repo stringlengths 7 54 | path stringlengths 4 223 | func_name stringlengths 1 134 | original_string stringlengths 75 104k | language stringclasses 1
value | code stringlengths 75 104k | code_tokens listlengths 20 28.4k | docstring stringlengths 1 46.3k | docstring_tokens listlengths 1 1.66k | sha stringlengths 40 40 | url stringlengths 87 315 | partition stringclasses 1
value | summary stringlengths 4 350 | obf_code stringlengths 7.85k 764k |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
marshmallow-code/marshmallow | src/marshmallow/fields.py | Time._deserialize | def _deserialize(self, value, attr, data, **kwargs):
"""Deserialize an ISO8601-formatted time to a :class:`datetime.time` object."""
if not value: # falsy values are invalid
self.fail('invalid')
try:
return utils.from_iso_time(value)
except (AttributeError, TypeE... | python | def _deserialize(self, value, attr, data, **kwargs):
"""Deserialize an ISO8601-formatted time to a :class:`datetime.time` object."""
if not value: # falsy values are invalid
self.fail('invalid')
try:
return utils.from_iso_time(value)
except (AttributeError, TypeE... | [
"def",
"_deserialize",
"(",
"self",
",",
"value",
",",
"attr",
",",
"data",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"not",
"value",
":",
"# falsy values are invalid",
"self",
".",
"fail",
"(",
"'invalid'",
")",
"try",
":",
"return",
"utils",
".",
"fro... | Deserialize an ISO8601-formatted time to a :class:`datetime.time` object. | [
"Deserialize",
"an",
"ISO8601",
"-",
"formatted",
"time",
"to",
"a",
":",
"class",
":",
"datetime",
".",
"time",
"object",
"."
] | a6b6c4151f1fbf16f3774d4052ca2bddf6903750 | https://github.com/marshmallow-code/marshmallow/blob/a6b6c4151f1fbf16f3774d4052ca2bddf6903750/src/marshmallow/fields.py#L1143-L1150 | train | Deserialize an ISO8601 - formatted time to a datetime. time object. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
marshmallow-code/marshmallow | src/marshmallow/utils.py | is_instance_or_subclass | def is_instance_or_subclass(val, class_):
"""Return True if ``val`` is either a subclass or instance of ``class_``."""
try:
return issubclass(val, class_)
except TypeError:
return isinstance(val, class_) | python | def is_instance_or_subclass(val, class_):
"""Return True if ``val`` is either a subclass or instance of ``class_``."""
try:
return issubclass(val, class_)
except TypeError:
return isinstance(val, class_) | [
"def",
"is_instance_or_subclass",
"(",
"val",
",",
"class_",
")",
":",
"try",
":",
"return",
"issubclass",
"(",
"val",
",",
"class_",
")",
"except",
"TypeError",
":",
"return",
"isinstance",
"(",
"val",
",",
"class_",
")"
] | Return True if ``val`` is either a subclass or instance of ``class_``. | [
"Return",
"True",
"if",
"val",
"is",
"either",
"a",
"subclass",
"or",
"instance",
"of",
"class_",
"."
] | a6b6c4151f1fbf16f3774d4052ca2bddf6903750 | https://github.com/marshmallow-code/marshmallow/blob/a6b6c4151f1fbf16f3774d4052ca2bddf6903750/src/marshmallow/utils.py#L72-L77 | train | Return True if val is either a subclass or instance of class_. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
marshmallow-code/marshmallow | src/marshmallow/utils.py | pprint | def pprint(obj, *args, **kwargs):
"""Pretty-printing function that can pretty-print OrderedDicts
like regular dictionaries. Useful for printing the output of
:meth:`marshmallow.Schema.dump`.
"""
if isinstance(obj, collections.OrderedDict):
print(json.dumps(obj, *args, **kwargs))
else:
... | python | def pprint(obj, *args, **kwargs):
"""Pretty-printing function that can pretty-print OrderedDicts
like regular dictionaries. Useful for printing the output of
:meth:`marshmallow.Schema.dump`.
"""
if isinstance(obj, collections.OrderedDict):
print(json.dumps(obj, *args, **kwargs))
else:
... | [
"def",
"pprint",
"(",
"obj",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"isinstance",
"(",
"obj",
",",
"collections",
".",
"OrderedDict",
")",
":",
"print",
"(",
"json",
".",
"dumps",
"(",
"obj",
",",
"*",
"args",
",",
"*",
"*",
... | Pretty-printing function that can pretty-print OrderedDicts
like regular dictionaries. Useful for printing the output of
:meth:`marshmallow.Schema.dump`. | [
"Pretty",
"-",
"printing",
"function",
"that",
"can",
"pretty",
"-",
"print",
"OrderedDicts",
"like",
"regular",
"dictionaries",
".",
"Useful",
"for",
"printing",
"the",
"output",
"of",
":",
"meth",
":",
"marshmallow",
".",
"Schema",
".",
"dump",
"."
] | a6b6c4151f1fbf16f3774d4052ca2bddf6903750 | https://github.com/marshmallow-code/marshmallow/blob/a6b6c4151f1fbf16f3774d4052ca2bddf6903750/src/marshmallow/utils.py#L86-L94 | train | Pretty - print a dictionary or OrderedDict. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
marshmallow-code/marshmallow | src/marshmallow/utils.py | local_rfcformat | def local_rfcformat(dt):
"""Return the RFC822-formatted representation of a timezone-aware datetime
with the UTC offset.
"""
weekday = ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'][dt.weekday()]
month = [
'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep',
'Oct', 'Nov'... | python | def local_rfcformat(dt):
"""Return the RFC822-formatted representation of a timezone-aware datetime
with the UTC offset.
"""
weekday = ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'][dt.weekday()]
month = [
'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep',
'Oct', 'Nov'... | [
"def",
"local_rfcformat",
"(",
"dt",
")",
":",
"weekday",
"=",
"[",
"'Mon'",
",",
"'Tue'",
",",
"'Wed'",
",",
"'Thu'",
",",
"'Fri'",
",",
"'Sat'",
",",
"'Sun'",
"]",
"[",
"dt",
".",
"weekday",
"(",
")",
"]",
"month",
"=",
"[",
"'Jan'",
",",
"'Feb... | Return the RFC822-formatted representation of a timezone-aware datetime
with the UTC offset. | [
"Return",
"the",
"RFC822",
"-",
"formatted",
"representation",
"of",
"a",
"timezone",
"-",
"aware",
"datetime",
"with",
"the",
"UTC",
"offset",
"."
] | a6b6c4151f1fbf16f3774d4052ca2bddf6903750 | https://github.com/marshmallow-code/marshmallow/blob/a6b6c4151f1fbf16f3774d4052ca2bddf6903750/src/marshmallow/utils.py#L151-L164 | train | Return the RFC822 - formatted representation of a datetime object. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
marshmallow-code/marshmallow | src/marshmallow/utils.py | rfcformat | def rfcformat(dt, localtime=False):
"""Return the RFC822-formatted representation of a datetime object.
:param datetime dt: The datetime.
:param bool localtime: If ``True``, return the date relative to the local
timezone instead of UTC, displaying the proper offset,
e.g. "Sun, 10 Nov 2013 0... | python | def rfcformat(dt, localtime=False):
"""Return the RFC822-formatted representation of a datetime object.
:param datetime dt: The datetime.
:param bool localtime: If ``True``, return the date relative to the local
timezone instead of UTC, displaying the proper offset,
e.g. "Sun, 10 Nov 2013 0... | [
"def",
"rfcformat",
"(",
"dt",
",",
"localtime",
"=",
"False",
")",
":",
"if",
"not",
"localtime",
":",
"return",
"formatdate",
"(",
"timegm",
"(",
"dt",
".",
"utctimetuple",
"(",
")",
")",
")",
"else",
":",
"return",
"local_rfcformat",
"(",
"dt",
")"
... | Return the RFC822-formatted representation of a datetime object.
:param datetime dt: The datetime.
:param bool localtime: If ``True``, return the date relative to the local
timezone instead of UTC, displaying the proper offset,
e.g. "Sun, 10 Nov 2013 08:23:45 -0600" | [
"Return",
"the",
"RFC822",
"-",
"formatted",
"representation",
"of",
"a",
"datetime",
"object",
"."
] | a6b6c4151f1fbf16f3774d4052ca2bddf6903750 | https://github.com/marshmallow-code/marshmallow/blob/a6b6c4151f1fbf16f3774d4052ca2bddf6903750/src/marshmallow/utils.py#L167-L178 | train | Return the RFC822 - formatted representation of a datetime object. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
marshmallow-code/marshmallow | src/marshmallow/utils.py | isoformat | def isoformat(dt, localtime=False, *args, **kwargs):
"""Return the ISO8601-formatted UTC representation of a datetime object."""
if localtime and dt.tzinfo is not None:
localized = dt
else:
if dt.tzinfo is None:
localized = UTC.localize(dt)
else:
localized = d... | python | def isoformat(dt, localtime=False, *args, **kwargs):
"""Return the ISO8601-formatted UTC representation of a datetime object."""
if localtime and dt.tzinfo is not None:
localized = dt
else:
if dt.tzinfo is None:
localized = UTC.localize(dt)
else:
localized = d... | [
"def",
"isoformat",
"(",
"dt",
",",
"localtime",
"=",
"False",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"localtime",
"and",
"dt",
".",
"tzinfo",
"is",
"not",
"None",
":",
"localized",
"=",
"dt",
"else",
":",
"if",
"dt",
".",
"tz... | Return the ISO8601-formatted UTC representation of a datetime object. | [
"Return",
"the",
"ISO8601",
"-",
"formatted",
"UTC",
"representation",
"of",
"a",
"datetime",
"object",
"."
] | a6b6c4151f1fbf16f3774d4052ca2bddf6903750 | https://github.com/marshmallow-code/marshmallow/blob/a6b6c4151f1fbf16f3774d4052ca2bddf6903750/src/marshmallow/utils.py#L199-L208 | train | Return the ISO8601 - formatted UTC representation of a datetime object. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
marshmallow-code/marshmallow | src/marshmallow/utils.py | from_rfc | def from_rfc(datestring, use_dateutil=True):
"""Parse a RFC822-formatted datetime string and return a datetime object.
Use dateutil's parser if possible.
https://stackoverflow.com/questions/885015/how-to-parse-a-rfc-2822-date-time-into-a-python-datetime
"""
# Use dateutil's parser if possible
... | python | def from_rfc(datestring, use_dateutil=True):
"""Parse a RFC822-formatted datetime string and return a datetime object.
Use dateutil's parser if possible.
https://stackoverflow.com/questions/885015/how-to-parse-a-rfc-2822-date-time-into-a-python-datetime
"""
# Use dateutil's parser if possible
... | [
"def",
"from_rfc",
"(",
"datestring",
",",
"use_dateutil",
"=",
"True",
")",
":",
"# Use dateutil's parser if possible",
"if",
"dateutil_available",
"and",
"use_dateutil",
":",
"return",
"parser",
".",
"parse",
"(",
"datestring",
")",
"else",
":",
"parsed",
"=",
... | Parse a RFC822-formatted datetime string and return a datetime object.
Use dateutil's parser if possible.
https://stackoverflow.com/questions/885015/how-to-parse-a-rfc-2822-date-time-into-a-python-datetime | [
"Parse",
"a",
"RFC822",
"-",
"formatted",
"datetime",
"string",
"and",
"return",
"a",
"datetime",
"object",
"."
] | a6b6c4151f1fbf16f3774d4052ca2bddf6903750 | https://github.com/marshmallow-code/marshmallow/blob/a6b6c4151f1fbf16f3774d4052ca2bddf6903750/src/marshmallow/utils.py#L211-L224 | train | Parse a RFC822 - formatted datetime string and return a datetime object. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
marshmallow-code/marshmallow | src/marshmallow/utils.py | from_iso_datetime | def from_iso_datetime(datetimestring, use_dateutil=True):
"""Parse an ISO8601-formatted datetime string and return a datetime object.
Use dateutil's parser if possible and return a timezone-aware datetime.
"""
if not _iso8601_datetime_re.match(datetimestring):
raise ValueError('Not a valid ISO8... | python | def from_iso_datetime(datetimestring, use_dateutil=True):
"""Parse an ISO8601-formatted datetime string and return a datetime object.
Use dateutil's parser if possible and return a timezone-aware datetime.
"""
if not _iso8601_datetime_re.match(datetimestring):
raise ValueError('Not a valid ISO8... | [
"def",
"from_iso_datetime",
"(",
"datetimestring",
",",
"use_dateutil",
"=",
"True",
")",
":",
"if",
"not",
"_iso8601_datetime_re",
".",
"match",
"(",
"datetimestring",
")",
":",
"raise",
"ValueError",
"(",
"'Not a valid ISO8601-formatted datetime string'",
")",
"# Us... | Parse an ISO8601-formatted datetime string and return a datetime object.
Use dateutil's parser if possible and return a timezone-aware datetime. | [
"Parse",
"an",
"ISO8601",
"-",
"formatted",
"datetime",
"string",
"and",
"return",
"a",
"datetime",
"object",
"."
] | a6b6c4151f1fbf16f3774d4052ca2bddf6903750 | https://github.com/marshmallow-code/marshmallow/blob/a6b6c4151f1fbf16f3774d4052ca2bddf6903750/src/marshmallow/utils.py#L227-L239 | train | Parse an ISO8601 - formatted datetime string and return a datetime object. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
marshmallow-code/marshmallow | src/marshmallow/utils.py | from_iso_time | def from_iso_time(timestring, use_dateutil=True):
"""Parse an ISO8601-formatted datetime string and return a datetime.time
object.
"""
if not _iso8601_time_re.match(timestring):
raise ValueError('Not a valid ISO8601-formatted time string')
if dateutil_available and use_dateutil:
retu... | python | def from_iso_time(timestring, use_dateutil=True):
"""Parse an ISO8601-formatted datetime string and return a datetime.time
object.
"""
if not _iso8601_time_re.match(timestring):
raise ValueError('Not a valid ISO8601-formatted time string')
if dateutil_available and use_dateutil:
retu... | [
"def",
"from_iso_time",
"(",
"timestring",
",",
"use_dateutil",
"=",
"True",
")",
":",
"if",
"not",
"_iso8601_time_re",
".",
"match",
"(",
"timestring",
")",
":",
"raise",
"ValueError",
"(",
"'Not a valid ISO8601-formatted time string'",
")",
"if",
"dateutil_availab... | Parse an ISO8601-formatted datetime string and return a datetime.time
object. | [
"Parse",
"an",
"ISO8601",
"-",
"formatted",
"datetime",
"string",
"and",
"return",
"a",
"datetime",
".",
"time",
"object",
"."
] | a6b6c4151f1fbf16f3774d4052ca2bddf6903750 | https://github.com/marshmallow-code/marshmallow/blob/a6b6c4151f1fbf16f3774d4052ca2bddf6903750/src/marshmallow/utils.py#L242-L255 | train | Parse an ISO8601 - formatted datetime string and return a datetime. time
object. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
marshmallow-code/marshmallow | src/marshmallow/utils.py | set_value | def set_value(dct, key, value):
"""Set a value in a dict. If `key` contains a '.', it is assumed
be a path (i.e. dot-delimited string) to the value's location.
::
>>> d = {}
>>> set_value(d, 'foo.bar', 42)
>>> d
{'foo': {'bar': 42}}
"""
if '.' in key:
head, ... | python | def set_value(dct, key, value):
"""Set a value in a dict. If `key` contains a '.', it is assumed
be a path (i.e. dot-delimited string) to the value's location.
::
>>> d = {}
>>> set_value(d, 'foo.bar', 42)
>>> d
{'foo': {'bar': 42}}
"""
if '.' in key:
head, ... | [
"def",
"set_value",
"(",
"dct",
",",
"key",
",",
"value",
")",
":",
"if",
"'.'",
"in",
"key",
":",
"head",
",",
"rest",
"=",
"key",
".",
"split",
"(",
"'.'",
",",
"1",
")",
"target",
"=",
"dct",
".",
"setdefault",
"(",
"head",
",",
"{",
"}",
... | Set a value in a dict. If `key` contains a '.', it is assumed
be a path (i.e. dot-delimited string) to the value's location.
::
>>> d = {}
>>> set_value(d, 'foo.bar', 42)
>>> d
{'foo': {'bar': 42}} | [
"Set",
"a",
"value",
"in",
"a",
"dict",
".",
"If",
"key",
"contains",
"a",
".",
"it",
"is",
"assumed",
"be",
"a",
"path",
"(",
"i",
".",
"e",
".",
"dot",
"-",
"delimited",
"string",
")",
"to",
"the",
"value",
"s",
"location",
"."
] | a6b6c4151f1fbf16f3774d4052ca2bddf6903750 | https://github.com/marshmallow-code/marshmallow/blob/a6b6c4151f1fbf16f3774d4052ca2bddf6903750/src/marshmallow/utils.py#L323-L344 | train | Set a value in a dict. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
marshmallow-code/marshmallow | src/marshmallow/utils.py | get_func_args | def get_func_args(func):
"""Given a callable, return a tuple of argument names. Handles
`functools.partial` objects and class-based callables.
.. versionchanged:: 3.0.0a1
Do not return bound arguments, eg. ``self``.
"""
if isinstance(func, functools.partial):
return _signature(func.... | python | def get_func_args(func):
"""Given a callable, return a tuple of argument names. Handles
`functools.partial` objects and class-based callables.
.. versionchanged:: 3.0.0a1
Do not return bound arguments, eg. ``self``.
"""
if isinstance(func, functools.partial):
return _signature(func.... | [
"def",
"get_func_args",
"(",
"func",
")",
":",
"if",
"isinstance",
"(",
"func",
",",
"functools",
".",
"partial",
")",
":",
"return",
"_signature",
"(",
"func",
".",
"func",
")",
"if",
"inspect",
".",
"isfunction",
"(",
"func",
")",
"or",
"inspect",
".... | Given a callable, return a tuple of argument names. Handles
`functools.partial` objects and class-based callables.
.. versionchanged:: 3.0.0a1
Do not return bound arguments, eg. ``self``. | [
"Given",
"a",
"callable",
"return",
"a",
"tuple",
"of",
"argument",
"names",
".",
"Handles",
"functools",
".",
"partial",
"objects",
"and",
"class",
"-",
"based",
"callables",
"."
] | a6b6c4151f1fbf16f3774d4052ca2bddf6903750 | https://github.com/marshmallow-code/marshmallow/blob/a6b6c4151f1fbf16f3774d4052ca2bddf6903750/src/marshmallow/utils.py#L365-L377 | train | Given a callable return a tuple of argument names. Handles
functools. partial objects and functools. class - based callables. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
marshmallow-code/marshmallow | src/marshmallow/utils.py | resolve_field_instance | def resolve_field_instance(cls_or_instance):
"""Return a Schema instance from a Schema class or instance.
:param type|Schema cls_or_instance: Marshmallow Schema class or instance.
"""
if isinstance(cls_or_instance, type):
if not issubclass(cls_or_instance, FieldABC):
raise FieldInst... | python | def resolve_field_instance(cls_or_instance):
"""Return a Schema instance from a Schema class or instance.
:param type|Schema cls_or_instance: Marshmallow Schema class or instance.
"""
if isinstance(cls_or_instance, type):
if not issubclass(cls_or_instance, FieldABC):
raise FieldInst... | [
"def",
"resolve_field_instance",
"(",
"cls_or_instance",
")",
":",
"if",
"isinstance",
"(",
"cls_or_instance",
",",
"type",
")",
":",
"if",
"not",
"issubclass",
"(",
"cls_or_instance",
",",
"FieldABC",
")",
":",
"raise",
"FieldInstanceResolutionError",
"return",
"... | Return a Schema instance from a Schema class or instance.
:param type|Schema cls_or_instance: Marshmallow Schema class or instance. | [
"Return",
"a",
"Schema",
"instance",
"from",
"a",
"Schema",
"class",
"or",
"instance",
"."
] | a6b6c4151f1fbf16f3774d4052ca2bddf6903750 | https://github.com/marshmallow-code/marshmallow/blob/a6b6c4151f1fbf16f3774d4052ca2bddf6903750/src/marshmallow/utils.py#L380-L392 | train | Return a Schema instance from a Marshmallow Schema class or instance. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
marshmallow-code/marshmallow | src/marshmallow/utils.py | UTC.localize | def localize(self, dt, is_dst=False):
"""Convert naive time to local time"""
if dt.tzinfo is not None:
raise ValueError('Not naive datetime (tzinfo is already set)')
return dt.replace(tzinfo=self) | python | def localize(self, dt, is_dst=False):
"""Convert naive time to local time"""
if dt.tzinfo is not None:
raise ValueError('Not naive datetime (tzinfo is already set)')
return dt.replace(tzinfo=self) | [
"def",
"localize",
"(",
"self",
",",
"dt",
",",
"is_dst",
"=",
"False",
")",
":",
"if",
"dt",
".",
"tzinfo",
"is",
"not",
"None",
":",
"raise",
"ValueError",
"(",
"'Not naive datetime (tzinfo is already set)'",
")",
"return",
"dt",
".",
"replace",
"(",
"tz... | Convert naive time to local time | [
"Convert",
"naive",
"time",
"to",
"local",
"time"
] | a6b6c4151f1fbf16f3774d4052ca2bddf6903750 | https://github.com/marshmallow-code/marshmallow/blob/a6b6c4151f1fbf16f3774d4052ca2bddf6903750/src/marshmallow/utils.py#L127-L131 | train | Convert naive time to local time | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
marshmallow-code/marshmallow | src/marshmallow/utils.py | UTC.normalize | def normalize(self, dt, is_dst=False):
"""Correct the timezone information on the given datetime"""
if dt.tzinfo is self:
return dt
if dt.tzinfo is None:
raise ValueError('Naive time - no tzinfo set')
return dt.astimezone(self) | python | def normalize(self, dt, is_dst=False):
"""Correct the timezone information on the given datetime"""
if dt.tzinfo is self:
return dt
if dt.tzinfo is None:
raise ValueError('Naive time - no tzinfo set')
return dt.astimezone(self) | [
"def",
"normalize",
"(",
"self",
",",
"dt",
",",
"is_dst",
"=",
"False",
")",
":",
"if",
"dt",
".",
"tzinfo",
"is",
"self",
":",
"return",
"dt",
"if",
"dt",
".",
"tzinfo",
"is",
"None",
":",
"raise",
"ValueError",
"(",
"'Naive time - no tzinfo set'",
"... | Correct the timezone information on the given datetime | [
"Correct",
"the",
"timezone",
"information",
"on",
"the",
"given",
"datetime"
] | a6b6c4151f1fbf16f3774d4052ca2bddf6903750 | https://github.com/marshmallow-code/marshmallow/blob/a6b6c4151f1fbf16f3774d4052ca2bddf6903750/src/marshmallow/utils.py#L133-L139 | train | Correct the timezone information on the given datetime | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
marshmallow-code/marshmallow | examples/peewee_example.py | check_auth | def check_auth(email, password):
"""Check if a username/password combination is valid.
"""
try:
user = User.get(User.email == email)
except User.DoesNotExist:
return False
return password == user.password | python | def check_auth(email, password):
"""Check if a username/password combination is valid.
"""
try:
user = User.get(User.email == email)
except User.DoesNotExist:
return False
return password == user.password | [
"def",
"check_auth",
"(",
"email",
",",
"password",
")",
":",
"try",
":",
"user",
"=",
"User",
".",
"get",
"(",
"User",
".",
"email",
"==",
"email",
")",
"except",
"User",
".",
"DoesNotExist",
":",
"return",
"False",
"return",
"password",
"==",
"user",... | Check if a username/password combination is valid. | [
"Check",
"if",
"a",
"username",
"/",
"password",
"combination",
"is",
"valid",
"."
] | a6b6c4151f1fbf16f3774d4052ca2bddf6903750 | https://github.com/marshmallow-code/marshmallow/blob/a6b6c4151f1fbf16f3774d4052ca2bddf6903750/examples/peewee_example.py#L100-L107 | train | Check if a username and password combination is valid. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
pennersr/django-allauth | allauth/account/auth_backends.py | AuthenticationBackend._stash_user | def _stash_user(cls, user):
"""Now, be aware, the following is quite ugly, let me explain:
Even if the user credentials match, the authentication can fail because
Django's default ModelBackend calls user_can_authenticate(), which
checks `is_active`. Now, earlier versions of allauth did ... | python | def _stash_user(cls, user):
"""Now, be aware, the following is quite ugly, let me explain:
Even if the user credentials match, the authentication can fail because
Django's default ModelBackend calls user_can_authenticate(), which
checks `is_active`. Now, earlier versions of allauth did ... | [
"def",
"_stash_user",
"(",
"cls",
",",
"user",
")",
":",
"global",
"_stash",
"ret",
"=",
"getattr",
"(",
"_stash",
",",
"'user'",
",",
"None",
")",
"_stash",
".",
"user",
"=",
"user",
"return",
"ret"
] | Now, be aware, the following is quite ugly, let me explain:
Even if the user credentials match, the authentication can fail because
Django's default ModelBackend calls user_can_authenticate(), which
checks `is_active`. Now, earlier versions of allauth did not do this
and simply returned... | [
"Now",
"be",
"aware",
"the",
"following",
"is",
"quite",
"ugly",
"let",
"me",
"explain",
":"
] | f70cb3d622f992f15fe9b57098e0b328445b664e | https://github.com/pennersr/django-allauth/blob/f70cb3d622f992f15fe9b57098e0b328445b664e/allauth/account/auth_backends.py#L68-L93 | train | Stashes the user in the _stash dictionary. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
pennersr/django-allauth | allauth/socialaccount/providers/bitbucket_oauth2/views.py | BitbucketOAuth2Adapter.get_email | def get_email(self, token):
"""Fetches email address from email API endpoint"""
resp = requests.get(self.emails_url,
params={'access_token': token.token})
emails = resp.json().get('values', [])
email = ''
try:
email = emails[0].get('email')... | python | def get_email(self, token):
"""Fetches email address from email API endpoint"""
resp = requests.get(self.emails_url,
params={'access_token': token.token})
emails = resp.json().get('values', [])
email = ''
try:
email = emails[0].get('email')... | [
"def",
"get_email",
"(",
"self",
",",
"token",
")",
":",
"resp",
"=",
"requests",
".",
"get",
"(",
"self",
".",
"emails_url",
",",
"params",
"=",
"{",
"'access_token'",
":",
"token",
".",
"token",
"}",
")",
"emails",
"=",
"resp",
".",
"json",
"(",
... | Fetches email address from email API endpoint | [
"Fetches",
"email",
"address",
"from",
"email",
"API",
"endpoint"
] | f70cb3d622f992f15fe9b57098e0b328445b664e | https://github.com/pennersr/django-allauth/blob/f70cb3d622f992f15fe9b57098e0b328445b664e/allauth/socialaccount/providers/bitbucket_oauth2/views.py#L29-L42 | train | Fetches email address from email API endpoint | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
pennersr/django-allauth | allauth/account/adapter.py | DefaultAccountAdapter.is_email_verified | def is_email_verified(self, request, email):
"""
Checks whether or not the email address is already verified
beyond allauth scope, for example, by having accepted an
invitation before signing up.
"""
ret = False
verified_email = request.session.get('account_verifi... | python | def is_email_verified(self, request, email):
"""
Checks whether or not the email address is already verified
beyond allauth scope, for example, by having accepted an
invitation before signing up.
"""
ret = False
verified_email = request.session.get('account_verifi... | [
"def",
"is_email_verified",
"(",
"self",
",",
"request",
",",
"email",
")",
":",
"ret",
"=",
"False",
"verified_email",
"=",
"request",
".",
"session",
".",
"get",
"(",
"'account_verified_email'",
")",
"if",
"verified_email",
":",
"ret",
"=",
"verified_email",... | Checks whether or not the email address is already verified
beyond allauth scope, for example, by having accepted an
invitation before signing up. | [
"Checks",
"whether",
"or",
"not",
"the",
"email",
"address",
"is",
"already",
"verified",
"beyond",
"allauth",
"scope",
"for",
"example",
"by",
"having",
"accepted",
"an",
"invitation",
"before",
"signing",
"up",
"."
] | f70cb3d622f992f15fe9b57098e0b328445b664e | https://github.com/pennersr/django-allauth/blob/f70cb3d622f992f15fe9b57098e0b328445b664e/allauth/account/adapter.py#L71-L81 | train | Checks whether or not the email address is already verified by allauth scope. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
pennersr/django-allauth | allauth/account/adapter.py | DefaultAccountAdapter.get_login_redirect_url | def get_login_redirect_url(self, request):
"""
Returns the default URL to redirect to after logging in. Note
that URLs passed explicitly (e.g. by passing along a `next`
GET parameter) take precedence over the value returned here.
"""
assert request.user.is_authenticated
... | python | def get_login_redirect_url(self, request):
"""
Returns the default URL to redirect to after logging in. Note
that URLs passed explicitly (e.g. by passing along a `next`
GET parameter) take precedence over the value returned here.
"""
assert request.user.is_authenticated
... | [
"def",
"get_login_redirect_url",
"(",
"self",
",",
"request",
")",
":",
"assert",
"request",
".",
"user",
".",
"is_authenticated",
"url",
"=",
"getattr",
"(",
"settings",
",",
"\"LOGIN_REDIRECT_URLNAME\"",
",",
"None",
")",
"if",
"url",
":",
"warnings",
".",
... | Returns the default URL to redirect to after logging in. Note
that URLs passed explicitly (e.g. by passing along a `next`
GET parameter) take precedence over the value returned here. | [
"Returns",
"the",
"default",
"URL",
"to",
"redirect",
"to",
"after",
"logging",
"in",
".",
"Note",
"that",
"URLs",
"passed",
"explicitly",
"(",
"e",
".",
"g",
".",
"by",
"passing",
"along",
"a",
"next",
"GET",
"parameter",
")",
"take",
"precedence",
"ove... | f70cb3d622f992f15fe9b57098e0b328445b664e | https://github.com/pennersr/django-allauth/blob/f70cb3d622f992f15fe9b57098e0b328445b664e/allauth/account/adapter.py#L139-L153 | train | Returns the URL to redirect to after logging in. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
pennersr/django-allauth | allauth/account/adapter.py | DefaultAccountAdapter.get_email_confirmation_redirect_url | def get_email_confirmation_redirect_url(self, request):
"""
The URL to return to after successful e-mail confirmation.
"""
if request.user.is_authenticated:
if app_settings.EMAIL_CONFIRMATION_AUTHENTICATED_REDIRECT_URL:
return \
app_settin... | python | def get_email_confirmation_redirect_url(self, request):
"""
The URL to return to after successful e-mail confirmation.
"""
if request.user.is_authenticated:
if app_settings.EMAIL_CONFIRMATION_AUTHENTICATED_REDIRECT_URL:
return \
app_settin... | [
"def",
"get_email_confirmation_redirect_url",
"(",
"self",
",",
"request",
")",
":",
"if",
"request",
".",
"user",
".",
"is_authenticated",
":",
"if",
"app_settings",
".",
"EMAIL_CONFIRMATION_AUTHENTICATED_REDIRECT_URL",
":",
"return",
"app_settings",
".",
"EMAIL_CONFIR... | The URL to return to after successful e-mail confirmation. | [
"The",
"URL",
"to",
"return",
"to",
"after",
"successful",
"e",
"-",
"mail",
"confirmation",
"."
] | f70cb3d622f992f15fe9b57098e0b328445b664e | https://github.com/pennersr/django-allauth/blob/f70cb3d622f992f15fe9b57098e0b328445b664e/allauth/account/adapter.py#L164-L175 | train | Returns the URL to return to after successful e - mail confirmation. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
pennersr/django-allauth | allauth/account/adapter.py | DefaultAccountAdapter.populate_username | def populate_username(self, request, user):
"""
Fills in a valid username, if required and missing. If the
username is already present it is assumed to be valid
(unique).
"""
from .utils import user_username, user_email, user_field
first_name = user_field(user, '... | python | def populate_username(self, request, user):
"""
Fills in a valid username, if required and missing. If the
username is already present it is assumed to be valid
(unique).
"""
from .utils import user_username, user_email, user_field
first_name = user_field(user, '... | [
"def",
"populate_username",
"(",
"self",
",",
"request",
",",
"user",
")",
":",
"from",
".",
"utils",
"import",
"user_username",
",",
"user_email",
",",
"user_field",
"first_name",
"=",
"user_field",
"(",
"user",
",",
"'first_name'",
")",
"last_name",
"=",
"... | Fills in a valid username, if required and missing. If the
username is already present it is assumed to be valid
(unique). | [
"Fills",
"in",
"a",
"valid",
"username",
"if",
"required",
"and",
"missing",
".",
"If",
"the",
"username",
"is",
"already",
"present",
"it",
"is",
"assumed",
"to",
"be",
"valid",
"(",
"unique",
")",
"."
] | f70cb3d622f992f15fe9b57098e0b328445b664e | https://github.com/pennersr/django-allauth/blob/f70cb3d622f992f15fe9b57098e0b328445b664e/allauth/account/adapter.py#L193-L212 | train | Populates the username field of the user model with the user s username. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
pennersr/django-allauth | allauth/account/adapter.py | DefaultAccountAdapter.save_user | def save_user(self, request, user, form, commit=True):
"""
Saves a new `User` instance using information provided in the
signup form.
"""
from .utils import user_username, user_email, user_field
data = form.cleaned_data
first_name = data.get('first_name')
... | python | def save_user(self, request, user, form, commit=True):
"""
Saves a new `User` instance using information provided in the
signup form.
"""
from .utils import user_username, user_email, user_field
data = form.cleaned_data
first_name = data.get('first_name')
... | [
"def",
"save_user",
"(",
"self",
",",
"request",
",",
"user",
",",
"form",
",",
"commit",
"=",
"True",
")",
":",
"from",
".",
"utils",
"import",
"user_username",
",",
"user_email",
",",
"user_field",
"data",
"=",
"form",
".",
"cleaned_data",
"first_name",
... | Saves a new `User` instance using information provided in the
signup form. | [
"Saves",
"a",
"new",
"User",
"instance",
"using",
"information",
"provided",
"in",
"the",
"signup",
"form",
"."
] | f70cb3d622f992f15fe9b57098e0b328445b664e | https://github.com/pennersr/django-allauth/blob/f70cb3d622f992f15fe9b57098e0b328445b664e/allauth/account/adapter.py#L217-L244 | train | Save a user instance using information provided in the theLogoutForm. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
pennersr/django-allauth | allauth/account/adapter.py | DefaultAccountAdapter.clean_username | def clean_username(self, username, shallow=False):
"""
Validates the username. You can hook into this if you want to
(dynamically) restrict what usernames can be chosen.
"""
for validator in app_settings.USERNAME_VALIDATORS:
validator(username)
# TODO: Add re... | python | def clean_username(self, username, shallow=False):
"""
Validates the username. You can hook into this if you want to
(dynamically) restrict what usernames can be chosen.
"""
for validator in app_settings.USERNAME_VALIDATORS:
validator(username)
# TODO: Add re... | [
"def",
"clean_username",
"(",
"self",
",",
"username",
",",
"shallow",
"=",
"False",
")",
":",
"for",
"validator",
"in",
"app_settings",
".",
"USERNAME_VALIDATORS",
":",
"validator",
"(",
"username",
")",
"# TODO: Add regexp support to USERNAME_BLACKLIST",
"username_b... | Validates the username. You can hook into this if you want to
(dynamically) restrict what usernames can be chosen. | [
"Validates",
"the",
"username",
".",
"You",
"can",
"hook",
"into",
"this",
"if",
"you",
"want",
"to",
"(",
"dynamically",
")",
"restrict",
"what",
"usernames",
"can",
"be",
"chosen",
"."
] | f70cb3d622f992f15fe9b57098e0b328445b664e | https://github.com/pennersr/django-allauth/blob/f70cb3d622f992f15fe9b57098e0b328445b664e/allauth/account/adapter.py#L246-L278 | train | Validates the username and returns the username that is valid. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
pennersr/django-allauth | allauth/account/adapter.py | DefaultAccountAdapter.clean_password | def clean_password(self, password, user=None):
"""
Validates a password. You can hook into this if you want to
restric the allowed password choices.
"""
min_length = app_settings.PASSWORD_MIN_LENGTH
if min_length and len(password) < min_length:
raise forms.Val... | python | def clean_password(self, password, user=None):
"""
Validates a password. You can hook into this if you want to
restric the allowed password choices.
"""
min_length = app_settings.PASSWORD_MIN_LENGTH
if min_length and len(password) < min_length:
raise forms.Val... | [
"def",
"clean_password",
"(",
"self",
",",
"password",
",",
"user",
"=",
"None",
")",
":",
"min_length",
"=",
"app_settings",
".",
"PASSWORD_MIN_LENGTH",
"if",
"min_length",
"and",
"len",
"(",
"password",
")",
"<",
"min_length",
":",
"raise",
"forms",
".",
... | Validates a password. You can hook into this if you want to
restric the allowed password choices. | [
"Validates",
"a",
"password",
".",
"You",
"can",
"hook",
"into",
"this",
"if",
"you",
"want",
"to",
"restric",
"the",
"allowed",
"password",
"choices",
"."
] | f70cb3d622f992f15fe9b57098e0b328445b664e | https://github.com/pennersr/django-allauth/blob/f70cb3d622f992f15fe9b57098e0b328445b664e/allauth/account/adapter.py#L287-L297 | train | Validates a password and returns a cleaned version of it. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
pennersr/django-allauth | allauth/account/adapter.py | DefaultAccountAdapter.add_message | def add_message(self, request, level, message_template,
message_context=None, extra_tags=''):
"""
Wrapper of `django.contrib.messages.add_message`, that reads
the message text from a template.
"""
if 'django.contrib.messages' in settings.INSTALLED_APPS:
... | python | def add_message(self, request, level, message_template,
message_context=None, extra_tags=''):
"""
Wrapper of `django.contrib.messages.add_message`, that reads
the message text from a template.
"""
if 'django.contrib.messages' in settings.INSTALLED_APPS:
... | [
"def",
"add_message",
"(",
"self",
",",
"request",
",",
"level",
",",
"message_template",
",",
"message_context",
"=",
"None",
",",
"extra_tags",
"=",
"''",
")",
":",
"if",
"'django.contrib.messages'",
"in",
"settings",
".",
"INSTALLED_APPS",
":",
"try",
":",
... | Wrapper of `django.contrib.messages.add_message`, that reads
the message text from a template. | [
"Wrapper",
"of",
"django",
".",
"contrib",
".",
"messages",
".",
"add_message",
"that",
"reads",
"the",
"message",
"text",
"from",
"a",
"template",
"."
] | f70cb3d622f992f15fe9b57098e0b328445b664e | https://github.com/pennersr/django-allauth/blob/f70cb3d622f992f15fe9b57098e0b328445b664e/allauth/account/adapter.py#L304-L320 | train | Wrapper of django. contrib. messages. add_message that reads the message text from a template and writes it to the internal cache. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
pennersr/django-allauth | allauth/account/adapter.py | DefaultAccountAdapter.confirm_email | def confirm_email(self, request, email_address):
"""
Marks the email address as confirmed on the db
"""
email_address.verified = True
email_address.set_as_primary(conditional=True)
email_address.save() | python | def confirm_email(self, request, email_address):
"""
Marks the email address as confirmed on the db
"""
email_address.verified = True
email_address.set_as_primary(conditional=True)
email_address.save() | [
"def",
"confirm_email",
"(",
"self",
",",
"request",
",",
"email_address",
")",
":",
"email_address",
".",
"verified",
"=",
"True",
"email_address",
".",
"set_as_primary",
"(",
"conditional",
"=",
"True",
")",
"email_address",
".",
"save",
"(",
")"
] | Marks the email address as confirmed on the db | [
"Marks",
"the",
"email",
"address",
"as",
"confirmed",
"on",
"the",
"db"
] | f70cb3d622f992f15fe9b57098e0b328445b664e | https://github.com/pennersr/django-allauth/blob/f70cb3d622f992f15fe9b57098e0b328445b664e/allauth/account/adapter.py#L396-L402 | train | Confirm the email address | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
pennersr/django-allauth | allauth/account/adapter.py | DefaultAccountAdapter.get_email_confirmation_url | def get_email_confirmation_url(self, request, emailconfirmation):
"""Constructs the email confirmation (activation) url.
Note that if you have architected your system such that email
confirmations are sent outside of the request context `request`
can be `None` here.
"""
... | python | def get_email_confirmation_url(self, request, emailconfirmation):
"""Constructs the email confirmation (activation) url.
Note that if you have architected your system such that email
confirmations are sent outside of the request context `request`
can be `None` here.
"""
... | [
"def",
"get_email_confirmation_url",
"(",
"self",
",",
"request",
",",
"emailconfirmation",
")",
":",
"url",
"=",
"reverse",
"(",
"\"account_confirm_email\"",
",",
"args",
"=",
"[",
"emailconfirmation",
".",
"key",
"]",
")",
"ret",
"=",
"build_absolute_uri",
"("... | Constructs the email confirmation (activation) url.
Note that if you have architected your system such that email
confirmations are sent outside of the request context `request`
can be `None` here. | [
"Constructs",
"the",
"email",
"confirmation",
"(",
"activation",
")",
"url",
"."
] | f70cb3d622f992f15fe9b57098e0b328445b664e | https://github.com/pennersr/django-allauth/blob/f70cb3d622f992f15fe9b57098e0b328445b664e/allauth/account/adapter.py#L418-L431 | train | Constructs the email confirmation url. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
pennersr/django-allauth | allauth/account/adapter.py | DefaultAccountAdapter.authenticate | def authenticate(self, request, **credentials):
"""Only authenticates, does not actually login. See `login`"""
from allauth.account.auth_backends import AuthenticationBackend
self.pre_authenticate(request, **credentials)
AuthenticationBackend.unstash_authenticated_user()
user = ... | python | def authenticate(self, request, **credentials):
"""Only authenticates, does not actually login. See `login`"""
from allauth.account.auth_backends import AuthenticationBackend
self.pre_authenticate(request, **credentials)
AuthenticationBackend.unstash_authenticated_user()
user = ... | [
"def",
"authenticate",
"(",
"self",
",",
"request",
",",
"*",
"*",
"credentials",
")",
":",
"from",
"allauth",
".",
"account",
".",
"auth_backends",
"import",
"AuthenticationBackend",
"self",
".",
"pre_authenticate",
"(",
"request",
",",
"*",
"*",
"credentials... | Only authenticates, does not actually login. See `login` | [
"Only",
"authenticates",
"does",
"not",
"actually",
"login",
".",
"See",
"login"
] | f70cb3d622f992f15fe9b57098e0b328445b664e | https://github.com/pennersr/django-allauth/blob/f70cb3d622f992f15fe9b57098e0b328445b664e/allauth/account/adapter.py#L483-L498 | train | Only authenticates does not actually login. See login. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
pennersr/django-allauth | allauth/socialaccount/providers/mailchimp/provider.py | MailChimpProvider.extract_common_fields | def extract_common_fields(self, data):
"""Extract fields from a metadata query."""
return dict(
dc=data.get('dc'),
role=data.get('role'),
account_name=data.get('accountname'),
user_id=data.get('user_id'),
login=data.get('login'),
lo... | python | def extract_common_fields(self, data):
"""Extract fields from a metadata query."""
return dict(
dc=data.get('dc'),
role=data.get('role'),
account_name=data.get('accountname'),
user_id=data.get('user_id'),
login=data.get('login'),
lo... | [
"def",
"extract_common_fields",
"(",
"self",
",",
"data",
")",
":",
"return",
"dict",
"(",
"dc",
"=",
"data",
".",
"get",
"(",
"'dc'",
")",
",",
"role",
"=",
"data",
".",
"get",
"(",
"'role'",
")",
",",
"account_name",
"=",
"data",
".",
"get",
"(",... | Extract fields from a metadata query. | [
"Extract",
"fields",
"from",
"a",
"metadata",
"query",
"."
] | f70cb3d622f992f15fe9b57098e0b328445b664e | https://github.com/pennersr/django-allauth/blob/f70cb3d622f992f15fe9b57098e0b328445b664e/allauth/socialaccount/providers/mailchimp/provider.py#L35-L45 | train | Extract fields from a metadata query. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
pennersr/django-allauth | allauth/socialaccount/providers/linkedin/views.py | LinkedInAPI.to_dict | def to_dict(self, xml):
"""
Convert XML structure to dict recursively, repeated keys
entries are returned as in list containers.
"""
children = list(xml)
if not children:
return xml.text
else:
out = {}
for node in list(xml):
... | python | def to_dict(self, xml):
"""
Convert XML structure to dict recursively, repeated keys
entries are returned as in list containers.
"""
children = list(xml)
if not children:
return xml.text
else:
out = {}
for node in list(xml):
... | [
"def",
"to_dict",
"(",
"self",
",",
"xml",
")",
":",
"children",
"=",
"list",
"(",
"xml",
")",
"if",
"not",
"children",
":",
"return",
"xml",
".",
"text",
"else",
":",
"out",
"=",
"{",
"}",
"for",
"node",
"in",
"list",
"(",
"xml",
")",
":",
"if... | Convert XML structure to dict recursively, repeated keys
entries are returned as in list containers. | [
"Convert",
"XML",
"structure",
"to",
"dict",
"recursively",
"repeated",
"keys",
"entries",
"are",
"returned",
"as",
"in",
"list",
"containers",
"."
] | f70cb3d622f992f15fe9b57098e0b328445b664e | https://github.com/pennersr/django-allauth/blob/f70cb3d622f992f15fe9b57098e0b328445b664e/allauth/socialaccount/providers/linkedin/views.py#L32-L49 | train | Convert XML structure to dict recursively | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
pennersr/django-allauth | allauth/socialaccount/templatetags/socialaccount.py | provider_login_url | def provider_login_url(parser, token):
"""
{% provider_login_url "facebook" next=bla %}
{% provider_login_url "openid" openid="http://me.yahoo.com" next=bla %}
"""
bits = token.split_contents()
provider_id = bits[1]
params = token_kwargs(bits[2:], parser, support_legacy=False)
return Pro... | python | def provider_login_url(parser, token):
"""
{% provider_login_url "facebook" next=bla %}
{% provider_login_url "openid" openid="http://me.yahoo.com" next=bla %}
"""
bits = token.split_contents()
provider_id = bits[1]
params = token_kwargs(bits[2:], parser, support_legacy=False)
return Pro... | [
"def",
"provider_login_url",
"(",
"parser",
",",
"token",
")",
":",
"bits",
"=",
"token",
".",
"split_contents",
"(",
")",
"provider_id",
"=",
"bits",
"[",
"1",
"]",
"params",
"=",
"token_kwargs",
"(",
"bits",
"[",
"2",
":",
"]",
",",
"parser",
",",
... | {% provider_login_url "facebook" next=bla %}
{% provider_login_url "openid" openid="http://me.yahoo.com" next=bla %} | [
"{",
"%",
"provider_login_url",
"facebook",
"next",
"=",
"bla",
"%",
"}",
"{",
"%",
"provider_login_url",
"openid",
"openid",
"=",
"http",
":",
"//",
"me",
".",
"yahoo",
".",
"com",
"next",
"=",
"bla",
"%",
"}"
] | f70cb3d622f992f15fe9b57098e0b328445b664e | https://github.com/pennersr/django-allauth/blob/f70cb3d622f992f15fe9b57098e0b328445b664e/allauth/socialaccount/templatetags/socialaccount.py#L43-L51 | train | Return provider login url. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
pennersr/django-allauth | allauth/socialaccount/templatetags/socialaccount.py | get_social_accounts | def get_social_accounts(user):
"""
{% get_social_accounts user as accounts %}
Then:
{{accounts.twitter}} -- a list of connected Twitter accounts
{{accounts.twitter.0}} -- the first Twitter account
{% if accounts %} -- if there is at least one social account
"""
accounts = {}... | python | def get_social_accounts(user):
"""
{% get_social_accounts user as accounts %}
Then:
{{accounts.twitter}} -- a list of connected Twitter accounts
{{accounts.twitter.0}} -- the first Twitter account
{% if accounts %} -- if there is at least one social account
"""
accounts = {}... | [
"def",
"get_social_accounts",
"(",
"user",
")",
":",
"accounts",
"=",
"{",
"}",
"for",
"account",
"in",
"user",
".",
"socialaccount_set",
".",
"all",
"(",
")",
".",
"iterator",
"(",
")",
":",
"providers",
"=",
"accounts",
".",
"setdefault",
"(",
"account... | {% get_social_accounts user as accounts %}
Then:
{{accounts.twitter}} -- a list of connected Twitter accounts
{{accounts.twitter.0}} -- the first Twitter account
{% if accounts %} -- if there is at least one social account | [
"{",
"%",
"get_social_accounts",
"user",
"as",
"accounts",
"%",
"}"
] | f70cb3d622f992f15fe9b57098e0b328445b664e | https://github.com/pennersr/django-allauth/blob/f70cb3d622f992f15fe9b57098e0b328445b664e/allauth/socialaccount/templatetags/socialaccount.py#L68-L81 | train | get_social_accounts returns a list of social accounts for a user | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
pennersr/django-allauth | allauth/socialaccount/adapter.py | DefaultSocialAccountAdapter.save_user | def save_user(self, request, sociallogin, form=None):
"""
Saves a newly signed up social login. In case of auto-signup,
the signup form is not available.
"""
u = sociallogin.user
u.set_unusable_password()
if form:
get_account_adapter().save_user(reques... | python | def save_user(self, request, sociallogin, form=None):
"""
Saves a newly signed up social login. In case of auto-signup,
the signup form is not available.
"""
u = sociallogin.user
u.set_unusable_password()
if form:
get_account_adapter().save_user(reques... | [
"def",
"save_user",
"(",
"self",
",",
"request",
",",
"sociallogin",
",",
"form",
"=",
"None",
")",
":",
"u",
"=",
"sociallogin",
".",
"user",
"u",
".",
"set_unusable_password",
"(",
")",
"if",
"form",
":",
"get_account_adapter",
"(",
")",
".",
"save_use... | Saves a newly signed up social login. In case of auto-signup,
the signup form is not available. | [
"Saves",
"a",
"newly",
"signed",
"up",
"social",
"login",
".",
"In",
"case",
"of",
"auto",
"-",
"signup",
"the",
"signup",
"form",
"is",
"not",
"available",
"."
] | f70cb3d622f992f15fe9b57098e0b328445b664e | https://github.com/pennersr/django-allauth/blob/f70cb3d622f992f15fe9b57098e0b328445b664e/allauth/socialaccount/adapter.py#L71-L83 | train | Saves a newly signed up social login. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
pennersr/django-allauth | allauth/socialaccount/adapter.py | DefaultSocialAccountAdapter.populate_user | def populate_user(self,
request,
sociallogin,
data):
"""
Hook that can be used to further populate the user instance.
For convenience, we populate several common fields.
Note that the user instance being populated repres... | python | def populate_user(self,
request,
sociallogin,
data):
"""
Hook that can be used to further populate the user instance.
For convenience, we populate several common fields.
Note that the user instance being populated repres... | [
"def",
"populate_user",
"(",
"self",
",",
"request",
",",
"sociallogin",
",",
"data",
")",
":",
"username",
"=",
"data",
".",
"get",
"(",
"'username'",
")",
"first_name",
"=",
"data",
".",
"get",
"(",
"'first_name'",
")",
"last_name",
"=",
"data",
".",
... | Hook that can be used to further populate the user instance.
For convenience, we populate several common fields.
Note that the user instance being populated represents a
suggested User instance that represents the social user that is
in the process of being logged in.
The User... | [
"Hook",
"that",
"can",
"be",
"used",
"to",
"further",
"populate",
"the",
"user",
"instance",
"."
] | f70cb3d622f992f15fe9b57098e0b328445b664e | https://github.com/pennersr/django-allauth/blob/f70cb3d622f992f15fe9b57098e0b328445b664e/allauth/socialaccount/adapter.py#L85-L113 | train | Populate the User instance with the data. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
pennersr/django-allauth | allauth/socialaccount/adapter.py | DefaultSocialAccountAdapter.get_connect_redirect_url | def get_connect_redirect_url(self, request, socialaccount):
"""
Returns the default URL to redirect to after successfully
connecting a social account.
"""
assert request.user.is_authenticated
url = reverse('socialaccount_connections')
return url | python | def get_connect_redirect_url(self, request, socialaccount):
"""
Returns the default URL to redirect to after successfully
connecting a social account.
"""
assert request.user.is_authenticated
url = reverse('socialaccount_connections')
return url | [
"def",
"get_connect_redirect_url",
"(",
"self",
",",
"request",
",",
"socialaccount",
")",
":",
"assert",
"request",
".",
"user",
".",
"is_authenticated",
"url",
"=",
"reverse",
"(",
"'socialaccount_connections'",
")",
"return",
"url"
] | Returns the default URL to redirect to after successfully
connecting a social account. | [
"Returns",
"the",
"default",
"URL",
"to",
"redirect",
"to",
"after",
"successfully",
"connecting",
"a",
"social",
"account",
"."
] | f70cb3d622f992f15fe9b57098e0b328445b664e | https://github.com/pennersr/django-allauth/blob/f70cb3d622f992f15fe9b57098e0b328445b664e/allauth/socialaccount/adapter.py#L115-L122 | train | Returns the default URL to redirect to after successfully connecting a social account. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
pennersr/django-allauth | allauth/socialaccount/adapter.py | DefaultSocialAccountAdapter.validate_disconnect | def validate_disconnect(self, account, accounts):
"""
Validate whether or not the socialaccount account can be
safely disconnected.
"""
if len(accounts) == 1:
# No usable password would render the local account unusable
if not account.user.has_usable_passw... | python | def validate_disconnect(self, account, accounts):
"""
Validate whether or not the socialaccount account can be
safely disconnected.
"""
if len(accounts) == 1:
# No usable password would render the local account unusable
if not account.user.has_usable_passw... | [
"def",
"validate_disconnect",
"(",
"self",
",",
"account",
",",
"accounts",
")",
":",
"if",
"len",
"(",
"accounts",
")",
"==",
"1",
":",
"# No usable password would render the local account unusable",
"if",
"not",
"account",
".",
"user",
".",
"has_usable_password",
... | Validate whether or not the socialaccount account can be
safely disconnected. | [
"Validate",
"whether",
"or",
"not",
"the",
"socialaccount",
"account",
"can",
"be",
"safely",
"disconnected",
"."
] | f70cb3d622f992f15fe9b57098e0b328445b664e | https://github.com/pennersr/django-allauth/blob/f70cb3d622f992f15fe9b57098e0b328445b664e/allauth/socialaccount/adapter.py#L124-L140 | train | Validate whether or not the socialaccount account can be safely disconnected. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
pennersr/django-allauth | allauth/utils.py | serialize_instance | def serialize_instance(instance):
"""
Since Django 1.6 items added to the session are no longer pickled,
but JSON encoded by default. We are storing partially complete models
in the session (user, account, token, ...). We cannot use standard
Django serialization, as these are models are not "complet... | python | def serialize_instance(instance):
"""
Since Django 1.6 items added to the session are no longer pickled,
but JSON encoded by default. We are storing partially complete models
in the session (user, account, token, ...). We cannot use standard
Django serialization, as these are models are not "complet... | [
"def",
"serialize_instance",
"(",
"instance",
")",
":",
"data",
"=",
"{",
"}",
"for",
"k",
",",
"v",
"in",
"instance",
".",
"__dict__",
".",
"items",
"(",
")",
":",
"if",
"k",
".",
"startswith",
"(",
"'_'",
")",
"or",
"callable",
"(",
"v",
")",
"... | Since Django 1.6 items added to the session are no longer pickled,
but JSON encoded by default. We are storing partially complete models
in the session (user, account, token, ...). We cannot use standard
Django serialization, as these are models are not "complete" yet.
Serialization will start complaini... | [
"Since",
"Django",
"1",
".",
"6",
"items",
"added",
"to",
"the",
"session",
"are",
"no",
"longer",
"pickled",
"but",
"JSON",
"encoded",
"by",
"default",
".",
"We",
"are",
"storing",
"partially",
"complete",
"models",
"in",
"the",
"session",
"(",
"user",
... | f70cb3d622f992f15fe9b57098e0b328445b664e | https://github.com/pennersr/django-allauth/blob/f70cb3d622f992f15fe9b57098e0b328445b664e/allauth/utils.py#L167-L196 | train | Serialize the object to a JSON - encoded version of the object. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
pennersr/django-allauth | allauth/utils.py | set_form_field_order | def set_form_field_order(form, field_order):
"""
This function is a verbatim copy of django.forms.Form.order_fields() to
support field ordering below Django 1.9.
field_order is a list of field names specifying the order. Append fields
not included in the list in the default order for backward compa... | python | def set_form_field_order(form, field_order):
"""
This function is a verbatim copy of django.forms.Form.order_fields() to
support field ordering below Django 1.9.
field_order is a list of field names specifying the order. Append fields
not included in the list in the default order for backward compa... | [
"def",
"set_form_field_order",
"(",
"form",
",",
"field_order",
")",
":",
"if",
"field_order",
"is",
"None",
":",
"return",
"fields",
"=",
"OrderedDict",
"(",
")",
"for",
"key",
"in",
"field_order",
":",
"try",
":",
"fields",
"[",
"key",
"]",
"=",
"form"... | This function is a verbatim copy of django.forms.Form.order_fields() to
support field ordering below Django 1.9.
field_order is a list of field names specifying the order. Append fields
not included in the list in the default order for backward compatibility
with subclasses not overriding field_order. ... | [
"This",
"function",
"is",
"a",
"verbatim",
"copy",
"of",
"django",
".",
"forms",
".",
"Form",
".",
"order_fields",
"()",
"to",
"support",
"field",
"ordering",
"below",
"Django",
"1",
".",
"9",
"."
] | f70cb3d622f992f15fe9b57098e0b328445b664e | https://github.com/pennersr/django-allauth/blob/f70cb3d622f992f15fe9b57098e0b328445b664e/allauth/utils.py#L235-L256 | train | Sets the order of the fields in the form. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
pennersr/django-allauth | allauth/utils.py | build_absolute_uri | def build_absolute_uri(request, location, protocol=None):
"""request.build_absolute_uri() helper
Like request.build_absolute_uri, but gracefully handling
the case where request is None.
"""
from .account import app_settings as account_settings
if request is None:
site = Site.objects.ge... | python | def build_absolute_uri(request, location, protocol=None):
"""request.build_absolute_uri() helper
Like request.build_absolute_uri, but gracefully handling
the case where request is None.
"""
from .account import app_settings as account_settings
if request is None:
site = Site.objects.ge... | [
"def",
"build_absolute_uri",
"(",
"request",
",",
"location",
",",
"protocol",
"=",
"None",
")",
":",
"from",
".",
"account",
"import",
"app_settings",
"as",
"account_settings",
"if",
"request",
"is",
"None",
":",
"site",
"=",
"Site",
".",
"objects",
".",
... | request.build_absolute_uri() helper
Like request.build_absolute_uri, but gracefully handling
the case where request is None. | [
"request",
".",
"build_absolute_uri",
"()",
"helper"
] | f70cb3d622f992f15fe9b57098e0b328445b664e | https://github.com/pennersr/django-allauth/blob/f70cb3d622f992f15fe9b57098e0b328445b664e/allauth/utils.py#L259-L291 | train | helper function to build an absolute URI for a single object. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
pennersr/django-allauth | allauth/account/forms.py | _base_signup_form_class | def _base_signup_form_class():
"""
Currently, we inherit from the custom form, if any. This is all
not very elegant, though it serves a purpose:
- There are two signup forms: one for local accounts, and one for
social accounts
- Both share a common base (BaseSignupForm)
- Given the above... | python | def _base_signup_form_class():
"""
Currently, we inherit from the custom form, if any. This is all
not very elegant, though it serves a purpose:
- There are two signup forms: one for local accounts, and one for
social accounts
- Both share a common base (BaseSignupForm)
- Given the above... | [
"def",
"_base_signup_form_class",
"(",
")",
":",
"if",
"not",
"app_settings",
".",
"SIGNUP_FORM_CLASS",
":",
"return",
"_DummyCustomSignupForm",
"try",
":",
"fc_module",
",",
"fc_classname",
"=",
"app_settings",
".",
"SIGNUP_FORM_CLASS",
".",
"rsplit",
"(",
"'.'",
... | Currently, we inherit from the custom form, if any. This is all
not very elegant, though it serves a purpose:
- There are two signup forms: one for local accounts, and one for
social accounts
- Both share a common base (BaseSignupForm)
- Given the above, how to put in a custom signup form? Which... | [
"Currently",
"we",
"inherit",
"from",
"the",
"custom",
"form",
"if",
"any",
".",
"This",
"is",
"all",
"not",
"very",
"elegant",
"though",
"it",
"serves",
"a",
"purpose",
":"
] | f70cb3d622f992f15fe9b57098e0b328445b664e | https://github.com/pennersr/django-allauth/blob/f70cb3d622f992f15fe9b57098e0b328445b664e/allauth/account/forms.py#L219-L258 | train | Return the base signup form class that is used by the signup form manager. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
pennersr/django-allauth | allauth/account/forms.py | LoginForm.user_credentials | def user_credentials(self):
"""
Provides the credentials required to authenticate the user for
login.
"""
credentials = {}
login = self.cleaned_data["login"]
if app_settings.AUTHENTICATION_METHOD == AuthenticationMethod.EMAIL:
credentials["email"] = lo... | python | def user_credentials(self):
"""
Provides the credentials required to authenticate the user for
login.
"""
credentials = {}
login = self.cleaned_data["login"]
if app_settings.AUTHENTICATION_METHOD == AuthenticationMethod.EMAIL:
credentials["email"] = lo... | [
"def",
"user_credentials",
"(",
"self",
")",
":",
"credentials",
"=",
"{",
"}",
"login",
"=",
"self",
".",
"cleaned_data",
"[",
"\"login\"",
"]",
"if",
"app_settings",
".",
"AUTHENTICATION_METHOD",
"==",
"AuthenticationMethod",
".",
"EMAIL",
":",
"credentials",
... | Provides the credentials required to authenticate the user for
login. | [
"Provides",
"the",
"credentials",
"required",
"to",
"authenticate",
"the",
"user",
"for",
"login",
"."
] | f70cb3d622f992f15fe9b57098e0b328445b664e | https://github.com/pennersr/django-allauth/blob/f70cb3d622f992f15fe9b57098e0b328445b664e/allauth/account/forms.py#L142-L160 | train | Provides the credentials required to authenticate the user for the specified login. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
pennersr/django-allauth | allauth/socialaccount/providers/facebook/locale.py | _build_locale_table | def _build_locale_table(filename_or_file):
"""
Parses the FacebookLocales.xml file and builds a dict relating every
available language ('en, 'es, 'zh', ...) with a list of available regions
for that language ('en' -> 'US', 'EN') and an (arbitrary) default region.
"""
# Require the XML parser mod... | python | def _build_locale_table(filename_or_file):
"""
Parses the FacebookLocales.xml file and builds a dict relating every
available language ('en, 'es, 'zh', ...) with a list of available regions
for that language ('en' -> 'US', 'EN') and an (arbitrary) default region.
"""
# Require the XML parser mod... | [
"def",
"_build_locale_table",
"(",
"filename_or_file",
")",
":",
"# Require the XML parser module only if we want the default mapping",
"from",
"xml",
".",
"dom",
".",
"minidom",
"import",
"parse",
"dom",
"=",
"parse",
"(",
"filename_or_file",
")",
"reps",
"=",
"dom",
... | Parses the FacebookLocales.xml file and builds a dict relating every
available language ('en, 'es, 'zh', ...) with a list of available regions
for that language ('en' -> 'US', 'EN') and an (arbitrary) default region. | [
"Parses",
"the",
"FacebookLocales",
".",
"xml",
"file",
"and",
"builds",
"a",
"dict",
"relating",
"every",
"available",
"language",
"(",
"en",
"es",
"zh",
"...",
")",
"with",
"a",
"list",
"of",
"available",
"regions",
"for",
"that",
"language",
"(",
"en",
... | f70cb3d622f992f15fe9b57098e0b328445b664e | https://github.com/pennersr/django-allauth/blob/f70cb3d622f992f15fe9b57098e0b328445b664e/allauth/socialaccount/providers/facebook/locale.py#L9-L37 | train | Parses the FacebookLocales. xml file and builds a dictionary relating every available language to a list of available regions for that language and a default region. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
pennersr/django-allauth | allauth/socialaccount/providers/facebook/locale.py | get_default_locale_callable | def get_default_locale_callable():
"""
Wrapper function so that the default mapping is only built when needed
"""
exec_dir = os.path.dirname(os.path.realpath(__file__))
xml_path = os.path.join(exec_dir, 'data', 'FacebookLocales.xml')
fb_locales = _build_locale_table(xml_path)
def default_l... | python | def get_default_locale_callable():
"""
Wrapper function so that the default mapping is only built when needed
"""
exec_dir = os.path.dirname(os.path.realpath(__file__))
xml_path = os.path.join(exec_dir, 'data', 'FacebookLocales.xml')
fb_locales = _build_locale_table(xml_path)
def default_l... | [
"def",
"get_default_locale_callable",
"(",
")",
":",
"exec_dir",
"=",
"os",
".",
"path",
".",
"dirname",
"(",
"os",
".",
"path",
".",
"realpath",
"(",
"__file__",
")",
")",
"xml_path",
"=",
"os",
".",
"path",
".",
"join",
"(",
"exec_dir",
",",
"'data'"... | Wrapper function so that the default mapping is only built when needed | [
"Wrapper",
"function",
"so",
"that",
"the",
"default",
"mapping",
"is",
"only",
"built",
"when",
"needed"
] | f70cb3d622f992f15fe9b57098e0b328445b664e | https://github.com/pennersr/django-allauth/blob/f70cb3d622f992f15fe9b57098e0b328445b664e/allauth/socialaccount/providers/facebook/locale.py#L40-L70 | train | Returns a callable that returns the default locale for the current FB. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
pennersr/django-allauth | allauth/socialaccount/app_settings.py | AppSettings.EMAIL_REQUIRED | def EMAIL_REQUIRED(self):
"""
The user is required to hand over an e-mail address when signing up
"""
from allauth.account import app_settings as account_settings
return self._setting("EMAIL_REQUIRED", account_settings.EMAIL_REQUIRED) | python | def EMAIL_REQUIRED(self):
"""
The user is required to hand over an e-mail address when signing up
"""
from allauth.account import app_settings as account_settings
return self._setting("EMAIL_REQUIRED", account_settings.EMAIL_REQUIRED) | [
"def",
"EMAIL_REQUIRED",
"(",
"self",
")",
":",
"from",
"allauth",
".",
"account",
"import",
"app_settings",
"as",
"account_settings",
"return",
"self",
".",
"_setting",
"(",
"\"EMAIL_REQUIRED\"",
",",
"account_settings",
".",
"EMAIL_REQUIRED",
")"
] | The user is required to hand over an e-mail address when signing up | [
"The",
"user",
"is",
"required",
"to",
"hand",
"over",
"an",
"e",
"-",
"mail",
"address",
"when",
"signing",
"up"
] | f70cb3d622f992f15fe9b57098e0b328445b664e | https://github.com/pennersr/django-allauth/blob/f70cb3d622f992f15fe9b57098e0b328445b664e/allauth/socialaccount/app_settings.py#L40-L45 | train | Returns a boolean value that indicates whether the user is required to hand over an e - mail address when signing up | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
pennersr/django-allauth | allauth/socialaccount/app_settings.py | AppSettings.EMAIL_VERIFICATION | def EMAIL_VERIFICATION(self):
"""
See e-mail verification method
"""
from allauth.account import app_settings as account_settings
return self._setting("EMAIL_VERIFICATION",
account_settings.EMAIL_VERIFICATION) | python | def EMAIL_VERIFICATION(self):
"""
See e-mail verification method
"""
from allauth.account import app_settings as account_settings
return self._setting("EMAIL_VERIFICATION",
account_settings.EMAIL_VERIFICATION) | [
"def",
"EMAIL_VERIFICATION",
"(",
"self",
")",
":",
"from",
"allauth",
".",
"account",
"import",
"app_settings",
"as",
"account_settings",
"return",
"self",
".",
"_setting",
"(",
"\"EMAIL_VERIFICATION\"",
",",
"account_settings",
".",
"EMAIL_VERIFICATION",
")"
] | See e-mail verification method | [
"See",
"e",
"-",
"mail",
"verification",
"method"
] | f70cb3d622f992f15fe9b57098e0b328445b664e | https://github.com/pennersr/django-allauth/blob/f70cb3d622f992f15fe9b57098e0b328445b664e/allauth/socialaccount/app_settings.py#L48-L54 | train | Get the value of EMAIL_VERIFICATION | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
pennersr/django-allauth | allauth/socialaccount/providers/dataporten/provider.py | DataportenAccount.to_str | def to_str(self):
'''
Returns string representation of a social account. Includes the name
of the user.
'''
dflt = super(DataportenAccount, self).to_str()
return '%s (%s)' % (
self.account.extra_data.get('name', ''),
dflt,
) | python | def to_str(self):
'''
Returns string representation of a social account. Includes the name
of the user.
'''
dflt = super(DataportenAccount, self).to_str()
return '%s (%s)' % (
self.account.extra_data.get('name', ''),
dflt,
) | [
"def",
"to_str",
"(",
"self",
")",
":",
"dflt",
"=",
"super",
"(",
"DataportenAccount",
",",
"self",
")",
".",
"to_str",
"(",
")",
"return",
"'%s (%s)'",
"%",
"(",
"self",
".",
"account",
".",
"extra_data",
".",
"get",
"(",
"'name'",
",",
"''",
")",
... | Returns string representation of a social account. Includes the name
of the user. | [
"Returns",
"string",
"representation",
"of",
"a",
"social",
"account",
".",
"Includes",
"the",
"name",
"of",
"the",
"user",
"."
] | f70cb3d622f992f15fe9b57098e0b328445b664e | https://github.com/pennersr/django-allauth/blob/f70cb3d622f992f15fe9b57098e0b328445b664e/allauth/socialaccount/providers/dataporten/provider.py#L15-L24 | train | Returns a string representation of a social account. Includes the name
of the user. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
pennersr/django-allauth | allauth/socialaccount/providers/dataporten/provider.py | DataportenProvider.extract_common_fields | def extract_common_fields(self, data):
'''
This function extracts information from the /userinfo endpoint which
will be consumed by allauth.socialaccount.adapter.populate_user().
Look there to find which key-value pairs that should be saved in the
returned dict.
Typical ... | python | def extract_common_fields(self, data):
'''
This function extracts information from the /userinfo endpoint which
will be consumed by allauth.socialaccount.adapter.populate_user().
Look there to find which key-value pairs that should be saved in the
returned dict.
Typical ... | [
"def",
"extract_common_fields",
"(",
"self",
",",
"data",
")",
":",
"# Make shallow copy to prevent possible mutability issues",
"data",
"=",
"dict",
"(",
"data",
")",
"# If a Feide username is available, use it. If not, use the \"username\"",
"# of the email-address",
"for",
"us... | This function extracts information from the /userinfo endpoint which
will be consumed by allauth.socialaccount.adapter.populate_user().
Look there to find which key-value pairs that should be saved in the
returned dict.
Typical return dict:
{
"userid": "76a7a061-3c55... | [
"This",
"function",
"extracts",
"information",
"from",
"the",
"/",
"userinfo",
"endpoint",
"which",
"will",
"be",
"consumed",
"by",
"allauth",
".",
"socialaccount",
".",
"adapter",
".",
"populate_user",
"()",
".",
"Look",
"there",
"to",
"find",
"which",
"key",... | f70cb3d622f992f15fe9b57098e0b328445b664e | https://github.com/pennersr/django-allauth/blob/f70cb3d622f992f15fe9b57098e0b328445b664e/allauth/socialaccount/providers/dataporten/provider.py#L60-L91 | train | This function extracts common fields from the data dict. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
pennersr/django-allauth | allauth/account/decorators.py | verified_email_required | def verified_email_required(function=None,
login_url=None,
redirect_field_name=REDIRECT_FIELD_NAME):
"""
Even when email verification is not mandatory during signup, there
may be circumstances during which you really want to prevent
unverified user... | python | def verified_email_required(function=None,
login_url=None,
redirect_field_name=REDIRECT_FIELD_NAME):
"""
Even when email verification is not mandatory during signup, there
may be circumstances during which you really want to prevent
unverified user... | [
"def",
"verified_email_required",
"(",
"function",
"=",
"None",
",",
"login_url",
"=",
"None",
",",
"redirect_field_name",
"=",
"REDIRECT_FIELD_NAME",
")",
":",
"def",
"decorator",
"(",
"view_func",
")",
":",
"@",
"login_required",
"(",
"redirect_field_name",
"=",... | Even when email verification is not mandatory during signup, there
may be circumstances during which you really want to prevent
unverified users to proceed. This decorator ensures the user is
authenticated and has a verified email address. If the former is
not the case then the behavior is identical to ... | [
"Even",
"when",
"email",
"verification",
"is",
"not",
"mandatory",
"during",
"signup",
"there",
"may",
"be",
"circumstances",
"during",
"which",
"you",
"really",
"want",
"to",
"prevent",
"unverified",
"users",
"to",
"proceed",
".",
"This",
"decorator",
"ensures"... | f70cb3d622f992f15fe9b57098e0b328445b664e | https://github.com/pennersr/django-allauth/blob/f70cb3d622f992f15fe9b57098e0b328445b664e/allauth/account/decorators.py#L9-L37 | train | This decorator allows the user to be able to verify their email address. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
pennersr/django-allauth | allauth/socialaccount/providers/oauth2/client.py | OAuth2Client._strip_empty_keys | def _strip_empty_keys(self, params):
"""Added because the Dropbox OAuth2 flow doesn't
work when scope is passed in, which is empty.
"""
keys = [k for k, v in params.items() if v == '']
for key in keys:
del params[key] | python | def _strip_empty_keys(self, params):
"""Added because the Dropbox OAuth2 flow doesn't
work when scope is passed in, which is empty.
"""
keys = [k for k, v in params.items() if v == '']
for key in keys:
del params[key] | [
"def",
"_strip_empty_keys",
"(",
"self",
",",
"params",
")",
":",
"keys",
"=",
"[",
"k",
"for",
"k",
",",
"v",
"in",
"params",
".",
"items",
"(",
")",
"if",
"v",
"==",
"''",
"]",
"for",
"key",
"in",
"keys",
":",
"del",
"params",
"[",
"key",
"]"... | Added because the Dropbox OAuth2 flow doesn't
work when scope is passed in, which is empty. | [
"Added",
"because",
"the",
"Dropbox",
"OAuth2",
"flow",
"doesn",
"t",
"work",
"when",
"scope",
"is",
"passed",
"in",
"which",
"is",
"empty",
"."
] | f70cb3d622f992f15fe9b57098e0b328445b664e | https://github.com/pennersr/django-allauth/blob/f70cb3d622f992f15fe9b57098e0b328445b664e/allauth/socialaccount/providers/oauth2/client.py#L88-L94 | train | Remove empty keys from params. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
pennersr/django-allauth | allauth/compat.py | int_to_base36 | def int_to_base36(i):
"""
Django on py2 raises ValueError on large values.
"""
if six.PY2:
char_set = '0123456789abcdefghijklmnopqrstuvwxyz'
if i < 0:
raise ValueError("Negative base36 conversion input.")
if not isinstance(i, six.integer_types):
raise Type... | python | def int_to_base36(i):
"""
Django on py2 raises ValueError on large values.
"""
if six.PY2:
char_set = '0123456789abcdefghijklmnopqrstuvwxyz'
if i < 0:
raise ValueError("Negative base36 conversion input.")
if not isinstance(i, six.integer_types):
raise Type... | [
"def",
"int_to_base36",
"(",
"i",
")",
":",
"if",
"six",
".",
"PY2",
":",
"char_set",
"=",
"'0123456789abcdefghijklmnopqrstuvwxyz'",
"if",
"i",
"<",
"0",
":",
"raise",
"ValueError",
"(",
"\"Negative base36 conversion input.\"",
")",
"if",
"not",
"isinstance",
"(... | Django on py2 raises ValueError on large values. | [
"Django",
"on",
"py2",
"raises",
"ValueError",
"on",
"large",
"values",
"."
] | f70cb3d622f992f15fe9b57098e0b328445b664e | https://github.com/pennersr/django-allauth/blob/f70cb3d622f992f15fe9b57098e0b328445b664e/allauth/compat.py#L41-L60 | train | Convert an integer to base36. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
pennersr/django-allauth | allauth/socialaccount/models.py | SocialLogin.save | def save(self, request, connect=False):
"""
Saves a new account. Note that while the account is new,
the user may be an existing one (when connecting accounts)
"""
assert not self.is_existing
user = self.user
user.save()
self.account.user = user
se... | python | def save(self, request, connect=False):
"""
Saves a new account. Note that while the account is new,
the user may be an existing one (when connecting accounts)
"""
assert not self.is_existing
user = self.user
user.save()
self.account.user = user
se... | [
"def",
"save",
"(",
"self",
",",
"request",
",",
"connect",
"=",
"False",
")",
":",
"assert",
"not",
"self",
".",
"is_existing",
"user",
"=",
"self",
".",
"user",
"user",
".",
"save",
"(",
")",
"self",
".",
"account",
".",
"user",
"=",
"user",
"sel... | Saves a new account. Note that while the account is new,
the user may be an existing one (when connecting accounts) | [
"Saves",
"a",
"new",
"account",
".",
"Note",
"that",
"while",
"the",
"account",
"is",
"new",
"the",
"user",
"may",
"be",
"an",
"existing",
"one",
"(",
"when",
"connecting",
"accounts",
")"
] | f70cb3d622f992f15fe9b57098e0b328445b664e | https://github.com/pennersr/django-allauth/blob/f70cb3d622f992f15fe9b57098e0b328445b664e/allauth/socialaccount/models.py#L228-L245 | train | Saves a new account. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
pennersr/django-allauth | allauth/socialaccount/models.py | SocialLogin.lookup | def lookup(self):
"""
Lookup existing account, if any.
"""
assert not self.is_existing
try:
a = SocialAccount.objects.get(provider=self.account.provider,
uid=self.account.uid)
# Update account
a.extra_d... | python | def lookup(self):
"""
Lookup existing account, if any.
"""
assert not self.is_existing
try:
a = SocialAccount.objects.get(provider=self.account.provider,
uid=self.account.uid)
# Update account
a.extra_d... | [
"def",
"lookup",
"(",
"self",
")",
":",
"assert",
"not",
"self",
".",
"is_existing",
"try",
":",
"a",
"=",
"SocialAccount",
".",
"objects",
".",
"get",
"(",
"provider",
"=",
"self",
".",
"account",
".",
"provider",
",",
"uid",
"=",
"self",
".",
"acco... | Lookup existing account, if any. | [
"Lookup",
"existing",
"account",
"if",
"any",
"."
] | f70cb3d622f992f15fe9b57098e0b328445b664e | https://github.com/pennersr/django-allauth/blob/f70cb3d622f992f15fe9b57098e0b328445b664e/allauth/socialaccount/models.py#L254-L285 | train | Lookup existing account if any. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
pennersr/django-allauth | allauth/socialaccount/providers/base.py | Provider.sociallogin_from_response | def sociallogin_from_response(self, request, response):
"""
Instantiates and populates a `SocialLogin` model based on the data
retrieved in `response`. The method does NOT save the model to the
DB.
Data for `SocialLogin` will be extracted from `response` with the
help of... | python | def sociallogin_from_response(self, request, response):
"""
Instantiates and populates a `SocialLogin` model based on the data
retrieved in `response`. The method does NOT save the model to the
DB.
Data for `SocialLogin` will be extracted from `response` with the
help of... | [
"def",
"sociallogin_from_response",
"(",
"self",
",",
"request",
",",
"response",
")",
":",
"# NOTE: Avoid loading models at top due to registry boot...",
"from",
"allauth",
".",
"socialaccount",
".",
"models",
"import",
"SocialLogin",
",",
"SocialAccount",
"adapter",
"="... | Instantiates and populates a `SocialLogin` model based on the data
retrieved in `response`. The method does NOT save the model to the
DB.
Data for `SocialLogin` will be extracted from `response` with the
help of the `.extract_uid()`, `.extract_extra_data()`,
`.extract_common_fie... | [
"Instantiates",
"and",
"populates",
"a",
"SocialLogin",
"model",
"based",
"on",
"the",
"data",
"retrieved",
"in",
"response",
".",
"The",
"method",
"does",
"NOT",
"save",
"the",
"model",
"to",
"the",
"DB",
"."
] | f70cb3d622f992f15fe9b57098e0b328445b664e | https://github.com/pennersr/django-allauth/blob/f70cb3d622f992f15fe9b57098e0b328445b664e/allauth/socialaccount/providers/base.py#L65-L99 | train | Instantiates and populates a SocialLogin model based on the data in the response. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
pennersr/django-allauth | allauth/socialaccount/providers/eventbrite/provider.py | EventbriteProvider.extract_common_fields | def extract_common_fields(self, data):
"""Extract fields from a basic user query."""
email = None
for curr_email in data.get("emails", []):
email = email or curr_email.get("email")
if curr_email.get("verified", False) and \
curr_email.get("primary", Fa... | python | def extract_common_fields(self, data):
"""Extract fields from a basic user query."""
email = None
for curr_email in data.get("emails", []):
email = email or curr_email.get("email")
if curr_email.get("verified", False) and \
curr_email.get("primary", Fa... | [
"def",
"extract_common_fields",
"(",
"self",
",",
"data",
")",
":",
"email",
"=",
"None",
"for",
"curr_email",
"in",
"data",
".",
"get",
"(",
"\"emails\"",
",",
"[",
"]",
")",
":",
"email",
"=",
"email",
"or",
"curr_email",
".",
"get",
"(",
"\"email\""... | Extract fields from a basic user query. | [
"Extract",
"fields",
"from",
"a",
"basic",
"user",
"query",
"."
] | f70cb3d622f992f15fe9b57098e0b328445b664e | https://github.com/pennersr/django-allauth/blob/f70cb3d622f992f15fe9b57098e0b328445b664e/allauth/socialaccount/providers/eventbrite/provider.py#L32-L48 | train | Extract fields from a basic user query. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
pennersr/django-allauth | allauth/socialaccount/providers/dataporten/views.py | DataportenAdapter.complete_login | def complete_login(self, request, app, token, **kwargs):
'''
Arguments:
request - The get request to the callback URL
/accounts/dataporten/login/callback.
app - The corresponding SocialApp model instance
token - A token object with access token... | python | def complete_login(self, request, app, token, **kwargs):
'''
Arguments:
request - The get request to the callback URL
/accounts/dataporten/login/callback.
app - The corresponding SocialApp model instance
token - A token object with access token... | [
"def",
"complete_login",
"(",
"self",
",",
"request",
",",
"app",
",",
"token",
",",
"*",
"*",
"kwargs",
")",
":",
"# The athentication header",
"headers",
"=",
"{",
"'Authorization'",
":",
"'Bearer '",
"+",
"token",
".",
"token",
"}",
"# Userinfo endpoint, fo... | Arguments:
request - The get request to the callback URL
/accounts/dataporten/login/callback.
app - The corresponding SocialApp model instance
token - A token object with access token given in token.token
Returns:
Should return a dict with ... | [
"Arguments",
":",
"request",
"-",
"The",
"get",
"request",
"to",
"the",
"callback",
"URL",
"/",
"accounts",
"/",
"dataporten",
"/",
"login",
"/",
"callback",
".",
"app",
"-",
"The",
"corresponding",
"SocialApp",
"model",
"instance",
"token",
"-",
"A",
"tok... | f70cb3d622f992f15fe9b57098e0b328445b664e | https://github.com/pennersr/django-allauth/blob/f70cb3d622f992f15fe9b57098e0b328445b664e/allauth/socialaccount/providers/dataporten/views.py#L20-L60 | train | Complete the login process for the given token. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
pennersr/django-allauth | allauth/socialaccount/providers/oauth/views.py | OAuthCallbackView.dispatch | def dispatch(self, request):
"""
View to handle final steps of OAuth based authentication where the user
gets redirected back to from the service provider
"""
login_done_url = reverse(self.adapter.provider_id + "_callback")
client = self._get_client(request, login_done_ur... | python | def dispatch(self, request):
"""
View to handle final steps of OAuth based authentication where the user
gets redirected back to from the service provider
"""
login_done_url = reverse(self.adapter.provider_id + "_callback")
client = self._get_client(request, login_done_ur... | [
"def",
"dispatch",
"(",
"self",
",",
"request",
")",
":",
"login_done_url",
"=",
"reverse",
"(",
"self",
".",
"adapter",
".",
"provider_id",
"+",
"\"_callback\"",
")",
"client",
"=",
"self",
".",
"_get_client",
"(",
"request",
",",
"login_done_url",
")",
"... | View to handle final steps of OAuth based authentication where the user
gets redirected back to from the service provider | [
"View",
"to",
"handle",
"final",
"steps",
"of",
"OAuth",
"based",
"authentication",
"where",
"the",
"user",
"gets",
"redirected",
"back",
"to",
"from",
"the",
"service",
"provider"
] | f70cb3d622f992f15fe9b57098e0b328445b664e | https://github.com/pennersr/django-allauth/blob/f70cb3d622f992f15fe9b57098e0b328445b664e/allauth/socialaccount/providers/oauth/views.py#L78-L115 | train | Dispatches the user to the provider based authentication | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
pennersr/django-allauth | allauth/account/views.py | ConfirmEmailView.login_on_confirm | def login_on_confirm(self, confirmation):
"""
Simply logging in the user may become a security issue. If you
do not take proper care (e.g. don't purge used email
confirmations), a malicious person that got hold of the link
will be able to login over and over again and the user is... | python | def login_on_confirm(self, confirmation):
"""
Simply logging in the user may become a security issue. If you
do not take proper care (e.g. don't purge used email
confirmations), a malicious person that got hold of the link
will be able to login over and over again and the user is... | [
"def",
"login_on_confirm",
"(",
"self",
",",
"confirmation",
")",
":",
"user_pk",
"=",
"None",
"user_pk_str",
"=",
"get_adapter",
"(",
"self",
".",
"request",
")",
".",
"unstash_user",
"(",
"self",
".",
"request",
")",
"if",
"user_pk_str",
":",
"user_pk",
... | Simply logging in the user may become a security issue. If you
do not take proper care (e.g. don't purge used email
confirmations), a malicious person that got hold of the link
will be able to login over and over again and the user is
unable to do anything about it. Even restoring their ... | [
"Simply",
"logging",
"in",
"the",
"user",
"may",
"become",
"a",
"security",
"issue",
".",
"If",
"you",
"do",
"not",
"take",
"proper",
"care",
"(",
"e",
".",
"g",
".",
"don",
"t",
"purge",
"used",
"email",
"confirmations",
")",
"a",
"malicious",
"person... | f70cb3d622f992f15fe9b57098e0b328445b664e | https://github.com/pennersr/django-allauth/blob/f70cb3d622f992f15fe9b57098e0b328445b664e/allauth/account/views.py#L302-L338 | train | This method is called by the user when the user is confirmed. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
pennersr/django-allauth | allauth/socialaccount/providers/orcid/provider.py | extract_from_dict | def extract_from_dict(data, path):
"""
Navigate `data`, a multidimensional array (list or dictionary), and returns
the object at `path`.
"""
value = data
try:
for key in path:
value = value[key]
return value
except (KeyError, IndexError, TypeError):
return... | python | def extract_from_dict(data, path):
"""
Navigate `data`, a multidimensional array (list or dictionary), and returns
the object at `path`.
"""
value = data
try:
for key in path:
value = value[key]
return value
except (KeyError, IndexError, TypeError):
return... | [
"def",
"extract_from_dict",
"(",
"data",
",",
"path",
")",
":",
"value",
"=",
"data",
"try",
":",
"for",
"key",
"in",
"path",
":",
"value",
"=",
"value",
"[",
"key",
"]",
"return",
"value",
"except",
"(",
"KeyError",
",",
"IndexError",
",",
"TypeError"... | Navigate `data`, a multidimensional array (list or dictionary), and returns
the object at `path`. | [
"Navigate",
"data",
"a",
"multidimensional",
"array",
"(",
"list",
"or",
"dictionary",
")",
"and",
"returns",
"the",
"object",
"at",
"path",
"."
] | f70cb3d622f992f15fe9b57098e0b328445b664e | https://github.com/pennersr/django-allauth/blob/f70cb3d622f992f15fe9b57098e0b328445b664e/allauth/socialaccount/providers/orcid/provider.py#L44-L55 | train | Extract the object at path from the data dictionary. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
pennersr/django-allauth | allauth/socialaccount/providers/linkedin_oauth2/provider.py | _extract_email | def _extract_email(data):
"""
{'elements': [{'handle': 'urn:li:emailAddress:319371470',
'handle~': {'emailAddress': 'raymond.penners@intenct.nl'}}]}
"""
ret = ''
elements = data.get('elements', [])
if len(elements) > 0:
ret = elements[0].get('handle~', {}).get('emailAddres... | python | def _extract_email(data):
"""
{'elements': [{'handle': 'urn:li:emailAddress:319371470',
'handle~': {'emailAddress': 'raymond.penners@intenct.nl'}}]}
"""
ret = ''
elements = data.get('elements', [])
if len(elements) > 0:
ret = elements[0].get('handle~', {}).get('emailAddres... | [
"def",
"_extract_email",
"(",
"data",
")",
":",
"ret",
"=",
"''",
"elements",
"=",
"data",
".",
"get",
"(",
"'elements'",
",",
"[",
"]",
")",
"if",
"len",
"(",
"elements",
")",
">",
"0",
":",
"ret",
"=",
"elements",
"[",
"0",
"]",
".",
"get",
"... | {'elements': [{'handle': 'urn:li:emailAddress:319371470',
'handle~': {'emailAddress': 'raymond.penners@intenct.nl'}}]} | [
"{",
"elements",
":",
"[",
"{",
"handle",
":",
"urn",
":",
"li",
":",
"emailAddress",
":",
"319371470",
"handle~",
":",
"{",
"emailAddress",
":",
"raymond",
".",
"penners"
] | f70cb3d622f992f15fe9b57098e0b328445b664e | https://github.com/pennersr/django-allauth/blob/f70cb3d622f992f15fe9b57098e0b328445b664e/allauth/socialaccount/providers/linkedin_oauth2/provider.py#L31-L40 | train | Extract the email address from the data. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
pennersr/django-allauth | allauth/socialaccount/providers/oauth/client.py | OAuthClient._get_request_token | def _get_request_token(self):
"""
Obtain a temporary request token to authorize an access token and to
sign the request to obtain the access token
"""
if self.request_token is None:
get_params = {}
if self.parameters:
get_params.update(self... | python | def _get_request_token(self):
"""
Obtain a temporary request token to authorize an access token and to
sign the request to obtain the access token
"""
if self.request_token is None:
get_params = {}
if self.parameters:
get_params.update(self... | [
"def",
"_get_request_token",
"(",
"self",
")",
":",
"if",
"self",
".",
"request_token",
"is",
"None",
":",
"get_params",
"=",
"{",
"}",
"if",
"self",
".",
"parameters",
":",
"get_params",
".",
"update",
"(",
"self",
".",
"parameters",
")",
"get_params",
... | Obtain a temporary request token to authorize an access token and to
sign the request to obtain the access token | [
"Obtain",
"a",
"temporary",
"request",
"token",
"to",
"authorize",
"an",
"access",
"token",
"and",
"to",
"sign",
"the",
"request",
"to",
"obtain",
"the",
"access",
"token"
] | f70cb3d622f992f15fe9b57098e0b328445b664e | https://github.com/pennersr/django-allauth/blob/f70cb3d622f992f15fe9b57098e0b328445b664e/allauth/socialaccount/providers/oauth/client.py#L61-L84 | train | Obtain a temporary request token and to the request token and to the request token session. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
pennersr/django-allauth | allauth/socialaccount/providers/oauth/client.py | OAuthClient.get_access_token | def get_access_token(self):
"""
Obtain the access token to access private resources at the API
endpoint.
"""
if self.access_token is None:
request_token = self._get_rt_from_session()
oauth = OAuth1(
self.consumer_key,
client... | python | def get_access_token(self):
"""
Obtain the access token to access private resources at the API
endpoint.
"""
if self.access_token is None:
request_token = self._get_rt_from_session()
oauth = OAuth1(
self.consumer_key,
client... | [
"def",
"get_access_token",
"(",
"self",
")",
":",
"if",
"self",
".",
"access_token",
"is",
"None",
":",
"request_token",
"=",
"self",
".",
"_get_rt_from_session",
"(",
")",
"oauth",
"=",
"OAuth1",
"(",
"self",
".",
"consumer_key",
",",
"client_secret",
"=",
... | Obtain the access token to access private resources at the API
endpoint. | [
"Obtain",
"the",
"access",
"token",
"to",
"access",
"private",
"resources",
"at",
"the",
"API",
"endpoint",
"."
] | f70cb3d622f992f15fe9b57098e0b328445b664e | https://github.com/pennersr/django-allauth/blob/f70cb3d622f992f15fe9b57098e0b328445b664e/allauth/socialaccount/providers/oauth/client.py#L86-L116 | train | Obtain the access token to access private resources at the API. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
pennersr/django-allauth | allauth/socialaccount/providers/oauth/client.py | OAuthClient.get_redirect | def get_redirect(self, authorization_url, extra_params):
"""
Returns a ``HttpResponseRedirect`` object to redirect the user
to the URL the OAuth provider handles authorization.
"""
request_token = self._get_request_token()
params = {'oauth_token': request_token['oauth_tok... | python | def get_redirect(self, authorization_url, extra_params):
"""
Returns a ``HttpResponseRedirect`` object to redirect the user
to the URL the OAuth provider handles authorization.
"""
request_token = self._get_request_token()
params = {'oauth_token': request_token['oauth_tok... | [
"def",
"get_redirect",
"(",
"self",
",",
"authorization_url",
",",
"extra_params",
")",
":",
"request_token",
"=",
"self",
".",
"_get_request_token",
"(",
")",
"params",
"=",
"{",
"'oauth_token'",
":",
"request_token",
"[",
"'oauth_token'",
"]",
",",
"'oauth_cal... | Returns a ``HttpResponseRedirect`` object to redirect the user
to the URL the OAuth provider handles authorization. | [
"Returns",
"a",
"HttpResponseRedirect",
"object",
"to",
"redirect",
"the",
"user",
"to",
"the",
"URL",
"the",
"OAuth",
"provider",
"handles",
"authorization",
"."
] | f70cb3d622f992f15fe9b57098e0b328445b664e | https://github.com/pennersr/django-allauth/blob/f70cb3d622f992f15fe9b57098e0b328445b664e/allauth/socialaccount/providers/oauth/client.py#L140-L151 | train | Returns a HttpResponseRedirect object to redirect the user to the URL the OAuth provider handles authorization. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
pennersr/django-allauth | allauth/socialaccount/providers/oauth/client.py | OAuth._get_at_from_session | def _get_at_from_session(self):
"""
Get the saved access token for private resources from the session.
"""
try:
return self.request.session['oauth_%s_access_token'
% get_token_prefix(
self.req... | python | def _get_at_from_session(self):
"""
Get the saved access token for private resources from the session.
"""
try:
return self.request.session['oauth_%s_access_token'
% get_token_prefix(
self.req... | [
"def",
"_get_at_from_session",
"(",
"self",
")",
":",
"try",
":",
"return",
"self",
".",
"request",
".",
"session",
"[",
"'oauth_%s_access_token'",
"%",
"get_token_prefix",
"(",
"self",
".",
"request_token_url",
")",
"]",
"except",
"KeyError",
":",
"raise",
"O... | Get the saved access token for private resources from the session. | [
"Get",
"the",
"saved",
"access",
"token",
"for",
"private",
"resources",
"from",
"the",
"session",
"."
] | f70cb3d622f992f15fe9b57098e0b328445b664e | https://github.com/pennersr/django-allauth/blob/f70cb3d622f992f15fe9b57098e0b328445b664e/allauth/socialaccount/providers/oauth/client.py#L167-L178 | train | Get the saved access token for private resources from the session. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
pennersr/django-allauth | allauth/socialaccount/providers/oauth/client.py | OAuth.query | def query(self, url, method="GET", params=dict(), headers=dict()):
"""
Request a API endpoint at ``url`` with ``params`` being either the
POST or GET data.
"""
access_token = self._get_at_from_session()
oauth = OAuth1(
self.consumer_key,
client_sec... | python | def query(self, url, method="GET", params=dict(), headers=dict()):
"""
Request a API endpoint at ``url`` with ``params`` being either the
POST or GET data.
"""
access_token = self._get_at_from_session()
oauth = OAuth1(
self.consumer_key,
client_sec... | [
"def",
"query",
"(",
"self",
",",
"url",
",",
"method",
"=",
"\"GET\"",
",",
"params",
"=",
"dict",
"(",
")",
",",
"headers",
"=",
"dict",
"(",
")",
")",
":",
"access_token",
"=",
"self",
".",
"_get_at_from_session",
"(",
")",
"oauth",
"=",
"OAuth1",... | Request a API endpoint at ``url`` with ``params`` being either the
POST or GET data. | [
"Request",
"a",
"API",
"endpoint",
"at",
"url",
"with",
"params",
"being",
"either",
"the",
"POST",
"or",
"GET",
"data",
"."
] | f70cb3d622f992f15fe9b57098e0b328445b664e | https://github.com/pennersr/django-allauth/blob/f70cb3d622f992f15fe9b57098e0b328445b664e/allauth/socialaccount/providers/oauth/client.py#L180-L200 | train | Request a URL at url with params being either the
POST or GET data. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
pennersr/django-allauth | allauth/account/utils.py | get_next_redirect_url | def get_next_redirect_url(request, redirect_field_name="next"):
"""
Returns the next URL to redirect to, if it was explicitly passed
via the request.
"""
redirect_to = get_request_param(request, redirect_field_name)
if not get_adapter(request).is_safe_url(redirect_to):
redirect_to = None... | python | def get_next_redirect_url(request, redirect_field_name="next"):
"""
Returns the next URL to redirect to, if it was explicitly passed
via the request.
"""
redirect_to = get_request_param(request, redirect_field_name)
if not get_adapter(request).is_safe_url(redirect_to):
redirect_to = None... | [
"def",
"get_next_redirect_url",
"(",
"request",
",",
"redirect_field_name",
"=",
"\"next\"",
")",
":",
"redirect_to",
"=",
"get_request_param",
"(",
"request",
",",
"redirect_field_name",
")",
"if",
"not",
"get_adapter",
"(",
"request",
")",
".",
"is_safe_url",
"(... | Returns the next URL to redirect to, if it was explicitly passed
via the request. | [
"Returns",
"the",
"next",
"URL",
"to",
"redirect",
"to",
"if",
"it",
"was",
"explicitly",
"passed",
"via",
"the",
"request",
"."
] | f70cb3d622f992f15fe9b57098e0b328445b664e | https://github.com/pennersr/django-allauth/blob/f70cb3d622f992f15fe9b57098e0b328445b664e/allauth/account/utils.py#L28-L36 | train | Returns the next URL to redirect to if the request parameter is not passed. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
pennersr/django-allauth | allauth/account/utils.py | user_field | def user_field(user, field, *args):
"""
Gets or sets (optional) user model fields. No-op if fields do not exist.
"""
if not field:
return
User = get_user_model()
try:
field_meta = User._meta.get_field(field)
max_length = field_meta.max_length
except FieldDoesNotExist:... | python | def user_field(user, field, *args):
"""
Gets or sets (optional) user model fields. No-op if fields do not exist.
"""
if not field:
return
User = get_user_model()
try:
field_meta = User._meta.get_field(field)
max_length = field_meta.max_length
except FieldDoesNotExist:... | [
"def",
"user_field",
"(",
"user",
",",
"field",
",",
"*",
"args",
")",
":",
"if",
"not",
"field",
":",
"return",
"User",
"=",
"get_user_model",
"(",
")",
"try",
":",
"field_meta",
"=",
"User",
".",
"_meta",
".",
"get_field",
"(",
"field",
")",
"max_l... | Gets or sets (optional) user model fields. No-op if fields do not exist. | [
"Gets",
"or",
"sets",
"(",
"optional",
")",
"user",
"model",
"fields",
".",
"No",
"-",
"op",
"if",
"fields",
"do",
"not",
"exist",
"."
] | f70cb3d622f992f15fe9b57098e0b328445b664e | https://github.com/pennersr/django-allauth/blob/f70cb3d622f992f15fe9b57098e0b328445b664e/allauth/account/utils.py#L80-L102 | train | Gets or sets a user model field. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
pennersr/django-allauth | allauth/account/utils.py | perform_login | def perform_login(request, user, email_verification,
redirect_url=None, signal_kwargs=None,
signup=False):
"""
Keyword arguments:
signup -- Indicates whether or not sending the
email is essential (during signup), or if it can be skipped (e.g. in
case email verifi... | python | def perform_login(request, user, email_verification,
redirect_url=None, signal_kwargs=None,
signup=False):
"""
Keyword arguments:
signup -- Indicates whether or not sending the
email is essential (during signup), or if it can be skipped (e.g. in
case email verifi... | [
"def",
"perform_login",
"(",
"request",
",",
"user",
",",
"email_verification",
",",
"redirect_url",
"=",
"None",
",",
"signal_kwargs",
"=",
"None",
",",
"signup",
"=",
"False",
")",
":",
"# Local users are stopped due to form validation checking",
"# is_active, yet, ad... | Keyword arguments:
signup -- Indicates whether or not sending the
email is essential (during signup), or if it can be skipped (e.g. in
case email verification is optional and we are only logging in). | [
"Keyword",
"arguments",
":"
] | f70cb3d622f992f15fe9b57098e0b328445b664e | https://github.com/pennersr/django-allauth/blob/f70cb3d622f992f15fe9b57098e0b328445b664e/allauth/account/utils.py#L115-L166 | train | Perform login and return a response. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
pennersr/django-allauth | allauth/account/utils.py | cleanup_email_addresses | def cleanup_email_addresses(request, addresses):
"""
Takes a list of EmailAddress instances and cleans it up, making
sure only valid ones remain, without multiple primaries etc.
Order is important: e.g. if multiple primary e-mail addresses
exist, the first one encountered will be kept as primary.
... | python | def cleanup_email_addresses(request, addresses):
"""
Takes a list of EmailAddress instances and cleans it up, making
sure only valid ones remain, without multiple primaries etc.
Order is important: e.g. if multiple primary e-mail addresses
exist, the first one encountered will be kept as primary.
... | [
"def",
"cleanup_email_addresses",
"(",
"request",
",",
"addresses",
")",
":",
"from",
".",
"models",
"import",
"EmailAddress",
"adapter",
"=",
"get_adapter",
"(",
"request",
")",
"# Let's group by `email`",
"e2a",
"=",
"OrderedDict",
"(",
")",
"# maps email to Email... | Takes a list of EmailAddress instances and cleans it up, making
sure only valid ones remain, without multiple primaries etc.
Order is important: e.g. if multiple primary e-mail addresses
exist, the first one encountered will be kept as primary. | [
"Takes",
"a",
"list",
"of",
"EmailAddress",
"instances",
"and",
"cleans",
"it",
"up",
"making",
"sure",
"only",
"valid",
"ones",
"remain",
"without",
"multiple",
"primaries",
"etc",
"."
] | f70cb3d622f992f15fe9b57098e0b328445b664e | https://github.com/pennersr/django-allauth/blob/f70cb3d622f992f15fe9b57098e0b328445b664e/allauth/account/utils.py#L184-L241 | train | Takes a list of EmailAddress instances and cleans up the list of EmailAddress objects that are not already in the list of valid e - mail addresses. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
pennersr/django-allauth | allauth/account/utils.py | setup_user_email | def setup_user_email(request, user, addresses):
"""
Creates proper EmailAddress for the user that was just signed
up. Only sets up, doesn't do any other handling such as sending
out email confirmation mails etc.
"""
from .models import EmailAddress
assert not EmailAddress.objects.filter(use... | python | def setup_user_email(request, user, addresses):
"""
Creates proper EmailAddress for the user that was just signed
up. Only sets up, doesn't do any other handling such as sending
out email confirmation mails etc.
"""
from .models import EmailAddress
assert not EmailAddress.objects.filter(use... | [
"def",
"setup_user_email",
"(",
"request",
",",
"user",
",",
"addresses",
")",
":",
"from",
".",
"models",
"import",
"EmailAddress",
"assert",
"not",
"EmailAddress",
".",
"objects",
".",
"filter",
"(",
"user",
"=",
"user",
")",
".",
"exists",
"(",
")",
"... | Creates proper EmailAddress for the user that was just signed
up. Only sets up, doesn't do any other handling such as sending
out email confirmation mails etc. | [
"Creates",
"proper",
"EmailAddress",
"for",
"the",
"user",
"that",
"was",
"just",
"signed",
"up",
".",
"Only",
"sets",
"up",
"doesn",
"t",
"do",
"any",
"other",
"handling",
"such",
"as",
"sending",
"out",
"email",
"confirmation",
"mails",
"etc",
"."
] | f70cb3d622f992f15fe9b57098e0b328445b664e | https://github.com/pennersr/django-allauth/blob/f70cb3d622f992f15fe9b57098e0b328445b664e/allauth/account/utils.py#L244-L278 | train | Sets up proper EmailAddress for the user that was just signed up. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
pennersr/django-allauth | allauth/account/utils.py | send_email_confirmation | def send_email_confirmation(request, user, signup=False):
"""
E-mail verification mails are sent:
a) Explicitly: when a user signs up
b) Implicitly: when a user attempts to log in using an unverified
e-mail while EMAIL_VERIFICATION is mandatory.
Especially in case of b), we want to limit the nu... | python | def send_email_confirmation(request, user, signup=False):
"""
E-mail verification mails are sent:
a) Explicitly: when a user signs up
b) Implicitly: when a user attempts to log in using an unverified
e-mail while EMAIL_VERIFICATION is mandatory.
Especially in case of b), we want to limit the nu... | [
"def",
"send_email_confirmation",
"(",
"request",
",",
"user",
",",
"signup",
"=",
"False",
")",
":",
"from",
".",
"models",
"import",
"EmailAddress",
",",
"EmailConfirmation",
"cooldown_period",
"=",
"timedelta",
"(",
"seconds",
"=",
"app_settings",
".",
"EMAIL... | E-mail verification mails are sent:
a) Explicitly: when a user signs up
b) Implicitly: when a user attempts to log in using an unverified
e-mail while EMAIL_VERIFICATION is mandatory.
Especially in case of b), we want to limit the number of mails
sent (consider a user retrying a few times), which i... | [
"E",
"-",
"mail",
"verification",
"mails",
"are",
"sent",
":",
"a",
")",
"Explicitly",
":",
"when",
"a",
"user",
"signs",
"up",
"b",
")",
"Implicitly",
":",
"when",
"a",
"user",
"attempts",
"to",
"log",
"in",
"using",
"an",
"unverified",
"e",
"-",
"m... | f70cb3d622f992f15fe9b57098e0b328445b664e | https://github.com/pennersr/django-allauth/blob/f70cb3d622f992f15fe9b57098e0b328445b664e/allauth/account/utils.py#L281-L332 | train | Sends an email confirmation mail to the user. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
pennersr/django-allauth | allauth/account/utils.py | sync_user_email_addresses | def sync_user_email_addresses(user):
"""
Keep user.email in sync with user.emailaddress_set.
Under some circumstances the user.email may not have ended up as
an EmailAddress record, e.g. in the case of manually created admin
users.
"""
from .models import EmailAddress
email = user_email... | python | def sync_user_email_addresses(user):
"""
Keep user.email in sync with user.emailaddress_set.
Under some circumstances the user.email may not have ended up as
an EmailAddress record, e.g. in the case of manually created admin
users.
"""
from .models import EmailAddress
email = user_email... | [
"def",
"sync_user_email_addresses",
"(",
"user",
")",
":",
"from",
".",
"models",
"import",
"EmailAddress",
"email",
"=",
"user_email",
"(",
"user",
")",
"if",
"email",
"and",
"not",
"EmailAddress",
".",
"objects",
".",
"filter",
"(",
"user",
"=",
"user",
... | Keep user.email in sync with user.emailaddress_set.
Under some circumstances the user.email may not have ended up as
an EmailAddress record, e.g. in the case of manually created admin
users. | [
"Keep",
"user",
".",
"email",
"in",
"sync",
"with",
"user",
".",
"emailaddress_set",
"."
] | f70cb3d622f992f15fe9b57098e0b328445b664e | https://github.com/pennersr/django-allauth/blob/f70cb3d622f992f15fe9b57098e0b328445b664e/allauth/account/utils.py#L335-L354 | train | Synchronize user. email with the user. emailaddress_set. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
pennersr/django-allauth | allauth/account/utils.py | filter_users_by_email | def filter_users_by_email(email):
"""Return list of users by email address
Typically one, at most just a few in length. First we look through
EmailAddress table, than customisable User model table. Add results
together avoiding SQL joins and deduplicate.
"""
from .models import EmailAddress
... | python | def filter_users_by_email(email):
"""Return list of users by email address
Typically one, at most just a few in length. First we look through
EmailAddress table, than customisable User model table. Add results
together avoiding SQL joins and deduplicate.
"""
from .models import EmailAddress
... | [
"def",
"filter_users_by_email",
"(",
"email",
")",
":",
"from",
".",
"models",
"import",
"EmailAddress",
"User",
"=",
"get_user_model",
"(",
")",
"mails",
"=",
"EmailAddress",
".",
"objects",
".",
"filter",
"(",
"email__iexact",
"=",
"email",
")",
"users",
"... | Return list of users by email address
Typically one, at most just a few in length. First we look through
EmailAddress table, than customisable User model table. Add results
together avoiding SQL joins and deduplicate. | [
"Return",
"list",
"of",
"users",
"by",
"email",
"address"
] | f70cb3d622f992f15fe9b57098e0b328445b664e | https://github.com/pennersr/django-allauth/blob/f70cb3d622f992f15fe9b57098e0b328445b664e/allauth/account/utils.py#L373-L387 | train | Return list of users by email address | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
pennersr/django-allauth | allauth/account/utils.py | user_pk_to_url_str | def user_pk_to_url_str(user):
"""
This should return a string.
"""
User = get_user_model()
if issubclass(type(User._meta.pk), models.UUIDField):
if isinstance(user.pk, six.string_types):
return user.pk
return user.pk.hex
ret = user.pk
if isinstance(ret, six.integ... | python | def user_pk_to_url_str(user):
"""
This should return a string.
"""
User = get_user_model()
if issubclass(type(User._meta.pk), models.UUIDField):
if isinstance(user.pk, six.string_types):
return user.pk
return user.pk.hex
ret = user.pk
if isinstance(ret, six.integ... | [
"def",
"user_pk_to_url_str",
"(",
"user",
")",
":",
"User",
"=",
"get_user_model",
"(",
")",
"if",
"issubclass",
"(",
"type",
"(",
"User",
".",
"_meta",
".",
"pk",
")",
",",
"models",
".",
"UUIDField",
")",
":",
"if",
"isinstance",
"(",
"user",
".",
... | This should return a string. | [
"This",
"should",
"return",
"a",
"string",
"."
] | f70cb3d622f992f15fe9b57098e0b328445b664e | https://github.com/pennersr/django-allauth/blob/f70cb3d622f992f15fe9b57098e0b328445b664e/allauth/account/utils.py#L398-L411 | train | This should return a string. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
pennersr/django-allauth | example/example/demo/apps.py | setup_dummy_social_apps | def setup_dummy_social_apps(sender, **kwargs):
"""
`allauth` needs tokens for OAuth based providers. So let's
setup some dummy tokens
"""
from allauth.socialaccount.providers import registry
from allauth.socialaccount.models import SocialApp
from allauth.socialaccount.providers.oauth.provide... | python | def setup_dummy_social_apps(sender, **kwargs):
"""
`allauth` needs tokens for OAuth based providers. So let's
setup some dummy tokens
"""
from allauth.socialaccount.providers import registry
from allauth.socialaccount.models import SocialApp
from allauth.socialaccount.providers.oauth.provide... | [
"def",
"setup_dummy_social_apps",
"(",
"sender",
",",
"*",
"*",
"kwargs",
")",
":",
"from",
"allauth",
".",
"socialaccount",
".",
"providers",
"import",
"registry",
"from",
"allauth",
".",
"socialaccount",
".",
"models",
"import",
"SocialApp",
"from",
"allauth",... | `allauth` needs tokens for OAuth based providers. So let's
setup some dummy tokens | [
"allauth",
"needs",
"tokens",
"for",
"OAuth",
"based",
"providers",
".",
"So",
"let",
"s",
"setup",
"some",
"dummy",
"tokens"
] | f70cb3d622f992f15fe9b57098e0b328445b664e | https://github.com/pennersr/django-allauth/blob/f70cb3d622f992f15fe9b57098e0b328445b664e/example/example/demo/apps.py#L7-L35 | train | Setup dummy social applications for OAuth based providers. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
pennersr/django-allauth | allauth/socialaccount/fields.py | JSONField.value_from_object | def value_from_object(self, obj):
"""Return value dumped to string."""
val = super(JSONField, self).value_from_object(obj)
return self.get_prep_value(val) | python | def value_from_object(self, obj):
"""Return value dumped to string."""
val = super(JSONField, self).value_from_object(obj)
return self.get_prep_value(val) | [
"def",
"value_from_object",
"(",
"self",
",",
"obj",
")",
":",
"val",
"=",
"super",
"(",
"JSONField",
",",
"self",
")",
".",
"value_from_object",
"(",
"obj",
")",
"return",
"self",
".",
"get_prep_value",
"(",
"val",
")"
] | Return value dumped to string. | [
"Return",
"value",
"dumped",
"to",
"string",
"."
] | f70cb3d622f992f15fe9b57098e0b328445b664e | https://github.com/pennersr/django-allauth/blob/f70cb3d622f992f15fe9b57098e0b328445b664e/allauth/socialaccount/fields.py#L54-L57 | train | Return value dumped to string. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
pennersr/django-allauth | allauth/account/app_settings.py | AppSettings.EMAIL_VERIFICATION | def EMAIL_VERIFICATION(self):
"""
See e-mail verification method
"""
ret = self._setting("EMAIL_VERIFICATION",
self.EmailVerificationMethod.OPTIONAL)
# Deal with legacy (boolean based) setting
if ret is True:
ret = self.EmailVerific... | python | def EMAIL_VERIFICATION(self):
"""
See e-mail verification method
"""
ret = self._setting("EMAIL_VERIFICATION",
self.EmailVerificationMethod.OPTIONAL)
# Deal with legacy (boolean based) setting
if ret is True:
ret = self.EmailVerific... | [
"def",
"EMAIL_VERIFICATION",
"(",
"self",
")",
":",
"ret",
"=",
"self",
".",
"_setting",
"(",
"\"EMAIL_VERIFICATION\"",
",",
"self",
".",
"EmailVerificationMethod",
".",
"OPTIONAL",
")",
"# Deal with legacy (boolean based) setting",
"if",
"ret",
"is",
"True",
":",
... | See e-mail verification method | [
"See",
"e",
"-",
"mail",
"verification",
"method"
] | f70cb3d622f992f15fe9b57098e0b328445b664e | https://github.com/pennersr/django-allauth/blob/f70cb3d622f992f15fe9b57098e0b328445b664e/allauth/account/app_settings.py#L91-L102 | train | Returns the e - mail verification method. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
pennersr/django-allauth | allauth/account/app_settings.py | AppSettings.PASSWORD_MIN_LENGTH | def PASSWORD_MIN_LENGTH(self):
"""
Minimum password Length
"""
from django.conf import settings
ret = None
if not settings.AUTH_PASSWORD_VALIDATORS:
ret = self._setting("PASSWORD_MIN_LENGTH", 6)
return ret | python | def PASSWORD_MIN_LENGTH(self):
"""
Minimum password Length
"""
from django.conf import settings
ret = None
if not settings.AUTH_PASSWORD_VALIDATORS:
ret = self._setting("PASSWORD_MIN_LENGTH", 6)
return ret | [
"def",
"PASSWORD_MIN_LENGTH",
"(",
"self",
")",
":",
"from",
"django",
".",
"conf",
"import",
"settings",
"ret",
"=",
"None",
"if",
"not",
"settings",
".",
"AUTH_PASSWORD_VALIDATORS",
":",
"ret",
"=",
"self",
".",
"_setting",
"(",
"\"PASSWORD_MIN_LENGTH\"",
",... | Minimum password Length | [
"Minimum",
"password",
"Length"
] | f70cb3d622f992f15fe9b57098e0b328445b664e | https://github.com/pennersr/django-allauth/blob/f70cb3d622f992f15fe9b57098e0b328445b664e/allauth/account/app_settings.py#L140-L148 | train | Returns the minimum password length for the user. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
blue-yonder/tsfresh | tsfresh/utilities/distribution.py | _function_with_partly_reduce | def _function_with_partly_reduce(chunk_list, map_function, kwargs):
"""
Small helper function to call a function (map_function)
on a list of data chunks (chunk_list) and convert the results into
a flattened list.
This function is used to send chunks of data with a size larger than 1 to
the ... | python | def _function_with_partly_reduce(chunk_list, map_function, kwargs):
"""
Small helper function to call a function (map_function)
on a list of data chunks (chunk_list) and convert the results into
a flattened list.
This function is used to send chunks of data with a size larger than 1 to
the ... | [
"def",
"_function_with_partly_reduce",
"(",
"chunk_list",
",",
"map_function",
",",
"kwargs",
")",
":",
"kwargs",
"=",
"kwargs",
"or",
"{",
"}",
"results",
"=",
"(",
"map_function",
"(",
"chunk",
",",
"*",
"*",
"kwargs",
")",
"for",
"chunk",
"in",
"chunk_l... | Small helper function to call a function (map_function)
on a list of data chunks (chunk_list) and convert the results into
a flattened list.
This function is used to send chunks of data with a size larger than 1 to
the workers in parallel and process these on the worker.
:param chunk_list: A l... | [
"Small",
"helper",
"function",
"to",
"call",
"a",
"function",
"(",
"map_function",
")",
"on",
"a",
"list",
"of",
"data",
"chunks",
"(",
"chunk_list",
")",
"and",
"convert",
"the",
"results",
"into",
"a",
"flattened",
"list",
".",
"This",
"function",
"is",
... | c72c9c574371cf7dd7d54e00a466792792e5d202 | https://github.com/blue-yonder/tsfresh/blob/c72c9c574371cf7dd7d54e00a466792792e5d202/tsfresh/utilities/distribution.py#L19-L39 | train | This function is used to reduce the data in a list of data chunks. It is used to reduce the data in a list of data chunks. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
blue-yonder/tsfresh | tsfresh/utilities/distribution.py | DistributorBaseClass.partition | def partition(data, chunk_size):
"""
This generator chunks a list of data into slices of length chunk_size. If the chunk_size is not a divider of the
data length, the last slice will be shorter than chunk_size.
:param data: The data to chunk.
:type data: list
:param chun... | python | def partition(data, chunk_size):
"""
This generator chunks a list of data into slices of length chunk_size. If the chunk_size is not a divider of the
data length, the last slice will be shorter than chunk_size.
:param data: The data to chunk.
:type data: list
:param chun... | [
"def",
"partition",
"(",
"data",
",",
"chunk_size",
")",
":",
"iterable",
"=",
"iter",
"(",
"data",
")",
"while",
"True",
":",
"next_chunk",
"=",
"list",
"(",
"itertools",
".",
"islice",
"(",
"iterable",
",",
"chunk_size",
")",
")",
"if",
"not",
"next_... | This generator chunks a list of data into slices of length chunk_size. If the chunk_size is not a divider of the
data length, the last slice will be shorter than chunk_size.
:param data: The data to chunk.
:type data: list
:param chunk_size: Each chunks size. The last chunk may be small... | [
"This",
"generator",
"chunks",
"a",
"list",
"of",
"data",
"into",
"slices",
"of",
"length",
"chunk_size",
".",
"If",
"the",
"chunk_size",
"is",
"not",
"a",
"divider",
"of",
"the",
"data",
"length",
"the",
"last",
"slice",
"will",
"be",
"shorter",
"than",
... | c72c9c574371cf7dd7d54e00a466792792e5d202 | https://github.com/blue-yonder/tsfresh/blob/c72c9c574371cf7dd7d54e00a466792792e5d202/tsfresh/utilities/distribution.py#L57-L77 | train | This generator splits a list of data into chunks of length chunk_size. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
blue-yonder/tsfresh | tsfresh/utilities/distribution.py | DistributorBaseClass.calculate_best_chunk_size | def calculate_best_chunk_size(self, data_length):
"""
Calculates the best chunk size for a list of length data_length. The current implemented formula is more or
less an empirical result for multiprocessing case on one machine.
:param data_length: A length which defines how man... | python | def calculate_best_chunk_size(self, data_length):
"""
Calculates the best chunk size for a list of length data_length. The current implemented formula is more or
less an empirical result for multiprocessing case on one machine.
:param data_length: A length which defines how man... | [
"def",
"calculate_best_chunk_size",
"(",
"self",
",",
"data_length",
")",
":",
"chunk_size",
",",
"extra",
"=",
"divmod",
"(",
"data_length",
",",
"self",
".",
"n_workers",
"*",
"5",
")",
"if",
"extra",
":",
"chunk_size",
"+=",
"1",
"return",
"chunk_size"
] | Calculates the best chunk size for a list of length data_length. The current implemented formula is more or
less an empirical result for multiprocessing case on one machine.
:param data_length: A length which defines how many calculations there need to be.
:type data_length: int
... | [
"Calculates",
"the",
"best",
"chunk",
"size",
"for",
"a",
"list",
"of",
"length",
"data_length",
".",
"The",
"current",
"implemented",
"formula",
"is",
"more",
"or",
"less",
"an",
"empirical",
"result",
"for",
"multiprocessing",
"case",
"on",
"one",
"machine",... | c72c9c574371cf7dd7d54e00a466792792e5d202 | https://github.com/blue-yonder/tsfresh/blob/c72c9c574371cf7dd7d54e00a466792792e5d202/tsfresh/utilities/distribution.py#L85-L100 | train | Calculates the best chunk size for a list of length data_length. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
blue-yonder/tsfresh | tsfresh/utilities/distribution.py | DistributorBaseClass.map_reduce | def map_reduce(self, map_function, data, function_kwargs=None, chunk_size=None, data_length=None):
"""
This method contains the core functionality of the DistributorBaseClass class.
It maps the map_function to each element of the data and reduces the results to return a flattened list.
... | python | def map_reduce(self, map_function, data, function_kwargs=None, chunk_size=None, data_length=None):
"""
This method contains the core functionality of the DistributorBaseClass class.
It maps the map_function to each element of the data and reduces the results to return a flattened list.
... | [
"def",
"map_reduce",
"(",
"self",
",",
"map_function",
",",
"data",
",",
"function_kwargs",
"=",
"None",
",",
"chunk_size",
"=",
"None",
",",
"data_length",
"=",
"None",
")",
":",
"if",
"data_length",
"is",
"None",
":",
"data_length",
"=",
"len",
"(",
"d... | This method contains the core functionality of the DistributorBaseClass class.
It maps the map_function to each element of the data and reduces the results to return a flattened list.
How the jobs are calculated, is determined by the classes
:func:`tsfresh.utilities.distribution.Distr... | [
"This",
"method",
"contains",
"the",
"core",
"functionality",
"of",
"the",
"DistributorBaseClass",
"class",
".",
"It",
"maps",
"the",
"map_function",
"to",
"each",
"element",
"of",
"the",
"data",
"and",
"reduces",
"the",
"results",
"to",
"return",
"a",
"flatte... | c72c9c574371cf7dd7d54e00a466792792e5d202 | https://github.com/blue-yonder/tsfresh/blob/c72c9c574371cf7dd7d54e00a466792792e5d202/tsfresh/utilities/distribution.py#L102-L151 | train | This method maps a function to each element of the data and reduces the results to return a flattened list. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
blue-yonder/tsfresh | tsfresh/utilities/distribution.py | MapDistributor.distribute | def distribute(self, func, partitioned_chunks, kwargs):
"""
Calculates the features in a sequential fashion by pythons map command
:param func: the function to send to each worker.
:type func: callable
:param partitioned_chunks: The list of data chunks - each element is again
... | python | def distribute(self, func, partitioned_chunks, kwargs):
"""
Calculates the features in a sequential fashion by pythons map command
:param func: the function to send to each worker.
:type func: callable
:param partitioned_chunks: The list of data chunks - each element is again
... | [
"def",
"distribute",
"(",
"self",
",",
"func",
",",
"partitioned_chunks",
",",
"kwargs",
")",
":",
"return",
"map",
"(",
"partial",
"(",
"func",
",",
"*",
"*",
"kwargs",
")",
",",
"partitioned_chunks",
")"
] | Calculates the features in a sequential fashion by pythons map command
:param func: the function to send to each worker.
:type func: callable
:param partitioned_chunks: The list of data chunks - each element is again
a list of chunks - and should be processed by one worker.
... | [
"Calculates",
"the",
"features",
"in",
"a",
"sequential",
"fashion",
"by",
"pythons",
"map",
"command"
] | c72c9c574371cf7dd7d54e00a466792792e5d202 | https://github.com/blue-yonder/tsfresh/blob/c72c9c574371cf7dd7d54e00a466792792e5d202/tsfresh/utilities/distribution.py#L195-L210 | train | Calculates the features in a sequential fashion by pythons map command | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
blue-yonder/tsfresh | tsfresh/utilities/distribution.py | LocalDaskDistributor.distribute | def distribute(self, func, partitioned_chunks, kwargs):
"""
Calculates the features in a parallel fashion by distributing the map command to the dask workers on a local
machine
:param func: the function to send to each worker.
:type func: callable
:param partitioned_chun... | python | def distribute(self, func, partitioned_chunks, kwargs):
"""
Calculates the features in a parallel fashion by distributing the map command to the dask workers on a local
machine
:param func: the function to send to each worker.
:type func: callable
:param partitioned_chun... | [
"def",
"distribute",
"(",
"self",
",",
"func",
",",
"partitioned_chunks",
",",
"kwargs",
")",
":",
"result",
"=",
"self",
".",
"client",
".",
"gather",
"(",
"self",
".",
"client",
".",
"map",
"(",
"partial",
"(",
"func",
",",
"*",
"*",
"kwargs",
")",... | Calculates the features in a parallel fashion by distributing the map command to the dask workers on a local
machine
:param func: the function to send to each worker.
:type func: callable
:param partitioned_chunks: The list of data chunks - each element is again
a list of ch... | [
"Calculates",
"the",
"features",
"in",
"a",
"parallel",
"fashion",
"by",
"distributing",
"the",
"map",
"command",
"to",
"the",
"dask",
"workers",
"on",
"a",
"local",
"machine"
] | c72c9c574371cf7dd7d54e00a466792792e5d202 | https://github.com/blue-yonder/tsfresh/blob/c72c9c574371cf7dd7d54e00a466792792e5d202/tsfresh/utilities/distribution.py#L246-L263 | train | Distribute the function func to the local cluster and return the features in a parallel fashion. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
blue-yonder/tsfresh | tsfresh/utilities/distribution.py | ClusterDaskDistributor.calculate_best_chunk_size | def calculate_best_chunk_size(self, data_length):
"""
Uses the number of dask workers in the cluster (during execution time, meaning when you start the extraction)
to find the optimal chunk_size.
:param data_length: A length which defines how many calculations there need to be.
... | python | def calculate_best_chunk_size(self, data_length):
"""
Uses the number of dask workers in the cluster (during execution time, meaning when you start the extraction)
to find the optimal chunk_size.
:param data_length: A length which defines how many calculations there need to be.
... | [
"def",
"calculate_best_chunk_size",
"(",
"self",
",",
"data_length",
")",
":",
"n_workers",
"=",
"len",
"(",
"self",
".",
"client",
".",
"scheduler_info",
"(",
")",
"[",
"\"workers\"",
"]",
")",
"chunk_size",
",",
"extra",
"=",
"divmod",
"(",
"data_length",
... | Uses the number of dask workers in the cluster (during execution time, meaning when you start the extraction)
to find the optimal chunk_size.
:param data_length: A length which defines how many calculations there need to be.
:type data_length: int | [
"Uses",
"the",
"number",
"of",
"dask",
"workers",
"in",
"the",
"cluster",
"(",
"during",
"execution",
"time",
"meaning",
"when",
"you",
"start",
"the",
"extraction",
")",
"to",
"find",
"the",
"optimal",
"chunk_size",
"."
] | c72c9c574371cf7dd7d54e00a466792792e5d202 | https://github.com/blue-yonder/tsfresh/blob/c72c9c574371cf7dd7d54e00a466792792e5d202/tsfresh/utilities/distribution.py#L289-L301 | train | Calculates the optimal chunk size for a dask cluster entry. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
blue-yonder/tsfresh | tsfresh/utilities/distribution.py | MultiprocessingDistributor.distribute | def distribute(self, func, partitioned_chunks, kwargs):
"""
Calculates the features in a parallel fashion by distributing the map command to a thread pool
:param func: the function to send to each worker.
:type func: callable
:param partitioned_chunks: The list of data chunks - ... | python | def distribute(self, func, partitioned_chunks, kwargs):
"""
Calculates the features in a parallel fashion by distributing the map command to a thread pool
:param func: the function to send to each worker.
:type func: callable
:param partitioned_chunks: The list of data chunks - ... | [
"def",
"distribute",
"(",
"self",
",",
"func",
",",
"partitioned_chunks",
",",
"kwargs",
")",
":",
"return",
"self",
".",
"pool",
".",
"imap_unordered",
"(",
"partial",
"(",
"func",
",",
"*",
"*",
"kwargs",
")",
",",
"partitioned_chunks",
")"
] | Calculates the features in a parallel fashion by distributing the map command to a thread pool
:param func: the function to send to each worker.
:type func: callable
:param partitioned_chunks: The list of data chunks - each element is again
a list of chunks - and should be processed... | [
"Calculates",
"the",
"features",
"in",
"a",
"parallel",
"fashion",
"by",
"distributing",
"the",
"map",
"command",
"to",
"a",
"thread",
"pool"
] | c72c9c574371cf7dd7d54e00a466792792e5d202 | https://github.com/blue-yonder/tsfresh/blob/c72c9c574371cf7dd7d54e00a466792792e5d202/tsfresh/utilities/distribution.py#L350-L365 | train | Distribute the function to a thread pool and return the features in a parallel fashion. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
blue-yonder/tsfresh | tsfresh/utilities/distribution.py | MultiprocessingDistributor.close | def close(self):
"""
Collects the result from the workers and closes the thread pool.
"""
self.pool.close()
self.pool.terminate()
self.pool.join() | python | def close(self):
"""
Collects the result from the workers and closes the thread pool.
"""
self.pool.close()
self.pool.terminate()
self.pool.join() | [
"def",
"close",
"(",
"self",
")",
":",
"self",
".",
"pool",
".",
"close",
"(",
")",
"self",
".",
"pool",
".",
"terminate",
"(",
")",
"self",
".",
"pool",
".",
"join",
"(",
")"
] | Collects the result from the workers and closes the thread pool. | [
"Collects",
"the",
"result",
"from",
"the",
"workers",
"and",
"closes",
"the",
"thread",
"pool",
"."
] | c72c9c574371cf7dd7d54e00a466792792e5d202 | https://github.com/blue-yonder/tsfresh/blob/c72c9c574371cf7dd7d54e00a466792792e5d202/tsfresh/utilities/distribution.py#L367-L373 | train | Closes the thread pool and terminate the thread pool. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
blue-yonder/tsfresh | tsfresh/feature_extraction/settings.py | from_columns | def from_columns(columns, columns_to_ignore=None):
"""
Creates a mapping from kind names to fc_parameters objects
(which are itself mappings from feature calculators to settings)
to extract only the features contained in the columns.
To do so, for every feature name in columns this method
1. sp... | python | def from_columns(columns, columns_to_ignore=None):
"""
Creates a mapping from kind names to fc_parameters objects
(which are itself mappings from feature calculators to settings)
to extract only the features contained in the columns.
To do so, for every feature name in columns this method
1. sp... | [
"def",
"from_columns",
"(",
"columns",
",",
"columns_to_ignore",
"=",
"None",
")",
":",
"kind_to_fc_parameters",
"=",
"{",
"}",
"if",
"columns_to_ignore",
"is",
"None",
":",
"columns_to_ignore",
"=",
"[",
"]",
"for",
"col",
"in",
"columns",
":",
"if",
"col",... | Creates a mapping from kind names to fc_parameters objects
(which are itself mappings from feature calculators to settings)
to extract only the features contained in the columns.
To do so, for every feature name in columns this method
1. split the column name into col, feature, params part
2. decid... | [
"Creates",
"a",
"mapping",
"from",
"kind",
"names",
"to",
"fc_parameters",
"objects",
"(",
"which",
"are",
"itself",
"mappings",
"from",
"feature",
"calculators",
"to",
"settings",
")",
"to",
"extract",
"only",
"the",
"features",
"contained",
"in",
"the",
"col... | c72c9c574371cf7dd7d54e00a466792792e5d202 | https://github.com/blue-yonder/tsfresh/blob/c72c9c574371cf7dd7d54e00a466792792e5d202/tsfresh/feature_extraction/settings.py#L24-L82 | train | Creates a mapping from kind names to fc_parameters objects. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
blue-yonder/tsfresh | tsfresh/feature_extraction/feature_calculators.py | _roll | def _roll(a, shift):
"""
Roll 1D array elements. Improves the performance of numpy.roll() by reducing the overhead introduced from the
flexibility of the numpy.roll() method such as the support for rolling over multiple dimensions.
Elements that roll beyond the last position are re-introduced at ... | python | def _roll(a, shift):
"""
Roll 1D array elements. Improves the performance of numpy.roll() by reducing the overhead introduced from the
flexibility of the numpy.roll() method such as the support for rolling over multiple dimensions.
Elements that roll beyond the last position are re-introduced at ... | [
"def",
"_roll",
"(",
"a",
",",
"shift",
")",
":",
"if",
"not",
"isinstance",
"(",
"a",
",",
"np",
".",
"ndarray",
")",
":",
"a",
"=",
"np",
".",
"asarray",
"(",
"a",
")",
"idx",
"=",
"shift",
"%",
"len",
"(",
"a",
")",
"return",
"np",
".",
... | Roll 1D array elements. Improves the performance of numpy.roll() by reducing the overhead introduced from the
flexibility of the numpy.roll() method such as the support for rolling over multiple dimensions.
Elements that roll beyond the last position are re-introduced at the beginning. Similarly, element... | [
"Roll",
"1D",
"array",
"elements",
".",
"Improves",
"the",
"performance",
"of",
"numpy",
".",
"roll",
"()",
"by",
"reducing",
"the",
"overhead",
"introduced",
"from",
"the",
"flexibility",
"of",
"the",
"numpy",
".",
"roll",
"()",
"method",
"such",
"as",
"t... | c72c9c574371cf7dd7d54e00a466792792e5d202 | https://github.com/blue-yonder/tsfresh/blob/c72c9c574371cf7dd7d54e00a466792792e5d202/tsfresh/feature_extraction/feature_calculators.py#L35-L78 | train | Roll 1D array elements. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
blue-yonder/tsfresh | tsfresh/feature_extraction/feature_calculators.py | _get_length_sequences_where | def _get_length_sequences_where(x):
"""
This method calculates the length of all sub-sequences where the array x is either True or 1.
Examples
--------
>>> x = [0,1,0,0,1,1,1,0,0,1,0,1,1]
>>> _get_length_sequences_where(x)
>>> [1, 3, 1, 2]
>>> x = [0,True,0,0,True,True,True,0,0,True,0,... | python | def _get_length_sequences_where(x):
"""
This method calculates the length of all sub-sequences where the array x is either True or 1.
Examples
--------
>>> x = [0,1,0,0,1,1,1,0,0,1,0,1,1]
>>> _get_length_sequences_where(x)
>>> [1, 3, 1, 2]
>>> x = [0,True,0,0,True,True,True,0,0,True,0,... | [
"def",
"_get_length_sequences_where",
"(",
"x",
")",
":",
"if",
"len",
"(",
"x",
")",
"==",
"0",
":",
"return",
"[",
"0",
"]",
"else",
":",
"res",
"=",
"[",
"len",
"(",
"list",
"(",
"group",
")",
")",
"for",
"value",
",",
"group",
"in",
"itertool... | This method calculates the length of all sub-sequences where the array x is either True or 1.
Examples
--------
>>> x = [0,1,0,0,1,1,1,0,0,1,0,1,1]
>>> _get_length_sequences_where(x)
>>> [1, 3, 1, 2]
>>> x = [0,True,0,0,True,True,True,0,0,True,0,True,True]
>>> _get_length_sequences_where(x... | [
"This",
"method",
"calculates",
"the",
"length",
"of",
"all",
"sub",
"-",
"sequences",
"where",
"the",
"array",
"x",
"is",
"either",
"True",
"or",
"1",
"."
] | c72c9c574371cf7dd7d54e00a466792792e5d202 | https://github.com/blue-yonder/tsfresh/blob/c72c9c574371cf7dd7d54e00a466792792e5d202/tsfresh/feature_extraction/feature_calculators.py#L81-L107 | train | This method calculates the length of all sub - sequences where the array x is either True or False. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
blue-yonder/tsfresh | tsfresh/feature_extraction/feature_calculators.py | _estimate_friedrich_coefficients | def _estimate_friedrich_coefficients(x, m, r):
"""
Coefficients of polynomial :math:`h(x)`, which has been fitted to
the deterministic dynamics of Langevin model
.. math::
\dot{x}(t) = h(x(t)) + \mathcal{N}(0,R)
As described by
Friedrich et al. (2000): Physics Letters A 271, p. 217... | python | def _estimate_friedrich_coefficients(x, m, r):
"""
Coefficients of polynomial :math:`h(x)`, which has been fitted to
the deterministic dynamics of Langevin model
.. math::
\dot{x}(t) = h(x(t)) + \mathcal{N}(0,R)
As described by
Friedrich et al. (2000): Physics Letters A 271, p. 217... | [
"def",
"_estimate_friedrich_coefficients",
"(",
"x",
",",
"m",
",",
"r",
")",
":",
"assert",
"m",
">",
"0",
",",
"\"Order of polynomial need to be positive integer, found {}\"",
".",
"format",
"(",
"m",
")",
"df",
"=",
"pd",
".",
"DataFrame",
"(",
"{",
"'signa... | Coefficients of polynomial :math:`h(x)`, which has been fitted to
the deterministic dynamics of Langevin model
.. math::
\dot{x}(t) = h(x(t)) + \mathcal{N}(0,R)
As described by
Friedrich et al. (2000): Physics Letters A 271, p. 217-222
*Extracting model equations from experimental ... | [
"Coefficients",
"of",
"polynomial",
":",
"math",
":",
"h",
"(",
"x",
")",
"which",
"has",
"been",
"fitted",
"to",
"the",
"deterministic",
"dynamics",
"of",
"Langevin",
"model",
"..",
"math",
"::",
"\\",
"dot",
"{",
"x",
"}",
"(",
"t",
")",
"=",
"h",
... | c72c9c574371cf7dd7d54e00a466792792e5d202 | https://github.com/blue-yonder/tsfresh/blob/c72c9c574371cf7dd7d54e00a466792792e5d202/tsfresh/feature_extraction/feature_calculators.py#L110-L150 | train | Estimate the coefficients of a random variational system of the given time series. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
blue-yonder/tsfresh | tsfresh/feature_extraction/feature_calculators.py | _aggregate_on_chunks | def _aggregate_on_chunks(x, f_agg, chunk_len):
"""
Takes the time series x and constructs a lower sampled version of it by applying the aggregation function f_agg on
consecutive chunks of length chunk_len
:param x: the time series to calculate the aggregation of
:type x: numpy.ndarray
:param f_... | python | def _aggregate_on_chunks(x, f_agg, chunk_len):
"""
Takes the time series x and constructs a lower sampled version of it by applying the aggregation function f_agg on
consecutive chunks of length chunk_len
:param x: the time series to calculate the aggregation of
:type x: numpy.ndarray
:param f_... | [
"def",
"_aggregate_on_chunks",
"(",
"x",
",",
"f_agg",
",",
"chunk_len",
")",
":",
"return",
"[",
"getattr",
"(",
"x",
"[",
"i",
"*",
"chunk_len",
":",
"(",
"i",
"+",
"1",
")",
"*",
"chunk_len",
"]",
",",
"f_agg",
")",
"(",
")",
"for",
"i",
"in",... | Takes the time series x and constructs a lower sampled version of it by applying the aggregation function f_agg on
consecutive chunks of length chunk_len
:param x: the time series to calculate the aggregation of
:type x: numpy.ndarray
:param f_agg: The name of the aggregation function that should be an... | [
"Takes",
"the",
"time",
"series",
"x",
"and",
"constructs",
"a",
"lower",
"sampled",
"version",
"of",
"it",
"by",
"applying",
"the",
"aggregation",
"function",
"f_agg",
"on",
"consecutive",
"chunks",
"of",
"length",
"chunk_len"
] | c72c9c574371cf7dd7d54e00a466792792e5d202 | https://github.com/blue-yonder/tsfresh/blob/c72c9c574371cf7dd7d54e00a466792792e5d202/tsfresh/feature_extraction/feature_calculators.py#L153-L167 | train | Takes the time series x and creates a lower sampled version of it by applying the aggregation function f_agg on consecutive chunks of length chunk_len and returns the list of the aggregation function over the chunks of length chunk_len | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
blue-yonder/tsfresh | tsfresh/feature_extraction/feature_calculators.py | set_property | def set_property(key, value):
"""
This method returns a decorator that sets the property key of the function to value
"""
def decorate_func(func):
setattr(func, key, value)
if func.__doc__ and key == "fctype":
func.__doc__ = func.__doc__ + "\n\n *This function is of type: ... | python | def set_property(key, value):
"""
This method returns a decorator that sets the property key of the function to value
"""
def decorate_func(func):
setattr(func, key, value)
if func.__doc__ and key == "fctype":
func.__doc__ = func.__doc__ + "\n\n *This function is of type: ... | [
"def",
"set_property",
"(",
"key",
",",
"value",
")",
":",
"def",
"decorate_func",
"(",
"func",
")",
":",
"setattr",
"(",
"func",
",",
"key",
",",
"value",
")",
"if",
"func",
".",
"__doc__",
"and",
"key",
"==",
"\"fctype\"",
":",
"func",
".",
"__doc_... | This method returns a decorator that sets the property key of the function to value | [
"This",
"method",
"returns",
"a",
"decorator",
"that",
"sets",
"the",
"property",
"key",
"of",
"the",
"function",
"to",
"value"
] | c72c9c574371cf7dd7d54e00a466792792e5d202 | https://github.com/blue-yonder/tsfresh/blob/c72c9c574371cf7dd7d54e00a466792792e5d202/tsfresh/feature_extraction/feature_calculators.py#L170-L179 | train | This method returns a decorator that sets the property key of the function to value | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
blue-yonder/tsfresh | tsfresh/feature_extraction/feature_calculators.py | variance_larger_than_standard_deviation | def variance_larger_than_standard_deviation(x):
"""
Boolean variable denoting if the variance of x is greater than its standard deviation. Is equal to variance of x
being larger than 1
:param x: the time series to calculate the feature of
:type x: numpy.ndarray
:return: the value of this featur... | python | def variance_larger_than_standard_deviation(x):
"""
Boolean variable denoting if the variance of x is greater than its standard deviation. Is equal to variance of x
being larger than 1
:param x: the time series to calculate the feature of
:type x: numpy.ndarray
:return: the value of this featur... | [
"def",
"variance_larger_than_standard_deviation",
"(",
"x",
")",
":",
"y",
"=",
"np",
".",
"var",
"(",
"x",
")",
"return",
"y",
">",
"np",
".",
"sqrt",
"(",
"y",
")"
] | Boolean variable denoting if the variance of x is greater than its standard deviation. Is equal to variance of x
being larger than 1
:param x: the time series to calculate the feature of
:type x: numpy.ndarray
:return: the value of this feature
:return type: bool | [
"Boolean",
"variable",
"denoting",
"if",
"the",
"variance",
"of",
"x",
"is",
"greater",
"than",
"its",
"standard",
"deviation",
".",
"Is",
"equal",
"to",
"variance",
"of",
"x",
"being",
"larger",
"than",
"1"
] | c72c9c574371cf7dd7d54e00a466792792e5d202 | https://github.com/blue-yonder/tsfresh/blob/c72c9c574371cf7dd7d54e00a466792792e5d202/tsfresh/feature_extraction/feature_calculators.py#L183-L194 | train | Returns a boolean variable denoting if the variance of x is greater than its standard deviation. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
blue-yonder/tsfresh | tsfresh/feature_extraction/feature_calculators.py | ratio_beyond_r_sigma | def ratio_beyond_r_sigma(x, r):
"""
Ratio of values that are more than r*std(x) (so r sigma) away from the mean of x.
:param x: the time series to calculate the feature of
:type x: iterable
:return: the value of this feature
:return type: float
"""
if not isinstance(x, (np.ndarray, pd.S... | python | def ratio_beyond_r_sigma(x, r):
"""
Ratio of values that are more than r*std(x) (so r sigma) away from the mean of x.
:param x: the time series to calculate the feature of
:type x: iterable
:return: the value of this feature
:return type: float
"""
if not isinstance(x, (np.ndarray, pd.S... | [
"def",
"ratio_beyond_r_sigma",
"(",
"x",
",",
"r",
")",
":",
"if",
"not",
"isinstance",
"(",
"x",
",",
"(",
"np",
".",
"ndarray",
",",
"pd",
".",
"Series",
")",
")",
":",
"x",
"=",
"np",
".",
"asarray",
"(",
"x",
")",
"return",
"np",
".",
"sum"... | Ratio of values that are more than r*std(x) (so r sigma) away from the mean of x.
:param x: the time series to calculate the feature of
:type x: iterable
:return: the value of this feature
:return type: float | [
"Ratio",
"of",
"values",
"that",
"are",
"more",
"than",
"r",
"*",
"std",
"(",
"x",
")",
"(",
"so",
"r",
"sigma",
")",
"away",
"from",
"the",
"mean",
"of",
"x",
"."
] | c72c9c574371cf7dd7d54e00a466792792e5d202 | https://github.com/blue-yonder/tsfresh/blob/c72c9c574371cf7dd7d54e00a466792792e5d202/tsfresh/feature_extraction/feature_calculators.py#L198-L209 | train | Ratio of values that are more than r * std ( x so r sigma away from the mean of x. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
blue-yonder/tsfresh | tsfresh/feature_extraction/feature_calculators.py | large_standard_deviation | def large_standard_deviation(x, r):
"""
Boolean variable denoting if the standard dev of x is higher
than 'r' times the range = difference between max and min of x.
Hence it checks if
.. math::
std(x) > r * (max(X)-min(X))
According to a rule of the thumb, the standard deviation shoul... | python | def large_standard_deviation(x, r):
"""
Boolean variable denoting if the standard dev of x is higher
than 'r' times the range = difference between max and min of x.
Hence it checks if
.. math::
std(x) > r * (max(X)-min(X))
According to a rule of the thumb, the standard deviation shoul... | [
"def",
"large_standard_deviation",
"(",
"x",
",",
"r",
")",
":",
"if",
"not",
"isinstance",
"(",
"x",
",",
"(",
"np",
".",
"ndarray",
",",
"pd",
".",
"Series",
")",
")",
":",
"x",
"=",
"np",
".",
"asarray",
"(",
"x",
")",
"return",
"np",
".",
"... | Boolean variable denoting if the standard dev of x is higher
than 'r' times the range = difference between max and min of x.
Hence it checks if
.. math::
std(x) > r * (max(X)-min(X))
According to a rule of the thumb, the standard deviation should be a forth of the range of the values.
:p... | [
"Boolean",
"variable",
"denoting",
"if",
"the",
"standard",
"dev",
"of",
"x",
"is",
"higher",
"than",
"r",
"times",
"the",
"range",
"=",
"difference",
"between",
"max",
"and",
"min",
"of",
"x",
".",
"Hence",
"it",
"checks",
"if"
] | c72c9c574371cf7dd7d54e00a466792792e5d202 | https://github.com/blue-yonder/tsfresh/blob/c72c9c574371cf7dd7d54e00a466792792e5d202/tsfresh/feature_extraction/feature_calculators.py#L213-L234 | train | Boolean variable denoting if the standard deviation of x is higher than r times the range of max and min of x. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
blue-yonder/tsfresh | tsfresh/feature_extraction/feature_calculators.py | has_duplicate_max | def has_duplicate_max(x):
"""
Checks if the maximum value of x is observed more than once
:param x: the time series to calculate the feature of
:type x: numpy.ndarray
:return: the value of this feature
:return type: bool
"""
if not isinstance(x, (np.ndarray, pd.Series)):
x = np.... | python | def has_duplicate_max(x):
"""
Checks if the maximum value of x is observed more than once
:param x: the time series to calculate the feature of
:type x: numpy.ndarray
:return: the value of this feature
:return type: bool
"""
if not isinstance(x, (np.ndarray, pd.Series)):
x = np.... | [
"def",
"has_duplicate_max",
"(",
"x",
")",
":",
"if",
"not",
"isinstance",
"(",
"x",
",",
"(",
"np",
".",
"ndarray",
",",
"pd",
".",
"Series",
")",
")",
":",
"x",
"=",
"np",
".",
"asarray",
"(",
"x",
")",
"return",
"np",
".",
"sum",
"(",
"x",
... | Checks if the maximum value of x is observed more than once
:param x: the time series to calculate the feature of
:type x: numpy.ndarray
:return: the value of this feature
:return type: bool | [
"Checks",
"if",
"the",
"maximum",
"value",
"of",
"x",
"is",
"observed",
"more",
"than",
"once"
] | c72c9c574371cf7dd7d54e00a466792792e5d202 | https://github.com/blue-yonder/tsfresh/blob/c72c9c574371cf7dd7d54e00a466792792e5d202/tsfresh/feature_extraction/feature_calculators.py#L262-L273 | train | Checks if the maximum value of x is observed more than once | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
blue-yonder/tsfresh | tsfresh/feature_extraction/feature_calculators.py | has_duplicate_min | def has_duplicate_min(x):
"""
Checks if the minimal value of x is observed more than once
:param x: the time series to calculate the feature of
:type x: numpy.ndarray
:return: the value of this feature
:return type: bool
"""
if not isinstance(x, (np.ndarray, pd.Series)):
x = np.... | python | def has_duplicate_min(x):
"""
Checks if the minimal value of x is observed more than once
:param x: the time series to calculate the feature of
:type x: numpy.ndarray
:return: the value of this feature
:return type: bool
"""
if not isinstance(x, (np.ndarray, pd.Series)):
x = np.... | [
"def",
"has_duplicate_min",
"(",
"x",
")",
":",
"if",
"not",
"isinstance",
"(",
"x",
",",
"(",
"np",
".",
"ndarray",
",",
"pd",
".",
"Series",
")",
")",
":",
"x",
"=",
"np",
".",
"asarray",
"(",
"x",
")",
"return",
"np",
".",
"sum",
"(",
"x",
... | Checks if the minimal value of x is observed more than once
:param x: the time series to calculate the feature of
:type x: numpy.ndarray
:return: the value of this feature
:return type: bool | [
"Checks",
"if",
"the",
"minimal",
"value",
"of",
"x",
"is",
"observed",
"more",
"than",
"once"
] | c72c9c574371cf7dd7d54e00a466792792e5d202 | https://github.com/blue-yonder/tsfresh/blob/c72c9c574371cf7dd7d54e00a466792792e5d202/tsfresh/feature_extraction/feature_calculators.py#L277-L288 | train | Checks if the minimal value of x is observed more than once | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
blue-yonder/tsfresh | tsfresh/feature_extraction/feature_calculators.py | has_duplicate | def has_duplicate(x):
"""
Checks if any value in x occurs more than once
:param x: the time series to calculate the feature of
:type x: numpy.ndarray
:return: the value of this feature
:return type: bool
"""
if not isinstance(x, (np.ndarray, pd.Series)):
x = np.asarray(x)
re... | python | def has_duplicate(x):
"""
Checks if any value in x occurs more than once
:param x: the time series to calculate the feature of
:type x: numpy.ndarray
:return: the value of this feature
:return type: bool
"""
if not isinstance(x, (np.ndarray, pd.Series)):
x = np.asarray(x)
re... | [
"def",
"has_duplicate",
"(",
"x",
")",
":",
"if",
"not",
"isinstance",
"(",
"x",
",",
"(",
"np",
".",
"ndarray",
",",
"pd",
".",
"Series",
")",
")",
":",
"x",
"=",
"np",
".",
"asarray",
"(",
"x",
")",
"return",
"x",
".",
"size",
"!=",
"np",
"... | Checks if any value in x occurs more than once
:param x: the time series to calculate the feature of
:type x: numpy.ndarray
:return: the value of this feature
:return type: bool | [
"Checks",
"if",
"any",
"value",
"in",
"x",
"occurs",
"more",
"than",
"once"
] | c72c9c574371cf7dd7d54e00a466792792e5d202 | https://github.com/blue-yonder/tsfresh/blob/c72c9c574371cf7dd7d54e00a466792792e5d202/tsfresh/feature_extraction/feature_calculators.py#L292-L303 | train | Checks if any value in x occurs more than once | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
blue-yonder/tsfresh | tsfresh/feature_extraction/feature_calculators.py | partial_autocorrelation | def partial_autocorrelation(x, param):
"""
Calculates the value of the partial autocorrelation function at the given lag. The lag `k` partial autocorrelation
of a time series :math:`\\lbrace x_t, t = 1 \\ldots T \\rbrace` equals the partial correlation of :math:`x_t` and
:math:`x_{t-k}`, adjusted for th... | python | def partial_autocorrelation(x, param):
"""
Calculates the value of the partial autocorrelation function at the given lag. The lag `k` partial autocorrelation
of a time series :math:`\\lbrace x_t, t = 1 \\ldots T \\rbrace` equals the partial correlation of :math:`x_t` and
:math:`x_{t-k}`, adjusted for th... | [
"def",
"partial_autocorrelation",
"(",
"x",
",",
"param",
")",
":",
"# Check the difference between demanded lags by param and possible lags to calculate (depends on len(x))",
"max_demanded_lag",
"=",
"max",
"(",
"[",
"lag",
"[",
"\"lag\"",
"]",
"for",
"lag",
"in",
"param",... | Calculates the value of the partial autocorrelation function at the given lag. The lag `k` partial autocorrelation
of a time series :math:`\\lbrace x_t, t = 1 \\ldots T \\rbrace` equals the partial correlation of :math:`x_t` and
:math:`x_{t-k}`, adjusted for the intermediate variables
:math:`\\lbrace x_{t-1... | [
"Calculates",
"the",
"value",
"of",
"the",
"partial",
"autocorrelation",
"function",
"at",
"the",
"given",
"lag",
".",
"The",
"lag",
"k",
"partial",
"autocorrelation",
"of",
"a",
"time",
"series",
":",
"math",
":",
"\\\\",
"lbrace",
"x_t",
"t",
"=",
"1",
... | c72c9c574371cf7dd7d54e00a466792792e5d202 | https://github.com/blue-yonder/tsfresh/blob/c72c9c574371cf7dd7d54e00a466792792e5d202/tsfresh/feature_extraction/feature_calculators.py#L370-L418 | train | Calculates the partial autocorrelation function at the given lag. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
blue-yonder/tsfresh | tsfresh/feature_extraction/feature_calculators.py | abs_energy | def abs_energy(x):
"""
Returns the absolute energy of the time series which is the sum over the squared values
.. math::
E = \\sum_{i=1,\ldots, n} x_i^2
:param x: the time series to calculate the feature of
:type x: numpy.ndarray
:return: the value of this feature
:return type: fl... | python | def abs_energy(x):
"""
Returns the absolute energy of the time series which is the sum over the squared values
.. math::
E = \\sum_{i=1,\ldots, n} x_i^2
:param x: the time series to calculate the feature of
:type x: numpy.ndarray
:return: the value of this feature
:return type: fl... | [
"def",
"abs_energy",
"(",
"x",
")",
":",
"if",
"not",
"isinstance",
"(",
"x",
",",
"(",
"np",
".",
"ndarray",
",",
"pd",
".",
"Series",
")",
")",
":",
"x",
"=",
"np",
".",
"asarray",
"(",
"x",
")",
"return",
"np",
".",
"dot",
"(",
"x",
",",
... | Returns the absolute energy of the time series which is the sum over the squared values
.. math::
E = \\sum_{i=1,\ldots, n} x_i^2
:param x: the time series to calculate the feature of
:type x: numpy.ndarray
:return: the value of this feature
:return type: float | [
"Returns",
"the",
"absolute",
"energy",
"of",
"the",
"time",
"series",
"which",
"is",
"the",
"sum",
"over",
"the",
"squared",
"values"
] | c72c9c574371cf7dd7d54e00a466792792e5d202 | https://github.com/blue-yonder/tsfresh/blob/c72c9c574371cf7dd7d54e00a466792792e5d202/tsfresh/feature_extraction/feature_calculators.py#L454-L469 | train | Returns the absolute energy of the time series which is the sum over the squared values
| Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.