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
YearMixin._get_current_year
(self, date)
Return the start date of the current interval.
Return the start date of the current interval.
def _get_current_year(self, date): """ Return the start date of the current interval. """ return date.replace(month=1, day=1)
[ "def", "_get_current_year", "(", "self", ",", "date", ")", ":", "return", "date", ".", "replace", "(", "month", "=", "1", ",", "day", "=", "1", ")" ]
[ 65, 4 ]
[ 69, 43 ]
python
en
['en', 'error', 'th']
False
MonthMixin.get_month_format
(self)
Get a month format string in strptime syntax to be used to parse the month from url variables.
Get a month format string in strptime syntax to be used to parse the month from url variables.
def get_month_format(self): """ Get a month format string in strptime syntax to be used to parse the month from url variables. """ return self.month_format
[ "def", "get_month_format", "(", "self", ")", ":", "return", "self", ".", "month_format" ]
[ 79, 4 ]
[ 84, 32 ]
python
en
['en', 'error', 'th']
False
MonthMixin.get_month
(self)
Return the month for which this view should display data.
Return the month for which this view should display data.
def get_month(self): """ Return the month for which this view should display data. """ month = self.month if month is None: try: month = self.kwargs['month'] except KeyError: try: month = self.request.GET...
[ "def", "get_month", "(", "self", ")", ":", "month", "=", "self", ".", "month", "if", "month", "is", "None", ":", "try", ":", "month", "=", "self", ".", "kwargs", "[", "'month'", "]", "except", "KeyError", ":", "try", ":", "month", "=", "self", ".",...
[ 86, 4 ]
[ 99, 20 ]
python
en
['en', 'error', 'th']
False
MonthMixin.get_next_month
(self, date)
Get the next valid month.
Get the next valid month.
def get_next_month(self, date): """ Get the next valid month. """ return _get_next_prev(self, date, is_previous=False, period='month')
[ "def", "get_next_month", "(", "self", ",", "date", ")", ":", "return", "_get_next_prev", "(", "self", ",", "date", ",", "is_previous", "=", "False", ",", "period", "=", "'month'", ")" ]
[ 101, 4 ]
[ 105, 76 ]
python
en
['en', 'error', 'th']
False
MonthMixin.get_previous_month
(self, date)
Get the previous valid month.
Get the previous valid month.
def get_previous_month(self, date): """ Get the previous valid month. """ return _get_next_prev(self, date, is_previous=True, period='month')
[ "def", "get_previous_month", "(", "self", ",", "date", ")", ":", "return", "_get_next_prev", "(", "self", ",", "date", ",", "is_previous", "=", "True", ",", "period", "=", "'month'", ")" ]
[ 107, 4 ]
[ 111, 75 ]
python
en
['en', 'error', 'th']
False
MonthMixin._get_next_month
(self, date)
Return the start date of the next interval. The interval is defined by start date <= item date < next start date.
Return the start date of the next interval.
def _get_next_month(self, date): """ Return the start date of the next interval. The interval is defined by start date <= item date < next start date. """ if date.month == 12: return date.replace(year=date.year + 1, month=1, day=1) else: return da...
[ "def", "_get_next_month", "(", "self", ",", "date", ")", ":", "if", "date", ".", "month", "==", "12", ":", "return", "date", ".", "replace", "(", "year", "=", "date", ".", "year", "+", "1", ",", "month", "=", "1", ",", "day", "=", "1", ")", "el...
[ 113, 4 ]
[ 122, 60 ]
python
en
['en', 'error', 'th']
False
MonthMixin._get_current_month
(self, date)
Return the start date of the previous interval.
Return the start date of the previous interval.
def _get_current_month(self, date): """ Return the start date of the previous interval. """ return date.replace(day=1)
[ "def", "_get_current_month", "(", "self", ",", "date", ")", ":", "return", "date", ".", "replace", "(", "day", "=", "1", ")" ]
[ 124, 4 ]
[ 128, 34 ]
python
en
['en', 'error', 'th']
False
DayMixin.get_day_format
(self)
Get a day format string in strptime syntax to be used to parse the day from url variables.
Get a day format string in strptime syntax to be used to parse the day from url variables.
def get_day_format(self): """ Get a day format string in strptime syntax to be used to parse the day from url variables. """ return self.day_format
[ "def", "get_day_format", "(", "self", ")", ":", "return", "self", ".", "day_format" ]
[ 138, 4 ]
[ 143, 30 ]
python
en
['en', 'error', 'th']
False
DayMixin.get_day
(self)
Return the day for which this view should display data.
Return the day for which this view should display data.
def get_day(self): """ Return the day for which this view should display data. """ day = self.day if day is None: try: day = self.kwargs['day'] except KeyError: try: day = self.request.GET['day'] ...
[ "def", "get_day", "(", "self", ")", ":", "day", "=", "self", ".", "day", "if", "day", "is", "None", ":", "try", ":", "day", "=", "self", ".", "kwargs", "[", "'day'", "]", "except", "KeyError", ":", "try", ":", "day", "=", "self", ".", "request", ...
[ 145, 4 ]
[ 158, 18 ]
python
en
['en', 'error', 'th']
False
DayMixin.get_next_day
(self, date)
Get the next valid day.
Get the next valid day.
def get_next_day(self, date): """ Get the next valid day. """ return _get_next_prev(self, date, is_previous=False, period='day')
[ "def", "get_next_day", "(", "self", ",", "date", ")", ":", "return", "_get_next_prev", "(", "self", ",", "date", ",", "is_previous", "=", "False", ",", "period", "=", "'day'", ")" ]
[ 160, 4 ]
[ 164, 74 ]
python
en
['en', 'error', 'th']
False
DayMixin.get_previous_day
(self, date)
Get the previous valid day.
Get the previous valid day.
def get_previous_day(self, date): """ Get the previous valid day. """ return _get_next_prev(self, date, is_previous=True, period='day')
[ "def", "get_previous_day", "(", "self", ",", "date", ")", ":", "return", "_get_next_prev", "(", "self", ",", "date", ",", "is_previous", "=", "True", ",", "period", "=", "'day'", ")" ]
[ 166, 4 ]
[ 170, 73 ]
python
en
['en', 'error', 'th']
False
DayMixin._get_next_day
(self, date)
Return the start date of the next interval. The interval is defined by start date <= item date < next start date.
Return the start date of the next interval.
def _get_next_day(self, date): """ Return the start date of the next interval. The interval is defined by start date <= item date < next start date. """ return date + datetime.timedelta(days=1)
[ "def", "_get_next_day", "(", "self", ",", "date", ")", ":", "return", "date", "+", "datetime", ".", "timedelta", "(", "days", "=", "1", ")" ]
[ 172, 4 ]
[ 178, 48 ]
python
en
['en', 'error', 'th']
False
DayMixin._get_current_day
(self, date)
Return the start date of the current interval.
Return the start date of the current interval.
def _get_current_day(self, date): """ Return the start date of the current interval. """ return date
[ "def", "_get_current_day", "(", "self", ",", "date", ")", ":", "return", "date" ]
[ 180, 4 ]
[ 184, 19 ]
python
en
['en', 'error', 'th']
False
WeekMixin.get_week_format
(self)
Get a week format string in strptime syntax to be used to parse the week from url variables.
Get a week format string in strptime syntax to be used to parse the week from url variables.
def get_week_format(self): """ Get a week format string in strptime syntax to be used to parse the week from url variables. """ return self.week_format
[ "def", "get_week_format", "(", "self", ")", ":", "return", "self", ".", "week_format" ]
[ 194, 4 ]
[ 199, 31 ]
python
en
['en', 'error', 'th']
False
WeekMixin.get_week
(self)
Return the week for which this view should display data
Return the week for which this view should display data
def get_week(self): """ Return the week for which this view should display data """ week = self.week if week is None: try: week = self.kwargs['week'] except KeyError: try: week = self.request.GET['week'] ...
[ "def", "get_week", "(", "self", ")", ":", "week", "=", "self", ".", "week", "if", "week", "is", "None", ":", "try", ":", "week", "=", "self", ".", "kwargs", "[", "'week'", "]", "except", "KeyError", ":", "try", ":", "week", "=", "self", ".", "req...
[ 201, 4 ]
[ 214, 19 ]
python
en
['en', 'error', 'th']
False
WeekMixin.get_next_week
(self, date)
Get the next valid week.
Get the next valid week.
def get_next_week(self, date): """ Get the next valid week. """ return _get_next_prev(self, date, is_previous=False, period='week')
[ "def", "get_next_week", "(", "self", ",", "date", ")", ":", "return", "_get_next_prev", "(", "self", ",", "date", ",", "is_previous", "=", "False", ",", "period", "=", "'week'", ")" ]
[ 216, 4 ]
[ 220, 75 ]
python
en
['en', 'error', 'th']
False
WeekMixin.get_previous_week
(self, date)
Get the previous valid week.
Get the previous valid week.
def get_previous_week(self, date): """ Get the previous valid week. """ return _get_next_prev(self, date, is_previous=True, period='week')
[ "def", "get_previous_week", "(", "self", ",", "date", ")", ":", "return", "_get_next_prev", "(", "self", ",", "date", ",", "is_previous", "=", "True", ",", "period", "=", "'week'", ")" ]
[ 222, 4 ]
[ 226, 74 ]
python
en
['en', 'error', 'th']
False
WeekMixin._get_next_week
(self, date)
Return the start date of the next interval. The interval is defined by start date <= item date < next start date.
Return the start date of the next interval.
def _get_next_week(self, date): """ Return the start date of the next interval. The interval is defined by start date <= item date < next start date. """ return date + datetime.timedelta(days=7 - self._get_weekday(date))
[ "def", "_get_next_week", "(", "self", ",", "date", ")", ":", "return", "date", "+", "datetime", ".", "timedelta", "(", "days", "=", "7", "-", "self", ".", "_get_weekday", "(", "date", ")", ")" ]
[ 228, 4 ]
[ 234, 74 ]
python
en
['en', 'error', 'th']
False
WeekMixin._get_current_week
(self, date)
Return the start date of the current interval.
Return the start date of the current interval.
def _get_current_week(self, date): """ Return the start date of the current interval. """ return date - datetime.timedelta(self._get_weekday(date))
[ "def", "_get_current_week", "(", "self", ",", "date", ")", ":", "return", "date", "-", "datetime", ".", "timedelta", "(", "self", ".", "_get_weekday", "(", "date", ")", ")" ]
[ 236, 4 ]
[ 240, 65 ]
python
en
['en', 'error', 'th']
False
WeekMixin._get_weekday
(self, date)
Return the weekday for a given date. The first day according to the week format is 0 and the last day is 6.
Return the weekday for a given date.
def _get_weekday(self, date): """ Return the weekday for a given date. The first day according to the week format is 0 and the last day is 6. """ week_format = self.get_week_format() if week_format == '%W': # week starts on Monday return date....
[ "def", "_get_weekday", "(", "self", ",", "date", ")", ":", "week_format", "=", "self", ".", "get_week_format", "(", ")", "if", "week_format", "==", "'%W'", ":", "# week starts on Monday", "return", "date", ".", "weekday", "(", ")", "elif", "week_format", "==...
[ 242, 4 ]
[ 254, 69 ]
python
en
['en', 'error', 'th']
False
DateMixin.get_date_field
(self)
Get the name of the date field to be used to filter by.
Get the name of the date field to be used to filter by.
def get_date_field(self): """ Get the name of the date field to be used to filter by. """ if self.date_field is None: raise ImproperlyConfigured("%s.date_field is required." % self.__class__.__name__) return self.date_field
[ "def", "get_date_field", "(", "self", ")", ":", "if", "self", ".", "date_field", "is", "None", ":", "raise", "ImproperlyConfigured", "(", "\"%s.date_field is required.\"", "%", "self", ".", "__class__", ".", "__name__", ")", "return", "self", ".", "date_field" ]
[ 264, 4 ]
[ 270, 30 ]
python
en
['en', 'error', 'th']
False
DateMixin.get_allow_future
(self)
Returns `True` if the view should be allowed to display objects from the future.
Returns `True` if the view should be allowed to display objects from the future.
def get_allow_future(self): """ Returns `True` if the view should be allowed to display objects from the future. """ return self.allow_future
[ "def", "get_allow_future", "(", "self", ")", ":", "return", "self", ".", "allow_future" ]
[ 272, 4 ]
[ 277, 32 ]
python
en
['en', 'error', 'th']
False
DateMixin.uses_datetime_field
(self)
Return `True` if the date field is a `DateTimeField` and `False` if it's a `DateField`.
Return `True` if the date field is a `DateTimeField` and `False` if it's a `DateField`.
def uses_datetime_field(self): """ Return `True` if the date field is a `DateTimeField` and `False` if it's a `DateField`. """ model = self.get_queryset().model if self.model is None else self.model field = model._meta.get_field(self.get_date_field()) return isins...
[ "def", "uses_datetime_field", "(", "self", ")", ":", "model", "=", "self", ".", "get_queryset", "(", ")", ".", "model", "if", "self", ".", "model", "is", "None", "else", "self", ".", "model", "field", "=", "model", ".", "_meta", ".", "get_field", "(", ...
[ 283, 4 ]
[ 290, 54 ]
python
en
['en', 'error', 'th']
False
DateMixin._make_date_lookup_arg
(self, value)
Convert a date into a datetime when the date field is a DateTimeField. When time zone support is enabled, `date` is assumed to be in the current time zone, so that displayed items are consistent with the URL.
Convert a date into a datetime when the date field is a DateTimeField.
def _make_date_lookup_arg(self, value): """ Convert a date into a datetime when the date field is a DateTimeField. When time zone support is enabled, `date` is assumed to be in the current time zone, so that displayed items are consistent with the URL. """ if self.uses_d...
[ "def", "_make_date_lookup_arg", "(", "self", ",", "value", ")", ":", "if", "self", ".", "uses_datetime_field", ":", "value", "=", "datetime", ".", "datetime", ".", "combine", "(", "value", ",", "datetime", ".", "time", ".", "min", ")", "if", "settings", ...
[ 292, 4 ]
[ 303, 20 ]
python
en
['en', 'error', 'th']
False
DateMixin._make_single_date_lookup
(self, date)
Get the lookup kwargs for filtering on a single date. If the date field is a DateTimeField, we can't just filter on date_field=date because that doesn't take the time into account.
Get the lookup kwargs for filtering on a single date.
def _make_single_date_lookup(self, date): """ Get the lookup kwargs for filtering on a single date. If the date field is a DateTimeField, we can't just filter on date_field=date because that doesn't take the time into account. """ date_field = self.get_date_field() ...
[ "def", "_make_single_date_lookup", "(", "self", ",", "date", ")", ":", "date_field", "=", "self", ".", "get_date_field", "(", ")", "if", "self", ".", "uses_datetime_field", ":", "since", "=", "self", ".", "_make_date_lookup_arg", "(", "date", ")", "until", "...
[ 305, 4 ]
[ 322, 37 ]
python
en
['en', 'error', 'th']
False
BaseDateListView.get_dated_items
(self)
Obtain the list of dates and items.
Obtain the list of dates and items.
def get_dated_items(self): """ Obtain the list of dates and items. """ raise NotImplementedError('A DateView must provide an implementation of get_dated_items()')
[ "def", "get_dated_items", "(", "self", ")", ":", "raise", "NotImplementedError", "(", "'A DateView must provide an implementation of get_dated_items()'", ")" ]
[ 339, 4 ]
[ 343, 99 ]
python
en
['en', 'error', 'th']
False
BaseDateListView.get_ordering
(self)
Returns the field or fields to use for ordering the queryset; uses the date field by default.
Returns the field or fields to use for ordering the queryset; uses the date field by default.
def get_ordering(self): """ Returns the field or fields to use for ordering the queryset; uses the date field by default. """ return '-%s' % self.get_date_field() if self.ordering is None else self.ordering
[ "def", "get_ordering", "(", "self", ")", ":", "return", "'-%s'", "%", "self", ".", "get_date_field", "(", ")", "if", "self", ".", "ordering", "is", "None", "else", "self", ".", "ordering" ]
[ 345, 4 ]
[ 350, 88 ]
python
en
['en', 'error', 'th']
False
BaseDateListView.get_dated_queryset
(self, **lookup)
Get a queryset properly filtered according to `allow_future` and any extra lookup kwargs.
Get a queryset properly filtered according to `allow_future` and any extra lookup kwargs.
def get_dated_queryset(self, **lookup): """ Get a queryset properly filtered according to `allow_future` and any extra lookup kwargs. """ qs = self.get_queryset().filter(**lookup) date_field = self.get_date_field() allow_future = self.get_allow_future() al...
[ "def", "get_dated_queryset", "(", "self", ",", "*", "*", "lookup", ")", ":", "qs", "=", "self", ".", "get_queryset", "(", ")", ".", "filter", "(", "*", "*", "lookup", ")", "date_field", "=", "self", ".", "get_date_field", "(", ")", "allow_future", "=",...
[ 352, 4 ]
[ 376, 17 ]
python
en
['en', 'error', 'th']
False
BaseDateListView.get_date_list_period
(self)
Get the aggregation period for the list of dates: 'year', 'month', or 'day'.
Get the aggregation period for the list of dates: 'year', 'month', or 'day'.
def get_date_list_period(self): """ Get the aggregation period for the list of dates: 'year', 'month', or 'day'. """ return self.date_list_period
[ "def", "get_date_list_period", "(", "self", ")", ":", "return", "self", ".", "date_list_period" ]
[ 378, 4 ]
[ 382, 36 ]
python
en
['en', 'error', 'th']
False
BaseDateListView.get_date_list
(self, queryset, date_type=None, ordering='ASC')
Get a date list by calling `queryset.dates/datetimes()`, checking along the way for empty lists that aren't allowed.
Get a date list by calling `queryset.dates/datetimes()`, checking along the way for empty lists that aren't allowed.
def get_date_list(self, queryset, date_type=None, ordering='ASC'): """ Get a date list by calling `queryset.dates/datetimes()`, checking along the way for empty lists that aren't allowed. """ date_field = self.get_date_field() allow_empty = self.get_allow_empty() ...
[ "def", "get_date_list", "(", "self", ",", "queryset", ",", "date_type", "=", "None", ",", "ordering", "=", "'ASC'", ")", ":", "date_field", "=", "self", ".", "get_date_field", "(", ")", "allow_empty", "=", "self", ".", "get_allow_empty", "(", ")", "if", ...
[ 384, 4 ]
[ 403, 24 ]
python
en
['en', 'error', 'th']
False
BaseArchiveIndexView.get_dated_items
(self)
Return (date_list, items, extra_context) for this request.
Return (date_list, items, extra_context) for this request.
def get_dated_items(self): """ Return (date_list, items, extra_context) for this request. """ qs = self.get_dated_queryset() date_list = self.get_date_list(qs, ordering='DESC') if not date_list: qs = qs.none() return (date_list, qs, {})
[ "def", "get_dated_items", "(", "self", ")", ":", "qs", "=", "self", ".", "get_dated_queryset", "(", ")", "date_list", "=", "self", ".", "get_date_list", "(", "qs", ",", "ordering", "=", "'DESC'", ")", "if", "not", "date_list", ":", "qs", "=", "qs", "."...
[ 414, 4 ]
[ 424, 34 ]
python
en
['en', 'error', 'th']
False
BaseYearArchiveView.get_dated_items
(self)
Return (date_list, items, extra_context) for this request.
Return (date_list, items, extra_context) for this request.
def get_dated_items(self): """ Return (date_list, items, extra_context) for this request. """ year = self.get_year() date_field = self.get_date_field() date = _date_from_string(year, self.get_year_format()) since = self._make_date_lookup_arg(date) until ...
[ "def", "get_dated_items", "(", "self", ")", ":", "year", "=", "self", ".", "get_year", "(", ")", "date_field", "=", "self", ".", "get_date_field", "(", ")", "date", "=", "_date_from_string", "(", "year", ",", "self", ".", "get_year_format", "(", ")", ")"...
[ 441, 4 ]
[ 469, 10 ]
python
en
['en', 'error', 'th']
False
BaseYearArchiveView.get_make_object_list
(self)
Return `True` if this view should contain the full list of objects in the given year.
Return `True` if this view should contain the full list of objects in the given year.
def get_make_object_list(self): """ Return `True` if this view should contain the full list of objects in the given year. """ return self.make_object_list
[ "def", "get_make_object_list", "(", "self", ")", ":", "return", "self", ".", "make_object_list" ]
[ 471, 4 ]
[ 476, 36 ]
python
en
['en', 'error', 'th']
False
BaseMonthArchiveView.get_dated_items
(self)
Return (date_list, items, extra_context) for this request.
Return (date_list, items, extra_context) for this request.
def get_dated_items(self): """ Return (date_list, items, extra_context) for this request. """ year = self.get_year() month = self.get_month() date_field = self.get_date_field() date = _date_from_string(year, self.get_year_format(), ...
[ "def", "get_dated_items", "(", "self", ")", ":", "year", "=", "self", ".", "get_year", "(", ")", "month", "=", "self", ".", "get_month", "(", ")", "date_field", "=", "self", ".", "get_date_field", "(", ")", "date", "=", "_date_from_string", "(", "year", ...
[ 492, 4 ]
[ 517, 10 ]
python
en
['en', 'error', 'th']
False
BaseWeekArchiveView.get_dated_items
(self)
Return (date_list, items, extra_context) for this request.
Return (date_list, items, extra_context) for this request.
def get_dated_items(self): """ Return (date_list, items, extra_context) for this request. """ year = self.get_year() week = self.get_week() date_field = self.get_date_field() week_format = self.get_week_format() week_start = { '%W': '1', ...
[ "def", "get_dated_items", "(", "self", ")", ":", "year", "=", "self", ".", "get_year", "(", ")", "week", "=", "self", ".", "get_week", "(", ")", "date_field", "=", "self", ".", "get_date_field", "(", ")", "week_format", "=", "self", ".", "get_week_format...
[ 532, 4 ]
[ 562, 10 ]
python
en
['en', 'error', 'th']
False
BaseDayArchiveView.get_dated_items
(self)
Return (date_list, items, extra_context) for this request.
Return (date_list, items, extra_context) for this request.
def get_dated_items(self): """ Return (date_list, items, extra_context) for this request. """ year = self.get_year() month = self.get_month() day = self.get_day() date = _date_from_string(year, self.get_year_format(), month, self....
[ "def", "get_dated_items", "(", "self", ")", ":", "year", "=", "self", ".", "get_year", "(", ")", "month", "=", "self", ".", "get_month", "(", ")", "day", "=", "self", ".", "get_day", "(", ")", "date", "=", "_date_from_string", "(", "year", ",", "self...
[ 576, 4 ]
[ 588, 42 ]
python
en
['en', 'error', 'th']
False
BaseDayArchiveView._get_dated_items
(self, date)
Do the actual heavy lifting of getting the dated items; this accepts a date object so that TodayArchiveView can be trivial.
Do the actual heavy lifting of getting the dated items; this accepts a date object so that TodayArchiveView can be trivial.
def _get_dated_items(self, date): """ Do the actual heavy lifting of getting the dated items; this accepts a date object so that TodayArchiveView can be trivial. """ lookup_kwargs = self._make_single_date_lookup(date) qs = self.get_dated_queryset(**lookup_kwargs) ...
[ "def", "_get_dated_items", "(", "self", ",", "date", ")", ":", "lookup_kwargs", "=", "self", ".", "_make_single_date_lookup", "(", "date", ")", "qs", "=", "self", ".", "get_dated_queryset", "(", "*", "*", "lookup_kwargs", ")", "return", "(", "None", ",", "...
[ 590, 4 ]
[ 604, 10 ]
python
en
['en', 'error', 'th']
False
BaseTodayArchiveView.get_dated_items
(self)
Return (date_list, items, extra_context) for this request.
Return (date_list, items, extra_context) for this request.
def get_dated_items(self): """ Return (date_list, items, extra_context) for this request. """ return self._get_dated_items(datetime.date.today())
[ "def", "get_dated_items", "(", "self", ")", ":", "return", "self", ".", "_get_dated_items", "(", "datetime", ".", "date", ".", "today", "(", ")", ")" ]
[ 619, 4 ]
[ 623, 59 ]
python
en
['en', 'error', 'th']
False
BaseDateDetailView.get_object
(self, queryset=None)
Get the object this request displays.
Get the object this request displays.
def get_object(self, queryset=None): """ Get the object this request displays. """ year = self.get_year() month = self.get_month() day = self.get_day() date = _date_from_string(year, self.get_year_format(), month, self.get_month_fo...
[ "def", "get_object", "(", "self", ",", "queryset", "=", "None", ")", ":", "year", "=", "self", ".", "get_year", "(", ")", "month", "=", "self", ".", "get_month", "(", ")", "day", "=", "self", ".", "get_day", "(", ")", "date", "=", "_date_from_string"...
[ 638, 4 ]
[ 667, 66 ]
python
en
['en', 'error', 'th']
False
SimplerXMLGenerator.addQuickElement
(self, name, contents=None, attrs=None)
Convenience method for adding an element with no children
Convenience method for adding an element with no children
def addQuickElement(self, name, contents=None, attrs=None): "Convenience method for adding an element with no children" if attrs is None: attrs = {} self.startElement(name, attrs) if contents is not None: self.characters(contents) self.endElement(name)
[ "def", "addQuickElement", "(", "self", ",", "name", ",", "contents", "=", "None", ",", "attrs", "=", "None", ")", ":", "if", "attrs", "is", "None", ":", "attrs", "=", "{", "}", "self", ".", "startElement", "(", "name", ",", "attrs", ")", "if", "con...
[ 8, 4 ]
[ 15, 29 ]
python
en
['en', 'en', 'en']
True
_copy_file_contents
(src, dst, buffer_size=16*1024)
Copy the file 'src' to 'dst'; both must be filenames. Any error opening either file, reading from 'src', or writing to 'dst', raises DistutilsFileError. Data is read/written in chunks of 'buffer_size' bytes (default 16k). No attempt is made to handle anything apart from regular files.
Copy the file 'src' to 'dst'; both must be filenames. Any error opening either file, reading from 'src', or writing to 'dst', raises DistutilsFileError. Data is read/written in chunks of 'buffer_size' bytes (default 16k). No attempt is made to handle anything apart from regular files.
def _copy_file_contents(src, dst, buffer_size=16*1024): """Copy the file 'src' to 'dst'; both must be filenames. Any error opening either file, reading from 'src', or writing to 'dst', raises DistutilsFileError. Data is read/written in chunks of 'buffer_size' bytes (default 16k). No attempt is made t...
[ "def", "_copy_file_contents", "(", "src", ",", "dst", ",", "buffer_size", "=", "16", "*", "1024", ")", ":", "# Stolen from shutil module in the standard library, but with", "# custom error-handling added.", "fsrc", "=", "None", "fdst", "=", "None", "try", ":", "try", ...
[ 15, 0 ]
[ 64, 24 ]
python
en
['en', 'en', 'en']
True
copy_file
(src, dst, preserve_mode=1, preserve_times=1, update=0, link=None, verbose=1, dry_run=0)
Copy a file 'src' to 'dst'. If 'dst' is a directory, then 'src' is copied there with the same name; otherwise, it must be a filename. (If the file exists, it will be ruthlessly clobbered.) If 'preserve_mode' is true (the default), the file's mode (type and permission bits, or whatever is analogous on...
Copy a file 'src' to 'dst'. If 'dst' is a directory, then 'src' is copied there with the same name; otherwise, it must be a filename. (If the file exists, it will be ruthlessly clobbered.) If 'preserve_mode' is true (the default), the file's mode (type and permission bits, or whatever is analogous on...
def copy_file(src, dst, preserve_mode=1, preserve_times=1, update=0, link=None, verbose=1, dry_run=0): """Copy a file 'src' to 'dst'. If 'dst' is a directory, then 'src' is copied there with the same name; otherwise, it must be a filename. (If the file exists, it will be ruthlessly clobbered...
[ "def", "copy_file", "(", "src", ",", "dst", ",", "preserve_mode", "=", "1", ",", "preserve_times", "=", "1", ",", "update", "=", "0", ",", "link", "=", "None", ",", "verbose", "=", "1", ",", "dry_run", "=", "0", ")", ":", "# XXX if the destination file...
[ 66, 0 ]
[ 161, 19 ]
python
en
['en', 'en', 'en']
True
move_file
(src, dst, verbose=1, dry_run=0)
Move a file 'src' to 'dst'. If 'dst' is a directory, the file will be moved into it with the same name; otherwise, 'src' is just renamed to 'dst'. Return the new full name of the file. Handles cross-device moves on Unix using 'copy_file()'. What about other systems???
Move a file 'src' to 'dst'. If 'dst' is a directory, the file will be moved into it with the same name; otherwise, 'src' is just renamed to 'dst'. Return the new full name of the file.
def move_file (src, dst, verbose=1, dry_run=0): """Move a file 'src' to 'dst'. If 'dst' is a directory, the file will be moved into it with the same name; otherwise, 'src' is just renamed to 'dst'. Return the new full name of the file. Handles cross-device moves on Unix...
[ "def", "move_file", "(", "src", ",", "dst", ",", "verbose", "=", "1", ",", "dry_run", "=", "0", ")", ":", "from", "os", ".", "path", "import", "exists", ",", "isfile", ",", "isdir", ",", "basename", ",", "dirname", "import", "errno", "if", "verbose",...
[ 165, 0 ]
[ 225, 14 ]
python
en
['en', 'en', 'en']
True
write_file
(filename, contents)
Create a file with the specified name and write 'contents' (a sequence of strings without line terminators) to it.
Create a file with the specified name and write 'contents' (a sequence of strings without line terminators) to it.
def write_file (filename, contents): """Create a file with the specified name and write 'contents' (a sequence of strings without line terminators) to it. """ f = open(filename, "w") try: for line in contents: f.write(line + "\n") finally: f.close()
[ "def", "write_file", "(", "filename", ",", "contents", ")", ":", "f", "=", "open", "(", "filename", ",", "\"w\"", ")", "try", ":", "for", "line", "in", "contents", ":", "f", ".", "write", "(", "line", "+", "\"\\n\"", ")", "finally", ":", "f", ".", ...
[ 228, 0 ]
[ 237, 17 ]
python
en
['en', 'en', 'en']
True
to_unicode
(s)
Convert strings to Unicode objects (and return all other data types unchanged).
Convert strings to Unicode objects (and return all other data types unchanged).
def to_unicode(s): """ Convert strings to Unicode objects (and return all other data types unchanged). """ if isinstance(s, six.string_types): return force_text(s) return s
[ "def", "to_unicode", "(", "s", ")", ":", "if", "isinstance", "(", "s", ",", "six", ".", "string_types", ")", ":", "return", "force_text", "(", "s", ")", "return", "s" ]
[ 1041, 0 ]
[ 1048, 12 ]
python
en
['en', 'error', 'th']
False
DatabaseFeatures.introspected_boolean_field_type
(self, field=None, created_separately=False)
Some versions of Oracle -- we've seen this on 11.2.0.1 and suspect it goes back -- have a weird bug where, when an integer column is added to an existing table with a default, its precision is later reported on introspection as 0, regardless of the real precision. For Django int...
Some versions of Oracle -- we've seen this on 11.2.0.1 and suspect it goes back -- have a weird bug where, when an integer column is added to an existing table with a default, its precision is later reported on introspection as 0, regardless of the real precision. For Django int...
def introspected_boolean_field_type(self, field=None, created_separately=False): """ Some versions of Oracle -- we've seen this on 11.2.0.1 and suspect it goes back -- have a weird bug where, when an integer column is added to an existing table with a default, its precision is later ...
[ "def", "introspected_boolean_field_type", "(", "self", ",", "field", "=", "None", ",", "created_separately", "=", "False", ")", ":", "if", "self", ".", "connection", ".", "oracle_full_version", "<", "'11.2.0.2'", "and", "field", "and", "field", ".", "has_default...
[ 127, 4 ]
[ 140, 103 ]
python
en
['en', 'error', 'th']
False
DatabaseOperations.date_interval_sql
(self, sql, connector, timedelta)
Implements the interval functionality for expressions format for Oracle: (datefield + INTERVAL '3 00:03:20.000000' DAY(1) TO SECOND(6))
Implements the interval functionality for expressions format for Oracle: (datefield + INTERVAL '3 00:03:20.000000' DAY(1) TO SECOND(6))
def date_interval_sql(self, sql, connector, timedelta): """ Implements the interval functionality for expressions format for Oracle: (datefield + INTERVAL '3 00:03:20.000000' DAY(1) TO SECOND(6)) """ minutes, seconds = divmod(timedelta.seconds, 60) hours, minutes ...
[ "def", "date_interval_sql", "(", "self", ",", "sql", ",", "connector", ",", "timedelta", ")", ":", "minutes", ",", "seconds", "=", "divmod", "(", "timedelta", ".", "seconds", ",", "60", ")", "hours", ",", "minutes", "=", "divmod", "(", "minutes", ",", ...
[ 200, 4 ]
[ 212, 54 ]
python
en
['en', 'error', 'th']
False
DatabaseOperations.value_to_db_date
(self, value)
Transform a date value to an object compatible with what is expected by the backend driver for date columns. The default implementation transforms the date to text, but that is not necessary for Oracle.
Transform a date value to an object compatible with what is expected by the backend driver for date columns. The default implementation transforms the date to text, but that is not necessary for Oracle.
def value_to_db_date(self, value): """ Transform a date value to an object compatible with what is expected by the backend driver for date columns. The default implementation transforms the date to text, but that is not necessary for Oracle. """ return value
[ "def", "value_to_db_date", "(", "self", ",", "value", ")", ":", "return", "value" ]
[ 484, 4 ]
[ 491, 20 ]
python
en
['en', 'error', 'th']
False
DatabaseOperations.value_to_db_datetime
(self, value)
Transform a datetime value to an object compatible with what is expected by the backend driver for datetime columns. If naive datetime is passed assumes that is in UTC. Normally Django models.DateTimeField makes sure that if USE_TZ is True passed datetime is timezone aware. ...
Transform a datetime value to an object compatible with what is expected by the backend driver for datetime columns.
def value_to_db_datetime(self, value): """ Transform a datetime value to an object compatible with what is expected by the backend driver for datetime columns. If naive datetime is passed assumes that is in UTC. Normally Django models.DateTimeField makes sure that if USE_TZ is T...
[ "def", "value_to_db_datetime", "(", "self", ",", "value", ")", ":", "if", "value", "is", "None", ":", "return", "None", "# cx_Oracle doesn't support tz-aware datetimes", "if", "timezone", ".", "is_aware", "(", "value", ")", ":", "if", "settings", ".", "USE_TZ", ...
[ 493, 4 ]
[ 513, 51 ]
python
en
['en', 'error', 'th']
False
DatabaseOperations.combine_expression
(self, connector, sub_expressions)
Oracle requires special cases for %% and & operators in query expressions
Oracle requires special cases for %% and & operators in query expressions
def combine_expression(self, connector, sub_expressions): "Oracle requires special cases for %% and & operators in query expressions" if connector == '%%': return 'MOD(%s)' % ','.join(sub_expressions) elif connector == '&': return 'BITAND(%s)' % ','.join(sub_expressions) ...
[ "def", "combine_expression", "(", "self", ",", "connector", ",", "sub_expressions", ")", ":", "if", "connector", "==", "'%%'", ":", "return", "'MOD(%s)'", "%", "','", ".", "join", "(", "sub_expressions", ")", "elif", "connector", "==", "'&'", ":", "return", ...
[ 542, 4 ]
[ 552, 93 ]
python
en
['en', 'en', 'en']
True
DatabaseWrapper.check_constraints
(self, table_names=None)
To check constraints, we set constraints to immediate. Then, when, we're done we must ensure they are returned to deferred.
To check constraints, we set constraints to immediate. Then, when, we're done we must ensure they are returned to deferred.
def check_constraints(self, table_names=None): """ To check constraints, we set constraints to immediate. Then, when, we're done we must ensure they are returned to deferred. """ self.cursor().execute('SET CONSTRAINTS ALL IMMEDIATE') self.cursor().execute('SET CONSTRAINTS...
[ "def", "check_constraints", "(", "self", ",", "table_names", "=", "None", ")", ":", "self", ".", "cursor", "(", ")", ".", "execute", "(", "'SET CONSTRAINTS ALL IMMEDIATE'", ")", "self", ".", "cursor", "(", ")", ".", "execute", "(", "'SET CONSTRAINTS ALL DEFERR...
[ 724, 4 ]
[ 730, 61 ]
python
en
['en', 'error', 'th']
False
check_flags
(flags: List[str], expected: Set[str])
The has_alert_word flag can be ignored for most tests.
The has_alert_word flag can be ignored for most tests.
def check_flags(flags: List[str], expected: Set[str]) -> None: """ The has_alert_word flag can be ignored for most tests. """ assert "has_alert_word" not in expected flag_set = set(flags) flag_set.discard("has_alert_word") if flag_set != expected: raise AssertionError(f"expected flag...
[ "def", "check_flags", "(", "flags", ":", "List", "[", "str", "]", ",", "expected", ":", "Set", "[", "str", "]", ")", "->", "None", ":", "assert", "\"has_alert_word\"", "not", "in", "expected", "flag_set", "=", "set", "(", "flags", ")", "flag_set", ".",...
[ 32, 0 ]
[ 40, 90 ]
python
en
['en', 'error', 'th']
False
MessageAccessTests.test_change_star
(self)
You can set a message as starred/un-starred through POST /json/messages/flags.
You can set a message as starred/un-starred through POST /json/messages/flags.
def test_change_star(self) -> None: """ You can set a message as starred/un-starred through POST /json/messages/flags. """ self.login("hamlet") message_ids = [ self.send_personal_message( self.example_user("hamlet"), self.example_user("hamlet")...
[ "def", "test_change_star", "(", "self", ")", "->", "None", ":", "self", ".", "login", "(", "\"hamlet\"", ")", "message_ids", "=", "[", "self", ".", "send_personal_message", "(", "self", ".", "example_user", "(", "\"hamlet\"", ")", ",", "self", ".", "exampl...
[ 1035, 4 ]
[ 1063, 48 ]
python
en
['en', 'error', 'th']
False
MessageAccessTests.test_change_star_public_stream_historical
(self)
You can set a message as starred/un-starred through POST /json/messages/flags.
You can set a message as starred/un-starred through POST /json/messages/flags.
def test_change_star_public_stream_historical(self) -> None: """ You can set a message as starred/un-starred through POST /json/messages/flags. """ stream_name = "new_stream" self.subscribe(self.example_user("hamlet"), stream_name) self.login("hamlet") mes...
[ "def", "test_change_star_public_stream_historical", "(", "self", ")", "->", "None", ":", "stream_name", "=", "\"new_stream\"", "self", ".", "subscribe", "(", "self", ".", "example_user", "(", "\"hamlet\"", ")", ",", "stream_name", ")", "self", ".", "login", "(",...
[ 1065, 4 ]
[ 1134, 60 ]
python
en
['en', 'error', 'th']
False
MessageAccessTests.test_change_star_private_message_security
(self)
You can set a message as starred/un-starred through POST /json/messages/flags.
You can set a message as starred/un-starred through POST /json/messages/flags.
def test_change_star_private_message_security(self) -> None: """ You can set a message as starred/un-starred through POST /json/messages/flags. """ self.login("hamlet") message_ids = [ self.send_personal_message( self.example_user("hamlet"), ...
[ "def", "test_change_star_private_message_security", "(", "self", ")", "->", "None", ":", "self", ".", "login", "(", "\"hamlet\"", ")", "message_ids", "=", "[", "self", ".", "send_personal_message", "(", "self", ".", "example_user", "(", "\"hamlet\"", ")", ",", ...
[ 1136, 4 ]
[ 1153, 60 ]
python
en
['en', 'error', 'th']
False
MessageAccessTests.test_new_message
(self)
New messages aren't starred.
New messages aren't starred.
def test_new_message(self) -> None: """ New messages aren't starred. """ sender = self.example_user("hamlet") self.login_user(sender) content = "Test message for star" self.send_stream_message(sender, "Verona", content=content) sent_message = ( ...
[ "def", "test_new_message", "(", "self", ")", "->", "None", ":", "sender", "=", "self", ".", "example_user", "(", "\"hamlet\"", ")", "self", ".", "login_user", "(", "sender", ")", "content", "=", "\"Test message for star\"", "self", ".", "send_stream_message", ...
[ 1193, 4 ]
[ 1210, 52 ]
python
en
['en', 'error', 'th']
False
PersonalMessagesFlagTest.test_is_private_flag_not_leaked
(self)
Make sure `is_private` flag is not leaked to the API.
Make sure `is_private` flag is not leaked to the API.
def test_is_private_flag_not_leaked(self) -> None: """ Make sure `is_private` flag is not leaked to the API. """ self.login("hamlet") self.send_personal_message( self.example_user("hamlet"), self.example_user("cordelia"), "test" ) for msg in self.get_...
[ "def", "test_is_private_flag_not_leaked", "(", "self", ")", "->", "None", ":", "self", ".", "login", "(", "\"hamlet\"", ")", "self", ".", "send_personal_message", "(", "self", ".", "example_user", "(", "\"hamlet\"", ")", ",", "self", ".", "example_user", "(", ...
[ 1360, 4 ]
[ 1370, 56 ]
python
en
['en', 'error', 'th']
False
_subst_vars
(path, local_vars)
In the string `path`, replace tokens like {some.thing} with the corresponding value from the map `local_vars`. If there is no corresponding value, leave the token unchanged.
In the string `path`, replace tokens like {some.thing} with the corresponding value from the map `local_vars`.
def _subst_vars(path, local_vars): """In the string `path`, replace tokens like {some.thing} with the corresponding value from the map `local_vars`. If there is no corresponding value, leave the token unchanged. """ def _replacer(matchobj): name = matchobj.group(1) if name in local_...
[ "def", "_subst_vars", "(", "path", ",", "local_vars", ")", ":", "def", "_replacer", "(", "matchobj", ")", ":", "name", "=", "matchobj", ".", "group", "(", "1", ")", "if", "name", "in", "local_vars", ":", "return", "local_vars", "[", "name", "]", "elif"...
[ 130, 0 ]
[ 143, 41 ]
python
en
['en', 'en', 'en']
True
_parse_makefile
(filename, vars=None)
Parse a Makefile-style file. A dictionary containing name/value pairs is returned. If an optional dictionary is passed in as the second argument, it is used instead of a new dictionary.
Parse a Makefile-style file.
def _parse_makefile(filename, vars=None): """Parse a Makefile-style file. A dictionary containing name/value pairs is returned. If an optional dictionary is passed in as the second argument, it is used instead of a new dictionary. """ # Regexes needed for parsing Makefile (and similar syntaxes...
[ "def", "_parse_makefile", "(", "filename", ",", "vars", "=", "None", ")", ":", "# Regexes needed for parsing Makefile (and similar syntaxes,", "# like old-style Setup files).", "_variable_rx", "=", "re", ".", "compile", "(", "r\"([a-zA-Z][a-zA-Z0-9_]+)\\s*=\\s*(.*)\"", ")", "...
[ 212, 0 ]
[ 327, 15 ]
python
en
['en', 'en', 'en']
True
get_makefile_filename
()
Return the path of the Makefile.
Return the path of the Makefile.
def get_makefile_filename(): """Return the path of the Makefile.""" if _PYTHON_BUILD: return os.path.join(_PROJECT_BASE, "Makefile") if hasattr(sys, 'abiflags'): config_dir_name = 'config-%s%s' % (_PY_VERSION_SHORT, sys.abiflags) else: config_dir_name = 'config' return os.pat...
[ "def", "get_makefile_filename", "(", ")", ":", "if", "_PYTHON_BUILD", ":", "return", "os", ".", "path", ".", "join", "(", "_PROJECT_BASE", ",", "\"Makefile\"", ")", "if", "hasattr", "(", "sys", ",", "'abiflags'", ")", ":", "config_dir_name", "=", "'config-%s...
[ 330, 0 ]
[ 338, 72 ]
python
en
['en', 'en', 'en']
True
_init_posix
(vars)
Initialize the module as appropriate for POSIX systems.
Initialize the module as appropriate for POSIX systems.
def _init_posix(vars): """Initialize the module as appropriate for POSIX systems.""" # load the installed Makefile: makefile = get_makefile_filename() try: _parse_makefile(makefile, vars) except IOError as e: msg = "invalid Python installation: unable to open %s" % makefile i...
[ "def", "_init_posix", "(", "vars", ")", ":", "# load the installed Makefile:", "makefile", "=", "get_makefile_filename", "(", ")", "try", ":", "_parse_makefile", "(", "makefile", ",", "vars", ")", "except", "IOError", "as", "e", ":", "msg", "=", "\"invalid Pytho...
[ 341, 0 ]
[ 366, 44 ]
python
en
['en', 'en', 'en']
True
_init_non_posix
(vars)
Initialize the module as appropriate for NT
Initialize the module as appropriate for NT
def _init_non_posix(vars): """Initialize the module as appropriate for NT""" # set basic install directories vars['LIBDEST'] = get_path('stdlib') vars['BINLIBDEST'] = get_path('platstdlib') vars['INCLUDEPY'] = get_path('include') vars['SO'] = '.pyd' vars['EXE'] = '.exe' vars['VERSION'] =...
[ "def", "_init_non_posix", "(", "vars", ")", ":", "# set basic install directories", "vars", "[", "'LIBDEST'", "]", "=", "get_path", "(", "'stdlib'", ")", "vars", "[", "'BINLIBDEST'", "]", "=", "get_path", "(", "'platstdlib'", ")", "vars", "[", "'INCLUDEPY'", "...
[ 369, 0 ]
[ 378, 68 ]
python
en
['en', 'en', 'en']
True
parse_config_h
(fp, vars=None)
Parse a config.h-style file. A dictionary containing name/value pairs is returned. If an optional dictionary is passed in as the second argument, it is used instead of a new dictionary.
Parse a config.h-style file.
def parse_config_h(fp, vars=None): """Parse a config.h-style file. A dictionary containing name/value pairs is returned. If an optional dictionary is passed in as the second argument, it is used instead of a new dictionary. """ if vars is None: vars = {} define_rx = re.compile("#de...
[ "def", "parse_config_h", "(", "fp", ",", "vars", "=", "None", ")", ":", "if", "vars", "is", "None", ":", "vars", "=", "{", "}", "define_rx", "=", "re", ".", "compile", "(", "\"#define ([A-Z][A-Za-z0-9_]+) (.*)\\n\"", ")", "undef_rx", "=", "re", ".", "com...
[ 385, 0 ]
[ 413, 15 ]
python
en
['es', 'en', 'en']
True
get_config_h_filename
()
Return the path of pyconfig.h.
Return the path of pyconfig.h.
def get_config_h_filename(): """Return the path of pyconfig.h.""" if _PYTHON_BUILD: if os.name == "nt": inc_dir = os.path.join(_PROJECT_BASE, "PC") else: inc_dir = _PROJECT_BASE else: inc_dir = get_path('platinclude') return os.path.join(inc_dir, 'pyconfig...
[ "def", "get_config_h_filename", "(", ")", ":", "if", "_PYTHON_BUILD", ":", "if", "os", ".", "name", "==", "\"nt\"", ":", "inc_dir", "=", "os", ".", "path", ".", "join", "(", "_PROJECT_BASE", ",", "\"PC\"", ")", "else", ":", "inc_dir", "=", "_PROJECT_BASE...
[ 416, 0 ]
[ 425, 46 ]
python
en
['en', 'en', 'en']
True
get_scheme_names
()
Return a tuple containing the schemes names.
Return a tuple containing the schemes names.
def get_scheme_names(): """Return a tuple containing the schemes names.""" return tuple(sorted(_SCHEMES.sections()))
[ "def", "get_scheme_names", "(", ")", ":", "return", "tuple", "(", "sorted", "(", "_SCHEMES", ".", "sections", "(", ")", ")", ")" ]
[ 428, 0 ]
[ 430, 45 ]
python
en
['en', 'en', 'en']
True
get_path_names
()
Return a tuple containing the paths names.
Return a tuple containing the paths names.
def get_path_names(): """Return a tuple containing the paths names.""" # xxx see if we want a static list return _SCHEMES.options('posix_prefix')
[ "def", "get_path_names", "(", ")", ":", "# xxx see if we want a static list", "return", "_SCHEMES", ".", "options", "(", "'posix_prefix'", ")" ]
[ 433, 0 ]
[ 436, 43 ]
python
en
['en', 'en', 'en']
True
get_paths
(scheme=_get_default_scheme(), vars=None, expand=True)
Return a mapping containing an install scheme. ``scheme`` is the install scheme name. If not provided, it will return the default scheme for the current platform.
Return a mapping containing an install scheme.
def get_paths(scheme=_get_default_scheme(), vars=None, expand=True): """Return a mapping containing an install scheme. ``scheme`` is the install scheme name. If not provided, it will return the default scheme for the current platform. """ _ensure_cfg_read() if expand: return _expand_var...
[ "def", "get_paths", "(", "scheme", "=", "_get_default_scheme", "(", ")", ",", "vars", "=", "None", ",", "expand", "=", "True", ")", ":", "_ensure_cfg_read", "(", ")", "if", "expand", ":", "return", "_expand_vars", "(", "scheme", ",", "vars", ")", "else",...
[ 439, 0 ]
[ 449, 43 ]
python
en
['en', 'en', 'en']
True
get_path
(name, scheme=_get_default_scheme(), vars=None, expand=True)
Return a path corresponding to the scheme. ``scheme`` is the install scheme name.
Return a path corresponding to the scheme.
def get_path(name, scheme=_get_default_scheme(), vars=None, expand=True): """Return a path corresponding to the scheme. ``scheme`` is the install scheme name. """ return get_paths(scheme, vars, expand)[name]
[ "def", "get_path", "(", "name", ",", "scheme", "=", "_get_default_scheme", "(", ")", ",", "vars", "=", "None", ",", "expand", "=", "True", ")", ":", "return", "get_paths", "(", "scheme", ",", "vars", ",", "expand", ")", "[", "name", "]" ]
[ 452, 0 ]
[ 457, 48 ]
python
en
['en', 'el-Latn', 'en']
True
get_config_vars
(*args)
With no arguments, return a dictionary of all configuration variables relevant for the current platform. On Unix, this means every variable defined in Python's installed Makefile; On Windows and Mac OS it's a much smaller set. With arguments, return a list of values that result from looking up eac...
With no arguments, return a dictionary of all configuration variables relevant for the current platform.
def get_config_vars(*args): """With no arguments, return a dictionary of all configuration variables relevant for the current platform. On Unix, this means every variable defined in Python's installed Makefile; On Windows and Mac OS it's a much smaller set. With arguments, return a list of values ...
[ "def", "get_config_vars", "(", "*", "args", ")", ":", "global", "_CONFIG_VARS", "if", "_CONFIG_VARS", "is", "None", ":", "_CONFIG_VARS", "=", "{", "}", "# Normalized versions of prefix and exec_prefix are handy to have;", "# in fact, these are the standard versions used most pl...
[ 460, 0 ]
[ 588, 27 ]
python
en
['en', 'en', 'en']
True
get_config_var
(name)
Return the value of a single variable using the dictionary returned by 'get_config_vars()'. Equivalent to get_config_vars().get(name)
Return the value of a single variable using the dictionary returned by 'get_config_vars()'.
def get_config_var(name): """Return the value of a single variable using the dictionary returned by 'get_config_vars()'. Equivalent to get_config_vars().get(name) """ return get_config_vars().get(name)
[ "def", "get_config_var", "(", "name", ")", ":", "return", "get_config_vars", "(", ")", ".", "get", "(", "name", ")" ]
[ 591, 0 ]
[ 597, 38 ]
python
en
['en', 'en', 'en']
True
get_platform
()
Return a string that identifies the current platform. This is used mainly to distinguish platform-specific build directories and platform-specific built distributions. Typically includes the OS name and version and the architecture (as supplied by 'os.uname()'), although the exact information included...
Return a string that identifies the current platform.
def get_platform(): """Return a string that identifies the current platform. This is used mainly to distinguish platform-specific build directories and platform-specific built distributions. Typically includes the OS name and version and the architecture (as supplied by 'os.uname()'), although the...
[ "def", "get_platform", "(", ")", ":", "if", "os", ".", "name", "==", "'nt'", ":", "# sniff sys.version for architecture.", "prefix", "=", "\" bit (\"", "i", "=", "sys", ".", "version", ".", "find", "(", "prefix", ")", "if", "i", "==", "-", "1", ":", "r...
[ 600, 0 ]
[ 759, 50 ]
python
en
['en', 'en', 'en']
True
_main
()
Display all information sysconfig detains.
Display all information sysconfig detains.
def _main(): """Display all information sysconfig detains.""" print('Platform: "%s"' % get_platform()) print('Python version: "%s"' % get_python_version()) print('Current installation scheme: "%s"' % _get_default_scheme()) print() _print_dict('Paths', get_paths()) print() _print_dict('Va...
[ "def", "_main", "(", ")", ":", "print", "(", "'Platform: \"%s\"'", "%", "get_platform", "(", ")", ")", "print", "(", "'Python version: \"%s\"'", "%", "get_python_version", "(", ")", ")", "print", "(", "'Current installation scheme: \"%s\"'", "%", "_get_default_schem...
[ 773, 0 ]
[ 781, 47 ]
python
en
['en', 'en', 'en']
True
parse_docstring
(f)
Parse the docstring of `f` and return a list of parameters
Parse the docstring of `f` and return a list of parameters
def parse_docstring(f): """ Parse the docstring of `f` and return a list of parameters """ doc = inspect.cleandoc(f.__doc__) lines = doc.splitlines() params = [] currentparam = None shortdoc = "" def flush_param_if_necessary(): if currentparam: params.append(cur...
[ "def", "parse_docstring", "(", "f", ")", ":", "doc", "=", "inspect", ".", "cleandoc", "(", "f", ".", "__doc__", ")", "lines", "=", "doc", ".", "splitlines", "(", ")", "params", "=", "[", "]", "currentparam", "=", "None", "shortdoc", "=", "\"\"", "def...
[ 62, 0 ]
[ 107, 97 ]
python
en
['en', 'error', 'th']
False
write_doc
(filename, f)
Write the documentation for a Function `f` to `filename`
Write the documentation for a Function `f` to `filename`
def write_doc(filename, f): """ Write the documentation for a Function `f` to `filename` """ with open(filename, "w") as docfile: # Write the title and shortdoc docfile.write("## " + f.name + "\n") docfile.write(f.shortdoc + "\n") # Write out the signature docfi...
[ "def", "write_doc", "(", "filename", ",", "f", ")", ":", "with", "open", "(", "filename", ",", "\"w\"", ")", "as", "docfile", ":", "# Write the title and shortdoc", "docfile", ".", "write", "(", "\"## \"", "+", "f", ".", "name", "+", "\"\\n\"", ")", "doc...
[ 109, 0 ]
[ 137, 57 ]
python
en
['en', 'error', 'th']
False
write_doc_for_packager
(packager, filename)
Writes the documentation for a packager to a file
Writes the documentation for a packager to a file
def write_doc_for_packager(packager, filename): """ Writes the documentation for a packager to a file """ f = parse_docstring(packager) write_doc(filename, f)
[ "def", "write_doc_for_packager", "(", "packager", ",", "filename", ")", ":", "f", "=", "parse_docstring", "(", "packager", ")", "write_doc", "(", "filename", ",", "f", ")" ]
[ 139, 0 ]
[ 144, 26 ]
python
en
['en', 'error', 'th']
False
Parameter.add_doc_line
(self, line)
Add a line of documentation
Add a line of documentation
def add_doc_line(self, line): """ Add a line of documentation """ self.docs_arr.append(line)
[ "def", "add_doc_line", "(", "self", ",", "line", ")", ":", "self", ".", "docs_arr", ".", "append", "(", "line", ")" ]
[ 41, 4 ]
[ 45, 34 ]
python
en
['en', 'error', 'th']
False
Parameter.get_clean_doc
(self)
Get a clean version of the documentation for this parameter
Get a clean version of the documentation for this parameter
def get_clean_doc(self): """ Get a clean version of the documentation for this parameter """ # Strips common leading whitespace return inspect.cleandoc("\n".join(self.docs_arr))
[ "def", "get_clean_doc", "(", "self", ")", ":", "# Strips common leading whitespace", "return", "inspect", ".", "cleandoc", "(", "\"\\n\"", ".", "join", "(", "self", ".", "docs_arr", ")", ")" ]
[ 47, 4 ]
[ 52, 57 ]
python
en
['en', 'error', 'th']
False
Parameter.set_default
(self, value)
Set the default value for this parameter
Set the default value for this parameter
def set_default(self, value): """ Set the default value for this parameter """ self.has_default = True self.default = value
[ "def", "set_default", "(", "self", ",", "value", ")", ":", "self", ".", "has_default", "=", "True", "self", ".", "default", "=", "value" ]
[ 54, 4 ]
[ 59, 28 ]
python
en
['en', 'error', 'th']
False
JpegImageFile.load_read
(self, read_bytes)
internal: read more image data For premature EOF and LOAD_TRUNCATED_IMAGES adds EOI marker so libjpeg can finish decoding
internal: read more image data For premature EOF and LOAD_TRUNCATED_IMAGES adds EOI marker so libjpeg can finish decoding
def load_read(self, read_bytes): """ internal: read more image data For premature EOF and LOAD_TRUNCATED_IMAGES adds EOI marker so libjpeg can finish decoding """ s = self.fp.read(read_bytes) if not s and ImageFile.LOAD_TRUNCATED_IMAGES: # Premature E...
[ "def", "load_read", "(", "self", ",", "read_bytes", ")", ":", "s", "=", "self", ".", "fp", ".", "read", "(", "read_bytes", ")", "if", "not", "s", "and", "ImageFile", ".", "LOAD_TRUNCATED_IMAGES", ":", "# Premature EOF.", "# Pretend file is finished adding EOI ma...
[ 389, 4 ]
[ 402, 16 ]
python
en
['en', 'error', 'th']
False
show_formats
()
Print all possible values for the 'formats' option (used by the "--help-formats" command-line option).
Print all possible values for the 'formats' option (used by the "--help-formats" command-line option).
def show_formats(): """Print all possible values for the 'formats' option (used by the "--help-formats" command-line option). """ from distutils.fancy_getopt import FancyGetopt from distutils.archive_util import ARCHIVE_FORMATS formats = [] for format in ARCHIVE_FORMATS.keys(): forma...
[ "def", "show_formats", "(", ")", ":", "from", "distutils", ".", "fancy_getopt", "import", "FancyGetopt", "from", "distutils", ".", "archive_util", "import", "ARCHIVE_FORMATS", "formats", "=", "[", "]", "for", "format", "in", "ARCHIVE_FORMATS", ".", "keys", "(", ...
[ 20, 0 ]
[ 32, 57 ]
python
en
['en', 'en', 'en']
True
sdist.checking_metadata
(self)
Callable used for the check sub-command. Placed here so user_options can view it
Callable used for the check sub-command.
def checking_metadata(self): """Callable used for the check sub-command. Placed here so user_options can view it""" return self.metadata_check
[ "def", "checking_metadata", "(", "self", ")", ":", "return", "self", ".", "metadata_check" ]
[ 39, 4 ]
[ 43, 34 ]
python
en
['en', 'en', 'en']
True
sdist.check_metadata
(self)
Deprecated API.
Deprecated API.
def check_metadata(self): """Deprecated API.""" warn("distutils.command.sdist.check_metadata is deprecated, \ use the check command instead", PendingDeprecationWarning) check = self.distribution.get_command_obj('check') check.ensure_finalized() check.run()
[ "def", "check_metadata", "(", "self", ")", ":", "warn", "(", "\"distutils.command.sdist.check_metadata is deprecated, \\\n use the check command instead\"", ",", "PendingDeprecationWarning", ")", "check", "=", "self", ".", "distribution", ".", "get_command_obj", "(...
[ 161, 4 ]
[ 167, 19 ]
python
en
['en', 'pt', 'en']
False
sdist.get_file_list
(self)
Figure out the list of files to include in the source distribution, and put it in 'self.filelist'. This might involve reading the manifest template (and writing the manifest), or just reading the manifest, or just using the default file set -- it all depends on the user's options. ...
Figure out the list of files to include in the source distribution, and put it in 'self.filelist'. This might involve reading the manifest template (and writing the manifest), or just reading the manifest, or just using the default file set -- it all depends on the user's options. ...
def get_file_list(self): """Figure out the list of files to include in the source distribution, and put it in 'self.filelist'. This might involve reading the manifest template (and writing the manifest), or just reading the manifest, or just using the default file set -- it all ...
[ "def", "get_file_list", "(", "self", ")", ":", "# new behavior when using a template:", "# the file list is recalculated every time because", "# even if MANIFEST.in or setup.py are not changed", "# the user might have added some files in the tree that", "# need to be included.", "#", "# Thi...
[ 169, 4 ]
[ 207, 29 ]
python
en
['en', 'en', 'en']
True
sdist.add_defaults
(self)
Add all the default files to self.filelist: - README or README.txt - setup.py - test/test*.py - all pure Python modules mentioned in setup script - all files pointed by package_data (build_py) - all files defined in data_files. - all files defined as...
Add all the default files to self.filelist: - README or README.txt - setup.py - test/test*.py - all pure Python modules mentioned in setup script - all files pointed by package_data (build_py) - all files defined in data_files. - all files defined as...
def add_defaults(self): """Add all the default files to self.filelist: - README or README.txt - setup.py - test/test*.py - all pure Python modules mentioned in setup script - all files pointed by package_data (build_py) - all files defined in data_file...
[ "def", "add_defaults", "(", "self", ")", ":", "self", ".", "_add_defaults_standards", "(", ")", "self", ".", "_add_defaults_optional", "(", ")", "self", ".", "_add_defaults_python", "(", ")", "self", ".", "_add_defaults_data_files", "(", ")", "self", ".", "_ad...
[ 209, 4 ]
[ 229, 36 ]
python
en
['en', 'en', 'en']
True
sdist._cs_path_exists
(fspath)
Case-sensitive path existence check >>> sdist._cs_path_exists(__file__) True >>> sdist._cs_path_exists(__file__.upper()) False
Case-sensitive path existence check
def _cs_path_exists(fspath): """ Case-sensitive path existence check >>> sdist._cs_path_exists(__file__) True >>> sdist._cs_path_exists(__file__.upper()) False """ if not os.path.exists(fspath): return False # make absolute so we alway...
[ "def", "_cs_path_exists", "(", "fspath", ")", ":", "if", "not", "os", ".", "path", ".", "exists", "(", "fspath", ")", ":", "return", "False", "# make absolute so we always have a directory", "abspath", "=", "os", ".", "path", ".", "abspath", "(", "fspath", "...
[ 232, 4 ]
[ 246, 48 ]
python
en
['en', 'error', 'th']
False
sdist.read_template
(self)
Read and parse manifest template file named by self.template. (usually "MANIFEST.in") The parsing and processing is done by 'self.filelist', which updates itself accordingly.
Read and parse manifest template file named by self.template.
def read_template(self): """Read and parse manifest template file named by self.template. (usually "MANIFEST.in") The parsing and processing is done by 'self.filelist', which updates itself accordingly. """ log.info("reading manifest template '%s'", self.template) templa...
[ "def", "read_template", "(", "self", ")", ":", "log", ".", "info", "(", "\"reading manifest template '%s'\"", ",", "self", ".", "template", ")", "template", "=", "TextFile", "(", "self", ".", "template", ",", "strip_comments", "=", "1", ",", "skip_blanks", "...
[ 323, 4 ]
[ 350, 28 ]
python
en
['en', 'en', 'en']
True
sdist.prune_file_list
(self)
Prune off branches that might slip into the file list as created by 'read_template()', but really don't belong there: * the build tree (typically "build") * the release tree itself (only an issue if we ran "sdist" previously with --keep-temp, or it aborted) * any RCS, C...
Prune off branches that might slip into the file list as created by 'read_template()', but really don't belong there: * the build tree (typically "build") * the release tree itself (only an issue if we ran "sdist" previously with --keep-temp, or it aborted) * any RCS, C...
def prune_file_list(self): """Prune off branches that might slip into the file list as created by 'read_template()', but really don't belong there: * the build tree (typically "build") * the release tree itself (only an issue if we ran "sdist" previously with --keep-temp,...
[ "def", "prune_file_list", "(", "self", ")", ":", "build", "=", "self", ".", "get_finalized_command", "(", "'build'", ")", "base_dir", "=", "self", ".", "distribution", ".", "get_fullname", "(", ")", "self", ".", "filelist", ".", "exclude_pattern", "(", "None...
[ 352, 4 ]
[ 374, 59 ]
python
en
['en', 'en', 'en']
True
sdist.write_manifest
(self)
Write the file list in 'self.filelist' (presumably as filled in by 'add_defaults()' and 'read_template()') to the manifest file named by 'self.manifest'.
Write the file list in 'self.filelist' (presumably as filled in by 'add_defaults()' and 'read_template()') to the manifest file named by 'self.manifest'.
def write_manifest(self): """Write the file list in 'self.filelist' (presumably as filled in by 'add_defaults()' and 'read_template()') to the manifest file named by 'self.manifest'. """ if self._manifest_is_not_generated(): log.info("not writing to manually maintaine...
[ "def", "write_manifest", "(", "self", ")", ":", "if", "self", ".", "_manifest_is_not_generated", "(", ")", ":", "log", ".", "info", "(", "\"not writing to manually maintained \"", "\"manifest file '%s'\"", "%", "self", ".", "manifest", ")", "return", "content", "=...
[ 376, 4 ]
[ 389, 66 ]
python
en
['en', 'en', 'en']
True
sdist.read_manifest
(self)
Read the manifest file (named by 'self.manifest') and use it to fill in 'self.filelist', the list of files to include in the source distribution.
Read the manifest file (named by 'self.manifest') and use it to fill in 'self.filelist', the list of files to include in the source distribution.
def read_manifest(self): """Read the manifest file (named by 'self.manifest') and use it to fill in 'self.filelist', the list of files to include in the source distribution. """ log.info("reading manifest file '%s'", self.manifest) with open(self.manifest) as manifest: ...
[ "def", "read_manifest", "(", "self", ")", ":", "log", ".", "info", "(", "\"reading manifest file '%s'\"", ",", "self", ".", "manifest", ")", "with", "open", "(", "self", ".", "manifest", ")", "as", "manifest", ":", "for", "line", "in", "manifest", ":", "...
[ 403, 4 ]
[ 415, 42 ]
python
en
['en', 'en', 'en']
True
sdist.make_release_tree
(self, base_dir, files)
Create the directory tree that will become the source distribution archive. All directories implied by the filenames in 'files' are created under 'base_dir', and then we hard link or copy (if hard linking is unavailable) those files into place. Essentially, this duplicates the developer...
Create the directory tree that will become the source distribution archive. All directories implied by the filenames in 'files' are created under 'base_dir', and then we hard link or copy (if hard linking is unavailable) those files into place. Essentially, this duplicates the developer...
def make_release_tree(self, base_dir, files): """Create the directory tree that will become the source distribution archive. All directories implied by the filenames in 'files' are created under 'base_dir', and then we hard link or copy (if hard linking is unavailable) those files into ...
[ "def", "make_release_tree", "(", "self", ",", "base_dir", ",", "files", ")", ":", "# Create all the directories under 'base_dir' necessary to", "# put 'files' there; the 'mkpath()' is just so we don't die", "# if the manifest happens to be empty.", "self", ".", "mkpath", "(", "base...
[ 417, 4 ]
[ 457, 59 ]
python
en
['en', 'en', 'en']
True
sdist.make_distribution
(self)
Create the source distribution(s). First, we create the release tree with 'make_release_tree()'; then, we create all required archive files (according to 'self.formats') from the release tree. Finally, we clean up by blowing away the release tree (unless 'self.keep_temp' is true). The ...
Create the source distribution(s). First, we create the release tree with 'make_release_tree()'; then, we create all required archive files (according to 'self.formats') from the release tree. Finally, we clean up by blowing away the release tree (unless 'self.keep_temp' is true). The ...
def make_distribution(self): """Create the source distribution(s). First, we create the release tree with 'make_release_tree()'; then, we create all required archive files (according to 'self.formats') from the release tree. Finally, we clean up by blowing away the release tree (unless ...
[ "def", "make_distribution", "(", "self", ")", ":", "# Don't warn about missing meta-data here -- should be (and is!)", "# done elsewhere.", "base_dir", "=", "self", ".", "distribution", ".", "get_fullname", "(", ")", "base_name", "=", "os", ".", "path", ".", "join", "...
[ 459, 4 ]
[ 487, 64 ]
python
en
['en', 'en', 'en']
True
sdist.get_archive_files
(self)
Return the list of archive files created when the command was run, or None if the command hasn't run yet.
Return the list of archive files created when the command was run, or None if the command hasn't run yet.
def get_archive_files(self): """Return the list of archive files created when the command was run, or None if the command hasn't run yet. """ return self.archive_files
[ "def", "get_archive_files", "(", "self", ")", ":", "return", "self", ".", "archive_files" ]
[ 489, 4 ]
[ 493, 33 ]
python
en
['en', 'en', 'en']
True
messages
(request)
Return a lazy 'messages' context variable as well as 'DEFAULT_MESSAGE_LEVELS'.
Return a lazy 'messages' context variable as well as 'DEFAULT_MESSAGE_LEVELS'.
def messages(request): """ Return a lazy 'messages' context variable as well as 'DEFAULT_MESSAGE_LEVELS'. """ return { 'messages': get_messages(request), 'DEFAULT_MESSAGE_LEVELS': DEFAULT_LEVELS, }
[ "def", "messages", "(", "request", ")", ":", "return", "{", "'messages'", ":", "get_messages", "(", "request", ")", ",", "'DEFAULT_MESSAGE_LEVELS'", ":", "DEFAULT_LEVELS", ",", "}" ]
[ 4, 0 ]
[ 12, 5 ]
python
en
['en', 'error', 'th']
False
test_translated_model_serializer_language_filtering
(TMS, equipment, space_resource)
Tests that TranslatedModelSerializer handles translated fields correctly when some or all of them are empty or None. ResourceEquipment model is used in the tests because it has description field that allows blank values.
Tests that TranslatedModelSerializer handles translated fields correctly when some or all of them are empty or None.
def test_translated_model_serializer_language_filtering(TMS, equipment, space_resource): """ Tests that TranslatedModelSerializer handles translated fields correctly when some or all of them are empty or None. ResourceEquipment model is used in the tests because it has description field that allows...
[ "def", "test_translated_model_serializer_language_filtering", "(", "TMS", ",", "equipment", ",", "space_resource", ")", ":", "tms", "=", "TMS", "(", ")", "resource_equipment", "=", "ResourceEquipment", ".", "objects", ".", "create", "(", "equipment", "=", "equipment...
[ 18, 0 ]
[ 56, 48 ]
python
en
['en', 'error', 'th']
False
MultiDBChangepasswordManagementCommandTestCase.test_that_changepassword_command_with_database_option_uses_given_db
(self)
Executing the changepassword management command with a database option should operate on the specified DB
Executing the changepassword management command with a database option should operate on the specified DB
def test_that_changepassword_command_with_database_option_uses_given_db(self): """ Executing the changepassword management command with a database option should operate on the specified DB """ self.assertTrue(self.user.check_password('qwerty')) command = changepassword.Co...
[ "def", "test_that_changepassword_command_with_database_option_uses_given_db", "(", "self", ")", ":", "self", ".", "assertTrue", "(", "self", ".", "user", ".", "check_password", "(", "'qwerty'", ")", ")", "command", "=", "changepassword", ".", "Command", "(", ")", ...
[ 17, 4 ]
[ 30, 108 ]
python
en
['en', 'error', 'th']
False
MultiDBCreatesuperuserTestCase.test_createsuperuser_command_with_database_option
(self)
createsuperuser command should operate on specified DB
createsuperuser command should operate on specified DB
def test_createsuperuser_command_with_database_option(self): " createsuperuser command should operate on specified DB" new_io = StringIO() call_command( "createsuperuser", interactive=False, username="joe", email="joe@somewhere.org", d...
[ "def", "test_createsuperuser_command_with_database_option", "(", "self", ")", ":", "new_io", "=", "StringIO", "(", ")", "call_command", "(", "\"createsuperuser\"", ",", "interactive", "=", "False", ",", "username", "=", "\"joe\"", ",", "email", "=", "\"joe@somewhere...
[ 36, 4 ]
[ 55, 22 ]
python
en
['en', 'en', 'en']
True
Criterion.from_requirement
(cls, provider, requirement, parent)
Build an instance from a requirement.
Build an instance from a requirement.
def from_requirement(cls, provider, requirement, parent): """Build an instance from a requirement. """ candidates = provider.find_matches(requirement) criterion = cls( candidates=candidates, information=[RequirementInformation(requirement, parent)], in...
[ "def", "from_requirement", "(", "cls", ",", "provider", ",", "requirement", ",", "parent", ")", ":", "candidates", "=", "provider", ".", "find_matches", "(", "requirement", ")", "criterion", "=", "cls", "(", "candidates", "=", "candidates", ",", "information",...
[ 76, 4 ]
[ 87, 24 ]
python
en
['en', 'en', 'en']
True
Criterion.merged_with
(self, provider, requirement, parent)
Build a new instance from this and a new requirement.
Build a new instance from this and a new requirement.
def merged_with(self, provider, requirement, parent): """Build a new instance from this and a new requirement. """ infos = list(self.information) infos.append(RequirementInformation(requirement, parent)) candidates = [ c for c in self.candidates ...
[ "def", "merged_with", "(", "self", ",", "provider", ",", "requirement", ",", "parent", ")", ":", "infos", "=", "list", "(", "self", ".", "information", ")", "infos", ".", "append", "(", "RequirementInformation", "(", "requirement", ",", "parent", ")", ")",...
[ 95, 4 ]
[ 108, 24 ]
python
en
['en', 'en', 'en']
True
Criterion.excluded_of
(self, candidate)
Build a new instance from this, but excluding specified candidate. Returns the new instance, or None if we still have no valid candidates.
Build a new instance from this, but excluding specified candidate.
def excluded_of(self, candidate): """Build a new instance from this, but excluding specified candidate. Returns the new instance, or None if we still have no valid candidates. """ incompats = list(self.incompatibilities) incompats.append(candidate) candidates = [c for c ...
[ "def", "excluded_of", "(", "self", ",", "candidate", ")", ":", "incompats", "=", "list", "(", "self", ".", "incompatibilities", ")", "incompats", ".", "append", "(", "candidate", ")", "candidates", "=", "[", "c", "for", "c", "in", "self", ".", "candidate...
[ 110, 4 ]
[ 121, 24 ]
python
en
['en', 'en', 'en']
True
Resolution._push_new_state
(self)
Push a new state into history. This new state will be used to hold resolution results of the next coming round.
Push a new state into history.
def _push_new_state(self): """Push a new state into history. This new state will be used to hold resolution results of the next coming round. """ try: base = self._states[-1] except IndexError: state = State(mapping=collections.OrderedDict(), crit...
[ "def", "_push_new_state", "(", "self", ")", ":", "try", ":", "base", "=", "self", ".", "_states", "[", "-", "1", "]", "except", "IndexError", ":", "state", "=", "State", "(", "mapping", "=", "collections", ".", "OrderedDict", "(", ")", ",", "criteria",...
[ 164, 4 ]
[ 178, 34 ]
python
en
['en', 'en', 'en']
True