partition stringclasses 3
values | func_name stringlengths 1 134 | docstring stringlengths 1 46.9k | path stringlengths 4 223 | original_string stringlengths 75 104k | code stringlengths 75 104k | docstring_tokens listlengths 1 1.97k | repo stringlengths 7 55 | language stringclasses 1
value | url stringlengths 87 315 | code_tokens listlengths 19 28.4k | sha stringlengths 40 40 |
|---|---|---|---|---|---|---|---|---|---|---|---|
train | per_from_id_in | :param s:
a list or set of from id
:param flavors:
``all`` or a list of flavors
:return:
a seeder function that returns the from id only if the from id is in ``s``
and message flavor is in ``flavors``. | telepot/delegate.py | def per_from_id_in(s, flavors=chat_flavors+inline_flavors):
"""
:param s:
a list or set of from id
:param flavors:
``all`` or a list of flavors
:return:
a seeder function that returns the from id only if the from id is in ``s``
and message flavor is in ``flavors``.
... | def per_from_id_in(s, flavors=chat_flavors+inline_flavors):
"""
:param s:
a list or set of from id
:param flavors:
``all`` or a list of flavors
:return:
a seeder function that returns the from id only if the from id is in ``s``
and message flavor is in ``flavors``.
... | [
":",
"param",
"s",
":",
"a",
"list",
"or",
"set",
"of",
"from",
"id"
] | nickoala/telepot | python | https://github.com/nickoala/telepot/blob/3792fde251d0f1d5a6ca16c8ad1a71f89360c41d/telepot/delegate.py#L75-L90 | [
"def",
"per_from_id_in",
"(",
"s",
",",
"flavors",
"=",
"chat_flavors",
"+",
"inline_flavors",
")",
":",
"return",
"_wrap_none",
"(",
"lambda",
"msg",
":",
"msg",
"[",
"'from'",
"]",
"[",
"'id'",
"]",
"if",
"(",
"flavors",
"==",
"'all'",
"or",
"flavor",
... | 3792fde251d0f1d5a6ca16c8ad1a71f89360c41d |
train | per_from_id_except | :param s:
a list or set of from id
:param flavors:
``all`` or a list of flavors
:return:
a seeder function that returns the from id only if the from id is *not* in ``s``
and message flavor is in ``flavors``. | telepot/delegate.py | def per_from_id_except(s, flavors=chat_flavors+inline_flavors):
"""
:param s:
a list or set of from id
:param flavors:
``all`` or a list of flavors
:return:
a seeder function that returns the from id only if the from id is *not* in ``s``
and message flavor is in ``flavo... | def per_from_id_except(s, flavors=chat_flavors+inline_flavors):
"""
:param s:
a list or set of from id
:param flavors:
``all`` or a list of flavors
:return:
a seeder function that returns the from id only if the from id is *not* in ``s``
and message flavor is in ``flavo... | [
":",
"param",
"s",
":",
"a",
"list",
"or",
"set",
"of",
"from",
"id"
] | nickoala/telepot | python | https://github.com/nickoala/telepot/blob/3792fde251d0f1d5a6ca16c8ad1a71f89360c41d/telepot/delegate.py#L92-L107 | [
"def",
"per_from_id_except",
"(",
"s",
",",
"flavors",
"=",
"chat_flavors",
"+",
"inline_flavors",
")",
":",
"return",
"_wrap_none",
"(",
"lambda",
"msg",
":",
"msg",
"[",
"'from'",
"]",
"[",
"'id'",
"]",
"if",
"(",
"flavors",
"==",
"'all'",
"or",
"flavo... | 3792fde251d0f1d5a6ca16c8ad1a71f89360c41d |
train | per_event_source_id | :return:
a seeder function that returns an event's source id only if that event's
source space equals to ``event_space``. | telepot/delegate.py | def per_event_source_id(event_space):
"""
:return:
a seeder function that returns an event's source id only if that event's
source space equals to ``event_space``.
"""
def f(event):
if is_event(event):
v = peel(event)
if v['source']['space'] == event_space... | def per_event_source_id(event_space):
"""
:return:
a seeder function that returns an event's source id only if that event's
source space equals to ``event_space``.
"""
def f(event):
if is_event(event):
v = peel(event)
if v['source']['space'] == event_space... | [
":",
"return",
":",
"a",
"seeder",
"function",
"that",
"returns",
"an",
"event",
"s",
"source",
"id",
"only",
"if",
"that",
"event",
"s",
"source",
"space",
"equals",
"to",
"event_space",
"."
] | nickoala/telepot | python | https://github.com/nickoala/telepot/blob/3792fde251d0f1d5a6ca16c8ad1a71f89360c41d/telepot/delegate.py#L152-L167 | [
"def",
"per_event_source_id",
"(",
"event_space",
")",
":",
"def",
"f",
"(",
"event",
")",
":",
"if",
"is_event",
"(",
"event",
")",
":",
"v",
"=",
"peel",
"(",
"event",
")",
"if",
"v",
"[",
"'source'",
"]",
"[",
"'space'",
"]",
"==",
"event_space",
... | 3792fde251d0f1d5a6ca16c8ad1a71f89360c41d |
train | per_callback_query_chat_id | :param types:
``all`` or a list of chat types (``private``, ``group``, ``channel``)
:return:
a seeder function that returns a callback query's originating chat id
if the chat type is in ``types``. | telepot/delegate.py | def per_callback_query_chat_id(types='all'):
"""
:param types:
``all`` or a list of chat types (``private``, ``group``, ``channel``)
:return:
a seeder function that returns a callback query's originating chat id
if the chat type is in ``types``.
"""
def f(msg):
if (f... | def per_callback_query_chat_id(types='all'):
"""
:param types:
``all`` or a list of chat types (``private``, ``group``, ``channel``)
:return:
a seeder function that returns a callback query's originating chat id
if the chat type is in ``types``.
"""
def f(msg):
if (f... | [
":",
"param",
"types",
":",
"all",
"or",
"a",
"list",
"of",
"chat",
"types",
"(",
"private",
"group",
"channel",
")"
] | nickoala/telepot | python | https://github.com/nickoala/telepot/blob/3792fde251d0f1d5a6ca16c8ad1a71f89360c41d/telepot/delegate.py#L169-L184 | [
"def",
"per_callback_query_chat_id",
"(",
"types",
"=",
"'all'",
")",
":",
"def",
"f",
"(",
"msg",
")",
":",
"if",
"(",
"flavor",
"(",
"msg",
")",
"==",
"'callback_query'",
"and",
"'message'",
"in",
"msg",
"and",
"(",
"types",
"==",
"'all'",
"or",
"msg... | 3792fde251d0f1d5a6ca16c8ad1a71f89360c41d |
train | per_callback_query_origin | :param origins:
``all`` or a list of origin types (``chat``, ``inline``)
:return:
a seeder function that returns a callback query's origin identifier if
that origin type is in ``origins``. The origin identifier is guaranteed
to be a tuple. | telepot/delegate.py | def per_callback_query_origin(origins='all'):
"""
:param origins:
``all`` or a list of origin types (``chat``, ``inline``)
:return:
a seeder function that returns a callback query's origin identifier if
that origin type is in ``origins``. The origin identifier is guaranteed
... | def per_callback_query_origin(origins='all'):
"""
:param origins:
``all`` or a list of origin types (``chat``, ``inline``)
:return:
a seeder function that returns a callback query's origin identifier if
that origin type is in ``origins``. The origin identifier is guaranteed
... | [
":",
"param",
"origins",
":",
"all",
"or",
"a",
"list",
"of",
"origin",
"types",
"(",
"chat",
"inline",
")"
] | nickoala/telepot | python | https://github.com/nickoala/telepot/blob/3792fde251d0f1d5a6ca16c8ad1a71f89360c41d/telepot/delegate.py#L186-L209 | [
"def",
"per_callback_query_origin",
"(",
"origins",
"=",
"'all'",
")",
":",
"def",
"f",
"(",
"msg",
")",
":",
"def",
"origin_type_ok",
"(",
")",
":",
"return",
"(",
"origins",
"==",
"'all'",
"or",
"(",
"'chat'",
"in",
"origins",
"and",
"'message'",
"in",... | 3792fde251d0f1d5a6ca16c8ad1a71f89360c41d |
train | call | :return:
a delegator function that returns a tuple (``func``, (seed tuple,)+ ``args``, ``kwargs``).
That is, seed tuple is inserted before supplied positional arguments.
By default, a thread wrapping ``func`` and all those arguments is spawned. | telepot/delegate.py | def call(func, *args, **kwargs):
"""
:return:
a delegator function that returns a tuple (``func``, (seed tuple,)+ ``args``, ``kwargs``).
That is, seed tuple is inserted before supplied positional arguments.
By default, a thread wrapping ``func`` and all those arguments is spawned.
""... | def call(func, *args, **kwargs):
"""
:return:
a delegator function that returns a tuple (``func``, (seed tuple,)+ ``args``, ``kwargs``).
That is, seed tuple is inserted before supplied positional arguments.
By default, a thread wrapping ``func`` and all those arguments is spawned.
""... | [
":",
"return",
":",
"a",
"delegator",
"function",
"that",
"returns",
"a",
"tuple",
"(",
"func",
"(",
"seed",
"tuple",
")",
"+",
"args",
"kwargs",
")",
".",
"That",
"is",
"seed",
"tuple",
"is",
"inserted",
"before",
"supplied",
"positional",
"arguments",
... | nickoala/telepot | python | https://github.com/nickoala/telepot/blob/3792fde251d0f1d5a6ca16c8ad1a71f89360c41d/telepot/delegate.py#L224-L233 | [
"def",
"call",
"(",
"func",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"def",
"f",
"(",
"seed_tuple",
")",
":",
"return",
"func",
",",
"(",
"seed_tuple",
",",
")",
"+",
"args",
",",
"kwargs",
"return",
"f"
] | 3792fde251d0f1d5a6ca16c8ad1a71f89360c41d |
train | create_run | :return:
a delegator function that calls the ``cls`` constructor whose arguments being
a seed tuple followed by supplied ``*args`` and ``**kwargs``, then returns
the object's ``run`` method. By default, a thread wrapping that ``run`` method
is spawned. | telepot/delegate.py | def create_run(cls, *args, **kwargs):
"""
:return:
a delegator function that calls the ``cls`` constructor whose arguments being
a seed tuple followed by supplied ``*args`` and ``**kwargs``, then returns
the object's ``run`` method. By default, a thread wrapping that ``run`` method
... | def create_run(cls, *args, **kwargs):
"""
:return:
a delegator function that calls the ``cls`` constructor whose arguments being
a seed tuple followed by supplied ``*args`` and ``**kwargs``, then returns
the object's ``run`` method. By default, a thread wrapping that ``run`` method
... | [
":",
"return",
":",
"a",
"delegator",
"function",
"that",
"calls",
"the",
"cls",
"constructor",
"whose",
"arguments",
"being",
"a",
"seed",
"tuple",
"followed",
"by",
"supplied",
"*",
"args",
"and",
"**",
"kwargs",
"then",
"returns",
"the",
"object",
"s",
... | nickoala/telepot | python | https://github.com/nickoala/telepot/blob/3792fde251d0f1d5a6ca16c8ad1a71f89360c41d/telepot/delegate.py#L235-L246 | [
"def",
"create_run",
"(",
"cls",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"def",
"f",
"(",
"seed_tuple",
")",
":",
"j",
"=",
"cls",
"(",
"seed_tuple",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
"return",
"j",
".",
"run",
"retur... | 3792fde251d0f1d5a6ca16c8ad1a71f89360c41d |
train | create_open | :return:
a delegator function that calls the ``cls`` constructor whose arguments being
a seed tuple followed by supplied ``*args`` and ``**kwargs``, then returns
a looping function that uses the object's ``listener`` to wait for messages
and invokes instance method ``open``, ``on_message... | telepot/delegate.py | def create_open(cls, *args, **kwargs):
"""
:return:
a delegator function that calls the ``cls`` constructor whose arguments being
a seed tuple followed by supplied ``*args`` and ``**kwargs``, then returns
a looping function that uses the object's ``listener`` to wait for messages
... | def create_open(cls, *args, **kwargs):
"""
:return:
a delegator function that calls the ``cls`` constructor whose arguments being
a seed tuple followed by supplied ``*args`` and ``**kwargs``, then returns
a looping function that uses the object's ``listener`` to wait for messages
... | [
":",
"return",
":",
"a",
"delegator",
"function",
"that",
"calls",
"the",
"cls",
"constructor",
"whose",
"arguments",
"being",
"a",
"seed",
"tuple",
"followed",
"by",
"supplied",
"*",
"args",
"and",
"**",
"kwargs",
"then",
"returns",
"a",
"looping",
"functio... | nickoala/telepot | python | https://github.com/nickoala/telepot/blob/3792fde251d0f1d5a6ca16c8ad1a71f89360c41d/telepot/delegate.py#L248-L283 | [
"def",
"create_open",
"(",
"cls",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"def",
"f",
"(",
"seed_tuple",
")",
":",
"j",
"=",
"cls",
"(",
"seed_tuple",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
"def",
"wait_loop",
"(",
")",
":... | 3792fde251d0f1d5a6ca16c8ad1a71f89360c41d |
train | until | Try a list of seeder functions until a condition is met.
:param condition:
a function that takes one argument - a seed - and returns ``True``
or ``False``
:param fns:
a list of seeder functions
:return:
a "composite" seeder function that calls each supplied function in tur... | telepot/delegate.py | def until(condition, fns):
"""
Try a list of seeder functions until a condition is met.
:param condition:
a function that takes one argument - a seed - and returns ``True``
or ``False``
:param fns:
a list of seeder functions
:return:
a "composite" seeder function t... | def until(condition, fns):
"""
Try a list of seeder functions until a condition is met.
:param condition:
a function that takes one argument - a seed - and returns ``True``
or ``False``
:param fns:
a list of seeder functions
:return:
a "composite" seeder function t... | [
"Try",
"a",
"list",
"of",
"seeder",
"functions",
"until",
"a",
"condition",
"is",
"met",
"."
] | nickoala/telepot | python | https://github.com/nickoala/telepot/blob/3792fde251d0f1d5a6ca16c8ad1a71f89360c41d/telepot/delegate.py#L285-L307 | [
"def",
"until",
"(",
"condition",
",",
"fns",
")",
":",
"def",
"f",
"(",
"msg",
")",
":",
"for",
"fn",
"in",
"fns",
":",
"seed",
"=",
"fn",
"(",
"msg",
")",
"if",
"condition",
"(",
"seed",
")",
":",
"return",
"seed",
"return",
"None",
"return",
... | 3792fde251d0f1d5a6ca16c8ad1a71f89360c41d |
train | pair | The basic pair producer.
:return:
a (seeder, delegator_factory(\*args, \*\*kwargs)) tuple.
:param seeders:
If it is a seeder function or a list of one seeder function, it is returned
as the final seeder. If it is a list of more than one seeder function, they
are chained togethe... | telepot/delegate.py | def pair(seeders, delegator_factory, *args, **kwargs):
"""
The basic pair producer.
:return:
a (seeder, delegator_factory(\*args, \*\*kwargs)) tuple.
:param seeders:
If it is a seeder function or a list of one seeder function, it is returned
as the final seeder. If it is a list... | def pair(seeders, delegator_factory, *args, **kwargs):
"""
The basic pair producer.
:return:
a (seeder, delegator_factory(\*args, \*\*kwargs)) tuple.
:param seeders:
If it is a seeder function or a list of one seeder function, it is returned
as the final seeder. If it is a list... | [
"The",
"basic",
"pair",
"producer",
"."
] | nickoala/telepot | python | https://github.com/nickoala/telepot/blob/3792fde251d0f1d5a6ca16c8ad1a71f89360c41d/telepot/delegate.py#L324-L337 | [
"def",
"pair",
"(",
"seeders",
",",
"delegator_factory",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"(",
"chain",
"(",
"*",
"seeders",
")",
"if",
"len",
"(",
"seeders",
")",
">",
"1",
"else",
"seeders",
"[",
"0",
"]",
",",
"de... | 3792fde251d0f1d5a6ca16c8ad1a71f89360c41d |
train | pave_event_space | :return:
a pair producer that ensures the seeder and delegator share the same event space. | telepot/delegate.py | def pave_event_space(fn=pair):
"""
:return:
a pair producer that ensures the seeder and delegator share the same event space.
"""
global _event_space
event_space = next(_event_space)
@_ensure_seeders_list
def p(seeders, delegator_factory, *args, **kwargs):
return fn(seeders ... | def pave_event_space(fn=pair):
"""
:return:
a pair producer that ensures the seeder and delegator share the same event space.
"""
global _event_space
event_space = next(_event_space)
@_ensure_seeders_list
def p(seeders, delegator_factory, *args, **kwargs):
return fn(seeders ... | [
":",
"return",
":",
"a",
"pair",
"producer",
"that",
"ensures",
"the",
"seeder",
"and",
"delegator",
"share",
"the",
"same",
"event",
"space",
"."
] | nickoala/telepot | python | https://github.com/nickoala/telepot/blob/3792fde251d0f1d5a6ca16c8ad1a71f89360c41d/telepot/delegate.py#L347-L359 | [
"def",
"pave_event_space",
"(",
"fn",
"=",
"pair",
")",
":",
"global",
"_event_space",
"event_space",
"=",
"next",
"(",
"_event_space",
")",
"@",
"_ensure_seeders_list",
"def",
"p",
"(",
"seeders",
",",
"delegator_factory",
",",
"*",
"args",
",",
"*",
"*",
... | 3792fde251d0f1d5a6ca16c8ad1a71f89360c41d |
train | include_callback_query_chat_id | :return:
a pair producer that enables static callback query capturing
across seeder and delegator.
:param types:
``all`` or a list of chat types (``private``, ``group``, ``channel``) | telepot/delegate.py | def include_callback_query_chat_id(fn=pair, types='all'):
"""
:return:
a pair producer that enables static callback query capturing
across seeder and delegator.
:param types:
``all`` or a list of chat types (``private``, ``group``, ``channel``)
"""
@_ensure_seeders_list
... | def include_callback_query_chat_id(fn=pair, types='all'):
"""
:return:
a pair producer that enables static callback query capturing
across seeder and delegator.
:param types:
``all`` or a list of chat types (``private``, ``group``, ``channel``)
"""
@_ensure_seeders_list
... | [
":",
"return",
":",
"a",
"pair",
"producer",
"that",
"enables",
"static",
"callback",
"query",
"capturing",
"across",
"seeder",
"and",
"delegator",
"."
] | nickoala/telepot | python | https://github.com/nickoala/telepot/blob/3792fde251d0f1d5a6ca16c8ad1a71f89360c41d/telepot/delegate.py#L361-L374 | [
"def",
"include_callback_query_chat_id",
"(",
"fn",
"=",
"pair",
",",
"types",
"=",
"'all'",
")",
":",
"@",
"_ensure_seeders_list",
"def",
"p",
"(",
"seeders",
",",
"delegator_factory",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"fn",
... | 3792fde251d0f1d5a6ca16c8ad1a71f89360c41d |
train | intercept_callback_query_origin | :return:
a pair producer that enables dynamic callback query origin mapping
across seeder and delegator.
:param origins:
``all`` or a list of origin types (``chat``, ``inline``).
Origin mapping is only enabled for specified origin types. | telepot/delegate.py | def intercept_callback_query_origin(fn=pair, origins='all'):
"""
:return:
a pair producer that enables dynamic callback query origin mapping
across seeder and delegator.
:param origins:
``all`` or a list of origin types (``chat``, ``inline``).
Origin mapping is only enabled ... | def intercept_callback_query_origin(fn=pair, origins='all'):
"""
:return:
a pair producer that enables dynamic callback query origin mapping
across seeder and delegator.
:param origins:
``all`` or a list of origin types (``chat``, ``inline``).
Origin mapping is only enabled ... | [
":",
"return",
":",
"a",
"pair",
"producer",
"that",
"enables",
"dynamic",
"callback",
"query",
"origin",
"mapping",
"across",
"seeder",
"and",
"delegator",
"."
] | nickoala/telepot | python | https://github.com/nickoala/telepot/blob/3792fde251d0f1d5a6ca16c8ad1a71f89360c41d/telepot/delegate.py#L378-L420 | [
"def",
"intercept_callback_query_origin",
"(",
"fn",
"=",
"pair",
",",
"origins",
"=",
"'all'",
")",
":",
"origin_map",
"=",
"helper",
".",
"SafeDict",
"(",
")",
"# For key functions that returns a tuple as key (e.g. per_callback_query_origin()),",
"# wrap the key in another ... | 3792fde251d0f1d5a6ca16c8ad1a71f89360c41d |
train | set_proxy | Access Bot API through a proxy.
:param url: proxy URL
:param basic_auth: 2-tuple ``('username', 'password')`` | telepot/api.py | def set_proxy(url, basic_auth=None):
"""
Access Bot API through a proxy.
:param url: proxy URL
:param basic_auth: 2-tuple ``('username', 'password')``
"""
global _pools, _onetime_pool_spec
if not url:
_pools['default'] = urllib3.PoolManager(**_default_pool_params)
_onetime_p... | def set_proxy(url, basic_auth=None):
"""
Access Bot API through a proxy.
:param url: proxy URL
:param basic_auth: 2-tuple ``('username', 'password')``
"""
global _pools, _onetime_pool_spec
if not url:
_pools['default'] = urllib3.PoolManager(**_default_pool_params)
_onetime_p... | [
"Access",
"Bot",
"API",
"through",
"a",
"proxy",
"."
] | nickoala/telepot | python | https://github.com/nickoala/telepot/blob/3792fde251d0f1d5a6ca16c8ad1a71f89360c41d/telepot/api.py#L23-L40 | [
"def",
"set_proxy",
"(",
"url",
",",
"basic_auth",
"=",
"None",
")",
":",
"global",
"_pools",
",",
"_onetime_pool_spec",
"if",
"not",
"url",
":",
"_pools",
"[",
"'default'",
"]",
"=",
"urllib3",
".",
"PoolManager",
"(",
"*",
"*",
"_default_pool_params",
")... | 3792fde251d0f1d5a6ca16c8ad1a71f89360c41d |
train | MessageLoop.run_forever | :type relax: float
:param relax: seconds between each :meth:`.getUpdates`
:type offset: int
:param offset:
initial ``offset`` parameter supplied to :meth:`.getUpdates`
:type timeout: int
:param timeout:
``timeout`` parameter supplied to :meth:`.getUpdate... | telepot/loop.py | def run_forever(self, *args, **kwargs):
"""
:type relax: float
:param relax: seconds between each :meth:`.getUpdates`
:type offset: int
:param offset:
initial ``offset`` parameter supplied to :meth:`.getUpdates`
:type timeout: int
:param timeout:
... | def run_forever(self, *args, **kwargs):
"""
:type relax: float
:param relax: seconds between each :meth:`.getUpdates`
:type offset: int
:param offset:
initial ``offset`` parameter supplied to :meth:`.getUpdates`
:type timeout: int
:param timeout:
... | [
":",
"type",
"relax",
":",
"float",
":",
"param",
"relax",
":",
"seconds",
"between",
"each",
":",
"meth",
":",
".",
"getUpdates"
] | nickoala/telepot | python | https://github.com/nickoala/telepot/blob/3792fde251d0f1d5a6ca16c8ad1a71f89360c41d/telepot/loop.py#L128-L160 | [
"def",
"run_forever",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"collectloop",
"=",
"CollectLoop",
"(",
"self",
".",
"_handle",
")",
"updatesloop",
"=",
"GetUpdatesLoop",
"(",
"self",
".",
"_bot",
",",
"lambda",
"update",
":",
"... | 3792fde251d0f1d5a6ca16c8ad1a71f89360c41d |
train | OrderedWebhook.run_forever | :type maxhold: float
:param maxhold:
The maximum number of seconds an update is held waiting for a
not-yet-arrived smaller ``update_id``. When this number of seconds
is up, the update is delivered to the message-handling function
even if some smaller ``update_id``... | telepot/loop.py | def run_forever(self, *args, **kwargs):
"""
:type maxhold: float
:param maxhold:
The maximum number of seconds an update is held waiting for a
not-yet-arrived smaller ``update_id``. When this number of seconds
is up, the update is delivered to the message-hand... | def run_forever(self, *args, **kwargs):
"""
:type maxhold: float
:param maxhold:
The maximum number of seconds an update is held waiting for a
not-yet-arrived smaller ``update_id``. When this number of seconds
is up, the update is delivered to the message-hand... | [
":",
"type",
"maxhold",
":",
"float",
":",
"param",
"maxhold",
":",
"The",
"maximum",
"number",
"of",
"seconds",
"an",
"update",
"is",
"held",
"waiting",
"for",
"a",
"not",
"-",
"yet",
"-",
"arrived",
"smaller",
"update_id",
".",
"When",
"this",
"number"... | nickoala/telepot | python | https://github.com/nickoala/telepot/blob/3792fde251d0f1d5a6ca16c8ad1a71f89360c41d/telepot/loop.py#L283-L301 | [
"def",
"run_forever",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"# feed events to collect loop",
"self",
".",
"_bot",
".",
"scheduler",
".",
"on_event",
"(",
"self",
".",
"_collectloop",
".",
"input_queue",
".",
"put",
")",
"self",
... | 3792fde251d0f1d5a6ca16c8ad1a71f89360c41d |
train | OrderedWebhook.feed | :param data:
One of these:
- ``str``, ``unicode`` (Python 2.7), or ``bytes`` (Python 3, decoded using UTF-8)
representing a JSON-serialized `Update <https://core.telegram.org/bots/api#update>`_ object.
- a ``dict`` representing an Update object. | telepot/loop.py | def feed(self, data):
"""
:param data:
One of these:
- ``str``, ``unicode`` (Python 2.7), or ``bytes`` (Python 3, decoded using UTF-8)
representing a JSON-serialized `Update <https://core.telegram.org/bots/api#update>`_ object.
- a ``dict`` representing... | def feed(self, data):
"""
:param data:
One of these:
- ``str``, ``unicode`` (Python 2.7), or ``bytes`` (Python 3, decoded using UTF-8)
representing a JSON-serialized `Update <https://core.telegram.org/bots/api#update>`_ object.
- a ``dict`` representing... | [
":",
"param",
"data",
":",
"One",
"of",
"these",
":"
] | nickoala/telepot | python | https://github.com/nickoala/telepot/blob/3792fde251d0f1d5a6ca16c8ad1a71f89360c41d/telepot/loop.py#L303-L313 | [
"def",
"feed",
"(",
"self",
",",
"data",
")",
":",
"update",
"=",
"_dictify",
"(",
"data",
")",
"self",
".",
"_orderer",
".",
"input_queue",
".",
"put",
"(",
"update",
")"
] | 3792fde251d0f1d5a6ca16c8ad1a71f89360c41d |
train | make_routing_table | :return:
a dictionary roughly equivalent to ``{'key1': obj.on_key1, 'key2': obj.on_key2, ...}``,
but ``obj`` does not have to define all methods. It may define the needed ones only.
:param obj: the object
:param keys: a list of keys
:param prefix: a string to be prepended to keys to make ... | telepot/aio/routing.py | def make_routing_table(obj, keys, prefix='on_'):
"""
:return:
a dictionary roughly equivalent to ``{'key1': obj.on_key1, 'key2': obj.on_key2, ...}``,
but ``obj`` does not have to define all methods. It may define the needed ones only.
:param obj: the object
:param keys: a list of keys
... | def make_routing_table(obj, keys, prefix='on_'):
"""
:return:
a dictionary roughly equivalent to ``{'key1': obj.on_key1, 'key2': obj.on_key2, ...}``,
but ``obj`` does not have to define all methods. It may define the needed ones only.
:param obj: the object
:param keys: a list of keys
... | [
":",
"return",
":",
"a",
"dictionary",
"roughly",
"equivalent",
"to",
"{",
"key1",
":",
"obj",
".",
"on_key1",
"key2",
":",
"obj",
".",
"on_key2",
"...",
"}",
"but",
"obj",
"does",
"not",
"have",
"to",
"define",
"all",
"methods",
".",
"It",
"may",
"d... | nickoala/telepot | python | https://github.com/nickoala/telepot/blob/3792fde251d0f1d5a6ca16c8ad1a71f89360c41d/telepot/aio/routing.py#L10-L33 | [
"def",
"make_routing_table",
"(",
"obj",
",",
"keys",
",",
"prefix",
"=",
"'on_'",
")",
":",
"def",
"maptuple",
"(",
"k",
")",
":",
"if",
"isinstance",
"(",
"k",
",",
"tuple",
")",
":",
"if",
"len",
"(",
"k",
")",
"==",
"2",
":",
"return",
"k",
... | 3792fde251d0f1d5a6ca16c8ad1a71f89360c41d |
train | by_content_type | :return:
A key function that returns a 2-tuple (content_type, (msg[content_type],)).
In plain English, it returns the message's *content type* as the key,
and the corresponding content as a positional argument to the handler
function. | telepot/routing.py | def by_content_type():
"""
:return:
A key function that returns a 2-tuple (content_type, (msg[content_type],)).
In plain English, it returns the message's *content type* as the key,
and the corresponding content as a positional argument to the handler
function.
"""
def f(... | def by_content_type():
"""
:return:
A key function that returns a 2-tuple (content_type, (msg[content_type],)).
In plain English, it returns the message's *content type* as the key,
and the corresponding content as a positional argument to the handler
function.
"""
def f(... | [
":",
"return",
":",
"A",
"key",
"function",
"that",
"returns",
"a",
"2",
"-",
"tuple",
"(",
"content_type",
"(",
"msg",
"[",
"content_type",
"]",
"))",
".",
"In",
"plain",
"English",
"it",
"returns",
"the",
"message",
"s",
"*",
"content",
"type",
"*",
... | nickoala/telepot | python | https://github.com/nickoala/telepot/blob/3792fde251d0f1d5a6ca16c8ad1a71f89360c41d/telepot/routing.py#L17-L28 | [
"def",
"by_content_type",
"(",
")",
":",
"def",
"f",
"(",
"msg",
")",
":",
"content_type",
"=",
"glance",
"(",
"msg",
",",
"flavor",
"=",
"'chat'",
")",
"[",
"0",
"]",
"return",
"content_type",
",",
"(",
"msg",
"[",
"content_type",
"]",
",",
")",
"... | 3792fde251d0f1d5a6ca16c8ad1a71f89360c41d |
train | by_command | :param extractor:
a function that takes one argument (the message) and returns a portion
of message to be interpreted. To extract the text of a chat message,
use ``lambda msg: msg['text']``.
:param prefix:
a list of special characters expected to indicate the head of a command.
... | telepot/routing.py | def by_command(extractor, prefix=('/',), separator=' ', pass_args=False):
"""
:param extractor:
a function that takes one argument (the message) and returns a portion
of message to be interpreted. To extract the text of a chat message,
use ``lambda msg: msg['text']``.
:param prefix:... | def by_command(extractor, prefix=('/',), separator=' ', pass_args=False):
"""
:param extractor:
a function that takes one argument (the message) and returns a portion
of message to be interpreted. To extract the text of a chat message,
use ``lambda msg: msg['text']``.
:param prefix:... | [
":",
"param",
"extractor",
":",
"a",
"function",
"that",
"takes",
"one",
"argument",
"(",
"the",
"message",
")",
"and",
"returns",
"a",
"portion",
"of",
"message",
"to",
"be",
"interpreted",
".",
"To",
"extract",
"the",
"text",
"of",
"a",
"chat",
"messag... | nickoala/telepot | python | https://github.com/nickoala/telepot/blob/3792fde251d0f1d5a6ca16c8ad1a71f89360c41d/telepot/routing.py#L30-L65 | [
"def",
"by_command",
"(",
"extractor",
",",
"prefix",
"=",
"(",
"'/'",
",",
")",
",",
"separator",
"=",
"' '",
",",
"pass_args",
"=",
"False",
")",
":",
"if",
"not",
"isinstance",
"(",
"prefix",
",",
"(",
"tuple",
",",
"list",
")",
")",
":",
"prefi... | 3792fde251d0f1d5a6ca16c8ad1a71f89360c41d |
train | by_chat_command | :param prefix:
a list of special characters expected to indicate the head of a command.
:param separator:
a command may be followed by arguments separated by ``separator``.
:type pass_args: bool
:param pass_args:
If ``True``, arguments following a command will be passed to the hand... | telepot/routing.py | def by_chat_command(prefix=('/',), separator=' ', pass_args=False):
"""
:param prefix:
a list of special characters expected to indicate the head of a command.
:param separator:
a command may be followed by arguments separated by ``separator``.
:type pass_args: bool
:param pass_arg... | def by_chat_command(prefix=('/',), separator=' ', pass_args=False):
"""
:param prefix:
a list of special characters expected to indicate the head of a command.
:param separator:
a command may be followed by arguments separated by ``separator``.
:type pass_args: bool
:param pass_arg... | [
":",
"param",
"prefix",
":",
"a",
"list",
"of",
"special",
"characters",
"expected",
"to",
"indicate",
"the",
"head",
"of",
"a",
"command",
"."
] | nickoala/telepot | python | https://github.com/nickoala/telepot/blob/3792fde251d0f1d5a6ca16c8ad1a71f89360c41d/telepot/routing.py#L67-L87 | [
"def",
"by_chat_command",
"(",
"prefix",
"=",
"(",
"'/'",
",",
")",
",",
"separator",
"=",
"' '",
",",
"pass_args",
"=",
"False",
")",
":",
"return",
"by_command",
"(",
"lambda",
"msg",
":",
"msg",
"[",
"'text'",
"]",
",",
"prefix",
",",
"separator",
... | 3792fde251d0f1d5a6ca16c8ad1a71f89360c41d |
train | by_regex | :param extractor:
a function that takes one argument (the message) and returns a portion
of message to be interpreted. To extract the text of a chat message,
use ``lambda msg: msg['text']``.
:type regex: str or regex object
:param regex: the pattern to look for
:param key: the part... | telepot/routing.py | def by_regex(extractor, regex, key=1):
"""
:param extractor:
a function that takes one argument (the message) and returns a portion
of message to be interpreted. To extract the text of a chat message,
use ``lambda msg: msg['text']``.
:type regex: str or regex object
:param regex... | def by_regex(extractor, regex, key=1):
"""
:param extractor:
a function that takes one argument (the message) and returns a portion
of message to be interpreted. To extract the text of a chat message,
use ``lambda msg: msg['text']``.
:type regex: str or regex object
:param regex... | [
":",
"param",
"extractor",
":",
"a",
"function",
"that",
"takes",
"one",
"argument",
"(",
"the",
"message",
")",
"and",
"returns",
"a",
"portion",
"of",
"message",
"to",
"be",
"interpreted",
".",
"To",
"extract",
"the",
"text",
"of",
"a",
"chat",
"messag... | nickoala/telepot | python | https://github.com/nickoala/telepot/blob/3792fde251d0f1d5a6ca16c8ad1a71f89360c41d/telepot/routing.py#L103-L132 | [
"def",
"by_regex",
"(",
"extractor",
",",
"regex",
",",
"key",
"=",
"1",
")",
":",
"if",
"_isstring",
"(",
"regex",
")",
":",
"regex",
"=",
"re",
".",
"compile",
"(",
"regex",
")",
"def",
"f",
"(",
"msg",
")",
":",
"text",
"=",
"extractor",
"(",
... | 3792fde251d0f1d5a6ca16c8ad1a71f89360c41d |
train | process_key | :param processor:
a function to process the key returned by the supplied key function
:param fn:
a key function
:return:
a function that wraps around the supplied key function to further
process the key before returning. | telepot/routing.py | def process_key(processor, fn):
"""
:param processor:
a function to process the key returned by the supplied key function
:param fn:
a key function
:return:
a function that wraps around the supplied key function to further
process the key before returning.
"""
d... | def process_key(processor, fn):
"""
:param processor:
a function to process the key returned by the supplied key function
:param fn:
a key function
:return:
a function that wraps around the supplied key function to further
process the key before returning.
"""
d... | [
":",
"param",
"processor",
":",
"a",
"function",
"to",
"process",
"the",
"key",
"returned",
"by",
"the",
"supplied",
"key",
"function"
] | nickoala/telepot | python | https://github.com/nickoala/telepot/blob/3792fde251d0f1d5a6ca16c8ad1a71f89360c41d/telepot/routing.py#L134-L152 | [
"def",
"process_key",
"(",
"processor",
",",
"fn",
")",
":",
"def",
"f",
"(",
"*",
"aa",
",",
"*",
"*",
"kw",
")",
":",
"k",
"=",
"fn",
"(",
"*",
"aa",
",",
"*",
"*",
"kw",
")",
"if",
"isinstance",
"(",
"k",
",",
"(",
"tuple",
",",
"list",
... | 3792fde251d0f1d5a6ca16c8ad1a71f89360c41d |
train | lower_key | :param fn: a key function
:return:
a function that wraps around the supplied key function to ensure
the returned key is in lowercase. | telepot/routing.py | def lower_key(fn):
"""
:param fn: a key function
:return:
a function that wraps around the supplied key function to ensure
the returned key is in lowercase.
"""
def lower(key):
try:
return key.lower()
except AttributeError:
return key
retu... | def lower_key(fn):
"""
:param fn: a key function
:return:
a function that wraps around the supplied key function to ensure
the returned key is in lowercase.
"""
def lower(key):
try:
return key.lower()
except AttributeError:
return key
retu... | [
":",
"param",
"fn",
":",
"a",
"key",
"function"
] | nickoala/telepot | python | https://github.com/nickoala/telepot/blob/3792fde251d0f1d5a6ca16c8ad1a71f89360c41d/telepot/routing.py#L154-L167 | [
"def",
"lower_key",
"(",
"fn",
")",
":",
"def",
"lower",
"(",
"key",
")",
":",
"try",
":",
"return",
"key",
".",
"lower",
"(",
")",
"except",
"AttributeError",
":",
"return",
"key",
"return",
"process_key",
"(",
"lower",
",",
"fn",
")"
] | 3792fde251d0f1d5a6ca16c8ad1a71f89360c41d |
train | upper_key | :param fn: a key function
:return:
a function that wraps around the supplied key function to ensure
the returned key is in uppercase. | telepot/routing.py | def upper_key(fn):
"""
:param fn: a key function
:return:
a function that wraps around the supplied key function to ensure
the returned key is in uppercase.
"""
def upper(key):
try:
return key.upper()
except AttributeError:
return key
retu... | def upper_key(fn):
"""
:param fn: a key function
:return:
a function that wraps around the supplied key function to ensure
the returned key is in uppercase.
"""
def upper(key):
try:
return key.upper()
except AttributeError:
return key
retu... | [
":",
"param",
"fn",
":",
"a",
"key",
"function"
] | nickoala/telepot | python | https://github.com/nickoala/telepot/blob/3792fde251d0f1d5a6ca16c8ad1a71f89360c41d/telepot/routing.py#L169-L182 | [
"def",
"upper_key",
"(",
"fn",
")",
":",
"def",
"upper",
"(",
"key",
")",
":",
"try",
":",
"return",
"key",
".",
"upper",
"(",
")",
"except",
"AttributeError",
":",
"return",
"key",
"return",
"process_key",
"(",
"upper",
",",
"fn",
")"
] | 3792fde251d0f1d5a6ca16c8ad1a71f89360c41d |
train | make_routing_table | :return:
a dictionary roughly equivalent to ``{'key1': obj.on_key1, 'key2': obj.on_key2, ...}``,
but ``obj`` does not have to define all methods. It may define the needed ones only.
:param obj: the object
:param keys: a list of keys
:param prefix: a string to be prepended to keys to make ... | telepot/routing.py | def make_routing_table(obj, keys, prefix='on_'):
"""
:return:
a dictionary roughly equivalent to ``{'key1': obj.on_key1, 'key2': obj.on_key2, ...}``,
but ``obj`` does not have to define all methods. It may define the needed ones only.
:param obj: the object
:param keys: a list of keys
... | def make_routing_table(obj, keys, prefix='on_'):
"""
:return:
a dictionary roughly equivalent to ``{'key1': obj.on_key1, 'key2': obj.on_key2, ...}``,
but ``obj`` does not have to define all methods. It may define the needed ones only.
:param obj: the object
:param keys: a list of keys
... | [
":",
"return",
":",
"a",
"dictionary",
"roughly",
"equivalent",
"to",
"{",
"key1",
":",
"obj",
".",
"on_key1",
"key2",
":",
"obj",
".",
"on_key2",
"...",
"}",
"but",
"obj",
"does",
"not",
"have",
"to",
"define",
"all",
"methods",
".",
"It",
"may",
"d... | nickoala/telepot | python | https://github.com/nickoala/telepot/blob/3792fde251d0f1d5a6ca16c8ad1a71f89360c41d/telepot/routing.py#L184-L210 | [
"def",
"make_routing_table",
"(",
"obj",
",",
"keys",
",",
"prefix",
"=",
"'on_'",
")",
":",
"def",
"maptuple",
"(",
"k",
")",
":",
"if",
"isinstance",
"(",
"k",
",",
"tuple",
")",
":",
"if",
"len",
"(",
"k",
")",
"==",
"2",
":",
"return",
"k",
... | 3792fde251d0f1d5a6ca16c8ad1a71f89360c41d |
train | openable | A class decorator to fill in certain methods and properties to ensure
a class can be used by :func:`.create_open`.
These instance methods and property will be added, if not defined
by the class:
- ``open(self, initial_msg, seed)``
- ``on_message(self, msg)``
- ``on_close(self, ex)``
- ``cl... | telepot/helper.py | def openable(cls):
"""
A class decorator to fill in certain methods and properties to ensure
a class can be used by :func:`.create_open`.
These instance methods and property will be added, if not defined
by the class:
- ``open(self, initial_msg, seed)``
- ``on_message(self, msg)``
- ``... | def openable(cls):
"""
A class decorator to fill in certain methods and properties to ensure
a class can be used by :func:`.create_open`.
These instance methods and property will be added, if not defined
by the class:
- ``open(self, initial_msg, seed)``
- ``on_message(self, msg)``
- ``... | [
"A",
"class",
"decorator",
"to",
"fill",
"in",
"certain",
"methods",
"and",
"properties",
"to",
"ensure",
"a",
"class",
"can",
"be",
"used",
"by",
":",
"func",
":",
".",
"create_open",
"."
] | nickoala/telepot | python | https://github.com/nickoala/telepot/blob/3792fde251d0f1d5a6ca16c8ad1a71f89360c41d/telepot/helper.py#L925-L967 | [
"def",
"openable",
"(",
"cls",
")",
":",
"def",
"open",
"(",
"self",
",",
"initial_msg",
",",
"seed",
")",
":",
"pass",
"def",
"on_message",
"(",
"self",
",",
"msg",
")",
":",
"raise",
"NotImplementedError",
"(",
")",
"def",
"on_close",
"(",
"self",
... | 3792fde251d0f1d5a6ca16c8ad1a71f89360c41d |
train | Listener.wait | Block until a matched message appears. | telepot/helper.py | def wait(self):
"""
Block until a matched message appears.
"""
if not self._patterns:
raise RuntimeError('Listener has nothing to capture')
while 1:
msg = self._queue.get(block=True)
if any(map(lambda p: filtering.match_all(msg, p), self._pat... | def wait(self):
"""
Block until a matched message appears.
"""
if not self._patterns:
raise RuntimeError('Listener has nothing to capture')
while 1:
msg = self._queue.get(block=True)
if any(map(lambda p: filtering.match_all(msg, p), self._pat... | [
"Block",
"until",
"a",
"matched",
"message",
"appears",
"."
] | nickoala/telepot | python | https://github.com/nickoala/telepot/blob/3792fde251d0f1d5a6ca16c8ad1a71f89360c41d/telepot/helper.py#L77-L88 | [
"def",
"wait",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"_patterns",
":",
"raise",
"RuntimeError",
"(",
"'Listener has nothing to capture'",
")",
"while",
"1",
":",
"msg",
"=",
"self",
".",
"_queue",
".",
"get",
"(",
"block",
"=",
"True",
")",
... | 3792fde251d0f1d5a6ca16c8ad1a71f89360c41d |
train | Answerer.answer | Spawns a thread that calls ``compute fn`` (along with additional arguments
``*compute_args`` and ``**compute_kwargs``), then applies the returned value to
:meth:`.Bot.answerInlineQuery` to answer the inline query.
If a preceding thread is already working for a user, that thread is cancelled,
... | telepot/helper.py | def answer(outerself, inline_query, compute_fn, *compute_args, **compute_kwargs):
"""
Spawns a thread that calls ``compute fn`` (along with additional arguments
``*compute_args`` and ``**compute_kwargs``), then applies the returned value to
:meth:`.Bot.answerInlineQuery` to answer the in... | def answer(outerself, inline_query, compute_fn, *compute_args, **compute_kwargs):
"""
Spawns a thread that calls ``compute fn`` (along with additional arguments
``*compute_args`` and ``**compute_kwargs``), then applies the returned value to
:meth:`.Bot.answerInlineQuery` to answer the in... | [
"Spawns",
"a",
"thread",
"that",
"calls",
"compute",
"fn",
"(",
"along",
"with",
"additional",
"arguments",
"*",
"compute_args",
"and",
"**",
"compute_kwargs",
")",
"then",
"applies",
"the",
"returned",
"value",
"to",
":",
"meth",
":",
".",
"Bot",
".",
"an... | nickoala/telepot | python | https://github.com/nickoala/telepot/blob/3792fde251d0f1d5a6ca16c8ad1a71f89360c41d/telepot/helper.py#L241-L311 | [
"def",
"answer",
"(",
"outerself",
",",
"inline_query",
",",
"compute_fn",
",",
"*",
"compute_args",
",",
"*",
"*",
"compute_kwargs",
")",
":",
"from_id",
"=",
"inline_query",
"[",
"'from'",
"]",
"[",
"'id'",
"]",
"class",
"Worker",
"(",
"threading",
".",
... | 3792fde251d0f1d5a6ca16c8ad1a71f89360c41d |
train | CallbackQueryCoordinator.configure | Configure a :class:`.Listener` to capture callback query | telepot/helper.py | def configure(self, listener):
"""
Configure a :class:`.Listener` to capture callback query
"""
listener.capture([
lambda msg: flavor(msg) == 'callback_query',
{'message': self._chat_origin_included}
])
listener.capture([
lambda msg: f... | def configure(self, listener):
"""
Configure a :class:`.Listener` to capture callback query
"""
listener.capture([
lambda msg: flavor(msg) == 'callback_query',
{'message': self._chat_origin_included}
])
listener.capture([
lambda msg: f... | [
"Configure",
"a",
":",
"class",
":",
".",
"Listener",
"to",
"capture",
"callback",
"query"
] | nickoala/telepot | python | https://github.com/nickoala/telepot/blob/3792fde251d0f1d5a6ca16c8ad1a71f89360c41d/telepot/helper.py#L366-L378 | [
"def",
"configure",
"(",
"self",
",",
"listener",
")",
":",
"listener",
".",
"capture",
"(",
"[",
"lambda",
"msg",
":",
"flavor",
"(",
"msg",
")",
"==",
"'callback_query'",
",",
"{",
"'message'",
":",
"self",
".",
"_chat_origin_included",
"}",
"]",
")",
... | 3792fde251d0f1d5a6ca16c8ad1a71f89360c41d |
train | CallbackQueryCoordinator.augment_send | :param send_func:
a function that sends messages, such as :meth:`.Bot.send\*`
:return:
a function that wraps around ``send_func`` and examines whether the
sent message contains an inline keyboard with callback data. If so,
future callback query originating from t... | telepot/helper.py | def augment_send(self, send_func):
"""
:param send_func:
a function that sends messages, such as :meth:`.Bot.send\*`
:return:
a function that wraps around ``send_func`` and examines whether the
sent message contains an inline keyboard with callback data. If s... | def augment_send(self, send_func):
"""
:param send_func:
a function that sends messages, such as :meth:`.Bot.send\*`
:return:
a function that wraps around ``send_func`` and examines whether the
sent message contains an inline keyboard with callback data. If s... | [
":",
"param",
"send_func",
":",
"a",
"function",
"that",
"sends",
"messages",
"such",
"as",
":",
"meth",
":",
".",
"Bot",
".",
"send",
"\\",
"*"
] | nickoala/telepot | python | https://github.com/nickoala/telepot/blob/3792fde251d0f1d5a6ca16c8ad1a71f89360c41d/telepot/helper.py#L426-L443 | [
"def",
"augment_send",
"(",
"self",
",",
"send_func",
")",
":",
"def",
"augmented",
"(",
"*",
"aa",
",",
"*",
"*",
"kw",
")",
":",
"sent",
"=",
"send_func",
"(",
"*",
"aa",
",",
"*",
"*",
"kw",
")",
"if",
"self",
".",
"_enable_chat",
"and",
"self... | 3792fde251d0f1d5a6ca16c8ad1a71f89360c41d |
train | CallbackQueryCoordinator.augment_delete | :param delete_func:
a function that deletes messages, such as :meth:`.Bot.deleteMessage`
:return:
a function that wraps around ``delete_func`` and stops capturing
callback query originating from that deleted message. | telepot/helper.py | def augment_delete(self, delete_func):
"""
:param delete_func:
a function that deletes messages, such as :meth:`.Bot.deleteMessage`
:return:
a function that wraps around ``delete_func`` and stops capturing
callback query originating from that deleted message.... | def augment_delete(self, delete_func):
"""
:param delete_func:
a function that deletes messages, such as :meth:`.Bot.deleteMessage`
:return:
a function that wraps around ``delete_func`` and stops capturing
callback query originating from that deleted message.... | [
":",
"param",
"delete_func",
":",
"a",
"function",
"that",
"deletes",
"messages",
"such",
"as",
":",
"meth",
":",
".",
"Bot",
".",
"deleteMessage"
] | nickoala/telepot | python | https://github.com/nickoala/telepot/blob/3792fde251d0f1d5a6ca16c8ad1a71f89360c41d/telepot/helper.py#L468-L484 | [
"def",
"augment_delete",
"(",
"self",
",",
"delete_func",
")",
":",
"def",
"augmented",
"(",
"msg_identifier",
",",
"*",
"aa",
",",
"*",
"*",
"kw",
")",
":",
"deleted",
"=",
"delete_func",
"(",
"msg_identifier",
",",
"*",
"aa",
",",
"*",
"*",
"kw",
"... | 3792fde251d0f1d5a6ca16c8ad1a71f89360c41d |
train | CallbackQueryCoordinator.augment_bot | :return:
a proxy to ``bot`` with these modifications:
- all ``send*`` methods augmented by :meth:`augment_send`
- all ``edit*`` methods augmented by :meth:`augment_edit`
- ``deleteMessage()`` augmented by :meth:`augment_delete`
- all other public methods, inc... | telepot/helper.py | def augment_bot(self, bot):
"""
:return:
a proxy to ``bot`` with these modifications:
- all ``send*`` methods augmented by :meth:`augment_send`
- all ``edit*`` methods augmented by :meth:`augment_edit`
- ``deleteMessage()`` augmented by :meth:`augment_del... | def augment_bot(self, bot):
"""
:return:
a proxy to ``bot`` with these modifications:
- all ``send*`` methods augmented by :meth:`augment_send`
- all ``edit*`` methods augmented by :meth:`augment_edit`
- ``deleteMessage()`` augmented by :meth:`augment_del... | [
":",
"return",
":",
"a",
"proxy",
"to",
"bot",
"with",
"these",
"modifications",
":"
] | nickoala/telepot | python | https://github.com/nickoala/telepot/blob/3792fde251d0f1d5a6ca16c8ad1a71f89360c41d/telepot/helper.py#L507-L562 | [
"def",
"augment_bot",
"(",
"self",
",",
"bot",
")",
":",
"# Because a plain object cannot be set attributes, we need a class.",
"class",
"BotProxy",
"(",
"object",
")",
":",
"pass",
"proxy",
"=",
"BotProxy",
"(",
")",
"send_methods",
"=",
"[",
"'sendMessage'",
",",
... | 3792fde251d0f1d5a6ca16c8ad1a71f89360c41d |
train | IdleEventCoordinator.refresh | Refresh timeout timer | telepot/helper.py | def refresh(self):
""" Refresh timeout timer """
try:
if self._timeout_event:
self._scheduler.cancel(self._timeout_event)
# Timeout event has been popped from queue prematurely
except exception.EventNotFound:
pass
# Ensure a new event is ... | def refresh(self):
""" Refresh timeout timer """
try:
if self._timeout_event:
self._scheduler.cancel(self._timeout_event)
# Timeout event has been popped from queue prematurely
except exception.EventNotFound:
pass
# Ensure a new event is ... | [
"Refresh",
"timeout",
"timer"
] | nickoala/telepot | python | https://github.com/nickoala/telepot/blob/3792fde251d0f1d5a6ca16c8ad1a71f89360c41d/telepot/helper.py#L659-L673 | [
"def",
"refresh",
"(",
"self",
")",
":",
"try",
":",
"if",
"self",
".",
"_timeout_event",
":",
"self",
".",
"_scheduler",
".",
"cancel",
"(",
"self",
".",
"_timeout_event",
")",
"# Timeout event has been popped from queue prematurely",
"except",
"exception",
".",
... | 3792fde251d0f1d5a6ca16c8ad1a71f89360c41d |
train | IdleEventCoordinator.augment_on_message | :return:
a function wrapping ``handler`` to refresh timer for every
non-event message | telepot/helper.py | def augment_on_message(self, handler):
"""
:return:
a function wrapping ``handler`` to refresh timer for every
non-event message
"""
def augmented(msg):
# Reset timer if this is an external message
is_event(msg) or self.refresh()
... | def augment_on_message(self, handler):
"""
:return:
a function wrapping ``handler`` to refresh timer for every
non-event message
"""
def augmented(msg):
# Reset timer if this is an external message
is_event(msg) or self.refresh()
... | [
":",
"return",
":",
"a",
"function",
"wrapping",
"handler",
"to",
"refresh",
"timer",
"for",
"every",
"non",
"-",
"event",
"message"
] | nickoala/telepot | python | https://github.com/nickoala/telepot/blob/3792fde251d0f1d5a6ca16c8ad1a71f89360c41d/telepot/helper.py#L675-L690 | [
"def",
"augment_on_message",
"(",
"self",
",",
"handler",
")",
":",
"def",
"augmented",
"(",
"msg",
")",
":",
"# Reset timer if this is an external message",
"is_event",
"(",
"msg",
")",
"or",
"self",
".",
"refresh",
"(",
")",
"# Ignore timeout event that have been ... | 3792fde251d0f1d5a6ca16c8ad1a71f89360c41d |
train | IdleEventCoordinator.augment_on_close | :return:
a function wrapping ``handler`` to cancel timeout event | telepot/helper.py | def augment_on_close(self, handler):
"""
:return:
a function wrapping ``handler`` to cancel timeout event
"""
def augmented(ex):
try:
if self._timeout_event:
self._scheduler.cancel(self._timeout_event)
self._... | def augment_on_close(self, handler):
"""
:return:
a function wrapping ``handler`` to cancel timeout event
"""
def augmented(ex):
try:
if self._timeout_event:
self._scheduler.cancel(self._timeout_event)
self._... | [
":",
"return",
":",
"a",
"function",
"wrapping",
"handler",
"to",
"cancel",
"timeout",
"event"
] | nickoala/telepot | python | https://github.com/nickoala/telepot/blob/3792fde251d0f1d5a6ca16c8ad1a71f89360c41d/telepot/helper.py#L692-L707 | [
"def",
"augment_on_close",
"(",
"self",
",",
"handler",
")",
":",
"def",
"augmented",
"(",
"ex",
")",
":",
"try",
":",
"if",
"self",
".",
"_timeout_event",
":",
"self",
".",
"_scheduler",
".",
"cancel",
"(",
"self",
".",
"_timeout_event",
")",
"self",
... | 3792fde251d0f1d5a6ca16c8ad1a71f89360c41d |
train | StandardEventScheduler.configure | Configure a :class:`.Listener` to capture events with this object's
event space and source id. | telepot/helper.py | def configure(self, listener):
"""
Configure a :class:`.Listener` to capture events with this object's
event space and source id.
"""
listener.capture([{re.compile('^_.+'): {'source': {'space': self._event_space, 'id': self._source_id}}}]) | def configure(self, listener):
"""
Configure a :class:`.Listener` to capture events with this object's
event space and source id.
"""
listener.capture([{re.compile('^_.+'): {'source': {'space': self._event_space, 'id': self._source_id}}}]) | [
"Configure",
"a",
":",
"class",
":",
".",
"Listener",
"to",
"capture",
"events",
"with",
"this",
"object",
"s",
"event",
"space",
"and",
"source",
"id",
"."
] | nickoala/telepot | python | https://github.com/nickoala/telepot/blob/3792fde251d0f1d5a6ca16c8ad1a71f89360c41d/telepot/helper.py#L767-L772 | [
"def",
"configure",
"(",
"self",
",",
"listener",
")",
":",
"listener",
".",
"capture",
"(",
"[",
"{",
"re",
".",
"compile",
"(",
"'^_.+'",
")",
":",
"{",
"'source'",
":",
"{",
"'space'",
":",
"self",
".",
"_event_space",
",",
"'id'",
":",
"self",
... | 3792fde251d0f1d5a6ca16c8ad1a71f89360c41d |
train | StandardEventScheduler.make_event_data | Marshall ``flavor`` and ``data`` into a standard event. | telepot/helper.py | def make_event_data(self, flavor, data):
"""
Marshall ``flavor`` and ``data`` into a standard event.
"""
if not flavor.startswith('_'):
raise ValueError('Event flavor must start with _underscore')
d = {'source': {'space': self._event_space, 'id': self._source_id}}
... | def make_event_data(self, flavor, data):
"""
Marshall ``flavor`` and ``data`` into a standard event.
"""
if not flavor.startswith('_'):
raise ValueError('Event flavor must start with _underscore')
d = {'source': {'space': self._event_space, 'id': self._source_id}}
... | [
"Marshall",
"flavor",
"and",
"data",
"into",
"a",
"standard",
"event",
"."
] | nickoala/telepot | python | https://github.com/nickoala/telepot/blob/3792fde251d0f1d5a6ca16c8ad1a71f89360c41d/telepot/helper.py#L774-L783 | [
"def",
"make_event_data",
"(",
"self",
",",
"flavor",
",",
"data",
")",
":",
"if",
"not",
"flavor",
".",
"startswith",
"(",
"'_'",
")",
":",
"raise",
"ValueError",
"(",
"'Event flavor must start with _underscore'",
")",
"d",
"=",
"{",
"'source'",
":",
"{",
... | 3792fde251d0f1d5a6ca16c8ad1a71f89360c41d |
train | StandardEventScheduler.event_at | Schedule an event to be emitted at a certain time.
:param when: an absolute timestamp
:param data_tuple: a 2-tuple (flavor, data)
:return: an event object, useful for cancelling. | telepot/helper.py | def event_at(self, when, data_tuple):
"""
Schedule an event to be emitted at a certain time.
:param when: an absolute timestamp
:param data_tuple: a 2-tuple (flavor, data)
:return: an event object, useful for cancelling.
"""
return self._base.event_at(when, self.... | def event_at(self, when, data_tuple):
"""
Schedule an event to be emitted at a certain time.
:param when: an absolute timestamp
:param data_tuple: a 2-tuple (flavor, data)
:return: an event object, useful for cancelling.
"""
return self._base.event_at(when, self.... | [
"Schedule",
"an",
"event",
"to",
"be",
"emitted",
"at",
"a",
"certain",
"time",
"."
] | nickoala/telepot | python | https://github.com/nickoala/telepot/blob/3792fde251d0f1d5a6ca16c8ad1a71f89360c41d/telepot/helper.py#L785-L793 | [
"def",
"event_at",
"(",
"self",
",",
"when",
",",
"data_tuple",
")",
":",
"return",
"self",
".",
"_base",
".",
"event_at",
"(",
"when",
",",
"self",
".",
"make_event_data",
"(",
"*",
"data_tuple",
")",
")"
] | 3792fde251d0f1d5a6ca16c8ad1a71f89360c41d |
train | StandardEventScheduler.event_later | Schedule an event to be emitted after a delay.
:param delay: number of seconds
:param data_tuple: a 2-tuple (flavor, data)
:return: an event object, useful for cancelling. | telepot/helper.py | def event_later(self, delay, data_tuple):
"""
Schedule an event to be emitted after a delay.
:param delay: number of seconds
:param data_tuple: a 2-tuple (flavor, data)
:return: an event object, useful for cancelling.
"""
return self._base.event_later(delay, self... | def event_later(self, delay, data_tuple):
"""
Schedule an event to be emitted after a delay.
:param delay: number of seconds
:param data_tuple: a 2-tuple (flavor, data)
:return: an event object, useful for cancelling.
"""
return self._base.event_later(delay, self... | [
"Schedule",
"an",
"event",
"to",
"be",
"emitted",
"after",
"a",
"delay",
"."
] | nickoala/telepot | python | https://github.com/nickoala/telepot/blob/3792fde251d0f1d5a6ca16c8ad1a71f89360c41d/telepot/helper.py#L795-L803 | [
"def",
"event_later",
"(",
"self",
",",
"delay",
",",
"data_tuple",
")",
":",
"return",
"self",
".",
"_base",
".",
"event_later",
"(",
"delay",
",",
"self",
".",
"make_event_data",
"(",
"*",
"data_tuple",
")",
")"
] | 3792fde251d0f1d5a6ca16c8ad1a71f89360c41d |
train | Router.map | Apply key function to ``msg`` to obtain a key. Return the routing table entry. | telepot/helper.py | def map(self, msg):
"""
Apply key function to ``msg`` to obtain a key. Return the routing table entry.
"""
k = self.key_function(msg)
key = k[0] if isinstance(k, (tuple, list)) else k
return self.routing_table[key] | def map(self, msg):
"""
Apply key function to ``msg`` to obtain a key. Return the routing table entry.
"""
k = self.key_function(msg)
key = k[0] if isinstance(k, (tuple, list)) else k
return self.routing_table[key] | [
"Apply",
"key",
"function",
"to",
"msg",
"to",
"obtain",
"a",
"key",
".",
"Return",
"the",
"routing",
"table",
"entry",
"."
] | nickoala/telepot | python | https://github.com/nickoala/telepot/blob/3792fde251d0f1d5a6ca16c8ad1a71f89360c41d/telepot/helper.py#L1002-L1008 | [
"def",
"map",
"(",
"self",
",",
"msg",
")",
":",
"k",
"=",
"self",
".",
"key_function",
"(",
"msg",
")",
"key",
"=",
"k",
"[",
"0",
"]",
"if",
"isinstance",
"(",
"k",
",",
"(",
"tuple",
",",
"list",
")",
")",
"else",
"k",
"return",
"self",
".... | 3792fde251d0f1d5a6ca16c8ad1a71f89360c41d |
train | Router.route | Apply key function to ``msg`` to obtain a key, look up routing table
to obtain a handler function, then call the handler function with
positional and keyword arguments, if any is returned by the key function.
``*aa`` and ``**kw`` are dummy placeholders for easy chaining.
Regardless of a... | telepot/helper.py | def route(self, msg, *aa, **kw):
"""
Apply key function to ``msg`` to obtain a key, look up routing table
to obtain a handler function, then call the handler function with
positional and keyword arguments, if any is returned by the key function.
``*aa`` and ``**kw`` are dummy pl... | def route(self, msg, *aa, **kw):
"""
Apply key function to ``msg`` to obtain a key, look up routing table
to obtain a handler function, then call the handler function with
positional and keyword arguments, if any is returned by the key function.
``*aa`` and ``**kw`` are dummy pl... | [
"Apply",
"key",
"function",
"to",
"msg",
"to",
"obtain",
"a",
"key",
"look",
"up",
"routing",
"table",
"to",
"obtain",
"a",
"handler",
"function",
"then",
"call",
"the",
"handler",
"function",
"with",
"positional",
"and",
"keyword",
"arguments",
"if",
"any",... | nickoala/telepot | python | https://github.com/nickoala/telepot/blob/3792fde251d0f1d5a6ca16c8ad1a71f89360c41d/telepot/helper.py#L1010-L1041 | [
"def",
"route",
"(",
"self",
",",
"msg",
",",
"*",
"aa",
",",
"*",
"*",
"kw",
")",
":",
"k",
"=",
"self",
".",
"key_function",
"(",
"msg",
")",
"if",
"isinstance",
"(",
"k",
",",
"(",
"tuple",
",",
"list",
")",
")",
":",
"key",
",",
"args",
... | 3792fde251d0f1d5a6ca16c8ad1a71f89360c41d |
train | apply_entities_as_html | Format text as HTML. Also take care of escaping special characters.
Returned value can be passed to :meth:`.Bot.sendMessage` with appropriate
``parse_mode``.
:param text:
plain text
:param entities:
a list of `MessageEntity <https://core.telegram.org/bots/api#messageentity>`_ objects | telepot/text.py | def apply_entities_as_html(text, entities):
"""
Format text as HTML. Also take care of escaping special characters.
Returned value can be passed to :meth:`.Bot.sendMessage` with appropriate
``parse_mode``.
:param text:
plain text
:param entities:
a list of `MessageEntity <https... | def apply_entities_as_html(text, entities):
"""
Format text as HTML. Also take care of escaping special characters.
Returned value can be passed to :meth:`.Bot.sendMessage` with appropriate
``parse_mode``.
:param text:
plain text
:param entities:
a list of `MessageEntity <https... | [
"Format",
"text",
"as",
"HTML",
".",
"Also",
"take",
"care",
"of",
"escaping",
"special",
"characters",
".",
"Returned",
"value",
"can",
"be",
"passed",
"to",
":",
"meth",
":",
".",
"Bot",
".",
"sendMessage",
"with",
"appropriate",
"parse_mode",
"."
] | nickoala/telepot | python | https://github.com/nickoala/telepot/blob/3792fde251d0f1d5a6ca16c8ad1a71f89360c41d/telepot/text.py#L65-L88 | [
"def",
"apply_entities_as_html",
"(",
"text",
",",
"entities",
")",
":",
"escapes",
"=",
"{",
"'<'",
":",
"'<'",
",",
"'>'",
":",
"'>'",
",",
"'&'",
":",
"'&'",
",",
"}",
"formatters",
"=",
"{",
"'bold'",
":",
"lambda",
"s",
",",
"e",
":",
... | 3792fde251d0f1d5a6ca16c8ad1a71f89360c41d |
train | call | :return:
a delegator function that returns a coroutine object by calling
``corofunc(seed_tuple, *args, **kwargs)``. | telepot/aio/delegate.py | def call(corofunc, *args, **kwargs):
"""
:return:
a delegator function that returns a coroutine object by calling
``corofunc(seed_tuple, *args, **kwargs)``.
"""
corofunc = _ensure_coroutine_function(corofunc)
def f(seed_tuple):
return corofunc(seed_tuple, *args, **kwargs)
... | def call(corofunc, *args, **kwargs):
"""
:return:
a delegator function that returns a coroutine object by calling
``corofunc(seed_tuple, *args, **kwargs)``.
"""
corofunc = _ensure_coroutine_function(corofunc)
def f(seed_tuple):
return corofunc(seed_tuple, *args, **kwargs)
... | [
":",
"return",
":",
"a",
"delegator",
"function",
"that",
"returns",
"a",
"coroutine",
"object",
"by",
"calling",
"corofunc",
"(",
"seed_tuple",
"*",
"args",
"**",
"kwargs",
")",
"."
] | nickoala/telepot | python | https://github.com/nickoala/telepot/blob/3792fde251d0f1d5a6ca16c8ad1a71f89360c41d/telepot/aio/delegate.py#L47-L56 | [
"def",
"call",
"(",
"corofunc",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"corofunc",
"=",
"_ensure_coroutine_function",
"(",
"corofunc",
")",
"def",
"f",
"(",
"seed_tuple",
")",
":",
"return",
"corofunc",
"(",
"seed_tuple",
",",
"*",
"args",
... | 3792fde251d0f1d5a6ca16c8ad1a71f89360c41d |
train | Bot.sendPhoto | See: https://core.telegram.org/bots/api#sendphoto
:param photo:
- string: ``file_id`` for a photo existing on Telegram servers
- string: HTTP URL of a photo from the Internet
- file-like object: obtained by ``open(path, 'rb')``
- tuple: (filename, file-like objec... | telepot/aio/__init__.py | async def sendPhoto(self, chat_id, photo,
caption=None,
parse_mode=None,
disable_notification=None,
reply_to_message_id=None,
reply_markup=None):
"""
See: https://core.telegram.org/bot... | async def sendPhoto(self, chat_id, photo,
caption=None,
parse_mode=None,
disable_notification=None,
reply_to_message_id=None,
reply_markup=None):
"""
See: https://core.telegram.org/bot... | [
"See",
":",
"https",
":",
"//",
"core",
".",
"telegram",
".",
"org",
"/",
"bots",
"/",
"api#sendphoto"
] | nickoala/telepot | python | https://github.com/nickoala/telepot/blob/3792fde251d0f1d5a6ca16c8ad1a71f89360c41d/telepot/aio/__init__.py#L108-L126 | [
"async",
"def",
"sendPhoto",
"(",
"self",
",",
"chat_id",
",",
"photo",
",",
"caption",
"=",
"None",
",",
"parse_mode",
"=",
"None",
",",
"disable_notification",
"=",
"None",
",",
"reply_to_message_id",
"=",
"None",
",",
"reply_markup",
"=",
"None",
")",
"... | 3792fde251d0f1d5a6ca16c8ad1a71f89360c41d |
train | Bot.sendAudio | See: https://core.telegram.org/bots/api#sendaudio
:param audio: Same as ``photo`` in :meth:`telepot.aio.Bot.sendPhoto` | telepot/aio/__init__.py | async def sendAudio(self, chat_id, audio,
caption=None,
parse_mode=None,
duration=None,
performer=None,
title=None,
disable_notification=None,
reply_to_... | async def sendAudio(self, chat_id, audio,
caption=None,
parse_mode=None,
duration=None,
performer=None,
title=None,
disable_notification=None,
reply_to_... | [
"See",
":",
"https",
":",
"//",
"core",
".",
"telegram",
".",
"org",
"/",
"bots",
"/",
"api#sendaudio"
] | nickoala/telepot | python | https://github.com/nickoala/telepot/blob/3792fde251d0f1d5a6ca16c8ad1a71f89360c41d/telepot/aio/__init__.py#L128-L143 | [
"async",
"def",
"sendAudio",
"(",
"self",
",",
"chat_id",
",",
"audio",
",",
"caption",
"=",
"None",
",",
"parse_mode",
"=",
"None",
",",
"duration",
"=",
"None",
",",
"performer",
"=",
"None",
",",
"title",
"=",
"None",
",",
"disable_notification",
"=",... | 3792fde251d0f1d5a6ca16c8ad1a71f89360c41d |
train | Bot.editMessageLiveLocation | See: https://core.telegram.org/bots/api#editmessagelivelocation
:param msg_identifier: Same as in :meth:`.Bot.editMessageText` | telepot/aio/__init__.py | async def editMessageLiveLocation(self, msg_identifier, latitude, longitude,
reply_markup=None):
"""
See: https://core.telegram.org/bots/api#editmessagelivelocation
:param msg_identifier: Same as in :meth:`.Bot.editMessageText`
"""
p = _stri... | async def editMessageLiveLocation(self, msg_identifier, latitude, longitude,
reply_markup=None):
"""
See: https://core.telegram.org/bots/api#editmessagelivelocation
:param msg_identifier: Same as in :meth:`.Bot.editMessageText`
"""
p = _stri... | [
"See",
":",
"https",
":",
"//",
"core",
".",
"telegram",
".",
"org",
"/",
"bots",
"/",
"api#editmessagelivelocation"
] | nickoala/telepot | python | https://github.com/nickoala/telepot/blob/3792fde251d0f1d5a6ca16c8ad1a71f89360c41d/telepot/aio/__init__.py#L248-L257 | [
"async",
"def",
"editMessageLiveLocation",
"(",
"self",
",",
"msg_identifier",
",",
"latitude",
",",
"longitude",
",",
"reply_markup",
"=",
"None",
")",
":",
"p",
"=",
"_strip",
"(",
"locals",
"(",
")",
",",
"more",
"=",
"[",
"'msg_identifier'",
"]",
")",
... | 3792fde251d0f1d5a6ca16c8ad1a71f89360c41d |
train | Bot.getFile | See: https://core.telegram.org/bots/api#getfile | telepot/aio/__init__.py | async def getFile(self, file_id):
""" See: https://core.telegram.org/bots/api#getfile """
p = _strip(locals())
return await self._api_request('getFile', _rectify(p)) | async def getFile(self, file_id):
""" See: https://core.telegram.org/bots/api#getfile """
p = _strip(locals())
return await self._api_request('getFile', _rectify(p)) | [
"See",
":",
"https",
":",
"//",
"core",
".",
"telegram",
".",
"org",
"/",
"bots",
"/",
"api#getfile"
] | nickoala/telepot | python | https://github.com/nickoala/telepot/blob/3792fde251d0f1d5a6ca16c8ad1a71f89360c41d/telepot/aio/__init__.py#L327-L330 | [
"async",
"def",
"getFile",
"(",
"self",
",",
"file_id",
")",
":",
"p",
"=",
"_strip",
"(",
"locals",
"(",
")",
")",
"return",
"await",
"self",
".",
"_api_request",
"(",
"'getFile'",
",",
"_rectify",
"(",
"p",
")",
")"
] | 3792fde251d0f1d5a6ca16c8ad1a71f89360c41d |
train | Bot.kickChatMember | See: https://core.telegram.org/bots/api#kickchatmember | telepot/aio/__init__.py | async def kickChatMember(self, chat_id, user_id,
until_date=None):
""" See: https://core.telegram.org/bots/api#kickchatmember """
p = _strip(locals())
return await self._api_request('kickChatMember', _rectify(p)) | async def kickChatMember(self, chat_id, user_id,
until_date=None):
""" See: https://core.telegram.org/bots/api#kickchatmember """
p = _strip(locals())
return await self._api_request('kickChatMember', _rectify(p)) | [
"See",
":",
"https",
":",
"//",
"core",
".",
"telegram",
".",
"org",
"/",
"bots",
"/",
"api#kickchatmember"
] | nickoala/telepot | python | https://github.com/nickoala/telepot/blob/3792fde251d0f1d5a6ca16c8ad1a71f89360c41d/telepot/aio/__init__.py#L332-L336 | [
"async",
"def",
"kickChatMember",
"(",
"self",
",",
"chat_id",
",",
"user_id",
",",
"until_date",
"=",
"None",
")",
":",
"p",
"=",
"_strip",
"(",
"locals",
"(",
")",
")",
"return",
"await",
"self",
".",
"_api_request",
"(",
"'kickChatMember'",
",",
"_rec... | 3792fde251d0f1d5a6ca16c8ad1a71f89360c41d |
train | Bot.restrictChatMember | See: https://core.telegram.org/bots/api#restrictchatmember | telepot/aio/__init__.py | async def restrictChatMember(self, chat_id, user_id,
until_date=None,
can_send_messages=None,
can_send_media_messages=None,
can_send_other_messages=None,
c... | async def restrictChatMember(self, chat_id, user_id,
until_date=None,
can_send_messages=None,
can_send_media_messages=None,
can_send_other_messages=None,
c... | [
"See",
":",
"https",
":",
"//",
"core",
".",
"telegram",
".",
"org",
"/",
"bots",
"/",
"api#restrictchatmember"
] | nickoala/telepot | python | https://github.com/nickoala/telepot/blob/3792fde251d0f1d5a6ca16c8ad1a71f89360c41d/telepot/aio/__init__.py#L343-L351 | [
"async",
"def",
"restrictChatMember",
"(",
"self",
",",
"chat_id",
",",
"user_id",
",",
"until_date",
"=",
"None",
",",
"can_send_messages",
"=",
"None",
",",
"can_send_media_messages",
"=",
"None",
",",
"can_send_other_messages",
"=",
"None",
",",
"can_add_web_pa... | 3792fde251d0f1d5a6ca16c8ad1a71f89360c41d |
train | Bot.setChatTitle | See: https://core.telegram.org/bots/api#setchattitle | telepot/aio/__init__.py | async def setChatTitle(self, chat_id, title):
""" See: https://core.telegram.org/bots/api#setchattitle """
p = _strip(locals())
return await self._api_request('setChatTitle', _rectify(p)) | async def setChatTitle(self, chat_id, title):
""" See: https://core.telegram.org/bots/api#setchattitle """
p = _strip(locals())
return await self._api_request('setChatTitle', _rectify(p)) | [
"See",
":",
"https",
":",
"//",
"core",
".",
"telegram",
".",
"org",
"/",
"bots",
"/",
"api#setchattitle"
] | nickoala/telepot | python | https://github.com/nickoala/telepot/blob/3792fde251d0f1d5a6ca16c8ad1a71f89360c41d/telepot/aio/__init__.py#L381-L384 | [
"async",
"def",
"setChatTitle",
"(",
"self",
",",
"chat_id",
",",
"title",
")",
":",
"p",
"=",
"_strip",
"(",
"locals",
"(",
")",
")",
"return",
"await",
"self",
".",
"_api_request",
"(",
"'setChatTitle'",
",",
"_rectify",
"(",
"p",
")",
")"
] | 3792fde251d0f1d5a6ca16c8ad1a71f89360c41d |
train | Bot.setChatDescription | See: https://core.telegram.org/bots/api#setchatdescription | telepot/aio/__init__.py | async def setChatDescription(self, chat_id,
description=None):
""" See: https://core.telegram.org/bots/api#setchatdescription """
p = _strip(locals())
return await self._api_request('setChatDescription', _rectify(p)) | async def setChatDescription(self, chat_id,
description=None):
""" See: https://core.telegram.org/bots/api#setchatdescription """
p = _strip(locals())
return await self._api_request('setChatDescription', _rectify(p)) | [
"See",
":",
"https",
":",
"//",
"core",
".",
"telegram",
".",
"org",
"/",
"bots",
"/",
"api#setchatdescription"
] | nickoala/telepot | python | https://github.com/nickoala/telepot/blob/3792fde251d0f1d5a6ca16c8ad1a71f89360c41d/telepot/aio/__init__.py#L386-L390 | [
"async",
"def",
"setChatDescription",
"(",
"self",
",",
"chat_id",
",",
"description",
"=",
"None",
")",
":",
"p",
"=",
"_strip",
"(",
"locals",
"(",
")",
")",
"return",
"await",
"self",
".",
"_api_request",
"(",
"'setChatDescription'",
",",
"_rectify",
"(... | 3792fde251d0f1d5a6ca16c8ad1a71f89360c41d |
train | Bot.pinChatMessage | See: https://core.telegram.org/bots/api#pinchatmessage | telepot/aio/__init__.py | async def pinChatMessage(self, chat_id, message_id,
disable_notification=None):
""" See: https://core.telegram.org/bots/api#pinchatmessage """
p = _strip(locals())
return await self._api_request('pinChatMessage', _rectify(p)) | async def pinChatMessage(self, chat_id, message_id,
disable_notification=None):
""" See: https://core.telegram.org/bots/api#pinchatmessage """
p = _strip(locals())
return await self._api_request('pinChatMessage', _rectify(p)) | [
"See",
":",
"https",
":",
"//",
"core",
".",
"telegram",
".",
"org",
"/",
"bots",
"/",
"api#pinchatmessage"
] | nickoala/telepot | python | https://github.com/nickoala/telepot/blob/3792fde251d0f1d5a6ca16c8ad1a71f89360c41d/telepot/aio/__init__.py#L392-L396 | [
"async",
"def",
"pinChatMessage",
"(",
"self",
",",
"chat_id",
",",
"message_id",
",",
"disable_notification",
"=",
"None",
")",
":",
"p",
"=",
"_strip",
"(",
"locals",
"(",
")",
")",
"return",
"await",
"self",
".",
"_api_request",
"(",
"'pinChatMessage'",
... | 3792fde251d0f1d5a6ca16c8ad1a71f89360c41d |
train | Bot.unpinChatMessage | See: https://core.telegram.org/bots/api#unpinchatmessage | telepot/aio/__init__.py | async def unpinChatMessage(self, chat_id):
""" See: https://core.telegram.org/bots/api#unpinchatmessage """
p = _strip(locals())
return await self._api_request('unpinChatMessage', _rectify(p)) | async def unpinChatMessage(self, chat_id):
""" See: https://core.telegram.org/bots/api#unpinchatmessage """
p = _strip(locals())
return await self._api_request('unpinChatMessage', _rectify(p)) | [
"See",
":",
"https",
":",
"//",
"core",
".",
"telegram",
".",
"org",
"/",
"bots",
"/",
"api#unpinchatmessage"
] | nickoala/telepot | python | https://github.com/nickoala/telepot/blob/3792fde251d0f1d5a6ca16c8ad1a71f89360c41d/telepot/aio/__init__.py#L398-L401 | [
"async",
"def",
"unpinChatMessage",
"(",
"self",
",",
"chat_id",
")",
":",
"p",
"=",
"_strip",
"(",
"locals",
"(",
")",
")",
"return",
"await",
"self",
".",
"_api_request",
"(",
"'unpinChatMessage'",
",",
"_rectify",
"(",
"p",
")",
")"
] | 3792fde251d0f1d5a6ca16c8ad1a71f89360c41d |
train | Bot.getChatMember | See: https://core.telegram.org/bots/api#getchatmember | telepot/aio/__init__.py | async def getChatMember(self, chat_id, user_id):
""" See: https://core.telegram.org/bots/api#getchatmember """
p = _strip(locals())
return await self._api_request('getChatMember', _rectify(p)) | async def getChatMember(self, chat_id, user_id):
""" See: https://core.telegram.org/bots/api#getchatmember """
p = _strip(locals())
return await self._api_request('getChatMember', _rectify(p)) | [
"See",
":",
"https",
":",
"//",
"core",
".",
"telegram",
".",
"org",
"/",
"bots",
"/",
"api#getchatmember"
] | nickoala/telepot | python | https://github.com/nickoala/telepot/blob/3792fde251d0f1d5a6ca16c8ad1a71f89360c41d/telepot/aio/__init__.py#L423-L426 | [
"async",
"def",
"getChatMember",
"(",
"self",
",",
"chat_id",
",",
"user_id",
")",
":",
"p",
"=",
"_strip",
"(",
"locals",
"(",
")",
")",
"return",
"await",
"self",
".",
"_api_request",
"(",
"'getChatMember'",
",",
"_rectify",
"(",
"p",
")",
")"
] | 3792fde251d0f1d5a6ca16c8ad1a71f89360c41d |
train | Bot.setChatStickerSet | See: https://core.telegram.org/bots/api#setchatstickerset | telepot/aio/__init__.py | async def setChatStickerSet(self, chat_id, sticker_set_name):
""" See: https://core.telegram.org/bots/api#setchatstickerset """
p = _strip(locals())
return await self._api_request('setChatStickerSet', _rectify(p)) | async def setChatStickerSet(self, chat_id, sticker_set_name):
""" See: https://core.telegram.org/bots/api#setchatstickerset """
p = _strip(locals())
return await self._api_request('setChatStickerSet', _rectify(p)) | [
"See",
":",
"https",
":",
"//",
"core",
".",
"telegram",
".",
"org",
"/",
"bots",
"/",
"api#setchatstickerset"
] | nickoala/telepot | python | https://github.com/nickoala/telepot/blob/3792fde251d0f1d5a6ca16c8ad1a71f89360c41d/telepot/aio/__init__.py#L428-L431 | [
"async",
"def",
"setChatStickerSet",
"(",
"self",
",",
"chat_id",
",",
"sticker_set_name",
")",
":",
"p",
"=",
"_strip",
"(",
"locals",
"(",
")",
")",
"return",
"await",
"self",
".",
"_api_request",
"(",
"'setChatStickerSet'",
",",
"_rectify",
"(",
"p",
")... | 3792fde251d0f1d5a6ca16c8ad1a71f89360c41d |
train | Bot.deleteChatStickerSet | See: https://core.telegram.org/bots/api#deletechatstickerset | telepot/aio/__init__.py | async def deleteChatStickerSet(self, chat_id):
""" See: https://core.telegram.org/bots/api#deletechatstickerset """
p = _strip(locals())
return await self._api_request('deleteChatStickerSet', _rectify(p)) | async def deleteChatStickerSet(self, chat_id):
""" See: https://core.telegram.org/bots/api#deletechatstickerset """
p = _strip(locals())
return await self._api_request('deleteChatStickerSet', _rectify(p)) | [
"See",
":",
"https",
":",
"//",
"core",
".",
"telegram",
".",
"org",
"/",
"bots",
"/",
"api#deletechatstickerset"
] | nickoala/telepot | python | https://github.com/nickoala/telepot/blob/3792fde251d0f1d5a6ca16c8ad1a71f89360c41d/telepot/aio/__init__.py#L433-L436 | [
"async",
"def",
"deleteChatStickerSet",
"(",
"self",
",",
"chat_id",
")",
":",
"p",
"=",
"_strip",
"(",
"locals",
"(",
")",
")",
"return",
"await",
"self",
".",
"_api_request",
"(",
"'deleteChatStickerSet'",
",",
"_rectify",
"(",
"p",
")",
")"
] | 3792fde251d0f1d5a6ca16c8ad1a71f89360c41d |
train | Bot.answerCallbackQuery | See: https://core.telegram.org/bots/api#answercallbackquery | telepot/aio/__init__.py | async def answerCallbackQuery(self, callback_query_id,
text=None,
show_alert=None,
url=None,
cache_time=None):
""" See: https://core.telegram.org/bots/api#answercallbackquery "... | async def answerCallbackQuery(self, callback_query_id,
text=None,
show_alert=None,
url=None,
cache_time=None):
""" See: https://core.telegram.org/bots/api#answercallbackquery "... | [
"See",
":",
"https",
":",
"//",
"core",
".",
"telegram",
".",
"org",
"/",
"bots",
"/",
"api#answercallbackquery"
] | nickoala/telepot | python | https://github.com/nickoala/telepot/blob/3792fde251d0f1d5a6ca16c8ad1a71f89360c41d/telepot/aio/__init__.py#L438-L445 | [
"async",
"def",
"answerCallbackQuery",
"(",
"self",
",",
"callback_query_id",
",",
"text",
"=",
"None",
",",
"show_alert",
"=",
"None",
",",
"url",
"=",
"None",
",",
"cache_time",
"=",
"None",
")",
":",
"p",
"=",
"_strip",
"(",
"locals",
"(",
")",
")",... | 3792fde251d0f1d5a6ca16c8ad1a71f89360c41d |
train | Bot.deleteMessage | See: https://core.telegram.org/bots/api#deletemessage
:param msg_identifier:
Same as ``msg_identifier`` in :meth:`telepot.aio.Bot.editMessageText`,
except this method does not work on inline messages. | telepot/aio/__init__.py | async def deleteMessage(self, msg_identifier):
"""
See: https://core.telegram.org/bots/api#deletemessage
:param msg_identifier:
Same as ``msg_identifier`` in :meth:`telepot.aio.Bot.editMessageText`,
except this method does not work on inline messages.
"""
... | async def deleteMessage(self, msg_identifier):
"""
See: https://core.telegram.org/bots/api#deletemessage
:param msg_identifier:
Same as ``msg_identifier`` in :meth:`telepot.aio.Bot.editMessageText`,
except this method does not work on inline messages.
"""
... | [
"See",
":",
"https",
":",
"//",
"core",
".",
"telegram",
".",
"org",
"/",
"bots",
"/",
"api#deletemessage"
] | nickoala/telepot | python | https://github.com/nickoala/telepot/blob/3792fde251d0f1d5a6ca16c8ad1a71f89360c41d/telepot/aio/__init__.py#L501-L511 | [
"async",
"def",
"deleteMessage",
"(",
"self",
",",
"msg_identifier",
")",
":",
"p",
"=",
"_strip",
"(",
"locals",
"(",
")",
",",
"more",
"=",
"[",
"'msg_identifier'",
"]",
")",
"p",
".",
"update",
"(",
"_dismantle_message_identifier",
"(",
"msg_identifier",
... | 3792fde251d0f1d5a6ca16c8ad1a71f89360c41d |
train | Bot.sendSticker | See: https://core.telegram.org/bots/api#sendsticker
:param sticker: Same as ``photo`` in :meth:`telepot.aio.Bot.sendPhoto` | telepot/aio/__init__.py | async def sendSticker(self, chat_id, sticker,
disable_notification=None,
reply_to_message_id=None,
reply_markup=None):
"""
See: https://core.telegram.org/bots/api#sendsticker
:param sticker: Same as ``photo`` in :meth... | async def sendSticker(self, chat_id, sticker,
disable_notification=None,
reply_to_message_id=None,
reply_markup=None):
"""
See: https://core.telegram.org/bots/api#sendsticker
:param sticker: Same as ``photo`` in :meth... | [
"See",
":",
"https",
":",
"//",
"core",
".",
"telegram",
".",
"org",
"/",
"bots",
"/",
"api#sendsticker"
] | nickoala/telepot | python | https://github.com/nickoala/telepot/blob/3792fde251d0f1d5a6ca16c8ad1a71f89360c41d/telepot/aio/__init__.py#L513-L523 | [
"async",
"def",
"sendSticker",
"(",
"self",
",",
"chat_id",
",",
"sticker",
",",
"disable_notification",
"=",
"None",
",",
"reply_to_message_id",
"=",
"None",
",",
"reply_markup",
"=",
"None",
")",
":",
"p",
"=",
"_strip",
"(",
"locals",
"(",
")",
",",
"... | 3792fde251d0f1d5a6ca16c8ad1a71f89360c41d |
train | Bot.getStickerSet | See: https://core.telegram.org/bots/api#getstickerset | telepot/aio/__init__.py | async def getStickerSet(self, name):
"""
See: https://core.telegram.org/bots/api#getstickerset
"""
p = _strip(locals())
return await self._api_request('getStickerSet', _rectify(p)) | async def getStickerSet(self, name):
"""
See: https://core.telegram.org/bots/api#getstickerset
"""
p = _strip(locals())
return await self._api_request('getStickerSet', _rectify(p)) | [
"See",
":",
"https",
":",
"//",
"core",
".",
"telegram",
".",
"org",
"/",
"bots",
"/",
"api#getstickerset"
] | nickoala/telepot | python | https://github.com/nickoala/telepot/blob/3792fde251d0f1d5a6ca16c8ad1a71f89360c41d/telepot/aio/__init__.py#L525-L530 | [
"async",
"def",
"getStickerSet",
"(",
"self",
",",
"name",
")",
":",
"p",
"=",
"_strip",
"(",
"locals",
"(",
")",
")",
"return",
"await",
"self",
".",
"_api_request",
"(",
"'getStickerSet'",
",",
"_rectify",
"(",
"p",
")",
")"
] | 3792fde251d0f1d5a6ca16c8ad1a71f89360c41d |
train | Bot.deleteStickerFromSet | See: https://core.telegram.org/bots/api#deletestickerfromset | telepot/aio/__init__.py | async def deleteStickerFromSet(self, sticker):
"""
See: https://core.telegram.org/bots/api#deletestickerfromset
"""
p = _strip(locals())
return await self._api_request('deleteStickerFromSet', _rectify(p)) | async def deleteStickerFromSet(self, sticker):
"""
See: https://core.telegram.org/bots/api#deletestickerfromset
"""
p = _strip(locals())
return await self._api_request('deleteStickerFromSet', _rectify(p)) | [
"See",
":",
"https",
":",
"//",
"core",
".",
"telegram",
".",
"org",
"/",
"bots",
"/",
"api#deletestickerfromset"
] | nickoala/telepot | python | https://github.com/nickoala/telepot/blob/3792fde251d0f1d5a6ca16c8ad1a71f89360c41d/telepot/aio/__init__.py#L563-L568 | [
"async",
"def",
"deleteStickerFromSet",
"(",
"self",
",",
"sticker",
")",
":",
"p",
"=",
"_strip",
"(",
"locals",
"(",
")",
")",
"return",
"await",
"self",
".",
"_api_request",
"(",
"'deleteStickerFromSet'",
",",
"_rectify",
"(",
"p",
")",
")"
] | 3792fde251d0f1d5a6ca16c8ad1a71f89360c41d |
train | Bot.answerInlineQuery | See: https://core.telegram.org/bots/api#answerinlinequery | telepot/aio/__init__.py | async def answerInlineQuery(self, inline_query_id, results,
cache_time=None,
is_personal=None,
next_offset=None,
switch_pm_text=None,
switch_pm_parameter=None):... | async def answerInlineQuery(self, inline_query_id, results,
cache_time=None,
is_personal=None,
next_offset=None,
switch_pm_text=None,
switch_pm_parameter=None):... | [
"See",
":",
"https",
":",
"//",
"core",
".",
"telegram",
".",
"org",
"/",
"bots",
"/",
"api#answerinlinequery"
] | nickoala/telepot | python | https://github.com/nickoala/telepot/blob/3792fde251d0f1d5a6ca16c8ad1a71f89360c41d/telepot/aio/__init__.py#L570-L578 | [
"async",
"def",
"answerInlineQuery",
"(",
"self",
",",
"inline_query_id",
",",
"results",
",",
"cache_time",
"=",
"None",
",",
"is_personal",
"=",
"None",
",",
"next_offset",
"=",
"None",
",",
"switch_pm_text",
"=",
"None",
",",
"switch_pm_parameter",
"=",
"No... | 3792fde251d0f1d5a6ca16c8ad1a71f89360c41d |
train | Bot.getUpdates | See: https://core.telegram.org/bots/api#getupdates | telepot/aio/__init__.py | async def getUpdates(self,
offset=None,
limit=None,
timeout=None,
allowed_updates=None):
""" See: https://core.telegram.org/bots/api#getupdates """
p = _strip(locals())
return await self._api_requ... | async def getUpdates(self,
offset=None,
limit=None,
timeout=None,
allowed_updates=None):
""" See: https://core.telegram.org/bots/api#getupdates """
p = _strip(locals())
return await self._api_requ... | [
"See",
":",
"https",
":",
"//",
"core",
".",
"telegram",
".",
"org",
"/",
"bots",
"/",
"api#getupdates"
] | nickoala/telepot | python | https://github.com/nickoala/telepot/blob/3792fde251d0f1d5a6ca16c8ad1a71f89360c41d/telepot/aio/__init__.py#L580-L587 | [
"async",
"def",
"getUpdates",
"(",
"self",
",",
"offset",
"=",
"None",
",",
"limit",
"=",
"None",
",",
"timeout",
"=",
"None",
",",
"allowed_updates",
"=",
"None",
")",
":",
"p",
"=",
"_strip",
"(",
"locals",
"(",
")",
")",
"return",
"await",
"self",... | 3792fde251d0f1d5a6ca16c8ad1a71f89360c41d |
train | Bot.setWebhook | See: https://core.telegram.org/bots/api#setwebhook | telepot/aio/__init__.py | async def setWebhook(self,
url=None,
certificate=None,
max_connections=None,
allowed_updates=None):
""" See: https://core.telegram.org/bots/api#setwebhook """
p = _strip(locals(), more=['certificate'])
... | async def setWebhook(self,
url=None,
certificate=None,
max_connections=None,
allowed_updates=None):
""" See: https://core.telegram.org/bots/api#setwebhook """
p = _strip(locals(), more=['certificate'])
... | [
"See",
":",
"https",
":",
"//",
"core",
".",
"telegram",
".",
"org",
"/",
"bots",
"/",
"api#setwebhook"
] | nickoala/telepot | python | https://github.com/nickoala/telepot/blob/3792fde251d0f1d5a6ca16c8ad1a71f89360c41d/telepot/aio/__init__.py#L589-L601 | [
"async",
"def",
"setWebhook",
"(",
"self",
",",
"url",
"=",
"None",
",",
"certificate",
"=",
"None",
",",
"max_connections",
"=",
"None",
",",
"allowed_updates",
"=",
"None",
")",
":",
"p",
"=",
"_strip",
"(",
"locals",
"(",
")",
",",
"more",
"=",
"[... | 3792fde251d0f1d5a6ca16c8ad1a71f89360c41d |
train | Bot.download_file | Download a file to local disk.
:param dest: a path or a ``file`` object | telepot/aio/__init__.py | async def download_file(self, file_id, dest):
"""
Download a file to local disk.
:param dest: a path or a ``file`` object
"""
f = await self.getFile(file_id)
try:
d = dest if isinstance(dest, io.IOBase) else open(dest, 'wb')
session, request = a... | async def download_file(self, file_id, dest):
"""
Download a file to local disk.
:param dest: a path or a ``file`` object
"""
f = await self.getFile(file_id)
try:
d = dest if isinstance(dest, io.IOBase) else open(dest, 'wb')
session, request = a... | [
"Download",
"a",
"file",
"to",
"local",
"disk",
"."
] | nickoala/telepot | python | https://github.com/nickoala/telepot/blob/3792fde251d0f1d5a6ca16c8ad1a71f89360c41d/telepot/aio/__init__.py#L625-L648 | [
"async",
"def",
"download_file",
"(",
"self",
",",
"file_id",
",",
"dest",
")",
":",
"f",
"=",
"await",
"self",
".",
"getFile",
"(",
"file_id",
")",
"try",
":",
"d",
"=",
"dest",
"if",
"isinstance",
"(",
"dest",
",",
"io",
".",
"IOBase",
")",
"else... | 3792fde251d0f1d5a6ca16c8ad1a71f89360c41d |
train | Bot.message_loop | Return a task to constantly ``getUpdates`` or pull updates from a queue.
Apply ``handler`` to every message received.
:param handler:
a function that takes one argument (the message), or a routing table.
If ``None``, the bot's ``handle`` method is used.
A *routing table... | telepot/aio/__init__.py | async def message_loop(self, handler=None, relax=0.1,
timeout=20, allowed_updates=None,
source=None, ordered=True, maxhold=3):
"""
Return a task to constantly ``getUpdates`` or pull updates from a queue.
Apply ``handler`` to every message rec... | async def message_loop(self, handler=None, relax=0.1,
timeout=20, allowed_updates=None,
source=None, ordered=True, maxhold=3):
"""
Return a task to constantly ``getUpdates`` or pull updates from a queue.
Apply ``handler`` to every message rec... | [
"Return",
"a",
"task",
"to",
"constantly",
"getUpdates",
"or",
"pull",
"updates",
"from",
"a",
"queue",
".",
"Apply",
"handler",
"to",
"every",
"message",
"received",
"."
] | nickoala/telepot | python | https://github.com/nickoala/telepot/blob/3792fde251d0f1d5a6ca16c8ad1a71f89360c41d/telepot/aio/__init__.py#L650-L881 | [
"async",
"def",
"message_loop",
"(",
"self",
",",
"handler",
"=",
"None",
",",
"relax",
"=",
"0.1",
",",
"timeout",
"=",
"20",
",",
"allowed_updates",
"=",
"None",
",",
"source",
"=",
"None",
",",
"ordered",
"=",
"True",
",",
"maxhold",
"=",
"3",
")"... | 3792fde251d0f1d5a6ca16c8ad1a71f89360c41d |
train | Broker.grab | Gather proxies from the providers without checking.
:param list countries: (optional) List of ISO country codes
where should be located proxies
:param int limit: (optional) The maximum number of proxies
:ref:`Example of usage <proxybroker-examples-grab>`. | proxybroker/api.py | async def grab(self, *, countries=None, limit=0):
"""Gather proxies from the providers without checking.
:param list countries: (optional) List of ISO country codes
where should be located proxies
:param int limit: (optional) The maximum number of proxies
... | async def grab(self, *, countries=None, limit=0):
"""Gather proxies from the providers without checking.
:param list countries: (optional) List of ISO country codes
where should be located proxies
:param int limit: (optional) The maximum number of proxies
... | [
"Gather",
"proxies",
"from",
"the",
"providers",
"without",
"checking",
"."
] | constverum/ProxyBroker | python | https://github.com/constverum/ProxyBroker/blob/d21aae8575fc3a95493233ecfd2c7cf47b36b069/proxybroker/api.py#L112-L124 | [
"async",
"def",
"grab",
"(",
"self",
",",
"*",
",",
"countries",
"=",
"None",
",",
"limit",
"=",
"0",
")",
":",
"self",
".",
"_countries",
"=",
"countries",
"self",
".",
"_limit",
"=",
"limit",
"task",
"=",
"asyncio",
".",
"ensure_future",
"(",
"self... | d21aae8575fc3a95493233ecfd2c7cf47b36b069 |
train | Broker.find | Gather and check proxies from providers or from a passed data.
:ref:`Example of usage <proxybroker-examples-find>`.
:param list types:
Types (protocols) that need to be check on support by proxy.
Supported: HTTP, HTTPS, SOCKS4, SOCKS5, CONNECT:80, CONNECT:25
And lev... | proxybroker/api.py | async def find(
self,
*,
types=None,
data=None,
countries=None,
post=False,
strict=False,
dnsbl=None,
limit=0,
**kwargs
):
"""Gather and check proxies from providers or from a passed data.
:ref:`Example of usage <proxyb... | async def find(
self,
*,
types=None,
data=None,
countries=None,
post=False,
strict=False,
dnsbl=None,
limit=0,
**kwargs
):
"""Gather and check proxies from providers or from a passed data.
:ref:`Example of usage <proxyb... | [
"Gather",
"and",
"check",
"proxies",
"from",
"providers",
"or",
"from",
"a",
"passed",
"data",
"."
] | constverum/ProxyBroker | python | https://github.com/constverum/ProxyBroker/blob/d21aae8575fc3a95493233ecfd2c7cf47b36b069/proxybroker/api.py#L126-L200 | [
"async",
"def",
"find",
"(",
"self",
",",
"*",
",",
"types",
"=",
"None",
",",
"data",
"=",
"None",
",",
"countries",
"=",
"None",
",",
"post",
"=",
"False",
",",
"strict",
"=",
"False",
",",
"dnsbl",
"=",
"None",
",",
"limit",
"=",
"0",
",",
"... | d21aae8575fc3a95493233ecfd2c7cf47b36b069 |
train | Broker.serve | Start a local proxy server.
The server distributes incoming requests to a pool of found proxies.
When the server receives an incoming request, it chooses the optimal
proxy (based on the percentage of errors and average response time)
and passes to it the incoming request.
In a... | proxybroker/api.py | def serve(self, host='127.0.0.1', port=8888, limit=100, **kwargs):
"""Start a local proxy server.
The server distributes incoming requests to a pool of found proxies.
When the server receives an incoming request, it chooses the optimal
proxy (based on the percentage of errors and avera... | def serve(self, host='127.0.0.1', port=8888, limit=100, **kwargs):
"""Start a local proxy server.
The server distributes incoming requests to a pool of found proxies.
When the server receives an incoming request, it chooses the optimal
proxy (based on the percentage of errors and avera... | [
"Start",
"a",
"local",
"proxy",
"server",
"."
] | constverum/ProxyBroker | python | https://github.com/constverum/ProxyBroker/blob/d21aae8575fc3a95493233ecfd2c7cf47b36b069/proxybroker/api.py#L202-L288 | [
"def",
"serve",
"(",
"self",
",",
"host",
"=",
"'127.0.0.1'",
",",
"port",
"=",
"8888",
",",
"limit",
"=",
"100",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"limit",
"<=",
"0",
":",
"raise",
"ValueError",
"(",
"'In serve mode value of the limit cannot be les... | d21aae8575fc3a95493233ecfd2c7cf47b36b069 |
train | Broker._load | Looking for proxies in the passed data.
Transform the passed data from [raw string | file-like object | list]
to set {(host, port), ...}: {('192.168.0.1', '80'), } | proxybroker/api.py | async def _load(self, data, check=True):
"""Looking for proxies in the passed data.
Transform the passed data from [raw string | file-like object | list]
to set {(host, port), ...}: {('192.168.0.1', '80'), }
"""
log.debug('Load proxies from the raw data')
if isinstance(d... | async def _load(self, data, check=True):
"""Looking for proxies in the passed data.
Transform the passed data from [raw string | file-like object | list]
to set {(host, port), ...}: {('192.168.0.1', '80'), }
"""
log.debug('Load proxies from the raw data')
if isinstance(d... | [
"Looking",
"for",
"proxies",
"in",
"the",
"passed",
"data",
"."
] | constverum/ProxyBroker | python | https://github.com/constverum/ProxyBroker/blob/d21aae8575fc3a95493233ecfd2c7cf47b36b069/proxybroker/api.py#L290-L305 | [
"async",
"def",
"_load",
"(",
"self",
",",
"data",
",",
"check",
"=",
"True",
")",
":",
"log",
".",
"debug",
"(",
"'Load proxies from the raw data'",
")",
"if",
"isinstance",
"(",
"data",
",",
"io",
".",
"TextIOWrapper",
")",
":",
"data",
"=",
"data",
... | d21aae8575fc3a95493233ecfd2c7cf47b36b069 |
train | Broker.stop | Stop all tasks, and the local proxy server if it's running. | proxybroker/api.py | def stop(self):
"""Stop all tasks, and the local proxy server if it's running."""
self._done()
if self._server:
self._server.stop()
self._server = None
log.info('Stop!') | def stop(self):
"""Stop all tasks, and the local proxy server if it's running."""
self._done()
if self._server:
self._server.stop()
self._server = None
log.info('Stop!') | [
"Stop",
"all",
"tasks",
"and",
"the",
"local",
"proxy",
"server",
"if",
"it",
"s",
"running",
"."
] | constverum/ProxyBroker | python | https://github.com/constverum/ProxyBroker/blob/d21aae8575fc3a95493233ecfd2c7cf47b36b069/proxybroker/api.py#L409-L415 | [
"def",
"stop",
"(",
"self",
")",
":",
"self",
".",
"_done",
"(",
")",
"if",
"self",
".",
"_server",
":",
"self",
".",
"_server",
".",
"stop",
"(",
")",
"self",
".",
"_server",
"=",
"None",
"log",
".",
"info",
"(",
"'Stop!'",
")"
] | d21aae8575fc3a95493233ecfd2c7cf47b36b069 |
train | Broker.show_stats | Show statistics on the found proxies.
Useful for debugging, but you can also use if you're interested.
:param verbose: Flag indicating whether to print verbose stats
.. deprecated:: 0.2.0
Use :attr:`verbose` instead of :attr:`full`. | proxybroker/api.py | def show_stats(self, verbose=False, **kwargs):
"""Show statistics on the found proxies.
Useful for debugging, but you can also use if you're interested.
:param verbose: Flag indicating whether to print verbose stats
.. deprecated:: 0.2.0
Use :attr:`verbose` instead of :att... | def show_stats(self, verbose=False, **kwargs):
"""Show statistics on the found proxies.
Useful for debugging, but you can also use if you're interested.
:param verbose: Flag indicating whether to print verbose stats
.. deprecated:: 0.2.0
Use :attr:`verbose` instead of :att... | [
"Show",
"statistics",
"on",
"the",
"found",
"proxies",
"."
] | constverum/ProxyBroker | python | https://github.com/constverum/ProxyBroker/blob/d21aae8575fc3a95493233ecfd2c7cf47b36b069/proxybroker/api.py#L426-L514 | [
"def",
"show_stats",
"(",
"self",
",",
"verbose",
"=",
"False",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"kwargs",
":",
"verbose",
"=",
"True",
"warnings",
".",
"warn",
"(",
"'`full` in `show_stats` is deprecated, '",
"'use `verbose` instead.'",
",",
"Deprecatio... | d21aae8575fc3a95493233ecfd2c7cf47b36b069 |
train | save | Save proxies to a file. | examples/only_grab.py | async def save(proxies, filename):
"""Save proxies to a file."""
with open(filename, 'w') as f:
while True:
proxy = await proxies.get()
if proxy is None:
break
f.write('%s:%d\n' % (proxy.host, proxy.port)) | async def save(proxies, filename):
"""Save proxies to a file."""
with open(filename, 'w') as f:
while True:
proxy = await proxies.get()
if proxy is None:
break
f.write('%s:%d\n' % (proxy.host, proxy.port)) | [
"Save",
"proxies",
"to",
"a",
"file",
"."
] | constverum/ProxyBroker | python | https://github.com/constverum/ProxyBroker/blob/d21aae8575fc3a95493233ecfd2c7cf47b36b069/examples/only_grab.py#L9-L16 | [
"async",
"def",
"save",
"(",
"proxies",
",",
"filename",
")",
":",
"with",
"open",
"(",
"filename",
",",
"'w'",
")",
"as",
"f",
":",
"while",
"True",
":",
"proxy",
"=",
"await",
"proxies",
".",
"get",
"(",
")",
"if",
"proxy",
"is",
"None",
":",
"... | d21aae8575fc3a95493233ecfd2c7cf47b36b069 |
train | Resolver.get_ip_info | Return geo information about IP address.
`code` - ISO country code
`name` - Full name of country
`region_code` - ISO region code
`region_name` - Full name of region
`city_name` - Full name of city | proxybroker/resolver.py | def get_ip_info(ip):
"""Return geo information about IP address.
`code` - ISO country code
`name` - Full name of country
`region_code` - ISO region code
`region_name` - Full name of region
`city_name` - Full name of city
"""
# from pprint import pprint
... | def get_ip_info(ip):
"""Return geo information about IP address.
`code` - ISO country code
`name` - Full name of country
`region_code` - ISO region code
`region_name` - Full name of region
`city_name` - Full name of city
"""
# from pprint import pprint
... | [
"Return",
"geo",
"information",
"about",
"IP",
"address",
"."
] | constverum/ProxyBroker | python | https://github.com/constverum/ProxyBroker/blob/d21aae8575fc3a95493233ecfd2c7cf47b36b069/proxybroker/resolver.py#L57-L85 | [
"def",
"get_ip_info",
"(",
"ip",
")",
":",
"# from pprint import pprint",
"try",
":",
"ipInfo",
"=",
"_mmdb_reader",
".",
"get",
"(",
"ip",
")",
"or",
"{",
"}",
"except",
"(",
"maxminddb",
".",
"errors",
".",
"InvalidDatabaseError",
",",
"ValueError",
")",
... | d21aae8575fc3a95493233ecfd2c7cf47b36b069 |
train | Resolver.get_real_ext_ip | Return real external IP address. | proxybroker/resolver.py | async def get_real_ext_ip(self):
"""Return real external IP address."""
while self._ip_hosts:
try:
timeout = aiohttp.ClientTimeout(total=self._timeout)
async with aiohttp.ClientSession(
timeout=timeout, loop=self._loop
) as ... | async def get_real_ext_ip(self):
"""Return real external IP address."""
while self._ip_hosts:
try:
timeout = aiohttp.ClientTimeout(total=self._timeout)
async with aiohttp.ClientSession(
timeout=timeout, loop=self._loop
) as ... | [
"Return",
"real",
"external",
"IP",
"address",
"."
] | constverum/ProxyBroker | python | https://github.com/constverum/ProxyBroker/blob/d21aae8575fc3a95493233ecfd2c7cf47b36b069/proxybroker/resolver.py#L92-L110 | [
"async",
"def",
"get_real_ext_ip",
"(",
"self",
")",
":",
"while",
"self",
".",
"_ip_hosts",
":",
"try",
":",
"timeout",
"=",
"aiohttp",
".",
"ClientTimeout",
"(",
"total",
"=",
"self",
".",
"_timeout",
")",
"async",
"with",
"aiohttp",
".",
"ClientSession"... | d21aae8575fc3a95493233ecfd2c7cf47b36b069 |
train | Resolver.resolve | Return resolving IP address(es) from host name. | proxybroker/resolver.py | async def resolve(
self, host, port=80, family=None, qtype='A', logging=True
):
"""Return resolving IP address(es) from host name."""
if self.host_is_ip(host):
return host
_host = self._cached_hosts.get(host)
if _host:
return _host
resp = awa... | async def resolve(
self, host, port=80, family=None, qtype='A', logging=True
):
"""Return resolving IP address(es) from host name."""
if self.host_is_ip(host):
return host
_host = self._cached_hosts.get(host)
if _host:
return _host
resp = awa... | [
"Return",
"resolving",
"IP",
"address",
"(",
"es",
")",
"from",
"host",
"name",
"."
] | constverum/ProxyBroker | python | https://github.com/constverum/ProxyBroker/blob/d21aae8575fc3a95493233ecfd2c7cf47b36b069/proxybroker/resolver.py#L112-L148 | [
"async",
"def",
"resolve",
"(",
"self",
",",
"host",
",",
"port",
"=",
"80",
",",
"family",
"=",
"None",
",",
"qtype",
"=",
"'A'",
",",
"logging",
"=",
"True",
")",
":",
"if",
"self",
".",
"host_is_ip",
"(",
"host",
")",
":",
"return",
"host",
"_... | d21aae8575fc3a95493233ecfd2c7cf47b36b069 |
train | Proxy.create | Asynchronously create a :class:`Proxy` object.
:param str host: A passed host can be a domain or IP address.
If the host is a domain, try to resolve it
:param str \*args:
(optional) Positional arguments that :class:`Proxy` takes
:param str \*\*kwargs:
... | proxybroker/proxy.py | async def create(cls, host, *args, **kwargs):
"""Asynchronously create a :class:`Proxy` object.
:param str host: A passed host can be a domain or IP address.
If the host is a domain, try to resolve it
:param str \*args:
(optional) Positional arguments that :... | async def create(cls, host, *args, **kwargs):
"""Asynchronously create a :class:`Proxy` object.
:param str host: A passed host can be a domain or IP address.
If the host is a domain, try to resolve it
:param str \*args:
(optional) Positional arguments that :... | [
"Asynchronously",
"create",
"a",
":",
"class",
":",
"Proxy",
"object",
"."
] | constverum/ProxyBroker | python | https://github.com/constverum/ProxyBroker/blob/d21aae8575fc3a95493233ecfd2c7cf47b36b069/proxybroker/proxy.py#L41-L65 | [
"async",
"def",
"create",
"(",
"cls",
",",
"host",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"# noqa: W605",
"loop",
"=",
"kwargs",
".",
"pop",
"(",
"'loop'",
",",
"None",
")",
"resolver",
"=",
"kwargs",
".",
"pop",
"(",
"'resolver'",
",... | d21aae8575fc3a95493233ecfd2c7cf47b36b069 |
train | Proxy.error_rate | Error rate: from 0 to 1.
For example: 0.7 = 70% requests ends with error.
:rtype: float
.. versionadded:: 0.2.0 | proxybroker/proxy.py | def error_rate(self):
"""Error rate: from 0 to 1.
For example: 0.7 = 70% requests ends with error.
:rtype: float
.. versionadded:: 0.2.0
"""
if not self.stat['requests']:
return 0
return round(
sum(self.stat['errors'].values()) / self.st... | def error_rate(self):
"""Error rate: from 0 to 1.
For example: 0.7 = 70% requests ends with error.
:rtype: float
.. versionadded:: 0.2.0
"""
if not self.stat['requests']:
return 0
return round(
sum(self.stat['errors'].values()) / self.st... | [
"Error",
"rate",
":",
"from",
"0",
"to",
"1",
"."
] | constverum/ProxyBroker | python | https://github.com/constverum/ProxyBroker/blob/d21aae8575fc3a95493233ecfd2c7cf47b36b069/proxybroker/proxy.py#L160-L173 | [
"def",
"error_rate",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"stat",
"[",
"'requests'",
"]",
":",
"return",
"0",
"return",
"round",
"(",
"sum",
"(",
"self",
".",
"stat",
"[",
"'errors'",
"]",
".",
"values",
"(",
")",
")",
"/",
"self",
".... | d21aae8575fc3a95493233ecfd2c7cf47b36b069 |
train | Proxy.schemes | Return supported schemes. | proxybroker/proxy.py | def schemes(self):
"""Return supported schemes."""
if not self._schemes:
_schemes = []
if self.types.keys() & _HTTP_PROTOS:
_schemes.append('HTTP')
if self.types.keys() & _HTTPS_PROTOS:
_schemes.append('HTTPS')
self._schemes... | def schemes(self):
"""Return supported schemes."""
if not self._schemes:
_schemes = []
if self.types.keys() & _HTTP_PROTOS:
_schemes.append('HTTP')
if self.types.keys() & _HTTPS_PROTOS:
_schemes.append('HTTPS')
self._schemes... | [
"Return",
"supported",
"schemes",
"."
] | constverum/ProxyBroker | python | https://github.com/constverum/ProxyBroker/blob/d21aae8575fc3a95493233ecfd2c7cf47b36b069/proxybroker/proxy.py#L176-L185 | [
"def",
"schemes",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"_schemes",
":",
"_schemes",
"=",
"[",
"]",
"if",
"self",
".",
"types",
".",
"keys",
"(",
")",
"&",
"_HTTP_PROTOS",
":",
"_schemes",
".",
"append",
"(",
"'HTTP'",
")",
"if",
"self",... | d21aae8575fc3a95493233ecfd2c7cf47b36b069 |
train | Proxy.avg_resp_time | The average connection/response time.
:rtype: float | proxybroker/proxy.py | def avg_resp_time(self):
"""The average connection/response time.
:rtype: float
"""
if not self._runtimes:
return 0
return round(sum(self._runtimes) / len(self._runtimes), 2) | def avg_resp_time(self):
"""The average connection/response time.
:rtype: float
"""
if not self._runtimes:
return 0
return round(sum(self._runtimes) / len(self._runtimes), 2) | [
"The",
"average",
"connection",
"/",
"response",
"time",
"."
] | constverum/ProxyBroker | python | https://github.com/constverum/ProxyBroker/blob/d21aae8575fc3a95493233ecfd2c7cf47b36b069/proxybroker/proxy.py#L188-L195 | [
"def",
"avg_resp_time",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"_runtimes",
":",
"return",
"0",
"return",
"round",
"(",
"sum",
"(",
"self",
".",
"_runtimes",
")",
"/",
"len",
"(",
"self",
".",
"_runtimes",
")",
",",
"2",
")"
] | d21aae8575fc3a95493233ecfd2c7cf47b36b069 |
train | Proxy.as_json | Return the proxy's properties in JSON format.
:rtype: dict | proxybroker/proxy.py | def as_json(self):
"""Return the proxy's properties in JSON format.
:rtype: dict
"""
info = {
'host': self.host,
'port': self.port,
'geo': {
'country': {'code': self._geo.code, 'name': self._geo.name},
'region': {
... | def as_json(self):
"""Return the proxy's properties in JSON format.
:rtype: dict
"""
info = {
'host': self.host,
'port': self.port,
'geo': {
'country': {'code': self._geo.code, 'name': self._geo.name},
'region': {
... | [
"Return",
"the",
"proxy",
"s",
"properties",
"in",
"JSON",
"format",
"."
] | constverum/ProxyBroker | python | https://github.com/constverum/ProxyBroker/blob/d21aae8575fc3a95493233ecfd2c7cf47b36b069/proxybroker/proxy.py#L236-L260 | [
"def",
"as_json",
"(",
"self",
")",
":",
"info",
"=",
"{",
"'host'",
":",
"self",
".",
"host",
",",
"'port'",
":",
"self",
".",
"port",
",",
"'geo'",
":",
"{",
"'country'",
":",
"{",
"'code'",
":",
"self",
".",
"_geo",
".",
"code",
",",
"'name'",... | d21aae8575fc3a95493233ecfd2c7cf47b36b069 |
train | Provider.get_proxies | Receive proxies from the provider and return them.
:return: :attr:`.proxies` | proxybroker/providers.py | async def get_proxies(self):
"""Receive proxies from the provider and return them.
:return: :attr:`.proxies`
"""
log.debug('Try to get proxies from %s' % self.domain)
async with aiohttp.ClientSession(
headers=get_headers(), cookies=self._cookies, loop=self._loop
... | async def get_proxies(self):
"""Receive proxies from the provider and return them.
:return: :attr:`.proxies`
"""
log.debug('Try to get proxies from %s' % self.domain)
async with aiohttp.ClientSession(
headers=get_headers(), cookies=self._cookies, loop=self._loop
... | [
"Receive",
"proxies",
"from",
"the",
"provider",
"and",
"return",
"them",
"."
] | constverum/ProxyBroker | python | https://github.com/constverum/ProxyBroker/blob/d21aae8575fc3a95493233ecfd2c7cf47b36b069/proxybroker/providers.py#L70-L86 | [
"async",
"def",
"get_proxies",
"(",
"self",
")",
":",
"log",
".",
"debug",
"(",
"'Try to get proxies from %s'",
"%",
"self",
".",
"domain",
")",
"async",
"with",
"aiohttp",
".",
"ClientSession",
"(",
"headers",
"=",
"get_headers",
"(",
")",
",",
"cookies",
... | d21aae8575fc3a95493233ecfd2c7cf47b36b069 |
train | save | Save proxies to a file. | examples/find_and_save.py | async def save(proxies, filename):
"""Save proxies to a file."""
with open(filename, 'w') as f:
while True:
proxy = await proxies.get()
if proxy is None:
break
proto = 'https' if 'HTTPS' in proxy.types else 'http'
row = '%s://%s:%d\n' % (pr... | async def save(proxies, filename):
"""Save proxies to a file."""
with open(filename, 'w') as f:
while True:
proxy = await proxies.get()
if proxy is None:
break
proto = 'https' if 'HTTPS' in proxy.types else 'http'
row = '%s://%s:%d\n' % (pr... | [
"Save",
"proxies",
"to",
"a",
"file",
"."
] | constverum/ProxyBroker | python | https://github.com/constverum/ProxyBroker/blob/d21aae8575fc3a95493233ecfd2c7cf47b36b069/examples/find_and_save.py#L8-L17 | [
"async",
"def",
"save",
"(",
"proxies",
",",
"filename",
")",
":",
"with",
"open",
"(",
"filename",
",",
"'w'",
")",
"as",
"f",
":",
"while",
"True",
":",
"proxy",
"=",
"await",
"proxies",
".",
"get",
"(",
")",
"if",
"proxy",
"is",
"None",
":",
"... | d21aae8575fc3a95493233ecfd2c7cf47b36b069 |
train | CommonConf.update | Updates global configuration settings with given values.
First checks if given configuration values differ from current values.
If any of the configuration values changed, generates a change event.
Currently we generate change event for any configuration change.
Note: This method is ide... | ryu/services/protocols/bgp/rtconf/common.py | def update(self, **kwargs):
"""Updates global configuration settings with given values.
First checks if given configuration values differ from current values.
If any of the configuration values changed, generates a change event.
Currently we generate change event for any configuration c... | def update(self, **kwargs):
"""Updates global configuration settings with given values.
First checks if given configuration values differ from current values.
If any of the configuration values changed, generates a change event.
Currently we generate change event for any configuration c... | [
"Updates",
"global",
"configuration",
"settings",
"with",
"given",
"values",
"."
] | osrg/ryu | python | https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/services/protocols/bgp/rtconf/common.py#L375-L403 | [
"def",
"update",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"# Update inherited configurations",
"super",
"(",
"CommonConf",
",",
"self",
")",
".",
"update",
"(",
"*",
"*",
"kwargs",
")",
"conf_changed",
"=",
"False",
"# Validate given configurations and ch... | 6f906e72c92e10bd0264c9b91a2f7bb85b97780c |
train | label_from_bin | Converts binary representation label to integer.
:param buf: Binary representation of label.
:return: MPLS Label and BoS bit. | ryu/lib/packet/mpls.py | def label_from_bin(buf):
"""
Converts binary representation label to integer.
:param buf: Binary representation of label.
:return: MPLS Label and BoS bit.
"""
mpls_label = type_desc.Int3.to_user(six.binary_type(buf))
return mpls_label >> 4, mpls_label & 1 | def label_from_bin(buf):
"""
Converts binary representation label to integer.
:param buf: Binary representation of label.
:return: MPLS Label and BoS bit.
"""
mpls_label = type_desc.Int3.to_user(six.binary_type(buf))
return mpls_label >> 4, mpls_label & 1 | [
"Converts",
"binary",
"representation",
"label",
"to",
"integer",
"."
] | osrg/ryu | python | https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/lib/packet/mpls.py#L73-L82 | [
"def",
"label_from_bin",
"(",
"buf",
")",
":",
"mpls_label",
"=",
"type_desc",
".",
"Int3",
".",
"to_user",
"(",
"six",
".",
"binary_type",
"(",
"buf",
")",
")",
"return",
"mpls_label",
">>",
"4",
",",
"mpls_label",
"&",
"1"
] | 6f906e72c92e10bd0264c9b91a2f7bb85b97780c |
train | ConfigurationManager.on_remove_vrf_conf | Removes VRF table associated with given `vrf_conf`.
Cleans up other links to this table as well. | ryu/services/protocols/bgp/core_managers/configuration_manager.py | def on_remove_vrf_conf(self, evt):
"""Removes VRF table associated with given `vrf_conf`.
Cleans up other links to this table as well.
"""
vrf_conf = evt.value
# Detach VrfConf change listener.
vrf_conf.remove_listener(VrfConf.VRF_CHG_EVT, self.on_chg_vrf_conf)
... | def on_remove_vrf_conf(self, evt):
"""Removes VRF table associated with given `vrf_conf`.
Cleans up other links to this table as well.
"""
vrf_conf = evt.value
# Detach VrfConf change listener.
vrf_conf.remove_listener(VrfConf.VRF_CHG_EVT, self.on_chg_vrf_conf)
... | [
"Removes",
"VRF",
"table",
"associated",
"with",
"given",
"vrf_conf",
"."
] | osrg/ryu | python | https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/services/protocols/bgp/core_managers/configuration_manager.py#L80-L102 | [
"def",
"on_remove_vrf_conf",
"(",
"self",
",",
"evt",
")",
":",
"vrf_conf",
"=",
"evt",
".",
"value",
"# Detach VrfConf change listener.",
"vrf_conf",
".",
"remove_listener",
"(",
"VrfConf",
".",
"VRF_CHG_EVT",
",",
"self",
".",
"on_chg_vrf_conf",
")",
"self",
"... | 6f906e72c92e10bd0264c9b91a2f7bb85b97780c |
train | ConfigurationManager.on_add_vrf_conf | Event handler for new VrfConf.
Creates a VrfTable to store routing information related to new Vrf.
Also arranges for related paths to be imported to this VrfTable. | ryu/services/protocols/bgp/core_managers/configuration_manager.py | def on_add_vrf_conf(self, evt):
"""Event handler for new VrfConf.
Creates a VrfTable to store routing information related to new Vrf.
Also arranges for related paths to be imported to this VrfTable.
"""
vrf_conf = evt.value
route_family = vrf_conf.route_family
as... | def on_add_vrf_conf(self, evt):
"""Event handler for new VrfConf.
Creates a VrfTable to store routing information related to new Vrf.
Also arranges for related paths to be imported to this VrfTable.
"""
vrf_conf = evt.value
route_family = vrf_conf.route_family
as... | [
"Event",
"handler",
"for",
"new",
"VrfConf",
"."
] | osrg/ryu | python | https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/services/protocols/bgp/core_managers/configuration_manager.py#L104-L128 | [
"def",
"on_add_vrf_conf",
"(",
"self",
",",
"evt",
")",
":",
"vrf_conf",
"=",
"evt",
".",
"value",
"route_family",
"=",
"vrf_conf",
".",
"route_family",
"assert",
"route_family",
"in",
"vrfs",
".",
"SUPPORTED_VRF_RF",
"# Create VRF table with given configuration.",
... | 6f906e72c92e10bd0264c9b91a2f7bb85b97780c |
train | _parse_zebra_family_prefix | Parses family and prefix in Zebra format. | ryu/lib/packet/zebra.py | def _parse_zebra_family_prefix(buf):
"""
Parses family and prefix in Zebra format.
"""
(family,) = struct.unpack_from(_ZEBRA_FAMILY_FMT, buf)
rest = buf[_ZEBRA_FAMILY_SIZE:]
if socket.AF_INET == family:
(prefix, p_len) = struct.unpack_from(_ZEBRA_IPV4_PREFIX_FMT, rest)
prefix = ... | def _parse_zebra_family_prefix(buf):
"""
Parses family and prefix in Zebra format.
"""
(family,) = struct.unpack_from(_ZEBRA_FAMILY_FMT, buf)
rest = buf[_ZEBRA_FAMILY_SIZE:]
if socket.AF_INET == family:
(prefix, p_len) = struct.unpack_from(_ZEBRA_IPV4_PREFIX_FMT, rest)
prefix = ... | [
"Parses",
"family",
"and",
"prefix",
"in",
"Zebra",
"format",
"."
] | osrg/ryu | python | https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/lib/packet/zebra.py#L426-L444 | [
"def",
"_parse_zebra_family_prefix",
"(",
"buf",
")",
":",
"(",
"family",
",",
")",
"=",
"struct",
".",
"unpack_from",
"(",
"_ZEBRA_FAMILY_FMT",
",",
"buf",
")",
"rest",
"=",
"buf",
"[",
"_ZEBRA_FAMILY_SIZE",
":",
"]",
"if",
"socket",
".",
"AF_INET",
"==",... | 6f906e72c92e10bd0264c9b91a2f7bb85b97780c |
train | _serialize_zebra_family_prefix | Serializes family and prefix in Zebra format. | ryu/lib/packet/zebra.py | def _serialize_zebra_family_prefix(prefix):
"""
Serializes family and prefix in Zebra format.
"""
if ip.valid_ipv4(prefix):
family = socket.AF_INET # fixup
prefix_addr, prefix_num = prefix.split('/')
return family, struct.pack(
_ZEBRA_FAMILY_IPV4_PREFIX_FMT,
... | def _serialize_zebra_family_prefix(prefix):
"""
Serializes family and prefix in Zebra format.
"""
if ip.valid_ipv4(prefix):
family = socket.AF_INET # fixup
prefix_addr, prefix_num = prefix.split('/')
return family, struct.pack(
_ZEBRA_FAMILY_IPV4_PREFIX_FMT,
... | [
"Serializes",
"family",
"and",
"prefix",
"in",
"Zebra",
"format",
"."
] | osrg/ryu | python | https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/lib/packet/zebra.py#L447-L468 | [
"def",
"_serialize_zebra_family_prefix",
"(",
"prefix",
")",
":",
"if",
"ip",
".",
"valid_ipv4",
"(",
"prefix",
")",
":",
"family",
"=",
"socket",
".",
"AF_INET",
"# fixup",
"prefix_addr",
",",
"prefix_num",
"=",
"prefix",
".",
"split",
"(",
"'/'",
")",
"r... | 6f906e72c92e10bd0264c9b91a2f7bb85b97780c |
train | is_valid_mac | Returns True if the given MAC address is valid.
The given MAC address should be a colon hexadecimal notation string.
Samples:
- valid address: aa:bb:cc:dd:ee:ff, 11:22:33:44:55:66
- invalid address: aa:bb:cc:dd, 11-22-33-44-55-66, etc. | ryu/services/protocols/bgp/utils/validation.py | def is_valid_mac(mac):
"""Returns True if the given MAC address is valid.
The given MAC address should be a colon hexadecimal notation string.
Samples:
- valid address: aa:bb:cc:dd:ee:ff, 11:22:33:44:55:66
- invalid address: aa:bb:cc:dd, 11-22-33-44-55-66, etc.
"""
return bool(re.m... | def is_valid_mac(mac):
"""Returns True if the given MAC address is valid.
The given MAC address should be a colon hexadecimal notation string.
Samples:
- valid address: aa:bb:cc:dd:ee:ff, 11:22:33:44:55:66
- invalid address: aa:bb:cc:dd, 11-22-33-44-55-66, etc.
"""
return bool(re.m... | [
"Returns",
"True",
"if",
"the",
"given",
"MAC",
"address",
"is",
"valid",
"."
] | osrg/ryu | python | https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/services/protocols/bgp/utils/validation.py#L26-L36 | [
"def",
"is_valid_mac",
"(",
"mac",
")",
":",
"return",
"bool",
"(",
"re",
".",
"match",
"(",
"r'^'",
"+",
"r'[\\:\\-]'",
".",
"join",
"(",
"[",
"r'([0-9a-f]{2})'",
"]",
"*",
"6",
")",
"+",
"r'$'",
",",
"mac",
".",
"lower",
"(",
")",
")",
")"
] | 6f906e72c92e10bd0264c9b91a2f7bb85b97780c |
train | is_valid_ip_prefix | Returns True if *prefix* is a valid IPv4 or IPv6 address prefix.
*prefix* should be a number between 0 to *bits* length. | ryu/services/protocols/bgp/utils/validation.py | def is_valid_ip_prefix(prefix, bits):
"""Returns True if *prefix* is a valid IPv4 or IPv6 address prefix.
*prefix* should be a number between 0 to *bits* length.
"""
try:
# Prefix should be a number
prefix = int(prefix)
except ValueError:
return False
# Prefix should be... | def is_valid_ip_prefix(prefix, bits):
"""Returns True if *prefix* is a valid IPv4 or IPv6 address prefix.
*prefix* should be a number between 0 to *bits* length.
"""
try:
# Prefix should be a number
prefix = int(prefix)
except ValueError:
return False
# Prefix should be... | [
"Returns",
"True",
"if",
"*",
"prefix",
"*",
"is",
"a",
"valid",
"IPv4",
"or",
"IPv6",
"address",
"prefix",
"."
] | osrg/ryu | python | https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/services/protocols/bgp/utils/validation.py#L39-L51 | [
"def",
"is_valid_ip_prefix",
"(",
"prefix",
",",
"bits",
")",
":",
"try",
":",
"# Prefix should be a number",
"prefix",
"=",
"int",
"(",
"prefix",
")",
"except",
"ValueError",
":",
"return",
"False",
"# Prefix should be a number between 0 to *bits*",
"return",
"0",
... | 6f906e72c92e10bd0264c9b91a2f7bb85b97780c |
train | is_valid_ipv4_prefix | Returns True if *ipv4_prefix* is a valid prefix with mask.
Samples:
- valid prefix: 1.1.1.0/32, 244.244.244.1/10
- invalid prefix: 255.2.2.2/2, 2.2.2/22, etc. | ryu/services/protocols/bgp/utils/validation.py | def is_valid_ipv4_prefix(ipv4_prefix):
"""Returns True if *ipv4_prefix* is a valid prefix with mask.
Samples:
- valid prefix: 1.1.1.0/32, 244.244.244.1/10
- invalid prefix: 255.2.2.2/2, 2.2.2/22, etc.
"""
if not isinstance(ipv4_prefix, str):
return False
tokens = ipv4_prefi... | def is_valid_ipv4_prefix(ipv4_prefix):
"""Returns True if *ipv4_prefix* is a valid prefix with mask.
Samples:
- valid prefix: 1.1.1.0/32, 244.244.244.1/10
- invalid prefix: 255.2.2.2/2, 2.2.2/22, etc.
"""
if not isinstance(ipv4_prefix, str):
return False
tokens = ipv4_prefi... | [
"Returns",
"True",
"if",
"*",
"ipv4_prefix",
"*",
"is",
"a",
"valid",
"prefix",
"with",
"mask",
"."
] | osrg/ryu | python | https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/services/protocols/bgp/utils/validation.py#L66-L81 | [
"def",
"is_valid_ipv4_prefix",
"(",
"ipv4_prefix",
")",
":",
"if",
"not",
"isinstance",
"(",
"ipv4_prefix",
",",
"str",
")",
":",
"return",
"False",
"tokens",
"=",
"ipv4_prefix",
".",
"split",
"(",
"'/'",
")",
"if",
"len",
"(",
"tokens",
")",
"!=",
"2",
... | 6f906e72c92e10bd0264c9b91a2f7bb85b97780c |
train | is_valid_ipv6_prefix | Returns True if given `ipv6_prefix` is a valid IPv6 prefix. | ryu/services/protocols/bgp/utils/validation.py | def is_valid_ipv6_prefix(ipv6_prefix):
"""Returns True if given `ipv6_prefix` is a valid IPv6 prefix."""
# Validate input type
if not isinstance(ipv6_prefix, str):
return False
tokens = ipv6_prefix.split('/')
if len(tokens) != 2:
return False
# Validate address/mask and return... | def is_valid_ipv6_prefix(ipv6_prefix):
"""Returns True if given `ipv6_prefix` is a valid IPv6 prefix."""
# Validate input type
if not isinstance(ipv6_prefix, str):
return False
tokens = ipv6_prefix.split('/')
if len(tokens) != 2:
return False
# Validate address/mask and return... | [
"Returns",
"True",
"if",
"given",
"ipv6_prefix",
"is",
"a",
"valid",
"IPv6",
"prefix",
"."
] | osrg/ryu | python | https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/services/protocols/bgp/utils/validation.py#L90-L102 | [
"def",
"is_valid_ipv6_prefix",
"(",
"ipv6_prefix",
")",
":",
"# Validate input type",
"if",
"not",
"isinstance",
"(",
"ipv6_prefix",
",",
"str",
")",
":",
"return",
"False",
"tokens",
"=",
"ipv6_prefix",
".",
"split",
"(",
"'/'",
")",
"if",
"len",
"(",
"toke... | 6f906e72c92e10bd0264c9b91a2f7bb85b97780c |
train | is_valid_vpnv4_prefix | Returns True if given prefix is a string represent vpnv4 prefix.
Vpnv4 prefix is made up of RD:Ipv4, where RD is represents route
distinguisher and Ipv4 represents valid dot-decimal ipv4 notation string. | ryu/services/protocols/bgp/utils/validation.py | def is_valid_vpnv4_prefix(prefix):
"""Returns True if given prefix is a string represent vpnv4 prefix.
Vpnv4 prefix is made up of RD:Ipv4, where RD is represents route
distinguisher and Ipv4 represents valid dot-decimal ipv4 notation string.
"""
if not isinstance(prefix, str):
return False
... | def is_valid_vpnv4_prefix(prefix):
"""Returns True if given prefix is a string represent vpnv4 prefix.
Vpnv4 prefix is made up of RD:Ipv4, where RD is represents route
distinguisher and Ipv4 represents valid dot-decimal ipv4 notation string.
"""
if not isinstance(prefix, str):
return False
... | [
"Returns",
"True",
"if",
"given",
"prefix",
"is",
"a",
"string",
"represent",
"vpnv4",
"prefix",
"."
] | osrg/ryu | python | https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/services/protocols/bgp/utils/validation.py#L115-L134 | [
"def",
"is_valid_vpnv4_prefix",
"(",
"prefix",
")",
":",
"if",
"not",
"isinstance",
"(",
"prefix",
",",
"str",
")",
":",
"return",
"False",
"# Split the prefix into route distinguisher and IP",
"tokens",
"=",
"prefix",
".",
"split",
"(",
"':'",
",",
"2",
")",
... | 6f906e72c92e10bd0264c9b91a2f7bb85b97780c |
train | is_valid_vpnv6_prefix | Returns True if given prefix is a string represent vpnv6 prefix.
Vpnv6 prefix is made up of RD:Ipv6, where RD is represents route
distinguisher and Ipv6 represents valid colon hexadecimal notation string. | ryu/services/protocols/bgp/utils/validation.py | def is_valid_vpnv6_prefix(prefix):
"""Returns True if given prefix is a string represent vpnv6 prefix.
Vpnv6 prefix is made up of RD:Ipv6, where RD is represents route
distinguisher and Ipv6 represents valid colon hexadecimal notation string.
"""
if not isinstance(prefix, str):
return False... | def is_valid_vpnv6_prefix(prefix):
"""Returns True if given prefix is a string represent vpnv6 prefix.
Vpnv6 prefix is made up of RD:Ipv6, where RD is represents route
distinguisher and Ipv6 represents valid colon hexadecimal notation string.
"""
if not isinstance(prefix, str):
return False... | [
"Returns",
"True",
"if",
"given",
"prefix",
"is",
"a",
"string",
"represent",
"vpnv6",
"prefix",
"."
] | osrg/ryu | python | https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/services/protocols/bgp/utils/validation.py#L137-L156 | [
"def",
"is_valid_vpnv6_prefix",
"(",
"prefix",
")",
":",
"if",
"not",
"isinstance",
"(",
"prefix",
",",
"str",
")",
":",
"return",
"False",
"# Split the prefix into route distinguisher and IP",
"tokens",
"=",
"prefix",
".",
"split",
"(",
"':'",
",",
"2",
")",
... | 6f906e72c92e10bd0264c9b91a2f7bb85b97780c |
train | is_valid_mpls_label | Validates `label` according to MPLS label rules
RFC says:
This 20-bit field.
A value of 0 represents the "IPv4 Explicit NULL Label".
A value of 1 represents the "Router Alert Label".
A value of 2 represents the "IPv6 Explicit NULL Label".
A value of 3 represents the "Implicit NULL Label".
V... | ryu/services/protocols/bgp/utils/validation.py | def is_valid_mpls_label(label):
"""Validates `label` according to MPLS label rules
RFC says:
This 20-bit field.
A value of 0 represents the "IPv4 Explicit NULL Label".
A value of 1 represents the "Router Alert Label".
A value of 2 represents the "IPv6 Explicit NULL Label".
A value of 3 repr... | def is_valid_mpls_label(label):
"""Validates `label` according to MPLS label rules
RFC says:
This 20-bit field.
A value of 0 represents the "IPv4 Explicit NULL Label".
A value of 1 represents the "Router Alert Label".
A value of 2 represents the "IPv6 Explicit NULL Label".
A value of 3 repr... | [
"Validates",
"label",
"according",
"to",
"MPLS",
"label",
"rules"
] | osrg/ryu | python | https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/services/protocols/bgp/utils/validation.py#L168-L184 | [
"def",
"is_valid_mpls_label",
"(",
"label",
")",
":",
"if",
"(",
"not",
"isinstance",
"(",
"label",
",",
"numbers",
".",
"Integral",
")",
"or",
"(",
"4",
"<=",
"label",
"<=",
"15",
")",
"or",
"(",
"label",
"<",
"0",
"or",
"label",
">",
"2",
"**",
... | 6f906e72c92e10bd0264c9b91a2f7bb85b97780c |
train | is_valid_mpls_labels | Returns True if the given value is a list of valid MPLS labels. | ryu/services/protocols/bgp/utils/validation.py | def is_valid_mpls_labels(labels):
"""Returns True if the given value is a list of valid MPLS labels.
"""
if not isinstance(labels, (list, tuple)):
return False
for label in labels:
if not is_valid_mpls_label(label):
return False
return True | def is_valid_mpls_labels(labels):
"""Returns True if the given value is a list of valid MPLS labels.
"""
if not isinstance(labels, (list, tuple)):
return False
for label in labels:
if not is_valid_mpls_label(label):
return False
return True | [
"Returns",
"True",
"if",
"the",
"given",
"value",
"is",
"a",
"list",
"of",
"valid",
"MPLS",
"labels",
"."
] | osrg/ryu | python | https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/services/protocols/bgp/utils/validation.py#L187-L197 | [
"def",
"is_valid_mpls_labels",
"(",
"labels",
")",
":",
"if",
"not",
"isinstance",
"(",
"labels",
",",
"(",
"list",
",",
"tuple",
")",
")",
":",
"return",
"False",
"for",
"label",
"in",
"labels",
":",
"if",
"not",
"is_valid_mpls_label",
"(",
"label",
")"... | 6f906e72c92e10bd0264c9b91a2f7bb85b97780c |
train | is_valid_ext_comm_attr | Validates *attr* as string representation of RT or SOO.
Returns True if *attr* is as per our convention of RT or SOO, else
False. Our convention is to represent RT/SOO is a string with format:
*global_admin_part:local_admin_path* | ryu/services/protocols/bgp/utils/validation.py | def is_valid_ext_comm_attr(attr):
"""Validates *attr* as string representation of RT or SOO.
Returns True if *attr* is as per our convention of RT or SOO, else
False. Our convention is to represent RT/SOO is a string with format:
*global_admin_part:local_admin_path*
"""
if not isinstance(attr, ... | def is_valid_ext_comm_attr(attr):
"""Validates *attr* as string representation of RT or SOO.
Returns True if *attr* is as per our convention of RT or SOO, else
False. Our convention is to represent RT/SOO is a string with format:
*global_admin_part:local_admin_path*
"""
if not isinstance(attr, ... | [
"Validates",
"*",
"attr",
"*",
"as",
"string",
"representation",
"of",
"RT",
"or",
"SOO",
"."
] | osrg/ryu | python | https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/services/protocols/bgp/utils/validation.py#L214-L238 | [
"def",
"is_valid_ext_comm_attr",
"(",
"attr",
")",
":",
"if",
"not",
"isinstance",
"(",
"attr",
",",
"str",
")",
":",
"return",
"False",
"tokens",
"=",
"attr",
".",
"rsplit",
"(",
"':'",
",",
"1",
")",
"if",
"len",
"(",
"tokens",
")",
"!=",
"2",
":... | 6f906e72c92e10bd0264c9b91a2f7bb85b97780c |
train | is_valid_esi | Returns True if the given EVPN Ethernet SegmentEthernet ID is valid. | ryu/services/protocols/bgp/utils/validation.py | def is_valid_esi(esi):
"""Returns True if the given EVPN Ethernet SegmentEthernet ID is valid."""
if isinstance(esi, numbers.Integral):
return 0 <= esi <= 0xffffffffffffffffff
return isinstance(esi, dict) | def is_valid_esi(esi):
"""Returns True if the given EVPN Ethernet SegmentEthernet ID is valid."""
if isinstance(esi, numbers.Integral):
return 0 <= esi <= 0xffffffffffffffffff
return isinstance(esi, dict) | [
"Returns",
"True",
"if",
"the",
"given",
"EVPN",
"Ethernet",
"SegmentEthernet",
"ID",
"is",
"valid",
"."
] | osrg/ryu | python | https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/services/protocols/bgp/utils/validation.py#L241-L245 | [
"def",
"is_valid_esi",
"(",
"esi",
")",
":",
"if",
"isinstance",
"(",
"esi",
",",
"numbers",
".",
"Integral",
")",
":",
"return",
"0",
"<=",
"esi",
"<=",
"0xffffffffffffffffff",
"return",
"isinstance",
"(",
"esi",
",",
"dict",
")"
] | 6f906e72c92e10bd0264c9b91a2f7bb85b97780c |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.