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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
hugapi/hug | hug/decorators.py | auto_kwargs | def auto_kwargs(function):
"""Modifies the provided function to support kwargs by only passing along kwargs for parameters it accepts"""
supported = introspect.arguments(function)
@wraps(function)
def call_function(*args, **kwargs):
return function(*args, **{key: value for key, value in kwargs.... | python | def auto_kwargs(function):
"""Modifies the provided function to support kwargs by only passing along kwargs for parameters it accepts"""
supported = introspect.arguments(function)
@wraps(function)
def call_function(*args, **kwargs):
return function(*args, **{key: value for key, value in kwargs.... | [
"def",
"auto_kwargs",
"(",
"function",
")",
":",
"supported",
"=",
"introspect",
".",
"arguments",
"(",
"function",
")",
"@",
"wraps",
"(",
"function",
")",
"def",
"call_function",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"function"... | Modifies the provided function to support kwargs by only passing along kwargs for parameters it accepts | [
"Modifies",
"the",
"provided",
"function",
"to",
"support",
"kwargs",
"by",
"only",
"passing",
"along",
"kwargs",
"for",
"parameters",
"it",
"accepts"
] | 080901c81576657f82e2432fd4a82f1d0d2f370c | https://github.com/hugapi/hug/blob/080901c81576657f82e2432fd4a82f1d0d2f370c/hug/decorators.py#L201-L208 | train | Modifies the provided function to support kwargs by only passing along kwargs for parameters it accepts | 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... |
hugapi/hug | examples/use_socket.py | get_time | def get_time():
"""Get time from a locally running NTP server"""
time_request = '\x1b' + 47 * '\0'
now = struct.unpack("!12I", ntp_service.request(time_request, timeout=5.0).data.read())[10]
return time.ctime(now - EPOCH_START) | python | def get_time():
"""Get time from a locally running NTP server"""
time_request = '\x1b' + 47 * '\0'
now = struct.unpack("!12I", ntp_service.request(time_request, timeout=5.0).data.read())[10]
return time.ctime(now - EPOCH_START) | [
"def",
"get_time",
"(",
")",
":",
"time_request",
"=",
"'\\x1b'",
"+",
"47",
"*",
"'\\0'",
"now",
"=",
"struct",
".",
"unpack",
"(",
"\"!12I\"",
",",
"ntp_service",
".",
"request",
"(",
"time_request",
",",
"timeout",
"=",
"5.0",
")",
".",
"data",
".",... | Get time from a locally running NTP server | [
"Get",
"time",
"from",
"a",
"locally",
"running",
"NTP",
"server"
] | 080901c81576657f82e2432fd4a82f1d0d2f370c | https://github.com/hugapi/hug/blob/080901c81576657f82e2432fd4a82f1d0d2f370c/examples/use_socket.py#L14-L19 | train | Get time from a locally running NTP server | 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... |
hugapi/hug | examples/use_socket.py | reverse_http_proxy | def reverse_http_proxy(length: int=100):
"""Simple reverse http proxy function that returns data/html from another http server (via sockets)
only drawback is the peername is static, and currently does not support being changed.
Example: curl localhost:8000/reverse_http_proxy?length=400"""
http_request ... | python | def reverse_http_proxy(length: int=100):
"""Simple reverse http proxy function that returns data/html from another http server (via sockets)
only drawback is the peername is static, and currently does not support being changed.
Example: curl localhost:8000/reverse_http_proxy?length=400"""
http_request ... | [
"def",
"reverse_http_proxy",
"(",
"length",
":",
"int",
"=",
"100",
")",
":",
"http_request",
"=",
"\"\"\"\nGET / HTTP/1.0\\r\\n\\r\\n\nHost: www.google.com\\r\\n\\r\\n\n\\r\\n\\r\\n\n\"\"\"",
"return",
"http_socket",
".",
"request",
"(",
"http_request",
",",
"timeout",
"="... | Simple reverse http proxy function that returns data/html from another http server (via sockets)
only drawback is the peername is static, and currently does not support being changed.
Example: curl localhost:8000/reverse_http_proxy?length=400 | [
"Simple",
"reverse",
"http",
"proxy",
"function",
"that",
"returns",
"data",
"/",
"html",
"from",
"another",
"http",
"server",
"(",
"via",
"sockets",
")",
"only",
"drawback",
"is",
"the",
"peername",
"is",
"static",
"and",
"currently",
"does",
"not",
"suppor... | 080901c81576657f82e2432fd4a82f1d0d2f370c | https://github.com/hugapi/hug/blob/080901c81576657f82e2432fd4a82f1d0d2f370c/examples/use_socket.py#L23-L33 | train | Simple http proxy function that returns data from another http server | 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... |
hugapi/hug | hug/validate.py | all | def all(*validators):
"""Validation only succeeds if all passed in validators return no errors"""
def validate_all(fields):
for validator in validators:
errors = validator(fields)
if errors:
return errors
validate_all.__doc__ = " and ".join(validator.__doc__ ... | python | def all(*validators):
"""Validation only succeeds if all passed in validators return no errors"""
def validate_all(fields):
for validator in validators:
errors = validator(fields)
if errors:
return errors
validate_all.__doc__ = " and ".join(validator.__doc__ ... | [
"def",
"all",
"(",
"*",
"validators",
")",
":",
"def",
"validate_all",
"(",
"fields",
")",
":",
"for",
"validator",
"in",
"validators",
":",
"errors",
"=",
"validator",
"(",
"fields",
")",
"if",
"errors",
":",
"return",
"errors",
"validate_all",
".",
"__... | Validation only succeeds if all passed in validators return no errors | [
"Validation",
"only",
"succeeds",
"if",
"all",
"passed",
"in",
"validators",
"return",
"no",
"errors"
] | 080901c81576657f82e2432fd4a82f1d0d2f370c | https://github.com/hugapi/hug/blob/080901c81576657f82e2432fd4a82f1d0d2f370c/hug/validate.py#L25-L34 | train | Validate only succeeds if all passed in validators return no errors | 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... |
hugapi/hug | hug/validate.py | any | def any(*validators):
"""If any of the specified validators pass the validation succeeds"""
def validate_any(fields):
errors = {}
for validator in validators:
validation_errors = validator(fields)
if not validation_errors:
return
errors.update(... | python | def any(*validators):
"""If any of the specified validators pass the validation succeeds"""
def validate_any(fields):
errors = {}
for validator in validators:
validation_errors = validator(fields)
if not validation_errors:
return
errors.update(... | [
"def",
"any",
"(",
"*",
"validators",
")",
":",
"def",
"validate_any",
"(",
"fields",
")",
":",
"errors",
"=",
"{",
"}",
"for",
"validator",
"in",
"validators",
":",
"validation_errors",
"=",
"validator",
"(",
"fields",
")",
"if",
"not",
"validation_errors... | If any of the specified validators pass the validation succeeds | [
"If",
"any",
"of",
"the",
"specified",
"validators",
"pass",
"the",
"validation",
"succeeds"
] | 080901c81576657f82e2432fd4a82f1d0d2f370c | https://github.com/hugapi/hug/blob/080901c81576657f82e2432fd4a82f1d0d2f370c/hug/validate.py#L37-L49 | train | Returns a validation function that checks if any of the specified validators pass the validation succeeds. | 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... |
hugapi/hug | hug/validate.py | contains_one_of | def contains_one_of(*fields):
"""Enables ensuring that one of multiple optional fields is set"""
message = 'Must contain any one of the following fields: {0}'.format(', '.join(fields))
def check_contains(endpoint_fields):
for field in fields:
if field in endpoint_fields:
... | python | def contains_one_of(*fields):
"""Enables ensuring that one of multiple optional fields is set"""
message = 'Must contain any one of the following fields: {0}'.format(', '.join(fields))
def check_contains(endpoint_fields):
for field in fields:
if field in endpoint_fields:
... | [
"def",
"contains_one_of",
"(",
"*",
"fields",
")",
":",
"message",
"=",
"'Must contain any one of the following fields: {0}'",
".",
"format",
"(",
"', '",
".",
"join",
"(",
"fields",
")",
")",
"def",
"check_contains",
"(",
"endpoint_fields",
")",
":",
"for",
"fi... | Enables ensuring that one of multiple optional fields is set | [
"Enables",
"ensuring",
"that",
"one",
"of",
"multiple",
"optional",
"fields",
"is",
"set"
] | 080901c81576657f82e2432fd4a82f1d0d2f370c | https://github.com/hugapi/hug/blob/080901c81576657f82e2432fd4a82f1d0d2f370c/hug/validate.py#L52-L66 | train | Enables ensuring that one of multiple optional fields is 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... |
hugapi/hug | hug/routing.py | Router.requires | def requires(self, requirements, **overrides):
"""Adds additional requirements to the specified route"""
return self.where(requires=tuple(self.route.get('requires', ())) + tuple(requirements), **overrides) | python | def requires(self, requirements, **overrides):
"""Adds additional requirements to the specified route"""
return self.where(requires=tuple(self.route.get('requires', ())) + tuple(requirements), **overrides) | [
"def",
"requires",
"(",
"self",
",",
"requirements",
",",
"*",
"*",
"overrides",
")",
":",
"return",
"self",
".",
"where",
"(",
"requires",
"=",
"tuple",
"(",
"self",
".",
"route",
".",
"get",
"(",
"'requires'",
",",
"(",
")",
")",
")",
"+",
"tuple... | Adds additional requirements to the specified route | [
"Adds",
"additional",
"requirements",
"to",
"the",
"specified",
"route"
] | 080901c81576657f82e2432fd4a82f1d0d2f370c | https://github.com/hugapi/hug/blob/080901c81576657f82e2432fd4a82f1d0d2f370c/hug/routing.py#L78-L80 | train | Adds additional requirements to the specified route | 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... |
hugapi/hug | hug/routing.py | Router.doesnt_require | def doesnt_require(self, requirements, **overrides):
"""Removes individual requirements while keeping all other defined ones within a route"""
return self.where(requires=tuple(set(self.route.get('requires', ())).difference(requirements if
type(... | python | def doesnt_require(self, requirements, **overrides):
"""Removes individual requirements while keeping all other defined ones within a route"""
return self.where(requires=tuple(set(self.route.get('requires', ())).difference(requirements if
type(... | [
"def",
"doesnt_require",
"(",
"self",
",",
"requirements",
",",
"*",
"*",
"overrides",
")",
":",
"return",
"self",
".",
"where",
"(",
"requires",
"=",
"tuple",
"(",
"set",
"(",
"self",
".",
"route",
".",
"get",
"(",
"'requires'",
",",
"(",
")",
")",
... | Removes individual requirements while keeping all other defined ones within a route | [
"Removes",
"individual",
"requirements",
"while",
"keeping",
"all",
"other",
"defined",
"ones",
"within",
"a",
"route"
] | 080901c81576657f82e2432fd4a82f1d0d2f370c | https://github.com/hugapi/hug/blob/080901c81576657f82e2432fd4a82f1d0d2f370c/hug/routing.py#L82-L85 | train | Removes individual requirements while keeping all other defined ones within a route | 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... |
hugapi/hug | hug/routing.py | Router.where | def where(self, **overrides):
"""Creates a new route, based on the current route, with the specified overrided values"""
route_data = self.route.copy()
route_data.update(overrides)
return self.__class__(**route_data) | python | def where(self, **overrides):
"""Creates a new route, based on the current route, with the specified overrided values"""
route_data = self.route.copy()
route_data.update(overrides)
return self.__class__(**route_data) | [
"def",
"where",
"(",
"self",
",",
"*",
"*",
"overrides",
")",
":",
"route_data",
"=",
"self",
".",
"route",
".",
"copy",
"(",
")",
"route_data",
".",
"update",
"(",
"overrides",
")",
"return",
"self",
".",
"__class__",
"(",
"*",
"*",
"route_data",
")... | Creates a new route, based on the current route, with the specified overrided values | [
"Creates",
"a",
"new",
"route",
"based",
"on",
"the",
"current",
"route",
"with",
"the",
"specified",
"overrided",
"values"
] | 080901c81576657f82e2432fd4a82f1d0d2f370c | https://github.com/hugapi/hug/blob/080901c81576657f82e2432fd4a82f1d0d2f370c/hug/routing.py#L91-L95 | train | Creates a new route based on the current route with the specified overrided 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... |
hugapi/hug | hug/routing.py | InternalValidation.raise_on_invalid | def raise_on_invalid(self, setting=True, **overrides):
"""Sets the route to raise validation errors instead of catching them"""
return self.where(raise_on_invalid=setting, **overrides) | python | def raise_on_invalid(self, setting=True, **overrides):
"""Sets the route to raise validation errors instead of catching them"""
return self.where(raise_on_invalid=setting, **overrides) | [
"def",
"raise_on_invalid",
"(",
"self",
",",
"setting",
"=",
"True",
",",
"*",
"*",
"overrides",
")",
":",
"return",
"self",
".",
"where",
"(",
"raise_on_invalid",
"=",
"setting",
",",
"*",
"*",
"overrides",
")"
] | Sets the route to raise validation errors instead of catching them | [
"Sets",
"the",
"route",
"to",
"raise",
"validation",
"errors",
"instead",
"of",
"catching",
"them"
] | 080901c81576657f82e2432fd4a82f1d0d2f370c | https://github.com/hugapi/hug/blob/080901c81576657f82e2432fd4a82f1d0d2f370c/hug/routing.py#L142-L144 | train | Sets the route to raise validation errors instead of catching them | 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... |
hugapi/hug | hug/routing.py | HTTPRouter.parse_body | def parse_body(self, automatic=True, **overrides):
"""Tells hug to automatically parse the input body if it matches a registered input format"""
return self.where(parse_body=automatic, **overrides) | python | def parse_body(self, automatic=True, **overrides):
"""Tells hug to automatically parse the input body if it matches a registered input format"""
return self.where(parse_body=automatic, **overrides) | [
"def",
"parse_body",
"(",
"self",
",",
"automatic",
"=",
"True",
",",
"*",
"*",
"overrides",
")",
":",
"return",
"self",
".",
"where",
"(",
"parse_body",
"=",
"automatic",
",",
"*",
"*",
"overrides",
")"
] | Tells hug to automatically parse the input body if it matches a registered input format | [
"Tells",
"hug",
"to",
"automatically",
"parse",
"the",
"input",
"body",
"if",
"it",
"matches",
"a",
"registered",
"input",
"format"
] | 080901c81576657f82e2432fd4a82f1d0d2f370c | https://github.com/hugapi/hug/blob/080901c81576657f82e2432fd4a82f1d0d2f370c/hug/routing.py#L218-L220 | train | Tells hug to automatically parse the input body if it matches a registered input format | 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... |
hugapi/hug | hug/routing.py | HTTPRouter.add_response_headers | def add_response_headers(self, headers, **overrides):
"""Adds the specified response headers while keeping existing ones in-tact"""
response_headers = self.route.get('response_headers', {}).copy()
response_headers.update(headers)
return self.where(response_headers=response_headers, **ove... | python | def add_response_headers(self, headers, **overrides):
"""Adds the specified response headers while keeping existing ones in-tact"""
response_headers = self.route.get('response_headers', {}).copy()
response_headers.update(headers)
return self.where(response_headers=response_headers, **ove... | [
"def",
"add_response_headers",
"(",
"self",
",",
"headers",
",",
"*",
"*",
"overrides",
")",
":",
"response_headers",
"=",
"self",
".",
"route",
".",
"get",
"(",
"'response_headers'",
",",
"{",
"}",
")",
".",
"copy",
"(",
")",
"response_headers",
".",
"u... | Adds the specified response headers while keeping existing ones in-tact | [
"Adds",
"the",
"specified",
"response",
"headers",
"while",
"keeping",
"existing",
"ones",
"in",
"-",
"tact"
] | 080901c81576657f82e2432fd4a82f1d0d2f370c | https://github.com/hugapi/hug/blob/080901c81576657f82e2432fd4a82f1d0d2f370c/hug/routing.py#L242-L246 | train | Adds the specified response headers while keeping existing ones in - tact | 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... |
hugapi/hug | hug/routing.py | HTTPRouter.cache | def cache(self, private=False, max_age=31536000, s_maxage=None, no_cache=False, no_store=False,
must_revalidate=False, **overrides):
"""Convenience method for quickly adding cache header to route"""
parts = ('private' if private else 'public', 'max-age={0}'.format(max_age),
... | python | def cache(self, private=False, max_age=31536000, s_maxage=None, no_cache=False, no_store=False,
must_revalidate=False, **overrides):
"""Convenience method for quickly adding cache header to route"""
parts = ('private' if private else 'public', 'max-age={0}'.format(max_age),
... | [
"def",
"cache",
"(",
"self",
",",
"private",
"=",
"False",
",",
"max_age",
"=",
"31536000",
",",
"s_maxage",
"=",
"None",
",",
"no_cache",
"=",
"False",
",",
"no_store",
"=",
"False",
",",
"must_revalidate",
"=",
"False",
",",
"*",
"*",
"overrides",
")... | Convenience method for quickly adding cache header to route | [
"Convenience",
"method",
"for",
"quickly",
"adding",
"cache",
"header",
"to",
"route"
] | 080901c81576657f82e2432fd4a82f1d0d2f370c | https://github.com/hugapi/hug/blob/080901c81576657f82e2432fd4a82f1d0d2f370c/hug/routing.py#L248-L254 | train | Convenience method for quickly adding cache header to route | 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... |
hugapi/hug | hug/routing.py | HTTPRouter.allow_origins | def allow_origins(self, *origins, methods=None, max_age=None, credentials=None, headers=None, **overrides):
"""Convenience method for quickly allowing other resources to access this one"""
response_headers = {}
if origins:
@hug.response_middleware()
def process_data(reque... | python | def allow_origins(self, *origins, methods=None, max_age=None, credentials=None, headers=None, **overrides):
"""Convenience method for quickly allowing other resources to access this one"""
response_headers = {}
if origins:
@hug.response_middleware()
def process_data(reque... | [
"def",
"allow_origins",
"(",
"self",
",",
"*",
"origins",
",",
"methods",
"=",
"None",
",",
"max_age",
"=",
"None",
",",
"credentials",
"=",
"None",
",",
"headers",
"=",
"None",
",",
"*",
"*",
"overrides",
")",
":",
"response_headers",
"=",
"{",
"}",
... | Convenience method for quickly allowing other resources to access this one | [
"Convenience",
"method",
"for",
"quickly",
"allowing",
"other",
"resources",
"to",
"access",
"this",
"one"
] | 080901c81576657f82e2432fd4a82f1d0d2f370c | https://github.com/hugapi/hug/blob/080901c81576657f82e2432fd4a82f1d0d2f370c/hug/routing.py#L256-L277 | train | Convenience method for quickly allowing other resources to access this one | 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... |
hugapi/hug | hug/routing.py | URLRouter.get | def get(self, urls=None, **overrides):
"""Sets the acceptable HTTP method to a GET"""
if urls is not None:
overrides['urls'] = urls
return self.where(accept='GET', **overrides) | python | def get(self, urls=None, **overrides):
"""Sets the acceptable HTTP method to a GET"""
if urls is not None:
overrides['urls'] = urls
return self.where(accept='GET', **overrides) | [
"def",
"get",
"(",
"self",
",",
"urls",
"=",
"None",
",",
"*",
"*",
"overrides",
")",
":",
"if",
"urls",
"is",
"not",
"None",
":",
"overrides",
"[",
"'urls'",
"]",
"=",
"urls",
"return",
"self",
".",
"where",
"(",
"accept",
"=",
"'GET'",
",",
"*"... | Sets the acceptable HTTP method to a GET | [
"Sets",
"the",
"acceptable",
"HTTP",
"method",
"to",
"a",
"GET"
] | 080901c81576657f82e2432fd4a82f1d0d2f370c | https://github.com/hugapi/hug/blob/080901c81576657f82e2432fd4a82f1d0d2f370c/hug/routing.py#L431-L435 | train | Sets the acceptable HTTP method to a GET | 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... |
hugapi/hug | hug/routing.py | URLRouter.delete | def delete(self, urls=None, **overrides):
"""Sets the acceptable HTTP method to DELETE"""
if urls is not None:
overrides['urls'] = urls
return self.where(accept='DELETE', **overrides) | python | def delete(self, urls=None, **overrides):
"""Sets the acceptable HTTP method to DELETE"""
if urls is not None:
overrides['urls'] = urls
return self.where(accept='DELETE', **overrides) | [
"def",
"delete",
"(",
"self",
",",
"urls",
"=",
"None",
",",
"*",
"*",
"overrides",
")",
":",
"if",
"urls",
"is",
"not",
"None",
":",
"overrides",
"[",
"'urls'",
"]",
"=",
"urls",
"return",
"self",
".",
"where",
"(",
"accept",
"=",
"'DELETE'",
",",... | Sets the acceptable HTTP method to DELETE | [
"Sets",
"the",
"acceptable",
"HTTP",
"method",
"to",
"DELETE"
] | 080901c81576657f82e2432fd4a82f1d0d2f370c | https://github.com/hugapi/hug/blob/080901c81576657f82e2432fd4a82f1d0d2f370c/hug/routing.py#L437-L441 | train | Sets the acceptable HTTP method to DELETE | 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... |
hugapi/hug | hug/routing.py | URLRouter.post | def post(self, urls=None, **overrides):
"""Sets the acceptable HTTP method to POST"""
if urls is not None:
overrides['urls'] = urls
return self.where(accept='POST', **overrides) | python | def post(self, urls=None, **overrides):
"""Sets the acceptable HTTP method to POST"""
if urls is not None:
overrides['urls'] = urls
return self.where(accept='POST', **overrides) | [
"def",
"post",
"(",
"self",
",",
"urls",
"=",
"None",
",",
"*",
"*",
"overrides",
")",
":",
"if",
"urls",
"is",
"not",
"None",
":",
"overrides",
"[",
"'urls'",
"]",
"=",
"urls",
"return",
"self",
".",
"where",
"(",
"accept",
"=",
"'POST'",
",",
"... | Sets the acceptable HTTP method to POST | [
"Sets",
"the",
"acceptable",
"HTTP",
"method",
"to",
"POST"
] | 080901c81576657f82e2432fd4a82f1d0d2f370c | https://github.com/hugapi/hug/blob/080901c81576657f82e2432fd4a82f1d0d2f370c/hug/routing.py#L443-L447 | train | Sets the acceptable HTTP method to POST | 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... |
hugapi/hug | hug/routing.py | URLRouter.put | def put(self, urls=None, **overrides):
"""Sets the acceptable HTTP method to PUT"""
if urls is not None:
overrides['urls'] = urls
return self.where(accept='PUT', **overrides) | python | def put(self, urls=None, **overrides):
"""Sets the acceptable HTTP method to PUT"""
if urls is not None:
overrides['urls'] = urls
return self.where(accept='PUT', **overrides) | [
"def",
"put",
"(",
"self",
",",
"urls",
"=",
"None",
",",
"*",
"*",
"overrides",
")",
":",
"if",
"urls",
"is",
"not",
"None",
":",
"overrides",
"[",
"'urls'",
"]",
"=",
"urls",
"return",
"self",
".",
"where",
"(",
"accept",
"=",
"'PUT'",
",",
"*"... | Sets the acceptable HTTP method to PUT | [
"Sets",
"the",
"acceptable",
"HTTP",
"method",
"to",
"PUT"
] | 080901c81576657f82e2432fd4a82f1d0d2f370c | https://github.com/hugapi/hug/blob/080901c81576657f82e2432fd4a82f1d0d2f370c/hug/routing.py#L449-L453 | train | Sets the acceptable HTTP method to PUT | 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... |
hugapi/hug | hug/routing.py | URLRouter.trace | def trace(self, urls=None, **overrides):
"""Sets the acceptable HTTP method to TRACE"""
if urls is not None:
overrides['urls'] = urls
return self.where(accept='TRACE', **overrides) | python | def trace(self, urls=None, **overrides):
"""Sets the acceptable HTTP method to TRACE"""
if urls is not None:
overrides['urls'] = urls
return self.where(accept='TRACE', **overrides) | [
"def",
"trace",
"(",
"self",
",",
"urls",
"=",
"None",
",",
"*",
"*",
"overrides",
")",
":",
"if",
"urls",
"is",
"not",
"None",
":",
"overrides",
"[",
"'urls'",
"]",
"=",
"urls",
"return",
"self",
".",
"where",
"(",
"accept",
"=",
"'TRACE'",
",",
... | Sets the acceptable HTTP method to TRACE | [
"Sets",
"the",
"acceptable",
"HTTP",
"method",
"to",
"TRACE"
] | 080901c81576657f82e2432fd4a82f1d0d2f370c | https://github.com/hugapi/hug/blob/080901c81576657f82e2432fd4a82f1d0d2f370c/hug/routing.py#L455-L459 | train | Sets the acceptable HTTP method to TRACE | 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... |
hugapi/hug | hug/routing.py | URLRouter.patch | def patch(self, urls=None, **overrides):
"""Sets the acceptable HTTP method to PATCH"""
if urls is not None:
overrides['urls'] = urls
return self.where(accept='PATCH', **overrides) | python | def patch(self, urls=None, **overrides):
"""Sets the acceptable HTTP method to PATCH"""
if urls is not None:
overrides['urls'] = urls
return self.where(accept='PATCH', **overrides) | [
"def",
"patch",
"(",
"self",
",",
"urls",
"=",
"None",
",",
"*",
"*",
"overrides",
")",
":",
"if",
"urls",
"is",
"not",
"None",
":",
"overrides",
"[",
"'urls'",
"]",
"=",
"urls",
"return",
"self",
".",
"where",
"(",
"accept",
"=",
"'PATCH'",
",",
... | Sets the acceptable HTTP method to PATCH | [
"Sets",
"the",
"acceptable",
"HTTP",
"method",
"to",
"PATCH"
] | 080901c81576657f82e2432fd4a82f1d0d2f370c | https://github.com/hugapi/hug/blob/080901c81576657f82e2432fd4a82f1d0d2f370c/hug/routing.py#L461-L465 | train | Sets the acceptable HTTP method to PATCH | 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... |
hugapi/hug | hug/routing.py | URLRouter.options | def options(self, urls=None, **overrides):
"""Sets the acceptable HTTP method to OPTIONS"""
if urls is not None:
overrides['urls'] = urls
return self.where(accept='OPTIONS', **overrides) | python | def options(self, urls=None, **overrides):
"""Sets the acceptable HTTP method to OPTIONS"""
if urls is not None:
overrides['urls'] = urls
return self.where(accept='OPTIONS', **overrides) | [
"def",
"options",
"(",
"self",
",",
"urls",
"=",
"None",
",",
"*",
"*",
"overrides",
")",
":",
"if",
"urls",
"is",
"not",
"None",
":",
"overrides",
"[",
"'urls'",
"]",
"=",
"urls",
"return",
"self",
".",
"where",
"(",
"accept",
"=",
"'OPTIONS'",
",... | Sets the acceptable HTTP method to OPTIONS | [
"Sets",
"the",
"acceptable",
"HTTP",
"method",
"to",
"OPTIONS"
] | 080901c81576657f82e2432fd4a82f1d0d2f370c | https://github.com/hugapi/hug/blob/080901c81576657f82e2432fd4a82f1d0d2f370c/hug/routing.py#L467-L471 | train | Sets the acceptable HTTP method to OPTIONS | 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... |
hugapi/hug | hug/routing.py | URLRouter.head | def head(self, urls=None, **overrides):
"""Sets the acceptable HTTP method to HEAD"""
if urls is not None:
overrides['urls'] = urls
return self.where(accept='HEAD', **overrides) | python | def head(self, urls=None, **overrides):
"""Sets the acceptable HTTP method to HEAD"""
if urls is not None:
overrides['urls'] = urls
return self.where(accept='HEAD', **overrides) | [
"def",
"head",
"(",
"self",
",",
"urls",
"=",
"None",
",",
"*",
"*",
"overrides",
")",
":",
"if",
"urls",
"is",
"not",
"None",
":",
"overrides",
"[",
"'urls'",
"]",
"=",
"urls",
"return",
"self",
".",
"where",
"(",
"accept",
"=",
"'HEAD'",
",",
"... | Sets the acceptable HTTP method to HEAD | [
"Sets",
"the",
"acceptable",
"HTTP",
"method",
"to",
"HEAD"
] | 080901c81576657f82e2432fd4a82f1d0d2f370c | https://github.com/hugapi/hug/blob/080901c81576657f82e2432fd4a82f1d0d2f370c/hug/routing.py#L473-L477 | train | Sets the acceptable HTTP method to HEAD | 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... |
hugapi/hug | hug/routing.py | URLRouter.connect | def connect(self, urls=None, **overrides):
"""Sets the acceptable HTTP method to CONNECT"""
if urls is not None:
overrides['urls'] = urls
return self.where(accept='CONNECT', **overrides) | python | def connect(self, urls=None, **overrides):
"""Sets the acceptable HTTP method to CONNECT"""
if urls is not None:
overrides['urls'] = urls
return self.where(accept='CONNECT', **overrides) | [
"def",
"connect",
"(",
"self",
",",
"urls",
"=",
"None",
",",
"*",
"*",
"overrides",
")",
":",
"if",
"urls",
"is",
"not",
"None",
":",
"overrides",
"[",
"'urls'",
"]",
"=",
"urls",
"return",
"self",
".",
"where",
"(",
"accept",
"=",
"'CONNECT'",
",... | Sets the acceptable HTTP method to CONNECT | [
"Sets",
"the",
"acceptable",
"HTTP",
"method",
"to",
"CONNECT"
] | 080901c81576657f82e2432fd4a82f1d0d2f370c | https://github.com/hugapi/hug/blob/080901c81576657f82e2432fd4a82f1d0d2f370c/hug/routing.py#L479-L483 | train | Sets the acceptable HTTP method to CONNECT | 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... |
hugapi/hug | hug/route.py | Object.http_methods | def http_methods(self, urls=None, **route_data):
"""Creates routes from a class, where the class method names should line up to HTTP METHOD types"""
def decorator(class_definition):
instance = class_definition
if isinstance(class_definition, type):
instance = clas... | python | def http_methods(self, urls=None, **route_data):
"""Creates routes from a class, where the class method names should line up to HTTP METHOD types"""
def decorator(class_definition):
instance = class_definition
if isinstance(class_definition, type):
instance = clas... | [
"def",
"http_methods",
"(",
"self",
",",
"urls",
"=",
"None",
",",
"*",
"*",
"route_data",
")",
":",
"def",
"decorator",
"(",
"class_definition",
")",
":",
"instance",
"=",
"class_definition",
"if",
"isinstance",
"(",
"class_definition",
",",
"type",
")",
... | Creates routes from a class, where the class method names should line up to HTTP METHOD types | [
"Creates",
"routes",
"from",
"a",
"class",
"where",
"the",
"class",
"method",
"names",
"should",
"line",
"up",
"to",
"HTTP",
"METHOD",
"types"
] | 080901c81576657f82e2432fd4a82f1d0d2f370c | https://github.com/hugapi/hug/blob/080901c81576657f82e2432fd4a82f1d0d2f370c/hug/route.py#L72-L95 | train | Creates routes from a class where the class method names should line up to HTTP METHOD types | 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... |
hugapi/hug | hug/route.py | Object.cli | def cli(self, method):
"""Registers a method on an Object as a CLI route"""
routes = getattr(method, '_hug_cli_routes', [])
routes.append(self.route)
method._hug_cli_routes = routes
return method | python | def cli(self, method):
"""Registers a method on an Object as a CLI route"""
routes = getattr(method, '_hug_cli_routes', [])
routes.append(self.route)
method._hug_cli_routes = routes
return method | [
"def",
"cli",
"(",
"self",
",",
"method",
")",
":",
"routes",
"=",
"getattr",
"(",
"method",
",",
"'_hug_cli_routes'",
",",
"[",
"]",
")",
"routes",
".",
"append",
"(",
"self",
".",
"route",
")",
"method",
".",
"_hug_cli_routes",
"=",
"routes",
"return... | Registers a method on an Object as a CLI route | [
"Registers",
"a",
"method",
"on",
"an",
"Object",
"as",
"a",
"CLI",
"route"
] | 080901c81576657f82e2432fd4a82f1d0d2f370c | https://github.com/hugapi/hug/blob/080901c81576657f82e2432fd4a82f1d0d2f370c/hug/route.py#L97-L102 | train | Registers a method on an Object as a CLI route | 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... |
hugapi/hug | hug/route.py | API.http | def http(self, *args, **kwargs):
"""Starts the process of building a new HTTP route linked to this API instance"""
kwargs['api'] = self.api
return http(*args, **kwargs) | python | def http(self, *args, **kwargs):
"""Starts the process of building a new HTTP route linked to this API instance"""
kwargs['api'] = self.api
return http(*args, **kwargs) | [
"def",
"http",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"kwargs",
"[",
"'api'",
"]",
"=",
"self",
".",
"api",
"return",
"http",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | Starts the process of building a new HTTP route linked to this API instance | [
"Starts",
"the",
"process",
"of",
"building",
"a",
"new",
"HTTP",
"route",
"linked",
"to",
"this",
"API",
"instance"
] | 080901c81576657f82e2432fd4a82f1d0d2f370c | https://github.com/hugapi/hug/blob/080901c81576657f82e2432fd4a82f1d0d2f370c/hug/route.py#L114-L117 | train | Starts the process of building a new HTTP route linked to this API 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... |
hugapi/hug | hug/route.py | API.not_found | def not_found(self, *args, **kwargs):
"""Defines the handler that should handle not found requests against this API"""
kwargs['api'] = self.api
return not_found(*args, **kwargs) | python | def not_found(self, *args, **kwargs):
"""Defines the handler that should handle not found requests against this API"""
kwargs['api'] = self.api
return not_found(*args, **kwargs) | [
"def",
"not_found",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"kwargs",
"[",
"'api'",
"]",
"=",
"self",
".",
"api",
"return",
"not_found",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | Defines the handler that should handle not found requests against this API | [
"Defines",
"the",
"handler",
"that",
"should",
"handle",
"not",
"found",
"requests",
"against",
"this",
"API"
] | 080901c81576657f82e2432fd4a82f1d0d2f370c | https://github.com/hugapi/hug/blob/080901c81576657f82e2432fd4a82f1d0d2f370c/hug/route.py#L126-L129 | train | Defines the handler that should handle not found requests against this 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... |
hugapi/hug | hug/route.py | API.static | def static(self, *args, **kwargs):
"""Define the routes to static files the API should expose"""
kwargs['api'] = self.api
return static(*args, **kwargs) | python | def static(self, *args, **kwargs):
"""Define the routes to static files the API should expose"""
kwargs['api'] = self.api
return static(*args, **kwargs) | [
"def",
"static",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"kwargs",
"[",
"'api'",
"]",
"=",
"self",
".",
"api",
"return",
"static",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | Define the routes to static files the API should expose | [
"Define",
"the",
"routes",
"to",
"static",
"files",
"the",
"API",
"should",
"expose"
] | 080901c81576657f82e2432fd4a82f1d0d2f370c | https://github.com/hugapi/hug/blob/080901c81576657f82e2432fd4a82f1d0d2f370c/hug/route.py#L131-L134 | train | Define the routes to static files the API should expose | 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... |
hugapi/hug | hug/route.py | API.sink | def sink(self, *args, **kwargs):
"""Define URL prefixes/handler matches where everything under the URL prefix should be handled"""
kwargs['api'] = self.api
return sink(*args, **kwargs) | python | def sink(self, *args, **kwargs):
"""Define URL prefixes/handler matches where everything under the URL prefix should be handled"""
kwargs['api'] = self.api
return sink(*args, **kwargs) | [
"def",
"sink",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"kwargs",
"[",
"'api'",
"]",
"=",
"self",
".",
"api",
"return",
"sink",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | Define URL prefixes/handler matches where everything under the URL prefix should be handled | [
"Define",
"URL",
"prefixes",
"/",
"handler",
"matches",
"where",
"everything",
"under",
"the",
"URL",
"prefix",
"should",
"be",
"handled"
] | 080901c81576657f82e2432fd4a82f1d0d2f370c | https://github.com/hugapi/hug/blob/080901c81576657f82e2432fd4a82f1d0d2f370c/hug/route.py#L136-L139 | train | Define URL prefixes and handler matches where everything under the URL prefix should be handled | 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... |
hugapi/hug | hug/route.py | API.exception | def exception(self, *args, **kwargs):
"""Defines how this API should handle the provided exceptions"""
kwargs['api'] = self.api
return exception(*args, **kwargs) | python | def exception(self, *args, **kwargs):
"""Defines how this API should handle the provided exceptions"""
kwargs['api'] = self.api
return exception(*args, **kwargs) | [
"def",
"exception",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"kwargs",
"[",
"'api'",
"]",
"=",
"self",
".",
"api",
"return",
"exception",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | Defines how this API should handle the provided exceptions | [
"Defines",
"how",
"this",
"API",
"should",
"handle",
"the",
"provided",
"exceptions"
] | 080901c81576657f82e2432fd4a82f1d0d2f370c | https://github.com/hugapi/hug/blob/080901c81576657f82e2432fd4a82f1d0d2f370c/hug/route.py#L141-L144 | train | Defines how this API should handle the provided exceptions | 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... |
hugapi/hug | hug/route.py | API.cli | def cli(self, *args, **kwargs):
"""Defines a CLI function that should be routed by this API"""
kwargs['api'] = self.api
return cli(*args, **kwargs) | python | def cli(self, *args, **kwargs):
"""Defines a CLI function that should be routed by this API"""
kwargs['api'] = self.api
return cli(*args, **kwargs) | [
"def",
"cli",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"kwargs",
"[",
"'api'",
"]",
"=",
"self",
".",
"api",
"return",
"cli",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | Defines a CLI function that should be routed by this API | [
"Defines",
"a",
"CLI",
"function",
"that",
"should",
"be",
"routed",
"by",
"this",
"API"
] | 080901c81576657f82e2432fd4a82f1d0d2f370c | https://github.com/hugapi/hug/blob/080901c81576657f82e2432fd4a82f1d0d2f370c/hug/route.py#L146-L149 | train | Defines a function that should be routed by this 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... |
hugapi/hug | hug/route.py | API.object | def object(self, *args, **kwargs):
"""Registers a class based router to this API"""
kwargs['api'] = self.api
return Object(*args, **kwargs) | python | def object(self, *args, **kwargs):
"""Registers a class based router to this API"""
kwargs['api'] = self.api
return Object(*args, **kwargs) | [
"def",
"object",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"kwargs",
"[",
"'api'",
"]",
"=",
"self",
".",
"api",
"return",
"Object",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | Registers a class based router to this API | [
"Registers",
"a",
"class",
"based",
"router",
"to",
"this",
"API"
] | 080901c81576657f82e2432fd4a82f1d0d2f370c | https://github.com/hugapi/hug/blob/080901c81576657f82e2432fd4a82f1d0d2f370c/hug/route.py#L151-L154 | train | Registers a class based router to this 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... |
hugapi/hug | hug/api.py | HTTPInterfaceAPI.urls | def urls(self):
"""Returns a generator of all URLs attached to this API"""
for base_url, mapping in self.routes.items():
for url, _ in mapping.items():
yield base_url + url | python | def urls(self):
"""Returns a generator of all URLs attached to this API"""
for base_url, mapping in self.routes.items():
for url, _ in mapping.items():
yield base_url + url | [
"def",
"urls",
"(",
"self",
")",
":",
"for",
"base_url",
",",
"mapping",
"in",
"self",
".",
"routes",
".",
"items",
"(",
")",
":",
"for",
"url",
",",
"_",
"in",
"mapping",
".",
"items",
"(",
")",
":",
"yield",
"base_url",
"+",
"url"
] | Returns a generator of all URLs attached to this API | [
"Returns",
"a",
"generator",
"of",
"all",
"URLs",
"attached",
"to",
"this",
"API"
] | 080901c81576657f82e2432fd4a82f1d0d2f370c | https://github.com/hugapi/hug/blob/080901c81576657f82e2432fd4a82f1d0d2f370c/hug/api.py#L102-L106 | train | Returns a generator of all URLs attached to this 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... |
hugapi/hug | hug/api.py | HTTPInterfaceAPI.handlers | def handlers(self):
"""Returns all registered handlers attached to this API"""
used = []
for base_url, mapping in self.routes.items():
for url, methods in mapping.items():
for method, versions in methods.items():
for version, handler in versions.it... | python | def handlers(self):
"""Returns all registered handlers attached to this API"""
used = []
for base_url, mapping in self.routes.items():
for url, methods in mapping.items():
for method, versions in methods.items():
for version, handler in versions.it... | [
"def",
"handlers",
"(",
"self",
")",
":",
"used",
"=",
"[",
"]",
"for",
"base_url",
",",
"mapping",
"in",
"self",
".",
"routes",
".",
"items",
"(",
")",
":",
"for",
"url",
",",
"methods",
"in",
"mapping",
".",
"items",
"(",
")",
":",
"for",
"meth... | Returns all registered handlers attached to this API | [
"Returns",
"all",
"registered",
"handlers",
"attached",
"to",
"this",
"API"
] | 080901c81576657f82e2432fd4a82f1d0d2f370c | https://github.com/hugapi/hug/blob/080901c81576657f82e2432fd4a82f1d0d2f370c/hug/api.py#L108-L117 | train | Returns all registered handlers attached to this 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... |
hugapi/hug | hug/api.py | HTTPInterfaceAPI.input_format | def input_format(self, content_type):
"""Returns the set input_format handler for the given content_type"""
return getattr(self, '_input_format', {}).get(content_type, hug.defaults.input_format.get(content_type, None)) | python | def input_format(self, content_type):
"""Returns the set input_format handler for the given content_type"""
return getattr(self, '_input_format', {}).get(content_type, hug.defaults.input_format.get(content_type, None)) | [
"def",
"input_format",
"(",
"self",
",",
"content_type",
")",
":",
"return",
"getattr",
"(",
"self",
",",
"'_input_format'",
",",
"{",
"}",
")",
".",
"get",
"(",
"content_type",
",",
"hug",
".",
"defaults",
".",
"input_format",
".",
"get",
"(",
"content_... | Returns the set input_format handler for the given content_type | [
"Returns",
"the",
"set",
"input_format",
"handler",
"for",
"the",
"given",
"content_type"
] | 080901c81576657f82e2432fd4a82f1d0d2f370c | https://github.com/hugapi/hug/blob/080901c81576657f82e2432fd4a82f1d0d2f370c/hug/api.py#L119-L121 | train | Returns the set input_format handler for the given content_type | 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... |
hugapi/hug | hug/api.py | HTTPInterfaceAPI.set_input_format | def set_input_format(self, content_type, handler):
"""Sets an input format handler for this Hug API, given the specified content_type"""
if getattr(self, '_input_format', None) is None:
self._input_format = {}
self._input_format[content_type] = handler | python | def set_input_format(self, content_type, handler):
"""Sets an input format handler for this Hug API, given the specified content_type"""
if getattr(self, '_input_format', None) is None:
self._input_format = {}
self._input_format[content_type] = handler | [
"def",
"set_input_format",
"(",
"self",
",",
"content_type",
",",
"handler",
")",
":",
"if",
"getattr",
"(",
"self",
",",
"'_input_format'",
",",
"None",
")",
"is",
"None",
":",
"self",
".",
"_input_format",
"=",
"{",
"}",
"self",
".",
"_input_format",
"... | Sets an input format handler for this Hug API, given the specified content_type | [
"Sets",
"an",
"input",
"format",
"handler",
"for",
"this",
"Hug",
"API",
"given",
"the",
"specified",
"content_type"
] | 080901c81576657f82e2432fd4a82f1d0d2f370c | https://github.com/hugapi/hug/blob/080901c81576657f82e2432fd4a82f1d0d2f370c/hug/api.py#L123-L127 | train | Sets an input format handler for this Hug API given the specified content_type | 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... |
hugapi/hug | hug/api.py | HTTPInterfaceAPI.add_middleware | def add_middleware(self, middleware):
"""Adds a middleware object used to process all incoming requests against the API"""
if self.middleware is None:
self._middleware = []
self.middleware.append(middleware) | python | def add_middleware(self, middleware):
"""Adds a middleware object used to process all incoming requests against the API"""
if self.middleware is None:
self._middleware = []
self.middleware.append(middleware) | [
"def",
"add_middleware",
"(",
"self",
",",
"middleware",
")",
":",
"if",
"self",
".",
"middleware",
"is",
"None",
":",
"self",
".",
"_middleware",
"=",
"[",
"]",
"self",
".",
"middleware",
".",
"append",
"(",
"middleware",
")"
] | Adds a middleware object used to process all incoming requests against the API | [
"Adds",
"a",
"middleware",
"object",
"used",
"to",
"process",
"all",
"incoming",
"requests",
"against",
"the",
"API"
] | 080901c81576657f82e2432fd4a82f1d0d2f370c | https://github.com/hugapi/hug/blob/080901c81576657f82e2432fd4a82f1d0d2f370c/hug/api.py#L133-L137 | train | Adds a middleware object used to process all incoming requests against 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... |
hugapi/hug | hug/api.py | HTTPInterfaceAPI.add_exception_handler | def add_exception_handler(self, exception_type, error_handler, versions=(None, )):
"""Adds a error handler to the hug api"""
versions = (versions, ) if not isinstance(versions, (tuple, list)) else versions
if not hasattr(self, '_exception_handlers'):
self._exception_handlers = {}
... | python | def add_exception_handler(self, exception_type, error_handler, versions=(None, )):
"""Adds a error handler to the hug api"""
versions = (versions, ) if not isinstance(versions, (tuple, list)) else versions
if not hasattr(self, '_exception_handlers'):
self._exception_handlers = {}
... | [
"def",
"add_exception_handler",
"(",
"self",
",",
"exception_type",
",",
"error_handler",
",",
"versions",
"=",
"(",
"None",
",",
")",
")",
":",
"versions",
"=",
"(",
"versions",
",",
")",
"if",
"not",
"isinstance",
"(",
"versions",
",",
"(",
"tuple",
",... | Adds a error handler to the hug api | [
"Adds",
"a",
"error",
"handler",
"to",
"the",
"hug",
"api"
] | 080901c81576657f82e2432fd4a82f1d0d2f370c | https://github.com/hugapi/hug/blob/080901c81576657f82e2432fd4a82f1d0d2f370c/hug/api.py#L150-L158 | train | Adds an exception handler to the hug 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... |
hugapi/hug | hug/api.py | HTTPInterfaceAPI.extend | def extend(self, http_api, route="", base_url="", **kwargs):
"""Adds handlers from a different Hug API to this one - to create a single API"""
self.versions.update(http_api.versions)
base_url = base_url or self.base_url
for router_base_url, routes in http_api.routes.items():
... | python | def extend(self, http_api, route="", base_url="", **kwargs):
"""Adds handlers from a different Hug API to this one - to create a single API"""
self.versions.update(http_api.versions)
base_url = base_url or self.base_url
for router_base_url, routes in http_api.routes.items():
... | [
"def",
"extend",
"(",
"self",
",",
"http_api",
",",
"route",
"=",
"\"\"",
",",
"base_url",
"=",
"\"\"",
",",
"*",
"*",
"kwargs",
")",
":",
"self",
".",
"versions",
".",
"update",
"(",
"http_api",
".",
"versions",
")",
"base_url",
"=",
"base_url",
"or... | Adds handlers from a different Hug API to this one - to create a single API | [
"Adds",
"handlers",
"from",
"a",
"different",
"Hug",
"API",
"to",
"this",
"one",
"-",
"to",
"create",
"a",
"single",
"API"
] | 080901c81576657f82e2432fd4a82f1d0d2f370c | https://github.com/hugapi/hug/blob/080901c81576657f82e2432fd4a82f1d0d2f370c/hug/api.py#L160-L193 | train | Extends this instance with the given http_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... |
hugapi/hug | hug/api.py | HTTPInterfaceAPI.set_not_found_handler | def set_not_found_handler(self, handler, version=None):
"""Sets the not_found handler for the specified version of the api"""
if not self.not_found_handlers:
self._not_found_handlers = {}
self.not_found_handlers[version] = handler | python | def set_not_found_handler(self, handler, version=None):
"""Sets the not_found handler for the specified version of the api"""
if not self.not_found_handlers:
self._not_found_handlers = {}
self.not_found_handlers[version] = handler | [
"def",
"set_not_found_handler",
"(",
"self",
",",
"handler",
",",
"version",
"=",
"None",
")",
":",
"if",
"not",
"self",
".",
"not_found_handlers",
":",
"self",
".",
"_not_found_handlers",
"=",
"{",
"}",
"self",
".",
"not_found_handlers",
"[",
"version",
"]"... | Sets the not_found handler for the specified version of the api | [
"Sets",
"the",
"not_found",
"handler",
"for",
"the",
"specified",
"version",
"of",
"the",
"api"
] | 080901c81576657f82e2432fd4a82f1d0d2f370c | https://github.com/hugapi/hug/blob/080901c81576657f82e2432fd4a82f1d0d2f370c/hug/api.py#L199-L204 | train | Sets the not_found handler for the specified version of 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... |
hugapi/hug | hug/api.py | HTTPInterfaceAPI.documentation | def documentation(self, base_url=None, api_version=None, prefix=""):
"""Generates and returns documentation for this API endpoint"""
documentation = OrderedDict()
base_url = self.base_url if base_url is None else base_url
overview = self.api.doc
if overview:
documenta... | python | def documentation(self, base_url=None, api_version=None, prefix=""):
"""Generates and returns documentation for this API endpoint"""
documentation = OrderedDict()
base_url = self.base_url if base_url is None else base_url
overview = self.api.doc
if overview:
documenta... | [
"def",
"documentation",
"(",
"self",
",",
"base_url",
"=",
"None",
",",
"api_version",
"=",
"None",
",",
"prefix",
"=",
"\"\"",
")",
":",
"documentation",
"=",
"OrderedDict",
"(",
")",
"base_url",
"=",
"self",
".",
"base_url",
"if",
"base_url",
"is",
"No... | Generates and returns documentation for this API endpoint | [
"Generates",
"and",
"returns",
"documentation",
"for",
"this",
"API",
"endpoint"
] | 080901c81576657f82e2432fd4a82f1d0d2f370c | https://github.com/hugapi/hug/blob/080901c81576657f82e2432fd4a82f1d0d2f370c/hug/api.py#L206-L247 | train | Generates and returns documentation for this 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... |
hugapi/hug | hug/api.py | HTTPInterfaceAPI.serve | def serve(self, host='', port=8000, no_documentation=False, display_intro=True):
"""Runs the basic hug development server against this API"""
if no_documentation:
api = self.server(None)
else:
api = self.server()
if display_intro:
print(INTRO)
... | python | def serve(self, host='', port=8000, no_documentation=False, display_intro=True):
"""Runs the basic hug development server against this API"""
if no_documentation:
api = self.server(None)
else:
api = self.server()
if display_intro:
print(INTRO)
... | [
"def",
"serve",
"(",
"self",
",",
"host",
"=",
"''",
",",
"port",
"=",
"8000",
",",
"no_documentation",
"=",
"False",
",",
"display_intro",
"=",
"True",
")",
":",
"if",
"no_documentation",
":",
"api",
"=",
"self",
".",
"server",
"(",
"None",
")",
"el... | Runs the basic hug development server against this API | [
"Runs",
"the",
"basic",
"hug",
"development",
"server",
"against",
"this",
"API"
] | 080901c81576657f82e2432fd4a82f1d0d2f370c | https://github.com/hugapi/hug/blob/080901c81576657f82e2432fd4a82f1d0d2f370c/hug/api.py#L249-L261 | train | Runs the basic hug development server against this 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... |
hugapi/hug | hug/api.py | HTTPInterfaceAPI.determine_version | def determine_version(self, request, api_version=None):
"""Determines the appropriate version given the set api_version, the request header, and URL query params"""
if api_version is False:
api_version = None
for version in self.versions:
if version and "v{0}".for... | python | def determine_version(self, request, api_version=None):
"""Determines the appropriate version given the set api_version, the request header, and URL query params"""
if api_version is False:
api_version = None
for version in self.versions:
if version and "v{0}".for... | [
"def",
"determine_version",
"(",
"self",
",",
"request",
",",
"api_version",
"=",
"None",
")",
":",
"if",
"api_version",
"is",
"False",
":",
"api_version",
"=",
"None",
"for",
"version",
"in",
"self",
".",
"versions",
":",
"if",
"version",
"and",
"\"v{0}\"... | Determines the appropriate version given the set api_version, the request header, and URL query params | [
"Determines",
"the",
"appropriate",
"version",
"given",
"the",
"set",
"api_version",
"the",
"request",
"header",
"and",
"URL",
"query",
"params"
] | 080901c81576657f82e2432fd4a82f1d0d2f370c | https://github.com/hugapi/hug/blob/080901c81576657f82e2432fd4a82f1d0d2f370c/hug/api.py#L268-L292 | train | Determines the appropriate version given the set api_version the request header and URL query 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... |
hugapi/hug | hug/api.py | HTTPInterfaceAPI.documentation_404 | def documentation_404(self, base_url=None):
"""Returns a smart 404 page that contains documentation for the written API"""
base_url = self.base_url if base_url is None else base_url
def handle_404(request, response, *args, **kwargs):
url_prefix = request.forwarded_uri[:-1]
... | python | def documentation_404(self, base_url=None):
"""Returns a smart 404 page that contains documentation for the written API"""
base_url = self.base_url if base_url is None else base_url
def handle_404(request, response, *args, **kwargs):
url_prefix = request.forwarded_uri[:-1]
... | [
"def",
"documentation_404",
"(",
"self",
",",
"base_url",
"=",
"None",
")",
":",
"base_url",
"=",
"self",
".",
"base_url",
"if",
"base_url",
"is",
"None",
"else",
"base_url",
"def",
"handle_404",
"(",
"request",
",",
"response",
",",
"*",
"args",
",",
"*... | Returns a smart 404 page that contains documentation for the written API | [
"Returns",
"a",
"smart",
"404",
"page",
"that",
"contains",
"documentation",
"for",
"the",
"written",
"API"
] | 080901c81576657f82e2432fd4a82f1d0d2f370c | https://github.com/hugapi/hug/blob/080901c81576657f82e2432fd4a82f1d0d2f370c/hug/api.py#L294-L319 | train | Returns a smart 404 page that contains documentation for the written 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... |
hugapi/hug | hug/api.py | HTTPInterfaceAPI.version_router | def version_router(self, request, response, api_version=None, versions={}, not_found=None, **kwargs):
"""Intelligently routes a request to the correct handler based on the version being requested"""
request_version = self.determine_version(request, api_version)
if request_version:
re... | python | def version_router(self, request, response, api_version=None, versions={}, not_found=None, **kwargs):
"""Intelligently routes a request to the correct handler based on the version being requested"""
request_version = self.determine_version(request, api_version)
if request_version:
re... | [
"def",
"version_router",
"(",
"self",
",",
"request",
",",
"response",
",",
"api_version",
"=",
"None",
",",
"versions",
"=",
"{",
"}",
",",
"not_found",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"request_version",
"=",
"self",
".",
"determine_vers... | Intelligently routes a request to the correct handler based on the version being requested | [
"Intelligently",
"routes",
"a",
"request",
"to",
"the",
"correct",
"handler",
"based",
"on",
"the",
"version",
"being",
"requested"
] | 080901c81576657f82e2432fd4a82f1d0d2f370c | https://github.com/hugapi/hug/blob/080901c81576657f82e2432fd4a82f1d0d2f370c/hug/api.py#L321-L328 | train | Intelligently routes a request to the correct handler based on the version being requested | 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... |
hugapi/hug | hug/api.py | HTTPInterfaceAPI.server | def server(self, default_not_found=True, base_url=None):
"""Returns a WSGI compatible API server for the given Hug API module"""
falcon_api = falcon.API(middleware=self.middleware)
default_not_found = self.documentation_404() if default_not_found is True else None
base_url = self.base_ur... | python | def server(self, default_not_found=True, base_url=None):
"""Returns a WSGI compatible API server for the given Hug API module"""
falcon_api = falcon.API(middleware=self.middleware)
default_not_found = self.documentation_404() if default_not_found is True else None
base_url = self.base_ur... | [
"def",
"server",
"(",
"self",
",",
"default_not_found",
"=",
"True",
",",
"base_url",
"=",
"None",
")",
":",
"falcon_api",
"=",
"falcon",
".",
"API",
"(",
"middleware",
"=",
"self",
".",
"middleware",
")",
"default_not_found",
"=",
"self",
".",
"documentat... | Returns a WSGI compatible API server for the given Hug API module | [
"Returns",
"a",
"WSGI",
"compatible",
"API",
"server",
"for",
"the",
"given",
"Hug",
"API",
"module"
] | 080901c81576657f82e2432fd4a82f1d0d2f370c | https://github.com/hugapi/hug/blob/080901c81576657f82e2432fd4a82f1d0d2f370c/hug/api.py#L330-L376 | train | Returns a WSGI compatible API server for the given Hug API module. | 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... |
hugapi/hug | hug/api.py | CLIInterfaceAPI.extend | def extend(self, cli_api, command_prefix="", sub_command="", **kwargs):
"""Extends this CLI api with the commands present in the provided cli_api object"""
if sub_command and command_prefix:
raise ValueError('It is not currently supported to provide both a command_prefix and sub_command')
... | python | def extend(self, cli_api, command_prefix="", sub_command="", **kwargs):
"""Extends this CLI api with the commands present in the provided cli_api object"""
if sub_command and command_prefix:
raise ValueError('It is not currently supported to provide both a command_prefix and sub_command')
... | [
"def",
"extend",
"(",
"self",
",",
"cli_api",
",",
"command_prefix",
"=",
"\"\"",
",",
"sub_command",
"=",
"\"\"",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"sub_command",
"and",
"command_prefix",
":",
"raise",
"ValueError",
"(",
"'It is not currently supported... | Extends this CLI api with the commands present in the provided cli_api object | [
"Extends",
"this",
"CLI",
"api",
"with",
"the",
"commands",
"present",
"in",
"the",
"provided",
"cli_api",
"object"
] | 080901c81576657f82e2432fd4a82f1d0d2f370c | https://github.com/hugapi/hug/blob/080901c81576657f82e2432fd4a82f1d0d2f370c/hug/api.py#L408-L417 | train | Extends this CLI api with the commands present in the provided CLI api 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... |
hugapi/hug | hug/api.py | API.directives | def directives(self):
"""Returns all directives applicable to this Hug API"""
directive_sources = chain(hug.defaults.directives.items(), getattr(self, '_directives', {}).items())
return {'hug_' + directive_name: directive for directive_name, directive in directive_sources} | python | def directives(self):
"""Returns all directives applicable to this Hug API"""
directive_sources = chain(hug.defaults.directives.items(), getattr(self, '_directives', {}).items())
return {'hug_' + directive_name: directive for directive_name, directive in directive_sources} | [
"def",
"directives",
"(",
"self",
")",
":",
"directive_sources",
"=",
"chain",
"(",
"hug",
".",
"defaults",
".",
"directives",
".",
"items",
"(",
")",
",",
"getattr",
"(",
"self",
",",
"'_directives'",
",",
"{",
"}",
")",
".",
"items",
"(",
")",
")",... | Returns all directives applicable to this Hug API | [
"Returns",
"all",
"directives",
"applicable",
"to",
"this",
"Hug",
"API"
] | 080901c81576657f82e2432fd4a82f1d0d2f370c | https://github.com/hugapi/hug/blob/080901c81576657f82e2432fd4a82f1d0d2f370c/hug/api.py#L474-L477 | train | Returns all directives applicable to this Hug 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... |
hugapi/hug | hug/api.py | API.directive | def directive(self, name, default=None):
"""Returns the loaded directive with the specified name, or default if passed name is not present"""
return getattr(self, '_directives', {}).get(name, hug.defaults.directives.get(name, default)) | python | def directive(self, name, default=None):
"""Returns the loaded directive with the specified name, or default if passed name is not present"""
return getattr(self, '_directives', {}).get(name, hug.defaults.directives.get(name, default)) | [
"def",
"directive",
"(",
"self",
",",
"name",
",",
"default",
"=",
"None",
")",
":",
"return",
"getattr",
"(",
"self",
",",
"'_directives'",
",",
"{",
"}",
")",
".",
"get",
"(",
"name",
",",
"hug",
".",
"defaults",
".",
"directives",
".",
"get",
"(... | Returns the loaded directive with the specified name, or default if passed name is not present | [
"Returns",
"the",
"loaded",
"directive",
"with",
"the",
"specified",
"name",
"or",
"default",
"if",
"passed",
"name",
"is",
"not",
"present"
] | 080901c81576657f82e2432fd4a82f1d0d2f370c | https://github.com/hugapi/hug/blob/080901c81576657f82e2432fd4a82f1d0d2f370c/hug/api.py#L479-L481 | train | Returns the loaded directive with the specified name or default if it is not present. | 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... |
hugapi/hug | hug/api.py | API.handlers | def handlers(self):
"""Returns all registered handlers attached to this API"""
if getattr(self, '_http'):
yield from self.http.handlers()
if getattr(self, '_cli'):
yield from self.cli.handlers() | python | def handlers(self):
"""Returns all registered handlers attached to this API"""
if getattr(self, '_http'):
yield from self.http.handlers()
if getattr(self, '_cli'):
yield from self.cli.handlers() | [
"def",
"handlers",
"(",
"self",
")",
":",
"if",
"getattr",
"(",
"self",
",",
"'_http'",
")",
":",
"yield",
"from",
"self",
".",
"http",
".",
"handlers",
"(",
")",
"if",
"getattr",
"(",
"self",
",",
"'_cli'",
")",
":",
"yield",
"from",
"self",
".",
... | Returns all registered handlers attached to this API | [
"Returns",
"all",
"registered",
"handlers",
"attached",
"to",
"this",
"API"
] | 080901c81576657f82e2432fd4a82f1d0d2f370c | https://github.com/hugapi/hug/blob/080901c81576657f82e2432fd4a82f1d0d2f370c/hug/api.py#L487-L492 | train | Returns all registered handlers attached to this 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... |
hugapi/hug | hug/api.py | API.extend | def extend(self, api, route="", base_url="", http=True, cli=True, **kwargs):
"""Adds handlers from a different Hug API to this one - to create a single API"""
api = API(api)
if http and hasattr(api, '_http'):
self.http.extend(api.http, route, base_url, **kwargs)
if cli and ... | python | def extend(self, api, route="", base_url="", http=True, cli=True, **kwargs):
"""Adds handlers from a different Hug API to this one - to create a single API"""
api = API(api)
if http and hasattr(api, '_http'):
self.http.extend(api.http, route, base_url, **kwargs)
if cli and ... | [
"def",
"extend",
"(",
"self",
",",
"api",
",",
"route",
"=",
"\"\"",
",",
"base_url",
"=",
"\"\"",
",",
"http",
"=",
"True",
",",
"cli",
"=",
"True",
",",
"*",
"*",
"kwargs",
")",
":",
"api",
"=",
"API",
"(",
"api",
")",
"if",
"http",
"and",
... | Adds handlers from a different Hug API to this one - to create a single API | [
"Adds",
"handlers",
"from",
"a",
"different",
"Hug",
"API",
"to",
"this",
"one",
"-",
"to",
"create",
"a",
"single",
"API"
] | 080901c81576657f82e2432fd4a82f1d0d2f370c | https://github.com/hugapi/hug/blob/080901c81576657f82e2432fd4a82f1d0d2f370c/hug/api.py#L528-L542 | train | Adds handlers from a different Hug API to this one - to create a single 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... |
hugapi/hug | hug/api.py | API.add_startup_handler | def add_startup_handler(self, handler):
"""Adds a startup handler to the hug api"""
if not self.startup_handlers:
self._startup_handlers = []
self.startup_handlers.append(handler) | python | def add_startup_handler(self, handler):
"""Adds a startup handler to the hug api"""
if not self.startup_handlers:
self._startup_handlers = []
self.startup_handlers.append(handler) | [
"def",
"add_startup_handler",
"(",
"self",
",",
"handler",
")",
":",
"if",
"not",
"self",
".",
"startup_handlers",
":",
"self",
".",
"_startup_handlers",
"=",
"[",
"]",
"self",
".",
"startup_handlers",
".",
"append",
"(",
"handler",
")"
] | Adds a startup handler to the hug api | [
"Adds",
"a",
"startup",
"handler",
"to",
"the",
"hug",
"api"
] | 080901c81576657f82e2432fd4a82f1d0d2f370c | https://github.com/hugapi/hug/blob/080901c81576657f82e2432fd4a82f1d0d2f370c/hug/api.py#L544-L549 | train | Adds a startup handler to the hug 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... |
hugapi/hug | hug/api.py | API._ensure_started | def _ensure_started(self):
"""Marks the API as started and runs all startup handlers"""
if not self.started:
async_handlers = [startup_handler for startup_handler in self.startup_handlers if
introspect.is_coroutine(startup_handler)]
if async_handlers... | python | def _ensure_started(self):
"""Marks the API as started and runs all startup handlers"""
if not self.started:
async_handlers = [startup_handler for startup_handler in self.startup_handlers if
introspect.is_coroutine(startup_handler)]
if async_handlers... | [
"def",
"_ensure_started",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"started",
":",
"async_handlers",
"=",
"[",
"startup_handler",
"for",
"startup_handler",
"in",
"self",
".",
"startup_handlers",
"if",
"introspect",
".",
"is_coroutine",
"(",
"startup_hand... | Marks the API as started and runs all startup handlers | [
"Marks",
"the",
"API",
"as",
"started",
"and",
"runs",
"all",
"startup",
"handlers"
] | 080901c81576657f82e2432fd4a82f1d0d2f370c | https://github.com/hugapi/hug/blob/080901c81576657f82e2432fd4a82f1d0d2f370c/hug/api.py#L551-L561 | train | Marks the API as started and runs all startup handlers | 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... |
PetrochukM/PyTorch-NLP | torchnlp/nn/weight_drop.py | _weight_drop | def _weight_drop(module, weights, dropout):
"""
Helper for `WeightDrop`.
"""
for name_w in weights:
w = getattr(module, name_w)
del module._parameters[name_w]
module.register_parameter(name_w + '_raw', Parameter(w))
original_module_forward = module.forward
def forward(... | python | def _weight_drop(module, weights, dropout):
"""
Helper for `WeightDrop`.
"""
for name_w in weights:
w = getattr(module, name_w)
del module._parameters[name_w]
module.register_parameter(name_w + '_raw', Parameter(w))
original_module_forward = module.forward
def forward(... | [
"def",
"_weight_drop",
"(",
"module",
",",
"weights",
",",
"dropout",
")",
":",
"for",
"name_w",
"in",
"weights",
":",
"w",
"=",
"getattr",
"(",
"module",
",",
"name_w",
")",
"del",
"module",
".",
"_parameters",
"[",
"name_w",
"]",
"module",
".",
"regi... | Helper for `WeightDrop`. | [
"Helper",
"for",
"WeightDrop",
"."
] | 5f7320da5c8d781df072fab3f7e421c6347e5bfa | https://github.com/PetrochukM/PyTorch-NLP/blob/5f7320da5c8d781df072fab3f7e421c6347e5bfa/torchnlp/nn/weight_drop.py#L6-L26 | train | Helper for WeightDrop. | 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... |
PetrochukM/PyTorch-NLP | torchnlp/datasets/imdb.py | imdb_dataset | def imdb_dataset(directory='data/',
train=False,
test=False,
train_directory='train',
test_directory='test',
extracted_name='aclImdb',
check_files=['aclImdb/README'],
url='http://ai.stanford.edu/~amaas... | python | def imdb_dataset(directory='data/',
train=False,
test=False,
train_directory='train',
test_directory='test',
extracted_name='aclImdb',
check_files=['aclImdb/README'],
url='http://ai.stanford.edu/~amaas... | [
"def",
"imdb_dataset",
"(",
"directory",
"=",
"'data/'",
",",
"train",
"=",
"False",
",",
"test",
"=",
"False",
",",
"train_directory",
"=",
"'train'",
",",
"test_directory",
"=",
"'test'",
",",
"extracted_name",
"=",
"'aclImdb'",
",",
"check_files",
"=",
"[... | Load the IMDB dataset (Large Movie Review Dataset v1.0).
This is a dataset for binary sentiment classification containing substantially more data than
previous benchmark datasets. Provided a set of 25,000 highly polar movie reviews for
training, and 25,000 for testing. There is additional unlabeled data fo... | [
"Load",
"the",
"IMDB",
"dataset",
"(",
"Large",
"Movie",
"Review",
"Dataset",
"v1",
".",
"0",
")",
"."
] | 5f7320da5c8d781df072fab3f7e421c6347e5bfa | https://github.com/PetrochukM/PyTorch-NLP/blob/5f7320da5c8d781df072fab3f7e421c6347e5bfa/torchnlp/datasets/imdb.py#L8-L81 | train | Loads the IMDB dataset for binary sentiment classification. | 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... |
PetrochukM/PyTorch-NLP | torchnlp/datasets/trec.py | trec_dataset | def trec_dataset(directory='data/trec/',
train=False,
test=False,
train_filename='train_5500.label',
test_filename='TREC_10.label',
check_files=['train_5500.label'],
urls=[
'http://cogcomp.org/Data... | python | def trec_dataset(directory='data/trec/',
train=False,
test=False,
train_filename='train_5500.label',
test_filename='TREC_10.label',
check_files=['train_5500.label'],
urls=[
'http://cogcomp.org/Data... | [
"def",
"trec_dataset",
"(",
"directory",
"=",
"'data/trec/'",
",",
"train",
"=",
"False",
",",
"test",
"=",
"False",
",",
"train_filename",
"=",
"'train_5500.label'",
",",
"test_filename",
"=",
"'TREC_10.label'",
",",
"check_files",
"=",
"[",
"'train_5500.label'",... | Load the Text REtrieval Conference (TREC) Question Classification dataset.
TREC dataset contains 5500 labeled questions in training set and another 500 for test set. The
dataset has 6 labels, 50 level-2 labels. Average length of each sentence is 10, vocabulary size
of 8700.
References:
* https... | [
"Load",
"the",
"Text",
"REtrieval",
"Conference",
"(",
"TREC",
")",
"Question",
"Classification",
"dataset",
"."
] | 5f7320da5c8d781df072fab3f7e421c6347e5bfa | https://github.com/PetrochukM/PyTorch-NLP/blob/5f7320da5c8d781df072fab3f7e421c6347e5bfa/torchnlp/datasets/trec.py#L7-L80 | train | Load the TREC dataset. | 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... |
PetrochukM/PyTorch-NLP | torchnlp/datasets/snli.py | snli_dataset | def snli_dataset(directory='data/',
train=False,
dev=False,
test=False,
train_filename='snli_1.0_train.jsonl',
dev_filename='snli_1.0_dev.jsonl',
test_filename='snli_1.0_test.jsonl',
extracted_name='sn... | python | def snli_dataset(directory='data/',
train=False,
dev=False,
test=False,
train_filename='snli_1.0_train.jsonl',
dev_filename='snli_1.0_dev.jsonl',
test_filename='snli_1.0_test.jsonl',
extracted_name='sn... | [
"def",
"snli_dataset",
"(",
"directory",
"=",
"'data/'",
",",
"train",
"=",
"False",
",",
"dev",
"=",
"False",
",",
"test",
"=",
"False",
",",
"train_filename",
"=",
"'snli_1.0_train.jsonl'",
",",
"dev_filename",
"=",
"'snli_1.0_dev.jsonl'",
",",
"test_filename"... | Load the Stanford Natural Language Inference (SNLI) dataset.
The SNLI corpus (version 1.0) is a collection of 570k human-written English sentence pairs
manually labeled for balanced classification with the labels entailment, contradiction, and
neutral, supporting the task of natural language inference (NLI... | [
"Load",
"the",
"Stanford",
"Natural",
"Language",
"Inference",
"(",
"SNLI",
")",
"dataset",
"."
] | 5f7320da5c8d781df072fab3f7e421c6347e5bfa | https://github.com/PetrochukM/PyTorch-NLP/blob/5f7320da5c8d781df072fab3f7e421c6347e5bfa/torchnlp/datasets/snli.py#L10-L91 | train | Loads the Stanford Natural Language Inference dataset. | 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... |
PetrochukM/PyTorch-NLP | torchnlp/nn/attention.py | Attention.forward | def forward(self, query, context):
"""
Args:
query (:class:`torch.FloatTensor` [batch size, output length, dimensions]): Sequence of
queries to query the context.
context (:class:`torch.FloatTensor` [batch size, query length, dimensions]): Data
ove... | python | def forward(self, query, context):
"""
Args:
query (:class:`torch.FloatTensor` [batch size, output length, dimensions]): Sequence of
queries to query the context.
context (:class:`torch.FloatTensor` [batch size, query length, dimensions]): Data
ove... | [
"def",
"forward",
"(",
"self",
",",
"query",
",",
"context",
")",
":",
"batch_size",
",",
"output_len",
",",
"dimensions",
"=",
"query",
".",
"size",
"(",
")",
"query_len",
"=",
"context",
".",
"size",
"(",
"1",
")",
"if",
"self",
".",
"attention_type"... | Args:
query (:class:`torch.FloatTensor` [batch size, output length, dimensions]): Sequence of
queries to query the context.
context (:class:`torch.FloatTensor` [batch size, query length, dimensions]): Data
overwhich to apply the attention mechanism.
Retur... | [
"Args",
":",
"query",
"(",
":",
"class",
":",
"torch",
".",
"FloatTensor",
"[",
"batch",
"size",
"output",
"length",
"dimensions",
"]",
")",
":",
"Sequence",
"of",
"queries",
"to",
"query",
"the",
"context",
".",
"context",
"(",
":",
"class",
":",
"tor... | 5f7320da5c8d781df072fab3f7e421c6347e5bfa | https://github.com/PetrochukM/PyTorch-NLP/blob/5f7320da5c8d781df072fab3f7e421c6347e5bfa/torchnlp/nn/attention.py#L45-L92 | train | Forward the attention mechanism to the next entry in the sequence of entries in the context. | 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... |
PetrochukM/PyTorch-NLP | torchnlp/datasets/iwslt.py | iwslt_dataset | def iwslt_dataset(
directory='data/iwslt/',
train=False,
dev=False,
test=False,
language_extensions=['en', 'de'],
train_filename='{source}-{target}/train.{source}-{target}.{lang}',
dev_filename='{source}-{target}/IWSLT16.TED.tst2013.{source}-{target}.{lang}',
... | python | def iwslt_dataset(
directory='data/iwslt/',
train=False,
dev=False,
test=False,
language_extensions=['en', 'de'],
train_filename='{source}-{target}/train.{source}-{target}.{lang}',
dev_filename='{source}-{target}/IWSLT16.TED.tst2013.{source}-{target}.{lang}',
... | [
"def",
"iwslt_dataset",
"(",
"directory",
"=",
"'data/iwslt/'",
",",
"train",
"=",
"False",
",",
"dev",
"=",
"False",
",",
"test",
"=",
"False",
",",
"language_extensions",
"=",
"[",
"'en'",
",",
"'de'",
"]",
",",
"train_filename",
"=",
"'{source}-{target}/t... | Load the International Workshop on Spoken Language Translation (IWSLT) 2017 translation dataset.
In-domain training, development and evaluation sets were supplied through the website of the
WIT3 project, while out-of-domain training data were linked in the workshop’s website. With
respect to edition 2016 o... | [
"Load",
"the",
"International",
"Workshop",
"on",
"Spoken",
"Language",
"Translation",
"(",
"IWSLT",
")",
"2017",
"translation",
"dataset",
"."
] | 5f7320da5c8d781df072fab3f7e421c6347e5bfa | https://github.com/PetrochukM/PyTorch-NLP/blob/5f7320da5c8d781df072fab3f7e421c6347e5bfa/torchnlp/datasets/iwslt.py#L10-L111 | train | Load the IWSLT 2017 translation dataset. | 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... |
PetrochukM/PyTorch-NLP | torchnlp/encoders/encoder.py | Encoder.encode | def encode(self, object_):
""" Encodes an object.
Args:
object_ (object): Object to encode.
Returns:
object: Encoding of the object.
"""
if self.enforce_reversible:
self.enforce_reversible = False
if self.decode(self.encode(object... | python | def encode(self, object_):
""" Encodes an object.
Args:
object_ (object): Object to encode.
Returns:
object: Encoding of the object.
"""
if self.enforce_reversible:
self.enforce_reversible = False
if self.decode(self.encode(object... | [
"def",
"encode",
"(",
"self",
",",
"object_",
")",
":",
"if",
"self",
".",
"enforce_reversible",
":",
"self",
".",
"enforce_reversible",
"=",
"False",
"if",
"self",
".",
"decode",
"(",
"self",
".",
"encode",
"(",
"object_",
")",
")",
"!=",
"object_",
"... | Encodes an object.
Args:
object_ (object): Object to encode.
Returns:
object: Encoding of the object. | [
"Encodes",
"an",
"object",
"."
] | 5f7320da5c8d781df072fab3f7e421c6347e5bfa | https://github.com/PetrochukM/PyTorch-NLP/blob/5f7320da5c8d781df072fab3f7e421c6347e5bfa/torchnlp/encoders/encoder.py#L14-L29 | train | Encodes an object into a base64 - 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... |
PetrochukM/PyTorch-NLP | torchnlp/encoders/encoder.py | Encoder.batch_encode | def batch_encode(self, iterator, *args, **kwargs):
"""
Args:
batch (list): Batch of objects to encode.
*args: Arguments passed to ``encode``.
**kwargs: Keyword arguments passed to ``encode``.
Returns:
list: Batch of encoded objects.
"""
... | python | def batch_encode(self, iterator, *args, **kwargs):
"""
Args:
batch (list): Batch of objects to encode.
*args: Arguments passed to ``encode``.
**kwargs: Keyword arguments passed to ``encode``.
Returns:
list: Batch of encoded objects.
"""
... | [
"def",
"batch_encode",
"(",
"self",
",",
"iterator",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"[",
"self",
".",
"encode",
"(",
"object_",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
"for",
"object_",
"in",
"iterator",
"]"
... | Args:
batch (list): Batch of objects to encode.
*args: Arguments passed to ``encode``.
**kwargs: Keyword arguments passed to ``encode``.
Returns:
list: Batch of encoded objects. | [
"Args",
":",
"batch",
"(",
"list",
")",
":",
"Batch",
"of",
"objects",
"to",
"encode",
".",
"*",
"args",
":",
"Arguments",
"passed",
"to",
"encode",
".",
"**",
"kwargs",
":",
"Keyword",
"arguments",
"passed",
"to",
"encode",
"."
] | 5f7320da5c8d781df072fab3f7e421c6347e5bfa | https://github.com/PetrochukM/PyTorch-NLP/blob/5f7320da5c8d781df072fab3f7e421c6347e5bfa/torchnlp/encoders/encoder.py#L31-L41 | train | Encodes a list of objects into a single list of bytes. | 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... |
PetrochukM/PyTorch-NLP | torchnlp/encoders/encoder.py | Encoder.decode | def decode(self, encoded):
""" Decodes an object.
Args:
object_ (object): Encoded object.
Returns:
object: Object decoded.
"""
if self.enforce_reversible:
self.enforce_reversible = False
if self.encode(self.decode(encoded)) != enc... | python | def decode(self, encoded):
""" Decodes an object.
Args:
object_ (object): Encoded object.
Returns:
object: Object decoded.
"""
if self.enforce_reversible:
self.enforce_reversible = False
if self.encode(self.decode(encoded)) != enc... | [
"def",
"decode",
"(",
"self",
",",
"encoded",
")",
":",
"if",
"self",
".",
"enforce_reversible",
":",
"self",
".",
"enforce_reversible",
"=",
"False",
"if",
"self",
".",
"encode",
"(",
"self",
".",
"decode",
"(",
"encoded",
")",
")",
"!=",
"encoded",
"... | Decodes an object.
Args:
object_ (object): Encoded object.
Returns:
object: Object decoded. | [
"Decodes",
"an",
"object",
"."
] | 5f7320da5c8d781df072fab3f7e421c6347e5bfa | https://github.com/PetrochukM/PyTorch-NLP/blob/5f7320da5c8d781df072fab3f7e421c6347e5bfa/torchnlp/encoders/encoder.py#L43-L58 | train | Decodes an 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... |
PetrochukM/PyTorch-NLP | torchnlp/encoders/encoder.py | Encoder.batch_decode | def batch_decode(self, iterator, *args, **kwargs):
"""
Args:
iterator (list): Batch of encoded objects.
*args: Arguments passed to ``decode``.
**kwargs: Keyword arguments passed to ``decode``.
Returns:
list: Batch of decoded objects.
"""
... | python | def batch_decode(self, iterator, *args, **kwargs):
"""
Args:
iterator (list): Batch of encoded objects.
*args: Arguments passed to ``decode``.
**kwargs: Keyword arguments passed to ``decode``.
Returns:
list: Batch of decoded objects.
"""
... | [
"def",
"batch_decode",
"(",
"self",
",",
"iterator",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"[",
"self",
".",
"decode",
"(",
"encoded",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
"for",
"encoded",
"in",
"iterator",
"]"
... | Args:
iterator (list): Batch of encoded objects.
*args: Arguments passed to ``decode``.
**kwargs: Keyword arguments passed to ``decode``.
Returns:
list: Batch of decoded objects. | [
"Args",
":",
"iterator",
"(",
"list",
")",
":",
"Batch",
"of",
"encoded",
"objects",
".",
"*",
"args",
":",
"Arguments",
"passed",
"to",
"decode",
".",
"**",
"kwargs",
":",
"Keyword",
"arguments",
"passed",
"to",
"decode",
"."
] | 5f7320da5c8d781df072fab3f7e421c6347e5bfa | https://github.com/PetrochukM/PyTorch-NLP/blob/5f7320da5c8d781df072fab3f7e421c6347e5bfa/torchnlp/encoders/encoder.py#L60-L70 | train | Decodes a list of encoded 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... |
PetrochukM/PyTorch-NLP | torchnlp/nn/cnn_encoder.py | CNNEncoder.forward | def forward(self, tokens, mask=None):
"""
Args:
tokens (:class:`torch.FloatTensor` [batch_size, num_tokens, input_dim]): Sequence
matrix to encode.
mask (:class:`torch.FloatTensor`): Broadcastable matrix to `tokens` used as a mask.
Returns:
(:c... | python | def forward(self, tokens, mask=None):
"""
Args:
tokens (:class:`torch.FloatTensor` [batch_size, num_tokens, input_dim]): Sequence
matrix to encode.
mask (:class:`torch.FloatTensor`): Broadcastable matrix to `tokens` used as a mask.
Returns:
(:c... | [
"def",
"forward",
"(",
"self",
",",
"tokens",
",",
"mask",
"=",
"None",
")",
":",
"if",
"mask",
"is",
"not",
"None",
":",
"tokens",
"=",
"tokens",
"*",
"mask",
".",
"unsqueeze",
"(",
"-",
"1",
")",
".",
"float",
"(",
")",
"# Our input is expected to ... | Args:
tokens (:class:`torch.FloatTensor` [batch_size, num_tokens, input_dim]): Sequence
matrix to encode.
mask (:class:`torch.FloatTensor`): Broadcastable matrix to `tokens` used as a mask.
Returns:
(:class:`torch.FloatTensor` [batch_size, output_dim]): Encodi... | [
"Args",
":",
"tokens",
"(",
":",
"class",
":",
"torch",
".",
"FloatTensor",
"[",
"batch_size",
"num_tokens",
"input_dim",
"]",
")",
":",
"Sequence",
"matrix",
"to",
"encode",
".",
"mask",
"(",
":",
"class",
":",
"torch",
".",
"FloatTensor",
")",
":",
"... | 5f7320da5c8d781df072fab3f7e421c6347e5bfa | https://github.com/PetrochukM/PyTorch-NLP/blob/5f7320da5c8d781df072fab3f7e421c6347e5bfa/torchnlp/nn/cnn_encoder.py#L82-L121 | train | Forward computation of the sequence. | 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... |
PetrochukM/PyTorch-NLP | torchnlp/encoders/text/subword_text_tokenizer.py | _unescape_token | def _unescape_token(escaped_token):
"""
Inverse of _escape_token().
Args:
escaped_token: a unicode string
Returns:
token: a unicode string
"""
def match(m):
if m.group(1) is None:
return u"_" if m.group(0) == u"\\u" else u"\\"
try:
return six... | python | def _unescape_token(escaped_token):
"""
Inverse of _escape_token().
Args:
escaped_token: a unicode string
Returns:
token: a unicode string
"""
def match(m):
if m.group(1) is None:
return u"_" if m.group(0) == u"\\u" else u"\\"
try:
return six... | [
"def",
"_unescape_token",
"(",
"escaped_token",
")",
":",
"def",
"match",
"(",
"m",
")",
":",
"if",
"m",
".",
"group",
"(",
"1",
")",
"is",
"None",
":",
"return",
"u\"_\"",
"if",
"m",
".",
"group",
"(",
"0",
")",
"==",
"u\"\\\\u\"",
"else",
"u\"\\\... | Inverse of _escape_token().
Args:
escaped_token: a unicode string
Returns:
token: a unicode string | [
"Inverse",
"of",
"_escape_token",
"()",
".",
"Args",
":",
"escaped_token",
":",
"a",
"unicode",
"string",
"Returns",
":",
"token",
":",
"a",
"unicode",
"string"
] | 5f7320da5c8d781df072fab3f7e421c6347e5bfa | https://github.com/PetrochukM/PyTorch-NLP/blob/5f7320da5c8d781df072fab3f7e421c6347e5bfa/torchnlp/encoders/text/subword_text_tokenizer.py#L123-L142 | train | Unescapes a unicode 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... |
PetrochukM/PyTorch-NLP | torchnlp/encoders/text/subword_text_tokenizer.py | SubwordTextTokenizer._tokens_to_subtoken | def _tokens_to_subtoken(self, tokens):
""" Converts a list of tokens to a list of subtoken.
Args:
tokens: a list of strings.
Returns:
a list of integers in the range [0, vocab_size)
"""
ret = []
for token in tokens:
ret.extend(
... | python | def _tokens_to_subtoken(self, tokens):
""" Converts a list of tokens to a list of subtoken.
Args:
tokens: a list of strings.
Returns:
a list of integers in the range [0, vocab_size)
"""
ret = []
for token in tokens:
ret.extend(
... | [
"def",
"_tokens_to_subtoken",
"(",
"self",
",",
"tokens",
")",
":",
"ret",
"=",
"[",
"]",
"for",
"token",
"in",
"tokens",
":",
"ret",
".",
"extend",
"(",
"self",
".",
"_escaped_token_to_subtoken_strings",
"(",
"_escape_token",
"(",
"token",
",",
"self",
".... | Converts a list of tokens to a list of subtoken.
Args:
tokens: a list of strings.
Returns:
a list of integers in the range [0, vocab_size) | [
"Converts",
"a",
"list",
"of",
"tokens",
"to",
"a",
"list",
"of",
"subtoken",
"."
] | 5f7320da5c8d781df072fab3f7e421c6347e5bfa | https://github.com/PetrochukM/PyTorch-NLP/blob/5f7320da5c8d781df072fab3f7e421c6347e5bfa/torchnlp/encoders/text/subword_text_tokenizer.py#L204-L216 | train | Converts a list of tokens to a list of subtoken strings. | 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... |
PetrochukM/PyTorch-NLP | torchnlp/encoders/text/subword_text_tokenizer.py | SubwordTextTokenizer._subtoken_to_tokens | def _subtoken_to_tokens(self, subtokens):
""" Converts a list of subtoken to a list of tokens.
Args:
subtokens: a list of integers in the range [0, vocab_size)
Returns:
a list of strings.
"""
concatenated = "".join(subtokens)
split = concatenated.spl... | python | def _subtoken_to_tokens(self, subtokens):
""" Converts a list of subtoken to a list of tokens.
Args:
subtokens: a list of integers in the range [0, vocab_size)
Returns:
a list of strings.
"""
concatenated = "".join(subtokens)
split = concatenated.spl... | [
"def",
"_subtoken_to_tokens",
"(",
"self",
",",
"subtokens",
")",
":",
"concatenated",
"=",
"\"\"",
".",
"join",
"(",
"subtokens",
")",
"split",
"=",
"concatenated",
".",
"split",
"(",
"\"_\"",
")",
"return",
"[",
"_unescape_token",
"(",
"t",
"+",
"\"_\"",... | Converts a list of subtoken to a list of tokens.
Args:
subtokens: a list of integers in the range [0, vocab_size)
Returns:
a list of strings. | [
"Converts",
"a",
"list",
"of",
"subtoken",
"to",
"a",
"list",
"of",
"tokens",
"."
] | 5f7320da5c8d781df072fab3f7e421c6347e5bfa | https://github.com/PetrochukM/PyTorch-NLP/blob/5f7320da5c8d781df072fab3f7e421c6347e5bfa/torchnlp/encoders/text/subword_text_tokenizer.py#L218-L229 | train | Converts a list of subtoken to a list of tokens. | 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... |
PetrochukM/PyTorch-NLP | torchnlp/encoders/text/subword_text_tokenizer.py | SubwordTextTokenizer._escaped_token_to_subtoken_strings | def _escaped_token_to_subtoken_strings(self, escaped_token):
""" Converts an escaped token string to a list of subtoken strings.
Args:
escaped_token: An escaped token as a unicode string.
Returns:
A list of subtokens as unicode strings.
"""
# NOTE: This algor... | python | def _escaped_token_to_subtoken_strings(self, escaped_token):
""" Converts an escaped token string to a list of subtoken strings.
Args:
escaped_token: An escaped token as a unicode string.
Returns:
A list of subtokens as unicode strings.
"""
# NOTE: This algor... | [
"def",
"_escaped_token_to_subtoken_strings",
"(",
"self",
",",
"escaped_token",
")",
":",
"# NOTE: This algorithm is greedy; it won't necessarily produce the \"best\"",
"# list of subtokens.",
"ret",
"=",
"[",
"]",
"start",
"=",
"0",
"token_len",
"=",
"len",
"(",
"escaped_t... | Converts an escaped token string to a list of subtoken strings.
Args:
escaped_token: An escaped token as a unicode string.
Returns:
A list of subtokens as unicode strings. | [
"Converts",
"an",
"escaped",
"token",
"string",
"to",
"a",
"list",
"of",
"subtoken",
"strings",
"."
] | 5f7320da5c8d781df072fab3f7e421c6347e5bfa | https://github.com/PetrochukM/PyTorch-NLP/blob/5f7320da5c8d781df072fab3f7e421c6347e5bfa/torchnlp/encoders/text/subword_text_tokenizer.py#L231-L258 | train | Converts an escaped token string to a list of subtoken strings. | 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... |
PetrochukM/PyTorch-NLP | torchnlp/encoders/text/subword_text_tokenizer.py | SubwordTextTokenizer.build_to_target_size_from_token_counts | def build_to_target_size_from_token_counts(cls,
target_size,
token_counts,
min_val,
max_val,
... | python | def build_to_target_size_from_token_counts(cls,
target_size,
token_counts,
min_val,
max_val,
... | [
"def",
"build_to_target_size_from_token_counts",
"(",
"cls",
",",
"target_size",
",",
"token_counts",
",",
"min_val",
",",
"max_val",
",",
"num_iterations",
"=",
"4",
")",
":",
"if",
"min_val",
">",
"max_val",
":",
"raise",
"ValueError",
"(",
"\"Lower bound for th... | Builds a SubwordTextTokenizer that has `vocab_size` near `target_size`.
Uses simple recursive binary search to find a minimum token count that most
closely matches the `target_size`.
Args:
target_size: Desired vocab_size to approximate.
token_counts: A dictionary of token c... | [
"Builds",
"a",
"SubwordTextTokenizer",
"that",
"has",
"vocab_size",
"near",
"target_size",
"."
] | 5f7320da5c8d781df072fab3f7e421c6347e5bfa | https://github.com/PetrochukM/PyTorch-NLP/blob/5f7320da5c8d781df072fab3f7e421c6347e5bfa/torchnlp/encoders/text/subword_text_tokenizer.py#L280-L334 | train | Builds a SubwordTextTokenizer instance that has vocab_size near target_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... |
PetrochukM/PyTorch-NLP | torchnlp/encoders/text/subword_text_tokenizer.py | SubwordTextTokenizer.build_from_token_counts | def build_from_token_counts(self, token_counts, min_count, num_iterations=4):
"""Train a SubwordTextTokenizer based on a dictionary of word counts.
Args:
token_counts: a dictionary of Unicode strings to int.
min_count: an integer - discard subtokens with lower counts.
num_... | python | def build_from_token_counts(self, token_counts, min_count, num_iterations=4):
"""Train a SubwordTextTokenizer based on a dictionary of word counts.
Args:
token_counts: a dictionary of Unicode strings to int.
min_count: an integer - discard subtokens with lower counts.
num_... | [
"def",
"build_from_token_counts",
"(",
"self",
",",
"token_counts",
",",
"min_count",
",",
"num_iterations",
"=",
"4",
")",
":",
"self",
".",
"_init_alphabet_from_tokens",
"(",
"six",
".",
"iterkeys",
"(",
"token_counts",
")",
")",
"# Bootstrap the initial list of s... | Train a SubwordTextTokenizer based on a dictionary of word counts.
Args:
token_counts: a dictionary of Unicode strings to int.
min_count: an integer - discard subtokens with lower counts.
num_iterations: an integer; how many iterations of refinement. | [
"Train",
"a",
"SubwordTextTokenizer",
"based",
"on",
"a",
"dictionary",
"of",
"word",
"counts",
"."
] | 5f7320da5c8d781df072fab3f7e421c6347e5bfa | https://github.com/PetrochukM/PyTorch-NLP/blob/5f7320da5c8d781df072fab3f7e421c6347e5bfa/torchnlp/encoders/text/subword_text_tokenizer.py#L340-L405 | train | Train a SubwordTextTokenizer based on a dictionary of word counts. | 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... |
PetrochukM/PyTorch-NLP | torchnlp/encoders/text/subword_text_tokenizer.py | SubwordTextTokenizer._init_subtokens_from_list | def _init_subtokens_from_list(self, subtoken_strings):
"""Initialize token information from a list of subtoken strings."""
# we remember the maximum length of any subtoken to avoid having to
# check arbitrarily long strings.
self._all_subtoken_strings = set([s for s in subtoken_strings i... | python | def _init_subtokens_from_list(self, subtoken_strings):
"""Initialize token information from a list of subtoken strings."""
# we remember the maximum length of any subtoken to avoid having to
# check arbitrarily long strings.
self._all_subtoken_strings = set([s for s in subtoken_strings i... | [
"def",
"_init_subtokens_from_list",
"(",
"self",
",",
"subtoken_strings",
")",
":",
"# we remember the maximum length of any subtoken to avoid having to",
"# check arbitrarily long strings.",
"self",
".",
"_all_subtoken_strings",
"=",
"set",
"(",
"[",
"s",
"for",
"s",
"in",
... | Initialize token information from a list of subtoken strings. | [
"Initialize",
"token",
"information",
"from",
"a",
"list",
"of",
"subtoken",
"strings",
"."
] | 5f7320da5c8d781df072fab3f7e421c6347e5bfa | https://github.com/PetrochukM/PyTorch-NLP/blob/5f7320da5c8d781df072fab3f7e421c6347e5bfa/torchnlp/encoders/text/subword_text_tokenizer.py#L407-L412 | train | Initialize token information from a list of subtoken strings. | 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... |
PetrochukM/PyTorch-NLP | torchnlp/encoders/text/subword_text_tokenizer.py | SubwordTextTokenizer._init_alphabet_from_tokens | def _init_alphabet_from_tokens(self, tokens):
"""Initialize alphabet from an iterable of token or subtoken strings."""
# Include all characters from all tokens in the alphabet to guarantee that
# any token can be encoded. Additionally, include all escaping
# characters.
self._alp... | python | def _init_alphabet_from_tokens(self, tokens):
"""Initialize alphabet from an iterable of token or subtoken strings."""
# Include all characters from all tokens in the alphabet to guarantee that
# any token can be encoded. Additionally, include all escaping
# characters.
self._alp... | [
"def",
"_init_alphabet_from_tokens",
"(",
"self",
",",
"tokens",
")",
":",
"# Include all characters from all tokens in the alphabet to guarantee that",
"# any token can be encoded. Additionally, include all escaping",
"# characters.",
"self",
".",
"_alphabet",
"=",
"{",
"c",
"for"... | Initialize alphabet from an iterable of token or subtoken strings. | [
"Initialize",
"alphabet",
"from",
"an",
"iterable",
"of",
"token",
"or",
"subtoken",
"strings",
"."
] | 5f7320da5c8d781df072fab3f7e421c6347e5bfa | https://github.com/PetrochukM/PyTorch-NLP/blob/5f7320da5c8d781df072fab3f7e421c6347e5bfa/torchnlp/encoders/text/subword_text_tokenizer.py#L414-L420 | train | Initialize the alphabet from an iterable of token or subtoken strings. | 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... |
PetrochukM/PyTorch-NLP | torchnlp/metrics/bleu.py | get_moses_multi_bleu | def get_moses_multi_bleu(hypotheses, references, lowercase=False):
"""Get the BLEU score using the moses `multi-bleu.perl` script.
**Script:**
https://raw.githubusercontent.com/moses-smt/mosesdecoder/master/scripts/generic/multi-bleu.perl
Args:
hypotheses (list of str): List of predicted values
... | python | def get_moses_multi_bleu(hypotheses, references, lowercase=False):
"""Get the BLEU score using the moses `multi-bleu.perl` script.
**Script:**
https://raw.githubusercontent.com/moses-smt/mosesdecoder/master/scripts/generic/multi-bleu.perl
Args:
hypotheses (list of str): List of predicted values
... | [
"def",
"get_moses_multi_bleu",
"(",
"hypotheses",
",",
"references",
",",
"lowercase",
"=",
"False",
")",
":",
"if",
"isinstance",
"(",
"hypotheses",
",",
"list",
")",
":",
"hypotheses",
"=",
"np",
".",
"array",
"(",
"hypotheses",
")",
"if",
"isinstance",
... | Get the BLEU score using the moses `multi-bleu.perl` script.
**Script:**
https://raw.githubusercontent.com/moses-smt/mosesdecoder/master/scripts/generic/multi-bleu.perl
Args:
hypotheses (list of str): List of predicted values
references (list of str): List of target values
lowercase (boo... | [
"Get",
"the",
"BLEU",
"score",
"using",
"the",
"moses",
"multi",
"-",
"bleu",
".",
"perl",
"script",
"."
] | 5f7320da5c8d781df072fab3f7e421c6347e5bfa | https://github.com/PetrochukM/PyTorch-NLP/blob/5f7320da5c8d781df072fab3f7e421c6347e5bfa/torchnlp/metrics/bleu.py#L30-L107 | train | Get the BLEU score using the MOSES multi - BLEU script. | 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... |
PetrochukM/PyTorch-NLP | torchnlp/datasets/ud_pos.py | ud_pos_dataset | def ud_pos_dataset(directory='data/',
train=False,
dev=False,
test=False,
train_filename='en-ud-tag.v2.train.txt',
dev_filename='en-ud-tag.v2.dev.txt',
test_filename='en-ud-tag.v2.test.txt',
... | python | def ud_pos_dataset(directory='data/',
train=False,
dev=False,
test=False,
train_filename='en-ud-tag.v2.train.txt',
dev_filename='en-ud-tag.v2.dev.txt',
test_filename='en-ud-tag.v2.test.txt',
... | [
"def",
"ud_pos_dataset",
"(",
"directory",
"=",
"'data/'",
",",
"train",
"=",
"False",
",",
"dev",
"=",
"False",
",",
"test",
"=",
"False",
",",
"train_filename",
"=",
"'en-ud-tag.v2.train.txt'",
",",
"dev_filename",
"=",
"'en-ud-tag.v2.dev.txt'",
",",
"test_fil... | Load the Universal Dependencies - English Dependency Treebank dataset.
Corpus of sentences annotated using Universal Dependencies annotation. The corpus comprises
254,830 words and 16,622 sentences, taken from various web media including weblogs, newsgroups,
emails, reviews, and Yahoo! answers.
Refere... | [
"Load",
"the",
"Universal",
"Dependencies",
"-",
"English",
"Dependency",
"Treebank",
"dataset",
"."
] | 5f7320da5c8d781df072fab3f7e421c6347e5bfa | https://github.com/PetrochukM/PyTorch-NLP/blob/5f7320da5c8d781df072fab3f7e421c6347e5bfa/torchnlp/datasets/ud_pos.py#L8-L88 | train | Load the Universal Dependencies Treebank dataset. | 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... |
PetrochukM/PyTorch-NLP | examples/snli/util.py | makedirs | def makedirs(name):
"""helper function for python 2 and 3 to call os.makedirs()
avoiding an error if the directory to be created already exists"""
import os, errno
try:
os.makedirs(name)
except OSError as ex:
if ex.errno == errno.EEXIST and os.path.isdir(name):
# ign... | python | def makedirs(name):
"""helper function for python 2 and 3 to call os.makedirs()
avoiding an error if the directory to be created already exists"""
import os, errno
try:
os.makedirs(name)
except OSError as ex:
if ex.errno == errno.EEXIST and os.path.isdir(name):
# ign... | [
"def",
"makedirs",
"(",
"name",
")",
":",
"import",
"os",
",",
"errno",
"try",
":",
"os",
".",
"makedirs",
"(",
"name",
")",
"except",
"OSError",
"as",
"ex",
":",
"if",
"ex",
".",
"errno",
"==",
"errno",
".",
"EEXIST",
"and",
"os",
".",
"path",
"... | helper function for python 2 and 3 to call os.makedirs()
avoiding an error if the directory to be created already exists | [
"helper",
"function",
"for",
"python",
"2",
"and",
"3",
"to",
"call",
"os",
".",
"makedirs",
"()",
"avoiding",
"an",
"error",
"if",
"the",
"directory",
"to",
"be",
"created",
"already",
"exists"
] | 5f7320da5c8d781df072fab3f7e421c6347e5bfa | https://github.com/PetrochukM/PyTorch-NLP/blob/5f7320da5c8d781df072fab3f7e421c6347e5bfa/examples/snli/util.py#L10-L24 | train | helper function for python 2 and 3 to call os. makedirs | 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... |
PetrochukM/PyTorch-NLP | examples/snli/util.py | collate_fn | def collate_fn(batch, train=True):
""" list of tensors to a batch tensors """
premise_batch, _ = pad_batch([row['premise'] for row in batch])
hypothesis_batch, _ = pad_batch([row['hypothesis'] for row in batch])
label_batch = torch.stack([row['label'] for row in batch])
# PyTorch RNN requires batch... | python | def collate_fn(batch, train=True):
""" list of tensors to a batch tensors """
premise_batch, _ = pad_batch([row['premise'] for row in batch])
hypothesis_batch, _ = pad_batch([row['hypothesis'] for row in batch])
label_batch = torch.stack([row['label'] for row in batch])
# PyTorch RNN requires batch... | [
"def",
"collate_fn",
"(",
"batch",
",",
"train",
"=",
"True",
")",
":",
"premise_batch",
",",
"_",
"=",
"pad_batch",
"(",
"[",
"row",
"[",
"'premise'",
"]",
"for",
"row",
"in",
"batch",
"]",
")",
"hypothesis_batch",
",",
"_",
"=",
"pad_batch",
"(",
"... | list of tensors to a batch tensors | [
"list",
"of",
"tensors",
"to",
"a",
"batch",
"tensors"
] | 5f7320da5c8d781df072fab3f7e421c6347e5bfa | https://github.com/PetrochukM/PyTorch-NLP/blob/5f7320da5c8d781df072fab3f7e421c6347e5bfa/examples/snli/util.py#L56-L65 | train | Returns a list of tensors to a batch tensors | 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... |
PetrochukM/PyTorch-NLP | torchnlp/datasets/smt.py | smt_dataset | def smt_dataset(directory='data/',
train=False,
dev=False,
test=False,
train_filename='train.txt',
dev_filename='dev.txt',
test_filename='test.txt',
extracted_name='trees',
check_files=['trees... | python | def smt_dataset(directory='data/',
train=False,
dev=False,
test=False,
train_filename='train.txt',
dev_filename='dev.txt',
test_filename='test.txt',
extracted_name='trees',
check_files=['trees... | [
"def",
"smt_dataset",
"(",
"directory",
"=",
"'data/'",
",",
"train",
"=",
"False",
",",
"dev",
"=",
"False",
",",
"test",
"=",
"False",
",",
"train_filename",
"=",
"'train.txt'",
",",
"dev_filename",
"=",
"'dev.txt'",
",",
"test_filename",
"=",
"'test.txt'"... | Load the Stanford Sentiment Treebank dataset.
Semantic word spaces have been very useful but cannot express the meaning of longer phrases in
a principled way. Further progress towards understanding compositionality in tasks such as
sentiment detection requires richer supervised training and evaluation reso... | [
"Load",
"the",
"Stanford",
"Sentiment",
"Treebank",
"dataset",
"."
] | 5f7320da5c8d781df072fab3f7e421c6347e5bfa | https://github.com/PetrochukM/PyTorch-NLP/blob/5f7320da5c8d781df072fab3f7e421c6347e5bfa/torchnlp/datasets/smt.py#L41-L119 | train | Loads the Sentiment Treebank dataset and returns a dict of Sentiment Treebank 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... |
PetrochukM/PyTorch-NLP | torchnlp/datasets/simple_qa.py | simple_qa_dataset | def simple_qa_dataset(
directory='data/',
train=False,
dev=False,
test=False,
extracted_name='SimpleQuestions_v2',
train_filename='annotated_fb_data_train.txt',
dev_filename='annotated_fb_data_valid.txt',
test_filename='annotated_fb_data_test.txt',
... | python | def simple_qa_dataset(
directory='data/',
train=False,
dev=False,
test=False,
extracted_name='SimpleQuestions_v2',
train_filename='annotated_fb_data_train.txt',
dev_filename='annotated_fb_data_valid.txt',
test_filename='annotated_fb_data_test.txt',
... | [
"def",
"simple_qa_dataset",
"(",
"directory",
"=",
"'data/'",
",",
"train",
"=",
"False",
",",
"dev",
"=",
"False",
",",
"test",
"=",
"False",
",",
"extracted_name",
"=",
"'SimpleQuestions_v2'",
",",
"train_filename",
"=",
"'annotated_fb_data_train.txt'",
",",
"... | Load the SimpleQuestions dataset.
Single-relation factoid questions (simple questions) are common in many settings
(e.g. Microsoft’s search query logs and WikiAnswers questions). The SimpleQuestions dataset is
one of the most commonly used benchmarks for studying single-relation factoid questions.
**R... | [
"Load",
"the",
"SimpleQuestions",
"dataset",
"."
] | 5f7320da5c8d781df072fab3f7e421c6347e5bfa | https://github.com/PetrochukM/PyTorch-NLP/blob/5f7320da5c8d781df072fab3f7e421c6347e5bfa/torchnlp/datasets/simple_qa.py#L9-L85 | train | Load the SimpleQuestions dataset. | 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... |
PetrochukM/PyTorch-NLP | torchnlp/nn/lock_dropout.py | LockedDropout.forward | def forward(self, x):
"""
Args:
x (:class:`torch.FloatTensor` [batch size, sequence length, rnn hidden size]): Input to
apply dropout too.
"""
if not self.training or not self.p:
return x
x = x.clone()
mask = x.new_empty(1, x.size(1... | python | def forward(self, x):
"""
Args:
x (:class:`torch.FloatTensor` [batch size, sequence length, rnn hidden size]): Input to
apply dropout too.
"""
if not self.training or not self.p:
return x
x = x.clone()
mask = x.new_empty(1, x.size(1... | [
"def",
"forward",
"(",
"self",
",",
"x",
")",
":",
"if",
"not",
"self",
".",
"training",
"or",
"not",
"self",
".",
"p",
":",
"return",
"x",
"x",
"=",
"x",
".",
"clone",
"(",
")",
"mask",
"=",
"x",
".",
"new_empty",
"(",
"1",
",",
"x",
".",
... | Args:
x (:class:`torch.FloatTensor` [batch size, sequence length, rnn hidden size]): Input to
apply dropout too. | [
"Args",
":",
"x",
"(",
":",
"class",
":",
"torch",
".",
"FloatTensor",
"[",
"batch",
"size",
"sequence",
"length",
"rnn",
"hidden",
"size",
"]",
")",
":",
"Input",
"to",
"apply",
"dropout",
"too",
"."
] | 5f7320da5c8d781df072fab3f7e421c6347e5bfa | https://github.com/PetrochukM/PyTorch-NLP/blob/5f7320da5c8d781df072fab3f7e421c6347e5bfa/torchnlp/nn/lock_dropout.py#L52-L64 | train | Forward computation of the n - grams. | 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... |
PetrochukM/PyTorch-NLP | torchnlp/encoders/text/text_encoder.py | pad_tensor | def pad_tensor(tensor, length, padding_index=DEFAULT_PADDING_INDEX):
""" Pad a ``tensor`` to ``length`` with ``padding_index``.
Args:
tensor (torch.Tensor [n, ...]): Tensor to pad.
length (int): Pad the ``tensor`` up to ``length``.
padding_index (int, optional): Index to pad tensor with... | python | def pad_tensor(tensor, length, padding_index=DEFAULT_PADDING_INDEX):
""" Pad a ``tensor`` to ``length`` with ``padding_index``.
Args:
tensor (torch.Tensor [n, ...]): Tensor to pad.
length (int): Pad the ``tensor`` up to ``length``.
padding_index (int, optional): Index to pad tensor with... | [
"def",
"pad_tensor",
"(",
"tensor",
",",
"length",
",",
"padding_index",
"=",
"DEFAULT_PADDING_INDEX",
")",
":",
"n_padding",
"=",
"length",
"-",
"tensor",
".",
"shape",
"[",
"0",
"]",
"assert",
"n_padding",
">=",
"0",
"if",
"n_padding",
"==",
"0",
":",
... | Pad a ``tensor`` to ``length`` with ``padding_index``.
Args:
tensor (torch.Tensor [n, ...]): Tensor to pad.
length (int): Pad the ``tensor`` up to ``length``.
padding_index (int, optional): Index to pad tensor with.
Returns
(torch.Tensor [length, ...]) Padded Tensor. | [
"Pad",
"a",
"tensor",
"to",
"length",
"with",
"padding_index",
"."
] | 5f7320da5c8d781df072fab3f7e421c6347e5bfa | https://github.com/PetrochukM/PyTorch-NLP/blob/5f7320da5c8d781df072fab3f7e421c6347e5bfa/torchnlp/encoders/text/text_encoder.py#L7-L23 | train | Pad a tensor up to length with padding_index. | 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... |
PetrochukM/PyTorch-NLP | torchnlp/encoders/text/text_encoder.py | stack_and_pad_tensors | def stack_and_pad_tensors(batch, padding_index=DEFAULT_PADDING_INDEX, dim=0):
""" Pad a :class:`list` of ``tensors`` (``batch``) with ``padding_index``.
Args:
batch (:class:`list` of :class:`torch.Tensor`): Batch of tensors to pad.
padding_index (int, optional): Index to pad tensors with.
... | python | def stack_and_pad_tensors(batch, padding_index=DEFAULT_PADDING_INDEX, dim=0):
""" Pad a :class:`list` of ``tensors`` (``batch``) with ``padding_index``.
Args:
batch (:class:`list` of :class:`torch.Tensor`): Batch of tensors to pad.
padding_index (int, optional): Index to pad tensors with.
... | [
"def",
"stack_and_pad_tensors",
"(",
"batch",
",",
"padding_index",
"=",
"DEFAULT_PADDING_INDEX",
",",
"dim",
"=",
"0",
")",
":",
"lengths",
"=",
"[",
"tensor",
".",
"shape",
"[",
"0",
"]",
"for",
"tensor",
"in",
"batch",
"]",
"max_len",
"=",
"max",
"(",... | Pad a :class:`list` of ``tensors`` (``batch``) with ``padding_index``.
Args:
batch (:class:`list` of :class:`torch.Tensor`): Batch of tensors to pad.
padding_index (int, optional): Index to pad tensors with.
dim (int, optional): Dimension on to which to concatenate the batch of tensors.
... | [
"Pad",
"a",
":",
"class",
":",
"list",
"of",
"tensors",
"(",
"batch",
")",
"with",
"padding_index",
"."
] | 5f7320da5c8d781df072fab3f7e421c6347e5bfa | https://github.com/PetrochukM/PyTorch-NLP/blob/5f7320da5c8d781df072fab3f7e421c6347e5bfa/torchnlp/encoders/text/text_encoder.py#L26-L44 | train | Pad a list of tensors with padding_index. | 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... |
PetrochukM/PyTorch-NLP | torchnlp/encoders/text/text_encoder.py | TextEncoder.batch_encode | def batch_encode(self, iterator, *args, dim=0, **kwargs):
"""
Args:
iterator (iterator): Batch of text to encode.
*args: Arguments passed onto ``Encoder.__init__``.
dim (int, optional): Dimension along which to concatenate tensors.
**kwargs: Keyword argume... | python | def batch_encode(self, iterator, *args, dim=0, **kwargs):
"""
Args:
iterator (iterator): Batch of text to encode.
*args: Arguments passed onto ``Encoder.__init__``.
dim (int, optional): Dimension along which to concatenate tensors.
**kwargs: Keyword argume... | [
"def",
"batch_encode",
"(",
"self",
",",
"iterator",
",",
"*",
"args",
",",
"dim",
"=",
"0",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"stack_and_pad_tensors",
"(",
"super",
"(",
")",
".",
"batch_encode",
"(",
"iterator",
")",
",",
"padding_index",
... | Args:
iterator (iterator): Batch of text to encode.
*args: Arguments passed onto ``Encoder.__init__``.
dim (int, optional): Dimension along which to concatenate tensors.
**kwargs: Keyword arguments passed onto ``Encoder.__init__``.
Returns
torch.Tenso... | [
"Args",
":",
"iterator",
"(",
"iterator",
")",
":",
"Batch",
"of",
"text",
"to",
"encode",
".",
"*",
"args",
":",
"Arguments",
"passed",
"onto",
"Encoder",
".",
"__init__",
".",
"dim",
"(",
"int",
"optional",
")",
":",
"Dimension",
"along",
"which",
"t... | 5f7320da5c8d781df072fab3f7e421c6347e5bfa | https://github.com/PetrochukM/PyTorch-NLP/blob/5f7320da5c8d781df072fab3f7e421c6347e5bfa/torchnlp/encoders/text/text_encoder.py#L49-L62 | train | Returns a batch of text encoded into a single tensor. | 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... |
PetrochukM/PyTorch-NLP | torchnlp/encoders/text/text_encoder.py | TextEncoder.batch_decode | def batch_decode(self, tensor, lengths, dim=0, *args, **kwargs):
"""
Args:
batch (list of :class:`torch.Tensor`): Batch of encoded sequences.
lengths (list of int): Original lengths of sequences.
dim (int, optional): Dimension along which to split tensors.
... | python | def batch_decode(self, tensor, lengths, dim=0, *args, **kwargs):
"""
Args:
batch (list of :class:`torch.Tensor`): Batch of encoded sequences.
lengths (list of int): Original lengths of sequences.
dim (int, optional): Dimension along which to split tensors.
... | [
"def",
"batch_decode",
"(",
"self",
",",
"tensor",
",",
"lengths",
",",
"dim",
"=",
"0",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"super",
"(",
")",
".",
"batch_decode",
"(",
"[",
"t",
".",
"squeeze",
"(",
"0",
")",
"[",
"... | Args:
batch (list of :class:`torch.Tensor`): Batch of encoded sequences.
lengths (list of int): Original lengths of sequences.
dim (int, optional): Dimension along which to split tensors.
*args: Arguments passed to ``decode``.
**kwargs: Key word arguments pass... | [
"Args",
":",
"batch",
"(",
"list",
"of",
":",
"class",
":",
"torch",
".",
"Tensor",
")",
":",
"Batch",
"of",
"encoded",
"sequences",
".",
"lengths",
"(",
"list",
"of",
"int",
")",
":",
"Original",
"lengths",
"of",
"sequences",
".",
"dim",
"(",
"int",... | 5f7320da5c8d781df072fab3f7e421c6347e5bfa | https://github.com/PetrochukM/PyTorch-NLP/blob/5f7320da5c8d781df072fab3f7e421c6347e5bfa/torchnlp/encoders/text/text_encoder.py#L64-L77 | train | Decode a batch of encoded sequences. | 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... |
PetrochukM/PyTorch-NLP | torchnlp/encoders/text/static_tokenizer_encoder.py | StaticTokenizerEncoder.encode | def encode(self, sequence):
""" Encodes a ``sequence``.
Args:
sequence (str): String ``sequence`` to encode.
Returns:
torch.Tensor: Encoding of the ``sequence``.
"""
sequence = super().encode(sequence)
sequence = self.tokenize(sequence)
v... | python | def encode(self, sequence):
""" Encodes a ``sequence``.
Args:
sequence (str): String ``sequence`` to encode.
Returns:
torch.Tensor: Encoding of the ``sequence``.
"""
sequence = super().encode(sequence)
sequence = self.tokenize(sequence)
v... | [
"def",
"encode",
"(",
"self",
",",
"sequence",
")",
":",
"sequence",
"=",
"super",
"(",
")",
".",
"encode",
"(",
"sequence",
")",
"sequence",
"=",
"self",
".",
"tokenize",
"(",
"sequence",
")",
"vector",
"=",
"[",
"self",
".",
"stoi",
".",
"get",
"... | Encodes a ``sequence``.
Args:
sequence (str): String ``sequence`` to encode.
Returns:
torch.Tensor: Encoding of the ``sequence``. | [
"Encodes",
"a",
"sequence",
"."
] | 5f7320da5c8d781df072fab3f7e421c6347e5bfa | https://github.com/PetrochukM/PyTorch-NLP/blob/5f7320da5c8d781df072fab3f7e421c6347e5bfa/torchnlp/encoders/text/static_tokenizer_encoder.py#L105-L119 | train | Encodes a sequence into a new version of the sequence. | 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... |
PetrochukM/PyTorch-NLP | torchnlp/encoders/text/static_tokenizer_encoder.py | StaticTokenizerEncoder.decode | def decode(self, encoded):
""" Decodes a tensor into a sequence.
Args:
encoded (torch.Tensor): Encoded sequence.
Returns:
str: Sequence decoded from ``encoded``.
"""
encoded = super().decode(encoded)
tokens = [self.itos[index] for index in encode... | python | def decode(self, encoded):
""" Decodes a tensor into a sequence.
Args:
encoded (torch.Tensor): Encoded sequence.
Returns:
str: Sequence decoded from ``encoded``.
"""
encoded = super().decode(encoded)
tokens = [self.itos[index] for index in encode... | [
"def",
"decode",
"(",
"self",
",",
"encoded",
")",
":",
"encoded",
"=",
"super",
"(",
")",
".",
"decode",
"(",
"encoded",
")",
"tokens",
"=",
"[",
"self",
".",
"itos",
"[",
"index",
"]",
"for",
"index",
"in",
"encoded",
"]",
"return",
"self",
".",
... | Decodes a tensor into a sequence.
Args:
encoded (torch.Tensor): Encoded sequence.
Returns:
str: Sequence decoded from ``encoded``. | [
"Decodes",
"a",
"tensor",
"into",
"a",
"sequence",
"."
] | 5f7320da5c8d781df072fab3f7e421c6347e5bfa | https://github.com/PetrochukM/PyTorch-NLP/blob/5f7320da5c8d781df072fab3f7e421c6347e5bfa/torchnlp/encoders/text/static_tokenizer_encoder.py#L121-L132 | train | Decodes a tensor into a sequence. | 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... |
PetrochukM/PyTorch-NLP | torchnlp/download.py | _reporthook | def _reporthook(t):
""" ``reporthook`` to use with ``urllib.request`` that prints the process of the download.
Uses ``tqdm`` for progress bar.
**Reference:**
https://github.com/tqdm/tqdm
Args:
t (tqdm.tqdm) Progress bar.
Example:
>>> with tqdm(unit='B', unit_scale=True, minit... | python | def _reporthook(t):
""" ``reporthook`` to use with ``urllib.request`` that prints the process of the download.
Uses ``tqdm`` for progress bar.
**Reference:**
https://github.com/tqdm/tqdm
Args:
t (tqdm.tqdm) Progress bar.
Example:
>>> with tqdm(unit='B', unit_scale=True, minit... | [
"def",
"_reporthook",
"(",
"t",
")",
":",
"last_b",
"=",
"[",
"0",
"]",
"def",
"inner",
"(",
"b",
"=",
"1",
",",
"bsize",
"=",
"1",
",",
"tsize",
"=",
"None",
")",
":",
"\"\"\"\n Args:\n b (int, optional): Number of blocks just transferred [def... | ``reporthook`` to use with ``urllib.request`` that prints the process of the download.
Uses ``tqdm`` for progress bar.
**Reference:**
https://github.com/tqdm/tqdm
Args:
t (tqdm.tqdm) Progress bar.
Example:
>>> with tqdm(unit='B', unit_scale=True, miniters=1, desc=filename) as t: ... | [
"reporthook",
"to",
"use",
"with",
"urllib",
".",
"request",
"that",
"prints",
"the",
"process",
"of",
"the",
"download",
"."
] | 5f7320da5c8d781df072fab3f7e421c6347e5bfa | https://github.com/PetrochukM/PyTorch-NLP/blob/5f7320da5c8d781df072fab3f7e421c6347e5bfa/torchnlp/download.py#L15-L44 | train | A function that returns a function that returns a tuple of tuples with the first element of the tuple as first argument and the second element as second argument. | 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... |
PetrochukM/PyTorch-NLP | torchnlp/download.py | _download_file_from_drive | def _download_file_from_drive(filename, url): # pragma: no cover
""" Download filename from google drive unless it's already in directory.
Args:
filename (str): Name of the file to download to (do nothing if it already exists).
url (str): URL to download from.
"""
confirm_token = None
... | python | def _download_file_from_drive(filename, url): # pragma: no cover
""" Download filename from google drive unless it's already in directory.
Args:
filename (str): Name of the file to download to (do nothing if it already exists).
url (str): URL to download from.
"""
confirm_token = None
... | [
"def",
"_download_file_from_drive",
"(",
"filename",
",",
"url",
")",
":",
"# pragma: no cover",
"confirm_token",
"=",
"None",
"# Since the file is big, drive will scan it for virus and take it to a",
"# warning page. We find the confirm token on this page and append it to the",
"# URL t... | Download filename from google drive unless it's already in directory.
Args:
filename (str): Name of the file to download to (do nothing if it already exists).
url (str): URL to download from. | [
"Download",
"filename",
"from",
"google",
"drive",
"unless",
"it",
"s",
"already",
"in",
"directory",
"."
] | 5f7320da5c8d781df072fab3f7e421c6347e5bfa | https://github.com/PetrochukM/PyTorch-NLP/blob/5f7320da5c8d781df072fab3f7e421c6347e5bfa/torchnlp/download.py#L47-L81 | train | Download a file from Google drive. | 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... |
PetrochukM/PyTorch-NLP | torchnlp/download.py | _maybe_extract | def _maybe_extract(compressed_filename, directory, extension=None):
""" Extract a compressed file to ``directory``.
Args:
compressed_filename (str): Compressed file.
directory (str): Extract to directory.
extension (str, optional): Extension of the file; Otherwise, attempts to extract e... | python | def _maybe_extract(compressed_filename, directory, extension=None):
""" Extract a compressed file to ``directory``.
Args:
compressed_filename (str): Compressed file.
directory (str): Extract to directory.
extension (str, optional): Extension of the file; Otherwise, attempts to extract e... | [
"def",
"_maybe_extract",
"(",
"compressed_filename",
",",
"directory",
",",
"extension",
"=",
"None",
")",
":",
"logger",
".",
"info",
"(",
"'Extracting {}'",
".",
"format",
"(",
"compressed_filename",
")",
")",
"if",
"extension",
"is",
"None",
":",
"basename"... | Extract a compressed file to ``directory``.
Args:
compressed_filename (str): Compressed file.
directory (str): Extract to directory.
extension (str, optional): Extension of the file; Otherwise, attempts to extract extension
from the filename. | [
"Extract",
"a",
"compressed",
"file",
"to",
"directory",
"."
] | 5f7320da5c8d781df072fab3f7e421c6347e5bfa | https://github.com/PetrochukM/PyTorch-NLP/blob/5f7320da5c8d781df072fab3f7e421c6347e5bfa/torchnlp/download.py#L84-L106 | train | Extract a compressed file to a directory. | 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... |
PetrochukM/PyTorch-NLP | torchnlp/download.py | _get_filename_from_url | def _get_filename_from_url(url):
""" Return a filename from a URL
Args:
url (str): URL to extract filename from
Returns:
(str): Filename in URL
"""
parse = urlparse(url)
return os.path.basename(parse.path) | python | def _get_filename_from_url(url):
""" Return a filename from a URL
Args:
url (str): URL to extract filename from
Returns:
(str): Filename in URL
"""
parse = urlparse(url)
return os.path.basename(parse.path) | [
"def",
"_get_filename_from_url",
"(",
"url",
")",
":",
"parse",
"=",
"urlparse",
"(",
"url",
")",
"return",
"os",
".",
"path",
".",
"basename",
"(",
"parse",
".",
"path",
")"
] | Return a filename from a URL
Args:
url (str): URL to extract filename from
Returns:
(str): Filename in URL | [
"Return",
"a",
"filename",
"from",
"a",
"URL"
] | 5f7320da5c8d781df072fab3f7e421c6347e5bfa | https://github.com/PetrochukM/PyTorch-NLP/blob/5f7320da5c8d781df072fab3f7e421c6347e5bfa/torchnlp/download.py#L109-L119 | train | Return a filename from a 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... |
PetrochukM/PyTorch-NLP | torchnlp/download.py | download_file_maybe_extract | def download_file_maybe_extract(url, directory, filename=None, extension=None, check_files=[]):
""" Download the file at ``url`` to ``directory``. Extract to ``directory`` if tar or zip.
Args:
url (str): Url of file.
directory (str): Directory to download to.
filename (str, optional): N... | python | def download_file_maybe_extract(url, directory, filename=None, extension=None, check_files=[]):
""" Download the file at ``url`` to ``directory``. Extract to ``directory`` if tar or zip.
Args:
url (str): Url of file.
directory (str): Directory to download to.
filename (str, optional): N... | [
"def",
"download_file_maybe_extract",
"(",
"url",
",",
"directory",
",",
"filename",
"=",
"None",
",",
"extension",
"=",
"None",
",",
"check_files",
"=",
"[",
"]",
")",
":",
"if",
"filename",
"is",
"None",
":",
"filename",
"=",
"_get_filename_from_url",
"(",... | Download the file at ``url`` to ``directory``. Extract to ``directory`` if tar or zip.
Args:
url (str): Url of file.
directory (str): Directory to download to.
filename (str, optional): Name of the file to download; Otherwise, a filename is extracted
from the url.
extens... | [
"Download",
"the",
"file",
"at",
"url",
"to",
"directory",
".",
"Extract",
"to",
"directory",
"if",
"tar",
"or",
"zip",
"."
] | 5f7320da5c8d781df072fab3f7e421c6347e5bfa | https://github.com/PetrochukM/PyTorch-NLP/blob/5f7320da5c8d781df072fab3f7e421c6347e5bfa/torchnlp/download.py#L122-L167 | train | Download the file at url to directory if tar or zip. | 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... |
PetrochukM/PyTorch-NLP | torchnlp/download.py | download_files_maybe_extract | def download_files_maybe_extract(urls, directory, check_files=[]):
""" Download the files at ``urls`` to ``directory``. Extract to ``directory`` if tar or zip.
Args:
urls (str): Url of files.
directory (str): Directory to download to.
check_files (list of str): Check if these files exis... | python | def download_files_maybe_extract(urls, directory, check_files=[]):
""" Download the files at ``urls`` to ``directory``. Extract to ``directory`` if tar or zip.
Args:
urls (str): Url of files.
directory (str): Directory to download to.
check_files (list of str): Check if these files exis... | [
"def",
"download_files_maybe_extract",
"(",
"urls",
",",
"directory",
",",
"check_files",
"=",
"[",
"]",
")",
":",
"check_files",
"=",
"[",
"os",
".",
"path",
".",
"join",
"(",
"directory",
",",
"f",
")",
"for",
"f",
"in",
"check_files",
"]",
"if",
"_c... | Download the files at ``urls`` to ``directory``. Extract to ``directory`` if tar or zip.
Args:
urls (str): Url of files.
directory (str): Directory to download to.
check_files (list of str): Check if these files exist, ensuring the download succeeded.
If these files exist before... | [
"Download",
"the",
"files",
"at",
"urls",
"to",
"directory",
".",
"Extract",
"to",
"directory",
"if",
"tar",
"or",
"zip",
"."
] | 5f7320da5c8d781df072fab3f7e421c6347e5bfa | https://github.com/PetrochukM/PyTorch-NLP/blob/5f7320da5c8d781df072fab3f7e421c6347e5bfa/torchnlp/download.py#L182-L202 | train | Download the files at urls to directory if tar or zip. | 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... |
PetrochukM/PyTorch-NLP | torchnlp/metrics/accuracy.py | get_accuracy | def get_accuracy(targets, outputs, k=1, ignore_index=None):
""" Get the accuracy top-k accuracy between two tensors.
Args:
targets (1 - 2D :class:`torch.Tensor`): Target or true vector against which to measure
saccuracy
outputs (1 - 3D :class:`torch.Tensor`): Prediction or output vector
... | python | def get_accuracy(targets, outputs, k=1, ignore_index=None):
""" Get the accuracy top-k accuracy between two tensors.
Args:
targets (1 - 2D :class:`torch.Tensor`): Target or true vector against which to measure
saccuracy
outputs (1 - 3D :class:`torch.Tensor`): Prediction or output vector
... | [
"def",
"get_accuracy",
"(",
"targets",
",",
"outputs",
",",
"k",
"=",
"1",
",",
"ignore_index",
"=",
"None",
")",
":",
"n_correct",
"=",
"0.0",
"for",
"target",
",",
"output",
"in",
"zip",
"(",
"targets",
",",
"outputs",
")",
":",
"if",
"not",
"torch... | Get the accuracy top-k accuracy between two tensors.
Args:
targets (1 - 2D :class:`torch.Tensor`): Target or true vector against which to measure
saccuracy
outputs (1 - 3D :class:`torch.Tensor`): Prediction or output vector
ignore_index (int, optional): Specifies a target index that is ... | [
"Get",
"the",
"accuracy",
"top",
"-",
"k",
"accuracy",
"between",
"two",
"tensors",
"."
] | 5f7320da5c8d781df072fab3f7e421c6347e5bfa | https://github.com/PetrochukM/PyTorch-NLP/blob/5f7320da5c8d781df072fab3f7e421c6347e5bfa/torchnlp/metrics/accuracy.py#L8-L50 | train | Get the accuracy between two tensors. | 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... |
PetrochukM/PyTorch-NLP | torchnlp/metrics/accuracy.py | get_token_accuracy | def get_token_accuracy(targets, outputs, ignore_index=None):
""" Get the accuracy token accuracy between two tensors.
Args:
targets (1 - 2D :class:`torch.Tensor`): Target or true vector against which to measure
saccuracy
outputs (1 - 3D :class:`torch.Tensor`): Prediction or output vector
... | python | def get_token_accuracy(targets, outputs, ignore_index=None):
""" Get the accuracy token accuracy between two tensors.
Args:
targets (1 - 2D :class:`torch.Tensor`): Target or true vector against which to measure
saccuracy
outputs (1 - 3D :class:`torch.Tensor`): Prediction or output vector
... | [
"def",
"get_token_accuracy",
"(",
"targets",
",",
"outputs",
",",
"ignore_index",
"=",
"None",
")",
":",
"n_correct",
"=",
"0.0",
"n_total",
"=",
"0.0",
"for",
"target",
",",
"output",
"in",
"zip",
"(",
"targets",
",",
"outputs",
")",
":",
"if",
"not",
... | Get the accuracy token accuracy between two tensors.
Args:
targets (1 - 2D :class:`torch.Tensor`): Target or true vector against which to measure
saccuracy
outputs (1 - 3D :class:`torch.Tensor`): Prediction or output vector
ignore_index (int, optional): Specifies a target index that is ... | [
"Get",
"the",
"accuracy",
"token",
"accuracy",
"between",
"two",
"tensors",
"."
] | 5f7320da5c8d781df072fab3f7e421c6347e5bfa | https://github.com/PetrochukM/PyTorch-NLP/blob/5f7320da5c8d781df072fab3f7e421c6347e5bfa/torchnlp/metrics/accuracy.py#L53-L102 | train | Get the accuracy token accuracy between two tensors. | 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... |
PetrochukM/PyTorch-NLP | torchnlp/utils.py | get_tensors | def get_tensors(object_):
""" Get all tensors associated with ``object_``
Args:
object_ (any): Any object to look for tensors.
Returns:
(list of torch.tensor): List of tensors that are associated with ``object_``.
"""
if torch.is_tensor(object_):
return [object_]
elif i... | python | def get_tensors(object_):
""" Get all tensors associated with ``object_``
Args:
object_ (any): Any object to look for tensors.
Returns:
(list of torch.tensor): List of tensors that are associated with ``object_``.
"""
if torch.is_tensor(object_):
return [object_]
elif i... | [
"def",
"get_tensors",
"(",
"object_",
")",
":",
"if",
"torch",
".",
"is_tensor",
"(",
"object_",
")",
":",
"return",
"[",
"object_",
"]",
"elif",
"isinstance",
"(",
"object_",
",",
"(",
"str",
",",
"float",
",",
"int",
")",
")",
":",
"return",
"[",
... | Get all tensors associated with ``object_``
Args:
object_ (any): Any object to look for tensors.
Returns:
(list of torch.tensor): List of tensors that are associated with ``object_``. | [
"Get",
"all",
"tensors",
"associated",
"with",
"object_"
] | 5f7320da5c8d781df072fab3f7e421c6347e5bfa | https://github.com/PetrochukM/PyTorch-NLP/blob/5f7320da5c8d781df072fab3f7e421c6347e5bfa/torchnlp/utils.py#L11-L40 | train | Returns a list of tensors that are associated with 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... |
PetrochukM/PyTorch-NLP | torchnlp/utils.py | sampler_to_iterator | def sampler_to_iterator(dataset, sampler):
""" Given a batch sampler or sampler returns examples instead of indices
Args:
dataset (torch.utils.data.Dataset): Dataset to sample from.
sampler (torch.utils.data.sampler.Sampler): Sampler over the dataset.
Returns:
generator over datase... | python | def sampler_to_iterator(dataset, sampler):
""" Given a batch sampler or sampler returns examples instead of indices
Args:
dataset (torch.utils.data.Dataset): Dataset to sample from.
sampler (torch.utils.data.sampler.Sampler): Sampler over the dataset.
Returns:
generator over datase... | [
"def",
"sampler_to_iterator",
"(",
"dataset",
",",
"sampler",
")",
":",
"for",
"sample",
"in",
"sampler",
":",
"if",
"isinstance",
"(",
"sample",
",",
"(",
"list",
",",
"tuple",
")",
")",
":",
"# yield a batch",
"yield",
"[",
"dataset",
"[",
"i",
"]",
... | Given a batch sampler or sampler returns examples instead of indices
Args:
dataset (torch.utils.data.Dataset): Dataset to sample from.
sampler (torch.utils.data.sampler.Sampler): Sampler over the dataset.
Returns:
generator over dataset examples | [
"Given",
"a",
"batch",
"sampler",
"or",
"sampler",
"returns",
"examples",
"instead",
"of",
"indices"
] | 5f7320da5c8d781df072fab3f7e421c6347e5bfa | https://github.com/PetrochukM/PyTorch-NLP/blob/5f7320da5c8d781df072fab3f7e421c6347e5bfa/torchnlp/utils.py#L43-L59 | train | Given a batch sampler or sampler returns examples instead of indices
AttributeNames | 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... |
PetrochukM/PyTorch-NLP | torchnlp/utils.py | resplit_datasets | def resplit_datasets(dataset, other_dataset, random_seed=None, split=None):
"""Deterministic shuffle and split algorithm.
Given the same two datasets and the same ``random_seed``, the split happens the same exact way
every call.
Args:
dataset (lib.datasets.Dataset): First dataset.
othe... | python | def resplit_datasets(dataset, other_dataset, random_seed=None, split=None):
"""Deterministic shuffle and split algorithm.
Given the same two datasets and the same ``random_seed``, the split happens the same exact way
every call.
Args:
dataset (lib.datasets.Dataset): First dataset.
othe... | [
"def",
"resplit_datasets",
"(",
"dataset",
",",
"other_dataset",
",",
"random_seed",
"=",
"None",
",",
"split",
"=",
"None",
")",
":",
"# Prevent circular dependency",
"from",
"torchnlp",
".",
"datasets",
"import",
"Dataset",
"concat",
"=",
"dataset",
".",
"rows... | Deterministic shuffle and split algorithm.
Given the same two datasets and the same ``random_seed``, the split happens the same exact way
every call.
Args:
dataset (lib.datasets.Dataset): First dataset.
other_dataset (lib.datasets.Dataset): Another dataset.
random_seed (int, option... | [
"Deterministic",
"shuffle",
"and",
"split",
"algorithm",
"."
] | 5f7320da5c8d781df072fab3f7e421c6347e5bfa | https://github.com/PetrochukM/PyTorch-NLP/blob/5f7320da5c8d781df072fab3f7e421c6347e5bfa/torchnlp/utils.py#L105-L130 | train | Deterministic shuffle and split algorithm. | 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... |
PetrochukM/PyTorch-NLP | torchnlp/utils.py | torch_equals_ignore_index | def torch_equals_ignore_index(tensor, tensor_other, ignore_index=None):
"""
Compute ``torch.equal`` with the optional mask parameter.
Args:
ignore_index (int, optional): Specifies a ``tensor`` index that is ignored.
Returns:
(bool) Returns ``True`` if target and prediction are equal.
... | python | def torch_equals_ignore_index(tensor, tensor_other, ignore_index=None):
"""
Compute ``torch.equal`` with the optional mask parameter.
Args:
ignore_index (int, optional): Specifies a ``tensor`` index that is ignored.
Returns:
(bool) Returns ``True`` if target and prediction are equal.
... | [
"def",
"torch_equals_ignore_index",
"(",
"tensor",
",",
"tensor_other",
",",
"ignore_index",
"=",
"None",
")",
":",
"if",
"ignore_index",
"is",
"not",
"None",
":",
"assert",
"tensor",
".",
"size",
"(",
")",
"==",
"tensor_other",
".",
"size",
"(",
")",
"mas... | Compute ``torch.equal`` with the optional mask parameter.
Args:
ignore_index (int, optional): Specifies a ``tensor`` index that is ignored.
Returns:
(bool) Returns ``True`` if target and prediction are equal. | [
"Compute",
"torch",
".",
"equal",
"with",
"the",
"optional",
"mask",
"parameter",
"."
] | 5f7320da5c8d781df072fab3f7e421c6347e5bfa | https://github.com/PetrochukM/PyTorch-NLP/blob/5f7320da5c8d781df072fab3f7e421c6347e5bfa/torchnlp/utils.py#L133-L149 | train | Compute torch. equal with the optional mask parameter. | 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... |
PetrochukM/PyTorch-NLP | torchnlp/utils.py | lengths_to_mask | def lengths_to_mask(*lengths, **kwargs):
""" Given a list of lengths, create a batch mask.
Example:
>>> lengths_to_mask([1, 2, 3])
tensor([[1, 0, 0],
[1, 1, 0],
[1, 1, 1]], dtype=torch.uint8)
>>> lengths_to_mask([1, 2, 2], [1, 2, 2])
tensor([[[1, ... | python | def lengths_to_mask(*lengths, **kwargs):
""" Given a list of lengths, create a batch mask.
Example:
>>> lengths_to_mask([1, 2, 3])
tensor([[1, 0, 0],
[1, 1, 0],
[1, 1, 1]], dtype=torch.uint8)
>>> lengths_to_mask([1, 2, 2], [1, 2, 2])
tensor([[[1, ... | [
"def",
"lengths_to_mask",
"(",
"*",
"lengths",
",",
"*",
"*",
"kwargs",
")",
":",
"# Squeeze to deal with random additional dimensions",
"lengths",
"=",
"[",
"l",
".",
"squeeze",
"(",
")",
".",
"tolist",
"(",
")",
"if",
"torch",
".",
"is_tensor",
"(",
"l",
... | Given a list of lengths, create a batch mask.
Example:
>>> lengths_to_mask([1, 2, 3])
tensor([[1, 0, 0],
[1, 1, 0],
[1, 1, 1]], dtype=torch.uint8)
>>> lengths_to_mask([1, 2, 2], [1, 2, 2])
tensor([[[1, 0],
[0, 0]],
<BLANKLINE>... | [
"Given",
"a",
"list",
"of",
"lengths",
"create",
"a",
"batch",
"mask",
"."
] | 5f7320da5c8d781df072fab3f7e421c6347e5bfa | https://github.com/PetrochukM/PyTorch-NLP/blob/5f7320da5c8d781df072fab3f7e421c6347e5bfa/torchnlp/utils.py#L156-L193 | train | Given a list of lengths create a batch mask. | 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... |
PetrochukM/PyTorch-NLP | torchnlp/utils.py | collate_tensors | def collate_tensors(batch, stack_tensors=torch.stack):
""" Collate a list of type ``k`` (dict, namedtuple, list, etc.) with tensors.
Inspired by:
https://github.com/pytorch/pytorch/blob/master/torch/utils/data/_utils/collate.py#L31
Args:
batch (list of k): List of rows of type ``k``.
s... | python | def collate_tensors(batch, stack_tensors=torch.stack):
""" Collate a list of type ``k`` (dict, namedtuple, list, etc.) with tensors.
Inspired by:
https://github.com/pytorch/pytorch/blob/master/torch/utils/data/_utils/collate.py#L31
Args:
batch (list of k): List of rows of type ``k``.
s... | [
"def",
"collate_tensors",
"(",
"batch",
",",
"stack_tensors",
"=",
"torch",
".",
"stack",
")",
":",
"if",
"all",
"(",
"[",
"torch",
".",
"is_tensor",
"(",
"b",
")",
"for",
"b",
"in",
"batch",
"]",
")",
":",
"return",
"stack_tensors",
"(",
"batch",
")... | Collate a list of type ``k`` (dict, namedtuple, list, etc.) with tensors.
Inspired by:
https://github.com/pytorch/pytorch/blob/master/torch/utils/data/_utils/collate.py#L31
Args:
batch (list of k): List of rows of type ``k``.
stack_tensors (callable): Function to stack tensors into a batch... | [
"Collate",
"a",
"list",
"of",
"type",
"k",
"(",
"dict",
"namedtuple",
"list",
"etc",
".",
")",
"with",
"tensors",
"."
] | 5f7320da5c8d781df072fab3f7e421c6347e5bfa | https://github.com/PetrochukM/PyTorch-NLP/blob/5f7320da5c8d781df072fab3f7e421c6347e5bfa/torchnlp/utils.py#L196-L238 | train | Collate a list of types k with tensors. | 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... |
PetrochukM/PyTorch-NLP | torchnlp/utils.py | tensors_to | def tensors_to(tensors, *args, **kwargs):
""" Apply ``torch.Tensor.to`` to tensors in a generic data structure.
Inspired by:
https://github.com/pytorch/pytorch/blob/master/torch/utils/data/_utils/collate.py#L31
Args:
tensors (tensor, dict, list, namedtuple or tuple): Data structure with tensor... | python | def tensors_to(tensors, *args, **kwargs):
""" Apply ``torch.Tensor.to`` to tensors in a generic data structure.
Inspired by:
https://github.com/pytorch/pytorch/blob/master/torch/utils/data/_utils/collate.py#L31
Args:
tensors (tensor, dict, list, namedtuple or tuple): Data structure with tensor... | [
"def",
"tensors_to",
"(",
"tensors",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"torch",
".",
"is_tensor",
"(",
"tensors",
")",
":",
"return",
"tensors",
".",
"to",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
"elif",
"isinstance... | Apply ``torch.Tensor.to`` to tensors in a generic data structure.
Inspired by:
https://github.com/pytorch/pytorch/blob/master/torch/utils/data/_utils/collate.py#L31
Args:
tensors (tensor, dict, list, namedtuple or tuple): Data structure with tensor values to
move.
*args: Argume... | [
"Apply",
"torch",
".",
"Tensor",
".",
"to",
"to",
"tensors",
"in",
"a",
"generic",
"data",
"structure",
"."
] | 5f7320da5c8d781df072fab3f7e421c6347e5bfa | https://github.com/PetrochukM/PyTorch-NLP/blob/5f7320da5c8d781df072fab3f7e421c6347e5bfa/torchnlp/utils.py#L241-L281 | train | Applies torch. Tensor. to a list of tensors and returns a new list of tuples. | 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.