repository_name stringlengths 5 67 | func_path_in_repository stringlengths 4 234 | func_name stringlengths 0 314 | whole_func_string stringlengths 52 3.87M | language stringclasses 6
values | func_code_string stringlengths 52 3.87M | func_documentation_string stringlengths 1 47.2k | func_code_url stringlengths 85 339 |
|---|---|---|---|---|---|---|---|
facelessuser/soupsieve | soupsieve/util.py | lower | def lower(string):
"""Lower."""
new_string = []
for c in string:
o = ord(c)
new_string.append(chr(o + 32) if UC_A <= o <= UC_Z else c)
return ''.join(new_string) | python | def lower(string):
"""Lower."""
new_string = []
for c in string:
o = ord(c)
new_string.append(chr(o + 32) if UC_A <= o <= UC_Z else c)
return ''.join(new_string) | Lower. | https://github.com/facelessuser/soupsieve/blob/24859cc3e756ebf46b75547d49c6b4a7bf35ee82/soupsieve/util.py#L45-L52 |
facelessuser/soupsieve | soupsieve/util.py | upper | def upper(string): # pragma: no cover
"""Lower."""
new_string = []
for c in string:
o = ord(c)
new_string.append(chr(o - 32) if LC_A <= o <= LC_Z else c)
return ''.join(new_string) | python | def upper(string): # pragma: no cover
"""Lower."""
new_string = []
for c in string:
o = ord(c)
new_string.append(chr(o - 32) if LC_A <= o <= LC_Z else c)
return ''.join(new_string) | Lower. | https://github.com/facelessuser/soupsieve/blob/24859cc3e756ebf46b75547d49c6b4a7bf35ee82/soupsieve/util.py#L55-L62 |
facelessuser/soupsieve | soupsieve/util.py | uord | def uord(c):
"""Get Unicode ordinal."""
if len(c) == 2: # pragma: no cover
high, low = [ord(p) for p in c]
ordinal = (high - 0xD800) * 0x400 + low - 0xDC00 + 0x10000
else:
ordinal = ord(c)
return ordinal | python | def uord(c):
"""Get Unicode ordinal."""
if len(c) == 2: # pragma: no cover
high, low = [ord(p) for p in c]
ordinal = (high - 0xD800) * 0x400 + low - 0xDC00 + 0x10000
else:
ordinal = ord(c)
return ordinal | Get Unicode ordinal. | https://github.com/facelessuser/soupsieve/blob/24859cc3e756ebf46b75547d49c6b4a7bf35ee82/soupsieve/util.py#L74-L83 |
facelessuser/soupsieve | soupsieve/util.py | deprecated | def deprecated(message, stacklevel=2): # pragma: no cover
"""
Raise a `DeprecationWarning` when wrapped function/method is called.
Borrowed from https://stackoverflow.com/a/48632082/866026
"""
def _decorator(func):
@wraps(func)
def _func(*args, **kwargs):
warnings.warn... | python | def deprecated(message, stacklevel=2): # pragma: no cover
"""
Raise a `DeprecationWarning` when wrapped function/method is called.
Borrowed from https://stackoverflow.com/a/48632082/866026
"""
def _decorator(func):
@wraps(func)
def _func(*args, **kwargs):
warnings.warn... | Raise a `DeprecationWarning` when wrapped function/method is called.
Borrowed from https://stackoverflow.com/a/48632082/866026 | https://github.com/facelessuser/soupsieve/blob/24859cc3e756ebf46b75547d49c6b4a7bf35ee82/soupsieve/util.py#L104-L121 |
facelessuser/soupsieve | soupsieve/util.py | warn_deprecated | def warn_deprecated(message, stacklevel=2): # pragma: no cover
"""Warn deprecated."""
warnings.warn(
message,
category=DeprecationWarning,
stacklevel=stacklevel
) | python | def warn_deprecated(message, stacklevel=2): # pragma: no cover
"""Warn deprecated."""
warnings.warn(
message,
category=DeprecationWarning,
stacklevel=stacklevel
) | Warn deprecated. | https://github.com/facelessuser/soupsieve/blob/24859cc3e756ebf46b75547d49c6b4a7bf35ee82/soupsieve/util.py#L124-L131 |
facelessuser/soupsieve | soupsieve/util.py | get_pattern_context | def get_pattern_context(pattern, index):
"""Get the pattern context."""
last = 0
current_line = 1
col = 1
text = []
line = 1
# Split pattern by newline and handle the text before the newline
for m in RE_PATTERN_LINE_SPLIT.finditer(pattern):
linetext = pattern[last:m.start(0)]
... | python | def get_pattern_context(pattern, index):
"""Get the pattern context."""
last = 0
current_line = 1
col = 1
text = []
line = 1
# Split pattern by newline and handle the text before the newline
for m in RE_PATTERN_LINE_SPLIT.finditer(pattern):
linetext = pattern[last:m.start(0)]
... | Get the pattern context. | https://github.com/facelessuser/soupsieve/blob/24859cc3e756ebf46b75547d49c6b4a7bf35ee82/soupsieve/util.py#L134-L171 |
facelessuser/soupsieve | soupsieve/util.py | warn_quirks | def warn_quirks(message, recommend, pattern, index):
"""Warn quirks."""
import traceback
import bs4 # noqa: F401
# Acquire source code line context
paths = (MODULE, sys.modules['bs4'].__path__[0])
tb = traceback.extract_stack()
previous = None
filename = None
lineno = None
for... | python | def warn_quirks(message, recommend, pattern, index):
"""Warn quirks."""
import traceback
import bs4 # noqa: F401
# Acquire source code line context
paths = (MODULE, sys.modules['bs4'].__path__[0])
tb = traceback.extract_stack()
previous = None
filename = None
lineno = None
for... | Warn quirks. | https://github.com/facelessuser/soupsieve/blob/24859cc3e756ebf46b75547d49c6b4a7bf35ee82/soupsieve/util.py#L178-L213 |
facelessuser/soupsieve | soupsieve/__init__.py | compile | def compile(pattern, namespaces=None, flags=0, **kwargs): # noqa: A001
"""Compile CSS pattern."""
if namespaces is not None:
namespaces = ct.Namespaces(**namespaces)
custom = kwargs.get('custom')
if custom is not None:
custom = ct.CustomSelectors(**custom)
if isinstance(pattern, ... | python | def compile(pattern, namespaces=None, flags=0, **kwargs): # noqa: A001
"""Compile CSS pattern."""
if namespaces is not None:
namespaces = ct.Namespaces(**namespaces)
custom = kwargs.get('custom')
if custom is not None:
custom = ct.CustomSelectors(**custom)
if isinstance(pattern, ... | Compile CSS pattern. | https://github.com/facelessuser/soupsieve/blob/24859cc3e756ebf46b75547d49c6b4a7bf35ee82/soupsieve/__init__.py#L44-L63 |
facelessuser/soupsieve | soupsieve/__init__.py | closest | def closest(select, tag, namespaces=None, flags=0, **kwargs):
"""Match closest ancestor."""
return compile(select, namespaces, flags, **kwargs).closest(tag) | python | def closest(select, tag, namespaces=None, flags=0, **kwargs):
"""Match closest ancestor."""
return compile(select, namespaces, flags, **kwargs).closest(tag) | Match closest ancestor. | https://github.com/facelessuser/soupsieve/blob/24859cc3e756ebf46b75547d49c6b4a7bf35ee82/soupsieve/__init__.py#L72-L75 |
facelessuser/soupsieve | soupsieve/__init__.py | match | def match(select, tag, namespaces=None, flags=0, **kwargs):
"""Match node."""
return compile(select, namespaces, flags, **kwargs).match(tag) | python | def match(select, tag, namespaces=None, flags=0, **kwargs):
"""Match node."""
return compile(select, namespaces, flags, **kwargs).match(tag) | Match node. | https://github.com/facelessuser/soupsieve/blob/24859cc3e756ebf46b75547d49c6b4a7bf35ee82/soupsieve/__init__.py#L78-L81 |
facelessuser/soupsieve | soupsieve/__init__.py | filter | def filter(select, iterable, namespaces=None, flags=0, **kwargs): # noqa: A001
"""Filter list of nodes."""
return compile(select, namespaces, flags, **kwargs).filter(iterable) | python | def filter(select, iterable, namespaces=None, flags=0, **kwargs): # noqa: A001
"""Filter list of nodes."""
return compile(select, namespaces, flags, **kwargs).filter(iterable) | Filter list of nodes. | https://github.com/facelessuser/soupsieve/blob/24859cc3e756ebf46b75547d49c6b4a7bf35ee82/soupsieve/__init__.py#L84-L87 |
facelessuser/soupsieve | soupsieve/__init__.py | comments | def comments(tag, limit=0, flags=0, **kwargs):
"""Get comments only."""
return [comment for comment in cm.CommentsMatch(tag).get_comments(limit)] | python | def comments(tag, limit=0, flags=0, **kwargs):
"""Get comments only."""
return [comment for comment in cm.CommentsMatch(tag).get_comments(limit)] | Get comments only. | https://github.com/facelessuser/soupsieve/blob/24859cc3e756ebf46b75547d49c6b4a7bf35ee82/soupsieve/__init__.py#L91-L94 |
facelessuser/soupsieve | soupsieve/__init__.py | select_one | def select_one(select, tag, namespaces=None, flags=0, **kwargs):
"""Select a single tag."""
return compile(select, namespaces, flags, **kwargs).select_one(tag) | python | def select_one(select, tag, namespaces=None, flags=0, **kwargs):
"""Select a single tag."""
return compile(select, namespaces, flags, **kwargs).select_one(tag) | Select a single tag. | https://github.com/facelessuser/soupsieve/blob/24859cc3e756ebf46b75547d49c6b4a7bf35ee82/soupsieve/__init__.py#L105-L108 |
facelessuser/soupsieve | soupsieve/__init__.py | select | def select(select, tag, namespaces=None, limit=0, flags=0, **kwargs):
"""Select the specified tags."""
return compile(select, namespaces, flags, **kwargs).select(tag, limit) | python | def select(select, tag, namespaces=None, limit=0, flags=0, **kwargs):
"""Select the specified tags."""
return compile(select, namespaces, flags, **kwargs).select(tag, limit) | Select the specified tags. | https://github.com/facelessuser/soupsieve/blob/24859cc3e756ebf46b75547d49c6b4a7bf35ee82/soupsieve/__init__.py#L111-L114 |
facelessuser/soupsieve | soupsieve/__init__.py | iselect | def iselect(select, tag, namespaces=None, limit=0, flags=0, **kwargs):
"""Iterate the specified tags."""
for el in compile(select, namespaces, flags, **kwargs).iselect(tag, limit):
yield el | python | def iselect(select, tag, namespaces=None, limit=0, flags=0, **kwargs):
"""Iterate the specified tags."""
for el in compile(select, namespaces, flags, **kwargs).iselect(tag, limit):
yield el | Iterate the specified tags. | https://github.com/facelessuser/soupsieve/blob/24859cc3e756ebf46b75547d49c6b4a7bf35ee82/soupsieve/__init__.py#L117-L121 |
bigcommerce/bigcommerce-api-python | bigcommerce/resources/base.py | ListableApiResource.all | def all(cls, connection=None, **params):
"""
Returns first page if no params passed in as a list.
"""
request = cls._make_request('GET', cls._get_all_path(), connection, params=params)
return cls._create_object(request, connection=connection) | python | def all(cls, connection=None, **params):
"""
Returns first page if no params passed in as a list.
"""
request = cls._make_request('GET', cls._get_all_path(), connection, params=params)
return cls._create_object(request, connection=connection) | Returns first page if no params passed in as a list. | https://github.com/bigcommerce/bigcommerce-api-python/blob/76a8f5d59fd44a4365f14a5959102e118cf35dee/bigcommerce/resources/base.py#L102-L108 |
bigcommerce/bigcommerce-api-python | bigcommerce/resources/base.py | ListableApiResource.iterall | def iterall(cls, connection=None, **kwargs):
"""
Returns a autopaging generator that yields each object returned one by one.
"""
try:
limit = kwargs['limit']
except KeyError:
limit = None
try:
page = kwargs['page']
except ... | python | def iterall(cls, connection=None, **kwargs):
"""
Returns a autopaging generator that yields each object returned one by one.
"""
try:
limit = kwargs['limit']
except KeyError:
limit = None
try:
page = kwargs['page']
except ... | Returns a autopaging generator that yields each object returned one by one. | https://github.com/bigcommerce/bigcommerce-api-python/blob/76a8f5d59fd44a4365f14a5959102e118cf35dee/bigcommerce/resources/base.py#L111-L148 |
bigcommerce/bigcommerce-api-python | bigcommerce/connection.py | Connection.get | def get(self, resource="", rid=None, **query):
"""
Retrieves the resource with given id 'rid', or all resources of given type.
Keep in mind that the API returns a list for any query that doesn't specify an ID, even when applying
a limit=1 filter.
Also be aware that float values t... | python | def get(self, resource="", rid=None, **query):
"""
Retrieves the resource with given id 'rid', or all resources of given type.
Keep in mind that the API returns a list for any query that doesn't specify an ID, even when applying
a limit=1 filter.
Also be aware that float values t... | Retrieves the resource with given id 'rid', or all resources of given type.
Keep in mind that the API returns a list for any query that doesn't specify an ID, even when applying
a limit=1 filter.
Also be aware that float values tend to come back as strings ("2.0000" instead of 2.0)
Keyw... | https://github.com/bigcommerce/bigcommerce-api-python/blob/76a8f5d59fd44a4365f14a5959102e118cf35dee/bigcommerce/connection.py#L83-L99 |
bigcommerce/bigcommerce-api-python | bigcommerce/connection.py | Connection.update | def update(self, resource, rid, updates):
"""
Updates the resource with id 'rid' with the given updates dictionary.
"""
if resource[-1] != '/':
resource += '/'
resource += str(rid)
return self.put(resource, data=updates) | python | def update(self, resource, rid, updates):
"""
Updates the resource with id 'rid' with the given updates dictionary.
"""
if resource[-1] != '/':
resource += '/'
resource += str(rid)
return self.put(resource, data=updates) | Updates the resource with id 'rid' with the given updates dictionary. | https://github.com/bigcommerce/bigcommerce-api-python/blob/76a8f5d59fd44a4365f14a5959102e118cf35dee/bigcommerce/connection.py#L101-L108 |
bigcommerce/bigcommerce-api-python | bigcommerce/connection.py | Connection.delete | def delete(self, resource, rid=None): # note that rid can't be 0 - problem?
"""
Deletes the resource with given id 'rid', or all resources of given type if rid is not supplied.
"""
if rid:
if resource[-1] != '/':
resource += '/'
resource += str(ri... | python | def delete(self, resource, rid=None): # note that rid can't be 0 - problem?
"""
Deletes the resource with given id 'rid', or all resources of given type if rid is not supplied.
"""
if rid:
if resource[-1] != '/':
resource += '/'
resource += str(ri... | Deletes the resource with given id 'rid', or all resources of given type if rid is not supplied. | https://github.com/bigcommerce/bigcommerce-api-python/blob/76a8f5d59fd44a4365f14a5959102e118cf35dee/bigcommerce/connection.py#L116-L125 |
bigcommerce/bigcommerce-api-python | bigcommerce/connection.py | Connection.put | def put(self, url, data):
"""
Make a PUT request to save data.
data should be a dictionary.
"""
response = self._run_method('PUT', url, data=data)
log.debug("OUTPUT: %s" % response.content)
return self._handle_response(url, response) | python | def put(self, url, data):
"""
Make a PUT request to save data.
data should be a dictionary.
"""
response = self._run_method('PUT', url, data=data)
log.debug("OUTPUT: %s" % response.content)
return self._handle_response(url, response) | Make a PUT request to save data.
data should be a dictionary. | https://github.com/bigcommerce/bigcommerce-api-python/blob/76a8f5d59fd44a4365f14a5959102e118cf35dee/bigcommerce/connection.py#L133-L140 |
bigcommerce/bigcommerce-api-python | bigcommerce/connection.py | Connection.post | def post(self, url, data, headers={}):
"""
POST request for creating new objects.
data should be a dictionary.
"""
response = self._run_method('POST', url, data=data, headers=headers)
return self._handle_response(url, response) | python | def post(self, url, data, headers={}):
"""
POST request for creating new objects.
data should be a dictionary.
"""
response = self._run_method('POST', url, data=data, headers=headers)
return self._handle_response(url, response) | POST request for creating new objects.
data should be a dictionary. | https://github.com/bigcommerce/bigcommerce-api-python/blob/76a8f5d59fd44a4365f14a5959102e118cf35dee/bigcommerce/connection.py#L142-L148 |
bigcommerce/bigcommerce-api-python | bigcommerce/connection.py | Connection._handle_response | def _handle_response(self, url, res, suppress_empty=True):
"""
Returns parsed JSON or raises an exception appropriately.
"""
self._last_response = res
result = {}
if res.status_code in (200, 201, 202):
try:
result = res.json()
excep... | python | def _handle_response(self, url, res, suppress_empty=True):
"""
Returns parsed JSON or raises an exception appropriately.
"""
self._last_response = res
result = {}
if res.status_code in (200, 201, 202):
try:
result = res.json()
excep... | Returns parsed JSON or raises an exception appropriately. | https://github.com/bigcommerce/bigcommerce-api-python/blob/76a8f5d59fd44a4365f14a5959102e118cf35dee/bigcommerce/connection.py#L150-L172 |
bigcommerce/bigcommerce-api-python | bigcommerce/connection.py | OAuthConnection.verify_payload | def verify_payload(signed_payload, client_secret):
"""
Given a signed payload (usually passed as parameter in a GET request to the app's load URL) and a client secret,
authenticates the payload and returns the user's data, or False on fail.
Uses constant-time str comparison to prevent v... | python | def verify_payload(signed_payload, client_secret):
"""
Given a signed payload (usually passed as parameter in a GET request to the app's load URL) and a client secret,
authenticates the payload and returns the user's data, or False on fail.
Uses constant-time str comparison to prevent v... | Given a signed payload (usually passed as parameter in a GET request to the app's load URL) and a client secret,
authenticates the payload and returns the user's data, or False on fail.
Uses constant-time str comparison to prevent vulnerability to timing attacks. | https://github.com/bigcommerce/bigcommerce-api-python/blob/76a8f5d59fd44a4365f14a5959102e118cf35dee/bigcommerce/connection.py#L217-L229 |
bigcommerce/bigcommerce-api-python | bigcommerce/connection.py | OAuthConnection.fetch_token | def fetch_token(self, client_secret, code, context, scope, redirect_uri,
token_url='https://login.bigcommerce.com/oauth2/token'):
"""
Fetches a token from given token_url, using given parameters, and sets up session headers for
future requests.
redirect_uri should be ... | python | def fetch_token(self, client_secret, code, context, scope, redirect_uri,
token_url='https://login.bigcommerce.com/oauth2/token'):
"""
Fetches a token from given token_url, using given parameters, and sets up session headers for
future requests.
redirect_uri should be ... | Fetches a token from given token_url, using given parameters, and sets up session headers for
future requests.
redirect_uri should be the same as your callback URL.
code, context, and scope should be passed as parameters to your callback URL on app installation.
Raises HttpException on ... | https://github.com/bigcommerce/bigcommerce-api-python/blob/76a8f5d59fd44a4365f14a5959102e118cf35dee/bigcommerce/connection.py#L231-L250 |
bigcommerce/bigcommerce-api-python | bigcommerce/connection.py | OAuthConnection._handle_response | def _handle_response(self, url, res, suppress_empty=True):
"""
Adds rate limiting information on to the response object
"""
result = Connection._handle_response(self, url, res, suppress_empty)
if 'X-Rate-Limit-Time-Reset-Ms' in res.headers:
self.rate_limit = dict(ms_u... | python | def _handle_response(self, url, res, suppress_empty=True):
"""
Adds rate limiting information on to the response object
"""
result = Connection._handle_response(self, url, res, suppress_empty)
if 'X-Rate-Limit-Time-Reset-Ms' in res.headers:
self.rate_limit = dict(ms_u... | Adds rate limiting information on to the response object | https://github.com/bigcommerce/bigcommerce-api-python/blob/76a8f5d59fd44a4365f14a5959102e118cf35dee/bigcommerce/connection.py#L252-L274 |
FSX/misaka | misaka/api.py | escape_html | def escape_html(text, escape_slash=False):
"""
Binding for Hoedown's HTML escaping function.
The implementation is inspired by the OWASP XSS Prevention recommendations:
.. code-block:: none
& --> &
< --> <
> --> >
" --> "
' --> '
/ -... | python | def escape_html(text, escape_slash=False):
"""
Binding for Hoedown's HTML escaping function.
The implementation is inspired by the OWASP XSS Prevention recommendations:
.. code-block:: none
& --> &
< --> <
> --> >
" --> "
' --> '
/ -... | Binding for Hoedown's HTML escaping function.
The implementation is inspired by the OWASP XSS Prevention recommendations:
.. code-block:: none
& --> &
< --> <
> --> >
" --> "
' --> '
/ --> / when escape_slash is set to True
.. ver... | https://github.com/FSX/misaka/blob/c13aff82d370d606ff61361db79c166a897641cf/misaka/api.py#L69-L93 |
FSX/misaka | misaka/api.py | html | def html(text, extensions=0, render_flags=0):
"""
Convert markdown text to HTML.
``extensions`` can be a list or tuple of extensions (e.g.
``('fenced-code', 'footnotes', 'strikethrough')``) or an integer
(e.g. ``EXT_FENCED_CODE | EXT_FOOTNOTES | EXT_STRIKETHROUGH``).
``render_flags`` can be a ... | python | def html(text, extensions=0, render_flags=0):
"""
Convert markdown text to HTML.
``extensions`` can be a list or tuple of extensions (e.g.
``('fenced-code', 'footnotes', 'strikethrough')``) or an integer
(e.g. ``EXT_FENCED_CODE | EXT_FOOTNOTES | EXT_STRIKETHROUGH``).
``render_flags`` can be a ... | Convert markdown text to HTML.
``extensions`` can be a list or tuple of extensions (e.g.
``('fenced-code', 'footnotes', 'strikethrough')``) or an integer
(e.g. ``EXT_FENCED_CODE | EXT_FOOTNOTES | EXT_STRIKETHROUGH``).
``render_flags`` can be a list or tuple of flags (e.g.
``('skip-html', 'hard-wra... | https://github.com/FSX/misaka/blob/c13aff82d370d606ff61361db79c166a897641cf/misaka/api.py#L96-L125 |
FSX/misaka | misaka/api.py | smartypants | def smartypants(text):
"""
Transforms sequences of characters into HTML entities.
=================================== ===================== =========
Markdown HTML Result
=================================== ===================== =========
``'s``... | python | def smartypants(text):
"""
Transforms sequences of characters into HTML entities.
=================================== ===================== =========
Markdown HTML Result
=================================== ===================== =========
``'s``... | Transforms sequences of characters into HTML entities.
=================================== ===================== =========
Markdown HTML Result
=================================== ===================== =========
``'s`` (s, t, m, d, re, ll, ve) &rsq... | https://github.com/FSX/misaka/blob/c13aff82d370d606ff61361db79c166a897641cf/misaka/api.py#L128-L156 |
FSX/misaka | misaka/api.py | SaferHtmlRenderer.autolink | def autolink(self, raw_url, is_email):
"""
Filters links generated by the ``autolink`` extension.
"""
if self.check_url(raw_url):
url = self.rewrite_url(('mailto:' if is_email else '') + raw_url)
url = escape_html(url)
return '<a href="%s">%s</a>' % (u... | python | def autolink(self, raw_url, is_email):
"""
Filters links generated by the ``autolink`` extension.
"""
if self.check_url(raw_url):
url = self.rewrite_url(('mailto:' if is_email else '') + raw_url)
url = escape_html(url)
return '<a href="%s">%s</a>' % (u... | Filters links generated by the ``autolink`` extension. | https://github.com/FSX/misaka/blob/c13aff82d370d606ff61361db79c166a897641cf/misaka/api.py#L304-L313 |
FSX/misaka | misaka/api.py | SaferHtmlRenderer.image | def image(self, raw_url, title='', alt=''):
"""
Filters the ``src`` attribute of an image.
Note that filtering the source URL of an ``<img>`` tag is only a very
basic protection, and it's mostly useless in modern browsers (they block
JavaScript in there by default). An example o... | python | def image(self, raw_url, title='', alt=''):
"""
Filters the ``src`` attribute of an image.
Note that filtering the source URL of an ``<img>`` tag is only a very
basic protection, and it's mostly useless in modern browsers (they block
JavaScript in there by default). An example o... | Filters the ``src`` attribute of an image.
Note that filtering the source URL of an ``<img>`` tag is only a very
basic protection, and it's mostly useless in modern browsers (they block
JavaScript in there by default). An example of attack that filtering
does not thwart is phishing base... | https://github.com/FSX/misaka/blob/c13aff82d370d606ff61361db79c166a897641cf/misaka/api.py#L315-L335 |
FSX/misaka | misaka/api.py | SaferHtmlRenderer.link | def link(self, content, raw_url, title=''):
"""
Filters links.
"""
if self.check_url(raw_url):
url = self.rewrite_url(raw_url)
maybe_title = ' title="%s"' % escape_html(title) if title else ''
url = escape_html(url)
return ('<a href="%s"%s>... | python | def link(self, content, raw_url, title=''):
"""
Filters links.
"""
if self.check_url(raw_url):
url = self.rewrite_url(raw_url)
maybe_title = ' title="%s"' % escape_html(title) if title else ''
url = escape_html(url)
return ('<a href="%s"%s>... | Filters links. | https://github.com/FSX/misaka/blob/c13aff82d370d606ff61361db79c166a897641cf/misaka/api.py#L337-L347 |
FSX/misaka | misaka/api.py | SaferHtmlRenderer.check_url | def check_url(self, url, is_image_src=False):
"""
This method is used to check a URL.
Returns :obj:`True` if the URL is "safe", :obj:`False` otherwise.
The default implementation only allows HTTP and HTTPS links. That means
no ``mailto:``, no ``xmpp:``, no ``ftp:``, etc.
... | python | def check_url(self, url, is_image_src=False):
"""
This method is used to check a URL.
Returns :obj:`True` if the URL is "safe", :obj:`False` otherwise.
The default implementation only allows HTTP and HTTPS links. That means
no ``mailto:``, no ``xmpp:``, no ``ftp:``, etc.
... | This method is used to check a URL.
Returns :obj:`True` if the URL is "safe", :obj:`False` otherwise.
The default implementation only allows HTTP and HTTPS links. That means
no ``mailto:``, no ``xmpp:``, no ``ftp:``, etc.
This method exists specifically to allow easy customization of ... | https://github.com/FSX/misaka/blob/c13aff82d370d606ff61361db79c166a897641cf/misaka/api.py#L349-L365 |
FSX/misaka | misaka/api.py | SaferHtmlRenderer.rewrite_url | def rewrite_url(self, url, is_image_src=False):
"""
This method is called to rewrite URLs.
It uses either ``self.link_rewrite`` or ``self.img_src_rewrite``
depending on the value of ``is_image_src``. The URL is returned
unchanged if the corresponding attribute is :obj:`None`.
... | python | def rewrite_url(self, url, is_image_src=False):
"""
This method is called to rewrite URLs.
It uses either ``self.link_rewrite`` or ``self.img_src_rewrite``
depending on the value of ``is_image_src``. The URL is returned
unchanged if the corresponding attribute is :obj:`None`.
... | This method is called to rewrite URLs.
It uses either ``self.link_rewrite`` or ``self.img_src_rewrite``
depending on the value of ``is_image_src``. The URL is returned
unchanged if the corresponding attribute is :obj:`None`. | https://github.com/FSX/misaka/blob/c13aff82d370d606ff61361db79c166a897641cf/misaka/api.py#L367-L378 |
FSX/misaka | misaka/utils.py | args_to_int | def args_to_int(mapping, argument):
"""
Convert list of strings to an int using a mapping.
"""
if isinstance(argument, int):
if argument == 0:
return 0
deprecation('passing extensions and flags as constants is deprecated')
return argument
elif isinstance(argument,... | python | def args_to_int(mapping, argument):
"""
Convert list of strings to an int using a mapping.
"""
if isinstance(argument, int):
if argument == 0:
return 0
deprecation('passing extensions and flags as constants is deprecated')
return argument
elif isinstance(argument,... | Convert list of strings to an int using a mapping. | https://github.com/FSX/misaka/blob/c13aff82d370d606ff61361db79c166a897641cf/misaka/utils.py#L40-L51 |
vsergeev/u-msgpack-python | umsgpack.py | _pack3 | def _pack3(obj, fp, **options):
"""
Serialize a Python object into MessagePack bytes.
Args:
obj: a Python object
fp: a .write()-supporting file-like object
Kwargs:
ext_handlers (dict): dictionary of Ext handlers, mapping a custom type
to a callable ... | python | def _pack3(obj, fp, **options):
"""
Serialize a Python object into MessagePack bytes.
Args:
obj: a Python object
fp: a .write()-supporting file-like object
Kwargs:
ext_handlers (dict): dictionary of Ext handlers, mapping a custom type
to a callable ... | Serialize a Python object into MessagePack bytes.
Args:
obj: a Python object
fp: a .write()-supporting file-like object
Kwargs:
ext_handlers (dict): dictionary of Ext handlers, mapping a custom type
to a callable that packs an instance of the type
... | https://github.com/vsergeev/u-msgpack-python/blob/e290b768ce63177ae04ed96402915b75a9741f38/umsgpack.py#L486-L555 |
GoogleCloudPlatform/appengine-pipelines | python/src/pipeline/util.py | _get_task_target | def _get_task_target():
"""Get the default target for a pipeline task.
Current version id format is: user_defined_version.minor_version_number
Current module id is just the module's name. It could be "default"
Returns:
A complete target name is of format version.module. If module is the
default module, ... | python | def _get_task_target():
"""Get the default target for a pipeline task.
Current version id format is: user_defined_version.minor_version_number
Current module id is just the module's name. It could be "default"
Returns:
A complete target name is of format version.module. If module is the
default module, ... | Get the default target for a pipeline task.
Current version id format is: user_defined_version.minor_version_number
Current module id is just the module's name. It could be "default"
Returns:
A complete target name is of format version.module. If module is the
default module, just version. None if target ... | https://github.com/GoogleCloudPlatform/appengine-pipelines/blob/277394648dac3e8214677af898935d07399ac8e1/python/src/pipeline/util.py#L40-L66 |
GoogleCloudPlatform/appengine-pipelines | python/src/pipeline/util.py | for_name | def for_name(fq_name, recursive=False):
"""Find class/function/method specified by its fully qualified name.
Fully qualified can be specified as:
* <module_name>.<class_name>
* <module_name>.<function_name>
* <module_name>.<class_name>.<method_name> (an unbound method will be
returned in this cas... | python | def for_name(fq_name, recursive=False):
"""Find class/function/method specified by its fully qualified name.
Fully qualified can be specified as:
* <module_name>.<class_name>
* <module_name>.<function_name>
* <module_name>.<class_name>.<method_name> (an unbound method will be
returned in this cas... | Find class/function/method specified by its fully qualified name.
Fully qualified can be specified as:
* <module_name>.<class_name>
* <module_name>.<function_name>
* <module_name>.<class_name>.<method_name> (an unbound method will be
returned in this case).
for_name works by doing __import__ for... | https://github.com/GoogleCloudPlatform/appengine-pipelines/blob/277394648dac3e8214677af898935d07399ac8e1/python/src/pipeline/util.py#L69-L133 |
GoogleCloudPlatform/appengine-pipelines | python/src/pipeline/util.py | is_generator_function | def is_generator_function(obj):
"""Return true if the object is a user-defined generator function.
Generator function objects provides same attributes as functions.
See isfunction.__doc__ for attributes listing.
Adapted from Python 2.6.
Args:
obj: an object to test.
Returns:
true if the object i... | python | def is_generator_function(obj):
"""Return true if the object is a user-defined generator function.
Generator function objects provides same attributes as functions.
See isfunction.__doc__ for attributes listing.
Adapted from Python 2.6.
Args:
obj: an object to test.
Returns:
true if the object i... | Return true if the object is a user-defined generator function.
Generator function objects provides same attributes as functions.
See isfunction.__doc__ for attributes listing.
Adapted from Python 2.6.
Args:
obj: an object to test.
Returns:
true if the object is generator function. | https://github.com/GoogleCloudPlatform/appengine-pipelines/blob/277394648dac3e8214677af898935d07399ac8e1/python/src/pipeline/util.py#L136-L152 |
GoogleCloudPlatform/appengine-pipelines | python/src/pipeline/util.py | _register_json_primitive | def _register_json_primitive(object_type, encoder, decoder):
"""Extend what Pipeline can serialize.
Args:
object_type: type of the object.
encoder: a function that takes in an object and returns
a dict of json primitives.
decoder: inverse function of encoder.
"""
global _TYPE_TO_ENCODER
glo... | python | def _register_json_primitive(object_type, encoder, decoder):
"""Extend what Pipeline can serialize.
Args:
object_type: type of the object.
encoder: a function that takes in an object and returns
a dict of json primitives.
decoder: inverse function of encoder.
"""
global _TYPE_TO_ENCODER
glo... | Extend what Pipeline can serialize.
Args:
object_type: type of the object.
encoder: a function that takes in an object and returns
a dict of json primitives.
decoder: inverse function of encoder. | https://github.com/GoogleCloudPlatform/appengine-pipelines/blob/277394648dac3e8214677af898935d07399ac8e1/python/src/pipeline/util.py#L211-L224 |
GoogleCloudPlatform/appengine-pipelines | python/src/pipeline/util.py | _JsonDecodeKey | def _JsonDecodeKey(d):
"""Json decode a ndb.Key object."""
k_c = d['key_string']
if isinstance(k_c, (list, tuple)):
return ndb.Key(flat=k_c)
return ndb.Key(urlsafe=d['key_string']) | python | def _JsonDecodeKey(d):
"""Json decode a ndb.Key object."""
k_c = d['key_string']
if isinstance(k_c, (list, tuple)):
return ndb.Key(flat=k_c)
return ndb.Key(urlsafe=d['key_string']) | Json decode a ndb.Key object. | https://github.com/GoogleCloudPlatform/appengine-pipelines/blob/277394648dac3e8214677af898935d07399ac8e1/python/src/pipeline/util.py#L238-L243 |
GoogleCloudPlatform/appengine-pipelines | python/src/pipeline/util.py | JsonEncoder.default | def default(self, o):
"""Inherit docs."""
if type(o) in _TYPE_TO_ENCODER:
encoder = _TYPE_TO_ENCODER[type(o)]
json_struct = encoder(o)
json_struct[self.TYPE_ID] = type(o).__name__
return json_struct
return super(JsonEncoder, self).default(o) | python | def default(self, o):
"""Inherit docs."""
if type(o) in _TYPE_TO_ENCODER:
encoder = _TYPE_TO_ENCODER[type(o)]
json_struct = encoder(o)
json_struct[self.TYPE_ID] = type(o).__name__
return json_struct
return super(JsonEncoder, self).default(o) | Inherit docs. | https://github.com/GoogleCloudPlatform/appengine-pipelines/blob/277394648dac3e8214677af898935d07399ac8e1/python/src/pipeline/util.py#L160-L167 |
GoogleCloudPlatform/appengine-pipelines | python/src/pipeline/util.py | JsonDecoder._dict_to_obj | def _dict_to_obj(self, d):
"""Converts a dictionary of json object to a Python object."""
if JsonEncoder.TYPE_ID not in d:
return d
type_name = d.pop(JsonEncoder.TYPE_ID)
if type_name in _TYPE_NAME_TO_DECODER:
decoder = _TYPE_NAME_TO_DECODER[type_name]
return decoder(d)
else:
... | python | def _dict_to_obj(self, d):
"""Converts a dictionary of json object to a Python object."""
if JsonEncoder.TYPE_ID not in d:
return d
type_name = d.pop(JsonEncoder.TYPE_ID)
if type_name in _TYPE_NAME_TO_DECODER:
decoder = _TYPE_NAME_TO_DECODER[type_name]
return decoder(d)
else:
... | Converts a dictionary of json object to a Python object. | https://github.com/GoogleCloudPlatform/appengine-pipelines/blob/277394648dac3e8214677af898935d07399ac8e1/python/src/pipeline/util.py#L178-L188 |
GoogleCloudPlatform/appengine-pipelines | python/src/pipeline/pipeline.py | _short_repr | def _short_repr(obj):
"""Helper function returns a truncated repr() of an object."""
stringified = pprint.saferepr(obj)
if len(stringified) > 200:
return '%s... (%d bytes)' % (stringified[:200], len(stringified))
return stringified | python | def _short_repr(obj):
"""Helper function returns a truncated repr() of an object."""
stringified = pprint.saferepr(obj)
if len(stringified) > 200:
return '%s... (%d bytes)' % (stringified[:200], len(stringified))
return stringified | Helper function returns a truncated repr() of an object. | https://github.com/GoogleCloudPlatform/appengine-pipelines/blob/277394648dac3e8214677af898935d07399ac8e1/python/src/pipeline/pipeline.py#L1233-L1238 |
GoogleCloudPlatform/appengine-pipelines | python/src/pipeline/pipeline.py | _write_json_blob | def _write_json_blob(encoded_value, pipeline_id=None):
"""Writes a JSON encoded value to a Cloud Storage File.
This function will store the blob in a GCS file in the default bucket under
the appengine_pipeline directory. Optionally using another directory level
specified by pipeline_id
Args:
encoded_valu... | python | def _write_json_blob(encoded_value, pipeline_id=None):
"""Writes a JSON encoded value to a Cloud Storage File.
This function will store the blob in a GCS file in the default bucket under
the appengine_pipeline directory. Optionally using another directory level
specified by pipeline_id
Args:
encoded_valu... | Writes a JSON encoded value to a Cloud Storage File.
This function will store the blob in a GCS file in the default bucket under
the appengine_pipeline directory. Optionally using another directory level
specified by pipeline_id
Args:
encoded_value: The encoded JSON string.
pipeline_id: A pipeline id t... | https://github.com/GoogleCloudPlatform/appengine-pipelines/blob/277394648dac3e8214677af898935d07399ac8e1/python/src/pipeline/pipeline.py#L1241-L1276 |
GoogleCloudPlatform/appengine-pipelines | python/src/pipeline/pipeline.py | _dereference_args | def _dereference_args(pipeline_name, args, kwargs):
"""Dereference a Pipeline's arguments that are slots, validating them.
Each argument value passed in is assumed to be a dictionary with the format:
{'type': 'value', 'value': 'serializable'} # A resolved value.
{'type': 'slot', 'slot_key': 'str() on a db... | python | def _dereference_args(pipeline_name, args, kwargs):
"""Dereference a Pipeline's arguments that are slots, validating them.
Each argument value passed in is assumed to be a dictionary with the format:
{'type': 'value', 'value': 'serializable'} # A resolved value.
{'type': 'slot', 'slot_key': 'str() on a db... | Dereference a Pipeline's arguments that are slots, validating them.
Each argument value passed in is assumed to be a dictionary with the format:
{'type': 'value', 'value': 'serializable'} # A resolved value.
{'type': 'slot', 'slot_key': 'str() on a db.Key'} # A pending Slot.
Args:
pipeline_name: The... | https://github.com/GoogleCloudPlatform/appengine-pipelines/blob/277394648dac3e8214677af898935d07399ac8e1/python/src/pipeline/pipeline.py#L1279-L1332 |
GoogleCloudPlatform/appengine-pipelines | python/src/pipeline/pipeline.py | _generate_args | def _generate_args(pipeline, future, queue_name, base_path):
"""Generate the params used to describe a Pipeline's depedencies.
The arguments passed to this method may be normal values, Slot instances
(for named outputs), or PipelineFuture instances (for referring to the
default output slot).
Args:
pipel... | python | def _generate_args(pipeline, future, queue_name, base_path):
"""Generate the params used to describe a Pipeline's depedencies.
The arguments passed to this method may be normal values, Slot instances
(for named outputs), or PipelineFuture instances (for referring to the
default output slot).
Args:
pipel... | Generate the params used to describe a Pipeline's depedencies.
The arguments passed to this method may be normal values, Slot instances
(for named outputs), or PipelineFuture instances (for referring to the
default output slot).
Args:
pipeline: The Pipeline instance to generate args for.
future: The P... | https://github.com/GoogleCloudPlatform/appengine-pipelines/blob/277394648dac3e8214677af898935d07399ac8e1/python/src/pipeline/pipeline.py#L1335-L1419 |
GoogleCloudPlatform/appengine-pipelines | python/src/pipeline/pipeline.py | _get_timestamp_ms | def _get_timestamp_ms(when):
"""Converts a datetime.datetime to integer milliseconds since the epoch.
Requires special handling to preserve microseconds.
Args:
when: A datetime.datetime instance.
Returns:
Integer time since the epoch in milliseconds. If the supplied 'when' is
None, the return val... | python | def _get_timestamp_ms(when):
"""Converts a datetime.datetime to integer milliseconds since the epoch.
Requires special handling to preserve microseconds.
Args:
when: A datetime.datetime instance.
Returns:
Integer time since the epoch in milliseconds. If the supplied 'when' is
None, the return val... | Converts a datetime.datetime to integer milliseconds since the epoch.
Requires special handling to preserve microseconds.
Args:
when: A datetime.datetime instance.
Returns:
Integer time since the epoch in milliseconds. If the supplied 'when' is
None, the return value will be None. | https://github.com/GoogleCloudPlatform/appengine-pipelines/blob/277394648dac3e8214677af898935d07399ac8e1/python/src/pipeline/pipeline.py#L2872-L2888 |
GoogleCloudPlatform/appengine-pipelines | python/src/pipeline/pipeline.py | _get_internal_status | def _get_internal_status(pipeline_key=None,
pipeline_dict=None,
slot_dict=None,
barrier_dict=None,
status_dict=None):
"""Gets the UI dictionary of a pipeline from a set of status dictionaries.
Args:
pipeline_key... | python | def _get_internal_status(pipeline_key=None,
pipeline_dict=None,
slot_dict=None,
barrier_dict=None,
status_dict=None):
"""Gets the UI dictionary of a pipeline from a set of status dictionaries.
Args:
pipeline_key... | Gets the UI dictionary of a pipeline from a set of status dictionaries.
Args:
pipeline_key: The key of the pipeline to lookup.
pipeline_dict: Dictionary mapping pipeline db.Key to _PipelineRecord.
Default is an empty dictionary.
slot_dict: Dictionary mapping slot db.Key to _SlotRecord.
Defaul... | https://github.com/GoogleCloudPlatform/appengine-pipelines/blob/277394648dac3e8214677af898935d07399ac8e1/python/src/pipeline/pipeline.py#L2891-L3056 |
GoogleCloudPlatform/appengine-pipelines | python/src/pipeline/pipeline.py | _get_internal_slot | def _get_internal_slot(slot_key=None,
filler_pipeline_key=None,
slot_dict=None):
"""Gets information about a _SlotRecord for display in UI.
Args:
slot_key: The db.Key of the slot to fetch.
filler_pipeline_key: In the case the slot has not yet been filled, assum... | python | def _get_internal_slot(slot_key=None,
filler_pipeline_key=None,
slot_dict=None):
"""Gets information about a _SlotRecord for display in UI.
Args:
slot_key: The db.Key of the slot to fetch.
filler_pipeline_key: In the case the slot has not yet been filled, assum... | Gets information about a _SlotRecord for display in UI.
Args:
slot_key: The db.Key of the slot to fetch.
filler_pipeline_key: In the case the slot has not yet been filled, assume
that the given db.Key (for a _PipelineRecord) will be the filler of
the slot in the future.
slot_dict: The slot JS... | https://github.com/GoogleCloudPlatform/appengine-pipelines/blob/277394648dac3e8214677af898935d07399ac8e1/python/src/pipeline/pipeline.py#L3059-L3103 |
GoogleCloudPlatform/appengine-pipelines | python/src/pipeline/pipeline.py | get_status_tree | def get_status_tree(root_pipeline_id):
"""Gets the full status tree of a pipeline.
Args:
root_pipeline_id: The pipeline ID to get status for.
Returns:
Dictionary with the keys:
rootPipelineId: The ID of the root pipeline.
slots: Mapping of slot IDs to result of from _get_internal_slot.
... | python | def get_status_tree(root_pipeline_id):
"""Gets the full status tree of a pipeline.
Args:
root_pipeline_id: The pipeline ID to get status for.
Returns:
Dictionary with the keys:
rootPipelineId: The ID of the root pipeline.
slots: Mapping of slot IDs to result of from _get_internal_slot.
... | Gets the full status tree of a pipeline.
Args:
root_pipeline_id: The pipeline ID to get status for.
Returns:
Dictionary with the keys:
rootPipelineId: The ID of the root pipeline.
slots: Mapping of slot IDs to result of from _get_internal_slot.
pipelines: Mapping of pipeline IDs to resul... | https://github.com/GoogleCloudPlatform/appengine-pipelines/blob/277394648dac3e8214677af898935d07399ac8e1/python/src/pipeline/pipeline.py#L3106-L3203 |
GoogleCloudPlatform/appengine-pipelines | python/src/pipeline/pipeline.py | get_pipeline_names | def get_pipeline_names():
"""Returns the class paths of all Pipelines defined in alphabetical order."""
class_path_set = set()
for cls in _PipelineMeta._all_classes:
if cls.class_path is not None:
class_path_set.add(cls.class_path)
return sorted(class_path_set) | python | def get_pipeline_names():
"""Returns the class paths of all Pipelines defined in alphabetical order."""
class_path_set = set()
for cls in _PipelineMeta._all_classes:
if cls.class_path is not None:
class_path_set.add(cls.class_path)
return sorted(class_path_set) | Returns the class paths of all Pipelines defined in alphabetical order. | https://github.com/GoogleCloudPlatform/appengine-pipelines/blob/277394648dac3e8214677af898935d07399ac8e1/python/src/pipeline/pipeline.py#L3206-L3212 |
GoogleCloudPlatform/appengine-pipelines | python/src/pipeline/pipeline.py | get_root_list | def get_root_list(class_path=None, cursor=None, count=50):
"""Gets a list root Pipelines.
Args:
class_path: Optional. If supplied, only return root Pipelines with the
given class_path. By default all root pipelines are returned.
cursor: Optional. When supplied, the cursor returned from the last call ... | python | def get_root_list(class_path=None, cursor=None, count=50):
"""Gets a list root Pipelines.
Args:
class_path: Optional. If supplied, only return root Pipelines with the
given class_path. By default all root pipelines are returned.
cursor: Optional. When supplied, the cursor returned from the last call ... | Gets a list root Pipelines.
Args:
class_path: Optional. If supplied, only return root Pipelines with the
given class_path. By default all root pipelines are returned.
cursor: Optional. When supplied, the cursor returned from the last call to
get_root_list which indicates where to pick up.
cou... | https://github.com/GoogleCloudPlatform/appengine-pipelines/blob/277394648dac3e8214677af898935d07399ac8e1/python/src/pipeline/pipeline.py#L3215-L3287 |
GoogleCloudPlatform/appengine-pipelines | python/src/pipeline/pipeline.py | create_handlers_map | def create_handlers_map(prefix='.*'):
"""Create new handlers map.
Args:
prefix: url prefix to use.
Returns:
list of (regexp, handler) pairs for WSGIApplication constructor.
"""
return [
(prefix + '/output', _BarrierHandler),
(prefix + '/run', _PipelineHandler),
(prefix + '/finalize... | python | def create_handlers_map(prefix='.*'):
"""Create new handlers map.
Args:
prefix: url prefix to use.
Returns:
list of (regexp, handler) pairs for WSGIApplication constructor.
"""
return [
(prefix + '/output', _BarrierHandler),
(prefix + '/run', _PipelineHandler),
(prefix + '/finalize... | Create new handlers map.
Args:
prefix: url prefix to use.
Returns:
list of (regexp, handler) pairs for WSGIApplication constructor. | https://github.com/GoogleCloudPlatform/appengine-pipelines/blob/277394648dac3e8214677af898935d07399ac8e1/python/src/pipeline/pipeline.py#L3303-L3325 |
GoogleCloudPlatform/appengine-pipelines | python/src/pipeline/pipeline.py | Slot.value | def value(self):
"""Returns the current value of this slot.
Returns:
The value of the slot (a serializable Python type).
Raises:
SlotNotFilledError if the value hasn't been filled yet.
"""
if not self.filled:
raise SlotNotFilledError('Slot with name "%s", key "%s" not yet filled.... | python | def value(self):
"""Returns the current value of this slot.
Returns:
The value of the slot (a serializable Python type).
Raises:
SlotNotFilledError if the value hasn't been filled yet.
"""
if not self.filled:
raise SlotNotFilledError('Slot with name "%s", key "%s" not yet filled.... | Returns the current value of this slot.
Returns:
The value of the slot (a serializable Python type).
Raises:
SlotNotFilledError if the value hasn't been filled yet. | https://github.com/GoogleCloudPlatform/appengine-pipelines/blob/277394648dac3e8214677af898935d07399ac8e1/python/src/pipeline/pipeline.py#L203-L215 |
GoogleCloudPlatform/appengine-pipelines | python/src/pipeline/pipeline.py | Slot.filler | def filler(self):
"""Returns the pipeline ID that filled this slot's value.
Returns:
A string that is the pipeline ID.
Raises:
SlotNotFilledError if the value hasn't been filled yet.
"""
if not self.filled:
raise SlotNotFilledError('Slot with name "%s", key "%s" not yet filled.'
... | python | def filler(self):
"""Returns the pipeline ID that filled this slot's value.
Returns:
A string that is the pipeline ID.
Raises:
SlotNotFilledError if the value hasn't been filled yet.
"""
if not self.filled:
raise SlotNotFilledError('Slot with name "%s", key "%s" not yet filled.'
... | Returns the pipeline ID that filled this slot's value.
Returns:
A string that is the pipeline ID.
Raises:
SlotNotFilledError if the value hasn't been filled yet. | https://github.com/GoogleCloudPlatform/appengine-pipelines/blob/277394648dac3e8214677af898935d07399ac8e1/python/src/pipeline/pipeline.py#L218-L230 |
GoogleCloudPlatform/appengine-pipelines | python/src/pipeline/pipeline.py | Slot.fill_datetime | def fill_datetime(self):
"""Returns when the slot was filled.
Returns:
A datetime.datetime.
Raises:
SlotNotFilledError if the value hasn't been filled yet.
"""
if not self.filled:
raise SlotNotFilledError('Slot with name "%s", key "%s" not yet filled.'
... | python | def fill_datetime(self):
"""Returns when the slot was filled.
Returns:
A datetime.datetime.
Raises:
SlotNotFilledError if the value hasn't been filled yet.
"""
if not self.filled:
raise SlotNotFilledError('Slot with name "%s", key "%s" not yet filled.'
... | Returns when the slot was filled.
Returns:
A datetime.datetime.
Raises:
SlotNotFilledError if the value hasn't been filled yet. | https://github.com/GoogleCloudPlatform/appengine-pipelines/blob/277394648dac3e8214677af898935d07399ac8e1/python/src/pipeline/pipeline.py#L233-L245 |
GoogleCloudPlatform/appengine-pipelines | python/src/pipeline/pipeline.py | Slot._set_value | def _set_value(self, slot_record):
"""Sets the value of this slot based on its corresponding _SlotRecord.
Does nothing if the slot has not yet been filled.
Args:
slot_record: The _SlotRecord containing this Slot's value.
"""
if slot_record.status == _SlotRecord.FILLED:
self.filled = Tr... | python | def _set_value(self, slot_record):
"""Sets the value of this slot based on its corresponding _SlotRecord.
Does nothing if the slot has not yet been filled.
Args:
slot_record: The _SlotRecord containing this Slot's value.
"""
if slot_record.status == _SlotRecord.FILLED:
self.filled = Tr... | Sets the value of this slot based on its corresponding _SlotRecord.
Does nothing if the slot has not yet been filled.
Args:
slot_record: The _SlotRecord containing this Slot's value. | https://github.com/GoogleCloudPlatform/appengine-pipelines/blob/277394648dac3e8214677af898935d07399ac8e1/python/src/pipeline/pipeline.py#L247-L260 |
GoogleCloudPlatform/appengine-pipelines | python/src/pipeline/pipeline.py | PipelineFuture._inherit_outputs | def _inherit_outputs(self,
pipeline_name,
already_defined,
resolve_outputs=False):
"""Inherits outputs from a calling Pipeline.
Args:
pipeline_name: The Pipeline class name (used for debugging).
already_defined: Maps output name t... | python | def _inherit_outputs(self,
pipeline_name,
already_defined,
resolve_outputs=False):
"""Inherits outputs from a calling Pipeline.
Args:
pipeline_name: The Pipeline class name (used for debugging).
already_defined: Maps output name t... | Inherits outputs from a calling Pipeline.
Args:
pipeline_name: The Pipeline class name (used for debugging).
already_defined: Maps output name to stringified db.Key (of _SlotRecords)
of any exiting output slots to be inherited by this future.
resolve_outputs: When True, this method will d... | https://github.com/GoogleCloudPlatform/appengine-pipelines/blob/277394648dac3e8214677af898935d07399ac8e1/python/src/pipeline/pipeline.py#L314-L358 |
GoogleCloudPlatform/appengine-pipelines | python/src/pipeline/pipeline.py | Pipeline.from_id | def from_id(cls, pipeline_id, resolve_outputs=True, _pipeline_record=None):
"""Returns an instance corresponding to an existing Pipeline.
The returned object will have the same properties a Pipeline does while
it's running synchronously (e.g., like what it's first allocated), allowing
callers to inspec... | python | def from_id(cls, pipeline_id, resolve_outputs=True, _pipeline_record=None):
"""Returns an instance corresponding to an existing Pipeline.
The returned object will have the same properties a Pipeline does while
it's running synchronously (e.g., like what it's first allocated), allowing
callers to inspec... | Returns an instance corresponding to an existing Pipeline.
The returned object will have the same properties a Pipeline does while
it's running synchronously (e.g., like what it's first allocated), allowing
callers to inspect caller arguments, outputs, fill slots, complete the
pipeline, abort, retry, e... | https://github.com/GoogleCloudPlatform/appengine-pipelines/blob/277394648dac3e8214677af898935d07399ac8e1/python/src/pipeline/pipeline.py#L544-L609 |
GoogleCloudPlatform/appengine-pipelines | python/src/pipeline/pipeline.py | Pipeline.start | def start(self,
idempotence_key='',
queue_name='default',
base_path='/_ah/pipeline',
return_task=False,
countdown=None,
eta=None):
"""Starts a new instance of this pipeline.
Args:
idempotence_key: The ID to use for this Pipeline and ... | python | def start(self,
idempotence_key='',
queue_name='default',
base_path='/_ah/pipeline',
return_task=False,
countdown=None,
eta=None):
"""Starts a new instance of this pipeline.
Args:
idempotence_key: The ID to use for this Pipeline and ... | Starts a new instance of this pipeline.
Args:
idempotence_key: The ID to use for this Pipeline and throughout its
asynchronous workflow to ensure the operations are idempotent. If
empty a starting key will be automatically assigned.
queue_name: What queue this Pipeline's workflow should... | https://github.com/GoogleCloudPlatform/appengine-pipelines/blob/277394648dac3e8214677af898935d07399ac8e1/python/src/pipeline/pipeline.py#L613-L673 |
GoogleCloudPlatform/appengine-pipelines | python/src/pipeline/pipeline.py | Pipeline.retry | def retry(self, retry_message=''):
"""Forces a currently running asynchronous pipeline to retry.
Note this may not be called by synchronous or generator pipelines. Those
must instead raise the 'Retry' exception during execution.
Args:
retry_message: Optional message explaining why the retry happ... | python | def retry(self, retry_message=''):
"""Forces a currently running asynchronous pipeline to retry.
Note this may not be called by synchronous or generator pipelines. Those
must instead raise the 'Retry' exception during execution.
Args:
retry_message: Optional message explaining why the retry happ... | Forces a currently running asynchronous pipeline to retry.
Note this may not be called by synchronous or generator pipelines. Those
must instead raise the 'Retry' exception during execution.
Args:
retry_message: Optional message explaining why the retry happened.
Returns:
True if the Pipe... | https://github.com/GoogleCloudPlatform/appengine-pipelines/blob/277394648dac3e8214677af898935d07399ac8e1/python/src/pipeline/pipeline.py#L693-L713 |
GoogleCloudPlatform/appengine-pipelines | python/src/pipeline/pipeline.py | Pipeline.abort | def abort(self, abort_message=''):
"""Mark the entire pipeline up to the root as aborted.
Note this should only be called from *outside* the context of a running
pipeline. Synchronous and generator pipelines should raise the 'Abort'
exception to cause this behavior during execution.
Args:
ab... | python | def abort(self, abort_message=''):
"""Mark the entire pipeline up to the root as aborted.
Note this should only be called from *outside* the context of a running
pipeline. Synchronous and generator pipelines should raise the 'Abort'
exception to cause this behavior during execution.
Args:
ab... | Mark the entire pipeline up to the root as aborted.
Note this should only be called from *outside* the context of a running
pipeline. Synchronous and generator pipelines should raise the 'Abort'
exception to cause this behavior during execution.
Args:
abort_message: Optional message explaining w... | https://github.com/GoogleCloudPlatform/appengine-pipelines/blob/277394648dac3e8214677af898935d07399ac8e1/python/src/pipeline/pipeline.py#L715-L738 |
GoogleCloudPlatform/appengine-pipelines | python/src/pipeline/pipeline.py | Pipeline.fill | def fill(self, name_or_slot, value):
"""Fills an output slot required by this Pipeline.
Args:
name_or_slot: The name of the slot (a string) or Slot record to fill.
value: The serializable value to assign to this slot.
Raises:
UnexpectedPipelineError if the Slot no longer exists. SlotNotD... | python | def fill(self, name_or_slot, value):
"""Fills an output slot required by this Pipeline.
Args:
name_or_slot: The name of the slot (a string) or Slot record to fill.
value: The serializable value to assign to this slot.
Raises:
UnexpectedPipelineError if the Slot no longer exists. SlotNotD... | Fills an output slot required by this Pipeline.
Args:
name_or_slot: The name of the slot (a string) or Slot record to fill.
value: The serializable value to assign to this slot.
Raises:
UnexpectedPipelineError if the Slot no longer exists. SlotNotDeclaredError
if trying to output to a ... | https://github.com/GoogleCloudPlatform/appengine-pipelines/blob/277394648dac3e8214677af898935d07399ac8e1/python/src/pipeline/pipeline.py#L741-L765 |
GoogleCloudPlatform/appengine-pipelines | python/src/pipeline/pipeline.py | Pipeline.set_status | def set_status(self, message=None, console_url=None, status_links=None):
"""Sets the current status of this pipeline.
This method is purposefully non-transactional. Updates are written to the
datastore immediately and overwrite all existing statuses.
Args:
message: (optional) Overall status mess... | python | def set_status(self, message=None, console_url=None, status_links=None):
"""Sets the current status of this pipeline.
This method is purposefully non-transactional. Updates are written to the
datastore immediately and overwrite all existing statuses.
Args:
message: (optional) Overall status mess... | Sets the current status of this pipeline.
This method is purposefully non-transactional. Updates are written to the
datastore immediately and overwrite all existing statuses.
Args:
message: (optional) Overall status message.
console_url: (optional) Relative URL to use for the "console" of this... | https://github.com/GoogleCloudPlatform/appengine-pipelines/blob/277394648dac3e8214677af898935d07399ac8e1/python/src/pipeline/pipeline.py#L767-L815 |
GoogleCloudPlatform/appengine-pipelines | python/src/pipeline/pipeline.py | Pipeline.complete | def complete(self, default_output=None):
"""Marks this asynchronous Pipeline as complete.
Args:
default_output: What value the 'default' output slot should be assigned.
Raises:
UnexpectedPipelineError if the slot no longer exists or this method was
called for a pipeline that is not async... | python | def complete(self, default_output=None):
"""Marks this asynchronous Pipeline as complete.
Args:
default_output: What value the 'default' output slot should be assigned.
Raises:
UnexpectedPipelineError if the slot no longer exists or this method was
called for a pipeline that is not async... | Marks this asynchronous Pipeline as complete.
Args:
default_output: What value the 'default' output slot should be assigned.
Raises:
UnexpectedPipelineError if the slot no longer exists or this method was
called for a pipeline that is not async. | https://github.com/GoogleCloudPlatform/appengine-pipelines/blob/277394648dac3e8214677af898935d07399ac8e1/python/src/pipeline/pipeline.py#L817-L834 |
GoogleCloudPlatform/appengine-pipelines | python/src/pipeline/pipeline.py | Pipeline.get_callback_url | def get_callback_url(self, **kwargs):
"""Returns a relative URL for invoking this Pipeline's callback method.
Args:
kwargs: Dictionary mapping keyword argument names to single values that
should be passed to the callback when it is invoked.
Raises:
UnexpectedPipelineError if this is in... | python | def get_callback_url(self, **kwargs):
"""Returns a relative URL for invoking this Pipeline's callback method.
Args:
kwargs: Dictionary mapping keyword argument names to single values that
should be passed to the callback when it is invoked.
Raises:
UnexpectedPipelineError if this is in... | Returns a relative URL for invoking this Pipeline's callback method.
Args:
kwargs: Dictionary mapping keyword argument names to single values that
should be passed to the callback when it is invoked.
Raises:
UnexpectedPipelineError if this is invoked on pipeline that is not async. | https://github.com/GoogleCloudPlatform/appengine-pipelines/blob/277394648dac3e8214677af898935d07399ac8e1/python/src/pipeline/pipeline.py#L836-L852 |
GoogleCloudPlatform/appengine-pipelines | python/src/pipeline/pipeline.py | Pipeline.get_callback_task | def get_callback_task(self, *args, **kwargs):
"""Returns a task for calling back this Pipeline.
Args:
params: Keyword argument containing a dictionary of key/value pairs
that will be passed to the callback when it is executed.
args, kwargs: Passed to the taskqueue.Task constructor. Use thes... | python | def get_callback_task(self, *args, **kwargs):
"""Returns a task for calling back this Pipeline.
Args:
params: Keyword argument containing a dictionary of key/value pairs
that will be passed to the callback when it is executed.
args, kwargs: Passed to the taskqueue.Task constructor. Use thes... | Returns a task for calling back this Pipeline.
Args:
params: Keyword argument containing a dictionary of key/value pairs
that will be passed to the callback when it is executed.
args, kwargs: Passed to the taskqueue.Task constructor. Use these
arguments to set the task name (for idempot... | https://github.com/GoogleCloudPlatform/appengine-pipelines/blob/277394648dac3e8214677af898935d07399ac8e1/python/src/pipeline/pipeline.py#L854-L875 |
GoogleCloudPlatform/appengine-pipelines | python/src/pipeline/pipeline.py | Pipeline.send_result_email | def send_result_email(self, sender=None):
"""Sends an email to admins indicating this Pipeline has completed.
For developer convenience. Automatically called from finalized for root
Pipelines that do not override the default action.
Args:
sender: (optional) Override the sender's email address.
... | python | def send_result_email(self, sender=None):
"""Sends an email to admins indicating this Pipeline has completed.
For developer convenience. Automatically called from finalized for root
Pipelines that do not override the default action.
Args:
sender: (optional) Override the sender's email address.
... | Sends an email to admins indicating this Pipeline has completed.
For developer convenience. Automatically called from finalized for root
Pipelines that do not override the default action.
Args:
sender: (optional) Override the sender's email address. | https://github.com/GoogleCloudPlatform/appengine-pipelines/blob/277394648dac3e8214677af898935d07399ac8e1/python/src/pipeline/pipeline.py#L877-L935 |
GoogleCloudPlatform/appengine-pipelines | python/src/pipeline/pipeline.py | Pipeline.cleanup | def cleanup(self):
"""Clean up this Pipeline and all Datastore records used for coordination.
Only works when called on a root pipeline. Child pipelines will ignore
calls to this method.
After this method is called, Pipeline.from_id() and related status
methods will return inconsistent or missing ... | python | def cleanup(self):
"""Clean up this Pipeline and all Datastore records used for coordination.
Only works when called on a root pipeline. Child pipelines will ignore
calls to this method.
After this method is called, Pipeline.from_id() and related status
methods will return inconsistent or missing ... | Clean up this Pipeline and all Datastore records used for coordination.
Only works when called on a root pipeline. Child pipelines will ignore
calls to this method.
After this method is called, Pipeline.from_id() and related status
methods will return inconsistent or missing results. This method is
... | https://github.com/GoogleCloudPlatform/appengine-pipelines/blob/277394648dac3e8214677af898935d07399ac8e1/python/src/pipeline/pipeline.py#L937-L956 |
GoogleCloudPlatform/appengine-pipelines | python/src/pipeline/pipeline.py | Pipeline.with_params | def with_params(self, **kwargs):
"""Modify various execution parameters of a Pipeline before it runs.
This method has no effect in test mode.
Args:
kwargs: Attributes to modify on this Pipeline instance before it has
been executed.
Returns:
This Pipeline instance, for easy chainin... | python | def with_params(self, **kwargs):
"""Modify various execution parameters of a Pipeline before it runs.
This method has no effect in test mode.
Args:
kwargs: Attributes to modify on this Pipeline instance before it has
been executed.
Returns:
This Pipeline instance, for easy chainin... | Modify various execution parameters of a Pipeline before it runs.
This method has no effect in test mode.
Args:
kwargs: Attributes to modify on this Pipeline instance before it has
been executed.
Returns:
This Pipeline instance, for easy chaining. | https://github.com/GoogleCloudPlatform/appengine-pipelines/blob/277394648dac3e8214677af898935d07399ac8e1/python/src/pipeline/pipeline.py#L958-L986 |
GoogleCloudPlatform/appengine-pipelines | python/src/pipeline/pipeline.py | Pipeline._set_class_path | def _set_class_path(cls, module_dict=sys.modules):
"""Sets the absolute path to this class as a string.
Used by the Pipeline API to reconstruct the Pipeline sub-class object
at execution time instead of passing around a serialized function.
Args:
module_dict: Used for testing.
"""
# Do n... | python | def _set_class_path(cls, module_dict=sys.modules):
"""Sets the absolute path to this class as a string.
Used by the Pipeline API to reconstruct the Pipeline sub-class object
at execution time instead of passing around a serialized function.
Args:
module_dict: Used for testing.
"""
# Do n... | Sets the absolute path to this class as a string.
Used by the Pipeline API to reconstruct the Pipeline sub-class object
at execution time instead of passing around a serialized function.
Args:
module_dict: Used for testing. | https://github.com/GoogleCloudPlatform/appengine-pipelines/blob/277394648dac3e8214677af898935d07399ac8e1/python/src/pipeline/pipeline.py#L1035-L1068 |
GoogleCloudPlatform/appengine-pipelines | python/src/pipeline/pipeline.py | Pipeline._set_values_internal | def _set_values_internal(self,
context,
pipeline_key,
root_pipeline_key,
outputs,
result_status):
"""Sets the user-visible values provided as an API by this class.
Args:
... | python | def _set_values_internal(self,
context,
pipeline_key,
root_pipeline_key,
outputs,
result_status):
"""Sets the user-visible values provided as an API by this class.
Args:
... | Sets the user-visible values provided as an API by this class.
Args:
context: The _PipelineContext used for this Pipeline.
pipeline_key: The db.Key of this pipeline.
root_pipeline_key: The db.Key of the root pipeline.
outputs: The PipelineFuture for this pipeline.
result_status: The r... | https://github.com/GoogleCloudPlatform/appengine-pipelines/blob/277394648dac3e8214677af898935d07399ac8e1/python/src/pipeline/pipeline.py#L1070-L1089 |
GoogleCloudPlatform/appengine-pipelines | python/src/pipeline/pipeline.py | Pipeline._callback_internal | def _callback_internal(self, kwargs):
"""Used to execute callbacks on asynchronous pipelines."""
logging.debug('Callback %s(*%s, **%s)#%s with params: %r',
self._class_path, _short_repr(self.args),
_short_repr(self.kwargs), self._pipeline_key.name(), kwargs)
return self.c... | python | def _callback_internal(self, kwargs):
"""Used to execute callbacks on asynchronous pipelines."""
logging.debug('Callback %s(*%s, **%s)#%s with params: %r',
self._class_path, _short_repr(self.args),
_short_repr(self.kwargs), self._pipeline_key.name(), kwargs)
return self.c... | Used to execute callbacks on asynchronous pipelines. | https://github.com/GoogleCloudPlatform/appengine-pipelines/blob/277394648dac3e8214677af898935d07399ac8e1/python/src/pipeline/pipeline.py#L1091-L1096 |
GoogleCloudPlatform/appengine-pipelines | python/src/pipeline/pipeline.py | Pipeline._run_internal | def _run_internal(self,
context,
pipeline_key,
root_pipeline_key,
caller_output):
"""Used by the Pipeline evaluator to execute this Pipeline."""
self._set_values_internal(
context, pipeline_key, root_pipeline_key, caller_out... | python | def _run_internal(self,
context,
pipeline_key,
root_pipeline_key,
caller_output):
"""Used by the Pipeline evaluator to execute this Pipeline."""
self._set_values_internal(
context, pipeline_key, root_pipeline_key, caller_out... | Used by the Pipeline evaluator to execute this Pipeline. | https://github.com/GoogleCloudPlatform/appengine-pipelines/blob/277394648dac3e8214677af898935d07399ac8e1/python/src/pipeline/pipeline.py#L1098-L1110 |
GoogleCloudPlatform/appengine-pipelines | python/src/pipeline/pipeline.py | Pipeline._finalized_internal | def _finalized_internal(self,
context,
pipeline_key,
root_pipeline_key,
caller_output,
aborted):
"""Used by the Pipeline evaluator to finalize this Pipeline."""
result_status = _Pipe... | python | def _finalized_internal(self,
context,
pipeline_key,
root_pipeline_key,
caller_output,
aborted):
"""Used by the Pipeline evaluator to finalize this Pipeline."""
result_status = _Pipe... | Used by the Pipeline evaluator to finalize this Pipeline. | https://github.com/GoogleCloudPlatform/appengine-pipelines/blob/277394648dac3e8214677af898935d07399ac8e1/python/src/pipeline/pipeline.py#L1112-L1131 |
GoogleCloudPlatform/appengine-pipelines | python/src/pipeline/pipeline.py | InOrder._add_future | def _add_future(cls, future):
"""Adds a future to the list of in-order futures thus far.
Args:
future: The future to add to the list.
"""
if cls._local._activated:
cls._local._in_order_futures.add(future) | python | def _add_future(cls, future):
"""Adds a future to the list of in-order futures thus far.
Args:
future: The future to add to the list.
"""
if cls._local._activated:
cls._local._in_order_futures.add(future) | Adds a future to the list of in-order futures thus far.
Args:
future: The future to add to the list. | https://github.com/GoogleCloudPlatform/appengine-pipelines/blob/277394648dac3e8214677af898935d07399ac8e1/python/src/pipeline/pipeline.py#L1190-L1197 |
GoogleCloudPlatform/appengine-pipelines | python/src/pipeline/pipeline.py | InOrder._thread_init | def _thread_init(cls):
"""Ensure thread local is initialized."""
if not hasattr(cls._local, '_in_order_futures'):
cls._local._in_order_futures = set()
cls._local._activated = False | python | def _thread_init(cls):
"""Ensure thread local is initialized."""
if not hasattr(cls._local, '_in_order_futures'):
cls._local._in_order_futures = set()
cls._local._activated = False | Ensure thread local is initialized. | https://github.com/GoogleCloudPlatform/appengine-pipelines/blob/277394648dac3e8214677af898935d07399ac8e1/python/src/pipeline/pipeline.py#L1224-L1228 |
GoogleCloudPlatform/appengine-pipelines | python/src/pipeline/pipeline.py | _PipelineContext.from_environ | def from_environ(cls, environ=os.environ):
"""Constructs a _PipelineContext from the task queue environment."""
base_path, unused = (environ['PATH_INFO'].rsplit('/', 1) + [''])[:2]
return cls(
environ['HTTP_X_APPENGINE_TASKNAME'],
environ['HTTP_X_APPENGINE_QUEUENAME'],
base_path) | python | def from_environ(cls, environ=os.environ):
"""Constructs a _PipelineContext from the task queue environment."""
base_path, unused = (environ['PATH_INFO'].rsplit('/', 1) + [''])[:2]
return cls(
environ['HTTP_X_APPENGINE_TASKNAME'],
environ['HTTP_X_APPENGINE_QUEUENAME'],
base_path) | Constructs a _PipelineContext from the task queue environment. | https://github.com/GoogleCloudPlatform/appengine-pipelines/blob/277394648dac3e8214677af898935d07399ac8e1/python/src/pipeline/pipeline.py#L1452-L1458 |
GoogleCloudPlatform/appengine-pipelines | python/src/pipeline/pipeline.py | _PipelineContext.fill_slot | def fill_slot(self, filler_pipeline_key, slot, value):
"""Fills a slot, enqueueing a task to trigger pending barriers.
Args:
filler_pipeline_key: db.Key or stringified key of the _PipelineRecord
that filled this slot.
slot: The Slot instance to fill.
value: The serializable value to a... | python | def fill_slot(self, filler_pipeline_key, slot, value):
"""Fills a slot, enqueueing a task to trigger pending barriers.
Args:
filler_pipeline_key: db.Key or stringified key of the _PipelineRecord
that filled this slot.
slot: The Slot instance to fill.
value: The serializable value to a... | Fills a slot, enqueueing a task to trigger pending barriers.
Args:
filler_pipeline_key: db.Key or stringified key of the _PipelineRecord
that filled this slot.
slot: The Slot instance to fill.
value: The serializable value to assign.
Raises:
UnexpectedPipelineError if the _Slot... | https://github.com/GoogleCloudPlatform/appengine-pipelines/blob/277394648dac3e8214677af898935d07399ac8e1/python/src/pipeline/pipeline.py#L1460-L1519 |
GoogleCloudPlatform/appengine-pipelines | python/src/pipeline/pipeline.py | _PipelineContext.notify_barriers | def notify_barriers(self,
slot_key,
cursor,
use_barrier_indexes,
max_to_notify=_MAX_BARRIERS_TO_NOTIFY):
"""Searches for barriers affected by a slot and triggers completed ones.
Args:
slot_key: db.Key or stringified k... | python | def notify_barriers(self,
slot_key,
cursor,
use_barrier_indexes,
max_to_notify=_MAX_BARRIERS_TO_NOTIFY):
"""Searches for barriers affected by a slot and triggers completed ones.
Args:
slot_key: db.Key or stringified k... | Searches for barriers affected by a slot and triggers completed ones.
Args:
slot_key: db.Key or stringified key of the _SlotRecord that was filled.
cursor: Stringified Datastore cursor where the notification query
should pick up.
use_barrier_indexes: When True, use _BarrierIndex records t... | https://github.com/GoogleCloudPlatform/appengine-pipelines/blob/277394648dac3e8214677af898935d07399ac8e1/python/src/pipeline/pipeline.py#L1521-L1665 |
GoogleCloudPlatform/appengine-pipelines | python/src/pipeline/pipeline.py | _PipelineContext.begin_abort | def begin_abort(self, root_pipeline_key, abort_message):
"""Kicks off the abort process for a root pipeline and all its children.
Args:
root_pipeline_key: db.Key of the root pipeline to abort.
abort_message: Message explaining why the abort happened, only saved
into the root pipeline.
... | python | def begin_abort(self, root_pipeline_key, abort_message):
"""Kicks off the abort process for a root pipeline and all its children.
Args:
root_pipeline_key: db.Key of the root pipeline to abort.
abort_message: Message explaining why the abort happened, only saved
into the root pipeline.
... | Kicks off the abort process for a root pipeline and all its children.
Args:
root_pipeline_key: db.Key of the root pipeline to abort.
abort_message: Message explaining why the abort happened, only saved
into the root pipeline.
Returns:
True if the abort signal was sent successfully;... | https://github.com/GoogleCloudPlatform/appengine-pipelines/blob/277394648dac3e8214677af898935d07399ac8e1/python/src/pipeline/pipeline.py#L1667-L1706 |
GoogleCloudPlatform/appengine-pipelines | python/src/pipeline/pipeline.py | _PipelineContext.continue_abort | def continue_abort(self,
root_pipeline_key,
cursor=None,
max_to_notify=_MAX_ABORTS_TO_BEGIN):
"""Sends the abort signal to all children for a root pipeline.
Args:
root_pipeline_key: db.Key of the root pipeline to abort.
cursor: The quer... | python | def continue_abort(self,
root_pipeline_key,
cursor=None,
max_to_notify=_MAX_ABORTS_TO_BEGIN):
"""Sends the abort signal to all children for a root pipeline.
Args:
root_pipeline_key: db.Key of the root pipeline to abort.
cursor: The quer... | Sends the abort signal to all children for a root pipeline.
Args:
root_pipeline_key: db.Key of the root pipeline to abort.
cursor: The query cursor for enumerating _PipelineRecords when inserting
tasks to cause child pipelines to terminate.
max_to_notify: Used for testing. | https://github.com/GoogleCloudPlatform/appengine-pipelines/blob/277394648dac3e8214677af898935d07399ac8e1/python/src/pipeline/pipeline.py#L1708-L1771 |
GoogleCloudPlatform/appengine-pipelines | python/src/pipeline/pipeline.py | _PipelineContext.start | def start(self, pipeline, return_task=True, countdown=None, eta=None):
"""Starts a pipeline.
Args:
pipeline: Pipeline instance to run.
return_task: When True, do not submit the task to start the pipeline
but instead return it for someone else to enqueue.
countdown: Time in seconds int... | python | def start(self, pipeline, return_task=True, countdown=None, eta=None):
"""Starts a pipeline.
Args:
pipeline: Pipeline instance to run.
return_task: When True, do not submit the task to start the pipeline
but instead return it for someone else to enqueue.
countdown: Time in seconds int... | Starts a pipeline.
Args:
pipeline: Pipeline instance to run.
return_task: When True, do not submit the task to start the pipeline
but instead return it for someone else to enqueue.
countdown: Time in seconds into the future that this Task should execute.
Defaults to zero.
et... | https://github.com/GoogleCloudPlatform/appengine-pipelines/blob/277394648dac3e8214677af898935d07399ac8e1/python/src/pipeline/pipeline.py#L1773-L1855 |
GoogleCloudPlatform/appengine-pipelines | python/src/pipeline/pipeline.py | _PipelineContext.evaluate | def evaluate(self, pipeline_key, purpose=None, attempt=0):
"""Evaluates the given Pipeline and enqueues sub-stages for execution.
Args:
pipeline_key: The db.Key or stringified key of the _PipelineRecord to run.
purpose: Why evaluate was called ('start', 'finalize', or 'abort').
attempt: The a... | python | def evaluate(self, pipeline_key, purpose=None, attempt=0):
"""Evaluates the given Pipeline and enqueues sub-stages for execution.
Args:
pipeline_key: The db.Key or stringified key of the _PipelineRecord to run.
purpose: Why evaluate was called ('start', 'finalize', or 'abort').
attempt: The a... | Evaluates the given Pipeline and enqueues sub-stages for execution.
Args:
pipeline_key: The db.Key or stringified key of the _PipelineRecord to run.
purpose: Why evaluate was called ('start', 'finalize', or 'abort').
attempt: The attempt number that should be tried. | https://github.com/GoogleCloudPlatform/appengine-pipelines/blob/277394648dac3e8214677af898935d07399ac8e1/python/src/pipeline/pipeline.py#L1989-L2359 |
GoogleCloudPlatform/appengine-pipelines | python/src/pipeline/pipeline.py | _PipelineContext._create_barrier_entities | def _create_barrier_entities(root_pipeline_key,
child_pipeline_key,
purpose,
blocking_slot_keys):
"""Creates all of the entities required for a _BarrierRecord.
Args:
root_pipeline_key: The root pipeline this is p... | python | def _create_barrier_entities(root_pipeline_key,
child_pipeline_key,
purpose,
blocking_slot_keys):
"""Creates all of the entities required for a _BarrierRecord.
Args:
root_pipeline_key: The root pipeline this is p... | Creates all of the entities required for a _BarrierRecord.
Args:
root_pipeline_key: The root pipeline this is part of.
child_pipeline_key: The pipeline this barrier is for.
purpose: _BarrierRecord.START or _BarrierRecord.FINALIZE.
blocking_slot_keys: Set of db.Keys corresponding to _SlotRec... | https://github.com/GoogleCloudPlatform/appengine-pipelines/blob/277394648dac3e8214677af898935d07399ac8e1/python/src/pipeline/pipeline.py#L2362-L2405 |
GoogleCloudPlatform/appengine-pipelines | python/src/pipeline/pipeline.py | _PipelineContext.handle_run_exception | def handle_run_exception(self, pipeline_key, pipeline_func, e):
"""Handles an exception raised by a Pipeline's user code.
Args:
pipeline_key: The pipeline that raised the error.
pipeline_func: The class path name of the Pipeline that was running.
e: The exception that was raised.
Returns... | python | def handle_run_exception(self, pipeline_key, pipeline_func, e):
"""Handles an exception raised by a Pipeline's user code.
Args:
pipeline_key: The pipeline that raised the error.
pipeline_func: The class path name of the Pipeline that was running.
e: The exception that was raised.
Returns... | Handles an exception raised by a Pipeline's user code.
Args:
pipeline_key: The pipeline that raised the error.
pipeline_func: The class path name of the Pipeline that was running.
e: The exception that was raised.
Returns:
True if the exception should be re-raised up through the callin... | https://github.com/GoogleCloudPlatform/appengine-pipelines/blob/277394648dac3e8214677af898935d07399ac8e1/python/src/pipeline/pipeline.py#L2407-L2435 |
GoogleCloudPlatform/appengine-pipelines | python/src/pipeline/pipeline.py | _PipelineContext.transition_run | def transition_run(self,
pipeline_key,
blocking_slot_keys=None,
fanned_out_pipelines=None,
pipelines_to_run=None):
"""Marks an asynchronous or generator pipeline as running.
Does nothing if the pipeline is no longer in a runnab... | python | def transition_run(self,
pipeline_key,
blocking_slot_keys=None,
fanned_out_pipelines=None,
pipelines_to_run=None):
"""Marks an asynchronous or generator pipeline as running.
Does nothing if the pipeline is no longer in a runnab... | Marks an asynchronous or generator pipeline as running.
Does nothing if the pipeline is no longer in a runnable state.
Args:
pipeline_key: The db.Key of the _PipelineRecord to update.
blocking_slot_keys: List of db.Key instances that this pipeline's
finalization barrier should wait on in a... | https://github.com/GoogleCloudPlatform/appengine-pipelines/blob/277394648dac3e8214677af898935d07399ac8e1/python/src/pipeline/pipeline.py#L2437-L2523 |
GoogleCloudPlatform/appengine-pipelines | python/src/pipeline/pipeline.py | _PipelineContext.transition_complete | def transition_complete(self, pipeline_key):
"""Marks the given pipeline as complete.
Does nothing if the pipeline is no longer in a state that can be completed.
Args:
pipeline_key: db.Key of the _PipelineRecord that has completed.
"""
def txn():
pipeline_record = db.get(pipeline_key)
... | python | def transition_complete(self, pipeline_key):
"""Marks the given pipeline as complete.
Does nothing if the pipeline is no longer in a state that can be completed.
Args:
pipeline_key: db.Key of the _PipelineRecord that has completed.
"""
def txn():
pipeline_record = db.get(pipeline_key)
... | Marks the given pipeline as complete.
Does nothing if the pipeline is no longer in a state that can be completed.
Args:
pipeline_key: db.Key of the _PipelineRecord that has completed. | https://github.com/GoogleCloudPlatform/appengine-pipelines/blob/277394648dac3e8214677af898935d07399ac8e1/python/src/pipeline/pipeline.py#L2525-L2551 |
GoogleCloudPlatform/appengine-pipelines | python/src/pipeline/pipeline.py | _PipelineContext.transition_retry | def transition_retry(self, pipeline_key, retry_message):
"""Marks the given pipeline as requiring another retry.
Does nothing if all attempts have been exceeded.
Args:
pipeline_key: db.Key of the _PipelineRecord that needs to be retried.
retry_message: User-supplied message indicating the reas... | python | def transition_retry(self, pipeline_key, retry_message):
"""Marks the given pipeline as requiring another retry.
Does nothing if all attempts have been exceeded.
Args:
pipeline_key: db.Key of the _PipelineRecord that needs to be retried.
retry_message: User-supplied message indicating the reas... | Marks the given pipeline as requiring another retry.
Does nothing if all attempts have been exceeded.
Args:
pipeline_key: db.Key of the _PipelineRecord that needs to be retried.
retry_message: User-supplied message indicating the reason for the retry. | https://github.com/GoogleCloudPlatform/appengine-pipelines/blob/277394648dac3e8214677af898935d07399ac8e1/python/src/pipeline/pipeline.py#L2553-L2615 |
GoogleCloudPlatform/appengine-pipelines | python/src/pipeline/pipeline.py | _CallbackHandler.run_callback | def run_callback(self):
"""Runs the callback for the pipeline specified in the request.
Raises:
_CallbackTaskError if something was wrong with the request parameters.
"""
pipeline_id = self.request.get('pipeline_id')
if not pipeline_id:
raise _CallbackTaskError('"pipeline_id" parameter ... | python | def run_callback(self):
"""Runs the callback for the pipeline specified in the request.
Raises:
_CallbackTaskError if something was wrong with the request parameters.
"""
pipeline_id = self.request.get('pipeline_id')
if not pipeline_id:
raise _CallbackTaskError('"pipeline_id" parameter ... | Runs the callback for the pipeline specified in the request.
Raises:
_CallbackTaskError if something was wrong with the request parameters. | https://github.com/GoogleCloudPlatform/appengine-pipelines/blob/277394648dac3e8214677af898935d07399ac8e1/python/src/pipeline/pipeline.py#L2803-L2867 |
GoogleCloudPlatform/appengine-pipelines | python/src/pipeline/__init__.py | _fix_path | def _fix_path():
"""Finds the google_appengine directory and fixes Python imports to use it."""
import os
import sys
all_paths = os.environ.get('PYTHONPATH').split(os.pathsep)
for path_dir in all_paths:
dev_appserver_path = os.path.join(path_dir, 'dev_appserver.py')
if os.path.exists(dev_appserver_pat... | python | def _fix_path():
"""Finds the google_appengine directory and fixes Python imports to use it."""
import os
import sys
all_paths = os.environ.get('PYTHONPATH').split(os.pathsep)
for path_dir in all_paths:
dev_appserver_path = os.path.join(path_dir, 'dev_appserver.py')
if os.path.exists(dev_appserver_pat... | Finds the google_appengine directory and fixes Python imports to use it. | https://github.com/GoogleCloudPlatform/appengine-pipelines/blob/277394648dac3e8214677af898935d07399ac8e1/python/src/pipeline/__init__.py#L22-L37 |
GoogleCloudPlatform/appengine-pipelines | python/src/pipeline/models.py | _PipelineRecord.params | def params(self):
"""Returns the dictionary of parameters for this Pipeline."""
if hasattr(self, '_params_decoded'):
return self._params_decoded
if self.params_blob is not None:
value_encoded = self.params_blob.open().read()
else:
value_encoded = self.params_text
value = json.loa... | python | def params(self):
"""Returns the dictionary of parameters for this Pipeline."""
if hasattr(self, '_params_decoded'):
return self._params_decoded
if self.params_blob is not None:
value_encoded = self.params_blob.open().read()
else:
value_encoded = self.params_text
value = json.loa... | Returns the dictionary of parameters for this Pipeline. | https://github.com/GoogleCloudPlatform/appengine-pipelines/blob/277394648dac3e8214677af898935d07399ac8e1/python/src/pipeline/models.py#L96-L117 |
GoogleCloudPlatform/appengine-pipelines | python/src/pipeline/models.py | _SlotRecord.value | def value(self):
"""Returns the value of this Slot."""
if hasattr(self, '_value_decoded'):
return self._value_decoded
if self.value_blob is not None:
encoded_value = self.value_blob.open().read()
else:
encoded_value = self.value_text
self._value_decoded = json.loads(encoded_value... | python | def value(self):
"""Returns the value of this Slot."""
if hasattr(self, '_value_decoded'):
return self._value_decoded
if self.value_blob is not None:
encoded_value = self.value_blob.open().read()
else:
encoded_value = self.value_text
self._value_decoded = json.loads(encoded_value... | Returns the value of this Slot. | https://github.com/GoogleCloudPlatform/appengine-pipelines/blob/277394648dac3e8214677af898935d07399ac8e1/python/src/pipeline/models.py#L156-L167 |
GoogleCloudPlatform/appengine-pipelines | python/src/pipeline/models.py | _BarrierIndex.to_barrier_key | def to_barrier_key(cls, barrier_index_key):
"""Converts a _BarrierIndex key to a _BarrierRecord key.
Args:
barrier_index_key: db.Key for a _BarrierIndex entity.
Returns:
db.Key for the corresponding _BarrierRecord entity.
"""
barrier_index_path = barrier_index_key.to_path()
# Pick... | python | def to_barrier_key(cls, barrier_index_key):
"""Converts a _BarrierIndex key to a _BarrierRecord key.
Args:
barrier_index_key: db.Key for a _BarrierIndex entity.
Returns:
db.Key for the corresponding _BarrierRecord entity.
"""
barrier_index_path = barrier_index_key.to_path()
# Pick... | Converts a _BarrierIndex key to a _BarrierRecord key.
Args:
barrier_index_key: db.Key for a _BarrierIndex entity.
Returns:
db.Key for the corresponding _BarrierRecord entity. | https://github.com/GoogleCloudPlatform/appengine-pipelines/blob/277394648dac3e8214677af898935d07399ac8e1/python/src/pipeline/models.py#L251-L271 |
bcbnz/pylabels | labels/sheet.py | Sheet.partial_page | def partial_page(self, page, used_labels):
"""Allows a page to be marked as already partially used so you can
generate a PDF to print on the remaining labels.
Parameters
----------
page: positive integer
The page number to mark as partially used. The page must not ha... | python | def partial_page(self, page, used_labels):
"""Allows a page to be marked as already partially used so you can
generate a PDF to print on the remaining labels.
Parameters
----------
page: positive integer
The page number to mark as partially used. The page must not ha... | Allows a page to be marked as already partially used so you can
generate a PDF to print on the remaining labels.
Parameters
----------
page: positive integer
The page number to mark as partially used. The page must not have
already been started, i.e., for page 1 ... | https://github.com/bcbnz/pylabels/blob/ecdb4ca48061d8f1dc0fcfe2d55ce2b89e0e5ec6/labels/sheet.py#L205-L239 |
bcbnz/pylabels | labels/sheet.py | Sheet._new_page | def _new_page(self):
"""Helper function to start a new page. Not intended for external use.
"""
self._current_page = Drawing(*self._pagesize)
if self._bgimage:
self._current_page.add(self._bgimage)
self._pages.append(self._current_page)
self.page_count += 1
... | python | def _new_page(self):
"""Helper function to start a new page. Not intended for external use.
"""
self._current_page = Drawing(*self._pagesize)
if self._bgimage:
self._current_page.add(self._bgimage)
self._pages.append(self._current_page)
self.page_count += 1
... | Helper function to start a new page. Not intended for external use. | https://github.com/bcbnz/pylabels/blob/ecdb4ca48061d8f1dc0fcfe2d55ce2b89e0e5ec6/labels/sheet.py#L241-L250 |
bcbnz/pylabels | labels/sheet.py | Sheet._next_label | def _next_label(self):
"""Helper method to move to the next label. Not intended for external use.
This does not increment the label_count attribute as the next label may
not be usable (it may have been marked as missing through
partial_pages). See _next_unused_label for generally more u... | python | def _next_label(self):
"""Helper method to move to the next label. Not intended for external use.
This does not increment the label_count attribute as the next label may
not be usable (it may have been marked as missing through
partial_pages). See _next_unused_label for generally more u... | Helper method to move to the next label. Not intended for external use.
This does not increment the label_count attribute as the next label may
not be usable (it may have been marked as missing through
partial_pages). See _next_unused_label for generally more useful method. | https://github.com/bcbnz/pylabels/blob/ecdb4ca48061d8f1dc0fcfe2d55ce2b89e0e5ec6/labels/sheet.py#L252-L274 |
bcbnz/pylabels | labels/sheet.py | Sheet._next_unused_label | def _next_unused_label(self):
"""Helper method to move to the next unused label. Not intended for external use.
This method will shade in any missing labels if desired, and will
increment the label_count attribute once a suitable label position has
been found.
"""
self.... | python | def _next_unused_label(self):
"""Helper method to move to the next unused label. Not intended for external use.
This method will shade in any missing labels if desired, and will
increment the label_count attribute once a suitable label position has
been found.
"""
self.... | Helper method to move to the next unused label. Not intended for external use.
This method will shade in any missing labels if desired, and will
increment the label_count attribute once a suitable label position has
been found. | https://github.com/bcbnz/pylabels/blob/ecdb4ca48061d8f1dc0fcfe2d55ce2b89e0e5ec6/labels/sheet.py#L276-L304 |
bcbnz/pylabels | labels/sheet.py | Sheet._calculate_edges | def _calculate_edges(self):
"""Calculate edges of the current label. Not intended for external use.
"""
# Calculate the left edge of the label.
left = self.specs.left_margin
left += (self.specs.label_width * (self._position[1] - 1))
if self.specs.column_gap:
... | python | def _calculate_edges(self):
"""Calculate edges of the current label. Not intended for external use.
"""
# Calculate the left edge of the label.
left = self.specs.left_margin
left += (self.specs.label_width * (self._position[1] - 1))
if self.specs.column_gap:
... | Calculate edges of the current label. Not intended for external use. | https://github.com/bcbnz/pylabels/blob/ecdb4ca48061d8f1dc0fcfe2d55ce2b89e0e5ec6/labels/sheet.py#L306-L326 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.