index
int64
0
50.7k
project_path
stringclasses
279 values
completion_path
stringlengths
57
199
signature_postion
stringlengths
3
11
class_position
stringlengths
3
11
function_name
stringlengths
1
62
class_name
stringlengths
0
55
body_position
stringlengths
3
11
body_position_with_comments
stringlengths
3
11
masked_class
stringlengths
14
8.32k
masked_class_with_comment
stringlengths
14
8.32k
func_body
stringlengths
9
6.72k
func_body_with_comment
stringlengths
9
6.72k
len_func_body
int64
1
643
len_input
int64
10
2.02k
len_output
int64
4
1.9k
total
int64
20
2.05k
file_code
stringlengths
14
442k
file_code_with_comment
stringlengths
14
442k
23,185
/home/hieuvd/dung_repo/raw/stars_01/pyodide_pyodide/pyodide
/home/hieuvd/dung_repo/raw/stars_01/pyodide_pyodide/pyodide/packages/optlang/test_optlang.py
4,5
1,41
test_optlang
5,41
5,41
import pytest def test_optlang(selenium): FILL_FUNC_BODY
import pytest def test_optlang(selenium): FILL_FUNC_BODY
selenium.load_package("optlang") selenium.run( """ from optlang import Model, Variable, Constraint, Objective # All the (symbolic) variables are declared, with a name and optionally a lower and/or upper bound. x1 = Variable('x1', lb=0) x2 = Variable('x2', lb=0) x...
selenium.load_package("optlang") selenium.run( """ from optlang import Model, Variable, Constraint, Objective # All the (symbolic) variables are declared, with a name and optionally a lower and/or upper bound. x1 = Variable('x1', lb=0) x2 = Variable('x2', lb=0) x...
184
27
574
601
import pytest def test_optlang(selenium): FILL_FUNC_BODY
import pytest def test_optlang(selenium): FILL_FUNC_BODY
23,186
/home/hieuvd/dung_repo/raw/stars_01/pyodide_pyodide/pyodide
/home/hieuvd/dung_repo/raw/stars_01/pyodide_pyodide/pyodide/packages/pandas/test_pandas.py
7,8
1,73
generate_largish_json
8,37
8,37
import random from typing import Any import pytest def generate_largish_json(n_rows: int = 91746) -> dict[str, Any]: FILL_FUNC_BODY@pytest.mark.driver_timeout(30) def test_extra_import(selenium, request): selenium.load_package("pandas") selenium.run("from pandas import Series, DataFrame") @pytest.mark.xfai...
import random from typing import Any import pytest def generate_largish_json(n_rows: int = 91746) -> dict[str, Any]: FILL_FUNC_BODY@pytest.mark.driver_timeout(30) def test_extra_import(selenium, request): selenium.load_package("pandas") selenium.run("from pandas import Series, DataFrame") @pytest.mark.xfai...
# with n_rows = 91746, the output JSON size will be ~15 MB/10k rows # Note: we don't fix the random seed here, but the actual values # shouldn't matter columns = [ ("column0", lambda: "XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX"), ( "column1", lambda: random.choice( ...
# with n_rows = 91746, the output JSON size will be ~15 MB/10k rows # Note: we don't fix the random seed here, but the actual values # shouldn't matter columns = [ ("column0", lambda: "XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX"), ( "column1", lambda: random.choice( ...
89
452
324
776
import random from typing import Any import pytest def generate_largish_json(n_rows: int = 91746) -> dict[str, Any]: FILL_FUNC_BODY@pytest.mark.driver_timeout(30) def test_extra_import(selenium, request): selenium.load_package("pandas") selenium.run("from pandas import Series, DataFrame") @pytest.mark.xfai...
import random from typing import Any import pytest def generate_largish_json(n_rows: int = 91746) -> dict[str, Any]: FILL_FUNC_BODY@pytest.mark.driver_timeout(30) def test_extra_import(selenium, request): selenium.load_package("pandas") selenium.run("from pandas import Series, DataFrame") @pytest.mark.xfai...
23,187
/home/hieuvd/dung_repo/raw/stars_01/pyodide_pyodide/pyodide
/home/hieuvd/dung_repo/raw/stars_01/pyodide_pyodide/pyodide/packages/pyxel/test_pyxel.py
4,6
1,63
selenium_sdl
6,24
6,24
import pytest @pytest.fixture(scope="function") def selenium_sdl(selenium_standalone): FILL_FUNC_BODY@pytest.mark.skip_refcount_check @pytest.mark.skip_pyproxy_check def test_show(selenium_sdl): selenium_sdl.run( """ import pyxel pyxel.init(120, 120) pyxel.cls(1) pyxel.cir...
import pytest @pytest.fixture(scope="function") def selenium_sdl(selenium_standalone): FILL_FUNC_BODY@pytest.mark.skip_refcount_check @pytest.mark.skip_pyproxy_check def test_show(selenium_sdl): selenium_sdl.run( """ import pyxel pyxel.init(120, 120) pyxel.cls(1) pyxel.cir...
if selenium_standalone.browser == "node": pytest.skip("No document object") selenium_standalone.run_js( """ var sdl2Canvas = document.createElement("canvas"); sdl2Canvas.id = "canvas"; document.body.appendChild(sdl2Canvas); // Temporary workaround for pyodide#36...
if selenium_standalone.browser == "node": pytest.skip("No document object") selenium_standalone.run_js( """ var sdl2Canvas = document.createElement("canvas"); sdl2Canvas.id = "canvas"; document.body.appendChild(sdl2Canvas); // Temporary workaround for pyodide#36...
31
355
194
549
import pytest @pytest.fixture(scope="function") def selenium_sdl(selenium_standalone): FILL_FUNC_BODY@pytest.mark.skip_refcount_check @pytest.mark.skip_pyproxy_check def test_show(selenium_sdl): selenium_sdl.run( """ import pyxel pyxel.init(120, 120) pyxel.cls(1) pyxel.cir...
import pytest @pytest.fixture(scope="function") def selenium_sdl(selenium_standalone): FILL_FUNC_BODY@pytest.mark.skip_refcount_check @pytest.mark.skip_pyproxy_check def test_show(selenium_sdl): selenium_sdl.run( """ import pyxel pyxel.init(120, 120) pyxel.cls(1) pyxel.cir...
23,188
/home/hieuvd/dung_repo/raw/stars_01/pyodide_pyodide/pyodide
/home/hieuvd/dung_repo/raw/stars_01/pyodide_pyodide/pyodide/packages/pyyaml/test_pyyaml.py
4,6
1,17
test_pyyaml
6,17
6,17
from pytest_pyodide import run_in_pyodide @run_in_pyodide(packages=["pyyaml"]) def test_pyyaml(selenium): FILL_FUNC_BODY
from pytest_pyodide import run_in_pyodide @run_in_pyodide(packages=["pyyaml"]) def test_pyyaml(selenium): FILL_FUNC_BODY
import yaml from yaml import CLoader as Loader document = """ - Hesperiidae - Papilionidae - Apatelodidae - Epiplemidae """ loaded = yaml.load(document, Loader=Loader) assert loaded == ["Hesperiidae", "Papilionidae", "Apatelodidae", "Epiplemidae"]
import yaml from yaml import CLoader as Loader document = """ - Hesperiidae - Papilionidae - Apatelodidae - Epiplemidae """ loaded = yaml.load(document, Loader=Loader) assert loaded == ["Hesperiidae", "Papilionidae", "Apatelodidae", "Epiplemidae"]
31
58
110
168
from pytest_pyodide import run_in_pyodide @run_in_pyodide(packages=["pyyaml"]) def test_pyyaml(selenium): FILL_FUNC_BODY
from pytest_pyodide import run_in_pyodide @run_in_pyodide(packages=["pyyaml"]) def test_pyyaml(selenium): FILL_FUNC_BODY
23,189
/home/hieuvd/dung_repo/raw/stars_01/pyodide_pyodide/pyodide
/home/hieuvd/dung_repo/raw/stars_01/pyodide_pyodide/pyodide/packages/scikit-learn/test_scikit-learn.py
5,10
1,51
test_scikit_learn
10,33
10,33
import pytest from pytest_pyodide.fixture import selenium_context_manager @pytest.mark.driver_timeout(40) @pytest.mark.xfail_browsers( chrome="Times out in chrome", firefox="Times out in firefox" ) def test_scikit_learn(selenium_module_scope): FILL_FUNC_BODY@pytest.mark.driver_timeout(40) @pytest.mark.xfail_brows...
import pytest from pytest_pyodide.fixture import selenium_context_manager @pytest.mark.driver_timeout(40) @pytest.mark.xfail_browsers( chrome="Times out in chrome", firefox="Times out in firefox" ) def test_scikit_learn(selenium_module_scope): FILL_FUNC_BODY@pytest.mark.driver_timeout(40) @pytest.mark.xfail_brows...
with selenium_context_manager(selenium_module_scope) as selenium: selenium.load_package("scikit-learn") assert ( selenium.run( """ import numpy as np import sklearn from sklearn.linear_model import LogisticRegression ...
with selenium_context_manager(selenium_module_scope) as selenium: selenium.load_package("scikit-learn") assert ( selenium.run( """ import numpy as np import sklearn from sklearn.linear_model import LogisticRegression ...
43
343
218
561
import pytest from pytest_pyodide.fixture import selenium_context_manager @pytest.mark.driver_timeout(40) @pytest.mark.xfail_browsers( chrome="Times out in chrome", firefox="Times out in firefox" ) def test_scikit_learn(selenium_module_scope): FILL_FUNC_BODY@pytest.mark.driver_timeout(40) @pytest.mark.xfail_brows...
import pytest from pytest_pyodide.fixture import selenium_context_manager @pytest.mark.driver_timeout(40) @pytest.mark.xfail_browsers( chrome="Times out in chrome", firefox="Times out in firefox" ) def test_scikit_learn(selenium_module_scope): FILL_FUNC_BODY@pytest.mark.driver_timeout(40) @pytest.mark.xfail_brows...
23,190
/home/hieuvd/dung_repo/raw/stars_01/pyodide_pyodide/pyodide
/home/hieuvd/dung_repo/raw/stars_01/pyodide_pyodide/pyodide/packages/sisl/test_sisl.py
46,49
1,52
test_physics_sparse
49,52
49,52
import pytest from pytest_pyodide import run_in_pyodide @pytest.mark.xfail_browsers(firefox="Too slow") @run_in_pyodide(packages=["sisl-tests", "pytest"]) def test_load_sisl(selenium): """Loading sisl takes a really long time so this separates it out to reduce the chance that test_nodes times out. """ ...
import pytest from pytest_pyodide import run_in_pyodide @pytest.mark.xfail_browsers(firefox="Too slow") @run_in_pyodide(packages=["sisl-tests", "pytest"]) def test_load_sisl(selenium): """Loading sisl takes a really long time so this separates it out to reduce the chance that test_nodes times out. """ ...
import pytest pytest.main(["--pyargs", "sisl.physics.tests.test_physics_sparse"])
import pytest pytest.main(["--pyargs", "sisl.physics.tests.test_physics_sparse"])
4
525
39
564
import pytest from pytest_pyodide import run_in_pyodide @pytest.mark.xfail_browsers(firefox="Too slow") @run_in_pyodide(packages=["sisl-tests", "pytest"]) def test_load_sisl(selenium): """Loading sisl takes a really long time so this separates it out to reduce the chance that test_nodes times out. """ ...
import pytest from pytest_pyodide import run_in_pyodide @pytest.mark.xfail_browsers(firefox="Too slow") @run_in_pyodide(packages=["sisl-tests", "pytest"]) def test_load_sisl(selenium): """Loading sisl takes a really long time so this separates it out to reduce the chance that test_nodes times out. """ ...
23,191
/home/hieuvd/dung_repo/raw/stars_01/pyodide_pyodide/pyodide
/home/hieuvd/dung_repo/raw/stars_01/pyodide_pyodide/pyodide/packages/swiglpk/test_swiglpk.py
1,2
1,49
test_swiglpk
2,49
2,49
def test_swiglpk(selenium): FILL_FUNC_BODY
def test_swiglpk(selenium): FILL_FUNC_BODY
selenium.load_package("swiglpk") selenium.run( """ from swiglpk import * ia = intArray(1+1000); ja = intArray(1+1000); ar = doubleArray(1+1000); lp = glp_create_prob(); glp_set_prob_name(lp, "sample"); glp_set_obj_dir(lp, GLP_MAX); glp_add_rows(lp...
selenium.load_package("swiglpk") selenium.run( """ from swiglpk import * ia = intArray(1+1000); ja = intArray(1+1000); ar = doubleArray(1+1000); lp = glp_create_prob(); glp_set_prob_name(lp, "sample"); glp_set_obj_dir(lp, GLP_MAX); glp_add_rows(lp...
260
23
1,119
1,142
def test_swiglpk(selenium): FILL_FUNC_BODY
def test_swiglpk(selenium): FILL_FUNC_BODY
23,192
/home/hieuvd/dung_repo/raw/stars_01/pyodide_pyodide/pyodide
/home/hieuvd/dung_repo/raw/stars_01/pyodide_pyodide/pyodide/pyodide-build/pyodide_build/bash_runner.py
104,108
1,122
get_bash_runner
108,122
108,122
import json import os import subprocess import sys import textwrap from collections.abc import Iterator from contextlib import contextmanager from pathlib import Path from types import TracebackType from typing import Any, TextIO from .build_env import ( get_build_environment_vars, get_pyodide_root, ) from .co...
import json import os import subprocess import sys import textwrap from collections.abc import Iterator from contextlib import contextmanager from pathlib import Path from types import TracebackType from typing import Any, TextIO from .build_env import ( get_build_environment_vars, get_pyodide_root, ) from .co...
pyodide_root = get_pyodide_root() env = get_build_environment_vars(pyodide_root) env.update(extra_envs) with BashRunnerWithSharedEnvironment(env=env) as b: # Working in-tree, add emscripten toolchain into PATH and set ccache if Path(pyodide_root, "pyodide_env.sh").exists(): ...
pyodide_root = get_pyodide_root() env = get_build_environment_vars(pyodide_root) env.update(extra_envs) with BashRunnerWithSharedEnvironment(env=env) as b: # Working in-tree, add emscripten toolchain into PATH and set ccache if Path(pyodide_root, "pyodide_env.sh").exists(): ...
34
971
179
1,150
import json import os import subprocess import sys import textwrap from collections.abc import Iterator from contextlib import contextmanager from pathlib import Path from types import TracebackType from typing import Any, TextIO from .build_env import ( get_build_environment_vars, get_pyodide_root, ) from .co...
import json import os import subprocess import sys import textwrap from collections.abc import Iterator from contextlib import contextmanager from pathlib import Path from types import TracebackType from typing import Any, TextIO from .build_env import ( get_build_environment_vars, get_pyodide_root, ) from .co...
23,193
/home/hieuvd/dung_repo/raw/stars_01/pyodide_pyodide/pyodide
/home/hieuvd/dung_repo/raw/stars_01/pyodide_pyodide/pyodide/pyodide-build/pyodide_build/bash_runner.py
40,41
20,104
run_unchecked
BashRunnerWithSharedEnvironment
41,65
41,65
class BashRunnerWithSharedEnvironment: """Run multiple bash scripts with persistent environment. Environment is stored to "env" member between runs. This can be updated directly to adjust the environment, or read to get variables. """ def __init__(self, env: dict[str, str] | None = None) -> None: ...
class BashRunnerWithSharedEnvironment: """Run multiple bash scripts with persistent environment. Environment is stored to "env" member between runs. This can be updated directly to adjust the environment, or read to get variables. """ def __init__(self, env: dict[str, str] | None = None) -> None: ...
assert self._fd_write is not None assert self._reader is not None write_env_pycode = ";".join( [ "import os", "import json", f'os.write({self._fd_write}, json.dumps(dict(os.environ)).encode() + b"\\n")', ] ) ...
assert self._fd_write is not None assert self._reader is not None write_env_pycode = ";".join( [ "import os", "import json", f'os.write({self._fd_write}, json.dumps(dict(os.environ)).encode() + b"\\n")', ] ) ...
53
589
263
852
import json import os import subprocess import sys import textwrap from collections.abc import Iterator from contextlib import contextmanager from pathlib import Path from types import TracebackType from typing import Any, TextIO from .build_env import ( get_build_environment_vars, get_pyodide_root, ) from .co...
import json import os import subprocess import sys import textwrap from collections.abc import Iterator from contextlib import contextmanager from pathlib import Path from types import TracebackType from typing import Any, TextIO from .build_env import ( get_build_environment_vars, get_pyodide_root, ) from .co...
23,194
/home/hieuvd/dung_repo/raw/stars_01/pyodide_pyodide/pyodide
/home/hieuvd/dung_repo/raw/stars_01/pyodide_pyodide/pyodide/pyodide-build/pyodide_build/config.py
55,56
11,109
_get_make_environment_vars
ConfigManager
59,87
56,87
class ConfigManager: """ Configuration manager for Package build process. The configuration manager is responsible for loading configuration from various sources. The configuration can be loaded from the following sources (in order of precedence): 1. Command line arguments (TODO) 2. En...
class ConfigManager: """ Configuration manager for Package build process. The configuration manager is responsible for loading configuration from various sources. The configuration can be loaded from the following sources (in order of precedence): 1. Command line arguments (TODO) 2. En...
environment = {} result = subprocess.run( ["make", "-f", str(self.pyodide_root / "Makefile.envs"), ".output_vars"], capture_output=True, text=True, env={"PYODIDE_ROOT": str(self.pyodide_root)}, ) if result.returncode != 0: logg...
""" Load environment variables from Makefile.envs """ environment = {} result = subprocess.run( ["make", "-f", str(self.pyodide_root / "Makefile.envs"), ".output_vars"], capture_output=True, text=True, env={"PYODIDE_ROOT": str(self....
66
697
267
964
import os import subprocess from collections.abc import Mapping from pathlib import Path from types import MappingProxyType from .common import _environment_substitute_str, exit_with_stdio from .logger import logger class ConfigManager: """ Configuration manager for Package build process. The configurat...
import os import subprocess from collections.abc import Mapping from pathlib import Path from types import MappingProxyType from .common import _environment_substitute_str, exit_with_stdio from .logger import logger class ConfigManager: """ Configuration manager for Package build process. The configurat...
23,195
/home/hieuvd/dung_repo/raw/stars_01/pyodide_pyodide/pyodide
/home/hieuvd/dung_repo/raw/stars_01/pyodide_pyodide/pyodide/pyodide-build/pyodide_build/create_xbuildenv.py
43,46
1,128
_copy_wasm_libs
46,97
46,97
import shutil import subprocess from pathlib import Path from .build_env import ( get_build_flag, get_pyodide_root, get_unisolated_packages, ) from .common import exit_with_stdio from .logger import logger from .recipe import load_all_recipes def _copy_xbuild_files( pyodide_root: Path, xbuildenv_path...
import shutil import subprocess from pathlib import Path from .build_env import ( get_build_flag, get_pyodide_root, get_unisolated_packages, ) from .common import exit_with_stdio from .logger import logger from .recipe import load_all_recipes def _copy_xbuild_files( pyodide_root: Path, xbuildenv_path...
def get_relative_path(pyodide_root: Path, flag: str) -> Path: return Path(get_build_flag(flag)).relative_to(pyodide_root) pythoninclude = get_relative_path(pyodide_root, "PYTHONINCLUDE") sysconfig_dir = get_relative_path(pyodide_root, "SYSCONFIGDATA_DIR") # TODO: remove libs from the xbuildenv ...
def get_relative_path(pyodide_root: Path, flag: str) -> Path: return Path(get_build_flag(flag)).relative_to(pyodide_root) pythoninclude = get_relative_path(pyodide_root, "PYTHONINCLUDE") sysconfig_dir = get_relative_path(pyodide_root, "SYSCONFIGDATA_DIR") # TODO: remove libs from the xbuildenv ...
170
888
737
1,625
import shutil import subprocess from pathlib import Path from .build_env import ( get_build_flag, get_pyodide_root, get_unisolated_packages, ) from .common import exit_with_stdio from .logger import logger from .recipe import load_all_recipes def _copy_xbuild_files( pyodide_root: Path, xbuildenv_path...
import shutil import subprocess from pathlib import Path from .build_env import ( get_build_flag, get_pyodide_root, get_unisolated_packages, ) from .common import exit_with_stdio from .logger import logger from .recipe import load_all_recipes def _copy_xbuild_files( pyodide_root: Path, xbuildenv_path...
23,197
/home/hieuvd/dung_repo/raw/stars_01/pyodide_pyodide/pyodide
/home/hieuvd/dung_repo/raw/stars_01/pyodide_pyodide/pyodide/pyodide-build/pyodide_build/out_of_tree/build.py
11,17
1,48
run
17,48
17,48
import os from pathlib import Path from build import ConfigSettingsType from .. import build_env, common, pypabuild from ..build_env import get_pyodide_root from ..io import _BuildSpecExports def run( srcdir: Path, outdir: Path, exports: _BuildSpecExports, config_settings: ConfigSettingsType, ) -> P...
import os from pathlib import Path from build import ConfigSettingsType from .. import build_env, common, pypabuild from ..build_env import get_pyodide_root from ..io import _BuildSpecExports def run( srcdir: Path, outdir: Path, exports: _BuildSpecExports, config_settings: ConfigSettingsType, ) -> P...
outdir = outdir.resolve() cflags = build_env.get_build_flag("SIDE_MODULE_CFLAGS") cflags += f" {os.environ.get('CFLAGS', '')}" cxxflags = build_env.get_build_flag("SIDE_MODULE_CXXFLAGS") cxxflags += f" {os.environ.get('CXXFLAGS', '')}" ldflags = build_env.get_build_flag("SIDE_MODULE_LDFLAGS") ...
outdir = outdir.resolve() cflags = build_env.get_build_flag("SIDE_MODULE_CFLAGS") cflags += f" {os.environ.get('CFLAGS', '')}" cxxflags = build_env.get_build_flag("SIDE_MODULE_CXXFLAGS") cxxflags += f" {os.environ.get('CXXFLAGS', '')}" ldflags = build_env.get_build_flag("SIDE_MODULE_LDFLAGS") ...
68
115
450
565
import os from pathlib import Path from build import ConfigSettingsType from .. import build_env, common, pypabuild from ..build_env import get_pyodide_root from ..io import _BuildSpecExports def run( srcdir: Path, outdir: Path, exports: _BuildSpecExports, config_settings: ConfigSettingsType, ) -> P...
import os from pathlib import Path from build import ConfigSettingsType from .. import build_env, common, pypabuild from ..build_env import get_pyodide_root from ..io import _BuildSpecExports def run( srcdir: Path, outdir: Path, exports: _BuildSpecExports, config_settings: ConfigSettingsType, ) -> P...
23,200
/home/hieuvd/dung_repo/raw/stars_01/pyodide_pyodide/pyodide
/home/hieuvd/dung_repo/raw/stars_01/pyodide_pyodide/pyodide/pyodide-build/pyodide_build/vendor/_pypabuild.py
104,106
1,127
_handle_build_error
106,127
106,127
# This file contains private functions taken from pypa/build. # Copyright © 2019 Filipe Laíns <filipe.lains@gmail.com> # Permission is hereby granted, free of charge, to any person obtaining a # copy of this software and associated documentation files (the "Software"), # to deal in the Software without restriction, i...
# This file contains private functions taken from pypa/build. # Copyright © 2019 Filipe Laíns <filipe.lains@gmail.com> # Permission is hereby granted, free of charge, to any person obtaining a # copy of this software and associated documentation files (the "Software"), # to deal in the Software without restriction, i...
try: yield except (BuildException, FailedProcessError) as e: _error(str(e)) except BuildBackendException as e: if isinstance(e.exception, subprocess.CalledProcessError): _cprint() _error(str(e)) if e.exc_info: tb_lines = traceback.format_e...
try: yield except (BuildException, FailedProcessError) as e: _error(str(e)) except BuildBackendException as e: if isinstance(e.exception, subprocess.CalledProcessError): _cprint() _error(str(e)) if e.exc_info: tb_lines = traceback.format_e...
40
1,078
230
1,308
# This file contains private functions taken from pypa/build. # Copyright © 2019 Filipe Laíns <filipe.lains@gmail.com> # Permission is hereby granted, free of charge, to any person obtaining a # copy of this software and associated documentation files (the "Software"), # to deal in the Software without restriction, i...
# This file contains private functions taken from pypa/build. # Copyright © 2019 Filipe Laíns <filipe.lains@gmail.com> # Permission is hereby granted, free of charge, to any person obtaining a # copy of this software and associated documentation files (the "Software"), # to deal in the Software without restriction, i...
23,201
/home/hieuvd/dung_repo/raw/stars_01/pyodide_pyodide/pyodide
/home/hieuvd/dung_repo/raw/stars_01/pyodide_pyodide/pyodide/pyodide-build/pyodide_build/vendor/_pypabuild.py
94,96
89,104
scripts_dir
_DefaultIsolatedEnv
96,104
96,104
class _DefaultIsolatedEnv(DefaultIsolatedEnv): @staticmethod def log(message: str) -> None: _cprint("{bold}* {}{reset}", message) @property def scripts_dir(self) -> str: FILL_FUNC_BODY
class _DefaultIsolatedEnv(DefaultIsolatedEnv): @staticmethod def log(message: str) -> None: _cprint("{bold}* {}{reset}", message) @property def scripts_dir(self) -> str: FILL_FUNC_BODY
if hasattr(self, "_env_backend"): # pypabuild >= 1.2.0 return self._env_backend.scripts_dir elif hasattr(self, "_scripts_dir"): return self._scripts_dir else: raise AttributeError("No attribute '_env_backend' or '_scripts_dir' found")
if hasattr(self, "_env_backend"): # pypabuild >= 1.2.0 return self._env_backend.scripts_dir elif hasattr(self, "_scripts_dir"): return self._scripts_dir else: raise AttributeError("No attribute '_env_backend' or '_scripts_dir' found")
22
78
100
178
# This file contains private functions taken from pypa/build. # Copyright © 2019 Filipe Laíns <filipe.lains@gmail.com> # Permission is hereby granted, free of charge, to any person obtaining a # copy of this software and associated documentation files (the "Software"), # to deal in the Software without restriction, i...
# This file contains private functions taken from pypa/build. # Copyright © 2019 Filipe Laíns <filipe.lains@gmail.com> # Permission is hereby granted, free of charge, to any person obtaining a # copy of this software and associated documentation files (the "Software"), # to deal in the Software without restriction, i...
23,202
/home/hieuvd/dung_repo/raw/stars_01/pyodide_pyodide/pyodide
/home/hieuvd/dung_repo/raw/stars_01/pyodide_pyodide/pyodide/pyodide-build/pyodide_build/vendor/_pypabuild.py
84,86
83,89
log
_ProjectBuilder
86,89
86,89
class _ProjectBuilder(ProjectBuilder): @staticmethod def log(message: str) -> None: FILL_FUNC_BODY
class _ProjectBuilder(ProjectBuilder): @staticmethod def log(message: str) -> None: FILL_FUNC_BODY
_cprint("{bold}* {}{reset}", message)
_cprint("{bold}* {}{reset}", message)
3
37
22
59
# This file contains private functions taken from pypa/build. # Copyright © 2019 Filipe Laíns <filipe.lains@gmail.com> # Permission is hereby granted, free of charge, to any person obtaining a # copy of this software and associated documentation files (the "Software"), # to deal in the Software without restriction, i...
# This file contains private functions taken from pypa/build. # Copyright © 2019 Filipe Laíns <filipe.lains@gmail.com> # Permission is hereby granted, free of charge, to any person obtaining a # copy of this software and associated documentation files (the "Software"), # to deal in the Software without restriction, i...
23,204
/home/hieuvd/dung_repo/raw/stars_01/pyodide_pyodide/pyodide
/home/hieuvd/dung_repo/raw/stars_01/pyodide_pyodide/pyodide/src/py/_pyodide/_importhook.py
76,77
12,99
unregister_js_module
JsFinder
91,99
77,99
class JsFinder(MetaPathFinder): def __init__(self) -> None: self.jsproxies: dict[str, Any] = {} self.hook: Callable[[JsProxy], None] = lambda _: None def find_spec( self, fullname: str, path: Sequence[bytes | str] | None, target: ModuleType | None = None, ) -...
class JsFinder(MetaPathFinder): def __init__(self) -> None: self.jsproxies: dict[str, Any] = {} self.hook: Callable[[JsProxy], None] = lambda _: None def find_spec( self, fullname: str, path: Sequence[bytes | str] | None, target: ModuleType | None = None, ) -...
try: del self.jsproxies[name] except KeyError: raise ValueError( f"Cannot unregister {name!r}: no Javascript module with that name is registered" ) from None
""" Unregisters a JavaScript module with given name that has been previously registered with :js:func:`pyodide.registerJsModule` or :py:func:`pyodide.ffi.register_js_module`. If a JavaScript module with that name does not already exist, will raise an error. If the module has alre...
21
830
66
896
import sys from collections.abc import Callable, Sequence from importlib.abc import Loader, MetaPathFinder from importlib.machinery import ModuleSpec from importlib.util import spec_from_loader from types import ModuleType from typing import Any from ._core_docs import JsProxy class JsFinder(MetaPathFinder): def...
import sys from collections.abc import Callable, Sequence from importlib.abc import Loader, MetaPathFinder from importlib.machinery import ModuleSpec from importlib.util import spec_from_loader from types import ModuleType from typing import Any from ._core_docs import JsProxy class JsFinder(MetaPathFinder): def...
23,205
/home/hieuvd/dung_repo/raw/stars_01/pyodide_pyodide/pyodide
/home/hieuvd/dung_repo/raw/stars_01/pyodide_pyodide/pyodide/src/py/_pyodide/_importhook.py
106,107
99,114
exec_module
JsLoader
107,110
107,110
class JsLoader(Loader): def __init__(self, jsproxy: Any) -> None: self.jsproxy = jsproxy def create_module(self, spec: ModuleSpec) -> Any: return self.jsproxy def exec_module(self, module: ModuleType) -> None: FILL_FUNC_BODY def is_package(self, fullname: str) -> bool: return Tr...
class JsLoader(Loader): def __init__(self, jsproxy: Any) -> None: self.jsproxy = jsproxy def create_module(self, spec: ModuleSpec) -> Any: return self.jsproxy def exec_module(self, module: ModuleType) -> None: FILL_FUNC_BODY def is_package(self, fullname: str) -> bool: return Tr...
pass # used by importlib.util.spec_from_loader
pass # used by importlib.util.spec_from_loader
5
113
22
135
import sys from collections.abc import Callable, Sequence from importlib.abc import Loader, MetaPathFinder from importlib.machinery import ModuleSpec from importlib.util import spec_from_loader from types import ModuleType from typing import Any from ._core_docs import JsProxy class JsFinder(MetaPathFinder): def...
import sys from collections.abc import Callable, Sequence from importlib.abc import Loader, MetaPathFinder from importlib.machinery import ModuleSpec from importlib.util import spec_from_loader from types import ModuleType from typing import Any from ._core_docs import JsProxy class JsFinder(MetaPathFinder): def...
23,206
/home/hieuvd/dung_repo/raw/stars_01/pyodide_pyodide/pyodide
/home/hieuvd/dung_repo/raw/stars_01/pyodide_pyodide/pyodide/src/py/_pyodide/docs_argspec.py
7,8
1,31
docs_argspec
18,25
8,25
from collections.abc import Callable from typing import TypeVar T = TypeVar("T") def docs_argspec(argspec: str) -> Callable[[T], T]: FILL_FUNC_BODYimport builtins # Evil method to override docs_argspec when building docs globals()["docs_argspec"] = getattr(builtins, "--docs_argspec--", docs_argspec) __all__ = ["do...
from collections.abc import Callable from typing import TypeVar T = TypeVar("T") def docs_argspec(argspec: str) -> Callable[[T], T]: """Override the argspec of the function in the documentation. This is defined as a no-op here, but is overridden when building the docs. It is not easy to satisfy mypy so...
def dec(func): return func return dec
"""Override the argspec of the function in the documentation. This is defined as a no-op here, but is overridden when building the docs. It is not easy to satisfy mypy so frequently we have to put something like *args: Any, **kwargs: Any as the type for the method itself. This makes the docs look ...
6
248
26
274
from collections.abc import Callable from typing import TypeVar T = TypeVar("T") def docs_argspec(argspec: str) -> Callable[[T], T]: FILL_FUNC_BODYimport builtins # Evil method to override docs_argspec when building docs globals()["docs_argspec"] = getattr(builtins, "--docs_argspec--", docs_argspec) __all__ = ["do...
from collections.abc import Callable from typing import TypeVar T = TypeVar("T") def docs_argspec(argspec: str) -> Callable[[T], T]: """Override the argspec of the function in the documentation. This is defined as a no-op here, but is overridden when building the docs. It is not easy to satisfy mypy so...
23,207
/home/hieuvd/dung_repo/raw/stars_01/pyodide_pyodide/pyodide
/home/hieuvd/dung_repo/raw/stars_01/pyodide_pyodide/pyodide/src/py/_pyodide/docstring.py
23,24
1,51
get_cmeth_docstring
40,51
24,51
from textwrap import dedent def dedent_docstring(docstring): """This removes initial spaces from the lines of the docstring. After the first line of the docstring, all other lines will include some spaces. This removes them. Examples -------- >>> from _pyodide.docstring import dedent_docstri...
from textwrap import dedent def dedent_docstring(docstring): """This removes initial spaces from the lines of the docstring. After the first line of the docstring, all other lines will include some spaces. This removes them. Examples -------- >>> from _pyodide.docstring import dedent_docstri...
from inspect import _empty, signature sig = signature(func) # remove param and return annotations and for param in sig.parameters.values(): param._annotation = _empty # type: ignore[attr-defined] sig._return_annotation = _empty # type: ignore[attr-defined] docstring = dedent_docstrin...
"""Get the value to use for the PyMethodDef.ml_doc attribute for a builtin function. This is used in docstring.c. The ml_doc should start with a signature which cannot have any type annotations. The signature must end with the exact characters ")\n--\n\n". For example: "funcname(arg1, arg2)\n--\n\n...
49
434
139
573
from textwrap import dedent def dedent_docstring(docstring): """This removes initial spaces from the lines of the docstring. After the first line of the docstring, all other lines will include some spaces. This removes them. Examples -------- >>> from _pyodide.docstring import dedent_docstri...
from textwrap import dedent def dedent_docstring(docstring): """This removes initial spaces from the lines of the docstring. After the first line of the docstring, all other lines will include some spaces. This removes them. Examples -------- >>> from _pyodide.docstring import dedent_docstri...
23,209
/home/hieuvd/dung_repo/raw/stars_01/pyodide_pyodide/pyodide
/home/hieuvd/dung_repo/raw/stars_01/pyodide_pyodide/pyodide/src/py/pyodide/_state.py
30,31
1,52
restore_state
33,51
31,51
import gc import sys from typing import Any import __main__ from _pyodide._importhook import jsfinder from .ffi import JsProxy def save_state() -> dict[str, Any]: """Record the current global state. This includes which JavaScript packages are loaded and the global scope in ``__main__.__dict__``. Many l...
import gc import sys from typing import Any import __main__ from _pyodide._importhook import jsfinder from .ffi import JsProxy def save_state() -> dict[str, Any]: """Record the current global state. This includes which JavaScript packages are loaded and the global scope in ``__main__.__dict__``. Many l...
__main__.__dict__.clear() __main__.__dict__.update(state["globals"]) jsfinder.jsproxies = state["js_modules"] loaded_js_modules = state["loaded_js_modules"] for [key, value] in list(sys.modules.items()): if isinstance(value, JsProxy) and key not in loaded_js_modules: del sys.mod...
"""Restore the global state to a snapshot. The argument ``state`` should come from ``save_state``""" __main__.__dict__.clear() __main__.__dict__.update(state["globals"]) jsfinder.jsproxies = state["js_modules"] loaded_js_modules = state["loaded_js_modules"] for [key, value] in list(sys.modu...
40
299
204
503
import gc import sys from typing import Any import __main__ from _pyodide._importhook import jsfinder from .ffi import JsProxy def save_state() -> dict[str, Any]: """Record the current global state. This includes which JavaScript packages are loaded and the global scope in ``__main__.__dict__``. Many l...
import gc import sys from typing import Any import __main__ from _pyodide._importhook import jsfinder from .ffi import JsProxy def save_state() -> dict[str, Any]: """Record the current global state. This includes which JavaScript packages are loaded and the global scope in ``__main__.__dict__``. Many l...
23,210
/home/hieuvd/dung_repo/raw/stars_01/pyodide_pyodide/pyodide
/home/hieuvd/dung_repo/raw/stars_01/pyodide_pyodide/pyodide/tools/check_ccache.py
6,7
1,25
main
7,23
7,23
import re import subprocess import sys def main(): FILL_FUNC_BODYif __name__ == "__main__": sys.exit(main())
import re import subprocess import sys def main(): FILL_FUNC_BODYif __name__ == "__main__": sys.exit(main())
result = subprocess.run(["emcc", "--version"], capture_output=True, encoding="utf8") if result.returncode == 0: return 0 if re.search("GLIBC.*not found.*ccache", result.stderr): print( "Emscripten ccache was linked against an incompatible version of glibc.\n" "Run `ma...
result = subprocess.run(["emcc", "--version"], capture_output=True, encoding="utf8") if result.returncode == 0: return 0 if re.search("GLIBC.*not found.*ccache", result.stderr): print( "Emscripten ccache was linked against an incompatible version of glibc.\n" "Run `ma...
61
45
186
231
import re import subprocess import sys def main(): FILL_FUNC_BODYif __name__ == "__main__": sys.exit(main())
import re import subprocess import sys def main(): FILL_FUNC_BODYif __name__ == "__main__": sys.exit(main())
23,211
/home/hieuvd/dung_repo/raw/stars_01/pyodide_pyodide/pyodide
/home/hieuvd/dung_repo/raw/stars_01/pyodide_pyodide/pyodide/tools/check_compressed_size.py
22,23
1,58
check_size
23,47
23,47
#!/usr/bin/env python3 # A short script to check the size of files when compressed. # Usage: # check_compressed_size.py pyodide.asm.js pyodide.asm.wasm import gzip import sys from pathlib import Path try: import brotli except ImportError: print("WARNING: Brotli not installed") brotli = None def kb(si...
#!/usr/bin/env python3 # A short script to check the size of files when compressed. # Usage: # check_compressed_size.py pyodide.asm.js pyodide.asm.wasm import gzip import sys from pathlib import Path try: import brotli except ImportError: print("WARNING: Brotli not installed") brotli = None def kb(si...
file = Path(file) if not file.is_file(): print(f"ERROR: {file} is not a file") return print(f"- {file.name}:") print(f" Original size: {kb(file.stat().st_size)} KB") data = file.read_bytes() compressed_data_1 = gzip.compress(data, compresslevel=1) compressed_data_6 = g...
file = Path(file) if not file.is_file(): print(f"ERROR: {file} is not a file") return print(f"- {file.name}:") print(f" Original size: {kb(file.stat().st_size)} KB") data = file.read_bytes() compressed_data_1 = gzip.compress(data, compresslevel=1) compressed_data_6 = g...
70
231
326
557
#!/usr/bin/env python3 # A short script to check the size of files when compressed. # Usage: # check_compressed_size.py pyodide.asm.js pyodide.asm.wasm import gzip import sys from pathlib import Path try: import brotli except ImportError: print("WARNING: Brotli not installed") brotli = None def kb(si...
#!/usr/bin/env python3 # A short script to check the size of files when compressed. # Usage: # check_compressed_size.py pyodide.asm.js pyodide.asm.wasm import gzip import sys from pathlib import Path try: import brotli except ImportError: print("WARNING: Brotli not installed") brotli = None def kb(si...
23,212
/home/hieuvd/dung_repo/raw/stars_01/pyodide_pyodide/pyodide
/home/hieuvd/dung_repo/raw/stars_01/pyodide_pyodide/pyodide/tools/check_editable_pyodide_build.py
6,7
1,20
main
7,18
7,18
#!/usr/bin/env python3 import sys from pathlib import Path def main(): FILL_FUNC_BODYif __name__ == "__main__": main()
#!/usr/bin/env python3 import sys from pathlib import Path def main(): FILL_FUNC_BODYif __name__ == "__main__": main()
try: import pyodide_build except ImportError: sys.exit(1) install_path = Path(pyodide_build.__path__[0]) editable_install_path = Path(__file__).parents[1] / "pyodide-build/pyodide_build" sys.exit(install_path != editable_install_path)
try: import pyodide_build except ImportError: sys.exit(1) install_path = Path(pyodide_build.__path__[0]) editable_install_path = Path(__file__).parents[1] / "pyodide-build/pyodide_build" sys.exit(install_path != editable_install_path)
17
49
110
159
#!/usr/bin/env python3 import sys from pathlib import Path def main(): FILL_FUNC_BODYif __name__ == "__main__": main()
#!/usr/bin/env python3 import sys from pathlib import Path def main(): FILL_FUNC_BODYif __name__ == "__main__": main()
23,213
/home/hieuvd/dung_repo/raw/stars_01/pyodide_pyodide/pyodide
/home/hieuvd/dung_repo/raw/stars_01/pyodide_pyodide/pyodide/tools/docker_image_tag.py
20,21
1,39
latest_version_of_firefox
21,25
21,25
#!/usr/bin/env python3 """ Get the current versions of Chrome and Firefox to aid in tagging Docker images. Old Docker image tag: 20230411-chromelatest-firefoxlatest New Docker image tag: 20230411-chrome112-firefox112-py311 """ from datetime import date from sys import version_info import requests def latest_versio...
#!/usr/bin/env python3 """ Get the current versions of Chrome and Firefox to aid in tagging Docker images. Old Docker image tag: 20230411-chromelatest-firefoxlatest New Docker image tag: 20230411-chrome112-firefox112-py311 """ from datetime import date from sys import version_info import requests def latest_versio...
URL = "https://www.mozilla.org/en-US/firefox/releasenotes" return requests.get(URL, allow_redirects=True).url.split("/")[-3].split(".")[0]
URL = "https://www.mozilla.org/en-US/firefox/releasenotes" return requests.get(URL, allow_redirects=True).url.split("/")[-3].split(".")[0]
6
366
63
429
#!/usr/bin/env python3 """ Get the current versions of Chrome and Firefox to aid in tagging Docker images. Old Docker image tag: 20230411-chromelatest-firefoxlatest New Docker image tag: 20230411-chrome112-firefox112-py311 """ from datetime import date from sys import version_info import requests def latest_versio...
#!/usr/bin/env python3 """ Get the current versions of Chrome and Firefox to aid in tagging Docker images. Old Docker image tag: 20230411-chromelatest-firefoxlatest New Docker image tag: 20230411-chrome112-firefox112-py311 """ from datetime import date from sys import version_info import requests def latest_versio...
23,214
/home/hieuvd/dung_repo/raw/stars_01/pyodide_pyodide/pyodide
/home/hieuvd/dung_repo/raw/stars_01/pyodide_pyodide/pyodide/tools/fixup-type-definitions.py
14,15
1,46
main
15,42
15,42
""" This file ensures that only types are exported from the .d.ts files, not as values. dts-bundle-generator seems to mess this up: things that were only exported as types from `ffi.d.ts` get exported as values here. It also adds deprecation notices to the type exports from pyodide.d.ts that would otherwise be missing...
""" This file ensures that only types are exported from the .d.ts files, not as values. dts-bundle-generator seems to mess this up: things that were only exported as types from `ffi.d.ts` get exported as values here. It also adds deprecation notices to the type exports from pyodide.d.ts that would otherwise be missing...
exported_things = set() path = Path(filename) text = path.read_text() exported_things.update( x.group(1) for x in re.finditer("export interface ([A-Za-z]*)", text) ) exported_things.update( x.group(1) for x in re.finditer("export declare class ([A-Za-z]*)", text) ) if pa...
exported_things = set() path = Path(filename) text = path.read_text() exported_things.update( x.group(1) for x in re.finditer("export interface ([A-Za-z]*)", text) ) exported_things.update( x.group(1) for x in re.finditer("export declare class ([A-Za-z]*)", text) ) if pa...
118
153
429
582
""" This file ensures that only types are exported from the .d.ts files, not as values. dts-bundle-generator seems to mess this up: things that were only exported as types from `ffi.d.ts` get exported as values here. It also adds deprecation notices to the type exports from pyodide.d.ts that would otherwise be missing...
""" This file ensures that only types are exported from the .d.ts files, not as values. dts-bundle-generator seems to mess this up: things that were only exported as types from `ffi.d.ts` get exported as values here. It also adds deprecation notices to the type exports from pyodide.d.ts that would otherwise be missing...
23,215
/home/hieuvd/dung_repo/raw/stars_01/pyodide_pyodide/pyodide
/home/hieuvd/dung_repo/raw/stars_01/pyodide_pyodide/pyodide/tools/pytest_wrapper.py
18,19
1,52
cache_dir
20,27
19,27
#!/usr/bin/env python3 import os import subprocess import sys args = sys.argv[1:] def remove_num_threads_option(args: list[str]) -> None: """Remove -n <n> from argument list""" for i in range(0, len(args)): if args[i] == "-n": del args[i : i + 2] break def cache_dir(args: l...
#!/usr/bin/env python3 import os import subprocess import sys args = sys.argv[1:] def remove_num_threads_option(args: list[str]) -> None: """Remove -n <n> from argument list""" for i in range(0, len(args)): if args[i] == "-n": del args[i : i + 2] break def cache_dir(args: l...
for i in range(0, len(args)): if args[i] == "-o" and args[i + 1].startswith("cache_dir"): return args[i + 1].split("=")[1] break return ".pytest_cache"
"""Find the name of the cache-dir in the argument list""" for i in range(0, len(args)): if args[i] == "-o" and args[i + 1].startswith("cache_dir"): return args[i + 1].split("=")[1] break return ".pytest_cache"
20
432
78
510
#!/usr/bin/env python3 import os import subprocess import sys args = sys.argv[1:] def remove_num_threads_option(args: list[str]) -> None: """Remove -n <n> from argument list""" for i in range(0, len(args)): if args[i] == "-n": del args[i : i + 2] break def cache_dir(args: l...
#!/usr/bin/env python3 import os import subprocess import sys args = sys.argv[1:] def remove_num_threads_option(args: list[str]) -> None: """Remove -n <n> from argument list""" for i in range(0, len(args)): if args[i] == "-n": del args[i : i + 2] break def cache_dir(args: l...
23,217
/home/hieuvd/dung_repo/raw/stars_01/python-telegram-bot_python-telegram-bot/python-telegram-bot
/home/hieuvd/dung_repo/raw/stars_01/python-telegram-bot_python-telegram-bot/python-telegram-bot/docs/auxil/kwargs_insertion.py
88,89
1,110
find_insert_pos_for_kwargs
90,96
89,96
# # A library that provides a Python interface to the Telegram Bot API # Copyright (C) 2015-2024 # Leandro Toledo de Souza <devs@python-telegram-bot.org> # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Lesser Public License as published by # the Free Softwa...
# # A library that provides a Python interface to the Telegram Bot API # Copyright (C) 2015-2024 # Leandro Toledo de Souza <devs@python-telegram-bot.org> # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Lesser Public License as published by # the Free Softwa...
for idx, value in reversed(list(enumerate(lines))): # reversed since :returns: is at the end if value.startswith("Returns"): return idx return False
"""Finds the correct position to insert the keyword arguments and returns the index.""" for idx, value in reversed(list(enumerate(lines))): # reversed since :returns: is at the end if value.startswith("Returns"): return idx return False
19
1,247
57
1,304
# # A library that provides a Python interface to the Telegram Bot API # Copyright (C) 2015-2024 # Leandro Toledo de Souza <devs@python-telegram-bot.org> # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Lesser Public License as published by # the Free Softwa...
# # A library that provides a Python interface to the Telegram Bot API # Copyright (C) 2015-2024 # Leandro Toledo de Souza <devs@python-telegram-bot.org> # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Lesser Public License as published by # the Free Softwa...
23,218
/home/hieuvd/dung_repo/raw/stars_01/python-telegram-bot_python-telegram-bot/python-telegram-bot
/home/hieuvd/dung_repo/raw/stars_01/python-telegram-bot_python-telegram-bot/python-telegram-bot/examples/arbitrarycallbackdatabot.py
37,38
1,120
start
39,43
38,43
#!/usr/bin/env python # pylint: disable=unused-argument # This program is dedicated to the public domain under the CC0 license. """This example showcases how PTBs "arbitrary callback data" feature can be used. For detailed info on arbitrary callback data, see the wiki page at https://github.com/python-telegram-bot/py...
#!/usr/bin/env python # pylint: disable=unused-argument # This program is dedicated to the public domain under the CC0 license. """This example showcases how PTBs "arbitrary callback data" feature can be used. For detailed info on arbitrary callback data, see the wiki page at https://github.com/python-telegram-bot/py...
number_list: List[int] = [] await update.message.reply_text("Please choose:", reply_markup=build_keyboard(number_list))
"""Sends a message with 5 inline buttons attached.""" number_list: List[int] = [] await update.message.reply_text("Please choose:", reply_markup=build_keyboard(number_list))
8
1,239
48
1,287
#!/usr/bin/env python # pylint: disable=unused-argument # This program is dedicated to the public domain under the CC0 license. """This example showcases how PTBs "arbitrary callback data" feature can be used. For detailed info on arbitrary callback data, see the wiki page at https://github.com/python-telegram-bot/py...
#!/usr/bin/env python # pylint: disable=unused-argument # This program is dedicated to the public domain under the CC0 license. """This example showcases how PTBs "arbitrary callback data" feature can be used. For detailed info on arbitrary callback data, see the wiki page at https://github.com/python-telegram-bot/py...
23,220
/home/hieuvd/dung_repo/raw/stars_01/python-telegram-bot_python-telegram-bot/python-telegram-bot
/home/hieuvd/dung_repo/raw/stars_01/python-telegram-bot_python-telegram-bot/python-telegram-bot/examples/contexttypesbot.py
102,103
1,144
count_click
104,115
103,115
#!/usr/bin/env python # pylint: disable=unused-argument # This program is dedicated to the public domain under the CC0 license. """ Simple Bot to showcase `telegram.ext.ContextTypes`. Usage: Press Ctrl-C on the command line or send a signal to the process to stop the bot. """ import logging from collections import d...
#!/usr/bin/env python # pylint: disable=unused-argument # This program is dedicated to the public domain under the CC0 license. """ Simple Bot to showcase `telegram.ext.ContextTypes`. Usage: Press Ctrl-C on the command line or send a signal to the process to stop the bot. """ import logging from collections import d...
context.message_clicks += 1 await update.callback_query.answer() await update.effective_message.edit_text( f"This button was clicked <i>{context.message_clicks}</i> times.", reply_markup=InlineKeyboardMarkup.from_button( InlineKeyboardButton(text="Click me!", callback_data="butto...
"""Update the click count for the message.""" context.message_clicks += 1 await update.callback_query.answer() await update.effective_message.edit_text( f"This button was clicked <i>{context.message_clicks}</i> times.", reply_markup=InlineKeyboardMarkup.from_button( InlineKey...
20
1,316
129
1,445
#!/usr/bin/env python # pylint: disable=unused-argument # This program is dedicated to the public domain under the CC0 license. """ Simple Bot to showcase `telegram.ext.ContextTypes`. Usage: Press Ctrl-C on the command line or send a signal to the process to stop the bot. """ import logging from collections import d...
#!/usr/bin/env python # pylint: disable=unused-argument # This program is dedicated to the public domain under the CC0 license. """ Simple Bot to showcase `telegram.ext.ContextTypes`. Usage: Press Ctrl-C on the command line or send a signal to the process to stop the bot. """ import logging from collections import d...
23,221
/home/hieuvd/dung_repo/raw/stars_01/python-telegram-bot_python-telegram-bot/python-telegram-bot
/home/hieuvd/dung_repo/raw/stars_01/python-telegram-bot_python-telegram-bot/python-telegram-bot/examples/contexttypesbot.py
78,80
47,92
from_update
CustomContext
81,92
80,92
class CustomContext(CallbackContext[ExtBot, dict, ChatData, dict]): """Custom class for context.""" def __init__( self, application: Application, chat_id: Optional[int] = None, user_id: Optional[int] = None, ): super().__init__(application=application, chat_id=chat_i...
class CustomContext(CallbackContext[ExtBot, dict, ChatData, dict]): """Custom class for context.""" def __init__( self, application: Application, chat_id: Optional[int] = None, user_id: Optional[int] = None, ): super().__init__(application=application, chat_id=chat_i...
# Make sure to call super() context = super().from_update(update, application) if context.chat_data and isinstance(update, Update) and update.effective_message: # pylint: disable=protected-access context._message_id = update.effective_message.message_id # Rememb...
"""Override from_update to set _message_id.""" # Make sure to call super() context = super().from_update(update, application) if context.chat_data and isinstance(update, Update) and update.effective_message: # pylint: disable=protected-access context._message_id ...
31
388
102
490
#!/usr/bin/env python # pylint: disable=unused-argument # This program is dedicated to the public domain under the CC0 license. """ Simple Bot to showcase `telegram.ext.ContextTypes`. Usage: Press Ctrl-C on the command line or send a signal to the process to stop the bot. """ import logging from collections import d...
#!/usr/bin/env python # pylint: disable=unused-argument # This program is dedicated to the public domain under the CC0 license. """ Simple Bot to showcase `telegram.ext.ContextTypes`. Usage: Press Ctrl-C on the command line or send a signal to the process to stop the bot. """ import logging from collections import d...
23,222
/home/hieuvd/dung_repo/raw/stars_01/python-telegram-bot_python-telegram-bot/python-telegram-bot
/home/hieuvd/dung_repo/raw/stars_01/python-telegram-bot_python-telegram-bot/python-telegram-bot/examples/conversationbot.py
94,95
1,167
location
96,108
95,108
#!/usr/bin/env python # pylint: disable=unused-argument # This program is dedicated to the public domain under the CC0 license. """ First, a few callback functions are defined. Then, those functions are passed to the Application and registered at their respective places. Then, the bot is started and runs until we pres...
#!/usr/bin/env python # pylint: disable=unused-argument # This program is dedicated to the public domain under the CC0 license. """ First, a few callback functions are defined. Then, those functions are passed to the Application and registered at their respective places. Then, the bot is started and runs until we pres...
user = update.message.from_user user_location = update.message.location logger.info( "Location of %s: %f / %f", user.first_name, user_location.latitude, user_location.longitude ) await update.message.reply_text( "Maybe I can visit you sometime! At last, tell me something about yourse...
"""Stores the location and asks for some info about the user.""" user = update.message.from_user user_location = update.message.location logger.info( "Location of %s: %f / %f", user.first_name, user_location.latitude, user_location.longitude ) await update.message.reply_text( "Ma...
35
1,615
119
1,734
#!/usr/bin/env python # pylint: disable=unused-argument # This program is dedicated to the public domain under the CC0 license. """ First, a few callback functions are defined. Then, those functions are passed to the Application and registered at their respective places. Then, the bot is started and runs until we pres...
#!/usr/bin/env python # pylint: disable=unused-argument # This program is dedicated to the public domain under the CC0 license. """ First, a few callback functions are defined. Then, those functions are passed to the Application and registered at their respective places. Then, the bot is started and runs until we pres...
23,223
/home/hieuvd/dung_repo/raw/stars_01/python-telegram-bot_python-telegram-bot/python-telegram-bot
/home/hieuvd/dung_repo/raw/stars_01/python-telegram-bot_python-telegram-bot/python-telegram-bot/examples/conversationbot2.py
117,118
1,155
main
119,153
118,153
#!/usr/bin/env python # pylint: disable=unused-argument # This program is dedicated to the public domain under the CC0 license. """ First, a few callback functions are defined. Then, those functions are passed to the Application and registered at their respective places. Then, the bot is started and runs until we pres...
#!/usr/bin/env python # pylint: disable=unused-argument # This program is dedicated to the public domain under the CC0 license. """ First, a few callback functions are defined. Then, those functions are passed to the Application and registered at their respective places. Then, the bot is started and runs until we pres...
# Create the Application and pass it your bot's token. application = Application.builder().token("TOKEN").build() # Add conversation handler with the states CHOOSING, TYPING_CHOICE and TYPING_REPLY conv_handler = ConversationHandler( entry_points=[CommandHandler("start", start)], states...
"""Run the bot.""" # Create the Application and pass it your bot's token. application = Application.builder().token("TOKEN").build() # Add conversation handler with the states CHOOSING, TYPING_CHOICE and TYPING_REPLY conv_handler = ConversationHandler( entry_points=[CommandHandler("start", ...
80
1,145
376
1,521
#!/usr/bin/env python # pylint: disable=unused-argument # This program is dedicated to the public domain under the CC0 license. """ First, a few callback functions are defined. Then, those functions are passed to the Application and registered at their respective places. Then, the bot is started and runs until we pres...
#!/usr/bin/env python # pylint: disable=unused-argument # This program is dedicated to the public domain under the CC0 license. """ First, a few callback functions are defined. Then, those functions are passed to the Application and registered at their respective places. Then, the bot is started and runs until we pres...
23,224
/home/hieuvd/dung_repo/raw/stars_01/python-telegram-bot_python-telegram-bot/python-telegram-bot
/home/hieuvd/dung_repo/raw/stars_01/python-telegram-bot_python-telegram-bot/python-telegram-bot/examples/customwebhookbot/djangobot.py
157,158
1,180
main
159,178
158,178
#!/usr/bin/env python # This program is dedicated to the public domain under the CC0 license. # pylint: disable=import-error,unused-argument """ Simple example of a bot that uses a custom webhook setup and handles custom updates. For the custom webhook setup, the libraries `Django` and `uvicorn` are used. Please instal...
#!/usr/bin/env python # This program is dedicated to the public domain under the CC0 license. # pylint: disable=import-error,unused-argument """ Simple example of a bot that uses a custom webhook setup and handles custom updates. For the custom webhook setup, the libraries `Django` and `uvicorn` are used. Please instal...
webserver = uvicorn.Server( config=uvicorn.Config( app=get_asgi_application(), port=PORT, use_colors=False, host="127.0.0.1", ) ) # Pass webhook settings to telegram await ptb_application.bot.set_webhook(url=f"{URL}/telegram", allowed_upda...
"""Finalize configuration and run the applications.""" webserver = uvicorn.Server( config=uvicorn.Config( app=get_asgi_application(), port=PORT, use_colors=False, host="127.0.0.1", ) ) # Pass webhook settings to telegram await ptb_appl...
34
1,688
185
1,873
#!/usr/bin/env python # This program is dedicated to the public domain under the CC0 license. # pylint: disable=import-error,unused-argument """ Simple example of a bot that uses a custom webhook setup and handles custom updates. For the custom webhook setup, the libraries `Django` and `uvicorn` are used. Please instal...
#!/usr/bin/env python # This program is dedicated to the public domain under the CC0 license. # pylint: disable=import-error,unused-argument """ Simple example of a bot that uses a custom webhook setup and handles custom updates. For the custom webhook setup, the libraries `Django` and `uvicorn` are used. Please instal...
23,225
/home/hieuvd/dung_repo/raw/stars_01/python-telegram-bot_python-telegram-bot/python-telegram-bot
/home/hieuvd/dung_repo/raw/stars_01/python-telegram-bot_python-telegram-bot/python-telegram-bot/examples/customwebhookbot/djangobot.py
70,76
64,81
from_update
CustomContext
76,81
76,81
class CustomContext(CallbackContext[ExtBot, dict, dict, dict]): """ Custom CallbackContext class that makes `user_data` available for updates of type `WebhookUpdate`. """ @classmethod def from_update( cls, update: object, application: "Application", ) -> "CustomConte...
class CustomContext(CallbackContext[ExtBot, dict, dict, dict]): """ Custom CallbackContext class that makes `user_data` available for updates of type `WebhookUpdate`. """ @classmethod def from_update( cls, update: object, application: "Application", ) -> "CustomConte...
if isinstance(update, WebhookUpdate): return cls(application=application, user_id=update.user_id) return super().from_update(update, application)
if isinstance(update, WebhookUpdate): return cls(application=application, user_id=update.user_id) return super().from_update(update, application)
9
101
52
153
#!/usr/bin/env python # This program is dedicated to the public domain under the CC0 license. # pylint: disable=import-error,unused-argument """ Simple example of a bot that uses a custom webhook setup and handles custom updates. For the custom webhook setup, the libraries `Django` and `uvicorn` are used. Please instal...
#!/usr/bin/env python # This program is dedicated to the public domain under the CC0 license. # pylint: disable=import-error,unused-argument """ Simple example of a bot that uses a custom webhook setup and handles custom updates. For the custom webhook setup, the libraries `Django` and `uvicorn` are used. Please instal...
23,226
/home/hieuvd/dung_repo/raw/stars_01/python-telegram-bot_python-telegram-bot/python-telegram-bot
/home/hieuvd/dung_repo/raw/stars_01/python-telegram-bot_python-telegram-bot/python-telegram-bot/examples/customwebhookbot/flaskbot.py
101,102
1,171
main
103,169
102,169
#!/usr/bin/env python # This program is dedicated to the public domain under the CC0 license. # pylint: disable=import-error,unused-argument """ Simple example of a bot that uses a custom webhook setup and handles custom updates. For the custom webhook setup, the libraries `flask`, `asgiref` and `uvicorn` are used. Ple...
#!/usr/bin/env python # This program is dedicated to the public domain under the CC0 license. # pylint: disable=import-error,unused-argument """ Simple example of a bot that uses a custom webhook setup and handles custom updates. For the custom webhook setup, the libraries `flask`, `asgiref` and `uvicorn` are used. Ple...
context_types = ContextTypes(context=CustomContext) # Here we set updater to None because we want our custom webhook server to handle the updates # and hence we don't need an Updater instance application = ( Application.builder().token(TOKEN).updater(None).context_types(context_types).build() ...
"""Set up PTB application and a web application for handling the incoming requests.""" context_types = ContextTypes(context=CustomContext) # Here we set updater to None because we want our custom webhook server to handle the updates # and hence we don't need an Updater instance application = ( ...
208
1,133
788
1,921
#!/usr/bin/env python # This program is dedicated to the public domain under the CC0 license. # pylint: disable=import-error,unused-argument """ Simple example of a bot that uses a custom webhook setup and handles custom updates. For the custom webhook setup, the libraries `flask`, `asgiref` and `uvicorn` are used. Ple...
#!/usr/bin/env python # This program is dedicated to the public domain under the CC0 license. # pylint: disable=import-error,unused-argument """ Simple example of a bot that uses a custom webhook setup and handles custom updates. For the custom webhook setup, the libraries `flask`, `asgiref` and `uvicorn` are used. Ple...
23,227
/home/hieuvd/dung_repo/raw/stars_01/python-telegram-bot_python-telegram-bot/python-telegram-bot
/home/hieuvd/dung_repo/raw/stars_01/python-telegram-bot_python-telegram-bot/python-telegram-bot/examples/customwebhookbot/flaskbot.py
67,73
61,78
from_update
CustomContext
73,78
73,78
class CustomContext(CallbackContext[ExtBot, dict, dict, dict]): """ Custom CallbackContext class that makes `user_data` available for updates of type `WebhookUpdate`. """ @classmethod def from_update( cls, update: object, application: "Application", ) -> "CustomConte...
class CustomContext(CallbackContext[ExtBot, dict, dict, dict]): """ Custom CallbackContext class that makes `user_data` available for updates of type `WebhookUpdate`. """ @classmethod def from_update( cls, update: object, application: "Application", ) -> "CustomConte...
if isinstance(update, WebhookUpdate): return cls(application=application, user_id=update.user_id) return super().from_update(update, application)
if isinstance(update, WebhookUpdate): return cls(application=application, user_id=update.user_id) return super().from_update(update, application)
9
101
52
153
#!/usr/bin/env python # This program is dedicated to the public domain under the CC0 license. # pylint: disable=import-error,unused-argument """ Simple example of a bot that uses a custom webhook setup and handles custom updates. For the custom webhook setup, the libraries `flask`, `asgiref` and `uvicorn` are used. Ple...
#!/usr/bin/env python # This program is dedicated to the public domain under the CC0 license. # pylint: disable=import-error,unused-argument """ Simple example of a bot that uses a custom webhook setup and handles custom updates. For the custom webhook setup, the libraries `flask`, `asgiref` and `uvicorn` are used. Ple...
23,228
/home/hieuvd/dung_repo/raw/stars_01/python-telegram-bot_python-telegram-bot/python-telegram-bot
/home/hieuvd/dung_repo/raw/stars_01/python-telegram-bot_python-telegram-bot/python-telegram-bot/examples/deeplinking.py
84,85
1,149
deep_linked_level_3
86,94
85,94
#!/usr/bin/env python # pylint: disable=unused-argument # This program is dedicated to the public domain under the CC0 license. """Bot that explains Telegram's "Deep Linking Parameters" functionality. This program is dedicated to the public domain under the CC0 license. This Bot uses the Application class to handle ...
#!/usr/bin/env python # pylint: disable=unused-argument # This program is dedicated to the public domain under the CC0 license. """Bot that explains Telegram's "Deep Linking Parameters" functionality. This program is dedicated to the public domain under the CC0 license. This Bot uses the Application class to handle ...
await update.message.reply_text( "It is also possible to make deep-linking using InlineKeyboardButtons.", reply_markup=InlineKeyboardMarkup( [[InlineKeyboardButton(text="Like this!", callback_data=KEYBOARD_CALLBACKDATA)]] ), )
"""Reached through the USING_ENTITIES payload""" await update.message.reply_text( "It is also possible to make deep-linking using InlineKeyboardButtons.", reply_markup=InlineKeyboardMarkup( [[InlineKeyboardButton(text="Like this!", callback_data=KEYBOARD_CALLBACKDATA)]] ), ...
17
1,587
92
1,679
#!/usr/bin/env python # pylint: disable=unused-argument # This program is dedicated to the public domain under the CC0 license. """Bot that explains Telegram's "Deep Linking Parameters" functionality. This program is dedicated to the public domain under the CC0 license. This Bot uses the Application class to handle ...
#!/usr/bin/env python # pylint: disable=unused-argument # This program is dedicated to the public domain under the CC0 license. """Bot that explains Telegram's "Deep Linking Parameters" functionality. This program is dedicated to the public domain under the CC0 license. This Bot uses the Application class to handle ...
23,229
/home/hieuvd/dung_repo/raw/stars_01/python-telegram-bot_python-telegram-bot/python-telegram-bot
/home/hieuvd/dung_repo/raw/stars_01/python-telegram-bot_python-telegram-bot/python-telegram-bot/examples/echobot.py
54,55
1,72
main
56,70
55,70
#!/usr/bin/env python # pylint: disable=unused-argument # This program is dedicated to the public domain under the CC0 license. """ Simple Bot to reply to Telegram messages. First, a few handler functions are defined. Then, those functions are passed to the Application and registered at their respective places. Then,...
#!/usr/bin/env python # pylint: disable=unused-argument # This program is dedicated to the public domain under the CC0 license. """ Simple Bot to reply to Telegram messages. First, a few handler functions are defined. Then, those functions are passed to the Application and registered at their respective places. Then,...
# Create the Application and pass it your bot's token. application = Application.builder().token("TOKEN").build() # on different commands - answer in Telegram application.add_handler(CommandHandler("start", start)) application.add_handler(CommandHandler("help", help_command)) # on non command ...
"""Start the bot.""" # Create the Application and pass it your bot's token. application = Application.builder().token("TOKEN").build() # on different commands - answer in Telegram application.add_handler(CommandHandler("start", start)) application.add_handler(CommandHandler("help", help_command...
51
530
170
700
#!/usr/bin/env python # pylint: disable=unused-argument # This program is dedicated to the public domain under the CC0 license. """ Simple Bot to reply to Telegram messages. First, a few handler functions are defined. Then, those functions are passed to the Application and registered at their respective places. Then,...
#!/usr/bin/env python # pylint: disable=unused-argument # This program is dedicated to the public domain under the CC0 license. """ Simple Bot to reply to Telegram messages. First, a few handler functions are defined. Then, those functions are passed to the Application and registered at their respective places. Then,...
23,230
/home/hieuvd/dung_repo/raw/stars_01/python-telegram-bot_python-telegram-bot/python-telegram-bot
/home/hieuvd/dung_repo/raw/stars_01/python-telegram-bot_python-telegram-bot/python-telegram-bot/examples/errorhandlerbot.py
29,30
1,88
error_handler
31,57
30,57
#!/usr/bin/env python # pylint: disable=unused-argument # This program is dedicated to the public domain under the CC0 license. """This is a very simple example on how one could implement a custom error handler.""" import html import json import logging import traceback from telegram import Update from telegram.const...
#!/usr/bin/env python # pylint: disable=unused-argument # This program is dedicated to the public domain under the CC0 license. """This is a very simple example on how one could implement a custom error handler.""" import html import json import logging import traceback from telegram import Update from telegram.const...
# Log the error before we do anything else, so we can see it even if something breaks. logger.error("Exception while handling an update:", exc_info=context.error) # traceback.format_exception returns the usual python message about an exception, but as a # list of strings rather than a single string, so...
"""Log the error and send a telegram message to notify the developer.""" # Log the error before we do anything else, so we can see it even if something breaks. logger.error("Exception while handling an update:", exc_info=context.error) # traceback.format_exception returns the usual python message about...
136
627
438
1,065
#!/usr/bin/env python # pylint: disable=unused-argument # This program is dedicated to the public domain under the CC0 license. """This is a very simple example on how one could implement a custom error handler.""" import html import json import logging import traceback from telegram import Update from telegram.const...
#!/usr/bin/env python # pylint: disable=unused-argument # This program is dedicated to the public domain under the CC0 license. """This is a very simple example on how one could implement a custom error handler.""" import html import json import logging import traceback from telegram import Update from telegram.const...
23,231
/home/hieuvd/dung_repo/raw/stars_01/python-telegram-bot_python-telegram-bot/python-telegram-bot
/home/hieuvd/dung_repo/raw/stars_01/python-telegram-bot_python-telegram-bot/python-telegram-bot/examples/inlinebot.py
47,48
1,97
inline_query
49,79
48,79
#!/usr/bin/env python # pylint: disable=unused-argument # This program is dedicated to the public domain under the CC0 license. """ Don't forget to enable inline mode with @BotFather First, a few handler functions are defined. Then, those functions are passed to the Application and registered at their respective plac...
#!/usr/bin/env python # pylint: disable=unused-argument # This program is dedicated to the public domain under the CC0 license. """ Don't forget to enable inline mode with @BotFather First, a few handler functions are defined. Then, those functions are passed to the Application and registered at their respective plac...
query = update.inline_query.query if not query: # empty query should not be handled return results = [ InlineQueryResultArticle( id=str(uuid4()), title="Caps", input_message_content=InputTextMessageContent(query.upper()), ), InlineQueryR...
"""Handle the inline query. This is run when you type: @botusername <query>""" query = update.inline_query.query if not query: # empty query should not be handled return results = [ InlineQueryResultArticle( id=str(uuid4()), title="Caps", input_mess...
41
660
271
931
#!/usr/bin/env python # pylint: disable=unused-argument # This program is dedicated to the public domain under the CC0 license. """ Don't forget to enable inline mode with @BotFather First, a few handler functions are defined. Then, those functions are passed to the Application and registered at their respective plac...
#!/usr/bin/env python # pylint: disable=unused-argument # This program is dedicated to the public domain under the CC0 license. """ Don't forget to enable inline mode with @BotFather First, a few handler functions are defined. Then, those functions are passed to the Application and registered at their respective plac...
23,232
/home/hieuvd/dung_repo/raw/stars_01/python-telegram-bot_python-telegram-bot/python-telegram-bot
/home/hieuvd/dung_repo/raw/stars_01/python-telegram-bot_python-telegram-bot/python-telegram-bot/examples/inlinekeyboard.py
24,25
1,70
start
26,39
25,39
#!/usr/bin/env python # pylint: disable=unused-argument # This program is dedicated to the public domain under the CC0 license. """ Basic example for a bot that uses inline keyboards. For an in-depth explanation, check out https://github.com/python-telegram-bot/python-telegram-bot/wiki/InlineKeyboard-Example. """ imp...
#!/usr/bin/env python # pylint: disable=unused-argument # This program is dedicated to the public domain under the CC0 license. """ Basic example for a bot that uses inline keyboards. For an in-depth explanation, check out https://github.com/python-telegram-bot/python-telegram-bot/wiki/InlineKeyboard-Example. """ imp...
keyboard = [ [ InlineKeyboardButton("Option 1", callback_data="1"), InlineKeyboardButton("Option 2", callback_data="2"), ], [InlineKeyboardButton("Option 3", callback_data="3")], ] reply_markup = InlineKeyboardMarkup(keyboard) await update.message.reply_...
"""Sends a message with three inline buttons attached.""" keyboard = [ [ InlineKeyboardButton("Option 1", callback_data="1"), InlineKeyboardButton("Option 2", callback_data="2"), ], [InlineKeyboardButton("Option 3", callback_data="3")], ] reply_markup = I...
22
612
134
746
#!/usr/bin/env python # pylint: disable=unused-argument # This program is dedicated to the public domain under the CC0 license. """ Basic example for a bot that uses inline keyboards. For an in-depth explanation, check out https://github.com/python-telegram-bot/python-telegram-bot/wiki/InlineKeyboard-Example. """ imp...
#!/usr/bin/env python # pylint: disable=unused-argument # This program is dedicated to the public domain under the CC0 license. """ Basic example for a bot that uses inline keyboards. For an in-depth explanation, check out https://github.com/python-telegram-bot/python-telegram-bot/wiki/InlineKeyboard-Example. """ imp...
23,235
/home/hieuvd/dung_repo/raw/stars_01/python-telegram-bot_python-telegram-bot/python-telegram-bot
/home/hieuvd/dung_repo/raw/stars_01/python-telegram-bot_python-telegram-bot/python-telegram-bot/examples/passportbot.py
35,36
1,127
msg
37,110
36,110
#!/usr/bin/env python # pylint: disable=unused-argument # This program is dedicated to the public domain under the CC0 license. """ Simple Bot to print/download all incoming passport data See https://telegram.org/blog/passport for info about what telegram passport is. See https://github.com/python-telegram-bot/pytho...
#!/usr/bin/env python # pylint: disable=unused-argument # This program is dedicated to the public domain under the CC0 license. """ Simple Bot to print/download all incoming passport data See https://telegram.org/blog/passport for info about what telegram passport is. See https://github.com/python-telegram-bot/pytho...
# Retrieve passport data passport_data = update.message.passport_data # If our nonce doesn't match what we think, this Update did not originate from us # Ideally you would randomize the nonce on the server if passport_data.decrypted_credentials.nonce != "thisisatest": return # Print the...
"""Downloads and prints the received passport data.""" # Retrieve passport data passport_data = update.message.passport_data # If our nonce doesn't match what we think, this Update did not originate from us # Ideally you would randomize the nonce on the server if passport_data.decrypted_credenti...
208
497
833
1,330
#!/usr/bin/env python # pylint: disable=unused-argument # This program is dedicated to the public domain under the CC0 license. """ Simple Bot to print/download all incoming passport data See https://telegram.org/blog/passport for info about what telegram passport is. See https://github.com/python-telegram-bot/pytho...
#!/usr/bin/env python # pylint: disable=unused-argument # This program is dedicated to the public domain under the CC0 license. """ Simple Bot to print/download all incoming passport data See https://telegram.org/blog/passport for info about what telegram passport is. See https://github.com/python-telegram-bot/pytho...
23,236
/home/hieuvd/dung_repo/raw/stars_01/python-telegram-bot_python-telegram-bot/python-telegram-bot
/home/hieuvd/dung_repo/raw/stars_01/python-telegram-bot_python-telegram-bot/python-telegram-bot/examples/paymentbot.py
98,99
1,163
shipping_callback
100,116
99,116
#!/usr/bin/env python # pylint: disable=unused-argument # This program is dedicated to the public domain under the CC0 license. """Basic example for a bot that can receive payment from user.""" import logging from telegram import LabeledPrice, ShippingOption, Update from telegram.ext import ( Application, Co...
#!/usr/bin/env python # pylint: disable=unused-argument # This program is dedicated to the public domain under the CC0 license. """Basic example for a bot that can receive payment from user.""" import logging from telegram import LabeledPrice, ShippingOption, Update from telegram.ext import ( Application, Co...
query = update.shipping_query # check the payload, is this from your bot? if query.invoice_payload != "Custom-Payload": # answer False pre_checkout_query await query.answer(ok=False, error_message="Something went wrong...") return # First option has a single LabeledPrice opt...
"""Answers the ShippingQuery with ShippingOptions""" query = update.shipping_query # check the payload, is this from your bot? if query.invoice_payload != "Custom-Payload": # answer False pre_checkout_query await query.answer(ok=False, error_message="Something went wrong...") ret...
71
1,544
240
1,784
#!/usr/bin/env python # pylint: disable=unused-argument # This program is dedicated to the public domain under the CC0 license. """Basic example for a bot that can receive payment from user.""" import logging from telegram import LabeledPrice, ShippingOption, Update from telegram.ext import ( Application, Co...
#!/usr/bin/env python # pylint: disable=unused-argument # This program is dedicated to the public domain under the CC0 license. """Basic example for a bot that can receive payment from user.""" import logging from telegram import LabeledPrice, ShippingOption, Update from telegram.ext import ( Application, Co...
23,237
/home/hieuvd/dung_repo/raw/stars_01/python-telegram-bot_python-telegram-bot/python-telegram-bot
/home/hieuvd/dung_repo/raw/stars_01/python-telegram-bot_python-telegram-bot/python-telegram-bot/examples/persistentconversationbot.py
74,75
1,178
regular_choice
76,89
75,89
#!/usr/bin/env python # pylint: disable=unused-argument # This program is dedicated to the public domain under the CC0 license. """ First, a few callback functions are defined. Then, those functions are passed to the Application and registered at their respective places. Then, the bot is started and runs until we pres...
#!/usr/bin/env python # pylint: disable=unused-argument # This program is dedicated to the public domain under the CC0 license. """ First, a few callback functions are defined. Then, those functions are passed to the Application and registered at their respective places. Then, the bot is started and runs until we pres...
text = update.message.text.lower() context.user_data["choice"] = text if context.user_data.get(text): reply_text = ( f"Your {text}? I already know the following about that: {context.user_data[text]}" ) else: reply_text = f"Your {text}? Yes, I would love to hear about ...
"""Ask the user for info about the selected predefined choice.""" text = update.message.text.lower() context.user_data["choice"] = text if context.user_data.get(text): reply_text = ( f"Your {text}? I already know the following about that: {context.user_data[text]}" ) else...
39
1,652
145
1,797
#!/usr/bin/env python # pylint: disable=unused-argument # This program is dedicated to the public domain under the CC0 license. """ First, a few callback functions are defined. Then, those functions are passed to the Application and registered at their respective places. Then, the bot is started and runs until we pres...
#!/usr/bin/env python # pylint: disable=unused-argument # This program is dedicated to the public domain under the CC0 license. """ First, a few callback functions are defined. Then, those functions are passed to the Application and registered at their respective places. Then, the bot is started and runs until we pres...
23,238
/home/hieuvd/dung_repo/raw/stars_01/python-telegram-bot_python-telegram-bot/python-telegram-bot
/home/hieuvd/dung_repo/raw/stars_01/python-telegram-bot_python-telegram-bot/python-telegram-bot/examples/pollbot.py
44,45
1,177
start
46,52
45,52
#!/usr/bin/env python # pylint: disable=unused-argument # This program is dedicated to the public domain under the CC0 license. """ Basic example for a bot that works with polls. Only 3 people are allowed to interact with each poll/quiz the bot generates. The preview command generates a closed poll/quiz, exactly like ...
#!/usr/bin/env python # pylint: disable=unused-argument # This program is dedicated to the public domain under the CC0 license. """ Basic example for a bot that works with polls. Only 3 people are allowed to interact with each poll/quiz the bot generates. The preview command generates a closed poll/quiz, exactly like ...
await update.message.reply_text( "Please select /poll to get a Poll, /quiz to get a Quiz or /preview" " to generate a preview for your poll" )
"""Inform user about what this bot can do""" await update.message.reply_text( "Please select /poll to get a Poll, /quiz to get a Quiz or /preview" " to generate a preview for your poll" )
25
1,917
61
1,978
#!/usr/bin/env python # pylint: disable=unused-argument # This program is dedicated to the public domain under the CC0 license. """ Basic example for a bot that works with polls. Only 3 people are allowed to interact with each poll/quiz the bot generates. The preview command generates a closed poll/quiz, exactly like ...
#!/usr/bin/env python # pylint: disable=unused-argument # This program is dedicated to the public domain under the CC0 license. """ Basic example for a bot that works with polls. Only 3 people are allowed to interact with each poll/quiz the bot generates. The preview command generates a closed poll/quiz, exactly like ...
23,239
/home/hieuvd/dung_repo/raw/stars_01/python-telegram-bot_python-telegram-bot/python-telegram-bot
/home/hieuvd/dung_repo/raw/stars_01/python-telegram-bot_python-telegram-bot/python-telegram-bot/examples/timerbot.py
63,64
1,109
set_timer
65,85
64,85
#!/usr/bin/env python # pylint: disable=unused-argument # This program is dedicated to the public domain under the CC0 license. """ Simple Bot to send timed Telegram messages. This Bot uses the Application class to handle the bot and the JobQueue to send timed messages. First, a few handler functions are defined. Th...
#!/usr/bin/env python # pylint: disable=unused-argument # This program is dedicated to the public domain under the CC0 license. """ Simple Bot to send timed Telegram messages. This Bot uses the Application class to handle the bot and the JobQueue to send timed messages. First, a few handler functions are defined. Th...
chat_id = update.effective_message.chat_id try: # args[0] should contain the time for the timer in seconds due = float(context.args[0]) if due < 0: await update.effective_message.reply_text("Sorry we can not go back to future!") return job_removed = remov...
"""Add a job to the queue.""" chat_id = update.effective_message.chat_id try: # args[0] should contain the time for the timer in seconds due = float(context.args[0]) if due < 0: await update.effective_message.reply_text("Sorry we can not go back to future!") r...
64
900
241
1,141
#!/usr/bin/env python # pylint: disable=unused-argument # This program is dedicated to the public domain under the CC0 license. """ Simple Bot to send timed Telegram messages. This Bot uses the Application class to handle the bot and the JobQueue to send timed messages. First, a few handler functions are defined. Th...
#!/usr/bin/env python # pylint: disable=unused-argument # This program is dedicated to the public domain under the CC0 license. """ Simple Bot to send timed Telegram messages. This Bot uses the Application class to handle the bot and the JobQueue to send timed messages. First, a few handler functions are defined. Th...
23,240
/home/hieuvd/dung_repo/raw/stars_01/python-telegram-bot_python-telegram-bot/python-telegram-bot
/home/hieuvd/dung_repo/raw/stars_01/python-telegram-bot_python-telegram-bot/python-telegram-bot/examples/webappbot.py
56,57
1,70
main
58,68
57,68
#!/usr/bin/env python # pylint: disable=unused-argument # This program is dedicated to the public domain under the CC0 license. """ Simple example of a Telegram WebApp which displays a color picker. The static website for this website is hosted by the PTB team for your convenience. Currently only showcases starting th...
#!/usr/bin/env python # pylint: disable=unused-argument # This program is dedicated to the public domain under the CC0 license. """ Simple example of a Telegram WebApp which displays a color picker. The static website for this website is hosted by the PTB team for your convenience. Currently only showcases starting th...
# Create the Application and pass it your bot's token. application = Application.builder().token("TOKEN").build() application.add_handler(CommandHandler("start", start)) application.add_handler(MessageHandler(filters.StatusUpdate.WEB_APP_DATA, web_app_data)) # Run the bot until the user presses Ct...
"""Start the bot.""" # Create the Application and pass it your bot's token. application = Application.builder().token("TOKEN").build() application.add_handler(CommandHandler("start", start)) application.add_handler(MessageHandler(filters.StatusUpdate.WEB_APP_DATA, web_app_data)) # Run the bot ...
27
643
125
768
#!/usr/bin/env python # pylint: disable=unused-argument # This program is dedicated to the public domain under the CC0 license. """ Simple example of a Telegram WebApp which displays a color picker. The static website for this website is hosted by the PTB team for your convenience. Currently only showcases starting th...
#!/usr/bin/env python # pylint: disable=unused-argument # This program is dedicated to the public domain under the CC0 license. """ Simple example of a Telegram WebApp which displays a color picker. The static website for this website is hosted by the PTB team for your convenience. Currently only showcases starting th...
23,241
/home/hieuvd/dung_repo/raw/stars_01/python-telegram-bot_python-telegram-bot/python-telegram-bot
/home/hieuvd/dung_repo/raw/stars_01/python-telegram-bot_python-telegram-bot/python-telegram-bot/setup.py
62,63
1,132
get_setup_kwargs
64,120
63,120
#!/usr/bin/env python """The setup and build script for the python-telegram-bot library.""" import subprocess import sys from collections import defaultdict from pathlib import Path from typing import Any, Dict, List, Tuple from setuptools import find_packages, setup def get_requirements() -> List[str]: """Build...
#!/usr/bin/env python """The setup and build script for the python-telegram-bot library.""" import subprocess import sys from collections import defaultdict from pathlib import Path from typing import Any, Dict, List, Tuple from setuptools import find_packages, setup def get_requirements() -> List[str]: """Build...
packages, requirements = get_packages_requirements(raw=raw) raw_ext = "-raw" if raw else "" readme = Path(f'README{"_RAW" if raw else ""}.rst') version_file = Path("telegram/_version.py").read_text(encoding="utf-8") first_part = version_file.split("# SETUP.PY MARKER")[0] exec(first_part) # py...
"""Builds a dictionary of kwargs for the setup function""" packages, requirements = get_packages_requirements(raw=raw) raw_ext = "-raw" if raw else "" readme = Path(f'README{"_RAW" if raw else ""}.rst') version_file = Path("telegram/_version.py").read_text(encoding="utf-8") first_part = versio...
195
690
895
1,585
#!/usr/bin/env python """The setup and build script for the python-telegram-bot library.""" import subprocess import sys from collections import defaultdict from pathlib import Path from typing import Any, Dict, List, Tuple from setuptools import find_packages, setup def get_requirements() -> List[str]: """Build...
#!/usr/bin/env python """The setup and build script for the python-telegram-bot library.""" import subprocess import sys from collections import defaultdict from pathlib import Path from typing import Any, Dict, List, Tuple from setuptools import find_packages, setup def get_requirements() -> List[str]: """Build...
23,242
/home/hieuvd/dung_repo/raw/stars_01/python-telegram-bot_python-telegram-bot/python-telegram-bot
/home/hieuvd/dung_repo/raw/stars_01/python-telegram-bot_python-telegram-bot/python-telegram-bot/telegram/__main__.py
38,39
1,54
print_ver_info
40,47
39,47
# !/usr/bin/env python # # A library that provides a Python interface to the Telegram Bot API # Copyright (C) 2015-2024 # Leandro Toledo de Souza <devs@python-telegram-bot.org> # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Lesser Public License as published by ...
# !/usr/bin/env python # # A library that provides a Python interface to the Telegram Bot API # Copyright (C) 2015-2024 # Leandro Toledo de Souza <devs@python-telegram-bot.org> # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Lesser Public License as published by ...
git_revision = _git_revision() print(f"python-telegram-bot {telegram_ver}" + (f" ({git_revision})" if git_revision else "")) print(f"Bot API {BOT_API_VERSION}") sys_version = sys.version.replace("\n", " ") print(f"Python {sys_version}")
"""Prints version information for python-telegram-bot, the Bot API and Python.""" git_revision = _git_revision() print(f"python-telegram-bot {telegram_ver}" + (f" ({git_revision})" if git_revision else "")) print(f"Bot API {BOT_API_VERSION}") sys_version = sys.version.replace("\n", " ") print(f"...
22
480
106
586
# !/usr/bin/env python # # A library that provides a Python interface to the Telegram Bot API # Copyright (C) 2015-2024 # Leandro Toledo de Souza <devs@python-telegram-bot.org> # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Lesser Public License as published by ...
# !/usr/bin/env python # # A library that provides a Python interface to the Telegram Bot API # Copyright (C) 2015-2024 # Leandro Toledo de Souza <devs@python-telegram-bot.org> # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Lesser Public License as published by ...
23,243
/home/hieuvd/dung_repo/raw/stars_01/python-telegram-bot_python-telegram-bot/python-telegram-bot
/home/hieuvd/dung_repo/raw/stars_01/python-telegram-bot_python-telegram-bot/python-telegram-bot/telegram/_birthdate.py
73,74
27,89
to_date
Birthdate
83,89
74,89
class Birthdate(TelegramObject): """ This object represents a user's birthday. Objects of this class are comparable in terms of equality. Two objects of this class are considered equal, if their :attr:`day`, and :attr:`month` are equal. .. versionadded:: 21.1 Args: day (:obj:`int`): D...
class Birthdate(TelegramObject): """ This object represents a user's birthday. Objects of this class are comparable in terms of equality. Two objects of this class are considered equal, if their :attr:`day`, and :attr:`month` are equal. .. versionadded:: 21.1 Args: day (:obj:`int`): D...
if self.year is None and year is None: raise ValueError( "The `year` argument is required if the `year` attribute was not present." ) return datetime(year or self.year, self.month, self.day) # type: ignore[arg-type]
"""Return the birthdate as a datetime object. Args: year (:obj:`int`, optional): The year to use. Required, if the :attr:`year` was not present. Returns: :obj:`datetime.datetime`: The birthdate as a datetime object. """ if self.year is No...
32
514
78
592
#!/usr/bin/env python # # A library that provides a Python interface to the Telegram Bot API # Copyright (C) 2015-2024 # Leandro Toledo de Souza <devs@python-telegram-bot.org> # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Lesser Public License as published by #...
#!/usr/bin/env python # # A library that provides a Python interface to the Telegram Bot API # Copyright (C) 2015-2024 # Leandro Toledo de Souza <devs@python-telegram-bot.org> # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Lesser Public License as published by #...
23,244
/home/hieuvd/dung_repo/raw/stars_01/python-telegram-bot_python-telegram-bot/python-telegram-bot
/home/hieuvd/dung_repo/raw/stars_01/python-telegram-bot_python-telegram-bot/python-telegram-bot/telegram/_botcommandscope.py
86,88
32,119
de_json
BotCommandScope
99,119
88,119
class BotCommandScope(TelegramObject): """Base class for objects that represent the scope to which bot commands are applied. Currently, the following 7 scopes are supported: * :class:`telegram.BotCommandScopeDefault` * :class:`telegram.BotCommandScopeAllPrivateChats` * :class:`telegram.BotCommandSc...
class BotCommandScope(TelegramObject): """Base class for objects that represent the scope to which bot commands are applied. Currently, the following 7 scopes are supported: * :class:`telegram.BotCommandScopeDefault` * :class:`telegram.BotCommandScopeAllPrivateChats` * :class:`telegram.BotCommandSc...
data = cls._parse_data(data) if not data: return None _class_mapping: Dict[str, Type[BotCommandScope]] = { cls.DEFAULT: BotCommandScopeDefault, cls.ALL_PRIVATE_CHATS: BotCommandScopeAllPrivateChats, cls.ALL_GROUP_CHATS: BotCommandScopeAllGroupCha...
"""Converts JSON data to the appropriate :class:`BotCommandScope` object, i.e. takes care of selecting the correct subclass. Args: data (Dict[:obj:`str`, ...]): The JSON data. bot (:class:`telegram.Bot`): The bot associated with this object. Returns: ...
42
962
272
1,234
#!/usr/bin/env python # # A library that provides a Python interface to the Telegram Bot API # Copyright (C) 2015-2024 # Leandro Toledo de Souza <devs@python-telegram-bot.org> # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Lesser Public License as published by #...
#!/usr/bin/env python # # A library that provides a Python interface to the Telegram Bot API # Copyright (C) 2015-2024 # Leandro Toledo de Souza <devs@python-telegram-bot.org> # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Lesser Public License as published by #...
23,245
/home/hieuvd/dung_repo/raw/stars_01/python-telegram-bot_python-telegram-bot/python-telegram-bot
/home/hieuvd/dung_repo/raw/stars_01/python-telegram-bot_python-telegram-bot/python-telegram-bot/telegram/_business.py
108,110
38,125
de_json
BusinessConnection
111,125
110,125
class BusinessConnection(TelegramObject): """ Describes the connection of the bot with a business account. Objects of this class are comparable in terms of equality. Two objects of this class are considered equal if their :attr:`id`, :attr:`user`, :attr:`user_chat_id`, :attr:`date`, :attr:`can_repl...
class BusinessConnection(TelegramObject): """ Describes the connection of the bot with a business account. Objects of this class are comparable in terms of equality. Two objects of this class are considered equal if their :attr:`id`, :attr:`user`, :attr:`user_chat_id`, :attr:`date`, :attr:`can_repl...
data = cls._parse_data(data) if not data: return None # Get the local timezone from the bot if it has defaults loc_tzinfo = extract_tzinfo_from_defaults(bot) data["date"] = from_timestamp(data.get("date"), tzinfo=loc_tzinfo) data["user"] = User.de_json(data...
"""See :meth:`telegram.TelegramObject.de_json`.""" data = cls._parse_data(data) if not data: return None # Get the local timezone from the bot if it has defaults loc_tzinfo = extract_tzinfo_from_defaults(bot) data["date"] = from_timestamp(data.get("date"), ...
34
811
140
951
#!/usr/bin/env python # pylint: disable=redefined-builtin # # A library that provides a Python interface to the Telegram Bot API # Copyright (C) 2015-2024 # Leandro Toledo de Souza <devs@python-telegram-bot.org> # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Les...
#!/usr/bin/env python # pylint: disable=redefined-builtin # # A library that provides a Python interface to the Telegram Bot API # Copyright (C) 2015-2024 # Leandro Toledo de Souza <devs@python-telegram-bot.org> # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Les...
23,246
/home/hieuvd/dung_repo/raw/stars_01/python-telegram-bot_python-telegram-bot/python-telegram-bot
/home/hieuvd/dung_repo/raw/stars_01/python-telegram-bot_python-telegram-bot/python-telegram-bot/telegram/_business.py
234,236
190,247
de_json
BusinessIntro
237,247
236,247
class BusinessIntro(TelegramObject): """ This object represents the intro of a business account. Objects of this class are comparable in terms of equality. Two objects of this class are considered equal, if their :attr:`title`, :attr:`message` and :attr:`sticker` are equal. .. versionadded:: 2...
class BusinessIntro(TelegramObject): """ This object represents the intro of a business account. Objects of this class are comparable in terms of equality. Two objects of this class are considered equal, if their :attr:`title`, :attr:`message` and :attr:`sticker` are equal. .. versionadded:: 2...
data = cls._parse_data(data) if not data: return None data["sticker"] = Sticker.de_json(data.get("sticker"), bot) return super().de_json(data=data, bot=bot)
"""See :meth:`telegram.TelegramObject.de_json`.""" data = cls._parse_data(data) if not data: return None data["sticker"] = Sticker.de_json(data.get("sticker"), bot) return super().de_json(data=data, bot=bot)
15
487
79
566
#!/usr/bin/env python # pylint: disable=redefined-builtin # # A library that provides a Python interface to the Telegram Bot API # Copyright (C) 2015-2024 # Leandro Toledo de Souza <devs@python-telegram-bot.org> # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Les...
#!/usr/bin/env python # pylint: disable=redefined-builtin # # A library that provides a Python interface to the Telegram Bot API # Copyright (C) 2015-2024 # Leandro Toledo de Souza <devs@python-telegram-bot.org> # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Les...
23,247
/home/hieuvd/dung_repo/raw/stars_01/python-telegram-bot_python-telegram-bot/python-telegram-bot
/home/hieuvd/dung_repo/raw/stars_01/python-telegram-bot_python-telegram-bot/python-telegram-bot/telegram/_business.py
286,288
247,299
de_json
BusinessLocation
289,299
288,299
class BusinessLocation(TelegramObject): """ This object represents the location of a business account. Objects of this class are comparable in terms of equality. Two objects of this class are considered equal, if their :attr:`address` is equal. .. versionadded:: 21.1 Args: address...
class BusinessLocation(TelegramObject): """ This object represents the location of a business account. Objects of this class are comparable in terms of equality. Two objects of this class are considered equal, if their :attr:`address` is equal. .. versionadded:: 21.1 Args: address...
data = cls._parse_data(data) if not data: return None data["location"] = Location.de_json(data.get("location"), bot) return super().de_json(data=data, bot=bot)
"""See :meth:`telegram.TelegramObject.de_json`.""" data = cls._parse_data(data) if not data: return None data["location"] = Location.de_json(data.get("location"), bot) return super().de_json(data=data, bot=bot)
15
363
76
439
#!/usr/bin/env python # pylint: disable=redefined-builtin # # A library that provides a Python interface to the Telegram Bot API # Copyright (C) 2015-2024 # Leandro Toledo de Souza <devs@python-telegram-bot.org> # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Les...
#!/usr/bin/env python # pylint: disable=redefined-builtin # # A library that provides a Python interface to the Telegram Bot API # Copyright (C) 2015-2024 # Leandro Toledo de Souza <devs@python-telegram-bot.org> # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Les...
23,248
/home/hieuvd/dung_repo/raw/stars_01/python-telegram-bot_python-telegram-bot/python-telegram-bot
/home/hieuvd/dung_repo/raw/stars_01/python-telegram-bot_python-telegram-bot/python-telegram-bot/telegram/_business.py
177,179
125,190
de_json
BusinessMessagesDeleted
180,190
179,190
class BusinessMessagesDeleted(TelegramObject): """ This object is received when messages are deleted from a connected business account. Objects of this class are comparable in terms of equality. Two objects of this class are considered equal if their :attr:`business_connection_id`, :attr:`message_ids`,...
class BusinessMessagesDeleted(TelegramObject): """ This object is received when messages are deleted from a connected business account. Objects of this class are comparable in terms of equality. Two objects of this class are considered equal if their :attr:`business_connection_id`, :attr:`message_ids`,...
data = cls._parse_data(data) if not data: return None data["chat"] = Chat.de_json(data.get("chat"), bot) return super().de_json(data=data, bot=bot)
"""See :meth:`telegram.TelegramObject.de_json`.""" data = cls._parse_data(data) if not data: return None data["chat"] = Chat.de_json(data.get("chat"), bot) return super().de_json(data=data, bot=bot)
15
585
76
661
#!/usr/bin/env python # pylint: disable=redefined-builtin # # A library that provides a Python interface to the Telegram Bot API # Copyright (C) 2015-2024 # Leandro Toledo de Souza <devs@python-telegram-bot.org> # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Les...
#!/usr/bin/env python # pylint: disable=redefined-builtin # # A library that provides a Python interface to the Telegram Bot API # Copyright (C) 2015-2024 # Leandro Toledo de Souza <devs@python-telegram-bot.org> # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Les...
23,249
/home/hieuvd/dung_repo/raw/stars_01/python-telegram-bot_python-telegram-bot/python-telegram-bot
/home/hieuvd/dung_repo/raw/stars_01/python-telegram-bot_python-telegram-bot/python-telegram-bot/telegram/_business.py
433,435
391,446
de_json
BusinessOpeningHours
436,446
435,446
class BusinessOpeningHours(TelegramObject): """ This object represents the opening hours of a business account. Objects of this class are comparable in terms of equality. Two objects of this class are considered equal, if their :attr:`time_zone_name` and :attr:`opening_hours` are equal. .. ver...
class BusinessOpeningHours(TelegramObject): """ This object represents the opening hours of a business account. Objects of this class are comparable in terms of equality. Two objects of this class are considered equal, if their :attr:`time_zone_name` and :attr:`opening_hours` are equal. .. ver...
data = cls._parse_data(data) if not data: return None data["opening_hours"] = BusinessOpeningHoursInterval.de_list( data.get("opening_hours"), bot ) return super().de_json(data=data, bot=bot)
"""See :meth:`telegram.TelegramObject.de_json`.""" data = cls._parse_data(data) if not data: return None data["opening_hours"] = BusinessOpeningHoursInterval.de_list( data.get("opening_hours"), bot ) return super().de_json(data=data, bot=bot)
17
491
89
580
#!/usr/bin/env python # pylint: disable=redefined-builtin # # A library that provides a Python interface to the Telegram Bot API # Copyright (C) 2015-2024 # Leandro Toledo de Souza <devs@python-telegram-bot.org> # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Les...
#!/usr/bin/env python # pylint: disable=redefined-builtin # # A library that provides a Python interface to the Telegram Bot API # Copyright (C) 2015-2024 # Leandro Toledo de Souza <devs@python-telegram-bot.org> # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Les...
23,250
/home/hieuvd/dung_repo/raw/stars_01/python-telegram-bot_python-telegram-bot/python-telegram-bot
/home/hieuvd/dung_repo/raw/stars_01/python-telegram-bot_python-telegram-bot/python-telegram-bot/telegram/_business.py
361,362
299,391
_parse_minute
BusinessOpeningHoursInterval
362,364
362,364
class BusinessOpeningHoursInterval(TelegramObject): """ This object represents the time intervals describing business opening hours. Objects of this class are comparable in terms of equality. Two objects of this class are considered equal, if their :attr:`opening_minute` and :attr:`closing_minute` ...
class BusinessOpeningHoursInterval(TelegramObject): """ This object represents the time intervals describing business opening hours. Objects of this class are comparable in terms of equality. Two objects of this class are considered equal, if their :attr:`opening_minute` and :attr:`closing_minute` ...
return (minute // 1440, minute % 1440 // 60, minute % 1440 % 60)
return (minute // 1440, minute % 1440 // 60, minute % 1440 % 60)
14
1,272
39
1,311
#!/usr/bin/env python # pylint: disable=redefined-builtin # # A library that provides a Python interface to the Telegram Bot API # Copyright (C) 2015-2024 # Leandro Toledo de Souza <devs@python-telegram-bot.org> # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Les...
#!/usr/bin/env python # pylint: disable=redefined-builtin # # A library that provides a Python interface to the Telegram Bot API # Copyright (C) 2015-2024 # Leandro Toledo de Souza <devs@python-telegram-bot.org> # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Les...
23,254
/home/hieuvd/dung_repo/raw/stars_01/python-telegram-bot_python-telegram-bot/python-telegram-bot
/home/hieuvd/dung_repo/raw/stars_01/python-telegram-bot_python-telegram-bot/python-telegram-bot/telegram/_chatboost.py
277,279
228,293
de_json
ChatBoost
280,293
279,293
class ChatBoost(TelegramObject): """ This object contains information about a chat boost. Objects of this class are comparable in terms of equality. Two objects of this class are considered equal, if their :attr:`boost_id`, :attr:`add_date`, :attr:`expiration_date`, and :attr:`source` are equal. ...
class ChatBoost(TelegramObject): """ This object contains information about a chat boost. Objects of this class are comparable in terms of equality. Two objects of this class are considered equal, if their :attr:`boost_id`, :attr:`add_date`, :attr:`expiration_date`, and :attr:`source` are equal. ...
data = cls._parse_data(data) if not data: return None data["source"] = ChatBoostSource.de_json(data.get("source"), bot) loc_tzinfo = extract_tzinfo_from_defaults(bot) data["add_date"] = from_timestamp(data["add_date"], tzinfo=loc_tzinfo) data["expiration_dat...
"""See :meth:`telegram.TelegramObject.de_json`.""" data = cls._parse_data(data) if not data: return None data["source"] = ChatBoostSource.de_json(data.get("source"), bot) loc_tzinfo = extract_tzinfo_from_defaults(bot) data["add_date"] = from_timestamp(data["...
26
634
158
792
#!/usr/bin/env python # # A library that provides a Python interface to the Telegram Bot API # Copyright (C) 2015-2024 # Leandro Toledo de Souza <devs@python-telegram-bot.org> # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Lesser Public License as published by #...
#!/usr/bin/env python # # A library that provides a Python interface to the Telegram Bot API # Copyright (C) 2015-2024 # Leandro Toledo de Souza <devs@python-telegram-bot.org> # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Lesser Public License as published by #...
23,255
/home/hieuvd/dung_repo/raw/stars_01/python-telegram-bot_python-telegram-bot/python-telegram-bot
/home/hieuvd/dung_repo/raw/stars_01/python-telegram-bot_python-telegram-bot/python-telegram-bot/telegram/_chatboost.py
384,386
341,400
de_json
ChatBoostRemoved
387,400
386,400
class ChatBoostRemoved(TelegramObject): """ This object represents a boost removed from a chat. Objects of this class are comparable in terms of equality. Two objects of this class are considered equal, if their :attr:`chat`, :attr:`boost_id`, :attr:`remove_date`, and :attr:`source` are equal. ...
class ChatBoostRemoved(TelegramObject): """ This object represents a boost removed from a chat. Objects of this class are comparable in terms of equality. Two objects of this class are considered equal, if their :attr:`chat`, :attr:`boost_id`, :attr:`remove_date`, and :attr:`source` are equal. ...
data = cls._parse_data(data) if not data: return None data["chat"] = Chat.de_json(data.get("chat"), bot) data["source"] = ChatBoostSource.de_json(data.get("source"), bot) loc_tzinfo = extract_tzinfo_from_defaults(bot) data["remove_date"] = from_timestamp(dat...
"""See :meth:`telegram.TelegramObject.de_json`.""" data = cls._parse_data(data) if not data: return None data["chat"] = Chat.de_json(data.get("chat"), bot) data["source"] = ChatBoostSource.de_json(data.get("source"), bot) loc_tzinfo = extract_tzinfo_from_def...
26
549
149
698
#!/usr/bin/env python # # A library that provides a Python interface to the Telegram Bot API # Copyright (C) 2015-2024 # Leandro Toledo de Souza <devs@python-telegram-bot.org> # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Lesser Public License as published by #...
#!/usr/bin/env python # # A library that provides a Python interface to the Telegram Bot API # Copyright (C) 2015-2024 # Leandro Toledo de Souza <devs@python-telegram-bot.org> # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Lesser Public License as published by #...
23,256
/home/hieuvd/dung_repo/raw/stars_01/python-telegram-bot_python-telegram-bot/python-telegram-bot
/home/hieuvd/dung_repo/raw/stars_01/python-telegram-bot_python-telegram-bot/python-telegram-bot/telegram/_chatboost.py
112,114
70,135
de_json
ChatBoostSource
115,135
114,135
class ChatBoostSource(TelegramObject): """ Base class for Telegram ChatBoostSource objects. It can be one of: * :class:`telegram.ChatBoostSourcePremium` * :class:`telegram.ChatBoostSourceGiftCode` * :class:`telegram.ChatBoostSourceGiveaway` Objects of this class are comparable in terms of equa...
class ChatBoostSource(TelegramObject): """ Base class for Telegram ChatBoostSource objects. It can be one of: * :class:`telegram.ChatBoostSourcePremium` * :class:`telegram.ChatBoostSourceGiftCode` * :class:`telegram.ChatBoostSourceGiveaway` Objects of this class are comparable in terms of equa...
data = cls._parse_data(data) if not data: return None _class_mapping: Dict[str, Type[ChatBoostSource]] = { cls.PREMIUM: ChatBoostSourcePremium, cls.GIFT_CODE: ChatBoostSourceGiftCode, cls.GIVEAWAY: ChatBoostSourceGiveaway, } if c...
"""See :meth:`telegram.TelegramObject.de_json`.""" data = cls._parse_data(data) if not data: return None _class_mapping: Dict[str, Type[ChatBoostSource]] = { cls.PREMIUM: ChatBoostSourcePremium, cls.GIFT_CODE: ChatBoostSourceGiftCode, cls...
42
653
223
876
#!/usr/bin/env python # # A library that provides a Python interface to the Telegram Bot API # Copyright (C) 2015-2024 # Leandro Toledo de Souza <devs@python-telegram-bot.org> # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Lesser Public License as published by #...
#!/usr/bin/env python # # A library that provides a Python interface to the Telegram Bot API # Copyright (C) 2015-2024 # Leandro Toledo de Souza <devs@python-telegram-bot.org> # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Lesser Public License as published by #...
23,257
/home/hieuvd/dung_repo/raw/stars_01/python-telegram-bot_python-telegram-bot/python-telegram-bot
/home/hieuvd/dung_repo/raw/stars_01/python-telegram-bot_python-telegram-bot/python-telegram-bot/telegram/_chatboost.py
327,329
293,341
de_json
ChatBoostUpdated
330,341
329,341
class ChatBoostUpdated(TelegramObject): """This object represents a boost added to a chat or changed. Objects of this class are comparable in terms of equality. Two objects of this class are considered equal, if their :attr:`chat`, and :attr:`boost` are equal. .. versionadded:: 20.8 Args: ...
class ChatBoostUpdated(TelegramObject): """This object represents a boost added to a chat or changed. Objects of this class are comparable in terms of equality. Two objects of this class are considered equal, if their :attr:`chat`, and :attr:`boost` are equal. .. versionadded:: 20.8 Args: ...
data = cls._parse_data(data) if not data: return None data["chat"] = Chat.de_json(data.get("chat"), bot) data["boost"] = ChatBoost.de_json(data.get("boost"), bot) return super().de_json(data=data, bot=bot)
"""See :meth:`telegram.TelegramObject.de_json`.""" data = cls._parse_data(data) if not data: return None data["chat"] = Chat.de_json(data.get("chat"), bot) data["boost"] = ChatBoost.de_json(data.get("boost"), bot) return super().de_json(data=data, bot=bot) ...
19
377
100
477
#!/usr/bin/env python # # A library that provides a Python interface to the Telegram Bot API # Copyright (C) 2015-2024 # Leandro Toledo de Souza <devs@python-telegram-bot.org> # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Lesser Public License as published by #...
#!/usr/bin/env python # # A library that provides a Python interface to the Telegram Bot API # Copyright (C) 2015-2024 # Leandro Toledo de Souza <devs@python-telegram-bot.org> # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Lesser Public License as published by #...
23,258
/home/hieuvd/dung_repo/raw/stars_01/python-telegram-bot_python-telegram-bot/python-telegram-bot
/home/hieuvd/dung_repo/raw/stars_01/python-telegram-bot_python-telegram-bot/python-telegram-bot/telegram/_chatboost.py
431,433
400,442
de_json
UserChatBoosts
434,442
433,442
class UserChatBoosts(TelegramObject): """This object represents a list of boosts added to a chat by a user. Objects of this class are comparable in terms of equality. Two objects of this class are considered equal, if their :attr:`boosts` are equal. .. versionadded:: 20.8 Args: boosts (Se...
class UserChatBoosts(TelegramObject): """This object represents a list of boosts added to a chat by a user. Objects of this class are comparable in terms of equality. Two objects of this class are considered equal, if their :attr:`boosts` are equal. .. versionadded:: 20.8 Args: boosts (Se...
data = cls._parse_data(data) if not data: return None data["boosts"] = ChatBoost.de_list(data.get("boosts"), bot) return super().de_json(data=data, bot=bot)
"""See :meth:`telegram.TelegramObject.de_json`.""" data = cls._parse_data(data) if not data: return None data["boosts"] = ChatBoost.de_list(data.get("boosts"), bot) return super().de_json(data=data, bot=bot)
15
355
76
431
#!/usr/bin/env python # # A library that provides a Python interface to the Telegram Bot API # Copyright (C) 2015-2024 # Leandro Toledo de Souza <devs@python-telegram-bot.org> # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Lesser Public License as published by #...
#!/usr/bin/env python # # A library that provides a Python interface to the Telegram Bot API # Copyright (C) 2015-2024 # Leandro Toledo de Souza <devs@python-telegram-bot.org> # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Lesser Public License as published by #...
23,259
/home/hieuvd/dung_repo/raw/stars_01/python-telegram-bot_python-telegram-bot/python-telegram-bot
/home/hieuvd/dung_repo/raw/stars_01/python-telegram-bot_python-telegram-bot/python-telegram-bot/telegram/_chatinvitelink.py
153,155
32,168
de_json
ChatInviteLink
156,168
155,168
class ChatInviteLink(TelegramObject): """This object represents an invite link for a chat. Objects of this class are comparable in terms of equality. Two objects of this class are considered equal, if their :attr:`invite_link`, :attr:`creator`, :attr:`creates_join_request`, :attr:`is_primary` and :attr...
class ChatInviteLink(TelegramObject): """This object represents an invite link for a chat. Objects of this class are comparable in terms of equality. Two objects of this class are considered equal, if their :attr:`invite_link`, :attr:`creator`, :attr:`creates_join_request`, :attr:`is_primary` and :attr...
data = cls._parse_data(data) if not data: return None # Get the local timezone from the bot if it has defaults loc_tzinfo = extract_tzinfo_from_defaults(bot) data["creator"] = User.de_json(data.get("creator"), bot) data["expire_date"] = from_timestamp(data....
"""See :meth:`telegram.TelegramObject.de_json`.""" data = cls._parse_data(data) if not data: return None # Get the local timezone from the bot if it has defaults loc_tzinfo = extract_tzinfo_from_defaults(bot) data["creator"] = User.de_json(data.get("creator...
35
1,569
146
1,715
#!/usr/bin/env python # # A library that provides a Python interface to the Telegram Bot API # Copyright (C) 2015-2024 # Leandro Toledo de Souza <devs@python-telegram-bot.org> # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Lesser Public License as published by #...
#!/usr/bin/env python # # A library that provides a Python interface to the Telegram Bot API # Copyright (C) 2015-2024 # Leandro Toledo de Souza <devs@python-telegram-bot.org> # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Lesser Public License as published by #...
23,261
/home/hieuvd/dung_repo/raw/stars_01/python-telegram-bot_python-telegram-bot/python-telegram-bot
/home/hieuvd/dung_repo/raw/stars_01/python-telegram-bot_python-telegram-bot/python-telegram-bot/telegram/_chatlocation.py
70,72
32,92
de_json
ChatLocation
73,82
72,82
class ChatLocation(TelegramObject): """This object represents a location to which a chat is connected. Objects of this class are comparable in terms of equality. Two objects of this class are considered equal, if their :attr:`location` is equal. Args: location (:class:`telegram.Location`): The...
class ChatLocation(TelegramObject): """This object represents a location to which a chat is connected. Objects of this class are comparable in terms of equality. Two objects of this class are considered equal, if their :attr:`location` is equal. Args: location (:class:`telegram.Location`): The...
data = cls._parse_data(data) if not data: return None data["location"] = Location.de_json(data.get("location"), bot) return super().de_json(data=data, bot=bot)
"""See :meth:`telegram.TelegramObject.de_json`.""" data = cls._parse_data(data) if not data: return None data["location"] = Location.de_json(data.get("location"), bot) return super().de_json(data=data, bot=bot)
15
595
74
669
#!/usr/bin/env python # # A library that provides a Python interface to the Telegram Bot API # Copyright (C) 2015-2024 # Leandro Toledo de Souza <devs@python-telegram-bot.org> # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Lesser Public License as published by #...
#!/usr/bin/env python # # A library that provides a Python interface to the Telegram Bot API # Copyright (C) 2015-2024 # Leandro Toledo de Souza <devs@python-telegram-bot.org> # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Lesser Public License as published by #...
23,262
/home/hieuvd/dung_repo/raw/stars_01/python-telegram-bot_python-telegram-bot/python-telegram-bot
/home/hieuvd/dung_repo/raw/stars_01/python-telegram-bot_python-telegram-bot/python-telegram-bot/telegram/_chatmember.py
106,108
33,142
de_json
ChatMember
109,142
108,142
class ChatMember(TelegramObject): """Base class for Telegram ChatMember Objects. Currently, the following 6 types of chat members are supported: * :class:`telegram.ChatMemberOwner` * :class:`telegram.ChatMemberAdministrator` * :class:`telegram.ChatMemberMember` * :class:`telegram.ChatMemberRest...
class ChatMember(TelegramObject): """Base class for Telegram ChatMember Objects. Currently, the following 6 types of chat members are supported: * :class:`telegram.ChatMemberOwner` * :class:`telegram.ChatMemberAdministrator` * :class:`telegram.ChatMemberMember` * :class:`telegram.ChatMemberRest...
data = cls._parse_data(data) if not data: return None _class_mapping: Dict[str, Type[ChatMember]] = { cls.OWNER: ChatMemberOwner, cls.ADMINISTRATOR: ChatMemberAdministrator, cls.MEMBER: ChatMemberMember, cls.RESTRICTED: ChatMemberRest...
"""See :meth:`telegram.TelegramObject.de_json`.""" data = cls._parse_data(data) if not data: return None _class_mapping: Dict[str, Type[ChatMember]] = { cls.OWNER: ChatMemberOwner, cls.ADMINISTRATOR: ChatMemberAdministrator, cls.MEMBER: C...
108
1,115
446
1,561
#!/usr/bin/env python # # A library that provides a Python interface to the Telegram Bot API # Copyright (C) 2015-2024 # Leandro Toledo de Souza <devs@python-telegram-bot.org> # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Lesser Public License as published by #...
#!/usr/bin/env python # # A library that provides a Python interface to the Telegram Bot API # Copyright (C) 2015-2024 # Leandro Toledo de Souza <devs@python-telegram-bot.org> # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Lesser Public License as published by #...
23,263
/home/hieuvd/dung_repo/raw/stars_01/python-telegram-bot_python-telegram-bot/python-telegram-bot
/home/hieuvd/dung_repo/raw/stars_01/python-telegram-bot_python-telegram-bot/python-telegram-bot/telegram/_chatmemberupdated.py
163,171
35,205
difference
ChatMemberUpdated
189,205
171,205
class ChatMemberUpdated(TelegramObject): """This object represents changes in the status of a chat member. Objects of this class are comparable in terms of equality. Two objects of this class are considered equal, if their :attr:`chat`, :attr:`from_user`, :attr:`date`, :attr:`old_chat_member` and :attr...
class ChatMemberUpdated(TelegramObject): """This object represents changes in the status of a chat member. Objects of this class are comparable in terms of equality. Two objects of this class are considered equal, if their :attr:`chat`, :attr:`from_user`, :attr:`date`, :attr:`old_chat_member` and :attr...
# we first get the names of the attributes that have changed # user.to_dict() is unhashable, so that needs some special casing further down old_dict = self.old_chat_member.to_dict() old_user_dict = old_dict.pop("user") new_dict = self.new_chat_member.to_dict() new_user_di...
"""Computes the difference between :attr:`old_chat_member` and :attr:`new_chat_member`. Example: .. code:: pycon >>> chat_member_updated.difference() {'custom_title': ('old title', 'new title')} Note: To determine, if the :attr:`telegram...
94
1,736
278
2,014
#!/usr/bin/env python # # A library that provides a Python interface to the Telegram Bot API # Copyright (C) 2015-2024 # Leandro Toledo de Souza <devs@python-telegram-bot.org> # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Lesser Public License as published by #...
#!/usr/bin/env python # # A library that provides a Python interface to the Telegram Bot API # Copyright (C) 2015-2024 # Leandro Toledo de Souza <devs@python-telegram-bot.org> # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Lesser Public License as published by #...
23,265
/home/hieuvd/dung_repo/raw/stars_01/python-telegram-bot_python-telegram-bot/python-telegram-bot
/home/hieuvd/dung_repo/raw/stars_01/python-telegram-bot_python-telegram-bot/python-telegram-bot/telegram/_choseninlineresult.py
94,96
33,108
de_json
ChosenInlineResult
97,108
96,108
class ChosenInlineResult(TelegramObject): """ Represents a result of an inline query that was chosen by the user and sent to their chat partner. Objects of this class are comparable in terms of equality. Two objects of this class are considered equal, if their :attr:`result_id` is equal. Note:...
class ChosenInlineResult(TelegramObject): """ Represents a result of an inline query that was chosen by the user and sent to their chat partner. Objects of this class are comparable in terms of equality. Two objects of this class are considered equal, if their :attr:`result_id` is equal. Note:...
data = cls._parse_data(data) if not data: return None # Required data["from_user"] = User.de_json(data.pop("from", None), bot) # Optionals data["location"] = Location.de_json(data.get("location"), bot) return super().de_json(data=data, bot=bot)
"""See :meth:`telegram.TelegramObject.de_json`.""" data = cls._parse_data(data) if not data: return None # Required data["from_user"] = User.de_json(data.pop("from", None), bot) # Optionals data["location"] = Location.de_json(data.get("location"), bo...
24
779
110
889
#!/usr/bin/env python # pylint: disable=too-many-arguments # # A library that provides a Python interface to the Telegram Bot API # Copyright (C) 2015-2024 # Leandro Toledo de Souza <devs@python-telegram-bot.org> # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Le...
#!/usr/bin/env python # pylint: disable=too-many-arguments # # A library that provides a Python interface to the Telegram Bot API # Copyright (C) 2015-2024 # Leandro Toledo de Souza <devs@python-telegram-bot.org> # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Le...
23,266
/home/hieuvd/dung_repo/raw/stars_01/python-telegram-bot_python-telegram-bot/python-telegram-bot
/home/hieuvd/dung_repo/raw/stars_01/python-telegram-bot_python-telegram-bot/python-telegram-bot/telegram/_files/_basemedium.py
73,82
30,101
get_file
_BaseMedium
93,101
82,101
class _BaseMedium(TelegramObject): """Base class for objects representing the various media file types. Objects of this class are comparable in terms of equality. Two objects of this class are considered equal, if their :attr:`file_unique_id` is equal. Args: file_id (:obj:`str`): Identifier for...
class _BaseMedium(TelegramObject): """Base class for objects representing the various media file types. Objects of this class are comparable in terms of equality. Two objects of this class are considered equal, if their :attr:`file_unique_id` is equal. Args: file_id (:obj:`str`): Identifier for...
return await self.get_bot().get_file( file_id=self.file_id, read_timeout=read_timeout, write_timeout=write_timeout, connect_timeout=connect_timeout, pool_timeout=pool_timeout, api_kwargs=api_kwargs, )
"""Convenience wrapper over :meth:`telegram.Bot.get_file` For the documentation of the arguments, please see :meth:`telegram.Bot.get_file`. Returns: :class:`telegram.File` Raises: :class:`telegram.error.TelegramError` """ return await self.get_...
10
678
87
765
#!/usr/bin/env python # # A library that provides a Python interface to the Telegram Bot API # Copyright (C) 2015-2024 # Leandro Toledo de Souza <devs@python-telegram-bot.org> # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Lesser Public License as published by #...
#!/usr/bin/env python # # A library that provides a Python interface to the Telegram Bot API # Copyright (C) 2015-2024 # Leandro Toledo de Souza <devs@python-telegram-bot.org> # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Lesser Public License as published by #...
23,267
/home/hieuvd/dung_repo/raw/stars_01/python-telegram-bot_python-telegram-bot/python-telegram-bot
/home/hieuvd/dung_repo/raw/stars_01/python-telegram-bot_python-telegram-bot/python-telegram-bot/telegram/_files/_basethumbedmedium.py
83,87
33,104
de_json
_BaseThumbedMedium
88,104
87,104
class _BaseThumbedMedium(_BaseMedium): """ Base class for objects representing the various media file types that may include a thumbnail. Objects of this class are comparable in terms of equality. Two objects of this class are considered equal, if their :attr:`file_unique_id` is equal. Args: ...
class _BaseThumbedMedium(_BaseMedium): """ Base class for objects representing the various media file types that may include a thumbnail. Objects of this class are comparable in terms of equality. Two objects of this class are considered equal, if their :attr:`file_unique_id` is equal. Args: ...
data = cls._parse_data(data) if not data: return None # In case this wasn't already done by the subclass if not isinstance(data.get("thumbnail"), PhotoSize): data["thumbnail"] = PhotoSize.de_json(data.get("thumbnail"), bot) api_kwargs = {} # Thi...
"""See :meth:`telegram.TelegramObject.de_json`.""" data = cls._parse_data(data) if not data: return None # In case this wasn't already done by the subclass if not isinstance(data.get("thumbnail"), PhotoSize): data["thumbnail"] = PhotoSize.de_json(data.ge...
65
608
194
802
#!/usr/bin/env python # # A library that provides a Python interface to the Telegram Bot API # Copyright (C) 2015-2024 # Leandro Toledo de Souza <devs@python-telegram-bot.org> # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Lesser Public License as published by #...
#!/usr/bin/env python # # A library that provides a Python interface to the Telegram Bot API # Copyright (C) 2015-2024 # Leandro Toledo de Souza <devs@python-telegram-bot.org> # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Lesser Public License as published by #...
23,268
/home/hieuvd/dung_repo/raw/stars_01/python-telegram-bot_python-telegram-bot/python-telegram-bot
/home/hieuvd/dung_repo/raw/stars_01/python-telegram-bot_python-telegram-bot/python-telegram-bot/telegram/_files/chatphoto.py
136,145
31,177
get_big_file
ChatPhoto
158,167
145,167
class ChatPhoto(TelegramObject): """This object represents a chat photo. Objects of this class are comparable in terms of equality. Two objects of this class are considered equal, if their :attr:`small_file_unique_id` and :attr:`big_file_unique_id` are equal. Args: small_file_id (:obj:`str...
class ChatPhoto(TelegramObject): """This object represents a chat photo. Objects of this class are comparable in terms of equality. Two objects of this class are considered equal, if their :attr:`small_file_unique_id` and :attr:`big_file_unique_id` are equal. Args: small_file_id (:obj:`str...
return await self.get_bot().get_file( file_id=self.big_file_id, read_timeout=read_timeout, write_timeout=write_timeout, connect_timeout=connect_timeout, pool_timeout=pool_timeout, api_kwargs=api_kwargs, )
"""Convenience wrapper over :meth:`telegram.Bot.get_file` for getting the big (:tg-const:`telegram.ChatPhoto.SIZE_BIG` x :tg-const:`telegram.ChatPhoto.SIZE_BIG`) chat photo For the documentation of the arguments, please see :meth:`telegram.Bot.get_file`. Returns: :c...
10
1,831
91
1,922
#!/usr/bin/env python # # A library that provides a Python interface to the Telegram Bot API # Copyright (C) 2015-2024 # Leandro Toledo de Souza <devs@python-telegram-bot.org> # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Lesser Public License as published by #...
#!/usr/bin/env python # # A library that provides a Python interface to the Telegram Bot API # Copyright (C) 2015-2024 # Leandro Toledo de Souza <devs@python-telegram-bot.org> # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Lesser Public License as published by #...
23,270
/home/hieuvd/dung_repo/raw/stars_01/python-telegram-bot_python-telegram-bot/python-telegram-bot
/home/hieuvd/dung_repo/raw/stars_01/python-telegram-bot_python-telegram-bot/python-telegram-bot/telegram/_files/inputfile.py
93,95
31,108
field_tuple
InputFile
100,102
95,102
class InputFile: """This object represents a Telegram InputFile. .. versionchanged:: 20.0 * The former attribute ``attach`` was renamed to :attr:`attach_name`. * Method ``is_image`` was removed. If you pass :obj:`bytes` to :paramref:`obj` and would like to have the mime type automati...
class InputFile: """This object represents a Telegram InputFile. .. versionchanged:: 20.0 * The former attribute ``attach`` was renamed to :attr:`attach_name`. * Method ``is_image`` was removed. If you pass :obj:`bytes` to :paramref:`obj` and would like to have the mime type automati...
return self.filename, self.input_file_content, self.mimetype
"""Field tuple representing the contents of the file for upload to the Telegram servers. Returns: Tuple[:obj:`str`, :obj:`bytes`, :obj:`str`]: """ return self.filename, self.input_file_content, self.mimetype
4
899
23
922
#!/usr/bin/env python # # A library that provides a Python interface to the Telegram Bot API # Copyright (C) 2015-2024 # Leandro Toledo de Souza <devs@python-telegram-bot.org> # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Lesser Public License as published by #...
#!/usr/bin/env python # # A library that provides a Python interface to the Telegram Bot API # Copyright (C) 2015-2024 # Leandro Toledo de Souza <devs@python-telegram-bot.org> # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Lesser Public License as published by #...
23,271
/home/hieuvd/dung_repo/raw/stars_01/python-telegram-bot_python-telegram-bot/python-telegram-bot
/home/hieuvd/dung_repo/raw/stars_01/python-telegram-bot_python-telegram-bot/python-telegram-bot/telegram/_files/inputmedia.py
107,109
41,118
_parse_thumbnail_input
InputMedia
109,118
109,118
class InputMedia(TelegramObject): """ Base class for Telegram InputMedia Objects. .. versionchanged:: 20.0 Added arguments and attributes :attr:`type`, :attr:`media`, :attr:`caption`, :attr:`caption_entities`, :paramref:`parse_mode`. .. seealso:: :wiki:`Working with Files and Media...
class InputMedia(TelegramObject): """ Base class for Telegram InputMedia Objects. .. versionchanged:: 20.0 Added arguments and attributes :attr:`type`, :attr:`media`, :attr:`caption`, :attr:`caption_entities`, :paramref:`parse_mode`. .. seealso:: :wiki:`Working with Files and Media...
# We use local_mode=True because we don't have access to the actual setting and want # things to work in local mode. return ( parse_file_input(thumbnail, attach=True, local_mode=True) if thumbnail is not None else thumbnail )
# We use local_mode=True because we don't have access to the actual setting and want # things to work in local mode. return ( parse_file_input(thumbnail, attach=True, local_mode=True) if thumbnail is not None else thumbnail )
35
914
85
999
#!/usr/bin/env python # # A library that provides a Python interface to the Telegram Bot API # Copyright (C) 2015-2024 # Leandro Toledo de Souza <devs@python-telegram-bot.org> # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Lesser Public License as published by #...
#!/usr/bin/env python # # A library that provides a Python interface to the Telegram Bot API # Copyright (C) 2015-2024 # Leandro Toledo de Souza <devs@python-telegram-bot.org> # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Lesser Public License as published by #...
23,273
/home/hieuvd/dung_repo/raw/stars_01/python-telegram-bot_python-telegram-bot/python-telegram-bot
/home/hieuvd/dung_repo/raw/stars_01/python-telegram-bot_python-telegram-bot/python-telegram-bot/telegram/_files/sticker.py
341,343
218,360
de_json
StickerSet
344,360
343,360
class StickerSet(TelegramObject): """This object represents a sticker set. Objects of this class are comparable in terms of equality. Two objects of this class are considered equal, if their :attr:`name` is equal. Note: As of v13.11 :paramref:`is_video` is a required argument and therefore the...
class StickerSet(TelegramObject): """This object represents a sticker set. Objects of this class are comparable in terms of equality. Two objects of this class are considered equal, if their :attr:`name` is equal. Note: As of v13.11 :paramref:`is_video` is a required argument and therefore the...
if not data: return None data["thumbnail"] = PhotoSize.de_json(data.get("thumbnail"), bot) data["stickers"] = Sticker.de_list(data.get("stickers"), bot) api_kwargs = {} # These are deprecated fields that TG still returns for backwards compatibility # Let's f...
"""See :meth:`telegram.TelegramObject.de_json`.""" if not data: return None data["thumbnail"] = PhotoSize.de_json(data.get("thumbnail"), bot) data["stickers"] = Sticker.de_list(data.get("stickers"), bot) api_kwargs = {} # These are deprecated fields that TG ...
55
1,455
192
1,647
#!/usr/bin/env python # # A library that provides a Python interface to the Telegram Bot API # Copyright (C) 2015-2024 # Leandro Toledo de Souza <devs@python-telegram-bot.org> # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Lesser Public License as published by #...
#!/usr/bin/env python # # A library that provides a Python interface to the Telegram Bot API # Copyright (C) 2015-2024 # Leandro Toledo de Souza <devs@python-telegram-bot.org> # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Lesser Public License as published by #...
23,274
/home/hieuvd/dung_repo/raw/stars_01/python-telegram-bot_python-telegram-bot/python-telegram-bot
/home/hieuvd/dung_repo/raw/stars_01/python-telegram-bot_python-telegram-bot/python-telegram-bot/telegram/_files/venue.py
105,107
31,116
de_json
Venue
108,116
107,116
class Venue(TelegramObject): """This object represents a venue. Objects of this class are comparable in terms of equality. Two objects of this class are considered equal, if their :attr:`location` and :attr:`title` are equal. Note: Foursquare details and Google Place details are mutually exclusi...
class Venue(TelegramObject): """This object represents a venue. Objects of this class are comparable in terms of equality. Two objects of this class are considered equal, if their :attr:`location` and :attr:`title` are equal. Note: Foursquare details and Google Place details are mutually exclusi...
data = cls._parse_data(data) if not data: return None data["location"] = Location.de_json(data.get("location"), bot) return super().de_json(data=data, bot=bot)
"""See :meth:`telegram.TelegramObject.de_json`.""" data = cls._parse_data(data) if not data: return None data["location"] = Location.de_json(data.get("location"), bot) return super().de_json(data=data, bot=bot)
15
960
72
1,032
#!/usr/bin/env python # # A library that provides a Python interface to the Telegram Bot API # Copyright (C) 2015-2024 # Leandro Toledo de Souza <devs@python-telegram-bot.org> # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Lesser Public License as published by #...
#!/usr/bin/env python # # A library that provides a Python interface to the Telegram Bot API # Copyright (C) 2015-2024 # Leandro Toledo de Souza <devs@python-telegram-bot.org> # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Lesser Public License as published by #...
23,275
/home/hieuvd/dung_repo/raw/stars_01/python-telegram-bot_python-telegram-bot/python-telegram-bot
/home/hieuvd/dung_repo/raw/stars_01/python-telegram-bot_python-telegram-bot/python-telegram-bot/telegram/_games/game.py
165,166
33,196
parse_text_entities
Game
188,196
166,196
class Game(TelegramObject): """ This object represents a game. Use `BotFather <https://t.me/BotFather>`_ to create and edit games, their short names will act as unique identifiers. Objects of this class are comparable in terms of equality. Two objects of this class are considered equal, if their :a...
class Game(TelegramObject): """ This object represents a game. Use `BotFather <https://t.me/BotFather>`_ to create and edit games, their short names will act as unique identifiers. Objects of this class are comparable in terms of equality. Two objects of this class are considered equal, if their :a...
if types is None: types = MessageEntity.ALL_TYPES return { entity: self.parse_text_entity(entity) for entity in self.text_entities if entity.type in types }
""" Returns a :obj:`dict` that maps :class:`telegram.MessageEntity` to :obj:`str`. It contains entities from this message filtered by their :attr:`~telegram.MessageEntity.type` attribute as the key, and the text that each entity belongs to as the value of the :obj:`dict`. ...
20
1,869
68
1,937
#!/usr/bin/env python # # A library that provides a Python interface to the Telegram Bot API # Copyright (C) 2015-2024 # Leandro Toledo de Souza <devs@python-telegram-bot.org> # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Lesser Public License as published by #...
#!/usr/bin/env python # # A library that provides a Python interface to the Telegram Bot API # Copyright (C) 2015-2024 # Leandro Toledo de Souza <devs@python-telegram-bot.org> # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Lesser Public License as published by #...
23,276
/home/hieuvd/dung_repo/raw/stars_01/python-telegram-bot_python-telegram-bot/python-telegram-bot
/home/hieuvd/dung_repo/raw/stars_01/python-telegram-bot_python-telegram-bot/python-telegram-bot/telegram/_games/gamehighscore.py
63,65
31,74
de_json
GameHighScore
66,74
65,74
class GameHighScore(TelegramObject): """This object represents one row of the high scores table for a game. Objects of this class are comparable in terms of equality. Two objects of this class are considered equal, if their :attr:`position`, :attr:`user` and :attr:`score` are equal. Args: posi...
class GameHighScore(TelegramObject): """This object represents one row of the high scores table for a game. Objects of this class are comparable in terms of equality. Two objects of this class are considered equal, if their :attr:`position`, :attr:`user` and :attr:`score` are equal. Args: posi...
data = cls._parse_data(data) if not data: return None data["user"] = User.de_json(data.get("user"), bot) return super().de_json(data=data, bot=bot)
"""See :meth:`telegram.TelegramObject.de_json`.""" data = cls._parse_data(data) if not data: return None data["user"] = User.de_json(data.get("user"), bot) return super().de_json(data=data, bot=bot)
15
393
72
465
#!/usr/bin/env python # # A library that provides a Python interface to the Telegram Bot API # Copyright (C) 2015-2024 # Leandro Toledo de Souza <devs@python-telegram-bot.org> # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Lesser Public License as published by #...
#!/usr/bin/env python # # A library that provides a Python interface to the Telegram Bot API # Copyright (C) 2015-2024 # Leandro Toledo de Souza <devs@python-telegram-bot.org> # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Lesser Public License as published by #...
23,277
/home/hieuvd/dung_repo/raw/stars_01/python-telegram-bot_python-telegram-bot/python-telegram-bot
/home/hieuvd/dung_repo/raw/stars_01/python-telegram-bot_python-telegram-bot/python-telegram-bot/telegram/_giveaway.py
125,127
34,144
de_json
Giveaway
128,144
127,144
class Giveaway(TelegramObject): """This object represents a message about a scheduled giveaway. Objects of this class are comparable in terms of equality. Two objects of this class are considered equal, if their :attr:`chats`, :attr:`winners_selection_date` and :attr:`winner_count` are equal. .. v...
class Giveaway(TelegramObject): """This object represents a message about a scheduled giveaway. Objects of this class are comparable in terms of equality. Two objects of this class are considered equal, if their :attr:`chats`, :attr:`winners_selection_date` and :attr:`winner_count` are equal. .. v...
data = cls._parse_data(data) if data is None: return None # Get the local timezone from the bot if it has defaults loc_tzinfo = extract_tzinfo_from_defaults(bot) data["chats"] = tuple(Chat.de_list(data.get("chats"), bot)) data["winners_selection_date"] = fr...
"""See :obj:`telegram.TelegramObject.de_json`.""" data = cls._parse_data(data) if data is None: return None # Get the local timezone from the bot if it has defaults loc_tzinfo = extract_tzinfo_from_defaults(bot) data["chats"] = tuple(Chat.de_list(data.get("...
37
1,319
161
1,480
#!/usr/bin/env python # # A library that provides a Python interface to the Telegram Bot API # Copyright (C) 2015-2024 # Leandro Toledo de Souza <devs@python-telegram-bot.org> # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Lesser Public License as published by #...
#!/usr/bin/env python # # A library that provides a Python interface to the Telegram Bot API # Copyright (C) 2015-2024 # Leandro Toledo de Souza <devs@python-telegram-bot.org> # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Lesser Public License as published by #...
23,278
/home/hieuvd/dung_repo/raw/stars_01/python-telegram-bot_python-telegram-bot/python-telegram-bot
/home/hieuvd/dung_repo/raw/stars_01/python-telegram-bot_python-telegram-bot/python-telegram-bot/telegram/_giveaway.py
325,327
279,339
de_json
GiveawayCompleted
328,339
327,339
class GiveawayCompleted(TelegramObject): """This object represents a service message about the completion of a giveaway without public winners. Objects of this class are comparable in terms of equality. Two objects of this class are considered equal, if their :attr:`winner_count` and :attr:`unclaimed_p...
class GiveawayCompleted(TelegramObject): """This object represents a service message about the completion of a giveaway without public winners. Objects of this class are comparable in terms of equality. Two objects of this class are considered equal, if their :attr:`winner_count` and :attr:`unclaimed_p...
data = cls._parse_data(data) if data is None: return None # Unfortunately, this needs to be here due to cyclic imports from telegram._message import Message # pylint: disable=import-outside-toplevel data["giveaway_message"] = Message.de_json(data.get("giveaway_mes...
"""See :obj:`telegram.TelegramObject.de_json`.""" data = cls._parse_data(data) if data is None: return None # Unfortunately, this needs to be here due to cyclic imports from telegram._message import Message # pylint: disable=import-outside-toplevel data["g...
34
561
124
685
#!/usr/bin/env python # # A library that provides a Python interface to the Telegram Bot API # Copyright (C) 2015-2024 # Leandro Toledo de Souza <devs@python-telegram-bot.org> # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Lesser Public License as published by #...
#!/usr/bin/env python # # A library that provides a Python interface to the Telegram Bot API # Copyright (C) 2015-2024 # Leandro Toledo de Souza <devs@python-telegram-bot.org> # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Lesser Public License as published by #...
23,279
/home/hieuvd/dung_repo/raw/stars_01/python-telegram-bot_python-telegram-bot/python-telegram-bot
/home/hieuvd/dung_repo/raw/stars_01/python-telegram-bot_python-telegram-bot/python-telegram-bot/telegram/_giveaway.py
259,261
157,279
de_json
GiveawayWinners
262,279
261,279
class GiveawayWinners(TelegramObject): """This object represents a message about the completion of a giveaway with public winners. Objects of this class are comparable in terms of equality. Two objects of this class are considered equal, if their :attr:`chat`, :attr:`giveaway_message_id`, :attr:`winner...
class GiveawayWinners(TelegramObject): """This object represents a message about the completion of a giveaway with public winners. Objects of this class are comparable in terms of equality. Two objects of this class are considered equal, if their :attr:`chat`, :attr:`giveaway_message_id`, :attr:`winner...
data = cls._parse_data(data) if data is None: return None # Get the local timezone from the bot if it has defaults loc_tzinfo = extract_tzinfo_from_defaults(bot) data["chat"] = Chat.de_json(data.get("chat"), bot) data["winners"] = tuple(User.de_list(data.ge...
"""See :obj:`telegram.TelegramObject.de_json`.""" data = cls._parse_data(data) if data is None: return None # Get the local timezone from the bot if it has defaults loc_tzinfo = extract_tzinfo_from_defaults(bot) data["chat"] = Chat.de_json(data.get("chat"),...
41
1,522
183
1,705
#!/usr/bin/env python # # A library that provides a Python interface to the Telegram Bot API # Copyright (C) 2015-2024 # Leandro Toledo de Souza <devs@python-telegram-bot.org> # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Lesser Public License as published by #...
#!/usr/bin/env python # # A library that provides a Python interface to the Telegram Bot API # Copyright (C) 2015-2024 # Leandro Toledo de Souza <devs@python-telegram-bot.org> # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Lesser Public License as published by #...
23,281
/home/hieuvd/dung_repo/raw/stars_01/python-telegram-bot_python-telegram-bot/python-telegram-bot
/home/hieuvd/dung_repo/raw/stars_01/python-telegram-bot_python-telegram-bot/python-telegram-bot/telegram/_inline/inlinekeyboardmarkup.py
92,94
31,163
de_json
InlineKeyboardMarkup
95,109
94,109
class InlineKeyboardMarkup(TelegramObject): """ This object represents an inline keyboard that appears right next to the message it belongs to. Objects of this class are comparable in terms of equality. Two objects of this class are considered equal, if their size of :attr:`inline_keyboard` and all the...
class InlineKeyboardMarkup(TelegramObject): """ This object represents an inline keyboard that appears right next to the message it belongs to. Objects of this class are comparable in terms of equality. Two objects of this class are considered equal, if their size of :attr:`inline_keyboard` and all the...
if not data: return None keyboard = [] for row in data["inline_keyboard"]: tmp = [] for col in row: btn = InlineKeyboardButton.de_json(col, bot) if btn: tmp.append(btn) keyboard.append(tmp) ...
"""See :meth:`telegram.TelegramObject.de_json`.""" if not data: return None keyboard = [] for row in data["inline_keyboard"]: tmp = [] for col in row: btn = InlineKeyboardButton.de_json(col, bot) if btn: ...
29
1,212
105
1,317
#!/usr/bin/env python # # A library that provides a Python interface to the Telegram Bot API # Copyright (C) 2015-2024 # Leandro Toledo de Souza <devs@python-telegram-bot.org> # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Lesser Public License as published by #...
#!/usr/bin/env python # # A library that provides a Python interface to the Telegram Bot API # Copyright (C) 2015-2024 # Leandro Toledo de Souza <devs@python-telegram-bot.org> # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Lesser Public License as published by #...
23,283
/home/hieuvd/dung_repo/raw/stars_01/python-telegram-bot_python-telegram-bot/python-telegram-bot
/home/hieuvd/dung_repo/raw/stars_01/python-telegram-bot_python-telegram-bot/python-telegram-bot/telegram/_inline/inlinequeryresultsbutton.py
99,101
32,117
de_json
InlineQueryResultsButton
102,109
101,109
class InlineQueryResultsButton(TelegramObject): """This object represents a button to be shown above inline query results. You **must** use exactly one of the optional fields. Objects of this class are comparable in terms of equality. Two objects of this class are considered equal, if their :attr:`text...
class InlineQueryResultsButton(TelegramObject): """This object represents a button to be shown above inline query results. You **must** use exactly one of the optional fields. Objects of this class are comparable in terms of equality. Two objects of this class are considered equal, if their :attr:`text...
if not data: return None data["web_app"] = WebAppInfo.de_json(data.get("web_app"), bot) return super().de_json(data=data, bot=bot)
"""See :meth:`telegram.TelegramObject.de_json`.""" if not data: return None data["web_app"] = WebAppInfo.de_json(data.get("web_app"), bot) return super().de_json(data=data, bot=bot)
12
1,185
64
1,249
#!/usr/bin/env python # # A library that provides a Python interface to the Telegram Bot API # Copyright (C) 2015-2024 # Leandro Toledo de Souza <devs@python-telegram-bot.org> # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Lesser Public License as published by #...
#!/usr/bin/env python # # A library that provides a Python interface to the Telegram Bot API # Copyright (C) 2015-2024 # Leandro Toledo de Souza <devs@python-telegram-bot.org> # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Lesser Public License as published by #...
23,286
/home/hieuvd/dung_repo/raw/stars_01/python-telegram-bot_python-telegram-bot/python-telegram-bot
/home/hieuvd/dung_repo/raw/stars_01/python-telegram-bot_python-telegram-bot/python-telegram-bot/telegram/_menubutton.py
71,73
32,110
de_json
MenuButton
84,102
73,102
class MenuButton(TelegramObject): """This object describes the bot's menu button in a private chat. It should be one of * :class:`telegram.MenuButtonCommands` * :class:`telegram.MenuButtonWebApp` * :class:`telegram.MenuButtonDefault` If a menu button other than :class:`telegram.MenuButtonDefault` ...
class MenuButton(TelegramObject): """This object describes the bot's menu button in a private chat. It should be one of * :class:`telegram.MenuButtonCommands` * :class:`telegram.MenuButtonWebApp` * :class:`telegram.MenuButtonDefault` If a menu button other than :class:`telegram.MenuButtonDefault` ...
data = cls._parse_data(data) if data is None: return None if not data and cls is MenuButton: return None _class_mapping: Dict[str, Type[MenuButton]] = { cls.COMMANDS: MenuButtonCommands, cls.WEB_APP: MenuButtonWebApp, cls.DEF...
"""Converts JSON data to the appropriate :class:`MenuButton` object, i.e. takes care of selecting the correct subclass. Args: data (Dict[:obj:`str`, ...]): The JSON data. bot (:class:`telegram.Bot`): The bot associated with this object. Returns: The ...
44
657
188
845
#!/usr/bin/env python # # A library that provides a Python interface to the Telegram Bot API # Copyright (C) 2015-2024 # Leandro Toledo de Souza <devs@python-telegram-bot.org> # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Lesser Public License as published by #...
#!/usr/bin/env python # # A library that provides a Python interface to the Telegram Bot API # Copyright (C) 2015-2024 # Leandro Toledo de Souza <devs@python-telegram-bot.org> # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Lesser Public License as published by #...
23,287
/home/hieuvd/dung_repo/raw/stars_01/python-telegram-bot_python-telegram-bot/python-telegram-bot
/home/hieuvd/dung_repo/raw/stars_01/python-telegram-bot_python-telegram-bot/python-telegram-bot/telegram/_menubutton.py
163,165
127,176
de_json
MenuButtonWebApp
166,176
165,176
class MenuButtonWebApp(MenuButton): """Represents a menu button, which launches a `Web App <https://core.telegram.org/bots/webapps>`_. Objects of this class are comparable in terms of equality. Two objects of this class are considered equal, if their :attr:`type`, :attr:`text` and :attr:`web_app` a...
class MenuButtonWebApp(MenuButton): """Represents a menu button, which launches a `Web App <https://core.telegram.org/bots/webapps>`_. Objects of this class are comparable in terms of equality. Two objects of this class are considered equal, if their :attr:`type`, :attr:`text` and :attr:`web_app` a...
data = cls._parse_data(data) if not data: return None data["web_app"] = WebAppInfo.de_json(data.get("web_app"), bot) return super().de_json(data=data, bot=bot) # type: ignore[return-value]
"""See :meth:`telegram.TelegramObject.de_json`.""" data = cls._parse_data(data) if not data: return None data["web_app"] = WebAppInfo.de_json(data.get("web_app"), bot) return super().de_json(data=data, bot=bot) # type: ignore[return-value]
18
578
92
670
#!/usr/bin/env python # # A library that provides a Python interface to the Telegram Bot API # Copyright (C) 2015-2024 # Leandro Toledo de Souza <devs@python-telegram-bot.org> # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Lesser Public License as published by #...
#!/usr/bin/env python # # A library that provides a Python interface to the Telegram Bot API # Copyright (C) 2015-2024 # Leandro Toledo de Souza <devs@python-telegram-bot.org> # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Lesser Public License as published by #...
23,289
/home/hieuvd/dung_repo/raw/stars_01/python-telegram-bot_python-telegram-bot/python-telegram-bot
/home/hieuvd/dung_repo/raw/stars_01/python-telegram-bot_python-telegram-bot/python-telegram-bot/telegram/_messageorigin.py
96,98
35,130
de_json
MessageOrigin
101,130
98,130
class MessageOrigin(TelegramObject): """ Base class for telegram MessageOrigin object, it can be one of: * :class:`MessageOriginUser` * :class:`MessageOriginHiddenUser` * :class:`MessageOriginChat` * :class:`MessageOriginChannel` Objects of this class are comparable in terms of equality. T...
class MessageOrigin(TelegramObject): """ Base class for telegram MessageOrigin object, it can be one of: * :class:`MessageOriginUser` * :class:`MessageOriginHiddenUser` * :class:`MessageOriginChat` * :class:`MessageOriginChannel` Objects of this class are comparable in terms of equality. T...
data = cls._parse_data(data) if not data: return None _class_mapping: Dict[str, Type[MessageOrigin]] = { cls.USER: MessageOriginUser, cls.HIDDEN_USER: MessageOriginHiddenUser, cls.CHAT: MessageOriginChat, cls.CHANNEL: MessageOriginCha...
"""Converts JSON data to the appropriate :class:`MessageOrigin` object, i.e. takes care of selecting the correct subclass. """ data = cls._parse_data(data) if not data: return None _class_mapping: Dict[str, Type[MessageOrigin]] = { cls.USER: Mess...
67
820
355
1,175
#!/usr/bin/env python # # A library that provides a Python interface to the Telegram Bot API # Copyright (C) 2015-2024 # Leandro Toledo de Souza <devs@python-telegram-bot.org> # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Lesser Public License as published by #...
#!/usr/bin/env python # # A library that provides a Python interface to the Telegram Bot API # Copyright (C) 2015-2024 # Leandro Toledo de Souza <devs@python-telegram-bot.org> # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Lesser Public License as published by #...
23,290
/home/hieuvd/dung_repo/raw/stars_01/python-telegram-bot_python-telegram-bot/python-telegram-bot
/home/hieuvd/dung_repo/raw/stars_01/python-telegram-bot_python-telegram-bot/python-telegram-bot/telegram/_messagereactionupdated.py
87,91
35,107
de_json
MessageReactionCountUpdated
92,107
91,107
class MessageReactionCountUpdated(TelegramObject): """This class represents reaction changes on a message with anonymous reactions. Objects of this class are comparable in terms of equality. Two objects of this class are considered equal, if the :attr:`chat`, :attr:`message_id`, :attr:`date` and :attr:`rea...
class MessageReactionCountUpdated(TelegramObject): """This class represents reaction changes on a message with anonymous reactions. Objects of this class are comparable in terms of equality. Two objects of this class are considered equal, if the :attr:`chat`, :attr:`message_id`, :attr:`date` and :attr:`rea...
data = cls._parse_data(data) if not data: return None # Get the local timezone from the bot if it has defaults loc_tzinfo = extract_tzinfo_from_defaults(bot) data["date"] = from_timestamp(data.get("date"), tzinfo=loc_tzinfo) data["chat"] = Chat.de_json(data...
"""See :meth:`telegram.TelegramObject.de_json`.""" data = cls._parse_data(data) if not data: return None # Get the local timezone from the bot if it has defaults loc_tzinfo = extract_tzinfo_from_defaults(bot) data["date"] = from_timestamp(data.get("date"), ...
38
606
166
772
#!/usr/bin/env python # # A library that provides a Python interface to the Telegram Bot API # Copyright (C) 2015-2024 # Leandro Toledo de Souza <devs@python-telegram-bot.org> # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Lesser Public License as published by #...
#!/usr/bin/env python # # A library that provides a Python interface to the Telegram Bot API # Copyright (C) 2015-2024 # Leandro Toledo de Souza <devs@python-telegram-bot.org> # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Lesser Public License as published by #...
23,291
/home/hieuvd/dung_repo/raw/stars_01/python-telegram-bot_python-telegram-bot/python-telegram-bot
/home/hieuvd/dung_repo/raw/stars_01/python-telegram-bot_python-telegram-bot/python-telegram-bot/telegram/_messagereactionupdated.py
188,190
107,207
de_json
MessageReactionUpdated
191,207
190,207
class MessageReactionUpdated(TelegramObject): """This class represents a change of a reaction on a message performed by a user. Objects of this class are comparable in terms of equality. Two objects of this class are considered equal, if the :attr:`chat`, :attr:`message_id`, :attr:`date`, :attr:`old_reacti...
class MessageReactionUpdated(TelegramObject): """This class represents a change of a reaction on a message performed by a user. Objects of this class are comparable in terms of equality. Two objects of this class are considered equal, if the :attr:`chat`, :attr:`message_id`, :attr:`date`, :attr:`old_reacti...
data = cls._parse_data(data) if not data: return None # Get the local timezone from the bot if it has defaults loc_tzinfo = extract_tzinfo_from_defaults(bot) data["date"] = from_timestamp(data.get("date"), tzinfo=loc_tzinfo) data["chat"] = Chat.de_json(data...
"""See :meth:`telegram.TelegramObject.de_json`.""" data = cls._parse_data(data) if not data: return None # Get the local timezone from the bot if it has defaults loc_tzinfo = extract_tzinfo_from_defaults(bot) data["date"] = from_timestamp(data.get("date"), ...
50
993
244
1,237
#!/usr/bin/env python # # A library that provides a Python interface to the Telegram Bot API # Copyright (C) 2015-2024 # Leandro Toledo de Souza <devs@python-telegram-bot.org> # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Lesser Public License as published by #...
#!/usr/bin/env python # # A library that provides a Python interface to the Telegram Bot API # Copyright (C) 2015-2024 # Leandro Toledo de Souza <devs@python-telegram-bot.org> # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Lesser Public License as published by #...
23,293
/home/hieuvd/dung_repo/raw/stars_01/python-telegram-bot_python-telegram-bot/python-telegram-bot
/home/hieuvd/dung_repo/raw/stars_01/python-telegram-bot_python-telegram-bot/python-telegram-bot/telegram/_passport/credentials.py
234,236
211,247
de_json
Credentials
237,247
236,247
class Credentials(TelegramObject): """ Attributes: secure_data (:class:`telegram.SecureData`): Credentials for encrypted data nonce (:obj:`str`): Bot-specified nonce """ __slots__ = ("nonce", "secure_data") def __init__( self, secure_data: "SecureData", nonc...
class Credentials(TelegramObject): """ Attributes: secure_data (:class:`telegram.SecureData`): Credentials for encrypted data nonce (:obj:`str`): Bot-specified nonce """ __slots__ = ("nonce", "secure_data") def __init__( self, secure_data: "SecureData", nonc...
data = cls._parse_data(data) if not data: return None data["secure_data"] = SecureData.de_json(data.get("secure_data"), bot=bot) return super().de_json(data=data, bot=bot)
"""See :meth:`telegram.TelegramObject.de_json`.""" data = cls._parse_data(data) if not data: return None data["secure_data"] = SecureData.de_json(data.get("secure_data"), bot=bot) return super().de_json(data=data, bot=bot)
15
253
84
337
#!/usr/bin/env python # # A library that provides a Python interface to the Telegram Bot API # Copyright (C) 2015-2024 # Leandro Toledo de Souza <devs@python-telegram-bot.org> # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Lesser Public License as published by #...
#!/usr/bin/env python # # A library that provides a Python interface to the Telegram Bot API # Copyright (C) 2015-2024 # Leandro Toledo de Souza <devs@python-telegram-bot.org> # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Lesser Public License as published by #...
23,294
/home/hieuvd/dung_repo/raw/stars_01/python-telegram-bot_python-telegram-bot/python-telegram-bot
/home/hieuvd/dung_repo/raw/stars_01/python-telegram-bot_python-telegram-bot/python-telegram-bot/telegram/_passport/credentials.py
161,163
104,211
decrypted_secret
EncryptedCredentials
170,192
163,192
class EncryptedCredentials(TelegramObject): """Contains data required for decrypting and authenticating EncryptedPassportElement. See the Telegram Passport Documentation for a complete description of the data decryption and authentication processes. Objects of this class are comparable in terms of equa...
class EncryptedCredentials(TelegramObject): """Contains data required for decrypting and authenticating EncryptedPassportElement. See the Telegram Passport Documentation for a complete description of the data decryption and authentication processes. Objects of this class are comparable in terms of equa...
if self._decrypted_secret is None: if not CRYPTO_INSTALLED: raise RuntimeError( "To use Telegram Passports, PTB must be installed via `pip install " '"python-telegram-bot[passport]"`.' ) # Try decrypting according to...
""" :obj:`bytes`: Lazily decrypt and return secret. Raises: telegram.error.PassportDecryptionError: Decryption failed. Usually due to bad private/public key but can also suggest malformed/tampered data. """ if self._decrypted_secret is None: ...
109
881
314
1,195
#!/usr/bin/env python # # A library that provides a Python interface to the Telegram Bot API # Copyright (C) 2015-2024 # Leandro Toledo de Souza <devs@python-telegram-bot.org> # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Lesser Public License as published by #...
#!/usr/bin/env python # # A library that provides a Python interface to the Telegram Bot API # Copyright (C) 2015-2024 # Leandro Toledo de Souza <devs@python-telegram-bot.org> # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Lesser Public License as published by #...
23,295
/home/hieuvd/dung_repo/raw/stars_01/python-telegram-bot_python-telegram-bot/python-telegram-bot
/home/hieuvd/dung_repo/raw/stars_01/python-telegram-bot_python-telegram-bot/python-telegram-bot/telegram/_passport/credentials.py
344,346
247,371
de_json
SecureData
347,371
346,371
class SecureData(TelegramObject): """ This object represents the credentials that were used to decrypt the encrypted data. All fields are optional and depend on fields that were requested. Args: personal_details (:class:`telegram.SecureValue`, optional): Credentials for encrypted pe...
class SecureData(TelegramObject): """ This object represents the credentials that were used to decrypt the encrypted data. All fields are optional and depend on fields that were requested. Args: personal_details (:class:`telegram.SecureValue`, optional): Credentials for encrypted pe...
data = cls._parse_data(data) if not data: return None data["temporary_registration"] = SecureValue.de_json( data.get("temporary_registration"), bot=bot ) data["passport_registration"] = SecureValue.de_json( data.get("passport_registration"), ...
"""See :meth:`telegram.TelegramObject.de_json`.""" data = cls._parse_data(data) if not data: return None data["temporary_registration"] = SecureValue.de_json( data.get("temporary_registration"), bot=bot ) data["passport_registration"] = SecureVal...
59
1,324
408
1,732
#!/usr/bin/env python # # A library that provides a Python interface to the Telegram Bot API # Copyright (C) 2015-2024 # Leandro Toledo de Souza <devs@python-telegram-bot.org> # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Lesser Public License as published by #...
#!/usr/bin/env python # # A library that provides a Python interface to the Telegram Bot API # Copyright (C) 2015-2024 # Leandro Toledo de Souza <devs@python-telegram-bot.org> # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Lesser Public License as published by #...
23,296
/home/hieuvd/dung_repo/raw/stars_01/python-telegram-bot_python-telegram-bot/python-telegram-bot
/home/hieuvd/dung_repo/raw/stars_01/python-telegram-bot_python-telegram-bot/python-telegram-bot/telegram/_passport/credentials.py
450,452
371,468
de_json
SecureValue
453,468
452,468
class SecureValue(TelegramObject): """ This object represents the credentials that were used to decrypt the encrypted value. All fields are optional and depend on the type of field. Args: data (:class:`telegram.DataCredentials`, optional): Credentials for encrypted Telegram Passport...
class SecureValue(TelegramObject): """ This object represents the credentials that were used to decrypt the encrypted value. All fields are optional and depend on the type of field. Args: data (:class:`telegram.DataCredentials`, optional): Credentials for encrypted Telegram Passport...
data = cls._parse_data(data) if not data: return None data["data"] = DataCredentials.de_json(data.get("data"), bot=bot) data["front_side"] = FileCredentials.de_json(data.get("front_side"), bot=bot) data["reverse_side"] = FileCredentials.de_json(data.get("reverse_sid...
"""See :meth:`telegram.TelegramObject.de_json`.""" data = cls._parse_data(data) if not data: return None data["data"] = DataCredentials.de_json(data.get("data"), bot=bot) data["front_side"] = FileCredentials.de_json(data.get("front_side"), bot=bot) data["rev...
35
1,263
222
1,485
#!/usr/bin/env python # # A library that provides a Python interface to the Telegram Bot API # Copyright (C) 2015-2024 # Leandro Toledo de Souza <devs@python-telegram-bot.org> # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Lesser Public License as published by #...
#!/usr/bin/env python # # A library that provides a Python interface to the Telegram Bot API # Copyright (C) 2015-2024 # Leandro Toledo de Souza <devs@python-telegram-bot.org> # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Lesser Public License as published by #...
23,298
/home/hieuvd/dung_repo/raw/stars_01/python-telegram-bot_python-telegram-bot/python-telegram-bot
/home/hieuvd/dung_repo/raw/stars_01/python-telegram-bot_python-telegram-bot/python-telegram-bot/telegram/_passport/passportdata.py
96,98
32,130
decrypted_data
PassportData
109,118
98,118
class PassportData(TelegramObject): """Contains information about Telegram Passport data shared with the bot by the user. Note: To be able to decrypt this object, you must pass your ``private_key`` to either :class:`telegram.ext.Updater` or :class:`telegram.Bot`. Decrypted data is then found in...
class PassportData(TelegramObject): """Contains information about Telegram Passport data shared with the bot by the user. Note: To be able to decrypt this object, you must pass your ``private_key`` to either :class:`telegram.ext.Updater` or :class:`telegram.Bot`. Decrypted data is then found in...
if self._decrypted_data is None: self._decrypted_data = tuple( # type: ignore[assignment] EncryptedPassportElement.de_json_decrypted( element.to_dict(), self.get_bot(), self.decrypted_credentials ) for element in self.data ...
""" Tuple[:class:`telegram.EncryptedPassportElement`]: Lazily decrypt and return information about documents and other Telegram Passport elements which were shared with the bot. .. versionchanged:: 20.0 Returns a tuple instead of a list. Raises: tele...
25
961
111
1,072
#!/usr/bin/env python # # A library that provides a Python interface to the Telegram Bot API # Copyright (C) 2015-2024 # Leandro Toledo de Souza <devs@python-telegram-bot.org> # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Lesser Public License as published by #...
#!/usr/bin/env python # # A library that provides a Python interface to the Telegram Bot API # Copyright (C) 2015-2024 # Leandro Toledo de Souza <devs@python-telegram-bot.org> # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Lesser Public License as published by #...
23,299
/home/hieuvd/dung_repo/raw/stars_01/python-telegram-bot_python-telegram-bot/python-telegram-bot
/home/hieuvd/dung_repo/raw/stars_01/python-telegram-bot_python-telegram-bot/python-telegram-bot/telegram/_passport/passportfile.py
175,184
33,209
get_file
PassportFile
198,209
184,209
class PassportFile(TelegramObject): """ This object represents a file uploaded to Telegram Passport. Currently all Telegram Passport files are in JPEG format when decrypted and don't exceed 10MB. Objects of this class are comparable in terms of equality. Two objects of this class are considered equ...
class PassportFile(TelegramObject): """ This object represents a file uploaded to Telegram Passport. Currently all Telegram Passport files are in JPEG format when decrypted and don't exceed 10MB. Objects of this class are comparable in terms of equality. Two objects of this class are considered equ...
file = await self.get_bot().get_file( file_id=self.file_id, read_timeout=read_timeout, write_timeout=write_timeout, connect_timeout=connect_timeout, pool_timeout=pool_timeout, api_kwargs=api_kwargs, ) if self._credentials: ...
""" Wrapper over :meth:`telegram.Bot.get_file`. Will automatically assign the correct credentials to the returned :class:`telegram.File` if originating from :obj:`telegram.PassportData.decrypted_data`. For the documentation of the arguments, please see :meth:`telegram.Bot.get_fi...
16
1,621
117
1,738
#!/usr/bin/env python # # A library that provides a Python interface to the Telegram Bot API # Copyright (C) 2015-2024 # Leandro Toledo de Souza <devs@python-telegram-bot.org> # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Lesser Public License as published by #...
#!/usr/bin/env python # # A library that provides a Python interface to the Telegram Bot API # Copyright (C) 2015-2024 # Leandro Toledo de Souza <devs@python-telegram-bot.org> # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Lesser Public License as published by #...
23,300
/home/hieuvd/dung_repo/raw/stars_01/python-telegram-bot_python-telegram-bot/python-telegram-bot
/home/hieuvd/dung_repo/raw/stars_01/python-telegram-bot_python-telegram-bot/python-telegram-bot/telegram/_payment/orderinfo.py
73,75
31,84
de_json
OrderInfo
76,84
75,84
class OrderInfo(TelegramObject): """This object represents information about an order. Objects of this class are comparable in terms of equality. Two objects of this class are considered equal, if their :attr:`name`, :attr:`phone_number`, :attr:`email` and :attr:`shipping_address` are equal. Args:...
class OrderInfo(TelegramObject): """This object represents information about an order. Objects of this class are comparable in terms of equality. Two objects of this class are considered equal, if their :attr:`name`, :attr:`phone_number`, :attr:`email` and :attr:`shipping_address` are equal. Args:...
data = cls._parse_data(data) if not data: return cls() data["shipping_address"] = ShippingAddress.de_json(data.get("shipping_address"), bot) return super().de_json(data=data, bot=bot)
"""See :meth:`telegram.TelegramObject.de_json`.""" data = cls._parse_data(data) if not data: return cls() data["shipping_address"] = ShippingAddress.de_json(data.get("shipping_address"), bot) return super().de_json(data=data, bot=bot)
15
549
81
630
#!/usr/bin/env python # # A library that provides a Python interface to the Telegram Bot API # Copyright (C) 2015-2024 # Leandro Toledo de Souza <devs@python-telegram-bot.org> # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Lesser Public License as published by #...
#!/usr/bin/env python # # A library that provides a Python interface to the Telegram Bot API # Copyright (C) 2015-2024 # Leandro Toledo de Souza <devs@python-telegram-bot.org> # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Lesser Public License as published by #...
23,301
/home/hieuvd/dung_repo/raw/stars_01/python-telegram-bot_python-telegram-bot/python-telegram-bot
/home/hieuvd/dung_repo/raw/stars_01/python-telegram-bot_python-telegram-bot/python-telegram-bot/telegram/_payment/precheckoutquery.py
110,112
33,152
de_json
PreCheckoutQuery
113,123
112,123
class PreCheckoutQuery(TelegramObject): """This object contains information about an incoming pre-checkout query. Objects of this class are comparable in terms of equality. Two objects of this class are considered equal, if their :attr:`id` is equal. Note: In Python :keyword:`from` is a reserv...
class PreCheckoutQuery(TelegramObject): """This object contains information about an incoming pre-checkout query. Objects of this class are comparable in terms of equality. Two objects of this class are considered equal, if their :attr:`id` is equal. Note: In Python :keyword:`from` is a reserv...
data = cls._parse_data(data) if not data: return None data["from_user"] = User.de_json(data.pop("from", None), bot) data["order_info"] = OrderInfo.de_json(data.get("order_info"), bot) return super().de_json(data=data, bot=bot)
"""See :meth:`telegram.TelegramObject.de_json`.""" data = cls._parse_data(data) if not data: return None data["from_user"] = User.de_json(data.pop("from", None), bot) data["order_info"] = OrderInfo.de_json(data.get("order_info"), bot) return super().de_json...
20
1,328
105
1,433
#!/usr/bin/env python # # A library that provides a Python interface to the Telegram Bot API # Copyright (C) 2015-2024 # Leandro Toledo de Souza <devs@python-telegram-bot.org> # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Lesser Public License as published by #...
#!/usr/bin/env python # # A library that provides a Python interface to the Telegram Bot API # Copyright (C) 2015-2024 # Leandro Toledo de Souza <devs@python-telegram-bot.org> # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Lesser Public License as published by #...
23,302
/home/hieuvd/dung_repo/raw/stars_01/python-telegram-bot_python-telegram-bot/python-telegram-bot
/home/hieuvd/dung_repo/raw/stars_01/python-telegram-bot_python-telegram-bot/python-telegram-bot/telegram/_payment/shippingquery.py
92,104
34,123
answer
ShippingQuery
112,123
104,123
class ShippingQuery(TelegramObject): """This object contains information about an incoming shipping query. Objects of this class are comparable in terms of equality. Two objects of this class are considered equal, if their :attr:`id` is equal. Note: In Python :keyword:`from` is a reserved word...
class ShippingQuery(TelegramObject): """This object contains information about an incoming shipping query. Objects of this class are comparable in terms of equality. Two objects of this class are considered equal, if their :attr:`id` is equal. Note: In Python :keyword:`from` is a reserved word...
return await self.get_bot().answer_shipping_query( shipping_query_id=self.id, ok=ok, shipping_options=shipping_options, error_message=error_message, read_timeout=read_timeout, write_timeout=write_timeout, connect_timeout=connect...
"""Shortcut for:: await bot.answer_shipping_query(update.shipping_query.id, *args, **kwargs) For the documentation of the arguments, please see :meth:`telegram.Bot.answer_shipping_query`. """ return await self.get_bot().answer_shipping_query( shipping_...
13
863
120
983
#!/usr/bin/env python # # A library that provides a Python interface to the Telegram Bot API # Copyright (C) 2015-2024 # Leandro Toledo de Souza <devs@python-telegram-bot.org> # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Lesser Public License as published by #...
#!/usr/bin/env python # # A library that provides a Python interface to the Telegram Bot API # Copyright (C) 2015-2024 # Leandro Toledo de Souza <devs@python-telegram-bot.org> # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Lesser Public License as published by #...
23,303
/home/hieuvd/dung_repo/raw/stars_01/python-telegram-bot_python-telegram-bot/python-telegram-bot
/home/hieuvd/dung_repo/raw/stars_01/python-telegram-bot_python-telegram-bot/python-telegram-bot/telegram/_payment/successfulpayment.py
105,107
31,116
de_json
SuccessfulPayment
108,116
107,116
class SuccessfulPayment(TelegramObject): """This object contains basic information about a successful payment. Objects of this class are comparable in terms of equality. Two objects of this class are considered equal, if their :attr:`telegram_payment_charge_id` and :attr:`provider_payment_charge_id` ar...
class SuccessfulPayment(TelegramObject): """This object contains basic information about a successful payment. Objects of this class are comparable in terms of equality. Two objects of this class are considered equal, if their :attr:`telegram_payment_charge_id` and :attr:`provider_payment_charge_id` ar...
data = cls._parse_data(data) if not data: return None data["order_info"] = OrderInfo.de_json(data.get("order_info"), bot) return super().de_json(data=data, bot=bot)
"""See :meth:`telegram.TelegramObject.de_json`.""" data = cls._parse_data(data) if not data: return None data["order_info"] = OrderInfo.de_json(data.get("order_info"), bot) return super().de_json(data=data, bot=bot)
15
1,080
77
1,157
#!/usr/bin/env python # # A library that provides a Python interface to the Telegram Bot API # Copyright (C) 2015-2024 # Leandro Toledo de Souza <devs@python-telegram-bot.org> # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Lesser Public License as published by #...
#!/usr/bin/env python # # A library that provides a Python interface to the Telegram Bot API # Copyright (C) 2015-2024 # Leandro Toledo de Souza <devs@python-telegram-bot.org> # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Lesser Public License as published by #...
23,305
/home/hieuvd/dung_repo/raw/stars_01/python-telegram-bot_python-telegram-bot/python-telegram-bot
/home/hieuvd/dung_repo/raw/stars_01/python-telegram-bot_python-telegram-bot/python-telegram-bot/telegram/_poll.py
160,162
81,174
de_json
PollAnswer
163,174
162,174
class PollAnswer(TelegramObject): """ This object represents an answer of a user in a non-anonymous poll. Objects of this class are comparable in terms of equality. Two objects of this class are considered equal, if their :attr:`poll_id`, :attr:`user` and :attr:`option_ids` are equal. .. versionch...
class PollAnswer(TelegramObject): """ This object represents an answer of a user in a non-anonymous poll. Objects of this class are comparable in terms of equality. Two objects of this class are considered equal, if their :attr:`poll_id`, :attr:`user` and :attr:`option_ids` are equal. .. versionch...
data = cls._parse_data(data) if not data: return None data["user"] = User.de_json(data.get("user"), bot) data["voter_chat"] = Chat.de_json(data.get("voter_chat"), bot) return super().de_json(data=data, bot=bot)
"""See :meth:`telegram.TelegramObject.de_json`.""" data = cls._parse_data(data) if not data: return None data["user"] = User.de_json(data.get("user"), bot) data["voter_chat"] = Chat.de_json(data.get("voter_chat"), bot) return super().de_json(data=data, bot=...
19
976
104
1,080
#!/usr/bin/env python # # A library that provides a Python interface to the Telegram Bot API # Copyright (C) 2015-2024 # Leandro Toledo de Souza <devs@python-telegram-bot.org> # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Lesser Public License as published by #...
#!/usr/bin/env python # # A library that provides a Python interface to the Telegram Bot API # Copyright (C) 2015-2024 # Leandro Toledo de Souza <devs@python-telegram-bot.org> # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Lesser Public License as published by #...
23,306
/home/hieuvd/dung_repo/raw/stars_01/python-telegram-bot_python-telegram-bot/python-telegram-bot
/home/hieuvd/dung_repo/raw/stars_01/python-telegram-bot_python-telegram-bot/python-telegram-bot/telegram/_proximityalerttriggered.py
69,71
30,81
de_json
ProximityAlertTriggered
72,81
71,81
class ProximityAlertTriggered(TelegramObject): """ This object represents the content of a service message, sent whenever a user in the chat triggers a proximity alert set by another user. Objects of this class are comparable in terms of equality. Two objects of this class are considered equal, if ...
class ProximityAlertTriggered(TelegramObject): """ This object represents the content of a service message, sent whenever a user in the chat triggers a proximity alert set by another user. Objects of this class are comparable in terms of equality. Two objects of this class are considered equal, if ...
data = cls._parse_data(data) if not data: return None data["traveler"] = User.de_json(data.get("traveler"), bot) data["watcher"] = User.de_json(data.get("watcher"), bot) return super().de_json(data=data, bot=bot)
"""See :meth:`telegram.TelegramObject.de_json`.""" data = cls._parse_data(data) if not data: return None data["traveler"] = User.de_json(data.get("traveler"), bot) data["watcher"] = User.de_json(data.get("watcher"), bot) return super().de_json(data=data, bo...
19
458
100
558
#!/usr/bin/env python # # A library that provides a Python interface to the Telegram Bot API # Copyright (C) 2015-2024 # Leandro Toledo de Souza <devs@python-telegram-bot.org> # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Lesser Public License as published by #...
#!/usr/bin/env python # # A library that provides a Python interface to the Telegram Bot API # Copyright (C) 2015-2024 # Leandro Toledo de Souza <devs@python-telegram-bot.org> # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Lesser Public License as published by #...
23,307
/home/hieuvd/dung_repo/raw/stars_01/python-telegram-bot_python-telegram-bot/python-telegram-bot
/home/hieuvd/dung_repo/raw/stars_01/python-telegram-bot_python-telegram-bot/python-telegram-bot/telegram/_reaction.py
194,196
153,205
de_json
ReactionCount
197,205
196,205
class ReactionCount(TelegramObject): """This class represents a reaction added to a message along with the number of times it was added. Objects of this class are comparable in terms of equality. Two objects of this class are considered equal, if the :attr:`type` and :attr:`total_count` is equal. ...
class ReactionCount(TelegramObject): """This class represents a reaction added to a message along with the number of times it was added. Objects of this class are comparable in terms of equality. Two objects of this class are considered equal, if the :attr:`type` and :attr:`total_count` is equal. ...
data = cls._parse_data(data) if not data: return None data["type"] = ReactionType.de_json(data.get("type"), bot) return super().de_json(data=data, bot=bot)
"""See :meth:`telegram.TelegramObject.de_json`.""" data = cls._parse_data(data) if not data: return None data["type"] = ReactionType.de_json(data.get("type"), bot) return super().de_json(data=data, bot=bot)
15
426
74
500
#!/usr/bin/env python # # A library that provides a Python interface to the Telegram Bot API # Copyright (C) 2015-2024 # Leandro Toledo de Souza <devs@python-telegram-bot.org> # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Lesser Public License as published by #...
#!/usr/bin/env python # # A library that provides a Python interface to the Telegram Bot API # Copyright (C) 2015-2024 # Leandro Toledo de Souza <devs@python-telegram-bot.org> # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Lesser Public License as published by #...
23,308
/home/hieuvd/dung_repo/raw/stars_01/python-telegram-bot_python-telegram-bot/python-telegram-bot
/home/hieuvd/dung_repo/raw/stars_01/python-telegram-bot_python-telegram-bot/python-telegram-bot/telegram/_reaction.py
67,69
31,84
de_json
ReactionType
70,84
69,84
class ReactionType(TelegramObject): """Base class for Telegram ReactionType Objects. There exist :class:`telegram.ReactionTypeEmoji` and :class:`telegram.ReactionTypeCustomEmoji`. .. versionadded:: 20.8 Args: type (:obj:`str`): Type of the reaction. Can be :attr:`~telegram.Reaction...
class ReactionType(TelegramObject): """Base class for Telegram ReactionType Objects. There exist :class:`telegram.ReactionTypeEmoji` and :class:`telegram.ReactionTypeCustomEmoji`. .. versionadded:: 20.8 Args: type (:obj:`str`): Type of the reaction. Can be :attr:`~telegram.Reaction...
data = cls._parse_data(data) if not data: return None if cls is ReactionType and data.get("type") in [cls.EMOJI, cls.CUSTOM_EMOJI]: reaction_type = data.pop("type") if reaction_type == cls.EMOJI: return ReactionTypeEmoji.de_json(data=data, bo...
"""See :meth:`telegram.TelegramObject.de_json`.""" data = cls._parse_data(data) if not data: return None if cls is ReactionType and data.get("type") in [cls.EMOJI, cls.CUSTOM_EMOJI]: reaction_type = data.pop("type") if reaction_type == cls.EMOJI: ...
33
534
168
702
#!/usr/bin/env python # # A library that provides a Python interface to the Telegram Bot API # Copyright (C) 2015-2024 # Leandro Toledo de Souza <devs@python-telegram-bot.org> # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Lesser Public License as published by #...
#!/usr/bin/env python # # A library that provides a Python interface to the Telegram Bot API # Copyright (C) 2015-2024 # Leandro Toledo de Souza <devs@python-telegram-bot.org> # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Lesser Public License as published by #...