partition stringclasses 3
values | func_name stringlengths 1 134 | docstring stringlengths 1 46.9k | path stringlengths 4 223 | original_string stringlengths 75 104k | code stringlengths 75 104k | docstring_tokens listlengths 1 1.97k | repo stringlengths 7 55 | language stringclasses 1
value | url stringlengths 87 315 | code_tokens listlengths 19 28.4k | sha stringlengths 40 40 |
|---|---|---|---|---|---|---|---|---|---|---|---|
train | json_success_response | Formats the response of a successful token request as JSON.
Also adds default headers and status code. | oauth2/grant.py | def json_success_response(data, response):
"""
Formats the response of a successful token request as JSON.
Also adds default headers and status code.
"""
response.body = json.dumps(data)
response.status_code = 200
response.add_header("Content-Type", "application/json")
response.add_hea... | def json_success_response(data, response):
"""
Formats the response of a successful token request as JSON.
Also adds default headers and status code.
"""
response.body = json.dumps(data)
response.status_code = 200
response.add_header("Content-Type", "application/json")
response.add_hea... | [
"Formats",
"the",
"response",
"of",
"a",
"successful",
"token",
"request",
"as",
"JSON",
"."
] | wndhydrnt/python-oauth2 | python | https://github.com/wndhydrnt/python-oauth2/blob/abe3bf5f27bda2ff737cab387b040e2e6e85c2e2/oauth2/grant.py#L69-L80 | [
"def",
"json_success_response",
"(",
"data",
",",
"response",
")",
":",
"response",
".",
"body",
"=",
"json",
".",
"dumps",
"(",
"data",
")",
"response",
".",
"status_code",
"=",
"200",
"response",
".",
"add_header",
"(",
"\"Content-Type\"",
",",
"\"applicat... | abe3bf5f27bda2ff737cab387b040e2e6e85c2e2 |
train | Scope.compare | Compares the scopes read from request with previously issued scopes.
:param previous_scopes: A list of scopes.
:return: ``True`` | oauth2/grant.py | def compare(self, previous_scopes):
"""
Compares the scopes read from request with previously issued scopes.
:param previous_scopes: A list of scopes.
:return: ``True``
"""
for scope in self.scopes:
if scope not in previous_scopes:
raise OAuth... | def compare(self, previous_scopes):
"""
Compares the scopes read from request with previously issued scopes.
:param previous_scopes: A list of scopes.
:return: ``True``
"""
for scope in self.scopes:
if scope not in previous_scopes:
raise OAuth... | [
"Compares",
"the",
"scopes",
"read",
"from",
"request",
"with",
"previously",
"issued",
"scopes",
"."
] | wndhydrnt/python-oauth2 | python | https://github.com/wndhydrnt/python-oauth2/blob/abe3bf5f27bda2ff737cab387b040e2e6e85c2e2/oauth2/grant.py#L113-L126 | [
"def",
"compare",
"(",
"self",
",",
"previous_scopes",
")",
":",
"for",
"scope",
"in",
"self",
".",
"scopes",
":",
"if",
"scope",
"not",
"in",
"previous_scopes",
":",
"raise",
"OAuthInvalidError",
"(",
"error",
"=",
"\"invalid_scope\"",
",",
"explanation",
"... | abe3bf5f27bda2ff737cab387b040e2e6e85c2e2 |
train | Scope.parse | Parses scope value in given request.
Expects the value of the "scope" parameter in request to be a string
where each requested scope is separated by a white space::
# One scope requested
"profile_read"
# Multiple scopes
"profile_read profile_write"
... | oauth2/grant.py | def parse(self, request, source):
"""
Parses scope value in given request.
Expects the value of the "scope" parameter in request to be a string
where each requested scope is separated by a white space::
# One scope requested
"profile_read"
# Multipl... | def parse(self, request, source):
"""
Parses scope value in given request.
Expects the value of the "scope" parameter in request to be a string
where each requested scope is separated by a white space::
# One scope requested
"profile_read"
# Multipl... | [
"Parses",
"scope",
"value",
"in",
"given",
"request",
"."
] | wndhydrnt/python-oauth2 | python | https://github.com/wndhydrnt/python-oauth2/blob/abe3bf5f27bda2ff737cab387b040e2e6e85c2e2/oauth2/grant.py#L128-L173 | [
"def",
"parse",
"(",
"self",
",",
"request",
",",
"source",
")",
":",
"if",
"source",
"==",
"\"body\"",
":",
"req_scope",
"=",
"request",
".",
"post_param",
"(",
"\"scope\"",
")",
"elif",
"source",
"==",
"\"query\"",
":",
"req_scope",
"=",
"request",
"."... | abe3bf5f27bda2ff737cab387b040e2e6e85c2e2 |
train | AuthRequestMixin.read_validate_params | Reads and validates data in an incoming request as required by
the Authorization Request of the Authorization Code Grant and the
Implicit Grant. | oauth2/grant.py | def read_validate_params(self, request):
"""
Reads and validates data in an incoming request as required by
the Authorization Request of the Authorization Code Grant and the
Implicit Grant.
"""
self.client = self.client_authenticator.by_identifier(request)
respon... | def read_validate_params(self, request):
"""
Reads and validates data in an incoming request as required by
the Authorization Request of the Authorization Code Grant and the
Implicit Grant.
"""
self.client = self.client_authenticator.by_identifier(request)
respon... | [
"Reads",
"and",
"validates",
"data",
"in",
"an",
"incoming",
"request",
"as",
"required",
"by",
"the",
"Authorization",
"Request",
"of",
"the",
"Authorization",
"Code",
"Grant",
"and",
"the",
"Implicit",
"Grant",
"."
] | wndhydrnt/python-oauth2 | python | https://github.com/wndhydrnt/python-oauth2/blob/abe3bf5f27bda2ff737cab387b040e2e6e85c2e2/oauth2/grant.py#L262-L279 | [
"def",
"read_validate_params",
"(",
"self",
",",
"request",
")",
":",
"self",
".",
"client",
"=",
"self",
".",
"client_authenticator",
".",
"by_identifier",
"(",
"request",
")",
"response_type",
"=",
"request",
".",
"get_param",
"(",
"\"response_type\"",
")",
... | abe3bf5f27bda2ff737cab387b040e2e6e85c2e2 |
train | AuthorizeMixin.authorize | Controls all steps to authorize a request by a user.
:param request: The incoming :class:`oauth2.web.Request`
:param response: The :class:`oauth2.web.Response` that will be
returned eventually
:param environ: The environment variables of this request
:param scop... | oauth2/grant.py | def authorize(self, request, response, environ, scopes):
"""
Controls all steps to authorize a request by a user.
:param request: The incoming :class:`oauth2.web.Request`
:param response: The :class:`oauth2.web.Response` that will be
returned eventually
... | def authorize(self, request, response, environ, scopes):
"""
Controls all steps to authorize a request by a user.
:param request: The incoming :class:`oauth2.web.Request`
:param response: The :class:`oauth2.web.Response` that will be
returned eventually
... | [
"Controls",
"all",
"steps",
"to",
"authorize",
"a",
"request",
"by",
"a",
"user",
"."
] | wndhydrnt/python-oauth2 | python | https://github.com/wndhydrnt/python-oauth2/blob/abe3bf5f27bda2ff737cab387b040e2e6e85c2e2/oauth2/grant.py#L292-L316 | [
"def",
"authorize",
"(",
"self",
",",
"request",
",",
"response",
",",
"environ",
",",
"scopes",
")",
":",
"if",
"self",
".",
"site_adapter",
".",
"user_has_denied_access",
"(",
"request",
")",
"is",
"True",
":",
"raise",
"OAuthInvalidError",
"(",
"error",
... | abe3bf5f27bda2ff737cab387b040e2e6e85c2e2 |
train | AuthorizationCodeAuthHandler.process | Generates a new authorization token.
A form to authorize the access of the application can be displayed with
the help of `oauth2.web.SiteAdapter`. | oauth2/grant.py | def process(self, request, response, environ):
"""
Generates a new authorization token.
A form to authorize the access of the application can be displayed with
the help of `oauth2.web.SiteAdapter`.
"""
data = self.authorize(request, response, environ,
... | def process(self, request, response, environ):
"""
Generates a new authorization token.
A form to authorize the access of the application can be displayed with
the help of `oauth2.web.SiteAdapter`.
"""
data = self.authorize(request, response, environ,
... | [
"Generates",
"a",
"new",
"authorization",
"token",
"."
] | wndhydrnt/python-oauth2 | python | https://github.com/wndhydrnt/python-oauth2/blob/abe3bf5f27bda2ff737cab387b040e2e6e85c2e2/oauth2/grant.py#L421-L449 | [
"def",
"process",
"(",
"self",
",",
"request",
",",
"response",
",",
"environ",
")",
":",
"data",
"=",
"self",
".",
"authorize",
"(",
"request",
",",
"response",
",",
"environ",
",",
"self",
".",
"scope_handler",
".",
"scopes",
")",
"if",
"isinstance",
... | abe3bf5f27bda2ff737cab387b040e2e6e85c2e2 |
train | AuthorizationCodeAuthHandler.handle_error | Redirects the client in case an error in the auth process occurred. | oauth2/grant.py | def handle_error(self, error, response):
"""
Redirects the client in case an error in the auth process occurred.
"""
query_params = {"error": error.error}
query = urlencode(query_params)
location = "%s?%s" % (self.client.redirect_uri, query)
response.status_cod... | def handle_error(self, error, response):
"""
Redirects the client in case an error in the auth process occurred.
"""
query_params = {"error": error.error}
query = urlencode(query_params)
location = "%s?%s" % (self.client.redirect_uri, query)
response.status_cod... | [
"Redirects",
"the",
"client",
"in",
"case",
"an",
"error",
"in",
"the",
"auth",
"process",
"occurred",
"."
] | wndhydrnt/python-oauth2 | python | https://github.com/wndhydrnt/python-oauth2/blob/abe3bf5f27bda2ff737cab387b040e2e6e85c2e2/oauth2/grant.py#L451-L465 | [
"def",
"handle_error",
"(",
"self",
",",
"error",
",",
"response",
")",
":",
"query_params",
"=",
"{",
"\"error\"",
":",
"error",
".",
"error",
"}",
"query",
"=",
"urlencode",
"(",
"query_params",
")",
"location",
"=",
"\"%s?%s\"",
"%",
"(",
"self",
".",... | abe3bf5f27bda2ff737cab387b040e2e6e85c2e2 |
train | AuthorizationCodeTokenHandler.process | Generates a new access token and returns it.
Returns the access token and the type of the token as JSON.
Calls `oauth2.store.AccessTokenStore` to persist the token. | oauth2/grant.py | def process(self, request, response, environ):
"""
Generates a new access token and returns it.
Returns the access token and the type of the token as JSON.
Calls `oauth2.store.AccessTokenStore` to persist the token.
"""
token_data = self.create_token(
client... | def process(self, request, response, environ):
"""
Generates a new access token and returns it.
Returns the access token and the type of the token as JSON.
Calls `oauth2.store.AccessTokenStore` to persist the token.
"""
token_data = self.create_token(
client... | [
"Generates",
"a",
"new",
"access",
"token",
"and",
"returns",
"it",
"."
] | wndhydrnt/python-oauth2 | python | https://github.com/wndhydrnt/python-oauth2/blob/abe3bf5f27bda2ff737cab387b040e2e6e85c2e2/oauth2/grant.py#L512-L534 | [
"def",
"process",
"(",
"self",
",",
"request",
",",
"response",
",",
"environ",
")",
":",
"token_data",
"=",
"self",
".",
"create_token",
"(",
"client_id",
"=",
"self",
".",
"client",
".",
"identifier",
",",
"data",
"=",
"self",
".",
"data",
",",
"gran... | abe3bf5f27bda2ff737cab387b040e2e6e85c2e2 |
train | ResourceOwnerGrantHandler.process | Takes the incoming request, asks the concrete SiteAdapter to validate
it and issues a new access token that is returned to the client on
successful validation. | oauth2/grant.py | def process(self, request, response, environ):
"""
Takes the incoming request, asks the concrete SiteAdapter to validate
it and issues a new access token that is returned to the client on
successful validation.
"""
try:
data = self.site_adapter.authenticate(re... | def process(self, request, response, environ):
"""
Takes the incoming request, asks the concrete SiteAdapter to validate
it and issues a new access token that is returned to the client on
successful validation.
"""
try:
data = self.site_adapter.authenticate(re... | [
"Takes",
"the",
"incoming",
"request",
"asks",
"the",
"concrete",
"SiteAdapter",
"to",
"validate",
"it",
"and",
"issues",
"a",
"new",
"access",
"token",
"that",
"is",
"returned",
"to",
"the",
"client",
"on",
"successful",
"validation",
"."
] | wndhydrnt/python-oauth2 | python | https://github.com/wndhydrnt/python-oauth2/blob/abe3bf5f27bda2ff737cab387b040e2e6e85c2e2/oauth2/grant.py#L813-L843 | [
"def",
"process",
"(",
"self",
",",
"request",
",",
"response",
",",
"environ",
")",
":",
"try",
":",
"data",
"=",
"self",
".",
"site_adapter",
".",
"authenticate",
"(",
"request",
",",
"environ",
",",
"self",
".",
"scope_handler",
".",
"scopes",
",",
... | abe3bf5f27bda2ff737cab387b040e2e6e85c2e2 |
train | ResourceOwnerGrantHandler.read_validate_params | Checks if all incoming parameters meet the expected values. | oauth2/grant.py | def read_validate_params(self, request):
"""
Checks if all incoming parameters meet the expected values.
"""
self.client = self.client_authenticator.by_identifier_secret(request)
self.password = request.post_param("password")
self.username = request.post_param("username"... | def read_validate_params(self, request):
"""
Checks if all incoming parameters meet the expected values.
"""
self.client = self.client_authenticator.by_identifier_secret(request)
self.password = request.post_param("password")
self.username = request.post_param("username"... | [
"Checks",
"if",
"all",
"incoming",
"parameters",
"meet",
"the",
"expected",
"values",
"."
] | wndhydrnt/python-oauth2 | python | https://github.com/wndhydrnt/python-oauth2/blob/abe3bf5f27bda2ff737cab387b040e2e6e85c2e2/oauth2/grant.py#L845-L856 | [
"def",
"read_validate_params",
"(",
"self",
",",
"request",
")",
":",
"self",
".",
"client",
"=",
"self",
".",
"client_authenticator",
".",
"by_identifier_secret",
"(",
"request",
")",
"self",
".",
"password",
"=",
"request",
".",
"post_param",
"(",
"\"passwor... | abe3bf5f27bda2ff737cab387b040e2e6e85c2e2 |
train | RefreshTokenHandler.process | Create a new access token.
:param request: The incoming :class:`oauth2.web.Request`.
:param response: The :class:`oauth2.web.Response` that will be returned
to the client.
:param environ: A ``dict`` containing data of the environment.
:return: :class:`oauth2.we... | oauth2/grant.py | def process(self, request, response, environ):
"""
Create a new access token.
:param request: The incoming :class:`oauth2.web.Request`.
:param response: The :class:`oauth2.web.Response` that will be returned
to the client.
:param environ: A ``dict`` cont... | def process(self, request, response, environ):
"""
Create a new access token.
:param request: The incoming :class:`oauth2.web.Request`.
:param response: The :class:`oauth2.web.Response` that will be returned
to the client.
:param environ: A ``dict`` cont... | [
"Create",
"a",
"new",
"access",
"token",
"."
] | wndhydrnt/python-oauth2 | python | https://github.com/wndhydrnt/python-oauth2/blob/abe3bf5f27bda2ff737cab387b040e2e6e85c2e2/oauth2/grant.py#L936-L971 | [
"def",
"process",
"(",
"self",
",",
"request",
",",
"response",
",",
"environ",
")",
":",
"token_data",
"=",
"self",
".",
"token_generator",
".",
"create_access_token_data",
"(",
"self",
".",
"refresh_grant_type",
")",
"expires_at",
"=",
"int",
"(",
"time",
... | abe3bf5f27bda2ff737cab387b040e2e6e85c2e2 |
train | RefreshTokenHandler.read_validate_params | Validate the incoming request.
:param request: The incoming :class:`oauth2.web.Request`.
:return: Returns ``True`` if data is valid.
:raises: :class:`oauth2.error.OAuthInvalidError` | oauth2/grant.py | def read_validate_params(self, request):
"""
Validate the incoming request.
:param request: The incoming :class:`oauth2.web.Request`.
:return: Returns ``True`` if data is valid.
:raises: :class:`oauth2.error.OAuthInvalidError`
"""
self.refresh_token = request.... | def read_validate_params(self, request):
"""
Validate the incoming request.
:param request: The incoming :class:`oauth2.web.Request`.
:return: Returns ``True`` if data is valid.
:raises: :class:`oauth2.error.OAuthInvalidError`
"""
self.refresh_token = request.... | [
"Validate",
"the",
"incoming",
"request",
"."
] | wndhydrnt/python-oauth2 | python | https://github.com/wndhydrnt/python-oauth2/blob/abe3bf5f27bda2ff737cab387b040e2e6e85c2e2/oauth2/grant.py#L973-L1015 | [
"def",
"read_validate_params",
"(",
"self",
",",
"request",
")",
":",
"self",
".",
"refresh_token",
"=",
"request",
".",
"post_param",
"(",
"\"refresh_token\"",
")",
"if",
"self",
".",
"refresh_token",
"is",
"None",
":",
"raise",
"OAuthInvalidError",
"(",
"err... | abe3bf5f27bda2ff737cab387b040e2e6e85c2e2 |
train | value_for_keypath | Get value from walking key path with start object obj. | pygameui/kvc.py | def value_for_keypath(obj, path):
"""Get value from walking key path with start object obj.
"""
val = obj
for part in path.split('.'):
match = re.match(list_index_re, part)
if match is not None:
val = _extract(val, match.group(1))
if not isinstance(val, list) and ... | def value_for_keypath(obj, path):
"""Get value from walking key path with start object obj.
"""
val = obj
for part in path.split('.'):
match = re.match(list_index_re, part)
if match is not None:
val = _extract(val, match.group(1))
if not isinstance(val, list) and ... | [
"Get",
"value",
"from",
"walking",
"key",
"path",
"with",
"start",
"object",
"obj",
"."
] | fictorial/pygameui | python | https://github.com/fictorial/pygameui/blob/af6a35f347d6fafa66c4255bbbe38736d842ff65/pygameui/kvc.py#L58-L74 | [
"def",
"value_for_keypath",
"(",
"obj",
",",
"path",
")",
":",
"val",
"=",
"obj",
"for",
"part",
"in",
"path",
".",
"split",
"(",
"'.'",
")",
":",
"match",
"=",
"re",
".",
"match",
"(",
"list_index_re",
",",
"part",
")",
"if",
"match",
"is",
"not",... | af6a35f347d6fafa66c4255bbbe38736d842ff65 |
train | set_value_for_keypath | Set attribute value new_value at key path of start object obj. | pygameui/kvc.py | def set_value_for_keypath(obj, path, new_value, preserve_child = False):
"""Set attribute value new_value at key path of start object obj.
"""
parts = path.split('.')
last_part = len(parts) - 1
dst = obj
for i, part in enumerate(parts):
match = re.match(list_index_re, part)
if ma... | def set_value_for_keypath(obj, path, new_value, preserve_child = False):
"""Set attribute value new_value at key path of start object obj.
"""
parts = path.split('.')
last_part = len(parts) - 1
dst = obj
for i, part in enumerate(parts):
match = re.match(list_index_re, part)
if ma... | [
"Set",
"attribute",
"value",
"new_value",
"at",
"key",
"path",
"of",
"start",
"object",
"obj",
"."
] | fictorial/pygameui | python | https://github.com/fictorial/pygameui/blob/af6a35f347d6fafa66c4255bbbe38736d842ff65/pygameui/kvc.py#L77-L107 | [
"def",
"set_value_for_keypath",
"(",
"obj",
",",
"path",
",",
"new_value",
",",
"preserve_child",
"=",
"False",
")",
":",
"parts",
"=",
"path",
".",
"split",
"(",
"'.'",
")",
"last_part",
"=",
"len",
"(",
"parts",
")",
"-",
"1",
"dst",
"=",
"obj",
"f... | af6a35f347d6fafa66c4255bbbe38736d842ff65 |
train | view_for_image_named | Create an ImageView for the given image. | pygameui/imageview.py | def view_for_image_named(image_name):
"""Create an ImageView for the given image."""
image = resource.get_image(image_name)
if not image:
return None
return ImageView(pygame.Rect(0, 0, 0, 0), image) | def view_for_image_named(image_name):
"""Create an ImageView for the given image."""
image = resource.get_image(image_name)
if not image:
return None
return ImageView(pygame.Rect(0, 0, 0, 0), image) | [
"Create",
"an",
"ImageView",
"for",
"the",
"given",
"image",
"."
] | fictorial/pygameui | python | https://github.com/fictorial/pygameui/blob/af6a35f347d6fafa66c4255bbbe38736d842ff65/pygameui/imageview.py#L64-L72 | [
"def",
"view_for_image_named",
"(",
"image_name",
")",
":",
"image",
"=",
"resource",
".",
"get_image",
"(",
"image_name",
")",
"if",
"not",
"image",
":",
"return",
"None",
"return",
"ImageView",
"(",
"pygame",
".",
"Rect",
"(",
"0",
",",
"0",
",",
"0",
... | af6a35f347d6fafa66c4255bbbe38736d842ff65 |
train | main | Install or upgrade setuptools and EasyInstall | distribute_setup.py | def main(argv, version=DEFAULT_VERSION):
"""Install or upgrade setuptools and EasyInstall"""
tarball = download_setuptools()
_install(tarball, _build_install_args(argv)) | def main(argv, version=DEFAULT_VERSION):
"""Install or upgrade setuptools and EasyInstall"""
tarball = download_setuptools()
_install(tarball, _build_install_args(argv)) | [
"Install",
"or",
"upgrade",
"setuptools",
"and",
"EasyInstall"
] | fictorial/pygameui | python | https://github.com/fictorial/pygameui/blob/af6a35f347d6fafa66c4255bbbe38736d842ff65/distribute_setup.py#L487-L490 | [
"def",
"main",
"(",
"argv",
",",
"version",
"=",
"DEFAULT_VERSION",
")",
":",
"tarball",
"=",
"download_setuptools",
"(",
")",
"_install",
"(",
"tarball",
",",
"_build_install_args",
"(",
"argv",
")",
")"
] | af6a35f347d6fafa66c4255bbbe38736d842ff65 |
train | fill_gradient | Fill a surface with a linear gradient pattern.
color
starting color
gradient
final color
rect
area to fill; default is surface's rect
vertical
True=vertical; False=horizontal
forward
True=forward; False=reverse
See http://www.pygame.org/wiki/Gra... | pygameui/render.py | def fill_gradient(surface, color, gradient,
rect=None, vertical=True, forward=True):
"""Fill a surface with a linear gradient pattern.
color
starting color
gradient
final color
rect
area to fill; default is surface's rect
vertical
True=verti... | def fill_gradient(surface, color, gradient,
rect=None, vertical=True, forward=True):
"""Fill a surface with a linear gradient pattern.
color
starting color
gradient
final color
rect
area to fill; default is surface's rect
vertical
True=verti... | [
"Fill",
"a",
"surface",
"with",
"a",
"linear",
"gradient",
"pattern",
"."
] | fictorial/pygameui | python | https://github.com/fictorial/pygameui/blob/af6a35f347d6fafa66c4255bbbe38736d842ff65/pygameui/render.py#L4-L66 | [
"def",
"fill_gradient",
"(",
"surface",
",",
"color",
",",
"gradient",
",",
"rect",
"=",
"None",
",",
"vertical",
"=",
"True",
",",
"forward",
"=",
"True",
")",
":",
"if",
"rect",
"is",
"None",
":",
"rect",
"=",
"surface",
".",
"get_rect",
"(",
")",
... | af6a35f347d6fafa66c4255bbbe38736d842ff65 |
train | Label.shrink_wrap | Tightly bound the current text respecting current padding. | pygameui/label.py | def shrink_wrap(self):
"""Tightly bound the current text respecting current padding."""
self.frame.size = (self.text_size[0] + self.padding[0] * 2,
self.text_size[1] + self.padding[1] * 2) | def shrink_wrap(self):
"""Tightly bound the current text respecting current padding."""
self.frame.size = (self.text_size[0] + self.padding[0] * 2,
self.text_size[1] + self.padding[1] * 2) | [
"Tightly",
"bound",
"the",
"current",
"text",
"respecting",
"current",
"padding",
"."
] | fictorial/pygameui | python | https://github.com/fictorial/pygameui/blob/af6a35f347d6fafa66c4255bbbe38736d842ff65/pygameui/label.py#L187-L191 | [
"def",
"shrink_wrap",
"(",
"self",
")",
":",
"self",
".",
"frame",
".",
"size",
"=",
"(",
"self",
".",
"text_size",
"[",
"0",
"]",
"+",
"self",
".",
"padding",
"[",
"0",
"]",
"*",
"2",
",",
"self",
".",
"text_size",
"[",
"1",
"]",
"+",
"self",
... | af6a35f347d6fafa66c4255bbbe38736d842ff65 |
train | View.layout | Call to have the view layout itself.
Subclasses should invoke this after laying out child
views and/or updating its own frame. | pygameui/view.py | def layout(self):
"""Call to have the view layout itself.
Subclasses should invoke this after laying out child
views and/or updating its own frame.
"""
if self.shadowed:
shadow_size = theme.current.shadow_size
shadowed_frame_size = (self.frame.w + shadow_... | def layout(self):
"""Call to have the view layout itself.
Subclasses should invoke this after laying out child
views and/or updating its own frame.
"""
if self.shadowed:
shadow_size = theme.current.shadow_size
shadowed_frame_size = (self.frame.w + shadow_... | [
"Call",
"to",
"have",
"the",
"view",
"layout",
"itself",
"."
] | fictorial/pygameui | python | https://github.com/fictorial/pygameui/blob/af6a35f347d6fafa66c4255bbbe38736d842ff65/pygameui/view.py#L74-L91 | [
"def",
"layout",
"(",
"self",
")",
":",
"if",
"self",
".",
"shadowed",
":",
"shadow_size",
"=",
"theme",
".",
"current",
".",
"shadow_size",
"shadowed_frame_size",
"=",
"(",
"self",
".",
"frame",
".",
"w",
"+",
"shadow_size",
",",
"self",
".",
"frame",
... | af6a35f347d6fafa66c4255bbbe38736d842ff65 |
train | View.stylize | Apply theme style attributes to this instance and its children.
This also causes a relayout to occur so that any changes in padding
or other stylistic attributes may be handled. | pygameui/view.py | def stylize(self):
"""Apply theme style attributes to this instance and its children.
This also causes a relayout to occur so that any changes in padding
or other stylistic attributes may be handled.
"""
# do children first in case parent needs to override their style
fo... | def stylize(self):
"""Apply theme style attributes to this instance and its children.
This also causes a relayout to occur so that any changes in padding
or other stylistic attributes may be handled.
"""
# do children first in case parent needs to override their style
fo... | [
"Apply",
"theme",
"style",
"attributes",
"to",
"this",
"instance",
"and",
"its",
"children",
"."
] | fictorial/pygameui | python | https://github.com/fictorial/pygameui/blob/af6a35f347d6fafa66c4255bbbe38736d842ff65/pygameui/view.py#L209-L227 | [
"def",
"stylize",
"(",
"self",
")",
":",
"# do children first in case parent needs to override their style",
"for",
"child",
"in",
"self",
".",
"children",
":",
"child",
".",
"stylize",
"(",
")",
"style",
"=",
"theme",
".",
"current",
".",
"get_dict",
"(",
"self... | af6a35f347d6fafa66c4255bbbe38736d842ff65 |
train | View.draw | Do not call directly. | pygameui/view.py | def draw(self):
"""Do not call directly."""
if self.hidden:
return False
if self.background_color is not None:
render.fillrect(self.surface, self.background_color,
rect=pygame.Rect((0, 0), self.frame.size))
for child in self.children... | def draw(self):
"""Do not call directly."""
if self.hidden:
return False
if self.background_color is not None:
render.fillrect(self.surface, self.background_color,
rect=pygame.Rect((0, 0), self.frame.size))
for child in self.children... | [
"Do",
"not",
"call",
"directly",
"."
] | fictorial/pygameui | python | https://github.com/fictorial/pygameui/blob/af6a35f347d6fafa66c4255bbbe38736d842ff65/pygameui/view.py#L229-L278 | [
"def",
"draw",
"(",
"self",
")",
":",
"if",
"self",
".",
"hidden",
":",
"return",
"False",
"if",
"self",
".",
"background_color",
"is",
"not",
"None",
":",
"render",
".",
"fillrect",
"(",
"self",
".",
"surface",
",",
"self",
".",
"background_color",
",... | af6a35f347d6fafa66c4255bbbe38736d842ff65 |
train | View.get_border_widths | Return border width for each side top, left, bottom, right. | pygameui/view.py | def get_border_widths(self):
"""Return border width for each side top, left, bottom, right."""
if type(self.border_widths) is int: # uniform size
return [self.border_widths] * 4
return self.border_widths | def get_border_widths(self):
"""Return border width for each side top, left, bottom, right."""
if type(self.border_widths) is int: # uniform size
return [self.border_widths] * 4
return self.border_widths | [
"Return",
"border",
"width",
"for",
"each",
"side",
"top",
"left",
"bottom",
"right",
"."
] | fictorial/pygameui | python | https://github.com/fictorial/pygameui/blob/af6a35f347d6fafa66c4255bbbe38736d842ff65/pygameui/view.py#L280-L284 | [
"def",
"get_border_widths",
"(",
"self",
")",
":",
"if",
"type",
"(",
"self",
".",
"border_widths",
")",
"is",
"int",
":",
"# uniform size",
"return",
"[",
"self",
".",
"border_widths",
"]",
"*",
"4",
"return",
"self",
".",
"border_widths"
] | af6a35f347d6fafa66c4255bbbe38736d842ff65 |
train | View.hit | Find the view (self, child, or None) under the point `pt`. | pygameui/view.py | def hit(self, pt):
"""Find the view (self, child, or None) under the point `pt`."""
if self.hidden or not self._enabled:
return None
if not self.frame.collidepoint(pt):
return None
local_pt = (pt[0] - self.frame.topleft[0],
pt[1] - self.fram... | def hit(self, pt):
"""Find the view (self, child, or None) under the point `pt`."""
if self.hidden or not self._enabled:
return None
if not self.frame.collidepoint(pt):
return None
local_pt = (pt[0] - self.frame.topleft[0],
pt[1] - self.fram... | [
"Find",
"the",
"view",
"(",
"self",
"child",
"or",
"None",
")",
"under",
"the",
"point",
"pt",
"."
] | fictorial/pygameui | python | https://github.com/fictorial/pygameui/blob/af6a35f347d6fafa66c4255bbbe38736d842ff65/pygameui/view.py#L286-L303 | [
"def",
"hit",
"(",
"self",
",",
"pt",
")",
":",
"if",
"self",
".",
"hidden",
"or",
"not",
"self",
".",
"_enabled",
":",
"return",
"None",
"if",
"not",
"self",
".",
"frame",
".",
"collidepoint",
"(",
"pt",
")",
":",
"return",
"None",
"local_pt",
"="... | af6a35f347d6fafa66c4255bbbe38736d842ff65 |
train | View.bring_to_front | TODO: explain depth sorting | pygameui/view.py | def bring_to_front(self):
"""TODO: explain depth sorting"""
if self.parent is not None:
ch = self.parent.children
index = ch.index(self)
ch[-1], ch[index] = ch[index], ch[-1] | def bring_to_front(self):
"""TODO: explain depth sorting"""
if self.parent is not None:
ch = self.parent.children
index = ch.index(self)
ch[-1], ch[index] = ch[index], ch[-1] | [
"TODO",
":",
"explain",
"depth",
"sorting"
] | fictorial/pygameui | python | https://github.com/fictorial/pygameui/blob/af6a35f347d6fafa66c4255bbbe38736d842ff65/pygameui/view.py#L347-L352 | [
"def",
"bring_to_front",
"(",
"self",
")",
":",
"if",
"self",
".",
"parent",
"is",
"not",
"None",
":",
"ch",
"=",
"self",
".",
"parent",
".",
"children",
"index",
"=",
"ch",
".",
"index",
"(",
"self",
")",
"ch",
"[",
"-",
"1",
"]",
",",
"ch",
"... | af6a35f347d6fafa66c4255bbbe38736d842ff65 |
train | use_theme | Make the given theme current.
There are two included themes: light_theme, dark_theme. | pygameui/theme.py | def use_theme(theme):
"""Make the given theme current.
There are two included themes: light_theme, dark_theme.
"""
global current
current = theme
import scene
if scene.current is not None:
scene.current.stylize() | def use_theme(theme):
"""Make the given theme current.
There are two included themes: light_theme, dark_theme.
"""
global current
current = theme
import scene
if scene.current is not None:
scene.current.stylize() | [
"Make",
"the",
"given",
"theme",
"current",
"."
] | fictorial/pygameui | python | https://github.com/fictorial/pygameui/blob/af6a35f347d6fafa66c4255bbbe38736d842ff65/pygameui/theme.py#L176-L185 | [
"def",
"use_theme",
"(",
"theme",
")",
":",
"global",
"current",
"current",
"=",
"theme",
"import",
"scene",
"if",
"scene",
".",
"current",
"is",
"not",
"None",
":",
"scene",
".",
"current",
".",
"stylize",
"(",
")"
] | af6a35f347d6fafa66c4255bbbe38736d842ff65 |
train | Theme.set | Set a single style value for a view class and state.
class_name
The name of the class to be styled; do not
include the package name; e.g. 'Button'.
state
The name of the state to be stylized. One of the
following: 'normal', 'focused', 'selected', 'disa... | pygameui/theme.py | def set(self, class_name, state, key, value):
"""Set a single style value for a view class and state.
class_name
The name of the class to be styled; do not
include the package name; e.g. 'Button'.
state
The name of the state to be stylized. One of the
... | def set(self, class_name, state, key, value):
"""Set a single style value for a view class and state.
class_name
The name of the class to be styled; do not
include the package name; e.g. 'Button'.
state
The name of the state to be stylized. One of the
... | [
"Set",
"a",
"single",
"style",
"value",
"for",
"a",
"view",
"class",
"and",
"state",
"."
] | fictorial/pygameui | python | https://github.com/fictorial/pygameui/blob/af6a35f347d6fafa66c4255bbbe38736d842ff65/pygameui/theme.py#L71-L97 | [
"def",
"set",
"(",
"self",
",",
"class_name",
",",
"state",
",",
"key",
",",
"value",
")",
":",
"self",
".",
"_styles",
".",
"setdefault",
"(",
"class_name",
",",
"{",
"}",
")",
".",
"setdefault",
"(",
"state",
",",
"{",
"}",
")",
"self",
".",
"_... | af6a35f347d6fafa66c4255bbbe38736d842ff65 |
train | Theme.get_dict_for_class | The style dict for a given class and state.
This collects the style attributes from parent classes
and the class of the given object and gives precedence
to values thereof to the children.
The state attribute of the view instance is taken as
the current state if state is None.
... | pygameui/theme.py | def get_dict_for_class(self, class_name, state=None, base_name='View'):
"""The style dict for a given class and state.
This collects the style attributes from parent classes
and the class of the given object and gives precedence
to values thereof to the children.
The state attr... | def get_dict_for_class(self, class_name, state=None, base_name='View'):
"""The style dict for a given class and state.
This collects the style attributes from parent classes
and the class of the given object and gives precedence
to values thereof to the children.
The state attr... | [
"The",
"style",
"dict",
"for",
"a",
"given",
"class",
"and",
"state",
"."
] | fictorial/pygameui | python | https://github.com/fictorial/pygameui/blob/af6a35f347d6fafa66c4255bbbe38736d842ff65/pygameui/theme.py#L99-L149 | [
"def",
"get_dict_for_class",
"(",
"self",
",",
"class_name",
",",
"state",
"=",
"None",
",",
"base_name",
"=",
"'View'",
")",
":",
"classes",
"=",
"[",
"]",
"klass",
"=",
"class_name",
"while",
"True",
":",
"classes",
".",
"append",
"(",
"klass",
")",
... | af6a35f347d6fafa66c4255bbbe38736d842ff65 |
train | Theme.get_dict | The style dict for a view instance. | pygameui/theme.py | def get_dict(self, obj, state=None, base_name='View'):
"""The style dict for a view instance.
"""
return self.get_dict_for_class(class_name=obj.__class__,
state=obj.state,
base_name=base_name) | def get_dict(self, obj, state=None, base_name='View'):
"""The style dict for a view instance.
"""
return self.get_dict_for_class(class_name=obj.__class__,
state=obj.state,
base_name=base_name) | [
"The",
"style",
"dict",
"for",
"a",
"view",
"instance",
"."
] | fictorial/pygameui | python | https://github.com/fictorial/pygameui/blob/af6a35f347d6fafa66c4255bbbe38736d842ff65/pygameui/theme.py#L151-L157 | [
"def",
"get_dict",
"(",
"self",
",",
"obj",
",",
"state",
"=",
"None",
",",
"base_name",
"=",
"'View'",
")",
":",
"return",
"self",
".",
"get_dict_for_class",
"(",
"class_name",
"=",
"obj",
".",
"__class__",
",",
"state",
"=",
"obj",
".",
"state",
",",... | af6a35f347d6fafa66c4255bbbe38736d842ff65 |
train | Theme.get_value | Get a single style attribute value for the given class. | pygameui/theme.py | def get_value(self, class_name, attr, default_value=None,
state='normal', base_name='View'):
"""Get a single style attribute value for the given class.
"""
styles = self.get_dict_for_class(class_name, state, base_name)
try:
return styles[attr]
excep... | def get_value(self, class_name, attr, default_value=None,
state='normal', base_name='View'):
"""Get a single style attribute value for the given class.
"""
styles = self.get_dict_for_class(class_name, state, base_name)
try:
return styles[attr]
excep... | [
"Get",
"a",
"single",
"style",
"attribute",
"value",
"for",
"the",
"given",
"class",
"."
] | fictorial/pygameui | python | https://github.com/fictorial/pygameui/blob/af6a35f347d6fafa66c4255bbbe38736d842ff65/pygameui/theme.py#L159-L168 | [
"def",
"get_value",
"(",
"self",
",",
"class_name",
",",
"attr",
",",
"default_value",
"=",
"None",
",",
"state",
"=",
"'normal'",
",",
"base_name",
"=",
"'View'",
")",
":",
"styles",
"=",
"self",
".",
"get_dict_for_class",
"(",
"class_name",
",",
"state",... | af6a35f347d6fafa66c4255bbbe38736d842ff65 |
train | Serializer.serialize | Serialize a queryset. | field_history/json_nested_serializer.py | def serialize(self, queryset, **options):
"""
Serialize a queryset.
"""
self.options = options
self.stream = options.pop("stream", six.StringIO())
self.selected_fields = options.pop("fields", None)
self.use_natural_keys = options.pop("use_natural_keys", False)
... | def serialize(self, queryset, **options):
"""
Serialize a queryset.
"""
self.options = options
self.stream = options.pop("stream", six.StringIO())
self.selected_fields = options.pop("fields", None)
self.use_natural_keys = options.pop("use_natural_keys", False)
... | [
"Serialize",
"a",
"queryset",
"."
] | grantmcconnaughey/django-field-history | python | https://github.com/grantmcconnaughey/django-field-history/blob/b61885d8bddf7d1f53addf3bea098f67fcf9a618/field_history/json_nested_serializer.py#L26-L65 | [
"def",
"serialize",
"(",
"self",
",",
"queryset",
",",
"*",
"*",
"options",
")",
":",
"self",
".",
"options",
"=",
"options",
"self",
".",
"stream",
"=",
"options",
".",
"pop",
"(",
"\"stream\"",
",",
"six",
".",
"StringIO",
"(",
")",
")",
"self",
... | b61885d8bddf7d1f53addf3bea098f67fcf9a618 |
train | FieldInstanceTracker.current | Returns dict of current values for all tracked fields | field_history/tracker.py | def current(self, fields=None):
"""Returns dict of current values for all tracked fields"""
if fields is None:
fields = self.fields
return dict((f, self.get_field_value(f)) for f in fields) | def current(self, fields=None):
"""Returns dict of current values for all tracked fields"""
if fields is None:
fields = self.fields
return dict((f, self.get_field_value(f)) for f in fields) | [
"Returns",
"dict",
"of",
"current",
"values",
"for",
"all",
"tracked",
"fields"
] | grantmcconnaughey/django-field-history | python | https://github.com/grantmcconnaughey/django-field-history/blob/b61885d8bddf7d1f53addf3bea098f67fcf9a618/field_history/tracker.py#L36-L41 | [
"def",
"current",
"(",
"self",
",",
"fields",
"=",
"None",
")",
":",
"if",
"fields",
"is",
"None",
":",
"fields",
"=",
"self",
".",
"fields",
"return",
"dict",
"(",
"(",
"f",
",",
"self",
".",
"get_field_value",
"(",
"f",
")",
")",
"for",
"f",
"i... | b61885d8bddf7d1f53addf3bea098f67fcf9a618 |
train | instantiate_object_id_field | Instantiates and returns a model field for FieldHistory.object_id.
object_id_class_or_tuple may be either a Django model field class or a
tuple of (model_field, kwargs), where kwargs is a dict passed to
model_field's constructor. | field_history/models.py | def instantiate_object_id_field(object_id_class_or_tuple=models.TextField):
"""
Instantiates and returns a model field for FieldHistory.object_id.
object_id_class_or_tuple may be either a Django model field class or a
tuple of (model_field, kwargs), where kwargs is a dict passed to
model_field's co... | def instantiate_object_id_field(object_id_class_or_tuple=models.TextField):
"""
Instantiates and returns a model field for FieldHistory.object_id.
object_id_class_or_tuple may be either a Django model field class or a
tuple of (model_field, kwargs), where kwargs is a dict passed to
model_field's co... | [
"Instantiates",
"and",
"returns",
"a",
"model",
"field",
"for",
"FieldHistory",
".",
"object_id",
"."
] | grantmcconnaughey/django-field-history | python | https://github.com/grantmcconnaughey/django-field-history/blob/b61885d8bddf7d1f53addf3bea098f67fcf9a618/field_history/models.py#L16-L35 | [
"def",
"instantiate_object_id_field",
"(",
"object_id_class_or_tuple",
"=",
"models",
".",
"TextField",
")",
":",
"if",
"isinstance",
"(",
"object_id_class_or_tuple",
",",
"(",
"list",
",",
"tuple",
")",
")",
":",
"object_id_class",
",",
"object_id_kwargs",
"=",
"... | b61885d8bddf7d1f53addf3bea098f67fcf9a618 |
train | SessionID.has_expired | Report if the session key has expired.
:param lifetime: A :class:`datetime.timedelta` that specifies the
maximum age this :class:`SessionID` should be checked
against.
:param now: If specified, use this :class:`~datetime.datetime` instance
... | flask_kvsession/__init__.py | def has_expired(self, lifetime, now=None):
"""Report if the session key has expired.
:param lifetime: A :class:`datetime.timedelta` that specifies the
maximum age this :class:`SessionID` should be checked
against.
:param now: If specified, use t... | def has_expired(self, lifetime, now=None):
"""Report if the session key has expired.
:param lifetime: A :class:`datetime.timedelta` that specifies the
maximum age this :class:`SessionID` should be checked
against.
:param now: If specified, use t... | [
"Report",
"if",
"the",
"session",
"key",
"has",
"expired",
"."
] | mbr/flask-kvsession | python | https://github.com/mbr/flask-kvsession/blob/83238b74d4e4d2ffbdfd65c1c0a00ceb4bdfd9fa/flask_kvsession/__init__.py#L41-L52 | [
"def",
"has_expired",
"(",
"self",
",",
"lifetime",
",",
"now",
"=",
"None",
")",
":",
"now",
"=",
"now",
"or",
"datetime",
".",
"utcnow",
"(",
")",
"return",
"now",
">",
"self",
".",
"created",
"+",
"lifetime"
] | 83238b74d4e4d2ffbdfd65c1c0a00ceb4bdfd9fa |
train | SessionID.unserialize | Unserializes from a string.
:param string: A string created by :meth:`serialize`. | flask_kvsession/__init__.py | def unserialize(cls, string):
"""Unserializes from a string.
:param string: A string created by :meth:`serialize`.
"""
id_s, created_s = string.split('_')
return cls(int(id_s, 16),
datetime.utcfromtimestamp(int(created_s, 16))) | def unserialize(cls, string):
"""Unserializes from a string.
:param string: A string created by :meth:`serialize`.
"""
id_s, created_s = string.split('_')
return cls(int(id_s, 16),
datetime.utcfromtimestamp(int(created_s, 16))) | [
"Unserializes",
"from",
"a",
"string",
"."
] | mbr/flask-kvsession | python | https://github.com/mbr/flask-kvsession/blob/83238b74d4e4d2ffbdfd65c1c0a00ceb4bdfd9fa/flask_kvsession/__init__.py#L60-L67 | [
"def",
"unserialize",
"(",
"cls",
",",
"string",
")",
":",
"id_s",
",",
"created_s",
"=",
"string",
".",
"split",
"(",
"'_'",
")",
"return",
"cls",
"(",
"int",
"(",
"id_s",
",",
"16",
")",
",",
"datetime",
".",
"utcfromtimestamp",
"(",
"int",
"(",
... | 83238b74d4e4d2ffbdfd65c1c0a00ceb4bdfd9fa |
train | KVSession.destroy | Destroys a session completely, by deleting all keys and removing it
from the internal store immediately.
This allows removing a session for security reasons, e.g. a login
stored in a session will cease to exist if the session is destroyed. | flask_kvsession/__init__.py | def destroy(self):
"""Destroys a session completely, by deleting all keys and removing it
from the internal store immediately.
This allows removing a session for security reasons, e.g. a login
stored in a session will cease to exist if the session is destroyed.
"""
for k... | def destroy(self):
"""Destroys a session completely, by deleting all keys and removing it
from the internal store immediately.
This allows removing a session for security reasons, e.g. a login
stored in a session will cease to exist if the session is destroyed.
"""
for k... | [
"Destroys",
"a",
"session",
"completely",
"by",
"deleting",
"all",
"keys",
"and",
"removing",
"it",
"from",
"the",
"internal",
"store",
"immediately",
"."
] | mbr/flask-kvsession | python | https://github.com/mbr/flask-kvsession/blob/83238b74d4e4d2ffbdfd65c1c0a00ceb4bdfd9fa/flask_kvsession/__init__.py#L89-L104 | [
"def",
"destroy",
"(",
"self",
")",
":",
"for",
"k",
"in",
"list",
"(",
"self",
".",
"keys",
"(",
")",
")",
":",
"del",
"self",
"[",
"k",
"]",
"if",
"getattr",
"(",
"self",
",",
"'sid_s'",
",",
"None",
")",
":",
"current_app",
".",
"kvsession_sto... | 83238b74d4e4d2ffbdfd65c1c0a00ceb4bdfd9fa |
train | KVSession.regenerate | Generate a new session id for this session.
To avoid vulnerabilities through `session fixation attacks
<http://en.wikipedia.org/wiki/Session_fixation>`_, this function can be
called after an action like a login has taken place. The session will
be copied over to a new session id and the... | flask_kvsession/__init__.py | def regenerate(self):
"""Generate a new session id for this session.
To avoid vulnerabilities through `session fixation attacks
<http://en.wikipedia.org/wiki/Session_fixation>`_, this function can be
called after an action like a login has taken place. The session will
be copied... | def regenerate(self):
"""Generate a new session id for this session.
To avoid vulnerabilities through `session fixation attacks
<http://en.wikipedia.org/wiki/Session_fixation>`_, this function can be
called after an action like a login has taken place. The session will
be copied... | [
"Generate",
"a",
"new",
"session",
"id",
"for",
"this",
"session",
"."
] | mbr/flask-kvsession | python | https://github.com/mbr/flask-kvsession/blob/83238b74d4e4d2ffbdfd65c1c0a00ceb4bdfd9fa/flask_kvsession/__init__.py#L106-L122 | [
"def",
"regenerate",
"(",
"self",
")",
":",
"self",
".",
"modified",
"=",
"True",
"if",
"getattr",
"(",
"self",
",",
"'sid_s'",
",",
"None",
")",
":",
"# delete old session",
"current_app",
".",
"kvsession_store",
".",
"delete",
"(",
"self",
".",
"sid_s",
... | 83238b74d4e4d2ffbdfd65c1c0a00ceb4bdfd9fa |
train | KVSessionExtension.cleanup_sessions | Removes all expired session from the store.
Periodically, this function can be called to remove sessions from
the backend store that have expired, as they are not removed
automatically unless the backend supports time-to-live and has been
configured appropriately (see :class:`~simplekv.... | flask_kvsession/__init__.py | def cleanup_sessions(self, app=None):
"""Removes all expired session from the store.
Periodically, this function can be called to remove sessions from
the backend store that have expired, as they are not removed
automatically unless the backend supports time-to-live and has been
... | def cleanup_sessions(self, app=None):
"""Removes all expired session from the store.
Periodically, this function can be called to remove sessions from
the backend store that have expired, as they are not removed
automatically unless the backend supports time-to-live and has been
... | [
"Removes",
"all",
"expired",
"session",
"from",
"the",
"store",
"."
] | mbr/flask-kvsession | python | https://github.com/mbr/flask-kvsession/blob/83238b74d4e4d2ffbdfd65c1c0a00ceb4bdfd9fa/flask_kvsession/__init__.py#L222-L250 | [
"def",
"cleanup_sessions",
"(",
"self",
",",
"app",
"=",
"None",
")",
":",
"if",
"not",
"app",
":",
"app",
"=",
"current_app",
"for",
"key",
"in",
"app",
".",
"kvsession_store",
".",
"keys",
"(",
")",
":",
"m",
"=",
"self",
".",
"key_regex",
".",
"... | 83238b74d4e4d2ffbdfd65c1c0a00ceb4bdfd9fa |
train | KVSessionExtension.init_app | Initialize application and KVSession.
This will replace the session management of the application with
Flask-KVSession's.
:param app: The :class:`~flask.Flask` app to be initialized. | flask_kvsession/__init__.py | def init_app(self, app, session_kvstore=None):
"""Initialize application and KVSession.
This will replace the session management of the application with
Flask-KVSession's.
:param app: The :class:`~flask.Flask` app to be initialized."""
app.config.setdefault('SESSION_KEY_BITS', ... | def init_app(self, app, session_kvstore=None):
"""Initialize application and KVSession.
This will replace the session management of the application with
Flask-KVSession's.
:param app: The :class:`~flask.Flask` app to be initialized."""
app.config.setdefault('SESSION_KEY_BITS', ... | [
"Initialize",
"application",
"and",
"KVSession",
"."
] | mbr/flask-kvsession | python | https://github.com/mbr/flask-kvsession/blob/83238b74d4e4d2ffbdfd65c1c0a00ceb4bdfd9fa/flask_kvsession/__init__.py#L252-L270 | [
"def",
"init_app",
"(",
"self",
",",
"app",
",",
"session_kvstore",
"=",
"None",
")",
":",
"app",
".",
"config",
".",
"setdefault",
"(",
"'SESSION_KEY_BITS'",
",",
"64",
")",
"app",
".",
"config",
".",
"setdefault",
"(",
"'SESSION_RANDOM_SOURCE'",
",",
"Sy... | 83238b74d4e4d2ffbdfd65c1c0a00ceb4bdfd9fa |
train | transfer_config_dict | This is a utility function used in the certification modules to transfer
the data dicts above to SOAP objects. This avoids repetition and allows
us to store all of our variable configuration here rather than in
each certification script. | label_certification/cert_config.py | def transfer_config_dict(soap_object, data_dict):
"""
This is a utility function used in the certification modules to transfer
the data dicts above to SOAP objects. This avoids repetition and allows
us to store all of our variable configuration here rather than in
each certification script.
"""
... | def transfer_config_dict(soap_object, data_dict):
"""
This is a utility function used in the certification modules to transfer
the data dicts above to SOAP objects. This avoids repetition and allows
us to store all of our variable configuration here rather than in
each certification script.
"""
... | [
"This",
"is",
"a",
"utility",
"function",
"used",
"in",
"the",
"certification",
"modules",
"to",
"transfer",
"the",
"data",
"dicts",
"above",
"to",
"SOAP",
"objects",
".",
"This",
"avoids",
"repetition",
"and",
"allows",
"us",
"to",
"store",
"all",
"of",
"... | python-fedex-devs/python-fedex | python | https://github.com/python-fedex-devs/python-fedex/blob/7ea2ca80c362f5dbbc8d959ab47648c7a4ab24eb/label_certification/cert_config.py#L65-L74 | [
"def",
"transfer_config_dict",
"(",
"soap_object",
",",
"data_dict",
")",
":",
"for",
"key",
",",
"val",
"in",
"data_dict",
".",
"items",
"(",
")",
":",
"# Transfer each key to the matching attribute ont he SOAP object.",
"setattr",
"(",
"soap_object",
",",
"key",
"... | 7ea2ca80c362f5dbbc8d959ab47648c7a4ab24eb |
train | FedexCreatePickupRequest._assemble_and_send_request | Fires off the Fedex request.
@warning: NEVER CALL THIS METHOD DIRECTLY. CALL send_request(),
WHICH RESIDES ON FedexBaseService AND IS INHERITED. | fedex/services/pickup_service.py | def _assemble_and_send_request(self):
"""
Fires off the Fedex request.
@warning: NEVER CALL THIS METHOD DIRECTLY. CALL send_request(),
WHICH RESIDES ON FedexBaseService AND IS INHERITED.
"""
# Fire off the query.
return self.client.service.createPickup(
... | def _assemble_and_send_request(self):
"""
Fires off the Fedex request.
@warning: NEVER CALL THIS METHOD DIRECTLY. CALL send_request(),
WHICH RESIDES ON FedexBaseService AND IS INHERITED.
"""
# Fire off the query.
return self.client.service.createPickup(
... | [
"Fires",
"off",
"the",
"Fedex",
"request",
"."
] | python-fedex-devs/python-fedex | python | https://github.com/python-fedex-devs/python-fedex/blob/7ea2ca80c362f5dbbc8d959ab47648c7a4ab24eb/fedex/services/pickup_service.py#L43-L66 | [
"def",
"_assemble_and_send_request",
"(",
"self",
")",
":",
"# Fire off the query.",
"return",
"self",
".",
"client",
".",
"service",
".",
"createPickup",
"(",
"WebAuthenticationDetail",
"=",
"self",
".",
"WebAuthenticationDetail",
",",
"ClientDetail",
"=",
"self",
... | 7ea2ca80c362f5dbbc8d959ab47648c7a4ab24eb |
train | FedexPickupAvailabilityRequest._assemble_and_send_request | Fires off the Fedex request.
@warning: NEVER CALL THIS METHOD DIRECTLY. CALL send_request(),
WHICH RESIDES ON FedexBaseService AND IS INHERITED. | fedex/services/pickup_service.py | def _assemble_and_send_request(self):
"""
Fires off the Fedex request.
@warning: NEVER CALL THIS METHOD DIRECTLY. CALL send_request(),
WHICH RESIDES ON FedexBaseService AND IS INHERITED.
"""
# Fire off the query.
return self.client.service.getPickupAvailabil... | def _assemble_and_send_request(self):
"""
Fires off the Fedex request.
@warning: NEVER CALL THIS METHOD DIRECTLY. CALL send_request(),
WHICH RESIDES ON FedexBaseService AND IS INHERITED.
"""
# Fire off the query.
return self.client.service.getPickupAvailabil... | [
"Fires",
"off",
"the",
"Fedex",
"request",
"."
] | python-fedex-devs/python-fedex | python | https://github.com/python-fedex-devs/python-fedex/blob/7ea2ca80c362f5dbbc8d959ab47648c7a4ab24eb/fedex/services/pickup_service.py#L120-L145 | [
"def",
"_assemble_and_send_request",
"(",
"self",
")",
":",
"# Fire off the query.",
"return",
"self",
".",
"client",
".",
"service",
".",
"getPickupAvailability",
"(",
"WebAuthenticationDetail",
"=",
"self",
".",
"WebAuthenticationDetail",
",",
"ClientDetail",
"=",
"... | 7ea2ca80c362f5dbbc8d959ab47648c7a4ab24eb |
train | FedexProcessShipmentRequest._prepare_wsdl_objects | This is the data that will be used to create your shipment. Create
the data structure and get it ready for the WSDL request. | fedex/services/ship_service.py | def _prepare_wsdl_objects(self):
"""
This is the data that will be used to create your shipment. Create
the data structure and get it ready for the WSDL request.
"""
# This is the primary data structure for processShipment requests.
self.RequestedShipment = self.client.f... | def _prepare_wsdl_objects(self):
"""
This is the data that will be used to create your shipment. Create
the data structure and get it ready for the WSDL request.
"""
# This is the primary data structure for processShipment requests.
self.RequestedShipment = self.client.f... | [
"This",
"is",
"the",
"data",
"that",
"will",
"be",
"used",
"to",
"create",
"your",
"shipment",
".",
"Create",
"the",
"data",
"structure",
"and",
"get",
"it",
"ready",
"for",
"the",
"WSDL",
"request",
"."
] | python-fedex-devs/python-fedex | python | https://github.com/python-fedex-devs/python-fedex/blob/7ea2ca80c362f5dbbc8d959ab47648c7a4ab24eb/fedex/services/ship_service.py#L44-L104 | [
"def",
"_prepare_wsdl_objects",
"(",
"self",
")",
":",
"# This is the primary data structure for processShipment requests.",
"self",
".",
"RequestedShipment",
"=",
"self",
".",
"client",
".",
"factory",
".",
"create",
"(",
"'RequestedShipment'",
")",
"self",
".",
"Reque... | 7ea2ca80c362f5dbbc8d959ab47648c7a4ab24eb |
train | FedexProcessShipmentRequest._assemble_and_send_validation_request | Fires off the Fedex shipment validation request.
@warning: NEVER CALL THIS METHOD DIRECTLY. CALL
send_validation_request(), WHICH RESIDES ON FedexBaseService
AND IS INHERITED. | fedex/services/ship_service.py | def _assemble_and_send_validation_request(self):
"""
Fires off the Fedex shipment validation request.
@warning: NEVER CALL THIS METHOD DIRECTLY. CALL
send_validation_request(), WHICH RESIDES ON FedexBaseService
AND IS INHERITED.
"""
# Fire off ... | def _assemble_and_send_validation_request(self):
"""
Fires off the Fedex shipment validation request.
@warning: NEVER CALL THIS METHOD DIRECTLY. CALL
send_validation_request(), WHICH RESIDES ON FedexBaseService
AND IS INHERITED.
"""
# Fire off ... | [
"Fires",
"off",
"the",
"Fedex",
"shipment",
"validation",
"request",
"."
] | python-fedex-devs/python-fedex | python | https://github.com/python-fedex-devs/python-fedex/blob/7ea2ca80c362f5dbbc8d959ab47648c7a4ab24eb/fedex/services/ship_service.py#L116-L131 | [
"def",
"_assemble_and_send_validation_request",
"(",
"self",
")",
":",
"# Fire off the query.",
"return",
"self",
".",
"client",
".",
"service",
".",
"validateShipment",
"(",
"WebAuthenticationDetail",
"=",
"self",
".",
"WebAuthenticationDetail",
",",
"ClientDetail",
"=... | 7ea2ca80c362f5dbbc8d959ab47648c7a4ab24eb |
train | FedexProcessShipmentRequest._assemble_and_send_request | Fires off the Fedex request.
@warning: NEVER CALL THIS METHOD DIRECTLY. CALL send_request(),
WHICH RESIDES ON FedexBaseService AND IS INHERITED. | fedex/services/ship_service.py | def _assemble_and_send_request(self):
"""
Fires off the Fedex request.
@warning: NEVER CALL THIS METHOD DIRECTLY. CALL send_request(),
WHICH RESIDES ON FedexBaseService AND IS INHERITED.
"""
# Fire off the query.
return self.client.service.processSh... | def _assemble_and_send_request(self):
"""
Fires off the Fedex request.
@warning: NEVER CALL THIS METHOD DIRECTLY. CALL send_request(),
WHICH RESIDES ON FedexBaseService AND IS INHERITED.
"""
# Fire off the query.
return self.client.service.processSh... | [
"Fires",
"off",
"the",
"Fedex",
"request",
"."
] | python-fedex-devs/python-fedex | python | https://github.com/python-fedex-devs/python-fedex/blob/7ea2ca80c362f5dbbc8d959ab47648c7a4ab24eb/fedex/services/ship_service.py#L133-L147 | [
"def",
"_assemble_and_send_request",
"(",
"self",
")",
":",
"# Fire off the query.",
"return",
"self",
".",
"client",
".",
"service",
".",
"processShipment",
"(",
"WebAuthenticationDetail",
"=",
"self",
".",
"WebAuthenticationDetail",
",",
"ClientDetail",
"=",
"self",... | 7ea2ca80c362f5dbbc8d959ab47648c7a4ab24eb |
train | FedexProcessShipmentRequest.add_package | Adds a package to the ship request.
@type package_item: WSDL object, type of RequestedPackageLineItem
WSDL object.
@keyword package_item: A RequestedPackageLineItem, created by
calling create_wsdl_object_of_type('RequestedPackageLineItem') on
this ShipmentRe... | fedex/services/ship_service.py | def add_package(self, package_item):
"""
Adds a package to the ship request.
@type package_item: WSDL object, type of RequestedPackageLineItem
WSDL object.
@keyword package_item: A RequestedPackageLineItem, created by
calling create_wsdl_object_of_type('... | def add_package(self, package_item):
"""
Adds a package to the ship request.
@type package_item: WSDL object, type of RequestedPackageLineItem
WSDL object.
@keyword package_item: A RequestedPackageLineItem, created by
calling create_wsdl_object_of_type('... | [
"Adds",
"a",
"package",
"to",
"the",
"ship",
"request",
"."
] | python-fedex-devs/python-fedex | python | https://github.com/python-fedex-devs/python-fedex/blob/7ea2ca80c362f5dbbc8d959ab47648c7a4ab24eb/fedex/services/ship_service.py#L149-L164 | [
"def",
"add_package",
"(",
"self",
",",
"package_item",
")",
":",
"self",
".",
"RequestedShipment",
".",
"RequestedPackageLineItems",
".",
"append",
"(",
"package_item",
")",
"package_weight",
"=",
"package_item",
".",
"Weight",
".",
"Value",
"self",
".",
"Reque... | 7ea2ca80c362f5dbbc8d959ab47648c7a4ab24eb |
train | FedexDeleteShipmentRequest._prepare_wsdl_objects | Preps the WSDL data structures for the user. | fedex/services/ship_service.py | def _prepare_wsdl_objects(self):
"""
Preps the WSDL data structures for the user.
"""
self.DeletionControlType = self.client.factory.create('DeletionControlType')
self.TrackingId = self.client.factory.create('TrackingId')
self.TrackingId.TrackingIdType = self.client.fact... | def _prepare_wsdl_objects(self):
"""
Preps the WSDL data structures for the user.
"""
self.DeletionControlType = self.client.factory.create('DeletionControlType')
self.TrackingId = self.client.factory.create('TrackingId')
self.TrackingId.TrackingIdType = self.client.fact... | [
"Preps",
"the",
"WSDL",
"data",
"structures",
"for",
"the",
"user",
"."
] | python-fedex-devs/python-fedex | python | https://github.com/python-fedex-devs/python-fedex/blob/7ea2ca80c362f5dbbc8d959ab47648c7a4ab24eb/fedex/services/ship_service.py#L191-L198 | [
"def",
"_prepare_wsdl_objects",
"(",
"self",
")",
":",
"self",
".",
"DeletionControlType",
"=",
"self",
".",
"client",
".",
"factory",
".",
"create",
"(",
"'DeletionControlType'",
")",
"self",
".",
"TrackingId",
"=",
"self",
".",
"client",
".",
"factory",
".... | 7ea2ca80c362f5dbbc8d959ab47648c7a4ab24eb |
train | FedexDeleteShipmentRequest._assemble_and_send_request | Fires off the Fedex request.
@warning: NEVER CALL THIS METHOD DIRECTLY. CALL send_request(), WHICH RESIDES
ON FedexBaseService AND IS INHERITED. | fedex/services/ship_service.py | def _assemble_and_send_request(self):
"""
Fires off the Fedex request.
@warning: NEVER CALL THIS METHOD DIRECTLY. CALL send_request(), WHICH RESIDES
ON FedexBaseService AND IS INHERITED.
"""
client = self.client
# Fire off the query.
return c... | def _assemble_and_send_request(self):
"""
Fires off the Fedex request.
@warning: NEVER CALL THIS METHOD DIRECTLY. CALL send_request(), WHICH RESIDES
ON FedexBaseService AND IS INHERITED.
"""
client = self.client
# Fire off the query.
return c... | [
"Fires",
"off",
"the",
"Fedex",
"request",
"."
] | python-fedex-devs/python-fedex | python | https://github.com/python-fedex-devs/python-fedex/blob/7ea2ca80c362f5dbbc8d959ab47648c7a4ab24eb/fedex/services/ship_service.py#L200-L217 | [
"def",
"_assemble_and_send_request",
"(",
"self",
")",
":",
"client",
"=",
"self",
".",
"client",
"# Fire off the query.",
"return",
"client",
".",
"service",
".",
"deleteShipment",
"(",
"WebAuthenticationDetail",
"=",
"self",
".",
"WebAuthenticationDetail",
",",
"C... | 7ea2ca80c362f5dbbc8d959ab47648c7a4ab24eb |
train | FedexDocumentServiceRequest._prepare_wsdl_objects | This is the data that will be used to create your shipment. Create
the data structure and get it ready for the WSDL request. | fedex/services/document_service.py | def _prepare_wsdl_objects(self):
"""
This is the data that will be used to create your shipment. Create
the data structure and get it ready for the WSDL request.
"""
self.UploadDocumentsRequest = self.client.factory.create('UploadDocumentsRequest')
... | def _prepare_wsdl_objects(self):
"""
This is the data that will be used to create your shipment. Create
the data structure and get it ready for the WSDL request.
"""
self.UploadDocumentsRequest = self.client.factory.create('UploadDocumentsRequest')
... | [
"This",
"is",
"the",
"data",
"that",
"will",
"be",
"used",
"to",
"create",
"your",
"shipment",
".",
"Create",
"the",
"data",
"structure",
"and",
"get",
"it",
"ready",
"for",
"the",
"WSDL",
"request",
"."
] | python-fedex-devs/python-fedex | python | https://github.com/python-fedex-devs/python-fedex/blob/7ea2ca80c362f5dbbc8d959ab47648c7a4ab24eb/fedex/services/document_service.py#L41-L52 | [
"def",
"_prepare_wsdl_objects",
"(",
"self",
")",
":",
"self",
".",
"UploadDocumentsRequest",
"=",
"self",
".",
"client",
".",
"factory",
".",
"create",
"(",
"'UploadDocumentsRequest'",
")",
"self",
".",
"OriginCountryCode",
"=",
"None",
"self",
".",
"Destinatio... | 7ea2ca80c362f5dbbc8d959ab47648c7a4ab24eb |
train | FedexDocumentServiceRequest._assemble_and_send_request | Fires off the Fedex request.
@warning: NEVER CALL THIS METHOD DIRECTLY. CALL send_request(),
WHICH RESIDES ON FedexBaseService AND IS INHERITED. | fedex/services/document_service.py | def _assemble_and_send_request(self):
"""
Fires off the Fedex request.
@warning: NEVER CALL THIS METHOD DIRECTLY. CALL send_request(),
WHICH RESIDES ON FedexBaseService AND IS INHERITED.
"""
# Fire off the query.
return self.clien... | def _assemble_and_send_request(self):
"""
Fires off the Fedex request.
@warning: NEVER CALL THIS METHOD DIRECTLY. CALL send_request(),
WHICH RESIDES ON FedexBaseService AND IS INHERITED.
"""
# Fire off the query.
return self.clien... | [
"Fires",
"off",
"the",
"Fedex",
"request",
"."
] | python-fedex-devs/python-fedex | python | https://github.com/python-fedex-devs/python-fedex/blob/7ea2ca80c362f5dbbc8d959ab47648c7a4ab24eb/fedex/services/document_service.py#L54-L72 | [
"def",
"_assemble_and_send_request",
"(",
"self",
")",
":",
"# Fire off the query.",
"return",
"self",
".",
"client",
".",
"service",
".",
"uploadDocuments",
"(",
"WebAuthenticationDetail",
"=",
"self",
".",
"WebAuthenticationDetail",
",",
"ClientDetail",
"=",
"self",... | 7ea2ca80c362f5dbbc8d959ab47648c7a4ab24eb |
train | FedexBaseService.__set_web_authentication_detail | Sets up the WebAuthenticationDetail node. This is required for all
requests. | fedex/base_service.py | def __set_web_authentication_detail(self):
"""
Sets up the WebAuthenticationDetail node. This is required for all
requests.
"""
# Start of the authentication stuff.
web_authentication_credential = self.client.factory.create('WebAuthenticationCredential')
web_auth... | def __set_web_authentication_detail(self):
"""
Sets up the WebAuthenticationDetail node. This is required for all
requests.
"""
# Start of the authentication stuff.
web_authentication_credential = self.client.factory.create('WebAuthenticationCredential')
web_auth... | [
"Sets",
"up",
"the",
"WebAuthenticationDetail",
"node",
".",
"This",
"is",
"required",
"for",
"all",
"requests",
"."
] | python-fedex-devs/python-fedex | python | https://github.com/python-fedex-devs/python-fedex/blob/7ea2ca80c362f5dbbc8d959ab47648c7a4ab24eb/fedex/base_service.py#L158-L177 | [
"def",
"__set_web_authentication_detail",
"(",
"self",
")",
":",
"# Start of the authentication stuff.",
"web_authentication_credential",
"=",
"self",
".",
"client",
".",
"factory",
".",
"create",
"(",
"'WebAuthenticationCredential'",
")",
"web_authentication_credential",
"."... | 7ea2ca80c362f5dbbc8d959ab47648c7a4ab24eb |
train | FedexBaseService.__set_client_detail | Sets up the ClientDetail node, which is required for all shipping
related requests. | fedex/base_service.py | def __set_client_detail(self, *args, **kwargs):
"""
Sets up the ClientDetail node, which is required for all shipping
related requests.
"""
client_detail = self.client.factory.create('ClientDetail')
client_detail.AccountNumber = self.config_obj.account_number
cli... | def __set_client_detail(self, *args, **kwargs):
"""
Sets up the ClientDetail node, which is required for all shipping
related requests.
"""
client_detail = self.client.factory.create('ClientDetail')
client_detail.AccountNumber = self.config_obj.account_number
cli... | [
"Sets",
"up",
"the",
"ClientDetail",
"node",
"which",
"is",
"required",
"for",
"all",
"shipping",
"related",
"requests",
"."
] | python-fedex-devs/python-fedex | python | https://github.com/python-fedex-devs/python-fedex/blob/7ea2ca80c362f5dbbc8d959ab47648c7a4ab24eb/fedex/base_service.py#L179-L206 | [
"def",
"__set_client_detail",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"client_detail",
"=",
"self",
".",
"client",
".",
"factory",
".",
"create",
"(",
"'ClientDetail'",
")",
"client_detail",
".",
"AccountNumber",
"=",
"self",
".",... | 7ea2ca80c362f5dbbc8d959ab47648c7a4ab24eb |
train | FedexBaseService.__set_transaction_detail | Checks kwargs for 'customer_transaction_id' and sets it if present. | fedex/base_service.py | def __set_transaction_detail(self, *args, **kwargs):
"""
Checks kwargs for 'customer_transaction_id' and sets it if present.
"""
customer_transaction_id = kwargs.get('customer_transaction_id', None)
if customer_transaction_id:
transaction_detail = self.client.factory... | def __set_transaction_detail(self, *args, **kwargs):
"""
Checks kwargs for 'customer_transaction_id' and sets it if present.
"""
customer_transaction_id = kwargs.get('customer_transaction_id', None)
if customer_transaction_id:
transaction_detail = self.client.factory... | [
"Checks",
"kwargs",
"for",
"customer_transaction_id",
"and",
"sets",
"it",
"if",
"present",
"."
] | python-fedex-devs/python-fedex | python | https://github.com/python-fedex-devs/python-fedex/blob/7ea2ca80c362f5dbbc8d959ab47648c7a4ab24eb/fedex/base_service.py#L208-L218 | [
"def",
"__set_transaction_detail",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"customer_transaction_id",
"=",
"kwargs",
".",
"get",
"(",
"'customer_transaction_id'",
",",
"None",
")",
"if",
"customer_transaction_id",
":",
"transaction_detail... | 7ea2ca80c362f5dbbc8d959ab47648c7a4ab24eb |
train | FedexBaseService.__set_version_id | Pulles the versioning info for the request from the child request. | fedex/base_service.py | def __set_version_id(self):
"""
Pulles the versioning info for the request from the child request.
"""
version_id = self.client.factory.create('VersionId')
version_id.ServiceId = self._version_info['service_id']
version_id.Major = self._version_info['major']
vers... | def __set_version_id(self):
"""
Pulles the versioning info for the request from the child request.
"""
version_id = self.client.factory.create('VersionId')
version_id.ServiceId = self._version_info['service_id']
version_id.Major = self._version_info['major']
vers... | [
"Pulles",
"the",
"versioning",
"info",
"for",
"the",
"request",
"from",
"the",
"child",
"request",
"."
] | python-fedex-devs/python-fedex | python | https://github.com/python-fedex-devs/python-fedex/blob/7ea2ca80c362f5dbbc8d959ab47648c7a4ab24eb/fedex/base_service.py#L220-L231 | [
"def",
"__set_version_id",
"(",
"self",
")",
":",
"version_id",
"=",
"self",
".",
"client",
".",
"factory",
".",
"create",
"(",
"'VersionId'",
")",
"version_id",
".",
"ServiceId",
"=",
"self",
".",
"_version_info",
"[",
"'service_id'",
"]",
"version_id",
"."... | 7ea2ca80c362f5dbbc8d959ab47648c7a4ab24eb |
train | FedexBaseService.__check_response_for_fedex_error | This checks the response for general Fedex errors that aren't related
to any one WSDL. | fedex/base_service.py | def __check_response_for_fedex_error(self):
"""
This checks the response for general Fedex errors that aren't related
to any one WSDL.
"""
if self.response.HighestSeverity == "FAILURE":
for notification in self.response.Notifications:
if notification.... | def __check_response_for_fedex_error(self):
"""
This checks the response for general Fedex errors that aren't related
to any one WSDL.
"""
if self.response.HighestSeverity == "FAILURE":
for notification in self.response.Notifications:
if notification.... | [
"This",
"checks",
"the",
"response",
"for",
"general",
"Fedex",
"errors",
"that",
"aren",
"t",
"related",
"to",
"any",
"one",
"WSDL",
"."
] | python-fedex-devs/python-fedex | python | https://github.com/python-fedex-devs/python-fedex/blob/7ea2ca80c362f5dbbc8d959ab47648c7a4ab24eb/fedex/base_service.py#L242-L252 | [
"def",
"__check_response_for_fedex_error",
"(",
"self",
")",
":",
"if",
"self",
".",
"response",
".",
"HighestSeverity",
"==",
"\"FAILURE\"",
":",
"for",
"notification",
"in",
"self",
".",
"response",
".",
"Notifications",
":",
"if",
"notification",
".",
"Severi... | 7ea2ca80c362f5dbbc8d959ab47648c7a4ab24eb |
train | FedexBaseService._check_response_for_request_errors | Override this in each service module to check for errors that are
specific to that module. For example, invalid tracking numbers in
a Tracking request. | fedex/base_service.py | def _check_response_for_request_errors(self):
"""
Override this in each service module to check for errors that are
specific to that module. For example, invalid tracking numbers in
a Tracking request.
"""
if self.response.HighestSeverity == "ERROR":
for noti... | def _check_response_for_request_errors(self):
"""
Override this in each service module to check for errors that are
specific to that module. For example, invalid tracking numbers in
a Tracking request.
"""
if self.response.HighestSeverity == "ERROR":
for noti... | [
"Override",
"this",
"in",
"each",
"service",
"module",
"to",
"check",
"for",
"errors",
"that",
"are",
"specific",
"to",
"that",
"module",
".",
"For",
"example",
"invalid",
"tracking",
"numbers",
"in",
"a",
"Tracking",
"request",
"."
] | python-fedex-devs/python-fedex | python | https://github.com/python-fedex-devs/python-fedex/blob/7ea2ca80c362f5dbbc8d959ab47648c7a4ab24eb/fedex/base_service.py#L254-L265 | [
"def",
"_check_response_for_request_errors",
"(",
"self",
")",
":",
"if",
"self",
".",
"response",
".",
"HighestSeverity",
"==",
"\"ERROR\"",
":",
"for",
"notification",
"in",
"self",
".",
"response",
".",
"Notifications",
":",
"if",
"notification",
".",
"Severi... | 7ea2ca80c362f5dbbc8d959ab47648c7a4ab24eb |
train | FedexBaseService._check_response_for_request_warnings | Override this in a service module to check for errors that are
specific to that module. For example, changing state/province based
on postal code in a Rate Service request. | fedex/base_service.py | def _check_response_for_request_warnings(self):
"""
Override this in a service module to check for errors that are
specific to that module. For example, changing state/province based
on postal code in a Rate Service request.
"""
if self.response.HighestSeverity in ("NOTE... | def _check_response_for_request_warnings(self):
"""
Override this in a service module to check for errors that are
specific to that module. For example, changing state/province based
on postal code in a Rate Service request.
"""
if self.response.HighestSeverity in ("NOTE... | [
"Override",
"this",
"in",
"a",
"service",
"module",
"to",
"check",
"for",
"errors",
"that",
"are",
"specific",
"to",
"that",
"module",
".",
"For",
"example",
"changing",
"state",
"/",
"province",
"based",
"on",
"postal",
"code",
"in",
"a",
"Rate",
"Service... | python-fedex-devs/python-fedex | python | https://github.com/python-fedex-devs/python-fedex/blob/7ea2ca80c362f5dbbc8d959ab47648c7a4ab24eb/fedex/base_service.py#L267-L278 | [
"def",
"_check_response_for_request_warnings",
"(",
"self",
")",
":",
"if",
"self",
".",
"response",
".",
"HighestSeverity",
"in",
"(",
"\"NOTE\"",
",",
"\"WARNING\"",
")",
":",
"for",
"notification",
"in",
"self",
".",
"response",
".",
"Notifications",
":",
"... | 7ea2ca80c362f5dbbc8d959ab47648c7a4ab24eb |
train | FedexBaseService.send_request | Sends the assembled request on the child object.
@type send_function: function reference
@keyword send_function: A function reference (passed without the
parenthesis) to a function that will send the request. This
allows for overriding the default function in cases such as
... | fedex/base_service.py | def send_request(self, send_function=None):
"""
Sends the assembled request on the child object.
@type send_function: function reference
@keyword send_function: A function reference (passed without the
parenthesis) to a function that will send the request. This
al... | def send_request(self, send_function=None):
"""
Sends the assembled request on the child object.
@type send_function: function reference
@keyword send_function: A function reference (passed without the
parenthesis) to a function that will send the request. This
al... | [
"Sends",
"the",
"assembled",
"request",
"on",
"the",
"child",
"object",
"."
] | python-fedex-devs/python-fedex | python | https://github.com/python-fedex-devs/python-fedex/blob/7ea2ca80c362f5dbbc8d959ab47648c7a4ab24eb/fedex/base_service.py#L299-L339 | [
"def",
"send_request",
"(",
"self",
",",
"send_function",
"=",
"None",
")",
":",
"# Send the request and get the response back.",
"try",
":",
"# If the user has overridden the send function, use theirs",
"# instead of the default.",
"if",
"send_function",
":",
"# Follow the overr... | 7ea2ca80c362f5dbbc8d959ab47648c7a4ab24eb |
train | FedexAddressValidationRequest._assemble_and_send_request | Fires off the Fedex request.
@warning: NEVER CALL THIS METHOD DIRECTLY. CALL send_request(),
WHICH RESIDES ON FedexBaseService AND IS INHERITED. | fedex/services/address_validation_service.py | def _assemble_and_send_request(self):
"""
Fires off the Fedex request.
@warning: NEVER CALL THIS METHOD DIRECTLY. CALL send_request(),
WHICH RESIDES ON FedexBaseService AND IS INHERITED.
"""
# We get an exception like this when specifying an IntegratorId:
... | def _assemble_and_send_request(self):
"""
Fires off the Fedex request.
@warning: NEVER CALL THIS METHOD DIRECTLY. CALL send_request(),
WHICH RESIDES ON FedexBaseService AND IS INHERITED.
"""
# We get an exception like this when specifying an IntegratorId:
... | [
"Fires",
"off",
"the",
"Fedex",
"request",
"."
] | python-fedex-devs/python-fedex | python | https://github.com/python-fedex-devs/python-fedex/blob/7ea2ca80c362f5dbbc8d959ab47648c7a4ab24eb/fedex/services/address_validation_service.py#L48-L71 | [
"def",
"_assemble_and_send_request",
"(",
"self",
")",
":",
"# We get an exception like this when specifying an IntegratorId:",
"# suds.TypeNotFound: Type not found: 'IntegratorId'",
"# Setting it to None does not seem to appease it.",
"del",
"self",
".",
"ClientDetail",
".",
"Integrator... | 7ea2ca80c362f5dbbc8d959ab47648c7a4ab24eb |
train | FedexTrackRequest._prepare_wsdl_objects | This sets the package identifier information. This may be a tracking
number or a few different things as per the Fedex spec. | fedex/services/track_service.py | def _prepare_wsdl_objects(self):
"""
This sets the package identifier information. This may be a tracking
number or a few different things as per the Fedex spec.
"""
self.SelectionDetails = self.client.factory.create('TrackSelectionDetail')
# Default to Fedex
se... | def _prepare_wsdl_objects(self):
"""
This sets the package identifier information. This may be a tracking
number or a few different things as per the Fedex spec.
"""
self.SelectionDetails = self.client.factory.create('TrackSelectionDetail')
# Default to Fedex
se... | [
"This",
"sets",
"the",
"package",
"identifier",
"information",
".",
"This",
"may",
"be",
"a",
"tracking",
"number",
"or",
"a",
"few",
"different",
"things",
"as",
"per",
"the",
"Fedex",
"spec",
"."
] | python-fedex-devs/python-fedex | python | https://github.com/python-fedex-devs/python-fedex/blob/7ea2ca80c362f5dbbc8d959ab47648c7a4ab24eb/fedex/services/track_service.py#L60-L76 | [
"def",
"_prepare_wsdl_objects",
"(",
"self",
")",
":",
"self",
".",
"SelectionDetails",
"=",
"self",
".",
"client",
".",
"factory",
".",
"create",
"(",
"'TrackSelectionDetail'",
")",
"# Default to Fedex",
"self",
".",
"SelectionDetails",
".",
"CarrierCode",
"=",
... | 7ea2ca80c362f5dbbc8d959ab47648c7a4ab24eb |
train | FedexTrackRequest._check_response_for_request_errors | Checks the response to see if there were any errors specific to
this WSDL. | fedex/services/track_service.py | def _check_response_for_request_errors(self):
"""
Checks the response to see if there were any errors specific to
this WSDL.
"""
if self.response.HighestSeverity == "ERROR": # pragma: no cover
for notification in self.response.Notifications:
if notifi... | def _check_response_for_request_errors(self):
"""
Checks the response to see if there were any errors specific to
this WSDL.
"""
if self.response.HighestSeverity == "ERROR": # pragma: no cover
for notification in self.response.Notifications:
if notifi... | [
"Checks",
"the",
"response",
"to",
"see",
"if",
"there",
"were",
"any",
"errors",
"specific",
"to",
"this",
"WSDL",
"."
] | python-fedex-devs/python-fedex | python | https://github.com/python-fedex-devs/python-fedex/blob/7ea2ca80c362f5dbbc8d959ab47648c7a4ab24eb/fedex/services/track_service.py#L78-L90 | [
"def",
"_check_response_for_request_errors",
"(",
"self",
")",
":",
"if",
"self",
".",
"response",
".",
"HighestSeverity",
"==",
"\"ERROR\"",
":",
"# pragma: no cover",
"for",
"notification",
"in",
"self",
".",
"response",
".",
"Notifications",
":",
"if",
"notific... | 7ea2ca80c362f5dbbc8d959ab47648c7a4ab24eb |
train | FedexTrackRequest._assemble_and_send_request | Fires off the Fedex request.
@warning: NEVER CALL THIS METHOD DIRECTLY. CALL send_request(), WHICH RESIDES
ON FedexBaseService AND IS INHERITED. | fedex/services/track_service.py | def _assemble_and_send_request(self):
"""
Fires off the Fedex request.
@warning: NEVER CALL THIS METHOD DIRECTLY. CALL send_request(), WHICH RESIDES
ON FedexBaseService AND IS INHERITED.
"""
client = self.client
# Fire off the query.
return c... | def _assemble_and_send_request(self):
"""
Fires off the Fedex request.
@warning: NEVER CALL THIS METHOD DIRECTLY. CALL send_request(), WHICH RESIDES
ON FedexBaseService AND IS INHERITED.
"""
client = self.client
# Fire off the query.
return c... | [
"Fires",
"off",
"the",
"Fedex",
"request",
"."
] | python-fedex-devs/python-fedex | python | https://github.com/python-fedex-devs/python-fedex/blob/7ea2ca80c362f5dbbc8d959ab47648c7a4ab24eb/fedex/services/track_service.py#L92-L108 | [
"def",
"_assemble_and_send_request",
"(",
"self",
")",
":",
"client",
"=",
"self",
".",
"client",
"# Fire off the query.",
"return",
"client",
".",
"service",
".",
"track",
"(",
"WebAuthenticationDetail",
"=",
"self",
".",
"WebAuthenticationDetail",
",",
"ClientDeta... | 7ea2ca80c362f5dbbc8d959ab47648c7a4ab24eb |
train | FedexRateServiceRequest._prepare_wsdl_objects | This is the data that will be used to create your shipment. Create
the data structure and get it ready for the WSDL request. | fedex/services/rate_service.py | def _prepare_wsdl_objects(self):
"""
This is the data that will be used to create your shipment. Create
the data structure and get it ready for the WSDL request.
"""
# Default behavior is to not request transit information
self.ReturnTransitAndCommit = False
# T... | def _prepare_wsdl_objects(self):
"""
This is the data that will be used to create your shipment. Create
the data structure and get it ready for the WSDL request.
"""
# Default behavior is to not request transit information
self.ReturnTransitAndCommit = False
# T... | [
"This",
"is",
"the",
"data",
"that",
"will",
"be",
"used",
"to",
"create",
"your",
"shipment",
".",
"Create",
"the",
"data",
"structure",
"and",
"get",
"it",
"ready",
"for",
"the",
"WSDL",
"request",
"."
] | python-fedex-devs/python-fedex | python | https://github.com/python-fedex-devs/python-fedex/blob/7ea2ca80c362f5dbbc8d959ab47648c7a4ab24eb/fedex/services/rate_service.py#L43-L91 | [
"def",
"_prepare_wsdl_objects",
"(",
"self",
")",
":",
"# Default behavior is to not request transit information",
"self",
".",
"ReturnTransitAndCommit",
"=",
"False",
"# This is the primary data structure for processShipment requests.",
"self",
".",
"RequestedShipment",
"=",
"self... | 7ea2ca80c362f5dbbc8d959ab47648c7a4ab24eb |
train | FedexRateServiceRequest._assemble_and_send_request | Fires off the Fedex request.
@warning: NEVER CALL THIS METHOD DIRECTLY. CALL send_request(),
WHICH RESIDES ON FedexBaseService AND IS INHERITED. | fedex/services/rate_service.py | def _assemble_and_send_request(self):
"""
Fires off the Fedex request.
@warning: NEVER CALL THIS METHOD DIRECTLY. CALL send_request(),
WHICH RESIDES ON FedexBaseService AND IS INHERITED.
"""
# Fire off the query.
return self.client.service.getRates(... | def _assemble_and_send_request(self):
"""
Fires off the Fedex request.
@warning: NEVER CALL THIS METHOD DIRECTLY. CALL send_request(),
WHICH RESIDES ON FedexBaseService AND IS INHERITED.
"""
# Fire off the query.
return self.client.service.getRates(... | [
"Fires",
"off",
"the",
"Fedex",
"request",
"."
] | python-fedex-devs/python-fedex | python | https://github.com/python-fedex-devs/python-fedex/blob/7ea2ca80c362f5dbbc8d959ab47648c7a4ab24eb/fedex/services/rate_service.py#L93-L108 | [
"def",
"_assemble_and_send_request",
"(",
"self",
")",
":",
"# Fire off the query.",
"return",
"self",
".",
"client",
".",
"service",
".",
"getRates",
"(",
"WebAuthenticationDetail",
"=",
"self",
".",
"WebAuthenticationDetail",
",",
"ClientDetail",
"=",
"self",
".",... | 7ea2ca80c362f5dbbc8d959ab47648c7a4ab24eb |
train | DirectDevicePrinter.print_label | Prints all of a shipment's labels, or optionally just one.
@type package_num: L{int}
@param package_num: 0-based index of the package to print. This is
only useful for shipments with more than one package. | fedex/printers/unix.py | def print_label(self, package_num=None):
"""
Prints all of a shipment's labels, or optionally just one.
@type package_num: L{int}
@param package_num: 0-based index of the package to print. This is
only useful for shipments with more than one package.
... | def print_label(self, package_num=None):
"""
Prints all of a shipment's labels, or optionally just one.
@type package_num: L{int}
@param package_num: 0-based index of the package to print. This is
only useful for shipments with more than one package.
... | [
"Prints",
"all",
"of",
"a",
"shipment",
"s",
"labels",
"or",
"optionally",
"just",
"one",
"."
] | python-fedex-devs/python-fedex | python | https://github.com/python-fedex-devs/python-fedex/blob/7ea2ca80c362f5dbbc8d959ab47648c7a4ab24eb/fedex/printers/unix.py#L31-L49 | [
"def",
"print_label",
"(",
"self",
",",
"package_num",
"=",
"None",
")",
":",
"if",
"package_num",
":",
"packages",
"=",
"[",
"self",
".",
"shipment",
".",
"response",
".",
"CompletedShipmentDetail",
".",
"CompletedPackageDetails",
"[",
"package_num",
"]",
"]"... | 7ea2ca80c362f5dbbc8d959ab47648c7a4ab24eb |
train | DirectDevicePrinter._print_base64 | Pipe the binary directly to the label printer. Works under Linux
without requiring PySerial. This is not typically something you
should call directly, unless you have special needs.
@type base64_data: L{str}
@param base64_data: The base64 encoded string for the label to print. | fedex/printers/unix.py | def _print_base64(self, base64_data):
"""
Pipe the binary directly to the label printer. Works under Linux
without requiring PySerial. This is not typically something you
should call directly, unless you have special needs.
@type base64_data: L{str}
@param base64... | def _print_base64(self, base64_data):
"""
Pipe the binary directly to the label printer. Works under Linux
without requiring PySerial. This is not typically something you
should call directly, unless you have special needs.
@type base64_data: L{str}
@param base64... | [
"Pipe",
"the",
"binary",
"directly",
"to",
"the",
"label",
"printer",
".",
"Works",
"under",
"Linux",
"without",
"requiring",
"PySerial",
".",
"This",
"is",
"not",
"typically",
"something",
"you",
"should",
"call",
"directly",
"unless",
"you",
"have",
"special... | python-fedex-devs/python-fedex | python | https://github.com/python-fedex-devs/python-fedex/blob/7ea2ca80c362f5dbbc8d959ab47648c7a4ab24eb/fedex/printers/unix.py#L51-L63 | [
"def",
"_print_base64",
"(",
"self",
",",
"base64_data",
")",
":",
"label_file",
"=",
"open",
"(",
"self",
".",
"device",
",",
"\"w\"",
")",
"label_file",
".",
"write",
"(",
"base64_data",
")",
"label_file",
".",
"close",
"(",
")"
] | 7ea2ca80c362f5dbbc8d959ab47648c7a4ab24eb |
train | FedexSearchLocationRequest._prepare_wsdl_objects | Create the data structure and get it ready for the WSDL request. | fedex/services/location_service.py | def _prepare_wsdl_objects(self):
"""
Create the data structure and get it ready for the WSDL request.
"""
# Service defaults for objects that are required.
self.MultipleMatchesAction = 'RETURN_ALL'
self.Constraints = self.create_wsdl_object_of_type('SearchLocationConstra... | def _prepare_wsdl_objects(self):
"""
Create the data structure and get it ready for the WSDL request.
"""
# Service defaults for objects that are required.
self.MultipleMatchesAction = 'RETURN_ALL'
self.Constraints = self.create_wsdl_object_of_type('SearchLocationConstra... | [
"Create",
"the",
"data",
"structure",
"and",
"get",
"it",
"ready",
"for",
"the",
"WSDL",
"request",
"."
] | python-fedex-devs/python-fedex | python | https://github.com/python-fedex-devs/python-fedex/blob/7ea2ca80c362f5dbbc8d959ab47648c7a4ab24eb/fedex/services/location_service.py#L58-L68 | [
"def",
"_prepare_wsdl_objects",
"(",
"self",
")",
":",
"# Service defaults for objects that are required.",
"self",
".",
"MultipleMatchesAction",
"=",
"'RETURN_ALL'",
"self",
".",
"Constraints",
"=",
"self",
".",
"create_wsdl_object_of_type",
"(",
"'SearchLocationConstraints'... | 7ea2ca80c362f5dbbc8d959ab47648c7a4ab24eb |
train | FedexSearchLocationRequest._assemble_and_send_request | Fires off the Fedex request.
@warning: NEVER CALL THIS METHOD DIRECTLY. CALL send_request(),
WHICH RESIDES ON FedexBaseService AND IS INHERITED. | fedex/services/location_service.py | def _assemble_and_send_request(self):
"""
Fires off the Fedex request.
@warning: NEVER CALL THIS METHOD DIRECTLY. CALL send_request(),
WHICH RESIDES ON FedexBaseService AND IS INHERITED.
"""
# We get an exception like this when specifying an IntegratorId:
... | def _assemble_and_send_request(self):
"""
Fires off the Fedex request.
@warning: NEVER CALL THIS METHOD DIRECTLY. CALL send_request(),
WHICH RESIDES ON FedexBaseService AND IS INHERITED.
"""
# We get an exception like this when specifying an IntegratorId:
... | [
"Fires",
"off",
"the",
"Fedex",
"request",
"."
] | python-fedex-devs/python-fedex | python | https://github.com/python-fedex-devs/python-fedex/blob/7ea2ca80c362f5dbbc8d959ab47648c7a4ab24eb/fedex/services/location_service.py#L70-L97 | [
"def",
"_assemble_and_send_request",
"(",
"self",
")",
":",
"# We get an exception like this when specifying an IntegratorId:",
"# suds.TypeNotFound: Type not found: 'IntegratorId'",
"# Setting it to None does not seem to appease it.",
"del",
"self",
".",
"ClientDetail",
".",
"Integrator... | 7ea2ca80c362f5dbbc8d959ab47648c7a4ab24eb |
train | PostalCodeInquiryRequest._check_response_for_request_errors | Checks the response to see if there were any errors specific to
this WSDL. | fedex/services/package_movement.py | def _check_response_for_request_errors(self):
"""
Checks the response to see if there were any errors specific to
this WSDL.
"""
if self.response.HighestSeverity == "ERROR":
for notification in self.response.Notifications: # pragma: no cover
if notifi... | def _check_response_for_request_errors(self):
"""
Checks the response to see if there were any errors specific to
this WSDL.
"""
if self.response.HighestSeverity == "ERROR":
for notification in self.response.Notifications: # pragma: no cover
if notifi... | [
"Checks",
"the",
"response",
"to",
"see",
"if",
"there",
"were",
"any",
"errors",
"specific",
"to",
"this",
"WSDL",
"."
] | python-fedex-devs/python-fedex | python | https://github.com/python-fedex-devs/python-fedex/blob/7ea2ca80c362f5dbbc8d959ab47648c7a4ab24eb/fedex/services/package_movement.py#L66-L83 | [
"def",
"_check_response_for_request_errors",
"(",
"self",
")",
":",
"if",
"self",
".",
"response",
".",
"HighestSeverity",
"==",
"\"ERROR\"",
":",
"for",
"notification",
"in",
"self",
".",
"response",
".",
"Notifications",
":",
"# pragma: no cover",
"if",
"notific... | 7ea2ca80c362f5dbbc8d959ab47648c7a4ab24eb |
train | PostalCodeInquiryRequest._assemble_and_send_request | Fires off the Fedex request.
@warning: NEVER CALL THIS METHOD DIRECTLY. CALL send_request(), WHICH RESIDES
ON FedexBaseService AND IS INHERITED. | fedex/services/package_movement.py | def _assemble_and_send_request(self):
"""
Fires off the Fedex request.
@warning: NEVER CALL THIS METHOD DIRECTLY. CALL send_request(), WHICH RESIDES
ON FedexBaseService AND IS INHERITED.
"""
client = self.client
# We get an exception like this when ... | def _assemble_and_send_request(self):
"""
Fires off the Fedex request.
@warning: NEVER CALL THIS METHOD DIRECTLY. CALL send_request(), WHICH RESIDES
ON FedexBaseService AND IS INHERITED.
"""
client = self.client
# We get an exception like this when ... | [
"Fires",
"off",
"the",
"Fedex",
"request",
"."
] | python-fedex-devs/python-fedex | python | https://github.com/python-fedex-devs/python-fedex/blob/7ea2ca80c362f5dbbc8d959ab47648c7a4ab24eb/fedex/services/package_movement.py#L92-L117 | [
"def",
"_assemble_and_send_request",
"(",
"self",
")",
":",
"client",
"=",
"self",
".",
"client",
"# We get an exception like this when specifying an IntegratorId:",
"# suds.TypeNotFound: Type not found: 'IntegratorId'",
"# Setting it to None does not seem to appease it.",
"del",
"self... | 7ea2ca80c362f5dbbc8d959ab47648c7a4ab24eb |
train | FedexAvailabilityCommitmentRequest._prepare_wsdl_objects | Create the data structure and get it ready for the WSDL request. | fedex/services/availability_commitment_service.py | def _prepare_wsdl_objects(self):
"""
Create the data structure and get it ready for the WSDL request.
"""
self.CarrierCode = 'FDXE'
self.Origin = self.client.factory.create('Address')
self.Destination = self.client.factory.create('Address')
self.ShipDate = datetim... | def _prepare_wsdl_objects(self):
"""
Create the data structure and get it ready for the WSDL request.
"""
self.CarrierCode = 'FDXE'
self.Origin = self.client.factory.create('Address')
self.Destination = self.client.factory.create('Address')
self.ShipDate = datetim... | [
"Create",
"the",
"data",
"structure",
"and",
"get",
"it",
"ready",
"for",
"the",
"WSDL",
"request",
"."
] | python-fedex-devs/python-fedex | python | https://github.com/python-fedex-devs/python-fedex/blob/7ea2ca80c362f5dbbc8d959ab47648c7a4ab24eb/fedex/services/availability_commitment_service.py#L63-L72 | [
"def",
"_prepare_wsdl_objects",
"(",
"self",
")",
":",
"self",
".",
"CarrierCode",
"=",
"'FDXE'",
"self",
".",
"Origin",
"=",
"self",
".",
"client",
".",
"factory",
".",
"create",
"(",
"'Address'",
")",
"self",
".",
"Destination",
"=",
"self",
".",
"clie... | 7ea2ca80c362f5dbbc8d959ab47648c7a4ab24eb |
train | FedexAvailabilityCommitmentRequest._assemble_and_send_request | Fires off the Fedex request.
@warning: NEVER CALL THIS METHOD DIRECTLY. CALL send_request(),
WHICH RESIDES ON FedexBaseService AND IS INHERITED. | fedex/services/availability_commitment_service.py | def _assemble_and_send_request(self):
"""
Fires off the Fedex request.
@warning: NEVER CALL THIS METHOD DIRECTLY. CALL send_request(),
WHICH RESIDES ON FedexBaseService AND IS INHERITED.
"""
# We get an exception like this when specifying an IntegratorId:
... | def _assemble_and_send_request(self):
"""
Fires off the Fedex request.
@warning: NEVER CALL THIS METHOD DIRECTLY. CALL send_request(),
WHICH RESIDES ON FedexBaseService AND IS INHERITED.
"""
# We get an exception like this when specifying an IntegratorId:
... | [
"Fires",
"off",
"the",
"Fedex",
"request",
"."
] | python-fedex-devs/python-fedex | python | https://github.com/python-fedex-devs/python-fedex/blob/7ea2ca80c362f5dbbc8d959ab47648c7a4ab24eb/fedex/services/availability_commitment_service.py#L74-L101 | [
"def",
"_assemble_and_send_request",
"(",
"self",
")",
":",
"# We get an exception like this when specifying an IntegratorId:",
"# suds.TypeNotFound: Type not found: 'IntegratorId'",
"# Setting it to None does not seem to appease it.",
"del",
"self",
".",
"ClientDetail",
".",
"Integrator... | 7ea2ca80c362f5dbbc8d959ab47648c7a4ab24eb |
train | basic_sobject_to_dict | Converts suds object to dict very quickly.
Does not serialize date time or normalize key case.
:param obj: suds object
:return: dict object | fedex/tools/conversion.py | def basic_sobject_to_dict(obj):
"""Converts suds object to dict very quickly.
Does not serialize date time or normalize key case.
:param obj: suds object
:return: dict object
"""
if not hasattr(obj, '__keylist__'):
return obj
data = {}
fields = obj.__keylist__
for field in fi... | def basic_sobject_to_dict(obj):
"""Converts suds object to dict very quickly.
Does not serialize date time or normalize key case.
:param obj: suds object
:return: dict object
"""
if not hasattr(obj, '__keylist__'):
return obj
data = {}
fields = obj.__keylist__
for field in fi... | [
"Converts",
"suds",
"object",
"to",
"dict",
"very",
"quickly",
".",
"Does",
"not",
"serialize",
"date",
"time",
"or",
"normalize",
"key",
"case",
".",
":",
"param",
"obj",
":",
"suds",
"object",
":",
"return",
":",
"dict",
"object"
] | python-fedex-devs/python-fedex | python | https://github.com/python-fedex-devs/python-fedex/blob/7ea2ca80c362f5dbbc8d959ab47648c7a4ab24eb/fedex/tools/conversion.py#L33-L51 | [
"def",
"basic_sobject_to_dict",
"(",
"obj",
")",
":",
"if",
"not",
"hasattr",
"(",
"obj",
",",
"'__keylist__'",
")",
":",
"return",
"obj",
"data",
"=",
"{",
"}",
"fields",
"=",
"obj",
".",
"__keylist__",
"for",
"field",
"in",
"fields",
":",
"val",
"=",... | 7ea2ca80c362f5dbbc8d959ab47648c7a4ab24eb |
train | sobject_to_dict | Converts a suds object to a dict. Includes advanced features.
:param json_serialize: If set, changes date and time types to iso string.
:param key_to_lower: If set, changes index key name to lower case.
:param obj: suds object
:return: dict object | fedex/tools/conversion.py | def sobject_to_dict(obj, key_to_lower=False, json_serialize=False):
"""
Converts a suds object to a dict. Includes advanced features.
:param json_serialize: If set, changes date and time types to iso string.
:param key_to_lower: If set, changes index key name to lower case.
:param obj: suds object
... | def sobject_to_dict(obj, key_to_lower=False, json_serialize=False):
"""
Converts a suds object to a dict. Includes advanced features.
:param json_serialize: If set, changes date and time types to iso string.
:param key_to_lower: If set, changes index key name to lower case.
:param obj: suds object
... | [
"Converts",
"a",
"suds",
"object",
"to",
"a",
"dict",
".",
"Includes",
"advanced",
"features",
".",
":",
"param",
"json_serialize",
":",
"If",
"set",
"changes",
"date",
"and",
"time",
"types",
"to",
"iso",
"string",
".",
":",
"param",
"key_to_lower",
":",
... | python-fedex-devs/python-fedex | python | https://github.com/python-fedex-devs/python-fedex/blob/7ea2ca80c362f5dbbc8d959ab47648c7a4ab24eb/fedex/tools/conversion.py#L54-L81 | [
"def",
"sobject_to_dict",
"(",
"obj",
",",
"key_to_lower",
"=",
"False",
",",
"json_serialize",
"=",
"False",
")",
":",
"import",
"datetime",
"if",
"not",
"hasattr",
"(",
"obj",
",",
"'__keylist__'",
")",
":",
"if",
"json_serialize",
"and",
"isinstance",
"("... | 7ea2ca80c362f5dbbc8d959ab47648c7a4ab24eb |
train | sobject_to_json | Converts a suds object to a JSON string.
:param obj: suds object
:param key_to_lower: If set, changes index key name to lower case.
:return: json object | fedex/tools/conversion.py | def sobject_to_json(obj, key_to_lower=False):
"""
Converts a suds object to a JSON string.
:param obj: suds object
:param key_to_lower: If set, changes index key name to lower case.
:return: json object
"""
import json
data = sobject_to_dict(obj, key_to_lower=key_to_lower, json_serialize... | def sobject_to_json(obj, key_to_lower=False):
"""
Converts a suds object to a JSON string.
:param obj: suds object
:param key_to_lower: If set, changes index key name to lower case.
:return: json object
"""
import json
data = sobject_to_dict(obj, key_to_lower=key_to_lower, json_serialize... | [
"Converts",
"a",
"suds",
"object",
"to",
"a",
"JSON",
"string",
".",
":",
"param",
"obj",
":",
"suds",
"object",
":",
"param",
"key_to_lower",
":",
"If",
"set",
"changes",
"index",
"key",
"name",
"to",
"lower",
"case",
".",
":",
"return",
":",
"json",
... | python-fedex-devs/python-fedex | python | https://github.com/python-fedex-devs/python-fedex/blob/7ea2ca80c362f5dbbc8d959ab47648c7a4ab24eb/fedex/tools/conversion.py#L84-L93 | [
"def",
"sobject_to_json",
"(",
"obj",
",",
"key_to_lower",
"=",
"False",
")",
":",
"import",
"json",
"data",
"=",
"sobject_to_dict",
"(",
"obj",
",",
"key_to_lower",
"=",
"key_to_lower",
",",
"json_serialize",
"=",
"True",
")",
"return",
"json",
".",
"dumps"... | 7ea2ca80c362f5dbbc8d959ab47648c7a4ab24eb |
train | FedexValidatePostalRequest._prepare_wsdl_objects | Create the data structure and get it ready for the WSDL request. | fedex/services/country_service.py | def _prepare_wsdl_objects(self):
"""
Create the data structure and get it ready for the WSDL request.
"""
self.CarrierCode = 'FDXE'
self.RoutingCode = 'FDSD'
self.Address = self.client.factory.create('Address')
self.ShipDateTime = datetime.datetime.now().isoformat... | def _prepare_wsdl_objects(self):
"""
Create the data structure and get it ready for the WSDL request.
"""
self.CarrierCode = 'FDXE'
self.RoutingCode = 'FDSD'
self.Address = self.client.factory.create('Address')
self.ShipDateTime = datetime.datetime.now().isoformat... | [
"Create",
"the",
"data",
"structure",
"and",
"get",
"it",
"ready",
"for",
"the",
"WSDL",
"request",
"."
] | python-fedex-devs/python-fedex | python | https://github.com/python-fedex-devs/python-fedex/blob/7ea2ca80c362f5dbbc8d959ab47648c7a4ab24eb/fedex/services/country_service.py#L53-L60 | [
"def",
"_prepare_wsdl_objects",
"(",
"self",
")",
":",
"self",
".",
"CarrierCode",
"=",
"'FDXE'",
"self",
".",
"RoutingCode",
"=",
"'FDSD'",
"self",
".",
"Address",
"=",
"self",
".",
"client",
".",
"factory",
".",
"create",
"(",
"'Address'",
")",
"self",
... | 7ea2ca80c362f5dbbc8d959ab47648c7a4ab24eb |
train | FedexValidatePostalRequest._assemble_and_send_request | Fires off the Fedex request.
@warning: NEVER CALL THIS METHOD DIRECTLY. CALL send_request(),
WHICH RESIDES ON FedexBaseService AND IS INHERITED. | fedex/services/country_service.py | def _assemble_and_send_request(self):
"""
Fires off the Fedex request.
@warning: NEVER CALL THIS METHOD DIRECTLY. CALL send_request(),
WHICH RESIDES ON FedexBaseService AND IS INHERITED.
"""
# We get an exception like this when specifying an IntegratorId:
... | def _assemble_and_send_request(self):
"""
Fires off the Fedex request.
@warning: NEVER CALL THIS METHOD DIRECTLY. CALL send_request(),
WHICH RESIDES ON FedexBaseService AND IS INHERITED.
"""
# We get an exception like this when specifying an IntegratorId:
... | [
"Fires",
"off",
"the",
"Fedex",
"request",
"."
] | python-fedex-devs/python-fedex | python | https://github.com/python-fedex-devs/python-fedex/blob/7ea2ca80c362f5dbbc8d959ab47648c7a4ab24eb/fedex/services/country_service.py#L62-L88 | [
"def",
"_assemble_and_send_request",
"(",
"self",
")",
":",
"# We get an exception like this when specifying an IntegratorId:",
"# suds.TypeNotFound: Type not found: 'IntegratorId'",
"# Setting it to None does not seem to appease it.",
"del",
"self",
".",
"ClientDetail",
".",
"Integrator... | 7ea2ca80c362f5dbbc8d959ab47648c7a4ab24eb |
train | guess_tags | Function to get potential tags for files using the file names.
:param filename: This field is the name of file. | ohapi/utils_fs.py | def guess_tags(filename):
"""
Function to get potential tags for files using the file names.
:param filename: This field is the name of file.
"""
tags = []
stripped_filename = strip_zip_suffix(filename)
if stripped_filename.endswith('.vcf'):
tags.append('vcf')
if stripped_filena... | def guess_tags(filename):
"""
Function to get potential tags for files using the file names.
:param filename: This field is the name of file.
"""
tags = []
stripped_filename = strip_zip_suffix(filename)
if stripped_filename.endswith('.vcf'):
tags.append('vcf')
if stripped_filena... | [
"Function",
"to",
"get",
"potential",
"tags",
"for",
"files",
"using",
"the",
"file",
"names",
"."
] | OpenHumans/open-humans-api | python | https://github.com/OpenHumans/open-humans-api/blob/ca2a28cf5d55cfdae13dd222ba58c25565bdb86e/ohapi/utils_fs.py#L33-L47 | [
"def",
"guess_tags",
"(",
"filename",
")",
":",
"tags",
"=",
"[",
"]",
"stripped_filename",
"=",
"strip_zip_suffix",
"(",
"filename",
")",
"if",
"stripped_filename",
".",
"endswith",
"(",
"'.vcf'",
")",
":",
"tags",
".",
"append",
"(",
"'vcf'",
")",
"if",
... | ca2a28cf5d55cfdae13dd222ba58c25565bdb86e |
train | characterize_local_files | Collate local file info as preperation for Open Humans upload.
Note: Files with filesize > max_bytes are not included in returned info.
:param filedir: This field is target directory to get files from.
:param max_bytes: This field is the maximum file size to consider. Its
default value is 128m. | ohapi/utils_fs.py | def characterize_local_files(filedir, max_bytes=MAX_FILE_DEFAULT):
"""
Collate local file info as preperation for Open Humans upload.
Note: Files with filesize > max_bytes are not included in returned info.
:param filedir: This field is target directory to get files from.
:param max_bytes: This fi... | def characterize_local_files(filedir, max_bytes=MAX_FILE_DEFAULT):
"""
Collate local file info as preperation for Open Humans upload.
Note: Files with filesize > max_bytes are not included in returned info.
:param filedir: This field is target directory to get files from.
:param max_bytes: This fi... | [
"Collate",
"local",
"file",
"info",
"as",
"preperation",
"for",
"Open",
"Humans",
"upload",
"."
] | OpenHumans/open-humans-api | python | https://github.com/OpenHumans/open-humans-api/blob/ca2a28cf5d55cfdae13dd222ba58c25565bdb86e/ohapi/utils_fs.py#L50-L79 | [
"def",
"characterize_local_files",
"(",
"filedir",
",",
"max_bytes",
"=",
"MAX_FILE_DEFAULT",
")",
":",
"file_data",
"=",
"{",
"}",
"logging",
".",
"info",
"(",
"'Characterizing files in {}'",
".",
"format",
"(",
"filedir",
")",
")",
"for",
"filename",
"in",
"... | ca2a28cf5d55cfdae13dd222ba58c25565bdb86e |
train | validate_metadata | Check that the files listed in metadata exactly match files in target dir.
:param target_dir: This field is the target directory from which to
match metadata
:param metadata: This field contains the metadata to be matched. | ohapi/utils_fs.py | def validate_metadata(target_dir, metadata):
"""
Check that the files listed in metadata exactly match files in target dir.
:param target_dir: This field is the target directory from which to
match metadata
:param metadata: This field contains the metadata to be matched.
"""
if not os.p... | def validate_metadata(target_dir, metadata):
"""
Check that the files listed in metadata exactly match files in target dir.
:param target_dir: This field is the target directory from which to
match metadata
:param metadata: This field contains the metadata to be matched.
"""
if not os.p... | [
"Check",
"that",
"the",
"files",
"listed",
"in",
"metadata",
"exactly",
"match",
"files",
"in",
"target",
"dir",
"."
] | OpenHumans/open-humans-api | python | https://github.com/OpenHumans/open-humans-api/blob/ca2a28cf5d55cfdae13dd222ba58c25565bdb86e/ohapi/utils_fs.py#L82-L104 | [
"def",
"validate_metadata",
"(",
"target_dir",
",",
"metadata",
")",
":",
"if",
"not",
"os",
".",
"path",
".",
"isdir",
"(",
"target_dir",
")",
":",
"print",
"(",
"\"Error: \"",
"+",
"target_dir",
"+",
"\" is not a directory\"",
")",
"return",
"False",
"file... | ca2a28cf5d55cfdae13dd222ba58c25565bdb86e |
train | load_metadata_csv_single_user | Return the metadata as requested for a single user.
:param csv_in: This field is the csv file to return metadata from.
:param header: This field contains the headers in the csv file
:param tags_idx: This field contains the index of the tags in the csv
file. | ohapi/utils_fs.py | def load_metadata_csv_single_user(csv_in, header, tags_idx):
"""
Return the metadata as requested for a single user.
:param csv_in: This field is the csv file to return metadata from.
:param header: This field contains the headers in the csv file
:param tags_idx: This field contains the index of th... | def load_metadata_csv_single_user(csv_in, header, tags_idx):
"""
Return the metadata as requested for a single user.
:param csv_in: This field is the csv file to return metadata from.
:param header: This field contains the headers in the csv file
:param tags_idx: This field contains the index of th... | [
"Return",
"the",
"metadata",
"as",
"requested",
"for",
"a",
"single",
"user",
"."
] | OpenHumans/open-humans-api | python | https://github.com/OpenHumans/open-humans-api/blob/ca2a28cf5d55cfdae13dd222ba58c25565bdb86e/ohapi/utils_fs.py#L107-L136 | [
"def",
"load_metadata_csv_single_user",
"(",
"csv_in",
",",
"header",
",",
"tags_idx",
")",
":",
"metadata",
"=",
"{",
"}",
"n_headers",
"=",
"len",
"(",
"header",
")",
"for",
"index",
",",
"row",
"in",
"enumerate",
"(",
"csv_in",
",",
"2",
")",
":",
"... | ca2a28cf5d55cfdae13dd222ba58c25565bdb86e |
train | load_metadata_csv | Return dict of metadata.
Format is either dict (filenames are keys) or dict-of-dicts (project member
IDs as top level keys, then filenames as keys).
:param input_filepath: This field is the filepath of the csv file. | ohapi/utils_fs.py | def load_metadata_csv(input_filepath):
"""
Return dict of metadata.
Format is either dict (filenames are keys) or dict-of-dicts (project member
IDs as top level keys, then filenames as keys).
:param input_filepath: This field is the filepath of the csv file.
"""
with open(input_filepath) a... | def load_metadata_csv(input_filepath):
"""
Return dict of metadata.
Format is either dict (filenames are keys) or dict-of-dicts (project member
IDs as top level keys, then filenames as keys).
:param input_filepath: This field is the filepath of the csv file.
"""
with open(input_filepath) a... | [
"Return",
"dict",
"of",
"metadata",
"."
] | OpenHumans/open-humans-api | python | https://github.com/OpenHumans/open-humans-api/blob/ca2a28cf5d55cfdae13dd222ba58c25565bdb86e/ohapi/utils_fs.py#L176-L206 | [
"def",
"load_metadata_csv",
"(",
"input_filepath",
")",
":",
"with",
"open",
"(",
"input_filepath",
")",
"as",
"f",
":",
"csv_in",
"=",
"csv",
".",
"reader",
"(",
"f",
")",
"header",
"=",
"next",
"(",
"csv_in",
")",
"if",
"'tags'",
"in",
"header",
":",... | ca2a28cf5d55cfdae13dd222ba58c25565bdb86e |
train | validate_date | Check if date is in ISO 8601 format.
:param date: This field is the date to be checked.
:param project_member_id: This field is the project_member_id corresponding
to the date provided.
:param filename: This field is the filename corresponding to the date
provided. | ohapi/utils_fs.py | def validate_date(date, project_member_id, filename):
"""
Check if date is in ISO 8601 format.
:param date: This field is the date to be checked.
:param project_member_id: This field is the project_member_id corresponding
to the date provided.
:param filename: This field is the filename cor... | def validate_date(date, project_member_id, filename):
"""
Check if date is in ISO 8601 format.
:param date: This field is the date to be checked.
:param project_member_id: This field is the project_member_id corresponding
to the date provided.
:param filename: This field is the filename cor... | [
"Check",
"if",
"date",
"is",
"in",
"ISO",
"8601",
"format",
"."
] | OpenHumans/open-humans-api | python | https://github.com/OpenHumans/open-humans-api/blob/ca2a28cf5d55cfdae13dd222ba58c25565bdb86e/ohapi/utils_fs.py#L218-L232 | [
"def",
"validate_date",
"(",
"date",
",",
"project_member_id",
",",
"filename",
")",
":",
"try",
":",
"arrow",
".",
"get",
"(",
"date",
")",
"except",
"Exception",
":",
"return",
"False",
"return",
"True"
] | ca2a28cf5d55cfdae13dd222ba58c25565bdb86e |
train | is_single_file_metadata_valid | Check if metadata fields like project member id, description, tags, md5 and
creation date are valid for a single file.
:param file_metadata: This field is metadata of file.
:param project_member_id: This field is the project member id corresponding
to the file metadata provided.
:param filename... | ohapi/utils_fs.py | def is_single_file_metadata_valid(file_metadata, project_member_id, filename):
"""
Check if metadata fields like project member id, description, tags, md5 and
creation date are valid for a single file.
:param file_metadata: This field is metadata of file.
:param project_member_id: This field is the... | def is_single_file_metadata_valid(file_metadata, project_member_id, filename):
"""
Check if metadata fields like project member id, description, tags, md5 and
creation date are valid for a single file.
:param file_metadata: This field is metadata of file.
:param project_member_id: This field is the... | [
"Check",
"if",
"metadata",
"fields",
"like",
"project",
"member",
"id",
"description",
"tags",
"md5",
"and",
"creation",
"date",
"are",
"valid",
"for",
"a",
"single",
"file",
"."
] | OpenHumans/open-humans-api | python | https://github.com/OpenHumans/open-humans-api/blob/ca2a28cf5d55cfdae13dd222ba58c25565bdb86e/ohapi/utils_fs.py#L235-L292 | [
"def",
"is_single_file_metadata_valid",
"(",
"file_metadata",
",",
"project_member_id",
",",
"filename",
")",
":",
"if",
"project_member_id",
"is",
"not",
"None",
":",
"if",
"not",
"project_member_id",
".",
"isdigit",
"(",
")",
"or",
"len",
"(",
"project_member_id... | ca2a28cf5d55cfdae13dd222ba58c25565bdb86e |
train | review_metadata_csv_single_user | Check validity of metadata for single user.
:param filedir: This field is the filepath of the directory whose csv
has to be made.
:param metadata: This field is the metadata generated from the
load_metadata_csv function.
:param csv_in: This field returns a reader object which iterates over ... | ohapi/utils_fs.py | def review_metadata_csv_single_user(filedir, metadata, csv_in, n_headers):
"""
Check validity of metadata for single user.
:param filedir: This field is the filepath of the directory whose csv
has to be made.
:param metadata: This field is the metadata generated from the
load_metadata_c... | def review_metadata_csv_single_user(filedir, metadata, csv_in, n_headers):
"""
Check validity of metadata for single user.
:param filedir: This field is the filepath of the directory whose csv
has to be made.
:param metadata: This field is the metadata generated from the
load_metadata_c... | [
"Check",
"validity",
"of",
"metadata",
"for",
"single",
"user",
"."
] | OpenHumans/open-humans-api | python | https://github.com/OpenHumans/open-humans-api/blob/ca2a28cf5d55cfdae13dd222ba58c25565bdb86e/ohapi/utils_fs.py#L295-L315 | [
"def",
"review_metadata_csv_single_user",
"(",
"filedir",
",",
"metadata",
",",
"csv_in",
",",
"n_headers",
")",
":",
"try",
":",
"if",
"not",
"validate_metadata",
"(",
"filedir",
",",
"metadata",
")",
":",
"return",
"False",
"for",
"filename",
",",
"file_meta... | ca2a28cf5d55cfdae13dd222ba58c25565bdb86e |
train | validate_subfolders | Check that all folders in the given directory have a corresponding
entry in the metadata file, and vice versa.
:param filedir: This field is the target directory from which to
match metadata
:param metadata: This field contains the metadata to be matched. | ohapi/utils_fs.py | def validate_subfolders(filedir, metadata):
"""
Check that all folders in the given directory have a corresponding
entry in the metadata file, and vice versa.
:param filedir: This field is the target directory from which to
match metadata
:param metadata: This field contains the metadata to... | def validate_subfolders(filedir, metadata):
"""
Check that all folders in the given directory have a corresponding
entry in the metadata file, and vice versa.
:param filedir: This field is the target directory from which to
match metadata
:param metadata: This field contains the metadata to... | [
"Check",
"that",
"all",
"folders",
"in",
"the",
"given",
"directory",
"have",
"a",
"corresponding",
"entry",
"in",
"the",
"metadata",
"file",
"and",
"vice",
"versa",
"."
] | OpenHumans/open-humans-api | python | https://github.com/OpenHumans/open-humans-api/blob/ca2a28cf5d55cfdae13dd222ba58c25565bdb86e/ohapi/utils_fs.py#L318-L341 | [
"def",
"validate_subfolders",
"(",
"filedir",
",",
"metadata",
")",
":",
"if",
"not",
"os",
".",
"path",
".",
"isdir",
"(",
"filedir",
")",
":",
"print",
"(",
"\"Error: \"",
"+",
"filedir",
"+",
"\" is not a directory\"",
")",
"return",
"False",
"subfolders"... | ca2a28cf5d55cfdae13dd222ba58c25565bdb86e |
train | review_metadata_csv_multi_user | Check validity of metadata for multi user.
:param filedir: This field is the filepath of the directory whose csv
has to be made.
:param metadata: This field is the metadata generated from the
load_metadata_csv function.
:param csv_in: This field returns a reader object which iterates over t... | ohapi/utils_fs.py | def review_metadata_csv_multi_user(filedir, metadata, csv_in, n_headers):
"""
Check validity of metadata for multi user.
:param filedir: This field is the filepath of the directory whose csv
has to be made.
:param metadata: This field is the metadata generated from the
load_metadata_csv... | def review_metadata_csv_multi_user(filedir, metadata, csv_in, n_headers):
"""
Check validity of metadata for multi user.
:param filedir: This field is the filepath of the directory whose csv
has to be made.
:param metadata: This field is the metadata generated from the
load_metadata_csv... | [
"Check",
"validity",
"of",
"metadata",
"for",
"multi",
"user",
"."
] | OpenHumans/open-humans-api | python | https://github.com/OpenHumans/open-humans-api/blob/ca2a28cf5d55cfdae13dd222ba58c25565bdb86e/ohapi/utils_fs.py#L344-L371 | [
"def",
"review_metadata_csv_multi_user",
"(",
"filedir",
",",
"metadata",
",",
"csv_in",
",",
"n_headers",
")",
":",
"try",
":",
"if",
"not",
"validate_subfolders",
"(",
"filedir",
",",
"metadata",
")",
":",
"return",
"False",
"for",
"project_member_id",
",",
... | ca2a28cf5d55cfdae13dd222ba58c25565bdb86e |
train | review_metadata_csv | Check validity of metadata fields.
:param filedir: This field is the filepath of the directory whose csv
has to be made.
:param outputfilepath: This field is the file path of the output csv.
:param max_bytes: This field is the maximum file size to consider. Its
default value is 128m. | ohapi/utils_fs.py | def review_metadata_csv(filedir, input_filepath):
"""
Check validity of metadata fields.
:param filedir: This field is the filepath of the directory whose csv
has to be made.
:param outputfilepath: This field is the file path of the output csv.
:param max_bytes: This field is the maximum fi... | def review_metadata_csv(filedir, input_filepath):
"""
Check validity of metadata fields.
:param filedir: This field is the filepath of the directory whose csv
has to be made.
:param outputfilepath: This field is the file path of the output csv.
:param max_bytes: This field is the maximum fi... | [
"Check",
"validity",
"of",
"metadata",
"fields",
"."
] | OpenHumans/open-humans-api | python | https://github.com/OpenHumans/open-humans-api/blob/ca2a28cf5d55cfdae13dd222ba58c25565bdb86e/ohapi/utils_fs.py#L374-L401 | [
"def",
"review_metadata_csv",
"(",
"filedir",
",",
"input_filepath",
")",
":",
"try",
":",
"metadata",
"=",
"load_metadata_csv",
"(",
"input_filepath",
")",
"except",
"ValueError",
"as",
"e",
":",
"print_error",
"(",
"e",
")",
"return",
"False",
"with",
"open"... | ca2a28cf5d55cfdae13dd222ba58c25565bdb86e |
train | write_metadata_to_filestream | Make metadata file for all files in a directory(helper function)
:param filedir: This field is the filepath of the directory whose csv
has to be made.
:param filestream: This field is a stream for writing to the csv.
:param max_bytes: This field is the maximum file size to consider. Its
def... | ohapi/utils_fs.py | def write_metadata_to_filestream(filedir, filestream,
max_bytes=MAX_FILE_DEFAULT):
"""
Make metadata file for all files in a directory(helper function)
:param filedir: This field is the filepath of the directory whose csv
has to be made.
:param filestream: This ... | def write_metadata_to_filestream(filedir, filestream,
max_bytes=MAX_FILE_DEFAULT):
"""
Make metadata file for all files in a directory(helper function)
:param filedir: This field is the filepath of the directory whose csv
has to be made.
:param filestream: This ... | [
"Make",
"metadata",
"file",
"for",
"all",
"files",
"in",
"a",
"directory",
"(",
"helper",
"function",
")"
] | OpenHumans/open-humans-api | python | https://github.com/OpenHumans/open-humans-api/blob/ca2a28cf5d55cfdae13dd222ba58c25565bdb86e/ohapi/utils_fs.py#L404-L452 | [
"def",
"write_metadata_to_filestream",
"(",
"filedir",
",",
"filestream",
",",
"max_bytes",
"=",
"MAX_FILE_DEFAULT",
")",
":",
"csv_out",
"=",
"csv",
".",
"writer",
"(",
"filestream",
")",
"subdirs",
"=",
"[",
"os",
".",
"path",
".",
"join",
"(",
"filedir",
... | ca2a28cf5d55cfdae13dd222ba58c25565bdb86e |
train | mk_metadata_csv | Make metadata file for all files in a directory.
:param filedir: This field is the filepath of the directory whose csv
has to be made.
:param outputfilepath: This field is the file path of the output csv.
:param max_bytes: This field is the maximum file size to consider. Its
default value i... | ohapi/utils_fs.py | def mk_metadata_csv(filedir, outputfilepath, max_bytes=MAX_FILE_DEFAULT):
"""
Make metadata file for all files in a directory.
:param filedir: This field is the filepath of the directory whose csv
has to be made.
:param outputfilepath: This field is the file path of the output csv.
:param m... | def mk_metadata_csv(filedir, outputfilepath, max_bytes=MAX_FILE_DEFAULT):
"""
Make metadata file for all files in a directory.
:param filedir: This field is the filepath of the directory whose csv
has to be made.
:param outputfilepath: This field is the file path of the output csv.
:param m... | [
"Make",
"metadata",
"file",
"for",
"all",
"files",
"in",
"a",
"directory",
"."
] | OpenHumans/open-humans-api | python | https://github.com/OpenHumans/open-humans-api/blob/ca2a28cf5d55cfdae13dd222ba58c25565bdb86e/ohapi/utils_fs.py#L455-L466 | [
"def",
"mk_metadata_csv",
"(",
"filedir",
",",
"outputfilepath",
",",
"max_bytes",
"=",
"MAX_FILE_DEFAULT",
")",
":",
"with",
"open",
"(",
"outputfilepath",
",",
"'w'",
")",
"as",
"filestream",
":",
"write_metadata_to_filestream",
"(",
"filedir",
",",
"filestream"... | ca2a28cf5d55cfdae13dd222ba58c25565bdb86e |
train | download_file | Download a file.
:param download_url: This field is the url from which data will be
downloaded.
:param target_filepath: This field is the path of the file where
data will be downloaded.
:param max_bytes: This field is the maximum file size to download. Its
default value is 128m. | ohapi/utils_fs.py | def download_file(download_url, target_filepath, max_bytes=MAX_FILE_DEFAULT):
"""
Download a file.
:param download_url: This field is the url from which data will be
downloaded.
:param target_filepath: This field is the path of the file where
data will be downloaded.
:param max_byte... | def download_file(download_url, target_filepath, max_bytes=MAX_FILE_DEFAULT):
"""
Download a file.
:param download_url: This field is the url from which data will be
downloaded.
:param target_filepath: This field is the path of the file where
data will be downloaded.
:param max_byte... | [
"Download",
"a",
"file",
"."
] | OpenHumans/open-humans-api | python | https://github.com/OpenHumans/open-humans-api/blob/ca2a28cf5d55cfdae13dd222ba58c25565bdb86e/ohapi/utils_fs.py#L469-L506 | [
"def",
"download_file",
"(",
"download_url",
",",
"target_filepath",
",",
"max_bytes",
"=",
"MAX_FILE_DEFAULT",
")",
":",
"response",
"=",
"requests",
".",
"get",
"(",
"download_url",
",",
"stream",
"=",
"True",
")",
"size",
"=",
"int",
"(",
"response",
".",... | ca2a28cf5d55cfdae13dd222ba58c25565bdb86e |
train | read_id_list | Get project member id from a file.
:param filepath: This field is the path of file to read. | ohapi/utils_fs.py | def read_id_list(filepath):
"""
Get project member id from a file.
:param filepath: This field is the path of file to read.
"""
if not filepath:
return None
id_list = []
with open(filepath) as f:
for line in f:
line = line.rstrip()
if not re.match('^[... | def read_id_list(filepath):
"""
Get project member id from a file.
:param filepath: This field is the path of file to read.
"""
if not filepath:
return None
id_list = []
with open(filepath) as f:
for line in f:
line = line.rstrip()
if not re.match('^[... | [
"Get",
"project",
"member",
"id",
"from",
"a",
"file",
"."
] | OpenHumans/open-humans-api | python | https://github.com/OpenHumans/open-humans-api/blob/ca2a28cf5d55cfdae13dd222ba58c25565bdb86e/ohapi/utils_fs.py#L509-L526 | [
"def",
"read_id_list",
"(",
"filepath",
")",
":",
"if",
"not",
"filepath",
":",
"return",
"None",
"id_list",
"=",
"[",
"]",
"with",
"open",
"(",
"filepath",
")",
"as",
"f",
":",
"for",
"line",
"in",
"f",
":",
"line",
"=",
"line",
".",
"rstrip",
"("... | ca2a28cf5d55cfdae13dd222ba58c25565bdb86e |
train | set_log_level | Function for setting the logging level.
:param debug: This boolean field is the logging level.
:param verbose: This boolean field is the logging level. | ohapi/command_line.py | def set_log_level(debug, verbose):
"""
Function for setting the logging level.
:param debug: This boolean field is the logging level.
:param verbose: This boolean field is the logging level.
"""
if debug:
logging.basicConfig(level=logging.DEBUG)
elif verbose:
logging.basicCo... | def set_log_level(debug, verbose):
"""
Function for setting the logging level.
:param debug: This boolean field is the logging level.
:param verbose: This boolean field is the logging level.
"""
if debug:
logging.basicConfig(level=logging.DEBUG)
elif verbose:
logging.basicCo... | [
"Function",
"for",
"setting",
"the",
"logging",
"level",
"."
] | OpenHumans/open-humans-api | python | https://github.com/OpenHumans/open-humans-api/blob/ca2a28cf5d55cfdae13dd222ba58c25565bdb86e/ohapi/command_line.py#L24-L34 | [
"def",
"set_log_level",
"(",
"debug",
",",
"verbose",
")",
":",
"if",
"debug",
":",
"logging",
".",
"basicConfig",
"(",
"level",
"=",
"logging",
".",
"DEBUG",
")",
"elif",
"verbose",
":",
"logging",
".",
"basicConfig",
"(",
"level",
"=",
"logging",
".",
... | ca2a28cf5d55cfdae13dd222ba58c25565bdb86e |
train | download_cli | Command line function for downloading data from project members to the
target directory. For more information visit
:func:`download<ohapi.command_line.download>`. | ohapi/command_line.py | def download_cli(directory, master_token=None, member=None, access_token=None,
source=None, project_data=False, max_size='128m',
verbose=False, debug=False, memberlist=None,
excludelist=None, id_filename=False):
"""
Command line function for downloading data fr... | def download_cli(directory, master_token=None, member=None, access_token=None,
source=None, project_data=False, max_size='128m',
verbose=False, debug=False, memberlist=None,
excludelist=None, id_filename=False):
"""
Command line function for downloading data fr... | [
"Command",
"line",
"function",
"for",
"downloading",
"data",
"from",
"project",
"members",
"to",
"the",
"target",
"directory",
".",
"For",
"more",
"information",
"visit",
":",
"func",
":",
"download<ohapi",
".",
"command_line",
".",
"download",
">",
"."
] | OpenHumans/open-humans-api | python | https://github.com/OpenHumans/open-humans-api/blob/ca2a28cf5d55cfdae13dd222ba58c25565bdb86e/ohapi/command_line.py#L56-L67 | [
"def",
"download_cli",
"(",
"directory",
",",
"master_token",
"=",
"None",
",",
"member",
"=",
"None",
",",
"access_token",
"=",
"None",
",",
"source",
"=",
"None",
",",
"project_data",
"=",
"False",
",",
"max_size",
"=",
"'128m'",
",",
"verbose",
"=",
"... | ca2a28cf5d55cfdae13dd222ba58c25565bdb86e |
train | download | Download data from project members to the target directory.
Unless this is a member-specific download, directories will be
created for each project member ID. Also, unless a source is specified,
all shared sources are downloaded and data is sorted into subdirectories
according to source.
Projects ... | ohapi/command_line.py | def download(directory, master_token=None, member=None, access_token=None,
source=None, project_data=False, max_size='128m', verbose=False,
debug=False, memberlist=None, excludelist=None,
id_filename=False):
"""
Download data from project members to the target directory.
... | def download(directory, master_token=None, member=None, access_token=None,
source=None, project_data=False, max_size='128m', verbose=False,
debug=False, memberlist=None, excludelist=None,
id_filename=False):
"""
Download data from project members to the target directory.
... | [
"Download",
"data",
"from",
"project",
"members",
"to",
"the",
"target",
"directory",
"."
] | OpenHumans/open-humans-api | python | https://github.com/OpenHumans/open-humans-api/blob/ca2a28cf5d55cfdae13dd222ba58c25565bdb86e/ohapi/command_line.py#L70-L158 | [
"def",
"download",
"(",
"directory",
",",
"master_token",
"=",
"None",
",",
"member",
"=",
"None",
",",
"access_token",
"=",
"None",
",",
"source",
"=",
"None",
",",
"project_data",
"=",
"False",
",",
"max_size",
"=",
"'128m'",
",",
"verbose",
"=",
"Fals... | ca2a28cf5d55cfdae13dd222ba58c25565bdb86e |
train | download_metadata_cli | Command line function for downloading metadata.
For more information visit
:func:`download_metadata<ohapi.command_line.download_metadata>`. | ohapi/command_line.py | def download_metadata_cli(master_token, output_csv, verbose=False,
debug=False):
"""
Command line function for downloading metadata.
For more information visit
:func:`download_metadata<ohapi.command_line.download_metadata>`.
"""
return download_metadata(master_token, ou... | def download_metadata_cli(master_token, output_csv, verbose=False,
debug=False):
"""
Command line function for downloading metadata.
For more information visit
:func:`download_metadata<ohapi.command_line.download_metadata>`.
"""
return download_metadata(master_token, ou... | [
"Command",
"line",
"function",
"for",
"downloading",
"metadata",
".",
"For",
"more",
"information",
"visit",
":",
"func",
":",
"download_metadata<ohapi",
".",
"command_line",
".",
"download_metadata",
">",
"."
] | OpenHumans/open-humans-api | python | https://github.com/OpenHumans/open-humans-api/blob/ca2a28cf5d55cfdae13dd222ba58c25565bdb86e/ohapi/command_line.py#L168-L175 | [
"def",
"download_metadata_cli",
"(",
"master_token",
",",
"output_csv",
",",
"verbose",
"=",
"False",
",",
"debug",
"=",
"False",
")",
":",
"return",
"download_metadata",
"(",
"master_token",
",",
"output_csv",
",",
"verbose",
",",
"debug",
")"
] | ca2a28cf5d55cfdae13dd222ba58c25565bdb86e |
train | download_metadata | Output CSV with metadata for a project's downloadable files in Open Humans.
:param master_token: This field is the master access token for the project.
:param output_csv: This field is the target csv file to which metadata is
written.
:param verbose: This boolean field is the logging level. It's de... | ohapi/command_line.py | def download_metadata(master_token, output_csv, verbose=False, debug=False):
"""
Output CSV with metadata for a project's downloadable files in Open Humans.
:param master_token: This field is the master access token for the project.
:param output_csv: This field is the target csv file to which metadata... | def download_metadata(master_token, output_csv, verbose=False, debug=False):
"""
Output CSV with metadata for a project's downloadable files in Open Humans.
:param master_token: This field is the master access token for the project.
:param output_csv: This field is the target csv file to which metadata... | [
"Output",
"CSV",
"with",
"metadata",
"for",
"a",
"project",
"s",
"downloadable",
"files",
"in",
"Open",
"Humans",
"."
] | OpenHumans/open-humans-api | python | https://github.com/OpenHumans/open-humans-api/blob/ca2a28cf5d55cfdae13dd222ba58c25565bdb86e/ohapi/command_line.py#L178-L208 | [
"def",
"download_metadata",
"(",
"master_token",
",",
"output_csv",
",",
"verbose",
"=",
"False",
",",
"debug",
"=",
"False",
")",
":",
"set_log_level",
"(",
"debug",
",",
"verbose",
")",
"project",
"=",
"OHProject",
"(",
"master_access_token",
"=",
"master_to... | ca2a28cf5d55cfdae13dd222ba58c25565bdb86e |
train | upload_metadata_cli | Command line function for drafting or reviewing metadata files.
For more information visit
:func:`upload_metadata<ohapi.command_line.upload_metadata>`. | ohapi/command_line.py | def upload_metadata_cli(directory, create_csv='', review='',
max_size='128m', verbose=False, debug=False):
"""
Command line function for drafting or reviewing metadata files.
For more information visit
:func:`upload_metadata<ohapi.command_line.upload_metadata>`.
"""
retur... | def upload_metadata_cli(directory, create_csv='', review='',
max_size='128m', verbose=False, debug=False):
"""
Command line function for drafting or reviewing metadata files.
For more information visit
:func:`upload_metadata<ohapi.command_line.upload_metadata>`.
"""
retur... | [
"Command",
"line",
"function",
"for",
"drafting",
"or",
"reviewing",
"metadata",
"files",
".",
"For",
"more",
"information",
"visit",
":",
"func",
":",
"upload_metadata<ohapi",
".",
"command_line",
".",
"upload_metadata",
">",
"."
] | OpenHumans/open-humans-api | python | https://github.com/OpenHumans/open-humans-api/blob/ca2a28cf5d55cfdae13dd222ba58c25565bdb86e/ohapi/command_line.py#L219-L227 | [
"def",
"upload_metadata_cli",
"(",
"directory",
",",
"create_csv",
"=",
"''",
",",
"review",
"=",
"''",
",",
"max_size",
"=",
"'128m'",
",",
"verbose",
"=",
"False",
",",
"debug",
"=",
"False",
")",
":",
"return",
"upload_metadata",
"(",
"directory",
",",
... | ca2a28cf5d55cfdae13dd222ba58c25565bdb86e |
train | upload_metadata | Draft or review metadata files for uploading files to Open Humans.
The target directory should either represent files for a single member (no
subdirectories), or contain a subdirectory for each project member ID.
:param directory: This field is the directory for which metadata has to be
created.
... | ohapi/command_line.py | def upload_metadata(directory, create_csv='', review='',
max_size='128m', verbose=False, debug=False):
"""
Draft or review metadata files for uploading files to Open Humans.
The target directory should either represent files for a single member (no
subdirectories), or contain a subdi... | def upload_metadata(directory, create_csv='', review='',
max_size='128m', verbose=False, debug=False):
"""
Draft or review metadata files for uploading files to Open Humans.
The target directory should either represent files for a single member (no
subdirectories), or contain a subdi... | [
"Draft",
"or",
"review",
"metadata",
"files",
"for",
"uploading",
"files",
"to",
"Open",
"Humans",
".",
"The",
"target",
"directory",
"should",
"either",
"represent",
"files",
"for",
"a",
"single",
"member",
"(",
"no",
"subdirectories",
")",
"or",
"contain",
... | OpenHumans/open-humans-api | python | https://github.com/OpenHumans/open-humans-api/blob/ca2a28cf5d55cfdae13dd222ba58c25565bdb86e/ohapi/command_line.py#L230-L261 | [
"def",
"upload_metadata",
"(",
"directory",
",",
"create_csv",
"=",
"''",
",",
"review",
"=",
"''",
",",
"max_size",
"=",
"'128m'",
",",
"verbose",
"=",
"False",
",",
"debug",
"=",
"False",
")",
":",
"set_log_level",
"(",
"debug",
",",
"verbose",
")",
... | ca2a28cf5d55cfdae13dd222ba58c25565bdb86e |
train | upload_cli | Command line function for uploading files to OH.
For more information visit
:func:`upload<ohapi.command_line.upload>`. | ohapi/command_line.py | def upload_cli(directory, metadata_csv, master_token=None, member=None,
access_token=None, safe=False, sync=False, max_size='128m',
mode='default', verbose=False, debug=False):
"""
Command line function for uploading files to OH.
For more information visit
:func:`upload<oha... | def upload_cli(directory, metadata_csv, master_token=None, member=None,
access_token=None, safe=False, sync=False, max_size='128m',
mode='default', verbose=False, debug=False):
"""
Command line function for uploading files to OH.
For more information visit
:func:`upload<oha... | [
"Command",
"line",
"function",
"for",
"uploading",
"files",
"to",
"OH",
".",
"For",
"more",
"information",
"visit",
":",
"func",
":",
"upload<ohapi",
".",
"command_line",
".",
"upload",
">",
"."
] | OpenHumans/open-humans-api | python | https://github.com/OpenHumans/open-humans-api/blob/ca2a28cf5d55cfdae13dd222ba58c25565bdb86e/ohapi/command_line.py#L282-L292 | [
"def",
"upload_cli",
"(",
"directory",
",",
"metadata_csv",
",",
"master_token",
"=",
"None",
",",
"member",
"=",
"None",
",",
"access_token",
"=",
"None",
",",
"safe",
"=",
"False",
",",
"sync",
"=",
"False",
",",
"max_size",
"=",
"'128m'",
",",
"mode",... | ca2a28cf5d55cfdae13dd222ba58c25565bdb86e |
train | upload | Upload files for the project to Open Humans member accounts.
If using a master access token and not specifying member ID:
(1) Files should be organized in subdirectories according to project
member ID, e.g.:
main_directory/01234567/data.json
main_directory/12345678/data.json
main_... | ohapi/command_line.py | def upload(directory, metadata_csv, master_token=None, member=None,
access_token=None, safe=False, sync=False, max_size='128m',
mode='default', verbose=False, debug=False):
"""
Upload files for the project to Open Humans member accounts.
If using a master access token and not specifyi... | def upload(directory, metadata_csv, master_token=None, member=None,
access_token=None, safe=False, sync=False, max_size='128m',
mode='default', verbose=False, debug=False):
"""
Upload files for the project to Open Humans member accounts.
If using a master access token and not specifyi... | [
"Upload",
"files",
"for",
"the",
"project",
"to",
"Open",
"Humans",
"member",
"accounts",
"."
] | OpenHumans/open-humans-api | python | https://github.com/OpenHumans/open-humans-api/blob/ca2a28cf5d55cfdae13dd222ba58c25565bdb86e/ohapi/command_line.py#L295-L411 | [
"def",
"upload",
"(",
"directory",
",",
"metadata_csv",
",",
"master_token",
"=",
"None",
",",
"member",
"=",
"None",
",",
"access_token",
"=",
"None",
",",
"safe",
"=",
"False",
",",
"sync",
"=",
"False",
",",
"max_size",
"=",
"'128m'",
",",
"mode",
"... | ca2a28cf5d55cfdae13dd222ba58c25565bdb86e |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.