Search is not available for this dataset
identifier stringlengths 1 155 | parameters stringlengths 2 6.09k | docstring stringlengths 11 63.4k | docstring_summary stringlengths 0 63.4k | function stringlengths 29 99.8k | function_tokens list | start_point list | end_point list | language stringclasses 1
value | docstring_language stringlengths 2 7 | docstring_language_predictions stringlengths 18 23 | is_langid_reliable stringclasses 2
values |
|---|---|---|---|---|---|---|---|---|---|---|---|
to_iso | (self, func, isocalendar_pos) | Check the toISOYear/Week functions with DateTime64 extended range. | Check the toISOYear/Week functions with DateTime64 extended range. | def to_iso(self, func, isocalendar_pos):
"""Check the toISOYear/Week functions with DateTime64 extended range."""
stress = self.context.stress
timezones = timezones_range(stress)
for year in years_range(stress=stress):
with Given(f"I choose datetimes in {year}"):
datetimes = select_... | [
"def",
"to_iso",
"(",
"self",
",",
"func",
",",
"isocalendar_pos",
")",
":",
"stress",
"=",
"self",
".",
"context",
".",
"stress",
"timezones",
"=",
"timezones_range",
"(",
"stress",
")",
"for",
"year",
"in",
"years_range",
"(",
"stress",
"=",
"stress",
... | [
663,
0
] | [
682,
77
] | python | en | ['en', 'en', 'en'] | True |
to_iso_year | (self) | Check the toISOYear function with DateTime64 extended range. | Check the toISOYear function with DateTime64 extended range. | def to_iso_year(self):
"""Check the toISOYear function with DateTime64 extended range."""
to_iso(func="toISOYear", isocalendar_pos=0) | [
"def",
"to_iso_year",
"(",
"self",
")",
":",
"to_iso",
"(",
"func",
"=",
"\"toISOYear\"",
",",
"isocalendar_pos",
"=",
"0",
")"
] | [
689,
0
] | [
691,
47
] | python | en | ['en', 'en', 'en'] | True |
to_iso_week | (self) | Check the toISOWeek function with DateTime64 extended range. | Check the toISOWeek function with DateTime64 extended range. | def to_iso_week(self):
"""Check the toISOWeek function with DateTime64 extended range."""
to_iso(func="toISOWeek", isocalendar_pos=1) | [
"def",
"to_iso_week",
"(",
"self",
")",
":",
"to_iso",
"(",
"func",
"=",
"\"toISOWeek\"",
",",
"isocalendar_pos",
"=",
"1",
")"
] | [
698,
0
] | [
700,
47
] | python | en | ['en', 'en', 'en'] | True |
to_time | (self) | Check the toTime function with DateTime64 extended range. | Check the toTime function with DateTime64 extended range. | def to_time(self):
"""Check the toTime function with DateTime64 extended range."""
stress = self.context.stress
timezones = timezones_range(stress)
for year in years_range(stress=stress):
with Given(f"I choose datetimes in {year}"):
datetimes = select_dates_in_year(year=year, stress... | [
"def",
"to_time",
"(",
"self",
")",
":",
"stress",
"=",
"self",
".",
"context",
".",
"stress",
"timezones",
"=",
"timezones_range",
"(",
"stress",
")",
"for",
"year",
"in",
"years_range",
"(",
"stress",
"=",
"stress",
")",
":",
"with",
"Given",
"(",
"f... | [
707,
0
] | [
726,
77
] | python | en | ['en', 'en', 'en'] | True |
to_relative_quarter_num | (self) | Check the toRelativeQuarterNum function with DateTime64 extended range. | Check the toRelativeQuarterNum function with DateTime64 extended range. | def to_relative_quarter_num(self):
"""Check the toRelativeQuarterNum function with DateTime64 extended range."""
stress = self.context.stress
timezones = timezones_range(stress)
for year in years_range(stress=stress):
with Given(f"I choose datetimes in {year}"):
datetimes = select_d... | [
"def",
"to_relative_quarter_num",
"(",
"self",
")",
":",
"stress",
"=",
"self",
".",
"context",
".",
"stress",
"timezones",
"=",
"timezones_range",
"(",
"stress",
")",
"for",
"year",
"in",
"years_range",
"(",
"stress",
"=",
"stress",
")",
":",
"with",
"Giv... | [
733,
0
] | [
752,
77
] | python | en | ['en', 'en', 'en'] | True |
to_relative_week_num | (self) | Check the toRelativeWeekNum function with DateTime64 extended range. | Check the toRelativeWeekNum function with DateTime64 extended range. | def to_relative_week_num(self):
"""Check the toRelativeWeekNum function with DateTime64 extended range."""
stress = self.context.stress
timezones = timezones_range(stress)
for year in years_range(stress=stress):
with Given(f"I choose datetimes in {year}"):
datetimes = select_dates_i... | [
"def",
"to_relative_week_num",
"(",
"self",
")",
":",
"stress",
"=",
"self",
".",
"context",
".",
"stress",
"timezones",
"=",
"timezones_range",
"(",
"stress",
")",
"for",
"year",
"in",
"years_range",
"(",
"stress",
"=",
"stress",
")",
":",
"with",
"Given"... | [
759,
0
] | [
779,
77
] | python | en | ['en', 'en', 'en'] | True |
to_relative_month_num | (self) | Check the toRelativeMonthNum function with DateTime64 extended range. | Check the toRelativeMonthNum function with DateTime64 extended range. | def to_relative_month_num(self):
"""Check the toRelativeMonthNum function with DateTime64 extended range."""
stress = self.context.stress
timezones = timezones_range(stress)
for year in years_range(stress=stress):
with Given(f"I choose datetimes in {year}"):
datetimes = select_dates... | [
"def",
"to_relative_month_num",
"(",
"self",
")",
":",
"stress",
"=",
"self",
".",
"context",
".",
"stress",
"timezones",
"=",
"timezones_range",
"(",
"stress",
")",
"for",
"year",
"in",
"years_range",
"(",
"stress",
"=",
"stress",
")",
":",
"with",
"Given... | [
786,
0
] | [
806,
77
] | python | en | ['en', 'en', 'en'] | True |
to_relative_day_num | (self) | Check the toRelativeDayNum function with DateTime64 extended range. | Check the toRelativeDayNum function with DateTime64 extended range. | def to_relative_day_num(self):
"""Check the toRelativeDayNum function with DateTime64 extended range."""
stress = self.context.stress
timezones = timezones_range(stress)
for year in years_range(stress=stress):
with Given(f"I choose datetimes in {year}"):
datetimes = select_dates_in_... | [
"def",
"to_relative_day_num",
"(",
"self",
")",
":",
"stress",
"=",
"self",
".",
"context",
".",
"stress",
"timezones",
"=",
"timezones_range",
"(",
"stress",
")",
"for",
"year",
"in",
"years_range",
"(",
"stress",
"=",
"stress",
")",
":",
"with",
"Given",... | [
813,
0
] | [
833,
77
] | python | en | ['en', 'en', 'en'] | True |
to_relative_time | (self, divisor, func) | Check the toRelative[Hour/Minute/Second]Num functions
with DateTime64 extended range.
| Check the toRelative[Hour/Minute/Second]Num functions
with DateTime64 extended range.
| def to_relative_time(self, divisor, func):
"""Check the toRelative[Hour/Minute/Second]Num functions
with DateTime64 extended range.
"""
stress = self.context.stress
timezones = timezones_range(stress)
for year in years_range(stress=stress):
with Given(f"I choose datetimes in {year}"):
... | [
"def",
"to_relative_time",
"(",
"self",
",",
"divisor",
",",
"func",
")",
":",
"stress",
"=",
"self",
".",
"context",
".",
"stress",
"timezones",
"=",
"timezones_range",
"(",
"stress",
")",
"for",
"year",
"in",
"years_range",
"(",
"stress",
"=",
"stress",
... | [
837,
0
] | [
859,
77
] | python | en | ['en', 'en', 'en'] | True |
to_relative_hour_num | (self) | Check the toRelativeHourNum function
with DateTime64 extended range.
| Check the toRelativeHourNum function
with DateTime64 extended range.
| def to_relative_hour_num(self):
"""Check the toRelativeHourNum function
with DateTime64 extended range.
"""
to_relative_time(func="toRelativeHourNum", divisor=3600) | [
"def",
"to_relative_hour_num",
"(",
"self",
")",
":",
"to_relative_time",
"(",
"func",
"=",
"\"toRelativeHourNum\"",
",",
"divisor",
"=",
"3600",
")"
] | [
866,
0
] | [
870,
60
] | python | en | ['en', 'sn', 'en'] | True |
to_relative_minute_num | (self) | Check the toRelativeMinuteNum function
with DateTime64 extended range.
| Check the toRelativeMinuteNum function
with DateTime64 extended range.
| def to_relative_minute_num(self):
"""Check the toRelativeMinuteNum function
with DateTime64 extended range.
"""
to_relative_time(func="toRelativeMinuteNum", divisor=60) | [
"def",
"to_relative_minute_num",
"(",
"self",
")",
":",
"to_relative_time",
"(",
"func",
"=",
"\"toRelativeMinuteNum\"",
",",
"divisor",
"=",
"60",
")"
] | [
877,
0
] | [
881,
60
] | python | en | ['en', 'sn', 'en'] | True |
to_relative_second_num | (self) | Check the toRelativeSecondNum function
with DateTime64 extended range.
| Check the toRelativeSecondNum function
with DateTime64 extended range.
| def to_relative_second_num(self):
"""Check the toRelativeSecondNum function
with DateTime64 extended range.
"""
to_relative_time(func="toRelativeSecondNum", divisor=1) | [
"def",
"to_relative_second_num",
"(",
"self",
")",
":",
"to_relative_time",
"(",
"func",
"=",
"\"toRelativeSecondNum\"",
",",
"divisor",
"=",
"1",
")"
] | [
888,
0
] | [
892,
59
] | python | en | ['en', 'en', 'en'] | True |
to_week_compute_expected | (dt: datetime.datetime, mode: int, ret_year=False) | Helper to get the expected value for testing toWeek().
Due to necessity to manually check 10 workmodes, the subroutine was removed from to_week()
| Helper to get the expected value for testing toWeek().
Due to necessity to manually check 10 workmodes, the subroutine was removed from to_week()
| def to_week_compute_expected(dt: datetime.datetime, mode: int, ret_year=False):
"""Helper to get the expected value for testing toWeek().
Due to necessity to manually check 10 workmodes, the subroutine was removed from to_week()
"""
year = dt.year
ex = datetime.datetime(year, 1, 1)
j1_weekday =... | [
"def",
"to_week_compute_expected",
"(",
"dt",
":",
"datetime",
".",
"datetime",
",",
"mode",
":",
"int",
",",
"ret_year",
"=",
"False",
")",
":",
"year",
"=",
"dt",
".",
"year",
"ex",
"=",
"datetime",
".",
"datetime",
"(",
"year",
",",
"1",
",",
"1",... | [
895,
0
] | [
973,
78
] | python | en | ['en', 'en', 'en'] | True |
to_week_year_week | (self, clh_func, ret_year) | Check the toWeek/toYearWeek function with DateTime64 extended range.
For detailed info on work modes and description, see
https://clickhouse.tech/docs/en/sql-reference/functions/date-time-functions/#toweekdatemode
:param self: current test
:param clh_func: ClickHouse function to be called, string
:p... | Check the toWeek/toYearWeek function with DateTime64 extended range.
For detailed info on work modes and description, see
https://clickhouse.tech/docs/en/sql-reference/functions/date-time-functions/#toweekdatemode
:param self: current test
:param clh_func: ClickHouse function to be called, string
:p... | def to_week_year_week(self, clh_func, ret_year):
"""Check the toWeek/toYearWeek function with DateTime64 extended range.
For detailed info on work modes and description, see
https://clickhouse.tech/docs/en/sql-reference/functions/date-time-functions/#toweekdatemode
:param self: current test
:param c... | [
"def",
"to_week_year_week",
"(",
"self",
",",
"clh_func",
",",
"ret_year",
")",
":",
"stress",
"=",
"self",
".",
"context",
".",
"stress",
"timezones",
"=",
"timezones_range",
"(",
"stress",
")",
"for",
"year",
"in",
"years_range",
"(",
"stress",
")",
":",... | [
977,
0
] | [
1003,
81
] | python | en | ['en', 'en', 'en'] | True |
to_week | (self) | Check the toWeek function with DateTime64 extended range. | Check the toWeek function with DateTime64 extended range. | def to_week(self):
"""Check the toWeek function with DateTime64 extended range."""
to_week_year_week(clh_func="toWeek", ret_year=False) | [
"def",
"to_week",
"(",
"self",
")",
":",
"to_week_year_week",
"(",
"clh_func",
"=",
"\"toWeek\"",
",",
"ret_year",
"=",
"False",
")"
] | [
1010,
0
] | [
1012,
56
] | python | en | ['en', 'en', 'en'] | True |
to_year_week | (self) | Check the toYearWeek function with DateTime64 extended range. | Check the toYearWeek function with DateTime64 extended range. | def to_year_week(self):
"""Check the toYearWeek function with DateTime64 extended range."""
to_week_year_week(clh_func="toYearWeek", ret_year=True) | [
"def",
"to_year_week",
"(",
"self",
")",
":",
"to_week_year_week",
"(",
"clh_func",
"=",
"\"toYearWeek\"",
",",
"ret_year",
"=",
"True",
")"
] | [
1019,
0
] | [
1021,
59
] | python | en | ['en', 'en', 'en'] | True |
to_yyyymm | (self) | Check the toYYYYMM() function with
DateTime64 extended range.
| Check the toYYYYMM() function with
DateTime64 extended range.
| def to_yyyymm(self):
"""Check the toYYYYMM() function with
DateTime64 extended range.
"""
stress = self.context.stress
timezones = timezones_range(stress)
for year in years_range(stress):
with Given(f"I choose datetimes in {year}"):
datetimes = select_dates_in_year(year=year... | [
"def",
"to_yyyymm",
"(",
"self",
")",
":",
"stress",
"=",
"self",
".",
"context",
".",
"stress",
"timezones",
"=",
"timezones_range",
"(",
"stress",
")",
"for",
"year",
"in",
"years_range",
"(",
"stress",
")",
":",
"with",
"Given",
"(",
"f\"I choose dateti... | [
1028,
0
] | [
1049,
77
] | python | en | ['en', 'en', 'en'] | True |
to_yyyymmdd | (self) | Check the toYYYYMMDD() function with
DateTime64 extended range.
| Check the toYYYYMMDD() function with
DateTime64 extended range.
| def to_yyyymmdd(self):
"""Check the toYYYYMMDD() function with
DateTime64 extended range.
"""
stress = self.context.stress
timezones = timezones_range(stress)
for year in years_range(stress):
with Given(f"I choose datetimes in {year}"):
datetimes = select_dates_in_year(year=... | [
"def",
"to_yyyymmdd",
"(",
"self",
")",
":",
"stress",
"=",
"self",
".",
"context",
".",
"stress",
"timezones",
"=",
"timezones_range",
"(",
"stress",
")",
"for",
"year",
"in",
"years_range",
"(",
"stress",
")",
":",
"with",
"Given",
"(",
"f\"I choose date... | [
1056,
0
] | [
1077,
77
] | python | en | ['en', 'en', 'en'] | True |
to_yyyymmddhhmmss | (self) | Check the toYYYYMMDDhhmmss() function with
DateTime64 extended range.
| Check the toYYYYMMDDhhmmss() function with
DateTime64 extended range.
| def to_yyyymmddhhmmss(self):
"""Check the toYYYYMMDDhhmmss() function with
DateTime64 extended range.
"""
stress = self.context.stress
timezones = timezones_range(stress)
for year in years_range(stress):
with Given(f"I choose datetimes in {year}"):
datetimes = select_dates_i... | [
"def",
"to_yyyymmddhhmmss",
"(",
"self",
")",
":",
"stress",
"=",
"self",
".",
"context",
".",
"stress",
"timezones",
"=",
"timezones_range",
"(",
"stress",
")",
"for",
"year",
"in",
"years_range",
"(",
"stress",
")",
":",
"with",
"Given",
"(",
"f\"I choos... | [
1084,
0
] | [
1105,
77
] | python | en | ['en', 'en', 'en'] | True |
now | (self) | Check the now() conversion to DateTime64 extended range.
In this test, we cannot assure that pytz now() and ClickHouse now() will be executed at the same time, so we need
a 30-second error tolerance to test this functionality
| Check the now() conversion to DateTime64 extended range.
In this test, we cannot assure that pytz now() and ClickHouse now() will be executed at the same time, so we need
a 30-second error tolerance to test this functionality
| def now(self):
"""Check the now() conversion to DateTime64 extended range.
In this test, we cannot assure that pytz now() and ClickHouse now() will be executed at the same time, so we need
a 30-second error tolerance to test this functionality
"""
stress = self.context.stress
timezones = timezon... | [
"def",
"now",
"(",
"self",
")",
":",
"stress",
"=",
"self",
".",
"context",
".",
"stress",
"timezones",
"=",
"timezones_range",
"(",
"stress",
")",
"for",
"tz",
"in",
"timezones",
":",
"with",
"Given",
"(",
"f\"I record current time and localize it for {tz}\"",
... | [
1112,
0
] | [
1139,
41
] | python | en | ['en', 'en', 'en'] | True |
today | (self) | Check the today() conversion to DateTime64 extended range.
| Check the today() conversion to DateTime64 extended range.
| def today(self):
"""Check the today() conversion to DateTime64 extended range.
"""
stress = self.context.stress
timezones = timezones_range(stress)
for tz in timezones:
with Given(f"I record current time and localize it for {tz}"):
dt = datetime.datetime.now()
dt = d... | [
"def",
"today",
"(",
"self",
")",
":",
"stress",
"=",
"self",
".",
"context",
".",
"stress",
"timezones",
"=",
"timezones_range",
"(",
"stress",
")",
"for",
"tz",
"in",
"timezones",
":",
"with",
"Given",
"(",
"f\"I record current time and localize it for {tz}\""... | [
1146,
0
] | [
1171,
44
] | python | en | ['en', 'en', 'en'] | True |
yesterday | (self) | Check the yesterday() conversion to DateTime64 extended range.
| Check the yesterday() conversion to DateTime64 extended range.
| def yesterday(self):
"""Check the yesterday() conversion to DateTime64 extended range.
"""
stress = self.context.stress
timezones = timezones_range(stress)
for tz in timezones:
with Given(f"I record current time and localize it for {tz}"):
dt = datetime.datetime.now()
... | [
"def",
"yesterday",
"(",
"self",
")",
":",
"stress",
"=",
"self",
".",
"context",
".",
"stress",
"timezones",
"=",
"timezones_range",
"(",
"stress",
")",
"for",
"tz",
"in",
"timezones",
":",
"with",
"Given",
"(",
"f\"I record current time and localize it for {tz... | [
1178,
0
] | [
1205,
45
] | python | en | ['en', 'en', 'en'] | True |
add_subtract_functions | (self, clh_func, py_key, test_range, years_padding=(1, 1), modifier=1, mult=1) | Check the addYears/addMonths/addWeeks/addDays/addHours/addMinutes/addSeconds with DateTime64 extended range.
Calculating expected result using eval() to avoid writing 9000+ comparisons and just parse string as object field name.
:param self: self
:param clh_func: ClickHouse function to be called, string
... | Check the addYears/addMonths/addWeeks/addDays/addHours/addMinutes/addSeconds with DateTime64 extended range.
Calculating expected result using eval() to avoid writing 9000+ comparisons and just parse string as object field name.
:param self: self
:param clh_func: ClickHouse function to be called, string
... | def add_subtract_functions(self, clh_func, py_key, test_range, years_padding=(1, 1), modifier=1, mult=1):
"""Check the addYears/addMonths/addWeeks/addDays/addHours/addMinutes/addSeconds with DateTime64 extended range.
Calculating expected result using eval() to avoid writing 9000+ comparisons and just parse str... | [
"def",
"add_subtract_functions",
"(",
"self",
",",
"clh_func",
",",
"py_key",
",",
"test_range",
",",
"years_padding",
"=",
"(",
"1",
",",
"1",
")",
",",
"modifier",
"=",
"1",
",",
"mult",
"=",
"1",
")",
":",
"stress",
"=",
"self",
".",
"context",
".... | [
1209,
0
] | [
1242,
81
] | python | en | ['en', 'en', 'en'] | True |
add_years | (self) | Check the addYears function with DateTime64 extended range. | Check the addYears function with DateTime64 extended range. | def add_years(self):
"""Check the addYears function with DateTime64 extended range."""
add_subtract_functions(clh_func="addYears", py_key="years", test_range=(0, 1), years_padding=(0, 1)) | [
"def",
"add_years",
"(",
"self",
")",
":",
"add_subtract_functions",
"(",
"clh_func",
"=",
"\"addYears\"",
",",
"py_key",
"=",
"\"years\"",
",",
"test_range",
"=",
"(",
"0",
",",
"1",
")",
",",
"years_padding",
"=",
"(",
"0",
",",
"1",
")",
")"
] | [
1249,
0
] | [
1251,
104
] | python | en | ['en', 'en', 'en'] | True |
subtract_years | (self) | Check the subtractYears function with DateTime64 extended range. | Check the subtractYears function with DateTime64 extended range. | def subtract_years(self):
"""Check the subtractYears function with DateTime64 extended range."""
add_subtract_functions(clh_func="subtractYears", py_key="years", test_range=(0, 1), years_padding=(1, 0), mult=-1) | [
"def",
"subtract_years",
"(",
"self",
")",
":",
"add_subtract_functions",
"(",
"clh_func",
"=",
"\"subtractYears\"",
",",
"py_key",
"=",
"\"years\"",
",",
"test_range",
"=",
"(",
"0",
",",
"1",
")",
",",
"years_padding",
"=",
"(",
"1",
",",
"0",
")",
","... | [
1258,
0
] | [
1260,
118
] | python | en | ['en', 'en', 'en'] | True |
add_quarters | (self) | Check the addQuarters function with DateTime64 extended range. | Check the addQuarters function with DateTime64 extended range. | def add_quarters(self):
"""Check the addQuarters function with DateTime64 extended range."""
add_subtract_functions(clh_func="addQuarters", py_key="months", test_range=range(1, 5), years_padding=(0, 1), modifier=3) | [
"def",
"add_quarters",
"(",
"self",
")",
":",
"add_subtract_functions",
"(",
"clh_func",
"=",
"\"addQuarters\"",
",",
"py_key",
"=",
"\"months\"",
",",
"test_range",
"=",
"range",
"(",
"1",
",",
"5",
")",
",",
"years_padding",
"=",
"(",
"0",
",",
"1",
")... | [
1267,
0
] | [
1269,
125
] | python | en | ['en', 'en', 'en'] | True |
subtract_quarters | (self) | Check the subtractQuarters function with DateTime64 extended range. | Check the subtractQuarters function with DateTime64 extended range. | def subtract_quarters(self):
"""Check the subtractQuarters function with DateTime64 extended range."""
add_subtract_functions(clh_func="subtractQuarters", py_key="months", test_range=range(1, 5), years_padding=(1, 0), modifier=3, mult=-1) | [
"def",
"subtract_quarters",
"(",
"self",
")",
":",
"add_subtract_functions",
"(",
"clh_func",
"=",
"\"subtractQuarters\"",
",",
"py_key",
"=",
"\"months\"",
",",
"test_range",
"=",
"range",
"(",
"1",
",",
"5",
")",
",",
"years_padding",
"=",
"(",
"1",
",",
... | [
1276,
0
] | [
1278,
139
] | python | en | ['en', 'en', 'en'] | True |
add_months | (self) | Check the addMonths function with DateTime64 extended range. | Check the addMonths function with DateTime64 extended range. | def add_months(self):
"""Check the addMonths function with DateTime64 extended range."""
add_subtract_functions(clh_func="addMonths", py_key="months", test_range=range(1, 13), years_padding=(0, 1)) | [
"def",
"add_months",
"(",
"self",
")",
":",
"add_subtract_functions",
"(",
"clh_func",
"=",
"\"addMonths\"",
",",
"py_key",
"=",
"\"months\"",
",",
"test_range",
"=",
"range",
"(",
"1",
",",
"13",
")",
",",
"years_padding",
"=",
"(",
"0",
",",
"1",
")",
... | [
1285,
0
] | [
1287,
112
] | python | en | ['en', 'en', 'en'] | True |
subtract_months | (self) | Check the subtractMonths function with DateTime64 extended range. | Check the subtractMonths function with DateTime64 extended range. | def subtract_months(self):
"""Check the subtractMonths function with DateTime64 extended range."""
add_subtract_functions(clh_func="subtractMonths", py_key="months", test_range=range(1, 13), years_padding=(1, 0), mult=-1) | [
"def",
"subtract_months",
"(",
"self",
")",
":",
"add_subtract_functions",
"(",
"clh_func",
"=",
"\"subtractMonths\"",
",",
"py_key",
"=",
"\"months\"",
",",
"test_range",
"=",
"range",
"(",
"1",
",",
"13",
")",
",",
"years_padding",
"=",
"(",
"1",
",",
"0... | [
1294,
0
] | [
1296,
126
] | python | en | ['en', 'en', 'en'] | True |
add_weeks | (self) | Check the addWeeks function with DateTime64 extended range. | Check the addWeeks function with DateTime64 extended range. | def add_weeks(self):
"""Check the addWeeks function with DateTime64 extended range."""
add_subtract_functions(clh_func="addWeeks", py_key="days", test_range=range(6), years_padding=(0, 1), modifier=7) | [
"def",
"add_weeks",
"(",
"self",
")",
":",
"add_subtract_functions",
"(",
"clh_func",
"=",
"\"addWeeks\"",
",",
"py_key",
"=",
"\"days\"",
",",
"test_range",
"=",
"range",
"(",
"6",
")",
",",
"years_padding",
"=",
"(",
"0",
",",
"1",
")",
",",
"modifier"... | [
1303,
0
] | [
1305,
117
] | python | en | ['en', 'en', 'en'] | True |
subtract_weeks | (self) | Check the subtractWeeks function with DateTime64 extended range. | Check the subtractWeeks function with DateTime64 extended range. | def subtract_weeks(self):
"""Check the subtractWeeks function with DateTime64 extended range."""
add_subtract_functions(clh_func="subtractWeeks", py_key="days", test_range=range(6), years_padding=(1, 0), modifier=7, mult=-1) | [
"def",
"subtract_weeks",
"(",
"self",
")",
":",
"add_subtract_functions",
"(",
"clh_func",
"=",
"\"subtractWeeks\"",
",",
"py_key",
"=",
"\"days\"",
",",
"test_range",
"=",
"range",
"(",
"6",
")",
",",
"years_padding",
"=",
"(",
"1",
",",
"0",
")",
",",
... | [
1312,
0
] | [
1314,
131
] | python | en | ['en', 'en', 'en'] | True |
add_days | (self) | Check the addDays function work with DateTime64 extended range | Check the addDays function work with DateTime64 extended range | def add_days(self):
"""Check the addDays function work with DateTime64 extended range"""
add_subtract_functions(clh_func="addDays", py_key="days", test_range=range(50)) | [
"def",
"add_days",
"(",
"self",
")",
":",
"add_subtract_functions",
"(",
"clh_func",
"=",
"\"addDays\"",
",",
"py_key",
"=",
"\"days\"",
",",
"test_range",
"=",
"range",
"(",
"50",
")",
")"
] | [
1322,
0
] | [
1324,
83
] | python | en | ['en', 'en', 'en'] | True |
subtract_days | (self) | Check the subtractDays function work with DateTime64 extended range | Check the subtractDays function work with DateTime64 extended range | def subtract_days(self):
"""Check the subtractDays function work with DateTime64 extended range"""
add_subtract_functions(clh_func="subtractDays", py_key="days", test_range=range(50), mult=-1) | [
"def",
"subtract_days",
"(",
"self",
")",
":",
"add_subtract_functions",
"(",
"clh_func",
"=",
"\"subtractDays\"",
",",
"py_key",
"=",
"\"days\"",
",",
"test_range",
"=",
"range",
"(",
"50",
")",
",",
"mult",
"=",
"-",
"1",
")"
] | [
1331,
0
] | [
1333,
97
] | python | en | ['en', 'en', 'en'] | True |
add_hours | (self) | Check the addHours function work with DateTime64 extended range | Check the addHours function work with DateTime64 extended range | def add_hours(self):
"""Check the addHours function work with DateTime64 extended range"""
add_subtract_functions(clh_func="addHours", py_key="hours", test_range=range(25)) | [
"def",
"add_hours",
"(",
"self",
")",
":",
"add_subtract_functions",
"(",
"clh_func",
"=",
"\"addHours\"",
",",
"py_key",
"=",
"\"hours\"",
",",
"test_range",
"=",
"range",
"(",
"25",
")",
")"
] | [
1340,
0
] | [
1342,
85
] | python | en | ['en', 'en', 'en'] | True |
subtract_hours | (self) | Check the subtractHours function work with DateTime64 extended range | Check the subtractHours function work with DateTime64 extended range | def subtract_hours(self):
"""Check the subtractHours function work with DateTime64 extended range"""
add_subtract_functions(clh_func="subtractHours", py_key="hours", test_range=range(25), mult=-1) | [
"def",
"subtract_hours",
"(",
"self",
")",
":",
"add_subtract_functions",
"(",
"clh_func",
"=",
"\"subtractHours\"",
",",
"py_key",
"=",
"\"hours\"",
",",
"test_range",
"=",
"range",
"(",
"25",
")",
",",
"mult",
"=",
"-",
"1",
")"
] | [
1349,
0
] | [
1351,
99
] | python | en | ['en', 'en', 'en'] | True |
add_minutes | (self) | Check the addMinutes function work with DateTime64 extended range | Check the addMinutes function work with DateTime64 extended range | def add_minutes(self):
"""Check the addMinutes function work with DateTime64 extended range"""
add_subtract_functions(clh_func="addMinutes", py_key="minutes", test_range=range(60)) | [
"def",
"add_minutes",
"(",
"self",
")",
":",
"add_subtract_functions",
"(",
"clh_func",
"=",
"\"addMinutes\"",
",",
"py_key",
"=",
"\"minutes\"",
",",
"test_range",
"=",
"range",
"(",
"60",
")",
")"
] | [
1358,
0
] | [
1360,
89
] | python | en | ['en', 'en', 'en'] | True |
subtract_minutes | (self) | Check the subtractMinutes function work with DateTime64 extended range | Check the subtractMinutes function work with DateTime64 extended range | def subtract_minutes(self):
"""Check the subtractMinutes function work with DateTime64 extended range"""
add_subtract_functions(clh_func="subtractMinutes", py_key="minutes", test_range=range(60), mult=-1) | [
"def",
"subtract_minutes",
"(",
"self",
")",
":",
"add_subtract_functions",
"(",
"clh_func",
"=",
"\"subtractMinutes\"",
",",
"py_key",
"=",
"\"minutes\"",
",",
"test_range",
"=",
"range",
"(",
"60",
")",
",",
"mult",
"=",
"-",
"1",
")"
] | [
1367,
0
] | [
1369,
103
] | python | en | ['en', 'en', 'en'] | True |
add_seconds | (self) | Check the addSeconds function work with DateTime64 extended range | Check the addSeconds function work with DateTime64 extended range | def add_seconds(self):
"""Check the addSeconds function work with DateTime64 extended range"""
add_subtract_functions(clh_func="addSeconds", py_key="seconds", test_range=range(60)) | [
"def",
"add_seconds",
"(",
"self",
")",
":",
"add_subtract_functions",
"(",
"clh_func",
"=",
"\"addSeconds\"",
",",
"py_key",
"=",
"\"seconds\"",
",",
"test_range",
"=",
"range",
"(",
"60",
")",
")"
] | [
1376,
0
] | [
1378,
89
] | python | en | ['en', 'en', 'en'] | True |
subtract_seconds | (self) | Check the subtractSeconds function work with DateTime64 extended range | Check the subtractSeconds function work with DateTime64 extended range | def subtract_seconds(self):
"""Check the subtractSeconds function work with DateTime64 extended range"""
add_subtract_functions(clh_func="subtractSeconds", py_key="seconds", test_range=range(60), mult=-1) | [
"def",
"subtract_seconds",
"(",
"self",
")",
":",
"add_subtract_functions",
"(",
"clh_func",
"=",
"\"subtractSeconds\"",
",",
"py_key",
"=",
"\"seconds\"",
",",
"test_range",
"=",
"range",
"(",
"60",
")",
",",
"mult",
"=",
"-",
"1",
")"
] | [
1385,
0
] | [
1387,
103
] | python | en | ['en', 'en', 'en'] | True |
date_diff_helper | (dt1, dt2: datetime.datetime, unit: str) | Helper for computing dateDiff expected result using Python.
| Helper for computing dateDiff expected result using Python.
| def date_diff_helper(dt1, dt2: datetime.datetime, unit: str):
"""Helper for computing dateDiff expected result using Python.
"""
delta = dt2 - dt1
if unit == "second":
return delta.total_seconds()
elif unit == "minute":
return delta.total_seconds() // 60
elif unit == "hour":
... | [
"def",
"date_diff_helper",
"(",
"dt1",
",",
"dt2",
":",
"datetime",
".",
"datetime",
",",
"unit",
":",
"str",
")",
":",
"delta",
"=",
"dt2",
"-",
"dt1",
"if",
"unit",
"==",
"\"second\"",
":",
"return",
"delta",
".",
"total_seconds",
"(",
")",
"elif",
... | [
1390,
0
] | [
1409,
34
] | python | en | ['en', 'en', 'en'] | True |
date_diff | (self) | Check how dateDiff works with DateTime64 extended range.
| Check how dateDiff works with DateTime64 extended range.
| def date_diff(self):
"""Check how dateDiff works with DateTime64 extended range.
"""
stress = self.context.stress
compare_units = ("second", "minute", "hour", "day", "week", "month", "quarter", "year")
timezones = timezones_range(stress=stress)
with Background("I select a set of datetimes to be... | [
"def",
"date_diff",
"(",
"self",
")",
":",
"stress",
"=",
"self",
".",
"context",
".",
"stress",
"compare_units",
"=",
"(",
"\"second\"",
",",
"\"minute\"",
",",
"\"hour\"",
",",
"\"day\"",
",",
"\"week\"",
",",
"\"month\"",
",",
"\"quarter\"",
",",
"\"yea... | [
1416,
0
] | [
1441,
68
] | python | en | ['en', 'en', 'en'] | True |
format_date_time | (self) | Test formatDateTime() when DateTime64 is out of normal range.
This function formats DateTime according to a given Format string.
| Test formatDateTime() when DateTime64 is out of normal range.
This function formats DateTime according to a given Format string.
| def format_date_time(self):
"""Test formatDateTime() when DateTime64 is out of normal range.
This function formats DateTime according to a given Format string.
"""
stress = self.context.stress
timezones = timezones_range(stress)
modes = ('C', 'd', 'D', 'e', 'F', 'G', 'g', 'H', 'I', 'j', 'm', ... | [
"def",
"format_date_time",
"(",
"self",
")",
":",
"stress",
"=",
"self",
".",
"context",
".",
"stress",
"timezones",
"=",
"timezones_range",
"(",
"stress",
")",
"modes",
"=",
"(",
"'C'",
",",
"'d'",
",",
"'D'",
",",
"'e'",
",",
"'F'",
",",
"'G'",
","... | [
1448,
0
] | [
1474,
81
] | python | en | ['en', 'en', 'en'] | True |
time_slots_get_expected | (dt: datetime.datetime, duration, size=1800) | Helper to compute expected array for timeSlots().
| Helper to compute expected array for timeSlots().
| def time_slots_get_expected(dt: datetime.datetime, duration, size=1800):
"""Helper to compute expected array for timeSlots().
"""
zero_time = datetime.datetime(1970, 1, 1, 0, 0, 0)
result = [(zero_time + datetime.timedelta(seconds=((dt - zero_time).total_seconds() // size * size))).strftime("%Y-%m-%d %... | [
"def",
"time_slots_get_expected",
"(",
"dt",
":",
"datetime",
".",
"datetime",
",",
"duration",
",",
"size",
"=",
"1800",
")",
":",
"zero_time",
"=",
"datetime",
".",
"datetime",
"(",
"1970",
",",
"1",
",",
"1",
",",
"0",
",",
"0",
",",
"0",
")",
"... | [
1477,
0
] | [
1495,
17
] | python | en | ['en', 'en', 'en'] | True |
time_slots | (self) | Check the timeSlots function with DateTime64 extended range.
syntax: timeSlots(StartTime, Duration _seconds_ [, Size _seconds_])
| Check the timeSlots function with DateTime64 extended range.
syntax: timeSlots(StartTime, Duration _seconds_ [, Size _seconds_])
| def time_slots(self):
"""Check the timeSlots function with DateTime64 extended range.
syntax: timeSlots(StartTime, Duration _seconds_ [, Size _seconds_])
"""
stress = self.context.stress
for year in years_range(stress=stress):
with Given(f"I choose datetimes in {year}"):
datetim... | [
"def",
"time_slots",
"(",
"self",
")",
":",
"stress",
"=",
"self",
".",
"context",
".",
"stress",
"for",
"year",
"in",
"years_range",
"(",
"stress",
"=",
"stress",
")",
":",
"with",
"Given",
"(",
"f\"I choose datetimes in {year}\"",
")",
":",
"datetimes",
... | [
1502,
0
] | [
1526,
48
] | python | en | ['en', 'en', 'en'] | True |
date_time_funcs | (self, node="clickhouse1") | Check the basic operations with DateTime64
| Check the basic operations with DateTime64
| def date_time_funcs(self, node="clickhouse1"):
"""Check the basic operations with DateTime64
"""
self.context.node = self.context.cluster.node(node)
tasks = []
with Pool(4) as pool:
try:
for scenario in loads(current_module(), Scenario):
run_scenario(pool, tasks,... | [
"def",
"date_time_funcs",
"(",
"self",
",",
"node",
"=",
"\"clickhouse1\"",
")",
":",
"self",
".",
"context",
".",
"node",
"=",
"self",
".",
"context",
".",
"cluster",
".",
"node",
"(",
"node",
")",
"tasks",
"=",
"[",
"]",
"with",
"Pool",
"(",
"4",
... | [
1533,
0
] | [
1544,
23
] | python | en | ['en', 'en', 'en'] | True |
eval_sign_at | (p, vs) |
Evaluate the sign of the polynomial `p` at `vs`. `p` is a Z3
Expression containing arithmetic operators: +, -, *, ^k where k is
an integer; and free variables x that is_var(x) is True. Moreover,
all variables must be real.
The result is 1 if the polynomial is positive at the given point,
... |
Evaluate the sign of the polynomial `p` at `vs`. `p` is a Z3
Expression containing arithmetic operators: +, -, *, ^k where k is
an integer; and free variables x that is_var(x) is True. Moreover,
all variables must be real.
The result is 1 if the polynomial is positive at the given point,
... | def eval_sign_at(p, vs):
"""
Evaluate the sign of the polynomial `p` at `vs`. `p` is a Z3
Expression containing arithmetic operators: +, -, *, ^k where k is
an integer; and free variables x that is_var(x) is True. Moreover,
all variables must be real.
The result is 1 if the polynomial is ... | [
"def",
"eval_sign_at",
"(",
"p",
",",
"vs",
")",
":",
"num",
"=",
"len",
"(",
"vs",
")",
"_vs",
"=",
"(",
"Ast",
"*",
"num",
")",
"(",
")",
"for",
"i",
"in",
"range",
"(",
"num",
")",
":",
"_vs",
"[",
"i",
"]",
"=",
"vs",
"[",
"i",
"]",
... | [
525,
0
] | [
547,
63
] | python | en | ['en', 'ja', 'th'] | False |
isolate_roots | (p, vs=[]) |
Given a multivariate polynomial p(x_0, ..., x_{n-1}, x_n), returns the
roots of the univariate polynomial p(vs[0], ..., vs[len(vs)-1], x_n).
Remarks:
* p is a Z3 expression that contains only arithmetic terms and free variables.
* forall i in [0, n) vs is a numeral.
The result is ... |
Given a multivariate polynomial p(x_0, ..., x_{n-1}, x_n), returns the
roots of the univariate polynomial p(vs[0], ..., vs[len(vs)-1], x_n).
Remarks:
* p is a Z3 expression that contains only arithmetic terms and free variables.
* forall i in [0, n) vs is a numeral.
The result is ... | def isolate_roots(p, vs=[]):
"""
Given a multivariate polynomial p(x_0, ..., x_{n-1}, x_n), returns the
roots of the univariate polynomial p(vs[0], ..., vs[len(vs)-1], x_n).
Remarks:
* p is a Z3 expression that contains only arithmetic terms and free variables.
* forall i in [0, n) vs i... | [
"def",
"isolate_roots",
"(",
"p",
",",
"vs",
"=",
"[",
"]",
")",
":",
"num",
"=",
"len",
"(",
"vs",
")",
"_vs",
"=",
"(",
"Ast",
"*",
"num",
")",
"(",
")",
"for",
"i",
"in",
"range",
"(",
"num",
")",
":",
"_vs",
"[",
"i",
"]",
"=",
"vs",
... | [
549,
0
] | [
575,
41
] | python | en | ['en', 'error', 'th'] | False |
Numeral.is_integer | (self) | Return True if the numeral is integer.
>>> Numeral(2).is_integer()
True
>>> (Numeral(Sqrt(2)) * Numeral(Sqrt(2))).is_integer()
True
>>> Numeral(Sqrt(2)).is_integer()
False
>>> Numeral("2/3").is_integer()
False
| Return True if the numeral is integer.
>>> Numeral(2).is_integer()
True
>>> (Numeral(Sqrt(2)) * Numeral(Sqrt(2))).is_integer()
True
>>> Numeral(Sqrt(2)).is_integer()
False
>>> Numeral("2/3").is_integer()
False
| def is_integer(self):
""" Return True if the numeral is integer.
>>> Numeral(2).is_integer()
True
>>> (Numeral(Sqrt(2)) * Numeral(Sqrt(2))).is_integer()
True
>>> Numeral(Sqrt(2)).is_integer()
False
>>> Numeral("2/3").is_integer()
False
... | [
"def",
"is_integer",
"(",
"self",
")",
":",
"return",
"self",
".",
"is_rational",
"(",
")",
"and",
"self",
".",
"denominator",
"(",
")",
"==",
"1"
] | [
108,
4
] | [
120,
61
] | python | en | ['en', 'en', 'en'] | True |
Numeral.is_rational | (self) | Return True if the numeral is rational.
>>> Numeral(2).is_rational()
True
>>> Numeral("2/3").is_rational()
True
>>> Numeral(Sqrt(2)).is_rational()
False
| Return True if the numeral is rational. | def is_rational(self):
""" Return True if the numeral is rational.
>>> Numeral(2).is_rational()
True
>>> Numeral("2/3").is_rational()
True
>>> Numeral(Sqrt(2)).is_rational()
False
"""
return Z3_get_ast_kind(self.ctx_ref(), self.as_ast()) ... | [
"def",
"is_rational",
"(",
"self",
")",
":",
"return",
"Z3_get_ast_kind",
"(",
"self",
".",
"ctx_ref",
"(",
")",
",",
"self",
".",
"as_ast",
"(",
")",
")",
"==",
"Z3_NUMERAL_AST"
] | [
122,
4
] | [
133,
79
] | python | en | ['en', 'en', 'en'] | True |
Numeral.denominator | (self) | Return the denominator if `self` is rational.
>>> Numeral("2/3").denominator()
3
| Return the denominator if `self` is rational.
>>> Numeral("2/3").denominator()
3
| def denominator(self):
""" Return the denominator if `self` is rational.
>>> Numeral("2/3").denominator()
3
"""
assert(self.is_rational())
return Numeral(Z3_get_denominator(self.ctx_ref(), self.as_ast()), self.ctx) | [
"def",
"denominator",
"(",
"self",
")",
":",
"assert",
"(",
"self",
".",
"is_rational",
"(",
")",
")",
"return",
"Numeral",
"(",
"Z3_get_denominator",
"(",
"self",
".",
"ctx_ref",
"(",
")",
",",
"self",
".",
"as_ast",
"(",
")",
")",
",",
"self",
".",... | [
135,
4
] | [
142,
83
] | python | en | ['en', 'en', 'en'] | True |
Numeral.numerator | (self) | Return the numerator if `self` is rational.
>>> Numeral("2/3").numerator()
2
| Return the numerator if `self` is rational.
>>> Numeral("2/3").numerator()
2
| def numerator(self):
""" Return the numerator if `self` is rational.
>>> Numeral("2/3").numerator()
2
"""
assert(self.is_rational())
return Numeral(Z3_get_numerator(self.ctx_ref(), self.as_ast()), self.ctx) | [
"def",
"numerator",
"(",
"self",
")",
":",
"assert",
"(",
"self",
".",
"is_rational",
"(",
")",
")",
"return",
"Numeral",
"(",
"Z3_get_numerator",
"(",
"self",
".",
"ctx_ref",
"(",
")",
",",
"self",
".",
"as_ast",
"(",
")",
")",
",",
"self",
".",
"... | [
144,
4
] | [
151,
81
] | python | en | ['en', 'en', 'en'] | True |
Numeral.is_irrational | (self) | Return True if the numeral is irrational.
>>> Numeral(2).is_irrational()
False
>>> Numeral("2/3").is_irrational()
False
>>> Numeral(Sqrt(2)).is_irrational()
True
| Return True if the numeral is irrational. | def is_irrational(self):
""" Return True if the numeral is irrational.
>>> Numeral(2).is_irrational()
False
>>> Numeral("2/3").is_irrational()
False
>>> Numeral(Sqrt(2)).is_irrational()
True
"""
return not self.is_rational() | [
"def",
"is_irrational",
"(",
"self",
")",
":",
"return",
"not",
"self",
".",
"is_rational",
"(",
")"
] | [
154,
4
] | [
164,
37
] | python | en | ['en', 'en', 'en'] | True |
Numeral.as_long | (self) | Return a numeral (that is an integer) as a Python long.
| Return a numeral (that is an integer) as a Python long. | def as_long(self):
""" Return a numeral (that is an integer) as a Python long.
"""
assert(self.is_integer())
if sys.version_info[0] >= 3:
return int(Z3_get_numeral_string(self.ctx_ref(), self.as_ast()))
else:
return long(Z3_get_numeral_string(self.ctx_ref... | [
"def",
"as_long",
"(",
"self",
")",
":",
"assert",
"(",
"self",
".",
"is_integer",
"(",
")",
")",
"if",
"sys",
".",
"version_info",
"[",
"0",
"]",
">=",
"3",
":",
"return",
"int",
"(",
"Z3_get_numeral_string",
"(",
"self",
".",
"ctx_ref",
"(",
")",
... | [
166,
4
] | [
174,
77
] | python | en | ['en', 'en', 'en'] | True |
Numeral.as_fraction | (self) | Return a numeral (that is a rational) as a Python Fraction.
>>> Numeral("1/5").as_fraction()
Fraction(1, 5)
| Return a numeral (that is a rational) as a Python Fraction.
>>> Numeral("1/5").as_fraction()
Fraction(1, 5)
| def as_fraction(self):
""" Return a numeral (that is a rational) as a Python Fraction.
>>> Numeral("1/5").as_fraction()
Fraction(1, 5)
"""
assert(self.is_rational())
return Fraction(self.numerator().as_long(), self.denominator().as_long()) | [
"def",
"as_fraction",
"(",
"self",
")",
":",
"assert",
"(",
"self",
".",
"is_rational",
"(",
")",
")",
"return",
"Fraction",
"(",
"self",
".",
"numerator",
"(",
")",
".",
"as_long",
"(",
")",
",",
"self",
".",
"denominator",
"(",
")",
".",
"as_long",... | [
176,
4
] | [
182,
81
] | python | en | ['en', 'en', 'en'] | True |
Numeral.approx | (self, precision=10) | Return a numeral that approximates the numeral `self`.
The result `r` is such that |r - self| <= 1/10^precision
If `self` is rational, then the result is `self`.
>>> x = Numeral(2).root(2)
>>> x.approx(20)
6838717160008073720548335/4835703278458516698824704
>>... | Return a numeral that approximates the numeral `self`.
The result `r` is such that |r - self| <= 1/10^precision
If `self` is rational, then the result is `self`. | def approx(self, precision=10):
"""Return a numeral that approximates the numeral `self`.
The result `r` is such that |r - self| <= 1/10^precision
If `self` is rational, then the result is `self`.
>>> x = Numeral(2).root(2)
>>> x.approx(20)
6838717160008073720... | [
"def",
"approx",
"(",
"self",
",",
"precision",
"=",
"10",
")",
":",
"return",
"self",
".",
"upper",
"(",
"precision",
")"
] | [
184,
4
] | [
198,
36
] | python | en | ['en', 'en', 'en'] | True |
Numeral.upper | (self, precision=10) | Return a upper bound that approximates the numeral `self`.
The result `r` is such that r - self <= 1/10^precision
If `self` is rational, then the result is `self`.
>>> x = Numeral(2).root(2)
>>> x.upper(20)
6838717160008073720548335/4835703278458516698824704
>... | Return a upper bound that approximates the numeral `self`.
The result `r` is such that r - self <= 1/10^precision
If `self` is rational, then the result is `self`. | def upper(self, precision=10):
"""Return a upper bound that approximates the numeral `self`.
The result `r` is such that r - self <= 1/10^precision
If `self` is rational, then the result is `self`.
>>> x = Numeral(2).root(2)
>>> x.upper(20)
6838717160008073720... | [
"def",
"upper",
"(",
"self",
",",
"precision",
"=",
"10",
")",
":",
"if",
"self",
".",
"is_rational",
"(",
")",
":",
"return",
"self",
"else",
":",
"return",
"Numeral",
"(",
"Z3_get_algebraic_number_upper",
"(",
"self",
".",
"ctx_ref",
"(",
")",
",",
"... | [
200,
4
] | [
217,
109
] | python | en | ['en', 'en', 'en'] | True |
Numeral.lower | (self, precision=10) | Return a lower bound that approximates the numeral `self`.
The result `r` is such that self - r <= 1/10^precision
If `self` is rational, then the result is `self`.
>>> x = Numeral(2).root(2)
>>> x.lower(20)
1709679290002018430137083/1208925819614629174706176
>... | Return a lower bound that approximates the numeral `self`.
The result `r` is such that self - r <= 1/10^precision
If `self` is rational, then the result is `self`. | def lower(self, precision=10):
"""Return a lower bound that approximates the numeral `self`.
The result `r` is such that self - r <= 1/10^precision
If `self` is rational, then the result is `self`.
>>> x = Numeral(2).root(2)
>>> x.lower(20)
1709679290002018430... | [
"def",
"lower",
"(",
"self",
",",
"precision",
"=",
"10",
")",
":",
"if",
"self",
".",
"is_rational",
"(",
")",
":",
"return",
"self",
"else",
":",
"return",
"Numeral",
"(",
"Z3_get_algebraic_number_lower",
"(",
"self",
".",
"ctx_ref",
"(",
")",
",",
"... | [
219,
4
] | [
234,
109
] | python | en | ['en', 'en', 'en'] | True |
Numeral.sign | (self) | Return the sign of the numeral.
>>> Numeral(2).sign()
1
>>> Numeral(-3).sign()
-1
>>> Numeral(0).sign()
0
| Return the sign of the numeral.
>>> Numeral(2).sign()
1
>>> Numeral(-3).sign()
-1
>>> Numeral(0).sign()
0
| def sign(self):
""" Return the sign of the numeral.
>>> Numeral(2).sign()
1
>>> Numeral(-3).sign()
-1
>>> Numeral(0).sign()
0
"""
return Z3_algebraic_sign(self.ctx_ref(), self.ast) | [
"def",
"sign",
"(",
"self",
")",
":",
"return",
"Z3_algebraic_sign",
"(",
"self",
".",
"ctx_ref",
"(",
")",
",",
"self",
".",
"ast",
")"
] | [
236,
4
] | [
246,
58
] | python | en | ['en', 'en', 'en'] | True |
Numeral.is_pos | (self) | Return True if the numeral is positive.
>>> Numeral(2).is_pos()
True
>>> Numeral(-3).is_pos()
False
>>> Numeral(0).is_pos()
False
| Return True if the numeral is positive.
>>> Numeral(2).is_pos()
True
>>> Numeral(-3).is_pos()
False
>>> Numeral(0).is_pos()
False
| def is_pos(self):
""" Return True if the numeral is positive.
>>> Numeral(2).is_pos()
True
>>> Numeral(-3).is_pos()
False
>>> Numeral(0).is_pos()
False
"""
return Z3_algebraic_is_pos(self.ctx_ref(), self.ast) | [
"def",
"is_pos",
"(",
"self",
")",
":",
"return",
"Z3_algebraic_is_pos",
"(",
"self",
".",
"ctx_ref",
"(",
")",
",",
"self",
".",
"ast",
")"
] | [
248,
4
] | [
258,
60
] | python | en | ['en', 'en', 'en'] | True |
Numeral.is_neg | (self) | Return True if the numeral is negative.
>>> Numeral(2).is_neg()
False
>>> Numeral(-3).is_neg()
True
>>> Numeral(0).is_neg()
False
| Return True if the numeral is negative.
>>> Numeral(2).is_neg()
False
>>> Numeral(-3).is_neg()
True
>>> Numeral(0).is_neg()
False
| def is_neg(self):
""" Return True if the numeral is negative.
>>> Numeral(2).is_neg()
False
>>> Numeral(-3).is_neg()
True
>>> Numeral(0).is_neg()
False
"""
return Z3_algebraic_is_neg(self.ctx_ref(), self.ast) | [
"def",
"is_neg",
"(",
"self",
")",
":",
"return",
"Z3_algebraic_is_neg",
"(",
"self",
".",
"ctx_ref",
"(",
")",
",",
"self",
".",
"ast",
")"
] | [
260,
4
] | [
270,
60
] | python | en | ['en', 'en', 'en'] | True |
Numeral.is_zero | (self) | Return True if the numeral is zero.
>>> Numeral(2).is_zero()
False
>>> Numeral(-3).is_zero()
False
>>> Numeral(0).is_zero()
True
>>> sqrt2 = Numeral(2).root(2)
>>> sqrt2.is_zero()
False
>>> (sqrt2 - sqrt2).is_zero()
True
... | Return True if the numeral is zero.
>>> Numeral(2).is_zero()
False
>>> Numeral(-3).is_zero()
False
>>> Numeral(0).is_zero()
True
>>> sqrt2 = Numeral(2).root(2)
>>> sqrt2.is_zero()
False
>>> (sqrt2 - sqrt2).is_zero()
True
... | def is_zero(self):
""" Return True if the numeral is zero.
>>> Numeral(2).is_zero()
False
>>> Numeral(-3).is_zero()
False
>>> Numeral(0).is_zero()
True
>>> sqrt2 = Numeral(2).root(2)
>>> sqrt2.is_zero()
False
>>> (sqrt2 - s... | [
"def",
"is_zero",
"(",
"self",
")",
":",
"return",
"Z3_algebraic_is_zero",
"(",
"self",
".",
"ctx_ref",
"(",
")",
",",
"self",
".",
"ast",
")"
] | [
272,
4
] | [
287,
61
] | python | en | ['en', 'en', 'en'] | True |
Numeral.__add__ | (self, other) | Return the numeral `self + other`.
>>> Numeral(2) + 3
5
>>> Numeral(2) + Numeral(4)
6
>>> Numeral("2/3") + 1
5/3
| Return the numeral `self + other`. | def __add__(self, other):
""" Return the numeral `self + other`.
>>> Numeral(2) + 3
5
>>> Numeral(2) + Numeral(4)
6
>>> Numeral("2/3") + 1
5/3
"""
return Numeral(Z3_algebraic_add(self.ctx_ref(), self.ast, _to_numeral(other, self.ctx).ast), self.ct... | [
"def",
"__add__",
"(",
"self",
",",
"other",
")",
":",
"return",
"Numeral",
"(",
"Z3_algebraic_add",
"(",
"self",
".",
"ctx_ref",
"(",
")",
",",
"self",
".",
"ast",
",",
"_to_numeral",
"(",
"other",
",",
"self",
".",
"ctx",
")",
".",
"ast",
")",
",... | [
289,
4
] | [
299,
110
] | python | en | ['en', 'en', 'en'] | True |
Numeral.__radd__ | (self, other) | Return the numeral `other + self`.
>>> 3 + Numeral(2)
5
| Return the numeral `other + self`. | def __radd__(self, other):
""" Return the numeral `other + self`.
>>> 3 + Numeral(2)
5
"""
return Numeral(Z3_algebraic_add(self.ctx_ref(), self.ast, _to_numeral(other, self.ctx).ast), self.ctx) | [
"def",
"__radd__",
"(",
"self",
",",
"other",
")",
":",
"return",
"Numeral",
"(",
"Z3_algebraic_add",
"(",
"self",
".",
"ctx_ref",
"(",
")",
",",
"self",
".",
"ast",
",",
"_to_numeral",
"(",
"other",
",",
"self",
".",
"ctx",
")",
".",
"ast",
")",
"... | [
301,
4
] | [
307,
110
] | python | en | ['en', 'en', 'en'] | True |
Numeral.__sub__ | (self, other) | Return the numeral `self - other`.
>>> Numeral(2) - 3
-1
| Return the numeral `self - other`. | def __sub__(self, other):
""" Return the numeral `self - other`.
>>> Numeral(2) - 3
-1
"""
return Numeral(Z3_algebraic_sub(self.ctx_ref(), self.ast, _to_numeral(other, self.ctx).ast), self.ctx) | [
"def",
"__sub__",
"(",
"self",
",",
"other",
")",
":",
"return",
"Numeral",
"(",
"Z3_algebraic_sub",
"(",
"self",
".",
"ctx_ref",
"(",
")",
",",
"self",
".",
"ast",
",",
"_to_numeral",
"(",
"other",
",",
"self",
".",
"ctx",
")",
".",
"ast",
")",
",... | [
309,
4
] | [
315,
110
] | python | en | ['en', 'en', 'en'] | True |
Numeral.__rsub__ | (self, other) | Return the numeral `other - self`.
>>> 3 - Numeral(2)
1
| Return the numeral `other - self`. | def __rsub__(self, other):
""" Return the numeral `other - self`.
>>> 3 - Numeral(2)
1
"""
return Numeral(Z3_algebraic_sub(self.ctx_ref(), _to_numeral(other, self.ctx).ast, self.ast), self.ctx) | [
"def",
"__rsub__",
"(",
"self",
",",
"other",
")",
":",
"return",
"Numeral",
"(",
"Z3_algebraic_sub",
"(",
"self",
".",
"ctx_ref",
"(",
")",
",",
"_to_numeral",
"(",
"other",
",",
"self",
".",
"ctx",
")",
".",
"ast",
",",
"self",
".",
"ast",
")",
"... | [
317,
4
] | [
323,
110
] | python | en | ['en', 'en', 'en'] | True |
Numeral.__mul__ | (self, other) | Return the numeral `self * other`.
>>> Numeral(2) * 3
6
| Return the numeral `self * other`.
>>> Numeral(2) * 3
6
| def __mul__(self, other):
""" Return the numeral `self * other`.
>>> Numeral(2) * 3
6
"""
return Numeral(Z3_algebraic_mul(self.ctx_ref(), self.ast, _to_numeral(other, self.ctx).ast), self.ctx) | [
"def",
"__mul__",
"(",
"self",
",",
"other",
")",
":",
"return",
"Numeral",
"(",
"Z3_algebraic_mul",
"(",
"self",
".",
"ctx_ref",
"(",
")",
",",
"self",
".",
"ast",
",",
"_to_numeral",
"(",
"other",
",",
"self",
".",
"ctx",
")",
".",
"ast",
")",
",... | [
325,
4
] | [
330,
110
] | python | en | ['en', 'en', 'en'] | True |
Numeral.__rmul__ | (self, other) | Return the numeral `other * mul`.
>>> 3 * Numeral(2)
6
| Return the numeral `other * mul`.
>>> 3 * Numeral(2)
6
| def __rmul__(self, other):
""" Return the numeral `other * mul`.
>>> 3 * Numeral(2)
6
"""
return Numeral(Z3_algebraic_mul(self.ctx_ref(), self.ast, _to_numeral(other, self.ctx).ast), self.ctx) | [
"def",
"__rmul__",
"(",
"self",
",",
"other",
")",
":",
"return",
"Numeral",
"(",
"Z3_algebraic_mul",
"(",
"self",
".",
"ctx_ref",
"(",
")",
",",
"self",
".",
"ast",
",",
"_to_numeral",
"(",
"other",
",",
"self",
".",
"ctx",
")",
".",
"ast",
")",
"... | [
332,
4
] | [
337,
110
] | python | en | ['en', 'en', 'en'] | True |
Numeral.__div__ | (self, other) | Return the numeral `self / other`.
>>> Numeral(2) / 3
2/3
>>> Numeral(2).root(2) / 3
0.4714045207?
>>> Numeral(Sqrt(2)) / Numeral(Sqrt(3))
0.8164965809?
| Return the numeral `self / other`.
>>> Numeral(2) / 3
2/3
>>> Numeral(2).root(2) / 3
0.4714045207?
>>> Numeral(Sqrt(2)) / Numeral(Sqrt(3))
0.8164965809?
| def __div__(self, other):
""" Return the numeral `self / other`.
>>> Numeral(2) / 3
2/3
>>> Numeral(2).root(2) / 3
0.4714045207?
>>> Numeral(Sqrt(2)) / Numeral(Sqrt(3))
0.8164965809?
"""
return Numeral(Z3_algebraic_div(self.ctx_ref(), self.ast, _to... | [
"def",
"__div__",
"(",
"self",
",",
"other",
")",
":",
"return",
"Numeral",
"(",
"Z3_algebraic_div",
"(",
"self",
".",
"ctx_ref",
"(",
")",
",",
"self",
".",
"ast",
",",
"_to_numeral",
"(",
"other",
",",
"self",
".",
"ctx",
")",
".",
"ast",
")",
",... | [
339,
4
] | [
348,
110
] | python | en | ['en', 'en', 'en'] | True |
Numeral.__rdiv__ | (self, other) | Return the numeral `other / self`.
>>> 3 / Numeral(2)
3/2
>>> 3 / Numeral(2).root(2)
2.1213203435?
| Return the numeral `other / self`.
>>> 3 / Numeral(2)
3/2
>>> 3 / Numeral(2).root(2)
2.1213203435?
| def __rdiv__(self, other):
""" Return the numeral `other / self`.
>>> 3 / Numeral(2)
3/2
>>> 3 / Numeral(2).root(2)
2.1213203435?
"""
return Numeral(Z3_algebraic_div(self.ctx_ref(), _to_numeral(other, self.ctx).ast, self.ast), self.ctx) | [
"def",
"__rdiv__",
"(",
"self",
",",
"other",
")",
":",
"return",
"Numeral",
"(",
"Z3_algebraic_div",
"(",
"self",
".",
"ctx_ref",
"(",
")",
",",
"_to_numeral",
"(",
"other",
",",
"self",
".",
"ctx",
")",
".",
"ast",
",",
"self",
".",
"ast",
")",
"... | [
353,
4
] | [
360,
110
] | python | en | ['en', 'en', 'en'] | True |
Numeral.root | (self, k) | Return the numeral `self^(1/k)`.
>>> sqrt2 = Numeral(2).root(2)
>>> sqrt2
1.4142135623?
>>> sqrt2 * sqrt2
2
>>> sqrt2 * 2 + 1
3.8284271247?
>>> (sqrt2 * 2 + 1).sexpr()
'(root-obj (+ (^ x 2) (* (- 2) x) (- 7)) 2)'
| Return the numeral `self^(1/k)`. | def root(self, k):
""" Return the numeral `self^(1/k)`.
>>> sqrt2 = Numeral(2).root(2)
>>> sqrt2
1.4142135623?
>>> sqrt2 * sqrt2
2
>>> sqrt2 * 2 + 1
3.8284271247?
>>> (sqrt2 * 2 + 1).sexpr()
'(root-obj (+ (^ x 2) (* (- 2) x) (- 7)) 2)'
... | [
"def",
"root",
"(",
"self",
",",
"k",
")",
":",
"return",
"Numeral",
"(",
"Z3_algebraic_root",
"(",
"self",
".",
"ctx_ref",
"(",
")",
",",
"self",
".",
"ast",
",",
"k",
")",
",",
"self",
".",
"ctx",
")"
] | [
365,
4
] | [
378,
80
] | python | en | ['en', 'ig', 'en'] | True |
Numeral.power | (self, k) | Return the numeral `self^k`.
>>> sqrt3 = Numeral(3).root(2)
>>> sqrt3
1.7320508075?
>>> sqrt3.power(2)
3
| Return the numeral `self^k`. | def power(self, k):
""" Return the numeral `self^k`.
>>> sqrt3 = Numeral(3).root(2)
>>> sqrt3
1.7320508075?
>>> sqrt3.power(2)
3
"""
return Numeral(Z3_algebraic_power(self.ctx_ref(), self.ast, k), self.ctx) | [
"def",
"power",
"(",
"self",
",",
"k",
")",
":",
"return",
"Numeral",
"(",
"Z3_algebraic_power",
"(",
"self",
".",
"ctx_ref",
"(",
")",
",",
"self",
".",
"ast",
",",
"k",
")",
",",
"self",
".",
"ctx",
")"
] | [
380,
4
] | [
389,
81
] | python | en | ['en', 'ig', 'en'] | True |
Numeral.__pow__ | (self, k) | Return the numeral `self^k`.
>>> sqrt3 = Numeral(3).root(2)
>>> sqrt3
1.7320508075?
>>> sqrt3**2
3
| Return the numeral `self^k`. | def __pow__(self, k):
""" Return the numeral `self^k`.
>>> sqrt3 = Numeral(3).root(2)
>>> sqrt3
1.7320508075?
>>> sqrt3**2
3
"""
return self.power(k) | [
"def",
"__pow__",
"(",
"self",
",",
"k",
")",
":",
"return",
"self",
".",
"power",
"(",
"k",
")"
] | [
391,
4
] | [
400,
28
] | python | en | ['en', 'ig', 'en'] | True |
Numeral.__lt__ | (self, other) | Return True if `self < other`.
>>> Numeral(Sqrt(2)) < 2
True
>>> Numeral(Sqrt(3)) < Numeral(Sqrt(2))
False
>>> Numeral(Sqrt(2)) < Numeral(Sqrt(2))
False
| Return True if `self < other`. | def __lt__(self, other):
""" Return True if `self < other`.
>>> Numeral(Sqrt(2)) < 2
True
>>> Numeral(Sqrt(3)) < Numeral(Sqrt(2))
False
>>> Numeral(Sqrt(2)) < Numeral(Sqrt(2))
False
"""
return Z3_algebraic_lt(self.ctx_ref(), self.ast, _to_numeral(... | [
"def",
"__lt__",
"(",
"self",
",",
"other",
")",
":",
"return",
"Z3_algebraic_lt",
"(",
"self",
".",
"ctx_ref",
"(",
")",
",",
"self",
".",
"ast",
",",
"_to_numeral",
"(",
"other",
",",
"self",
".",
"ctx",
")",
".",
"ast",
")"
] | [
402,
4
] | [
412,
90
] | python | en | ['en', 'mt', 'en'] | True |
Numeral.__rlt__ | (self, other) | Return True if `other < self`.
>>> 2 < Numeral(Sqrt(2))
False
| Return True if `other < self`. | def __rlt__(self, other):
""" Return True if `other < self`.
>>> 2 < Numeral(Sqrt(2))
False
"""
return self > other | [
"def",
"__rlt__",
"(",
"self",
",",
"other",
")",
":",
"return",
"self",
">",
"other"
] | [
414,
4
] | [
420,
27
] | python | en | ['en', 'mt', 'en'] | True |
Numeral.__gt__ | (self, other) | Return True if `self > other`.
>>> Numeral(Sqrt(2)) > 2
False
>>> Numeral(Sqrt(3)) > Numeral(Sqrt(2))
True
>>> Numeral(Sqrt(2)) > Numeral(Sqrt(2))
False
| Return True if `self > other`. | def __gt__(self, other):
""" Return True if `self > other`.
>>> Numeral(Sqrt(2)) > 2
False
>>> Numeral(Sqrt(3)) > Numeral(Sqrt(2))
True
>>> Numeral(Sqrt(2)) > Numeral(Sqrt(2))
False
"""
return Z3_algebraic_gt(self.ctx_ref(), self.ast, _to_numeral(... | [
"def",
"__gt__",
"(",
"self",
",",
"other",
")",
":",
"return",
"Z3_algebraic_gt",
"(",
"self",
".",
"ctx_ref",
"(",
")",
",",
"self",
".",
"ast",
",",
"_to_numeral",
"(",
"other",
",",
"self",
".",
"ctx",
")",
".",
"ast",
")"
] | [
422,
4
] | [
432,
90
] | python | en | ['en', 'mt', 'en'] | True |
Numeral.__rgt__ | (self, other) | Return True if `other > self`.
>>> 2 > Numeral(Sqrt(2))
True
| Return True if `other > self`. | def __rgt__(self, other):
""" Return True if `other > self`.
>>> 2 > Numeral(Sqrt(2))
True
"""
return self < other | [
"def",
"__rgt__",
"(",
"self",
",",
"other",
")",
":",
"return",
"self",
"<",
"other"
] | [
434,
4
] | [
440,
27
] | python | en | ['en', 'mt', 'en'] | True |
Numeral.__le__ | (self, other) | Return True if `self <= other`.
>>> Numeral(Sqrt(2)) <= 2
True
>>> Numeral(Sqrt(3)) <= Numeral(Sqrt(2))
False
>>> Numeral(Sqrt(2)) <= Numeral(Sqrt(2))
True
| Return True if `self <= other`. | def __le__(self, other):
""" Return True if `self <= other`.
>>> Numeral(Sqrt(2)) <= 2
True
>>> Numeral(Sqrt(3)) <= Numeral(Sqrt(2))
False
>>> Numeral(Sqrt(2)) <= Numeral(Sqrt(2))
True
"""
return Z3_algebraic_le(self.ctx_ref(), self.ast, _to_numer... | [
"def",
"__le__",
"(",
"self",
",",
"other",
")",
":",
"return",
"Z3_algebraic_le",
"(",
"self",
".",
"ctx_ref",
"(",
")",
",",
"self",
".",
"ast",
",",
"_to_numeral",
"(",
"other",
",",
"self",
".",
"ctx",
")",
".",
"ast",
")"
] | [
443,
4
] | [
453,
90
] | python | en | ['en', 'mt', 'en'] | True |
Numeral.__rle__ | (self, other) | Return True if `other <= self`.
>>> 2 <= Numeral(Sqrt(2))
False
| Return True if `other <= self`. | def __rle__(self, other):
""" Return True if `other <= self`.
>>> 2 <= Numeral(Sqrt(2))
False
"""
return self >= other | [
"def",
"__rle__",
"(",
"self",
",",
"other",
")",
":",
"return",
"self",
">=",
"other"
] | [
455,
4
] | [
461,
28
] | python | en | ['en', 'mt', 'en'] | True |
Numeral.__ge__ | (self, other) | Return True if `self >= other`.
>>> Numeral(Sqrt(2)) >= 2
False
>>> Numeral(Sqrt(3)) >= Numeral(Sqrt(2))
True
>>> Numeral(Sqrt(2)) >= Numeral(Sqrt(2))
True
| Return True if `self >= other`. | def __ge__(self, other):
""" Return True if `self >= other`.
>>> Numeral(Sqrt(2)) >= 2
False
>>> Numeral(Sqrt(3)) >= Numeral(Sqrt(2))
True
>>> Numeral(Sqrt(2)) >= Numeral(Sqrt(2))
True
"""
return Z3_algebraic_ge(self.ctx_ref(), self.ast, _to_numer... | [
"def",
"__ge__",
"(",
"self",
",",
"other",
")",
":",
"return",
"Z3_algebraic_ge",
"(",
"self",
".",
"ctx_ref",
"(",
")",
",",
"self",
".",
"ast",
",",
"_to_numeral",
"(",
"other",
",",
"self",
".",
"ctx",
")",
".",
"ast",
")"
] | [
463,
4
] | [
473,
90
] | python | en | ['en', 'mt', 'en'] | True |
Numeral.__rge__ | (self, other) | Return True if `other >= self`.
>>> 2 >= Numeral(Sqrt(2))
True
| Return True if `other >= self`. | def __rge__(self, other):
""" Return True if `other >= self`.
>>> 2 >= Numeral(Sqrt(2))
True
"""
return self <= other | [
"def",
"__rge__",
"(",
"self",
",",
"other",
")",
":",
"return",
"self",
"<=",
"other"
] | [
475,
4
] | [
481,
28
] | python | en | ['en', 'mt', 'en'] | True |
Numeral.__eq__ | (self, other) | Return True if `self == other`.
>>> Numeral(Sqrt(2)) == 2
False
>>> Numeral(Sqrt(3)) == Numeral(Sqrt(2))
False
>>> Numeral(Sqrt(2)) == Numeral(Sqrt(2))
True
| Return True if `self == other`. | def __eq__(self, other):
""" Return True if `self == other`.
>>> Numeral(Sqrt(2)) == 2
False
>>> Numeral(Sqrt(3)) == Numeral(Sqrt(2))
False
>>> Numeral(Sqrt(2)) == Numeral(Sqrt(2))
True
"""
return Z3_algebraic_eq(self.ctx_ref(), self.ast, _to_nume... | [
"def",
"__eq__",
"(",
"self",
",",
"other",
")",
":",
"return",
"Z3_algebraic_eq",
"(",
"self",
".",
"ctx_ref",
"(",
")",
",",
"self",
".",
"ast",
",",
"_to_numeral",
"(",
"other",
",",
"self",
".",
"ctx",
")",
".",
"ast",
")"
] | [
483,
4
] | [
493,
90
] | python | en | ['en', 'mt', 'en'] | True |
Numeral.__ne__ | (self, other) | Return True if `self != other`.
>>> Numeral(Sqrt(2)) != 2
True
>>> Numeral(Sqrt(3)) != Numeral(Sqrt(2))
True
>>> Numeral(Sqrt(2)) != Numeral(Sqrt(2))
False
| Return True if `self != other`. | def __ne__(self, other):
""" Return True if `self != other`.
>>> Numeral(Sqrt(2)) != 2
True
>>> Numeral(Sqrt(3)) != Numeral(Sqrt(2))
True
>>> Numeral(Sqrt(2)) != Numeral(Sqrt(2))
False
"""
return Z3_algebraic_neq(self.ctx_ref(), self.ast, _to_nume... | [
"def",
"__ne__",
"(",
"self",
",",
"other",
")",
":",
"return",
"Z3_algebraic_neq",
"(",
"self",
".",
"ctx_ref",
"(",
")",
",",
"self",
".",
"ast",
",",
"_to_numeral",
"(",
"other",
",",
"self",
".",
"ctx",
")",
".",
"ast",
")"
] | [
495,
4
] | [
505,
91
] | python | en | ['en', 'mt', 'en'] | True |
regression | (self, local, clickhouse_binary_path, stress=None, parallel=None) | Map type regression.
| Map type regression.
| def regression(self, local, clickhouse_binary_path, stress=None, parallel=None):
"""Map type regression.
"""
top().terminating = False
nodes = {
"clickhouse":
("clickhouse1", "clickhouse2", "clickhouse3")
}
if stress is not None:
self.context.stress = stress
if p... | [
"def",
"regression",
"(",
"self",
",",
"local",
",",
"clickhouse_binary_path",
",",
"stress",
"=",
"None",
",",
"parallel",
"=",
"None",
")",
":",
"top",
"(",
")",
".",
"terminating",
"=",
"False",
"nodes",
"=",
"{",
"\"clickhouse\"",
":",
"(",
"\"clickh... | [
104,
0
] | [
122,
62
] | python | en | ['en', 'en', 'en'] | True |
_parse_trans_unit | (trans_unit) | Converts a trans-unit XML node into a more convenient dictionary format.
Args:
trans_unit: An XML representation of a .xlf translation unit.
Returns:
A dictionary with useful information about the translation unit.
The returned dictionary is guaranteed to have an entry for 'key' and
... | Converts a trans-unit XML node into a more convenient dictionary format. | def _parse_trans_unit(trans_unit):
"""Converts a trans-unit XML node into a more convenient dictionary format.
Args:
trans_unit: An XML representation of a .xlf translation unit.
Returns:
A dictionary with useful information about the translation unit.
The returned dictionary is gu... | [
"def",
"_parse_trans_unit",
"(",
"trans_unit",
")",
":",
"def",
"get_value",
"(",
"tag_name",
")",
":",
"elts",
"=",
"trans_unit",
".",
"getElementsByTagName",
"(",
"tag_name",
")",
"if",
"not",
"elts",
":",
"return",
"None",
"elif",
"len",
"(",
"elts",
")... | [
32,
0
] | [
79,
17
] | python | en | ['en', 'ca', 'en'] | True |
_process_file | (filename) | Builds list of translation units from input file.
Each translation unit in the input file includes:
- an id (opaquely generated by Soy)
- the Blockly name for the message
- the text in the source language (generally English)
- a description for the translator
The Soy and Blockly ids are joined... | Builds list of translation units from input file. | def _process_file(filename):
"""Builds list of translation units from input file.
Each translation unit in the input file includes:
- an id (opaquely generated by Soy)
- the Blockly name for the message
- the text in the source language (generally English)
- a description for the translator
... | [
"def",
"_process_file",
"(",
"filename",
")",
":",
"try",
":",
"results",
"=",
"[",
"]",
"# list of dictionaries (return value)",
"names",
"=",
"[",
"]",
"# list of names of encountered keys (local variable)",
"try",
":",
"parsed_xml",
"=",
"minidom",
".",
"parse",
... | [
82,
0
] | [
150,
19
] | python | en | ['en', 'en', 'en'] | True |
sort_units | (units, templates) | Sorts the translation units by their definition order in the template.
Args:
units: A list of dictionaries produced by parse_trans_unit()
that have a non-empty value for the key 'meaning'.
templates: A string containing the Soy templates in which each of
the units' meanings ... | Sorts the translation units by their definition order in the template. | def sort_units(units, templates):
"""Sorts the translation units by their definition order in the template.
Args:
units: A list of dictionaries produced by parse_trans_unit()
that have a non-empty value for the key 'meaning'.
templates: A string containing the Soy templates in which... | [
"def",
"sort_units",
"(",
"units",
",",
"templates",
")",
":",
"def",
"key_function",
"(",
"unit",
")",
":",
"match",
"=",
"re",
".",
"search",
"(",
"'\\\\smeaning\\\\s*=\\\\s*\"{0}\"\\\\s'",
".",
"format",
"(",
"unit",
"[",
"'meaning'",
"]",
")",
",",
"te... | [
153,
0
] | [
180,
42
] | python | en | ['en', 'en', 'en'] | True |
main | () | Parses arguments and processes the specified file.
Raises:
IOError: An I/O error occurred with an input or output file.
InputError: Input files lacked required fields.
| Parses arguments and processes the specified file. | def main():
"""Parses arguments and processes the specified file.
Raises:
IOError: An I/O error occurred with an input or output file.
InputError: Input files lacked required fields.
"""
# Set up argument parser.
parser = argparse.ArgumentParser(description='Create translation files... | [
"def",
"main",
"(",
")",
":",
"# Set up argument parser.",
"parser",
"=",
"argparse",
".",
"ArgumentParser",
"(",
"description",
"=",
"'Create translation files.'",
")",
"parser",
".",
"add_argument",
"(",
"'--author'",
",",
"default",
"=",
"'Ellen Spertus <ellen.sper... | [
183,
0
] | [
227,
32
] | python | en | ['en', 'en', 'en'] | True |
plotting_style | (context='paper', for_package='matplotlib', figsize='full') | Get dictionary of formatting options for figure creation
inspired by seaborn's plotting_context and axes_style (and using several of
the values from there as a starting point), this is to make sure our
figures are consistently-styled.
if `for_package='matplotlib'`, this will be a dictionary to pass to... | Get dictionary of formatting options for figure creation | def plotting_style(context='paper', for_package='matplotlib', figsize='full'):
"""Get dictionary of formatting options for figure creation
inspired by seaborn's plotting_context and axes_style (and using several of
the values from there as a starting point), this is to make sure our
figures are consist... | [
"def",
"plotting_style",
"(",
"context",
"=",
"'paper'",
",",
"for_package",
"=",
"'matplotlib'",
",",
"figsize",
"=",
"'full'",
")",
":",
"if",
"for_package",
"==",
"'matplotlib'",
":",
"params",
"=",
"{",
"'figure.facecolor'",
":",
"'white'",
",",
"'axes.lab... | [
5,
0
] | [
126,
31
] | python | en | ['en', 'en', 'en'] | True |
chunk | (seq, n) |
divide a sequence into equal sized chunks
(the last chunk may be smaller, but won't be empty)
|
divide a sequence into equal sized chunks
(the last chunk may be smaller, but won't be empty)
| def chunk(seq, n):
"""
divide a sequence into equal sized chunks
(the last chunk may be smaller, but won't be empty)
"""
chunks = []
some = []
for element in seq:
if len(some) == n:
chunks.append(some)
some = []
some.append(element)
if len(some) > ... | [
"def",
"chunk",
"(",
"seq",
",",
"n",
")",
":",
"chunks",
"=",
"[",
"]",
"some",
"=",
"[",
"]",
"for",
"element",
"in",
"seq",
":",
"if",
"len",
"(",
"some",
")",
"==",
"n",
":",
"chunks",
".",
"append",
"(",
"some",
")",
"some",
"=",
"[",
... | [
23,
0
] | [
37,
17
] | python | en | ['en', 'error', 'th'] | False |
dechunk | (chunks) | flatten chunks into a single list | flatten chunks into a single list | def dechunk(chunks):
"flatten chunks into a single list"
seq = []
for chunk in chunks:
seq.extend(chunk)
return seq | [
"def",
"dechunk",
"(",
"chunks",
")",
":",
"seq",
"=",
"[",
"]",
"for",
"chunk",
"in",
"chunks",
":",
"seq",
".",
"extend",
"(",
"chunk",
")",
"return",
"seq"
] | [
40,
0
] | [
45,
14
] | python | en | ['en', 'lb', 'en'] | True |
run_parallel | (cmds, **kwargs) |
Run each of cmds (with shared **kwargs) using subprocess.Popen
then wait for all of them to complete.
Runs batches of multiprocessing.cpu_count() * 2 from cmds
returns a list of tuples containing each process'
returncode, stdout, stderr
|
Run each of cmds (with shared **kwargs) using subprocess.Popen
then wait for all of them to complete.
Runs batches of multiprocessing.cpu_count() * 2 from cmds
returns a list of tuples containing each process'
returncode, stdout, stderr
| def run_parallel(cmds, **kwargs):
"""
Run each of cmds (with shared **kwargs) using subprocess.Popen
then wait for all of them to complete.
Runs batches of multiprocessing.cpu_count() * 2 from cmds
returns a list of tuples containing each process'
returncode, stdout, stderr
"""
complete ... | [
"def",
"run_parallel",
"(",
"cmds",
",",
"*",
"*",
"kwargs",
")",
":",
"complete",
"=",
"[",
"]",
"for",
"cmds_batch",
"in",
"chunk",
"(",
"cmds",
",",
"mp",
".",
"cpu_count",
"(",
")",
"*",
"2",
")",
":",
"procs_batch",
"=",
"[",
"Popen",
"(",
"... | [
48,
0
] | [
62,
19
] | python | en | ['en', 'error', 'th'] | False |
stdout_pathcolonline | (completed_process, filenames) |
given a completed process which may have reported some files as problematic
by printing the path name followed by ':' then a line number, examine
stdout and return the set of actually reported file names
|
given a completed process which may have reported some files as problematic
by printing the path name followed by ':' then a line number, examine
stdout and return the set of actually reported file names
| def stdout_pathcolonline(completed_process, filenames):
"""
given a completed process which may have reported some files as problematic
by printing the path name followed by ':' then a line number, examine
stdout and return the set of actually reported file names
"""
returncode, stdout, stderr =... | [
"def",
"stdout_pathcolonline",
"(",
"completed_process",
",",
"filenames",
")",
":",
"returncode",
",",
"stdout",
",",
"stderr",
"=",
"completed_process",
"bfilenames",
"=",
"set",
"(",
")",
"for",
"filename",
"in",
"filenames",
":",
"bfilenames",
".",
"add",
... | [
91,
0
] | [
108,
32
] | python | en | ['en', 'error', 'th'] | False |
privilege_granted_directly_or_via_role | (self, table_type, privilege, node=None) | Check that user is only able to execute ALTER FETCH PARTITION when they have required privilege, either directly or via role.
| Check that user is only able to execute ALTER FETCH PARTITION when they have required privilege, either directly or via role.
| def privilege_granted_directly_or_via_role(self, table_type, privilege, node=None):
"""Check that user is only able to execute ALTER FETCH PARTITION when they have required privilege, either directly or via role.
"""
role_name = f"role_{getuid()}"
user_name = f"user_{getuid()}"
if node is None:
... | [
"def",
"privilege_granted_directly_or_via_role",
"(",
"self",
",",
"table_type",
",",
"privilege",
",",
"node",
"=",
"None",
")",
":",
"role_name",
"=",
"f\"role_{getuid()}\"",
"user_name",
"=",
"f\"user_{getuid()}\"",
"if",
"node",
"is",
"None",
":",
"node",
"=",... | [
10,
0
] | [
32,
136
] | python | en | ['en', 'en', 'en'] | True |
privilege_check | (grant_target_name, user_name, table_type, privilege, node=None) | Run scenarios to check the user's access with different privileges.
| Run scenarios to check the user's access with different privileges.
| def privilege_check(grant_target_name, user_name, table_type, privilege, node=None):
"""Run scenarios to check the user's access with different privileges.
"""
exitcode, message = errors.not_enough_privileges(name=f"{user_name}")
with Scenario("user without privilege", setup=instrument_clickhouse_serve... | [
"def",
"privilege_check",
"(",
"grant_target_name",
",",
"user_name",
",",
"table_type",
",",
"privilege",
",",
"node",
"=",
"None",
")",
":",
"exitcode",
",",
"message",
"=",
"errors",
".",
"not_enough_privileges",
"(",
"name",
"=",
"f\"{user_name}\"",
")",
"... | [
34,
0
] | [
77,
55
] | python | en | ['en', 'en', 'en'] | True |
feature | (self, node="clickhouse1", stress=None, parallel=None) | Check the RBAC functionality of ALTER FETCH.
| Check the RBAC functionality of ALTER FETCH.
| def feature(self, node="clickhouse1", stress=None, parallel=None):
"""Check the RBAC functionality of ALTER FETCH.
"""
self.context.node = self.context.cluster.node(node)
if parallel is not None:
self.context.parallel = parallel
if stress is not None:
self.context.stress = stress
... | [
"def",
"feature",
"(",
"self",
",",
"node",
"=",
"\"clickhouse1\"",
",",
"stress",
"=",
"None",
",",
"parallel",
"=",
"None",
")",
":",
"self",
".",
"context",
".",
"node",
"=",
"self",
".",
"context",
".",
"cluster",
".",
"node",
"(",
"node",
")",
... | [
102,
0
] | [
121,
98
] | python | en | ['en', 'en', 'en'] | True |
null | () | Create a NULL/NA scalar | Create a NULL/NA scalar | def null():
"""Create a NULL/NA scalar"""
import ibis.expr.operations as ops
global _NULL
if _NULL is None:
_NULL = ops.NullLiteral().to_expr()
return _NULL | [
"def",
"null",
"(",
")",
":",
"import",
"ibis",
".",
"expr",
".",
"operations",
"as",
"ops",
"global",
"_NULL",
"if",
"_NULL",
"is",
"None",
":",
"_NULL",
"=",
"ops",
".",
"NullLiteral",
"(",
")",
".",
"to_expr",
"(",
")",
"return",
"_NULL"
] | [
784,
0
] | [
792,
16
] | python | en | ['en', 'ga', 'en'] | True |
literal | (value, type=None) | Create a scalar expression from a Python value.
Parameters
----------
value : some Python basic type
A Python value
type : ibis type or string, optional
An instance of :class:`ibis.expr.datatypes.DataType` or a string
indicating the ibis type of `value`. This parameter should on... | Create a scalar expression from a Python value. | def literal(value, type=None):
"""Create a scalar expression from a Python value.
Parameters
----------
value : some Python basic type
A Python value
type : ibis type or string, optional
An instance of :class:`ibis.expr.datatypes.DataType` or a string
indicating the ibis typ... | [
"def",
"literal",
"(",
"value",
",",
"type",
"=",
"None",
")",
":",
"import",
"ibis",
".",
"expr",
".",
"datatypes",
"as",
"dt",
"import",
"ibis",
".",
"expr",
".",
"operations",
"as",
"ops",
"if",
"hasattr",
"(",
"value",
",",
"'op'",
")",
"and",
... | [
795,
0
] | [
849,
56
] | python | en | ['en', 'en', 'en'] | True |
sequence | (values) |
Wrap a list of Python values as an Ibis sequence type
Parameters
----------
values : list
Should all be None or the same type
Returns
-------
seq : Sequence
|
Wrap a list of Python values as an Ibis sequence type | def sequence(values):
"""
Wrap a list of Python values as an Ibis sequence type
Parameters
----------
values : list
Should all be None or the same type
Returns
-------
seq : Sequence
"""
import ibis.expr.operations as ops
return ops.ValueList(values).to_expr() | [
"def",
"sequence",
"(",
"values",
")",
":",
"import",
"ibis",
".",
"expr",
".",
"operations",
"as",
"ops",
"return",
"ops",
".",
"ValueList",
"(",
"values",
")",
".",
"to_expr",
"(",
")"
] | [
852,
0
] | [
867,
42
] | python | en | ['en', 'error', 'th'] | False |
param | (type) | Create a parameter of a particular type to be defined just before
execution.
Parameters
----------
type : dt.DataType
The type of the unbound parameter, e.g., double, int64, date, etc.
Returns
-------
ScalarExpr
Examples
--------
>>> import ibis
>>> import ibis.exp... | Create a parameter of a particular type to be defined just before
execution. | def param(type):
"""Create a parameter of a particular type to be defined just before
execution.
Parameters
----------
type : dt.DataType
The type of the unbound parameter, e.g., double, int64, date, etc.
Returns
-------
ScalarExpr
Examples
--------
>>> import ibis... | [
"def",
"param",
"(",
"type",
")",
":",
"import",
"ibis",
".",
"expr",
".",
"datatypes",
"as",
"dt",
"import",
"ibis",
".",
"expr",
".",
"operations",
"as",
"ops",
"return",
"ops",
".",
"ScalarParameter",
"(",
"dt",
".",
"dtype",
"(",
"type",
")",
")"... | [
883,
0
] | [
909,
56
] | python | en | ['en', 'en', 'en'] | True |
Expr.visualize | (self, format='svg') | Visualize an expression in the browser as an SVG image.
Parameters
----------
format : str, optional
Defaults to ``'svg'``. Some additional formats are
``'jpeg'`` and ``'png'``. These are specified by the ``graphviz``
Python library.
Notes
--... | Visualize an expression in the browser as an SVG image. | def visualize(self, format='svg'):
"""Visualize an expression in the browser as an SVG image.
Parameters
----------
format : str, optional
Defaults to ``'svg'``. Some additional formats are
``'jpeg'`` and ``'png'``. These are specified by the ``graphviz``
... | [
"def",
"visualize",
"(",
"self",
",",
"format",
"=",
"'svg'",
")",
":",
"import",
"ibis",
".",
"expr",
".",
"visualize",
"as",
"viz",
"path",
"=",
"viz",
".",
"draw",
"(",
"viz",
".",
"to_graph",
"(",
"self",
")",
",",
"format",
"=",
"format",
")",... | [
64,
4
] | [
86,
66
] | python | en | ['en', 'en', 'en'] | True |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.