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
sequencelengths
1.02k
1.02k
labels
sequencelengths
1.02k
1.02k
attention_mask
sequencelengths
1.02k
1.02k
tequa/ammisoft
ammimain/WinPython-64bit-2.7.13.1Zero/python-2.7.13.amd64/Lib/site-packages/pytz/reference.py
839
3649
''' Reference tzinfo implementations from the Python docs. Used for testing against as they are only correct for the years 1987 to 2006. Do not use these for real code. ''' from datetime import tzinfo, timedelta, datetime from pytz import utc, UTC, HOUR, ZERO # A class building tzinfo objects for fixed-offset time zones. # Note that FixedOffset(0, "UTC") is a different way to build a # UTC tzinfo object. class FixedOffset(tzinfo): """Fixed offset in minutes east from UTC.""" def __init__(self, offset, name): self.__offset = timedelta(minutes = offset) self.__name = name def utcoffset(self, dt): return self.__offset def tzname(self, dt): return self.__name def dst(self, dt): return ZERO # A class capturing the platform's idea of local time. import time as _time STDOFFSET = timedelta(seconds = -_time.timezone) if _time.daylight: DSTOFFSET = timedelta(seconds = -_time.altzone) else: DSTOFFSET = STDOFFSET DSTDIFF = DSTOFFSET - STDOFFSET class LocalTimezone(tzinfo): def utcoffset(self, dt): if self._isdst(dt): return DSTOFFSET else: return STDOFFSET def dst(self, dt): if self._isdst(dt): return DSTDIFF else: return ZERO def tzname(self, dt): return _time.tzname[self._isdst(dt)] def _isdst(self, dt): tt = (dt.year, dt.month, dt.day, dt.hour, dt.minute, dt.second, dt.weekday(), 0, -1) stamp = _time.mktime(tt) tt = _time.localtime(stamp) return tt.tm_isdst > 0 Local = LocalTimezone() # A complete implementation of current DST rules for major US time zones. def first_sunday_on_or_after(dt): days_to_go = 6 - dt.weekday() if days_to_go: dt += timedelta(days_to_go) return dt # In the US, DST starts at 2am (standard time) on the first Sunday in April. DSTSTART = datetime(1, 4, 1, 2) # and ends at 2am (DST time; 1am standard time) on the last Sunday of Oct. # which is the first Sunday on or after Oct 25. DSTEND = datetime(1, 10, 25, 1) class USTimeZone(tzinfo): def __init__(self, hours, reprname, stdname, dstname): self.stdoffset = timedelta(hours=hours) self.reprname = reprname self.stdname = stdname self.dstname = dstname def __repr__(self): return self.reprname def tzname(self, dt): if self.dst(dt): return self.dstname else: return self.stdname def utcoffset(self, dt): return self.stdoffset + self.dst(dt) def dst(self, dt): if dt is None or dt.tzinfo is None: # An exception may be sensible here, in one or both cases. # It depends on how you want to treat them. The default # fromutc() implementation (called by the default astimezone() # implementation) passes a datetime with dt.tzinfo is self. return ZERO assert dt.tzinfo is self # Find first Sunday in April & the last in October. start = first_sunday_on_or_after(DSTSTART.replace(year=dt.year)) end = first_sunday_on_or_after(DSTEND.replace(year=dt.year)) # Can't compare naive to aware objects, so strip the timezone from # dt first. if start <= dt.replace(tzinfo=None) < end: return HOUR else: return ZERO Eastern = USTimeZone(-5, "Eastern", "EST", "EDT") Central = USTimeZone(-6, "Central", "CST", "CDT") Mountain = USTimeZone(-7, "Mountain", "MST", "MDT") Pacific = USTimeZone(-8, "Pacific", "PST", "PDT")
bsd-3-clause
[ 2344, 199, 5083, 10313, 12591, 687, 314, 2018, 9149, 14, 199, 9167, 367, 5343, 6169, 465, 2985, 787, 1454, 3211, 367, 314, 17399, 199, 30828, 370, 8315, 14, 4226, 440, 675, 3520, 367, 3363, 1233, 14, 199, 2344, 199, 199, 504, 2197, 492, 10313, 12, 6871, 12, 2197, 199, 504, 15444, 492, 19314, 12, 12174, 12, 7781, 1230, 12, 20348, 199, 199, 3, 437, 1021, 10015, 10313, 2251, 367, 6317, 13, 2743, 900, 18666, 14, 199, 3, 3390, 626, 18659, 6397, 8, 16, 12, 298, 11288, 531, 365, 282, 3365, 4340, 370, 1900, 282, 199, 3, 12174, 10313, 909, 14, 199, 199, 533, 18659, 6397, 8, 9374, 304, 272, 408, 9515, 3268, 315, 9395, 30254, 687, 12174, 1041, 339, 347, 636, 826, 721, 277, 12, 3268, 12, 536, 304, 267, 291, 855, 2743, 275, 6871, 8, 10430, 275, 3268, 9, 267, 291, 855, 354, 275, 536, 339, 347, 11430, 18102, 8, 277, 12, 4487, 304, 267, 372, 291, 855, 2743, 339, 347, 28054, 8, 277, 12, 4487, 304, 267, 372, 291, 855, 354, 339, 347, 5042, 8, 277, 12, 4487, 304, 267, 372, 20348, 199, 199, 3, 437, 1021, 12162, 4039, 314, 4298, 1159, 16819, 402, 2257, 900, 14, 199, 199, 646, 900, 465, 485, 521, 199, 199, 840, 1649, 1665, 3597, 275, 6871, 8, 4515, 275, 446, 63, 521, 14, 7145, 9, 199, 692, 485, 521, 14, 2977, 4040, 26, 272, 22782, 14839, 275, 6871, 8, 4515, 275, 446, 63, 521, 14, 4478, 2619, 9, 199, 2836, 26, 272, 22782, 14839, 275, 4384, 1649, 1665, 3597, 199, 199, 18651, 10596, 275, 22782, 14839, 446, 4384, 1649, 1665, 3597, 199, 199, 533, 10111, 28705, 8, 9374, 304, 339, 347, 11430, 18102, 8, 277, 12, 4487, 304, 267, 340, 291, 423, 374, 5119, 8, 3583, 304, 288, 372, 22782, 14839, 267, 587, 26, 288, 372, 4384, 1649, 1665, 3597, 339, 347, 5042, 8, 277, 12, 4487, 304, 267, 340, 291, 423, 374, 5119, 8, 3583, 304, 288, 372, 22782, 10596, 267, 587, 26, 288, 372, 20348, 339, 347, 28054, 8, 277, 12, 4487, 304, 267, 372, 485, 521, 14, 20027, 59, 277, 423, 374, 5119, 8, 3583, 1874, 339, 347, 485, 374, 5119, 8, 277, 12, 4487, 304, 267, 13638, 275, 334, 3583, 14, 3403, 12, 4487, 14, 4482, 12, 4487, 14, 2977, 12, 1598, 4487, 14, 5180, 12, 4487, 14, 10698, 12, 4487, 14, 4375, 12, 1598, 4487, 14, 12451, 1062, 378, 12, 446, 17, 9, 267, 16206, 275, 485, 521, 14, 23456, 8, 6215, 9, 267, 13638, 275, 485, 521, 14, 15198, 8, 2359, 9, 267, 372, 13638, 14, 7574, 63, 374, 5119, 690, 378, 199, 199, 5339, 275, 10111, 28705, 342, 199, 199, 3, 437, 4890, 4514, 402, 1453, 22782, 4713, 367, 12160, 19635, 900, 18666, 14, 199, 199, 318, 1642, 63, 83, 24759, 63, 265, 63, 269, 63, 4399, 8, 3583, 304, 272, 7609, 63, 475, 63, 1939, 275, 1227, 446, 4487, 14, 12451, 342, 272, 340, 7609, 63, 475, 63, 1939, 26, 267, 4487, 847, 6871, 8, 4899, 63, 475, 63, 1939, 9, 272, 372, 4487, 199, 199, 3, 1010, 314, 19635, 12, 22782, 9174, 737, 499, 455, 334, 6807, 900, 9, 641, 314, 1642, 428, 24759, 315, 437, 28026, 14, 199, 18651, 7363, 275, 2197, 8, 17, 12, 841, 12, 413, 12, 499, 9, 199, 3, 436, 11187, 737, 499, 455, 334, 18651, 900, 27, 413, 455, 4465, 900, 9, 641, 314, 2061, 428, 24759, 402, 18365, 14, 199, 3, 1314, 365, 314, 1642, 428, 24759, 641, 503, 2410, 18365, 5661, 14, 199, 18651, 3902, 275, 2197, 8, 17, 12, 1616, 12, 5661, 12, 413, 9, 199, 199, 533, 738, 840, 1036, 11860, 8, 9374, 304, 339, 347, 636, 826, 721, 277, 12, 10857, 12, 4700, 354, 12, 2418, 354, 12, 5042, 354, 304, 267, 291, 14, 270, 1117, 12449, 275, 6871, 8, 8419, 29, 8419, 9, 267, 291, 14, 2722, 354, 275, 4700, 354, 267, 291, 14, 1516, 354, 275, 2418, 354, 267, 291, 14, 5119, 354, 275, 5042, 354, 339, 347, 636, 2722, 721, 277, 304, 267, 372, 291, 14, 2722, 354, 339, 347, 28054, 8, 277, 12, 4487, 304, 267, 340, 291, 14, 5119, 8, 3583, 304, 288, 372, 291, 14, 5119, 354, 267, 587, 26, 288, 372, 291, 14, 1516, 354, 339, 347, 11430, 18102, 8, 277, 12, 4487, 304, 267, 372, 291, 14, 270, 1117, 12449, 435, 291, 14, 5119, 8, 3583, 9, 339, 347, 5042, 8, 277, 12, 4487, 304, 267, 340, 4487, 365, 488, 503, 4487, 14, 9374, 365, 488, 26, 288, 327, 1626, 1919, 1443, 506, 27962, 2348, 12, 315, 1373, 503, 3865, 5560, 14, 288, 327, 2779, 8350, 641, 4212, 1265, 2934, 370, 14312, 3062, 14, 221, 710, 849, 288, 327, 687, 5834, 342, 4514, 334, 3527, 701, 314, 849, 6073, 27636, 342, 288, 327, 4514, 9, 14933, 282, 2197, 543, 4487, 14, 9374, 365, 291, 14, 288, 372, 20348, 267, 702, 4487, 14, 9374, 365, 291, 398, 327, 6668, 1642, 428, 24759, 315, 437, 28026, 1253, 314, 2061, 315, 18365, 22459, 14, 267, 1343, 275, 1642, 63, 83, 24759, 63, 265, 63, 269, 63, 4399, 8, 18651, 7363, 14, 1814, 8, 3403, 29, 3583, 14, 3403, 430, 267, 1284, 275, 1642, 63, 83, 24759, 63, 265, 63, 269, 63, 4399, 8, 18651, 3902, 14, 1814, 8, 3403, 29, 3583, 14, 3403, 430, 398, 327, 6855, 1133, 6540, 19995, 370, 20381, 2251, 12, 880, 6202, 314, 7137, 687, 267, 327, 4487, 1642, 14, 267, 340, 1343, 2695, 4487, 14, 1814, 8, 9374, 29, 403, 9, 665, 1284, 26, 288, 372, 7781, 1230, 267, 587, 26, 288, 372, 20348, 199, 199, 32661, 221, 275, 738, 840, 1036, 11860, 2801, 21, 12, 298, 32661, 401, 221, 298, 1719, 401, 298, 1149, 52, 531, 199, 25290, 221, 275, 738, 840, 1036, 11860, 2801, 22, 12, 298, 25290, 401, 221, 298, 35, 840, 401, 298, 35, 7438, 531, 199, 3716, 324, 877, 275, 738, 840, 1036, 11860, 2801, 23, 12, 298, 3716, 324, 877, 401, 298, 45, 840, 401, 298, 5127, 52, 531, 199, 20687, 221, 275, 738, 840, 1036, 11860, 2801, 24, 12, 298, 20687, 401, 221, 298, 48, 840, 401, 298, 48 ]
[ 199, 5083, 10313, 12591, 687, 314, 2018, 9149, 14, 199, 9167, 367, 5343, 6169, 465, 2985, 787, 1454, 3211, 367, 314, 17399, 199, 30828, 370, 8315, 14, 4226, 440, 675, 3520, 367, 3363, 1233, 14, 199, 2344, 199, 199, 504, 2197, 492, 10313, 12, 6871, 12, 2197, 199, 504, 15444, 492, 19314, 12, 12174, 12, 7781, 1230, 12, 20348, 199, 199, 3, 437, 1021, 10015, 10313, 2251, 367, 6317, 13, 2743, 900, 18666, 14, 199, 3, 3390, 626, 18659, 6397, 8, 16, 12, 298, 11288, 531, 365, 282, 3365, 4340, 370, 1900, 282, 199, 3, 12174, 10313, 909, 14, 199, 199, 533, 18659, 6397, 8, 9374, 304, 272, 408, 9515, 3268, 315, 9395, 30254, 687, 12174, 1041, 339, 347, 636, 826, 721, 277, 12, 3268, 12, 536, 304, 267, 291, 855, 2743, 275, 6871, 8, 10430, 275, 3268, 9, 267, 291, 855, 354, 275, 536, 339, 347, 11430, 18102, 8, 277, 12, 4487, 304, 267, 372, 291, 855, 2743, 339, 347, 28054, 8, 277, 12, 4487, 304, 267, 372, 291, 855, 354, 339, 347, 5042, 8, 277, 12, 4487, 304, 267, 372, 20348, 199, 199, 3, 437, 1021, 12162, 4039, 314, 4298, 1159, 16819, 402, 2257, 900, 14, 199, 199, 646, 900, 465, 485, 521, 199, 199, 840, 1649, 1665, 3597, 275, 6871, 8, 4515, 275, 446, 63, 521, 14, 7145, 9, 199, 692, 485, 521, 14, 2977, 4040, 26, 272, 22782, 14839, 275, 6871, 8, 4515, 275, 446, 63, 521, 14, 4478, 2619, 9, 199, 2836, 26, 272, 22782, 14839, 275, 4384, 1649, 1665, 3597, 199, 199, 18651, 10596, 275, 22782, 14839, 446, 4384, 1649, 1665, 3597, 199, 199, 533, 10111, 28705, 8, 9374, 304, 339, 347, 11430, 18102, 8, 277, 12, 4487, 304, 267, 340, 291, 423, 374, 5119, 8, 3583, 304, 288, 372, 22782, 14839, 267, 587, 26, 288, 372, 4384, 1649, 1665, 3597, 339, 347, 5042, 8, 277, 12, 4487, 304, 267, 340, 291, 423, 374, 5119, 8, 3583, 304, 288, 372, 22782, 10596, 267, 587, 26, 288, 372, 20348, 339, 347, 28054, 8, 277, 12, 4487, 304, 267, 372, 485, 521, 14, 20027, 59, 277, 423, 374, 5119, 8, 3583, 1874, 339, 347, 485, 374, 5119, 8, 277, 12, 4487, 304, 267, 13638, 275, 334, 3583, 14, 3403, 12, 4487, 14, 4482, 12, 4487, 14, 2977, 12, 1598, 4487, 14, 5180, 12, 4487, 14, 10698, 12, 4487, 14, 4375, 12, 1598, 4487, 14, 12451, 1062, 378, 12, 446, 17, 9, 267, 16206, 275, 485, 521, 14, 23456, 8, 6215, 9, 267, 13638, 275, 485, 521, 14, 15198, 8, 2359, 9, 267, 372, 13638, 14, 7574, 63, 374, 5119, 690, 378, 199, 199, 5339, 275, 10111, 28705, 342, 199, 199, 3, 437, 4890, 4514, 402, 1453, 22782, 4713, 367, 12160, 19635, 900, 18666, 14, 199, 199, 318, 1642, 63, 83, 24759, 63, 265, 63, 269, 63, 4399, 8, 3583, 304, 272, 7609, 63, 475, 63, 1939, 275, 1227, 446, 4487, 14, 12451, 342, 272, 340, 7609, 63, 475, 63, 1939, 26, 267, 4487, 847, 6871, 8, 4899, 63, 475, 63, 1939, 9, 272, 372, 4487, 199, 199, 3, 1010, 314, 19635, 12, 22782, 9174, 737, 499, 455, 334, 6807, 900, 9, 641, 314, 1642, 428, 24759, 315, 437, 28026, 14, 199, 18651, 7363, 275, 2197, 8, 17, 12, 841, 12, 413, 12, 499, 9, 199, 3, 436, 11187, 737, 499, 455, 334, 18651, 900, 27, 413, 455, 4465, 900, 9, 641, 314, 2061, 428, 24759, 402, 18365, 14, 199, 3, 1314, 365, 314, 1642, 428, 24759, 641, 503, 2410, 18365, 5661, 14, 199, 18651, 3902, 275, 2197, 8, 17, 12, 1616, 12, 5661, 12, 413, 9, 199, 199, 533, 738, 840, 1036, 11860, 8, 9374, 304, 339, 347, 636, 826, 721, 277, 12, 10857, 12, 4700, 354, 12, 2418, 354, 12, 5042, 354, 304, 267, 291, 14, 270, 1117, 12449, 275, 6871, 8, 8419, 29, 8419, 9, 267, 291, 14, 2722, 354, 275, 4700, 354, 267, 291, 14, 1516, 354, 275, 2418, 354, 267, 291, 14, 5119, 354, 275, 5042, 354, 339, 347, 636, 2722, 721, 277, 304, 267, 372, 291, 14, 2722, 354, 339, 347, 28054, 8, 277, 12, 4487, 304, 267, 340, 291, 14, 5119, 8, 3583, 304, 288, 372, 291, 14, 5119, 354, 267, 587, 26, 288, 372, 291, 14, 1516, 354, 339, 347, 11430, 18102, 8, 277, 12, 4487, 304, 267, 372, 291, 14, 270, 1117, 12449, 435, 291, 14, 5119, 8, 3583, 9, 339, 347, 5042, 8, 277, 12, 4487, 304, 267, 340, 4487, 365, 488, 503, 4487, 14, 9374, 365, 488, 26, 288, 327, 1626, 1919, 1443, 506, 27962, 2348, 12, 315, 1373, 503, 3865, 5560, 14, 288, 327, 2779, 8350, 641, 4212, 1265, 2934, 370, 14312, 3062, 14, 221, 710, 849, 288, 327, 687, 5834, 342, 4514, 334, 3527, 701, 314, 849, 6073, 27636, 342, 288, 327, 4514, 9, 14933, 282, 2197, 543, 4487, 14, 9374, 365, 291, 14, 288, 372, 20348, 267, 702, 4487, 14, 9374, 365, 291, 398, 327, 6668, 1642, 428, 24759, 315, 437, 28026, 1253, 314, 2061, 315, 18365, 22459, 14, 267, 1343, 275, 1642, 63, 83, 24759, 63, 265, 63, 269, 63, 4399, 8, 18651, 7363, 14, 1814, 8, 3403, 29, 3583, 14, 3403, 430, 267, 1284, 275, 1642, 63, 83, 24759, 63, 265, 63, 269, 63, 4399, 8, 18651, 3902, 14, 1814, 8, 3403, 29, 3583, 14, 3403, 430, 398, 327, 6855, 1133, 6540, 19995, 370, 20381, 2251, 12, 880, 6202, 314, 7137, 687, 267, 327, 4487, 1642, 14, 267, 340, 1343, 2695, 4487, 14, 1814, 8, 9374, 29, 403, 9, 665, 1284, 26, 288, 372, 7781, 1230, 267, 587, 26, 288, 372, 20348, 199, 199, 32661, 221, 275, 738, 840, 1036, 11860, 2801, 21, 12, 298, 32661, 401, 221, 298, 1719, 401, 298, 1149, 52, 531, 199, 25290, 221, 275, 738, 840, 1036, 11860, 2801, 22, 12, 298, 25290, 401, 221, 298, 35, 840, 401, 298, 35, 7438, 531, 199, 3716, 324, 877, 275, 738, 840, 1036, 11860, 2801, 23, 12, 298, 3716, 324, 877, 401, 298, 45, 840, 401, 298, 5127, 52, 531, 199, 20687, 221, 275, 738, 840, 1036, 11860, 2801, 24, 12, 298, 20687, 401, 221, 298, 48, 840, 401, 298, 48, 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,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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 ]
gronnbeck/udacity-deep-learning
embeddings/utils.py
150
2194
import re from collections import Counter def preprocess(text): # Replace punctuation with tokens so we can use them in our model text = text.lower() text = text.replace('.', ' <PERIOD> ') text = text.replace(',', ' <COMMA> ') text = text.replace('"', ' <QUOTATION_MARK> ') text = text.replace(';', ' <SEMICOLON> ') text = text.replace('!', ' <EXCLAMATION_MARK> ') text = text.replace('?', ' <QUESTION_MARK> ') text = text.replace('(', ' <LEFT_PAREN> ') text = text.replace(')', ' <RIGHT_PAREN> ') text = text.replace('--', ' <HYPHENS> ') text = text.replace('?', ' <QUESTION_MARK> ') # text = text.replace('\n', ' <NEW_LINE> ') text = text.replace(':', ' <COLON> ') words = text.split() # Remove all words with 5 or fewer occurences word_counts = Counter(words) trimmed_words = [word for word in words if word_counts[word] > 5] return trimmed_words def get_batches(int_text, batch_size, seq_length): """ Return batches of input and target :param int_text: Text with the words replaced by their ids :param batch_size: The size of batch :param seq_length: The length of sequence :return: A list where each item is a tuple of (batch of input, batch of target). """ n_batches = int(len(int_text) / (batch_size * seq_length)) # Drop the last few characters to make only full batches xdata = np.array(int_text[: n_batches * batch_size * seq_length]) ydata = np.array(int_text[1: n_batches * batch_size * seq_length + 1]) x_batches = np.split(xdata.reshape(batch_size, -1), n_batches, 1) y_batches = np.split(ydata.reshape(batch_size, -1), n_batches, 1) return list(zip(x_batches, y_batches)) def create_lookup_tables(words): """ Create lookup tables for vocabulary :param words: Input list of words :return: A tuple of dicts. The first dict.... """ word_counts = Counter(words) sorted_vocab = sorted(word_counts, key=word_counts.get, reverse=True) int_to_vocab = {ii: word for ii, word in enumerate(sorted_vocab)} vocab_to_int = {word: ii for ii, word in int_to_vocab.items()} return vocab_to_int, int_to_vocab
mit
[ 646, 295, 199, 504, 5055, 492, 14427, 199, 199, 318, 23351, 8, 505, 304, 339, 327, 14402, 22929, 543, 4645, 880, 781, 883, 675, 3062, 315, 4154, 1402, 272, 1318, 275, 1318, 14, 2325, 342, 272, 1318, 275, 1318, 14, 1814, 14078, 283, 665, 27081, 30, 5320, 272, 1318, 275, 1318, 14, 1814, 32718, 283, 665, 11265, 2054, 30, 5320, 272, 1318, 275, 1318, 14, 1814, 20630, 283, 665, 18654, 2594, 63, 10520, 30, 5320, 272, 1318, 275, 1318, 14, 1814, 360, 10805, 283, 665, 899, 17233, 22670, 30, 5320, 272, 1318, 275, 1318, 14, 1814, 360, 12389, 283, 665, 1438, 23371, 63, 10520, 30, 5320, 272, 1318, 275, 1318, 14, 1814, 360, 7044, 283, 665, 2328, 19212, 63, 10520, 30, 5320, 272, 1318, 275, 1318, 14, 1814, 360, 5102, 283, 665, 9894, 63, 22169, 30, 5320, 272, 1318, 275, 1318, 14, 1814, 15938, 297, 283, 665, 12811, 63, 22169, 30, 5320, 272, 1318, 275, 1318, 14, 1814, 4517, 297, 283, 665, 40, 21150, 8456, 30, 5320, 272, 1318, 275, 1318, 14, 1814, 360, 7044, 283, 665, 2328, 19212, 63, 10520, 30, 5320, 272, 327, 1318, 275, 1318, 14, 1814, 2258, 78, 297, 283, 665, 11365, 63, 6174, 30, 5320, 272, 1318, 275, 1318, 14, 1814, 16451, 283, 665, 3978, 615, 30, 5320, 272, 5932, 275, 1318, 14, 1294, 342, 2286, 327, 5852, 1006, 5932, 543, 221, 959, 503, 27392, 14706, 608, 78, 823, 272, 4349, 63, 6851, 275, 14427, 8, 3148, 9, 272, 24196, 63, 3148, 275, 359, 1027, 367, 4349, 315, 5932, 340, 4349, 63, 6851, 59, 1027, 61, 690, 959, 61, 339, 372, 24196, 63, 3148, 199, 199, 318, 664, 63, 14896, 8, 442, 63, 505, 12, 3522, 63, 890, 12, 5412, 63, 1267, 304, 272, 408, 272, 1432, 19593, 402, 1324, 436, 1347, 272, 520, 635, 1109, 63, 505, 26, 4516, 543, 314, 5932, 8717, 701, 3932, 2762, 272, 520, 635, 3522, 63, 890, 26, 710, 1568, 402, 3522, 272, 520, 635, 5412, 63, 1267, 26, 710, 2582, 402, 3414, 272, 520, 1107, 26, 437, 769, 2382, 1924, 1242, 365, 282, 2008, 402, 334, 2912, 402, 1324, 12, 3522, 402, 1347, 680, 272, 408, 272, 302, 63, 14896, 275, 1109, 8, 552, 8, 442, 63, 505, 9, 1182, 334, 2912, 63, 890, 627, 5412, 63, 1267, 430, 339, 327, 18110, 314, 2061, 9284, 4110, 370, 1852, 1454, 2615, 19593, 272, 671, 576, 275, 980, 14, 1144, 8, 442, 63, 505, 1491, 302, 63, 14896, 627, 3522, 63, 890, 627, 5412, 63, 1267, 566, 272, 612, 576, 275, 980, 14, 1144, 8, 442, 63, 505, 59, 17, 26, 302, 63, 14896, 627, 3522, 63, 890, 627, 5412, 63, 1267, 435, 413, 566, 339, 671, 63, 14896, 275, 980, 14, 1294, 8, 31643, 14, 5217, 8, 2912, 63, 890, 12, 446, 17, 395, 302, 63, 14896, 12, 413, 9, 272, 612, 63, 14896, 275, 980, 14, 1294, 8, 89, 576, 14, 5217, 8, 2912, 63, 890, 12, 446, 17, 395, 302, 63, 14896, 12, 413, 9, 339, 372, 769, 8, 3065, 8, 88, 63, 14896, 12, 612, 63, 14896, 430, 421, 199, 318, 1218, 63, 3892, 63, 5987, 8, 3148, 304, 272, 408, 272, 2790, 4237, 6716, 367, 17515, 272, 520, 635, 5932, 26, 6924, 769, 402, 5932, 272, 520, 1107, 26, 437, 2008, 402, 10809, 14, 221, 710, 1642, 1211, 4496, 272, 408, 272, 4349, 63, 6851, 275, 14427, 8, 3148, 9, 272, 3355, 63, 9953, 275, 3355, 8, 1027, 63, 6851, 12, 790, 29, 1027, 63, 6851, 14, 362, 12, 3837, 29, 549, 9, 272, 1109, 63, 475, 63, 9953, 275, 469, 5908, 26, 4349, 367, 15393, 12, 4349, 315, 3874, 8, 5917, 63, 9953, 6769, 272, 11181, 63, 475, 63, 442, 275, 469, 1027, 26, 15393, 367, 15393, 12, 4349, 315, 1109, 63, 475, 63, 9953, 14, 1744, 12737, 339, 372, 11181, 63, 475, 63, 442, 12, 1109, 63, 475, 63, 9953, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768 ]
[ 295, 199, 504, 5055, 492, 14427, 199, 199, 318, 23351, 8, 505, 304, 339, 327, 14402, 22929, 543, 4645, 880, 781, 883, 675, 3062, 315, 4154, 1402, 272, 1318, 275, 1318, 14, 2325, 342, 272, 1318, 275, 1318, 14, 1814, 14078, 283, 665, 27081, 30, 5320, 272, 1318, 275, 1318, 14, 1814, 32718, 283, 665, 11265, 2054, 30, 5320, 272, 1318, 275, 1318, 14, 1814, 20630, 283, 665, 18654, 2594, 63, 10520, 30, 5320, 272, 1318, 275, 1318, 14, 1814, 360, 10805, 283, 665, 899, 17233, 22670, 30, 5320, 272, 1318, 275, 1318, 14, 1814, 360, 12389, 283, 665, 1438, 23371, 63, 10520, 30, 5320, 272, 1318, 275, 1318, 14, 1814, 360, 7044, 283, 665, 2328, 19212, 63, 10520, 30, 5320, 272, 1318, 275, 1318, 14, 1814, 360, 5102, 283, 665, 9894, 63, 22169, 30, 5320, 272, 1318, 275, 1318, 14, 1814, 15938, 297, 283, 665, 12811, 63, 22169, 30, 5320, 272, 1318, 275, 1318, 14, 1814, 4517, 297, 283, 665, 40, 21150, 8456, 30, 5320, 272, 1318, 275, 1318, 14, 1814, 360, 7044, 283, 665, 2328, 19212, 63, 10520, 30, 5320, 272, 327, 1318, 275, 1318, 14, 1814, 2258, 78, 297, 283, 665, 11365, 63, 6174, 30, 5320, 272, 1318, 275, 1318, 14, 1814, 16451, 283, 665, 3978, 615, 30, 5320, 272, 5932, 275, 1318, 14, 1294, 342, 2286, 327, 5852, 1006, 5932, 543, 221, 959, 503, 27392, 14706, 608, 78, 823, 272, 4349, 63, 6851, 275, 14427, 8, 3148, 9, 272, 24196, 63, 3148, 275, 359, 1027, 367, 4349, 315, 5932, 340, 4349, 63, 6851, 59, 1027, 61, 690, 959, 61, 339, 372, 24196, 63, 3148, 199, 199, 318, 664, 63, 14896, 8, 442, 63, 505, 12, 3522, 63, 890, 12, 5412, 63, 1267, 304, 272, 408, 272, 1432, 19593, 402, 1324, 436, 1347, 272, 520, 635, 1109, 63, 505, 26, 4516, 543, 314, 5932, 8717, 701, 3932, 2762, 272, 520, 635, 3522, 63, 890, 26, 710, 1568, 402, 3522, 272, 520, 635, 5412, 63, 1267, 26, 710, 2582, 402, 3414, 272, 520, 1107, 26, 437, 769, 2382, 1924, 1242, 365, 282, 2008, 402, 334, 2912, 402, 1324, 12, 3522, 402, 1347, 680, 272, 408, 272, 302, 63, 14896, 275, 1109, 8, 552, 8, 442, 63, 505, 9, 1182, 334, 2912, 63, 890, 627, 5412, 63, 1267, 430, 339, 327, 18110, 314, 2061, 9284, 4110, 370, 1852, 1454, 2615, 19593, 272, 671, 576, 275, 980, 14, 1144, 8, 442, 63, 505, 1491, 302, 63, 14896, 627, 3522, 63, 890, 627, 5412, 63, 1267, 566, 272, 612, 576, 275, 980, 14, 1144, 8, 442, 63, 505, 59, 17, 26, 302, 63, 14896, 627, 3522, 63, 890, 627, 5412, 63, 1267, 435, 413, 566, 339, 671, 63, 14896, 275, 980, 14, 1294, 8, 31643, 14, 5217, 8, 2912, 63, 890, 12, 446, 17, 395, 302, 63, 14896, 12, 413, 9, 272, 612, 63, 14896, 275, 980, 14, 1294, 8, 89, 576, 14, 5217, 8, 2912, 63, 890, 12, 446, 17, 395, 302, 63, 14896, 12, 413, 9, 339, 372, 769, 8, 3065, 8, 88, 63, 14896, 12, 612, 63, 14896, 430, 421, 199, 318, 1218, 63, 3892, 63, 5987, 8, 3148, 304, 272, 408, 272, 2790, 4237, 6716, 367, 17515, 272, 520, 635, 5932, 26, 6924, 769, 402, 5932, 272, 520, 1107, 26, 437, 2008, 402, 10809, 14, 221, 710, 1642, 1211, 4496, 272, 408, 272, 4349, 63, 6851, 275, 14427, 8, 3148, 9, 272, 3355, 63, 9953, 275, 3355, 8, 1027, 63, 6851, 12, 790, 29, 1027, 63, 6851, 14, 362, 12, 3837, 29, 549, 9, 272, 1109, 63, 475, 63, 9953, 275, 469, 5908, 26, 4349, 367, 15393, 12, 4349, 315, 3874, 8, 5917, 63, 9953, 6769, 272, 11181, 63, 475, 63, 442, 275, 469, 1027, 26, 15393, 367, 15393, 12, 4349, 315, 1109, 63, 475, 63, 9953, 14, 1744, 12737, 339, 372, 11181, 63, 475, 63, 442, 12, 1109, 63, 475, 63, 9953, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 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, 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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 ]
ecell/libmoleculizer
python-src/bngparser/src/moleculizer/moleculeinterpreter.py
1
6341
############################################################################### # BNGMZRConverter - A utility program for converting bngl input files to mzr # input files. # Copyright (C) 2007, 2008, 2009 The Molecular Sciences Institute # # Moleculizer 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 3 of the License, or # (at your option) any later version. # # Moleculizer 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 Moleculizer; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # # Original Author: # Nathan Addy, Scientific Programmer Email: [email protected] # The Molecular Sciences Institute Email: [email protected] # # ############################################################################### from moleculizermol import MoleculizerMol, MoleculizerSmallMol, MoleculizerModMol, isSmallMol, isModMol from util import DataUnifier from xmlobject import XmlObject import pdb # This class parses a Mols Block into a list of small-mols and big mols. # It also manages the list of modifications. class MoleculeDictionary: class DuplicateMolDefinitionException(Exception): pass class BadMolDefinitionException(Exception): pass listOfNullModifications = ["none"] def __init__(self, moleculeBlock, paramDict): self.rawMoleculeDefinitions = moleculeBlock[:] self.paramDict = paramDict self.registeredMoleculesDictionary = {} self.smallMolsDictionary = {} self.modMolsDictionary = {} self.initialize() def initialize(self): self.rawMoleculeDefinitions = DataUnifier( self.rawMoleculeDefinitions ) for line in self.rawMoleculeDefinitions: if isSmallMol(line): print "SM: %s" % line MoleculizerSmallMol(line) elif isModMol(line): print "MM: %s" % line MoleculizerModMol(line) else: print "'%s' is neither a ModMol nor a SmallMol, according to the isSmallMol and isModMol functions." % line raise "Hello" def parseMoleculeTypesLine(self, moleculeTypesLine): parsedMol = MoleculizerMol(moleculeTypesLine) parsedMolName = parsedMol.getName() if parsedMolName in self.registeredMoleculesDictionary.keys(): raise DuplicateMolDefinitionException("Error, molecule %s already defined in the MoleculeInterpreter" % parsedMolName) self.registeredMoleculesDictionary[parsedMolName] = parsedMol def getUniversalModificationList(self): return MoleculizerMol.modificationStates[:] def addModifications(self, parentElmt): for modification in self.getUniversalModificationList(): modificationTypeElmt = XmlObject("modification") modificationTypeElmt.addAttribute("name", modification) modificationTypeElmt.attachToParent(parentElmt) weightElmt = XmlObject("weight-delta") weightElmt.attachToParent(modificationTypeElmt) if self.representsNullModification(modification): weightDelta = 0.0 else: weightDelta = 1.0 weightElmt.addAttribute("daltons", weightDelta) def addMols(self, parentElmt): for molName in self.registeredMoleculesDictionary.keys(): self.addModMolElmtToMolsElmt(parentElmt, self.registeredMoleculesDictionary[molName]) def addModMolElmt(self, parentElmt): pass def addModMolElmtToMolsElmt(self, xmlObject, moleculizerMolObject): assert(isinstance(xmlObject, XmlObject)) assert(isinstance(moleculizerMolObject, MoleculizerMol)) newModMol = XmlObject("mod-mol") newModMol.addAttribute("name", moleculizerMolObject.getName()) weightElement = XmlObject("weight") # Obviously this is one of the big deficiencies of this thing. What shall # we set the (mandatory) weights to? For now, let's just put in something # arbitratry. But this is a big issue that ought to be fixed as soon as all # the basic facilities of the code have been built in. if moleculizerMolObject.getName() == "Pheromone": weightElement.addAttribute("daltons", 10.0) else: weightElement.addAttribute("daltons", 100.0) newModMol.addSubElement(weightElement) for binding in moleculizerMolObject.bindingSites: self.addBindingSiteElmtToModMolElmt(binding, moleculizerMolObject, newModMol) for modification in moleculizerMolObject.modificationSites: modSite, defaultModState = modification modSiteElmt = XmlObject("mod-site") modSiteElmt.addAttribute("name", modSite) defModRefElmt = XmlObject("default-mod-ref") defModRefElmt.addAttribute("name", defaultModState) defModRefElmt.attachToParent(modSiteElmt).attachToParent(newModMol) xmlObject.addSubElement(newModMol) return def addBindingSiteElmtToModMolElmt(self, bindingName, moleculizerMol, xmlObject): newBindingElmt = XmlObject("binding-site") newBindingElmt.addAttribute("name", bindingName) defaultShape = XmlObject("default-shape-ref") defaultShape.addAttribute("name", "default") defaultShape.attachToParent(newBindingElmt) for shapeName in moleculizerMol.bindingSites[bindingName]: siteShapeElmt = XmlObject("site-shape") siteShapeElmt.addAttribute("name", shapeName) siteShapeElmt.attachToParent(newBindingElmt) xmlObject.addSubElement(newBindingElmt) return def representsNullModification(self, modificationType): return modificationType.lower() in MoleculeDictionary.listOfNullModifications
gpl-2.0
[ 11490, 199, 3, 699, 12259, 45, 58, 50, 11907, 446, 437, 11420, 2240, 367, 13806, 330, 2753, 76, 1324, 1584, 370, 333, 32605, 199, 3, 1057, 259, 1324, 1584, 14, 199, 3, 1898, 334, 35, 9, 10219, 12, 9079, 12, 8937, 710, 3930, 10251, 2238, 16578, 25231, 1010, 25585, 199, 3, 199, 3, 3930, 10251, 13987, 2282, 365, 2867, 2032, 27, 1265, 883, 3604, 652, 436, 15, 269, 2811, 199, 3, 652, 1334, 314, 2895, 402, 314, 1664, 6401, 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, 3930, 10251, 13987, 2282, 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, 6401, 1696, 1684, 844, 367, 1655, 2436, 14, 199, 3, 199, 3, 2047, 1077, 1172, 3086, 282, 1331, 402, 314, 1664, 6401, 1696, 1684, 844, 199, 3, 3180, 543, 3930, 10251, 13987, 2282, 27, 340, 440, 12, 2218, 370, 314, 2868, 2290, 199, 3, 2752, 12, 3277, 2020, 8155, 15630, 10902, 12, 14453, 13540, 12, 8226, 12, 4828, 221, 15673, 13, 13421, 221, 8217, 199, 3, 199, 3, 12769, 6529, 26, 199, 3, 257, 653, 1619, 290, 2654, 89, 12, 16578, 23509, 18841, 2626, 198, 7035, 26, 1050, 89, 32, 16924, 9907, 14, 1308, 199, 3, 257, 710, 3930, 10251, 2238, 16578, 25231, 1010, 25585, 259, 11426, 26, 1050, 89, 32, 16924, 9907, 14, 1308, 257, 199, 3, 10473, 199, 3, 259, 199, 11490, 199, 199, 504, 1303, 10251, 13987, 2282, 16924, 492, 3930, 10251, 13987, 2282, 45, 393, 12, 3930, 10251, 13987, 2282, 10712, 45, 393, 12, 3930, 10251, 13987, 2282, 9871, 45, 393, 12, 365, 10712, 45, 393, 12, 365, 9871, 45, 393, 199, 199, 504, 4884, 492, 3918, 1358, 9893, 199, 199, 504, 17725, 27789, 492, 24881, 1692, 199, 646, 10543, 421, 199, 3, 961, 1021, 19953, 282, 603, 1446, 8651, 1901, 282, 769, 402, 7425, 13, 77, 1446, 436, 7282, 333, 1446, 14, 199, 3, 2779, 2597, 31965, 314, 769, 402, 23070, 14, 199, 199, 533, 3930, 14413, 11728, 26, 272, 1021, 23942, 45, 393, 10701, 1726, 8, 1726, 304, 986, 272, 1021, 8857, 45, 393, 10701, 1726, 8, 1726, 304, 986, 339, 769, 3466, 8849, 29188, 83, 275, 2097, 3592, 937, 339, 347, 636, 826, 721, 277, 12, 26350, 3142, 12, 1215, 2141, 304, 267, 291, 14, 1773, 3716, 14413, 16738, 275, 26350, 3142, 5873, 398, 291, 14, 635, 2141, 275, 1215, 2141, 398, 291, 14, 11616, 3716, 14413, 83, 11728, 275, 1052, 267, 291, 14, 7241, 45, 1446, 11728, 275, 1052, 267, 291, 14, 1494, 45, 1446, 11728, 275, 1052, 398, 291, 14, 8489, 342, 339, 347, 8265, 8, 277, 304, 267, 291, 14, 1773, 3716, 14413, 16738, 275, 3918, 1358, 9893, 8, 291, 14, 1773, 3716, 14413, 16738, 776, 398, 367, 1004, 315, 291, 14, 1773, 3716, 14413, 16738, 26, 288, 340, 365, 10712, 45, 393, 8, 604, 304, 355, 870, 298, 4029, 26, 450, 83, 2, 450, 1004, 355, 3930, 10251, 13987, 2282, 10712, 45, 393, 8, 604, 9, 288, 916, 365, 9871, 45, 393, 8, 604, 304, 355, 870, 298, 3218, 26, 450, 83, 2, 450, 1004, 355, 3930, 10251, 13987, 2282, 9871, 45, 393, 8, 604, 9, 288, 587, 26, 355, 870, 17648, 83, 7, 365, 15564, 282, 22035, 45, 393, 6590, 282, 23704, 45, 393, 12, 7182, 370, 314, 365, 10712, 45, 393, 436, 365, 9871, 45, 393, 3423, 2122, 450, 1004, 355, 746, 298, 6257, 2, 268, 339, 347, 2198, 3716, 14413, 4100, 3049, 8, 277, 12, 26350, 4100, 3049, 304, 398, 4565, 45, 393, 275, 3930, 10251, 13987, 2282, 45, 393, 8, 26310, 4100, 3049, 9, 267, 4565, 45, 393, 985, 275, 4565, 45, 393, 14, 16405, 342, 398, 340, 4565, 45, 393, 985, 315, 291, 14, 11616, 3716, 14413, 83, 11728, 14, 1612, 837, 288, 746, 23942, 45, 393, 10701, 1726, 480, 547, 12, 26350, 450, 83, 2575, 3247, 315, 314, 3930, 14413, 2620, 26499, 2, 450, 4565, 45, 393, 985, 9, 398, 291, 14, 11616, 3716, 14413, 83, 11728, 59, 6751, 45, 393, 985, 61, 275, 4565, 45, 393, 16478, 347, 664, 1358, 10959, 29188, 1296, 8, 277, 304, 267, 372, 3930, 10251, 13987, 2282, 45, 393, 14, 20945, 18010, 5873, 2378, 347, 1050, 29188, 83, 8, 277, 12, 1676, 10420, 2037, 304, 267, 367, 7100, 315, 291, 14, 362, 1358, 10959, 29188, 1296, 837, 288, 7100, 804, 10420, 2037, 275, 24881, 1692, 480, 20945, 531, 288, 7100, 804, 10420, 2037, 14, 525, 1646, 480, 354, 401, 7100, 9, 288, 7100, 804, 10420, 2037, 14, 5040, 1378, 6652, 8, 1708, 10420, 2037, 9, 3777, 953, 5401, 10420, 2037, 275, 24881, 1692, 480, 3463, 13, 3136, 531, 288, 5401, 10420, 2037, 14, 5040, 1378, 6652, 8, 20945, 804, 10420, 2037, 9, 953, 340, 291, 14, 13063, 83, 8849, 29188, 8, 20945, 304, 355, 5401, 13411, 275, 378, 14, 16, 288, 587, 26, 355, 5401, 13411, 275, 413, 14, 16, 953, 5401, 10420, 2037, 14, 525, 1646, 480, 12390, 1860, 83, 401, 5401, 13411, 9, 339, 347, 1050, 45, 1446, 8, 277, 12, 1676, 10420, 2037, 304, 267, 367, 22956, 985, 315, 291, 14, 11616, 3716, 14413, 83, 11728, 14, 1612, 837, 288, 291, 14, 525, 9871, 45, 393, 10420, 2037, 1378, 45, 1446, 10420, 2037, 8, 1708, 10420, 2037, 12, 291, 14, 11616, 3716, 14413, 83, 11728, 59, 16924, 985, 566, 3777, 339, 347, 1050, 9871, 45, 393, 10420, 2037, 8, 277, 12, 1676, 10420, 2037, 304, 267, 986, 2378, 347, 1050, 9871, 45, 393, 10420, 2037, 1378, 45, 1446, 10420, 2037, 8, 277, 12, 2748, 1692, 12, 1303, 10251, 13987, 2282, 45, 393, 1692, 304, 267, 702, 8, 6074, 8, 1652, 1692, 12, 24881, 1692, 430, 267, 702, 8, 6074, 8, 573, 10251, 13987, 2282, 45, 393, 1692, 12, 3930, 10251, 13987, 2282, 45, 393, 430, 398, 892, 9871, 45, 393, 275, 24881, 1692, 480, 1494, 13, 16924, 531, 267 ]
[ 199, 3, 699, 12259, 45, 58, 50, 11907, 446, 437, 11420, 2240, 367, 13806, 330, 2753, 76, 1324, 1584, 370, 333, 32605, 199, 3, 1057, 259, 1324, 1584, 14, 199, 3, 1898, 334, 35, 9, 10219, 12, 9079, 12, 8937, 710, 3930, 10251, 2238, 16578, 25231, 1010, 25585, 199, 3, 199, 3, 3930, 10251, 13987, 2282, 365, 2867, 2032, 27, 1265, 883, 3604, 652, 436, 15, 269, 2811, 199, 3, 652, 1334, 314, 2895, 402, 314, 1664, 6401, 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, 3930, 10251, 13987, 2282, 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, 6401, 1696, 1684, 844, 367, 1655, 2436, 14, 199, 3, 199, 3, 2047, 1077, 1172, 3086, 282, 1331, 402, 314, 1664, 6401, 1696, 1684, 844, 199, 3, 3180, 543, 3930, 10251, 13987, 2282, 27, 340, 440, 12, 2218, 370, 314, 2868, 2290, 199, 3, 2752, 12, 3277, 2020, 8155, 15630, 10902, 12, 14453, 13540, 12, 8226, 12, 4828, 221, 15673, 13, 13421, 221, 8217, 199, 3, 199, 3, 12769, 6529, 26, 199, 3, 257, 653, 1619, 290, 2654, 89, 12, 16578, 23509, 18841, 2626, 198, 7035, 26, 1050, 89, 32, 16924, 9907, 14, 1308, 199, 3, 257, 710, 3930, 10251, 2238, 16578, 25231, 1010, 25585, 259, 11426, 26, 1050, 89, 32, 16924, 9907, 14, 1308, 257, 199, 3, 10473, 199, 3, 259, 199, 11490, 199, 199, 504, 1303, 10251, 13987, 2282, 16924, 492, 3930, 10251, 13987, 2282, 45, 393, 12, 3930, 10251, 13987, 2282, 10712, 45, 393, 12, 3930, 10251, 13987, 2282, 9871, 45, 393, 12, 365, 10712, 45, 393, 12, 365, 9871, 45, 393, 199, 199, 504, 4884, 492, 3918, 1358, 9893, 199, 199, 504, 17725, 27789, 492, 24881, 1692, 199, 646, 10543, 421, 199, 3, 961, 1021, 19953, 282, 603, 1446, 8651, 1901, 282, 769, 402, 7425, 13, 77, 1446, 436, 7282, 333, 1446, 14, 199, 3, 2779, 2597, 31965, 314, 769, 402, 23070, 14, 199, 199, 533, 3930, 14413, 11728, 26, 272, 1021, 23942, 45, 393, 10701, 1726, 8, 1726, 304, 986, 272, 1021, 8857, 45, 393, 10701, 1726, 8, 1726, 304, 986, 339, 769, 3466, 8849, 29188, 83, 275, 2097, 3592, 937, 339, 347, 636, 826, 721, 277, 12, 26350, 3142, 12, 1215, 2141, 304, 267, 291, 14, 1773, 3716, 14413, 16738, 275, 26350, 3142, 5873, 398, 291, 14, 635, 2141, 275, 1215, 2141, 398, 291, 14, 11616, 3716, 14413, 83, 11728, 275, 1052, 267, 291, 14, 7241, 45, 1446, 11728, 275, 1052, 267, 291, 14, 1494, 45, 1446, 11728, 275, 1052, 398, 291, 14, 8489, 342, 339, 347, 8265, 8, 277, 304, 267, 291, 14, 1773, 3716, 14413, 16738, 275, 3918, 1358, 9893, 8, 291, 14, 1773, 3716, 14413, 16738, 776, 398, 367, 1004, 315, 291, 14, 1773, 3716, 14413, 16738, 26, 288, 340, 365, 10712, 45, 393, 8, 604, 304, 355, 870, 298, 4029, 26, 450, 83, 2, 450, 1004, 355, 3930, 10251, 13987, 2282, 10712, 45, 393, 8, 604, 9, 288, 916, 365, 9871, 45, 393, 8, 604, 304, 355, 870, 298, 3218, 26, 450, 83, 2, 450, 1004, 355, 3930, 10251, 13987, 2282, 9871, 45, 393, 8, 604, 9, 288, 587, 26, 355, 870, 17648, 83, 7, 365, 15564, 282, 22035, 45, 393, 6590, 282, 23704, 45, 393, 12, 7182, 370, 314, 365, 10712, 45, 393, 436, 365, 9871, 45, 393, 3423, 2122, 450, 1004, 355, 746, 298, 6257, 2, 268, 339, 347, 2198, 3716, 14413, 4100, 3049, 8, 277, 12, 26350, 4100, 3049, 304, 398, 4565, 45, 393, 275, 3930, 10251, 13987, 2282, 45, 393, 8, 26310, 4100, 3049, 9, 267, 4565, 45, 393, 985, 275, 4565, 45, 393, 14, 16405, 342, 398, 340, 4565, 45, 393, 985, 315, 291, 14, 11616, 3716, 14413, 83, 11728, 14, 1612, 837, 288, 746, 23942, 45, 393, 10701, 1726, 480, 547, 12, 26350, 450, 83, 2575, 3247, 315, 314, 3930, 14413, 2620, 26499, 2, 450, 4565, 45, 393, 985, 9, 398, 291, 14, 11616, 3716, 14413, 83, 11728, 59, 6751, 45, 393, 985, 61, 275, 4565, 45, 393, 16478, 347, 664, 1358, 10959, 29188, 1296, 8, 277, 304, 267, 372, 3930, 10251, 13987, 2282, 45, 393, 14, 20945, 18010, 5873, 2378, 347, 1050, 29188, 83, 8, 277, 12, 1676, 10420, 2037, 304, 267, 367, 7100, 315, 291, 14, 362, 1358, 10959, 29188, 1296, 837, 288, 7100, 804, 10420, 2037, 275, 24881, 1692, 480, 20945, 531, 288, 7100, 804, 10420, 2037, 14, 525, 1646, 480, 354, 401, 7100, 9, 288, 7100, 804, 10420, 2037, 14, 5040, 1378, 6652, 8, 1708, 10420, 2037, 9, 3777, 953, 5401, 10420, 2037, 275, 24881, 1692, 480, 3463, 13, 3136, 531, 288, 5401, 10420, 2037, 14, 5040, 1378, 6652, 8, 20945, 804, 10420, 2037, 9, 953, 340, 291, 14, 13063, 83, 8849, 29188, 8, 20945, 304, 355, 5401, 13411, 275, 378, 14, 16, 288, 587, 26, 355, 5401, 13411, 275, 413, 14, 16, 953, 5401, 10420, 2037, 14, 525, 1646, 480, 12390, 1860, 83, 401, 5401, 13411, 9, 339, 347, 1050, 45, 1446, 8, 277, 12, 1676, 10420, 2037, 304, 267, 367, 22956, 985, 315, 291, 14, 11616, 3716, 14413, 83, 11728, 14, 1612, 837, 288, 291, 14, 525, 9871, 45, 393, 10420, 2037, 1378, 45, 1446, 10420, 2037, 8, 1708, 10420, 2037, 12, 291, 14, 11616, 3716, 14413, 83, 11728, 59, 16924, 985, 566, 3777, 339, 347, 1050, 9871, 45, 393, 10420, 2037, 8, 277, 12, 1676, 10420, 2037, 304, 267, 986, 2378, 347, 1050, 9871, 45, 393, 10420, 2037, 1378, 45, 1446, 10420, 2037, 8, 277, 12, 2748, 1692, 12, 1303, 10251, 13987, 2282, 45, 393, 1692, 304, 267, 702, 8, 6074, 8, 1652, 1692, 12, 24881, 1692, 430, 267, 702, 8, 6074, 8, 573, 10251, 13987, 2282, 45, 393, 1692, 12, 3930, 10251, 13987, 2282, 45, 393, 430, 398, 892, 9871, 45, 393, 275, 24881, 1692, 480, 1494, 13, 16924, 531, 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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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 ]
totallybradical/temp_servo2
tests/wpt/web-platform-tests/tools/html5lib/html5lib/tests/test_stream.py
446
6264
from __future__ import absolute_import, division, unicode_literals from . import support # flake8: noqa import unittest import codecs from io import BytesIO from six.moves import http_client from html5lib.inputstream import (BufferedStream, HTMLInputStream, HTMLUnicodeInputStream, HTMLBinaryInputStream) class BufferedStreamTest(unittest.TestCase): def test_basic(self): s = b"abc" fp = BufferedStream(BytesIO(s)) read = fp.read(10) assert read == s def test_read_length(self): fp = BufferedStream(BytesIO(b"abcdef")) read1 = fp.read(1) assert read1 == b"a" read2 = fp.read(2) assert read2 == b"bc" read3 = fp.read(3) assert read3 == b"def" read4 = fp.read(4) assert read4 == b"" def test_tell(self): fp = BufferedStream(BytesIO(b"abcdef")) read1 = fp.read(1) assert fp.tell() == 1 read2 = fp.read(2) assert fp.tell() == 3 read3 = fp.read(3) assert fp.tell() == 6 read4 = fp.read(4) assert fp.tell() == 6 def test_seek(self): fp = BufferedStream(BytesIO(b"abcdef")) read1 = fp.read(1) assert read1 == b"a" fp.seek(0) read2 = fp.read(1) assert read2 == b"a" read3 = fp.read(2) assert read3 == b"bc" fp.seek(2) read4 = fp.read(2) assert read4 == b"cd" fp.seek(4) read5 = fp.read(2) assert read5 == b"ef" def test_seek_tell(self): fp = BufferedStream(BytesIO(b"abcdef")) read1 = fp.read(1) assert fp.tell() == 1 fp.seek(0) read2 = fp.read(1) assert fp.tell() == 1 read3 = fp.read(2) assert fp.tell() == 3 fp.seek(2) read4 = fp.read(2) assert fp.tell() == 4 fp.seek(4) read5 = fp.read(2) assert fp.tell() == 6 class HTMLUnicodeInputStreamShortChunk(HTMLUnicodeInputStream): _defaultChunkSize = 2 class HTMLBinaryInputStreamShortChunk(HTMLBinaryInputStream): _defaultChunkSize = 2 class HTMLInputStreamTest(unittest.TestCase): def test_char_ascii(self): stream = HTMLInputStream(b"'", encoding='ascii') self.assertEqual(stream.charEncoding[0], 'ascii') self.assertEqual(stream.char(), "'") def test_char_utf8(self): stream = HTMLInputStream('\u2018'.encode('utf-8'), encoding='utf-8') self.assertEqual(stream.charEncoding[0], 'utf-8') self.assertEqual(stream.char(), '\u2018') def test_char_win1252(self): stream = HTMLInputStream("\xa9\xf1\u2019".encode('windows-1252')) self.assertEqual(stream.charEncoding[0], 'windows-1252') self.assertEqual(stream.char(), "\xa9") self.assertEqual(stream.char(), "\xf1") self.assertEqual(stream.char(), "\u2019") def test_bom(self): stream = HTMLInputStream(codecs.BOM_UTF8 + b"'") self.assertEqual(stream.charEncoding[0], 'utf-8') self.assertEqual(stream.char(), "'") def test_utf_16(self): stream = HTMLInputStream((' ' * 1025).encode('utf-16')) self.assertTrue(stream.charEncoding[0] in ['utf-16-le', 'utf-16-be'], stream.charEncoding) self.assertEqual(len(stream.charsUntil(' ', True)), 1025) def test_newlines(self): stream = HTMLBinaryInputStreamShortChunk(codecs.BOM_UTF8 + b"a\nbb\r\nccc\rddddxe") self.assertEqual(stream.position(), (1, 0)) self.assertEqual(stream.charsUntil('c'), "a\nbb\n") self.assertEqual(stream.position(), (3, 0)) self.assertEqual(stream.charsUntil('x'), "ccc\ndddd") self.assertEqual(stream.position(), (4, 4)) self.assertEqual(stream.charsUntil('e'), "x") self.assertEqual(stream.position(), (4, 5)) def test_newlines2(self): size = HTMLUnicodeInputStream._defaultChunkSize stream = HTMLInputStream("\r" * size + "\n") self.assertEqual(stream.charsUntil('x'), "\n" * size) def test_position(self): stream = HTMLBinaryInputStreamShortChunk(codecs.BOM_UTF8 + b"a\nbb\nccc\nddde\nf\ngh") self.assertEqual(stream.position(), (1, 0)) self.assertEqual(stream.charsUntil('c'), "a\nbb\n") self.assertEqual(stream.position(), (3, 0)) stream.unget("\n") self.assertEqual(stream.position(), (2, 2)) self.assertEqual(stream.charsUntil('c'), "\n") self.assertEqual(stream.position(), (3, 0)) stream.unget("\n") self.assertEqual(stream.position(), (2, 2)) self.assertEqual(stream.char(), "\n") self.assertEqual(stream.position(), (3, 0)) self.assertEqual(stream.charsUntil('e'), "ccc\nddd") self.assertEqual(stream.position(), (4, 3)) self.assertEqual(stream.charsUntil('h'), "e\nf\ng") self.assertEqual(stream.position(), (6, 1)) def test_position2(self): stream = HTMLUnicodeInputStreamShortChunk("abc\nd") self.assertEqual(stream.position(), (1, 0)) self.assertEqual(stream.char(), "a") self.assertEqual(stream.position(), (1, 1)) self.assertEqual(stream.char(), "b") self.assertEqual(stream.position(), (1, 2)) self.assertEqual(stream.char(), "c") self.assertEqual(stream.position(), (1, 3)) self.assertEqual(stream.char(), "\n") self.assertEqual(stream.position(), (2, 0)) self.assertEqual(stream.char(), "d") self.assertEqual(stream.position(), (2, 1)) def test_python_issue_20007(self): """ Make sure we have a work-around for Python bug #20007 http://bugs.python.org/issue20007 """ class FakeSocket(object): def makefile(self, _mode, _bufsize=None): return BytesIO(b"HTTP/1.1 200 Ok\r\n\r\nText") source = http_client.HTTPResponse(FakeSocket()) source.begin() stream = HTMLInputStream(source) self.assertEqual(stream.charsUntil(" "), "Text") def buildTestSuite(): return unittest.defaultTestLoader.loadTestsFromName(__name__) def main(): buildTestSuite() unittest.main() if __name__ == '__main__': main()
mpl-2.0
[ 504, 636, 2443, 363, 492, 3679, 63, 646, 12, 4629, 12, 2649, 63, 5955, 199, 199, 504, 1275, 492, 2291, 221, 327, 27510, 24, 26, 8151, 199, 646, 2882, 199, 646, 6010, 199, 504, 5890, 492, 11808, 199, 199, 504, 3816, 14, 4912, 492, 1455, 63, 1258, 199, 199, 504, 3517, 21, 773, 14, 1210, 1745, 492, 334, 23139, 3296, 12, 4163, 27611, 12, 3303, 4163, 7087, 27611, 12, 4163, 6636, 27611, 9, 199, 199, 533, 26832, 3296, 774, 8, 2796, 14, 1746, 304, 272, 347, 511, 63, 4316, 8, 277, 304, 267, 308, 275, 330, 2, 3175, 2, 267, 4090, 275, 26832, 3296, 8, 15466, 8, 83, 430, 267, 1586, 275, 4090, 14, 739, 8, 709, 9, 267, 702, 1586, 508, 308, 339, 347, 511, 63, 739, 63, 1267, 8, 277, 304, 267, 4090, 275, 26832, 3296, 8, 15466, 8, 66, 2, 10678, 2237, 267, 1586, 17, 275, 4090, 14, 739, 8, 17, 9, 267, 702, 1586, 17, 508, 330, 2, 65, 2, 267, 1586, 18, 275, 4090, 14, 739, 8, 18, 9, 267, 702, 1586, 18, 508, 330, 2, 3776, 2, 267, 1586, 19, 275, 4090, 14, 739, 8, 19, 9, 267, 702, 1586, 19, 508, 330, 2, 318, 2, 267, 1586, 20, 275, 4090, 14, 739, 8, 20, 9, 267, 702, 1586, 20, 508, 330, 341, 339, 347, 511, 63, 9974, 8, 277, 304, 267, 4090, 275, 26832, 3296, 8, 15466, 8, 66, 2, 10678, 2237, 267, 1586, 17, 275, 4090, 14, 739, 8, 17, 9, 267, 702, 4090, 14, 9974, 342, 508, 413, 267, 1586, 18, 275, 4090, 14, 739, 8, 18, 9, 267, 702, 4090, 14, 9974, 342, 508, 650, 267, 1586, 19, 275, 4090, 14, 739, 8, 19, 9, 267, 702, 4090, 14, 9974, 342, 508, 1227, 267, 1586, 20, 275, 4090, 14, 739, 8, 20, 9, 267, 702, 4090, 14, 9974, 342, 508, 1227, 339, 347, 511, 63, 5507, 8, 277, 304, 267, 4090, 275, 26832, 3296, 8, 15466, 8, 66, 2, 10678, 2237, 267, 1586, 17, 275, 4090, 14, 739, 8, 17, 9, 267, 702, 1586, 17, 508, 330, 2, 65, 2, 267, 4090, 14, 5507, 8, 16, 9, 267, 1586, 18, 275, 4090, 14, 739, 8, 17, 9, 267, 702, 1586, 18, 508, 330, 2, 65, 2, 267, 1586, 19, 275, 4090, 14, 739, 8, 18, 9, 267, 702, 1586, 19, 508, 330, 2, 3776, 2, 267, 4090, 14, 5507, 8, 18, 9, 267, 1586, 20, 275, 4090, 14, 739, 8, 18, 9, 267, 702, 1586, 20, 508, 330, 2, 2866, 2, 267, 4090, 14, 5507, 8, 20, 9, 267, 1586, 21, 275, 4090, 14, 739, 8, 18, 9, 267, 702, 1586, 21, 508, 330, 2, 2829, 2, 339, 347, 511, 63, 5507, 63, 9974, 8, 277, 304, 267, 4090, 275, 26832, 3296, 8, 15466, 8, 66, 2, 10678, 2237, 267, 1586, 17, 275, 4090, 14, 739, 8, 17, 9, 267, 702, 4090, 14, 9974, 342, 508, 413, 267, 4090, 14, 5507, 8, 16, 9, 267, 1586, 18, 275, 4090, 14, 739, 8, 17, 9, 267, 702, 4090, 14, 9974, 342, 508, 413, 267, 1586, 19, 275, 4090, 14, 739, 8, 18, 9, 267, 702, 4090, 14, 9974, 342, 508, 650, 267, 4090, 14, 5507, 8, 18, 9, 267, 1586, 20, 275, 4090, 14, 739, 8, 18, 9, 267, 702, 4090, 14, 9974, 342, 508, 841, 267, 4090, 14, 5507, 8, 20, 9, 267, 1586, 21, 275, 4090, 14, 739, 8, 18, 9, 267, 702, 4090, 14, 9974, 342, 508, 1227, 421, 199, 533, 4163, 7087, 27611, 10039, 9856, 8, 4943, 7087, 27611, 304, 272, 485, 885, 9856, 2320, 275, 499, 421, 199, 533, 4163, 6636, 27611, 10039, 9856, 8, 4943, 6636, 27611, 304, 272, 485, 885, 9856, 2320, 275, 499, 421, 199, 533, 4163, 27611, 774, 8, 2796, 14, 1746, 304, 339, 347, 511, 63, 1560, 63, 4371, 8, 277, 304, 267, 2547, 275, 4163, 27611, 8, 66, 4507, 401, 2644, 534, 4371, 358, 267, 291, 14, 629, 8, 1745, 14, 1560, 7630, 59, 16, 467, 283, 4371, 358, 267, 291, 14, 629, 8, 1745, 14, 1560, 1062, 3546, 531, 339, 347, 511, 63, 1560, 63, 1624, 24, 8, 277, 304, 267, 2547, 275, 4163, 27611, 2258, 85, 12682, 1370, 2143, 360, 1624, 13, 24, 659, 2644, 534, 1624, 13, 24, 358, 267, 291, 14, 629, 8, 1745, 14, 1560, 7630, 59, 16, 467, 283, 1624, 13, 24, 358, 267, 291, 14, 629, 8, 1745, 14, 1560, 1062, 1557, 85, 12682, 358, 339, 347, 511, 63, 1560, 63, 2676, 19364, 8, 277, 304, 267, 2547, 275, 4163, 27611, 4582, 1800, 25, 60, 1949, 17, 60, 85, 14982, 1674, 2143, 360, 8258, 13, 19364, 1333, 267, 291, 14, 629, 8, 1745, 14, 1560, 7630, 59, 16, 467, 283, 8258, 13, 19364, 358, 267, 291, 14, 629, 8, 1745, 14, 1560, 1062, 1867, 1800, 25, 531, 267, 291, 14, 629, 8, 1745, 14, 1560, 1062, 1867, 1949, 17, 531, 267, 291, 14, 629, 8, 1745, 14, 1560, 1062, 1867, 85, 14982, 531, 339, 347, 511, 63, 16302, 8, 277, 304, 267, 2547, 275, 4163, 27611, 8, 8933, 14, 19550, 63, 6610, 24, 435, 330, 4507, 531, 267, 291, 14, 629, 8, 1745, 14, 1560, 7630, 59, 16, 467, 283, 1624, 13, 24, 358, 267, 291, 14, 629, 8, 1745, 14, 1560, 1062, 3546, 531, 339, 347, 511, 63, 1624, 63, 975, 8, 277, 304, 267, 2547, 275, 4163, 27611, 4725, 283, 627, 1616, 821, 680, 2143, 360, 1624, 13, 975, 1333, 267, 291, 14, 1815, 8, 1745, 14, 1560, 7630, 59, 16, 61, 315, 788, 1624, 13, 975, 13, 274, 297, 283, 1624, 13, 975, 13, 1235, 995, 2547, 14, 1560, 7630, 9, 267, 291, 14, 629, 8, 552, 8, 1745, 14, 6574, 18667, 360, 1656, 715, 1826, 1616, 821, 9, 339, 347, 511, 63, 13839, 8, 277, 304, 267, 2547, 275, 4163, 6636, 27611, 10039, 9856, 8, 8933, 14, 19550, 63, 6610, 24, 435, 330, 2, 65, 60, 78, 2501, 60, 82, 60, 78, 19504, 60, 82, 17472, 1845, 531, 267, 291, 14, 629, 8, 1745, 14, 3124, 1062, 334, 17, 12, 378, 430, 267, 291, 14, 629, 8, 1745, 14, 6574, 18667, 360, 67 ]
[ 636, 2443, 363, 492, 3679, 63, 646, 12, 4629, 12, 2649, 63, 5955, 199, 199, 504, 1275, 492, 2291, 221, 327, 27510, 24, 26, 8151, 199, 646, 2882, 199, 646, 6010, 199, 504, 5890, 492, 11808, 199, 199, 504, 3816, 14, 4912, 492, 1455, 63, 1258, 199, 199, 504, 3517, 21, 773, 14, 1210, 1745, 492, 334, 23139, 3296, 12, 4163, 27611, 12, 3303, 4163, 7087, 27611, 12, 4163, 6636, 27611, 9, 199, 199, 533, 26832, 3296, 774, 8, 2796, 14, 1746, 304, 272, 347, 511, 63, 4316, 8, 277, 304, 267, 308, 275, 330, 2, 3175, 2, 267, 4090, 275, 26832, 3296, 8, 15466, 8, 83, 430, 267, 1586, 275, 4090, 14, 739, 8, 709, 9, 267, 702, 1586, 508, 308, 339, 347, 511, 63, 739, 63, 1267, 8, 277, 304, 267, 4090, 275, 26832, 3296, 8, 15466, 8, 66, 2, 10678, 2237, 267, 1586, 17, 275, 4090, 14, 739, 8, 17, 9, 267, 702, 1586, 17, 508, 330, 2, 65, 2, 267, 1586, 18, 275, 4090, 14, 739, 8, 18, 9, 267, 702, 1586, 18, 508, 330, 2, 3776, 2, 267, 1586, 19, 275, 4090, 14, 739, 8, 19, 9, 267, 702, 1586, 19, 508, 330, 2, 318, 2, 267, 1586, 20, 275, 4090, 14, 739, 8, 20, 9, 267, 702, 1586, 20, 508, 330, 341, 339, 347, 511, 63, 9974, 8, 277, 304, 267, 4090, 275, 26832, 3296, 8, 15466, 8, 66, 2, 10678, 2237, 267, 1586, 17, 275, 4090, 14, 739, 8, 17, 9, 267, 702, 4090, 14, 9974, 342, 508, 413, 267, 1586, 18, 275, 4090, 14, 739, 8, 18, 9, 267, 702, 4090, 14, 9974, 342, 508, 650, 267, 1586, 19, 275, 4090, 14, 739, 8, 19, 9, 267, 702, 4090, 14, 9974, 342, 508, 1227, 267, 1586, 20, 275, 4090, 14, 739, 8, 20, 9, 267, 702, 4090, 14, 9974, 342, 508, 1227, 339, 347, 511, 63, 5507, 8, 277, 304, 267, 4090, 275, 26832, 3296, 8, 15466, 8, 66, 2, 10678, 2237, 267, 1586, 17, 275, 4090, 14, 739, 8, 17, 9, 267, 702, 1586, 17, 508, 330, 2, 65, 2, 267, 4090, 14, 5507, 8, 16, 9, 267, 1586, 18, 275, 4090, 14, 739, 8, 17, 9, 267, 702, 1586, 18, 508, 330, 2, 65, 2, 267, 1586, 19, 275, 4090, 14, 739, 8, 18, 9, 267, 702, 1586, 19, 508, 330, 2, 3776, 2, 267, 4090, 14, 5507, 8, 18, 9, 267, 1586, 20, 275, 4090, 14, 739, 8, 18, 9, 267, 702, 1586, 20, 508, 330, 2, 2866, 2, 267, 4090, 14, 5507, 8, 20, 9, 267, 1586, 21, 275, 4090, 14, 739, 8, 18, 9, 267, 702, 1586, 21, 508, 330, 2, 2829, 2, 339, 347, 511, 63, 5507, 63, 9974, 8, 277, 304, 267, 4090, 275, 26832, 3296, 8, 15466, 8, 66, 2, 10678, 2237, 267, 1586, 17, 275, 4090, 14, 739, 8, 17, 9, 267, 702, 4090, 14, 9974, 342, 508, 413, 267, 4090, 14, 5507, 8, 16, 9, 267, 1586, 18, 275, 4090, 14, 739, 8, 17, 9, 267, 702, 4090, 14, 9974, 342, 508, 413, 267, 1586, 19, 275, 4090, 14, 739, 8, 18, 9, 267, 702, 4090, 14, 9974, 342, 508, 650, 267, 4090, 14, 5507, 8, 18, 9, 267, 1586, 20, 275, 4090, 14, 739, 8, 18, 9, 267, 702, 4090, 14, 9974, 342, 508, 841, 267, 4090, 14, 5507, 8, 20, 9, 267, 1586, 21, 275, 4090, 14, 739, 8, 18, 9, 267, 702, 4090, 14, 9974, 342, 508, 1227, 421, 199, 533, 4163, 7087, 27611, 10039, 9856, 8, 4943, 7087, 27611, 304, 272, 485, 885, 9856, 2320, 275, 499, 421, 199, 533, 4163, 6636, 27611, 10039, 9856, 8, 4943, 6636, 27611, 304, 272, 485, 885, 9856, 2320, 275, 499, 421, 199, 533, 4163, 27611, 774, 8, 2796, 14, 1746, 304, 339, 347, 511, 63, 1560, 63, 4371, 8, 277, 304, 267, 2547, 275, 4163, 27611, 8, 66, 4507, 401, 2644, 534, 4371, 358, 267, 291, 14, 629, 8, 1745, 14, 1560, 7630, 59, 16, 467, 283, 4371, 358, 267, 291, 14, 629, 8, 1745, 14, 1560, 1062, 3546, 531, 339, 347, 511, 63, 1560, 63, 1624, 24, 8, 277, 304, 267, 2547, 275, 4163, 27611, 2258, 85, 12682, 1370, 2143, 360, 1624, 13, 24, 659, 2644, 534, 1624, 13, 24, 358, 267, 291, 14, 629, 8, 1745, 14, 1560, 7630, 59, 16, 467, 283, 1624, 13, 24, 358, 267, 291, 14, 629, 8, 1745, 14, 1560, 1062, 1557, 85, 12682, 358, 339, 347, 511, 63, 1560, 63, 2676, 19364, 8, 277, 304, 267, 2547, 275, 4163, 27611, 4582, 1800, 25, 60, 1949, 17, 60, 85, 14982, 1674, 2143, 360, 8258, 13, 19364, 1333, 267, 291, 14, 629, 8, 1745, 14, 1560, 7630, 59, 16, 467, 283, 8258, 13, 19364, 358, 267, 291, 14, 629, 8, 1745, 14, 1560, 1062, 1867, 1800, 25, 531, 267, 291, 14, 629, 8, 1745, 14, 1560, 1062, 1867, 1949, 17, 531, 267, 291, 14, 629, 8, 1745, 14, 1560, 1062, 1867, 85, 14982, 531, 339, 347, 511, 63, 16302, 8, 277, 304, 267, 2547, 275, 4163, 27611, 8, 8933, 14, 19550, 63, 6610, 24, 435, 330, 4507, 531, 267, 291, 14, 629, 8, 1745, 14, 1560, 7630, 59, 16, 467, 283, 1624, 13, 24, 358, 267, 291, 14, 629, 8, 1745, 14, 1560, 1062, 3546, 531, 339, 347, 511, 63, 1624, 63, 975, 8, 277, 304, 267, 2547, 275, 4163, 27611, 4725, 283, 627, 1616, 821, 680, 2143, 360, 1624, 13, 975, 1333, 267, 291, 14, 1815, 8, 1745, 14, 1560, 7630, 59, 16, 61, 315, 788, 1624, 13, 975, 13, 274, 297, 283, 1624, 13, 975, 13, 1235, 995, 2547, 14, 1560, 7630, 9, 267, 291, 14, 629, 8, 552, 8, 1745, 14, 6574, 18667, 360, 1656, 715, 1826, 1616, 821, 9, 339, 347, 511, 63, 13839, 8, 277, 304, 267, 2547, 275, 4163, 6636, 27611, 10039, 9856, 8, 8933, 14, 19550, 63, 6610, 24, 435, 330, 2, 65, 60, 78, 2501, 60, 82, 60, 78, 19504, 60, 82, 17472, 1845, 531, 267, 291, 14, 629, 8, 1745, 14, 3124, 1062, 334, 17, 12, 378, 430, 267, 291, 14, 629, 8, 1745, 14, 6574, 18667, 360, 67, 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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, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
GunnerJnr/_CodeInstitute
Stream-2/Back-End-Development/3.Testing/3.Safe-Refactoring/challenge-solution/test_vending_machine.py
1
1027
# import the unit test module import unittest from vending_machine import give_change from vending_machine import give_change_decimal # define a class (inherits from unittest) class TestVendingMachine(unittest.TestCase): # define our method (must because with test_ otherwise the test will not run) def test_return_change(self): # we're imaging there is a method called give_change which returns a list of coins # given in an amount in pence self.assertEqual(give_change(.17), [.10, .05, .02], 'wrong change given') self.assertEqual(give_change(18), [.10, .05, .02, .01], 'wrong change given') # decimal test self.assertEqual(give_change_decimal(.17), [.10, .05, .02], 'wrong change given') self.assertEqual(give_change_decimal(18), [.10, .05, .02, .01], 'wrong change given') def test_multiple_same_coins(self): self.assertEqual(give_change(.04), [.02, .02]) # decimal test self.assertEqual(give_change_decimal(.04), [.02, .02])
mit
[ 3, 492, 314, 4137, 511, 859, 199, 646, 2882, 199, 504, 373, 3219, 63, 6744, 492, 8120, 63, 1461, 199, 504, 373, 3219, 63, 6744, 492, 8120, 63, 1461, 63, 6355, 421, 199, 3, 5627, 282, 1021, 334, 20882, 687, 2882, 9, 199, 533, 1379, 54, 3219, 8412, 8, 2796, 14, 1746, 304, 272, 327, 5627, 4154, 1083, 334, 7790, 2952, 543, 511, 63, 4257, 314, 511, 911, 440, 1255, 9, 272, 347, 511, 63, 1107, 63, 1461, 8, 277, 304, 267, 327, 781, 3984, 18884, 1540, 2337, 365, 282, 1083, 2797, 8120, 63, 1461, 1314, 2529, 282, 769, 402, 512, 3617, 267, 327, 1627, 315, 376, 5982, 315, 299, 4894, 267, 291, 14, 629, 8, 26035, 63, 1461, 13417, 1196, 395, 26496, 709, 12, 1275, 1717, 12, 1275, 996, 467, 283, 10603, 1570, 1627, 358, 267, 291, 14, 629, 8, 26035, 63, 1461, 8, 1085, 395, 26496, 709, 12, 1275, 1717, 12, 1275, 996, 12, 1275, 614, 467, 283, 10603, 1570, 1627, 358, 398, 327, 6107, 511, 267, 291, 14, 629, 8, 26035, 63, 1461, 63, 6355, 13417, 1196, 395, 26496, 709, 12, 1275, 1717, 12, 1275, 996, 467, 283, 10603, 1570, 1627, 358, 267, 291, 14, 629, 8, 26035, 63, 1461, 63, 6355, 8, 1085, 395, 26496, 709, 12, 1275, 1717, 12, 1275, 996, 12, 1275, 614, 467, 283, 10603, 1570, 1627, 358, 339, 347, 511, 63, 6048, 63, 7191, 63, 331, 3617, 8, 277, 304, 267, 291, 14, 629, 8, 26035, 63, 1461, 13417, 966, 395, 26496, 996, 12, 1275, 996, 566, 398, 327, 6107, 511, 267, 291, 14, 629, 8, 26035, 63, 1461, 63, 6355, 13417, 966, 395, 26496, 996, 12, 1275, 996, 566, 199, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768 ]
[ 492, 314, 4137, 511, 859, 199, 646, 2882, 199, 504, 373, 3219, 63, 6744, 492, 8120, 63, 1461, 199, 504, 373, 3219, 63, 6744, 492, 8120, 63, 1461, 63, 6355, 421, 199, 3, 5627, 282, 1021, 334, 20882, 687, 2882, 9, 199, 533, 1379, 54, 3219, 8412, 8, 2796, 14, 1746, 304, 272, 327, 5627, 4154, 1083, 334, 7790, 2952, 543, 511, 63, 4257, 314, 511, 911, 440, 1255, 9, 272, 347, 511, 63, 1107, 63, 1461, 8, 277, 304, 267, 327, 781, 3984, 18884, 1540, 2337, 365, 282, 1083, 2797, 8120, 63, 1461, 1314, 2529, 282, 769, 402, 512, 3617, 267, 327, 1627, 315, 376, 5982, 315, 299, 4894, 267, 291, 14, 629, 8, 26035, 63, 1461, 13417, 1196, 395, 26496, 709, 12, 1275, 1717, 12, 1275, 996, 467, 283, 10603, 1570, 1627, 358, 267, 291, 14, 629, 8, 26035, 63, 1461, 8, 1085, 395, 26496, 709, 12, 1275, 1717, 12, 1275, 996, 12, 1275, 614, 467, 283, 10603, 1570, 1627, 358, 398, 327, 6107, 511, 267, 291, 14, 629, 8, 26035, 63, 1461, 63, 6355, 13417, 1196, 395, 26496, 709, 12, 1275, 1717, 12, 1275, 996, 467, 283, 10603, 1570, 1627, 358, 267, 291, 14, 629, 8, 26035, 63, 1461, 63, 6355, 8, 1085, 395, 26496, 709, 12, 1275, 1717, 12, 1275, 996, 12, 1275, 614, 467, 283, 10603, 1570, 1627, 358, 339, 347, 511, 63, 6048, 63, 7191, 63, 331, 3617, 8, 277, 304, 267, 291, 14, 629, 8, 26035, 63, 1461, 13417, 966, 395, 26496, 996, 12, 1275, 996, 566, 398, 327, 6107, 511, 267, 291, 14, 629, 8, 26035, 63, 1461, 63, 6355, 13417, 966, 395, 26496, 996, 12, 1275, 996, 566, 199, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 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,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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 ]
wvdd007/robomongo
tests/gtest-1.7.0/test/gtest_xml_outfiles_test.py
2526
5340
#!/usr/bin/env python # # Copyright 2008, 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. """Unit test for the gtest_xml_output module.""" __author__ = "[email protected] (Keith Ray)" import os from xml.dom import minidom, Node import gtest_test_utils import gtest_xml_test_utils GTEST_OUTPUT_SUBDIR = "xml_outfiles" GTEST_OUTPUT_1_TEST = "gtest_xml_outfile1_test_" GTEST_OUTPUT_2_TEST = "gtest_xml_outfile2_test_" EXPECTED_XML_1 = """<?xml version="1.0" encoding="UTF-8"?> <testsuites tests="1" failures="0" disabled="0" errors="0" time="*" timestamp="*" name="AllTests"> <testsuite name="PropertyOne" tests="1" failures="0" disabled="0" errors="0" time="*"> <testcase name="TestSomeProperties" status="run" time="*" classname="PropertyOne" SetUpProp="1" TestSomeProperty="1" TearDownProp="1" /> </testsuite> </testsuites> """ EXPECTED_XML_2 = """<?xml version="1.0" encoding="UTF-8"?> <testsuites tests="1" failures="0" disabled="0" errors="0" time="*" timestamp="*" name="AllTests"> <testsuite name="PropertyTwo" tests="1" failures="0" disabled="0" errors="0" time="*"> <testcase name="TestSomeProperties" status="run" time="*" classname="PropertyTwo" SetUpProp="2" TestSomeProperty="2" TearDownProp="2" /> </testsuite> </testsuites> """ class GTestXMLOutFilesTest(gtest_xml_test_utils.GTestXMLTestCase): """Unit test for Google Test's XML output functionality.""" def setUp(self): # We want the trailing '/' that the last "" provides in os.path.join, for # telling Google Test to create an output directory instead of a single file # for xml output. self.output_dir_ = os.path.join(gtest_test_utils.GetTempDir(), GTEST_OUTPUT_SUBDIR, "") self.DeleteFilesAndDir() def tearDown(self): self.DeleteFilesAndDir() def DeleteFilesAndDir(self): try: os.remove(os.path.join(self.output_dir_, GTEST_OUTPUT_1_TEST + ".xml")) except os.error: pass try: os.remove(os.path.join(self.output_dir_, GTEST_OUTPUT_2_TEST + ".xml")) except os.error: pass try: os.rmdir(self.output_dir_) except os.error: pass def testOutfile1(self): self._TestOutFile(GTEST_OUTPUT_1_TEST, EXPECTED_XML_1) def testOutfile2(self): self._TestOutFile(GTEST_OUTPUT_2_TEST, EXPECTED_XML_2) def _TestOutFile(self, test_name, expected_xml): gtest_prog_path = gtest_test_utils.GetTestExecutablePath(test_name) command = [gtest_prog_path, "--gtest_output=xml:%s" % self.output_dir_] p = gtest_test_utils.Subprocess(command, working_dir=gtest_test_utils.GetTempDir()) self.assert_(p.exited) self.assertEquals(0, p.exit_code) # TODO([email protected]): libtool causes the built test binary to be # named lt-gtest_xml_outfiles_test_ instead of # gtest_xml_outfiles_test_. To account for this possibillity, we # allow both names in the following code. We should remove this # hack when Chandler Carruth's libtool replacement tool is ready. output_file_name1 = test_name + ".xml" output_file1 = os.path.join(self.output_dir_, output_file_name1) output_file_name2 = 'lt-' + output_file_name1 output_file2 = os.path.join(self.output_dir_, output_file_name2) self.assert_(os.path.isfile(output_file1) or os.path.isfile(output_file2), output_file1) expected = minidom.parseString(expected_xml) if os.path.isfile(output_file1): actual = minidom.parse(output_file1) else: actual = minidom.parse(output_file2) self.NormalizeXml(actual.documentElement) self.AssertEquivalentNodes(expected.documentElement, actual.documentElement) expected.unlink() actual.unlink() if __name__ == "__main__": os.environ["GTEST_STACK_TRACE_DEPTH"] = "0" gtest_test_utils.Main()
gpl-3.0
[ 3381, 2647, 15, 1393, 15, 1813, 2366, 199, 3, 199, 3, 1898, 9079, 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, 5072, 511, 367, 314, 9088, 63, 1652, 63, 1199, 859, 1041, 199, 199, 363, 2502, 363, 275, 298, 415, 448, 14, 803, 32, 6799, 14, 957, 334, 1136, 448, 30703, 2924, 199, 199, 646, 747, 199, 504, 2748, 14, 4556, 492, 19165, 12, 5013, 199, 199, 646, 9088, 63, 396, 63, 1208, 199, 646, 9088, 63, 1652, 63, 396, 63, 1208, 421, 199, 16151, 63, 8414, 63, 6348, 3022, 275, 298, 1652, 63, 548, 1725, 2, 199, 16151, 63, 8414, 63, 17, 63, 2864, 275, 298, 8385, 63, 1652, 63, 4984, 17, 63, 396, 12172, 199, 16151, 63, 8414, 63, 18, 63, 2864, 275, 298, 8385, 63, 1652, 63, 4984, 18, 63, 396, 12172, 199, 199, 22358, 63, 4317, 63, 17, 275, 31501, 1652, 1015, 628, 17, 14, 16, 2, 2644, 628, 6610, 13, 24, 24327, 199, 28, 2219, 11650, 2295, 628, 17, 2, 9081, 628, 16, 2, 6980, 628, 16, 2, 2552, 628, 16, 2, 900, 21437, 4913, 21437, 536, 628, 2422, 2925, 1743, 523, 665, 14239, 536, 628, 3697, 4395, 2, 2295, 628, 17, 2, 9081, 628, 16, 2, 6980, 628, 16, 2, 2552, 628, 16, 2, 900, 32103, 1743, 272, 665, 10847, 536, 628, 774, 7700, 8516, 2, 2004, 628, 1065, 2, 900, 21437, 15876, 628, 3697, 4395, 2, 2494, 1721, 9955, 628, 17, 2, 1379, 7700, 3697, 628, 17, 2, 377, 25236, 9955, 628, 17, 2, 7082, 523, 3068, 14239, 30, 199, 1108, 2219, 11650, 30, 199, 624, 199, 199, 22358, 63, 4317, 63, 18, 275, 31501, 1652, 1015, 628, 17, 14, 16, 2, 2644, 628, 6610, 13, 24, 24327, 199, 28, 2219, 11650, 2295, 628, 17, 2, 9081, 628, 16, 2, 6980, 628, 16, 2, 2552, 628, 16, 2, 900, 21437, 4913, 21437, 536, 628, 2422, 2925, 1743, 523, 665, 14239, 536, 628, 3697, 11467, 2, 2295, 628, 17, 2, 9081, 628, 16, 2, 6980, 628, 16, 2, 2552, 628, 16, 2, 900, 32103, 1743, 272, 665, 10847, 536, 628, 774, 7700, 8516, 2, 2004, 628, 1065, 2, 900, 21437, 15876, 628, 3697, 11467, 2, 2494, 1721, 9955, 628, 18, 2, 1379, 7700, 3697, 628, 18, 2, 377, 25236, 9955, 628, 18, 2, 7082, 523, 3068, 14239, 30, 199, 1108, 2219, 11650, 30, 199, 624, 421, 199, 533, 598, 774, 13901, 1484, 337, 5535, 774, 8, 8385, 63, 1652, 63, 396, 63, 1208, 14, 39, 774, 4317, 1746, 304, 523, 408, 5072, 511, 367, 4475, 1379, 1159, 4692, 1072, 9330, 1041, 819, 347, 3613, 8, 277, 304, 272, 327, 2136, 2934, 314, 8520, 7324, 626, 314, 2061, 3087, 6571, 315, 747, 14, 515, 14, 904, 12, 367, 272, 327, 1565, 10564, 4475, 1379, 370, 1218, 376, 1072, 2082, 3140, 402, 282, 2849, 570, 272, 327, 367, 2748, 1072, 14, 272, 291, 14, 1199, 63, 694, 63, 275, 747, 14, 515, 14, 904, 8, 8385, 63, 396, 63, 1208, 14, 1002, 29008, 1062, 2511, 18652, 63, 8414, 63, 6348, 3022, 12, 6899, 272, 291, 14, 5392, 5535, 3325, 3567, 342, 819, 347, 6766, 8, 277, 304, 272, 291, 14, 5392, 5535, 3325, 3567, 342, 819, 347, 8496, 5535, 3325, 3567, 8, 277, 304, 272, 862, 26, 489, 747, 14, 2168, 8, 736, 14, 515, 14, 904, 8, 277, 14, 1199, 63, 694, 3131, 18652, 63, 8414, 63, 17, 63, 2864, 435, 3680, 1652, 2237, 272, 871, 747, 14, 705, 26, 489, 986, 272, 862, 26, 489, 747, 14, 2168, 8, 736, 14, 515, 14, 904, 8, 277, 14, 1199, 63, 694, 3131, 18652, 63, 8414, 63, 18, 63, 2864, 435, 3680, 1652, 2237, 272, 871, 747, 14, 705, 26, 489, 986, 272, 862, 26, 489, 747, 14, 19405, 8, 277, 14, 1199, 63, 694, 4602, 272, 871, 747, 14, 705, 26, 489, 986, 819, 347, 511, 2204, 493, 17, 8, 277, 304, 272, 291, 423, 774, 2204, 1173, 8, 16151, 63, 8414, 63, 17, 63, 2864, 12, 20464, 1149, 63, 4317, 63, 17, 9, 819, 347, 511, 2204, 493, 18, 8, 277, 304, 272, 291, 423, 774, 2204, 1173, 8, 16151, 63, 8414, 63, 18, 63, 2864, 12, 20464, 1149, 63, 4317, 63, 18, 9, 819, 347, 485, 774, 2204, 1173, 8, 277, 12, 511, 63, 354 ]
[ 2647, 15, 1393, 15, 1813, 2366, 199, 3, 199, 3, 1898, 9079, 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, 5072, 511, 367, 314, 9088, 63, 1652, 63, 1199, 859, 1041, 199, 199, 363, 2502, 363, 275, 298, 415, 448, 14, 803, 32, 6799, 14, 957, 334, 1136, 448, 30703, 2924, 199, 199, 646, 747, 199, 504, 2748, 14, 4556, 492, 19165, 12, 5013, 199, 199, 646, 9088, 63, 396, 63, 1208, 199, 646, 9088, 63, 1652, 63, 396, 63, 1208, 421, 199, 16151, 63, 8414, 63, 6348, 3022, 275, 298, 1652, 63, 548, 1725, 2, 199, 16151, 63, 8414, 63, 17, 63, 2864, 275, 298, 8385, 63, 1652, 63, 4984, 17, 63, 396, 12172, 199, 16151, 63, 8414, 63, 18, 63, 2864, 275, 298, 8385, 63, 1652, 63, 4984, 18, 63, 396, 12172, 199, 199, 22358, 63, 4317, 63, 17, 275, 31501, 1652, 1015, 628, 17, 14, 16, 2, 2644, 628, 6610, 13, 24, 24327, 199, 28, 2219, 11650, 2295, 628, 17, 2, 9081, 628, 16, 2, 6980, 628, 16, 2, 2552, 628, 16, 2, 900, 21437, 4913, 21437, 536, 628, 2422, 2925, 1743, 523, 665, 14239, 536, 628, 3697, 4395, 2, 2295, 628, 17, 2, 9081, 628, 16, 2, 6980, 628, 16, 2, 2552, 628, 16, 2, 900, 32103, 1743, 272, 665, 10847, 536, 628, 774, 7700, 8516, 2, 2004, 628, 1065, 2, 900, 21437, 15876, 628, 3697, 4395, 2, 2494, 1721, 9955, 628, 17, 2, 1379, 7700, 3697, 628, 17, 2, 377, 25236, 9955, 628, 17, 2, 7082, 523, 3068, 14239, 30, 199, 1108, 2219, 11650, 30, 199, 624, 199, 199, 22358, 63, 4317, 63, 18, 275, 31501, 1652, 1015, 628, 17, 14, 16, 2, 2644, 628, 6610, 13, 24, 24327, 199, 28, 2219, 11650, 2295, 628, 17, 2, 9081, 628, 16, 2, 6980, 628, 16, 2, 2552, 628, 16, 2, 900, 21437, 4913, 21437, 536, 628, 2422, 2925, 1743, 523, 665, 14239, 536, 628, 3697, 11467, 2, 2295, 628, 17, 2, 9081, 628, 16, 2, 6980, 628, 16, 2, 2552, 628, 16, 2, 900, 32103, 1743, 272, 665, 10847, 536, 628, 774, 7700, 8516, 2, 2004, 628, 1065, 2, 900, 21437, 15876, 628, 3697, 11467, 2, 2494, 1721, 9955, 628, 18, 2, 1379, 7700, 3697, 628, 18, 2, 377, 25236, 9955, 628, 18, 2, 7082, 523, 3068, 14239, 30, 199, 1108, 2219, 11650, 30, 199, 624, 421, 199, 533, 598, 774, 13901, 1484, 337, 5535, 774, 8, 8385, 63, 1652, 63, 396, 63, 1208, 14, 39, 774, 4317, 1746, 304, 523, 408, 5072, 511, 367, 4475, 1379, 1159, 4692, 1072, 9330, 1041, 819, 347, 3613, 8, 277, 304, 272, 327, 2136, 2934, 314, 8520, 7324, 626, 314, 2061, 3087, 6571, 315, 747, 14, 515, 14, 904, 12, 367, 272, 327, 1565, 10564, 4475, 1379, 370, 1218, 376, 1072, 2082, 3140, 402, 282, 2849, 570, 272, 327, 367, 2748, 1072, 14, 272, 291, 14, 1199, 63, 694, 63, 275, 747, 14, 515, 14, 904, 8, 8385, 63, 396, 63, 1208, 14, 1002, 29008, 1062, 2511, 18652, 63, 8414, 63, 6348, 3022, 12, 6899, 272, 291, 14, 5392, 5535, 3325, 3567, 342, 819, 347, 6766, 8, 277, 304, 272, 291, 14, 5392, 5535, 3325, 3567, 342, 819, 347, 8496, 5535, 3325, 3567, 8, 277, 304, 272, 862, 26, 489, 747, 14, 2168, 8, 736, 14, 515, 14, 904, 8, 277, 14, 1199, 63, 694, 3131, 18652, 63, 8414, 63, 17, 63, 2864, 435, 3680, 1652, 2237, 272, 871, 747, 14, 705, 26, 489, 986, 272, 862, 26, 489, 747, 14, 2168, 8, 736, 14, 515, 14, 904, 8, 277, 14, 1199, 63, 694, 3131, 18652, 63, 8414, 63, 18, 63, 2864, 435, 3680, 1652, 2237, 272, 871, 747, 14, 705, 26, 489, 986, 272, 862, 26, 489, 747, 14, 19405, 8, 277, 14, 1199, 63, 694, 4602, 272, 871, 747, 14, 705, 26, 489, 986, 819, 347, 511, 2204, 493, 17, 8, 277, 304, 272, 291, 423, 774, 2204, 1173, 8, 16151, 63, 8414, 63, 17, 63, 2864, 12, 20464, 1149, 63, 4317, 63, 17, 9, 819, 347, 511, 2204, 493, 18, 8, 277, 304, 272, 291, 423, 774, 2204, 1173, 8, 16151, 63, 8414, 63, 18, 63, 2864, 12, 20464, 1149, 63, 4317, 63, 18, 9, 819, 347, 485, 774, 2204, 1173, 8, 277, 12, 511, 63, 354, 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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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 ]
hj3938/or-tools
examples/python/data/nonogram_regular/nonogram_hard.py
74
1104
# Copyright 2010 Hakan Kjellerstrand [email protected] # # 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. # # Nonogram "hard" # Note: I don't remember where I found this. # It isn't very hard, though. # rows = 10 row_rule_len = 4 row_rules = [ [0,0,0,1], [0,0,0,3], [0,0,1,3], [0,0,2,4], [0,0,1,2], [0,2,1,1], [1,1,1,1], [0,2,1,1], [0,0,2,2], [0,0,0,5] ] cols = 10 col_rule_len = 4 col_rules = [ [0,0,0,4], [0,0,1,3], [0,0,2,3], [0,0,1,2], [0,0,2,2], [0,1,1,1], [1,1,1,1], [0,1,1,1], [0,0,1,2], [0,0,0,5] ]
apache-2.0
[ 3, 1898, 7129, 869, 1151, 290, 1804, 74, 352, 1435, 30964, 394, 1151, 3580, 32, 21134, 84, 1198, 14, 957, 199, 3, 199, 3, 3909, 1334, 314, 3668, 844, 12, 3394, 499, 14, 16, 334, 1589, 283, 3761, 11339, 221, 199, 3, 1265, 1443, 440, 675, 642, 570, 871, 315, 4151, 543, 314, 844, 14, 221, 199, 3, 2047, 1443, 3332, 282, 1331, 402, 314, 844, 737, 221, 199, 3, 199, 3, 258, 1455, 921, 1544, 14, 3796, 14, 1308, 15, 2383, 15, 3961, 13, 18, 14, 16, 221, 199, 3, 199, 3, 4158, 1415, 701, 3964, 4179, 503, 4193, 370, 315, 3575, 12, 2032, 221, 199, 3, 1854, 1334, 314, 844, 365, 1854, 641, 376, 283, 1179, 2281, 7, 4207, 12, 221, 199, 3, 2428, 2990, 1549, 4217, 1634, 1821, 3826, 12, 1902, 4056, 503, 2478, 14, 221, 199, 3, 1666, 314, 844, 367, 314, 2488, 2637, 4210, 3443, 436, 221, 199, 3, 4204, 1334, 314, 844, 14, 221, 199, 3, 199, 3, 10172, 79, 1679, 298, 8726, 2, 199, 3, 3390, 26, 473, 2793, 1133, 21027, 2382, 473, 1911, 642, 14, 199, 3, 2779, 5712, 1133, 7437, 7508, 12, 10617, 14, 199, 3, 199, 3838, 275, 1616, 199, 1143, 63, 2200, 63, 552, 275, 841, 199, 1143, 63, 4423, 275, 359, 272, 359, 16, 12, 16, 12, 16, 12, 17, 467, 272, 359, 16, 12, 16, 12, 16, 12, 19, 467, 272, 359, 16, 12, 16, 12, 17, 12, 19, 467, 272, 359, 16, 12, 16, 12, 18, 12, 20, 467, 272, 359, 16, 12, 16, 12, 17, 12, 18, 467, 272, 359, 16, 12, 18, 12, 17, 12, 17, 467, 272, 359, 17, 12, 17, 12, 17, 12, 17, 467, 272, 359, 16, 12, 18, 12, 17, 12, 17, 467, 272, 359, 16, 12, 16, 12, 18, 12, 18, 467, 272, 359, 16, 12, 16, 12, 16, 12, 21, 61, 272, 1622, 199, 199, 4574, 275, 1616, 199, 761, 63, 2200, 63, 552, 275, 841, 199, 761, 63, 4423, 275, 359, 272, 359, 16, 12, 16, 12, 16, 12, 20, 467, 272, 359, 16, 12, 16, 12, 17, 12, 19, 467, 272, 359, 16, 12, 16, 12, 18, 12, 19, 467, 272, 359, 16, 12, 16, 12, 17, 12, 18, 467, 272, 359, 16, 12, 16, 12, 18, 12, 18, 467, 272, 359, 16, 12, 17, 12, 17, 12, 17, 467, 272, 359, 17, 12, 17, 12, 17, 12, 17, 467, 272, 359, 16, 12, 17, 12, 17, 12, 17, 467, 272, 359, 16, 12, 16, 12, 17, 12, 18, 467, 272, 359, 16, 12, 16, 12, 16, 12, 21, 61, 272, 1622, 421, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768 ]
[ 1898, 7129, 869, 1151, 290, 1804, 74, 352, 1435, 30964, 394, 1151, 3580, 32, 21134, 84, 1198, 14, 957, 199, 3, 199, 3, 3909, 1334, 314, 3668, 844, 12, 3394, 499, 14, 16, 334, 1589, 283, 3761, 11339, 221, 199, 3, 1265, 1443, 440, 675, 642, 570, 871, 315, 4151, 543, 314, 844, 14, 221, 199, 3, 2047, 1443, 3332, 282, 1331, 402, 314, 844, 737, 221, 199, 3, 199, 3, 258, 1455, 921, 1544, 14, 3796, 14, 1308, 15, 2383, 15, 3961, 13, 18, 14, 16, 221, 199, 3, 199, 3, 4158, 1415, 701, 3964, 4179, 503, 4193, 370, 315, 3575, 12, 2032, 221, 199, 3, 1854, 1334, 314, 844, 365, 1854, 641, 376, 283, 1179, 2281, 7, 4207, 12, 221, 199, 3, 2428, 2990, 1549, 4217, 1634, 1821, 3826, 12, 1902, 4056, 503, 2478, 14, 221, 199, 3, 1666, 314, 844, 367, 314, 2488, 2637, 4210, 3443, 436, 221, 199, 3, 4204, 1334, 314, 844, 14, 221, 199, 3, 199, 3, 10172, 79, 1679, 298, 8726, 2, 199, 3, 3390, 26, 473, 2793, 1133, 21027, 2382, 473, 1911, 642, 14, 199, 3, 2779, 5712, 1133, 7437, 7508, 12, 10617, 14, 199, 3, 199, 3838, 275, 1616, 199, 1143, 63, 2200, 63, 552, 275, 841, 199, 1143, 63, 4423, 275, 359, 272, 359, 16, 12, 16, 12, 16, 12, 17, 467, 272, 359, 16, 12, 16, 12, 16, 12, 19, 467, 272, 359, 16, 12, 16, 12, 17, 12, 19, 467, 272, 359, 16, 12, 16, 12, 18, 12, 20, 467, 272, 359, 16, 12, 16, 12, 17, 12, 18, 467, 272, 359, 16, 12, 18, 12, 17, 12, 17, 467, 272, 359, 17, 12, 17, 12, 17, 12, 17, 467, 272, 359, 16, 12, 18, 12, 17, 12, 17, 467, 272, 359, 16, 12, 16, 12, 18, 12, 18, 467, 272, 359, 16, 12, 16, 12, 16, 12, 21, 61, 272, 1622, 199, 199, 4574, 275, 1616, 199, 761, 63, 2200, 63, 552, 275, 841, 199, 761, 63, 4423, 275, 359, 272, 359, 16, 12, 16, 12, 16, 12, 20, 467, 272, 359, 16, 12, 16, 12, 17, 12, 19, 467, 272, 359, 16, 12, 16, 12, 18, 12, 19, 467, 272, 359, 16, 12, 16, 12, 17, 12, 18, 467, 272, 359, 16, 12, 16, 12, 18, 12, 18, 467, 272, 359, 16, 12, 17, 12, 17, 12, 17, 467, 272, 359, 17, 12, 17, 12, 17, 12, 17, 467, 272, 359, 16, 12, 17, 12, 17, 12, 17, 467, 272, 359, 16, 12, 16, 12, 17, 12, 18, 467, 272, 359, 16, 12, 16, 12, 16, 12, 21, 61, 272, 1622, 421, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 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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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 ]
Humanity4all/SpokenCode
test_common_interpreter.py
2
2306
# pylint: disable=missing-docstring,no-self-use from nose.tools import assert_equals, assert_raises from .common_interpreter import CommonInterpreter class MockNode(): def __init__(self, value): self.value = value def make_list_of_mock_nodes(plain_list): node_list = [] for item in plain_list: node_list.append(MockNode(item)) return node_list class TestNumbers(): def test_valid_number_elements(self): test_cases = [ ("zero", 0), ("one", 1), ("forty", 40), ("fourty", 40), ("million", 10**6), ("fourteen", 14), ("8", 8), (80, 80), ("hundred", 100)] interpreter = CommonInterpreter() for test_case in test_cases: assert_equals( interpreter.visit_number_element(MockNode(test_case[0]), None), test_case[1]) def test_invalid_number_elements(self): test_cases = [ "eleventyone", "pi"] interpreter = CommonInterpreter() for test_case in test_cases: with assert_raises(ValueError): interpreter.visit_number_element(MockNode(test_case), None) print(test_case) def test_unsigned_integer(self): test_cases = [ ([1, 100], 100), ([14], 14), ([1, 2, 3, 4], 1234), ([19, 1000, 4, 100, 20, 3], 19423), ([100, 90, 1000], 190000), ([100, 90, 8, 1000], 198000), ([200, 90, 8, 1000], 298000), ([1, 100, 90, 8, 1000], 198000), ([1e6, 400, 1000], 1400000)] interpreter = CommonInterpreter() for test_case in test_cases: assert_equals( interpreter.visit_unsigned_integer( None, test_case[0]), test_case[1]) def test_signed_integer(self): test_cases = [ (['-', 100], -100), ([100], 100)] # case without minus interpreter = CommonInterpreter() for test_case in test_cases: assert_equals( interpreter.visit_signed_integer( None, test_case[0]), test_case[1])
gpl-3.0
[ 3, 4287, 26, 3507, 29, 4752, 13, 12485, 12, 889, 13, 277, 13, 1180, 199, 504, 11354, 14, 2537, 492, 702, 63, 11332, 12, 702, 63, 3536, 199, 504, 1275, 2330, 63, 20244, 492, 13964, 2620, 26499, 199, 199, 533, 4420, 1716, 837, 272, 347, 636, 826, 721, 277, 12, 574, 304, 267, 291, 14, 585, 275, 574, 199, 199, 318, 1852, 63, 513, 63, 1618, 63, 1805, 63, 2415, 8, 6104, 63, 513, 304, 272, 1031, 63, 513, 275, 942, 272, 367, 1242, 315, 8971, 63, 513, 26, 267, 1031, 63, 513, 14, 740, 8, 3346, 1716, 8, 1053, 430, 272, 372, 1031, 63, 513, 199, 199, 533, 1379, 22951, 837, 272, 347, 511, 63, 1078, 63, 1955, 63, 5527, 8, 277, 304, 267, 511, 63, 9403, 275, 359, 288, 1689, 4262, 401, 378, 395, 288, 1689, 368, 401, 413, 395, 288, 1689, 10279, 89, 401, 6335, 395, 288, 1689, 13672, 369, 401, 6335, 395, 288, 1689, 19579, 265, 401, 1616, 538, 22, 395, 288, 1689, 13672, 25076, 401, 4329, 395, 288, 1689, 24, 401, 1695, 395, 288, 334, 1257, 12, 5939, 395, 288, 1689, 72, 725, 581, 401, 2948, 1874, 267, 12693, 275, 13964, 2620, 26499, 342, 267, 367, 511, 63, 2546, 315, 511, 63, 9403, 26, 288, 702, 63, 11332, 8, 355, 12693, 14, 5427, 63, 1955, 63, 2108, 8, 3346, 1716, 8, 396, 63, 2546, 59, 16, 2522, 488, 395, 355, 511, 63, 2546, 59, 17, 566, 339, 347, 511, 63, 3197, 63, 1955, 63, 5527, 8, 277, 304, 267, 511, 63, 9403, 275, 359, 288, 298, 8081, 1856, 369, 368, 401, 288, 298, 1038, 937, 267, 12693, 275, 13964, 2620, 26499, 342, 267, 367, 511, 63, 2546, 315, 511, 63, 9403, 26, 288, 543, 702, 63, 3536, 8, 3393, 304, 355, 12693, 14, 5427, 63, 1955, 63, 2108, 8, 3346, 1716, 8, 396, 63, 2546, 395, 488, 9, 355, 870, 8, 396, 63, 2546, 9, 339, 347, 511, 63, 2244, 63, 4115, 8, 277, 304, 267, 511, 63, 9403, 275, 359, 288, 7287, 17, 12, 2948, 467, 2948, 395, 288, 7287, 1079, 467, 4329, 395, 288, 7287, 17, 12, 499, 12, 650, 12, 841, 467, 14763, 395, 288, 7287, 1167, 12, 5198, 12, 841, 12, 2948, 12, 3388, 12, 650, 467, 413, 2635, 1789, 395, 288, 7287, 1960, 12, 9137, 12, 5198, 467, 5851, 993, 395, 288, 7287, 1960, 12, 9137, 12, 1695, 12, 5198, 467, 413, 2905, 1493, 395, 288, 7287, 1840, 12, 9137, 12, 1695, 12, 5198, 467, 499, 2905, 1493, 395, 288, 7287, 17, 12, 2948, 12, 9137, 12, 1695, 12, 5198, 467, 413, 2905, 1493, 395, 288, 7287, 17, 69, 22, 12, 8290, 12, 5198, 467, 4329, 5345, 1874, 267, 12693, 275, 13964, 2620, 26499, 342, 267, 367, 511, 63, 2546, 315, 511, 63, 9403, 26, 288, 702, 63, 11332, 8, 355, 12693, 14, 5427, 63, 2244, 63, 4115, 8, 490, 488, 12, 490, 511, 63, 2546, 59, 16, 2522, 355, 511, 63, 2546, 59, 17, 566, 339, 347, 511, 63, 1737, 63, 4115, 8, 277, 304, 267, 511, 63, 9403, 275, 359, 288, 21022, 14382, 2948, 467, 446, 1960, 395, 288, 7287, 1960, 467, 2948, 1874, 221, 327, 1930, 1928, 21357, 267, 12693, 275, 13964, 2620, 26499, 342, 267, 367, 511, 63, 2546, 315, 511, 63, 9403, 26, 288, 702, 63, 11332, 8, 355, 12693, 14, 5427, 63, 1737, 63, 4115, 8, 490, 488, 12, 490, 511, 63, 2546, 59, 16, 2522, 355, 511, 63, 2546, 59, 17, 566, 199, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768 ]
[ 4287, 26, 3507, 29, 4752, 13, 12485, 12, 889, 13, 277, 13, 1180, 199, 504, 11354, 14, 2537, 492, 702, 63, 11332, 12, 702, 63, 3536, 199, 504, 1275, 2330, 63, 20244, 492, 13964, 2620, 26499, 199, 199, 533, 4420, 1716, 837, 272, 347, 636, 826, 721, 277, 12, 574, 304, 267, 291, 14, 585, 275, 574, 199, 199, 318, 1852, 63, 513, 63, 1618, 63, 1805, 63, 2415, 8, 6104, 63, 513, 304, 272, 1031, 63, 513, 275, 942, 272, 367, 1242, 315, 8971, 63, 513, 26, 267, 1031, 63, 513, 14, 740, 8, 3346, 1716, 8, 1053, 430, 272, 372, 1031, 63, 513, 199, 199, 533, 1379, 22951, 837, 272, 347, 511, 63, 1078, 63, 1955, 63, 5527, 8, 277, 304, 267, 511, 63, 9403, 275, 359, 288, 1689, 4262, 401, 378, 395, 288, 1689, 368, 401, 413, 395, 288, 1689, 10279, 89, 401, 6335, 395, 288, 1689, 13672, 369, 401, 6335, 395, 288, 1689, 19579, 265, 401, 1616, 538, 22, 395, 288, 1689, 13672, 25076, 401, 4329, 395, 288, 1689, 24, 401, 1695, 395, 288, 334, 1257, 12, 5939, 395, 288, 1689, 72, 725, 581, 401, 2948, 1874, 267, 12693, 275, 13964, 2620, 26499, 342, 267, 367, 511, 63, 2546, 315, 511, 63, 9403, 26, 288, 702, 63, 11332, 8, 355, 12693, 14, 5427, 63, 1955, 63, 2108, 8, 3346, 1716, 8, 396, 63, 2546, 59, 16, 2522, 488, 395, 355, 511, 63, 2546, 59, 17, 566, 339, 347, 511, 63, 3197, 63, 1955, 63, 5527, 8, 277, 304, 267, 511, 63, 9403, 275, 359, 288, 298, 8081, 1856, 369, 368, 401, 288, 298, 1038, 937, 267, 12693, 275, 13964, 2620, 26499, 342, 267, 367, 511, 63, 2546, 315, 511, 63, 9403, 26, 288, 543, 702, 63, 3536, 8, 3393, 304, 355, 12693, 14, 5427, 63, 1955, 63, 2108, 8, 3346, 1716, 8, 396, 63, 2546, 395, 488, 9, 355, 870, 8, 396, 63, 2546, 9, 339, 347, 511, 63, 2244, 63, 4115, 8, 277, 304, 267, 511, 63, 9403, 275, 359, 288, 7287, 17, 12, 2948, 467, 2948, 395, 288, 7287, 1079, 467, 4329, 395, 288, 7287, 17, 12, 499, 12, 650, 12, 841, 467, 14763, 395, 288, 7287, 1167, 12, 5198, 12, 841, 12, 2948, 12, 3388, 12, 650, 467, 413, 2635, 1789, 395, 288, 7287, 1960, 12, 9137, 12, 5198, 467, 5851, 993, 395, 288, 7287, 1960, 12, 9137, 12, 1695, 12, 5198, 467, 413, 2905, 1493, 395, 288, 7287, 1840, 12, 9137, 12, 1695, 12, 5198, 467, 499, 2905, 1493, 395, 288, 7287, 17, 12, 2948, 12, 9137, 12, 1695, 12, 5198, 467, 413, 2905, 1493, 395, 288, 7287, 17, 69, 22, 12, 8290, 12, 5198, 467, 4329, 5345, 1874, 267, 12693, 275, 13964, 2620, 26499, 342, 267, 367, 511, 63, 2546, 315, 511, 63, 9403, 26, 288, 702, 63, 11332, 8, 355, 12693, 14, 5427, 63, 2244, 63, 4115, 8, 490, 488, 12, 490, 511, 63, 2546, 59, 16, 2522, 355, 511, 63, 2546, 59, 17, 566, 339, 347, 511, 63, 1737, 63, 4115, 8, 277, 304, 267, 511, 63, 9403, 275, 359, 288, 21022, 14382, 2948, 467, 446, 1960, 395, 288, 7287, 1960, 467, 2948, 1874, 221, 327, 1930, 1928, 21357, 267, 12693, 275, 13964, 2620, 26499, 342, 267, 367, 511, 63, 2546, 315, 511, 63, 9403, 26, 288, 702, 63, 11332, 8, 355, 12693, 14, 5427, 63, 1737, 63, 4115, 8, 490, 488, 12, 490, 511, 63, 2546, 59, 16, 2522, 355, 511, 63, 2546, 59, 17, 566, 199, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 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 ]
daniel2101/fleosa
sale/report/sale_report.py
6
5790
# -*- 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 tools from osv import fields, osv class sale_report(osv.osv): _name = "sale.report" _description = "Sales Orders Statistics" _auto = False _rec_name = 'date' _columns = { 'date': fields.date('Date Order', readonly=True), 'date_confirm': fields.date('Date Confirm', readonly=True), 'shipped': fields.boolean('Shipped', readonly=True), 'shipped_qty_1': fields.integer('Shipped', readonly=True), 'year': fields.char('Year', size=4, readonly=True), 'month': fields.selection([('01', 'January'), ('02', 'February'), ('03', 'March'), ('04', 'April'), ('05', 'May'), ('06', 'June'), ('07', 'July'), ('08', 'August'), ('09', 'September'), ('10', 'October'), ('11', 'November'), ('12', 'December')], 'Month', readonly=True), 'day': fields.char('Day', size=128, readonly=True), 'product_id': fields.many2one('product.product', 'Product', readonly=True), 'product_uom': fields.many2one('product.uom', 'UoM', readonly=True), 'product_uom_qty': fields.float('# of Qty', readonly=True), 'partner_id': fields.many2one('res.partner', 'Partner', readonly=True), 'shop_id': fields.many2one('sale.shop', 'Shop', readonly=True), 'company_id': fields.many2one('res.company', 'Company', readonly=True), 'user_id': fields.many2one('res.users', 'Salesman', readonly=True), 'price_total': fields.float('Total Price', readonly=True), 'delay': fields.float('Commitment Delay', digits=(16,2), readonly=True), 'categ_id': fields.many2one('product.category','Category of Product', readonly=True), 'nbr': fields.integer('# of Lines', readonly=True), 'state': fields.selection([ ('draft', 'Quotation'), ('waiting_date', 'Waiting Schedule'), ('manual', 'Manual In Progress'), ('progress', 'In Progress'), ('shipping_except', 'Shipping Exception'), ('invoice_except', 'Invoice Exception'), ('done', 'Done'), ('cancel', 'Cancelled') ], 'Order State', readonly=True), 'pricelist_id': fields.many2one('product.pricelist', 'Pricelist', readonly=True), 'analytic_account_id': fields.many2one('account.analytic.account', 'Analytic Account', readonly=True), } _order = 'date desc' def init(self, cr): tools.drop_view_if_exists(cr, 'sale_report') cr.execute(""" create or replace view sale_report as ( select min(l.id) as id, l.product_id as product_id, t.uom_id as product_uom, sum(l.product_uom_qty / u.factor * u2.factor) as product_uom_qty, sum(l.product_uom_qty * l.price_unit * (100.0-l.discount) / 100.0) as price_total, 1 as nbr, s.date_order as date, s.date_confirm as date_confirm, to_char(s.date_order, 'YYYY') as year, to_char(s.date_order, 'MM') as month, to_char(s.date_order, 'YYYY-MM-DD') as day, s.partner_id as partner_id, s.user_id as user_id, s.shop_id as shop_id, s.company_id as company_id, extract(epoch from avg(date_trunc('day',s.date_confirm)-date_trunc('day',s.create_date)))/(24*60*60)::decimal(16,2) as delay, s.state, t.categ_id as categ_id, s.shipped, s.shipped::integer as shipped_qty_1, s.pricelist_id as pricelist_id, s.project_id as analytic_account_id from sale_order s join sale_order_line l on (s.id=l.order_id) left join product_product p on (l.product_id=p.id) left join product_template t on (p.product_tmpl_id=t.id) left join product_uom u on (u.id=l.product_uom) left join product_uom u2 on (u2.id=t.uom_id) group by l.product_id, l.product_uom_qty, l.order_id, t.uom_id, t.categ_id, s.date_order, s.date_confirm, s.partner_id, s.user_id, s.shop_id, s.company_id, s.state, s.shipped, s.pricelist_id, s.project_id ) """) sale_report() # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
gpl-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, 7249, 199, 504, 9506, 492, 1504, 12, 9506, 199, 199, 533, 13590, 63, 3070, 8, 4795, 14, 4795, 304, 272, 485, 354, 275, 298, 8515, 14, 3070, 2, 272, 485, 1802, 275, 298, 18220, 4236, 7735, 28365, 2, 272, 485, 2495, 275, 756, 272, 485, 2761, 63, 354, 275, 283, 602, 7, 272, 485, 3406, 275, 469, 267, 283, 602, 356, 1504, 14, 602, 360, 2506, 9240, 297, 6863, 29, 549, 395, 267, 283, 602, 63, 9548, 356, 1504, 14, 602, 360, 2506, 32112, 297, 6863, 29, 549, 395, 267, 283, 3319, 1915, 356, 1504, 14, 4871, 360, 30707, 1915, 297, 6863, 29, 549, 395, 267, 283, 3319, 1915, 63, 5643, 63, 17, 356, 1504, 14, 4115, 360, 30707, 1915, 297, 6863, 29, 549, 395, 267, 283, 3403, 356, 1504, 14, 1560, 360, 15731, 297, 1568, 29, 20, 12, 6863, 29, 549, 395, 267, 283, 4482, 356, 1504, 14, 5592, 8318, 614, 297, 283, 19825, 20527, 659, 661, 996, 297, 283, 27717, 26709, 659, 661, 1644, 297, 283, 45, 1047, 659, 661, 966, 297, 283, 33, 28026, 659, 288, 661, 1717, 297, 283, 15586, 659, 661, 1690, 297, 283, 42, 11474, 659, 661, 1780, 297, 283, 42, 21797, 659, 661, 2036, 297, 283, 21640, 833, 659, 661, 1643, 297, 283, 23337, 31575, 659, 288, 661, 709, 297, 283, 17584, 22459, 659, 661, 845, 297, 283, 1944, 432, 976, 659, 661, 713, 297, 283, 872, 26381, 2665, 283, 14306, 297, 6863, 29, 549, 395, 267, 283, 2977, 356, 1504, 14, 1560, 360, 12631, 297, 1568, 29, 3933, 12, 6863, 29, 549, 395, 267, 283, 2558, 63, 344, 356, 1504, 14, 3479, 18, 368, 360, 2558, 14, 2558, 297, 283, 5884, 297, 6863, 29, 549, 395, 267, 283, 2558, 63, 7519, 356, 1504, 14, 3479, 18, 368, 360, 2558, 14, 7519, 297, 283, 53, 79, 45, 297, 6863, 29, 549, 395, 267, 283, 2558, 63, 7519, 63, 5643, 356, 1504, 14, 1609, 7863, 402, 1413, 369, 297, 6863, 29, 549, 395, 398, 283, 3899, 63, 344, 356, 1504, 14, 3479, 18, 368, 360, 470, 14, 3899, 297, 283, 24120, 297, 6863, 29, 549, 395, 267, 283, 10568, 63, 344, 356, 1504, 14, 3479, 18, 368, 360, 8515, 14, 10568, 297, 283, 2662, 411, 297, 6863, 29, 549, 395, 267, 283, 4627, 63, 344, 356, 1504, 14, 3479, 18, 368, 360, 470, 14, 4627, 297, 283, 16063, 297, 6863, 29, 549, 395, 267, 283, 751, 63, 344, 356, 1504, 14, 3479, 18, 368, 360, 470, 14, 3707, 297, 283, 18220, 1237, 297, 6863, 29, 549, 395, 267, 283, 4777, 63, 2923, 356, 1504, 14, 1609, 360, 7316, 20276, 297, 6863, 29, 549, 395, 267, 283, 5814, 356, 1504, 14, 1609, 360, 11421, 434, 18464, 1187, 297, 7576, 2687, 975, 12, 18, 395, 6863, 29, 549, 395, 267, 283, 3533, 63, 344, 356, 1504, 14, 3479, 18, 368, 360, 2558, 14, 3710, 1673, 7841, 402, 12705, 297, 6863, 29, 549, 395, 267, 283, 23299, 356, 1504, 14, 4115, 7863, 402, 29406, 297, 6863, 29, 549, 395, 267, 283, 929, 356, 1504, 14, 5592, 779, 288, 661, 7185, 297, 283, 2371, 357, 425, 659, 288, 661, 14093, 63, 602, 297, 283, 19189, 24317, 659, 288, 661, 9285, 297, 283, 22382, 1010, 21211, 659, 288, 661, 5734, 297, 283, 607, 21211, 659, 288, 661, 17801, 63, 2590, 297, 283, 30707, 4073, 2186, 659, 288, 661, 5404, 63, 2590, 297, 283, 21092, 2186, 659, 288, 661, 4456, 297, 283, 10759, 659, 288, 661, 6406, 297, 283, 22127, 358, 288, 2156, 283, 4738, 8511, 297, 6863, 29, 549, 395, 267, 283, 17385, 63, 344, 356, 1504, 14, 3479, 18, 368, 360, 2558, 14, 17385, 297, 283, 11826, 513, 297, 6863, 29, 549, 395, 267, 283, 9782, 63, 2048, 63, 344, 356, 1504, 14, 3479, 18, 368, 360, 2048, 14, 9782, 14, 2048, 297, 283, 8014, 764, 9973, 297, 6863, 29, 549, 395, 272, 789, 272, 485, 1648, 275, 283, 602, 4328, 7, 272, 347, 4205, 8, 277, 12, 2467, 304, 267, 7249, 14, 4824, 63, 1345, 63, 692, 63, 2444, 8, 1556, 12, 283, 8515, 63, 3070, 358, 267, 2467, 14, 2526, 4852, 288, 1218, 503, 3350, 2455, 13590, 63, 3070, 465, 334, 355, 3504, 490, 1748, 8, 76, 14, 344, 9, 465, 1305, 12, 490, 634, 14, 2558, 63, 344, 465, 3336, 63, 344, 12, 490, 307, 14, 7519, 63, 344, 465, 3336, 63, 7519, 12, 490, 3089, 8, 76, 14, 2558, 63, 7519, 63, 5643, 1182, 399, 14, 4778, 627, 399, 18, 14, 4778, 9, 465, 3336, 63, 7519, 63, 5643, 12, 490, 3089, 8, 76, 14, 2558, 63, 7519, 63, 5643, 627, 634, 14, 4777, 63, 3248, 627, 334, 1960, 14, 16, 13, 76, 14, 15446, 9, 1182, 2948, 14, 16, 9, 465, 8033, 63, 2923, 12, 490, 413, 465, 31646, 12, 490, 308, 14, 602, 63, 1648, 465, 1434, 12, 490, 308, 14, 602, 63, 9548, 465 ]
[ 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, 7249, 199, 504, 9506, 492, 1504, 12, 9506, 199, 199, 533, 13590, 63, 3070, 8, 4795, 14, 4795, 304, 272, 485, 354, 275, 298, 8515, 14, 3070, 2, 272, 485, 1802, 275, 298, 18220, 4236, 7735, 28365, 2, 272, 485, 2495, 275, 756, 272, 485, 2761, 63, 354, 275, 283, 602, 7, 272, 485, 3406, 275, 469, 267, 283, 602, 356, 1504, 14, 602, 360, 2506, 9240, 297, 6863, 29, 549, 395, 267, 283, 602, 63, 9548, 356, 1504, 14, 602, 360, 2506, 32112, 297, 6863, 29, 549, 395, 267, 283, 3319, 1915, 356, 1504, 14, 4871, 360, 30707, 1915, 297, 6863, 29, 549, 395, 267, 283, 3319, 1915, 63, 5643, 63, 17, 356, 1504, 14, 4115, 360, 30707, 1915, 297, 6863, 29, 549, 395, 267, 283, 3403, 356, 1504, 14, 1560, 360, 15731, 297, 1568, 29, 20, 12, 6863, 29, 549, 395, 267, 283, 4482, 356, 1504, 14, 5592, 8318, 614, 297, 283, 19825, 20527, 659, 661, 996, 297, 283, 27717, 26709, 659, 661, 1644, 297, 283, 45, 1047, 659, 661, 966, 297, 283, 33, 28026, 659, 288, 661, 1717, 297, 283, 15586, 659, 661, 1690, 297, 283, 42, 11474, 659, 661, 1780, 297, 283, 42, 21797, 659, 661, 2036, 297, 283, 21640, 833, 659, 661, 1643, 297, 283, 23337, 31575, 659, 288, 661, 709, 297, 283, 17584, 22459, 659, 661, 845, 297, 283, 1944, 432, 976, 659, 661, 713, 297, 283, 872, 26381, 2665, 283, 14306, 297, 6863, 29, 549, 395, 267, 283, 2977, 356, 1504, 14, 1560, 360, 12631, 297, 1568, 29, 3933, 12, 6863, 29, 549, 395, 267, 283, 2558, 63, 344, 356, 1504, 14, 3479, 18, 368, 360, 2558, 14, 2558, 297, 283, 5884, 297, 6863, 29, 549, 395, 267, 283, 2558, 63, 7519, 356, 1504, 14, 3479, 18, 368, 360, 2558, 14, 7519, 297, 283, 53, 79, 45, 297, 6863, 29, 549, 395, 267, 283, 2558, 63, 7519, 63, 5643, 356, 1504, 14, 1609, 7863, 402, 1413, 369, 297, 6863, 29, 549, 395, 398, 283, 3899, 63, 344, 356, 1504, 14, 3479, 18, 368, 360, 470, 14, 3899, 297, 283, 24120, 297, 6863, 29, 549, 395, 267, 283, 10568, 63, 344, 356, 1504, 14, 3479, 18, 368, 360, 8515, 14, 10568, 297, 283, 2662, 411, 297, 6863, 29, 549, 395, 267, 283, 4627, 63, 344, 356, 1504, 14, 3479, 18, 368, 360, 470, 14, 4627, 297, 283, 16063, 297, 6863, 29, 549, 395, 267, 283, 751, 63, 344, 356, 1504, 14, 3479, 18, 368, 360, 470, 14, 3707, 297, 283, 18220, 1237, 297, 6863, 29, 549, 395, 267, 283, 4777, 63, 2923, 356, 1504, 14, 1609, 360, 7316, 20276, 297, 6863, 29, 549, 395, 267, 283, 5814, 356, 1504, 14, 1609, 360, 11421, 434, 18464, 1187, 297, 7576, 2687, 975, 12, 18, 395, 6863, 29, 549, 395, 267, 283, 3533, 63, 344, 356, 1504, 14, 3479, 18, 368, 360, 2558, 14, 3710, 1673, 7841, 402, 12705, 297, 6863, 29, 549, 395, 267, 283, 23299, 356, 1504, 14, 4115, 7863, 402, 29406, 297, 6863, 29, 549, 395, 267, 283, 929, 356, 1504, 14, 5592, 779, 288, 661, 7185, 297, 283, 2371, 357, 425, 659, 288, 661, 14093, 63, 602, 297, 283, 19189, 24317, 659, 288, 661, 9285, 297, 283, 22382, 1010, 21211, 659, 288, 661, 5734, 297, 283, 607, 21211, 659, 288, 661, 17801, 63, 2590, 297, 283, 30707, 4073, 2186, 659, 288, 661, 5404, 63, 2590, 297, 283, 21092, 2186, 659, 288, 661, 4456, 297, 283, 10759, 659, 288, 661, 6406, 297, 283, 22127, 358, 288, 2156, 283, 4738, 8511, 297, 6863, 29, 549, 395, 267, 283, 17385, 63, 344, 356, 1504, 14, 3479, 18, 368, 360, 2558, 14, 17385, 297, 283, 11826, 513, 297, 6863, 29, 549, 395, 267, 283, 9782, 63, 2048, 63, 344, 356, 1504, 14, 3479, 18, 368, 360, 2048, 14, 9782, 14, 2048, 297, 283, 8014, 764, 9973, 297, 6863, 29, 549, 395, 272, 789, 272, 485, 1648, 275, 283, 602, 4328, 7, 272, 347, 4205, 8, 277, 12, 2467, 304, 267, 7249, 14, 4824, 63, 1345, 63, 692, 63, 2444, 8, 1556, 12, 283, 8515, 63, 3070, 358, 267, 2467, 14, 2526, 4852, 288, 1218, 503, 3350, 2455, 13590, 63, 3070, 465, 334, 355, 3504, 490, 1748, 8, 76, 14, 344, 9, 465, 1305, 12, 490, 634, 14, 2558, 63, 344, 465, 3336, 63, 344, 12, 490, 307, 14, 7519, 63, 344, 465, 3336, 63, 7519, 12, 490, 3089, 8, 76, 14, 2558, 63, 7519, 63, 5643, 1182, 399, 14, 4778, 627, 399, 18, 14, 4778, 9, 465, 3336, 63, 7519, 63, 5643, 12, 490, 3089, 8, 76, 14, 2558, 63, 7519, 63, 5643, 627, 634, 14, 4777, 63, 3248, 627, 334, 1960, 14, 16, 13, 76, 14, 15446, 9, 1182, 2948, 14, 16, 9, 465, 8033, 63, 2923, 12, 490, 413, 465, 31646, 12, 490, 308, 14, 602, 63, 1648, 465, 1434, 12, 490, 308, 14, 602, 63, 9548, 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, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 ]
Medium/phantomjs-1
src/qt/qtwebkit/Tools/Scripts/webkitpy/layout_tests/controllers/manager.py
113
18377
# Copyright (C) 2010 Google Inc. All rights reserved. # Copyright (C) 2010 Gabor Rapcsanyi ([email protected]), University of Szeged # # 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. """ The Manager runs a series of tests (TestType interface) against a set of test files. If a test file fails a TestType, it returns a list of TestFailure objects to the Manager. The Manager then aggregates the TestFailures to create a final report. """ import json import logging import random import sys import time from webkitpy.layout_tests.controllers.layout_test_finder import LayoutTestFinder from webkitpy.layout_tests.controllers.layout_test_runner import LayoutTestRunner from webkitpy.layout_tests.controllers.test_result_writer import TestResultWriter from webkitpy.layout_tests.layout_package import json_layout_results_generator from webkitpy.layout_tests.layout_package import json_results_generator from webkitpy.layout_tests.models import test_expectations from webkitpy.layout_tests.models import test_failures from webkitpy.layout_tests.models import test_run_results from webkitpy.layout_tests.models.test_input import TestInput _log = logging.getLogger(__name__) # Builder base URL where we have the archived test results. BUILDER_BASE_URL = "http://build.chromium.org/buildbot/layout_test_results/" TestExpectations = test_expectations.TestExpectations class Manager(object): """A class for managing running a series of tests on a series of layout test files.""" def __init__(self, port, options, printer): """Initialize test runner data structures. Args: port: an object implementing port-specific options: a dictionary of command line options printer: a Printer object to record updates to. """ self._port = port self._filesystem = port.host.filesystem self._options = options self._printer = printer self._expectations = None self.HTTP_SUBDIR = 'http' + port.TEST_PATH_SEPARATOR self.PERF_SUBDIR = 'perf' self.WEBSOCKET_SUBDIR = 'websocket' + port.TEST_PATH_SEPARATOR self.LAYOUT_TESTS_DIRECTORY = 'LayoutTests' # disable wss server. need to install pyOpenSSL on buildbots. # self._websocket_secure_server = websocket_server.PyWebSocket( # options.results_directory, use_tls=True, port=9323) self._results_directory = self._port.results_directory() self._finder = LayoutTestFinder(self._port, self._options) self._runner = LayoutTestRunner(self._options, self._port, self._printer, self._results_directory, self._test_is_slow) def _collect_tests(self, args): return self._finder.find_tests(self._options, args) def _is_http_test(self, test): return self.HTTP_SUBDIR in test or self._is_websocket_test(test) def _is_websocket_test(self, test): return self.WEBSOCKET_SUBDIR in test def _http_tests(self, test_names): return set(test for test in test_names if self._is_http_test(test)) def _is_perf_test(self, test): return self.PERF_SUBDIR == test or (self.PERF_SUBDIR + self._port.TEST_PATH_SEPARATOR) in test def _prepare_lists(self, paths, test_names): tests_to_skip = self._finder.skip_tests(paths, test_names, self._expectations, self._http_tests(test_names)) tests_to_run = [test for test in test_names if test not in tests_to_skip] # Create a sorted list of test files so the subset chunk, # if used, contains alphabetically consecutive tests. if self._options.order == 'natural': tests_to_run.sort(key=self._port.test_key) elif self._options.order == 'random': random.shuffle(tests_to_run) tests_to_run, tests_in_other_chunks = self._finder.split_into_chunks(tests_to_run) self._expectations.add_skipped_tests(tests_in_other_chunks) tests_to_skip.update(tests_in_other_chunks) return tests_to_run, tests_to_skip def _test_input_for_file(self, test_file): return TestInput(test_file, self._options.slow_time_out_ms if self._test_is_slow(test_file) else self._options.time_out_ms, self._test_requires_lock(test_file)) def _test_requires_lock(self, test_file): """Return True if the test needs to be locked when running multiple copies of NRWTs. Perf tests are locked because heavy load caused by running other tests in parallel might cause some of them to timeout.""" return self._is_http_test(test_file) or self._is_perf_test(test_file) def _test_is_slow(self, test_file): return self._expectations.has_modifier(test_file, test_expectations.SLOW) def needs_servers(self, test_names): return any(self._test_requires_lock(test_name) for test_name in test_names) and self._options.http def _set_up_run(self, test_names): self._printer.write_update("Checking build ...") if not self._port.check_build(self.needs_servers(test_names)): _log.error("Build check failed") return False # This must be started before we check the system dependencies, # since the helper may do things to make the setup correct. if self._options.pixel_tests: self._printer.write_update("Starting pixel test helper ...") self._port.start_helper() # Check that the system dependencies (themes, fonts, ...) are correct. if not self._options.nocheck_sys_deps: self._printer.write_update("Checking system dependencies ...") if not self._port.check_sys_deps(self.needs_servers(test_names)): self._port.stop_helper() return False if self._options.clobber_old_results: self._clobber_old_results() # Create the output directory if it doesn't already exist. self._port.host.filesystem.maybe_make_directory(self._results_directory) self._port.setup_test_run() return True def run(self, args): """Run the tests and return a RunDetails object with the results.""" self._printer.write_update("Collecting tests ...") try: paths, test_names = self._collect_tests(args) except IOError: # This is raised if --test-list doesn't exist return test_run_results.RunDetails(exit_code=-1) self._printer.write_update("Parsing expectations ...") self._expectations = test_expectations.TestExpectations(self._port, test_names) tests_to_run, tests_to_skip = self._prepare_lists(paths, test_names) self._printer.print_found(len(test_names), len(tests_to_run), self._options.repeat_each, self._options.iterations) # Check to make sure we're not skipping every test. if not tests_to_run: _log.critical('No tests to run.') return test_run_results.RunDetails(exit_code=-1) if not self._set_up_run(tests_to_run): return test_run_results.RunDetails(exit_code=-1) start_time = time.time() enabled_pixel_tests_in_retry = False try: initial_results = self._run_tests(tests_to_run, tests_to_skip, self._options.repeat_each, self._options.iterations, int(self._options.child_processes), retrying=False) tests_to_retry = self._tests_to_retry(initial_results, include_crashes=self._port.should_retry_crashes()) if self._options.retry_failures and tests_to_retry and not initial_results.interrupted: enabled_pixel_tests_in_retry = self._force_pixel_tests_if_needed() _log.info('') _log.info("Retrying %d unexpected failure(s) ..." % len(tests_to_retry)) _log.info('') retry_results = self._run_tests(tests_to_retry, tests_to_skip=set(), repeat_each=1, iterations=1, num_workers=1, retrying=True) if enabled_pixel_tests_in_retry: self._options.pixel_tests = False else: retry_results = None finally: self._clean_up_run() end_time = time.time() # Some crash logs can take a long time to be written out so look # for new logs after the test run finishes. _log.debug("looking for new crash logs") self._look_for_new_crash_logs(initial_results, start_time) if retry_results: self._look_for_new_crash_logs(retry_results, start_time) _log.debug("summarizing results") summarized_results = test_run_results.summarize_results(self._port, self._expectations, initial_results, retry_results, enabled_pixel_tests_in_retry) self._printer.print_results(end_time - start_time, initial_results, summarized_results) if not self._options.dry_run: self._port.print_leaks_summary() self._upload_json_files(summarized_results, initial_results) results_path = self._filesystem.join(self._results_directory, "results.html") self._copy_results_html_file(results_path) if self._options.show_results and (initial_results.unexpected_results_by_name or (self._options.full_results_html and initial_results.total_failures)): self._port.show_results_html_file(results_path) return test_run_results.RunDetails(self._port.exit_code_from_summarized_results(summarized_results), summarized_results, initial_results, retry_results, enabled_pixel_tests_in_retry) def _run_tests(self, tests_to_run, tests_to_skip, repeat_each, iterations, num_workers, retrying): needs_http = any(self._is_http_test(test) for test in tests_to_run) needs_websockets = any(self._is_websocket_test(test) for test in tests_to_run) test_inputs = [] for _ in xrange(iterations): for test in tests_to_run: for _ in xrange(repeat_each): test_inputs.append(self._test_input_for_file(test)) return self._runner.run_tests(self._expectations, test_inputs, tests_to_skip, num_workers, needs_http, needs_websockets, retrying) def _clean_up_run(self): _log.debug("Flushing stdout") sys.stdout.flush() _log.debug("Flushing stderr") sys.stderr.flush() _log.debug("Stopping helper") self._port.stop_helper() _log.debug("Cleaning up port") self._port.clean_up_test_run() def _force_pixel_tests_if_needed(self): if self._options.pixel_tests: return False _log.debug("Restarting helper") self._port.stop_helper() self._options.pixel_tests = True self._port.start_helper() return True def _look_for_new_crash_logs(self, run_results, start_time): """Since crash logs can take a long time to be written out if the system is under stress do a second pass at the end of the test run. run_results: the results of the test run start_time: time the tests started at. We're looking for crash logs after that time. """ crashed_processes = [] for test, result in run_results.unexpected_results_by_name.iteritems(): if (result.type != test_expectations.CRASH): continue for failure in result.failures: if not isinstance(failure, test_failures.FailureCrash): continue crashed_processes.append([test, failure.process_name, failure.pid]) sample_files = self._port.look_for_new_samples(crashed_processes, start_time) if sample_files: for test, sample_file in sample_files.iteritems(): writer = TestResultWriter(self._port._filesystem, self._port, self._port.results_directory(), test) writer.copy_sample_file(sample_file) crash_logs = self._port.look_for_new_crash_logs(crashed_processes, start_time) if crash_logs: for test, crash_log in crash_logs.iteritems(): writer = TestResultWriter(self._port._filesystem, self._port, self._port.results_directory(), test) writer.write_crash_log(crash_log) def _clobber_old_results(self): # Just clobber the actual test results directories since the other # files in the results directory are explicitly used for cross-run # tracking. self._printer.write_update("Clobbering old results in %s" % self._results_directory) layout_tests_dir = self._port.layout_tests_dir() possible_dirs = self._port.test_dirs() for dirname in possible_dirs: if self._filesystem.isdir(self._filesystem.join(layout_tests_dir, dirname)): self._filesystem.rmtree(self._filesystem.join(self._results_directory, dirname)) def _tests_to_retry(self, run_results, include_crashes): return [result.test_name for result in run_results.unexpected_results_by_name.values() if ((result.type != test_expectations.PASS) and (result.type != test_expectations.MISSING) and (result.type != test_expectations.CRASH or include_crashes))] def _upload_json_files(self, summarized_results, initial_results): """Writes the results of the test run as JSON files into the results dir and upload the files to the appengine server. Args: summarized_results: dict of results initial_results: full summary object """ _log.debug("Writing JSON files in %s." % self._results_directory) # FIXME: Upload stats.json to the server and delete times_ms. times_trie = json_results_generator.test_timings_trie(self._port, initial_results.results_by_name.values()) times_json_path = self._filesystem.join(self._results_directory, "times_ms.json") json_results_generator.write_json(self._filesystem, times_trie, times_json_path) stats_trie = self._stats_trie(initial_results) stats_path = self._filesystem.join(self._results_directory, "stats.json") self._filesystem.write_text_file(stats_path, json.dumps(stats_trie)) full_results_path = self._filesystem.join(self._results_directory, "full_results.json") # We write full_results.json out as jsonp because we need to load it from a file url and Chromium doesn't allow that. json_results_generator.write_json(self._filesystem, summarized_results, full_results_path, callback="ADD_RESULTS") generator = json_layout_results_generator.JSONLayoutResultsGenerator( self._port, self._options.builder_name, self._options.build_name, self._options.build_number, self._results_directory, BUILDER_BASE_URL, self._expectations, initial_results, self._options.test_results_server, "layout-tests", self._options.master_name) _log.debug("Finished writing JSON files.") json_files = ["incremental_results.json", "full_results.json", "times_ms.json"] generator.upload_json_files(json_files) incremental_results_path = self._filesystem.join(self._results_directory, "incremental_results.json") # Remove these files from the results directory so they don't take up too much space on the buildbot. # The tools use the version we uploaded to the results server anyway. self._filesystem.remove(times_json_path) self._filesystem.remove(incremental_results_path) def _copy_results_html_file(self, destination_path): base_dir = self._port.path_from_webkit_base('LayoutTests', 'fast', 'harness') results_file = self._filesystem.join(base_dir, 'results.html') # Note that the results.html template file won't exist when we're using a MockFileSystem during unit tests, # so make sure it exists before we try to copy it. if self._filesystem.exists(results_file): self._filesystem.copyfile(results_file, destination_path) def _stats_trie(self, initial_results): def _worker_number(worker_name): return int(worker_name.split('/')[1]) if worker_name else -1 stats = {} for result in initial_results.results_by_name.values(): if result.type != test_expectations.SKIP: stats[result.test_name] = {'results': (_worker_number(result.worker_name), result.test_number, result.pid, int(result.test_run_time * 1000), int(result.total_run_time * 1000))} stats_trie = {} for name, value in stats.iteritems(): json_results_generator.add_path_to_trie(name, value, stats_trie) return stats_trie
bsd-3-clause
[ 3, 1898, 334, 35, 9, 7129, 4475, 3277, 14, 2900, 4481, 4644, 14, 199, 3, 1898, 334, 35, 9, 7129, 598, 371, 269, 820, 439, 1259, 1629, 73, 334, 12430, 371, 269, 32, 4904, 14, 85, 13, 83, 806, 3046, 14, 10616, 395, 15904, 402, 428, 806, 3046, 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, 199, 1918, 13537, 7858, 282, 6779, 402, 2295, 334, 774, 804, 3217, 9, 6169, 282, 663, 199, 1618, 511, 1584, 14, 221, 982, 282, 511, 570, 6918, 282, 1379, 804, 12, 652, 2529, 282, 769, 402, 1379, 6782, 199, 1462, 370, 314, 13537, 14, 710, 13537, 2066, 27535, 314, 1379, 29415, 370, 199, 981, 282, 4242, 3622, 14, 199, 624, 199, 199, 646, 2022, 199, 646, 2050, 199, 646, 2196, 199, 646, 984, 199, 646, 900, 199, 199, 504, 18007, 14, 4209, 63, 2219, 14, 20531, 14, 4209, 63, 396, 63, 11681, 492, 25604, 774, 11791, 199, 504, 18007, 14, 4209, 63, 2219, 14, 20531, 14, 4209, 63, 396, 63, 5933, 492, 25604, 13649, 199, 504, 18007, 14, 4209, 63, 2219, 14, 20531, 14, 396, 63, 1099, 63, 5491, 492, 23795, 6261, 199, 504, 18007, 14, 4209, 63, 2219, 14, 4209, 63, 2491, 492, 2022, 63, 4209, 63, 2604, 63, 4679, 199, 504, 18007, 14, 4209, 63, 2219, 14, 4209, 63, 2491, 492, 2022, 63, 2604, 63, 4679, 199, 504, 18007, 14, 4209, 63, 2219, 14, 992, 492, 511, 63, 15752, 199, 504, 18007, 14, 4209, 63, 2219, 14, 992, 492, 511, 63, 9968, 199, 504, 18007, 14, 4209, 63, 2219, 14, 992, 492, 511, 63, 1065, 63, 2604, 199, 504, 18007, 14, 4209, 63, 2219, 14, 992, 14, 396, 63, 1210, 492, 1379, 3205, 199, 199, 63, 793, 275, 2050, 14, 5572, 3460, 354, 3368, 199, 199, 3, 19286, 1300, 2851, 2382, 781, 1172, 314, 3819, 12905, 511, 2058, 14, 199, 8248, 540, 63, 5825, 63, 2632, 275, 298, 1014, 921, 1506, 14, 13211, 14, 1308, 15, 25497, 15, 4209, 63, 396, 63, 2604, 6687, 199, 199, 774, 31323, 275, 511, 63, 15752, 14, 774, 31323, 4388, 199, 533, 13537, 8, 785, 304, 272, 408, 33, 1021, 367, 28453, 3879, 282, 6779, 402, 2295, 641, 282, 6779, 402, 7054, 272, 511, 1584, 1041, 339, 347, 636, 826, 721, 277, 12, 1844, 12, 1511, 12, 16639, 304, 267, 408, 9345, 511, 7876, 666, 13955, 14, 398, 3033, 26, 881, 1844, 26, 376, 909, 18234, 1844, 13, 6100, 881, 1511, 26, 282, 2600, 402, 1414, 1004, 1511, 881, 16639, 26, 282, 25716, 1058, 909, 370, 2777, 7029, 370, 14, 267, 408, 267, 291, 423, 719, 275, 1844, 267, 291, 423, 11381, 275, 1844, 14, 1102, 14, 11381, 267, 291, 423, 1419, 275, 1511, 267, 291, 423, 11835, 275, 16639, 267, 291, 423, 15752, 275, 488, 398, 291, 14, 2856, 63, 6348, 3022, 275, 283, 1014, 7, 435, 1844, 14, 2864, 63, 3243, 63, 15828, 267, 291, 14, 17038, 63, 6348, 3022, 275, 283, 9452, 7, 267, 291, 14, 13166, 17462, 63, 6348, 3022, 275, 283, 13508, 7, 435, 1844, 14, 2864, 63, 3243, 63, 15828, 267, 291, 14, 16897, 1877, 63, 7569, 63, 16436, 275, 283, 4798, 2925, 7, 398, 327, 3507, 336, 385, 1654, 14, 1929, 370, 3907, 1134, 22791, 641, 21306, 83, 14, 267, 327, 291, 423, 13508, 63, 7817, 63, 1000, 275, 24897, 63, 1000, 14, 2713, 18477, 8, 267, 327, 263, 1511, 14, 2604, 63, 3619, 12, 675, 63, 9945, 29, 549, 12, 1844, 29, 25, 13905, 9, 398, 291, 423, 2604, 63, 3619, 275, 291, 423, 719, 14, 2604, 63, 3619, 342, 267, 291, 423, 11681, 275, 25604, 774, 11791, 8, 277, 423, 719, 12, 291, 423, 1419, 9, 267, 291, 423, 5933, 275, 25604, 13649, 8, 277, 423, 1419, 12, 291, 423, 719, 12, 291, 423, 11835, 12, 291, 423, 2604, 63, 3619, 12, 291, 423, 396, 63, 374, 63, 14362, 9, 339, 347, 485, 7112, 63, 2219, 8, 277, 12, 1249, 304, 267, 372, 291, 423, 11681, 14, 1623, 63, 2219, 8, 277, 423, 1419, 12, 1249, 9, 339, 347, 485, 374, 63, 1014, 63, 396, 8, 277, 12, 511, 304, 267, 372, 291, 14, 2856, 63, 6348, 3022, 315, 511, 503, 291, 423, 374, 63, 13508, 63, 396, 8, 396, 9, 339, 347, 485, 374, 63, 13508, 63, 396, 8, 277, 12, 511, 304, 267, 372, 291, 14, 13166 ]
[ 1898, 334, 35, 9, 7129, 4475, 3277, 14, 2900, 4481, 4644, 14, 199, 3, 1898, 334, 35, 9, 7129, 598, 371, 269, 820, 439, 1259, 1629, 73, 334, 12430, 371, 269, 32, 4904, 14, 85, 13, 83, 806, 3046, 14, 10616, 395, 15904, 402, 428, 806, 3046, 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, 199, 1918, 13537, 7858, 282, 6779, 402, 2295, 334, 774, 804, 3217, 9, 6169, 282, 663, 199, 1618, 511, 1584, 14, 221, 982, 282, 511, 570, 6918, 282, 1379, 804, 12, 652, 2529, 282, 769, 402, 1379, 6782, 199, 1462, 370, 314, 13537, 14, 710, 13537, 2066, 27535, 314, 1379, 29415, 370, 199, 981, 282, 4242, 3622, 14, 199, 624, 199, 199, 646, 2022, 199, 646, 2050, 199, 646, 2196, 199, 646, 984, 199, 646, 900, 199, 199, 504, 18007, 14, 4209, 63, 2219, 14, 20531, 14, 4209, 63, 396, 63, 11681, 492, 25604, 774, 11791, 199, 504, 18007, 14, 4209, 63, 2219, 14, 20531, 14, 4209, 63, 396, 63, 5933, 492, 25604, 13649, 199, 504, 18007, 14, 4209, 63, 2219, 14, 20531, 14, 396, 63, 1099, 63, 5491, 492, 23795, 6261, 199, 504, 18007, 14, 4209, 63, 2219, 14, 4209, 63, 2491, 492, 2022, 63, 4209, 63, 2604, 63, 4679, 199, 504, 18007, 14, 4209, 63, 2219, 14, 4209, 63, 2491, 492, 2022, 63, 2604, 63, 4679, 199, 504, 18007, 14, 4209, 63, 2219, 14, 992, 492, 511, 63, 15752, 199, 504, 18007, 14, 4209, 63, 2219, 14, 992, 492, 511, 63, 9968, 199, 504, 18007, 14, 4209, 63, 2219, 14, 992, 492, 511, 63, 1065, 63, 2604, 199, 504, 18007, 14, 4209, 63, 2219, 14, 992, 14, 396, 63, 1210, 492, 1379, 3205, 199, 199, 63, 793, 275, 2050, 14, 5572, 3460, 354, 3368, 199, 199, 3, 19286, 1300, 2851, 2382, 781, 1172, 314, 3819, 12905, 511, 2058, 14, 199, 8248, 540, 63, 5825, 63, 2632, 275, 298, 1014, 921, 1506, 14, 13211, 14, 1308, 15, 25497, 15, 4209, 63, 396, 63, 2604, 6687, 199, 199, 774, 31323, 275, 511, 63, 15752, 14, 774, 31323, 4388, 199, 533, 13537, 8, 785, 304, 272, 408, 33, 1021, 367, 28453, 3879, 282, 6779, 402, 2295, 641, 282, 6779, 402, 7054, 272, 511, 1584, 1041, 339, 347, 636, 826, 721, 277, 12, 1844, 12, 1511, 12, 16639, 304, 267, 408, 9345, 511, 7876, 666, 13955, 14, 398, 3033, 26, 881, 1844, 26, 376, 909, 18234, 1844, 13, 6100, 881, 1511, 26, 282, 2600, 402, 1414, 1004, 1511, 881, 16639, 26, 282, 25716, 1058, 909, 370, 2777, 7029, 370, 14, 267, 408, 267, 291, 423, 719, 275, 1844, 267, 291, 423, 11381, 275, 1844, 14, 1102, 14, 11381, 267, 291, 423, 1419, 275, 1511, 267, 291, 423, 11835, 275, 16639, 267, 291, 423, 15752, 275, 488, 398, 291, 14, 2856, 63, 6348, 3022, 275, 283, 1014, 7, 435, 1844, 14, 2864, 63, 3243, 63, 15828, 267, 291, 14, 17038, 63, 6348, 3022, 275, 283, 9452, 7, 267, 291, 14, 13166, 17462, 63, 6348, 3022, 275, 283, 13508, 7, 435, 1844, 14, 2864, 63, 3243, 63, 15828, 267, 291, 14, 16897, 1877, 63, 7569, 63, 16436, 275, 283, 4798, 2925, 7, 398, 327, 3507, 336, 385, 1654, 14, 1929, 370, 3907, 1134, 22791, 641, 21306, 83, 14, 267, 327, 291, 423, 13508, 63, 7817, 63, 1000, 275, 24897, 63, 1000, 14, 2713, 18477, 8, 267, 327, 263, 1511, 14, 2604, 63, 3619, 12, 675, 63, 9945, 29, 549, 12, 1844, 29, 25, 13905, 9, 398, 291, 423, 2604, 63, 3619, 275, 291, 423, 719, 14, 2604, 63, 3619, 342, 267, 291, 423, 11681, 275, 25604, 774, 11791, 8, 277, 423, 719, 12, 291, 423, 1419, 9, 267, 291, 423, 5933, 275, 25604, 13649, 8, 277, 423, 1419, 12, 291, 423, 719, 12, 291, 423, 11835, 12, 291, 423, 2604, 63, 3619, 12, 291, 423, 396, 63, 374, 63, 14362, 9, 339, 347, 485, 7112, 63, 2219, 8, 277, 12, 1249, 304, 267, 372, 291, 423, 11681, 14, 1623, 63, 2219, 8, 277, 423, 1419, 12, 1249, 9, 339, 347, 485, 374, 63, 1014, 63, 396, 8, 277, 12, 511, 304, 267, 372, 291, 14, 2856, 63, 6348, 3022, 315, 511, 503, 291, 423, 374, 63, 13508, 63, 396, 8, 396, 9, 339, 347, 485, 374, 63, 13508, 63, 396, 8, 277, 12, 511, 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1, 1, 1, 1, 1, 1, 1, 1, 1 ]
marckuz/django
tests/migrations/test_autodetector.py
100
112818
# -*- coding: utf-8 -*- import re from django.apps import apps from django.conf import settings from django.contrib.auth.models import AbstractBaseUser from django.core.validators import RegexValidator, validate_slug from django.db import connection, models from django.db.migrations.autodetector import MigrationAutodetector from django.db.migrations.graph import MigrationGraph from django.db.migrations.loader import MigrationLoader from django.db.migrations.questioner import MigrationQuestioner from django.db.migrations.state import ModelState, ProjectState from django.test import TestCase, mock, override_settings from django.test.utils import isolate_lru_cache from .models import FoodManager, FoodQuerySet class DeconstructableObject(object): """ A custom deconstructable object. """ def __init__(self, *args, **kwargs): self.args = args self.kwargs = kwargs def deconstruct(self): return ( self.__module__ + '.' + self.__class__.__name__, self.args, self.kwargs ) class AutodetectorTests(TestCase): """ Tests the migration autodetector. """ author_empty = ModelState("testapp", "Author", [("id", models.AutoField(primary_key=True))]) author_name = ModelState("testapp", "Author", [ ("id", models.AutoField(primary_key=True)), ("name", models.CharField(max_length=200)), ]) author_name_null = ModelState("testapp", "Author", [ ("id", models.AutoField(primary_key=True)), ("name", models.CharField(max_length=200, null=True)), ]) author_name_longer = ModelState("testapp", "Author", [ ("id", models.AutoField(primary_key=True)), ("name", models.CharField(max_length=400)), ]) author_name_renamed = ModelState("testapp", "Author", [ ("id", models.AutoField(primary_key=True)), ("names", models.CharField(max_length=200)), ]) author_name_default = ModelState("testapp", "Author", [ ("id", models.AutoField(primary_key=True)), ("name", models.CharField(max_length=200, default='Ada Lovelace')), ]) author_name_deconstructable_1 = ModelState("testapp", "Author", [ ("id", models.AutoField(primary_key=True)), ("name", models.CharField(max_length=200, default=DeconstructableObject())), ]) author_name_deconstructable_2 = ModelState("testapp", "Author", [ ("id", models.AutoField(primary_key=True)), ("name", models.CharField(max_length=200, default=DeconstructableObject())), ]) author_name_deconstructable_3 = ModelState("testapp", "Author", [ ("id", models.AutoField(primary_key=True)), ("name", models.CharField(max_length=200, default=models.IntegerField())), ]) author_name_deconstructable_4 = ModelState("testapp", "Author", [ ("id", models.AutoField(primary_key=True)), ("name", models.CharField(max_length=200, default=models.IntegerField())), ]) author_name_deconstructable_list_1 = ModelState("testapp", "Author", [ ("id", models.AutoField(primary_key=True)), ("name", models.CharField(max_length=200, default=[DeconstructableObject(), 123])), ]) author_name_deconstructable_list_2 = ModelState("testapp", "Author", [ ("id", models.AutoField(primary_key=True)), ("name", models.CharField(max_length=200, default=[DeconstructableObject(), 123])), ]) author_name_deconstructable_list_3 = ModelState("testapp", "Author", [ ("id", models.AutoField(primary_key=True)), ("name", models.CharField(max_length=200, default=[DeconstructableObject(), 999])), ]) author_name_deconstructable_tuple_1 = ModelState("testapp", "Author", [ ("id", models.AutoField(primary_key=True)), ("name", models.CharField(max_length=200, default=(DeconstructableObject(), 123))), ]) author_name_deconstructable_tuple_2 = ModelState("testapp", "Author", [ ("id", models.AutoField(primary_key=True)), ("name", models.CharField(max_length=200, default=(DeconstructableObject(), 123))), ]) author_name_deconstructable_tuple_3 = ModelState("testapp", "Author", [ ("id", models.AutoField(primary_key=True)), ("name", models.CharField(max_length=200, default=(DeconstructableObject(), 999))), ]) author_name_deconstructable_dict_1 = ModelState("testapp", "Author", [ ("id", models.AutoField(primary_key=True)), ("name", models.CharField(max_length=200, default={ 'item': DeconstructableObject(), 'otheritem': 123 })), ]) author_name_deconstructable_dict_2 = ModelState("testapp", "Author", [ ("id", models.AutoField(primary_key=True)), ("name", models.CharField(max_length=200, default={ 'item': DeconstructableObject(), 'otheritem': 123 })), ]) author_name_deconstructable_dict_3 = ModelState("testapp", "Author", [ ("id", models.AutoField(primary_key=True)), ("name", models.CharField(max_length=200, default={ 'item': DeconstructableObject(), 'otheritem': 999 })), ]) author_name_nested_deconstructable_1 = ModelState("testapp", "Author", [ ("id", models.AutoField(primary_key=True)), ("name", models.CharField(max_length=200, default=DeconstructableObject( DeconstructableObject(1), (DeconstructableObject('t1'), DeconstructableObject('t2'),), a=DeconstructableObject('A'), b=DeconstructableObject(B=DeconstructableObject('c')), ))), ]) author_name_nested_deconstructable_2 = ModelState("testapp", "Author", [ ("id", models.AutoField(primary_key=True)), ("name", models.CharField(max_length=200, default=DeconstructableObject( DeconstructableObject(1), (DeconstructableObject('t1'), DeconstructableObject('t2'),), a=DeconstructableObject('A'), b=DeconstructableObject(B=DeconstructableObject('c')), ))), ]) author_name_nested_deconstructable_changed_arg = ModelState("testapp", "Author", [ ("id", models.AutoField(primary_key=True)), ("name", models.CharField(max_length=200, default=DeconstructableObject( DeconstructableObject(1), (DeconstructableObject('t1'), DeconstructableObject('t2-changed'),), a=DeconstructableObject('A'), b=DeconstructableObject(B=DeconstructableObject('c')), ))), ]) author_name_nested_deconstructable_extra_arg = ModelState("testapp", "Author", [ ("id", models.AutoField(primary_key=True)), ("name", models.CharField(max_length=200, default=DeconstructableObject( DeconstructableObject(1), (DeconstructableObject('t1'), DeconstructableObject('t2'),), None, a=DeconstructableObject('A'), b=DeconstructableObject(B=DeconstructableObject('c')), ))), ]) author_name_nested_deconstructable_changed_kwarg = ModelState("testapp", "Author", [ ("id", models.AutoField(primary_key=True)), ("name", models.CharField(max_length=200, default=DeconstructableObject( DeconstructableObject(1), (DeconstructableObject('t1'), DeconstructableObject('t2'),), a=DeconstructableObject('A'), b=DeconstructableObject(B=DeconstructableObject('c-changed')), ))), ]) author_name_nested_deconstructable_extra_kwarg = ModelState("testapp", "Author", [ ("id", models.AutoField(primary_key=True)), ("name", models.CharField(max_length=200, default=DeconstructableObject( DeconstructableObject(1), (DeconstructableObject('t1'), DeconstructableObject('t2'),), a=DeconstructableObject('A'), b=DeconstructableObject(B=DeconstructableObject('c')), c=None, ))), ]) author_custom_pk = ModelState("testapp", "Author", [("pk_field", models.IntegerField(primary_key=True))]) author_with_biography_non_blank = ModelState("testapp", "Author", [ ("id", models.AutoField(primary_key=True)), ("name", models.CharField()), ("biography", models.TextField()), ]) author_with_biography_blank = ModelState("testapp", "Author", [ ("id", models.AutoField(primary_key=True)), ("name", models.CharField(blank=True)), ("biography", models.TextField(blank=True)), ]) author_with_book = ModelState("testapp", "Author", [ ("id", models.AutoField(primary_key=True)), ("name", models.CharField(max_length=200)), ("book", models.ForeignKey("otherapp.Book", models.CASCADE)), ]) author_with_book_order_wrt = ModelState("testapp", "Author", [ ("id", models.AutoField(primary_key=True)), ("name", models.CharField(max_length=200)), ("book", models.ForeignKey("otherapp.Book", models.CASCADE)), ], options={"order_with_respect_to": "book"}) author_renamed_with_book = ModelState("testapp", "Writer", [ ("id", models.AutoField(primary_key=True)), ("name", models.CharField(max_length=200)), ("book", models.ForeignKey("otherapp.Book", models.CASCADE)), ]) author_with_publisher_string = ModelState("testapp", "Author", [ ("id", models.AutoField(primary_key=True)), ("name", models.CharField(max_length=200)), ("publisher_name", models.CharField(max_length=200)), ]) author_with_publisher = ModelState("testapp", "Author", [ ("id", models.AutoField(primary_key=True)), ("name", models.CharField(max_length=200)), ("publisher", models.ForeignKey("testapp.Publisher", models.CASCADE)), ]) author_with_user = ModelState("testapp", "Author", [ ("id", models.AutoField(primary_key=True)), ("name", models.CharField(max_length=200)), ("user", models.ForeignKey("auth.User", models.CASCADE)), ]) author_with_custom_user = ModelState("testapp", "Author", [ ("id", models.AutoField(primary_key=True)), ("name", models.CharField(max_length=200)), ("user", models.ForeignKey("thirdapp.CustomUser", models.CASCADE)), ]) author_proxy = ModelState("testapp", "AuthorProxy", [], {"proxy": True}, ("testapp.author",)) author_proxy_options = ModelState("testapp", "AuthorProxy", [], { "proxy": True, "verbose_name": "Super Author", }, ("testapp.author", )) author_proxy_notproxy = ModelState("testapp", "AuthorProxy", [], {}, ("testapp.author", )) author_proxy_third = ModelState("thirdapp", "AuthorProxy", [], {"proxy": True}, ("testapp.author", )) author_proxy_proxy = ModelState("testapp", "AAuthorProxyProxy", [], {"proxy": True}, ("testapp.authorproxy", )) author_unmanaged = ModelState("testapp", "AuthorUnmanaged", [], {"managed": False}, ("testapp.author", )) author_unmanaged_managed = ModelState("testapp", "AuthorUnmanaged", [], {}, ("testapp.author", )) author_unmanaged_default_pk = ModelState("testapp", "Author", [("id", models.AutoField(primary_key=True))]) author_unmanaged_custom_pk = ModelState("testapp", "Author", [ ("pk_field", models.IntegerField(primary_key=True)), ]) author_with_m2m = ModelState("testapp", "Author", [ ("id", models.AutoField(primary_key=True)), ("publishers", models.ManyToManyField("testapp.Publisher")), ]) author_with_m2m_blank = ModelState("testapp", "Author", [ ("id", models.AutoField(primary_key=True)), ("publishers", models.ManyToManyField("testapp.Publisher", blank=True)), ]) author_with_m2m_through = ModelState("testapp", "Author", [ ("id", models.AutoField(primary_key=True)), ("publishers", models.ManyToManyField("testapp.Publisher", through="testapp.Contract")), ]) author_with_former_m2m = ModelState("testapp", "Author", [ ("id", models.AutoField(primary_key=True)), ("publishers", models.CharField(max_length=100)), ]) author_with_options = ModelState("testapp", "Author", [ ("id", models.AutoField(primary_key=True)), ], { "permissions": [('can_hire', 'Can hire')], "verbose_name": "Authi", }) author_with_db_table_options = ModelState("testapp", "Author", [ ("id", models.AutoField(primary_key=True)), ], {"db_table": "author_one"}) author_with_new_db_table_options = ModelState("testapp", "Author", [ ("id", models.AutoField(primary_key=True)), ], {"db_table": "author_two"}) author_renamed_with_db_table_options = ModelState("testapp", "NewAuthor", [ ("id", models.AutoField(primary_key=True)), ], {"db_table": "author_one"}) author_renamed_with_new_db_table_options = ModelState("testapp", "NewAuthor", [ ("id", models.AutoField(primary_key=True)), ], {"db_table": "author_three"}) contract = ModelState("testapp", "Contract", [ ("id", models.AutoField(primary_key=True)), ("author", models.ForeignKey("testapp.Author", models.CASCADE)), ("publisher", models.ForeignKey("testapp.Publisher", models.CASCADE)), ]) publisher = ModelState("testapp", "Publisher", [ ("id", models.AutoField(primary_key=True)), ("name", models.CharField(max_length=100)), ]) publisher_with_author = ModelState("testapp", "Publisher", [ ("id", models.AutoField(primary_key=True)), ("author", models.ForeignKey("testapp.Author", models.CASCADE)), ("name", models.CharField(max_length=100)), ]) publisher_with_aardvark_author = ModelState("testapp", "Publisher", [ ("id", models.AutoField(primary_key=True)), ("author", models.ForeignKey("testapp.Aardvark", models.CASCADE)), ("name", models.CharField(max_length=100)), ]) publisher_with_book = ModelState("testapp", "Publisher", [ ("id", models.AutoField(primary_key=True)), ("author", models.ForeignKey("otherapp.Book", models.CASCADE)), ("name", models.CharField(max_length=100)), ]) other_pony = ModelState("otherapp", "Pony", [ ("id", models.AutoField(primary_key=True)), ]) other_pony_food = ModelState("otherapp", "Pony", [ ("id", models.AutoField(primary_key=True)), ], managers=[ ('food_qs', FoodQuerySet.as_manager()), ('food_mgr', FoodManager('a', 'b')), ('food_mgr_kwargs', FoodManager('x', 'y', 3, 4)), ]) other_stable = ModelState("otherapp", "Stable", [("id", models.AutoField(primary_key=True))]) third_thing = ModelState("thirdapp", "Thing", [("id", models.AutoField(primary_key=True))]) book = ModelState("otherapp", "Book", [ ("id", models.AutoField(primary_key=True)), ("author", models.ForeignKey("testapp.Author", models.CASCADE)), ("title", models.CharField(max_length=200)), ]) book_proxy_fk = ModelState("otherapp", "Book", [ ("id", models.AutoField(primary_key=True)), ("author", models.ForeignKey("thirdapp.AuthorProxy", models.CASCADE)), ("title", models.CharField(max_length=200)), ]) book_migrations_fk = ModelState("otherapp", "Book", [ ("id", models.AutoField(primary_key=True)), ("author", models.ForeignKey("migrations.UnmigratedModel", models.CASCADE)), ("title", models.CharField(max_length=200)), ]) book_with_no_author = ModelState("otherapp", "Book", [ ("id", models.AutoField(primary_key=True)), ("title", models.CharField(max_length=200)), ]) book_with_author_renamed = ModelState("otherapp", "Book", [ ("id", models.AutoField(primary_key=True)), ("author", models.ForeignKey("testapp.Writer", models.CASCADE)), ("title", models.CharField(max_length=200)), ]) book_with_field_and_author_renamed = ModelState("otherapp", "Book", [ ("id", models.AutoField(primary_key=True)), ("writer", models.ForeignKey("testapp.Writer", models.CASCADE)), ("title", models.CharField(max_length=200)), ]) book_with_multiple_authors = ModelState("otherapp", "Book", [ ("id", models.AutoField(primary_key=True)), ("authors", models.ManyToManyField("testapp.Author")), ("title", models.CharField(max_length=200)), ]) book_with_multiple_authors_through_attribution = ModelState("otherapp", "Book", [ ("id", models.AutoField(primary_key=True)), ("authors", models.ManyToManyField("testapp.Author", through="otherapp.Attribution")), ("title", models.CharField(max_length=200)), ]) book_foo_together = ModelState("otherapp", "Book", [ ("id", models.AutoField(primary_key=True)), ("author", models.ForeignKey("testapp.Author", models.CASCADE)), ("title", models.CharField(max_length=200)), ], { "index_together": {("author", "title")}, "unique_together": {("author", "title")}, }) book_foo_together_2 = ModelState("otherapp", "Book", [ ("id", models.AutoField(primary_key=True)), ("author", models.ForeignKey("testapp.Author", models.CASCADE)), ("title", models.CharField(max_length=200)), ], { "index_together": {("title", "author")}, "unique_together": {("title", "author")}, }) book_foo_together_3 = ModelState("otherapp", "Book", [ ("id", models.AutoField(primary_key=True)), ("newfield", models.IntegerField()), ("author", models.ForeignKey("testapp.Author", models.CASCADE)), ("title", models.CharField(max_length=200)), ], { "index_together": {("title", "newfield")}, "unique_together": {("title", "newfield")}, }) book_foo_together_4 = ModelState("otherapp", "Book", [ ("id", models.AutoField(primary_key=True)), ("newfield2", models.IntegerField()), ("author", models.ForeignKey("testapp.Author", models.CASCADE)), ("title", models.CharField(max_length=200)), ], { "index_together": {("title", "newfield2")}, "unique_together": {("title", "newfield2")}, }) attribution = ModelState("otherapp", "Attribution", [ ("id", models.AutoField(primary_key=True)), ("author", models.ForeignKey("testapp.Author", models.CASCADE)), ("book", models.ForeignKey("otherapp.Book", models.CASCADE)), ]) edition = ModelState("thirdapp", "Edition", [ ("id", models.AutoField(primary_key=True)), ("book", models.ForeignKey("otherapp.Book", models.CASCADE)), ]) custom_user = ModelState("thirdapp", "CustomUser", [ ("id", models.AutoField(primary_key=True)), ("username", models.CharField(max_length=255)), ], bases=(AbstractBaseUser, )) custom_user_no_inherit = ModelState("thirdapp", "CustomUser", [ ("id", models.AutoField(primary_key=True)), ("username", models.CharField(max_length=255)), ]) aardvark = ModelState("thirdapp", "Aardvark", [("id", models.AutoField(primary_key=True))]) aardvark_testapp = ModelState("testapp", "Aardvark", [("id", models.AutoField(primary_key=True))]) aardvark_based_on_author = ModelState("testapp", "Aardvark", [], bases=("testapp.Author", )) aardvark_pk_fk_author = ModelState("testapp", "Aardvark", [ ("id", models.OneToOneField("testapp.Author", models.CASCADE, primary_key=True)), ]) knight = ModelState("eggs", "Knight", [("id", models.AutoField(primary_key=True))]) rabbit = ModelState("eggs", "Rabbit", [ ("id", models.AutoField(primary_key=True)), ("knight", models.ForeignKey("eggs.Knight", models.CASCADE)), ("parent", models.ForeignKey("eggs.Rabbit", models.CASCADE)), ], {"unique_together": {("parent", "knight")}}) def repr_changes(self, changes, include_dependencies=False): output = "" for app_label, migrations in sorted(changes.items()): output += " %s:\n" % app_label for migration in migrations: output += " %s\n" % migration.name for operation in migration.operations: output += " %s\n" % operation if include_dependencies: output += " Dependencies:\n" if migration.dependencies: for dep in migration.dependencies: output += " %s\n" % (dep,) else: output += " None\n" return output def assertNumberMigrations(self, changes, app_label, number): if len(changes.get(app_label, [])) != number: self.fail("Incorrect number of migrations (%s) for %s (expected %s)\n%s" % ( len(changes.get(app_label, [])), app_label, number, self.repr_changes(changes), )) def assertMigrationDependencies(self, changes, app_label, index, dependencies): if not changes.get(app_label): self.fail("No migrations found for %s\n%s" % (app_label, self.repr_changes(changes))) if len(changes[app_label]) < index + 1: self.fail("No migration at index %s for %s\n%s" % (index, app_label, self.repr_changes(changes))) migration = changes[app_label][index] if set(migration.dependencies) != set(dependencies): self.fail("Migration dependencies mismatch for %s.%s (expected %s):\n%s" % ( app_label, migration.name, dependencies, self.repr_changes(changes, include_dependencies=True), )) def assertOperationTypes(self, changes, app_label, index, types): if not changes.get(app_label): self.fail("No migrations found for %s\n%s" % (app_label, self.repr_changes(changes))) if len(changes[app_label]) < index + 1: self.fail("No migration at index %s for %s\n%s" % (index, app_label, self.repr_changes(changes))) migration = changes[app_label][index] real_types = [operation.__class__.__name__ for operation in migration.operations] if types != real_types: self.fail("Operation type mismatch for %s.%s (expected %s):\n%s" % ( app_label, migration.name, types, self.repr_changes(changes), )) def assertOperationAttributes(self, changes, app_label, index, operation_index, **attrs): if not changes.get(app_label): self.fail("No migrations found for %s\n%s" % (app_label, self.repr_changes(changes))) if len(changes[app_label]) < index + 1: self.fail("No migration at index %s for %s\n%s" % (index, app_label, self.repr_changes(changes))) migration = changes[app_label][index] if len(changes[app_label]) < index + 1: self.fail("No operation at index %s for %s.%s\n%s" % ( operation_index, app_label, migration.name, self.repr_changes(changes), )) operation = migration.operations[operation_index] for attr, value in attrs.items(): if getattr(operation, attr, None) != value: self.fail("Attribute mismatch for %s.%s op #%s, %s (expected %r, got %r):\n%s" % ( app_label, migration.name, operation_index, attr, value, getattr(operation, attr, None), self.repr_changes(changes), )) def assertOperationFieldAttributes(self, changes, app_label, index, operation_index, **attrs): if not changes.get(app_label): self.fail("No migrations found for %s\n%s" % (app_label, self.repr_changes(changes))) if len(changes[app_label]) < index + 1: self.fail("No migration at index %s for %s\n%s" % (index, app_label, self.repr_changes(changes))) migration = changes[app_label][index] if len(changes[app_label]) < index + 1: self.fail("No operation at index %s for %s.%s\n%s" % ( operation_index, app_label, migration.name, self.repr_changes(changes), )) operation = migration.operations[operation_index] if not hasattr(operation, 'field'): self.fail("No field attribute for %s.%s op #%s." % ( app_label, migration.name, operation_index, )) field = operation.field for attr, value in attrs.items(): if getattr(field, attr, None) != value: self.fail("Field attribute mismatch for %s.%s op #%s, field.%s (expected %r, got %r):\n%s" % ( app_label, migration.name, operation_index, attr, value, getattr(field, attr, None), self.repr_changes(changes), )) def make_project_state(self, model_states): "Shortcut to make ProjectStates from lists of predefined models" project_state = ProjectState() for model_state in model_states: project_state.add_model(model_state.clone()) return project_state def test_arrange_for_graph(self): """Tests auto-naming of migrations for graph matching.""" # Make a fake graph graph = MigrationGraph() graph.add_node(("testapp", "0001_initial"), None) graph.add_node(("testapp", "0002_foobar"), None) graph.add_node(("otherapp", "0001_initial"), None) graph.add_dependency("testapp.0002_foobar", ("testapp", "0002_foobar"), ("testapp", "0001_initial")) graph.add_dependency("testapp.0002_foobar", ("testapp", "0002_foobar"), ("otherapp", "0001_initial")) # Use project state to make a new migration change set before = self.make_project_state([]) after = self.make_project_state([self.author_empty, self.other_pony, self.other_stable]) autodetector = MigrationAutodetector(before, after) changes = autodetector._detect_changes() # Run through arrange_for_graph changes = autodetector.arrange_for_graph(changes, graph) # Make sure there's a new name, deps match, etc. self.assertEqual(changes["testapp"][0].name, "0003_author") self.assertEqual(changes["testapp"][0].dependencies, [("testapp", "0002_foobar")]) self.assertEqual(changes["otherapp"][0].name, "0002_pony_stable") self.assertEqual(changes["otherapp"][0].dependencies, [("otherapp", "0001_initial")]) def test_trim_apps(self): """ Tests that trim does not remove dependencies but does remove unwanted apps. """ # Use project state to make a new migration change set before = self.make_project_state([]) after = self.make_project_state([self.author_empty, self.other_pony, self.other_stable, self.third_thing]) autodetector = MigrationAutodetector(before, after, MigrationQuestioner({"ask_initial": True})) changes = autodetector._detect_changes() # Run through arrange_for_graph graph = MigrationGraph() changes = autodetector.arrange_for_graph(changes, graph) changes["testapp"][0].dependencies.append(("otherapp", "0001_initial")) changes = autodetector._trim_to_apps(changes, {"testapp"}) # Make sure there's the right set of migrations self.assertEqual(changes["testapp"][0].name, "0001_initial") self.assertEqual(changes["otherapp"][0].name, "0001_initial") self.assertNotIn("thirdapp", changes) def test_custom_migration_name(self): """Tests custom naming of migrations for graph matching.""" # Make a fake graph graph = MigrationGraph() graph.add_node(("testapp", "0001_initial"), None) graph.add_node(("testapp", "0002_foobar"), None) graph.add_node(("otherapp", "0001_initial"), None) graph.add_dependency("testapp.0002_foobar", ("testapp", "0002_foobar"), ("testapp", "0001_initial")) # Use project state to make a new migration change set before = self.make_project_state([]) after = self.make_project_state([self.author_empty, self.other_pony, self.other_stable]) autodetector = MigrationAutodetector(before, after) changes = autodetector._detect_changes() # Run through arrange_for_graph migration_name = 'custom_name' changes = autodetector.arrange_for_graph(changes, graph, migration_name) # Make sure there's a new name, deps match, etc. self.assertEqual(changes["testapp"][0].name, "0003_%s" % migration_name) self.assertEqual(changes["testapp"][0].dependencies, [("testapp", "0002_foobar")]) self.assertEqual(changes["otherapp"][0].name, "0002_%s" % migration_name) self.assertEqual(changes["otherapp"][0].dependencies, [("otherapp", "0001_initial")]) def test_new_model(self): """Tests autodetection of new models.""" # Make state before = self.make_project_state([]) after = self.make_project_state([self.other_pony_food]) autodetector = MigrationAutodetector(before, after) changes = autodetector._detect_changes() # Right number/type of migrations? self.assertNumberMigrations(changes, 'otherapp', 1) self.assertOperationTypes(changes, 'otherapp', 0, ["CreateModel"]) self.assertOperationAttributes(changes, "otherapp", 0, 0, name="Pony") self.assertEqual([name for name, mgr in changes['otherapp'][0].operations[0].managers], ['food_qs', 'food_mgr', 'food_mgr_kwargs']) def test_old_model(self): """Tests deletion of old models.""" # Make state before = self.make_project_state([self.author_empty]) after = self.make_project_state([]) autodetector = MigrationAutodetector(before, after) changes = autodetector._detect_changes() # Right number/type of migrations? self.assertNumberMigrations(changes, 'testapp', 1) self.assertOperationTypes(changes, 'testapp', 0, ["DeleteModel"]) self.assertOperationAttributes(changes, "testapp", 0, 0, name="Author") def test_add_field(self): """Tests autodetection of new fields.""" # Make state before = self.make_project_state([self.author_empty]) after = self.make_project_state([self.author_name]) autodetector = MigrationAutodetector(before, after) changes = autodetector._detect_changes() # Right number/type of migrations? self.assertNumberMigrations(changes, 'testapp', 1) self.assertOperationTypes(changes, 'testapp', 0, ["AddField"]) self.assertOperationAttributes(changes, "testapp", 0, 0, name="name") def test_remove_field(self): """Tests autodetection of removed fields.""" # Make state before = self.make_project_state([self.author_name]) after = self.make_project_state([self.author_empty]) autodetector = MigrationAutodetector(before, after) changes = autodetector._detect_changes() # Right number/type of migrations? self.assertNumberMigrations(changes, 'testapp', 1) self.assertOperationTypes(changes, 'testapp', 0, ["RemoveField"]) self.assertOperationAttributes(changes, "testapp", 0, 0, name="name") def test_alter_field(self): """Tests autodetection of new fields.""" # Make state before = self.make_project_state([self.author_name]) after = self.make_project_state([self.author_name_longer]) autodetector = MigrationAutodetector(before, after) changes = autodetector._detect_changes() # Right number/type of migrations? self.assertNumberMigrations(changes, 'testapp', 1) self.assertOperationTypes(changes, 'testapp', 0, ["AlterField"]) self.assertOperationAttributes(changes, "testapp", 0, 0, name="name", preserve_default=True) @mock.patch('django.db.migrations.questioner.MigrationQuestioner.ask_not_null_alteration', side_effect=AssertionError("Should not have prompted for not null addition")) def test_alter_field_to_not_null_with_default(self, mocked_ask_method): """ #23609 - Tests autodetection of nullable to non-nullable alterations. """ # Make state before = self.make_project_state([self.author_name_null]) after = self.make_project_state([self.author_name_default]) autodetector = MigrationAutodetector(before, after) changes = autodetector._detect_changes() # Right number/type of migrations? self.assertNumberMigrations(changes, 'testapp', 1) self.assertOperationTypes(changes, 'testapp', 0, ["AlterField"]) self.assertOperationAttributes(changes, "testapp", 0, 0, name="name", preserve_default=True) self.assertOperationFieldAttributes(changes, "testapp", 0, 0, default='Ada Lovelace') @mock.patch('django.db.migrations.questioner.MigrationQuestioner.ask_not_null_alteration', return_value=models.NOT_PROVIDED) def test_alter_field_to_not_null_without_default(self, mocked_ask_method): """ #23609 - Tests autodetection of nullable to non-nullable alterations. """ # Make state before = self.make_project_state([self.author_name_null]) after = self.make_project_state([self.author_name]) autodetector = MigrationAutodetector(before, after) changes = autodetector._detect_changes() self.assertEqual(mocked_ask_method.call_count, 1) # Right number/type of migrations? self.assertNumberMigrations(changes, 'testapp', 1) self.assertOperationTypes(changes, 'testapp', 0, ["AlterField"]) self.assertOperationAttributes(changes, "testapp", 0, 0, name="name", preserve_default=True) self.assertOperationFieldAttributes(changes, "testapp", 0, 0, default=models.NOT_PROVIDED) @mock.patch('django.db.migrations.questioner.MigrationQuestioner.ask_not_null_alteration', return_value='Some Name') def test_alter_field_to_not_null_oneoff_default(self, mocked_ask_method): """ #23609 - Tests autodetection of nullable to non-nullable alterations. """ # Make state before = self.make_project_state([self.author_name_null]) after = self.make_project_state([self.author_name]) autodetector = MigrationAutodetector(before, after) changes = autodetector._detect_changes() self.assertEqual(mocked_ask_method.call_count, 1) # Right number/type of migrations? self.assertNumberMigrations(changes, 'testapp', 1) self.assertOperationTypes(changes, 'testapp', 0, ["AlterField"]) self.assertOperationAttributes(changes, "testapp", 0, 0, name="name", preserve_default=False) self.assertOperationFieldAttributes(changes, "testapp", 0, 0, default="Some Name") def test_rename_field(self): """Tests autodetection of renamed fields.""" # Make state before = self.make_project_state([self.author_name]) after = self.make_project_state([self.author_name_renamed]) autodetector = MigrationAutodetector(before, after, MigrationQuestioner({"ask_rename": True})) changes = autodetector._detect_changes() # Right number/type of migrations? self.assertNumberMigrations(changes, 'testapp', 1) self.assertOperationTypes(changes, 'testapp', 0, ["RenameField"]) self.assertOperationAttributes(changes, 'testapp', 0, 0, old_name="name", new_name="names") def test_rename_model(self): """Tests autodetection of renamed models.""" # Make state before = self.make_project_state([self.author_with_book, self.book]) after = self.make_project_state([self.author_renamed_with_book, self.book_with_author_renamed]) autodetector = MigrationAutodetector(before, after, MigrationQuestioner({"ask_rename_model": True})) changes = autodetector._detect_changes() # Right number/type of migrations? self.assertNumberMigrations(changes, 'testapp', 1) self.assertOperationTypes(changes, 'testapp', 0, ["RenameModel"]) self.assertOperationAttributes(changes, 'testapp', 0, 0, old_name="Author", new_name="Writer") # Now that RenameModel handles related fields too, there should be # no AlterField for the related field. self.assertNumberMigrations(changes, 'otherapp', 0) def test_rename_model_with_renamed_rel_field(self): """ Tests autodetection of renamed models while simultaneously renaming one of the fields that relate to the renamed model. """ # Make state before = self.make_project_state([self.author_with_book, self.book]) after = self.make_project_state([self.author_renamed_with_book, self.book_with_field_and_author_renamed]) autodetector = MigrationAutodetector(before, after, MigrationQuestioner({ "ask_rename": True, "ask_rename_model": True, })) changes = autodetector._detect_changes() # Right number/type of migrations? self.assertNumberMigrations(changes, 'testapp', 1) self.assertOperationTypes(changes, 'testapp', 0, ["RenameModel"]) self.assertOperationAttributes(changes, 'testapp', 0, 0, old_name="Author", new_name="Writer") # Right number/type of migrations for related field rename? # Alter is already taken care of. self.assertNumberMigrations(changes, 'otherapp', 1) self.assertOperationTypes(changes, 'otherapp', 0, ["RenameField"]) self.assertOperationAttributes(changes, 'otherapp', 0, 0, old_name="author", new_name="writer") def test_rename_model_with_fks_in_different_position(self): """ #24537 - Tests that the order of fields in a model does not influence the RenameModel detection. """ before = self.make_project_state([ ModelState("testapp", "EntityA", [ ("id", models.AutoField(primary_key=True)), ]), ModelState("testapp", "EntityB", [ ("id", models.AutoField(primary_key=True)), ("some_label", models.CharField(max_length=255)), ("entity_a", models.ForeignKey("testapp.EntityA", models.CASCADE)), ]), ]) after = self.make_project_state([ ModelState("testapp", "EntityA", [ ("id", models.AutoField(primary_key=True)), ]), ModelState("testapp", "RenamedEntityB", [ ("id", models.AutoField(primary_key=True)), ("entity_a", models.ForeignKey("testapp.EntityA", models.CASCADE)), ("some_label", models.CharField(max_length=255)), ]), ]) autodetector = MigrationAutodetector(before, after, MigrationQuestioner({"ask_rename_model": True})) changes = autodetector._detect_changes() self.assertNumberMigrations(changes, "testapp", 1) self.assertOperationTypes(changes, "testapp", 0, ["RenameModel"]) self.assertOperationAttributes(changes, "testapp", 0, 0, old_name="EntityB", new_name="RenamedEntityB") def test_fk_dependency(self): """Tests that having a ForeignKey automatically adds a dependency.""" # Make state # Note that testapp (author) has no dependencies, # otherapp (book) depends on testapp (author), # thirdapp (edition) depends on otherapp (book) before = self.make_project_state([]) after = self.make_project_state([self.author_name, self.book, self.edition]) autodetector = MigrationAutodetector(before, after) changes = autodetector._detect_changes() # Right number/type of migrations? self.assertNumberMigrations(changes, 'testapp', 1) self.assertOperationTypes(changes, 'testapp', 0, ["CreateModel"]) self.assertOperationAttributes(changes, 'testapp', 0, 0, name="Author") self.assertMigrationDependencies(changes, 'testapp', 0, []) # Right number/type of migrations? self.assertNumberMigrations(changes, 'otherapp', 1) self.assertOperationTypes(changes, 'otherapp', 0, ["CreateModel"]) self.assertOperationAttributes(changes, 'otherapp', 0, 0, name="Book") self.assertMigrationDependencies(changes, 'otherapp', 0, [("testapp", "auto_1")]) # Right number/type of migrations? self.assertNumberMigrations(changes, 'thirdapp', 1) self.assertOperationTypes(changes, 'thirdapp', 0, ["CreateModel"]) self.assertOperationAttributes(changes, 'thirdapp', 0, 0, name="Edition") self.assertMigrationDependencies(changes, 'thirdapp', 0, [("otherapp", "auto_1")]) def test_proxy_fk_dependency(self): """Tests that FK dependencies still work on proxy models.""" # Make state # Note that testapp (author) has no dependencies, # otherapp (book) depends on testapp (authorproxy) before = self.make_project_state([]) after = self.make_project_state([self.author_empty, self.author_proxy_third, self.book_proxy_fk]) autodetector = MigrationAutodetector(before, after) changes = autodetector._detect_changes() # Right number/type of migrations? self.assertNumberMigrations(changes, 'testapp', 1) self.assertOperationTypes(changes, 'testapp', 0, ["CreateModel"]) self.assertOperationAttributes(changes, 'testapp', 0, 0, name="Author") self.assertMigrationDependencies(changes, 'testapp', 0, []) # Right number/type of migrations? self.assertNumberMigrations(changes, 'otherapp', 1) self.assertOperationTypes(changes, 'otherapp', 0, ["CreateModel"]) self.assertOperationAttributes(changes, 'otherapp', 0, 0, name="Book") self.assertMigrationDependencies(changes, 'otherapp', 0, [("thirdapp", "auto_1")]) # Right number/type of migrations? self.assertNumberMigrations(changes, 'thirdapp', 1) self.assertOperationTypes(changes, 'thirdapp', 0, ["CreateModel"]) self.assertOperationAttributes(changes, 'thirdapp', 0, 0, name="AuthorProxy") self.assertMigrationDependencies(changes, 'thirdapp', 0, [("testapp", "auto_1")]) def test_same_app_no_fk_dependency(self): """ Tests that a migration with a FK between two models of the same app does not have a dependency to itself. """ # Make state before = self.make_project_state([]) after = self.make_project_state([self.author_with_publisher, self.publisher]) autodetector = MigrationAutodetector(before, after) changes = autodetector._detect_changes() # Right number/type of migrations? self.assertNumberMigrations(changes, 'testapp', 1) self.assertOperationTypes(changes, 'testapp', 0, ["CreateModel", "CreateModel", "AddField"]) self.assertOperationAttributes(changes, "testapp", 0, 0, name="Author") self.assertOperationAttributes(changes, "testapp", 0, 1, name="Publisher") self.assertOperationAttributes(changes, "testapp", 0, 2, name="publisher") self.assertMigrationDependencies(changes, 'testapp', 0, []) def test_circular_fk_dependency(self): """ Tests that having a circular ForeignKey dependency automatically resolves the situation into 2 migrations on one side and 1 on the other. """ # Make state before = self.make_project_state([]) after = self.make_project_state([self.author_with_book, self.book, self.publisher_with_book]) autodetector = MigrationAutodetector(before, after) changes = autodetector._detect_changes() # Right number/type of migrations? self.assertNumberMigrations(changes, 'testapp', 1) self.assertOperationTypes(changes, 'testapp', 0, ["CreateModel", "CreateModel"]) self.assertOperationAttributes(changes, "testapp", 0, 0, name="Author") self.assertOperationAttributes(changes, "testapp", 0, 1, name="Publisher") self.assertMigrationDependencies(changes, 'testapp', 0, [("otherapp", "auto_1")]) # Right number/type of migrations? self.assertNumberMigrations(changes, 'otherapp', 2) self.assertOperationTypes(changes, 'otherapp', 0, ["CreateModel"]) self.assertOperationTypes(changes, 'otherapp', 1, ["AddField"]) self.assertMigrationDependencies(changes, 'otherapp', 0, []) self.assertMigrationDependencies(changes, 'otherapp', 1, [("otherapp", "auto_1"), ("testapp", "auto_1")]) # both split migrations should be `initial` self.assertTrue(changes['otherapp'][0].initial) self.assertTrue(changes['otherapp'][1].initial) def test_same_app_circular_fk_dependency(self): """ Tests that a migration with a FK between two models of the same app does not have a dependency to itself. """ # Make state before = self.make_project_state([]) after = self.make_project_state([self.author_with_publisher, self.publisher_with_author]) autodetector = MigrationAutodetector(before, after) changes = autodetector._detect_changes() # Right number/type of migrations? self.assertNumberMigrations(changes, 'testapp', 1) self.assertOperationTypes(changes, 'testapp', 0, ["CreateModel", "CreateModel", "AddField"]) self.assertOperationAttributes(changes, "testapp", 0, 0, name="Author") self.assertOperationAttributes(changes, "testapp", 0, 1, name="Publisher") self.assertOperationAttributes(changes, "testapp", 0, 2, name="publisher") self.assertMigrationDependencies(changes, 'testapp', 0, []) def test_same_app_circular_fk_dependency_and_unique_together(self): """ #22275 - Tests that a migration with circular FK dependency does not try to create unique together constraint before creating all required fields first. """ # Make state before = self.make_project_state([]) after = self.make_project_state([self.knight, self.rabbit]) autodetector = MigrationAutodetector(before, after) changes = autodetector._detect_changes() # Right number/type of migrations? self.assertNumberMigrations(changes, 'eggs', 1) self.assertOperationTypes(changes, 'eggs', 0, ["CreateModel", "CreateModel", "AlterUniqueTogether"]) self.assertNotIn("unique_together", changes['eggs'][0].operations[0].options) self.assertNotIn("unique_together", changes['eggs'][0].operations[1].options) self.assertMigrationDependencies(changes, 'eggs', 0, []) def test_alter_db_table_add(self): """Tests detection for adding db_table in model's options.""" # Make state before = self.make_project_state([self.author_empty]) after = self.make_project_state([self.author_with_db_table_options]) autodetector = MigrationAutodetector(before, after) changes = autodetector._detect_changes() # Right number/type of migrations? self.assertNumberMigrations(changes, 'testapp', 1) self.assertOperationTypes(changes, 'testapp', 0, ["AlterModelTable"]) self.assertOperationAttributes(changes, "testapp", 0, 0, name="author", table="author_one") def test_alter_db_table_change(self): """Tests detection for changing db_table in model's options'.""" # Make state before = self.make_project_state([self.author_with_db_table_options]) after = self.make_project_state([self.author_with_new_db_table_options]) autodetector = MigrationAutodetector(before, after) changes = autodetector._detect_changes() # Right number/type of migrations? self.assertNumberMigrations(changes, 'testapp', 1) self.assertOperationTypes(changes, 'testapp', 0, ["AlterModelTable"]) self.assertOperationAttributes(changes, "testapp", 0, 0, name="author", table="author_two") def test_alter_db_table_remove(self): """Tests detection for removing db_table in model's options.""" # Make state before = self.make_project_state([self.author_with_db_table_options]) after = self.make_project_state([self.author_empty]) autodetector = MigrationAutodetector(before, after) changes = autodetector._detect_changes() # Right number/type of migrations? self.assertNumberMigrations(changes, 'testapp', 1) self.assertOperationTypes(changes, 'testapp', 0, ["AlterModelTable"]) self.assertOperationAttributes(changes, "testapp", 0, 0, name="author", table=None) def test_alter_db_table_no_changes(self): """ Tests that alter_db_table doesn't generate a migration if no changes have been made. """ # Make state before = self.make_project_state([self.author_with_db_table_options]) after = self.make_project_state([self.author_with_db_table_options]) autodetector = MigrationAutodetector(before, after) changes = autodetector._detect_changes() # Right number of migrations? self.assertEqual(len(changes), 0) def test_keep_db_table_with_model_change(self): """ Tests when model changes but db_table stays as-is, autodetector must not create more than one operation. """ # Make state before = self.make_project_state([self.author_with_db_table_options]) after = self.make_project_state([self.author_renamed_with_db_table_options]) autodetector = MigrationAutodetector(before, after, MigrationQuestioner({"ask_rename_model": True})) changes = autodetector._detect_changes() # Right number/type of migrations? self.assertNumberMigrations(changes, 'testapp', 1) self.assertOperationTypes(changes, 'testapp', 0, ["RenameModel"]) self.assertOperationAttributes(changes, "testapp", 0, 0, old_name="Author", new_name="NewAuthor") def test_alter_db_table_with_model_change(self): """ Tests when model and db_table changes, autodetector must create two operations. """ # Make state before = self.make_project_state([self.author_with_db_table_options]) after = self.make_project_state([self.author_renamed_with_new_db_table_options]) autodetector = MigrationAutodetector(before, after, MigrationQuestioner({"ask_rename_model": True})) changes = autodetector._detect_changes() # Right number/type of migrations? self.assertNumberMigrations(changes, 'testapp', 1) self.assertOperationTypes(changes, 'testapp', 0, ["RenameModel", "AlterModelTable"]) self.assertOperationAttributes(changes, "testapp", 0, 0, old_name="Author", new_name="NewAuthor") self.assertOperationAttributes(changes, "testapp", 0, 1, name="newauthor", table="author_three") def test_identical_regex_doesnt_alter(self): from_state = ModelState( "testapp", "model", [("id", models.AutoField(primary_key=True, validators=[ RegexValidator( re.compile('^[-a-zA-Z0-9_]+\\Z'), "Enter a valid 'slug' consisting of letters, numbers, underscores or hyphens.", 'invalid' ) ]))] ) to_state = ModelState( "testapp", "model", [("id", models.AutoField(primary_key=True, validators=[validate_slug]))] ) before = self.make_project_state([from_state]) after = self.make_project_state([to_state]) autodetector = MigrationAutodetector(before, after) changes = autodetector._detect_changes() # Right number/type of migrations? self.assertNumberMigrations(changes, "testapp", 0) def test_different_regex_does_alter(self): from_state = ModelState( "testapp", "model", [("id", models.AutoField(primary_key=True, validators=[ RegexValidator( re.compile('^[a-z]+\\Z', 32), "Enter a valid 'slug' consisting of letters, numbers, underscores or hyphens.", 'invalid' ) ]))] ) to_state = ModelState( "testapp", "model", [("id", models.AutoField(primary_key=True, validators=[validate_slug]))] ) before = self.make_project_state([from_state]) after = self.make_project_state([to_state]) autodetector = MigrationAutodetector(before, after) changes = autodetector._detect_changes() self.assertNumberMigrations(changes, "testapp", 1) self.assertOperationTypes(changes, "testapp", 0, ["AlterField"]) def test_empty_foo_together(self): """ #23452 - Empty unique/index_together shouldn't generate a migration. """ # Explicitly testing for not specified, since this is the case after # a CreateModel operation w/o any definition on the original model model_state_not_specified = ModelState("a", "model", [("id", models.AutoField(primary_key=True))]) # Explicitly testing for None, since this was the issue in #23452 after # a AlterFooTogether operation with e.g. () as value model_state_none = ModelState("a", "model", [ ("id", models.AutoField(primary_key=True)) ], { "index_together": None, "unique_together": None, }) # Explicitly testing for the empty set, since we now always have sets. # During removal (('col1', 'col2'),) --> () this becomes set([]) model_state_empty = ModelState("a", "model", [ ("id", models.AutoField(primary_key=True)) ], { "index_together": set(), "unique_together": set(), }) def test(from_state, to_state, msg): before = self.make_project_state([from_state]) after = self.make_project_state([to_state]) autodetector = MigrationAutodetector(before, after) changes = autodetector._detect_changes() if len(changes) > 0: ops = ', '.join(o.__class__.__name__ for o in changes['a'][0].operations) self.fail('Created operation(s) %s from %s' % (ops, msg)) tests = ( (model_state_not_specified, model_state_not_specified, '"not specified" to "not specified"'), (model_state_not_specified, model_state_none, '"not specified" to "None"'), (model_state_not_specified, model_state_empty, '"not specified" to "empty"'), (model_state_none, model_state_not_specified, '"None" to "not specified"'), (model_state_none, model_state_none, '"None" to "None"'), (model_state_none, model_state_empty, '"None" to "empty"'), (model_state_empty, model_state_not_specified, '"empty" to "not specified"'), (model_state_empty, model_state_none, '"empty" to "None"'), (model_state_empty, model_state_empty, '"empty" to "empty"'), ) for t in tests: test(*t) def test_add_foo_together(self): """Tests index/unique_together detection.""" # Make state before = self.make_project_state([self.author_empty, self.book]) after = self.make_project_state([self.author_empty, self.book_foo_together]) autodetector = MigrationAutodetector(before, after) changes = autodetector._detect_changes() # Right number/type of migrations? self.assertNumberMigrations(changes, "otherapp", 1) self.assertOperationTypes(changes, "otherapp", 0, ["AlterUniqueTogether", "AlterIndexTogether"]) self.assertOperationAttributes(changes, "otherapp", 0, 0, name="book", unique_together={("author", "title")}) self.assertOperationAttributes(changes, "otherapp", 0, 1, name="book", index_together={("author", "title")}) def test_remove_foo_together(self): """Tests index/unique_together detection.""" before = self.make_project_state([self.author_empty, self.book_foo_together]) after = self.make_project_state([self.author_empty, self.book]) autodetector = MigrationAutodetector(before, after) changes = autodetector._detect_changes() # Right number/type of migrations? self.assertNumberMigrations(changes, "otherapp", 1) self.assertOperationTypes(changes, "otherapp", 0, ["AlterUniqueTogether", "AlterIndexTogether"]) self.assertOperationAttributes(changes, "otherapp", 0, 0, name="book", unique_together=set()) self.assertOperationAttributes(changes, "otherapp", 0, 1, name="book", index_together=set()) def test_foo_together_remove_fk(self): """Tests unique_together and field removal detection & ordering""" # Make state before = self.make_project_state([self.author_empty, self.book_foo_together]) after = self.make_project_state([self.author_empty, self.book_with_no_author]) autodetector = MigrationAutodetector(before, after) changes = autodetector._detect_changes() # Right number/type of migrations? self.assertNumberMigrations(changes, "otherapp", 1) self.assertOperationTypes(changes, "otherapp", 0, [ "AlterUniqueTogether", "AlterIndexTogether", "RemoveField" ]) self.assertOperationAttributes(changes, "otherapp", 0, 0, name="book", unique_together=set()) self.assertOperationAttributes(changes, "otherapp", 0, 1, name="book", index_together=set()) self.assertOperationAttributes(changes, "otherapp", 0, 2, model_name="book", name="author") def test_foo_together_no_changes(self): """ Tests that index/unique_together doesn't generate a migration if no changes have been made. """ # Make state before = self.make_project_state([self.author_empty, self.book_foo_together]) after = self.make_project_state([self.author_empty, self.book_foo_together]) autodetector = MigrationAutodetector(before, after) changes = autodetector._detect_changes() # Right number of migrations? self.assertEqual(len(changes), 0) def test_foo_together_ordering(self): """ Tests that index/unique_together also triggers on ordering changes. """ # Make state before = self.make_project_state([self.author_empty, self.book_foo_together]) after = self.make_project_state([self.author_empty, self.book_foo_together_2]) autodetector = MigrationAutodetector(before, after) changes = autodetector._detect_changes() # Right number/type of migrations? self.assertNumberMigrations(changes, "otherapp", 1) self.assertOperationTypes(changes, "otherapp", 0, ["AlterUniqueTogether", "AlterIndexTogether"]) self.assertOperationAttributes(changes, "otherapp", 0, 0, name="book", unique_together={("title", "author")}) self.assertOperationAttributes(changes, "otherapp", 0, 1, name="book", index_together={("title", "author")}) def test_add_field_and_foo_together(self): """ Tests that added fields will be created before using them in index/unique_together. """ before = self.make_project_state([self.author_empty, self.book]) after = self.make_project_state([self.author_empty, self.book_foo_together_3]) autodetector = MigrationAutodetector(before, after) changes = autodetector._detect_changes() # Right number/type of migrations? self.assertNumberMigrations(changes, "otherapp", 1) self.assertOperationTypes(changes, "otherapp", 0, ["AddField", "AlterUniqueTogether", "AlterIndexTogether"]) self.assertOperationAttributes(changes, "otherapp", 0, 1, name="book", unique_together={("title", "newfield")}) self.assertOperationAttributes(changes, "otherapp", 0, 2, name="book", index_together={("title", "newfield")}) def test_remove_field_and_foo_together(self): """ Tests that removed fields will be removed after updating index/unique_together. """ before = self.make_project_state([self.author_empty, self.book_foo_together_3]) after = self.make_project_state([self.author_empty, self.book_foo_together]) autodetector = MigrationAutodetector(before, after) changes = autodetector._detect_changes() # Right number/type of migrations? self.assertNumberMigrations(changes, "otherapp", 1) self.assertOperationTypes(changes, "otherapp", 0, ["RemoveField", "AlterUniqueTogether", "AlterIndexTogether"]) self.assertOperationAttributes(changes, "otherapp", 0, 0, model_name="book", name="newfield") self.assertOperationAttributes(changes, "otherapp", 0, 1, name="book", unique_together={("author", "title")}) self.assertOperationAttributes(changes, "otherapp", 0, 2, name="book", index_together={("author", "title")}) def test_rename_field_and_foo_together(self): """ Tests that removed fields will be removed after updating index/unique_together. """ before = self.make_project_state([self.author_empty, self.book_foo_together_3]) after = self.make_project_state([self.author_empty, self.book_foo_together_4]) autodetector = MigrationAutodetector(before, after, MigrationQuestioner({"ask_rename": True})) changes = autodetector._detect_changes() # Right number/type of migrations? self.assertNumberMigrations(changes, "otherapp", 1) self.assertOperationTypes(changes, "otherapp", 0, ["RenameField", "AlterUniqueTogether", "AlterIndexTogether"]) self.assertOperationAttributes(changes, "otherapp", 0, 1, name="book", unique_together={ ("title", "newfield2") }) self.assertOperationAttributes(changes, "otherapp", 0, 2, name="book", index_together={("title", "newfield2")}) def test_proxy(self): """Tests that the autodetector correctly deals with proxy models.""" # First, we test adding a proxy model before = self.make_project_state([self.author_empty]) after = self.make_project_state([self.author_empty, self.author_proxy]) autodetector = MigrationAutodetector(before, after) changes = autodetector._detect_changes() # Right number/type of migrations? self.assertNumberMigrations(changes, "testapp", 1) self.assertOperationTypes(changes, "testapp", 0, ["CreateModel"]) self.assertOperationAttributes(changes, "testapp", 0, 0, name="AuthorProxy", options={"proxy": True}) # Now, we test turning a proxy model into a non-proxy model # It should delete the proxy then make the real one before = self.make_project_state([self.author_empty, self.author_proxy]) after = self.make_project_state([self.author_empty, self.author_proxy_notproxy]) autodetector = MigrationAutodetector(before, after) changes = autodetector._detect_changes() # Right number/type of migrations? self.assertNumberMigrations(changes, "testapp", 1) self.assertOperationTypes(changes, "testapp", 0, ["DeleteModel", "CreateModel"]) self.assertOperationAttributes(changes, "testapp", 0, 0, name="AuthorProxy") self.assertOperationAttributes(changes, "testapp", 0, 1, name="AuthorProxy", options={}) def test_proxy_custom_pk(self): """ #23415 - The autodetector must correctly deal with custom FK on proxy models. """ # First, we test the default pk field name before = self.make_project_state([]) after = self.make_project_state([self.author_empty, self.author_proxy_third, self.book_proxy_fk]) autodetector = MigrationAutodetector(before, after) changes = autodetector._detect_changes() # The field name the FK on the book model points to self.assertEqual(changes['otherapp'][0].operations[0].fields[2][1].remote_field.field_name, 'id') # Now, we test the custom pk field name before = self.make_project_state([]) after = self.make_project_state([self.author_custom_pk, self.author_proxy_third, self.book_proxy_fk]) autodetector = MigrationAutodetector(before, after) changes = autodetector._detect_changes() # The field name the FK on the book model points to self.assertEqual(changes['otherapp'][0].operations[0].fields[2][1].remote_field.field_name, 'pk_field') def test_unmanaged_create(self): """Tests that the autodetector correctly deals with managed models.""" # First, we test adding an unmanaged model before = self.make_project_state([self.author_empty]) after = self.make_project_state([self.author_empty, self.author_unmanaged]) autodetector = MigrationAutodetector(before, after) changes = autodetector._detect_changes() # Right number/type of migrations? self.assertNumberMigrations(changes, 'testapp', 1) self.assertOperationTypes(changes, 'testapp', 0, ["CreateModel"]) self.assertOperationAttributes(changes, 'testapp', 0, 0, name="AuthorUnmanaged", options={"managed": False}) def test_unmanaged_to_managed(self): # Now, we test turning an unmanaged model into a managed model before = self.make_project_state([self.author_empty, self.author_unmanaged]) after = self.make_project_state([self.author_empty, self.author_unmanaged_managed]) autodetector = MigrationAutodetector(before, after) changes = autodetector._detect_changes() # Right number/type of migrations? self.assertNumberMigrations(changes, 'testapp', 1) self.assertOperationTypes(changes, 'testapp', 0, ["AlterModelOptions"]) self.assertOperationAttributes(changes, 'testapp', 0, 0, name="authorunmanaged", options={}) def test_managed_to_unmanaged(self): # Now, we turn managed to unmanaged. before = self.make_project_state([self.author_empty, self.author_unmanaged_managed]) after = self.make_project_state([self.author_empty, self.author_unmanaged]) autodetector = MigrationAutodetector(before, after) changes = autodetector._detect_changes() # Right number/type of migrations? self.assertNumberMigrations(changes, 'testapp', 1) self.assertOperationTypes(changes, "testapp", 0, ["AlterModelOptions"]) self.assertOperationAttributes(changes, "testapp", 0, 0, name="authorunmanaged", options={"managed": False}) def test_unmanaged_custom_pk(self): """ #23415 - The autodetector must correctly deal with custom FK on unmanaged models. """ # First, we test the default pk field name before = self.make_project_state([]) after = self.make_project_state([self.author_unmanaged_default_pk, self.book]) autodetector = MigrationAutodetector(before, after) changes = autodetector._detect_changes() # The field name the FK on the book model points to self.assertEqual(changes['otherapp'][0].operations[0].fields[2][1].remote_field.field_name, 'id') # Now, we test the custom pk field name before = self.make_project_state([]) after = self.make_project_state([self.author_unmanaged_custom_pk, self.book]) autodetector = MigrationAutodetector(before, after) changes = autodetector._detect_changes() # The field name the FK on the book model points to self.assertEqual(changes['otherapp'][0].operations[0].fields[2][1].remote_field.field_name, 'pk_field') @override_settings(AUTH_USER_MODEL="thirdapp.CustomUser") def test_swappable(self): with isolate_lru_cache(apps.get_swappable_settings_name): before = self.make_project_state([self.custom_user]) after = self.make_project_state([self.custom_user, self.author_with_custom_user]) autodetector = MigrationAutodetector(before, after) changes = autodetector._detect_changes() # Right number/type of migrations? self.assertNumberMigrations(changes, 'testapp', 1) self.assertOperationTypes(changes, 'testapp', 0, ["CreateModel"]) self.assertOperationAttributes(changes, 'testapp', 0, 0, name="Author") self.assertMigrationDependencies(changes, 'testapp', 0, [("__setting__", "AUTH_USER_MODEL")]) def test_swappable_changed(self): with isolate_lru_cache(apps.get_swappable_settings_name): before = self.make_project_state([self.custom_user, self.author_with_user]) with override_settings(AUTH_USER_MODEL="thirdapp.CustomUser"): after = self.make_project_state([self.custom_user, self.author_with_custom_user]) autodetector = MigrationAutodetector(before, after) changes = autodetector._detect_changes() # Right number/type of migrations? self.assertNumberMigrations(changes, 'testapp', 1) self.assertOperationTypes(changes, 'testapp', 0, ["AlterField"]) self.assertOperationAttributes(changes, 'testapp', 0, 0, model_name="author", name='user') fk_field = changes['testapp'][0].operations[0].field to_model = '%s.%s' % ( fk_field.remote_field.model._meta.app_label, fk_field.remote_field.model._meta.object_name, ) self.assertEqual(to_model, 'thirdapp.CustomUser') def test_add_field_with_default(self): """#22030 - Adding a field with a default should work.""" # Make state before = self.make_project_state([self.author_empty]) after = self.make_project_state([self.author_name_default]) autodetector = MigrationAutodetector(before, after) changes = autodetector._detect_changes() # Right number/type of migrations? self.assertNumberMigrations(changes, 'testapp', 1) self.assertOperationTypes(changes, 'testapp', 0, ["AddField"]) self.assertOperationAttributes(changes, 'testapp', 0, 0, name="name") def test_custom_deconstructable(self): """ Two instances which deconstruct to the same value aren't considered a change. """ before = self.make_project_state([self.author_name_deconstructable_1]) after = self.make_project_state([self.author_name_deconstructable_2]) autodetector = MigrationAutodetector(before, after) changes = autodetector._detect_changes() # Right number of migrations? self.assertEqual(len(changes), 0) def test_deconstruct_field_kwarg(self): """Field instances are handled correctly by nested deconstruction.""" before = self.make_project_state([self.author_name_deconstructable_3]) after = self.make_project_state([self.author_name_deconstructable_4]) autodetector = MigrationAutodetector(before, after) changes = autodetector._detect_changes() self.assertEqual(changes, {}) def test_deconstructable_list(self): """Nested deconstruction descends into lists.""" # When lists contain items that deconstruct to identical values, those lists # should be considered equal for the purpose of detecting state changes # (even if the original items are unequal). before = self.make_project_state([self.author_name_deconstructable_list_1]) after = self.make_project_state([self.author_name_deconstructable_list_2]) autodetector = MigrationAutodetector(before, after) changes = autodetector._detect_changes() self.assertEqual(changes, {}) # Legitimate differences within the deconstructed lists should be reported # as a change before = self.make_project_state([self.author_name_deconstructable_list_1]) after = self.make_project_state([self.author_name_deconstructable_list_3]) autodetector = MigrationAutodetector(before, after) changes = autodetector._detect_changes() self.assertEqual(len(changes), 1) def test_deconstructable_tuple(self): """Nested deconstruction descends into tuples.""" # When tuples contain items that deconstruct to identical values, those tuples # should be considered equal for the purpose of detecting state changes # (even if the original items are unequal). before = self.make_project_state([self.author_name_deconstructable_tuple_1]) after = self.make_project_state([self.author_name_deconstructable_tuple_2]) autodetector = MigrationAutodetector(before, after) changes = autodetector._detect_changes() self.assertEqual(changes, {}) # Legitimate differences within the deconstructed tuples should be reported # as a change before = self.make_project_state([self.author_name_deconstructable_tuple_1]) after = self.make_project_state([self.author_name_deconstructable_tuple_3]) autodetector = MigrationAutodetector(before, after) changes = autodetector._detect_changes() self.assertEqual(len(changes), 1) def test_deconstructable_dict(self): """Nested deconstruction descends into dict values.""" # When dicts contain items whose values deconstruct to identical values, # those dicts should be considered equal for the purpose of detecting # state changes (even if the original values are unequal). before = self.make_project_state([self.author_name_deconstructable_dict_1]) after = self.make_project_state([self.author_name_deconstructable_dict_2]) autodetector = MigrationAutodetector(before, after) changes = autodetector._detect_changes() self.assertEqual(changes, {}) # Legitimate differences within the deconstructed dicts should be reported # as a change before = self.make_project_state([self.author_name_deconstructable_dict_1]) after = self.make_project_state([self.author_name_deconstructable_dict_3]) autodetector = MigrationAutodetector(before, after) changes = autodetector._detect_changes() self.assertEqual(len(changes), 1) def test_nested_deconstructable_objects(self): """ Nested deconstruction is applied recursively to the args/kwargs of deconstructed objects. """ # If the items within a deconstructed object's args/kwargs have the same # deconstructed values - whether or not the items themselves are different # instances - then the object as a whole is regarded as unchanged. before = self.make_project_state([self.author_name_nested_deconstructable_1]) after = self.make_project_state([self.author_name_nested_deconstructable_2]) autodetector = MigrationAutodetector(before, after) changes = autodetector._detect_changes() self.assertEqual(changes, {}) # Differences that exist solely within the args list of a deconstructed object # should be reported as changes before = self.make_project_state([self.author_name_nested_deconstructable_1]) after = self.make_project_state([self.author_name_nested_deconstructable_changed_arg]) autodetector = MigrationAutodetector(before, after) changes = autodetector._detect_changes() self.assertEqual(len(changes), 1) # Additional args should also be reported as a change before = self.make_project_state([self.author_name_nested_deconstructable_1]) after = self.make_project_state([self.author_name_nested_deconstructable_extra_arg]) autodetector = MigrationAutodetector(before, after) changes = autodetector._detect_changes() self.assertEqual(len(changes), 1) # Differences that exist solely within the kwargs dict of a deconstructed object # should be reported as changes before = self.make_project_state([self.author_name_nested_deconstructable_1]) after = self.make_project_state([self.author_name_nested_deconstructable_changed_kwarg]) autodetector = MigrationAutodetector(before, after) changes = autodetector._detect_changes() self.assertEqual(len(changes), 1) # Additional kwargs should also be reported as a change before = self.make_project_state([self.author_name_nested_deconstructable_1]) after = self.make_project_state([self.author_name_nested_deconstructable_extra_kwarg]) autodetector = MigrationAutodetector(before, after) changes = autodetector._detect_changes() self.assertEqual(len(changes), 1) def test_deconstruct_type(self): """ #22951 -- Uninstanted classes with deconstruct are correctly returned by deep_deconstruct during serialization. """ author = ModelState( "testapp", "Author", [ ("id", models.AutoField(primary_key=True)), ("name", models.CharField( max_length=200, # IntegerField intentionally not instantiated. default=models.IntegerField, )) ], ) # Make state before = self.make_project_state([]) after = self.make_project_state([author]) autodetector = MigrationAutodetector(before, after) changes = autodetector._detect_changes() # Right number/type of migrations? self.assertNumberMigrations(changes, 'testapp', 1) self.assertOperationTypes(changes, 'testapp', 0, ["CreateModel"]) def test_replace_string_with_foreignkey(self): """ #22300 - Adding an FK in the same "spot" as a deleted CharField should work. """ # Make state before = self.make_project_state([self.author_with_publisher_string]) after = self.make_project_state([self.author_with_publisher, self.publisher]) autodetector = MigrationAutodetector(before, after) changes = autodetector._detect_changes() # Right number/type of migrations? self.assertNumberMigrations(changes, 'testapp', 1) self.assertOperationTypes(changes, 'testapp', 0, ["CreateModel", "RemoveField", "AddField"]) self.assertOperationAttributes(changes, 'testapp', 0, 0, name="Publisher") self.assertOperationAttributes(changes, 'testapp', 0, 1, name="publisher_name") self.assertOperationAttributes(changes, 'testapp', 0, 2, name="publisher") def test_foreign_key_removed_before_target_model(self): """ Removing an FK and the model it targets in the same change must remove the FK field before the model to maintain consistency. """ before = self.make_project_state([self.author_with_publisher, self.publisher]) after = self.make_project_state([self.author_name]) # removes both the model and FK autodetector = MigrationAutodetector(before, after) changes = autodetector._detect_changes() # Right number/type of migrations? self.assertNumberMigrations(changes, 'testapp', 1) self.assertOperationTypes(changes, 'testapp', 0, ["RemoveField", "DeleteModel"]) self.assertOperationAttributes(changes, 'testapp', 0, 0, name="publisher") self.assertOperationAttributes(changes, 'testapp', 0, 1, name="Publisher") @mock.patch('django.db.migrations.questioner.MigrationQuestioner.ask_not_null_addition', side_effect=AssertionError("Should not have prompted for not null addition")) def test_add_many_to_many(self, mocked_ask_method): """#22435 - Adding a ManyToManyField should not prompt for a default.""" before = self.make_project_state([self.author_empty, self.publisher]) after = self.make_project_state([self.author_with_m2m, self.publisher]) autodetector = MigrationAutodetector(before, after) changes = autodetector._detect_changes() # Right number/type of migrations? self.assertNumberMigrations(changes, 'testapp', 1) self.assertOperationTypes(changes, 'testapp', 0, ["AddField"]) self.assertOperationAttributes(changes, 'testapp', 0, 0, name="publishers") def test_alter_many_to_many(self): before = self.make_project_state([self.author_with_m2m, self.publisher]) after = self.make_project_state([self.author_with_m2m_blank, self.publisher]) autodetector = MigrationAutodetector(before, after) changes = autodetector._detect_changes() # Right number/type of migrations? self.assertNumberMigrations(changes, 'testapp', 1) self.assertOperationTypes(changes, 'testapp', 0, ["AlterField"]) self.assertOperationAttributes(changes, 'testapp', 0, 0, name="publishers") def test_create_with_through_model(self): """ Adding a m2m with a through model and the models that use it should be ordered correctly. """ before = self.make_project_state([]) after = self.make_project_state([self.author_with_m2m_through, self.publisher, self.contract]) autodetector = MigrationAutodetector(before, after) changes = autodetector._detect_changes() # Right number/type of migrations? self.assertNumberMigrations(changes, "testapp", 1) self.assertOperationTypes(changes, "testapp", 0, [ "CreateModel", "CreateModel", "CreateModel", "AddField", "AddField" ]) self.assertOperationAttributes(changes, 'testapp', 0, 0, name="Author") self.assertOperationAttributes(changes, 'testapp', 0, 1, name="Contract") self.assertOperationAttributes(changes, 'testapp', 0, 2, name="Publisher") self.assertOperationAttributes(changes, 'testapp', 0, 3, model_name='contract', name='publisher') self.assertOperationAttributes(changes, 'testapp', 0, 4, model_name='author', name='publishers') def test_many_to_many_removed_before_through_model(self): """ Removing a ManyToManyField and the "through" model in the same change must remove the field before the model to maintain consistency. """ before = self.make_project_state([ self.book_with_multiple_authors_through_attribution, self.author_name, self.attribution ]) # Remove both the through model and ManyToMany after = self.make_project_state([self.book_with_no_author, self.author_name]) autodetector = MigrationAutodetector(before, after) changes = autodetector._detect_changes() # Right number/type of migrations? self.assertNumberMigrations(changes, "otherapp", 1) self.assertOperationTypes(changes, "otherapp", 0, ["RemoveField", "RemoveField", "RemoveField", "DeleteModel"]) self.assertOperationAttributes(changes, 'otherapp', 0, 0, name="author", model_name='attribution') self.assertOperationAttributes(changes, 'otherapp', 0, 1, name="book", model_name='attribution') self.assertOperationAttributes(changes, 'otherapp', 0, 2, name="authors", model_name='book') self.assertOperationAttributes(changes, 'otherapp', 0, 3, name='Attribution') def test_many_to_many_removed_before_through_model_2(self): """ Removing a model that contains a ManyToManyField and the "through" model in the same change must remove the field before the model to maintain consistency. """ before = self.make_project_state([ self.book_with_multiple_authors_through_attribution, self.author_name, self.attribution ]) # Remove both the through model and ManyToMany after = self.make_project_state([self.author_name]) autodetector = MigrationAutodetector(before, after) changes = autodetector._detect_changes() # Right number/type of migrations? self.assertNumberMigrations(changes, "otherapp", 1) self.assertOperationTypes(changes, "otherapp", 0, [ "RemoveField", "RemoveField", "RemoveField", "DeleteModel", "DeleteModel" ]) self.assertOperationAttributes(changes, 'otherapp', 0, 0, name="author", model_name='attribution') self.assertOperationAttributes(changes, 'otherapp', 0, 1, name="book", model_name='attribution') self.assertOperationAttributes(changes, 'otherapp', 0, 2, name="authors", model_name='book') self.assertOperationAttributes(changes, 'otherapp', 0, 3, name='Attribution') self.assertOperationAttributes(changes, 'otherapp', 0, 4, name='Book') def test_m2m_w_through_multistep_remove(self): """ A model with a m2m field that specifies a "through" model cannot be removed in the same migration as that through model as the schema will pass through an inconsistent state. The autodetector should produce two migrations to avoid this issue. """ before = self.make_project_state([self.author_with_m2m_through, self.publisher, self.contract]) after = self.make_project_state([self.publisher]) autodetector = MigrationAutodetector(before, after) changes = autodetector._detect_changes() # Right number/type of migrations? self.assertNumberMigrations(changes, "testapp", 1) self.assertOperationTypes(changes, "testapp", 0, [ "RemoveField", "RemoveField", "RemoveField", "DeleteModel", "DeleteModel" ]) self.assertOperationAttributes(changes, "testapp", 0, 0, name="publishers", model_name='author') self.assertOperationAttributes(changes, "testapp", 0, 1, name="author", model_name='contract') self.assertOperationAttributes(changes, "testapp", 0, 2, name="publisher", model_name='contract') self.assertOperationAttributes(changes, "testapp", 0, 3, name="Author") self.assertOperationAttributes(changes, "testapp", 0, 4, name="Contract") def test_concrete_field_changed_to_many_to_many(self): """ #23938 - Tests that changing a concrete field into a ManyToManyField first removes the concrete field and then adds the m2m field. """ before = self.make_project_state([self.author_with_former_m2m]) after = self.make_project_state([self.author_with_m2m, self.publisher]) autodetector = MigrationAutodetector(before, after) changes = autodetector._detect_changes() # Right number/type of migrations? self.assertNumberMigrations(changes, "testapp", 1) self.assertOperationTypes(changes, "testapp", 0, ["CreateModel", "RemoveField", "AddField"]) self.assertOperationAttributes(changes, 'testapp', 0, 0, name='Publisher') self.assertOperationAttributes(changes, 'testapp', 0, 1, name="publishers", model_name='author') self.assertOperationAttributes(changes, 'testapp', 0, 2, name="publishers", model_name='author') def test_many_to_many_changed_to_concrete_field(self): """ #23938 - Tests that changing a ManyToManyField into a concrete field first removes the m2m field and then adds the concrete field. """ before = self.make_project_state([self.author_with_m2m, self.publisher]) after = self.make_project_state([self.author_with_former_m2m]) autodetector = MigrationAutodetector(before, after) changes = autodetector._detect_changes() # Right number/type of migrations? self.assertNumberMigrations(changes, "testapp", 1) self.assertOperationTypes(changes, "testapp", 0, ["RemoveField", "AddField", "DeleteModel"]) self.assertOperationAttributes(changes, 'testapp', 0, 0, name="publishers", model_name='author') self.assertOperationAttributes(changes, 'testapp', 0, 1, name="publishers", model_name='author') self.assertOperationAttributes(changes, 'testapp', 0, 2, name='Publisher') self.assertOperationFieldAttributes(changes, 'testapp', 0, 1, max_length=100) def test_non_circular_foreignkey_dependency_removal(self): """ If two models with a ForeignKey from one to the other are removed at the same time, the autodetector should remove them in the correct order. """ before = self.make_project_state([self.author_with_publisher, self.publisher_with_author]) after = self.make_project_state([]) autodetector = MigrationAutodetector(before, after) changes = autodetector._detect_changes() # Right number/type of migrations? self.assertNumberMigrations(changes, "testapp", 1) self.assertOperationTypes(changes, "testapp", 0, ["RemoveField", "RemoveField", "DeleteModel", "DeleteModel"]) self.assertOperationAttributes(changes, "testapp", 0, 0, name="publisher", model_name='author') self.assertOperationAttributes(changes, "testapp", 0, 1, name="author", model_name='publisher') self.assertOperationAttributes(changes, "testapp", 0, 2, name="Author") self.assertOperationAttributes(changes, "testapp", 0, 3, name="Publisher") def test_alter_model_options(self): """Changing a model's options should make a change.""" before = self.make_project_state([self.author_empty]) after = self.make_project_state([self.author_with_options]) autodetector = MigrationAutodetector(before, after) changes = autodetector._detect_changes() # Right number/type of migrations? self.assertNumberMigrations(changes, "testapp", 1) self.assertOperationTypes(changes, "testapp", 0, ["AlterModelOptions"]) self.assertOperationAttributes(changes, "testapp", 0, 0, options={ "permissions": [('can_hire', 'Can hire')], "verbose_name": "Authi", }) # Changing them back to empty should also make a change before = self.make_project_state([self.author_with_options]) after = self.make_project_state([self.author_empty]) autodetector = MigrationAutodetector(before, after) changes = autodetector._detect_changes() # Right number/type of migrations? self.assertNumberMigrations(changes, "testapp", 1) self.assertOperationTypes(changes, "testapp", 0, ["AlterModelOptions"]) self.assertOperationAttributes(changes, "testapp", 0, 0, name="author", options={}) def test_alter_model_options_proxy(self): """Changing a proxy model's options should also make a change.""" before = self.make_project_state([self.author_proxy, self.author_empty]) after = self.make_project_state([self.author_proxy_options, self.author_empty]) autodetector = MigrationAutodetector(before, after) changes = autodetector._detect_changes() # Right number/type of migrations? self.assertNumberMigrations(changes, "testapp", 1) self.assertOperationTypes(changes, "testapp", 0, ["AlterModelOptions"]) self.assertOperationAttributes(changes, "testapp", 0, 0, name="authorproxy", options={ "verbose_name": "Super Author" }) def test_set_alter_order_with_respect_to(self): """Tests that setting order_with_respect_to adds a field.""" # Make state before = self.make_project_state([self.book, self.author_with_book]) after = self.make_project_state([self.book, self.author_with_book_order_wrt]) autodetector = MigrationAutodetector(before, after) changes = autodetector._detect_changes() # Right number/type of migrations? self.assertNumberMigrations(changes, 'testapp', 1) self.assertOperationTypes(changes, 'testapp', 0, ["AlterOrderWithRespectTo"]) self.assertOperationAttributes(changes, 'testapp', 0, 0, name="author", order_with_respect_to="book") def test_add_alter_order_with_respect_to(self): """ Tests that setting order_with_respect_to when adding the FK too does things in the right order. """ # Make state before = self.make_project_state([self.author_name]) after = self.make_project_state([self.book, self.author_with_book_order_wrt]) autodetector = MigrationAutodetector(before, after) changes = autodetector._detect_changes() # Right number/type of migrations? self.assertNumberMigrations(changes, 'testapp', 1) self.assertOperationTypes(changes, 'testapp', 0, ["AddField", "AlterOrderWithRespectTo"]) self.assertOperationAttributes(changes, 'testapp', 0, 0, model_name="author", name="book") self.assertOperationAttributes(changes, 'testapp', 0, 1, name="author", order_with_respect_to="book") def test_remove_alter_order_with_respect_to(self): """ Tests that removing order_with_respect_to when removing the FK too does things in the right order. """ # Make state before = self.make_project_state([self.book, self.author_with_book_order_wrt]) after = self.make_project_state([self.author_name]) autodetector = MigrationAutodetector(before, after) changes = autodetector._detect_changes() # Right number/type of migrations? self.assertNumberMigrations(changes, 'testapp', 1) self.assertOperationTypes(changes, 'testapp', 0, ["AlterOrderWithRespectTo", "RemoveField"]) self.assertOperationAttributes(changes, 'testapp', 0, 0, name="author", order_with_respect_to=None) self.assertOperationAttributes(changes, 'testapp', 0, 1, model_name="author", name="book") def test_add_model_order_with_respect_to(self): """ Tests that setting order_with_respect_to when adding the whole model does things in the right order. """ # Make state before = self.make_project_state([]) after = self.make_project_state([self.book, self.author_with_book_order_wrt]) autodetector = MigrationAutodetector(before, after) changes = autodetector._detect_changes() # Right number/type of migrations? self.assertNumberMigrations(changes, 'testapp', 1) self.assertOperationTypes(changes, 'testapp', 0, ["CreateModel", "AlterOrderWithRespectTo"]) self.assertOperationAttributes(changes, 'testapp', 0, 1, name="author", order_with_respect_to="book") self.assertNotIn("_order", [name for name, field in changes['testapp'][0].operations[0].fields]) def test_alter_model_managers(self): """ Tests that changing the model managers adds a new operation. """ # Make state before = self.make_project_state([self.other_pony]) after = self.make_project_state([self.other_pony_food]) autodetector = MigrationAutodetector(before, after) changes = autodetector._detect_changes() # Right number/type of migrations? self.assertNumberMigrations(changes, 'otherapp', 1) self.assertOperationTypes(changes, 'otherapp', 0, ["AlterModelManagers"]) self.assertOperationAttributes(changes, 'otherapp', 0, 0, name="pony") self.assertEqual([name for name, mgr in changes['otherapp'][0].operations[0].managers], ['food_qs', 'food_mgr', 'food_mgr_kwargs']) self.assertEqual(changes['otherapp'][0].operations[0].managers[1][1].args, ('a', 'b', 1, 2)) self.assertEqual(changes['otherapp'][0].operations[0].managers[2][1].args, ('x', 'y', 3, 4)) def test_swappable_first_inheritance(self): """Tests that swappable models get their CreateModel first.""" # Make state before = self.make_project_state([]) after = self.make_project_state([self.custom_user, self.aardvark]) autodetector = MigrationAutodetector(before, after) changes = autodetector._detect_changes() # Right number/type of migrations? self.assertNumberMigrations(changes, 'thirdapp', 1) self.assertOperationTypes(changes, 'thirdapp', 0, ["CreateModel", "CreateModel"]) self.assertOperationAttributes(changes, 'thirdapp', 0, 0, name="CustomUser") self.assertOperationAttributes(changes, 'thirdapp', 0, 1, name="Aardvark") @override_settings(AUTH_USER_MODEL="thirdapp.CustomUser") def test_swappable_first_setting(self): """Tests that swappable models get their CreateModel first.""" with isolate_lru_cache(apps.get_swappable_settings_name): # Make state before = self.make_project_state([]) after = self.make_project_state([self.custom_user_no_inherit, self.aardvark]) autodetector = MigrationAutodetector(before, after) changes = autodetector._detect_changes() # Right number/type of migrations? self.assertNumberMigrations(changes, 'thirdapp', 1) self.assertOperationTypes(changes, 'thirdapp', 0, ["CreateModel", "CreateModel"]) self.assertOperationAttributes(changes, 'thirdapp', 0, 0, name="CustomUser") self.assertOperationAttributes(changes, 'thirdapp', 0, 1, name="Aardvark") def test_bases_first(self): """Tests that bases of other models come first.""" # Make state before = self.make_project_state([]) after = self.make_project_state([self.aardvark_based_on_author, self.author_name]) autodetector = MigrationAutodetector(before, after) changes = autodetector._detect_changes() # Right number/type of migrations? self.assertNumberMigrations(changes, 'testapp', 1) self.assertOperationTypes(changes, 'testapp', 0, ["CreateModel", "CreateModel"]) self.assertOperationAttributes(changes, 'testapp', 0, 0, name="Author") self.assertOperationAttributes(changes, 'testapp', 0, 1, name="Aardvark") def test_multiple_bases(self): """#23956 - Tests that inheriting models doesn't move *_ptr fields into AddField operations.""" A = ModelState("app", "A", [("a_id", models.AutoField(primary_key=True))]) B = ModelState("app", "B", [("b_id", models.AutoField(primary_key=True))]) C = ModelState("app", "C", [], bases=("app.A", "app.B")) D = ModelState("app", "D", [], bases=("app.A", "app.B")) E = ModelState("app", "E", [], bases=("app.A", "app.B")) # Make state before = self.make_project_state([]) after = self.make_project_state([A, B, C, D, E]) autodetector = MigrationAutodetector(before, after) changes = autodetector._detect_changes() # Right number/type of migrations? self.assertNumberMigrations(changes, "app", 1) self.assertOperationTypes(changes, "app", 0, [ "CreateModel", "CreateModel", "CreateModel", "CreateModel", "CreateModel" ]) self.assertOperationAttributes(changes, "app", 0, 0, name="A") self.assertOperationAttributes(changes, "app", 0, 1, name="B") self.assertOperationAttributes(changes, "app", 0, 2, name="C") self.assertOperationAttributes(changes, "app", 0, 3, name="D") self.assertOperationAttributes(changes, "app", 0, 4, name="E") def test_proxy_bases_first(self): """Tests that bases of proxies come first.""" # Make state before = self.make_project_state([]) after = self.make_project_state([self.author_empty, self.author_proxy, self.author_proxy_proxy]) autodetector = MigrationAutodetector(before, after) changes = autodetector._detect_changes() # Right number/type of migrations? self.assertNumberMigrations(changes, 'testapp', 1) self.assertOperationTypes(changes, 'testapp', 0, ["CreateModel", "CreateModel", "CreateModel"]) self.assertOperationAttributes(changes, 'testapp', 0, 0, name="Author") self.assertOperationAttributes(changes, 'testapp', 0, 1, name="AuthorProxy") self.assertOperationAttributes(changes, 'testapp', 0, 2, name="AAuthorProxyProxy") def test_pk_fk_included(self): """ Tests that a relation used as the primary key is kept as part of CreateModel. """ # Make state before = self.make_project_state([]) after = self.make_project_state([self.aardvark_pk_fk_author, self.author_name]) autodetector = MigrationAutodetector(before, after) changes = autodetector._detect_changes() # Right number/type of migrations? self.assertNumberMigrations(changes, 'testapp', 1) self.assertOperationTypes(changes, 'testapp', 0, ["CreateModel", "CreateModel"]) self.assertOperationAttributes(changes, 'testapp', 0, 0, name="Author") self.assertOperationAttributes(changes, 'testapp', 0, 1, name="Aardvark") def test_first_dependency(self): """ Tests that a dependency to an app with no migrations uses __first__. """ # Load graph loader = MigrationLoader(connection) # Make state before = self.make_project_state([]) after = self.make_project_state([self.book_migrations_fk]) after.real_apps = ["migrations"] autodetector = MigrationAutodetector(before, after) changes = autodetector._detect_changes(graph=loader.graph) # Right number/type of migrations? self.assertNumberMigrations(changes, 'otherapp', 1) self.assertOperationTypes(changes, 'otherapp', 0, ["CreateModel"]) self.assertOperationAttributes(changes, 'otherapp', 0, 0, name="Book") self.assertMigrationDependencies(changes, 'otherapp', 0, [("migrations", "__first__")]) @override_settings(MIGRATION_MODULES={"migrations": "migrations.test_migrations"}) def test_last_dependency(self): """ Tests that a dependency to an app with existing migrations uses the last migration of that app. """ # Load graph loader = MigrationLoader(connection) # Make state before = self.make_project_state([]) after = self.make_project_state([self.book_migrations_fk]) after.real_apps = ["migrations"] autodetector = MigrationAutodetector(before, after) changes = autodetector._detect_changes(graph=loader.graph) # Right number/type of migrations? self.assertNumberMigrations(changes, 'otherapp', 1) self.assertOperationTypes(changes, 'otherapp', 0, ["CreateModel"]) self.assertOperationAttributes(changes, 'otherapp', 0, 0, name="Book") self.assertMigrationDependencies(changes, 'otherapp', 0, [("migrations", "0002_second")]) def test_alter_fk_before_model_deletion(self): """ Tests that ForeignKeys are altered _before_ the model they used to refer to are deleted. """ # Make state before = self.make_project_state([self.author_name, self.publisher_with_author]) after = self.make_project_state([self.aardvark_testapp, self.publisher_with_aardvark_author]) autodetector = MigrationAutodetector(before, after) changes = autodetector._detect_changes() # Right number/type of migrations? self.assertNumberMigrations(changes, 'testapp', 1) self.assertOperationTypes(changes, 'testapp', 0, ["CreateModel", "AlterField", "DeleteModel"]) self.assertOperationAttributes(changes, 'testapp', 0, 0, name="Aardvark") self.assertOperationAttributes(changes, 'testapp', 0, 1, name="author") self.assertOperationAttributes(changes, 'testapp', 0, 2, name="Author") def test_fk_dependency_other_app(self): """ #23100 - Tests that ForeignKeys correctly depend on other apps' models. """ # Make state before = self.make_project_state([self.author_name, self.book]) after = self.make_project_state([self.author_with_book, self.book]) autodetector = MigrationAutodetector(before, after) changes = autodetector._detect_changes() # Right number/type of migrations? self.assertNumberMigrations(changes, 'testapp', 1) self.assertOperationTypes(changes, 'testapp', 0, ["AddField"]) self.assertOperationAttributes(changes, 'testapp', 0, 0, name="book") self.assertMigrationDependencies(changes, 'testapp', 0, [("otherapp", "__first__")]) def test_circular_dependency_mixed_addcreate(self): """ #23315 - Tests that the dependency resolver knows to put all CreateModel before AddField and not become unsolvable. """ address = ModelState("a", "Address", [ ("id", models.AutoField(primary_key=True)), ("country", models.ForeignKey("b.DeliveryCountry", models.CASCADE)), ]) person = ModelState("a", "Person", [ ("id", models.AutoField(primary_key=True)), ]) apackage = ModelState("b", "APackage", [ ("id", models.AutoField(primary_key=True)), ("person", models.ForeignKey("a.Person", models.CASCADE)), ]) country = ModelState("b", "DeliveryCountry", [ ("id", models.AutoField(primary_key=True)), ]) # Make state before = self.make_project_state([]) after = self.make_project_state([address, person, apackage, country]) autodetector = MigrationAutodetector(before, after) changes = autodetector._detect_changes() # Right number/type of migrations? self.assertNumberMigrations(changes, 'a', 2) self.assertNumberMigrations(changes, 'b', 1) self.assertOperationTypes(changes, 'a', 0, ["CreateModel", "CreateModel"]) self.assertOperationTypes(changes, 'a', 1, ["AddField"]) self.assertOperationTypes(changes, 'b', 0, ["CreateModel", "CreateModel"]) @override_settings(AUTH_USER_MODEL="a.Tenant") def test_circular_dependency_swappable(self): """ #23322 - Tests that the dependency resolver knows to explicitly resolve swappable models. """ with isolate_lru_cache(apps.get_swappable_settings_name): tenant = ModelState("a", "Tenant", [ ("id", models.AutoField(primary_key=True)), ("primary_address", models.ForeignKey("b.Address", models.CASCADE))], bases=(AbstractBaseUser, ) ) address = ModelState("b", "Address", [ ("id", models.AutoField(primary_key=True)), ("tenant", models.ForeignKey(settings.AUTH_USER_MODEL, models.CASCADE)), ]) # Make state before = self.make_project_state([]) after = self.make_project_state([address, tenant]) autodetector = MigrationAutodetector(before, after) changes = autodetector._detect_changes() # Right number/type of migrations? self.assertNumberMigrations(changes, 'a', 2) self.assertOperationTypes(changes, 'a', 0, ["CreateModel"]) self.assertOperationTypes(changes, 'a', 1, ["AddField"]) self.assertMigrationDependencies(changes, 'a', 0, []) self.assertMigrationDependencies(changes, 'a', 1, [('a', 'auto_1'), ('b', 'auto_1')]) # Right number/type of migrations? self.assertNumberMigrations(changes, 'b', 1) self.assertOperationTypes(changes, 'b', 0, ["CreateModel"]) self.assertMigrationDependencies(changes, 'b', 0, [('__setting__', 'AUTH_USER_MODEL')]) @override_settings(AUTH_USER_MODEL="b.Tenant") def test_circular_dependency_swappable2(self): """ #23322 - Tests that the dependency resolver knows to explicitly resolve swappable models but with the swappable not being the first migrated model. """ with isolate_lru_cache(apps.get_swappable_settings_name): address = ModelState("a", "Address", [ ("id", models.AutoField(primary_key=True)), ("tenant", models.ForeignKey(settings.AUTH_USER_MODEL, models.CASCADE)), ]) tenant = ModelState("b", "Tenant", [ ("id", models.AutoField(primary_key=True)), ("primary_address", models.ForeignKey("a.Address", models.CASCADE))], bases=(AbstractBaseUser, ) ) # Make state before = self.make_project_state([]) after = self.make_project_state([address, tenant]) autodetector = MigrationAutodetector(before, after) changes = autodetector._detect_changes() # Right number/type of migrations? self.assertNumberMigrations(changes, 'a', 2) self.assertOperationTypes(changes, 'a', 0, ["CreateModel"]) self.assertOperationTypes(changes, 'a', 1, ["AddField"]) self.assertMigrationDependencies(changes, 'a', 0, []) self.assertMigrationDependencies(changes, 'a', 1, [('__setting__', 'AUTH_USER_MODEL'), ('a', 'auto_1')]) # Right number/type of migrations? self.assertNumberMigrations(changes, 'b', 1) self.assertOperationTypes(changes, 'b', 0, ["CreateModel"]) self.assertMigrationDependencies(changes, 'b', 0, [('a', 'auto_1')]) @override_settings(AUTH_USER_MODEL="a.Person") def test_circular_dependency_swappable_self(self): """ #23322 - Tests that the dependency resolver knows to explicitly resolve swappable models. """ with isolate_lru_cache(apps.get_swappable_settings_name): person = ModelState("a", "Person", [ ("id", models.AutoField(primary_key=True)), ("parent1", models.ForeignKey(settings.AUTH_USER_MODEL, models.CASCADE, related_name='children')) ]) # Make state before = self.make_project_state([]) after = self.make_project_state([person]) autodetector = MigrationAutodetector(before, after) changes = autodetector._detect_changes() # Right number/type of migrations? self.assertNumberMigrations(changes, 'a', 1) self.assertOperationTypes(changes, 'a', 0, ["CreateModel"]) self.assertMigrationDependencies(changes, 'a', 0, []) @mock.patch('django.db.migrations.questioner.MigrationQuestioner.ask_not_null_addition', side_effect=AssertionError("Should not have prompted for not null addition")) def test_add_blank_textfield_and_charfield(self, mocked_ask_method): """ #23405 - Adding a NOT NULL and blank `CharField` or `TextField` without default should not prompt for a default. """ before = self.make_project_state([self.author_empty]) after = self.make_project_state([self.author_with_biography_blank]) autodetector = MigrationAutodetector(before, after) changes = autodetector._detect_changes() # Right number/type of migrations? self.assertNumberMigrations(changes, 'testapp', 1) self.assertOperationTypes(changes, 'testapp', 0, ["AddField", "AddField"]) self.assertOperationAttributes(changes, 'testapp', 0, 0) @mock.patch('django.db.migrations.questioner.MigrationQuestioner.ask_not_null_addition') def test_add_non_blank_textfield_and_charfield(self, mocked_ask_method): """ #23405 - Adding a NOT NULL and non-blank `CharField` or `TextField` without default should prompt for a default. """ before = self.make_project_state([self.author_empty]) after = self.make_project_state([self.author_with_biography_non_blank]) autodetector = MigrationAutodetector(before, after) changes = autodetector._detect_changes() self.assertEqual(mocked_ask_method.call_count, 2) # Right number/type of migrations? self.assertNumberMigrations(changes, 'testapp', 1) self.assertOperationTypes(changes, 'testapp', 0, ["AddField", "AddField"]) self.assertOperationAttributes(changes, 'testapp', 0, 0)
bsd-3-clause
[ 3, 1882, 2803, 26, 2774, 13, 24, 1882, 199, 646, 295, 199, 199, 504, 1639, 14, 5181, 492, 8686, 199, 504, 1639, 14, 2190, 492, 2202, 199, 504, 1639, 14, 2828, 14, 1178, 14, 992, 492, 11836, 1563, 1899, 199, 504, 1639, 14, 1018, 14, 11346, 492, 12939, 8640, 12, 4107, 63, 5464, 199, 504, 1639, 14, 697, 492, 1950, 12, 1709, 199, 504, 1639, 14, 697, 14, 7685, 14, 6898, 380, 9119, 492, 12090, 23570, 380, 9119, 199, 504, 1639, 14, 697, 14, 7685, 14, 2180, 492, 12090, 4578, 199, 504, 1639, 14, 697, 14, 7685, 14, 3422, 492, 12090, 5455, 199, 504, 1639, 14, 697, 14, 7685, 14, 4790, 281, 492, 12090, 16778, 281, 199, 504, 1639, 14, 697, 14, 7685, 14, 929, 492, 5822, 2223, 12, 7290, 2223, 199, 504, 1639, 14, 396, 492, 7640, 12, 1683, 12, 4278, 63, 1751, 199, 504, 1639, 14, 396, 14, 1208, 492, 365, 16288, 63, 25003, 63, 1637, 199, 199, 504, 1275, 992, 492, 481, 23521, 2988, 12, 481, 23521, 13689, 421, 199, 533, 1487, 8514, 461, 1692, 8, 785, 304, 272, 408, 272, 437, 3537, 477, 8514, 461, 909, 14, 272, 408, 339, 347, 636, 826, 721, 277, 12, 627, 589, 12, 1011, 958, 304, 267, 291, 14, 589, 275, 1249, 267, 291, 14, 958, 275, 2074, 339, 347, 477, 8514, 8, 277, 304, 267, 372, 334, 288, 291, 855, 578, 363, 435, 7815, 435, 291, 855, 533, 4914, 354, 3108, 288, 291, 14, 589, 12, 288, 291, 14, 958, 267, 776, 421, 199, 533, 27722, 380, 9119, 2925, 8, 1746, 304, 272, 408, 272, 6496, 314, 8367, 28537, 9119, 14, 272, 408, 339, 4132, 63, 1667, 275, 5822, 2223, 480, 19700, 401, 298, 5949, 401, 10003, 344, 401, 1709, 14, 4378, 8, 3327, 63, 498, 29, 549, 18229, 272, 4132, 63, 354, 275, 5822, 2223, 480, 19700, 401, 298, 5949, 401, 359, 267, 1689, 344, 401, 1709, 14, 4378, 8, 3327, 63, 498, 29, 549, 1826, 267, 1689, 354, 401, 1709, 14, 2183, 8, 988, 63, 1267, 29, 1840, 1826, 272, 4794, 272, 4132, 63, 354, 63, 2307, 275, 5822, 2223, 480, 19700, 401, 298, 5949, 401, 359, 267, 1689, 344, 401, 1709, 14, 4378, 8, 3327, 63, 498, 29, 549, 1826, 267, 1689, 354, 401, 1709, 14, 2183, 8, 988, 63, 1267, 29, 1840, 12, 2973, 29, 549, 1826, 272, 4794, 272, 4132, 63, 354, 63, 5298, 836, 275, 5822, 2223, 480, 19700, 401, 298, 5949, 401, 359, 267, 1689, 344, 401, 1709, 14, 4378, 8, 3327, 63, 498, 29, 549, 1826, 267, 1689, 354, 401, 1709, 14, 2183, 8, 988, 63, 1267, 29, 5303, 1826, 272, 4794, 272, 4132, 63, 354, 63, 29401, 275, 5822, 2223, 480, 19700, 401, 298, 5949, 401, 359, 267, 1689, 344, 401, 1709, 14, 4378, 8, 3327, 63, 498, 29, 549, 1826, 267, 1689, 1247, 401, 1709, 14, 2183, 8, 988, 63, 1267, 29, 1840, 1826, 272, 4794, 272, 4132, 63, 354, 63, 885, 275, 5822, 2223, 480, 19700, 401, 298, 5949, 401, 359, 267, 1689, 344, 401, 1709, 14, 4378, 8, 3327, 63, 498, 29, 549, 1826, 267, 1689, 354, 401, 1709, 14, 2183, 8, 988, 63, 1267, 29, 1840, 12, 849, 534, 33, 983, 3835, 1090, 7984, 3855, 272, 4794, 272, 4132, 63, 354, 63, 23693, 461, 63, 17, 275, 5822, 2223, 480, 19700, 401, 298, 5949, 401, 359, 267, 1689, 344, 401, 1709, 14, 4378, 8, 3327, 63, 498, 29, 549, 1826, 267, 1689, 354, 401, 1709, 14, 2183, 8, 988, 63, 1267, 29, 1840, 12, 849, 29, 872, 8514, 461, 1692, 22606, 272, 4794, 272, 4132, 63, 354, 63, 23693, 461, 63, 18, 275, 5822, 2223, 480, 19700, 401, 298, 5949, 401, 359, 267, 1689, 344, 401, 1709, 14, 4378, 8, 3327, 63, 498, 29, 549, 1826, 267, 1689, 354, 401, 1709, 14, 2183, 8, 988, 63, 1267, 29, 1840, 12, 849, 29, 872, 8514, 461, 1692, 22606, 272, 4794, 272, 4132, 63, 354, 63, 23693, 461, 63, 19, 275, 5822, 2223, 480, 19700, 401, 298, 5949, 401, 359, 267, 1689, 344, 401, 1709, 14, 4378, 8, 3327, 63, 498, 29, 549, 1826, 267, 1689, 354, 401, 1709, 14, 2183, 8, 988, 63, 1267, 29, 1840, 12, 849, 29, 992, 14, 3901, 22606, 272, 4794, 272, 4132, 63, 354, 63, 23693, 461, 63, 20, 275, 5822, 2223, 480, 19700, 401, 298, 5949, 401, 359, 267, 1689, 344, 401, 1709, 14, 4378, 8, 3327, 63, 498, 29, 549, 1826, 267, 1689, 354, 401, 1709, 14, 2183, 8, 988, 63, 1267, 29, 1840, 12, 849, 29, 992, 14, 3901, 22606, 272, 4794, 272, 4132, 63, 354, 63, 23693, 461, 63, 513, 63, 17, 275, 5822, 2223, 480, 19700, 401, 298, 5949, 401, 359, 267, 1689, 344, 401, 1709, 14, 4378, 8, 3327, 63, 498, 29, 549, 1826, 267, 1689, 354, 401, 1709, 14, 2183, 8, 988, 63, 1267, 29, 1840, 12, 849, 1524, 872, 8514, 461, 1692, 1062, 11869, 12884, 272, 4794, 272, 4132, 63, 354, 63, 23693, 461, 63, 513, 63, 18, 275, 5822, 2223, 480, 19700, 401, 298, 5949, 401, 359, 267, 1689, 344, 401, 1709, 14, 4378, 8, 3327, 63, 498, 29, 549, 1826, 267, 1689, 354, 401, 1709, 14, 2183, 8, 988, 63, 1267, 29, 1840, 12, 849, 1524, 872, 8514, 461, 1692, 1062, 11869, 12884, 272, 4794, 272, 4132, 63, 354, 63, 23693, 461, 63, 513, 63, 19, 275, 5822, 2223, 480, 19700, 401, 298, 5949, 401, 359, 267, 1689, 344, 401, 1709, 14, 4378, 8, 3327, 63, 498, 29, 549, 1826, 267, 1689, 354, 401, 1709, 14, 2183, 8, 988, 63, 1267, 29, 1840, 12, 849, 1524, 872, 8514, 461, 1692, 1062, 22291, 12884, 272, 4794, 272, 4132, 63, 354, 63, 23693, 461, 63, 2960, 63, 17, 275, 5822, 2223, 480, 19700, 401, 298, 5949, 401, 359, 267, 1689, 344, 401, 1709, 14, 4378, 8, 3327, 63, 498, 29, 549, 1826, 267, 1689, 354, 401, 1709, 14, 2183, 8, 988, 63, 1267, 29, 1840, 12, 849, 2687, 872, 8514, 461, 1692, 1062, 11869, 11508, 272, 4794, 272, 4132, 63, 354, 63, 23693, 461, 63, 2960, 63, 18, 275, 5822, 2223, 480, 19700, 401, 298, 5949, 401, 359 ]
[ 1882, 2803, 26, 2774, 13, 24, 1882, 199, 646, 295, 199, 199, 504, 1639, 14, 5181, 492, 8686, 199, 504, 1639, 14, 2190, 492, 2202, 199, 504, 1639, 14, 2828, 14, 1178, 14, 992, 492, 11836, 1563, 1899, 199, 504, 1639, 14, 1018, 14, 11346, 492, 12939, 8640, 12, 4107, 63, 5464, 199, 504, 1639, 14, 697, 492, 1950, 12, 1709, 199, 504, 1639, 14, 697, 14, 7685, 14, 6898, 380, 9119, 492, 12090, 23570, 380, 9119, 199, 504, 1639, 14, 697, 14, 7685, 14, 2180, 492, 12090, 4578, 199, 504, 1639, 14, 697, 14, 7685, 14, 3422, 492, 12090, 5455, 199, 504, 1639, 14, 697, 14, 7685, 14, 4790, 281, 492, 12090, 16778, 281, 199, 504, 1639, 14, 697, 14, 7685, 14, 929, 492, 5822, 2223, 12, 7290, 2223, 199, 504, 1639, 14, 396, 492, 7640, 12, 1683, 12, 4278, 63, 1751, 199, 504, 1639, 14, 396, 14, 1208, 492, 365, 16288, 63, 25003, 63, 1637, 199, 199, 504, 1275, 992, 492, 481, 23521, 2988, 12, 481, 23521, 13689, 421, 199, 533, 1487, 8514, 461, 1692, 8, 785, 304, 272, 408, 272, 437, 3537, 477, 8514, 461, 909, 14, 272, 408, 339, 347, 636, 826, 721, 277, 12, 627, 589, 12, 1011, 958, 304, 267, 291, 14, 589, 275, 1249, 267, 291, 14, 958, 275, 2074, 339, 347, 477, 8514, 8, 277, 304, 267, 372, 334, 288, 291, 855, 578, 363, 435, 7815, 435, 291, 855, 533, 4914, 354, 3108, 288, 291, 14, 589, 12, 288, 291, 14, 958, 267, 776, 421, 199, 533, 27722, 380, 9119, 2925, 8, 1746, 304, 272, 408, 272, 6496, 314, 8367, 28537, 9119, 14, 272, 408, 339, 4132, 63, 1667, 275, 5822, 2223, 480, 19700, 401, 298, 5949, 401, 10003, 344, 401, 1709, 14, 4378, 8, 3327, 63, 498, 29, 549, 18229, 272, 4132, 63, 354, 275, 5822, 2223, 480, 19700, 401, 298, 5949, 401, 359, 267, 1689, 344, 401, 1709, 14, 4378, 8, 3327, 63, 498, 29, 549, 1826, 267, 1689, 354, 401, 1709, 14, 2183, 8, 988, 63, 1267, 29, 1840, 1826, 272, 4794, 272, 4132, 63, 354, 63, 2307, 275, 5822, 2223, 480, 19700, 401, 298, 5949, 401, 359, 267, 1689, 344, 401, 1709, 14, 4378, 8, 3327, 63, 498, 29, 549, 1826, 267, 1689, 354, 401, 1709, 14, 2183, 8, 988, 63, 1267, 29, 1840, 12, 2973, 29, 549, 1826, 272, 4794, 272, 4132, 63, 354, 63, 5298, 836, 275, 5822, 2223, 480, 19700, 401, 298, 5949, 401, 359, 267, 1689, 344, 401, 1709, 14, 4378, 8, 3327, 63, 498, 29, 549, 1826, 267, 1689, 354, 401, 1709, 14, 2183, 8, 988, 63, 1267, 29, 5303, 1826, 272, 4794, 272, 4132, 63, 354, 63, 29401, 275, 5822, 2223, 480, 19700, 401, 298, 5949, 401, 359, 267, 1689, 344, 401, 1709, 14, 4378, 8, 3327, 63, 498, 29, 549, 1826, 267, 1689, 1247, 401, 1709, 14, 2183, 8, 988, 63, 1267, 29, 1840, 1826, 272, 4794, 272, 4132, 63, 354, 63, 885, 275, 5822, 2223, 480, 19700, 401, 298, 5949, 401, 359, 267, 1689, 344, 401, 1709, 14, 4378, 8, 3327, 63, 498, 29, 549, 1826, 267, 1689, 354, 401, 1709, 14, 2183, 8, 988, 63, 1267, 29, 1840, 12, 849, 534, 33, 983, 3835, 1090, 7984, 3855, 272, 4794, 272, 4132, 63, 354, 63, 23693, 461, 63, 17, 275, 5822, 2223, 480, 19700, 401, 298, 5949, 401, 359, 267, 1689, 344, 401, 1709, 14, 4378, 8, 3327, 63, 498, 29, 549, 1826, 267, 1689, 354, 401, 1709, 14, 2183, 8, 988, 63, 1267, 29, 1840, 12, 849, 29, 872, 8514, 461, 1692, 22606, 272, 4794, 272, 4132, 63, 354, 63, 23693, 461, 63, 18, 275, 5822, 2223, 480, 19700, 401, 298, 5949, 401, 359, 267, 1689, 344, 401, 1709, 14, 4378, 8, 3327, 63, 498, 29, 549, 1826, 267, 1689, 354, 401, 1709, 14, 2183, 8, 988, 63, 1267, 29, 1840, 12, 849, 29, 872, 8514, 461, 1692, 22606, 272, 4794, 272, 4132, 63, 354, 63, 23693, 461, 63, 19, 275, 5822, 2223, 480, 19700, 401, 298, 5949, 401, 359, 267, 1689, 344, 401, 1709, 14, 4378, 8, 3327, 63, 498, 29, 549, 1826, 267, 1689, 354, 401, 1709, 14, 2183, 8, 988, 63, 1267, 29, 1840, 12, 849, 29, 992, 14, 3901, 22606, 272, 4794, 272, 4132, 63, 354, 63, 23693, 461, 63, 20, 275, 5822, 2223, 480, 19700, 401, 298, 5949, 401, 359, 267, 1689, 344, 401, 1709, 14, 4378, 8, 3327, 63, 498, 29, 549, 1826, 267, 1689, 354, 401, 1709, 14, 2183, 8, 988, 63, 1267, 29, 1840, 12, 849, 29, 992, 14, 3901, 22606, 272, 4794, 272, 4132, 63, 354, 63, 23693, 461, 63, 513, 63, 17, 275, 5822, 2223, 480, 19700, 401, 298, 5949, 401, 359, 267, 1689, 344, 401, 1709, 14, 4378, 8, 3327, 63, 498, 29, 549, 1826, 267, 1689, 354, 401, 1709, 14, 2183, 8, 988, 63, 1267, 29, 1840, 12, 849, 1524, 872, 8514, 461, 1692, 1062, 11869, 12884, 272, 4794, 272, 4132, 63, 354, 63, 23693, 461, 63, 513, 63, 18, 275, 5822, 2223, 480, 19700, 401, 298, 5949, 401, 359, 267, 1689, 344, 401, 1709, 14, 4378, 8, 3327, 63, 498, 29, 549, 1826, 267, 1689, 354, 401, 1709, 14, 2183, 8, 988, 63, 1267, 29, 1840, 12, 849, 1524, 872, 8514, 461, 1692, 1062, 11869, 12884, 272, 4794, 272, 4132, 63, 354, 63, 23693, 461, 63, 513, 63, 19, 275, 5822, 2223, 480, 19700, 401, 298, 5949, 401, 359, 267, 1689, 344, 401, 1709, 14, 4378, 8, 3327, 63, 498, 29, 549, 1826, 267, 1689, 354, 401, 1709, 14, 2183, 8, 988, 63, 1267, 29, 1840, 12, 849, 1524, 872, 8514, 461, 1692, 1062, 22291, 12884, 272, 4794, 272, 4132, 63, 354, 63, 23693, 461, 63, 2960, 63, 17, 275, 5822, 2223, 480, 19700, 401, 298, 5949, 401, 359, 267, 1689, 344, 401, 1709, 14, 4378, 8, 3327, 63, 498, 29, 549, 1826, 267, 1689, 354, 401, 1709, 14, 2183, 8, 988, 63, 1267, 29, 1840, 12, 849, 2687, 872, 8514, 461, 1692, 1062, 11869, 11508, 272, 4794, 272, 4132, 63, 354, 63, 23693, 461, 63, 2960, 63, 18, 275, 5822, 2223, 480, 19700, 401, 298, 5949, 401, 359, 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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1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
djo938/supershell
pyshell/system/manager/environment.py
3
1148
#!/usr/bin/env python -t # -*- coding: utf-8 -*- # Copyright (C) 2017 Jonathan Delvaux <[email protected]> # 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/>. from pyshell.system.manager.abstract import AbstractParameterManager from pyshell.system.parameter.environment import EnvironmentParameter from pyshell.utils.constants import ENVIRONMENT_ATTRIBUTE_NAME class EnvironmentParameterManager(AbstractParameterManager): @staticmethod def getLoaderName(): return ENVIRONMENT_ATTRIBUTE_NAME def getAllowedType(self): return EnvironmentParameter
gpl-3.0
[ 3381, 2647, 15, 1393, 15, 1813, 2366, 446, 84, 199, 3, 1882, 2803, 26, 2774, 13, 24, 1882, 199, 199, 3, 1898, 334, 35, 9, 9708, 221, 1603, 265, 1619, 290, 18464, 3042, 2521, 665, 15983, 72, 1697, 32, 18256, 13798, 14, 846, 30, 199, 199, 3, 961, 2240, 365, 2867, 2032, 26, 1265, 883, 3604, 652, 436, 15, 269, 2811, 199, 3, 652, 1334, 314, 2895, 402, 314, 1664, 1696, 1684, 844, 465, 3267, 701, 199, 3, 314, 2868, 2290, 2752, 12, 1902, 1015, 650, 402, 314, 844, 12, 503, 199, 3, 1263, 2945, 1015, 14, 199, 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, 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, 199, 504, 10382, 72, 1697, 14, 2253, 14, 2609, 14, 6198, 492, 11836, 4720, 2988, 199, 504, 10382, 72, 1697, 14, 2253, 14, 5329, 14, 5418, 492, 9711, 4720, 199, 504, 10382, 72, 1697, 14, 1208, 14, 5559, 492, 5070, 13679, 615, 4479, 63, 17075, 63, 2339, 421, 199, 533, 9711, 4720, 2988, 8, 8458, 4720, 2988, 304, 272, 768, 4639, 272, 347, 664, 5455, 985, 837, 267, 372, 5070, 13679, 615, 4479, 63, 17075, 63, 2339, 339, 347, 664, 16070, 804, 8, 277, 304, 267, 372, 9711, 4720, 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 ]
[ 2647, 15, 1393, 15, 1813, 2366, 446, 84, 199, 3, 1882, 2803, 26, 2774, 13, 24, 1882, 199, 199, 3, 1898, 334, 35, 9, 9708, 221, 1603, 265, 1619, 290, 18464, 3042, 2521, 665, 15983, 72, 1697, 32, 18256, 13798, 14, 846, 30, 199, 199, 3, 961, 2240, 365, 2867, 2032, 26, 1265, 883, 3604, 652, 436, 15, 269, 2811, 199, 3, 652, 1334, 314, 2895, 402, 314, 1664, 1696, 1684, 844, 465, 3267, 701, 199, 3, 314, 2868, 2290, 2752, 12, 1902, 1015, 650, 402, 314, 844, 12, 503, 199, 3, 1263, 2945, 1015, 14, 199, 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, 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, 199, 504, 10382, 72, 1697, 14, 2253, 14, 2609, 14, 6198, 492, 11836, 4720, 2988, 199, 504, 10382, 72, 1697, 14, 2253, 14, 5329, 14, 5418, 492, 9711, 4720, 199, 504, 10382, 72, 1697, 14, 1208, 14, 5559, 492, 5070, 13679, 615, 4479, 63, 17075, 63, 2339, 421, 199, 533, 9711, 4720, 2988, 8, 8458, 4720, 2988, 304, 272, 768, 4639, 272, 347, 664, 5455, 985, 837, 267, 372, 5070, 13679, 615, 4479, 63, 17075, 63, 2339, 339, 347, 664, 16070, 804, 8, 277, 304, 267, 372, 9711, 4720, 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, 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,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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 ]
stackimpact/stackimpact-python
tests/message_queue_test.py
1
1716
import unittest import sys import json import stackimpact from stackimpact.utils import timestamp from test_server import TestServer class MessageQueueTest(unittest.TestCase): def test_flush(self): server = TestServer(5005) server.start() stackimpact._agent = None agent = stackimpact.start( dashboard_address = 'http://localhost:5005', agent_key = 'key1', app_name = 'TestPythonApp', debug = True ) m = { 'm1': 1 } agent.message_queue.add('t1', m) m = { 'm2': 2 } agent.message_queue.add('t1', m) agent.message_queue.queue[0]['added_at'] = timestamp() - 20 * 60 agent.message_queue.flush() data = json.loads(server.get_request_data()) self.assertEqual(data['payload']['messages'][0]['content']['m2'], 2) agent.destroy() server.join() def test_flush_fail(self): server = TestServer(5006) server.set_response_data("unparsablejson") server.start() stackimpact._agent = None agent = stackimpact.start( dashboard_address = 'http://localhost:5006', agent_key = 'key1', app_name = 'TestPythonApp', debug = True ) m = { 'm1': 1 } agent.message_queue.add('t1', m) m = { 'm2': 2 } agent.message_queue.add('t1', m) agent.message_queue.flush() self.assertEqual(len(agent.message_queue.queue), 2) agent.destroy() server.join() if __name__ == '__main__': unittest.main()
bsd-3-clause
[ 646, 2882, 199, 646, 984, 199, 646, 2022, 199, 199, 646, 3464, 31822, 199, 504, 3464, 31822, 14, 1208, 492, 4913, 199, 199, 504, 511, 63, 1000, 492, 1379, 3120, 4388, 199, 533, 6430, 3737, 774, 8, 2796, 14, 1746, 304, 2378, 347, 511, 63, 4939, 8, 277, 304, 267, 1654, 275, 1379, 3120, 8, 5783, 21, 9, 267, 1654, 14, 928, 342, 398, 3464, 31822, 423, 4054, 275, 488, 267, 6631, 275, 3464, 31822, 14, 928, 8, 288, 17216, 63, 1562, 275, 283, 1014, 921, 5967, 26, 5783, 21, 297, 288, 6631, 63, 498, 275, 283, 498, 17, 297, 288, 1145, 63, 354, 275, 283, 774, 4718, 2640, 297, 288, 3105, 275, 715, 267, 776, 398, 333, 275, 469, 288, 283, 77, 17, 356, 413, 267, 789, 267, 6631, 14, 1188, 63, 1825, 14, 525, 360, 84, 17, 297, 333, 9, 398, 333, 275, 469, 288, 283, 77, 18, 356, 499, 267, 789, 18418, 6631, 14, 1188, 63, 1825, 14, 525, 360, 84, 17, 297, 333, 9, 398, 6631, 14, 1188, 63, 1825, 14, 1825, 59, 16, 2733, 3270, 63, 292, 418, 275, 4913, 342, 446, 3388, 627, 5212, 398, 6631, 14, 1188, 63, 1825, 14, 4939, 342, 398, 666, 275, 2022, 14, 3640, 8, 1000, 14, 362, 63, 1069, 63, 576, 1012, 267, 291, 14, 629, 8, 576, 459, 4749, 2545, 3431, 3488, 16, 2733, 1317, 2545, 77, 18, 995, 499, 9, 398, 6631, 14, 7237, 342, 267, 1654, 14, 904, 342, 2378, 347, 511, 63, 4939, 63, 1633, 8, 277, 304, 267, 1654, 275, 1379, 3120, 8, 5783, 22, 9, 267, 1654, 14, 409, 63, 1310, 63, 576, 480, 324, 21152, 461, 1001, 531, 267, 1654, 14, 928, 342, 398, 3464, 31822, 423, 4054, 275, 488, 267, 6631, 275, 3464, 31822, 14, 928, 8, 288, 17216, 63, 1562, 275, 283, 1014, 921, 5967, 26, 5783, 22, 297, 288, 6631, 63, 498, 275, 283, 498, 17, 297, 288, 1145, 63, 354, 275, 283, 774, 4718, 2640, 297, 288, 3105, 275, 715, 267, 776, 398, 333, 275, 469, 288, 283, 77, 17, 356, 413, 267, 789, 267, 6631, 14, 1188, 63, 1825, 14, 525, 360, 84, 17, 297, 333, 9, 398, 333, 275, 469, 288, 283, 77, 18, 356, 499, 267, 789, 18418, 6631, 14, 1188, 63, 1825, 14, 525, 360, 84, 17, 297, 333, 9, 398, 6631, 14, 1188, 63, 1825, 14, 4939, 342, 267, 291, 14, 629, 8, 552, 8, 4054, 14, 1188, 63, 1825, 14, 1825, 395, 499, 9, 398, 6631, 14, 7237, 342, 267, 1654, 14, 904, 342, 199, 199, 692, 636, 354, 363, 508, 2560, 973, 3706, 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, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768 ]
[ 2882, 199, 646, 984, 199, 646, 2022, 199, 199, 646, 3464, 31822, 199, 504, 3464, 31822, 14, 1208, 492, 4913, 199, 199, 504, 511, 63, 1000, 492, 1379, 3120, 4388, 199, 533, 6430, 3737, 774, 8, 2796, 14, 1746, 304, 2378, 347, 511, 63, 4939, 8, 277, 304, 267, 1654, 275, 1379, 3120, 8, 5783, 21, 9, 267, 1654, 14, 928, 342, 398, 3464, 31822, 423, 4054, 275, 488, 267, 6631, 275, 3464, 31822, 14, 928, 8, 288, 17216, 63, 1562, 275, 283, 1014, 921, 5967, 26, 5783, 21, 297, 288, 6631, 63, 498, 275, 283, 498, 17, 297, 288, 1145, 63, 354, 275, 283, 774, 4718, 2640, 297, 288, 3105, 275, 715, 267, 776, 398, 333, 275, 469, 288, 283, 77, 17, 356, 413, 267, 789, 267, 6631, 14, 1188, 63, 1825, 14, 525, 360, 84, 17, 297, 333, 9, 398, 333, 275, 469, 288, 283, 77, 18, 356, 499, 267, 789, 18418, 6631, 14, 1188, 63, 1825, 14, 525, 360, 84, 17, 297, 333, 9, 398, 6631, 14, 1188, 63, 1825, 14, 1825, 59, 16, 2733, 3270, 63, 292, 418, 275, 4913, 342, 446, 3388, 627, 5212, 398, 6631, 14, 1188, 63, 1825, 14, 4939, 342, 398, 666, 275, 2022, 14, 3640, 8, 1000, 14, 362, 63, 1069, 63, 576, 1012, 267, 291, 14, 629, 8, 576, 459, 4749, 2545, 3431, 3488, 16, 2733, 1317, 2545, 77, 18, 995, 499, 9, 398, 6631, 14, 7237, 342, 267, 1654, 14, 904, 342, 2378, 347, 511, 63, 4939, 63, 1633, 8, 277, 304, 267, 1654, 275, 1379, 3120, 8, 5783, 22, 9, 267, 1654, 14, 409, 63, 1310, 63, 576, 480, 324, 21152, 461, 1001, 531, 267, 1654, 14, 928, 342, 398, 3464, 31822, 423, 4054, 275, 488, 267, 6631, 275, 3464, 31822, 14, 928, 8, 288, 17216, 63, 1562, 275, 283, 1014, 921, 5967, 26, 5783, 22, 297, 288, 6631, 63, 498, 275, 283, 498, 17, 297, 288, 1145, 63, 354, 275, 283, 774, 4718, 2640, 297, 288, 3105, 275, 715, 267, 776, 398, 333, 275, 469, 288, 283, 77, 17, 356, 413, 267, 789, 267, 6631, 14, 1188, 63, 1825, 14, 525, 360, 84, 17, 297, 333, 9, 398, 333, 275, 469, 288, 283, 77, 18, 356, 499, 267, 789, 18418, 6631, 14, 1188, 63, 1825, 14, 525, 360, 84, 17, 297, 333, 9, 398, 6631, 14, 1188, 63, 1825, 14, 4939, 342, 267, 291, 14, 629, 8, 552, 8, 4054, 14, 1188, 63, 1825, 14, 1825, 395, 499, 9, 398, 6631, 14, 7237, 342, 267, 1654, 14, 904, 342, 199, 199, 692, 636, 354, 363, 508, 2560, 973, 3706, 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, 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, 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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 ]
mia1rab/OpenColorado-Tools-and-Utilities
Scripts/Harvest/Drcog/bs4/__init__.py
4
12867
"""Beautiful Soup Elixir and Tonic "The Screen-Scraper's Friend" http://www.crummy.com/software/BeautifulSoup/ Beautiful Soup uses a pluggable XML or HTML parser to parse a (possibly invalid) document into a tree representation. Beautiful Soup provides provides methods and Pythonic idioms that make it easy to navigate, search, and modify the parse tree. Beautiful Soup works with Python 2.6 and up. It works better if lxml and/or html5lib is installed. For more than you ever wanted to know about Beautiful Soup, see the documentation: http://www.crummy.com/software/BeautifulSoup/bs4/doc/ """ __author__ = "Leonard Richardson ([email protected])" __version__ = "4.1.1" __copyright__ = "Copyright (c) 2004-2012 Leonard Richardson" __license__ = "MIT" __all__ = ['BeautifulSoup'] import re import warnings from .builder import builder_registry from .dammit import UnicodeDammit from .element import ( CData, Comment, DEFAULT_OUTPUT_ENCODING, Declaration, Doctype, NavigableString, PageElement, ProcessingInstruction, ResultSet, SoupStrainer, Tag, ) # The very first thing we do is give a useful error if someone is # running this code under Python 3 without converting it. syntax_error = u'You are trying to run the Python 2 version of Beautiful Soup under Python 3. This will not work. You need to convert the code, either by installing it (`python setup.py install`) or by running 2to3 (`2to3 -w bs4`).' class BeautifulSoup(Tag): """ This class defines the basic interface called by the tree builders. These methods will be called by the parser: reset() feed(markup) The tree builder may call these methods from its feed() implementation: handle_starttag(name, attrs) # See note about return value handle_endtag(name) handle_data(data) # Appends to the current data node endData(containerClass=NavigableString) # Ends the current data node No matter how complicated the underlying parser is, you should be able to build a tree using 'start tag' events, 'end tag' events, 'data' events, and "done with data" events. If you encounter an empty-element tag (aka a self-closing tag, like HTML's <br> tag), call handle_starttag and then handle_endtag. """ ROOT_TAG_NAME = u'[document]' # If the end-user gives no indication which tree builder they # want, look for one with these features. DEFAULT_BUILDER_FEATURES = ['html', 'fast'] # Used when determining whether a text node is all whitespace and # can be replaced with a single space. A text node that contains # fancy Unicode spaces (usually non-breaking) should be left # alone. STRIP_ASCII_SPACES = {9: None, 10: None, 12: None, 13: None, 32: None, } def __init__(self, markup="", features=None, builder=None, parse_only=None, from_encoding=None, **kwargs): """The Soup object is initialized as the 'root tag', and the provided markup (which can be a string or a file-like object) is fed into the underlying parser.""" if 'convertEntities' in kwargs: warnings.warn( "BS4 does not respect the convertEntities argument to the " "BeautifulSoup constructor. Entities are always converted " "to Unicode characters.") if 'markupMassage' in kwargs: del kwargs['markupMassage'] warnings.warn( "BS4 does not respect the markupMassage argument to the " "BeautifulSoup constructor. The tree builder is responsible " "for any necessary markup massage.") if 'smartQuotesTo' in kwargs: del kwargs['smartQuotesTo'] warnings.warn( "BS4 does not respect the smartQuotesTo argument to the " "BeautifulSoup constructor. Smart quotes are always converted " "to Unicode characters.") if 'selfClosingTags' in kwargs: del kwargs['selfClosingTags'] warnings.warn( "BS4 does not respect the selfClosingTags argument to the " "BeautifulSoup constructor. The tree builder is responsible " "for understanding self-closing tags.") if 'isHTML' in kwargs: del kwargs['isHTML'] warnings.warn( "BS4 does not respect the isHTML argument to the " "BeautifulSoup constructor. You can pass in features='html' " "or features='xml' to get a builder capable of handling " "one or the other.") def deprecated_argument(old_name, new_name): if old_name in kwargs: warnings.warn( 'The "%s" argument to the BeautifulSoup constructor ' 'has been renamed to "%s."' % (old_name, new_name)) value = kwargs[old_name] del kwargs[old_name] return value return None parse_only = parse_only or deprecated_argument( "parseOnlyThese", "parse_only") from_encoding = from_encoding or deprecated_argument( "fromEncoding", "from_encoding") if len(kwargs) > 0: arg = kwargs.keys().pop() raise TypeError( "__init__() got an unexpected keyword argument '%s'" % arg) if builder is None: if isinstance(features, basestring): features = [features] if features is None or len(features) == 0: features = self.DEFAULT_BUILDER_FEATURES builder_class = builder_registry.lookup(*features) if builder_class is None: raise ValueError( "Couldn't find a tree builder with the features you " "requested: %s. Do you need to install a parser library?" % ",".join(features)) builder = builder_class() self.builder = builder self.is_xml = builder.is_xml self.builder.soup = self self.parse_only = parse_only self.reset() if hasattr(markup, 'read'): # It's a file-type object. markup = markup.read() (self.markup, self.original_encoding, self.declared_html_encoding, self.contains_replacement_characters) = ( self.builder.prepare_markup(markup, from_encoding)) try: self._feed() except StopParsing: pass # Clear out the markup and remove the builder's circular # reference to this object. self.markup = None self.builder.soup = None def _feed(self): # Convert the document to Unicode. self.builder.reset() self.builder.feed(self.markup) # Close out any unfinished strings and close all the open tags. self.endData() while self.currentTag.name != self.ROOT_TAG_NAME: self.popTag() def reset(self): Tag.__init__(self, self, self.builder, self.ROOT_TAG_NAME) self.hidden = 1 self.builder.reset() self.currentData = [] self.currentTag = None self.tagStack = [] self.pushTag(self) def new_tag(self, name, namespace=None, nsprefix=None, **attrs): """Create a new tag associated with this soup.""" return Tag(None, self.builder, name, namespace, nsprefix, attrs) def new_string(self, s): """Create a new NavigableString associated with this soup.""" navigable = NavigableString(s) navigable.setup() return navigable def insert_before(self, successor): raise ValueError("BeautifulSoup objects don't support insert_before().") def insert_after(self, successor): raise ValueError("BeautifulSoup objects don't support insert_after().") def popTag(self): tag = self.tagStack.pop() #print "Pop", tag.name if self.tagStack: self.currentTag = self.tagStack[-1] return self.currentTag def pushTag(self, tag): #print "Push", tag.name if self.currentTag: self.currentTag.contents.append(tag) self.tagStack.append(tag) self.currentTag = self.tagStack[-1] def endData(self, containerClass=NavigableString): if self.currentData: currentData = u''.join(self.currentData) if (currentData.translate(self.STRIP_ASCII_SPACES) == '' and not set([tag.name for tag in self.tagStack]).intersection( self.builder.preserve_whitespace_tags)): if '\n' in currentData: currentData = '\n' else: currentData = ' ' self.currentData = [] if self.parse_only and len(self.tagStack) <= 1 and \ (not self.parse_only.text or \ not self.parse_only.search(currentData)): return o = containerClass(currentData) self.object_was_parsed(o) def object_was_parsed(self, o): """Add an object to the parse tree.""" o.setup(self.currentTag, self.previous_element) if self.previous_element: self.previous_element.next_element = o self.previous_element = o self.currentTag.contents.append(o) def _popToTag(self, name, nsprefix=None, inclusivePop=True): """Pops the tag stack up to and including the most recent instance of the given tag. If inclusivePop is false, pops the tag stack up to but *not* including the most recent instqance of the given tag.""" #print "Popping to %s" % name if name == self.ROOT_TAG_NAME: return numPops = 0 mostRecentTag = None for i in range(len(self.tagStack) - 1, 0, -1): if (name == self.tagStack[i].name and nsprefix == self.tagStack[i].prefix): numPops = len(self.tagStack) - i break if not inclusivePop: numPops = numPops - 1 for i in range(0, numPops): mostRecentTag = self.popTag() return mostRecentTag def handle_starttag(self, name, namespace, nsprefix, attrs): """Push a start tag on to the stack. If this method returns None, the tag was rejected by the SoupStrainer. You should proceed as if the tag had not occured in the document. For instance, if this was a self-closing tag, don't call handle_endtag. """ # print "Start tag %s: %s" % (name, attrs) self.endData() if (self.parse_only and len(self.tagStack) <= 1 and (self.parse_only.text or not self.parse_only.search_tag(name, attrs))): return None tag = Tag(self, self.builder, name, namespace, nsprefix, attrs, self.currentTag, self.previous_element) if tag is None: return tag if self.previous_element: self.previous_element.next_element = tag self.previous_element = tag self.pushTag(tag) return tag def handle_endtag(self, name, nsprefix=None): #print "End tag: " + name self.endData() self._popToTag(name, nsprefix) def handle_data(self, data): self.currentData.append(data) def decode(self, pretty_print=False, eventual_encoding=DEFAULT_OUTPUT_ENCODING, formatter="minimal"): """Returns a string or Unicode representation of this document. To get Unicode, pass None for encoding.""" if self.is_xml: # Print the XML declaration encoding_part = '' if eventual_encoding != None: encoding_part = ' encoding="%s"' % eventual_encoding prefix = u'<?xml version="1.0"%s?>\n' % encoding_part else: prefix = u'' if not pretty_print: indent_level = None else: indent_level = 0 return prefix + super(BeautifulSoup, self).decode( indent_level, eventual_encoding, formatter) class BeautifulStoneSoup(BeautifulSoup): """Deprecated interface to an XML parser.""" def __init__(self, *args, **kwargs): kwargs['features'] = 'xml' warnings.warn( 'The BeautifulStoneSoup class is deprecated. Instead of using ' 'it, pass features="xml" into the BeautifulSoup constructor.') super(BeautifulStoneSoup, self).__init__(*args, **kwargs) class StopParsing(Exception): pass #By default, act as an HTML pretty-printer. if __name__ == '__main__': import sys soup = BeautifulSoup(sys.stdin) print soup.prettify()
apache-2.0
[ 624, 30117, 28028, 199, 37, 20528, 723, 436, 377, 12732, 199, 2, 1918, 17804, 13, 7181, 345, 529, 1159, 481, 8528, 2, 199, 1014, 921, 1544, 14, 1556, 3323, 14, 957, 15, 15619, 15, 30117, 12341, 15, 199, 199, 30117, 28028, 4440, 282, 14202, 16725, 4692, 503, 4163, 1798, 370, 2198, 282, 199, 8, 19614, 3866, 9, 2213, 1901, 282, 3123, 6025, 14, 14562, 28028, 199, 20121, 6571, 3102, 436, 2018, 530, 284, 328, 22491, 626, 1852, 652, 8837, 370, 199, 15595, 3237, 12, 2754, 12, 436, 2811, 314, 2198, 3123, 14, 199, 199, 30117, 28028, 5419, 543, 2018, 499, 14, 22, 436, 1536, 14, 2779, 5419, 8034, 340, 14490, 199, 460, 15, 269, 3517, 21, 773, 365, 4903, 14, 199, 199, 1858, 1655, 2419, 1265, 14433, 13632, 370, 5715, 3595, 14562, 28028, 12, 1937, 314, 199, 9970, 26, 199, 1014, 921, 1544, 14, 1556, 3323, 14, 957, 15, 15619, 15, 30117, 12341, 15, 1533, 20, 15, 1301, 15, 199, 624, 199, 199, 363, 2502, 363, 275, 298, 2553, 265, 1005, 30846, 5596, 265, 334, 274, 265, 1005, 82, 32, 8359, 1879, 14, 1308, 2924, 199, 363, 1023, 363, 275, 298, 20, 14, 17, 14, 17, 2, 199, 363, 7307, 363, 275, 298, 7384, 334, 67, 9, 8353, 13, 7409, 7005, 265, 1005, 30846, 5596, 265, 2, 199, 363, 1682, 363, 275, 298, 13965, 2, 199, 199, 363, 452, 363, 275, 788, 30117, 12341, 418, 199, 199, 646, 295, 199, 646, 3598, 199, 199, 504, 1275, 5649, 492, 6545, 63, 5189, 199, 504, 1275, 68, 28980, 492, 6140, 36, 28980, 199, 504, 1275, 2108, 492, 334, 272, 445, 1451, 12, 272, 6819, 12, 272, 6186, 63, 8414, 63, 16314, 12, 272, 1487, 7456, 12, 272, 4226, 3667, 12, 272, 20721, 16725, 1558, 12, 272, 10331, 2162, 12, 272, 20157, 17700, 12, 272, 30751, 12, 272, 28028, 933, 6322, 281, 12, 272, 8053, 12, 272, 776, 199, 199, 3, 710, 7437, 1642, 8377, 781, 886, 365, 8120, 282, 2997, 1125, 340, 17122, 365, 199, 3, 3879, 642, 1233, 1334, 2018, 650, 1928, 13806, 652, 14, 199, 7093, 63, 705, 275, 399, 7, 5556, 787, 9936, 370, 1255, 314, 2018, 499, 1015, 402, 14562, 28028, 1334, 2018, 650, 14, 961, 911, 440, 1736, 14, 2047, 1929, 370, 3957, 314, 1233, 12, 1902, 701, 22200, 652, 13493, 1548, 3272, 14, 647, 3907, 10522, 503, 701, 3879, 499, 475, 19, 13493, 18, 475, 19, 446, 87, 9922, 20, 14963, 7, 199, 199, 533, 17132, 8, 1931, 304, 272, 408, 272, 961, 1021, 7890, 314, 5678, 3217, 2797, 701, 314, 3123, 27378, 14, 339, 5723, 3102, 911, 506, 2797, 701, 314, 1798, 26, 489, 5305, 342, 489, 4733, 8, 10131, 9, 339, 710, 3123, 6545, 1443, 1240, 3520, 3102, 687, 2399, 4733, 342, 4514, 26, 489, 2429, 63, 15234, 8, 354, 12, 3290, 9, 327, 1666, 5317, 3595, 372, 574, 489, 2429, 63, 25765, 8, 354, 9, 489, 2429, 63, 576, 8, 576, 9, 327, 4693, 3198, 370, 314, 1453, 666, 1031, 489, 1284, 1451, 8, 3600, 2543, 29, 19617, 16725, 1558, 9, 327, 3447, 795, 314, 1453, 666, 1031, 339, 3091, 17247, 4212, 23515, 314, 8793, 1798, 365, 12, 1265, 1077, 506, 272, 7688, 370, 1900, 282, 3123, 1808, 283, 928, 1947, 7, 4474, 12, 283, 500, 1947, 7, 4474, 12, 272, 283, 576, 7, 4474, 12, 436, 298, 4456, 543, 666, 2, 4474, 14, 339, 982, 1265, 655, 5337, 376, 2701, 13, 2108, 1947, 334, 24685, 282, 291, 13, 11707, 1947, 12, 272, 2839, 4163, 1159, 665, 3289, 30, 1947, 395, 1240, 2429, 63, 15234, 436, 2066, 272, 2429, 63, 25765, 14, 272, 408, 272, 16547, 63, 6967, 63, 2339, 275, 399, 3894, 3554, 6616, 339, 327, 982, 314, 1284, 13, 751, 10557, 949, 2539, 1063, 1314, 3123, 6545, 2985, 272, 327, 2934, 12, 3648, 367, 1373, 543, 3520, 4534, 14, 272, 6186, 63, 8248, 540, 63, 13313, 275, 788, 1360, 297, 283, 7015, 418, 339, 327, 8051, 1380, 26638, 3775, 282, 1318, 1031, 365, 1006, 8139, 436, 272, 327, 883, 506, 8717, 543, 282, 2849, 4601, 14, 437, 1318, 1031, 626, 3509, 272, 327, 27571, 6140, 7883, 334, 25118, 2222, 13, 4785, 316, 9, 1077, 506, 3602, 272, 327, 23016, 14, 272, 7553, 1772, 63, 12292, 63, 5763, 21287, 275, 469, 25, 26, 488, 12, 1616, 26, 488, 12, 3144, 26, 488, 12, 4944, 26, 488, 12, 4337, 26, 488, 12, 789, 339, 347, 636, 826, 721, 277, 12, 9189, 8772, 4534, 29, 403, 12, 6545, 29, 403, 12, 326, 2198, 63, 2118, 29, 403, 12, 687, 63, 2991, 29, 403, 12, 1011, 958, 304, 267, 408, 1918, 28028, 909, 365, 10038, 465, 314, 283, 1231, 1947, 297, 436, 314, 267, 2741, 9189, 334, 6777, 883, 506, 282, 1059, 503, 282, 570, 13, 2930, 909, 9, 267, 365, 23036, 1901, 314, 8793, 1798, 1041, 398, 340, 283, 3916, 24672, 7, 315, 2074, 26, 288, 3598, 14, 4050, 8, 355, 298, 11087, 20, 1630, 440, 14021, 314, 3957, 24672, 1423, 370, 314, 298, 355, 298, 30117, 12341, 3787, 14, 3447, 5080, 787, 3544, 6702, 298, 355, 298, 475, 6140, 4110, 2685, 398, 340, 283, 10131, 27218, 474, 7, 315, 2074, 26, 288, 2150, 2074, 459, 10131, 27218, 474, 418, 288, 3598, 14, 4050, 8, 355, 298, 11087, 20, 1630, 440, 14021, 314, 9189, 27218, 474, 1423, 370, 314, 298, 355, 298, 30117, 12341, 3787, 14, 710, 3123, 6545, 365, 17845, 298, 355, 298, 509, 1263, 5784, 9189, 12250, 474, 2685, 398, 340, 283, 7853, 2371, 6510, 1378, 7, 315, 2074, 26, 288, 2150, 2074, 459, 7853, 2371, 6510, 1378, 418, 288, 3598, 14, 4050, 8, 355, 298, 11087, 20, 1630, 440, 14021, 314, 11179, 2371, 6510, 1378, 1423, 370, 314, 298, 355, 298, 30117, 12341, 3787, 14, 26017, 9344, 787, 3544, 6702, 298, 355, 298, 475, 6140, 4110, 2685, 398, 340, 283, 26770, 9440, 7, 315, 2074, 26, 288, 2150, 2074, 459, 26770, 9440, 418, 288, 3598, 14, 4050, 8, 355, 298, 11087, 20, 1630, 440, 14021, 314, 291, 18433, 9440, 1423, 370, 314, 298, 355, 298, 30117, 12341, 3787, 14, 710, 3123, 6545, 365, 17845, 298, 355, 298, 509, 1334, 18126, 291, 13, 11707, 3762, 2685 ]
[ 30117, 28028, 199, 37, 20528, 723, 436, 377, 12732, 199, 2, 1918, 17804, 13, 7181, 345, 529, 1159, 481, 8528, 2, 199, 1014, 921, 1544, 14, 1556, 3323, 14, 957, 15, 15619, 15, 30117, 12341, 15, 199, 199, 30117, 28028, 4440, 282, 14202, 16725, 4692, 503, 4163, 1798, 370, 2198, 282, 199, 8, 19614, 3866, 9, 2213, 1901, 282, 3123, 6025, 14, 14562, 28028, 199, 20121, 6571, 3102, 436, 2018, 530, 284, 328, 22491, 626, 1852, 652, 8837, 370, 199, 15595, 3237, 12, 2754, 12, 436, 2811, 314, 2198, 3123, 14, 199, 199, 30117, 28028, 5419, 543, 2018, 499, 14, 22, 436, 1536, 14, 2779, 5419, 8034, 340, 14490, 199, 460, 15, 269, 3517, 21, 773, 365, 4903, 14, 199, 199, 1858, 1655, 2419, 1265, 14433, 13632, 370, 5715, 3595, 14562, 28028, 12, 1937, 314, 199, 9970, 26, 199, 1014, 921, 1544, 14, 1556, 3323, 14, 957, 15, 15619, 15, 30117, 12341, 15, 1533, 20, 15, 1301, 15, 199, 624, 199, 199, 363, 2502, 363, 275, 298, 2553, 265, 1005, 30846, 5596, 265, 334, 274, 265, 1005, 82, 32, 8359, 1879, 14, 1308, 2924, 199, 363, 1023, 363, 275, 298, 20, 14, 17, 14, 17, 2, 199, 363, 7307, 363, 275, 298, 7384, 334, 67, 9, 8353, 13, 7409, 7005, 265, 1005, 30846, 5596, 265, 2, 199, 363, 1682, 363, 275, 298, 13965, 2, 199, 199, 363, 452, 363, 275, 788, 30117, 12341, 418, 199, 199, 646, 295, 199, 646, 3598, 199, 199, 504, 1275, 5649, 492, 6545, 63, 5189, 199, 504, 1275, 68, 28980, 492, 6140, 36, 28980, 199, 504, 1275, 2108, 492, 334, 272, 445, 1451, 12, 272, 6819, 12, 272, 6186, 63, 8414, 63, 16314, 12, 272, 1487, 7456, 12, 272, 4226, 3667, 12, 272, 20721, 16725, 1558, 12, 272, 10331, 2162, 12, 272, 20157, 17700, 12, 272, 30751, 12, 272, 28028, 933, 6322, 281, 12, 272, 8053, 12, 272, 776, 199, 199, 3, 710, 7437, 1642, 8377, 781, 886, 365, 8120, 282, 2997, 1125, 340, 17122, 365, 199, 3, 3879, 642, 1233, 1334, 2018, 650, 1928, 13806, 652, 14, 199, 7093, 63, 705, 275, 399, 7, 5556, 787, 9936, 370, 1255, 314, 2018, 499, 1015, 402, 14562, 28028, 1334, 2018, 650, 14, 961, 911, 440, 1736, 14, 2047, 1929, 370, 3957, 314, 1233, 12, 1902, 701, 22200, 652, 13493, 1548, 3272, 14, 647, 3907, 10522, 503, 701, 3879, 499, 475, 19, 13493, 18, 475, 19, 446, 87, 9922, 20, 14963, 7, 199, 199, 533, 17132, 8, 1931, 304, 272, 408, 272, 961, 1021, 7890, 314, 5678, 3217, 2797, 701, 314, 3123, 27378, 14, 339, 5723, 3102, 911, 506, 2797, 701, 314, 1798, 26, 489, 5305, 342, 489, 4733, 8, 10131, 9, 339, 710, 3123, 6545, 1443, 1240, 3520, 3102, 687, 2399, 4733, 342, 4514, 26, 489, 2429, 63, 15234, 8, 354, 12, 3290, 9, 327, 1666, 5317, 3595, 372, 574, 489, 2429, 63, 25765, 8, 354, 9, 489, 2429, 63, 576, 8, 576, 9, 327, 4693, 3198, 370, 314, 1453, 666, 1031, 489, 1284, 1451, 8, 3600, 2543, 29, 19617, 16725, 1558, 9, 327, 3447, 795, 314, 1453, 666, 1031, 339, 3091, 17247, 4212, 23515, 314, 8793, 1798, 365, 12, 1265, 1077, 506, 272, 7688, 370, 1900, 282, 3123, 1808, 283, 928, 1947, 7, 4474, 12, 283, 500, 1947, 7, 4474, 12, 272, 283, 576, 7, 4474, 12, 436, 298, 4456, 543, 666, 2, 4474, 14, 339, 982, 1265, 655, 5337, 376, 2701, 13, 2108, 1947, 334, 24685, 282, 291, 13, 11707, 1947, 12, 272, 2839, 4163, 1159, 665, 3289, 30, 1947, 395, 1240, 2429, 63, 15234, 436, 2066, 272, 2429, 63, 25765, 14, 272, 408, 272, 16547, 63, 6967, 63, 2339, 275, 399, 3894, 3554, 6616, 339, 327, 982, 314, 1284, 13, 751, 10557, 949, 2539, 1063, 1314, 3123, 6545, 2985, 272, 327, 2934, 12, 3648, 367, 1373, 543, 3520, 4534, 14, 272, 6186, 63, 8248, 540, 63, 13313, 275, 788, 1360, 297, 283, 7015, 418, 339, 327, 8051, 1380, 26638, 3775, 282, 1318, 1031, 365, 1006, 8139, 436, 272, 327, 883, 506, 8717, 543, 282, 2849, 4601, 14, 437, 1318, 1031, 626, 3509, 272, 327, 27571, 6140, 7883, 334, 25118, 2222, 13, 4785, 316, 9, 1077, 506, 3602, 272, 327, 23016, 14, 272, 7553, 1772, 63, 12292, 63, 5763, 21287, 275, 469, 25, 26, 488, 12, 1616, 26, 488, 12, 3144, 26, 488, 12, 4944, 26, 488, 12, 4337, 26, 488, 12, 789, 339, 347, 636, 826, 721, 277, 12, 9189, 8772, 4534, 29, 403, 12, 6545, 29, 403, 12, 326, 2198, 63, 2118, 29, 403, 12, 687, 63, 2991, 29, 403, 12, 1011, 958, 304, 267, 408, 1918, 28028, 909, 365, 10038, 465, 314, 283, 1231, 1947, 297, 436, 314, 267, 2741, 9189, 334, 6777, 883, 506, 282, 1059, 503, 282, 570, 13, 2930, 909, 9, 267, 365, 23036, 1901, 314, 8793, 1798, 1041, 398, 340, 283, 3916, 24672, 7, 315, 2074, 26, 288, 3598, 14, 4050, 8, 355, 298, 11087, 20, 1630, 440, 14021, 314, 3957, 24672, 1423, 370, 314, 298, 355, 298, 30117, 12341, 3787, 14, 3447, 5080, 787, 3544, 6702, 298, 355, 298, 475, 6140, 4110, 2685, 398, 340, 283, 10131, 27218, 474, 7, 315, 2074, 26, 288, 2150, 2074, 459, 10131, 27218, 474, 418, 288, 3598, 14, 4050, 8, 355, 298, 11087, 20, 1630, 440, 14021, 314, 9189, 27218, 474, 1423, 370, 314, 298, 355, 298, 30117, 12341, 3787, 14, 710, 3123, 6545, 365, 17845, 298, 355, 298, 509, 1263, 5784, 9189, 12250, 474, 2685, 398, 340, 283, 7853, 2371, 6510, 1378, 7, 315, 2074, 26, 288, 2150, 2074, 459, 7853, 2371, 6510, 1378, 418, 288, 3598, 14, 4050, 8, 355, 298, 11087, 20, 1630, 440, 14021, 314, 11179, 2371, 6510, 1378, 1423, 370, 314, 298, 355, 298, 30117, 12341, 3787, 14, 26017, 9344, 787, 3544, 6702, 298, 355, 298, 475, 6140, 4110, 2685, 398, 340, 283, 26770, 9440, 7, 315, 2074, 26, 288, 2150, 2074, 459, 26770, 9440, 418, 288, 3598, 14, 4050, 8, 355, 298, 11087, 20, 1630, 440, 14021, 314, 291, 18433, 9440, 1423, 370, 314, 298, 355, 298, 30117, 12341, 3787, 14, 710, 3123, 6545, 365, 17845, 298, 355, 298, 509, 1334, 18126, 291, 13, 11707, 3762, 2685, 0 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1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1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
Lekensteyn/buildbot
master/buildbot/steps/package/util.py
11
1235
# 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, version 2. # # 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., 51 # Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. # # Portions Copyright Buildbot Team Members # Portions Copyright Marius Rieder <[email protected]> from __future__ import absolute_import from __future__ import print_function from buildbot.process import logobserver class WEObserver(logobserver.LogLineObserver): def __init__(self): logobserver.LogLineObserver.__init__(self) self.warnings = [] self.errors = [] def outLineReceived(self, line): if line.startswith('W: '): self.warnings.append(line) elif line.startswith('E: '): self.errors.append(line)
gpl-2.0
[ 3, 961, 2240, 365, 2867, 2032, 27, 1265, 883, 199, 3, 3604, 652, 436, 15, 269, 2811, 652, 1334, 314, 2895, 402, 314, 1664, 1696, 1684, 199, 3, 844, 465, 3267, 701, 314, 2868, 2290, 2752, 12, 1015, 499, 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, 3092, 199, 3, 2381, 437, 3115, 3104, 14, 221, 1666, 314, 1664, 1696, 1684, 844, 367, 1655, 199, 3, 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, 8217, 14, 199, 3, 199, 3, 20825, 1898, 6516, 3018, 11682, 14409, 83, 199, 3, 20825, 1898, 603, 759, 527, 820, 1873, 424, 665, 77, 759, 527, 14, 11317, 424, 32, 30695, 335, 6415, 332, 14, 335, 30, 199, 199, 504, 636, 2443, 363, 492, 3679, 63, 646, 199, 504, 636, 2443, 363, 492, 870, 63, 1593, 199, 199, 504, 21306, 14, 1412, 492, 943, 23968, 421, 199, 533, 644, 37, 22715, 8, 793, 23968, 14, 2445, 3049, 22715, 304, 339, 347, 636, 826, 721, 277, 304, 267, 943, 23968, 14, 2445, 3049, 22715, 855, 826, 721, 277, 9, 267, 291, 14, 5451, 275, 942, 267, 291, 14, 2550, 275, 942, 339, 347, 734, 3049, 9392, 8, 277, 12, 1004, 304, 267, 340, 1004, 14, 2460, 360, 55, 26, 18927, 288, 291, 14, 5451, 14, 740, 8, 604, 9, 267, 916, 1004, 14, 2460, 360, 37, 26, 18927, 288, 291, 14, 2550, 14, 740, 8, 604, 9, 199, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768 ]
[ 961, 2240, 365, 2867, 2032, 27, 1265, 883, 199, 3, 3604, 652, 436, 15, 269, 2811, 652, 1334, 314, 2895, 402, 314, 1664, 1696, 1684, 199, 3, 844, 465, 3267, 701, 314, 2868, 2290, 2752, 12, 1015, 499, 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, 3092, 199, 3, 2381, 437, 3115, 3104, 14, 221, 1666, 314, 1664, 1696, 1684, 844, 367, 1655, 199, 3, 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, 8217, 14, 199, 3, 199, 3, 20825, 1898, 6516, 3018, 11682, 14409, 83, 199, 3, 20825, 1898, 603, 759, 527, 820, 1873, 424, 665, 77, 759, 527, 14, 11317, 424, 32, 30695, 335, 6415, 332, 14, 335, 30, 199, 199, 504, 636, 2443, 363, 492, 3679, 63, 646, 199, 504, 636, 2443, 363, 492, 870, 63, 1593, 199, 199, 504, 21306, 14, 1412, 492, 943, 23968, 421, 199, 533, 644, 37, 22715, 8, 793, 23968, 14, 2445, 3049, 22715, 304, 339, 347, 636, 826, 721, 277, 304, 267, 943, 23968, 14, 2445, 3049, 22715, 855, 826, 721, 277, 9, 267, 291, 14, 5451, 275, 942, 267, 291, 14, 2550, 275, 942, 339, 347, 734, 3049, 9392, 8, 277, 12, 1004, 304, 267, 340, 1004, 14, 2460, 360, 55, 26, 18927, 288, 291, 14, 5451, 14, 740, 8, 604, 9, 267, 916, 1004, 14, 2460, 360, 37, 26, 18927, 288, 291, 14, 2550, 14, 740, 8, 604, 9, 199, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 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,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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 ]
mpi-sws-rse/antevents-python
examples/event_library_comparison/event.py
1
8071
"""This version uses a traditional event-driven version, using continuation passing style. Each method call is passed a completion callback and an error callback """ from statistics import median import json import asyncio import random import time import hbmqtt.client from collections import deque from antevents.base import SensorEvent URL = "mqtt://localhost:1883" class RandomSensor: def __init__(self, sensor_id, mean=100.0, stddev=20.0, stop_after_events=None): self.sensor_id = sensor_id self.mean = mean self.stddev = stddev self.stop_after_events = stop_after_events if stop_after_events is not None: def generator(): for i in range(stop_after_events): yield round(random.gauss(mean, stddev), 1) else: # go on forever def generator(): while True: yield round(random.gauss(mean, stddev), 1) self.generator = generator() def sample(self): return self.generator.__next__() def __repr__(self): if self.stop_after_events is None: return 'RandomSensor(%s, mean=%s, stddev=%s)' % \ (self.sensor_id, self.mean, self.stddev) else: return 'RandomSensor(%s, mean=%s, stddev=%s, stop_after_events=%s)' % \ (self.sensor_id, self.mean, self.stddev, self.stop_after_events) class PeriodicMedianTransducer: """Emit an event once every ``period`` input events. The value is the median of the inputs received since the last emission. """ def __init__(self, period=5): self.period = period self.samples = [None for i in range(period)] self.events_since_last = 0 self.last_event = None # this is used in emitting the last event def step(self, v): self.samples[self.events_since_last] = v.val self.events_since_last += 1 if self.events_since_last==self.period: val = median(self.samples) event = SensorEvent(sensor_id=v.sensor_id, ts=v.ts, val=val) self.events_since_last = 0 return event else: self.last_event = v # save in case we complete before completing a period return None def complete(self): if self.events_since_last>0: # if we have some partial state, we emit one final event that # averages whatever we saw since the last emission. return SensorEvent(sensor_id=self.last_event.sensor_id, ts=self.last_event.ts, val=median(self.samples[0:self.events_since_last])) def csv_writer(evt): print("csv_writer(%s)" % repr(evt)) class MqttWriter: """All the processing is asynchronous. We ensure that a given send has completed and the callbacks called before we process the next one. """ def __init__(self, url, topic, event_loop): self.url = url self.topic = topic self.client = hbmqtt.client.MQTTClient(loop=event_loop) self.event_loop = event_loop self.connected = False self.pending_task = None self.request_queue = deque() def _to_message(self, msg): return bytes(json.dumps((msg.sensor_id, msg.ts, msg.val),), encoding='utf-8') def _request_done(self, f, completion_cb, error_cb): assert f==self.pending_task self.pending_task = None exc = f.exception() if exc: self.event_loop.call_soon(error_cb, exc) else: self.event_loop.call_soon(completion_cb) if len(self.request_queue)>0: self.event_loop.call_soon(self._process_queue) def _process_queue(self): assert self.pending_task == None assert len(self.request_queue)>0 (msg, completion_cb, error_cb) = self.request_queue.popleft() if msg is not None: print("send from queue: %s" % msg) self.pending_task = self.event_loop.create_task( self.client.publish(self.topic, msg) ) else: # None means that we wanted a disconnect print("disconnect") self.pending_task = self.event_loop.create_task( self.client.disconnect() ) self.pending_task.add_done_callback(lambda f: self._request_done(f, completion_cb, error_cb)) def send(self, msg, completion_cb, error_cb): if not self.connected: print("attempting connection") self.request_queue.append((self._to_message(msg), completion_cb, error_cb),) self.connected = True self.pending_task = self.event_loop.create_task(self.client.connect(self.url)) def connect_done(f): assert f==self.pending_task print("connected") self.pending_task = None self.event_loop.call_soon(self._process_queue) self.pending_task.add_done_callback(connect_done) elif self.pending_task: self.request_queue.append((self._to_message(msg), completion_cb, error_cb),) else: print("sending %s" % self._to_message(msg)) self.pending_task = self.event_loop.create_task( self.client.publish(self.topic, self._to_message(msg)) ) self.pending_task.add_done_callback(lambda f: self._request_done(f, completion_cb, error_cb)) def disconnect(self, completion_cb, error_cb, drop_queue=False): if not self.connected: return if len(self.request_queue)>0 and drop_queue: # for error situations self.request_queue = deque() if self.pending_task: self.request_queue.append((None, completion_cb, error_cb),) else: print("disconnecting") self.pending_task = self.event_loop.create_task( self.client.disconnect() ) self.pending_task.add_done_callback(lambda f: self._request_done(f, completion_cb, error_cb)) def sample_and_process(sensor, mqtt_writer, xducer, completion_cb, error_cb): try: sample = sensor.sample() except StopIteration: final_event = xducer.complete() if final_event: mqtt_writer.send(final_event, lambda: mqtt_writer.disconnect(lambda: completion_cb(False), error_cb), error_cb) else: mqtt_writer.disconnect(lambda: completion_cb(False), error_cb) return event = SensorEvent(sensor_id=sensor.sensor_id, ts=time.time(), val=sample) csv_writer(event) median_event = xducer.step(event) if median_event: mqtt_writer.send(median_event, lambda: completion_cb(True), error_cb) else: completion_cb(True) sensor = RandomSensor('sensor-2', stop_after_events=12) transducer = PeriodicMedianTransducer(5) event_loop = asyncio.get_event_loop() writer = MqttWriter(URL, sensor.sensor_id, event_loop) def loop(): def completion_cb(more): if more: event_loop.call_later(0.5, loop) else: print("all done, no more callbacks to schedule") event_loop.stop() def error_cb(e): print("Got error: %s" % e) event_loop.stop() event_loop.call_soon( lambda: sample_and_process(sensor, writer, transducer, completion_cb, error_cb) ) event_loop.call_soon(loop) event_loop.run_forever() print("that's all folks")
apache-2.0
[ 624, 2765, 1015, 4440, 282, 1468, 2603, 1566, 13, 17824, 1856, 1015, 12, 199, 4941, 16015, 9476, 3449, 14, 7048, 1083, 1240, 365, 3032, 199, 65, 13659, 3233, 436, 376, 1125, 3233, 199, 624, 199, 504, 11076, 492, 17312, 199, 646, 2022, 199, 646, 16195, 199, 646, 2196, 199, 646, 900, 199, 646, 394, 66, 19214, 14, 1258, 199, 504, 5055, 492, 15782, 199, 199, 504, 376, 266, 782, 83, 14, 1095, 492, 18474, 2390, 199, 199, 2632, 275, 298, 19214, 921, 5967, 26, 1085, 2658, 2, 199, 199, 533, 9571, 10160, 26, 272, 347, 636, 826, 721, 277, 12, 8778, 63, 344, 12, 4615, 29, 1960, 14, 16, 12, 28052, 29, 1165, 14, 16, 12, 3631, 63, 4399, 63, 4368, 29, 403, 304, 267, 291, 14, 8956, 63, 344, 275, 8778, 63, 344, 267, 291, 14, 3670, 275, 4615, 267, 291, 14, 21672, 275, 28052, 267, 291, 14, 2379, 63, 4399, 63, 4368, 275, 3631, 63, 4399, 63, 4368, 267, 340, 3631, 63, 4399, 63, 4368, 365, 440, 488, 26, 288, 347, 4306, 837, 355, 367, 284, 315, 1425, 8, 2379, 63, 4399, 63, 4368, 304, 490, 1995, 6168, 8, 2355, 14, 25898, 8, 3670, 12, 28052, 395, 413, 9, 267, 587, 26, 327, 2621, 641, 28688, 288, 347, 4306, 837, 355, 1830, 715, 26, 490, 1995, 6168, 8, 2355, 14, 25898, 8, 3670, 12, 28052, 395, 413, 9, 267, 291, 14, 4679, 275, 4306, 342, 339, 347, 2690, 8, 277, 304, 267, 372, 291, 14, 4679, 855, 2184, 4533, 339, 347, 636, 2722, 721, 277, 304, 267, 340, 291, 14, 2379, 63, 4399, 63, 4368, 365, 488, 26, 288, 372, 283, 3883, 10160, 4042, 83, 12, 4615, 2458, 83, 12, 28052, 2458, 83, 3171, 450, 971, 355, 334, 277, 14, 8956, 63, 344, 12, 291, 14, 3670, 12, 291, 14, 21672, 9, 267, 587, 26, 288, 372, 283, 3883, 10160, 4042, 83, 12, 4615, 2458, 83, 12, 28052, 2458, 83, 12, 3631, 63, 4399, 63, 4368, 2458, 83, 3171, 450, 971, 355, 334, 277, 14, 8956, 63, 344, 12, 291, 14, 3670, 12, 291, 14, 21672, 12, 291, 14, 2379, 63, 4399, 63, 4368, 9, 199, 199, 533, 3492, 11273, 1352, 6268, 3188, 7610, 26, 272, 408, 37, 1147, 376, 1566, 5403, 4036, 1124, 5191, 1040, 1324, 4474, 14, 272, 710, 574, 365, 314, 17312, 402, 314, 4153, 3086, 3967, 314, 2061, 272, 325, 2250, 14, 272, 408, 272, 347, 636, 826, 721, 277, 12, 6247, 29, 21, 304, 267, 291, 14, 5191, 275, 6247, 267, 291, 14, 3356, 275, 359, 403, 367, 284, 315, 1425, 8, 5191, 1874, 267, 291, 14, 4368, 63, 8585, 63, 2019, 275, 378, 267, 291, 14, 2019, 63, 1430, 275, 488, 327, 642, 365, 1202, 315, 8689, 1337, 314, 2061, 1566, 2286, 347, 3650, 8, 277, 12, 373, 304, 267, 291, 14, 3356, 59, 277, 14, 4368, 63, 8585, 63, 2019, 61, 275, 373, 14, 637, 267, 291, 14, 4368, 63, 8585, 63, 2019, 847, 413, 267, 340, 291, 14, 4368, 63, 8585, 63, 2019, 389, 277, 14, 5191, 26, 288, 1139, 275, 17312, 8, 277, 14, 3356, 9, 288, 1566, 275, 18474, 2390, 8, 8956, 63, 344, 29, 86, 14, 8956, 63, 344, 12, 6714, 29, 86, 14, 1086, 12, 1139, 29, 637, 9, 288, 291, 14, 4368, 63, 8585, 63, 2019, 275, 378, 288, 372, 1566, 267, 587, 26, 288, 291, 14, 2019, 63, 1430, 275, 373, 327, 3354, 315, 1930, 781, 4890, 2544, 2831, 1337, 282, 6247, 288, 372, 488, 339, 347, 4890, 8, 277, 304, 267, 340, 291, 14, 4368, 63, 8585, 63, 2019, 30, 16, 26, 288, 327, 340, 781, 1172, 2005, 7417, 1174, 12, 781, 8689, 1373, 4242, 1566, 626, 288, 327, 8095, 83, 15685, 781, 28454, 3967, 314, 2061, 325, 2250, 14, 288, 372, 18474, 2390, 8, 8956, 63, 344, 29, 277, 14, 2019, 63, 1430, 14, 8956, 63, 344, 12, 3044, 6714, 29, 277, 14, 2019, 63, 1430, 14, 1086, 12, 3044, 1139, 29, 13106, 8, 277, 14, 3356, 59, 16, 26, 277, 14, 4368, 63, 8585, 63, 2019, 2459, 421, 199, 318, 7392, 63, 5491, 8, 19296, 304, 272, 870, 480, 4737, 63, 5491, 4042, 83, 2924, 450, 4700, 8, 19296, 430, 199, 199, 533, 603, 81, 6215, 6261, 26, 272, 408, 2422, 314, 6661, 365, 15608, 14, 2136, 4868, 626, 282, 1627, 3222, 965, 272, 9709, 436, 314, 13484, 2797, 2544, 781, 2112, 314, 2163, 1373, 14, 272, 408, 272, 347, 636, 826, 721, 277, 12, 1166, 12, 7482, 12, 1566, 63, 3813, 304, 267, 291, 14, 633, 275, 1166, 267, 291, 14, 5746, 275, 7482, 267, 291, 14, 1258, 275, 394, 66, 19214, 14, 1258, 14, 14449, 1481, 3041, 8, 3813, 29, 1430, 63, 3813, 9, 267, 291, 14, 1430, 63, 3813, 275, 1566, 63, 3813, 267, 291, 14, 7113, 275, 756, 267, 291, 14, 6455, 63, 1765, 275, 488, 267, 291, 14, 1069, 63, 1825, 275, 15782, 342, 339, 347, 485, 475, 63, 1188, 8, 277, 12, 1499, 304, 267, 372, 2783, 8, 1001, 14, 4180, 1332, 1328, 14, 8956, 63, 344, 12, 1499, 14, 1086, 12, 1499, 14, 637, 30148, 2644, 534, 1624, 13, 24, 358, 339, 347, 485, 1069, 63, 4456, 8, 277, 12, 289, 12, 13659, 63, 2894, 12, 1125, 63, 2894, 304, 267, 702, 289, 389, 277, 14, 6455, 63, 1765, 267, 291, 14, 6455, 63, 1765, 275, 488, 267, 3178, 275, 289, 14, 1971, 342, 267, 340, 3178, 26, 288, 291, 14, 1430, 63, 3813, 14, 1250, 63, 1152, 265, 8, 705, 63, 2894, 12, 3178, 9, 267, 587, 26, 288, 291, 14, 1430, 63, 3813, 14, 1250, 63, 1152, 265, 8, 13207, 63, 2894, 9, 267, 340, 822, 8, 277, 14, 1069, 63, 1825, 13032, 16, 26, 288, 291, 14, 1430, 63, 3813, 14, 1250, 63, 1152, 265, 8, 277, 423, 1412, 63, 1825, 9, 2286, 347, 485, 1412, 63, 1825, 8, 277, 304, 267, 702, 291, 14, 6455, 63, 1765, 508, 488, 267, 702, 822, 8, 277, 14, 1069, 63, 1825, 13032, 16, 267, 334, 1328, 12, 13659, 63, 2894, 12, 1125, 63, 2894, 9, 275, 291, 14, 1069, 63, 1825, 14, 25704, 342, 267, 340, 1499 ]
[ 2765, 1015, 4440, 282, 1468, 2603, 1566, 13, 17824, 1856, 1015, 12, 199, 4941, 16015, 9476, 3449, 14, 7048, 1083, 1240, 365, 3032, 199, 65, 13659, 3233, 436, 376, 1125, 3233, 199, 624, 199, 504, 11076, 492, 17312, 199, 646, 2022, 199, 646, 16195, 199, 646, 2196, 199, 646, 900, 199, 646, 394, 66, 19214, 14, 1258, 199, 504, 5055, 492, 15782, 199, 199, 504, 376, 266, 782, 83, 14, 1095, 492, 18474, 2390, 199, 199, 2632, 275, 298, 19214, 921, 5967, 26, 1085, 2658, 2, 199, 199, 533, 9571, 10160, 26, 272, 347, 636, 826, 721, 277, 12, 8778, 63, 344, 12, 4615, 29, 1960, 14, 16, 12, 28052, 29, 1165, 14, 16, 12, 3631, 63, 4399, 63, 4368, 29, 403, 304, 267, 291, 14, 8956, 63, 344, 275, 8778, 63, 344, 267, 291, 14, 3670, 275, 4615, 267, 291, 14, 21672, 275, 28052, 267, 291, 14, 2379, 63, 4399, 63, 4368, 275, 3631, 63, 4399, 63, 4368, 267, 340, 3631, 63, 4399, 63, 4368, 365, 440, 488, 26, 288, 347, 4306, 837, 355, 367, 284, 315, 1425, 8, 2379, 63, 4399, 63, 4368, 304, 490, 1995, 6168, 8, 2355, 14, 25898, 8, 3670, 12, 28052, 395, 413, 9, 267, 587, 26, 327, 2621, 641, 28688, 288, 347, 4306, 837, 355, 1830, 715, 26, 490, 1995, 6168, 8, 2355, 14, 25898, 8, 3670, 12, 28052, 395, 413, 9, 267, 291, 14, 4679, 275, 4306, 342, 339, 347, 2690, 8, 277, 304, 267, 372, 291, 14, 4679, 855, 2184, 4533, 339, 347, 636, 2722, 721, 277, 304, 267, 340, 291, 14, 2379, 63, 4399, 63, 4368, 365, 488, 26, 288, 372, 283, 3883, 10160, 4042, 83, 12, 4615, 2458, 83, 12, 28052, 2458, 83, 3171, 450, 971, 355, 334, 277, 14, 8956, 63, 344, 12, 291, 14, 3670, 12, 291, 14, 21672, 9, 267, 587, 26, 288, 372, 283, 3883, 10160, 4042, 83, 12, 4615, 2458, 83, 12, 28052, 2458, 83, 12, 3631, 63, 4399, 63, 4368, 2458, 83, 3171, 450, 971, 355, 334, 277, 14, 8956, 63, 344, 12, 291, 14, 3670, 12, 291, 14, 21672, 12, 291, 14, 2379, 63, 4399, 63, 4368, 9, 199, 199, 533, 3492, 11273, 1352, 6268, 3188, 7610, 26, 272, 408, 37, 1147, 376, 1566, 5403, 4036, 1124, 5191, 1040, 1324, 4474, 14, 272, 710, 574, 365, 314, 17312, 402, 314, 4153, 3086, 3967, 314, 2061, 272, 325, 2250, 14, 272, 408, 272, 347, 636, 826, 721, 277, 12, 6247, 29, 21, 304, 267, 291, 14, 5191, 275, 6247, 267, 291, 14, 3356, 275, 359, 403, 367, 284, 315, 1425, 8, 5191, 1874, 267, 291, 14, 4368, 63, 8585, 63, 2019, 275, 378, 267, 291, 14, 2019, 63, 1430, 275, 488, 327, 642, 365, 1202, 315, 8689, 1337, 314, 2061, 1566, 2286, 347, 3650, 8, 277, 12, 373, 304, 267, 291, 14, 3356, 59, 277, 14, 4368, 63, 8585, 63, 2019, 61, 275, 373, 14, 637, 267, 291, 14, 4368, 63, 8585, 63, 2019, 847, 413, 267, 340, 291, 14, 4368, 63, 8585, 63, 2019, 389, 277, 14, 5191, 26, 288, 1139, 275, 17312, 8, 277, 14, 3356, 9, 288, 1566, 275, 18474, 2390, 8, 8956, 63, 344, 29, 86, 14, 8956, 63, 344, 12, 6714, 29, 86, 14, 1086, 12, 1139, 29, 637, 9, 288, 291, 14, 4368, 63, 8585, 63, 2019, 275, 378, 288, 372, 1566, 267, 587, 26, 288, 291, 14, 2019, 63, 1430, 275, 373, 327, 3354, 315, 1930, 781, 4890, 2544, 2831, 1337, 282, 6247, 288, 372, 488, 339, 347, 4890, 8, 277, 304, 267, 340, 291, 14, 4368, 63, 8585, 63, 2019, 30, 16, 26, 288, 327, 340, 781, 1172, 2005, 7417, 1174, 12, 781, 8689, 1373, 4242, 1566, 626, 288, 327, 8095, 83, 15685, 781, 28454, 3967, 314, 2061, 325, 2250, 14, 288, 372, 18474, 2390, 8, 8956, 63, 344, 29, 277, 14, 2019, 63, 1430, 14, 8956, 63, 344, 12, 3044, 6714, 29, 277, 14, 2019, 63, 1430, 14, 1086, 12, 3044, 1139, 29, 13106, 8, 277, 14, 3356, 59, 16, 26, 277, 14, 4368, 63, 8585, 63, 2019, 2459, 421, 199, 318, 7392, 63, 5491, 8, 19296, 304, 272, 870, 480, 4737, 63, 5491, 4042, 83, 2924, 450, 4700, 8, 19296, 430, 199, 199, 533, 603, 81, 6215, 6261, 26, 272, 408, 2422, 314, 6661, 365, 15608, 14, 2136, 4868, 626, 282, 1627, 3222, 965, 272, 9709, 436, 314, 13484, 2797, 2544, 781, 2112, 314, 2163, 1373, 14, 272, 408, 272, 347, 636, 826, 721, 277, 12, 1166, 12, 7482, 12, 1566, 63, 3813, 304, 267, 291, 14, 633, 275, 1166, 267, 291, 14, 5746, 275, 7482, 267, 291, 14, 1258, 275, 394, 66, 19214, 14, 1258, 14, 14449, 1481, 3041, 8, 3813, 29, 1430, 63, 3813, 9, 267, 291, 14, 1430, 63, 3813, 275, 1566, 63, 3813, 267, 291, 14, 7113, 275, 756, 267, 291, 14, 6455, 63, 1765, 275, 488, 267, 291, 14, 1069, 63, 1825, 275, 15782, 342, 339, 347, 485, 475, 63, 1188, 8, 277, 12, 1499, 304, 267, 372, 2783, 8, 1001, 14, 4180, 1332, 1328, 14, 8956, 63, 344, 12, 1499, 14, 1086, 12, 1499, 14, 637, 30148, 2644, 534, 1624, 13, 24, 358, 339, 347, 485, 1069, 63, 4456, 8, 277, 12, 289, 12, 13659, 63, 2894, 12, 1125, 63, 2894, 304, 267, 702, 289, 389, 277, 14, 6455, 63, 1765, 267, 291, 14, 6455, 63, 1765, 275, 488, 267, 3178, 275, 289, 14, 1971, 342, 267, 340, 3178, 26, 288, 291, 14, 1430, 63, 3813, 14, 1250, 63, 1152, 265, 8, 705, 63, 2894, 12, 3178, 9, 267, 587, 26, 288, 291, 14, 1430, 63, 3813, 14, 1250, 63, 1152, 265, 8, 13207, 63, 2894, 9, 267, 340, 822, 8, 277, 14, 1069, 63, 1825, 13032, 16, 26, 288, 291, 14, 1430, 63, 3813, 14, 1250, 63, 1152, 265, 8, 277, 423, 1412, 63, 1825, 9, 2286, 347, 485, 1412, 63, 1825, 8, 277, 304, 267, 702, 291, 14, 6455, 63, 1765, 508, 488, 267, 702, 822, 8, 277, 14, 1069, 63, 1825, 13032, 16, 267, 334, 1328, 12, 13659, 63, 2894, 12, 1125, 63, 2894, 9, 275, 291, 14, 1069, 63, 1825, 14, 25704, 342, 267, 340, 1499, 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 ]
esthermm/odoomrp-wip
stock_picking_wave_management/__openerp__.py
9
1554
# -*- encoding: utf-8 -*- ############################################################################## # # Copyright (c) # 2015 Serv. Tec. Avanzados - Pedro M. Baeza (http://www.serviciosbaeza.com) # 2015 AvanzOsc (http://www.avanzosc.es) # # 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/>. # ############################################################################## { 'name': 'Stock Picking Wave Management', 'version': "8.0.1.0.0", "author": "OdooMRP team," "AvanzOSC," "Serv. Tecnol. Avanzados - Pedro M. Baeza", 'website': "http://www.odoomrp.com", 'category': 'Warehouse Management', 'depends': [ "stock", "stock_picking_wave", ], 'data': [ "data/stock_picking_wave_management_data.xml", "wizard/stock_transfer_details_view.xml", "views/stock_picking_wave_view.xml", ], 'installable': True, }
agpl-3.0
[ 3, 1882, 2644, 26, 2774, 13, 24, 1882, 199, 4605, 199, 3, 199, 3, 1898, 334, 67, 9, 199, 3, 259, 6900, 3739, 86, 14, 377, 825, 14, 16599, 290, 90, 20257, 446, 510, 379, 293, 603, 14, 699, 3624, 8076, 334, 1014, 921, 1544, 14, 332, 433, 559, 736, 28363, 8076, 14, 957, 9, 199, 3, 259, 6900, 16599, 290, 90, 47, 551, 334, 1014, 921, 1544, 14, 1214, 290, 18070, 551, 14, 397, 9, 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, 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, 91, 272, 283, 354, 356, 283, 17103, 16568, 316, 644, 811, 8259, 297, 272, 283, 1023, 356, 298, 24, 14, 16, 14, 17, 14, 16, 14, 16, 401, 272, 298, 2502, 582, 298, 47, 16766, 45, 18612, 8099, 4589, 1598, 298, 6651, 290, 90, 31799, 4589, 1598, 298, 1505, 86, 14, 377, 825, 78, 393, 14, 16599, 290, 90, 20257, 446, 510, 379, 293, 603, 14, 699, 3624, 8076, 401, 272, 283, 7360, 356, 298, 1014, 921, 1544, 14, 364, 7501, 4599, 14, 957, 401, 272, 283, 3710, 356, 283, 55, 11499, 8259, 297, 272, 283, 8912, 356, 359, 267, 298, 6088, 401, 267, 298, 6088, 63, 11463, 63, 10024, 401, 272, 2156, 272, 283, 576, 356, 359, 267, 298, 576, 15, 6088, 63, 11463, 63, 10024, 63, 8110, 63, 576, 14, 1652, 401, 267, 298, 9819, 15, 6088, 63, 9609, 63, 5087, 63, 1345, 14, 1652, 401, 267, 298, 4196, 15, 6088, 63, 11463, 63, 10024, 63, 1345, 14, 1652, 401, 272, 2156, 272, 283, 21762, 356, 715, 12, 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 ]
[ 1882, 2644, 26, 2774, 13, 24, 1882, 199, 4605, 199, 3, 199, 3, 1898, 334, 67, 9, 199, 3, 259, 6900, 3739, 86, 14, 377, 825, 14, 16599, 290, 90, 20257, 446, 510, 379, 293, 603, 14, 699, 3624, 8076, 334, 1014, 921, 1544, 14, 332, 433, 559, 736, 28363, 8076, 14, 957, 9, 199, 3, 259, 6900, 16599, 290, 90, 47, 551, 334, 1014, 921, 1544, 14, 1214, 290, 18070, 551, 14, 397, 9, 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, 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, 91, 272, 283, 354, 356, 283, 17103, 16568, 316, 644, 811, 8259, 297, 272, 283, 1023, 356, 298, 24, 14, 16, 14, 17, 14, 16, 14, 16, 401, 272, 298, 2502, 582, 298, 47, 16766, 45, 18612, 8099, 4589, 1598, 298, 6651, 290, 90, 31799, 4589, 1598, 298, 1505, 86, 14, 377, 825, 78, 393, 14, 16599, 290, 90, 20257, 446, 510, 379, 293, 603, 14, 699, 3624, 8076, 401, 272, 283, 7360, 356, 298, 1014, 921, 1544, 14, 364, 7501, 4599, 14, 957, 401, 272, 283, 3710, 356, 283, 55, 11499, 8259, 297, 272, 283, 8912, 356, 359, 267, 298, 6088, 401, 267, 298, 6088, 63, 11463, 63, 10024, 401, 272, 2156, 272, 283, 576, 356, 359, 267, 298, 576, 15, 6088, 63, 11463, 63, 10024, 63, 8110, 63, 576, 14, 1652, 401, 267, 298, 9819, 15, 6088, 63, 9609, 63, 5087, 63, 1345, 14, 1652, 401, 267, 298, 4196, 15, 6088, 63, 11463, 63, 10024, 63, 1345, 14, 1652, 401, 272, 2156, 272, 283, 21762, 356, 715, 12, 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, 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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0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
Zhiqiang-He/kafka-0914-edit
tests/kafkatest/utils/remote_account.py
42
1280
# 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. def file_exists(node, file): """Quick and dirty check for existence of remote file.""" try: node.account.ssh("cat " + file, allow_fail=False) return True except: return False def line_count(node, file): """Return the line count of file on node""" out = [line for line in node.account.ssh_capture("wc -l %s" % file)] if len(out) != 1: raise Exception("Expected single line of output from wc -l") return int(out[0].strip().split(" ")[0])
apache-2.0
[ 3, 3909, 370, 314, 3668, 2290, 2752, 334, 14950, 9, 1334, 1373, 503, 1655, 199, 3, 11615, 4190, 14024, 14, 221, 1666, 314, 12840, 570, 1854, 543, 199, 3, 642, 1736, 367, 4722, 2556, 12602, 4248, 12715, 14, 199, 3, 710, 14857, 12378, 642, 570, 370, 2047, 1334, 314, 3668, 844, 12, 3394, 499, 14, 16, 199, 3, 334, 1589, 298, 3761, 3547, 1265, 1443, 440, 675, 642, 570, 871, 315, 4151, 543, 199, 3, 314, 844, 14, 221, 2047, 1443, 3332, 282, 1331, 402, 314, 844, 737, 199, 3, 199, 3, 259, 1455, 921, 1544, 14, 3796, 14, 1308, 15, 2383, 15, 3961, 13, 18, 14, 16, 199, 3, 199, 3, 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, 421, 199, 318, 570, 63, 2444, 8, 932, 12, 570, 304, 272, 408, 19684, 436, 14650, 1104, 367, 23780, 402, 3982, 570, 1041, 272, 862, 26, 267, 1031, 14, 2048, 14, 5510, 480, 3385, 298, 435, 570, 12, 2040, 63, 1633, 29, 797, 9, 267, 372, 715, 272, 871, 26, 267, 372, 756, 421, 199, 318, 1004, 63, 835, 8, 932, 12, 570, 304, 272, 408, 1767, 314, 1004, 2338, 402, 570, 641, 1031, 624, 272, 734, 275, 359, 604, 367, 1004, 315, 1031, 14, 2048, 14, 5510, 63, 12685, 480, 13683, 446, 76, 450, 83, 2, 450, 570, 1874, 272, 340, 822, 8, 548, 9, 1137, 413, 26, 267, 746, 2186, 480, 6964, 2849, 1004, 402, 1072, 687, 21304, 446, 76, 531, 339, 372, 1109, 8, 548, 59, 16, 1055, 1913, 1252, 1294, 480, 298, 2788, 16, 566, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768 ]
[ 3909, 370, 314, 3668, 2290, 2752, 334, 14950, 9, 1334, 1373, 503, 1655, 199, 3, 11615, 4190, 14024, 14, 221, 1666, 314, 12840, 570, 1854, 543, 199, 3, 642, 1736, 367, 4722, 2556, 12602, 4248, 12715, 14, 199, 3, 710, 14857, 12378, 642, 570, 370, 2047, 1334, 314, 3668, 844, 12, 3394, 499, 14, 16, 199, 3, 334, 1589, 298, 3761, 3547, 1265, 1443, 440, 675, 642, 570, 871, 315, 4151, 543, 199, 3, 314, 844, 14, 221, 2047, 1443, 3332, 282, 1331, 402, 314, 844, 737, 199, 3, 199, 3, 259, 1455, 921, 1544, 14, 3796, 14, 1308, 15, 2383, 15, 3961, 13, 18, 14, 16, 199, 3, 199, 3, 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, 421, 199, 318, 570, 63, 2444, 8, 932, 12, 570, 304, 272, 408, 19684, 436, 14650, 1104, 367, 23780, 402, 3982, 570, 1041, 272, 862, 26, 267, 1031, 14, 2048, 14, 5510, 480, 3385, 298, 435, 570, 12, 2040, 63, 1633, 29, 797, 9, 267, 372, 715, 272, 871, 26, 267, 372, 756, 421, 199, 318, 1004, 63, 835, 8, 932, 12, 570, 304, 272, 408, 1767, 314, 1004, 2338, 402, 570, 641, 1031, 624, 272, 734, 275, 359, 604, 367, 1004, 315, 1031, 14, 2048, 14, 5510, 63, 12685, 480, 13683, 446, 76, 450, 83, 2, 450, 570, 1874, 272, 340, 822, 8, 548, 9, 1137, 413, 26, 267, 746, 2186, 480, 6964, 2849, 1004, 402, 1072, 687, 21304, 446, 76, 531, 339, 372, 1109, 8, 548, 59, 16, 1055, 1913, 1252, 1294, 480, 298, 2788, 16, 566, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 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,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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 ]
imsut/commons
src/python/twitter/pants/tasks/binary_create.py
2
4176
# ================================================================================================== # Copyright 2012 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__ = 'John Sirois' import os from zipfile import ZIP_STORED, ZIP_DEFLATED from twitter.common.contextutil import open_zip as open_jar, temporary_dir from twitter.common.dirutil import safe_mkdir from twitter.pants import get_buildroot, get_version, is_internal from twitter.pants.java import Manifest from twitter.pants.tasks.binary_utils import safe_extract from twitter.pants.tasks.jvm_binary_task import JvmBinaryTask class BinaryCreate(JvmBinaryTask): @classmethod def setup_parser(cls, option_group, args, mkflag): JvmBinaryTask.setup_parser(option_group, args, mkflag) option_group.add_option(mkflag("compressed"), mkflag("compressed", negate=True), dest="binary_create_compressed", default=True, action="callback", callback=mkflag.set_bool, help="[%default] Create a compressed binary jar.") def __init__(self, context): JvmBinaryTask.__init__(self, context) self.outdir = ( context.options.jvm_binary_create_outdir or context.config.get('binary-create', 'outdir') ) self.compression = ZIP_DEFLATED if context.options.binary_create_compressed else ZIP_STORED self.deployjar = context.options.jvm_binary_create_deployjar context.products.require('jars', predicate=self.is_binary) if self.deployjar: self.require_jar_dependencies() def execute(self, targets): for binary in filter(self.is_binary, targets): self.create_binary(binary) def create_binary(self, binary): import platform safe_mkdir(self.outdir) jarmap = self.context.products.get('jars') binary_jarname = '%s.jar' % binary.basename binaryjarpath = os.path.join(self.outdir, binary_jarname) self.context.log.info('creating %s' % os.path.relpath(binaryjarpath, get_buildroot())) with open_jar(binaryjarpath, 'w', compression=self.compression) as jar: def add_jars(target): generated = jarmap.get(target) if generated: for basedir, jars in generated.items(): for internaljar in jars: self.dump(os.path.join(basedir, internaljar), jar) binary.walk(add_jars, is_internal) if self.deployjar: for basedir, externaljar in self.list_jar_dependencies(binary): self.dump(os.path.join(basedir, externaljar), jar) manifest = Manifest() manifest.addentry(Manifest.MANIFEST_VERSION, '1.0') manifest.addentry( Manifest.CREATED_BY, 'python %s pants %s (Twitter, Inc.)' % (platform.python_version(), get_version()) ) main = binary.main or '*** java -jar not supported, please use -cp and pick a main ***' manifest.addentry(Manifest.MAIN_CLASS, main) jar.writestr(Manifest.PATH, manifest.contents()) jarmap.add(binary, self.outdir, [binary_jarname]) def dump(self, jarpath, jarfile): self.context.log.debug(' dumping %s' % jarpath) with temporary_dir() as tmpdir: safe_extract(jarpath, tmpdir) for root, dirs, files in os.walk(tmpdir): for file in files: path = os.path.join(root, file) relpath = os.path.relpath(path, tmpdir) if Manifest.PATH != relpath: jarfile.write(path, relpath)
apache-2.0
[ 3, 7819, 2486, 29, 199, 3, 1898, 6029, 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, 12923, 428, 14352, 374, 7, 199, 199, 646, 747, 199, 199, 504, 10392, 492, 221, 18402, 63, 29456, 12, 18402, 63, 28506, 199, 199, 504, 15811, 14, 2330, 14, 1100, 1974, 492, 1551, 63, 3065, 465, 1551, 63, 7338, 12, 7937, 63, 694, 199, 504, 15811, 14, 2330, 14, 694, 1974, 492, 5048, 63, 8215, 199, 199, 504, 15811, 14, 21970, 492, 664, 63, 1506, 1231, 12, 664, 63, 1023, 12, 365, 63, 4672, 199, 504, 15811, 14, 21970, 14, 6138, 492, 4688, 3944, 199, 504, 15811, 14, 21970, 14, 5054, 14, 3008, 63, 1208, 492, 5048, 63, 5005, 199, 504, 15811, 14, 21970, 14, 5054, 14, 15813, 63, 3008, 63, 1765, 492, 1603, 2611, 6636, 4476, 421, 199, 533, 14161, 2499, 8, 42, 2611, 6636, 4476, 304, 523, 768, 3744, 523, 347, 3272, 63, 2087, 8, 1886, 12, 945, 63, 923, 12, 1249, 12, 9199, 4173, 304, 272, 1603, 2611, 6636, 4476, 14, 2758, 63, 2087, 8, 1422, 63, 923, 12, 1249, 12, 9199, 4173, 9, 272, 945, 63, 923, 14, 525, 63, 1422, 8, 3880, 4173, 480, 10895, 1288, 9199, 4173, 480, 10895, 401, 30112, 29, 549, 395, 1169, 2053, 628, 3008, 63, 981, 63, 10895, 401, 849, 29, 549, 12, 1169, 1595, 628, 3058, 401, 3233, 29, 3880, 4173, 14, 409, 63, 2245, 12, 1169, 1720, 628, 9722, 885, 61, 2790, 282, 12335, 3366, 16290, 2685, 819, 347, 636, 826, 721, 277, 12, 1067, 304, 272, 1603, 2611, 6636, 4476, 855, 826, 721, 277, 12, 1067, 9, 339, 291, 14, 18091, 275, 334, 489, 1067, 14, 1419, 14, 15813, 63, 3008, 63, 981, 63, 18091, 489, 503, 1067, 14, 888, 14, 362, 360, 3008, 13, 981, 297, 283, 18091, 358, 272, 776, 272, 291, 14, 12849, 275, 18402, 63, 28506, 340, 1067, 14, 1419, 14, 3008, 63, 981, 63, 10895, 587, 18402, 63, 29456, 272, 291, 14, 11060, 7338, 275, 1067, 14, 1419, 14, 15813, 63, 3008, 63, 981, 63, 11060, 7338, 339, 1067, 14, 13336, 14, 4365, 360, 32262, 297, 11944, 29, 277, 14, 374, 63, 3008, 9, 272, 340, 291, 14, 11060, 7338, 26, 489, 291, 14, 4365, 63, 7338, 63, 5714, 342, 819, 347, 5341, 8, 277, 12, 4545, 304, 272, 367, 3366, 315, 2457, 8, 277, 14, 374, 63, 3008, 12, 4545, 304, 489, 291, 14, 981, 63, 3008, 8, 3008, 9, 819, 347, 1218, 63, 3008, 8, 277, 12, 3366, 304, 272, 492, 4298, 272, 5048, 63, 8215, 8, 277, 14, 18091, 9, 339, 16290, 1130, 275, 291, 14, 1100, 14, 13336, 14, 362, 360, 32262, 358, 339, 3366, 63, 7338, 354, 275, 1543, 83, 14, 7338, 7, 450, 3366, 14, 4846, 272, 3366, 7338, 515, 275, 747, 14, 515, 14, 904, 8, 277, 14, 18091, 12, 3366, 63, 7338, 354, 9, 272, 291, 14, 1100, 14, 793, 14, 815, 360, 20358, 450, 83, 7, 450, 747, 14, 515, 14, 12405, 8, 3008, 7338, 515, 12, 664, 63, 1506, 1231, 4059, 339, 543, 1551, 63, 7338, 8, 3008, 7338, 515, 12, 283, 87, 297, 10291, 29, 277, 14, 12849, 9, 465, 16290, 26, 489, 347, 1050, 63, 32262, 8, 1375, 304, 267, 4046, 275, 16290, 1130, 14, 362, 8, 1375, 9, 267, 340, 4046, 26, 881, 367, 19380, 12, 1335, 4291, 315, 4046, 14, 1744, 837, 288, 367, 5007, 7338, 315, 1335, 4291, 26, 1598, 291, 14, 2724, 8, 736, 14, 515, 14, 904, 8, 12484, 12, 5007, 7338, 395, 16290, 9, 2541, 3366, 14, 7757, 8, 525, 63, 32262, 12, 365, 63, 4672, 9, 2541, 340, 291, 14, 11060, 7338, 26, 267, 367, 19380, 12, 5957, 7338, 315, 291, 14, 513, 63, 7338, 63, 5714, 8, 3008, 304, 881, 291, 14, 2724, 8, 736, 14, 515, 14, 904, 8, 12484, 12, 5957, 7338, 395, 16290, 9, 2541, 7712, 275, 4688, 3944, 342, 489, 7712, 14, 350, 1326, 651, 8, 11038, 14, 24067, 63, 4612, 12, 283, 17, 14, 16, 358, 489, 7712, 14, 350, 1326, 651, 8, 267, 4688, 3944, 14, 26561, 63, 8285, 12, 267, 283, 1548, 450, 83, 18081, 450, 83, 334, 24540, 12, 3277, 14, 3171, 450, 334, 3246, 14, 1548, 63, 1023, 1062, 664, 63, 1023, 1012, 489, 776, 489, 2446, 275, 3366, 14, 973, 503, 283, 9153, 12120, 446, 7338, 440, 3748, 12, 8749, 675, 446, 1850, 436, 3732, 282, 2446, 1011, 10223, 489, 7712, 14, 350, 1326, 651, 8, 11038, 14, 5848, 63, 6885, 12, 221, 2446, 9, 489, 16290, 14, 3392, 28792, 8, 11038, 14, 3243, 12, 7712, 14, 4407, 1012, 2541, 16290, 1130, 14, 525, 8, 3008, 12, 291, 14, 18091, 12, 359, 3008, 63, 7338, 354, 566, 819, 347, 5461, 8, 277, 12, 16290, 515, 12, 16290, 493, 304, 272, 291, 14, 1100, 14, 793, 14, 1757, 360, 221, 5461, 316, 450, 83, 7, 450, 16290, 515, 9, 339, 543, 7937, 63, 694, 342, 465, 12885, 26, 489, 5048, 63, 5005, 8, 7338, 515, 12, 12885, 9, 489, 367, 1738, 12, 7606, 12, 1584, 315, 747, 14, 7757, 8, 8616, 304, 267, 367, 570, 315, 1584, 26, 881, 931, 275, 747, 14, 515, 14, 904, 8, 1231, 12, 570, 9, 881, 20700, 275, 747, 14, 515, 14, 12405, 8, 515, 12 ]
[ 7819, 2486, 29, 199, 3, 1898, 6029, 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, 12923, 428, 14352, 374, 7, 199, 199, 646, 747, 199, 199, 504, 10392, 492, 221, 18402, 63, 29456, 12, 18402, 63, 28506, 199, 199, 504, 15811, 14, 2330, 14, 1100, 1974, 492, 1551, 63, 3065, 465, 1551, 63, 7338, 12, 7937, 63, 694, 199, 504, 15811, 14, 2330, 14, 694, 1974, 492, 5048, 63, 8215, 199, 199, 504, 15811, 14, 21970, 492, 664, 63, 1506, 1231, 12, 664, 63, 1023, 12, 365, 63, 4672, 199, 504, 15811, 14, 21970, 14, 6138, 492, 4688, 3944, 199, 504, 15811, 14, 21970, 14, 5054, 14, 3008, 63, 1208, 492, 5048, 63, 5005, 199, 504, 15811, 14, 21970, 14, 5054, 14, 15813, 63, 3008, 63, 1765, 492, 1603, 2611, 6636, 4476, 421, 199, 533, 14161, 2499, 8, 42, 2611, 6636, 4476, 304, 523, 768, 3744, 523, 347, 3272, 63, 2087, 8, 1886, 12, 945, 63, 923, 12, 1249, 12, 9199, 4173, 304, 272, 1603, 2611, 6636, 4476, 14, 2758, 63, 2087, 8, 1422, 63, 923, 12, 1249, 12, 9199, 4173, 9, 272, 945, 63, 923, 14, 525, 63, 1422, 8, 3880, 4173, 480, 10895, 1288, 9199, 4173, 480, 10895, 401, 30112, 29, 549, 395, 1169, 2053, 628, 3008, 63, 981, 63, 10895, 401, 849, 29, 549, 12, 1169, 1595, 628, 3058, 401, 3233, 29, 3880, 4173, 14, 409, 63, 2245, 12, 1169, 1720, 628, 9722, 885, 61, 2790, 282, 12335, 3366, 16290, 2685, 819, 347, 636, 826, 721, 277, 12, 1067, 304, 272, 1603, 2611, 6636, 4476, 855, 826, 721, 277, 12, 1067, 9, 339, 291, 14, 18091, 275, 334, 489, 1067, 14, 1419, 14, 15813, 63, 3008, 63, 981, 63, 18091, 489, 503, 1067, 14, 888, 14, 362, 360, 3008, 13, 981, 297, 283, 18091, 358, 272, 776, 272, 291, 14, 12849, 275, 18402, 63, 28506, 340, 1067, 14, 1419, 14, 3008, 63, 981, 63, 10895, 587, 18402, 63, 29456, 272, 291, 14, 11060, 7338, 275, 1067, 14, 1419, 14, 15813, 63, 3008, 63, 981, 63, 11060, 7338, 339, 1067, 14, 13336, 14, 4365, 360, 32262, 297, 11944, 29, 277, 14, 374, 63, 3008, 9, 272, 340, 291, 14, 11060, 7338, 26, 489, 291, 14, 4365, 63, 7338, 63, 5714, 342, 819, 347, 5341, 8, 277, 12, 4545, 304, 272, 367, 3366, 315, 2457, 8, 277, 14, 374, 63, 3008, 12, 4545, 304, 489, 291, 14, 981, 63, 3008, 8, 3008, 9, 819, 347, 1218, 63, 3008, 8, 277, 12, 3366, 304, 272, 492, 4298, 272, 5048, 63, 8215, 8, 277, 14, 18091, 9, 339, 16290, 1130, 275, 291, 14, 1100, 14, 13336, 14, 362, 360, 32262, 358, 339, 3366, 63, 7338, 354, 275, 1543, 83, 14, 7338, 7, 450, 3366, 14, 4846, 272, 3366, 7338, 515, 275, 747, 14, 515, 14, 904, 8, 277, 14, 18091, 12, 3366, 63, 7338, 354, 9, 272, 291, 14, 1100, 14, 793, 14, 815, 360, 20358, 450, 83, 7, 450, 747, 14, 515, 14, 12405, 8, 3008, 7338, 515, 12, 664, 63, 1506, 1231, 4059, 339, 543, 1551, 63, 7338, 8, 3008, 7338, 515, 12, 283, 87, 297, 10291, 29, 277, 14, 12849, 9, 465, 16290, 26, 489, 347, 1050, 63, 32262, 8, 1375, 304, 267, 4046, 275, 16290, 1130, 14, 362, 8, 1375, 9, 267, 340, 4046, 26, 881, 367, 19380, 12, 1335, 4291, 315, 4046, 14, 1744, 837, 288, 367, 5007, 7338, 315, 1335, 4291, 26, 1598, 291, 14, 2724, 8, 736, 14, 515, 14, 904, 8, 12484, 12, 5007, 7338, 395, 16290, 9, 2541, 3366, 14, 7757, 8, 525, 63, 32262, 12, 365, 63, 4672, 9, 2541, 340, 291, 14, 11060, 7338, 26, 267, 367, 19380, 12, 5957, 7338, 315, 291, 14, 513, 63, 7338, 63, 5714, 8, 3008, 304, 881, 291, 14, 2724, 8, 736, 14, 515, 14, 904, 8, 12484, 12, 5957, 7338, 395, 16290, 9, 2541, 7712, 275, 4688, 3944, 342, 489, 7712, 14, 350, 1326, 651, 8, 11038, 14, 24067, 63, 4612, 12, 283, 17, 14, 16, 358, 489, 7712, 14, 350, 1326, 651, 8, 267, 4688, 3944, 14, 26561, 63, 8285, 12, 267, 283, 1548, 450, 83, 18081, 450, 83, 334, 24540, 12, 3277, 14, 3171, 450, 334, 3246, 14, 1548, 63, 1023, 1062, 664, 63, 1023, 1012, 489, 776, 489, 2446, 275, 3366, 14, 973, 503, 283, 9153, 12120, 446, 7338, 440, 3748, 12, 8749, 675, 446, 1850, 436, 3732, 282, 2446, 1011, 10223, 489, 7712, 14, 350, 1326, 651, 8, 11038, 14, 5848, 63, 6885, 12, 221, 2446, 9, 489, 16290, 14, 3392, 28792, 8, 11038, 14, 3243, 12, 7712, 14, 4407, 1012, 2541, 16290, 1130, 14, 525, 8, 3008, 12, 291, 14, 18091, 12, 359, 3008, 63, 7338, 354, 566, 819, 347, 5461, 8, 277, 12, 16290, 515, 12, 16290, 493, 304, 272, 291, 14, 1100, 14, 793, 14, 1757, 360, 221, 5461, 316, 450, 83, 7, 450, 16290, 515, 9, 339, 543, 7937, 63, 694, 342, 465, 12885, 26, 489, 5048, 63, 5005, 8, 7338, 515, 12, 12885, 9, 489, 367, 1738, 12, 7606, 12, 1584, 315, 747, 14, 7757, 8, 8616, 304, 267, 367, 570, 315, 1584, 26, 881, 931, 275, 747, 14, 515, 14, 904, 8, 1231, 12, 570, 9, 881, 20700, 275, 747, 14, 515, 14, 12405, 8, 515, 12, 0 ]
[ 1, 1, 1, 1, 1, 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conf.py
2
10687
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # # epistasis documentation build configuration file, created by # sphinx-quickstart on Thu Jul 7 15:47:18 2016. # # 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 os import sys # Import sphinx gallery sys.path.insert(0, os.path.abspath('sphinxext')) import sphinx_gallery # importing modules with weird dependencies try: from mock import Mock as MagicMock except ImportError: from unittest.mock import MagicMock class Mock(MagicMock): @classmethod def __getattr__(cls, name): return Mock() MOCK_MODULES = [ 'ipython', 'ipywidgets', 'jupyter', 'notebook', 'Cython.Build', 'emcee', 'pandas' ] try: sys.modules.update((mod_name, Mock()) for mod_name in MOCK_MODULES) except RecursionError: pass highlight_language = "python3" # -- 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', 'sphinx.ext.mathjax', 'sphinx.ext.napoleon', 'sphinx_gallery.gen_gallery' ] # Add any paths that contain templates here, relative to this directory. templates_path = ['_templates'] # The suffix(es) of source filenames. # You can specify multiple suffix as a list of string: # source_suffix = ['.rst', '.md'] 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 = 'epistasis' copyright = '2016, Zach Sailer' author = 'Zach Sailer' # The version info for the project you're documenting, acts as replacement for # |version| and |release|, also used in various other places throughout the # built documents. # # The short X.Y version. version = '0.1' # The full version, including alpha/beta/rc tags. release = '0.1' # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. # # This is also used if you do content translation via gettext catalogs. # Usually you set "language" from the command line for these cases. 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. # This patterns also effect to html_static_path and html_extra_path exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store'] # 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 = 'default' # 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 # If true, `todo` and `todoList` produce output, else they produce nothing. todo_include_todos = 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 = 'alabaster' # 'sphinx_rtd_theme' # 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. # "<project> v<release> documentation" by default. #html_title = 'epistasis v0.1' # 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 (relative to this directory) to use as a 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'] # Add any extra paths that contain custom files (such as robots.txt or # .htaccess) here, relative to this directory. These files are copied # directly to the root of the documentation. #html_extra_path = [] # If not None, a 'Last updated on:' timestamp is inserted at every page # bottom, using the given strftime format. # The empty string is equivalent to '%b %d, %Y'. #html_last_updated_fmt = None # If true, SmartyPants will be used to convert quotes and dashes to # typographically correct entities. #html_use_smartypants = True # Custom sidebar templates, maps document names to template names. #html_sidebars = {} # Additional templates that should be rendered to pages, maps page names to # template names. #html_additional_pages = {} # If false, no module index is generated. #html_domain_indices = True # If false, no index is generated. #html_use_index = True # If true, the index is split into individual pages for each letter. #html_split_index = False # If true, links to the reST sources are added to the pages. #html_show_sourcelink = True # If true, "Created using Sphinx" is shown in the HTML footer. Default is True. #html_show_sphinx = True # If true, "(C) Copyright ..." is shown in the HTML footer. Default is True. #html_show_copyright = True # If true, an OpenSearch description file will be output, and all pages will # contain a <link> tag referring to it. The value of this option must be the # base URL from which the finished HTML is served. #html_use_opensearch = '' # This is the file name suffix for HTML files (e.g. ".xhtml"). #html_file_suffix = None # Language to be used for generating the HTML full-text search index. # Sphinx supports the following languages: # 'da', 'de', 'en', 'es', 'fi', 'fr', 'h', 'it', 'ja' # 'nl', 'no', 'pt', 'ro', 'r', 'sv', 'tr', 'zh' #html_search_language = 'en' # A dictionary with options for the search language support, empty by default. # 'ja' uses this config value. # 'zh' user can custom change `jieba` dictionary path. #html_search_options = {'type': 'default'} # The name of a javascript file (relative to the configuration directory) that # implements a search results scorer. If empty, the default will be used. #html_search_scorer = 'scorer.js' # Output file base name for HTML help builder. htmlhelp_basename = 'epistasisdoc' # -- 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': '', # Latex figure (float) alignment #'figure_align': 'htbp', } # Grouping the document tree into LaTeX files. List of tuples # (source start file, target name, title, # author, documentclass [howto, manual, or own class]). latex_documents = [ (master_doc, 'epistasis.tex', 'epistasis Documentation', 'Zach Sailer', '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 = [ (master_doc, 'epistasis', 'epistasis Documentation', [author], 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 = [ (master_doc, 'epistasis', 'epistasis Documentation', author, 'epistasis', '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 # Napoleon settings napoleon_google_docstring = False napoleon_numpy_docstring = True napoleon_include_private_with_doc = False napoleon_include_special_with_doc = True napoleon_use_admonition_for_examples = True napoleon_use_admonition_for_notes = False napoleon_use_admonition_for_references = False napoleon_use_ivar = False napoleon_use_param = True napoleon_use_rtype = True # ------------------------- Sphinx Gallery ------------------------ # Sphinx gallery conf sphinx_gallery_conf = { # path to your examples scripts 'examples_dirs' : '../examples', # path where to save gallery generated examples 'gallery_dirs' : 'gallery', 'backreferences_dir': 'generated/modules', 'download_section_examples' : False, 'reference_url': { 'epistasis': None, }, } plot_gallery = 'True'
unlicense
[ 3381, 2647, 15, 1393, 15, 1813, 2366, 19, 199, 3, 1882, 2803, 26, 2774, 13, 24, 1882, 199, 3, 199, 3, 5442, 631, 4864, 3794, 1900, 2897, 570, 12, 2737, 701, 199, 3, 15882, 13, 28957, 641, 3868, 85, 1603, 348, 221, 1520, 4114, 26, 2417, 26, 1085, 7800, 14, 199, 3, 199, 3, 961, 570, 365, 22711, 342, 68, 543, 314, 1453, 2082, 663, 370, 2399, 199, 3, 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, 747, 199, 646, 984, 199, 199, 3, 3161, 15882, 486, 17787, 199, 1274, 14, 515, 14, 3176, 8, 16, 12, 747, 14, 515, 14, 4832, 360, 8008, 832, 1333, 199, 646, 15882, 63, 25372, 199, 199, 3, 16306, 4621, 543, 22965, 5124, 199, 893, 26, 272, 687, 1683, 492, 4420, 465, 10079, 199, 2590, 3545, 26, 272, 687, 2882, 14, 1805, 492, 10079, 199, 199, 533, 4420, 8, 11988, 304, 272, 768, 3744, 272, 347, 636, 5675, 721, 1886, 12, 536, 304, 288, 372, 4420, 342, 199, 199, 17749, 63, 21194, 275, 359, 272, 283, 22691, 297, 272, 283, 73, 647, 8583, 297, 272, 283, 74, 28022, 351, 297, 272, 283, 19174, 297, 272, 283, 9156, 898, 14, 3425, 297, 272, 283, 5633, 29377, 297, 272, 283, 15718, 7, 199, 61, 199, 199, 893, 26, 272, 984, 14, 3112, 14, 873, 1332, 1494, 63, 354, 12, 4420, 1012, 367, 3413, 63, 354, 315, 10362, 2504, 63, 21194, 9, 199, 2590, 18306, 438, 547, 26, 272, 986, 421, 199, 14337, 63, 3671, 275, 298, 1548, 19, 2, 199, 199, 3, 1553, 1696, 2897, 9527, 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, 199, 3, 5478, 17262, 543, 10229, 334, 4579, 283, 8008, 14, 832, 24915, 503, 2195, 3537, 199, 3, 7869, 14, 199, 5359, 275, 359, 272, 283, 8008, 14, 832, 14, 28056, 297, 272, 283, 8008, 14, 832, 14, 3442, 15863, 297, 272, 283, 8008, 14, 832, 14, 2542, 16721, 265, 297, 272, 283, 8008, 63, 25372, 14, 2268, 63, 25372, 7, 199, 61, 16478, 327, 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, 8, 397, 9, 402, 1350, 6203, 14, 199, 3, 2047, 883, 4165, 3663, 4739, 465, 282, 769, 402, 1059, 26, 199, 3, 1350, 63, 4511, 275, 18953, 8332, 297, 1987, 1064, 418, 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, 283, 1545, 631, 4864, 7, 199, 7307, 275, 283, 9261, 12, 3107, 1225, 428, 65, 3566, 7, 199, 2502, 275, 283, 58, 1225, 428, 65, 3566, 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, 16, 14, 17, 7, 199, 3, 710, 2615, 1015, 12, 5893, 5131, 15, 5683, 15, 1195, 3762, 14, 199, 3221, 275, 283, 16, 14, 17, 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, 199, 3, 961, 365, 2597, 1202, 340, 1265, 886, 1564, 7761, 4799, 9796, 6230, 18238, 14, 199, 3, 24612, 1265, 663, 298, 3671, 2, 687, 314, 1414, 1004, 367, 3520, 5560, 14, 199, 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, 3, 961, 7970, 2597, 7763, 370, 3517, 63, 1986, 63, 515, 436, 3517, 63, 2911, 63, 515, 199, 5473, 63, 7435, 275, 4044, 1506, 297, 283, 2719, 23135, 14, 697, 297, 1987, 3177, 63, 5502, 418, 199, 199, 3, 710, 20883, 849, 4719, 334, 2972, 367, 642, 9189, 26, 658, 505, 10522, 370, 675, 367, 1006, 199, 3, 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, 885, 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 ]
[ 2647, 15, 1393, 15, 1813, 2366, 19, 199, 3, 1882, 2803, 26, 2774, 13, 24, 1882, 199, 3, 199, 3, 5442, 631, 4864, 3794, 1900, 2897, 570, 12, 2737, 701, 199, 3, 15882, 13, 28957, 641, 3868, 85, 1603, 348, 221, 1520, 4114, 26, 2417, 26, 1085, 7800, 14, 199, 3, 199, 3, 961, 570, 365, 22711, 342, 68, 543, 314, 1453, 2082, 663, 370, 2399, 199, 3, 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, 747, 199, 646, 984, 199, 199, 3, 3161, 15882, 486, 17787, 199, 1274, 14, 515, 14, 3176, 8, 16, 12, 747, 14, 515, 14, 4832, 360, 8008, 832, 1333, 199, 646, 15882, 63, 25372, 199, 199, 3, 16306, 4621, 543, 22965, 5124, 199, 893, 26, 272, 687, 1683, 492, 4420, 465, 10079, 199, 2590, 3545, 26, 272, 687, 2882, 14, 1805, 492, 10079, 199, 199, 533, 4420, 8, 11988, 304, 272, 768, 3744, 272, 347, 636, 5675, 721, 1886, 12, 536, 304, 288, 372, 4420, 342, 199, 199, 17749, 63, 21194, 275, 359, 272, 283, 22691, 297, 272, 283, 73, 647, 8583, 297, 272, 283, 74, 28022, 351, 297, 272, 283, 19174, 297, 272, 283, 9156, 898, 14, 3425, 297, 272, 283, 5633, 29377, 297, 272, 283, 15718, 7, 199, 61, 199, 199, 893, 26, 272, 984, 14, 3112, 14, 873, 1332, 1494, 63, 354, 12, 4420, 1012, 367, 3413, 63, 354, 315, 10362, 2504, 63, 21194, 9, 199, 2590, 18306, 438, 547, 26, 272, 986, 421, 199, 14337, 63, 3671, 275, 298, 1548, 19, 2, 199, 199, 3, 1553, 1696, 2897, 9527, 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, 199, 3, 5478, 17262, 543, 10229, 334, 4579, 283, 8008, 14, 832, 24915, 503, 2195, 3537, 199, 3, 7869, 14, 199, 5359, 275, 359, 272, 283, 8008, 14, 832, 14, 28056, 297, 272, 283, 8008, 14, 832, 14, 3442, 15863, 297, 272, 283, 8008, 14, 832, 14, 2542, 16721, 265, 297, 272, 283, 8008, 63, 25372, 14, 2268, 63, 25372, 7, 199, 61, 16478, 327, 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, 8, 397, 9, 402, 1350, 6203, 14, 199, 3, 2047, 883, 4165, 3663, 4739, 465, 282, 769, 402, 1059, 26, 199, 3, 1350, 63, 4511, 275, 18953, 8332, 297, 1987, 1064, 418, 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, 283, 1545, 631, 4864, 7, 199, 7307, 275, 283, 9261, 12, 3107, 1225, 428, 65, 3566, 7, 199, 2502, 275, 283, 58, 1225, 428, 65, 3566, 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, 16, 14, 17, 7, 199, 3, 710, 2615, 1015, 12, 5893, 5131, 15, 5683, 15, 1195, 3762, 14, 199, 3221, 275, 283, 16, 14, 17, 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, 199, 3, 961, 365, 2597, 1202, 340, 1265, 886, 1564, 7761, 4799, 9796, 6230, 18238, 14, 199, 3, 24612, 1265, 663, 298, 3671, 2, 687, 314, 1414, 1004, 367, 3520, 5560, 14, 199, 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, 3, 961, 7970, 2597, 7763, 370, 3517, 63, 1986, 63, 515, 436, 3517, 63, 2911, 63, 515, 199, 5473, 63, 7435, 275, 4044, 1506, 297, 283, 2719, 23135, 14, 697, 297, 1987, 3177, 63, 5502, 418, 199, 199, 3, 710, 20883, 849, 4719, 334, 2972, 367, 642, 9189, 26, 658, 505, 10522, 370, 675, 367, 1006, 199, 3, 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, 885, 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, 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,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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 ]
a20012251/dd-agent
checks.d/gearmand.py
34
2314
# 3rd party import gearman # project from checks import AgentCheck class Gearman(AgentCheck): SERVICE_CHECK_NAME = 'gearman.can_connect' def get_library_versions(self): return {"gearman": gearman.__version__} def _get_client(self,host,port): self.log.debug("Connecting to gearman at address %s:%s" % (host, port)) return gearman.GearmanAdminClient(["%s:%s" % (host, port)]) def _get_metrics(self, client, tags): data = client.get_status() running = 0 queued = 0 workers = 0 for stat in data: running += stat['running'] queued += stat['queued'] workers += stat['workers'] unique_tasks = len(data) self.gauge("gearman.unique_tasks", unique_tasks, tags=tags) self.gauge("gearman.running", running, tags=tags) self.gauge("gearman.queued", queued, tags=tags) self.gauge("gearman.workers", workers, tags=tags) self.log.debug("running %d, queued %d, unique tasks %d, workers: %d" % (running, queued, unique_tasks, workers)) def _get_conf(self, instance): host = instance.get('server', None) port = instance.get('port', None) if host is None: self.warning("Host not set, assuming 127.0.0.1") host = "127.0.0.1" if port is None: self.warning("Port is not set, assuming 4730") port = 4730 tags = instance.get('tags', []) return host, port, tags def check(self, instance): self.log.debug("Gearman check start") host, port, tags = self._get_conf(instance) service_check_tags = ["server:{0}".format(host), "port:{0}".format(port)] client = self._get_client(host, port) self.log.debug("Connected to gearman") tags += service_check_tags try: self._get_metrics(client, tags) self.service_check(self.SERVICE_CHECK_NAME, AgentCheck.OK, message="Connection to %s:%s succeeded." % (host, port), tags=service_check_tags) except Exception as e: self.service_check(self.SERVICE_CHECK_NAME, AgentCheck.CRITICAL, message=str(e), tags=service_check_tags) raise
bsd-3-clause
[ 3, 650, 6883, 17135, 199, 646, 2312, 285, 1237, 199, 199, 3, 2199, 199, 504, 5920, 492, 19866, 1799, 199, 199, 533, 598, 2210, 1237, 8, 7788, 1799, 304, 272, 16655, 63, 8936, 63, 2339, 275, 283, 29571, 1237, 14, 2425, 63, 2242, 7, 339, 347, 664, 63, 4342, 63, 6234, 8, 277, 304, 267, 372, 2420, 29571, 1237, 582, 2312, 285, 1237, 855, 1023, 363, 93, 339, 347, 485, 362, 63, 1258, 8, 277, 12, 1102, 12, 719, 304, 267, 291, 14, 793, 14, 1757, 480, 32000, 370, 2312, 285, 1237, 737, 2287, 450, 83, 2689, 83, 2, 450, 334, 1102, 12, 1844, 430, 267, 372, 2312, 285, 1237, 14, 39, 2210, 1237, 4880, 3041, 30387, 83, 2689, 83, 2, 450, 288, 334, 1102, 12, 1844, 3948, 339, 347, 485, 362, 63, 6759, 8, 277, 12, 1890, 12, 3762, 304, 267, 666, 275, 1890, 14, 362, 63, 1205, 342, 267, 3879, 275, 378, 267, 26102, 275, 378, 267, 14123, 275, 378, 398, 367, 5672, 315, 666, 26, 288, 3879, 847, 5672, 459, 5720, 418, 288, 26102, 847, 5672, 459, 14268, 418, 288, 14123, 847, 5672, 459, 11009, 418, 398, 3747, 63, 5054, 275, 822, 8, 576, 9, 398, 291, 14, 26775, 480, 29571, 1237, 14, 3235, 63, 5054, 401, 3747, 63, 5054, 12, 3762, 29, 2969, 9, 267, 291, 14, 26775, 480, 29571, 1237, 14, 5720, 401, 3879, 12, 3762, 29, 2969, 9, 267, 291, 14, 26775, 480, 29571, 1237, 14, 14268, 401, 26102, 12, 3762, 29, 2969, 9, 267, 291, 14, 26775, 480, 29571, 1237, 14, 11009, 401, 14123, 12, 3762, 29, 2969, 9, 398, 291, 14, 793, 14, 1757, 480, 5720, 450, 68, 12, 26102, 450, 68, 12, 3747, 6527, 450, 68, 12, 14123, 26, 450, 68, 2, 267, 450, 334, 5720, 12, 26102, 12, 3747, 63, 5054, 12, 14123, 430, 339, 347, 485, 362, 63, 2190, 8, 277, 12, 1256, 304, 267, 1591, 275, 1256, 14, 362, 360, 1000, 297, 488, 9, 267, 1844, 275, 1256, 14, 362, 360, 719, 297, 488, 9, 398, 340, 1591, 365, 488, 26, 288, 291, 14, 3764, 480, 4965, 440, 663, 12, 18002, 12792, 14, 16, 14, 16, 14, 17, 531, 288, 1591, 275, 298, 4195, 14, 16, 14, 16, 14, 17, 2, 398, 340, 1844, 365, 488, 26, 288, 291, 14, 3764, 480, 4313, 365, 440, 663, 12, 18002, 10954, 1216, 531, 288, 1844, 275, 10954, 1216, 398, 3762, 275, 1256, 14, 362, 360, 2969, 297, 3073, 398, 372, 1591, 12, 1844, 12, 3762, 339, 347, 1104, 8, 277, 12, 1256, 304, 267, 291, 14, 793, 14, 1757, 480, 39, 2210, 1237, 1104, 1343, 531, 398, 1591, 12, 1844, 12, 3762, 275, 291, 423, 362, 63, 2190, 8, 842, 9, 267, 2435, 63, 1074, 63, 2969, 275, 2097, 1000, 14534, 16, 5469, 908, 8, 1102, 395, 288, 298, 719, 14534, 16, 5469, 908, 8, 719, 1874, 398, 1890, 275, 291, 423, 362, 63, 1258, 8, 1102, 12, 1844, 9, 267, 291, 14, 793, 14, 1757, 480, 16382, 370, 2312, 285, 1237, 531, 398, 3762, 847, 2435, 63, 1074, 63, 2969, 398, 862, 26, 288, 291, 423, 362, 63, 6759, 8, 1258, 12, 3762, 9, 288, 291, 14, 1364, 63, 1074, 8, 277, 14, 10486, 63, 8936, 63, 2339, 12, 19866, 1799, 14, 3593, 12, 355, 1245, 628, 3225, 370, 450, 83, 2689, 83, 19268, 2122, 450, 334, 1102, 12, 1844, 395, 355, 3762, 29, 1364, 63, 1074, 63, 2969, 9, 267, 871, 2186, 465, 325, 26, 288, 291, 14, 1364, 63, 1074, 8, 277, 14, 10486, 63, 8936, 63, 2339, 12, 19866, 1799, 14, 21539, 12, 355, 1245, 29, 495, 8, 69, 395, 3762, 29, 1364, 63, 1074, 63, 2969, 9, 288, 746, 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 ]
[ 650, 6883, 17135, 199, 646, 2312, 285, 1237, 199, 199, 3, 2199, 199, 504, 5920, 492, 19866, 1799, 199, 199, 533, 598, 2210, 1237, 8, 7788, 1799, 304, 272, 16655, 63, 8936, 63, 2339, 275, 283, 29571, 1237, 14, 2425, 63, 2242, 7, 339, 347, 664, 63, 4342, 63, 6234, 8, 277, 304, 267, 372, 2420, 29571, 1237, 582, 2312, 285, 1237, 855, 1023, 363, 93, 339, 347, 485, 362, 63, 1258, 8, 277, 12, 1102, 12, 719, 304, 267, 291, 14, 793, 14, 1757, 480, 32000, 370, 2312, 285, 1237, 737, 2287, 450, 83, 2689, 83, 2, 450, 334, 1102, 12, 1844, 430, 267, 372, 2312, 285, 1237, 14, 39, 2210, 1237, 4880, 3041, 30387, 83, 2689, 83, 2, 450, 288, 334, 1102, 12, 1844, 3948, 339, 347, 485, 362, 63, 6759, 8, 277, 12, 1890, 12, 3762, 304, 267, 666, 275, 1890, 14, 362, 63, 1205, 342, 267, 3879, 275, 378, 267, 26102, 275, 378, 267, 14123, 275, 378, 398, 367, 5672, 315, 666, 26, 288, 3879, 847, 5672, 459, 5720, 418, 288, 26102, 847, 5672, 459, 14268, 418, 288, 14123, 847, 5672, 459, 11009, 418, 398, 3747, 63, 5054, 275, 822, 8, 576, 9, 398, 291, 14, 26775, 480, 29571, 1237, 14, 3235, 63, 5054, 401, 3747, 63, 5054, 12, 3762, 29, 2969, 9, 267, 291, 14, 26775, 480, 29571, 1237, 14, 5720, 401, 3879, 12, 3762, 29, 2969, 9, 267, 291, 14, 26775, 480, 29571, 1237, 14, 14268, 401, 26102, 12, 3762, 29, 2969, 9, 267, 291, 14, 26775, 480, 29571, 1237, 14, 11009, 401, 14123, 12, 3762, 29, 2969, 9, 398, 291, 14, 793, 14, 1757, 480, 5720, 450, 68, 12, 26102, 450, 68, 12, 3747, 6527, 450, 68, 12, 14123, 26, 450, 68, 2, 267, 450, 334, 5720, 12, 26102, 12, 3747, 63, 5054, 12, 14123, 430, 339, 347, 485, 362, 63, 2190, 8, 277, 12, 1256, 304, 267, 1591, 275, 1256, 14, 362, 360, 1000, 297, 488, 9, 267, 1844, 275, 1256, 14, 362, 360, 719, 297, 488, 9, 398, 340, 1591, 365, 488, 26, 288, 291, 14, 3764, 480, 4965, 440, 663, 12, 18002, 12792, 14, 16, 14, 16, 14, 17, 531, 288, 1591, 275, 298, 4195, 14, 16, 14, 16, 14, 17, 2, 398, 340, 1844, 365, 488, 26, 288, 291, 14, 3764, 480, 4313, 365, 440, 663, 12, 18002, 10954, 1216, 531, 288, 1844, 275, 10954, 1216, 398, 3762, 275, 1256, 14, 362, 360, 2969, 297, 3073, 398, 372, 1591, 12, 1844, 12, 3762, 339, 347, 1104, 8, 277, 12, 1256, 304, 267, 291, 14, 793, 14, 1757, 480, 39, 2210, 1237, 1104, 1343, 531, 398, 1591, 12, 1844, 12, 3762, 275, 291, 423, 362, 63, 2190, 8, 842, 9, 267, 2435, 63, 1074, 63, 2969, 275, 2097, 1000, 14534, 16, 5469, 908, 8, 1102, 395, 288, 298, 719, 14534, 16, 5469, 908, 8, 719, 1874, 398, 1890, 275, 291, 423, 362, 63, 1258, 8, 1102, 12, 1844, 9, 267, 291, 14, 793, 14, 1757, 480, 16382, 370, 2312, 285, 1237, 531, 398, 3762, 847, 2435, 63, 1074, 63, 2969, 398, 862, 26, 288, 291, 423, 362, 63, 6759, 8, 1258, 12, 3762, 9, 288, 291, 14, 1364, 63, 1074, 8, 277, 14, 10486, 63, 8936, 63, 2339, 12, 19866, 1799, 14, 3593, 12, 355, 1245, 628, 3225, 370, 450, 83, 2689, 83, 19268, 2122, 450, 334, 1102, 12, 1844, 395, 355, 3762, 29, 1364, 63, 1074, 63, 2969, 9, 267, 871, 2186, 465, 325, 26, 288, 291, 14, 1364, 63, 1074, 8, 277, 14, 10486, 63, 8936, 63, 2339, 12, 19866, 1799, 14, 21539, 12, 355, 1245, 29, 495, 8, 69, 395, 3762, 29, 1364, 63, 1074, 63, 2969, 9, 288, 746, 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, 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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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 ]
tchx84/debian-pkg-sugar
extensions/cpsection/aboutme/model.py
9
4490
# Copyright (C) 2008 One Laptop Per Child # Copyright (C) 2010-14, Sugar Labs # Copyright (C) 2010-14, Walter Bender # # 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA # from gettext import gettext as _ from gi.repository import Gio from sugar3 import profile _COLORS = { 'red': {'dark': '#b20008', 'medium': '#e6000a', 'light': '#ffadce'}, 'orange': {'dark': '#9a5200', 'medium': '#c97e00', 'light': '#ffc169'}, 'yellow': {'dark': '#807500', 'medium': '#be9e00', 'light': '#fffa00'}, 'green': {'dark': '#008009', 'medium': '#00b20d', 'light': '#8bff7a'}, 'blue': {'dark': '#00588c', 'medium': '#005fe4', 'light': '#bccdff'}, 'purple': {'dark': '#5e008c', 'medium': '#7f00bf', 'light': '#d1a3ff'}, } _MODIFIERS = ('dark', 'medium', 'light') def get_nick(): return profile.get_nick_name() def print_nick(): print get_nick() def set_nick(nick): """Set the nickname. nick : e.g. 'walter' """ if not nick: raise ValueError(_('You must enter a name.')) if not isinstance(nick, unicode): nick = unicode(nick, 'utf-8') settings = Gio.Settings('org.sugarlabs.user') settings.set_string('nick', nick) # DEPRECATED from gi.repository import GConf client = GConf.Client.get_default() client.set_string('/desktop/sugar/user/nick', nick) return 1 def get_color(): settings = Gio.Settings('org.sugarlabs.user') return settings.get_string('color') def print_color(): color_string = get_color() tmp = color_string.split(',') stroke_tuple = None fill_tuple = None for color in _COLORS: for hue in _COLORS[color]: if _COLORS[color][hue] == tmp[0]: stroke_tuple = (color, hue) if _COLORS[color][hue] == tmp[1]: fill_tuple = (color, hue) if stroke_tuple is not None: print _('stroke: color=%s hue=%s') % (stroke_tuple[0], stroke_tuple[1]) else: print _('stroke: %s') % (tmp[0]) if fill_tuple is not None: print _('fill: color=%s hue=%s') % (fill_tuple[0], fill_tuple[1]) else: print _('fill: %s') % (tmp[1]) def set_color(stroke, fill, stroke_modifier='medium', fill_modifier='medium'): """Set the system color by setting a fill and stroke color. fill : [red, orange, yellow, blue, green, purple] stroke : [red, orange, yellow, blue, green, purple] hue stroke : [dark, medium, light] (optional) hue fill : [dark, medium, light] (optional) """ if stroke_modifier not in _MODIFIERS or fill_modifier not in _MODIFIERS: print (_('Error in specified color modifiers.')) return if stroke not in _COLORS or fill not in _COLORS: print (_('Error in specified colors.')) return if stroke_modifier == fill_modifier: if fill_modifier == 'medium': fill_modifier = 'light' else: fill_modifier = 'medium' color = _COLORS[stroke][stroke_modifier] + ',' \ + _COLORS[fill][fill_modifier] settings = Gio.Settings('org.sugarlabs.user') settings.set_string('color', color) # DEPRECATED from gi.repository import GConf client = GConf.Client.get_default() client.set_string('/desktop/sugar/user/color', color) return 1 def get_color_xo(): settings = Gio.Settings('org.sugarlabs.user') return settings.get_string('color') def set_color_xo(color): """Set a color with an XoColor This method is used by the graphical user interface """ settings = Gio.Settings('org.sugarlabs.user') settings.set_string('color', color) # DEPRECATED from gi.repository import GConf client = GConf.Client.get_default() client.set_string('/desktop/sugar/user/color', color) return 1
gpl-2.0
[ 3, 1898, 334, 35, 9, 9079, 7309, 491, 439, 2119, 3492, 12988, 199, 3, 1898, 334, 35, 9, 7129, 13, 1079, 12, 428, 21922, 491, 2101, 199, 3, 1898, 334, 35, 9, 7129, 13, 1079, 12, 644, 11858, 699, 13747, 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, 499, 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, 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, 221, 11315, 13, 10067, 221, 8217, 199, 3, 199, 199, 504, 9796, 492, 9796, 465, 485, 199, 199, 504, 18895, 14, 8421, 492, 598, 2308, 199, 199, 504, 308, 21922, 19, 492, 4690, 199, 199, 63, 25671, 275, 469, 272, 283, 581, 356, 791, 13625, 356, 3943, 66, 8269, 24, 297, 283, 14345, 356, 3943, 69, 32623, 65, 297, 283, 4040, 356, 3943, 556, 350, 301, 2267, 272, 283, 22683, 356, 791, 13625, 356, 3943, 25, 65, 21, 1840, 297, 283, 14345, 356, 3943, 67, 2576, 69, 383, 297, 283, 4040, 356, 3943, 26299, 10143, 2267, 272, 283, 14514, 356, 791, 13625, 356, 3943, 1257, 2194, 383, 297, 283, 14345, 356, 3943, 1235, 25, 69, 383, 297, 283, 4040, 356, 3943, 556, 667, 383, 2267, 272, 283, 7731, 356, 791, 13625, 356, 3943, 383, 6718, 25, 297, 283, 14345, 356, 3943, 383, 66, 1165, 68, 297, 283, 4040, 356, 3943, 24, 66, 556, 23, 65, 2267, 272, 283, 6304, 356, 791, 13625, 356, 3943, 7972, 1299, 67, 297, 283, 14345, 356, 3943, 7972, 771, 20, 297, 283, 4040, 356, 3943, 21976, 23425, 2267, 272, 283, 6653, 11045, 356, 791, 13625, 356, 3943, 21, 69, 8662, 67, 297, 283, 14345, 356, 3943, 23, 70, 383, 4361, 297, 283, 4040, 356, 3943, 68, 17, 65, 19, 556, 2267, 199, 93, 199, 199, 63, 16422, 1976, 3960, 275, 661, 13625, 297, 283, 14345, 297, 283, 4040, 358, 421, 199, 318, 664, 63, 11082, 837, 272, 372, 4690, 14, 362, 63, 11082, 63, 354, 342, 421, 199, 318, 870, 63, 11082, 837, 272, 870, 664, 63, 11082, 342, 421, 199, 318, 663, 63, 11082, 8, 11082, 304, 272, 408, 1084, 314, 24332, 14, 272, 14900, 520, 325, 14, 71, 14, 283, 87, 11858, 7, 272, 408, 272, 340, 440, 14900, 26, 267, 746, 1722, 6723, 5556, 1471, 9509, 282, 536, 12459, 272, 340, 440, 1228, 8, 11082, 12, 2649, 304, 267, 14900, 275, 2649, 8, 11082, 12, 283, 1624, 13, 24, 358, 272, 2202, 275, 598, 2308, 14, 5268, 360, 1308, 14, 83, 21922, 76, 2101, 14, 751, 358, 272, 2202, 14, 409, 63, 875, 360, 11082, 297, 14900, 9, 339, 327, 31404, 272, 687, 18895, 14, 8421, 492, 598, 8930, 272, 1890, 275, 598, 8930, 14, 3041, 14, 362, 63, 885, 342, 272, 1890, 14, 409, 63, 875, 2336, 14487, 15, 83, 21922, 15, 751, 15, 11082, 297, 14900, 9, 272, 372, 413, 421, 199, 318, 664, 63, 2326, 837, 272, 2202, 275, 598, 2308, 14, 5268, 360, 1308, 14, 83, 21922, 76, 2101, 14, 751, 358, 272, 372, 2202, 14, 362, 63, 875, 360, 2326, 358, 421, 199, 318, 870, 63, 2326, 837, 272, 3164, 63, 875, 275, 664, 63, 2326, 342, 272, 3529, 275, 3164, 63, 875, 14, 1294, 11917, 339, 22824, 63, 2960, 275, 488, 272, 5554, 63, 2960, 275, 488, 272, 367, 3164, 315, 485, 25671, 26, 267, 367, 28679, 315, 485, 25671, 59, 2326, 2189, 288, 340, 485, 25671, 59, 2326, 1527, 25016, 61, 508, 3529, 59, 16, 2189, 355, 22824, 63, 2960, 275, 334, 2326, 12, 28679, 9, 288, 340, 485, 25671, 59, 2326, 1527, 25016, 61, 508, 3529, 59, 17, 2189, 355, 5554, 63, 2960, 275, 334, 2326, 12, 28679, 9, 339, 340, 22824, 63, 2960, 365, 440, 488, 26, 267, 870, 4018, 11473, 26, 257, 3164, 2458, 83, 28679, 2458, 83, 358, 450, 334, 11473, 63, 2960, 59, 16, 467, 6059, 22824, 63, 2960, 59, 17, 566, 272, 587, 26, 267, 870, 4018, 11473, 26, 257, 450, 83, 358, 450, 334, 2791, 59, 16, 566, 272, 340, 5554, 63, 2960, 365, 440, 488, 26, 267, 870, 4018, 4498, 26, 258, 3164, 2458, 83, 28679, 2458, 83, 358, 450, 334, 4498, 63, 2960, 59, 16, 467, 5554, 63, 2960, 59, 17, 566, 272, 587, 26, 267, 870, 4018, 4498, 26, 258, 450, 83, 358, 450, 334, 2791, 59, 17, 566, 421, 199, 318, 663, 63, 2326, 8, 11473, 12, 5554, 12, 22824, 63, 18156, 534, 14345, 297, 5554, 63, 18156, 534, 14345, 735, 272, 408, 1084, 314, 2656, 3164, 701, 4260, 282, 5554, 436, 22824, 3164, 14, 272, 5554, 520, 359, 581, 12, 29713, 12, 31194, 12, 10030, 12, 12431, 12, 5861, 11045, 61, 272, 22824, 520, 359, 581, 12, 29713, 12, 31194, 12, 10030, 12, 12431, 12, 5861, 11045, 61, 272, 28679, 22824, 520, 359, 13625, 12, 21576, 12, 10540, 61, 334, 4144, 9, 272, 28679, 5554, 520, 359, 13625, 12, 21576, 12, 10540, 61, 334, 4144, 9, 272, 408, 339, 340, 22824, 63, 18156, 440, 315, 485, 16422, 1976, 3960, 503, 5554, 63, 18156, 440, 315, 485, 16422, 1976, 3960, 26, 267, 870, 21790, 547, 315, 2013, 3164, 9933, 12459, 267, 372, 272, 340, 22824, 440, 315, 485, 25671, 503, 5554, 440, 315, 485, 25671, 26, 267, 870, 21790, 547, 315, 2013, 9229, 12459, 267, 372, 339, 340, 22824, 63, 18156, 508, 5554, 63, 18156, 26, 267, 340, 5554, 63, 18156, 508, 283, 14345, 356, 288, 5554, 63, 18156 ]
[ 1898, 334, 35, 9, 9079, 7309, 491, 439, 2119, 3492, 12988, 199, 3, 1898, 334, 35, 9, 7129, 13, 1079, 12, 428, 21922, 491, 2101, 199, 3, 1898, 334, 35, 9, 7129, 13, 1079, 12, 644, 11858, 699, 13747, 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, 499, 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, 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, 221, 11315, 13, 10067, 221, 8217, 199, 3, 199, 199, 504, 9796, 492, 9796, 465, 485, 199, 199, 504, 18895, 14, 8421, 492, 598, 2308, 199, 199, 504, 308, 21922, 19, 492, 4690, 199, 199, 63, 25671, 275, 469, 272, 283, 581, 356, 791, 13625, 356, 3943, 66, 8269, 24, 297, 283, 14345, 356, 3943, 69, 32623, 65, 297, 283, 4040, 356, 3943, 556, 350, 301, 2267, 272, 283, 22683, 356, 791, 13625, 356, 3943, 25, 65, 21, 1840, 297, 283, 14345, 356, 3943, 67, 2576, 69, 383, 297, 283, 4040, 356, 3943, 26299, 10143, 2267, 272, 283, 14514, 356, 791, 13625, 356, 3943, 1257, 2194, 383, 297, 283, 14345, 356, 3943, 1235, 25, 69, 383, 297, 283, 4040, 356, 3943, 556, 667, 383, 2267, 272, 283, 7731, 356, 791, 13625, 356, 3943, 383, 6718, 25, 297, 283, 14345, 356, 3943, 383, 66, 1165, 68, 297, 283, 4040, 356, 3943, 24, 66, 556, 23, 65, 2267, 272, 283, 6304, 356, 791, 13625, 356, 3943, 7972, 1299, 67, 297, 283, 14345, 356, 3943, 7972, 771, 20, 297, 283, 4040, 356, 3943, 21976, 23425, 2267, 272, 283, 6653, 11045, 356, 791, 13625, 356, 3943, 21, 69, 8662, 67, 297, 283, 14345, 356, 3943, 23, 70, 383, 4361, 297, 283, 4040, 356, 3943, 68, 17, 65, 19, 556, 2267, 199, 93, 199, 199, 63, 16422, 1976, 3960, 275, 661, 13625, 297, 283, 14345, 297, 283, 4040, 358, 421, 199, 318, 664, 63, 11082, 837, 272, 372, 4690, 14, 362, 63, 11082, 63, 354, 342, 421, 199, 318, 870, 63, 11082, 837, 272, 870, 664, 63, 11082, 342, 421, 199, 318, 663, 63, 11082, 8, 11082, 304, 272, 408, 1084, 314, 24332, 14, 272, 14900, 520, 325, 14, 71, 14, 283, 87, 11858, 7, 272, 408, 272, 340, 440, 14900, 26, 267, 746, 1722, 6723, 5556, 1471, 9509, 282, 536, 12459, 272, 340, 440, 1228, 8, 11082, 12, 2649, 304, 267, 14900, 275, 2649, 8, 11082, 12, 283, 1624, 13, 24, 358, 272, 2202, 275, 598, 2308, 14, 5268, 360, 1308, 14, 83, 21922, 76, 2101, 14, 751, 358, 272, 2202, 14, 409, 63, 875, 360, 11082, 297, 14900, 9, 339, 327, 31404, 272, 687, 18895, 14, 8421, 492, 598, 8930, 272, 1890, 275, 598, 8930, 14, 3041, 14, 362, 63, 885, 342, 272, 1890, 14, 409, 63, 875, 2336, 14487, 15, 83, 21922, 15, 751, 15, 11082, 297, 14900, 9, 272, 372, 413, 421, 199, 318, 664, 63, 2326, 837, 272, 2202, 275, 598, 2308, 14, 5268, 360, 1308, 14, 83, 21922, 76, 2101, 14, 751, 358, 272, 372, 2202, 14, 362, 63, 875, 360, 2326, 358, 421, 199, 318, 870, 63, 2326, 837, 272, 3164, 63, 875, 275, 664, 63, 2326, 342, 272, 3529, 275, 3164, 63, 875, 14, 1294, 11917, 339, 22824, 63, 2960, 275, 488, 272, 5554, 63, 2960, 275, 488, 272, 367, 3164, 315, 485, 25671, 26, 267, 367, 28679, 315, 485, 25671, 59, 2326, 2189, 288, 340, 485, 25671, 59, 2326, 1527, 25016, 61, 508, 3529, 59, 16, 2189, 355, 22824, 63, 2960, 275, 334, 2326, 12, 28679, 9, 288, 340, 485, 25671, 59, 2326, 1527, 25016, 61, 508, 3529, 59, 17, 2189, 355, 5554, 63, 2960, 275, 334, 2326, 12, 28679, 9, 339, 340, 22824, 63, 2960, 365, 440, 488, 26, 267, 870, 4018, 11473, 26, 257, 3164, 2458, 83, 28679, 2458, 83, 358, 450, 334, 11473, 63, 2960, 59, 16, 467, 6059, 22824, 63, 2960, 59, 17, 566, 272, 587, 26, 267, 870, 4018, 11473, 26, 257, 450, 83, 358, 450, 334, 2791, 59, 16, 566, 272, 340, 5554, 63, 2960, 365, 440, 488, 26, 267, 870, 4018, 4498, 26, 258, 3164, 2458, 83, 28679, 2458, 83, 358, 450, 334, 4498, 63, 2960, 59, 16, 467, 5554, 63, 2960, 59, 17, 566, 272, 587, 26, 267, 870, 4018, 4498, 26, 258, 450, 83, 358, 450, 334, 2791, 59, 17, 566, 421, 199, 318, 663, 63, 2326, 8, 11473, 12, 5554, 12, 22824, 63, 18156, 534, 14345, 297, 5554, 63, 18156, 534, 14345, 735, 272, 408, 1084, 314, 2656, 3164, 701, 4260, 282, 5554, 436, 22824, 3164, 14, 272, 5554, 520, 359, 581, 12, 29713, 12, 31194, 12, 10030, 12, 12431, 12, 5861, 11045, 61, 272, 22824, 520, 359, 581, 12, 29713, 12, 31194, 12, 10030, 12, 12431, 12, 5861, 11045, 61, 272, 28679, 22824, 520, 359, 13625, 12, 21576, 12, 10540, 61, 334, 4144, 9, 272, 28679, 5554, 520, 359, 13625, 12, 21576, 12, 10540, 61, 334, 4144, 9, 272, 408, 339, 340, 22824, 63, 18156, 440, 315, 485, 16422, 1976, 3960, 503, 5554, 63, 18156, 440, 315, 485, 16422, 1976, 3960, 26, 267, 870, 21790, 547, 315, 2013, 3164, 9933, 12459, 267, 372, 272, 340, 22824, 440, 315, 485, 25671, 503, 5554, 440, 315, 485, 25671, 26, 267, 870, 21790, 547, 315, 2013, 9229, 12459, 267, 372, 339, 340, 22824, 63, 18156, 508, 5554, 63, 18156, 26, 267, 340, 5554, 63, 18156, 508, 283, 14345, 356, 288, 5554, 63, 18156, 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, 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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 ]
saikrishnar/vsm_preparer
scripts/quincontext.py
1
1778
#! /usr/bin/python import os def main(folder): #vectors = [] #f = open('../dictionary/vectors.txt') #for line in f: # representation = line.strip('\n') # vectors.append(representation) #f.close() for d, ds, fs in os.walk(folder): for fname in fs: if fname[-4:] != '.dur': continue fullfname = d + '/' + fname phone_array = [] dur_array = [] fr = open(fullfname) for line in fr: if line.split('\n')[0] == '#': continue [phone, dur] = line.rstrip('\n').split() phone_array.append(phone) dur_array.append(dur) fw = open(fullfname[:-4] + '.quindur', 'w') for i in range(2, len(dur_array) - 2 ): phoneme_2p = phone_array[i-2] #phoneme_2p_index = uniquephone_list.index(phoneme_2p) phoneme_1p = phone_array[i-1] #phoneme_1p_index = uniquephone_list.index(phoneme_1p) phoneme = phone_array[i] #phoneme_index = uniquephone_list.index(phoneme) phoneme_1n = phone_array[i+1] #phoneme_1n_index = uniquephone_list.index(phoneme_1n) phoneme_2n = phone_array[i+2] #phoneme_2n_index = uniquephone_list.index(phoneme_2n) duration = dur_array[i] fw.write( str(float(duration)) + ' ' + phoneme_2p + ' ' + phoneme_1p + ' ' + phoneme + ' ' + phoneme_1n + ' ' + phoneme_2n + '\n') fw.close() fr.close() if __name__ == '__main__': folder = '../lab' main(folder)
gpl-2.0
[ 3168, 1182, 2647, 15, 1393, 15, 1548, 199, 646, 747, 199, 199, 318, 2446, 8, 3741, 304, 1362, 327, 12280, 275, 942, 221, 1362, 327, 70, 275, 1551, 24592, 9086, 15, 12280, 14, 2424, 358, 1362, 327, 509, 1004, 315, 289, 26, 1362, 327, 259, 6025, 275, 1004, 14, 1913, 2258, 78, 358, 1362, 327, 259, 11102, 14, 740, 8, 22903, 9, 1362, 327, 70, 14, 1600, 342, 1362, 367, 366, 12, 6364, 12, 7449, 315, 747, 14, 7757, 8, 3741, 304, 267, 367, 6748, 315, 7449, 26, 288, 340, 6748, 1988, 20, 2938, 1137, 1987, 30695, 356, 355, 1980, 288, 289, 348, 276, 354, 275, 366, 435, 7324, 435, 6748, 288, 14617, 63, 1144, 275, 942, 288, 366, 300, 63, 1144, 275, 942, 288, 9513, 275, 1551, 8, 1893, 276, 354, 9, 288, 367, 1004, 315, 9513, 26, 355, 340, 1004, 14, 1294, 2258, 78, 5832, 16, 61, 508, 32326, 673, 1980, 355, 359, 9339, 12, 366, 300, 61, 275, 1004, 14, 6735, 2258, 78, 1959, 1294, 342, 355, 14617, 63, 1144, 14, 740, 8, 9339, 9, 355, 366, 300, 63, 1144, 14, 740, 8, 30695, 9, 288, 13908, 275, 1551, 8, 1893, 276, 354, 4439, 20, 61, 435, 1987, 392, 688, 300, 297, 283, 87, 358, 288, 367, 284, 315, 1425, 8, 18, 12, 822, 8, 30695, 63, 1144, 9, 446, 499, 3461, 221, 2151, 14617, 278, 63, 18, 80, 275, 14617, 63, 1144, 59, 73, 13, 18, 61, 2151, 327, 9339, 278, 63, 18, 80, 63, 1080, 275, 3747, 9339, 63, 513, 14, 1080, 8, 9339, 278, 63, 18, 80, 9, 199, 2151, 14617, 278, 63, 17, 80, 275, 14617, 63, 1144, 59, 73, 13, 17, 61, 2151, 327, 9339, 278, 63, 17, 80, 63, 1080, 275, 3747, 9339, 63, 513, 14, 1080, 8, 9339, 278, 63, 17, 80, 9, 199, 2151, 14617, 278, 275, 14617, 63, 1144, 59, 73, 61, 2151, 327, 9339, 278, 63, 1080, 275, 3747, 9339, 63, 513, 14, 1080, 8, 9339, 278, 9, 199, 2151, 14617, 278, 63, 17, 78, 275, 14617, 63, 1144, 59, 73, 11, 17, 61, 2151, 327, 9339, 278, 63, 17, 78, 63, 1080, 275, 3747, 9339, 63, 513, 14, 1080, 8, 9339, 278, 63, 17, 78, 9, 199, 2151, 14617, 278, 63, 18, 78, 275, 14617, 63, 1144, 59, 73, 11, 18, 61, 2151, 327, 9339, 278, 63, 18, 78, 63, 1080, 275, 3747, 9339, 63, 513, 14, 1080, 8, 9339, 278, 63, 18, 78, 9, 199, 2151, 7373, 275, 366, 300, 63, 1144, 59, 73, 61, 2151, 13908, 14, 952, 8, 620, 8, 1609, 8, 5553, 430, 435, 283, 283, 435, 14617, 278, 63, 18, 80, 435, 283, 283, 435, 14617, 278, 63, 17, 80, 435, 283, 283, 435, 14617, 278, 435, 283, 283, 435, 14617, 278, 63, 17, 78, 435, 283, 283, 435, 14617, 278, 63, 18, 78, 435, 1557, 78, 358, 288, 13908, 14, 1600, 342, 288, 9513, 14, 1600, 342, 421, 199, 692, 636, 354, 363, 508, 2560, 973, 3706, 272, 4922, 275, 20644, 5561, 7, 272, 2446, 8, 3741, 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 ]
[ 1182, 2647, 15, 1393, 15, 1548, 199, 646, 747, 199, 199, 318, 2446, 8, 3741, 304, 1362, 327, 12280, 275, 942, 221, 1362, 327, 70, 275, 1551, 24592, 9086, 15, 12280, 14, 2424, 358, 1362, 327, 509, 1004, 315, 289, 26, 1362, 327, 259, 6025, 275, 1004, 14, 1913, 2258, 78, 358, 1362, 327, 259, 11102, 14, 740, 8, 22903, 9, 1362, 327, 70, 14, 1600, 342, 1362, 367, 366, 12, 6364, 12, 7449, 315, 747, 14, 7757, 8, 3741, 304, 267, 367, 6748, 315, 7449, 26, 288, 340, 6748, 1988, 20, 2938, 1137, 1987, 30695, 356, 355, 1980, 288, 289, 348, 276, 354, 275, 366, 435, 7324, 435, 6748, 288, 14617, 63, 1144, 275, 942, 288, 366, 300, 63, 1144, 275, 942, 288, 9513, 275, 1551, 8, 1893, 276, 354, 9, 288, 367, 1004, 315, 9513, 26, 355, 340, 1004, 14, 1294, 2258, 78, 5832, 16, 61, 508, 32326, 673, 1980, 355, 359, 9339, 12, 366, 300, 61, 275, 1004, 14, 6735, 2258, 78, 1959, 1294, 342, 355, 14617, 63, 1144, 14, 740, 8, 9339, 9, 355, 366, 300, 63, 1144, 14, 740, 8, 30695, 9, 288, 13908, 275, 1551, 8, 1893, 276, 354, 4439, 20, 61, 435, 1987, 392, 688, 300, 297, 283, 87, 358, 288, 367, 284, 315, 1425, 8, 18, 12, 822, 8, 30695, 63, 1144, 9, 446, 499, 3461, 221, 2151, 14617, 278, 63, 18, 80, 275, 14617, 63, 1144, 59, 73, 13, 18, 61, 2151, 327, 9339, 278, 63, 18, 80, 63, 1080, 275, 3747, 9339, 63, 513, 14, 1080, 8, 9339, 278, 63, 18, 80, 9, 199, 2151, 14617, 278, 63, 17, 80, 275, 14617, 63, 1144, 59, 73, 13, 17, 61, 2151, 327, 9339, 278, 63, 17, 80, 63, 1080, 275, 3747, 9339, 63, 513, 14, 1080, 8, 9339, 278, 63, 17, 80, 9, 199, 2151, 14617, 278, 275, 14617, 63, 1144, 59, 73, 61, 2151, 327, 9339, 278, 63, 1080, 275, 3747, 9339, 63, 513, 14, 1080, 8, 9339, 278, 9, 199, 2151, 14617, 278, 63, 17, 78, 275, 14617, 63, 1144, 59, 73, 11, 17, 61, 2151, 327, 9339, 278, 63, 17, 78, 63, 1080, 275, 3747, 9339, 63, 513, 14, 1080, 8, 9339, 278, 63, 17, 78, 9, 199, 2151, 14617, 278, 63, 18, 78, 275, 14617, 63, 1144, 59, 73, 11, 18, 61, 2151, 327, 9339, 278, 63, 18, 78, 63, 1080, 275, 3747, 9339, 63, 513, 14, 1080, 8, 9339, 278, 63, 18, 78, 9, 199, 2151, 7373, 275, 366, 300, 63, 1144, 59, 73, 61, 2151, 13908, 14, 952, 8, 620, 8, 1609, 8, 5553, 430, 435, 283, 283, 435, 14617, 278, 63, 18, 80, 435, 283, 283, 435, 14617, 278, 63, 17, 80, 435, 283, 283, 435, 14617, 278, 435, 283, 283, 435, 14617, 278, 63, 17, 78, 435, 283, 283, 435, 14617, 278, 63, 18, 78, 435, 1557, 78, 358, 288, 13908, 14, 1600, 342, 288, 9513, 14, 1600, 342, 421, 199, 692, 636, 354, 363, 508, 2560, 973, 3706, 272, 4922, 275, 20644, 5561, 7, 272, 2446, 8, 3741, 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, 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, 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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 ]
cjcjameson/gpdb
gpMgmt/bin/pythonSrc/PyGreSQL-4.0/pgdb.py
57
17608
#!/usr/bin/env python # # pgdb.py # # Written by D'Arcy J.M. Cain # # $Id: pgdb.py,v 1.54 2008/11/23 14:32:18 cito Exp $ # """pgdb - DB-API 2.0 compliant module for PygreSQL. (c) 1999, Pascal Andre <[email protected]>. See package documentation for further information on copyright. Inline documentation is sparse. See DB-API 2.0 specification for usage information: http://www.python.org/peps/pep-0249.html Basic usage: pgdb.connect(connect_string) # open a connection # connect_string = 'host:database:user:password:opt:tty' # All parts are optional. You may also pass host through # password as keyword arguments. To pass a port, # pass it in the host keyword parameter: pgdb.connect(host='localhost:5432') connection.cursor() # open a cursor cursor.execute(query[, params]) # Execute a query, binding params (a dictionary) if they are # passed. The binding syntax is the same as the % operator # for dictionaries, and no quoting is done. cursor.executemany(query, list of params) # Execute a query many times, binding each param dictionary # from the list. cursor.fetchone() # fetch one row, [value, value, ...] cursor.fetchall() # fetch all rows, [[value, value, ...], ...] cursor.fetchmany([size]) # returns size or cursor.arraysize number of rows, # [[value, value, ...], ...] from result set. # Default cursor.arraysize is 1. cursor.description # returns information about the columns # [(column_name, type_name, display_size, # internal_size, precision, scale, null_ok), ...] # Note that precision, scale and null_ok are not implemented. cursor.rowcount # number of rows available in the result set # Available after a call to execute. connection.commit() # commit transaction connection.rollback() # or rollback transaction cursor.close() # close the cursor connection.close() # close the connection """ from _pg import * import time try: frozenset except NameError: # Python < 2.4 from sets import ImmutableSet as frozenset from datetime import datetime, timedelta try: # use Decimal if available from decimal import Decimal set_decimal(Decimal) except ImportError: # otherwise (Python < 2.4) Decimal = float # use float instead of Decimal ### Module Constants # compliant with DB SIG 2.0 apilevel = '2.0' # module may be shared, but not connections threadsafety = 1 # this module use extended python format codes paramstyle = 'pyformat' ### Internal Types Handling def decimal_type(decimal_type=None): """Get or set global type to be used for decimal values.""" global Decimal if decimal_type is not None: Decimal = decimal_type set_decimal(decimal_type) return Decimal def _cast_bool(value): return value[:1] in ['t', 'T'] def _cast_money(value): return Decimal(''.join(filter( lambda v: v in '0123456789.-', value))) _cast = {'bool': _cast_bool, 'int2': int, 'int4': int, 'serial': int, 'int8': long, 'oid': long, 'oid8': long, 'float4': float, 'float8': float, 'numeric': Decimal, 'money': _cast_money} class pgdbTypeCache(dict): """Cache for database types.""" def __init__(self, cnx): """Initialize type cache for connection.""" super(pgdbTypeCache, self).__init__() self._src = cnx.source() def typecast(typ, value): """Cast value to database type.""" if value is None: # for NULL values, no typecast is necessary return None cast = _cast.get(typ) if cast is None: # no typecast available or necessary return value else: return cast(value) typecast = staticmethod(typecast) def getdescr(self, oid): """Get name of database type with given oid.""" try: return self[oid] except KeyError: self._src.execute( "SELECT typname, typlen " "FROM pg_type WHERE oid=%s" % oid) res = self._src.fetch(1)[0] # The column name is omitted from the return value. # It will have to be prepended by the caller. res = (res[0], None, int(res[1]), None, None, None) self[oid] = res return res class _quotedict(dict): """Dictionary with auto quoting of its items. The quote attribute must be set to the desired quote function. """ def __getitem__(self, key): return self.quote(super(_quotedict, self).__getitem__(key)) ### Cursor Object class pgdbCursor(object): """Cursor Object.""" def __init__(self, dbcnx): """Create a cursor object for the database connection.""" self.connection = self._dbcnx = dbcnx self._cnx = dbcnx._cnx self._type_cache = dbcnx._type_cache self._src = self._cnx.source() self.description = None self.rowcount = -1 self.arraysize = 1 self.lastrowid = None def __iter__(self): """Return self to make cursors compatible to the iteration protocol.""" return self def _quote(self, val): """Quote value depending on its type.""" if isinstance(val, datetime): val = str(val) elif isinstance(val, unicode): val = val.encode( 'utf8' ) if isinstance(val, str): val = "'%s'" % self._cnx.escape_string(val) elif isinstance(val, (int, long, float)): pass elif val is None: val = 'NULL' elif isinstance(val, (list, tuple)): val = '(%s)' % ','.join(map(lambda v: str(self._quote(v)), val)) elif Decimal is not float and isinstance(val, Decimal): pass elif hasattr(val, '__pg_repr__'): val = val.__pg_repr__() else: raise InterfaceError( 'do not know how to handle type %s' % type(val)) return val def _quoteparams(self, string, params): """Quote parameters. This function works for both mappings and sequences. """ if isinstance(params, dict): params = _quotedict(params) params.quote = self._quote else: params = tuple(map(self._quote, params)) return string % params def row_factory(row): """Process rows before they are returned. You can overwrite this with a custom row factory, e.g. a dict factory: class myCursor(pgdb.pgdbCursor): def cursor.row_factory(self, row): d = {} for idx, col in enumerate(self.description): d[col[0]] = row[idx] return d cursor = myCursor(cnx) """ return row row_factory = staticmethod(row_factory) def close(self): """Close the cursor object.""" self._src.close() self.description = None self.rowcount = -1 self.lastrowid = None def execute(self, operation, params=None): """Prepare and execute a database operation (query or command).""" # The parameters may also be specified as list of # tuples to e.g. insert multiple rows in a single # operation, but this kind of usage is deprecated: if (params and isinstance(params, list) and isinstance(params[0], tuple)): self.executemany(operation, params) else: # not a list of tuples self.executemany(operation, (params,)) def executemany(self, operation, param_seq): """Prepare operation and execute it against a parameter sequence.""" if not param_seq: # don't do anything without parameters return self.description = None self.rowcount = -1 # first try to execute all queries totrows = 0 sql = "BEGIN" try: if not self._dbcnx._tnx: try: self._cnx.source().execute(sql) except Exception: raise OperationalError("can't start transaction") self._dbcnx._tnx = True for params in param_seq: if params: sql = self._quoteparams(operation, params) else: sql = operation rows = self._src.execute(sql) if rows: # true if not DML totrows += rows else: self.rowcount = -1 except Error, msg: raise DatabaseError("error '%s' in '%s'" % (msg, sql)) except Exception, err: raise OperationalError("internal error in '%s': %s" % (sql, err)) # then initialize result raw count and description if self._src.resulttype == RESULT_DQL: self.rowcount = self._src.ntuples getdescr = self._type_cache.getdescr coltypes = self._src.listinfo() self.description = [typ[1:2] + getdescr(typ[2]) for typ in coltypes] self.lastrowid = self._src.oidstatus() else: self.rowcount = totrows self.description = None self.lastrowid = self._src.oidstatus() def fetchone(self): """Fetch the next row of a query result set.""" res = self.fetchmany(1, False) try: return res[0] except IndexError: return None def fetchall(self): """Fetch all (remaining) rows of a query result.""" return self.fetchmany(-1, False) def fetchmany(self, size=None, keep=False): """Fetch the next set of rows of a query result. The number of rows to fetch per call is specified by the size parameter. If it is not given, the cursor's arraysize determines the number of rows to be fetched. If you set the keep parameter to true, this is kept as new arraysize. """ if size is None: size = self.arraysize if keep: self.arraysize = size try: result = self._src.fetch(size) except Error, err: raise DatabaseError(str(err)) row_factory = self.row_factory typecast = self._type_cache.typecast coltypes = [desc[1] for desc in self.description] return [row_factory([typecast(*args) for args in zip(coltypes, row)]) for row in result] def next(self): """Return the next row (support for the iteration protocol).""" res = self.fetchone() if res is None: raise StopIteration return res def nextset(): """Not supported.""" raise NotSupportedError("nextset() is not supported") nextset = staticmethod(nextset) def setinputsizes(sizes): """Not supported.""" pass setinputsizes = staticmethod(setinputsizes) def setoutputsize(size, column=0): """Not supported.""" pass setoutputsize = staticmethod(setoutputsize) ### Connection Objects class pgdbCnx(object): """Connection Object.""" # expose the exceptions as attributes on the connection object Error = Error Warning = Warning InterfaceError = InterfaceError DatabaseError = DatabaseError InternalError = InternalError OperationalError = OperationalError ProgrammingError = ProgrammingError IntegrityError = IntegrityError DataError = DataError NotSupportedError = NotSupportedError def __init__(self, cnx): """Create a database connection object.""" self._cnx = cnx # connection self._tnx = False # transaction state self._type_cache = pgdbTypeCache(cnx) try: self._cnx.source() except Exception: raise OperationalError("invalid connection") def close(self): """Close the connection object.""" if self._cnx: self._cnx.close() self._cnx = None else: raise OperationalError("connection has been closed") def commit(self): """Commit any pending transaction to the database.""" if self._cnx: if self._tnx: self._tnx = False try: self._cnx.source().execute("COMMIT") except Exception: raise OperationalError("can't commit") else: raise OperationalError("connection has been closed") def rollback(self): """Roll back to the start of any pending transaction.""" if self._cnx: if self._tnx: self._tnx = False try: self._cnx.source().execute("ROLLBACK") except Exception: raise OperationalError("can't rollback") else: raise OperationalError("connection has been closed") def cursor(self): """Return a new Cursor Object using the connection.""" if self._cnx: try: return pgdbCursor(self) except Exception: raise OperationalError("invalid connection") else: raise OperationalError("connection has been closed") ### Module Interface _connect_ = connect def connect(dsn=None, user=None, password=None, host=None, database=None): """Connects to a database.""" # first get params from DSN dbport = -1 dbhost = "" dbbase = "" dbuser = "" dbpasswd = "" dbopt = "" dbtty = "" try: params = dsn.split(":") dbhost = params[0] dbport = int(params[1]) dbbase = params[2] dbuser = params[3] dbpasswd = params[4] dbopt = params[5] dbtty = params[6] except (AttributeError, IndexError, TypeError): pass # override if necessary if user is not None: dbuser = user if password is not None: dbpasswd = password if database is not None: dbbase = database if host is not None: try: params = host.split(":") dbhost = params[0] dbport = int(params[1]) except (AttributeError, IndexError, TypeError, ValueError): pass # empty host is localhost if dbhost == "": dbhost = None if dbuser == "": dbuser = None # open the connection cnx = _connect_(dbbase, dbhost, dbport, dbopt, dbtty, dbuser, dbpasswd) return pgdbCnx(cnx) ### Types Handling class pgdbType(frozenset): """Type class for a couple of PostgreSQL data types. PostgreSQL is object-oriented: types are dynamic. We must thus use type names as internal type codes. """ if frozenset.__module__ == '__builtin__': def __new__(cls, values): if isinstance(values, basestring): values = values.split() return super(pgdbType, cls).__new__(cls, values) else: # Python < 2.4 def __init__(self, values): if isinstance(values, basestring): values = values.split() super(pgdbType, self).__init__(values) def __eq__(self, other): if isinstance(other, basestring): return other in self else: return super(pgdbType, self).__eq__(other) def __ne__(self, other): if isinstance(other, basestring): return other not in self else: return super(pgdbType, self).__ne__(other) # Mandatory type objects defined by DB-API 2 specs: STRING = pgdbType('char bpchar name text varchar') BINARY = pgdbType('bytea') NUMBER = pgdbType('int2 int4 serial int8 float4 float8 numeric money') DATETIME = pgdbType('date time timetz timestamp timestamptz datetime abstime' ' interval tinterval timespan reltime') ROWID = pgdbType('oid oid8') # Additional type objects (more specific): BOOL = pgdbType('bool') SMALLINT = pgdbType('int2') INTEGER = pgdbType('int2 int4 int8 serial') LONG = pgdbType('int8') FLOAT = pgdbType('float4 float8') NUMERIC = pgdbType('numeric') MONEY = pgdbType('money') DATE = pgdbType('date') TIME = pgdbType('time timetz') TIMESTAMP = pgdbType('timestamp timestamptz datetime abstime') INTERVAL = pgdbType('interval tinterval timespan reltime') # Mandatory type helpers defined by DB-API 2 specs: def Date(year, month, day): """Construct an object holding a date value.""" return datetime(year, month, day) def Time(hour, minute, second): """Construct an object holding a time value.""" return timedelta(hour, minute, second) def Timestamp(year, month, day, hour, minute, second): """construct an object holding a time stamp value.""" return datetime(year, month, day, hour, minute, second) def DateFromTicks(ticks): """Construct an object holding a date value from the given ticks value.""" return Date(*time.localtime(ticks)[:3]) def TimeFromTicks(ticks): """construct an object holding a time value from the given ticks value.""" return Time(*time.localtime(ticks)[3:6]) def TimestampFromTicks(ticks): """construct an object holding a time stamp from the given ticks value.""" return Timestamp(*time.localtime(ticks)[:6]) def Binary(value): """construct an object capable of holding a binary (long) string value.""" return value # If run as script, print some information: if __name__ == '__main__': print 'PyGreSQL version', version print print __doc__
apache-2.0
[ 3381, 2647, 15, 1393, 15, 1813, 2366, 199, 3, 199, 3, 10275, 697, 14, 647, 199, 3, 199, 3, 27694, 701, 577, 7, 27604, 89, 1603, 14, 45, 14, 445, 1581, 199, 3, 199, 3, 2672, 1304, 26, 10275, 697, 14, 647, 12, 86, 413, 14, 1477, 9079, 15, 845, 15, 1789, 4329, 26, 708, 26, 1085, 286, 24308, 7910, 2672, 199, 3, 199, 199, 624, 4198, 697, 446, 6249, 13, 3735, 499, 14, 16, 1013, 22676, 859, 367, 1611, 16268, 14, 199, 199, 8, 67, 9, 21300, 12, 510, 305, 915, 6061, 264, 665, 28547, 32, 12897, 14, 825, 80, 14, 4391, 10827, 199, 9295, 2559, 3794, 367, 9848, 2556, 641, 4248, 14, 199, 199, 10307, 3794, 365, 5178, 14, 199, 9295, 6249, 13, 3735, 499, 14, 16, 8929, 367, 4503, 2556, 26, 199, 1014, 921, 1544, 14, 1548, 14, 1308, 15, 321, 1190, 15, 12636, 13, 996, 1887, 14, 1360, 199, 199, 6845, 4503, 26, 339, 10275, 697, 14, 2242, 8, 2242, 63, 875, 9, 327, 1551, 282, 1950, 272, 327, 4907, 63, 875, 275, 283, 1102, 26, 4659, 26, 751, 26, 2060, 26, 2992, 26, 4707, 7, 272, 327, 2900, 4184, 787, 2716, 14, 2047, 1443, 2597, 986, 1591, 4012, 272, 327, 2505, 465, 4252, 2368, 14, 4005, 986, 282, 1844, 12, 272, 327, 986, 652, 315, 314, 1591, 4252, 2725, 26, 272, 10275, 697, 14, 2242, 8, 1102, 534, 5967, 26, 1477, 708, 358, 339, 1950, 14, 3937, 342, 327, 1551, 282, 3920, 339, 3920, 14, 2526, 8, 1131, 14675, 1862, 566, 272, 327, 17009, 282, 1827, 12, 11696, 1862, 334, 65, 2600, 9, 340, 2985, 787, 272, 327, 3032, 14, 710, 11696, 6302, 365, 314, 2011, 465, 314, 450, 4182, 272, 327, 367, 11196, 12, 436, 949, 18593, 365, 4224, 14, 339, 3920, 14, 31162, 8, 1131, 12, 769, 402, 1862, 9, 272, 327, 17009, 282, 1827, 5002, 5431, 12, 11696, 1924, 1215, 2600, 272, 327, 687, 314, 769, 14, 339, 3920, 14, 11591, 342, 327, 5267, 1373, 1962, 12, 359, 585, 12, 574, 12, 21214, 339, 3920, 14, 10174, 342, 327, 5267, 1006, 4730, 12, 3474, 585, 12, 574, 12, 2263, 467, 21214, 339, 3920, 14, 3535, 3479, 779, 890, 566, 272, 327, 2529, 1568, 503, 3920, 14, 1144, 890, 1329, 402, 4730, 12, 272, 327, 3474, 585, 12, 574, 12, 2263, 467, 21214, 687, 754, 663, 14, 272, 327, 3758, 3920, 14, 1144, 890, 365, 413, 14, 339, 3920, 14, 1802, 327, 2529, 2556, 3595, 314, 4362, 272, 327, 198, 7528, 2301, 63, 354, 12, 730, 63, 354, 12, 2929, 63, 890, 12, 272, 327, 198, 198, 4672, 63, 890, 12, 7151, 12, 4666, 12, 2973, 63, 745, 395, 21214, 272, 327, 3390, 626, 7151, 12, 4666, 436, 2973, 63, 745, 787, 440, 6366, 14, 339, 3920, 14, 24007, 327, 1329, 402, 4730, 2808, 315, 314, 754, 663, 272, 327, 23840, 2410, 282, 1240, 370, 5341, 14, 339, 1950, 14, 3543, 342, 327, 5532, 6008, 339, 1950, 14, 10437, 342, 327, 503, 16475, 6008, 339, 3920, 14, 1600, 342, 327, 4002, 314, 3920, 339, 1950, 14, 1600, 342, 327, 4002, 314, 1950, 199, 199, 624, 199, 199, 504, 485, 4198, 492, 627, 199, 646, 900, 199, 893, 26, 272, 9522, 199, 2590, 12746, 26, 327, 2018, 665, 499, 14, 20, 272, 687, 5951, 492, 25609, 1084, 465, 9522, 199, 504, 2197, 492, 2197, 12, 6871, 199, 893, 26, 327, 675, 6345, 340, 2808, 272, 687, 6107, 492, 6345, 272, 663, 63, 6355, 8, 6745, 9, 199, 2590, 3545, 26, 327, 4257, 334, 4718, 665, 499, 14, 20, 9, 272, 6345, 275, 2069, 327, 675, 2069, 3140, 402, 6345, 421, 199, 5680, 5673, 22296, 199, 199, 3, 1013, 22676, 543, 6249, 15522, 499, 14, 16, 199, 439, 441, 1090, 275, 283, 18, 14, 16, 7, 199, 199, 3, 859, 1443, 506, 5709, 12, 1325, 440, 6947, 199, 2671, 3489, 369, 275, 413, 199, 199, 3, 642, 859, 675, 9243, 2366, 1475, 9479, 199, 635, 2487, 275, 283, 647, 908, 7, 421, 199, 5680, 12624, 18851, 18405, 2983, 199, 199, 318, 6107, 63, 466, 8, 6355, 63, 466, 29, 403, 304, 272, 408, 1002, 503, 663, 2288, 730, 370, 506, 1202, 367, 6107, 1338, 1041, 272, 2288, 6345, 272, 340, 6107, 63, 466, 365, 440, 488, 26, 267, 6345, 275, 6107, 63, 466, 267, 663, 63, 6355, 8, 6355, 63, 466, 9, 272, 372, 6345, 421, 199, 318, 485, 2931, 63, 2245, 8, 585, 304, 272, 372, 574, 1491, 17, 61, 315, 788, 84, 297, 283, 52, 418, 421, 199, 318, 485, 2931, 63, 27468, 8, 585, 304, 272, 372, 6345, 17840, 904, 8, 1541, 8, 267, 2400, 373, 26, 373, 315, 283, 11371, 14, 14382, 574, 1724, 421, 199, 63, 2931, 275, 791, 2245, 356, 485, 2931, 63, 2245, 12, 272, 283, 442, 18, 356, 1109, 12, 283, 442, 20, 356, 1109, 12, 283, 2171, 356, 1109, 12, 272, 283, 442, 24, 356, 1846, 12, 283, 1170, 356, 1846, 12, 283, 1170, 24, 356, 1846, 12, 272, 283, 1609, 20, 356, 2069, 12, 283, 1609, 24, 356, 2069, 12, 272, 283, 6677, 356, 6345, 12, 283, 27468, 356, 485, 2931, 63, 27468, 93, 421, 199, 533, 10275, 697, 804, 4437, 8, 807, 304, 272, 408, 4437, 367, 3050, 2943, 1041, 339, 347, 636, 826, 721, 277, 12, 286, 7343, 304, 267, 408, 9345, 730, 2581, 367, 1950, 1041, 267, 1613, 8, 4198, 697, 804, 4437, 12, 291, 2843, 826, 4533, 267, 291, 423, 2164, 275, 286, 7343, 14, 1365, 342, 339, 347, 730, 2931, 8, 9749, 12, 574, 304, 267, 408, 24654, 574, 370, 3050, 730, 1041, 267, 340, 574, 365, 488, 26, 288, 327, 367, 5962, 1338, 12, 949, 730, 2931, 365, 5784, 288, 372, 488, 267, 9106, 275, 485, 2931, 14, 362, 8, 9749, 9, 267, 340, 9106, 365, 488, 26, 288, 327, 949, 730, 2931, 2808, 503, 5784, 288, 372, 574, 267, 587, 26, 288, 372, 9106, 8, 585, 9, 272, 730, 2931, 275, 12822, 8, 466, 2931, 9, 339, 347, 664, 12113, 8, 277, 12, 20109, 304, 267, 408, 1002, 536, 402, 3050, 730, 543, 1627, 20109, 1041, 267, 862, 26, 288, 372, 291 ]
[ 2647, 15, 1393, 15, 1813, 2366, 199, 3, 199, 3, 10275, 697, 14, 647, 199, 3, 199, 3, 27694, 701, 577, 7, 27604, 89, 1603, 14, 45, 14, 445, 1581, 199, 3, 199, 3, 2672, 1304, 26, 10275, 697, 14, 647, 12, 86, 413, 14, 1477, 9079, 15, 845, 15, 1789, 4329, 26, 708, 26, 1085, 286, 24308, 7910, 2672, 199, 3, 199, 199, 624, 4198, 697, 446, 6249, 13, 3735, 499, 14, 16, 1013, 22676, 859, 367, 1611, 16268, 14, 199, 199, 8, 67, 9, 21300, 12, 510, 305, 915, 6061, 264, 665, 28547, 32, 12897, 14, 825, 80, 14, 4391, 10827, 199, 9295, 2559, 3794, 367, 9848, 2556, 641, 4248, 14, 199, 199, 10307, 3794, 365, 5178, 14, 199, 9295, 6249, 13, 3735, 499, 14, 16, 8929, 367, 4503, 2556, 26, 199, 1014, 921, 1544, 14, 1548, 14, 1308, 15, 321, 1190, 15, 12636, 13, 996, 1887, 14, 1360, 199, 199, 6845, 4503, 26, 339, 10275, 697, 14, 2242, 8, 2242, 63, 875, 9, 327, 1551, 282, 1950, 272, 327, 4907, 63, 875, 275, 283, 1102, 26, 4659, 26, 751, 26, 2060, 26, 2992, 26, 4707, 7, 272, 327, 2900, 4184, 787, 2716, 14, 2047, 1443, 2597, 986, 1591, 4012, 272, 327, 2505, 465, 4252, 2368, 14, 4005, 986, 282, 1844, 12, 272, 327, 986, 652, 315, 314, 1591, 4252, 2725, 26, 272, 10275, 697, 14, 2242, 8, 1102, 534, 5967, 26, 1477, 708, 358, 339, 1950, 14, 3937, 342, 327, 1551, 282, 3920, 339, 3920, 14, 2526, 8, 1131, 14675, 1862, 566, 272, 327, 17009, 282, 1827, 12, 11696, 1862, 334, 65, 2600, 9, 340, 2985, 787, 272, 327, 3032, 14, 710, 11696, 6302, 365, 314, 2011, 465, 314, 450, 4182, 272, 327, 367, 11196, 12, 436, 949, 18593, 365, 4224, 14, 339, 3920, 14, 31162, 8, 1131, 12, 769, 402, 1862, 9, 272, 327, 17009, 282, 1827, 5002, 5431, 12, 11696, 1924, 1215, 2600, 272, 327, 687, 314, 769, 14, 339, 3920, 14, 11591, 342, 327, 5267, 1373, 1962, 12, 359, 585, 12, 574, 12, 21214, 339, 3920, 14, 10174, 342, 327, 5267, 1006, 4730, 12, 3474, 585, 12, 574, 12, 2263, 467, 21214, 339, 3920, 14, 3535, 3479, 779, 890, 566, 272, 327, 2529, 1568, 503, 3920, 14, 1144, 890, 1329, 402, 4730, 12, 272, 327, 3474, 585, 12, 574, 12, 2263, 467, 21214, 687, 754, 663, 14, 272, 327, 3758, 3920, 14, 1144, 890, 365, 413, 14, 339, 3920, 14, 1802, 327, 2529, 2556, 3595, 314, 4362, 272, 327, 198, 7528, 2301, 63, 354, 12, 730, 63, 354, 12, 2929, 63, 890, 12, 272, 327, 198, 198, 4672, 63, 890, 12, 7151, 12, 4666, 12, 2973, 63, 745, 395, 21214, 272, 327, 3390, 626, 7151, 12, 4666, 436, 2973, 63, 745, 787, 440, 6366, 14, 339, 3920, 14, 24007, 327, 1329, 402, 4730, 2808, 315, 314, 754, 663, 272, 327, 23840, 2410, 282, 1240, 370, 5341, 14, 339, 1950, 14, 3543, 342, 327, 5532, 6008, 339, 1950, 14, 10437, 342, 327, 503, 16475, 6008, 339, 3920, 14, 1600, 342, 327, 4002, 314, 3920, 339, 1950, 14, 1600, 342, 327, 4002, 314, 1950, 199, 199, 624, 199, 199, 504, 485, 4198, 492, 627, 199, 646, 900, 199, 893, 26, 272, 9522, 199, 2590, 12746, 26, 327, 2018, 665, 499, 14, 20, 272, 687, 5951, 492, 25609, 1084, 465, 9522, 199, 504, 2197, 492, 2197, 12, 6871, 199, 893, 26, 327, 675, 6345, 340, 2808, 272, 687, 6107, 492, 6345, 272, 663, 63, 6355, 8, 6745, 9, 199, 2590, 3545, 26, 327, 4257, 334, 4718, 665, 499, 14, 20, 9, 272, 6345, 275, 2069, 327, 675, 2069, 3140, 402, 6345, 421, 199, 5680, 5673, 22296, 199, 199, 3, 1013, 22676, 543, 6249, 15522, 499, 14, 16, 199, 439, 441, 1090, 275, 283, 18, 14, 16, 7, 199, 199, 3, 859, 1443, 506, 5709, 12, 1325, 440, 6947, 199, 2671, 3489, 369, 275, 413, 199, 199, 3, 642, 859, 675, 9243, 2366, 1475, 9479, 199, 635, 2487, 275, 283, 647, 908, 7, 421, 199, 5680, 12624, 18851, 18405, 2983, 199, 199, 318, 6107, 63, 466, 8, 6355, 63, 466, 29, 403, 304, 272, 408, 1002, 503, 663, 2288, 730, 370, 506, 1202, 367, 6107, 1338, 1041, 272, 2288, 6345, 272, 340, 6107, 63, 466, 365, 440, 488, 26, 267, 6345, 275, 6107, 63, 466, 267, 663, 63, 6355, 8, 6355, 63, 466, 9, 272, 372, 6345, 421, 199, 318, 485, 2931, 63, 2245, 8, 585, 304, 272, 372, 574, 1491, 17, 61, 315, 788, 84, 297, 283, 52, 418, 421, 199, 318, 485, 2931, 63, 27468, 8, 585, 304, 272, 372, 6345, 17840, 904, 8, 1541, 8, 267, 2400, 373, 26, 373, 315, 283, 11371, 14, 14382, 574, 1724, 421, 199, 63, 2931, 275, 791, 2245, 356, 485, 2931, 63, 2245, 12, 272, 283, 442, 18, 356, 1109, 12, 283, 442, 20, 356, 1109, 12, 283, 2171, 356, 1109, 12, 272, 283, 442, 24, 356, 1846, 12, 283, 1170, 356, 1846, 12, 283, 1170, 24, 356, 1846, 12, 272, 283, 1609, 20, 356, 2069, 12, 283, 1609, 24, 356, 2069, 12, 272, 283, 6677, 356, 6345, 12, 283, 27468, 356, 485, 2931, 63, 27468, 93, 421, 199, 533, 10275, 697, 804, 4437, 8, 807, 304, 272, 408, 4437, 367, 3050, 2943, 1041, 339, 347, 636, 826, 721, 277, 12, 286, 7343, 304, 267, 408, 9345, 730, 2581, 367, 1950, 1041, 267, 1613, 8, 4198, 697, 804, 4437, 12, 291, 2843, 826, 4533, 267, 291, 423, 2164, 275, 286, 7343, 14, 1365, 342, 339, 347, 730, 2931, 8, 9749, 12, 574, 304, 267, 408, 24654, 574, 370, 3050, 730, 1041, 267, 340, 574, 365, 488, 26, 288, 327, 367, 5962, 1338, 12, 949, 730, 2931, 365, 5784, 288, 372, 488, 267, 9106, 275, 485, 2931, 14, 362, 8, 9749, 9, 267, 340, 9106, 365, 488, 26, 288, 327, 949, 730, 2931, 2808, 503, 5784, 288, 372, 574, 267, 587, 26, 288, 372, 9106, 8, 585, 9, 272, 730, 2931, 275, 12822, 8, 466, 2931, 9, 339, 347, 664, 12113, 8, 277, 12, 20109, 304, 267, 408, 1002, 536, 402, 3050, 730, 543, 1627, 20109, 1041, 267, 862, 26, 288, 372, 291, 0 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1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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 ]
DMLoy/ECommerceBasic
bin/bin/activate/lib/python2.7/site-packages/setuptools/command/bdist_wininst.py
325
2283
from distutils.command.bdist_wininst import bdist_wininst as _bdist_wininst import os, sys class bdist_wininst(_bdist_wininst): _good_upload = _bad_upload = None def create_exe(self, arcname, fullname, bitmap=None): _bdist_wininst.create_exe(self, arcname, fullname, bitmap) installer_name = self.get_installer_filename(fullname) if self.target_version: pyversion = self.target_version # fix 2.5+ bdist_wininst ignoring --target-version spec self._bad_upload = ('bdist_wininst', 'any', installer_name) else: pyversion = 'any' self._good_upload = ('bdist_wininst', pyversion, installer_name) def _fix_upload_names(self): good, bad = self._good_upload, self._bad_upload dist_files = getattr(self.distribution, 'dist_files', []) if bad in dist_files: dist_files.remove(bad) if good not in dist_files: dist_files.append(good) def reinitialize_command (self, command, reinit_subcommands=0): cmd = self.distribution.reinitialize_command( command, reinit_subcommands) if command in ('install', 'install_lib'): cmd.install_lib = None # work around distutils bug return cmd def run(self): self._is_running = True try: _bdist_wininst.run(self) self._fix_upload_names() finally: self._is_running = False if not hasattr(_bdist_wininst, 'get_installer_filename'): def get_installer_filename(self, fullname): # Factored out to allow overriding in subclasses if self.target_version: # if we create an installer for a specific python version, # it's better to include this in the name installer_name = os.path.join(self.dist_dir, "%s.win32-py%s.exe" % (fullname, self.target_version)) else: installer_name = os.path.join(self.dist_dir, "%s.win32.exe" % fullname) return installer_name # get_installer_filename()
mit
[ 504, 7065, 14, 1531, 14, 17403, 63, 2676, 3615, 492, 26308, 63, 2676, 3615, 465, 485, 17403, 63, 2676, 3615, 199, 646, 747, 12, 984, 199, 199, 533, 26308, 63, 2676, 3615, 1547, 17403, 63, 2676, 3615, 304, 272, 485, 8302, 63, 5064, 275, 485, 4087, 63, 5064, 275, 488, 339, 347, 1218, 63, 5803, 8, 277, 12, 22177, 12, 11064, 12, 20810, 29, 403, 304, 267, 485, 17403, 63, 2676, 3615, 14, 981, 63, 5803, 8, 277, 12, 22177, 12, 11064, 12, 20810, 9, 267, 18535, 63, 354, 275, 291, 14, 362, 63, 17047, 63, 1501, 8, 9930, 9, 4960, 340, 291, 14, 1375, 63, 1023, 26, 288, 1134, 1023, 275, 291, 14, 1375, 63, 1023, 288, 327, 5325, 499, 14, 21, 11, 26308, 63, 2676, 3615, 17289, 1553, 1375, 13, 1023, 3158, 288, 291, 423, 4087, 63, 5064, 275, 661, 17403, 63, 2676, 3615, 297, 283, 1629, 297, 18535, 63, 354, 9, 267, 587, 26, 288, 1134, 1023, 275, 283, 1629, 7, 267, 291, 423, 8302, 63, 5064, 275, 661, 17403, 63, 2676, 3615, 297, 1134, 1023, 12, 18535, 63, 354, 9, 5493, 347, 485, 970, 63, 5064, 63, 1247, 8, 277, 304, 267, 6954, 12, 4875, 275, 291, 423, 8302, 63, 5064, 12, 291, 423, 4087, 63, 5064, 267, 2917, 63, 1725, 275, 2519, 8, 277, 14, 4972, 12, 283, 2686, 63, 1725, 297, 3073, 267, 340, 4875, 315, 2917, 63, 1725, 26, 288, 2917, 63, 1725, 14, 2168, 8, 4087, 9, 267, 340, 6954, 440, 315, 2917, 63, 1725, 26, 288, 2917, 63, 1725, 14, 740, 8, 8302, 9, 339, 347, 295, 8489, 63, 1531, 334, 277, 12, 1414, 12, 295, 826, 63, 954, 4405, 29, 16, 304, 267, 2088, 275, 291, 14, 4972, 14, 264, 8489, 63, 1531, 8, 288, 1414, 12, 295, 826, 63, 954, 4405, 9, 267, 340, 1414, 315, 661, 3174, 297, 283, 3174, 63, 773, 735, 288, 2088, 14, 3174, 63, 773, 275, 488, 221, 327, 1736, 6818, 7065, 6519, 267, 372, 2088, 339, 347, 1255, 8, 277, 304, 267, 291, 423, 374, 63, 5720, 275, 715, 267, 862, 26, 288, 485, 17403, 63, 2676, 3615, 14, 1065, 8, 277, 9, 288, 291, 423, 970, 63, 5064, 63, 1247, 342, 267, 3753, 26, 288, 291, 423, 374, 63, 5720, 275, 756, 2378, 340, 440, 2688, 1547, 17403, 63, 2676, 3615, 12, 283, 362, 63, 17047, 63, 1501, 735, 267, 347, 664, 63, 17047, 63, 1501, 8, 277, 12, 11064, 304, 288, 327, 481, 2442, 2908, 734, 370, 2040, 18972, 315, 9180, 288, 340, 291, 14, 1375, 63, 1023, 26, 355, 327, 340, 781, 1218, 376, 18535, 367, 282, 2488, 2366, 1015, 12, 355, 327, 652, 1159, 8034, 370, 2387, 642, 315, 314, 536, 355, 18535, 63, 354, 275, 747, 14, 515, 14, 904, 8, 277, 14, 2686, 63, 694, 12, 6343, 2071, 83, 14, 2676, 708, 13, 647, 5, 83, 14, 5803, 2, 450, 6901, 334, 9930, 12, 291, 14, 1375, 63, 1023, 430, 288, 587, 26, 355, 18535, 63, 354, 275, 747, 14, 515, 14, 904, 8, 277, 14, 2686, 63, 694, 12, 6343, 2071, 83, 14, 2676, 708, 14, 5803, 2, 450, 11064, 9, 288, 372, 18535, 63, 354, 272, 327, 664, 63, 17047, 63, 1501, 342, 1362, 17344, 17344, 17344, 4388, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768 ]
[ 7065, 14, 1531, 14, 17403, 63, 2676, 3615, 492, 26308, 63, 2676, 3615, 465, 485, 17403, 63, 2676, 3615, 199, 646, 747, 12, 984, 199, 199, 533, 26308, 63, 2676, 3615, 1547, 17403, 63, 2676, 3615, 304, 272, 485, 8302, 63, 5064, 275, 485, 4087, 63, 5064, 275, 488, 339, 347, 1218, 63, 5803, 8, 277, 12, 22177, 12, 11064, 12, 20810, 29, 403, 304, 267, 485, 17403, 63, 2676, 3615, 14, 981, 63, 5803, 8, 277, 12, 22177, 12, 11064, 12, 20810, 9, 267, 18535, 63, 354, 275, 291, 14, 362, 63, 17047, 63, 1501, 8, 9930, 9, 4960, 340, 291, 14, 1375, 63, 1023, 26, 288, 1134, 1023, 275, 291, 14, 1375, 63, 1023, 288, 327, 5325, 499, 14, 21, 11, 26308, 63, 2676, 3615, 17289, 1553, 1375, 13, 1023, 3158, 288, 291, 423, 4087, 63, 5064, 275, 661, 17403, 63, 2676, 3615, 297, 283, 1629, 297, 18535, 63, 354, 9, 267, 587, 26, 288, 1134, 1023, 275, 283, 1629, 7, 267, 291, 423, 8302, 63, 5064, 275, 661, 17403, 63, 2676, 3615, 297, 1134, 1023, 12, 18535, 63, 354, 9, 5493, 347, 485, 970, 63, 5064, 63, 1247, 8, 277, 304, 267, 6954, 12, 4875, 275, 291, 423, 8302, 63, 5064, 12, 291, 423, 4087, 63, 5064, 267, 2917, 63, 1725, 275, 2519, 8, 277, 14, 4972, 12, 283, 2686, 63, 1725, 297, 3073, 267, 340, 4875, 315, 2917, 63, 1725, 26, 288, 2917, 63, 1725, 14, 2168, 8, 4087, 9, 267, 340, 6954, 440, 315, 2917, 63, 1725, 26, 288, 2917, 63, 1725, 14, 740, 8, 8302, 9, 339, 347, 295, 8489, 63, 1531, 334, 277, 12, 1414, 12, 295, 826, 63, 954, 4405, 29, 16, 304, 267, 2088, 275, 291, 14, 4972, 14, 264, 8489, 63, 1531, 8, 288, 1414, 12, 295, 826, 63, 954, 4405, 9, 267, 340, 1414, 315, 661, 3174, 297, 283, 3174, 63, 773, 735, 288, 2088, 14, 3174, 63, 773, 275, 488, 221, 327, 1736, 6818, 7065, 6519, 267, 372, 2088, 339, 347, 1255, 8, 277, 304, 267, 291, 423, 374, 63, 5720, 275, 715, 267, 862, 26, 288, 485, 17403, 63, 2676, 3615, 14, 1065, 8, 277, 9, 288, 291, 423, 970, 63, 5064, 63, 1247, 342, 267, 3753, 26, 288, 291, 423, 374, 63, 5720, 275, 756, 2378, 340, 440, 2688, 1547, 17403, 63, 2676, 3615, 12, 283, 362, 63, 17047, 63, 1501, 735, 267, 347, 664, 63, 17047, 63, 1501, 8, 277, 12, 11064, 304, 288, 327, 481, 2442, 2908, 734, 370, 2040, 18972, 315, 9180, 288, 340, 291, 14, 1375, 63, 1023, 26, 355, 327, 340, 781, 1218, 376, 18535, 367, 282, 2488, 2366, 1015, 12, 355, 327, 652, 1159, 8034, 370, 2387, 642, 315, 314, 536, 355, 18535, 63, 354, 275, 747, 14, 515, 14, 904, 8, 277, 14, 2686, 63, 694, 12, 6343, 2071, 83, 14, 2676, 708, 13, 647, 5, 83, 14, 5803, 2, 450, 6901, 334, 9930, 12, 291, 14, 1375, 63, 1023, 430, 288, 587, 26, 355, 18535, 63, 354, 275, 747, 14, 515, 14, 904, 8, 277, 14, 2686, 63, 694, 12, 6343, 2071, 83, 14, 2676, 708, 14, 5803, 2, 450, 11064, 9, 288, 372, 18535, 63, 354, 272, 327, 664, 63, 17047, 63, 1501, 342, 1362, 17344, 17344, 17344, 4388, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 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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0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
laslabs/odoo
openerp/addons/base/tests/test_user_has_group.py
78
1567
# -*- coding: utf-8 -*- import openerp.tests class TestHasGroup(openerp.tests.TransactionCase): def setUp(self): super(TestHasGroup, self).setUp() group0 = self.env['ir.model.data']._update( 'res.groups', 'test_user_has_group', {'name': 'group0'}, xml_id='group0' ) self.group0 = 'test_user_has_group.group0' self.env['ir.model.data']._update( 'res.groups', 'test_user_has_group', {'name': 'group1'}, xml_id='group1' ) self.group1 = 'test_user_has_group.group1' self.test_user = self.env['res.users'].create({ 'login': 'testuser', 'partner_id': self.env['res.partner'].create({ 'name': "Strawman Test User" }).id, 'groups_id': [(4, group0, 0)] }) def test_old_api(self): Users = self.registry['res.users'] self.assertTrue( Users.has_group(self.cr, self.test_user.id, self.group0), "the test user should belong to group0" ) self.assertFalse( Users.has_group(self.cr, self.test_user.id, self.group1), "the test user should *not* belong to group1" ) def test_new_api(self): self.assertTrue( self.test_user.has_group(self.group0), "the test user should belong to group0", ) self.assertFalse( self.test_user.has_group(self.group1), "the test user shoudl not belong to group1" )
agpl-3.0
[ 3, 1882, 2803, 26, 2774, 13, 24, 1882, 199, 646, 5166, 14, 2219, 199, 199, 533, 1379, 6362, 2448, 8, 11267, 14, 2219, 14, 10161, 1538, 304, 272, 347, 3613, 8, 277, 304, 267, 1613, 8, 774, 6362, 2448, 12, 291, 680, 5996, 342, 398, 1572, 16, 275, 291, 14, 1813, 459, 723, 14, 1238, 14, 576, 26099, 873, 8, 288, 283, 470, 14, 2634, 297, 283, 396, 63, 751, 63, 1989, 63, 923, 297, 288, 791, 354, 356, 283, 923, 16, 2267, 288, 2748, 63, 344, 534, 923, 16, 7, 267, 776, 267, 291, 14, 923, 16, 275, 283, 396, 63, 751, 63, 1989, 63, 923, 14, 923, 16, 7, 267, 291, 14, 1813, 459, 723, 14, 1238, 14, 576, 26099, 873, 8, 288, 283, 470, 14, 2634, 297, 283, 396, 63, 751, 63, 1989, 63, 923, 297, 288, 791, 354, 356, 283, 923, 17, 2267, 288, 2748, 63, 344, 534, 923, 17, 7, 267, 776, 267, 291, 14, 923, 17, 275, 283, 396, 63, 751, 63, 1989, 63, 923, 14, 923, 17, 7, 398, 291, 14, 396, 63, 751, 275, 291, 14, 1813, 459, 470, 14, 3707, 2278, 981, 2561, 288, 283, 2886, 356, 283, 21029, 297, 288, 283, 3899, 63, 344, 356, 291, 14, 1813, 459, 470, 14, 3899, 2278, 981, 2561, 355, 283, 354, 356, 298, 933, 1773, 1237, 1379, 2876, 2, 288, 789, 680, 344, 12, 288, 283, 2634, 63, 344, 356, 3842, 20, 12, 1572, 16, 12, 378, 1874, 267, 3828, 339, 347, 511, 63, 1753, 63, 1246, 8, 277, 304, 267, 20123, 275, 291, 14, 5189, 459, 470, 14, 3707, 418, 398, 291, 14, 1815, 8, 288, 20123, 14, 1989, 63, 923, 8, 277, 14, 1556, 12, 291, 14, 396, 63, 751, 14, 344, 12, 291, 14, 923, 16, 395, 288, 298, 1589, 511, 922, 1077, 13511, 370, 1572, 16, 2, 267, 776, 267, 291, 14, 3334, 8, 288, 20123, 14, 1989, 63, 923, 8, 277, 14, 1556, 12, 291, 14, 396, 63, 751, 14, 344, 12, 291, 14, 923, 17, 395, 288, 298, 1589, 511, 922, 1077, 627, 1397, 10, 13511, 370, 1572, 17, 2, 267, 776, 339, 347, 511, 63, 1222, 63, 1246, 8, 277, 304, 267, 291, 14, 1815, 8, 288, 291, 14, 396, 63, 751, 14, 1989, 63, 923, 8, 277, 14, 923, 16, 395, 288, 298, 1589, 511, 922, 1077, 13511, 370, 1572, 16, 401, 267, 776, 267, 291, 14, 3334, 8, 288, 291, 14, 396, 63, 751, 14, 1989, 63, 923, 8, 277, 14, 923, 17, 395, 288, 298, 1589, 511, 922, 930, 1181, 76, 440, 13511, 370, 1572, 17, 2, 267, 776, 199, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768 ]
[ 1882, 2803, 26, 2774, 13, 24, 1882, 199, 646, 5166, 14, 2219, 199, 199, 533, 1379, 6362, 2448, 8, 11267, 14, 2219, 14, 10161, 1538, 304, 272, 347, 3613, 8, 277, 304, 267, 1613, 8, 774, 6362, 2448, 12, 291, 680, 5996, 342, 398, 1572, 16, 275, 291, 14, 1813, 459, 723, 14, 1238, 14, 576, 26099, 873, 8, 288, 283, 470, 14, 2634, 297, 283, 396, 63, 751, 63, 1989, 63, 923, 297, 288, 791, 354, 356, 283, 923, 16, 2267, 288, 2748, 63, 344, 534, 923, 16, 7, 267, 776, 267, 291, 14, 923, 16, 275, 283, 396, 63, 751, 63, 1989, 63, 923, 14, 923, 16, 7, 267, 291, 14, 1813, 459, 723, 14, 1238, 14, 576, 26099, 873, 8, 288, 283, 470, 14, 2634, 297, 283, 396, 63, 751, 63, 1989, 63, 923, 297, 288, 791, 354, 356, 283, 923, 17, 2267, 288, 2748, 63, 344, 534, 923, 17, 7, 267, 776, 267, 291, 14, 923, 17, 275, 283, 396, 63, 751, 63, 1989, 63, 923, 14, 923, 17, 7, 398, 291, 14, 396, 63, 751, 275, 291, 14, 1813, 459, 470, 14, 3707, 2278, 981, 2561, 288, 283, 2886, 356, 283, 21029, 297, 288, 283, 3899, 63, 344, 356, 291, 14, 1813, 459, 470, 14, 3899, 2278, 981, 2561, 355, 283, 354, 356, 298, 933, 1773, 1237, 1379, 2876, 2, 288, 789, 680, 344, 12, 288, 283, 2634, 63, 344, 356, 3842, 20, 12, 1572, 16, 12, 378, 1874, 267, 3828, 339, 347, 511, 63, 1753, 63, 1246, 8, 277, 304, 267, 20123, 275, 291, 14, 5189, 459, 470, 14, 3707, 418, 398, 291, 14, 1815, 8, 288, 20123, 14, 1989, 63, 923, 8, 277, 14, 1556, 12, 291, 14, 396, 63, 751, 14, 344, 12, 291, 14, 923, 16, 395, 288, 298, 1589, 511, 922, 1077, 13511, 370, 1572, 16, 2, 267, 776, 267, 291, 14, 3334, 8, 288, 20123, 14, 1989, 63, 923, 8, 277, 14, 1556, 12, 291, 14, 396, 63, 751, 14, 344, 12, 291, 14, 923, 17, 395, 288, 298, 1589, 511, 922, 1077, 627, 1397, 10, 13511, 370, 1572, 17, 2, 267, 776, 339, 347, 511, 63, 1222, 63, 1246, 8, 277, 304, 267, 291, 14, 1815, 8, 288, 291, 14, 396, 63, 751, 14, 1989, 63, 923, 8, 277, 14, 923, 16, 395, 288, 298, 1589, 511, 922, 1077, 13511, 370, 1572, 16, 401, 267, 776, 267, 291, 14, 3334, 8, 288, 291, 14, 396, 63, 751, 14, 1989, 63, 923, 8, 277, 14, 923, 17, 395, 288, 298, 1589, 511, 922, 930, 1181, 76, 440, 13511, 370, 1572, 17, 2, 267, 776, 199, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 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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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 ]
Beyond-Imagination/BlubBlub
ChatbotServer/ChatbotEnv/Lib/site-packages/bs4/tests/test_builder_registry.py
176
5582
"""Tests of the builder registry.""" import unittest import warnings from bs4 import BeautifulSoup from bs4.builder import ( builder_registry as registry, HTMLParserTreeBuilder, TreeBuilderRegistry, ) try: from bs4.builder import HTML5TreeBuilder HTML5LIB_PRESENT = True except ImportError: HTML5LIB_PRESENT = False try: from bs4.builder import ( LXMLTreeBuilderForXML, LXMLTreeBuilder, ) LXML_PRESENT = True except ImportError: LXML_PRESENT = False class BuiltInRegistryTest(unittest.TestCase): """Test the built-in registry with the default builders registered.""" def test_combination(self): if LXML_PRESENT: self.assertEqual(registry.lookup('fast', 'html'), LXMLTreeBuilder) if LXML_PRESENT: self.assertEqual(registry.lookup('permissive', 'xml'), LXMLTreeBuilderForXML) self.assertEqual(registry.lookup('strict', 'html'), HTMLParserTreeBuilder) if HTML5LIB_PRESENT: self.assertEqual(registry.lookup('html5lib', 'html'), HTML5TreeBuilder) def test_lookup_by_markup_type(self): if LXML_PRESENT: self.assertEqual(registry.lookup('html'), LXMLTreeBuilder) self.assertEqual(registry.lookup('xml'), LXMLTreeBuilderForXML) else: self.assertEqual(registry.lookup('xml'), None) if HTML5LIB_PRESENT: self.assertEqual(registry.lookup('html'), HTML5TreeBuilder) else: self.assertEqual(registry.lookup('html'), HTMLParserTreeBuilder) def test_named_library(self): if LXML_PRESENT: self.assertEqual(registry.lookup('lxml', 'xml'), LXMLTreeBuilderForXML) self.assertEqual(registry.lookup('lxml', 'html'), LXMLTreeBuilder) if HTML5LIB_PRESENT: self.assertEqual(registry.lookup('html5lib'), HTML5TreeBuilder) self.assertEqual(registry.lookup('html.parser'), HTMLParserTreeBuilder) def test_beautifulsoup_constructor_does_lookup(self): with warnings.catch_warnings(record=True) as w: # This will create a warning about not explicitly # specifying a parser, but we'll ignore it. # You can pass in a string. BeautifulSoup("", features="html") # Or a list of strings. BeautifulSoup("", features=["html", "fast"]) # You'll get an exception if BS can't find an appropriate # builder. self.assertRaises(ValueError, BeautifulSoup, "", features="no-such-feature") class RegistryTest(unittest.TestCase): """Test the TreeBuilderRegistry class in general.""" def setUp(self): self.registry = TreeBuilderRegistry() def builder_for_features(self, *feature_list): cls = type('Builder_' + '_'.join(feature_list), (object,), {'features' : feature_list}) self.registry.register(cls) return cls def test_register_with_no_features(self): builder = self.builder_for_features() # Since the builder advertises no features, you can't find it # by looking up features. self.assertEqual(self.registry.lookup('foo'), None) # But you can find it by doing a lookup with no features, if # this happens to be the only registered builder. self.assertEqual(self.registry.lookup(), builder) def test_register_with_features_makes_lookup_succeed(self): builder = self.builder_for_features('foo', 'bar') self.assertEqual(self.registry.lookup('foo'), builder) self.assertEqual(self.registry.lookup('bar'), builder) def test_lookup_fails_when_no_builder_implements_feature(self): builder = self.builder_for_features('foo', 'bar') self.assertEqual(self.registry.lookup('baz'), None) def test_lookup_gets_most_recent_registration_when_no_feature_specified(self): builder1 = self.builder_for_features('foo') builder2 = self.builder_for_features('bar') self.assertEqual(self.registry.lookup(), builder2) def test_lookup_fails_when_no_tree_builders_registered(self): self.assertEqual(self.registry.lookup(), None) def test_lookup_gets_most_recent_builder_supporting_all_features(self): has_one = self.builder_for_features('foo') has_the_other = self.builder_for_features('bar') has_both_early = self.builder_for_features('foo', 'bar', 'baz') has_both_late = self.builder_for_features('foo', 'bar', 'quux') lacks_one = self.builder_for_features('bar') has_the_other = self.builder_for_features('foo') # There are two builders featuring 'foo' and 'bar', but # the one that also features 'quux' was registered later. self.assertEqual(self.registry.lookup('foo', 'bar'), has_both_late) # There is only one builder featuring 'foo', 'bar', and 'baz'. self.assertEqual(self.registry.lookup('foo', 'bar', 'baz'), has_both_early) def test_lookup_fails_when_cannot_reconcile_requested_features(self): builder1 = self.builder_for_features('foo', 'bar') builder2 = self.builder_for_features('foo', 'baz') self.assertEqual(self.registry.lookup('bar', 'baz'), None)
gpl-3.0
[ 624, 2925, 402, 314, 6545, 7086, 1041, 199, 199, 646, 2882, 199, 646, 3598, 199, 199, 504, 9922, 20, 492, 17132, 199, 504, 9922, 20, 14, 5649, 492, 334, 272, 6545, 63, 5189, 465, 7086, 12, 272, 24581, 20437, 12, 272, 12178, 6437, 10899, 12, 199, 9, 199, 199, 893, 26, 272, 687, 9922, 20, 14, 5649, 492, 4163, 21, 20437, 272, 4163, 21, 5617, 63, 19743, 275, 715, 199, 2590, 3545, 26, 272, 4163, 21, 5617, 63, 19743, 275, 756, 199, 199, 893, 26, 272, 687, 9922, 20, 14, 5649, 492, 334, 267, 491, 4317, 20437, 1858, 4317, 12, 267, 491, 4317, 20437, 12, 267, 776, 272, 491, 4317, 63, 19743, 275, 715, 199, 2590, 3545, 26, 272, 491, 4317, 63, 19743, 275, 756, 421, 199, 533, 4779, 4803, 607, 10899, 774, 8, 2796, 14, 1746, 304, 272, 408, 774, 314, 6137, 13, 262, 7086, 543, 314, 849, 27378, 7264, 1041, 339, 347, 511, 63, 6560, 3155, 8, 277, 304, 267, 340, 491, 4317, 63, 19743, 26, 288, 291, 14, 629, 8, 5189, 14, 3892, 360, 7015, 297, 283, 1360, 659, 2490, 491, 4317, 20437, 9, 398, 340, 491, 4317, 63, 19743, 26, 288, 291, 14, 629, 8, 5189, 14, 3892, 360, 529, 32237, 297, 283, 1652, 659, 2490, 491, 4317, 20437, 1858, 4317, 9, 267, 291, 14, 629, 8, 5189, 14, 3892, 360, 4768, 297, 283, 1360, 659, 2079, 24581, 20437, 9, 267, 340, 4163, 21, 5617, 63, 19743, 26, 288, 291, 14, 629, 8, 5189, 14, 3892, 360, 1360, 21, 773, 297, 283, 1360, 659, 2892, 4163, 21, 20437, 9, 339, 347, 511, 63, 3892, 63, 991, 63, 10131, 63, 466, 8, 277, 304, 267, 340, 491, 4317, 63, 19743, 26, 288, 291, 14, 629, 8, 5189, 14, 3892, 360, 1360, 659, 491, 4317, 20437, 9, 288, 291, 14, 629, 8, 5189, 14, 3892, 360, 1652, 659, 491, 4317, 20437, 1858, 4317, 9, 267, 587, 26, 288, 291, 14, 629, 8, 5189, 14, 3892, 360, 1652, 659, 488, 9, 288, 340, 4163, 21, 5617, 63, 19743, 26, 355, 291, 14, 629, 8, 5189, 14, 3892, 360, 1360, 659, 4163, 21, 20437, 9, 288, 587, 26, 355, 291, 14, 629, 8, 5189, 14, 3892, 360, 1360, 659, 24581, 20437, 9, 339, 347, 511, 63, 4579, 63, 4342, 8, 277, 304, 267, 340, 491, 4317, 63, 19743, 26, 288, 291, 14, 629, 8, 5189, 14, 3892, 360, 22899, 297, 283, 1652, 659, 2490, 491, 4317, 20437, 1858, 4317, 9, 288, 291, 14, 629, 8, 5189, 14, 3892, 360, 22899, 297, 283, 1360, 659, 2490, 491, 4317, 20437, 9, 267, 340, 4163, 21, 5617, 63, 19743, 26, 288, 291, 14, 629, 8, 5189, 14, 3892, 360, 1360, 21, 773, 659, 2892, 4163, 21, 20437, 9, 398, 291, 14, 629, 8, 5189, 14, 3892, 360, 1360, 14, 2087, 659, 2079, 24581, 20437, 9, 339, 347, 511, 63, 1235, 25146, 9317, 63, 1880, 63, 9105, 63, 3892, 8, 277, 304, 398, 543, 3598, 14, 9341, 63, 5451, 8, 3059, 29, 549, 9, 465, 336, 26, 288, 327, 961, 911, 1218, 282, 5721, 3595, 440, 7662, 288, 327, 9176, 282, 1798, 12, 1325, 781, 7171, 3686, 652, 14, 953, 327, 2047, 883, 986, 315, 282, 1059, 14, 288, 17132, 12398, 4534, 628, 1360, 531, 288, 327, 4236, 282, 769, 402, 3326, 14, 288, 17132, 12398, 4534, 6270, 1360, 401, 298, 7015, 3135, 398, 327, 2047, 7171, 664, 376, 1919, 340, 699, 51, 883, 1133, 2342, 376, 5827, 267, 327, 6545, 14, 267, 291, 14, 1855, 8, 3393, 12, 17132, 12, 2079, 4873, 4534, 628, 889, 13, 10180, 13, 4445, 531, 199, 199, 533, 20738, 774, 8, 2796, 14, 1746, 304, 272, 408, 774, 314, 12178, 6437, 10899, 1021, 315, 8605, 1041, 339, 347, 3613, 8, 277, 304, 267, 291, 14, 5189, 275, 12178, 6437, 10899, 342, 339, 347, 6545, 63, 509, 63, 3179, 8, 277, 12, 627, 4445, 63, 513, 304, 267, 843, 275, 730, 360, 6437, 8650, 435, 2513, 1370, 904, 8, 4445, 63, 513, 395, 673, 334, 785, 4706, 791, 3179, 7, 520, 3878, 63, 513, 1552, 398, 291, 14, 5189, 14, 2683, 8, 1886, 9, 267, 372, 843, 339, 347, 511, 63, 2683, 63, 1045, 63, 889, 63, 3179, 8, 277, 304, 267, 6545, 275, 291, 14, 5649, 63, 509, 63, 3179, 342, 398, 327, 9336, 314, 6545, 19613, 874, 949, 4534, 12, 1265, 883, 1133, 2342, 652, 267, 327, 701, 10023, 1536, 4534, 14, 267, 291, 14, 629, 8, 277, 14, 5189, 14, 3892, 360, 1421, 659, 488, 9, 398, 327, 11017, 1265, 883, 2342, 652, 701, 9689, 282, 4237, 543, 949, 4534, 12, 340, 267, 327, 642, 10986, 370, 506, 314, 1454, 7264, 6545, 14, 267, 291, 14, 629, 8, 277, 14, 5189, 14, 3892, 1062, 6545, 9, 339, 347, 511, 63, 2683, 63, 1045, 63, 3179, 63, 391, 9246, 63, 3892, 63, 26622, 8, 277, 304, 267, 6545, 275, 291, 14, 5649, 63, 509, 63, 3179, 360, 1421, 297, 283, 1700, 358, 267, 291, 14, 629, 8, 277, 14, 5189, 14, 3892, 360, 1421, 659, 6545, 9, 267, 291, 14, 629, 8, 277, 14, 5189, 14, 3892, 360, 1700, 659, 6545, 9, 339, 347, 511, 63, 3892, 63, 15762, 63, 6526, 63, 889, 63, 5649, 63, 24900, 63, 4445, 8, 277, 304, 267, 6545, 275, 291, 14, 5649, 63, 509, 63, 3179, 360, 1421, 297, 283, 1700, 358, 267, 291, 14, 629, 8, 277, 14, 5189, 14, 3892, 360, 6185, 659, 488, 9, 339, 347, 511, 63, 3892, 63, 24894, 63, 2786, 63, 14951, 63, 8054, 63, 6526, 63, 889, 63, 4445, 63, 10085, 8, 277, 304, 267, 6545, 17, 275, 291, 14, 5649, 63, 509, 63, 3179, 360, 1421, 358, 267, 6545, 18, 275, 291, 14, 5649, 63, 509, 63, 3179, 360, 1700, 358, 267, 291, 14, 629, 8, 277, 14, 5189, 14, 3892, 1062, 6545, 18, 9, 339, 347, 511, 63, 3892, 63, 15762, 63, 6526, 63, 889, 63, 2350, 63, 20968, 63, 11616, 8, 277, 304, 267, 291, 14, 629, 8, 277, 14, 5189, 14, 3892, 1062, 488, 9, 339, 347, 511, 63, 3892, 63, 24894, 63, 2786, 63, 14951, 63, 5649, 63, 4058, 316, 63, 452, 63 ]
[ 2925, 402, 314, 6545, 7086, 1041, 199, 199, 646, 2882, 199, 646, 3598, 199, 199, 504, 9922, 20, 492, 17132, 199, 504, 9922, 20, 14, 5649, 492, 334, 272, 6545, 63, 5189, 465, 7086, 12, 272, 24581, 20437, 12, 272, 12178, 6437, 10899, 12, 199, 9, 199, 199, 893, 26, 272, 687, 9922, 20, 14, 5649, 492, 4163, 21, 20437, 272, 4163, 21, 5617, 63, 19743, 275, 715, 199, 2590, 3545, 26, 272, 4163, 21, 5617, 63, 19743, 275, 756, 199, 199, 893, 26, 272, 687, 9922, 20, 14, 5649, 492, 334, 267, 491, 4317, 20437, 1858, 4317, 12, 267, 491, 4317, 20437, 12, 267, 776, 272, 491, 4317, 63, 19743, 275, 715, 199, 2590, 3545, 26, 272, 491, 4317, 63, 19743, 275, 756, 421, 199, 533, 4779, 4803, 607, 10899, 774, 8, 2796, 14, 1746, 304, 272, 408, 774, 314, 6137, 13, 262, 7086, 543, 314, 849, 27378, 7264, 1041, 339, 347, 511, 63, 6560, 3155, 8, 277, 304, 267, 340, 491, 4317, 63, 19743, 26, 288, 291, 14, 629, 8, 5189, 14, 3892, 360, 7015, 297, 283, 1360, 659, 2490, 491, 4317, 20437, 9, 398, 340, 491, 4317, 63, 19743, 26, 288, 291, 14, 629, 8, 5189, 14, 3892, 360, 529, 32237, 297, 283, 1652, 659, 2490, 491, 4317, 20437, 1858, 4317, 9, 267, 291, 14, 629, 8, 5189, 14, 3892, 360, 4768, 297, 283, 1360, 659, 2079, 24581, 20437, 9, 267, 340, 4163, 21, 5617, 63, 19743, 26, 288, 291, 14, 629, 8, 5189, 14, 3892, 360, 1360, 21, 773, 297, 283, 1360, 659, 2892, 4163, 21, 20437, 9, 339, 347, 511, 63, 3892, 63, 991, 63, 10131, 63, 466, 8, 277, 304, 267, 340, 491, 4317, 63, 19743, 26, 288, 291, 14, 629, 8, 5189, 14, 3892, 360, 1360, 659, 491, 4317, 20437, 9, 288, 291, 14, 629, 8, 5189, 14, 3892, 360, 1652, 659, 491, 4317, 20437, 1858, 4317, 9, 267, 587, 26, 288, 291, 14, 629, 8, 5189, 14, 3892, 360, 1652, 659, 488, 9, 288, 340, 4163, 21, 5617, 63, 19743, 26, 355, 291, 14, 629, 8, 5189, 14, 3892, 360, 1360, 659, 4163, 21, 20437, 9, 288, 587, 26, 355, 291, 14, 629, 8, 5189, 14, 3892, 360, 1360, 659, 24581, 20437, 9, 339, 347, 511, 63, 4579, 63, 4342, 8, 277, 304, 267, 340, 491, 4317, 63, 19743, 26, 288, 291, 14, 629, 8, 5189, 14, 3892, 360, 22899, 297, 283, 1652, 659, 2490, 491, 4317, 20437, 1858, 4317, 9, 288, 291, 14, 629, 8, 5189, 14, 3892, 360, 22899, 297, 283, 1360, 659, 2490, 491, 4317, 20437, 9, 267, 340, 4163, 21, 5617, 63, 19743, 26, 288, 291, 14, 629, 8, 5189, 14, 3892, 360, 1360, 21, 773, 659, 2892, 4163, 21, 20437, 9, 398, 291, 14, 629, 8, 5189, 14, 3892, 360, 1360, 14, 2087, 659, 2079, 24581, 20437, 9, 339, 347, 511, 63, 1235, 25146, 9317, 63, 1880, 63, 9105, 63, 3892, 8, 277, 304, 398, 543, 3598, 14, 9341, 63, 5451, 8, 3059, 29, 549, 9, 465, 336, 26, 288, 327, 961, 911, 1218, 282, 5721, 3595, 440, 7662, 288, 327, 9176, 282, 1798, 12, 1325, 781, 7171, 3686, 652, 14, 953, 327, 2047, 883, 986, 315, 282, 1059, 14, 288, 17132, 12398, 4534, 628, 1360, 531, 288, 327, 4236, 282, 769, 402, 3326, 14, 288, 17132, 12398, 4534, 6270, 1360, 401, 298, 7015, 3135, 398, 327, 2047, 7171, 664, 376, 1919, 340, 699, 51, 883, 1133, 2342, 376, 5827, 267, 327, 6545, 14, 267, 291, 14, 1855, 8, 3393, 12, 17132, 12, 2079, 4873, 4534, 628, 889, 13, 10180, 13, 4445, 531, 199, 199, 533, 20738, 774, 8, 2796, 14, 1746, 304, 272, 408, 774, 314, 12178, 6437, 10899, 1021, 315, 8605, 1041, 339, 347, 3613, 8, 277, 304, 267, 291, 14, 5189, 275, 12178, 6437, 10899, 342, 339, 347, 6545, 63, 509, 63, 3179, 8, 277, 12, 627, 4445, 63, 513, 304, 267, 843, 275, 730, 360, 6437, 8650, 435, 2513, 1370, 904, 8, 4445, 63, 513, 395, 673, 334, 785, 4706, 791, 3179, 7, 520, 3878, 63, 513, 1552, 398, 291, 14, 5189, 14, 2683, 8, 1886, 9, 267, 372, 843, 339, 347, 511, 63, 2683, 63, 1045, 63, 889, 63, 3179, 8, 277, 304, 267, 6545, 275, 291, 14, 5649, 63, 509, 63, 3179, 342, 398, 327, 9336, 314, 6545, 19613, 874, 949, 4534, 12, 1265, 883, 1133, 2342, 652, 267, 327, 701, 10023, 1536, 4534, 14, 267, 291, 14, 629, 8, 277, 14, 5189, 14, 3892, 360, 1421, 659, 488, 9, 398, 327, 11017, 1265, 883, 2342, 652, 701, 9689, 282, 4237, 543, 949, 4534, 12, 340, 267, 327, 642, 10986, 370, 506, 314, 1454, 7264, 6545, 14, 267, 291, 14, 629, 8, 277, 14, 5189, 14, 3892, 1062, 6545, 9, 339, 347, 511, 63, 2683, 63, 1045, 63, 3179, 63, 391, 9246, 63, 3892, 63, 26622, 8, 277, 304, 267, 6545, 275, 291, 14, 5649, 63, 509, 63, 3179, 360, 1421, 297, 283, 1700, 358, 267, 291, 14, 629, 8, 277, 14, 5189, 14, 3892, 360, 1421, 659, 6545, 9, 267, 291, 14, 629, 8, 277, 14, 5189, 14, 3892, 360, 1700, 659, 6545, 9, 339, 347, 511, 63, 3892, 63, 15762, 63, 6526, 63, 889, 63, 5649, 63, 24900, 63, 4445, 8, 277, 304, 267, 6545, 275, 291, 14, 5649, 63, 509, 63, 3179, 360, 1421, 297, 283, 1700, 358, 267, 291, 14, 629, 8, 277, 14, 5189, 14, 3892, 360, 6185, 659, 488, 9, 339, 347, 511, 63, 3892, 63, 24894, 63, 2786, 63, 14951, 63, 8054, 63, 6526, 63, 889, 63, 4445, 63, 10085, 8, 277, 304, 267, 6545, 17, 275, 291, 14, 5649, 63, 509, 63, 3179, 360, 1421, 358, 267, 6545, 18, 275, 291, 14, 5649, 63, 509, 63, 3179, 360, 1700, 358, 267, 291, 14, 629, 8, 277, 14, 5189, 14, 3892, 1062, 6545, 18, 9, 339, 347, 511, 63, 3892, 63, 15762, 63, 6526, 63, 889, 63, 2350, 63, 20968, 63, 11616, 8, 277, 304, 267, 291, 14, 629, 8, 277, 14, 5189, 14, 3892, 1062, 488, 9, 339, 347, 511, 63, 3892, 63, 24894, 63, 2786, 63, 14951, 63, 5649, 63, 4058, 316, 63, 452, 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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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 ]
rversteegen/commandergenius
project/jni/python/src/Lib/test/test_mimetypes.py
77
2581
import mimetypes import StringIO import unittest from test import test_support # Tell it we don't know about external files: mimetypes.knownfiles = [] mimetypes.inited = False mimetypes._default_mime_types() class MimeTypesTestCase(unittest.TestCase): def setUp(self): self.db = mimetypes.MimeTypes() def test_default_data(self): eq = self.assertEqual eq(self.db.guess_type("foo.html"), ("text/html", None)) eq(self.db.guess_type("foo.tgz"), ("application/x-tar", "gzip")) eq(self.db.guess_type("foo.tar.gz"), ("application/x-tar", "gzip")) eq(self.db.guess_type("foo.tar.Z"), ("application/x-tar", "compress")) def test_data_urls(self): eq = self.assertEqual guess_type = self.db.guess_type eq(guess_type("data:,thisIsTextPlain"), ("text/plain", None)) eq(guess_type("data:;base64,thisIsTextPlain"), ("text/plain", None)) eq(guess_type("data:text/x-foo,thisIsTextXFoo"), ("text/x-foo", None)) def test_file_parsing(self): eq = self.assertEqual sio = StringIO.StringIO("x-application/x-unittest pyunit\n") self.db.readfp(sio) eq(self.db.guess_type("foo.pyunit"), ("x-application/x-unittest", None)) eq(self.db.guess_extension("x-application/x-unittest"), ".pyunit") def test_non_standard_types(self): eq = self.assertEqual # First try strict eq(self.db.guess_type('foo.xul', strict=True), (None, None)) eq(self.db.guess_extension('image/jpg', strict=True), None) # And then non-strict eq(self.db.guess_type('foo.xul', strict=False), ('text/xul', None)) eq(self.db.guess_extension('image/jpg', strict=False), '.jpg') def test_guess_all_types(self): eq = self.assertEqual unless = self.failUnless # First try strict. Use a set here for testing the results because if # test_urllib2 is run before test_mimetypes, global state is modified # such that the 'all' set will have more items in it. all = set(self.db.guess_all_extensions('text/plain', strict=True)) unless(all >= set(['.bat', '.c', '.h', '.ksh', '.pl', '.txt'])) # And now non-strict all = self.db.guess_all_extensions('image/jpg', strict=False) all.sort() eq(all, ['.jpg']) # And now for no hits all = self.db.guess_all_extensions('image/jpg', strict=True) eq(all, []) def test_main(): test_support.run_unittest(MimeTypesTestCase) if __name__ == "__main__": test_main()
lgpl-2.1
[ 646, 13290, 199, 646, 5228, 199, 646, 2882, 199, 199, 504, 511, 492, 511, 63, 4058, 199, 199, 3, 30528, 652, 781, 2793, 1133, 5715, 3595, 5957, 1584, 26, 199, 7626, 1313, 14, 3159, 1725, 275, 942, 199, 7626, 1313, 14, 2730, 471, 275, 756, 199, 7626, 1313, 423, 885, 63, 7626, 63, 1313, 342, 421, 199, 533, 603, 1036, 4100, 1746, 8, 2796, 14, 1746, 304, 272, 347, 3613, 8, 277, 304, 267, 291, 14, 697, 275, 13290, 14, 45, 1036, 4100, 342, 339, 347, 511, 63, 885, 63, 576, 8, 277, 304, 267, 3850, 275, 291, 14, 629, 267, 3850, 8, 277, 14, 697, 14, 11636, 63, 466, 480, 1421, 14, 1360, 1288, 1689, 505, 15, 1360, 401, 488, 430, 267, 3850, 8, 277, 14, 697, 14, 11636, 63, 466, 480, 1421, 14, 27220, 1288, 1689, 3578, 15, 88, 13, 5369, 401, 298, 12256, 2237, 267, 3850, 8, 277, 14, 697, 14, 11636, 63, 466, 480, 1421, 14, 5369, 14, 6838, 1288, 1689, 3578, 15, 88, 13, 5369, 401, 298, 12256, 2237, 267, 3850, 8, 277, 14, 697, 14, 11636, 63, 466, 480, 1421, 14, 5369, 14, 58, 1288, 1689, 3578, 15, 88, 13, 5369, 401, 298, 6447, 2237, 339, 347, 511, 63, 576, 63, 3603, 8, 277, 304, 267, 3850, 275, 291, 14, 629, 267, 9519, 63, 466, 275, 291, 14, 697, 14, 11636, 63, 466, 267, 3850, 8, 11636, 63, 466, 480, 576, 11941, 3749, 1831, 1872, 20711, 1288, 1689, 505, 15, 6104, 401, 488, 430, 267, 3850, 8, 11636, 63, 466, 480, 576, 26, 27, 1095, 772, 12, 3749, 1831, 1872, 20711, 1288, 1689, 505, 15, 6104, 401, 488, 430, 267, 3850, 8, 11636, 63, 466, 480, 576, 26, 505, 15, 88, 13, 1421, 12, 3749, 1831, 1872, 56, 5686, 1288, 1689, 505, 15, 88, 13, 1421, 401, 488, 430, 339, 347, 511, 63, 493, 63, 11059, 8, 277, 304, 267, 3850, 275, 291, 14, 629, 267, 29129, 275, 5228, 14, 6424, 480, 88, 13, 3578, 15, 88, 13, 2796, 1134, 3248, 60, 78, 531, 267, 291, 14, 697, 14, 739, 3997, 8, 22961, 9, 267, 3850, 8, 277, 14, 697, 14, 11636, 63, 466, 480, 1421, 14, 647, 3248, 1288, 1779, 1689, 88, 13, 3578, 15, 88, 13, 2796, 401, 488, 430, 267, 3850, 8, 277, 14, 697, 14, 11636, 63, 3435, 480, 88, 13, 3578, 15, 88, 13, 2796, 1288, 3680, 647, 3248, 531, 339, 347, 511, 63, 2865, 63, 6807, 63, 1313, 8, 277, 304, 267, 3850, 275, 291, 14, 629, 267, 327, 7758, 862, 7478, 267, 3850, 8, 277, 14, 697, 14, 11636, 63, 466, 360, 1421, 14, 88, 348, 297, 7478, 29, 549, 395, 334, 403, 12, 488, 430, 267, 3850, 8, 277, 14, 697, 14, 11636, 63, 3435, 360, 1569, 15, 8476, 297, 7478, 29, 549, 395, 488, 9, 267, 327, 6061, 2066, 2222, 13, 4768, 267, 3850, 8, 277, 14, 697, 14, 11636, 63, 466, 360, 1421, 14, 88, 348, 297, 7478, 29, 797, 395, 661, 505, 15, 88, 348, 297, 488, 430, 267, 3850, 8, 277, 14, 697, 14, 11636, 63, 3435, 360, 1569, 15, 8476, 297, 7478, 29, 797, 395, 1987, 8476, 358, 339, 347, 511, 63, 11636, 63, 452, 63, 1313, 8, 277, 304, 267, 3850, 275, 291, 14, 629, 267, 7444, 275, 291, 14, 7589, 267, 327, 7758, 862, 7478, 14, 221, 3645, 282, 663, 2348, 367, 5343, 314, 2058, 2952, 340, 267, 327, 511, 63, 4078, 18, 365, 1255, 2544, 511, 63, 7626, 1313, 12, 2288, 1174, 365, 6042, 267, 327, 4066, 626, 314, 283, 452, 7, 663, 911, 1172, 1655, 2974, 315, 652, 14, 267, 1006, 275, 663, 8, 277, 14, 697, 14, 11636, 63, 452, 63, 5359, 360, 505, 15, 6104, 297, 7478, 29, 549, 430, 267, 7444, 8, 452, 2356, 663, 2941, 14, 13475, 297, 1987, 67, 297, 1987, 72, 297, 1987, 75, 609, 297, 1987, 1168, 297, 1987, 2424, 5156, 267, 327, 6061, 3063, 2222, 13, 4768, 267, 1006, 275, 291, 14, 697, 14, 11636, 63, 452, 63, 5359, 360, 1569, 15, 8476, 297, 7478, 29, 797, 9, 267, 1006, 14, 3191, 342, 267, 3850, 8, 452, 12, 18953, 8476, 1105, 267, 327, 6061, 3063, 367, 949, 19745, 267, 1006, 275, 291, 14, 697, 14, 11636, 63, 452, 63, 5359, 360, 1569, 15, 8476, 297, 7478, 29, 549, 9, 267, 3850, 8, 452, 12, 3073, 421, 199, 318, 511, 63, 973, 837, 272, 511, 63, 4058, 14, 1065, 63, 2796, 8, 45, 1036, 4100, 1746, 9, 421, 199, 692, 636, 354, 363, 508, 4396, 973, 5727, 272, 511, 63, 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 ]
[ 13290, 199, 646, 5228, 199, 646, 2882, 199, 199, 504, 511, 492, 511, 63, 4058, 199, 199, 3, 30528, 652, 781, 2793, 1133, 5715, 3595, 5957, 1584, 26, 199, 7626, 1313, 14, 3159, 1725, 275, 942, 199, 7626, 1313, 14, 2730, 471, 275, 756, 199, 7626, 1313, 423, 885, 63, 7626, 63, 1313, 342, 421, 199, 533, 603, 1036, 4100, 1746, 8, 2796, 14, 1746, 304, 272, 347, 3613, 8, 277, 304, 267, 291, 14, 697, 275, 13290, 14, 45, 1036, 4100, 342, 339, 347, 511, 63, 885, 63, 576, 8, 277, 304, 267, 3850, 275, 291, 14, 629, 267, 3850, 8, 277, 14, 697, 14, 11636, 63, 466, 480, 1421, 14, 1360, 1288, 1689, 505, 15, 1360, 401, 488, 430, 267, 3850, 8, 277, 14, 697, 14, 11636, 63, 466, 480, 1421, 14, 27220, 1288, 1689, 3578, 15, 88, 13, 5369, 401, 298, 12256, 2237, 267, 3850, 8, 277, 14, 697, 14, 11636, 63, 466, 480, 1421, 14, 5369, 14, 6838, 1288, 1689, 3578, 15, 88, 13, 5369, 401, 298, 12256, 2237, 267, 3850, 8, 277, 14, 697, 14, 11636, 63, 466, 480, 1421, 14, 5369, 14, 58, 1288, 1689, 3578, 15, 88, 13, 5369, 401, 298, 6447, 2237, 339, 347, 511, 63, 576, 63, 3603, 8, 277, 304, 267, 3850, 275, 291, 14, 629, 267, 9519, 63, 466, 275, 291, 14, 697, 14, 11636, 63, 466, 267, 3850, 8, 11636, 63, 466, 480, 576, 11941, 3749, 1831, 1872, 20711, 1288, 1689, 505, 15, 6104, 401, 488, 430, 267, 3850, 8, 11636, 63, 466, 480, 576, 26, 27, 1095, 772, 12, 3749, 1831, 1872, 20711, 1288, 1689, 505, 15, 6104, 401, 488, 430, 267, 3850, 8, 11636, 63, 466, 480, 576, 26, 505, 15, 88, 13, 1421, 12, 3749, 1831, 1872, 56, 5686, 1288, 1689, 505, 15, 88, 13, 1421, 401, 488, 430, 339, 347, 511, 63, 493, 63, 11059, 8, 277, 304, 267, 3850, 275, 291, 14, 629, 267, 29129, 275, 5228, 14, 6424, 480, 88, 13, 3578, 15, 88, 13, 2796, 1134, 3248, 60, 78, 531, 267, 291, 14, 697, 14, 739, 3997, 8, 22961, 9, 267, 3850, 8, 277, 14, 697, 14, 11636, 63, 466, 480, 1421, 14, 647, 3248, 1288, 1779, 1689, 88, 13, 3578, 15, 88, 13, 2796, 401, 488, 430, 267, 3850, 8, 277, 14, 697, 14, 11636, 63, 3435, 480, 88, 13, 3578, 15, 88, 13, 2796, 1288, 3680, 647, 3248, 531, 339, 347, 511, 63, 2865, 63, 6807, 63, 1313, 8, 277, 304, 267, 3850, 275, 291, 14, 629, 267, 327, 7758, 862, 7478, 267, 3850, 8, 277, 14, 697, 14, 11636, 63, 466, 360, 1421, 14, 88, 348, 297, 7478, 29, 549, 395, 334, 403, 12, 488, 430, 267, 3850, 8, 277, 14, 697, 14, 11636, 63, 3435, 360, 1569, 15, 8476, 297, 7478, 29, 549, 395, 488, 9, 267, 327, 6061, 2066, 2222, 13, 4768, 267, 3850, 8, 277, 14, 697, 14, 11636, 63, 466, 360, 1421, 14, 88, 348, 297, 7478, 29, 797, 395, 661, 505, 15, 88, 348, 297, 488, 430, 267, 3850, 8, 277, 14, 697, 14, 11636, 63, 3435, 360, 1569, 15, 8476, 297, 7478, 29, 797, 395, 1987, 8476, 358, 339, 347, 511, 63, 11636, 63, 452, 63, 1313, 8, 277, 304, 267, 3850, 275, 291, 14, 629, 267, 7444, 275, 291, 14, 7589, 267, 327, 7758, 862, 7478, 14, 221, 3645, 282, 663, 2348, 367, 5343, 314, 2058, 2952, 340, 267, 327, 511, 63, 4078, 18, 365, 1255, 2544, 511, 63, 7626, 1313, 12, 2288, 1174, 365, 6042, 267, 327, 4066, 626, 314, 283, 452, 7, 663, 911, 1172, 1655, 2974, 315, 652, 14, 267, 1006, 275, 663, 8, 277, 14, 697, 14, 11636, 63, 452, 63, 5359, 360, 505, 15, 6104, 297, 7478, 29, 549, 430, 267, 7444, 8, 452, 2356, 663, 2941, 14, 13475, 297, 1987, 67, 297, 1987, 72, 297, 1987, 75, 609, 297, 1987, 1168, 297, 1987, 2424, 5156, 267, 327, 6061, 3063, 2222, 13, 4768, 267, 1006, 275, 291, 14, 697, 14, 11636, 63, 452, 63, 5359, 360, 1569, 15, 8476, 297, 7478, 29, 797, 9, 267, 1006, 14, 3191, 342, 267, 3850, 8, 452, 12, 18953, 8476, 1105, 267, 327, 6061, 3063, 367, 949, 19745, 267, 1006, 275, 291, 14, 697, 14, 11636, 63, 452, 63, 5359, 360, 1569, 15, 8476, 297, 7478, 29, 549, 9, 267, 3850, 8, 452, 12, 3073, 421, 199, 318, 511, 63, 973, 837, 272, 511, 63, 4058, 14, 1065, 63, 2796, 8, 45, 1036, 4100, 1746, 9, 421, 199, 692, 636, 354, 363, 508, 4396, 973, 5727, 272, 511, 63, 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, 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, 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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 ]
tomato42/tlsfuzzer
scripts/test-openssl-3712.py
1
9502
# Author: Hubert Kario, (c) 2015 # Released under Gnu GPL v2.0, see LICENSE file for details from __future__ import print_function import traceback import sys import getopt from itertools import chain from random import sample from tlsfuzzer.runner import Runner from tlsfuzzer.messages import Connect, ClientHelloGenerator, \ ClientKeyExchangeGenerator, ChangeCipherSpecGenerator, \ FinishedGenerator, ApplicationDataGenerator, AlertGenerator, \ ResetHandshakeHashes from tlsfuzzer.expect import ExpectServerHello, ExpectCertificate, \ ExpectServerHelloDone, ExpectChangeCipherSpec, ExpectFinished, \ ExpectAlert, ExpectApplicationData, ExpectClose from tlslite.constants import CipherSuite, AlertLevel, AlertDescription, \ ExtensionType from tlsfuzzer.utils.lists import natural_sort_keys version = 2 def help_msg(): print("Usage: <script-name> [-h hostname] [-p port] [[probe-name] ...]") print(" -h hostname name of the host to run the test against") print(" localhost by default") print(" -p port port number to use for connection, 4433 by default") print(" probe-name if present, will run only the probes with given") print(" names and not all of them, e.g \"sanity\"") print(" -e probe-name exclude the probe from the list of the ones run") print(" may be specified multiple times") print(" -x probe-name expect the probe to fail. When such probe passes despite being marked like this") print(" it will be reported in the test summary and the whole script will fail.") print(" May be specified multiple times.") print(" -X message expect the `message` substring in exception raised during") print(" execution of preceding expected failure probe") print(" usage: [-x probe-name] [-X exception], order is compulsory!") print(" -n num run 'num' or all(if 0) tests instead of default(all)") print(" (excluding \"sanity\" tests)") print(" --help this message") def main(): # # Test interleaving of Application Data with handshake messages, # requires server to support client initiated renegotiation # host = "localhost" port = 4433 num_limit = None run_exclude = set() expected_failures = {} last_exp_tmp = None argv = sys.argv[1:] opts, args = getopt.getopt(argv, "h:p:e:x:X:n:", ["help"]) for opt, arg in opts: if opt == '-h': host = arg elif opt == '-p': port = int(arg) elif opt == '-e': run_exclude.add(arg) elif opt == '-x': expected_failures[arg] = None last_exp_tmp = str(arg) elif opt == '-X': if not last_exp_tmp: raise ValueError("-x has to be specified before -X") expected_failures[last_exp_tmp] = str(arg) elif opt == '-n': num_limit = int(arg) elif opt == '--help': help_msg() sys.exit(0) else: raise ValueError("Unknown option: {0}".format(opt)) if args: run_only = set(args) else: run_only = None conversations = {} conversation = Connect(host, port) node = conversation ciphers = [CipherSuite.TLS_RSA_WITH_AES_128_CBC_SHA, CipherSuite.TLS_EMPTY_RENEGOTIATION_INFO_SCSV] node = node.add_child(ClientHelloGenerator(ciphers)) node = node.add_child(ExpectServerHello()) node = node.add_child(ExpectCertificate()) node = node.add_child(ExpectServerHelloDone()) node = node.add_child(ClientKeyExchangeGenerator()) node = node.add_child(ChangeCipherSpecGenerator()) node = node.add_child(FinishedGenerator()) node = node.add_child(ExpectChangeCipherSpec()) node = node.add_child(ExpectFinished()) node = node.add_child(ApplicationDataGenerator( bytearray(b"GET / HTTP/1.0\n\n"))) node = node.add_child(ExpectApplicationData()) node = node.add_child(AlertGenerator(AlertLevel.warning, AlertDescription.close_notify)) node = node.add_child(ExpectAlert()) node.next_sibling = ExpectClose() conversations["sanity"] = conversation conversation = Connect(host, port) node = conversation #ciphers = [CipherSuite.TLS_RSA_WITH_AES_128_CBC_SHA, # CipherSuite.TLS_EMPTY_RENEGOTIATION_INFO_SCSV] ciphers = [CipherSuite.TLS_RSA_WITH_AES_128_CBC_SHA] node = node.add_child(ClientHelloGenerator(ciphers, extensions={ExtensionType.renegotiation_info:None})) node = node.add_child(ExpectServerHello(extensions={ExtensionType.renegotiation_info:None})) node = node.add_child(ExpectCertificate()) node = node.add_child(ExpectServerHelloDone()) node = node.add_child(ClientKeyExchangeGenerator()) node = node.add_child(ChangeCipherSpecGenerator()) node = node.add_child(FinishedGenerator()) node = node.add_child(ExpectChangeCipherSpec()) node = node.add_child(ExpectFinished()) # 2nd handshake node = node.add_child(ResetHandshakeHashes()) node = node.add_child(ClientHelloGenerator([CipherSuite.TLS_RSA_WITH_AES_128_CBC_SHA], session_id=bytearray(0), extensions={ExtensionType.renegotiation_info:None})) node = node.add_child(ExpectServerHello(extensions={ExtensionType.renegotiation_info:None})) node = node.add_child(ExpectCertificate()) node = node.add_child(ExpectServerHelloDone()) node = node.add_child(ApplicationDataGenerator(bytearray(b"hello server!\n"))) node = node.add_child(ClientKeyExchangeGenerator()) node = node.add_child(ChangeCipherSpecGenerator()) node = node.add_child(FinishedGenerator()) node = node.add_child(ExpectChangeCipherSpec()) node = node.add_child(ExpectFinished()) node = node.add_child(ApplicationDataGenerator(bytearray(b"hello server!\n"))) #node = node.add_child(ExpectApplicationData(bytearray(b"hello client!\n"))) node = node.add_child(AlertGenerator(AlertLevel.warning, AlertDescription.close_notify)) node = node.add_child(ExpectAlert()) node.next_sibling = ExpectClose() node.next_sibling.next_sibling = ExpectApplicationData() conversations["weaved app data and handshake proto"] = conversation # run the conversation good = 0 bad = 0 xfail = 0 xpass = 0 failed = [] xpassed = [] if not num_limit: num_limit = len(conversations) # make sure that sanity test is run first and last # to verify that server was running and kept running throughout sanity_tests = [('sanity', conversations['sanity'])] if run_only: if num_limit > len(run_only): num_limit = len(run_only) regular_tests = [(k, v) for k, v in conversations.items() if k in run_only] else: regular_tests = [(k, v) for k, v in conversations.items() if (k != 'sanity') and k not in run_exclude] sampled_tests = sample(regular_tests, min(num_limit, len(regular_tests))) ordered_tests = chain(sanity_tests, sampled_tests, sanity_tests) for c_name, c_test in ordered_tests: if run_only and c_name not in run_only or c_name in run_exclude: continue print("{0} ...".format(c_name)) runner = Runner(c_test) res = True exception = None try: runner.run() except Exception as exp: exception = exp print("Error while processing") print(traceback.format_exc()) res = False if c_name in expected_failures: if res: xpass += 1 xpassed.append(c_name) print("XPASS-expected failure but test passed\n") else: if expected_failures[c_name] is not None and \ expected_failures[c_name] not in str(exception): bad += 1 failed.append(c_name) print("Expected error message: {0}\n" .format(expected_failures[c_name])) else: xfail += 1 print("OK-expected failure\n") else: if res: good += 1 print("OK\n") else: bad += 1 failed.append(c_name) print("Test end") print(20 * '=') print("version: {0}".format(version)) print(20 * '=') print("TOTAL: {0}".format(len(sampled_tests) + 2*len(sanity_tests))) print("SKIP: {0}".format(len(run_exclude.intersection(conversations.keys())))) print("PASS: {0}".format(good)) print("XFAIL: {0}".format(xfail)) print("FAIL: {0}".format(bad)) print("XPASS: {0}".format(xpass)) print(20 * '=') sort = sorted(xpassed ,key=natural_sort_keys) if len(sort): print("XPASSED:\n\t{0}".format('\n\t'.join(repr(i) for i in sort))) sort = sorted(failed, key=natural_sort_keys) if len(sort): print("FAILED:\n\t{0}".format('\n\t'.join(repr(i) for i in sort))) if bad > 0: sys.exit(1) if __name__ == "__main__": main()
gpl-2.0
[ 3, 6529, 26, 869, 10400, 84, 1804, 6936, 12, 334, 67, 9, 6900, 199, 3, 17646, 68, 1334, 598, 4850, 14629, 373, 18, 14, 16, 12, 1937, 5113, 570, 367, 2436, 199, 199, 504, 636, 2443, 363, 492, 870, 63, 1593, 199, 646, 5190, 199, 646, 984, 199, 646, 12733, 199, 504, 7975, 492, 6036, 199, 504, 2196, 492, 2690, 199, 199, 504, 15142, 70, 9494, 2282, 14, 5933, 492, 3378, 1372, 199, 504, 15142, 70, 9494, 2282, 14, 3431, 492, 15175, 12, 6810, 6257, 7599, 12, 971, 267, 6810, 1197, 13188, 7599, 12, 7743, 21967, 5307, 7599, 12, 971, 267, 11711, 4387, 7599, 12, 13515, 1451, 7599, 12, 25762, 7599, 12, 971, 267, 15510, 26392, 31660, 199, 504, 15142, 70, 9494, 2282, 14, 4921, 492, 15100, 3120, 6257, 12, 15100, 11414, 12, 971, 267, 15100, 3120, 6257, 10759, 12, 15100, 4001, 21967, 5307, 12, 15100, 13430, 12, 971, 267, 15100, 18758, 12, 15100, 5039, 1451, 12, 15100, 4724, 199, 199, 504, 15142, 5333, 14, 5559, 492, 29683, 6207, 12, 25762, 4670, 12, 25762, 5831, 12, 971, 267, 13282, 804, 199, 504, 15142, 70, 9494, 2282, 14, 1208, 14, 6717, 492, 19981, 63, 3191, 63, 1612, 199, 199, 1023, 275, 499, 199, 199, 318, 1720, 63, 1328, 837, 272, 870, 480, 7692, 26, 665, 1579, 13, 354, 30, 5243, 72, 6246, 61, 5243, 80, 1844, 61, 3474, 15944, 13, 354, 61, 2263, 12523, 272, 870, 480, 446, 72, 6246, 259, 536, 402, 314, 1591, 370, 1255, 314, 511, 6169, 531, 272, 870, 480, 4483, 11667, 701, 849, 531, 272, 870, 480, 446, 80, 1844, 263, 1844, 1329, 370, 675, 367, 1950, 12, 10868, 1153, 701, 849, 531, 272, 870, 480, 22362, 13, 354, 258, 340, 3451, 12, 911, 1255, 1454, 314, 5128, 397, 543, 1627, 531, 272, 870, 480, 4483, 1561, 436, 440, 1006, 402, 3062, 12, 325, 14, 71, 8441, 21614, 60, 7230, 272, 870, 480, 446, 69, 22362, 13, 354, 221, 5760, 314, 22362, 687, 314, 769, 402, 314, 7869, 1255, 531, 272, 870, 480, 4483, 1443, 506, 2013, 3663, 5431, 531, 272, 870, 480, 446, 88, 22362, 13, 354, 221, 4282, 314, 22362, 370, 2449, 14, 3979, 4066, 22362, 14933, 477, 681, 1175, 3769, 11584, 2839, 642, 531, 272, 870, 480, 4483, 652, 911, 506, 14581, 315, 314, 511, 6212, 436, 314, 8852, 2884, 911, 2449, 2685, 272, 870, 480, 4483, 10162, 506, 2013, 3663, 5431, 2685, 272, 870, 480, 446, 56, 1245, 258, 4282, 314, 658, 1188, 64, 20597, 315, 1919, 4915, 5309, 531, 272, 870, 480, 4483, 6451, 402, 22627, 1420, 5988, 22362, 531, 272, 870, 480, 4483, 4503, 26, 5243, 88, 22362, 13, 354, 61, 5243, 56, 1919, 467, 1865, 365, 1013, 348, 83, 1089, 9124, 272, 870, 480, 446, 78, 1967, 260, 1255, 283, 1507, 7, 503, 1006, 8, 692, 378, 9, 2295, 3140, 402, 849, 8, 452, 6320, 272, 870, 480, 4483, 334, 476, 4923, 8441, 21614, 4451, 2295, 6320, 272, 870, 480, 1553, 3437, 260, 642, 1245, 531, 421, 199, 318, 2446, 837, 272, 327, 272, 327, 1379, 1640, 274, 5519, 402, 13515, 3918, 543, 14305, 3788, 12, 272, 327, 5074, 1654, 370, 2291, 1890, 11023, 972, 295, 21961, 425, 272, 327, 272, 1591, 275, 298, 5967, 2, 272, 1844, 275, 10868, 1153, 272, 1967, 63, 3097, 275, 488, 272, 1255, 63, 5473, 275, 663, 342, 272, 1420, 63, 9968, 275, 1052, 272, 2061, 63, 1474, 63, 2791, 275, 488, 339, 9238, 275, 984, 14, 3020, 59, 17, 2938, 272, 3999, 12, 1249, 275, 12733, 14, 18907, 8, 3020, 12, 298, 72, 26, 80, 26, 69, 26, 88, 26, 56, 26, 78, 6783, 2097, 3437, 3135, 272, 367, 2450, 12, 1680, 315, 3999, 26, 267, 340, 2450, 508, 2475, 72, 356, 288, 1591, 275, 1680, 267, 916, 2450, 508, 2475, 80, 356, 288, 1844, 275, 1109, 8, 1273, 9, 267, 916, 2450, 508, 2475, 69, 356, 288, 1255, 63, 5473, 14, 525, 8, 1273, 9, 267, 916, 2450, 508, 2475, 88, 356, 288, 1420, 63, 9968, 59, 1273, 61, 275, 488, 288, 2061, 63, 1474, 63, 2791, 275, 620, 8, 1273, 9, 267, 916, 2450, 508, 2475, 56, 356, 288, 340, 440, 2061, 63, 1474, 63, 2791, 26, 355, 746, 1722, 6096, 88, 965, 370, 506, 2013, 2544, 446, 56, 531, 288, 1420, 63, 9968, 59, 2019, 63, 1474, 63, 2791, 61, 275, 620, 8, 1273, 9, 267, 916, 2450, 508, 2475, 78, 356, 288, 1967, 63, 3097, 275, 1109, 8, 1273, 9, 267, 916, 2450, 508, 2850, 3437, 356, 288, 1720, 63, 1328, 342, 288, 984, 14, 2224, 8, 16, 9, 267, 587, 26, 288, 746, 1722, 480, 5912, 945, 26, 469, 16, 5469, 908, 8, 2992, 430, 339, 340, 1249, 26, 267, 1255, 63, 2118, 275, 663, 8, 589, 9, 272, 587, 26, 267, 1255, 63, 2118, 275, 488, 339, 3818, 83, 1298, 275, 1052, 339, 3818, 20592, 275, 15175, 8, 1102, 12, 1844, 9, 272, 1031, 275, 3818, 20592, 272, 30377, 275, 359, 21967, 6207, 14, 10224, 63, 12115, 63, 9139, 63, 14494, 63, 3933, 63, 18255, 63, 8461, 12, 2049, 29683, 6207, 14, 10224, 63, 13993, 63, 50, 742, 4680, 1387, 41, 2594, 63, 4531, 63, 14897, 54, 61, 272, 1031, 275, 1031, 14, 525, 63, 1739, 8, 3041, 6257, 7599, 8, 27426, 430, 272, 1031, 275, 1031, 14, 525, 63, 1739, 8, 13495, 3120, 6257, 1012, 272, 1031, 275, 1031, 14, 525, 63, 1739, 8, 13495, 11414, 1012, 272, 1031, 275, 1031, 14, 525, 63, 1739, 8, 13495, 3120, 6257, 10759, 1012, 272, 1031, 275, 1031, 14, 525, 63, 1739, 8, 3041, 1197, 13188, 7599, 1012, 272, 1031, 275, 1031, 14, 525, 63, 1739, 8, 4001, 21967, 5307, 7599, 1012, 272, 1031, 275, 1031, 14, 525, 63, 1739, 8, 13430, 7599, 1012, 272, 1031, 275, 1031, 14, 525, 63, 1739, 8, 13495, 4001, 21967, 5307, 1012, 272, 1031, 275, 1031, 14, 525, 63, 1739, 8, 13495, 13430, 1012, 272, 1031, 275, 1031, 14, 525, 63, 1739, 8, 5039, 1451, 7599, 8, 267, 11640, 8, 66, 2, 2970, 1182, 3101, 15, 17, 14, 16, 60, 78, 60, 78, 13324, 272, 1031, 275, 1031, 14, 525, 63, 1739, 8, 13495, 5039, 1451 ]
[ 6529, 26, 869, 10400, 84, 1804, 6936, 12, 334, 67, 9, 6900, 199, 3, 17646, 68, 1334, 598, 4850, 14629, 373, 18, 14, 16, 12, 1937, 5113, 570, 367, 2436, 199, 199, 504, 636, 2443, 363, 492, 870, 63, 1593, 199, 646, 5190, 199, 646, 984, 199, 646, 12733, 199, 504, 7975, 492, 6036, 199, 504, 2196, 492, 2690, 199, 199, 504, 15142, 70, 9494, 2282, 14, 5933, 492, 3378, 1372, 199, 504, 15142, 70, 9494, 2282, 14, 3431, 492, 15175, 12, 6810, 6257, 7599, 12, 971, 267, 6810, 1197, 13188, 7599, 12, 7743, 21967, 5307, 7599, 12, 971, 267, 11711, 4387, 7599, 12, 13515, 1451, 7599, 12, 25762, 7599, 12, 971, 267, 15510, 26392, 31660, 199, 504, 15142, 70, 9494, 2282, 14, 4921, 492, 15100, 3120, 6257, 12, 15100, 11414, 12, 971, 267, 15100, 3120, 6257, 10759, 12, 15100, 4001, 21967, 5307, 12, 15100, 13430, 12, 971, 267, 15100, 18758, 12, 15100, 5039, 1451, 12, 15100, 4724, 199, 199, 504, 15142, 5333, 14, 5559, 492, 29683, 6207, 12, 25762, 4670, 12, 25762, 5831, 12, 971, 267, 13282, 804, 199, 504, 15142, 70, 9494, 2282, 14, 1208, 14, 6717, 492, 19981, 63, 3191, 63, 1612, 199, 199, 1023, 275, 499, 199, 199, 318, 1720, 63, 1328, 837, 272, 870, 480, 7692, 26, 665, 1579, 13, 354, 30, 5243, 72, 6246, 61, 5243, 80, 1844, 61, 3474, 15944, 13, 354, 61, 2263, 12523, 272, 870, 480, 446, 72, 6246, 259, 536, 402, 314, 1591, 370, 1255, 314, 511, 6169, 531, 272, 870, 480, 4483, 11667, 701, 849, 531, 272, 870, 480, 446, 80, 1844, 263, 1844, 1329, 370, 675, 367, 1950, 12, 10868, 1153, 701, 849, 531, 272, 870, 480, 22362, 13, 354, 258, 340, 3451, 12, 911, 1255, 1454, 314, 5128, 397, 543, 1627, 531, 272, 870, 480, 4483, 1561, 436, 440, 1006, 402, 3062, 12, 325, 14, 71, 8441, 21614, 60, 7230, 272, 870, 480, 446, 69, 22362, 13, 354, 221, 5760, 314, 22362, 687, 314, 769, 402, 314, 7869, 1255, 531, 272, 870, 480, 4483, 1443, 506, 2013, 3663, 5431, 531, 272, 870, 480, 446, 88, 22362, 13, 354, 221, 4282, 314, 22362, 370, 2449, 14, 3979, 4066, 22362, 14933, 477, 681, 1175, 3769, 11584, 2839, 642, 531, 272, 870, 480, 4483, 652, 911, 506, 14581, 315, 314, 511, 6212, 436, 314, 8852, 2884, 911, 2449, 2685, 272, 870, 480, 4483, 10162, 506, 2013, 3663, 5431, 2685, 272, 870, 480, 446, 56, 1245, 258, 4282, 314, 658, 1188, 64, 20597, 315, 1919, 4915, 5309, 531, 272, 870, 480, 4483, 6451, 402, 22627, 1420, 5988, 22362, 531, 272, 870, 480, 4483, 4503, 26, 5243, 88, 22362, 13, 354, 61, 5243, 56, 1919, 467, 1865, 365, 1013, 348, 83, 1089, 9124, 272, 870, 480, 446, 78, 1967, 260, 1255, 283, 1507, 7, 503, 1006, 8, 692, 378, 9, 2295, 3140, 402, 849, 8, 452, 6320, 272, 870, 480, 4483, 334, 476, 4923, 8441, 21614, 4451, 2295, 6320, 272, 870, 480, 1553, 3437, 260, 642, 1245, 531, 421, 199, 318, 2446, 837, 272, 327, 272, 327, 1379, 1640, 274, 5519, 402, 13515, 3918, 543, 14305, 3788, 12, 272, 327, 5074, 1654, 370, 2291, 1890, 11023, 972, 295, 21961, 425, 272, 327, 272, 1591, 275, 298, 5967, 2, 272, 1844, 275, 10868, 1153, 272, 1967, 63, 3097, 275, 488, 272, 1255, 63, 5473, 275, 663, 342, 272, 1420, 63, 9968, 275, 1052, 272, 2061, 63, 1474, 63, 2791, 275, 488, 339, 9238, 275, 984, 14, 3020, 59, 17, 2938, 272, 3999, 12, 1249, 275, 12733, 14, 18907, 8, 3020, 12, 298, 72, 26, 80, 26, 69, 26, 88, 26, 56, 26, 78, 6783, 2097, 3437, 3135, 272, 367, 2450, 12, 1680, 315, 3999, 26, 267, 340, 2450, 508, 2475, 72, 356, 288, 1591, 275, 1680, 267, 916, 2450, 508, 2475, 80, 356, 288, 1844, 275, 1109, 8, 1273, 9, 267, 916, 2450, 508, 2475, 69, 356, 288, 1255, 63, 5473, 14, 525, 8, 1273, 9, 267, 916, 2450, 508, 2475, 88, 356, 288, 1420, 63, 9968, 59, 1273, 61, 275, 488, 288, 2061, 63, 1474, 63, 2791, 275, 620, 8, 1273, 9, 267, 916, 2450, 508, 2475, 56, 356, 288, 340, 440, 2061, 63, 1474, 63, 2791, 26, 355, 746, 1722, 6096, 88, 965, 370, 506, 2013, 2544, 446, 56, 531, 288, 1420, 63, 9968, 59, 2019, 63, 1474, 63, 2791, 61, 275, 620, 8, 1273, 9, 267, 916, 2450, 508, 2475, 78, 356, 288, 1967, 63, 3097, 275, 1109, 8, 1273, 9, 267, 916, 2450, 508, 2850, 3437, 356, 288, 1720, 63, 1328, 342, 288, 984, 14, 2224, 8, 16, 9, 267, 587, 26, 288, 746, 1722, 480, 5912, 945, 26, 469, 16, 5469, 908, 8, 2992, 430, 339, 340, 1249, 26, 267, 1255, 63, 2118, 275, 663, 8, 589, 9, 272, 587, 26, 267, 1255, 63, 2118, 275, 488, 339, 3818, 83, 1298, 275, 1052, 339, 3818, 20592, 275, 15175, 8, 1102, 12, 1844, 9, 272, 1031, 275, 3818, 20592, 272, 30377, 275, 359, 21967, 6207, 14, 10224, 63, 12115, 63, 9139, 63, 14494, 63, 3933, 63, 18255, 63, 8461, 12, 2049, 29683, 6207, 14, 10224, 63, 13993, 63, 50, 742, 4680, 1387, 41, 2594, 63, 4531, 63, 14897, 54, 61, 272, 1031, 275, 1031, 14, 525, 63, 1739, 8, 3041, 6257, 7599, 8, 27426, 430, 272, 1031, 275, 1031, 14, 525, 63, 1739, 8, 13495, 3120, 6257, 1012, 272, 1031, 275, 1031, 14, 525, 63, 1739, 8, 13495, 11414, 1012, 272, 1031, 275, 1031, 14, 525, 63, 1739, 8, 13495, 3120, 6257, 10759, 1012, 272, 1031, 275, 1031, 14, 525, 63, 1739, 8, 3041, 1197, 13188, 7599, 1012, 272, 1031, 275, 1031, 14, 525, 63, 1739, 8, 4001, 21967, 5307, 7599, 1012, 272, 1031, 275, 1031, 14, 525, 63, 1739, 8, 13430, 7599, 1012, 272, 1031, 275, 1031, 14, 525, 63, 1739, 8, 13495, 4001, 21967, 5307, 1012, 272, 1031, 275, 1031, 14, 525, 63, 1739, 8, 13495, 13430, 1012, 272, 1031, 275, 1031, 14, 525, 63, 1739, 8, 5039, 1451, 7599, 8, 267, 11640, 8, 66, 2, 2970, 1182, 3101, 15, 17, 14, 16, 60, 78, 60, 78, 13324, 272, 1031, 275, 1031, 14, 525, 63, 1739, 8, 13495, 5039, 1451, 0 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
tdliu/hoop-picks
lib/requests/packages/chardet/big5freq.py
3133
82594
######################## BEGIN LICENSE BLOCK ######################## # The Original Code is Mozilla Communicator client code. # # The Initial Developer of the Original Code is # Netscape Communications Corporation. # Portions created by the Initial Developer are Copyright (C) 1998 # the Initial Developer. All Rights Reserved. # # Contributor(s): # Mark Pilgrim - port to Python # # 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 ######################### # Big5 frequency table # by Taiwan's Mandarin Promotion Council # <http://www.edu.tw:81/mandr/> # # 128 --> 0.42261 # 256 --> 0.57851 # 512 --> 0.74851 # 1024 --> 0.89384 # 2048 --> 0.97583 # # Ideal Distribution Ratio = 0.74851/(1-0.74851) =2.98 # Random Distribution Ration = 512/(5401-512)=0.105 # # Typical Distribution Ratio about 25% of Ideal one, still much higher than RDR BIG5_TYPICAL_DISTRIBUTION_RATIO = 0.75 #Char to FreqOrder table BIG5_TABLE_SIZE = 5376 Big5CharToFreqOrder = ( 1,1801,1506, 255,1431, 198, 9, 82, 6,5008, 177, 202,3681,1256,2821, 110, # 16 3814, 33,3274, 261, 76, 44,2114, 16,2946,2187,1176, 659,3971, 26,3451,2653, # 32 1198,3972,3350,4202, 410,2215, 302, 590, 361,1964, 8, 204, 58,4510,5009,1932, # 48 63,5010,5011, 317,1614, 75, 222, 159,4203,2417,1480,5012,3555,3091, 224,2822, # 64 3682, 3, 10,3973,1471, 29,2787,1135,2866,1940, 873, 130,3275,1123, 312,5013, # 80 4511,2052, 507, 252, 682,5014, 142,1915, 124, 206,2947, 34,3556,3204, 64, 604, # 96 5015,2501,1977,1978, 155,1991, 645, 641,1606,5016,3452, 337, 72, 406,5017, 80, # 112 630, 238,3205,1509, 263, 939,1092,2654, 756,1440,1094,3453, 449, 69,2987, 591, # 128 179,2096, 471, 115,2035,1844, 60, 50,2988, 134, 806,1869, 734,2036,3454, 180, # 144 995,1607, 156, 537,2907, 688,5018, 319,1305, 779,2145, 514,2379, 298,4512, 359, # 160 2502, 90,2716,1338, 663, 11, 906,1099,2553, 20,2441, 182, 532,1716,5019, 732, # 176 1376,4204,1311,1420,3206, 25,2317,1056, 113, 399, 382,1950, 242,3455,2474, 529, # 192 3276, 475,1447,3683,5020, 117, 21, 656, 810,1297,2300,2334,3557,5021, 126,4205, # 208 706, 456, 150, 613,4513, 71,1118,2037,4206, 145,3092, 85, 835, 486,2115,1246, # 224 1426, 428, 727,1285,1015, 800, 106, 623, 303,1281,5022,2128,2359, 347,3815, 221, # 240 3558,3135,5023,1956,1153,4207, 83, 296,1199,3093, 192, 624, 93,5024, 822,1898, # 256 2823,3136, 795,2065, 991,1554,1542,1592, 27, 43,2867, 859, 139,1456, 860,4514, # 272 437, 712,3974, 164,2397,3137, 695, 211,3037,2097, 195,3975,1608,3559,3560,3684, # 288 3976, 234, 811,2989,2098,3977,2233,1441,3561,1615,2380, 668,2077,1638, 305, 228, # 304 1664,4515, 467, 415,5025, 262,2099,1593, 239, 108, 300, 200,1033, 512,1247,2078, # 320 5026,5027,2176,3207,3685,2682, 593, 845,1062,3277, 88,1723,2038,3978,1951, 212, # 336 266, 152, 149, 468,1899,4208,4516, 77, 187,5028,3038, 37, 5,2990,5029,3979, # 352 5030,5031, 39,2524,4517,2908,3208,2079, 55, 148, 74,4518, 545, 483,1474,1029, # 368 1665, 217,1870,1531,3138,1104,2655,4209, 24, 172,3562, 900,3980,3563,3564,4519, # 384 32,1408,2824,1312, 329, 487,2360,2251,2717, 784,2683, 4,3039,3351,1427,1789, # 400 188, 109, 499,5032,3686,1717,1790, 888,1217,3040,4520,5033,3565,5034,3352,1520, # 416 3687,3981, 196,1034, 775,5035,5036, 929,1816, 249, 439, 38,5037,1063,5038, 794, # 432 3982,1435,2301, 46, 178,3278,2066,5039,2381,5040, 214,1709,4521, 804, 35, 707, # 448 324,3688,1601,2554, 140, 459,4210,5041,5042,1365, 839, 272, 978,2262,2580,3456, # 464 2129,1363,3689,1423, 697, 100,3094, 48, 70,1231, 495,3139,2196,5043,1294,5044, # 480 2080, 462, 586,1042,3279, 853, 256, 988, 185,2382,3457,1698, 434,1084,5045,3458, # 496 314,2625,2788,4522,2335,2336, 569,2285, 637,1817,2525, 757,1162,1879,1616,3459, # 512 287,1577,2116, 768,4523,1671,2868,3566,2526,1321,3816, 909,2418,5046,4211, 933, # 528 3817,4212,2053,2361,1222,4524, 765,2419,1322, 786,4525,5047,1920,1462,1677,2909, # 544 1699,5048,4526,1424,2442,3140,3690,2600,3353,1775,1941,3460,3983,4213, 309,1369, # 560 1130,2825, 364,2234,1653,1299,3984,3567,3985,3986,2656, 525,1085,3041, 902,2001, # 576 1475, 964,4527, 421,1845,1415,1057,2286, 940,1364,3141, 376,4528,4529,1381, 7, # 592 2527, 983,2383, 336,1710,2684,1846, 321,3461, 559,1131,3042,2752,1809,1132,1313, # 608 265,1481,1858,5049, 352,1203,2826,3280, 167,1089, 420,2827, 776, 792,1724,3568, # 624 4214,2443,3281,5050,4215,5051, 446, 229, 333,2753, 901,3818,1200,1557,4530,2657, # 640 1921, 395,2754,2685,3819,4216,1836, 125, 916,3209,2626,4531,5052,5053,3820,5054, # 656 5055,5056,4532,3142,3691,1133,2555,1757,3462,1510,2318,1409,3569,5057,2146, 438, # 672 2601,2910,2384,3354,1068, 958,3043, 461, 311,2869,2686,4217,1916,3210,4218,1979, # 688 383, 750,2755,2627,4219, 274, 539, 385,1278,1442,5058,1154,1965, 384, 561, 210, # 704 98,1295,2556,3570,5059,1711,2420,1482,3463,3987,2911,1257, 129,5060,3821, 642, # 720 523,2789,2790,2658,5061, 141,2235,1333, 68, 176, 441, 876, 907,4220, 603,2602, # 736 710, 171,3464, 404, 549, 18,3143,2398,1410,3692,1666,5062,3571,4533,2912,4534, # 752 5063,2991, 368,5064, 146, 366, 99, 871,3693,1543, 748, 807,1586,1185, 22,2263, # 768 379,3822,3211,5065,3212, 505,1942,2628,1992,1382,2319,5066, 380,2362, 218, 702, # 784 1818,1248,3465,3044,3572,3355,3282,5067,2992,3694, 930,3283,3823,5068, 59,5069, # 800 585, 601,4221, 497,3466,1112,1314,4535,1802,5070,1223,1472,2177,5071, 749,1837, # 816 690,1900,3824,1773,3988,1476, 429,1043,1791,2236,2117, 917,4222, 447,1086,1629, # 832 5072, 556,5073,5074,2021,1654, 844,1090, 105, 550, 966,1758,2828,1008,1783, 686, # 848 1095,5075,2287, 793,1602,5076,3573,2603,4536,4223,2948,2302,4537,3825, 980,2503, # 864 544, 353, 527,4538, 908,2687,2913,5077, 381,2629,1943,1348,5078,1341,1252, 560, # 880 3095,5079,3467,2870,5080,2054, 973, 886,2081, 143,4539,5081,5082, 157,3989, 496, # 896 4224, 57, 840, 540,2039,4540,4541,3468,2118,1445, 970,2264,1748,1966,2082,4225, # 912 3144,1234,1776,3284,2829,3695, 773,1206,2130,1066,2040,1326,3990,1738,1725,4226, # 928 279,3145, 51,1544,2604, 423,1578,2131,2067, 173,4542,1880,5083,5084,1583, 264, # 944 610,3696,4543,2444, 280, 154,5085,5086,5087,1739, 338,1282,3096, 693,2871,1411, # 960 1074,3826,2445,5088,4544,5089,5090,1240, 952,2399,5091,2914,1538,2688, 685,1483, # 976 4227,2475,1436, 953,4228,2055,4545, 671,2400, 79,4229,2446,3285, 608, 567,2689, # 992 3469,4230,4231,1691, 393,1261,1792,2401,5092,4546,5093,5094,5095,5096,1383,1672, # 1008 3827,3213,1464, 522,1119, 661,1150, 216, 675,4547,3991,1432,3574, 609,4548,2690, # 1024 2402,5097,5098,5099,4232,3045, 0,5100,2476, 315, 231,2447, 301,3356,4549,2385, # 1040 5101, 233,4233,3697,1819,4550,4551,5102, 96,1777,1315,2083,5103, 257,5104,1810, # 1056 3698,2718,1139,1820,4234,2022,1124,2164,2791,1778,2659,5105,3097, 363,1655,3214, # 1072 5106,2993,5107,5108,5109,3992,1567,3993, 718, 103,3215, 849,1443, 341,3357,2949, # 1088 1484,5110,1712, 127, 67, 339,4235,2403, 679,1412, 821,5111,5112, 834, 738, 351, # 1104 2994,2147, 846, 235,1497,1881, 418,1993,3828,2719, 186,1100,2148,2756,3575,1545, # 1120 1355,2950,2872,1377, 583,3994,4236,2581,2995,5113,1298,3699,1078,2557,3700,2363, # 1136 78,3829,3830, 267,1289,2100,2002,1594,4237, 348, 369,1274,2197,2178,1838,4552, # 1152 1821,2830,3701,2757,2288,2003,4553,2951,2758, 144,3358, 882,4554,3995,2759,3470, # 1168 4555,2915,5114,4238,1726, 320,5115,3996,3046, 788,2996,5116,2831,1774,1327,2873, # 1184 3997,2832,5117,1306,4556,2004,1700,3831,3576,2364,2660, 787,2023, 506, 824,3702, # 1200 534, 323,4557,1044,3359,2024,1901, 946,3471,5118,1779,1500,1678,5119,1882,4558, # 1216 165, 243,4559,3703,2528, 123, 683,4239, 764,4560, 36,3998,1793, 589,2916, 816, # 1232 626,1667,3047,2237,1639,1555,1622,3832,3999,5120,4000,2874,1370,1228,1933, 891, # 1248 2084,2917, 304,4240,5121, 292,2997,2720,3577, 691,2101,4241,1115,4561, 118, 662, # 1264 5122, 611,1156, 854,2386,1316,2875, 2, 386, 515,2918,5123,5124,3286, 868,2238, # 1280 1486, 855,2661, 785,2216,3048,5125,1040,3216,3578,5126,3146, 448,5127,1525,5128, # 1296 2165,4562,5129,3833,5130,4242,2833,3579,3147, 503, 818,4001,3148,1568, 814, 676, # 1312 1444, 306,1749,5131,3834,1416,1030, 197,1428, 805,2834,1501,4563,5132,5133,5134, # 1328 1994,5135,4564,5136,5137,2198, 13,2792,3704,2998,3149,1229,1917,5138,3835,2132, # 1344 5139,4243,4565,2404,3580,5140,2217,1511,1727,1120,5141,5142, 646,3836,2448, 307, # 1360 5143,5144,1595,3217,5145,5146,5147,3705,1113,1356,4002,1465,2529,2530,5148, 519, # 1376 5149, 128,2133, 92,2289,1980,5150,4003,1512, 342,3150,2199,5151,2793,2218,1981, # 1392 3360,4244, 290,1656,1317, 789, 827,2365,5152,3837,4566, 562, 581,4004,5153, 401, # 1408 4567,2252, 94,4568,5154,1399,2794,5155,1463,2025,4569,3218,1944,5156, 828,1105, # 1424 4245,1262,1394,5157,4246, 605,4570,5158,1784,2876,5159,2835, 819,2102, 578,2200, # 1440 2952,5160,1502, 436,3287,4247,3288,2836,4005,2919,3472,3473,5161,2721,2320,5162, # 1456 5163,2337,2068, 23,4571, 193, 826,3838,2103, 699,1630,4248,3098, 390,1794,1064, # 1472 3581,5164,1579,3099,3100,1400,5165,4249,1839,1640,2877,5166,4572,4573, 137,4250, # 1488 598,3101,1967, 780, 104, 974,2953,5167, 278, 899, 253, 402, 572, 504, 493,1339, # 1504 5168,4006,1275,4574,2582,2558,5169,3706,3049,3102,2253, 565,1334,2722, 863, 41, # 1520 5170,5171,4575,5172,1657,2338, 19, 463,2760,4251, 606,5173,2999,3289,1087,2085, # 1536 1323,2662,3000,5174,1631,1623,1750,4252,2691,5175,2878, 791,2723,2663,2339, 232, # 1552 2421,5176,3001,1498,5177,2664,2630, 755,1366,3707,3290,3151,2026,1609, 119,1918, # 1568 3474, 862,1026,4253,5178,4007,3839,4576,4008,4577,2265,1952,2477,5179,1125, 817, # 1584 4254,4255,4009,1513,1766,2041,1487,4256,3050,3291,2837,3840,3152,5180,5181,1507, # 1600 5182,2692, 733, 40,1632,1106,2879, 345,4257, 841,2531, 230,4578,3002,1847,3292, # 1616 3475,5183,1263, 986,3476,5184, 735, 879, 254,1137, 857, 622,1300,1180,1388,1562, # 1632 4010,4011,2954, 967,2761,2665,1349, 592,2134,1692,3361,3003,1995,4258,1679,4012, # 1648 1902,2188,5185, 739,3708,2724,1296,1290,5186,4259,2201,2202,1922,1563,2605,2559, # 1664 1871,2762,3004,5187, 435,5188, 343,1108, 596, 17,1751,4579,2239,3477,3709,5189, # 1680 4580, 294,3582,2955,1693, 477, 979, 281,2042,3583, 643,2043,3710,2631,2795,2266, # 1696 1031,2340,2135,2303,3584,4581, 367,1249,2560,5190,3585,5191,4582,1283,3362,2005, # 1712 240,1762,3363,4583,4584, 836,1069,3153, 474,5192,2149,2532, 268,3586,5193,3219, # 1728 1521,1284,5194,1658,1546,4260,5195,3587,3588,5196,4261,3364,2693,1685,4262, 961, # 1744 1673,2632, 190,2006,2203,3841,4585,4586,5197, 570,2504,3711,1490,5198,4587,2633, # 1760 3293,1957,4588, 584,1514, 396,1045,1945,5199,4589,1968,2449,5200,5201,4590,4013, # 1776 619,5202,3154,3294, 215,2007,2796,2561,3220,4591,3221,4592, 763,4263,3842,4593, # 1792 5203,5204,1958,1767,2956,3365,3712,1174, 452,1477,4594,3366,3155,5205,2838,1253, # 1808 2387,2189,1091,2290,4264, 492,5206, 638,1169,1825,2136,1752,4014, 648, 926,1021, # 1824 1324,4595, 520,4596, 997, 847,1007, 892,4597,3843,2267,1872,3713,2405,1785,4598, # 1840 1953,2957,3103,3222,1728,4265,2044,3714,4599,2008,1701,3156,1551, 30,2268,4266, # 1856 5207,2027,4600,3589,5208, 501,5209,4267, 594,3478,2166,1822,3590,3479,3591,3223, # 1872 829,2839,4268,5210,1680,3157,1225,4269,5211,3295,4601,4270,3158,2341,5212,4602, # 1888 4271,5213,4015,4016,5214,1848,2388,2606,3367,5215,4603, 374,4017, 652,4272,4273, # 1904 375,1140, 798,5216,5217,5218,2366,4604,2269, 546,1659, 138,3051,2450,4605,5219, # 1920 2254, 612,1849, 910, 796,3844,1740,1371, 825,3845,3846,5220,2920,2562,5221, 692, # 1936 444,3052,2634, 801,4606,4274,5222,1491, 244,1053,3053,4275,4276, 340,5223,4018, # 1952 1041,3005, 293,1168, 87,1357,5224,1539, 959,5225,2240, 721, 694,4277,3847, 219, # 1968 1478, 644,1417,3368,2666,1413,1401,1335,1389,4019,5226,5227,3006,2367,3159,1826, # 1984 730,1515, 184,2840, 66,4607,5228,1660,2958, 246,3369, 378,1457, 226,3480, 975, # 2000 4020,2959,1264,3592, 674, 696,5229, 163,5230,1141,2422,2167, 713,3593,3370,4608, # 2016 4021,5231,5232,1186, 15,5233,1079,1070,5234,1522,3224,3594, 276,1050,2725, 758, # 2032 1126, 653,2960,3296,5235,2342, 889,3595,4022,3104,3007, 903,1250,4609,4023,3481, # 2048 3596,1342,1681,1718, 766,3297, 286, 89,2961,3715,5236,1713,5237,2607,3371,3008, # 2064 5238,2962,2219,3225,2880,5239,4610,2505,2533, 181, 387,1075,4024, 731,2190,3372, # 2080 5240,3298, 310, 313,3482,2304, 770,4278, 54,3054, 189,4611,3105,3848,4025,5241, # 2096 1230,1617,1850, 355,3597,4279,4612,3373, 111,4280,3716,1350,3160,3483,3055,4281, # 2112 2150,3299,3598,5242,2797,4026,4027,3009, 722,2009,5243,1071, 247,1207,2343,2478, # 2128 1378,4613,2010, 864,1437,1214,4614, 373,3849,1142,2220, 667,4615, 442,2763,2563, # 2144 3850,4028,1969,4282,3300,1840, 837, 170,1107, 934,1336,1883,5244,5245,2119,4283, # 2160 2841, 743,1569,5246,4616,4284, 582,2389,1418,3484,5247,1803,5248, 357,1395,1729, # 2176 3717,3301,2423,1564,2241,5249,3106,3851,1633,4617,1114,2086,4285,1532,5250, 482, # 2192 2451,4618,5251,5252,1492, 833,1466,5253,2726,3599,1641,2842,5254,1526,1272,3718, # 2208 4286,1686,1795, 416,2564,1903,1954,1804,5255,3852,2798,3853,1159,2321,5256,2881, # 2224 4619,1610,1584,3056,2424,2764, 443,3302,1163,3161,5257,5258,4029,5259,4287,2506, # 2240 3057,4620,4030,3162,2104,1647,3600,2011,1873,4288,5260,4289, 431,3485,5261, 250, # 2256 97, 81,4290,5262,1648,1851,1558, 160, 848,5263, 866, 740,1694,5264,2204,2843, # 2272 3226,4291,4621,3719,1687, 950,2479, 426, 469,3227,3720,3721,4031,5265,5266,1188, # 2288 424,1996, 861,3601,4292,3854,2205,2694, 168,1235,3602,4293,5267,2087,1674,4622, # 2304 3374,3303, 220,2565,1009,5268,3855, 670,3010, 332,1208, 717,5269,5270,3603,2452, # 2320 4032,3375,5271, 513,5272,1209,2882,3376,3163,4623,1080,5273,5274,5275,5276,2534, # 2336 3722,3604, 815,1587,4033,4034,5277,3605,3486,3856,1254,4624,1328,3058,1390,4035, # 2352 1741,4036,3857,4037,5278, 236,3858,2453,3304,5279,5280,3723,3859,1273,3860,4625, # 2368 5281, 308,5282,4626, 245,4627,1852,2480,1307,2583, 430, 715,2137,2454,5283, 270, # 2384 199,2883,4038,5284,3606,2727,1753, 761,1754, 725,1661,1841,4628,3487,3724,5285, # 2400 5286, 587, 14,3305, 227,2608, 326, 480,2270, 943,2765,3607, 291, 650,1884,5287, # 2416 1702,1226, 102,1547, 62,3488, 904,4629,3489,1164,4294,5288,5289,1224,1548,2766, # 2432 391, 498,1493,5290,1386,1419,5291,2056,1177,4630, 813, 880,1081,2368, 566,1145, # 2448 4631,2291,1001,1035,2566,2609,2242, 394,1286,5292,5293,2069,5294, 86,1494,1730, # 2464 4039, 491,1588, 745, 897,2963, 843,3377,4040,2767,2884,3306,1768, 998,2221,2070, # 2480 397,1827,1195,1970,3725,3011,3378, 284,5295,3861,2507,2138,2120,1904,5296,4041, # 2496 2151,4042,4295,1036,3490,1905, 114,2567,4296, 209,1527,5297,5298,2964,2844,2635, # 2512 2390,2728,3164, 812,2568,5299,3307,5300,1559, 737,1885,3726,1210, 885, 28,2695, # 2528 3608,3862,5301,4297,1004,1780,4632,5302, 346,1982,2222,2696,4633,3863,1742, 797, # 2544 1642,4043,1934,1072,1384,2152, 896,4044,3308,3727,3228,2885,3609,5303,2569,1959, # 2560 4634,2455,1786,5304,5305,5306,4045,4298,1005,1308,3728,4299,2729,4635,4636,1528, # 2576 2610, 161,1178,4300,1983, 987,4637,1101,4301, 631,4046,1157,3229,2425,1343,1241, # 2592 1016,2243,2570, 372, 877,2344,2508,1160, 555,1935, 911,4047,5307, 466,1170, 169, # 2608 1051,2921,2697,3729,2481,3012,1182,2012,2571,1251,2636,5308, 992,2345,3491,1540, # 2624 2730,1201,2071,2406,1997,2482,5309,4638, 528,1923,2191,1503,1874,1570,2369,3379, # 2640 3309,5310, 557,1073,5311,1828,3492,2088,2271,3165,3059,3107, 767,3108,2799,4639, # 2656 1006,4302,4640,2346,1267,2179,3730,3230, 778,4048,3231,2731,1597,2667,5312,4641, # 2672 5313,3493,5314,5315,5316,3310,2698,1433,3311, 131, 95,1504,4049, 723,4303,3166, # 2688 1842,3610,2768,2192,4050,2028,2105,3731,5317,3013,4051,1218,5318,3380,3232,4052, # 2704 4304,2584, 248,1634,3864, 912,5319,2845,3732,3060,3865, 654, 53,5320,3014,5321, # 2720 1688,4642, 777,3494,1032,4053,1425,5322, 191, 820,2121,2846, 971,4643, 931,3233, # 2736 135, 664, 783,3866,1998, 772,2922,1936,4054,3867,4644,2923,3234, 282,2732, 640, # 2752 1372,3495,1127, 922, 325,3381,5323,5324, 711,2045,5325,5326,4055,2223,2800,1937, # 2768 4056,3382,2224,2255,3868,2305,5327,4645,3869,1258,3312,4057,3235,2139,2965,4058, # 2784 4059,5328,2225, 258,3236,4646, 101,1227,5329,3313,1755,5330,1391,3314,5331,2924, # 2800 2057, 893,5332,5333,5334,1402,4305,2347,5335,5336,3237,3611,5337,5338, 878,1325, # 2816 1781,2801,4647, 259,1385,2585, 744,1183,2272,4648,5339,4060,2509,5340, 684,1024, # 2832 4306,5341, 472,3612,3496,1165,3315,4061,4062, 322,2153, 881, 455,1695,1152,1340, # 2848 660, 554,2154,4649,1058,4650,4307, 830,1065,3383,4063,4651,1924,5342,1703,1919, # 2864 5343, 932,2273, 122,5344,4652, 947, 677,5345,3870,2637, 297,1906,1925,2274,4653, # 2880 2322,3316,5346,5347,4308,5348,4309, 84,4310, 112, 989,5349, 547,1059,4064, 701, # 2896 3613,1019,5350,4311,5351,3497, 942, 639, 457,2306,2456, 993,2966, 407, 851, 494, # 2912 4654,3384, 927,5352,1237,5353,2426,3385, 573,4312, 680, 921,2925,1279,1875, 285, # 2928 790,1448,1984, 719,2168,5354,5355,4655,4065,4066,1649,5356,1541, 563,5357,1077, # 2944 5358,3386,3061,3498, 511,3015,4067,4068,3733,4069,1268,2572,3387,3238,4656,4657, # 2960 5359, 535,1048,1276,1189,2926,2029,3167,1438,1373,2847,2967,1134,2013,5360,4313, # 2976 1238,2586,3109,1259,5361, 700,5362,2968,3168,3734,4314,5363,4315,1146,1876,1907, # 2992 4658,2611,4070, 781,2427, 132,1589, 203, 147, 273,2802,2407, 898,1787,2155,4071, # 3008 4072,5364,3871,2803,5365,5366,4659,4660,5367,3239,5368,1635,3872, 965,5369,1805, # 3024 2699,1516,3614,1121,1082,1329,3317,4073,1449,3873, 65,1128,2848,2927,2769,1590, # 3040 3874,5370,5371, 12,2668, 45, 976,2587,3169,4661, 517,2535,1013,1037,3240,5372, # 3056 3875,2849,5373,3876,5374,3499,5375,2612, 614,1999,2323,3877,3110,2733,2638,5376, # 3072 2588,4316, 599,1269,5377,1811,3735,5378,2700,3111, 759,1060, 489,1806,3388,3318, # 3088 1358,5379,5380,2391,1387,1215,2639,2256, 490,5381,5382,4317,1759,2392,2348,5383, # 3104 4662,3878,1908,4074,2640,1807,3241,4663,3500,3319,2770,2349, 874,5384,5385,3501, # 3120 3736,1859, 91,2928,3737,3062,3879,4664,5386,3170,4075,2669,5387,3502,1202,1403, # 3136 3880,2969,2536,1517,2510,4665,3503,2511,5388,4666,5389,2701,1886,1495,1731,4076, # 3152 2370,4667,5390,2030,5391,5392,4077,2702,1216, 237,2589,4318,2324,4078,3881,4668, # 3168 4669,2703,3615,3504, 445,4670,5393,5394,5395,5396,2771, 61,4079,3738,1823,4080, # 3184 5397, 687,2046, 935, 925, 405,2670, 703,1096,1860,2734,4671,4081,1877,1367,2704, # 3200 3389, 918,2106,1782,2483, 334,3320,1611,1093,4672, 564,3171,3505,3739,3390, 945, # 3216 2641,2058,4673,5398,1926, 872,4319,5399,3506,2705,3112, 349,4320,3740,4082,4674, # 3232 3882,4321,3741,2156,4083,4675,4676,4322,4677,2408,2047, 782,4084, 400, 251,4323, # 3248 1624,5400,5401, 277,3742, 299,1265, 476,1191,3883,2122,4324,4325,1109, 205,5402, # 3264 2590,1000,2157,3616,1861,5403,5404,5405,4678,5406,4679,2573, 107,2484,2158,4085, # 3280 3507,3172,5407,1533, 541,1301, 158, 753,4326,2886,3617,5408,1696, 370,1088,4327, # 3296 4680,3618, 579, 327, 440, 162,2244, 269,1938,1374,3508, 968,3063, 56,1396,3113, # 3312 2107,3321,3391,5409,1927,2159,4681,3016,5410,3619,5411,5412,3743,4682,2485,5413, # 3328 2804,5414,1650,4683,5415,2613,5416,5417,4086,2671,3392,1149,3393,4087,3884,4088, # 3344 5418,1076, 49,5419, 951,3242,3322,3323, 450,2850, 920,5420,1812,2805,2371,4328, # 3360 1909,1138,2372,3885,3509,5421,3243,4684,1910,1147,1518,2428,4685,3886,5422,4686, # 3376 2393,2614, 260,1796,3244,5423,5424,3887,3324, 708,5425,3620,1704,5426,3621,1351, # 3392 1618,3394,3017,1887, 944,4329,3395,4330,3064,3396,4331,5427,3744, 422, 413,1714, # 3408 3325, 500,2059,2350,4332,2486,5428,1344,1911, 954,5429,1668,5430,5431,4089,2409, # 3424 4333,3622,3888,4334,5432,2307,1318,2512,3114, 133,3115,2887,4687, 629, 31,2851, # 3440 2706,3889,4688, 850, 949,4689,4090,2970,1732,2089,4335,1496,1853,5433,4091, 620, # 3456 3245, 981,1242,3745,3397,1619,3746,1643,3326,2140,2457,1971,1719,3510,2169,5434, # 3472 3246,5435,5436,3398,1829,5437,1277,4690,1565,2048,5438,1636,3623,3116,5439, 869, # 3488 2852, 655,3890,3891,3117,4092,3018,3892,1310,3624,4691,5440,5441,5442,1733, 558, # 3504 4692,3747, 335,1549,3065,1756,4336,3748,1946,3511,1830,1291,1192, 470,2735,2108, # 3520 2806, 913,1054,4093,5443,1027,5444,3066,4094,4693, 982,2672,3399,3173,3512,3247, # 3536 3248,1947,2807,5445, 571,4694,5446,1831,5447,3625,2591,1523,2429,5448,2090, 984, # 3552 4695,3749,1960,5449,3750, 852, 923,2808,3513,3751, 969,1519, 999,2049,2325,1705, # 3568 5450,3118, 615,1662, 151, 597,4095,2410,2326,1049, 275,4696,3752,4337, 568,3753, # 3584 3626,2487,4338,3754,5451,2430,2275, 409,3249,5452,1566,2888,3514,1002, 769,2853, # 3600 194,2091,3174,3755,2226,3327,4339, 628,1505,5453,5454,1763,2180,3019,4096, 521, # 3616 1161,2592,1788,2206,2411,4697,4097,1625,4340,4341, 412, 42,3119, 464,5455,2642, # 3632 4698,3400,1760,1571,2889,3515,2537,1219,2207,3893,2643,2141,2373,4699,4700,3328, # 3648 1651,3401,3627,5456,5457,3628,2488,3516,5458,3756,5459,5460,2276,2092, 460,5461, # 3664 4701,5462,3020, 962, 588,3629, 289,3250,2644,1116, 52,5463,3067,1797,5464,5465, # 3680 5466,1467,5467,1598,1143,3757,4342,1985,1734,1067,4702,1280,3402, 465,4703,1572, # 3696 510,5468,1928,2245,1813,1644,3630,5469,4704,3758,5470,5471,2673,1573,1534,5472, # 3712 5473, 536,1808,1761,3517,3894,3175,2645,5474,5475,5476,4705,3518,2929,1912,2809, # 3728 5477,3329,1122, 377,3251,5478, 360,5479,5480,4343,1529, 551,5481,2060,3759,1769, # 3744 2431,5482,2930,4344,3330,3120,2327,2109,2031,4706,1404, 136,1468,1479, 672,1171, # 3760 3252,2308, 271,3176,5483,2772,5484,2050, 678,2736, 865,1948,4707,5485,2014,4098, # 3776 2971,5486,2737,2227,1397,3068,3760,4708,4709,1735,2931,3403,3631,5487,3895, 509, # 3792 2854,2458,2890,3896,5488,5489,3177,3178,4710,4345,2538,4711,2309,1166,1010, 552, # 3808 681,1888,5490,5491,2972,2973,4099,1287,1596,1862,3179, 358, 453, 736, 175, 478, # 3824 1117, 905,1167,1097,5492,1854,1530,5493,1706,5494,2181,3519,2292,3761,3520,3632, # 3840 4346,2093,4347,5495,3404,1193,2489,4348,1458,2193,2208,1863,1889,1421,3331,2932, # 3856 3069,2182,3521, 595,2123,5496,4100,5497,5498,4349,1707,2646, 223,3762,1359, 751, # 3872 3121, 183,3522,5499,2810,3021, 419,2374, 633, 704,3897,2394, 241,5500,5501,5502, # 3888 838,3022,3763,2277,2773,2459,3898,1939,2051,4101,1309,3122,2246,1181,5503,1136, # 3904 2209,3899,2375,1446,4350,2310,4712,5504,5505,4351,1055,2615, 484,3764,5506,4102, # 3920 625,4352,2278,3405,1499,4353,4103,5507,4104,4354,3253,2279,2280,3523,5508,5509, # 3936 2774, 808,2616,3765,3406,4105,4355,3123,2539, 526,3407,3900,4356, 955,5510,1620, # 3952 4357,2647,2432,5511,1429,3766,1669,1832, 994, 928,5512,3633,1260,5513,5514,5515, # 3968 1949,2293, 741,2933,1626,4358,2738,2460, 867,1184, 362,3408,1392,5516,5517,4106, # 3984 4359,1770,1736,3254,2934,4713,4714,1929,2707,1459,1158,5518,3070,3409,2891,1292, # 4000 1930,2513,2855,3767,1986,1187,2072,2015,2617,4360,5519,2574,2514,2170,3768,2490, # 4016 3332,5520,3769,4715,5521,5522, 666,1003,3023,1022,3634,4361,5523,4716,1814,2257, # 4032 574,3901,1603, 295,1535, 705,3902,4362, 283, 858, 417,5524,5525,3255,4717,4718, # 4048 3071,1220,1890,1046,2281,2461,4107,1393,1599, 689,2575, 388,4363,5526,2491, 802, # 4064 5527,2811,3903,2061,1405,2258,5528,4719,3904,2110,1052,1345,3256,1585,5529, 809, # 4080 5530,5531,5532, 575,2739,3524, 956,1552,1469,1144,2328,5533,2329,1560,2462,3635, # 4096 3257,4108, 616,2210,4364,3180,2183,2294,5534,1833,5535,3525,4720,5536,1319,3770, # 4112 3771,1211,3636,1023,3258,1293,2812,5537,5538,5539,3905, 607,2311,3906, 762,2892, # 4128 1439,4365,1360,4721,1485,3072,5540,4722,1038,4366,1450,2062,2648,4367,1379,4723, # 4144 2593,5541,5542,4368,1352,1414,2330,2935,1172,5543,5544,3907,3908,4724,1798,1451, # 4160 5545,5546,5547,5548,2936,4109,4110,2492,2351, 411,4111,4112,3637,3333,3124,4725, # 4176 1561,2674,1452,4113,1375,5549,5550, 47,2974, 316,5551,1406,1591,2937,3181,5552, # 4192 1025,2142,3125,3182, 354,2740, 884,2228,4369,2412, 508,3772, 726,3638, 996,2433, # 4208 3639, 729,5553, 392,2194,1453,4114,4726,3773,5554,5555,2463,3640,2618,1675,2813, # 4224 919,2352,2975,2353,1270,4727,4115, 73,5556,5557, 647,5558,3259,2856,2259,1550, # 4240 1346,3024,5559,1332, 883,3526,5560,5561,5562,5563,3334,2775,5564,1212, 831,1347, # 4256 4370,4728,2331,3909,1864,3073, 720,3910,4729,4730,3911,5565,4371,5566,5567,4731, # 4272 5568,5569,1799,4732,3774,2619,4733,3641,1645,2376,4734,5570,2938, 669,2211,2675, # 4288 2434,5571,2893,5572,5573,1028,3260,5574,4372,2413,5575,2260,1353,5576,5577,4735, # 4304 3183, 518,5578,4116,5579,4373,1961,5580,2143,4374,5581,5582,3025,2354,2355,3912, # 4320 516,1834,1454,4117,2708,4375,4736,2229,2620,1972,1129,3642,5583,2776,5584,2976, # 4336 1422, 577,1470,3026,1524,3410,5585,5586, 432,4376,3074,3527,5587,2594,1455,2515, # 4352 2230,1973,1175,5588,1020,2741,4118,3528,4737,5589,2742,5590,1743,1361,3075,3529, # 4368 2649,4119,4377,4738,2295, 895, 924,4378,2171, 331,2247,3076, 166,1627,3077,1098, # 4384 5591,1232,2894,2231,3411,4739, 657, 403,1196,2377, 542,3775,3412,1600,4379,3530, # 4400 5592,4740,2777,3261, 576, 530,1362,4741,4742,2540,2676,3776,4120,5593, 842,3913, # 4416 5594,2814,2032,1014,4121, 213,2709,3413, 665, 621,4380,5595,3777,2939,2435,5596, # 4432 2436,3335,3643,3414,4743,4381,2541,4382,4744,3644,1682,4383,3531,1380,5597, 724, # 4448 2282, 600,1670,5598,1337,1233,4745,3126,2248,5599,1621,4746,5600, 651,4384,5601, # 4464 1612,4385,2621,5602,2857,5603,2743,2312,3078,5604, 716,2464,3079, 174,1255,2710, # 4480 4122,3645, 548,1320,1398, 728,4123,1574,5605,1891,1197,3080,4124,5606,3081,3082, # 4496 3778,3646,3779, 747,5607, 635,4386,4747,5608,5609,5610,4387,5611,5612,4748,5613, # 4512 3415,4749,2437, 451,5614,3780,2542,2073,4388,2744,4389,4125,5615,1764,4750,5616, # 4528 4390, 350,4751,2283,2395,2493,5617,4391,4126,2249,1434,4127, 488,4752, 458,4392, # 4544 4128,3781, 771,1330,2396,3914,2576,3184,2160,2414,1553,2677,3185,4393,5618,2494, # 4560 2895,2622,1720,2711,4394,3416,4753,5619,2543,4395,5620,3262,4396,2778,5621,2016, # 4576 2745,5622,1155,1017,3782,3915,5623,3336,2313, 201,1865,4397,1430,5624,4129,5625, # 4592 5626,5627,5628,5629,4398,1604,5630, 414,1866, 371,2595,4754,4755,3532,2017,3127, # 4608 4756,1708, 960,4399, 887, 389,2172,1536,1663,1721,5631,2232,4130,2356,2940,1580, # 4624 5632,5633,1744,4757,2544,4758,4759,5634,4760,5635,2074,5636,4761,3647,3417,2896, # 4640 4400,5637,4401,2650,3418,2815, 673,2712,2465, 709,3533,4131,3648,4402,5638,1148, # 4656 502, 634,5639,5640,1204,4762,3649,1575,4763,2623,3783,5641,3784,3128, 948,3263, # 4672 121,1745,3916,1110,5642,4403,3083,2516,3027,4132,3785,1151,1771,3917,1488,4133, # 4688 1987,5643,2438,3534,5644,5645,2094,5646,4404,3918,1213,1407,2816, 531,2746,2545, # 4704 3264,1011,1537,4764,2779,4405,3129,1061,5647,3786,3787,1867,2897,5648,2018, 120, # 4720 4406,4407,2063,3650,3265,2314,3919,2678,3419,1955,4765,4134,5649,3535,1047,2713, # 4736 1266,5650,1368,4766,2858, 649,3420,3920,2546,2747,1102,2859,2679,5651,5652,2000, # 4752 5653,1111,3651,2977,5654,2495,3921,3652,2817,1855,3421,3788,5655,5656,3422,2415, # 4768 2898,3337,3266,3653,5657,2577,5658,3654,2818,4135,1460, 856,5659,3655,5660,2899, # 4784 2978,5661,2900,3922,5662,4408, 632,2517, 875,3923,1697,3924,2296,5663,5664,4767, # 4800 3028,1239, 580,4768,4409,5665, 914, 936,2075,1190,4136,1039,2124,5666,5667,5668, # 4816 5669,3423,1473,5670,1354,4410,3925,4769,2173,3084,4137, 915,3338,4411,4412,3339, # 4832 1605,1835,5671,2748, 398,3656,4413,3926,4138, 328,1913,2860,4139,3927,1331,4414, # 4848 3029, 937,4415,5672,3657,4140,4141,3424,2161,4770,3425, 524, 742, 538,3085,1012, # 4864 5673,5674,3928,2466,5675, 658,1103, 225,3929,5676,5677,4771,5678,4772,5679,3267, # 4880 1243,5680,4142, 963,2250,4773,5681,2714,3658,3186,5682,5683,2596,2332,5684,4774, # 4896 5685,5686,5687,3536, 957,3426,2547,2033,1931,2941,2467, 870,2019,3659,1746,2780, # 4912 2781,2439,2468,5688,3930,5689,3789,3130,3790,3537,3427,3791,5690,1179,3086,5691, # 4928 3187,2378,4416,3792,2548,3188,3131,2749,4143,5692,3428,1556,2549,2297, 977,2901, # 4944 2034,4144,1205,3429,5693,1765,3430,3189,2125,1271, 714,1689,4775,3538,5694,2333, # 4960 3931, 533,4417,3660,2184, 617,5695,2469,3340,3539,2315,5696,5697,3190,5698,5699, # 4976 3932,1988, 618, 427,2651,3540,3431,5700,5701,1244,1690,5702,2819,4418,4776,5703, # 4992 3541,4777,5704,2284,1576, 473,3661,4419,3432, 972,5705,3662,5706,3087,5707,5708, # 5008 4778,4779,5709,3793,4145,4146,5710, 153,4780, 356,5711,1892,2902,4420,2144, 408, # 5024 803,2357,5712,3933,5713,4421,1646,2578,2518,4781,4782,3934,5714,3935,4422,5715, # 5040 2416,3433, 752,5716,5717,1962,3341,2979,5718, 746,3030,2470,4783,4423,3794, 698, # 5056 4784,1893,4424,3663,2550,4785,3664,3936,5719,3191,3434,5720,1824,1302,4147,2715, # 5072 3937,1974,4425,5721,4426,3192, 823,1303,1288,1236,2861,3542,4148,3435, 774,3938, # 5088 5722,1581,4786,1304,2862,3939,4787,5723,2440,2162,1083,3268,4427,4149,4428, 344, # 5104 1173, 288,2316, 454,1683,5724,5725,1461,4788,4150,2597,5726,5727,4789, 985, 894, # 5120 5728,3436,3193,5729,1914,2942,3795,1989,5730,2111,1975,5731,4151,5732,2579,1194, # 5136 425,5733,4790,3194,1245,3796,4429,5734,5735,2863,5736, 636,4791,1856,3940, 760, # 5152 1800,5737,4430,2212,1508,4792,4152,1894,1684,2298,5738,5739,4793,4431,4432,2213, # 5168 479,5740,5741, 832,5742,4153,2496,5743,2980,2497,3797, 990,3132, 627,1815,2652, # 5184 4433,1582,4434,2126,2112,3543,4794,5744, 799,4435,3195,5745,4795,2113,1737,3031, # 5200 1018, 543, 754,4436,3342,1676,4796,4797,4154,4798,1489,5746,3544,5747,2624,2903, # 5216 4155,5748,5749,2981,5750,5751,5752,5753,3196,4799,4800,2185,1722,5754,3269,3270, # 5232 1843,3665,1715, 481, 365,1976,1857,5755,5756,1963,2498,4801,5757,2127,3666,3271, # 5248 433,1895,2064,2076,5758, 602,2750,5759,5760,5761,5762,5763,3032,1628,3437,5764, # 5264 3197,4802,4156,2904,4803,2519,5765,2551,2782,5766,5767,5768,3343,4804,2905,5769, # 5280 4805,5770,2864,4806,4807,1221,2982,4157,2520,5771,5772,5773,1868,1990,5774,5775, # 5296 5776,1896,5777,5778,4808,1897,4158, 318,5779,2095,4159,4437,5780,5781, 485,5782, # 5312 938,3941, 553,2680, 116,5783,3942,3667,5784,3545,2681,2783,3438,3344,2820,5785, # 5328 3668,2943,4160,1747,2944,2983,5786,5787, 207,5788,4809,5789,4810,2521,5790,3033, # 5344 890,3669,3943,5791,1878,3798,3439,5792,2186,2358,3440,1652,5793,5794,5795, 941, # 5360 2299, 208,3546,4161,2020, 330,4438,3944,2906,2499,3799,4439,4811,5796,5797,5798, # 5376 #last 512 #Everything below is of no interest for detection purpose 2522,1613,4812,5799,3345,3945,2523,5800,4162,5801,1637,4163,2471,4813,3946,5802, # 5392 2500,3034,3800,5803,5804,2195,4814,5805,2163,5806,5807,5808,5809,5810,5811,5812, # 5408 5813,5814,5815,5816,5817,5818,5819,5820,5821,5822,5823,5824,5825,5826,5827,5828, # 5424 5829,5830,5831,5832,5833,5834,5835,5836,5837,5838,5839,5840,5841,5842,5843,5844, # 5440 5845,5846,5847,5848,5849,5850,5851,5852,5853,5854,5855,5856,5857,5858,5859,5860, # 5456 5861,5862,5863,5864,5865,5866,5867,5868,5869,5870,5871,5872,5873,5874,5875,5876, # 5472 5877,5878,5879,5880,5881,5882,5883,5884,5885,5886,5887,5888,5889,5890,5891,5892, # 5488 5893,5894,5895,5896,5897,5898,5899,5900,5901,5902,5903,5904,5905,5906,5907,5908, # 5504 5909,5910,5911,5912,5913,5914,5915,5916,5917,5918,5919,5920,5921,5922,5923,5924, # 5520 5925,5926,5927,5928,5929,5930,5931,5932,5933,5934,5935,5936,5937,5938,5939,5940, # 5536 5941,5942,5943,5944,5945,5946,5947,5948,5949,5950,5951,5952,5953,5954,5955,5956, # 5552 5957,5958,5959,5960,5961,5962,5963,5964,5965,5966,5967,5968,5969,5970,5971,5972, # 5568 5973,5974,5975,5976,5977,5978,5979,5980,5981,5982,5983,5984,5985,5986,5987,5988, # 5584 5989,5990,5991,5992,5993,5994,5995,5996,5997,5998,5999,6000,6001,6002,6003,6004, # 5600 6005,6006,6007,6008,6009,6010,6011,6012,6013,6014,6015,6016,6017,6018,6019,6020, # 5616 6021,6022,6023,6024,6025,6026,6027,6028,6029,6030,6031,6032,6033,6034,6035,6036, # 5632 6037,6038,6039,6040,6041,6042,6043,6044,6045,6046,6047,6048,6049,6050,6051,6052, # 5648 6053,6054,6055,6056,6057,6058,6059,6060,6061,6062,6063,6064,6065,6066,6067,6068, # 5664 6069,6070,6071,6072,6073,6074,6075,6076,6077,6078,6079,6080,6081,6082,6083,6084, # 5680 6085,6086,6087,6088,6089,6090,6091,6092,6093,6094,6095,6096,6097,6098,6099,6100, # 5696 6101,6102,6103,6104,6105,6106,6107,6108,6109,6110,6111,6112,6113,6114,6115,6116, # 5712 6117,6118,6119,6120,6121,6122,6123,6124,6125,6126,6127,6128,6129,6130,6131,6132, # 5728 6133,6134,6135,6136,6137,6138,6139,6140,6141,6142,6143,6144,6145,6146,6147,6148, # 5744 6149,6150,6151,6152,6153,6154,6155,6156,6157,6158,6159,6160,6161,6162,6163,6164, # 5760 6165,6166,6167,6168,6169,6170,6171,6172,6173,6174,6175,6176,6177,6178,6179,6180, # 5776 6181,6182,6183,6184,6185,6186,6187,6188,6189,6190,6191,6192,6193,6194,6195,6196, # 5792 6197,6198,6199,6200,6201,6202,6203,6204,6205,6206,6207,6208,6209,6210,6211,6212, # 5808 6213,6214,6215,6216,6217,6218,6219,6220,6221,6222,6223,3670,6224,6225,6226,6227, # 5824 6228,6229,6230,6231,6232,6233,6234,6235,6236,6237,6238,6239,6240,6241,6242,6243, # 5840 6244,6245,6246,6247,6248,6249,6250,6251,6252,6253,6254,6255,6256,6257,6258,6259, # 5856 6260,6261,6262,6263,6264,6265,6266,6267,6268,6269,6270,6271,6272,6273,6274,6275, # 5872 6276,6277,6278,6279,6280,6281,6282,6283,6284,6285,4815,6286,6287,6288,6289,6290, # 5888 6291,6292,4816,6293,6294,6295,6296,6297,6298,6299,6300,6301,6302,6303,6304,6305, # 5904 6306,6307,6308,6309,6310,6311,4817,4818,6312,6313,6314,6315,6316,6317,6318,4819, # 5920 6319,6320,6321,6322,6323,6324,6325,6326,6327,6328,6329,6330,6331,6332,6333,6334, # 5936 6335,6336,6337,4820,6338,6339,6340,6341,6342,6343,6344,6345,6346,6347,6348,6349, # 5952 6350,6351,6352,6353,6354,6355,6356,6357,6358,6359,6360,6361,6362,6363,6364,6365, # 5968 6366,6367,6368,6369,6370,6371,6372,6373,6374,6375,6376,6377,6378,6379,6380,6381, # 5984 6382,6383,6384,6385,6386,6387,6388,6389,6390,6391,6392,6393,6394,6395,6396,6397, # 6000 6398,6399,6400,6401,6402,6403,6404,6405,6406,6407,6408,6409,6410,3441,6411,6412, # 6016 6413,6414,6415,6416,6417,6418,6419,6420,6421,6422,6423,6424,6425,4440,6426,6427, # 6032 6428,6429,6430,6431,6432,6433,6434,6435,6436,6437,6438,6439,6440,6441,6442,6443, # 6048 6444,6445,6446,6447,6448,6449,6450,6451,6452,6453,6454,4821,6455,6456,6457,6458, # 6064 6459,6460,6461,6462,6463,6464,6465,6466,6467,6468,6469,6470,6471,6472,6473,6474, # 6080 6475,6476,6477,3947,3948,6478,6479,6480,6481,3272,4441,6482,6483,6484,6485,4442, # 6096 6486,6487,6488,6489,6490,6491,6492,6493,6494,6495,6496,4822,6497,6498,6499,6500, # 6112 6501,6502,6503,6504,6505,6506,6507,6508,6509,6510,6511,6512,6513,6514,6515,6516, # 6128 6517,6518,6519,6520,6521,6522,6523,6524,6525,6526,6527,6528,6529,6530,6531,6532, # 6144 6533,6534,6535,6536,6537,6538,6539,6540,6541,6542,6543,6544,6545,6546,6547,6548, # 6160 6549,6550,6551,6552,6553,6554,6555,6556,2784,6557,4823,6558,6559,6560,6561,6562, # 6176 6563,6564,6565,6566,6567,6568,6569,3949,6570,6571,6572,4824,6573,6574,6575,6576, # 6192 6577,6578,6579,6580,6581,6582,6583,4825,6584,6585,6586,3950,2785,6587,6588,6589, # 6208 6590,6591,6592,6593,6594,6595,6596,6597,6598,6599,6600,6601,6602,6603,6604,6605, # 6224 6606,6607,6608,6609,6610,6611,6612,4826,6613,6614,6615,4827,6616,6617,6618,6619, # 6240 6620,6621,6622,6623,6624,6625,4164,6626,6627,6628,6629,6630,6631,6632,6633,6634, # 6256 3547,6635,4828,6636,6637,6638,6639,6640,6641,6642,3951,2984,6643,6644,6645,6646, # 6272 6647,6648,6649,4165,6650,4829,6651,6652,4830,6653,6654,6655,6656,6657,6658,6659, # 6288 6660,6661,6662,4831,6663,6664,6665,6666,6667,6668,6669,6670,6671,4166,6672,4832, # 6304 3952,6673,6674,6675,6676,4833,6677,6678,6679,4167,6680,6681,6682,3198,6683,6684, # 6320 6685,6686,6687,6688,6689,6690,6691,6692,6693,6694,6695,6696,6697,4834,6698,6699, # 6336 6700,6701,6702,6703,6704,6705,6706,6707,6708,6709,6710,6711,6712,6713,6714,6715, # 6352 6716,6717,6718,6719,6720,6721,6722,6723,6724,6725,6726,6727,6728,6729,6730,6731, # 6368 6732,6733,6734,4443,6735,6736,6737,6738,6739,6740,6741,6742,6743,6744,6745,4444, # 6384 6746,6747,6748,6749,6750,6751,6752,6753,6754,6755,6756,6757,6758,6759,6760,6761, # 6400 6762,6763,6764,6765,6766,6767,6768,6769,6770,6771,6772,6773,6774,6775,6776,6777, # 6416 6778,6779,6780,6781,4168,6782,6783,3442,6784,6785,6786,6787,6788,6789,6790,6791, # 6432 4169,6792,6793,6794,6795,6796,6797,6798,6799,6800,6801,6802,6803,6804,6805,6806, # 6448 6807,6808,6809,6810,6811,4835,6812,6813,6814,4445,6815,6816,4446,6817,6818,6819, # 6464 6820,6821,6822,6823,6824,6825,6826,6827,6828,6829,6830,6831,6832,6833,6834,6835, # 6480 3548,6836,6837,6838,6839,6840,6841,6842,6843,6844,6845,6846,4836,6847,6848,6849, # 6496 6850,6851,6852,6853,6854,3953,6855,6856,6857,6858,6859,6860,6861,6862,6863,6864, # 6512 6865,6866,6867,6868,6869,6870,6871,6872,6873,6874,6875,6876,6877,3199,6878,6879, # 6528 6880,6881,6882,4447,6883,6884,6885,6886,6887,6888,6889,6890,6891,6892,6893,6894, # 6544 6895,6896,6897,6898,6899,6900,6901,6902,6903,6904,4170,6905,6906,6907,6908,6909, # 6560 6910,6911,6912,6913,6914,6915,6916,6917,6918,6919,6920,6921,6922,6923,6924,6925, # 6576 6926,6927,4837,6928,6929,6930,6931,6932,6933,6934,6935,6936,3346,6937,6938,4838, # 6592 6939,6940,6941,4448,6942,6943,6944,6945,6946,4449,6947,6948,6949,6950,6951,6952, # 6608 6953,6954,6955,6956,6957,6958,6959,6960,6961,6962,6963,6964,6965,6966,6967,6968, # 6624 6969,6970,6971,6972,6973,6974,6975,6976,6977,6978,6979,6980,6981,6982,6983,6984, # 6640 6985,6986,6987,6988,6989,6990,6991,6992,6993,6994,3671,6995,6996,6997,6998,4839, # 6656 6999,7000,7001,7002,3549,7003,7004,7005,7006,7007,7008,7009,7010,7011,7012,7013, # 6672 7014,7015,7016,7017,7018,7019,7020,7021,7022,7023,7024,7025,7026,7027,7028,7029, # 6688 7030,4840,7031,7032,7033,7034,7035,7036,7037,7038,4841,7039,7040,7041,7042,7043, # 6704 7044,7045,7046,7047,7048,7049,7050,7051,7052,7053,7054,7055,7056,7057,7058,7059, # 6720 7060,7061,7062,7063,7064,7065,7066,7067,7068,7069,7070,2985,7071,7072,7073,7074, # 6736 7075,7076,7077,7078,7079,7080,4842,7081,7082,7083,7084,7085,7086,7087,7088,7089, # 6752 7090,7091,7092,7093,7094,7095,7096,7097,7098,7099,7100,7101,7102,7103,7104,7105, # 6768 7106,7107,7108,7109,7110,7111,7112,7113,7114,7115,7116,7117,7118,4450,7119,7120, # 6784 7121,7122,7123,7124,7125,7126,7127,7128,7129,7130,7131,7132,7133,7134,7135,7136, # 6800 7137,7138,7139,7140,7141,7142,7143,4843,7144,7145,7146,7147,7148,7149,7150,7151, # 6816 7152,7153,7154,7155,7156,7157,7158,7159,7160,7161,7162,7163,7164,7165,7166,7167, # 6832 7168,7169,7170,7171,7172,7173,7174,7175,7176,7177,7178,7179,7180,7181,7182,7183, # 6848 7184,7185,7186,7187,7188,4171,4172,7189,7190,7191,7192,7193,7194,7195,7196,7197, # 6864 7198,7199,7200,7201,7202,7203,7204,7205,7206,7207,7208,7209,7210,7211,7212,7213, # 6880 7214,7215,7216,7217,7218,7219,7220,7221,7222,7223,7224,7225,7226,7227,7228,7229, # 6896 7230,7231,7232,7233,7234,7235,7236,7237,7238,7239,7240,7241,7242,7243,7244,7245, # 6912 7246,7247,7248,7249,7250,7251,7252,7253,7254,7255,7256,7257,7258,7259,7260,7261, # 6928 7262,7263,7264,7265,7266,7267,7268,7269,7270,7271,7272,7273,7274,7275,7276,7277, # 6944 7278,7279,7280,7281,7282,7283,7284,7285,7286,7287,7288,7289,7290,7291,7292,7293, # 6960 7294,7295,7296,4844,7297,7298,7299,7300,7301,7302,7303,7304,7305,7306,7307,7308, # 6976 7309,7310,7311,7312,7313,7314,7315,7316,4451,7317,7318,7319,7320,7321,7322,7323, # 6992 7324,7325,7326,7327,7328,7329,7330,7331,7332,7333,7334,7335,7336,7337,7338,7339, # 7008 7340,7341,7342,7343,7344,7345,7346,7347,7348,7349,7350,7351,7352,7353,4173,7354, # 7024 7355,4845,7356,7357,7358,7359,7360,7361,7362,7363,7364,7365,7366,7367,7368,7369, # 7040 7370,7371,7372,7373,7374,7375,7376,7377,7378,7379,7380,7381,7382,7383,7384,7385, # 7056 7386,7387,7388,4846,7389,7390,7391,7392,7393,7394,7395,7396,7397,7398,7399,7400, # 7072 7401,7402,7403,7404,7405,3672,7406,7407,7408,7409,7410,7411,7412,7413,7414,7415, # 7088 7416,7417,7418,7419,7420,7421,7422,7423,7424,7425,7426,7427,7428,7429,7430,7431, # 7104 7432,7433,7434,7435,7436,7437,7438,7439,7440,7441,7442,7443,7444,7445,7446,7447, # 7120 7448,7449,7450,7451,7452,7453,4452,7454,3200,7455,7456,7457,7458,7459,7460,7461, # 7136 7462,7463,7464,7465,7466,7467,7468,7469,7470,7471,7472,7473,7474,4847,7475,7476, # 7152 7477,3133,7478,7479,7480,7481,7482,7483,7484,7485,7486,7487,7488,7489,7490,7491, # 7168 7492,7493,7494,7495,7496,7497,7498,7499,7500,7501,7502,3347,7503,7504,7505,7506, # 7184 7507,7508,7509,7510,7511,7512,7513,7514,7515,7516,7517,7518,7519,7520,7521,4848, # 7200 7522,7523,7524,7525,7526,7527,7528,7529,7530,7531,7532,7533,7534,7535,7536,7537, # 7216 7538,7539,7540,7541,7542,7543,7544,7545,7546,7547,7548,7549,3801,4849,7550,7551, # 7232 7552,7553,7554,7555,7556,7557,7558,7559,7560,7561,7562,7563,7564,7565,7566,7567, # 7248 7568,7569,3035,7570,7571,7572,7573,7574,7575,7576,7577,7578,7579,7580,7581,7582, # 7264 7583,7584,7585,7586,7587,7588,7589,7590,7591,7592,7593,7594,7595,7596,7597,7598, # 7280 7599,7600,7601,7602,7603,7604,7605,7606,7607,7608,7609,7610,7611,7612,7613,7614, # 7296 7615,7616,4850,7617,7618,3802,7619,7620,7621,7622,7623,7624,7625,7626,7627,7628, # 7312 7629,7630,7631,7632,4851,7633,7634,7635,7636,7637,7638,7639,7640,7641,7642,7643, # 7328 7644,7645,7646,7647,7648,7649,7650,7651,7652,7653,7654,7655,7656,7657,7658,7659, # 7344 7660,7661,7662,7663,7664,7665,7666,7667,7668,7669,7670,4453,7671,7672,7673,7674, # 7360 7675,7676,7677,7678,7679,7680,7681,7682,7683,7684,7685,7686,7687,7688,7689,7690, # 7376 7691,7692,7693,7694,7695,7696,7697,3443,7698,7699,7700,7701,7702,4454,7703,7704, # 7392 7705,7706,7707,7708,7709,7710,7711,7712,7713,2472,7714,7715,7716,7717,7718,7719, # 7408 7720,7721,7722,7723,7724,7725,7726,7727,7728,7729,7730,7731,3954,7732,7733,7734, # 7424 7735,7736,7737,7738,7739,7740,7741,7742,7743,7744,7745,7746,7747,7748,7749,7750, # 7440 3134,7751,7752,4852,7753,7754,7755,4853,7756,7757,7758,7759,7760,4174,7761,7762, # 7456 7763,7764,7765,7766,7767,7768,7769,7770,7771,7772,7773,7774,7775,7776,7777,7778, # 7472 7779,7780,7781,7782,7783,7784,7785,7786,7787,7788,7789,7790,7791,7792,7793,7794, # 7488 7795,7796,7797,7798,7799,7800,7801,7802,7803,7804,7805,4854,7806,7807,7808,7809, # 7504 7810,7811,7812,7813,7814,7815,7816,7817,7818,7819,7820,7821,7822,7823,7824,7825, # 7520 4855,7826,7827,7828,7829,7830,7831,7832,7833,7834,7835,7836,7837,7838,7839,7840, # 7536 7841,7842,7843,7844,7845,7846,7847,3955,7848,7849,7850,7851,7852,7853,7854,7855, # 7552 7856,7857,7858,7859,7860,3444,7861,7862,7863,7864,7865,7866,7867,7868,7869,7870, # 7568 7871,7872,7873,7874,7875,7876,7877,7878,7879,7880,7881,7882,7883,7884,7885,7886, # 7584 7887,7888,7889,7890,7891,4175,7892,7893,7894,7895,7896,4856,4857,7897,7898,7899, # 7600 7900,2598,7901,7902,7903,7904,7905,7906,7907,7908,4455,7909,7910,7911,7912,7913, # 7616 7914,3201,7915,7916,7917,7918,7919,7920,7921,4858,7922,7923,7924,7925,7926,7927, # 7632 7928,7929,7930,7931,7932,7933,7934,7935,7936,7937,7938,7939,7940,7941,7942,7943, # 7648 7944,7945,7946,7947,7948,7949,7950,7951,7952,7953,7954,7955,7956,7957,7958,7959, # 7664 7960,7961,7962,7963,7964,7965,7966,7967,7968,7969,7970,7971,7972,7973,7974,7975, # 7680 7976,7977,7978,7979,7980,7981,4859,7982,7983,7984,7985,7986,7987,7988,7989,7990, # 7696 7991,7992,7993,7994,7995,7996,4860,7997,7998,7999,8000,8001,8002,8003,8004,8005, # 7712 8006,8007,8008,8009,8010,8011,8012,8013,8014,8015,8016,4176,8017,8018,8019,8020, # 7728 8021,8022,8023,4861,8024,8025,8026,8027,8028,8029,8030,8031,8032,8033,8034,8035, # 7744 8036,4862,4456,8037,8038,8039,8040,4863,8041,8042,8043,8044,8045,8046,8047,8048, # 7760 8049,8050,8051,8052,8053,8054,8055,8056,8057,8058,8059,8060,8061,8062,8063,8064, # 7776 8065,8066,8067,8068,8069,8070,8071,8072,8073,8074,8075,8076,8077,8078,8079,8080, # 7792 8081,8082,8083,8084,8085,8086,8087,8088,8089,8090,8091,8092,8093,8094,8095,8096, # 7808 8097,8098,8099,4864,4177,8100,8101,8102,8103,8104,8105,8106,8107,8108,8109,8110, # 7824 8111,8112,8113,8114,8115,8116,8117,8118,8119,8120,4178,8121,8122,8123,8124,8125, # 7840 8126,8127,8128,8129,8130,8131,8132,8133,8134,8135,8136,8137,8138,8139,8140,8141, # 7856 8142,8143,8144,8145,4865,4866,8146,8147,8148,8149,8150,8151,8152,8153,8154,8155, # 7872 8156,8157,8158,8159,8160,8161,8162,8163,8164,8165,4179,8166,8167,8168,8169,8170, # 7888 8171,8172,8173,8174,8175,8176,8177,8178,8179,8180,8181,4457,8182,8183,8184,8185, # 7904 8186,8187,8188,8189,8190,8191,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201, # 7920 8202,8203,8204,8205,8206,8207,8208,8209,8210,8211,8212,8213,8214,8215,8216,8217, # 7936 8218,8219,8220,8221,8222,8223,8224,8225,8226,8227,8228,8229,8230,8231,8232,8233, # 7952 8234,8235,8236,8237,8238,8239,8240,8241,8242,8243,8244,8245,8246,8247,8248,8249, # 7968 8250,8251,8252,8253,8254,8255,8256,3445,8257,8258,8259,8260,8261,8262,4458,8263, # 7984 8264,8265,8266,8267,8268,8269,8270,8271,8272,4459,8273,8274,8275,8276,3550,8277, # 8000 8278,8279,8280,8281,8282,8283,8284,8285,8286,8287,8288,8289,4460,8290,8291,8292, # 8016 8293,8294,8295,8296,8297,8298,8299,8300,8301,8302,8303,8304,8305,8306,8307,4867, # 8032 8308,8309,8310,8311,8312,3551,8313,8314,8315,8316,8317,8318,8319,8320,8321,8322, # 8048 8323,8324,8325,8326,4868,8327,8328,8329,8330,8331,8332,8333,8334,8335,8336,8337, # 8064 8338,8339,8340,8341,8342,8343,8344,8345,8346,8347,8348,8349,8350,8351,8352,8353, # 8080 8354,8355,8356,8357,8358,8359,8360,8361,8362,8363,4869,4461,8364,8365,8366,8367, # 8096 8368,8369,8370,4870,8371,8372,8373,8374,8375,8376,8377,8378,8379,8380,8381,8382, # 8112 8383,8384,8385,8386,8387,8388,8389,8390,8391,8392,8393,8394,8395,8396,8397,8398, # 8128 8399,8400,8401,8402,8403,8404,8405,8406,8407,8408,8409,8410,4871,8411,8412,8413, # 8144 8414,8415,8416,8417,8418,8419,8420,8421,8422,4462,8423,8424,8425,8426,8427,8428, # 8160 8429,8430,8431,8432,8433,2986,8434,8435,8436,8437,8438,8439,8440,8441,8442,8443, # 8176 8444,8445,8446,8447,8448,8449,8450,8451,8452,8453,8454,8455,8456,8457,8458,8459, # 8192 8460,8461,8462,8463,8464,8465,8466,8467,8468,8469,8470,8471,8472,8473,8474,8475, # 8208 8476,8477,8478,4180,8479,8480,8481,8482,8483,8484,8485,8486,8487,8488,8489,8490, # 8224 8491,8492,8493,8494,8495,8496,8497,8498,8499,8500,8501,8502,8503,8504,8505,8506, # 8240 8507,8508,8509,8510,8511,8512,8513,8514,8515,8516,8517,8518,8519,8520,8521,8522, # 8256 8523,8524,8525,8526,8527,8528,8529,8530,8531,8532,8533,8534,8535,8536,8537,8538, # 8272 8539,8540,8541,8542,8543,8544,8545,8546,8547,8548,8549,8550,8551,8552,8553,8554, # 8288 8555,8556,8557,8558,8559,8560,8561,8562,8563,8564,4872,8565,8566,8567,8568,8569, # 8304 8570,8571,8572,8573,4873,8574,8575,8576,8577,8578,8579,8580,8581,8582,8583,8584, # 8320 8585,8586,8587,8588,8589,8590,8591,8592,8593,8594,8595,8596,8597,8598,8599,8600, # 8336 8601,8602,8603,8604,8605,3803,8606,8607,8608,8609,8610,8611,8612,8613,4874,3804, # 8352 8614,8615,8616,8617,8618,8619,8620,8621,3956,8622,8623,8624,8625,8626,8627,8628, # 8368 8629,8630,8631,8632,8633,8634,8635,8636,8637,8638,2865,8639,8640,8641,8642,8643, # 8384 8644,8645,8646,8647,8648,8649,8650,8651,8652,8653,8654,8655,8656,4463,8657,8658, # 8400 8659,4875,4876,8660,8661,8662,8663,8664,8665,8666,8667,8668,8669,8670,8671,8672, # 8416 8673,8674,8675,8676,8677,8678,8679,8680,8681,4464,8682,8683,8684,8685,8686,8687, # 8432 8688,8689,8690,8691,8692,8693,8694,8695,8696,8697,8698,8699,8700,8701,8702,8703, # 8448 8704,8705,8706,8707,8708,8709,2261,8710,8711,8712,8713,8714,8715,8716,8717,8718, # 8464 8719,8720,8721,8722,8723,8724,8725,8726,8727,8728,8729,8730,8731,8732,8733,4181, # 8480 8734,8735,8736,8737,8738,8739,8740,8741,8742,8743,8744,8745,8746,8747,8748,8749, # 8496 8750,8751,8752,8753,8754,8755,8756,8757,8758,8759,8760,8761,8762,8763,4877,8764, # 8512 8765,8766,8767,8768,8769,8770,8771,8772,8773,8774,8775,8776,8777,8778,8779,8780, # 8528 8781,8782,8783,8784,8785,8786,8787,8788,4878,8789,4879,8790,8791,8792,4880,8793, # 8544 8794,8795,8796,8797,8798,8799,8800,8801,4881,8802,8803,8804,8805,8806,8807,8808, # 8560 8809,8810,8811,8812,8813,8814,8815,3957,8816,8817,8818,8819,8820,8821,8822,8823, # 8576 8824,8825,8826,8827,8828,8829,8830,8831,8832,8833,8834,8835,8836,8837,8838,8839, # 8592 8840,8841,8842,8843,8844,8845,8846,8847,4882,8848,8849,8850,8851,8852,8853,8854, # 8608 8855,8856,8857,8858,8859,8860,8861,8862,8863,8864,8865,8866,8867,8868,8869,8870, # 8624 8871,8872,8873,8874,8875,8876,8877,8878,8879,8880,8881,8882,8883,8884,3202,8885, # 8640 8886,8887,8888,8889,8890,8891,8892,8893,8894,8895,8896,8897,8898,8899,8900,8901, # 8656 8902,8903,8904,8905,8906,8907,8908,8909,8910,8911,8912,8913,8914,8915,8916,8917, # 8672 8918,8919,8920,8921,8922,8923,8924,4465,8925,8926,8927,8928,8929,8930,8931,8932, # 8688 4883,8933,8934,8935,8936,8937,8938,8939,8940,8941,8942,8943,2214,8944,8945,8946, # 8704 8947,8948,8949,8950,8951,8952,8953,8954,8955,8956,8957,8958,8959,8960,8961,8962, # 8720 8963,8964,8965,4884,8966,8967,8968,8969,8970,8971,8972,8973,8974,8975,8976,8977, # 8736 8978,8979,8980,8981,8982,8983,8984,8985,8986,8987,8988,8989,8990,8991,8992,4885, # 8752 8993,8994,8995,8996,8997,8998,8999,9000,9001,9002,9003,9004,9005,9006,9007,9008, # 8768 9009,9010,9011,9012,9013,9014,9015,9016,9017,9018,9019,9020,9021,4182,9022,9023, # 8784 9024,9025,9026,9027,9028,9029,9030,9031,9032,9033,9034,9035,9036,9037,9038,9039, # 8800 9040,9041,9042,9043,9044,9045,9046,9047,9048,9049,9050,9051,9052,9053,9054,9055, # 8816 9056,9057,9058,9059,9060,9061,9062,9063,4886,9064,9065,9066,9067,9068,9069,4887, # 8832 9070,9071,9072,9073,9074,9075,9076,9077,9078,9079,9080,9081,9082,9083,9084,9085, # 8848 9086,9087,9088,9089,9090,9091,9092,9093,9094,9095,9096,9097,9098,9099,9100,9101, # 8864 9102,9103,9104,9105,9106,9107,9108,9109,9110,9111,9112,9113,9114,9115,9116,9117, # 8880 9118,9119,9120,9121,9122,9123,9124,9125,9126,9127,9128,9129,9130,9131,9132,9133, # 8896 9134,9135,9136,9137,9138,9139,9140,9141,3958,9142,9143,9144,9145,9146,9147,9148, # 8912 9149,9150,9151,4888,9152,9153,9154,9155,9156,9157,9158,9159,9160,9161,9162,9163, # 8928 9164,9165,9166,9167,9168,9169,9170,9171,9172,9173,9174,9175,4889,9176,9177,9178, # 8944 9179,9180,9181,9182,9183,9184,9185,9186,9187,9188,9189,9190,9191,9192,9193,9194, # 8960 9195,9196,9197,9198,9199,9200,9201,9202,9203,4890,9204,9205,9206,9207,9208,9209, # 8976 9210,9211,9212,9213,9214,9215,9216,9217,9218,9219,9220,9221,9222,4466,9223,9224, # 8992 9225,9226,9227,9228,9229,9230,9231,9232,9233,9234,9235,9236,9237,9238,9239,9240, # 9008 9241,9242,9243,9244,9245,4891,9246,9247,9248,9249,9250,9251,9252,9253,9254,9255, # 9024 9256,9257,4892,9258,9259,9260,9261,4893,4894,9262,9263,9264,9265,9266,9267,9268, # 9040 9269,9270,9271,9272,9273,4467,9274,9275,9276,9277,9278,9279,9280,9281,9282,9283, # 9056 9284,9285,3673,9286,9287,9288,9289,9290,9291,9292,9293,9294,9295,9296,9297,9298, # 9072 9299,9300,9301,9302,9303,9304,9305,9306,9307,9308,9309,9310,9311,9312,9313,9314, # 9088 9315,9316,9317,9318,9319,9320,9321,9322,4895,9323,9324,9325,9326,9327,9328,9329, # 9104 9330,9331,9332,9333,9334,9335,9336,9337,9338,9339,9340,9341,9342,9343,9344,9345, # 9120 9346,9347,4468,9348,9349,9350,9351,9352,9353,9354,9355,9356,9357,9358,9359,9360, # 9136 9361,9362,9363,9364,9365,9366,9367,9368,9369,9370,9371,9372,9373,4896,9374,4469, # 9152 9375,9376,9377,9378,9379,4897,9380,9381,9382,9383,9384,9385,9386,9387,9388,9389, # 9168 9390,9391,9392,9393,9394,9395,9396,9397,9398,9399,9400,9401,9402,9403,9404,9405, # 9184 9406,4470,9407,2751,9408,9409,3674,3552,9410,9411,9412,9413,9414,9415,9416,9417, # 9200 9418,9419,9420,9421,4898,9422,9423,9424,9425,9426,9427,9428,9429,3959,9430,9431, # 9216 9432,9433,9434,9435,9436,4471,9437,9438,9439,9440,9441,9442,9443,9444,9445,9446, # 9232 9447,9448,9449,9450,3348,9451,9452,9453,9454,9455,9456,9457,9458,9459,9460,9461, # 9248 9462,9463,9464,9465,9466,9467,9468,9469,9470,9471,9472,4899,9473,9474,9475,9476, # 9264 9477,4900,9478,9479,9480,9481,9482,9483,9484,9485,9486,9487,9488,3349,9489,9490, # 9280 9491,9492,9493,9494,9495,9496,9497,9498,9499,9500,9501,9502,9503,9504,9505,9506, # 9296 9507,9508,9509,9510,9511,9512,9513,9514,9515,9516,9517,9518,9519,9520,4901,9521, # 9312 9522,9523,9524,9525,9526,4902,9527,9528,9529,9530,9531,9532,9533,9534,9535,9536, # 9328 9537,9538,9539,9540,9541,9542,9543,9544,9545,9546,9547,9548,9549,9550,9551,9552, # 9344 9553,9554,9555,9556,9557,9558,9559,9560,9561,9562,9563,9564,9565,9566,9567,9568, # 9360 9569,9570,9571,9572,9573,9574,9575,9576,9577,9578,9579,9580,9581,9582,9583,9584, # 9376 3805,9585,9586,9587,9588,9589,9590,9591,9592,9593,9594,9595,9596,9597,9598,9599, # 9392 9600,9601,9602,4903,9603,9604,9605,9606,9607,4904,9608,9609,9610,9611,9612,9613, # 9408 9614,4905,9615,9616,9617,9618,9619,9620,9621,9622,9623,9624,9625,9626,9627,9628, # 9424 9629,9630,9631,9632,4906,9633,9634,9635,9636,9637,9638,9639,9640,9641,9642,9643, # 9440 4907,9644,9645,9646,9647,9648,9649,9650,9651,9652,9653,9654,9655,9656,9657,9658, # 9456 9659,9660,9661,9662,9663,9664,9665,9666,9667,9668,9669,9670,9671,9672,4183,9673, # 9472 9674,9675,9676,9677,4908,9678,9679,9680,9681,4909,9682,9683,9684,9685,9686,9687, # 9488 9688,9689,9690,4910,9691,9692,9693,3675,9694,9695,9696,2945,9697,9698,9699,9700, # 9504 9701,9702,9703,9704,9705,4911,9706,9707,9708,9709,9710,9711,9712,9713,9714,9715, # 9520 9716,9717,9718,9719,9720,9721,9722,9723,9724,9725,9726,9727,9728,9729,9730,9731, # 9536 9732,9733,9734,9735,4912,9736,9737,9738,9739,9740,4913,9741,9742,9743,9744,9745, # 9552 9746,9747,9748,9749,9750,9751,9752,9753,9754,9755,9756,9757,9758,4914,9759,9760, # 9568 9761,9762,9763,9764,9765,9766,9767,9768,9769,9770,9771,9772,9773,9774,9775,9776, # 9584 9777,9778,9779,9780,9781,9782,4915,9783,9784,9785,9786,9787,9788,9789,9790,9791, # 9600 9792,9793,4916,9794,9795,9796,9797,9798,9799,9800,9801,9802,9803,9804,9805,9806, # 9616 9807,9808,9809,9810,9811,9812,9813,9814,9815,9816,9817,9818,9819,9820,9821,9822, # 9632 9823,9824,9825,9826,9827,9828,9829,9830,9831,9832,9833,9834,9835,9836,9837,9838, # 9648 9839,9840,9841,9842,9843,9844,9845,9846,9847,9848,9849,9850,9851,9852,9853,9854, # 9664 9855,9856,9857,9858,9859,9860,9861,9862,9863,9864,9865,9866,9867,9868,4917,9869, # 9680 9870,9871,9872,9873,9874,9875,9876,9877,9878,9879,9880,9881,9882,9883,9884,9885, # 9696 9886,9887,9888,9889,9890,9891,9892,4472,9893,9894,9895,9896,9897,3806,9898,9899, # 9712 9900,9901,9902,9903,9904,9905,9906,9907,9908,9909,9910,9911,9912,9913,9914,4918, # 9728 9915,9916,9917,4919,9918,9919,9920,9921,4184,9922,9923,9924,9925,9926,9927,9928, # 9744 9929,9930,9931,9932,9933,9934,9935,9936,9937,9938,9939,9940,9941,9942,9943,9944, # 9760 9945,9946,4920,9947,9948,9949,9950,9951,9952,9953,9954,9955,4185,9956,9957,9958, # 9776 9959,9960,9961,9962,9963,9964,9965,4921,9966,9967,9968,4473,9969,9970,9971,9972, # 9792 9973,9974,9975,9976,9977,4474,9978,9979,9980,9981,9982,9983,9984,9985,9986,9987, # 9808 9988,9989,9990,9991,9992,9993,9994,9995,9996,9997,9998,9999,10000,10001,10002,10003, # 9824 10004,10005,10006,10007,10008,10009,10010,10011,10012,10013,10014,10015,10016,10017,10018,10019, # 9840 10020,10021,4922,10022,4923,10023,10024,10025,10026,10027,10028,10029,10030,10031,10032,10033, # 9856 10034,10035,10036,10037,10038,10039,10040,10041,10042,10043,10044,10045,10046,10047,10048,4924, # 9872 10049,10050,10051,10052,10053,10054,10055,10056,10057,10058,10059,10060,10061,10062,10063,10064, # 9888 10065,10066,10067,10068,10069,10070,10071,10072,10073,10074,10075,10076,10077,10078,10079,10080, # 9904 10081,10082,10083,10084,10085,10086,10087,4475,10088,10089,10090,10091,10092,10093,10094,10095, # 9920 10096,10097,4476,10098,10099,10100,10101,10102,10103,10104,10105,10106,10107,10108,10109,10110, # 9936 10111,2174,10112,10113,10114,10115,10116,10117,10118,10119,10120,10121,10122,10123,10124,10125, # 9952 10126,10127,10128,10129,10130,10131,10132,10133,10134,10135,10136,10137,10138,10139,10140,3807, # 9968 4186,4925,10141,10142,10143,10144,10145,10146,10147,4477,4187,10148,10149,10150,10151,10152, # 9984 10153,4188,10154,10155,10156,10157,10158,10159,10160,10161,4926,10162,10163,10164,10165,10166, #10000 10167,10168,10169,10170,10171,10172,10173,10174,10175,10176,10177,10178,10179,10180,10181,10182, #10016 10183,10184,10185,10186,10187,10188,10189,10190,10191,10192,3203,10193,10194,10195,10196,10197, #10032 10198,10199,10200,4478,10201,10202,10203,10204,4479,10205,10206,10207,10208,10209,10210,10211, #10048 10212,10213,10214,10215,10216,10217,10218,10219,10220,10221,10222,10223,10224,10225,10226,10227, #10064 10228,10229,10230,10231,10232,10233,10234,4927,10235,10236,10237,10238,10239,10240,10241,10242, #10080 10243,10244,10245,10246,10247,10248,10249,10250,10251,10252,10253,10254,10255,10256,10257,10258, #10096 10259,10260,10261,10262,10263,10264,10265,10266,10267,10268,10269,10270,10271,10272,10273,4480, #10112 4928,4929,10274,10275,10276,10277,10278,10279,10280,10281,10282,10283,10284,10285,10286,10287, #10128 10288,10289,10290,10291,10292,10293,10294,10295,10296,10297,10298,10299,10300,10301,10302,10303, #10144 10304,10305,10306,10307,10308,10309,10310,10311,10312,10313,10314,10315,10316,10317,10318,10319, #10160 10320,10321,10322,10323,10324,10325,10326,10327,10328,10329,10330,10331,10332,10333,10334,4930, #10176 10335,10336,10337,10338,10339,10340,10341,10342,4931,10343,10344,10345,10346,10347,10348,10349, #10192 10350,10351,10352,10353,10354,10355,3088,10356,2786,10357,10358,10359,10360,4189,10361,10362, #10208 10363,10364,10365,10366,10367,10368,10369,10370,10371,10372,10373,10374,10375,4932,10376,10377, #10224 10378,10379,10380,10381,10382,10383,10384,10385,10386,10387,10388,10389,10390,10391,10392,4933, #10240 10393,10394,10395,4934,10396,10397,10398,10399,10400,10401,10402,10403,10404,10405,10406,10407, #10256 10408,10409,10410,10411,10412,3446,10413,10414,10415,10416,10417,10418,10419,10420,10421,10422, #10272 10423,4935,10424,10425,10426,10427,10428,10429,10430,4936,10431,10432,10433,10434,10435,10436, #10288 10437,10438,10439,10440,10441,10442,10443,4937,10444,10445,10446,10447,4481,10448,10449,10450, #10304 10451,10452,10453,10454,10455,10456,10457,10458,10459,10460,10461,10462,10463,10464,10465,10466, #10320 10467,10468,10469,10470,10471,10472,10473,10474,10475,10476,10477,10478,10479,10480,10481,10482, #10336 10483,10484,10485,10486,10487,10488,10489,10490,10491,10492,10493,10494,10495,10496,10497,10498, #10352 10499,10500,10501,10502,10503,10504,10505,4938,10506,10507,10508,10509,10510,2552,10511,10512, #10368 10513,10514,10515,10516,3447,10517,10518,10519,10520,10521,10522,10523,10524,10525,10526,10527, #10384 10528,10529,10530,10531,10532,10533,10534,10535,10536,10537,10538,10539,10540,10541,10542,10543, #10400 4482,10544,4939,10545,10546,10547,10548,10549,10550,10551,10552,10553,10554,10555,10556,10557, #10416 10558,10559,10560,10561,10562,10563,10564,10565,10566,10567,3676,4483,10568,10569,10570,10571, #10432 10572,3448,10573,10574,10575,10576,10577,10578,10579,10580,10581,10582,10583,10584,10585,10586, #10448 10587,10588,10589,10590,10591,10592,10593,10594,10595,10596,10597,10598,10599,10600,10601,10602, #10464 10603,10604,10605,10606,10607,10608,10609,10610,10611,10612,10613,10614,10615,10616,10617,10618, #10480 10619,10620,10621,10622,10623,10624,10625,10626,10627,4484,10628,10629,10630,10631,10632,4940, #10496 10633,10634,10635,10636,10637,10638,10639,10640,10641,10642,10643,10644,10645,10646,10647,10648, #10512 10649,10650,10651,10652,10653,10654,10655,10656,4941,10657,10658,10659,2599,10660,10661,10662, #10528 10663,10664,10665,10666,3089,10667,10668,10669,10670,10671,10672,10673,10674,10675,10676,10677, #10544 10678,10679,10680,4942,10681,10682,10683,10684,10685,10686,10687,10688,10689,10690,10691,10692, #10560 10693,10694,10695,10696,10697,4485,10698,10699,10700,10701,10702,10703,10704,4943,10705,3677, #10576 10706,10707,10708,10709,10710,10711,10712,4944,10713,10714,10715,10716,10717,10718,10719,10720, #10592 10721,10722,10723,10724,10725,10726,10727,10728,4945,10729,10730,10731,10732,10733,10734,10735, #10608 10736,10737,10738,10739,10740,10741,10742,10743,10744,10745,10746,10747,10748,10749,10750,10751, #10624 10752,10753,10754,10755,10756,10757,10758,10759,10760,10761,4946,10762,10763,10764,10765,10766, #10640 10767,4947,4948,10768,10769,10770,10771,10772,10773,10774,10775,10776,10777,10778,10779,10780, #10656 10781,10782,10783,10784,10785,10786,10787,10788,10789,10790,10791,10792,10793,10794,10795,10796, #10672 10797,10798,10799,10800,10801,10802,10803,10804,10805,10806,10807,10808,10809,10810,10811,10812, #10688 10813,10814,10815,10816,10817,10818,10819,10820,10821,10822,10823,10824,10825,10826,10827,10828, #10704 10829,10830,10831,10832,10833,10834,10835,10836,10837,10838,10839,10840,10841,10842,10843,10844, #10720 10845,10846,10847,10848,10849,10850,10851,10852,10853,10854,10855,10856,10857,10858,10859,10860, #10736 10861,10862,10863,10864,10865,10866,10867,10868,10869,10870,10871,10872,10873,10874,10875,10876, #10752 10877,10878,4486,10879,10880,10881,10882,10883,10884,10885,4949,10886,10887,10888,10889,10890, #10768 10891,10892,10893,10894,10895,10896,10897,10898,10899,10900,10901,10902,10903,10904,10905,10906, #10784 10907,10908,10909,10910,10911,10912,10913,10914,10915,10916,10917,10918,10919,4487,10920,10921, #10800 10922,10923,10924,10925,10926,10927,10928,10929,10930,10931,10932,4950,10933,10934,10935,10936, #10816 10937,10938,10939,10940,10941,10942,10943,10944,10945,10946,10947,10948,10949,4488,10950,10951, #10832 10952,10953,10954,10955,10956,10957,10958,10959,4190,10960,10961,10962,10963,10964,10965,10966, #10848 10967,10968,10969,10970,10971,10972,10973,10974,10975,10976,10977,10978,10979,10980,10981,10982, #10864 10983,10984,10985,10986,10987,10988,10989,10990,10991,10992,10993,10994,10995,10996,10997,10998, #10880 10999,11000,11001,11002,11003,11004,11005,11006,3960,11007,11008,11009,11010,11011,11012,11013, #10896 11014,11015,11016,11017,11018,11019,11020,11021,11022,11023,11024,11025,11026,11027,11028,11029, #10912 11030,11031,11032,4951,11033,11034,11035,11036,11037,11038,11039,11040,11041,11042,11043,11044, #10928 11045,11046,11047,4489,11048,11049,11050,11051,4952,11052,11053,11054,11055,11056,11057,11058, #10944 4953,11059,11060,11061,11062,11063,11064,11065,11066,11067,11068,11069,11070,11071,4954,11072, #10960 11073,11074,11075,11076,11077,11078,11079,11080,11081,11082,11083,11084,11085,11086,11087,11088, #10976 11089,11090,11091,11092,11093,11094,11095,11096,11097,11098,11099,11100,11101,11102,11103,11104, #10992 11105,11106,11107,11108,11109,11110,11111,11112,11113,11114,11115,3808,11116,11117,11118,11119, #11008 11120,11121,11122,11123,11124,11125,11126,11127,11128,11129,11130,11131,11132,11133,11134,4955, #11024 11135,11136,11137,11138,11139,11140,11141,11142,11143,11144,11145,11146,11147,11148,11149,11150, #11040 11151,11152,11153,11154,11155,11156,11157,11158,11159,11160,11161,4956,11162,11163,11164,11165, #11056 11166,11167,11168,11169,11170,11171,11172,11173,11174,11175,11176,11177,11178,11179,11180,4957, #11072 11181,11182,11183,11184,11185,11186,4958,11187,11188,11189,11190,11191,11192,11193,11194,11195, #11088 11196,11197,11198,11199,11200,3678,11201,11202,11203,11204,11205,11206,4191,11207,11208,11209, #11104 11210,11211,11212,11213,11214,11215,11216,11217,11218,11219,11220,11221,11222,11223,11224,11225, #11120 11226,11227,11228,11229,11230,11231,11232,11233,11234,11235,11236,11237,11238,11239,11240,11241, #11136 11242,11243,11244,11245,11246,11247,11248,11249,11250,11251,4959,11252,11253,11254,11255,11256, #11152 11257,11258,11259,11260,11261,11262,11263,11264,11265,11266,11267,11268,11269,11270,11271,11272, #11168 11273,11274,11275,11276,11277,11278,11279,11280,11281,11282,11283,11284,11285,11286,11287,11288, #11184 11289,11290,11291,11292,11293,11294,11295,11296,11297,11298,11299,11300,11301,11302,11303,11304, #11200 11305,11306,11307,11308,11309,11310,11311,11312,11313,11314,3679,11315,11316,11317,11318,4490, #11216 11319,11320,11321,11322,11323,11324,11325,11326,11327,11328,11329,11330,11331,11332,11333,11334, #11232 11335,11336,11337,11338,11339,11340,11341,11342,11343,11344,11345,11346,11347,4960,11348,11349, #11248 11350,11351,11352,11353,11354,11355,11356,11357,11358,11359,11360,11361,11362,11363,11364,11365, #11264 11366,11367,11368,11369,11370,11371,11372,11373,11374,11375,11376,11377,3961,4961,11378,11379, #11280 11380,11381,11382,11383,11384,11385,11386,11387,11388,11389,11390,11391,11392,11393,11394,11395, #11296 11396,11397,4192,11398,11399,11400,11401,11402,11403,11404,11405,11406,11407,11408,11409,11410, #11312 11411,4962,11412,11413,11414,11415,11416,11417,11418,11419,11420,11421,11422,11423,11424,11425, #11328 11426,11427,11428,11429,11430,11431,11432,11433,11434,11435,11436,11437,11438,11439,11440,11441, #11344 11442,11443,11444,11445,11446,11447,11448,11449,11450,11451,11452,11453,11454,11455,11456,11457, #11360 11458,11459,11460,11461,11462,11463,11464,11465,11466,11467,11468,11469,4963,11470,11471,4491, #11376 11472,11473,11474,11475,4964,11476,11477,11478,11479,11480,11481,11482,11483,11484,11485,11486, #11392 11487,11488,11489,11490,11491,11492,4965,11493,11494,11495,11496,11497,11498,11499,11500,11501, #11408 11502,11503,11504,11505,11506,11507,11508,11509,11510,11511,11512,11513,11514,11515,11516,11517, #11424 11518,11519,11520,11521,11522,11523,11524,11525,11526,11527,11528,11529,3962,11530,11531,11532, #11440 11533,11534,11535,11536,11537,11538,11539,11540,11541,11542,11543,11544,11545,11546,11547,11548, #11456 11549,11550,11551,11552,11553,11554,11555,11556,11557,11558,11559,11560,11561,11562,11563,11564, #11472 4193,4194,11565,11566,11567,11568,11569,11570,11571,11572,11573,11574,11575,11576,11577,11578, #11488 11579,11580,11581,11582,11583,11584,11585,11586,11587,11588,11589,11590,11591,4966,4195,11592, #11504 11593,11594,11595,11596,11597,11598,11599,11600,11601,11602,11603,11604,3090,11605,11606,11607, #11520 11608,11609,11610,4967,11611,11612,11613,11614,11615,11616,11617,11618,11619,11620,11621,11622, #11536 11623,11624,11625,11626,11627,11628,11629,11630,11631,11632,11633,11634,11635,11636,11637,11638, #11552 11639,11640,11641,11642,11643,11644,11645,11646,11647,11648,11649,11650,11651,11652,11653,11654, #11568 11655,11656,11657,11658,11659,11660,11661,11662,11663,11664,11665,11666,11667,11668,11669,11670, #11584 11671,11672,11673,11674,4968,11675,11676,11677,11678,11679,11680,11681,11682,11683,11684,11685, #11600 11686,11687,11688,11689,11690,11691,11692,11693,3809,11694,11695,11696,11697,11698,11699,11700, #11616 11701,11702,11703,11704,11705,11706,11707,11708,11709,11710,11711,11712,11713,11714,11715,11716, #11632 11717,11718,3553,11719,11720,11721,11722,11723,11724,11725,11726,11727,11728,11729,11730,4969, #11648 11731,11732,11733,11734,11735,11736,11737,11738,11739,11740,4492,11741,11742,11743,11744,11745, #11664 11746,11747,11748,11749,11750,11751,11752,4970,11753,11754,11755,11756,11757,11758,11759,11760, #11680 11761,11762,11763,11764,11765,11766,11767,11768,11769,11770,11771,11772,11773,11774,11775,11776, #11696 11777,11778,11779,11780,11781,11782,11783,11784,11785,11786,11787,11788,11789,11790,4971,11791, #11712 11792,11793,11794,11795,11796,11797,4972,11798,11799,11800,11801,11802,11803,11804,11805,11806, #11728 11807,11808,11809,11810,4973,11811,11812,11813,11814,11815,11816,11817,11818,11819,11820,11821, #11744 11822,11823,11824,11825,11826,11827,11828,11829,11830,11831,11832,11833,11834,3680,3810,11835, #11760 11836,4974,11837,11838,11839,11840,11841,11842,11843,11844,11845,11846,11847,11848,11849,11850, #11776 11851,11852,11853,11854,11855,11856,11857,11858,11859,11860,11861,11862,11863,11864,11865,11866, #11792 11867,11868,11869,11870,11871,11872,11873,11874,11875,11876,11877,11878,11879,11880,11881,11882, #11808 11883,11884,4493,11885,11886,11887,11888,11889,11890,11891,11892,11893,11894,11895,11896,11897, #11824 11898,11899,11900,11901,11902,11903,11904,11905,11906,11907,11908,11909,11910,11911,11912,11913, #11840 11914,11915,4975,11916,11917,11918,11919,11920,11921,11922,11923,11924,11925,11926,11927,11928, #11856 11929,11930,11931,11932,11933,11934,11935,11936,11937,11938,11939,11940,11941,11942,11943,11944, #11872 11945,11946,11947,11948,11949,4976,11950,11951,11952,11953,11954,11955,11956,11957,11958,11959, #11888 11960,11961,11962,11963,11964,11965,11966,11967,11968,11969,11970,11971,11972,11973,11974,11975, #11904 11976,11977,11978,11979,11980,11981,11982,11983,11984,11985,11986,11987,4196,11988,11989,11990, #11920 11991,11992,4977,11993,11994,11995,11996,11997,11998,11999,12000,12001,12002,12003,12004,12005, #11936 12006,12007,12008,12009,12010,12011,12012,12013,12014,12015,12016,12017,12018,12019,12020,12021, #11952 12022,12023,12024,12025,12026,12027,12028,12029,12030,12031,12032,12033,12034,12035,12036,12037, #11968 12038,12039,12040,12041,12042,12043,12044,12045,12046,12047,12048,12049,12050,12051,12052,12053, #11984 12054,12055,12056,12057,12058,12059,12060,12061,4978,12062,12063,12064,12065,12066,12067,12068, #12000 12069,12070,12071,12072,12073,12074,12075,12076,12077,12078,12079,12080,12081,12082,12083,12084, #12016 12085,12086,12087,12088,12089,12090,12091,12092,12093,12094,12095,12096,12097,12098,12099,12100, #12032 12101,12102,12103,12104,12105,12106,12107,12108,12109,12110,12111,12112,12113,12114,12115,12116, #12048 12117,12118,12119,12120,12121,12122,12123,4979,12124,12125,12126,12127,12128,4197,12129,12130, #12064 12131,12132,12133,12134,12135,12136,12137,12138,12139,12140,12141,12142,12143,12144,12145,12146, #12080 12147,12148,12149,12150,12151,12152,12153,12154,4980,12155,12156,12157,12158,12159,12160,4494, #12096 12161,12162,12163,12164,3811,12165,12166,12167,12168,12169,4495,12170,12171,4496,12172,12173, #12112 12174,12175,12176,3812,12177,12178,12179,12180,12181,12182,12183,12184,12185,12186,12187,12188, #12128 12189,12190,12191,12192,12193,12194,12195,12196,12197,12198,12199,12200,12201,12202,12203,12204, #12144 12205,12206,12207,12208,12209,12210,12211,12212,12213,12214,12215,12216,12217,12218,12219,12220, #12160 12221,4981,12222,12223,12224,12225,12226,12227,12228,12229,12230,12231,12232,12233,12234,12235, #12176 4982,12236,12237,12238,12239,12240,12241,12242,12243,12244,12245,4983,12246,12247,12248,12249, #12192 4984,12250,12251,12252,12253,12254,12255,12256,12257,12258,12259,12260,12261,12262,12263,12264, #12208 4985,12265,4497,12266,12267,12268,12269,12270,12271,12272,12273,12274,12275,12276,12277,12278, #12224 12279,12280,12281,12282,12283,12284,12285,12286,12287,4986,12288,12289,12290,12291,12292,12293, #12240 12294,12295,12296,2473,12297,12298,12299,12300,12301,12302,12303,12304,12305,12306,12307,12308, #12256 12309,12310,12311,12312,12313,12314,12315,12316,12317,12318,12319,3963,12320,12321,12322,12323, #12272 12324,12325,12326,12327,12328,12329,12330,12331,12332,4987,12333,12334,12335,12336,12337,12338, #12288 12339,12340,12341,12342,12343,12344,12345,12346,12347,12348,12349,12350,12351,12352,12353,12354, #12304 12355,12356,12357,12358,12359,3964,12360,12361,12362,12363,12364,12365,12366,12367,12368,12369, #12320 12370,3965,12371,12372,12373,12374,12375,12376,12377,12378,12379,12380,12381,12382,12383,12384, #12336 12385,12386,12387,12388,12389,12390,12391,12392,12393,12394,12395,12396,12397,12398,12399,12400, #12352 12401,12402,12403,12404,12405,12406,12407,12408,4988,12409,12410,12411,12412,12413,12414,12415, #12368 12416,12417,12418,12419,12420,12421,12422,12423,12424,12425,12426,12427,12428,12429,12430,12431, #12384 12432,12433,12434,12435,12436,12437,12438,3554,12439,12440,12441,12442,12443,12444,12445,12446, #12400 12447,12448,12449,12450,12451,12452,12453,12454,12455,12456,12457,12458,12459,12460,12461,12462, #12416 12463,12464,4989,12465,12466,12467,12468,12469,12470,12471,12472,12473,12474,12475,12476,12477, #12432 12478,12479,12480,4990,12481,12482,12483,12484,12485,12486,12487,12488,12489,4498,12490,12491, #12448 12492,12493,12494,12495,12496,12497,12498,12499,12500,12501,12502,12503,12504,12505,12506,12507, #12464 12508,12509,12510,12511,12512,12513,12514,12515,12516,12517,12518,12519,12520,12521,12522,12523, #12480 12524,12525,12526,12527,12528,12529,12530,12531,12532,12533,12534,12535,12536,12537,12538,12539, #12496 12540,12541,12542,12543,12544,12545,12546,12547,12548,12549,12550,12551,4991,12552,12553,12554, #12512 12555,12556,12557,12558,12559,12560,12561,12562,12563,12564,12565,12566,12567,12568,12569,12570, #12528 12571,12572,12573,12574,12575,12576,12577,12578,3036,12579,12580,12581,12582,12583,3966,12584, #12544 12585,12586,12587,12588,12589,12590,12591,12592,12593,12594,12595,12596,12597,12598,12599,12600, #12560 12601,12602,12603,12604,12605,12606,12607,12608,12609,12610,12611,12612,12613,12614,12615,12616, #12576 12617,12618,12619,12620,12621,12622,12623,12624,12625,12626,12627,12628,12629,12630,12631,12632, #12592 12633,12634,12635,12636,12637,12638,12639,12640,12641,12642,12643,12644,12645,12646,4499,12647, #12608 12648,12649,12650,12651,12652,12653,12654,12655,12656,12657,12658,12659,12660,12661,12662,12663, #12624 12664,12665,12666,12667,12668,12669,12670,12671,12672,12673,12674,12675,12676,12677,12678,12679, #12640 12680,12681,12682,12683,12684,12685,12686,12687,12688,12689,12690,12691,12692,12693,12694,12695, #12656 12696,12697,12698,4992,12699,12700,12701,12702,12703,12704,12705,12706,12707,12708,12709,12710, #12672 12711,12712,12713,12714,12715,12716,12717,12718,12719,12720,12721,12722,12723,12724,12725,12726, #12688 12727,12728,12729,12730,12731,12732,12733,12734,12735,12736,12737,12738,12739,12740,12741,12742, #12704 12743,12744,12745,12746,12747,12748,12749,12750,12751,12752,12753,12754,12755,12756,12757,12758, #12720 12759,12760,12761,12762,12763,12764,12765,12766,12767,12768,12769,12770,12771,12772,12773,12774, #12736 12775,12776,12777,12778,4993,2175,12779,12780,12781,12782,12783,12784,12785,12786,4500,12787, #12752 12788,12789,12790,12791,12792,12793,12794,12795,12796,12797,12798,12799,12800,12801,12802,12803, #12768 12804,12805,12806,12807,12808,12809,12810,12811,12812,12813,12814,12815,12816,12817,12818,12819, #12784 12820,12821,12822,12823,12824,12825,12826,4198,3967,12827,12828,12829,12830,12831,12832,12833, #12800 12834,12835,12836,12837,12838,12839,12840,12841,12842,12843,12844,12845,12846,12847,12848,12849, #12816 12850,12851,12852,12853,12854,12855,12856,12857,12858,12859,12860,12861,4199,12862,12863,12864, #12832 12865,12866,12867,12868,12869,12870,12871,12872,12873,12874,12875,12876,12877,12878,12879,12880, #12848 12881,12882,12883,12884,12885,12886,12887,4501,12888,12889,12890,12891,12892,12893,12894,12895, #12864 12896,12897,12898,12899,12900,12901,12902,12903,12904,12905,12906,12907,12908,12909,12910,12911, #12880 12912,4994,12913,12914,12915,12916,12917,12918,12919,12920,12921,12922,12923,12924,12925,12926, #12896 12927,12928,12929,12930,12931,12932,12933,12934,12935,12936,12937,12938,12939,12940,12941,12942, #12912 12943,12944,12945,12946,12947,12948,12949,12950,12951,12952,12953,12954,12955,12956,1772,12957, #12928 12958,12959,12960,12961,12962,12963,12964,12965,12966,12967,12968,12969,12970,12971,12972,12973, #12944 12974,12975,12976,12977,12978,12979,12980,12981,12982,12983,12984,12985,12986,12987,12988,12989, #12960 12990,12991,12992,12993,12994,12995,12996,12997,4502,12998,4503,12999,13000,13001,13002,13003, #12976 4504,13004,13005,13006,13007,13008,13009,13010,13011,13012,13013,13014,13015,13016,13017,13018, #12992 13019,13020,13021,13022,13023,13024,13025,13026,13027,13028,13029,3449,13030,13031,13032,13033, #13008 13034,13035,13036,13037,13038,13039,13040,13041,13042,13043,13044,13045,13046,13047,13048,13049, #13024 13050,13051,13052,13053,13054,13055,13056,13057,13058,13059,13060,13061,13062,13063,13064,13065, #13040 13066,13067,13068,13069,13070,13071,13072,13073,13074,13075,13076,13077,13078,13079,13080,13081, #13056 13082,13083,13084,13085,13086,13087,13088,13089,13090,13091,13092,13093,13094,13095,13096,13097, #13072 13098,13099,13100,13101,13102,13103,13104,13105,13106,13107,13108,13109,13110,13111,13112,13113, #13088 13114,13115,13116,13117,13118,3968,13119,4995,13120,13121,13122,13123,13124,13125,13126,13127, #13104 4505,13128,13129,13130,13131,13132,13133,13134,4996,4506,13135,13136,13137,13138,13139,4997, #13120 13140,13141,13142,13143,13144,13145,13146,13147,13148,13149,13150,13151,13152,13153,13154,13155, #13136 13156,13157,13158,13159,4998,13160,13161,13162,13163,13164,13165,13166,13167,13168,13169,13170, #13152 13171,13172,13173,13174,13175,13176,4999,13177,13178,13179,13180,13181,13182,13183,13184,13185, #13168 13186,13187,13188,13189,13190,13191,13192,13193,13194,13195,13196,13197,13198,13199,13200,13201, #13184 13202,13203,13204,13205,13206,5000,13207,13208,13209,13210,13211,13212,13213,13214,13215,13216, #13200 13217,13218,13219,13220,13221,13222,13223,13224,13225,13226,13227,4200,5001,13228,13229,13230, #13216 13231,13232,13233,13234,13235,13236,13237,13238,13239,13240,3969,13241,13242,13243,13244,3970, #13232 13245,13246,13247,13248,13249,13250,13251,13252,13253,13254,13255,13256,13257,13258,13259,13260, #13248 13261,13262,13263,13264,13265,13266,13267,13268,3450,13269,13270,13271,13272,13273,13274,13275, #13264 13276,5002,13277,13278,13279,13280,13281,13282,13283,13284,13285,13286,13287,13288,13289,13290, #13280 13291,13292,13293,13294,13295,13296,13297,13298,13299,13300,13301,13302,3813,13303,13304,13305, #13296 13306,13307,13308,13309,13310,13311,13312,13313,13314,13315,13316,13317,13318,13319,13320,13321, #13312 13322,13323,13324,13325,13326,13327,13328,4507,13329,13330,13331,13332,13333,13334,13335,13336, #13328 13337,13338,13339,13340,13341,5003,13342,13343,13344,13345,13346,13347,13348,13349,13350,13351, #13344 13352,13353,13354,13355,13356,13357,13358,13359,13360,13361,13362,13363,13364,13365,13366,13367, #13360 5004,13368,13369,13370,13371,13372,13373,13374,13375,13376,13377,13378,13379,13380,13381,13382, #13376 13383,13384,13385,13386,13387,13388,13389,13390,13391,13392,13393,13394,13395,13396,13397,13398, #13392 13399,13400,13401,13402,13403,13404,13405,13406,13407,13408,13409,13410,13411,13412,13413,13414, #13408 13415,13416,13417,13418,13419,13420,13421,13422,13423,13424,13425,13426,13427,13428,13429,13430, #13424 13431,13432,4508,13433,13434,13435,4201,13436,13437,13438,13439,13440,13441,13442,13443,13444, #13440 13445,13446,13447,13448,13449,13450,13451,13452,13453,13454,13455,13456,13457,5005,13458,13459, #13456 13460,13461,13462,13463,13464,13465,13466,13467,13468,13469,13470,4509,13471,13472,13473,13474, #13472 13475,13476,13477,13478,13479,13480,13481,13482,13483,13484,13485,13486,13487,13488,13489,13490, #13488 13491,13492,13493,13494,13495,13496,13497,13498,13499,13500,13501,13502,13503,13504,13505,13506, #13504 13507,13508,13509,13510,13511,13512,13513,13514,13515,13516,13517,13518,13519,13520,13521,13522, #13520 13523,13524,13525,13526,13527,13528,13529,13530,13531,13532,13533,13534,13535,13536,13537,13538, #13536 13539,13540,13541,13542,13543,13544,13545,13546,13547,13548,13549,13550,13551,13552,13553,13554, #13552 13555,13556,13557,13558,13559,13560,13561,13562,13563,13564,13565,13566,13567,13568,13569,13570, #13568 13571,13572,13573,13574,13575,13576,13577,13578,13579,13580,13581,13582,13583,13584,13585,13586, #13584 13587,13588,13589,13590,13591,13592,13593,13594,13595,13596,13597,13598,13599,13600,13601,13602, #13600 13603,13604,13605,13606,13607,13608,13609,13610,13611,13612,13613,13614,13615,13616,13617,13618, #13616 13619,13620,13621,13622,13623,13624,13625,13626,13627,13628,13629,13630,13631,13632,13633,13634, #13632 13635,13636,13637,13638,13639,13640,13641,13642,5006,13643,13644,13645,13646,13647,13648,13649, #13648 13650,13651,5007,13652,13653,13654,13655,13656,13657,13658,13659,13660,13661,13662,13663,13664, #13664 13665,13666,13667,13668,13669,13670,13671,13672,13673,13674,13675,13676,13677,13678,13679,13680, #13680 13681,13682,13683,13684,13685,13686,13687,13688,13689,13690,13691,13692,13693,13694,13695,13696, #13696 13697,13698,13699,13700,13701,13702,13703,13704,13705,13706,13707,13708,13709,13710,13711,13712, #13712 13713,13714,13715,13716,13717,13718,13719,13720,13721,13722,13723,13724,13725,13726,13727,13728, #13728 13729,13730,13731,13732,13733,13734,13735,13736,13737,13738,13739,13740,13741,13742,13743,13744, #13744 13745,13746,13747,13748,13749,13750,13751,13752,13753,13754,13755,13756,13757,13758,13759,13760, #13760 13761,13762,13763,13764,13765,13766,13767,13768,13769,13770,13771,13772,13773,13774,3273,13775, #13776 13776,13777,13778,13779,13780,13781,13782,13783,13784,13785,13786,13787,13788,13789,13790,13791, #13792 13792,13793,13794,13795,13796,13797,13798,13799,13800,13801,13802,13803,13804,13805,13806,13807, #13808 13808,13809,13810,13811,13812,13813,13814,13815,13816,13817,13818,13819,13820,13821,13822,13823, #13824 13824,13825,13826,13827,13828,13829,13830,13831,13832,13833,13834,13835,13836,13837,13838,13839, #13840 13840,13841,13842,13843,13844,13845,13846,13847,13848,13849,13850,13851,13852,13853,13854,13855, #13856 13856,13857,13858,13859,13860,13861,13862,13863,13864,13865,13866,13867,13868,13869,13870,13871, #13872 13872,13873,13874,13875,13876,13877,13878,13879,13880,13881,13882,13883,13884,13885,13886,13887, #13888 13888,13889,13890,13891,13892,13893,13894,13895,13896,13897,13898,13899,13900,13901,13902,13903, #13904 13904,13905,13906,13907,13908,13909,13910,13911,13912,13913,13914,13915,13916,13917,13918,13919, #13920 13920,13921,13922,13923,13924,13925,13926,13927,13928,13929,13930,13931,13932,13933,13934,13935, #13936 13936,13937,13938,13939,13940,13941,13942,13943,13944,13945,13946,13947,13948,13949,13950,13951, #13952 13952,13953,13954,13955,13956,13957,13958,13959,13960,13961,13962,13963,13964,13965,13966,13967, #13968 13968,13969,13970,13971,13972) #13973 # flake8: noqa
apache-2.0
[ 6565, 16427, 5113, 8068, 11945, 199, 3, 710, 12769, 5495, 365, 17728, 13338, 707, 1890, 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, 19960, 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, 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, 3, 13123, 21, 9857, 1817, 199, 3, 701, 377, 5789, 20444, 1159, 603, 460, 285, 262, 27724, 23193, 1849, 1097, 382, 199, 3, 665, 1014, 921, 1544, 14, 8654, 14, 8122, 26, 2835, 15, 10333, 82, 3133, 199, 3, 199, 3, 7960, 221, 10541, 378, 14, 23814, 2976, 199, 3, 7633, 221, 10541, 378, 14, 1641, 22740, 199, 3, 10574, 221, 10541, 378, 14, 1342, 22740, 199, 3, 6619, 10541, 378, 14, 1407, 8188, 199, 3, 18427, 10541, 378, 14, 2576, 16793, 199, 3, 199, 3, 473, 21245, 11839, 820, 32736, 275, 378, 14, 1342, 22740, 7985, 17, 13, 16, 14, 1342, 22740, 9, 275, 18, 14, 2905, 199, 3, 9571, 11839, 820, 425, 275, 10574, 7985, 1477, 614, 13, 7736, 23397, 16, 14, 7320, 199, 3, 199, 3, 29267, 11839, 820, 32736, 3595, 5661, 5, 402, 473, 21245, 1373, 12, 5139, 8298, 10948, 2419, 820, 4564, 199, 199, 18643, 21, 63, 7034, 5974, 63, 24580, 26601, 63, 26566, 275, 378, 14, 2194, 199, 199, 3, 1610, 370, 481, 2103, 4738, 1817, 199, 18643, 21, 63, 8723, 63, 4305, 275, 959, 11452, 199, 199, 7279, 21, 18139, 13875, 4738, 275, 334, 2043, 413, 12, 1085, 614, 12, 1046, 1690, 12, 5450, 12, 1079, 2192, 12, 413, 2905, 12, 257, 1749, 12, 221, 18051, 12, 257, 1227, 12, 5783, 24, 12, 413, 1138, 12, 19328, 12, 1344, 2835, 12, 713, 1367, 12, 1651, 2025, 12, 16814, 12, 327, 257, 3193, 199, 1703, 1079, 12, 221, 9404, 12, 708, 1342, 12, 499, 2976, 12, 221, 14646, 12, 221, 10868, 12, 18, 7636, 12, 221, 3193, 12, 1398, 2466, 12, 9252, 23, 12, 31989, 12, 1227, 1427, 12, 1355, 3172, 12, 221, 7875, 12, 1082, 2869, 12, 1479, 2481, 12, 327, 257, 4337, 199, 845, 2905, 12, 1355, 2819, 12, 1153, 1400, 12, 2260, 996, 12, 32321, 12, 1081, 1046, 12, 11485, 12, 959, 2710, 12, 650, 2976, 12, 1167, 772, 12, 257, 1695, 12, 14785, 12, 221, 13713, 12, 2322, 709, 12, 5783, 25, 12, 1167, 708, 12, 327, 257, 9615, 523, 13668, 12, 8216, 16, 12, 8216, 17, 12, 650, 1196, 12, 975, 1079, 12, 221, 13098, 12, 26485, 12, 413, 1427, 12, 20, 11341, 12, 1194, 1196, 12, 1079, 1257, 12, 8216, 18, 12, 10156, 21, 12, 1216, 3328, 12, 18565, 12, 29736, 12, 327, 257, 5049, 199, 1344, 2564, 12, 257, 650, 12, 221, 1616, 12, 1355, 2898, 12, 1079, 3172, 12, 221, 7349, 12, 1465, 1555, 12, 845, 1276, 12, 11125, 22, 12, 30614, 12, 10513, 19, 12, 21334, 12, 708, 2194, 12, 17, 4288, 12, 650, 713, 12, 8216, 19, 12, 327, 257, 5939, 199, 2322, 845, 12, 1165, 2528, 12, 959, 1780, 12, 27210, 12, 1227, 2564, 12, 8216, 20, 12, 31308, 12, 1167, 1046, 12, 25442, 12, 26761, 12, 1398, 2417, 12, 221, 8177, 12, 10156, 22, 12, 708, 966, 12, 221, 5049, 12, 1227, 966, 12, 327, 257, 15580, 199, 8216, 21, 12, 821, 614, 12, 1167, 1138, 12, 1167, 2277, 12, 29710, 12, 7155, 17, 12, 5049, 21, 12, 5049, 17, 12, 975, 1690, 12, 8216, 22, 12, 1082, 2528, 12, 650, 1401, 12, 221, 15323, 12, 841, 1690, 12, 8216, 23, 12, 221, 5939, 12, 327, 221, 20240, 199, 1227, 1216, 12, 27077, 12, 708, 1717, 12, 1046, 1643, 12, 499, 2766, 12, 1749, 1355, 12, 709, 2942, 12, 1479, 1477, 12, 1520, 1367, 12, 1079, 2167, 12, 709, 2635, 12, 1082, 2481, 12, 841, 1887, 12, 221, 14610, 12, 1398, 1555, 12, 959, 3328, 12, 327, 221, 7960, 199, 31420, 12, 1165, 2534, 12, 841, 3172, 12, 22560, 12, 1165, 1276, 12, 1085, 1602, 12, 221, 5212, 12, 221, 5238, 12, 1398, 1299, 12, 25956, 12, 5939, 22, 12, 1085, 1876, 12, 1520, 1082, 12, 1165, 1344, 12, 1082, 1477, 12, 13576, 12, 327, 221, 21771, 199, 8806, 21, 12, 975, 1780, 12, 32609, 12, 959, 1401, 12, 1398, 1780, 12, 1227, 1299, 12, 8216, 24, 12, 650, 1167, 12, 969, 1717, 12, 8375, 25, 12, 6886, 21, 12, 959, 1079, 12, 10638, 25, 12, 499, 2905, 12, 2322, 713, 12, 650, 1427, 12, 327, 221, 21235, 199, 27874, 12, 221, 9137, 12, 1465, 975, 12, 969, 1703, 12, 1227, 2766, 12, 221, 4119, 12, 1749, 1690, 12, 709, 1020, 12, 2299, 19, 12, 221, 3388, 12, 1194, 2953, 12, 413, 2564, 12, 959, 708, 12, 1196, 975, 12, 8216, 25, 12, 1520, 708, 12, 327, 221, 27827, 199, 969, 2114, 12, 2260, 966, 12, 969, 845, 12, 1079, 1165, 12, 708, 1690, 12, 221, 5661, 12, 1789, 1196, 12, 709, 1367, 12, 24073, 12, 650, 1020, 12, 650, 2564 ]
[ 16427, 5113, 8068, 11945, 199, 3, 710, 12769, 5495, 365, 17728, 13338, 707, 1890, 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, 19960, 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, 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, 3, 13123, 21, 9857, 1817, 199, 3, 701, 377, 5789, 20444, 1159, 603, 460, 285, 262, 27724, 23193, 1849, 1097, 382, 199, 3, 665, 1014, 921, 1544, 14, 8654, 14, 8122, 26, 2835, 15, 10333, 82, 3133, 199, 3, 199, 3, 7960, 221, 10541, 378, 14, 23814, 2976, 199, 3, 7633, 221, 10541, 378, 14, 1641, 22740, 199, 3, 10574, 221, 10541, 378, 14, 1342, 22740, 199, 3, 6619, 10541, 378, 14, 1407, 8188, 199, 3, 18427, 10541, 378, 14, 2576, 16793, 199, 3, 199, 3, 473, 21245, 11839, 820, 32736, 275, 378, 14, 1342, 22740, 7985, 17, 13, 16, 14, 1342, 22740, 9, 275, 18, 14, 2905, 199, 3, 9571, 11839, 820, 425, 275, 10574, 7985, 1477, 614, 13, 7736, 23397, 16, 14, 7320, 199, 3, 199, 3, 29267, 11839, 820, 32736, 3595, 5661, 5, 402, 473, 21245, 1373, 12, 5139, 8298, 10948, 2419, 820, 4564, 199, 199, 18643, 21, 63, 7034, 5974, 63, 24580, 26601, 63, 26566, 275, 378, 14, 2194, 199, 199, 3, 1610, 370, 481, 2103, 4738, 1817, 199, 18643, 21, 63, 8723, 63, 4305, 275, 959, 11452, 199, 199, 7279, 21, 18139, 13875, 4738, 275, 334, 2043, 413, 12, 1085, 614, 12, 1046, 1690, 12, 5450, 12, 1079, 2192, 12, 413, 2905, 12, 257, 1749, 12, 221, 18051, 12, 257, 1227, 12, 5783, 24, 12, 413, 1138, 12, 19328, 12, 1344, 2835, 12, 713, 1367, 12, 1651, 2025, 12, 16814, 12, 327, 257, 3193, 199, 1703, 1079, 12, 221, 9404, 12, 708, 1342, 12, 499, 2976, 12, 221, 14646, 12, 221, 10868, 12, 18, 7636, 12, 221, 3193, 12, 1398, 2466, 12, 9252, 23, 12, 31989, 12, 1227, 1427, 12, 1355, 3172, 12, 221, 7875, 12, 1082, 2869, 12, 1479, 2481, 12, 327, 257, 4337, 199, 845, 2905, 12, 1355, 2819, 12, 1153, 1400, 12, 2260, 996, 12, 32321, 12, 1081, 1046, 12, 11485, 12, 959, 2710, 12, 650, 2976, 12, 1167, 772, 12, 257, 1695, 12, 14785, 12, 221, 13713, 12, 2322, 709, 12, 5783, 25, 12, 1167, 708, 12, 327, 257, 9615, 523, 13668, 12, 8216, 16, 12, 8216, 17, 12, 650, 1196, 12, 975, 1079, 12, 221, 13098, 12, 26485, 12, 413, 1427, 12, 20, 11341, 12, 1194, 1196, 12, 1079, 1257, 12, 8216, 18, 12, 10156, 21, 12, 1216, 3328, 12, 18565, 12, 29736, 12, 327, 257, 5049, 199, 1344, 2564, 12, 257, 650, 12, 221, 1616, 12, 1355, 2898, 12, 1079, 3172, 12, 221, 7349, 12, 1465, 1555, 12, 845, 1276, 12, 11125, 22, 12, 30614, 12, 10513, 19, 12, 21334, 12, 708, 2194, 12, 17, 4288, 12, 650, 713, 12, 8216, 19, 12, 327, 257, 5939, 199, 2322, 845, 12, 1165, 2528, 12, 959, 1780, 12, 27210, 12, 1227, 2564, 12, 8216, 20, 12, 31308, 12, 1167, 1046, 12, 25442, 12, 26761, 12, 1398, 2417, 12, 221, 8177, 12, 10156, 22, 12, 708, 966, 12, 221, 5049, 12, 1227, 966, 12, 327, 257, 15580, 199, 8216, 21, 12, 821, 614, 12, 1167, 1138, 12, 1167, 2277, 12, 29710, 12, 7155, 17, 12, 5049, 21, 12, 5049, 17, 12, 975, 1690, 12, 8216, 22, 12, 1082, 2528, 12, 650, 1401, 12, 221, 15323, 12, 841, 1690, 12, 8216, 23, 12, 221, 5939, 12, 327, 221, 20240, 199, 1227, 1216, 12, 27077, 12, 708, 1717, 12, 1046, 1643, 12, 499, 2766, 12, 1749, 1355, 12, 709, 2942, 12, 1479, 1477, 12, 1520, 1367, 12, 1079, 2167, 12, 709, 2635, 12, 1082, 2481, 12, 841, 1887, 12, 221, 14610, 12, 1398, 1555, 12, 959, 3328, 12, 327, 221, 7960, 199, 31420, 12, 1165, 2534, 12, 841, 3172, 12, 22560, 12, 1165, 1276, 12, 1085, 1602, 12, 221, 5212, 12, 221, 5238, 12, 1398, 1299, 12, 25956, 12, 5939, 22, 12, 1085, 1876, 12, 1520, 1082, 12, 1165, 1344, 12, 1082, 1477, 12, 13576, 12, 327, 221, 21771, 199, 8806, 21, 12, 975, 1780, 12, 32609, 12, 959, 1401, 12, 1398, 1780, 12, 1227, 1299, 12, 8216, 24, 12, 650, 1167, 12, 969, 1717, 12, 8375, 25, 12, 6886, 21, 12, 959, 1079, 12, 10638, 25, 12, 499, 2905, 12, 2322, 713, 12, 650, 1427, 12, 327, 221, 21235, 199, 27874, 12, 221, 9137, 12, 1465, 975, 12, 969, 1703, 12, 1227, 2766, 12, 221, 4119, 12, 1749, 1690, 12, 709, 1020, 12, 2299, 19, 12, 221, 3388, 12, 1194, 2953, 12, 413, 2564, 12, 959, 708, 12, 1196, 975, 12, 8216, 25, 12, 1520, 708, 12, 327, 221, 27827, 199, 969, 2114, 12, 2260, 966, 12, 969, 845, 12, 1079, 1165, 12, 708, 1690, 12, 221, 5661, 12, 1789, 1196, 12, 709, 1367, 12, 24073, 12, 650, 1020, 12, 650, 2564, 0 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,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
199
3908
#!/usr/bin/env python # Copyright (c) 2012 The LibYuv Project Authors. All rights reserved. # # Use of this source code is governed by a BSD-style license # that can be found in the LICENSE file in the root of the source # tree. An additional intellectual property rights grant can be found # in the file PATENTS. All contributing project authors may # be found in the AUTHORS file in the root of the source tree. """ Copied from Chrome's src/tools/valgrind/memcheck/PRESUBMIT.py See http://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts for more details on the presubmit API built into gcl. """ import os import re import sys def CheckChange(input_api, output_api): """Checks the memcheck suppressions files for bad data.""" # Add the path to the Chrome valgrind dir to the import path: tools_vg_path = os.path.join(input_api.PresubmitLocalPath(), '..', '..', 'valgrind') sys.path.append(tools_vg_path) import suppressions sup_regex = re.compile('suppressions.*\.txt$') suppressions = {} errors = [] check_for_memcheck = False # skip_next_line has 3 possible values: # - False: don't skip the next line. # - 'skip_suppression_name': the next line is a suppression name, skip. # - 'skip_param': the next line is a system call parameter error, skip. skip_next_line = False for f in filter(lambda x: sup_regex.search(x.LocalPath()), input_api.AffectedFiles()): for line, line_num in zip(f.NewContents(), xrange(1, len(f.NewContents()) + 1)): line = line.lstrip() if line.startswith('#') or not line: continue if skip_next_line: if skip_next_line == 'skip_suppression_name': if 'insert_a_suppression_name_here' in line: errors.append('"insert_a_suppression_name_here" is not a valid ' 'suppression name') if suppressions.has_key(line): if f.LocalPath() == suppressions[line][1]: errors.append('suppression with name "%s" at %s line %s ' 'has already been defined at line %s' % (line, f.LocalPath(), line_num, suppressions[line][1])) else: errors.append('suppression with name "%s" at %s line %s ' 'has already been defined at %s line %s' % (line, f.LocalPath(), line_num, suppressions[line][0], suppressions[line][1])) else: suppressions[line] = (f, line_num) check_for_memcheck = True; skip_next_line = False continue if check_for_memcheck: if not line.startswith('Memcheck:'): errors.append('"%s" should be "Memcheck:..." in %s line %s' % (line, f.LocalPath(), line_num)) check_for_memcheck = False; if line == '{': skip_next_line = 'skip_suppression_name' continue if line == "Memcheck:Param": skip_next_line = 'skip_param' continue if (line.startswith('fun:') or line.startswith('obj:') or line.startswith('Memcheck:') or line == '}' or line == '...'): continue errors.append('"%s" is probably wrong: %s line %s' % (line, f.LocalPath(), line_num)) if errors: return [output_api.PresubmitError('\n'.join(errors))] return [] def CheckChangeOnUpload(input_api, output_api): return CheckChange(input_api, output_api) def CheckChangeOnCommit(input_api, output_api): return CheckChange(input_api, output_api) def GetPreferredTrySlaves(): # We don't have any memcheck slaves yet, so there's no use for this method. # When we have, the slave name(s) should be put into this list. return []
bsd-3-clause
[ 3381, 2647, 15, 1393, 15, 1813, 2366, 199, 3, 1898, 334, 67, 9, 6029, 710, 8003, 57, 9154, 7290, 6642, 14, 2900, 4481, 4644, 14, 199, 3, 199, 3, 3645, 402, 642, 1350, 1233, 365, 10413, 701, 282, 6289, 13, 2487, 4190, 199, 3, 626, 883, 506, 1911, 315, 314, 5113, 570, 315, 314, 1738, 402, 314, 1350, 199, 3, 3123, 14, 1626, 4722, 27925, 1264, 1061, 3324, 4481, 16085, 883, 506, 1911, 199, 3, 315, 314, 570, 31467, 1309, 51, 14, 221, 2900, 5914, 4655, 2199, 11462, 1443, 199, 3, 506, 1911, 315, 314, 10610, 570, 315, 314, 1738, 402, 314, 1350, 3123, 14, 199, 199, 624, 199, 18268, 5299, 687, 16776, 1159, 2928, 15, 2537, 15, 637, 21510, 15, 5286, 1074, 15, 14956, 2533, 13965, 14, 647, 199, 199, 9295, 1455, 921, 2374, 14, 13211, 14, 1308, 15, 23826, 15, 1917, 13, 14543, 15, 27834, 2537, 15, 80, 15527, 13, 6429, 199, 509, 1655, 2436, 641, 314, 23895, 3261, 6137, 1901, 486, 429, 14, 199, 624, 199, 199, 646, 747, 199, 646, 295, 199, 646, 984, 199, 199, 318, 2670, 4001, 8, 1210, 63, 1246, 12, 1072, 63, 1246, 304, 523, 408, 11834, 314, 7573, 1074, 4973, 6274, 1584, 367, 4875, 666, 1041, 819, 327, 2654, 314, 931, 370, 314, 16776, 1139, 21510, 2935, 370, 314, 492, 931, 26, 523, 7249, 63, 10929, 63, 515, 275, 747, 14, 515, 14, 904, 8, 1210, 63, 1246, 14, 30607, 26453, 1062, 19155, 19155, 3044, 283, 637, 21510, 358, 523, 984, 14, 515, 14, 740, 8, 2537, 63, 10929, 63, 515, 9, 523, 492, 4973, 6274, 819, 1029, 63, 3821, 275, 295, 14, 2014, 360, 8621, 6274, 24736, 2424, 9988, 523, 4973, 6274, 275, 1052, 523, 2552, 275, 942, 523, 1104, 63, 509, 63, 5286, 1074, 275, 756, 523, 327, 3372, 63, 2184, 63, 604, 965, 650, 3962, 1338, 26, 523, 327, 446, 756, 26, 2793, 1133, 3372, 314, 2163, 1004, 14, 523, 327, 446, 283, 2759, 63, 8621, 1941, 63, 354, 356, 314, 2163, 1004, 365, 282, 4973, 1941, 536, 12, 3372, 14, 523, 327, 446, 283, 2759, 63, 635, 356, 314, 2163, 1004, 365, 282, 2656, 1240, 2725, 1125, 12, 3372, 14, 523, 3372, 63, 2184, 63, 604, 275, 756, 523, 367, 289, 315, 2457, 8, 2734, 671, 26, 1029, 63, 3821, 14, 1733, 8, 88, 14, 26453, 4000, 2116, 1324, 63, 1246, 14, 19256, 6201, 5535, 5109, 272, 367, 1004, 12, 1004, 63, 1507, 315, 3482, 8, 70, 14, 4665, 11383, 1062, 2892, 4945, 8, 17, 12, 822, 8, 70, 14, 4665, 11383, 1012, 435, 413, 2298, 489, 1004, 275, 1004, 14, 10124, 342, 489, 340, 1004, 14, 2460, 7863, 358, 503, 440, 1004, 26, 267, 1980, 2541, 340, 3372, 63, 2184, 63, 604, 26, 267, 340, 3372, 63, 2184, 63, 604, 508, 283, 2759, 63, 8621, 1941, 63, 354, 356, 881, 340, 283, 3176, 63, 65, 63, 8621, 1941, 63, 354, 63, 1681, 7, 315, 1004, 26, 288, 2552, 14, 740, 14088, 3176, 63, 65, 63, 8621, 1941, 63, 354, 63, 1681, 2, 365, 440, 282, 1686, 283, 2079, 283, 8621, 1941, 536, 358, 881, 340, 4973, 6274, 14, 1989, 63, 498, 8, 604, 304, 288, 340, 289, 14, 26453, 342, 508, 4973, 6274, 59, 604, 1527, 17, 2189, 1598, 2552, 14, 740, 360, 8621, 1941, 543, 536, 2071, 83, 2, 737, 450, 83, 1004, 450, 83, 283, 1169, 283, 1989, 2575, 2757, 3247, 737, 1004, 450, 83, 7, 450, 1169, 334, 604, 12, 289, 14, 26453, 1062, 1004, 63, 1507, 12, 2490, 4973, 6274, 59, 604, 1527, 17, 2459, 288, 587, 26, 1598, 2552, 14, 740, 360, 8621, 1941, 543, 536, 2071, 83, 2, 737, 450, 83, 1004, 450, 83, 283, 1169, 283, 1989, 2575, 2757, 3247, 737, 450, 83, 1004, 450, 83, 7, 450, 1169, 334, 604, 12, 289, 14, 26453, 1062, 1004, 63, 1507, 12, 2490, 4973, 6274, 59, 604, 1527, 16, 467, 4973, 6274, 59, 604, 1527, 17, 2459, 881, 587, 26, 288, 4973, 6274, 59, 604, 61, 275, 334, 70, 12, 1004, 63, 1507, 9, 288, 1104, 63, 509, 63, 5286, 1074, 275, 715, 27, 267, 3372, 63, 2184, 63, 604, 275, 756, 267, 1980, 489, 340, 1104, 63, 509, 63, 5286, 1074, 26, 267, 340, 440, 1004, 14, 2460, 360, 14169, 1074, 23117, 881, 2552, 14, 740, 32681, 83, 2, 1077, 506, 298, 14169, 1074, 26, 11500, 315, 450, 83, 1004, 450, 83, 7, 450, 717, 334, 604, 12, 289, 14, 26453, 1062, 1004, 63, 1507, 430, 267, 1104, 63, 509, 63, 5286, 1074, 275, 756, 27, 489, 340, 1004, 508, 5041, 356, 267, 3372, 63, 2184, 63, 604, 275, 283, 2759, 63, 8621, 1941, 63, 354, 7, 267, 1980, 489, 340, 1004, 508, 298, 14169, 1074, 26, 4098, 582, 267, 3372, 63, 2184, 63, 604, 275, 283, 2759, 63, 635, 7, 267, 1980, 2541, 340, 334, 604, 14, 2460, 360, 7036, 10993, 503, 1004, 14, 2460, 360, 1113, 10993, 503, 881, 1004, 14, 2460, 360, 14169, 1074, 10993, 503, 1004, 508, 23618, 503, 881, 1004, 508, 24352, 735, 267, 1980, 489, 2552, 14, 740, 32681, 83, 2, 365, 8646, 6835, 26, 450, 83, 1004, 450, 83, 7, 450, 334, 604, 12, 289, 14, 26453, 1062, 14663, 1004, 63, 1507, 430, 523, 340, 2552, 26, 272, 372, 359, 1199, 63, 1246, 14, 30607, 547, 2258, 78, 1370, 904, 8, 2550, 10524, 523, 372, 942, 199, 199, 318, 2670, 4001, 3314, 10301, 8, 1210, 63, 1246, 12, 1072, 63, 1246, 304, 523, 372, 2670, 4001, 8, 1210, 63, 1246, 12, 1072, 63, 1246, 9, 199, 199, 318, 2670, 4001, 3314, 11421, 8, 1210, 63, 1246, 12, 1072, 63, 1246, 304, 523, 372, 2670, 4001, 8, 1210, 63, 1246, 12, 1072, 63, 1246, 9, 199, 199, 318, 2372, 29373, 12357, 51, 21868, 837, 523, 327, 2136, 2793, 1133, 1172, 1263, 7573, 1074, 308, 21868, 5966, 12, 880, 2337, 1159, 949, 675, 367, 642, 1083, 14, 523, 327, 3979, 781, 1172, 12, 314, 15494, 536, 8, 83, 9, 1077, 506, 5324, 1901, 642, 769, 14, 523, 372, 942, 199, 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, 334, 67, 9, 6029, 710, 8003, 57, 9154, 7290, 6642, 14, 2900, 4481, 4644, 14, 199, 3, 199, 3, 3645, 402, 642, 1350, 1233, 365, 10413, 701, 282, 6289, 13, 2487, 4190, 199, 3, 626, 883, 506, 1911, 315, 314, 5113, 570, 315, 314, 1738, 402, 314, 1350, 199, 3, 3123, 14, 1626, 4722, 27925, 1264, 1061, 3324, 4481, 16085, 883, 506, 1911, 199, 3, 315, 314, 570, 31467, 1309, 51, 14, 221, 2900, 5914, 4655, 2199, 11462, 1443, 199, 3, 506, 1911, 315, 314, 10610, 570, 315, 314, 1738, 402, 314, 1350, 3123, 14, 199, 199, 624, 199, 18268, 5299, 687, 16776, 1159, 2928, 15, 2537, 15, 637, 21510, 15, 5286, 1074, 15, 14956, 2533, 13965, 14, 647, 199, 199, 9295, 1455, 921, 2374, 14, 13211, 14, 1308, 15, 23826, 15, 1917, 13, 14543, 15, 27834, 2537, 15, 80, 15527, 13, 6429, 199, 509, 1655, 2436, 641, 314, 23895, 3261, 6137, 1901, 486, 429, 14, 199, 624, 199, 199, 646, 747, 199, 646, 295, 199, 646, 984, 199, 199, 318, 2670, 4001, 8, 1210, 63, 1246, 12, 1072, 63, 1246, 304, 523, 408, 11834, 314, 7573, 1074, 4973, 6274, 1584, 367, 4875, 666, 1041, 819, 327, 2654, 314, 931, 370, 314, 16776, 1139, 21510, 2935, 370, 314, 492, 931, 26, 523, 7249, 63, 10929, 63, 515, 275, 747, 14, 515, 14, 904, 8, 1210, 63, 1246, 14, 30607, 26453, 1062, 19155, 19155, 3044, 283, 637, 21510, 358, 523, 984, 14, 515, 14, 740, 8, 2537, 63, 10929, 63, 515, 9, 523, 492, 4973, 6274, 819, 1029, 63, 3821, 275, 295, 14, 2014, 360, 8621, 6274, 24736, 2424, 9988, 523, 4973, 6274, 275, 1052, 523, 2552, 275, 942, 523, 1104, 63, 509, 63, 5286, 1074, 275, 756, 523, 327, 3372, 63, 2184, 63, 604, 965, 650, 3962, 1338, 26, 523, 327, 446, 756, 26, 2793, 1133, 3372, 314, 2163, 1004, 14, 523, 327, 446, 283, 2759, 63, 8621, 1941, 63, 354, 356, 314, 2163, 1004, 365, 282, 4973, 1941, 536, 12, 3372, 14, 523, 327, 446, 283, 2759, 63, 635, 356, 314, 2163, 1004, 365, 282, 2656, 1240, 2725, 1125, 12, 3372, 14, 523, 3372, 63, 2184, 63, 604, 275, 756, 523, 367, 289, 315, 2457, 8, 2734, 671, 26, 1029, 63, 3821, 14, 1733, 8, 88, 14, 26453, 4000, 2116, 1324, 63, 1246, 14, 19256, 6201, 5535, 5109, 272, 367, 1004, 12, 1004, 63, 1507, 315, 3482, 8, 70, 14, 4665, 11383, 1062, 2892, 4945, 8, 17, 12, 822, 8, 70, 14, 4665, 11383, 1012, 435, 413, 2298, 489, 1004, 275, 1004, 14, 10124, 342, 489, 340, 1004, 14, 2460, 7863, 358, 503, 440, 1004, 26, 267, 1980, 2541, 340, 3372, 63, 2184, 63, 604, 26, 267, 340, 3372, 63, 2184, 63, 604, 508, 283, 2759, 63, 8621, 1941, 63, 354, 356, 881, 340, 283, 3176, 63, 65, 63, 8621, 1941, 63, 354, 63, 1681, 7, 315, 1004, 26, 288, 2552, 14, 740, 14088, 3176, 63, 65, 63, 8621, 1941, 63, 354, 63, 1681, 2, 365, 440, 282, 1686, 283, 2079, 283, 8621, 1941, 536, 358, 881, 340, 4973, 6274, 14, 1989, 63, 498, 8, 604, 304, 288, 340, 289, 14, 26453, 342, 508, 4973, 6274, 59, 604, 1527, 17, 2189, 1598, 2552, 14, 740, 360, 8621, 1941, 543, 536, 2071, 83, 2, 737, 450, 83, 1004, 450, 83, 283, 1169, 283, 1989, 2575, 2757, 3247, 737, 1004, 450, 83, 7, 450, 1169, 334, 604, 12, 289, 14, 26453, 1062, 1004, 63, 1507, 12, 2490, 4973, 6274, 59, 604, 1527, 17, 2459, 288, 587, 26, 1598, 2552, 14, 740, 360, 8621, 1941, 543, 536, 2071, 83, 2, 737, 450, 83, 1004, 450, 83, 283, 1169, 283, 1989, 2575, 2757, 3247, 737, 450, 83, 1004, 450, 83, 7, 450, 1169, 334, 604, 12, 289, 14, 26453, 1062, 1004, 63, 1507, 12, 2490, 4973, 6274, 59, 604, 1527, 16, 467, 4973, 6274, 59, 604, 1527, 17, 2459, 881, 587, 26, 288, 4973, 6274, 59, 604, 61, 275, 334, 70, 12, 1004, 63, 1507, 9, 288, 1104, 63, 509, 63, 5286, 1074, 275, 715, 27, 267, 3372, 63, 2184, 63, 604, 275, 756, 267, 1980, 489, 340, 1104, 63, 509, 63, 5286, 1074, 26, 267, 340, 440, 1004, 14, 2460, 360, 14169, 1074, 23117, 881, 2552, 14, 740, 32681, 83, 2, 1077, 506, 298, 14169, 1074, 26, 11500, 315, 450, 83, 1004, 450, 83, 7, 450, 717, 334, 604, 12, 289, 14, 26453, 1062, 1004, 63, 1507, 430, 267, 1104, 63, 509, 63, 5286, 1074, 275, 756, 27, 489, 340, 1004, 508, 5041, 356, 267, 3372, 63, 2184, 63, 604, 275, 283, 2759, 63, 8621, 1941, 63, 354, 7, 267, 1980, 489, 340, 1004, 508, 298, 14169, 1074, 26, 4098, 582, 267, 3372, 63, 2184, 63, 604, 275, 283, 2759, 63, 635, 7, 267, 1980, 2541, 340, 334, 604, 14, 2460, 360, 7036, 10993, 503, 1004, 14, 2460, 360, 1113, 10993, 503, 881, 1004, 14, 2460, 360, 14169, 1074, 10993, 503, 1004, 508, 23618, 503, 881, 1004, 508, 24352, 735, 267, 1980, 489, 2552, 14, 740, 32681, 83, 2, 365, 8646, 6835, 26, 450, 83, 1004, 450, 83, 7, 450, 334, 604, 12, 289, 14, 26453, 1062, 14663, 1004, 63, 1507, 430, 523, 340, 2552, 26, 272, 372, 359, 1199, 63, 1246, 14, 30607, 547, 2258, 78, 1370, 904, 8, 2550, 10524, 523, 372, 942, 199, 199, 318, 2670, 4001, 3314, 10301, 8, 1210, 63, 1246, 12, 1072, 63, 1246, 304, 523, 372, 2670, 4001, 8, 1210, 63, 1246, 12, 1072, 63, 1246, 9, 199, 199, 318, 2670, 4001, 3314, 11421, 8, 1210, 63, 1246, 12, 1072, 63, 1246, 304, 523, 372, 2670, 4001, 8, 1210, 63, 1246, 12, 1072, 63, 1246, 9, 199, 199, 318, 2372, 29373, 12357, 51, 21868, 837, 523, 327, 2136, 2793, 1133, 1172, 1263, 7573, 1074, 308, 21868, 5966, 12, 880, 2337, 1159, 949, 675, 367, 642, 1083, 14, 523, 327, 3979, 781, 1172, 12, 314, 15494, 536, 8, 83, 9, 1077, 506, 5324, 1901, 642, 769, 14, 523, 372, 942, 199, 32768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 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 ]
pathletboy/rt-thread
bsp/upd70f3454/rtconfig.py
36
2949
import os # toolchains options ARCH = 'v850' CPU = '70f34' CROSS_TOOL = 'iar' if os.getenv('RTT_CC'): CROSS_TOOL = os.getenv('RTT_CC') if CROSS_TOOL == 'gcc': print '================ERROR============================' print 'Not support gcc yet!' print '=================================================' exit(0) elif CROSS_TOOL == 'iar': PLATFORM = 'iar' IAR_PATH = 'C:/Program Files/IAR Systems/Embedded Workbench 6.0 Evaluation_0' elif CROSS_TOOL == 'keil': print '================ERROR============================' print 'Not support keil yet!' print '=================================================' exit(0) if os.getenv('RTT_EXEC_PATH'): EXEC_PATH = os.getenv('RTT_EXEC_PATH') BUILD = 'debug' if PLATFORM == 'gcc': # toolchains PREFIX = 'm32c-elf-' CC = PREFIX + 'gcc' AS = PREFIX + 'gcc' AR = PREFIX + 'ar' LINK = PREFIX + 'gcc' TARGET_EXT = 'out' SIZE = PREFIX + 'size' OBJDUMP = PREFIX + 'objdump' OBJCPY = PREFIX + 'objcopy' DEVICE = ' -mcpu=m16c' CFLAGS = DEVICE AFLAGS = ' -c' + DEVICE + ' -x assembler-with-cpp' LFLAGS = DEVICE + ' -nostartfiles' + ' -Wl,--gc-sections,-Map=rtthread_m16c.map,-cref,-u,_start -T m16c62p.ld' CPATH = '' LPATH = '' if BUILD == 'debug': CFLAGS += ' -O0 -gdwarf-2' AFLAGS += ' -gdwarf-2' else: CFLAGS += ' -O2' POST_ACTION = OBJCPY + ' -O srec $TARGET rtthread.mot\n' + SIZE + ' $TARGET \n' elif PLATFORM == 'iar': # toolchains CC = 'iccv850' AS = 'av850' AR = 'xar' LINK = 'xlink' TARGET_EXT = 'hex' DEVICE = '--cpu V850' EXEC_PATH = IAR_PATH + '/v850/bin' AFLAGS = '-s+' AFLAGS = ' -v1' # AFLAGS += ' -M<>' AFLAGS += ' -s+' AFLAGS += ' -DCODE_MODEL_NORMAL' AFLAGS += ' -DDATA_MODEL_TINY' AFLAGS += ' -w+' AFLAGS += ' -r' AFLAGS += ' -I"' + IAR_PATH + '/v850/INC"' LFLAGS = '-xms' LFLAGS += ' -I"' + IAR_PATH + '/v850/LIB"' LFLAGS += ' -rt' LFLAGS += ' -s __program_start' LFLAGS += ' -D_CSTACK_SIZE=1000' LFLAGS += ' "' + IAR_PATH + '/v850/LIB/dl85nn1.r85"' LFLAGS += ' -D_HEAP_SIZE=0' # LFLAGS += ' "' + IAR_PATH + '/v850/lib/CLIB/clm16cfnffwc.r34"' # LFLAGS += ' -e_small_write=_formatted_write' # LFLAGS += ' -e_medium_read=_formatted_read' # CFLAGS = DEVICE CFLAGS = '--diag_suppress Pa050' CFLAGS += ' -v1' CFLAGS += ' -mt' CFLAGS += ' --code_model normal' CFLAGS += ' --no_cse' CFLAGS += ' --no_unroll' CFLAGS += ' --no_inline' CFLAGS += ' --no_code_motion' CFLAGS += ' --dlib_config "' + IAR_PATH + '/v850/LIB/dl85nn1.h"' CFLAGS += ' -I"' + IAR_PATH + '/v850/INC"' CFLAGS += ' --no_tbaa' CFLAGS += ' --debug' CFLAGS += ' --lock_regs 0' CFLAGS += ' --migration_preprocessor_extensions' CFLAGS += ' -e' CFLAGS += ' -Ol' POST_ACTION = ''
gpl-2.0
[ 646, 747, 199, 199, 3, 4744, 17419, 1511, 199, 7762, 258, 275, 283, 86, 21419, 7, 199, 11011, 420, 275, 283, 2760, 70, 1082, 7, 199, 199, 28368, 63, 9731, 221, 198, 29, 283, 73, 285, 7, 199, 199, 692, 747, 14, 12959, 360, 50, 1481, 63, 2571, 735, 199, 198, 28368, 63, 9731, 275, 747, 14, 12959, 360, 50, 1481, 63, 2571, 358, 199, 199, 692, 221, 445, 23264, 63, 9731, 508, 283, 13112, 356, 272, 870, 283, 1280, 3170, 1280, 5769, 7, 272, 870, 283, 1763, 2291, 19443, 5966, 11213, 272, 870, 283, 12813, 534, 272, 4458, 8, 16, 9, 199, 4164, 445, 23264, 63, 9731, 508, 283, 73, 285, 356, 199, 198, 17805, 221, 198, 29, 283, 73, 285, 7, 199, 198, 41, 689, 63, 3243, 275, 283, 35, 11254, 9184, 16920, 15, 41, 689, 15285, 15, 27395, 9361, 16571, 1227, 14, 16, 16494, 4086, 63, 16, 7, 199, 4164, 445, 23264, 63, 9731, 508, 283, 415, 382, 356, 272, 870, 283, 1280, 3170, 1280, 5769, 7, 272, 870, 283, 1763, 2291, 10074, 382, 5966, 11213, 272, 870, 283, 12813, 534, 272, 4458, 8, 16, 9, 199, 199, 692, 747, 14, 12959, 360, 50, 1481, 63, 10276, 63, 3243, 735, 199, 198, 10276, 63, 3243, 275, 747, 14, 12959, 360, 50, 1481, 63, 10276, 63, 3243, 358, 199, 199, 8248, 275, 283, 1757, 7, 199, 199, 692, 21966, 508, 283, 13112, 356, 272, 327, 4744, 17419, 272, 27884, 275, 283, 77, 708, 67, 13, 25371, 15668, 272, 17586, 275, 27884, 435, 283, 13112, 7, 272, 4319, 275, 27884, 435, 283, 13112, 7, 272, 4160, 275, 27884, 435, 283, 285, 7, 272, 19774, 275, 27884, 435, 283, 13112, 7, 272, 26134, 63, 2472, 275, 283, 548, 7, 272, 32289, 275, 27884, 435, 283, 890, 7, 272, 593, 16262, 26406, 275, 27884, 435, 283, 1113, 2724, 7, 272, 593, 16262, 2890, 57, 275, 27884, 435, 283, 1113, 1574, 7, 339, 11643, 275, 283, 446, 77, 3541, 29, 77, 975, 67, 7, 272, 25149, 275, 11643, 272, 437, 4831, 275, 283, 446, 67, 7, 435, 11643, 435, 283, 446, 88, 22931, 82, 13, 1045, 13, 5910, 7, 272, 491, 4831, 275, 11643, 435, 283, 446, 889, 928, 1725, 7, 435, 283, 446, 16239, 28925, 9493, 13, 7786, 3057, 2956, 29, 2591, 2671, 63, 77, 975, 67, 14, 1130, 3057, 67, 1121, 3057, 85, 16987, 928, 446, 52, 333, 975, 67, 2789, 80, 14, 1447, 7, 339, 445, 3243, 275, 2125, 272, 491, 3243, 275, 2125, 339, 340, 22974, 508, 283, 1757, 356, 267, 25149, 847, 283, 446, 47, 16, 446, 7136, 3281, 70, 13, 18, 7, 267, 437, 4831, 847, 283, 446, 7136, 3281, 70, 13, 18, 7, 272, 587, 26, 267, 25149, 847, 283, 446, 47, 18, 7, 339, 8761, 63, 10052, 275, 593, 16262, 2890, 57, 435, 283, 446, 47, 308, 2761, 2672, 9268, 14059, 2671, 14, 30034, 60, 78, 7, 435, 32289, 435, 283, 2672, 9268, 971, 78, 7, 199, 199, 4164, 21966, 508, 283, 73, 285, 356, 272, 327, 4744, 17419, 272, 17586, 275, 283, 530, 5107, 21419, 7, 272, 4319, 275, 283, 1214, 21419, 7, 272, 4160, 275, 283, 88, 285, 7, 272, 19774, 275, 283, 24085, 7, 272, 26134, 63, 2472, 275, 283, 4097, 7, 339, 11643, 275, 2850, 3541, 812, 21419, 7, 339, 3651, 4220, 63, 3243, 275, 473, 689, 63, 3243, 435, 1994, 86, 21419, 15, 1393, 7, 339, 437, 4831, 275, 2475, 83, 4786, 272, 437, 4831, 275, 283, 446, 86, 17, 7, 199, 3, 259, 437, 4831, 847, 283, 446, 45, 28, 3524, 5591, 437, 4831, 847, 283, 446, 83, 4786, 5591, 437, 4831, 847, 283, 446, 36, 6012, 63, 11429, 63, 10765, 7, 5591, 437, 4831, 847, 283, 446, 36, 3998, 63, 11429, 63, 31178, 7, 272, 437, 4831, 847, 283, 446, 87, 4786, 272, 437, 4831, 847, 283, 446, 82, 7, 272, 437, 4831, 847, 283, 446, 41, 4507, 435, 473, 689, 63, 3243, 435, 1994, 86, 21419, 15, 25205, 4507, 339, 491, 4831, 275, 2475, 88, 706, 7, 272, 491, 4831, 847, 283, 446, 41, 4507, 435, 473, 689, 63, 3243, 435, 1994, 86, 21419, 15, 5617, 4507, 5591, 491, 4831, 847, 283, 446, 2591, 7, 5591, 491, 4831, 847, 283, 446, 83, 636, 6815, 63, 928, 7, 5591, 491, 4831, 847, 283, 446, 36, 63, 35, 17014, 63, 4305, 29, 5279, 7, 5591, 491, 4831, 847, 283, 3546, 435, 473, 689, 63, 3243, 435, 1994, 86, 21419, 15, 5617, 15, 5030, 2426, 4411, 17, 14, 82, 2426, 4507, 272, 491, 4831, 847, 283, 446, 36, 63, 23707, 63, 4305, 29, 16, 7, 9948, 199, 3, 259, 491, 4831, 847, 283, 3546, 435, 473, 689, 63, 3243, 435, 1994, 86, 21419, 15, 773, 15, 1981, 2100, 15, 429, 77, 975, 2177, 78, 556, 13683, 14, 82, 1082, 4507, 221, 199, 3, 257, 491, 4831, 847, 283, 446, 69, 63, 7241, 63, 952, 3699, 15317, 63, 952, 7, 221, 199, 3, 259, 491, 4831, 847, 283, 446, 69, 63, 14345, 63, 739, 3699, 15317, 63, 739, 7, 199, 199, 3, 259, 25149, 275, 11643, 272, 25149, 275, 2850, 6706, 63, 17381, 10164, 24742, 7, 272, 25149, 847, 283, 446, 86, 17, 7, 5591, 25149, 847, 283, 446, 2037, 7, 5591, 25149, 847, 283, 1553, 600, 63, 1238, 3293, 7, 5591, 25149, 847, 283, 1553, 889, 63, 67, 261, 7, 5591, 25149, 847, 283, 1553, 889, 63, 324, 2827, 7, 5591, 25149, 847, 283, 1553, 889, 63, 6460, 7, 5591, 25149, 847, 283, 1553, 889, 63, 600, 63, 15335, 7, 5591, 25149, 847, 283, 1553, 68, 773, 63, 888, 3546, 435, 473, 689, 63, 3243, 435, 1994, 86, 21419, 15, 5617, 15, 5030, 2426, 4411, 17, 14, 72, 4507, 272, 25149, 847, 283, 446, 41, 4507, 435, 473, 689, 63, 3243, 435, 1994, 86, 21419, 15, 25205, 4507, 272, 25149, 847, 283, 1553, 889, 63, 5842, 2158, 7, 5591, 25149, 847, 283, 1553, 1757, 7, 5591, 25149, 847, 283, 1553, 831, 63, 23957, 378, 7, 5591, 25149, 847, 283, 1553, 8998, 63, 657, 6459, 63, 5359, 7, 5591, 25149, 847, 283, 446, 69, 7, 5591, 25149, 847, 283, 446, 47, 76, 7, 339 ]
[ 747, 199, 199, 3, 4744, 17419, 1511, 199, 7762, 258, 275, 283, 86, 21419, 7, 199, 11011, 420, 275, 283, 2760, 70, 1082, 7, 199, 199, 28368, 63, 9731, 221, 198, 29, 283, 73, 285, 7, 199, 199, 692, 747, 14, 12959, 360, 50, 1481, 63, 2571, 735, 199, 198, 28368, 63, 9731, 275, 747, 14, 12959, 360, 50, 1481, 63, 2571, 358, 199, 199, 692, 221, 445, 23264, 63, 9731, 508, 283, 13112, 356, 272, 870, 283, 1280, 3170, 1280, 5769, 7, 272, 870, 283, 1763, 2291, 19443, 5966, 11213, 272, 870, 283, 12813, 534, 272, 4458, 8, 16, 9, 199, 4164, 445, 23264, 63, 9731, 508, 283, 73, 285, 356, 199, 198, 17805, 221, 198, 29, 283, 73, 285, 7, 199, 198, 41, 689, 63, 3243, 275, 283, 35, 11254, 9184, 16920, 15, 41, 689, 15285, 15, 27395, 9361, 16571, 1227, 14, 16, 16494, 4086, 63, 16, 7, 199, 4164, 445, 23264, 63, 9731, 508, 283, 415, 382, 356, 272, 870, 283, 1280, 3170, 1280, 5769, 7, 272, 870, 283, 1763, 2291, 10074, 382, 5966, 11213, 272, 870, 283, 12813, 534, 272, 4458, 8, 16, 9, 199, 199, 692, 747, 14, 12959, 360, 50, 1481, 63, 10276, 63, 3243, 735, 199, 198, 10276, 63, 3243, 275, 747, 14, 12959, 360, 50, 1481, 63, 10276, 63, 3243, 358, 199, 199, 8248, 275, 283, 1757, 7, 199, 199, 692, 21966, 508, 283, 13112, 356, 272, 327, 4744, 17419, 272, 27884, 275, 283, 77, 708, 67, 13, 25371, 15668, 272, 17586, 275, 27884, 435, 283, 13112, 7, 272, 4319, 275, 27884, 435, 283, 13112, 7, 272, 4160, 275, 27884, 435, 283, 285, 7, 272, 19774, 275, 27884, 435, 283, 13112, 7, 272, 26134, 63, 2472, 275, 283, 548, 7, 272, 32289, 275, 27884, 435, 283, 890, 7, 272, 593, 16262, 26406, 275, 27884, 435, 283, 1113, 2724, 7, 272, 593, 16262, 2890, 57, 275, 27884, 435, 283, 1113, 1574, 7, 339, 11643, 275, 283, 446, 77, 3541, 29, 77, 975, 67, 7, 272, 25149, 275, 11643, 272, 437, 4831, 275, 283, 446, 67, 7, 435, 11643, 435, 283, 446, 88, 22931, 82, 13, 1045, 13, 5910, 7, 272, 491, 4831, 275, 11643, 435, 283, 446, 889, 928, 1725, 7, 435, 283, 446, 16239, 28925, 9493, 13, 7786, 3057, 2956, 29, 2591, 2671, 63, 77, 975, 67, 14, 1130, 3057, 67, 1121, 3057, 85, 16987, 928, 446, 52, 333, 975, 67, 2789, 80, 14, 1447, 7, 339, 445, 3243, 275, 2125, 272, 491, 3243, 275, 2125, 339, 340, 22974, 508, 283, 1757, 356, 267, 25149, 847, 283, 446, 47, 16, 446, 7136, 3281, 70, 13, 18, 7, 267, 437, 4831, 847, 283, 446, 7136, 3281, 70, 13, 18, 7, 272, 587, 26, 267, 25149, 847, 283, 446, 47, 18, 7, 339, 8761, 63, 10052, 275, 593, 16262, 2890, 57, 435, 283, 446, 47, 308, 2761, 2672, 9268, 14059, 2671, 14, 30034, 60, 78, 7, 435, 32289, 435, 283, 2672, 9268, 971, 78, 7, 199, 199, 4164, 21966, 508, 283, 73, 285, 356, 272, 327, 4744, 17419, 272, 17586, 275, 283, 530, 5107, 21419, 7, 272, 4319, 275, 283, 1214, 21419, 7, 272, 4160, 275, 283, 88, 285, 7, 272, 19774, 275, 283, 24085, 7, 272, 26134, 63, 2472, 275, 283, 4097, 7, 339, 11643, 275, 2850, 3541, 812, 21419, 7, 339, 3651, 4220, 63, 3243, 275, 473, 689, 63, 3243, 435, 1994, 86, 21419, 15, 1393, 7, 339, 437, 4831, 275, 2475, 83, 4786, 272, 437, 4831, 275, 283, 446, 86, 17, 7, 199, 3, 259, 437, 4831, 847, 283, 446, 45, 28, 3524, 5591, 437, 4831, 847, 283, 446, 83, 4786, 5591, 437, 4831, 847, 283, 446, 36, 6012, 63, 11429, 63, 10765, 7, 5591, 437, 4831, 847, 283, 446, 36, 3998, 63, 11429, 63, 31178, 7, 272, 437, 4831, 847, 283, 446, 87, 4786, 272, 437, 4831, 847, 283, 446, 82, 7, 272, 437, 4831, 847, 283, 446, 41, 4507, 435, 473, 689, 63, 3243, 435, 1994, 86, 21419, 15, 25205, 4507, 339, 491, 4831, 275, 2475, 88, 706, 7, 272, 491, 4831, 847, 283, 446, 41, 4507, 435, 473, 689, 63, 3243, 435, 1994, 86, 21419, 15, 5617, 4507, 5591, 491, 4831, 847, 283, 446, 2591, 7, 5591, 491, 4831, 847, 283, 446, 83, 636, 6815, 63, 928, 7, 5591, 491, 4831, 847, 283, 446, 36, 63, 35, 17014, 63, 4305, 29, 5279, 7, 5591, 491, 4831, 847, 283, 3546, 435, 473, 689, 63, 3243, 435, 1994, 86, 21419, 15, 5617, 15, 5030, 2426, 4411, 17, 14, 82, 2426, 4507, 272, 491, 4831, 847, 283, 446, 36, 63, 23707, 63, 4305, 29, 16, 7, 9948, 199, 3, 259, 491, 4831, 847, 283, 3546, 435, 473, 689, 63, 3243, 435, 1994, 86, 21419, 15, 773, 15, 1981, 2100, 15, 429, 77, 975, 2177, 78, 556, 13683, 14, 82, 1082, 4507, 221, 199, 3, 257, 491, 4831, 847, 283, 446, 69, 63, 7241, 63, 952, 3699, 15317, 63, 952, 7, 221, 199, 3, 259, 491, 4831, 847, 283, 446, 69, 63, 14345, 63, 739, 3699, 15317, 63, 739, 7, 199, 199, 3, 259, 25149, 275, 11643, 272, 25149, 275, 2850, 6706, 63, 17381, 10164, 24742, 7, 272, 25149, 847, 283, 446, 86, 17, 7, 5591, 25149, 847, 283, 446, 2037, 7, 5591, 25149, 847, 283, 1553, 600, 63, 1238, 3293, 7, 5591, 25149, 847, 283, 1553, 889, 63, 67, 261, 7, 5591, 25149, 847, 283, 1553, 889, 63, 324, 2827, 7, 5591, 25149, 847, 283, 1553, 889, 63, 6460, 7, 5591, 25149, 847, 283, 1553, 889, 63, 600, 63, 15335, 7, 5591, 25149, 847, 283, 1553, 68, 773, 63, 888, 3546, 435, 473, 689, 63, 3243, 435, 1994, 86, 21419, 15, 5617, 15, 5030, 2426, 4411, 17, 14, 72, 4507, 272, 25149, 847, 283, 446, 41, 4507, 435, 473, 689, 63, 3243, 435, 1994, 86, 21419, 15, 25205, 4507, 272, 25149, 847, 283, 1553, 889, 63, 5842, 2158, 7, 5591, 25149, 847, 283, 1553, 1757, 7, 5591, 25149, 847, 283, 1553, 831, 63, 23957, 378, 7, 5591, 25149, 847, 283, 1553, 8998, 63, 657, 6459, 63, 5359, 7, 5591, 25149, 847, 283, 446, 69, 7, 5591, 25149, 847, 283, 446, 47, 76, 7, 339, 0 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 ]
Sorsly/subtle
google-cloud-sdk/platform/gsutil/third_party/boto/tests/integration/opsworks/test_layer1.py
114
2121
# Copyright (c) 2013 Amazon.com, Inc. or its affiliates. All Rights Reserved # # Permission is hereby granted, free of charge, to any person obtaining a # copy of this software and associated documentation files (the # "Software"), to deal in the Software without restriction, including # without limitation the rights to use, copy, modify, merge, publish, dis- # tribute, sublicense, and/or sell copies of the Software, and to permit # persons to whom the Software is furnished to do so, subject to the fol- # lowing conditions: # # The above copyright notice and this permission notice shall be included # in all copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS # OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABIL- # ITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT # SHALL THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, # WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS # IN THE SOFTWARE. # from boto.exception import JSONResponseError from boto.opsworks import connect_to_region, regions, RegionInfo from boto.opsworks.layer1 import OpsWorksConnection from tests.compat import unittest class TestOpsWorksConnection(unittest.TestCase): opsworks = True def setUp(self): self.api = OpsWorksConnection() def test_describe_stacks(self): response = self.api.describe_stacks() self.assertIn('Stacks', response) def test_validation_errors(self): with self.assertRaises(JSONResponseError): self.api.create_stack('testbotostack', 'us-east-1', 'badarn', 'badarn2') class TestOpsWorksHelpers(unittest.TestCase): opsworks = True def test_regions(self): response = regions() self.assertIsInstance(response[0], RegionInfo) def test_connect_to_region(self): connection = connect_to_region('us-east-1') self.assertIsInstance(connection, OpsWorksConnection)
mit
[ 3, 1898, 334, 67, 9, 6171, 14347, 14, 957, 12, 3277, 14, 503, 2399, 29172, 2335, 14, 221, 2900, 5924, 5702, 199, 3, 199, 3, 8779, 365, 11882, 10009, 12, 2867, 402, 11204, 12, 370, 1263, 4954, 12408, 282, 199, 3, 1331, 402, 642, 2032, 436, 4568, 3794, 1584, 334, 1589, 199, 3, 298, 10337, 1288, 370, 7962, 315, 314, 2290, 1928, 10588, 12, 5893, 199, 3, 1928, 12305, 314, 4481, 370, 675, 12, 1331, 12, 2811, 12, 5389, 12, 2780, 12, 2153, 13, 199, 3, 28420, 12, 13473, 12, 436, 15, 269, 12743, 6866, 402, 314, 2290, 12, 436, 370, 11291, 199, 3, 12103, 370, 12676, 314, 2290, 365, 13985, 370, 886, 880, 12, 5420, 370, 314, 1699, 13, 199, 3, 28486, 3704, 26, 199, 3, 199, 3, 710, 3432, 4248, 4245, 436, 642, 4983, 4245, 10989, 506, 5120, 199, 3, 315, 1006, 6866, 503, 13393, 12468, 402, 314, 2290, 14, 199, 3, 199, 3, 2334, 4141, 2281, 7049, 298, 1179, 2281, 401, 2428, 3408, 1634, 1821, 3826, 12, 7168, 199, 3, 1549, 5292, 12, 6931, 5400, 2845, 5471, 2296, 2334, 2990, 1634, 28471, 13, 199, 3, 28463, 12, 3092, 2381, 437, 3115, 3104, 2401, 13229, 14, 1621, 4825, 6461, 199, 3, 7000, 2334, 17632, 6262, 7024, 2381, 1821, 13140, 12, 6736, 1549, 5010, 5603, 12, 199, 3, 7061, 1621, 1261, 9612, 1634, 7066, 12, 7056, 1549, 7334, 12, 7043, 4442, 12, 199, 3, 5738, 1634, 1549, 1621, 11287, 1663, 2334, 4141, 1549, 2334, 4815, 1549, 5010, 13198, 199, 3, 1621, 2334, 4141, 14, 199, 3, 199, 199, 504, 6055, 14, 1971, 492, 4840, 19712, 199, 504, 6055, 14, 1483, 12243, 492, 4907, 63, 475, 63, 4551, 12, 16150, 12, 22240, 2354, 199, 504, 6055, 14, 1483, 12243, 14, 1897, 17, 492, 593, 1190, 25348, 3225, 199, 504, 2295, 14, 5819, 492, 2882, 421, 199, 533, 1379, 16452, 25348, 3225, 8, 2796, 14, 1746, 304, 272, 4156, 12243, 275, 715, 339, 347, 3613, 8, 277, 304, 267, 291, 14, 1246, 275, 593, 1190, 25348, 3225, 342, 339, 347, 511, 63, 11935, 63, 21707, 8, 277, 304, 267, 1177, 275, 291, 14, 1246, 14, 11935, 63, 21707, 342, 267, 291, 14, 4080, 360, 4851, 83, 297, 1177, 9, 339, 347, 511, 63, 6136, 63, 2550, 8, 277, 304, 267, 543, 291, 14, 1855, 8, 6243, 19712, 304, 288, 291, 14, 1246, 14, 981, 63, 2340, 360, 396, 3018, 941, 564, 297, 283, 527, 13, 14346, 13, 17, 297, 3303, 283, 4087, 1060, 297, 283, 4087, 1060, 18, 358, 421, 199, 533, 1379, 16452, 25348, 4433, 83, 8, 2796, 14, 1746, 304, 272, 4156, 12243, 275, 715, 339, 347, 511, 63, 11963, 8, 277, 304, 267, 1177, 275, 16150, 342, 267, 291, 14, 6926, 8, 1310, 59, 16, 467, 22240, 2354, 9, 339, 347, 511, 63, 2242, 63, 475, 63, 4551, 8, 277, 304, 267, 1950, 275, 4907, 63, 475, 63, 4551, 360, 527, 13, 14346, 13, 17, 358, 267, 291, 14, 6926, 8, 2105, 12, 593, 1190, 25348, 3225, 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 ]
[ 1898, 334, 67, 9, 6171, 14347, 14, 957, 12, 3277, 14, 503, 2399, 29172, 2335, 14, 221, 2900, 5924, 5702, 199, 3, 199, 3, 8779, 365, 11882, 10009, 12, 2867, 402, 11204, 12, 370, 1263, 4954, 12408, 282, 199, 3, 1331, 402, 642, 2032, 436, 4568, 3794, 1584, 334, 1589, 199, 3, 298, 10337, 1288, 370, 7962, 315, 314, 2290, 1928, 10588, 12, 5893, 199, 3, 1928, 12305, 314, 4481, 370, 675, 12, 1331, 12, 2811, 12, 5389, 12, 2780, 12, 2153, 13, 199, 3, 28420, 12, 13473, 12, 436, 15, 269, 12743, 6866, 402, 314, 2290, 12, 436, 370, 11291, 199, 3, 12103, 370, 12676, 314, 2290, 365, 13985, 370, 886, 880, 12, 5420, 370, 314, 1699, 13, 199, 3, 28486, 3704, 26, 199, 3, 199, 3, 710, 3432, 4248, 4245, 436, 642, 4983, 4245, 10989, 506, 5120, 199, 3, 315, 1006, 6866, 503, 13393, 12468, 402, 314, 2290, 14, 199, 3, 199, 3, 2334, 4141, 2281, 7049, 298, 1179, 2281, 401, 2428, 3408, 1634, 1821, 3826, 12, 7168, 199, 3, 1549, 5292, 12, 6931, 5400, 2845, 5471, 2296, 2334, 2990, 1634, 28471, 13, 199, 3, 28463, 12, 3092, 2381, 437, 3115, 3104, 2401, 13229, 14, 1621, 4825, 6461, 199, 3, 7000, 2334, 17632, 6262, 7024, 2381, 1821, 13140, 12, 6736, 1549, 5010, 5603, 12, 199, 3, 7061, 1621, 1261, 9612, 1634, 7066, 12, 7056, 1549, 7334, 12, 7043, 4442, 12, 199, 3, 5738, 1634, 1549, 1621, 11287, 1663, 2334, 4141, 1549, 2334, 4815, 1549, 5010, 13198, 199, 3, 1621, 2334, 4141, 14, 199, 3, 199, 199, 504, 6055, 14, 1971, 492, 4840, 19712, 199, 504, 6055, 14, 1483, 12243, 492, 4907, 63, 475, 63, 4551, 12, 16150, 12, 22240, 2354, 199, 504, 6055, 14, 1483, 12243, 14, 1897, 17, 492, 593, 1190, 25348, 3225, 199, 504, 2295, 14, 5819, 492, 2882, 421, 199, 533, 1379, 16452, 25348, 3225, 8, 2796, 14, 1746, 304, 272, 4156, 12243, 275, 715, 339, 347, 3613, 8, 277, 304, 267, 291, 14, 1246, 275, 593, 1190, 25348, 3225, 342, 339, 347, 511, 63, 11935, 63, 21707, 8, 277, 304, 267, 1177, 275, 291, 14, 1246, 14, 11935, 63, 21707, 342, 267, 291, 14, 4080, 360, 4851, 83, 297, 1177, 9, 339, 347, 511, 63, 6136, 63, 2550, 8, 277, 304, 267, 543, 291, 14, 1855, 8, 6243, 19712, 304, 288, 291, 14, 1246, 14, 981, 63, 2340, 360, 396, 3018, 941, 564, 297, 283, 527, 13, 14346, 13, 17, 297, 3303, 283, 4087, 1060, 297, 283, 4087, 1060, 18, 358, 421, 199, 533, 1379, 16452, 25348, 4433, 83, 8, 2796, 14, 1746, 304, 272, 4156, 12243, 275, 715, 339, 347, 511, 63, 11963, 8, 277, 304, 267, 1177, 275, 16150, 342, 267, 291, 14, 6926, 8, 1310, 59, 16, 467, 22240, 2354, 9, 339, 347, 511, 63, 2242, 63, 475, 63, 4551, 8, 277, 304, 267, 1950, 275, 4907, 63, 475, 63, 4551, 360, 527, 13, 14346, 13, 17, 358, 267, 291, 14, 6926, 8, 2105, 12, 593, 1190, 25348, 3225, 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, 0 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
sumeetsk/NEXT-1
apps/DuelingBanditsPureExploration/tests/test_api.py
1
5422
import numpy import numpy as np import numpy.random import random import json import time from datetime import datetime import requests from scipy.linalg import norm import time from multiprocessing import Pool import os import sys try: import next.apps.test_utils as test_utils except: sys.path.append('../../../next/apps') import test_utils def test_validation_params(): params = [{'num_tries': 5}, {'query_list': [[0, 1], [1, 2], [3, 4]]}] for param in params: print(param) test_api(params=param) def test_api(assert_200=True, num_arms=5, num_clients=8, delta=0.05, total_pulls_per_client=5, num_experiments=1, params={'num_tries': 5}): app_id = 'DuelingBanditsPureExploration' true_means = numpy.array(range(num_arms)[::-1])/float(num_arms) pool = Pool(processes=num_clients) supported_alg_ids = ['BR_LilUCB', 'BR_Random', 'ValidationSampling'] alg_list = [] for i, alg_id in enumerate(supported_alg_ids): alg_item = {} if alg_id == 'ValidationSampling': alg_item['params'] = params alg_item['alg_id'] = alg_id alg_item['alg_label'] = alg_id+'_'+str(i) alg_list.append(alg_item) params = [] for algorithm in alg_list: params.append({'alg_label': algorithm['alg_label'], 'proportion':1./len(alg_list)}) algorithm_management_settings = {} algorithm_management_settings['mode'] = 'fixed_proportions' algorithm_management_settings['params'] = params print algorithm_management_settings ################################################# # Test POST Experiment ################################################# initExp_args_dict = {} initExp_args_dict['args'] = {'alg_list': alg_list, 'algorithm_management_settings': algorithm_management_settings, 'context': 'Context for Dueling Bandits', 'context_type': 'text', 'debrief': 'Test debried.', 'failure_probability': 0.05, 'instructions': 'Test instructions.', 'participant_to_algorithm_management': 'one_to_many', 'targets': {'n': num_arms}} initExp_args_dict['app_id'] = app_id initExp_args_dict['site_id'] = 'replace this with working site id' initExp_args_dict['site_key'] = 'replace this with working site key' exp_info = [] for ell in range(num_experiments): exp_info += [test_utils.initExp(initExp_args_dict)[1]] # Generate participants participants = [] pool_args = [] for i in range(num_clients): participant_uid = '%030x' % random.randrange(16**30) participants.append(participant_uid) experiment = numpy.random.choice(exp_info) exp_uid = experiment['exp_uid'] pool_args.append((exp_uid, participant_uid, total_pulls_per_client, true_means,assert_200)) results = pool.map(simulate_one_client, pool_args) for result in results: result test_utils.getModel(exp_uid, app_id, supported_alg_ids, alg_list) def simulate_one_client(input_args): exp_uid,participant_uid,total_pulls,true_means,assert_200 = input_args getQuery_times = [] processAnswer_times = [] for t in range(total_pulls): print " Participant {} had {} total pulls: ".format(participant_uid, t) # test POST getQuery # # return a widget 1/5 of the time (normally, use HTML) widget = random.choice([True] + 4*[False]) getQuery_args_dict = {'args': {'participant_uid': participant_uid, 'widget': widget}, 'exp_uid': exp_uid} query_dict, dt = test_utils.getQuery(getQuery_args_dict) getQuery_times.append(dt) if widget: query_dict = query_dict['args'] query_uid = query_dict['query_uid'] targets = query_dict['target_indices'] left = targets[0]['target'] right = targets[1]['target'] # sleep for a bit to simulate response time ts = test_utils.response_delay() # print left reward_left = true_means[left['target_id']] + numpy.random.randn()*0.5 reward_right = true_means[right['target_id']] + numpy.random.randn()*0.5 if reward_left > reward_right: target_winner = left else: target_winner = right response_time = time.time() - ts # test POST processAnswer processAnswer_args_dict = {'args': {'query_uid': query_uid, 'response_time': response_time, 'target_winner': target_winner["target_id"]}, 'exp_uid': exp_uid} processAnswer_json_response, dt = test_utils.processAnswer(processAnswer_args_dict) processAnswer_times += [dt] r = test_utils.format_times(getQuery_times, processAnswer_times, total_pulls, participant_uid) return r if __name__ == '__main__': test_api() # test_api(assert_200=True, num_arms=5, num_clients=10, delta=0.05, # total_pulls_per_client=10, num_experiments=1)
apache-2.0
[ 646, 2680, 199, 646, 2680, 465, 980, 199, 646, 2680, 14, 2355, 199, 646, 2196, 199, 646, 2022, 199, 646, 900, 199, 504, 2197, 492, 2197, 199, 646, 4145, 199, 504, 7026, 14, 10096, 492, 6316, 199, 646, 900, 199, 504, 12866, 492, 15553, 199, 646, 747, 199, 646, 984, 199, 893, 26, 272, 492, 2163, 14, 5181, 14, 396, 63, 1208, 465, 511, 63, 1208, 199, 2590, 26, 272, 984, 14, 515, 14, 740, 360, 29866, 2184, 15, 5181, 358, 272, 492, 511, 63, 1208, 421, 199, 318, 511, 63, 6136, 63, 1162, 837, 272, 1862, 275, 9016, 1507, 63, 6264, 356, 959, 1386, 1598, 791, 1131, 63, 513, 356, 3474, 16, 12, 413, 467, 359, 17, 12, 499, 467, 359, 19, 12, 841, 2677, 11049, 272, 367, 1215, 315, 1862, 26, 267, 870, 8, 635, 9, 267, 511, 63, 1246, 8, 1162, 29, 635, 9, 421, 199, 318, 511, 63, 1246, 8, 479, 63, 1840, 29, 549, 12, 1967, 63, 25005, 29, 21, 12, 1967, 63, 14555, 29, 24, 12, 5762, 29, 16, 14, 1717, 12, 1467, 3141, 63, 80, 13072, 63, 529, 63, 1258, 29, 21, 12, 1967, 63, 476, 22263, 29, 17, 12, 1467, 1862, 3713, 1507, 63, 6264, 356, 959, 22558, 339, 1145, 63, 344, 275, 283, 36, 310, 2983, 28018, 15256, 28928, 920, 18361, 7, 272, 2549, 63, 11579, 275, 2680, 14, 1144, 8, 1842, 8, 1507, 63, 25005, 2788, 21123, 17, 23067, 1609, 8, 1507, 63, 25005, 9, 272, 4203, 275, 15553, 8, 11816, 29, 1507, 63, 14555, 9, 272, 3748, 63, 6731, 63, 1580, 275, 788, 7184, 63, 44, 382, 53, 9956, 297, 283, 7184, 63, 3883, 297, 283, 13816, 12226, 8922, 418, 339, 15760, 63, 513, 275, 942, 272, 367, 284, 12, 15760, 63, 344, 315, 3874, 8, 4946, 63, 6731, 63, 1580, 304, 267, 15760, 63, 1053, 275, 1052, 267, 340, 15760, 63, 344, 508, 283, 13816, 12226, 8922, 356, 288, 15760, 63, 1053, 459, 1162, 418, 275, 1862, 267, 15760, 63, 1053, 459, 6731, 63, 344, 418, 275, 15760, 63, 344, 267, 15760, 63, 1053, 459, 6731, 63, 1302, 418, 275, 15760, 63, 344, 4786, 20013, 495, 8, 73, 9, 267, 15760, 63, 513, 14, 740, 8, 6731, 63, 1053, 9, 339, 1862, 275, 942, 272, 367, 5563, 315, 15760, 63, 513, 26, 267, 1862, 14, 740, 3252, 6731, 63, 1302, 356, 5563, 459, 6731, 63, 1302, 995, 283, 4469, 15029, 356, 17, 13186, 552, 8, 6731, 63, 513, 11466, 272, 5563, 63, 8110, 63, 1751, 275, 1052, 272, 5563, 63, 8110, 63, 1751, 459, 632, 418, 275, 283, 5964, 63, 4469, 18434, 7, 272, 5563, 63, 8110, 63, 1751, 459, 1162, 418, 275, 1862, 339, 870, 5563, 63, 8110, 63, 1751, 339, 20286, 3, 272, 327, 1379, 8761, 23997, 272, 20286, 3, 272, 4205, 4527, 63, 589, 63, 807, 275, 1052, 272, 4205, 4527, 63, 589, 63, 807, 459, 589, 418, 275, 791, 6731, 63, 513, 356, 15760, 63, 513, 12, 639, 283, 8833, 63, 8110, 63, 1751, 356, 5563, 63, 8110, 63, 1751, 12, 639, 283, 1100, 356, 283, 2998, 367, 25855, 2983, 699, 290, 15256, 297, 639, 283, 1100, 63, 466, 356, 283, 505, 297, 639, 283, 271, 19127, 356, 283, 774, 477, 9660, 379, 3130, 639, 283, 5328, 63, 17210, 356, 378, 14, 1717, 12, 639, 283, 20718, 356, 283, 774, 15794, 3130, 639, 283, 29253, 63, 475, 63, 8833, 63, 8110, 356, 283, 368, 63, 475, 63, 3479, 297, 639, 283, 4684, 356, 791, 78, 356, 1967, 63, 25005, 4863, 339, 4205, 4527, 63, 589, 63, 807, 459, 571, 63, 344, 418, 275, 1145, 63, 344, 272, 4205, 4527, 63, 589, 63, 807, 459, 2124, 63, 344, 418, 275, 283, 1814, 642, 543, 6449, 4770, 1305, 7, 272, 4205, 4527, 63, 589, 63, 807, 459, 2124, 63, 498, 418, 275, 283, 1814, 642, 543, 6449, 4770, 790, 7, 339, 1437, 63, 815, 275, 942, 272, 367, 579, 76, 315, 1425, 8, 1507, 63, 476, 22263, 304, 267, 1437, 63, 815, 847, 359, 396, 63, 1208, 14, 826, 4527, 8, 826, 4527, 63, 589, 63, 807, 2788, 17, 2677, 339, 327, 7958, 623, 20989, 272, 623, 20989, 275, 942, 272, 4203, 63, 589, 275, 942, 272, 367, 284, 315, 1425, 8, 1507, 63, 14555, 304, 267, 623, 16448, 63, 1535, 275, 1543, 22739, 88, 7, 450, 2196, 14, 20539, 8, 975, 538, 1216, 9, 267, 623, 20989, 14, 740, 8, 29253, 63, 1535, 9, 398, 11805, 275, 2680, 14, 2355, 14, 5095, 8, 1474, 63, 815, 9, 267, 1437, 63, 1535, 275, 11805, 459, 1474, 63, 1535, 418, 267, 4203, 63, 589, 14, 740, 1332, 1474, 63, 1535, 12, 623, 16448, 63, 1535, 12, 3141, 63, 80, 13072, 63, 529, 63, 1258, 12, 2079, 2549, 63, 11579, 12, 479, 63, 1840, 430, 339, 2058, 275, 4203, 14, 1130, 8, 28689, 63, 368, 63, 1258, 12, 4203, 63, 589, 9, 339, 367, 754, 315, 2058, 26, 267, 754, 339, 511, 63, 1208, 14, 362, 1685, 8, 1474, 63, 1535, 12, 1145, 63, 344, 12, 3748, 63, 6731, 63, 1580, 12, 15760, 63, 513, 9, 199, 199, 318, 20577, 63, 368, 63, 1258, 8, 1210, 63, 589, 304, 272, 1437, 63, 1535, 12, 29253, 63, 1535, 12, 2923, 63, 80, 13072, 12, 2052, 63, 11579, 12, 479, 63, 1840, 275, 1324, 63, 589, 339, 664, 3227, 63, 4508, 275, 942, 272, 2112, 19104, 63, 4508, 275, 942, 272, 367, 307, 315, 1425, 8, 2923, 63, 80, 13072, 304, 267, 870, 298, 263, 2235, 16448, 1052, 10530, 1052, 3141, 299, 13072, 26, 3680, 908, 8, 29253, 63, 1535, 12, 307, 9, 398, 327, 511, 8761, 664, 3227, 327, 267, 327, 372, 282, 3938, 413, 15, 21, 402, 314, 900, 334, 4791, 1183, 12, 675, 4163, 9, 267, 3938, 275, 2196, 14, 5095, 779, 549, 61, 435, 841, 23033, 797, 566, 267, 664, 3227, 63, 589, 63, 807, 275, 791, 589, 356, 791, 29253, 63, 1535, 356, 623, 16448, 63, 1535, 12, 4318, 283, 3440, 356, 3938, 1386, 2892, 283, 1474, 63, 1535, 356, 1437, 63, 1535, 93, 267, 1827, 63, 807, 12, 4487, 275, 511, 63, 1208, 14, 362, 3227, 8, 362 ]
[ 2680, 199, 646, 2680, 465, 980, 199, 646, 2680, 14, 2355, 199, 646, 2196, 199, 646, 2022, 199, 646, 900, 199, 504, 2197, 492, 2197, 199, 646, 4145, 199, 504, 7026, 14, 10096, 492, 6316, 199, 646, 900, 199, 504, 12866, 492, 15553, 199, 646, 747, 199, 646, 984, 199, 893, 26, 272, 492, 2163, 14, 5181, 14, 396, 63, 1208, 465, 511, 63, 1208, 199, 2590, 26, 272, 984, 14, 515, 14, 740, 360, 29866, 2184, 15, 5181, 358, 272, 492, 511, 63, 1208, 421, 199, 318, 511, 63, 6136, 63, 1162, 837, 272, 1862, 275, 9016, 1507, 63, 6264, 356, 959, 1386, 1598, 791, 1131, 63, 513, 356, 3474, 16, 12, 413, 467, 359, 17, 12, 499, 467, 359, 19, 12, 841, 2677, 11049, 272, 367, 1215, 315, 1862, 26, 267, 870, 8, 635, 9, 267, 511, 63, 1246, 8, 1162, 29, 635, 9, 421, 199, 318, 511, 63, 1246, 8, 479, 63, 1840, 29, 549, 12, 1967, 63, 25005, 29, 21, 12, 1967, 63, 14555, 29, 24, 12, 5762, 29, 16, 14, 1717, 12, 1467, 3141, 63, 80, 13072, 63, 529, 63, 1258, 29, 21, 12, 1967, 63, 476, 22263, 29, 17, 12, 1467, 1862, 3713, 1507, 63, 6264, 356, 959, 22558, 339, 1145, 63, 344, 275, 283, 36, 310, 2983, 28018, 15256, 28928, 920, 18361, 7, 272, 2549, 63, 11579, 275, 2680, 14, 1144, 8, 1842, 8, 1507, 63, 25005, 2788, 21123, 17, 23067, 1609, 8, 1507, 63, 25005, 9, 272, 4203, 275, 15553, 8, 11816, 29, 1507, 63, 14555, 9, 272, 3748, 63, 6731, 63, 1580, 275, 788, 7184, 63, 44, 382, 53, 9956, 297, 283, 7184, 63, 3883, 297, 283, 13816, 12226, 8922, 418, 339, 15760, 63, 513, 275, 942, 272, 367, 284, 12, 15760, 63, 344, 315, 3874, 8, 4946, 63, 6731, 63, 1580, 304, 267, 15760, 63, 1053, 275, 1052, 267, 340, 15760, 63, 344, 508, 283, 13816, 12226, 8922, 356, 288, 15760, 63, 1053, 459, 1162, 418, 275, 1862, 267, 15760, 63, 1053, 459, 6731, 63, 344, 418, 275, 15760, 63, 344, 267, 15760, 63, 1053, 459, 6731, 63, 1302, 418, 275, 15760, 63, 344, 4786, 20013, 495, 8, 73, 9, 267, 15760, 63, 513, 14, 740, 8, 6731, 63, 1053, 9, 339, 1862, 275, 942, 272, 367, 5563, 315, 15760, 63, 513, 26, 267, 1862, 14, 740, 3252, 6731, 63, 1302, 356, 5563, 459, 6731, 63, 1302, 995, 283, 4469, 15029, 356, 17, 13186, 552, 8, 6731, 63, 513, 11466, 272, 5563, 63, 8110, 63, 1751, 275, 1052, 272, 5563, 63, 8110, 63, 1751, 459, 632, 418, 275, 283, 5964, 63, 4469, 18434, 7, 272, 5563, 63, 8110, 63, 1751, 459, 1162, 418, 275, 1862, 339, 870, 5563, 63, 8110, 63, 1751, 339, 20286, 3, 272, 327, 1379, 8761, 23997, 272, 20286, 3, 272, 4205, 4527, 63, 589, 63, 807, 275, 1052, 272, 4205, 4527, 63, 589, 63, 807, 459, 589, 418, 275, 791, 6731, 63, 513, 356, 15760, 63, 513, 12, 639, 283, 8833, 63, 8110, 63, 1751, 356, 5563, 63, 8110, 63, 1751, 12, 639, 283, 1100, 356, 283, 2998, 367, 25855, 2983, 699, 290, 15256, 297, 639, 283, 1100, 63, 466, 356, 283, 505, 297, 639, 283, 271, 19127, 356, 283, 774, 477, 9660, 379, 3130, 639, 283, 5328, 63, 17210, 356, 378, 14, 1717, 12, 639, 283, 20718, 356, 283, 774, 15794, 3130, 639, 283, 29253, 63, 475, 63, 8833, 63, 8110, 356, 283, 368, 63, 475, 63, 3479, 297, 639, 283, 4684, 356, 791, 78, 356, 1967, 63, 25005, 4863, 339, 4205, 4527, 63, 589, 63, 807, 459, 571, 63, 344, 418, 275, 1145, 63, 344, 272, 4205, 4527, 63, 589, 63, 807, 459, 2124, 63, 344, 418, 275, 283, 1814, 642, 543, 6449, 4770, 1305, 7, 272, 4205, 4527, 63, 589, 63, 807, 459, 2124, 63, 498, 418, 275, 283, 1814, 642, 543, 6449, 4770, 790, 7, 339, 1437, 63, 815, 275, 942, 272, 367, 579, 76, 315, 1425, 8, 1507, 63, 476, 22263, 304, 267, 1437, 63, 815, 847, 359, 396, 63, 1208, 14, 826, 4527, 8, 826, 4527, 63, 589, 63, 807, 2788, 17, 2677, 339, 327, 7958, 623, 20989, 272, 623, 20989, 275, 942, 272, 4203, 63, 589, 275, 942, 272, 367, 284, 315, 1425, 8, 1507, 63, 14555, 304, 267, 623, 16448, 63, 1535, 275, 1543, 22739, 88, 7, 450, 2196, 14, 20539, 8, 975, 538, 1216, 9, 267, 623, 20989, 14, 740, 8, 29253, 63, 1535, 9, 398, 11805, 275, 2680, 14, 2355, 14, 5095, 8, 1474, 63, 815, 9, 267, 1437, 63, 1535, 275, 11805, 459, 1474, 63, 1535, 418, 267, 4203, 63, 589, 14, 740, 1332, 1474, 63, 1535, 12, 623, 16448, 63, 1535, 12, 3141, 63, 80, 13072, 63, 529, 63, 1258, 12, 2079, 2549, 63, 11579, 12, 479, 63, 1840, 430, 339, 2058, 275, 4203, 14, 1130, 8, 28689, 63, 368, 63, 1258, 12, 4203, 63, 589, 9, 339, 367, 754, 315, 2058, 26, 267, 754, 339, 511, 63, 1208, 14, 362, 1685, 8, 1474, 63, 1535, 12, 1145, 63, 344, 12, 3748, 63, 6731, 63, 1580, 12, 15760, 63, 513, 9, 199, 199, 318, 20577, 63, 368, 63, 1258, 8, 1210, 63, 589, 304, 272, 1437, 63, 1535, 12, 29253, 63, 1535, 12, 2923, 63, 80, 13072, 12, 2052, 63, 11579, 12, 479, 63, 1840, 275, 1324, 63, 589, 339, 664, 3227, 63, 4508, 275, 942, 272, 2112, 19104, 63, 4508, 275, 942, 272, 367, 307, 315, 1425, 8, 2923, 63, 80, 13072, 304, 267, 870, 298, 263, 2235, 16448, 1052, 10530, 1052, 3141, 299, 13072, 26, 3680, 908, 8, 29253, 63, 1535, 12, 307, 9, 398, 327, 511, 8761, 664, 3227, 327, 267, 327, 372, 282, 3938, 413, 15, 21, 402, 314, 900, 334, 4791, 1183, 12, 675, 4163, 9, 267, 3938, 275, 2196, 14, 5095, 779, 549, 61, 435, 841, 23033, 797, 566, 267, 664, 3227, 63, 589, 63, 807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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 ]
xydinesh/youtube-dl
youtube_dl/extractor/tv4.py
117
3631
# coding: utf-8 from __future__ import unicode_literals from .common import InfoExtractor from ..utils import ( ExtractorError, parse_iso8601, ) class TV4IE(InfoExtractor): IE_DESC = 'tv4.se and tv4play.se' _VALID_URL = r'''(?x)https?://(?:www\.)? (?: tv4\.se/(?:[^/]+)/klipp/(?:.*)-| tv4play\.se/ (?: (?:program|barn)/(?:[^\?]+)\?video_id=| iframe/video/| film/| sport/| ) )(?P<id>[0-9]+)''' _TESTS = [ { 'url': 'http://www.tv4.se/kalla-fakta/klipp/kalla-fakta-5-english-subtitles-2491650', 'md5': '909d6454b87b10a25aa04c4bdd416a9b', 'info_dict': { 'id': '2491650', 'ext': 'mp4', 'title': 'Kalla Fakta 5 (english subtitles)', 'thumbnail': 're:^https?://.*\.jpg$', 'timestamp': int, 'upload_date': '20131125', }, }, { 'url': 'http://www.tv4play.se/iframe/video/3054113', 'md5': '77f851c55139ffe0ebd41b6a5552489b', 'info_dict': { 'id': '3054113', 'ext': 'mp4', 'title': 'Så här jobbar ficktjuvarna - se avslöjande bilder', 'thumbnail': 're:^https?://.*\.jpg$', 'description': 'Unika bilder avslöjar hur turisternas fickor vittjas mitt på Stockholms central. Två experter på ficktjuvarna avslöjar knepen du ska se upp för.', 'timestamp': int, 'upload_date': '20150130', }, }, { 'url': 'http://www.tv4play.se/sport/3060959', 'only_matching': True, }, { 'url': 'http://www.tv4play.se/film/2378136', 'only_matching': True, }, { 'url': 'http://www.tv4play.se/barn/looney-tunes?video_id=3062412', 'only_matching': True, }, ] def _real_extract(self, url): video_id = self._match_id(url) info = self._download_json( 'http://www.tv4play.se/player/assets/%s.json' % video_id, video_id, 'Downloading video info JSON') # If is_geo_restricted is true, it doesn't neceserally mean we can't download it if info['is_geo_restricted']: self.report_warning('This content might not be available in your country due to licensing restrictions.') if info['requires_subscription']: raise ExtractorError('This content requires subscription.', expected=True) sources_data = self._download_json( 'https://prima.tv4play.se/api/web/asset/%s/play.json?protocol=http&videoFormat=MP4' % video_id, video_id, 'Downloading sources JSON') sources = sources_data['playback'] formats = [] for item in sources.get('items', {}).get('item', []): ext, bitrate = item['mediaFormat'], item['bitrate'] formats.append({ 'format_id': '%s_%s' % (ext, bitrate), 'tbr': bitrate, 'ext': ext, 'url': item['url'], }) self._sort_formats(formats) return { 'id': video_id, 'title': info['title'], 'formats': formats, 'description': info.get('description'), 'timestamp': parse_iso8601(info.get('broadcast_date_time')), 'duration': info.get('duration'), 'thumbnail': info.get('image'), 'is_live': sources.get('live'), }
unlicense
[ 3, 2803, 26, 2774, 13, 24, 199, 504, 636, 2443, 363, 492, 2649, 63, 5955, 199, 199, 504, 1275, 2330, 492, 21298, 199, 504, 2508, 1208, 492, 334, 272, 19783, 12, 272, 2198, 63, 4595, 15363, 12, 199, 9, 421, 199, 533, 26990, 20, 4332, 8, 18283, 304, 272, 15292, 63, 15119, 275, 283, 6993, 20, 14, 261, 436, 13466, 20, 2802, 14, 261, 7, 272, 485, 5600, 63, 2632, 275, 519, 2344, 2229, 88, 9, 2859, 24524, 1544, 20316, 267, 16697, 288, 13466, 20, 4537, 261, 32576, 26285, 2447, 75, 317, 802, 32576, 2795, 7216, 92, 288, 13466, 20, 2802, 4537, 261, 15, 288, 16697, 355, 16697, 6815, 92, 66, 1060, 2447, 5169, 16045, 31, 18096, 31, 3722, 63, 344, 26777, 355, 340, 1186, 15, 3722, 15, 92, 355, 1794, 77, 15, 92, 355, 308, 719, 15, 92, 288, 776, 267, 776, 2229, 48, 28, 344, 9514, 16, 13, 25, 11896, 2344, 272, 485, 7569, 275, 359, 267, 469, 288, 283, 633, 356, 283, 1014, 921, 1544, 14, 6993, 20, 14, 261, 15, 26446, 416, 13, 667, 75, 502, 15, 75, 317, 802, 15, 26446, 416, 13, 667, 75, 502, 13, 21, 13, 17872, 13, 16858, 13, 11032, 975, 1400, 297, 288, 283, 1064, 21, 356, 283, 26578, 68, 772, 1477, 66, 1555, 66, 709, 65, 821, 2158, 966, 67, 20, 26293, 25209, 65, 25, 66, 297, 288, 283, 815, 63, 807, 356, 469, 355, 283, 344, 356, 283, 11032, 975, 1400, 297, 355, 283, 832, 356, 283, 311, 20, 297, 355, 283, 1213, 356, 283, 43, 29339, 481, 1151, 502, 959, 334, 17872, 19297, 3196, 355, 283, 8311, 356, 283, 264, 23497, 2859, 32569, 8476, 4268, 355, 283, 3954, 356, 1109, 12, 355, 283, 5064, 63, 602, 356, 283, 1797, 2192, 6889, 297, 288, 1660, 267, 1660, 267, 469, 288, 283, 633, 356, 283, 1014, 921, 1544, 14, 6993, 20, 2802, 14, 261, 15, 20052, 15, 3722, 15, 1216, 1477, 9225, 297, 288, 283, 1064, 21, 356, 283, 1138, 70, 22740, 67, 1229, 7491, 2026, 16, 2871, 68, 2953, 66, 22, 65, 15722, 1194, 1407, 66, 297, 288, 283, 815, 63, 807, 356, 469, 355, 283, 344, 356, 283, 1216, 1477, 9225, 297, 355, 283, 832, 356, 283, 311, 20, 297, 355, 283, 1213, 356, 283, 51, 30234, 394, 13733, 82, 3906, 1700, 289, 2000, 84, 74, 9154, 24252, 446, 542, 2289, 2482, 14614, 24418, 271, 330, 3030, 297, 355, 283, 8311, 356, 283, 264, 23497, 2859, 32569, 8476, 4268, 355, 283, 1802, 356, 283, 1358, 26966, 330, 3030, 2289, 2482, 14614, 7338, 394, 300, 307, 17656, 1203, 305, 289, 2000, 269, 373, 390, 84, 74, 305, 30714, 84, 299, 30234, 28406, 24588, 706, 18796, 14, 377, 86, 30234, 444, 529, 351, 299, 30234, 289, 2000, 84, 74, 9154, 24252, 2289, 2482, 14614, 7338, 1022, 685, 897, 15776, 2386, 65, 542, 1536, 80, 289, 14614, 82, 3130, 355, 283, 3954, 356, 1109, 12, 355, 283, 5064, 63, 602, 356, 283, 7806, 614, 1216, 297, 288, 1660, 267, 1660, 267, 469, 288, 283, 633, 356, 283, 1014, 921, 1544, 14, 6993, 20, 2802, 14, 261, 15, 3275, 15, 11363, 1643, 1427, 297, 288, 283, 2118, 63, 9467, 356, 715, 12, 267, 1660, 267, 469, 288, 283, 633, 356, 283, 1014, 921, 1544, 14, 6993, 20, 2802, 14, 261, 15, 1289, 77, 15, 10638, 24, 8138, 297, 288, 283, 2118, 63, 9467, 356, 715, 12, 267, 1660, 267, 469, 288, 283, 633, 356, 283, 1014, 921, 1544, 14, 6993, 20, 2802, 14, 261, 15, 66, 1060, 15, 320, 13234, 13, 10032, 397, 31, 3722, 63, 344, 29, 11363, 1194, 713, 297, 288, 283, 2118, 63, 9467, 356, 715, 12, 267, 1660, 272, 1622, 339, 347, 485, 3093, 63, 5005, 8, 277, 12, 1166, 304, 267, 3991, 63, 344, 275, 291, 423, 1431, 63, 344, 8, 633, 9, 398, 2256, 275, 291, 423, 4249, 63, 1001, 8, 288, 283, 1014, 921, 1544, 14, 6993, 20, 2802, 14, 261, 15, 6147, 15, 12186, 3149, 83, 14, 1001, 7, 450, 3991, 63, 344, 12, 3991, 63, 344, 12, 283, 18085, 3991, 2256, 4840, 358, 398, 327, 982, 365, 63, 6721, 63, 17973, 365, 2549, 12, 652, 3181, 1133, 1279, 301, 332, 1183, 4615, 781, 883, 1133, 5235, 652, 267, 340, 2256, 459, 374, 63, 6721, 63, 17973, 2565, 288, 291, 14, 3070, 63, 3764, 360, 2765, 1564, 5594, 440, 506, 2808, 315, 2195, 9023, 7037, 370, 32572, 24488, 2659, 267, 340, 2256, 459, 6537, 63, 6645, 2565, 288, 746, 19783, 360, 2765, 1564, 5074, 9966, 3130, 1420, 29, 549, 9, 398, 5274, 63, 576, 275, 291, 423, 4249, 63, 1001, 8, 288, 283, 2859, 921, 1359, 391, 14, 6993, 20, 2802, 14, 261, 15, 1246, 15, 2520, 15, 6562, 3149, 83, 15, 2802, 14, 1001, 31, 3922, 29, 1014, 6, 3722, 3484, 29, 1658, 20, 7, 450, 3991, 63, 344, 12, 3991, 63, 344, 12, 283, 18085, 5274, 4840, 358, 267, 5274, 275, 5274, 63, 576, 459, 2802, 894, 418, 398, 6752, 275, 942, 267, 367, 1242, 315, 5274, 14, 362, 360, 1744, 297, 13056, 362, 360, 1053, 297, 12319, 288, 1599, 12, 4546, 1866, 275, 1242, 459, 4603, 3484, 995, 1242, 459, 24484, 418, 288, 6752, 14, 740, 2561, 355, 283, 908, 63, 344, 356, 1543, 83, 4970, 83, 7, 450, 334, 832, 12, 4546, 1866, 395, 355, 283, 84, 3289, 356, 4546, 1866, 12, 355, 283, 832, 356, 1599, 12, 355, 283, 633, 356, 1242, 459, 633, 995, 288, 3828, 267, 291, 423, 3191, 63, 6321, 8, 6321, 9, 398, 372, 469, 288, 283, 344, 356, 3991, 63, 344, 12, 288, 283, 1213, 356, 2256, 459, 1213, 995, 288, 283, 6321, 356, 6752, 12, 288, 283, 1802, 356, 2256, 14, 362, 360, 1802, 659, 288, 283, 3954, 356, 2198, 63, 4595, 15363, 8, 815, 14, 362, 360, 10786, 63, 602, 63, 521, 3855, 288, 283, 5553, 356, 2256, 14, 362, 360, 5553, 659, 288, 283, 8311, 356, 2256, 14, 362, 360, 1569, 659, 288, 283, 374, 63, 6442, 356, 5274, 14, 362, 360, 6442, 659, 267, 789, 199, 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, 504, 1275, 2330, 492, 21298, 199, 504, 2508, 1208, 492, 334, 272, 19783, 12, 272, 2198, 63, 4595, 15363, 12, 199, 9, 421, 199, 533, 26990, 20, 4332, 8, 18283, 304, 272, 15292, 63, 15119, 275, 283, 6993, 20, 14, 261, 436, 13466, 20, 2802, 14, 261, 7, 272, 485, 5600, 63, 2632, 275, 519, 2344, 2229, 88, 9, 2859, 24524, 1544, 20316, 267, 16697, 288, 13466, 20, 4537, 261, 32576, 26285, 2447, 75, 317, 802, 32576, 2795, 7216, 92, 288, 13466, 20, 2802, 4537, 261, 15, 288, 16697, 355, 16697, 6815, 92, 66, 1060, 2447, 5169, 16045, 31, 18096, 31, 3722, 63, 344, 26777, 355, 340, 1186, 15, 3722, 15, 92, 355, 1794, 77, 15, 92, 355, 308, 719, 15, 92, 288, 776, 267, 776, 2229, 48, 28, 344, 9514, 16, 13, 25, 11896, 2344, 272, 485, 7569, 275, 359, 267, 469, 288, 283, 633, 356, 283, 1014, 921, 1544, 14, 6993, 20, 14, 261, 15, 26446, 416, 13, 667, 75, 502, 15, 75, 317, 802, 15, 26446, 416, 13, 667, 75, 502, 13, 21, 13, 17872, 13, 16858, 13, 11032, 975, 1400, 297, 288, 283, 1064, 21, 356, 283, 26578, 68, 772, 1477, 66, 1555, 66, 709, 65, 821, 2158, 966, 67, 20, 26293, 25209, 65, 25, 66, 297, 288, 283, 815, 63, 807, 356, 469, 355, 283, 344, 356, 283, 11032, 975, 1400, 297, 355, 283, 832, 356, 283, 311, 20, 297, 355, 283, 1213, 356, 283, 43, 29339, 481, 1151, 502, 959, 334, 17872, 19297, 3196, 355, 283, 8311, 356, 283, 264, 23497, 2859, 32569, 8476, 4268, 355, 283, 3954, 356, 1109, 12, 355, 283, 5064, 63, 602, 356, 283, 1797, 2192, 6889, 297, 288, 1660, 267, 1660, 267, 469, 288, 283, 633, 356, 283, 1014, 921, 1544, 14, 6993, 20, 2802, 14, 261, 15, 20052, 15, 3722, 15, 1216, 1477, 9225, 297, 288, 283, 1064, 21, 356, 283, 1138, 70, 22740, 67, 1229, 7491, 2026, 16, 2871, 68, 2953, 66, 22, 65, 15722, 1194, 1407, 66, 297, 288, 283, 815, 63, 807, 356, 469, 355, 283, 344, 356, 283, 1216, 1477, 9225, 297, 355, 283, 832, 356, 283, 311, 20, 297, 355, 283, 1213, 356, 283, 51, 30234, 394, 13733, 82, 3906, 1700, 289, 2000, 84, 74, 9154, 24252, 446, 542, 2289, 2482, 14614, 24418, 271, 330, 3030, 297, 355, 283, 8311, 356, 283, 264, 23497, 2859, 32569, 8476, 4268, 355, 283, 1802, 356, 283, 1358, 26966, 330, 3030, 2289, 2482, 14614, 7338, 394, 300, 307, 17656, 1203, 305, 289, 2000, 269, 373, 390, 84, 74, 305, 30714, 84, 299, 30234, 28406, 24588, 706, 18796, 14, 377, 86, 30234, 444, 529, 351, 299, 30234, 289, 2000, 84, 74, 9154, 24252, 2289, 2482, 14614, 7338, 1022, 685, 897, 15776, 2386, 65, 542, 1536, 80, 289, 14614, 82, 3130, 355, 283, 3954, 356, 1109, 12, 355, 283, 5064, 63, 602, 356, 283, 7806, 614, 1216, 297, 288, 1660, 267, 1660, 267, 469, 288, 283, 633, 356, 283, 1014, 921, 1544, 14, 6993, 20, 2802, 14, 261, 15, 3275, 15, 11363, 1643, 1427, 297, 288, 283, 2118, 63, 9467, 356, 715, 12, 267, 1660, 267, 469, 288, 283, 633, 356, 283, 1014, 921, 1544, 14, 6993, 20, 2802, 14, 261, 15, 1289, 77, 15, 10638, 24, 8138, 297, 288, 283, 2118, 63, 9467, 356, 715, 12, 267, 1660, 267, 469, 288, 283, 633, 356, 283, 1014, 921, 1544, 14, 6993, 20, 2802, 14, 261, 15, 66, 1060, 15, 320, 13234, 13, 10032, 397, 31, 3722, 63, 344, 29, 11363, 1194, 713, 297, 288, 283, 2118, 63, 9467, 356, 715, 12, 267, 1660, 272, 1622, 339, 347, 485, 3093, 63, 5005, 8, 277, 12, 1166, 304, 267, 3991, 63, 344, 275, 291, 423, 1431, 63, 344, 8, 633, 9, 398, 2256, 275, 291, 423, 4249, 63, 1001, 8, 288, 283, 1014, 921, 1544, 14, 6993, 20, 2802, 14, 261, 15, 6147, 15, 12186, 3149, 83, 14, 1001, 7, 450, 3991, 63, 344, 12, 3991, 63, 344, 12, 283, 18085, 3991, 2256, 4840, 358, 398, 327, 982, 365, 63, 6721, 63, 17973, 365, 2549, 12, 652, 3181, 1133, 1279, 301, 332, 1183, 4615, 781, 883, 1133, 5235, 652, 267, 340, 2256, 459, 374, 63, 6721, 63, 17973, 2565, 288, 291, 14, 3070, 63, 3764, 360, 2765, 1564, 5594, 440, 506, 2808, 315, 2195, 9023, 7037, 370, 32572, 24488, 2659, 267, 340, 2256, 459, 6537, 63, 6645, 2565, 288, 746, 19783, 360, 2765, 1564, 5074, 9966, 3130, 1420, 29, 549, 9, 398, 5274, 63, 576, 275, 291, 423, 4249, 63, 1001, 8, 288, 283, 2859, 921, 1359, 391, 14, 6993, 20, 2802, 14, 261, 15, 1246, 15, 2520, 15, 6562, 3149, 83, 15, 2802, 14, 1001, 31, 3922, 29, 1014, 6, 3722, 3484, 29, 1658, 20, 7, 450, 3991, 63, 344, 12, 3991, 63, 344, 12, 283, 18085, 5274, 4840, 358, 267, 5274, 275, 5274, 63, 576, 459, 2802, 894, 418, 398, 6752, 275, 942, 267, 367, 1242, 315, 5274, 14, 362, 360, 1744, 297, 13056, 362, 360, 1053, 297, 12319, 288, 1599, 12, 4546, 1866, 275, 1242, 459, 4603, 3484, 995, 1242, 459, 24484, 418, 288, 6752, 14, 740, 2561, 355, 283, 908, 63, 344, 356, 1543, 83, 4970, 83, 7, 450, 334, 832, 12, 4546, 1866, 395, 355, 283, 84, 3289, 356, 4546, 1866, 12, 355, 283, 832, 356, 1599, 12, 355, 283, 633, 356, 1242, 459, 633, 995, 288, 3828, 267, 291, 423, 3191, 63, 6321, 8, 6321, 9, 398, 372, 469, 288, 283, 344, 356, 3991, 63, 344, 12, 288, 283, 1213, 356, 2256, 459, 1213, 995, 288, 283, 6321, 356, 6752, 12, 288, 283, 1802, 356, 2256, 14, 362, 360, 1802, 659, 288, 283, 3954, 356, 2198, 63, 4595, 15363, 8, 815, 14, 362, 360, 10786, 63, 602, 63, 521, 3855, 288, 283, 5553, 356, 2256, 14, 362, 360, 5553, 659, 288, 283, 8311, 356, 2256, 14, 362, 360, 1569, 659, 288, 283, 374, 63, 6442, 356, 5274, 14, 362, 360, 6442, 659, 267, 789, 199, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 0 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1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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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
sigma-random/scrapy
scrapy/utils/console.py
71
1444
def start_python_console(namespace=None, noipython=False, banner=''): """Start Python console binded to the given namespace. If IPython is available, an IPython console will be started instead, unless `noipython` is True. Also, tab completion will be used on Unix systems. """ if namespace is None: namespace = {} try: try: # use IPython if available if noipython: raise ImportError() try: from IPython.terminal.embed import InteractiveShellEmbed from IPython.terminal.ipapp import load_default_config except ImportError: from IPython.frontend.terminal.embed import InteractiveShellEmbed from IPython.frontend.terminal.ipapp import load_default_config config = load_default_config() shell = InteractiveShellEmbed( banner1=banner, user_ns=namespace, config=config) shell() except ImportError: import code try: # readline module is only available on unix systems import readline except ImportError: pass else: import rlcompleter readline.parse_and_bind("tab:complete") code.interact(banner=banner, local=namespace) except SystemExit: # raised when using exit() in python code.interact pass
bsd-3-clause
[ 199, 318, 1343, 63, 1548, 63, 6614, 8, 3251, 29, 403, 12, 949, 22691, 29, 797, 12, 20997, 9280, 272, 408, 3162, 2018, 8559, 2517, 770, 370, 314, 1627, 3231, 14, 982, 16243, 365, 272, 2808, 12, 376, 16243, 8559, 911, 506, 8239, 3140, 12, 7444, 658, 889, 22691, 64, 272, 365, 715, 14, 6121, 12, 5174, 13659, 911, 506, 1202, 641, 13074, 10460, 14, 272, 408, 272, 340, 3231, 365, 488, 26, 267, 3231, 275, 1052, 339, 862, 26, 267, 862, 26, 327, 675, 16243, 340, 2808, 288, 340, 949, 22691, 26, 355, 746, 3545, 342, 953, 862, 26, 355, 687, 16243, 14, 12010, 14, 6427, 492, 1010, 7502, 8529, 13200, 355, 687, 16243, 14, 12010, 14, 20014, 802, 492, 2248, 63, 885, 63, 888, 288, 871, 3545, 26, 355, 687, 16243, 14, 18062, 14, 12010, 14, 6427, 492, 1010, 7502, 8529, 13200, 355, 687, 16243, 14, 18062, 14, 12010, 14, 20014, 802, 492, 2248, 63, 885, 63, 888, 953, 1101, 275, 2248, 63, 885, 63, 888, 342, 288, 5218, 275, 1010, 7502, 8529, 13200, 8, 355, 20997, 17, 29, 13066, 12, 922, 63, 561, 29, 3251, 12, 1101, 29, 888, 9, 288, 5218, 342, 267, 871, 3545, 26, 288, 492, 1233, 288, 862, 26, 327, 14441, 859, 365, 1454, 2808, 641, 16572, 10460, 355, 492, 14441, 288, 871, 3545, 26, 355, 986, 288, 587, 26, 355, 492, 25717, 18452, 355, 14441, 14, 1122, 63, 460, 63, 3409, 480, 2902, 26, 4883, 531, 288, 1233, 14, 25850, 8, 13066, 29, 13066, 12, 2257, 29, 3251, 9, 272, 871, 14838, 26, 327, 4915, 1380, 1808, 4458, 342, 315, 2366, 1233, 14, 25850, 267, 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 ]
[ 318, 1343, 63, 1548, 63, 6614, 8, 3251, 29, 403, 12, 949, 22691, 29, 797, 12, 20997, 9280, 272, 408, 3162, 2018, 8559, 2517, 770, 370, 314, 1627, 3231, 14, 982, 16243, 365, 272, 2808, 12, 376, 16243, 8559, 911, 506, 8239, 3140, 12, 7444, 658, 889, 22691, 64, 272, 365, 715, 14, 6121, 12, 5174, 13659, 911, 506, 1202, 641, 13074, 10460, 14, 272, 408, 272, 340, 3231, 365, 488, 26, 267, 3231, 275, 1052, 339, 862, 26, 267, 862, 26, 327, 675, 16243, 340, 2808, 288, 340, 949, 22691, 26, 355, 746, 3545, 342, 953, 862, 26, 355, 687, 16243, 14, 12010, 14, 6427, 492, 1010, 7502, 8529, 13200, 355, 687, 16243, 14, 12010, 14, 20014, 802, 492, 2248, 63, 885, 63, 888, 288, 871, 3545, 26, 355, 687, 16243, 14, 18062, 14, 12010, 14, 6427, 492, 1010, 7502, 8529, 13200, 355, 687, 16243, 14, 18062, 14, 12010, 14, 20014, 802, 492, 2248, 63, 885, 63, 888, 953, 1101, 275, 2248, 63, 885, 63, 888, 342, 288, 5218, 275, 1010, 7502, 8529, 13200, 8, 355, 20997, 17, 29, 13066, 12, 922, 63, 561, 29, 3251, 12, 1101, 29, 888, 9, 288, 5218, 342, 267, 871, 3545, 26, 288, 492, 1233, 288, 862, 26, 327, 14441, 859, 365, 1454, 2808, 641, 16572, 10460, 355, 492, 14441, 288, 871, 3545, 26, 355, 986, 288, 587, 26, 355, 492, 25717, 18452, 355, 14441, 14, 1122, 63, 460, 63, 3409, 480, 2902, 26, 4883, 531, 288, 1233, 14, 25850, 8, 13066, 29, 13066, 12, 2257, 29, 3251, 9, 272, 871, 14838, 26, 327, 4915, 1380, 1808, 4458, 342, 315, 2366, 1233, 14, 25850, 267, 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, 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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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 ]
Workday/OpenFrame
third_party/cython/src/Tools/cython-epydoc.py
125
1436
#! /usr/bin/env python # -------------------------------------------------------------------- import re from epydoc import docstringparser as dsp CYTHON_SIGNATURE_RE = re.compile( # Class name (for builtin methods) r'^\s*((?P<class>\w+)\.)?' + # The function name r'(?P<func>\w+)' + # The parameters r'\(((?P<self>(?:self|cls|mcs)),?)?(?P<params>.*)\)' + # The return value (optional) r'(\s*(->)\s*(?P<return>\w+(?:\s*\w+)))?' + # The end marker r'\s*(?:\n|$)') parse_signature = dsp.parse_function_signature def parse_function_signature(func_doc, doc_source, docformat, parse_errors): PYTHON_SIGNATURE_RE = dsp._SIGNATURE_RE assert PYTHON_SIGNATURE_RE is not CYTHON_SIGNATURE_RE try: dsp._SIGNATURE_RE = CYTHON_SIGNATURE_RE found = parse_signature(func_doc, doc_source, docformat, parse_errors) dsp._SIGNATURE_RE = PYTHON_SIGNATURE_RE if not found: found = parse_signature(func_doc, doc_source, docformat, parse_errors) return found finally: dsp._SIGNATURE_RE = PYTHON_SIGNATURE_RE dsp.parse_function_signature = parse_function_signature # -------------------------------------------------------------------- from epydoc.cli import cli cli() # --------------------------------------------------------------------
bsd-3-clause
[ 3168, 1182, 2647, 15, 1393, 15, 1813, 2366, 199, 199, 3, 23567, 199, 199, 646, 295, 199, 504, 325, 25048, 492, 9214, 2087, 465, 366, 681, 199, 199, 15068, 8472, 63, 26588, 63, 907, 275, 295, 14, 2014, 8, 272, 327, 8089, 536, 334, 509, 6762, 3102, 9, 272, 519, 15542, 83, 10, 17304, 48, 28, 533, 3072, 87, 13439, 4959, 14069, 435, 272, 327, 710, 805, 536, 272, 519, 10120, 48, 28, 1532, 3072, 87, 29600, 435, 272, 327, 710, 2633, 272, 519, 1154, 1332, 2229, 48, 28, 277, 30, 5169, 277, 92, 1886, 92, 77, 1259, 1826, 31, 5547, 2229, 48, 28, 1162, 23742, 2862, 3171, 435, 272, 327, 710, 372, 574, 334, 4144, 9, 272, 519, 13445, 83, 27436, 30, 2862, 83, 30957, 48, 28, 1107, 3072, 87, 11, 15840, 83, 7590, 87, 11, 1724, 14069, 435, 272, 327, 710, 1284, 3608, 272, 519, 1154, 83, 10, 15840, 78, 92, 4, 5942, 199, 199, 1122, 63, 5233, 275, 366, 681, 14, 1122, 63, 1593, 63, 5233, 199, 199, 318, 2198, 63, 1593, 63, 5233, 8, 1532, 63, 1301, 12, 1382, 63, 1365, 12, 2490, 1382, 908, 12, 2198, 63, 2550, 304, 272, 18280, 63, 26588, 63, 907, 275, 366, 681, 423, 26588, 63, 907, 272, 702, 18280, 63, 26588, 63, 907, 365, 440, 445, 57, 8472, 63, 26588, 63, 907, 272, 862, 26, 267, 366, 681, 423, 26588, 63, 907, 275, 445, 57, 8472, 63, 26588, 63, 907, 267, 1911, 275, 2198, 63, 5233, 8, 1532, 63, 1301, 12, 1382, 63, 1365, 12, 1816, 1382, 908, 12, 2198, 63, 2550, 9, 267, 366, 681, 423, 26588, 63, 907, 275, 18280, 63, 26588, 63, 907, 267, 340, 440, 1911, 26, 288, 1911, 275, 2198, 63, 5233, 8, 1532, 63, 1301, 12, 1382, 63, 1365, 12, 2511, 1382, 908, 12, 2198, 63, 2550, 9, 267, 372, 1911, 272, 3753, 26, 267, 366, 681, 423, 26588, 63, 907, 275, 18280, 63, 26588, 63, 907, 199, 199, 68, 681, 14, 1122, 63, 1593, 63, 5233, 275, 2198, 63, 1593, 63, 5233, 199, 199, 3, 23567, 199, 199, 504, 325, 25048, 14, 2764, 492, 5053, 199, 2764, 342, 199, 199, 3, 23567, 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 ]
[ 1182, 2647, 15, 1393, 15, 1813, 2366, 199, 199, 3, 23567, 199, 199, 646, 295, 199, 504, 325, 25048, 492, 9214, 2087, 465, 366, 681, 199, 199, 15068, 8472, 63, 26588, 63, 907, 275, 295, 14, 2014, 8, 272, 327, 8089, 536, 334, 509, 6762, 3102, 9, 272, 519, 15542, 83, 10, 17304, 48, 28, 533, 3072, 87, 13439, 4959, 14069, 435, 272, 327, 710, 805, 536, 272, 519, 10120, 48, 28, 1532, 3072, 87, 29600, 435, 272, 327, 710, 2633, 272, 519, 1154, 1332, 2229, 48, 28, 277, 30, 5169, 277, 92, 1886, 92, 77, 1259, 1826, 31, 5547, 2229, 48, 28, 1162, 23742, 2862, 3171, 435, 272, 327, 710, 372, 574, 334, 4144, 9, 272, 519, 13445, 83, 27436, 30, 2862, 83, 30957, 48, 28, 1107, 3072, 87, 11, 15840, 83, 7590, 87, 11, 1724, 14069, 435, 272, 327, 710, 1284, 3608, 272, 519, 1154, 83, 10, 15840, 78, 92, 4, 5942, 199, 199, 1122, 63, 5233, 275, 366, 681, 14, 1122, 63, 1593, 63, 5233, 199, 199, 318, 2198, 63, 1593, 63, 5233, 8, 1532, 63, 1301, 12, 1382, 63, 1365, 12, 2490, 1382, 908, 12, 2198, 63, 2550, 304, 272, 18280, 63, 26588, 63, 907, 275, 366, 681, 423, 26588, 63, 907, 272, 702, 18280, 63, 26588, 63, 907, 365, 440, 445, 57, 8472, 63, 26588, 63, 907, 272, 862, 26, 267, 366, 681, 423, 26588, 63, 907, 275, 445, 57, 8472, 63, 26588, 63, 907, 267, 1911, 275, 2198, 63, 5233, 8, 1532, 63, 1301, 12, 1382, 63, 1365, 12, 1816, 1382, 908, 12, 2198, 63, 2550, 9, 267, 366, 681, 423, 26588, 63, 907, 275, 18280, 63, 26588, 63, 907, 267, 340, 440, 1911, 26, 288, 1911, 275, 2198, 63, 5233, 8, 1532, 63, 1301, 12, 1382, 63, 1365, 12, 2511, 1382, 908, 12, 2198, 63, 2550, 9, 267, 372, 1911, 272, 3753, 26, 267, 366, 681, 423, 26588, 63, 907, 275, 18280, 63, 26588, 63, 907, 199, 199, 68, 681, 14, 1122, 63, 1593, 63, 5233, 275, 2198, 63, 1593, 63, 5233, 199, 199, 3, 23567, 199, 199, 504, 325, 25048, 14, 2764, 492, 5053, 199, 2764, 342, 199, 199, 3, 23567, 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, 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, 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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 ]
Eksmo/calibre
src/calibre/gui2/viewer/position.py
1
1815
#!/usr/bin/env python # vim:fileencoding=UTF-8:ts=4:sw=4:sta:et:sts=4:ai from __future__ import (unicode_literals, division, absolute_import, print_function) __license__ = 'GPL v3' __copyright__ = '2012, Kovid Goyal <[email protected]>' __docformat__ = 'restructuredtext en' import json class PagePosition(object): def __init__(self, document): self.document = document @property def viewport_cfi(self): ans = None res = self.document.mainFrame().evaluateJavaScript(''' ans = 'undefined'; if (window.paged_display) { ans = window.paged_display.current_cfi(); if (!ans) ans = 'undefined'; } ans; ''') if res.isValid() and not res.isNull() and res.type() == res.String: c = unicode(res.toString()) if c != 'undefined': ans = c return ans def scroll_to_cfi(self, cfi): if cfi: cfi = json.dumps(cfi) self.document.mainFrame().evaluateJavaScript( 'paged_display.jump_to_cfi(%s)'%cfi) @property def current_pos(self): ans = self.viewport_cfi if not ans: ans = self.document.scroll_fraction return ans def __enter__(self): self.save() def __exit__(self, *args): self.restore() def save(self): self._cpos = self.current_pos def restore(self): if self._cpos is None: return self.to_pos(self._cpos) self._cpos = None def to_pos(self, pos): if isinstance(pos, (int, float)): self.document.scroll_fraction = pos else: self.scroll_to_cfi(pos) def set_pos(self, pos): self._cpos = pos
gpl-3.0
[ 3381, 2647, 15, 1393, 15, 1813, 2366, 199, 3, 6695, 26, 493, 2991, 29, 6610, 13, 24, 26, 1086, 29, 20, 26, 3519, 29, 20, 26, 1207, 26, 386, 26, 10329, 29, 20, 26, 5789, 199, 504, 636, 2443, 363, 492, 334, 2975, 63, 5955, 12, 4629, 12, 3679, 63, 646, 12, 717, 870, 63, 1593, 9, 199, 199, 363, 1682, 363, 257, 275, 283, 12006, 373, 19, 7, 199, 363, 7307, 363, 275, 283, 7409, 12, 1804, 79, 5017, 3971, 31876, 665, 7697, 5017, 32, 7697, 5017, 1939, 31876, 14, 846, 3524, 199, 363, 21841, 363, 275, 283, 26854, 655, 7, 199, 199, 646, 2022, 199, 199, 533, 10331, 5625, 8, 785, 304, 339, 347, 636, 826, 721, 277, 12, 2213, 304, 267, 291, 14, 3554, 275, 2213, 339, 768, 1829, 272, 347, 2455, 719, 63, 67, 329, 8, 277, 304, 267, 4987, 275, 488, 267, 522, 275, 291, 14, 3554, 14, 973, 3160, 1252, 7383, 21986, 10505, 288, 4987, 275, 283, 10705, 13619, 288, 340, 334, 3806, 14, 1606, 68, 63, 2918, 9, 469, 355, 4987, 275, 4353, 14, 1606, 68, 63, 2918, 14, 1818, 63, 67, 329, 7303, 355, 340, 19452, 796, 9, 4987, 275, 283, 10705, 13619, 288, 789, 288, 4987, 27, 267, 21464, 267, 340, 522, 14, 18728, 342, 436, 440, 522, 14, 374, 8849, 342, 436, 522, 14, 466, 342, 508, 522, 14, 1558, 26, 288, 286, 275, 2649, 8, 470, 14, 16695, 1012, 288, 340, 286, 1137, 283, 10705, 356, 355, 4987, 275, 286, 267, 372, 4987, 339, 347, 13704, 63, 475, 63, 67, 329, 8, 277, 12, 286, 329, 304, 267, 340, 286, 329, 26, 288, 286, 329, 275, 2022, 14, 4180, 8, 67, 329, 9, 288, 291, 14, 3554, 14, 973, 3160, 1252, 7383, 21986, 8, 490, 283, 1606, 68, 63, 2918, 14, 11126, 63, 475, 63, 67, 329, 4042, 83, 3171, 5, 67, 329, 9, 339, 768, 1829, 272, 347, 1453, 63, 1712, 8, 277, 304, 267, 4987, 275, 291, 14, 25484, 63, 67, 329, 267, 340, 440, 4987, 26, 288, 4987, 275, 291, 14, 3554, 14, 6755, 63, 13054, 267, 372, 4987, 339, 347, 636, 4200, 721, 277, 304, 267, 291, 14, 2117, 342, 339, 347, 636, 2224, 721, 277, 12, 627, 589, 304, 267, 291, 14, 8011, 342, 339, 347, 3354, 8, 277, 304, 267, 291, 423, 67, 1712, 275, 291, 14, 1818, 63, 1712, 339, 347, 9066, 8, 277, 304, 267, 340, 291, 423, 67, 1712, 365, 488, 26, 372, 267, 291, 14, 475, 63, 1712, 8, 277, 423, 67, 1712, 9, 267, 291, 423, 67, 1712, 275, 488, 339, 347, 370, 63, 1712, 8, 277, 12, 2086, 304, 267, 340, 1228, 8, 1712, 12, 334, 442, 12, 2069, 2298, 288, 291, 14, 3554, 14, 6755, 63, 13054, 275, 2086, 267, 587, 26, 288, 291, 14, 6755, 63, 475, 63, 67, 329, 8, 1712, 9, 339, 347, 663, 63, 1712, 8, 277, 12, 2086, 304, 267, 291, 423, 67, 1712, 275, 2086, 4388, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 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, 6695, 26, 493, 2991, 29, 6610, 13, 24, 26, 1086, 29, 20, 26, 3519, 29, 20, 26, 1207, 26, 386, 26, 10329, 29, 20, 26, 5789, 199, 504, 636, 2443, 363, 492, 334, 2975, 63, 5955, 12, 4629, 12, 3679, 63, 646, 12, 717, 870, 63, 1593, 9, 199, 199, 363, 1682, 363, 257, 275, 283, 12006, 373, 19, 7, 199, 363, 7307, 363, 275, 283, 7409, 12, 1804, 79, 5017, 3971, 31876, 665, 7697, 5017, 32, 7697, 5017, 1939, 31876, 14, 846, 3524, 199, 363, 21841, 363, 275, 283, 26854, 655, 7, 199, 199, 646, 2022, 199, 199, 533, 10331, 5625, 8, 785, 304, 339, 347, 636, 826, 721, 277, 12, 2213, 304, 267, 291, 14, 3554, 275, 2213, 339, 768, 1829, 272, 347, 2455, 719, 63, 67, 329, 8, 277, 304, 267, 4987, 275, 488, 267, 522, 275, 291, 14, 3554, 14, 973, 3160, 1252, 7383, 21986, 10505, 288, 4987, 275, 283, 10705, 13619, 288, 340, 334, 3806, 14, 1606, 68, 63, 2918, 9, 469, 355, 4987, 275, 4353, 14, 1606, 68, 63, 2918, 14, 1818, 63, 67, 329, 7303, 355, 340, 19452, 796, 9, 4987, 275, 283, 10705, 13619, 288, 789, 288, 4987, 27, 267, 21464, 267, 340, 522, 14, 18728, 342, 436, 440, 522, 14, 374, 8849, 342, 436, 522, 14, 466, 342, 508, 522, 14, 1558, 26, 288, 286, 275, 2649, 8, 470, 14, 16695, 1012, 288, 340, 286, 1137, 283, 10705, 356, 355, 4987, 275, 286, 267, 372, 4987, 339, 347, 13704, 63, 475, 63, 67, 329, 8, 277, 12, 286, 329, 304, 267, 340, 286, 329, 26, 288, 286, 329, 275, 2022, 14, 4180, 8, 67, 329, 9, 288, 291, 14, 3554, 14, 973, 3160, 1252, 7383, 21986, 8, 490, 283, 1606, 68, 63, 2918, 14, 11126, 63, 475, 63, 67, 329, 4042, 83, 3171, 5, 67, 329, 9, 339, 768, 1829, 272, 347, 1453, 63, 1712, 8, 277, 304, 267, 4987, 275, 291, 14, 25484, 63, 67, 329, 267, 340, 440, 4987, 26, 288, 4987, 275, 291, 14, 3554, 14, 6755, 63, 13054, 267, 372, 4987, 339, 347, 636, 4200, 721, 277, 304, 267, 291, 14, 2117, 342, 339, 347, 636, 2224, 721, 277, 12, 627, 589, 304, 267, 291, 14, 8011, 342, 339, 347, 3354, 8, 277, 304, 267, 291, 423, 67, 1712, 275, 291, 14, 1818, 63, 1712, 339, 347, 9066, 8, 277, 304, 267, 340, 291, 423, 67, 1712, 365, 488, 26, 372, 267, 291, 14, 475, 63, 1712, 8, 277, 423, 67, 1712, 9, 267, 291, 423, 67, 1712, 275, 488, 339, 347, 370, 63, 1712, 8, 277, 12, 2086, 304, 267, 340, 1228, 8, 1712, 12, 334, 442, 12, 2069, 2298, 288, 291, 14, 3554, 14, 6755, 63, 13054, 275, 2086, 267, 587, 26, 288, 291, 14, 6755, 63, 475, 63, 67, 329, 8, 1712, 9, 339, 347, 663, 63, 1712, 8, 277, 12, 2086, 304, 267, 291, 423, 67, 1712, 275, 2086, 4388, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 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 ]
Xeralux/tensorflow
tensorflow/python/keras/applications/vgg19/__init__.py
74
1127
# 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. # ============================================================================== """VGG19 Keras application.""" from __future__ import absolute_import from __future__ import division from __future__ import print_function from tensorflow.python.keras._impl.keras.applications.vgg19 import decode_predictions from tensorflow.python.keras._impl.keras.applications.vgg19 import preprocess_input from tensorflow.python.keras._impl.keras.applications.vgg19 import VGG19 del absolute_import del division del print_function
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, 54, 2916, 1167, 1804, 30037, 4223, 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, 8811, 423, 5472, 14, 8811, 14, 15853, 14, 27948, 1167, 492, 4849, 63, 9869, 199, 504, 3228, 14, 1548, 14, 8811, 423, 5472, 14, 8811, 14, 15853, 14, 27948, 1167, 492, 23351, 63, 1210, 199, 504, 3228, 14, 1548, 14, 8811, 423, 5472, 14, 8811, 14, 15853, 14, 27948, 1167, 492, 812, 2916, 1167, 199, 199, 2264, 3679, 63, 646, 199, 2264, 4629, 199, 2264, 870, 63, 1593, 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 ]
[ 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, 54, 2916, 1167, 1804, 30037, 4223, 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, 8811, 423, 5472, 14, 8811, 14, 15853, 14, 27948, 1167, 492, 4849, 63, 9869, 199, 504, 3228, 14, 1548, 14, 8811, 423, 5472, 14, 8811, 14, 15853, 14, 27948, 1167, 492, 23351, 63, 1210, 199, 504, 3228, 14, 1548, 14, 8811, 423, 5472, 14, 8811, 14, 15853, 14, 27948, 1167, 492, 812, 2916, 1167, 199, 199, 2264, 3679, 63, 646, 199, 2264, 4629, 199, 2264, 870, 63, 1593, 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, 1, 1, 1, 1, 1, 1, 1, 1, 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 ]
openego/oeplatform
modelview/migrations/0022_auto_20160303_2233.py
1
1468
# -*- coding: utf-8 -*- # Generated by Django 1.9 on 2016-03-03 21:33 from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [("modelview", "0021_auto_20160303_2233")] operations = [ migrations.AlterField( model_name="energymodel", name="model_file_format", field=models.CharField( choices=[ (".exe", ".exe"), (".gms", ".gms"), (".py", ".py"), (".xls", ".xls"), ("other", "other"), ], default="other", help_text="In which format is the model saved?", max_length=5, verbose_name="Model file format", ), ), migrations.AlterField( model_name="energymodel", name="model_input", field=models.CharField( choices=[ (".csv", ".csv"), (".py", ".py"), ("text", "text"), (".xls", ".xls"), ("other", "other"), ], default="other", help_text="Of which file format are the input and output data?", max_length=5, verbose_name="Input/output data file format", ), ), ]
agpl-3.0
[ 3, 1882, 2803, 26, 2774, 13, 24, 1882, 199, 3, 17065, 701, 5634, 413, 14, 25, 641, 7800, 13, 1644, 13, 1644, 7829, 26, 1153, 199, 504, 636, 2443, 363, 492, 2649, 63, 5955, 199, 199, 504, 1639, 14, 697, 492, 6180, 12, 1709, 421, 199, 533, 12090, 8, 7685, 14, 9816, 304, 339, 5124, 275, 10003, 1238, 1345, 401, 298, 383, 2025, 63, 2495, 63, 1797, 2259, 11810, 63, 1081, 1153, 11323, 339, 5331, 275, 359, 267, 6180, 14, 19275, 8, 288, 1402, 63, 354, 628, 8443, 1238, 401, 288, 536, 628, 1238, 63, 493, 63, 908, 401, 288, 901, 29, 992, 14, 2183, 8, 355, 3415, 1524, 490, 334, 1674, 5803, 401, 3680, 5803, 1288, 490, 334, 1674, 71, 706, 401, 3680, 71, 706, 1288, 490, 334, 1674, 647, 401, 3680, 647, 1288, 490, 334, 1674, 19023, 401, 3680, 19023, 1288, 490, 1689, 1848, 401, 298, 1848, 1288, 355, 2156, 355, 849, 628, 1848, 401, 355, 1720, 63, 505, 628, 607, 1314, 1475, 365, 314, 1402, 6290, 15583, 355, 1390, 63, 1267, 29, 21, 12, 355, 3376, 63, 354, 628, 1685, 570, 1475, 401, 288, 2318, 267, 2318, 267, 6180, 14, 19275, 8, 288, 1402, 63, 354, 628, 8443, 1238, 401, 288, 536, 628, 1238, 63, 1210, 401, 288, 901, 29, 992, 14, 2183, 8, 355, 3415, 1524, 490, 334, 1674, 4737, 401, 3680, 4737, 1288, 490, 334, 1674, 647, 401, 3680, 647, 1288, 490, 1689, 505, 401, 298, 505, 1288, 490, 334, 1674, 19023, 401, 3680, 19023, 1288, 490, 1689, 1848, 401, 298, 1848, 1288, 355, 2156, 355, 849, 628, 1848, 401, 355, 1720, 63, 505, 628, 3466, 1314, 570, 1475, 787, 314, 1324, 436, 1072, 666, 15583, 355, 1390, 63, 1267, 29, 21, 12, 355, 3376, 63, 354, 628, 3205, 15, 1199, 666, 570, 1475, 401, 288, 2318, 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, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 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, 641, 7800, 13, 1644, 13, 1644, 7829, 26, 1153, 199, 504, 636, 2443, 363, 492, 2649, 63, 5955, 199, 199, 504, 1639, 14, 697, 492, 6180, 12, 1709, 421, 199, 533, 12090, 8, 7685, 14, 9816, 304, 339, 5124, 275, 10003, 1238, 1345, 401, 298, 383, 2025, 63, 2495, 63, 1797, 2259, 11810, 63, 1081, 1153, 11323, 339, 5331, 275, 359, 267, 6180, 14, 19275, 8, 288, 1402, 63, 354, 628, 8443, 1238, 401, 288, 536, 628, 1238, 63, 493, 63, 908, 401, 288, 901, 29, 992, 14, 2183, 8, 355, 3415, 1524, 490, 334, 1674, 5803, 401, 3680, 5803, 1288, 490, 334, 1674, 71, 706, 401, 3680, 71, 706, 1288, 490, 334, 1674, 647, 401, 3680, 647, 1288, 490, 334, 1674, 19023, 401, 3680, 19023, 1288, 490, 1689, 1848, 401, 298, 1848, 1288, 355, 2156, 355, 849, 628, 1848, 401, 355, 1720, 63, 505, 628, 607, 1314, 1475, 365, 314, 1402, 6290, 15583, 355, 1390, 63, 1267, 29, 21, 12, 355, 3376, 63, 354, 628, 1685, 570, 1475, 401, 288, 2318, 267, 2318, 267, 6180, 14, 19275, 8, 288, 1402, 63, 354, 628, 8443, 1238, 401, 288, 536, 628, 1238, 63, 1210, 401, 288, 901, 29, 992, 14, 2183, 8, 355, 3415, 1524, 490, 334, 1674, 4737, 401, 3680, 4737, 1288, 490, 334, 1674, 647, 401, 3680, 647, 1288, 490, 1689, 505, 401, 298, 505, 1288, 490, 334, 1674, 19023, 401, 3680, 19023, 1288, 490, 1689, 1848, 401, 298, 1848, 1288, 355, 2156, 355, 849, 628, 1848, 401, 355, 1720, 63, 505, 628, 3466, 1314, 570, 1475, 787, 314, 1324, 436, 1072, 666, 15583, 355, 1390, 63, 1267, 29, 21, 12, 355, 3376, 63, 354, 628, 3205, 15, 1199, 666, 570, 1475, 401, 288, 2318, 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, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 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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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 ]
emetsger/osf.io
scripts/migrate_guid.py
64
8584
""" Create a GUID for all non-GUID database records. If record already has a GUID, skip; if record has an ID but not a GUID, create a GUID matching the ID. Newly created records will have optimistically generated GUIDs. """ import time import collections from framework.mongo import StoredObject from website import models from website.app import init_app app = init_app('website.settings', set_backends=True, routes=True) def count_values(values): counts = collections.defaultdict(int) for value in values: counts[value] += 1 return counts def check_conflicts(conflict_models): ids = [] for model in conflict_models: ids += list(model.find().__iter__(raw=True)) if len(set(ids)) != len(ids): print( 'Conflict among models {}'.format( ', '.join([model._name for model in conflict_models]) ) ) counts = count_values(ids) case_conflicts = [ _id for _id in counts if counts[_id] > 1 ] ids = [ _id.lower() for _id in ids if _id ] counts = count_values(ids) no_case_conflicts = [ _id for _id in counts if counts[_id] > 1 ] return case_conflicts, no_case_conflicts guid_models = [models.Node, models.User, models.NodeFile, models.NodeWikiPage, models.MetaData] def migrate_guid(conflict_models): """Check GUID models for conflicts, then migrate records that are not in conflict. Lower-case primary keys; ensure GUIDs for each record; delete outdated GUIDs. """ case_conflicts, no_case_conflicts = check_conflicts(conflict_models) print 'Case conflicts', case_conflicts print 'No-case conflicts', no_case_conflicts if case_conflicts: raise Exception('Unavoidable conflicts') for model in conflict_models: print 'Working on model', model._name for obj in model.find(): if obj is None: continue # Check for existing GUID guid = models.Guid.load(obj._primary_key) print obj._primary_key if guid is not None: # Skip if GUID is already lower-cased if guid._primary_key == guid._primary_key.lower(): continue # Skip if GUID in no-case conflicts if guid._primary_key.lower() in no_case_conflicts: continue # Delete GUID record guid.remove_one(guid) # Lower-case if not in no-case conflicts if obj._primary_key.lower() not in no_case_conflicts: obj._primary_key = obj._primary_key.lower() obj.save() # Update GUID obj._ensure_guid() check_pk_change(obj) def check_pk_change(obj): for backref in obj._backrefs_flat: pk = backref[1] if backref[0][1] == 'guid': continue Schema = StoredObject.get_collection(backref[0][1]) record = Schema.load(pk) if record is None: print 'Error: Backref {} not found'.format(pk) field = getattr(record, backref[0][2]) if isinstance(field, list): if obj not in field: print 'Error: Object {} not in backref list'.format(pk) else: if field != obj: print 'Error: Object {} not equal to backref'.format(pk) for fname, fobj in obj._fields.items(): if fobj._is_foreign: if fobj._list: key = fobj._field_instance._backref_field_name else: key = fobj._backref_field_name if not key: continue backref_key = '__'.join([ obj._name, key, fname, ]) value = getattr(obj, fname) if not value: continue if fobj._list: for item in value: if item is None: continue if obj not in getattr(item, backref_key): print 'Error: Obj {} not in backrefs of referent {}'.format( obj._primary_key, fname ) else: if obj not in getattr(value, backref_key): print 'Error: Obj {} not in backrefs of referent {}'.format( obj._primary_key, fname ) def migrate_guid_log(log): """Migrate non-reference fields containing primary keys on logs. """ for key in ['project', 'node']: if key in log.params: value = log.params[key] or '' record = models.Node.load(value.lower()) if record is not None: log.params[key] = record._primary_key if 'contributor' in log.params: if isinstance(log.params['contributor'], basestring): record = models.User.load(log.params['contributor'].lower()) if record: log.params['contributor'] = record._primary_key if 'contributors' in log.params: for idx, uid in enumerate(log.params['contributors']): if isinstance(uid, basestring): record = models.User.load(uid.lower()) if record: log.params['contributors'][idx] = record._primary_key # Shouldn't have to do this, but some logs users weren't correctly # migrated; may have to do with inconsistent backrefs data = log.to_storage() if data['user']: record = models.User.load(data['user'].lower()) if record: log.user = record log.save() def migrate_guid_node(node): """Migrate non-reference fields containing primary keys on nodes. """ for idx, contributor in enumerate(node.contributor_list): if 'id' in contributor: record = models.User.load(contributor['id'].lower()) if record: node.contributor_list[idx]['id'] = record._primary_key for idx, fork in enumerate(node.node__forked): if isinstance(fork, basestring): record = models.Node.load(fork.lower()) if record: node.node__forked[idx] = record._primary_key for idx, registration in enumerate(node.node__registrations): if isinstance(registration, basestring): record = models.Node.load(registration.lower()) if record: node.node__registrations[idx] = record._primary_key for page in node.wiki_pages_current: record = models.NodeWikiPage.load(str(node.wiki_pages_current[page]).lower()) if record: node.wiki_pages_current[page] = record._primary_key for page in node.wiki_pages_versions: for idx, wid in enumerate(node.wiki_pages_versions[page]): record = models.NodeWikiPage.load(str(wid).lower()) if record: node.wiki_pages_versions[page][idx] = record._primary_key for fname in node.files_current: record = models.NodeFile.load(str(node.files_current[fname]).lower()) if record: node.files_current[fname] = record._primary_key for fname in node.files_versions: for idx, fid in enumerate(node.files_versions[fname]): record = models.NodeFile.load(str(fid).lower()) if record: node.files_versions[fname][idx] = record._primary_key node.save() def migrate_guid_wiki(wiki): """Migrate non-reference fields containing primary keys on wiki pages. """ data = wiki.to_storage() uid = data.get('user') if uid: record = models.User.load(uid.lower()) if record: wiki.user = record pid = data.get('node') if pid: record = models.Node.load(pid.lower()) if record: wiki.node = record wiki.save() if __name__ == '__main__': t0 = time.time() # Lower-case PKs and ensure GUIDs migrate_guid(guid_models) # Manual migrations for node in models.Node.find(): #print 'Migrating node', node._primary_key migrate_guid_node(node) for log in models.NodeLog.find(): #print 'Migrating log', log._primary_key migrate_guid_log(log) for wiki in models.NodeWikiPage.find(): #print 'Migrating wiki', wiki._primary_key migrate_guid_wiki(wiki) print 'Took {}'.format(time.time() - t0)
apache-2.0
[ 624, 199, 2499, 282, 21645, 367, 1006, 2222, 13, 17856, 3050, 5767, 14, 982, 2777, 2575, 965, 282, 21645, 12, 199, 2759, 27, 340, 2777, 965, 376, 2870, 1325, 440, 282, 21645, 12, 1218, 282, 21645, 4877, 314, 2870, 14, 7053, 590, 199, 3966, 5767, 911, 1172, 5323, 6937, 1183, 4046, 21645, 83, 14, 199, 624, 199, 199, 646, 900, 199, 646, 5055, 199, 199, 504, 10059, 14, 9217, 492, 9785, 581, 1692, 199, 199, 504, 10691, 492, 1709, 199, 504, 10691, 14, 571, 492, 4205, 63, 571, 199, 199, 571, 275, 4205, 63, 571, 360, 7360, 14, 1751, 297, 663, 63, 7765, 29, 549, 12, 15777, 29, 549, 9, 199, 199, 318, 2338, 63, 1459, 8, 1459, 304, 272, 8242, 275, 5055, 14, 21501, 8, 442, 9, 272, 367, 574, 315, 1338, 26, 267, 8242, 59, 585, 61, 847, 413, 272, 372, 8242, 199, 199, 318, 1104, 63, 22654, 8, 15207, 63, 992, 304, 339, 2762, 275, 942, 339, 367, 1402, 315, 12395, 63, 992, 26, 267, 2762, 847, 769, 8, 1238, 14, 1623, 11027, 1661, 721, 1773, 29, 549, 430, 339, 340, 822, 8, 409, 8, 1580, 430, 1137, 822, 8, 1580, 304, 267, 870, 8, 288, 283, 15919, 16885, 1709, 9499, 908, 8, 355, 1656, 1987, 904, 779, 1238, 423, 354, 367, 1402, 315, 12395, 63, 992, 566, 288, 776, 267, 776, 339, 8242, 275, 2338, 63, 1459, 8, 1580, 9, 272, 1930, 63, 22654, 275, 359, 267, 485, 344, 267, 367, 485, 344, 315, 8242, 267, 340, 8242, 13040, 344, 61, 690, 413, 272, 1622, 339, 2762, 275, 359, 267, 485, 344, 14, 2325, 342, 267, 367, 485, 344, 315, 2762, 267, 340, 485, 344, 272, 1622, 339, 8242, 275, 2338, 63, 1459, 8, 1580, 9, 272, 949, 63, 2546, 63, 22654, 275, 359, 267, 485, 344, 267, 367, 485, 344, 315, 8242, 267, 340, 8242, 13040, 344, 61, 690, 413, 272, 1622, 339, 372, 1930, 63, 22654, 12, 949, 63, 2546, 63, 22654, 421, 199, 9473, 63, 992, 275, 359, 992, 14, 1716, 12, 1709, 14, 1899, 12, 1709, 14, 1716, 1173, 12, 2049, 1709, 14, 1716, 26198, 3276, 12, 1709, 14, 25285, 61, 199, 199, 318, 12810, 63, 9473, 8, 15207, 63, 992, 304, 272, 408, 1799, 21645, 1709, 367, 18511, 12, 2066, 12810, 5767, 626, 787, 440, 315, 272, 12395, 14, 29893, 13, 2546, 5062, 2883, 27, 4868, 21645, 83, 367, 1924, 2777, 27, 3145, 272, 734, 19074, 21645, 83, 14, 339, 408, 272, 1930, 63, 22654, 12, 949, 63, 2546, 63, 22654, 275, 1104, 63, 22654, 8, 15207, 63, 992, 9, 339, 870, 283, 1538, 18511, 297, 1930, 63, 22654, 272, 870, 283, 1944, 13, 2546, 18511, 297, 949, 63, 2546, 63, 22654, 339, 340, 1930, 63, 22654, 26, 267, 746, 2186, 360, 1358, 27403, 461, 18511, 358, 339, 367, 1402, 315, 12395, 63, 992, 26, 398, 870, 283, 18356, 641, 1402, 297, 1402, 423, 354, 398, 367, 1559, 315, 1402, 14, 1623, 837, 953, 340, 1559, 365, 488, 26, 355, 1980, 953, 327, 2670, 367, 3411, 21645, 288, 15593, 275, 1709, 14, 18834, 14, 912, 8, 1113, 423, 3327, 63, 498, 9, 953, 870, 1559, 423, 3327, 63, 498, 953, 340, 15593, 365, 440, 488, 26, 2234, 327, 8232, 340, 21645, 365, 2575, 5117, 13, 32738, 355, 340, 15593, 423, 3327, 63, 498, 508, 15593, 423, 3327, 63, 498, 14, 2325, 837, 490, 1980, 2234, 327, 8232, 340, 21645, 315, 949, 13, 2546, 18511, 355, 340, 15593, 423, 3327, 63, 498, 14, 2325, 342, 315, 949, 63, 2546, 63, 22654, 26, 490, 1980, 2234, 327, 8496, 21645, 2777, 355, 15593, 14, 2168, 63, 368, 8, 9473, 9, 953, 327, 29893, 13, 2546, 340, 440, 315, 949, 13, 2546, 18511, 288, 340, 1559, 423, 3327, 63, 498, 14, 2325, 342, 440, 315, 949, 63, 2546, 63, 22654, 26, 355, 1559, 423, 3327, 63, 498, 275, 1559, 423, 3327, 63, 498, 14, 2325, 342, 355, 1559, 14, 2117, 342, 953, 327, 6162, 21645, 288, 1559, 423, 7505, 63, 9473, 342, 953, 1104, 63, 2051, 63, 1461, 8, 1113, 9, 421, 199, 318, 1104, 63, 2051, 63, 1461, 8, 1113, 304, 339, 367, 23412, 315, 1559, 423, 894, 7655, 63, 7088, 26, 267, 3803, 275, 23412, 59, 17, 61, 267, 340, 23412, 59, 16, 1527, 17, 61, 508, 283, 9473, 356, 288, 1980, 267, 13268, 275, 9785, 581, 1692, 14, 362, 63, 3627, 8, 894, 1121, 59, 16, 1527, 17, 566, 267, 2777, 275, 13268, 14, 912, 8, 2051, 9, 267, 340, 2777, 365, 488, 26, 288, 870, 283, 547, 26, 10257, 1121, 1052, 440, 1911, 1370, 908, 8, 2051, 9, 267, 901, 275, 2519, 8, 3059, 12, 23412, 59, 16, 1527, 18, 566, 267, 340, 1228, 8, 698, 12, 769, 304, 288, 340, 1559, 440, 315, 901, 26, 355, 870, 283, 547, 26, 6935, 1052, 440, 315, 23412, 769, 1370, 908, 8, 2051, 9, 267, 587, 26, 288, 340, 901, 1137, 1559, 26, 355, 870, 283, 547, 26, 6935, 1052, 440, 4472, 370, 23412, 1370, 908, 8, 2051, 9, 339, 367, 6748, 12, 29962, 315, 1559, 423, 955, 14, 1744, 837, 267, 340, 29962, 423, 374, 63, 6846, 26, 288, 340, 29962, 423, 513, 26, 355, 790, 275, 29962, 423, 698, 63, 842, 423, 894, 1121, 63, 698, 63, 354, 288, 587, 26, 355, 790, 275, 29962, 423, 894, 1121, 63, 698, 63, 354, 288, 340, 440, 790, 26, 355, 1980, 288, 23412, 63, 498, 275, 2560, 1370, 904, 779, 355, 1559, 423, 354, 12, 355, 790, 12, 355, 6748, 12, 355, 4794, 288, 574, 275, 2519, 8, 1113, 12, 6748, 9, 288, 340, 440, 574, 26, 355, 1980, 288, 340, 29962, 423, 513, 26, 355, 367, 1242, 315, 574, 26, 490, 340, 1242, 365, 488, 26, 717, 1980, 490, 340, 1559, 440, 315, 2519, 8, 1053, 12, 23412, 63, 498, 304, 717, 870, 283, 547, 26, 24921, 1052, 440, 315, 1771, 7655, 402, 295, 771, 640, 9499, 908, 8, 1169, 1559, 423, 3327, 63, 498, 12, 6748, 717, 776, 288, 587, 26, 355, 340, 1559, 440, 315, 2519, 8, 585, 12, 23412, 63, 498, 304, 490, 870, 283, 547, 26, 24921, 1052, 440, 315, 1771, 7655 ]
[ 199, 2499, 282, 21645, 367, 1006, 2222, 13, 17856, 3050, 5767, 14, 982, 2777, 2575, 965, 282, 21645, 12, 199, 2759, 27, 340, 2777, 965, 376, 2870, 1325, 440, 282, 21645, 12, 1218, 282, 21645, 4877, 314, 2870, 14, 7053, 590, 199, 3966, 5767, 911, 1172, 5323, 6937, 1183, 4046, 21645, 83, 14, 199, 624, 199, 199, 646, 900, 199, 646, 5055, 199, 199, 504, 10059, 14, 9217, 492, 9785, 581, 1692, 199, 199, 504, 10691, 492, 1709, 199, 504, 10691, 14, 571, 492, 4205, 63, 571, 199, 199, 571, 275, 4205, 63, 571, 360, 7360, 14, 1751, 297, 663, 63, 7765, 29, 549, 12, 15777, 29, 549, 9, 199, 199, 318, 2338, 63, 1459, 8, 1459, 304, 272, 8242, 275, 5055, 14, 21501, 8, 442, 9, 272, 367, 574, 315, 1338, 26, 267, 8242, 59, 585, 61, 847, 413, 272, 372, 8242, 199, 199, 318, 1104, 63, 22654, 8, 15207, 63, 992, 304, 339, 2762, 275, 942, 339, 367, 1402, 315, 12395, 63, 992, 26, 267, 2762, 847, 769, 8, 1238, 14, 1623, 11027, 1661, 721, 1773, 29, 549, 430, 339, 340, 822, 8, 409, 8, 1580, 430, 1137, 822, 8, 1580, 304, 267, 870, 8, 288, 283, 15919, 16885, 1709, 9499, 908, 8, 355, 1656, 1987, 904, 779, 1238, 423, 354, 367, 1402, 315, 12395, 63, 992, 566, 288, 776, 267, 776, 339, 8242, 275, 2338, 63, 1459, 8, 1580, 9, 272, 1930, 63, 22654, 275, 359, 267, 485, 344, 267, 367, 485, 344, 315, 8242, 267, 340, 8242, 13040, 344, 61, 690, 413, 272, 1622, 339, 2762, 275, 359, 267, 485, 344, 14, 2325, 342, 267, 367, 485, 344, 315, 2762, 267, 340, 485, 344, 272, 1622, 339, 8242, 275, 2338, 63, 1459, 8, 1580, 9, 272, 949, 63, 2546, 63, 22654, 275, 359, 267, 485, 344, 267, 367, 485, 344, 315, 8242, 267, 340, 8242, 13040, 344, 61, 690, 413, 272, 1622, 339, 372, 1930, 63, 22654, 12, 949, 63, 2546, 63, 22654, 421, 199, 9473, 63, 992, 275, 359, 992, 14, 1716, 12, 1709, 14, 1899, 12, 1709, 14, 1716, 1173, 12, 2049, 1709, 14, 1716, 26198, 3276, 12, 1709, 14, 25285, 61, 199, 199, 318, 12810, 63, 9473, 8, 15207, 63, 992, 304, 272, 408, 1799, 21645, 1709, 367, 18511, 12, 2066, 12810, 5767, 626, 787, 440, 315, 272, 12395, 14, 29893, 13, 2546, 5062, 2883, 27, 4868, 21645, 83, 367, 1924, 2777, 27, 3145, 272, 734, 19074, 21645, 83, 14, 339, 408, 272, 1930, 63, 22654, 12, 949, 63, 2546, 63, 22654, 275, 1104, 63, 22654, 8, 15207, 63, 992, 9, 339, 870, 283, 1538, 18511, 297, 1930, 63, 22654, 272, 870, 283, 1944, 13, 2546, 18511, 297, 949, 63, 2546, 63, 22654, 339, 340, 1930, 63, 22654, 26, 267, 746, 2186, 360, 1358, 27403, 461, 18511, 358, 339, 367, 1402, 315, 12395, 63, 992, 26, 398, 870, 283, 18356, 641, 1402, 297, 1402, 423, 354, 398, 367, 1559, 315, 1402, 14, 1623, 837, 953, 340, 1559, 365, 488, 26, 355, 1980, 953, 327, 2670, 367, 3411, 21645, 288, 15593, 275, 1709, 14, 18834, 14, 912, 8, 1113, 423, 3327, 63, 498, 9, 953, 870, 1559, 423, 3327, 63, 498, 953, 340, 15593, 365, 440, 488, 26, 2234, 327, 8232, 340, 21645, 365, 2575, 5117, 13, 32738, 355, 340, 15593, 423, 3327, 63, 498, 508, 15593, 423, 3327, 63, 498, 14, 2325, 837, 490, 1980, 2234, 327, 8232, 340, 21645, 315, 949, 13, 2546, 18511, 355, 340, 15593, 423, 3327, 63, 498, 14, 2325, 342, 315, 949, 63, 2546, 63, 22654, 26, 490, 1980, 2234, 327, 8496, 21645, 2777, 355, 15593, 14, 2168, 63, 368, 8, 9473, 9, 953, 327, 29893, 13, 2546, 340, 440, 315, 949, 13, 2546, 18511, 288, 340, 1559, 423, 3327, 63, 498, 14, 2325, 342, 440, 315, 949, 63, 2546, 63, 22654, 26, 355, 1559, 423, 3327, 63, 498, 275, 1559, 423, 3327, 63, 498, 14, 2325, 342, 355, 1559, 14, 2117, 342, 953, 327, 6162, 21645, 288, 1559, 423, 7505, 63, 9473, 342, 953, 1104, 63, 2051, 63, 1461, 8, 1113, 9, 421, 199, 318, 1104, 63, 2051, 63, 1461, 8, 1113, 304, 339, 367, 23412, 315, 1559, 423, 894, 7655, 63, 7088, 26, 267, 3803, 275, 23412, 59, 17, 61, 267, 340, 23412, 59, 16, 1527, 17, 61, 508, 283, 9473, 356, 288, 1980, 267, 13268, 275, 9785, 581, 1692, 14, 362, 63, 3627, 8, 894, 1121, 59, 16, 1527, 17, 566, 267, 2777, 275, 13268, 14, 912, 8, 2051, 9, 267, 340, 2777, 365, 488, 26, 288, 870, 283, 547, 26, 10257, 1121, 1052, 440, 1911, 1370, 908, 8, 2051, 9, 267, 901, 275, 2519, 8, 3059, 12, 23412, 59, 16, 1527, 18, 566, 267, 340, 1228, 8, 698, 12, 769, 304, 288, 340, 1559, 440, 315, 901, 26, 355, 870, 283, 547, 26, 6935, 1052, 440, 315, 23412, 769, 1370, 908, 8, 2051, 9, 267, 587, 26, 288, 340, 901, 1137, 1559, 26, 355, 870, 283, 547, 26, 6935, 1052, 440, 4472, 370, 23412, 1370, 908, 8, 2051, 9, 339, 367, 6748, 12, 29962, 315, 1559, 423, 955, 14, 1744, 837, 267, 340, 29962, 423, 374, 63, 6846, 26, 288, 340, 29962, 423, 513, 26, 355, 790, 275, 29962, 423, 698, 63, 842, 423, 894, 1121, 63, 698, 63, 354, 288, 587, 26, 355, 790, 275, 29962, 423, 894, 1121, 63, 698, 63, 354, 288, 340, 440, 790, 26, 355, 1980, 288, 23412, 63, 498, 275, 2560, 1370, 904, 779, 355, 1559, 423, 354, 12, 355, 790, 12, 355, 6748, 12, 355, 4794, 288, 574, 275, 2519, 8, 1113, 12, 6748, 9, 288, 340, 440, 574, 26, 355, 1980, 288, 340, 29962, 423, 513, 26, 355, 367, 1242, 315, 574, 26, 490, 340, 1242, 365, 488, 26, 717, 1980, 490, 340, 1559, 440, 315, 2519, 8, 1053, 12, 23412, 63, 498, 304, 717, 870, 283, 547, 26, 24921, 1052, 440, 315, 1771, 7655, 402, 295, 771, 640, 9499, 908, 8, 1169, 1559, 423, 3327, 63, 498, 12, 6748, 717, 776, 288, 587, 26, 355, 340, 1559, 440, 315, 2519, 8, 585, 12, 23412, 63, 498, 304, 490, 870, 283, 547, 26, 24921, 1052, 440, 315, 1771, 7655, 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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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 ]
ryfeus/lambda-packs
Tensorflow_LightGBM_Scipy_nightly/source/google/protobuf/internal/symbol_database_test.py
70
5650
#! /usr/bin/env python # # Protocol Buffers - Google's data interchange format # Copyright 2008 Google Inc. All rights reserved. # https://developers.google.com/protocol-buffers/ # # 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. """Tests for google.protobuf.symbol_database.""" try: import unittest2 as unittest #PY26 except ImportError: import unittest from google.protobuf import unittest_pb2 from google.protobuf import descriptor from google.protobuf import descriptor_pool from google.protobuf import symbol_database class SymbolDatabaseTest(unittest.TestCase): def _Database(self): if descriptor._USE_C_DESCRIPTORS: # The C++ implementation does not allow mixing descriptors from # different pools. db = symbol_database.SymbolDatabase(pool=descriptor_pool.Default()) else: db = symbol_database.SymbolDatabase() # Register representative types from unittest_pb2. db.RegisterFileDescriptor(unittest_pb2.DESCRIPTOR) db.RegisterMessage(unittest_pb2.TestAllTypes) db.RegisterMessage(unittest_pb2.TestAllTypes.NestedMessage) db.RegisterMessage(unittest_pb2.TestAllTypes.OptionalGroup) db.RegisterMessage(unittest_pb2.TestAllTypes.RepeatedGroup) db.RegisterEnumDescriptor(unittest_pb2.ForeignEnum.DESCRIPTOR) db.RegisterEnumDescriptor(unittest_pb2.TestAllTypes.NestedEnum.DESCRIPTOR) db.RegisterServiceDescriptor(unittest_pb2._TESTSERVICE) return db def testGetPrototype(self): instance = self._Database().GetPrototype( unittest_pb2.TestAllTypes.DESCRIPTOR) self.assertTrue(instance is unittest_pb2.TestAllTypes) def testGetMessages(self): messages = self._Database().GetMessages( ['google/protobuf/unittest.proto']) self.assertTrue( unittest_pb2.TestAllTypes is messages['protobuf_unittest.TestAllTypes']) def testGetSymbol(self): self.assertEqual( unittest_pb2.TestAllTypes, self._Database().GetSymbol( 'protobuf_unittest.TestAllTypes')) self.assertEqual( unittest_pb2.TestAllTypes.NestedMessage, self._Database().GetSymbol( 'protobuf_unittest.TestAllTypes.NestedMessage')) self.assertEqual( unittest_pb2.TestAllTypes.OptionalGroup, self._Database().GetSymbol( 'protobuf_unittest.TestAllTypes.OptionalGroup')) self.assertEqual( unittest_pb2.TestAllTypes.RepeatedGroup, self._Database().GetSymbol( 'protobuf_unittest.TestAllTypes.RepeatedGroup')) def testEnums(self): # Check registration of types in the pool. self.assertEqual( 'protobuf_unittest.ForeignEnum', self._Database().pool.FindEnumTypeByName( 'protobuf_unittest.ForeignEnum').full_name) self.assertEqual( 'protobuf_unittest.TestAllTypes.NestedEnum', self._Database().pool.FindEnumTypeByName( 'protobuf_unittest.TestAllTypes.NestedEnum').full_name) def testFindMessageTypeByName(self): self.assertEqual( 'protobuf_unittest.TestAllTypes', self._Database().pool.FindMessageTypeByName( 'protobuf_unittest.TestAllTypes').full_name) self.assertEqual( 'protobuf_unittest.TestAllTypes.NestedMessage', self._Database().pool.FindMessageTypeByName( 'protobuf_unittest.TestAllTypes.NestedMessage').full_name) def testFindServiceByName(self): self.assertEqual( 'protobuf_unittest.TestService', self._Database().pool.FindServiceByName( 'protobuf_unittest.TestService').full_name) def testFindFileContainingSymbol(self): # Lookup based on either enum or message. self.assertEqual( 'google/protobuf/unittest.proto', self._Database().pool.FindFileContainingSymbol( 'protobuf_unittest.TestAllTypes.NestedEnum').name) self.assertEqual( 'google/protobuf/unittest.proto', self._Database().pool.FindFileContainingSymbol( 'protobuf_unittest.TestAllTypes').name) def testFindFileByName(self): self.assertEqual( 'google/protobuf/unittest.proto', self._Database().pool.FindFileByName( 'google/protobuf/unittest.proto').name) if __name__ == '__main__': unittest.main()
mit
[ 3168, 1182, 2647, 15, 1393, 15, 1813, 2366, 199, 3, 199, 3, 11557, 699, 3043, 1192, 446, 4475, 1159, 666, 1640, 1461, 1475, 199, 3, 1898, 9079, 4475, 3277, 14, 221, 2900, 4481, 4644, 14, 199, 3, 4178, 921, 23826, 14, 3098, 14, 957, 15, 3922, 13, 17389, 15, 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, 2925, 367, 6233, 14, 7204, 14, 5155, 63, 4659, 1041, 199, 199, 893, 26, 523, 492, 2882, 18, 465, 2882, 221, 327, 4521, 1479, 199, 2590, 3545, 26, 523, 492, 2882, 199, 199, 504, 6233, 14, 7204, 492, 2882, 63, 3317, 18, 199, 504, 6233, 14, 7204, 492, 5872, 199, 504, 6233, 14, 7204, 492, 5872, 63, 2293, 199, 504, 6233, 14, 7204, 492, 5272, 63, 4659, 421, 199, 533, 10080, 7243, 774, 8, 2796, 14, 1746, 304, 819, 347, 485, 7243, 8, 277, 304, 272, 340, 5872, 423, 4701, 63, 35, 63, 6597, 4149, 26, 489, 327, 710, 445, 4176, 4514, 1630, 440, 2040, 13667, 316, 15428, 687, 489, 327, 3365, 20092, 14, 489, 1592, 275, 5272, 63, 4659, 14, 8169, 7243, 8, 2293, 29, 4120, 63, 2293, 14, 2698, 1012, 272, 587, 26, 489, 1592, 275, 5272, 63, 4659, 14, 8169, 7243, 342, 272, 327, 11828, 2954, 1905, 2943, 687, 2882, 63, 3317, 18, 14, 272, 1592, 14, 7099, 23859, 8, 2796, 63, 3317, 18, 14, 7580, 9, 272, 1592, 14, 20917, 8, 2796, 63, 3317, 18, 14, 14973, 9, 272, 1592, 14, 20917, 8, 2796, 63, 3317, 18, 14, 14973, 14, 22808, 9, 272, 1592, 14, 20917, 8, 2796, 63, 3317, 18, 14, 14973, 14, 7012, 2448, 9, 272, 1592, 14, 20917, 8, 2796, 63, 3317, 18, 14, 14973, 14, 19390, 2448, 9, 272, 1592, 14, 7099, 5081, 4311, 8, 2796, 63, 3317, 18, 14, 20931, 5081, 14, 7580, 9, 272, 1592, 14, 7099, 5081, 4311, 8, 2796, 63, 3317, 18, 14, 14973, 14, 13029, 5081, 14, 7580, 9, 272, 1592, 14, 7099, 3167, 4311, 8, 2796, 63, 3317, 18, 423, 2864, 10486, 9, 272, 372, 1592, 819, 347, 19970, 25565, 8, 277, 304, 272, 1256, 275, 291, 423, 7243, 1252, 1002, 25565, 8, 267, 2882, 63, 3317, 18, 14, 14973, 14, 7580, 9, 272, 291, 14, 1815, 8, 842, 365, 2882, 63, 3317, 18, 14, 14973, 9, 819, 347, 19970, 14508, 8, 277, 304, 272, 3788, 275, 291, 423, 7243, 1252, 1002, 14508, 8, 267, 788, 3098, 15, 7204, 15, 2796, 14, 2625, 1105, 272, 291, 14, 1815, 8, 267, 2882, 63, 3317, 18, 14, 14973, 365, 267, 3788, 459, 7204, 63, 2796, 14, 14973, 1105, 819, 347, 19970, 8169, 8, 277, 304, 272, 291, 14, 629, 8, 267, 2882, 63, 3317, 18, 14, 14973, 12, 291, 423, 7243, 1252, 1002, 8169, 8, 288, 283, 7204, 63, 2796, 14, 14973, 1333, 272, 291, 14, 629, 8, 267, 2882, 63, 3317, 18, 14, 14973, 14, 22808, 12, 291, 423, 7243, 1252, 1002, 8169, 8, 288, 283, 7204, 63, 2796, 14, 14973, 14, 22808, 1333, 272, 291, 14, 629, 8, 267, 2882, 63, 3317, 18, 14, 14973, 14, 7012, 2448, 12, 291, 423, 7243, 1252, 1002, 8169, 8, 288, 283, 7204, 63, 2796, 14, 14973, 14, 7012, 2448, 1333, 272, 291, 14, 629, 8, 267, 2882, 63, 3317, 18, 14, 14973, 14, 19390, 2448, 12, 291, 423, 7243, 1252, 1002, 8169, 8, 288, 283, 7204, 63, 2796, 14, 14973, 14, 19390, 2448, 1333, 819, 347, 511, 5081, 83, 8, 277, 304, 272, 327, 2670, 10991, 402, 2943, 315, 314, 4203, 14, 272, 291, 14, 629, 8, 267, 283, 7204, 63, 2796, 14, 20931, 5081, 297, 267, 291, 423, 7243, 1252, 2293, 14, 6591, 5081, 804, 11190, 8, 288, 283, 7204, 63, 2796, 14, 20931, 5081, 1959, 2861, 63, 354, 9, 272, 291, 14, 629, 8, 267, 283, 7204, 63, 2796, 14, 14973, 14, 13029, 5081, 297, 267, 291, 423, 7243, 1252, 2293, 14, 6591, 5081, 804, 11190, 8, 288, 283, 7204, 63, 2796, 14, 14973, 14, 13029, 5081, 1959, 2861, 63, 354, 9, 819, 347, 511, 6591, 12091, 11190, 8, 277, 304, 272, 291, 14, 629, 8, 267, 283, 7204, 63, 2796, 14, 14973, 297, 267, 291, 423, 7243, 1252, 2293, 14, 6591, 12091, 11190, 8, 288, 283, 7204, 63, 2796, 14, 14973, 1959, 2861, 63, 354, 9, 272, 291, 14, 629, 8, 267, 283, 7204, 63, 2796, 14, 14973, 14, 22808, 297 ]
[ 1182, 2647, 15, 1393, 15, 1813, 2366, 199, 3, 199, 3, 11557, 699, 3043, 1192, 446, 4475, 1159, 666, 1640, 1461, 1475, 199, 3, 1898, 9079, 4475, 3277, 14, 221, 2900, 4481, 4644, 14, 199, 3, 4178, 921, 23826, 14, 3098, 14, 957, 15, 3922, 13, 17389, 15, 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, 2925, 367, 6233, 14, 7204, 14, 5155, 63, 4659, 1041, 199, 199, 893, 26, 523, 492, 2882, 18, 465, 2882, 221, 327, 4521, 1479, 199, 2590, 3545, 26, 523, 492, 2882, 199, 199, 504, 6233, 14, 7204, 492, 2882, 63, 3317, 18, 199, 504, 6233, 14, 7204, 492, 5872, 199, 504, 6233, 14, 7204, 492, 5872, 63, 2293, 199, 504, 6233, 14, 7204, 492, 5272, 63, 4659, 421, 199, 533, 10080, 7243, 774, 8, 2796, 14, 1746, 304, 819, 347, 485, 7243, 8, 277, 304, 272, 340, 5872, 423, 4701, 63, 35, 63, 6597, 4149, 26, 489, 327, 710, 445, 4176, 4514, 1630, 440, 2040, 13667, 316, 15428, 687, 489, 327, 3365, 20092, 14, 489, 1592, 275, 5272, 63, 4659, 14, 8169, 7243, 8, 2293, 29, 4120, 63, 2293, 14, 2698, 1012, 272, 587, 26, 489, 1592, 275, 5272, 63, 4659, 14, 8169, 7243, 342, 272, 327, 11828, 2954, 1905, 2943, 687, 2882, 63, 3317, 18, 14, 272, 1592, 14, 7099, 23859, 8, 2796, 63, 3317, 18, 14, 7580, 9, 272, 1592, 14, 20917, 8, 2796, 63, 3317, 18, 14, 14973, 9, 272, 1592, 14, 20917, 8, 2796, 63, 3317, 18, 14, 14973, 14, 22808, 9, 272, 1592, 14, 20917, 8, 2796, 63, 3317, 18, 14, 14973, 14, 7012, 2448, 9, 272, 1592, 14, 20917, 8, 2796, 63, 3317, 18, 14, 14973, 14, 19390, 2448, 9, 272, 1592, 14, 7099, 5081, 4311, 8, 2796, 63, 3317, 18, 14, 20931, 5081, 14, 7580, 9, 272, 1592, 14, 7099, 5081, 4311, 8, 2796, 63, 3317, 18, 14, 14973, 14, 13029, 5081, 14, 7580, 9, 272, 1592, 14, 7099, 3167, 4311, 8, 2796, 63, 3317, 18, 423, 2864, 10486, 9, 272, 372, 1592, 819, 347, 19970, 25565, 8, 277, 304, 272, 1256, 275, 291, 423, 7243, 1252, 1002, 25565, 8, 267, 2882, 63, 3317, 18, 14, 14973, 14, 7580, 9, 272, 291, 14, 1815, 8, 842, 365, 2882, 63, 3317, 18, 14, 14973, 9, 819, 347, 19970, 14508, 8, 277, 304, 272, 3788, 275, 291, 423, 7243, 1252, 1002, 14508, 8, 267, 788, 3098, 15, 7204, 15, 2796, 14, 2625, 1105, 272, 291, 14, 1815, 8, 267, 2882, 63, 3317, 18, 14, 14973, 365, 267, 3788, 459, 7204, 63, 2796, 14, 14973, 1105, 819, 347, 19970, 8169, 8, 277, 304, 272, 291, 14, 629, 8, 267, 2882, 63, 3317, 18, 14, 14973, 12, 291, 423, 7243, 1252, 1002, 8169, 8, 288, 283, 7204, 63, 2796, 14, 14973, 1333, 272, 291, 14, 629, 8, 267, 2882, 63, 3317, 18, 14, 14973, 14, 22808, 12, 291, 423, 7243, 1252, 1002, 8169, 8, 288, 283, 7204, 63, 2796, 14, 14973, 14, 22808, 1333, 272, 291, 14, 629, 8, 267, 2882, 63, 3317, 18, 14, 14973, 14, 7012, 2448, 12, 291, 423, 7243, 1252, 1002, 8169, 8, 288, 283, 7204, 63, 2796, 14, 14973, 14, 7012, 2448, 1333, 272, 291, 14, 629, 8, 267, 2882, 63, 3317, 18, 14, 14973, 14, 19390, 2448, 12, 291, 423, 7243, 1252, 1002, 8169, 8, 288, 283, 7204, 63, 2796, 14, 14973, 14, 19390, 2448, 1333, 819, 347, 511, 5081, 83, 8, 277, 304, 272, 327, 2670, 10991, 402, 2943, 315, 314, 4203, 14, 272, 291, 14, 629, 8, 267, 283, 7204, 63, 2796, 14, 20931, 5081, 297, 267, 291, 423, 7243, 1252, 2293, 14, 6591, 5081, 804, 11190, 8, 288, 283, 7204, 63, 2796, 14, 20931, 5081, 1959, 2861, 63, 354, 9, 272, 291, 14, 629, 8, 267, 283, 7204, 63, 2796, 14, 14973, 14, 13029, 5081, 297, 267, 291, 423, 7243, 1252, 2293, 14, 6591, 5081, 804, 11190, 8, 288, 283, 7204, 63, 2796, 14, 14973, 14, 13029, 5081, 1959, 2861, 63, 354, 9, 819, 347, 511, 6591, 12091, 11190, 8, 277, 304, 272, 291, 14, 629, 8, 267, 283, 7204, 63, 2796, 14, 14973, 297, 267, 291, 423, 7243, 1252, 2293, 14, 6591, 12091, 11190, 8, 288, 283, 7204, 63, 2796, 14, 14973, 1959, 2861, 63, 354, 9, 272, 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1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
iivic/BoiseStateX
lms/djangoapps/certificates/tests/tests.py
87
4494
""" Tests for the certificates models. """ from ddt import ddt, data, unpack from mock import patch from django.conf import settings from nose.plugins.attrib import attr from xmodule.modulestore.tests.factories import CourseFactory from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase from student.tests.factories import UserFactory from certificates.models import ( CertificateStatuses, GeneratedCertificate, certificate_status_for_student, certificate_info_for_user ) from certificates.tests.factories import GeneratedCertificateFactory from util.milestones_helpers import ( set_prerequisite_courses, milestones_achieved_by_user, seed_milestone_relationship_types, ) @attr('shard_1') @ddt class CertificatesModelTest(ModuleStoreTestCase): """ Tests for the GeneratedCertificate model """ def test_certificate_status_for_student(self): student = UserFactory() course = CourseFactory.create(org='edx', number='verified', display_name='Verified Course') certificate_status = certificate_status_for_student(student, course.id) self.assertEqual(certificate_status['status'], CertificateStatuses.unavailable) self.assertEqual(certificate_status['mode'], GeneratedCertificate.MODES.honor) @unpack @data( {'allow_certificate': False, 'whitelisted': False, 'grade': None, 'output': ['N', 'N', 'N/A']}, {'allow_certificate': True, 'whitelisted': True, 'grade': None, 'output': ['Y', 'N', 'N/A']}, {'allow_certificate': True, 'whitelisted': False, 'grade': 0.9, 'output': ['Y', 'N', 'N/A']}, {'allow_certificate': False, 'whitelisted': True, 'grade': 0.8, 'output': ['N', 'N', 'N/A']}, {'allow_certificate': False, 'whitelisted': None, 'grade': 0.8, 'output': ['N', 'N', 'N/A']} ) def test_certificate_info_for_user(self, allow_certificate, whitelisted, grade, output): """ Verify that certificate_info_for_user works. """ student = UserFactory() course = CourseFactory.create(org='edx', number='verified', display_name='Verified Course') student.profile.allow_certificate = allow_certificate student.profile.save() certificate_info = certificate_info_for_user(student, course.id, grade, whitelisted) self.assertEqual(certificate_info, output) @patch.dict(settings.FEATURES, {'ENABLE_PREREQUISITE_COURSES': True, 'MILESTONES_APP': True}) def test_course_milestone_collected(self): seed_milestone_relationship_types() student = UserFactory() course = CourseFactory.create(org='edx', number='998', display_name='Test Course') pre_requisite_course = CourseFactory.create(org='edx', number='999', display_name='Pre requisite Course') # set pre-requisite course set_prerequisite_courses(course.id, [unicode(pre_requisite_course.id)]) # get milestones collected by user before completing the pre-requisite course completed_milestones = milestones_achieved_by_user(student, unicode(pre_requisite_course.id)) self.assertEqual(len(completed_milestones), 0) GeneratedCertificateFactory.create( user=student, course_id=pre_requisite_course.id, status=CertificateStatuses.generating, mode='verified' ) # get milestones collected by user after user has completed the pre-requisite course completed_milestones = milestones_achieved_by_user(student, unicode(pre_requisite_course.id)) self.assertEqual(len(completed_milestones), 1) self.assertEqual(completed_milestones[0]['namespace'], unicode(pre_requisite_course.id)) @patch.dict(settings.FEATURES, {'ENABLE_OPENBADGES': True}) @patch('certificates.badge_handler.BadgeHandler', spec=True) def test_badge_callback(self, handler): student = UserFactory() course = CourseFactory.create(org='edx', number='998', display_name='Test Course', issue_badges=True) cert = GeneratedCertificateFactory.create( user=student, course_id=course.id, status=CertificateStatuses.generating, mode='verified' ) # Check return value since class instance will be stored there. self.assertFalse(handler.return_value.award.called) cert.status = CertificateStatuses.downloadable cert.save() self.assertTrue(handler.return_value.award.called)
agpl-3.0
[ 624, 199, 2925, 367, 314, 14512, 1709, 14, 199, 624, 199, 504, 366, 3583, 492, 366, 3583, 12, 666, 12, 7787, 199, 504, 1683, 492, 3371, 199, 504, 1639, 14, 2190, 492, 2202, 199, 504, 11354, 14, 5265, 14, 6640, 492, 1921, 199, 199, 504, 9872, 14, 10012, 14, 2219, 14, 15406, 492, 17862, 199, 504, 9872, 14, 10012, 14, 2219, 14, 1176, 63, 1208, 492, 17996, 1746, 199, 199, 504, 6474, 14, 2219, 14, 15406, 492, 16047, 199, 504, 14512, 14, 992, 492, 334, 272, 12904, 11232, 5589, 12, 272, 17065, 11414, 12, 272, 5897, 63, 1205, 63, 509, 63, 5500, 12, 272, 5897, 63, 815, 63, 509, 63, 751, 199, 9, 199, 504, 14512, 14, 2219, 14, 15406, 492, 17065, 11414, 2927, 199, 199, 504, 4884, 14, 77, 24156, 63, 7546, 492, 334, 272, 663, 63, 657, 21763, 63, 11653, 12, 272, 333, 24156, 63, 1225, 1873, 1354, 63, 991, 63, 751, 12, 272, 6347, 63, 25324, 63, 11704, 63, 1313, 12, 199, 9, 421, 199, 32, 962, 360, 10810, 63, 17, 358, 199, 32, 11138, 199, 533, 12904, 83, 1685, 774, 8, 27863, 304, 272, 408, 272, 6496, 367, 314, 17065, 11414, 1402, 272, 408, 339, 347, 511, 63, 6999, 63, 1205, 63, 509, 63, 5500, 8, 277, 304, 267, 6474, 275, 16047, 342, 267, 2518, 275, 17862, 14, 981, 8, 1308, 534, 8268, 297, 1329, 534, 12949, 297, 2929, 63, 354, 534, 3673, 4541, 5531, 358, 398, 5897, 63, 1205, 275, 5897, 63, 1205, 63, 509, 63, 5500, 8, 5500, 12, 2518, 14, 344, 9, 267, 291, 14, 629, 8, 6999, 63, 1205, 459, 1205, 995, 12904, 11232, 5589, 14, 28119, 9, 267, 291, 14, 629, 8, 6999, 63, 1205, 459, 632, 995, 17065, 11414, 14, 31095, 14, 19923, 9, 339, 768, 5301, 272, 768, 576, 8, 267, 791, 3306, 63, 6999, 356, 756, 12, 283, 7510, 15023, 356, 756, 12, 283, 4523, 356, 488, 12, 283, 1199, 356, 788, 46, 297, 283, 46, 297, 283, 46, 15, 33, 14949, 267, 791, 3306, 63, 6999, 356, 715, 12, 283, 7510, 15023, 356, 715, 12, 283, 4523, 356, 488, 12, 283, 1199, 356, 788, 57, 297, 283, 46, 297, 283, 46, 15, 33, 14949, 267, 791, 3306, 63, 6999, 356, 715, 12, 283, 7510, 15023, 356, 756, 12, 283, 4523, 356, 378, 14, 25, 12, 283, 1199, 356, 788, 57, 297, 283, 46, 297, 283, 46, 15, 33, 14949, 267, 791, 3306, 63, 6999, 356, 756, 12, 283, 7510, 15023, 356, 715, 12, 283, 4523, 356, 378, 14, 24, 12, 283, 1199, 356, 788, 46, 297, 283, 46, 297, 283, 46, 15, 33, 14949, 267, 791, 3306, 63, 6999, 356, 756, 12, 283, 7510, 15023, 356, 488, 12, 283, 4523, 356, 378, 14, 24, 12, 283, 1199, 356, 788, 46, 297, 283, 46, 297, 283, 46, 15, 33, 12074, 272, 776, 272, 347, 511, 63, 6999, 63, 815, 63, 509, 63, 751, 8, 277, 12, 2040, 63, 6999, 12, 10424, 15023, 12, 16183, 12, 1072, 304, 267, 408, 267, 7635, 626, 5897, 63, 815, 63, 509, 63, 751, 5419, 14, 267, 408, 267, 6474, 275, 16047, 342, 267, 2518, 275, 17862, 14, 981, 8, 1308, 534, 8268, 297, 1329, 534, 12949, 297, 2929, 63, 354, 534, 3673, 4541, 5531, 358, 267, 6474, 14, 2913, 14, 3306, 63, 6999, 275, 2040, 63, 6999, 267, 6474, 14, 2913, 14, 2117, 342, 398, 5897, 63, 815, 275, 5897, 63, 815, 63, 509, 63, 751, 8, 5500, 12, 2518, 14, 344, 12, 16183, 12, 10424, 15023, 9, 267, 291, 14, 629, 8, 6999, 63, 815, 12, 1072, 9, 339, 768, 2068, 14, 807, 8, 1751, 14, 13313, 12, 791, 8898, 63, 3311, 28106, 2328, 1311, 4427, 63, 1439, 28746, 654, 356, 715, 12, 283, 45, 1193, 1719, 615, 654, 63, 7121, 356, 715, 1552, 272, 347, 511, 63, 1972, 63, 25324, 63, 22766, 8, 277, 304, 267, 6347, 63, 25324, 63, 11704, 63, 1313, 342, 267, 6474, 275, 16047, 342, 267, 2518, 275, 17862, 14, 981, 8, 1308, 534, 8268, 297, 1329, 534, 13830, 297, 2929, 63, 354, 534, 774, 5531, 358, 267, 876, 63, 21763, 63, 1972, 275, 17862, 14, 981, 8, 1308, 534, 8268, 297, 1329, 534, 5637, 297, 2929, 63, 354, 534, 2398, 295, 783, 2124, 5531, 358, 267, 327, 663, 876, 13, 21763, 2518, 267, 663, 63, 657, 21763, 63, 11653, 8, 1972, 14, 344, 12, 359, 2975, 8, 657, 63, 21763, 63, 1972, 14, 344, 3948, 267, 327, 664, 333, 24156, 13736, 701, 922, 2544, 2831, 1337, 314, 876, 13, 21763, 2518, 267, 9709, 63, 77, 24156, 275, 333, 24156, 63, 1225, 1873, 1354, 63, 991, 63, 751, 8, 5500, 12, 2649, 8, 657, 63, 21763, 63, 1972, 14, 344, 430, 267, 291, 14, 629, 8, 552, 8, 12634, 63, 77, 24156, 395, 378, 9, 398, 17065, 11414, 2927, 14, 981, 8, 288, 922, 29, 5500, 12, 288, 2518, 63, 344, 29, 657, 63, 21763, 63, 1972, 14, 344, 12, 288, 2004, 29, 11414, 11232, 5589, 14, 2038, 1958, 12, 288, 818, 534, 12949, 7, 267, 776, 267, 327, 664, 333, 24156, 13736, 701, 922, 2410, 922, 965, 9709, 314, 876, 13, 21763, 2518, 267, 9709, 63, 77, 24156, 275, 333, 24156, 63, 1225, 1873, 1354, 63, 991, 63, 751, 8, 5500, 12, 2649, 8, 657, 63, 21763, 63, 1972, 14, 344, 430, 267, 291, 14, 629, 8, 552, 8, 12634, 63, 77, 24156, 395, 413, 9, 267, 291, 14, 629, 8, 12634, 63, 77, 24156, 59, 16, 2733, 3251, 995, 2649, 8, 657, 63, 21763, 63, 1972, 14, 344, 430, 339, 768, 2068, 14, 807, 8, 1751, 14, 13313, 12, 791, 8898, 63, 9935, 9439, 39, 654, 356, 715, 1552, 272, 768, 2068, 360, 16159, 14, 18465, 63, 2232, 14, 5725, 303, 2461, 297, 3158, 29, 549, 9, 272, 347, 511, 63, 18465, 63, 3058, 8, 277, 12, 3016, 304, 267, 6474, 275, 16047, 342, 267, 2518, 275, 17862, 14, 981, 8, 1308, 534, 8268, 297, 1329, 534, 13830, 297, 2929, 63, 354, 534, 774, 5531, 297, 4976, 63, 4087, 3389, 29, 549, 9, 267, 6250, 275, 17065, 11414, 2927, 14, 981, 8, 288, 922, 29, 5500, 12, 288 ]
[ 199, 2925, 367, 314, 14512, 1709, 14, 199, 624, 199, 504, 366, 3583, 492, 366, 3583, 12, 666, 12, 7787, 199, 504, 1683, 492, 3371, 199, 504, 1639, 14, 2190, 492, 2202, 199, 504, 11354, 14, 5265, 14, 6640, 492, 1921, 199, 199, 504, 9872, 14, 10012, 14, 2219, 14, 15406, 492, 17862, 199, 504, 9872, 14, 10012, 14, 2219, 14, 1176, 63, 1208, 492, 17996, 1746, 199, 199, 504, 6474, 14, 2219, 14, 15406, 492, 16047, 199, 504, 14512, 14, 992, 492, 334, 272, 12904, 11232, 5589, 12, 272, 17065, 11414, 12, 272, 5897, 63, 1205, 63, 509, 63, 5500, 12, 272, 5897, 63, 815, 63, 509, 63, 751, 199, 9, 199, 504, 14512, 14, 2219, 14, 15406, 492, 17065, 11414, 2927, 199, 199, 504, 4884, 14, 77, 24156, 63, 7546, 492, 334, 272, 663, 63, 657, 21763, 63, 11653, 12, 272, 333, 24156, 63, 1225, 1873, 1354, 63, 991, 63, 751, 12, 272, 6347, 63, 25324, 63, 11704, 63, 1313, 12, 199, 9, 421, 199, 32, 962, 360, 10810, 63, 17, 358, 199, 32, 11138, 199, 533, 12904, 83, 1685, 774, 8, 27863, 304, 272, 408, 272, 6496, 367, 314, 17065, 11414, 1402, 272, 408, 339, 347, 511, 63, 6999, 63, 1205, 63, 509, 63, 5500, 8, 277, 304, 267, 6474, 275, 16047, 342, 267, 2518, 275, 17862, 14, 981, 8, 1308, 534, 8268, 297, 1329, 534, 12949, 297, 2929, 63, 354, 534, 3673, 4541, 5531, 358, 398, 5897, 63, 1205, 275, 5897, 63, 1205, 63, 509, 63, 5500, 8, 5500, 12, 2518, 14, 344, 9, 267, 291, 14, 629, 8, 6999, 63, 1205, 459, 1205, 995, 12904, 11232, 5589, 14, 28119, 9, 267, 291, 14, 629, 8, 6999, 63, 1205, 459, 632, 995, 17065, 11414, 14, 31095, 14, 19923, 9, 339, 768, 5301, 272, 768, 576, 8, 267, 791, 3306, 63, 6999, 356, 756, 12, 283, 7510, 15023, 356, 756, 12, 283, 4523, 356, 488, 12, 283, 1199, 356, 788, 46, 297, 283, 46, 297, 283, 46, 15, 33, 14949, 267, 791, 3306, 63, 6999, 356, 715, 12, 283, 7510, 15023, 356, 715, 12, 283, 4523, 356, 488, 12, 283, 1199, 356, 788, 57, 297, 283, 46, 297, 283, 46, 15, 33, 14949, 267, 791, 3306, 63, 6999, 356, 715, 12, 283, 7510, 15023, 356, 756, 12, 283, 4523, 356, 378, 14, 25, 12, 283, 1199, 356, 788, 57, 297, 283, 46, 297, 283, 46, 15, 33, 14949, 267, 791, 3306, 63, 6999, 356, 756, 12, 283, 7510, 15023, 356, 715, 12, 283, 4523, 356, 378, 14, 24, 12, 283, 1199, 356, 788, 46, 297, 283, 46, 297, 283, 46, 15, 33, 14949, 267, 791, 3306, 63, 6999, 356, 756, 12, 283, 7510, 15023, 356, 488, 12, 283, 4523, 356, 378, 14, 24, 12, 283, 1199, 356, 788, 46, 297, 283, 46, 297, 283, 46, 15, 33, 12074, 272, 776, 272, 347, 511, 63, 6999, 63, 815, 63, 509, 63, 751, 8, 277, 12, 2040, 63, 6999, 12, 10424, 15023, 12, 16183, 12, 1072, 304, 267, 408, 267, 7635, 626, 5897, 63, 815, 63, 509, 63, 751, 5419, 14, 267, 408, 267, 6474, 275, 16047, 342, 267, 2518, 275, 17862, 14, 981, 8, 1308, 534, 8268, 297, 1329, 534, 12949, 297, 2929, 63, 354, 534, 3673, 4541, 5531, 358, 267, 6474, 14, 2913, 14, 3306, 63, 6999, 275, 2040, 63, 6999, 267, 6474, 14, 2913, 14, 2117, 342, 398, 5897, 63, 815, 275, 5897, 63, 815, 63, 509, 63, 751, 8, 5500, 12, 2518, 14, 344, 12, 16183, 12, 10424, 15023, 9, 267, 291, 14, 629, 8, 6999, 63, 815, 12, 1072, 9, 339, 768, 2068, 14, 807, 8, 1751, 14, 13313, 12, 791, 8898, 63, 3311, 28106, 2328, 1311, 4427, 63, 1439, 28746, 654, 356, 715, 12, 283, 45, 1193, 1719, 615, 654, 63, 7121, 356, 715, 1552, 272, 347, 511, 63, 1972, 63, 25324, 63, 22766, 8, 277, 304, 267, 6347, 63, 25324, 63, 11704, 63, 1313, 342, 267, 6474, 275, 16047, 342, 267, 2518, 275, 17862, 14, 981, 8, 1308, 534, 8268, 297, 1329, 534, 13830, 297, 2929, 63, 354, 534, 774, 5531, 358, 267, 876, 63, 21763, 63, 1972, 275, 17862, 14, 981, 8, 1308, 534, 8268, 297, 1329, 534, 5637, 297, 2929, 63, 354, 534, 2398, 295, 783, 2124, 5531, 358, 267, 327, 663, 876, 13, 21763, 2518, 267, 663, 63, 657, 21763, 63, 11653, 8, 1972, 14, 344, 12, 359, 2975, 8, 657, 63, 21763, 63, 1972, 14, 344, 3948, 267, 327, 664, 333, 24156, 13736, 701, 922, 2544, 2831, 1337, 314, 876, 13, 21763, 2518, 267, 9709, 63, 77, 24156, 275, 333, 24156, 63, 1225, 1873, 1354, 63, 991, 63, 751, 8, 5500, 12, 2649, 8, 657, 63, 21763, 63, 1972, 14, 344, 430, 267, 291, 14, 629, 8, 552, 8, 12634, 63, 77, 24156, 395, 378, 9, 398, 17065, 11414, 2927, 14, 981, 8, 288, 922, 29, 5500, 12, 288, 2518, 63, 344, 29, 657, 63, 21763, 63, 1972, 14, 344, 12, 288, 2004, 29, 11414, 11232, 5589, 14, 2038, 1958, 12, 288, 818, 534, 12949, 7, 267, 776, 267, 327, 664, 333, 24156, 13736, 701, 922, 2410, 922, 965, 9709, 314, 876, 13, 21763, 2518, 267, 9709, 63, 77, 24156, 275, 333, 24156, 63, 1225, 1873, 1354, 63, 991, 63, 751, 8, 5500, 12, 2649, 8, 657, 63, 21763, 63, 1972, 14, 344, 430, 267, 291, 14, 629, 8, 552, 8, 12634, 63, 77, 24156, 395, 413, 9, 267, 291, 14, 629, 8, 12634, 63, 77, 24156, 59, 16, 2733, 3251, 995, 2649, 8, 657, 63, 21763, 63, 1972, 14, 344, 430, 339, 768, 2068, 14, 807, 8, 1751, 14, 13313, 12, 791, 8898, 63, 9935, 9439, 39, 654, 356, 715, 1552, 272, 768, 2068, 360, 16159, 14, 18465, 63, 2232, 14, 5725, 303, 2461, 297, 3158, 29, 549, 9, 272, 347, 511, 63, 18465, 63, 3058, 8, 277, 12, 3016, 304, 267, 6474, 275, 16047, 342, 267, 2518, 275, 17862, 14, 981, 8, 1308, 534, 8268, 297, 1329, 534, 13830, 297, 2929, 63, 354, 534, 774, 5531, 297, 4976, 63, 4087, 3389, 29, 549, 9, 267, 6250, 275, 17065, 11414, 2927, 14, 981, 8, 288, 922, 29, 5500, 12, 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, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 ]
AjabWorld/ajabsacco
ajabsacco/core/facades/loans/transactions.py
1
8484
from ajabsacco.core.models import ( LoanTransactionEntry, LoanProduct, LoanAccount, Message as SMSMessage, ) from decimal import Decimal as D from django.db.models import Q, Sum, F from django.utils import timezone from django.db import transaction as db_transaction from ajabsacco.core import codes from ajabsacco.core.sms import templates from ajabsacco.core.utils import record_log, month_delta from ajabsacco.core.exceptions import * import ledger as ledger_facades from ajabsacco.core.facades import transactions as transaction_facades from ajabsacco.core.facades.loans import validations as validation_facades import logging logger = logging.getLogger('core.ajabsacco.loans') import uuid def allocate_repayment(loan_account, amount, *args, **kwargs): with db_transaction.atomic(): fee_accrued = ledger_facades.loan_account_fees_due(loan_account) penalties_accrued = ledger_facades.loan_account_penalties_due(loan_account) interest_accrued = ledger_facades.loan_account_interest_due(loan_account) principal_accrued = ledger_facades.loan_account_principal_due(loan_account) #1. Align the order we will deduct the accruals accruals = { LoanProduct.ALLOCATION_CHOICE_FEE: (fee_accrued or D('0.0'), post_loan_fee), LoanProduct.ALLOCATION_CHOICE_PENALTY: (penalties_accrued or D('0.0'), post_penalty_fee), LoanProduct.ALLOCATION_CHOICE_INTEREST: (interest_accrued or D('0.0'), post_loan_interest), } amount = (amount or 0) #get a sum of all accruals total_accruals = sum(i[0] for i in accruals.values()) #Ensure we have sane values if (amount > 0) and (principal_accrued > 0): transaction_id = uuid.uuid4() #setup allocation balance, to help us check to total allocation allocation_balance = amount if total_accruals > 0: items_allocated = 0 #Loop through the allocation order for allocation_item in LoanProduct.ALLOCATION_ORDER: #Loop through all the accruals we are expecting to collect for accrued_item, allocation_tuple in accruals.iteritems(): #put aside the variables from the turple accrued_amount, transaction_func = allocation_tuple #if allocation item is equal to accrued item code, and accrued amount is more than 1 #Check to ensure we do not get to negative numbers if (allocation_item == accrued_item) and (accrued_amount > 0) and (allocation_balance > 0): #if amount accrued is sizable, deduct transaction_func(loan_account, accrued_amount, transaction_id=transaction_id) #stamp new allocation items_allocated += 1 #deduct amount posted from balance allocation_balance -= accrued_amount post_loan_principal( loan_account, allocation_balance, transaction_id=transaction_id ) loan_account.last_repayment_date = timezone.now() loan_account.save() else: logger.debug("amount: %s and total_accruals %s" % (amount, total_accruals)) raise AmountNotSufficientException() def apply_accruals(loan_account, approved_by=None): with db_transaction.atomic(): date_disbursed = loan_account.date_disbursed if date_disbursed is None: raise ActionOnUndisbursedLoanException( "You cannot apply accruals on Un-disbursed Loan %s" % loan_account.account_number) date_today = timezone.now() month_diff = month_delta(date_disbursed, date_today, days_of_the_month=30) grace_period = loan_account.grace_period grace_period_type = loan_account.product.grace_period_type within_grace_period = ((month_diff - grace_period) < 1) within_repayment_period = ((month_diff - loan_account.repayment_period) < 1) if (not grace_period == 0): if (within_grace_period): if (grace_period_type == LoanProduct.FULL_GRACE_PERIOD): #No need to proceed, we don't want to accrue anything interest_due = 0 elif (grace_period_type == LoanProduct.PRINCIPAL_GRACE_PERIOD): principal_due = loan_account.amount interest_due = ( (principal_due * loan_account.interest_rate) / loan_account.repayment_period ) else: if within_repayment_period: principal_due = ledger_facades.loan_account_principal_due(loan_account) interest_due = ( (principal_due * (loan_account.interest_rate / D('100.0'))) / loan_account.repayment_period ) if interest_due > 0: apply_interest_to_account(loan_account, interest_due) def disburse_loan(loan_account, *args, **kwargs): with db_transaction.atomic(): validation_facades.validate_disbursement(loan_account) debit_entry, credit_entry = transaction_facades.create_transaction( LoanTransactionEntry, loan_account, loan_account.amount, transaction_type=codes.TRANSACTION_TYPE_LOAN_DISBURSAL, *args, **kwargs ) loan_account.status = LoanAccount.ACTIVE loan_account.date_disbursed = timezone.now() loan_account.save() return (debit_entry, credit_entry) def apply_interest_to_account(loan_account, amount, *args, **kwargs): return transaction_facades.create_transaction(LoanTransactionEntry, loan_account, amount, transaction_type=codes.TRANSACTION_TYPE_INTEREST_APPLY, *args, **kwargs) def apply_fee_to_account(loan_account, amount, *args, **kwargs): return transaction_facades.create_transaction(LoanTransactionEntry, loan_account, amount, transaction_type=codes.TRANSACTION_TYPE_FEE_APPLY, *args, **kwargs) def apply_penalty_to_account(loan_account, amount, *args, **kwargs): return transaction_facades.create_transaction(LoanTransactionEntry, loan_account, amount, transaction_type=codes.TRANSACTION_TYPE_PENALTY_APPLY, *args, **kwargs) def write_off_loan_principal(loan_account, amount, *args, **kwargs): return transaction_facades.create_transaction(LoanTransactionEntry, loan_account, amount, transaction_type=codes.TRANSACTION_TYPE_PRINCIPAL_WRITE_OFF, *args, **kwargs) def write_off_loan_interest(loan_account, amount, *args, **kwargs): return transaction_facades.create_transaction(LoanTransactionEntry, loan_account, amount, transaction_type=codes.TRANSACTION_TYPE_INTEREST_WRITE_OFF, *args, **kwargs) def write_off_loan_penalty(loan_account, amount, *args, **kwargs): return transaction_facades.create_transaction(LoanTransactionEntry, loan_account, amount, transaction_type=codes.TRANSACTION_TYPE_PENALTY_WRITE_OFF, *args, **kwargs) def write_off_loan_fee(loan_account, amount, *args, **kwargs): return transaction_facades.create_transaction(LoanTransactionEntry, loan_account, amount, transaction_type=codes.TRANSACTION_TYPE_FEE_WRITE_OFF, *args, **kwargs) def post_loan_principal(loan_account, amount, *args, **kwargs): return transaction_facades.create_transaction(LoanTransactionEntry, loan_account, amount, transaction_type=codes.TRANSACTION_TYPE_PRINCIPAL_POSTING, *args, **kwargs) def post_loan_interest(loan_account, amount, *args, **kwargs): return transaction_facades.create_transaction(LoanTransactionEntry, loan_account, amount, transaction_type=codes.TRANSACTION_TYPE_INTEREST_POSTING, *args, **kwargs) def post_loan_fee(loan_account, amount, *args, **kwargs): return transaction_facades.create_transaction(LoanTransactionEntry, loan_account, amount, transaction_type=codes.TRANSACTION_TYPE_FEE_POSTING, *args, **kwargs) def post_penalty_fee(loan_account, amount, *args, **kwargs): return transaction_facades.create_transaction(LoanTransactionEntry, loan_account, amount, transaction_type=codes.TRANSACTION_TYPE_PENALTY_POSTING, *args, **kwargs)
apache-2.0
[ 504, 282, 74, 2101, 645, 331, 14, 1018, 14, 992, 492, 334, 272, 3835, 290, 10161, 3900, 12, 5591, 3835, 290, 5884, 12, 5591, 3835, 290, 6009, 12, 272, 6430, 465, 30337, 2209, 12, 221, 199, 9, 199, 504, 6107, 492, 6345, 465, 577, 199, 199, 504, 1639, 14, 697, 14, 992, 492, 1413, 12, 12094, 12, 481, 199, 199, 504, 1639, 14, 1208, 492, 7137, 199, 504, 1639, 14, 697, 492, 6008, 465, 1592, 63, 5945, 199, 199, 504, 282, 74, 2101, 645, 331, 14, 1018, 492, 9479, 199, 504, 282, 74, 2101, 645, 331, 14, 1018, 14, 18751, 492, 7009, 199, 504, 282, 74, 2101, 645, 331, 14, 1018, 14, 1208, 492, 2777, 63, 793, 12, 5794, 63, 3136, 199, 504, 282, 74, 2101, 645, 331, 14, 1018, 14, 3924, 492, 627, 199, 199, 646, 29239, 836, 465, 29239, 836, 63, 12668, 65, 3424, 199, 504, 282, 74, 2101, 645, 331, 14, 1018, 14, 12668, 65, 3424, 492, 15809, 465, 6008, 63, 12668, 65, 3424, 199, 504, 282, 74, 2101, 645, 331, 14, 1018, 14, 12668, 65, 3424, 14, 320, 796, 492, 1686, 1298, 465, 6411, 63, 12668, 65, 3424, 199, 199, 646, 2050, 199, 2921, 275, 2050, 14, 5572, 360, 1018, 14, 9091, 2101, 645, 331, 14, 320, 796, 358, 199, 199, 646, 5377, 199, 199, 318, 18310, 63, 264, 7948, 8, 320, 290, 63, 2048, 12, 5982, 12, 627, 589, 12, 1011, 958, 304, 272, 543, 1592, 63, 5945, 14, 10910, 837, 267, 14751, 63, 5470, 431, 68, 275, 29239, 836, 63, 12668, 65, 3424, 14, 320, 290, 63, 2048, 63, 771, 397, 63, 11933, 8, 320, 290, 63, 2048, 9, 267, 12374, 279, 1417, 63, 5470, 431, 68, 275, 29239, 836, 63, 12668, 65, 3424, 14, 320, 290, 63, 2048, 63, 897, 279, 1417, 63, 11933, 8, 320, 290, 63, 2048, 9, 267, 13518, 63, 5470, 431, 68, 275, 29239, 836, 63, 12668, 65, 3424, 14, 320, 290, 63, 2048, 63, 18700, 63, 11933, 8, 320, 290, 63, 2048, 9, 267, 21646, 63, 5470, 431, 68, 275, 29239, 836, 63, 12668, 65, 3424, 14, 320, 290, 63, 2048, 63, 19200, 63, 11933, 8, 320, 290, 63, 2048, 9, 398, 327, 17, 14, 15170, 784, 314, 1865, 781, 911, 477, 1601, 314, 1066, 1556, 1061, 83, 267, 1066, 1556, 1061, 83, 275, 469, 288, 3835, 290, 5884, 14, 748, 16575, 63, 22544, 63, 5100, 37, 26, 334, 11195, 63, 5470, 431, 68, 503, 577, 360, 16, 14, 16, 659, 2963, 63, 320, 290, 63, 11195, 395, 288, 3835, 290, 5884, 14, 748, 16575, 63, 22544, 63, 48, 742, 748, 2099, 26, 334, 897, 279, 1417, 63, 5470, 431, 68, 503, 577, 360, 16, 14, 16, 659, 2963, 63, 26264, 63, 11195, 395, 288, 3835, 290, 5884, 14, 748, 16575, 63, 22544, 63, 3843, 1719, 26, 334, 18700, 63, 5470, 431, 68, 503, 577, 360, 16, 14, 16, 659, 2963, 63, 320, 290, 63, 18700, 395, 267, 789, 398, 5982, 275, 334, 4606, 503, 378, 9, 267, 327, 362, 282, 3089, 402, 1006, 1066, 1556, 1061, 83, 267, 3141, 63, 645, 1556, 1061, 83, 275, 3089, 8, 73, 59, 16, 61, 367, 284, 315, 1066, 1556, 1061, 83, 14, 1459, 1012, 398, 327, 13913, 781, 1172, 31648, 1338, 267, 340, 334, 4606, 690, 378, 9, 436, 334, 19200, 63, 5470, 431, 68, 690, 378, 304, 288, 6008, 63, 344, 275, 5377, 14, 2580, 20, 342, 953, 327, 2758, 18723, 14094, 12, 370, 1720, 2739, 1104, 370, 3141, 18723, 288, 18723, 63, 7358, 275, 5982, 953, 340, 3141, 63, 645, 1556, 1061, 83, 690, 378, 26, 355, 2974, 63, 19570, 275, 378, 355, 327, 7382, 4012, 314, 18723, 1865, 355, 367, 18723, 63, 1053, 315, 3835, 290, 5884, 14, 748, 16575, 63, 12125, 26, 490, 327, 7382, 4012, 1006, 314, 1066, 1556, 1061, 83, 781, 787, 21055, 370, 8775, 490, 367, 6907, 431, 68, 63, 1053, 12, 18723, 63, 2960, 315, 1066, 1556, 1061, 83, 14, 4611, 837, 717, 327, 524, 282, 2441, 314, 2860, 687, 314, 307, 300, 11045, 717, 6907, 431, 68, 63, 4606, 12, 6008, 63, 1532, 275, 18723, 63, 2960, 9453, 327, 692, 18723, 1242, 365, 4472, 370, 6907, 431, 68, 1242, 1233, 12, 436, 6907, 431, 68, 5982, 365, 1655, 2419, 413, 717, 327, 1799, 370, 4868, 781, 886, 440, 664, 370, 6946, 5579, 717, 340, 334, 14940, 63, 1053, 508, 6907, 431, 68, 63, 1053, 9, 436, 334, 5470, 431, 68, 63, 4606, 690, 378, 9, 436, 334, 14940, 63, 7358, 690, 378, 304, 1169, 327, 692, 5982, 6907, 431, 68, 365, 308, 14065, 12, 477, 1601, 1169, 6008, 63, 1532, 8, 320, 290, 63, 2048, 12, 6907, 431, 68, 63, 4606, 12, 6008, 63, 344, 29, 5945, 63, 344, 9, 18008, 327, 2359, 892, 18723, 1169, 2974, 63, 19570, 847, 413, 18008, 327, 770, 918, 5982, 22752, 687, 14094, 1169, 18723, 63, 7358, 4862, 6907, 431, 68, 63, 4606, 953, 2963, 63, 320, 290, 63, 19200, 8, 355, 560, 290, 63, 2048, 12, 8892, 18723, 63, 7358, 12, 8892, 6008, 63, 344, 29, 5945, 63, 344, 288, 776, 953, 560, 290, 63, 2048, 14, 2019, 63, 264, 7948, 63, 602, 275, 7137, 14, 2131, 342, 288, 560, 290, 63, 2048, 14, 2117, 342, 267, 587, 26, 288, 2512, 14, 1757, 480, 4606, 26, 450, 83, 436, 3141, 63, 645, 1556, 1061, 83, 450, 83, 2, 450, 334, 4606, 12, 3141, 63, 645, 1556, 1061, 83, 430, 288, 746, 26701, 1763, 51, 12983, 1726, 342, 199, 199, 318, 4838, 63, 645, 1556, 1061, 83, 8, 320, 290, 63, 2048, 12, 30055, 63, 991, 29, 403, 304, 272, 543, 1592, 63, 5945, 14, 10910, 837, 267, 1434, 63, 2297, 30735, 939, 275, 560, 290, 63, 2048, 14, 602, 63, 2297, 30735, 939, 398, 340, 1434, 63, 2297, 30735, 939, 365, 488, 26, 288, 746, 10033, 3314, 1358, 2297, 30735, 939, 2041, 290, 1726, 8, 355, 298, 5556, 3913, 4838, 1066, 1556, 1061, 83, 641, 1910, 13, 2297, 30735, 939, 3835, 290, 450, 83, 2, 450, 560, 290, 63, 2048, 14, 2048, 63, 1955, 9, 398, 1434, 63, 8136, 275, 7137, 14, 2131, 342, 267, 5794, 63, 3028 ]
[ 282, 74, 2101, 645, 331, 14, 1018, 14, 992, 492, 334, 272, 3835, 290, 10161, 3900, 12, 5591, 3835, 290, 5884, 12, 5591, 3835, 290, 6009, 12, 272, 6430, 465, 30337, 2209, 12, 221, 199, 9, 199, 504, 6107, 492, 6345, 465, 577, 199, 199, 504, 1639, 14, 697, 14, 992, 492, 1413, 12, 12094, 12, 481, 199, 199, 504, 1639, 14, 1208, 492, 7137, 199, 504, 1639, 14, 697, 492, 6008, 465, 1592, 63, 5945, 199, 199, 504, 282, 74, 2101, 645, 331, 14, 1018, 492, 9479, 199, 504, 282, 74, 2101, 645, 331, 14, 1018, 14, 18751, 492, 7009, 199, 504, 282, 74, 2101, 645, 331, 14, 1018, 14, 1208, 492, 2777, 63, 793, 12, 5794, 63, 3136, 199, 504, 282, 74, 2101, 645, 331, 14, 1018, 14, 3924, 492, 627, 199, 199, 646, 29239, 836, 465, 29239, 836, 63, 12668, 65, 3424, 199, 504, 282, 74, 2101, 645, 331, 14, 1018, 14, 12668, 65, 3424, 492, 15809, 465, 6008, 63, 12668, 65, 3424, 199, 504, 282, 74, 2101, 645, 331, 14, 1018, 14, 12668, 65, 3424, 14, 320, 796, 492, 1686, 1298, 465, 6411, 63, 12668, 65, 3424, 199, 199, 646, 2050, 199, 2921, 275, 2050, 14, 5572, 360, 1018, 14, 9091, 2101, 645, 331, 14, 320, 796, 358, 199, 199, 646, 5377, 199, 199, 318, 18310, 63, 264, 7948, 8, 320, 290, 63, 2048, 12, 5982, 12, 627, 589, 12, 1011, 958, 304, 272, 543, 1592, 63, 5945, 14, 10910, 837, 267, 14751, 63, 5470, 431, 68, 275, 29239, 836, 63, 12668, 65, 3424, 14, 320, 290, 63, 2048, 63, 771, 397, 63, 11933, 8, 320, 290, 63, 2048, 9, 267, 12374, 279, 1417, 63, 5470, 431, 68, 275, 29239, 836, 63, 12668, 65, 3424, 14, 320, 290, 63, 2048, 63, 897, 279, 1417, 63, 11933, 8, 320, 290, 63, 2048, 9, 267, 13518, 63, 5470, 431, 68, 275, 29239, 836, 63, 12668, 65, 3424, 14, 320, 290, 63, 2048, 63, 18700, 63, 11933, 8, 320, 290, 63, 2048, 9, 267, 21646, 63, 5470, 431, 68, 275, 29239, 836, 63, 12668, 65, 3424, 14, 320, 290, 63, 2048, 63, 19200, 63, 11933, 8, 320, 290, 63, 2048, 9, 398, 327, 17, 14, 15170, 784, 314, 1865, 781, 911, 477, 1601, 314, 1066, 1556, 1061, 83, 267, 1066, 1556, 1061, 83, 275, 469, 288, 3835, 290, 5884, 14, 748, 16575, 63, 22544, 63, 5100, 37, 26, 334, 11195, 63, 5470, 431, 68, 503, 577, 360, 16, 14, 16, 659, 2963, 63, 320, 290, 63, 11195, 395, 288, 3835, 290, 5884, 14, 748, 16575, 63, 22544, 63, 48, 742, 748, 2099, 26, 334, 897, 279, 1417, 63, 5470, 431, 68, 503, 577, 360, 16, 14, 16, 659, 2963, 63, 26264, 63, 11195, 395, 288, 3835, 290, 5884, 14, 748, 16575, 63, 22544, 63, 3843, 1719, 26, 334, 18700, 63, 5470, 431, 68, 503, 577, 360, 16, 14, 16, 659, 2963, 63, 320, 290, 63, 18700, 395, 267, 789, 398, 5982, 275, 334, 4606, 503, 378, 9, 267, 327, 362, 282, 3089, 402, 1006, 1066, 1556, 1061, 83, 267, 3141, 63, 645, 1556, 1061, 83, 275, 3089, 8, 73, 59, 16, 61, 367, 284, 315, 1066, 1556, 1061, 83, 14, 1459, 1012, 398, 327, 13913, 781, 1172, 31648, 1338, 267, 340, 334, 4606, 690, 378, 9, 436, 334, 19200, 63, 5470, 431, 68, 690, 378, 304, 288, 6008, 63, 344, 275, 5377, 14, 2580, 20, 342, 953, 327, 2758, 18723, 14094, 12, 370, 1720, 2739, 1104, 370, 3141, 18723, 288, 18723, 63, 7358, 275, 5982, 953, 340, 3141, 63, 645, 1556, 1061, 83, 690, 378, 26, 355, 2974, 63, 19570, 275, 378, 355, 327, 7382, 4012, 314, 18723, 1865, 355, 367, 18723, 63, 1053, 315, 3835, 290, 5884, 14, 748, 16575, 63, 12125, 26, 490, 327, 7382, 4012, 1006, 314, 1066, 1556, 1061, 83, 781, 787, 21055, 370, 8775, 490, 367, 6907, 431, 68, 63, 1053, 12, 18723, 63, 2960, 315, 1066, 1556, 1061, 83, 14, 4611, 837, 717, 327, 524, 282, 2441, 314, 2860, 687, 314, 307, 300, 11045, 717, 6907, 431, 68, 63, 4606, 12, 6008, 63, 1532, 275, 18723, 63, 2960, 9453, 327, 692, 18723, 1242, 365, 4472, 370, 6907, 431, 68, 1242, 1233, 12, 436, 6907, 431, 68, 5982, 365, 1655, 2419, 413, 717, 327, 1799, 370, 4868, 781, 886, 440, 664, 370, 6946, 5579, 717, 340, 334, 14940, 63, 1053, 508, 6907, 431, 68, 63, 1053, 9, 436, 334, 5470, 431, 68, 63, 4606, 690, 378, 9, 436, 334, 14940, 63, 7358, 690, 378, 304, 1169, 327, 692, 5982, 6907, 431, 68, 365, 308, 14065, 12, 477, 1601, 1169, 6008, 63, 1532, 8, 320, 290, 63, 2048, 12, 6907, 431, 68, 63, 4606, 12, 6008, 63, 344, 29, 5945, 63, 344, 9, 18008, 327, 2359, 892, 18723, 1169, 2974, 63, 19570, 847, 413, 18008, 327, 770, 918, 5982, 22752, 687, 14094, 1169, 18723, 63, 7358, 4862, 6907, 431, 68, 63, 4606, 953, 2963, 63, 320, 290, 63, 19200, 8, 355, 560, 290, 63, 2048, 12, 8892, 18723, 63, 7358, 12, 8892, 6008, 63, 344, 29, 5945, 63, 344, 288, 776, 953, 560, 290, 63, 2048, 14, 2019, 63, 264, 7948, 63, 602, 275, 7137, 14, 2131, 342, 288, 560, 290, 63, 2048, 14, 2117, 342, 267, 587, 26, 288, 2512, 14, 1757, 480, 4606, 26, 450, 83, 436, 3141, 63, 645, 1556, 1061, 83, 450, 83, 2, 450, 334, 4606, 12, 3141, 63, 645, 1556, 1061, 83, 430, 288, 746, 26701, 1763, 51, 12983, 1726, 342, 199, 199, 318, 4838, 63, 645, 1556, 1061, 83, 8, 320, 290, 63, 2048, 12, 30055, 63, 991, 29, 403, 304, 272, 543, 1592, 63, 5945, 14, 10910, 837, 267, 1434, 63, 2297, 30735, 939, 275, 560, 290, 63, 2048, 14, 602, 63, 2297, 30735, 939, 398, 340, 1434, 63, 2297, 30735, 939, 365, 488, 26, 288, 746, 10033, 3314, 1358, 2297, 30735, 939, 2041, 290, 1726, 8, 355, 298, 5556, 3913, 4838, 1066, 1556, 1061, 83, 641, 1910, 13, 2297, 30735, 939, 3835, 290, 450, 83, 2, 450, 560, 290, 63, 2048, 14, 2048, 63, 1955, 9, 398, 1434, 63, 8136, 275, 7137, 14, 2131, 342, 267, 5794, 63, 3028, 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, 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 \13world\14 " * 1000 p = re.compile(r"([\13\14])") timefunc(10, p.sub, "", s) timefunc(10, p.split, s) timefunc(10, p.findall, s) def timefunc(n, func, *args, **kw): t0 = time.perf_counter() try: for i in range(n): result = func(*args, **kw) return result finally: t1 = time.perf_counter() if n > 1: print(n, "times", end=' ') print(func.__name__, "%.3f" % (t1-t0), "CPU seconds") main() ======= import re import time def main(): s = "\13hello\14 \13world\14 " * 1000 p = re.compile(r"([\13\14])") timefunc(10, p.sub, "", s) timefunc(10, p.split, s) timefunc(10, p.findall, s) def timefunc(n, func, *args, **kw): t0 = time.perf_counter() try: for i in range(n): result = func(*args, **kw) return result finally: t1 = time.perf_counter() if n > 1: print(n, "times", end=' ') print(func.__name__, "%.3f" % (t1-t0), "CPU seconds") main() >>>>>>> b875702c9c06ab5012e52ff4337439b03918f453 ======= import re import time def main(): s = "\13hello\14 \13world\14 " * 1000 p = re.compile(r"([\13\14])") timefunc(10, p.sub, "", s) timefunc(10, p.split, s) timefunc(10, p.findall, s) def timefunc(n, func, *args, **kw): t0 = time.perf_counter() try: for i in range(n): result = func(*args, **kw) return result finally: t1 = time.perf_counter() if n > 1: print(n, "times", end=' ') print(func.__name__, "%.3f" % (t1-t0), "CPU seconds") main() >>>>>>> b875702c9c06ab5012e52ff4337439b03918f453
mit
[ 31275, 8999, 28, 13053, 199, 31275, 8999, 28, 13053, 199, 646, 295, 199, 646, 900, 199, 199, 318, 2446, 837, 272, 308, 275, 1867, 969, 5006, 60, 1079, 971, 969, 7617, 60, 1079, 298, 627, 5198, 272, 299, 275, 295, 14, 2014, 8, 82, 2, 16510, 969, 60, 1079, 566, 531, 272, 900, 1532, 8, 709, 12, 299, 14, 954, 12, 4873, 308, 9, 272, 900, 1532, 8, 709, 12, 299, 14, 1294, 12, 308, 9, 272, 900, 1532, 8, 709, 12, 299, 14, 6452, 12, 308, 9, 199, 199, 318, 900, 1532, 8, 78, 12, 2562, 12, 627, 589, 12, 1011, 829, 304, 272, 307, 16, 275, 900, 14, 9452, 63, 5337, 342, 272, 862, 26, 267, 367, 284, 315, 1425, 8, 78, 304, 288, 754, 275, 2562, 2031, 589, 12, 1011, 829, 9, 267, 372, 754, 272, 3753, 26, 267, 307, 17, 275, 900, 14, 9452, 63, 5337, 342, 267, 340, 302, 690, 413, 26, 288, 870, 8, 78, 12, 298, 4508, 401, 1284, 534, 5320, 267, 870, 8, 1532, 855, 354, 3108, 31681, 19, 70, 2, 450, 334, 84, 17, 13, 84, 16, 395, 298, 11011, 4696, 531, 199, 199, 973, 342, 199, 18673, 199, 646, 295, 199, 646, 900, 199, 199, 318, 2446, 837, 272, 308, 275, 1867, 969, 5006, 60, 1079, 971, 969, 7617, 60, 1079, 298, 627, 5198, 272, 299, 275, 295, 14, 2014, 8, 82, 2, 16510, 969, 60, 1079, 566, 531, 272, 900, 1532, 8, 709, 12, 299, 14, 954, 12, 4873, 308, 9, 272, 900, 1532, 8, 709, 12, 299, 14, 1294, 12, 308, 9, 272, 900, 1532, 8, 709, 12, 299, 14, 6452, 12, 308, 9, 199, 199, 318, 900, 1532, 8, 78, 12, 2562, 12, 627, 589, 12, 1011, 829, 304, 272, 307, 16, 275, 900, 14, 9452, 63, 5337, 342, 272, 862, 26, 267, 367, 284, 315, 1425, 8, 78, 304, 288, 754, 275, 2562, 2031, 589, 12, 1011, 829, 9, 267, 372, 754, 272, 3753, 26, 267, 307, 17, 275, 900, 14, 9452, 63, 5337, 342, 267, 340, 302, 690, 413, 26, 288, 870, 8, 78, 12, 298, 4508, 401, 1284, 534, 5320, 267, 870, 8, 1532, 855, 354, 3108, 31681, 19, 70, 2, 450, 334, 84, 17, 13, 84, 16, 395, 298, 11011, 4696, 531, 199, 199, 973, 342, 199, 28375, 6071, 330, 1555, 1641, 996, 67, 25, 67, 1690, 371, 8216, 18, 69, 2528, 556, 23404, 1342, 1355, 66, 10005, 1085, 70, 24135, 199, 18673, 199, 646, 295, 199, 646, 900, 199, 199, 318, 2446, 837, 272, 308, 275, 1867, 969, 5006, 60, 1079, 971, 969, 7617, 60, 1079, 298, 627, 5198, 272, 299, 275, 295, 14, 2014, 8, 82, 2, 16510, 969, 60, 1079, 566, 531, 272, 900, 1532, 8, 709, 12, 299, 14, 954, 12, 4873, 308, 9, 272, 900, 1532, 8, 709, 12, 299, 14, 1294, 12, 308, 9, 272, 900, 1532, 8, 709, 12, 299, 14, 6452, 12, 308, 9, 199, 199, 318, 900, 1532, 8, 78, 12, 2562, 12, 627, 589, 12, 1011, 829, 304, 272, 307, 16, 275, 900, 14, 9452, 63, 5337, 342, 272, 862, 26, 267, 367, 284, 315, 1425, 8, 78, 304, 288, 754, 275, 2562, 2031, 589, 12, 1011, 829, 9, 267, 372, 754, 272, 3753, 26, 267, 307, 17, 275, 900, 14, 9452, 63, 5337, 342, 267, 340, 302, 690, 413, 26, 288, 870, 8, 78, 12, 298, 4508, 401, 1284, 534, 5320, 267, 870, 8, 1532, 855, 354, 3108, 31681, 19, 70, 2, 450, 334, 84, 17, 13, 84, 16, 395, 298, 11011, 4696, 531, 199, 199, 973, 342, 199, 28375, 6071, 330, 1555, 1641, 996, 67, 25, 67, 1690, 371, 8216, 18, 69, 2528, 556, 23404, 1342, 1355, 66, 10005, 1085, 70, 24135, 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 ]
[ 8999, 28, 13053, 199, 31275, 8999, 28, 13053, 199, 646, 295, 199, 646, 900, 199, 199, 318, 2446, 837, 272, 308, 275, 1867, 969, 5006, 60, 1079, 971, 969, 7617, 60, 1079, 298, 627, 5198, 272, 299, 275, 295, 14, 2014, 8, 82, 2, 16510, 969, 60, 1079, 566, 531, 272, 900, 1532, 8, 709, 12, 299, 14, 954, 12, 4873, 308, 9, 272, 900, 1532, 8, 709, 12, 299, 14, 1294, 12, 308, 9, 272, 900, 1532, 8, 709, 12, 299, 14, 6452, 12, 308, 9, 199, 199, 318, 900, 1532, 8, 78, 12, 2562, 12, 627, 589, 12, 1011, 829, 304, 272, 307, 16, 275, 900, 14, 9452, 63, 5337, 342, 272, 862, 26, 267, 367, 284, 315, 1425, 8, 78, 304, 288, 754, 275, 2562, 2031, 589, 12, 1011, 829, 9, 267, 372, 754, 272, 3753, 26, 267, 307, 17, 275, 900, 14, 9452, 63, 5337, 342, 267, 340, 302, 690, 413, 26, 288, 870, 8, 78, 12, 298, 4508, 401, 1284, 534, 5320, 267, 870, 8, 1532, 855, 354, 3108, 31681, 19, 70, 2, 450, 334, 84, 17, 13, 84, 16, 395, 298, 11011, 4696, 531, 199, 199, 973, 342, 199, 18673, 199, 646, 295, 199, 646, 900, 199, 199, 318, 2446, 837, 272, 308, 275, 1867, 969, 5006, 60, 1079, 971, 969, 7617, 60, 1079, 298, 627, 5198, 272, 299, 275, 295, 14, 2014, 8, 82, 2, 16510, 969, 60, 1079, 566, 531, 272, 900, 1532, 8, 709, 12, 299, 14, 954, 12, 4873, 308, 9, 272, 900, 1532, 8, 709, 12, 299, 14, 1294, 12, 308, 9, 272, 900, 1532, 8, 709, 12, 299, 14, 6452, 12, 308, 9, 199, 199, 318, 900, 1532, 8, 78, 12, 2562, 12, 627, 589, 12, 1011, 829, 304, 272, 307, 16, 275, 900, 14, 9452, 63, 5337, 342, 272, 862, 26, 267, 367, 284, 315, 1425, 8, 78, 304, 288, 754, 275, 2562, 2031, 589, 12, 1011, 829, 9, 267, 372, 754, 272, 3753, 26, 267, 307, 17, 275, 900, 14, 9452, 63, 5337, 342, 267, 340, 302, 690, 413, 26, 288, 870, 8, 78, 12, 298, 4508, 401, 1284, 534, 5320, 267, 870, 8, 1532, 855, 354, 3108, 31681, 19, 70, 2, 450, 334, 84, 17, 13, 84, 16, 395, 298, 11011, 4696, 531, 199, 199, 973, 342, 199, 28375, 6071, 330, 1555, 1641, 996, 67, 25, 67, 1690, 371, 8216, 18, 69, 2528, 556, 23404, 1342, 1355, 66, 10005, 1085, 70, 24135, 199, 18673, 199, 646, 295, 199, 646, 900, 199, 199, 318, 2446, 837, 272, 308, 275, 1867, 969, 5006, 60, 1079, 971, 969, 7617, 60, 1079, 298, 627, 5198, 272, 299, 275, 295, 14, 2014, 8, 82, 2, 16510, 969, 60, 1079, 566, 531, 272, 900, 1532, 8, 709, 12, 299, 14, 954, 12, 4873, 308, 9, 272, 900, 1532, 8, 709, 12, 299, 14, 1294, 12, 308, 9, 272, 900, 1532, 8, 709, 12, 299, 14, 6452, 12, 308, 9, 199, 199, 318, 900, 1532, 8, 78, 12, 2562, 12, 627, 589, 12, 1011, 829, 304, 272, 307, 16, 275, 900, 14, 9452, 63, 5337, 342, 272, 862, 26, 267, 367, 284, 315, 1425, 8, 78, 304, 288, 754, 275, 2562, 2031, 589, 12, 1011, 829, 9, 267, 372, 754, 272, 3753, 26, 267, 307, 17, 275, 900, 14, 9452, 63, 5337, 342, 267, 340, 302, 690, 413, 26, 288, 870, 8, 78, 12, 298, 4508, 401, 1284, 534, 5320, 267, 870, 8, 1532, 855, 354, 3108, 31681, 19, 70, 2, 450, 334, 84, 17, 13, 84, 16, 395, 298, 11011, 4696, 531, 199, 199, 973, 342, 199, 28375, 6071, 330, 1555, 1641, 996, 67, 25, 67, 1690, 371, 8216, 18, 69, 2528, 556, 23404, 1342, 1355, 66, 10005, 1085, 70, 24135, 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, 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, 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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 ]
nopjmp/SickRage
lib/stevedore/dispatch.py
21
9005
import logging from .enabled import EnabledExtensionManager from .exception import NoMatches LOG = logging.getLogger(__name__) class DispatchExtensionManager(EnabledExtensionManager): """Loads all plugins and filters on execution. This is useful for long-running processes that need to pass different inputs to different extensions. :param namespace: The namespace for the entry points. :type namespace: str :param check_func: Function to determine which extensions to load. :type check_func: callable :param invoke_on_load: Boolean controlling whether to invoke the object returned by the entry point after the driver is loaded. :type invoke_on_load: bool :param invoke_args: Positional arguments to pass when invoking the object returned by the entry point. Only used if invoke_on_load is True. :type invoke_args: tuple :param invoke_kwds: Named arguments to pass when invoking the object returned by the entry point. Only used if invoke_on_load is True. :type invoke_kwds: dict :param propagate_map_exceptions: Boolean controlling whether exceptions are propagated up through the map call or whether they are logged and then ignored :type invoke_on_load: bool """ def map(self, filter_func, func, *args, **kwds): """Iterate over the extensions invoking func() for any where filter_func() returns True. The signature of filter_func() should be:: def filter_func(ext, *args, **kwds): pass The first argument to filter_func(), 'ext', is the :class:`~stevedore.extension.Extension` instance. filter_func() should return True if the extension should be invoked for the input arguments. The signature for func() should be:: def func(ext, *args, **kwds): pass The first argument to func(), 'ext', is the :class:`~stevedore.extension.Extension` instance. Exceptions raised from within func() are propagated up and processing stopped if self.propagate_map_exceptions is True, otherwise they are logged and ignored. :param filter_func: Callable to test each extension. :param func: Callable to invoke for each extension. :param args: Variable arguments to pass to func() :param kwds: Keyword arguments to pass to func() :returns: List of values returned from func() """ if not self.extensions: # FIXME: Use a more specific exception class here. raise NoMatches('No %s extensions found' % self.namespace) response = [] for e in self.extensions: if filter_func(e, *args, **kwds): self._invoke_one_plugin(response.append, func, e, args, kwds) return response def map_method(self, filter_func, method_name, *args, **kwds): """Iterate over the extensions invoking each one's object method called `method_name` for any where filter_func() returns True. This is equivalent of using :meth:`map` with func set to `lambda x: x.obj.method_name()` while being more convenient. Exceptions raised from within the called method are propagated up and processing stopped if self.propagate_map_exceptions is True, otherwise they are logged and ignored. .. versionadded:: 0.12 :param filter_func: Callable to test each extension. :param method_name: The extension method name to call for each extension. :param args: Variable arguments to pass to method :param kwds: Keyword arguments to pass to method :returns: List of values returned from methods """ return self.map(filter_func, self._call_extension_method, method_name, *args, **kwds) class NameDispatchExtensionManager(DispatchExtensionManager): """Loads all plugins and filters on execution. This is useful for long-running processes that need to pass different inputs to different extensions and can predict the name of the extensions before calling them. The check_func argument should return a boolean, with ``True`` indicating that the extension should be loaded and made available and ``False`` indicating that the extension should be ignored. :param namespace: The namespace for the entry points. :type namespace: str :param check_func: Function to determine which extensions to load. :type check_func: callable :param invoke_on_load: Boolean controlling whether to invoke the object returned by the entry point after the driver is loaded. :type invoke_on_load: bool :param invoke_args: Positional arguments to pass when invoking the object returned by the entry point. Only used if invoke_on_load is True. :type invoke_args: tuple :param invoke_kwds: Named arguments to pass when invoking the object returned by the entry point. Only used if invoke_on_load is True. :type invoke_kwds: dict :param propagate_map_exceptions: Boolean controlling whether exceptions are propagated up through the map call or whether they are logged and then ignored :type invoke_on_load: bool :param on_load_failure_callback: Callback function that will be called when a entrypoint can not be loaded. The arguments that will be provided when this is called (when an entrypoint fails to load) are (manager, entrypoint, exception) :type on_load_failure_callback: function :param verify_requirements: Use setuptools to enforce the dependencies of the plugin(s) being loaded. Defaults to False. :type verify_requirements: bool """ def __init__(self, namespace, check_func, invoke_on_load=False, invoke_args=(), invoke_kwds={}, propagate_map_exceptions=False, on_load_failure_callback=None, verify_requirements=False): super(NameDispatchExtensionManager, self).__init__( namespace=namespace, check_func=check_func, invoke_on_load=invoke_on_load, invoke_args=invoke_args, invoke_kwds=invoke_kwds, propagate_map_exceptions=propagate_map_exceptions, on_load_failure_callback=on_load_failure_callback, verify_requirements=verify_requirements, ) def _init_plugins(self, extensions): super(NameDispatchExtensionManager, self)._init_plugins(extensions) self.by_name = dict((e.name, e) for e in self.extensions) def map(self, names, func, *args, **kwds): """Iterate over the extensions invoking func() for any where the name is in the given list of names. The signature for func() should be:: def func(ext, *args, **kwds): pass The first argument to func(), 'ext', is the :class:`~stevedore.extension.Extension` instance. Exceptions raised from within func() are propagated up and processing stopped if self.propagate_map_exceptions is True, otherwise they are logged and ignored. :param names: List or set of name(s) of extension(s) to invoke. :param func: Callable to invoke for each extension. :param args: Variable arguments to pass to func() :param kwds: Keyword arguments to pass to func() :returns: List of values returned from func() """ response = [] for name in names: try: e = self.by_name[name] except KeyError: LOG.debug('Missing extension %r being ignored', name) else: self._invoke_one_plugin(response.append, func, e, args, kwds) return response def map_method(self, names, method_name, *args, **kwds): """Iterate over the extensions invoking each one's object method called `method_name` for any where the name is in the given list of names. This is equivalent of using :meth:`map` with func set to `lambda x: x.obj.method_name()` while being more convenient. Exceptions raised from within the called method are propagated up and processing stopped if self.propagate_map_exceptions is True, otherwise they are logged and ignored. .. versionadded:: 0.12 :param names: List or set of name(s) of extension(s) to invoke. :param method_name: The extension method name to call for each extension. :param args: Variable arguments to pass to method :param kwds: Keyword arguments to pass to method :returns: List of values returned from methods """ return self.map(names, self._call_extension_method, method_name, *args, **kwds)
gpl-3.0
[ 646, 2050, 199, 199, 504, 1275, 3827, 492, 3447, 1909, 6382, 2988, 199, 504, 1275, 1971, 492, 3091, 12962, 199, 199, 4947, 275, 2050, 14, 5572, 3460, 354, 3368, 421, 199, 533, 28626, 6382, 2988, 8, 6589, 6382, 2988, 304, 272, 408, 30777, 1006, 8963, 436, 4766, 641, 6451, 14, 339, 961, 365, 2997, 367, 1846, 13, 5720, 10358, 626, 1929, 370, 986, 272, 3365, 4153, 370, 3365, 5478, 14, 339, 520, 635, 3231, 26, 710, 3231, 367, 314, 2397, 4501, 14, 272, 520, 466, 3231, 26, 620, 272, 520, 635, 1104, 63, 1532, 26, 6801, 370, 6705, 1314, 5478, 370, 2248, 14, 272, 520, 466, 1104, 63, 1532, 26, 4550, 272, 520, 635, 12677, 63, 265, 63, 912, 26, 9411, 30350, 3775, 370, 12677, 314, 267, 909, 2138, 701, 314, 2397, 2376, 2410, 314, 5253, 365, 6511, 14, 272, 520, 466, 12677, 63, 265, 63, 912, 26, 2155, 272, 520, 635, 12677, 63, 589, 26, 15483, 279, 2368, 370, 986, 1380, 26750, 267, 314, 909, 2138, 701, 314, 2397, 2376, 14, 5972, 1202, 340, 12677, 63, 265, 63, 912, 267, 365, 715, 14, 272, 520, 466, 12677, 63, 589, 26, 2008, 272, 520, 635, 12677, 63, 10340, 26, 16198, 2368, 370, 986, 1380, 26750, 267, 314, 909, 2138, 701, 314, 2397, 2376, 14, 5972, 1202, 340, 12677, 63, 265, 63, 912, 267, 365, 715, 14, 272, 520, 466, 12677, 63, 10340, 26, 1211, 272, 520, 635, 19843, 63, 1130, 63, 3924, 26, 9411, 30350, 3775, 4967, 267, 787, 25350, 1536, 4012, 314, 2341, 1240, 503, 3775, 2985, 787, 10367, 436, 267, 2066, 5525, 272, 520, 466, 12677, 63, 265, 63, 912, 26, 2155, 272, 408, 339, 347, 2341, 8, 277, 12, 2457, 63, 1532, 12, 2562, 12, 627, 589, 12, 1011, 10340, 304, 267, 408, 3315, 323, 1806, 314, 5478, 26750, 2562, 342, 367, 1263, 2382, 267, 2457, 63, 1532, 342, 2529, 715, 14, 398, 710, 4955, 402, 2457, 63, 1532, 342, 1077, 506, 447, 953, 347, 2457, 63, 1532, 8, 832, 12, 627, 589, 12, 1011, 10340, 304, 355, 986, 398, 710, 1642, 1423, 370, 2457, 63, 1532, 1062, 283, 832, 297, 365, 314, 267, 520, 533, 6054, 1597, 1354, 720, 14, 3435, 14, 6382, 64, 267, 1256, 14, 2457, 63, 1532, 342, 1077, 372, 715, 340, 314, 3329, 267, 1077, 506, 10302, 367, 314, 1324, 2368, 14, 398, 710, 4955, 367, 2562, 342, 1077, 506, 447, 953, 347, 2562, 8, 832, 12, 627, 589, 12, 1011, 10340, 304, 355, 986, 398, 710, 1642, 1423, 370, 2562, 1062, 283, 832, 297, 365, 314, 267, 520, 533, 6054, 1597, 1354, 720, 14, 3435, 14, 6382, 64, 1256, 14, 398, 24873, 4915, 687, 4453, 2562, 342, 787, 25350, 1536, 436, 267, 6661, 15248, 340, 291, 14, 19432, 63, 1130, 63, 3924, 365, 715, 12, 267, 4257, 2985, 787, 10367, 436, 5525, 14, 398, 520, 635, 2457, 63, 1532, 26, 16975, 370, 511, 1924, 3329, 14, 267, 520, 635, 2562, 26, 16975, 370, 12677, 367, 1924, 3329, 14, 267, 520, 635, 1249, 26, 4905, 2368, 370, 986, 370, 2562, 342, 267, 520, 635, 16286, 26, 6431, 2368, 370, 986, 370, 2562, 342, 267, 520, 5808, 26, 3820, 402, 1338, 2138, 687, 2562, 342, 267, 408, 267, 340, 440, 291, 14, 5359, 26, 288, 327, 7600, 26, 3645, 282, 1655, 2488, 1919, 1021, 2348, 14, 288, 746, 3091, 12962, 360, 1944, 450, 83, 5478, 1911, 7, 450, 291, 14, 3251, 9, 267, 1177, 275, 942, 267, 367, 325, 315, 291, 14, 5359, 26, 288, 340, 2457, 63, 1532, 8, 69, 12, 627, 589, 12, 1011, 10340, 304, 355, 291, 423, 15195, 63, 368, 63, 2718, 8, 1310, 14, 740, 12, 2562, 12, 325, 12, 1249, 12, 16286, 9, 267, 372, 1177, 339, 347, 2341, 63, 765, 8, 277, 12, 2457, 63, 1532, 12, 1083, 63, 354, 12, 627, 589, 12, 1011, 10340, 304, 267, 408, 3315, 323, 1806, 314, 5478, 26750, 1924, 1373, 1159, 909, 1083, 2797, 267, 658, 765, 63, 354, 64, 367, 1263, 2382, 2457, 63, 1532, 342, 2529, 715, 14, 398, 961, 365, 7353, 402, 1808, 520, 5247, 1705, 1130, 64, 543, 2562, 663, 370, 267, 658, 2734, 671, 26, 671, 14, 1113, 14, 765, 63, 354, 11995, 267, 1830, 3769, 1655, 22700, 14, 398, 24873, 4915, 687, 4453, 314, 2797, 1083, 787, 25350, 1536, 267, 436, 6661, 15248, 340, 291, 14, 19432, 63, 1130, 63, 3924, 365, 715, 12, 267, 4257, 2985, 787, 10367, 436, 5525, 14, 398, 2508, 7445, 447, 378, 14, 713, 398, 520, 635, 2457, 63, 1532, 26, 16975, 370, 511, 1924, 3329, 14, 267, 520, 635, 1083, 63, 354, 26, 710, 3329, 1083, 536, 370, 1240, 1169, 367, 1924, 3329, 14, 267, 520, 635, 1249, 26, 4905, 2368, 370, 986, 370, 1083, 267, 520, 635, 16286, 26, 6431, 2368, 370, 986, 370, 1083, 267, 520, 5808, 26, 3820, 402, 1338, 2138, 687, 3102, 267, 408, 267, 372, 291, 14, 1130, 8, 1541, 63, 1532, 12, 291, 423, 1250, 63, 3435, 63, 765, 12, 717, 1083, 63, 354, 12, 627, 589, 12, 1011, 10340, 9, 421, 199, 533, 2812, 20628, 6382, 2988, 8, 20628, 6382, 2988, 304, 272, 408, 30777, 1006, 8963, 436, 4766, 641, 6451, 14, 339, 961, 365, 2997, 367, 1846, 13, 5720, 10358, 626, 1929, 370, 986, 272, 3365, 4153, 370, 3365, 5478, 436, 883, 12610, 314, 536, 272, 402, 314, 5478, 2544, 6358, 3062, 14, 339, 710, 1104, 63, 1532, 1423, 1077, 372, 282, 5046, 12, 543, 1124, 549, 1040, 272, 9297, 626, 314, 3329, 1077, 506, 6511, 436, 6326, 2808, 272, 436, 1124, 797, 1040, 9297, 626, 314, 3329, 1077, 506, 5525, 14, 339, 520, 635, 3231, 26, 710, 3231, 367, 314, 2397, 4501, 14, 272, 520, 466, 3231, 26, 620, 272, 520, 635, 1104, 63, 1532, 26, 6801, 370, 6705, 1314, 5478, 370, 2248, 14, 272, 520, 466, 1104, 63, 1532, 26, 4550, 272, 520, 635, 12677, 63, 265, 63, 912, 26, 9411, 30350, 3775, 370, 12677, 314, 267, 909, 2138, 701, 314, 2397, 2376, 2410, 314, 5253, 365, 6511, 14, 272, 520, 466, 12677, 63, 265, 63, 912, 26, 2155, 272, 520, 635, 12677, 63, 589, 26, 15483, 279, 2368, 370, 986 ]
[ 2050, 199, 199, 504, 1275, 3827, 492, 3447, 1909, 6382, 2988, 199, 504, 1275, 1971, 492, 3091, 12962, 199, 199, 4947, 275, 2050, 14, 5572, 3460, 354, 3368, 421, 199, 533, 28626, 6382, 2988, 8, 6589, 6382, 2988, 304, 272, 408, 30777, 1006, 8963, 436, 4766, 641, 6451, 14, 339, 961, 365, 2997, 367, 1846, 13, 5720, 10358, 626, 1929, 370, 986, 272, 3365, 4153, 370, 3365, 5478, 14, 339, 520, 635, 3231, 26, 710, 3231, 367, 314, 2397, 4501, 14, 272, 520, 466, 3231, 26, 620, 272, 520, 635, 1104, 63, 1532, 26, 6801, 370, 6705, 1314, 5478, 370, 2248, 14, 272, 520, 466, 1104, 63, 1532, 26, 4550, 272, 520, 635, 12677, 63, 265, 63, 912, 26, 9411, 30350, 3775, 370, 12677, 314, 267, 909, 2138, 701, 314, 2397, 2376, 2410, 314, 5253, 365, 6511, 14, 272, 520, 466, 12677, 63, 265, 63, 912, 26, 2155, 272, 520, 635, 12677, 63, 589, 26, 15483, 279, 2368, 370, 986, 1380, 26750, 267, 314, 909, 2138, 701, 314, 2397, 2376, 14, 5972, 1202, 340, 12677, 63, 265, 63, 912, 267, 365, 715, 14, 272, 520, 466, 12677, 63, 589, 26, 2008, 272, 520, 635, 12677, 63, 10340, 26, 16198, 2368, 370, 986, 1380, 26750, 267, 314, 909, 2138, 701, 314, 2397, 2376, 14, 5972, 1202, 340, 12677, 63, 265, 63, 912, 267, 365, 715, 14, 272, 520, 466, 12677, 63, 10340, 26, 1211, 272, 520, 635, 19843, 63, 1130, 63, 3924, 26, 9411, 30350, 3775, 4967, 267, 787, 25350, 1536, 4012, 314, 2341, 1240, 503, 3775, 2985, 787, 10367, 436, 267, 2066, 5525, 272, 520, 466, 12677, 63, 265, 63, 912, 26, 2155, 272, 408, 339, 347, 2341, 8, 277, 12, 2457, 63, 1532, 12, 2562, 12, 627, 589, 12, 1011, 10340, 304, 267, 408, 3315, 323, 1806, 314, 5478, 26750, 2562, 342, 367, 1263, 2382, 267, 2457, 63, 1532, 342, 2529, 715, 14, 398, 710, 4955, 402, 2457, 63, 1532, 342, 1077, 506, 447, 953, 347, 2457, 63, 1532, 8, 832, 12, 627, 589, 12, 1011, 10340, 304, 355, 986, 398, 710, 1642, 1423, 370, 2457, 63, 1532, 1062, 283, 832, 297, 365, 314, 267, 520, 533, 6054, 1597, 1354, 720, 14, 3435, 14, 6382, 64, 267, 1256, 14, 2457, 63, 1532, 342, 1077, 372, 715, 340, 314, 3329, 267, 1077, 506, 10302, 367, 314, 1324, 2368, 14, 398, 710, 4955, 367, 2562, 342, 1077, 506, 447, 953, 347, 2562, 8, 832, 12, 627, 589, 12, 1011, 10340, 304, 355, 986, 398, 710, 1642, 1423, 370, 2562, 1062, 283, 832, 297, 365, 314, 267, 520, 533, 6054, 1597, 1354, 720, 14, 3435, 14, 6382, 64, 1256, 14, 398, 24873, 4915, 687, 4453, 2562, 342, 787, 25350, 1536, 436, 267, 6661, 15248, 340, 291, 14, 19432, 63, 1130, 63, 3924, 365, 715, 12, 267, 4257, 2985, 787, 10367, 436, 5525, 14, 398, 520, 635, 2457, 63, 1532, 26, 16975, 370, 511, 1924, 3329, 14, 267, 520, 635, 2562, 26, 16975, 370, 12677, 367, 1924, 3329, 14, 267, 520, 635, 1249, 26, 4905, 2368, 370, 986, 370, 2562, 342, 267, 520, 635, 16286, 26, 6431, 2368, 370, 986, 370, 2562, 342, 267, 520, 5808, 26, 3820, 402, 1338, 2138, 687, 2562, 342, 267, 408, 267, 340, 440, 291, 14, 5359, 26, 288, 327, 7600, 26, 3645, 282, 1655, 2488, 1919, 1021, 2348, 14, 288, 746, 3091, 12962, 360, 1944, 450, 83, 5478, 1911, 7, 450, 291, 14, 3251, 9, 267, 1177, 275, 942, 267, 367, 325, 315, 291, 14, 5359, 26, 288, 340, 2457, 63, 1532, 8, 69, 12, 627, 589, 12, 1011, 10340, 304, 355, 291, 423, 15195, 63, 368, 63, 2718, 8, 1310, 14, 740, 12, 2562, 12, 325, 12, 1249, 12, 16286, 9, 267, 372, 1177, 339, 347, 2341, 63, 765, 8, 277, 12, 2457, 63, 1532, 12, 1083, 63, 354, 12, 627, 589, 12, 1011, 10340, 304, 267, 408, 3315, 323, 1806, 314, 5478, 26750, 1924, 1373, 1159, 909, 1083, 2797, 267, 658, 765, 63, 354, 64, 367, 1263, 2382, 2457, 63, 1532, 342, 2529, 715, 14, 398, 961, 365, 7353, 402, 1808, 520, 5247, 1705, 1130, 64, 543, 2562, 663, 370, 267, 658, 2734, 671, 26, 671, 14, 1113, 14, 765, 63, 354, 11995, 267, 1830, 3769, 1655, 22700, 14, 398, 24873, 4915, 687, 4453, 314, 2797, 1083, 787, 25350, 1536, 267, 436, 6661, 15248, 340, 291, 14, 19432, 63, 1130, 63, 3924, 365, 715, 12, 267, 4257, 2985, 787, 10367, 436, 5525, 14, 398, 2508, 7445, 447, 378, 14, 713, 398, 520, 635, 2457, 63, 1532, 26, 16975, 370, 511, 1924, 3329, 14, 267, 520, 635, 1083, 63, 354, 26, 710, 3329, 1083, 536, 370, 1240, 1169, 367, 1924, 3329, 14, 267, 520, 635, 1249, 26, 4905, 2368, 370, 986, 370, 1083, 267, 520, 635, 16286, 26, 6431, 2368, 370, 986, 370, 1083, 267, 520, 5808, 26, 3820, 402, 1338, 2138, 687, 3102, 267, 408, 267, 372, 291, 14, 1130, 8, 1541, 63, 1532, 12, 291, 423, 1250, 63, 3435, 63, 765, 12, 717, 1083, 63, 354, 12, 627, 589, 12, 1011, 10340, 9, 421, 199, 533, 2812, 20628, 6382, 2988, 8, 20628, 6382, 2988, 304, 272, 408, 30777, 1006, 8963, 436, 4766, 641, 6451, 14, 339, 961, 365, 2997, 367, 1846, 13, 5720, 10358, 626, 1929, 370, 986, 272, 3365, 4153, 370, 3365, 5478, 436, 883, 12610, 314, 536, 272, 402, 314, 5478, 2544, 6358, 3062, 14, 339, 710, 1104, 63, 1532, 1423, 1077, 372, 282, 5046, 12, 543, 1124, 549, 1040, 272, 9297, 626, 314, 3329, 1077, 506, 6511, 436, 6326, 2808, 272, 436, 1124, 797, 1040, 9297, 626, 314, 3329, 1077, 506, 5525, 14, 339, 520, 635, 3231, 26, 710, 3231, 367, 314, 2397, 4501, 14, 272, 520, 466, 3231, 26, 620, 272, 520, 635, 1104, 63, 1532, 26, 6801, 370, 6705, 1314, 5478, 370, 2248, 14, 272, 520, 466, 1104, 63, 1532, 26, 4550, 272, 520, 635, 12677, 63, 265, 63, 912, 26, 9411, 30350, 3775, 370, 12677, 314, 267, 909, 2138, 701, 314, 2397, 2376, 2410, 314, 5253, 365, 6511, 14, 272, 520, 466, 12677, 63, 265, 63, 912, 26, 2155, 272, 520, 635, 12677,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, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
Erotemic/ibeis
dev/_scripts/installers.py
1
16608
#!/usr/bin/env python # -*- coding: utf-8 -*- r""" On mac need to run with sudo Testing: python %HOME%/code/ibeis/_installers/ibeis_pyinstaller_data_helper.py --test-get_data_list python ~/code/ibeis/_installers/ibeis_pyinstaller_data_helper.py --test-get_data_list SeeAlso: _installers/ibeis_pyinstaller_data_helper.py _installers/pyinstaller-ibeis.spec WindowsNew: python installers --build python installers --inno python installers --test References: https://groups.google.com/forum/#!topic/pyinstaller/178I9ANuk14 This script is often flaky. here are workarounds CommonIssues: Is the correct opencv being found? Is 3.0 being built? I think we are on 2.4.8 InstallPyinstaller: pip install pyinstaller pip install pyinstaller --upgrade Win32CommandLine: # Uninstallation python installers.py --clean # Build Installer pyinstaller --runtime-hook rthook_pyqt4.py _installers/pyinstaller-ibeis.spec -y "C:\Program Files (x86)\Inno Setup 5\ISCC.exe" _installers\win_installer_script.iss # Install dist\ibeis-win32-setup.exe # Test "C:\Program Files (x86)\IBEIS\IBEISApp.exe" """ from __future__ import absolute_import, division, print_function from os.path import dirname, realpath, join, exists, normpath #import six import utool as ut import sys import importlib from os.path import join # NOQA def use_development_pyinstaller(): """ sudo pip uninstall pyinstaller pip uninstall pyinstaller code git clone https://github.com/pyinstaller/pyinstaller.git cd pyinstaller sudo python setup.py develop sudo python setup.py install ib which pyinstaller export PATH=$PATH:/opt/local/Library/Frameworks/Python.framework/Versions/2.7/bin had to uninstall sphinx sudo pip uninstall sphinx sudo pip uninstall sphinx """ def fix_pyinstaller_sip_api(): """ Hack to get the correct version of SIP for win32 References: http://stackoverflow.com/questions/21217399/pyqt4-qtcore-qvariant-object-instead-of-a-string """ import PyInstaller from os.path import dirname, join # NOQA hook_fpath = join(dirname(PyInstaller.__file__), 'loader', 'rthooks', 'pyi_rth_qt4plugins.py') patch_code = ut.codeblock( ''' try: import sip # http://stackoverflow.com/questions/21217399/pyqt4-qtcore-qvariant-object-instead-of-a-string sip.setapi('QVariant', 2) sip.setapi('QString', 2) sip.setapi('QTextStream', 2) sip.setapi('QTime', 2) sip.setapi('QUrl', 2) sip.setapi('QDate', 2) sip.setapi('QDateTime', 2) if hasattr(sip, 'setdestroyonexit'): sip.setdestroyonexit(False) # This prevents a crash on windows except ValueError as ex: print('Warning: Value Error: %s' % str(ex)) pass ''') fpath = hook_fpath # Patch the hook file tag = 'SIP_API_2' ut.inject_python_code(fpath, patch_code, tag) #ut.editfile(hook_fpath) pass def get_setup_dpath(): assert exists('setup.py'), 'must be run in ibeis directory' #assert exists('main.py'), 'must be run in ibeis directory' assert exists('../ibeis/ibeis'), 'must be run in ibeis directory' cwd = normpath(realpath(dirname(__file__))) return cwd def clean_pyinstaller(): print('[installer] +--- CLEAN_PYINSTALLER ---') cwd = get_setup_dpath() ut.remove_files_in_dir(cwd, 'IBEISApp.pkg', recursive=False) ut.remove_files_in_dir(cwd, 'qt_menu.nib', recursive=False) ut.remove_files_in_dir(cwd, 'qt_menu.nib', recursive=False) ut.delete(join(cwd, 'dist/ibeis')) ut.delete(join(cwd, 'ibeis-win32-setup.exe')) ut.delete(join(cwd, 'build')) #ut.delete(join(cwd, 'pyrf')) #ut.delete(join(cwd, 'pyhesaff')) print('[installer] L___ FINSHED CLEAN_PYINSTALLER ___') def build_pyinstaller(): """ build_pyinstaller creates build/ibeis/* and dist/ibeis/* """ print('[installer] +--- BUILD_PYINSTALLER ---') # 1) RUN: PYINSTALLER # Run the pyinstaller command (does all the work) utool_python_path = dirname(dirname(ut.__file__)) #import os #os.environ['PYTHONPATH'] = os.pathsep.join([utool_python_path] + os.environ['PYTHONPATH'].strip(os.pathsep).split(os.pathsep)) import os sys.path.insert(1, utool_python_path) if not ut.WIN32: pathcmd = 'export PYTHONPATH=%s%s$PYTHONPATH && ' % (utool_python_path, os.pathsep) else: pathcmd = '' installcmd = '/opt/local/Library/Frameworks/Python.framework/Versions/2.7/bin/pyinstaller --runtime-hook _installers/rthook_pyqt4.py _installers/pyinstaller-ibeis.spec -y' output, err, ret = ut.cmd(pathcmd + installcmd) if ret != 0: raise AssertionError('Pyinstalled failed with return code = %r' % (ret,)) #ut.cmd(installcmd) #ut.cmd('pyinstaller --runtime-hook rthook_pyqt4.py _installers/pyinstaller-ibeis.spec -y') #else: #ut.cmd('pyinstaller', '_installers/pyinstaller-ibeis.spec', '-y') #ut.cmd('pyinstaller', '--runtime-hook rthook_pyqt4.py', '_installers/pyinstaller-ibeis.spec') # 2) POST: PROCESSING # Perform some post processing steps on the mac if sys.platform == 'darwin' and exists('dist/IBEIS.app/Contents/'): copy_list = [ ('ibsicon.icns', 'Resources/icon-windowed.icns'), ('Info.plist', 'Info.plist'), ] srcdir = '_installers' dstdir = 'dist/IBEIS.app/Contents/' for srcname, dstname in copy_list: src = join(srcdir, srcname) dst = join(dstdir, dstname) ut.copy(src, dst) # TODO: make this take arguments instead of defaulting to ~/code/ibeis/build #print("RUN: sudo ./_installers/mac_dmg_builder.sh") app_fpath = get_dist_app_fpath() print('[installer] app_fpath = %s' % (app_fpath,)) print('[installer] L___ FINISH BUILD_PYINSTALLER ___') # ut.cmd('./_scripts/mac_dmg_builder.sh') def ensure_inno_isinstalled(): """ Ensures that the current machine has INNO installed. returns path to the executable """ assert ut.WIN32, 'Can only build INNO on windows' inno_fpath = ut.search_in_dirs('Inno Setup 5\ISCC.exe', ut.get_install_dirs()) # Make sure INNO is installed if inno_fpath is None: print('WARNING: cannot find inno_fpath') AUTO_FIXIT = ut.WIN32 print('Inno seems to not be installed. AUTO_FIXIT=%r' % AUTO_FIXIT) if AUTO_FIXIT: print('Automaticaly trying to downoad and install INNO') # Download INNO Installer inno_installer_url = 'http://www.jrsoftware.org/download.php/ispack.exe' inno_installer_fpath = ut.download_url(inno_installer_url) print('Automaticaly trying to install INNO') # Install INNO Installer ut.cmd(inno_installer_fpath) else: inno_homepage_url = 'http://www.jrsoftware.org/isdl.php' ut.open_url_in_browser(inno_homepage_url) raise AssertionError('Cannot find INNO and AUTOFIX it is false') # Ensure that it has now been installed inno_fpath = ut.search_in_dirs('Inno Setup 5\ISCC.exe', ut.get_install_dirs()) assert ut.checkpath(inno_fpath, verbose=True, info=True), 'inno installer is still not installed!' return inno_fpath def ensure_inno_script(): """ writes inno script to disk for win32 installer build """ cwd = get_setup_dpath() iss_script_fpath = join(cwd, '_installers', 'win_installer_script.iss') # THE ISS USES {} AS SYNTAX. CAREFUL #app_publisher = 'Rensselaer Polytechnic Institute' #app_name = 'IBEIS' import ibeis iss_script_code = ut.codeblock( r''' ; Script generated by the Inno Setup Script Wizard. ; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES! ; http://www.jrsoftware.org/isdl.php [Setup] ; NOTE: The value of AppId uniquely identifies this application. ; Do not use the same AppId value in installers for other applications. ; (To generate a new GUID, click Tools | Generate GUID inside the IDE.) ; Also it seems like the off-balanced curly brace is necessary AppId={{47BE3DA2-261D-4672-9849-18BB2EB382FC} AppName=IBEIS AppVersion=''' + str(ibeis.__version__) + ''' ;AppVerName=IBEIS 1 AppPublisher=Rensselaer Polytechnic Institute AppPublisherURL=ibeis.org ;www.rpi.edu/~crallj/ AppSupportURL=ibeis.org ;ww.rpi.edu/~crallj/ AppUpdatesURL=ibeis.org ;www.rpi.edu/~crallj/ DefaultDirName={pf}\IBEIS DefaultGroupName=IBEIS OutputBaseFilename=ibeis-win32-setup SetupIconFile=ibsicon.ico Compression=lzma SolidCompression=yes [Languages] Name: "english"; MessagesFile: "compiler:Default.isl" [Tasks] Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked [Files] Source: "..\dist\ibeis\IBEISApp.exe"; DestDir: "{app}"; Flags: ignoreversion Source: "..\dist\ibeis\*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs ; NOTE: Don't use "Flags: ignoreversion" on any shared system files [Icons] Name: "{group}\ibeis"; Filename: "{app}\IBEISApp.exe" Name: "{commondesktop}\ibeis"; Filename: "{app}\IBEISApp.exe"; Tasks: desktopicon [Run] Filename: "{app}\IBEISApp.exe"; Description: "{cm:LaunchProgram,IBEIS}"; Flags: nowait postinstall skipifsilent ''' ) ut.write_to(iss_script_fpath, iss_script_code, onlyifdiff=True) assert ut.checkpath(iss_script_fpath, verbose=True, info=True), 'cannot find iss_script_fpath' return iss_script_fpath def build_win32_inno_installer(): """ win32 self-executable package """ print('[installer] +--- BUILD_WIN32_INNO_INSTALLER ---') assert ut.WIN32, 'Can only build INNO on windows' # Get inno executable inno_fpath = ensure_inno_isinstalled() # Get IBEIS inno script iss_script_fpath = ensure_inno_script() print('Trying to run ' + ' '.join(['"' + inno_fpath + '"', '"' + iss_script_fpath + '"'])) try: command_args = ' '.join((inno_fpath, iss_script_fpath)) ut.cmd(command_args) except Exception as ex: ut.printex(ex, 'error running script') raise # Move the installer into dist and make a timestamped version # Uninstall exe in case we need to cleanup #uninstall_ibeis_exe = 'unins000.exe' cwd = get_setup_dpath() installer_fpath = join(cwd, '_installers', 'Output', 'ibeis-win32-setup.exe') print('[installer] L___ BUILD_WIN32_INNO_INSTALLER ___') return installer_fpath def build_osx_dmg_installer(): # outputs dmg to ut.cmd('./_installers/mac_dmg_builder.sh', sudo=True) cwd = get_setup_dpath() installer_fpath = join(cwd, 'dist', 'IBEIS.dmg') return installer_fpath def build_linux_zip_binaries(): fpath_list = ut.ls('dist/ibeis') archive_fpath = 'dist/ibeis-linux-binary.zip' ut.archive_files(archive_fpath, fpath_list) return archive_fpath def package_installer(): """ system dependent post pyinstaller step """ print('[installer] +--- PACKAGE_INSTALLER ---') #build_win32_inno_installer() cwd = get_setup_dpath() # Build the os-appropriate package if sys.platform.startswith('win32'): installer_src = build_win32_inno_installer() installer_fname_fmt = 'ibeis-win32-install-{timestamp}.exe' elif sys.platform.startswith('darwin'): installer_src = build_osx_dmg_installer() installer_fname_fmt = 'ibeis-osx-install-{timestamp}.dmg' elif sys.platform.startswith('linux'): installer_src = build_linux_zip_binaries() installer_fname_fmt = 'ibeis-linux-binary-{timestamp}.zip' #try: # raise NotImplementedError('no linux packager (rpm or deb) supported. try running with --build') #except Exception as ex: # ut.printex(ex) #pass # timestamp the installer name installer_fname = installer_fname_fmt.format(timestamp=ut.get_timestamp()) installer_dst = join(cwd, 'dist', installer_fname) try: ut.move(installer_src, installer_dst) except Exception as ex: ut.printex(ex, 'error moving setups', iswarning=True) print('[installer] L___ FINISH PACKAGE_INSTALLER ___') def fix_importlib_hook(): """ IMPORTLIB FIX References: http://stackoverflow.com/questions/18596410/importerror-no-module-named-mpl-toolkits-with-maptlotlib-1-3-0-and-py2exe """ try: dpath_ = importlib.import_module('mpl_toolkits').__path__ if isinstance(dpath_, (list, tuple)): for dpath in dpath_: fpath = join(dpath, '__init__.py') break else: dpath = dpath_ if not ut.checkpath(dpath, verbose=True, info=True): ut.touch(fpath) except ImportError as ex: ut.printex(ex, 'pip install mpl_toolkits?') def get_dist_app_fpath(): app_fpath = ut.unixpath('dist/ibeis/IBEISApp') if ut.DARWIN: app_fpath = ut.unixpath('dist/IBEIS.app/Contents/MacOS/IBEISApp') if ut.WIN32: app_fpath += '.exe' return app_fpath def run_suite_test(): app_fpath = get_dist_app_fpath() ut.assert_exists(app_fpath, 'app fpath must exist', info=True, verbose=True) ut.cmd(app_fpath + ' --run-utool-tests') #ut.cmd(app_fpath + ' --run-vtool_ibeis-tests') #ut.cmd(app_fpath + ' --run-ibeis-tests') def run_app_test(): """ Execute the installed app """ print('[installer] +--- TEST_APP ---') app_fpath = get_dist_app_fpath() ut.assert_exists(app_fpath, 'app fpath must exist', info=True, verbose=True) if ut.DARWIN: #ut.cmd('open ' + ut.unixpath('dist/IBEIS.app')) """ rm -rf ~/Desktop/IBEIS.app rm -rf /Applications/IBEIS.app ls /Applications/IBEIS.app cd /Volumes/IBEIS ib cd dist # Install to /Applications hdiutil attach ~/code/ibeis/dist/IBEIS.dmg cp -R /Volumes/IBEIS/IBEIS.app /Applications/IBEIS.app hdiutil unmount /Volumes/IBEIS open -a /Applications/IBEIS.app chmod +x /Applications/IBEIS.app/Contents/MacOS/IBEISApp cp -R /Volumes/IBEIS/IBEIS.app ~/Desktop open -a ~/Desktop/IBEIS.app chmod +x ~/code/ibeis/dist/IBEIS.app/Contents/MacOS/IBEISApp open -a ~/code/ibeis/dist/IBEIS.app open ~/code/ibeis/dist/IBEIS.app/Contents/MacOS/IBEISApp open ~/Desktop/IBEIS.app ./dist/IBEIS.app/Contents/MacOS/IBEISApp --run-tests """ ut.cmd(app_fpath) else: ut.cmd(app_fpath) print('[installer] L___ FINISH TEST_APP ___') #ut.cmd(ut.unixpath('dist/ibeis/ibeis-win32-setup.exe')) def main(): """ CommandLine: python installers.py --clean python installers.py --all python installers.py --inno # For linux python installers.py --clean python installers.py --build python installers.py --test python installers.py --clean --build --test python installers.py --build --test """ print('For a full run use: python installers.py --all') print('[installer] +--- MAIN ---') import functools get_argflag = functools.partial(ut.get_argflag, need_prefix=False) BUILD_APP = get_argflag(('--build')) BUILD_INSTALLER = get_argflag(('--inno', '--package', '--pkg')) TEST_RUN = get_argflag(('--run')) TEST_CODE = get_argflag(('--test')) CLEAN_BUILD = get_argflag(('--clean')) ALL = get_argflag('--all') fix_importlib_hook() # default behavior is full build DEFAULT_RUN = len(sys.argv) == 1 #or not (CLEAN_BUILD or BUILD_APP or BUILD_INSTALLER or TEST_APP) # 1) SETUP: CLEAN UP if CLEAN_BUILD or ALL: clean_pyinstaller() if BUILD_APP or ALL or DEFAULT_RUN: build_pyinstaller() if BUILD_INSTALLER or ALL: package_installer() if TEST_CODE or ALL: run_suite_test() if TEST_RUN or ALL: run_app_test() print('[installer] L___ FINISH MAIN ___') if __name__ == '__main__': main() ''' dist\ibeis-win32-setup.exe dist\ibeis\IBEISApp.exe '''
apache-2.0
[ 3381, 2647, 15, 1393, 15, 1813, 2366, 199, 3, 1882, 2803, 26, 2774, 13, 24, 1882, 199, 82, 624, 199, 3314, 4497, 1929, 370, 1255, 543, 14682, 421, 199, 9029, 26, 272, 2366, 450, 9524, 5, 15, 600, 15, 73, 1235, 374, 15607, 17047, 83, 15, 73, 1235, 374, 63, 647, 17047, 63, 576, 63, 3676, 14, 647, 1553, 396, 13, 362, 63, 576, 63, 513, 272, 2366, 6146, 15, 600, 15, 73, 1235, 374, 15607, 17047, 83, 15, 73, 1235, 374, 63, 647, 17047, 63, 576, 63, 3676, 14, 647, 1553, 396, 13, 362, 63, 576, 63, 513, 4388, 199, 9295, 31892, 26, 272, 485, 17047, 83, 15, 73, 1235, 374, 63, 647, 17047, 63, 576, 63, 3676, 14, 647, 272, 485, 17047, 83, 15, 647, 17047, 13, 73, 1235, 374, 14, 1650, 199, 199, 8647, 4665, 26, 272, 2366, 18535, 83, 1553, 1506, 272, 2366, 18535, 83, 1553, 262, 889, 272, 2366, 18535, 83, 1553, 396, 199, 199, 15242, 26, 272, 4178, 921, 2634, 14, 3098, 14, 957, 15, 10044, 15, 3168, 5746, 15, 647, 17047, 15, 11175, 41, 25, 879, 3210, 1079, 199, 199, 2765, 2884, 365, 14115, 17566, 10562, 14, 2348, 787, 18092, 83, 199, 199, 7844, 17106, 83, 26, 272, 6596, 314, 3211, 1551, 5107, 3769, 1911, 31, 272, 6596, 650, 14, 16, 3769, 6137, 31, 473, 13516, 781, 787, 641, 499, 14, 20, 14, 24, 199, 199, 8154, 2713, 17047, 26, 272, 7305, 3907, 1134, 17047, 272, 7305, 3907, 1134, 17047, 1553, 9375, 199, 199, 8886, 708, 16926, 26, 272, 327, 1910, 23048, 272, 2366, 18535, 83, 14, 647, 1553, 3118, 339, 327, 6516, 14089, 9230, 272, 1134, 17047, 1553, 7726, 13, 3664, 519, 273, 6992, 63, 24835, 20, 14, 647, 485, 17047, 83, 15, 647, 17047, 13, 73, 1235, 374, 14, 1650, 446, 89, 272, 298, 35, 3427, 9184, 16920, 334, 88, 1184, 2862, 607, 889, 12439, 959, 60, 1311, 2571, 14, 5803, 2, 485, 17047, 83, 60, 2676, 63, 17047, 63, 1579, 14, 19857, 339, 327, 13276, 272, 2917, 60, 73, 1235, 374, 13, 2676, 708, 13, 2758, 14, 5803, 339, 327, 1379, 272, 298, 35, 3427, 9184, 16920, 334, 88, 1184, 2862, 2100, 37, 1311, 60, 2100, 37, 1311, 2640, 14, 5803, 2, 199, 199, 624, 199, 504, 636, 2443, 363, 492, 3679, 63, 646, 12, 4629, 12, 870, 63, 1593, 199, 504, 747, 14, 515, 492, 9017, 12, 3363, 515, 12, 4263, 12, 3495, 12, 25962, 199, 3, 646, 3816, 199, 646, 221, 1283, 393, 465, 11430, 199, 646, 984, 199, 646, 14802, 199, 504, 747, 14, 515, 492, 4263, 221, 327, 20432, 421, 199, 318, 675, 63, 31688, 63, 647, 17047, 837, 272, 408, 272, 14682, 7305, 22199, 1134, 17047, 272, 7305, 22199, 1134, 17047, 272, 1233, 272, 6135, 7289, 4178, 921, 5031, 14, 957, 15, 647, 17047, 15, 647, 17047, 14, 3187, 272, 12829, 1134, 17047, 272, 14682, 2366, 3272, 14, 647, 477, 7549, 272, 14682, 2366, 3272, 14, 647, 3907, 272, 26242, 272, 1314, 1134, 17047, 339, 4843, 15097, 28617, 3243, 11254, 2992, 15, 1832, 15, 7424, 15, 30052, 15, 4718, 14, 4857, 15, 21167, 15, 18, 14, 23, 15, 1393, 339, 10530, 370, 22199, 15882, 272, 14682, 7305, 22199, 15882, 272, 14682, 7305, 22199, 15882, 272, 408, 421, 199, 318, 5325, 63, 647, 17047, 63, 17839, 63, 1246, 837, 272, 408, 272, 30802, 370, 664, 314, 3211, 1015, 402, 428, 1772, 367, 4747, 708, 339, 14504, 26, 267, 1455, 921, 23153, 14, 957, 15, 16069, 15, 11722, 1196, 10936, 15, 24835, 20, 13, 8440, 1018, 13, 81, 8759, 13, 785, 13, 23145, 13, 1618, 13, 65, 13, 875, 272, 408, 272, 492, 1611, 27598, 272, 687, 747, 14, 515, 492, 9017, 12, 4263, 221, 327, 20432, 272, 5759, 63, 23248, 275, 4263, 8, 3475, 8, 2713, 27598, 855, 493, 10139, 283, 3422, 297, 283, 82, 273, 6992, 83, 297, 283, 647, 73, 63, 82, 273, 63, 8440, 20, 5265, 14, 647, 358, 272, 3371, 63, 600, 275, 11430, 14, 600, 1457, 8, 267, 1449, 267, 862, 26, 288, 492, 25342, 288, 327, 1455, 921, 23153, 14, 957, 15, 16069, 15, 11722, 1196, 10936, 15, 24835, 20, 13, 8440, 1018, 13, 81, 8759, 13, 785, 13, 23145, 13, 1618, 13, 65, 13, 875, 288, 25342, 14, 409, 1246, 360, 49, 12935, 297, 499, 9, 288, 25342, 14, 409, 1246, 360, 49, 1558, 297, 499, 9, 288, 25342, 14, 409, 1246, 360, 49, 1872, 3296, 297, 499, 9, 288, 25342, 14, 409, 1246, 360, 49, 1366, 297, 499, 9, 288, 25342, 14, 409, 1246, 360, 2328, 4308, 297, 499, 9, 288, 25342, 14, 409, 1246, 360, 49, 2506, 297, 499, 9, 288, 25342, 14, 409, 1246, 360, 49, 3926, 297, 499, 9, 288, 340, 2688, 8, 17839, 12, 283, 409, 7237, 368, 88, 390, 735, 355, 25342, 14, 409, 7237, 368, 88, 390, 8, 797, 9, 221, 327, 961, 21925, 282, 12420, 641, 10061, 267, 871, 1722, 465, 444, 26, 288, 870, 360, 3849, 26, 1594, 4520, 26, 450, 83, 7, 450, 620, 8, 476, 430, 267, 986, 267, 21464, 272, 30540, 275, 5759, 63, 23248, 272, 327, 19292, 314, 5759, 570, 272, 1947, 275, 283, 51, 1772, 63, 3735, 63, 18, 7, 272, 11430, 14, 14815, 63, 1548, 63, 600, 8, 23248, 12, 3371, 63, 600, 12, 1947, 9, 272, 327, 337, 14, 3773, 493, 8, 3664, 63, 23248, 9, 272, 986, 421, 199, 318, 664, 63, 2758, 63, 68, 515, 837, 272, 702, 3495, 360, 2758, 14, 647, 659, 283, 7790, 506, 1255, 315, 284, 1235, 374, 2082, 7, 272, 327, 479, 3495, 360, 973, 14, 647, 659, 283, 7790, 506, 1255, 315, 284, 1235, 374, 2082, 7, 272, 702, 3495, 24592, 73, 1235, 374, 15, 73, 1235, 374, 659, 283, 7790, 506, 1255, 315, 284, 1235, 374, 2082, 7, 272, 8288, 275, 25962, 8, 11091, 8, 3475, 3460, 493, 29658, 272, 372, 8288, 421, 199, 318, 3633, 63, 647, 17047, 837, 272, 870, 11894, 17047, 61, 435, 2595, 445, 906, 879, 63, 4521, 16811, 540, 10894, 358, 272, 8288, 275, 664, 63, 2758, 63, 68, 515, 342, 272, 11430, 14, 2168, 63, 1725, 63, 262, 63, 694, 8, 6525 ]
[ 2647, 15, 1393, 15, 1813, 2366, 199, 3, 1882, 2803, 26, 2774, 13, 24, 1882, 199, 82, 624, 199, 3314, 4497, 1929, 370, 1255, 543, 14682, 421, 199, 9029, 26, 272, 2366, 450, 9524, 5, 15, 600, 15, 73, 1235, 374, 15607, 17047, 83, 15, 73, 1235, 374, 63, 647, 17047, 63, 576, 63, 3676, 14, 647, 1553, 396, 13, 362, 63, 576, 63, 513, 272, 2366, 6146, 15, 600, 15, 73, 1235, 374, 15607, 17047, 83, 15, 73, 1235, 374, 63, 647, 17047, 63, 576, 63, 3676, 14, 647, 1553, 396, 13, 362, 63, 576, 63, 513, 4388, 199, 9295, 31892, 26, 272, 485, 17047, 83, 15, 73, 1235, 374, 63, 647, 17047, 63, 576, 63, 3676, 14, 647, 272, 485, 17047, 83, 15, 647, 17047, 13, 73, 1235, 374, 14, 1650, 199, 199, 8647, 4665, 26, 272, 2366, 18535, 83, 1553, 1506, 272, 2366, 18535, 83, 1553, 262, 889, 272, 2366, 18535, 83, 1553, 396, 199, 199, 15242, 26, 272, 4178, 921, 2634, 14, 3098, 14, 957, 15, 10044, 15, 3168, 5746, 15, 647, 17047, 15, 11175, 41, 25, 879, 3210, 1079, 199, 199, 2765, 2884, 365, 14115, 17566, 10562, 14, 2348, 787, 18092, 83, 199, 199, 7844, 17106, 83, 26, 272, 6596, 314, 3211, 1551, 5107, 3769, 1911, 31, 272, 6596, 650, 14, 16, 3769, 6137, 31, 473, 13516, 781, 787, 641, 499, 14, 20, 14, 24, 199, 199, 8154, 2713, 17047, 26, 272, 7305, 3907, 1134, 17047, 272, 7305, 3907, 1134, 17047, 1553, 9375, 199, 199, 8886, 708, 16926, 26, 272, 327, 1910, 23048, 272, 2366, 18535, 83, 14, 647, 1553, 3118, 339, 327, 6516, 14089, 9230, 272, 1134, 17047, 1553, 7726, 13, 3664, 519, 273, 6992, 63, 24835, 20, 14, 647, 485, 17047, 83, 15, 647, 17047, 13, 73, 1235, 374, 14, 1650, 446, 89, 272, 298, 35, 3427, 9184, 16920, 334, 88, 1184, 2862, 607, 889, 12439, 959, 60, 1311, 2571, 14, 5803, 2, 485, 17047, 83, 60, 2676, 63, 17047, 63, 1579, 14, 19857, 339, 327, 13276, 272, 2917, 60, 73, 1235, 374, 13, 2676, 708, 13, 2758, 14, 5803, 339, 327, 1379, 272, 298, 35, 3427, 9184, 16920, 334, 88, 1184, 2862, 2100, 37, 1311, 60, 2100, 37, 1311, 2640, 14, 5803, 2, 199, 199, 624, 199, 504, 636, 2443, 363, 492, 3679, 63, 646, 12, 4629, 12, 870, 63, 1593, 199, 504, 747, 14, 515, 492, 9017, 12, 3363, 515, 12, 4263, 12, 3495, 12, 25962, 199, 3, 646, 3816, 199, 646, 221, 1283, 393, 465, 11430, 199, 646, 984, 199, 646, 14802, 199, 504, 747, 14, 515, 492, 4263, 221, 327, 20432, 421, 199, 318, 675, 63, 31688, 63, 647, 17047, 837, 272, 408, 272, 14682, 7305, 22199, 1134, 17047, 272, 7305, 22199, 1134, 17047, 272, 1233, 272, 6135, 7289, 4178, 921, 5031, 14, 957, 15, 647, 17047, 15, 647, 17047, 14, 3187, 272, 12829, 1134, 17047, 272, 14682, 2366, 3272, 14, 647, 477, 7549, 272, 14682, 2366, 3272, 14, 647, 3907, 272, 26242, 272, 1314, 1134, 17047, 339, 4843, 15097, 28617, 3243, 11254, 2992, 15, 1832, 15, 7424, 15, 30052, 15, 4718, 14, 4857, 15, 21167, 15, 18, 14, 23, 15, 1393, 339, 10530, 370, 22199, 15882, 272, 14682, 7305, 22199, 15882, 272, 14682, 7305, 22199, 15882, 272, 408, 421, 199, 318, 5325, 63, 647, 17047, 63, 17839, 63, 1246, 837, 272, 408, 272, 30802, 370, 664, 314, 3211, 1015, 402, 428, 1772, 367, 4747, 708, 339, 14504, 26, 267, 1455, 921, 23153, 14, 957, 15, 16069, 15, 11722, 1196, 10936, 15, 24835, 20, 13, 8440, 1018, 13, 81, 8759, 13, 785, 13, 23145, 13, 1618, 13, 65, 13, 875, 272, 408, 272, 492, 1611, 27598, 272, 687, 747, 14, 515, 492, 9017, 12, 4263, 221, 327, 20432, 272, 5759, 63, 23248, 275, 4263, 8, 3475, 8, 2713, 27598, 855, 493, 10139, 283, 3422, 297, 283, 82, 273, 6992, 83, 297, 283, 647, 73, 63, 82, 273, 63, 8440, 20, 5265, 14, 647, 358, 272, 3371, 63, 600, 275, 11430, 14, 600, 1457, 8, 267, 1449, 267, 862, 26, 288, 492, 25342, 288, 327, 1455, 921, 23153, 14, 957, 15, 16069, 15, 11722, 1196, 10936, 15, 24835, 20, 13, 8440, 1018, 13, 81, 8759, 13, 785, 13, 23145, 13, 1618, 13, 65, 13, 875, 288, 25342, 14, 409, 1246, 360, 49, 12935, 297, 499, 9, 288, 25342, 14, 409, 1246, 360, 49, 1558, 297, 499, 9, 288, 25342, 14, 409, 1246, 360, 49, 1872, 3296, 297, 499, 9, 288, 25342, 14, 409, 1246, 360, 49, 1366, 297, 499, 9, 288, 25342, 14, 409, 1246, 360, 2328, 4308, 297, 499, 9, 288, 25342, 14, 409, 1246, 360, 49, 2506, 297, 499, 9, 288, 25342, 14, 409, 1246, 360, 49, 3926, 297, 499, 9, 288, 340, 2688, 8, 17839, 12, 283, 409, 7237, 368, 88, 390, 735, 355, 25342, 14, 409, 7237, 368, 88, 390, 8, 797, 9, 221, 327, 961, 21925, 282, 12420, 641, 10061, 267, 871, 1722, 465, 444, 26, 288, 870, 360, 3849, 26, 1594, 4520, 26, 450, 83, 7, 450, 620, 8, 476, 430, 267, 986, 267, 21464, 272, 30540, 275, 5759, 63, 23248, 272, 327, 19292, 314, 5759, 570, 272, 1947, 275, 283, 51, 1772, 63, 3735, 63, 18, 7, 272, 11430, 14, 14815, 63, 1548, 63, 600, 8, 23248, 12, 3371, 63, 600, 12, 1947, 9, 272, 327, 337, 14, 3773, 493, 8, 3664, 63, 23248, 9, 272, 986, 421, 199, 318, 664, 63, 2758, 63, 68, 515, 837, 272, 702, 3495, 360, 2758, 14, 647, 659, 283, 7790, 506, 1255, 315, 284, 1235, 374, 2082, 7, 272, 327, 479, 3495, 360, 973, 14, 647, 659, 283, 7790, 506, 1255, 315, 284, 1235, 374, 2082, 7, 272, 702, 3495, 24592, 73, 1235, 374, 15, 73, 1235, 374, 659, 283, 7790, 506, 1255, 315, 284, 1235, 374, 2082, 7, 272, 8288, 275, 25962, 8, 11091, 8, 3475, 3460, 493, 29658, 272, 372, 8288, 421, 199, 318, 3633, 63, 647, 17047, 837, 272, 870, 11894, 17047, 61, 435, 2595, 445, 906, 879, 63, 4521, 16811, 540, 10894, 358, 272, 8288, 275, 664, 63, 2758, 63, 68, 515, 342, 272, 11430, 14, 2168, 63, 1725, 63, 262, 63, 694, 8, 6525, 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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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 ]
andykimpe/chromium-test-npapi
tools/valgrind/asan/asan_symbolize.py
17
1357
#!/usr/bin/env python # Copyright (c) 2012 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. from third_party import asan_symbolize import os import re import sys def fix_filename(file_name): for path_to_cut in sys.argv[1:]: file_name = re.sub(".*" + path_to_cut, "", file_name) file_name = re.sub(".*asan_[a-z_]*.cc:[0-9]*", "_asan_rtl_", file_name) file_name = re.sub(".*crtstuff.c:0", "???:0", file_name) return file_name class LineBuffered(object): """Disable buffering on a file object.""" def __init__(self, stream): self.stream = stream def write(self, data): self.stream.write(data) if '\n' in data: self.stream.flush() def __getattr__(self, attr): return getattr(self.stream, attr) def disable_buffering(): """Makes this process and child processes stdout unbuffered.""" if not os.environ.get('PYTHONUNBUFFERED'): # Since sys.stdout is a C++ object, it's impossible to do # sys.stdout.write = lambda... sys.stdout = LineBuffered(sys.stdout) os.environ['PYTHONUNBUFFERED'] = 'x' def main(): disable_buffering() asan_symbolize.demangle = True loop = asan_symbolize.SymbolizationLoop(binary_name_filter=fix_filename) loop.process_stdin() if __name__ == '__main__': main()
bsd-3-clause
[ 3381, 2647, 15, 1393, 15, 1813, 2366, 199, 199, 3, 1898, 334, 67, 9, 6029, 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, 504, 10919, 63, 7522, 492, 465, 290, 63, 3840, 656, 13559, 199, 199, 646, 747, 199, 646, 295, 199, 646, 984, 199, 199, 318, 5325, 63, 1501, 8, 493, 63, 354, 304, 523, 367, 931, 63, 475, 63, 5919, 315, 984, 14, 3020, 59, 17, 10688, 272, 570, 63, 354, 275, 295, 14, 954, 480, 2795, 2, 435, 931, 63, 475, 63, 5919, 12, 4873, 570, 63, 354, 9, 523, 570, 63, 354, 275, 295, 14, 954, 480, 2795, 305, 290, 9925, 65, 13, 90, 15555, 14, 2055, 7766, 16, 13, 25, 3672, 401, 2668, 305, 290, 63, 25011, 29808, 570, 63, 354, 9, 523, 570, 63, 354, 275, 295, 14, 954, 480, 2795, 16617, 14573, 14, 67, 26, 16, 401, 298, 10674, 31, 26, 16, 401, 570, 63, 354, 9, 523, 372, 570, 63, 354, 199, 199, 533, 7030, 23139, 8, 785, 304, 523, 408, 13707, 21033, 641, 282, 570, 909, 1041, 523, 347, 636, 826, 721, 277, 12, 2547, 304, 272, 291, 14, 1745, 275, 2547, 819, 347, 2218, 8, 277, 12, 666, 304, 272, 291, 14, 1745, 14, 952, 8, 576, 9, 272, 340, 1557, 78, 7, 315, 666, 26, 489, 291, 14, 1745, 14, 4939, 342, 819, 347, 636, 5675, 721, 277, 12, 1921, 304, 272, 372, 2519, 8, 277, 14, 1745, 12, 1921, 9, 421, 199, 318, 3507, 63, 2738, 316, 837, 523, 408, 27142, 642, 2112, 436, 1982, 10358, 3839, 625, 17605, 1041, 523, 340, 440, 747, 14, 2314, 14, 362, 360, 11720, 1734, 10960, 1149, 735, 272, 327, 9336, 984, 14, 2703, 365, 282, 445, 4176, 909, 12, 652, 1159, 26847, 370, 886, 272, 327, 984, 14, 2703, 14, 952, 275, 2400, 1396, 272, 984, 14, 2703, 275, 7030, 23139, 8, 1274, 14, 2703, 9, 272, 747, 14, 2314, 459, 11720, 1734, 10960, 1149, 418, 275, 283, 88, 7, 421, 199, 318, 2446, 837, 523, 3507, 63, 2738, 316, 342, 523, 465, 290, 63, 3840, 656, 13559, 14, 23522, 4593, 275, 715, 523, 4438, 275, 465, 290, 63, 3840, 656, 13559, 14, 16594, 656, 25698, 7382, 8, 3008, 63, 354, 63, 1541, 29, 970, 63, 1501, 9, 523, 4438, 14, 1412, 63, 6626, 342, 199, 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 ]
[ 2647, 15, 1393, 15, 1813, 2366, 199, 199, 3, 1898, 334, 67, 9, 6029, 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, 504, 10919, 63, 7522, 492, 465, 290, 63, 3840, 656, 13559, 199, 199, 646, 747, 199, 646, 295, 199, 646, 984, 199, 199, 318, 5325, 63, 1501, 8, 493, 63, 354, 304, 523, 367, 931, 63, 475, 63, 5919, 315, 984, 14, 3020, 59, 17, 10688, 272, 570, 63, 354, 275, 295, 14, 954, 480, 2795, 2, 435, 931, 63, 475, 63, 5919, 12, 4873, 570, 63, 354, 9, 523, 570, 63, 354, 275, 295, 14, 954, 480, 2795, 305, 290, 9925, 65, 13, 90, 15555, 14, 2055, 7766, 16, 13, 25, 3672, 401, 2668, 305, 290, 63, 25011, 29808, 570, 63, 354, 9, 523, 570, 63, 354, 275, 295, 14, 954, 480, 2795, 16617, 14573, 14, 67, 26, 16, 401, 298, 10674, 31, 26, 16, 401, 570, 63, 354, 9, 523, 372, 570, 63, 354, 199, 199, 533, 7030, 23139, 8, 785, 304, 523, 408, 13707, 21033, 641, 282, 570, 909, 1041, 523, 347, 636, 826, 721, 277, 12, 2547, 304, 272, 291, 14, 1745, 275, 2547, 819, 347, 2218, 8, 277, 12, 666, 304, 272, 291, 14, 1745, 14, 952, 8, 576, 9, 272, 340, 1557, 78, 7, 315, 666, 26, 489, 291, 14, 1745, 14, 4939, 342, 819, 347, 636, 5675, 721, 277, 12, 1921, 304, 272, 372, 2519, 8, 277, 14, 1745, 12, 1921, 9, 421, 199, 318, 3507, 63, 2738, 316, 837, 523, 408, 27142, 642, 2112, 436, 1982, 10358, 3839, 625, 17605, 1041, 523, 340, 440, 747, 14, 2314, 14, 362, 360, 11720, 1734, 10960, 1149, 735, 272, 327, 9336, 984, 14, 2703, 365, 282, 445, 4176, 909, 12, 652, 1159, 26847, 370, 886, 272, 327, 984, 14, 2703, 14, 952, 275, 2400, 1396, 272, 984, 14, 2703, 275, 7030, 23139, 8, 1274, 14, 2703, 9, 272, 747, 14, 2314, 459, 11720, 1734, 10960, 1149, 418, 275, 283, 88, 7, 421, 199, 318, 2446, 837, 523, 3507, 63, 2738, 316, 342, 523, 465, 290, 63, 3840, 656, 13559, 14, 23522, 4593, 275, 715, 523, 4438, 275, 465, 290, 63, 3840, 656, 13559, 14, 16594, 656, 25698, 7382, 8, 3008, 63, 354, 63, 1541, 29, 970, 63, 1501, 9, 523, 4438, 14, 1412, 63, 6626, 342, 199, 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, 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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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 ]
janicduplessis/buck
third-party/py/unittest2/unittest2/test/test_discovery.py
111
13372
import os import re import sys import unittest2 class TestDiscovery(unittest2.TestCase): # Heavily mocked tests so I can avoid hitting the filesystem def test_get_name_from_path(self): loader = unittest2.TestLoader() loader._top_level_dir = '/foo' name = loader._get_name_from_path('/foo/bar/baz.py') self.assertEqual(name, 'bar.baz') if not __debug__: # asserts are off return self.assertRaises(AssertionError, loader._get_name_from_path, '/bar/baz.py') def test_find_tests(self): loader = unittest2.TestLoader() original_listdir = os.listdir def restore_listdir(): os.listdir = original_listdir original_isfile = os.path.isfile def restore_isfile(): os.path.isfile = original_isfile original_isdir = os.path.isdir def restore_isdir(): os.path.isdir = original_isdir path_lists = [['test1.py', 'test2.py', 'not_a_test.py', 'test_dir', 'test.foo', 'test-not-a-module.py', 'another_dir'], ['test3.py', 'test4.py', ]] os.listdir = lambda path: path_lists.pop(0) self.addCleanup(restore_listdir) def isdir(path): return path.endswith('dir') os.path.isdir = isdir self.addCleanup(restore_isdir) def isfile(path): # another_dir is not a package and so shouldn't be recursed into return not path.endswith('dir') and not 'another_dir' in path os.path.isfile = isfile self.addCleanup(restore_isfile) loader._get_module_from_name = lambda path: path + ' module' loader.loadTestsFromModule = lambda module: module + ' tests' top_level = os.path.abspath('/foo') loader._top_level_dir = top_level suite = list(loader._find_tests(top_level, 'test*.py')) expected = [name + ' module tests' for name in ('test1', 'test2')] expected.extend([('test_dir.%s' % name) + ' module tests' for name in ('test3', 'test4')]) self.assertEqual(suite, expected) def test_find_tests_with_package(self): loader = unittest2.TestLoader() original_listdir = os.listdir def restore_listdir(): os.listdir = original_listdir original_isfile = os.path.isfile def restore_isfile(): os.path.isfile = original_isfile original_isdir = os.path.isdir def restore_isdir(): os.path.isdir = original_isdir directories = ['a_directory', 'test_directory', 'test_directory2'] path_lists = [directories, [], [], []] os.listdir = lambda path: path_lists.pop(0) self.addCleanup(restore_listdir) os.path.isdir = lambda path: True self.addCleanup(restore_isdir) os.path.isfile = lambda path: os.path.basename(path) not in directories self.addCleanup(restore_isfile) class Module(object): paths = [] load_tests_args = [] def __init__(self, path): self.path = path self.paths.append(path) if os.path.basename(path) == 'test_directory': def load_tests(loader, tests, pattern): self.load_tests_args.append((loader, tests, pattern)) return 'load_tests' self.load_tests = load_tests def __eq__(self, other): return self.path == other.path # Silence py3k warning __hash__ = None loader._get_module_from_name = lambda name: Module(name) def loadTestsFromModule(module, use_load_tests): if use_load_tests: raise self.failureException('use_load_tests should be False for packages') return module.path + ' module tests' loader.loadTestsFromModule = loadTestsFromModule loader._top_level_dir = '/foo' # this time no '.py' on the pattern so that it can match # a test package suite = list(loader._find_tests('/foo', 'test*')) # We should have loaded tests from the test_directory package by calling load_tests # and directly from the test_directory2 package self.assertEqual(suite, ['load_tests', 'test_directory2' + ' module tests']) self.assertEqual(Module.paths, ['test_directory', 'test_directory2']) # load_tests should have been called once with loader, tests and pattern self.assertEqual(Module.load_tests_args, [(loader, 'test_directory' + ' module tests', 'test*')]) def test_discover(self): loader = unittest2.TestLoader() original_isfile = os.path.isfile original_isdir = os.path.isdir def restore_isfile(): os.path.isfile = original_isfile os.path.isfile = lambda path: False self.addCleanup(restore_isfile) orig_sys_path = sys.path[:] def restore_path(): sys.path[:] = orig_sys_path self.addCleanup(restore_path) full_path = os.path.abspath(os.path.normpath('/foo')) self.assertRaises(ImportError, loader.discover, '/foo/bar', top_level_dir='/foo') self.assertEqual(loader._top_level_dir, full_path) self.assertIn(full_path, sys.path) os.path.isfile = lambda path: True os.path.isdir = lambda path: True def restore_isdir(): os.path.isdir = original_isdir self.addCleanup(restore_isdir) _find_tests_args = [] def _find_tests(start_dir, pattern): _find_tests_args.append((start_dir, pattern)) return ['tests'] loader._find_tests = _find_tests loader.suiteClass = str suite = loader.discover('/foo/bar/baz', 'pattern', '/foo/bar') top_level_dir = os.path.abspath(os.path.normpath('/foo/bar')) start_dir = os.path.abspath(os.path.normpath('/foo/bar/baz')) self.assertEqual(suite, "['tests']") self.assertEqual(loader._top_level_dir, top_level_dir) self.assertEqual(_find_tests_args, [(start_dir, 'pattern')]) self.assertIn(top_level_dir, sys.path) def test_discover_with_modules_that_fail_to_import(self): loader = unittest2.TestLoader() listdir = os.listdir os.listdir = lambda _: ['test_this_does_not_exist.py'] isfile = os.path.isfile os.path.isfile = lambda _: True orig_sys_path = sys.path[:] def restore(): os.path.isfile = isfile os.listdir = listdir sys.path[:] = orig_sys_path self.addCleanup(restore) suite = loader.discover('.') self.assertIn(os.getcwd(), sys.path) self.assertEqual(suite.countTestCases(), 1) test = list(list(suite)[0])[0] # extract test from suite self.assertRaises(ImportError, lambda: test.test_this_does_not_exist()) def test_command_line_handling_parseArgs(self): # Haha - take that uninstantiable class program = object.__new__(unittest2.TestProgram) args = [] def do_discovery(argv): args.extend(argv) program._do_discovery = do_discovery program.parseArgs(['something', 'discover']) self.assertEqual(args, []) program.parseArgs(['something', 'discover', 'foo', 'bar']) self.assertEqual(args, ['foo', 'bar']) def test_command_line_handling_do_discovery_too_many_arguments(self): class Stop(Exception): pass def usageExit(): raise Stop program = object.__new__(unittest2.TestProgram) program.usageExit = usageExit self.assertRaises(Stop, # too many args lambda: program._do_discovery(['one', 'two', 'three', 'four'])) def test_command_line_handling_do_discovery_calls_loader(self): program = object.__new__(unittest2.TestProgram) class Loader(object): args = [] def discover(self, start_dir, pattern, top_level_dir): self.args.append((start_dir, pattern, top_level_dir)) return 'tests' program._do_discovery(['-v'], Loader=Loader) self.assertEqual(program.verbosity, 2) self.assertEqual(program.test, 'tests') self.assertEqual(Loader.args, [('.', 'test*.py', None)]) Loader.args = [] program = object.__new__(unittest2.TestProgram) program._do_discovery(['--verbose'], Loader=Loader) self.assertEqual(program.test, 'tests') self.assertEqual(Loader.args, [('.', 'test*.py', None)]) Loader.args = [] program = object.__new__(unittest2.TestProgram) program._do_discovery([], Loader=Loader) self.assertEqual(program.test, 'tests') self.assertEqual(Loader.args, [('.', 'test*.py', None)]) Loader.args = [] program = object.__new__(unittest2.TestProgram) program._do_discovery(['fish'], Loader=Loader) self.assertEqual(program.test, 'tests') self.assertEqual(Loader.args, [('fish', 'test*.py', None)]) Loader.args = [] program = object.__new__(unittest2.TestProgram) program._do_discovery(['fish', 'eggs'], Loader=Loader) self.assertEqual(program.test, 'tests') self.assertEqual(Loader.args, [('fish', 'eggs', None)]) Loader.args = [] program = object.__new__(unittest2.TestProgram) program._do_discovery(['fish', 'eggs', 'ham'], Loader=Loader) self.assertEqual(program.test, 'tests') self.assertEqual(Loader.args, [('fish', 'eggs', 'ham')]) Loader.args = [] program = object.__new__(unittest2.TestProgram) program._do_discovery(['-s', 'fish'], Loader=Loader) self.assertEqual(program.test, 'tests') self.assertEqual(Loader.args, [('fish', 'test*.py', None)]) Loader.args = [] program = object.__new__(unittest2.TestProgram) program._do_discovery(['-t', 'fish'], Loader=Loader) self.assertEqual(program.test, 'tests') self.assertEqual(Loader.args, [('.', 'test*.py', 'fish')]) Loader.args = [] program = object.__new__(unittest2.TestProgram) program._do_discovery(['-p', 'fish'], Loader=Loader) self.assertEqual(program.test, 'tests') self.assertEqual(Loader.args, [('.', 'fish', None)]) self.assertFalse(program.failfast) self.assertFalse(program.catchbreak) args = ['-p', 'eggs', '-s', 'fish', '-v', '-f'] try: import signal except ImportError: signal = None else: args.append('-c') Loader.args = [] program = object.__new__(unittest2.TestProgram) program._do_discovery(args, Loader=Loader) self.assertEqual(program.test, 'tests') self.assertEqual(Loader.args, [('fish', 'eggs', None)]) self.assertEqual(program.verbosity, 2) self.assertTrue(program.failfast) if signal is not None: self.assertTrue(program.catchbreak) def test_detect_module_clash(self): class Module(object): __file__ = 'bar/foo.py' sys.modules['foo'] = Module full_path = os.path.abspath('foo') original_listdir = os.listdir original_isfile = os.path.isfile original_isdir = os.path.isdir def cleanup(): os.listdir = original_listdir os.path.isfile = original_isfile os.path.isdir = original_isdir del sys.modules['foo'] if full_path in sys.path: sys.path.remove(full_path) self.addCleanup(cleanup) def listdir(_): return ['foo.py'] def isfile(_): return True def isdir(_): return True os.listdir = listdir os.path.isfile = isfile os.path.isdir = isdir loader = unittest2.TestLoader() mod_dir = os.path.abspath('bar') expected_dir = os.path.abspath('foo') msg = re.escape(r"'foo' module incorrectly imported from %r. Expected %r. " "Is this module globally installed?" % (mod_dir, expected_dir)) self.assertRaisesRegexp( ImportError, '^%s$' % msg, loader.discover, start_dir='foo', pattern='foo.py' ) self.assertEqual(sys.path[0], full_path) def test_discovery_from_dotted_path(self): loader = unittest2.TestLoader() tests = [self] expectedPath = os.path.abspath(os.path.dirname(unittest2.test.__file__)) self.wasRun = False def _find_tests(start_dir, pattern): self.wasRun = True self.assertEqual(start_dir, expectedPath) return tests loader._find_tests = _find_tests suite = loader.discover('unittest2.test') self.assertTrue(self.wasRun) self.assertEqual(suite._tests, tests) if __name__ == '__main__': unittest2.main()
apache-2.0
[ 646, 747, 199, 646, 295, 199, 646, 984, 199, 199, 646, 2882, 18, 421, 199, 533, 1379, 2825, 6913, 8, 2796, 18, 14, 1746, 304, 339, 327, 5311, 1214, 3444, 16991, 2295, 880, 473, 883, 5126, 9793, 1337, 314, 10036, 272, 347, 511, 63, 362, 63, 354, 63, 504, 63, 515, 8, 277, 304, 267, 5077, 275, 2882, 18, 14, 15824, 342, 398, 5077, 423, 2119, 63, 1896, 63, 694, 275, 1994, 1421, 7, 267, 536, 275, 5077, 423, 362, 63, 354, 63, 504, 63, 515, 2336, 1421, 15, 1700, 15, 6185, 14, 647, 358, 267, 291, 14, 629, 8, 354, 12, 283, 1700, 14, 6185, 358, 398, 340, 440, 636, 1757, 10651, 288, 327, 702, 83, 787, 2331, 288, 372, 398, 291, 14, 1855, 8, 14844, 12, 2079, 5077, 423, 362, 63, 354, 63, 504, 63, 515, 12, 2079, 1994, 1700, 15, 6185, 14, 647, 358, 339, 347, 511, 63, 1623, 63, 2219, 8, 277, 304, 267, 5077, 275, 2882, 18, 14, 15824, 342, 398, 3379, 63, 7374, 275, 747, 14, 7374, 267, 347, 9066, 63, 7374, 837, 288, 747, 14, 7374, 275, 3379, 63, 7374, 267, 3379, 63, 6292, 275, 747, 14, 515, 14, 6292, 267, 347, 9066, 63, 6292, 837, 288, 747, 14, 515, 14, 6292, 275, 3379, 63, 6292, 267, 3379, 63, 6027, 275, 747, 14, 515, 14, 6027, 267, 347, 9066, 63, 6027, 837, 288, 747, 14, 515, 14, 6027, 275, 3379, 63, 6027, 398, 931, 63, 6717, 275, 11194, 396, 17, 14, 647, 297, 283, 396, 18, 14, 647, 297, 283, 1397, 63, 65, 63, 396, 14, 647, 297, 283, 396, 63, 694, 297, 2432, 283, 396, 14, 1421, 297, 283, 396, 13, 1397, 13, 65, 13, 578, 14, 647, 297, 283, 13565, 63, 694, 995, 1993, 788, 396, 19, 14, 647, 297, 283, 396, 20, 14, 647, 297, 1622, 61, 267, 747, 14, 7374, 275, 2400, 931, 26, 931, 63, 6717, 14, 1935, 8, 16, 9, 267, 291, 14, 12808, 8, 8011, 63, 7374, 9, 398, 347, 26004, 8, 515, 304, 288, 372, 931, 14, 4130, 360, 694, 358, 267, 747, 14, 515, 14, 6027, 275, 26004, 267, 291, 14, 12808, 8, 8011, 63, 6027, 9, 398, 347, 29214, 8, 515, 304, 288, 327, 4573, 63, 694, 365, 440, 282, 2559, 436, 880, 9296, 1133, 506, 5344, 939, 1901, 288, 372, 440, 931, 14, 4130, 360, 694, 358, 436, 440, 283, 13565, 63, 694, 7, 315, 931, 267, 747, 14, 515, 14, 6292, 275, 29214, 267, 291, 14, 12808, 8, 8011, 63, 6292, 9, 398, 5077, 423, 362, 63, 578, 63, 504, 63, 354, 275, 2400, 931, 26, 931, 435, 283, 859, 7, 267, 5077, 14, 12861, 2377, 275, 2400, 859, 26, 859, 435, 283, 2295, 7, 398, 2746, 63, 1896, 275, 747, 14, 515, 14, 4832, 2336, 1421, 358, 267, 5077, 423, 2119, 63, 1896, 63, 694, 275, 2746, 63, 1896, 267, 5241, 275, 769, 8, 3422, 423, 1623, 63, 2219, 8, 2119, 63, 1896, 12, 283, 396, 4856, 647, 1333, 398, 1420, 275, 359, 354, 435, 283, 859, 2295, 7, 367, 536, 315, 490, 661, 396, 17, 297, 283, 396, 18, 5440, 267, 1420, 14, 2880, 8318, 396, 63, 694, 4111, 83, 7, 450, 536, 9, 435, 283, 859, 2295, 7, 367, 536, 315, 490, 661, 396, 19, 297, 283, 396, 20, 2023, 267, 291, 14, 629, 8, 5768, 12, 1420, 9, 339, 347, 511, 63, 1623, 63, 2219, 63, 1045, 63, 2491, 8, 277, 304, 267, 5077, 275, 2882, 18, 14, 15824, 342, 398, 3379, 63, 7374, 275, 747, 14, 7374, 267, 347, 9066, 63, 7374, 837, 288, 747, 14, 7374, 275, 3379, 63, 7374, 267, 3379, 63, 6292, 275, 747, 14, 515, 14, 6292, 267, 347, 9066, 63, 6292, 837, 288, 747, 14, 515, 14, 6292, 275, 3379, 63, 6292, 267, 3379, 63, 6027, 275, 747, 14, 515, 14, 6027, 267, 347, 9066, 63, 6027, 837, 288, 747, 14, 515, 14, 6027, 275, 3379, 63, 6027, 398, 6602, 275, 788, 65, 63, 3619, 297, 283, 396, 63, 3619, 297, 283, 396, 63, 3619, 18, 418, 267, 931, 63, 6717, 275, 359, 12629, 12, 990, 990, 942, 61, 267, 747, 14, 7374, 275, 2400, 931, 26, 931, 63, 6717, 14, 1935, 8, 16, 9, 267, 291, 14, 12808, 8, 8011, 63, 7374, 9, 398, 747, 14, 515, 14, 6027, 275, 2400, 931, 26, 715, 267, 291, 14, 12808, 8, 8011, 63, 6027, 9, 398, 747, 14, 515, 14, 6292, 275, 2400, 931, 26, 747, 14, 515, 14, 4846, 8, 515, 9, 440, 315, 6602, 267, 291, 14, 12808, 8, 8011, 63, 6292, 9, 398, 1021, 5673, 8, 785, 304, 288, 3792, 275, 942, 288, 2248, 63, 2219, 63, 589, 275, 942, 953, 347, 636, 826, 721, 277, 12, 931, 304, 355, 291, 14, 515, 275, 931, 355, 291, 14, 3771, 14, 740, 8, 515, 9, 355, 340, 747, 14, 515, 14, 4846, 8, 515, 9, 508, 283, 396, 63, 3619, 356, 490, 347, 2248, 63, 2219, 8, 3422, 12, 2295, 12, 3851, 304, 717, 291, 14, 912, 63, 2219, 63, 589, 14, 740, 1332, 3422, 12, 2295, 12, 3851, 430, 717, 372, 283, 912, 63, 2219, 7, 490, 291, 14, 912, 63, 2219, 275, 2248, 63, 2219, 953, 347, 636, 4077, 721, 277, 12, 1163, 304, 355, 372, 291, 14, 515, 508, 1163, 14, 515, 953, 327, 428, 441, 21225, 1134, 19, 75, 5721, 288, 636, 2227, 363, 275, 488, 398, 5077, 423, 362, 63, 578, 63, 504, 63, 354, 275, 2400, 536, 26, 5673, 8, 354, 9, 267, 347, 2248, 11519, 2377, 8, 578, 12, 675, 63, 912, 63, 2219, 304, 288, 340, 675, 63, 912, 63, 2219, 26, 355, 746, 291, 14, 15935, 360, 1180, 63, 912, 63, 2219, 1077, 506, 756, 367, 6117, 358, 288, 372, 859, 14, 515, 435, 283, 859, 2295, 7, 267, 5077, 14, 12861, 2377, 275, 2248, 11519, 2377, 398, 5077, 423, 2119, 63, 1896, 63, 694, 275, 1994, 1421, 7, 267, 327, 642, 900, 949, 1987, 647, 7, 641, 314, 3851, 880, 626, 652, 883, 1336, 267, 327, 282, 511, 2559, 267, 5241, 275, 769, 8, 3422, 423, 1623, 63, 2219, 2336, 1421, 297, 283, 396 ]
[ 747, 199, 646, 295, 199, 646, 984, 199, 199, 646, 2882, 18, 421, 199, 533, 1379, 2825, 6913, 8, 2796, 18, 14, 1746, 304, 339, 327, 5311, 1214, 3444, 16991, 2295, 880, 473, 883, 5126, 9793, 1337, 314, 10036, 272, 347, 511, 63, 362, 63, 354, 63, 504, 63, 515, 8, 277, 304, 267, 5077, 275, 2882, 18, 14, 15824, 342, 398, 5077, 423, 2119, 63, 1896, 63, 694, 275, 1994, 1421, 7, 267, 536, 275, 5077, 423, 362, 63, 354, 63, 504, 63, 515, 2336, 1421, 15, 1700, 15, 6185, 14, 647, 358, 267, 291, 14, 629, 8, 354, 12, 283, 1700, 14, 6185, 358, 398, 340, 440, 636, 1757, 10651, 288, 327, 702, 83, 787, 2331, 288, 372, 398, 291, 14, 1855, 8, 14844, 12, 2079, 5077, 423, 362, 63, 354, 63, 504, 63, 515, 12, 2079, 1994, 1700, 15, 6185, 14, 647, 358, 339, 347, 511, 63, 1623, 63, 2219, 8, 277, 304, 267, 5077, 275, 2882, 18, 14, 15824, 342, 398, 3379, 63, 7374, 275, 747, 14, 7374, 267, 347, 9066, 63, 7374, 837, 288, 747, 14, 7374, 275, 3379, 63, 7374, 267, 3379, 63, 6292, 275, 747, 14, 515, 14, 6292, 267, 347, 9066, 63, 6292, 837, 288, 747, 14, 515, 14, 6292, 275, 3379, 63, 6292, 267, 3379, 63, 6027, 275, 747, 14, 515, 14, 6027, 267, 347, 9066, 63, 6027, 837, 288, 747, 14, 515, 14, 6027, 275, 3379, 63, 6027, 398, 931, 63, 6717, 275, 11194, 396, 17, 14, 647, 297, 283, 396, 18, 14, 647, 297, 283, 1397, 63, 65, 63, 396, 14, 647, 297, 283, 396, 63, 694, 297, 2432, 283, 396, 14, 1421, 297, 283, 396, 13, 1397, 13, 65, 13, 578, 14, 647, 297, 283, 13565, 63, 694, 995, 1993, 788, 396, 19, 14, 647, 297, 283, 396, 20, 14, 647, 297, 1622, 61, 267, 747, 14, 7374, 275, 2400, 931, 26, 931, 63, 6717, 14, 1935, 8, 16, 9, 267, 291, 14, 12808, 8, 8011, 63, 7374, 9, 398, 347, 26004, 8, 515, 304, 288, 372, 931, 14, 4130, 360, 694, 358, 267, 747, 14, 515, 14, 6027, 275, 26004, 267, 291, 14, 12808, 8, 8011, 63, 6027, 9, 398, 347, 29214, 8, 515, 304, 288, 327, 4573, 63, 694, 365, 440, 282, 2559, 436, 880, 9296, 1133, 506, 5344, 939, 1901, 288, 372, 440, 931, 14, 4130, 360, 694, 358, 436, 440, 283, 13565, 63, 694, 7, 315, 931, 267, 747, 14, 515, 14, 6292, 275, 29214, 267, 291, 14, 12808, 8, 8011, 63, 6292, 9, 398, 5077, 423, 362, 63, 578, 63, 504, 63, 354, 275, 2400, 931, 26, 931, 435, 283, 859, 7, 267, 5077, 14, 12861, 2377, 275, 2400, 859, 26, 859, 435, 283, 2295, 7, 398, 2746, 63, 1896, 275, 747, 14, 515, 14, 4832, 2336, 1421, 358, 267, 5077, 423, 2119, 63, 1896, 63, 694, 275, 2746, 63, 1896, 267, 5241, 275, 769, 8, 3422, 423, 1623, 63, 2219, 8, 2119, 63, 1896, 12, 283, 396, 4856, 647, 1333, 398, 1420, 275, 359, 354, 435, 283, 859, 2295, 7, 367, 536, 315, 490, 661, 396, 17, 297, 283, 396, 18, 5440, 267, 1420, 14, 2880, 8318, 396, 63, 694, 4111, 83, 7, 450, 536, 9, 435, 283, 859, 2295, 7, 367, 536, 315, 490, 661, 396, 19, 297, 283, 396, 20, 2023, 267, 291, 14, 629, 8, 5768, 12, 1420, 9, 339, 347, 511, 63, 1623, 63, 2219, 63, 1045, 63, 2491, 8, 277, 304, 267, 5077, 275, 2882, 18, 14, 15824, 342, 398, 3379, 63, 7374, 275, 747, 14, 7374, 267, 347, 9066, 63, 7374, 837, 288, 747, 14, 7374, 275, 3379, 63, 7374, 267, 3379, 63, 6292, 275, 747, 14, 515, 14, 6292, 267, 347, 9066, 63, 6292, 837, 288, 747, 14, 515, 14, 6292, 275, 3379, 63, 6292, 267, 3379, 63, 6027, 275, 747, 14, 515, 14, 6027, 267, 347, 9066, 63, 6027, 837, 288, 747, 14, 515, 14, 6027, 275, 3379, 63, 6027, 398, 6602, 275, 788, 65, 63, 3619, 297, 283, 396, 63, 3619, 297, 283, 396, 63, 3619, 18, 418, 267, 931, 63, 6717, 275, 359, 12629, 12, 990, 990, 942, 61, 267, 747, 14, 7374, 275, 2400, 931, 26, 931, 63, 6717, 14, 1935, 8, 16, 9, 267, 291, 14, 12808, 8, 8011, 63, 7374, 9, 398, 747, 14, 515, 14, 6027, 275, 2400, 931, 26, 715, 267, 291, 14, 12808, 8, 8011, 63, 6027, 9, 398, 747, 14, 515, 14, 6292, 275, 2400, 931, 26, 747, 14, 515, 14, 4846, 8, 515, 9, 440, 315, 6602, 267, 291, 14, 12808, 8, 8011, 63, 6292, 9, 398, 1021, 5673, 8, 785, 304, 288, 3792, 275, 942, 288, 2248, 63, 2219, 63, 589, 275, 942, 953, 347, 636, 826, 721, 277, 12, 931, 304, 355, 291, 14, 515, 275, 931, 355, 291, 14, 3771, 14, 740, 8, 515, 9, 355, 340, 747, 14, 515, 14, 4846, 8, 515, 9, 508, 283, 396, 63, 3619, 356, 490, 347, 2248, 63, 2219, 8, 3422, 12, 2295, 12, 3851, 304, 717, 291, 14, 912, 63, 2219, 63, 589, 14, 740, 1332, 3422, 12, 2295, 12, 3851, 430, 717, 372, 283, 912, 63, 2219, 7, 490, 291, 14, 912, 63, 2219, 275, 2248, 63, 2219, 953, 347, 636, 4077, 721, 277, 12, 1163, 304, 355, 372, 291, 14, 515, 508, 1163, 14, 515, 953, 327, 428, 441, 21225, 1134, 19, 75, 5721, 288, 636, 2227, 363, 275, 488, 398, 5077, 423, 362, 63, 578, 63, 504, 63, 354, 275, 2400, 536, 26, 5673, 8, 354, 9, 267, 347, 2248, 11519, 2377, 8, 578, 12, 675, 63, 912, 63, 2219, 304, 288, 340, 675, 63, 912, 63, 2219, 26, 355, 746, 291, 14, 15935, 360, 1180, 63, 912, 63, 2219, 1077, 506, 756, 367, 6117, 358, 288, 372, 859, 14, 515, 435, 283, 859, 2295, 7, 267, 5077, 14, 12861, 2377, 275, 2248, 11519, 2377, 398, 5077, 423, 2119, 63, 1896, 63, 694, 275, 1994, 1421, 7, 267, 327, 642, 900, 949, 1987, 647, 7, 641, 314, 3851, 880, 626, 652, 883, 1336, 267, 327, 282, 511, 2559, 267, 5241, 275, 769, 8, 3422, 423, 1623, 63, 2219, 2336, 1421, 297, 283, 396, 0 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 ]
shanemcd/ansible
lib/ansible/galaxy/role.py
33
14986
######################################################################## # # (C) 2015, Brian Coca <[email protected]> # # 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/>. # ######################################################################## from __future__ import (absolute_import, division, print_function) __metaclass__ = type import datetime import os import tarfile import tempfile import yaml from distutils.version import LooseVersion from shutil import rmtree from ansible.errors import AnsibleError from ansible.module_utils.urls import open_url from ansible.playbook.role.requirement import RoleRequirement from ansible.galaxy.api import GalaxyAPI try: from __main__ import display except ImportError: from ansible.utils.display import Display display = Display() class GalaxyRole(object): SUPPORTED_SCMS = set(['git', 'hg']) META_MAIN = os.path.join('meta', 'main.yml') META_INSTALL = os.path.join('meta', '.galaxy_install_info') ROLE_DIRS = ('defaults', 'files', 'handlers', 'meta', 'tasks', 'templates', 'vars', 'tests') def __init__(self, galaxy, name, src=None, version=None, scm=None, path=None): self._metadata = None self._install_info = None self._validate_certs = not galaxy.options.ignore_certs display.debug('Validate TLS certificates: %s' % self._validate_certs) self.options = galaxy.options self.galaxy = galaxy self.name = name self.version = version self.src = src or name self.scm = scm if path is not None: if self.name not in path: path = os.path.join(path, self.name) self.path = path else: for role_path_dir in galaxy.roles_paths: role_path = os.path.join(role_path_dir, self.name) if os.path.exists(role_path): self.path = role_path break else: # use the first path by default self.path = os.path.join(galaxy.roles_paths[0], self.name) # create list of possible paths self.paths = [x for x in galaxy.roles_paths] self.paths = [os.path.join(x, self.name) for x in self.paths] def __repr__(self): """ Returns "rolename (version)" if version is not null Returns "rolename" otherwise """ if self.version: return "%s (%s)" % (self.name, self.version) else: return self.name def __eq__(self, other): return self.name == other.name @property def metadata(self): """ Returns role metadata """ if self._metadata is None: meta_path = os.path.join(self.path, self.META_MAIN) if os.path.isfile(meta_path): try: f = open(meta_path, 'r') self._metadata = yaml.safe_load(f) except: display.vvvvv("Unable to load metadata for %s" % self.name) return False finally: f.close() return self._metadata @property def install_info(self): """ Returns role install info """ if self._install_info is None: info_path = os.path.join(self.path, self.META_INSTALL) if os.path.isfile(info_path): try: f = open(info_path, 'r') self._install_info = yaml.safe_load(f) except: display.vvvvv("Unable to load Galaxy install info for %s" % self.name) return False finally: f.close() return self._install_info def _write_galaxy_install_info(self): """ Writes a YAML-formatted file to the role's meta/ directory (named .galaxy_install_info) which contains some information we can use later for commands like 'list' and 'info'. """ info = dict( version=self.version, install_date=datetime.datetime.utcnow().strftime("%c"), ) if not os.path.exists(os.path.join(self.path, 'meta')): os.makedirs(os.path.join(self.path, 'meta')) info_path = os.path.join(self.path, self.META_INSTALL) with open(info_path, 'w+') as f: try: self._install_info = yaml.safe_dump(info, f) except: return False return True def remove(self): """ Removes the specified role from the roles path. There is a sanity check to make sure there's a meta/main.yml file at this path so the user doesn't blow away random directories. """ if self.metadata: try: rmtree(self.path) return True except: pass return False def fetch(self, role_data): """ Downloads the archived role from github to a temp location """ if role_data: # first grab the file and save it to a temp location if "github_user" in role_data and "github_repo" in role_data: archive_url = 'https://github.com/%s/%s/archive/%s.tar.gz' % (role_data["github_user"], role_data["github_repo"], self.version) else: archive_url = self.src display.display("- downloading role from %s" % archive_url) try: url_file = open_url(archive_url, validate_certs=self._validate_certs) temp_file = tempfile.NamedTemporaryFile(delete=False) data = url_file.read() while data: temp_file.write(data) data = url_file.read() temp_file.close() return temp_file.name except Exception as e: display.error("failed to download the file: %s" % str(e)) return False def install(self): # the file is a tar, so open it that way and extract it # to the specified (or default) roles directory local_file = False if self.scm: # create tar file from scm url tmp_file = RoleRequirement.scm_archive_role(**self.spec) elif self.src: if os.path.isfile(self.src): # installing a local tar.gz local_file = True tmp_file = self.src elif '://' in self.src: role_data = self.src tmp_file = self.fetch(role_data) else: api = GalaxyAPI(self.galaxy) role_data = api.lookup_role_by_name(self.src) if not role_data: raise AnsibleError("- sorry, %s was not found on %s." % (self.src, api.api_server)) if role_data.get('role_type') == 'APP': # Container Role display.warning("%s is a Container App role, and should only be installed using Ansible " "Container" % self.name) role_versions = api.fetch_role_related('versions', role_data['id']) if not self.version: # convert the version names to LooseVersion objects # and sort them to get the latest version. If there # are no versions in the list, we'll grab the head # of the master branch if len(role_versions) > 0: loose_versions = [LooseVersion(a.get('name', None)) for a in role_versions] loose_versions.sort() self.version = str(loose_versions[-1]) elif role_data.get('github_branch', None): self.version = role_data['github_branch'] else: self.version = 'master' elif self.version != 'master': if role_versions and str(self.version) not in [a.get('name', None) for a in role_versions]: raise AnsibleError("- the specified version (%s) of %s was not found in the list of available versions (%s)." % (self.version, self.name, role_versions)) tmp_file = self.fetch(role_data) else: raise AnsibleError("No valid role data found") if tmp_file: display.debug("installing from %s" % tmp_file) if not tarfile.is_tarfile(tmp_file): raise AnsibleError("the file downloaded was not a tar.gz") else: if tmp_file.endswith('.gz'): role_tar_file = tarfile.open(tmp_file, "r:gz") else: role_tar_file = tarfile.open(tmp_file, "r") # verify the role's meta file meta_file = None members = role_tar_file.getmembers() # next find the metadata file for member in members: if self.META_MAIN in member.name: # Look for parent of meta/main.yml # Due to possibility of sub roles each containing meta/main.yml # look for shortest length parent meta_parent_dir = os.path.dirname(os.path.dirname(member.name)) if not meta_file: archive_parent_dir = meta_parent_dir meta_file = member else: if len(meta_parent_dir) < len(archive_parent_dir): archive_parent_dir = meta_parent_dir meta_file = member if not meta_file: raise AnsibleError("this role does not appear to have a meta/main.yml file.") else: try: self._metadata = yaml.safe_load(role_tar_file.extractfile(meta_file)) except: raise AnsibleError("this role does not appear to have a valid meta/main.yml file.") # we strip off any higher-level directories for all of the files contained within # the tar file here. The default is 'github_repo-target'. Gerrit instances, on the other # hand, does not have a parent directory at all. installed = False while not installed: display.display("- extracting %s to %s" % (self.name, self.path)) try: if os.path.exists(self.path): if not os.path.isdir(self.path): raise AnsibleError("the specified roles path exists and is not a directory.") elif not getattr(self.options, "force", False): raise AnsibleError("the specified role %s appears to already exist. Use --force to replace it." % self.name) else: # using --force, remove the old path if not self.remove(): raise AnsibleError("%s doesn't appear to contain a role.\n please remove this directory manually if you really " "want to put the role here." % self.path) else: os.makedirs(self.path) # now we do the actual extraction to the path for member in members: # we only extract files, and remove any relative path # bits that might be in the file for security purposes # and drop any containing directory, as mentioned above if member.isreg() or member.issym(): parts = member.name.replace(archive_parent_dir, "", 1).split(os.sep) final_parts = [] for part in parts: if part != '..' and '~' not in part and '$' not in part: final_parts.append(part) member.name = os.path.join(*final_parts) role_tar_file.extract(member, self.path) # write out the install info file for later use self._write_galaxy_install_info() installed = True except OSError as e: error = True if e[0] == 13 and len(self.paths) > 1: current = self.paths.index(self.path) nextidx = current + 1 if len(self.paths) >= current: self.path = self.paths[nextidx] error = False if error: raise AnsibleError("Could not update files in %s: %s" % (self.path, str(e))) # return the parsed yaml metadata display.display("- %s was installed successfully" % str(self)) if not local_file: try: os.unlink(tmp_file) except (OSError, IOError) as e: display.warning("Unable to remove tmp file (%s): %s" % (tmp_file, str(e))) return True return False @property def spec(self): """ Returns role spec info { 'scm': 'git', 'src': 'http://git.example.com/repos/repo.git', 'version': 'v1.0', 'name': 'repo' } """ return dict(scm=self.scm, src=self.src, version=self.version, name=self.name)
gpl-3.0
[ 3949, 199, 3, 199, 3, 334, 35, 9, 6900, 12, 699, 18429, 445, 679, 65, 665, 66, 331, 696, 32, 4853, 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, 3, 199, 3949, 199, 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, 646, 2197, 199, 646, 747, 199, 646, 13608, 199, 646, 5549, 199, 646, 8864, 199, 504, 7065, 14, 1023, 492, 18462, 199, 504, 5145, 492, 20978, 199, 199, 504, 3242, 14, 2550, 492, 13358, 199, 504, 3242, 14, 578, 63, 1208, 14, 3603, 492, 1551, 63, 633, 199, 504, 3242, 14, 14205, 14, 3756, 14, 12434, 492, 18033, 17947, 199, 504, 3242, 14, 24806, 14, 1246, 492, 598, 15914, 3735, 199, 199, 893, 26, 272, 687, 636, 973, 363, 492, 2929, 199, 2590, 3545, 26, 272, 687, 3242, 14, 1208, 14, 2918, 492, 12175, 272, 2929, 275, 12175, 342, 421, 199, 533, 598, 15914, 7422, 8, 785, 304, 339, 32501, 63, 5153, 3053, 275, 663, 2941, 3187, 297, 283, 9208, 1105, 272, 603, 15808, 63, 5848, 275, 747, 14, 515, 14, 904, 360, 2024, 297, 283, 973, 14, 11714, 358, 272, 603, 15808, 63, 16811, 275, 747, 14, 515, 14, 904, 360, 2024, 297, 1987, 24806, 63, 3174, 63, 815, 358, 272, 9769, 906, 63, 14455, 275, 661, 4322, 297, 283, 1725, 297, 283, 5586, 297, 283, 2024, 297, 283, 5054, 297, 283, 5876, 297, 283, 2936, 297, 283, 2219, 358, 339, 347, 636, 826, 721, 277, 12, 486, 15914, 12, 536, 12, 2928, 29, 403, 12, 1015, 29, 403, 12, 25811, 29, 403, 12, 931, 29, 403, 304, 398, 291, 423, 2343, 275, 488, 267, 291, 423, 3174, 63, 815, 275, 488, 267, 291, 423, 3502, 63, 8356, 275, 440, 486, 15914, 14, 1419, 14, 4247, 63, 8356, 398, 2929, 14, 1757, 360, 12584, 12213, 14512, 26, 450, 83, 7, 450, 291, 423, 3502, 63, 8356, 9, 398, 291, 14, 1419, 275, 486, 15914, 14, 1419, 267, 291, 14, 24806, 275, 486, 15914, 398, 291, 14, 354, 275, 536, 267, 291, 14, 1023, 275, 1015, 267, 291, 14, 2164, 275, 2928, 503, 536, 267, 291, 14, 17143, 275, 25811, 398, 340, 931, 365, 440, 488, 26, 288, 340, 291, 14, 354, 440, 315, 931, 26, 355, 931, 275, 747, 14, 515, 14, 904, 8, 515, 12, 291, 14, 354, 9, 288, 291, 14, 515, 275, 931, 267, 587, 26, 288, 367, 4719, 63, 515, 63, 694, 315, 486, 15914, 14, 8050, 63, 3771, 26, 355, 4719, 63, 515, 275, 747, 14, 515, 14, 904, 8, 3756, 63, 515, 63, 694, 12, 291, 14, 354, 9, 355, 340, 747, 14, 515, 14, 2444, 8, 3756, 63, 515, 304, 490, 291, 14, 515, 275, 4719, 63, 515, 490, 2059, 288, 587, 26, 355, 327, 675, 314, 1642, 931, 701, 849, 355, 291, 14, 515, 275, 747, 14, 515, 14, 904, 8, 24806, 14, 8050, 63, 3771, 59, 16, 467, 291, 14, 354, 9, 355, 327, 1218, 769, 402, 3962, 3792, 355, 291, 14, 3771, 275, 359, 88, 367, 671, 315, 486, 15914, 14, 8050, 63, 3771, 61, 355, 291, 14, 3771, 275, 359, 736, 14, 515, 14, 904, 8, 88, 12, 291, 14, 354, 9, 367, 671, 315, 291, 14, 3771, 61, 339, 347, 636, 2722, 721, 277, 304, 267, 408, 267, 1803, 298, 3756, 354, 334, 1023, 2924, 340, 1015, 365, 440, 2973, 267, 1803, 298, 3756, 354, 2, 4257, 267, 408, 267, 340, 291, 14, 1023, 26, 288, 372, 2071, 83, 4366, 83, 2924, 450, 334, 277, 14, 354, 12, 291, 14, 1023, 9, 267, 587, 26, 288, 372, 291, 14, 354, 339, 347, 636, 4077, 721, 277, 12, 1163, 304, 267, 372, 291, 14, 354, 508, 1163, 14, 354, 339, 768, 1829, 272, 347, 3341, 8, 277, 304, 267, 408, 267, 1803, 4719, 3341, 267, 408, 267, 340, 291, 423, 2343, 365, 488, 26, 288, 3404, 63, 515, 275, 747, 14, 515, 14, 904, 8, 277, 14, 515, 12, 291, 14, 10614, 63, 5848, 9, 288, 340, 747, 14, 515, 14, 6292, 8, 2024, 63, 515, 304, 355, 862, 26, 490, 289, 275, 1551, 8, 2024, 63, 515, 12, 283, 82, 358, 490, 291, 423, 2343, 275, 8864, 14, 3489, 63, 912, 8, 70, 9, 355, 871, 26, 490, 2929, 14, 8958, 24622, 480, 6005, 370, 2248, 3341, 367, 450, 83, 2, 450, 291, 14, 354, 9, 490, 372, 756, 355, 3753, 26, 490, 289, 14, 1600, 342, 398, 372, 291, 423, 2343, 339, 768, 1829, 272, 347, 3907, 63, 815, 8, 277, 304, 267, 408, 267, 1803, 4719, 3907, 2256, 267, 408, 267, 340, 291, 423, 3174, 63, 815, 365, 488, 26, 953, 2256, 63, 515, 275, 747, 14, 515, 14, 904, 8, 277, 14, 515, 12, 291, 14, 10614, 63, 16811, 9, 288, 340, 747, 14, 515, 14, 6292, 8, 815, 63, 515, 304, 355, 862, 26, 490, 289, 275, 1551, 8, 815, 63, 515, 12, 283, 82, 358, 490, 291, 423, 3174, 63, 815, 275, 8864, 14, 3489, 63, 912, 8, 70, 9, 355, 871, 26, 490, 2929, 14, 8958, 24622, 480, 6005, 370, 2248, 598, 15914, 3907, 2256, 367, 450, 83, 2, 450, 291, 14, 354 ]
[ 199, 3, 199, 3, 334, 35, 9, 6900, 12, 699, 18429, 445, 679, 65, 665, 66, 331, 696, 32, 4853, 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, 3, 199, 3949, 199, 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, 646, 2197, 199, 646, 747, 199, 646, 13608, 199, 646, 5549, 199, 646, 8864, 199, 504, 7065, 14, 1023, 492, 18462, 199, 504, 5145, 492, 20978, 199, 199, 504, 3242, 14, 2550, 492, 13358, 199, 504, 3242, 14, 578, 63, 1208, 14, 3603, 492, 1551, 63, 633, 199, 504, 3242, 14, 14205, 14, 3756, 14, 12434, 492, 18033, 17947, 199, 504, 3242, 14, 24806, 14, 1246, 492, 598, 15914, 3735, 199, 199, 893, 26, 272, 687, 636, 973, 363, 492, 2929, 199, 2590, 3545, 26, 272, 687, 3242, 14, 1208, 14, 2918, 492, 12175, 272, 2929, 275, 12175, 342, 421, 199, 533, 598, 15914, 7422, 8, 785, 304, 339, 32501, 63, 5153, 3053, 275, 663, 2941, 3187, 297, 283, 9208, 1105, 272, 603, 15808, 63, 5848, 275, 747, 14, 515, 14, 904, 360, 2024, 297, 283, 973, 14, 11714, 358, 272, 603, 15808, 63, 16811, 275, 747, 14, 515, 14, 904, 360, 2024, 297, 1987, 24806, 63, 3174, 63, 815, 358, 272, 9769, 906, 63, 14455, 275, 661, 4322, 297, 283, 1725, 297, 283, 5586, 297, 283, 2024, 297, 283, 5054, 297, 283, 5876, 297, 283, 2936, 297, 283, 2219, 358, 339, 347, 636, 826, 721, 277, 12, 486, 15914, 12, 536, 12, 2928, 29, 403, 12, 1015, 29, 403, 12, 25811, 29, 403, 12, 931, 29, 403, 304, 398, 291, 423, 2343, 275, 488, 267, 291, 423, 3174, 63, 815, 275, 488, 267, 291, 423, 3502, 63, 8356, 275, 440, 486, 15914, 14, 1419, 14, 4247, 63, 8356, 398, 2929, 14, 1757, 360, 12584, 12213, 14512, 26, 450, 83, 7, 450, 291, 423, 3502, 63, 8356, 9, 398, 291, 14, 1419, 275, 486, 15914, 14, 1419, 267, 291, 14, 24806, 275, 486, 15914, 398, 291, 14, 354, 275, 536, 267, 291, 14, 1023, 275, 1015, 267, 291, 14, 2164, 275, 2928, 503, 536, 267, 291, 14, 17143, 275, 25811, 398, 340, 931, 365, 440, 488, 26, 288, 340, 291, 14, 354, 440, 315, 931, 26, 355, 931, 275, 747, 14, 515, 14, 904, 8, 515, 12, 291, 14, 354, 9, 288, 291, 14, 515, 275, 931, 267, 587, 26, 288, 367, 4719, 63, 515, 63, 694, 315, 486, 15914, 14, 8050, 63, 3771, 26, 355, 4719, 63, 515, 275, 747, 14, 515, 14, 904, 8, 3756, 63, 515, 63, 694, 12, 291, 14, 354, 9, 355, 340, 747, 14, 515, 14, 2444, 8, 3756, 63, 515, 304, 490, 291, 14, 515, 275, 4719, 63, 515, 490, 2059, 288, 587, 26, 355, 327, 675, 314, 1642, 931, 701, 849, 355, 291, 14, 515, 275, 747, 14, 515, 14, 904, 8, 24806, 14, 8050, 63, 3771, 59, 16, 467, 291, 14, 354, 9, 355, 327, 1218, 769, 402, 3962, 3792, 355, 291, 14, 3771, 275, 359, 88, 367, 671, 315, 486, 15914, 14, 8050, 63, 3771, 61, 355, 291, 14, 3771, 275, 359, 736, 14, 515, 14, 904, 8, 88, 12, 291, 14, 354, 9, 367, 671, 315, 291, 14, 3771, 61, 339, 347, 636, 2722, 721, 277, 304, 267, 408, 267, 1803, 298, 3756, 354, 334, 1023, 2924, 340, 1015, 365, 440, 2973, 267, 1803, 298, 3756, 354, 2, 4257, 267, 408, 267, 340, 291, 14, 1023, 26, 288, 372, 2071, 83, 4366, 83, 2924, 450, 334, 277, 14, 354, 12, 291, 14, 1023, 9, 267, 587, 26, 288, 372, 291, 14, 354, 339, 347, 636, 4077, 721, 277, 12, 1163, 304, 267, 372, 291, 14, 354, 508, 1163, 14, 354, 339, 768, 1829, 272, 347, 3341, 8, 277, 304, 267, 408, 267, 1803, 4719, 3341, 267, 408, 267, 340, 291, 423, 2343, 365, 488, 26, 288, 3404, 63, 515, 275, 747, 14, 515, 14, 904, 8, 277, 14, 515, 12, 291, 14, 10614, 63, 5848, 9, 288, 340, 747, 14, 515, 14, 6292, 8, 2024, 63, 515, 304, 355, 862, 26, 490, 289, 275, 1551, 8, 2024, 63, 515, 12, 283, 82, 358, 490, 291, 423, 2343, 275, 8864, 14, 3489, 63, 912, 8, 70, 9, 355, 871, 26, 490, 2929, 14, 8958, 24622, 480, 6005, 370, 2248, 3341, 367, 450, 83, 2, 450, 291, 14, 354, 9, 490, 372, 756, 355, 3753, 26, 490, 289, 14, 1600, 342, 398, 372, 291, 423, 2343, 339, 768, 1829, 272, 347, 3907, 63, 815, 8, 277, 304, 267, 408, 267, 1803, 4719, 3907, 2256, 267, 408, 267, 340, 291, 423, 3174, 63, 815, 365, 488, 26, 953, 2256, 63, 515, 275, 747, 14, 515, 14, 904, 8, 277, 14, 515, 12, 291, 14, 10614, 63, 16811, 9, 288, 340, 747, 14, 515, 14, 6292, 8, 815, 63, 515, 304, 355, 862, 26, 490, 289, 275, 1551, 8, 815, 63, 515, 12, 283, 82, 358, 490, 291, 423, 3174, 63, 815, 275, 8864, 14, 3489, 63, 912, 8, 70, 9, 355, 871, 26, 490, 2929, 14, 8958, 24622, 480, 6005, 370, 2248, 598, 15914, 3907, 2256, 367, 450, 83, 2, 450, 291, 14, 354, 0 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1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1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
shsingh/ansible
test/units/parsing/vault/test_vault.py
44
40862
# -*- coding: utf-8 -*- # (c) 2012-2014, Michael DeHaan <[email protected]> # (c) 2016, Toshio Kuratomi <[email protected]> # # 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 import binascii import io import os import tempfile from binascii import hexlify import pytest from units.compat import unittest from units.compat.mock import patch, MagicMock from ansible import errors from ansible.module_utils import six from ansible.module_utils._text import to_bytes, to_text from ansible.parsing import vault from units.mock.loader import DictDataLoader from units.mock.vault_helper import TextVaultSecret class TestUnhexlify(unittest.TestCase): def test(self): b_plain_data = b'some text to hexlify' b_data = hexlify(b_plain_data) res = vault._unhexlify(b_data) self.assertEqual(res, b_plain_data) def test_odd_length(self): b_data = b'123456789abcdefghijklmnopqrstuvwxyz' self.assertRaisesRegexp(vault.AnsibleVaultFormatError, '.*Vault format unhexlify error.*', vault._unhexlify, b_data) def test_nonhex(self): b_data = b'6z36316566653264333665333637623064303639353237620a636366633565663263336335656532' self.assertRaisesRegexp(vault.AnsibleVaultFormatError, '.*Vault format unhexlify error.*Non-hexadecimal digit found', vault._unhexlify, b_data) class TestParseVaulttext(unittest.TestCase): def test(self): vaulttext_envelope = u'''$ANSIBLE_VAULT;1.1;AES256 33363965326261303234626463623963633531343539616138316433353830356566396130353436 3562643163366231316662386565383735653432386435610a306664636137376132643732393835 63383038383730306639353234326630666539346233376330303938323639306661313032396437 6233623062366136310a633866373936313238333730653739323461656662303864663666653563 3138''' b_vaulttext_envelope = to_bytes(vaulttext_envelope, errors='strict', encoding='utf-8') b_vaulttext, b_version, cipher_name, vault_id = vault.parse_vaulttext_envelope(b_vaulttext_envelope) res = vault.parse_vaulttext(b_vaulttext) self.assertIsInstance(res[0], bytes) self.assertIsInstance(res[1], bytes) self.assertIsInstance(res[2], bytes) def test_non_hex(self): vaulttext_envelope = u'''$ANSIBLE_VAULT;1.1;AES256 3336396J326261303234626463623963633531343539616138316433353830356566396130353436 3562643163366231316662386565383735653432386435610a306664636137376132643732393835 63383038383730306639353234326630666539346233376330303938323639306661313032396437 6233623062366136310a633866373936313238333730653739323461656662303864663666653563 3138''' b_vaulttext_envelope = to_bytes(vaulttext_envelope, errors='strict', encoding='utf-8') b_vaulttext, b_version, cipher_name, vault_id = vault.parse_vaulttext_envelope(b_vaulttext_envelope) self.assertRaisesRegexp(vault.AnsibleVaultFormatError, '.*Vault format unhexlify error.*Non-hexadecimal digit found', vault.parse_vaulttext, b_vaulttext_envelope) class TestVaultSecret(unittest.TestCase): def test(self): secret = vault.VaultSecret() secret.load() self.assertIsNone(secret._bytes) def test_bytes(self): some_text = u'私はガラスを食べられます。それは私を傷つけません。' _bytes = to_bytes(some_text) secret = vault.VaultSecret(_bytes) secret.load() self.assertEqual(secret.bytes, _bytes) class TestPromptVaultSecret(unittest.TestCase): def test_empty_prompt_formats(self): secret = vault.PromptVaultSecret(vault_id='test_id', prompt_formats=[]) secret.load() self.assertIsNone(secret._bytes) @patch('ansible.parsing.vault.display.prompt', return_value='the_password') def test_prompt_formats_none(self, mock_display_prompt): secret = vault.PromptVaultSecret(vault_id='test_id') secret.load() self.assertEqual(secret._bytes, b'the_password') @patch('ansible.parsing.vault.display.prompt', return_value='the_password') def test_custom_prompt(self, mock_display_prompt): secret = vault.PromptVaultSecret(vault_id='test_id', prompt_formats=['The cow flies at midnight: ']) secret.load() self.assertEqual(secret._bytes, b'the_password') @patch('ansible.parsing.vault.display.prompt', side_effect=EOFError) def test_prompt_eoferror(self, mock_display_prompt): secret = vault.PromptVaultSecret(vault_id='test_id') self.assertRaisesRegexp(vault.AnsibleVaultError, 'EOFError.*test_id', secret.load) @patch('ansible.parsing.vault.display.prompt', side_effect=['first_password', 'second_password']) def test_prompt_passwords_dont_match(self, mock_display_prompt): secret = vault.PromptVaultSecret(vault_id='test_id', prompt_formats=['Vault password: ', 'Confirm Vault password: ']) self.assertRaisesRegexp(errors.AnsibleError, 'Passwords do not match', secret.load) class TestFileVaultSecret(unittest.TestCase): def setUp(self): self.vault_password = "test-vault-password" text_secret = TextVaultSecret(self.vault_password) self.vault_secrets = [('foo', text_secret)] def test(self): secret = vault.FileVaultSecret() self.assertIsNone(secret._bytes) self.assertIsNone(secret._text) def test_repr_empty(self): secret = vault.FileVaultSecret() self.assertEqual(repr(secret), "FileVaultSecret()") def test_repr(self): tmp_file = tempfile.NamedTemporaryFile(delete=False) fake_loader = DictDataLoader({tmp_file.name: 'sdfadf'}) secret = vault.FileVaultSecret(loader=fake_loader, filename=tmp_file.name) filename = tmp_file.name tmp_file.close() self.assertEqual(repr(secret), "FileVaultSecret(filename='%s')" % filename) def test_empty_bytes(self): secret = vault.FileVaultSecret() self.assertIsNone(secret.bytes) def test_file(self): password = 'some password' tmp_file = tempfile.NamedTemporaryFile(delete=False) tmp_file.write(to_bytes(password)) tmp_file.close() fake_loader = DictDataLoader({tmp_file.name: 'sdfadf'}) secret = vault.FileVaultSecret(loader=fake_loader, filename=tmp_file.name) secret.load() os.unlink(tmp_file.name) self.assertEqual(secret.bytes, to_bytes(password)) def test_file_empty(self): tmp_file = tempfile.NamedTemporaryFile(delete=False) tmp_file.write(to_bytes('')) tmp_file.close() fake_loader = DictDataLoader({tmp_file.name: ''}) secret = vault.FileVaultSecret(loader=fake_loader, filename=tmp_file.name) self.assertRaisesRegexp(vault.AnsibleVaultPasswordError, 'Invalid vault password was provided from file.*%s' % tmp_file.name, secret.load) os.unlink(tmp_file.name) def test_file_encrypted(self): vault_password = "test-vault-password" text_secret = TextVaultSecret(vault_password) vault_secrets = [('foo', text_secret)] password = 'some password' # 'some password' encrypted with 'test-ansible-password' password_file_content = '''$ANSIBLE_VAULT;1.1;AES256 61393863643638653437313566313632306462383837303132346434616433313438353634613762 3334363431623364386164616163326537366333353663650a663634306232363432626162353665 39623061353266373631636331643761306665343731376633623439313138396330346237653930 6432643864346136640a653364386634666461306231353765636662316335613235383565306437 3737 ''' tmp_file = tempfile.NamedTemporaryFile(delete=False) tmp_file.write(to_bytes(password_file_content)) tmp_file.close() fake_loader = DictDataLoader({tmp_file.name: 'sdfadf'}) fake_loader._vault.secrets = vault_secrets secret = vault.FileVaultSecret(loader=fake_loader, filename=tmp_file.name) secret.load() os.unlink(tmp_file.name) self.assertEqual(secret.bytes, to_bytes(password)) def test_file_not_a_directory(self): filename = '/dev/null/foobar' fake_loader = DictDataLoader({filename: 'sdfadf'}) secret = vault.FileVaultSecret(loader=fake_loader, filename=filename) self.assertRaisesRegexp(errors.AnsibleError, '.*Could not read vault password file.*/dev/null/foobar.*Not a directory', secret.load) def test_file_not_found(self): tmp_file = tempfile.NamedTemporaryFile() filename = os.path.realpath(tmp_file.name) tmp_file.close() fake_loader = DictDataLoader({filename: 'sdfadf'}) secret = vault.FileVaultSecret(loader=fake_loader, filename=filename) self.assertRaisesRegexp(errors.AnsibleError, '.*Could not read vault password file.*%s.*' % filename, secret.load) class TestScriptVaultSecret(unittest.TestCase): def test(self): secret = vault.ScriptVaultSecret() self.assertIsNone(secret._bytes) self.assertIsNone(secret._text) def _mock_popen(self, mock_popen, return_code=0, stdout=b'', stderr=b''): def communicate(): return stdout, stderr mock_popen.return_value = MagicMock(returncode=return_code) mock_popen_instance = mock_popen.return_value mock_popen_instance.communicate = communicate @patch('ansible.parsing.vault.subprocess.Popen') def test_read_file(self, mock_popen): self._mock_popen(mock_popen, stdout=b'some_password') secret = vault.ScriptVaultSecret() with patch.object(secret, 'loader') as mock_loader: mock_loader.is_executable = MagicMock(return_value=True) secret.load() @patch('ansible.parsing.vault.subprocess.Popen') def test_read_file_empty(self, mock_popen): self._mock_popen(mock_popen, stdout=b'') secret = vault.ScriptVaultSecret() with patch.object(secret, 'loader') as mock_loader: mock_loader.is_executable = MagicMock(return_value=True) self.assertRaisesRegexp(vault.AnsibleVaultPasswordError, 'Invalid vault password was provided from script', secret.load) @patch('ansible.parsing.vault.subprocess.Popen') def test_read_file_os_error(self, mock_popen): self._mock_popen(mock_popen) mock_popen.side_effect = OSError('That is not an executable') secret = vault.ScriptVaultSecret() with patch.object(secret, 'loader') as mock_loader: mock_loader.is_executable = MagicMock(return_value=True) self.assertRaisesRegexp(errors.AnsibleError, 'Problem running vault password script.*', secret.load) @patch('ansible.parsing.vault.subprocess.Popen') def test_read_file_not_executable(self, mock_popen): self._mock_popen(mock_popen) secret = vault.ScriptVaultSecret() with patch.object(secret, 'loader') as mock_loader: mock_loader.is_executable = MagicMock(return_value=False) self.assertRaisesRegexp(vault.AnsibleVaultError, 'The vault password script .* was not executable', secret.load) @patch('ansible.parsing.vault.subprocess.Popen') def test_read_file_non_zero_return_code(self, mock_popen): stderr = b'That did not work for a random reason' rc = 37 self._mock_popen(mock_popen, return_code=rc, stderr=stderr) secret = vault.ScriptVaultSecret(filename='/dev/null/some_vault_secret') with patch.object(secret, 'loader') as mock_loader: mock_loader.is_executable = MagicMock(return_value=True) self.assertRaisesRegexp(errors.AnsibleError, r'Vault password script.*returned non-zero \(%s\): %s' % (rc, stderr), secret.load) class TestScriptIsClient(unittest.TestCase): def test_randomname(self): filename = 'randomname' res = vault.script_is_client(filename) self.assertFalse(res) def test_something_dash_client(self): filename = 'something-client' res = vault.script_is_client(filename) self.assertTrue(res) def test_something_dash_client_somethingelse(self): filename = 'something-client-somethingelse' res = vault.script_is_client(filename) self.assertFalse(res) def test_something_dash_client_py(self): filename = 'something-client.py' res = vault.script_is_client(filename) self.assertTrue(res) def test_full_path_something_dash_client_py(self): filename = '/foo/bar/something-client.py' res = vault.script_is_client(filename) self.assertTrue(res) def test_full_path_something_dash_client(self): filename = '/foo/bar/something-client' res = vault.script_is_client(filename) self.assertTrue(res) def test_full_path_something_dash_client_in_dir(self): filename = '/foo/bar/something-client/but/not/filename' res = vault.script_is_client(filename) self.assertFalse(res) class TestGetFileVaultSecret(unittest.TestCase): def test_file(self): password = 'some password' tmp_file = tempfile.NamedTemporaryFile(delete=False) tmp_file.write(to_bytes(password)) tmp_file.close() fake_loader = DictDataLoader({tmp_file.name: 'sdfadf'}) secret = vault.get_file_vault_secret(filename=tmp_file.name, loader=fake_loader) secret.load() os.unlink(tmp_file.name) self.assertEqual(secret.bytes, to_bytes(password)) def test_file_not_a_directory(self): filename = '/dev/null/foobar' fake_loader = DictDataLoader({filename: 'sdfadf'}) self.assertRaisesRegexp(errors.AnsibleError, '.*The vault password file %s was not found.*' % filename, vault.get_file_vault_secret, filename=filename, loader=fake_loader) def test_file_not_found(self): tmp_file = tempfile.NamedTemporaryFile() filename = os.path.realpath(tmp_file.name) tmp_file.close() fake_loader = DictDataLoader({filename: 'sdfadf'}) self.assertRaisesRegexp(errors.AnsibleError, '.*The vault password file %s was not found.*' % filename, vault.get_file_vault_secret, filename=filename, loader=fake_loader) class TestVaultIsEncrypted(unittest.TestCase): def test_bytes_not_encrypted(self): b_data = b"foobar" self.assertFalse(vault.is_encrypted(b_data)) def test_bytes_encrypted(self): b_data = b"$ANSIBLE_VAULT;9.9;TEST\n%s" % hexlify(b"ansible") self.assertTrue(vault.is_encrypted(b_data)) def test_text_not_encrypted(self): b_data = to_text(b"foobar") self.assertFalse(vault.is_encrypted(b_data)) def test_text_encrypted(self): b_data = to_text(b"$ANSIBLE_VAULT;9.9;TEST\n%s" % hexlify(b"ansible")) self.assertTrue(vault.is_encrypted(b_data)) def test_invalid_text_not_ascii(self): data = u"$ANSIBLE_VAULT;9.9;TEST\n%s" % u"ァ ア ィ イ ゥ ウ ェ エ ォ オ カ ガ キ ギ ク グ ケ " self.assertFalse(vault.is_encrypted(data)) def test_invalid_bytes_not_ascii(self): data = u"$ANSIBLE_VAULT;9.9;TEST\n%s" % u"ァ ア ィ イ ゥ ウ ェ エ ォ オ カ ガ キ ギ ク グ ケ " b_data = to_bytes(data, encoding='utf-8') self.assertFalse(vault.is_encrypted(b_data)) class TestVaultIsEncryptedFile(unittest.TestCase): def test_binary_file_handle_not_encrypted(self): b_data = b"foobar" b_data_fo = io.BytesIO(b_data) self.assertFalse(vault.is_encrypted_file(b_data_fo)) def test_text_file_handle_not_encrypted(self): data = u"foobar" data_fo = io.StringIO(data) self.assertFalse(vault.is_encrypted_file(data_fo)) def test_binary_file_handle_encrypted(self): b_data = b"$ANSIBLE_VAULT;9.9;TEST\n%s" % hexlify(b"ansible") b_data_fo = io.BytesIO(b_data) self.assertTrue(vault.is_encrypted_file(b_data_fo)) def test_text_file_handle_encrypted(self): data = u"$ANSIBLE_VAULT;9.9;TEST\n%s" % to_text(hexlify(b"ansible")) data_fo = io.StringIO(data) self.assertTrue(vault.is_encrypted_file(data_fo)) def test_binary_file_handle_invalid(self): data = u"$ANSIBLE_VAULT;9.9;TEST\n%s" % u"ァ ア ィ イ ゥ ウ ェ エ ォ オ カ ガ キ ギ ク グ ケ " b_data = to_bytes(data) b_data_fo = io.BytesIO(b_data) self.assertFalse(vault.is_encrypted_file(b_data_fo)) def test_text_file_handle_invalid(self): data = u"$ANSIBLE_VAULT;9.9;TEST\n%s" % u"ァ ア ィ イ ゥ ウ ェ エ ォ オ カ ガ キ ギ ク グ ケ " data_fo = io.StringIO(data) self.assertFalse(vault.is_encrypted_file(data_fo)) def test_file_already_read_from_finds_header(self): b_data = b"$ANSIBLE_VAULT;9.9;TEST\n%s" % hexlify(b"ansible\ntesting\nfile pos") b_data_fo = io.BytesIO(b_data) b_data_fo.read(42) # Arbitrary number self.assertTrue(vault.is_encrypted_file(b_data_fo)) def test_file_already_read_from_saves_file_pos(self): b_data = b"$ANSIBLE_VAULT;9.9;TEST\n%s" % hexlify(b"ansible\ntesting\nfile pos") b_data_fo = io.BytesIO(b_data) b_data_fo.read(69) # Arbitrary number vault.is_encrypted_file(b_data_fo) self.assertEqual(b_data_fo.tell(), 69) def test_file_with_offset(self): b_data = b"JUNK$ANSIBLE_VAULT;9.9;TEST\n%s" % hexlify(b"ansible\ntesting\nfile pos") b_data_fo = io.BytesIO(b_data) self.assertTrue(vault.is_encrypted_file(b_data_fo, start_pos=4)) def test_file_with_count(self): b_data = b"$ANSIBLE_VAULT;9.9;TEST\n%s" % hexlify(b"ansible\ntesting\nfile pos") vault_length = len(b_data) b_data = b_data + u'ァ ア'.encode('utf-8') b_data_fo = io.BytesIO(b_data) self.assertTrue(vault.is_encrypted_file(b_data_fo, count=vault_length)) def test_file_with_offset_and_count(self): b_data = b"$ANSIBLE_VAULT;9.9;TEST\n%s" % hexlify(b"ansible\ntesting\nfile pos") vault_length = len(b_data) b_data = b'JUNK' + b_data + u'ァ ア'.encode('utf-8') b_data_fo = io.BytesIO(b_data) self.assertTrue(vault.is_encrypted_file(b_data_fo, start_pos=4, count=vault_length)) @pytest.mark.skipif(not vault.HAS_CRYPTOGRAPHY, reason="Skipping cryptography tests because cryptography is not installed") class TestVaultCipherAes256(unittest.TestCase): def setUp(self): self.vault_cipher = vault.VaultAES256() def test(self): self.assertIsInstance(self.vault_cipher, vault.VaultAES256) # TODO: tag these as slow tests def test_create_key_cryptography(self): b_password = b'hunter42' b_salt = os.urandom(32) b_key_cryptography = self.vault_cipher._create_key_cryptography(b_password, b_salt, key_length=32, iv_length=16) self.assertIsInstance(b_key_cryptography, six.binary_type) @pytest.mark.skipif(not vault.HAS_PYCRYPTO, reason='Not testing pycrypto key as pycrypto is not installed') def test_create_key_pycrypto(self): b_password = b'hunter42' b_salt = os.urandom(32) b_key_pycrypto = self.vault_cipher._create_key_pycrypto(b_password, b_salt, key_length=32, iv_length=16) self.assertIsInstance(b_key_pycrypto, six.binary_type) @pytest.mark.skipif(not vault.HAS_PYCRYPTO, reason='Not comparing cryptography key to pycrypto key as pycrypto is not installed') def test_compare_new_keys(self): b_password = b'hunter42' b_salt = os.urandom(32) b_key_cryptography = self.vault_cipher._create_key_cryptography(b_password, b_salt, key_length=32, iv_length=16) b_key_pycrypto = self.vault_cipher._create_key_pycrypto(b_password, b_salt, key_length=32, iv_length=16) self.assertEqual(b_key_cryptography, b_key_pycrypto) def test_create_key_known_cryptography(self): b_password = b'hunter42' # A fixed salt b_salt = b'q' * 32 # q is the most random letter. b_key_1 = self.vault_cipher._create_key_cryptography(b_password, b_salt, key_length=32, iv_length=16) self.assertIsInstance(b_key_1, six.binary_type) # verify we get the same answer # we could potentially run a few iterations of this and time it to see if it's roughly constant time # and or that it exceeds some minimal time, but that would likely cause unreliable fails, esp in CI b_key_2 = self.vault_cipher._create_key_cryptography(b_password, b_salt, key_length=32, iv_length=16) self.assertIsInstance(b_key_2, six.binary_type) self.assertEqual(b_key_1, b_key_2) # And again with pycrypto b_key_3 = self.vault_cipher._create_key_pycrypto(b_password, b_salt, key_length=32, iv_length=16) self.assertIsInstance(b_key_3, six.binary_type) # verify we get the same answer # we could potentially run a few iterations of this and time it to see if it's roughly constant time # and or that it exceeds some minimal time, but that would likely cause unreliable fails, esp in CI b_key_4 = self.vault_cipher._create_key_pycrypto(b_password, b_salt, key_length=32, iv_length=16) self.assertIsInstance(b_key_4, six.binary_type) self.assertEqual(b_key_3, b_key_4) self.assertEqual(b_key_1, b_key_4) def test_create_key_known_pycrypto(self): b_password = b'hunter42' # A fixed salt b_salt = b'q' * 32 # q is the most random letter. b_key_3 = self.vault_cipher._create_key_pycrypto(b_password, b_salt, key_length=32, iv_length=16) self.assertIsInstance(b_key_3, six.binary_type) # verify we get the same answer # we could potentially run a few iterations of this and time it to see if it's roughly constant time # and or that it exceeds some minimal time, but that would likely cause unreliable fails, esp in CI b_key_4 = self.vault_cipher._create_key_pycrypto(b_password, b_salt, key_length=32, iv_length=16) self.assertIsInstance(b_key_4, six.binary_type) self.assertEqual(b_key_3, b_key_4) def test_is_equal_is_equal(self): self.assertTrue(self.vault_cipher._is_equal(b'abcdefghijklmnopqrstuvwxyz', b'abcdefghijklmnopqrstuvwxyz')) def test_is_equal_unequal_length(self): self.assertFalse(self.vault_cipher._is_equal(b'abcdefghijklmnopqrstuvwxyz', b'abcdefghijklmnopqrstuvwx and sometimes y')) def test_is_equal_not_equal(self): self.assertFalse(self.vault_cipher._is_equal(b'abcdefghijklmnopqrstuvwxyz', b'AbcdefghijKlmnopQrstuvwxZ')) def test_is_equal_empty(self): self.assertTrue(self.vault_cipher._is_equal(b'', b'')) def test_is_equal_non_ascii_equal(self): utf8_data = to_bytes(u'私はガラスを食べられます。それは私を傷つけません。') self.assertTrue(self.vault_cipher._is_equal(utf8_data, utf8_data)) def test_is_equal_non_ascii_unequal(self): utf8_data = to_bytes(u'私はガラスを食べられます。それは私を傷つけません。') utf8_data2 = to_bytes(u'Pot să mănânc sticlă și ea nu mă rănește.') # Test for the len optimization path self.assertFalse(self.vault_cipher._is_equal(utf8_data, utf8_data2)) # Test for the slower, char by char comparison path self.assertFalse(self.vault_cipher._is_equal(utf8_data, utf8_data[:-1] + b'P')) def test_is_equal_non_bytes(self): """ Anything not a byte string should raise a TypeError """ self.assertRaises(TypeError, self.vault_cipher._is_equal, u"One fish", b"two fish") self.assertRaises(TypeError, self.vault_cipher._is_equal, b"One fish", u"two fish") self.assertRaises(TypeError, self.vault_cipher._is_equal, 1, b"red fish") self.assertRaises(TypeError, self.vault_cipher._is_equal, b"blue fish", 2) @pytest.mark.skipif(not vault.HAS_PYCRYPTO, reason="Skipping Pycrypto tests because pycrypto is not installed") class TestVaultCipherAes256PyCrypto(TestVaultCipherAes256): def setUp(self): self.has_cryptography = vault.HAS_CRYPTOGRAPHY vault.HAS_CRYPTOGRAPHY = False super(TestVaultCipherAes256PyCrypto, self).setUp() def tearDown(self): vault.HAS_CRYPTOGRAPHY = self.has_cryptography super(TestVaultCipherAes256PyCrypto, self).tearDown() class TestMatchSecrets(unittest.TestCase): def test_empty_tuple(self): secrets = [tuple()] vault_ids = ['vault_id_1'] self.assertRaises(ValueError, vault.match_secrets, secrets, vault_ids) def test_empty_secrets(self): matches = vault.match_secrets([], ['vault_id_1']) self.assertEqual(matches, []) def test_single_match(self): secret = TextVaultSecret('password') matches = vault.match_secrets([('default', secret)], ['default']) self.assertEqual(matches, [('default', secret)]) def test_no_matches(self): secret = TextVaultSecret('password') matches = vault.match_secrets([('default', secret)], ['not_default']) self.assertEqual(matches, []) def test_multiple_matches(self): secrets = [('vault_id1', TextVaultSecret('password1')), ('vault_id2', TextVaultSecret('password2')), ('vault_id1', TextVaultSecret('password3')), ('vault_id4', TextVaultSecret('password4'))] vault_ids = ['vault_id1', 'vault_id4'] matches = vault.match_secrets(secrets, vault_ids) self.assertEqual(len(matches), 3) expected = [('vault_id1', TextVaultSecret('password1')), ('vault_id1', TextVaultSecret('password3')), ('vault_id4', TextVaultSecret('password4'))] self.assertEqual([x for x, y in matches], [a for a, b in expected]) @pytest.mark.skipif(not vault.HAS_CRYPTOGRAPHY, reason="Skipping cryptography tests because cryptography is not installed") class TestVaultLib(unittest.TestCase): def setUp(self): self.vault_password = "test-vault-password" text_secret = TextVaultSecret(self.vault_password) self.vault_secrets = [('default', text_secret), ('test_id', text_secret)] self.v = vault.VaultLib(self.vault_secrets) def _vault_secrets(self, vault_id, secret): return [(vault_id, secret)] def _vault_secrets_from_password(self, vault_id, password): return [(vault_id, TextVaultSecret(password))] def test_encrypt(self): plaintext = u'Some text to encrypt in a café' b_vaulttext = self.v.encrypt(plaintext) self.assertIsInstance(b_vaulttext, six.binary_type) b_header = b'$ANSIBLE_VAULT;1.1;AES256\n' self.assertEqual(b_vaulttext[:len(b_header)], b_header) def test_encrypt_vault_id(self): plaintext = u'Some text to encrypt in a café' b_vaulttext = self.v.encrypt(plaintext, vault_id='test_id') self.assertIsInstance(b_vaulttext, six.binary_type) b_header = b'$ANSIBLE_VAULT;1.2;AES256;test_id\n' self.assertEqual(b_vaulttext[:len(b_header)], b_header) def test_encrypt_bytes(self): plaintext = to_bytes(u'Some text to encrypt in a café') b_vaulttext = self.v.encrypt(plaintext) self.assertIsInstance(b_vaulttext, six.binary_type) b_header = b'$ANSIBLE_VAULT;1.1;AES256\n' self.assertEqual(b_vaulttext[:len(b_header)], b_header) def test_encrypt_no_secret_empty_secrets(self): vault_secrets = [] v = vault.VaultLib(vault_secrets) plaintext = u'Some text to encrypt in a café' self.assertRaisesRegexp(vault.AnsibleVaultError, '.*A vault password must be specified to encrypt data.*', v.encrypt, plaintext) def test_format_vaulttext_envelope(self): cipher_name = "TEST" b_ciphertext = b"ansible" b_vaulttext = vault.format_vaulttext_envelope(b_ciphertext, cipher_name, version=self.v.b_version, vault_id='default') b_lines = b_vaulttext.split(b'\n') self.assertGreater(len(b_lines), 1, msg="failed to properly add header") b_header = b_lines[0] # self.assertTrue(b_header.endswith(b';TEST'), msg="header does not end with cipher name") b_header_parts = b_header.split(b';') self.assertEqual(len(b_header_parts), 4, msg="header has the wrong number of parts") self.assertEqual(b_header_parts[0], b'$ANSIBLE_VAULT', msg="header does not start with $ANSIBLE_VAULT") self.assertEqual(b_header_parts[1], self.v.b_version, msg="header version is incorrect") self.assertEqual(b_header_parts[2], b'TEST', msg="header does not end with cipher name") # And just to verify, lets parse the results and compare b_ciphertext2, b_version2, cipher_name2, vault_id2 = \ vault.parse_vaulttext_envelope(b_vaulttext) self.assertEqual(b_ciphertext, b_ciphertext2) self.assertEqual(self.v.b_version, b_version2) self.assertEqual(cipher_name, cipher_name2) self.assertEqual('default', vault_id2) def test_parse_vaulttext_envelope(self): b_vaulttext = b"$ANSIBLE_VAULT;9.9;TEST\nansible" b_ciphertext, b_version, cipher_name, vault_id = vault.parse_vaulttext_envelope(b_vaulttext) b_lines = b_ciphertext.split(b'\n') self.assertEqual(b_lines[0], b"ansible", msg="Payload was not properly split from the header") self.assertEqual(cipher_name, u'TEST', msg="cipher name was not properly set") self.assertEqual(b_version, b"9.9", msg="version was not properly set") def test_parse_vaulttext_envelope_crlf(self): b_vaulttext = b"$ANSIBLE_VAULT;9.9;TEST\r\nansible" b_ciphertext, b_version, cipher_name, vault_id = vault.parse_vaulttext_envelope(b_vaulttext) b_lines = b_ciphertext.split(b'\n') self.assertEqual(b_lines[0], b"ansible", msg="Payload was not properly split from the header") self.assertEqual(cipher_name, u'TEST', msg="cipher name was not properly set") self.assertEqual(b_version, b"9.9", msg="version was not properly set") def test_encrypt_decrypt_aes256(self): self.v.cipher_name = u'AES256' plaintext = u"foobar" b_vaulttext = self.v.encrypt(plaintext) b_plaintext = self.v.decrypt(b_vaulttext) self.assertNotEqual(b_vaulttext, b"foobar", msg="encryption failed") self.assertEqual(b_plaintext, b"foobar", msg="decryption failed") def test_encrypt_decrypt_aes256_none_secrets(self): vault_secrets = self._vault_secrets_from_password('default', 'ansible') v = vault.VaultLib(vault_secrets) plaintext = u"foobar" b_vaulttext = v.encrypt(plaintext) # VaultLib will default to empty {} if secrets is None v_none = vault.VaultLib(None) # so set secrets None explicitly v_none.secrets = None self.assertRaisesRegexp(vault.AnsibleVaultError, '.*A vault password must be specified to decrypt data.*', v_none.decrypt, b_vaulttext) def test_encrypt_decrypt_aes256_empty_secrets(self): vault_secrets = self._vault_secrets_from_password('default', 'ansible') v = vault.VaultLib(vault_secrets) plaintext = u"foobar" b_vaulttext = v.encrypt(plaintext) vault_secrets_empty = [] v_none = vault.VaultLib(vault_secrets_empty) self.assertRaisesRegexp(vault.AnsibleVaultError, '.*Attempting to decrypt but no vault secrets found.*', v_none.decrypt, b_vaulttext) def test_encrypt_decrypt_aes256_multiple_secrets_all_wrong(self): plaintext = u'Some text to encrypt in a café' b_vaulttext = self.v.encrypt(plaintext) vault_secrets = [('default', TextVaultSecret('another-wrong-password')), ('wrong-password', TextVaultSecret('wrong-password'))] v_multi = vault.VaultLib(vault_secrets) self.assertRaisesRegexp(errors.AnsibleError, '.*Decryption failed.*', v_multi.decrypt, b_vaulttext, filename='/dev/null/fake/filename') def test_encrypt_decrypt_aes256_multiple_secrets_one_valid(self): plaintext = u'Some text to encrypt in a café' b_vaulttext = self.v.encrypt(plaintext) correct_secret = TextVaultSecret(self.vault_password) wrong_secret = TextVaultSecret('wrong-password') vault_secrets = [('default', wrong_secret), ('corect_secret', correct_secret), ('wrong_secret', wrong_secret)] v_multi = vault.VaultLib(vault_secrets) b_plaintext = v_multi.decrypt(b_vaulttext) self.assertNotEqual(b_vaulttext, to_bytes(plaintext), msg="encryption failed") self.assertEqual(b_plaintext, to_bytes(plaintext), msg="decryption failed") def test_encrypt_decrypt_aes256_existing_vault(self): self.v.cipher_name = u'AES256' b_orig_plaintext = b"Setec Astronomy" vaulttext = u'''$ANSIBLE_VAULT;1.1;AES256 33363965326261303234626463623963633531343539616138316433353830356566396130353436 3562643163366231316662386565383735653432386435610a306664636137376132643732393835 63383038383730306639353234326630666539346233376330303938323639306661313032396437 6233623062366136310a633866373936313238333730653739323461656662303864663666653563 3138''' b_plaintext = self.v.decrypt(vaulttext) self.assertEqual(b_plaintext, b_plaintext, msg="decryption failed") b_vaulttext = to_bytes(vaulttext, encoding='ascii', errors='strict') b_plaintext = self.v.decrypt(b_vaulttext) self.assertEqual(b_plaintext, b_orig_plaintext, msg="decryption failed") # FIXME This test isn't working quite yet. @pytest.mark.skip(reason='This test is not ready yet') def test_encrypt_decrypt_aes256_bad_hmac(self): self.v.cipher_name = 'AES256' # plaintext = "Setec Astronomy" enc_data = '''$ANSIBLE_VAULT;1.1;AES256 33363965326261303234626463623963633531343539616138316433353830356566396130353436 3562643163366231316662386565383735653432386435610a306664636137376132643732393835 63383038383730306639353234326630666539346233376330303938323639306661313032396437 6233623062366136310a633866373936313238333730653739323461656662303864663666653563 3138''' b_data = to_bytes(enc_data, errors='strict', encoding='utf-8') b_data = self.v._split_header(b_data) foo = binascii.unhexlify(b_data) lines = foo.splitlines() # line 0 is salt, line 1 is hmac, line 2+ is ciphertext b_salt = lines[0] b_hmac = lines[1] b_ciphertext_data = b'\n'.join(lines[2:]) b_ciphertext = binascii.unhexlify(b_ciphertext_data) # b_orig_ciphertext = b_ciphertext[:] # now muck with the text # b_munged_ciphertext = b_ciphertext[:10] + b'\x00' + b_ciphertext[11:] # b_munged_ciphertext = b_ciphertext # assert b_orig_ciphertext != b_munged_ciphertext b_ciphertext_data = binascii.hexlify(b_ciphertext) b_payload = b'\n'.join([b_salt, b_hmac, b_ciphertext_data]) # reformat b_invalid_ciphertext = self.v._format_output(b_payload) # assert we throw an error self.v.decrypt(b_invalid_ciphertext) def test_decrypt_and_get_vault_id(self): b_expected_plaintext = to_bytes('foo bar\n') vaulttext = '''$ANSIBLE_VAULT;1.2;AES256;ansible_devel 65616435333934613466373335363332373764363365633035303466643439313864663837393234 3330656363343637313962633731333237313636633534630a386264363438363362326132363239 39363166646664346264383934393935653933316263333838386362633534326664646166663736 6462303664383765650a356637643633366663643566353036303162386237336233393065393164 6264''' vault_secrets = self._vault_secrets_from_password('ansible_devel', 'ansible') v = vault.VaultLib(vault_secrets) b_vaulttext = to_bytes(vaulttext) b_plaintext, vault_id_used, vault_secret_used = v.decrypt_and_get_vault_id(b_vaulttext) self.assertEqual(b_expected_plaintext, b_plaintext) self.assertEqual(vault_id_used, 'ansible_devel') self.assertEqual(vault_secret_used.text, 'ansible') def test_decrypt_non_default_1_2(self): b_expected_plaintext = to_bytes('foo bar\n') vaulttext = '''$ANSIBLE_VAULT;1.2;AES256;ansible_devel 65616435333934613466373335363332373764363365633035303466643439313864663837393234 3330656363343637313962633731333237313636633534630a386264363438363362326132363239 39363166646664346264383934393935653933316263333838386362633534326664646166663736 6462303664383765650a356637643633366663643566353036303162386237336233393065393164 6264''' vault_secrets = self._vault_secrets_from_password('default', 'ansible') v = vault.VaultLib(vault_secrets) b_vaulttext = to_bytes(vaulttext) b_plaintext = v.decrypt(b_vaulttext) self.assertEqual(b_expected_plaintext, b_plaintext) b_ciphertext, b_version, cipher_name, vault_id = vault.parse_vaulttext_envelope(b_vaulttext) self.assertEqual('ansible_devel', vault_id) self.assertEqual(b'1.2', b_version) def test_decrypt_decrypted(self): plaintext = u"ansible" self.assertRaises(errors.AnsibleError, self.v.decrypt, plaintext) b_plaintext = b"ansible" self.assertRaises(errors.AnsibleError, self.v.decrypt, b_plaintext) def test_cipher_not_set(self): plaintext = u"ansible" self.v.encrypt(plaintext) self.assertEqual(self.v.cipher_name, "AES256") @pytest.mark.skipif(not vault.HAS_PYCRYPTO, reason="Skipping Pycrypto tests because pycrypto is not installed") class TestVaultLibPyCrypto(TestVaultLib): def setUp(self): self.has_cryptography = vault.HAS_CRYPTOGRAPHY vault.HAS_CRYPTOGRAPHY = False super(TestVaultLibPyCrypto, self).setUp() def tearDown(self): vault.HAS_CRYPTOGRAPHY = self.has_cryptography super(TestVaultLibPyCrypto, self).tearDown()
gpl-3.0
[ 3, 1882, 2803, 26, 2774, 13, 24, 1882, 199, 3, 334, 67, 9, 6029, 13, 7280, 12, 16922, 22453, 665, 22333, 14, 24247, 32, 6799, 14, 957, 30, 199, 3, 334, 67, 9, 7800, 12, 4005, 609, 2308, 1804, 300, 4188, 73, 665, 2663, 300, 4188, 73, 32, 4853, 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, 646, 14755, 199, 646, 5890, 199, 646, 747, 199, 646, 5549, 199, 199, 504, 14755, 492, 6318, 8209, 199, 646, 4613, 199, 199, 504, 6204, 14, 5819, 492, 2882, 199, 504, 6204, 14, 5819, 14, 1805, 492, 3371, 12, 10079, 199, 199, 504, 3242, 492, 2552, 199, 504, 3242, 14, 578, 63, 1208, 492, 3816, 199, 504, 3242, 14, 578, 63, 1208, 423, 505, 492, 370, 63, 2394, 12, 370, 63, 505, 199, 504, 3242, 14, 11059, 492, 12738, 199, 199, 504, 6204, 14, 1805, 14, 3422, 492, 7448, 1451, 5455, 199, 504, 6204, 14, 1805, 14, 10077, 63, 3676, 492, 4516, 20229, 13790, 421, 199, 533, 1379, 1358, 20677, 8, 2796, 14, 1746, 304, 272, 347, 511, 8, 277, 304, 267, 330, 63, 6104, 63, 576, 275, 330, 1159, 1377, 1318, 370, 6318, 8209, 7, 267, 330, 63, 576, 275, 6318, 8209, 8, 66, 63, 6104, 63, 576, 9, 267, 522, 275, 12738, 423, 324, 20677, 8, 66, 63, 576, 9, 267, 291, 14, 629, 8, 470, 12, 330, 63, 6104, 63, 576, 9, 339, 347, 511, 63, 16216, 63, 1267, 8, 277, 304, 267, 330, 63, 576, 275, 330, 7, 11272, 23459, 7, 398, 291, 14, 10835, 8, 10077, 14, 10047, 20229, 3484, 547, 12, 1816, 1987, 10, 20229, 1475, 625, 20677, 1125, 16110, 1816, 12738, 423, 324, 20677, 12, 1816, 330, 63, 576, 9, 339, 347, 511, 63, 2865, 4097, 8, 277, 304, 267, 330, 63, 576, 275, 330, 7, 22, 90, 15031, 10355, 1272, 2182, 708, 772, 1153, 11065, 25293, 1344, 1401, 2789, 1216, 772, 1216, 1344, 1355, 1276, 708, 11452, 1165, 65, 26654, 11065, 31639, 15670, 1272, 8342, 1153, 1344, 1153, 1367, 15670, 708, 7, 398, 291, 14, 10835, 8, 10077, 14, 10047, 20229, 3484, 547, 12, 1816, 1987, 10, 20229, 1475, 625, 20677, 1125, 2795, 6932, 13, 426, 1800, 6355, 10964, 1911, 297, 1816, 12738, 423, 324, 20677, 12, 1816, 330, 63, 576, 9, 421, 199, 533, 1379, 4003, 20229, 505, 8, 2796, 14, 1746, 304, 272, 347, 511, 8, 277, 304, 267, 12738, 505, 63, 19707, 275, 399, 2344, 4, 8490, 63, 15162, 2233, 27, 17, 14, 17, 27, 14494, 3912, 199, 1153, 1344, 1355, 2182, 8342, 1479, 9056, 708, 1082, 2789, 11387, 1344, 9803, 26654, 1153, 2481, 7582, 1276, 13443, 975, 8527, 2192, 772, 1153, 1276, 1703, 1216, 1276, 2182, 1272, 13443, 9056, 1276, 1082, 1344, 199, 1276, 2789, 14637, 975, 1153, 1272, 1789, 969, 975, 1272, 1789, 1184, 15670, 1703, 1401, 1276, 2182, 1082, 708, 1703, 772, 13251, 709, 65, 1216, 1272, 11387, 1344, 7498, 1401, 23318, 772, 1401, 708, 1355, 1703, 1276, 199, 22, 13744, 1216, 1703, 1703, 1401, 1216, 1216, 1272, 1355, 1276, 708, 1082, 708, 1272, 1216, 1272, 2182, 1355, 1082, 2789, 1153, 11452, 14137, 1216, 1355, 1703, 708, 1344, 1355, 1216, 11829, 969, 9056, 708, 1355, 772, 1401, 199, 2789, 1153, 2789, 11363, 1789, 1272, 969, 2766, 709, 65, 31639, 13465, 1401, 1355, 1344, 2192, 708, 1703, 1153, 1401, 1216, 2182, 1401, 1355, 708, 12583, 10355, 1272, 2789, 1216, 1703, 772, 18263, 6997, 7920, 2766, 199, 19, 8527, 2344, 398, 330, 63, 10077, 505, 63, 19707, 275, 370, 63, 2394, 8, 10077, 505, 63, 19707, 12, 2552, 534, 4768, 297, 2644, 534, 1624, 13, 24, 358, 267, 330, 63, 10077, 505, 12, 330, 63, 1023, 12, 10830, 63, 354, 12, 12738, 63, 344, 275, 12738, 14, 1122, 63, 10077, 505, 63, 19707, 8, 66, 63, 10077, 505, 63, 19707, 9, 267, 522, 275, 12738, 14, 1122, 63, 10077, 505, 8, 66, 63, 10077, 505, 9, 267, 291, 14, 6926, 8, 470, 59, 16, 467, 2783, 9, 267, 291, 14, 6926, 8, 470, 59, 17, 467, 2783, 9, 267, 291, 14, 6926, 8, 470, 59, 18, 467, 2783, 9, 339, 347, 511, 63, 2865, 63, 4097, 8, 277, 304, 267, 12738, 505, 63, 19707, 275, 399, 2344, 4, 8490, 63, 15162, 2233, 27, 17, 14, 17, 27, 14494, 3912, 199, 1153, 1344, 13443, 42, 8342, 1479, 9056, 708, 1082, 2789, 11387, 1344, 9803, 26654, 1153, 2481, 7582, 1276, 13443, 975, 8527, 2192, 772, 1153, 1276, 1703, 1216, 1276, 2182, 1272, 13443, 9056, 1276, 1082, 1344, 199, 1276, 2789, 14637, 975, 1153, 1272, 1789, 969, 975, 1272, 1789, 1184, 15670, 1703, 1401, 1276, 2182, 1082, 708, 1703, 772, 13251, 709, 65, 1216, 1272, 11387, 1344, 7498, 1401, 23318, 772, 1401, 708, 1355, 1703, 1276, 199, 22, 13744, 1216, 1703, 1703, 1401, 1216, 1216, 1272, 1355, 1276, 708, 1082, 708, 1272, 1216, 1272, 2182, 1355, 1082, 2789, 1153, 11452, 14137, 1216, 1355, 1703, 708, 1344, 1355, 1216, 11829, 969, 9056, 708, 1355, 772, 1401, 199, 2789, 1153, 2789, 11363, 1789, 1272, 969, 2766, 709, 65, 31639, 13465, 1401, 1355 ]
[ 1882, 2803, 26, 2774, 13, 24, 1882, 199, 3, 334, 67, 9, 6029, 13, 7280, 12, 16922, 22453, 665, 22333, 14, 24247, 32, 6799, 14, 957, 30, 199, 3, 334, 67, 9, 7800, 12, 4005, 609, 2308, 1804, 300, 4188, 73, 665, 2663, 300, 4188, 73, 32, 4853, 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, 646, 14755, 199, 646, 5890, 199, 646, 747, 199, 646, 5549, 199, 199, 504, 14755, 492, 6318, 8209, 199, 646, 4613, 199, 199, 504, 6204, 14, 5819, 492, 2882, 199, 504, 6204, 14, 5819, 14, 1805, 492, 3371, 12, 10079, 199, 199, 504, 3242, 492, 2552, 199, 504, 3242, 14, 578, 63, 1208, 492, 3816, 199, 504, 3242, 14, 578, 63, 1208, 423, 505, 492, 370, 63, 2394, 12, 370, 63, 505, 199, 504, 3242, 14, 11059, 492, 12738, 199, 199, 504, 6204, 14, 1805, 14, 3422, 492, 7448, 1451, 5455, 199, 504, 6204, 14, 1805, 14, 10077, 63, 3676, 492, 4516, 20229, 13790, 421, 199, 533, 1379, 1358, 20677, 8, 2796, 14, 1746, 304, 272, 347, 511, 8, 277, 304, 267, 330, 63, 6104, 63, 576, 275, 330, 1159, 1377, 1318, 370, 6318, 8209, 7, 267, 330, 63, 576, 275, 6318, 8209, 8, 66, 63, 6104, 63, 576, 9, 267, 522, 275, 12738, 423, 324, 20677, 8, 66, 63, 576, 9, 267, 291, 14, 629, 8, 470, 12, 330, 63, 6104, 63, 576, 9, 339, 347, 511, 63, 16216, 63, 1267, 8, 277, 304, 267, 330, 63, 576, 275, 330, 7, 11272, 23459, 7, 398, 291, 14, 10835, 8, 10077, 14, 10047, 20229, 3484, 547, 12, 1816, 1987, 10, 20229, 1475, 625, 20677, 1125, 16110, 1816, 12738, 423, 324, 20677, 12, 1816, 330, 63, 576, 9, 339, 347, 511, 63, 2865, 4097, 8, 277, 304, 267, 330, 63, 576, 275, 330, 7, 22, 90, 15031, 10355, 1272, 2182, 708, 772, 1153, 11065, 25293, 1344, 1401, 2789, 1216, 772, 1216, 1344, 1355, 1276, 708, 11452, 1165, 65, 26654, 11065, 31639, 15670, 1272, 8342, 1153, 1344, 1153, 1367, 15670, 708, 7, 398, 291, 14, 10835, 8, 10077, 14, 10047, 20229, 3484, 547, 12, 1816, 1987, 10, 20229, 1475, 625, 20677, 1125, 2795, 6932, 13, 426, 1800, 6355, 10964, 1911, 297, 1816, 12738, 423, 324, 20677, 12, 1816, 330, 63, 576, 9, 421, 199, 533, 1379, 4003, 20229, 505, 8, 2796, 14, 1746, 304, 272, 347, 511, 8, 277, 304, 267, 12738, 505, 63, 19707, 275, 399, 2344, 4, 8490, 63, 15162, 2233, 27, 17, 14, 17, 27, 14494, 3912, 199, 1153, 1344, 1355, 2182, 8342, 1479, 9056, 708, 1082, 2789, 11387, 1344, 9803, 26654, 1153, 2481, 7582, 1276, 13443, 975, 8527, 2192, 772, 1153, 1276, 1703, 1216, 1276, 2182, 1272, 13443, 9056, 1276, 1082, 1344, 199, 1276, 2789, 14637, 975, 1153, 1272, 1789, 969, 975, 1272, 1789, 1184, 15670, 1703, 1401, 1276, 2182, 1082, 708, 1703, 772, 13251, 709, 65, 1216, 1272, 11387, 1344, 7498, 1401, 23318, 772, 1401, 708, 1355, 1703, 1276, 199, 22, 13744, 1216, 1703, 1703, 1401, 1216, 1216, 1272, 1355, 1276, 708, 1082, 708, 1272, 1216, 1272, 2182, 1355, 1082, 2789, 1153, 11452, 14137, 1216, 1355, 1703, 708, 1344, 1355, 1216, 11829, 969, 9056, 708, 1355, 772, 1401, 199, 2789, 1153, 2789, 11363, 1789, 1272, 969, 2766, 709, 65, 31639, 13465, 1401, 1355, 1344, 2192, 708, 1703, 1153, 1401, 1216, 2182, 1401, 1355, 708, 12583, 10355, 1272, 2789, 1216, 1703, 772, 18263, 6997, 7920, 2766, 199, 19, 8527, 2344, 398, 330, 63, 10077, 505, 63, 19707, 275, 370, 63, 2394, 8, 10077, 505, 63, 19707, 12, 2552, 534, 4768, 297, 2644, 534, 1624, 13, 24, 358, 267, 330, 63, 10077, 505, 12, 330, 63, 1023, 12, 10830, 63, 354, 12, 12738, 63, 344, 275, 12738, 14, 1122, 63, 10077, 505, 63, 19707, 8, 66, 63, 10077, 505, 63, 19707, 9, 267, 522, 275, 12738, 14, 1122, 63, 10077, 505, 8, 66, 63, 10077, 505, 9, 267, 291, 14, 6926, 8, 470, 59, 16, 467, 2783, 9, 267, 291, 14, 6926, 8, 470, 59, 17, 467, 2783, 9, 267, 291, 14, 6926, 8, 470, 59, 18, 467, 2783, 9, 339, 347, 511, 63, 2865, 63, 4097, 8, 277, 304, 267, 12738, 505, 63, 19707, 275, 399, 2344, 4, 8490, 63, 15162, 2233, 27, 17, 14, 17, 27, 14494, 3912, 199, 1153, 1344, 13443, 42, 8342, 1479, 9056, 708, 1082, 2789, 11387, 1344, 9803, 26654, 1153, 2481, 7582, 1276, 13443, 975, 8527, 2192, 772, 1153, 1276, 1703, 1216, 1276, 2182, 1272, 13443, 9056, 1276, 1082, 1344, 199, 1276, 2789, 14637, 975, 1153, 1272, 1789, 969, 975, 1272, 1789, 1184, 15670, 1703, 1401, 1276, 2182, 1082, 708, 1703, 772, 13251, 709, 65, 1216, 1272, 11387, 1344, 7498, 1401, 23318, 772, 1401, 708, 1355, 1703, 1276, 199, 22, 13744, 1216, 1703, 1703, 1401, 1216, 1216, 1272, 1355, 1276, 708, 1082, 708, 1272, 1216, 1272, 2182, 1355, 1082, 2789, 1153, 11452, 14137, 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 ]
iamkingmaker/zipline
zipline/utils/test_utils.py
8
9150
from contextlib import contextmanager from itertools import ( product, ) from logbook import FileHandler from mock import patch from numpy.testing import assert_array_equal import operator from zipline.finance.blotter import ORDER_STATUS from zipline.utils import security_list from six import ( itervalues, ) from six.moves import filter import os import pandas as pd import shutil import tempfile EPOCH = pd.Timestamp(0, tz='UTC') def seconds_to_timestamp(seconds): return pd.Timestamp(seconds, unit='s', tz='UTC') def to_utc(time_str): """Convert a string in US/Eastern time to UTC""" return pd.Timestamp(time_str, tz='US/Eastern').tz_convert('UTC') def str_to_seconds(s): """ Convert a pandas-intelligible string to (integer) seconds since UTC. >>> from pandas import Timestamp >>> (Timestamp('2014-01-01') - Timestamp(0)).total_seconds() 1388534400.0 >>> str_to_seconds('2014-01-01') 1388534400 """ return int((pd.Timestamp(s, tz='UTC') - EPOCH).total_seconds()) def setup_logger(test, path='test.log'): test.log_handler = FileHandler(path) test.log_handler.push_application() def teardown_logger(test): test.log_handler.pop_application() test.log_handler.close() def drain_zipline(test, zipline): output = [] transaction_count = 0 msg_counter = 0 # start the simulation for update in zipline: msg_counter += 1 output.append(update) if 'daily_perf' in update: transaction_count += \ len(update['daily_perf']['transactions']) return output, transaction_count def assert_single_position(test, zipline): output, transaction_count = drain_zipline(test, zipline) if 'expected_transactions' in test.zipline_test_config: test.assertEqual( test.zipline_test_config['expected_transactions'], transaction_count ) else: test.assertEqual( test.zipline_test_config['order_count'], transaction_count ) # the final message is the risk report, the second to # last is the final day's results. Positions is a list of # dicts. closing_positions = output[-2]['daily_perf']['positions'] # confirm that all orders were filled. # iterate over the output updates, overwriting # orders when they are updated. Then check the status on all. orders_by_id = {} for update in output: if 'daily_perf' in update: if 'orders' in update['daily_perf']: for order in update['daily_perf']['orders']: orders_by_id[order['id']] = order for order in itervalues(orders_by_id): test.assertEqual( order['status'], ORDER_STATUS.FILLED, "") test.assertEqual( len(closing_positions), 1, "Portfolio should have one position." ) sid = test.zipline_test_config['sid'] test.assertEqual( closing_positions[0]['sid'], sid, "Portfolio should have one position in " + str(sid) ) return output, transaction_count class ExceptionSource(object): def __init__(self): pass def get_hash(self): return "ExceptionSource" def __iter__(self): return self def next(self): 5 / 0 def __next__(self): 5 / 0 @contextmanager def security_list_copy(): old_dir = security_list.SECURITY_LISTS_DIR new_dir = tempfile.mkdtemp() try: for subdir in os.listdir(old_dir): shutil.copytree(os.path.join(old_dir, subdir), os.path.join(new_dir, subdir)) with patch.object(security_list, 'SECURITY_LISTS_DIR', new_dir), \ patch.object(security_list, 'using_copy', True, create=True): yield finally: shutil.rmtree(new_dir, True) def add_security_data(adds, deletes): if not hasattr(security_list, 'using_copy'): raise Exception('add_security_data must be used within ' 'security_list_copy context') directory = os.path.join( security_list.SECURITY_LISTS_DIR, "leveraged_etf_list/20150127/20150125" ) if not os.path.exists(directory): os.makedirs(directory) del_path = os.path.join(directory, "delete") with open(del_path, 'w') as f: for sym in deletes: f.write(sym) f.write('\n') add_path = os.path.join(directory, "add") with open(add_path, 'w') as f: for sym in adds: f.write(sym) f.write('\n') def all_pairs_matching_predicate(values, pred): """ Return an iterator of all pairs, (v0, v1) from values such that `pred(v0, v1) == True` Parameters ---------- values : iterable pred : function Returns ------- pairs_iterator : generator Generator yielding pairs matching `pred`. Examples -------- >>> from zipline.utils.test_utils import all_pairs_matching_predicate >>> from operator import eq, lt >>> list(all_pairs_matching_predicate(range(5), eq)) [(0, 0), (1, 1), (2, 2), (3, 3), (4, 4)] >>> list(all_pairs_matching_predicate("abcd", lt)) [('a', 'b'), ('a', 'c'), ('a', 'd'), ('b', 'c'), ('b', 'd'), ('c', 'd')] """ return filter(lambda pair: pred(*pair), product(values, repeat=2)) def product_upper_triangle(values, include_diagonal=False): """ Return an iterator over pairs, (v0, v1), drawn from values. If `include_diagonal` is True, returns all pairs such that v0 <= v1. If `include_diagonal` is False, returns all pairs such that v0 < v1. """ return all_pairs_matching_predicate( values, operator.le if include_diagonal else operator.lt, ) def all_subindices(index): """ Return all valid sub-indices of a pandas Index. """ return ( index[start:stop] for start, stop in product_upper_triangle(range(len(index) + 1)) ) def make_rotating_asset_info(num_assets, first_start, frequency, periods_between_starts, asset_lifetime): """ Create a DataFrame representing lifetimes of assets that are constantly rotating in and out of existence. Parameters ---------- num_assets : int How many assets to create. first_start : pd.Timestamp The start date for the first asset. frequency : str or pd.tseries.offsets.Offset (e.g. trading_day) Frequency used to interpret next two arguments. periods_between_starts : int Create a new asset every `frequency` * `periods_between_new` asset_lifetime : int Each asset exists for `frequency` * `asset_lifetime` days. Returns ------- info : pd.DataFrame DataFrame representing newly-created assets. """ return pd.DataFrame( { 'sid': range(num_assets), 'symbol': [chr(ord('A') + i) for i in range(num_assets)], 'asset_type': ['equity'] * num_assets, # Start a new asset every `periods_between_starts` days. 'start_date': pd.date_range( first_start, freq=(periods_between_starts * frequency), periods=num_assets, ), # Each asset lasts for `asset_lifetime` days. 'end_date': pd.date_range( first_start + (asset_lifetime * frequency), freq=(periods_between_starts * frequency), periods=num_assets, ), 'exchange': 'TEST', } ) def make_simple_asset_info(assets, start_date, end_date, symbols=None): """ Create a DataFrame representing assets that exist for the full duration between `start_date` and `end_date`. Parameters ---------- assets : array-like start_date : pd.DatetimeIndex end_date : pd.DatetimeIndex symbols : list, optional Symbols to use for the assets. If not provided, symbols are generated from upper-case letters. Returns ------- info : pd.DataFrame DataFrame representing newly-created assets. """ num_assets = len(assets) if symbols is None: symbols = [chr(ord('A') + i) for i in range(num_assets)] return pd.DataFrame( { 'sid': assets, 'symbol': symbols, 'asset_type': ['equity'] * num_assets, 'start_date': [start_date] * num_assets, 'end_date': [end_date] * num_assets, 'exchange': 'TEST', } ) def check_arrays(left, right, err_msg='', verbose=True): """ Wrapper around np.assert_array_equal that also verifies that inputs are ndarrays. See Also -------- np.assert_array_equal """ if type(left) != type(right): raise AssertionError("%s != %s" % (type(left), type(right))) return assert_array_equal(left, right, err_msg=err_msg, verbose=True)
apache-2.0
[ 504, 15502, 492, 27608, 199, 504, 7975, 492, 334, 272, 3336, 12, 199, 9, 199, 504, 943, 2706, 492, 3814, 2461, 199, 504, 1683, 492, 3371, 199, 504, 2680, 14, 4776, 492, 702, 63, 1144, 63, 1452, 199, 646, 4182, 199, 504, 3482, 604, 14, 2408, 554, 14, 66, 1653, 351, 492, 16044, 63, 6305, 199, 504, 3482, 604, 14, 1208, 492, 6391, 63, 513, 199, 504, 3816, 492, 334, 272, 24451, 12, 199, 9, 199, 504, 3816, 14, 4912, 492, 2457, 199, 199, 646, 747, 199, 646, 10634, 465, 6454, 199, 646, 5145, 199, 646, 5549, 199, 199, 37, 1512, 1244, 275, 6454, 14, 10239, 8, 16, 12, 5823, 534, 11288, 358, 421, 199, 318, 4696, 63, 475, 63, 3954, 8, 4515, 304, 272, 372, 6454, 14, 10239, 8, 4515, 12, 4137, 534, 83, 297, 5823, 534, 11288, 358, 421, 199, 318, 370, 63, 5834, 8, 521, 63, 495, 304, 272, 408, 7306, 282, 1059, 315, 19635, 15, 32661, 900, 370, 12174, 624, 272, 372, 6454, 14, 10239, 8, 521, 63, 495, 12, 5823, 534, 1668, 15, 32661, 1959, 3903, 63, 3916, 360, 11288, 358, 421, 199, 318, 620, 63, 475, 63, 4515, 8, 83, 304, 272, 408, 272, 7905, 282, 10634, 13, 5707, 13876, 28297, 1059, 370, 334, 4115, 9, 4696, 3967, 12174, 14, 339, 1306, 687, 10634, 492, 18267, 272, 1306, 334, 10239, 360, 7280, 13, 614, 13, 614, 358, 446, 18267, 8, 16, 4992, 2923, 63, 4515, 342, 272, 4944, 15889, 1082, 5303, 14, 16, 272, 1306, 620, 63, 475, 63, 4515, 360, 7280, 13, 614, 13, 614, 358, 272, 4944, 15889, 1082, 5303, 272, 408, 272, 372, 1109, 1332, 8961, 14, 10239, 8, 83, 12, 5823, 534, 11288, 358, 446, 662, 1512, 1244, 680, 2923, 63, 4515, 1012, 421, 199, 318, 3272, 63, 2921, 8, 396, 12, 931, 534, 396, 14, 793, 735, 272, 511, 14, 793, 63, 2232, 275, 3814, 2461, 8, 515, 9, 272, 511, 14, 793, 63, 2232, 14, 5335, 63, 3578, 342, 421, 199, 318, 17558, 63, 2921, 8, 396, 304, 272, 511, 14, 793, 63, 2232, 14, 1935, 63, 3578, 342, 272, 511, 14, 793, 63, 2232, 14, 1600, 342, 421, 199, 318, 366, 6322, 63, 3065, 604, 8, 396, 12, 3482, 604, 304, 272, 1072, 275, 942, 272, 6008, 63, 835, 275, 378, 272, 1499, 63, 5337, 275, 378, 272, 327, 1343, 314, 17625, 272, 367, 1678, 315, 3482, 604, 26, 267, 1499, 63, 5337, 847, 413, 267, 1072, 14, 740, 8, 873, 9, 267, 340, 283, 18621, 63, 9452, 7, 315, 1678, 26, 288, 6008, 63, 835, 847, 971, 355, 822, 8, 873, 459, 18621, 63, 9452, 2545, 13754, 1105, 339, 372, 1072, 12, 6008, 63, 835, 421, 199, 318, 702, 63, 4780, 63, 3124, 8, 396, 12, 3482, 604, 304, 339, 1072, 12, 6008, 63, 835, 275, 366, 6322, 63, 3065, 604, 8, 396, 12, 3482, 604, 9, 339, 340, 283, 2062, 63, 13754, 7, 315, 511, 14, 3065, 604, 63, 396, 63, 888, 26, 267, 511, 14, 629, 8, 288, 511, 14, 3065, 604, 63, 396, 63, 888, 459, 2062, 63, 13754, 995, 288, 6008, 63, 835, 267, 776, 272, 587, 26, 267, 511, 14, 629, 8, 288, 511, 14, 3065, 604, 63, 396, 63, 888, 459, 1648, 63, 835, 995, 288, 6008, 63, 835, 267, 776, 339, 327, 314, 4242, 1245, 365, 314, 22633, 3622, 12, 314, 3499, 370, 272, 327, 2061, 365, 314, 4242, 5382, 1159, 2058, 14, 4376, 6150, 365, 282, 769, 402, 272, 327, 10809, 14, 272, 11261, 63, 12658, 275, 1072, 1988, 18, 2733, 18621, 63, 9452, 2545, 12658, 418, 339, 327, 12679, 626, 1006, 15460, 4898, 13457, 14, 272, 327, 13974, 1806, 314, 1072, 7029, 12, 32592, 272, 327, 15460, 1380, 2985, 787, 4588, 14, 9442, 1104, 314, 2004, 641, 1006, 14, 272, 15460, 63, 991, 63, 344, 275, 1052, 272, 367, 1678, 315, 1072, 26, 267, 340, 283, 18621, 63, 9452, 7, 315, 1678, 26, 288, 340, 283, 14387, 7, 315, 1678, 459, 18621, 63, 9452, 2565, 355, 367, 1865, 315, 1678, 459, 18621, 63, 9452, 2545, 14387, 2565, 490, 15460, 63, 991, 63, 344, 59, 1648, 459, 344, 6538, 275, 1865, 339, 367, 1865, 315, 24451, 8, 14387, 63, 991, 63, 344, 304, 267, 511, 14, 629, 8, 288, 1865, 459, 1205, 995, 288, 16044, 63, 6305, 14, 5110, 5290, 12, 288, 6899, 339, 511, 14, 629, 8, 267, 822, 8, 11707, 63, 12658, 395, 267, 413, 12, 267, 298, 4313, 27165, 1077, 1172, 1373, 3421, 2122, 272, 776, 339, 15764, 275, 511, 14, 3065, 604, 63, 396, 63, 888, 459, 4148, 418, 272, 511, 14, 629, 8, 267, 11261, 63, 12658, 59, 16, 2733, 4148, 995, 267, 15764, 12, 267, 298, 4313, 27165, 1077, 1172, 1373, 3421, 315, 298, 435, 620, 8, 4148, 9, 272, 776, 339, 372, 1072, 12, 6008, 63, 835, 421, 199, 533, 2186, 2980, 8, 785, 304, 339, 347, 636, 826, 721, 277, 304, 267, 986, 339, 347, 664, 63, 2227, 8, 277, 304, 267, 372, 298, 1726, 2980, 2, 339, 347, 636, 1661, 721, 277, 304, 267, 372, 291, 339, 347, 2163, 8, 277, 304, 267, 959, 1182, 378, 339, 347, 636, 2184, 721, 277, 304, 267, 959, 1182, 378, 421, 199, 32, 14237, 199, 318, 6391, 63, 513, 63, 1574, 837, 272, 2269, 63, 694, 275, 6391, 63, 513, 14, 13554, 63, 4924, 51, 63, 3022, 272, 892, 63, 694, 275, 5549, 14, 11983, 342, 272, 862, 26, 267, 367, 15488, 315, 747, 14, 7374, 8, 1753, 63, 694, 304, 288, 5145, 14, 29296, 8, 736, 14, 515, 14, 904, 8, 1753, 63, 694, 12, 15488, 395, 1169, 747, 14, 515, 14, 904, 8, 1222, 63, 694, 12, 15488, 430, 288, 543, 3371, 14, 785, 8, 4416, 63, 513, 12, 283, 13554, 63, 4924, 51, 63, 3022, 297, 892, 63, 694, 395, 971, 490, 3371, 14, 785, 8, 4416, 63, 513, 12, 283, 4941, 63, 1574, 297, 715, 12, 639, 1218, 29, 549, 304, 355, 1995, 272, 3753, 26, 267, 5145, 14, 9242, 8, 1222, 63, 694, 12, 715, 9, 421, 199, 318, 1050, 63, 4416, 63, 576, 8, 525, 83, 12, 21812, 304, 272 ]
[ 15502, 492, 27608, 199, 504, 7975, 492, 334, 272, 3336, 12, 199, 9, 199, 504, 943, 2706, 492, 3814, 2461, 199, 504, 1683, 492, 3371, 199, 504, 2680, 14, 4776, 492, 702, 63, 1144, 63, 1452, 199, 646, 4182, 199, 504, 3482, 604, 14, 2408, 554, 14, 66, 1653, 351, 492, 16044, 63, 6305, 199, 504, 3482, 604, 14, 1208, 492, 6391, 63, 513, 199, 504, 3816, 492, 334, 272, 24451, 12, 199, 9, 199, 504, 3816, 14, 4912, 492, 2457, 199, 199, 646, 747, 199, 646, 10634, 465, 6454, 199, 646, 5145, 199, 646, 5549, 199, 199, 37, 1512, 1244, 275, 6454, 14, 10239, 8, 16, 12, 5823, 534, 11288, 358, 421, 199, 318, 4696, 63, 475, 63, 3954, 8, 4515, 304, 272, 372, 6454, 14, 10239, 8, 4515, 12, 4137, 534, 83, 297, 5823, 534, 11288, 358, 421, 199, 318, 370, 63, 5834, 8, 521, 63, 495, 304, 272, 408, 7306, 282, 1059, 315, 19635, 15, 32661, 900, 370, 12174, 624, 272, 372, 6454, 14, 10239, 8, 521, 63, 495, 12, 5823, 534, 1668, 15, 32661, 1959, 3903, 63, 3916, 360, 11288, 358, 421, 199, 318, 620, 63, 475, 63, 4515, 8, 83, 304, 272, 408, 272, 7905, 282, 10634, 13, 5707, 13876, 28297, 1059, 370, 334, 4115, 9, 4696, 3967, 12174, 14, 339, 1306, 687, 10634, 492, 18267, 272, 1306, 334, 10239, 360, 7280, 13, 614, 13, 614, 358, 446, 18267, 8, 16, 4992, 2923, 63, 4515, 342, 272, 4944, 15889, 1082, 5303, 14, 16, 272, 1306, 620, 63, 475, 63, 4515, 360, 7280, 13, 614, 13, 614, 358, 272, 4944, 15889, 1082, 5303, 272, 408, 272, 372, 1109, 1332, 8961, 14, 10239, 8, 83, 12, 5823, 534, 11288, 358, 446, 662, 1512, 1244, 680, 2923, 63, 4515, 1012, 421, 199, 318, 3272, 63, 2921, 8, 396, 12, 931, 534, 396, 14, 793, 735, 272, 511, 14, 793, 63, 2232, 275, 3814, 2461, 8, 515, 9, 272, 511, 14, 793, 63, 2232, 14, 5335, 63, 3578, 342, 421, 199, 318, 17558, 63, 2921, 8, 396, 304, 272, 511, 14, 793, 63, 2232, 14, 1935, 63, 3578, 342, 272, 511, 14, 793, 63, 2232, 14, 1600, 342, 421, 199, 318, 366, 6322, 63, 3065, 604, 8, 396, 12, 3482, 604, 304, 272, 1072, 275, 942, 272, 6008, 63, 835, 275, 378, 272, 1499, 63, 5337, 275, 378, 272, 327, 1343, 314, 17625, 272, 367, 1678, 315, 3482, 604, 26, 267, 1499, 63, 5337, 847, 413, 267, 1072, 14, 740, 8, 873, 9, 267, 340, 283, 18621, 63, 9452, 7, 315, 1678, 26, 288, 6008, 63, 835, 847, 971, 355, 822, 8, 873, 459, 18621, 63, 9452, 2545, 13754, 1105, 339, 372, 1072, 12, 6008, 63, 835, 421, 199, 318, 702, 63, 4780, 63, 3124, 8, 396, 12, 3482, 604, 304, 339, 1072, 12, 6008, 63, 835, 275, 366, 6322, 63, 3065, 604, 8, 396, 12, 3482, 604, 9, 339, 340, 283, 2062, 63, 13754, 7, 315, 511, 14, 3065, 604, 63, 396, 63, 888, 26, 267, 511, 14, 629, 8, 288, 511, 14, 3065, 604, 63, 396, 63, 888, 459, 2062, 63, 13754, 995, 288, 6008, 63, 835, 267, 776, 272, 587, 26, 267, 511, 14, 629, 8, 288, 511, 14, 3065, 604, 63, 396, 63, 888, 459, 1648, 63, 835, 995, 288, 6008, 63, 835, 267, 776, 339, 327, 314, 4242, 1245, 365, 314, 22633, 3622, 12, 314, 3499, 370, 272, 327, 2061, 365, 314, 4242, 5382, 1159, 2058, 14, 4376, 6150, 365, 282, 769, 402, 272, 327, 10809, 14, 272, 11261, 63, 12658, 275, 1072, 1988, 18, 2733, 18621, 63, 9452, 2545, 12658, 418, 339, 327, 12679, 626, 1006, 15460, 4898, 13457, 14, 272, 327, 13974, 1806, 314, 1072, 7029, 12, 32592, 272, 327, 15460, 1380, 2985, 787, 4588, 14, 9442, 1104, 314, 2004, 641, 1006, 14, 272, 15460, 63, 991, 63, 344, 275, 1052, 272, 367, 1678, 315, 1072, 26, 267, 340, 283, 18621, 63, 9452, 7, 315, 1678, 26, 288, 340, 283, 14387, 7, 315, 1678, 459, 18621, 63, 9452, 2565, 355, 367, 1865, 315, 1678, 459, 18621, 63, 9452, 2545, 14387, 2565, 490, 15460, 63, 991, 63, 344, 59, 1648, 459, 344, 6538, 275, 1865, 339, 367, 1865, 315, 24451, 8, 14387, 63, 991, 63, 344, 304, 267, 511, 14, 629, 8, 288, 1865, 459, 1205, 995, 288, 16044, 63, 6305, 14, 5110, 5290, 12, 288, 6899, 339, 511, 14, 629, 8, 267, 822, 8, 11707, 63, 12658, 395, 267, 413, 12, 267, 298, 4313, 27165, 1077, 1172, 1373, 3421, 2122, 272, 776, 339, 15764, 275, 511, 14, 3065, 604, 63, 396, 63, 888, 459, 4148, 418, 272, 511, 14, 629, 8, 267, 11261, 63, 12658, 59, 16, 2733, 4148, 995, 267, 15764, 12, 267, 298, 4313, 27165, 1077, 1172, 1373, 3421, 315, 298, 435, 620, 8, 4148, 9, 272, 776, 339, 372, 1072, 12, 6008, 63, 835, 421, 199, 533, 2186, 2980, 8, 785, 304, 339, 347, 636, 826, 721, 277, 304, 267, 986, 339, 347, 664, 63, 2227, 8, 277, 304, 267, 372, 298, 1726, 2980, 2, 339, 347, 636, 1661, 721, 277, 304, 267, 372, 291, 339, 347, 2163, 8, 277, 304, 267, 959, 1182, 378, 339, 347, 636, 2184, 721, 277, 304, 267, 959, 1182, 378, 421, 199, 32, 14237, 199, 318, 6391, 63, 513, 63, 1574, 837, 272, 2269, 63, 694, 275, 6391, 63, 513, 14, 13554, 63, 4924, 51, 63, 3022, 272, 892, 63, 694, 275, 5549, 14, 11983, 342, 272, 862, 26, 267, 367, 15488, 315, 747, 14, 7374, 8, 1753, 63, 694, 304, 288, 5145, 14, 29296, 8, 736, 14, 515, 14, 904, 8, 1753, 63, 694, 12, 15488, 395, 1169, 747, 14, 515, 14, 904, 8, 1222, 63, 694, 12, 15488, 430, 288, 543, 3371, 14, 785, 8, 4416, 63, 513, 12, 283, 13554, 63, 4924, 51, 63, 3022, 297, 892, 63, 694, 395, 971, 490, 3371, 14, 785, 8, 4416, 63, 513, 12, 283, 4941, 63, 1574, 297, 715, 12, 639, 1218, 29, 549, 304, 355, 1995, 272, 3753, 26, 267, 5145, 14, 9242, 8, 1222, 63, 694, 12, 715, 9, 421, 199, 318, 1050, 63, 4416, 63, 576, 8, 525, 83, 12, 21812, 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, 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 ]
mastizada/pontoon
pontoon/base/migrations/0002_initial_data.py
2
30009
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.conf import settings from django.db import migrations def load_initial_data(apps, schema_editor): Locale = apps.get_model('base', 'Locale') for locale_kwargs in LOCALES: Locale.objects.create(**locale_kwargs) Project = apps.get_model('base', 'Project') project = Project.objects.create( name='Pontoon Intro', slug='pontoon-intro', url=settings.SITE_URL + '/intro/', links=True, repository_type='git', repository_url='https://github.com/mozilla/pontoon-intro.git', info_brief=('This is a demo website, used for demonstration purposes ' 'only. You can translate on the website itself by double ' 'clicking on page elements. Access to advanced features ' 'like translation memory and machine translation is ' 'available by clicking on the menu icon in the top-left ' 'corner.') ) # The "historical" version of the Project model that this migration # uses has trouble working with the ManyToManyField on the Project # model. Our workaround is to use the auto-generated intermediate # model directly to create the relation between project and locales. locale = Locale.objects.get(code='en-GB') Project.locales.through.objects.create(project_id=project.id, locale_id=locale.id) class Migration(migrations.Migration): dependencies = [ ('base', '0001_initial'), ] operations = [ migrations.RunPython(load_initial_data), ] LOCALES = [ { u'code': u'af', u'name': u'Afrikaans', u'nplurals': u'2', u'plural_rule': u'(n != 1)' }, { u'code': u'af-ZA', u'name': u'Afrikaans' }, { u'code': u'ak', u'name': u'Akan', u'nplurals': u'2', u'plural_rule': u'(n > 1)' }, { u'code': u'sq', u'name': u'Albanian', u'nplurals': u'2', u'plural_rule': u'(n != 1)' }, { u'code': u'sq-AL', u'name': u'Albanian' }, { u'code': u'aln', u'name': u'Albanian Gheg' }, { u'code': u'am', u'name': u'Amharic', u'nplurals': u'2', u'plural_rule': u'(n > 1)' }, { u'code': u'am-ET', u'name': u'Amharic' }, { u'code': u'ar', u'name': u'Arabic', u'nplurals': u'6', u'plural_rule': u'(n==0 ? 0 : n==1 ? 1 : n==2 ? 2 : n%100>=3 && n%100<=10 ? 3 : n%100>=11 ? 4 : 5)' }, { u'code': u'ar-SA', u'name': u'Arabic' }, { u'code': u'an', u'name': u'Aragonese', u'nplurals': u'2', u'plural_rule': u'(n != 1)' }, { u'code': u'hy', u'name': u'Armenian', u'nplurals': u'2', u'plural_rule': u'(n != 1)' }, { u'code': u'hy-AM', u'name': u'Armenian' }, { u'code': u'as', u'name': u'Assamese' }, { u'code': u'as-IN', u'name': u'Assamese' }, { u'code': u'ast', u'name': u'Asturian', u'nplurals': u'2', u'plural_rule': u'(n != 1)' }, { u'code': u'az', u'name': u'Azerbaijani', u'nplurals': u'2', u'plural_rule': u'(n != 1)' }, { u'code': u'az-AZ', u'name': u'Azerbaijani' }, { u'code': u'bal', u'name': u'Balochi' }, { u'code': u'eu', u'name': u'Basque', u'nplurals': u'2', u'plural_rule': u'(n != 1)' }, { u'code': u'eu-ES', u'name': u'Basque' }, { u'code': u'be', u'name': u'Belarusian', u'nplurals': u'3', u'plural_rule': u'(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2)' }, { u'code': u'be-BY', u'name': u'Belarusian' }, { u'code': u'be@tarask', u'name': u'Belarusian' }, { u'code': u'bn', u'name': u'Bengali', u'nplurals': u'2', u'plural_rule': u'(n != 1)' }, { u'code': u'bn-BD', u'name': u'Bengali', u'nplurals': u'2', u'plural_rule': u'(n != 1)' }, { u'code': u'bn-IN', u'name': u'Bengali', u'nplurals': u'2', u'plural_rule': u'(n != 1)' }, { u'code': u'bs', u'name': u'Bosnian', u'nplurals': u'3', u'plural_rule': u'(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2)' }, { u'code': u'bs-BA', u'name': u'Bosnian' }, { u'code': u'br', u'name': u'Breton', u'nplurals': u'2', u'plural_rule': u'(n > 1)' }, { u'code': u'bg', u'name': u'Bulgarian', u'nplurals': u'2', u'plural_rule': u'(n != 1)' }, { u'code': u'bg-BG', u'name': u'Bulgarian' }, { u'code': u'my', u'name': u'Burmese', u'nplurals': u'1', u'plural_rule': u'0' }, { u'code': u'my-MM', u'name': u'Burmese' }, { u'code': u'ca', u'name': u'Catalan', u'nplurals': u'2', u'plural_rule': u'(n != 1)' }, { u'code': u'ca-ES', u'name': u'Catalan' }, { u'code': u'ca@valencia', u'name': u'Catalan' }, { u'code': u'hne', u'name': u'Chhattisgarhi', u'nplurals': u'2', u'plural_rule': u'(n != 1)' }, { u'code': u'zh', u'name': u'Chinese', u'nplurals': u'2', u'plural_rule': u'(n > 1)' }, { u'code': u'zh-CN', u'name': u'Chinese', u'nplurals': u'2', u'plural_rule': u'(n > 1)' }, { u'code': u'zh-CN.GB2312', u'name': u'Chinese' }, { u'code': u'zh-HK', u'name': u'Chinese', u'nplurals': u'2', u'plural_rule': u'(n > 1)' }, { u'code': u'zh-TW', u'name': u'Chinese', u'nplurals': u'2', u'plural_rule': u'(n > 1)' }, { u'code': u'zh-TW.Big5', u'name': u'Chinese' }, { u'code': u'kw', u'name': u'Cornish', u'nplurals': u'4', u'plural_rule': u'(n==1) ? 0 : (n==2) ? 1 : (n == 3) ? 2 : 3' }, { u'code': u'crh', u'name': u'Crimean Turkish' }, { u'code': u'hr', u'name': u'Croatian', u'nplurals': u'3', u'plural_rule': u'(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2)' }, { u'code': u'hr-HR', u'name': u'Croatian' }, { u'code': u'cs', u'name': u'Czech', u'nplurals': u'3', u'plural_rule': u'(n==1) ? 0 : (n>=2 && n<=4) ? 1 : 2' }, { u'code': u'cs-CZ', u'name': u'Czech' }, { u'code': u'da', u'name': u'Danish', u'nplurals': u'2', u'plural_rule': u'(n != 1)' }, { u'code': u'da-DK', u'name': u'Danish' }, { u'code': u'nl', u'name': u'Dutch', u'nplurals': u'2', u'plural_rule': u'(n != 1)' }, { u'code': u'nl-BE', u'name': u'Dutch' }, { u'code': u'nl-NL', u'name': u'Dutch' }, { u'code': u'dz', u'name': u'Dzongkha', u'nplurals': u'1', u'plural_rule': u'0' }, { u'code': u'dz-BT', u'name': u'Dzongkha' }, { u'code': u'en', u'name': u'English', u'nplurals': u'2', u'plural_rule': u'(n != 1)' }, { u'code': u'en-AU', u'name': u'English', u'nplurals': u'2', u'plural_rule': u'(n != 1)' }, { u'code': u'en-CA', u'name': u'English', u'nplurals': u'2', u'plural_rule': u'(n != 1)' }, { u'code': u'en-IE', u'name': u'English', u'nplurals': u'2', u'plural_rule': u'(n != 1)' }, { u'code': u'en-ZA', u'name': u'English', u'nplurals': u'2', u'plural_rule': u'(n != 1)' }, { u'code': u'en-GB', u'name': u'English', u'nplurals': u'2', u'plural_rule': u'(n != 1)' }, { u'code': u'en-US', u'name': u'English', u'nplurals': u'2', u'plural_rule': u'(n != 1)' }, { u'code': u'eo', u'name': u'Esperanto', u'nplurals': u'2', u'plural_rule': u'(n != 1)' }, { u'code': u'et', u'name': u'Estonian', u'nplurals': u'2', u'plural_rule': u'(n != 1)' }, { u'code': u'et-EE', u'name': u'Estonian' }, { u'code': u'fo', u'name': u'Faroese', u'nplurals': u'2', u'plural_rule': u'(n != 1)' }, { u'code': u'fo-FO', u'name': u'Faroese' }, { u'code': u'fil', u'name': u'Filipino', u'nplurals': u'2', u'plural_rule': u'(n > 1)' }, { u'code': u'fi', u'name': u'Finnish', u'nplurals': u'2', u'plural_rule': u'(n != 1)' }, { u'code': u'fi-FI', u'name': u'Finnish' }, { u'code': u'frp', u'name': u'Franco-Proven\xe7al' }, { u'code': u'fr', u'name': u'French', u'nplurals': u'2', u'plural_rule': u'(n > 1)' }, { u'code': u'fr-CA', u'name': u'French' }, { u'code': u'fr-FR', u'name': u'French' }, { u'code': u'fr-CH', u'name': u'French' }, { u'code': u'fur', u'name': u'Friulian', u'nplurals': u'2', u'plural_rule': u'(n != 1)' }, { u'code': u'ff', u'name': u'Fulah', u'nplurals': u'2', u'plural_rule': u'(n != 1)' }, { u'code': u'gd', u'name': u'Gaelic, Scottish', u'nplurals': u'4', u'plural_rule': u'(n==1 || n==11) ? 0 : (n==2 || n==12) ? 1 : (n > 2 && n < 20) ? 2 : 3' }, { u'code': u'gl', u'name': u'Galician', u'nplurals': u'2', u'plural_rule': u'(n != 1)' }, { u'code': u'gl-ES', u'name': u'Galician' }, { u'code': u'ka', u'name': u'Georgian', u'nplurals': u'1', u'plural_rule': u'0' }, { u'code': u'ka-GE', u'name': u'Georgian' }, { u'code': u'de', u'name': u'German', u'nplurals': u'2', u'plural_rule': u'(n != 1)' }, { u'code': u'de-DE', u'name': u'German' }, { u'code': u'de-CH', u'name': u'German' }, { u'code': u'el', u'name': u'Greek', u'nplurals': u'2', u'plural_rule': u'(n != 1)' }, { u'code': u'el-GR', u'name': u'Greek' }, { u'code': u'gu', u'name': u'Gujarati', u'nplurals': u'2', u'plural_rule': u'(n != 1)' }, { u'code': u'gu-IN', u'name': u'Gujarati', u'nplurals': u'2', u'plural_rule': u'(n != 1)' }, { u'code': u'gun', u'name': u'Gun', u'nplurals': u'2', u'plural_rule': u'(n > 1)' }, { u'code': u'ht', u'name': u'Haitian', u'nplurals': u'2', u'plural_rule': u'(n != 1)' }, { u'code': u'ht-HT', u'name': u'Haitian' }, { u'code': u'ha', u'name': u'Hausa', u'nplurals': u'2', u'plural_rule': u'(n != 1)' }, { u'code': u'he', u'name': u'Hebrew', u'nplurals': u'2', u'plural_rule': u'(n != 1)' }, { u'code': u'he-IL', u'name': u'Hebrew' }, { u'code': u'hi', u'name': u'Hindi', u'nplurals': u'2', u'plural_rule': u'(n != 1)' }, { u'code': u'hi-IN', u'name': u'Hindi', u'nplurals': u'2', u'plural_rule': u'(n != 1)' }, { u'code': u'hu', u'name': u'Hungarian', u'nplurals': u'2', u'plural_rule': u'(n != 1)' }, { u'code': u'hu-HU', u'name': u'Hungarian' }, { u'code': u'is', u'name': u'Icelandic', u'nplurals': u'2', u'plural_rule': u'(n%10!=1 || n%100==11)' }, { u'code': u'is-IS', u'name': u'Icelandic' }, { u'code': u'ig', u'name': u'Igbo' }, { u'code': u'ilo', u'name': u'Iloko' }, { u'code': u'id', u'name': u'Indonesian', u'nplurals': u'1', u'plural_rule': u'0' }, { u'code': u'id-ID', u'name': u'Indonesian' }, { u'code': u'ia', u'name': u'Interlingua', u'nplurals': u'2', u'plural_rule': u'(n != 1)' }, { u'code': u'ga', u'name': u'Irish', u'nplurals': u'5', u'plural_rule': u'n==1 ? 0 : n==2 ? 1 : n<7 ? 2 : n<11 ? 3 : 4' }, { u'code': u'ga-IE', u'name': u'Irish' }, { u'code': u'it', u'name': u'Italian', u'nplurals': u'2', u'plural_rule': u'(n != 1)' }, { u'code': u'it-IT', u'name': u'Italian' }, { u'code': u'ja', u'name': u'Japanese', u'nplurals': u'1', u'plural_rule': u'0' }, { u'code': u'ja-JP', u'name': u'Japanese' }, { u'code': u'jv', u'name': u'Javanese', u'nplurals': u'2', u'plural_rule': u'(n != 0)' }, { u'code': u'kn', u'name': u'Kannada', u'nplurals': u'2', u'plural_rule': u'(n != 1)' }, { u'code': u'kn-IN', u'name': u'Kannada' }, { u'code': u'ks', u'name': u'Kashmiri' }, { u'code': u'ks-IN', u'name': u'Kashmiri' }, { u'code': u'csb', u'name': u'Kashubian', u'nplurals': u'3', u'plural_rule': u'(n==1 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2)' }, { u'code': u'kk', u'name': u'Kazakh', u'nplurals': u'1', u'plural_rule': u'0' }, { u'code': u'kk-KZ', u'name': u'Kazakh' }, { u'code': u'km', u'name': u'Khmer', u'nplurals': u'1', u'plural_rule': u'0' }, { u'code': u'km-KH', u'name': u'Khmer' }, { u'code': u'rw', u'name': u'Kinyarwanda', u'nplurals': u'2', u'plural_rule': u'(n != 1)' }, { u'code': u'ky', u'name': u'Kirgyz', u'nplurals': u'1', u'plural_rule': u'0' }, { u'code': u'tlh', u'name': u'Klingon' }, { u'code': u'ko', u'name': u'Korean', u'nplurals': u'1', u'plural_rule': u'0' }, { u'code': u'ko-KR', u'name': u'Korean' }, { u'code': u'ku', u'name': u'Kurdish', u'nplurals': u'2', u'plural_rule': u'(n != 1)' }, { u'code': u'ku-IQ', u'name': u'Kurdish' }, { u'code': u'lo', u'name': u'Lao', u'nplurals': u'1', u'plural_rule': u'0' }, { u'code': u'lo-LA', u'name': u'Lao' }, { u'code': u'la', u'name': u'Latin' }, { u'code': u'lv', u'name': u'Latvian', u'nplurals': u'3', u'plural_rule': u'(n%10==1 && n%100!=11 ? 0 : n != 0 ? 1 : 2)' }, { u'code': u'lv-LV', u'name': u'Latvian' }, { u'code': u'lij', u'name': u'Ligurian', u'nplurals': u'2', u'plural_rule': u'(n != 1)' }, { u'code': u'li', u'name': u'Limburgian' }, { u'code': u'ln', u'name': u'Lingala', u'nplurals': u'2', u'plural_rule': u'(n > 1)' }, { u'code': u'lt', u'name': u'Lithuanian', u'nplurals': u'3', u'plural_rule': u'(n%10==1 && n%100!=11 ? 0 : n%10>=2 && (n%100<10 or n%100>=20) ? 1 : 2)' }, { u'code': u'lt-LT', u'name': u'Lithuanian' }, { u'code': u'nds', u'name': u'Low German' }, { u'code': u'lb', u'name': u'Luxembourgish', u'nplurals': u'2', u'plural_rule': u'(n != 1)' }, { u'code': u'mk', u'name': u'Macedonian', u'nplurals': u'2', u'plural_rule': u'(n==1 || n%10==1 ? 0 : 1)' }, { u'code': u'mk-MK', u'name': u'Macedonian' }, { u'code': u'mai', u'name': u'Maithili', u'nplurals': u'2', u'plural_rule': u'(n != 1)' }, { u'code': u'mg', u'name': u'Malagasy', u'nplurals': u'2', u'plural_rule': u'(n > 1)' }, { u'code': u'ms', u'name': u'Malay', u'nplurals': u'1', u'plural_rule': u'0' }, { u'code': u'ml', u'name': u'Malayalam', u'nplurals': u'2', u'plural_rule': u'(n != 1)' }, { u'code': u'ml-IN', u'name': u'Malayalam' }, { u'code': u'ms-MY', u'name': u'Malay' }, { u'code': u'mt', u'name': u'Maltese', u'nplurals': u'4', u'plural_rule': u'(n==1 ? 0 : n==0 || ( n%100>1 && n%100<11) ? 1 : (n%100>10 && n%100<20 ) ? 2 : 3)' }, { u'code': u'mt-MT', u'name': u'Maltese' }, { u'code': u'mi', u'name': u'Maori', u'nplurals': u'2', u'plural_rule': u'(n > 1)' }, { u'code': u'arn', u'name': u'Mapudungun', u'nplurals': u'2', u'plural_rule': u'(n > 1)' }, { u'code': u'mr', u'name': u'Marathi', u'nplurals': u'2', u'plural_rule': u'(n != 1)' }, { u'code': u'mr-IN', u'name': u'Marathi' }, { u'code': u'mn', u'name': u'Mongolian', u'nplurals': u'2', u'plural_rule': u'(n != 1)' }, { u'code': u'mn-MN', u'name': u'Mongolian' }, { u'code': u'nah', u'name': u'Nahuatl', u'nplurals': u'2', u'plural_rule': u'(n != 1)' }, { u'code': u'nr', u'name': u'Ndebele, South' }, { u'code': u'nap', u'name': u'Neapolitan', u'nplurals': u'2', u'plural_rule': u'(n != 1)' }, { u'code': u'ne', u'name': u'Nepali', u'nplurals': u'2', u'plural_rule': u'(n != 1)' }, { u'code': u'ne-NP', u'name': u'Nepali' }, { u'code': u'se', u'name': u'Northern Sami', u'nplurals': u'2', u'plural_rule': u'(n != 1)' }, { u'code': u'nso', u'name': u'Northern Sotho', u'nplurals': u'2', u'plural_rule': u'(n != 1)' }, { u'code': u'no', u'name': u'Norwegian', u'nplurals': u'2', u'plural_rule': u'(n != 1)' }, { u'code': u'nb', u'name': u'Norwegian Bokm\xe5l', u'nplurals': u'2', u'plural_rule': u'(n != 1)' }, { u'code': u'nb-NO', u'name': u'Norwegian Bokm\xe5l' }, { u'code': u'no-NO', u'name': u'Norwegian' }, { u'code': u'nn', u'name': u'Norwegian Nynorsk', u'nplurals': u'2', u'plural_rule': u'(n != 1)' }, { u'code': u'nn-NO', u'name': u'Norwegian Nynorsk' }, { u'code': u'oc', u'name': u'Occitan', u'nplurals': u'2', u'plural_rule': u'(n > 1)' }, { u'code': u'or', u'name': u'Oriya', u'nplurals': u'2', u'plural_rule': u'(n != 1)' }, { u'code': u'or-IN', u'name': u'Oriya' }, { u'code': u'pa', u'name': u'Panjabi', u'nplurals': u'2', u'plural_rule': u'(n != 1)' }, { u'code': u'pa-IN', u'name': u'Panjabi' }, { u'code': u'pap', u'name': u'Papiamento', u'nplurals': u'2', u'plural_rule': u'(n != 1)' }, { u'code': u'fa', u'name': u'Persian', u'nplurals': u'1', u'plural_rule': u'0' }, { u'code': u'fa-IR', u'name': u'Persian' }, { u'code': u'pms', u'name': u'Piemontese', u'nplurals': u'2', u'plural_rule': u'(n != 1)' }, { u'code': u'pl', u'name': u'Polish', u'nplurals': u'3', u'plural_rule': u'(n==1 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2)' }, { u'code': u'pl-PL', u'name': u'Polish' }, { u'code': u'pt', u'name': u'Portuguese', u'nplurals': u'2', u'plural_rule': u'(n != 1)' }, { u'code': u'pt-BR', u'name': u'Portuguese', u'nplurals': u'2', u'plural_rule': u'(n > 1)' }, { u'code': u'pt-PT', u'name': u'Portuguese' }, { u'code': u'ps', u'name': u'Pushto', u'nplurals': u'2', u'plural_rule': u'(n != 1)' }, { u'code': u'ro', u'name': u'Romanian', u'nplurals': u'3', u'plural_rule': u'(n==1 ? 0 : (n==0 || (n%100 > 0 && n%100 < 20)) ? 1 : 2)' }, { u'code': u'ro-RO', u'name': u'Romanian' }, { u'code': u'rm', u'name': u'Romansh', u'nplurals': u'2', u'plural_rule': u'(n != 1)' }, { u'code': u'ru', u'name': u'Russian', u'nplurals': u'3', u'plural_rule': u'(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2)' }, { u'code': u'ru-RU', u'name': u'Russian' }, { u'code': u'sm', u'name': u'Samoan' }, { u'code': u'sc', u'name': u'Sardinian' }, { u'code': u'sco', u'name': u'Scots', u'nplurals': u'2', u'plural_rule': u'(n != 1)' }, { u'code': u'sr', u'name': u'Serbian', u'nplurals': u'3', u'plural_rule': u'(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2)' }, { u'code': u'sr@latin', u'name': u'Serbian', u'nplurals': u'3', u'plural_rule': u'(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2)' }, { u'code': u'sr-RS@latin', u'name': u'Serbian' }, { u'code': u'sr-RS', u'name': u'Serbian' }, { u'code': u'sn', u'name': u'Shona' }, { u'code': u'si', u'name': u'Sinhala', u'nplurals': u'2', u'plural_rule': u'(n != 1)' }, { u'code': u'si-LK', u'name': u'Sinhala' }, { u'code': u'sk', u'name': u'Slovak', u'nplurals': u'3', u'plural_rule': u'(n==1) ? 0 : (n>=2 && n<=4) ? 1 : 2' }, { u'code': u'sk-SK', u'name': u'Slovak' }, { u'code': u'sl', u'name': u'Slovenian', u'nplurals': u'4', u'plural_rule': u'(n%100==1 ? 0 : n%100==2 ? 1 : n%100==3 || n%100==4 ? 2 : 3)' }, { u'code': u'sl-SI', u'name': u'Slovenian', u'nplurals': u'4', u'plural_rule': u'(n%100==1 ? 0 : n%100==2 ? 1 : n%100==3 || n%100==4 ? 2 : 3)' }, { u'code': u'so', u'name': u'Somali', u'nplurals': u'2', u'plural_rule': u'(n != 1)' }, { u'code': u'son', u'name': u'Songhay', u'nplurals': u'2', u'plural_rule': u'(n != 1)' }, { u'code': u'st', u'name': u'Sotho, Southern', u'nplurals': u'2', u'plural_rule': u'(n != 1)' }, { u'code': u'st-ZA', u'name': u'Sotho, Southern' }, { u'code': u'es-AR', u'name': u'Spanish', u'nplurals': u'2', u'plural_rule': u'(n != 1)' }, { u'code': u'es-BO', u'name': u'Spanish' }, { u'code': u'es', u'name': u'Spanish', u'nplurals': u'2', u'plural_rule': u'(n != 1)' }, { u'code': u'es-CL', u'name': u'Spanish', u'nplurals': u'2', u'plural_rule': u'(n != 1)' }, { u'code': u'es-CO', u'name': u'Spanish' }, { u'code': u'es-CR', u'name': u'Spanish' }, { u'code': u'es-DO', u'name': u'Spanish' }, { u'code': u'es-EC', u'name': u'Spanish' }, { u'code': u'es-SV', u'name': u'Spanish' }, { u'code': u'es-MX', u'name': u'Spanish', u'nplurals': u'2', u'plural_rule': u'(n != 1)' }, { u'code': u'es-NI', u'name': u'Spanish' }, { u'code': u'es-PA', u'name': u'Spanish' }, { u'code': u'es-PY', u'name': u'Spanish' }, { u'code': u'es-PE', u'name': u'Spanish' }, { u'code': u'es-PR', u'name': u'Spanish' }, { u'code': u'es-ES', u'name': u'Spanish' }, { u'code': u'es-UY', u'name': u'Spanish' }, { u'code': u'es-VE', u'name': u'Spanish' }, { u'code': u'su', u'name': u'Sundanese', u'nplurals': u'1', u'plural_rule': u'0' }, { u'code': u'sw', u'name': u'Swahili', u'nplurals': u'2', u'plural_rule': u'(n != 1)' }, { u'code': u'sw-KE', u'name': u'Swahili' }, { u'code': u'sv', u'name': u'Swedish', u'nplurals': u'2', u'plural_rule': u'(n != 1)' }, { u'code': u'sv-FI', u'name': u'Swedish' }, { u'code': u'sv-SE', u'name': u'Swedish', u'nplurals': u'2', u'plural_rule': u'(n != 1)' }, { u'code': u'tl', u'name': u'Tagalog' }, { u'code': u'tl-PH', u'name': u'Tagalog' }, { u'code': u'tg', u'name': u'Tajik', u'nplurals': u'2', u'plural_rule': u'(n > 1)' }, { u'code': u'tg-TJ', u'name': u'Tajik' }, { u'code': u'ta', u'name': u'Tamil', u'nplurals': u'2', u'plural_rule': u'(n != 1)' }, { u'code': u'ta-IN', u'name': u'Tamil', u'nplurals': u'2', u'plural_rule': u'(n != 1)' }, { u'code': u'ta-LK', u'name': u'Tamil' }, { u'code': u'tt', u'name': u'Tatar', u'nplurals': u'1', u'plural_rule': u'0' }, { u'code': u'te', u'name': u'Telugu', u'nplurals': u'2', u'plural_rule': u'(n != 1)' }, { u'code': u'te-IN', u'name': u'Telugu' }, { u'code': u'th', u'name': u'Thai', u'nplurals': u'1', u'plural_rule': u'0' }, { u'code': u'th-TH', u'name': u'Thai' }, { u'code': u'bo', u'name': u'Tibetan', u'nplurals': u'1', u'plural_rule': u'0' }, { u'code': u'bo-CN', u'name': u'Tibetan' }, { u'code': u'ti', u'name': u'Tigrinya', u'nplurals': u'2', u'plural_rule': u'(n > 1)' }, { u'code': u'to', u'name': u'Tongan' }, { u'code': u'tr', u'name': u'Turkish', u'nplurals': u'2', u'plural_rule': u'(n > 1)' }, { u'code': u'tr-TR', u'name': u'Turkish' }, { u'code': u'tk', u'name': u'Turkmen', u'nplurals': u'2', u'plural_rule': u'(n != 1)' }, { u'code': u'ug', u'name': u'Uighur', u'nplurals': u'1', u'plural_rule': u'0' }, { u'code': u'uk', u'name': u'Ukrainian', u'nplurals': u'3', u'plural_rule': u'(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2)' }, { u'code': u'uk-UA', u'name': u'Ukrainian' }, { u'code': u'hsb', u'name': u'Upper Sorbian', u'nplurals': u'4', u'plural_rule': u'(n%100==1 ? 0 : n%100==2 ? 1 : n%100==3 || n%100==4 ? 2 : 3)' }, { u'code': u'ur', u'name': u'Urdu', u'nplurals': u'2', u'plural_rule': u'(n != 1)' }, { u'code': u'ur-PK', u'name': u'Urdu' }, { u'code': u'uz', u'name': u'Uzbek', u'nplurals': u'2', u'plural_rule': u'(n > 1)' }, { u'code': u've', u'name': u'Venda' }, { u'code': u'vi', u'name': u'Vietnamese', u'nplurals': u'1', u'plural_rule': u'0' }, { u'code': u'vi-VN', u'name': u'Vietnamese' }, { u'code': u'vls', u'name': u'Vlaams' }, { u'code': u'wa', u'name': u'Walloon', u'nplurals': u'2', u'plural_rule': u'(n > 1)' }, { u'code': u'cy', u'name': u'Welsh', u'nplurals': u'4', u'plural_rule': u'(n==1) ? 0 : (n==2) ? 1 : (n != 8 && n != 11) ? 2 : 3' }, { u'code': u'cy-GB', u'name': u'Welsh' }, { u'code': u'fy', u'name': u'Western Frisian', u'nplurals': u'2', u'plural_rule': u'(n != 1)' }, { u'code': u'fy-NL', u'name': u'Western Frisian' }, { u'code': u'wo', u'name': u'Wolof', u'nplurals': u'2', u'plural_rule': u'(n != 1)' }, { u'code': u'wo-SN', u'name': u'Wolof' }, { u'code': u'xh', u'name': u'Xhosa', u'nplurals': u'2', u'plural_rule': u'(n != 1)' }, { u'code': u'yi', u'name': u'Yiddish' }, { u'code': u'yo', u'name': u'Yoruba', u'nplurals': u'2', u'plural_rule': u'(n != 1)' }, { u'code': u'zu', u'name': u'Zulu' }, { u'code': u'zu-ZA', u'name': u'Zulu' }, { u'code': u'dsb', u'name': u'Lower Sorbian', u'nplurals': u'4', u'plural_rule': u'(n%100==1 ? 0 : n%100==2 ? 1 : n%100==3 || n%100==4 ? 2 : 3)' }]
bsd-3-clause
[ 3, 1882, 2803, 26, 2774, 13, 24, 1882, 199, 504, 636, 2443, 363, 492, 2649, 63, 5955, 199, 199, 504, 1639, 14, 2190, 492, 2202, 199, 504, 1639, 14, 697, 492, 6180, 421, 199, 318, 2248, 63, 2747, 63, 576, 8, 5181, 12, 4177, 63, 7515, 304, 272, 28298, 275, 8686, 14, 362, 63, 1238, 360, 1095, 297, 283, 20342, 358, 272, 367, 5867, 63, 958, 315, 20639, 654, 26, 267, 28298, 14, 1462, 14, 981, 3682, 5508, 63, 958, 9, 339, 7290, 275, 8686, 14, 362, 63, 1238, 360, 1095, 297, 283, 4761, 358, 272, 2199, 275, 7290, 14, 1462, 14, 981, 8, 267, 536, 534, 48, 26296, 265, 9805, 293, 297, 267, 8889, 534, 678, 475, 265, 13, 18206, 297, 267, 1166, 29, 1751, 14, 7917, 63, 2632, 435, 1994, 18206, 3678, 267, 6220, 29, 549, 12, 267, 7611, 63, 466, 534, 3187, 297, 267, 7611, 63, 633, 534, 2859, 921, 5031, 14, 957, 15, 12102, 15, 678, 475, 265, 13, 18206, 14, 3187, 297, 267, 2256, 63, 19127, 7782, 2765, 365, 282, 14779, 10691, 12, 1202, 367, 23789, 270, 1754, 12901, 283, 490, 283, 2118, 14, 2047, 883, 9028, 641, 314, 10691, 6337, 701, 4270, 283, 490, 283, 4891, 316, 641, 2034, 4008, 14, 11003, 370, 19472, 4534, 283, 490, 283, 2930, 7761, 4402, 436, 6844, 7761, 365, 283, 490, 283, 4561, 701, 8968, 316, 641, 314, 6269, 7016, 315, 314, 2746, 13, 3039, 283, 490, 283, 22605, 2659, 272, 776, 339, 327, 710, 298, 11141, 10611, 2, 1015, 402, 314, 7290, 1402, 626, 642, 8367, 272, 327, 4440, 965, 29616, 6449, 543, 314, 28409, 641, 314, 7290, 272, 327, 1402, 14, 25119, 18092, 365, 370, 675, 314, 2599, 13, 10176, 13197, 272, 327, 1402, 5370, 370, 1218, 314, 5850, 3382, 2199, 436, 24847, 14, 272, 5867, 275, 28298, 14, 1462, 14, 362, 8, 600, 534, 287, 13, 6487, 358, 272, 7290, 14, 24763, 14, 8304, 14, 1462, 14, 981, 8, 1715, 63, 344, 29, 1715, 14, 344, 12, 5867, 63, 344, 29, 5508, 14, 344, 9, 421, 199, 533, 12090, 8, 7685, 14, 9816, 304, 339, 5124, 275, 359, 267, 661, 1095, 297, 283, 4183, 63, 2747, 659, 272, 1622, 339, 5331, 275, 359, 267, 6180, 14, 2540, 4718, 8, 912, 63, 2747, 63, 576, 395, 272, 1622, 421, 199, 7486, 654, 275, 359, 272, 469, 267, 399, 7, 600, 356, 399, 7, 2756, 297, 267, 399, 7, 354, 356, 399, 7, 14799, 322, 7351, 796, 297, 267, 399, 7, 78, 1168, 300, 2551, 356, 399, 7, 18, 297, 267, 399, 7, 10019, 63, 2200, 356, 399, 6774, 78, 1137, 413, 3171, 272, 1660, 272, 469, 267, 399, 7, 600, 356, 399, 7, 2756, 13, 21959, 297, 399, 7, 354, 356, 399, 7, 14799, 322, 7351, 796, 7, 272, 1660, 272, 469, 267, 399, 7, 600, 356, 399, 7, 1151, 297, 267, 399, 7, 354, 356, 399, 7, 33, 29305, 297, 267, 399, 7, 78, 1168, 300, 2551, 356, 399, 7, 18, 297, 267, 399, 7, 10019, 63, 2200, 356, 399, 6774, 78, 690, 413, 3171, 272, 1660, 272, 469, 267, 399, 7, 600, 356, 399, 1159, 81, 297, 267, 399, 7, 354, 356, 399, 7, 2439, 13206, 5653, 297, 267, 399, 7, 78, 1168, 300, 2551, 356, 399, 7, 18, 297, 267, 399, 7, 10019, 63, 2200, 356, 399, 6774, 78, 1137, 413, 3171, 272, 1660, 272, 469, 267, 399, 7, 600, 356, 399, 1159, 81, 13, 748, 297, 399, 7, 354, 356, 399, 7, 2439, 13206, 5653, 7, 272, 1660, 272, 469, 267, 399, 7, 600, 356, 399, 7, 279, 78, 297, 399, 7, 354, 356, 399, 7, 2439, 13206, 5653, 598, 426, 71, 7, 272, 1660, 272, 469, 267, 399, 7, 600, 356, 399, 7, 455, 297, 267, 399, 7, 354, 356, 399, 7, 24566, 8210, 530, 297, 267, 399, 7, 78, 1168, 300, 2551, 356, 399, 7, 18, 297, 267, 399, 7, 10019, 63, 2200, 356, 399, 6774, 78, 690, 413, 3171, 272, 1660, 272, 469, 267, 399, 7, 600, 356, 399, 7, 455, 13, 775, 297, 399, 7, 354, 356, 399, 7, 24566, 8210, 530, 7, 272, 1660, 272, 469, 267, 399, 7, 600, 356, 399, 7, 285, 297, 267, 399, 7, 354, 356, 399, 7, 33, 24176, 297, 267, 399, 7, 78, 1168, 300, 2551, 356, 399, 7, 22, 297, 267, 399, 7, 10019, 63, 2200, 356, 399, 6774, 78, 389, 16, 5805, 378, 520, 302, 389, 17, 5805, 413, 520, 302, 389, 18, 5805, 499, 520, 302, 5, 1960, 8119, 19, 10883, 302, 5, 1960, 12932, 709, 5805, 650, 520, 302, 5, 1960, 8119, 845, 5805, 841, 520, 959, 3171, 272, 1660, 272, 469, 267, 399, 7, 600, 356, 399, 7, 285, 13, 4251, 297, 399, 7, 354, 356, 399, 7, 33, 24176, 7, 272, 1660, 272, 469, 267, 399, 7, 600, 356, 399, 7, 290, 297, 267, 399, 7, 354, 356, 399, 7, 33, 2527, 368, 261, 297, 267, 399, 7, 78, 1168, 300, 2551, 356, 399, 7, 18, 297, 267, 399, 7, 10019, 63, 2200, 356, 399, 6774, 78, 1137, 413, 3171, 272, 1660, 272, 469, 267, 399, 7, 600, 356, 399, 7, 3577, 297, 267, 399, 7, 354, 356, 399, 7, 1596, 22562, 297, 267, 399, 7, 78, 1168, 300, 2551, 356, 399, 7, 18, 297, 267, 399, 7, 10019, 63, 2200, 356, 399, 6774, 78, 1137, 413, 3171, 272, 1660, 272, 469, 267, 399, 7, 600, 356, 399, 7, 3577, 13, 1156, 297, 399, 7, 354, 356, 399, 7, 1596, 22562, 7, 272, 1660, 272, 469, 267, 399, 7, 600, 356, 399, 7, 305, 297, 399, 7, 354, 356, 399, 7, 9824, 313, 261, 7, 272, 1660, 272, 469, 267, 399, 7, 600, 356, 399, 7, 305, 13, 568, 297, 399, 7, 354, 356, 399, 7, 9824, 313, 261, 7, 272, 1660, 272, 469, 267, 399, 7, 600, 356, 399, 7, 1810, 297, 267, 399, 7, 354, 356, 399, 7, 33, 270, 2302, 290, 297, 267, 399, 7, 78, 1168, 300, 2551, 356, 399, 7, 18, 297, 267, 399, 7, 10019, 63, 2200, 356, 399, 6774, 78, 1137, 413, 3171, 272, 1660, 272, 469, 267, 399, 7, 600, 356 ]
[ 1882, 2803, 26, 2774, 13, 24, 1882, 199, 504, 636, 2443, 363, 492, 2649, 63, 5955, 199, 199, 504, 1639, 14, 2190, 492, 2202, 199, 504, 1639, 14, 697, 492, 6180, 421, 199, 318, 2248, 63, 2747, 63, 576, 8, 5181, 12, 4177, 63, 7515, 304, 272, 28298, 275, 8686, 14, 362, 63, 1238, 360, 1095, 297, 283, 20342, 358, 272, 367, 5867, 63, 958, 315, 20639, 654, 26, 267, 28298, 14, 1462, 14, 981, 3682, 5508, 63, 958, 9, 339, 7290, 275, 8686, 14, 362, 63, 1238, 360, 1095, 297, 283, 4761, 358, 272, 2199, 275, 7290, 14, 1462, 14, 981, 8, 267, 536, 534, 48, 26296, 265, 9805, 293, 297, 267, 8889, 534, 678, 475, 265, 13, 18206, 297, 267, 1166, 29, 1751, 14, 7917, 63, 2632, 435, 1994, 18206, 3678, 267, 6220, 29, 549, 12, 267, 7611, 63, 466, 534, 3187, 297, 267, 7611, 63, 633, 534, 2859, 921, 5031, 14, 957, 15, 12102, 15, 678, 475, 265, 13, 18206, 14, 3187, 297, 267, 2256, 63, 19127, 7782, 2765, 365, 282, 14779, 10691, 12, 1202, 367, 23789, 270, 1754, 12901, 283, 490, 283, 2118, 14, 2047, 883, 9028, 641, 314, 10691, 6337, 701, 4270, 283, 490, 283, 4891, 316, 641, 2034, 4008, 14, 11003, 370, 19472, 4534, 283, 490, 283, 2930, 7761, 4402, 436, 6844, 7761, 365, 283, 490, 283, 4561, 701, 8968, 316, 641, 314, 6269, 7016, 315, 314, 2746, 13, 3039, 283, 490, 283, 22605, 2659, 272, 776, 339, 327, 710, 298, 11141, 10611, 2, 1015, 402, 314, 7290, 1402, 626, 642, 8367, 272, 327, 4440, 965, 29616, 6449, 543, 314, 28409, 641, 314, 7290, 272, 327, 1402, 14, 25119, 18092, 365, 370, 675, 314, 2599, 13, 10176, 13197, 272, 327, 1402, 5370, 370, 1218, 314, 5850, 3382, 2199, 436, 24847, 14, 272, 5867, 275, 28298, 14, 1462, 14, 362, 8, 600, 534, 287, 13, 6487, 358, 272, 7290, 14, 24763, 14, 8304, 14, 1462, 14, 981, 8, 1715, 63, 344, 29, 1715, 14, 344, 12, 5867, 63, 344, 29, 5508, 14, 344, 9, 421, 199, 533, 12090, 8, 7685, 14, 9816, 304, 339, 5124, 275, 359, 267, 661, 1095, 297, 283, 4183, 63, 2747, 659, 272, 1622, 339, 5331, 275, 359, 267, 6180, 14, 2540, 4718, 8, 912, 63, 2747, 63, 576, 395, 272, 1622, 421, 199, 7486, 654, 275, 359, 272, 469, 267, 399, 7, 600, 356, 399, 7, 2756, 297, 267, 399, 7, 354, 356, 399, 7, 14799, 322, 7351, 796, 297, 267, 399, 7, 78, 1168, 300, 2551, 356, 399, 7, 18, 297, 267, 399, 7, 10019, 63, 2200, 356, 399, 6774, 78, 1137, 413, 3171, 272, 1660, 272, 469, 267, 399, 7, 600, 356, 399, 7, 2756, 13, 21959, 297, 399, 7, 354, 356, 399, 7, 14799, 322, 7351, 796, 7, 272, 1660, 272, 469, 267, 399, 7, 600, 356, 399, 7, 1151, 297, 267, 399, 7, 354, 356, 399, 7, 33, 29305, 297, 267, 399, 7, 78, 1168, 300, 2551, 356, 399, 7, 18, 297, 267, 399, 7, 10019, 63, 2200, 356, 399, 6774, 78, 690, 413, 3171, 272, 1660, 272, 469, 267, 399, 7, 600, 356, 399, 1159, 81, 297, 267, 399, 7, 354, 356, 399, 7, 2439, 13206, 5653, 297, 267, 399, 7, 78, 1168, 300, 2551, 356, 399, 7, 18, 297, 267, 399, 7, 10019, 63, 2200, 356, 399, 6774, 78, 1137, 413, 3171, 272, 1660, 272, 469, 267, 399, 7, 600, 356, 399, 1159, 81, 13, 748, 297, 399, 7, 354, 356, 399, 7, 2439, 13206, 5653, 7, 272, 1660, 272, 469, 267, 399, 7, 600, 356, 399, 7, 279, 78, 297, 399, 7, 354, 356, 399, 7, 2439, 13206, 5653, 598, 426, 71, 7, 272, 1660, 272, 469, 267, 399, 7, 600, 356, 399, 7, 455, 297, 267, 399, 7, 354, 356, 399, 7, 24566, 8210, 530, 297, 267, 399, 7, 78, 1168, 300, 2551, 356, 399, 7, 18, 297, 267, 399, 7, 10019, 63, 2200, 356, 399, 6774, 78, 690, 413, 3171, 272, 1660, 272, 469, 267, 399, 7, 600, 356, 399, 7, 455, 13, 775, 297, 399, 7, 354, 356, 399, 7, 24566, 8210, 530, 7, 272, 1660, 272, 469, 267, 399, 7, 600, 356, 399, 7, 285, 297, 267, 399, 7, 354, 356, 399, 7, 33, 24176, 297, 267, 399, 7, 78, 1168, 300, 2551, 356, 399, 7, 22, 297, 267, 399, 7, 10019, 63, 2200, 356, 399, 6774, 78, 389, 16, 5805, 378, 520, 302, 389, 17, 5805, 413, 520, 302, 389, 18, 5805, 499, 520, 302, 5, 1960, 8119, 19, 10883, 302, 5, 1960, 12932, 709, 5805, 650, 520, 302, 5, 1960, 8119, 845, 5805, 841, 520, 959, 3171, 272, 1660, 272, 469, 267, 399, 7, 600, 356, 399, 7, 285, 13, 4251, 297, 399, 7, 354, 356, 399, 7, 33, 24176, 7, 272, 1660, 272, 469, 267, 399, 7, 600, 356, 399, 7, 290, 297, 267, 399, 7, 354, 356, 399, 7, 33, 2527, 368, 261, 297, 267, 399, 7, 78, 1168, 300, 2551, 356, 399, 7, 18, 297, 267, 399, 7, 10019, 63, 2200, 356, 399, 6774, 78, 1137, 413, 3171, 272, 1660, 272, 469, 267, 399, 7, 600, 356, 399, 7, 3577, 297, 267, 399, 7, 354, 356, 399, 7, 1596, 22562, 297, 267, 399, 7, 78, 1168, 300, 2551, 356, 399, 7, 18, 297, 267, 399, 7, 10019, 63, 2200, 356, 399, 6774, 78, 1137, 413, 3171, 272, 1660, 272, 469, 267, 399, 7, 600, 356, 399, 7, 3577, 13, 1156, 297, 399, 7, 354, 356, 399, 7, 1596, 22562, 7, 272, 1660, 272, 469, 267, 399, 7, 600, 356, 399, 7, 305, 297, 399, 7, 354, 356, 399, 7, 9824, 313, 261, 7, 272, 1660, 272, 469, 267, 399, 7, 600, 356, 399, 7, 305, 13, 568, 297, 399, 7, 354, 356, 399, 7, 9824, 313, 261, 7, 272, 1660, 272, 469, 267, 399, 7, 600, 356, 399, 7, 1810, 297, 267, 399, 7, 354, 356, 399, 7, 33, 270, 2302, 290, 297, 267, 399, 7, 78, 1168, 300, 2551, 356, 399, 7, 18, 297, 267, 399, 7, 10019, 63, 2200, 356, 399, 6774, 78, 1137, 413, 3171, 272, 1660, 272, 469, 267, 399, 7, 600, 356, 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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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 ]
jonathonwalz/ansible
lib/ansible/modules/network/cumulus/_cl_ports.py
70
7259
#!/usr/bin/python # -*- coding: utf-8 -*- # (c) 2016, Cumulus Networks <[email protected]> # # 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.0', 'status': ['deprecated'], 'supported_by': 'community'} DOCUMENTATION = ''' --- module: cl_ports version_added: "2.1" author: "Cumulus Networks (@CumulusNetworks)" short_description: Configure Cumulus Switch port attributes (ports.conf) deprecated: Deprecated in 2.3. Use M(nclu) instead. description: - Set the initial port attribute defined in the Cumulus Linux ports.conf, file. This module does not do any error checking at the moment. Be careful to not include ports that do not exist on the switch. Carefully read the original ports.conf file for any exceptions or limitations. For more details go the Configure Switch Port Attribute Documentation at U(http://docs.cumulusnetworks.com). options: speed_10g: description: - List of ports to run initial run at 10G. speed_40g: description: - List of ports to run initial run at 40G. speed_4_by_10g: description: - List of 40G ports that will be unganged to run as 4 10G ports. speed_40g_div_4: description: - List of 10G ports that will be ganged to form a 40G port. ''' EXAMPLES = ''' # Use cl_ports module to manage the switch attributes defined in the # ports.conf file on Cumulus Linux ## Unganged port configuration on certain ports - name: configure ports.conf setup cl_ports: speed_4_by_10g: - swp1 - swp32 speed_40g: - swp2-31 ## Unganged port configuration on certain ports - name: configure ports.conf setup cl_ports: speed_4_by_10g: - swp1-3 - swp6 speed_40g: - swp4-5 - swp7-32 ''' RETURN = ''' changed: description: whether the interface was changed returned: changed type: bool sample: True msg: description: human-readable report of success or failure returned: always type: string sample: "interface bond0 config updated" ''' PORTS_CONF = '/etc/cumulus/ports.conf' def hash_existing_ports_conf(module): module.ports_conf_hash = {} if not os.path.exists(PORTS_CONF): return False try: existing_ports_conf = open(PORTS_CONF).readlines() except IOError: error_msg = get_exception() _msg = "Failed to open %s: %s" % (PORTS_CONF, error_msg) module.fail_json(msg=_msg) return # for testing only should return on module.fail_json for _line in existing_ports_conf: _m0 = re.match(r'^(\d+)=(\w+)', _line) if _m0: _portnum = int(_m0.group(1)) _speed = _m0.group(2) module.ports_conf_hash[_portnum] = _speed def generate_new_ports_conf_hash(module): new_ports_conf_hash = {} convert_hash = { 'speed_40g_div_4': '40G/4', 'speed_4_by_10g': '4x10G', 'speed_10g': '10G', 'speed_40g': '40G' } for k in module.params.keys(): port_range = module.params[k] port_setting = convert_hash[k] if port_range: port_range = [x for x in port_range if x] for port_str in port_range: port_range_str = port_str.replace('swp', '').split('-') if len(port_range_str) == 1: new_ports_conf_hash[int(port_range_str[0])] = \ port_setting else: int_range = map(int, port_range_str) portnum_range = range(int_range[0], int_range[1]+1) for i in portnum_range: new_ports_conf_hash[i] = port_setting module.new_ports_hash = new_ports_conf_hash def compare_new_and_old_port_conf_hash(module): ports_conf_hash_copy = module.ports_conf_hash.copy() module.ports_conf_hash.update(module.new_ports_hash) port_num_length = len(module.ports_conf_hash.keys()) orig_port_num_length = len(ports_conf_hash_copy.keys()) if port_num_length != orig_port_num_length: module.fail_json(msg="Port numbering is wrong. \ Too many or two few ports configured") return False elif ports_conf_hash_copy == module.ports_conf_hash: return False return True def make_copy_of_orig_ports_conf(module): if os.path.exists(PORTS_CONF + '.orig'): return try: shutil.copyfile(PORTS_CONF, PORTS_CONF + '.orig') except IOError: error_msg = get_exception() _msg = "Failed to save the original %s: %s" % (PORTS_CONF, error_msg) module.fail_json(msg=_msg) return # for testing only def write_to_ports_conf(module): """ use tempfile to first write out config in temp file then write to actual location. may help prevent file corruption. Ports.conf is a critical file for Cumulus. Don't want to corrupt this file under any circumstance. """ temp = tempfile.NamedTemporaryFile() try: try: temp.write('# Managed By Ansible\n') for k in sorted(module.ports_conf_hash.keys()): port_setting = module.ports_conf_hash[k] _str = "%s=%s\n" % (k, port_setting) temp.write(_str) temp.seek(0) shutil.copyfile(temp.name, PORTS_CONF) except IOError: error_msg = get_exception() module.fail_json( msg="Failed to write to %s: %s" % (PORTS_CONF, error_msg)) finally: temp.close() def main(): module = AnsibleModule( argument_spec=dict( speed_40g_div_4=dict(type='list'), speed_4_by_10g=dict(type='list'), speed_10g=dict(type='list'), speed_40g=dict(type='list') ), required_one_of=[['speed_40g_div_4', 'speed_4_by_10g', 'speed_10g', 'speed_40g']] ) _changed = False hash_existing_ports_conf(module) generate_new_ports_conf_hash(module) if compare_new_and_old_port_conf_hash(module): make_copy_of_orig_ports_conf(module) write_to_ports_conf(module) _changed = True _msg = "/etc/cumulus/ports.conf changed" else: _msg = 'No change in /etc/ports.conf' module.exit_json(changed=_changed, msg=_msg) # import module snippets from ansible.module_utils.basic import * # from ansible.module_utils.urls import * import os import tempfile import shutil if __name__ == '__main__': main()
gpl-3.0
[ 3381, 2647, 15, 1393, 15, 1548, 199, 3, 1882, 2803, 26, 2774, 13, 24, 1882, 199, 199, 3, 334, 67, 9, 7800, 12, 445, 453, 15909, 17138, 665, 301, 13, 2497, 71, 32, 11898, 15909, 7642, 14, 957, 30, 199, 3, 199, 3, 961, 570, 365, 1777, 402, 2622, 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, 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, 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, 8490, 63, 8314, 275, 791, 2343, 63, 1023, 356, 283, 17, 14, 16, 297, 490, 283, 1205, 356, 788, 6667, 995, 490, 283, 4946, 63, 991, 356, 283, 9387, 936, 421, 199, 8948, 275, 1449, 199, 2595, 199, 578, 26, 824, 63, 5203, 199, 1023, 63, 3270, 26, 298, 18, 14, 17, 2, 199, 2502, 26, 298, 35, 453, 15909, 17138, 8593, 35, 453, 15909, 30551, 2924, 199, 3612, 63, 1802, 26, 15453, 445, 453, 15909, 17711, 1844, 3004, 334, 5203, 14, 2190, 9, 199, 6667, 26, 17993, 315, 499, 14, 19, 14, 3645, 603, 8, 78, 1016, 9, 3140, 14, 199, 1802, 26, 272, 446, 2494, 314, 2536, 1844, 2225, 3247, 315, 314, 445, 453, 15909, 10130, 8873, 14, 2190, 12, 489, 570, 14, 961, 859, 1630, 440, 886, 1263, 1125, 7907, 737, 314, 12427, 14, 6423, 25082, 489, 370, 440, 2387, 8873, 626, 886, 440, 2187, 641, 314, 6258, 14, 8790, 1121, 8525, 1586, 314, 489, 3379, 8873, 14, 2190, 570, 367, 1263, 4967, 503, 4204, 14, 489, 2104, 1655, 2436, 2621, 314, 15453, 17711, 10977, 3882, 15249, 737, 489, 738, 8, 1014, 921, 4757, 14, 11898, 15909, 7642, 14, 957, 680, 199, 1419, 26, 272, 8112, 63, 709, 71, 26, 267, 1369, 26, 288, 446, 3820, 402, 8873, 370, 1255, 2536, 1255, 737, 1616, 39, 14, 272, 8112, 63, 2167, 71, 26, 267, 1369, 26, 288, 446, 3820, 402, 8873, 370, 1255, 2536, 1255, 737, 6335, 39, 14, 272, 8112, 63, 20, 63, 991, 63, 709, 71, 26, 267, 1369, 26, 288, 446, 3820, 402, 6335, 39, 8873, 626, 911, 506, 625, 71, 618, 68, 370, 1255, 465, 841, 1616, 39, 8873, 14, 272, 8112, 63, 2167, 71, 63, 3015, 63, 20, 26, 267, 1369, 26, 288, 446, 3820, 402, 1616, 39, 8873, 626, 911, 506, 486, 618, 68, 370, 1824, 282, 6335, 39, 1844, 14, 199, 2344, 199, 8918, 275, 1449, 199, 3, 3645, 824, 63, 5203, 859, 370, 9635, 314, 6258, 3004, 3247, 315, 314, 199, 3, 8873, 14, 2190, 570, 641, 445, 453, 15909, 10130, 199, 199, 309, 1910, 71, 618, 68, 1844, 2897, 641, 9842, 8873, 199, 13, 536, 26, 7908, 8873, 14, 2190, 3272, 523, 824, 63, 5203, 26, 272, 8112, 63, 20, 63, 991, 63, 709, 71, 26, 489, 446, 5584, 80, 17, 489, 446, 5584, 80, 708, 272, 8112, 63, 2167, 71, 26, 489, 446, 5584, 80, 18, 13, 2192, 199, 199, 309, 1910, 71, 618, 68, 1844, 2897, 641, 9842, 8873, 199, 13, 536, 26, 7908, 8873, 14, 2190, 3272, 523, 824, 63, 5203, 26, 272, 8112, 63, 20, 63, 991, 63, 709, 71, 26, 489, 446, 5584, 80, 17, 13, 19, 489, 446, 5584, 80, 22, 272, 8112, 63, 2167, 71, 26, 489, 446, 5584, 80, 20, 13, 21, 489, 446, 5584, 80, 23, 13, 708, 199, 2344, 199, 199, 9677, 275, 1449, 199, 2489, 26, 272, 1369, 26, 3775, 314, 3217, 1990, 2896, 272, 2138, 26, 2896, 272, 730, 26, 2155, 272, 2690, 26, 715, 199, 1328, 26, 272, 1369, 26, 11779, 13, 11875, 3622, 402, 3182, 503, 5988, 272, 2138, 26, 3544, 272, 730, 26, 1059, 272, 2690, 26, 298, 3266, 23119, 16, 1101, 4588, 2, 199, 2344, 199, 199, 3657, 51, 63, 3103, 275, 1994, 6839, 15, 11898, 15909, 15, 5203, 14, 2190, 7, 421, 199, 318, 2631, 63, 5952, 63, 5203, 63, 2190, 8, 578, 304, 272, 859, 14, 5203, 63, 2190, 63, 2227, 275, 1052, 272, 340, 440, 747, 14, 515, 14, 2444, 8, 3657, 51, 63, 3103, 304, 267, 372, 756, 339, 862, 26, 267, 3411, 63, 5203, 63, 2190, 275, 1551, 8, 3657, 51, 63, 3103, 680, 9684, 342, 272, 871, 5925, 26, 267, 1125, 63, 1328, 275, 664, 63, 1971, 342, 267, 485, 1328, 275, 298, 4276, 370, 1551, 450, 83, 26, 450, 83, 2, 450, 334, 3657, 51, 63, 3103, 12, 1125, 63, 1328, 9, 267, 859, 14, 1633, 63, 1001, 8, 1328, 3699, 1328, 9, 267, 372, 327, 367, 5343, 1454, 1077, 372, 641, 859, 14, 1633, 63, 1001, 339, 367, 485, 604, 315, 3411, 63, 5203, 63, 2190, 26, 267, 485, 77, 16, 275, 295, 14, 1431, 8, 82, 31344, 68, 8771, 2687, 60, 87, 14705, 485, 604, 9, 267, 340, 485, 77, 16, 26, 288, 485, 719, 1507, 275, 1109, 1547, 77, 16, 14, 923, 8, 17, 430, 288, 485, 7625, 275, 485, 77, 16, 14, 923, 8, 18, 9, 288, 859, 14, 5203, 63, 2190, 63, 2227, 13040, 719, 1507, 61, 275, 485, 7625, 421, 199, 318, 3550, 63, 1222, 63, 5203, 63, 2190, 63, 2227, 8, 578, 304, 272, 892, 63, 5203, 63, 2190, 63, 2227, 275, 1052, 272, 3957, 63, 2227, 275, 469, 267, 283, 7625, 63, 2167, 71, 63, 3015, 63, 20, 356, 283, 2167, 39, 15, 20, 297, 267, 283, 7625, 63, 20, 63, 991, 63, 709, 71, 356, 283, 20, 88, 709, 39, 297, 267, 283, 7625, 63, 709, 71, 356, 283, 709, 39, 297, 267, 283, 7625, 63, 2167, 71 ]
[ 2647, 15, 1393, 15, 1548, 199, 3, 1882, 2803, 26, 2774, 13, 24, 1882, 199, 199, 3, 334, 67, 9, 7800, 12, 445, 453, 15909, 17138, 665, 301, 13, 2497, 71, 32, 11898, 15909, 7642, 14, 957, 30, 199, 3, 199, 3, 961, 570, 365, 1777, 402, 2622, 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, 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, 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, 8490, 63, 8314, 275, 791, 2343, 63, 1023, 356, 283, 17, 14, 16, 297, 490, 283, 1205, 356, 788, 6667, 995, 490, 283, 4946, 63, 991, 356, 283, 9387, 936, 421, 199, 8948, 275, 1449, 199, 2595, 199, 578, 26, 824, 63, 5203, 199, 1023, 63, 3270, 26, 298, 18, 14, 17, 2, 199, 2502, 26, 298, 35, 453, 15909, 17138, 8593, 35, 453, 15909, 30551, 2924, 199, 3612, 63, 1802, 26, 15453, 445, 453, 15909, 17711, 1844, 3004, 334, 5203, 14, 2190, 9, 199, 6667, 26, 17993, 315, 499, 14, 19, 14, 3645, 603, 8, 78, 1016, 9, 3140, 14, 199, 1802, 26, 272, 446, 2494, 314, 2536, 1844, 2225, 3247, 315, 314, 445, 453, 15909, 10130, 8873, 14, 2190, 12, 489, 570, 14, 961, 859, 1630, 440, 886, 1263, 1125, 7907, 737, 314, 12427, 14, 6423, 25082, 489, 370, 440, 2387, 8873, 626, 886, 440, 2187, 641, 314, 6258, 14, 8790, 1121, 8525, 1586, 314, 489, 3379, 8873, 14, 2190, 570, 367, 1263, 4967, 503, 4204, 14, 489, 2104, 1655, 2436, 2621, 314, 15453, 17711, 10977, 3882, 15249, 737, 489, 738, 8, 1014, 921, 4757, 14, 11898, 15909, 7642, 14, 957, 680, 199, 1419, 26, 272, 8112, 63, 709, 71, 26, 267, 1369, 26, 288, 446, 3820, 402, 8873, 370, 1255, 2536, 1255, 737, 1616, 39, 14, 272, 8112, 63, 2167, 71, 26, 267, 1369, 26, 288, 446, 3820, 402, 8873, 370, 1255, 2536, 1255, 737, 6335, 39, 14, 272, 8112, 63, 20, 63, 991, 63, 709, 71, 26, 267, 1369, 26, 288, 446, 3820, 402, 6335, 39, 8873, 626, 911, 506, 625, 71, 618, 68, 370, 1255, 465, 841, 1616, 39, 8873, 14, 272, 8112, 63, 2167, 71, 63, 3015, 63, 20, 26, 267, 1369, 26, 288, 446, 3820, 402, 1616, 39, 8873, 626, 911, 506, 486, 618, 68, 370, 1824, 282, 6335, 39, 1844, 14, 199, 2344, 199, 8918, 275, 1449, 199, 3, 3645, 824, 63, 5203, 859, 370, 9635, 314, 6258, 3004, 3247, 315, 314, 199, 3, 8873, 14, 2190, 570, 641, 445, 453, 15909, 10130, 199, 199, 309, 1910, 71, 618, 68, 1844, 2897, 641, 9842, 8873, 199, 13, 536, 26, 7908, 8873, 14, 2190, 3272, 523, 824, 63, 5203, 26, 272, 8112, 63, 20, 63, 991, 63, 709, 71, 26, 489, 446, 5584, 80, 17, 489, 446, 5584, 80, 708, 272, 8112, 63, 2167, 71, 26, 489, 446, 5584, 80, 18, 13, 2192, 199, 199, 309, 1910, 71, 618, 68, 1844, 2897, 641, 9842, 8873, 199, 13, 536, 26, 7908, 8873, 14, 2190, 3272, 523, 824, 63, 5203, 26, 272, 8112, 63, 20, 63, 991, 63, 709, 71, 26, 489, 446, 5584, 80, 17, 13, 19, 489, 446, 5584, 80, 22, 272, 8112, 63, 2167, 71, 26, 489, 446, 5584, 80, 20, 13, 21, 489, 446, 5584, 80, 23, 13, 708, 199, 2344, 199, 199, 9677, 275, 1449, 199, 2489, 26, 272, 1369, 26, 3775, 314, 3217, 1990, 2896, 272, 2138, 26, 2896, 272, 730, 26, 2155, 272, 2690, 26, 715, 199, 1328, 26, 272, 1369, 26, 11779, 13, 11875, 3622, 402, 3182, 503, 5988, 272, 2138, 26, 3544, 272, 730, 26, 1059, 272, 2690, 26, 298, 3266, 23119, 16, 1101, 4588, 2, 199, 2344, 199, 199, 3657, 51, 63, 3103, 275, 1994, 6839, 15, 11898, 15909, 15, 5203, 14, 2190, 7, 421, 199, 318, 2631, 63, 5952, 63, 5203, 63, 2190, 8, 578, 304, 272, 859, 14, 5203, 63, 2190, 63, 2227, 275, 1052, 272, 340, 440, 747, 14, 515, 14, 2444, 8, 3657, 51, 63, 3103, 304, 267, 372, 756, 339, 862, 26, 267, 3411, 63, 5203, 63, 2190, 275, 1551, 8, 3657, 51, 63, 3103, 680, 9684, 342, 272, 871, 5925, 26, 267, 1125, 63, 1328, 275, 664, 63, 1971, 342, 267, 485, 1328, 275, 298, 4276, 370, 1551, 450, 83, 26, 450, 83, 2, 450, 334, 3657, 51, 63, 3103, 12, 1125, 63, 1328, 9, 267, 859, 14, 1633, 63, 1001, 8, 1328, 3699, 1328, 9, 267, 372, 327, 367, 5343, 1454, 1077, 372, 641, 859, 14, 1633, 63, 1001, 339, 367, 485, 604, 315, 3411, 63, 5203, 63, 2190, 26, 267, 485, 77, 16, 275, 295, 14, 1431, 8, 82, 31344, 68, 8771, 2687, 60, 87, 14705, 485, 604, 9, 267, 340, 485, 77, 16, 26, 288, 485, 719, 1507, 275, 1109, 1547, 77, 16, 14, 923, 8, 17, 430, 288, 485, 7625, 275, 485, 77, 16, 14, 923, 8, 18, 9, 288, 859, 14, 5203, 63, 2190, 63, 2227, 13040, 719, 1507, 61, 275, 485, 7625, 421, 199, 318, 3550, 63, 1222, 63, 5203, 63, 2190, 63, 2227, 8, 578, 304, 272, 892, 63, 5203, 63, 2190, 63, 2227, 275, 1052, 272, 3957, 63, 2227, 275, 469, 267, 283, 7625, 63, 2167, 71, 63, 3015, 63, 20, 356, 283, 2167, 39, 15, 20, 297, 267, 283, 7625, 63, 20, 63, 991, 63, 709, 71, 356, 283, 20, 88, 709, 39, 297, 267, 283, 7625, 63, 709, 71, 356, 283, 709, 39, 297, 267, 283, 7625, 63, 2167, 71, 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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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 ]
shaufi/odoo
addons/point_of_sale/wizard/pos_confirm.py
343
2403
# -*- coding: utf-8 -*- ############################################################################## # # OpenERP, Open Source Management Solution # Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>). # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as # published by the Free Software Foundation, either version 3 of the # License, or (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. # ############################################################################## from openerp.osv import osv class pos_confirm(osv.osv_memory): _name = 'pos.confirm' _description = 'Post POS Journal Entries' def action_confirm(self, cr, uid, ids, context=None): order_obj = self.pool.get('pos.order') ids = order_obj.search(cr, uid, [('state','=','paid')], context=context) for order in order_obj.browse(cr, uid, ids, context=context): todo = True for line in order.statement_ids: if line.statement_id.state != 'confirm': todo = False break if todo: order.signal_workflow('done') # Check if there is orders to reconcile their invoices ids = order_obj.search(cr, uid, [('state','=','invoiced'),('invoice_id.state','=','open')], context=context) for order in order_obj.browse(cr, uid, ids, context=context): invoice = order.invoice_id data_lines = [x.id for x in invoice.move_id.line_id if x.account_id.id == invoice.account_id.id] for st in order.statement_ids: for move in st.move_ids: data_lines += [x.id for x in move.line_id if x.account_id.id == invoice.account_id.id] self.pool.get('account.move.line').reconcile(cr, uid, data_lines, context=context) return {} # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
agpl-3.0
[ 3, 1882, 2803, 26, 2774, 13, 24, 1882, 199, 4605, 199, 3, 199, 3, 259, 7653, 12, 3232, 5800, 8259, 9274, 199, 3, 259, 1898, 334, 35, 9, 8353, 13, 6542, 11947, 12361, 8642, 1014, 921, 9864, 14, 1235, 10121, 199, 3, 199, 3, 259, 961, 2240, 365, 2867, 2032, 26, 1265, 883, 3604, 652, 436, 15, 269, 2811, 199, 3, 259, 652, 1334, 314, 2895, 402, 314, 1664, 4265, 1696, 1684, 844, 465, 199, 3, 259, 3267, 701, 314, 2868, 2290, 2752, 12, 1902, 1015, 650, 402, 314, 199, 3, 259, 844, 12, 503, 334, 292, 2195, 945, 9, 1263, 2945, 1015, 14, 199, 3, 199, 3, 259, 961, 2240, 365, 1854, 315, 314, 3661, 626, 652, 911, 506, 2997, 12, 199, 3, 259, 1325, 2428, 1821, 3408, 27, 1928, 2755, 314, 2478, 3750, 402, 199, 3, 259, 3169, 503, 3092, 2381, 437, 3115, 3104, 14, 221, 1666, 314, 199, 3, 259, 1664, 4265, 1696, 1684, 844, 367, 1655, 2436, 14, 199, 3, 199, 3, 259, 2047, 1077, 1172, 3086, 282, 1331, 402, 314, 1664, 4265, 1696, 1684, 844, 199, 3, 259, 3180, 543, 642, 2240, 14, 221, 982, 440, 12, 1937, 665, 1014, 921, 1544, 14, 3689, 14, 1308, 15, 2383, 4743, 199, 3, 199, 4605, 199, 199, 504, 5166, 14, 4795, 492, 9506, 421, 199, 533, 2086, 63, 9548, 8, 4795, 14, 4795, 63, 4844, 304, 272, 485, 354, 275, 283, 1712, 14, 9548, 7, 272, 485, 1802, 275, 283, 6564, 510, 3100, 22142, 23450, 1996, 7, 339, 347, 1595, 63, 9548, 8, 277, 12, 2467, 12, 1747, 12, 2762, 12, 1067, 29, 403, 304, 267, 1865, 63, 1113, 275, 291, 14, 2293, 14, 362, 360, 1712, 14, 1648, 358, 267, 2762, 275, 1865, 63, 1113, 14, 1733, 8, 1556, 12, 1747, 12, 4274, 929, 1673, 29511, 16555, 2665, 1067, 29, 1100, 9, 267, 367, 1865, 315, 1865, 63, 1113, 14, 4570, 8, 1556, 12, 1747, 12, 2762, 12, 1067, 29, 1100, 304, 288, 11386, 275, 715, 288, 367, 1004, 315, 1865, 14, 6242, 63, 1580, 26, 355, 340, 1004, 14, 6242, 63, 344, 14, 929, 1137, 283, 9548, 356, 490, 11386, 275, 756, 490, 2059, 288, 340, 11386, 26, 355, 1865, 14, 4653, 63, 8856, 360, 4456, 358, 398, 327, 2670, 340, 2337, 365, 15460, 370, 26053, 441, 3932, 26175, 267, 2762, 275, 1865, 63, 1113, 14, 1733, 8, 1556, 12, 1747, 12, 4274, 929, 1673, 29511, 25614, 8157, 5404, 63, 344, 14, 929, 1673, 29511, 1490, 2665, 1067, 29, 1100, 9, 267, 367, 1865, 315, 1865, 63, 1113, 14, 4570, 8, 1556, 12, 1747, 12, 2762, 12, 1067, 29, 1100, 304, 288, 8485, 275, 1865, 14, 5404, 63, 344, 288, 666, 63, 1278, 275, 359, 88, 14, 344, 367, 671, 315, 8485, 14, 1185, 63, 344, 14, 604, 63, 344, 340, 671, 14, 2048, 63, 344, 14, 344, 508, 8485, 14, 2048, 63, 344, 14, 344, 61, 288, 367, 410, 315, 1865, 14, 6242, 63, 1580, 26, 355, 367, 4057, 315, 410, 14, 1185, 63, 1580, 26, 490, 666, 63, 1278, 847, 359, 88, 14, 344, 367, 671, 315, 4057, 14, 604, 63, 344, 340, 671, 14, 2048, 63, 344, 14, 344, 508, 8485, 14, 2048, 63, 344, 14, 344, 61, 490, 291, 14, 2293, 14, 362, 360, 2048, 14, 1185, 14, 604, 1959, 18403, 8, 1556, 12, 1747, 12, 666, 63, 1278, 12, 1067, 29, 1100, 9, 267, 372, 1052, 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 ]
[ 1882, 2803, 26, 2774, 13, 24, 1882, 199, 4605, 199, 3, 199, 3, 259, 7653, 12, 3232, 5800, 8259, 9274, 199, 3, 259, 1898, 334, 35, 9, 8353, 13, 6542, 11947, 12361, 8642, 1014, 921, 9864, 14, 1235, 10121, 199, 3, 199, 3, 259, 961, 2240, 365, 2867, 2032, 26, 1265, 883, 3604, 652, 436, 15, 269, 2811, 199, 3, 259, 652, 1334, 314, 2895, 402, 314, 1664, 4265, 1696, 1684, 844, 465, 199, 3, 259, 3267, 701, 314, 2868, 2290, 2752, 12, 1902, 1015, 650, 402, 314, 199, 3, 259, 844, 12, 503, 334, 292, 2195, 945, 9, 1263, 2945, 1015, 14, 199, 3, 199, 3, 259, 961, 2240, 365, 1854, 315, 314, 3661, 626, 652, 911, 506, 2997, 12, 199, 3, 259, 1325, 2428, 1821, 3408, 27, 1928, 2755, 314, 2478, 3750, 402, 199, 3, 259, 3169, 503, 3092, 2381, 437, 3115, 3104, 14, 221, 1666, 314, 199, 3, 259, 1664, 4265, 1696, 1684, 844, 367, 1655, 2436, 14, 199, 3, 199, 3, 259, 2047, 1077, 1172, 3086, 282, 1331, 402, 314, 1664, 4265, 1696, 1684, 844, 199, 3, 259, 3180, 543, 642, 2240, 14, 221, 982, 440, 12, 1937, 665, 1014, 921, 1544, 14, 3689, 14, 1308, 15, 2383, 4743, 199, 3, 199, 4605, 199, 199, 504, 5166, 14, 4795, 492, 9506, 421, 199, 533, 2086, 63, 9548, 8, 4795, 14, 4795, 63, 4844, 304, 272, 485, 354, 275, 283, 1712, 14, 9548, 7, 272, 485, 1802, 275, 283, 6564, 510, 3100, 22142, 23450, 1996, 7, 339, 347, 1595, 63, 9548, 8, 277, 12, 2467, 12, 1747, 12, 2762, 12, 1067, 29, 403, 304, 267, 1865, 63, 1113, 275, 291, 14, 2293, 14, 362, 360, 1712, 14, 1648, 358, 267, 2762, 275, 1865, 63, 1113, 14, 1733, 8, 1556, 12, 1747, 12, 4274, 929, 1673, 29511, 16555, 2665, 1067, 29, 1100, 9, 267, 367, 1865, 315, 1865, 63, 1113, 14, 4570, 8, 1556, 12, 1747, 12, 2762, 12, 1067, 29, 1100, 304, 288, 11386, 275, 715, 288, 367, 1004, 315, 1865, 14, 6242, 63, 1580, 26, 355, 340, 1004, 14, 6242, 63, 344, 14, 929, 1137, 283, 9548, 356, 490, 11386, 275, 756, 490, 2059, 288, 340, 11386, 26, 355, 1865, 14, 4653, 63, 8856, 360, 4456, 358, 398, 327, 2670, 340, 2337, 365, 15460, 370, 26053, 441, 3932, 26175, 267, 2762, 275, 1865, 63, 1113, 14, 1733, 8, 1556, 12, 1747, 12, 4274, 929, 1673, 29511, 25614, 8157, 5404, 63, 344, 14, 929, 1673, 29511, 1490, 2665, 1067, 29, 1100, 9, 267, 367, 1865, 315, 1865, 63, 1113, 14, 4570, 8, 1556, 12, 1747, 12, 2762, 12, 1067, 29, 1100, 304, 288, 8485, 275, 1865, 14, 5404, 63, 344, 288, 666, 63, 1278, 275, 359, 88, 14, 344, 367, 671, 315, 8485, 14, 1185, 63, 344, 14, 604, 63, 344, 340, 671, 14, 2048, 63, 344, 14, 344, 508, 8485, 14, 2048, 63, 344, 14, 344, 61, 288, 367, 410, 315, 1865, 14, 6242, 63, 1580, 26, 355, 367, 4057, 315, 410, 14, 1185, 63, 1580, 26, 490, 666, 63, 1278, 847, 359, 88, 14, 344, 367, 671, 315, 4057, 14, 604, 63, 344, 340, 671, 14, 2048, 63, 344, 14, 344, 508, 8485, 14, 2048, 63, 344, 14, 344, 61, 490, 291, 14, 2293, 14, 362, 360, 2048, 14, 1185, 14, 604, 1959, 18403, 8, 1556, 12, 1747, 12, 666, 63, 1278, 12, 1067, 29, 1100, 9, 267, 372, 1052, 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, 0 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
Ziqi-Li/bknqgis
Shapely/tests/test_geos_err_handler.py
2
2033
import logging import pytest from shapely.geometry import LineString from shapely.errors import ReadingError from shapely.wkt import loads def test_error_handler_exception(tmpdir): """Error logged in addition to exception""" logger = logging.getLogger('shapely.geos') logfile = str(tmpdir.join('test_error.log')) fh = logging.FileHandler(logfile) logger.addHandler(fh) # This calls error_handler with a format string of "%s" and one # value. with pytest.raises(ReadingError): loads('POINT (LOLWUT)') log = open(logfile).read() assert "Expected number but encountered word: 'LOLWUT'" in log def test_error_handler(tmpdir): logger = logging.getLogger('shapely.geos') logfile = str(tmpdir.join('test_error.log')) fh = logging.FileHandler(logfile) logger.addHandler(fh) # This operation calls error_handler with a format string that # has *no* conversion specifiers. LineString([(0, 0), (2, 2)]).project(LineString([(1, 1), (1.5, 1.5)])) log = open(logfile).read() assert "third argument of GEOSProject_r must be Point*" in log def test_info_handler(tmpdir): logger = logging.getLogger('shapely.geos') logfile = str(tmpdir.join('test_error.log')) fh = logging.FileHandler(logfile) logger.addHandler(fh) logger.setLevel(logging.INFO) g = loads('MULTIPOLYGON (((10 20, 10 120, 60 70, 30 70, 30 40, 60 40, 60 70, 90 20, 10 20)))') assert not g.is_valid log = open(logfile).read() assert "Ring Self-intersection at or near point 60 70" in log def test_info_handler_quiet(tmpdir): logger = logging.getLogger('shapely.geos') logfile = str(tmpdir.join('test_error.log')) fh = logging.FileHandler(logfile) logger.addHandler(fh) logger.setLevel(logging.WARNING) g = loads('MULTIPOLYGON (((10 20, 10 120, 60 70, 30 70, 30 40, 60 40, 60 70, 90 20, 10 20)))') assert not g.is_valid log = open(logfile).read() assert "Ring Self-intersection at or near point 60 70" not in log
gpl-2.0
[ 646, 2050, 199, 199, 646, 4613, 199, 199, 504, 2215, 590, 14, 7660, 492, 30020, 199, 504, 2215, 590, 14, 2550, 492, 799, 5384, 547, 199, 504, 2215, 590, 14, 11412, 492, 14404, 421, 199, 318, 511, 63, 705, 63, 2232, 63, 1971, 8, 8616, 304, 272, 408, 547, 10367, 315, 10234, 370, 1919, 624, 272, 2512, 275, 2050, 14, 5572, 360, 1392, 590, 14, 12151, 358, 272, 17251, 275, 620, 8, 8616, 14, 904, 360, 396, 63, 705, 14, 793, 1333, 272, 11155, 275, 2050, 14, 21982, 8, 12804, 9, 272, 2512, 14, 18826, 8, 12853, 9, 339, 327, 961, 4882, 1125, 63, 2232, 543, 282, 1475, 1059, 402, 2071, 83, 2, 436, 1373, 272, 327, 574, 14, 272, 543, 4613, 14, 3536, 8, 20568, 547, 304, 267, 14404, 360, 7217, 334, 1484, 20145, 934, 5942, 339, 943, 275, 1551, 8, 12804, 680, 739, 342, 272, 702, 298, 6964, 1329, 1325, 14556, 4349, 26, 283, 1484, 20145, 934, 4065, 315, 943, 421, 199, 318, 511, 63, 705, 63, 2232, 8, 8616, 304, 272, 2512, 275, 2050, 14, 5572, 360, 1392, 590, 14, 12151, 358, 272, 17251, 275, 620, 8, 8616, 14, 904, 360, 396, 63, 705, 14, 793, 1333, 272, 11155, 275, 2050, 14, 21982, 8, 12804, 9, 272, 2512, 14, 18826, 8, 12853, 9, 339, 327, 961, 3439, 4882, 1125, 63, 2232, 543, 282, 1475, 1059, 626, 272, 327, 965, 627, 889, 10, 8603, 29558, 14, 272, 30020, 7694, 16, 12, 378, 395, 334, 18, 12, 499, 3948, 14, 1715, 8, 22134, 7694, 17, 12, 413, 395, 334, 17, 14, 21, 12, 413, 14, 21, 19563, 339, 943, 275, 1551, 8, 12804, 680, 739, 342, 272, 702, 298, 11470, 1423, 402, 11920, 4761, 63, 82, 1471, 506, 7584, 12469, 315, 943, 421, 199, 318, 511, 63, 815, 63, 2232, 8, 8616, 304, 272, 2512, 275, 2050, 14, 5572, 360, 1392, 590, 14, 12151, 358, 272, 17251, 275, 620, 8, 8616, 14, 904, 360, 396, 63, 705, 14, 793, 1333, 272, 11155, 275, 2050, 14, 21982, 8, 12804, 9, 272, 2512, 14, 18826, 8, 12853, 9, 272, 2512, 14, 13548, 8, 4806, 14, 4531, 9, 339, 486, 275, 14404, 360, 21389, 23602, 20337, 709, 3388, 12, 1616, 13960, 12, 5212, 10045, 12, 4233, 10045, 12, 4233, 6335, 12, 5212, 6335, 12, 5212, 10045, 12, 9137, 3388, 12, 1616, 3388, 1724, 358, 272, 702, 440, 486, 14, 374, 63, 1078, 339, 943, 275, 1551, 8, 12804, 680, 739, 342, 272, 702, 298, 15420, 23820, 13, 12569, 737, 503, 17429, 2376, 5212, 10045, 2, 315, 943, 421, 199, 318, 511, 63, 815, 63, 2232, 63, 10243, 8, 8616, 304, 272, 2512, 275, 2050, 14, 5572, 360, 1392, 590, 14, 12151, 358, 272, 17251, 275, 620, 8, 8616, 14, 904, 360, 396, 63, 705, 14, 793, 1333, 272, 11155, 275, 2050, 14, 21982, 8, 12804, 9, 272, 2512, 14, 18826, 8, 12853, 9, 272, 2512, 14, 13548, 8, 4806, 14, 9171, 9, 339, 486, 275, 14404, 360, 21389, 23602, 20337, 709, 3388, 12, 1616, 13960, 12, 5212, 10045, 12, 4233, 10045, 12, 4233, 6335, 12, 5212, 6335, 12, 5212, 10045, 12, 9137, 3388, 12, 1616, 3388, 1724, 358, 272, 702, 440, 486, 14, 374, 63, 1078, 339, 943, 275, 1551, 8, 12804, 680, 739, 342, 272, 702, 298, 15420, 23820, 13, 12569, 737, 503, 17429, 2376, 5212, 10045, 2, 440, 315, 943, 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 ]
[ 2050, 199, 199, 646, 4613, 199, 199, 504, 2215, 590, 14, 7660, 492, 30020, 199, 504, 2215, 590, 14, 2550, 492, 799, 5384, 547, 199, 504, 2215, 590, 14, 11412, 492, 14404, 421, 199, 318, 511, 63, 705, 63, 2232, 63, 1971, 8, 8616, 304, 272, 408, 547, 10367, 315, 10234, 370, 1919, 624, 272, 2512, 275, 2050, 14, 5572, 360, 1392, 590, 14, 12151, 358, 272, 17251, 275, 620, 8, 8616, 14, 904, 360, 396, 63, 705, 14, 793, 1333, 272, 11155, 275, 2050, 14, 21982, 8, 12804, 9, 272, 2512, 14, 18826, 8, 12853, 9, 339, 327, 961, 4882, 1125, 63, 2232, 543, 282, 1475, 1059, 402, 2071, 83, 2, 436, 1373, 272, 327, 574, 14, 272, 543, 4613, 14, 3536, 8, 20568, 547, 304, 267, 14404, 360, 7217, 334, 1484, 20145, 934, 5942, 339, 943, 275, 1551, 8, 12804, 680, 739, 342, 272, 702, 298, 6964, 1329, 1325, 14556, 4349, 26, 283, 1484, 20145, 934, 4065, 315, 943, 421, 199, 318, 511, 63, 705, 63, 2232, 8, 8616, 304, 272, 2512, 275, 2050, 14, 5572, 360, 1392, 590, 14, 12151, 358, 272, 17251, 275, 620, 8, 8616, 14, 904, 360, 396, 63, 705, 14, 793, 1333, 272, 11155, 275, 2050, 14, 21982, 8, 12804, 9, 272, 2512, 14, 18826, 8, 12853, 9, 339, 327, 961, 3439, 4882, 1125, 63, 2232, 543, 282, 1475, 1059, 626, 272, 327, 965, 627, 889, 10, 8603, 29558, 14, 272, 30020, 7694, 16, 12, 378, 395, 334, 18, 12, 499, 3948, 14, 1715, 8, 22134, 7694, 17, 12, 413, 395, 334, 17, 14, 21, 12, 413, 14, 21, 19563, 339, 943, 275, 1551, 8, 12804, 680, 739, 342, 272, 702, 298, 11470, 1423, 402, 11920, 4761, 63, 82, 1471, 506, 7584, 12469, 315, 943, 421, 199, 318, 511, 63, 815, 63, 2232, 8, 8616, 304, 272, 2512, 275, 2050, 14, 5572, 360, 1392, 590, 14, 12151, 358, 272, 17251, 275, 620, 8, 8616, 14, 904, 360, 396, 63, 705, 14, 793, 1333, 272, 11155, 275, 2050, 14, 21982, 8, 12804, 9, 272, 2512, 14, 18826, 8, 12853, 9, 272, 2512, 14, 13548, 8, 4806, 14, 4531, 9, 339, 486, 275, 14404, 360, 21389, 23602, 20337, 709, 3388, 12, 1616, 13960, 12, 5212, 10045, 12, 4233, 10045, 12, 4233, 6335, 12, 5212, 6335, 12, 5212, 10045, 12, 9137, 3388, 12, 1616, 3388, 1724, 358, 272, 702, 440, 486, 14, 374, 63, 1078, 339, 943, 275, 1551, 8, 12804, 680, 739, 342, 272, 702, 298, 15420, 23820, 13, 12569, 737, 503, 17429, 2376, 5212, 10045, 2, 315, 943, 421, 199, 318, 511, 63, 815, 63, 2232, 63, 10243, 8, 8616, 304, 272, 2512, 275, 2050, 14, 5572, 360, 1392, 590, 14, 12151, 358, 272, 17251, 275, 620, 8, 8616, 14, 904, 360, 396, 63, 705, 14, 793, 1333, 272, 11155, 275, 2050, 14, 21982, 8, 12804, 9, 272, 2512, 14, 18826, 8, 12853, 9, 272, 2512, 14, 13548, 8, 4806, 14, 9171, 9, 339, 486, 275, 14404, 360, 21389, 23602, 20337, 709, 3388, 12, 1616, 13960, 12, 5212, 10045, 12, 4233, 10045, 12, 4233, 6335, 12, 5212, 6335, 12, 5212, 10045, 12, 9137, 3388, 12, 1616, 3388, 1724, 358, 272, 702, 440, 486, 14, 374, 63, 1078, 339, 943, 275, 1551, 8, 12804, 680, 739, 342, 272, 702, 298, 15420, 23820, 13, 12569, 737, 503, 17429, 2376, 5212, 10045, 2, 440, 315, 943, 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, 0 ]
[ 1,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0--key/lib
portfolio/Python/scrapy/lego/lego_pixmania.py
2
1987
import csv import os import copy from scrapy.spider import BaseSpider from scrapy.selector import HtmlXPathSelector from scrapy.http import Request, HtmlResponse, FormRequest from scrapy.utils.response import get_base_url from scrapy.utils.url import urljoin_rfc from scrapy.http.cookies import CookieJar from product_spiders.items import Product, ProductLoaderWithNameStrip as ProductLoader HERE = os.path.abspath(os.path.dirname(__file__)) class PixmaniaSpider(BaseSpider): name = 'lego-pixmania.com' allowed_domains = ['pixmania.com'] def start_requests(self): with open(os.path.join(HERE, 'products.csv')) as f: reader = csv.DictReader(f) for row in reader: sku = row['sku'] url = 'http://www.pixmania.com/it/it/search/lego-%s' yield Request(url % sku, meta={'sku': sku}) def parse(self, response): hxs = HtmlXPathSelector(response) products = hxs.select('//tr[@class="prd first"]') if products: pr = None product = products[0] loader = ProductLoader(item=Product(), selector=product) loader.add_xpath('name', './/h3/a/text()') loader.add_xpath('url', './/h3/a/@href') loader.add_value('sku', response.meta['sku']) loader.add_value('price', 0) price = product.select('.//p[@class="prd-amount"]/strong/text()').extract() if price: loader.add_value('price', price[0].replace(',','.')) pr = loader if pr: if price: yield pr.load_item() else: yield Request(pr.get_output_value('url'), callback=self.parse_product,meta={'cur_prod': pr}, dont_filter=True) def parse_product(self, response): hxs = HtmlXPathSelector(response) cur_prod = response.meta['cur_prod'] if not cur_prod.get_output_value('price'): price = hxs.select('.//span[@itemprop="price"]/text()').extract() if price: cur_prod.add_value('price', price[0].replace(',','.')) yield cur_prod.load_item()
apache-2.0
[ 646, 7392, 199, 646, 747, 199, 646, 1331, 199, 199, 504, 18918, 14, 12856, 492, 3523, 25157, 199, 504, 18918, 14, 6662, 492, 20880, 27645, 11212, 199, 504, 18918, 14, 1014, 492, 4784, 12, 20880, 2364, 12, 8204, 2017, 199, 504, 18918, 14, 1208, 14, 1310, 492, 664, 63, 1095, 63, 633, 199, 504, 18918, 14, 1208, 14, 633, 492, 20818, 63, 8973, 199, 504, 18918, 14, 1014, 14, 7792, 492, 25143, 199, 199, 504, 3336, 63, 8721, 7735, 14, 1744, 492, 12705, 12, 12705, 5455, 3007, 985, 21332, 465, 12705, 5455, 199, 199, 5293, 275, 747, 14, 515, 14, 4832, 8, 736, 14, 515, 14, 3475, 3460, 493, 8964, 199, 199, 533, 510, 1148, 1237, 4674, 25157, 8, 1563, 25157, 304, 272, 536, 275, 283, 274, 1939, 13, 6644, 1237, 4674, 14, 957, 7, 272, 4370, 63, 9756, 275, 788, 6644, 1237, 4674, 14, 957, 418, 339, 347, 1343, 63, 6615, 8, 277, 304, 267, 543, 1551, 8, 736, 14, 515, 14, 904, 8, 5293, 12, 283, 13336, 14, 4737, 1333, 465, 289, 26, 288, 7002, 275, 7392, 14, 2141, 5929, 8, 70, 9, 288, 367, 1962, 315, 7002, 26, 355, 2386, 85, 275, 1962, 459, 27772, 418, 355, 1166, 275, 283, 1014, 921, 1544, 14, 6644, 1237, 4674, 14, 957, 15, 390, 15, 390, 15, 1733, 15, 274, 1939, 3295, 83, 7, 355, 1995, 4784, 8, 633, 450, 2386, 85, 12, 3404, 3713, 27772, 356, 2386, 85, 1552, 339, 347, 2198, 8, 277, 12, 1177, 304, 267, 394, 7977, 275, 20880, 27645, 11212, 8, 1310, 9, 267, 7585, 275, 394, 7977, 14, 2416, 15079, 454, 14251, 533, 628, 2700, 68, 1642, 937, 358, 267, 340, 7585, 26, 6722, 5448, 275, 488, 6722, 3336, 275, 7585, 59, 16, 61, 6722, 5077, 275, 12705, 5455, 8, 1053, 29, 5884, 1062, 9759, 29, 2558, 9, 6722, 5077, 14, 525, 63, 8006, 360, 354, 297, 1987, 501, 72, 19, 15, 65, 15, 505, 19004, 288, 5077, 14, 525, 63, 8006, 360, 633, 297, 1987, 501, 72, 19, 15, 65, 15, 32, 6399, 358, 6722, 5077, 14, 525, 63, 585, 360, 27772, 297, 1177, 14, 2024, 459, 27772, 1105, 6722, 5077, 14, 525, 63, 585, 360, 4777, 297, 378, 9, 6722, 8033, 275, 3336, 14, 2416, 29995, 80, 14251, 533, 628, 2700, 68, 13, 4606, 937, 15, 9370, 15, 505, 342, 1959, 5005, 342, 6722, 340, 8033, 26, 507, 198, 3422, 14, 525, 63, 585, 360, 4777, 297, 8033, 59, 16, 1055, 1814, 5102, 26409, 1333, 6722, 5448, 275, 5077, 6722, 340, 5448, 26, 507, 198, 692, 8033, 26, 15075, 1995, 5448, 14, 912, 63, 1053, 342, 507, 198, 2836, 26, 15075, 1995, 4784, 8, 2700, 14, 362, 63, 1199, 63, 585, 360, 633, 659, 3233, 29, 277, 14, 1122, 63, 2558, 12, 2024, 3713, 895, 63, 8788, 356, 5448, 1386, 21542, 63, 1541, 29, 549, 9, 339, 347, 2198, 63, 2558, 8, 277, 12, 1177, 304, 199, 198, 72, 7977, 275, 20880, 27645, 11212, 8, 1310, 9, 199, 198, 895, 63, 8788, 275, 1177, 14, 2024, 459, 895, 63, 8788, 418, 199, 198, 692, 440, 1094, 63, 8788, 14, 362, 63, 1199, 63, 585, 360, 4777, 735, 6722, 8033, 275, 394, 7977, 14, 2416, 29995, 3751, 14251, 73, 808, 2675, 628, 4777, 937, 15, 505, 342, 1959, 5005, 342, 6722, 340, 8033, 26, 507, 198, 895, 63, 8788, 14, 525, 63, 585, 360, 4777, 297, 8033, 59, 16, 1055, 1814, 5102, 26409, 1333, 199, 198, 11481, 1094, 63, 8788, 14, 912, 63, 1053, 342, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768 ]
[ 7392, 199, 646, 747, 199, 646, 1331, 199, 199, 504, 18918, 14, 12856, 492, 3523, 25157, 199, 504, 18918, 14, 6662, 492, 20880, 27645, 11212, 199, 504, 18918, 14, 1014, 492, 4784, 12, 20880, 2364, 12, 8204, 2017, 199, 504, 18918, 14, 1208, 14, 1310, 492, 664, 63, 1095, 63, 633, 199, 504, 18918, 14, 1208, 14, 633, 492, 20818, 63, 8973, 199, 504, 18918, 14, 1014, 14, 7792, 492, 25143, 199, 199, 504, 3336, 63, 8721, 7735, 14, 1744, 492, 12705, 12, 12705, 5455, 3007, 985, 21332, 465, 12705, 5455, 199, 199, 5293, 275, 747, 14, 515, 14, 4832, 8, 736, 14, 515, 14, 3475, 3460, 493, 8964, 199, 199, 533, 510, 1148, 1237, 4674, 25157, 8, 1563, 25157, 304, 272, 536, 275, 283, 274, 1939, 13, 6644, 1237, 4674, 14, 957, 7, 272, 4370, 63, 9756, 275, 788, 6644, 1237, 4674, 14, 957, 418, 339, 347, 1343, 63, 6615, 8, 277, 304, 267, 543, 1551, 8, 736, 14, 515, 14, 904, 8, 5293, 12, 283, 13336, 14, 4737, 1333, 465, 289, 26, 288, 7002, 275, 7392, 14, 2141, 5929, 8, 70, 9, 288, 367, 1962, 315, 7002, 26, 355, 2386, 85, 275, 1962, 459, 27772, 418, 355, 1166, 275, 283, 1014, 921, 1544, 14, 6644, 1237, 4674, 14, 957, 15, 390, 15, 390, 15, 1733, 15, 274, 1939, 3295, 83, 7, 355, 1995, 4784, 8, 633, 450, 2386, 85, 12, 3404, 3713, 27772, 356, 2386, 85, 1552, 339, 347, 2198, 8, 277, 12, 1177, 304, 267, 394, 7977, 275, 20880, 27645, 11212, 8, 1310, 9, 267, 7585, 275, 394, 7977, 14, 2416, 15079, 454, 14251, 533, 628, 2700, 68, 1642, 937, 358, 267, 340, 7585, 26, 6722, 5448, 275, 488, 6722, 3336, 275, 7585, 59, 16, 61, 6722, 5077, 275, 12705, 5455, 8, 1053, 29, 5884, 1062, 9759, 29, 2558, 9, 6722, 5077, 14, 525, 63, 8006, 360, 354, 297, 1987, 501, 72, 19, 15, 65, 15, 505, 19004, 288, 5077, 14, 525, 63, 8006, 360, 633, 297, 1987, 501, 72, 19, 15, 65, 15, 32, 6399, 358, 6722, 5077, 14, 525, 63, 585, 360, 27772, 297, 1177, 14, 2024, 459, 27772, 1105, 6722, 5077, 14, 525, 63, 585, 360, 4777, 297, 378, 9, 6722, 8033, 275, 3336, 14, 2416, 29995, 80, 14251, 533, 628, 2700, 68, 13, 4606, 937, 15, 9370, 15, 505, 342, 1959, 5005, 342, 6722, 340, 8033, 26, 507, 198, 3422, 14, 525, 63, 585, 360, 4777, 297, 8033, 59, 16, 1055, 1814, 5102, 26409, 1333, 6722, 5448, 275, 5077, 6722, 340, 5448, 26, 507, 198, 692, 8033, 26, 15075, 1995, 5448, 14, 912, 63, 1053, 342, 507, 198, 2836, 26, 15075, 1995, 4784, 8, 2700, 14, 362, 63, 1199, 63, 585, 360, 633, 659, 3233, 29, 277, 14, 1122, 63, 2558, 12, 2024, 3713, 895, 63, 8788, 356, 5448, 1386, 21542, 63, 1541, 29, 549, 9, 339, 347, 2198, 63, 2558, 8, 277, 12, 1177, 304, 199, 198, 72, 7977, 275, 20880, 27645, 11212, 8, 1310, 9, 199, 198, 895, 63, 8788, 275, 1177, 14, 2024, 459, 895, 63, 8788, 418, 199, 198, 692, 440, 1094, 63, 8788, 14, 362, 63, 1199, 63, 585, 360, 4777, 735, 6722, 8033, 275, 394, 7977, 14, 2416, 29995, 3751, 14251, 73, 808, 2675, 628, 4777, 937, 15, 505, 342, 1959, 5005, 342, 6722, 340, 8033, 26, 507, 198, 895, 63, 8788, 14, 525, 63, 585, 360, 4777, 297, 8033, 59, 16, 1055, 1814, 5102, 26409, 1333, 199, 198, 11481, 1094, 63, 8788, 14, 912, 63, 1053, 342, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 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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 ]
rr-/ida-images
rgb-ida.py
1
3099
import idaapi import librgb from librgb.qt_shims import QtGui # important for PySide legacy IDA from librgb.qt_shims import QtWidgets try: MAJOR, MINOR = map(int, idaapi.get_kernel_version().split(".")) except AttributeError: MAJOR, MINOR = 6, 6 USING_IDA7API = MAJOR > 6 USING_PYQT5 = USING_IDA7API or (MAJOR == 6 and MINOR >= 9) class DockableShim(object): def __init__(self, title): self._title = title # IDA 7+ Widgets if USING_IDA7API: import sip self._form = idaapi.create_empty_widget(self._title) self.widget = sip.wrapinstance(long(self._form), QtWidgets.QWidget) # legacy IDA PluginForm's else: self._form = idaapi.create_tform(self._title, None) if USING_PYQT5: self.widget = idaapi.PluginForm.FormToPyQtWidget(self._form) else: self.widget = idaapi.PluginForm.FormToPySideWidget(self._form) def show(self): if USING_IDA7API: flags = ( idaapi.PluginForm.WOPN_TAB | idaapi.PluginForm.WOPN_MENU | idaapi.PluginForm.WOPN_RESTORE | idaapi.PluginForm.WOPN_PERSIST ) idaapi.display_widget(self._form, flags) # legacy IDA PluginForm's else: flags = ( idaapi.PluginForm.FORM_TAB | idaapi.PluginForm.FORM_MENU | idaapi.PluginForm.FORM_RESTORE | idaapi.PluginForm.FORM_PERSIST | 0x80 ) # idaapi.PluginForm.FORM_QWIDGET idaapi.open_tform(self._form, flags) class ImagePreviewPlugin(idaapi.plugin_t): flags = 0 wanted_name = "Image previewer" wanted_hotkey = "Alt + I" comment = "Preview memory as image" help = "https://github.com/rr-/ida-images" def init(self): return idaapi.PLUGIN_OK def term(self): pass def run(self, arg): class IdaWindowAdapter(librgb.GenericWindowAdapter): def ask_address(self, address): return AskAddr(address, "Please enter an address") def ask_file(self): return AskFile(1, "*.png", "Save the image as...") image_preview_form = DockableShim("Image preview") params = librgb.RendererParams() params.readers = [librgb.MemoryReader()] params.format = librgb.PixelFormats.GRAY8 params.width = 800 params.height = 600 params.flip = False params.brightness = 50 adapter = IdaWindowAdapter(params) shortcut_manager = librgb.ShortcutManager(adapter, params) for shortcut, func in shortcut_manager.shortcuts.items(): adapter.define_shortcut(shortcut, image_preview_form.widget, func) layout = adapter.create_layout() image_preview_form.widget.setLayout(layout) adapter.draw() image_preview_form.show() def PLUGIN_ENTRY(): return ImagePreviewPlugin() if __name__ == "__main__": ImagePreviewPlugin().run(0)
mit
[ 646, 284, 983, 1246, 199, 646, 1973, 10090, 199, 504, 1973, 10090, 14, 8440, 63, 609, 11171, 492, 5928, 221, 327, 11012, 367, 1611, 15414, 12139, 2870, 33, 199, 504, 1973, 10090, 14, 8440, 63, 609, 11171, 492, 17113, 199, 199, 893, 26, 272, 4828, 27109, 12, 15861, 726, 275, 2341, 8, 442, 12, 284, 983, 1246, 14, 362, 63, 4989, 63, 1023, 1252, 1294, 480, 13853, 199, 2590, 4281, 26, 272, 4828, 27109, 12, 15861, 726, 275, 1227, 12, 1227, 199, 1668, 1206, 63, 998, 33, 23, 3735, 275, 4828, 27109, 690, 1227, 199, 1668, 1206, 63, 4521, 19229, 21, 275, 32210, 63, 998, 33, 23, 3735, 503, 334, 29241, 508, 1227, 436, 15861, 726, 2356, 1749, 9, 421, 199, 533, 577, 766, 461, 2662, 1017, 8, 785, 304, 272, 347, 636, 826, 721, 277, 12, 2538, 304, 267, 291, 423, 1213, 275, 2538, 398, 327, 2870, 33, 1520, 11, 16905, 83, 267, 340, 32210, 63, 998, 33, 23, 3735, 26, 288, 492, 25342, 953, 291, 423, 964, 275, 284, 983, 1246, 14, 981, 63, 1667, 63, 3440, 8, 277, 423, 1213, 9, 288, 291, 14, 3440, 275, 25342, 14, 3823, 842, 8, 2809, 8, 277, 423, 964, 395, 17113, 14, 23894, 9, 267, 327, 12139, 2870, 33, 11349, 2821, 1159, 267, 587, 26, 288, 291, 423, 964, 275, 284, 983, 1246, 14, 981, 63, 84, 964, 8, 277, 423, 1213, 12, 488, 9, 288, 340, 32210, 63, 4521, 19229, 21, 26, 355, 291, 14, 3440, 275, 284, 983, 1246, 14, 5061, 2821, 14, 2821, 1378, 24107, 3339, 8, 277, 423, 964, 9, 288, 587, 26, 355, 291, 14, 3440, 275, 284, 983, 1246, 14, 5061, 2821, 14, 2821, 1378, 2713, 15414, 3339, 8, 277, 423, 964, 9, 339, 347, 2498, 8, 277, 304, 267, 340, 32210, 63, 998, 33, 23, 3735, 26, 288, 3285, 275, 334, 355, 284, 983, 1246, 14, 5061, 2821, 14, 55, 1938, 46, 63, 10129, 355, 1204, 284, 983, 1246, 14, 5061, 2821, 14, 55, 1938, 46, 63, 18223, 355, 1204, 284, 983, 1246, 14, 5061, 2821, 14, 55, 1938, 46, 63, 15740, 5788, 355, 1204, 284, 983, 1246, 14, 5061, 2821, 14, 55, 1938, 46, 63, 4227, 29367, 288, 776, 288, 284, 983, 1246, 14, 2918, 63, 3440, 8, 277, 423, 964, 12, 3285, 9, 398, 327, 12139, 2870, 33, 11349, 2821, 1159, 267, 587, 26, 288, 3285, 275, 334, 355, 284, 983, 1246, 14, 5061, 2821, 14, 3516, 63, 10129, 355, 1204, 284, 983, 1246, 14, 5061, 2821, 14, 3516, 63, 18223, 355, 1204, 284, 983, 1246, 14, 5061, 2821, 14, 3516, 63, 15740, 5788, 355, 1204, 284, 983, 1246, 14, 5061, 2821, 14, 3516, 63, 4227, 29367, 355, 1204, 378, 88, 1257, 288, 776, 221, 327, 284, 983, 1246, 14, 5061, 2821, 14, 3516, 63, 49, 9845, 2970, 288, 284, 983, 1246, 14, 1490, 63, 84, 964, 8, 277, 423, 964, 12, 3285, 9, 421, 199, 533, 6047, 27116, 5061, 8, 29132, 1246, 14, 2718, 63, 84, 304, 272, 3285, 275, 378, 272, 13632, 63, 354, 275, 298, 3491, 876, 16645, 2, 272, 13632, 63, 8885, 498, 275, 298, 16985, 435, 473, 2, 272, 3721, 275, 298, 27116, 4402, 465, 1834, 2, 272, 1720, 275, 298, 2859, 921, 5031, 14, 957, 15, 9734, 13, 15, 29132, 13, 4782, 2, 339, 347, 4205, 8, 277, 304, 267, 372, 284, 983, 1246, 14, 19108, 63, 3593, 339, 347, 6707, 8, 277, 304, 267, 986, 339, 347, 1255, 8, 277, 12, 1680, 304, 267, 1021, 473, 983, 4301, 10200, 8, 773, 10090, 14, 9417, 4301, 10200, 304, 288, 347, 7198, 63, 1562, 8, 277, 12, 2287, 304, 355, 372, 30481, 11404, 8, 1562, 12, 298, 8254, 9509, 376, 2287, 531, 953, 347, 7198, 63, 493, 8, 277, 304, 355, 372, 30481, 1173, 8, 17, 12, 298, 4856, 4524, 401, 298, 8229, 314, 1834, 465, 12594, 398, 1834, 63, 7780, 63, 964, 275, 577, 766, 461, 2662, 1017, 480, 3491, 19653, 531, 398, 1862, 275, 1973, 10090, 14, 11355, 6007, 342, 267, 1862, 14, 27056, 275, 359, 773, 10090, 14, 8628, 5929, 5106, 267, 1862, 14, 908, 275, 1973, 10090, 14, 14383, 29717, 14, 18583, 57, 24, 267, 1862, 14, 2063, 275, 23466, 267, 1862, 14, 3333, 275, 11624, 267, 1862, 14, 16114, 275, 756, 267, 1862, 14, 22298, 275, 5238, 398, 12146, 275, 473, 983, 4301, 10200, 8, 1162, 9, 267, 17522, 63, 2609, 275, 1973, 10090, 14, 28301, 2988, 8, 10394, 12, 1862, 9, 267, 367, 17522, 12, 2562, 315, 17522, 63, 2609, 14, 17469, 14, 1744, 837, 288, 12146, 14, 4640, 63, 24231, 8, 24231, 12, 1834, 63, 7780, 63, 964, 14, 3440, 12, 2562, 9, 398, 7054, 275, 12146, 14, 981, 63, 4209, 342, 267, 1834, 63, 7780, 63, 964, 14, 3440, 14, 409, 4798, 8, 4209, 9, 267, 12146, 14, 5485, 342, 267, 1834, 63, 7780, 63, 964, 14, 2384, 342, 421, 199, 318, 10092, 10134, 568, 63, 7285, 837, 272, 372, 6047, 27116, 5061, 342, 421, 199, 692, 636, 354, 363, 508, 4396, 973, 5727, 272, 6047, 27116, 5061, 1252, 1065, 8, 16, 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 ]
[ 284, 983, 1246, 199, 646, 1973, 10090, 199, 504, 1973, 10090, 14, 8440, 63, 609, 11171, 492, 5928, 221, 327, 11012, 367, 1611, 15414, 12139, 2870, 33, 199, 504, 1973, 10090, 14, 8440, 63, 609, 11171, 492, 17113, 199, 199, 893, 26, 272, 4828, 27109, 12, 15861, 726, 275, 2341, 8, 442, 12, 284, 983, 1246, 14, 362, 63, 4989, 63, 1023, 1252, 1294, 480, 13853, 199, 2590, 4281, 26, 272, 4828, 27109, 12, 15861, 726, 275, 1227, 12, 1227, 199, 1668, 1206, 63, 998, 33, 23, 3735, 275, 4828, 27109, 690, 1227, 199, 1668, 1206, 63, 4521, 19229, 21, 275, 32210, 63, 998, 33, 23, 3735, 503, 334, 29241, 508, 1227, 436, 15861, 726, 2356, 1749, 9, 421, 199, 533, 577, 766, 461, 2662, 1017, 8, 785, 304, 272, 347, 636, 826, 721, 277, 12, 2538, 304, 267, 291, 423, 1213, 275, 2538, 398, 327, 2870, 33, 1520, 11, 16905, 83, 267, 340, 32210, 63, 998, 33, 23, 3735, 26, 288, 492, 25342, 953, 291, 423, 964, 275, 284, 983, 1246, 14, 981, 63, 1667, 63, 3440, 8, 277, 423, 1213, 9, 288, 291, 14, 3440, 275, 25342, 14, 3823, 842, 8, 2809, 8, 277, 423, 964, 395, 17113, 14, 23894, 9, 267, 327, 12139, 2870, 33, 11349, 2821, 1159, 267, 587, 26, 288, 291, 423, 964, 275, 284, 983, 1246, 14, 981, 63, 84, 964, 8, 277, 423, 1213, 12, 488, 9, 288, 340, 32210, 63, 4521, 19229, 21, 26, 355, 291, 14, 3440, 275, 284, 983, 1246, 14, 5061, 2821, 14, 2821, 1378, 24107, 3339, 8, 277, 423, 964, 9, 288, 587, 26, 355, 291, 14, 3440, 275, 284, 983, 1246, 14, 5061, 2821, 14, 2821, 1378, 2713, 15414, 3339, 8, 277, 423, 964, 9, 339, 347, 2498, 8, 277, 304, 267, 340, 32210, 63, 998, 33, 23, 3735, 26, 288, 3285, 275, 334, 355, 284, 983, 1246, 14, 5061, 2821, 14, 55, 1938, 46, 63, 10129, 355, 1204, 284, 983, 1246, 14, 5061, 2821, 14, 55, 1938, 46, 63, 18223, 355, 1204, 284, 983, 1246, 14, 5061, 2821, 14, 55, 1938, 46, 63, 15740, 5788, 355, 1204, 284, 983, 1246, 14, 5061, 2821, 14, 55, 1938, 46, 63, 4227, 29367, 288, 776, 288, 284, 983, 1246, 14, 2918, 63, 3440, 8, 277, 423, 964, 12, 3285, 9, 398, 327, 12139, 2870, 33, 11349, 2821, 1159, 267, 587, 26, 288, 3285, 275, 334, 355, 284, 983, 1246, 14, 5061, 2821, 14, 3516, 63, 10129, 355, 1204, 284, 983, 1246, 14, 5061, 2821, 14, 3516, 63, 18223, 355, 1204, 284, 983, 1246, 14, 5061, 2821, 14, 3516, 63, 15740, 5788, 355, 1204, 284, 983, 1246, 14, 5061, 2821, 14, 3516, 63, 4227, 29367, 355, 1204, 378, 88, 1257, 288, 776, 221, 327, 284, 983, 1246, 14, 5061, 2821, 14, 3516, 63, 49, 9845, 2970, 288, 284, 983, 1246, 14, 1490, 63, 84, 964, 8, 277, 423, 964, 12, 3285, 9, 421, 199, 533, 6047, 27116, 5061, 8, 29132, 1246, 14, 2718, 63, 84, 304, 272, 3285, 275, 378, 272, 13632, 63, 354, 275, 298, 3491, 876, 16645, 2, 272, 13632, 63, 8885, 498, 275, 298, 16985, 435, 473, 2, 272, 3721, 275, 298, 27116, 4402, 465, 1834, 2, 272, 1720, 275, 298, 2859, 921, 5031, 14, 957, 15, 9734, 13, 15, 29132, 13, 4782, 2, 339, 347, 4205, 8, 277, 304, 267, 372, 284, 983, 1246, 14, 19108, 63, 3593, 339, 347, 6707, 8, 277, 304, 267, 986, 339, 347, 1255, 8, 277, 12, 1680, 304, 267, 1021, 473, 983, 4301, 10200, 8, 773, 10090, 14, 9417, 4301, 10200, 304, 288, 347, 7198, 63, 1562, 8, 277, 12, 2287, 304, 355, 372, 30481, 11404, 8, 1562, 12, 298, 8254, 9509, 376, 2287, 531, 953, 347, 7198, 63, 493, 8, 277, 304, 355, 372, 30481, 1173, 8, 17, 12, 298, 4856, 4524, 401, 298, 8229, 314, 1834, 465, 12594, 398, 1834, 63, 7780, 63, 964, 275, 577, 766, 461, 2662, 1017, 480, 3491, 19653, 531, 398, 1862, 275, 1973, 10090, 14, 11355, 6007, 342, 267, 1862, 14, 27056, 275, 359, 773, 10090, 14, 8628, 5929, 5106, 267, 1862, 14, 908, 275, 1973, 10090, 14, 14383, 29717, 14, 18583, 57, 24, 267, 1862, 14, 2063, 275, 23466, 267, 1862, 14, 3333, 275, 11624, 267, 1862, 14, 16114, 275, 756, 267, 1862, 14, 22298, 275, 5238, 398, 12146, 275, 473, 983, 4301, 10200, 8, 1162, 9, 267, 17522, 63, 2609, 275, 1973, 10090, 14, 28301, 2988, 8, 10394, 12, 1862, 9, 267, 367, 17522, 12, 2562, 315, 17522, 63, 2609, 14, 17469, 14, 1744, 837, 288, 12146, 14, 4640, 63, 24231, 8, 24231, 12, 1834, 63, 7780, 63, 964, 14, 3440, 12, 2562, 9, 398, 7054, 275, 12146, 14, 981, 63, 4209, 342, 267, 1834, 63, 7780, 63, 964, 14, 3440, 14, 409, 4798, 8, 4209, 9, 267, 12146, 14, 5485, 342, 267, 1834, 63, 7780, 63, 964, 14, 2384, 342, 421, 199, 318, 10092, 10134, 568, 63, 7285, 837, 272, 372, 6047, 27116, 5061, 342, 421, 199, 692, 636, 354, 363, 508, 4396, 973, 5727, 272, 6047, 27116, 5061, 1252, 1065, 8, 16, 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, 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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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 ]
dursk/django
tests/template_tests/test_nodelist.py
173
3234
from unittest import TestCase from django.template import Context, Engine from django.template.base import TextNode, VariableNode from django.utils import six class NodelistTest(TestCase): @classmethod def setUpClass(cls): cls.engine = Engine() super(NodelistTest, cls).setUpClass() def test_for(self): template = self.engine.from_string('{% for i in 1 %}{{ a }}{% endfor %}') vars = template.nodelist.get_nodes_by_type(VariableNode) self.assertEqual(len(vars), 1) def test_if(self): template = self.engine.from_string('{% if x %}{{ a }}{% endif %}') vars = template.nodelist.get_nodes_by_type(VariableNode) self.assertEqual(len(vars), 1) def test_ifequal(self): template = self.engine.from_string('{% ifequal x y %}{{ a }}{% endifequal %}') vars = template.nodelist.get_nodes_by_type(VariableNode) self.assertEqual(len(vars), 1) def test_ifchanged(self): template = self.engine.from_string('{% ifchanged x %}{{ a }}{% endifchanged %}') vars = template.nodelist.get_nodes_by_type(VariableNode) self.assertEqual(len(vars), 1) class TextNodeTest(TestCase): def test_textnode_repr(self): engine = Engine() for temptext, reprtext in [ ("Hello, world!", "<TextNode: u'Hello, world!'>"), ("One\ntwo.", "<TextNode: u'One\\ntwo.'>"), ]: template = engine.from_string(temptext) texts = template.nodelist.get_nodes_by_type(TextNode) if six.PY3: reprtext = reprtext.replace("u'", "'") self.assertEqual(repr(texts[0]), reprtext) class ErrorIndexTest(TestCase): """ Checks whether index of error is calculated correctly in template debugger in for loops. Refs ticket #5831 """ def test_correct_exception_index(self): tests = [ ('{% load bad_tag %}{% for i in range %}{% badsimpletag %}{% endfor %}', (38, 56)), ( '{% load bad_tag %}{% for i in range %}{% for j in range %}' '{% badsimpletag %}{% endfor %}{% endfor %}', (58, 76) ), ( '{% load bad_tag %}{% for i in range %}{% badsimpletag %}' '{% for j in range %}Hello{% endfor %}{% endfor %}', (38, 56) ), ( '{% load bad_tag %}{% for i in range %}{% for j in five %}' '{% badsimpletag %}{% endfor %}{% endfor %}', (38, 57) ), ('{% load bad_tag %}{% for j in five %}{% badsimpletag %}{% endfor %}', (18, 37)), ] context = Context({ 'range': range(5), 'five': 5, }) engine = Engine(debug=True, libraries={'bad_tag': 'template_tests.templatetags.bad_tag'}) for source, expected_error_source_index in tests: template = engine.from_string(source) try: template.render(context) except (RuntimeError, TypeError) as e: debug = e.template_debug self.assertEqual((debug['start'], debug['end']), expected_error_source_index)
bsd-3-clause
[ 504, 2882, 492, 7640, 199, 199, 504, 1639, 14, 1160, 492, 9470, 12, 12580, 199, 504, 1639, 14, 1160, 14, 1095, 492, 4516, 1716, 12, 4905, 1716, 199, 504, 1639, 14, 1208, 492, 3816, 421, 199, 533, 5013, 513, 774, 8, 1746, 304, 339, 768, 3744, 272, 347, 18561, 8, 1886, 304, 267, 843, 14, 3908, 275, 12580, 342, 267, 1613, 8, 1716, 513, 774, 12, 843, 680, 27777, 342, 339, 347, 511, 63, 509, 8, 277, 304, 267, 1978, 275, 291, 14, 3908, 14, 504, 63, 875, 24103, 367, 284, 315, 413, 17337, 282, 20104, 17273, 31246, 267, 6802, 275, 1978, 14, 14371, 14, 362, 63, 2415, 63, 991, 63, 466, 8, 2773, 1716, 9, 267, 291, 14, 629, 8, 552, 8, 2936, 395, 413, 9, 339, 347, 511, 63, 692, 8, 277, 304, 267, 1978, 275, 291, 14, 3908, 14, 504, 63, 875, 24103, 340, 671, 17337, 282, 20104, 14454, 31246, 267, 6802, 275, 1978, 14, 14371, 14, 362, 63, 2415, 63, 991, 63, 466, 8, 2773, 1716, 9, 267, 291, 14, 629, 8, 552, 8, 2936, 395, 413, 9, 339, 347, 511, 63, 692, 1452, 8, 277, 304, 267, 1978, 275, 291, 14, 3908, 14, 504, 63, 875, 24103, 340, 1452, 671, 612, 17337, 282, 20104, 655, 328, 771, 537, 31246, 267, 6802, 275, 1978, 14, 14371, 14, 362, 63, 2415, 63, 991, 63, 466, 8, 2773, 1716, 9, 267, 291, 14, 629, 8, 552, 8, 2936, 395, 413, 9, 339, 347, 511, 63, 692, 2489, 8, 277, 304, 267, 1978, 275, 291, 14, 3908, 14, 504, 63, 875, 24103, 340, 2489, 671, 17337, 282, 20104, 14454, 2489, 31246, 267, 6802, 275, 1978, 14, 14371, 14, 362, 63, 2415, 63, 991, 63, 466, 8, 2773, 1716, 9, 267, 291, 14, 629, 8, 552, 8, 2936, 395, 413, 9, 421, 199, 533, 4516, 1716, 774, 8, 1746, 304, 339, 347, 511, 63, 505, 932, 63, 2722, 8, 277, 304, 267, 6869, 275, 12580, 342, 267, 367, 2388, 505, 12, 4700, 505, 315, 359, 288, 1689, 6257, 12, 6701, 17716, 3886, 32540, 26, 399, 7, 6257, 12, 6701, 1, 8423, 1288, 288, 1689, 4395, 60, 343, 2027, 4765, 3886, 32540, 26, 399, 7, 4395, 1103, 343, 2027, 3530, 30, 1288, 267, 16246, 288, 1978, 275, 6869, 14, 504, 63, 875, 8, 808, 505, 9, 288, 24857, 275, 1978, 14, 14371, 14, 362, 63, 2415, 63, 991, 63, 466, 8, 32540, 9, 288, 340, 3816, 14, 4521, 19, 26, 355, 4700, 505, 275, 4700, 505, 14, 1814, 480, 85, 4662, 3546, 531, 288, 291, 14, 629, 8, 2722, 8, 19517, 59, 16, 2522, 4700, 505, 9, 421, 199, 533, 4520, 2681, 774, 8, 1746, 304, 272, 408, 272, 13813, 3775, 1478, 402, 1125, 365, 12950, 6657, 315, 272, 1978, 14958, 315, 367, 17222, 14, 22165, 12052, 327, 2010, 2192, 272, 408, 272, 347, 511, 63, 4525, 63, 1971, 63, 1080, 8, 277, 304, 267, 2295, 275, 359, 288, 23960, 2248, 4875, 63, 1450, 12760, 367, 284, 315, 1425, 12760, 4875, 4129, 1450, 12760, 17273, 21610, 334, 1703, 12, 12001, 1826, 288, 334, 355, 12100, 2248, 4875, 63, 1450, 12760, 367, 284, 315, 1425, 12760, 367, 1335, 315, 1425, 25509, 355, 12100, 4875, 4129, 1450, 12760, 17273, 12760, 17273, 21610, 355, 334, 2010, 12, 14646, 9, 288, 2318, 288, 334, 355, 12100, 2248, 4875, 63, 1450, 12760, 367, 284, 315, 1425, 12760, 4875, 4129, 1450, 25509, 355, 12100, 367, 1335, 315, 1425, 3674, 6257, 3996, 17273, 12760, 17273, 21610, 355, 334, 1703, 12, 12001, 9, 288, 2318, 288, 334, 355, 12100, 2248, 4875, 63, 1450, 12760, 367, 284, 315, 1425, 12760, 367, 1335, 315, 24187, 25509, 355, 12100, 4875, 4129, 1450, 12760, 17273, 12760, 17273, 21610, 355, 334, 1703, 12, 12699, 9, 288, 2318, 288, 23960, 2248, 4875, 63, 1450, 12760, 367, 1335, 315, 24187, 12760, 4875, 4129, 1450, 12760, 17273, 21610, 334, 1085, 12, 6877, 1826, 267, 1622, 267, 1067, 275, 9470, 2561, 288, 283, 1842, 356, 1425, 8, 21, 395, 288, 283, 23702, 356, 959, 12, 267, 3828, 267, 6869, 275, 12580, 8, 1757, 29, 549, 12, 8363, 3713, 4087, 63, 1450, 356, 283, 1160, 63, 2219, 14, 1160, 2969, 14, 4087, 63, 1450, 3071, 267, 367, 1350, 12, 1420, 63, 705, 63, 1365, 63, 1080, 315, 2295, 26, 288, 1978, 275, 6869, 14, 504, 63, 875, 8, 1365, 9, 288, 862, 26, 355, 1978, 14, 3352, 8, 1100, 9, 288, 871, 334, 13281, 12, 3146, 9, 465, 325, 26, 355, 3105, 275, 325, 14, 1160, 63, 1757, 355, 291, 14, 629, 1332, 1757, 459, 928, 995, 3105, 459, 500, 3815, 1420, 63, 705, 63, 1365, 63, 1080, 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 ]
[ 2882, 492, 7640, 199, 199, 504, 1639, 14, 1160, 492, 9470, 12, 12580, 199, 504, 1639, 14, 1160, 14, 1095, 492, 4516, 1716, 12, 4905, 1716, 199, 504, 1639, 14, 1208, 492, 3816, 421, 199, 533, 5013, 513, 774, 8, 1746, 304, 339, 768, 3744, 272, 347, 18561, 8, 1886, 304, 267, 843, 14, 3908, 275, 12580, 342, 267, 1613, 8, 1716, 513, 774, 12, 843, 680, 27777, 342, 339, 347, 511, 63, 509, 8, 277, 304, 267, 1978, 275, 291, 14, 3908, 14, 504, 63, 875, 24103, 367, 284, 315, 413, 17337, 282, 20104, 17273, 31246, 267, 6802, 275, 1978, 14, 14371, 14, 362, 63, 2415, 63, 991, 63, 466, 8, 2773, 1716, 9, 267, 291, 14, 629, 8, 552, 8, 2936, 395, 413, 9, 339, 347, 511, 63, 692, 8, 277, 304, 267, 1978, 275, 291, 14, 3908, 14, 504, 63, 875, 24103, 340, 671, 17337, 282, 20104, 14454, 31246, 267, 6802, 275, 1978, 14, 14371, 14, 362, 63, 2415, 63, 991, 63, 466, 8, 2773, 1716, 9, 267, 291, 14, 629, 8, 552, 8, 2936, 395, 413, 9, 339, 347, 511, 63, 692, 1452, 8, 277, 304, 267, 1978, 275, 291, 14, 3908, 14, 504, 63, 875, 24103, 340, 1452, 671, 612, 17337, 282, 20104, 655, 328, 771, 537, 31246, 267, 6802, 275, 1978, 14, 14371, 14, 362, 63, 2415, 63, 991, 63, 466, 8, 2773, 1716, 9, 267, 291, 14, 629, 8, 552, 8, 2936, 395, 413, 9, 339, 347, 511, 63, 692, 2489, 8, 277, 304, 267, 1978, 275, 291, 14, 3908, 14, 504, 63, 875, 24103, 340, 2489, 671, 17337, 282, 20104, 14454, 2489, 31246, 267, 6802, 275, 1978, 14, 14371, 14, 362, 63, 2415, 63, 991, 63, 466, 8, 2773, 1716, 9, 267, 291, 14, 629, 8, 552, 8, 2936, 395, 413, 9, 421, 199, 533, 4516, 1716, 774, 8, 1746, 304, 339, 347, 511, 63, 505, 932, 63, 2722, 8, 277, 304, 267, 6869, 275, 12580, 342, 267, 367, 2388, 505, 12, 4700, 505, 315, 359, 288, 1689, 6257, 12, 6701, 17716, 3886, 32540, 26, 399, 7, 6257, 12, 6701, 1, 8423, 1288, 288, 1689, 4395, 60, 343, 2027, 4765, 3886, 32540, 26, 399, 7, 4395, 1103, 343, 2027, 3530, 30, 1288, 267, 16246, 288, 1978, 275, 6869, 14, 504, 63, 875, 8, 808, 505, 9, 288, 24857, 275, 1978, 14, 14371, 14, 362, 63, 2415, 63, 991, 63, 466, 8, 32540, 9, 288, 340, 3816, 14, 4521, 19, 26, 355, 4700, 505, 275, 4700, 505, 14, 1814, 480, 85, 4662, 3546, 531, 288, 291, 14, 629, 8, 2722, 8, 19517, 59, 16, 2522, 4700, 505, 9, 421, 199, 533, 4520, 2681, 774, 8, 1746, 304, 272, 408, 272, 13813, 3775, 1478, 402, 1125, 365, 12950, 6657, 315, 272, 1978, 14958, 315, 367, 17222, 14, 22165, 12052, 327, 2010, 2192, 272, 408, 272, 347, 511, 63, 4525, 63, 1971, 63, 1080, 8, 277, 304, 267, 2295, 275, 359, 288, 23960, 2248, 4875, 63, 1450, 12760, 367, 284, 315, 1425, 12760, 4875, 4129, 1450, 12760, 17273, 21610, 334, 1703, 12, 12001, 1826, 288, 334, 355, 12100, 2248, 4875, 63, 1450, 12760, 367, 284, 315, 1425, 12760, 367, 1335, 315, 1425, 25509, 355, 12100, 4875, 4129, 1450, 12760, 17273, 12760, 17273, 21610, 355, 334, 2010, 12, 14646, 9, 288, 2318, 288, 334, 355, 12100, 2248, 4875, 63, 1450, 12760, 367, 284, 315, 1425, 12760, 4875, 4129, 1450, 25509, 355, 12100, 367, 1335, 315, 1425, 3674, 6257, 3996, 17273, 12760, 17273, 21610, 355, 334, 1703, 12, 12001, 9, 288, 2318, 288, 334, 355, 12100, 2248, 4875, 63, 1450, 12760, 367, 284, 315, 1425, 12760, 367, 1335, 315, 24187, 25509, 355, 12100, 4875, 4129, 1450, 12760, 17273, 12760, 17273, 21610, 355, 334, 1703, 12, 12699, 9, 288, 2318, 288, 23960, 2248, 4875, 63, 1450, 12760, 367, 1335, 315, 24187, 12760, 4875, 4129, 1450, 12760, 17273, 21610, 334, 1085, 12, 6877, 1826, 267, 1622, 267, 1067, 275, 9470, 2561, 288, 283, 1842, 356, 1425, 8, 21, 395, 288, 283, 23702, 356, 959, 12, 267, 3828, 267, 6869, 275, 12580, 8, 1757, 29, 549, 12, 8363, 3713, 4087, 63, 1450, 356, 283, 1160, 63, 2219, 14, 1160, 2969, 14, 4087, 63, 1450, 3071, 267, 367, 1350, 12, 1420, 63, 705, 63, 1365, 63, 1080, 315, 2295, 26, 288, 1978, 275, 6869, 14, 504, 63, 875, 8, 1365, 9, 288, 862, 26, 355, 1978, 14, 3352, 8, 1100, 9, 288, 871, 334, 13281, 12, 3146, 9, 465, 325, 26, 355, 3105, 275, 325, 14, 1160, 63, 1757, 355, 291, 14, 629, 1332, 1757, 459, 928, 995, 3105, 459, 500, 3815, 1420, 63, 705, 63, 1365, 63, 1080, 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, 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,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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 ]
jeremyclover/airflow
airflow/hooks/base_hook.py
20
1812
from builtins import object import logging import os import random from airflow import settings from airflow.models import Connection from airflow.utils import AirflowException CONN_ENV_PREFIX = 'AIRFLOW_CONN_' class BaseHook(object): """ Abstract base class for hooks, hooks are meant as an interface to interact with external systems. MySqlHook, HiveHook, PigHook return object that can handle the connection and interaction to specific instances of these systems, and expose consistent methods to interact with them. """ def __init__(self, source): pass @classmethod def get_connections(cls, conn_id): session = settings.Session() db = ( session.query(Connection) .filter(Connection.conn_id == conn_id) .all() ) if not db: raise AirflowException( "The conn_id `{0}` isn't defined".format(conn_id)) session.expunge_all() session.close() return db @classmethod def get_connection(cls, conn_id): environment_uri = os.environ.get(CONN_ENV_PREFIX + conn_id.upper()) conn = None if environment_uri: conn = Connection(uri=environment_uri) else: conn = random.choice(cls.get_connections(conn_id)) if conn.host: logging.info("Using connection to: " + conn.host) return conn @classmethod def get_hook(cls, conn_id): connection = cls.get_connection(conn_id) return connection.get_hook() def get_conn(self): raise NotImplemented() def get_records(self, sql): raise NotImplemented() def get_pandas_df(self, sql): raise NotImplemented() def run(self, sql): raise NotImplemented()
apache-2.0
[ 504, 12963, 492, 909, 199, 646, 2050, 199, 646, 747, 199, 646, 2196, 199, 199, 504, 16321, 492, 2202, 199, 504, 16321, 14, 992, 492, 8113, 199, 504, 16321, 14, 1208, 492, 31040, 1726, 199, 199, 17489, 63, 9984, 63, 6351, 275, 283, 33, 3927, 17114, 63, 17489, 8650, 421, 199, 533, 3523, 8481, 8, 785, 304, 272, 408, 272, 11836, 1300, 1021, 367, 12604, 12, 12604, 787, 18329, 465, 376, 3217, 370, 272, 17232, 543, 5957, 10460, 14, 4932, 16790, 8481, 12, 869, 1912, 8481, 12, 510, 528, 8481, 372, 272, 909, 626, 883, 2429, 314, 1950, 436, 18752, 370, 2488, 272, 4454, 402, 3520, 10460, 12, 436, 23705, 12137, 3102, 370, 17232, 272, 543, 3062, 14, 272, 408, 272, 347, 636, 826, 721, 277, 12, 1350, 304, 267, 986, 339, 768, 3744, 272, 347, 664, 63, 7995, 8, 1886, 12, 2557, 63, 344, 304, 267, 2351, 275, 2202, 14, 4434, 342, 267, 1592, 275, 334, 288, 2351, 14, 1131, 8, 3225, 9, 288, 1275, 1541, 8, 3225, 14, 1631, 63, 344, 508, 2557, 63, 344, 9, 288, 1275, 452, 342, 267, 776, 267, 340, 440, 1592, 26, 288, 746, 31040, 1726, 8, 355, 298, 1918, 2557, 63, 344, 658, 91, 16, 23485, 5712, 1133, 3247, 1674, 908, 8, 1631, 63, 344, 430, 267, 2351, 14, 30847, 63, 452, 342, 267, 2351, 14, 1600, 342, 267, 372, 1592, 339, 768, 3744, 272, 347, 664, 63, 2105, 8, 1886, 12, 2557, 63, 344, 304, 267, 3734, 63, 2302, 275, 747, 14, 2314, 14, 362, 8, 17489, 63, 9984, 63, 6351, 435, 2557, 63, 344, 14, 4142, 1012, 267, 2557, 275, 488, 267, 340, 3734, 63, 2302, 26, 288, 2557, 275, 8113, 8, 2302, 29, 5418, 63, 2302, 9, 267, 587, 26, 288, 2557, 275, 2196, 14, 5095, 8, 1886, 14, 362, 63, 7995, 8, 1631, 63, 344, 430, 267, 340, 2557, 14, 1102, 26, 288, 2050, 14, 815, 480, 10369, 1950, 370, 26, 298, 435, 2557, 14, 1102, 9, 267, 372, 2557, 339, 768, 3744, 272, 347, 664, 63, 3664, 8, 1886, 12, 2557, 63, 344, 304, 267, 1950, 275, 843, 14, 362, 63, 2105, 8, 1631, 63, 344, 9, 267, 372, 1950, 14, 362, 63, 3664, 342, 339, 347, 664, 63, 1631, 8, 277, 304, 267, 746, 3784, 342, 339, 347, 664, 63, 6502, 8, 277, 12, 3875, 304, 267, 746, 3784, 342, 339, 347, 664, 63, 15718, 63, 1587, 8, 277, 12, 3875, 304, 267, 746, 3784, 342, 339, 347, 1255, 8, 277, 12, 3875, 304, 267, 746, 3784, 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 ]
[ 12963, 492, 909, 199, 646, 2050, 199, 646, 747, 199, 646, 2196, 199, 199, 504, 16321, 492, 2202, 199, 504, 16321, 14, 992, 492, 8113, 199, 504, 16321, 14, 1208, 492, 31040, 1726, 199, 199, 17489, 63, 9984, 63, 6351, 275, 283, 33, 3927, 17114, 63, 17489, 8650, 421, 199, 533, 3523, 8481, 8, 785, 304, 272, 408, 272, 11836, 1300, 1021, 367, 12604, 12, 12604, 787, 18329, 465, 376, 3217, 370, 272, 17232, 543, 5957, 10460, 14, 4932, 16790, 8481, 12, 869, 1912, 8481, 12, 510, 528, 8481, 372, 272, 909, 626, 883, 2429, 314, 1950, 436, 18752, 370, 2488, 272, 4454, 402, 3520, 10460, 12, 436, 23705, 12137, 3102, 370, 17232, 272, 543, 3062, 14, 272, 408, 272, 347, 636, 826, 721, 277, 12, 1350, 304, 267, 986, 339, 768, 3744, 272, 347, 664, 63, 7995, 8, 1886, 12, 2557, 63, 344, 304, 267, 2351, 275, 2202, 14, 4434, 342, 267, 1592, 275, 334, 288, 2351, 14, 1131, 8, 3225, 9, 288, 1275, 1541, 8, 3225, 14, 1631, 63, 344, 508, 2557, 63, 344, 9, 288, 1275, 452, 342, 267, 776, 267, 340, 440, 1592, 26, 288, 746, 31040, 1726, 8, 355, 298, 1918, 2557, 63, 344, 658, 91, 16, 23485, 5712, 1133, 3247, 1674, 908, 8, 1631, 63, 344, 430, 267, 2351, 14, 30847, 63, 452, 342, 267, 2351, 14, 1600, 342, 267, 372, 1592, 339, 768, 3744, 272, 347, 664, 63, 2105, 8, 1886, 12, 2557, 63, 344, 304, 267, 3734, 63, 2302, 275, 747, 14, 2314, 14, 362, 8, 17489, 63, 9984, 63, 6351, 435, 2557, 63, 344, 14, 4142, 1012, 267, 2557, 275, 488, 267, 340, 3734, 63, 2302, 26, 288, 2557, 275, 8113, 8, 2302, 29, 5418, 63, 2302, 9, 267, 587, 26, 288, 2557, 275, 2196, 14, 5095, 8, 1886, 14, 362, 63, 7995, 8, 1631, 63, 344, 430, 267, 340, 2557, 14, 1102, 26, 288, 2050, 14, 815, 480, 10369, 1950, 370, 26, 298, 435, 2557, 14, 1102, 9, 267, 372, 2557, 339, 768, 3744, 272, 347, 664, 63, 3664, 8, 1886, 12, 2557, 63, 344, 304, 267, 1950, 275, 843, 14, 362, 63, 2105, 8, 1631, 63, 344, 9, 267, 372, 1950, 14, 362, 63, 3664, 342, 339, 347, 664, 63, 1631, 8, 277, 304, 267, 746, 3784, 342, 339, 347, 664, 63, 6502, 8, 277, 12, 3875, 304, 267, 746, 3784, 342, 339, 347, 664, 63, 15718, 63, 1587, 8, 277, 12, 3875, 304, 267, 746, 3784, 342, 339, 347, 1255, 8, 277, 12, 3875, 304, 267, 746, 3784, 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, 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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 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
ryfeus/lambda-packs
Pyrestest_wrk/source/pip/_vendor/requests/packages/chardet/hebrewprober.py
2929
13359
######################## BEGIN LICENSE BLOCK ######################## # The Original Code is Mozilla Universal charset detector code. # # The Initial Developer of the Original Code is # Shy Shalom # Portions created by the Initial Developer are Copyright (C) 2005 # the Initial Developer. All Rights Reserved. # # Contributor(s): # Mark Pilgrim - port to Python # # 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 .charsetprober import CharSetProber from .constants import eNotMe, eDetecting from .compat import wrap_ord # This prober doesn't actually recognize a language or a charset. # It is a helper prober for the use of the Hebrew model probers ### General ideas of the Hebrew charset recognition ### # # Four main charsets exist in Hebrew: # "ISO-8859-8" - Visual Hebrew # "windows-1255" - Logical Hebrew # "ISO-8859-8-I" - Logical Hebrew # "x-mac-hebrew" - ?? Logical Hebrew ?? # # Both "ISO" charsets use a completely identical set of code points, whereas # "windows-1255" and "x-mac-hebrew" are two different proper supersets of # these code points. windows-1255 defines additional characters in the range # 0x80-0x9F as some misc punctuation marks as well as some Hebrew-specific # diacritics and additional 'Yiddish' ligature letters in the range 0xc0-0xd6. # x-mac-hebrew defines similar additional code points but with a different # mapping. # # As far as an average Hebrew text with no diacritics is concerned, all four # charsets are identical with respect to code points. Meaning that for the # main Hebrew alphabet, all four map the same values to all 27 Hebrew letters # (including final letters). # # The dominant difference between these charsets is their directionality. # "Visual" directionality means that the text is ordered as if the renderer is # not aware of a BIDI rendering algorithm. The renderer sees the text and # draws it from left to right. The text itself when ordered naturally is read # backwards. A buffer of Visual Hebrew generally looks like so: # "[last word of first line spelled backwards] [whole line ordered backwards # and spelled backwards] [first word of first line spelled backwards] # [end of line] [last word of second line] ... etc' " # adding punctuation marks, numbers and English text to visual text is # naturally also "visual" and from left to right. # # "Logical" directionality means the text is ordered "naturally" according to # the order it is read. It is the responsibility of the renderer to display # the text from right to left. A BIDI algorithm is used to place general # punctuation marks, numbers and English text in the text. # # Texts in x-mac-hebrew are almost impossible to find on the Internet. From # what little evidence I could find, it seems that its general directionality # is Logical. # # To sum up all of the above, the Hebrew probing mechanism knows about two # charsets: # Visual Hebrew - "ISO-8859-8" - backwards text - Words and sentences are # backwards while line order is natural. For charset recognition purposes # the line order is unimportant (In fact, for this implementation, even # word order is unimportant). # Logical Hebrew - "windows-1255" - normal, naturally ordered text. # # "ISO-8859-8-I" is a subset of windows-1255 and doesn't need to be # specifically identified. # "x-mac-hebrew" is also identified as windows-1255. A text in x-mac-hebrew # that contain special punctuation marks or diacritics is displayed with # some unconverted characters showing as question marks. This problem might # be corrected using another model prober for x-mac-hebrew. Due to the fact # that x-mac-hebrew texts are so rare, writing another model prober isn't # worth the effort and performance hit. # #### The Prober #### # # The prober is divided between two SBCharSetProbers and a HebrewProber, # all of which are managed, created, fed data, inquired and deleted by the # SBCSGroupProber. The two SBCharSetProbers identify that the text is in # fact some kind of Hebrew, Logical or Visual. The final decision about which # one is it is made by the HebrewProber by combining final-letter scores # with the scores of the two SBCharSetProbers to produce a final answer. # # The SBCSGroupProber is responsible for stripping the original text of HTML # tags, English characters, numbers, low-ASCII punctuation characters, spaces # and new lines. It reduces any sequence of such characters to a single space. # The buffer fed to each prober in the SBCS group prober is pure text in # high-ASCII. # The two SBCharSetProbers (model probers) share the same language model: # Win1255Model. # The first SBCharSetProber uses the model normally as any other # SBCharSetProber does, to recognize windows-1255, upon which this model was # built. The second SBCharSetProber is told to make the pair-of-letter # lookup in the language model backwards. This in practice exactly simulates # a visual Hebrew model using the windows-1255 logical Hebrew model. # # The HebrewProber is not using any language model. All it does is look for # final-letter evidence suggesting the text is either logical Hebrew or visual # Hebrew. Disjointed from the model probers, the results of the HebrewProber # alone are meaningless. HebrewProber always returns 0.00 as confidence # since it never identifies a charset by itself. Instead, the pointer to the # HebrewProber is passed to the model probers as a helper "Name Prober". # When the Group prober receives a positive identification from any prober, # it asks for the name of the charset identified. If the prober queried is a # Hebrew model prober, the model prober forwards the call to the # HebrewProber to make the final decision. In the HebrewProber, the # decision is made according to the final-letters scores maintained and Both # model probers scores. The answer is returned in the form of the name of the # charset identified, either "windows-1255" or "ISO-8859-8". # windows-1255 / ISO-8859-8 code points of interest FINAL_KAF = 0xea NORMAL_KAF = 0xeb FINAL_MEM = 0xed NORMAL_MEM = 0xee FINAL_NUN = 0xef NORMAL_NUN = 0xf0 FINAL_PE = 0xf3 NORMAL_PE = 0xf4 FINAL_TSADI = 0xf5 NORMAL_TSADI = 0xf6 # Minimum Visual vs Logical final letter score difference. # If the difference is below this, don't rely solely on the final letter score # distance. MIN_FINAL_CHAR_DISTANCE = 5 # Minimum Visual vs Logical model score difference. # If the difference is below this, don't rely at all on the model score # distance. MIN_MODEL_DISTANCE = 0.01 VISUAL_HEBREW_NAME = "ISO-8859-8" LOGICAL_HEBREW_NAME = "windows-1255" class HebrewProber(CharSetProber): def __init__(self): CharSetProber.__init__(self) self._mLogicalProber = None self._mVisualProber = None self.reset() def reset(self): self._mFinalCharLogicalScore = 0 self._mFinalCharVisualScore = 0 # The two last characters seen in the previous buffer, # mPrev and mBeforePrev are initialized to space in order to simulate # a word delimiter at the beginning of the data self._mPrev = ' ' self._mBeforePrev = ' ' # These probers are owned by the group prober. def set_model_probers(self, logicalProber, visualProber): self._mLogicalProber = logicalProber self._mVisualProber = visualProber def is_final(self, c): return wrap_ord(c) in [FINAL_KAF, FINAL_MEM, FINAL_NUN, FINAL_PE, FINAL_TSADI] def is_non_final(self, c): # The normal Tsadi is not a good Non-Final letter due to words like # 'lechotet' (to chat) containing an apostrophe after the tsadi. This # apostrophe is converted to a space in FilterWithoutEnglishLetters # causing the Non-Final tsadi to appear at an end of a word even # though this is not the case in the original text. # The letters Pe and Kaf rarely display a related behavior of not being # a good Non-Final letter. Words like 'Pop', 'Winamp' and 'Mubarak' # for example legally end with a Non-Final Pe or Kaf. However, the # benefit of these letters as Non-Final letters outweighs the damage # since these words are quite rare. return wrap_ord(c) in [NORMAL_KAF, NORMAL_MEM, NORMAL_NUN, NORMAL_PE] def feed(self, aBuf): # Final letter analysis for logical-visual decision. # Look for evidence that the received buffer is either logical Hebrew # or visual Hebrew. # The following cases are checked: # 1) A word longer than 1 letter, ending with a final letter. This is # an indication that the text is laid out "naturally" since the # final letter really appears at the end. +1 for logical score. # 2) A word longer than 1 letter, ending with a Non-Final letter. In # normal Hebrew, words ending with Kaf, Mem, Nun, Pe or Tsadi, # should not end with the Non-Final form of that letter. Exceptions # to this rule are mentioned above in isNonFinal(). This is an # indication that the text is laid out backwards. +1 for visual # score # 3) A word longer than 1 letter, starting with a final letter. Final # letters should not appear at the beginning of a word. This is an # indication that the text is laid out backwards. +1 for visual # score. # # The visual score and logical score are accumulated throughout the # text and are finally checked against each other in GetCharSetName(). # No checking for final letters in the middle of words is done since # that case is not an indication for either Logical or Visual text. # # We automatically filter out all 7-bit characters (replace them with # spaces) so the word boundary detection works properly. [MAP] if self.get_state() == eNotMe: # Both model probers say it's not them. No reason to continue. return eNotMe aBuf = self.filter_high_bit_only(aBuf) for cur in aBuf: if cur == ' ': # We stand on a space - a word just ended if self._mBeforePrev != ' ': # next-to-last char was not a space so self._mPrev is not a # 1 letter word if self.is_final(self._mPrev): # case (1) [-2:not space][-1:final letter][cur:space] self._mFinalCharLogicalScore += 1 elif self.is_non_final(self._mPrev): # case (2) [-2:not space][-1:Non-Final letter][ # cur:space] self._mFinalCharVisualScore += 1 else: # Not standing on a space if ((self._mBeforePrev == ' ') and (self.is_final(self._mPrev)) and (cur != ' ')): # case (3) [-2:space][-1:final letter][cur:not space] self._mFinalCharVisualScore += 1 self._mBeforePrev = self._mPrev self._mPrev = cur # Forever detecting, till the end or until both model probers return # eNotMe (handled above) return eDetecting def get_charset_name(self): # Make the decision: is it Logical or Visual? # If the final letter score distance is dominant enough, rely on it. finalsub = self._mFinalCharLogicalScore - self._mFinalCharVisualScore if finalsub >= MIN_FINAL_CHAR_DISTANCE: return LOGICAL_HEBREW_NAME if finalsub <= -MIN_FINAL_CHAR_DISTANCE: return VISUAL_HEBREW_NAME # It's not dominant enough, try to rely on the model scores instead. modelsub = (self._mLogicalProber.get_confidence() - self._mVisualProber.get_confidence()) if modelsub > MIN_MODEL_DISTANCE: return LOGICAL_HEBREW_NAME if modelsub < -MIN_MODEL_DISTANCE: return VISUAL_HEBREW_NAME # Still no good, back to final letter distance, maybe it'll save the # day. if finalsub < 0.0: return VISUAL_HEBREW_NAME # (finalsub > 0 - Logical) or (don't know what to do) default to # Logical. return LOGICAL_HEBREW_NAME def get_state(self): # Remain active as long as any of the model probers are active. if (self._mLogicalProber.get_state() == eNotMe) and \ (self._mVisualProber.get_state() == eNotMe): return eNotMe return eDetecting
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, 3515, 428, 3577, 5244, 279, 676, 199, 3, 20825, 2737, 701, 314, 6026, 9607, 787, 1898, 334, 35, 9, 11811, 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, 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, 6043, 19903, 492, 31727, 199, 504, 1275, 5559, 492, 325, 1763, 1352, 12, 325, 20064, 316, 199, 504, 1275, 5819, 492, 4816, 63, 2181, 199, 199, 3, 961, 16118, 3181, 1133, 5965, 27159, 282, 2637, 503, 282, 5960, 14, 199, 3, 2779, 365, 282, 5922, 16118, 367, 314, 675, 402, 314, 19771, 1402, 16118, 83, 199, 199, 5680, 1696, 9979, 305, 402, 314, 19771, 5960, 17319, 15415, 6754, 199, 3, 199, 3, 23843, 2446, 1495, 2193, 2187, 315, 19771, 26, 199, 3, 298, 7336, 13, 4830, 13, 24, 2, 446, 14702, 19771, 199, 3, 298, 8258, 13, 20197, 2, 446, 26303, 19771, 199, 3, 298, 7336, 13, 4830, 13, 24, 13, 41, 2, 446, 26303, 19771, 199, 3, 298, 88, 13, 3088, 13, 14557, 2, 446, 5805, 31, 26303, 19771, 5805, 31, 199, 3, 199, 3, 17650, 298, 7336, 2, 1495, 2193, 675, 282, 14793, 13130, 663, 402, 1233, 4501, 12, 29781, 199, 3, 298, 8258, 13, 20197, 2, 436, 298, 88, 13, 3088, 13, 14557, 2, 787, 2877, 3365, 5576, 1613, 2193, 402, 199, 3, 3520, 1233, 4501, 14, 10061, 13, 20197, 7890, 4722, 4110, 315, 314, 1425, 199, 3, 378, 88, 1257, 13, 16, 88, 25, 38, 465, 2005, 18576, 22929, 17370, 465, 5521, 465, 2005, 19771, 13, 6100, 199, 3, 487, 645, 322, 7769, 436, 4722, 283, 57, 344, 29159, 7, 1212, 71, 1463, 14435, 315, 314, 1425, 378, 1812, 16, 13, 16, 2207, 22, 14, 199, 3, 671, 13, 3088, 13, 14557, 7890, 8545, 4722, 1233, 4501, 1325, 543, 282, 3365, 199, 3, 4412, 14, 199, 3, 199, 3, 3709, 12474, 465, 376, 8095, 19771, 1318, 543, 949, 487, 645, 322, 7769, 365, 406, 2247, 7439, 12, 1006, 11648, 199, 3, 1495, 2193, 787, 13130, 543, 14021, 370, 1233, 4501, 14, 25136, 316, 626, 367, 314, 199, 3, 2446, 19771, 27230, 12, 1006, 11648, 2341, 314, 2011, 1338, 370, 1006, 8087, 19771, 14435, 199, 3, 334, 15768, 4242, 14435, 680, 199, 3, 199, 3, 710, 8266, 262, 867, 8865, 3382, 3520, 1495, 2193, 365, 3932, 7581, 6712, 14, 199, 3, 298, 15039, 2, 7581, 6712, 4910, 626, 314, 1318, 365, 7741, 465, 340, 314, 11889, 365, 199, 3, 440, 20381, 402, 282, 699, 28904, 14066, 5563, 14, 710, 11889, 542, 397, 314, 1318, 436, 199, 3, 5954, 83, 652, 687, 3602, 370, 2451, 14, 710, 1318, 6337, 1380, 7741, 13872, 300, 1183, 365, 1586, 199, 3, 8552, 14, 437, 3335, 402, 14702, 19771, 16711, 10734, 2839, 880, 26, 199, 3, 7369, 2019, 4349, 402, 1642, 1004, 14475, 76, 1146, 8552, 61, 359, 21224, 1004, 7741, 8552, 199, 3, 436, 14475, 76, 1146, 8552, 61, 359, 2246, 4349, 402, 1642, 1004, 14475, 76, 1146, 8552, 61, 199, 3, 359, 500, 402, 1004, 61, 359, 2019, 4349, 402, 3499, 1004, 61, 2263, 5423, 7, 298, 199, 3, 7791, 22929, 17370, 12, 5579, 436, 20144, 1318, 370, 13104, 1318, 365, 199, 3, 13872, 300, 1183, 2597, 298, 16948, 2, 436, 687, 3602, 370, 2451, 14, 199, 3, 199, 3, 298, 22455, 2, 7581, 6712, 4910, 314, 1318, 365, 7741, 298, 9468, 300, 1183, 2, 7182, 370, 199, 3, 314, 1865, 652, 365, 1586, 14, 2779, 365, 314, 9163, 4783, 402, 314, 11889, 370, 2929, 199, 3, 314, 1318, 687, 2451, 370, 3602, 14, 437, 699, 28904, 5563, 365, 1202, 370, 4192, 8605, 199, 3, 22929, 17370, 12, 5579, 436, 20144, 1318, 315, 314, 1318, 14, 199, 3, 199, 3, 4516, 83, 315, 671, 13, 3088, 13, 14557, 787, 18871, 26847, 370, 2342, 641, 314, 22026, 14, 11606, 199, 3, 4052, 12050, 24656, 5606, 473, 4293, 2342, 12, 652, 12237, 626, 2399, 8605, 7581, 6712, 199, 3, 365, 26303, 14, 199, 3, 199, 3, 4005, 3089, 1536, 1006, 402, 314, 3432, 12, 314, 19771, 5128, 316, 14729, 19428, 3595, 2877, 199, 3, 1495, 2193, 26, 199, 3, 14702, 19771, 446, 298, 7336, 13, 4830, 13, 24, 2, 446, 8552, 1318, 446, 644, 5630, 436, 24256, 787, 199, 3, 259, 8552, 1830, 1004, 1865, 365, 19981, 14, 2104, 5960, 17319, 15415, 12901, 199, 3, 259, 314, 1004, 1865, 365, 625, 19559, 334, 607, 10572, 12, 367, 642, 4514, 12, 2755, 199, 3, 259, 4349, 1865, 365, 625, 19559, 680, 199, 3, 26303, 19771, 446, 298, 8258, 13, 20197, 2, 446, 3293, 12, 13872, 300, 1183, 7741, 1318, 14, 199, 3, 199, 3, 298, 7336, 13, 4830, 13, 24, 13, 41, 2, 365, 282, 10026, 402, 10061, 13, 20197, 436, 3181, 1133, 1929, 370, 506, 199, 3, 259, 22543, 15836, 14, 199, 3, 298, 88, 13, 3088, 13, 14557, 2, 365, 2597, 15836, 465, 10061, 13, 20197 ]
[ 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, 3515, 428, 3577, 5244, 279, 676, 199, 3, 20825, 2737, 701, 314, 6026, 9607, 787, 1898, 334, 35, 9, 11811, 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, 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, 6043, 19903, 492, 31727, 199, 504, 1275, 5559, 492, 325, 1763, 1352, 12, 325, 20064, 316, 199, 504, 1275, 5819, 492, 4816, 63, 2181, 199, 199, 3, 961, 16118, 3181, 1133, 5965, 27159, 282, 2637, 503, 282, 5960, 14, 199, 3, 2779, 365, 282, 5922, 16118, 367, 314, 675, 402, 314, 19771, 1402, 16118, 83, 199, 199, 5680, 1696, 9979, 305, 402, 314, 19771, 5960, 17319, 15415, 6754, 199, 3, 199, 3, 23843, 2446, 1495, 2193, 2187, 315, 19771, 26, 199, 3, 298, 7336, 13, 4830, 13, 24, 2, 446, 14702, 19771, 199, 3, 298, 8258, 13, 20197, 2, 446, 26303, 19771, 199, 3, 298, 7336, 13, 4830, 13, 24, 13, 41, 2, 446, 26303, 19771, 199, 3, 298, 88, 13, 3088, 13, 14557, 2, 446, 5805, 31, 26303, 19771, 5805, 31, 199, 3, 199, 3, 17650, 298, 7336, 2, 1495, 2193, 675, 282, 14793, 13130, 663, 402, 1233, 4501, 12, 29781, 199, 3, 298, 8258, 13, 20197, 2, 436, 298, 88, 13, 3088, 13, 14557, 2, 787, 2877, 3365, 5576, 1613, 2193, 402, 199, 3, 3520, 1233, 4501, 14, 10061, 13, 20197, 7890, 4722, 4110, 315, 314, 1425, 199, 3, 378, 88, 1257, 13, 16, 88, 25, 38, 465, 2005, 18576, 22929, 17370, 465, 5521, 465, 2005, 19771, 13, 6100, 199, 3, 487, 645, 322, 7769, 436, 4722, 283, 57, 344, 29159, 7, 1212, 71, 1463, 14435, 315, 314, 1425, 378, 1812, 16, 13, 16, 2207, 22, 14, 199, 3, 671, 13, 3088, 13, 14557, 7890, 8545, 4722, 1233, 4501, 1325, 543, 282, 3365, 199, 3, 4412, 14, 199, 3, 199, 3, 3709, 12474, 465, 376, 8095, 19771, 1318, 543, 949, 487, 645, 322, 7769, 365, 406, 2247, 7439, 12, 1006, 11648, 199, 3, 1495, 2193, 787, 13130, 543, 14021, 370, 1233, 4501, 14, 25136, 316, 626, 367, 314, 199, 3, 2446, 19771, 27230, 12, 1006, 11648, 2341, 314, 2011, 1338, 370, 1006, 8087, 19771, 14435, 199, 3, 334, 15768, 4242, 14435, 680, 199, 3, 199, 3, 710, 8266, 262, 867, 8865, 3382, 3520, 1495, 2193, 365, 3932, 7581, 6712, 14, 199, 3, 298, 15039, 2, 7581, 6712, 4910, 626, 314, 1318, 365, 7741, 465, 340, 314, 11889, 365, 199, 3, 440, 20381, 402, 282, 699, 28904, 14066, 5563, 14, 710, 11889, 542, 397, 314, 1318, 436, 199, 3, 5954, 83, 652, 687, 3602, 370, 2451, 14, 710, 1318, 6337, 1380, 7741, 13872, 300, 1183, 365, 1586, 199, 3, 8552, 14, 437, 3335, 402, 14702, 19771, 16711, 10734, 2839, 880, 26, 199, 3, 7369, 2019, 4349, 402, 1642, 1004, 14475, 76, 1146, 8552, 61, 359, 21224, 1004, 7741, 8552, 199, 3, 436, 14475, 76, 1146, 8552, 61, 359, 2246, 4349, 402, 1642, 1004, 14475, 76, 1146, 8552, 61, 199, 3, 359, 500, 402, 1004, 61, 359, 2019, 4349, 402, 3499, 1004, 61, 2263, 5423, 7, 298, 199, 3, 7791, 22929, 17370, 12, 5579, 436, 20144, 1318, 370, 13104, 1318, 365, 199, 3, 13872, 300, 1183, 2597, 298, 16948, 2, 436, 687, 3602, 370, 2451, 14, 199, 3, 199, 3, 298, 22455, 2, 7581, 6712, 4910, 314, 1318, 365, 7741, 298, 9468, 300, 1183, 2, 7182, 370, 199, 3, 314, 1865, 652, 365, 1586, 14, 2779, 365, 314, 9163, 4783, 402, 314, 11889, 370, 2929, 199, 3, 314, 1318, 687, 2451, 370, 3602, 14, 437, 699, 28904, 5563, 365, 1202, 370, 4192, 8605, 199, 3, 22929, 17370, 12, 5579, 436, 20144, 1318, 315, 314, 1318, 14, 199, 3, 199, 3, 4516, 83, 315, 671, 13, 3088, 13, 14557, 787, 18871, 26847, 370, 2342, 641, 314, 22026, 14, 11606, 199, 3, 4052, 12050, 24656, 5606, 473, 4293, 2342, 12, 652, 12237, 626, 2399, 8605, 7581, 6712, 199, 3, 365, 26303, 14, 199, 3, 199, 3, 4005, 3089, 1536, 1006, 402, 314, 3432, 12, 314, 19771, 5128, 316, 14729, 19428, 3595, 2877, 199, 3, 1495, 2193, 26, 199, 3, 14702, 19771, 446, 298, 7336, 13, 4830, 13, 24, 2, 446, 8552, 1318, 446, 644, 5630, 436, 24256, 787, 199, 3, 259, 8552, 1830, 1004, 1865, 365, 19981, 14, 2104, 5960, 17319, 15415, 12901, 199, 3, 259, 314, 1004, 1865, 365, 625, 19559, 334, 607, 10572, 12, 367, 642, 4514, 12, 2755, 199, 3, 259, 4349, 1865, 365, 625, 19559, 680, 199, 3, 26303, 19771, 446, 298, 8258, 13, 20197, 2, 446, 3293, 12, 13872, 300, 1183, 7741, 1318, 14, 199, 3, 199, 3, 298, 7336, 13, 4830, 13, 24, 13, 41, 2, 365, 282, 10026, 402, 10061, 13, 20197, 436, 3181, 1133, 1929, 370, 506, 199, 3, 259, 22543, 15836, 14, 199, 3, 298, 88, 13, 3088, 13, 14557, 2, 365, 2597, 15836, 465, 10061, 13, 20197, 0 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,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The Johnson-Lindenstrauss bound for embedding with random projections ===================================================================== The `Johnson-Lindenstrauss lemma`_ states that any high dimensional dataset can be randomly projected into a lower dimensional Euclidean space while controlling the distortion in the pairwise distances. .. _`Johnson-Lindenstrauss lemma`: https://en.wikipedia.org/wiki/Johnson%E2%80%93Lindenstrauss_lemma Theoretical bounds ================== The distortion introduced by a random projection `p` is asserted by the fact that `p` is defining an eps-embedding with good probability as defined by: .. math:: (1 - eps) \|u - v\|^2 < \|p(u) - p(v)\|^2 < (1 + eps) \|u - v\|^2 Where u and v are any rows taken from a dataset of shape [n_samples, n_features] and p is a projection by a random Gaussian N(0, 1) matrix with shape [n_components, n_features] (or a sparse Achlioptas matrix). The minimum number of components to guarantees the eps-embedding is given by: .. math:: n\_components >= 4 log(n\_samples) / (eps^2 / 2 - eps^3 / 3) The first plot shows that with an increasing number of samples ``n_samples``, the minimal number of dimensions ``n_components`` increased logarithmically in order to guarantee an ``eps``-embedding. The second plot shows that an increase of the admissible distortion ``eps`` allows to reduce drastically the minimal number of dimensions ``n_components`` for a given number of samples ``n_samples`` Empirical validation ==================== We validate the above bounds on the digits dataset or on the 20 newsgroups text document (TF-IDF word frequencies) dataset: - for the digits dataset, some 8x8 gray level pixels data for 500 handwritten digits pictures are randomly projected to spaces for various larger number of dimensions ``n_components``. - for the 20 newsgroups dataset some 500 documents with 100k features in total are projected using a sparse random matrix to smaller euclidean spaces with various values for the target number of dimensions ``n_components``. The default dataset is the digits dataset. To run the example on the twenty newsgroups dataset, pass the --twenty-newsgroups command line argument to this script. For each value of ``n_components``, we plot: - 2D distribution of sample pairs with pairwise distances in original and projected spaces as x and y axis respectively. - 1D histogram of the ratio of those distances (projected / original). We can see that for low values of ``n_components`` the distribution is wide with many distorted pairs and a skewed distribution (due to the hard limit of zero ratio on the left as distances are always positives) while for larger values of n_components the distortion is controlled and the distances are well preserved by the random projection. Remarks ======= According to the JL lemma, projecting 500 samples without too much distortion will require at least several thousands dimensions, irrespective of the number of features of the original dataset. Hence using random projections on the digits dataset which only has 64 features in the input space does not make sense: it does not allow for dimensionality reduction in this case. On the twenty newsgroups on the other hand the dimensionality can be decreased from 56436 down to 10000 while reasonably preserving pairwise distances. """ print(__doc__) import sys from time import time import numpy as np import matplotlib.pyplot as plt from sklearn.random_projection import johnson_lindenstrauss_min_dim from sklearn.random_projection import SparseRandomProjection from sklearn.datasets import fetch_20newsgroups_vectorized from sklearn.datasets import load_digits from sklearn.metrics.pairwise import euclidean_distances # Part 1: plot the theoretical dependency between n_components_min and # n_samples # range of admissible distortions eps_range = np.linspace(0.1, 0.99, 5) colors = plt.cm.Blues(np.linspace(0.3, 1.0, len(eps_range))) # range of number of samples (observation) to embed n_samples_range = np.logspace(1, 9, 9) plt.figure() for eps, color in zip(eps_range, colors): min_n_components = johnson_lindenstrauss_min_dim(n_samples_range, eps=eps) plt.loglog(n_samples_range, min_n_components, color=color) plt.legend(["eps = %0.1f" % eps for eps in eps_range], loc="lower right") plt.xlabel("Number of observations to eps-embed") plt.ylabel("Minimum number of dimensions") plt.title("Johnson-Lindenstrauss bounds:\nn_samples vs n_components") # range of admissible distortions eps_range = np.linspace(0.01, 0.99, 100) # range of number of samples (observation) to embed n_samples_range = np.logspace(2, 6, 5) colors = plt.cm.Blues(np.linspace(0.3, 1.0, len(n_samples_range))) plt.figure() for n_samples, color in zip(n_samples_range, colors): min_n_components = johnson_lindenstrauss_min_dim(n_samples, eps=eps_range) plt.semilogy(eps_range, min_n_components, color=color) plt.legend(["n_samples = %d" % n for n in n_samples_range], loc="upper right") plt.xlabel("Distortion eps") plt.ylabel("Minimum number of dimensions") plt.title("Johnson-Lindenstrauss bounds:\nn_components vs eps") # Part 2: perform sparse random projection of some digits images which are # quite low dimensional and dense or documents of the 20 newsgroups dataset # which is both high dimensional and sparse if '--twenty-newsgroups' in sys.argv: # Need an internet connection hence not enabled by default data = fetch_20newsgroups_vectorized().data[:500] else: data = load_digits().data[:500] n_samples, n_features = data.shape print("Embedding %d samples with dim %d using various random projections" % (n_samples, n_features)) n_components_range = np.array([300, 1000, 10000]) dists = euclidean_distances(data, squared=True).ravel() # select only non-identical samples pairs nonzero = dists != 0 dists = dists[nonzero] for n_components in n_components_range: t0 = time() rp = SparseRandomProjection(n_components=n_components) projected_data = rp.fit_transform(data) print("Projected %d samples from %d to %d in %0.3fs" % (n_samples, n_features, n_components, time() - t0)) if hasattr(rp, 'components_'): n_bytes = rp.components_.data.nbytes n_bytes += rp.components_.indices.nbytes print("Random matrix with size: %0.3fMB" % (n_bytes / 1e6)) projected_dists = euclidean_distances( projected_data, squared=True).ravel()[nonzero] plt.figure() plt.hexbin(dists, projected_dists, gridsize=100, cmap=plt.cm.PuBu) plt.xlabel("Pairwise squared distances in original space") plt.ylabel("Pairwise squared distances in projected space") plt.title("Pairwise distances distribution for n_components=%d" % n_components) cb = plt.colorbar() cb.set_label('Sample pairs counts') rates = projected_dists / dists print("Mean distances rate: %0.2f (%0.2f)" % (np.mean(rates), np.std(rates))) plt.figure() plt.hist(rates, bins=50, normed=True, range=(0., 2.)) plt.xlabel("Squared distances rate: projected / original") plt.ylabel("Distribution of samples pairs") plt.title("Histogram of pairwise distance rates for n_components=%d" % n_components) # TODO: compute the expected value of eps and add them to the previous plot # as vertical lines / region plt.show()
bsd-3-clause
[ 82, 624, 199, 5695, 19989, 199, 1918, 7135, 25338, 265, 13, 27889, 848, 14183, 27678, 3914, 367, 12452, 543, 2196, 557, 6532, 2452, 199, 5695, 19989, 421, 199, 1918, 658, 5691, 25338, 265, 13, 27889, 848, 14183, 27678, 1026, 77, 391, 18417, 6363, 626, 1263, 4721, 28341, 199, 5214, 883, 506, 19311, 27294, 1901, 282, 5117, 28341, 662, 24941, 199, 2638, 1830, 30350, 314, 2917, 15029, 315, 314, 24859, 15108, 14, 199, 199, 703, 485, 64, 5691, 25338, 265, 13, 27889, 848, 14183, 27678, 1026, 77, 391, 8340, 4178, 921, 287, 14, 13961, 14, 1308, 15, 6797, 15, 5691, 25338, 265, 5, 37, 18, 5, 1257, 5, 3129, 27889, 848, 14183, 27678, 63, 3701, 391, 421, 199, 1918, 720, 3294, 10461, 199, 1280, 389, 199, 199, 1918, 2917, 15029, 21399, 701, 282, 2196, 14777, 658, 80, 64, 365, 465, 9449, 701, 199, 1589, 10572, 626, 658, 80, 64, 365, 12669, 376, 10245, 13, 14275, 543, 6954, 12224, 199, 305, 3247, 701, 26, 199, 199, 703, 3473, 447, 2043, 334, 17, 446, 10245, 9, 971, 92, 85, 446, 373, 60, 92, 62, 18, 665, 971, 92, 80, 8, 85, 9, 446, 299, 8, 86, 2862, 92, 62, 18, 665, 334, 17, 435, 10245, 9, 971, 92, 85, 446, 373, 60, 92, 62, 18, 199, 199, 26493, 399, 436, 373, 787, 1263, 4730, 9394, 687, 282, 4789, 402, 2215, 359, 78, 63, 3356, 12, 199, 78, 63, 3179, 61, 436, 299, 365, 282, 14777, 701, 282, 2196, 17131, 653, 8, 16, 12, 413, 9, 3634, 199, 1045, 2215, 359, 78, 63, 4608, 12, 302, 63, 3179, 61, 334, 269, 282, 5178, 437, 335, 317, 2992, 305, 3634, 680, 199, 199, 1918, 7481, 1329, 402, 7323, 370, 12072, 397, 314, 10245, 13, 14275, 365, 199, 11809, 701, 26, 199, 199, 703, 3473, 447, 2043, 302, 60, 63, 4608, 2356, 841, 943, 8, 78, 60, 63, 3356, 9, 1182, 334, 8277, 62, 18, 1182, 499, 446, 10245, 62, 19, 1182, 650, 9, 421, 199, 1918, 1642, 5137, 13703, 626, 543, 376, 22255, 1329, 402, 5845, 1124, 78, 63, 3356, 4542, 199, 1589, 13460, 1329, 402, 7365, 1124, 78, 63, 4608, 1040, 10035, 11185, 943, 18327, 77, 7288, 199, 262, 1865, 370, 24197, 376, 1124, 8277, 1040, 13, 14275, 14, 199, 199, 1918, 3499, 5137, 13703, 626, 376, 19781, 402, 314, 1503, 1292, 1164, 199, 2686, 15029, 1124, 8277, 1040, 6127, 370, 7114, 366, 345, 270, 7288, 314, 13460, 1329, 402, 199, 13320, 1124, 78, 63, 4608, 1040, 367, 282, 1627, 1329, 402, 5845, 1124, 78, 63, 3356, 1040, 421, 199, 24949, 6411, 199, 1280, 532, 199, 199, 6004, 4107, 314, 3432, 10461, 641, 314, 7576, 4789, 503, 641, 314, 3388, 19497, 2634, 199, 505, 2213, 334, 6145, 13, 998, 38, 4349, 22411, 9, 4789, 26, 199, 199, 13, 367, 314, 7576, 4789, 12, 2005, 1695, 88, 24, 21977, 2166, 11094, 666, 367, 6891, 523, 4926, 8938, 7576, 6682, 22004, 787, 19311, 27294, 370, 7883, 367, 7750, 523, 12142, 1329, 402, 7365, 1124, 78, 63, 4608, 4345, 199, 199, 13, 367, 314, 3388, 19497, 2634, 4789, 2005, 6891, 8247, 543, 2948, 75, 523, 4534, 315, 3141, 787, 27294, 1808, 282, 5178, 2196, 3634, 370, 12700, 523, 325, 24941, 7883, 543, 7750, 1338, 367, 314, 1347, 1329, 402, 7365, 523, 1124, 78, 63, 4608, 4345, 199, 199, 1918, 849, 4789, 365, 314, 7576, 4789, 14, 4005, 1255, 314, 2893, 641, 314, 8900, 287, 369, 199, 13224, 2634, 4789, 12, 986, 314, 1553, 8122, 287, 369, 13, 13224, 2634, 1414, 1004, 1423, 370, 642, 199, 1579, 14, 199, 199, 1858, 1924, 574, 402, 1124, 78, 63, 4608, 4542, 781, 5137, 26, 199, 199, 13, 499, 36, 4084, 402, 2690, 6342, 543, 24859, 15108, 315, 3379, 523, 436, 27294, 7883, 465, 671, 436, 612, 3114, 17342, 14, 199, 199, 13, 413, 36, 15379, 402, 314, 10463, 402, 5204, 15108, 334, 25554, 1182, 3379, 680, 199, 199, 6004, 883, 1937, 626, 367, 6465, 1338, 402, 1124, 78, 63, 4608, 1040, 314, 4084, 365, 20239, 199, 1045, 5002, 2917, 1376, 6342, 436, 282, 18380, 24084, 4084, 334, 11933, 370, 314, 7508, 199, 3097, 402, 4697, 10463, 641, 314, 3602, 465, 15108, 787, 3544, 27609, 9, 199, 6710, 367, 12142, 1338, 402, 302, 63, 4608, 314, 2917, 15029, 365, 22284, 199, 460, 314, 15108, 787, 5521, 17731, 701, 314, 2196, 14777, 14, 421, 199, 497, 10375, 199, 18673, 199, 199, 31497, 370, 314, 1603, 44, 1026, 77, 391, 12, 2199, 316, 6891, 5845, 1928, 4634, 8298, 2917, 15029, 199, 14117, 4409, 737, 5210, 9978, 294, 29737, 7365, 12, 8190, 470, 32759, 402, 314, 199, 1955, 402, 4534, 402, 314, 3379, 4789, 14, 199, 199, 40, 4894, 1808, 2196, 557, 6532, 2452, 641, 314, 7576, 4789, 1314, 1454, 965, 5049, 4534, 199, 262, 314, 1324, 4601, 1630, 440, 1852, 12249, 26, 652, 1630, 440, 2040, 367, 6240, 6712, 199, 22508, 315, 642, 1930, 14, 199, 199, 3314, 314, 8900, 287, 369, 19497, 2634, 641, 314, 1163, 4926, 314, 6240, 6712, 883, 506, 477, 1353, 11185, 199, 504, 959, 772, 1344, 3224, 370, 11630, 1830, 4499, 6665, 876, 14717, 24859, 15108, 14, 199, 199, 624, 199, 1361, 3460, 1301, 3368, 199, 199, 646, 984, 199, 504, 900, 492, 900, 199, 646, 2680, 465, 980, 199, 646, 8027, 14, 13563, 465, 4488, 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, 14531, 3883, 23706, 199, 504, 6357, 14, 12281, 492, 5267, 63, 1165, 13224, 2634, 63, 4106, 1759, 199, 504, 6357, 14, 12281, 492, 2248, 63, 7022, 199, 504, 6357, 14, 6759, 14, 25069, 492, 325, 24941, 63, 15482, 199, 199, 3, 14320, 413, 26, 5137, 314, 314, 720, 3294, 5936, 3382, 302, 63, 4608, 63, 827, 436, 199, 3, 302, 63, 3356, 199, 199, 3, 1425, 402, 1503, 1292, 1164, 2917, 18434, 199, 8277, 63, 1842, 275, 980, 14, 11649, 8, 16, 14, 17, 12, 378, 14, 1020, 12, 959, 9, 199, 7120, 275, 4488, 14, 4400, 14, 24613, 10138, 8, 1590, 14, 11649, 8, 16, 14, 19, 12, 413, 14, 16, 12, 822, 8, 8277, 63, 1842 ]
[ 624, 199, 5695, 19989, 199, 1918, 7135, 25338, 265, 13, 27889, 848, 14183, 27678, 3914, 367, 12452, 543, 2196, 557, 6532, 2452, 199, 5695, 19989, 421, 199, 1918, 658, 5691, 25338, 265, 13, 27889, 848, 14183, 27678, 1026, 77, 391, 18417, 6363, 626, 1263, 4721, 28341, 199, 5214, 883, 506, 19311, 27294, 1901, 282, 5117, 28341, 662, 24941, 199, 2638, 1830, 30350, 314, 2917, 15029, 315, 314, 24859, 15108, 14, 199, 199, 703, 485, 64, 5691, 25338, 265, 13, 27889, 848, 14183, 27678, 1026, 77, 391, 8340, 4178, 921, 287, 14, 13961, 14, 1308, 15, 6797, 15, 5691, 25338, 265, 5, 37, 18, 5, 1257, 5, 3129, 27889, 848, 14183, 27678, 63, 3701, 391, 421, 199, 1918, 720, 3294, 10461, 199, 1280, 389, 199, 199, 1918, 2917, 15029, 21399, 701, 282, 2196, 14777, 658, 80, 64, 365, 465, 9449, 701, 199, 1589, 10572, 626, 658, 80, 64, 365, 12669, 376, 10245, 13, 14275, 543, 6954, 12224, 199, 305, 3247, 701, 26, 199, 199, 703, 3473, 447, 2043, 334, 17, 446, 10245, 9, 971, 92, 85, 446, 373, 60, 92, 62, 18, 665, 971, 92, 80, 8, 85, 9, 446, 299, 8, 86, 2862, 92, 62, 18, 665, 334, 17, 435, 10245, 9, 971, 92, 85, 446, 373, 60, 92, 62, 18, 199, 199, 26493, 399, 436, 373, 787, 1263, 4730, 9394, 687, 282, 4789, 402, 2215, 359, 78, 63, 3356, 12, 199, 78, 63, 3179, 61, 436, 299, 365, 282, 14777, 701, 282, 2196, 17131, 653, 8, 16, 12, 413, 9, 3634, 199, 1045, 2215, 359, 78, 63, 4608, 12, 302, 63, 3179, 61, 334, 269, 282, 5178, 437, 335, 317, 2992, 305, 3634, 680, 199, 199, 1918, 7481, 1329, 402, 7323, 370, 12072, 397, 314, 10245, 13, 14275, 365, 199, 11809, 701, 26, 199, 199, 703, 3473, 447, 2043, 302, 60, 63, 4608, 2356, 841, 943, 8, 78, 60, 63, 3356, 9, 1182, 334, 8277, 62, 18, 1182, 499, 446, 10245, 62, 19, 1182, 650, 9, 421, 199, 1918, 1642, 5137, 13703, 626, 543, 376, 22255, 1329, 402, 5845, 1124, 78, 63, 3356, 4542, 199, 1589, 13460, 1329, 402, 7365, 1124, 78, 63, 4608, 1040, 10035, 11185, 943, 18327, 77, 7288, 199, 262, 1865, 370, 24197, 376, 1124, 8277, 1040, 13, 14275, 14, 199, 199, 1918, 3499, 5137, 13703, 626, 376, 19781, 402, 314, 1503, 1292, 1164, 199, 2686, 15029, 1124, 8277, 1040, 6127, 370, 7114, 366, 345, 270, 7288, 314, 13460, 1329, 402, 199, 13320, 1124, 78, 63, 4608, 1040, 367, 282, 1627, 1329, 402, 5845, 1124, 78, 63, 3356, 1040, 421, 199, 24949, 6411, 199, 1280, 532, 199, 199, 6004, 4107, 314, 3432, 10461, 641, 314, 7576, 4789, 503, 641, 314, 3388, 19497, 2634, 199, 505, 2213, 334, 6145, 13, 998, 38, 4349, 22411, 9, 4789, 26, 199, 199, 13, 367, 314, 7576, 4789, 12, 2005, 1695, 88, 24, 21977, 2166, 11094, 666, 367, 6891, 523, 4926, 8938, 7576, 6682, 22004, 787, 19311, 27294, 370, 7883, 367, 7750, 523, 12142, 1329, 402, 7365, 1124, 78, 63, 4608, 4345, 199, 199, 13, 367, 314, 3388, 19497, 2634, 4789, 2005, 6891, 8247, 543, 2948, 75, 523, 4534, 315, 3141, 787, 27294, 1808, 282, 5178, 2196, 3634, 370, 12700, 523, 325, 24941, 7883, 543, 7750, 1338, 367, 314, 1347, 1329, 402, 7365, 523, 1124, 78, 63, 4608, 4345, 199, 199, 1918, 849, 4789, 365, 314, 7576, 4789, 14, 4005, 1255, 314, 2893, 641, 314, 8900, 287, 369, 199, 13224, 2634, 4789, 12, 986, 314, 1553, 8122, 287, 369, 13, 13224, 2634, 1414, 1004, 1423, 370, 642, 199, 1579, 14, 199, 199, 1858, 1924, 574, 402, 1124, 78, 63, 4608, 4542, 781, 5137, 26, 199, 199, 13, 499, 36, 4084, 402, 2690, 6342, 543, 24859, 15108, 315, 3379, 523, 436, 27294, 7883, 465, 671, 436, 612, 3114, 17342, 14, 199, 199, 13, 413, 36, 15379, 402, 314, 10463, 402, 5204, 15108, 334, 25554, 1182, 3379, 680, 199, 199, 6004, 883, 1937, 626, 367, 6465, 1338, 402, 1124, 78, 63, 4608, 1040, 314, 4084, 365, 20239, 199, 1045, 5002, 2917, 1376, 6342, 436, 282, 18380, 24084, 4084, 334, 11933, 370, 314, 7508, 199, 3097, 402, 4697, 10463, 641, 314, 3602, 465, 15108, 787, 3544, 27609, 9, 199, 6710, 367, 12142, 1338, 402, 302, 63, 4608, 314, 2917, 15029, 365, 22284, 199, 460, 314, 15108, 787, 5521, 17731, 701, 314, 2196, 14777, 14, 421, 199, 497, 10375, 199, 18673, 199, 199, 31497, 370, 314, 1603, 44, 1026, 77, 391, 12, 2199, 316, 6891, 5845, 1928, 4634, 8298, 2917, 15029, 199, 14117, 4409, 737, 5210, 9978, 294, 29737, 7365, 12, 8190, 470, 32759, 402, 314, 199, 1955, 402, 4534, 402, 314, 3379, 4789, 14, 199, 199, 40, 4894, 1808, 2196, 557, 6532, 2452, 641, 314, 7576, 4789, 1314, 1454, 965, 5049, 4534, 199, 262, 314, 1324, 4601, 1630, 440, 1852, 12249, 26, 652, 1630, 440, 2040, 367, 6240, 6712, 199, 22508, 315, 642, 1930, 14, 199, 199, 3314, 314, 8900, 287, 369, 19497, 2634, 641, 314, 1163, 4926, 314, 6240, 6712, 883, 506, 477, 1353, 11185, 199, 504, 959, 772, 1344, 3224, 370, 11630, 1830, 4499, 6665, 876, 14717, 24859, 15108, 14, 199, 199, 624, 199, 1361, 3460, 1301, 3368, 199, 199, 646, 984, 199, 504, 900, 492, 900, 199, 646, 2680, 465, 980, 199, 646, 8027, 14, 13563, 465, 4488, 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, 14531, 3883, 23706, 199, 504, 6357, 14, 12281, 492, 5267, 63, 1165, 13224, 2634, 63, 4106, 1759, 199, 504, 6357, 14, 12281, 492, 2248, 63, 7022, 199, 504, 6357, 14, 6759, 14, 25069, 492, 325, 24941, 63, 15482, 199, 199, 3, 14320, 413, 26, 5137, 314, 314, 720, 3294, 5936, 3382, 302, 63, 4608, 63, 827, 436, 199, 3, 302, 63, 3356, 199, 199, 3, 1425, 402, 1503, 1292, 1164, 2917, 18434, 199, 8277, 63, 1842, 275, 980, 14, 11649, 8, 16, 14, 17, 12, 378, 14, 1020, 12, 959, 9, 199, 7120, 275, 4488, 14, 4400, 14, 24613, 10138, 8, 1590, 14, 11649, 8, 16, 14, 19, 12, 413, 14, 16, 12, 822, 8, 8277, 63, 1842, 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 ]
sharhar/USB-Thing
UpdaterFiles/Lib/python-3.5.1.amd64/Lib/wsgiref/simple_server.py
86
5153
"""BaseHTTPServer that implements the Python WSGI protocol (PEP 3333) This is both an example of how WSGI can be implemented, and a basis for running simple web applications on a local machine, such as might be done when testing or debugging an application. It has not been reviewed for security issues, however, and we strongly recommend that you use a "real" web server for production use. For example usage, see the 'if __name__=="__main__"' block at the end of the module. See also the BaseHTTPServer module docs for other API information. """ from http.server import BaseHTTPRequestHandler, HTTPServer import sys import urllib.parse from wsgiref.handlers import SimpleHandler from platform import python_implementation __version__ = "0.2" __all__ = ['WSGIServer', 'WSGIRequestHandler', 'demo_app', 'make_server'] server_version = "WSGIServer/" + __version__ sys_version = python_implementation() + "/" + sys.version.split()[0] software_version = server_version + ' ' + sys_version class ServerHandler(SimpleHandler): server_software = software_version def close(self): try: self.request_handler.log_request( self.status.split(' ',1)[0], self.bytes_sent ) finally: SimpleHandler.close(self) class WSGIServer(HTTPServer): """BaseHTTPServer that implements the Python WSGI protocol""" application = None def server_bind(self): """Override server_bind to store the server name.""" HTTPServer.server_bind(self) self.setup_environ() def setup_environ(self): # Set up base environment env = self.base_environ = {} env['SERVER_NAME'] = self.server_name env['GATEWAY_INTERFACE'] = 'CGI/1.1' env['SERVER_PORT'] = str(self.server_port) env['REMOTE_HOST']='' env['CONTENT_LENGTH']='' env['SCRIPT_NAME'] = '' def get_app(self): return self.application def set_app(self,application): self.application = application class WSGIRequestHandler(BaseHTTPRequestHandler): server_version = "WSGIServer/" + __version__ def get_environ(self): env = self.server.base_environ.copy() env['SERVER_PROTOCOL'] = self.request_version env['SERVER_SOFTWARE'] = self.server_version env['REQUEST_METHOD'] = self.command if '?' in self.path: path,query = self.path.split('?',1) else: path,query = self.path,'' env['PATH_INFO'] = urllib.parse.unquote_to_bytes(path).decode('iso-8859-1') env['QUERY_STRING'] = query host = self.address_string() if host != self.client_address[0]: env['REMOTE_HOST'] = host env['REMOTE_ADDR'] = self.client_address[0] if self.headers.get('content-type') is None: env['CONTENT_TYPE'] = self.headers.get_content_type() else: env['CONTENT_TYPE'] = self.headers['content-type'] length = self.headers.get('content-length') if length: env['CONTENT_LENGTH'] = length for k, v in self.headers.items(): k=k.replace('-','_').upper(); v=v.strip() if k in env: continue # skip content length, type,etc. if 'HTTP_'+k in env: env['HTTP_'+k] += ','+v # comma-separate multiple headers else: env['HTTP_'+k] = v return env def get_stderr(self): return sys.stderr def handle(self): """Handle a single HTTP request""" self.raw_requestline = self.rfile.readline(65537) if len(self.raw_requestline) > 65536: self.requestline = '' self.request_version = '' self.command = '' self.send_error(414) return if not self.parse_request(): # An error code has been sent, just exit return handler = ServerHandler( self.rfile, self.wfile, self.get_stderr(), self.get_environ() ) handler.request_handler = self # backpointer for logging handler.run(self.server.get_app()) def demo_app(environ,start_response): from io import StringIO stdout = StringIO() print("Hello world!", file=stdout) print(file=stdout) h = sorted(environ.items()) for k,v in h: print(k,'=',repr(v), file=stdout) start_response("200 OK", [('Content-Type','text/plain; charset=utf-8')]) return [stdout.getvalue().encode("utf-8")] def make_server( host, port, app, server_class=WSGIServer, handler_class=WSGIRequestHandler ): """Create a new WSGI server listening on `host` and `port` for `app`""" server = server_class((host, port), handler_class) server.set_app(app) return server if __name__ == '__main__': httpd = make_server('', 8000, demo_app) sa = httpd.socket.getsockname() print("Serving HTTP on", sa[0], "port", sa[1], "...") import webbrowser webbrowser.open('http://localhost:8000/xyz?abc') httpd.handle_request() # serve one request, then exit httpd.server_close()
apache-2.0
[ 624, 1563, 14938, 626, 9031, 314, 2018, 9279, 4113, 334, 25633, 650, 11769, 9, 199, 199, 2765, 365, 3865, 376, 2893, 402, 4212, 9279, 883, 506, 6366, 12, 436, 282, 5597, 367, 3879, 199, 4129, 3330, 13103, 641, 282, 2257, 6844, 12, 4066, 465, 5594, 506, 4224, 1380, 5343, 199, 269, 10201, 376, 4223, 14, 221, 2779, 965, 440, 2757, 11248, 379, 367, 6391, 10876, 12, 199, 526, 1129, 422, 12, 436, 781, 30390, 27747, 626, 1265, 675, 282, 298, 3093, 2, 3330, 1654, 367, 199, 10777, 675, 14, 199, 199, 1858, 2893, 4503, 12, 1937, 314, 283, 692, 636, 354, 363, 11800, 363, 973, 363, 4507, 1853, 737, 314, 1284, 402, 314, 199, 578, 14, 221, 1666, 2597, 314, 3523, 14938, 859, 9149, 367, 1163, 3261, 2556, 14, 199, 624, 199, 199, 504, 1455, 14, 1000, 492, 3523, 23518, 12, 3101, 3120, 199, 646, 984, 199, 646, 4011, 14, 1122, 199, 504, 12464, 1121, 14, 5586, 492, 5870, 2461, 199, 504, 4298, 492, 2366, 63, 12236, 199, 199, 363, 1023, 363, 275, 298, 16, 14, 18, 2, 199, 363, 452, 363, 275, 788, 55, 28732, 297, 283, 16828, 11149, 297, 283, 8768, 63, 571, 297, 283, 1875, 63, 1000, 418, 421, 199, 1000, 63, 1023, 275, 298, 55, 28732, 6687, 435, 636, 1023, 363, 199, 1274, 63, 1023, 275, 2366, 63, 12236, 342, 435, 10609, 435, 984, 14, 1023, 14, 1294, 3430, 16, 61, 199, 15619, 63, 1023, 275, 1654, 63, 1023, 435, 283, 283, 435, 984, 63, 1023, 421, 199, 533, 7146, 2461, 8, 3184, 2461, 304, 339, 1654, 63, 15619, 275, 2032, 63, 1023, 339, 347, 4002, 8, 277, 304, 267, 862, 26, 288, 291, 14, 1069, 63, 2232, 14, 793, 63, 1069, 8, 355, 291, 14, 1205, 14, 1294, 360, 1656, 17, 2788, 16, 467, 291, 14, 2394, 63, 1150, 288, 776, 267, 3753, 26, 288, 5870, 2461, 14, 1600, 8, 277, 9, 4388, 199, 533, 644, 28732, 8, 14938, 304, 339, 408, 1563, 14938, 626, 9031, 314, 2018, 9279, 4113, 624, 339, 4223, 275, 488, 339, 347, 1654, 63, 3409, 8, 277, 304, 267, 408, 11954, 1654, 63, 3409, 370, 3877, 314, 1654, 536, 1041, 267, 3101, 3120, 14, 1000, 63, 3409, 8, 277, 9, 267, 291, 14, 2758, 63, 2314, 342, 339, 347, 3272, 63, 2314, 8, 277, 304, 267, 327, 2494, 1536, 1300, 3734, 267, 2589, 275, 291, 14, 1095, 63, 2314, 275, 1052, 267, 2589, 459, 6613, 63, 2339, 418, 275, 291, 14, 1000, 63, 354, 267, 2589, 459, 26624, 17488, 63, 17598, 418, 275, 283, 21337, 15, 17, 14, 17, 7, 267, 2589, 459, 6613, 63, 3657, 418, 275, 620, 8, 277, 14, 1000, 63, 719, 9, 267, 2589, 459, 16058, 63, 5449, 418, 19070, 267, 2589, 459, 9663, 63, 9127, 418, 19070, 267, 2589, 459, 10484, 63, 2339, 418, 275, 2125, 339, 347, 664, 63, 571, 8, 277, 304, 267, 372, 291, 14, 3578, 339, 347, 663, 63, 571, 8, 277, 12, 3578, 304, 267, 291, 14, 3578, 275, 4223, 4388, 199, 533, 9279, 11149, 8, 1563, 23518, 304, 339, 1654, 63, 1023, 275, 298, 55, 28732, 6687, 435, 636, 1023, 363, 339, 347, 664, 63, 2314, 8, 277, 304, 267, 2589, 275, 291, 14, 1000, 14, 1095, 63, 2314, 14, 1574, 342, 267, 2589, 459, 6613, 63, 9583, 418, 275, 291, 14, 1069, 63, 1023, 267, 2589, 459, 6613, 63, 26734, 418, 275, 291, 14, 1000, 63, 1023, 267, 2589, 459, 6780, 63, 9977, 418, 275, 291, 14, 1531, 267, 340, 15539, 315, 291, 14, 515, 26, 288, 931, 12, 1131, 275, 291, 14, 515, 14, 1294, 360, 7044, 17, 9, 267, 587, 26, 288, 931, 12, 1131, 275, 291, 14, 515, 12, 891, 398, 2589, 459, 3243, 63, 4531, 418, 275, 4011, 14, 1122, 14, 12240, 63, 475, 63, 2394, 8, 515, 680, 2708, 360, 4595, 13, 4830, 13, 17, 358, 267, 2589, 459, 11938, 63, 5353, 418, 275, 1827, 398, 1591, 275, 291, 14, 1562, 63, 875, 342, 267, 340, 1591, 1137, 291, 14, 1258, 63, 1562, 59, 16, 2189, 288, 2589, 459, 16058, 63, 5449, 418, 275, 1591, 267, 2589, 459, 16058, 63, 7803, 418, 275, 291, 14, 1258, 63, 1562, 59, 16, 61, 398, 340, 291, 14, 2139, 14, 362, 360, 1317, 13, 466, 358, 365, 488, 26, 288, 2589, 459, 9663, 63, 2711, 418, 275, 291, 14, 2139, 14, 362, 63, 1317, 63, 466, 342, 267, 587, 26, 288, 2589, 459, 9663, 63, 2711, 418, 275, 291, 14, 2139, 459, 1317, 13, 466, 418, 398, 2582, 275, 291, 14, 2139, 14, 362, 360, 1317, 13, 1267, 358, 267, 340, 2582, 26, 288, 2589, 459, 9663, 63, 9127, 418, 275, 2582, 398, 367, 1022, 12, 373, 315, 291, 14, 2139, 14, 1744, 837, 288, 1022, 29, 75, 14, 1814, 3654, 1673, 63, 1959, 4142, 7303, 373, 29, 86, 14, 1913, 342, 288, 340, 1022, 315, 2589, 26, 355, 1980, 8540, 327, 3372, 1564, 2582, 12, 730, 12, 6839, 14, 288, 340, 283, 2856, 20013, 75, 315, 2589, 26, 355, 2589, 459, 2856, 20013, 75, 61, 847, 1656, 6828, 86, 258, 327, 10029, 13, 24904, 3663, 2323, 288, 587, 26, 355, 2589, 459, 2856, 20013, 75, 61, 275, 373, 267, 372, 2589, 339, 347, 664, 63, 3083, 8, 277, 304, 267, 372, 984, 14, 3083, 339, 347, 2429, 8, 277, 304, 267, 408, 5940, 282, 2849, 3101, 1056, 624, 398, 291, 14, 1773, 63, 1069, 604, 275, 291, 14, 23830, 14, 6407, 8, 10027, 1401, 9, 267, 340, 822, 8, 277, 14, 1773, 63, 1069, 604, 9, 690, 25980, 26, 288, 291, 14, 1069, 604, 275, 2125, 288, 291, 14, 1069, 63, 1023, 275, 2125, 288, 291, 14, 1531, 275, 2125, 288, 291, 14, 2254, 63, 705, 8, 25250, 9, 288, 372, 398, 340, 440, 291, 14, 1122, 63, 1069, 837, 327, 1626, 1125, 1233, 965, 2757, 4847, 12, 2951, 4458, 288, 372, 398, 3016, 275, 7146, 2461, 8, 288, 291, 14, 23830, 12, 291, 14, 18076, 12, 291, 14, 362, 63, 3083, 1062, 291, 14, 362, 63, 2314, 342, 267, 776, 267, 3016, 14, 1069, 63, 2232, 275, 291, 420, 327, 1771, 3929, 367, 2050, 267, 3016, 14, 1065 ]
[ 1563, 14938, 626, 9031, 314, 2018, 9279, 4113, 334, 25633, 650, 11769, 9, 199, 199, 2765, 365, 3865, 376, 2893, 402, 4212, 9279, 883, 506, 6366, 12, 436, 282, 5597, 367, 3879, 199, 4129, 3330, 13103, 641, 282, 2257, 6844, 12, 4066, 465, 5594, 506, 4224, 1380, 5343, 199, 269, 10201, 376, 4223, 14, 221, 2779, 965, 440, 2757, 11248, 379, 367, 6391, 10876, 12, 199, 526, 1129, 422, 12, 436, 781, 30390, 27747, 626, 1265, 675, 282, 298, 3093, 2, 3330, 1654, 367, 199, 10777, 675, 14, 199, 199, 1858, 2893, 4503, 12, 1937, 314, 283, 692, 636, 354, 363, 11800, 363, 973, 363, 4507, 1853, 737, 314, 1284, 402, 314, 199, 578, 14, 221, 1666, 2597, 314, 3523, 14938, 859, 9149, 367, 1163, 3261, 2556, 14, 199, 624, 199, 199, 504, 1455, 14, 1000, 492, 3523, 23518, 12, 3101, 3120, 199, 646, 984, 199, 646, 4011, 14, 1122, 199, 504, 12464, 1121, 14, 5586, 492, 5870, 2461, 199, 504, 4298, 492, 2366, 63, 12236, 199, 199, 363, 1023, 363, 275, 298, 16, 14, 18, 2, 199, 363, 452, 363, 275, 788, 55, 28732, 297, 283, 16828, 11149, 297, 283, 8768, 63, 571, 297, 283, 1875, 63, 1000, 418, 421, 199, 1000, 63, 1023, 275, 298, 55, 28732, 6687, 435, 636, 1023, 363, 199, 1274, 63, 1023, 275, 2366, 63, 12236, 342, 435, 10609, 435, 984, 14, 1023, 14, 1294, 3430, 16, 61, 199, 15619, 63, 1023, 275, 1654, 63, 1023, 435, 283, 283, 435, 984, 63, 1023, 421, 199, 533, 7146, 2461, 8, 3184, 2461, 304, 339, 1654, 63, 15619, 275, 2032, 63, 1023, 339, 347, 4002, 8, 277, 304, 267, 862, 26, 288, 291, 14, 1069, 63, 2232, 14, 793, 63, 1069, 8, 355, 291, 14, 1205, 14, 1294, 360, 1656, 17, 2788, 16, 467, 291, 14, 2394, 63, 1150, 288, 776, 267, 3753, 26, 288, 5870, 2461, 14, 1600, 8, 277, 9, 4388, 199, 533, 644, 28732, 8, 14938, 304, 339, 408, 1563, 14938, 626, 9031, 314, 2018, 9279, 4113, 624, 339, 4223, 275, 488, 339, 347, 1654, 63, 3409, 8, 277, 304, 267, 408, 11954, 1654, 63, 3409, 370, 3877, 314, 1654, 536, 1041, 267, 3101, 3120, 14, 1000, 63, 3409, 8, 277, 9, 267, 291, 14, 2758, 63, 2314, 342, 339, 347, 3272, 63, 2314, 8, 277, 304, 267, 327, 2494, 1536, 1300, 3734, 267, 2589, 275, 291, 14, 1095, 63, 2314, 275, 1052, 267, 2589, 459, 6613, 63, 2339, 418, 275, 291, 14, 1000, 63, 354, 267, 2589, 459, 26624, 17488, 63, 17598, 418, 275, 283, 21337, 15, 17, 14, 17, 7, 267, 2589, 459, 6613, 63, 3657, 418, 275, 620, 8, 277, 14, 1000, 63, 719, 9, 267, 2589, 459, 16058, 63, 5449, 418, 19070, 267, 2589, 459, 9663, 63, 9127, 418, 19070, 267, 2589, 459, 10484, 63, 2339, 418, 275, 2125, 339, 347, 664, 63, 571, 8, 277, 304, 267, 372, 291, 14, 3578, 339, 347, 663, 63, 571, 8, 277, 12, 3578, 304, 267, 291, 14, 3578, 275, 4223, 4388, 199, 533, 9279, 11149, 8, 1563, 23518, 304, 339, 1654, 63, 1023, 275, 298, 55, 28732, 6687, 435, 636, 1023, 363, 339, 347, 664, 63, 2314, 8, 277, 304, 267, 2589, 275, 291, 14, 1000, 14, 1095, 63, 2314, 14, 1574, 342, 267, 2589, 459, 6613, 63, 9583, 418, 275, 291, 14, 1069, 63, 1023, 267, 2589, 459, 6613, 63, 26734, 418, 275, 291, 14, 1000, 63, 1023, 267, 2589, 459, 6780, 63, 9977, 418, 275, 291, 14, 1531, 267, 340, 15539, 315, 291, 14, 515, 26, 288, 931, 12, 1131, 275, 291, 14, 515, 14, 1294, 360, 7044, 17, 9, 267, 587, 26, 288, 931, 12, 1131, 275, 291, 14, 515, 12, 891, 398, 2589, 459, 3243, 63, 4531, 418, 275, 4011, 14, 1122, 14, 12240, 63, 475, 63, 2394, 8, 515, 680, 2708, 360, 4595, 13, 4830, 13, 17, 358, 267, 2589, 459, 11938, 63, 5353, 418, 275, 1827, 398, 1591, 275, 291, 14, 1562, 63, 875, 342, 267, 340, 1591, 1137, 291, 14, 1258, 63, 1562, 59, 16, 2189, 288, 2589, 459, 16058, 63, 5449, 418, 275, 1591, 267, 2589, 459, 16058, 63, 7803, 418, 275, 291, 14, 1258, 63, 1562, 59, 16, 61, 398, 340, 291, 14, 2139, 14, 362, 360, 1317, 13, 466, 358, 365, 488, 26, 288, 2589, 459, 9663, 63, 2711, 418, 275, 291, 14, 2139, 14, 362, 63, 1317, 63, 466, 342, 267, 587, 26, 288, 2589, 459, 9663, 63, 2711, 418, 275, 291, 14, 2139, 459, 1317, 13, 466, 418, 398, 2582, 275, 291, 14, 2139, 14, 362, 360, 1317, 13, 1267, 358, 267, 340, 2582, 26, 288, 2589, 459, 9663, 63, 9127, 418, 275, 2582, 398, 367, 1022, 12, 373, 315, 291, 14, 2139, 14, 1744, 837, 288, 1022, 29, 75, 14, 1814, 3654, 1673, 63, 1959, 4142, 7303, 373, 29, 86, 14, 1913, 342, 288, 340, 1022, 315, 2589, 26, 355, 1980, 8540, 327, 3372, 1564, 2582, 12, 730, 12, 6839, 14, 288, 340, 283, 2856, 20013, 75, 315, 2589, 26, 355, 2589, 459, 2856, 20013, 75, 61, 847, 1656, 6828, 86, 258, 327, 10029, 13, 24904, 3663, 2323, 288, 587, 26, 355, 2589, 459, 2856, 20013, 75, 61, 275, 373, 267, 372, 2589, 339, 347, 664, 63, 3083, 8, 277, 304, 267, 372, 984, 14, 3083, 339, 347, 2429, 8, 277, 304, 267, 408, 5940, 282, 2849, 3101, 1056, 624, 398, 291, 14, 1773, 63, 1069, 604, 275, 291, 14, 23830, 14, 6407, 8, 10027, 1401, 9, 267, 340, 822, 8, 277, 14, 1773, 63, 1069, 604, 9, 690, 25980, 26, 288, 291, 14, 1069, 604, 275, 2125, 288, 291, 14, 1069, 63, 1023, 275, 2125, 288, 291, 14, 1531, 275, 2125, 288, 291, 14, 2254, 63, 705, 8, 25250, 9, 288, 372, 398, 340, 440, 291, 14, 1122, 63, 1069, 837, 327, 1626, 1125, 1233, 965, 2757, 4847, 12, 2951, 4458, 288, 372, 398, 3016, 275, 7146, 2461, 8, 288, 291, 14, 23830, 12, 291, 14, 18076, 12, 291, 14, 362, 63, 3083, 1062, 291, 14, 362, 63, 2314, 342, 267, 776, 267, 3016, 14, 1069, 63, 2232, 275, 291, 420, 327, 1771, 3929, 367, 2050, 267, 3016, 14, 1065, 0 ]
[ 1, 1, 1, 1, 1, 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romium-42.0.2311.135
third_party/protobuf/python/google/protobuf/internal/message_cpp_test.py
215
1929
#! /usr/bin/python # # Protocol Buffers - Google's data interchange format # Copyright 2008 Google Inc. All rights reserved. # http://code.google.com/p/protobuf/ # # 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. """Tests for google.protobuf.internal.message_cpp.""" __author__ = '[email protected] (Shahms King)' import os os.environ['PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION'] = 'cpp' import unittest from google.protobuf.internal.message_test import * if __name__ == '__main__': unittest.main()
bsd-3-clause
[ 3168, 1182, 2647, 15, 1393, 15, 1548, 199, 3, 199, 3, 11557, 699, 3043, 1192, 446, 4475, 1159, 666, 1640, 1461, 1475, 199, 3, 1898, 9079, 4475, 3277, 14, 221, 2900, 4481, 4644, 14, 199, 3, 1455, 921, 600, 14, 3098, 14, 957, 15, 80, 15, 7204, 15, 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, 2925, 367, 6233, 14, 7204, 14, 4672, 14, 1188, 63, 5910, 1041, 199, 199, 363, 2502, 363, 275, 283, 4835, 72, 706, 32, 3098, 14, 957, 334, 23527, 72, 706, 1804, 316, 3171, 199, 199, 646, 747, 199, 736, 14, 2314, 459, 9583, 63, 10255, 3960, 63, 11720, 63, 8947, 10320, 2594, 418, 275, 283, 5910, 7, 199, 199, 646, 2882, 199, 504, 6233, 14, 7204, 14, 4672, 14, 1188, 63, 396, 492, 627, 421, 199, 692, 636, 354, 363, 508, 2560, 973, 3706, 523, 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 ]
[ 1182, 2647, 15, 1393, 15, 1548, 199, 3, 199, 3, 11557, 699, 3043, 1192, 446, 4475, 1159, 666, 1640, 1461, 1475, 199, 3, 1898, 9079, 4475, 3277, 14, 221, 2900, 4481, 4644, 14, 199, 3, 1455, 921, 600, 14, 3098, 14, 957, 15, 80, 15, 7204, 15, 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, 2925, 367, 6233, 14, 7204, 14, 4672, 14, 1188, 63, 5910, 1041, 199, 199, 363, 2502, 363, 275, 283, 4835, 72, 706, 32, 3098, 14, 957, 334, 23527, 72, 706, 1804, 316, 3171, 199, 199, 646, 747, 199, 736, 14, 2314, 459, 9583, 63, 10255, 3960, 63, 11720, 63, 8947, 10320, 2594, 418, 275, 283, 5910, 7, 199, 199, 646, 2882, 199, 504, 6233, 14, 7204, 14, 4672, 14, 1188, 63, 396, 492, 627, 421, 199, 692, 636, 354, 363, 508, 2560, 973, 3706, 523, 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, 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 ]
louiskun/flaskGIT
venv/lib/python2.7/site-packages/alembic/util/messaging.py
40
2442
from .compat import py27, binary_type, string_types import sys from sqlalchemy.engine import url import warnings import textwrap import collections import logging log = logging.getLogger(__name__) if py27: # disable "no handler found" errors logging.getLogger('alembic').addHandler(logging.NullHandler()) try: import fcntl import termios import struct ioctl = fcntl.ioctl(0, termios.TIOCGWINSZ, struct.pack('HHHH', 0, 0, 0, 0)) _h, TERMWIDTH, _hp, _wp = struct.unpack('HHHH', ioctl) if TERMWIDTH <= 0: # can occur if running in emacs pseudo-tty TERMWIDTH = None except (ImportError, IOError): TERMWIDTH = None def write_outstream(stream, *text): encoding = getattr(stream, 'encoding', 'ascii') or 'ascii' for t in text: if not isinstance(t, binary_type): t = t.encode(encoding, 'replace') t = t.decode(encoding) try: stream.write(t) except IOError: # suppress "broken pipe" errors. # no known way to handle this on Python 3 however # as the exception is "ignored" (noisily) in TextIOWrapper. break def status(_statmsg, fn, *arg, **kw): msg(_statmsg + " ...", False) try: ret = fn(*arg, **kw) write_outstream(sys.stdout, " done\n") return ret except: write_outstream(sys.stdout, " FAILED\n") raise def err(message): log.error(message) msg("FAILED: %s" % message) sys.exit(-1) def obfuscate_url_pw(u): u = url.make_url(u) if u.password: u.password = 'XXXXX' return str(u) def warn(msg): warnings.warn(msg) def msg(msg, newline=True): if TERMWIDTH is None: write_outstream(sys.stdout, msg) if newline: write_outstream(sys.stdout, "\n") else: # left indent output lines lines = textwrap.wrap(msg, TERMWIDTH) if len(lines) > 1: for line in lines[0:-1]: write_outstream(sys.stdout, " ", line, "\n") write_outstream(sys.stdout, " ", lines[-1], ("\n" if newline else "")) def format_as_comma(value): if value is None: return "" elif isinstance(value, string_types): return value elif isinstance(value, collections.Iterable): return ", ".join(value) else: raise ValueError("Don't know how to comma-format %r" % value)
mit
[ 504, 1275, 5819, 492, 1134, 1465, 12, 3366, 63, 466, 12, 1059, 63, 1313, 199, 646, 984, 199, 504, 8335, 14, 3908, 492, 1166, 199, 646, 3598, 199, 646, 13390, 199, 646, 5055, 199, 646, 2050, 199, 199, 793, 275, 2050, 14, 5572, 3460, 354, 3368, 199, 199, 692, 1134, 1465, 26, 272, 327, 3507, 298, 889, 3016, 1911, 2, 2552, 272, 2050, 14, 5572, 360, 1895, 20596, 1959, 18826, 8, 4806, 14, 8849, 2461, 1012, 421, 199, 893, 26, 272, 492, 12871, 272, 492, 28725, 272, 492, 2702, 272, 5890, 8077, 275, 12871, 14, 2308, 8077, 8, 16, 12, 28725, 14, 52, 2090, 4064, 7941, 18101, 12, 717, 2702, 14, 1389, 360, 10213, 10213, 297, 378, 12, 378, 12, 378, 12, 378, 430, 272, 485, 72, 12, 31510, 45, 11139, 12, 485, 12025, 12, 485, 14649, 275, 2702, 14, 5301, 360, 10213, 10213, 297, 5890, 8077, 9, 272, 340, 31510, 45, 11139, 2695, 378, 26, 221, 327, 883, 4781, 340, 3879, 315, 325, 19309, 15984, 13, 4707, 267, 31510, 45, 11139, 275, 488, 199, 2590, 334, 17825, 12, 5925, 304, 272, 31510, 45, 11139, 275, 488, 421, 199, 318, 2218, 63, 548, 1745, 8, 1745, 12, 627, 505, 304, 272, 2644, 275, 2519, 8, 1745, 12, 283, 2991, 297, 283, 4371, 358, 503, 283, 4371, 7, 272, 367, 307, 315, 1318, 26, 267, 340, 440, 1228, 8, 84, 12, 3366, 63, 466, 304, 288, 307, 275, 307, 14, 2143, 8, 2991, 12, 283, 1814, 358, 267, 307, 275, 307, 14, 2708, 8, 2991, 9, 267, 862, 26, 288, 2547, 14, 952, 8, 84, 9, 267, 871, 5925, 26, 288, 327, 15678, 298, 15697, 5200, 2, 2552, 14, 288, 327, 949, 6040, 4340, 370, 2429, 642, 641, 2018, 650, 13432, 288, 327, 465, 314, 1919, 365, 298, 11996, 2, 334, 889, 29022, 590, 9, 315, 4516, 29365, 14, 288, 2059, 421, 199, 318, 2004, 1547, 3736, 1328, 12, 4325, 12, 627, 1273, 12, 1011, 829, 304, 272, 1499, 1547, 3736, 1328, 435, 298, 2263, 401, 756, 9, 272, 862, 26, 267, 2203, 275, 4325, 2031, 1273, 12, 1011, 829, 9, 267, 2218, 63, 548, 1745, 8, 1274, 14, 2703, 12, 298, 4224, 60, 78, 531, 267, 372, 2203, 272, 871, 26, 267, 2218, 63, 548, 1745, 8, 1274, 14, 2703, 12, 298, 26892, 60, 78, 531, 267, 746, 421, 199, 318, 2329, 8, 1188, 304, 272, 943, 14, 705, 8, 1188, 9, 272, 1499, 480, 12299, 26, 450, 83, 2, 450, 1245, 9, 272, 984, 14, 2224, 2801, 17, 9, 421, 199, 318, 2607, 31958, 1411, 63, 633, 63, 8796, 8, 85, 304, 272, 399, 275, 1166, 14, 1875, 63, 633, 8, 85, 9, 272, 340, 399, 14, 2060, 26, 267, 399, 14, 2060, 275, 283, 6873, 56, 7, 272, 372, 620, 8, 85, 9, 421, 199, 318, 7987, 8, 1328, 304, 272, 3598, 14, 4050, 8, 1328, 9, 421, 199, 318, 1499, 8, 1328, 12, 8057, 29, 549, 304, 272, 340, 31510, 45, 11139, 365, 488, 26, 267, 2218, 63, 548, 1745, 8, 1274, 14, 2703, 12, 1499, 9, 267, 340, 8057, 26, 288, 2218, 63, 548, 1745, 8, 1274, 14, 2703, 12, 1867, 78, 531, 272, 587, 26, 267, 327, 3602, 4363, 1072, 2385, 267, 2385, 275, 13390, 14, 3823, 8, 1328, 12, 31510, 45, 11139, 9, 267, 340, 822, 8, 1278, 9, 690, 413, 26, 288, 367, 1004, 315, 2385, 59, 16, 6809, 17, 2189, 355, 2218, 63, 548, 1745, 8, 1274, 14, 2703, 12, 298, 221, 3872, 1004, 12, 1867, 78, 531, 267, 2218, 63, 548, 1745, 8, 1274, 14, 2703, 12, 298, 221, 3872, 2385, 1988, 17, 467, 25381, 78, 2, 340, 8057, 587, 25491, 421, 199, 318, 1475, 63, 305, 63, 13184, 8, 585, 304, 272, 340, 574, 365, 488, 26, 267, 372, 3087, 272, 916, 1228, 8, 585, 12, 1059, 63, 1313, 304, 267, 372, 574, 272, 916, 1228, 8, 585, 12, 5055, 14, 20852, 304, 267, 372, 3872, 3680, 904, 8, 585, 9, 272, 587, 26, 267, 746, 1722, 480, 16932, 1133, 5715, 4212, 370, 10029, 13, 908, 450, 82, 2, 450, 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 ]
[ 1275, 5819, 492, 1134, 1465, 12, 3366, 63, 466, 12, 1059, 63, 1313, 199, 646, 984, 199, 504, 8335, 14, 3908, 492, 1166, 199, 646, 3598, 199, 646, 13390, 199, 646, 5055, 199, 646, 2050, 199, 199, 793, 275, 2050, 14, 5572, 3460, 354, 3368, 199, 199, 692, 1134, 1465, 26, 272, 327, 3507, 298, 889, 3016, 1911, 2, 2552, 272, 2050, 14, 5572, 360, 1895, 20596, 1959, 18826, 8, 4806, 14, 8849, 2461, 1012, 421, 199, 893, 26, 272, 492, 12871, 272, 492, 28725, 272, 492, 2702, 272, 5890, 8077, 275, 12871, 14, 2308, 8077, 8, 16, 12, 28725, 14, 52, 2090, 4064, 7941, 18101, 12, 717, 2702, 14, 1389, 360, 10213, 10213, 297, 378, 12, 378, 12, 378, 12, 378, 430, 272, 485, 72, 12, 31510, 45, 11139, 12, 485, 12025, 12, 485, 14649, 275, 2702, 14, 5301, 360, 10213, 10213, 297, 5890, 8077, 9, 272, 340, 31510, 45, 11139, 2695, 378, 26, 221, 327, 883, 4781, 340, 3879, 315, 325, 19309, 15984, 13, 4707, 267, 31510, 45, 11139, 275, 488, 199, 2590, 334, 17825, 12, 5925, 304, 272, 31510, 45, 11139, 275, 488, 421, 199, 318, 2218, 63, 548, 1745, 8, 1745, 12, 627, 505, 304, 272, 2644, 275, 2519, 8, 1745, 12, 283, 2991, 297, 283, 4371, 358, 503, 283, 4371, 7, 272, 367, 307, 315, 1318, 26, 267, 340, 440, 1228, 8, 84, 12, 3366, 63, 466, 304, 288, 307, 275, 307, 14, 2143, 8, 2991, 12, 283, 1814, 358, 267, 307, 275, 307, 14, 2708, 8, 2991, 9, 267, 862, 26, 288, 2547, 14, 952, 8, 84, 9, 267, 871, 5925, 26, 288, 327, 15678, 298, 15697, 5200, 2, 2552, 14, 288, 327, 949, 6040, 4340, 370, 2429, 642, 641, 2018, 650, 13432, 288, 327, 465, 314, 1919, 365, 298, 11996, 2, 334, 889, 29022, 590, 9, 315, 4516, 29365, 14, 288, 2059, 421, 199, 318, 2004, 1547, 3736, 1328, 12, 4325, 12, 627, 1273, 12, 1011, 829, 304, 272, 1499, 1547, 3736, 1328, 435, 298, 2263, 401, 756, 9, 272, 862, 26, 267, 2203, 275, 4325, 2031, 1273, 12, 1011, 829, 9, 267, 2218, 63, 548, 1745, 8, 1274, 14, 2703, 12, 298, 4224, 60, 78, 531, 267, 372, 2203, 272, 871, 26, 267, 2218, 63, 548, 1745, 8, 1274, 14, 2703, 12, 298, 26892, 60, 78, 531, 267, 746, 421, 199, 318, 2329, 8, 1188, 304, 272, 943, 14, 705, 8, 1188, 9, 272, 1499, 480, 12299, 26, 450, 83, 2, 450, 1245, 9, 272, 984, 14, 2224, 2801, 17, 9, 421, 199, 318, 2607, 31958, 1411, 63, 633, 63, 8796, 8, 85, 304, 272, 399, 275, 1166, 14, 1875, 63, 633, 8, 85, 9, 272, 340, 399, 14, 2060, 26, 267, 399, 14, 2060, 275, 283, 6873, 56, 7, 272, 372, 620, 8, 85, 9, 421, 199, 318, 7987, 8, 1328, 304, 272, 3598, 14, 4050, 8, 1328, 9, 421, 199, 318, 1499, 8, 1328, 12, 8057, 29, 549, 304, 272, 340, 31510, 45, 11139, 365, 488, 26, 267, 2218, 63, 548, 1745, 8, 1274, 14, 2703, 12, 1499, 9, 267, 340, 8057, 26, 288, 2218, 63, 548, 1745, 8, 1274, 14, 2703, 12, 1867, 78, 531, 272, 587, 26, 267, 327, 3602, 4363, 1072, 2385, 267, 2385, 275, 13390, 14, 3823, 8, 1328, 12, 31510, 45, 11139, 9, 267, 340, 822, 8, 1278, 9, 690, 413, 26, 288, 367, 1004, 315, 2385, 59, 16, 6809, 17, 2189, 355, 2218, 63, 548, 1745, 8, 1274, 14, 2703, 12, 298, 221, 3872, 1004, 12, 1867, 78, 531, 267, 2218, 63, 548, 1745, 8, 1274, 14, 2703, 12, 298, 221, 3872, 2385, 1988, 17, 467, 25381, 78, 2, 340, 8057, 587, 25491, 421, 199, 318, 1475, 63, 305, 63, 13184, 8, 585, 304, 272, 340, 574, 365, 488, 26, 267, 372, 3087, 272, 916, 1228, 8, 585, 12, 1059, 63, 1313, 304, 267, 372, 574, 272, 916, 1228, 8, 585, 12, 5055, 14, 20852, 304, 267, 372, 3872, 3680, 904, 8, 585, 9, 272, 587, 26, 267, 746, 1722, 480, 16932, 1133, 5715, 4212, 370, 10029, 13, 908, 450, 82, 2, 450, 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, 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,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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 ]
ftomassetti/intellij-community
python/helpers/pydev/third_party/pep8/lib2to3/lib2to3/main.py
250
11605
""" Main program for 2to3. """ from __future__ import with_statement import sys import os import difflib import logging import shutil import optparse from . import refactor def diff_texts(a, b, filename): """Return a unified diff of two strings.""" a = a.splitlines() b = b.splitlines() return difflib.unified_diff(a, b, filename, filename, "(original)", "(refactored)", lineterm="") class StdoutRefactoringTool(refactor.MultiprocessRefactoringTool): """ A refactoring tool that can avoid overwriting its input files. Prints output to stdout. Output files can optionally be written to a different directory and or have an extra file suffix appended to their name for use in situations where you do not want to replace the input files. """ def __init__(self, fixers, options, explicit, nobackups, show_diffs, input_base_dir='', output_dir='', append_suffix=''): """ Args: fixers: A list of fixers to import. options: A dict with RefactoringTool configuration. explicit: A list of fixers to run even if they are explicit. nobackups: If true no backup '.bak' files will be created for those files that are being refactored. show_diffs: Should diffs of the refactoring be printed to stdout? input_base_dir: The base directory for all input files. This class will strip this path prefix off of filenames before substituting it with output_dir. Only meaningful if output_dir is supplied. All files processed by refactor() must start with this path. output_dir: If supplied, all converted files will be written into this directory tree instead of input_base_dir. append_suffix: If supplied, all files output by this tool will have this appended to their filename. Useful for changing .py to .py3 for example by passing append_suffix='3'. """ self.nobackups = nobackups self.show_diffs = show_diffs if input_base_dir and not input_base_dir.endswith(os.sep): input_base_dir += os.sep self._input_base_dir = input_base_dir self._output_dir = output_dir self._append_suffix = append_suffix super(StdoutRefactoringTool, self).__init__(fixers, options, explicit) def log_error(self, msg, *args, **kwargs): self.errors.append((msg, args, kwargs)) self.logger.error(msg, *args, **kwargs) def write_file(self, new_text, filename, old_text, encoding): orig_filename = filename if self._output_dir: if filename.startswith(self._input_base_dir): filename = os.path.join(self._output_dir, filename[len(self._input_base_dir):]) else: raise ValueError('filename %s does not start with the ' 'input_base_dir %s' % ( filename, self._input_base_dir)) if self._append_suffix: filename += self._append_suffix if orig_filename != filename: output_dir = os.path.dirname(filename) if not os.path.isdir(output_dir): os.makedirs(output_dir) self.log_message('Writing converted %s to %s.', orig_filename, filename) if not self.nobackups: # Make backup backup = filename + ".bak" if os.path.lexists(backup): try: os.remove(backup) except os.error, err: self.log_message("Can't remove backup %s", backup) try: os.rename(filename, backup) except os.error, err: self.log_message("Can't rename %s to %s", filename, backup) # Actually write the new file write = super(StdoutRefactoringTool, self).write_file write(new_text, filename, old_text, encoding) if not self.nobackups: shutil.copymode(backup, filename) if orig_filename != filename: # Preserve the file mode in the new output directory. shutil.copymode(orig_filename, filename) def print_output(self, old, new, filename, equal): if equal: self.log_message("No changes to %s", filename) else: self.log_message("Refactored %s", filename) if self.show_diffs: diff_lines = diff_texts(old, new, filename) try: if self.output_lock is not None: with self.output_lock: for line in diff_lines: print line sys.stdout.flush() else: for line in diff_lines: print line except UnicodeEncodeError: warn("couldn't encode %s's diff for your terminal" % (filename,)) return def warn(msg): print >> sys.stderr, "WARNING: %s" % (msg,) def main(fixer_pkg, args=None): """Main program. Args: fixer_pkg: the name of a package where the fixers are located. args: optional; a list of command line arguments. If omitted, sys.argv[1:] is used. Returns a suggested exit status (0, 1, 2). """ # Set up option parser parser = optparse.OptionParser(usage="2to3 [options] file|dir ...") parser.add_option("-d", "--doctests_only", action="store_true", help="Fix up doctests only") parser.add_option("-f", "--fix", action="append", default=[], help="Each FIX specifies a transformation; default: all") parser.add_option("-j", "--processes", action="store", default=1, type="int", help="Run 2to3 concurrently") parser.add_option("-x", "--nofix", action="append", default=[], help="Prevent a transformation from being run") parser.add_option("-l", "--list-fixes", action="store_true", help="List available transformations") parser.add_option("-p", "--print-function", action="store_true", help="Modify the grammar so that print() is a function") parser.add_option("-v", "--verbose", action="store_true", help="More verbose logging") parser.add_option("--no-diffs", action="store_true", help="Don't show diffs of the refactoring") parser.add_option("-w", "--write", action="store_true", help="Write back modified files") parser.add_option("-n", "--nobackups", action="store_true", default=False, help="Don't write backups for modified files") parser.add_option("-o", "--output-dir", action="store", type="str", default="", help="Put output files in this directory " "instead of overwriting the input files. Requires -n.") parser.add_option("-W", "--write-unchanged-files", action="store_true", help="Also write files even if no changes were required" " (useful with --output-dir); implies -w.") parser.add_option("--add-suffix", action="store", type="str", default="", help="Append this string to all output filenames." " Requires -n if non-empty. " "ex: --add-suffix='3' will generate .py3 files.") # Parse command line arguments refactor_stdin = False flags = {} options, args = parser.parse_args(args) if options.write_unchanged_files: flags["write_unchanged_files"] = True if not options.write: warn("--write-unchanged-files/-W implies -w.") options.write = True # If we allowed these, the original files would be renamed to backup names # but not replaced. if options.output_dir and not options.nobackups: parser.error("Can't use --output-dir/-o without -n.") if options.add_suffix and not options.nobackups: parser.error("Can't use --add-suffix without -n.") if not options.write and options.no_diffs: warn("not writing files and not printing diffs; that's not very useful") if not options.write and options.nobackups: parser.error("Can't use -n without -w") if options.list_fixes: print "Available transformations for the -f/--fix option:" for fixname in refactor.get_all_fix_names(fixer_pkg): print fixname if not args: return 0 if not args: print >> sys.stderr, "At least one file or directory argument required." print >> sys.stderr, "Use --help to show usage." return 2 if "-" in args: refactor_stdin = True if options.write: print >> sys.stderr, "Can't write to stdin." return 2 if options.print_function: flags["print_function"] = True # Set up logging handler level = logging.DEBUG if options.verbose else logging.INFO logging.basicConfig(format='%(name)s: %(message)s', level=level) logger = logging.getLogger('lib2to3.main') # Initialize the refactoring tool avail_fixes = set(refactor.get_fixers_from_package(fixer_pkg)) unwanted_fixes = set(fixer_pkg + ".fix_" + fix for fix in options.nofix) explicit = set() if options.fix: all_present = False for fix in options.fix: if fix == "all": all_present = True else: explicit.add(fixer_pkg + ".fix_" + fix) requested = avail_fixes.union(explicit) if all_present else explicit else: requested = avail_fixes.union(explicit) fixer_names = requested.difference(unwanted_fixes) input_base_dir = os.path.commonprefix(args) if (input_base_dir and not input_base_dir.endswith(os.sep) and not os.path.isdir(input_base_dir)): # One or more similar names were passed, their directory is the base. # os.path.commonprefix() is ignorant of path elements, this corrects # for that weird API. input_base_dir = os.path.dirname(input_base_dir) if options.output_dir: input_base_dir = input_base_dir.rstrip(os.sep) logger.info('Output in %r will mirror the input directory %r layout.', options.output_dir, input_base_dir) rt = StdoutRefactoringTool( sorted(fixer_names), flags, sorted(explicit), options.nobackups, not options.no_diffs, input_base_dir=input_base_dir, output_dir=options.output_dir, append_suffix=options.add_suffix) # Refactor all files and directories passed as arguments if not rt.errors: if refactor_stdin: rt.refactor_stdin() else: try: rt.refactor(args, options.write, options.doctests_only, options.processes) except refactor.MultiprocessingUnsupported: assert options.processes > 1 print >> sys.stderr, "Sorry, -j isn't " \ "supported on this platform." return 1 rt.summarize() # Return error status (0 if rt.errors is zero) return int(bool(rt.errors))
apache-2.0
[ 624, 199, 6756, 2240, 367, 499, 475, 19, 14, 199, 624, 199, 199, 504, 636, 2443, 363, 492, 543, 63, 6242, 199, 199, 646, 984, 199, 646, 747, 199, 646, 27070, 199, 646, 2050, 199, 646, 5145, 199, 646, 8691, 199, 199, 504, 1275, 492, 24200, 421, 199, 318, 3915, 63, 19517, 8, 65, 12, 330, 12, 1788, 304, 272, 408, 1767, 282, 25344, 3915, 402, 2877, 3326, 1041, 272, 282, 275, 282, 14, 7644, 342, 272, 330, 275, 330, 14, 7644, 342, 272, 372, 27070, 14, 32180, 63, 3028, 8, 65, 12, 330, 12, 1788, 12, 1788, 12, 1816, 7340, 5043, 4186, 7340, 264, 7783, 2908, 4186, 1816, 1004, 5125, 18413, 421, 199, 533, 20992, 548, 497, 4778, 316, 5157, 8, 264, 4778, 14, 3947, 1412, 497, 4778, 316, 5157, 304, 272, 408, 272, 437, 24200, 316, 4744, 626, 883, 5126, 32592, 2399, 1324, 1584, 14, 272, 9101, 83, 1072, 370, 3839, 14, 339, 7242, 1584, 883, 14190, 506, 5313, 370, 282, 3365, 2082, 436, 503, 272, 1172, 376, 2402, 570, 4739, 11544, 370, 3932, 536, 367, 675, 315, 24325, 272, 2382, 1265, 886, 440, 2934, 370, 3350, 314, 1324, 1584, 14, 272, 408, 339, 347, 636, 826, 721, 277, 12, 5325, 1192, 12, 1511, 12, 5027, 12, 949, 27376, 12, 2498, 63, 17418, 12, 326, 1324, 63, 1095, 63, 694, 4581, 1072, 63, 694, 4581, 5666, 63, 4511, 9280, 267, 408, 267, 3033, 26, 288, 5325, 1192, 26, 437, 769, 402, 5325, 1192, 370, 492, 14, 288, 1511, 26, 437, 1211, 543, 799, 4778, 316, 5157, 2897, 14, 288, 5027, 26, 437, 769, 402, 5325, 1192, 370, 1255, 2755, 340, 2985, 787, 5027, 14, 288, 949, 27376, 26, 982, 2549, 949, 6902, 1987, 27162, 7, 1584, 911, 506, 2737, 367, 5204, 355, 1584, 626, 787, 3769, 295, 7783, 2908, 14, 288, 2498, 63, 17418, 26, 7719, 14981, 402, 314, 24200, 316, 506, 12487, 370, 3839, 31, 288, 1324, 63, 1095, 63, 694, 26, 710, 1300, 2082, 367, 1006, 1324, 1584, 14, 221, 961, 1021, 355, 911, 6202, 642, 931, 2403, 2331, 402, 6203, 2544, 10004, 4655, 355, 652, 543, 1072, 63, 694, 14, 221, 5972, 26562, 340, 1072, 63, 694, 365, 6841, 14, 355, 2900, 1584, 7686, 701, 24200, 342, 1471, 1343, 543, 642, 931, 14, 288, 1072, 63, 694, 26, 982, 6841, 12, 1006, 6702, 1584, 911, 506, 5313, 1901, 355, 642, 2082, 3123, 3140, 402, 1324, 63, 1095, 63, 694, 14, 288, 5666, 63, 4511, 26, 982, 6841, 12, 1006, 1584, 1072, 701, 642, 4744, 911, 1172, 355, 642, 11544, 370, 3932, 1788, 14, 221, 18491, 367, 13729, 1275, 647, 370, 355, 1275, 647, 19, 367, 2893, 701, 9476, 5666, 63, 4511, 534, 19, 1370, 267, 408, 267, 291, 14, 889, 27376, 275, 949, 27376, 267, 291, 14, 2384, 63, 17418, 275, 2498, 63, 17418, 267, 340, 1324, 63, 1095, 63, 694, 436, 440, 1324, 63, 1095, 63, 694, 14, 4130, 8, 736, 14, 4127, 304, 288, 1324, 63, 1095, 63, 694, 847, 747, 14, 4127, 267, 291, 423, 1210, 63, 1095, 63, 694, 275, 1324, 63, 1095, 63, 694, 267, 291, 423, 1199, 63, 694, 275, 1072, 63, 694, 267, 291, 423, 740, 63, 4511, 275, 5666, 63, 4511, 267, 1613, 8, 26080, 497, 4778, 316, 5157, 12, 291, 2843, 826, 721, 970, 1192, 12, 1511, 12, 5027, 9, 339, 347, 943, 63, 705, 8, 277, 12, 1499, 12, 627, 589, 12, 1011, 958, 304, 267, 291, 14, 2550, 14, 740, 1332, 1328, 12, 1249, 12, 2074, 430, 267, 291, 14, 2921, 14, 705, 8, 1328, 12, 627, 589, 12, 1011, 958, 9, 339, 347, 2218, 63, 493, 8, 277, 12, 892, 63, 505, 12, 1788, 12, 2269, 63, 505, 12, 2644, 304, 267, 2306, 63, 1501, 275, 1788, 267, 340, 291, 423, 1199, 63, 694, 26, 288, 340, 1788, 14, 2460, 8, 277, 423, 1210, 63, 1095, 63, 694, 304, 355, 1788, 275, 747, 14, 515, 14, 904, 8, 277, 423, 1199, 63, 694, 12, 3147, 1788, 59, 552, 8, 277, 423, 1210, 63, 1095, 63, 694, 304, 566, 288, 587, 26, 355, 746, 1722, 360, 1501, 450, 83, 1630, 440, 1343, 543, 314, 283, 639, 283, 1210, 63, 1095, 63, 694, 450, 83, 7, 450, 334, 1460, 1788, 12, 291, 423, 1210, 63, 1095, 63, 694, 430, 267, 340, 291, 423, 740, 63, 4511, 26, 288, 1788, 847, 291, 423, 740, 63, 4511, 267, 340, 2306, 63, 1501, 1137, 1788, 26, 288, 1072, 63, 694, 275, 747, 14, 515, 14, 3475, 8, 1501, 9, 288, 340, 440, 747, 14, 515, 14, 6027, 8, 1199, 63, 694, 304, 355, 747, 14, 8347, 8, 1199, 63, 694, 9, 288, 291, 14, 793, 63, 1188, 360, 16646, 6702, 450, 83, 370, 450, 83, 3130, 2306, 63, 1501, 12, 2490, 1788, 9, 267, 340, 440, 291, 14, 889, 27376, 26, 288, 327, 4155, 6902, 288, 6902, 275, 1788, 435, 3680, 27162, 2, 288, 340, 747, 14, 515, 14, 3113, 1670, 8, 5751, 304, 355, 862, 26, 490, 747, 14, 2168, 8, 5751, 9, 355, 871, 747, 14, 705, 12, 2329, 26, 490, 291, 14, 793, 63, 1188, 480, 6049, 1133, 2813, 6902, 450, 83, 401, 6902, 9, 288, 862, 26, 355, 747, 14, 8165, 8, 1501, 12, 6902, 9, 288, 871, 747, 14, 705, 12, 2329, 26, 355, 291, 14, 793, 63, 1188, 480, 6049, 1133, 11441, 450, 83, 370, 450, 83, 401, 1788, 12, 6902, 9, 267, 327, 18982, 3163, 2218, 314, 892, 570, 267, 2218, 275, 1613, 8, 26080, 497, 4778, 316, 5157, 12, 291, 680, 952, 63, 493, 267, 2218, 8, 1222, 63, 505, 12, 1788, 12, 2269, 63, 505, 12, 2644, 9, 267, 340, 440, 291, 14, 889, 27376, 26, 288, 5145, 14, 1574, 632, 8, 5751, 12, 1788, 9, 267, 340, 2306, 63, 1501, 1137, 1788, 26, 288, 327, 5543, 4909, 314, 570, 818, 315, 314, 892, 1072, 2082, 14, 288, 5145, 14, 1574, 632, 8, 2981, 63, 1501, 12, 1788, 9, 339, 347, 870, 63, 1199, 8, 277, 12, 2269, 12, 892, 12, 1788, 12, 4472, 304, 267, 340, 4472, 26, 288, 291, 14, 793, 63, 1188, 480, 1944, 4493, 370, 450, 83, 401, 1788 ]
[ 199, 6756, 2240, 367, 499, 475, 19, 14, 199, 624, 199, 199, 504, 636, 2443, 363, 492, 543, 63, 6242, 199, 199, 646, 984, 199, 646, 747, 199, 646, 27070, 199, 646, 2050, 199, 646, 5145, 199, 646, 8691, 199, 199, 504, 1275, 492, 24200, 421, 199, 318, 3915, 63, 19517, 8, 65, 12, 330, 12, 1788, 304, 272, 408, 1767, 282, 25344, 3915, 402, 2877, 3326, 1041, 272, 282, 275, 282, 14, 7644, 342, 272, 330, 275, 330, 14, 7644, 342, 272, 372, 27070, 14, 32180, 63, 3028, 8, 65, 12, 330, 12, 1788, 12, 1788, 12, 1816, 7340, 5043, 4186, 7340, 264, 7783, 2908, 4186, 1816, 1004, 5125, 18413, 421, 199, 533, 20992, 548, 497, 4778, 316, 5157, 8, 264, 4778, 14, 3947, 1412, 497, 4778, 316, 5157, 304, 272, 408, 272, 437, 24200, 316, 4744, 626, 883, 5126, 32592, 2399, 1324, 1584, 14, 272, 9101, 83, 1072, 370, 3839, 14, 339, 7242, 1584, 883, 14190, 506, 5313, 370, 282, 3365, 2082, 436, 503, 272, 1172, 376, 2402, 570, 4739, 11544, 370, 3932, 536, 367, 675, 315, 24325, 272, 2382, 1265, 886, 440, 2934, 370, 3350, 314, 1324, 1584, 14, 272, 408, 339, 347, 636, 826, 721, 277, 12, 5325, 1192, 12, 1511, 12, 5027, 12, 949, 27376, 12, 2498, 63, 17418, 12, 326, 1324, 63, 1095, 63, 694, 4581, 1072, 63, 694, 4581, 5666, 63, 4511, 9280, 267, 408, 267, 3033, 26, 288, 5325, 1192, 26, 437, 769, 402, 5325, 1192, 370, 492, 14, 288, 1511, 26, 437, 1211, 543, 799, 4778, 316, 5157, 2897, 14, 288, 5027, 26, 437, 769, 402, 5325, 1192, 370, 1255, 2755, 340, 2985, 787, 5027, 14, 288, 949, 27376, 26, 982, 2549, 949, 6902, 1987, 27162, 7, 1584, 911, 506, 2737, 367, 5204, 355, 1584, 626, 787, 3769, 295, 7783, 2908, 14, 288, 2498, 63, 17418, 26, 7719, 14981, 402, 314, 24200, 316, 506, 12487, 370, 3839, 31, 288, 1324, 63, 1095, 63, 694, 26, 710, 1300, 2082, 367, 1006, 1324, 1584, 14, 221, 961, 1021, 355, 911, 6202, 642, 931, 2403, 2331, 402, 6203, 2544, 10004, 4655, 355, 652, 543, 1072, 63, 694, 14, 221, 5972, 26562, 340, 1072, 63, 694, 365, 6841, 14, 355, 2900, 1584, 7686, 701, 24200, 342, 1471, 1343, 543, 642, 931, 14, 288, 1072, 63, 694, 26, 982, 6841, 12, 1006, 6702, 1584, 911, 506, 5313, 1901, 355, 642, 2082, 3123, 3140, 402, 1324, 63, 1095, 63, 694, 14, 288, 5666, 63, 4511, 26, 982, 6841, 12, 1006, 1584, 1072, 701, 642, 4744, 911, 1172, 355, 642, 11544, 370, 3932, 1788, 14, 221, 18491, 367, 13729, 1275, 647, 370, 355, 1275, 647, 19, 367, 2893, 701, 9476, 5666, 63, 4511, 534, 19, 1370, 267, 408, 267, 291, 14, 889, 27376, 275, 949, 27376, 267, 291, 14, 2384, 63, 17418, 275, 2498, 63, 17418, 267, 340, 1324, 63, 1095, 63, 694, 436, 440, 1324, 63, 1095, 63, 694, 14, 4130, 8, 736, 14, 4127, 304, 288, 1324, 63, 1095, 63, 694, 847, 747, 14, 4127, 267, 291, 423, 1210, 63, 1095, 63, 694, 275, 1324, 63, 1095, 63, 694, 267, 291, 423, 1199, 63, 694, 275, 1072, 63, 694, 267, 291, 423, 740, 63, 4511, 275, 5666, 63, 4511, 267, 1613, 8, 26080, 497, 4778, 316, 5157, 12, 291, 2843, 826, 721, 970, 1192, 12, 1511, 12, 5027, 9, 339, 347, 943, 63, 705, 8, 277, 12, 1499, 12, 627, 589, 12, 1011, 958, 304, 267, 291, 14, 2550, 14, 740, 1332, 1328, 12, 1249, 12, 2074, 430, 267, 291, 14, 2921, 14, 705, 8, 1328, 12, 627, 589, 12, 1011, 958, 9, 339, 347, 2218, 63, 493, 8, 277, 12, 892, 63, 505, 12, 1788, 12, 2269, 63, 505, 12, 2644, 304, 267, 2306, 63, 1501, 275, 1788, 267, 340, 291, 423, 1199, 63, 694, 26, 288, 340, 1788, 14, 2460, 8, 277, 423, 1210, 63, 1095, 63, 694, 304, 355, 1788, 275, 747, 14, 515, 14, 904, 8, 277, 423, 1199, 63, 694, 12, 3147, 1788, 59, 552, 8, 277, 423, 1210, 63, 1095, 63, 694, 304, 566, 288, 587, 26, 355, 746, 1722, 360, 1501, 450, 83, 1630, 440, 1343, 543, 314, 283, 639, 283, 1210, 63, 1095, 63, 694, 450, 83, 7, 450, 334, 1460, 1788, 12, 291, 423, 1210, 63, 1095, 63, 694, 430, 267, 340, 291, 423, 740, 63, 4511, 26, 288, 1788, 847, 291, 423, 740, 63, 4511, 267, 340, 2306, 63, 1501, 1137, 1788, 26, 288, 1072, 63, 694, 275, 747, 14, 515, 14, 3475, 8, 1501, 9, 288, 340, 440, 747, 14, 515, 14, 6027, 8, 1199, 63, 694, 304, 355, 747, 14, 8347, 8, 1199, 63, 694, 9, 288, 291, 14, 793, 63, 1188, 360, 16646, 6702, 450, 83, 370, 450, 83, 3130, 2306, 63, 1501, 12, 2490, 1788, 9, 267, 340, 440, 291, 14, 889, 27376, 26, 288, 327, 4155, 6902, 288, 6902, 275, 1788, 435, 3680, 27162, 2, 288, 340, 747, 14, 515, 14, 3113, 1670, 8, 5751, 304, 355, 862, 26, 490, 747, 14, 2168, 8, 5751, 9, 355, 871, 747, 14, 705, 12, 2329, 26, 490, 291, 14, 793, 63, 1188, 480, 6049, 1133, 2813, 6902, 450, 83, 401, 6902, 9, 288, 862, 26, 355, 747, 14, 8165, 8, 1501, 12, 6902, 9, 288, 871, 747, 14, 705, 12, 2329, 26, 355, 291, 14, 793, 63, 1188, 480, 6049, 1133, 11441, 450, 83, 370, 450, 83, 401, 1788, 12, 6902, 9, 267, 327, 18982, 3163, 2218, 314, 892, 570, 267, 2218, 275, 1613, 8, 26080, 497, 4778, 316, 5157, 12, 291, 680, 952, 63, 493, 267, 2218, 8, 1222, 63, 505, 12, 1788, 12, 2269, 63, 505, 12, 2644, 9, 267, 340, 440, 291, 14, 889, 27376, 26, 288, 5145, 14, 1574, 632, 8, 5751, 12, 1788, 9, 267, 340, 2306, 63, 1501, 1137, 1788, 26, 288, 327, 5543, 4909, 314, 570, 818, 315, 314, 892, 1072, 2082, 14, 288, 5145, 14, 1574, 632, 8, 2981, 63, 1501, 12, 1788, 9, 339, 347, 870, 63, 1199, 8, 277, 12, 2269, 12, 892, 12, 1788, 12, 4472, 304, 267, 340, 4472, 26, 288, 291, 14, 793, 63, 1188, 480, 1944, 4493, 370, 450, 83, 401, 1788, 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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, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
AamerShareef/Spy-Bot
SpyBot_Workspace/Dependencies/hostapd-2.6/hostapd/wps-ap-nfc.py
23
9966
#!/usr/bin/python # # Example nfcpy to hostapd wrapper for WPS NFC operations # Copyright (c) 2012-2013, Jouni Malinen <[email protected]> # # This software may be distributed under the terms of the BSD license. # See README for more details. import os import sys import time import argparse import nfc import nfc.ndef import nfc.llcp import nfc.handover import logging import wpaspy wpas_ctrl = '/var/run/hostapd' continue_loop = True summary_file = None success_file = None def summary(txt): print txt if summary_file: with open(summary_file, 'a') as f: f.write(txt + "\n") def success_report(txt): summary(txt) if success_file: with open(success_file, 'a') as f: f.write(txt + "\n") def wpas_connect(): ifaces = [] if os.path.isdir(wpas_ctrl): try: ifaces = [os.path.join(wpas_ctrl, i) for i in os.listdir(wpas_ctrl)] except OSError, error: print "Could not find hostapd: ", error return None if len(ifaces) < 1: print "No hostapd control interface found" return None for ctrl in ifaces: try: wpas = wpaspy.Ctrl(ctrl) return wpas except Exception, e: pass return None def wpas_tag_read(message): wpas = wpas_connect() if (wpas == None): return False if "FAIL" in wpas.request("WPS_NFC_TAG_READ " + str(message).encode("hex")): return False return True def wpas_get_config_token(): wpas = wpas_connect() if (wpas == None): return None ret = wpas.request("WPS_NFC_CONFIG_TOKEN NDEF") if "FAIL" in ret: return None return ret.rstrip().decode("hex") def wpas_get_password_token(): wpas = wpas_connect() if (wpas == None): return None ret = wpas.request("WPS_NFC_TOKEN NDEF") if "FAIL" in ret: return None return ret.rstrip().decode("hex") def wpas_get_handover_sel(): wpas = wpas_connect() if (wpas == None): return None ret = wpas.request("NFC_GET_HANDOVER_SEL NDEF WPS-CR") if "FAIL" in ret: return None return ret.rstrip().decode("hex") def wpas_report_handover(req, sel): wpas = wpas_connect() if (wpas == None): return None return wpas.request("NFC_REPORT_HANDOVER RESP WPS " + str(req).encode("hex") + " " + str(sel).encode("hex")) class HandoverServer(nfc.handover.HandoverServer): def __init__(self, llc): super(HandoverServer, self).__init__(llc) self.ho_server_processing = False self.success = False # override to avoid parser error in request/response.pretty() in nfcpy # due to new WSC handover format def _process_request(self, request): summary("received handover request {}".format(request.type)) response = nfc.ndef.Message("\xd1\x02\x01Hs\x12") if not request.type == 'urn:nfc:wkt:Hr': summary("not a handover request") else: try: request = nfc.ndef.HandoverRequestMessage(request) except nfc.ndef.DecodeError as e: summary("error decoding 'Hr' message: {}".format(e)) else: response = self.process_request(request) summary("send handover response {}".format(response.type)) return response def process_request(self, request): summary("HandoverServer - request received") try: print "Parsed handover request: " + request.pretty() except Exception, e: print e print str(request).encode("hex") sel = nfc.ndef.HandoverSelectMessage(version="1.2") for carrier in request.carriers: print "Remote carrier type: " + carrier.type if carrier.type == "application/vnd.wfa.wsc": summary("WPS carrier type match - add WPS carrier record") data = wpas_get_handover_sel() if data is None: summary("Could not get handover select carrier record from hostapd") continue print "Handover select carrier record from hostapd:" print data.encode("hex") if "OK" in wpas_report_handover(carrier.record, data): success_report("Handover reported successfully") else: summary("Handover report rejected") message = nfc.ndef.Message(data); sel.add_carrier(message[0], "active", message[1:]) print "Handover select:" try: print sel.pretty() except Exception, e: print e print str(sel).encode("hex") summary("Sending handover select") self.success = True return sel def wps_tag_read(tag): success = False if len(tag.ndef.message): for record in tag.ndef.message: print "record type " + record.type if record.type == "application/vnd.wfa.wsc": summary("WPS tag - send to hostapd") success = wpas_tag_read(tag.ndef.message) break else: summary("Empty tag") if success: success_report("Tag read succeeded") return success def rdwr_connected_write(tag): summary("Tag found - writing - " + str(tag)) global write_data tag.ndef.message = str(write_data) success_report("Tag write succeeded") print "Done - remove tag" global only_one if only_one: global continue_loop continue_loop = False global write_wait_remove while write_wait_remove and tag.is_present: time.sleep(0.1) def wps_write_config_tag(clf, wait_remove=True): summary("Write WPS config token") global write_data, write_wait_remove write_wait_remove = wait_remove write_data = wpas_get_config_token() if write_data == None: summary("Could not get WPS config token from hostapd") return print "Touch an NFC tag" clf.connect(rdwr={'on-connect': rdwr_connected_write}) def wps_write_password_tag(clf, wait_remove=True): summary("Write WPS password token") global write_data, write_wait_remove write_wait_remove = wait_remove write_data = wpas_get_password_token() if write_data == None: summary("Could not get WPS password token from hostapd") return print "Touch an NFC tag" clf.connect(rdwr={'on-connect': rdwr_connected_write}) def rdwr_connected(tag): global only_one, no_wait summary("Tag connected: " + str(tag)) if tag.ndef: print "NDEF tag: " + tag.type try: print tag.ndef.message.pretty() except Exception, e: print e success = wps_tag_read(tag) if only_one and success: global continue_loop continue_loop = False else: summary("Not an NDEF tag - remove tag") return True return not no_wait def llcp_startup(clf, llc): print "Start LLCP server" global srv srv = HandoverServer(llc) return llc def llcp_connected(llc): print "P2P LLCP connected" global wait_connection wait_connection = False global srv srv.start() return True def main(): clf = nfc.ContactlessFrontend() parser = argparse.ArgumentParser(description='nfcpy to hostapd integration for WPS NFC operations') parser.add_argument('-d', const=logging.DEBUG, default=logging.INFO, action='store_const', dest='loglevel', help='verbose debug output') parser.add_argument('-q', const=logging.WARNING, action='store_const', dest='loglevel', help='be quiet') parser.add_argument('--only-one', '-1', action='store_true', help='run only one operation and exit') parser.add_argument('--no-wait', action='store_true', help='do not wait for tag to be removed before exiting') parser.add_argument('--summary', help='summary file for writing status updates') parser.add_argument('--success', help='success file for writing success update') parser.add_argument('command', choices=['write-config', 'write-password'], nargs='?') args = parser.parse_args() global only_one only_one = args.only_one global no_wait no_wait = args.no_wait if args.summary: global summary_file summary_file = args.summary if args.success: global success_file success_file = args.success logging.basicConfig(level=args.loglevel) try: if not clf.open("usb"): print "Could not open connection with an NFC device" raise SystemExit if args.command == "write-config": wps_write_config_tag(clf, wait_remove=not args.no_wait) raise SystemExit if args.command == "write-password": wps_write_password_tag(clf, wait_remove=not args.no_wait) raise SystemExit global continue_loop while continue_loop: print "Waiting for a tag or peer to be touched" wait_connection = True try: if not clf.connect(rdwr={'on-connect': rdwr_connected}, llcp={'on-startup': llcp_startup, 'on-connect': llcp_connected}): break except Exception, e: print "clf.connect failed" global srv if only_one and srv and srv.success: raise SystemExit except KeyboardInterrupt: raise SystemExit finally: clf.close() raise SystemExit if __name__ == '__main__': main()
mit
[ 3381, 2647, 15, 1393, 15, 1548, 199, 3, 199, 3, 5679, 302, 3003, 647, 370, 1591, 439, 68, 4975, 367, 644, 5067, 653, 4161, 5331, 199, 3, 1898, 334, 67, 9, 6029, 13, 6965, 12, 7135, 5411, 29936, 262, 287, 665, 74, 32, 87, 17, 14, 329, 30, 199, 3, 199, 3, 961, 2032, 1443, 506, 1854, 1334, 314, 2895, 402, 314, 6289, 4190, 14, 199, 3, 1666, 27781, 367, 1655, 2436, 14, 199, 199, 646, 747, 199, 646, 984, 199, 646, 900, 199, 646, 7534, 199, 199, 646, 302, 3003, 199, 646, 302, 3003, 14, 18467, 199, 646, 302, 3003, 14, 914, 1850, 199, 646, 302, 3003, 14, 6868, 1883, 199, 199, 646, 2050, 199, 199, 646, 336, 15534, 647, 199, 199, 14649, 305, 63, 12476, 275, 1994, 1391, 15, 1065, 15, 1102, 439, 68, 7, 199, 6958, 63, 3813, 275, 715, 199, 4705, 63, 493, 275, 488, 199, 3742, 63, 493, 275, 488, 199, 199, 318, 6212, 8, 2424, 304, 272, 870, 9444, 272, 340, 6212, 63, 493, 26, 267, 543, 1551, 8, 4705, 63, 493, 12, 283, 65, 358, 465, 289, 26, 288, 289, 14, 952, 8, 2424, 435, 1867, 78, 531, 199, 199, 318, 3182, 63, 3070, 8, 2424, 304, 272, 6212, 8, 2424, 9, 272, 340, 3182, 63, 493, 26, 267, 543, 1551, 8, 3742, 63, 493, 12, 283, 65, 358, 465, 289, 26, 288, 289, 14, 952, 8, 2424, 435, 1867, 78, 531, 199, 199, 318, 336, 15534, 63, 2242, 837, 272, 340, 65, 823, 275, 942, 272, 340, 747, 14, 515, 14, 6027, 8, 14649, 305, 63, 12476, 304, 267, 862, 26, 288, 340, 65, 823, 275, 359, 736, 14, 515, 14, 904, 8, 14649, 305, 63, 12476, 12, 284, 9, 367, 284, 315, 747, 14, 7374, 8, 14649, 305, 63, 12476, 1874, 267, 871, 6440, 12, 1125, 26, 288, 870, 298, 6531, 440, 2342, 1591, 439, 68, 26, 3872, 1125, 288, 372, 488, 339, 340, 822, 8, 73, 4309, 9, 665, 413, 26, 267, 870, 298, 1944, 1591, 439, 68, 3304, 3217, 1911, 2, 267, 372, 488, 339, 367, 15427, 315, 340, 65, 823, 26, 267, 862, 26, 288, 336, 15534, 275, 336, 15534, 647, 14, 9778, 8, 12476, 9, 288, 372, 336, 15534, 267, 871, 2186, 12, 325, 26, 288, 986, 272, 372, 488, 421, 199, 318, 336, 15534, 63, 1450, 63, 739, 8, 1188, 304, 272, 336, 15534, 275, 336, 15534, 63, 2242, 342, 272, 340, 334, 14649, 305, 508, 488, 304, 267, 372, 756, 272, 340, 298, 8784, 2, 315, 336, 15534, 14, 1069, 480, 55, 5067, 63, 46, 4161, 63, 6967, 63, 5670, 298, 435, 620, 8, 1188, 680, 2143, 480, 4097, 14150, 267, 372, 756, 272, 372, 715, 421, 199, 318, 336, 15534, 63, 362, 63, 888, 63, 1418, 837, 272, 336, 15534, 275, 336, 15534, 63, 2242, 342, 272, 340, 334, 14649, 305, 508, 488, 304, 267, 372, 488, 272, 2203, 275, 336, 15534, 14, 1069, 480, 55, 5067, 63, 46, 4161, 63, 5569, 63, 8803, 653, 5638, 531, 272, 340, 298, 8784, 2, 315, 2203, 26, 267, 372, 488, 272, 372, 2203, 14, 6735, 1252, 2708, 480, 4097, 531, 421, 199, 318, 336, 15534, 63, 362, 63, 2060, 63, 1418, 837, 272, 336, 15534, 275, 336, 15534, 63, 2242, 342, 272, 340, 334, 14649, 305, 508, 488, 304, 267, 372, 488, 272, 2203, 275, 336, 15534, 14, 1069, 480, 55, 5067, 63, 46, 4161, 63, 8803, 653, 5638, 531, 272, 340, 298, 8784, 2, 315, 2203, 26, 267, 372, 488, 272, 372, 2203, 14, 6735, 1252, 2708, 480, 4097, 531, 421, 199, 318, 336, 15534, 63, 362, 63, 6868, 1883, 63, 5891, 837, 272, 336, 15534, 275, 336, 15534, 63, 2242, 342, 272, 340, 334, 14649, 305, 508, 488, 304, 267, 372, 488, 272, 2203, 275, 336, 15534, 14, 1069, 480, 46, 4161, 63, 2970, 63, 40, 879, 1649, 2111, 63, 899, 44, 653, 5638, 644, 5067, 13, 2944, 531, 272, 340, 298, 8784, 2, 315, 2203, 26, 267, 372, 488, 272, 372, 2203, 14, 6735, 1252, 2708, 480, 4097, 531, 421, 199, 318, 336, 15534, 63, 3070, 63, 6868, 1883, 8, 2103, 12, 13680, 304, 272, 336, 15534, 275, 336, 15534, 63, 2242, 342, 272, 340, 334, 14649, 305, 508, 488, 304, 267, 372, 488, 272, 372, 336, 15534, 14, 1069, 480, 46, 4161, 63, 17356, 63, 40, 879, 1649, 2111, 820, 7613, 644, 5067, 298, 435, 717, 620, 8, 2103, 680, 2143, 480, 4097, 531, 435, 298, 298, 435, 717, 620, 8, 5891, 680, 2143, 480, 4097, 2237, 421, 199, 533, 18405, 1883, 3120, 8, 78, 3003, 14, 6868, 1883, 14, 13220, 1883, 3120, 304, 272, 347, 636, 826, 721, 277, 12, 634, 10181, 304, 267, 1613, 8, 13220, 1883, 3120, 12, 291, 2843, 826, 721, 914, 67, 9, 267, 291, 14, 526, 63, 1000, 63, 6338, 275, 756, 267, 291, 14, 3742, 275, 756, 339, 327, 4278, 370, 5126, 1798, 1125, 315, 1056, 15, 1310, 14, 9118, 342, 315, 302, 3003, 647, 272, 327, 7037, 370, 892, 644, 5153, 4926, 1883, 1475, 272, 347, 485, 1412, 63, 1069, 8, 277, 12, 1056, 304, 267, 6212, 480, 9226, 4926, 1883, 1056, 8352, 908, 8, 1069, 14, 466, 430, 267, 1177, 275, 302, 3003, 14, 18467, 14, 2209, 4582, 2207, 17, 60, 88, 996, 60, 88, 614, 40, 83, 60, 88, 713, 531, 267, 340, 440, 1056, 14, 466, 508, 283, 349, 26, 78, 3003, 26, 11412, 26, 40, 82, 356, 288, 6212, 480, 1397, 282, 4926, 1883, 1056, 531, 267, 587, 26, 288, 862, 26, 355, 1056, 275, 302, 3003, 14, 18467, 14, 13220, 1883, 2017, 2209, 8, 1069, 9, 288, 871, 302, 3003, 14, 18467, 14, 12620, 465, 325, 26, 355, 6212, 480, 705, 15952, 283, 40, 82, 7, 1245, 26, 8352, 908, 8, 69, 430, 288, 587, 26, 355, 1177, 275, 291, 14, 1412, 63, 1069, 8, 1069, 9, 267, 6212, 480, 2254, 4926, 1883, 1177, 8352, 908, 8, 1310, 14, 466, 430, 267, 372, 1177, 339, 347, 2112, 63, 1069, 8, 277, 12, 1056, 304, 267, 6212, 480, 13220, 1883, 3120, 446, 1056, 3086, 531, 267, 862, 26, 288, 870, 298, 1262, 939, 4926 ]
[ 2647, 15, 1393, 15, 1548, 199, 3, 199, 3, 5679, 302, 3003, 647, 370, 1591, 439, 68, 4975, 367, 644, 5067, 653, 4161, 5331, 199, 3, 1898, 334, 67, 9, 6029, 13, 6965, 12, 7135, 5411, 29936, 262, 287, 665, 74, 32, 87, 17, 14, 329, 30, 199, 3, 199, 3, 961, 2032, 1443, 506, 1854, 1334, 314, 2895, 402, 314, 6289, 4190, 14, 199, 3, 1666, 27781, 367, 1655, 2436, 14, 199, 199, 646, 747, 199, 646, 984, 199, 646, 900, 199, 646, 7534, 199, 199, 646, 302, 3003, 199, 646, 302, 3003, 14, 18467, 199, 646, 302, 3003, 14, 914, 1850, 199, 646, 302, 3003, 14, 6868, 1883, 199, 199, 646, 2050, 199, 199, 646, 336, 15534, 647, 199, 199, 14649, 305, 63, 12476, 275, 1994, 1391, 15, 1065, 15, 1102, 439, 68, 7, 199, 6958, 63, 3813, 275, 715, 199, 4705, 63, 493, 275, 488, 199, 3742, 63, 493, 275, 488, 199, 199, 318, 6212, 8, 2424, 304, 272, 870, 9444, 272, 340, 6212, 63, 493, 26, 267, 543, 1551, 8, 4705, 63, 493, 12, 283, 65, 358, 465, 289, 26, 288, 289, 14, 952, 8, 2424, 435, 1867, 78, 531, 199, 199, 318, 3182, 63, 3070, 8, 2424, 304, 272, 6212, 8, 2424, 9, 272, 340, 3182, 63, 493, 26, 267, 543, 1551, 8, 3742, 63, 493, 12, 283, 65, 358, 465, 289, 26, 288, 289, 14, 952, 8, 2424, 435, 1867, 78, 531, 199, 199, 318, 336, 15534, 63, 2242, 837, 272, 340, 65, 823, 275, 942, 272, 340, 747, 14, 515, 14, 6027, 8, 14649, 305, 63, 12476, 304, 267, 862, 26, 288, 340, 65, 823, 275, 359, 736, 14, 515, 14, 904, 8, 14649, 305, 63, 12476, 12, 284, 9, 367, 284, 315, 747, 14, 7374, 8, 14649, 305, 63, 12476, 1874, 267, 871, 6440, 12, 1125, 26, 288, 870, 298, 6531, 440, 2342, 1591, 439, 68, 26, 3872, 1125, 288, 372, 488, 339, 340, 822, 8, 73, 4309, 9, 665, 413, 26, 267, 870, 298, 1944, 1591, 439, 68, 3304, 3217, 1911, 2, 267, 372, 488, 339, 367, 15427, 315, 340, 65, 823, 26, 267, 862, 26, 288, 336, 15534, 275, 336, 15534, 647, 14, 9778, 8, 12476, 9, 288, 372, 336, 15534, 267, 871, 2186, 12, 325, 26, 288, 986, 272, 372, 488, 421, 199, 318, 336, 15534, 63, 1450, 63, 739, 8, 1188, 304, 272, 336, 15534, 275, 336, 15534, 63, 2242, 342, 272, 340, 334, 14649, 305, 508, 488, 304, 267, 372, 756, 272, 340, 298, 8784, 2, 315, 336, 15534, 14, 1069, 480, 55, 5067, 63, 46, 4161, 63, 6967, 63, 5670, 298, 435, 620, 8, 1188, 680, 2143, 480, 4097, 14150, 267, 372, 756, 272, 372, 715, 421, 199, 318, 336, 15534, 63, 362, 63, 888, 63, 1418, 837, 272, 336, 15534, 275, 336, 15534, 63, 2242, 342, 272, 340, 334, 14649, 305, 508, 488, 304, 267, 372, 488, 272, 2203, 275, 336, 15534, 14, 1069, 480, 55, 5067, 63, 46, 4161, 63, 5569, 63, 8803, 653, 5638, 531, 272, 340, 298, 8784, 2, 315, 2203, 26, 267, 372, 488, 272, 372, 2203, 14, 6735, 1252, 2708, 480, 4097, 531, 421, 199, 318, 336, 15534, 63, 362, 63, 2060, 63, 1418, 837, 272, 336, 15534, 275, 336, 15534, 63, 2242, 342, 272, 340, 334, 14649, 305, 508, 488, 304, 267, 372, 488, 272, 2203, 275, 336, 15534, 14, 1069, 480, 55, 5067, 63, 46, 4161, 63, 8803, 653, 5638, 531, 272, 340, 298, 8784, 2, 315, 2203, 26, 267, 372, 488, 272, 372, 2203, 14, 6735, 1252, 2708, 480, 4097, 531, 421, 199, 318, 336, 15534, 63, 362, 63, 6868, 1883, 63, 5891, 837, 272, 336, 15534, 275, 336, 15534, 63, 2242, 342, 272, 340, 334, 14649, 305, 508, 488, 304, 267, 372, 488, 272, 2203, 275, 336, 15534, 14, 1069, 480, 46, 4161, 63, 2970, 63, 40, 879, 1649, 2111, 63, 899, 44, 653, 5638, 644, 5067, 13, 2944, 531, 272, 340, 298, 8784, 2, 315, 2203, 26, 267, 372, 488, 272, 372, 2203, 14, 6735, 1252, 2708, 480, 4097, 531, 421, 199, 318, 336, 15534, 63, 3070, 63, 6868, 1883, 8, 2103, 12, 13680, 304, 272, 336, 15534, 275, 336, 15534, 63, 2242, 342, 272, 340, 334, 14649, 305, 508, 488, 304, 267, 372, 488, 272, 372, 336, 15534, 14, 1069, 480, 46, 4161, 63, 17356, 63, 40, 879, 1649, 2111, 820, 7613, 644, 5067, 298, 435, 717, 620, 8, 2103, 680, 2143, 480, 4097, 531, 435, 298, 298, 435, 717, 620, 8, 5891, 680, 2143, 480, 4097, 2237, 421, 199, 533, 18405, 1883, 3120, 8, 78, 3003, 14, 6868, 1883, 14, 13220, 1883, 3120, 304, 272, 347, 636, 826, 721, 277, 12, 634, 10181, 304, 267, 1613, 8, 13220, 1883, 3120, 12, 291, 2843, 826, 721, 914, 67, 9, 267, 291, 14, 526, 63, 1000, 63, 6338, 275, 756, 267, 291, 14, 3742, 275, 756, 339, 327, 4278, 370, 5126, 1798, 1125, 315, 1056, 15, 1310, 14, 9118, 342, 315, 302, 3003, 647, 272, 327, 7037, 370, 892, 644, 5153, 4926, 1883, 1475, 272, 347, 485, 1412, 63, 1069, 8, 277, 12, 1056, 304, 267, 6212, 480, 9226, 4926, 1883, 1056, 8352, 908, 8, 1069, 14, 466, 430, 267, 1177, 275, 302, 3003, 14, 18467, 14, 2209, 4582, 2207, 17, 60, 88, 996, 60, 88, 614, 40, 83, 60, 88, 713, 531, 267, 340, 440, 1056, 14, 466, 508, 283, 349, 26, 78, 3003, 26, 11412, 26, 40, 82, 356, 288, 6212, 480, 1397, 282, 4926, 1883, 1056, 531, 267, 587, 26, 288, 862, 26, 355, 1056, 275, 302, 3003, 14, 18467, 14, 13220, 1883, 2017, 2209, 8, 1069, 9, 288, 871, 302, 3003, 14, 18467, 14, 12620, 465, 325, 26, 355, 6212, 480, 705, 15952, 283, 40, 82, 7, 1245, 26, 8352, 908, 8, 69, 430, 288, 587, 26, 355, 1177, 275, 291, 14, 1412, 63, 1069, 8, 1069, 9, 267, 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1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
bzbarsky/servo
tests/wpt/web-platform-tests/tools/pytest/_pytest/_argcomplete.py
179
3623
"""allow bash-completion for argparse with argcomplete if installed needs argcomplete>=0.5.6 for python 3.2/3.3 (older versions fail to find the magic string, so _ARGCOMPLETE env. var is never set, and this does not need special code. argcomplete does not support python 2.5 (although the changes for that are minor). Function try_argcomplete(parser) should be called directly before the call to ArgumentParser.parse_args(). The filescompleter is what you normally would use on the positional arguments specification, in order to get "dirname/" after "dirn<TAB>" instead of the default "dirname ": optparser.add_argument(Config._file_or_dir, nargs='*' ).completer=filescompleter Other, application specific, completers should go in the file doing the add_argument calls as they need to be specified as .completer attributes as well. (If argcomplete is not installed, the function the attribute points to will not be used). SPEEDUP ======= The generic argcomplete script for bash-completion (/etc/bash_completion.d/python-argcomplete.sh ) uses a python program to determine startup script generated by pip. You can speed up completion somewhat by changing this script to include # PYTHON_ARGCOMPLETE_OK so the the python-argcomplete-check-easy-install-script does not need to be called to find the entry point of the code and see if that is marked with PYTHON_ARGCOMPLETE_OK INSTALL/DEBUGGING ================= To include this support in another application that has setup.py generated scripts: - add the line: # PYTHON_ARGCOMPLETE_OK near the top of the main python entry point - include in the file calling parse_args(): from _argcomplete import try_argcomplete, filescompleter , call try_argcomplete just before parse_args(), and optionally add filescompleter to the positional arguments' add_argument() If things do not work right away: - switch on argcomplete debugging with (also helpful when doing custom completers): export _ARC_DEBUG=1 - run: python-argcomplete-check-easy-install-script $(which appname) echo $? will echo 0 if the magic line has been found, 1 if not - sometimes it helps to find early on errors using: _ARGCOMPLETE=1 _ARC_DEBUG=1 appname which should throw a KeyError: 'COMPLINE' (which is properly set by the global argcomplete script). """ import sys import os from glob import glob class FastFilesCompleter: 'Fast file completer class' def __init__(self, directories=True): self.directories = directories def __call__(self, prefix, **kwargs): """only called on non option completions""" if os.path.sep in prefix[1:]: # prefix_dir = len(os.path.dirname(prefix) + os.path.sep) else: prefix_dir = 0 completion = [] globbed = [] if '*' not in prefix and '?' not in prefix: if prefix[-1] == os.path.sep: # we are on unix, otherwise no bash globbed.extend(glob(prefix + '.*')) prefix += '*' globbed.extend(glob(prefix)) for x in sorted(globbed): if os.path.isdir(x): x += '/' # append stripping the prefix (like bash, not like compgen) completion.append(x[prefix_dir:]) return completion if os.environ.get('_ARGCOMPLETE'): try: import argcomplete.completers except ImportError: sys.exit(-1) filescompleter = FastFilesCompleter() def try_argcomplete(parser): argcomplete.autocomplete(parser) else: def try_argcomplete(parser): pass filescompleter = None
mpl-2.0
[ 199, 624, 3306, 20387, 13, 13207, 367, 7534, 543, 1680, 4883, 340, 4903, 199, 10065, 1680, 4883, 8119, 16, 14, 21, 14, 22, 367, 2366, 650, 14, 18, 15, 19, 14, 19, 334, 2149, 5459, 2449, 199, 475, 2342, 314, 10628, 1059, 12, 880, 485, 11611, 15558, 2589, 14, 2729, 365, 7078, 663, 12, 436, 199, 3749, 1630, 440, 1929, 4539, 1233, 14, 199, 199, 1273, 4883, 1630, 440, 2291, 2366, 499, 14, 21, 334, 6130, 4937, 314, 4493, 367, 626, 199, 1530, 12612, 680, 199, 199, 3481, 862, 63, 1273, 4883, 8, 2087, 9, 1077, 506, 2797, 5370, 2544, 199, 1589, 1240, 370, 27615, 14, 1122, 63, 589, 1252, 199, 199, 1918, 1584, 18452, 365, 4052, 1265, 12252, 3955, 675, 641, 314, 11333, 199, 4958, 8929, 12, 315, 1865, 370, 664, 298, 3475, 6687, 2410, 298, 694, 78, 28, 10129, 4335, 199, 23145, 402, 314, 849, 298, 3475, 7244, 8410, 2450, 2087, 14, 525, 63, 2094, 8, 2028, 423, 493, 63, 269, 63, 694, 12, 9237, 534, 10223, 3044, 7092, 18452, 29, 1725, 18452, 199, 199, 8632, 12, 4223, 2488, 12, 2831, 878, 1077, 2621, 315, 314, 570, 199, 1117, 316, 314, 1050, 63, 2094, 4882, 465, 2985, 1929, 370, 506, 2013, 465, 1275, 18452, 199, 2987, 465, 5521, 14, 334, 3917, 1680, 4883, 365, 440, 4903, 12, 314, 805, 314, 199, 3215, 4501, 370, 911, 440, 506, 1202, 680, 199, 199, 29110, 2160, 199, 18673, 199, 1918, 7809, 1680, 4883, 2884, 367, 20387, 13, 13207, 199, 29478, 6839, 15, 16408, 63, 13207, 14, 68, 15, 1548, 13, 1273, 4883, 14, 609, 776, 199, 5589, 282, 2366, 2240, 370, 6705, 14210, 2884, 4046, 701, 7305, 14, 199, 5556, 883, 8112, 1536, 13659, 30362, 701, 13729, 642, 2884, 370, 2387, 523, 327, 18280, 63, 11611, 15558, 63, 3593, 199, 1152, 314, 314, 2366, 13, 1273, 4883, 13, 1074, 13, 13581, 13, 3174, 13, 1579, 1630, 440, 199, 9321, 370, 506, 2797, 370, 2342, 314, 2397, 2376, 402, 314, 1233, 436, 1937, 340, 626, 365, 199, 17938, 221, 543, 18280, 63, 11611, 15558, 63, 3593, 199, 199, 16811, 15, 1093, 2910, 22790, 199, 1280, 29, 199, 1378, 2387, 642, 2291, 315, 4573, 4223, 626, 965, 3272, 14, 647, 4046, 199, 6429, 26, 199, 13, 1050, 314, 1004, 26, 272, 327, 18280, 63, 11611, 15558, 63, 3593, 523, 17429, 314, 2746, 402, 314, 2446, 2366, 2397, 2376, 199, 13, 2387, 315, 314, 570, 6358, 2198, 63, 589, 837, 272, 687, 485, 1273, 4883, 492, 862, 63, 1273, 4883, 12, 1584, 18452, 2043, 2360, 1240, 862, 63, 1273, 4883, 2951, 2544, 2198, 63, 589, 1062, 436, 14190, 1050, 2043, 1584, 18452, 370, 314, 11333, 2368, 7, 1050, 63, 2094, 342, 199, 3917, 7645, 886, 440, 1736, 2451, 13437, 26, 199, 13, 6258, 641, 1680, 4883, 10201, 543, 334, 12344, 24606, 1380, 9689, 3537, 523, 2831, 878, 304, 272, 4843, 485, 24028, 63, 5287, 29, 17, 199, 13, 1255, 26, 272, 2366, 13, 1273, 4883, 13, 1074, 13, 13581, 13, 3174, 13, 1579, 7714, 6777, 20268, 9, 272, 11343, 2672, 31, 523, 911, 11343, 378, 340, 314, 10628, 1004, 965, 2757, 1911, 12, 413, 340, 440, 199, 13, 15026, 652, 22577, 370, 2342, 14670, 641, 2552, 1808, 26, 272, 485, 11611, 15558, 29, 17, 485, 24028, 63, 5287, 29, 17, 20268, 523, 1314, 1077, 7978, 282, 4067, 26, 283, 12558, 3565, 7, 334, 6777, 365, 7684, 663, 701, 314, 523, 2288, 1680, 4883, 2884, 680, 199, 624, 199, 199, 646, 984, 199, 646, 747, 199, 504, 5739, 492, 5739, 199, 199, 533, 22613, 5535, 6600, 351, 26, 272, 283, 16976, 570, 2831, 351, 1021, 7, 272, 347, 636, 826, 721, 277, 12, 6602, 29, 549, 304, 267, 291, 14, 12629, 275, 6602, 339, 347, 636, 1250, 721, 277, 12, 2403, 12, 1011, 958, 304, 267, 408, 2118, 2797, 641, 2222, 945, 31516, 624, 267, 340, 747, 14, 515, 14, 4127, 315, 2403, 59, 17, 10688, 327, 288, 2403, 63, 694, 275, 822, 8, 736, 14, 515, 14, 3475, 8, 1861, 9, 435, 747, 14, 515, 14, 4127, 9, 267, 587, 26, 288, 2403, 63, 694, 275, 378, 267, 13659, 275, 942, 267, 5739, 6123, 275, 942, 267, 340, 13626, 440, 315, 2403, 436, 15539, 440, 315, 2403, 26, 288, 340, 2403, 1988, 17, 61, 508, 747, 14, 515, 14, 4127, 26, 221, 327, 781, 787, 641, 16572, 12, 4257, 949, 20387, 355, 5739, 6123, 14, 2880, 8, 6463, 8, 1861, 435, 1987, 10, 1333, 288, 2403, 847, 13626, 267, 5739, 6123, 14, 2880, 8, 6463, 8, 1861, 430, 267, 367, 671, 315, 3355, 8, 6463, 6123, 304, 288, 340, 747, 14, 515, 14, 6027, 8, 88, 304, 355, 671, 847, 7324, 288, 327, 5666, 4024, 3637, 314, 2403, 334, 2930, 20387, 12, 440, 2839, 1013, 2268, 9, 288, 13659, 14, 740, 8, 88, 59, 1861, 63, 694, 5728, 267, 372, 13659, 199, 199, 692, 747, 14, 2314, 14, 362, 6412, 11611, 15558, 735, 272, 862, 26, 267, 492, 1680, 4883, 14, 2731, 878, 272, 871, 3545, 26, 267, 984, 14, 2224, 2801, 17, 9, 272, 1584, 18452, 275, 22613, 5535, 6600, 351, 342, 339, 347, 862, 63, 1273, 4883, 8, 2087, 304, 267, 1680, 4883, 14, 29695, 8, 2087, 9, 199, 2836, 26, 272, 347, 862, 63, 1273, 4883, 8, 2087, 304, 986, 272, 1584, 18452, 275, 488, 199, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768 ]
[ 624, 3306, 20387, 13, 13207, 367, 7534, 543, 1680, 4883, 340, 4903, 199, 10065, 1680, 4883, 8119, 16, 14, 21, 14, 22, 367, 2366, 650, 14, 18, 15, 19, 14, 19, 334, 2149, 5459, 2449, 199, 475, 2342, 314, 10628, 1059, 12, 880, 485, 11611, 15558, 2589, 14, 2729, 365, 7078, 663, 12, 436, 199, 3749, 1630, 440, 1929, 4539, 1233, 14, 199, 199, 1273, 4883, 1630, 440, 2291, 2366, 499, 14, 21, 334, 6130, 4937, 314, 4493, 367, 626, 199, 1530, 12612, 680, 199, 199, 3481, 862, 63, 1273, 4883, 8, 2087, 9, 1077, 506, 2797, 5370, 2544, 199, 1589, 1240, 370, 27615, 14, 1122, 63, 589, 1252, 199, 199, 1918, 1584, 18452, 365, 4052, 1265, 12252, 3955, 675, 641, 314, 11333, 199, 4958, 8929, 12, 315, 1865, 370, 664, 298, 3475, 6687, 2410, 298, 694, 78, 28, 10129, 4335, 199, 23145, 402, 314, 849, 298, 3475, 7244, 8410, 2450, 2087, 14, 525, 63, 2094, 8, 2028, 423, 493, 63, 269, 63, 694, 12, 9237, 534, 10223, 3044, 7092, 18452, 29, 1725, 18452, 199, 199, 8632, 12, 4223, 2488, 12, 2831, 878, 1077, 2621, 315, 314, 570, 199, 1117, 316, 314, 1050, 63, 2094, 4882, 465, 2985, 1929, 370, 506, 2013, 465, 1275, 18452, 199, 2987, 465, 5521, 14, 334, 3917, 1680, 4883, 365, 440, 4903, 12, 314, 805, 314, 199, 3215, 4501, 370, 911, 440, 506, 1202, 680, 199, 199, 29110, 2160, 199, 18673, 199, 1918, 7809, 1680, 4883, 2884, 367, 20387, 13, 13207, 199, 29478, 6839, 15, 16408, 63, 13207, 14, 68, 15, 1548, 13, 1273, 4883, 14, 609, 776, 199, 5589, 282, 2366, 2240, 370, 6705, 14210, 2884, 4046, 701, 7305, 14, 199, 5556, 883, 8112, 1536, 13659, 30362, 701, 13729, 642, 2884, 370, 2387, 523, 327, 18280, 63, 11611, 15558, 63, 3593, 199, 1152, 314, 314, 2366, 13, 1273, 4883, 13, 1074, 13, 13581, 13, 3174, 13, 1579, 1630, 440, 199, 9321, 370, 506, 2797, 370, 2342, 314, 2397, 2376, 402, 314, 1233, 436, 1937, 340, 626, 365, 199, 17938, 221, 543, 18280, 63, 11611, 15558, 63, 3593, 199, 199, 16811, 15, 1093, 2910, 22790, 199, 1280, 29, 199, 1378, 2387, 642, 2291, 315, 4573, 4223, 626, 965, 3272, 14, 647, 4046, 199, 6429, 26, 199, 13, 1050, 314, 1004, 26, 272, 327, 18280, 63, 11611, 15558, 63, 3593, 523, 17429, 314, 2746, 402, 314, 2446, 2366, 2397, 2376, 199, 13, 2387, 315, 314, 570, 6358, 2198, 63, 589, 837, 272, 687, 485, 1273, 4883, 492, 862, 63, 1273, 4883, 12, 1584, 18452, 2043, 2360, 1240, 862, 63, 1273, 4883, 2951, 2544, 2198, 63, 589, 1062, 436, 14190, 1050, 2043, 1584, 18452, 370, 314, 11333, 2368, 7, 1050, 63, 2094, 342, 199, 3917, 7645, 886, 440, 1736, 2451, 13437, 26, 199, 13, 6258, 641, 1680, 4883, 10201, 543, 334, 12344, 24606, 1380, 9689, 3537, 523, 2831, 878, 304, 272, 4843, 485, 24028, 63, 5287, 29, 17, 199, 13, 1255, 26, 272, 2366, 13, 1273, 4883, 13, 1074, 13, 13581, 13, 3174, 13, 1579, 7714, 6777, 20268, 9, 272, 11343, 2672, 31, 523, 911, 11343, 378, 340, 314, 10628, 1004, 965, 2757, 1911, 12, 413, 340, 440, 199, 13, 15026, 652, 22577, 370, 2342, 14670, 641, 2552, 1808, 26, 272, 485, 11611, 15558, 29, 17, 485, 24028, 63, 5287, 29, 17, 20268, 523, 1314, 1077, 7978, 282, 4067, 26, 283, 12558, 3565, 7, 334, 6777, 365, 7684, 663, 701, 314, 523, 2288, 1680, 4883, 2884, 680, 199, 624, 199, 199, 646, 984, 199, 646, 747, 199, 504, 5739, 492, 5739, 199, 199, 533, 22613, 5535, 6600, 351, 26, 272, 283, 16976, 570, 2831, 351, 1021, 7, 272, 347, 636, 826, 721, 277, 12, 6602, 29, 549, 304, 267, 291, 14, 12629, 275, 6602, 339, 347, 636, 1250, 721, 277, 12, 2403, 12, 1011, 958, 304, 267, 408, 2118, 2797, 641, 2222, 945, 31516, 624, 267, 340, 747, 14, 515, 14, 4127, 315, 2403, 59, 17, 10688, 327, 288, 2403, 63, 694, 275, 822, 8, 736, 14, 515, 14, 3475, 8, 1861, 9, 435, 747, 14, 515, 14, 4127, 9, 267, 587, 26, 288, 2403, 63, 694, 275, 378, 267, 13659, 275, 942, 267, 5739, 6123, 275, 942, 267, 340, 13626, 440, 315, 2403, 436, 15539, 440, 315, 2403, 26, 288, 340, 2403, 1988, 17, 61, 508, 747, 14, 515, 14, 4127, 26, 221, 327, 781, 787, 641, 16572, 12, 4257, 949, 20387, 355, 5739, 6123, 14, 2880, 8, 6463, 8, 1861, 435, 1987, 10, 1333, 288, 2403, 847, 13626, 267, 5739, 6123, 14, 2880, 8, 6463, 8, 1861, 430, 267, 367, 671, 315, 3355, 8, 6463, 6123, 304, 288, 340, 747, 14, 515, 14, 6027, 8, 88, 304, 355, 671, 847, 7324, 288, 327, 5666, 4024, 3637, 314, 2403, 334, 2930, 20387, 12, 440, 2839, 1013, 2268, 9, 288, 13659, 14, 740, 8, 88, 59, 1861, 63, 694, 5728, 267, 372, 13659, 199, 199, 692, 747, 14, 2314, 14, 362, 6412, 11611, 15558, 735, 272, 862, 26, 267, 492, 1680, 4883, 14, 2731, 878, 272, 871, 3545, 26, 267, 984, 14, 2224, 2801, 17, 9, 272, 1584, 18452, 275, 22613, 5535, 6600, 351, 342, 339, 347, 862, 63, 1273, 4883, 8, 2087, 304, 267, 1680, 4883, 14, 29695, 8, 2087, 9, 199, 2836, 26, 272, 347, 862, 63, 1273, 4883, 8, 2087, 304, 986, 272, 1584, 18452, 275, 488, 199, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 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, 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 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 ]
guildenstern70/pyfab
src/reportlab/graphics/barcode/code39.py
42
9830
# # Copyright (c) 1996-2000 Tyler C. Sarna <[email protected]> # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are met: # 1. Redistributions of source code must retain the above copyright # notice, this list of conditions and the following disclaimer. # 2. Redistributions in binary form must reproduce the above copyright # notice, this list of conditions and the following disclaimer in the # documentation and/or other materials provided with the distribution. # 3. All advertising materials mentioning features or use of this software # must display the following acknowledgement: # This product includes software developed by Tyler C. Sarna. # 4. Neither the name of the author nor the names of contributors # may be used to endorse or promote products derived from this software # without specific prior written permission. # # THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR OR CONTRIBUTORS # BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE # POSSIBILITY OF SUCH DAMAGE. # from reportlab.lib.units import inch from reportlab.lib.utils import asNative from reportlab.graphics.barcode.common import Barcode from string import digits as string_digits _patterns = { '0': ("bsbSBsBsb", 0), '1': ("BsbSbsbsB", 1), '2': ("bsBSbsbsB", 2), '3': ("BsBSbsbsb", 3), '4': ("bsbSBsbsB", 4), '5': ("BsbSBsbsb", 5), '6': ("bsBSBsbsb", 6), '7': ("bsbSbsBsB", 7), '8': ("BsbSbsBsb", 8), '9': ("bsBSbsBsb", 9), 'A': ("BsbsbSbsB", 10), 'B': ("bsBsbSbsB", 11), 'C': ("BsBsbSbsb", 12), 'D': ("bsbsBSbsB", 13), 'E': ("BsbsBSbsb", 14), 'F': ("bsBsBSbsb", 15), 'G': ("bsbsbSBsB", 16), 'H': ("BsbsbSBsb", 17), 'I': ("bsBsbSBsb", 18), 'J': ("bsbsBSBsb", 19), 'K': ("BsbsbsbSB", 20), 'L': ("bsBsbsbSB", 21), 'M': ("BsBsbsbSb", 22), 'N': ("bsbsBsbSB", 23), 'O': ("BsbsBsbSb", 24), 'P': ("bsBsBsbSb", 25), 'Q': ("bsbsbsBSB", 26), 'R': ("BsbsbsBSb", 27), 'S': ("bsBsbsBSb", 28), 'T': ("bsbsBsBSb", 29), 'U': ("BSbsbsbsB", 30), 'V': ("bSBsbsbsB", 31), 'W': ("BSBsbsbsb", 32), 'X': ("bSbsBsbsB", 33), 'Y': ("BSbsBsbsb", 34), 'Z': ("bSBsBsbsb", 35), '-': ("bSbsbsBsB", 36), '.': ("BSbsbsBsb", 37), ' ': ("bSBsbsBsb", 38), '*': ("bSbsBsBsb", None), '$': ("bSbSbSbsb", 39), '/': ("bSbSbsbSb", 40), '+': ("bSbsbSbSb", 41), '%': ("bsbSbSbSb", 42) } from reportlab.lib.utils import ascii_uppercase, ascii_lowercase _stdchrs = string_digits + ascii_uppercase + "-. $/+%" _extended = { '\0': "%U", '\01': "$A", '\02': "$B", '\03': "$C", '\04': "$D", '\05': "$E", '\06': "$F", '\07': "$G", '\010': "$H", '\011': "$I", '\012': "$J", '\013': "$K", '\014': "$L", '\015': "$M", '\016': "$N", '\017': "$O", '\020': "$P", '\021': "$Q", '\022': "$R", '\023': "$S", '\024': "$T", '\025': "$U", '\026': "$V", '\027': "$W", '\030': "$X", '\031': "$Y", '\032': "$Z", '\033': "%A", '\034': "%B", '\035': "%C", '\036': "%D", '\037': "%E", '!': "/A", '"': "/B", '#': "/C", '$': "/D", '%': "/E", '&': "/F", '\'': "/G", '(': "/H", ')': "/I", '*': "/J", '+': "/K", ',': "/L", '/': "/O", ':': "/Z", ';': "%F", '<': "%G", '=': "%H", '>': "%I", '?': "%J", '@': "%V", '[': "%K", '\\': "%L", ']': "%M", '^': "%N", '_': "%O", '`': "%W", 'a': "+A", 'b': "+B", 'c': "+C", 'd': "+D", 'e': "+E", 'f': "+F", 'g': "+G", 'h': "+H", 'i': "+I", 'j': "+J", 'k': "+K", 'l': "+L", 'm': "+M", 'n': "+N", 'o': "+O", 'p': "+P", 'q': "+Q", 'r': "+R", 's': "+S", 't': "+T", 'u': "+U", 'v': "+V", 'w': "+W", 'x': "+X", 'y': "+Y", 'z': "+Z", '{': "%P", '|': "%Q", '}': "%R", '~': "%S", '\177': "%T" } _extchrs = _stdchrs + ascii_lowercase + \ "\000\001\002\003\004\005\006\007\010\011\012\013\014\015\016\017" + \ "\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037" + \ "*!'#&\"(),:;<=>?@[\\]^_`{|}~\177" def _encode39(value, cksum, stop): v = sum([_patterns[c][1] for c in value]) % 43 if cksum: value += _stdchrs[v] if stop: value = '*'+value+'*' return value class _Code39Base(Barcode): barWidth = inch * 0.0075 lquiet = None rquiet = None quiet = 1 gap = None barHeight = None ratio = 2.2 checksum = 1 bearers = 0.0 stop = 1 def __init__(self, value = "", **args): value = asNative(value) for k, v in args.items(): setattr(self, k, v) if self.quiet: if self.lquiet is None: self.lquiet = max(inch * 0.25, self.barWidth * 10.0) self.rquiet = max(inch * 0.25, self.barWidth * 10.0) else: self.lquiet = self.rquiet = 0.0 Barcode.__init__(self, value) def decompose(self): dval = "" for c in self.encoded: dval = dval + _patterns[c][0] + 'i' self.decomposed = dval[:-1] return self.decomposed def _humanText(self): return self.stop and self.encoded[1:-1] or self.encoded class Standard39(_Code39Base): """ Options that may be passed to constructor: value (int, or numeric string required.): The value to encode. barWidth (float, default .0075): X-Dimension, or width of the smallest element Minumum is .0075 inch (7.5 mils). ratio (float, default 2.2): The ratio of wide elements to narrow elements. Must be between 2.0 and 3.0 (or 2.2 and 3.0 if the barWidth is greater than 20 mils (.02 inch)) gap (float or None, default None): width of intercharacter gap. None means "use barWidth". barHeight (float, see default below): Height of the symbol. Default is the height of the two bearer bars (if they exist) plus the greater of .25 inch or .15 times the symbol's length. checksum (bool, default 1): Wether to compute and include the check digit bearers (float, in units of barWidth. default 0): Height of bearer bars (horizontal bars along the top and bottom of the barcode). Default is 0 (no bearers). quiet (bool, default 1): Wether to include quiet zones in the symbol. lquiet (float, see default below): Quiet zone size to left of code, if quiet is true. Default is the greater of .25 inch, or .15 times the symbol's length. rquiet (float, defaults as above): Quiet zone size to right left of code, if quiet is true. stop (bool, default 1): Whether to include start/stop symbols. Sources of Information on Code 39: http://www.semiconductor.agilent.com/barcode/sg/Misc/code_39.html http://www.adams1.com/pub/russadam/39code.html http://www.barcodeman.com/c39_1.html Official Spec, "ANSI/AIM BC1-1995, USS" is available for US$45 from http://www.aimglobal.org/aimstore/ """ def validate(self): vval = [].append self.valid = 1 for c in self.value: if c in ascii_lowercase: c = c.upper() if c not in _stdchrs: self.valid = 0 continue vval(c) self.validated = ''.join(vval.__self__) return self.validated def encode(self): self.encoded = _encode39(self.validated, self.checksum, self.stop) return self.encoded class Extended39(_Code39Base): """ Extended Code 39 is a convention for encoding additional characters not present in stanmdard Code 39 by using pairs of characters to represent the characters missing in Standard Code 39. See Standard39 for arguments. Sources of Information on Extended Code 39: http://www.semiconductor.agilent.com/barcode/sg/Misc/xcode_39.html http://www.barcodeman.com/c39_ext.html """ def validate(self): vval = "" self.valid = 1 for c in self.value: if c not in _extchrs: self.valid = 0 continue vval = vval + c self.validated = vval return vval def encode(self): self.encoded = "" for c in self.validated: if c in _extended: self.encoded = self.encoded + _extended[c] elif c in _stdchrs: self.encoded = self.encoded + c else: raise ValueError self.encoded = _encode39(self.encoded, self.checksum,self.stop) return self.encoded
mit
[ 3, 199, 3, 1898, 334, 67, 9, 31347, 13, 8269, 377, 89, 1435, 445, 14, 428, 24252, 665, 1086, 24252, 32, 83, 24252, 14, 1308, 30, 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, 199, 3, 787, 7647, 26, 199, 3, 413, 14, 6823, 402, 1350, 1233, 1471, 8074, 314, 3432, 4248, 199, 3, 259, 4245, 12, 642, 769, 402, 3704, 436, 314, 2569, 6450, 14, 199, 3, 499, 14, 6823, 315, 3366, 1824, 1471, 9172, 314, 3432, 4248, 199, 3, 259, 4245, 12, 642, 769, 402, 3704, 436, 314, 2569, 6450, 315, 314, 199, 3, 259, 3794, 436, 15, 269, 1163, 8418, 2741, 543, 314, 4084, 14, 199, 3, 650, 14, 2900, 19613, 1044, 8418, 20811, 316, 4534, 503, 675, 402, 642, 2032, 199, 3, 259, 1471, 2929, 314, 2569, 19807, 23504, 434, 26, 199, 3, 420, 961, 3336, 6952, 2032, 477, 27813, 701, 377, 89, 1435, 445, 14, 428, 24252, 14, 199, 3, 841, 14, 11443, 314, 536, 402, 314, 4132, 6590, 314, 1561, 402, 8417, 199, 3, 259, 1443, 506, 1202, 370, 10692, 503, 10016, 7585, 7131, 687, 642, 2032, 199, 3, 259, 1928, 2488, 6791, 5313, 4983, 14, 199, 3, 199, 3, 5749, 4141, 2281, 7049, 6515, 2334, 17632, 2401, 6483, 1124, 1179, 2281, 891, 2401, 199, 3, 1821, 7168, 1549, 5292, 2990, 12, 6931, 12, 5400, 2845, 5471, 2296, 12, 2334, 199, 3, 5292, 2990, 1634, 3169, 2401, 3092, 2381, 437, 3115, 199, 3, 3104, 9315, 9706, 14, 221, 1621, 4825, 6461, 7000, 2334, 17632, 1549, 6483, 199, 3, 6262, 7024, 2381, 1821, 8703, 12, 9168, 12, 9716, 12, 8820, 12, 9836, 12, 1549, 199, 3, 9110, 6736, 334, 6446, 12, 5400, 2845, 5471, 2296, 12, 9838, 1634, 199, 3, 9103, 9764, 1549, 9714, 27, 9102, 1634, 4815, 12, 7126, 12, 1549, 9206, 27, 1549, 9748, 199, 3, 9831, 9, 9802, 9817, 2401, 5258, 1821, 9815, 1634, 5603, 12, 7061, 1621, 199, 3, 7066, 12, 9644, 5603, 12, 1549, 7056, 334, 6446, 9254, 1549, 7334, 9, 199, 3, 7043, 1621, 1821, 9683, 5738, 1634, 2334, 4815, 1634, 5749, 4141, 12, 9704, 8036, 9691, 1634, 2334, 199, 3, 9726, 1634, 9712, 9784, 14, 199, 3, 199, 199, 504, 21773, 14, 773, 14, 5260, 492, 315, 335, 199, 504, 21773, 14, 773, 14, 1208, 492, 465, 19675, 199, 504, 21773, 14, 15707, 14, 22091, 14, 2330, 492, 12377, 600, 199, 504, 1059, 492, 7576, 465, 1059, 63, 7022, 199, 199, 63, 7435, 275, 469, 272, 283, 16, 356, 259, 1689, 1533, 66, 12463, 83, 34, 9264, 401, 378, 395, 755, 283, 17, 356, 1689, 34, 9264, 51, 1533, 1533, 34, 401, 413, 395, 272, 283, 18, 356, 259, 1689, 1533, 11087, 1533, 1533, 34, 401, 499, 395, 755, 283, 19, 356, 1689, 26394, 11087, 1533, 1533, 66, 401, 650, 395, 272, 283, 20, 356, 259, 1689, 1533, 66, 12463, 83, 1533, 34, 401, 841, 395, 755, 283, 21, 356, 1689, 34, 9264, 12463, 83, 1533, 66, 401, 959, 395, 272, 283, 22, 356, 259, 1689, 1533, 11087, 26394, 1533, 66, 401, 1227, 395, 755, 283, 23, 356, 1689, 1533, 66, 51, 1533, 26394, 34, 401, 1520, 395, 272, 283, 24, 356, 259, 1689, 34, 9264, 51, 1533, 34, 9264, 401, 1695, 395, 755, 283, 25, 356, 1689, 1533, 11087, 1533, 34, 9264, 401, 1749, 395, 272, 283, 33, 356, 259, 1689, 26394, 1533, 66, 51, 1533, 34, 401, 1616, 395, 420, 283, 34, 356, 1689, 1533, 34, 9264, 51, 1533, 34, 401, 4119, 395, 272, 283, 35, 356, 259, 1689, 26394, 34, 9264, 51, 1533, 66, 401, 3144, 395, 420, 283, 36, 356, 1689, 1533, 1533, 11087, 1533, 34, 401, 4944, 395, 272, 283, 37, 356, 259, 1689, 26394, 1533, 11087, 1533, 66, 401, 4329, 395, 420, 283, 38, 356, 1689, 1533, 26394, 11087, 1533, 66, 401, 4114, 395, 272, 283, 39, 356, 259, 1689, 1533, 1533, 66, 12463, 83, 34, 401, 3193, 395, 420, 283, 40, 356, 1689, 26394, 1533, 66, 12463, 9264, 401, 5557, 395, 272, 283, 41, 356, 259, 1689, 1533, 34, 9264, 12463, 9264, 401, 6155, 395, 420, 283, 42, 356, 1689, 1533, 1533, 11087, 34, 9264, 401, 5851, 395, 272, 283, 43, 356, 259, 1689, 26394, 1533, 1533, 66, 12463, 401, 3388, 395, 420, 283, 44, 356, 1689, 1533, 26394, 1533, 66, 12463, 401, 7829, 395, 272, 283, 45, 356, 259, 1689, 26394, 26394, 1533, 66, 51, 66, 401, 6928, 395, 420, 283, 46, 356, 1689, 1533, 1533, 34, 9264, 12463, 401, 6546, 395, 272, 283, 47, 356, 259, 1689, 26394, 1533, 34, 9264, 51, 66, 401, 5504, 395, 420, 283, 48, 356, 1689, 1533, 26394, 34, 9264, 51, 66, 401, 5661, 395, 272, 283, 49, 356, 259, 1689, 1533, 1533, 1533, 11087, 34, 401, 7875, 395, 420, 283, 50, 356, 1689, 26394, 1533, 1533, 11087, 66, 401, 8087, 395, 272, 283, 51, 356, 259, 1689, 1533, 26394, 1533, 11087, 66, 401, 7294, 395, 420, 283, 52, 356, 1689, 1533, 1533, 26394, 11087, 66, 401, 7349, 395, 272, 283, 53, 356, 259, 1689, 11087, 1533, 1533, 1533, 34, 401, 4233, 395, 420, 283, 54, 356, 1689, 66, 12463, 83, 1533, 1533, 34, 401, 7105, 395, 272, 283, 55, 356, 259, 1689, 11087, 26394, 1533, 1533, 66, 401, 4337, 395, 420, 283, 56, 356, 1689, 66, 51, 1533, 26394, 1533, 34, 401, 9404, 395, 272, 283, 57, 356, 259, 1689, 11087, 1533, 26394, 1533, 66, 401, 8177, 395, 420, 283, 58, 356, 1689, 66, 12463, 83, 26394, 1533, 66, 401, 8685, 395, 272, 20905, 259, 1689, 66, 51, 1533, 1533, 26394, 34, 401, 8780, 395, 420, 26351, 1689, 11087, 1533, 1533, 34, 9264, 401, 6877, 395, 272, 283, 7596, 259, 1689, 66, 12463, 83, 1533, 34, 9264, 401, 10448, 395, 420, 22969, 1689, 66, 51, 1533, 26394, 34, 9264, 401, 488, 395, 272, 4505, 356, 259, 1689, 66, 51, 66, 51, 66, 51, 1533, 66, 401, 10551, 395, 420, 20549, 1689, 66, 51, 66, 51, 1533, 66, 51, 66, 401, 6335, 395, 272, 6681, 356, 259, 1689, 66, 51, 1533, 66, 51 ]
[ 199, 3, 1898, 334, 67, 9, 31347, 13, 8269, 377, 89, 1435, 445, 14, 428, 24252, 665, 1086, 24252, 32, 83, 24252, 14, 1308, 30, 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, 199, 3, 787, 7647, 26, 199, 3, 413, 14, 6823, 402, 1350, 1233, 1471, 8074, 314, 3432, 4248, 199, 3, 259, 4245, 12, 642, 769, 402, 3704, 436, 314, 2569, 6450, 14, 199, 3, 499, 14, 6823, 315, 3366, 1824, 1471, 9172, 314, 3432, 4248, 199, 3, 259, 4245, 12, 642, 769, 402, 3704, 436, 314, 2569, 6450, 315, 314, 199, 3, 259, 3794, 436, 15, 269, 1163, 8418, 2741, 543, 314, 4084, 14, 199, 3, 650, 14, 2900, 19613, 1044, 8418, 20811, 316, 4534, 503, 675, 402, 642, 2032, 199, 3, 259, 1471, 2929, 314, 2569, 19807, 23504, 434, 26, 199, 3, 420, 961, 3336, 6952, 2032, 477, 27813, 701, 377, 89, 1435, 445, 14, 428, 24252, 14, 199, 3, 841, 14, 11443, 314, 536, 402, 314, 4132, 6590, 314, 1561, 402, 8417, 199, 3, 259, 1443, 506, 1202, 370, 10692, 503, 10016, 7585, 7131, 687, 642, 2032, 199, 3, 259, 1928, 2488, 6791, 5313, 4983, 14, 199, 3, 199, 3, 5749, 4141, 2281, 7049, 6515, 2334, 17632, 2401, 6483, 1124, 1179, 2281, 891, 2401, 199, 3, 1821, 7168, 1549, 5292, 2990, 12, 6931, 12, 5400, 2845, 5471, 2296, 12, 2334, 199, 3, 5292, 2990, 1634, 3169, 2401, 3092, 2381, 437, 3115, 199, 3, 3104, 9315, 9706, 14, 221, 1621, 4825, 6461, 7000, 2334, 17632, 1549, 6483, 199, 3, 6262, 7024, 2381, 1821, 8703, 12, 9168, 12, 9716, 12, 8820, 12, 9836, 12, 1549, 199, 3, 9110, 6736, 334, 6446, 12, 5400, 2845, 5471, 2296, 12, 9838, 1634, 199, 3, 9103, 9764, 1549, 9714, 27, 9102, 1634, 4815, 12, 7126, 12, 1549, 9206, 27, 1549, 9748, 199, 3, 9831, 9, 9802, 9817, 2401, 5258, 1821, 9815, 1634, 5603, 12, 7061, 1621, 199, 3, 7066, 12, 9644, 5603, 12, 1549, 7056, 334, 6446, 9254, 1549, 7334, 9, 199, 3, 7043, 1621, 1821, 9683, 5738, 1634, 2334, 4815, 1634, 5749, 4141, 12, 9704, 8036, 9691, 1634, 2334, 199, 3, 9726, 1634, 9712, 9784, 14, 199, 3, 199, 199, 504, 21773, 14, 773, 14, 5260, 492, 315, 335, 199, 504, 21773, 14, 773, 14, 1208, 492, 465, 19675, 199, 504, 21773, 14, 15707, 14, 22091, 14, 2330, 492, 12377, 600, 199, 504, 1059, 492, 7576, 465, 1059, 63, 7022, 199, 199, 63, 7435, 275, 469, 272, 283, 16, 356, 259, 1689, 1533, 66, 12463, 83, 34, 9264, 401, 378, 395, 755, 283, 17, 356, 1689, 34, 9264, 51, 1533, 1533, 34, 401, 413, 395, 272, 283, 18, 356, 259, 1689, 1533, 11087, 1533, 1533, 34, 401, 499, 395, 755, 283, 19, 356, 1689, 26394, 11087, 1533, 1533, 66, 401, 650, 395, 272, 283, 20, 356, 259, 1689, 1533, 66, 12463, 83, 1533, 34, 401, 841, 395, 755, 283, 21, 356, 1689, 34, 9264, 12463, 83, 1533, 66, 401, 959, 395, 272, 283, 22, 356, 259, 1689, 1533, 11087, 26394, 1533, 66, 401, 1227, 395, 755, 283, 23, 356, 1689, 1533, 66, 51, 1533, 26394, 34, 401, 1520, 395, 272, 283, 24, 356, 259, 1689, 34, 9264, 51, 1533, 34, 9264, 401, 1695, 395, 755, 283, 25, 356, 1689, 1533, 11087, 1533, 34, 9264, 401, 1749, 395, 272, 283, 33, 356, 259, 1689, 26394, 1533, 66, 51, 1533, 34, 401, 1616, 395, 420, 283, 34, 356, 1689, 1533, 34, 9264, 51, 1533, 34, 401, 4119, 395, 272, 283, 35, 356, 259, 1689, 26394, 34, 9264, 51, 1533, 66, 401, 3144, 395, 420, 283, 36, 356, 1689, 1533, 1533, 11087, 1533, 34, 401, 4944, 395, 272, 283, 37, 356, 259, 1689, 26394, 1533, 11087, 1533, 66, 401, 4329, 395, 420, 283, 38, 356, 1689, 1533, 26394, 11087, 1533, 66, 401, 4114, 395, 272, 283, 39, 356, 259, 1689, 1533, 1533, 66, 12463, 83, 34, 401, 3193, 395, 420, 283, 40, 356, 1689, 26394, 1533, 66, 12463, 9264, 401, 5557, 395, 272, 283, 41, 356, 259, 1689, 1533, 34, 9264, 12463, 9264, 401, 6155, 395, 420, 283, 42, 356, 1689, 1533, 1533, 11087, 34, 9264, 401, 5851, 395, 272, 283, 43, 356, 259, 1689, 26394, 1533, 1533, 66, 12463, 401, 3388, 395, 420, 283, 44, 356, 1689, 1533, 26394, 1533, 66, 12463, 401, 7829, 395, 272, 283, 45, 356, 259, 1689, 26394, 26394, 1533, 66, 51, 66, 401, 6928, 395, 420, 283, 46, 356, 1689, 1533, 1533, 34, 9264, 12463, 401, 6546, 395, 272, 283, 47, 356, 259, 1689, 26394, 1533, 34, 9264, 51, 66, 401, 5504, 395, 420, 283, 48, 356, 1689, 1533, 26394, 34, 9264, 51, 66, 401, 5661, 395, 272, 283, 49, 356, 259, 1689, 1533, 1533, 1533, 11087, 34, 401, 7875, 395, 420, 283, 50, 356, 1689, 26394, 1533, 1533, 11087, 66, 401, 8087, 395, 272, 283, 51, 356, 259, 1689, 1533, 26394, 1533, 11087, 66, 401, 7294, 395, 420, 283, 52, 356, 1689, 1533, 1533, 26394, 11087, 66, 401, 7349, 395, 272, 283, 53, 356, 259, 1689, 11087, 1533, 1533, 1533, 34, 401, 4233, 395, 420, 283, 54, 356, 1689, 66, 12463, 83, 1533, 1533, 34, 401, 7105, 395, 272, 283, 55, 356, 259, 1689, 11087, 26394, 1533, 1533, 66, 401, 4337, 395, 420, 283, 56, 356, 1689, 66, 51, 1533, 26394, 1533, 34, 401, 9404, 395, 272, 283, 57, 356, 259, 1689, 11087, 1533, 26394, 1533, 66, 401, 8177, 395, 420, 283, 58, 356, 1689, 66, 12463, 83, 26394, 1533, 66, 401, 8685, 395, 272, 20905, 259, 1689, 66, 51, 1533, 1533, 26394, 34, 401, 8780, 395, 420, 26351, 1689, 11087, 1533, 1533, 34, 9264, 401, 6877, 395, 272, 283, 7596, 259, 1689, 66, 12463, 83, 1533, 34, 9264, 401, 10448, 395, 420, 22969, 1689, 66, 51, 1533, 26394, 34, 9264, 401, 488, 395, 272, 4505, 356, 259, 1689, 66, 51, 66, 51, 66, 51, 1533, 66, 401, 10551, 395, 420, 20549, 1689, 66, 51, 66, 51, 1533, 66, 51, 66, 401, 6335, 395, 272, 6681, 356, 259, 1689, 66, 51, 1533, 66, 51, 0 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
chayapan/django-sentry
src/sentry/migrations/0030_auto__add_view__chg_field_event_group.py
7
13667
# encoding: utf-8 import datetime from south.db import db from south.v2 import SchemaMigration from django.db import models class Migration(SchemaMigration): def forwards(self, orm): # Adding model 'View' db.create_table('sentry_view', ( ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)), ('path', self.gf('django.db.models.fields.CharField')(unique=True, max_length=100)), )) db.send_create_signal('sentry', ['View']) # Adding M2M table for field views on 'Group' db.create_table('sentry_groupedmessage_views', ( ('id', models.AutoField(verbose_name='ID', primary_key=True, auto_created=True)), ('group', models.ForeignKey(orm['sentry.group'], null=False)), ('view', models.ForeignKey(orm['sentry.view'], null=False)) )) db.create_unique('sentry_groupedmessage_views', ['group_id', 'view_id']) def backwards(self, orm): # Deleting model 'View' db.delete_table('sentry_view') # Removing M2M table for field views on 'Group' db.delete_table('sentry_groupedmessage_views') models = { 'auth.group': { 'Meta': {'object_name': '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']", 'symmetrical': 'False', 'blank': 'True'}) }, 'auth.permission': { 'Meta': {'ordering': "('content_type__app_label', 'content_type__model', 'codename')", 'unique_together': "(('content_type', 'codename'),)", 'object_name': 'Permission'}, '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': { 'Meta': {'object_name': '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']", 'symmetrical': 'False', 'blank': 'True'}), 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), 'is_active': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), 'is_staff': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), 'is_superuser': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), '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']", 'symmetrical': 'False', 'blank': 'True'}), 'username': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'}) }, 'contenttypes.contenttype': { 'Meta': {'ordering': "('name',)", 'unique_together': "(('app_label', 'model'),)", 'object_name': 'ContentType', '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'}) }, 'sentry.event': { 'Meta': {'object_name': 'Event', 'db_table': "'sentry_message'"}, 'checksum': ('django.db.models.fields.CharField', [], {'max_length': '32', 'db_index': 'True'}), 'culprit': ('django.db.models.fields.CharField', [], {'max_length': '200', 'null': 'True', 'db_column': "'view'", 'blank': 'True'}), 'data': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), 'datetime': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now', 'db_index': 'True'}), 'event_id': ('django.db.models.fields.CharField', [], {'max_length': '32', 'unique': 'True', 'null': 'True', 'db_column': "'message_id'"}), 'group': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['sentry.Group']", 'null': 'True', 'db_column': "'group'", 'blank': 'True'}), 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), 'level': ('django.db.models.fields.PositiveIntegerField', [], {'default': '40', 'db_index': 'True', 'blank': 'True'}), 'logger': ('django.db.models.fields.CharField', [], {'default': "'root'", 'max_length': '64', 'db_index': 'True', 'blank': 'True'}), 'message': ('django.db.models.fields.TextField', [], {}), 'project': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['sentry.Project']", 'null': 'True'}), 'server_name': ('django.db.models.fields.CharField', [], {'max_length': '128', 'null': 'True', 'db_index': 'True'}), 'site': ('django.db.models.fields.CharField', [], {'max_length': '128', 'null': 'True', 'db_index': 'True'}), 'time_spent': ('django.db.models.fields.FloatField', [], {'null': 'True'}) }, 'sentry.filtervalue': { 'Meta': {'unique_together': "(('project', 'key', 'value'),)", 'object_name': 'FilterValue'}, 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), 'key': ('django.db.models.fields.CharField', [], {'max_length': '32'}), 'project': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['sentry.Project']", 'null': 'True'}), 'value': ('django.db.models.fields.CharField', [], {'max_length': '200'}) }, 'sentry.group': { 'Meta': {'unique_together': "(('project', 'logger', 'culprit', 'checksum'),)", 'object_name': 'Group', 'db_table': "'sentry_groupedmessage'"}, 'checksum': ('django.db.models.fields.CharField', [], {'max_length': '32', 'db_index': 'True'}), 'culprit': ('django.db.models.fields.CharField', [], {'max_length': '200', 'null': 'True', 'db_column': "'view'", 'blank': 'True'}), 'data': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), 'first_seen': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now', 'db_index': 'True'}), 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), 'last_seen': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now', 'db_index': 'True'}), 'level': ('django.db.models.fields.PositiveIntegerField', [], {'default': '40', 'db_index': 'True', 'blank': 'True'}), 'logger': ('django.db.models.fields.CharField', [], {'default': "'root'", 'max_length': '64', 'db_index': 'True', 'blank': 'True'}), 'message': ('django.db.models.fields.TextField', [], {}), 'project': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['sentry.Project']", 'null': 'True'}), 'score': ('django.db.models.fields.IntegerField', [], {'default': '0'}), 'status': ('django.db.models.fields.PositiveIntegerField', [], {'default': '0', 'db_index': 'True'}), 'time_spent_count': ('django.db.models.fields.IntegerField', [], {'default': '0'}), 'time_spent_total': ('django.db.models.fields.FloatField', [], {'default': '0'}), 'times_seen': ('django.db.models.fields.PositiveIntegerField', [], {'default': '1', 'db_index': 'True'}), 'views': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['sentry.View']", 'symmetrical': 'False', 'blank': 'True'}) }, 'sentry.messagecountbyminute': { 'Meta': {'unique_together': "(('project', 'group', 'date'),)", 'object_name': 'MessageCountByMinute'}, 'date': ('django.db.models.fields.DateTimeField', [], {}), 'group': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['sentry.Group']"}), 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), 'project': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['sentry.Project']", 'null': 'True'}), 'time_spent_count': ('django.db.models.fields.IntegerField', [], {'default': '0'}), 'time_spent_total': ('django.db.models.fields.FloatField', [], {'default': '0'}), 'times_seen': ('django.db.models.fields.PositiveIntegerField', [], {'default': '0'}) }, 'sentry.messagefiltervalue': { 'Meta': {'unique_together': "(('project', 'key', 'value', 'group'),)", 'object_name': 'MessageFilterValue'}, 'group': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['sentry.Group']"}), 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), 'key': ('django.db.models.fields.CharField', [], {'max_length': '32'}), 'project': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['sentry.Project']", 'null': 'True'}), 'times_seen': ('django.db.models.fields.PositiveIntegerField', [], {'default': '0'}), 'value': ('django.db.models.fields.CharField', [], {'max_length': '200'}) }, 'sentry.messageindex': { 'Meta': {'unique_together': "(('column', 'value', 'object_id'),)", 'object_name': 'MessageIndex'}, 'column': ('django.db.models.fields.CharField', [], {'max_length': '32'}), 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), 'object_id': ('django.db.models.fields.PositiveIntegerField', [], {}), 'value': ('django.db.models.fields.CharField', [], {'max_length': '128'}) }, 'sentry.project': { 'Meta': {'object_name': 'Project'}, 'date_added': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), 'name': ('django.db.models.fields.CharField', [], {'max_length': '200'}), 'owner': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'owned_project_set'", 'null': 'True', 'to': "orm['auth.User']"}), 'public': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), 'status': ('django.db.models.fields.PositiveIntegerField', [], {'default': '0', 'db_index': 'True'}) }, 'sentry.projectdomain': { 'Meta': {'unique_together': "(('project', 'domain'),)", 'object_name': 'ProjectDomain'}, 'domain': ('django.db.models.fields.CharField', [], {'max_length': '128'}), 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), 'project': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'domain_set'", 'to': "orm['sentry.Project']"}) }, 'sentry.projectmember': { 'Meta': {'unique_together': "(('project', 'user'),)", 'object_name': 'ProjectMember'}, 'date_added': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), 'project': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'member_set'", 'to': "orm['sentry.Project']"}), 'public_key': ('django.db.models.fields.CharField', [], {'max_length': '32', 'unique': 'True', 'null': 'True'}), 'secret_key': ('django.db.models.fields.CharField', [], {'max_length': '32', 'unique': 'True', 'null': 'True'}), 'type': ('django.db.models.fields.IntegerField', [], {'default': '0'}), 'user': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'project_set'", 'to': "orm['auth.User']"}) }, 'sentry.projectoptions': { 'Meta': {'unique_together': "(('project', 'key', 'value'),)", 'object_name': 'ProjectOptions'}, 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), 'key': ('django.db.models.fields.CharField', [], {'max_length': '32'}), 'project': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['sentry.Project']"}), 'value': ('django.db.models.fields.CharField', [], {'max_length': '200'}) }, 'sentry.view': { 'Meta': {'object_name': 'View'}, 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), 'path': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '100'}) } } complete_apps = ['sentry']
bsd-3-clause
[ 3, 2644, 26, 2774, 13, 24, 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, 199, 199, 533, 12090, 8, 24822, 304, 339, 347, 17465, 8, 277, 12, 9813, 304, 398, 327, 12934, 1402, 283, 2768, 7, 267, 1592, 14, 981, 63, 1224, 360, 3870, 63, 1345, 297, 334, 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, 515, 297, 291, 14, 7102, 360, 1176, 14, 697, 14, 992, 14, 955, 14, 2183, 7533, 3235, 29, 549, 12, 1390, 63, 1267, 29, 1960, 1826, 267, 5082, 267, 1592, 14, 2254, 63, 981, 63, 4653, 360, 3870, 297, 788, 2768, 1105, 398, 327, 12934, 603, 18, 45, 1817, 367, 901, 6858, 641, 283, 2448, 7, 267, 1592, 14, 981, 63, 1224, 360, 3870, 63, 22674, 1188, 63, 4196, 297, 334, 288, 661, 344, 297, 1709, 14, 4378, 8, 3832, 63, 354, 534, 998, 297, 5062, 63, 498, 29, 549, 12, 2599, 63, 3966, 29, 549, 1826, 288, 661, 923, 297, 1709, 14, 3190, 8, 1025, 459, 3870, 14, 923, 995, 2973, 29, 797, 1826, 288, 661, 1345, 297, 1709, 14, 3190, 8, 1025, 459, 3870, 14, 1345, 995, 2973, 29, 797, 430, 267, 5082, 267, 1592, 14, 981, 63, 3235, 360, 3870, 63, 22674, 1188, 63, 4196, 297, 788, 923, 63, 344, 297, 283, 1345, 63, 344, 1105, 2378, 347, 8552, 8, 277, 12, 9813, 304, 398, 327, 15920, 1402, 283, 2768, 7, 267, 1592, 14, 1807, 63, 1224, 360, 3870, 63, 1345, 358, 398, 327, 29343, 603, 18, 45, 1817, 367, 901, 6858, 641, 283, 2448, 7, 267, 1592, 14, 1807, 63, 1224, 360, 3870, 63, 22674, 1188, 63, 4196, 358, 2378, 1709, 275, 469, 267, 283, 1178, 14, 923, 356, 469, 288, 283, 3396, 356, 791, 785, 63, 354, 356, 283, 2448, 2267, 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, 10247, 356, 283, 797, 297, 283, 2500, 356, 283, 549, 3071, 267, 1660, 267, 283, 1178, 14, 5693, 356, 469, 288, 283, 3396, 356, 791, 7128, 356, 16111, 1317, 63, 466, 363, 571, 63, 1302, 297, 283, 1317, 63, 466, 363, 1238, 297, 283, 11879, 18106, 283, 3235, 63, 6314, 356, 9510, 1317, 63, 466, 297, 283, 11879, 9878, 283, 785, 63, 354, 356, 283, 7980, 2267, 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, 3396, 356, 791, 785, 63, 354, 356, 283, 1899, 2267, 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, 10247, 356, 283, 797, 297, 283, 2500, 356, 283, 549, 1604, 288, 283, 344, 356, 661, 1176, 14, 697, 14, 992, 14, 955, 14, 4378, 297, 990, 791, 3327, 63, 498, 356, 283, 549, 1604, 288, 283, 374, 63, 2682, 356, 661, 1176, 14, 697, 14, 992, 14, 955, 14, 5036, 297, 990, 791, 885, 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, 1604, 288, 283, 374, 63, 11434, 356, 661, 1176, 14, 697, 14, 992, 14, 955, 14, 5036, 297, 990, 791, 885, 356, 283, 797, 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, 10247, 356, 283, 797, 297, 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, 7128, 356, 16111, 354, 21099, 283, 3235, 63, 6314, 356, 9510, 571, 63, 1302, 297, 283, 1238, 9878, 283, 785, 63, 354, 356, 283, 11282, 297, 283, 697 ]
[ 2644, 26, 2774, 13, 24, 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, 199, 199, 533, 12090, 8, 24822, 304, 339, 347, 17465, 8, 277, 12, 9813, 304, 398, 327, 12934, 1402, 283, 2768, 7, 267, 1592, 14, 981, 63, 1224, 360, 3870, 63, 1345, 297, 334, 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, 515, 297, 291, 14, 7102, 360, 1176, 14, 697, 14, 992, 14, 955, 14, 2183, 7533, 3235, 29, 549, 12, 1390, 63, 1267, 29, 1960, 1826, 267, 5082, 267, 1592, 14, 2254, 63, 981, 63, 4653, 360, 3870, 297, 788, 2768, 1105, 398, 327, 12934, 603, 18, 45, 1817, 367, 901, 6858, 641, 283, 2448, 7, 267, 1592, 14, 981, 63, 1224, 360, 3870, 63, 22674, 1188, 63, 4196, 297, 334, 288, 661, 344, 297, 1709, 14, 4378, 8, 3832, 63, 354, 534, 998, 297, 5062, 63, 498, 29, 549, 12, 2599, 63, 3966, 29, 549, 1826, 288, 661, 923, 297, 1709, 14, 3190, 8, 1025, 459, 3870, 14, 923, 995, 2973, 29, 797, 1826, 288, 661, 1345, 297, 1709, 14, 3190, 8, 1025, 459, 3870, 14, 1345, 995, 2973, 29, 797, 430, 267, 5082, 267, 1592, 14, 981, 63, 3235, 360, 3870, 63, 22674, 1188, 63, 4196, 297, 788, 923, 63, 344, 297, 283, 1345, 63, 344, 1105, 2378, 347, 8552, 8, 277, 12, 9813, 304, 398, 327, 15920, 1402, 283, 2768, 7, 267, 1592, 14, 1807, 63, 1224, 360, 3870, 63, 1345, 358, 398, 327, 29343, 603, 18, 45, 1817, 367, 901, 6858, 641, 283, 2448, 7, 267, 1592, 14, 1807, 63, 1224, 360, 3870, 63, 22674, 1188, 63, 4196, 358, 2378, 1709, 275, 469, 267, 283, 1178, 14, 923, 356, 469, 288, 283, 3396, 356, 791, 785, 63, 354, 356, 283, 2448, 2267, 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, 10247, 356, 283, 797, 297, 283, 2500, 356, 283, 549, 3071, 267, 1660, 267, 283, 1178, 14, 5693, 356, 469, 288, 283, 3396, 356, 791, 7128, 356, 16111, 1317, 63, 466, 363, 571, 63, 1302, 297, 283, 1317, 63, 466, 363, 1238, 297, 283, 11879, 18106, 283, 3235, 63, 6314, 356, 9510, 1317, 63, 466, 297, 283, 11879, 9878, 283, 785, 63, 354, 356, 283, 7980, 2267, 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, 3396, 356, 791, 785, 63, 354, 356, 283, 1899, 2267, 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, 10247, 356, 283, 797, 297, 283, 2500, 356, 283, 549, 1604, 288, 283, 344, 356, 661, 1176, 14, 697, 14, 992, 14, 955, 14, 4378, 297, 990, 791, 3327, 63, 498, 356, 283, 549, 1604, 288, 283, 374, 63, 2682, 356, 661, 1176, 14, 697, 14, 992, 14, 955, 14, 5036, 297, 990, 791, 885, 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, 1604, 288, 283, 374, 63, 11434, 356, 661, 1176, 14, 697, 14, 992, 14, 955, 14, 5036, 297, 990, 791, 885, 356, 283, 797, 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, 10247, 356, 283, 797, 297, 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, 7128, 356, 16111, 354, 21099, 283, 3235, 63, 6314, 356, 9510, 571, 63, 1302, 297, 283, 1238, 9878, 283, 785, 63, 354, 356, 283, 11282, 297, 283, 697, 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, 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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 ]
davidyezsetz/kuma
vendor/packages/ipython/IPython/kernel/core/tests/test_interpreter.py
7
2119
# encoding: utf-8 """This file contains unittests for the interpreter.py module.""" #----------------------------------------------------------------------------- # Copyright (C) 2008-2009 The IPython Development Team # # Distributed under the terms of the BSD License. The full license is # in the file COPYING, distributed as part of this software. #----------------------------------------------------------------------------- #----------------------------------------------------------------------------- # Imports #----------------------------------------------------------------------------- # Tell nose to skip this module __test__ = {} from twisted.trial import unittest from IPython.kernel.core.interpreter import Interpreter #----------------------------------------------------------------------------- # Tests #----------------------------------------------------------------------------- class TestInterpreter(unittest.TestCase): def test_unicode(self): """ Test unicode handling with the interpreter.""" i = Interpreter() i.execute_python(u'print "ù"') i.execute_python('print "ù"') def test_ticket266993(self): """ Test for ticket 266993.""" i = Interpreter() i.execute('str("""a\nb""")') def test_ticket364347(self): """Test for ticket 364347.""" i = Interpreter() i.split_commands('str("a\\nb")') def test_split_commands(self): """ Test that commands are indeed individually split.""" i = Interpreter() test_atoms = [('(1\n + 1)', ), ('1', '1', ), ] for atoms in test_atoms: atoms = [atom.rstrip() + '\n' for atom in atoms] self.assertEquals(i.split_commands(''.join(atoms)),atoms) def test_long_lines(self): """ Test for spurious syntax error created by the interpreter.""" test_strings = [u'( 1 +\n 1\n )\n\n', u'(1 \n + 1\n )\n\n', ] i = Interpreter() for s in test_strings: i.execute(s)
mpl-2.0
[ 3, 2644, 26, 2774, 13, 24, 199, 199, 624, 2765, 570, 3509, 2882, 83, 367, 314, 12693, 14, 647, 859, 1041, 199, 199, 18045, 199, 3, 221, 1898, 334, 35, 9, 9079, 13, 8664, 221, 710, 16243, 15290, 11682, 199, 3, 199, 3, 221, 17484, 1334, 314, 2895, 402, 314, 6289, 844, 14, 221, 710, 2615, 4190, 365, 199, 3, 221, 315, 314, 570, 9685, 12, 1854, 465, 1777, 402, 642, 2032, 14, 199, 18045, 199, 199, 18045, 199, 3, 24339, 199, 18045, 199, 199, 3, 30528, 11354, 370, 3372, 642, 859, 199, 363, 396, 363, 275, 1052, 199, 199, 504, 7390, 14, 14443, 492, 2882, 199, 504, 16243, 14, 4989, 14, 1018, 14, 20244, 492, 6551, 26499, 199, 199, 18045, 199, 3, 6496, 199, 18045, 199, 199, 533, 1379, 2620, 26499, 8, 2796, 14, 1746, 304, 339, 347, 511, 63, 2975, 8, 277, 304, 267, 408, 1379, 2649, 7252, 543, 314, 12693, 1041, 267, 284, 275, 6551, 26499, 342, 267, 284, 14, 2526, 63, 1548, 8, 85, 7, 1361, 298, 128, 118, 9008, 267, 284, 14, 2526, 63, 1548, 360, 1361, 298, 128, 118, 9008, 339, 347, 511, 63, 9201, 9969, 16998, 8, 277, 304, 267, 408, 1379, 367, 12052, 499, 1272, 16998, 1041, 267, 284, 275, 6551, 26499, 342, 267, 284, 14, 2526, 360, 495, 4852, 65, 60, 4994, 6141, 358, 339, 347, 511, 63, 9201, 22775, 12532, 8, 277, 304, 267, 408, 774, 367, 12052, 650, 772, 12532, 1041, 267, 284, 275, 6551, 26499, 342, 267, 284, 14, 1294, 63, 4405, 360, 495, 480, 65, 1103, 4994, 531, 358, 339, 347, 511, 63, 1294, 63, 4405, 8, 277, 304, 267, 408, 1379, 626, 3718, 787, 31043, 379, 7814, 3163, 3715, 1041, 267, 284, 275, 6551, 26499, 342, 267, 511, 63, 11521, 275, 4274, 8, 17, 60, 78, 435, 413, 3196, 2318, 1993, 661, 17, 297, 283, 17, 297, 2318, 1993, 1622, 267, 367, 14503, 315, 511, 63, 11521, 26, 288, 14503, 275, 359, 4188, 14, 6735, 342, 435, 1557, 78, 7, 367, 6222, 315, 14503, 61, 288, 291, 14, 2947, 8, 73, 14, 1294, 63, 4405, 17840, 904, 8, 11521, 1826, 11521, 9, 339, 347, 511, 63, 2809, 63, 1278, 8, 277, 304, 267, 408, 1379, 367, 2249, 2302, 1785, 6302, 1125, 2737, 701, 314, 12693, 1041, 267, 511, 63, 5465, 275, 359, 85, 6774, 413, 17992, 78, 413, 60, 78, 776, 60, 78, 60, 78, 297, 717, 399, 6774, 17, 971, 78, 435, 413, 60, 78, 776, 60, 78, 60, 78, 297, 2432, 1622, 267, 284, 275, 6551, 26499, 342, 267, 367, 308, 315, 511, 63, 5465, 26, 288, 284, 14, 2526, 8, 83, 9, 421, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768 ]
[ 2644, 26, 2774, 13, 24, 199, 199, 624, 2765, 570, 3509, 2882, 83, 367, 314, 12693, 14, 647, 859, 1041, 199, 199, 18045, 199, 3, 221, 1898, 334, 35, 9, 9079, 13, 8664, 221, 710, 16243, 15290, 11682, 199, 3, 199, 3, 221, 17484, 1334, 314, 2895, 402, 314, 6289, 844, 14, 221, 710, 2615, 4190, 365, 199, 3, 221, 315, 314, 570, 9685, 12, 1854, 465, 1777, 402, 642, 2032, 14, 199, 18045, 199, 199, 18045, 199, 3, 24339, 199, 18045, 199, 199, 3, 30528, 11354, 370, 3372, 642, 859, 199, 363, 396, 363, 275, 1052, 199, 199, 504, 7390, 14, 14443, 492, 2882, 199, 504, 16243, 14, 4989, 14, 1018, 14, 20244, 492, 6551, 26499, 199, 199, 18045, 199, 3, 6496, 199, 18045, 199, 199, 533, 1379, 2620, 26499, 8, 2796, 14, 1746, 304, 339, 347, 511, 63, 2975, 8, 277, 304, 267, 408, 1379, 2649, 7252, 543, 314, 12693, 1041, 267, 284, 275, 6551, 26499, 342, 267, 284, 14, 2526, 63, 1548, 8, 85, 7, 1361, 298, 128, 118, 9008, 267, 284, 14, 2526, 63, 1548, 360, 1361, 298, 128, 118, 9008, 339, 347, 511, 63, 9201, 9969, 16998, 8, 277, 304, 267, 408, 1379, 367, 12052, 499, 1272, 16998, 1041, 267, 284, 275, 6551, 26499, 342, 267, 284, 14, 2526, 360, 495, 4852, 65, 60, 4994, 6141, 358, 339, 347, 511, 63, 9201, 22775, 12532, 8, 277, 304, 267, 408, 774, 367, 12052, 650, 772, 12532, 1041, 267, 284, 275, 6551, 26499, 342, 267, 284, 14, 1294, 63, 4405, 360, 495, 480, 65, 1103, 4994, 531, 358, 339, 347, 511, 63, 1294, 63, 4405, 8, 277, 304, 267, 408, 1379, 626, 3718, 787, 31043, 379, 7814, 3163, 3715, 1041, 267, 284, 275, 6551, 26499, 342, 267, 511, 63, 11521, 275, 4274, 8, 17, 60, 78, 435, 413, 3196, 2318, 1993, 661, 17, 297, 283, 17, 297, 2318, 1993, 1622, 267, 367, 14503, 315, 511, 63, 11521, 26, 288, 14503, 275, 359, 4188, 14, 6735, 342, 435, 1557, 78, 7, 367, 6222, 315, 14503, 61, 288, 291, 14, 2947, 8, 73, 14, 1294, 63, 4405, 17840, 904, 8, 11521, 1826, 11521, 9, 339, 347, 511, 63, 2809, 63, 1278, 8, 277, 304, 267, 408, 1379, 367, 2249, 2302, 1785, 6302, 1125, 2737, 701, 314, 12693, 1041, 267, 511, 63, 5465, 275, 359, 85, 6774, 413, 17992, 78, 413, 60, 78, 776, 60, 78, 60, 78, 297, 717, 399, 6774, 17, 971, 78, 435, 413, 60, 78, 776, 60, 78, 60, 78, 297, 2432, 1622, 267, 284, 275, 6551, 26499, 342, 267, 367, 308, 315, 511, 63, 5465, 26, 288, 284, 14, 2526, 8, 83, 9, 421, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 0 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
kswiat/django
django/core/serializers/xml_serializer.py
52
15026
""" XML serializer. """ from __future__ import unicode_literals from django.apps import apps from django.conf import settings from django.core.serializers import base from django.db import models, DEFAULT_DB_ALIAS from django.utils.xmlutils import SimplerXMLGenerator from django.utils.encoding import smart_text from xml.dom import pulldom from xml.sax import handler from xml.sax.expatreader import ExpatParser as _ExpatParser class Serializer(base.Serializer): """ Serializes a QuerySet to XML. """ def indent(self, level): if self.options.get('indent', None) is not None: self.xml.ignorableWhitespace('\n' + ' ' * self.options.get('indent', None) * level) def start_serialization(self): """ Start serialization -- open the XML document and the root element. """ self.xml = SimplerXMLGenerator(self.stream, self.options.get("encoding", settings.DEFAULT_CHARSET)) self.xml.startDocument() self.xml.startElement("django-objects", {"version": "1.0"}) def end_serialization(self): """ End serialization -- end the document. """ self.indent(0) self.xml.endElement("django-objects") self.xml.endDocument() def start_object(self, obj): """ Called as each object is handled. """ if not hasattr(obj, "_meta"): raise base.SerializationError("Non-model object (%s) encountered during serialization" % type(obj)) self.indent(1) attrs = {"model": smart_text(obj._meta)} if not self.use_natural_primary_keys or not hasattr(obj, 'natural_key'): obj_pk = obj._get_pk_val() if obj_pk is not None: attrs['pk'] = smart_text(obj_pk) self.xml.startElement("object", attrs) def end_object(self, obj): """ Called after handling all fields for an object. """ self.indent(1) self.xml.endElement("object") def handle_field(self, obj, field): """ Called to handle each field on an object (except for ForeignKeys and ManyToManyFields) """ self.indent(2) self.xml.startElement("field", { "name": field.name, "type": field.get_internal_type() }) # Get a "string version" of the object's data. if getattr(obj, field.name) is not None: self.xml.characters(field.value_to_string(obj)) else: self.xml.addQuickElement("None") self.xml.endElement("field") def handle_fk_field(self, obj, field): """ Called to handle a ForeignKey (we need to treat them slightly differently from regular fields). """ self._start_relational_field(field) related_att = getattr(obj, field.get_attname()) if related_att is not None: if self.use_natural_foreign_keys and hasattr(field.rel.to, 'natural_key'): related = getattr(obj, field.name) # If related object has a natural key, use it related = related.natural_key() # Iterable natural keys are rolled out as subelements for key_value in related: self.xml.startElement("natural", {}) self.xml.characters(smart_text(key_value)) self.xml.endElement("natural") else: self.xml.characters(smart_text(related_att)) else: self.xml.addQuickElement("None") self.xml.endElement("field") def handle_m2m_field(self, obj, field): """ Called to handle a ManyToManyField. Related objects are only serialized as references to the object's PK (i.e. the related *data* is not dumped, just the relation). """ if field.rel.through._meta.auto_created: self._start_relational_field(field) if self.use_natural_foreign_keys and hasattr(field.rel.to, 'natural_key'): # If the objects in the m2m have a natural key, use it def handle_m2m(value): natural = value.natural_key() # Iterable natural keys are rolled out as subelements self.xml.startElement("object", {}) for key_value in natural: self.xml.startElement("natural", {}) self.xml.characters(smart_text(key_value)) self.xml.endElement("natural") self.xml.endElement("object") else: def handle_m2m(value): self.xml.addQuickElement("object", attrs={ 'pk': smart_text(value._get_pk_val()) }) for relobj in getattr(obj, field.name).iterator(): handle_m2m(relobj) self.xml.endElement("field") def _start_relational_field(self, field): """ Helper to output the <field> element for relational fields """ self.indent(2) self.xml.startElement("field", { "name": field.name, "rel": field.rel.__class__.__name__, "to": smart_text(field.rel.to._meta), }) class Deserializer(base.Deserializer): """ Deserialize XML. """ def __init__(self, stream_or_string, **options): super(Deserializer, self).__init__(stream_or_string, **options) self.event_stream = pulldom.parse(self.stream, self._make_parser()) self.db = options.pop('using', DEFAULT_DB_ALIAS) self.ignore = options.pop('ignorenonexistent', False) def _make_parser(self): """Create a hardened XML parser (no custom/external entities).""" return DefusedExpatParser() def __next__(self): for event, node in self.event_stream: if event == "START_ELEMENT" and node.nodeName == "object": self.event_stream.expandNode(node) return self._handle_object(node) raise StopIteration def _handle_object(self, node): """ Convert an <object> node to a DeserializedObject. """ # Look up the model using the model loading mechanism. If this fails, # bail. Model = self._get_model_from_node(node, "model") # Start building a data dictionary from the object. data = {} if node.hasAttribute('pk'): data[Model._meta.pk.attname] = Model._meta.pk.to_python( node.getAttribute('pk')) # Also start building a dict of m2m data (this is saved as # {m2m_accessor_attribute : [list_of_related_objects]}) m2m_data = {} model_fields = Model._meta.get_all_field_names() # Deseralize each field. for field_node in node.getElementsByTagName("field"): # If the field is missing the name attribute, bail (are you # sensing a pattern here?) field_name = field_node.getAttribute("name") if not field_name: raise base.DeserializationError("<field> node is missing the 'name' attribute") # Get the field from the Model. This will raise a # FieldDoesNotExist if, well, the field doesn't exist, which will # be propagated correctly unless ignorenonexistent=True is used. if self.ignore and field_name not in model_fields: continue field = Model._meta.get_field(field_name) # As is usually the case, relation fields get the special treatment. if field.rel and isinstance(field.rel, models.ManyToManyRel): m2m_data[field.name] = self._handle_m2m_field_node(field_node, field) elif field.rel and isinstance(field.rel, models.ManyToOneRel): data[field.attname] = self._handle_fk_field_node(field_node, field) else: if field_node.getElementsByTagName('None'): value = None else: value = field.to_python(getInnerText(field_node).strip()) data[field.name] = value obj = base.build_instance(Model, data, self.db) # Return a DeserializedObject so that the m2m data has a place to live. return base.DeserializedObject(obj, m2m_data) def _handle_fk_field_node(self, node, field): """ Handle a <field> node for a ForeignKey """ # Check if there is a child node named 'None', returning None if so. if node.getElementsByTagName('None'): return None else: if hasattr(field.rel.to._default_manager, 'get_by_natural_key'): keys = node.getElementsByTagName('natural') if keys: # If there are 'natural' subelements, it must be a natural key field_value = [getInnerText(k).strip() for k in keys] obj = field.rel.to._default_manager.db_manager(self.db).get_by_natural_key(*field_value) obj_pk = getattr(obj, field.rel.field_name) # If this is a natural foreign key to an object that # has a FK/O2O as the foreign key, use the FK value if field.rel.to._meta.pk.rel: obj_pk = obj_pk.pk else: # Otherwise, treat like a normal PK field_value = getInnerText(node).strip() obj_pk = field.rel.to._meta.get_field(field.rel.field_name).to_python(field_value) return obj_pk else: field_value = getInnerText(node).strip() return field.rel.to._meta.get_field(field.rel.field_name).to_python(field_value) def _handle_m2m_field_node(self, node, field): """ Handle a <field> node for a ManyToManyField. """ if hasattr(field.rel.to._default_manager, 'get_by_natural_key'): def m2m_convert(n): keys = n.getElementsByTagName('natural') if keys: # If there are 'natural' subelements, it must be a natural key field_value = [getInnerText(k).strip() for k in keys] obj_pk = field.rel.to._default_manager.db_manager(self.db).get_by_natural_key(*field_value).pk else: # Otherwise, treat like a normal PK value. obj_pk = field.rel.to._meta.pk.to_python(n.getAttribute('pk')) return obj_pk else: m2m_convert = lambda n: field.rel.to._meta.pk.to_python(n.getAttribute('pk')) return [m2m_convert(c) for c in node.getElementsByTagName("object")] def _get_model_from_node(self, node, attr): """ Helper to look up a model from a <object model=...> or a <field rel=... to=...> node. """ model_identifier = node.getAttribute(attr) if not model_identifier: raise base.DeserializationError( "<%s> node is missing the required '%s' attribute" % (node.nodeName, attr)) try: return apps.get_model(model_identifier) except (LookupError, TypeError): raise base.DeserializationError( "<%s> node has invalid model identifier: '%s'" % (node.nodeName, model_identifier)) def getInnerText(node): """ Get all the inner text of a DOM node (recursively). """ # inspired by http://mail.python.org/pipermail/xml-sig/2005-March/011022.html inner_text = [] for child in node.childNodes: if child.nodeType == child.TEXT_NODE or child.nodeType == child.CDATA_SECTION_NODE: inner_text.append(child.data) elif child.nodeType == child.ELEMENT_NODE: inner_text.extend(getInnerText(child)) else: pass return "".join(inner_text) # Below code based on Christian Heimes' defusedxml class DefusedExpatParser(_ExpatParser): """ An expat parser hardened against XML bomb attacks. Forbids DTDs, external entity references """ def __init__(self, *args, **kwargs): _ExpatParser.__init__(self, *args, **kwargs) self.setFeature(handler.feature_external_ges, False) self.setFeature(handler.feature_external_pes, False) def start_doctype_decl(self, name, sysid, pubid, has_internal_subset): raise DTDForbidden(name, sysid, pubid) def entity_decl(self, name, is_parameter_entity, value, base, sysid, pubid, notation_name): raise EntitiesForbidden(name, value, base, sysid, pubid, notation_name) def unparsed_entity_decl(self, name, base, sysid, pubid, notation_name): # expat 1.2 raise EntitiesForbidden(name, None, base, sysid, pubid, notation_name) def external_entity_ref_handler(self, context, base, sysid, pubid): raise ExternalReferenceForbidden(context, base, sysid, pubid) def reset(self): _ExpatParser.reset(self) parser = self._parser parser.StartDoctypeDeclHandler = self.start_doctype_decl parser.EntityDeclHandler = self.entity_decl parser.UnparsedEntityDeclHandler = self.unparsed_entity_decl parser.ExternalEntityRefHandler = self.external_entity_ref_handler class DefusedXmlException(ValueError): """Base exception.""" def __repr__(self): return str(self) class DTDForbidden(DefusedXmlException): """Document type definition is forbidden.""" def __init__(self, name, sysid, pubid): super(DTDForbidden, self).__init__() self.name = name self.sysid = sysid self.pubid = pubid def __str__(self): tpl = "DTDForbidden(name='{}', system_id={!r}, public_id={!r})" return tpl.format(self.name, self.sysid, self.pubid) class EntitiesForbidden(DefusedXmlException): """Entity definition is forbidden.""" def __init__(self, name, value, base, sysid, pubid, notation_name): super(EntitiesForbidden, self).__init__() self.name = name self.value = value self.base = base self.sysid = sysid self.pubid = pubid self.notation_name = notation_name def __str__(self): tpl = "EntitiesForbidden(name='{}', system_id={!r}, public_id={!r})" return tpl.format(self.name, self.sysid, self.pubid) class ExternalReferenceForbidden(DefusedXmlException): """Resolving an external reference is forbidden.""" def __init__(self, context, base, sysid, pubid): super(ExternalReferenceForbidden, self).__init__() self.context = context self.base = base self.sysid = sysid self.pubid = pubid def __str__(self): tpl = "ExternalReferenceForbidden(system_id='{}', public_id={})" return tpl.format(self.sysid, self.pubid)
bsd-3-clause
[ 624, 199, 4317, 9146, 14, 199, 624, 199, 199, 504, 636, 2443, 363, 492, 2649, 63, 5955, 199, 199, 504, 1639, 14, 5181, 492, 8686, 199, 504, 1639, 14, 2190, 492, 2202, 199, 504, 1639, 14, 1018, 14, 12844, 492, 1300, 199, 504, 1639, 14, 697, 492, 1709, 12, 6186, 63, 2846, 63, 12644, 199, 504, 1639, 14, 1208, 14, 1652, 1208, 492, 5870, 82, 4317, 7599, 199, 504, 1639, 14, 1208, 14, 2991, 492, 11179, 63, 505, 199, 504, 2748, 14, 4556, 492, 10299, 4556, 199, 504, 2748, 14, 14338, 492, 3016, 199, 504, 2748, 14, 14338, 14, 27098, 5503, 492, 7910, 292, 2842, 465, 485, 4527, 292, 2842, 421, 199, 533, 25555, 8, 1095, 14, 7299, 304, 272, 408, 272, 11973, 6491, 282, 18397, 370, 4692, 14, 272, 408, 339, 347, 4363, 8, 277, 12, 2166, 304, 267, 340, 291, 14, 1419, 14, 362, 360, 3724, 297, 488, 9, 365, 440, 488, 26, 288, 291, 14, 1652, 14, 1030, 30932, 16552, 2258, 78, 7, 435, 283, 283, 627, 291, 14, 1419, 14, 362, 360, 3724, 297, 488, 9, 627, 2166, 9, 339, 347, 1343, 63, 12161, 8, 277, 304, 267, 408, 267, 7707, 16953, 1553, 1551, 314, 4692, 2213, 436, 314, 1738, 1819, 14, 267, 408, 267, 291, 14, 1652, 275, 5870, 82, 4317, 7599, 8, 277, 14, 1745, 12, 291, 14, 1419, 14, 362, 480, 2991, 401, 2202, 14, 3472, 63, 23969, 430, 267, 291, 14, 1652, 14, 928, 5564, 342, 267, 291, 14, 1652, 14, 30398, 480, 1176, 13, 1462, 401, 2420, 1023, 582, 298, 17, 14, 16, 5984, 339, 347, 1284, 63, 12161, 8, 277, 304, 267, 408, 267, 9599, 16953, 1553, 1284, 314, 2213, 14, 267, 408, 267, 291, 14, 3724, 8, 16, 9, 267, 291, 14, 1652, 14, 31290, 480, 1176, 13, 1462, 531, 267, 291, 14, 1652, 14, 500, 5564, 342, 339, 347, 1343, 63, 785, 8, 277, 12, 1559, 304, 267, 408, 267, 12295, 465, 1924, 909, 365, 8860, 14, 267, 408, 267, 340, 440, 2688, 8, 1113, 12, 2668, 2024, 2349, 288, 746, 1300, 14, 3571, 2072, 547, 480, 6932, 13, 1238, 909, 4366, 83, 9, 14556, 5309, 16953, 2, 450, 730, 8, 1113, 430, 398, 291, 14, 3724, 8, 17, 9, 267, 3290, 275, 2420, 1238, 582, 11179, 63, 505, 8, 1113, 423, 2024, 6769, 267, 340, 440, 291, 14, 1180, 63, 15759, 63, 3327, 63, 1612, 503, 440, 2688, 8, 1113, 12, 283, 15759, 63, 498, 735, 288, 1559, 63, 2051, 275, 1559, 423, 362, 63, 2051, 63, 637, 342, 288, 340, 1559, 63, 2051, 365, 440, 488, 26, 355, 3290, 459, 2051, 418, 275, 11179, 63, 505, 8, 1113, 63, 2051, 9, 398, 291, 14, 1652, 14, 30398, 480, 785, 401, 3290, 9, 339, 347, 1284, 63, 785, 8, 277, 12, 1559, 304, 267, 408, 267, 12295, 2410, 7252, 1006, 1504, 367, 376, 909, 14, 267, 408, 267, 291, 14, 3724, 8, 17, 9, 267, 291, 14, 1652, 14, 31290, 480, 785, 531, 339, 347, 2429, 63, 698, 8, 277, 12, 1559, 12, 901, 304, 267, 408, 267, 12295, 370, 2429, 1924, 901, 641, 376, 909, 334, 2590, 367, 481, 2692, 6340, 436, 267, 28409, 83, 9, 267, 408, 267, 291, 14, 3724, 8, 18, 9, 267, 291, 14, 1652, 14, 30398, 480, 698, 401, 469, 288, 298, 354, 582, 901, 14, 354, 12, 288, 298, 466, 582, 901, 14, 362, 63, 4672, 63, 466, 342, 267, 3828, 398, 327, 2372, 282, 298, 875, 1015, 2, 402, 314, 909, 1159, 666, 14, 267, 340, 2519, 8, 1113, 12, 901, 14, 354, 9, 365, 440, 488, 26, 288, 291, 14, 1652, 14, 16516, 8, 698, 14, 585, 63, 475, 63, 875, 8, 1113, 430, 267, 587, 26, 288, 291, 14, 1652, 14, 525, 19684, 2162, 480, 403, 531, 398, 291, 14, 1652, 14, 31290, 480, 698, 531, 339, 347, 2429, 63, 9010, 63, 698, 8, 277, 12, 1559, 12, 901, 304, 267, 408, 267, 12295, 370, 2429, 282, 12718, 334, 1129, 1929, 370, 14312, 3062, 18023, 267, 23142, 687, 5578, 1504, 680, 267, 408, 267, 291, 423, 928, 63, 5690, 279, 63, 698, 8, 698, 9, 267, 4048, 63, 6796, 275, 2519, 8, 1113, 12, 901, 14, 362, 63, 13651, 1012, 267, 340, 4048, 63, 6796, 365, 440, 488, 26, 288, 340, 291, 14, 1180, 63, 15759, 63, 6846, 63, 1612, 436, 2688, 8, 698, 14, 3369, 14, 475, 12, 283, 15759, 63, 498, 735, 355, 4048, 275, 2519, 8, 1113, 12, 901, 14, 354, 9, 355, 327, 982, 4048, 909, 965, 282, 19981, 790, 12, 675, 652, 355, 4048, 275, 4048, 14, 15759, 63, 498, 342, 355, 327, 19937, 19981, 2883, 787, 20182, 1146, 734, 465, 1007, 5527, 355, 367, 790, 63, 585, 315, 4048, 26, 490, 291, 14, 1652, 14, 30398, 480, 15759, 401, 5009, 490, 291, 14, 1652, 14, 16516, 8, 7853, 63, 505, 8, 498, 63, 585, 430, 490, 291, 14, 1652, 14, 31290, 480, 15759, 531, 288, 587, 26, 355, 291, 14, 1652, 14, 16516, 8, 7853, 63, 505, 8, 2407, 63, 6796, 430, 267, 587, 26, 288, 291, 14, 1652, 14, 525, 19684, 2162, 480, 403, 531, 267, 291, 14, 1652, 14, 31290, 480, 698, 531, 339, 347, 2429, 63, 77, 18, 77, 63, 698, 8, 277, 12, 1559, 12, 901, 304, 267, 408, 267, 12295, 370, 2429, 282, 28409, 14, 20116, 2251, 787, 1454, 267, 6380, 465, 6941, 370, 314, 909, 1159, 18368, 334, 73, 14, 69, 14, 314, 4048, 627, 576, 10, 267, 365, 440, 31374, 12, 2951, 314, 5850, 680, 267, 408, 267, 340, 901, 14, 3369, 14, 8304, 423, 2024, 14, 2495, 63, 3966, 26, 288, 291, 423, 928, 63, 5690, 279, 63, 698, 8, 698, 9, 288, 340, 291, 14, 1180, 63, 15759, 63, 6846, 63, 1612, 436, 2688, 8, 698, 14, 3369, 14, 475, 12, 283, 15759, 63, 498, 735, 355, 327, 982, 314, 2251, 315, 314, 333, 18, 77, 1172, 282, 19981, 790, 12, 675, 652, 355, 347, 2429, 63, 77, 18, 77, 8, 585, 304, 490, 19981, 275, 574, 14, 15759, 63, 498, 342, 490, 327, 19937, 19981, 2883, 787, 20182, 1146, 734, 465, 1007, 5527, 490, 291 ]
[ 199, 4317, 9146, 14, 199, 624, 199, 199, 504, 636, 2443, 363, 492, 2649, 63, 5955, 199, 199, 504, 1639, 14, 5181, 492, 8686, 199, 504, 1639, 14, 2190, 492, 2202, 199, 504, 1639, 14, 1018, 14, 12844, 492, 1300, 199, 504, 1639, 14, 697, 492, 1709, 12, 6186, 63, 2846, 63, 12644, 199, 504, 1639, 14, 1208, 14, 1652, 1208, 492, 5870, 82, 4317, 7599, 199, 504, 1639, 14, 1208, 14, 2991, 492, 11179, 63, 505, 199, 504, 2748, 14, 4556, 492, 10299, 4556, 199, 504, 2748, 14, 14338, 492, 3016, 199, 504, 2748, 14, 14338, 14, 27098, 5503, 492, 7910, 292, 2842, 465, 485, 4527, 292, 2842, 421, 199, 533, 25555, 8, 1095, 14, 7299, 304, 272, 408, 272, 11973, 6491, 282, 18397, 370, 4692, 14, 272, 408, 339, 347, 4363, 8, 277, 12, 2166, 304, 267, 340, 291, 14, 1419, 14, 362, 360, 3724, 297, 488, 9, 365, 440, 488, 26, 288, 291, 14, 1652, 14, 1030, 30932, 16552, 2258, 78, 7, 435, 283, 283, 627, 291, 14, 1419, 14, 362, 360, 3724, 297, 488, 9, 627, 2166, 9, 339, 347, 1343, 63, 12161, 8, 277, 304, 267, 408, 267, 7707, 16953, 1553, 1551, 314, 4692, 2213, 436, 314, 1738, 1819, 14, 267, 408, 267, 291, 14, 1652, 275, 5870, 82, 4317, 7599, 8, 277, 14, 1745, 12, 291, 14, 1419, 14, 362, 480, 2991, 401, 2202, 14, 3472, 63, 23969, 430, 267, 291, 14, 1652, 14, 928, 5564, 342, 267, 291, 14, 1652, 14, 30398, 480, 1176, 13, 1462, 401, 2420, 1023, 582, 298, 17, 14, 16, 5984, 339, 347, 1284, 63, 12161, 8, 277, 304, 267, 408, 267, 9599, 16953, 1553, 1284, 314, 2213, 14, 267, 408, 267, 291, 14, 3724, 8, 16, 9, 267, 291, 14, 1652, 14, 31290, 480, 1176, 13, 1462, 531, 267, 291, 14, 1652, 14, 500, 5564, 342, 339, 347, 1343, 63, 785, 8, 277, 12, 1559, 304, 267, 408, 267, 12295, 465, 1924, 909, 365, 8860, 14, 267, 408, 267, 340, 440, 2688, 8, 1113, 12, 2668, 2024, 2349, 288, 746, 1300, 14, 3571, 2072, 547, 480, 6932, 13, 1238, 909, 4366, 83, 9, 14556, 5309, 16953, 2, 450, 730, 8, 1113, 430, 398, 291, 14, 3724, 8, 17, 9, 267, 3290, 275, 2420, 1238, 582, 11179, 63, 505, 8, 1113, 423, 2024, 6769, 267, 340, 440, 291, 14, 1180, 63, 15759, 63, 3327, 63, 1612, 503, 440, 2688, 8, 1113, 12, 283, 15759, 63, 498, 735, 288, 1559, 63, 2051, 275, 1559, 423, 362, 63, 2051, 63, 637, 342, 288, 340, 1559, 63, 2051, 365, 440, 488, 26, 355, 3290, 459, 2051, 418, 275, 11179, 63, 505, 8, 1113, 63, 2051, 9, 398, 291, 14, 1652, 14, 30398, 480, 785, 401, 3290, 9, 339, 347, 1284, 63, 785, 8, 277, 12, 1559, 304, 267, 408, 267, 12295, 2410, 7252, 1006, 1504, 367, 376, 909, 14, 267, 408, 267, 291, 14, 3724, 8, 17, 9, 267, 291, 14, 1652, 14, 31290, 480, 785, 531, 339, 347, 2429, 63, 698, 8, 277, 12, 1559, 12, 901, 304, 267, 408, 267, 12295, 370, 2429, 1924, 901, 641, 376, 909, 334, 2590, 367, 481, 2692, 6340, 436, 267, 28409, 83, 9, 267, 408, 267, 291, 14, 3724, 8, 18, 9, 267, 291, 14, 1652, 14, 30398, 480, 698, 401, 469, 288, 298, 354, 582, 901, 14, 354, 12, 288, 298, 466, 582, 901, 14, 362, 63, 4672, 63, 466, 342, 267, 3828, 398, 327, 2372, 282, 298, 875, 1015, 2, 402, 314, 909, 1159, 666, 14, 267, 340, 2519, 8, 1113, 12, 901, 14, 354, 9, 365, 440, 488, 26, 288, 291, 14, 1652, 14, 16516, 8, 698, 14, 585, 63, 475, 63, 875, 8, 1113, 430, 267, 587, 26, 288, 291, 14, 1652, 14, 525, 19684, 2162, 480, 403, 531, 398, 291, 14, 1652, 14, 31290, 480, 698, 531, 339, 347, 2429, 63, 9010, 63, 698, 8, 277, 12, 1559, 12, 901, 304, 267, 408, 267, 12295, 370, 2429, 282, 12718, 334, 1129, 1929, 370, 14312, 3062, 18023, 267, 23142, 687, 5578, 1504, 680, 267, 408, 267, 291, 423, 928, 63, 5690, 279, 63, 698, 8, 698, 9, 267, 4048, 63, 6796, 275, 2519, 8, 1113, 12, 901, 14, 362, 63, 13651, 1012, 267, 340, 4048, 63, 6796, 365, 440, 488, 26, 288, 340, 291, 14, 1180, 63, 15759, 63, 6846, 63, 1612, 436, 2688, 8, 698, 14, 3369, 14, 475, 12, 283, 15759, 63, 498, 735, 355, 4048, 275, 2519, 8, 1113, 12, 901, 14, 354, 9, 355, 327, 982, 4048, 909, 965, 282, 19981, 790, 12, 675, 652, 355, 4048, 275, 4048, 14, 15759, 63, 498, 342, 355, 327, 19937, 19981, 2883, 787, 20182, 1146, 734, 465, 1007, 5527, 355, 367, 790, 63, 585, 315, 4048, 26, 490, 291, 14, 1652, 14, 30398, 480, 15759, 401, 5009, 490, 291, 14, 1652, 14, 16516, 8, 7853, 63, 505, 8, 498, 63, 585, 430, 490, 291, 14, 1652, 14, 31290, 480, 15759, 531, 288, 587, 26, 355, 291, 14, 1652, 14, 16516, 8, 7853, 63, 505, 8, 2407, 63, 6796, 430, 267, 587, 26, 288, 291, 14, 1652, 14, 525, 19684, 2162, 480, 403, 531, 267, 291, 14, 1652, 14, 31290, 480, 698, 531, 339, 347, 2429, 63, 77, 18, 77, 63, 698, 8, 277, 12, 1559, 12, 901, 304, 267, 408, 267, 12295, 370, 2429, 282, 28409, 14, 20116, 2251, 787, 1454, 267, 6380, 465, 6941, 370, 314, 909, 1159, 18368, 334, 73, 14, 69, 14, 314, 4048, 627, 576, 10, 267, 365, 440, 31374, 12, 2951, 314, 5850, 680, 267, 408, 267, 340, 901, 14, 3369, 14, 8304, 423, 2024, 14, 2495, 63, 3966, 26, 288, 291, 423, 928, 63, 5690, 279, 63, 698, 8, 698, 9, 288, 340, 291, 14, 1180, 63, 15759, 63, 6846, 63, 1612, 436, 2688, 8, 698, 14, 3369, 14, 475, 12, 283, 15759, 63, 498, 735, 355, 327, 982, 314, 2251, 315, 314, 333, 18, 77, 1172, 282, 19981, 790, 12, 675, 652, 355, 347, 2429, 63, 77, 18, 77, 8, 585, 304, 490, 19981, 275, 574, 14, 15759, 63, 498, 342, 490, 327, 19937, 19981, 2883, 787, 20182, 1146, 734, 465, 1007, 5527, 490, 291, 0 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 ]
waelrash1/or-tools
data/nonogram_regular/nonogram_p199.py
74
1527
# Copyright 2010 Hakan Kjellerstrand [email protected] # # 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. # # Nonogram problem: P199, difficulty 8 # From http://87.230.22.228/examples/nono_regular.ecl.txt # rows = 20 row_rule_len = 6 row_rules = [ [0,0,0,1,1,4], [0,0,0,0,1,6], [1,1,1,1,2,3], [0,0,1,1,2,3], [0,0,3,1,2,3], [0,0,4,5,2,2], [0,0,0,7,3,2], [0,0,3,5,1,2], [0,0,2,2,4,1], [0,0,2,2,3,4], [0,0,0,2,5,2], [0,0,2,1,5,1], [0,0,2,2,3,1], [0,0,0,6,2,2], [0,0,0,0,1,7], [0,0,0,2,2,2], [0,0,0,0,1,4], [0,0,0,3,1,1], [0,0,0,0,1,1], [0,0,0,0,1,1] ] cols = 20 col_rule_len = 5 col_rules = [ [0,0,0,6,1], [0,0,0,8,3], [0,0,3,2,1], [1,1,2,2,1], [1,2,2,1,1], [0,1,1,1,1], [0,0,0,2,3], [0,4,1,2,2], [0,0,5,2,1], [0,0,8,1,1], [0,0,0,7,2], [0,0,3,5,2], [0,0,0,2,5], [0,0,2,1,4], [0,2,2,2,2], [2,2,1,1,1], [3,1,1,1,1], [0,5,4,2,1], [0,7,4,1,1], [0,0,0,0,4] ]
apache-2.0
[ 3, 1898, 7129, 869, 1151, 290, 1804, 74, 352, 1435, 30964, 394, 1151, 3580, 32, 21134, 84, 1198, 14, 957, 199, 3, 199, 3, 3909, 1334, 314, 3668, 844, 12, 3394, 499, 14, 16, 334, 1589, 283, 3761, 11339, 221, 199, 3, 1265, 1443, 440, 675, 642, 570, 871, 315, 4151, 543, 314, 844, 14, 221, 199, 3, 2047, 1443, 3332, 282, 1331, 402, 314, 844, 737, 221, 199, 3, 199, 3, 258, 1455, 921, 1544, 14, 3796, 14, 1308, 15, 2383, 15, 3961, 13, 18, 14, 16, 221, 199, 3, 199, 3, 4158, 1415, 701, 3964, 4179, 503, 4193, 370, 315, 3575, 12, 2032, 221, 199, 3, 1854, 1334, 314, 844, 365, 1854, 641, 376, 283, 1179, 2281, 7, 4207, 12, 221, 199, 3, 2428, 2990, 1549, 4217, 1634, 1821, 3826, 12, 1902, 4056, 503, 2478, 14, 221, 199, 3, 1666, 314, 844, 367, 314, 2488, 2637, 4210, 3443, 436, 221, 199, 3, 4204, 1334, 314, 844, 14, 221, 199, 3, 199, 3, 10172, 79, 1679, 5160, 26, 510, 7155, 12, 23976, 17323, 1695, 199, 3, 11606, 1455, 921, 1555, 14, 9687, 14, 1081, 14, 12048, 15, 8589, 15, 2865, 79, 63, 7898, 14, 69, 429, 14, 2424, 199, 3, 199, 3838, 275, 3388, 199, 1143, 63, 2200, 63, 552, 275, 1227, 199, 1143, 63, 4423, 275, 359, 272, 359, 16, 12, 16, 12, 16, 12, 17, 12, 17, 12, 20, 467, 272, 359, 16, 12, 16, 12, 16, 12, 16, 12, 17, 12, 22, 467, 272, 359, 17, 12, 17, 12, 17, 12, 17, 12, 18, 12, 19, 467, 272, 359, 16, 12, 16, 12, 17, 12, 17, 12, 18, 12, 19, 467, 272, 359, 16, 12, 16, 12, 19, 12, 17, 12, 18, 12, 19, 467, 272, 359, 16, 12, 16, 12, 20, 12, 21, 12, 18, 12, 18, 467, 272, 359, 16, 12, 16, 12, 16, 12, 23, 12, 19, 12, 18, 467, 272, 359, 16, 12, 16, 12, 19, 12, 21, 12, 17, 12, 18, 467, 272, 359, 16, 12, 16, 12, 18, 12, 18, 12, 20, 12, 17, 467, 272, 359, 16, 12, 16, 12, 18, 12, 18, 12, 19, 12, 20, 467, 272, 359, 16, 12, 16, 12, 16, 12, 18, 12, 21, 12, 18, 467, 272, 359, 16, 12, 16, 12, 18, 12, 17, 12, 21, 12, 17, 467, 272, 359, 16, 12, 16, 12, 18, 12, 18, 12, 19, 12, 17, 467, 272, 359, 16, 12, 16, 12, 16, 12, 22, 12, 18, 12, 18, 467, 272, 359, 16, 12, 16, 12, 16, 12, 16, 12, 17, 12, 23, 467, 272, 359, 16, 12, 16, 12, 16, 12, 18, 12, 18, 12, 18, 467, 272, 359, 16, 12, 16, 12, 16, 12, 16, 12, 17, 12, 20, 467, 272, 359, 16, 12, 16, 12, 16, 12, 19, 12, 17, 12, 17, 467, 272, 359, 16, 12, 16, 12, 16, 12, 16, 12, 17, 12, 17, 467, 272, 359, 16, 12, 16, 12, 16, 12, 16, 12, 17, 12, 17, 61, 272, 1622, 199, 199, 4574, 275, 3388, 199, 761, 63, 2200, 63, 552, 275, 959, 199, 761, 63, 4423, 275, 359, 272, 359, 16, 12, 16, 12, 16, 12, 22, 12, 17, 467, 272, 359, 16, 12, 16, 12, 16, 12, 24, 12, 19, 467, 272, 359, 16, 12, 16, 12, 19, 12, 18, 12, 17, 467, 272, 359, 17, 12, 17, 12, 18, 12, 18, 12, 17, 467, 272, 359, 17, 12, 18, 12, 18, 12, 17, 12, 17, 467, 272, 359, 16, 12, 17, 12, 17, 12, 17, 12, 17, 467, 272, 359, 16, 12, 16, 12, 16, 12, 18, 12, 19, 467, 272, 359, 16, 12, 20, 12, 17, 12, 18, 12, 18, 467, 272, 359, 16, 12, 16, 12, 21, 12, 18, 12, 17, 467, 272, 359, 16, 12, 16, 12, 24, 12, 17, 12, 17, 467, 272, 359, 16, 12, 16, 12, 16, 12, 23, 12, 18, 467, 272, 359, 16, 12, 16, 12, 19, 12, 21, 12, 18, 467, 272, 359, 16, 12, 16, 12, 16, 12, 18, 12, 21, 467, 272, 359, 16, 12, 16, 12, 18, 12, 17, 12, 20, 467, 272, 359, 16, 12, 18, 12, 18, 12, 18, 12, 18, 467, 272, 359, 18, 12, 18, 12, 17, 12, 17, 12, 17, 467, 272, 359, 19, 12, 17, 12, 17, 12, 17, 12, 17, 467, 272, 359, 16, 12, 21, 12, 20, 12, 18, 12, 17, 467, 272, 359, 16, 12, 23, 12, 20, 12, 17, 12, 17, 467, 272, 359, 16, 12, 16, 12, 16, 12, 16, 12, 20, 61, 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, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 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, 7129, 869, 1151, 290, 1804, 74, 352, 1435, 30964, 394, 1151, 3580, 32, 21134, 84, 1198, 14, 957, 199, 3, 199, 3, 3909, 1334, 314, 3668, 844, 12, 3394, 499, 14, 16, 334, 1589, 283, 3761, 11339, 221, 199, 3, 1265, 1443, 440, 675, 642, 570, 871, 315, 4151, 543, 314, 844, 14, 221, 199, 3, 2047, 1443, 3332, 282, 1331, 402, 314, 844, 737, 221, 199, 3, 199, 3, 258, 1455, 921, 1544, 14, 3796, 14, 1308, 15, 2383, 15, 3961, 13, 18, 14, 16, 221, 199, 3, 199, 3, 4158, 1415, 701, 3964, 4179, 503, 4193, 370, 315, 3575, 12, 2032, 221, 199, 3, 1854, 1334, 314, 844, 365, 1854, 641, 376, 283, 1179, 2281, 7, 4207, 12, 221, 199, 3, 2428, 2990, 1549, 4217, 1634, 1821, 3826, 12, 1902, 4056, 503, 2478, 14, 221, 199, 3, 1666, 314, 844, 367, 314, 2488, 2637, 4210, 3443, 436, 221, 199, 3, 4204, 1334, 314, 844, 14, 221, 199, 3, 199, 3, 10172, 79, 1679, 5160, 26, 510, 7155, 12, 23976, 17323, 1695, 199, 3, 11606, 1455, 921, 1555, 14, 9687, 14, 1081, 14, 12048, 15, 8589, 15, 2865, 79, 63, 7898, 14, 69, 429, 14, 2424, 199, 3, 199, 3838, 275, 3388, 199, 1143, 63, 2200, 63, 552, 275, 1227, 199, 1143, 63, 4423, 275, 359, 272, 359, 16, 12, 16, 12, 16, 12, 17, 12, 17, 12, 20, 467, 272, 359, 16, 12, 16, 12, 16, 12, 16, 12, 17, 12, 22, 467, 272, 359, 17, 12, 17, 12, 17, 12, 17, 12, 18, 12, 19, 467, 272, 359, 16, 12, 16, 12, 17, 12, 17, 12, 18, 12, 19, 467, 272, 359, 16, 12, 16, 12, 19, 12, 17, 12, 18, 12, 19, 467, 272, 359, 16, 12, 16, 12, 20, 12, 21, 12, 18, 12, 18, 467, 272, 359, 16, 12, 16, 12, 16, 12, 23, 12, 19, 12, 18, 467, 272, 359, 16, 12, 16, 12, 19, 12, 21, 12, 17, 12, 18, 467, 272, 359, 16, 12, 16, 12, 18, 12, 18, 12, 20, 12, 17, 467, 272, 359, 16, 12, 16, 12, 18, 12, 18, 12, 19, 12, 20, 467, 272, 359, 16, 12, 16, 12, 16, 12, 18, 12, 21, 12, 18, 467, 272, 359, 16, 12, 16, 12, 18, 12, 17, 12, 21, 12, 17, 467, 272, 359, 16, 12, 16, 12, 18, 12, 18, 12, 19, 12, 17, 467, 272, 359, 16, 12, 16, 12, 16, 12, 22, 12, 18, 12, 18, 467, 272, 359, 16, 12, 16, 12, 16, 12, 16, 12, 17, 12, 23, 467, 272, 359, 16, 12, 16, 12, 16, 12, 18, 12, 18, 12, 18, 467, 272, 359, 16, 12, 16, 12, 16, 12, 16, 12, 17, 12, 20, 467, 272, 359, 16, 12, 16, 12, 16, 12, 19, 12, 17, 12, 17, 467, 272, 359, 16, 12, 16, 12, 16, 12, 16, 12, 17, 12, 17, 467, 272, 359, 16, 12, 16, 12, 16, 12, 16, 12, 17, 12, 17, 61, 272, 1622, 199, 199, 4574, 275, 3388, 199, 761, 63, 2200, 63, 552, 275, 959, 199, 761, 63, 4423, 275, 359, 272, 359, 16, 12, 16, 12, 16, 12, 22, 12, 17, 467, 272, 359, 16, 12, 16, 12, 16, 12, 24, 12, 19, 467, 272, 359, 16, 12, 16, 12, 19, 12, 18, 12, 17, 467, 272, 359, 17, 12, 17, 12, 18, 12, 18, 12, 17, 467, 272, 359, 17, 12, 18, 12, 18, 12, 17, 12, 17, 467, 272, 359, 16, 12, 17, 12, 17, 12, 17, 12, 17, 467, 272, 359, 16, 12, 16, 12, 16, 12, 18, 12, 19, 467, 272, 359, 16, 12, 20, 12, 17, 12, 18, 12, 18, 467, 272, 359, 16, 12, 16, 12, 21, 12, 18, 12, 17, 467, 272, 359, 16, 12, 16, 12, 24, 12, 17, 12, 17, 467, 272, 359, 16, 12, 16, 12, 16, 12, 23, 12, 18, 467, 272, 359, 16, 12, 16, 12, 19, 12, 21, 12, 18, 467, 272, 359, 16, 12, 16, 12, 16, 12, 18, 12, 21, 467, 272, 359, 16, 12, 16, 12, 18, 12, 17, 12, 20, 467, 272, 359, 16, 12, 18, 12, 18, 12, 18, 12, 18, 467, 272, 359, 18, 12, 18, 12, 17, 12, 17, 12, 17, 467, 272, 359, 19, 12, 17, 12, 17, 12, 17, 12, 17, 467, 272, 359, 16, 12, 21, 12, 20, 12, 18, 12, 17, 467, 272, 359, 16, 12, 23, 12, 20, 12, 17, 12, 17, 467, 272, 359, 16, 12, 16, 12, 16, 12, 16, 12, 20, 61, 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, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 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 ]
michaelgallacher/intellij-community
python/helpers/python-skeletons/subprocess.py
62
4287
"""Skeleton for 'subprocess' stdlib module.""" def call(args, bufsize=0, executable=None, stdin=None, stdout=None, stderr=None, preexec_fn=None, close_fds=False, shell=False, cwd=None, env=None, universal_newlines=False, startupinfo=None, creationflags=0, timeout=None, restore_signals=True, start_new_session=False, pass_fds=()): """Run the command described by args. :type args: collections.Iterable[bytes | unicode] :type bufsize: int :type executable: bytes | unicode | None :type close_fds: bool :type shell: bool :type cwd: bytes | unicode | None :type env: collections.Mapping | None :type universal_newlines: bool :type creationflags: int :rtype: int """ return 0 def check_call(args, bufsize=0, executable=None, stdin=None, stdout=None, stderr=None, preexec_fn=None, close_fds=False, shell=False, cwd=None, env=None, universal_newlines=False, startupinfo=None, creationflags=0, timeout=None, restore_signals=True, start_new_session=False, pass_fds=()): """Run command with arguments. Wait for command to complete. If the return code was zero then return, otherwise raise CalledProcessError. :type args: collections.Iterable[bytes | unicode] :type bufsize: int :type executable: bytes | unicode | None :type close_fds: bool :type shell: bool :type cwd: bytes | unicode | None :type env: collections.Mapping | None :type universal_newlines: bool :type creationflags: int :rtype: int """ return 0 def check_output(args, bufsize=0, executable=None, stdin=None, stderr=None, preexec_fn=None, close_fds=False, shell=False, cwd=None, env=None, universal_newlines=False, startupinfo=None, creationflags=0, timeout=None, restore_signals=True, start_new_session=False, pass_fds=()): """Run command with arguments and return its output as a byte string. :type args: collections.Iterable[bytes | unicode] :type bufsize: int :type executable: bytes | unicode | None :type close_fds: bool :type shell: bool :type cwd: bytes | unicode | None :type env: collections.Mapping | None :type universal_newlines: bool :type creationflags: int :rtype: bytes """ pass class Popen(object): """Execute a child program in a new process. :type returncode: int """ def __init__(self, args, bufsize=0, executable=None, stdin=None, stdout=None, stderr=None, preexec_fn=None, close_fds=False, shell=False, cwd=None, env=None, universal_newlines=False, startupinfo=None, creationflags=0, timeout=None, restore_signals=True, start_new_session=False, pass_fds=()): """Popen constructor. :type args: collections.Iterable[bytes | unicode] :type bufsize: int :type executable: bytes | unicode | None :type close_fds: bool :type shell: bool :type cwd: bytes | unicode | None :type env: collections.Mapping | None :type universal_newlines: bool :type creationflags: int """ self.stdin = stdin self.stdout = stdout self.stderr = stderr self.pid = 0 self.returncode = 0 def poll(self): """Check if child process has terminated. :rtype: int """ return 0 def wait(self, timeout=None): """Wait for child process to terminate. :rtype: int """ return 0 def communicate(self, input=None, timeout=None): """Interact with process: Send data to stdin. Read data from stdout and stderr, until end-of-file is reached. :type input: bytes | unicode | None :rtype: (bytes, bytes) """ return b'', b'' def send_signal(self, signal): """Sends the signal signal to the child. :type signal: int :rtype: None """ pass def terminate(self): """Stop the child. :rtype: None """ pass def kill(self): """Kills the child. :rtype: None """ pass
apache-2.0
[ 624, 51, 415, 17589, 367, 283, 5781, 7, 26678, 859, 1041, 421, 199, 318, 1240, 8, 589, 12, 17080, 29, 16, 12, 7286, 29, 403, 12, 9009, 29, 403, 12, 3839, 29, 403, 12, 4635, 29, 403, 12, 268, 876, 1628, 63, 2324, 29, 403, 12, 4002, 63, 14240, 29, 797, 12, 5218, 29, 797, 12, 8288, 29, 403, 12, 2589, 29, 403, 12, 268, 17508, 63, 13839, 29, 797, 12, 14210, 815, 29, 403, 12, 7143, 2469, 29, 16, 12, 268, 2653, 29, 403, 12, 9066, 63, 10458, 29, 549, 12, 1343, 63, 1222, 63, 1730, 29, 797, 12, 268, 986, 63, 14240, 23603, 272, 408, 2540, 314, 1414, 11736, 701, 1249, 14, 339, 520, 466, 1249, 26, 5055, 14, 20852, 59, 2394, 1204, 2649, 61, 272, 520, 466, 17080, 26, 1109, 272, 520, 466, 7286, 26, 2783, 1204, 2649, 1204, 488, 272, 520, 466, 4002, 63, 14240, 26, 2155, 272, 520, 466, 5218, 26, 2155, 272, 520, 466, 8288, 26, 2783, 1204, 2649, 1204, 488, 272, 520, 466, 2589, 26, 5055, 14, 7674, 1204, 488, 272, 520, 466, 17508, 63, 13839, 26, 2155, 272, 520, 466, 7143, 2469, 26, 1109, 272, 520, 4500, 26, 1109, 272, 408, 272, 372, 378, 421, 199, 318, 1104, 63, 1250, 8, 589, 12, 17080, 29, 16, 12, 7286, 29, 403, 12, 9009, 29, 403, 12, 3839, 29, 403, 12, 2049, 4635, 29, 403, 12, 876, 1628, 63, 2324, 29, 403, 12, 4002, 63, 14240, 29, 797, 12, 5218, 29, 797, 12, 2049, 8288, 29, 403, 12, 2589, 29, 403, 12, 17508, 63, 13839, 29, 797, 12, 14210, 815, 29, 403, 12, 2049, 7143, 2469, 29, 16, 12, 2653, 29, 403, 12, 9066, 63, 10458, 29, 549, 12, 2049, 1343, 63, 1222, 63, 1730, 29, 797, 12, 986, 63, 14240, 23603, 272, 408, 2540, 1414, 543, 2368, 14, 13144, 367, 1414, 370, 4890, 14, 982, 314, 372, 272, 1233, 1990, 4697, 2066, 372, 12, 4257, 746, 12295, 19148, 14, 339, 520, 466, 1249, 26, 5055, 14, 20852, 59, 2394, 1204, 2649, 61, 272, 520, 466, 17080, 26, 1109, 272, 520, 466, 7286, 26, 2783, 1204, 2649, 1204, 488, 272, 520, 466, 4002, 63, 14240, 26, 2155, 272, 520, 466, 5218, 26, 2155, 272, 520, 466, 8288, 26, 2783, 1204, 2649, 1204, 488, 272, 520, 466, 2589, 26, 5055, 14, 7674, 1204, 488, 272, 520, 466, 17508, 63, 13839, 26, 2155, 272, 520, 466, 7143, 2469, 26, 1109, 272, 520, 4500, 26, 1109, 272, 408, 272, 372, 378, 421, 199, 318, 1104, 63, 1199, 8, 589, 12, 17080, 29, 16, 12, 7286, 29, 403, 12, 9009, 29, 403, 12, 4635, 29, 403, 12, 326, 876, 1628, 63, 2324, 29, 403, 12, 4002, 63, 14240, 29, 797, 12, 5218, 29, 797, 12, 8288, 29, 403, 12, 326, 2589, 29, 403, 12, 17508, 63, 13839, 29, 797, 12, 14210, 815, 29, 403, 12, 326, 7143, 2469, 29, 16, 12, 2653, 29, 403, 12, 9066, 63, 10458, 29, 549, 12, 326, 1343, 63, 1222, 63, 1730, 29, 797, 12, 986, 63, 14240, 23603, 272, 408, 2540, 1414, 543, 2368, 436, 372, 2399, 1072, 465, 282, 3696, 1059, 14, 339, 520, 466, 1249, 26, 5055, 14, 20852, 59, 2394, 1204, 2649, 61, 272, 520, 466, 17080, 26, 1109, 272, 520, 466, 7286, 26, 2783, 1204, 2649, 1204, 488, 272, 520, 466, 4002, 63, 14240, 26, 2155, 272, 520, 466, 5218, 26, 2155, 272, 520, 466, 8288, 26, 2783, 1204, 2649, 1204, 488, 272, 520, 466, 2589, 26, 5055, 14, 7674, 1204, 488, 272, 520, 466, 17508, 63, 13839, 26, 2155, 272, 520, 466, 7143, 2469, 26, 1109, 272, 520, 4500, 26, 2783, 272, 408, 272, 986, 421, 199, 533, 13995, 8, 785, 304, 272, 408, 12049, 282, 1982, 2240, 315, 282, 892, 2112, 14, 339, 520, 466, 17630, 26, 1109, 272, 408, 339, 347, 636, 826, 721, 277, 12, 1249, 12, 17080, 29, 16, 12, 7286, 29, 403, 12, 9009, 29, 403, 12, 326, 3839, 29, 403, 12, 4635, 29, 403, 12, 876, 1628, 63, 2324, 29, 403, 12, 4002, 63, 14240, 29, 797, 12, 326, 5218, 29, 797, 12, 8288, 29, 403, 12, 2589, 29, 403, 12, 17508, 63, 13839, 29, 797, 12, 326, 14210, 815, 29, 403, 12, 7143, 2469, 29, 16, 12, 2653, 29, 403, 12, 326, 9066, 63, 10458, 29, 549, 12, 1343, 63, 1222, 63, 1730, 29, 797, 12, 986, 63, 14240, 23603, 267, 408, 7942, 3787, 14, 398, 520, 466, 1249, 26, 5055, 14, 20852, 59, 2394, 1204, 2649, 61, 267, 520, 466, 17080, 26, 1109, 267, 520, 466, 7286, 26, 2783, 1204, 2649, 1204, 488, 267, 520, 466, 4002, 63, 14240, 26, 2155, 267, 520, 466, 5218, 26, 2155, 267, 520, 466, 8288, 26, 2783, 1204, 2649, 1204, 488, 267, 520, 466, 2589, 26, 5055, 14, 7674, 1204, 488, 267, 520, 466, 17508, 63, 13839, 26, 2155, 267, 520, 466, 7143, 2469, 26, 1109, 267, 408, 267, 291, 14, 6626, 275, 9009, 267, 291, 14, 2703, 275, 3839, 267, 291, 14, 3083, 275, 4635, 267, 291, 14, 3150, 275, 378, 267, 291, 14, 9913, 275, 378, 339, 347, 11271, 8, 277, 304, 267, 408, 1799, 340, 1982, 2112, 965, 15745, 14, 398, 520, 4500, 26, 1109, 267, 408, 267, 372, 378, 339, 347, 3618, 8, 277, 12, 2653, 29, 403, 304, 267, 408, 7536, 367, 1982, 2112, 370, 15095, 14, 398, 520, 4500, 26, 1109, 267, 408, 267, 372, 378, 339, 347, 26808, 8, 277, 12, 1324, 29, 403, 12, 2653, 29, 403, 304, 267, 408, 8309, 1957, 543, 2112, 26, 10217, 666, 370, 9009, 14, 5574, 666, 687, 3839, 436, 267, 4635, 12, 5133, 1284, 13, 1618, 13, 493, 365, 13075, 14, 398, 520, 466, 1324, 26, 2783, 1204, 2649, 1204, 488, 267, 520, 4500, 26, 334, 2394, 12, 2783, 9, 267, 408, 267, 372, 330, 6448, 330, 891, 339, 347, 3222, 63, 4653, 8, 277, 12, 4673, 304, 267, 408, 26276, 314, 4673, 4673, 370, 314, 1982, 14, 398, 520, 466, 4673, 26, 1109, 267, 520, 4500, 26, 488, 267, 408, 267, 986, 339, 347, 15095, 8, 277, 304, 267, 408, 6293, 314, 1982, 14, 398, 520, 4500, 26, 488, 267, 408, 267 ]
[ 51, 415, 17589, 367, 283, 5781, 7, 26678, 859, 1041, 421, 199, 318, 1240, 8, 589, 12, 17080, 29, 16, 12, 7286, 29, 403, 12, 9009, 29, 403, 12, 3839, 29, 403, 12, 4635, 29, 403, 12, 268, 876, 1628, 63, 2324, 29, 403, 12, 4002, 63, 14240, 29, 797, 12, 5218, 29, 797, 12, 8288, 29, 403, 12, 2589, 29, 403, 12, 268, 17508, 63, 13839, 29, 797, 12, 14210, 815, 29, 403, 12, 7143, 2469, 29, 16, 12, 268, 2653, 29, 403, 12, 9066, 63, 10458, 29, 549, 12, 1343, 63, 1222, 63, 1730, 29, 797, 12, 268, 986, 63, 14240, 23603, 272, 408, 2540, 314, 1414, 11736, 701, 1249, 14, 339, 520, 466, 1249, 26, 5055, 14, 20852, 59, 2394, 1204, 2649, 61, 272, 520, 466, 17080, 26, 1109, 272, 520, 466, 7286, 26, 2783, 1204, 2649, 1204, 488, 272, 520, 466, 4002, 63, 14240, 26, 2155, 272, 520, 466, 5218, 26, 2155, 272, 520, 466, 8288, 26, 2783, 1204, 2649, 1204, 488, 272, 520, 466, 2589, 26, 5055, 14, 7674, 1204, 488, 272, 520, 466, 17508, 63, 13839, 26, 2155, 272, 520, 466, 7143, 2469, 26, 1109, 272, 520, 4500, 26, 1109, 272, 408, 272, 372, 378, 421, 199, 318, 1104, 63, 1250, 8, 589, 12, 17080, 29, 16, 12, 7286, 29, 403, 12, 9009, 29, 403, 12, 3839, 29, 403, 12, 2049, 4635, 29, 403, 12, 876, 1628, 63, 2324, 29, 403, 12, 4002, 63, 14240, 29, 797, 12, 5218, 29, 797, 12, 2049, 8288, 29, 403, 12, 2589, 29, 403, 12, 17508, 63, 13839, 29, 797, 12, 14210, 815, 29, 403, 12, 2049, 7143, 2469, 29, 16, 12, 2653, 29, 403, 12, 9066, 63, 10458, 29, 549, 12, 2049, 1343, 63, 1222, 63, 1730, 29, 797, 12, 986, 63, 14240, 23603, 272, 408, 2540, 1414, 543, 2368, 14, 13144, 367, 1414, 370, 4890, 14, 982, 314, 372, 272, 1233, 1990, 4697, 2066, 372, 12, 4257, 746, 12295, 19148, 14, 339, 520, 466, 1249, 26, 5055, 14, 20852, 59, 2394, 1204, 2649, 61, 272, 520, 466, 17080, 26, 1109, 272, 520, 466, 7286, 26, 2783, 1204, 2649, 1204, 488, 272, 520, 466, 4002, 63, 14240, 26, 2155, 272, 520, 466, 5218, 26, 2155, 272, 520, 466, 8288, 26, 2783, 1204, 2649, 1204, 488, 272, 520, 466, 2589, 26, 5055, 14, 7674, 1204, 488, 272, 520, 466, 17508, 63, 13839, 26, 2155, 272, 520, 466, 7143, 2469, 26, 1109, 272, 520, 4500, 26, 1109, 272, 408, 272, 372, 378, 421, 199, 318, 1104, 63, 1199, 8, 589, 12, 17080, 29, 16, 12, 7286, 29, 403, 12, 9009, 29, 403, 12, 4635, 29, 403, 12, 326, 876, 1628, 63, 2324, 29, 403, 12, 4002, 63, 14240, 29, 797, 12, 5218, 29, 797, 12, 8288, 29, 403, 12, 326, 2589, 29, 403, 12, 17508, 63, 13839, 29, 797, 12, 14210, 815, 29, 403, 12, 326, 7143, 2469, 29, 16, 12, 2653, 29, 403, 12, 9066, 63, 10458, 29, 549, 12, 326, 1343, 63, 1222, 63, 1730, 29, 797, 12, 986, 63, 14240, 23603, 272, 408, 2540, 1414, 543, 2368, 436, 372, 2399, 1072, 465, 282, 3696, 1059, 14, 339, 520, 466, 1249, 26, 5055, 14, 20852, 59, 2394, 1204, 2649, 61, 272, 520, 466, 17080, 26, 1109, 272, 520, 466, 7286, 26, 2783, 1204, 2649, 1204, 488, 272, 520, 466, 4002, 63, 14240, 26, 2155, 272, 520, 466, 5218, 26, 2155, 272, 520, 466, 8288, 26, 2783, 1204, 2649, 1204, 488, 272, 520, 466, 2589, 26, 5055, 14, 7674, 1204, 488, 272, 520, 466, 17508, 63, 13839, 26, 2155, 272, 520, 466, 7143, 2469, 26, 1109, 272, 520, 4500, 26, 2783, 272, 408, 272, 986, 421, 199, 533, 13995, 8, 785, 304, 272, 408, 12049, 282, 1982, 2240, 315, 282, 892, 2112, 14, 339, 520, 466, 17630, 26, 1109, 272, 408, 339, 347, 636, 826, 721, 277, 12, 1249, 12, 17080, 29, 16, 12, 7286, 29, 403, 12, 9009, 29, 403, 12, 326, 3839, 29, 403, 12, 4635, 29, 403, 12, 876, 1628, 63, 2324, 29, 403, 12, 4002, 63, 14240, 29, 797, 12, 326, 5218, 29, 797, 12, 8288, 29, 403, 12, 2589, 29, 403, 12, 17508, 63, 13839, 29, 797, 12, 326, 14210, 815, 29, 403, 12, 7143, 2469, 29, 16, 12, 2653, 29, 403, 12, 326, 9066, 63, 10458, 29, 549, 12, 1343, 63, 1222, 63, 1730, 29, 797, 12, 986, 63, 14240, 23603, 267, 408, 7942, 3787, 14, 398, 520, 466, 1249, 26, 5055, 14, 20852, 59, 2394, 1204, 2649, 61, 267, 520, 466, 17080, 26, 1109, 267, 520, 466, 7286, 26, 2783, 1204, 2649, 1204, 488, 267, 520, 466, 4002, 63, 14240, 26, 2155, 267, 520, 466, 5218, 26, 2155, 267, 520, 466, 8288, 26, 2783, 1204, 2649, 1204, 488, 267, 520, 466, 2589, 26, 5055, 14, 7674, 1204, 488, 267, 520, 466, 17508, 63, 13839, 26, 2155, 267, 520, 466, 7143, 2469, 26, 1109, 267, 408, 267, 291, 14, 6626, 275, 9009, 267, 291, 14, 2703, 275, 3839, 267, 291, 14, 3083, 275, 4635, 267, 291, 14, 3150, 275, 378, 267, 291, 14, 9913, 275, 378, 339, 347, 11271, 8, 277, 304, 267, 408, 1799, 340, 1982, 2112, 965, 15745, 14, 398, 520, 4500, 26, 1109, 267, 408, 267, 372, 378, 339, 347, 3618, 8, 277, 12, 2653, 29, 403, 304, 267, 408, 7536, 367, 1982, 2112, 370, 15095, 14, 398, 520, 4500, 26, 1109, 267, 408, 267, 372, 378, 339, 347, 26808, 8, 277, 12, 1324, 29, 403, 12, 2653, 29, 403, 304, 267, 408, 8309, 1957, 543, 2112, 26, 10217, 666, 370, 9009, 14, 5574, 666, 687, 3839, 436, 267, 4635, 12, 5133, 1284, 13, 1618, 13, 493, 365, 13075, 14, 398, 520, 466, 1324, 26, 2783, 1204, 2649, 1204, 488, 267, 520, 4500, 26, 334, 2394, 12, 2783, 9, 267, 408, 267, 372, 330, 6448, 330, 891, 339, 347, 3222, 63, 4653, 8, 277, 12, 4673, 304, 267, 408, 26276, 314, 4673, 4673, 370, 314, 1982, 14, 398, 520, 466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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 ]
bukun/pycsw
pycsw/server.py
1
35618
# -*- coding: utf-8 -*- # ================================================================= # # Authors: Tom Kralidis <[email protected]> # Angelos Tzotsos <[email protected]> # # Copyright (c) 2016 Tom Kralidis # Copyright (c) 2015 Angelos Tzotsos # Copyright (c) 2016 James Dickens # Copyright (c) 2016 Ricardo Silva # # Permission is hereby granted, free of charge, to any person # obtaining a copy of this software and associated documentation # files (the "Software"), to deal in the Software without # restriction, including without limitation the rights to use, # copy, modify, merge, publish, distribute, sublicense, and/or sell # copies of the Software, and to permit persons to whom the # Software is furnished to do so, subject to the following # conditions: # # The above copyright notice and this permission notice shall be # included in all copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES # OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT # HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, # WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR # OTHER DEALINGS IN THE SOFTWARE. # # ================================================================= import logging import os from six.moves.urllib.parse import parse_qsl from six.moves.urllib.parse import splitquery from six.moves.urllib.parse import urlparse from six import StringIO from six.moves.configparser import SafeConfigParser import sys from time import time import wsgiref.util from pycsw.core.etree import etree from pycsw import oaipmh, opensearch, sru from pycsw.plugins.profiles import profile as pprofile import pycsw.plugins.outputschemas from pycsw.core import config, log, util from pycsw.ogc.csw import csw2, csw3 LOGGER = logging.getLogger(__name__) class Csw(object): """ Base CSW server """ def __init__(self, rtconfig=None, env=None, version='3.0.0'): """ Initialize CSW """ if not env: self.environ = os.environ else: self.environ = env self.context = config.StaticContext() # Lazy load this when needed # (it will permanently update global cfg namespaces) self.sruobj = None self.opensearchobj = None self.oaipmhobj = None # init kvp self.kvp = {} self.mode = 'csw' self.asynchronous = False self.soap = False self.request = None self.exception = False self.status = 'OK' self.profiles = None self.manager = False self.outputschemas = {} self.mimetype = 'application/xml; charset=UTF-8' self.encoding = 'UTF-8' self.pretty_print = 0 self.domainquerytype = 'list' self.orm = 'django' self.language = {'639_code': 'en', 'text': 'english'} self.process_time_start = time() # define CSW implementation object (default CSW3) self.iface = csw3.Csw3(server_csw=self) self.request_version = version if self.request_version == '2.0.2': self.iface = csw2.Csw2(server_csw=self) self.context.set_model('csw') # load user configuration try: LOGGER.info('Loading user configuration') if isinstance(rtconfig, SafeConfigParser): # serialized already self.config = rtconfig else: self.config = SafeConfigParser() if isinstance(rtconfig, dict): # dictionary for section, options in rtconfig.items(): self.config.add_section(section) for k, v in options.items(): self.config.set(section, k, v) else: # configuration file import codecs with codecs.open(rtconfig, encoding='utf-8') as scp: self.config.readfp(scp) except Exception as err: msg = 'Could not load configuration' LOGGER.exception('%s %s: %s', msg, rtconfig, err) self.response = self.iface.exceptionreport( 'NoApplicableCode', 'service', msg) return # set server.home safely # TODO: make this more abstract self.config.set( 'server', 'home', os.path.dirname(os.path.join(os.path.dirname(__file__), '..')) ) self.context.pycsw_home = self.config.get('server', 'home') self.context.url = self.config.get('server', 'url') log.setup_logger(self.config) LOGGER.info('running configuration %s', rtconfig) LOGGER.debug('QUERY_STRING: %s', self.environ['QUERY_STRING']) # set OGC schemas location if not self.config.has_option('server', 'ogc_schemas_base'): self.config.set('server', 'ogc_schemas_base', self.context.ogc_schemas_base) # set mimetype if self.config.has_option('server', 'mimetype'): self.mimetype = self.config.get('server', 'mimetype').encode() # set encoding if self.config.has_option('server', 'encoding'): self.encoding = self.config.get('server', 'encoding') # set domainquerytype if self.config.has_option('server', 'domainquerytype'): self.domainquerytype = self.config.get('server', 'domainquerytype') # set XML pretty print if (self.config.has_option('server', 'pretty_print') and self.config.get('server', 'pretty_print') == 'true'): self.pretty_print = 1 # set Spatial Ranking option if (self.config.has_option('server', 'spatial_ranking') and self.config.get('server', 'spatial_ranking') == 'true'): util.ranking_enabled = True # set language default if self.config.has_option('server', 'language'): try: LOGGER.info('Setting language') lang_code = self.config.get('server', 'language').split('-')[0] self.language['639_code'] = lang_code self.language['text'] = self.context.languages[lang_code] except Exception as err: LOGGER.exception('Could not set language: %s', err) pass LOGGER.debug('Configuration: %s.', self.config) LOGGER.debug('Model: %s.', self.context.model) # load user-defined mappings if they exist if self.config.has_option('repository', 'mappings'): # override default repository mappings try: import imp module = self.config.get('repository', 'mappings') if '/' in module: # filepath modulename = '%s' % os.path.splitext(module)[0].replace( os.sep, '.') mappings = imp.load_source(modulename, module) else: # dotted name mappings = __import__(module, fromlist=['']) LOGGER.info('Loading custom repository mappings ' 'from %s', module) self.context.md_core_model = mappings.MD_CORE_MODEL self.context.refresh_dc(mappings.MD_CORE_MODEL) except Exception as err: LOGGER.exception('Could not load custom mappings: %s', err) self.response = self.iface.exceptionreport( 'NoApplicableCode', 'service', 'Could not load repository.mappings') # load outputschemas LOGGER.info('Loading outputschemas') for osch in pycsw.plugins.outputschemas.__all__: output_schema_module = __import__( 'pycsw.plugins.outputschemas.%s' % osch) mod = getattr(output_schema_module.plugins.outputschemas, osch) self.outputschemas[mod.NAMESPACE] = mod LOGGER.debug('Outputschemas loaded: %s.', self.outputschemas) LOGGER.debug('Namespaces: %s', self.context.namespaces) def expand_path(self, path): """ return safe path for WSGI environments """ if 'local.app_root' in self.environ and not os.path.isabs(path): return os.path.join(self.environ['local.app_root'], path) else: return path def dispatch_wsgi(self): """ WSGI handler """ if hasattr(self, 'response'): return self._write_response() LOGGER.debug('WSGI mode detected') if self.environ['REQUEST_METHOD'] == 'POST': try: request_body_size = int(self.environ.get('CONTENT_LENGTH', 0)) except (ValueError): request_body_size = 0 self.requesttype = 'POST' self.request = self.environ['wsgi.input'].read(request_body_size) LOGGER.debug('Request type: POST. Request:\n%s\n', self.request) else: # it's a GET request self.requesttype = 'GET' self.request = wsgiref.util.request_uri(self.environ) try: query_part = splitquery(self.request)[-1] self.kvp = dict(parse_qsl(query_part, keep_blank_values=True)) except AttributeError as err: LOGGER.exception('Could not parse query string') self.kvp = {} LOGGER.debug('Request type: GET. Request:\n%s\n', self.request) return self.dispatch() def opensearch(self): """ enable OpenSearch """ if not self.opensearchobj: self.opensearchobj = opensearch.OpenSearch(self.context) return self.opensearchobj def sru(self): """ enable SRU """ if not self.sruobj: self.sruobj = sru.Sru(self.context) return self.sruobj def oaipmh(self): """ enable OAI-PMH """ if not self.oaipmhobj: self.oaipmhobj = oaipmh.OAIPMH(self.context, self.config) return self.oaipmhobj def dispatch(self, writer=sys.stdout, write_headers=True): """ Handle incoming HTTP request """ error = 0 if self.requesttype == 'GET': self.kvp = self.normalize_kvp(self.kvp) version_202 = ('version' in self.kvp and self.kvp['version'] == '2.0.2') accept_version_202 = ('acceptversions' in self.kvp and '2.0.2' in self.kvp['acceptversions']) if version_202 or accept_version_202: self.request_version = '2.0.2' elif self.requesttype == 'POST': if self.request.find(b'cat/csw/2.0.2') != -1: self.request_version = '2.0.2' elif self.request.find(b'cat/csw/3.0') != -1: self.request_version = '3.0.0' if (not isinstance(self.kvp, str) and 'mode' in self.kvp and self.kvp['mode'] == 'sru'): self.mode = 'sru' self.request_version = '2.0.2' LOGGER.info('SRU mode detected; processing request') self.kvp = self.sru().request_sru2csw(self.kvp) if (not isinstance(self.kvp, str) and 'mode' in self.kvp and self.kvp['mode'] == 'oaipmh'): self.mode = 'oaipmh' self.request_version = '2.0.2' LOGGER.info('OAI-PMH mode detected; processing request.') self.oaiargs = dict((k, v) for k, v in self.kvp.items() if k) self.kvp = self.oaipmh().request(self.kvp) if self.request_version == '2.0.2': self.iface = csw2.Csw2(server_csw=self) self.context.set_model('csw') # configure transaction support, if specified in config self._gen_manager() namespaces = self.context.namespaces ops = self.context.model['operations'] constraints = self.context.model['constraints'] # generate domain model # NOTE: We should probably avoid this sort of mutable state for WSGI if 'GetDomain' not in ops: ops['GetDomain'] = self.context.gen_domains() # generate distributed search model, if specified in config if self.config.has_option('server', 'federatedcatalogues'): LOGGER.info('Configuring distributed search') constraints['FederatedCatalogues'] = {'values': []} for fedcat in self.config.get('server', 'federatedcatalogues').split(','): LOGGER.debug('federated catalogue: %s', fedcat) constraints['FederatedCatalogues']['values'].append(fedcat) for key, value in self.outputschemas.items(): get_records_params = ops['GetRecords']['parameters'] get_records_params['outputSchema']['values'].append( value.NAMESPACE) get_records_by_id_params = ops['GetRecordById']['parameters'] get_records_by_id_params['outputSchema']['values'].append( value.NAMESPACE) if 'Harvest' in ops: harvest_params = ops['Harvest']['parameters'] harvest_params['ResourceType']['values'].append( value.NAMESPACE) LOGGER.info('Setting MaxRecordDefault') if self.config.has_option('server', 'maxrecords'): constraints['MaxRecordDefault']['values'] = [ self.config.get('server', 'maxrecords')] # load profiles if self.config.has_option('server', 'profiles'): self.profiles = pprofile.load_profiles( os.path.join('pycsw', 'plugins', 'profiles'), pprofile.Profile, self.config.get('server', 'profiles') ) for prof in self.profiles['plugins'].keys(): tmp = self.profiles['plugins'][prof](self.context.model, namespaces, self.context) key = tmp.outputschema # to ref by outputschema self.profiles['loaded'][key] = tmp self.profiles['loaded'][key].extend_core(self.context.model, namespaces, self.config) LOGGER.debug('Profiles loaded: %s' % list(self.profiles['loaded'].keys())) # init repository # look for tablename, set 'records' as default if not self.config.has_option('repository', 'table'): self.config.set('repository', 'table', 'records') repo_filter = None if self.config.has_option('repository', 'filter'): repo_filter = self.config.get('repository', 'filter') if self.config.has_option('repository', 'source'): # load custom repository rs = self.config.get('repository', 'source') rs_modname, rs_clsname = rs.rsplit('.', 1) rs_mod = __import__(rs_modname, globals(), locals(), [rs_clsname]) rs_cls = getattr(rs_mod, rs_clsname) try: self.repository = rs_cls(self.context, repo_filter) LOGGER.debug('Custom repository %s loaded (%s)', rs, self.repository.dbtype) except Exception as err: msg = 'Could not load custom repository %s: %s' % (rs, err) LOGGER.exception(msg) error = 1 code = 'NoApplicableCode' locator = 'service' text = 'Could not initialize repository. Check server logs' else: # load default repository self.orm = 'sqlalchemy' from pycsw.core import repository try: LOGGER.info('Loading default repository') self.repository = repository.Repository( self.config.get('repository', 'database'), self.context, self.environ.get('local.app_root', None), self.config.get('repository', 'table'), repo_filter ) LOGGER.debug( 'Repository loaded (local): %s.' % self.repository.dbtype) except Exception as err: msg = 'Could not load repository (local): %s' % err LOGGER.exception(msg) error = 1 code = 'NoApplicableCode' locator = 'service' text = 'Could not initialize repository. Check server logs' if self.requesttype == 'POST': LOGGER.debug('HTTP POST request') LOGGER.debug('CSW version: %s', self.iface.version) self.kvp = self.iface.parse_postdata(self.request) if isinstance(self.kvp, str): # it's an exception error = 1 locator = 'service' text = self.kvp if (self.kvp.find('the document is not valid') != -1 or self.kvp.find('document not well-formed') != -1): code = 'NoApplicableCode' else: code = 'InvalidParameterValue' LOGGER.debug('HTTP Headers:\n%s.', self.environ) LOGGER.debug('Parsed request parameters: %s', self.kvp) if (not isinstance(self.kvp, str) and 'mode' in self.kvp and self.kvp['mode'] == 'opensearch'): self.mode = 'opensearch' LOGGER.info('OpenSearch mode detected; processing request.') self.kvp['outputschema'] = 'http://www.w3.org/2005/Atom' if ((len(self.kvp) == 0 and self.request_version == '3.0.0') or (len(self.kvp) == 1 and 'config' in self.kvp)): LOGGER.info('Turning on default csw30:Capabilities for base URL') self.kvp = { 'service': 'CSW', 'acceptversions': '3.0.0', 'request': 'GetCapabilities' } http_accept = self.environ.get('HTTP_ACCEPT', '') if 'application/opensearchdescription+xml' in http_accept: self.mode = 'opensearch' self.kvp['outputschema'] = 'http://www.w3.org/2005/Atom' if error == 0: # test for the basic keyword values (service, version, request) basic_options = ['service', 'request'] request = self.kvp.get('request', '') own_version_integer = util.get_version_integer( self.request_version) if self.request_version == '2.0.2': basic_options.append('version') if self.request_version == '3.0.0' and 'version' not in self.kvp and self.requesttype == 'POST': if 'service' not in self.kvp: self.kvp['service'] = 'CSW' basic_options.append('service') self.kvp['version'] = self.request_version basic_options.append('version') for k in basic_options: if k not in self.kvp: if (k in ['version', 'acceptversions'] and request == 'GetCapabilities'): pass else: error = 1 locator = k code = 'MissingParameterValue' text = 'Missing keyword: %s' % k break # test each of the basic keyword values if error == 0: # test service if self.kvp['service'] != 'CSW': error = 1 locator = 'service' code = 'InvalidParameterValue' text = 'Invalid value for service: %s.\ Value MUST be CSW' % self.kvp['service'] # test version kvp_version = self.kvp.get('version', '') try: kvp_version_integer = util.get_version_integer(kvp_version) except Exception as err: kvp_version_integer = 'invalid_value' if (request != 'GetCapabilities' and kvp_version_integer != own_version_integer): error = 1 locator = 'version' code = 'InvalidParameterValue' text = ('Invalid value for version: %s. Value MUST be ' '2.0.2 or 3.0.0' % kvp_version) # check for GetCapabilities acceptversions if 'acceptversions' in self.kvp: for vers in self.kvp['acceptversions'].split(','): vers_integer = util.get_version_integer(vers) if vers_integer == own_version_integer: break else: error = 1 locator = 'acceptversions' code = 'VersionNegotiationFailed' text = ('Invalid parameter value in ' 'acceptversions: %s. Value MUST be ' '2.0.2 or 3.0.0' % self.kvp['acceptversions']) # test request if self.kvp['request'] not in \ self.context.model['operations']: error = 1 locator = 'request' if request in ['Transaction', 'Harvest']: code = 'OperationNotSupported' text = '%s operations are not supported' % request else: code = 'InvalidParameterValue' text = 'Invalid value for request: %s' % request if error == 1: # return an ExceptionReport LOGGER.error('basic service options error: %s, %s, %s', code, locator, text) self.response = self.iface.exceptionreport(code, locator, text) else: # process per the request value if 'responsehandler' in self.kvp: # set flag to process asynchronously import threading self.asynchronous = True request_id = self.kvp.get('requestid', None) if request_id is None: import uuid self.kvp['requestid'] = str(uuid.uuid4()) if self.kvp['request'] == 'GetCapabilities': self.response = self.iface.getcapabilities() elif self.kvp['request'] == 'DescribeRecord': self.response = self.iface.describerecord() elif self.kvp['request'] == 'GetDomain': self.response = self.iface.getdomain() elif self.kvp['request'] == 'GetRecords': if self.asynchronous: # process asynchronously threading.Thread(target=self.iface.getrecords).start() self.response = self.iface._write_acknowledgement() else: self.response = self.iface.getrecords() elif self.kvp['request'] == 'GetRecordById': self.response = self.iface.getrecordbyid() elif self.kvp['request'] == 'GetRepositoryItem': self.response = self.iface.getrepositoryitem() elif self.kvp['request'] == 'Transaction': self.response = self.iface.transaction() elif self.kvp['request'] == 'Harvest': if self.asynchronous: # process asynchronously threading.Thread(target=self.iface.harvest).start() self.response = self.iface._write_acknowledgement() else: self.response = self.iface.harvest() else: self.response = self.iface.exceptionreport( 'InvalidParameterValue', 'request', 'Invalid request parameter: %s' % self.kvp['request'] ) LOGGER.info('Request processed') if self.mode == 'sru': LOGGER.info('SRU mode detected; processing response.') self.response = self.sru().response_csw2sru(self.response, self.environ) elif self.mode == 'opensearch': LOGGER.info('OpenSearch mode detected; processing response.') self.response = self.opensearch().response_csw2opensearch( self.response, self.config) elif self.mode == 'oaipmh': LOGGER.info('OAI-PMH mode detected; processing response.') self.response = self.oaipmh().response( self.response, self.oaiargs, self.repository, self.config.get('server', 'url') ) return self._write_response() def getcapabilities(self): """ Handle GetCapabilities request """ return self.iface.getcapabilities() def describerecord(self): """ Handle DescribeRecord request """ return self.iface.describerecord() def getdomain(self): """ Handle GetDomain request """ return self.iface.getdomain() def getrecords(self): """ Handle GetRecords request """ return self.iface.getrecords() def getrecordbyid(self, raw=False): """ Handle GetRecordById request """ return self.iface.getrecordbyid(raw) def getrepositoryitem(self): """ Handle GetRepositoryItem request """ return self.iface.getrepositoryitem() def transaction(self): """ Handle Transaction request """ return self.iface.transaction() def harvest(self): """ Handle Harvest request """ return self.iface.harvest() def _write_response(self): """ Generate response """ # set HTTP response headers and XML declaration xmldecl = '' appinfo = '' LOGGER.info('Writing response.') if hasattr(self, 'soap') and self.soap: self._gen_soap_wrapper() if etree.__version__ >= '3.5.0': # remove superfluous namespaces etree.cleanup_namespaces(self.response, keep_ns_prefixes=self.context.keep_ns_prefixes) response = etree.tostring(self.response, pretty_print=self.pretty_print, encoding='unicode') if (isinstance(self.kvp, dict) and 'outputformat' in self.kvp and self.kvp['outputformat'] == 'application/json'): self.contenttype = self.kvp['outputformat'] from pycsw.core.formats import fmt_json response = fmt_json.xml2json(response, self.context.namespaces, self.pretty_print) else: # it's XML if 'outputformat' in self.kvp: self.contenttype = self.kvp['outputformat'] else: self.contenttype = self.mimetype xmldecl = ('<?xml version="1.0" encoding="%s" standalone="no"?>' '\n' % self.encoding) appinfo = '<!-- pycsw %s -->\n' % self.context.version if isinstance(self.contenttype, bytes): self.contenttype = self.contenttype.decode() s = (u'%s%s%s' % (xmldecl, appinfo, response)).encode(self.encoding) LOGGER.debug('Response code: %s', self.context.response_codes[self.status]) LOGGER.debug('Response:\n%s', s) return [self.context.response_codes[self.status], s] def _gen_soap_wrapper(self): """ Generate SOAP wrapper """ LOGGER.info('Writing SOAP wrapper.') node = etree.Element( util.nspath_eval('soapenv:Envelope', self.context.namespaces), nsmap=self.context.namespaces ) schema_location_ns = util.nspath_eval('xsi:schemaLocation', self.context.namespaces) node.attrib[schema_location_ns] = '%s %s' % ( self.context.namespaces['soapenv'], self.context.namespaces['soapenv'] ) node2 = etree.SubElement( node, util.nspath_eval('soapenv:Body', self.context.namespaces)) if self.exception: node3 = etree.SubElement( node2, util.nspath_eval('soapenv:Fault', self.context.namespaces) ) node4 = etree.SubElement( node3, util.nspath_eval('soapenv:Code', self.context.namespaces) ) etree.SubElement( node4, util.nspath_eval('soapenv:Value', self.context.namespaces) ).text = 'soap:Server' node4 = etree.SubElement( node3, util.nspath_eval('soapenv:Reason', self.context.namespaces) ) etree.SubElement( node4, util.nspath_eval('soapenv:Text', self.context.namespaces) ).text = 'A server exception was encountered.' node4 = etree.SubElement( node3, util.nspath_eval('soapenv:Detail', self.context.namespaces) ) node4.append(self.response) else: node2.append(self.response) self.response = node def _gen_manager(self): """ Update self.context.model with CSW-T advertising """ if (self.config.has_option('manager', 'transactions') and self.config.get('manager', 'transactions') == 'true'): self.manager = True self.context.model['operations_order'].append('Transaction') self.context.model['operations']['Transaction'] = { 'methods': {'get': False, 'post': True}, 'parameters': {} } schema_values = [ 'http://www.opengis.net/cat/csw/2.0.2', 'http://www.opengis.net/cat/csw/3.0', 'http://www.opengis.net/wms', 'http://www.opengis.net/wmts/1.0', 'http://www.opengis.net/wfs', 'http://www.opengis.net/wfs/2.0', 'http://www.opengis.net/wcs', 'http://www.opengis.net/wps/1.0.0', 'http://www.opengis.net/sos/1.0', 'http://www.opengis.net/sos/2.0', 'http://www.isotc211.org/2005/gmi', 'urn:geoss:waf', ] self.context.model['operations_order'].append('Harvest') self.context.model['operations']['Harvest'] = { 'methods': {'get': False, 'post': True}, 'parameters': { 'ResourceType': {'values': schema_values} } } self.context.model['operations']['Transaction'] = { 'methods': {'get': False, 'post': True}, 'parameters': { 'TransactionSchemas': {'values': sorted(schema_values)} } } self.csw_harvest_pagesize = 10 if self.config.has_option('manager', 'csw_harvest_pagesize'): self.csw_harvest_pagesize = int( self.config.get('manager', 'csw_harvest_pagesize')) def _test_manager(self): """ Verify that transactions are allowed """ if self.config.get('manager', 'transactions') != 'true': raise RuntimeError('CSW-T interface is disabled') """ get the client first forwarded ip """ if 'HTTP_X_FORWARDED_FOR' in self.environ: ipaddress = self.environ['HTTP_X_FORWARDED_FOR'].split(',')[0].strip() else: ipaddress = self.environ['REMOTE_ADDR'] if not self.config.has_option('manager', 'allowed_ips') or \ (self.config.has_option('manager', 'allowed_ips') and not util.ipaddress_in_whitelist(ipaddress, self.config.get('manager', 'allowed_ips').split(','))): raise RuntimeError( 'CSW-T operations not allowed for this IP address: %s' % ipaddress) def _cql_update_queryables_mappings(self, cql, mappings): """ Transform CQL query's properties to underlying DB columns """ LOGGER.debug('Raw CQL text = %s', cql) LOGGER.debug(str(list(mappings.keys()))) if cql is not None: for key in mappings.keys(): try: cql = cql.replace(key, mappings[key]['dbcol']) except: cql = cql.replace(key, mappings[key]) LOGGER.debug('Interpolated CQL text = %s.', cql) return cql def _process_responsehandler(self, xml): """ Process response handler """ if self.kvp['responsehandler'] is not None: LOGGER.info('Processing responsehandler %s' % self.kvp['responsehandler']) uprh = urlparse(self.kvp['responsehandler']) if uprh.scheme == 'mailto': # email import smtplib LOGGER.debug('Email detected') smtp_host = 'localhost' if self.config.has_option('server', 'smtp_host'): smtp_host = self.config.get('server', 'smtp_host') body = ('Subject: pycsw %s results\n\n%s' % (self.kvp['request'], xml)) try: LOGGER.info('Sending email') msg = smtplib.SMTP(smtp_host) msg.sendmail( self.config.get('metadata:main', 'contact_email'), uprh.path, body ) msg.quit() LOGGER.debug('Email sent successfully.') except Exception as err: LOGGER.exception('Error processing email') elif uprh.scheme == 'ftp': import ftplib LOGGER.debug('FTP detected.') try: LOGGER.info('Sending to FTP server.') ftp = ftplib.FTP(uprh.hostname) if uprh.username is not None: ftp.login(uprh.username, uprh.password) ftp.storbinary('STOR %s' % uprh.path[1:], StringIO(xml)) ftp.quit() LOGGER.debug('FTP sent successfully.') except Exception as err: LOGGER.exception('Error processing FTP') @staticmethod def normalize_kvp(kvp): """Normalize Key Value Pairs. This method will transform all keys to lowercase and leave values unchanged, as specified in the CSW standard (see for example note C on Table 62 - KVP Encoding for DescribeRecord operation request of the CSW standard version 2.0.2) :arg kvp: a mapping with Key Value Pairs :type kvp: dict :returns: A new dictionary with normalized parameters """ result = dict() for name, value in kvp.items(): result[name.lower()] = value return result
mit
[ 3, 1882, 2803, 26, 2774, 13, 24, 1882, 199, 3, 7819, 199, 3, 199, 3, 6642, 26, 21644, 1804, 82, 10874, 2297, 665, 3151, 16779, 10874, 2297, 32, 6799, 14, 957, 30, 199, 3, 3515, 1626, 303, 11560, 377, 90, 16673, 736, 665, 3903, 16673, 736, 32, 6799, 14, 957, 30, 199, 3, 199, 3, 1898, 334, 67, 9, 7800, 21644, 1804, 82, 10874, 2297, 199, 3, 1898, 334, 67, 9, 6900, 1626, 303, 11560, 377, 90, 16673, 736, 199, 3, 1898, 334, 67, 9, 7800, 1603, 14015, 577, 2000, 8764, 199, 3, 1898, 334, 67, 9, 7800, 820, 530, 1005, 79, 428, 382, 3042, 199, 3, 199, 3, 8779, 365, 11882, 10009, 12, 2867, 402, 11204, 12, 370, 1263, 4954, 199, 3, 12408, 282, 1331, 402, 642, 2032, 436, 4568, 3794, 199, 3, 1584, 334, 1589, 298, 10337, 1288, 370, 7962, 315, 314, 2290, 1928, 199, 3, 10588, 12, 5893, 1928, 12305, 314, 4481, 370, 675, 12, 199, 3, 1331, 12, 2811, 12, 5389, 12, 2780, 12, 11207, 12, 13473, 12, 436, 15, 269, 12743, 199, 3, 6866, 402, 314, 2290, 12, 436, 370, 11291, 12103, 370, 12676, 314, 199, 3, 2290, 365, 13985, 370, 886, 880, 12, 5420, 370, 314, 2569, 199, 3, 3704, 26, 199, 3, 199, 3, 710, 3432, 4248, 4245, 436, 642, 4983, 4245, 10989, 506, 199, 3, 5120, 315, 1006, 6866, 503, 13393, 12468, 402, 314, 2290, 14, 199, 3, 199, 3, 2334, 4141, 2281, 7049, 298, 1179, 2281, 401, 2428, 3408, 1634, 1821, 3826, 12, 199, 3, 7168, 1549, 5292, 12, 6931, 5400, 2845, 5471, 2296, 2334, 2990, 199, 3, 1634, 3169, 12, 3092, 2381, 437, 3115, 3104, 2401, 199, 3, 13229, 14, 1621, 4825, 6461, 7000, 2334, 10610, 1549, 5877, 199, 3, 8164, 6262, 7024, 2381, 1821, 13140, 12, 6736, 1549, 5010, 5603, 12, 199, 3, 7061, 1621, 1261, 9612, 1634, 7066, 12, 7056, 1549, 7334, 12, 7043, 199, 3, 4442, 12, 5738, 1634, 1549, 1621, 11287, 1663, 2334, 4141, 1549, 2334, 4815, 1549, 199, 3, 5010, 13198, 1621, 2334, 4141, 14, 199, 3, 199, 3, 7819, 199, 199, 646, 2050, 199, 646, 747, 199, 504, 3816, 14, 4912, 14, 4078, 14, 1122, 492, 2198, 63, 26714, 199, 504, 3816, 14, 4912, 14, 4078, 14, 1122, 492, 3715, 1131, 199, 504, 3816, 14, 4912, 14, 4078, 14, 1122, 492, 7097, 199, 504, 3816, 492, 5228, 199, 504, 3816, 14, 4912, 14, 888, 2087, 492, 14969, 15218, 199, 646, 984, 199, 504, 900, 492, 900, 199, 646, 12464, 1121, 14, 1974, 199, 199, 504, 1134, 29735, 14, 1018, 14, 9464, 492, 7559, 199, 504, 1134, 29735, 492, 312, 65, 711, 17077, 12, 1687, 677, 1047, 12, 308, 6558, 199, 504, 1134, 29735, 14, 5265, 14, 11225, 492, 4690, 465, 299, 2913, 199, 646, 1134, 29735, 14, 5265, 14, 4467, 8532, 199, 504, 1134, 29735, 14, 1018, 492, 1101, 12, 943, 12, 4884, 199, 504, 1134, 29735, 14, 29238, 14, 29735, 492, 286, 3519, 18, 12, 286, 3519, 19, 199, 199, 10186, 275, 2050, 14, 5572, 3460, 354, 3368, 421, 199, 533, 445, 3519, 8, 785, 304, 272, 408, 3523, 445, 8745, 1654, 408, 272, 347, 636, 826, 721, 277, 12, 14059, 888, 29, 403, 12, 2589, 29, 403, 12, 1015, 534, 19, 14, 16, 14, 16, 735, 267, 408, 11578, 445, 8745, 408, 398, 340, 440, 2589, 26, 288, 291, 14, 2314, 275, 747, 14, 2314, 267, 587, 26, 288, 291, 14, 2314, 275, 2589, 398, 291, 14, 1100, 275, 1101, 14, 9278, 2998, 342, 398, 327, 22373, 2248, 642, 1380, 4346, 267, 327, 334, 390, 911, 19860, 590, 1678, 2288, 4810, 10747, 9, 267, 291, 14, 5474, 85, 1113, 275, 488, 267, 291, 14, 27285, 1113, 275, 488, 267, 291, 14, 20047, 711, 77, 526, 468, 275, 488, 398, 327, 4205, 1022, 11702, 267, 291, 14, 11475, 80, 275, 1052, 398, 291, 14, 632, 275, 283, 29735, 7, 267, 291, 14, 305, 9865, 275, 756, 267, 291, 14, 21818, 275, 756, 267, 291, 14, 1069, 275, 488, 267, 291, 14, 1971, 275, 756, 267, 291, 14, 1205, 275, 283, 3593, 7, 267, 291, 14, 11225, 275, 488, 267, 291, 14, 2609, 275, 756, 267, 291, 14, 4467, 8532, 275, 1052, 267, 291, 14, 17450, 275, 283, 3578, 15, 1652, 27, 5960, 29, 6610, 13, 24, 7, 267, 291, 14, 2991, 275, 283, 6610, 13, 24, 7, 267, 291, 14, 9118, 63, 1361, 275, 378, 267, 291, 14, 2261, 1131, 466, 275, 283, 513, 7, 267, 291, 14, 1025, 275, 283, 1176, 7, 267, 291, 14, 3671, 275, 791, 26723, 63, 600, 356, 283, 287, 297, 283, 505, 356, 283, 17872, 936, 267, 291, 14, 1412, 63, 521, 63, 928, 275, 900, 342, 398, 327, 5627, 445, 8745, 4514, 909, 334, 885, 445, 8745, 19, 9, 267, 291, 14, 11166, 275, 286, 3519, 19, 14, 35, 3519, 19, 8, 1000, 63, 29735, 29, 277, 9, 267, 291, 14, 1069, 63, 1023, 275, 1015, 398, 340, 291, 14, 1069, 63, 1023, 508, 283, 18, 14, 16, 14, 18, 356, 288, 291, 14, 11166, 275, 286, 3519, 18, 14, 35, 3519, 18, 8, 1000, 63, 29735, 29, 277, 9, 288, 291, 14, 1100, 14, 409, 63, 1238, 360, 29735, 358, 398, 327, 2248, 922, 2897, 267, 862, 26, 288, 20184, 14, 815, 360, 19236, 922, 2897, 358, 288, 340, 1228, 8, 2591, 888, 12, 14969, 15218, 304, 221, 327, 6380, 2575, 355, 291, 14, 888, 275, 14059, 888, 288, 587, 26, 355, 291, 14, 888, 275, 14969, 15218, 342, 355, 340, 1228, 8, 2591, 888, 12, 1211, 304, 221, 327, 2600, 490, 367, 3420, 12, 1511, 315, 14059, 888, 14, 1744, 837, 717, 291, 14, 888, 14, 525, 63, 2792, 8, 2792, 9, 717, 367, 1022, 12, 373, 315, 1511, 14, 1744, 837, 1169, 291, 14, 888, 14, 409, 8, 2792, 12, 1022, 12, 373, 9, 355, 587, 26, 221, 327, 2897, 570, 490, 492, 6010, 490, 543, 6010, 14, 1490, 8, 2591, 888, 12, 2644, 534, 1624, 13, 24, 358, 465, 308, 1850, 26, 717, 291, 14, 888, 14, 739, 3997, 8, 17124, 9, 267, 871, 2186, 465, 2329, 26, 288, 1499, 275, 283, 6531, 440, 2248, 2897 ]
[ 1882, 2803, 26, 2774, 13, 24, 1882, 199, 3, 7819, 199, 3, 199, 3, 6642, 26, 21644, 1804, 82, 10874, 2297, 665, 3151, 16779, 10874, 2297, 32, 6799, 14, 957, 30, 199, 3, 3515, 1626, 303, 11560, 377, 90, 16673, 736, 665, 3903, 16673, 736, 32, 6799, 14, 957, 30, 199, 3, 199, 3, 1898, 334, 67, 9, 7800, 21644, 1804, 82, 10874, 2297, 199, 3, 1898, 334, 67, 9, 6900, 1626, 303, 11560, 377, 90, 16673, 736, 199, 3, 1898, 334, 67, 9, 7800, 1603, 14015, 577, 2000, 8764, 199, 3, 1898, 334, 67, 9, 7800, 820, 530, 1005, 79, 428, 382, 3042, 199, 3, 199, 3, 8779, 365, 11882, 10009, 12, 2867, 402, 11204, 12, 370, 1263, 4954, 199, 3, 12408, 282, 1331, 402, 642, 2032, 436, 4568, 3794, 199, 3, 1584, 334, 1589, 298, 10337, 1288, 370, 7962, 315, 314, 2290, 1928, 199, 3, 10588, 12, 5893, 1928, 12305, 314, 4481, 370, 675, 12, 199, 3, 1331, 12, 2811, 12, 5389, 12, 2780, 12, 11207, 12, 13473, 12, 436, 15, 269, 12743, 199, 3, 6866, 402, 314, 2290, 12, 436, 370, 11291, 12103, 370, 12676, 314, 199, 3, 2290, 365, 13985, 370, 886, 880, 12, 5420, 370, 314, 2569, 199, 3, 3704, 26, 199, 3, 199, 3, 710, 3432, 4248, 4245, 436, 642, 4983, 4245, 10989, 506, 199, 3, 5120, 315, 1006, 6866, 503, 13393, 12468, 402, 314, 2290, 14, 199, 3, 199, 3, 2334, 4141, 2281, 7049, 298, 1179, 2281, 401, 2428, 3408, 1634, 1821, 3826, 12, 199, 3, 7168, 1549, 5292, 12, 6931, 5400, 2845, 5471, 2296, 2334, 2990, 199, 3, 1634, 3169, 12, 3092, 2381, 437, 3115, 3104, 2401, 199, 3, 13229, 14, 1621, 4825, 6461, 7000, 2334, 10610, 1549, 5877, 199, 3, 8164, 6262, 7024, 2381, 1821, 13140, 12, 6736, 1549, 5010, 5603, 12, 199, 3, 7061, 1621, 1261, 9612, 1634, 7066, 12, 7056, 1549, 7334, 12, 7043, 199, 3, 4442, 12, 5738, 1634, 1549, 1621, 11287, 1663, 2334, 4141, 1549, 2334, 4815, 1549, 199, 3, 5010, 13198, 1621, 2334, 4141, 14, 199, 3, 199, 3, 7819, 199, 199, 646, 2050, 199, 646, 747, 199, 504, 3816, 14, 4912, 14, 4078, 14, 1122, 492, 2198, 63, 26714, 199, 504, 3816, 14, 4912, 14, 4078, 14, 1122, 492, 3715, 1131, 199, 504, 3816, 14, 4912, 14, 4078, 14, 1122, 492, 7097, 199, 504, 3816, 492, 5228, 199, 504, 3816, 14, 4912, 14, 888, 2087, 492, 14969, 15218, 199, 646, 984, 199, 504, 900, 492, 900, 199, 646, 12464, 1121, 14, 1974, 199, 199, 504, 1134, 29735, 14, 1018, 14, 9464, 492, 7559, 199, 504, 1134, 29735, 492, 312, 65, 711, 17077, 12, 1687, 677, 1047, 12, 308, 6558, 199, 504, 1134, 29735, 14, 5265, 14, 11225, 492, 4690, 465, 299, 2913, 199, 646, 1134, 29735, 14, 5265, 14, 4467, 8532, 199, 504, 1134, 29735, 14, 1018, 492, 1101, 12, 943, 12, 4884, 199, 504, 1134, 29735, 14, 29238, 14, 29735, 492, 286, 3519, 18, 12, 286, 3519, 19, 199, 199, 10186, 275, 2050, 14, 5572, 3460, 354, 3368, 421, 199, 533, 445, 3519, 8, 785, 304, 272, 408, 3523, 445, 8745, 1654, 408, 272, 347, 636, 826, 721, 277, 12, 14059, 888, 29, 403, 12, 2589, 29, 403, 12, 1015, 534, 19, 14, 16, 14, 16, 735, 267, 408, 11578, 445, 8745, 408, 398, 340, 440, 2589, 26, 288, 291, 14, 2314, 275, 747, 14, 2314, 267, 587, 26, 288, 291, 14, 2314, 275, 2589, 398, 291, 14, 1100, 275, 1101, 14, 9278, 2998, 342, 398, 327, 22373, 2248, 642, 1380, 4346, 267, 327, 334, 390, 911, 19860, 590, 1678, 2288, 4810, 10747, 9, 267, 291, 14, 5474, 85, 1113, 275, 488, 267, 291, 14, 27285, 1113, 275, 488, 267, 291, 14, 20047, 711, 77, 526, 468, 275, 488, 398, 327, 4205, 1022, 11702, 267, 291, 14, 11475, 80, 275, 1052, 398, 291, 14, 632, 275, 283, 29735, 7, 267, 291, 14, 305, 9865, 275, 756, 267, 291, 14, 21818, 275, 756, 267, 291, 14, 1069, 275, 488, 267, 291, 14, 1971, 275, 756, 267, 291, 14, 1205, 275, 283, 3593, 7, 267, 291, 14, 11225, 275, 488, 267, 291, 14, 2609, 275, 756, 267, 291, 14, 4467, 8532, 275, 1052, 267, 291, 14, 17450, 275, 283, 3578, 15, 1652, 27, 5960, 29, 6610, 13, 24, 7, 267, 291, 14, 2991, 275, 283, 6610, 13, 24, 7, 267, 291, 14, 9118, 63, 1361, 275, 378, 267, 291, 14, 2261, 1131, 466, 275, 283, 513, 7, 267, 291, 14, 1025, 275, 283, 1176, 7, 267, 291, 14, 3671, 275, 791, 26723, 63, 600, 356, 283, 287, 297, 283, 505, 356, 283, 17872, 936, 267, 291, 14, 1412, 63, 521, 63, 928, 275, 900, 342, 398, 327, 5627, 445, 8745, 4514, 909, 334, 885, 445, 8745, 19, 9, 267, 291, 14, 11166, 275, 286, 3519, 19, 14, 35, 3519, 19, 8, 1000, 63, 29735, 29, 277, 9, 267, 291, 14, 1069, 63, 1023, 275, 1015, 398, 340, 291, 14, 1069, 63, 1023, 508, 283, 18, 14, 16, 14, 18, 356, 288, 291, 14, 11166, 275, 286, 3519, 18, 14, 35, 3519, 18, 8, 1000, 63, 29735, 29, 277, 9, 288, 291, 14, 1100, 14, 409, 63, 1238, 360, 29735, 358, 398, 327, 2248, 922, 2897, 267, 862, 26, 288, 20184, 14, 815, 360, 19236, 922, 2897, 358, 288, 340, 1228, 8, 2591, 888, 12, 14969, 15218, 304, 221, 327, 6380, 2575, 355, 291, 14, 888, 275, 14059, 888, 288, 587, 26, 355, 291, 14, 888, 275, 14969, 15218, 342, 355, 340, 1228, 8, 2591, 888, 12, 1211, 304, 221, 327, 2600, 490, 367, 3420, 12, 1511, 315, 14059, 888, 14, 1744, 837, 717, 291, 14, 888, 14, 525, 63, 2792, 8, 2792, 9, 717, 367, 1022, 12, 373, 315, 1511, 14, 1744, 837, 1169, 291, 14, 888, 14, 409, 8, 2792, 12, 1022, 12, 373, 9, 355, 587, 26, 221, 327, 2897, 570, 490, 492, 6010, 490, 543, 6010, 14, 1490, 8, 2591, 888, 12, 2644, 534, 1624, 13, 24, 358, 465, 308, 1850, 26, 717, 291, 14, 888, 14, 739, 3997, 8, 17124, 9, 267, 871, 2186, 465, 2329, 26, 288, 1499, 275, 283, 6531, 440, 2248, 2897, 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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 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
zencore-dobetter/zencore-utils
src/zencore/utils/redis.py
1
3995
import uuid import math import time import logging import redis as engine from zencore.errors import WrongParameterTypeError from .types import smart_force_to_string logger = logging.getLogger(__name__) class RedisLock(object): def __init__(self, url, name=None, app_name=None, expire=None, prefix="zencore:lock:", tick=5, **kwargs): self.url = url self.connection = engine.Redis.from_url(url, **kwargs) self.app_name = app_name or str(uuid.uuid4()) self.prefix = prefix self.expire = expire self.tick = tick if name: self.setup(name) def setup(self, name): self.lock_name = ":".join([self.prefix, name]) self.signal_name = ":".join([self.prefix, name, "signal"]) def acquire(self, blocking=True, timeout=-1): stime = time.clock() while True: result = self.acquire_nowait() if result: return True if not blocking: return False if timeout == 0: return False if timeout > 0: delta = math.ceil(timeout - (time.clock() - stime)) if delta < 0: return False if delta > self.tick: delta = self.tick else: delta = self.tick event = self.connection.blpop(self.signal_name, timeout=delta) if event is None: return False def acquire_nowait(self): result = self.connection.setnx(self.lock_name, self.app_name) if result: if self.expire: self.connection.expire(self.lock_name, self.expire) self.connection.delete(self.signal_name) return True return False def release(self): if self.is_lock_owner(): self.connection.delete(self.lock_name) self.connection.rpush(self.signal_name, 1) def force_clean(self): self.connection.delete(self.lock_name) self.connection.rpush(self.signal_name, 1) def get_current_lock_owner(self, ): return smart_force_to_string(self.connection.get(self.lock_name)) def is_lock_owner(self): return self.get_current_lock_owner() == self.app_name class Counter(object): def __init__(self, connection, namespace): self.connection = connection self.namespace = namespace def incr(self, name): key = self.make_counter_key(name) self.connection.incr(key) def get(self, name): key = self.make_counter_key(name) return int(self.connection.get(key)) def getall(self): keys = self.connection.keys(self.make_counter_pattern()) if not keys: return {} keys = [key.decode("utf-8") for key in keys] values = [int(value) for value in self.connection.mget(*keys)] return dict(zip(keys, values)) def make_counter_key(self, name): return "{}:{}".format(self.namespace, name) def make_counter_pattern(self): return "{}:*".format(self.namespace) def get_redis(config): """ 从配置文件获取redis对象。 """ if isinstance(config, engine.StrictRedis): return config if isinstance(config, str): return engine.Redis.from_url(config) if isinstance(config, dict): url = config.get("url") host = config.get("host") if url: db = config.get("db", None) options = config.get("options", {}) return engine.Redis.from_url(url, db, **options) if host: return engine.Redis(**config) logger.error("get_redis got wrong parameter type error.") raise WrongParameterTypeError() # ########################################################################### # 重复或不推荐使用 # ########################################################################### make_redis_instance = get_redis
mit
[ 646, 5377, 199, 646, 3473, 199, 646, 900, 199, 646, 2050, 199, 646, 16967, 465, 6869, 199, 504, 1315, 287, 1018, 14, 2550, 492, 30801, 4720, 4333, 199, 504, 1275, 1313, 492, 11179, 63, 3990, 63, 475, 63, 875, 421, 199, 2921, 275, 2050, 14, 5572, 3460, 354, 3368, 421, 199, 533, 25496, 6432, 8, 785, 304, 339, 347, 636, 826, 721, 277, 12, 1166, 12, 536, 29, 403, 12, 1145, 63, 354, 29, 403, 12, 16667, 29, 403, 12, 2403, 628, 5193, 1018, 26, 831, 6783, 11748, 29, 21, 12, 1011, 958, 304, 267, 291, 14, 633, 275, 1166, 267, 291, 14, 2105, 275, 6869, 14, 29605, 14, 504, 63, 633, 8, 633, 12, 1011, 958, 9, 267, 291, 14, 571, 63, 354, 275, 1145, 63, 354, 503, 620, 8, 2580, 14, 2580, 20, 1012, 267, 291, 14, 1861, 275, 2403, 267, 291, 14, 14691, 275, 16667, 267, 291, 14, 8284, 275, 11748, 267, 340, 536, 26, 288, 291, 14, 2758, 8, 354, 9, 339, 347, 3272, 8, 277, 12, 536, 304, 267, 291, 14, 831, 63, 354, 275, 7244, 1674, 904, 779, 277, 14, 1861, 12, 536, 566, 267, 291, 14, 4653, 63, 354, 275, 7244, 1674, 904, 779, 277, 14, 1861, 12, 536, 12, 298, 4653, 3135, 339, 347, 16919, 8, 277, 12, 14592, 29, 549, 12, 2653, 4022, 17, 304, 267, 410, 1036, 275, 900, 14, 9597, 342, 267, 1830, 715, 26, 288, 754, 275, 291, 14, 8174, 63, 20870, 342, 288, 340, 754, 26, 355, 372, 715, 288, 340, 440, 14592, 26, 355, 372, 756, 288, 340, 2653, 508, 378, 26, 355, 372, 756, 288, 340, 2653, 690, 378, 26, 355, 5762, 275, 3473, 14, 14085, 8, 2593, 446, 334, 521, 14, 9597, 342, 446, 410, 1036, 430, 355, 340, 5762, 665, 378, 26, 490, 372, 756, 355, 340, 5762, 690, 291, 14, 8284, 26, 490, 5762, 275, 291, 14, 8284, 288, 587, 26, 355, 5762, 275, 291, 14, 8284, 288, 1566, 275, 291, 14, 2105, 14, 3345, 1935, 8, 277, 14, 4653, 63, 354, 12, 2653, 29, 3136, 9, 288, 340, 1566, 365, 488, 26, 355, 372, 756, 339, 347, 16919, 63, 20870, 8, 277, 304, 267, 754, 275, 291, 14, 2105, 14, 409, 7343, 8, 277, 14, 831, 63, 354, 12, 291, 14, 571, 63, 354, 9, 267, 340, 754, 26, 288, 340, 291, 14, 14691, 26, 355, 291, 14, 2105, 14, 14691, 8, 277, 14, 831, 63, 354, 12, 291, 14, 14691, 9, 288, 291, 14, 2105, 14, 1807, 8, 277, 14, 4653, 63, 354, 9, 288, 372, 715, 267, 372, 756, 339, 347, 4683, 8, 277, 304, 267, 340, 291, 14, 374, 63, 831, 63, 4597, 837, 288, 291, 14, 2105, 14, 1807, 8, 277, 14, 831, 63, 354, 9, 288, 291, 14, 2105, 14, 4599, 2084, 8, 277, 14, 4653, 63, 354, 12, 413, 9, 339, 347, 3542, 63, 3118, 8, 277, 304, 267, 291, 14, 2105, 14, 1807, 8, 277, 14, 831, 63, 354, 9, 267, 291, 14, 2105, 14, 4599, 2084, 8, 277, 14, 4653, 63, 354, 12, 413, 9, 339, 347, 664, 63, 1818, 63, 831, 63, 4597, 8, 277, 12, 3461, 267, 372, 11179, 63, 3990, 63, 475, 63, 875, 8, 277, 14, 2105, 14, 362, 8, 277, 14, 831, 63, 354, 430, 339, 347, 365, 63, 831, 63, 4597, 8, 277, 304, 267, 372, 291, 14, 362, 63, 1818, 63, 831, 63, 4597, 342, 508, 291, 14, 571, 63, 354, 421, 199, 533, 14427, 8, 785, 304, 339, 347, 636, 826, 721, 277, 12, 1950, 12, 3231, 304, 267, 291, 14, 2105, 275, 1950, 267, 291, 14, 3251, 275, 3231, 339, 347, 315, 1556, 8, 277, 12, 536, 304, 267, 790, 275, 291, 14, 1875, 63, 5337, 63, 498, 8, 354, 9, 267, 291, 14, 2105, 14, 19362, 8, 498, 9, 339, 347, 664, 8, 277, 12, 536, 304, 267, 790, 275, 291, 14, 1875, 63, 5337, 63, 498, 8, 354, 9, 267, 372, 1109, 8, 277, 14, 2105, 14, 362, 8, 498, 430, 339, 347, 664, 452, 8, 277, 304, 267, 2883, 275, 291, 14, 2105, 14, 1612, 8, 277, 14, 1875, 63, 5337, 63, 3401, 1012, 267, 340, 440, 2883, 26, 288, 372, 1052, 267, 2883, 275, 359, 498, 14, 2708, 480, 1624, 13, 24, 531, 367, 790, 315, 2883, 61, 267, 1338, 275, 359, 442, 8, 585, 9, 367, 574, 315, 291, 14, 2105, 14, 77, 362, 2031, 1612, 1874, 267, 372, 1211, 8, 3065, 8, 1612, 12, 1338, 430, 339, 347, 1852, 63, 5337, 63, 498, 8, 277, 12, 536, 304, 267, 372, 11491, 26, 13536, 908, 8, 277, 14, 3251, 12, 536, 9, 339, 347, 1852, 63, 5337, 63, 3401, 8, 277, 304, 267, 372, 11491, 27344, 1674, 908, 8, 277, 14, 3251, 9, 421, 199, 318, 664, 63, 15369, 8, 888, 304, 272, 408, 272, 221, 5498, 237, 166, 228, 236, 27029, 29303, 165, 237, 116, 22924, 15369, 26604, 165, 110, 95, 20061, 272, 408, 272, 340, 1228, 8, 888, 12, 6869, 14, 18625, 29605, 304, 267, 372, 1101, 272, 340, 1228, 8, 888, 12, 620, 304, 267, 372, 6869, 14, 29605, 14, 504, 63, 633, 8, 888, 9, 272, 340, 1228, 8, 888, 12, 1211, 304, 267, 1166, 275, 1101, 14, 362, 480, 633, 531, 267, 1591, 275, 1101, 14, 362, 480, 1102, 531, 267, 340, 1166, 26, 288, 1592, 275, 1101, 14, 362, 480, 697, 401, 488, 9, 288, 1511, 275, 1101, 14, 362, 480, 1419, 401, 5009, 288, 372, 6869, 14, 29605, 14, 504, 63, 633, 8, 633, 12, 1592, 12, 1011, 1419, 9, 267, 340, 1591, 26, 288, 372, 6869, 14, 29605, 3682, 888, 9, 272, 2512, 14, 705, 480, 362, 63, 15369, 4788, 6835, 2725, 730, 1125, 2685, 272, 746, 30801, 4720, 4333, 342, 199, 199, 3, 23441, 5680, 199, 3, 10469, 230, 236, 11546, 236, 9077, 245, 19594, 17797, 102, 165, 236, 239, 30026, 199, 3, 23441, 5680, 199, 1875, 63, 15369, 63, 842, 275, 664, 63, 15369, 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 ]
[ 5377, 199, 646, 3473, 199, 646, 900, 199, 646, 2050, 199, 646, 16967, 465, 6869, 199, 504, 1315, 287, 1018, 14, 2550, 492, 30801, 4720, 4333, 199, 504, 1275, 1313, 492, 11179, 63, 3990, 63, 475, 63, 875, 421, 199, 2921, 275, 2050, 14, 5572, 3460, 354, 3368, 421, 199, 533, 25496, 6432, 8, 785, 304, 339, 347, 636, 826, 721, 277, 12, 1166, 12, 536, 29, 403, 12, 1145, 63, 354, 29, 403, 12, 16667, 29, 403, 12, 2403, 628, 5193, 1018, 26, 831, 6783, 11748, 29, 21, 12, 1011, 958, 304, 267, 291, 14, 633, 275, 1166, 267, 291, 14, 2105, 275, 6869, 14, 29605, 14, 504, 63, 633, 8, 633, 12, 1011, 958, 9, 267, 291, 14, 571, 63, 354, 275, 1145, 63, 354, 503, 620, 8, 2580, 14, 2580, 20, 1012, 267, 291, 14, 1861, 275, 2403, 267, 291, 14, 14691, 275, 16667, 267, 291, 14, 8284, 275, 11748, 267, 340, 536, 26, 288, 291, 14, 2758, 8, 354, 9, 339, 347, 3272, 8, 277, 12, 536, 304, 267, 291, 14, 831, 63, 354, 275, 7244, 1674, 904, 779, 277, 14, 1861, 12, 536, 566, 267, 291, 14, 4653, 63, 354, 275, 7244, 1674, 904, 779, 277, 14, 1861, 12, 536, 12, 298, 4653, 3135, 339, 347, 16919, 8, 277, 12, 14592, 29, 549, 12, 2653, 4022, 17, 304, 267, 410, 1036, 275, 900, 14, 9597, 342, 267, 1830, 715, 26, 288, 754, 275, 291, 14, 8174, 63, 20870, 342, 288, 340, 754, 26, 355, 372, 715, 288, 340, 440, 14592, 26, 355, 372, 756, 288, 340, 2653, 508, 378, 26, 355, 372, 756, 288, 340, 2653, 690, 378, 26, 355, 5762, 275, 3473, 14, 14085, 8, 2593, 446, 334, 521, 14, 9597, 342, 446, 410, 1036, 430, 355, 340, 5762, 665, 378, 26, 490, 372, 756, 355, 340, 5762, 690, 291, 14, 8284, 26, 490, 5762, 275, 291, 14, 8284, 288, 587, 26, 355, 5762, 275, 291, 14, 8284, 288, 1566, 275, 291, 14, 2105, 14, 3345, 1935, 8, 277, 14, 4653, 63, 354, 12, 2653, 29, 3136, 9, 288, 340, 1566, 365, 488, 26, 355, 372, 756, 339, 347, 16919, 63, 20870, 8, 277, 304, 267, 754, 275, 291, 14, 2105, 14, 409, 7343, 8, 277, 14, 831, 63, 354, 12, 291, 14, 571, 63, 354, 9, 267, 340, 754, 26, 288, 340, 291, 14, 14691, 26, 355, 291, 14, 2105, 14, 14691, 8, 277, 14, 831, 63, 354, 12, 291, 14, 14691, 9, 288, 291, 14, 2105, 14, 1807, 8, 277, 14, 4653, 63, 354, 9, 288, 372, 715, 267, 372, 756, 339, 347, 4683, 8, 277, 304, 267, 340, 291, 14, 374, 63, 831, 63, 4597, 837, 288, 291, 14, 2105, 14, 1807, 8, 277, 14, 831, 63, 354, 9, 288, 291, 14, 2105, 14, 4599, 2084, 8, 277, 14, 4653, 63, 354, 12, 413, 9, 339, 347, 3542, 63, 3118, 8, 277, 304, 267, 291, 14, 2105, 14, 1807, 8, 277, 14, 831, 63, 354, 9, 267, 291, 14, 2105, 14, 4599, 2084, 8, 277, 14, 4653, 63, 354, 12, 413, 9, 339, 347, 664, 63, 1818, 63, 831, 63, 4597, 8, 277, 12, 3461, 267, 372, 11179, 63, 3990, 63, 475, 63, 875, 8, 277, 14, 2105, 14, 362, 8, 277, 14, 831, 63, 354, 430, 339, 347, 365, 63, 831, 63, 4597, 8, 277, 304, 267, 372, 291, 14, 362, 63, 1818, 63, 831, 63, 4597, 342, 508, 291, 14, 571, 63, 354, 421, 199, 533, 14427, 8, 785, 304, 339, 347, 636, 826, 721, 277, 12, 1950, 12, 3231, 304, 267, 291, 14, 2105, 275, 1950, 267, 291, 14, 3251, 275, 3231, 339, 347, 315, 1556, 8, 277, 12, 536, 304, 267, 790, 275, 291, 14, 1875, 63, 5337, 63, 498, 8, 354, 9, 267, 291, 14, 2105, 14, 19362, 8, 498, 9, 339, 347, 664, 8, 277, 12, 536, 304, 267, 790, 275, 291, 14, 1875, 63, 5337, 63, 498, 8, 354, 9, 267, 372, 1109, 8, 277, 14, 2105, 14, 362, 8, 498, 430, 339, 347, 664, 452, 8, 277, 304, 267, 2883, 275, 291, 14, 2105, 14, 1612, 8, 277, 14, 1875, 63, 5337, 63, 3401, 1012, 267, 340, 440, 2883, 26, 288, 372, 1052, 267, 2883, 275, 359, 498, 14, 2708, 480, 1624, 13, 24, 531, 367, 790, 315, 2883, 61, 267, 1338, 275, 359, 442, 8, 585, 9, 367, 574, 315, 291, 14, 2105, 14, 77, 362, 2031, 1612, 1874, 267, 372, 1211, 8, 3065, 8, 1612, 12, 1338, 430, 339, 347, 1852, 63, 5337, 63, 498, 8, 277, 12, 536, 304, 267, 372, 11491, 26, 13536, 908, 8, 277, 14, 3251, 12, 536, 9, 339, 347, 1852, 63, 5337, 63, 3401, 8, 277, 304, 267, 372, 11491, 27344, 1674, 908, 8, 277, 14, 3251, 9, 421, 199, 318, 664, 63, 15369, 8, 888, 304, 272, 408, 272, 221, 5498, 237, 166, 228, 236, 27029, 29303, 165, 237, 116, 22924, 15369, 26604, 165, 110, 95, 20061, 272, 408, 272, 340, 1228, 8, 888, 12, 6869, 14, 18625, 29605, 304, 267, 372, 1101, 272, 340, 1228, 8, 888, 12, 620, 304, 267, 372, 6869, 14, 29605, 14, 504, 63, 633, 8, 888, 9, 272, 340, 1228, 8, 888, 12, 1211, 304, 267, 1166, 275, 1101, 14, 362, 480, 633, 531, 267, 1591, 275, 1101, 14, 362, 480, 1102, 531, 267, 340, 1166, 26, 288, 1592, 275, 1101, 14, 362, 480, 697, 401, 488, 9, 288, 1511, 275, 1101, 14, 362, 480, 1419, 401, 5009, 288, 372, 6869, 14, 29605, 14, 504, 63, 633, 8, 633, 12, 1592, 12, 1011, 1419, 9, 267, 340, 1591, 26, 288, 372, 6869, 14, 29605, 3682, 888, 9, 272, 2512, 14, 705, 480, 362, 63, 15369, 4788, 6835, 2725, 730, 1125, 2685, 272, 746, 30801, 4720, 4333, 342, 199, 199, 3, 23441, 5680, 199, 3, 10469, 230, 236, 11546, 236, 9077, 245, 19594, 17797, 102, 165, 236, 239, 30026, 199, 3, 23441, 5680, 199, 1875, 63, 15369, 63, 842, 275, 664, 63, 15369, 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, 0 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,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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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
samdoran/ansible
lib/ansible/module_utils/netscaler.py
17
11949
# -*- coding: utf-8 -*- # Copyright (c) 2017 Citrix Systems # # This code is part of Ansible, but is an independent component. # This particular file snippet, and this file snippet only, is BSD licensed. # Modules you write using this snippet, which is embedded dynamically by Ansible # still belong to the author of the module, and may assign their own license # to the complete work. # # Redistribution and use in source and binary forms, with or without modification, # are permitted provided that the following conditions are met: # # * Redistributions of source code must retain the above copyright # notice, this list of conditions and the following disclaimer. # * Redistributions in binary form must reproduce the above copyright notice, # this list of conditions and the following disclaimer in the documentation # and/or other materials provided with the distribution. # # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. # IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, # INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE # USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. # import json import re from ansible.module_utils.basic import env_fallback class ConfigProxy(object): def __init__(self, actual, client, attribute_values_dict, readwrite_attrs, transforms={}, readonly_attrs=[], immutable_attrs=[], json_encodes=[]): # Actual config object from nitro sdk self.actual = actual # nitro client self.client = client # ansible attribute_values_dict self.attribute_values_dict = attribute_values_dict self.readwrite_attrs = readwrite_attrs self.readonly_attrs = readonly_attrs self.immutable_attrs = immutable_attrs self.json_encodes = json_encodes self.transforms = transforms self.attribute_values_processed = {} for attribute, value in self.attribute_values_dict.items(): if attribute in transforms: for transform in self.transforms[attribute]: if transform == 'bool_yes_no': value = 'YES' if value is True else 'NO' elif transform == 'bool_on_off': value = 'ON' if value is True else 'OFF' elif callable(transform): value = transform(value) else: raise Exception('Invalid transform %s' % transform) self.attribute_values_processed[attribute] = value self._copy_attributes_to_actual() def _copy_attributes_to_actual(self): for attribute in self.readwrite_attrs: if attribute in self.attribute_values_processed: attribute_value = self.attribute_values_processed[attribute] if attribute_value is None: continue # Fallthrough if attribute in self.json_encodes: attribute_value = json.JSONEncoder().encode(attribute_value).strip('"') setattr(self.actual, attribute, attribute_value) def __getattr__(self, name): if name in self.attribute_values_dict: return self.attribute_values_dict[name] else: raise AttributeError('No attribute %s found' % name) def add(self): self.actual.__class__.add(self.client, self.actual) def update(self): return self.actual.__class__.update(self.client, self.actual) def delete(self): self.actual.__class__.delete(self.client, self.actual) def get(self, *args, **kwargs): result = self.actual.__class__.get(self.client, *args, **kwargs) return result def has_equal_attributes(self, other): if self.diff_object(other) == {}: return True else: return False def diff_object(self, other): diff_dict = {} for attribute in self.attribute_values_processed: # Skip readonly attributes if attribute not in self.readwrite_attrs: continue # Skip attributes not present in module arguments if self.attribute_values_processed[attribute] is None: continue # Check existence if hasattr(other, attribute): attribute_value = getattr(other, attribute) else: diff_dict[attribute] = 'missing from other' continue # Compare values param_type = self.attribute_values_processed[attribute].__class__ if param_type(attribute_value) != self.attribute_values_processed[attribute]: str_tuple = ( type(self.attribute_values_processed[attribute]), self.attribute_values_processed[attribute], type(attribute_value), attribute_value, ) diff_dict[attribute] = 'difference. ours: (%s) %s other: (%s) %s' % str_tuple return diff_dict def get_actual_rw_attributes(self, filter='name'): if self.actual.__class__.count_filtered(self.client, '%s:%s' % (filter, self.attribute_values_dict[filter])) == 0: return {} server_list = self.actual.__class__.get_filtered(self.client, '%s:%s' % (filter, self.attribute_values_dict[filter])) actual_instance = server_list[0] ret_val = {} for attribute in self.readwrite_attrs: if not hasattr(actual_instance, attribute): continue ret_val[attribute] = getattr(actual_instance, attribute) return ret_val def get_actual_ro_attributes(self, filter='name'): if self.actual.__class__.count_filtered(self.client, '%s:%s' % (filter, self.attribute_values_dict[filter])) == 0: return {} server_list = self.actual.__class__.get_filtered(self.client, '%s:%s' % (filter, self.attribute_values_dict[filter])) actual_instance = server_list[0] ret_val = {} for attribute in self.readonly_attrs: if not hasattr(actual_instance, attribute): continue ret_val[attribute] = getattr(actual_instance, attribute) return ret_val def get_missing_rw_attributes(self): return list(set(self.readwrite_attrs) - set(self.get_actual_rw_attributes().keys())) def get_missing_ro_attributes(self): return list(set(self.readonly_attrs) - set(self.get_actual_ro_attributes().keys())) def get_immutables_intersection(config_proxy, keys): immutables_set = set(config_proxy.immutable_attrs) keys_set = set(keys) # Return list of sets' intersection return list(immutables_set & keys_set) def ensure_feature_is_enabled(client, feature_str): enabled_features = client.get_enabled_features() if feature_str not in enabled_features: client.enable_features(feature_str) client.save_config() def get_nitro_client(module): from nssrc.com.citrix.netscaler.nitro.service.nitro_service import nitro_service client = nitro_service(module.params['nsip'], module.params['nitro_protocol']) client.set_credential(module.params['nitro_user'], module.params['nitro_pass']) client.timeout = float(module.params['nitro_timeout']) client.certvalidation = module.params['validate_certs'] return client netscaler_common_arguments = dict( nsip=dict( required=True, fallback=(env_fallback, ['NETSCALER_NSIP']), ), nitro_user=dict( required=True, fallback=(env_fallback, ['NETSCALER_NITRO_USER']), no_log=True ), nitro_pass=dict( required=True, fallback=(env_fallback, ['NETSCALER_NITRO_PASS']), no_log=True ), nitro_protocol=dict( choices=['http', 'https'], fallback=(env_fallback, ['NETSCALER_NITRO_PROTOCOL']), default='http' ), validate_certs=dict( default=True, type='bool' ), nitro_timeout=dict(default=310, type='float'), state=dict( choices=[ 'present', 'absent', ], default='present', ), save_config=dict( type='bool', default=True, ), ) loglines = [] def complete_missing_attributes(actual, attrs_list, fill_value=None): for attribute in attrs_list: if not hasattr(actual, attribute): setattr(actual, attribute, fill_value) def log(msg): loglines.append(msg) def get_ns_version(client): from nssrc.com.citrix.netscaler.nitro.resource.config.ns.nsversion import nsversion result = nsversion.get(client) m = re.match(r'^.*NS(\d+)\.(\d+).*$', result[0].version) if m is None: return None else: return int(m.group(1)), int(m.group(2)) def monkey_patch_nitro_api(): from nssrc.com.citrix.netscaler.nitro.resource.base.Json import Json def new_resource_to_string_convert(self, resrc): try: # Line below is the actual patch dict_valid_values = dict((k.replace('_', '', 1), v) for k, v in resrc.__dict__.items() if v) return json.dumps(dict_valid_values) except Exception as e: raise e Json.resource_to_string_convert = new_resource_to_string_convert from nssrc.com.citrix.netscaler.nitro.util.nitro_util import nitro_util @classmethod def object_to_string_new(cls, obj): try: str_ = "" flds = obj.__dict__ # Line below is the actual patch flds = dict((k.replace('_', '', 1), v) for k, v in flds.items() if v) if (flds): for k, v in flds.items(): str_ = str_ + "\"" + k + "\":" if type(v) is unicode: v = v.encode('utf8') if type(v) is bool: str_ = str_ + v elif type(v) is str: str_ = str_ + "\"" + v + "\"" elif type(v) is int: str_ = str_ + "\"" + str(v) + "\"" if str_: str_ = str_ + "," return str_ except Exception as e: raise e @classmethod def object_to_string_withoutquotes_new(cls, obj): try: str_ = "" flds = obj.__dict__ # Line below is the actual patch flds = dict((k.replace('_', '', 1), v) for k, v in flds.items() if v) i = 0 if (flds): for k, v in flds.items(): str_ = str_ + k + ":" if type(v) is unicode: v = v.encode('utf8') if type(v) is bool: str_ = str_ + v elif type(v) is str: str_ = str_ + cls.encode(v) elif type(v) is int: str_ = str_ + str(v) i = i + 1 if i != (len(flds.items())) and str_: str_ = str_ + "," return str_ except Exception as e: raise e nitro_util.object_to_string = object_to_string_new nitro_util.object_to_string_withoutquotes = object_to_string_withoutquotes_new
gpl-3.0
[ 3, 1882, 2803, 26, 2774, 13, 24, 1882, 199, 199, 3, 221, 1898, 334, 67, 9, 9708, 445, 390, 1904, 15285, 199, 3, 199, 3, 961, 1233, 365, 1777, 402, 2622, 12, 1325, 365, 376, 12717, 3931, 14, 199, 3, 961, 6770, 570, 17440, 12, 436, 642, 570, 17440, 1454, 12, 365, 6289, 18233, 14, 199, 3, 18167, 1265, 2218, 1808, 642, 17440, 12, 1314, 365, 12169, 18774, 701, 2622, 199, 3, 5139, 13511, 370, 314, 4132, 402, 314, 859, 12, 436, 1443, 5090, 3932, 5705, 4190, 199, 3, 370, 314, 4890, 1736, 14, 199, 3, 199, 3, 10114, 436, 675, 315, 1350, 436, 3366, 4513, 12, 543, 503, 1928, 7100, 12, 199, 3, 787, 8211, 2741, 626, 314, 2569, 3704, 787, 7647, 26, 199, 3, 199, 3, 259, 627, 6823, 402, 1350, 1233, 1471, 8074, 314, 3432, 4248, 199, 3, 420, 4245, 12, 642, 769, 402, 3704, 436, 314, 2569, 6450, 14, 199, 3, 259, 627, 6823, 315, 3366, 1824, 1471, 9172, 314, 3432, 4248, 4245, 12, 199, 3, 420, 642, 769, 402, 3704, 436, 314, 2569, 6450, 315, 314, 3794, 199, 3, 420, 436, 15, 269, 1163, 8418, 2741, 543, 314, 4084, 14, 199, 3, 199, 3, 5749, 4141, 2281, 7049, 6515, 2334, 5877, 8164, 2401, 6483, 298, 1179, 2281, 2, 2401, 199, 3, 1821, 7168, 1549, 5292, 2990, 12, 6931, 12, 5400, 2845, 5471, 2296, 12, 2334, 5292, 199, 3, 2990, 1634, 3169, 2401, 3092, 2381, 437, 3115, 3104, 9315, 9706, 14, 199, 3, 1621, 4825, 6461, 7000, 2334, 5877, 29785, 1549, 6483, 6262, 7024, 2381, 1821, 8703, 12, 9168, 12, 199, 3, 9716, 12, 8820, 12, 9836, 12, 1549, 9110, 6736, 334, 6446, 12, 5400, 2845, 5471, 2296, 12, 199, 3, 9838, 1634, 9103, 9764, 1549, 9714, 27, 9102, 1634, 4815, 12, 7126, 12, 1549, 9206, 27, 1549, 9748, 199, 3, 9831, 9, 9802, 9817, 2401, 5258, 1821, 9815, 1634, 5603, 12, 7061, 1621, 7066, 12, 9644, 199, 3, 5603, 12, 1549, 7056, 334, 6446, 9254, 1549, 7334, 9, 7043, 1621, 1821, 9683, 5738, 1634, 2334, 199, 3, 4815, 1634, 5749, 4141, 12, 9704, 8036, 9691, 1634, 2334, 9726, 1634, 9712, 9784, 14, 199, 3, 199, 199, 646, 2022, 199, 646, 295, 199, 199, 504, 3242, 14, 578, 63, 1208, 14, 4316, 492, 2589, 63, 10538, 421, 199, 533, 4094, 4936, 8, 785, 304, 339, 347, 636, 826, 721, 277, 12, 3503, 12, 1890, 12, 2225, 63, 1459, 63, 807, 12, 1586, 952, 63, 3288, 12, 18501, 10324, 6863, 63, 3288, 6034, 17092, 63, 3288, 6034, 2022, 63, 2143, 83, 17894, 398, 327, 18982, 1061, 1101, 909, 687, 20107, 13628, 267, 291, 14, 6514, 275, 3503, 398, 327, 20107, 1890, 267, 291, 14, 1258, 275, 1890, 398, 327, 3242, 2225, 63, 1459, 63, 807, 267, 291, 14, 3215, 63, 1459, 63, 807, 275, 2225, 63, 1459, 63, 807, 398, 291, 14, 24044, 63, 3288, 275, 1586, 952, 63, 3288, 267, 291, 14, 6753, 63, 3288, 275, 6863, 63, 3288, 267, 291, 14, 17836, 63, 3288, 275, 17092, 63, 3288, 267, 291, 14, 1001, 63, 2143, 83, 275, 2022, 63, 2143, 83, 267, 291, 14, 15133, 275, 18501, 398, 291, 14, 3215, 63, 1459, 63, 7292, 275, 1052, 267, 367, 2225, 12, 574, 315, 291, 14, 3215, 63, 1459, 63, 807, 14, 1744, 837, 288, 340, 2225, 315, 18501, 26, 355, 367, 5793, 315, 291, 14, 15133, 59, 3215, 2189, 490, 340, 5793, 508, 283, 2245, 63, 5066, 63, 889, 356, 717, 574, 275, 283, 15641, 7, 340, 574, 365, 715, 587, 283, 2826, 7, 490, 916, 5793, 508, 283, 2245, 63, 265, 63, 1997, 356, 717, 574, 275, 283, 615, 7, 340, 574, 365, 715, 587, 283, 7517, 7, 490, 916, 4550, 8, 4711, 304, 717, 574, 275, 5793, 8, 585, 9, 490, 587, 26, 717, 746, 2186, 360, 3364, 5793, 450, 83, 7, 450, 5793, 9, 288, 291, 14, 3215, 63, 1459, 63, 7292, 59, 3215, 61, 275, 574, 398, 291, 423, 1574, 63, 2987, 63, 475, 63, 6514, 342, 339, 347, 485, 1574, 63, 2987, 63, 475, 63, 6514, 8, 277, 304, 267, 367, 2225, 315, 291, 14, 24044, 63, 3288, 26, 288, 340, 2225, 315, 291, 14, 3215, 63, 1459, 63, 7292, 26, 355, 2225, 63, 585, 275, 291, 14, 3215, 63, 1459, 63, 7292, 59, 3215, 61, 2234, 340, 2225, 63, 585, 365, 488, 26, 490, 1980, 2234, 327, 481, 452, 8304, 355, 340, 2225, 315, 291, 14, 1001, 63, 2143, 83, 26, 490, 2225, 63, 585, 275, 2022, 14, 23069, 1252, 2143, 8, 3215, 63, 585, 680, 1913, 25441, 355, 5371, 8, 277, 14, 6514, 12, 2225, 12, 2225, 63, 585, 9, 339, 347, 636, 5675, 721, 277, 12, 536, 304, 267, 340, 536, 315, 291, 14, 3215, 63, 1459, 63, 807, 26, 288, 372, 291, 14, 3215, 63, 1459, 63, 807, 59, 354, 61, 267, 587, 26, 288, 746, 4281, 360, 1944, 2225, 450, 83, 1911, 7, 450, 536, 9, 339, 347, 1050, 8, 277, 304, 267, 291, 14, 6514, 855, 533, 4343, 525, 8, 277, 14, 1258, 12, 291, 14, 6514, 9, 339, 347, 1678, 8, 277, 304, 267, 372, 291, 14, 6514, 855, 533, 4343, 873, 8, 277, 14, 1258, 12, 291, 14, 6514, 9, 339, 347, 3145, 8, 277, 304, 267, 291, 14, 6514, 855, 533, 4343, 1807, 8, 277, 14, 1258, 12, 291, 14, 6514, 9, 339, 347, 664, 8, 277, 12, 627, 589, 12, 1011, 958, 304, 267, 754, 275, 291, 14, 6514, 855, 533, 4343, 362, 8, 277, 14, 1258, 12, 627, 589, 12, 1011, 958, 9, 398, 372, 754, 339, 347, 965, 63, 1452, 63, 2987, 8, 277, 12, 1163, 304, 267, 340, 291, 14, 3028, 63, 785, 8, 1848, 9, 508, 24702, 288, 372, 715, 267, 587, 26, 288, 372, 756, 339, 347, 3915, 63, 785, 8, 277, 12, 1163, 304, 267, 3915, 63, 807, 275, 1052, 267, 367, 2225, 315, 291, 14, 3215, 63, 1459, 63, 7292, 26, 288, 327, 8232, 6863, 3004, 288, 340, 2225, 440, 315, 291, 14, 24044, 63, 3288, 26, 355, 1980, 953, 327, 8232, 3004, 440, 3451, 315, 859, 2368, 288, 340, 291, 14, 3215, 63, 1459, 63, 7292, 59 ]
[ 1882, 2803, 26, 2774, 13, 24, 1882, 199, 199, 3, 221, 1898, 334, 67, 9, 9708, 445, 390, 1904, 15285, 199, 3, 199, 3, 961, 1233, 365, 1777, 402, 2622, 12, 1325, 365, 376, 12717, 3931, 14, 199, 3, 961, 6770, 570, 17440, 12, 436, 642, 570, 17440, 1454, 12, 365, 6289, 18233, 14, 199, 3, 18167, 1265, 2218, 1808, 642, 17440, 12, 1314, 365, 12169, 18774, 701, 2622, 199, 3, 5139, 13511, 370, 314, 4132, 402, 314, 859, 12, 436, 1443, 5090, 3932, 5705, 4190, 199, 3, 370, 314, 4890, 1736, 14, 199, 3, 199, 3, 10114, 436, 675, 315, 1350, 436, 3366, 4513, 12, 543, 503, 1928, 7100, 12, 199, 3, 787, 8211, 2741, 626, 314, 2569, 3704, 787, 7647, 26, 199, 3, 199, 3, 259, 627, 6823, 402, 1350, 1233, 1471, 8074, 314, 3432, 4248, 199, 3, 420, 4245, 12, 642, 769, 402, 3704, 436, 314, 2569, 6450, 14, 199, 3, 259, 627, 6823, 315, 3366, 1824, 1471, 9172, 314, 3432, 4248, 4245, 12, 199, 3, 420, 642, 769, 402, 3704, 436, 314, 2569, 6450, 315, 314, 3794, 199, 3, 420, 436, 15, 269, 1163, 8418, 2741, 543, 314, 4084, 14, 199, 3, 199, 3, 5749, 4141, 2281, 7049, 6515, 2334, 5877, 8164, 2401, 6483, 298, 1179, 2281, 2, 2401, 199, 3, 1821, 7168, 1549, 5292, 2990, 12, 6931, 12, 5400, 2845, 5471, 2296, 12, 2334, 5292, 199, 3, 2990, 1634, 3169, 2401, 3092, 2381, 437, 3115, 3104, 9315, 9706, 14, 199, 3, 1621, 4825, 6461, 7000, 2334, 5877, 29785, 1549, 6483, 6262, 7024, 2381, 1821, 8703, 12, 9168, 12, 199, 3, 9716, 12, 8820, 12, 9836, 12, 1549, 9110, 6736, 334, 6446, 12, 5400, 2845, 5471, 2296, 12, 199, 3, 9838, 1634, 9103, 9764, 1549, 9714, 27, 9102, 1634, 4815, 12, 7126, 12, 1549, 9206, 27, 1549, 9748, 199, 3, 9831, 9, 9802, 9817, 2401, 5258, 1821, 9815, 1634, 5603, 12, 7061, 1621, 7066, 12, 9644, 199, 3, 5603, 12, 1549, 7056, 334, 6446, 9254, 1549, 7334, 9, 7043, 1621, 1821, 9683, 5738, 1634, 2334, 199, 3, 4815, 1634, 5749, 4141, 12, 9704, 8036, 9691, 1634, 2334, 9726, 1634, 9712, 9784, 14, 199, 3, 199, 199, 646, 2022, 199, 646, 295, 199, 199, 504, 3242, 14, 578, 63, 1208, 14, 4316, 492, 2589, 63, 10538, 421, 199, 533, 4094, 4936, 8, 785, 304, 339, 347, 636, 826, 721, 277, 12, 3503, 12, 1890, 12, 2225, 63, 1459, 63, 807, 12, 1586, 952, 63, 3288, 12, 18501, 10324, 6863, 63, 3288, 6034, 17092, 63, 3288, 6034, 2022, 63, 2143, 83, 17894, 398, 327, 18982, 1061, 1101, 909, 687, 20107, 13628, 267, 291, 14, 6514, 275, 3503, 398, 327, 20107, 1890, 267, 291, 14, 1258, 275, 1890, 398, 327, 3242, 2225, 63, 1459, 63, 807, 267, 291, 14, 3215, 63, 1459, 63, 807, 275, 2225, 63, 1459, 63, 807, 398, 291, 14, 24044, 63, 3288, 275, 1586, 952, 63, 3288, 267, 291, 14, 6753, 63, 3288, 275, 6863, 63, 3288, 267, 291, 14, 17836, 63, 3288, 275, 17092, 63, 3288, 267, 291, 14, 1001, 63, 2143, 83, 275, 2022, 63, 2143, 83, 267, 291, 14, 15133, 275, 18501, 398, 291, 14, 3215, 63, 1459, 63, 7292, 275, 1052, 267, 367, 2225, 12, 574, 315, 291, 14, 3215, 63, 1459, 63, 807, 14, 1744, 837, 288, 340, 2225, 315, 18501, 26, 355, 367, 5793, 315, 291, 14, 15133, 59, 3215, 2189, 490, 340, 5793, 508, 283, 2245, 63, 5066, 63, 889, 356, 717, 574, 275, 283, 15641, 7, 340, 574, 365, 715, 587, 283, 2826, 7, 490, 916, 5793, 508, 283, 2245, 63, 265, 63, 1997, 356, 717, 574, 275, 283, 615, 7, 340, 574, 365, 715, 587, 283, 7517, 7, 490, 916, 4550, 8, 4711, 304, 717, 574, 275, 5793, 8, 585, 9, 490, 587, 26, 717, 746, 2186, 360, 3364, 5793, 450, 83, 7, 450, 5793, 9, 288, 291, 14, 3215, 63, 1459, 63, 7292, 59, 3215, 61, 275, 574, 398, 291, 423, 1574, 63, 2987, 63, 475, 63, 6514, 342, 339, 347, 485, 1574, 63, 2987, 63, 475, 63, 6514, 8, 277, 304, 267, 367, 2225, 315, 291, 14, 24044, 63, 3288, 26, 288, 340, 2225, 315, 291, 14, 3215, 63, 1459, 63, 7292, 26, 355, 2225, 63, 585, 275, 291, 14, 3215, 63, 1459, 63, 7292, 59, 3215, 61, 2234, 340, 2225, 63, 585, 365, 488, 26, 490, 1980, 2234, 327, 481, 452, 8304, 355, 340, 2225, 315, 291, 14, 1001, 63, 2143, 83, 26, 490, 2225, 63, 585, 275, 2022, 14, 23069, 1252, 2143, 8, 3215, 63, 585, 680, 1913, 25441, 355, 5371, 8, 277, 14, 6514, 12, 2225, 12, 2225, 63, 585, 9, 339, 347, 636, 5675, 721, 277, 12, 536, 304, 267, 340, 536, 315, 291, 14, 3215, 63, 1459, 63, 807, 26, 288, 372, 291, 14, 3215, 63, 1459, 63, 807, 59, 354, 61, 267, 587, 26, 288, 746, 4281, 360, 1944, 2225, 450, 83, 1911, 7, 450, 536, 9, 339, 347, 1050, 8, 277, 304, 267, 291, 14, 6514, 855, 533, 4343, 525, 8, 277, 14, 1258, 12, 291, 14, 6514, 9, 339, 347, 1678, 8, 277, 304, 267, 372, 291, 14, 6514, 855, 533, 4343, 873, 8, 277, 14, 1258, 12, 291, 14, 6514, 9, 339, 347, 3145, 8, 277, 304, 267, 291, 14, 6514, 855, 533, 4343, 1807, 8, 277, 14, 1258, 12, 291, 14, 6514, 9, 339, 347, 664, 8, 277, 12, 627, 589, 12, 1011, 958, 304, 267, 754, 275, 291, 14, 6514, 855, 533, 4343, 362, 8, 277, 14, 1258, 12, 627, 589, 12, 1011, 958, 9, 398, 372, 754, 339, 347, 965, 63, 1452, 63, 2987, 8, 277, 12, 1163, 304, 267, 340, 291, 14, 3028, 63, 785, 8, 1848, 9, 508, 24702, 288, 372, 715, 267, 587, 26, 288, 372, 756, 339, 347, 3915, 63, 785, 8, 277, 12, 1163, 304, 267, 3915, 63, 807, 275, 1052, 267, 367, 2225, 315, 291, 14, 3215, 63, 1459, 63, 7292, 26, 288, 327, 8232, 6863, 3004, 288, 340, 2225, 440, 315, 291, 14, 24044, 63, 3288, 26, 355, 1980, 953, 327, 8232, 3004, 440, 3451, 315, 859, 2368, 288, 340, 291, 14, 3215, 63, 1459, 63, 7292, 59, 0 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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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 ]
kronicz/ecommerce-2
lib/python2.7/site-packages/django/contrib/gis/geos/prototypes/predicates.py
103
1794
""" This module houses the GEOS ctypes prototype functions for the unary and binary predicate operations on geometries. """ from ctypes import c_char, c_char_p, c_double from django.contrib.gis.geos.libgeos import GEOM_PTR from django.contrib.gis.geos.prototypes.errcheck import check_predicate from django.contrib.gis.geos.prototypes.threadsafe import GEOSFunc # ## Binary & unary predicate functions ## def binary_predicate(func, *args): "For GEOS binary predicate functions." argtypes = [GEOM_PTR, GEOM_PTR] if args: argtypes += args func.argtypes = argtypes func.restype = c_char func.errcheck = check_predicate return func def unary_predicate(func): "For GEOS unary predicate functions." func.argtypes = [GEOM_PTR] func.restype = c_char func.errcheck = check_predicate return func # ## Unary Predicates ## geos_hasz = unary_predicate(GEOSFunc('GEOSHasZ')) geos_isempty = unary_predicate(GEOSFunc('GEOSisEmpty')) geos_isring = unary_predicate(GEOSFunc('GEOSisRing')) geos_issimple = unary_predicate(GEOSFunc('GEOSisSimple')) geos_isvalid = unary_predicate(GEOSFunc('GEOSisValid')) # ## Binary Predicates ## geos_contains = binary_predicate(GEOSFunc('GEOSContains')) geos_crosses = binary_predicate(GEOSFunc('GEOSCrosses')) geos_disjoint = binary_predicate(GEOSFunc('GEOSDisjoint')) geos_equals = binary_predicate(GEOSFunc('GEOSEquals')) geos_equalsexact = binary_predicate(GEOSFunc('GEOSEqualsExact'), c_double) geos_intersects = binary_predicate(GEOSFunc('GEOSIntersects')) geos_overlaps = binary_predicate(GEOSFunc('GEOSOverlaps')) geos_relatepattern = binary_predicate(GEOSFunc('GEOSRelatePattern'), c_char_p) geos_touches = binary_predicate(GEOSFunc('GEOSTouches')) geos_within = binary_predicate(GEOSFunc('GEOSWithin'))
mit
[ 624, 199, 961, 859, 394, 810, 874, 314, 11920, 5577, 19393, 3423, 367, 314, 199, 21603, 436, 3366, 11944, 5331, 641, 24883, 14, 199, 624, 199, 504, 5577, 492, 286, 63, 1560, 12, 286, 63, 1560, 63, 80, 12, 286, 63, 3157, 199, 199, 504, 1639, 14, 2828, 14, 5668, 14, 12151, 14, 773, 12151, 492, 8991, 7474, 63, 14528, 199, 504, 1639, 14, 2828, 14, 5668, 14, 12151, 14, 16141, 83, 14, 21205, 492, 1104, 63, 14463, 199, 504, 1639, 14, 2828, 14, 5668, 14, 12151, 14, 16141, 83, 14, 2671, 3489, 492, 11920, 7465, 421, 199, 3, 925, 14161, 1253, 21603, 11944, 3423, 925, 199, 318, 3366, 63, 14463, 8, 1532, 12, 627, 589, 304, 272, 298, 1858, 11920, 3366, 11944, 3423, 2122, 272, 29669, 275, 359, 31080, 63, 14528, 12, 8991, 7474, 63, 14528, 61, 272, 340, 1249, 26, 267, 29669, 847, 1249, 272, 2562, 14, 10025, 275, 29669, 272, 2562, 14, 9990, 275, 286, 63, 1560, 272, 2562, 14, 21205, 275, 1104, 63, 14463, 272, 372, 2562, 421, 199, 318, 21603, 63, 14463, 8, 1532, 304, 272, 298, 1858, 11920, 21603, 11944, 3423, 2122, 272, 2562, 14, 10025, 275, 359, 31080, 63, 14528, 61, 272, 2562, 14, 9990, 275, 286, 63, 1560, 272, 2562, 14, 21205, 275, 1104, 63, 14463, 272, 372, 2562, 199, 199, 3, 925, 1910, 695, 5543, 16292, 925, 199, 12151, 63, 1989, 90, 275, 21603, 63, 14463, 8, 31887, 360, 14151, 6362, 58, 1333, 199, 12151, 63, 572, 1171, 275, 21603, 63, 14463, 8, 31887, 360, 14151, 374, 4699, 1333, 199, 12151, 63, 374, 5985, 275, 21603, 63, 14463, 8, 31887, 360, 14151, 374, 15420, 1333, 199, 12151, 63, 374, 4129, 275, 21603, 63, 14463, 8, 31887, 360, 14151, 374, 3184, 1333, 199, 12151, 63, 374, 1078, 275, 21603, 63, 14463, 8, 31887, 360, 14151, 18728, 1333, 199, 199, 3, 925, 14161, 5543, 16292, 925, 199, 12151, 63, 6134, 275, 3366, 63, 14463, 8, 31887, 360, 14151, 6906, 1333, 199, 12151, 63, 20363, 874, 275, 3366, 63, 14463, 8, 31887, 360, 14151, 35, 4796, 874, 1333, 199, 12151, 63, 31880, 275, 3366, 63, 14463, 8, 31887, 360, 14151, 2825, 10153, 1333, 199, 12151, 63, 11332, 275, 3366, 63, 14463, 8, 31887, 360, 14151, 13317, 1333, 199, 12151, 63, 15788, 535, 1800, 319, 275, 3366, 63, 14463, 8, 31887, 360, 14151, 13317, 29751, 659, 286, 63, 3157, 9, 199, 12151, 63, 1058, 25353, 275, 3366, 63, 14463, 8, 31887, 360, 14151, 2620, 25353, 1333, 199, 12151, 63, 20798, 275, 3366, 63, 14463, 8, 31887, 360, 14151, 5674, 13719, 1333, 199, 12151, 63, 17322, 3401, 275, 3366, 63, 14463, 8, 31887, 360, 14151, 5640, 323, 9959, 659, 286, 63, 1560, 63, 80, 9, 199, 12151, 63, 12376, 397, 275, 3366, 63, 14463, 8, 31887, 360, 18120, 840, 810, 12253, 1333, 199, 12151, 63, 12541, 275, 3366, 63, 14463, 8, 31887, 360, 14151, 3007, 262, 1333, 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 ]
[ 199, 961, 859, 394, 810, 874, 314, 11920, 5577, 19393, 3423, 367, 314, 199, 21603, 436, 3366, 11944, 5331, 641, 24883, 14, 199, 624, 199, 504, 5577, 492, 286, 63, 1560, 12, 286, 63, 1560, 63, 80, 12, 286, 63, 3157, 199, 199, 504, 1639, 14, 2828, 14, 5668, 14, 12151, 14, 773, 12151, 492, 8991, 7474, 63, 14528, 199, 504, 1639, 14, 2828, 14, 5668, 14, 12151, 14, 16141, 83, 14, 21205, 492, 1104, 63, 14463, 199, 504, 1639, 14, 2828, 14, 5668, 14, 12151, 14, 16141, 83, 14, 2671, 3489, 492, 11920, 7465, 421, 199, 3, 925, 14161, 1253, 21603, 11944, 3423, 925, 199, 318, 3366, 63, 14463, 8, 1532, 12, 627, 589, 304, 272, 298, 1858, 11920, 3366, 11944, 3423, 2122, 272, 29669, 275, 359, 31080, 63, 14528, 12, 8991, 7474, 63, 14528, 61, 272, 340, 1249, 26, 267, 29669, 847, 1249, 272, 2562, 14, 10025, 275, 29669, 272, 2562, 14, 9990, 275, 286, 63, 1560, 272, 2562, 14, 21205, 275, 1104, 63, 14463, 272, 372, 2562, 421, 199, 318, 21603, 63, 14463, 8, 1532, 304, 272, 298, 1858, 11920, 21603, 11944, 3423, 2122, 272, 2562, 14, 10025, 275, 359, 31080, 63, 14528, 61, 272, 2562, 14, 9990, 275, 286, 63, 1560, 272, 2562, 14, 21205, 275, 1104, 63, 14463, 272, 372, 2562, 199, 199, 3, 925, 1910, 695, 5543, 16292, 925, 199, 12151, 63, 1989, 90, 275, 21603, 63, 14463, 8, 31887, 360, 14151, 6362, 58, 1333, 199, 12151, 63, 572, 1171, 275, 21603, 63, 14463, 8, 31887, 360, 14151, 374, 4699, 1333, 199, 12151, 63, 374, 5985, 275, 21603, 63, 14463, 8, 31887, 360, 14151, 374, 15420, 1333, 199, 12151, 63, 374, 4129, 275, 21603, 63, 14463, 8, 31887, 360, 14151, 374, 3184, 1333, 199, 12151, 63, 374, 1078, 275, 21603, 63, 14463, 8, 31887, 360, 14151, 18728, 1333, 199, 199, 3, 925, 14161, 5543, 16292, 925, 199, 12151, 63, 6134, 275, 3366, 63, 14463, 8, 31887, 360, 14151, 6906, 1333, 199, 12151, 63, 20363, 874, 275, 3366, 63, 14463, 8, 31887, 360, 14151, 35, 4796, 874, 1333, 199, 12151, 63, 31880, 275, 3366, 63, 14463, 8, 31887, 360, 14151, 2825, 10153, 1333, 199, 12151, 63, 11332, 275, 3366, 63, 14463, 8, 31887, 360, 14151, 13317, 1333, 199, 12151, 63, 15788, 535, 1800, 319, 275, 3366, 63, 14463, 8, 31887, 360, 14151, 13317, 29751, 659, 286, 63, 3157, 9, 199, 12151, 63, 1058, 25353, 275, 3366, 63, 14463, 8, 31887, 360, 14151, 2620, 25353, 1333, 199, 12151, 63, 20798, 275, 3366, 63, 14463, 8, 31887, 360, 14151, 5674, 13719, 1333, 199, 12151, 63, 17322, 3401, 275, 3366, 63, 14463, 8, 31887, 360, 14151, 5640, 323, 9959, 659, 286, 63, 1560, 63, 80, 9, 199, 12151, 63, 12376, 397, 275, 3366, 63, 14463, 8, 31887, 360, 18120, 840, 810, 12253, 1333, 199, 12151, 63, 12541, 275, 3366, 63, 14463, 8, 31887, 360, 14151, 3007, 262, 1333, 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, 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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0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
tommystendahl/cassandra
pylib/cqlshlib/helptopics.py
91
4532
# 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. class CQL3HelpTopics(object): def get_help_topics(self): return [t[5:] for t in dir(self) if t.startswith('help_')] def get_help_topic(self, topic): return getattr(self, 'help_' + topic.lower())() def help_types(self): return 'types' def help_timestamp(self): return 'usingtimestamps' def help_date(self): return 'usingdates' def help_time(self): return 'usingtime' def help_blob(self): return 'constants' def help_uuid(self): return 'constants' def help_boolean(self): return 'constants' def help_int(self): return 'constants' def help_counter(self): return 'counters' def help_text(self): return 'constants' help_ascii = help_text def help_use(self): return 'useStmt' def help_insert(self): return 'insertStmt' def help_update(self): return 'updateStmt' def help_delete(self): return 'deleteStmt' def help_select(self): return 'selectStmt' def help_json(self): return 'json' def help_select_json(self): return 'selectJson' def help_insert_json(self): return 'insertJson' def help_batch(self): return 'batchStmt' help_begin = help_batch help_apply = help_batch def help_create_keyspace(self): return 'createKeyspaceStmt' def help_alter_keyspace(self): return 'alterKeyspaceStmt' def help_drop_keyspace(self): return 'dropKeyspaceStmt' def help_create_table(self): return 'createTableStmt' help_create_columnfamily = help_create_table def help_alter_table(self): return 'alterTableStmt' def help_drop_table(self): return 'dropTableStmt' help_drop_columnfamily = help_drop_table def help_create_index(self): return 'createIndexStmt' def help_drop_index(self): return 'dropIndexStmt' def help_truncate(self): return 'truncateStmt' def help_create_type(self): return 'createTypeStmt' def help_alter_type(self): return 'alterTypeStmt' def help_drop_type(self): return 'dropTypeStmt' def help_create_function(self): return 'createFunctionStmt' def help_drop_function(self): return 'dropFunctionStmt' def help_functions(self): return 'functions' def help_create_aggregate(self): return 'createAggregateStmt' def help_drop_aggregate(self): return 'dropAggregateStmt' def help_aggregates(self): return 'aggregates' def help_create_trigger(self): return 'createTriggerStmt' def help_drop_trigger(self): return 'dropTriggerStmt' def help_create_materialized_view(self): return 'createMVStmt' def help_alter_materialized_view(self): return 'alterMVStmt' def help_drop_materialized_view(self): return 'dropMVStmt' def help_keywords(self): return 'appendixA' def help_create_user(self): return 'createUserStmt' def help_alter_user(self): return 'alterUserStmt' def help_drop_user(self): return 'dropUserStmt' def help_list_users(self): return 'listUsersStmt' def help_create_role(self): return 'createRoleStmt' def help_drop_role(self): return 'dropRoleStmt' def help_list_roles(self): return 'listRolesStmt' def help_permissions(self): return 'permissions' def help_list_permissions(self): return 'listPermissionsStmt' def help_grant(self): return 'grantRoleStmt' def help_revoke(self): return 'revokeRoleStmt'
apache-2.0
[ 3, 3909, 370, 314, 3668, 2290, 2752, 334, 14950, 9, 1334, 1373, 199, 3, 503, 1655, 11615, 4190, 14024, 14, 221, 1666, 314, 12840, 570, 199, 3, 1854, 543, 642, 1736, 367, 4722, 2556, 199, 3, 12602, 4248, 12715, 14, 221, 710, 14857, 12378, 642, 570, 199, 3, 370, 1265, 1334, 314, 3668, 844, 12, 3394, 499, 14, 16, 334, 1589, 199, 3, 298, 3761, 3547, 1265, 1443, 440, 675, 642, 570, 871, 315, 4151, 199, 3, 543, 314, 844, 14, 221, 2047, 1443, 3332, 282, 1331, 402, 314, 844, 737, 199, 3, 199, 3, 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, 421, 199, 533, 445, 2940, 19, 8673, 6105, 2932, 8, 785, 304, 272, 347, 664, 63, 3437, 63, 11299, 8, 277, 304, 267, 372, 359, 84, 59, 21, 2938, 367, 307, 315, 2935, 8, 277, 9, 340, 307, 14, 2460, 360, 3437, 63, 5440, 339, 347, 664, 63, 3437, 63, 5746, 8, 277, 12, 7482, 304, 267, 372, 2519, 8, 277, 12, 283, 3437, 8650, 435, 7482, 14, 2325, 1012, 342, 339, 347, 1720, 63, 1313, 8, 277, 304, 267, 372, 283, 1313, 7, 339, 347, 1720, 63, 3954, 8, 277, 304, 267, 372, 283, 4941, 25430, 7, 339, 347, 1720, 63, 602, 8, 277, 304, 267, 372, 283, 4941, 9356, 7, 339, 347, 1720, 63, 521, 8, 277, 304, 267, 372, 283, 4941, 521, 7, 339, 347, 1720, 63, 6582, 8, 277, 304, 267, 372, 283, 5559, 7, 339, 347, 1720, 63, 2580, 8, 277, 304, 267, 372, 283, 5559, 7, 339, 347, 1720, 63, 4871, 8, 277, 304, 267, 372, 283, 5559, 7, 339, 347, 1720, 63, 442, 8, 277, 304, 267, 372, 283, 5559, 7, 339, 347, 1720, 63, 5337, 8, 277, 304, 267, 372, 283, 16558, 7, 339, 347, 1720, 63, 505, 8, 277, 304, 267, 372, 283, 5559, 7, 272, 1720, 63, 4371, 275, 1720, 63, 505, 339, 347, 1720, 63, 1180, 8, 277, 304, 267, 372, 283, 1180, 32431, 7, 339, 347, 1720, 63, 3176, 8, 277, 304, 267, 372, 283, 3176, 32431, 7, 339, 347, 1720, 63, 873, 8, 277, 304, 267, 372, 283, 873, 32431, 7, 339, 347, 1720, 63, 1807, 8, 277, 304, 267, 372, 283, 1807, 32431, 7, 339, 347, 1720, 63, 2416, 8, 277, 304, 267, 372, 283, 2416, 32431, 7, 339, 347, 1720, 63, 1001, 8, 277, 304, 267, 372, 283, 1001, 7, 339, 347, 1720, 63, 2416, 63, 1001, 8, 277, 304, 267, 372, 283, 2416, 9653, 7, 339, 347, 1720, 63, 3176, 63, 1001, 8, 277, 304, 267, 372, 283, 3176, 9653, 7, 339, 347, 1720, 63, 2912, 8, 277, 304, 267, 372, 283, 2912, 32431, 7, 272, 1720, 63, 5037, 275, 1720, 63, 2912, 272, 1720, 63, 4998, 275, 1720, 63, 2912, 339, 347, 1720, 63, 981, 63, 16365, 8, 277, 304, 267, 372, 283, 981, 6340, 1142, 32431, 7, 339, 347, 1720, 63, 11858, 63, 16365, 8, 277, 304, 267, 372, 283, 11858, 6340, 1142, 32431, 7, 339, 347, 1720, 63, 4824, 63, 16365, 8, 277, 304, 267, 372, 283, 4824, 6340, 1142, 32431, 7, 339, 347, 1720, 63, 981, 63, 1224, 8, 277, 304, 267, 372, 283, 981, 3186, 32431, 7, 272, 1720, 63, 981, 63, 2301, 6606, 275, 1720, 63, 981, 63, 1224, 339, 347, 1720, 63, 11858, 63, 1224, 8, 277, 304, 267, 372, 283, 11858, 3186, 32431, 7, 339, 347, 1720, 63, 4824, 63, 1224, 8, 277, 304, 267, 372, 283, 4824, 3186, 32431, 7, 272, 1720, 63, 4824, 63, 2301, 6606, 275, 1720, 63, 4824, 63, 1224, 339, 347, 1720, 63, 981, 63, 1080, 8, 277, 304, 267, 372, 283, 981, 2681, 32431, 7, 339, 347, 1720, 63, 4824, 63, 1080, 8, 277, 304, 267, 372, 283, 4824, 2681, 32431, 7, 339, 347, 1720, 63, 12517, 8, 277, 304, 267, 372, 283, 12517, 32431, 7, 339, 347, 1720, 63, 981, 63, 466, 8, 277, 304, 267, 372, 283, 981, 804, 32431, 7, 339, 347, 1720, 63, 11858, 63, 466, 8, 277, 304, 267, 372, 283, 11858, 804, 32431, 7, 339, 347, 1720, 63, 4824, 63, 466, 8, 277, 304, 267, 372, 283, 4824, 804, 32431, 7, 339, 347, 1720, 63, 981, 63, 1593, 8, 277, 304, 267, 372, 283, 981, 3481, 32431, 7, 339, 347, 1720, 63, 4824, 63, 1593, 8, 277, 304, 267, 372, 283, 4824, 3481, 32431, 7, 339, 347, 1720, 63, 5777, 8, 277, 304, 267, 372, 283, 5777, 7, 339, 347, 1720, 63, 981, 63, 7516, 8, 277, 304, 267, 372, 283, 981, 10170, 32431, 7, 339, 347, 1720, 63, 4824, 63, 7516, 8, 277, 304, 267, 372, 283, 4824, 10170, 32431, 7, 339, 347, 1720, 63, 21622, 8, 277, 304, 267, 372, 283, 21622, 7, 339, 347, 1720, 63, 981, 63, 7631, 8, 277, 304, 267, 372, 283, 981, 16276, 32431, 7, 339, 347, 1720, 63, 4824, 63, 7631, 8, 277, 304, 267, 372, 283, 4824, 16276, 32431, 7, 339, 347, 1720, 63, 981, 63, 9820, 1759, 63, 1345, 8, 277, 304, 267, 372, 283, 981, 25875, 32431, 7, 339, 347, 1720, 63, 11858, 63, 9820, 1759, 63, 1345, 8, 277, 304, 267, 372, 283, 11858, 25875, 32431, 7, 339, 347, 1720, 63, 4824, 63, 9820, 1759, 63, 1345, 8, 277, 304, 267, 372, 283, 4824, 25875, 32431, 7, 339, 347, 1720, 63, 7511, 8, 277, 304, 267, 372, 283, 5435, 328, 7471, 7, 339, 347, 1720, 63, 981, 63, 751, 8, 277, 304, 267, 372, 283, 981, 1899, 32431, 7, 339, 347, 1720, 63, 11858, 63, 751, 8, 277, 304, 267, 372, 283, 11858, 1899, 32431, 7, 339, 347, 1720, 63, 4824, 63, 751, 8, 277, 304, 267, 372, 283, 4824, 1899, 32431, 7, 339, 347, 1720, 63, 513, 63 ]
[ 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, 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, 421, 199, 533, 445, 2940, 19, 8673, 6105, 2932, 8, 785, 304, 272, 347, 664, 63, 3437, 63, 11299, 8, 277, 304, 267, 372, 359, 84, 59, 21, 2938, 367, 307, 315, 2935, 8, 277, 9, 340, 307, 14, 2460, 360, 3437, 63, 5440, 339, 347, 664, 63, 3437, 63, 5746, 8, 277, 12, 7482, 304, 267, 372, 2519, 8, 277, 12, 283, 3437, 8650, 435, 7482, 14, 2325, 1012, 342, 339, 347, 1720, 63, 1313, 8, 277, 304, 267, 372, 283, 1313, 7, 339, 347, 1720, 63, 3954, 8, 277, 304, 267, 372, 283, 4941, 25430, 7, 339, 347, 1720, 63, 602, 8, 277, 304, 267, 372, 283, 4941, 9356, 7, 339, 347, 1720, 63, 521, 8, 277, 304, 267, 372, 283, 4941, 521, 7, 339, 347, 1720, 63, 6582, 8, 277, 304, 267, 372, 283, 5559, 7, 339, 347, 1720, 63, 2580, 8, 277, 304, 267, 372, 283, 5559, 7, 339, 347, 1720, 63, 4871, 8, 277, 304, 267, 372, 283, 5559, 7, 339, 347, 1720, 63, 442, 8, 277, 304, 267, 372, 283, 5559, 7, 339, 347, 1720, 63, 5337, 8, 277, 304, 267, 372, 283, 16558, 7, 339, 347, 1720, 63, 505, 8, 277, 304, 267, 372, 283, 5559, 7, 272, 1720, 63, 4371, 275, 1720, 63, 505, 339, 347, 1720, 63, 1180, 8, 277, 304, 267, 372, 283, 1180, 32431, 7, 339, 347, 1720, 63, 3176, 8, 277, 304, 267, 372, 283, 3176, 32431, 7, 339, 347, 1720, 63, 873, 8, 277, 304, 267, 372, 283, 873, 32431, 7, 339, 347, 1720, 63, 1807, 8, 277, 304, 267, 372, 283, 1807, 32431, 7, 339, 347, 1720, 63, 2416, 8, 277, 304, 267, 372, 283, 2416, 32431, 7, 339, 347, 1720, 63, 1001, 8, 277, 304, 267, 372, 283, 1001, 7, 339, 347, 1720, 63, 2416, 63, 1001, 8, 277, 304, 267, 372, 283, 2416, 9653, 7, 339, 347, 1720, 63, 3176, 63, 1001, 8, 277, 304, 267, 372, 283, 3176, 9653, 7, 339, 347, 1720, 63, 2912, 8, 277, 304, 267, 372, 283, 2912, 32431, 7, 272, 1720, 63, 5037, 275, 1720, 63, 2912, 272, 1720, 63, 4998, 275, 1720, 63, 2912, 339, 347, 1720, 63, 981, 63, 16365, 8, 277, 304, 267, 372, 283, 981, 6340, 1142, 32431, 7, 339, 347, 1720, 63, 11858, 63, 16365, 8, 277, 304, 267, 372, 283, 11858, 6340, 1142, 32431, 7, 339, 347, 1720, 63, 4824, 63, 16365, 8, 277, 304, 267, 372, 283, 4824, 6340, 1142, 32431, 7, 339, 347, 1720, 63, 981, 63, 1224, 8, 277, 304, 267, 372, 283, 981, 3186, 32431, 7, 272, 1720, 63, 981, 63, 2301, 6606, 275, 1720, 63, 981, 63, 1224, 339, 347, 1720, 63, 11858, 63, 1224, 8, 277, 304, 267, 372, 283, 11858, 3186, 32431, 7, 339, 347, 1720, 63, 4824, 63, 1224, 8, 277, 304, 267, 372, 283, 4824, 3186, 32431, 7, 272, 1720, 63, 4824, 63, 2301, 6606, 275, 1720, 63, 4824, 63, 1224, 339, 347, 1720, 63, 981, 63, 1080, 8, 277, 304, 267, 372, 283, 981, 2681, 32431, 7, 339, 347, 1720, 63, 4824, 63, 1080, 8, 277, 304, 267, 372, 283, 4824, 2681, 32431, 7, 339, 347, 1720, 63, 12517, 8, 277, 304, 267, 372, 283, 12517, 32431, 7, 339, 347, 1720, 63, 981, 63, 466, 8, 277, 304, 267, 372, 283, 981, 804, 32431, 7, 339, 347, 1720, 63, 11858, 63, 466, 8, 277, 304, 267, 372, 283, 11858, 804, 32431, 7, 339, 347, 1720, 63, 4824, 63, 466, 8, 277, 304, 267, 372, 283, 4824, 804, 32431, 7, 339, 347, 1720, 63, 981, 63, 1593, 8, 277, 304, 267, 372, 283, 981, 3481, 32431, 7, 339, 347, 1720, 63, 4824, 63, 1593, 8, 277, 304, 267, 372, 283, 4824, 3481, 32431, 7, 339, 347, 1720, 63, 5777, 8, 277, 304, 267, 372, 283, 5777, 7, 339, 347, 1720, 63, 981, 63, 7516, 8, 277, 304, 267, 372, 283, 981, 10170, 32431, 7, 339, 347, 1720, 63, 4824, 63, 7516, 8, 277, 304, 267, 372, 283, 4824, 10170, 32431, 7, 339, 347, 1720, 63, 21622, 8, 277, 304, 267, 372, 283, 21622, 7, 339, 347, 1720, 63, 981, 63, 7631, 8, 277, 304, 267, 372, 283, 981, 16276, 32431, 7, 339, 347, 1720, 63, 4824, 63, 7631, 8, 277, 304, 267, 372, 283, 4824, 16276, 32431, 7, 339, 347, 1720, 63, 981, 63, 9820, 1759, 63, 1345, 8, 277, 304, 267, 372, 283, 981, 25875, 32431, 7, 339, 347, 1720, 63, 11858, 63, 9820, 1759, 63, 1345, 8, 277, 304, 267, 372, 283, 11858, 25875, 32431, 7, 339, 347, 1720, 63, 4824, 63, 9820, 1759, 63, 1345, 8, 277, 304, 267, 372, 283, 4824, 25875, 32431, 7, 339, 347, 1720, 63, 7511, 8, 277, 304, 267, 372, 283, 5435, 328, 7471, 7, 339, 347, 1720, 63, 981, 63, 751, 8, 277, 304, 267, 372, 283, 981, 1899, 32431, 7, 339, 347, 1720, 63, 11858, 63, 751, 8, 277, 304, 267, 372, 283, 11858, 1899, 32431, 7, 339, 347, 1720, 63, 4824, 63, 751, 8, 277, 304, 267, 372, 283, 4824, 1899, 32431, 7, 339, 347, 1720, 63, 513, 63, 0 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
big-pegasus/spark
python/pyspark/ml/__init__.py
46
1105
# # 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. # """ DataFrame-based machine learning APIs to let users quickly assemble and configure practical machine learning pipelines. """ from pyspark.ml.base import Estimator, Model, Transformer from pyspark.ml.pipeline import Pipeline, PipelineModel __all__ = ["Transformer", "Estimator", "Model", "Pipeline", "PipelineModel"]
apache-2.0
[ 3, 199, 3, 3909, 370, 314, 3668, 2290, 2752, 334, 14950, 9, 1334, 1373, 503, 1655, 199, 3, 11615, 4190, 14024, 14, 221, 1666, 314, 12840, 570, 1854, 543, 199, 3, 642, 1736, 367, 4722, 2556, 12602, 4248, 12715, 14, 199, 3, 710, 14857, 12378, 642, 570, 370, 2047, 1334, 314, 3668, 844, 12, 3394, 499, 14, 16, 199, 3, 334, 1589, 298, 3761, 3547, 1265, 1443, 440, 675, 642, 570, 871, 315, 4151, 543, 199, 3, 314, 844, 14, 221, 2047, 1443, 3332, 282, 1331, 402, 314, 844, 737, 199, 3, 199, 3, 259, 1455, 921, 1544, 14, 3796, 14, 1308, 15, 2383, 15, 3961, 13, 18, 14, 16, 199, 3, 199, 3, 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, 624, 199, 9205, 13, 6788, 6844, 9328, 15913, 370, 4691, 4390, 23661, 22931, 436, 7908, 20594, 3294, 199, 6744, 9328, 5200, 1278, 14, 199, 624, 199, 504, 15847, 14, 757, 14, 1095, 492, 28992, 12, 5822, 12, 30486, 199, 504, 15847, 14, 757, 14, 7379, 492, 19090, 12, 19090, 1685, 199, 199, 363, 452, 363, 275, 2097, 19761, 401, 298, 13183, 401, 298, 1685, 401, 298, 17562, 401, 298, 17562, 1685, 937, 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 ]
[ 199, 3, 3909, 370, 314, 3668, 2290, 2752, 334, 14950, 9, 1334, 1373, 503, 1655, 199, 3, 11615, 4190, 14024, 14, 221, 1666, 314, 12840, 570, 1854, 543, 199, 3, 642, 1736, 367, 4722, 2556, 12602, 4248, 12715, 14, 199, 3, 710, 14857, 12378, 642, 570, 370, 2047, 1334, 314, 3668, 844, 12, 3394, 499, 14, 16, 199, 3, 334, 1589, 298, 3761, 3547, 1265, 1443, 440, 675, 642, 570, 871, 315, 4151, 543, 199, 3, 314, 844, 14, 221, 2047, 1443, 3332, 282, 1331, 402, 314, 844, 737, 199, 3, 199, 3, 259, 1455, 921, 1544, 14, 3796, 14, 1308, 15, 2383, 15, 3961, 13, 18, 14, 16, 199, 3, 199, 3, 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, 624, 199, 9205, 13, 6788, 6844, 9328, 15913, 370, 4691, 4390, 23661, 22931, 436, 7908, 20594, 3294, 199, 6744, 9328, 5200, 1278, 14, 199, 624, 199, 504, 15847, 14, 757, 14, 1095, 492, 28992, 12, 5822, 12, 30486, 199, 504, 15847, 14, 757, 14, 7379, 492, 19090, 12, 19090, 1685, 199, 199, 363, 452, 363, 275, 2097, 19761, 401, 298, 13183, 401, 298, 1685, 401, 298, 17562, 401, 298, 17562, 1685, 937, 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, 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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0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
p/webracer
tests/request_via_form_test.py
1
1451
import webracer import nose.plugins.attrib from . import utils from .apps import form_app utils.app_runner_setup(__name__, form_app.app, 8059) @nose.plugins.attrib.attr('client') @webracer.config(host='localhost', port=8059) class RequestViaFormTest(webracer.WebTestCase): def test_get_form_as_url(self): self.get('/method_check_form') self.assert_status(200) form = self.response.form() self.get(form) self.assertEqual('GET', self.response.body) def test_post_form_as_url(self): self.get('/textarea') self.assert_status(200) form = self.response.form() self.post(form) self.assertEqual('{}', self.response.body) def test_post_form_with_elements(self): self.get('/textarea') self.assert_status(200) form = self.response.form() elements = form.elements self.post(form, elements) json = self.response.json self.assertEqual(dict(field='hello world'), json) def test_post_form_with_mutated_elements(self): self.get('/textarea') self.assert_status(200) form = self.response.form() elements = form.elements.mutable elements.set_value('field', 'changed') self.post(form, elements) json = self.response.json self.assertEqual(dict(field='changed'), json)
bsd-2-clause
[ 646, 3330, 345, 2247, 199, 646, 11354, 14, 5265, 14, 6640, 199, 504, 1275, 492, 3778, 199, 504, 1275, 5181, 492, 1824, 63, 571, 199, 199, 1208, 14, 571, 63, 5933, 63, 2758, 3460, 354, 3108, 1824, 63, 571, 14, 571, 12, 5939, 1427, 9, 199, 199, 32, 21085, 14, 5265, 14, 6640, 14, 962, 360, 1258, 358, 199, 32, 2520, 345, 2247, 14, 888, 8, 1102, 534, 5967, 297, 1844, 29, 1257, 1427, 9, 199, 533, 4784, 2201, 65, 2821, 774, 8, 2520, 345, 2247, 14, 5926, 1746, 304, 272, 347, 511, 63, 362, 63, 964, 63, 305, 63, 633, 8, 277, 304, 267, 291, 14, 362, 2336, 765, 63, 1074, 63, 964, 358, 267, 291, 14, 479, 63, 1205, 8, 1840, 9, 2728, 1824, 275, 291, 14, 1310, 14, 964, 342, 2728, 291, 14, 362, 8, 964, 9, 267, 291, 14, 629, 360, 2970, 297, 291, 14, 1310, 14, 2030, 9, 2286, 347, 511, 63, 1932, 63, 964, 63, 305, 63, 633, 8, 277, 304, 267, 291, 14, 362, 2336, 20895, 358, 267, 291, 14, 479, 63, 1205, 8, 1840, 9, 2728, 1824, 275, 291, 14, 1310, 14, 964, 342, 2728, 291, 14, 1932, 8, 964, 9, 267, 291, 14, 629, 17519, 297, 291, 14, 1310, 14, 2030, 9, 2286, 347, 511, 63, 1932, 63, 964, 63, 1045, 63, 5527, 8, 277, 304, 267, 291, 14, 362, 2336, 20895, 358, 267, 291, 14, 479, 63, 1205, 8, 1840, 9, 2728, 1824, 275, 291, 14, 1310, 14, 964, 342, 267, 4008, 275, 1824, 14, 5527, 2728, 291, 14, 1932, 8, 964, 12, 4008, 9, 267, 2022, 275, 291, 14, 1310, 14, 1001, 267, 291, 14, 629, 8, 807, 8, 698, 534, 5006, 6701, 659, 2022, 9, 2286, 347, 511, 63, 1932, 63, 964, 63, 1045, 63, 6552, 972, 63, 5527, 8, 277, 304, 267, 291, 14, 362, 2336, 20895, 358, 267, 291, 14, 479, 63, 1205, 8, 1840, 9, 2728, 1824, 275, 291, 14, 1310, 14, 964, 342, 267, 4008, 275, 1824, 14, 5527, 14, 17404, 267, 4008, 14, 409, 63, 585, 360, 698, 297, 283, 2489, 358, 2728, 291, 14, 1932, 8, 964, 12, 4008, 9, 267, 2022, 275, 291, 14, 1310, 14, 1001, 267, 291, 14, 629, 8, 807, 8, 698, 534, 2489, 659, 2022, 9, 199, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768 ]
[ 3330, 345, 2247, 199, 646, 11354, 14, 5265, 14, 6640, 199, 504, 1275, 492, 3778, 199, 504, 1275, 5181, 492, 1824, 63, 571, 199, 199, 1208, 14, 571, 63, 5933, 63, 2758, 3460, 354, 3108, 1824, 63, 571, 14, 571, 12, 5939, 1427, 9, 199, 199, 32, 21085, 14, 5265, 14, 6640, 14, 962, 360, 1258, 358, 199, 32, 2520, 345, 2247, 14, 888, 8, 1102, 534, 5967, 297, 1844, 29, 1257, 1427, 9, 199, 533, 4784, 2201, 65, 2821, 774, 8, 2520, 345, 2247, 14, 5926, 1746, 304, 272, 347, 511, 63, 362, 63, 964, 63, 305, 63, 633, 8, 277, 304, 267, 291, 14, 362, 2336, 765, 63, 1074, 63, 964, 358, 267, 291, 14, 479, 63, 1205, 8, 1840, 9, 2728, 1824, 275, 291, 14, 1310, 14, 964, 342, 2728, 291, 14, 362, 8, 964, 9, 267, 291, 14, 629, 360, 2970, 297, 291, 14, 1310, 14, 2030, 9, 2286, 347, 511, 63, 1932, 63, 964, 63, 305, 63, 633, 8, 277, 304, 267, 291, 14, 362, 2336, 20895, 358, 267, 291, 14, 479, 63, 1205, 8, 1840, 9, 2728, 1824, 275, 291, 14, 1310, 14, 964, 342, 2728, 291, 14, 1932, 8, 964, 9, 267, 291, 14, 629, 17519, 297, 291, 14, 1310, 14, 2030, 9, 2286, 347, 511, 63, 1932, 63, 964, 63, 1045, 63, 5527, 8, 277, 304, 267, 291, 14, 362, 2336, 20895, 358, 267, 291, 14, 479, 63, 1205, 8, 1840, 9, 2728, 1824, 275, 291, 14, 1310, 14, 964, 342, 267, 4008, 275, 1824, 14, 5527, 2728, 291, 14, 1932, 8, 964, 12, 4008, 9, 267, 2022, 275, 291, 14, 1310, 14, 1001, 267, 291, 14, 629, 8, 807, 8, 698, 534, 5006, 6701, 659, 2022, 9, 2286, 347, 511, 63, 1932, 63, 964, 63, 1045, 63, 6552, 972, 63, 5527, 8, 277, 304, 267, 291, 14, 362, 2336, 20895, 358, 267, 291, 14, 479, 63, 1205, 8, 1840, 9, 2728, 1824, 275, 291, 14, 1310, 14, 964, 342, 267, 4008, 275, 1824, 14, 5527, 14, 17404, 267, 4008, 14, 409, 63, 585, 360, 698, 297, 283, 2489, 358, 2728, 291, 14, 1932, 8, 964, 12, 4008, 9, 267, 2022, 275, 291, 14, 1310, 14, 1001, 267, 291, 14, 629, 8, 807, 8, 698, 534, 2489, 659, 2022, 9, 199, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 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, 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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 ]
m11s/MissionPlanner
Lib/urllib2.py
50
52574
"""An extensible library for opening URLs using a variety of protocols The simplest way to use this module is to call the urlopen function, which accepts a string containing a URL or a Request object (described below). It opens the URL and returns the results as file-like object; the returned object has some extra methods described below. The OpenerDirector manages a collection of Handler objects that do all the actual work. Each Handler implements a particular protocol or option. The OpenerDirector is a composite object that invokes the Handlers needed to open the requested URL. For example, the HTTPHandler performs HTTP GET and POST requests and deals with non-error returns. The HTTPRedirectHandler automatically deals with HTTP 301, 302, 303 and 307 redirect errors, and the HTTPDigestAuthHandler deals with digest authentication. urlopen(url, data=None) -- Basic usage is the same as original urllib. pass the url and optionally data to post to an HTTP URL, and get a file-like object back. One difference is that you can also pass a Request instance instead of URL. Raises a URLError (subclass of IOError); for HTTP errors, raises an HTTPError, which can also be treated as a valid response. build_opener -- Function that creates a new OpenerDirector instance. Will install the default handlers. Accepts one or more Handlers as arguments, either instances or Handler classes that it will instantiate. If one of the argument is a subclass of the default handler, the argument will be installed instead of the default. install_opener -- Installs a new opener as the default opener. objects of interest: OpenerDirector -- Sets up the User Agent as the Python-urllib client and manages the Handler classes, while dealing with requests and responses. Request -- An object that encapsulates the state of a request. The state can be as simple as the URL. It can also include extra HTTP headers, e.g. a User-Agent. BaseHandler -- exceptions: URLError -- A subclass of IOError, individual protocols have their own specific subclass. HTTPError -- Also a valid HTTP response, so you can treat an HTTP error as an exceptional event or valid response. internals: BaseHandler and parent _call_chain conventions Example usage: import urllib2 # set up authentication info authinfo = urllib2.HTTPBasicAuthHandler() authinfo.add_password(realm='PDQ Application', uri='https://mahler:8092/site-updates.py', user='klem', passwd='geheim$parole') proxy_support = urllib2.ProxyHandler({"http" : "http://ahad-haam:3128"}) # build a new opener that adds authentication and caching FTP handlers opener = urllib2.build_opener(proxy_support, authinfo, urllib2.CacheFTPHandler) # install it urllib2.install_opener(opener) f = urllib2.urlopen('http://www.python.org/') """ # XXX issues: # If an authentication error handler that tries to perform # authentication for some reason but fails, how should the error be # signalled? The client needs to know the HTTP error code. But if # the handler knows that the problem was, e.g., that it didn't know # that hash algo that requested in the challenge, it would be good to # pass that information along to the client, too. # ftp errors aren't handled cleanly # check digest against correct (i.e. non-apache) implementation # Possible extensions: # complex proxies XXX not sure what exactly was meant by this # abstract factory for opener import base64 import hashlib import httplib import mimetools import os import posixpath import random import re import socket import sys import time import urlparse import bisect try: from cStringIO import StringIO except ImportError: from StringIO import StringIO from urllib import (unwrap, unquote, splittype, splithost, quote, addinfourl, splitport, splittag, splitattr, ftpwrapper, splituser, splitpasswd, splitvalue) # support for FileHandler, proxies via environment variables from urllib import localhost, url2pathname, getproxies, proxy_bypass # used in User-Agent header sent __version__ = sys.version[:3] _opener = None def urlopen(url, data=None, timeout=socket._GLOBAL_DEFAULT_TIMEOUT): global _opener if _opener is None: _opener = build_opener() return _opener.open(url, data, timeout) def install_opener(opener): global _opener _opener = opener # do these error classes make sense? # make sure all of the IOError stuff is overridden. we just want to be # subtypes. class URLError(IOError): # URLError is a sub-type of IOError, but it doesn't share any of # the implementation. need to override __init__ and __str__. # It sets self.args for compatibility with other EnvironmentError # subclasses, but args doesn't have the typical format with errno in # slot 0 and strerror in slot 1. This may be better than nothing. def __init__(self, reason): self.args = reason, self.reason = reason def __str__(self): return '<urlopen error %s>' % self.reason class HTTPError(URLError, addinfourl): """Raised when HTTP error occurs, but also acts like non-error return""" __super_init = addinfourl.__init__ def __init__(self, url, code, msg, hdrs, fp): self.code = code self.msg = msg self.hdrs = hdrs self.fp = fp self.filename = url # The addinfourl classes depend on fp being a valid file # object. In some cases, the HTTPError may not have a valid # file object. If this happens, the simplest workaround is to # not initialize the base classes. if fp is not None: self.__super_init(fp, hdrs, url, code) def __str__(self): return 'HTTP Error %s: %s' % (self.code, self.msg) # copied from cookielib.py _cut_port_re = re.compile(r":\d+$") def request_host(request): """Return request-host, as defined by RFC 2965. Variation from RFC: returned value is lowercased, for convenient comparison. """ url = request.get_full_url() host = urlparse.urlparse(url)[1] if host == "": host = request.get_header("Host", "") # remove port, if present host = _cut_port_re.sub("", host, 1) return host.lower() class Request: def __init__(self, url, data=None, headers={}, origin_req_host=None, unverifiable=False): # unwrap('<URL:type://host/path>') --> 'type://host/path' self.__original = unwrap(url) self.__original, self.__fragment = splittag(self.__original) self.type = None # self.__r_type is what's left after doing the splittype self.host = None self.port = None self._tunnel_host = None self.data = data self.headers = {} for key, value in headers.items(): self.add_header(key, value) self.unredirected_hdrs = {} if origin_req_host is None: origin_req_host = request_host(self) self.origin_req_host = origin_req_host self.unverifiable = unverifiable def __getattr__(self, attr): # XXX this is a fallback mechanism to guard against these # methods getting called in a non-standard order. this may be # too complicated and/or unnecessary. # XXX should the __r_XXX attributes be public? if attr[:12] == '_Request__r_': name = attr[12:] if hasattr(Request, 'get_' + name): getattr(self, 'get_' + name)() return getattr(self, attr) raise AttributeError, attr def get_method(self): if self.has_data(): return "POST" else: return "GET" # XXX these helper methods are lame def add_data(self, data): self.data = data def has_data(self): return self.data is not None def get_data(self): return self.data def get_full_url(self): if self.__fragment: return '%s#%s' % (self.__original, self.__fragment) else: return self.__original def get_type(self): if self.type is None: self.type, self.__r_type = splittype(self.__original) if self.type is None: raise ValueError, "unknown url type: %s" % self.__original return self.type def get_host(self): if self.host is None: self.host, self.__r_host = splithost(self.__r_type) if self.host: self.host = unquote(self.host) return self.host def get_selector(self): return self.__r_host def set_proxy(self, host, type): if self.type == 'https' and not self._tunnel_host: self._tunnel_host = self.host else: self.type = type self.__r_host = self.__original self.host = host def has_proxy(self): return self.__r_host == self.__original def get_origin_req_host(self): return self.origin_req_host def is_unverifiable(self): return self.unverifiable def add_header(self, key, val): # useful for something like authentication self.headers[key.capitalize()] = val def add_unredirected_header(self, key, val): # will not be added to a redirected request self.unredirected_hdrs[key.capitalize()] = val def has_header(self, header_name): return (header_name in self.headers or header_name in self.unredirected_hdrs) def get_header(self, header_name, default=None): return self.headers.get( header_name, self.unredirected_hdrs.get(header_name, default)) def header_items(self): hdrs = self.unredirected_hdrs.copy() hdrs.update(self.headers) return hdrs.items() class OpenerDirector: def __init__(self): client_version = "Python-urllib/%s" % __version__ self.addheaders = [('User-agent', client_version)] # self.handlers is retained only for backward compatibility self.handlers = [] # manage the individual handlers self.handle_open = {} self.handle_error = {} self.process_response = {} self.process_request = {} def add_handler(self, handler): if not hasattr(handler, "add_parent"): raise TypeError("expected BaseHandler instance, got %r" % type(handler)) added = False for meth in dir(handler): if meth in ["redirect_request", "do_open", "proxy_open"]: # oops, coincidental match continue i = meth.find("_") protocol = meth[:i] condition = meth[i+1:] if condition.startswith("error"): j = condition.find("_") + i + 1 kind = meth[j+1:] try: kind = int(kind) except ValueError: pass lookup = self.handle_error.get(protocol, {}) self.handle_error[protocol] = lookup elif condition == "open": kind = protocol lookup = self.handle_open elif condition == "response": kind = protocol lookup = self.process_response elif condition == "request": kind = protocol lookup = self.process_request else: continue handlers = lookup.setdefault(kind, []) if handlers: bisect.insort(handlers, handler) else: handlers.append(handler) added = True if added: bisect.insort(self.handlers, handler) handler.add_parent(self) def close(self): # Only exists for backwards compatibility. pass def _call_chain(self, chain, kind, meth_name, *args): # Handlers raise an exception if no one else should try to handle # the request, or return None if they can't but another handler # could. Otherwise, they return the response. handlers = chain.get(kind, ()) for handler in handlers: func = getattr(handler, meth_name) result = func(*args) if result is not None: return result def open(self, fullurl, data=None, timeout=socket._GLOBAL_DEFAULT_TIMEOUT): # accept a URL or a Request object if isinstance(fullurl, basestring): req = Request(fullurl, data) else: req = fullurl if data is not None: req.add_data(data) req.timeout = timeout protocol = req.get_type() # pre-process request meth_name = protocol+"_request" for processor in self.process_request.get(protocol, []): meth = getattr(processor, meth_name) req = meth(req) response = self._open(req, data) # post-process response meth_name = protocol+"_response" for processor in self.process_response.get(protocol, []): meth = getattr(processor, meth_name) response = meth(req, response) return response def _open(self, req, data=None): result = self._call_chain(self.handle_open, 'default', 'default_open', req) if result: return result protocol = req.get_type() result = self._call_chain(self.handle_open, protocol, protocol + '_open', req) if result: return result return self._call_chain(self.handle_open, 'unknown', 'unknown_open', req) def error(self, proto, *args): if proto in ('http', 'https'): # XXX http[s] protocols are special-cased dict = self.handle_error['http'] # https is not different than http proto = args[2] # YUCK! meth_name = 'http_error_%s' % proto http_err = 1 orig_args = args else: dict = self.handle_error meth_name = proto + '_error' http_err = 0 args = (dict, proto, meth_name) + args result = self._call_chain(*args) if result: return result if http_err: args = (dict, 'default', 'http_error_default') + orig_args return self._call_chain(*args) # XXX probably also want an abstract factory that knows when it makes # sense to skip a superclass in favor of a subclass and when it might # make sense to include both def build_opener(*handlers): """Create an opener object from a list of handlers. The opener will use several default handlers, including support for HTTP, FTP and when applicable, HTTPS. If any of the handlers passed as arguments are subclasses of the default handlers, the default handlers will not be used. """ import types def isclass(obj): return isinstance(obj, (types.ClassType, type)) opener = OpenerDirector() default_classes = [ProxyHandler, UnknownHandler, HTTPHandler, HTTPDefaultErrorHandler, HTTPRedirectHandler, FTPHandler, FileHandler, HTTPErrorProcessor] if hasattr(httplib, 'HTTPS'): default_classes.append(HTTPSHandler) skip = set() for klass in default_classes: for check in handlers: if isclass(check): if issubclass(check, klass): skip.add(klass) elif isinstance(check, klass): skip.add(klass) for klass in skip: default_classes.remove(klass) for klass in default_classes: opener.add_handler(klass()) for h in handlers: if isclass(h): h = h() opener.add_handler(h) return opener class BaseHandler: handler_order = 500 def add_parent(self, parent): self.parent = parent def close(self): # Only exists for backwards compatibility pass def __lt__(self, other): if not hasattr(other, "handler_order"): # Try to preserve the old behavior of having custom classes # inserted after default ones (works only for custom user # classes which are not aware of handler_order). return True return self.handler_order < other.handler_order class HTTPErrorProcessor(BaseHandler): """Process HTTP error responses.""" handler_order = 1000 # after all other processing def http_response(self, request, response): code, msg, hdrs = response.code, response.msg, response.info() # According to RFC 2616, "2xx" code indicates that the client's # request was successfully received, understood, and accepted. if not (200 <= code < 300): response = self.parent.error( 'http', request, response, code, msg, hdrs) return response https_response = http_response class HTTPDefaultErrorHandler(BaseHandler): def http_error_default(self, req, fp, code, msg, hdrs): raise HTTPError(req.get_full_url(), code, msg, hdrs, fp) class HTTPRedirectHandler(BaseHandler): # maximum number of redirections to any single URL # this is needed because of the state that cookies introduce max_repeats = 4 # maximum total number of redirections (regardless of URL) before # assuming we're in a loop max_redirections = 10 def redirect_request(self, req, fp, code, msg, headers, newurl): """Return a Request or None in response to a redirect. This is called by the http_error_30x methods when a redirection response is received. If a redirection should take place, return a new Request to allow http_error_30x to perform the redirect. Otherwise, raise HTTPError if no-one else should try to handle this url. Return None if you can't but another Handler might. """ m = req.get_method() if (code in (301, 302, 303, 307) and m in ("GET", "HEAD") or code in (301, 302, 303) and m == "POST"): # Strictly (according to RFC 2616), 301 or 302 in response # to a POST MUST NOT cause a redirection without confirmation # from the user (of urllib2, in this case). In practice, # essentially all clients do redirect in this case, so we # do the same. # be conciliant with URIs containing a space newurl = newurl.replace(' ', '%20') newheaders = dict((k,v) for k,v in req.headers.items() if k.lower() not in ("content-length", "content-type") ) return Request(newurl, headers=newheaders, origin_req_host=req.get_origin_req_host(), unverifiable=True) else: raise HTTPError(req.get_full_url(), code, msg, headers, fp) # Implementation note: To avoid the server sending us into an # infinite loop, the request object needs to track what URLs we # have already seen. Do this by adding a handler-specific # attribute to the Request object. def http_error_302(self, req, fp, code, msg, headers): # Some servers (incorrectly) return multiple Location headers # (so probably same goes for URI). Use first header. if 'location' in headers: newurl = headers.getheaders('location')[0] elif 'uri' in headers: newurl = headers.getheaders('uri')[0] else: return # fix a possible malformed URL urlparts = urlparse.urlparse(newurl) if not urlparts.path: urlparts = list(urlparts) urlparts[2] = "/" newurl = urlparse.urlunparse(urlparts) newurl = urlparse.urljoin(req.get_full_url(), newurl) # For security reasons we do not allow redirects to protocols # other than HTTP, HTTPS or FTP. newurl_lower = newurl.lower() if not (newurl_lower.startswith('http://') or newurl_lower.startswith('https://') or newurl_lower.startswith('ftp://')): raise HTTPError(newurl, code, msg + " - Redirection to url '%s' is not allowed" % newurl, headers, fp) # XXX Probably want to forget about the state of the current # request, although that might interact poorly with other # handlers that also use handler-specific request attributes new = self.redirect_request(req, fp, code, msg, headers, newurl) if new is None: return # loop detection # .redirect_dict has a key url if url was previously visited. if hasattr(req, 'redirect_dict'): visited = new.redirect_dict = req.redirect_dict if (visited.get(newurl, 0) >= self.max_repeats or len(visited) >= self.max_redirections): raise HTTPError(req.get_full_url(), code, self.inf_msg + msg, headers, fp) else: visited = new.redirect_dict = req.redirect_dict = {} visited[newurl] = visited.get(newurl, 0) + 1 # Don't close the fp until we are sure that we won't use it # with HTTPError. fp.read() fp.close() return self.parent.open(new, timeout=req.timeout) http_error_301 = http_error_303 = http_error_307 = http_error_302 inf_msg = "The HTTP server returned a redirect error that would " \ "lead to an infinite loop.\n" \ "The last 30x error message was:\n" def _parse_proxy(proxy): """Return (scheme, user, password, host/port) given a URL or an authority. If a URL is supplied, it must have an authority (host:port) component. According to RFC 3986, having an authority component means the URL must have two slashes after the scheme: >>> _parse_proxy('file:/ftp.example.com/') Traceback (most recent call last): ValueError: proxy URL with no authority: 'file:/ftp.example.com/' The first three items of the returned tuple may be None. Examples of authority parsing: >>> _parse_proxy('proxy.example.com') (None, None, None, 'proxy.example.com') >>> _parse_proxy('proxy.example.com:3128') (None, None, None, 'proxy.example.com:3128') The authority component may optionally include userinfo (assumed to be username:password): >>> _parse_proxy('joe:[email protected]') (None, 'joe', 'password', 'proxy.example.com') >>> _parse_proxy('joe:[email protected]:3128') (None, 'joe', 'password', 'proxy.example.com:3128') Same examples, but with URLs instead: >>> _parse_proxy('http://proxy.example.com/') ('http', None, None, 'proxy.example.com') >>> _parse_proxy('http://proxy.example.com:3128/') ('http', None, None, 'proxy.example.com:3128') >>> _parse_proxy('http://joe:[email protected]/') ('http', 'joe', 'password', 'proxy.example.com') >>> _parse_proxy('http://joe:[email protected]:3128') ('http', 'joe', 'password', 'proxy.example.com:3128') Everything after the authority is ignored: >>> _parse_proxy('ftp://joe:[email protected]/rubbish:3128') ('ftp', 'joe', 'password', 'proxy.example.com') Test for no trailing '/' case: >>> _parse_proxy('http://joe:[email protected]') ('http', 'joe', 'password', 'proxy.example.com') """ scheme, r_scheme = splittype(proxy) if not r_scheme.startswith("/"): # authority scheme = None authority = proxy else: # URL if not r_scheme.startswith("//"): raise ValueError("proxy URL with no authority: %r" % proxy) # We have an authority, so for RFC 3986-compliant URLs (by ss 3. # and 3.3.), path is empty or starts with '/' end = r_scheme.find("/", 2) if end == -1: end = None authority = r_scheme[2:end] userinfo, hostport = splituser(authority) if userinfo is not None: user, password = splitpasswd(userinfo) else: user = password = None return scheme, user, password, hostport class ProxyHandler(BaseHandler): # Proxies must be in front handler_order = 100 def __init__(self, proxies=None): if proxies is None: proxies = getproxies() assert hasattr(proxies, 'has_key'), "proxies must be a mapping" self.proxies = proxies for type, url in proxies.items(): setattr(self, '%s_open' % type, lambda r, proxy=url, type=type, meth=self.proxy_open: \ meth(r, proxy, type)) def proxy_open(self, req, proxy, type): orig_type = req.get_type() proxy_type, user, password, hostport = _parse_proxy(proxy) if proxy_type is None: proxy_type = orig_type if req.host and proxy_bypass(req.host): return None if user and password: user_pass = '%s:%s' % (unquote(user), unquote(password)) creds = base64.b64encode(user_pass).strip() req.add_header('Proxy-authorization', 'Basic ' + creds) hostport = unquote(hostport) req.set_proxy(hostport, proxy_type) if orig_type == proxy_type or orig_type == 'https': # let other handlers take care of it return None else: # need to start over, because the other handlers don't # grok the proxy's URL type # e.g. if we have a constructor arg proxies like so: # {'http': 'ftp://proxy.example.com'}, we may end up turning # a request for http://acme.example.com/a into one for # ftp://proxy.example.com/a return self.parent.open(req, timeout=req.timeout) class HTTPPasswordMgr: def __init__(self): self.passwd = {} def add_password(self, realm, uri, user, passwd): # uri could be a single URI or a sequence if isinstance(uri, basestring): uri = [uri] if not realm in self.passwd: self.passwd[realm] = {} for default_port in True, False: reduced_uri = tuple( [self.reduce_uri(u, default_port) for u in uri]) self.passwd[realm][reduced_uri] = (user, passwd) def find_user_password(self, realm, authuri): domains = self.passwd.get(realm, {}) for default_port in True, False: reduced_authuri = self.reduce_uri(authuri, default_port) for uris, authinfo in domains.iteritems(): for uri in uris: if self.is_suburi(uri, reduced_authuri): return authinfo return None, None def reduce_uri(self, uri, default_port=True): """Accept authority or URI and extract only the authority and path.""" # note HTTP URLs do not have a userinfo component parts = urlparse.urlsplit(uri) if parts[1]: # URI scheme = parts[0] authority = parts[1] path = parts[2] or '/' else: # host or host:port scheme = None authority = uri path = '/' host, port = splitport(authority) if default_port and port is None and scheme is not None: dport = {"http": 80, "https": 443, }.get(scheme) if dport is not None: authority = "%s:%d" % (host, dport) return authority, path def is_suburi(self, base, test): """Check if test is below base in a URI tree Both args must be URIs in reduced form. """ if base == test: return True if base[0] != test[0]: return False common = posixpath.commonprefix((base[1], test[1])) if len(common) == len(base[1]): return True return False class HTTPPasswordMgrWithDefaultRealm(HTTPPasswordMgr): def find_user_password(self, realm, authuri): user, password = HTTPPasswordMgr.find_user_password(self, realm, authuri) if user is not None: return user, password return HTTPPasswordMgr.find_user_password(self, None, authuri) class AbstractBasicAuthHandler: # XXX this allows for multiple auth-schemes, but will stupidly pick # the last one with a realm specified. # allow for double- and single-quoted realm values # (single quotes are a violation of the RFC, but appear in the wild) rx = re.compile('(?:.*,)*[ \t]*([^ \t]+)[ \t]+' 'realm=(["\'])(.*?)\\2', re.I) # XXX could pre-emptively send auth info already accepted (RFC 2617, # end of section 2, and section 1.2 immediately after "credentials" # production). def __init__(self, password_mgr=None): if password_mgr is None: password_mgr = HTTPPasswordMgr() self.passwd = password_mgr self.add_password = self.passwd.add_password self.retried = 0 def reset_retry_count(self): self.retried = 0 def http_error_auth_reqed(self, authreq, host, req, headers): # host may be an authority (without userinfo) or a URL with an # authority # XXX could be multiple headers authreq = headers.get(authreq, None) if self.retried > 5: # retry sending the username:password 5 times before failing. raise HTTPError(req.get_full_url(), 401, "basic auth failed", headers, None) else: self.retried += 1 if authreq: mo = AbstractBasicAuthHandler.rx.search(authreq) if mo: scheme, quote, realm = mo.groups() if scheme.lower() == 'basic': response = self.retry_http_basic_auth(host, req, realm) if response and response.code != 401: self.retried = 0 return response def retry_http_basic_auth(self, host, req, realm): user, pw = self.passwd.find_user_password(realm, host) if pw is not None: raw = "%s:%s" % (user, pw) auth = 'Basic %s' % base64.b64encode(raw).strip() if req.headers.get(self.auth_header, None) == auth: return None req.add_unredirected_header(self.auth_header, auth) return self.parent.open(req, timeout=req.timeout) else: return None class HTTPBasicAuthHandler(AbstractBasicAuthHandler, BaseHandler): auth_header = 'Authorization' def http_error_401(self, req, fp, code, msg, headers): url = req.get_full_url() response = self.http_error_auth_reqed('www-authenticate', url, req, headers) self.reset_retry_count() return response class ProxyBasicAuthHandler(AbstractBasicAuthHandler, BaseHandler): auth_header = 'Proxy-authorization' def http_error_407(self, req, fp, code, msg, headers): # http_error_auth_reqed requires that there is no userinfo component in # authority. Assume there isn't one, since urllib2 does not (and # should not, RFC 3986 s. 3.2.1) support requests for URLs containing # userinfo. authority = req.get_host() response = self.http_error_auth_reqed('proxy-authenticate', authority, req, headers) self.reset_retry_count() return response def randombytes(n): """Return n random bytes.""" # Use /dev/urandom if it is available. Fall back to random module # if not. It might be worthwhile to extend this function to use # other platform-specific mechanisms for getting random bytes. if os.path.exists("/dev/urandom"): f = open("/dev/urandom") s = f.read(n) f.close() return s else: L = [chr(random.randrange(0, 256)) for i in range(n)] return "".join(L) class AbstractDigestAuthHandler: # Digest authentication is specified in RFC 2617. # XXX The client does not inspect the Authentication-Info header # in a successful response. # XXX It should be possible to test this implementation against # a mock server that just generates a static set of challenges. # XXX qop="auth-int" supports is shaky def __init__(self, passwd=None): if passwd is None: passwd = HTTPPasswordMgr() self.passwd = passwd self.add_password = self.passwd.add_password self.retried = 0 self.nonce_count = 0 self.last_nonce = None def reset_retry_count(self): self.retried = 0 def http_error_auth_reqed(self, auth_header, host, req, headers): authreq = headers.get(auth_header, None) if self.retried > 5: # Don't fail endlessly - if we failed once, we'll probably # fail a second time. Hm. Unless the Password Manager is # prompting for the information. Crap. This isn't great # but it's better than the current 'repeat until recursion # depth exceeded' approach <wink> raise HTTPError(req.get_full_url(), 401, "digest auth failed", headers, None) else: self.retried += 1 if authreq: scheme = authreq.split()[0] if scheme.lower() == 'digest': return self.retry_http_digest_auth(req, authreq) def retry_http_digest_auth(self, req, auth): token, challenge = auth.split(' ', 1) chal = parse_keqv_list(parse_http_list(challenge)) auth = self.get_authorization(req, chal) if auth: auth_val = 'Digest %s' % auth if req.headers.get(self.auth_header, None) == auth_val: return None req.add_unredirected_header(self.auth_header, auth_val) resp = self.parent.open(req, timeout=req.timeout) return resp def get_cnonce(self, nonce): # The cnonce-value is an opaque # quoted string value provided by the client and used by both client # and server to avoid chosen plaintext attacks, to provide mutual # authentication, and to provide some message integrity protection. # This isn't a fabulous effort, but it's probably Good Enough. dig = hashlib.sha1("%s:%s:%s:%s" % (self.nonce_count, nonce, time.ctime(), randombytes(8))).hexdigest() return dig[:16] def get_authorization(self, req, chal): try: realm = chal['realm'] nonce = chal['nonce'] qop = chal.get('qop') algorithm = chal.get('algorithm', 'MD5') # mod_digest doesn't send an opaque, even though it isn't # supposed to be optional opaque = chal.get('opaque', None) except KeyError: return None H, KD = self.get_algorithm_impls(algorithm) if H is None: return None user, pw = self.passwd.find_user_password(realm, req.get_full_url()) if user is None: return None # XXX not implemented yet if req.has_data(): entdig = self.get_entity_digest(req.get_data(), chal) else: entdig = None A1 = "%s:%s:%s" % (user, realm, pw) A2 = "%s:%s" % (req.get_method(), # XXX selector: what about proxies and full urls req.get_selector()) if qop == 'auth': if nonce == self.last_nonce: self.nonce_count += 1 else: self.nonce_count = 1 self.last_nonce = nonce ncvalue = '%08x' % self.nonce_count cnonce = self.get_cnonce(nonce) noncebit = "%s:%s:%s:%s:%s" % (nonce, ncvalue, cnonce, qop, H(A2)) respdig = KD(H(A1), noncebit) elif qop is None: respdig = KD(H(A1), "%s:%s" % (nonce, H(A2))) else: # XXX handle auth-int. raise URLError("qop '%s' is not supported." % qop) # XXX should the partial digests be encoded too? base = 'username="%s", realm="%s", nonce="%s", uri="%s", ' \ 'response="%s"' % (user, realm, nonce, req.get_selector(), respdig) if opaque: base += ', opaque="%s"' % opaque if entdig: base += ', digest="%s"' % entdig base += ', algorithm="%s"' % algorithm if qop: base += ', qop=auth, nc=%s, cnonce="%s"' % (ncvalue, cnonce) return base def get_algorithm_impls(self, algorithm): # algorithm should be case-insensitive according to RFC2617 algorithm = algorithm.upper() # lambdas assume digest modules are imported at the top level if algorithm == 'MD5': H = lambda x: hashlib.md5(x).hexdigest() elif algorithm == 'SHA': H = lambda x: hashlib.sha1(x).hexdigest() # XXX MD5-sess KD = lambda s, d: H("%s:%s" % (s, d)) return H, KD def get_entity_digest(self, data, chal): # XXX not implemented yet return None class HTTPDigestAuthHandler(BaseHandler, AbstractDigestAuthHandler): """An authentication protocol defined by RFC 2069 Digest authentication improves on basic authentication because it does not transmit passwords in the clear. """ auth_header = 'Authorization' handler_order = 490 # before Basic auth def http_error_401(self, req, fp, code, msg, headers): host = urlparse.urlparse(req.get_full_url())[1] retry = self.http_error_auth_reqed('www-authenticate', host, req, headers) self.reset_retry_count() return retry class ProxyDigestAuthHandler(BaseHandler, AbstractDigestAuthHandler): auth_header = 'Proxy-Authorization' handler_order = 490 # before Basic auth def http_error_407(self, req, fp, code, msg, headers): host = req.get_host() retry = self.http_error_auth_reqed('proxy-authenticate', host, req, headers) self.reset_retry_count() return retry class AbstractHTTPHandler(BaseHandler): def __init__(self, debuglevel=0): self._debuglevel = debuglevel def set_http_debuglevel(self, level): self._debuglevel = level def do_request_(self, request): host = request.get_host() if not host: raise URLError('no host given') if request.has_data(): # POST data = request.get_data() if not request.has_header('Content-type'): request.add_unredirected_header( 'Content-type', 'application/x-www-form-urlencoded') if not request.has_header('Content-length'): request.add_unredirected_header( 'Content-length', '%d' % len(data)) sel_host = host if request.has_proxy(): scheme, sel = splittype(request.get_selector()) sel_host, sel_path = splithost(sel) if not request.has_header('Host'): request.add_unredirected_header('Host', sel_host) for name, value in self.parent.addheaders: name = name.capitalize() if not request.has_header(name): request.add_unredirected_header(name, value) return request def do_open(self, http_class, req): """Return an addinfourl object for the request, using http_class. http_class must implement the HTTPConnection API from httplib. The addinfourl return value is a file-like object. It also has methods and attributes including: - info(): return a mimetools.Message object for the headers - geturl(): return the original request URL - code: HTTP status code """ host = req.get_host() if not host: raise URLError('no host given') h = http_class(host, timeout=req.timeout) # will parse host:port h.set_debuglevel(self._debuglevel) headers = dict(req.unredirected_hdrs) headers.update(dict((k, v) for k, v in req.headers.items() if k not in headers)) # We want to make an HTTP/1.1 request, but the addinfourl # class isn't prepared to deal with a persistent connection. # It will try to read all remaining data from the socket, # which will block while the server waits for the next request. # So make sure the connection gets closed after the (only) # request. headers["Connection"] = "close" headers = dict( (name.title(), val) for name, val in headers.items()) if req._tunnel_host: tunnel_headers = {} proxy_auth_hdr = "Proxy-Authorization" if proxy_auth_hdr in headers: tunnel_headers[proxy_auth_hdr] = headers[proxy_auth_hdr] # Proxy-Authorization should not be sent to origin # server. del headers[proxy_auth_hdr] h.set_tunnel(req._tunnel_host, headers=tunnel_headers) try: h.request(req.get_method(), req.get_selector(), req.data, headers) try: r = h.getresponse(buffering=True) except TypeError: #buffering kw not supported r = h.getresponse() except socket.error, err: # XXX what error? raise URLError(err) # Pick apart the HTTPResponse object to get the addinfourl # object initialized properly. # Wrap the HTTPResponse object in socket's file object adapter # for Windows. That adapter calls recv(), so delegate recv() # to read(). This weird wrapping allows the returned object to # have readline() and readlines() methods. # XXX It might be better to extract the read buffering code # out of socket._fileobject() and into a base class. r.recv = r.read fp = socket._fileobject(r, close=True) resp = addinfourl(fp, r.msg, req.get_full_url()) resp.code = r.status resp.msg = r.reason return resp class HTTPHandler(AbstractHTTPHandler): def http_open(self, req): return self.do_open(httplib.HTTPConnection, req) http_request = AbstractHTTPHandler.do_request_ if hasattr(httplib, 'HTTPS'): class HTTPSHandler(AbstractHTTPHandler): def https_open(self, req): return self.do_open(httplib.HTTPSConnection, req) https_request = AbstractHTTPHandler.do_request_ class HTTPCookieProcessor(BaseHandler): def __init__(self, cookiejar=None): import cookielib if cookiejar is None: cookiejar = cookielib.CookieJar() self.cookiejar = cookiejar def http_request(self, request): self.cookiejar.add_cookie_header(request) return request def http_response(self, request, response): self.cookiejar.extract_cookies(response, request) return response https_request = http_request https_response = http_response class UnknownHandler(BaseHandler): def unknown_open(self, req): type = req.get_type() raise URLError('unknown url type: %s' % type) def parse_keqv_list(l): """Parse list of key=value strings where keys are not duplicated.""" parsed = {} for elt in l: k, v = elt.split('=', 1) if v[0] == '"' and v[-1] == '"': v = v[1:-1] parsed[k] = v return parsed def parse_http_list(s): """Parse lists as described by RFC 2068 Section 2. In particular, parse comma-separated lists where the elements of the list may include quoted-strings. A quoted-string could contain a comma. A non-quoted string could have quotes in the middle. Neither commas nor quotes count if they are escaped. Only double-quotes count, not single-quotes. """ res = [] part = '' escape = quote = False for cur in s: if escape: part += cur escape = False continue if quote: if cur == '\\': escape = True continue elif cur == '"': quote = False part += cur continue if cur == ',': res.append(part) part = '' continue if cur == '"': quote = True part += cur # append last part if part: res.append(part) return [part.strip() for part in res] def _safe_gethostbyname(host): try: return socket.gethostbyname(host) except socket.gaierror: return None class FileHandler(BaseHandler): # Use local file or FTP depending on form of URL def file_open(self, req): url = req.get_selector() if url[:2] == '//' and url[2:3] != '/' and (req.host and req.host != 'localhost'): req.type = 'ftp' return self.parent.open(req) else: return self.open_local_file(req) # names for the localhost names = None def get_names(self): if FileHandler.names is None: try: FileHandler.names = tuple( socket.gethostbyname_ex('localhost')[2] + socket.gethostbyname_ex(socket.gethostname())[2]) except socket.gaierror: FileHandler.names = (socket.gethostbyname('localhost'),) return FileHandler.names # not entirely sure what the rules are here def open_local_file(self, req): import email.utils import mimetypes host = req.get_host() filename = req.get_selector() localfile = url2pathname(filename) try: stats = os.stat(localfile) size = stats.st_size modified = email.utils.formatdate(stats.st_mtime, usegmt=True) mtype = mimetypes.guess_type(filename)[0] headers = mimetools.Message(StringIO( 'Content-type: %s\nContent-length: %d\nLast-modified: %s\n' % (mtype or 'text/plain', size, modified))) if host: host, port = splitport(host) if not host or \ (not port and _safe_gethostbyname(host) in self.get_names()): if host: origurl = 'file://' + host + filename else: origurl = 'file://' + filename return addinfourl(open(localfile, 'rb'), headers, origurl) except OSError, msg: # urllib2 users shouldn't expect OSErrors coming from urlopen() raise URLError(msg) raise URLError('file not on local host') class FTPHandler(BaseHandler): def ftp_open(self, req): import ftplib import mimetypes host = req.get_host() if not host: raise URLError('ftp error: no host given') host, port = splitport(host) if port is None: port = ftplib.FTP_PORT else: port = int(port) # username/password handling user, host = splituser(host) if user: user, passwd = splitpasswd(user) else: passwd = None host = unquote(host) user = user or '' passwd = passwd or '' try: host = socket.gethostbyname(host) except socket.error, msg: raise URLError(msg) path, attrs = splitattr(req.get_selector()) dirs = path.split('/') dirs = map(unquote, dirs) dirs, file = dirs[:-1], dirs[-1] if dirs and not dirs[0]: dirs = dirs[1:] try: fw = self.connect_ftp(user, passwd, host, port, dirs, req.timeout) type = file and 'I' or 'D' for attr in attrs: attr, value = splitvalue(attr) if attr.lower() == 'type' and \ value in ('a', 'A', 'i', 'I', 'd', 'D'): type = value.upper() fp, retrlen = fw.retrfile(file, type) headers = "" mtype = mimetypes.guess_type(req.get_full_url())[0] if mtype: headers += "Content-type: %s\n" % mtype if retrlen is not None and retrlen >= 0: headers += "Content-length: %d\n" % retrlen sf = StringIO(headers) headers = mimetools.Message(sf) return addinfourl(fp, headers, req.get_full_url()) except ftplib.all_errors, msg: raise URLError, ('ftp error: %s' % msg), sys.exc_info()[2] def connect_ftp(self, user, passwd, host, port, dirs, timeout): fw = ftpwrapper(user, passwd, host, port, dirs, timeout) ## fw.ftp.set_debuglevel(1) return fw class CacheFTPHandler(FTPHandler): # XXX would be nice to have pluggable cache strategies # XXX this stuff is definitely not thread safe def __init__(self): self.cache = {} self.timeout = {} self.soonest = 0 self.delay = 60 self.max_conns = 16 def setTimeout(self, t): self.delay = t def setMaxConns(self, m): self.max_conns = m def connect_ftp(self, user, passwd, host, port, dirs, timeout): key = user, host, port, '/'.join(dirs), timeout if key in self.cache: self.timeout[key] = time.time() + self.delay else: self.cache[key] = ftpwrapper(user, passwd, host, port, dirs, timeout) self.timeout[key] = time.time() + self.delay self.check_cache() return self.cache[key] def check_cache(self): # first check for old ones t = time.time() if self.soonest <= t: for k, v in self.timeout.items(): if v < t: self.cache[k].close() del self.cache[k] del self.timeout[k] self.soonest = min(self.timeout.values()) # then check the size if len(self.cache) == self.max_conns: for k, v in self.timeout.items(): if v == self.soonest: del self.cache[k] del self.timeout[k] break self.soonest = min(self.timeout.values())
gpl-3.0
[ 624, 2493, 2178, 1164, 3555, 367, 13618, 10867, 1808, 282, 32246, 402, 19230, 2999, 199, 1918, 3486, 270, 4340, 370, 675, 642, 859, 365, 370, 1240, 314, 18279, 805, 12, 202, 199, 6777, 11479, 282, 1059, 3035, 282, 2851, 503, 282, 4784, 909, 334, 271, 14922, 202, 199, 12843, 680, 221, 2779, 30848, 314, 2851, 436, 2529, 314, 2058, 465, 570, 13, 2930, 202, 199, 785, 27, 314, 2138, 909, 965, 2005, 2402, 3102, 11736, 5084, 14, 2999, 199, 1918, 9319, 727, 28704, 31965, 282, 3245, 402, 18599, 2251, 626, 886, 202, 199, 452, 314, 3503, 1736, 14, 221, 7048, 18599, 9031, 282, 6770, 4113, 503, 202, 199, 1422, 14, 221, 710, 9319, 727, 28704, 365, 282, 19306, 909, 626, 29761, 314, 202, 199, 25096, 4346, 370, 1551, 314, 5839, 2851, 14, 221, 2104, 2893, 12, 314, 202, 199, 2856, 2461, 18628, 3101, 9576, 436, 8761, 4145, 436, 477, 2551, 543, 202, 199, 2865, 13, 705, 2529, 14, 221, 710, 3101, 7071, 2461, 5847, 477, 2551, 543, 202, 199, 2856, 19660, 12, 11485, 12, 25989, 436, 26959, 4660, 2552, 12, 436, 314, 3101, 18541, 21547, 202, 199, 271, 2551, 543, 10017, 6299, 14, 2999, 199, 10890, 8, 633, 12, 666, 29, 403, 9, 1553, 10082, 4503, 365, 314, 2011, 465, 3379, 202, 199, 4078, 14, 221, 986, 314, 1166, 436, 14190, 666, 370, 2963, 370, 376, 3101, 2851, 12, 436, 202, 199, 362, 282, 570, 13, 2930, 909, 1771, 14, 221, 7309, 8865, 365, 626, 1265, 883, 2597, 986, 202, 199, 65, 4784, 1256, 3140, 402, 2851, 14, 221, 6218, 282, 30794, 334, 6083, 402, 202, 199, 13760, 2736, 367, 3101, 2552, 12, 6534, 376, 15050, 12, 1314, 883, 2597, 506, 202, 199, 84, 9640, 465, 282, 1686, 1177, 14, 2999, 199, 1506, 63, 11637, 1553, 6801, 626, 8491, 282, 892, 9319, 727, 28704, 1256, 14, 202, 199, 20326, 3907, 314, 849, 8297, 14, 221, 15506, 83, 1373, 503, 1655, 18599, 83, 465, 202, 199, 4958, 12, 1902, 4454, 503, 18599, 3992, 626, 652, 911, 202, 199, 3615, 18973, 14, 221, 982, 1373, 402, 314, 1423, 365, 282, 5516, 402, 314, 849, 202, 199, 2232, 12, 314, 1423, 911, 506, 4903, 3140, 402, 314, 849, 14, 2999, 199, 3174, 63, 11637, 1553, 13276, 83, 282, 892, 16088, 465, 314, 849, 16088, 14, 2999, 199, 1462, 402, 13518, 26, 2999, 199, 29993, 28704, 1553, 10729, 1536, 314, 2876, 19866, 465, 314, 2018, 13, 4078, 1890, 436, 31965, 202, 199, 1589, 18599, 3992, 12, 1830, 23654, 543, 4145, 436, 9320, 14, 2999, 199, 2017, 1553, 1626, 909, 626, 22667, 15409, 314, 1174, 402, 282, 1056, 14, 221, 710, 202, 199, 929, 883, 506, 465, 3486, 465, 314, 2851, 14, 221, 2779, 883, 2597, 2387, 2402, 3101, 202, 199, 2139, 12, 325, 14, 71, 14, 282, 2876, 13, 7788, 14, 2999, 199, 1563, 2461, 1553, 2999, 199, 3924, 26, 202, 199, 31475, 1553, 437, 5516, 402, 5925, 12, 8212, 19230, 1172, 3932, 5705, 202, 199, 6100, 5516, 14, 2999, 199, 12815, 1553, 6121, 282, 1686, 3101, 1177, 12, 880, 1265, 883, 14312, 376, 3101, 1125, 202, 199, 305, 376, 1919, 279, 1566, 503, 1686, 1177, 14, 2999, 199, 4404, 2551, 26, 202, 199, 1563, 2461, 436, 1676, 202, 199, 63, 1250, 63, 4429, 8758, 852, 2999, 199, 9846, 4503, 26, 2999, 199, 646, 4011, 18, 2999, 199, 3, 663, 1536, 6299, 2256, 202, 199, 1178, 815, 275, 4011, 18, 14, 2856, 6845, 21547, 342, 202, 199, 1178, 815, 14, 525, 63, 2060, 8, 7728, 534, 11435, 49, 13515, 297, 202, 1993, 5108, 534, 2859, 921, 391, 72, 1435, 26, 1257, 2942, 15, 2124, 13, 7618, 14, 647, 297, 202, 1993, 922, 534, 75, 3701, 297, 202, 1993, 15081, 534, 303, 426, 1017, 4, 462, 16721, 358, 2999, 199, 3280, 63, 4058, 275, 4011, 18, 14, 4936, 2461, 6333, 1014, 2, 520, 298, 1014, 921, 11326, 350, 13, 2411, 455, 26, 19, 3933, 5984, 2999, 199, 3, 1900, 282, 892, 16088, 626, 9584, 6299, 436, 13627, 23125, 8297, 202, 199, 11637, 275, 4011, 18, 14, 1506, 63, 11637, 8, 3280, 63, 4058, 12, 1790, 815, 12, 4011, 18, 14, 4437, 15123, 2461, 9, 2999, 199, 3, 3907, 652, 202, 199, 4078, 18, 14, 3174, 63, 11637, 8, 11637, 9, 2999, 199, 70, 275, 4011, 18, 14, 10890, 360, 1014, 921, 1544, 14, 1548, 14, 1308, 6217, 8065, 199, 624, 2999, 199, 3, 5787, 10876, 26, 202, 199, 3, 982, 376, 6299, 1125, 3016, 626, 11275, 370, 5147, 202, 199, 3, 6299, 367, 2005, 4499, 1325, 6918, 12, 4212, 1077, 314, 1125, 506, 202, 199, 3, 2070, 1843, 31, 221, 710, 1890, 4839, 370, 5715, 314, 3101, 1125, 1233, 14, 221, 11017, 340, 202, 199, 3, 314, 3016, 19428, 626, 314, 5160, 1990, 12, 325, 14, 71, 2020, 626, 652, 9980, 1133, 5715, 202, 199, 3, 626, 2631, 24633, 626, 5839, 315, 314, 14929, 12, 652, 3955, 506, 6954, 370, 202, 199, 3, 986, 626, 2556, 3180, 370, 314, 1890, 12, 4634, 14, 202, 199, 3, 14904, 2552, 10621, 1133, 8860, 3633, 590, 202, 199, 3, 1104, 10017, 6169, 3211, 334, 73, 14, 69, 14, 2222, 13, 3796, 9, 4514, 2999, 199, 3, 18558, 5478, 26, 202, 199, 3, 6114, 14942, 221, 5787, 440, 3238, 4052, 8840, 1990, 18329, 701, 642, 202, 199, 3, 9006, 6434, 367, 16088, 2999, 199, 646, 1300, 772, 202, 199, 646, 8337, 202, 199, 646, 8809, 202, 199, 646, 6660, 2537, 202, 199, 646, 747, 202, 199, 646, 15454, 202, 199, 646, 2196, 202, 199, 646, 295, 202, 199, 646, 2838, 202, 199, 646, 984, 202, 199, 646, 900, 202, 199, 646, 7097, 202, 199, 646, 19063, 2999, 199, 893, 26, 1128, 687, 15073, 492, 5228, 202, 199, 2590, 3545, 26, 1128, 687, 5228, 492, 5228, 2999, 199, 504, 4011, 492, 334, 28896, 12, 14342, 12, 3715, 466, 12, 2249, 317, 15157, 12, 6313, 12, 8428, 1050, 815, 633, 12, 2249, 317, 19394, 12, 3715, 1450, 12, 8428, 3715, 962, 12, 14904, 5029, 12, 3715, 751, 12, 2249, 317, 32376, 2989, 12, 3715, 585, 9, 2999, 199, 3, 2291, 367, 3814, 2461, 12, 14942, 4799, 3734, 2860, 202, 199, 504, 4011, 492, 11667, 12 ]
[ 2493, 2178, 1164, 3555, 367, 13618, 10867, 1808, 282, 32246, 402, 19230, 2999, 199, 1918, 3486, 270, 4340, 370, 675, 642, 859, 365, 370, 1240, 314, 18279, 805, 12, 202, 199, 6777, 11479, 282, 1059, 3035, 282, 2851, 503, 282, 4784, 909, 334, 271, 14922, 202, 199, 12843, 680, 221, 2779, 30848, 314, 2851, 436, 2529, 314, 2058, 465, 570, 13, 2930, 202, 199, 785, 27, 314, 2138, 909, 965, 2005, 2402, 3102, 11736, 5084, 14, 2999, 199, 1918, 9319, 727, 28704, 31965, 282, 3245, 402, 18599, 2251, 626, 886, 202, 199, 452, 314, 3503, 1736, 14, 221, 7048, 18599, 9031, 282, 6770, 4113, 503, 202, 199, 1422, 14, 221, 710, 9319, 727, 28704, 365, 282, 19306, 909, 626, 29761, 314, 202, 199, 25096, 4346, 370, 1551, 314, 5839, 2851, 14, 221, 2104, 2893, 12, 314, 202, 199, 2856, 2461, 18628, 3101, 9576, 436, 8761, 4145, 436, 477, 2551, 543, 202, 199, 2865, 13, 705, 2529, 14, 221, 710, 3101, 7071, 2461, 5847, 477, 2551, 543, 202, 199, 2856, 19660, 12, 11485, 12, 25989, 436, 26959, 4660, 2552, 12, 436, 314, 3101, 18541, 21547, 202, 199, 271, 2551, 543, 10017, 6299, 14, 2999, 199, 10890, 8, 633, 12, 666, 29, 403, 9, 1553, 10082, 4503, 365, 314, 2011, 465, 3379, 202, 199, 4078, 14, 221, 986, 314, 1166, 436, 14190, 666, 370, 2963, 370, 376, 3101, 2851, 12, 436, 202, 199, 362, 282, 570, 13, 2930, 909, 1771, 14, 221, 7309, 8865, 365, 626, 1265, 883, 2597, 986, 202, 199, 65, 4784, 1256, 3140, 402, 2851, 14, 221, 6218, 282, 30794, 334, 6083, 402, 202, 199, 13760, 2736, 367, 3101, 2552, 12, 6534, 376, 15050, 12, 1314, 883, 2597, 506, 202, 199, 84, 9640, 465, 282, 1686, 1177, 14, 2999, 199, 1506, 63, 11637, 1553, 6801, 626, 8491, 282, 892, 9319, 727, 28704, 1256, 14, 202, 199, 20326, 3907, 314, 849, 8297, 14, 221, 15506, 83, 1373, 503, 1655, 18599, 83, 465, 202, 199, 4958, 12, 1902, 4454, 503, 18599, 3992, 626, 652, 911, 202, 199, 3615, 18973, 14, 221, 982, 1373, 402, 314, 1423, 365, 282, 5516, 402, 314, 849, 202, 199, 2232, 12, 314, 1423, 911, 506, 4903, 3140, 402, 314, 849, 14, 2999, 199, 3174, 63, 11637, 1553, 13276, 83, 282, 892, 16088, 465, 314, 849, 16088, 14, 2999, 199, 1462, 402, 13518, 26, 2999, 199, 29993, 28704, 1553, 10729, 1536, 314, 2876, 19866, 465, 314, 2018, 13, 4078, 1890, 436, 31965, 202, 199, 1589, 18599, 3992, 12, 1830, 23654, 543, 4145, 436, 9320, 14, 2999, 199, 2017, 1553, 1626, 909, 626, 22667, 15409, 314, 1174, 402, 282, 1056, 14, 221, 710, 202, 199, 929, 883, 506, 465, 3486, 465, 314, 2851, 14, 221, 2779, 883, 2597, 2387, 2402, 3101, 202, 199, 2139, 12, 325, 14, 71, 14, 282, 2876, 13, 7788, 14, 2999, 199, 1563, 2461, 1553, 2999, 199, 3924, 26, 202, 199, 31475, 1553, 437, 5516, 402, 5925, 12, 8212, 19230, 1172, 3932, 5705, 202, 199, 6100, 5516, 14, 2999, 199, 12815, 1553, 6121, 282, 1686, 3101, 1177, 12, 880, 1265, 883, 14312, 376, 3101, 1125, 202, 199, 305, 376, 1919, 279, 1566, 503, 1686, 1177, 14, 2999, 199, 4404, 2551, 26, 202, 199, 1563, 2461, 436, 1676, 202, 199, 63, 1250, 63, 4429, 8758, 852, 2999, 199, 9846, 4503, 26, 2999, 199, 646, 4011, 18, 2999, 199, 3, 663, 1536, 6299, 2256, 202, 199, 1178, 815, 275, 4011, 18, 14, 2856, 6845, 21547, 342, 202, 199, 1178, 815, 14, 525, 63, 2060, 8, 7728, 534, 11435, 49, 13515, 297, 202, 1993, 5108, 534, 2859, 921, 391, 72, 1435, 26, 1257, 2942, 15, 2124, 13, 7618, 14, 647, 297, 202, 1993, 922, 534, 75, 3701, 297, 202, 1993, 15081, 534, 303, 426, 1017, 4, 462, 16721, 358, 2999, 199, 3280, 63, 4058, 275, 4011, 18, 14, 4936, 2461, 6333, 1014, 2, 520, 298, 1014, 921, 11326, 350, 13, 2411, 455, 26, 19, 3933, 5984, 2999, 199, 3, 1900, 282, 892, 16088, 626, 9584, 6299, 436, 13627, 23125, 8297, 202, 199, 11637, 275, 4011, 18, 14, 1506, 63, 11637, 8, 3280, 63, 4058, 12, 1790, 815, 12, 4011, 18, 14, 4437, 15123, 2461, 9, 2999, 199, 3, 3907, 652, 202, 199, 4078, 18, 14, 3174, 63, 11637, 8, 11637, 9, 2999, 199, 70, 275, 4011, 18, 14, 10890, 360, 1014, 921, 1544, 14, 1548, 14, 1308, 6217, 8065, 199, 624, 2999, 199, 3, 5787, 10876, 26, 202, 199, 3, 982, 376, 6299, 1125, 3016, 626, 11275, 370, 5147, 202, 199, 3, 6299, 367, 2005, 4499, 1325, 6918, 12, 4212, 1077, 314, 1125, 506, 202, 199, 3, 2070, 1843, 31, 221, 710, 1890, 4839, 370, 5715, 314, 3101, 1125, 1233, 14, 221, 11017, 340, 202, 199, 3, 314, 3016, 19428, 626, 314, 5160, 1990, 12, 325, 14, 71, 2020, 626, 652, 9980, 1133, 5715, 202, 199, 3, 626, 2631, 24633, 626, 5839, 315, 314, 14929, 12, 652, 3955, 506, 6954, 370, 202, 199, 3, 986, 626, 2556, 3180, 370, 314, 1890, 12, 4634, 14, 202, 199, 3, 14904, 2552, 10621, 1133, 8860, 3633, 590, 202, 199, 3, 1104, 10017, 6169, 3211, 334, 73, 14, 69, 14, 2222, 13, 3796, 9, 4514, 2999, 199, 3, 18558, 5478, 26, 202, 199, 3, 6114, 14942, 221, 5787, 440, 3238, 4052, 8840, 1990, 18329, 701, 642, 202, 199, 3, 9006, 6434, 367, 16088, 2999, 199, 646, 1300, 772, 202, 199, 646, 8337, 202, 199, 646, 8809, 202, 199, 646, 6660, 2537, 202, 199, 646, 747, 202, 199, 646, 15454, 202, 199, 646, 2196, 202, 199, 646, 295, 202, 199, 646, 2838, 202, 199, 646, 984, 202, 199, 646, 900, 202, 199, 646, 7097, 202, 199, 646, 19063, 2999, 199, 893, 26, 1128, 687, 15073, 492, 5228, 202, 199, 2590, 3545, 26, 1128, 687, 5228, 492, 5228, 2999, 199, 504, 4011, 492, 334, 28896, 12, 14342, 12, 3715, 466, 12, 2249, 317, 15157, 12, 6313, 12, 8428, 1050, 815, 633, 12, 2249, 317, 19394, 12, 3715, 1450, 12, 8428, 3715, 962, 12, 14904, 5029, 12, 3715, 751, 12, 2249, 317, 32376, 2989, 12, 3715, 585, 9, 2999, 199, 3, 2291, 367, 3814, 2461, 12, 14942, 4799, 3734, 2860, 202, 199, 504, 4011, 492, 11667, 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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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 ]
scs/uclinux
lib/boost/boost_1_38_0/tools/build/v2/example/customization/inline_file.py
52
1097
#!/usr/bin/python # Copyright 2003 Vladimir Prus # Distributed under the Boost Software License, Version 1.0. # (See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) import sys from string import strip def quote_line(line): result = "" for i in line: if (i == '\\'): result = result + '\\\\' elif (i == '\"'): result = result + '\\\"' elif (i != '\r' and i != '\n'): result = result + i; return '\"' + result + '\\n\"' def quote_file(file): result = "" for i in file.readlines(): result = result + quote_line(i) + "\n" return result if len(sys.argv) < 3: print "Usage: inline_file.py output_c_file file_to_include" else: output_c_file = sys.argv[1] out_file = open(output_c_file, "w"); file_to_include = sys.argv[2] in_file = open(file_to_include, "r"); variable_name = strip(in_file.readline()) out_file.write("extern const char %s[] = {\n%s};\n\n" % (variable_name, quote_file(in_file))) in_file.close() out_file.close()
gpl-2.0
[ 3381, 2647, 15, 1393, 15, 1548, 199, 199, 3, 1898, 13004, 812, 416, 3572, 723, 510, 20791, 221, 199, 3, 17484, 1334, 314, 30470, 2290, 844, 12, 3394, 413, 14, 16, 14, 221, 199, 3, 334, 9295, 23073, 570, 5113, 63, 17, 63, 16, 14, 2424, 503, 1455, 921, 1544, 14, 15589, 14, 1308, 15, 3961, 63, 17, 63, 16, 14, 2424, 9, 9948, 199, 646, 984, 199, 504, 1059, 492, 6202, 199, 199, 318, 6313, 63, 604, 8, 604, 304, 339, 754, 275, 3087, 339, 367, 284, 315, 1004, 26, 267, 340, 334, 73, 508, 6468, 735, 288, 754, 275, 754, 435, 31375, 7, 267, 916, 334, 73, 508, 1557, 2, 735, 288, 754, 275, 754, 435, 6468, 4451, 7, 267, 916, 334, 73, 1137, 1557, 82, 7, 436, 284, 1137, 1557, 78, 735, 288, 754, 275, 754, 435, 284, 27, 339, 372, 1557, 4507, 435, 754, 435, 6468, 78, 4451, 7, 199, 199, 318, 6313, 63, 493, 8, 493, 304, 272, 754, 275, 3087, 339, 367, 284, 315, 570, 14, 9684, 837, 267, 754, 275, 754, 435, 6313, 63, 604, 8, 73, 9, 435, 1867, 78, 2, 339, 372, 754, 199, 199, 692, 822, 8, 1274, 14, 3020, 9, 665, 650, 26, 272, 870, 298, 7692, 26, 8308, 63, 493, 14, 647, 1072, 63, 67, 63, 493, 570, 63, 475, 63, 2613, 2, 199, 2836, 26, 272, 1072, 63, 67, 63, 493, 275, 984, 14, 3020, 59, 17, 61, 272, 734, 63, 493, 275, 1551, 8, 1199, 63, 67, 63, 493, 12, 298, 87, 3547, 339, 570, 63, 475, 63, 2613, 275, 984, 14, 3020, 59, 18, 61, 339, 315, 63, 493, 221, 275, 1551, 8, 493, 63, 475, 63, 2613, 12, 298, 82, 3547, 272, 1750, 63, 354, 275, 6202, 8, 262, 63, 493, 14, 6407, 1012, 14821, 734, 63, 493, 14, 952, 480, 18587, 950, 1495, 450, 83, 8607, 275, 9459, 78, 5, 83, 16055, 78, 60, 78, 2, 450, 334, 1975, 63, 354, 12, 6313, 63, 493, 8, 262, 63, 493, 1724, 272, 315, 63, 493, 14, 1600, 342, 272, 734, 63, 493, 14, 1600, 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 ]
[ 2647, 15, 1393, 15, 1548, 199, 199, 3, 1898, 13004, 812, 416, 3572, 723, 510, 20791, 221, 199, 3, 17484, 1334, 314, 30470, 2290, 844, 12, 3394, 413, 14, 16, 14, 221, 199, 3, 334, 9295, 23073, 570, 5113, 63, 17, 63, 16, 14, 2424, 503, 1455, 921, 1544, 14, 15589, 14, 1308, 15, 3961, 63, 17, 63, 16, 14, 2424, 9, 9948, 199, 646, 984, 199, 504, 1059, 492, 6202, 199, 199, 318, 6313, 63, 604, 8, 604, 304, 339, 754, 275, 3087, 339, 367, 284, 315, 1004, 26, 267, 340, 334, 73, 508, 6468, 735, 288, 754, 275, 754, 435, 31375, 7, 267, 916, 334, 73, 508, 1557, 2, 735, 288, 754, 275, 754, 435, 6468, 4451, 7, 267, 916, 334, 73, 1137, 1557, 82, 7, 436, 284, 1137, 1557, 78, 735, 288, 754, 275, 754, 435, 284, 27, 339, 372, 1557, 4507, 435, 754, 435, 6468, 78, 4451, 7, 199, 199, 318, 6313, 63, 493, 8, 493, 304, 272, 754, 275, 3087, 339, 367, 284, 315, 570, 14, 9684, 837, 267, 754, 275, 754, 435, 6313, 63, 604, 8, 73, 9, 435, 1867, 78, 2, 339, 372, 754, 199, 199, 692, 822, 8, 1274, 14, 3020, 9, 665, 650, 26, 272, 870, 298, 7692, 26, 8308, 63, 493, 14, 647, 1072, 63, 67, 63, 493, 570, 63, 475, 63, 2613, 2, 199, 2836, 26, 272, 1072, 63, 67, 63, 493, 275, 984, 14, 3020, 59, 17, 61, 272, 734, 63, 493, 275, 1551, 8, 1199, 63, 67, 63, 493, 12, 298, 87, 3547, 339, 570, 63, 475, 63, 2613, 275, 984, 14, 3020, 59, 18, 61, 339, 315, 63, 493, 221, 275, 1551, 8, 493, 63, 475, 63, 2613, 12, 298, 82, 3547, 272, 1750, 63, 354, 275, 6202, 8, 262, 63, 493, 14, 6407, 1012, 14821, 734, 63, 493, 14, 952, 480, 18587, 950, 1495, 450, 83, 8607, 275, 9459, 78, 5, 83, 16055, 78, 60, 78, 2, 450, 334, 1975, 63, 354, 12, 6313, 63, 493, 8, 262, 63, 493, 1724, 272, 315, 63, 493, 14, 1600, 342, 272, 734, 63, 493, 14, 1600, 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, 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,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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 ]
n4hy/gnuradio
gr-digital/python/qa_ofdm_insert_preamble.py
16
5662
#!/usr/bin/env python # # Copyright 2007,2010,2011 Free Software Foundation, Inc. # # This file is part of GNU Radio # # GNU Radio 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, or (at your option) # any later version. # # GNU Radio 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 GNU Radio; see the file COPYING. If not, write to # the Free Software Foundation, Inc., 51 Franklin Street, # Boston, MA 02110-1301, USA. # from gnuradio import gr, gr_unittest from pprint import pprint import digital_swig class test_ofdm_insert_preamble (gr_unittest.TestCase): def setUp (self): self.tb = gr.top_block () def tearDown (self): self.tb = None def helper(self, v0, v1, fft_length, preamble): tb = self.tb src0 = gr.vector_source_c(v0) src1 = gr.vector_source_b(v1) s2v = gr.stream_to_vector(gr.sizeof_gr_complex, fft_length) # print "len(v) = %d" % (len(v)) op = digital_swig.ofdm_insert_preamble(fft_length, preamble) v2s = gr.vector_to_stream(gr.sizeof_gr_complex, fft_length) dst0 = gr.vector_sink_c() dst1 = gr.vector_sink_b() tb.connect(src0, s2v, (op, 0)) tb.connect(src1, (op, 1)) tb.connect((op, 0), v2s, dst0) tb.connect((op, 1), dst1) tb.run() r0 = dst0.data() r0v = [] for i in range(len(r0)//fft_length): r0v.append(r0[i*fft_length:(i+1)*fft_length]) r1 = dst1.data() self.assertEqual(len(r0v), len(r1)) return (r1, r0v) def check_match(self, actual, expected_list): lst = [] map(lambda x: lst.append(x), expected_list) self.assertEqual(actual, lst) # ---------------------------------------------------------------- def test_000(self): # no preamble, 1 symbol payloads preamble = () fft_length = 8 npayloads = 8 v = [] p = [] for i in range(npayloads): t = fft_length*[(i + i*1j)] p.append(tuple(t)) v += t p = tuple(p) r = self.helper(v, npayloads*[1], fft_length, preamble) # pprint(r) self.assertEqual(r[0], tuple(npayloads*[1])) self.check_match(r[1], (p[0],p[1],p[2],p[3],p[4],p[5],p[6],p[7])) def test_001(self): # 1 symbol preamble, 1 symbol payloads preamble = ((100, 101, 102, 103, 104, 105, 106, 107),) p0 = preamble[0] fft_length = 8 npayloads = 8 v = [] p = [] for i in range(npayloads): t = fft_length*[(i + i*1j)] p.append(tuple(t)) v += t r = self.helper(v, npayloads*[1], fft_length, preamble) self.assertEqual(r[0], tuple(npayloads*[1, 0])) self.check_match(r[1], (p0, p[0], p0, p[1], p0, p[2], p0, p[3], p0, p[4], p0, p[5], p0, p[6], p0, p[7])) def test_002(self): # 2 symbol preamble, 1 symbol payloads preamble = ((100, 101, 102, 103, 104, 105, 106, 107), (200, 201, 202, 203, 204, 205, 206, 207)) p0 = preamble[0] p1 = preamble[1] fft_length = 8 npayloads = 8 v = [] p = [] for i in range(npayloads): t = fft_length*[(i + i*1j)] p.append(tuple(t)) v += t r = self.helper(v, npayloads*[1], fft_length, preamble) self.assertEqual(r[0], tuple(npayloads*[1, 0, 0])) self.check_match(r[1], (p0, p1, p[0], p0, p1, p[1], p0, p1, p[2], p0, p1, p[3], p0, p1, p[4], p0, p1, p[5], p0, p1, p[6], p0, p1, p[7])) def xtest_003_preamble(self): # 2 symbol preamble, 2 symbol payloads preamble = ((100, 101, 102, 103, 104, 105, 106, 107), (200, 201, 202, 203, 204, 205, 206, 207)) p0 = preamble[0] p1 = preamble[1] fft_length = 8 npayloads = 8 v = [] p = [] for i in range(npayloads * 2): t = fft_length*[(i + i*1j)] p.append(tuple(t)) v += t r = self.helper(v, npayloads*[1, 0], fft_length, preamble) self.assertEqual(r[0], tuple(npayloads*[1, 0, 0, 0])) self.check_match(r[1], (p0, p1, p[0], p[1], p0, p1, p[2], p[3], p0, p1, p[4], p[5], p0, p1, p[6], p[7], p0, p1, p[8], p[9], p0, p1, p[10], p[11], p0, p1, p[12], p[13], p0, p1, p[14], p[15])) if __name__ == '__main__': gr_unittest.run(test_ofdm_insert_preamble, "test_ofdm_insert_preamble.xml")
gpl-3.0
[ 3381, 2647, 15, 1393, 15, 1813, 2366, 199, 3, 199, 3, 1898, 10219, 12, 6542, 12, 8128, 2868, 2290, 2752, 12, 3277, 14, 199, 3, 221, 199, 3, 961, 570, 365, 1777, 402, 1664, 13514, 199, 3, 221, 199, 3, 1664, 13514, 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, 12, 503, 334, 292, 2195, 945, 9, 199, 3, 1263, 2945, 1015, 14, 199, 3, 221, 199, 3, 1664, 13514, 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, 221, 199, 3, 2047, 1077, 1172, 3086, 282, 1331, 402, 314, 1664, 1696, 1684, 844, 199, 3, 3180, 543, 1664, 13514, 27, 1937, 314, 570, 9685, 14, 221, 982, 440, 12, 2218, 370, 199, 3, 314, 2868, 2290, 2752, 12, 3277, 2020, 8026, 11236, 14259, 12, 199, 3, 8226, 12, 4828, 11315, 13, 10067, 12, 8217, 14, 199, 3, 9948, 199, 504, 24526, 492, 7192, 12, 7192, 63, 2796, 199, 504, 10933, 492, 10933, 199, 646, 20545, 63, 9676, 199, 199, 533, 511, 63, 1618, 6428, 63, 3176, 63, 17918, 334, 2587, 63, 2796, 14, 1746, 304, 339, 347, 3613, 334, 277, 304, 267, 291, 14, 5842, 275, 7192, 14, 2119, 63, 1457, 6248, 339, 347, 6766, 334, 277, 304, 267, 291, 14, 5842, 275, 488, 339, 347, 5922, 8, 277, 12, 373, 16, 12, 373, 17, 12, 18160, 63, 1267, 12, 19789, 304, 267, 7070, 275, 291, 14, 5842, 267, 2928, 16, 275, 7192, 14, 4106, 63, 1365, 63, 67, 8, 86, 16, 9, 267, 2928, 17, 275, 7192, 14, 4106, 63, 1365, 63, 66, 8, 86, 17, 9, 2728, 308, 18, 86, 275, 7192, 14, 1745, 63, 475, 63, 4106, 8, 2587, 14, 12590, 63, 2587, 63, 5254, 12, 18160, 63, 1267, 9, 398, 327, 870, 298, 552, 8, 86, 9, 275, 450, 68, 2, 450, 334, 552, 8, 86, 430, 398, 1687, 275, 20545, 63, 9676, 14, 1618, 6428, 63, 3176, 63, 17918, 8, 9996, 63, 1267, 12, 19789, 9, 398, 373, 18, 83, 275, 7192, 14, 4106, 63, 475, 63, 1745, 8, 2587, 14, 12590, 63, 2587, 63, 5254, 12, 18160, 63, 1267, 9, 267, 5042, 16, 275, 7192, 14, 4106, 63, 11279, 63, 67, 342, 267, 5042, 17, 275, 7192, 14, 4106, 63, 11279, 63, 66, 342, 398, 7070, 14, 2242, 8, 2164, 16, 12, 308, 18, 86, 12, 334, 411, 12, 378, 430, 267, 7070, 14, 2242, 8, 2164, 17, 12, 334, 411, 12, 413, 430, 267, 7070, 14, 2242, 1332, 411, 12, 378, 395, 373, 18, 83, 12, 5042, 16, 9, 267, 7070, 14, 2242, 1332, 411, 12, 413, 395, 5042, 17, 9, 398, 7070, 14, 1065, 342, 267, 519, 16, 275, 5042, 16, 14, 576, 342, 267, 519, 16, 86, 275, 942, 267, 367, 284, 315, 1425, 8, 552, 8, 82, 16, 28428, 9996, 63, 1267, 304, 288, 519, 16, 86, 14, 740, 8, 82, 16, 59, 73, 10, 9996, 63, 1267, 20334, 73, 11, 17, 3342, 9996, 63, 1267, 566, 10631, 519, 17, 275, 5042, 17, 14, 576, 342, 267, 291, 14, 629, 8, 552, 8, 82, 16, 86, 395, 822, 8, 82, 17, 430, 267, 372, 334, 82, 17, 12, 519, 16, 86, 9, 5493, 347, 1104, 63, 1431, 8, 277, 12, 3503, 12, 1420, 63, 513, 304, 267, 9877, 275, 942, 267, 2341, 8, 2734, 671, 26, 9877, 14, 740, 8, 88, 395, 1420, 63, 513, 9, 267, 291, 14, 629, 8, 6514, 12, 9877, 9, 2378, 327, 5620, 339, 347, 511, 63, 1493, 8, 277, 304, 267, 327, 949, 19789, 12, 413, 5272, 4886, 83, 398, 19789, 275, 6248, 267, 18160, 63, 1267, 275, 1695, 267, 302, 4749, 83, 275, 1695, 267, 373, 275, 942, 267, 299, 275, 942, 267, 367, 284, 315, 1425, 8, 78, 4749, 83, 304, 288, 307, 275, 18160, 63, 1267, 10, 7528, 73, 435, 284, 10, 17, 74, 1874, 288, 299, 14, 740, 8, 2960, 8, 84, 430, 288, 373, 847, 307, 398, 299, 275, 2008, 8, 80, 9, 10631, 519, 275, 291, 14, 3676, 8, 86, 12, 302, 4749, 83, 23033, 17, 467, 18160, 63, 1267, 12, 19789, 9, 267, 327, 10933, 8, 82, 9, 398, 291, 14, 629, 8, 82, 59, 16, 467, 2008, 8, 78, 4749, 83, 23033, 17, 2459, 267, 291, 14, 1074, 63, 1431, 8, 82, 59, 17, 467, 334, 80, 59, 16, 467, 80, 59, 17, 467, 80, 59, 18, 467, 80, 59, 19, 467, 80, 59, 20, 467, 80, 59, 21, 467, 80, 59, 22, 467, 80, 59, 23, 2459, 1467, 339, 347, 511, 63, 4587, 8, 277, 304, 267, 327, 413, 5272, 19789, 12, 413, 5272, 4886, 83, 267, 19789, 275, 3666, 1960, 12, 14313, 12, 12996, 12, 22363, 12, 21083, 12, 20462, 12, 23746, 12, 23543, 16945, 267, 299, 16, 275, 19789, 59, 16, 61, 267, 18160, 63, 1267, 275, 1695, 267, 302, 4749, 83, 275, 1695, 267, 373, 275, 942, 267, 299, 275, 942, 267, 367, 284, 315, 1425, 8, 78, 4749, 83, 304, 288, 307, 275, 18160, 63, 1267, 10, 7528, 73, 435, 284, 10, 17, 74, 1874, 288, 299, 14, 740, 8, 2960, 8, 84, 430, 288, 373, 847, 307, 199, 2728, 519, 275, 291, 14, 3676, 8, 86, 12, 302, 4749, 83, 23033, 17, 467, 18160, 63, 1267, 12, 19789, 9, 398, 291, 14, 629, 8, 82, 59, 16, 467, 2008, 8, 78, 4749, 83, 23033, 17, 12, 378, 2459, 267, 291, 14, 1074, 63, 1431, 8, 82, 59, 17, 467, 334, 80, 16, 12, 299, 59, 16, 467, 1816, 299, 16, 12, 299, 59, 17, 467, 1816, 299, 16, 12, 299, 59, 18, 467, 1816, 299, 16, 12, 299, 59, 19, 467, 1816, 299, 16, 12, 299, 59, 20, 467, 1816, 299, 16, 12, 299, 59, 21, 467, 1816, 299, 16, 12, 299, 59, 22 ]
[ 2647, 15, 1393, 15, 1813, 2366, 199, 3, 199, 3, 1898, 10219, 12, 6542, 12, 8128, 2868, 2290, 2752, 12, 3277, 14, 199, 3, 221, 199, 3, 961, 570, 365, 1777, 402, 1664, 13514, 199, 3, 221, 199, 3, 1664, 13514, 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, 12, 503, 334, 292, 2195, 945, 9, 199, 3, 1263, 2945, 1015, 14, 199, 3, 221, 199, 3, 1664, 13514, 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, 221, 199, 3, 2047, 1077, 1172, 3086, 282, 1331, 402, 314, 1664, 1696, 1684, 844, 199, 3, 3180, 543, 1664, 13514, 27, 1937, 314, 570, 9685, 14, 221, 982, 440, 12, 2218, 370, 199, 3, 314, 2868, 2290, 2752, 12, 3277, 2020, 8026, 11236, 14259, 12, 199, 3, 8226, 12, 4828, 11315, 13, 10067, 12, 8217, 14, 199, 3, 9948, 199, 504, 24526, 492, 7192, 12, 7192, 63, 2796, 199, 504, 10933, 492, 10933, 199, 646, 20545, 63, 9676, 199, 199, 533, 511, 63, 1618, 6428, 63, 3176, 63, 17918, 334, 2587, 63, 2796, 14, 1746, 304, 339, 347, 3613, 334, 277, 304, 267, 291, 14, 5842, 275, 7192, 14, 2119, 63, 1457, 6248, 339, 347, 6766, 334, 277, 304, 267, 291, 14, 5842, 275, 488, 339, 347, 5922, 8, 277, 12, 373, 16, 12, 373, 17, 12, 18160, 63, 1267, 12, 19789, 304, 267, 7070, 275, 291, 14, 5842, 267, 2928, 16, 275, 7192, 14, 4106, 63, 1365, 63, 67, 8, 86, 16, 9, 267, 2928, 17, 275, 7192, 14, 4106, 63, 1365, 63, 66, 8, 86, 17, 9, 2728, 308, 18, 86, 275, 7192, 14, 1745, 63, 475, 63, 4106, 8, 2587, 14, 12590, 63, 2587, 63, 5254, 12, 18160, 63, 1267, 9, 398, 327, 870, 298, 552, 8, 86, 9, 275, 450, 68, 2, 450, 334, 552, 8, 86, 430, 398, 1687, 275, 20545, 63, 9676, 14, 1618, 6428, 63, 3176, 63, 17918, 8, 9996, 63, 1267, 12, 19789, 9, 398, 373, 18, 83, 275, 7192, 14, 4106, 63, 475, 63, 1745, 8, 2587, 14, 12590, 63, 2587, 63, 5254, 12, 18160, 63, 1267, 9, 267, 5042, 16, 275, 7192, 14, 4106, 63, 11279, 63, 67, 342, 267, 5042, 17, 275, 7192, 14, 4106, 63, 11279, 63, 66, 342, 398, 7070, 14, 2242, 8, 2164, 16, 12, 308, 18, 86, 12, 334, 411, 12, 378, 430, 267, 7070, 14, 2242, 8, 2164, 17, 12, 334, 411, 12, 413, 430, 267, 7070, 14, 2242, 1332, 411, 12, 378, 395, 373, 18, 83, 12, 5042, 16, 9, 267, 7070, 14, 2242, 1332, 411, 12, 413, 395, 5042, 17, 9, 398, 7070, 14, 1065, 342, 267, 519, 16, 275, 5042, 16, 14, 576, 342, 267, 519, 16, 86, 275, 942, 267, 367, 284, 315, 1425, 8, 552, 8, 82, 16, 28428, 9996, 63, 1267, 304, 288, 519, 16, 86, 14, 740, 8, 82, 16, 59, 73, 10, 9996, 63, 1267, 20334, 73, 11, 17, 3342, 9996, 63, 1267, 566, 10631, 519, 17, 275, 5042, 17, 14, 576, 342, 267, 291, 14, 629, 8, 552, 8, 82, 16, 86, 395, 822, 8, 82, 17, 430, 267, 372, 334, 82, 17, 12, 519, 16, 86, 9, 5493, 347, 1104, 63, 1431, 8, 277, 12, 3503, 12, 1420, 63, 513, 304, 267, 9877, 275, 942, 267, 2341, 8, 2734, 671, 26, 9877, 14, 740, 8, 88, 395, 1420, 63, 513, 9, 267, 291, 14, 629, 8, 6514, 12, 9877, 9, 2378, 327, 5620, 339, 347, 511, 63, 1493, 8, 277, 304, 267, 327, 949, 19789, 12, 413, 5272, 4886, 83, 398, 19789, 275, 6248, 267, 18160, 63, 1267, 275, 1695, 267, 302, 4749, 83, 275, 1695, 267, 373, 275, 942, 267, 299, 275, 942, 267, 367, 284, 315, 1425, 8, 78, 4749, 83, 304, 288, 307, 275, 18160, 63, 1267, 10, 7528, 73, 435, 284, 10, 17, 74, 1874, 288, 299, 14, 740, 8, 2960, 8, 84, 430, 288, 373, 847, 307, 398, 299, 275, 2008, 8, 80, 9, 10631, 519, 275, 291, 14, 3676, 8, 86, 12, 302, 4749, 83, 23033, 17, 467, 18160, 63, 1267, 12, 19789, 9, 267, 327, 10933, 8, 82, 9, 398, 291, 14, 629, 8, 82, 59, 16, 467, 2008, 8, 78, 4749, 83, 23033, 17, 2459, 267, 291, 14, 1074, 63, 1431, 8, 82, 59, 17, 467, 334, 80, 59, 16, 467, 80, 59, 17, 467, 80, 59, 18, 467, 80, 59, 19, 467, 80, 59, 20, 467, 80, 59, 21, 467, 80, 59, 22, 467, 80, 59, 23, 2459, 1467, 339, 347, 511, 63, 4587, 8, 277, 304, 267, 327, 413, 5272, 19789, 12, 413, 5272, 4886, 83, 267, 19789, 275, 3666, 1960, 12, 14313, 12, 12996, 12, 22363, 12, 21083, 12, 20462, 12, 23746, 12, 23543, 16945, 267, 299, 16, 275, 19789, 59, 16, 61, 267, 18160, 63, 1267, 275, 1695, 267, 302, 4749, 83, 275, 1695, 267, 373, 275, 942, 267, 299, 275, 942, 267, 367, 284, 315, 1425, 8, 78, 4749, 83, 304, 288, 307, 275, 18160, 63, 1267, 10, 7528, 73, 435, 284, 10, 17, 74, 1874, 288, 299, 14, 740, 8, 2960, 8, 84, 430, 288, 373, 847, 307, 199, 2728, 519, 275, 291, 14, 3676, 8, 86, 12, 302, 4749, 83, 23033, 17, 467, 18160, 63, 1267, 12, 19789, 9, 398, 291, 14, 629, 8, 82, 59, 16, 467, 2008, 8, 78, 4749, 83, 23033, 17, 12, 378, 2459, 267, 291, 14, 1074, 63, 1431, 8, 82, 59, 17, 467, 334, 80, 16, 12, 299, 59, 16, 467, 1816, 299, 16, 12, 299, 59, 17, 467, 1816, 299, 16, 12, 299, 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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 ]
Ichag/django-timelinejs3
timeline/migrations/0009_auto_20150819_0648.py
1
3020
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations class Migration(migrations.Migration): dependencies = [ ('timeline', '0008_auto_20150818_2241'), ] operations = [ migrations.AlterField( model_name='options', name='duration', field=models.IntegerField(null=True, blank=True), ), migrations.AlterField( model_name='options', name='height', field=models.IntegerField(null=True, blank=True), ), migrations.AlterField( model_name='options', name='marker_height_min', field=models.IntegerField(null=True, blank=True), ), migrations.AlterField( model_name='options', name='marker_padding', field=models.IntegerField(null=True, blank=True), ), migrations.AlterField( model_name='options', name='marker_width_min', field=models.IntegerField(null=True, blank=True), ), migrations.AlterField( model_name='options', name='menubar_height', field=models.IntegerField(null=True, blank=True), ), migrations.AlterField( model_name='options', name='optimal_tick_width', field=models.IntegerField(null=True, blank=True), ), migrations.AlterField( model_name='options', name='scale_factor', field=models.IntegerField(null=True, blank=True), ), migrations.AlterField( model_name='options', name='skinny_size', field=models.IntegerField(null=True, blank=True), ), migrations.AlterField( model_name='options', name='slide_default_fade', field=models.IntegerField(null=True, blank=True), ), migrations.AlterField( model_name='options', name='slide_padding_lr', field=models.IntegerField(null=True, blank=True), ), migrations.AlterField( model_name='options', name='start_at_slide', field=models.IntegerField(null=True, blank=True), ), migrations.AlterField( model_name='options', name='timenav_height', field=models.IntegerField(null=True, blank=True), ), migrations.AlterField( model_name='options', name='timenav_height_min', field=models.IntegerField(null=True, blank=True), ), migrations.AlterField( model_name='options', name='timenav_height_percentage', field=models.IntegerField(null=True, blank=True), ), migrations.AlterField( model_name='options', name='width', field=models.IntegerField(null=True, blank=True), ), ]
bsd-3-clause
[ 3, 1882, 2803, 26, 2774, 13, 24, 1882, 199, 504, 636, 2443, 363, 492, 2649, 63, 5955, 199, 199, 504, 1639, 14, 697, 492, 1709, 12, 6180, 421, 199, 533, 12090, 8, 7685, 14, 9816, 304, 339, 5124, 275, 359, 267, 661, 19369, 297, 283, 19141, 63, 2495, 63, 1797, 14585, 1085, 63, 1081, 2953, 659, 272, 1622, 339, 5331, 275, 359, 267, 6180, 14, 19275, 8, 288, 1402, 63, 354, 534, 1419, 297, 288, 536, 534, 5553, 297, 288, 901, 29, 992, 14, 3901, 8, 2307, 29, 549, 12, 4596, 29, 549, 395, 267, 2318, 267, 6180, 14, 19275, 8, 288, 1402, 63, 354, 534, 1419, 297, 288, 536, 534, 3333, 297, 288, 901, 29, 992, 14, 3901, 8, 2307, 29, 549, 12, 4596, 29, 549, 395, 267, 2318, 267, 6180, 14, 19275, 8, 288, 1402, 63, 354, 534, 1419, 297, 288, 536, 534, 4211, 63, 3333, 63, 827, 297, 288, 901, 29, 992, 14, 3901, 8, 2307, 29, 549, 12, 4596, 29, 549, 395, 267, 2318, 267, 6180, 14, 19275, 8, 288, 1402, 63, 354, 534, 1419, 297, 288, 536, 534, 4211, 63, 8358, 297, 288, 901, 29, 992, 14, 3901, 8, 2307, 29, 549, 12, 4596, 29, 549, 395, 267, 2318, 267, 6180, 14, 19275, 8, 288, 1402, 63, 354, 534, 1419, 297, 288, 536, 534, 4211, 63, 2063, 63, 827, 297, 288, 901, 29, 992, 14, 3901, 8, 2307, 29, 549, 12, 4596, 29, 549, 395, 267, 2318, 267, 6180, 14, 19275, 8, 288, 1402, 63, 354, 534, 1419, 297, 288, 536, 534, 31680, 63, 3333, 297, 288, 901, 29, 992, 14, 3901, 8, 2307, 29, 549, 12, 4596, 29, 549, 395, 267, 2318, 267, 6180, 14, 19275, 8, 288, 1402, 63, 354, 534, 1419, 297, 288, 536, 534, 411, 16757, 63, 8284, 63, 2063, 297, 288, 901, 29, 992, 14, 3901, 8, 2307, 29, 549, 12, 4596, 29, 549, 395, 267, 2318, 267, 6180, 14, 19275, 8, 288, 1402, 63, 354, 534, 1419, 297, 288, 536, 534, 3467, 63, 4778, 297, 288, 901, 29, 992, 14, 3901, 8, 2307, 29, 549, 12, 4596, 29, 549, 395, 267, 2318, 267, 6180, 14, 19275, 8, 288, 1402, 63, 354, 534, 1419, 297, 288, 536, 534, 16409, 9745, 63, 890, 297, 288, 901, 29, 992, 14, 3901, 8, 2307, 29, 549, 12, 4596, 29, 549, 395, 267, 2318, 267, 6180, 14, 19275, 8, 288, 1402, 63, 354, 534, 1419, 297, 288, 536, 534, 19968, 63, 885, 63, 667, 271, 297, 288, 901, 29, 992, 14, 3901, 8, 2307, 29, 549, 12, 4596, 29, 549, 395, 267, 2318, 267, 6180, 14, 19275, 8, 288, 1402, 63, 354, 534, 1419, 297, 288, 536, 534, 19968, 63, 8358, 63, 7493, 297, 288, 901, 29, 992, 14, 3901, 8, 2307, 29, 549, 12, 4596, 29, 549, 395, 267, 2318, 267, 6180, 14, 19275, 8, 288, 1402, 63, 354, 534, 1419, 297, 288, 536, 534, 928, 63, 292, 63, 19968, 297, 288, 901, 29, 992, 14, 3901, 8, 2307, 29, 549, 12, 4596, 29, 549, 395, 267, 2318, 267, 6180, 14, 19275, 8, 288, 1402, 63, 354, 534, 1419, 297, 288, 536, 534, 521, 10927, 63, 3333, 297, 288, 901, 29, 992, 14, 3901, 8, 2307, 29, 549, 12, 4596, 29, 549, 395, 267, 2318, 267, 6180, 14, 19275, 8, 288, 1402, 63, 354, 534, 1419, 297, 288, 536, 534, 521, 10927, 63, 3333, 63, 827, 297, 288, 901, 29, 992, 14, 3901, 8, 2307, 29, 549, 12, 4596, 29, 549, 395, 267, 2318, 267, 6180, 14, 19275, 8, 288, 1402, 63, 354, 534, 1419, 297, 288, 536, 534, 521, 10927, 63, 3333, 63, 14200, 297, 288, 901, 29, 992, 14, 3901, 8, 2307, 29, 549, 12, 4596, 29, 549, 395, 267, 2318, 267, 6180, 14, 19275, 8, 288, 1402, 63, 354, 534, 1419, 297, 288, 536, 534, 2063, 297, 288, 901, 29, 992, 14, 3901, 8, 2307, 29, 549, 12, 4596, 29, 549, 395, 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, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 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, 504, 636, 2443, 363, 492, 2649, 63, 5955, 199, 199, 504, 1639, 14, 697, 492, 1709, 12, 6180, 421, 199, 533, 12090, 8, 7685, 14, 9816, 304, 339, 5124, 275, 359, 267, 661, 19369, 297, 283, 19141, 63, 2495, 63, 1797, 14585, 1085, 63, 1081, 2953, 659, 272, 1622, 339, 5331, 275, 359, 267, 6180, 14, 19275, 8, 288, 1402, 63, 354, 534, 1419, 297, 288, 536, 534, 5553, 297, 288, 901, 29, 992, 14, 3901, 8, 2307, 29, 549, 12, 4596, 29, 549, 395, 267, 2318, 267, 6180, 14, 19275, 8, 288, 1402, 63, 354, 534, 1419, 297, 288, 536, 534, 3333, 297, 288, 901, 29, 992, 14, 3901, 8, 2307, 29, 549, 12, 4596, 29, 549, 395, 267, 2318, 267, 6180, 14, 19275, 8, 288, 1402, 63, 354, 534, 1419, 297, 288, 536, 534, 4211, 63, 3333, 63, 827, 297, 288, 901, 29, 992, 14, 3901, 8, 2307, 29, 549, 12, 4596, 29, 549, 395, 267, 2318, 267, 6180, 14, 19275, 8, 288, 1402, 63, 354, 534, 1419, 297, 288, 536, 534, 4211, 63, 8358, 297, 288, 901, 29, 992, 14, 3901, 8, 2307, 29, 549, 12, 4596, 29, 549, 395, 267, 2318, 267, 6180, 14, 19275, 8, 288, 1402, 63, 354, 534, 1419, 297, 288, 536, 534, 4211, 63, 2063, 63, 827, 297, 288, 901, 29, 992, 14, 3901, 8, 2307, 29, 549, 12, 4596, 29, 549, 395, 267, 2318, 267, 6180, 14, 19275, 8, 288, 1402, 63, 354, 534, 1419, 297, 288, 536, 534, 31680, 63, 3333, 297, 288, 901, 29, 992, 14, 3901, 8, 2307, 29, 549, 12, 4596, 29, 549, 395, 267, 2318, 267, 6180, 14, 19275, 8, 288, 1402, 63, 354, 534, 1419, 297, 288, 536, 534, 411, 16757, 63, 8284, 63, 2063, 297, 288, 901, 29, 992, 14, 3901, 8, 2307, 29, 549, 12, 4596, 29, 549, 395, 267, 2318, 267, 6180, 14, 19275, 8, 288, 1402, 63, 354, 534, 1419, 297, 288, 536, 534, 3467, 63, 4778, 297, 288, 901, 29, 992, 14, 3901, 8, 2307, 29, 549, 12, 4596, 29, 549, 395, 267, 2318, 267, 6180, 14, 19275, 8, 288, 1402, 63, 354, 534, 1419, 297, 288, 536, 534, 16409, 9745, 63, 890, 297, 288, 901, 29, 992, 14, 3901, 8, 2307, 29, 549, 12, 4596, 29, 549, 395, 267, 2318, 267, 6180, 14, 19275, 8, 288, 1402, 63, 354, 534, 1419, 297, 288, 536, 534, 19968, 63, 885, 63, 667, 271, 297, 288, 901, 29, 992, 14, 3901, 8, 2307, 29, 549, 12, 4596, 29, 549, 395, 267, 2318, 267, 6180, 14, 19275, 8, 288, 1402, 63, 354, 534, 1419, 297, 288, 536, 534, 19968, 63, 8358, 63, 7493, 297, 288, 901, 29, 992, 14, 3901, 8, 2307, 29, 549, 12, 4596, 29, 549, 395, 267, 2318, 267, 6180, 14, 19275, 8, 288, 1402, 63, 354, 534, 1419, 297, 288, 536, 534, 928, 63, 292, 63, 19968, 297, 288, 901, 29, 992, 14, 3901, 8, 2307, 29, 549, 12, 4596, 29, 549, 395, 267, 2318, 267, 6180, 14, 19275, 8, 288, 1402, 63, 354, 534, 1419, 297, 288, 536, 534, 521, 10927, 63, 3333, 297, 288, 901, 29, 992, 14, 3901, 8, 2307, 29, 549, 12, 4596, 29, 549, 395, 267, 2318, 267, 6180, 14, 19275, 8, 288, 1402, 63, 354, 534, 1419, 297, 288, 536, 534, 521, 10927, 63, 3333, 63, 827, 297, 288, 901, 29, 992, 14, 3901, 8, 2307, 29, 549, 12, 4596, 29, 549, 395, 267, 2318, 267, 6180, 14, 19275, 8, 288, 1402, 63, 354, 534, 1419, 297, 288, 536, 534, 521, 10927, 63, 3333, 63, 14200, 297, 288, 901, 29, 992, 14, 3901, 8, 2307, 29, 549, 12, 4596, 29, 549, 395, 267, 2318, 267, 6180, 14, 19275, 8, 288, 1402, 63, 354, 534, 1419, 297, 288, 536, 534, 2063, 297, 288, 901, 29, 992, 14, 3901, 8, 2307, 29, 549, 12, 4596, 29, 549, 395, 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, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 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 ]
std05048/Thesis
.waf-1.7.13-5a064c2686fe54de4e11018d22148cfc/waflib/Tools/errcheck.py
331
5821
#! /usr/bin/env python # encoding: utf-8 # WARNING! Do not edit! http://waf.googlecode.com/git/docs/wafbook/single.html#_obtaining_the_waf_file typos={'feature':'features','sources':'source','targets':'target','include':'includes','export_include':'export_includes','define':'defines','importpath':'includes','installpath':'install_path','iscopy':'is_copy',} meths_typos=['__call__','program','shlib','stlib','objects'] from waflib import Logs,Build,Node,Task,TaskGen,ConfigSet,Errors,Utils import waflib.Tools.ccroot def check_same_targets(self): mp=Utils.defaultdict(list) uids={} def check_task(tsk): if not isinstance(tsk,Task.Task): return for node in tsk.outputs: mp[node].append(tsk) try: uids[tsk.uid()].append(tsk) except KeyError: uids[tsk.uid()]=[tsk] for g in self.groups: for tg in g: try: for tsk in tg.tasks: check_task(tsk) except AttributeError: check_task(tg) dupe=False for(k,v)in mp.items(): if len(v)>1: dupe=True msg='* Node %r is created more than once%s. The task generators are:'%(k,Logs.verbose==1 and" (full message on 'waf -v -v')"or"") Logs.error(msg) for x in v: if Logs.verbose>1: Logs.error(' %d. %r'%(1+v.index(x),x.generator)) else: Logs.error(' %d. %r in %r'%(1+v.index(x),x.generator.name,getattr(x.generator,'path',None))) if not dupe: for(k,v)in uids.items(): if len(v)>1: Logs.error('* Several tasks use the same identifier. Please check the information on\n http://docs.waf.googlecode.com/git/apidocs_16/Task.html#waflib.Task.Task.uid') for tsk in v: Logs.error(' - object %r (%r) defined in %r'%(tsk.__class__.__name__,tsk,tsk.generator)) def check_invalid_constraints(self): feat=set([]) for x in list(TaskGen.feats.values()): feat.union(set(x)) for(x,y)in TaskGen.task_gen.prec.items(): feat.add(x) feat.union(set(y)) ext=set([]) for x in TaskGen.task_gen.mappings.values(): ext.add(x.__name__) invalid=ext&feat if invalid: Logs.error('The methods %r have invalid annotations: @extension <-> @feature/@before_method/@after_method'%list(invalid)) for cls in list(Task.classes.values()): for x in('before','after'): for y in Utils.to_list(getattr(cls,x,[])): if not Task.classes.get(y,None): Logs.error('Erroneous order constraint %r=%r on task class %r'%(x,y,cls.__name__)) if getattr(cls,'rule',None): Logs.error('Erroneous attribute "rule" on task class %r (rename to "run_str")'%cls.__name__) def replace(m): oldcall=getattr(Build.BuildContext,m) def call(self,*k,**kw): ret=oldcall(self,*k,**kw) for x in typos: if x in kw: if x=='iscopy'and'subst'in getattr(self,'features',''): continue err=True Logs.error('Fix the typo %r -> %r on %r'%(x,typos[x],ret)) return ret setattr(Build.BuildContext,m,call) def enhance_lib(): for m in meths_typos: replace(m) def ant_glob(self,*k,**kw): if k: lst=Utils.to_list(k[0]) for pat in lst: if'..'in pat.split('/'): Logs.error("In ant_glob pattern %r: '..' means 'two dots', not 'parent directory'"%k[0]) if kw.get('remove',True): try: if self.is_child_of(self.ctx.bldnode)and not kw.get('quiet',False): Logs.error('Using ant_glob on the build folder (%r) is dangerous (quiet=True to disable this warning)'%self) except AttributeError: pass return self.old_ant_glob(*k,**kw) Node.Node.old_ant_glob=Node.Node.ant_glob Node.Node.ant_glob=ant_glob old=Task.is_before def is_before(t1,t2): ret=old(t1,t2) if ret and old(t2,t1): Logs.error('Contradictory order constraints in classes %r %r'%(t1,t2)) return ret Task.is_before=is_before def check_err_features(self): lst=self.to_list(self.features) if'shlib'in lst: Logs.error('feature shlib -> cshlib, dshlib or cxxshlib') for x in('c','cxx','d','fc'): if not x in lst and lst and lst[0]in[x+y for y in('program','shlib','stlib')]: Logs.error('%r features is probably missing %r'%(self,x)) TaskGen.feature('*')(check_err_features) def check_err_order(self): if not hasattr(self,'rule')and not'subst'in Utils.to_list(self.features): for x in('before','after','ext_in','ext_out'): if hasattr(self,x): Logs.warn('Erroneous order constraint %r on non-rule based task generator %r'%(x,self)) else: for x in('before','after'): for y in self.to_list(getattr(self,x,[])): if not Task.classes.get(y,None): Logs.error('Erroneous order constraint %s=%r on %r (no such class)'%(x,y,self)) TaskGen.feature('*')(check_err_order) def check_compile(self): check_invalid_constraints(self) try: ret=self.orig_compile() finally: check_same_targets(self) return ret Build.BuildContext.orig_compile=Build.BuildContext.compile Build.BuildContext.compile=check_compile def use_rec(self,name,**kw): try: y=self.bld.get_tgen_by_name(name) except Errors.WafError: pass else: idx=self.bld.get_group_idx(self) odx=self.bld.get_group_idx(y) if odx>idx: msg="Invalid 'use' across build groups:" if Logs.verbose>1: msg+='\n target %r\n uses:\n %r'%(self,y) else: msg+=" %r uses %r (try 'waf -v -v' for the full error)"%(self.name,name) raise Errors.WafError(msg) self.orig_use_rec(name,**kw) TaskGen.task_gen.orig_use_rec=TaskGen.task_gen.use_rec TaskGen.task_gen.use_rec=use_rec def getattri(self,name,default=None): if name=='append'or name=='add': raise Errors.WafError('env.append and env.add do not exist: use env.append_value/env.append_unique') elif name=='prepend': raise Errors.WafError('env.prepend does not exist: use env.prepend_value') if name in self.__slots__: return object.__getattr__(self,name,default) else: return self[name] ConfigSet.ConfigSet.__getattr__=getattri def options(opt): enhance_lib() def configure(conf): pass
gpl-2.0
[ 3168, 1182, 2647, 15, 1393, 15, 1813, 2366, 199, 3, 2644, 26, 2774, 13, 24, 199, 3, 14750, 1, 4226, 440, 5283, 1, 1455, 921, 21500, 14, 31864, 14, 957, 15, 3187, 15, 4757, 15, 21500, 2706, 15, 4780, 14, 1360, 20930, 2873, 24522, 63, 1589, 63, 21500, 63, 493, 199, 199, 369, 1712, 3713, 4445, 5242, 3179, 1673, 4553, 5242, 1365, 1673, 4684, 5242, 1375, 1673, 2613, 5242, 9441, 1673, 3790, 63, 2613, 5242, 3790, 63, 9441, 1673, 4640, 5242, 14334, 1673, 646, 515, 5242, 9441, 1673, 3174, 515, 5242, 3174, 63, 515, 1673, 374, 1574, 5242, 374, 63, 1574, 297, 93, 199, 5247, 83, 63, 369, 1712, 2968, 363, 1250, 363, 1673, 6815, 1673, 609, 773, 1673, 270, 773, 1673, 1462, 418, 199, 504, 31380, 492, 3835, 458, 12, 3425, 12, 1716, 12, 4476, 12, 4476, 8168, 12, 2028, 1084, 12, 9298, 12, 7535, 199, 646, 31380, 14, 11654, 14, 2055, 1231, 199, 318, 1104, 63, 7191, 63, 4684, 8, 277, 304, 199, 198, 311, 29, 7535, 14, 21501, 8, 513, 9, 199, 198, 27637, 7622, 199, 198, 318, 1104, 63, 1765, 8, 21563, 304, 507, 198, 692, 440, 1228, 8, 21563, 12, 4476, 14, 4476, 304, 686, 198, 1107, 507, 198, 509, 1031, 315, 307, 1339, 14, 4467, 26, 686, 198, 311, 59, 932, 1055, 740, 8, 21563, 9, 507, 198, 893, 26, 686, 198, 27637, 59, 21563, 14, 1535, 342, 1055, 740, 8, 21563, 9, 507, 198, 2590, 4067, 26, 686, 198, 27637, 59, 21563, 14, 1535, 5106, 1524, 21563, 61, 199, 198, 509, 486, 315, 291, 14, 2634, 26, 507, 198, 509, 22387, 315, 486, 26, 686, 198, 893, 26, 1585, 198, 509, 307, 1339, 315, 22387, 14, 5054, 26, 1871, 198, 1074, 63, 1765, 8, 21563, 9, 686, 198, 2590, 4281, 26, 1585, 198, 1074, 63, 1765, 8, 17699, 9, 199, 198, 30706, 29, 797, 199, 198, 509, 8, 75, 12, 86, 9, 262, 6118, 14, 1744, 837, 507, 198, 692, 822, 8, 86, 13032, 17, 26, 686, 198, 30706, 29, 549, 686, 198, 1328, 534, 10, 5013, 450, 82, 365, 2737, 1655, 2419, 5403, 5, 83, 14, 710, 2120, 16952, 787, 4881, 2840, 75, 12, 16333, 14, 3832, 389, 17, 436, 2, 334, 2861, 1245, 641, 283, 21500, 446, 86, 446, 86, 19124, 269, 7230, 686, 198, 16333, 14, 705, 8, 1328, 9, 686, 198, 509, 671, 315, 373, 26, 1585, 198, 692, 3835, 458, 14, 3832, 30, 17, 26, 1871, 198, 16333, 14, 705, 360, 221, 450, 68, 14, 450, 82, 13328, 17, 11, 86, 14, 1080, 8, 88, 395, 88, 14, 4679, 430, 1585, 198, 2836, 26, 1871, 198, 16333, 14, 705, 360, 221, 450, 68, 14, 450, 82, 315, 450, 82, 13328, 17, 11, 86, 14, 1080, 8, 88, 395, 88, 14, 4679, 14, 354, 12, 5675, 8, 88, 14, 4679, 2584, 515, 297, 403, 1724, 199, 198, 692, 440, 15776, 321, 26, 507, 198, 509, 8, 75, 12, 86, 9, 262, 399, 1580, 14, 1744, 837, 686, 198, 692, 822, 8, 86, 13032, 17, 26, 1585, 198, 16333, 14, 705, 18225, 3240, 422, 279, 6527, 675, 314, 2011, 5148, 14, 7754, 1104, 314, 2556, 641, 60, 78, 257, 1455, 921, 4757, 14, 21500, 14, 31864, 14, 957, 15, 3187, 15, 27703, 14851, 63, 975, 15, 4476, 14, 1360, 3, 21500, 773, 14, 4476, 14, 4476, 14, 1535, 358, 1585, 198, 509, 307, 1339, 315, 373, 26, 1871, 198, 16333, 14, 705, 360, 221, 446, 909, 450, 82, 4366, 82, 9, 3247, 315, 450, 82, 13328, 21563, 855, 533, 4914, 354, 3108, 21563, 12, 21563, 14, 4679, 430, 199, 318, 1104, 63, 3197, 63, 9882, 8, 277, 304, 199, 198, 11873, 29, 409, 4157, 199, 198, 509, 671, 315, 769, 8, 4476, 8168, 14, 29255, 14, 1459, 5109, 507, 198, 11873, 14, 8888, 8, 409, 8, 88, 430, 199, 198, 509, 8, 88, 12, 89, 9, 262, 8495, 8168, 14, 1765, 63, 2268, 14, 9218, 14, 1744, 837, 507, 198, 11873, 14, 525, 8, 88, 9, 507, 198, 11873, 14, 8888, 8, 409, 8, 89, 430, 199, 198, 832, 29, 409, 4157, 199, 198, 509, 671, 315, 8495, 8168, 14, 1765, 63, 2268, 14, 14632, 14, 1459, 837, 507, 198, 832, 14, 525, 8, 88, 855, 354, 3368, 199, 198, 3197, 29, 832, 6, 11873, 199, 198, 692, 3866, 26, 507, 198, 16333, 14, 705, 360, 1918, 3102, 450, 82, 1172, 3866, 15538, 26, 221, 768, 3435, 665, 5118, 768, 4445, 15, 32, 5182, 63, 765, 15, 32, 4399, 63, 765, 5956, 513, 8, 3197, 430, 199, 198, 509, 843, 315, 769, 8, 4476, 14, 2888, 14, 1459, 5109, 507, 198, 509, 671, 315, 360, 5182, 1673, 4399, 735, 686, 198, 509, 612, 315, 17397, 14, 475, 63, 513, 8, 5675, 8, 1886, 12, 88, 14343, 18710, 1585, 198, 692, 440, 8495, 14, 2888, 14, 362, 8, 89, 12, 403, 304, 1871, 198, 16333, 14, 705, 360, 5432, 368, 1785, 1865, 5828, 450, 82, 2458, 82, 641, 2120, 1021, 450, 82, 13328, 88, 12, 89, 12, 1886, 855, 354, 8964, 507, 198, 692, 2519, 8, 1886, 2584, 2200, 297, 403, 304, 686, 198, 16333, 14, 705, 360, 5432, 368, 1785, 2225, 298, 2200, 2, 641, 2120, 1021, 450, 82, 334, 8165, 370, 298, 1065, 63, 495, 531, 5956, 1886, 855, 354, 3368, 199, 318, 3350, 8, 77, 304, 199, 198, 1753, 1250, 29, 5675, 8, 3425, 14, 3425, 2998, 12, 77, 9, 199, 198, 318, 1240, 8, 277, 19166, 75, 12663, 829, 304, 507, 198, 3292, 29, 1753, 1250, 8, 277, 19166, 75, 12663, 829, 9, 507, 198, 509, 671, 315, 10284, 1712, 26, 686, 198, 692, 671, 315, 4775, 26, 1585, 198, 692, 671, 6803, 374, 1574, 7, 460, 1159, 456, 270, 7, 262, 2519, 8, 277, 2584, 3179, 1673, 735, 1871, 198, 6958, 1585, 198, 1508, 29, 549, 1585, 198, 16333, 14, 705, 360, 11985, 314, 24013, 450, 82, 1035, 450, 82, 641, 450, 82, 13328, 88, 12, 369, 1712, 59, 88, 467, 3292, 430, 507, 198, 1107, 2203, 199, 198, 10202, 8, 3425, 14, 3425, 2998, 12, 77, 12, 1250, 9, 199, 318, 655, 14666, 63, 773, 837, 199, 198, 509 ]
[ 1182, 2647, 15, 1393, 15, 1813, 2366, 199, 3, 2644, 26, 2774, 13, 24, 199, 3, 14750, 1, 4226, 440, 5283, 1, 1455, 921, 21500, 14, 31864, 14, 957, 15, 3187, 15, 4757, 15, 21500, 2706, 15, 4780, 14, 1360, 20930, 2873, 24522, 63, 1589, 63, 21500, 63, 493, 199, 199, 369, 1712, 3713, 4445, 5242, 3179, 1673, 4553, 5242, 1365, 1673, 4684, 5242, 1375, 1673, 2613, 5242, 9441, 1673, 3790, 63, 2613, 5242, 3790, 63, 9441, 1673, 4640, 5242, 14334, 1673, 646, 515, 5242, 9441, 1673, 3174, 515, 5242, 3174, 63, 515, 1673, 374, 1574, 5242, 374, 63, 1574, 297, 93, 199, 5247, 83, 63, 369, 1712, 2968, 363, 1250, 363, 1673, 6815, 1673, 609, 773, 1673, 270, 773, 1673, 1462, 418, 199, 504, 31380, 492, 3835, 458, 12, 3425, 12, 1716, 12, 4476, 12, 4476, 8168, 12, 2028, 1084, 12, 9298, 12, 7535, 199, 646, 31380, 14, 11654, 14, 2055, 1231, 199, 318, 1104, 63, 7191, 63, 4684, 8, 277, 304, 199, 198, 311, 29, 7535, 14, 21501, 8, 513, 9, 199, 198, 27637, 7622, 199, 198, 318, 1104, 63, 1765, 8, 21563, 304, 507, 198, 692, 440, 1228, 8, 21563, 12, 4476, 14, 4476, 304, 686, 198, 1107, 507, 198, 509, 1031, 315, 307, 1339, 14, 4467, 26, 686, 198, 311, 59, 932, 1055, 740, 8, 21563, 9, 507, 198, 893, 26, 686, 198, 27637, 59, 21563, 14, 1535, 342, 1055, 740, 8, 21563, 9, 507, 198, 2590, 4067, 26, 686, 198, 27637, 59, 21563, 14, 1535, 5106, 1524, 21563, 61, 199, 198, 509, 486, 315, 291, 14, 2634, 26, 507, 198, 509, 22387, 315, 486, 26, 686, 198, 893, 26, 1585, 198, 509, 307, 1339, 315, 22387, 14, 5054, 26, 1871, 198, 1074, 63, 1765, 8, 21563, 9, 686, 198, 2590, 4281, 26, 1585, 198, 1074, 63, 1765, 8, 17699, 9, 199, 198, 30706, 29, 797, 199, 198, 509, 8, 75, 12, 86, 9, 262, 6118, 14, 1744, 837, 507, 198, 692, 822, 8, 86, 13032, 17, 26, 686, 198, 30706, 29, 549, 686, 198, 1328, 534, 10, 5013, 450, 82, 365, 2737, 1655, 2419, 5403, 5, 83, 14, 710, 2120, 16952, 787, 4881, 2840, 75, 12, 16333, 14, 3832, 389, 17, 436, 2, 334, 2861, 1245, 641, 283, 21500, 446, 86, 446, 86, 19124, 269, 7230, 686, 198, 16333, 14, 705, 8, 1328, 9, 686, 198, 509, 671, 315, 373, 26, 1585, 198, 692, 3835, 458, 14, 3832, 30, 17, 26, 1871, 198, 16333, 14, 705, 360, 221, 450, 68, 14, 450, 82, 13328, 17, 11, 86, 14, 1080, 8, 88, 395, 88, 14, 4679, 430, 1585, 198, 2836, 26, 1871, 198, 16333, 14, 705, 360, 221, 450, 68, 14, 450, 82, 315, 450, 82, 13328, 17, 11, 86, 14, 1080, 8, 88, 395, 88, 14, 4679, 14, 354, 12, 5675, 8, 88, 14, 4679, 2584, 515, 297, 403, 1724, 199, 198, 692, 440, 15776, 321, 26, 507, 198, 509, 8, 75, 12, 86, 9, 262, 399, 1580, 14, 1744, 837, 686, 198, 692, 822, 8, 86, 13032, 17, 26, 1585, 198, 16333, 14, 705, 18225, 3240, 422, 279, 6527, 675, 314, 2011, 5148, 14, 7754, 1104, 314, 2556, 641, 60, 78, 257, 1455, 921, 4757, 14, 21500, 14, 31864, 14, 957, 15, 3187, 15, 27703, 14851, 63, 975, 15, 4476, 14, 1360, 3, 21500, 773, 14, 4476, 14, 4476, 14, 1535, 358, 1585, 198, 509, 307, 1339, 315, 373, 26, 1871, 198, 16333, 14, 705, 360, 221, 446, 909, 450, 82, 4366, 82, 9, 3247, 315, 450, 82, 13328, 21563, 855, 533, 4914, 354, 3108, 21563, 12, 21563, 14, 4679, 430, 199, 318, 1104, 63, 3197, 63, 9882, 8, 277, 304, 199, 198, 11873, 29, 409, 4157, 199, 198, 509, 671, 315, 769, 8, 4476, 8168, 14, 29255, 14, 1459, 5109, 507, 198, 11873, 14, 8888, 8, 409, 8, 88, 430, 199, 198, 509, 8, 88, 12, 89, 9, 262, 8495, 8168, 14, 1765, 63, 2268, 14, 9218, 14, 1744, 837, 507, 198, 11873, 14, 525, 8, 88, 9, 507, 198, 11873, 14, 8888, 8, 409, 8, 89, 430, 199, 198, 832, 29, 409, 4157, 199, 198, 509, 671, 315, 8495, 8168, 14, 1765, 63, 2268, 14, 14632, 14, 1459, 837, 507, 198, 832, 14, 525, 8, 88, 855, 354, 3368, 199, 198, 3197, 29, 832, 6, 11873, 199, 198, 692, 3866, 26, 507, 198, 16333, 14, 705, 360, 1918, 3102, 450, 82, 1172, 3866, 15538, 26, 221, 768, 3435, 665, 5118, 768, 4445, 15, 32, 5182, 63, 765, 15, 32, 4399, 63, 765, 5956, 513, 8, 3197, 430, 199, 198, 509, 843, 315, 769, 8, 4476, 14, 2888, 14, 1459, 5109, 507, 198, 509, 671, 315, 360, 5182, 1673, 4399, 735, 686, 198, 509, 612, 315, 17397, 14, 475, 63, 513, 8, 5675, 8, 1886, 12, 88, 14343, 18710, 1585, 198, 692, 440, 8495, 14, 2888, 14, 362, 8, 89, 12, 403, 304, 1871, 198, 16333, 14, 705, 360, 5432, 368, 1785, 1865, 5828, 450, 82, 2458, 82, 641, 2120, 1021, 450, 82, 13328, 88, 12, 89, 12, 1886, 855, 354, 8964, 507, 198, 692, 2519, 8, 1886, 2584, 2200, 297, 403, 304, 686, 198, 16333, 14, 705, 360, 5432, 368, 1785, 2225, 298, 2200, 2, 641, 2120, 1021, 450, 82, 334, 8165, 370, 298, 1065, 63, 495, 531, 5956, 1886, 855, 354, 3368, 199, 318, 3350, 8, 77, 304, 199, 198, 1753, 1250, 29, 5675, 8, 3425, 14, 3425, 2998, 12, 77, 9, 199, 198, 318, 1240, 8, 277, 19166, 75, 12663, 829, 304, 507, 198, 3292, 29, 1753, 1250, 8, 277, 19166, 75, 12663, 829, 9, 507, 198, 509, 671, 315, 10284, 1712, 26, 686, 198, 692, 671, 315, 4775, 26, 1585, 198, 692, 671, 6803, 374, 1574, 7, 460, 1159, 456, 270, 7, 262, 2519, 8, 277, 2584, 3179, 1673, 735, 1871, 198, 6958, 1585, 198, 1508, 29, 549, 1585, 198, 16333, 14, 705, 360, 11985, 314, 24013, 450, 82, 1035, 450, 82, 641, 450, 82, 13328, 88, 12, 369, 1712, 59, 88, 467, 3292, 430, 507, 198, 1107, 2203, 199, 198, 10202, 8, 3425, 14, 3425, 2998, 12, 77, 12, 1250, 9, 199, 318, 655, 14666, 63, 773, 837, 199, 198, 509, 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, 1 ]
jmorcar/ZenEventClassMapping
addTrapFromMIB/Deprecated/TrapToEventClassMapping.py
2
2514
#!/usr/bin/env python import Globals, sys, ast, yaml, os, tempfile from transaction import commit from Products.ZenUtils.ZenScriptBase import ZenScriptBase if len(sys.argv) < 3: sys.exit('\nError faltan argumentos\n\nUsage: %s "fichero_MIBS" "cabecera_TRAPS"\n\n' % sys.argv[0]) file = sys.argv[1] cabecera = sys.argv[2].upper() #dmd = ZenScriptBase(connect=True).dmd ########################################## # CONEXION CON ZOPE conex = None dmd = None try: dmd = ZenScriptBase(connect=True).dmd except Exception, e: print "Connection to zenoss dmd failed: %s\n" % e sys.exit(1) ########################################### def evalSeverity(severity): return { 'Clear': '0', 'Normal': '2', 'Minor': '1', 'Warning': '3', 'Major': '4', 'Critical': '5', }.get(severity, 2) #VARIABLES GLOBALES #Definicion de Event Classes: # event_classes = [ #'/Events/clase1' #'/Events/clase2' #] event_classes = '/Events/NUEVOS' # PROVISION DE NUEVAS EVENTCLASSES EN ZENOSS print "+ ADDING Event Class %s" % event_classes conex = dmd.Events.getOrganizer('/') conex.dmd.Events.manage_addOrganizer(event_classes) #carga del fichero de mibs filestr = '' #String para leer fichero de datos definitions = [] #Array para importar a ZENOSS ########################################### #EXTRAER LAS TRAPS DEL FICHERO DE MIB outfile = tempfile.mkstemp(prefix="traps-out") errfile = tempfile.mkstemp(prefix="traps-err") os.system("smidump --keep-going -f python %s > %s 2> %s " % (file, outfile[1], errfile[1])) errmsgs = open(errfile[1], "r").read() os.unlink(errfile[1]) code = open(outfile[1],"r").read() os.unlink(outfile[1]) try: exec(code) except Exception, e: print >> sys.stderr, "%s - ha fallado la carga de la mib, %s" % (file, errmsgs) sys.exit(1) try: traps = MIB['notifications'] except NameError: print >> sys.stderr, "%s was too badly formed to have output\n%s" % (file, errmsgs) sys.exit(1) #print "traps: %s" % traps for n , v in traps.items(): nombre_trap = cabecera + n oid = traps.get(n)['oid'] descripcion = traps.get(n)['description'] varbinds = traps.get(n)['objects'] descripcion += "\n Lista varbinds:" for o , b in varbinds.items(): descripcion += "\n %s" % o print ("Creando instancia -> %s" % nombre_trap) org = dmd.Events.getOrganizer(event_classes) inst = org.createInstance(nombre_trap) inst.example = descripcion inst.explanation = descripcion commit()
gpl-2.0
[ 3381, 2647, 15, 1393, 15, 1813, 2366, 28154, 199, 646, 13641, 83, 12, 984, 12, 6073, 12, 8864, 12, 747, 12, 5549, 199, 504, 6008, 492, 5532, 199, 504, 32411, 14, 58, 287, 7535, 14, 58, 287, 5229, 1563, 492, 3107, 287, 5229, 1563, 28154, 199, 692, 822, 8, 1274, 14, 3020, 9, 665, 650, 26, 1362, 984, 14, 2224, 2258, 78, 547, 289, 4478, 290, 1423, 736, 60, 78, 60, 78, 7692, 26, 450, 83, 298, 329, 335, 3478, 63, 10535, 51, 2, 298, 26481, 825, 32311, 63, 1766, 1282, 51, 3212, 78, 60, 78, 7, 450, 984, 14, 3020, 59, 16, 566, 199, 199, 493, 275, 984, 14, 3020, 59, 17, 61, 199, 26481, 825, 32311, 275, 984, 14, 3020, 59, 18, 1055, 4142, 342, 28154, 199, 3, 68, 1064, 275, 3107, 287, 5229, 1563, 8, 2242, 29, 549, 680, 68, 1064, 199, 26634, 309, 199, 3, 1868, 1438, 1075, 1868, 3107, 47, 1510, 199, 67, 368, 88, 275, 488, 199, 68, 1064, 275, 488, 199, 893, 26, 272, 366, 1064, 275, 3107, 287, 5229, 1563, 8, 2242, 29, 549, 680, 68, 1064, 199, 2590, 2186, 12, 325, 26, 272, 870, 298, 3225, 370, 1315, 287, 26890, 366, 1064, 3405, 26, 450, 83, 60, 78, 2, 450, 325, 272, 984, 14, 2224, 8, 17, 9, 199, 26634, 5680, 199, 199, 318, 3468, 1513, 18226, 8, 20394, 304, 272, 372, 469, 267, 283, 9721, 356, 283, 16, 297, 267, 283, 6241, 356, 283, 18, 297, 267, 283, 23094, 356, 283, 17, 297, 267, 283, 3849, 356, 283, 19, 297, 199, 198, 7, 21657, 356, 283, 20, 297, 267, 283, 27677, 356, 283, 21, 297, 272, 789, 14, 362, 8, 20394, 12, 499, 9, 199, 199, 3, 21161, 598, 12667, 654, 199, 3, 872, 2408, 530, 1636, 477, 6763, 27939, 26, 257, 199, 3, 1566, 63, 2888, 275, 359, 199, 3, 9807, 11770, 15, 3995, 261, 17, 7, 199, 3, 9807, 11770, 15, 3995, 261, 18, 7, 199, 3, 61, 199, 199, 1430, 63, 2888, 275, 1994, 11770, 15, 1440, 18015, 3100, 7, 199, 199, 3, 3611, 18775, 3265, 653, 4187, 54, 1179, 6461, 13748, 5070, 3107, 15577, 2300, 199, 1361, 7210, 21380, 1206, 6763, 8089, 450, 83, 2, 450, 1566, 63, 2888, 199, 67, 368, 88, 275, 366, 1064, 14, 11770, 14, 362, 11014, 290, 1793, 7825, 199, 67, 368, 88, 14, 68, 1064, 14, 11770, 14, 9053, 63, 525, 11014, 290, 1793, 8, 1430, 63, 2888, 9, 421, 199, 3, 67, 1273, 65, 2150, 289, 1158, 3478, 477, 10684, 1533, 199, 199, 493, 495, 275, 2125, 327, 1558, 12665, 1026, 281, 289, 1158, 3478, 477, 6394, 736, 199, 199, 15388, 275, 942, 221, 198, 3, 3836, 12665, 492, 285, 282, 3107, 15577, 2300, 199, 26634, 5680, 199, 199, 3, 1438, 1766, 9537, 491, 1179, 9074, 1282, 51, 12355, 481, 948, 3452, 47, 3265, 603, 2100, 199, 4984, 275, 5549, 14, 17721, 8, 1861, 628, 1239, 1190, 13, 548, 531, 199, 1508, 493, 275, 5549, 14, 17721, 8, 1861, 628, 1239, 1190, 13, 1508, 531, 199, 736, 14, 2253, 480, 3300, 344, 1220, 1553, 3250, 13, 10947, 446, 70, 2366, 450, 83, 690, 450, 83, 499, 30, 450, 83, 298, 450, 221, 334, 493, 12, 4386, 59, 17, 467, 2329, 493, 59, 17, 2459, 199, 1508, 13429, 275, 1551, 8, 1508, 493, 59, 17, 467, 298, 82, 3471, 739, 342, 199, 736, 14, 7162, 8, 1508, 493, 59, 17, 566, 199, 600, 275, 1551, 8, 4984, 59, 17, 20007, 82, 3471, 739, 342, 199, 736, 14, 7162, 8, 4984, 59, 17, 566, 199, 893, 26, 199, 198, 1628, 8, 600, 9, 199, 2590, 2186, 12, 325, 26, 199, 198, 1361, 4331, 984, 14, 3083, 12, 2071, 83, 446, 18251, 11264, 5129, 1127, 286, 1273, 65, 477, 1127, 333, 1892, 12, 450, 83, 2, 450, 334, 493, 12, 2329, 13429, 9, 199, 198, 1274, 14, 2224, 8, 17, 9, 421, 199, 893, 26, 199, 198, 1239, 1190, 275, 603, 2100, 459, 12782, 418, 199, 2590, 12746, 26, 199, 198, 1361, 4331, 984, 14, 3083, 12, 2071, 83, 1990, 4634, 4875, 590, 28917, 370, 1172, 1072, 60, 78, 5, 83, 2, 450, 334, 493, 12, 2329, 13429, 9, 199, 198, 1274, 14, 2224, 8, 17, 9, 199, 3, 1361, 298, 1239, 1190, 26, 450, 83, 2, 450, 1468, 1190, 421, 199, 509, 302, 2360, 373, 315, 1468, 1190, 14, 1744, 837, 199, 198, 15998, 10205, 63, 19510, 275, 286, 371, 825, 32311, 435, 302, 199, 198, 1170, 275, 1468, 1190, 14, 362, 8, 78, 11820, 1170, 418, 199, 198, 271, 729, 80, 9718, 275, 1468, 1190, 14, 362, 8, 78, 11820, 1802, 418, 199, 198, 1391, 27080, 275, 1468, 1190, 14, 362, 8, 78, 11820, 1462, 418, 199, 198, 271, 729, 80, 9718, 847, 1867, 78, 3820, 65, 2729, 27080, 5424, 199, 198, 509, 312, 2360, 330, 315, 2729, 27080, 14, 1744, 837, 507, 198, 271, 729, 80, 9718, 847, 1867, 78, 257, 450, 83, 2, 450, 312, 28550, 8299, 198, 1361, 1689, 5482, 22066, 2727, 290, 16521, 1035, 450, 83, 2, 450, 17468, 10205, 63, 19510, 9, 199, 198, 1308, 275, 366, 1064, 14, 11770, 14, 362, 11014, 290, 1793, 8, 1430, 63, 2888, 9, 199, 198, 3615, 275, 5981, 14, 981, 3244, 8, 15998, 10205, 63, 19510, 9, 199, 198, 3615, 14, 2694, 275, 7039, 80, 9718, 199, 198, 3615, 14, 15228, 275, 7039, 80, 9718, 8299, 199, 3543, 342, 2742, 507, 2742, 259, 421, 28550, 507, 6905, 28154, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 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, 28154, 199, 646, 13641, 83, 12, 984, 12, 6073, 12, 8864, 12, 747, 12, 5549, 199, 504, 6008, 492, 5532, 199, 504, 32411, 14, 58, 287, 7535, 14, 58, 287, 5229, 1563, 492, 3107, 287, 5229, 1563, 28154, 199, 692, 822, 8, 1274, 14, 3020, 9, 665, 650, 26, 1362, 984, 14, 2224, 2258, 78, 547, 289, 4478, 290, 1423, 736, 60, 78, 60, 78, 7692, 26, 450, 83, 298, 329, 335, 3478, 63, 10535, 51, 2, 298, 26481, 825, 32311, 63, 1766, 1282, 51, 3212, 78, 60, 78, 7, 450, 984, 14, 3020, 59, 16, 566, 199, 199, 493, 275, 984, 14, 3020, 59, 17, 61, 199, 26481, 825, 32311, 275, 984, 14, 3020, 59, 18, 1055, 4142, 342, 28154, 199, 3, 68, 1064, 275, 3107, 287, 5229, 1563, 8, 2242, 29, 549, 680, 68, 1064, 199, 26634, 309, 199, 3, 1868, 1438, 1075, 1868, 3107, 47, 1510, 199, 67, 368, 88, 275, 488, 199, 68, 1064, 275, 488, 199, 893, 26, 272, 366, 1064, 275, 3107, 287, 5229, 1563, 8, 2242, 29, 549, 680, 68, 1064, 199, 2590, 2186, 12, 325, 26, 272, 870, 298, 3225, 370, 1315, 287, 26890, 366, 1064, 3405, 26, 450, 83, 60, 78, 2, 450, 325, 272, 984, 14, 2224, 8, 17, 9, 199, 26634, 5680, 199, 199, 318, 3468, 1513, 18226, 8, 20394, 304, 272, 372, 469, 267, 283, 9721, 356, 283, 16, 297, 267, 283, 6241, 356, 283, 18, 297, 267, 283, 23094, 356, 283, 17, 297, 267, 283, 3849, 356, 283, 19, 297, 199, 198, 7, 21657, 356, 283, 20, 297, 267, 283, 27677, 356, 283, 21, 297, 272, 789, 14, 362, 8, 20394, 12, 499, 9, 199, 199, 3, 21161, 598, 12667, 654, 199, 3, 872, 2408, 530, 1636, 477, 6763, 27939, 26, 257, 199, 3, 1566, 63, 2888, 275, 359, 199, 3, 9807, 11770, 15, 3995, 261, 17, 7, 199, 3, 9807, 11770, 15, 3995, 261, 18, 7, 199, 3, 61, 199, 199, 1430, 63, 2888, 275, 1994, 11770, 15, 1440, 18015, 3100, 7, 199, 199, 3, 3611, 18775, 3265, 653, 4187, 54, 1179, 6461, 13748, 5070, 3107, 15577, 2300, 199, 1361, 7210, 21380, 1206, 6763, 8089, 450, 83, 2, 450, 1566, 63, 2888, 199, 67, 368, 88, 275, 366, 1064, 14, 11770, 14, 362, 11014, 290, 1793, 7825, 199, 67, 368, 88, 14, 68, 1064, 14, 11770, 14, 9053, 63, 525, 11014, 290, 1793, 8, 1430, 63, 2888, 9, 421, 199, 3, 67, 1273, 65, 2150, 289, 1158, 3478, 477, 10684, 1533, 199, 199, 493, 495, 275, 2125, 327, 1558, 12665, 1026, 281, 289, 1158, 3478, 477, 6394, 736, 199, 199, 15388, 275, 942, 221, 198, 3, 3836, 12665, 492, 285, 282, 3107, 15577, 2300, 199, 26634, 5680, 199, 199, 3, 1438, 1766, 9537, 491, 1179, 9074, 1282, 51, 12355, 481, 948, 3452, 47, 3265, 603, 2100, 199, 4984, 275, 5549, 14, 17721, 8, 1861, 628, 1239, 1190, 13, 548, 531, 199, 1508, 493, 275, 5549, 14, 17721, 8, 1861, 628, 1239, 1190, 13, 1508, 531, 199, 736, 14, 2253, 480, 3300, 344, 1220, 1553, 3250, 13, 10947, 446, 70, 2366, 450, 83, 690, 450, 83, 499, 30, 450, 83, 298, 450, 221, 334, 493, 12, 4386, 59, 17, 467, 2329, 493, 59, 17, 2459, 199, 1508, 13429, 275, 1551, 8, 1508, 493, 59, 17, 467, 298, 82, 3471, 739, 342, 199, 736, 14, 7162, 8, 1508, 493, 59, 17, 566, 199, 600, 275, 1551, 8, 4984, 59, 17, 20007, 82, 3471, 739, 342, 199, 736, 14, 7162, 8, 4984, 59, 17, 566, 199, 893, 26, 199, 198, 1628, 8, 600, 9, 199, 2590, 2186, 12, 325, 26, 199, 198, 1361, 4331, 984, 14, 3083, 12, 2071, 83, 446, 18251, 11264, 5129, 1127, 286, 1273, 65, 477, 1127, 333, 1892, 12, 450, 83, 2, 450, 334, 493, 12, 2329, 13429, 9, 199, 198, 1274, 14, 2224, 8, 17, 9, 421, 199, 893, 26, 199, 198, 1239, 1190, 275, 603, 2100, 459, 12782, 418, 199, 2590, 12746, 26, 199, 198, 1361, 4331, 984, 14, 3083, 12, 2071, 83, 1990, 4634, 4875, 590, 28917, 370, 1172, 1072, 60, 78, 5, 83, 2, 450, 334, 493, 12, 2329, 13429, 9, 199, 198, 1274, 14, 2224, 8, 17, 9, 199, 3, 1361, 298, 1239, 1190, 26, 450, 83, 2, 450, 1468, 1190, 421, 199, 509, 302, 2360, 373, 315, 1468, 1190, 14, 1744, 837, 199, 198, 15998, 10205, 63, 19510, 275, 286, 371, 825, 32311, 435, 302, 199, 198, 1170, 275, 1468, 1190, 14, 362, 8, 78, 11820, 1170, 418, 199, 198, 271, 729, 80, 9718, 275, 1468, 1190, 14, 362, 8, 78, 11820, 1802, 418, 199, 198, 1391, 27080, 275, 1468, 1190, 14, 362, 8, 78, 11820, 1462, 418, 199, 198, 271, 729, 80, 9718, 847, 1867, 78, 3820, 65, 2729, 27080, 5424, 199, 198, 509, 312, 2360, 330, 315, 2729, 27080, 14, 1744, 837, 507, 198, 271, 729, 80, 9718, 847, 1867, 78, 257, 450, 83, 2, 450, 312, 28550, 8299, 198, 1361, 1689, 5482, 22066, 2727, 290, 16521, 1035, 450, 83, 2, 450, 17468, 10205, 63, 19510, 9, 199, 198, 1308, 275, 366, 1064, 14, 11770, 14, 362, 11014, 290, 1793, 8, 1430, 63, 2888, 9, 199, 198, 3615, 275, 5981, 14, 981, 3244, 8, 15998, 10205, 63, 19510, 9, 199, 198, 3615, 14, 2694, 275, 7039, 80, 9718, 199, 198, 3615, 14, 15228, 275, 7039, 80, 9718, 8299, 199, 3543, 342, 2742, 507, 2742, 259, 421, 28550, 507, 6905, 28154, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 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,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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 ]
EUDAT-B2SHARE/invenio-old
modules/bibformat/lib/elements/bfe_contact.py
18
1522
# -*- coding: utf-8 -*- ## ## This file is part of Invenio. ## Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011 CERN. ## ## Invenio is free software; you can redistribute it and/or ## modify it under the terms of the GNU General Public License as ## published by the Free Software Foundation; either version 2 of the ## License, or (at your option) any later version. ## ## Invenio is distributed in the hope that it will be useful, but ## WITHOUT ANY WARRANTY; without even the implied warranty of ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ## General Public License for more details. ## ## You should have received a copy of the GNU General Public License ## along with Invenio; if not, write to the Free Software Foundation, Inc., ## 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. """BibFormat element - Prints contact information """ __revision__ = "$Id$" def format_element(bfo, separator='; ', link="yes"): """ Prints contact information for the record @param separator: the separator between addresses. @param link: Link the addresses to search engine (HTML links) if 'yes' """ from urllib import quote from invenio.config import CFG_SITE_URL addresses = bfo.fields('270__p') if link == "yes": addresses = ['<a href="'+CFG_SITE_URL+'/search?f=author&p='+ \ quote(address) +'&amp;ln=' + bfo.lang + '">' + \ address +'</a>' for address in addresses] return separator.join(addresses)
gpl-2.0
[ 3, 1882, 2803, 26, 2774, 13, 24, 1882, 199, 309, 199, 309, 961, 570, 365, 1777, 402, 12235, 14, 199, 309, 1898, 334, 35, 9, 8315, 12, 10219, 12, 9079, 12, 8937, 12, 7129, 12, 7760, 24354, 14, 199, 309, 199, 309, 12235, 365, 2867, 2032, 27, 1265, 883, 3604, 652, 436, 15, 269, 199, 309, 2811, 652, 1334, 314, 2895, 402, 314, 1664, 1696, 1684, 844, 465, 199, 309, 3267, 701, 314, 2868, 2290, 2752, 27, 1902, 1015, 499, 402, 314, 199, 309, 844, 12, 503, 334, 292, 2195, 945, 9, 1263, 2945, 1015, 14, 199, 309, 199, 309, 12235, 365, 1854, 315, 314, 3661, 626, 652, 911, 506, 2997, 12, 1325, 199, 309, 2428, 1821, 3408, 27, 1928, 2755, 314, 2478, 3750, 402, 199, 309, 3169, 503, 3092, 2381, 437, 3115, 3104, 14, 221, 1666, 314, 1664, 199, 309, 1696, 1684, 844, 367, 1655, 2436, 14, 199, 309, 199, 309, 2047, 1077, 1172, 3086, 282, 1331, 402, 314, 1664, 1696, 1684, 844, 199, 309, 3180, 543, 12235, 27, 340, 440, 12, 2218, 370, 314, 2868, 2290, 2752, 12, 3277, 2020, 199, 309, 8155, 15630, 10902, 12, 14453, 13540, 12, 8226, 12, 4828, 15673, 13, 13421, 12, 8217, 14, 199, 624, 25217, 3484, 1819, 446, 9101, 83, 8966, 2556, 199, 624, 199, 363, 5792, 363, 275, 7880, 1304, 17351, 199, 199, 318, 1475, 63, 2108, 8, 66, 545, 12, 9432, 534, 27, 1656, 2142, 628, 5066, 2349, 272, 408, 272, 9101, 83, 8966, 2556, 367, 314, 2777, 339, 768, 635, 9432, 26, 314, 9432, 3382, 7149, 14, 272, 768, 635, 2142, 26, 10967, 314, 7149, 370, 2754, 6869, 334, 4943, 6220, 9, 340, 283, 5066, 7, 272, 408, 272, 687, 4011, 492, 6313, 272, 687, 13640, 14, 888, 492, 10974, 63, 7917, 63, 2632, 339, 7149, 275, 330, 545, 14, 955, 360, 13299, 363, 80, 358, 339, 340, 2142, 508, 298, 5066, 582, 267, 7149, 275, 12329, 65, 4369, 628, 6828, 10118, 63, 7917, 63, 2632, 23164, 1733, 31, 70, 29, 2502, 6, 80, 22078, 971, 2151, 6313, 8, 1562, 9, 435, 21840, 5282, 27, 6066, 534, 435, 330, 545, 14, 4159, 435, 283, 15603, 435, 971, 2151, 2287, 435, 29477, 65, 3524, 367, 2287, 315, 7149, 61, 339, 372, 9432, 14, 904, 8, 7423, 9, 28154, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 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, 309, 199, 309, 961, 570, 365, 1777, 402, 12235, 14, 199, 309, 1898, 334, 35, 9, 8315, 12, 10219, 12, 9079, 12, 8937, 12, 7129, 12, 7760, 24354, 14, 199, 309, 199, 309, 12235, 365, 2867, 2032, 27, 1265, 883, 3604, 652, 436, 15, 269, 199, 309, 2811, 652, 1334, 314, 2895, 402, 314, 1664, 1696, 1684, 844, 465, 199, 309, 3267, 701, 314, 2868, 2290, 2752, 27, 1902, 1015, 499, 402, 314, 199, 309, 844, 12, 503, 334, 292, 2195, 945, 9, 1263, 2945, 1015, 14, 199, 309, 199, 309, 12235, 365, 1854, 315, 314, 3661, 626, 652, 911, 506, 2997, 12, 1325, 199, 309, 2428, 1821, 3408, 27, 1928, 2755, 314, 2478, 3750, 402, 199, 309, 3169, 503, 3092, 2381, 437, 3115, 3104, 14, 221, 1666, 314, 1664, 199, 309, 1696, 1684, 844, 367, 1655, 2436, 14, 199, 309, 199, 309, 2047, 1077, 1172, 3086, 282, 1331, 402, 314, 1664, 1696, 1684, 844, 199, 309, 3180, 543, 12235, 27, 340, 440, 12, 2218, 370, 314, 2868, 2290, 2752, 12, 3277, 2020, 199, 309, 8155, 15630, 10902, 12, 14453, 13540, 12, 8226, 12, 4828, 15673, 13, 13421, 12, 8217, 14, 199, 624, 25217, 3484, 1819, 446, 9101, 83, 8966, 2556, 199, 624, 199, 363, 5792, 363, 275, 7880, 1304, 17351, 199, 199, 318, 1475, 63, 2108, 8, 66, 545, 12, 9432, 534, 27, 1656, 2142, 628, 5066, 2349, 272, 408, 272, 9101, 83, 8966, 2556, 367, 314, 2777, 339, 768, 635, 9432, 26, 314, 9432, 3382, 7149, 14, 272, 768, 635, 2142, 26, 10967, 314, 7149, 370, 2754, 6869, 334, 4943, 6220, 9, 340, 283, 5066, 7, 272, 408, 272, 687, 4011, 492, 6313, 272, 687, 13640, 14, 888, 492, 10974, 63, 7917, 63, 2632, 339, 7149, 275, 330, 545, 14, 955, 360, 13299, 363, 80, 358, 339, 340, 2142, 508, 298, 5066, 582, 267, 7149, 275, 12329, 65, 4369, 628, 6828, 10118, 63, 7917, 63, 2632, 23164, 1733, 31, 70, 29, 2502, 6, 80, 22078, 971, 2151, 6313, 8, 1562, 9, 435, 21840, 5282, 27, 6066, 534, 435, 330, 545, 14, 4159, 435, 283, 15603, 435, 971, 2151, 2287, 435, 29477, 65, 3524, 367, 2287, 315, 7149, 61, 339, 372, 9432, 14, 904, 8, 7423, 9, 28154, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 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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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 ]
nishnik/networkx
networkx/classes/tests/historical_tests.py
8
17376
#!/usr/bin/env python """Original NetworkX graph tests""" from nose.tools import * import networkx import networkx as nx from networkx import convert_node_labels_to_integers as cnlti from networkx.testing import * class HistoricalTests(object): def setUp(self): self.null=nx.null_graph() self.P1=cnlti(nx.path_graph(1),first_label=1) self.P3=cnlti(nx.path_graph(3),first_label=1) self.P10=cnlti(nx.path_graph(10),first_label=1) self.K1=cnlti(nx.complete_graph(1),first_label=1) self.K3=cnlti(nx.complete_graph(3),first_label=1) self.K4=cnlti(nx.complete_graph(4),first_label=1) self.K5=cnlti(nx.complete_graph(5),first_label=1) self.K10=cnlti(nx.complete_graph(10),first_label=1) self.G=nx.Graph def test_name(self): G=self.G(name="test") assert_equal(str(G),'test') assert_equal(G.name,'test') H=self.G() assert_equal(H.name,'') # Nodes def test_add_remove_node(self): G=self.G() G.add_node('A') assert_true(G.has_node('A')) G.remove_node('A') assert_false(G.has_node('A')) def test_nonhashable_node(self): # Test if a non-hashable object is in the Graph. A python dict will # raise a TypeError, but for a Graph class a simple False should be # returned (see Graph __contains__). If it cannot be a node then it is # not a node. G=self.G() assert_false(G.has_node(['A'])) assert_false(G.has_node({'A':1})) def test_add_nodes_from(self): G=self.G() G.add_nodes_from(list("ABCDEFGHIJKL")) assert_true(G.has_node("L")) G.remove_nodes_from(['H','I','J','K','L']) G.add_nodes_from([1,2,3,4]) assert_equal(sorted(G.nodes(),key=str), [1, 2, 3, 4, 'A', 'B', 'C', 'D', 'E', 'F', 'G']) # test __iter__ assert_equal(sorted(G,key=str), [1, 2, 3, 4, 'A', 'B', 'C', 'D', 'E', 'F', 'G']) def test_contains(self): G=self.G() G.add_node('A') assert_true('A' in G) assert_false([] in G) # never raise a Key or TypeError in this test assert_false({1:1} in G) def test_add_remove(self): # Test add_node and remove_node acting for various nbunch G=self.G() G.add_node('m') assert_true(G.has_node('m')) G.add_node('m') # no complaints assert_raises(nx.NetworkXError,G.remove_node,'j') G.remove_node('m') assert_equal(list(G), []) def test_nbunch_is_list(self): G=self.G() G.add_nodes_from(list("ABCD")) G.add_nodes_from(self.P3) # add nbunch of nodes (nbunch=Graph) assert_equal(sorted(G.nodes(),key=str), [1, 2, 3, 'A', 'B', 'C', 'D']) G.remove_nodes_from(self.P3) # remove nbunch of nodes (nbunch=Graph) assert_equal(sorted(G.nodes(),key=str), ['A', 'B', 'C', 'D']) def test_nbunch_is_set(self): G=self.G() nbunch=set("ABCDEFGHIJKL") G.add_nodes_from(nbunch) assert_true(G.has_node("L")) def test_nbunch_dict(self): # nbunch is a dict with nodes as keys G=self.G() nbunch=set("ABCDEFGHIJKL") G.add_nodes_from(nbunch) nbunch={'I':"foo",'J':2,'K':True,'L':"spam"} G.remove_nodes_from(nbunch) assert_true(sorted(G.nodes(),key=str), ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H']) def test_nbunch_iterator(self): G=self.G() G.add_nodes_from(['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H']) n_iter=self.P3.nodes() G.add_nodes_from(n_iter) assert_equal(sorted(G.nodes(),key=str), [1, 2, 3, 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H']) n_iter=self.P3.nodes() # rebuild same iterator G.remove_nodes_from(n_iter) # remove nbunch of nodes (nbunch=iterator) assert_equal(sorted(G.nodes(),key=str), ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H']) def test_nbunch_graph(self): G=self.G() G.add_nodes_from(['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H']) nbunch=self.K3 G.add_nodes_from(nbunch) assert_true(sorted(G.nodes(),key=str), [1, 2, 3, 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H']) # Edges def test_add_edge(self): G=self.G() assert_raises(TypeError,G.add_edge,'A') G.add_edge('A','B') # testing add_edge() G.add_edge('A','B') # should fail silently assert_true(G.has_edge('A','B')) assert_false(G.has_edge('A','C')) assert_true(G.has_edge( *('A','B') )) if G.is_directed(): assert_false(G.has_edge('B','A')) else: # G is undirected, so B->A is an edge assert_true(G.has_edge('B','A')) G.add_edge('A','C') # test directedness G.add_edge('C','A') G.remove_edge('C','A') if G.is_directed(): assert_true(G.has_edge('A','C')) else: assert_false(G.has_edge('A','C')) assert_false(G.has_edge('C','A')) def test_self_loop(self): G=self.G() G.add_edge('A','A') # test self loops assert_true(G.has_edge('A','A')) G.remove_edge('A','A') G.add_edge('X','X') assert_true(G.has_node('X')) G.remove_node('X') G.add_edge('A','Z') # should add the node silently assert_true(G.has_node('Z')) def test_add_edges_from(self): G=self.G() G.add_edges_from([('B','C')]) # test add_edges_from() assert_true(G.has_edge('B','C')) if G.is_directed(): assert_false(G.has_edge('C','B')) else: assert_true(G.has_edge('C','B')) # undirected G.add_edges_from([('D','F'),('B','D')]) assert_true(G.has_edge('D','F')) assert_true(G.has_edge('B','D')) if G.is_directed(): assert_false(G.has_edge('D','B')) else: assert_true(G.has_edge('D','B')) # undirected def test_add_edges_from2(self): G=self.G() # after failing silently, should add 2nd edge G.add_edges_from([tuple('IJ'),list('KK'),tuple('JK')]) assert_true(G.has_edge(*('I','J'))) assert_true(G.has_edge(*('K','K'))) assert_true(G.has_edge(*('J','K'))) if G.is_directed(): assert_false(G.has_edge(*('K','J'))) else: assert_true(G.has_edge(*('K','J'))) def test_add_edges_from3(self): G=self.G() G.add_edges_from(zip(list('ACD'),list('CDE'))) assert_true(G.has_edge('D','E')) assert_false(G.has_edge('E','C')) def test_remove_edge(self): G=self.G() G.add_nodes_from([1, 2, 3, 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H']) G.add_edges_from(zip(list('MNOP'),list('NOPM'))) assert_true(G.has_edge('O','P')) assert_true( G.has_edge('P','M')) G.remove_node('P') # tests remove_node()'s handling of edges. assert_false(G.has_edge('P','M')) assert_raises(TypeError,G.remove_edge,'M') G.add_edge('N','M') assert_true(G.has_edge('M','N')) G.remove_edge('M','N') assert_false(G.has_edge('M','N')) # self loop fails silently G.remove_edges_from([list('HI'),list('DF'), tuple('KK'),tuple('JK')]) assert_false(G.has_edge('H','I')) assert_false(G.has_edge('J','K')) G.remove_edges_from([list('IJ'),list('KK'),list('JK')]) assert_false(G.has_edge('I','J')) G.remove_nodes_from(set('ZEFHIMNO')) G.add_edge('J','K') def test_edges_nbunch(self): # Test G.edges(nbunch) with various forms of nbunch G=self.G() G.add_edges_from([('A', 'B'), ('A', 'C'), ('B', 'D'), ('C', 'B'), ('C', 'D')]) # node not in nbunch should be quietly ignored assert_raises(nx.NetworkXError,G.edges,6) assert_equals(G.edges('Z'),[]) # iterable non-node # nbunch can be an empty list assert_equals(G.edges([]),[]) if G.is_directed(): elist=[('A', 'B'), ('A', 'C'), ('B', 'D')] else: elist=[('A', 'B'), ('A', 'C'), ('B', 'C'), ('B', 'D')] # nbunch can be a list assert_edges_equal(G.edges(['A','B']),elist) # nbunch can be a set assert_edges_equal(G.edges(set(['A','B'])),elist) # nbunch can be a graph G1=self.G() G1.add_nodes_from('AB') assert_edges_equal(G.edges(G1),elist) # nbunch can be a dict with nodes as keys ndict={'A': "thing1", 'B': "thing2"} assert_edges_equal(G.edges(ndict),elist) # nbunch can be a single node assert_edges_equal(G.edges('A'), [('A', 'B'), ('A', 'C')]) assert_nodes_equal(sorted(G), ['A', 'B', 'C', 'D']) def test_edges_nbunch(self): G=self.G() G.add_edges_from([('A', 'B'), ('A', 'C'), ('B', 'D'), ('C', 'B'), ('C', 'D')]) # Test G.edges(nbunch) with various forms of nbunch # node not in nbunch should be quietly ignored assert_equals(list(G.edges('Z')),[]) # nbunch can be an empty list assert_equals(sorted(G.edges([])),[]) if G.is_directed(): elist=[('A', 'B'), ('A', 'C'), ('B', 'D')] else: elist=[('A', 'B'), ('A', 'C'), ('B', 'C'), ('B', 'D')] # nbunch can be a list assert_edges_equal(G.edges(['A','B']),elist) # nbunch can be a set assert_edges_equal(G.edges(set(['A','B'])),elist) # nbunch can be a graph G1=self.G() G1.add_nodes_from(['A','B']) assert_edges_equal(G.edges(G1),elist) # nbunch can be a dict with nodes as keys ndict={'A': "thing1", 'B': "thing2"} assert_edges_equal(G.edges(ndict),elist) # nbunch can be a single node assert_edges_equal(G.edges('A'), [('A', 'B'), ('A', 'C')]) # nbunch can be nothing (whole graph) assert_edges_equal(G.edges(), [('A', 'B'), ('A', 'C'), ('B', 'D'), ('C', 'B'), ('C', 'D')]) def test_degree(self): G=self.G() G.add_edges_from([('A', 'B'), ('A', 'C'), ('B', 'D'), ('C', 'B'), ('C', 'D')]) assert_equal(G.degree('A'),2) # degree of single node in iterable container must return dict assert_equal(list(G.degree(['A'])), [('A', 2)]) assert_equal(sorted(d for n, d in G.degree(['A','B'])), [2, 3]) assert_equal(sorted(d for n, d in G.degree()), [2, 2, 3, 3]) def test_degree2(self): H=self.G() H.add_edges_from([(1,24),(1,2)]) assert_equal(sorted(d for n, d in H.degree([1,24])),[1, 2]) def test_degree_graph(self): P3=nx.path_graph(3) P5=nx.path_graph(5) # silently ignore nodes not in P3 assert_equal(dict(d for n, d in P3.degree(['A','B'])),{}) # nbunch can be a graph assert_equal(sorted(d for n, d in P5.degree(P3)),[1, 2, 2]) # nbunch can be a graph thats way to big assert_equal(sorted(d for n, d in P3.degree(P5)),[1, 1, 2]) assert_equal(list(P5.degree([])),[]) assert_equal(dict(P5.degree([])),{}) def test_null(self): null=nx.null_graph() assert_equal(list(null.degree()),[]) assert_equal(dict(null.degree()),{}) def test_order_size(self): G=self.G() G.add_edges_from([('A', 'B'), ('A', 'C'), ('B', 'D'), ('C', 'B'), ('C', 'D')]) assert_equal(G.order(),4) assert_equal(G.size(),5) assert_equal(G.number_of_edges(),5) assert_equal(G.number_of_edges('A','B'),1) assert_equal(G.number_of_edges('A','D'),0) def test_copy(self): G=self.G() H=G.copy() # copy assert_equal(H.adj,G.adj) assert_equal(H.name,G.name) assert_not_equal(H,G) def test_subgraph(self): G=self.G() G.add_edges_from([('A', 'B'), ('A', 'C'), ('B', 'D'), ('C', 'B'), ('C', 'D')]) SG=G.subgraph(['A','B','D']) assert_nodes_equal(list(SG), ['A', 'B', 'D']) assert_edges_equal(list(SG.edges()), [('A', 'B'), ('B', 'D')]) def test_to_directed(self): G=self.G() if not G.is_directed(): G.add_edges_from([('A', 'B'), ('A', 'C'), ('B', 'D'), ('C', 'B'), ('C', 'D')]) DG=G.to_directed() assert_not_equal(DG,G) # directed copy or copy assert_true(DG.is_directed()) assert_equal(DG.name,G.name) assert_equal(DG.adj,G.adj) assert_equal(sorted(DG.out_edges(list('AB'))), [('A', 'B'), ('A', 'C'), ('B', 'A'), ('B', 'C'), ('B', 'D')]) DG.remove_edge('A','B') assert_true(DG.has_edge('B','A')) # this removes B-A but not A-B assert_false(DG.has_edge('A','B')) def test_to_undirected(self): G=self.G() if G.is_directed(): G.add_edges_from([('A', 'B'), ('A', 'C'), ('B', 'D'), ('C', 'B'), ('C', 'D')]) UG=G.to_undirected() # to_undirected assert_not_equal(UG,G) assert_false(UG.is_directed()) assert_true(G.is_directed()) assert_equal(UG.name,G.name) assert_not_equal(UG.adj,G.adj) assert_equal(sorted(UG.edges(list('AB'))), [('A', 'B'), ('A', 'C'), ('B', 'C'), ('B', 'D')]) assert_equal(sorted(UG.edges(['A','B'])), [('A', 'B'), ('A', 'C'), ('B', 'C'), ('B', 'D')]) UG.remove_edge('A','B') assert_false(UG.has_edge('B','A')) assert_false( UG.has_edge('A','B')) def test_neighbors(self): G=self.G() G.add_edges_from([('A', 'B'), ('A', 'C'), ('B', 'D'), ('C', 'B'), ('C', 'D')]) G.add_nodes_from('GJK') assert_equal(sorted(G['A']),['B', 'C']) assert_equal(sorted(G.neighbors('A')),['B', 'C']) assert_equal(sorted(G.neighbors('A')),['B', 'C']) assert_equal(sorted(G.neighbors('G')),[]) assert_raises(nx.NetworkXError,G.neighbors,'j') def test_iterators(self): G=self.G() G.add_edges_from([('A', 'B'), ('A', 'C'), ('B', 'D'), ('C', 'B'), ('C', 'D')]) G.add_nodes_from('GJK') assert_equal(sorted(G.nodes()), ['A', 'B', 'C', 'D', 'G', 'J', 'K']) assert_edges_equal(G.edges(), [('A', 'B'), ('A', 'C'), ('B', 'D'), ('C', 'B'), ('C', 'D')]) assert_equal(sorted([v for k,v in G.degree()]), [0, 0, 0, 2, 2, 3, 3]) assert_equal(sorted(G.degree(), key=str), [('A', 2), ('B', 3), ('C', 3), ('D', 2), ('G', 0), ('J', 0), ('K', 0)]) assert_equal(sorted(G.neighbors('A')),['B', 'C']) assert_raises(nx.NetworkXError,G.neighbors,'X') G.clear() assert_equal(nx.number_of_nodes(G),0) assert_equal(nx.number_of_edges(G),0) def test_null_subgraph(self): # Subgraph of a null graph is a null graph nullgraph=nx.null_graph() G=nx.null_graph() H=G.subgraph([]) assert_true(nx.is_isomorphic(H,nullgraph)) def test_empty_subgraph(self): # Subgraph of an empty graph is an empty graph. test 1 nullgraph=nx.null_graph() E5=nx.empty_graph(5) E10=nx.empty_graph(10) H=E10.subgraph([]) assert_true(nx.is_isomorphic(H,nullgraph)) H=E10.subgraph([1,2,3,4,5]) assert_true(nx.is_isomorphic(H,E5)) def test_complete_subgraph(self): # Subgraph of a complete graph is a complete graph K1=nx.complete_graph(1) K3=nx.complete_graph(3) K5=nx.complete_graph(5) H=K5.subgraph([1,2,3]) assert_true(nx.is_isomorphic(H,K3)) def test_subgraph_nbunch(self): nullgraph=nx.null_graph() K1=nx.complete_graph(1) K3=nx.complete_graph(3) K5=nx.complete_graph(5) # Test G.subgraph(nbunch), where nbunch is a single node H=K5.subgraph(1) assert_true(nx.is_isomorphic(H,K1)) # Test G.subgraph(nbunch), where nbunch is a set H=K5.subgraph(set([1])) assert_true(nx.is_isomorphic(H,K1)) # Test G.subgraph(nbunch), where nbunch is an iterator H=K5.subgraph(iter(K3)) assert_true(nx.is_isomorphic(H,K3)) # Test G.subgraph(nbunch), where nbunch is another graph H=K5.subgraph(K3) assert_true(nx.is_isomorphic(H,K3)) H=K5.subgraph([9]) assert_true(nx.is_isomorphic(H,nullgraph)) def test_node_tuple_issue(self): H=self.G() # Test error handling of tuple as a node assert_raises(nx.NetworkXError,H.remove_node,(1,2)) H.remove_nodes_from([(1,2)]) # no error assert_raises(nx.NetworkXError,H.neighbors,(1,2))
bsd-3-clause
[ 3381, 2647, 15, 1393, 15, 1813, 2366, 199, 624, 17286, 7220, 56, 3343, 2295, 624, 199, 504, 11354, 14, 2537, 492, 627, 199, 646, 24313, 199, 646, 24313, 465, 8484, 199, 504, 24313, 492, 3957, 63, 932, 63, 3512, 63, 475, 63, 23931, 465, 286, 7530, 280, 199, 504, 24313, 14, 4776, 492, 627, 199, 199, 533, 869, 631, 10611, 2925, 8, 785, 304, 339, 347, 3613, 8, 277, 304, 267, 291, 14, 2307, 29, 7343, 14, 2307, 63, 2180, 342, 267, 291, 14, 48, 17, 29, 6413, 21934, 8, 7343, 14, 515, 63, 2180, 8, 17, 395, 2246, 63, 1302, 29, 17, 9, 267, 291, 14, 48, 19, 29, 6413, 21934, 8, 7343, 14, 515, 63, 2180, 8, 19, 395, 2246, 63, 1302, 29, 17, 9, 267, 291, 14, 48, 709, 29, 6413, 21934, 8, 7343, 14, 515, 63, 2180, 8, 709, 395, 2246, 63, 1302, 29, 17, 9, 267, 291, 14, 43, 17, 29, 6413, 21934, 8, 7343, 14, 4883, 63, 2180, 8, 17, 395, 2246, 63, 1302, 29, 17, 9, 267, 291, 14, 43, 19, 29, 6413, 21934, 8, 7343, 14, 4883, 63, 2180, 8, 19, 395, 2246, 63, 1302, 29, 17, 9, 267, 291, 14, 43, 20, 29, 6413, 21934, 8, 7343, 14, 4883, 63, 2180, 8, 20, 395, 2246, 63, 1302, 29, 17, 9, 267, 291, 14, 43, 21, 29, 6413, 21934, 8, 7343, 14, 4883, 63, 2180, 8, 21, 395, 2246, 63, 1302, 29, 17, 9, 267, 291, 14, 43, 709, 29, 6413, 21934, 8, 7343, 14, 4883, 63, 2180, 8, 709, 395, 2246, 63, 1302, 29, 17, 9, 267, 291, 14, 39, 29, 7343, 14, 4578, 339, 347, 511, 63, 354, 8, 277, 304, 267, 598, 29, 277, 14, 39, 8, 354, 628, 396, 531, 267, 702, 63, 1452, 8, 495, 8, 39, 26582, 396, 358, 267, 702, 63, 1452, 8, 39, 14, 354, 2584, 396, 358, 267, 869, 29, 277, 14, 39, 342, 267, 702, 63, 1452, 8, 40, 14, 354, 2584, 358, 339, 327, 23836, 339, 347, 511, 63, 525, 63, 2168, 63, 932, 8, 277, 304, 267, 598, 29, 277, 14, 39, 342, 267, 598, 14, 525, 63, 932, 360, 33, 358, 267, 702, 63, 2052, 8, 39, 14, 1989, 63, 932, 360, 33, 1333, 267, 598, 14, 2168, 63, 932, 360, 33, 358, 267, 702, 63, 3910, 8, 39, 14, 1989, 63, 932, 360, 33, 1333, 339, 347, 511, 63, 2865, 24596, 63, 932, 8, 277, 304, 267, 327, 1379, 340, 282, 2222, 13, 24596, 909, 365, 315, 314, 11513, 14, 221, 437, 2366, 1211, 911, 267, 327, 746, 282, 3146, 12, 1325, 367, 282, 11513, 1021, 282, 3486, 221, 756, 1077, 506, 267, 327, 2138, 334, 3239, 11513, 636, 6134, 28634, 982, 652, 3913, 506, 282, 1031, 2066, 652, 365, 267, 327, 440, 282, 1031, 14, 267, 598, 29, 277, 14, 39, 342, 267, 702, 63, 3910, 8, 39, 14, 1989, 63, 932, 2941, 33, 5156, 267, 702, 63, 3910, 8, 39, 14, 1989, 63, 932, 3252, 33, 356, 17, 12466, 339, 347, 511, 63, 525, 63, 2415, 63, 504, 8, 277, 304, 267, 598, 29, 277, 14, 39, 342, 267, 598, 14, 525, 63, 2415, 63, 504, 8, 513, 480, 25694, 24100, 2237, 267, 702, 63, 2052, 8, 39, 14, 1989, 63, 932, 480, 44, 2237, 267, 598, 14, 2168, 63, 2415, 63, 504, 2941, 40, 1673, 41, 1673, 42, 1673, 43, 1673, 44, 1105, 267, 598, 14, 525, 63, 2415, 63, 504, 779, 17, 12, 18, 12, 19, 12, 20, 566, 267, 702, 63, 1452, 8, 5917, 8, 39, 14, 2415, 1062, 498, 29, 495, 395, 2151, 359, 17, 12, 499, 12, 650, 12, 841, 12, 283, 33, 297, 283, 34, 297, 283, 35, 297, 283, 36, 297, 283, 37, 297, 283, 38, 297, 283, 39, 1105, 267, 327, 511, 636, 1661, 363, 267, 702, 63, 1452, 8, 5917, 8, 39, 12, 498, 29, 495, 395, 2151, 359, 17, 12, 499, 12, 650, 12, 841, 12, 283, 33, 297, 283, 34, 297, 283, 35, 297, 283, 36, 297, 283, 37, 297, 283, 38, 297, 283, 39, 1105, 2378, 347, 511, 63, 6134, 8, 277, 304, 267, 598, 29, 277, 14, 39, 342, 267, 598, 14, 525, 63, 932, 360, 33, 358, 267, 702, 63, 2052, 360, 33, 7, 315, 598, 9, 267, 702, 63, 3910, 779, 61, 315, 598, 9, 221, 327, 7078, 746, 282, 2606, 503, 3146, 315, 642, 511, 267, 702, 63, 3910, 2561, 17, 26, 17, 93, 315, 598, 9, 18407, 347, 511, 63, 525, 63, 2168, 8, 277, 304, 267, 327, 1379, 1050, 63, 932, 436, 2813, 63, 932, 2454, 316, 367, 7750, 8526, 4689, 267, 598, 29, 277, 14, 39, 342, 267, 598, 14, 525, 63, 932, 360, 77, 358, 267, 702, 63, 2052, 8, 39, 14, 1989, 63, 932, 360, 77, 1333, 267, 598, 14, 525, 63, 932, 360, 77, 358, 257, 327, 949, 32493, 13141, 267, 702, 63, 3536, 8, 7343, 14, 4491, 29356, 12, 39, 14, 2168, 63, 932, 2584, 74, 358, 267, 598, 14, 2168, 63, 932, 360, 77, 358, 267, 702, 63, 1452, 8, 513, 8, 39, 395, 3073, 339, 347, 511, 63, 4994, 4689, 63, 374, 63, 513, 8, 277, 304, 267, 598, 29, 277, 14, 39, 342, 267, 598, 14, 525, 63, 2415, 63, 504, 8, 513, 480, 31578, 2237, 4960, 598, 14, 525, 63, 2415, 63, 504, 8, 277, 14, 48, 19, 9, 327, 1050, 8526, 4689, 402, 3380, 334, 4994, 4689, 29, 4578, 9, 267, 702, 63, 1452, 8, 5917, 8, 39, 14, 2415, 1062, 498, 29, 495, 395, 2151, 359, 17, 12, 499, 12, 650, 12, 283, 33, 297, 283, 34, 297, 283, 35, 297, 283, 36, 1105, 267, 598, 14, 2168, 63, 2415, 63, 504, 8, 277, 14, 48, 19, 9, 327, 2813, 8526, 4689, 402, 3380, 334, 4994, 4689, 29, 4578, 9, 267, 702, 63, 1452, 8, 5917, 8, 39, 14, 2415, 1062, 498, 29, 495, 395, 2151, 788, 33, 297, 283, 34, 297, 283, 35, 297, 283, 36, 1105, 339, 347, 511, 63, 4994, 4689, 63, 374, 63, 409, 8, 277, 304, 267, 598, 29, 277, 14, 39, 342, 267, 8526, 4689 ]
[ 2647, 15, 1393, 15, 1813, 2366, 199, 624, 17286, 7220, 56, 3343, 2295, 624, 199, 504, 11354, 14, 2537, 492, 627, 199, 646, 24313, 199, 646, 24313, 465, 8484, 199, 504, 24313, 492, 3957, 63, 932, 63, 3512, 63, 475, 63, 23931, 465, 286, 7530, 280, 199, 504, 24313, 14, 4776, 492, 627, 199, 199, 533, 869, 631, 10611, 2925, 8, 785, 304, 339, 347, 3613, 8, 277, 304, 267, 291, 14, 2307, 29, 7343, 14, 2307, 63, 2180, 342, 267, 291, 14, 48, 17, 29, 6413, 21934, 8, 7343, 14, 515, 63, 2180, 8, 17, 395, 2246, 63, 1302, 29, 17, 9, 267, 291, 14, 48, 19, 29, 6413, 21934, 8, 7343, 14, 515, 63, 2180, 8, 19, 395, 2246, 63, 1302, 29, 17, 9, 267, 291, 14, 48, 709, 29, 6413, 21934, 8, 7343, 14, 515, 63, 2180, 8, 709, 395, 2246, 63, 1302, 29, 17, 9, 267, 291, 14, 43, 17, 29, 6413, 21934, 8, 7343, 14, 4883, 63, 2180, 8, 17, 395, 2246, 63, 1302, 29, 17, 9, 267, 291, 14, 43, 19, 29, 6413, 21934, 8, 7343, 14, 4883, 63, 2180, 8, 19, 395, 2246, 63, 1302, 29, 17, 9, 267, 291, 14, 43, 20, 29, 6413, 21934, 8, 7343, 14, 4883, 63, 2180, 8, 20, 395, 2246, 63, 1302, 29, 17, 9, 267, 291, 14, 43, 21, 29, 6413, 21934, 8, 7343, 14, 4883, 63, 2180, 8, 21, 395, 2246, 63, 1302, 29, 17, 9, 267, 291, 14, 43, 709, 29, 6413, 21934, 8, 7343, 14, 4883, 63, 2180, 8, 709, 395, 2246, 63, 1302, 29, 17, 9, 267, 291, 14, 39, 29, 7343, 14, 4578, 339, 347, 511, 63, 354, 8, 277, 304, 267, 598, 29, 277, 14, 39, 8, 354, 628, 396, 531, 267, 702, 63, 1452, 8, 495, 8, 39, 26582, 396, 358, 267, 702, 63, 1452, 8, 39, 14, 354, 2584, 396, 358, 267, 869, 29, 277, 14, 39, 342, 267, 702, 63, 1452, 8, 40, 14, 354, 2584, 358, 339, 327, 23836, 339, 347, 511, 63, 525, 63, 2168, 63, 932, 8, 277, 304, 267, 598, 29, 277, 14, 39, 342, 267, 598, 14, 525, 63, 932, 360, 33, 358, 267, 702, 63, 2052, 8, 39, 14, 1989, 63, 932, 360, 33, 1333, 267, 598, 14, 2168, 63, 932, 360, 33, 358, 267, 702, 63, 3910, 8, 39, 14, 1989, 63, 932, 360, 33, 1333, 339, 347, 511, 63, 2865, 24596, 63, 932, 8, 277, 304, 267, 327, 1379, 340, 282, 2222, 13, 24596, 909, 365, 315, 314, 11513, 14, 221, 437, 2366, 1211, 911, 267, 327, 746, 282, 3146, 12, 1325, 367, 282, 11513, 1021, 282, 3486, 221, 756, 1077, 506, 267, 327, 2138, 334, 3239, 11513, 636, 6134, 28634, 982, 652, 3913, 506, 282, 1031, 2066, 652, 365, 267, 327, 440, 282, 1031, 14, 267, 598, 29, 277, 14, 39, 342, 267, 702, 63, 3910, 8, 39, 14, 1989, 63, 932, 2941, 33, 5156, 267, 702, 63, 3910, 8, 39, 14, 1989, 63, 932, 3252, 33, 356, 17, 12466, 339, 347, 511, 63, 525, 63, 2415, 63, 504, 8, 277, 304, 267, 598, 29, 277, 14, 39, 342, 267, 598, 14, 525, 63, 2415, 63, 504, 8, 513, 480, 25694, 24100, 2237, 267, 702, 63, 2052, 8, 39, 14, 1989, 63, 932, 480, 44, 2237, 267, 598, 14, 2168, 63, 2415, 63, 504, 2941, 40, 1673, 41, 1673, 42, 1673, 43, 1673, 44, 1105, 267, 598, 14, 525, 63, 2415, 63, 504, 779, 17, 12, 18, 12, 19, 12, 20, 566, 267, 702, 63, 1452, 8, 5917, 8, 39, 14, 2415, 1062, 498, 29, 495, 395, 2151, 359, 17, 12, 499, 12, 650, 12, 841, 12, 283, 33, 297, 283, 34, 297, 283, 35, 297, 283, 36, 297, 283, 37, 297, 283, 38, 297, 283, 39, 1105, 267, 327, 511, 636, 1661, 363, 267, 702, 63, 1452, 8, 5917, 8, 39, 12, 498, 29, 495, 395, 2151, 359, 17, 12, 499, 12, 650, 12, 841, 12, 283, 33, 297, 283, 34, 297, 283, 35, 297, 283, 36, 297, 283, 37, 297, 283, 38, 297, 283, 39, 1105, 2378, 347, 511, 63, 6134, 8, 277, 304, 267, 598, 29, 277, 14, 39, 342, 267, 598, 14, 525, 63, 932, 360, 33, 358, 267, 702, 63, 2052, 360, 33, 7, 315, 598, 9, 267, 702, 63, 3910, 779, 61, 315, 598, 9, 221, 327, 7078, 746, 282, 2606, 503, 3146, 315, 642, 511, 267, 702, 63, 3910, 2561, 17, 26, 17, 93, 315, 598, 9, 18407, 347, 511, 63, 525, 63, 2168, 8, 277, 304, 267, 327, 1379, 1050, 63, 932, 436, 2813, 63, 932, 2454, 316, 367, 7750, 8526, 4689, 267, 598, 29, 277, 14, 39, 342, 267, 598, 14, 525, 63, 932, 360, 77, 358, 267, 702, 63, 2052, 8, 39, 14, 1989, 63, 932, 360, 77, 1333, 267, 598, 14, 525, 63, 932, 360, 77, 358, 257, 327, 949, 32493, 13141, 267, 702, 63, 3536, 8, 7343, 14, 4491, 29356, 12, 39, 14, 2168, 63, 932, 2584, 74, 358, 267, 598, 14, 2168, 63, 932, 360, 77, 358, 267, 702, 63, 1452, 8, 513, 8, 39, 395, 3073, 339, 347, 511, 63, 4994, 4689, 63, 374, 63, 513, 8, 277, 304, 267, 598, 29, 277, 14, 39, 342, 267, 598, 14, 525, 63, 2415, 63, 504, 8, 513, 480, 31578, 2237, 4960, 598, 14, 525, 63, 2415, 63, 504, 8, 277, 14, 48, 19, 9, 327, 1050, 8526, 4689, 402, 3380, 334, 4994, 4689, 29, 4578, 9, 267, 702, 63, 1452, 8, 5917, 8, 39, 14, 2415, 1062, 498, 29, 495, 395, 2151, 359, 17, 12, 499, 12, 650, 12, 283, 33, 297, 283, 34, 297, 283, 35, 297, 283, 36, 1105, 267, 598, 14, 2168, 63, 2415, 63, 504, 8, 277, 14, 48, 19, 9, 327, 2813, 8526, 4689, 402, 3380, 334, 4994, 4689, 29, 4578, 9, 267, 702, 63, 1452, 8, 5917, 8, 39, 14, 2415, 1062, 498, 29, 495, 395, 2151, 788, 33, 297, 283, 34, 297, 283, 35, 297, 283, 36, 1105, 339, 347, 511, 63, 4994, 4689, 63, 374, 63, 409, 8, 277, 304, 267, 598, 29, 277, 14, 39, 342, 267, 8526, 4689, 0 ]
[ 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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 2014, 2015 CERN. # # Invenio is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License as # published by the Free Software Foundation; either version 2 of the # License, or (at your option) any later version. # # Invenio is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License # along with Invenio; if not, write to the Free Software Foundation, Inc., # 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. """Registries for search module.""" from flask_registry import RegistryError, ModuleAutoDiscoveryRegistry, \ RegistryProxy from werkzeug.utils import cached_property from invenio.ext.registry import DictModuleAutoDiscoverySubRegistry, \ ModuleAutoDiscoverySubRegistry from invenio.modules.search.models import FacetCollection from invenio.modules.search.facet_builders import FacetBuilder from invenio.utils.memoise import memoize searchext = RegistryProxy('searchext', ModuleAutoDiscoveryRegistry, 'searchext') class SearchServiceRegistry(ModuleAutoDiscoverySubRegistry): """Search Service Registry.""" __required_plugin_API_version__ = "Search Service Plugin API 1.0" def register(self, item): """Check plugin version and instantiate search service plugin.""" if item.__plugin_version__ != self.__required_plugin_API_version__: raise RegistryError( 'Invalid plugin version {0} required {1}'.format( item.__plugin_version__, self.__required_plugin_API_version__ )) service = getattr(item, item.__name__.split('.')[-1]) return super(SearchServiceRegistry, self).register(service()) services = RegistryProxy('searchext.services', SearchServiceRegistry, 'services', registry_namespace=searchext) class FacetsRegistry(DictModuleAutoDiscoverySubRegistry): """Registry for facets modules. Serves also modules sets and their configuration for specific collections. """ def keygetter(self, key, original_value, new_value): """ Method used to compute the key for a value being registered. The key is the facet name stored in facet module. :param key: Key if provided by the user. Defaults to None. :param value: Value being registered. FacetBuilder object """ return new_value.name def valuegetter(self, value): """Return FacetBuilder from inside the module. :param value: loaded python module with FacetBuilder instance stored in facet property """ if self.facet_plugin_checker(value): return value.facet @classmethod def facet_plugin_checker(cls, plugin_code): """Handy function to check facet plugin. :param plugin_code: a module with facet definition - should have facet variable """ if 'facet' in dir(plugin_code): candidate = getattr(plugin_code, 'facet') if isinstance(candidate, FacetBuilder): return candidate @memoize def get_facets_for_collection(self, collection_id): """Return facets set for a collection. :param collection_id: the collection id for requested facets set """ facets_conf = FacetCollection.query\ .filter(FacetCollection.id_collection == collection_id)\ .order_by(FacetCollection.order)\ .all() collection_facets = [] for facet in facets_conf: if facet.facet_name not in self.keys(): raise RegistryError( 'Facet %s is not available.' + 'Maybe it\'s on PACKAGES_FACETS_EXCLUDE config list' % facet.facet_name) collection_facets.append(self.get(facet.facet_name)) return collection_facets @cached_property def default_facets(self): """Return default set of facets.""" return self.get_facets_for_collection(1) def get_facets_config(self, collection, qid): """Return facet config for the collection. If no configuration found returns the default facets set. :param collection: Collection object facets matching which are returned :param qid: md5 hash of search parameters generated by get_search_query_id() from invenio.modules.search.cache """ if collection and self.get_facets_for_collection(collection.id): facets_set = self.get_facets_for_collection(collection.id) else: facets_set = self.default_facets return [facet.get_conf(collection=collection, qid=qid) for facet in facets_set] facets = RegistryProxy('facets', FacetsRegistry, 'facets')
gpl-2.0
[ 3, 1882, 2803, 26, 2774, 13, 24, 1882, 199, 3, 199, 3, 961, 570, 365, 1777, 402, 12235, 14, 199, 3, 1898, 334, 35, 9, 6927, 12, 6900, 24354, 14, 199, 3, 199, 3, 12235, 365, 2867, 2032, 27, 1265, 883, 3604, 652, 436, 15, 269, 199, 3, 2811, 652, 1334, 314, 2895, 402, 314, 1664, 1696, 1684, 844, 465, 199, 3, 3267, 701, 314, 2868, 2290, 2752, 27, 1902, 1015, 499, 402, 314, 199, 3, 844, 12, 503, 334, 292, 2195, 945, 9, 1263, 2945, 1015, 14, 199, 3, 199, 3, 12235, 365, 1854, 315, 314, 3661, 626, 652, 911, 506, 2997, 12, 1325, 199, 3, 2428, 1821, 3408, 27, 1928, 2755, 314, 2478, 3750, 402, 199, 3, 3169, 503, 3092, 2381, 437, 3115, 3104, 14, 221, 1666, 314, 1664, 199, 3, 1696, 1684, 844, 367, 1655, 2436, 14, 199, 3, 199, 3, 2047, 1077, 1172, 3086, 282, 1331, 402, 314, 1664, 1696, 1684, 844, 199, 3, 3180, 543, 12235, 27, 340, 440, 12, 2218, 370, 314, 2868, 2290, 2752, 12, 3277, 2020, 199, 3, 8155, 15630, 10902, 12, 14453, 13540, 12, 8226, 12, 4828, 15673, 13, 13421, 12, 8217, 14, 199, 199, 624, 2872, 631, 1996, 367, 2754, 859, 1041, 199, 199, 504, 7209, 63, 5189, 492, 20738, 547, 12, 5673, 3358, 2825, 6913, 10899, 12, 971, 272, 20738, 4936, 199, 504, 10380, 14, 1208, 492, 6328, 63, 1829, 199, 199, 504, 13640, 14, 832, 14, 5189, 492, 7448, 2377, 3358, 2825, 6913, 2610, 10899, 12, 971, 272, 5673, 3358, 2825, 6913, 2610, 10899, 199, 504, 13640, 14, 3112, 14, 1733, 14, 992, 492, 21459, 84, 7768, 199, 504, 13640, 14, 3112, 14, 1733, 14, 24271, 63, 20968, 492, 21459, 84, 6437, 199, 504, 13640, 14, 1208, 14, 11979, 572, 492, 11955, 794, 199, 199, 261, 285, 595, 400, 275, 20738, 4936, 360, 261, 285, 595, 400, 297, 5673, 3358, 2825, 6913, 10899, 12, 2079, 283, 261, 285, 595, 400, 358, 421, 199, 533, 8730, 3167, 10899, 8, 2377, 3358, 2825, 6913, 2610, 10899, 304, 339, 408, 5278, 7591, 20738, 1041, 339, 636, 2427, 63, 2718, 63, 3735, 63, 1023, 363, 275, 298, 5278, 7591, 11349, 3261, 413, 14, 16, 2, 339, 347, 2274, 8, 277, 12, 1242, 304, 267, 408, 1799, 3589, 1015, 436, 17321, 2754, 2435, 3589, 1041, 267, 340, 1242, 855, 2718, 63, 1023, 363, 1137, 291, 855, 2427, 63, 2718, 63, 3735, 63, 1023, 10651, 288, 746, 20738, 547, 8, 355, 283, 3364, 3589, 1015, 469, 16, 93, 1415, 469, 17, 5285, 908, 8, 490, 1242, 855, 2718, 63, 1023, 3108, 490, 291, 855, 2427, 63, 2718, 63, 3735, 63, 1023, 363, 355, 5082, 267, 2435, 275, 2519, 8, 1053, 12, 1242, 855, 354, 4343, 1294, 29084, 17, 566, 267, 372, 1613, 8, 5278, 3167, 10899, 12, 291, 680, 2683, 8, 1364, 1012, 199, 199, 5950, 275, 20738, 4936, 360, 261, 285, 595, 400, 14, 5950, 297, 8730, 3167, 10899, 12, 586, 283, 5950, 297, 7086, 63, 3251, 29, 261, 285, 595, 400, 9, 421, 199, 533, 21459, 1086, 10899, 8, 2141, 2377, 3358, 2825, 6913, 2610, 10899, 304, 339, 408, 10899, 367, 8870, 1086, 4621, 14, 339, 3739, 2310, 2597, 4621, 5951, 436, 3932, 2897, 272, 367, 2488, 5055, 14, 272, 408, 339, 347, 790, 7416, 8, 277, 12, 790, 12, 3379, 63, 585, 12, 892, 63, 585, 304, 267, 408, 267, 9075, 1202, 370, 4526, 314, 790, 367, 282, 574, 3769, 7264, 14, 398, 710, 790, 365, 314, 8870, 84, 536, 5489, 315, 8870, 84, 859, 14, 398, 520, 635, 790, 26, 2606, 340, 2741, 701, 314, 922, 14, 7827, 370, 488, 14, 267, 520, 635, 574, 26, 1594, 3769, 7264, 14, 21459, 84, 6437, 909, 267, 408, 267, 372, 892, 63, 585, 14, 354, 339, 347, 574, 7416, 8, 277, 12, 574, 304, 267, 408, 1767, 21459, 84, 6437, 687, 6272, 314, 859, 14, 398, 520, 635, 574, 26, 6511, 2366, 859, 543, 21459, 84, 6437, 1256, 288, 5489, 315, 8870, 84, 3324, 267, 408, 267, 340, 291, 14, 24271, 63, 2718, 63, 6743, 8, 585, 304, 288, 372, 574, 14, 24271, 339, 768, 3744, 272, 347, 8870, 84, 63, 2718, 63, 6743, 8, 1886, 12, 3589, 63, 600, 304, 267, 408, 13220, 89, 805, 370, 1104, 8870, 84, 3589, 14, 398, 520, 635, 3589, 63, 600, 26, 282, 859, 543, 8870, 84, 5492, 446, 1077, 1172, 8870, 84, 288, 1750, 267, 408, 267, 340, 283, 24271, 7, 315, 2935, 8, 2718, 63, 600, 304, 288, 7627, 275, 2519, 8, 2718, 63, 600, 12, 283, 24271, 358, 288, 340, 1228, 8, 9007, 12, 21459, 84, 6437, 304, 355, 372, 7627, 339, 768, 11979, 794, 272, 347, 664, 63, 1409, 1086, 63, 509, 63, 3627, 8, 277, 12, 3245, 63, 344, 304, 267, 408, 1767, 8870, 1086, 663, 367, 282, 3245, 14, 398, 520, 635, 3245, 63, 344, 26, 314, 3245, 1305, 367, 5839, 8870, 1086, 663, 267, 408, 267, 8870, 1086, 63, 2190, 275, 21459, 84, 7768, 14, 1131, 60, 288, 1275, 1541, 8, 13414, 84, 7768, 14, 344, 63, 3627, 508, 3245, 63, 344, 2862, 288, 1275, 1648, 63, 991, 8, 13414, 84, 7768, 14, 1648, 2862, 288, 1275, 452, 342, 398, 3245, 63, 1409, 1086, 275, 942, 267, 367, 8870, 84, 315, 8870, 1086, 63, 2190, 26, 288, 340, 8870, 84, 14, 24271, 63, 354, 440, 315, 291, 14, 1612, 837, 355, 746, 20738, 547, 8, 490, 283, 13414, 84, 450, 83, 365, 440, 2808, 3530, 435, 490, 283, 15586, 1235, 652, 3985, 83, 641, 510, 3099, 5383, 63, 38, 1348, 30416, 63, 1438, 13958, 1101, 769, 7, 490, 450, 8870, 84, 14, 24271, 63, 354, 9, 288, 3245, 63, 1409, 1086, 14, 740, 8, 277, 14, 362, 8, 24271, 14, 24271, 63, 354, 430, 398, 372, 3245, 63, 1409, 1086, 339, 768, 5245, 63, 1829, 272, 347, 849, 63, 1409, 1086, 8, 277, 304, 267, 408, 1767, 849, 663, 402, 8870, 1086, 1041, 267, 372, 291, 14, 362, 63, 1409, 1086, 63, 509, 63, 3627, 8, 17, 9, 339, 347, 664, 63, 1409, 1086, 63, 888, 8, 277, 12, 3245, 12, 1894, 344, 304, 267, 408, 1767, 8870, 84, 1101, 367, 314 ]
[ 1882, 2803, 26, 2774, 13, 24, 1882, 199, 3, 199, 3, 961, 570, 365, 1777, 402, 12235, 14, 199, 3, 1898, 334, 35, 9, 6927, 12, 6900, 24354, 14, 199, 3, 199, 3, 12235, 365, 2867, 2032, 27, 1265, 883, 3604, 652, 436, 15, 269, 199, 3, 2811, 652, 1334, 314, 2895, 402, 314, 1664, 1696, 1684, 844, 465, 199, 3, 3267, 701, 314, 2868, 2290, 2752, 27, 1902, 1015, 499, 402, 314, 199, 3, 844, 12, 503, 334, 292, 2195, 945, 9, 1263, 2945, 1015, 14, 199, 3, 199, 3, 12235, 365, 1854, 315, 314, 3661, 626, 652, 911, 506, 2997, 12, 1325, 199, 3, 2428, 1821, 3408, 27, 1928, 2755, 314, 2478, 3750, 402, 199, 3, 3169, 503, 3092, 2381, 437, 3115, 3104, 14, 221, 1666, 314, 1664, 199, 3, 1696, 1684, 844, 367, 1655, 2436, 14, 199, 3, 199, 3, 2047, 1077, 1172, 3086, 282, 1331, 402, 314, 1664, 1696, 1684, 844, 199, 3, 3180, 543, 12235, 27, 340, 440, 12, 2218, 370, 314, 2868, 2290, 2752, 12, 3277, 2020, 199, 3, 8155, 15630, 10902, 12, 14453, 13540, 12, 8226, 12, 4828, 15673, 13, 13421, 12, 8217, 14, 199, 199, 624, 2872, 631, 1996, 367, 2754, 859, 1041, 199, 199, 504, 7209, 63, 5189, 492, 20738, 547, 12, 5673, 3358, 2825, 6913, 10899, 12, 971, 272, 20738, 4936, 199, 504, 10380, 14, 1208, 492, 6328, 63, 1829, 199, 199, 504, 13640, 14, 832, 14, 5189, 492, 7448, 2377, 3358, 2825, 6913, 2610, 10899, 12, 971, 272, 5673, 3358, 2825, 6913, 2610, 10899, 199, 504, 13640, 14, 3112, 14, 1733, 14, 992, 492, 21459, 84, 7768, 199, 504, 13640, 14, 3112, 14, 1733, 14, 24271, 63, 20968, 492, 21459, 84, 6437, 199, 504, 13640, 14, 1208, 14, 11979, 572, 492, 11955, 794, 199, 199, 261, 285, 595, 400, 275, 20738, 4936, 360, 261, 285, 595, 400, 297, 5673, 3358, 2825, 6913, 10899, 12, 2079, 283, 261, 285, 595, 400, 358, 421, 199, 533, 8730, 3167, 10899, 8, 2377, 3358, 2825, 6913, 2610, 10899, 304, 339, 408, 5278, 7591, 20738, 1041, 339, 636, 2427, 63, 2718, 63, 3735, 63, 1023, 363, 275, 298, 5278, 7591, 11349, 3261, 413, 14, 16, 2, 339, 347, 2274, 8, 277, 12, 1242, 304, 267, 408, 1799, 3589, 1015, 436, 17321, 2754, 2435, 3589, 1041, 267, 340, 1242, 855, 2718, 63, 1023, 363, 1137, 291, 855, 2427, 63, 2718, 63, 3735, 63, 1023, 10651, 288, 746, 20738, 547, 8, 355, 283, 3364, 3589, 1015, 469, 16, 93, 1415, 469, 17, 5285, 908, 8, 490, 1242, 855, 2718, 63, 1023, 3108, 490, 291, 855, 2427, 63, 2718, 63, 3735, 63, 1023, 363, 355, 5082, 267, 2435, 275, 2519, 8, 1053, 12, 1242, 855, 354, 4343, 1294, 29084, 17, 566, 267, 372, 1613, 8, 5278, 3167, 10899, 12, 291, 680, 2683, 8, 1364, 1012, 199, 199, 5950, 275, 20738, 4936, 360, 261, 285, 595, 400, 14, 5950, 297, 8730, 3167, 10899, 12, 586, 283, 5950, 297, 7086, 63, 3251, 29, 261, 285, 595, 400, 9, 421, 199, 533, 21459, 1086, 10899, 8, 2141, 2377, 3358, 2825, 6913, 2610, 10899, 304, 339, 408, 10899, 367, 8870, 1086, 4621, 14, 339, 3739, 2310, 2597, 4621, 5951, 436, 3932, 2897, 272, 367, 2488, 5055, 14, 272, 408, 339, 347, 790, 7416, 8, 277, 12, 790, 12, 3379, 63, 585, 12, 892, 63, 585, 304, 267, 408, 267, 9075, 1202, 370, 4526, 314, 790, 367, 282, 574, 3769, 7264, 14, 398, 710, 790, 365, 314, 8870, 84, 536, 5489, 315, 8870, 84, 859, 14, 398, 520, 635, 790, 26, 2606, 340, 2741, 701, 314, 922, 14, 7827, 370, 488, 14, 267, 520, 635, 574, 26, 1594, 3769, 7264, 14, 21459, 84, 6437, 909, 267, 408, 267, 372, 892, 63, 585, 14, 354, 339, 347, 574, 7416, 8, 277, 12, 574, 304, 267, 408, 1767, 21459, 84, 6437, 687, 6272, 314, 859, 14, 398, 520, 635, 574, 26, 6511, 2366, 859, 543, 21459, 84, 6437, 1256, 288, 5489, 315, 8870, 84, 3324, 267, 408, 267, 340, 291, 14, 24271, 63, 2718, 63, 6743, 8, 585, 304, 288, 372, 574, 14, 24271, 339, 768, 3744, 272, 347, 8870, 84, 63, 2718, 63, 6743, 8, 1886, 12, 3589, 63, 600, 304, 267, 408, 13220, 89, 805, 370, 1104, 8870, 84, 3589, 14, 398, 520, 635, 3589, 63, 600, 26, 282, 859, 543, 8870, 84, 5492, 446, 1077, 1172, 8870, 84, 288, 1750, 267, 408, 267, 340, 283, 24271, 7, 315, 2935, 8, 2718, 63, 600, 304, 288, 7627, 275, 2519, 8, 2718, 63, 600, 12, 283, 24271, 358, 288, 340, 1228, 8, 9007, 12, 21459, 84, 6437, 304, 355, 372, 7627, 339, 768, 11979, 794, 272, 347, 664, 63, 1409, 1086, 63, 509, 63, 3627, 8, 277, 12, 3245, 63, 344, 304, 267, 408, 1767, 8870, 1086, 663, 367, 282, 3245, 14, 398, 520, 635, 3245, 63, 344, 26, 314, 3245, 1305, 367, 5839, 8870, 1086, 663, 267, 408, 267, 8870, 1086, 63, 2190, 275, 21459, 84, 7768, 14, 1131, 60, 288, 1275, 1541, 8, 13414, 84, 7768, 14, 344, 63, 3627, 508, 3245, 63, 344, 2862, 288, 1275, 1648, 63, 991, 8, 13414, 84, 7768, 14, 1648, 2862, 288, 1275, 452, 342, 398, 3245, 63, 1409, 1086, 275, 942, 267, 367, 8870, 84, 315, 8870, 1086, 63, 2190, 26, 288, 340, 8870, 84, 14, 24271, 63, 354, 440, 315, 291, 14, 1612, 837, 355, 746, 20738, 547, 8, 490, 283, 13414, 84, 450, 83, 365, 440, 2808, 3530, 435, 490, 283, 15586, 1235, 652, 3985, 83, 641, 510, 3099, 5383, 63, 38, 1348, 30416, 63, 1438, 13958, 1101, 769, 7, 490, 450, 8870, 84, 14, 24271, 63, 354, 9, 288, 3245, 63, 1409, 1086, 14, 740, 8, 277, 14, 362, 8, 24271, 14, 24271, 63, 354, 430, 398, 372, 3245, 63, 1409, 1086, 339, 768, 5245, 63, 1829, 272, 347, 849, 63, 1409, 1086, 8, 277, 304, 267, 408, 1767, 849, 663, 402, 8870, 1086, 1041, 267, 372, 291, 14, 362, 63, 1409, 1086, 63, 509, 63, 3627, 8, 17, 9, 339, 347, 664, 63, 1409, 1086, 63, 888, 8, 277, 12, 3245, 12, 1894, 344, 304, 267, 408, 1767, 8870, 84, 1101, 367, 314, 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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1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
SoSBallers/pogo-map
pogom/pgoapi/pgoapi.py
28
6203
""" pgoapi - Pokemon Go API Copyright (c) 2016 tjado <https://github.com/tejado> Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Author: tjado <https://github.com/tejado> """ import logging import re import requests from utilities import f2i, h2f from rpc_api import RpcApi from auth_ptc import AuthPtc from auth_google import AuthGoogle from exceptions import AuthException, NotLoggedInException, ServerBusyOrOfflineException import protos.RpcEnum_pb2 as RpcEnum logger = logging.getLogger(__name__) class PGoApi: API_ENTRY = 'https://pgorelease.nianticlabs.com/plfe/rpc' def __init__(self): self.log = logging.getLogger(__name__) self._auth_provider = None self._api_endpoint = None self._position_lat = 0 self._position_lng = 0 self._position_alt = 0 self._req_method_list = [] def call(self): if not self._req_method_list: return False if self._auth_provider is None or not self._auth_provider.is_login(): self.log.info('Not logged in') return False player_position = self.get_position() request = RpcApi(self._auth_provider) if self._api_endpoint: api_endpoint = self._api_endpoint else: api_endpoint = self.API_ENTRY self.log.info('Execution of RPC') response = None try: response = request.request(api_endpoint, self._req_method_list, player_position) except ServerBusyOrOfflineException as e: self.log.info('Server seems to be busy or offline - try again!') # cleanup after call execution self.log.info('Cleanup of request!') self._req_method_list = [] return response #def get_player(self): def list_curr_methods(self): for i in self._req_method_list: print("{} ({})".format(RpcEnum.RequestMethod.Name(i),i)) def set_logger(self, logger): self._ = logger or logging.getLogger(__name__) def get_position(self): return (self._position_lat, self._position_lng, self._position_alt) def set_position(self, lat, lng, alt): self.log.debug('Set Position - Lat: %s Long: %s Alt: %s', lat, lng, alt) self._position_lat = f2i(lat) self._position_lng = f2i(lng) self._position_alt = f2i(alt) def __getattr__(self, func): def function(**kwargs): if not self._req_method_list: self.log.info('Create new request...') name = func.upper() if kwargs: self._req_method_list.append( { RpcEnum.RequestMethod.Value(name): kwargs } ) self.log.info("Adding '%s' to RPC request including arguments", name) self.log.debug("Arguments of '%s': \n\r%s", name, kwargs) else: self._req_method_list.append( RpcEnum.RequestMethod.Value(name) ) self.log.info("Adding '%s' to RPC request", name) return self if func.upper() in RpcEnum.RequestMethod.keys(): return function else: raise AttributeError def login(self, provider, username, password): if not isinstance(username, basestring) or not isinstance(password, basestring): raise AuthException("Username/password not correctly specified") if provider == 'ptc': self._auth_provider = AuthPtc() elif provider == 'google': self._auth_provider = AuthGoogle() else: raise AuthException("Invalid authentication provider - only ptc/google available.") self.log.debug('Auth provider: %s', provider) if not self._auth_provider.login(username, password): self.log.info('Login process failed') return False self.log.info('Starting RPC login sequence (app simulation)') # making a standard call, like it is also done by the client self.get_player() self.get_hatched_eggs() self.get_inventory() self.check_awarded_badges() self.download_settings(hash="4a2e9bc330dae60e7b74fc85b98868ab4700802e") response = self.call() if not response: self.log.info('Login failed!') return False if 'api_url' in response: self._api_endpoint = ('https://{}/rpc'.format(response['api_url'])) self.log.debug('Setting API endpoint to: %s', self._api_endpoint) elif 'auth_ticket' in response: auth_ticket = response['auth_ticket'] self._auth_provider.set_ticket([auth_ticket['expire_timestamp_ms'], auth_ticket['start'], auth_ticket['end']]) else: self.log.error('Login failed - unexpected server response!') return False self.log.info('Finished RPC login sequence (app simulation)') self.log.info('Login process completed') return True
agpl-3.0
[ 624, 199, 80, 1939, 1246, 446, 4376, 17180, 3971, 3261, 199, 7384, 334, 67, 9, 7800, 307, 74, 5129, 665, 2859, 921, 5031, 14, 957, 15, 266, 74, 5129, 30, 199, 199, 7980, 365, 11882, 10009, 12, 2867, 402, 11204, 12, 370, 1263, 4954, 12408, 282, 1331, 199, 1618, 642, 2032, 436, 4568, 3794, 1584, 334, 1589, 298, 10337, 1288, 370, 7962, 199, 262, 314, 2290, 1928, 10588, 12, 5893, 1928, 12305, 314, 4481, 199, 475, 675, 12, 1331, 12, 2811, 12, 5389, 12, 2780, 12, 11207, 12, 13473, 12, 436, 15, 269, 12743, 199, 16847, 402, 314, 2290, 12, 436, 370, 11291, 12103, 370, 12676, 314, 2290, 365, 199, 70, 13399, 370, 886, 880, 12, 5420, 370, 314, 2569, 3704, 26, 199, 199, 1918, 3432, 4248, 4245, 436, 642, 4983, 4245, 10989, 506, 5120, 315, 1006, 199, 16847, 503, 13393, 12468, 402, 314, 2290, 14, 199, 199, 18061, 4141, 2281, 7049, 298, 1179, 2281, 401, 2428, 3408, 1634, 1821, 3826, 12, 199, 1438, 5786, 1549, 5292, 12, 6931, 5400, 2845, 5471, 2296, 2334, 2990, 1634, 199, 31461, 12, 3092, 2381, 437, 3115, 3104, 2401, 13229, 14, 199, 568, 4825, 6461, 7000, 2334, 10610, 1549, 5877, 8164, 6262, 7024, 2381, 1821, 13140, 12, 199, 36, 1156, 5383, 1549, 5010, 5603, 12, 7061, 1621, 1261, 9612, 1634, 7066, 12, 7056, 1549, 199, 18400, 7095, 12, 7043, 4442, 12, 5738, 1634, 1549, 1621, 11287, 1663, 2334, 4141, 1549, 2334, 4815, 199, 726, 5010, 13198, 1621, 2334, 4141, 14, 199, 199, 5949, 26, 307, 74, 5129, 665, 2859, 921, 5031, 14, 957, 15, 266, 74, 5129, 30, 199, 624, 199, 199, 646, 2050, 199, 646, 295, 199, 646, 4145, 199, 199, 504, 15841, 492, 289, 18, 73, 12, 394, 18, 70, 199, 199, 504, 8985, 63, 1246, 492, 820, 2352, 7394, 199, 504, 1790, 63, 541, 67, 492, 3590, 48, 3641, 199, 504, 1790, 63, 3098, 492, 3590, 13266, 199, 504, 4967, 492, 3590, 1726, 12, 2832, 28985, 607, 1726, 12, 7146, 28759, 2844, 5195, 604, 1726, 199, 199, 646, 4104, 83, 14, 15569, 5081, 63, 3317, 18, 465, 820, 2352, 5081, 199, 199, 2921, 275, 2050, 14, 5572, 3460, 354, 3368, 199, 199, 533, 510, 7250, 7394, 26, 339, 3261, 63, 7285, 275, 283, 2859, 921, 4198, 720, 1756, 14, 8445, 4466, 429, 2101, 14, 957, 15, 80, 276, 69, 15, 4354, 7, 339, 347, 636, 826, 721, 277, 304, 13857, 291, 14, 793, 275, 2050, 14, 5572, 3460, 354, 3368, 398, 291, 423, 1178, 63, 3780, 275, 488, 267, 291, 423, 1246, 63, 6520, 275, 488, 2728, 291, 423, 3124, 63, 4452, 275, 378, 267, 291, 423, 3124, 63, 23829, 275, 378, 267, 291, 423, 3124, 63, 4478, 275, 378, 398, 291, 423, 2103, 63, 765, 63, 513, 275, 942, 5493, 347, 1240, 8, 277, 304, 267, 340, 440, 291, 423, 2103, 63, 765, 63, 513, 26, 288, 372, 756, 2728, 340, 291, 423, 1178, 63, 3780, 365, 488, 503, 440, 291, 423, 1178, 63, 3780, 14, 374, 63, 2886, 837, 288, 291, 14, 793, 14, 815, 360, 1763, 10367, 315, 358, 288, 372, 756, 2728, 7748, 63, 3124, 275, 291, 14, 362, 63, 3124, 342, 2728, 1056, 275, 820, 2352, 7394, 8, 277, 423, 1178, 63, 3780, 9, 2728, 340, 291, 423, 1246, 63, 6520, 26, 288, 2986, 63, 6520, 275, 291, 423, 1246, 63, 6520, 267, 587, 26, 288, 2986, 63, 6520, 275, 291, 14, 3735, 63, 7285, 2728, 291, 14, 793, 14, 815, 360, 11310, 402, 11785, 358, 267, 1177, 275, 488, 267, 862, 26, 288, 1177, 275, 1056, 14, 1069, 8, 1246, 63, 6520, 12, 291, 423, 2103, 63, 765, 63, 513, 12, 7748, 63, 3124, 9, 267, 871, 7146, 28759, 2844, 5195, 604, 1726, 465, 325, 26, 288, 291, 14, 793, 14, 815, 360, 3120, 12237, 370, 506, 10414, 89, 503, 26302, 446, 862, 4020, 10916, 2728, 327, 9058, 2410, 1240, 6451, 267, 291, 14, 793, 14, 815, 360, 7891, 402, 1056, 10916, 267, 291, 423, 2103, 63, 765, 63, 513, 275, 942, 2728, 372, 1177, 2286, 327, 318, 664, 63, 6147, 8, 277, 304, 2286, 347, 769, 63, 9808, 63, 2474, 8, 277, 304, 267, 367, 284, 315, 291, 423, 2103, 63, 765, 63, 513, 26, 288, 870, 20794, 11459, 25974, 908, 8, 15569, 5081, 14, 2017, 3767, 14, 985, 8, 73, 395, 73, 430, 2286, 347, 663, 63, 2921, 8, 277, 12, 2512, 304, 267, 291, 423, 275, 2512, 503, 2050, 14, 5572, 3460, 354, 3368, 339, 347, 664, 63, 3124, 8, 277, 304, 267, 372, 334, 277, 423, 3124, 63, 4452, 12, 291, 423, 3124, 63, 23829, 12, 291, 423, 3124, 63, 4478, 9, 339, 347, 663, 63, 3124, 8, 277, 12, 8396, 12, 634, 2753, 12, 8791, 304, 259, 267, 291, 14, 793, 14, 1757, 360, 1084, 15483, 446, 491, 292, 26, 450, 83, 19944, 26, 450, 83, 437, 4116, 26, 450, 83, 297, 8396, 12, 634, 2753, 12, 8791, 9, 2728, 291, 423, 3124, 63, 4452, 275, 289, 18, 73, 8, 4452, 9, 267, 291, 423, 3124, 63, 23829, 275, 289, 18, 73, 8, 23829, 9, 267, 291, 423, 3124, 63, 4478, 275, 289, 18, 73, 8, 4478, 9, 339, 347, 636, 5675, 721, 277, 12, 2562, 304, 267, 347, 805, 3682, 958, 304, 27180, 340, 440, 291, 423, 2103, 63, 765, 63, 513, 26, 355, 291, 14, 793, 14, 815, 360, 2499, 892, 1056, 15103, 27180, 536, 275, 2562, 14, 4142, 342, 288, 340, 2074, 26, 355, 291, 423, 2103, 63, 765, 63, 513, 14, 740, 8, 469, 820, 2352, 5081, 14, 2017, 3767, 14, 1110, 8, 354, 304, 2074, 789, 776, 355, 291, 14, 793, 14, 815, 480, 20897, 1543, 83, 7, 370, 11785, 1056, 5893, 2368, 401, 536, 9, 355, 291, 14, 793, 14, 1757, 480, 14517, 402, 1543, 83, 356, 971, 78, 60, 82, 5, 83, 401, 536, 12, 2074, 9, 288, 587, 26, 355, 291, 423, 2103, 63, 765, 63, 513, 14, 740, 8, 820, 2352, 5081, 14, 2017, 3767, 14, 1110, 8, 354, 9, 776, 355, 291, 14, 793, 14, 815, 480, 20897, 1543, 83, 7, 370, 11785, 1056, 401, 536, 9, 272, 288, 372, 291, 272, 267, 340 ]
[ 199, 80, 1939, 1246, 446, 4376, 17180, 3971, 3261, 199, 7384, 334, 67, 9, 7800, 307, 74, 5129, 665, 2859, 921, 5031, 14, 957, 15, 266, 74, 5129, 30, 199, 199, 7980, 365, 11882, 10009, 12, 2867, 402, 11204, 12, 370, 1263, 4954, 12408, 282, 1331, 199, 1618, 642, 2032, 436, 4568, 3794, 1584, 334, 1589, 298, 10337, 1288, 370, 7962, 199, 262, 314, 2290, 1928, 10588, 12, 5893, 1928, 12305, 314, 4481, 199, 475, 675, 12, 1331, 12, 2811, 12, 5389, 12, 2780, 12, 11207, 12, 13473, 12, 436, 15, 269, 12743, 199, 16847, 402, 314, 2290, 12, 436, 370, 11291, 12103, 370, 12676, 314, 2290, 365, 199, 70, 13399, 370, 886, 880, 12, 5420, 370, 314, 2569, 3704, 26, 199, 199, 1918, 3432, 4248, 4245, 436, 642, 4983, 4245, 10989, 506, 5120, 315, 1006, 199, 16847, 503, 13393, 12468, 402, 314, 2290, 14, 199, 199, 18061, 4141, 2281, 7049, 298, 1179, 2281, 401, 2428, 3408, 1634, 1821, 3826, 12, 199, 1438, 5786, 1549, 5292, 12, 6931, 5400, 2845, 5471, 2296, 2334, 2990, 1634, 199, 31461, 12, 3092, 2381, 437, 3115, 3104, 2401, 13229, 14, 199, 568, 4825, 6461, 7000, 2334, 10610, 1549, 5877, 8164, 6262, 7024, 2381, 1821, 13140, 12, 199, 36, 1156, 5383, 1549, 5010, 5603, 12, 7061, 1621, 1261, 9612, 1634, 7066, 12, 7056, 1549, 199, 18400, 7095, 12, 7043, 4442, 12, 5738, 1634, 1549, 1621, 11287, 1663, 2334, 4141, 1549, 2334, 4815, 199, 726, 5010, 13198, 1621, 2334, 4141, 14, 199, 199, 5949, 26, 307, 74, 5129, 665, 2859, 921, 5031, 14, 957, 15, 266, 74, 5129, 30, 199, 624, 199, 199, 646, 2050, 199, 646, 295, 199, 646, 4145, 199, 199, 504, 15841, 492, 289, 18, 73, 12, 394, 18, 70, 199, 199, 504, 8985, 63, 1246, 492, 820, 2352, 7394, 199, 504, 1790, 63, 541, 67, 492, 3590, 48, 3641, 199, 504, 1790, 63, 3098, 492, 3590, 13266, 199, 504, 4967, 492, 3590, 1726, 12, 2832, 28985, 607, 1726, 12, 7146, 28759, 2844, 5195, 604, 1726, 199, 199, 646, 4104, 83, 14, 15569, 5081, 63, 3317, 18, 465, 820, 2352, 5081, 199, 199, 2921, 275, 2050, 14, 5572, 3460, 354, 3368, 199, 199, 533, 510, 7250, 7394, 26, 339, 3261, 63, 7285, 275, 283, 2859, 921, 4198, 720, 1756, 14, 8445, 4466, 429, 2101, 14, 957, 15, 80, 276, 69, 15, 4354, 7, 339, 347, 636, 826, 721, 277, 304, 13857, 291, 14, 793, 275, 2050, 14, 5572, 3460, 354, 3368, 398, 291, 423, 1178, 63, 3780, 275, 488, 267, 291, 423, 1246, 63, 6520, 275, 488, 2728, 291, 423, 3124, 63, 4452, 275, 378, 267, 291, 423, 3124, 63, 23829, 275, 378, 267, 291, 423, 3124, 63, 4478, 275, 378, 398, 291, 423, 2103, 63, 765, 63, 513, 275, 942, 5493, 347, 1240, 8, 277, 304, 267, 340, 440, 291, 423, 2103, 63, 765, 63, 513, 26, 288, 372, 756, 2728, 340, 291, 423, 1178, 63, 3780, 365, 488, 503, 440, 291, 423, 1178, 63, 3780, 14, 374, 63, 2886, 837, 288, 291, 14, 793, 14, 815, 360, 1763, 10367, 315, 358, 288, 372, 756, 2728, 7748, 63, 3124, 275, 291, 14, 362, 63, 3124, 342, 2728, 1056, 275, 820, 2352, 7394, 8, 277, 423, 1178, 63, 3780, 9, 2728, 340, 291, 423, 1246, 63, 6520, 26, 288, 2986, 63, 6520, 275, 291, 423, 1246, 63, 6520, 267, 587, 26, 288, 2986, 63, 6520, 275, 291, 14, 3735, 63, 7285, 2728, 291, 14, 793, 14, 815, 360, 11310, 402, 11785, 358, 267, 1177, 275, 488, 267, 862, 26, 288, 1177, 275, 1056, 14, 1069, 8, 1246, 63, 6520, 12, 291, 423, 2103, 63, 765, 63, 513, 12, 7748, 63, 3124, 9, 267, 871, 7146, 28759, 2844, 5195, 604, 1726, 465, 325, 26, 288, 291, 14, 793, 14, 815, 360, 3120, 12237, 370, 506, 10414, 89, 503, 26302, 446, 862, 4020, 10916, 2728, 327, 9058, 2410, 1240, 6451, 267, 291, 14, 793, 14, 815, 360, 7891, 402, 1056, 10916, 267, 291, 423, 2103, 63, 765, 63, 513, 275, 942, 2728, 372, 1177, 2286, 327, 318, 664, 63, 6147, 8, 277, 304, 2286, 347, 769, 63, 9808, 63, 2474, 8, 277, 304, 267, 367, 284, 315, 291, 423, 2103, 63, 765, 63, 513, 26, 288, 870, 20794, 11459, 25974, 908, 8, 15569, 5081, 14, 2017, 3767, 14, 985, 8, 73, 395, 73, 430, 2286, 347, 663, 63, 2921, 8, 277, 12, 2512, 304, 267, 291, 423, 275, 2512, 503, 2050, 14, 5572, 3460, 354, 3368, 339, 347, 664, 63, 3124, 8, 277, 304, 267, 372, 334, 277, 423, 3124, 63, 4452, 12, 291, 423, 3124, 63, 23829, 12, 291, 423, 3124, 63, 4478, 9, 339, 347, 663, 63, 3124, 8, 277, 12, 8396, 12, 634, 2753, 12, 8791, 304, 259, 267, 291, 14, 793, 14, 1757, 360, 1084, 15483, 446, 491, 292, 26, 450, 83, 19944, 26, 450, 83, 437, 4116, 26, 450, 83, 297, 8396, 12, 634, 2753, 12, 8791, 9, 2728, 291, 423, 3124, 63, 4452, 275, 289, 18, 73, 8, 4452, 9, 267, 291, 423, 3124, 63, 23829, 275, 289, 18, 73, 8, 23829, 9, 267, 291, 423, 3124, 63, 4478, 275, 289, 18, 73, 8, 4478, 9, 339, 347, 636, 5675, 721, 277, 12, 2562, 304, 267, 347, 805, 3682, 958, 304, 27180, 340, 440, 291, 423, 2103, 63, 765, 63, 513, 26, 355, 291, 14, 793, 14, 815, 360, 2499, 892, 1056, 15103, 27180, 536, 275, 2562, 14, 4142, 342, 288, 340, 2074, 26, 355, 291, 423, 2103, 63, 765, 63, 513, 14, 740, 8, 469, 820, 2352, 5081, 14, 2017, 3767, 14, 1110, 8, 354, 304, 2074, 789, 776, 355, 291, 14, 793, 14, 815, 480, 20897, 1543, 83, 7, 370, 11785, 1056, 5893, 2368, 401, 536, 9, 355, 291, 14, 793, 14, 1757, 480, 14517, 402, 1543, 83, 356, 971, 78, 60, 82, 5, 83, 401, 536, 12, 2074, 9, 288, 587, 26, 355, 291, 423, 2103, 63, 765, 63, 513, 14, 740, 8, 820, 2352, 5081, 14, 2017, 3767, 14, 1110, 8, 354, 9, 776, 355, 291, 14, 793, 14, 815, 480, 20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, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
handroissuazo/tensorflow
tensorflow/python/client/session_test.py
30
65566
# 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 threading import time import numpy as np import six from six.moves import xrange # pylint: disable=redefined-builtin 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 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 math_ops 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 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) 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 testOpConstructionErrorPayload(self): with session.Session(): failing_op = ops.get_default_graph().create_op( 'ConstructionFails', [], [], name='f') def exc_predicate(e): return (e.op == failing_op and e.error_code == error_codes_pb2.INVALID_ARGUMENT) with self.assertRaisesOpError(exc_predicate): failing_op.run() 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. # pylint: disable=protected-access 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) # pylint: enable=protected-access 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) 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, res[0]) self.assertEqual(None, res[1]) self.assertEqual(44.0, res[2]) self.assertEqual(42.0, res[3]) self.assertEqual(None, res[4]) self.assertEqual(63.0, sess.run(v)) 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, res[0]) self.assertEqual(None, res[1]) self.assertEqual(44.0, res[2]) self.assertEqual(42.0, res[3]) 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) 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() 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 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('/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('/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) 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 runTestPartialRun(self, sess): a = array_ops.placeholder(dtypes.float32, shape=[]) b = array_ops.placeholder(dtypes.float32, shape=[]) c = array_ops.placeholder(dtypes.float32, shape=[]) r1 = math_ops.add(a, b) r2 = math_ops.multiply(r1, c) h = sess.partial_run_setup([r1, r2], [a, b, c]) res = sess.partial_run(h, r1, feed_dict={a: 1, b: 2}) self.assertEqual(3, res) temp = res * 17 res = sess.partial_run(h, r2, feed_dict={c: temp}) self.assertEqual(153, res) # Call again on the same graph. h2 = sess.partial_run_setup([r1, r2], [a, b, c]) res = sess.partial_run(h2, r1, feed_dict={a: 1, b: 2}) self.assertEqual(3, res) temp = res * 18 res = sess.partial_run(h2, r2, feed_dict={c: temp}) self.assertEqual(162, res) def runTestPartialRunIncomplete(self, sess): a = array_ops.placeholder(dtypes.float32, shape=[]) b = array_ops.placeholder(dtypes.float32, shape=[]) c = array_ops.placeholder(dtypes.float32, shape=[]) r1 = math_ops.add(a, b) r2 = math_ops.multiply(r1, c) h = sess.partial_run_setup([r1, r2], [a, b, c]) res = sess.partial_run(h, r1, feed_dict={a: 1, b: 2}) self.assertEqual(3, res) def runTestConcurrentPartialRun(self, sess): a = array_ops.placeholder(dtypes.float32, shape=[]) b = array_ops.placeholder(dtypes.float32, shape=[]) c = array_ops.placeholder(dtypes.float32, shape=[]) r1 = math_ops.add(a, b) r2 = math_ops.multiply(r1, c) h1 = sess.partial_run_setup([r1], [a, b, c]) h2 = sess.partial_run_setup([r1, r2], [a, b, c]) res = sess.partial_run(h1, r1, feed_dict={a: 1, b: 2}) self.assertEqual(3, res) temp = res * 19 res = sess.partial_run(h2, r1, feed_dict={a: temp, b: 9}) self.assertEqual(66, res) res = sess.partial_run(h2, r2, feed_dict={c: 7}) self.assertEqual(462, res) def runTestManyPartialRun(self, sess): steps = 200 inputs = [] outputs = [] a = constant_op.constant(2.0, dtypes.float32) for i in xrange(steps): inputs.append(array_ops.placeholder(dtypes.float32, shape=[])) a = math_ops.multiply(a, inputs[i]) outputs.append(a) h = sess.partial_run_setup(outputs, inputs) for i in xrange(steps): res = sess.partial_run(h, outputs[i], feed_dict={inputs[i]: 1.0}) self.assertEqual(2.0, res) feed_dict = {} for i in xrange(steps): feed_dict[inputs[i]] = 1.0 res = sess.run(outputs, feed_dict) self.assertEqual(steps, len(res)) self.assertEqual(2.0, res[-1]) def runTestRunAndPartialRun(self, sess): a = constant_op.constant(2.0, dtypes.float32) b = a * 2 c = b * 3 r1 = sess.run([b, c]) h = sess.partial_run_setup([b, c], []) r2 = sess.partial_run(h, [b, c]) self.assertEqual(r1, r2) def testPartialRunDirect(self): self.runTestPartialRun(session.Session()) def testPartialRunIncompleteDirect(self): self.runTestPartialRunIncomplete(session.Session()) def testConcurrentPartialRunDirect(self): self.runTestConcurrentPartialRun(session.Session()) def testManyPartialRunDirect(self): self.runTestManyPartialRun(session.Session()) def testRunAndPartialRunDirect(self): self.runTestRunAndPartialRun(session.Session()) def testPartialRunDist(self): server = server_lib.Server.create_local_server() self.runTestPartialRun(session.Session(server.target)) def testPartialRunIncompleteDist(self): server = server_lib.Server.create_local_server() self.runTestPartialRunIncomplete(session.Session(server.target)) def testConcurrentPartialRunDist(self): server = server_lib.Server.create_local_server() self.runTestConcurrentPartialRun(session.Session(server.target)) def testManyPartialRunDist(self): server = server_lib.Server.create_local_server() self.runTestManyPartialRun(session.Session(server.target)) def testRunAndPartialRunDist(self): server = server_lib.Server.create_local_server() self.runTestRunAndPartialRun(session.Session(server.target)) 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(ValueError, 'may not be fed'): 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('/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 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) 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, 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, 5796, 199, 646, 900, 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, 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, 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, 3473, 63, 1483, 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, 421, 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, 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, 1590, 14, 8748, 4038, 709, 14, 16, 12, 1616, 14, 16, 12, 1616, 14, 16, 467, 359, 709, 14, 16, 12, 1616, 14, 16, 12, 1616, 14, 16, 2365, 3660, 2152, 29, 1590, 14, 1609, 708, 395, 1331, 63, 637, 9, 819, 347, 511, 4089, 11011, 83, 8, 277, 304, 272, 327, 3254, 8, 415, 432, 1237, 304, 22467, 3820, 18204, 436, 511, 367, 314, 1329, 402, 272, 327, 7256, 2138, 701, 3820, 18204, 14, 272, 543, 2351, 14, 4434, 8, 267, 1101, 29, 888, 63, 3317, 18, 14, 2028, 8548, 8, 1782, 63, 835, 3713, 11011, 356, 499, 1552, 304, 489, 10702, 275, 4413, 63, 411, 14, 4083, 8, 709, 14, 16, 12, 536, 534, 55, 17, 358, 489, 291, 14, 7069, 8, 11416, 14, 2579, 1062, 1616, 14, 16, 9, 819, 347, 511 ]
[ 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, 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, 5796, 199, 646, 900, 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, 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, 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, 3473, 63, 1483, 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, 421, 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, 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, 1590, 14, 8748, 4038, 709, 14, 16, 12, 1616, 14, 16, 12, 1616, 14, 16, 467, 359, 709, 14, 16, 12, 1616, 14, 16, 12, 1616, 14, 16, 2365, 3660, 2152, 29, 1590, 14, 1609, 708, 395, 1331, 63, 637, 9, 819, 347, 511, 4089, 11011, 83, 8, 277, 304, 272, 327, 3254, 8, 415, 432, 1237, 304, 22467, 3820, 18204, 436, 511, 367, 314, 1329, 402, 272, 327, 7256, 2138, 701, 3820, 18204, 14, 272, 543, 2351, 14, 4434, 8, 267, 1101, 29, 888, 63, 3317, 18, 14, 2028, 8548, 8, 1782, 63, 835, 3713, 11011, 356, 499, 1552, 304, 489, 10702, 275, 4413, 63, 411, 14, 4083, 8, 709, 14, 16, 12, 536, 534, 55, 17, 358, 489, 291, 14, 7069, 8, 11416, 14, 2579, 1062, 1616, 14, 16, 9, 819, 347, 511, 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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 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
mccheung/kbengine
kbe/src/lib/python/Lib/test/test_importlib/import_/test_meta_path.py
72
4414
from .. import util from . import util as import_util import importlib._bootstrap import sys from types import MethodType import unittest import warnings class CallingOrder: """Calls to the importers on sys.meta_path happen in order that they are specified in the sequence, starting with the first importer [first called], and then continuing on down until one is found that doesn't return None [continuing].""" def test_first_called(self): # [first called] mod = 'top_level' with util.mock_spec(mod) as first, util.mock_spec(mod) as second: with util.import_state(meta_path=[first, second]): self.assertIs(self.__import__(mod), first.modules[mod]) def test_continuing(self): # [continuing] mod_name = 'for_real' with util.mock_spec('nonexistent') as first, \ util.mock_spec(mod_name) as second: first.find_spec = lambda self, fullname, path=None, parent=None: None with util.import_state(meta_path=[first, second]): self.assertIs(self.__import__(mod_name), second.modules[mod_name]) def test_empty(self): # Raise an ImportWarning if sys.meta_path is empty. module_name = 'nothing' try: del sys.modules[module_name] except KeyError: pass with util.import_state(meta_path=[]): with warnings.catch_warnings(record=True) as w: warnings.simplefilter('always') self.assertIsNone(importlib._bootstrap._find_spec('nothing', None)) self.assertEqual(len(w), 1) self.assertTrue(issubclass(w[-1].category, ImportWarning)) Frozen_CallingOrder, Source_CallingOrder = util.test_both( CallingOrder, __import__=import_util.__import__) class CallSignature: """If there is no __path__ entry on the parent module, then 'path' is None [no path]. Otherwise, the value for __path__ is passed in for the 'path' argument [path set].""" def log_finder(self, importer): fxn = getattr(importer, self.finder_name) log = [] def wrapper(self, *args, **kwargs): log.append([args, kwargs]) return fxn(*args, **kwargs) return log, wrapper def test_no_path(self): # [no path] mod_name = 'top_level' assert '.' not in mod_name with self.mock_modules(mod_name) as importer: log, wrapped_call = self.log_finder(importer) setattr(importer, self.finder_name, MethodType(wrapped_call, importer)) with util.import_state(meta_path=[importer]): self.__import__(mod_name) assert len(log) == 1 args = log[0][0] kwargs = log[0][1] # Assuming all arguments are positional. self.assertEqual(args[0], mod_name) self.assertIsNone(args[1]) def test_with_path(self): # [path set] pkg_name = 'pkg' mod_name = pkg_name + '.module' path = [42] assert '.' in mod_name with self.mock_modules(pkg_name+'.__init__', mod_name) as importer: importer.modules[pkg_name].__path__ = path log, wrapped_call = self.log_finder(importer) setattr(importer, self.finder_name, MethodType(wrapped_call, importer)) with util.import_state(meta_path=[importer]): self.__import__(mod_name) assert len(log) == 2 args = log[1][0] kwargs = log[1][1] # Assuming all arguments are positional. self.assertFalse(kwargs) self.assertEqual(args[0], mod_name) self.assertIs(args[1], path) class CallSignaturePEP302(CallSignature): mock_modules = util.mock_modules finder_name = 'find_module' Frozen_CallSignaturePEP302, Source_CallSignaturePEP302 = util.test_both( CallSignaturePEP302, __import__=import_util.__import__) class CallSignaturePEP451(CallSignature): mock_modules = util.mock_spec finder_name = 'find_spec' Frozen_CallSignaturePEP451, Source_CallSignaturePEP451 = util.test_both( CallSignaturePEP451, __import__=import_util.__import__) if __name__ == '__main__': unittest.main()
lgpl-3.0
[ 504, 2508, 492, 4884, 199, 504, 1275, 492, 4884, 465, 492, 63, 1974, 199, 646, 14802, 423, 11146, 199, 646, 984, 199, 504, 2943, 492, 9075, 804, 199, 646, 2882, 199, 646, 3598, 421, 199, 533, 23892, 4738, 26, 339, 408, 18287, 370, 314, 1742, 27568, 641, 984, 14, 2024, 63, 515, 5992, 315, 1865, 626, 2985, 787, 272, 2013, 315, 314, 3414, 12, 6617, 543, 314, 1642, 13479, 272, 359, 2246, 2797, 467, 436, 2066, 32620, 641, 3224, 5133, 1373, 365, 1911, 626, 3181, 1133, 272, 372, 488, 359, 12875, 23221, 61, 1041, 2378, 347, 511, 63, 2246, 63, 3527, 8, 277, 304, 267, 327, 359, 2246, 2797, 61, 267, 3413, 275, 283, 2119, 63, 1896, 7, 267, 543, 4884, 14, 1805, 63, 1650, 8, 1494, 9, 465, 1642, 12, 4884, 14, 1805, 63, 1650, 8, 1494, 9, 465, 3499, 26, 288, 543, 4884, 14, 646, 63, 929, 8, 2024, 63, 515, 1524, 2246, 12, 3499, 4682, 355, 291, 14, 3436, 8, 277, 855, 646, 721, 1494, 395, 1642, 14, 3112, 59, 1494, 566, 339, 347, 511, 63, 12875, 23221, 8, 277, 304, 267, 327, 359, 12875, 23221, 61, 267, 3413, 63, 354, 275, 283, 509, 63, 3093, 7, 267, 543, 4884, 14, 1805, 63, 1650, 360, 21573, 358, 465, 1642, 12, 971, 1467, 4884, 14, 1805, 63, 1650, 8, 1494, 63, 354, 9, 465, 3499, 26, 288, 1642, 14, 1623, 63, 1650, 275, 2400, 291, 12, 11064, 12, 931, 29, 403, 12, 1676, 29, 403, 26, 488, 288, 543, 4884, 14, 646, 63, 929, 8, 2024, 63, 515, 1524, 2246, 12, 3499, 4682, 355, 291, 14, 3436, 8, 277, 855, 646, 721, 1494, 63, 354, 395, 3499, 14, 3112, 59, 1494, 63, 354, 566, 339, 347, 511, 63, 1667, 8, 277, 304, 267, 327, 14771, 376, 3161, 3849, 340, 984, 14, 2024, 63, 515, 365, 2701, 14, 267, 859, 63, 354, 275, 283, 16323, 7, 267, 862, 26, 288, 2150, 984, 14, 3112, 59, 578, 63, 354, 61, 267, 871, 4067, 26, 288, 986, 267, 543, 4884, 14, 646, 63, 929, 8, 2024, 63, 515, 17894, 288, 543, 3598, 14, 9341, 63, 5451, 8, 3059, 29, 549, 9, 465, 336, 26, 355, 3598, 14, 18815, 360, 9223, 358, 355, 291, 14, 7702, 8, 25893, 423, 11146, 423, 1623, 63, 1650, 360, 16323, 297, 25404, 488, 430, 355, 291, 14, 629, 8, 552, 8, 87, 395, 413, 9, 355, 291, 14, 1815, 8, 20179, 8, 87, 1988, 17, 1055, 3710, 12, 3161, 3849, 430, 199, 199, 29767, 63, 23796, 4738, 12, 5800, 63, 23796, 4738, 275, 4884, 14, 396, 63, 10727, 8, 267, 23892, 4738, 12, 636, 646, 363, 29, 646, 63, 1974, 855, 646, 3368, 421, 199, 533, 6523, 10014, 26, 339, 408, 3917, 2337, 365, 949, 636, 515, 363, 2397, 641, 314, 1676, 859, 12, 2066, 283, 515, 7, 365, 488, 272, 359, 889, 931, 1055, 6630, 12, 314, 574, 367, 636, 515, 363, 365, 3032, 315, 367, 314, 283, 515, 7, 272, 1423, 359, 515, 663, 61, 1041, 339, 347, 943, 63, 11681, 8, 277, 12, 13479, 304, 267, 289, 5032, 275, 2519, 8, 12138, 12, 291, 14, 11681, 63, 354, 9, 267, 943, 275, 942, 267, 347, 4975, 8, 277, 12, 627, 589, 12, 1011, 958, 304, 288, 943, 14, 740, 779, 589, 12, 2074, 566, 288, 372, 289, 5032, 2031, 589, 12, 1011, 958, 9, 267, 372, 943, 12, 4975, 339, 347, 511, 63, 889, 63, 515, 8, 277, 304, 267, 327, 359, 889, 931, 61, 267, 3413, 63, 354, 275, 283, 2119, 63, 1896, 7, 267, 702, 7815, 440, 315, 3413, 63, 354, 267, 543, 291, 14, 1805, 63, 3112, 8, 1494, 63, 354, 9, 465, 13479, 26, 288, 943, 12, 8072, 63, 1250, 275, 291, 14, 793, 63, 11681, 8, 12138, 9, 288, 5371, 8, 12138, 12, 291, 14, 11681, 63, 354, 12, 9075, 804, 8, 9130, 63, 1250, 12, 13479, 430, 288, 543, 4884, 14, 646, 63, 929, 8, 2024, 63, 515, 1524, 12138, 4682, 355, 291, 855, 646, 721, 1494, 63, 354, 9, 355, 702, 822, 8, 793, 9, 508, 413, 355, 1249, 275, 943, 59, 16, 1527, 16, 61, 355, 2074, 275, 943, 59, 16, 1527, 17, 61, 355, 327, 10829, 12848, 1006, 2368, 787, 11333, 14, 355, 291, 14, 629, 8, 589, 59, 16, 467, 3413, 63, 354, 9, 355, 291, 14, 7702, 8, 589, 59, 17, 566, 339, 347, 511, 63, 1045, 63, 515, 8, 277, 304, 267, 327, 359, 515, 663, 61, 267, 5496, 63, 354, 275, 283, 4600, 7, 267, 3413, 63, 354, 275, 5496, 63, 354, 435, 1987, 578, 7, 267, 931, 275, 359, 2260, 61, 267, 702, 7815, 315, 3413, 63, 354, 267, 543, 291, 14, 1805, 63, 3112, 8, 4600, 63, 354, 4786, 855, 826, 7500, 3413, 63, 354, 9, 465, 13479, 26, 288, 13479, 14, 3112, 59, 4600, 63, 354, 17979, 515, 363, 275, 931, 288, 943, 12, 8072, 63, 1250, 275, 291, 14, 793, 63, 11681, 8, 12138, 9, 288, 5371, 8, 12138, 12, 291, 14, 11681, 63, 354, 12, 9075, 804, 8, 9130, 63, 1250, 12, 13479, 430, 288, 543, 4884, 14, 646, 63, 929, 8, 2024, 63, 515, 1524, 12138, 4682, 355, 291, 855, 646, 721, 1494, 63, 354, 9, 355, 702, 822, 8, 793, 9, 508, 499, 355, 1249, 275, 943, 59, 17, 1527, 16, 61, 355, 2074, 275, 943, 59, 17, 1527, 17, 61, 355, 327, 10829, 12848, 1006, 2368, 787, 11333, 14, 355, 291, 14, 3334, 8, 958, 9, 355, 291, 14, 629, 8, 589, 59, 16, 467, 3413, 63, 354, 9, 355, 291, 14, 3436, 8, 589, 59, 17, 467, 931, 9, 199, 199, 533, 6523, 10014, 25633, 8551, 8, 2176, 10014, 304, 272, 1683, 63, 3112, 275, 4884, 14, 1805, 63, 3112, 272, 11569, 63, 354, 275, 283, 1623, 63, 578, 7, 199, 199, 29767, 63, 2176, 10014, 25633, 8551, 12, 5800, 63, 2176, 10014, 25633, 8551, 275, 4884, 14, 396, 63, 10727, 8, 267, 6523, 10014, 25633, 8551, 12, 636, 646, 363, 29, 646, 63, 1974, 855, 646, 3368, 199, 199, 533, 6523, 10014, 25633, 24723, 8, 2176, 10014, 304, 272, 1683, 63, 3112, 275, 4884 ]
[ 2508, 492, 4884, 199, 504, 1275, 492, 4884, 465, 492, 63, 1974, 199, 646, 14802, 423, 11146, 199, 646, 984, 199, 504, 2943, 492, 9075, 804, 199, 646, 2882, 199, 646, 3598, 421, 199, 533, 23892, 4738, 26, 339, 408, 18287, 370, 314, 1742, 27568, 641, 984, 14, 2024, 63, 515, 5992, 315, 1865, 626, 2985, 787, 272, 2013, 315, 314, 3414, 12, 6617, 543, 314, 1642, 13479, 272, 359, 2246, 2797, 467, 436, 2066, 32620, 641, 3224, 5133, 1373, 365, 1911, 626, 3181, 1133, 272, 372, 488, 359, 12875, 23221, 61, 1041, 2378, 347, 511, 63, 2246, 63, 3527, 8, 277, 304, 267, 327, 359, 2246, 2797, 61, 267, 3413, 275, 283, 2119, 63, 1896, 7, 267, 543, 4884, 14, 1805, 63, 1650, 8, 1494, 9, 465, 1642, 12, 4884, 14, 1805, 63, 1650, 8, 1494, 9, 465, 3499, 26, 288, 543, 4884, 14, 646, 63, 929, 8, 2024, 63, 515, 1524, 2246, 12, 3499, 4682, 355, 291, 14, 3436, 8, 277, 855, 646, 721, 1494, 395, 1642, 14, 3112, 59, 1494, 566, 339, 347, 511, 63, 12875, 23221, 8, 277, 304, 267, 327, 359, 12875, 23221, 61, 267, 3413, 63, 354, 275, 283, 509, 63, 3093, 7, 267, 543, 4884, 14, 1805, 63, 1650, 360, 21573, 358, 465, 1642, 12, 971, 1467, 4884, 14, 1805, 63, 1650, 8, 1494, 63, 354, 9, 465, 3499, 26, 288, 1642, 14, 1623, 63, 1650, 275, 2400, 291, 12, 11064, 12, 931, 29, 403, 12, 1676, 29, 403, 26, 488, 288, 543, 4884, 14, 646, 63, 929, 8, 2024, 63, 515, 1524, 2246, 12, 3499, 4682, 355, 291, 14, 3436, 8, 277, 855, 646, 721, 1494, 63, 354, 395, 3499, 14, 3112, 59, 1494, 63, 354, 566, 339, 347, 511, 63, 1667, 8, 277, 304, 267, 327, 14771, 376, 3161, 3849, 340, 984, 14, 2024, 63, 515, 365, 2701, 14, 267, 859, 63, 354, 275, 283, 16323, 7, 267, 862, 26, 288, 2150, 984, 14, 3112, 59, 578, 63, 354, 61, 267, 871, 4067, 26, 288, 986, 267, 543, 4884, 14, 646, 63, 929, 8, 2024, 63, 515, 17894, 288, 543, 3598, 14, 9341, 63, 5451, 8, 3059, 29, 549, 9, 465, 336, 26, 355, 3598, 14, 18815, 360, 9223, 358, 355, 291, 14, 7702, 8, 25893, 423, 11146, 423, 1623, 63, 1650, 360, 16323, 297, 25404, 488, 430, 355, 291, 14, 629, 8, 552, 8, 87, 395, 413, 9, 355, 291, 14, 1815, 8, 20179, 8, 87, 1988, 17, 1055, 3710, 12, 3161, 3849, 430, 199, 199, 29767, 63, 23796, 4738, 12, 5800, 63, 23796, 4738, 275, 4884, 14, 396, 63, 10727, 8, 267, 23892, 4738, 12, 636, 646, 363, 29, 646, 63, 1974, 855, 646, 3368, 421, 199, 533, 6523, 10014, 26, 339, 408, 3917, 2337, 365, 949, 636, 515, 363, 2397, 641, 314, 1676, 859, 12, 2066, 283, 515, 7, 365, 488, 272, 359, 889, 931, 1055, 6630, 12, 314, 574, 367, 636, 515, 363, 365, 3032, 315, 367, 314, 283, 515, 7, 272, 1423, 359, 515, 663, 61, 1041, 339, 347, 943, 63, 11681, 8, 277, 12, 13479, 304, 267, 289, 5032, 275, 2519, 8, 12138, 12, 291, 14, 11681, 63, 354, 9, 267, 943, 275, 942, 267, 347, 4975, 8, 277, 12, 627, 589, 12, 1011, 958, 304, 288, 943, 14, 740, 779, 589, 12, 2074, 566, 288, 372, 289, 5032, 2031, 589, 12, 1011, 958, 9, 267, 372, 943, 12, 4975, 339, 347, 511, 63, 889, 63, 515, 8, 277, 304, 267, 327, 359, 889, 931, 61, 267, 3413, 63, 354, 275, 283, 2119, 63, 1896, 7, 267, 702, 7815, 440, 315, 3413, 63, 354, 267, 543, 291, 14, 1805, 63, 3112, 8, 1494, 63, 354, 9, 465, 13479, 26, 288, 943, 12, 8072, 63, 1250, 275, 291, 14, 793, 63, 11681, 8, 12138, 9, 288, 5371, 8, 12138, 12, 291, 14, 11681, 63, 354, 12, 9075, 804, 8, 9130, 63, 1250, 12, 13479, 430, 288, 543, 4884, 14, 646, 63, 929, 8, 2024, 63, 515, 1524, 12138, 4682, 355, 291, 855, 646, 721, 1494, 63, 354, 9, 355, 702, 822, 8, 793, 9, 508, 413, 355, 1249, 275, 943, 59, 16, 1527, 16, 61, 355, 2074, 275, 943, 59, 16, 1527, 17, 61, 355, 327, 10829, 12848, 1006, 2368, 787, 11333, 14, 355, 291, 14, 629, 8, 589, 59, 16, 467, 3413, 63, 354, 9, 355, 291, 14, 7702, 8, 589, 59, 17, 566, 339, 347, 511, 63, 1045, 63, 515, 8, 277, 304, 267, 327, 359, 515, 663, 61, 267, 5496, 63, 354, 275, 283, 4600, 7, 267, 3413, 63, 354, 275, 5496, 63, 354, 435, 1987, 578, 7, 267, 931, 275, 359, 2260, 61, 267, 702, 7815, 315, 3413, 63, 354, 267, 543, 291, 14, 1805, 63, 3112, 8, 4600, 63, 354, 4786, 855, 826, 7500, 3413, 63, 354, 9, 465, 13479, 26, 288, 13479, 14, 3112, 59, 4600, 63, 354, 17979, 515, 363, 275, 931, 288, 943, 12, 8072, 63, 1250, 275, 291, 14, 793, 63, 11681, 8, 12138, 9, 288, 5371, 8, 12138, 12, 291, 14, 11681, 63, 354, 12, 9075, 804, 8, 9130, 63, 1250, 12, 13479, 430, 288, 543, 4884, 14, 646, 63, 929, 8, 2024, 63, 515, 1524, 12138, 4682, 355, 291, 855, 646, 721, 1494, 63, 354, 9, 355, 702, 822, 8, 793, 9, 508, 499, 355, 1249, 275, 943, 59, 17, 1527, 16, 61, 355, 2074, 275, 943, 59, 17, 1527, 17, 61, 355, 327, 10829, 12848, 1006, 2368, 787, 11333, 14, 355, 291, 14, 3334, 8, 958, 9, 355, 291, 14, 629, 8, 589, 59, 16, 467, 3413, 63, 354, 9, 355, 291, 14, 3436, 8, 589, 59, 17, 467, 931, 9, 199, 199, 533, 6523, 10014, 25633, 8551, 8, 2176, 10014, 304, 272, 1683, 63, 3112, 275, 4884, 14, 1805, 63, 3112, 272, 11569, 63, 354, 275, 283, 1623, 63, 578, 7, 199, 199, 29767, 63, 2176, 10014, 25633, 8551, 12, 5800, 63, 2176, 10014, 25633, 8551, 275, 4884, 14, 396, 63, 10727, 8, 267, 6523, 10014, 25633, 8551, 12, 636, 646, 363, 29, 646, 63, 1974, 855, 646, 3368, 199, 199, 533, 6523, 10014, 25633, 24723, 8, 2176, 10014, 304, 272, 1683, 63, 3112, 275, 4884, 0 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,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, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
YangSongzhou/django
tests/proxy_model_inheritance/tests.py
278
1764
from __future__ import absolute_import, unicode_literals import os from django.core.management import call_command from django.test import TestCase, TransactionTestCase from django.test.utils import extend_sys_path from django.utils._os import upath from .models import ( ConcreteModel, ConcreteModelSubclass, ConcreteModelSubclassProxy, ) class ProxyModelInheritanceTests(TransactionTestCase): """ Proxy model inheritance across apps can result in migrate not creating the table for the proxied model (as described in #12286). This test creates two dummy apps and calls migrate, then verifies that the table has been created. """ available_apps = [] def test_table_exists(self): with extend_sys_path(os.path.dirname(os.path.abspath(upath(__file__)))): with self.modify_settings(INSTALLED_APPS={'append': ['app1', 'app2']}): call_command('migrate', verbosity=0, run_syncdb=True) from app1.models import ProxyModel from app2.models import NiceModel self.assertEqual(NiceModel.objects.all().count(), 0) self.assertEqual(ProxyModel.objects.all().count(), 0) class MultiTableInheritanceProxyTest(TestCase): def test_model_subclass_proxy(self): """ Deleting an instance of a model proxying a multi-table inherited subclass should cascade delete down the whole inheritance chain (see #18083). """ instance = ConcreteModelSubclassProxy.objects.create() instance.delete() self.assertEqual(0, ConcreteModelSubclassProxy.objects.count()) self.assertEqual(0, ConcreteModelSubclass.objects.count()) self.assertEqual(0, ConcreteModel.objects.count())
bsd-3-clause
[ 504, 636, 2443, 363, 492, 3679, 63, 646, 12, 2649, 63, 5955, 199, 199, 646, 747, 199, 199, 504, 1639, 14, 1018, 14, 8110, 492, 1240, 63, 1531, 199, 504, 1639, 14, 396, 492, 7640, 12, 18244, 1746, 199, 504, 1639, 14, 396, 14, 1208, 492, 12247, 63, 1274, 63, 515, 199, 504, 1639, 14, 1208, 423, 736, 492, 1536, 1619, 199, 199, 504, 1275, 992, 492, 334, 272, 1448, 7564, 1685, 12, 1448, 7564, 1685, 23636, 12, 1448, 7564, 1685, 23636, 4936, 12, 199, 9, 421, 199, 533, 12373, 1685, 23542, 554, 2925, 8, 10161, 1746, 304, 272, 408, 272, 12373, 1402, 15433, 9371, 8686, 883, 754, 315, 12810, 440, 6425, 314, 1817, 272, 367, 314, 10645, 5299, 1402, 334, 305, 11736, 315, 327, 7507, 1184, 680, 221, 961, 511, 8491, 2877, 7283, 272, 8686, 436, 4882, 12810, 12, 2066, 22694, 626, 314, 1817, 965, 2757, 2737, 14, 272, 408, 272, 2808, 63, 5181, 275, 942, 339, 347, 511, 63, 1224, 63, 2444, 8, 277, 304, 267, 543, 12247, 63, 1274, 63, 515, 8, 736, 14, 515, 14, 3475, 8, 736, 14, 515, 14, 4832, 8, 384, 1619, 3460, 493, 29658, 304, 288, 543, 291, 14, 8951, 63, 1751, 8, 15942, 63, 14219, 3713, 740, 356, 788, 571, 17, 297, 283, 571, 18, 12074, 304, 355, 1240, 63, 1531, 360, 8462, 297, 8661, 29, 16, 12, 1255, 63, 5186, 697, 29, 549, 9, 355, 687, 1145, 17, 14, 992, 492, 12373, 1685, 355, 687, 1145, 18, 14, 992, 492, 653, 1885, 1685, 355, 291, 14, 629, 8, 46, 1885, 1685, 14, 1462, 14, 452, 1252, 835, 1062, 378, 9, 355, 291, 14, 629, 8, 4936, 1685, 14, 1462, 14, 452, 1252, 835, 1062, 378, 9, 421, 199, 533, 6879, 3186, 23542, 554, 4936, 774, 8, 1746, 304, 339, 347, 511, 63, 1238, 63, 6083, 63, 3280, 8, 277, 304, 267, 408, 267, 15920, 376, 1256, 402, 282, 1402, 4566, 316, 282, 3510, 13, 1224, 12623, 267, 5516, 1077, 22809, 3145, 3224, 314, 8852, 15433, 6036, 334, 3239, 267, 327, 1085, 19573, 680, 267, 408, 267, 1256, 275, 1448, 7564, 1685, 23636, 4936, 14, 1462, 14, 981, 342, 267, 1256, 14, 1807, 342, 267, 291, 14, 629, 8, 16, 12, 1448, 7564, 1685, 23636, 4936, 14, 1462, 14, 835, 1012, 267, 291, 14, 629, 8, 16, 12, 1448, 7564, 1685, 23636, 14, 1462, 14, 835, 1012, 267, 291, 14, 629, 8, 16, 12, 1448, 7564, 1685, 14, 1462, 14, 835, 1012, 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 ]
[ 636, 2443, 363, 492, 3679, 63, 646, 12, 2649, 63, 5955, 199, 199, 646, 747, 199, 199, 504, 1639, 14, 1018, 14, 8110, 492, 1240, 63, 1531, 199, 504, 1639, 14, 396, 492, 7640, 12, 18244, 1746, 199, 504, 1639, 14, 396, 14, 1208, 492, 12247, 63, 1274, 63, 515, 199, 504, 1639, 14, 1208, 423, 736, 492, 1536, 1619, 199, 199, 504, 1275, 992, 492, 334, 272, 1448, 7564, 1685, 12, 1448, 7564, 1685, 23636, 12, 1448, 7564, 1685, 23636, 4936, 12, 199, 9, 421, 199, 533, 12373, 1685, 23542, 554, 2925, 8, 10161, 1746, 304, 272, 408, 272, 12373, 1402, 15433, 9371, 8686, 883, 754, 315, 12810, 440, 6425, 314, 1817, 272, 367, 314, 10645, 5299, 1402, 334, 305, 11736, 315, 327, 7507, 1184, 680, 221, 961, 511, 8491, 2877, 7283, 272, 8686, 436, 4882, 12810, 12, 2066, 22694, 626, 314, 1817, 965, 2757, 2737, 14, 272, 408, 272, 2808, 63, 5181, 275, 942, 339, 347, 511, 63, 1224, 63, 2444, 8, 277, 304, 267, 543, 12247, 63, 1274, 63, 515, 8, 736, 14, 515, 14, 3475, 8, 736, 14, 515, 14, 4832, 8, 384, 1619, 3460, 493, 29658, 304, 288, 543, 291, 14, 8951, 63, 1751, 8, 15942, 63, 14219, 3713, 740, 356, 788, 571, 17, 297, 283, 571, 18, 12074, 304, 355, 1240, 63, 1531, 360, 8462, 297, 8661, 29, 16, 12, 1255, 63, 5186, 697, 29, 549, 9, 355, 687, 1145, 17, 14, 992, 492, 12373, 1685, 355, 687, 1145, 18, 14, 992, 492, 653, 1885, 1685, 355, 291, 14, 629, 8, 46, 1885, 1685, 14, 1462, 14, 452, 1252, 835, 1062, 378, 9, 355, 291, 14, 629, 8, 4936, 1685, 14, 1462, 14, 452, 1252, 835, 1062, 378, 9, 421, 199, 533, 6879, 3186, 23542, 554, 4936, 774, 8, 1746, 304, 339, 347, 511, 63, 1238, 63, 6083, 63, 3280, 8, 277, 304, 267, 408, 267, 15920, 376, 1256, 402, 282, 1402, 4566, 316, 282, 3510, 13, 1224, 12623, 267, 5516, 1077, 22809, 3145, 3224, 314, 8852, 15433, 6036, 334, 3239, 267, 327, 1085, 19573, 680, 267, 408, 267, 1256, 275, 1448, 7564, 1685, 23636, 4936, 14, 1462, 14, 981, 342, 267, 1256, 14, 1807, 342, 267, 291, 14, 629, 8, 16, 12, 1448, 7564, 1685, 23636, 4936, 14, 1462, 14, 835, 1012, 267, 291, 14, 629, 8, 16, 12, 1448, 7564, 1685, 23636, 14, 1462, 14, 835, 1012, 267, 291, 14, 629, 8, 16, 12, 1448, 7564, 1685, 14, 1462, 14, 835, 1012, 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, 32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0, 0, 0, 0, 0 ]
CryToCry96/android_kernel_ef51lsk
tools/perf/scripts/python/net_dropmonitor.py
4235
1554
# Monitor the system for dropped packets and proudce a report of drop locations and counts import os import sys sys.path.append(os.environ['PERF_EXEC_PATH'] + \ '/scripts/python/Perf-Trace-Util/lib/Perf/Trace') from perf_trace_context import * from Core import * from Util import * drop_log = {} kallsyms = [] def get_kallsyms_table(): global kallsyms try: f = open("/proc/kallsyms", "r") linecount = 0 for line in f: linecount = linecount+1 f.seek(0) except: return j = 0 for line in f: loc = int(line.split()[0], 16) name = line.split()[2] j = j +1 if ((j % 100) == 0): print "\r" + str(j) + "/" + str(linecount), kallsyms.append({ 'loc': loc, 'name' : name}) print "\r" + str(j) + "/" + str(linecount) kallsyms.sort() return def get_sym(sloc): loc = int(sloc) for i in kallsyms: if (i['loc'] >= loc): return (i['name'], i['loc']-loc) return (None, 0) def print_drop_table(): print "%25s %25s %25s" % ("LOCATION", "OFFSET", "COUNT") for i in drop_log.keys(): (sym, off) = get_sym(i) if sym == None: sym = i print "%25s %25s %25s" % (sym, off, drop_log[i]) def trace_begin(): print "Starting trace (Ctrl-C to dump results)" def trace_end(): print "Gathering kallsyms data" get_kallsyms_table() print_drop_table() # called from perf, when it finds a correspoinding event def skb__kfree_skb(name, context, cpu, sec, nsec, pid, comm, skbaddr, protocol, location): slocation = str(location) try: drop_log[slocation] = drop_log[slocation] + 1 except: drop_log[slocation] = 1
gpl-2.0
[ 3, 26504, 314, 2656, 367, 17481, 14593, 436, 557, 1181, 301, 282, 3622, 402, 5978, 9918, 436, 8242, 199, 199, 646, 747, 199, 646, 984, 199, 199, 1274, 14, 515, 14, 740, 8, 736, 14, 2314, 459, 17038, 63, 10276, 63, 3243, 418, 435, 971, 507, 198, 9807, 6429, 15, 1548, 15, 12387, 13, 3921, 13, 9562, 15, 773, 15, 12387, 15, 3921, 358, 199, 199, 504, 8582, 63, 3446, 63, 1100, 492, 627, 199, 504, 11672, 492, 627, 199, 504, 21248, 492, 627, 199, 199, 4824, 63, 793, 275, 1052, 199, 32483, 275, 942, 199, 199, 318, 664, 63, 32483, 63, 1224, 837, 199, 198, 2966, 1022, 452, 13807, 199, 198, 893, 26, 507, 198, 70, 275, 1551, 4769, 4687, 15, 32483, 401, 298, 82, 531, 507, 198, 604, 835, 275, 378, 507, 198, 509, 1004, 315, 289, 26, 686, 198, 604, 835, 275, 1004, 835, 11, 17, 507, 198, 70, 14, 5507, 8, 16, 9, 199, 198, 2590, 26, 507, 198, 1107, 4388, 198, 74, 275, 378, 199, 198, 509, 1004, 315, 289, 26, 507, 198, 2102, 275, 1109, 8, 604, 14, 1294, 3430, 16, 467, 3193, 9, 507, 198, 354, 275, 1004, 14, 1294, 3430, 18, 61, 507, 198, 74, 275, 1335, 435, 17, 507, 198, 692, 3666, 74, 450, 2948, 9, 508, 378, 304, 686, 198, 1361, 1867, 82, 2, 435, 620, 8, 74, 9, 435, 10609, 435, 620, 8, 604, 835, 395, 507, 198, 32483, 14, 740, 2561, 283, 2102, 356, 4355, 12, 283, 354, 7, 520, 536, 1552, 421, 198, 1361, 1867, 82, 2, 435, 620, 8, 74, 9, 435, 10609, 435, 620, 8, 604, 835, 9, 199, 198, 32483, 14, 3191, 342, 199, 198, 1107, 199, 199, 318, 664, 63, 3840, 8, 83, 2102, 304, 199, 198, 2102, 275, 1109, 8, 83, 2102, 9, 199, 198, 509, 284, 315, 1022, 452, 13807, 26, 507, 198, 692, 334, 73, 459, 2102, 418, 2356, 4355, 304, 686, 198, 1107, 334, 73, 459, 354, 995, 284, 459, 2102, 418, 13, 2102, 9, 199, 198, 1107, 334, 403, 12, 378, 9, 199, 199, 318, 870, 63, 4824, 63, 1224, 837, 199, 198, 1361, 2071, 821, 83, 450, 821, 83, 450, 821, 83, 2, 450, 1689, 16575, 401, 298, 14839, 401, 298, 8760, 531, 199, 198, 509, 284, 315, 5978, 63, 793, 14, 1612, 837, 507, 198, 8, 3840, 12, 2331, 9, 275, 664, 63, 3840, 8, 73, 9, 507, 198, 692, 4678, 508, 488, 26, 686, 198, 3840, 275, 284, 507, 198, 1361, 2071, 821, 83, 450, 821, 83, 450, 821, 83, 2, 450, 334, 3840, 12, 2331, 12, 5978, 63, 793, 59, 73, 566, 421, 199, 318, 3307, 63, 5037, 837, 199, 198, 1361, 298, 14139, 3307, 334, 9778, 13, 35, 370, 5461, 2058, 2924, 199, 199, 318, 3307, 63, 500, 837, 199, 198, 1361, 298, 39, 7404, 316, 1022, 452, 13807, 666, 2, 199, 198, 362, 63, 32483, 63, 1224, 342, 199, 198, 1361, 63, 4824, 63, 1224, 342, 199, 199, 3, 2797, 687, 8582, 12, 1380, 652, 17651, 282, 1970, 470, 555, 688, 316, 1566, 199, 318, 11448, 363, 22197, 63, 6852, 8, 354, 12, 1067, 12, 5033, 12, 6513, 12, 14256, 12, 4422, 12, 1923, 12, 686, 198, 13664, 12, 4113, 12, 2909, 304, 199, 198, 83, 1985, 275, 620, 8, 1985, 9, 199, 198, 893, 26, 507, 198, 4824, 63, 793, 59, 83, 1985, 61, 275, 5978, 63, 793, 59, 83, 1985, 61, 435, 413, 199, 198, 2590, 26, 507, 198, 4824, 63, 793, 59, 83, 1985, 61, 275, 413, 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 ]
[ 26504, 314, 2656, 367, 17481, 14593, 436, 557, 1181, 301, 282, 3622, 402, 5978, 9918, 436, 8242, 199, 199, 646, 747, 199, 646, 984, 199, 199, 1274, 14, 515, 14, 740, 8, 736, 14, 2314, 459, 17038, 63, 10276, 63, 3243, 418, 435, 971, 507, 198, 9807, 6429, 15, 1548, 15, 12387, 13, 3921, 13, 9562, 15, 773, 15, 12387, 15, 3921, 358, 199, 199, 504, 8582, 63, 3446, 63, 1100, 492, 627, 199, 504, 11672, 492, 627, 199, 504, 21248, 492, 627, 199, 199, 4824, 63, 793, 275, 1052, 199, 32483, 275, 942, 199, 199, 318, 664, 63, 32483, 63, 1224, 837, 199, 198, 2966, 1022, 452, 13807, 199, 198, 893, 26, 507, 198, 70, 275, 1551, 4769, 4687, 15, 32483, 401, 298, 82, 531, 507, 198, 604, 835, 275, 378, 507, 198, 509, 1004, 315, 289, 26, 686, 198, 604, 835, 275, 1004, 835, 11, 17, 507, 198, 70, 14, 5507, 8, 16, 9, 199, 198, 2590, 26, 507, 198, 1107, 4388, 198, 74, 275, 378, 199, 198, 509, 1004, 315, 289, 26, 507, 198, 2102, 275, 1109, 8, 604, 14, 1294, 3430, 16, 467, 3193, 9, 507, 198, 354, 275, 1004, 14, 1294, 3430, 18, 61, 507, 198, 74, 275, 1335, 435, 17, 507, 198, 692, 3666, 74, 450, 2948, 9, 508, 378, 304, 686, 198, 1361, 1867, 82, 2, 435, 620, 8, 74, 9, 435, 10609, 435, 620, 8, 604, 835, 395, 507, 198, 32483, 14, 740, 2561, 283, 2102, 356, 4355, 12, 283, 354, 7, 520, 536, 1552, 421, 198, 1361, 1867, 82, 2, 435, 620, 8, 74, 9, 435, 10609, 435, 620, 8, 604, 835, 9, 199, 198, 32483, 14, 3191, 342, 199, 198, 1107, 199, 199, 318, 664, 63, 3840, 8, 83, 2102, 304, 199, 198, 2102, 275, 1109, 8, 83, 2102, 9, 199, 198, 509, 284, 315, 1022, 452, 13807, 26, 507, 198, 692, 334, 73, 459, 2102, 418, 2356, 4355, 304, 686, 198, 1107, 334, 73, 459, 354, 995, 284, 459, 2102, 418, 13, 2102, 9, 199, 198, 1107, 334, 403, 12, 378, 9, 199, 199, 318, 870, 63, 4824, 63, 1224, 837, 199, 198, 1361, 2071, 821, 83, 450, 821, 83, 450, 821, 83, 2, 450, 1689, 16575, 401, 298, 14839, 401, 298, 8760, 531, 199, 198, 509, 284, 315, 5978, 63, 793, 14, 1612, 837, 507, 198, 8, 3840, 12, 2331, 9, 275, 664, 63, 3840, 8, 73, 9, 507, 198, 692, 4678, 508, 488, 26, 686, 198, 3840, 275, 284, 507, 198, 1361, 2071, 821, 83, 450, 821, 83, 450, 821, 83, 2, 450, 334, 3840, 12, 2331, 12, 5978, 63, 793, 59, 73, 566, 421, 199, 318, 3307, 63, 5037, 837, 199, 198, 1361, 298, 14139, 3307, 334, 9778, 13, 35, 370, 5461, 2058, 2924, 199, 199, 318, 3307, 63, 500, 837, 199, 198, 1361, 298, 39, 7404, 316, 1022, 452, 13807, 666, 2, 199, 198, 362, 63, 32483, 63, 1224, 342, 199, 198, 1361, 63, 4824, 63, 1224, 342, 199, 199, 3, 2797, 687, 8582, 12, 1380, 652, 17651, 282, 1970, 470, 555, 688, 316, 1566, 199, 318, 11448, 363, 22197, 63, 6852, 8, 354, 12, 1067, 12, 5033, 12, 6513, 12, 14256, 12, 4422, 12, 1923, 12, 686, 198, 13664, 12, 4113, 12, 2909, 304, 199, 198, 83, 1985, 275, 620, 8, 1985, 9, 199, 198, 893, 26, 507, 198, 4824, 63, 793, 59, 83, 1985, 61, 275, 5978, 63, 793, 59, 83, 1985, 61, 435, 413, 199, 198, 2590, 26, 507, 198, 4824, 63, 793, 59, 83, 1985, 61, 275, 413, 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, 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, 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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 ]
rochy2014/repo
main.py
48
11992
#!/bin/sh # # Copyright (C) 2008 The Android Open Source Project # # 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. magic='--calling-python-from-/bin/sh--' """exec" python -E "$0" "$@" """#$magic" if __name__ == '__main__': import sys if sys.argv[-1] == '#%s' % magic: del sys.argv[-1] del magic import getpass import imp import netrc import optparse import os import re import sys import time import urllib2 from trace import SetTrace from git_command import git, GitCommand from git_config import init_ssh, close_ssh from command import InteractiveCommand from command import MirrorSafeCommand from subcmds.version import Version from editor import Editor from error import DownloadError from error import ManifestInvalidRevisionError from error import NoSuchProjectError from error import RepoChangedException from manifest_xml import XmlManifest from pager import RunPager from subcmds import all_commands global_options = optparse.OptionParser( usage="repo [-p|--paginate|--no-pager] COMMAND [ARGS]" ) global_options.add_option('-p', '--paginate', dest='pager', action='store_true', help='display command output in the pager') global_options.add_option('--no-pager', dest='no_pager', action='store_true', help='disable the pager') global_options.add_option('--trace', dest='trace', action='store_true', help='trace git command execution') global_options.add_option('--time', dest='time', action='store_true', help='time repo command execution') global_options.add_option('--version', dest='show_version', action='store_true', help='display this version of repo') class _Repo(object): def __init__(self, repodir): self.repodir = repodir self.commands = all_commands # add 'branch' as an alias for 'branches' all_commands['branch'] = all_commands['branches'] def _Run(self, argv): result = 0 name = None glob = [] for i in xrange(0, len(argv)): if not argv[i].startswith('-'): name = argv[i] if i > 0: glob = argv[:i] argv = argv[i + 1:] break if not name: glob = argv name = 'help' argv = [] gopts, _gargs = global_options.parse_args(glob) if gopts.trace: SetTrace() if gopts.show_version: if name == 'help': name = 'version' else: print >>sys.stderr, 'fatal: invalid usage of --version' return 1 try: cmd = self.commands[name] except KeyError: print >>sys.stderr,\ "repo: '%s' is not a repo command. See 'repo help'."\ % name return 1 cmd.repodir = self.repodir cmd.manifest = XmlManifest(cmd.repodir) Editor.globalConfig = cmd.manifest.globalConfig if not isinstance(cmd, MirrorSafeCommand) and cmd.manifest.IsMirror: print >>sys.stderr, \ "fatal: '%s' requires a working directory"\ % name return 1 copts, cargs = cmd.OptionParser.parse_args(argv) if not gopts.no_pager and not isinstance(cmd, InteractiveCommand): config = cmd.manifest.globalConfig if gopts.pager: use_pager = True else: use_pager = config.GetBoolean('pager.%s' % name) if use_pager is None: use_pager = cmd.WantPager(copts) if use_pager: RunPager(config) try: start = time.time() try: result = cmd.Execute(copts, cargs) finally: elapsed = time.time() - start hours, remainder = divmod(elapsed, 3600) minutes, seconds = divmod(remainder, 60) if gopts.time: if hours == 0: print >>sys.stderr, 'real\t%dm%.3fs' \ % (minutes, seconds) else: print >>sys.stderr, 'real\t%dh%dm%.3fs' \ % (hours, minutes, seconds) except DownloadError as e: print >>sys.stderr, 'error: %s' % str(e) return 1 except ManifestInvalidRevisionError as e: print >>sys.stderr, 'error: %s' % str(e) return 1 except NoSuchProjectError as e: if e.name: print >>sys.stderr, 'error: project %s not found' % e.name else: print >>sys.stderr, 'error: no project in current directory' return 1 return result def _MyRepoPath(): return os.path.dirname(__file__) def _MyWrapperPath(): return os.path.join(os.path.dirname(__file__), 'repo') _wrapper_module = None def WrapperModule(): global _wrapper_module if not _wrapper_module: _wrapper_module = imp.load_source('wrapper', _MyWrapperPath()) return _wrapper_module def _CurrentWrapperVersion(): return WrapperModule().VERSION def _CheckWrapperVersion(ver, repo_path): if not repo_path: repo_path = '~/bin/repo' if not ver: print >>sys.stderr, 'no --wrapper-version argument' sys.exit(1) exp = _CurrentWrapperVersion() ver = tuple(map(lambda x: int(x), ver.split('.'))) if len(ver) == 1: ver = (0, ver[0]) if exp[0] > ver[0] or ver < (0, 4): exp_str = '.'.join(map(lambda x: str(x), exp)) print >>sys.stderr, """ !!! A new repo command (%5s) is available. !!! !!! You must upgrade before you can continue: !!! cp %s %s """ % (exp_str, _MyWrapperPath(), repo_path) sys.exit(1) if exp > ver: exp_str = '.'.join(map(lambda x: str(x), exp)) print >>sys.stderr, """ ... A new repo command (%5s) is available. ... You should upgrade soon: cp %s %s """ % (exp_str, _MyWrapperPath(), repo_path) def _CheckRepoDir(repo_dir): if not repo_dir: print >>sys.stderr, 'no --repo-dir argument' sys.exit(1) def _PruneOptions(argv, opt): i = 0 while i < len(argv): a = argv[i] if a == '--': break if a.startswith('--'): eq = a.find('=') if eq > 0: a = a[0:eq] if not opt.has_option(a): del argv[i] continue i += 1 _user_agent = None def _UserAgent(): global _user_agent if _user_agent is None: py_version = sys.version_info os_name = sys.platform if os_name == 'linux2': os_name = 'Linux' elif os_name == 'win32': os_name = 'Win32' elif os_name == 'cygwin': os_name = 'Cygwin' elif os_name == 'darwin': os_name = 'Darwin' p = GitCommand( None, ['describe', 'HEAD'], cwd = _MyRepoPath(), capture_stdout = True) if p.Wait() == 0: repo_version = p.stdout if len(repo_version) > 0 and repo_version[-1] == '\n': repo_version = repo_version[0:-1] if len(repo_version) > 0 and repo_version[0] == 'v': repo_version = repo_version[1:] else: repo_version = 'unknown' _user_agent = 'git-repo/%s (%s) git/%s Python/%d.%d.%d' % ( repo_version, os_name, '.'.join(map(lambda d: str(d), git.version_tuple())), py_version[0], py_version[1], py_version[2]) return _user_agent class _UserAgentHandler(urllib2.BaseHandler): def http_request(self, req): req.add_header('User-Agent', _UserAgent()) return req def https_request(self, req): req.add_header('User-Agent', _UserAgent()) return req def _AddPasswordFromUserInput(handler, msg, req): # If repo could not find auth info from netrc, try to get it from user input url = req.get_full_url() user, password = handler.passwd.find_user_password(None, url) if user is None: print msg try: user = raw_input('User: ') password = getpass.getpass() except KeyboardInterrupt: return handler.passwd.add_password(None, url, user, password) class _BasicAuthHandler(urllib2.HTTPBasicAuthHandler): def http_error_401(self, req, fp, code, msg, headers): _AddPasswordFromUserInput(self, msg, req) return urllib2.HTTPBasicAuthHandler.http_error_401( self, req, fp, code, msg, headers) def http_error_auth_reqed(self, authreq, host, req, headers): try: old_add_header = req.add_header def _add_header(name, val): val = val.replace('\n', '') old_add_header(name, val) req.add_header = _add_header return urllib2.AbstractBasicAuthHandler.http_error_auth_reqed( self, authreq, host, req, headers) except: reset = getattr(self, 'reset_retry_count', None) if reset is not None: reset() elif getattr(self, 'retried', None): self.retried = 0 raise class _DigestAuthHandler(urllib2.HTTPDigestAuthHandler): def http_error_401(self, req, fp, code, msg, headers): _AddPasswordFromUserInput(self, msg, req) return urllib2.HTTPDigestAuthHandler.http_error_401( self, req, fp, code, msg, headers) def http_error_auth_reqed(self, auth_header, host, req, headers): try: old_add_header = req.add_header def _add_header(name, val): val = val.replace('\n', '') old_add_header(name, val) req.add_header = _add_header return urllib2.AbstractDigestAuthHandler.http_error_auth_reqed( self, auth_header, host, req, headers) except: reset = getattr(self, 'reset_retry_count', None) if reset is not None: reset() elif getattr(self, 'retried', None): self.retried = 0 raise def init_http(): handlers = [_UserAgentHandler()] mgr = urllib2.HTTPPasswordMgrWithDefaultRealm() try: n = netrc.netrc() for host in n.hosts: p = n.hosts[host] mgr.add_password(p[1], 'http://%s/' % host, p[0], p[2]) mgr.add_password(p[1], 'https://%s/' % host, p[0], p[2]) except netrc.NetrcParseError: pass except IOError: pass handlers.append(_BasicAuthHandler(mgr)) handlers.append(_DigestAuthHandler(mgr)) if 'http_proxy' in os.environ: url = os.environ['http_proxy'] handlers.append(urllib2.ProxyHandler({'http': url, 'https': url})) if 'REPO_CURL_VERBOSE' in os.environ: handlers.append(urllib2.HTTPHandler(debuglevel=1)) handlers.append(urllib2.HTTPSHandler(debuglevel=1)) urllib2.install_opener(urllib2.build_opener(*handlers)) def _Main(argv): result = 0 opt = optparse.OptionParser(usage="repo wrapperinfo -- ...") opt.add_option("--repo-dir", dest="repodir", help="path to .repo/") opt.add_option("--wrapper-version", dest="wrapper_version", help="version of the wrapper script") opt.add_option("--wrapper-path", dest="wrapper_path", help="location of the wrapper script") _PruneOptions(argv, opt) opt, argv = opt.parse_args(argv) _CheckWrapperVersion(opt.wrapper_version, opt.wrapper_path) _CheckRepoDir(opt.repodir) Version.wrapper_version = opt.wrapper_version Version.wrapper_path = opt.wrapper_path repo = _Repo(opt.repodir) try: try: init_ssh() init_http() result = repo._Run(argv) or 0 finally: close_ssh() except KeyboardInterrupt: result = 1 except RepoChangedException as rce: # If repo changed, re-exec ourselves. # argv = list(sys.argv) argv.extend(rce.extra_args) try: os.execv(__file__, argv) except OSError as e: print >>sys.stderr, 'fatal: cannot restart repo after upgrade' print >>sys.stderr, 'fatal: %s' % e result = 128 sys.exit(result) if __name__ == '__main__': _Main(sys.argv[1:])
apache-2.0
[ 3381, 1393, 15, 609, 199, 3, 199, 3, 1898, 334, 35, 9, 9079, 710, 14694, 3232, 5800, 7290, 199, 3, 199, 3, 3909, 1334, 314, 3668, 844, 12, 3394, 499, 14, 16, 334, 1589, 298, 3761, 3547, 199, 3, 1265, 1443, 440, 675, 642, 570, 871, 315, 4151, 543, 314, 844, 14, 199, 3, 2047, 1443, 3332, 282, 1331, 402, 314, 844, 737, 199, 3, 199, 3, 420, 1455, 921, 1544, 14, 3796, 14, 1308, 15, 2383, 15, 3961, 13, 18, 14, 16, 199, 3, 199, 3, 4158, 1415, 701, 3964, 4179, 503, 4193, 370, 315, 3575, 12, 2032, 199, 3, 1854, 1334, 314, 844, 365, 1854, 641, 376, 298, 1179, 2281, 2, 4207, 12, 199, 3, 2428, 2990, 1549, 4217, 1634, 1821, 3826, 12, 1902, 4056, 503, 2478, 14, 199, 3, 1666, 314, 844, 367, 314, 2488, 2637, 4210, 3443, 436, 199, 3, 4204, 1334, 314, 844, 14, 199, 199, 11523, 23791, 25566, 13, 1548, 13, 504, 13, 15, 1393, 15, 609, 306, 7, 199, 624, 1628, 2, 2366, 446, 37, 7880, 16, 2, 7880, 32, 2, 408, 3, 4, 11523, 2, 199, 692, 636, 354, 363, 508, 2560, 973, 3706, 523, 492, 984, 523, 340, 984, 14, 3020, 1988, 17, 61, 508, 3943, 5, 83, 7, 450, 10628, 26, 272, 2150, 984, 14, 3020, 1988, 17, 61, 199, 2264, 10628, 199, 199, 646, 18354, 199, 646, 1742, 199, 646, 1851, 1195, 199, 646, 8691, 199, 646, 747, 199, 646, 295, 199, 646, 984, 199, 646, 900, 199, 646, 4011, 18, 199, 199, 504, 3307, 492, 2494, 3921, 199, 504, 6135, 63, 1531, 492, 6135, 12, 12579, 3110, 199, 504, 6135, 63, 888, 492, 4205, 63, 5510, 12, 4002, 63, 5510, 199, 504, 1414, 492, 1010, 7502, 3110, 199, 504, 1414, 492, 603, 7932, 11090, 3110, 199, 504, 1007, 12975, 14, 1023, 492, 3394, 199, 504, 8823, 492, 30318, 199, 504, 1125, 492, 17955, 547, 199, 504, 1125, 492, 4688, 3944, 3364, 12714, 547, 199, 504, 1125, 492, 23798, 4761, 547, 199, 504, 1125, 492, 20069, 6970, 1726, 199, 504, 7712, 63, 1652, 492, 24881, 11038, 199, 504, 26581, 492, 3378, 48, 1456, 199, 199, 504, 1007, 12975, 492, 1006, 63, 4405, 199, 199, 2966, 63, 1419, 275, 8691, 14, 14553, 8, 326, 4503, 628, 3417, 5243, 80, 92, 306, 30979, 92, 306, 889, 13, 21219, 61, 25965, 359, 13990, 8480, 326, 776, 199, 2966, 63, 1419, 14, 525, 63, 1422, 3654, 80, 297, 2850, 30979, 297, 2079, 2053, 534, 21219, 297, 1595, 534, 1617, 63, 2052, 297, 2079, 1720, 534, 2918, 1414, 1072, 315, 314, 26581, 358, 199, 2966, 63, 1419, 14, 525, 63, 1422, 4517, 889, 13, 21219, 297, 2079, 2053, 534, 889, 63, 21219, 297, 1595, 534, 1617, 63, 2052, 297, 2079, 1720, 534, 5993, 314, 26581, 358, 199, 2966, 63, 1419, 14, 525, 63, 1422, 4517, 3446, 297, 2079, 2053, 534, 3446, 297, 1595, 534, 1617, 63, 2052, 297, 2079, 1720, 534, 3446, 6135, 1414, 6451, 358, 199, 2966, 63, 1419, 14, 525, 63, 1422, 4517, 521, 297, 2079, 2053, 534, 521, 297, 1595, 534, 1617, 63, 2052, 297, 2079, 1720, 534, 521, 3831, 1414, 6451, 358, 199, 2966, 63, 1419, 14, 525, 63, 1422, 4517, 1023, 297, 2079, 2053, 534, 2384, 63, 1023, 297, 1595, 534, 1617, 63, 2052, 297, 2079, 1720, 534, 2918, 642, 1015, 402, 3831, 358, 199, 199, 533, 485, 11334, 8, 785, 304, 523, 347, 636, 826, 721, 277, 12, 3831, 694, 304, 272, 291, 14, 3417, 694, 275, 3831, 694, 272, 291, 14, 4405, 275, 1006, 63, 4405, 272, 327, 1050, 283, 4694, 7, 465, 376, 5162, 367, 283, 16896, 7, 272, 1006, 63, 4405, 459, 4694, 418, 275, 1006, 63, 4405, 459, 16896, 418, 819, 347, 485, 2540, 8, 277, 12, 9238, 304, 272, 754, 275, 378, 272, 536, 275, 488, 272, 5739, 275, 942, 339, 367, 284, 315, 4945, 8, 16, 12, 822, 8, 3020, 2298, 489, 340, 440, 9238, 59, 73, 1055, 2460, 3654, 735, 267, 536, 275, 9238, 59, 73, 61, 267, 340, 284, 690, 378, 26, 881, 5739, 275, 9238, 1491, 73, 61, 267, 9238, 275, 9238, 59, 73, 435, 413, 2938, 267, 2059, 272, 340, 440, 536, 26, 489, 5739, 275, 9238, 489, 536, 275, 283, 3437, 7, 489, 9238, 275, 942, 272, 486, 3291, 12, 485, 71, 589, 275, 2288, 63, 1419, 14, 1122, 63, 589, 8, 6463, 9, 339, 340, 486, 3291, 14, 3446, 26, 489, 2494, 3921, 342, 272, 340, 486, 3291, 14, 2384, 63, 1023, 26, 489, 340, 536, 508, 283, 3437, 356, 267, 536, 275, 283, 1023, 7, 489, 587, 26, 267, 870, 4331, 1274, 14, 3083, 12, 283, 16208, 26, 3866, 4503, 402, 1553, 1023, 7, 267, 372, 413, 339, 862, 26, 489, 2088, 275, 291, 14, 4405, 59, 354, 61, 272, 871, 4067, 26, 489, 870, 4331, 1274, 14, 3083, 4202, 288, 298, 3417, 26, 1543, 83, 7, 365, 440, 282, 3831, 1414, 14, 221, 1666, 283, 3417, 1720, 1370, 3212, 288, 450, 536, 489, 372, 413, 339, 2088, 14, 3417, 694, 275, 291, 14, 3417, 694, 272, 2088, 14, 6418, 275, 24881, 11038, 8, 1760, 14, 3417, 694, 9, 272, 30318, 14, 2966, 2028, 275, 2088, 14, 6418, 14, 2966, 2028, 339, 340, 440, 1228, 8, 1760, 12, 603, 7932, 11090, 3110, 9, 436, 2088, 14, 6418, 14, 1831, 28034, 26, 489, 870, 4331, 1274, 14, 3083, 12, 971, 288, 298, 16208, 26, 1543, 83, 7, 5074, 282, 6449, 2082, 3212, 288, 450, 536, 489, 372, 413, 339, 286, 3291, 12, 286, 589, 275, 2088, 14, 14553, 14, 1122, 63, 589, 8, 3020, 9, 339, 340, 440, 486, 3291, 14, 889, 63, 21219, 436, 440, 1228, 8, 1760, 12, 1010, 7502, 3110, 304, 489, 1101, 275, 2088, 14, 6418, 14, 2966, 2028, 489, 340, 486, 3291, 14, 21219, 26, 267, 675, 63, 21219, 275, 715, 489, 587, 26, 267, 675, 63, 21219, 275, 1101, 14, 1002, 4082, 360, 21219, 4111, 83, 7, 450, 536, 9, 267, 340, 675, 63, 21219, 365, 488, 26, 881, 675, 63, 21219, 275, 2088, 14, 55, 867, 48, 1456, 8, 331, 8382, 9, 489, 340, 675, 63, 21219, 26, 267, 3378, 48, 1456, 8 ]
[ 1393, 15, 609, 199, 3, 199, 3, 1898, 334, 35, 9, 9079, 710, 14694, 3232, 5800, 7290, 199, 3, 199, 3, 3909, 1334, 314, 3668, 844, 12, 3394, 499, 14, 16, 334, 1589, 298, 3761, 3547, 199, 3, 1265, 1443, 440, 675, 642, 570, 871, 315, 4151, 543, 314, 844, 14, 199, 3, 2047, 1443, 3332, 282, 1331, 402, 314, 844, 737, 199, 3, 199, 3, 420, 1455, 921, 1544, 14, 3796, 14, 1308, 15, 2383, 15, 3961, 13, 18, 14, 16, 199, 3, 199, 3, 4158, 1415, 701, 3964, 4179, 503, 4193, 370, 315, 3575, 12, 2032, 199, 3, 1854, 1334, 314, 844, 365, 1854, 641, 376, 298, 1179, 2281, 2, 4207, 12, 199, 3, 2428, 2990, 1549, 4217, 1634, 1821, 3826, 12, 1902, 4056, 503, 2478, 14, 199, 3, 1666, 314, 844, 367, 314, 2488, 2637, 4210, 3443, 436, 199, 3, 4204, 1334, 314, 844, 14, 199, 199, 11523, 23791, 25566, 13, 1548, 13, 504, 13, 15, 1393, 15, 609, 306, 7, 199, 624, 1628, 2, 2366, 446, 37, 7880, 16, 2, 7880, 32, 2, 408, 3, 4, 11523, 2, 199, 692, 636, 354, 363, 508, 2560, 973, 3706, 523, 492, 984, 523, 340, 984, 14, 3020, 1988, 17, 61, 508, 3943, 5, 83, 7, 450, 10628, 26, 272, 2150, 984, 14, 3020, 1988, 17, 61, 199, 2264, 10628, 199, 199, 646, 18354, 199, 646, 1742, 199, 646, 1851, 1195, 199, 646, 8691, 199, 646, 747, 199, 646, 295, 199, 646, 984, 199, 646, 900, 199, 646, 4011, 18, 199, 199, 504, 3307, 492, 2494, 3921, 199, 504, 6135, 63, 1531, 492, 6135, 12, 12579, 3110, 199, 504, 6135, 63, 888, 492, 4205, 63, 5510, 12, 4002, 63, 5510, 199, 504, 1414, 492, 1010, 7502, 3110, 199, 504, 1414, 492, 603, 7932, 11090, 3110, 199, 504, 1007, 12975, 14, 1023, 492, 3394, 199, 504, 8823, 492, 30318, 199, 504, 1125, 492, 17955, 547, 199, 504, 1125, 492, 4688, 3944, 3364, 12714, 547, 199, 504, 1125, 492, 23798, 4761, 547, 199, 504, 1125, 492, 20069, 6970, 1726, 199, 504, 7712, 63, 1652, 492, 24881, 11038, 199, 504, 26581, 492, 3378, 48, 1456, 199, 199, 504, 1007, 12975, 492, 1006, 63, 4405, 199, 199, 2966, 63, 1419, 275, 8691, 14, 14553, 8, 326, 4503, 628, 3417, 5243, 80, 92, 306, 30979, 92, 306, 889, 13, 21219, 61, 25965, 359, 13990, 8480, 326, 776, 199, 2966, 63, 1419, 14, 525, 63, 1422, 3654, 80, 297, 2850, 30979, 297, 2079, 2053, 534, 21219, 297, 1595, 534, 1617, 63, 2052, 297, 2079, 1720, 534, 2918, 1414, 1072, 315, 314, 26581, 358, 199, 2966, 63, 1419, 14, 525, 63, 1422, 4517, 889, 13, 21219, 297, 2079, 2053, 534, 889, 63, 21219, 297, 1595, 534, 1617, 63, 2052, 297, 2079, 1720, 534, 5993, 314, 26581, 358, 199, 2966, 63, 1419, 14, 525, 63, 1422, 4517, 3446, 297, 2079, 2053, 534, 3446, 297, 1595, 534, 1617, 63, 2052, 297, 2079, 1720, 534, 3446, 6135, 1414, 6451, 358, 199, 2966, 63, 1419, 14, 525, 63, 1422, 4517, 521, 297, 2079, 2053, 534, 521, 297, 1595, 534, 1617, 63, 2052, 297, 2079, 1720, 534, 521, 3831, 1414, 6451, 358, 199, 2966, 63, 1419, 14, 525, 63, 1422, 4517, 1023, 297, 2079, 2053, 534, 2384, 63, 1023, 297, 1595, 534, 1617, 63, 2052, 297, 2079, 1720, 534, 2918, 642, 1015, 402, 3831, 358, 199, 199, 533, 485, 11334, 8, 785, 304, 523, 347, 636, 826, 721, 277, 12, 3831, 694, 304, 272, 291, 14, 3417, 694, 275, 3831, 694, 272, 291, 14, 4405, 275, 1006, 63, 4405, 272, 327, 1050, 283, 4694, 7, 465, 376, 5162, 367, 283, 16896, 7, 272, 1006, 63, 4405, 459, 4694, 418, 275, 1006, 63, 4405, 459, 16896, 418, 819, 347, 485, 2540, 8, 277, 12, 9238, 304, 272, 754, 275, 378, 272, 536, 275, 488, 272, 5739, 275, 942, 339, 367, 284, 315, 4945, 8, 16, 12, 822, 8, 3020, 2298, 489, 340, 440, 9238, 59, 73, 1055, 2460, 3654, 735, 267, 536, 275, 9238, 59, 73, 61, 267, 340, 284, 690, 378, 26, 881, 5739, 275, 9238, 1491, 73, 61, 267, 9238, 275, 9238, 59, 73, 435, 413, 2938, 267, 2059, 272, 340, 440, 536, 26, 489, 5739, 275, 9238, 489, 536, 275, 283, 3437, 7, 489, 9238, 275, 942, 272, 486, 3291, 12, 485, 71, 589, 275, 2288, 63, 1419, 14, 1122, 63, 589, 8, 6463, 9, 339, 340, 486, 3291, 14, 3446, 26, 489, 2494, 3921, 342, 272, 340, 486, 3291, 14, 2384, 63, 1023, 26, 489, 340, 536, 508, 283, 3437, 356, 267, 536, 275, 283, 1023, 7, 489, 587, 26, 267, 870, 4331, 1274, 14, 3083, 12, 283, 16208, 26, 3866, 4503, 402, 1553, 1023, 7, 267, 372, 413, 339, 862, 26, 489, 2088, 275, 291, 14, 4405, 59, 354, 61, 272, 871, 4067, 26, 489, 870, 4331, 1274, 14, 3083, 4202, 288, 298, 3417, 26, 1543, 83, 7, 365, 440, 282, 3831, 1414, 14, 221, 1666, 283, 3417, 1720, 1370, 3212, 288, 450, 536, 489, 372, 413, 339, 2088, 14, 3417, 694, 275, 291, 14, 3417, 694, 272, 2088, 14, 6418, 275, 24881, 11038, 8, 1760, 14, 3417, 694, 9, 272, 30318, 14, 2966, 2028, 275, 2088, 14, 6418, 14, 2966, 2028, 339, 340, 440, 1228, 8, 1760, 12, 603, 7932, 11090, 3110, 9, 436, 2088, 14, 6418, 14, 1831, 28034, 26, 489, 870, 4331, 1274, 14, 3083, 12, 971, 288, 298, 16208, 26, 1543, 83, 7, 5074, 282, 6449, 2082, 3212, 288, 450, 536, 489, 372, 413, 339, 286, 3291, 12, 286, 589, 275, 2088, 14, 14553, 14, 1122, 63, 589, 8, 3020, 9, 339, 340, 440, 486, 3291, 14, 889, 63, 21219, 436, 440, 1228, 8, 1760, 12, 1010, 7502, 3110, 304, 489, 1101, 275, 2088, 14, 6418, 14, 2966, 2028, 489, 340, 486, 3291, 14, 21219, 26, 267, 675, 63, 21219, 275, 715, 489, 587, 26, 267, 675, 63, 21219, 275, 1101, 14, 1002, 4082, 360, 21219, 4111, 83, 7, 450, 536, 9, 267, 340, 675, 63, 21219, 365, 488, 26, 881, 675, 63, 21219, 275, 2088, 14, 55, 867, 48, 1456, 8, 331, 8382, 9, 489, 340, 675, 63, 21219, 26, 267, 3378, 48, 1456, 8, 0 ]
[ 1, 1, 1, 1, 1, 1, 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_oscillating_masses_discrete_dae.py
1
3206
# # This file is part of do-mpc # # do-mpc: An environment for the easy, modular and efficient implementation of # robust nonlinear model predictive control # # Copyright (c) 2014-2019 Sergio Lucia, Alexandru Tatulea-Codrean # TU Dortmund. All rights reserved # # do-mpc 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 3 # of the License, or (at your option) any later version. # # do-mpc 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 General Public License # along with do-mpc. If not, see <http://www.gnu.org/licenses/>. import numpy as np import matplotlib.pyplot as plt from casadi import * from casadi.tools import * import pdb import sys import unittest sys.path.append('../') import do_mpc sys.path.pop(-1) sys.path.append('../examples/oscillating_masses_discrete_dae/') from template_model import template_model from template_mpc import template_mpc from template_simulator import template_simulator sys.path.pop(-1) class TestOscillatingMassesDiscrete(unittest.TestCase): def test_oscillating_masses_discrete(self): """ Get configured do-mpc modules: """ model = template_model() mpc = template_mpc(model) simulator = template_simulator(model) estimator = do_mpc.estimator.StateFeedback(model) """ Set initial state """ np.random.seed(99) x0 = np.random.rand(model.n_x)-0.5 mpc.x0 = x0 simulator.x0 = x0 estimator.x0 = x0 # Use initial state to set the initial guess. mpc.set_initial_guess() # This is only meaningful for DAE systems. simulator.set_initial_guess() """ Run some steps: """ for k in range(5): u0 = mpc.make_step(x0) y_next = simulator.make_step(u0) x0 = estimator.make_step(y_next) """ Store results (from reference run): """ #do_mpc.data.save_results([mpc, simulator, estimator], 'results_oscillatingMasses_dae', overwrite=True) """ Compare results to reference run: """ ref = do_mpc.data.load_results('./results/results_oscillatingMasses_dae.pkl') test = ['_x', '_u', '_aux', '_time', '_z'] for test_i in test: # Check MPC check = np.allclose(mpc.data.__dict__[test_i], ref['mpc'].__dict__[test_i]) self.assertTrue(check) # Check Simulator check = np.allclose(simulator.data.__dict__[test_i], ref['simulator'].__dict__[test_i]) self.assertTrue(check) # Estimator check = np.allclose(estimator.data.__dict__[test_i], ref['estimator'].__dict__[test_i]) self.assertTrue(check) if __name__ == '__main__': unittest.main()
lgpl-3.0
[ 3, 199, 3, 257, 961, 570, 365, 1777, 402, 886, 13, 311, 67, 199, 3, 199, 3, 257, 886, 13, 311, 67, 26, 1626, 3734, 367, 314, 8837, 12, 3413, 2238, 436, 13402, 4514, 402, 199, 3, 263, 23399, 2222, 6676, 1402, 4557, 6648, 3304, 199, 3, 199, 3, 257, 1898, 334, 67, 9, 6927, 13, 14982, 3739, 71, 2308, 30936, 16521, 12, 22986, 460, 6558, 377, 292, 443, 65, 13, 35, 364, 264, 290, 199, 3, 12788, 377, 53, 577, 361, 77, 725, 14, 2900, 4481, 4644, 199, 3, 199, 3, 257, 886, 13, 311, 67, 365, 2867, 2032, 26, 1265, 883, 3604, 652, 436, 15, 269, 2811, 199, 3, 257, 652, 1334, 314, 2895, 402, 314, 1664, 6401, 1696, 1684, 844, 465, 199, 3, 257, 3267, 701, 314, 2868, 2290, 2752, 12, 1902, 1015, 650, 199, 3, 257, 402, 314, 844, 12, 503, 334, 292, 2195, 945, 9, 1263, 2945, 1015, 14, 199, 3, 199, 3, 257, 886, 13, 311, 67, 365, 1854, 315, 314, 3661, 626, 652, 911, 506, 2997, 12, 199, 3, 257, 1325, 2428, 1821, 3408, 27, 1928, 2755, 314, 2478, 3750, 402, 199, 3, 257, 3169, 503, 3092, 2381, 437, 3115, 3104, 14, 221, 1666, 314, 199, 3, 257, 1664, 6401, 1696, 1684, 844, 367, 1655, 2436, 14, 199, 3, 199, 3, 257, 2047, 1077, 1172, 3086, 282, 1331, 402, 314, 1664, 1696, 1684, 844, 199, 3, 257, 3180, 543, 886, 13, 311, 67, 14, 221, 982, 440, 12, 1937, 665, 1014, 921, 1544, 14, 3689, 14, 1308, 15, 2383, 4743, 199, 199, 646, 2680, 465, 980, 199, 646, 8027, 14, 13563, 465, 4488, 199, 504, 14984, 65, 328, 492, 627, 199, 504, 14984, 65, 328, 14, 2537, 492, 627, 199, 646, 10543, 199, 646, 984, 199, 646, 2882, 199, 199, 1274, 14, 515, 14, 740, 24592, 358, 199, 646, 886, 63, 311, 67, 199, 1274, 14, 515, 14, 1935, 2801, 17, 9, 199, 199, 1274, 14, 515, 14, 740, 24592, 8589, 15, 26737, 778, 1958, 63, 77, 1916, 63, 23591, 63, 9747, 6217, 199, 504, 1978, 63, 1238, 492, 1978, 63, 1238, 199, 504, 1978, 63, 311, 67, 492, 1978, 63, 311, 67, 199, 504, 1978, 63, 20125, 492, 1978, 63, 20125, 199, 1274, 14, 515, 14, 1935, 2801, 17, 9, 421, 199, 533, 1379, 47, 551, 778, 1958, 45, 1916, 2825, 7564, 8, 2796, 14, 1746, 304, 339, 347, 511, 63, 26737, 778, 1958, 63, 77, 1916, 63, 23591, 8, 277, 304, 267, 408, 267, 2372, 7526, 886, 13, 311, 67, 4621, 26, 267, 408, 398, 1402, 275, 1978, 63, 1238, 342, 267, 6118, 67, 275, 1978, 63, 311, 67, 8, 1238, 9, 267, 15797, 275, 1978, 63, 20125, 8, 1238, 9, 267, 8943, 275, 886, 63, 311, 67, 14, 8627, 14, 2223, 28687, 8, 1238, 9, 398, 408, 267, 2494, 2536, 1174, 267, 408, 398, 980, 14, 2355, 14, 5176, 8, 1020, 9, 398, 671, 16, 275, 980, 14, 2355, 14, 3759, 8, 1238, 14, 78, 63, 88, 7216, 16, 14, 21, 267, 6118, 67, 14, 88, 16, 275, 671, 16, 267, 15797, 14, 88, 16, 275, 671, 16, 267, 8943, 14, 88, 16, 275, 671, 16, 398, 327, 3645, 2536, 1174, 370, 663, 314, 2536, 9519, 14, 267, 6118, 67, 14, 409, 63, 2747, 63, 11636, 342, 267, 327, 961, 365, 1454, 26562, 367, 577, 12500, 10460, 14, 267, 15797, 14, 409, 63, 2747, 63, 11636, 342, 7318, 408, 267, 3378, 2005, 7124, 26, 267, 408, 398, 367, 1022, 315, 1425, 8, 21, 304, 288, 399, 16, 275, 6118, 67, 14, 1875, 63, 2926, 8, 88, 16, 9, 288, 612, 63, 2184, 275, 15797, 14, 1875, 63, 2926, 8, 85, 16, 9, 288, 671, 16, 275, 8943, 14, 1875, 63, 2926, 8, 89, 63, 2184, 9, 398, 408, 267, 13874, 2058, 334, 504, 3659, 1255, 304, 267, 408, 267, 327, 1117, 63, 311, 67, 14, 576, 14, 2117, 63, 2604, 779, 311, 67, 12, 15797, 12, 8943, 467, 283, 2604, 63, 26737, 778, 1958, 45, 1916, 63, 9747, 297, 8970, 29, 549, 9, 398, 408, 267, 18955, 2058, 370, 3659, 1255, 26, 267, 408, 267, 2984, 275, 886, 63, 311, 67, 14, 576, 14, 912, 63, 2604, 17371, 2604, 15, 2604, 63, 26737, 778, 1958, 45, 1916, 63, 9747, 14, 23947, 358, 398, 511, 275, 4044, 88, 297, 2513, 85, 297, 2513, 10962, 297, 2513, 521, 297, 2513, 90, 418, 398, 367, 511, 63, 73, 315, 511, 26, 288, 327, 2670, 603, 4222, 288, 1104, 275, 980, 14, 7520, 8, 311, 67, 14, 576, 855, 807, 12298, 396, 63, 73, 467, 2984, 459, 311, 67, 418, 855, 807, 12298, 396, 63, 73, 566, 288, 291, 14, 1815, 8, 1074, 9, 288, 327, 2670, 10751, 6109, 288, 1104, 275, 980, 14, 7520, 8, 20125, 14, 576, 855, 807, 12298, 396, 63, 73, 467, 2984, 459, 20125, 418, 855, 807, 12298, 396, 63, 73, 566, 288, 291, 14, 1815, 8, 1074, 9, 288, 327, 28992, 288, 1104, 275, 980, 14, 7520, 8, 8627, 14, 576, 855, 807, 12298, 396, 63, 73, 467, 2984, 459, 8627, 418, 855, 807, 12298, 396, 63, 73, 566, 288, 291, 14, 1815, 8, 1074, 9, 6905, 199, 692, 636, 354, 363, 508, 2560, 973, 3706, 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 ]
[ 199, 3, 257, 961, 570, 365, 1777, 402, 886, 13, 311, 67, 199, 3, 199, 3, 257, 886, 13, 311, 67, 26, 1626, 3734, 367, 314, 8837, 12, 3413, 2238, 436, 13402, 4514, 402, 199, 3, 263, 23399, 2222, 6676, 1402, 4557, 6648, 3304, 199, 3, 199, 3, 257, 1898, 334, 67, 9, 6927, 13, 14982, 3739, 71, 2308, 30936, 16521, 12, 22986, 460, 6558, 377, 292, 443, 65, 13, 35, 364, 264, 290, 199, 3, 12788, 377, 53, 577, 361, 77, 725, 14, 2900, 4481, 4644, 199, 3, 199, 3, 257, 886, 13, 311, 67, 365, 2867, 2032, 26, 1265, 883, 3604, 652, 436, 15, 269, 2811, 199, 3, 257, 652, 1334, 314, 2895, 402, 314, 1664, 6401, 1696, 1684, 844, 465, 199, 3, 257, 3267, 701, 314, 2868, 2290, 2752, 12, 1902, 1015, 650, 199, 3, 257, 402, 314, 844, 12, 503, 334, 292, 2195, 945, 9, 1263, 2945, 1015, 14, 199, 3, 199, 3, 257, 886, 13, 311, 67, 365, 1854, 315, 314, 3661, 626, 652, 911, 506, 2997, 12, 199, 3, 257, 1325, 2428, 1821, 3408, 27, 1928, 2755, 314, 2478, 3750, 402, 199, 3, 257, 3169, 503, 3092, 2381, 437, 3115, 3104, 14, 221, 1666, 314, 199, 3, 257, 1664, 6401, 1696, 1684, 844, 367, 1655, 2436, 14, 199, 3, 199, 3, 257, 2047, 1077, 1172, 3086, 282, 1331, 402, 314, 1664, 1696, 1684, 844, 199, 3, 257, 3180, 543, 886, 13, 311, 67, 14, 221, 982, 440, 12, 1937, 665, 1014, 921, 1544, 14, 3689, 14, 1308, 15, 2383, 4743, 199, 199, 646, 2680, 465, 980, 199, 646, 8027, 14, 13563, 465, 4488, 199, 504, 14984, 65, 328, 492, 627, 199, 504, 14984, 65, 328, 14, 2537, 492, 627, 199, 646, 10543, 199, 646, 984, 199, 646, 2882, 199, 199, 1274, 14, 515, 14, 740, 24592, 358, 199, 646, 886, 63, 311, 67, 199, 1274, 14, 515, 14, 1935, 2801, 17, 9, 199, 199, 1274, 14, 515, 14, 740, 24592, 8589, 15, 26737, 778, 1958, 63, 77, 1916, 63, 23591, 63, 9747, 6217, 199, 504, 1978, 63, 1238, 492, 1978, 63, 1238, 199, 504, 1978, 63, 311, 67, 492, 1978, 63, 311, 67, 199, 504, 1978, 63, 20125, 492, 1978, 63, 20125, 199, 1274, 14, 515, 14, 1935, 2801, 17, 9, 421, 199, 533, 1379, 47, 551, 778, 1958, 45, 1916, 2825, 7564, 8, 2796, 14, 1746, 304, 339, 347, 511, 63, 26737, 778, 1958, 63, 77, 1916, 63, 23591, 8, 277, 304, 267, 408, 267, 2372, 7526, 886, 13, 311, 67, 4621, 26, 267, 408, 398, 1402, 275, 1978, 63, 1238, 342, 267, 6118, 67, 275, 1978, 63, 311, 67, 8, 1238, 9, 267, 15797, 275, 1978, 63, 20125, 8, 1238, 9, 267, 8943, 275, 886, 63, 311, 67, 14, 8627, 14, 2223, 28687, 8, 1238, 9, 398, 408, 267, 2494, 2536, 1174, 267, 408, 398, 980, 14, 2355, 14, 5176, 8, 1020, 9, 398, 671, 16, 275, 980, 14, 2355, 14, 3759, 8, 1238, 14, 78, 63, 88, 7216, 16, 14, 21, 267, 6118, 67, 14, 88, 16, 275, 671, 16, 267, 15797, 14, 88, 16, 275, 671, 16, 267, 8943, 14, 88, 16, 275, 671, 16, 398, 327, 3645, 2536, 1174, 370, 663, 314, 2536, 9519, 14, 267, 6118, 67, 14, 409, 63, 2747, 63, 11636, 342, 267, 327, 961, 365, 1454, 26562, 367, 577, 12500, 10460, 14, 267, 15797, 14, 409, 63, 2747, 63, 11636, 342, 7318, 408, 267, 3378, 2005, 7124, 26, 267, 408, 398, 367, 1022, 315, 1425, 8, 21, 304, 288, 399, 16, 275, 6118, 67, 14, 1875, 63, 2926, 8, 88, 16, 9, 288, 612, 63, 2184, 275, 15797, 14, 1875, 63, 2926, 8, 85, 16, 9, 288, 671, 16, 275, 8943, 14, 1875, 63, 2926, 8, 89, 63, 2184, 9, 398, 408, 267, 13874, 2058, 334, 504, 3659, 1255, 304, 267, 408, 267, 327, 1117, 63, 311, 67, 14, 576, 14, 2117, 63, 2604, 779, 311, 67, 12, 15797, 12, 8943, 467, 283, 2604, 63, 26737, 778, 1958, 45, 1916, 63, 9747, 297, 8970, 29, 549, 9, 398, 408, 267, 18955, 2058, 370, 3659, 1255, 26, 267, 408, 267, 2984, 275, 886, 63, 311, 67, 14, 576, 14, 912, 63, 2604, 17371, 2604, 15, 2604, 63, 26737, 778, 1958, 45, 1916, 63, 9747, 14, 23947, 358, 398, 511, 275, 4044, 88, 297, 2513, 85, 297, 2513, 10962, 297, 2513, 521, 297, 2513, 90, 418, 398, 367, 511, 63, 73, 315, 511, 26, 288, 327, 2670, 603, 4222, 288, 1104, 275, 980, 14, 7520, 8, 311, 67, 14, 576, 855, 807, 12298, 396, 63, 73, 467, 2984, 459, 311, 67, 418, 855, 807, 12298, 396, 63, 73, 566, 288, 291, 14, 1815, 8, 1074, 9, 288, 327, 2670, 10751, 6109, 288, 1104, 275, 980, 14, 7520, 8, 20125, 14, 576, 855, 807, 12298, 396, 63, 73, 467, 2984, 459, 20125, 418, 855, 807, 12298, 396, 63, 73, 566, 288, 291, 14, 1815, 8, 1074, 9, 288, 327, 28992, 288, 1104, 275, 980, 14, 7520, 8, 8627, 14, 576, 855, 807, 12298, 396, 63, 73, 467, 2984, 459, 8627, 418, 855, 807, 12298, 396, 63, 73, 566, 288, 291, 14, 1815, 8, 1074, 9, 6905, 199, 692, 636, 354, 363, 508, 2560, 973, 3706, 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, 0 ]
[ 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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ection.py
187
5659
# urllib3/connection.py # Copyright 2008-2013 Andrey Petrov and contributors (see CONTRIBUTORS.txt) # # This module is part of urllib3 and is released under # the MIT License: http://www.opensource.org/licenses/mit-license.php import socket from socket import timeout as SocketTimeout try: # Python 3 from http.client import HTTPConnection as _HTTPConnection, HTTPException except ImportError: from httplib import HTTPConnection as _HTTPConnection, HTTPException class DummyConnection(object): "Used to detect a failed ConnectionCls import." pass try: # Compiled with SSL? ssl = None HTTPSConnection = DummyConnection class BaseSSLError(BaseException): pass try: # Python 3 from http.client import HTTPSConnection as _HTTPSConnection except ImportError: from httplib import HTTPSConnection as _HTTPSConnection import ssl BaseSSLError = ssl.SSLError except (ImportError, AttributeError): # Platform-specific: No SSL. pass from .exceptions import ( ConnectTimeoutError, ) from .packages.ssl_match_hostname import match_hostname from .util import ( assert_fingerprint, resolve_cert_reqs, resolve_ssl_version, ssl_wrap_socket, ) port_by_scheme = { 'http': 80, 'https': 443, } class HTTPConnection(_HTTPConnection, object): default_port = port_by_scheme['http'] # By default, disable Nagle's Algorithm. tcp_nodelay = 1 def _new_conn(self): """ Establish a socket connection and set nodelay settings on it :return: a new socket connection """ try: conn = socket.create_connection( (self.host, self.port), self.timeout, self.source_address, ) except AttributeError: # Python 2.6 conn = socket.create_connection( (self.host, self.port), self.timeout, ) conn.setsockopt(socket.IPPROTO_TCP, socket.TCP_NODELAY, self.tcp_nodelay) return conn def _prepare_conn(self, conn): self.sock = conn if self._tunnel_host: # TODO: Fix tunnel so it doesn't depend on self.sock state. self._tunnel() def connect(self): conn = self._new_conn() self._prepare_conn(conn) class HTTPSConnection(HTTPConnection): default_port = port_by_scheme['https'] def __init__(self, host, port=None, key_file=None, cert_file=None, strict=None, timeout=socket._GLOBAL_DEFAULT_TIMEOUT, source_address=None): try: HTTPConnection.__init__(self, host, port, strict, timeout, source_address) except TypeError: # Python 2.6 HTTPConnection.__init__(self, host, port, strict, timeout) self.key_file = key_file self.cert_file = cert_file def connect(self): conn = self._new_conn() self._prepare_conn(conn) self.sock = ssl.wrap_socket(conn, self.key_file, self.cert_file) class VerifiedHTTPSConnection(HTTPSConnection): """ Based on httplib.HTTPSConnection but wraps the socket with SSL certification. """ cert_reqs = None ca_certs = None ssl_version = None def set_cert(self, key_file=None, cert_file=None, cert_reqs=None, ca_certs=None, assert_hostname=None, assert_fingerprint=None): self.key_file = key_file self.cert_file = cert_file self.cert_reqs = cert_reqs self.ca_certs = ca_certs self.assert_hostname = assert_hostname self.assert_fingerprint = assert_fingerprint def connect(self): # Add certificate verification try: sock = socket.create_connection( address=(self.host, self.port), timeout=self.timeout, ) except SocketTimeout: raise ConnectTimeoutError( self, "Connection to %s timed out. (connect timeout=%s)" % (self.host, self.timeout)) sock.setsockopt(socket.IPPROTO_TCP, socket.TCP_NODELAY, self.tcp_nodelay) resolved_cert_reqs = resolve_cert_reqs(self.cert_reqs) resolved_ssl_version = resolve_ssl_version(self.ssl_version) # the _tunnel_host attribute was added in python 2.6.3 (via # http://hg.python.org/cpython/rev/0f57b30a152f) so pythons 2.6(0-2) do # not have them. if getattr(self, '_tunnel_host', None): self.sock = sock # Calls self._set_hostport(), so self.host is # self._tunnel_host below. self._tunnel() # Wrap socket using verification with the root certs in # trusted_root_certs self.sock = ssl_wrap_socket(sock, self.key_file, self.cert_file, cert_reqs=resolved_cert_reqs, ca_certs=self.ca_certs, server_hostname=self.host, ssl_version=resolved_ssl_version) if resolved_cert_reqs != ssl.CERT_NONE: if self.assert_fingerprint: assert_fingerprint(self.sock.getpeercert(binary_form=True), self.assert_fingerprint) elif self.assert_hostname is not False: match_hostname(self.sock.getpeercert(), self.assert_hostname or self.host) if ssl: # Make a copy for testing. UnverifiedHTTPSConnection = HTTPSConnection HTTPSConnection = VerifiedHTTPSConnection
gpl-3.0
[ 3, 4011, 19, 15, 2105, 14, 647, 199, 3, 1898, 9079, 13, 6965, 6061, 17885, 31449, 293, 86, 436, 8417, 334, 3239, 6483, 14, 2424, 9, 199, 3, 199, 3, 961, 859, 365, 1777, 402, 4011, 19, 436, 365, 14286, 1334, 199, 3, 314, 10697, 844, 26, 1455, 921, 1544, 14, 16374, 14, 1308, 15, 2383, 15, 1147, 13, 1682, 14, 8624, 199, 199, 646, 2838, 199, 504, 2838, 492, 2653, 465, 17766, 6372, 199, 199, 893, 26, 327, 2018, 650, 272, 687, 1455, 14, 1258, 492, 3101, 3225, 465, 485, 19114, 12, 28185, 199, 2590, 3545, 26, 272, 687, 8809, 492, 3101, 3225, 465, 485, 19114, 12, 28185, 199, 199, 533, 9762, 3225, 8, 785, 304, 272, 298, 9167, 370, 9696, 282, 3405, 8113, 24342, 492, 2122, 272, 986, 199, 199, 893, 26, 327, 3599, 1672, 543, 7799, 31, 272, 6149, 275, 488, 272, 14147, 3225, 275, 9762, 3225, 339, 1021, 3523, 27102, 8, 29900, 304, 267, 986, 339, 862, 26, 327, 2018, 650, 267, 687, 1455, 14, 1258, 492, 14147, 3225, 465, 485, 27945, 272, 871, 3545, 26, 267, 687, 8809, 492, 14147, 3225, 465, 485, 27945, 339, 492, 6149, 272, 3523, 27102, 275, 6149, 14, 27102, 199, 199, 2590, 334, 17825, 12, 4281, 304, 327, 16078, 13, 6100, 26, 3091, 7799, 14, 272, 986, 199, 199, 504, 1275, 3924, 492, 334, 272, 15175, 19382, 12, 199, 9, 199, 504, 1275, 5154, 14, 4266, 63, 1431, 63, 4269, 492, 1336, 63, 4269, 199, 504, 1275, 1974, 492, 334, 272, 702, 63, 15077, 12, 272, 7512, 63, 4736, 63, 12720, 12, 272, 7512, 63, 4266, 63, 1023, 12, 272, 6149, 63, 3823, 63, 3450, 12, 199, 9, 421, 199, 719, 63, 991, 63, 5512, 275, 469, 272, 283, 1014, 356, 5939, 12, 272, 283, 2859, 356, 23865, 12, 199, 93, 421, 199, 533, 3101, 3225, 1547, 19114, 12, 909, 304, 272, 849, 63, 719, 275, 1844, 63, 991, 63, 5512, 459, 1014, 418, 339, 327, 4885, 849, 12, 3507, 653, 643, 274, 1159, 23823, 14, 272, 14719, 63, 932, 817, 275, 413, 339, 347, 485, 1222, 63, 1631, 8, 277, 304, 267, 408, 15896, 13306, 282, 2838, 1950, 436, 663, 1031, 817, 2202, 641, 652, 398, 520, 1107, 26, 282, 892, 2838, 1950, 267, 408, 267, 862, 26, 288, 2557, 275, 2838, 14, 981, 63, 2105, 8, 355, 334, 277, 14, 1102, 12, 291, 14, 719, 395, 355, 291, 14, 2593, 12, 355, 291, 14, 1365, 63, 1562, 12, 288, 776, 267, 871, 4281, 26, 327, 2018, 499, 14, 22, 288, 2557, 275, 2838, 14, 981, 63, 2105, 8, 355, 334, 277, 14, 1102, 12, 291, 14, 719, 395, 355, 291, 14, 2593, 12, 288, 776, 267, 2557, 14, 27689, 8, 3450, 14, 20130, 63, 9735, 12, 2838, 14, 9735, 63, 2826, 18616, 12, 717, 291, 14, 8815, 63, 932, 817, 9, 267, 372, 2557, 339, 347, 485, 6726, 63, 1631, 8, 277, 12, 2557, 304, 267, 291, 14, 5096, 275, 2557, 267, 340, 291, 423, 15360, 63, 1102, 26, 288, 327, 3254, 26, 14811, 21496, 880, 652, 3181, 1133, 11687, 641, 291, 14, 5096, 1174, 14, 288, 291, 423, 15360, 342, 339, 347, 4907, 8, 277, 304, 267, 2557, 275, 291, 423, 1222, 63, 1631, 342, 267, 291, 423, 6726, 63, 1631, 8, 1631, 9, 421, 199, 533, 14147, 3225, 8, 19114, 304, 272, 849, 63, 719, 275, 1844, 63, 991, 63, 5512, 459, 2859, 418, 339, 347, 636, 826, 721, 277, 12, 1591, 12, 1844, 29, 403, 12, 790, 63, 493, 29, 403, 12, 6250, 63, 493, 29, 403, 12, 326, 7478, 29, 403, 12, 2653, 29, 3450, 423, 13808, 63, 3472, 63, 8899, 12, 326, 1350, 63, 1562, 29, 403, 304, 267, 862, 26, 288, 3101, 3225, 855, 826, 721, 277, 12, 1591, 12, 1844, 12, 7478, 12, 2653, 12, 1350, 63, 1562, 9, 267, 871, 3146, 26, 327, 2018, 499, 14, 22, 288, 3101, 3225, 855, 826, 721, 277, 12, 1591, 12, 1844, 12, 7478, 12, 2653, 9, 267, 291, 14, 498, 63, 493, 275, 790, 63, 493, 267, 291, 14, 4736, 63, 493, 275, 6250, 63, 493, 339, 347, 4907, 8, 277, 304, 267, 2557, 275, 291, 423, 1222, 63, 1631, 342, 267, 291, 423, 6726, 63, 1631, 8, 1631, 9, 267, 291, 14, 5096, 275, 6149, 14, 3823, 63, 3450, 8, 1631, 12, 291, 14, 498, 63, 493, 12, 291, 14, 4736, 63, 493, 9, 421, 199, 533, 5444, 4541, 27945, 8, 27945, 304, 272, 408, 272, 21311, 641, 8809, 14, 27945, 1325, 14018, 314, 2838, 543, 272, 7799, 3361, 3793, 14, 272, 408, 272, 6250, 63, 12720, 275, 488, 272, 1704, 63, 8356, 275, 488, 272, 6149, 63, 1023, 275, 488, 339, 347, 663, 63, 4736, 8, 277, 12, 790, 63, 493, 29, 403, 12, 6250, 63, 493, 29, 403, 12, 326, 6250, 63, 12720, 29, 403, 12, 1704, 63, 8356, 29, 403, 12, 326, 702, 63, 4269, 29, 403, 12, 702, 63, 15077, 29, 403, 304, 398, 291, 14, 498, 63, 493, 275, 790, 63, 493, 267, 291, 14, 4736, 63, 493, 275, 6250, 63, 493, 267, 291, 14, 4736, 63, 12720, 275, 6250, 63, 12720, 267, 291, 14, 696, 63, 8356, 275, 1704, 63, 8356, 267, 291, 14, 479, 63, 4269, 275, 702, 63, 4269, 267, 291, 14, 479, 63, 15077, 275, 702, 63, 15077, 339, 347, 4907, 8, 277, 304, 267, 327, 2654, 5897, 14786, 267, 862, 26, 288, 6771, 275, 2838, 14, 981, 63, 2105, 8, 355, 2287, 2687, 277, 14, 1102, 12, 291, 14, 719, 395, 355, 2653, 29, 277, 14, 2593, 12, 288, 776, 267, 871, 17766, 6372, 26, 288, 746, 15175, 19382, 8, 355, 291, 12, 298, 3225, 370, 450, 83, 18590, 734, 14, 334, 2242, 2653, 2458, 83, 2924, 450, 355, 334, 277, 14, 1102, 12, 291, 14, 2593, 430, 398, 6771, 14, 27689, 8, 3450, 14, 20130, 63, 9735, 12, 2838, 14, 9735, 63, 2826, 18616, 12, 717, 291, 14, 8815, 63, 932, 817, 9, 398, 12152, 63, 4736, 63, 12720, 275, 7512, 63, 4736, 63, 12720, 8, 277, 14, 4736, 63, 12720, 9, 267, 12152, 63, 4266, 63, 1023, 275, 7512, 63, 4266, 63, 1023, 8 ]
[ 4011, 19, 15, 2105, 14, 647, 199, 3, 1898, 9079, 13, 6965, 6061, 17885, 31449, 293, 86, 436, 8417, 334, 3239, 6483, 14, 2424, 9, 199, 3, 199, 3, 961, 859, 365, 1777, 402, 4011, 19, 436, 365, 14286, 1334, 199, 3, 314, 10697, 844, 26, 1455, 921, 1544, 14, 16374, 14, 1308, 15, 2383, 15, 1147, 13, 1682, 14, 8624, 199, 199, 646, 2838, 199, 504, 2838, 492, 2653, 465, 17766, 6372, 199, 199, 893, 26, 327, 2018, 650, 272, 687, 1455, 14, 1258, 492, 3101, 3225, 465, 485, 19114, 12, 28185, 199, 2590, 3545, 26, 272, 687, 8809, 492, 3101, 3225, 465, 485, 19114, 12, 28185, 199, 199, 533, 9762, 3225, 8, 785, 304, 272, 298, 9167, 370, 9696, 282, 3405, 8113, 24342, 492, 2122, 272, 986, 199, 199, 893, 26, 327, 3599, 1672, 543, 7799, 31, 272, 6149, 275, 488, 272, 14147, 3225, 275, 9762, 3225, 339, 1021, 3523, 27102, 8, 29900, 304, 267, 986, 339, 862, 26, 327, 2018, 650, 267, 687, 1455, 14, 1258, 492, 14147, 3225, 465, 485, 27945, 272, 871, 3545, 26, 267, 687, 8809, 492, 14147, 3225, 465, 485, 27945, 339, 492, 6149, 272, 3523, 27102, 275, 6149, 14, 27102, 199, 199, 2590, 334, 17825, 12, 4281, 304, 327, 16078, 13, 6100, 26, 3091, 7799, 14, 272, 986, 199, 199, 504, 1275, 3924, 492, 334, 272, 15175, 19382, 12, 199, 9, 199, 504, 1275, 5154, 14, 4266, 63, 1431, 63, 4269, 492, 1336, 63, 4269, 199, 504, 1275, 1974, 492, 334, 272, 702, 63, 15077, 12, 272, 7512, 63, 4736, 63, 12720, 12, 272, 7512, 63, 4266, 63, 1023, 12, 272, 6149, 63, 3823, 63, 3450, 12, 199, 9, 421, 199, 719, 63, 991, 63, 5512, 275, 469, 272, 283, 1014, 356, 5939, 12, 272, 283, 2859, 356, 23865, 12, 199, 93, 421, 199, 533, 3101, 3225, 1547, 19114, 12, 909, 304, 272, 849, 63, 719, 275, 1844, 63, 991, 63, 5512, 459, 1014, 418, 339, 327, 4885, 849, 12, 3507, 653, 643, 274, 1159, 23823, 14, 272, 14719, 63, 932, 817, 275, 413, 339, 347, 485, 1222, 63, 1631, 8, 277, 304, 267, 408, 15896, 13306, 282, 2838, 1950, 436, 663, 1031, 817, 2202, 641, 652, 398, 520, 1107, 26, 282, 892, 2838, 1950, 267, 408, 267, 862, 26, 288, 2557, 275, 2838, 14, 981, 63, 2105, 8, 355, 334, 277, 14, 1102, 12, 291, 14, 719, 395, 355, 291, 14, 2593, 12, 355, 291, 14, 1365, 63, 1562, 12, 288, 776, 267, 871, 4281, 26, 327, 2018, 499, 14, 22, 288, 2557, 275, 2838, 14, 981, 63, 2105, 8, 355, 334, 277, 14, 1102, 12, 291, 14, 719, 395, 355, 291, 14, 2593, 12, 288, 776, 267, 2557, 14, 27689, 8, 3450, 14, 20130, 63, 9735, 12, 2838, 14, 9735, 63, 2826, 18616, 12, 717, 291, 14, 8815, 63, 932, 817, 9, 267, 372, 2557, 339, 347, 485, 6726, 63, 1631, 8, 277, 12, 2557, 304, 267, 291, 14, 5096, 275, 2557, 267, 340, 291, 423, 15360, 63, 1102, 26, 288, 327, 3254, 26, 14811, 21496, 880, 652, 3181, 1133, 11687, 641, 291, 14, 5096, 1174, 14, 288, 291, 423, 15360, 342, 339, 347, 4907, 8, 277, 304, 267, 2557, 275, 291, 423, 1222, 63, 1631, 342, 267, 291, 423, 6726, 63, 1631, 8, 1631, 9, 421, 199, 533, 14147, 3225, 8, 19114, 304, 272, 849, 63, 719, 275, 1844, 63, 991, 63, 5512, 459, 2859, 418, 339, 347, 636, 826, 721, 277, 12, 1591, 12, 1844, 29, 403, 12, 790, 63, 493, 29, 403, 12, 6250, 63, 493, 29, 403, 12, 326, 7478, 29, 403, 12, 2653, 29, 3450, 423, 13808, 63, 3472, 63, 8899, 12, 326, 1350, 63, 1562, 29, 403, 304, 267, 862, 26, 288, 3101, 3225, 855, 826, 721, 277, 12, 1591, 12, 1844, 12, 7478, 12, 2653, 12, 1350, 63, 1562, 9, 267, 871, 3146, 26, 327, 2018, 499, 14, 22, 288, 3101, 3225, 855, 826, 721, 277, 12, 1591, 12, 1844, 12, 7478, 12, 2653, 9, 267, 291, 14, 498, 63, 493, 275, 790, 63, 493, 267, 291, 14, 4736, 63, 493, 275, 6250, 63, 493, 339, 347, 4907, 8, 277, 304, 267, 2557, 275, 291, 423, 1222, 63, 1631, 342, 267, 291, 423, 6726, 63, 1631, 8, 1631, 9, 267, 291, 14, 5096, 275, 6149, 14, 3823, 63, 3450, 8, 1631, 12, 291, 14, 498, 63, 493, 12, 291, 14, 4736, 63, 493, 9, 421, 199, 533, 5444, 4541, 27945, 8, 27945, 304, 272, 408, 272, 21311, 641, 8809, 14, 27945, 1325, 14018, 314, 2838, 543, 272, 7799, 3361, 3793, 14, 272, 408, 272, 6250, 63, 12720, 275, 488, 272, 1704, 63, 8356, 275, 488, 272, 6149, 63, 1023, 275, 488, 339, 347, 663, 63, 4736, 8, 277, 12, 790, 63, 493, 29, 403, 12, 6250, 63, 493, 29, 403, 12, 326, 6250, 63, 12720, 29, 403, 12, 1704, 63, 8356, 29, 403, 12, 326, 702, 63, 4269, 29, 403, 12, 702, 63, 15077, 29, 403, 304, 398, 291, 14, 498, 63, 493, 275, 790, 63, 493, 267, 291, 14, 4736, 63, 493, 275, 6250, 63, 493, 267, 291, 14, 4736, 63, 12720, 275, 6250, 63, 12720, 267, 291, 14, 696, 63, 8356, 275, 1704, 63, 8356, 267, 291, 14, 479, 63, 4269, 275, 702, 63, 4269, 267, 291, 14, 479, 63, 15077, 275, 702, 63, 15077, 339, 347, 4907, 8, 277, 304, 267, 327, 2654, 5897, 14786, 267, 862, 26, 288, 6771, 275, 2838, 14, 981, 63, 2105, 8, 355, 2287, 2687, 277, 14, 1102, 12, 291, 14, 719, 395, 355, 2653, 29, 277, 14, 2593, 12, 288, 776, 267, 871, 17766, 6372, 26, 288, 746, 15175, 19382, 8, 355, 291, 12, 298, 3225, 370, 450, 83, 18590, 734, 14, 334, 2242, 2653, 2458, 83, 2924, 450, 355, 334, 277, 14, 1102, 12, 291, 14, 2593, 430, 398, 6771, 14, 27689, 8, 3450, 14, 20130, 63, 9735, 12, 2838, 14, 9735, 63, 2826, 18616, 12, 717, 291, 14, 8815, 63, 932, 817, 9, 398, 12152, 63, 4736, 63, 12720, 275, 7512, 63, 4736, 63, 12720, 8, 277, 14, 4736, 63, 12720, 9, 267, 12152, 63, 4266, 63, 1023, 275, 7512, 63, 4266, 63, 1023, 8, 0 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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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 ]
scottgigante/picopore
test/test.py
1
2274
from __future__ import print_function import subprocess import os import errno import shutil import time import signal __test_files__ = ["sample_data/albacore_1d_original.fast5", "sample_data/metrichor_2d_original.fast5"] __test_runs__ = ["lossless", "deep-lossless"] __prefix__ = "picopore.test" __raw_runs__ = [["--fastq","--summary"],["--summary","--no-fastq"],["--fastq","--no-summary"],["--no-fastq","--no-summary"], ["--manual", "Analyses"]] def mkdir(path): try: os.makedirs(path) except OSError as e: if e.errno == errno.EEXIST and os.path.isdir(path): pass else: raise def call(additionalArgs, prefix=None): args=["python","-m","picopore","-y","--print-every","1"] if prefix is not None: args.extend(["--prefix",prefix]) args.extend(additionalArgs) print(" ".join(args)) p = subprocess.call(args) if prefix is not None: filename = args[-1] dirname = os.path.dirname(filename) basename = os.path.basename(filename) os.remove(os.path.join(dirname,".".join([prefix,basename]))) return p def testFile(filename): result = 0 for run in __test_runs__: result += call(["--test","--mode",run, filename]) result += call(["--mode",run, filename], prefix=__prefix__) for run in __raw_runs__: result += call(["--mode","raw"] + run + [filename], prefix=__prefix__) return result def testRealtime(mode, additionalArgs=None, directory="realtime"): __waittime = 10 mkdir(directory) args = ["python","-m","picopore","-y","--realtime","--print-every","1"] if additionalArgs is not None: args.extend(additionalArgs) args.extend(["--mode",mode,directory]) print(" ".join(args)) p = subprocess.Popen(args) time.sleep(__waittime) for filename in __test_files__: shutil.copy(filename, directory) time.sleep(__waittime) p.send_signal(signal.SIGINT) p.wait() shutil.rmtree(directory) return p.returncode exitcode = 0 for filename in __test_files__: exitcode += testFile(filename) for mode in __test_runs__: exitcode += testRealtime(mode) for mode in __raw_runs__: exitcode += testRealtime("raw", additionalArgs=mode) exit(exitcode)
gpl-3.0
[ 504, 636, 2443, 363, 492, 870, 63, 1593, 199, 646, 3873, 199, 646, 747, 199, 646, 7554, 199, 646, 5145, 199, 646, 900, 199, 646, 4673, 199, 199, 363, 396, 63, 1725, 363, 275, 2097, 3271, 63, 576, 15, 279, 2470, 1018, 63, 17, 68, 63, 5043, 14, 7015, 21, 401, 298, 3271, 63, 576, 15, 3318, 7050, 63, 18, 68, 63, 5043, 14, 7015, 21, 937, 199, 363, 396, 63, 10802, 363, 275, 2097, 4358, 2003, 401, 298, 16131, 13, 4358, 2003, 937, 199, 363, 1861, 363, 275, 298, 1038, 331, 555, 264, 14, 396, 2, 199, 363, 1773, 63, 10802, 363, 275, 24212, 306, 26423, 2266, 306, 4705, 30549, 306, 4705, 2266, 306, 889, 13, 26423, 30549, 306, 26423, 2266, 306, 889, 13, 4705, 30549, 306, 889, 13, 26423, 2266, 306, 889, 13, 4705, 2255, 22448, 9285, 401, 298, 8014, 874, 15261, 199, 199, 318, 20366, 8, 515, 304, 272, 862, 26, 267, 747, 14, 8347, 8, 515, 9, 272, 871, 6440, 465, 325, 26, 267, 340, 325, 14, 7931, 508, 7554, 14, 28596, 436, 747, 14, 515, 14, 6027, 8, 515, 304, 288, 986, 267, 587, 26, 288, 746, 199, 199, 318, 1240, 8, 8460, 6213, 12, 2403, 29, 403, 304, 272, 1249, 6270, 1548, 2266, 13, 77, 2266, 1038, 331, 555, 264, 2266, 13, 89, 2266, 306, 1361, 13, 14287, 2266, 17, 937, 272, 340, 2403, 365, 440, 488, 26, 267, 1249, 14, 2880, 5234, 306, 1861, 401, 1861, 566, 272, 1249, 14, 2880, 8, 8460, 6213, 9, 272, 870, 480, 3680, 904, 8, 589, 430, 272, 299, 275, 3873, 14, 1250, 8, 589, 9, 272, 340, 2403, 365, 440, 488, 26, 267, 1788, 275, 1249, 1988, 17, 61, 267, 9017, 275, 747, 14, 515, 14, 3475, 8, 1501, 9, 267, 9593, 275, 747, 14, 515, 14, 4846, 8, 1501, 9, 267, 747, 14, 2168, 8, 736, 14, 515, 14, 904, 8, 3475, 12, 1674, 1674, 904, 779, 1861, 12, 4846, 11845, 272, 372, 299, 199, 199, 318, 511, 1173, 8, 1501, 304, 272, 754, 275, 378, 272, 367, 1255, 315, 636, 396, 63, 10802, 10651, 267, 754, 847, 1240, 5234, 306, 396, 2266, 306, 632, 401, 1065, 12, 1788, 566, 267, 754, 847, 1240, 5234, 306, 632, 401, 1065, 12, 1788, 467, 2403, 18971, 1861, 3368, 272, 367, 1255, 315, 636, 1773, 63, 10802, 10651, 267, 754, 847, 1240, 5234, 306, 632, 2266, 1773, 937, 435, 1255, 435, 359, 1501, 467, 2403, 18971, 1861, 3368, 272, 372, 754, 199, 199, 318, 511, 30119, 8, 632, 12, 4722, 6213, 29, 403, 12, 2082, 628, 3093, 521, 2349, 272, 636, 2573, 521, 275, 1616, 272, 20366, 8, 3619, 9, 272, 1249, 275, 2097, 1548, 2266, 13, 77, 2266, 1038, 331, 555, 264, 2266, 13, 89, 2266, 306, 3093, 521, 2266, 306, 1361, 13, 14287, 2266, 17, 937, 272, 340, 4722, 6213, 365, 440, 488, 26, 267, 1249, 14, 2880, 8, 8460, 6213, 9, 272, 1249, 14, 2880, 5234, 306, 632, 401, 632, 12, 3619, 566, 272, 870, 480, 3680, 904, 8, 589, 430, 272, 299, 275, 3873, 14, 7942, 8, 589, 9, 272, 900, 14, 4532, 3460, 2573, 521, 9, 272, 367, 1788, 315, 636, 396, 63, 1725, 10651, 267, 5145, 14, 1574, 8, 1501, 12, 2082, 9, 267, 900, 14, 4532, 3460, 2573, 521, 9, 272, 299, 14, 2254, 63, 4653, 8, 4653, 14, 21223, 9, 272, 299, 14, 2573, 342, 272, 5145, 14, 9242, 8, 3619, 9, 272, 372, 299, 14, 9913, 199, 199, 2224, 600, 275, 378, 199, 509, 1788, 315, 636, 396, 63, 1725, 10651, 272, 4458, 600, 847, 511, 1173, 8, 1501, 9, 199, 199, 509, 818, 315, 636, 396, 63, 10802, 10651, 272, 4458, 600, 847, 511, 30119, 8, 632, 9, 199, 509, 818, 315, 636, 1773, 63, 10802, 10651, 272, 4458, 600, 847, 511, 30119, 480, 1773, 401, 4722, 6213, 29, 632, 9, 199, 2224, 8, 2224, 600, 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 ]
[ 636, 2443, 363, 492, 870, 63, 1593, 199, 646, 3873, 199, 646, 747, 199, 646, 7554, 199, 646, 5145, 199, 646, 900, 199, 646, 4673, 199, 199, 363, 396, 63, 1725, 363, 275, 2097, 3271, 63, 576, 15, 279, 2470, 1018, 63, 17, 68, 63, 5043, 14, 7015, 21, 401, 298, 3271, 63, 576, 15, 3318, 7050, 63, 18, 68, 63, 5043, 14, 7015, 21, 937, 199, 363, 396, 63, 10802, 363, 275, 2097, 4358, 2003, 401, 298, 16131, 13, 4358, 2003, 937, 199, 363, 1861, 363, 275, 298, 1038, 331, 555, 264, 14, 396, 2, 199, 363, 1773, 63, 10802, 363, 275, 24212, 306, 26423, 2266, 306, 4705, 30549, 306, 4705, 2266, 306, 889, 13, 26423, 30549, 306, 26423, 2266, 306, 889, 13, 4705, 30549, 306, 889, 13, 26423, 2266, 306, 889, 13, 4705, 2255, 22448, 9285, 401, 298, 8014, 874, 15261, 199, 199, 318, 20366, 8, 515, 304, 272, 862, 26, 267, 747, 14, 8347, 8, 515, 9, 272, 871, 6440, 465, 325, 26, 267, 340, 325, 14, 7931, 508, 7554, 14, 28596, 436, 747, 14, 515, 14, 6027, 8, 515, 304, 288, 986, 267, 587, 26, 288, 746, 199, 199, 318, 1240, 8, 8460, 6213, 12, 2403, 29, 403, 304, 272, 1249, 6270, 1548, 2266, 13, 77, 2266, 1038, 331, 555, 264, 2266, 13, 89, 2266, 306, 1361, 13, 14287, 2266, 17, 937, 272, 340, 2403, 365, 440, 488, 26, 267, 1249, 14, 2880, 5234, 306, 1861, 401, 1861, 566, 272, 1249, 14, 2880, 8, 8460, 6213, 9, 272, 870, 480, 3680, 904, 8, 589, 430, 272, 299, 275, 3873, 14, 1250, 8, 589, 9, 272, 340, 2403, 365, 440, 488, 26, 267, 1788, 275, 1249, 1988, 17, 61, 267, 9017, 275, 747, 14, 515, 14, 3475, 8, 1501, 9, 267, 9593, 275, 747, 14, 515, 14, 4846, 8, 1501, 9, 267, 747, 14, 2168, 8, 736, 14, 515, 14, 904, 8, 3475, 12, 1674, 1674, 904, 779, 1861, 12, 4846, 11845, 272, 372, 299, 199, 199, 318, 511, 1173, 8, 1501, 304, 272, 754, 275, 378, 272, 367, 1255, 315, 636, 396, 63, 10802, 10651, 267, 754, 847, 1240, 5234, 306, 396, 2266, 306, 632, 401, 1065, 12, 1788, 566, 267, 754, 847, 1240, 5234, 306, 632, 401, 1065, 12, 1788, 467, 2403, 18971, 1861, 3368, 272, 367, 1255, 315, 636, 1773, 63, 10802, 10651, 267, 754, 847, 1240, 5234, 306, 632, 2266, 1773, 937, 435, 1255, 435, 359, 1501, 467, 2403, 18971, 1861, 3368, 272, 372, 754, 199, 199, 318, 511, 30119, 8, 632, 12, 4722, 6213, 29, 403, 12, 2082, 628, 3093, 521, 2349, 272, 636, 2573, 521, 275, 1616, 272, 20366, 8, 3619, 9, 272, 1249, 275, 2097, 1548, 2266, 13, 77, 2266, 1038, 331, 555, 264, 2266, 13, 89, 2266, 306, 3093, 521, 2266, 306, 1361, 13, 14287, 2266, 17, 937, 272, 340, 4722, 6213, 365, 440, 488, 26, 267, 1249, 14, 2880, 8, 8460, 6213, 9, 272, 1249, 14, 2880, 5234, 306, 632, 401, 632, 12, 3619, 566, 272, 870, 480, 3680, 904, 8, 589, 430, 272, 299, 275, 3873, 14, 7942, 8, 589, 9, 272, 900, 14, 4532, 3460, 2573, 521, 9, 272, 367, 1788, 315, 636, 396, 63, 1725, 10651, 267, 5145, 14, 1574, 8, 1501, 12, 2082, 9, 267, 900, 14, 4532, 3460, 2573, 521, 9, 272, 299, 14, 2254, 63, 4653, 8, 4653, 14, 21223, 9, 272, 299, 14, 2573, 342, 272, 5145, 14, 9242, 8, 3619, 9, 272, 372, 299, 14, 9913, 199, 199, 2224, 600, 275, 378, 199, 509, 1788, 315, 636, 396, 63, 1725, 10651, 272, 4458, 600, 847, 511, 1173, 8, 1501, 9, 199, 199, 509, 818, 315, 636, 396, 63, 10802, 10651, 272, 4458, 600, 847, 511, 30119, 8, 632, 9, 199, 509, 818, 315, 636, 1773, 63, 10802, 10651, 272, 4458, 600, 847, 511, 30119, 480, 1773, 401, 4722, 6213, 29, 632, 9, 199, 2224, 8, 2224, 600, 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, 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,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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 ]
wuxianghou/phantomjs
src/qt/qtwebkit/Source/WebKit2/Scripts/webkit2/model.py
118
2669
# Copyright (C) 2010, 2011 Apple 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: # 1. Redistributions of source code must retain the above copyright # notice, this list of conditions and the following disclaimer. # 2. Redistributions in binary form must reproduce the above copyright # notice, this list of conditions and the following disclaimer in the # documentation and/or other materials provided with the distribution. # # THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS 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 APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR # ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR # SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER # CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, # OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. import itertools class MessageReceiver(object): def __init__(self, name, attributes, messages, condition): self.name = name self.attributes = frozenset(attributes or []) self.messages = messages self.condition = condition def iterparameters(self): return itertools.chain((parameter for message in self.messages for parameter in message.parameters), (reply_parameter for message in self.messages if message.reply_parameters for reply_parameter in message.reply_parameters)) def has_attribute(self, attribute): return attribute in self.attributes class Message(object): def __init__(self, name, parameters, reply_parameters, attributes, condition): self.name = name self.parameters = parameters self.reply_parameters = reply_parameters self.attributes = frozenset(attributes or []) self.condition = condition def has_attribute(self, attribute): return attribute in self.attributes class Parameter(object): def __init__(self, type, name, attributes=None, condition=None): self.type = type self.name = name self.attributes = frozenset(attributes or []) self.condition = condition def has_attribute(self, attribute): return attribute in self.attributes
bsd-3-clause
[ 3, 1898, 334, 35, 9, 7129, 12, 7760, 21257, 3277, 14, 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, 199, 3, 787, 7647, 26, 199, 3, 413, 14, 221, 6823, 402, 1350, 1233, 1471, 8074, 314, 3432, 4248, 199, 3, 258, 4245, 12, 642, 769, 402, 3704, 436, 314, 2569, 6450, 14, 199, 3, 499, 14, 221, 6823, 315, 3366, 1824, 1471, 9172, 314, 3432, 4248, 199, 3, 258, 4245, 12, 642, 769, 402, 3704, 436, 314, 2569, 6450, 315, 314, 199, 3, 258, 3794, 436, 15, 269, 1163, 8418, 2741, 543, 314, 4084, 14, 199, 3, 199, 3, 5749, 4141, 2281, 7049, 6515, 19525, 906, 7839, 14, 2401, 473, 9730, 6483, 1124, 1179, 2281, 891, 2401, 199, 3, 1821, 7168, 1549, 5292, 2990, 12, 6931, 12, 5400, 2845, 5471, 2296, 12, 2334, 5292, 199, 3, 2990, 1634, 3169, 2401, 3092, 2381, 437, 3115, 3104, 9315, 199, 3, 9706, 14, 1621, 4825, 6461, 7000, 19525, 906, 7839, 14, 1549, 473, 9730, 6483, 6262, 7024, 2381, 199, 3, 1821, 8703, 12, 9168, 12, 9716, 12, 8820, 12, 9836, 12, 1549, 9110, 199, 3, 6736, 334, 6446, 12, 5400, 2845, 5471, 2296, 12, 9838, 1634, 9103, 9764, 1549, 199, 3, 9714, 27, 9102, 1634, 4815, 12, 7126, 12, 1549, 9206, 27, 1549, 9748, 9831, 9, 9802, 199, 3, 9817, 2401, 5258, 1821, 9815, 1634, 5603, 12, 7061, 1621, 7066, 12, 9644, 5603, 12, 199, 3, 1549, 7056, 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, 646, 7975, 421, 199, 533, 6430, 21800, 8, 785, 304, 272, 347, 636, 826, 721, 277, 12, 536, 12, 3004, 12, 3788, 12, 5558, 304, 267, 291, 14, 354, 275, 536, 267, 291, 14, 2987, 275, 9522, 8, 2987, 503, 3073, 267, 291, 14, 3431, 275, 3788, 267, 291, 14, 5394, 275, 5558, 339, 347, 2740, 3214, 8, 277, 304, 267, 372, 7975, 14, 4429, 1332, 5329, 367, 1245, 315, 291, 14, 3431, 367, 2725, 315, 1245, 14, 3214, 395, 288, 334, 8102, 63, 5329, 367, 1245, 315, 291, 14, 3431, 340, 1245, 14, 8102, 63, 3214, 367, 9351, 63, 5329, 315, 1245, 14, 8102, 63, 3214, 430, 339, 347, 965, 63, 3215, 8, 277, 12, 2225, 304, 267, 372, 2225, 315, 291, 14, 2987, 199, 199, 533, 6430, 8, 785, 304, 272, 347, 636, 826, 721, 277, 12, 536, 12, 2633, 12, 9351, 63, 3214, 12, 3004, 12, 5558, 304, 267, 291, 14, 354, 275, 536, 267, 291, 14, 3214, 275, 2633, 267, 291, 14, 8102, 63, 3214, 275, 9351, 63, 3214, 267, 291, 14, 2987, 275, 9522, 8, 2987, 503, 3073, 267, 291, 14, 5394, 275, 5558, 339, 347, 965, 63, 3215, 8, 277, 12, 2225, 304, 267, 372, 2225, 315, 291, 14, 2987, 421, 199, 533, 12009, 8, 785, 304, 272, 347, 636, 826, 721, 277, 12, 730, 12, 536, 12, 3004, 29, 403, 12, 5558, 29, 403, 304, 267, 291, 14, 466, 275, 730, 267, 291, 14, 354, 275, 536, 267, 291, 14, 2987, 275, 9522, 8, 2987, 503, 3073, 267, 291, 14, 5394, 275, 5558, 339, 347, 965, 63, 3215, 8, 277, 12, 2225, 304, 267, 372, 2225, 315, 291, 14, 2987, 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 ]
[ 1898, 334, 35, 9, 7129, 12, 7760, 21257, 3277, 14, 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, 199, 3, 787, 7647, 26, 199, 3, 413, 14, 221, 6823, 402, 1350, 1233, 1471, 8074, 314, 3432, 4248, 199, 3, 258, 4245, 12, 642, 769, 402, 3704, 436, 314, 2569, 6450, 14, 199, 3, 499, 14, 221, 6823, 315, 3366, 1824, 1471, 9172, 314, 3432, 4248, 199, 3, 258, 4245, 12, 642, 769, 402, 3704, 436, 314, 2569, 6450, 315, 314, 199, 3, 258, 3794, 436, 15, 269, 1163, 8418, 2741, 543, 314, 4084, 14, 199, 3, 199, 3, 5749, 4141, 2281, 7049, 6515, 19525, 906, 7839, 14, 2401, 473, 9730, 6483, 1124, 1179, 2281, 891, 2401, 199, 3, 1821, 7168, 1549, 5292, 2990, 12, 6931, 12, 5400, 2845, 5471, 2296, 12, 2334, 5292, 199, 3, 2990, 1634, 3169, 2401, 3092, 2381, 437, 3115, 3104, 9315, 199, 3, 9706, 14, 1621, 4825, 6461, 7000, 19525, 906, 7839, 14, 1549, 473, 9730, 6483, 6262, 7024, 2381, 199, 3, 1821, 8703, 12, 9168, 12, 9716, 12, 8820, 12, 9836, 12, 1549, 9110, 199, 3, 6736, 334, 6446, 12, 5400, 2845, 5471, 2296, 12, 9838, 1634, 9103, 9764, 1549, 199, 3, 9714, 27, 9102, 1634, 4815, 12, 7126, 12, 1549, 9206, 27, 1549, 9748, 9831, 9, 9802, 199, 3, 9817, 2401, 5258, 1821, 9815, 1634, 5603, 12, 7061, 1621, 7066, 12, 9644, 5603, 12, 199, 3, 1549, 7056, 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, 646, 7975, 421, 199, 533, 6430, 21800, 8, 785, 304, 272, 347, 636, 826, 721, 277, 12, 536, 12, 3004, 12, 3788, 12, 5558, 304, 267, 291, 14, 354, 275, 536, 267, 291, 14, 2987, 275, 9522, 8, 2987, 503, 3073, 267, 291, 14, 3431, 275, 3788, 267, 291, 14, 5394, 275, 5558, 339, 347, 2740, 3214, 8, 277, 304, 267, 372, 7975, 14, 4429, 1332, 5329, 367, 1245, 315, 291, 14, 3431, 367, 2725, 315, 1245, 14, 3214, 395, 288, 334, 8102, 63, 5329, 367, 1245, 315, 291, 14, 3431, 340, 1245, 14, 8102, 63, 3214, 367, 9351, 63, 5329, 315, 1245, 14, 8102, 63, 3214, 430, 339, 347, 965, 63, 3215, 8, 277, 12, 2225, 304, 267, 372, 2225, 315, 291, 14, 2987, 199, 199, 533, 6430, 8, 785, 304, 272, 347, 636, 826, 721, 277, 12, 536, 12, 2633, 12, 9351, 63, 3214, 12, 3004, 12, 5558, 304, 267, 291, 14, 354, 275, 536, 267, 291, 14, 3214, 275, 2633, 267, 291, 14, 8102, 63, 3214, 275, 9351, 63, 3214, 267, 291, 14, 2987, 275, 9522, 8, 2987, 503, 3073, 267, 291, 14, 5394, 275, 5558, 339, 347, 965, 63, 3215, 8, 277, 12, 2225, 304, 267, 372, 2225, 315, 291, 14, 2987, 421, 199, 533, 12009, 8, 785, 304, 272, 347, 636, 826, 721, 277, 12, 730, 12, 536, 12, 3004, 29, 403, 12, 5558, 29, 403, 304, 267, 291, 14, 466, 275, 730, 267, 291, 14, 354, 275, 536, 267, 291, 14, 2987, 275, 9522, 8, 2987, 503, 3073, 267, 291, 14, 5394, 275, 5558, 339, 347, 965, 63, 3215, 8, 277, 12, 2225, 304, 267, 372, 2225, 315, 291, 14, 2987, 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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