repo stringlengths 7 55 | path stringlengths 4 223 | func_name stringlengths 1 134 | original_string stringlengths 75 104k | language stringclasses 1
value | code stringlengths 75 104k | code_tokens listlengths 19 28.4k | docstring stringlengths 1 46.9k | docstring_tokens listlengths 1 1.97k | sha stringlengths 40 40 | url stringlengths 87 315 | partition stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|
aws/sagemaker-python-sdk | src/sagemaker/session.py | Session.default_bucket | def default_bucket(self):
"""Return the name of the default bucket to use in relevant Amazon SageMaker interactions.
Returns:
str: The name of the default bucket, which is of the form: ``sagemaker-{region}-{AWS account ID}``.
"""
if self._default_bucket:
return s... | python | def default_bucket(self):
"""Return the name of the default bucket to use in relevant Amazon SageMaker interactions.
Returns:
str: The name of the default bucket, which is of the form: ``sagemaker-{region}-{AWS account ID}``.
"""
if self._default_bucket:
return s... | [
"def",
"default_bucket",
"(",
"self",
")",
":",
"if",
"self",
".",
"_default_bucket",
":",
"return",
"self",
".",
"_default_bucket",
"account",
"=",
"self",
".",
"boto_session",
".",
"client",
"(",
"'sts'",
")",
".",
"get_caller_identity",
"(",
")",
"[",
"... | Return the name of the default bucket to use in relevant Amazon SageMaker interactions.
Returns:
str: The name of the default bucket, which is of the form: ``sagemaker-{region}-{AWS account ID}``. | [
"Return",
"the",
"name",
"of",
"the",
"default",
"bucket",
"to",
"use",
"in",
"relevant",
"Amazon",
"SageMaker",
"interactions",
"."
] | a9e724c7d3f5572b68c3903548c792a59d99799a | https://github.com/aws/sagemaker-python-sdk/blob/a9e724c7d3f5572b68c3903548c792a59d99799a/src/sagemaker/session.py#L171-L211 | train |
aws/sagemaker-python-sdk | src/sagemaker/session.py | Session.train | def train(self, input_mode, input_config, role, job_name, output_config, # noqa: C901
resource_config, vpc_config, hyperparameters, stop_condition, tags, metric_definitions,
enable_network_isolation=False, image=None, algorithm_arn=None,
encrypt_inter_container_traffic=False):... | python | def train(self, input_mode, input_config, role, job_name, output_config, # noqa: C901
resource_config, vpc_config, hyperparameters, stop_condition, tags, metric_definitions,
enable_network_isolation=False, image=None, algorithm_arn=None,
encrypt_inter_container_traffic=False):... | [
"def",
"train",
"(",
"self",
",",
"input_mode",
",",
"input_config",
",",
"role",
",",
"job_name",
",",
"output_config",
",",
"# noqa: C901",
"resource_config",
",",
"vpc_config",
",",
"hyperparameters",
",",
"stop_condition",
",",
"tags",
",",
"metric_definitions... | Create an Amazon SageMaker training job.
Args:
input_mode (str): The input mode that the algorithm supports. Valid modes:
* 'File' - Amazon SageMaker copies the training dataset from the S3 location to
a directory in the Docker container.
* 'Pipe... | [
"Create",
"an",
"Amazon",
"SageMaker",
"training",
"job",
"."
] | a9e724c7d3f5572b68c3903548c792a59d99799a | https://github.com/aws/sagemaker-python-sdk/blob/a9e724c7d3f5572b68c3903548c792a59d99799a/src/sagemaker/session.py#L213-L317 | train |
aws/sagemaker-python-sdk | src/sagemaker/session.py | Session.compile_model | def compile_model(self, input_model_config, output_model_config, role,
job_name, stop_condition, tags):
"""Create an Amazon SageMaker Neo compilation job.
Args:
input_model_config (dict): the trained model and the Amazon S3 location where it is stored.
outp... | python | def compile_model(self, input_model_config, output_model_config, role,
job_name, stop_condition, tags):
"""Create an Amazon SageMaker Neo compilation job.
Args:
input_model_config (dict): the trained model and the Amazon S3 location where it is stored.
outp... | [
"def",
"compile_model",
"(",
"self",
",",
"input_model_config",
",",
"output_model_config",
",",
"role",
",",
"job_name",
",",
"stop_condition",
",",
"tags",
")",
":",
"compilation_job_request",
"=",
"{",
"'InputConfig'",
":",
"input_model_config",
",",
"'OutputConf... | Create an Amazon SageMaker Neo compilation job.
Args:
input_model_config (dict): the trained model and the Amazon S3 location where it is stored.
output_model_config (dict): Identifies the Amazon S3 location where you want Amazon SageMaker Neo to save
the results of comp... | [
"Create",
"an",
"Amazon",
"SageMaker",
"Neo",
"compilation",
"job",
"."
] | a9e724c7d3f5572b68c3903548c792a59d99799a | https://github.com/aws/sagemaker-python-sdk/blob/a9e724c7d3f5572b68c3903548c792a59d99799a/src/sagemaker/session.py#L319-L351 | train |
aws/sagemaker-python-sdk | src/sagemaker/session.py | Session.tune | def tune(self, job_name, strategy, objective_type, objective_metric_name,
max_jobs, max_parallel_jobs, parameter_ranges,
static_hyperparameters, input_mode, metric_definitions,
role, input_config, output_config, resource_config, stop_condition, tags,
warm_start_config... | python | def tune(self, job_name, strategy, objective_type, objective_metric_name,
max_jobs, max_parallel_jobs, parameter_ranges,
static_hyperparameters, input_mode, metric_definitions,
role, input_config, output_config, resource_config, stop_condition, tags,
warm_start_config... | [
"def",
"tune",
"(",
"self",
",",
"job_name",
",",
"strategy",
",",
"objective_type",
",",
"objective_metric_name",
",",
"max_jobs",
",",
"max_parallel_jobs",
",",
"parameter_ranges",
",",
"static_hyperparameters",
",",
"input_mode",
",",
"metric_definitions",
",",
"... | Create an Amazon SageMaker hyperparameter tuning job
Args:
job_name (str): Name of the tuning job being created.
strategy (str): Strategy to be used for hyperparameter estimations.
objective_type (str): The type of the objective metric for evaluating training jobs. This valu... | [
"Create",
"an",
"Amazon",
"SageMaker",
"hyperparameter",
"tuning",
"job"
] | a9e724c7d3f5572b68c3903548c792a59d99799a | https://github.com/aws/sagemaker-python-sdk/blob/a9e724c7d3f5572b68c3903548c792a59d99799a/src/sagemaker/session.py#L353-L474 | train |
aws/sagemaker-python-sdk | src/sagemaker/session.py | Session.stop_tuning_job | def stop_tuning_job(self, name):
"""Stop the Amazon SageMaker hyperparameter tuning job with the specified name.
Args:
name (str): Name of the Amazon SageMaker hyperparameter tuning job.
Raises:
ClientError: If an error occurs while trying to stop the hyperparameter tun... | python | def stop_tuning_job(self, name):
"""Stop the Amazon SageMaker hyperparameter tuning job with the specified name.
Args:
name (str): Name of the Amazon SageMaker hyperparameter tuning job.
Raises:
ClientError: If an error occurs while trying to stop the hyperparameter tun... | [
"def",
"stop_tuning_job",
"(",
"self",
",",
"name",
")",
":",
"try",
":",
"LOGGER",
".",
"info",
"(",
"'Stopping tuning job: {}'",
".",
"format",
"(",
"name",
")",
")",
"self",
".",
"sagemaker_client",
".",
"stop_hyper_parameter_tuning_job",
"(",
"HyperParameter... | Stop the Amazon SageMaker hyperparameter tuning job with the specified name.
Args:
name (str): Name of the Amazon SageMaker hyperparameter tuning job.
Raises:
ClientError: If an error occurs while trying to stop the hyperparameter tuning job. | [
"Stop",
"the",
"Amazon",
"SageMaker",
"hyperparameter",
"tuning",
"job",
"with",
"the",
"specified",
"name",
"."
] | a9e724c7d3f5572b68c3903548c792a59d99799a | https://github.com/aws/sagemaker-python-sdk/blob/a9e724c7d3f5572b68c3903548c792a59d99799a/src/sagemaker/session.py#L476-L495 | train |
aws/sagemaker-python-sdk | src/sagemaker/session.py | Session.transform | def transform(self, job_name, model_name, strategy, max_concurrent_transforms, max_payload, env,
input_config, output_config, resource_config, tags):
"""Create an Amazon SageMaker transform job.
Args:
job_name (str): Name of the transform job being created.
mod... | python | def transform(self, job_name, model_name, strategy, max_concurrent_transforms, max_payload, env,
input_config, output_config, resource_config, tags):
"""Create an Amazon SageMaker transform job.
Args:
job_name (str): Name of the transform job being created.
mod... | [
"def",
"transform",
"(",
"self",
",",
"job_name",
",",
"model_name",
",",
"strategy",
",",
"max_concurrent_transforms",
",",
"max_payload",
",",
"env",
",",
"input_config",
",",
"output_config",
",",
"resource_config",
",",
"tags",
")",
":",
"transform_request",
... | Create an Amazon SageMaker transform job.
Args:
job_name (str): Name of the transform job being created.
model_name (str): Name of the SageMaker model being used for the transform job.
strategy (str): The strategy used to decide how to batch records in a single request.
... | [
"Create",
"an",
"Amazon",
"SageMaker",
"transform",
"job",
"."
] | a9e724c7d3f5572b68c3903548c792a59d99799a | https://github.com/aws/sagemaker-python-sdk/blob/a9e724c7d3f5572b68c3903548c792a59d99799a/src/sagemaker/session.py#L497-L541 | train |
aws/sagemaker-python-sdk | src/sagemaker/session.py | Session.create_model | def create_model(self, name, role, container_defs, vpc_config=None,
enable_network_isolation=False, primary_container=None,
tags=None):
"""Create an Amazon SageMaker ``Model``.
Specify the S3 location of the model artifacts and Docker image containing
th... | python | def create_model(self, name, role, container_defs, vpc_config=None,
enable_network_isolation=False, primary_container=None,
tags=None):
"""Create an Amazon SageMaker ``Model``.
Specify the S3 location of the model artifacts and Docker image containing
th... | [
"def",
"create_model",
"(",
"self",
",",
"name",
",",
"role",
",",
"container_defs",
",",
"vpc_config",
"=",
"None",
",",
"enable_network_isolation",
"=",
"False",
",",
"primary_container",
"=",
"None",
",",
"tags",
"=",
"None",
")",
":",
"if",
"container_de... | Create an Amazon SageMaker ``Model``.
Specify the S3 location of the model artifacts and Docker image containing
the inference code. Amazon SageMaker uses this information to deploy the
model in Amazon SageMaker. This method can also be used to create a Model for an Inference Pipeline
if... | [
"Create",
"an",
"Amazon",
"SageMaker",
"Model",
".",
"Specify",
"the",
"S3",
"location",
"of",
"the",
"model",
"artifacts",
"and",
"Docker",
"image",
"containing",
"the",
"inference",
"code",
".",
"Amazon",
"SageMaker",
"uses",
"this",
"information",
"to",
"de... | a9e724c7d3f5572b68c3903548c792a59d99799a | https://github.com/aws/sagemaker-python-sdk/blob/a9e724c7d3f5572b68c3903548c792a59d99799a/src/sagemaker/session.py#L543-L620 | train |
aws/sagemaker-python-sdk | src/sagemaker/session.py | Session.create_model_from_job | def create_model_from_job(self, training_job_name, name=None, role=None, primary_container_image=None,
model_data_url=None, env=None, vpc_config_override=vpc_utils.VPC_CONFIG_DEFAULT):
"""Create an Amazon SageMaker ``Model`` from a SageMaker Training Job.
Args:
... | python | def create_model_from_job(self, training_job_name, name=None, role=None, primary_container_image=None,
model_data_url=None, env=None, vpc_config_override=vpc_utils.VPC_CONFIG_DEFAULT):
"""Create an Amazon SageMaker ``Model`` from a SageMaker Training Job.
Args:
... | [
"def",
"create_model_from_job",
"(",
"self",
",",
"training_job_name",
",",
"name",
"=",
"None",
",",
"role",
"=",
"None",
",",
"primary_container_image",
"=",
"None",
",",
"model_data_url",
"=",
"None",
",",
"env",
"=",
"None",
",",
"vpc_config_override",
"="... | Create an Amazon SageMaker ``Model`` from a SageMaker Training Job.
Args:
training_job_name (str): The Amazon SageMaker Training Job name.
name (str): The name of the SageMaker ``Model`` to create (default: None).
If not specified, the training job name is used.
... | [
"Create",
"an",
"Amazon",
"SageMaker",
"Model",
"from",
"a",
"SageMaker",
"Training",
"Job",
"."
] | a9e724c7d3f5572b68c3903548c792a59d99799a | https://github.com/aws/sagemaker-python-sdk/blob/a9e724c7d3f5572b68c3903548c792a59d99799a/src/sagemaker/session.py#L622-L654 | train |
aws/sagemaker-python-sdk | src/sagemaker/session.py | Session.create_model_package_from_algorithm | def create_model_package_from_algorithm(self, name, description, algorithm_arn, model_data):
"""Create a SageMaker Model Package from the results of training with an Algorithm Package
Args:
name (str): ModelPackage name
description (str): Model Package description
al... | python | def create_model_package_from_algorithm(self, name, description, algorithm_arn, model_data):
"""Create a SageMaker Model Package from the results of training with an Algorithm Package
Args:
name (str): ModelPackage name
description (str): Model Package description
al... | [
"def",
"create_model_package_from_algorithm",
"(",
"self",
",",
"name",
",",
"description",
",",
"algorithm_arn",
",",
"model_data",
")",
":",
"request",
"=",
"{",
"'ModelPackageName'",
":",
"name",
",",
"'ModelPackageDescription'",
":",
"description",
",",
"'Source... | Create a SageMaker Model Package from the results of training with an Algorithm Package
Args:
name (str): ModelPackage name
description (str): Model Package description
algorithm_arn (str): arn or name of the algorithm used for training.
model_data (str): s3 URI ... | [
"Create",
"a",
"SageMaker",
"Model",
"Package",
"from",
"the",
"results",
"of",
"training",
"with",
"an",
"Algorithm",
"Package"
] | a9e724c7d3f5572b68c3903548c792a59d99799a | https://github.com/aws/sagemaker-python-sdk/blob/a9e724c7d3f5572b68c3903548c792a59d99799a/src/sagemaker/session.py#L656-L690 | train |
aws/sagemaker-python-sdk | src/sagemaker/session.py | Session.wait_for_model_package | def wait_for_model_package(self, model_package_name, poll=5):
"""Wait for an Amazon SageMaker endpoint deployment to complete.
Args:
endpoint (str): Name of the ``Endpoint`` to wait for.
poll (int): Polling interval in seconds (default: 5).
Returns:
dict: Re... | python | def wait_for_model_package(self, model_package_name, poll=5):
"""Wait for an Amazon SageMaker endpoint deployment to complete.
Args:
endpoint (str): Name of the ``Endpoint`` to wait for.
poll (int): Polling interval in seconds (default: 5).
Returns:
dict: Re... | [
"def",
"wait_for_model_package",
"(",
"self",
",",
"model_package_name",
",",
"poll",
"=",
"5",
")",
":",
"desc",
"=",
"_wait_until",
"(",
"lambda",
":",
"_create_model_package_status",
"(",
"self",
".",
"sagemaker_client",
",",
"model_package_name",
")",
",",
"... | Wait for an Amazon SageMaker endpoint deployment to complete.
Args:
endpoint (str): Name of the ``Endpoint`` to wait for.
poll (int): Polling interval in seconds (default: 5).
Returns:
dict: Return value from the ``DescribeEndpoint`` API. | [
"Wait",
"for",
"an",
"Amazon",
"SageMaker",
"endpoint",
"deployment",
"to",
"complete",
"."
] | a9e724c7d3f5572b68c3903548c792a59d99799a | https://github.com/aws/sagemaker-python-sdk/blob/a9e724c7d3f5572b68c3903548c792a59d99799a/src/sagemaker/session.py#L692-L710 | train |
aws/sagemaker-python-sdk | src/sagemaker/session.py | Session.create_endpoint_config | def create_endpoint_config(self, name, model_name, initial_instance_count, instance_type,
accelerator_type=None, tags=None, kms_key=None):
"""Create an Amazon SageMaker endpoint configuration.
The endpoint configuration identifies the Amazon SageMaker model (created using... | python | def create_endpoint_config(self, name, model_name, initial_instance_count, instance_type,
accelerator_type=None, tags=None, kms_key=None):
"""Create an Amazon SageMaker endpoint configuration.
The endpoint configuration identifies the Amazon SageMaker model (created using... | [
"def",
"create_endpoint_config",
"(",
"self",
",",
"name",
",",
"model_name",
",",
"initial_instance_count",
",",
"instance_type",
",",
"accelerator_type",
"=",
"None",
",",
"tags",
"=",
"None",
",",
"kms_key",
"=",
"None",
")",
":",
"LOGGER",
".",
"info",
"... | Create an Amazon SageMaker endpoint configuration.
The endpoint configuration identifies the Amazon SageMaker model (created using the
``CreateModel`` API) and the hardware configuration on which to deploy the model. Provide this
endpoint configuration to the ``CreateEndpoint`` API, which then ... | [
"Create",
"an",
"Amazon",
"SageMaker",
"endpoint",
"configuration",
"."
] | a9e724c7d3f5572b68c3903548c792a59d99799a | https://github.com/aws/sagemaker-python-sdk/blob/a9e724c7d3f5572b68c3903548c792a59d99799a/src/sagemaker/session.py#L712-L756 | train |
aws/sagemaker-python-sdk | src/sagemaker/session.py | Session.create_endpoint | def create_endpoint(self, endpoint_name, config_name, tags=None, wait=True):
"""Create an Amazon SageMaker ``Endpoint`` according to the endpoint configuration specified in the request.
Once the ``Endpoint`` is created, client applications can send requests to obtain inferences.
The endpoint co... | python | def create_endpoint(self, endpoint_name, config_name, tags=None, wait=True):
"""Create an Amazon SageMaker ``Endpoint`` according to the endpoint configuration specified in the request.
Once the ``Endpoint`` is created, client applications can send requests to obtain inferences.
The endpoint co... | [
"def",
"create_endpoint",
"(",
"self",
",",
"endpoint_name",
",",
"config_name",
",",
"tags",
"=",
"None",
",",
"wait",
"=",
"True",
")",
":",
"LOGGER",
".",
"info",
"(",
"'Creating endpoint with name {}'",
".",
"format",
"(",
"endpoint_name",
")",
")",
"tag... | Create an Amazon SageMaker ``Endpoint`` according to the endpoint configuration specified in the request.
Once the ``Endpoint`` is created, client applications can send requests to obtain inferences.
The endpoint configuration is created using the ``CreateEndpointConfig`` API.
Args:
... | [
"Create",
"an",
"Amazon",
"SageMaker",
"Endpoint",
"according",
"to",
"the",
"endpoint",
"configuration",
"specified",
"in",
"the",
"request",
"."
] | a9e724c7d3f5572b68c3903548c792a59d99799a | https://github.com/aws/sagemaker-python-sdk/blob/a9e724c7d3f5572b68c3903548c792a59d99799a/src/sagemaker/session.py#L758-L779 | train |
aws/sagemaker-python-sdk | src/sagemaker/session.py | Session.update_endpoint | def update_endpoint(self, endpoint_name, endpoint_config_name):
""" Update an Amazon SageMaker ``Endpoint`` according to the endpoint configuration specified in the request
Raise an error if endpoint with endpoint_name does not exist.
Args:
endpoint_name (str): Name of the Amazon S... | python | def update_endpoint(self, endpoint_name, endpoint_config_name):
""" Update an Amazon SageMaker ``Endpoint`` according to the endpoint configuration specified in the request
Raise an error if endpoint with endpoint_name does not exist.
Args:
endpoint_name (str): Name of the Amazon S... | [
"def",
"update_endpoint",
"(",
"self",
",",
"endpoint_name",
",",
"endpoint_config_name",
")",
":",
"if",
"not",
"_deployment_entity_exists",
"(",
"lambda",
":",
"self",
".",
"sagemaker_client",
".",
"describe_endpoint",
"(",
"EndpointName",
"=",
"endpoint_name",
")... | Update an Amazon SageMaker ``Endpoint`` according to the endpoint configuration specified in the request
Raise an error if endpoint with endpoint_name does not exist.
Args:
endpoint_name (str): Name of the Amazon SageMaker ``Endpoint`` to update.
endpoint_config_name (str): Nam... | [
"Update",
"an",
"Amazon",
"SageMaker",
"Endpoint",
"according",
"to",
"the",
"endpoint",
"configuration",
"specified",
"in",
"the",
"request"
] | a9e724c7d3f5572b68c3903548c792a59d99799a | https://github.com/aws/sagemaker-python-sdk/blob/a9e724c7d3f5572b68c3903548c792a59d99799a/src/sagemaker/session.py#L781-L799 | train |
aws/sagemaker-python-sdk | src/sagemaker/session.py | Session.delete_endpoint | def delete_endpoint(self, endpoint_name):
"""Delete an Amazon SageMaker ``Endpoint``.
Args:
endpoint_name (str): Name of the Amazon SageMaker ``Endpoint`` to delete.
"""
LOGGER.info('Deleting endpoint with name: {}'.format(endpoint_name))
self.sagemaker_client.delete... | python | def delete_endpoint(self, endpoint_name):
"""Delete an Amazon SageMaker ``Endpoint``.
Args:
endpoint_name (str): Name of the Amazon SageMaker ``Endpoint`` to delete.
"""
LOGGER.info('Deleting endpoint with name: {}'.format(endpoint_name))
self.sagemaker_client.delete... | [
"def",
"delete_endpoint",
"(",
"self",
",",
"endpoint_name",
")",
":",
"LOGGER",
".",
"info",
"(",
"'Deleting endpoint with name: {}'",
".",
"format",
"(",
"endpoint_name",
")",
")",
"self",
".",
"sagemaker_client",
".",
"delete_endpoint",
"(",
"EndpointName",
"="... | Delete an Amazon SageMaker ``Endpoint``.
Args:
endpoint_name (str): Name of the Amazon SageMaker ``Endpoint`` to delete. | [
"Delete",
"an",
"Amazon",
"SageMaker",
"Endpoint",
"."
] | a9e724c7d3f5572b68c3903548c792a59d99799a | https://github.com/aws/sagemaker-python-sdk/blob/a9e724c7d3f5572b68c3903548c792a59d99799a/src/sagemaker/session.py#L801-L808 | train |
aws/sagemaker-python-sdk | src/sagemaker/session.py | Session.delete_endpoint_config | def delete_endpoint_config(self, endpoint_config_name):
"""Delete an Amazon SageMaker endpoint configuration.
Args:
endpoint_config_name (str): Name of the Amazon SageMaker endpoint configuration to delete.
"""
LOGGER.info('Deleting endpoint configuration with name: {}'.form... | python | def delete_endpoint_config(self, endpoint_config_name):
"""Delete an Amazon SageMaker endpoint configuration.
Args:
endpoint_config_name (str): Name of the Amazon SageMaker endpoint configuration to delete.
"""
LOGGER.info('Deleting endpoint configuration with name: {}'.form... | [
"def",
"delete_endpoint_config",
"(",
"self",
",",
"endpoint_config_name",
")",
":",
"LOGGER",
".",
"info",
"(",
"'Deleting endpoint configuration with name: {}'",
".",
"format",
"(",
"endpoint_config_name",
")",
")",
"self",
".",
"sagemaker_client",
".",
"delete_endpoi... | Delete an Amazon SageMaker endpoint configuration.
Args:
endpoint_config_name (str): Name of the Amazon SageMaker endpoint configuration to delete. | [
"Delete",
"an",
"Amazon",
"SageMaker",
"endpoint",
"configuration",
"."
] | a9e724c7d3f5572b68c3903548c792a59d99799a | https://github.com/aws/sagemaker-python-sdk/blob/a9e724c7d3f5572b68c3903548c792a59d99799a/src/sagemaker/session.py#L810-L817 | train |
aws/sagemaker-python-sdk | src/sagemaker/session.py | Session.delete_model | def delete_model(self, model_name):
"""Delete an Amazon SageMaker Model.
Args:
model_name (str): Name of the Amazon SageMaker model to delete.
"""
LOGGER.info('Deleting model with name: {}'.format(model_name))
self.sagemaker_client.delete_model(ModelName=model_name) | python | def delete_model(self, model_name):
"""Delete an Amazon SageMaker Model.
Args:
model_name (str): Name of the Amazon SageMaker model to delete.
"""
LOGGER.info('Deleting model with name: {}'.format(model_name))
self.sagemaker_client.delete_model(ModelName=model_name) | [
"def",
"delete_model",
"(",
"self",
",",
"model_name",
")",
":",
"LOGGER",
".",
"info",
"(",
"'Deleting model with name: {}'",
".",
"format",
"(",
"model_name",
")",
")",
"self",
".",
"sagemaker_client",
".",
"delete_model",
"(",
"ModelName",
"=",
"model_name",
... | Delete an Amazon SageMaker Model.
Args:
model_name (str): Name of the Amazon SageMaker model to delete. | [
"Delete",
"an",
"Amazon",
"SageMaker",
"Model",
"."
] | a9e724c7d3f5572b68c3903548c792a59d99799a | https://github.com/aws/sagemaker-python-sdk/blob/a9e724c7d3f5572b68c3903548c792a59d99799a/src/sagemaker/session.py#L819-L827 | train |
aws/sagemaker-python-sdk | src/sagemaker/session.py | Session.wait_for_job | def wait_for_job(self, job, poll=5):
"""Wait for an Amazon SageMaker training job to complete.
Args:
job (str): Name of the training job to wait for.
poll (int): Polling interval in seconds (default: 5).
Returns:
(dict): Return value from the ``DescribeTrain... | python | def wait_for_job(self, job, poll=5):
"""Wait for an Amazon SageMaker training job to complete.
Args:
job (str): Name of the training job to wait for.
poll (int): Polling interval in seconds (default: 5).
Returns:
(dict): Return value from the ``DescribeTrain... | [
"def",
"wait_for_job",
"(",
"self",
",",
"job",
",",
"poll",
"=",
"5",
")",
":",
"desc",
"=",
"_wait_until_training_done",
"(",
"lambda",
"last_desc",
":",
"_train_done",
"(",
"self",
".",
"sagemaker_client",
",",
"job",
",",
"last_desc",
")",
",",
"None",... | Wait for an Amazon SageMaker training job to complete.
Args:
job (str): Name of the training job to wait for.
poll (int): Polling interval in seconds (default: 5).
Returns:
(dict): Return value from the ``DescribeTrainingJob`` API.
Raises:
Value... | [
"Wait",
"for",
"an",
"Amazon",
"SageMaker",
"training",
"job",
"to",
"complete",
"."
] | a9e724c7d3f5572b68c3903548c792a59d99799a | https://github.com/aws/sagemaker-python-sdk/blob/a9e724c7d3f5572b68c3903548c792a59d99799a/src/sagemaker/session.py#L829-L845 | train |
aws/sagemaker-python-sdk | src/sagemaker/session.py | Session.wait_for_compilation_job | def wait_for_compilation_job(self, job, poll=5):
"""Wait for an Amazon SageMaker Neo compilation job to complete.
Args:
job (str): Name of the compilation job to wait for.
poll (int): Polling interval in seconds (default: 5).
Returns:
(dict): Return value fr... | python | def wait_for_compilation_job(self, job, poll=5):
"""Wait for an Amazon SageMaker Neo compilation job to complete.
Args:
job (str): Name of the compilation job to wait for.
poll (int): Polling interval in seconds (default: 5).
Returns:
(dict): Return value fr... | [
"def",
"wait_for_compilation_job",
"(",
"self",
",",
"job",
",",
"poll",
"=",
"5",
")",
":",
"desc",
"=",
"_wait_until",
"(",
"lambda",
":",
"_compilation_job_status",
"(",
"self",
".",
"sagemaker_client",
",",
"job",
")",
",",
"poll",
")",
"self",
".",
... | Wait for an Amazon SageMaker Neo compilation job to complete.
Args:
job (str): Name of the compilation job to wait for.
poll (int): Polling interval in seconds (default: 5).
Returns:
(dict): Return value from the ``DescribeCompilationJob`` API.
Raises:
... | [
"Wait",
"for",
"an",
"Amazon",
"SageMaker",
"Neo",
"compilation",
"job",
"to",
"complete",
"."
] | a9e724c7d3f5572b68c3903548c792a59d99799a | https://github.com/aws/sagemaker-python-sdk/blob/a9e724c7d3f5572b68c3903548c792a59d99799a/src/sagemaker/session.py#L847-L862 | train |
aws/sagemaker-python-sdk | src/sagemaker/session.py | Session.wait_for_tuning_job | def wait_for_tuning_job(self, job, poll=5):
"""Wait for an Amazon SageMaker hyperparameter tuning job to complete.
Args:
job (str): Name of the tuning job to wait for.
poll (int): Polling interval in seconds (default: 5).
Returns:
(dict): Return value from t... | python | def wait_for_tuning_job(self, job, poll=5):
"""Wait for an Amazon SageMaker hyperparameter tuning job to complete.
Args:
job (str): Name of the tuning job to wait for.
poll (int): Polling interval in seconds (default: 5).
Returns:
(dict): Return value from t... | [
"def",
"wait_for_tuning_job",
"(",
"self",
",",
"job",
",",
"poll",
"=",
"5",
")",
":",
"desc",
"=",
"_wait_until",
"(",
"lambda",
":",
"_tuning_job_status",
"(",
"self",
".",
"sagemaker_client",
",",
"job",
")",
",",
"poll",
")",
"self",
".",
"_check_jo... | Wait for an Amazon SageMaker hyperparameter tuning job to complete.
Args:
job (str): Name of the tuning job to wait for.
poll (int): Polling interval in seconds (default: 5).
Returns:
(dict): Return value from the ``DescribeHyperParameterTuningJob`` API.
Ra... | [
"Wait",
"for",
"an",
"Amazon",
"SageMaker",
"hyperparameter",
"tuning",
"job",
"to",
"complete",
"."
] | a9e724c7d3f5572b68c3903548c792a59d99799a | https://github.com/aws/sagemaker-python-sdk/blob/a9e724c7d3f5572b68c3903548c792a59d99799a/src/sagemaker/session.py#L864-L879 | train |
aws/sagemaker-python-sdk | src/sagemaker/session.py | Session.wait_for_transform_job | def wait_for_transform_job(self, job, poll=5):
"""Wait for an Amazon SageMaker transform job to complete.
Args:
job (str): Name of the transform job to wait for.
poll (int): Polling interval in seconds (default: 5).
Returns:
(dict): Return value from the ``D... | python | def wait_for_transform_job(self, job, poll=5):
"""Wait for an Amazon SageMaker transform job to complete.
Args:
job (str): Name of the transform job to wait for.
poll (int): Polling interval in seconds (default: 5).
Returns:
(dict): Return value from the ``D... | [
"def",
"wait_for_transform_job",
"(",
"self",
",",
"job",
",",
"poll",
"=",
"5",
")",
":",
"desc",
"=",
"_wait_until",
"(",
"lambda",
":",
"_transform_job_status",
"(",
"self",
".",
"sagemaker_client",
",",
"job",
")",
",",
"poll",
")",
"self",
".",
"_ch... | Wait for an Amazon SageMaker transform job to complete.
Args:
job (str): Name of the transform job to wait for.
poll (int): Polling interval in seconds (default: 5).
Returns:
(dict): Return value from the ``DescribeTransformJob`` API.
Raises:
Va... | [
"Wait",
"for",
"an",
"Amazon",
"SageMaker",
"transform",
"job",
"to",
"complete",
"."
] | a9e724c7d3f5572b68c3903548c792a59d99799a | https://github.com/aws/sagemaker-python-sdk/blob/a9e724c7d3f5572b68c3903548c792a59d99799a/src/sagemaker/session.py#L881-L896 | train |
aws/sagemaker-python-sdk | src/sagemaker/session.py | Session._check_job_status | def _check_job_status(self, job, desc, status_key_name):
"""Check to see if the job completed successfully and, if not, construct and
raise a ValueError.
Args:
job (str): The name of the job to check.
desc (dict[str, str]): The result of ``describe_training_job()``.
... | python | def _check_job_status(self, job, desc, status_key_name):
"""Check to see if the job completed successfully and, if not, construct and
raise a ValueError.
Args:
job (str): The name of the job to check.
desc (dict[str, str]): The result of ``describe_training_job()``.
... | [
"def",
"_check_job_status",
"(",
"self",
",",
"job",
",",
"desc",
",",
"status_key_name",
")",
":",
"status",
"=",
"desc",
"[",
"status_key_name",
"]",
"# If the status is capital case, then convert it to Camel case",
"status",
"=",
"_STATUS_CODE_TABLE",
".",
"get",
"... | Check to see if the job completed successfully and, if not, construct and
raise a ValueError.
Args:
job (str): The name of the job to check.
desc (dict[str, str]): The result of ``describe_training_job()``.
status_key_name (str): Status key name to check for.
... | [
"Check",
"to",
"see",
"if",
"the",
"job",
"completed",
"successfully",
"and",
"if",
"not",
"construct",
"and",
"raise",
"a",
"ValueError",
"."
] | a9e724c7d3f5572b68c3903548c792a59d99799a | https://github.com/aws/sagemaker-python-sdk/blob/a9e724c7d3f5572b68c3903548c792a59d99799a/src/sagemaker/session.py#L898-L917 | train |
aws/sagemaker-python-sdk | src/sagemaker/session.py | Session.wait_for_endpoint | def wait_for_endpoint(self, endpoint, poll=5):
"""Wait for an Amazon SageMaker endpoint deployment to complete.
Args:
endpoint (str): Name of the ``Endpoint`` to wait for.
poll (int): Polling interval in seconds (default: 5).
Returns:
dict: Return value from... | python | def wait_for_endpoint(self, endpoint, poll=5):
"""Wait for an Amazon SageMaker endpoint deployment to complete.
Args:
endpoint (str): Name of the ``Endpoint`` to wait for.
poll (int): Polling interval in seconds (default: 5).
Returns:
dict: Return value from... | [
"def",
"wait_for_endpoint",
"(",
"self",
",",
"endpoint",
",",
"poll",
"=",
"5",
")",
":",
"desc",
"=",
"_wait_until",
"(",
"lambda",
":",
"_deploy_done",
"(",
"self",
".",
"sagemaker_client",
",",
"endpoint",
")",
",",
"poll",
")",
"status",
"=",
"desc"... | Wait for an Amazon SageMaker endpoint deployment to complete.
Args:
endpoint (str): Name of the ``Endpoint`` to wait for.
poll (int): Polling interval in seconds (default: 5).
Returns:
dict: Return value from the ``DescribeEndpoint`` API. | [
"Wait",
"for",
"an",
"Amazon",
"SageMaker",
"endpoint",
"deployment",
"to",
"complete",
"."
] | a9e724c7d3f5572b68c3903548c792a59d99799a | https://github.com/aws/sagemaker-python-sdk/blob/a9e724c7d3f5572b68c3903548c792a59d99799a/src/sagemaker/session.py#L919-L935 | train |
aws/sagemaker-python-sdk | src/sagemaker/session.py | Session.endpoint_from_job | def endpoint_from_job(self, job_name, initial_instance_count, instance_type,
deployment_image=None, name=None, role=None, wait=True,
model_environment_vars=None, vpc_config_override=vpc_utils.VPC_CONFIG_DEFAULT,
accelerator_type=None):
... | python | def endpoint_from_job(self, job_name, initial_instance_count, instance_type,
deployment_image=None, name=None, role=None, wait=True,
model_environment_vars=None, vpc_config_override=vpc_utils.VPC_CONFIG_DEFAULT,
accelerator_type=None):
... | [
"def",
"endpoint_from_job",
"(",
"self",
",",
"job_name",
",",
"initial_instance_count",
",",
"instance_type",
",",
"deployment_image",
"=",
"None",
",",
"name",
"=",
"None",
",",
"role",
"=",
"None",
",",
"wait",
"=",
"True",
",",
"model_environment_vars",
"=... | Create an ``Endpoint`` using the results of a successful training job.
Specify the job name, Docker image containing the inference code, and hardware configuration to deploy
the model. Internally the API, creates an Amazon SageMaker model (that describes the model artifacts and
the Docker image... | [
"Create",
"an",
"Endpoint",
"using",
"the",
"results",
"of",
"a",
"successful",
"training",
"job",
"."
] | a9e724c7d3f5572b68c3903548c792a59d99799a | https://github.com/aws/sagemaker-python-sdk/blob/a9e724c7d3f5572b68c3903548c792a59d99799a/src/sagemaker/session.py#L937-L985 | train |
aws/sagemaker-python-sdk | src/sagemaker/session.py | Session.endpoint_from_model_data | def endpoint_from_model_data(self, model_s3_location, deployment_image, initial_instance_count, instance_type,
name=None, role=None, wait=True, model_environment_vars=None, model_vpc_config=None,
accelerator_type=None):
"""Create and deploy to an... | python | def endpoint_from_model_data(self, model_s3_location, deployment_image, initial_instance_count, instance_type,
name=None, role=None, wait=True, model_environment_vars=None, model_vpc_config=None,
accelerator_type=None):
"""Create and deploy to an... | [
"def",
"endpoint_from_model_data",
"(",
"self",
",",
"model_s3_location",
",",
"deployment_image",
",",
"initial_instance_count",
",",
"instance_type",
",",
"name",
"=",
"None",
",",
"role",
"=",
"None",
",",
"wait",
"=",
"True",
",",
"model_environment_vars",
"="... | Create and deploy to an ``Endpoint`` using existing model data stored in S3.
Args:
model_s3_location (str): S3 URI of the model artifacts to use for the endpoint.
deployment_image (str): The Docker image which defines the runtime code to be used as
the entry point for ac... | [
"Create",
"and",
"deploy",
"to",
"an",
"Endpoint",
"using",
"existing",
"model",
"data",
"stored",
"in",
"S3",
"."
] | a9e724c7d3f5572b68c3903548c792a59d99799a | https://github.com/aws/sagemaker-python-sdk/blob/a9e724c7d3f5572b68c3903548c792a59d99799a/src/sagemaker/session.py#L987-L1042 | train |
aws/sagemaker-python-sdk | src/sagemaker/session.py | Session.endpoint_from_production_variants | def endpoint_from_production_variants(self, name, production_variants, tags=None, kms_key=None, wait=True):
"""Create an SageMaker ``Endpoint`` from a list of production variants.
Args:
name (str): The name of the ``Endpoint`` to create.
production_variants (list[dict[str, str]]... | python | def endpoint_from_production_variants(self, name, production_variants, tags=None, kms_key=None, wait=True):
"""Create an SageMaker ``Endpoint`` from a list of production variants.
Args:
name (str): The name of the ``Endpoint`` to create.
production_variants (list[dict[str, str]]... | [
"def",
"endpoint_from_production_variants",
"(",
"self",
",",
"name",
",",
"production_variants",
",",
"tags",
"=",
"None",
",",
"kms_key",
"=",
"None",
",",
"wait",
"=",
"True",
")",
":",
"if",
"not",
"_deployment_entity_exists",
"(",
"lambda",
":",
"self",
... | Create an SageMaker ``Endpoint`` from a list of production variants.
Args:
name (str): The name of the ``Endpoint`` to create.
production_variants (list[dict[str, str]]): The list of production variants to deploy.
tags (list[dict[str, str]]): A list of key-value pairs for ta... | [
"Create",
"an",
"SageMaker",
"Endpoint",
"from",
"a",
"list",
"of",
"production",
"variants",
"."
] | a9e724c7d3f5572b68c3903548c792a59d99799a | https://github.com/aws/sagemaker-python-sdk/blob/a9e724c7d3f5572b68c3903548c792a59d99799a/src/sagemaker/session.py#L1044-L1068 | train |
aws/sagemaker-python-sdk | src/sagemaker/session.py | Session.expand_role | def expand_role(self, role):
"""Expand an IAM role name into an ARN.
If the role is already in the form of an ARN, then the role is simply returned. Otherwise we retrieve the full
ARN and return it.
Args:
role (str): An AWS IAM role (either name or full ARN).
Retur... | python | def expand_role(self, role):
"""Expand an IAM role name into an ARN.
If the role is already in the form of an ARN, then the role is simply returned. Otherwise we retrieve the full
ARN and return it.
Args:
role (str): An AWS IAM role (either name or full ARN).
Retur... | [
"def",
"expand_role",
"(",
"self",
",",
"role",
")",
":",
"if",
"'/'",
"in",
"role",
":",
"return",
"role",
"else",
":",
"return",
"self",
".",
"boto_session",
".",
"resource",
"(",
"'iam'",
")",
".",
"Role",
"(",
"role",
")",
".",
"arn"
] | Expand an IAM role name into an ARN.
If the role is already in the form of an ARN, then the role is simply returned. Otherwise we retrieve the full
ARN and return it.
Args:
role (str): An AWS IAM role (either name or full ARN).
Returns:
str: The corresponding A... | [
"Expand",
"an",
"IAM",
"role",
"name",
"into",
"an",
"ARN",
"."
] | a9e724c7d3f5572b68c3903548c792a59d99799a | https://github.com/aws/sagemaker-python-sdk/blob/a9e724c7d3f5572b68c3903548c792a59d99799a/src/sagemaker/session.py#L1070-L1085 | train |
aws/sagemaker-python-sdk | src/sagemaker/session.py | Session.get_caller_identity_arn | def get_caller_identity_arn(self):
"""Returns the ARN user or role whose credentials are used to call the API.
Returns:
(str): The ARN user or role
"""
assumed_role = self.boto_session.client('sts').get_caller_identity()['Arn']
if 'AmazonSageMaker-ExecutionRole' in a... | python | def get_caller_identity_arn(self):
"""Returns the ARN user or role whose credentials are used to call the API.
Returns:
(str): The ARN user or role
"""
assumed_role = self.boto_session.client('sts').get_caller_identity()['Arn']
if 'AmazonSageMaker-ExecutionRole' in a... | [
"def",
"get_caller_identity_arn",
"(",
"self",
")",
":",
"assumed_role",
"=",
"self",
".",
"boto_session",
".",
"client",
"(",
"'sts'",
")",
".",
"get_caller_identity",
"(",
")",
"[",
"'Arn'",
"]",
"if",
"'AmazonSageMaker-ExecutionRole'",
"in",
"assumed_role",
"... | Returns the ARN user or role whose credentials are used to call the API.
Returns:
(str): The ARN user or role | [
"Returns",
"the",
"ARN",
"user",
"or",
"role",
"whose",
"credentials",
"are",
"used",
"to",
"call",
"the",
"API",
".",
"Returns",
":",
"(",
"str",
")",
":",
"The",
"ARN",
"user",
"or",
"role"
] | a9e724c7d3f5572b68c3903548c792a59d99799a | https://github.com/aws/sagemaker-python-sdk/blob/a9e724c7d3f5572b68c3903548c792a59d99799a/src/sagemaker/session.py#L1087-L1108 | train |
aws/sagemaker-python-sdk | src/sagemaker/session.py | Session.logs_for_job | def logs_for_job(self, job_name, wait=False, poll=10): # noqa: C901 - suppress complexity warning for this method
"""Display the logs for a given training job, optionally tailing them until the
job is complete. If the output is a tty or a Jupyter cell, it will be color-coded
based on which inst... | python | def logs_for_job(self, job_name, wait=False, poll=10): # noqa: C901 - suppress complexity warning for this method
"""Display the logs for a given training job, optionally tailing them until the
job is complete. If the output is a tty or a Jupyter cell, it will be color-coded
based on which inst... | [
"def",
"logs_for_job",
"(",
"self",
",",
"job_name",
",",
"wait",
"=",
"False",
",",
"poll",
"=",
"10",
")",
":",
"# noqa: C901 - suppress complexity warning for this method",
"description",
"=",
"self",
".",
"sagemaker_client",
".",
"describe_training_job",
"(",
"T... | Display the logs for a given training job, optionally tailing them until the
job is complete. If the output is a tty or a Jupyter cell, it will be color-coded
based on which instance the log entry is from.
Args:
job_name (str): Name of the training job to display the logs for.
... | [
"Display",
"the",
"logs",
"for",
"a",
"given",
"training",
"job",
"optionally",
"tailing",
"them",
"until",
"the",
"job",
"is",
"complete",
".",
"If",
"the",
"output",
"is",
"a",
"tty",
"or",
"a",
"Jupyter",
"cell",
"it",
"will",
"be",
"color",
"-",
"c... | a9e724c7d3f5572b68c3903548c792a59d99799a | https://github.com/aws/sagemaker-python-sdk/blob/a9e724c7d3f5572b68c3903548c792a59d99799a/src/sagemaker/session.py#L1110-L1226 | train |
aws/sagemaker-python-sdk | src/sagemaker/fw_registry.py | registry | def registry(region_name, framework=None):
"""
Return docker registry for the given AWS region for the given framework.
This is only used for SparkML and Scikit-learn for now.
"""
try:
account_id = image_registry_map[region_name][framework]
return get_ecr_image_uri_prefix(account_id,... | python | def registry(region_name, framework=None):
"""
Return docker registry for the given AWS region for the given framework.
This is only used for SparkML and Scikit-learn for now.
"""
try:
account_id = image_registry_map[region_name][framework]
return get_ecr_image_uri_prefix(account_id,... | [
"def",
"registry",
"(",
"region_name",
",",
"framework",
"=",
"None",
")",
":",
"try",
":",
"account_id",
"=",
"image_registry_map",
"[",
"region_name",
"]",
"[",
"framework",
"]",
"return",
"get_ecr_image_uri_prefix",
"(",
"account_id",
",",
"region_name",
")",... | Return docker registry for the given AWS region for the given framework.
This is only used for SparkML and Scikit-learn for now. | [
"Return",
"docker",
"registry",
"for",
"the",
"given",
"AWS",
"region",
"for",
"the",
"given",
"framework",
".",
"This",
"is",
"only",
"used",
"for",
"SparkML",
"and",
"Scikit",
"-",
"learn",
"for",
"now",
"."
] | a9e724c7d3f5572b68c3903548c792a59d99799a | https://github.com/aws/sagemaker-python-sdk/blob/a9e724c7d3f5572b68c3903548c792a59d99799a/src/sagemaker/fw_registry.py#L82-L92 | train |
aws/sagemaker-python-sdk | src/sagemaker/amazon/knn.py | KNN.create_model | def create_model(self, vpc_config_override=VPC_CONFIG_DEFAULT):
"""Return a :class:`~sagemaker.amazon.KNNModel` referencing the latest
s3 model data produced by this Estimator.
Args:
vpc_config_override (dict[str, list[str]]): Optional override for VpcConfig set on the model.
... | python | def create_model(self, vpc_config_override=VPC_CONFIG_DEFAULT):
"""Return a :class:`~sagemaker.amazon.KNNModel` referencing the latest
s3 model data produced by this Estimator.
Args:
vpc_config_override (dict[str, list[str]]): Optional override for VpcConfig set on the model.
... | [
"def",
"create_model",
"(",
"self",
",",
"vpc_config_override",
"=",
"VPC_CONFIG_DEFAULT",
")",
":",
"return",
"KNNModel",
"(",
"self",
".",
"model_data",
",",
"self",
".",
"role",
",",
"sagemaker_session",
"=",
"self",
".",
"sagemaker_session",
",",
"vpc_config... | Return a :class:`~sagemaker.amazon.KNNModel` referencing the latest
s3 model data produced by this Estimator.
Args:
vpc_config_override (dict[str, list[str]]): Optional override for VpcConfig set on the model.
Default: use subnets and security groups from this Estimator.
... | [
"Return",
"a",
":",
"class",
":",
"~sagemaker",
".",
"amazon",
".",
"KNNModel",
"referencing",
"the",
"latest",
"s3",
"model",
"data",
"produced",
"by",
"this",
"Estimator",
"."
] | a9e724c7d3f5572b68c3903548c792a59d99799a | https://github.com/aws/sagemaker-python-sdk/blob/a9e724c7d3f5572b68c3903548c792a59d99799a/src/sagemaker/amazon/knn.py#L102-L113 | train |
aws/sagemaker-python-sdk | src/sagemaker/local/utils.py | copy_directory_structure | def copy_directory_structure(destination_directory, relative_path):
"""Create all the intermediate directories required for relative_path to exist within destination_directory.
This assumes that relative_path is a directory located within root_dir.
Examples:
destination_directory: /tmp/destination
... | python | def copy_directory_structure(destination_directory, relative_path):
"""Create all the intermediate directories required for relative_path to exist within destination_directory.
This assumes that relative_path is a directory located within root_dir.
Examples:
destination_directory: /tmp/destination
... | [
"def",
"copy_directory_structure",
"(",
"destination_directory",
",",
"relative_path",
")",
":",
"full_path",
"=",
"os",
".",
"path",
".",
"join",
"(",
"destination_directory",
",",
"relative_path",
")",
"if",
"os",
".",
"path",
".",
"exists",
"(",
"full_path",
... | Create all the intermediate directories required for relative_path to exist within destination_directory.
This assumes that relative_path is a directory located within root_dir.
Examples:
destination_directory: /tmp/destination
relative_path: test/unit/
will create: /tmp/destination/t... | [
"Create",
"all",
"the",
"intermediate",
"directories",
"required",
"for",
"relative_path",
"to",
"exist",
"within",
"destination_directory",
".",
"This",
"assumes",
"that",
"relative_path",
"is",
"a",
"directory",
"located",
"within",
"root_dir",
"."
] | a9e724c7d3f5572b68c3903548c792a59d99799a | https://github.com/aws/sagemaker-python-sdk/blob/a9e724c7d3f5572b68c3903548c792a59d99799a/src/sagemaker/local/utils.py#L22-L40 | train |
aws/sagemaker-python-sdk | src/sagemaker/local/utils.py | move_to_destination | def move_to_destination(source, destination, job_name, sagemaker_session):
"""move source to destination. Can handle uploading to S3
Args:
source (str): root directory to move
destination (str): file:// or s3:// URI that source will be moved to.
job_name (str): SageMaker job name.
... | python | def move_to_destination(source, destination, job_name, sagemaker_session):
"""move source to destination. Can handle uploading to S3
Args:
source (str): root directory to move
destination (str): file:// or s3:// URI that source will be moved to.
job_name (str): SageMaker job name.
... | [
"def",
"move_to_destination",
"(",
"source",
",",
"destination",
",",
"job_name",
",",
"sagemaker_session",
")",
":",
"parsed_uri",
"=",
"urlparse",
"(",
"destination",
")",
"if",
"parsed_uri",
".",
"scheme",
"==",
"'file'",
":",
"recursive_copy",
"(",
"source",... | move source to destination. Can handle uploading to S3
Args:
source (str): root directory to move
destination (str): file:// or s3:// URI that source will be moved to.
job_name (str): SageMaker job name.
sagemaker_session (sagemaker.Session): a sagemaker_session to interact with S3 ... | [
"move",
"source",
"to",
"destination",
".",
"Can",
"handle",
"uploading",
"to",
"S3"
] | a9e724c7d3f5572b68c3903548c792a59d99799a | https://github.com/aws/sagemaker-python-sdk/blob/a9e724c7d3f5572b68c3903548c792a59d99799a/src/sagemaker/local/utils.py#L43-L68 | train |
aws/sagemaker-python-sdk | src/sagemaker/local/utils.py | recursive_copy | def recursive_copy(source, destination):
"""A wrapper around distutils.dir_util.copy_tree but won't throw any exception when the source
directory does not exist.
Args:
source (str): source path
destination (str): destination path
"""
if os.path.isdir(source):
copy_tree(sourc... | python | def recursive_copy(source, destination):
"""A wrapper around distutils.dir_util.copy_tree but won't throw any exception when the source
directory does not exist.
Args:
source (str): source path
destination (str): destination path
"""
if os.path.isdir(source):
copy_tree(sourc... | [
"def",
"recursive_copy",
"(",
"source",
",",
"destination",
")",
":",
"if",
"os",
".",
"path",
".",
"isdir",
"(",
"source",
")",
":",
"copy_tree",
"(",
"source",
",",
"destination",
")"
] | A wrapper around distutils.dir_util.copy_tree but won't throw any exception when the source
directory does not exist.
Args:
source (str): source path
destination (str): destination path | [
"A",
"wrapper",
"around",
"distutils",
".",
"dir_util",
".",
"copy_tree",
"but",
"won",
"t",
"throw",
"any",
"exception",
"when",
"the",
"source",
"directory",
"does",
"not",
"exist",
"."
] | a9e724c7d3f5572b68c3903548c792a59d99799a | https://github.com/aws/sagemaker-python-sdk/blob/a9e724c7d3f5572b68c3903548c792a59d99799a/src/sagemaker/local/utils.py#L71-L80 | train |
aws/sagemaker-python-sdk | src/sagemaker/mxnet/estimator.py | MXNet._prepare_init_params_from_job_description | def _prepare_init_params_from_job_description(cls, job_details, model_channel_name=None):
"""Convert the job description to init params that can be handled by the class constructor
Args:
job_details: the returned job details from a describe_training_job API call.
model_channel_n... | python | def _prepare_init_params_from_job_description(cls, job_details, model_channel_name=None):
"""Convert the job description to init params that can be handled by the class constructor
Args:
job_details: the returned job details from a describe_training_job API call.
model_channel_n... | [
"def",
"_prepare_init_params_from_job_description",
"(",
"cls",
",",
"job_details",
",",
"model_channel_name",
"=",
"None",
")",
":",
"init_params",
"=",
"super",
"(",
"MXNet",
",",
"cls",
")",
".",
"_prepare_init_params_from_job_description",
"(",
"job_details",
",",... | Convert the job description to init params that can be handled by the class constructor
Args:
job_details: the returned job details from a describe_training_job API call.
model_channel_name (str): Name of the channel where pre-trained model data will be downloaded.
Returns:
... | [
"Convert",
"the",
"job",
"description",
"to",
"init",
"params",
"that",
"can",
"be",
"handled",
"by",
"the",
"class",
"constructor"
] | a9e724c7d3f5572b68c3903548c792a59d99799a | https://github.com/aws/sagemaker-python-sdk/blob/a9e724c7d3f5572b68c3903548c792a59d99799a/src/sagemaker/mxnet/estimator.py#L123-L157 | train |
aws/sagemaker-python-sdk | src/sagemaker/transformer.py | Transformer.transform | def transform(self, data, data_type='S3Prefix', content_type=None, compression_type=None, split_type=None,
job_name=None):
"""Start a new transform job.
Args:
data (str): Input data location in S3.
data_type (str): What the S3 location defines (default: 'S3Pref... | python | def transform(self, data, data_type='S3Prefix', content_type=None, compression_type=None, split_type=None,
job_name=None):
"""Start a new transform job.
Args:
data (str): Input data location in S3.
data_type (str): What the S3 location defines (default: 'S3Pref... | [
"def",
"transform",
"(",
"self",
",",
"data",
",",
"data_type",
"=",
"'S3Prefix'",
",",
"content_type",
"=",
"None",
",",
"compression_type",
"=",
"None",
",",
"split_type",
"=",
"None",
",",
"job_name",
"=",
"None",
")",
":",
"local_mode",
"=",
"self",
... | Start a new transform job.
Args:
data (str): Input data location in S3.
data_type (str): What the S3 location defines (default: 'S3Prefix'). Valid values:
* 'S3Prefix' - the S3 URI defines a key name prefix. All objects with this prefix will be used as
... | [
"Start",
"a",
"new",
"transform",
"job",
"."
] | a9e724c7d3f5572b68c3903548c792a59d99799a | https://github.com/aws/sagemaker-python-sdk/blob/a9e724c7d3f5572b68c3903548c792a59d99799a/src/sagemaker/transformer.py#L81-L115 | train |
aws/sagemaker-python-sdk | src/sagemaker/transformer.py | Transformer.attach | def attach(cls, transform_job_name, sagemaker_session=None):
"""Attach an existing transform job to a new Transformer instance
Args:
transform_job_name (str): Name for the transform job to be attached.
sagemaker_session (sagemaker.session.Session): Session object which manages i... | python | def attach(cls, transform_job_name, sagemaker_session=None):
"""Attach an existing transform job to a new Transformer instance
Args:
transform_job_name (str): Name for the transform job to be attached.
sagemaker_session (sagemaker.session.Session): Session object which manages i... | [
"def",
"attach",
"(",
"cls",
",",
"transform_job_name",
",",
"sagemaker_session",
"=",
"None",
")",
":",
"sagemaker_session",
"=",
"sagemaker_session",
"or",
"Session",
"(",
")",
"job_details",
"=",
"sagemaker_session",
".",
"sagemaker_client",
".",
"describe_transf... | Attach an existing transform job to a new Transformer instance
Args:
transform_job_name (str): Name for the transform job to be attached.
sagemaker_session (sagemaker.session.Session): Session object which manages interactions with
Amazon SageMaker APIs and any other AWS... | [
"Attach",
"an",
"existing",
"transform",
"job",
"to",
"a",
"new",
"Transformer",
"instance"
] | a9e724c7d3f5572b68c3903548c792a59d99799a | https://github.com/aws/sagemaker-python-sdk/blob/a9e724c7d3f5572b68c3903548c792a59d99799a/src/sagemaker/transformer.py#L142-L163 | train |
aws/sagemaker-python-sdk | src/sagemaker/transformer.py | Transformer._prepare_init_params_from_job_description | def _prepare_init_params_from_job_description(cls, job_details):
"""Convert the transform job description to init params that can be handled by the class constructor
Args:
job_details (dict): the returned job details from a describe_transform_job API call.
Returns:
dict... | python | def _prepare_init_params_from_job_description(cls, job_details):
"""Convert the transform job description to init params that can be handled by the class constructor
Args:
job_details (dict): the returned job details from a describe_transform_job API call.
Returns:
dict... | [
"def",
"_prepare_init_params_from_job_description",
"(",
"cls",
",",
"job_details",
")",
":",
"init_params",
"=",
"dict",
"(",
")",
"init_params",
"[",
"'model_name'",
"]",
"=",
"job_details",
"[",
"'ModelName'",
"]",
"init_params",
"[",
"'instance_count'",
"]",
"... | Convert the transform job description to init params that can be handled by the class constructor
Args:
job_details (dict): the returned job details from a describe_transform_job API call.
Returns:
dict: The transformed init_params | [
"Convert",
"the",
"transform",
"job",
"description",
"to",
"init",
"params",
"that",
"can",
"be",
"handled",
"by",
"the",
"class",
"constructor"
] | a9e724c7d3f5572b68c3903548c792a59d99799a | https://github.com/aws/sagemaker-python-sdk/blob/a9e724c7d3f5572b68c3903548c792a59d99799a/src/sagemaker/transformer.py#L166-L190 | train |
google/sentencepiece | tensorflow/tf_sentencepiece/sentencepiece_processor_ops.py | piece_size | def piece_size(model_file=None, model_proto=None, name=None):
"""Returns the piece size (vocabulary size).
Args:
model_file: The sentencepiece model file path.
model_proto: The sentencepiece model serialized proto.
Either `model_file` or `model_proto` must be set.
name: The name argume... | python | def piece_size(model_file=None, model_proto=None, name=None):
"""Returns the piece size (vocabulary size).
Args:
model_file: The sentencepiece model file path.
model_proto: The sentencepiece model serialized proto.
Either `model_file` or `model_proto` must be set.
name: The name argume... | [
"def",
"piece_size",
"(",
"model_file",
"=",
"None",
",",
"model_proto",
"=",
"None",
",",
"name",
"=",
"None",
")",
":",
"return",
"_gen_sentencepiece_processor_op",
".",
"sentencepiece_get_piece_size",
"(",
"model_file",
"=",
"model_file",
",",
"model_proto",
"=... | Returns the piece size (vocabulary size).
Args:
model_file: The sentencepiece model file path.
model_proto: The sentencepiece model serialized proto.
Either `model_file` or `model_proto` must be set.
name: The name argument that is passed to the op function.
Returns:
A scalar repre... | [
"Returns",
"the",
"piece",
"size",
"(",
"vocabulary",
"size",
")",
"."
] | ffa2c8218f7afbb06d0c1bb87c82efb6867db41a | https://github.com/google/sentencepiece/blob/ffa2c8218f7afbb06d0c1bb87c82efb6867db41a/tensorflow/tf_sentencepiece/sentencepiece_processor_ops.py#L46-L59 | train |
google/sentencepiece | tensorflow/tf_sentencepiece/sentencepiece_processor_ops.py | piece_to_id | def piece_to_id(input, model_file=None, model_proto=None, name=None):
"""Converts piece into vocabulary id.
Args:
input: An arbitrary tensor of string.
model_file: The sentencepiece model file path.
model_proto: The sentencepiece model serialized proto.
Either `model_file` or `model_pr... | python | def piece_to_id(input, model_file=None, model_proto=None, name=None):
"""Converts piece into vocabulary id.
Args:
input: An arbitrary tensor of string.
model_file: The sentencepiece model file path.
model_proto: The sentencepiece model serialized proto.
Either `model_file` or `model_pr... | [
"def",
"piece_to_id",
"(",
"input",
",",
"model_file",
"=",
"None",
",",
"model_proto",
"=",
"None",
",",
"name",
"=",
"None",
")",
":",
"return",
"_gen_sentencepiece_processor_op",
".",
"sentencepiece_piece_to_id",
"(",
"input",
",",
"model_file",
"=",
"model_f... | Converts piece into vocabulary id.
Args:
input: An arbitrary tensor of string.
model_file: The sentencepiece model file path.
model_proto: The sentencepiece model serialized proto.
Either `model_file` or `model_proto` must be set.
name: The name argument that is passed to the op func... | [
"Converts",
"piece",
"into",
"vocabulary",
"id",
"."
] | ffa2c8218f7afbb06d0c1bb87c82efb6867db41a | https://github.com/google/sentencepiece/blob/ffa2c8218f7afbb06d0c1bb87c82efb6867db41a/tensorflow/tf_sentencepiece/sentencepiece_processor_ops.py#L62-L76 | train |
google/sentencepiece | tensorflow/tf_sentencepiece/sentencepiece_processor_ops.py | id_to_piece | def id_to_piece(input, model_file=None, model_proto=None, name=None):
"""Converts vocabulary id into piece.
Args:
input: An arbitrary tensor of int32.
model_file: The sentencepiece model file path.
model_proto: The sentencepiece model serialized proto.
Either `model_file` or `model_pro... | python | def id_to_piece(input, model_file=None, model_proto=None, name=None):
"""Converts vocabulary id into piece.
Args:
input: An arbitrary tensor of int32.
model_file: The sentencepiece model file path.
model_proto: The sentencepiece model serialized proto.
Either `model_file` or `model_pro... | [
"def",
"id_to_piece",
"(",
"input",
",",
"model_file",
"=",
"None",
",",
"model_proto",
"=",
"None",
",",
"name",
"=",
"None",
")",
":",
"return",
"_gen_sentencepiece_processor_op",
".",
"sentencepiece_id_to_piece",
"(",
"input",
",",
"model_file",
"=",
"model_f... | Converts vocabulary id into piece.
Args:
input: An arbitrary tensor of int32.
model_file: The sentencepiece model file path.
model_proto: The sentencepiece model serialized proto.
Either `model_file` or `model_proto` must be set.
name: The name argument that is passed to the op funct... | [
"Converts",
"vocabulary",
"id",
"into",
"piece",
"."
] | ffa2c8218f7afbb06d0c1bb87c82efb6867db41a | https://github.com/google/sentencepiece/blob/ffa2c8218f7afbb06d0c1bb87c82efb6867db41a/tensorflow/tf_sentencepiece/sentencepiece_processor_ops.py#L79-L93 | train |
google/sentencepiece | tensorflow/tf_sentencepiece/sentencepiece_processor_ops.py | is_unknown | def is_unknown(input, model_file=None, model_proto=None, name=None):
"""Returns true if input id is unknown piece.
Args:
input: An arbitrary tensor of int32.
model_file: The sentencepiece model file path.
model_proto: The sentencepiece model serialized proto.
Either `model_file` or `mo... | python | def is_unknown(input, model_file=None, model_proto=None, name=None):
"""Returns true if input id is unknown piece.
Args:
input: An arbitrary tensor of int32.
model_file: The sentencepiece model file path.
model_proto: The sentencepiece model serialized proto.
Either `model_file` or `mo... | [
"def",
"is_unknown",
"(",
"input",
",",
"model_file",
"=",
"None",
",",
"model_proto",
"=",
"None",
",",
"name",
"=",
"None",
")",
":",
"return",
"_gen_sentencepiece_processor_op",
".",
"sentencepiece_get_piece_type",
"(",
"input",
",",
"model_file",
"=",
"model... | Returns true if input id is unknown piece.
Args:
input: An arbitrary tensor of int32.
model_file: The sentencepiece model file path.
model_proto: The sentencepiece model serialized proto.
Either `model_file` or `model_proto` must be set.
name: The name argument that is passed to the ... | [
"Returns",
"true",
"if",
"input",
"id",
"is",
"unknown",
"piece",
"."
] | ffa2c8218f7afbb06d0c1bb87c82efb6867db41a | https://github.com/google/sentencepiece/blob/ffa2c8218f7afbb06d0c1bb87c82efb6867db41a/tensorflow/tf_sentencepiece/sentencepiece_processor_ops.py#L96-L111 | train |
google/sentencepiece | tensorflow/tf_sentencepiece/sentencepiece_processor_ops.py | is_control | def is_control(input, model_file=None, model_proto=None, name=None):
"""Returns true if input id is control piece.
Args:
input: An arbitrary tensor of int32.
model_file: The sentencepiece model file path.
model_proto: The sentencepiece model serialized proto.
Either `model_file` or `mo... | python | def is_control(input, model_file=None, model_proto=None, name=None):
"""Returns true if input id is control piece.
Args:
input: An arbitrary tensor of int32.
model_file: The sentencepiece model file path.
model_proto: The sentencepiece model serialized proto.
Either `model_file` or `mo... | [
"def",
"is_control",
"(",
"input",
",",
"model_file",
"=",
"None",
",",
"model_proto",
"=",
"None",
",",
"name",
"=",
"None",
")",
":",
"return",
"_gen_sentencepiece_processor_op",
".",
"sentencepiece_get_piece_type",
"(",
"input",
",",
"model_file",
"=",
"model... | Returns true if input id is control piece.
Args:
input: An arbitrary tensor of int32.
model_file: The sentencepiece model file path.
model_proto: The sentencepiece model serialized proto.
Either `model_file` or `model_proto` must be set.
name: The name argument that is passed to the ... | [
"Returns",
"true",
"if",
"input",
"id",
"is",
"control",
"piece",
"."
] | ffa2c8218f7afbb06d0c1bb87c82efb6867db41a | https://github.com/google/sentencepiece/blob/ffa2c8218f7afbb06d0c1bb87c82efb6867db41a/tensorflow/tf_sentencepiece/sentencepiece_processor_ops.py#L114-L129 | train |
google/sentencepiece | tensorflow/tf_sentencepiece/sentencepiece_processor_ops.py | is_unused | def is_unused(input, model_file=None, model_proto=None, name=None):
"""Returns true if input id is unused piece.
Args:
input: An arbitrary tensor of int32.
model_file: The sentencepiece model file path.
model_proto: The sentencepiece model serialized proto.
Either `model_file` or `mode... | python | def is_unused(input, model_file=None, model_proto=None, name=None):
"""Returns true if input id is unused piece.
Args:
input: An arbitrary tensor of int32.
model_file: The sentencepiece model file path.
model_proto: The sentencepiece model serialized proto.
Either `model_file` or `mode... | [
"def",
"is_unused",
"(",
"input",
",",
"model_file",
"=",
"None",
",",
"model_proto",
"=",
"None",
",",
"name",
"=",
"None",
")",
":",
"return",
"_gen_sentencepiece_processor_op",
".",
"sentencepiece_get_piece_type",
"(",
"input",
",",
"model_file",
"=",
"model_... | Returns true if input id is unused piece.
Args:
input: An arbitrary tensor of int32.
model_file: The sentencepiece model file path.
model_proto: The sentencepiece model serialized proto.
Either `model_file` or `model_proto` must be set.
name: The name argument that is passed to the o... | [
"Returns",
"true",
"if",
"input",
"id",
"is",
"unused",
"piece",
"."
] | ffa2c8218f7afbb06d0c1bb87c82efb6867db41a | https://github.com/google/sentencepiece/blob/ffa2c8218f7afbb06d0c1bb87c82efb6867db41a/tensorflow/tf_sentencepiece/sentencepiece_processor_ops.py#L132-L147 | train |
google/sentencepiece | tensorflow/tf_sentencepiece/sentencepiece_processor_ops.py | encode_dense | def encode_dense(input_sentences, nbest_size=0, alpha=1.0,
model_file=None, model_proto=None,
reverse=False, add_bos=False, add_eos=False,
out_type=tf.int32, name=None):
"""Encodes sentences into pieces in dense tensor format.
Args:
input_sentences: A 1D strin... | python | def encode_dense(input_sentences, nbest_size=0, alpha=1.0,
model_file=None, model_proto=None,
reverse=False, add_bos=False, add_eos=False,
out_type=tf.int32, name=None):
"""Encodes sentences into pieces in dense tensor format.
Args:
input_sentences: A 1D strin... | [
"def",
"encode_dense",
"(",
"input_sentences",
",",
"nbest_size",
"=",
"0",
",",
"alpha",
"=",
"1.0",
",",
"model_file",
"=",
"None",
",",
"model_proto",
"=",
"None",
",",
"reverse",
"=",
"False",
",",
"add_bos",
"=",
"False",
",",
"add_eos",
"=",
"False... | Encodes sentences into pieces in dense tensor format.
Args:
input_sentences: A 1D string tensor of arbitrary size holding the raw
text of input sentences.
nbest_size: A scalar or 1D tensor for sampling.
nbest_size = {0,1}: No sampling is performed.
nbest_s... | [
"Encodes",
"sentences",
"into",
"pieces",
"in",
"dense",
"tensor",
"format",
"."
] | ffa2c8218f7afbb06d0c1bb87c82efb6867db41a | https://github.com/google/sentencepiece/blob/ffa2c8218f7afbb06d0c1bb87c82efb6867db41a/tensorflow/tf_sentencepiece/sentencepiece_processor_ops.py#L150-L186 | train |
google/sentencepiece | tensorflow/tf_sentencepiece/sentencepiece_processor_ops.py | encode_sparse | def encode_sparse(input_sentences, nbest_size=0, alpha=1.0,
model_file=None, model_proto=None,
reverse=False, add_bos=False, add_eos=False,
out_type=tf.int32, name=None):
"""Encodes sentences into pieces in sparse tensor format.
Args:
input_sentences: A 1D ... | python | def encode_sparse(input_sentences, nbest_size=0, alpha=1.0,
model_file=None, model_proto=None,
reverse=False, add_bos=False, add_eos=False,
out_type=tf.int32, name=None):
"""Encodes sentences into pieces in sparse tensor format.
Args:
input_sentences: A 1D ... | [
"def",
"encode_sparse",
"(",
"input_sentences",
",",
"nbest_size",
"=",
"0",
",",
"alpha",
"=",
"1.0",
",",
"model_file",
"=",
"None",
",",
"model_proto",
"=",
"None",
",",
"reverse",
"=",
"False",
",",
"add_bos",
"=",
"False",
",",
"add_eos",
"=",
"Fals... | Encodes sentences into pieces in sparse tensor format.
Args:
input_sentences: A 1D string tensor of arbitrary size holding the raw
text of input sentences.
nbest_size: A scalar or 1D tensor for sampling.
nbest_size = {0,1}: No sampling is performed.
nbest_... | [
"Encodes",
"sentences",
"into",
"pieces",
"in",
"sparse",
"tensor",
"format",
"."
] | ffa2c8218f7afbb06d0c1bb87c82efb6867db41a | https://github.com/google/sentencepiece/blob/ffa2c8218f7afbb06d0c1bb87c82efb6867db41a/tensorflow/tf_sentencepiece/sentencepiece_processor_ops.py#L189-L227 | train |
google/sentencepiece | tensorflow/tf_sentencepiece/sentencepiece_processor_ops.py | decode | def decode(pieces, sequence_length, model_file=None, model_proto=None,
reverse=False, name=None):
"""Decode pieces into postprocessed text.
Args:
pieces: A 2D int32 or string tensor [batch_size x max_length] of
encoded sequences.
sequence_length: A 1D int32 tensor [batch_size] repres... | python | def decode(pieces, sequence_length, model_file=None, model_proto=None,
reverse=False, name=None):
"""Decode pieces into postprocessed text.
Args:
pieces: A 2D int32 or string tensor [batch_size x max_length] of
encoded sequences.
sequence_length: A 1D int32 tensor [batch_size] repres... | [
"def",
"decode",
"(",
"pieces",
",",
"sequence_length",
",",
"model_file",
"=",
"None",
",",
"model_proto",
"=",
"None",
",",
"reverse",
"=",
"False",
",",
"name",
"=",
"None",
")",
":",
"return",
"_gen_sentencepiece_processor_op",
".",
"sentencepiece_decode",
... | Decode pieces into postprocessed text.
Args:
pieces: A 2D int32 or string tensor [batch_size x max_length] of
encoded sequences.
sequence_length: A 1D int32 tensor [batch_size] representing the
length of pieces.
model_file: The sentencepiece model file path.
model_proto... | [
"Decode",
"pieces",
"into",
"postprocessed",
"text",
"."
] | ffa2c8218f7afbb06d0c1bb87c82efb6867db41a | https://github.com/google/sentencepiece/blob/ffa2c8218f7afbb06d0c1bb87c82efb6867db41a/tensorflow/tf_sentencepiece/sentencepiece_processor_ops.py#L230-L251 | train |
eternnoir/pyTelegramBotAPI | telebot/util.py | split_string | def split_string(text, chars_per_string):
"""
Splits one string into multiple strings, with a maximum amount of `chars_per_string` characters per string.
This is very useful for splitting one giant message into multiples.
:param text: The text to split
:param chars_per_string: The number of charact... | python | def split_string(text, chars_per_string):
"""
Splits one string into multiple strings, with a maximum amount of `chars_per_string` characters per string.
This is very useful for splitting one giant message into multiples.
:param text: The text to split
:param chars_per_string: The number of charact... | [
"def",
"split_string",
"(",
"text",
",",
"chars_per_string",
")",
":",
"return",
"[",
"text",
"[",
"i",
":",
"i",
"+",
"chars_per_string",
"]",
"for",
"i",
"in",
"range",
"(",
"0",
",",
"len",
"(",
"text",
")",
",",
"chars_per_string",
")",
"]"
] | Splits one string into multiple strings, with a maximum amount of `chars_per_string` characters per string.
This is very useful for splitting one giant message into multiples.
:param text: The text to split
:param chars_per_string: The number of characters per line the text is split into.
:return: The ... | [
"Splits",
"one",
"string",
"into",
"multiple",
"strings",
"with",
"a",
"maximum",
"amount",
"of",
"chars_per_string",
"characters",
"per",
"string",
".",
"This",
"is",
"very",
"useful",
"for",
"splitting",
"one",
"giant",
"message",
"into",
"multiples",
"."
] | 47b53b88123097f1b9562a6cd5d4e080b86185d1 | https://github.com/eternnoir/pyTelegramBotAPI/blob/47b53b88123097f1b9562a6cd5d4e080b86185d1/telebot/util.py#L186-L195 | train |
eternnoir/pyTelegramBotAPI | telebot/util.py | extract_arguments | def extract_arguments(text):
"""
Returns the argument after the command.
Examples:
extract_arguments("/get name"): 'name'
extract_arguments("/get"): ''
extract_arguments("/get@botName name"): 'name'
:param text: String to extract the arguments from a command
:return: the argume... | python | def extract_arguments(text):
"""
Returns the argument after the command.
Examples:
extract_arguments("/get name"): 'name'
extract_arguments("/get"): ''
extract_arguments("/get@botName name"): 'name'
:param text: String to extract the arguments from a command
:return: the argume... | [
"def",
"extract_arguments",
"(",
"text",
")",
":",
"regexp",
"=",
"re",
".",
"compile",
"(",
"\"/\\w*(@\\w*)*\\s*([\\s\\S]*)\"",
",",
"re",
".",
"IGNORECASE",
")",
"result",
"=",
"regexp",
".",
"match",
"(",
"text",
")",
"return",
"result",
".",
"group",
"... | Returns the argument after the command.
Examples:
extract_arguments("/get name"): 'name'
extract_arguments("/get"): ''
extract_arguments("/get@botName name"): 'name'
:param text: String to extract the arguments from a command
:return: the arguments if `text` is a command (according to ... | [
"Returns",
"the",
"argument",
"after",
"the",
"command",
".",
"Examples",
":",
"extract_arguments",
"(",
"/",
"get",
"name",
")",
":",
"name",
"extract_arguments",
"(",
"/",
"get",
")",
":",
"extract_arguments",
"(",
"/",
"get"
] | 47b53b88123097f1b9562a6cd5d4e080b86185d1 | https://github.com/eternnoir/pyTelegramBotAPI/blob/47b53b88123097f1b9562a6cd5d4e080b86185d1/telebot/util.py#L235-L249 | train |
eternnoir/pyTelegramBotAPI | examples/detailed_example/detailed_example.py | listener | def listener(messages):
"""
When new messages arrive TeleBot will call this function.
"""
for m in messages:
if m.content_type == 'text':
# print the sent message to the console
print(str(m.chat.first_name) + " [" + str(m.chat.id) + "]: " + m.text) | python | def listener(messages):
"""
When new messages arrive TeleBot will call this function.
"""
for m in messages:
if m.content_type == 'text':
# print the sent message to the console
print(str(m.chat.first_name) + " [" + str(m.chat.id) + "]: " + m.text) | [
"def",
"listener",
"(",
"messages",
")",
":",
"for",
"m",
"in",
"messages",
":",
"if",
"m",
".",
"content_type",
"==",
"'text'",
":",
"# print the sent message to the console",
"print",
"(",
"str",
"(",
"m",
".",
"chat",
".",
"first_name",
")",
"+",
"\" [\... | When new messages arrive TeleBot will call this function. | [
"When",
"new",
"messages",
"arrive",
"TeleBot",
"will",
"call",
"this",
"function",
"."
] | 47b53b88123097f1b9562a6cd5d4e080b86185d1 | https://github.com/eternnoir/pyTelegramBotAPI/blob/47b53b88123097f1b9562a6cd5d4e080b86185d1/examples/detailed_example/detailed_example.py#L42-L49 | train |
eternnoir/pyTelegramBotAPI | telebot/types.py | JsonDeserializable.check_json | def check_json(json_type):
"""
Checks whether json_type is a dict or a string. If it is already a dict, it is returned as-is.
If it is not, it is converted to a dict by means of json.loads(json_type)
:param json_type:
:return:
"""
try:
str_types = (str... | python | def check_json(json_type):
"""
Checks whether json_type is a dict or a string. If it is already a dict, it is returned as-is.
If it is not, it is converted to a dict by means of json.loads(json_type)
:param json_type:
:return:
"""
try:
str_types = (str... | [
"def",
"check_json",
"(",
"json_type",
")",
":",
"try",
":",
"str_types",
"=",
"(",
"str",
",",
"unicode",
")",
"except",
"NameError",
":",
"str_types",
"=",
"(",
"str",
",",
")",
"if",
"type",
"(",
"json_type",
")",
"==",
"dict",
":",
"return",
"jso... | Checks whether json_type is a dict or a string. If it is already a dict, it is returned as-is.
If it is not, it is converted to a dict by means of json.loads(json_type)
:param json_type:
:return: | [
"Checks",
"whether",
"json_type",
"is",
"a",
"dict",
"or",
"a",
"string",
".",
"If",
"it",
"is",
"already",
"a",
"dict",
"it",
"is",
"returned",
"as",
"-",
"is",
".",
"If",
"it",
"is",
"not",
"it",
"is",
"converted",
"to",
"a",
"dict",
"by",
"means... | 47b53b88123097f1b9562a6cd5d4e080b86185d1 | https://github.com/eternnoir/pyTelegramBotAPI/blob/47b53b88123097f1b9562a6cd5d4e080b86185d1/telebot/types.py#L62-L79 | train |
eternnoir/pyTelegramBotAPI | telebot/types.py | Message.__html_text | def __html_text(self, text, entities):
"""
Author: @sviat9440
Message: "*Test* parse _formatting_, [url](https://example.com), [text_mention](tg://user?id=123456) and mention @username"
Example:
message.html_text
>> "<b>Test</b> parse <i>formatting</i>, <a href=\... | python | def __html_text(self, text, entities):
"""
Author: @sviat9440
Message: "*Test* parse _formatting_, [url](https://example.com), [text_mention](tg://user?id=123456) and mention @username"
Example:
message.html_text
>> "<b>Test</b> parse <i>formatting</i>, <a href=\... | [
"def",
"__html_text",
"(",
"self",
",",
"text",
",",
"entities",
")",
":",
"if",
"not",
"entities",
":",
"return",
"text",
"_subs",
"=",
"{",
"\"bold\"",
":",
"\"<b>{text}</b>\"",
",",
"\"italic\"",
":",
"\"<i>{text}</i>\"",
",",
"\"pre\"",
":",
"\"<pre>{tex... | Author: @sviat9440
Message: "*Test* parse _formatting_, [url](https://example.com), [text_mention](tg://user?id=123456) and mention @username"
Example:
message.html_text
>> "<b>Test</b> parse <i>formatting</i>, <a href=\"https://example.com\">url</a>, <a href=\"tg://user?id=1234... | [
"Author",
":",
"@sviat9440",
"Message",
":",
"*",
"Test",
"*",
"parse",
"_formatting_",
"[",
"url",
"]",
"(",
"https",
":",
"//",
"example",
".",
"com",
")",
"[",
"text_mention",
"]",
"(",
"tg",
":",
"//",
"user?id",
"=",
"123456",
")",
"and",
"menti... | 47b53b88123097f1b9562a6cd5d4e080b86185d1 | https://github.com/eternnoir/pyTelegramBotAPI/blob/47b53b88123097f1b9562a6cd5d4e080b86185d1/telebot/types.py#L440-L495 | train |
eternnoir/pyTelegramBotAPI | telebot/types.py | ReplyKeyboardMarkup.add | def add(self, *args):
"""
This function adds strings to the keyboard, while not exceeding row_width.
E.g. ReplyKeyboardMarkup#add("A", "B", "C") yields the json result {keyboard: [["A"], ["B"], ["C"]]}
when row_width is set to 1.
When row_width is set to 2, the following is the r... | python | def add(self, *args):
"""
This function adds strings to the keyboard, while not exceeding row_width.
E.g. ReplyKeyboardMarkup#add("A", "B", "C") yields the json result {keyboard: [["A"], ["B"], ["C"]]}
when row_width is set to 1.
When row_width is set to 2, the following is the r... | [
"def",
"add",
"(",
"self",
",",
"*",
"args",
")",
":",
"i",
"=",
"1",
"row",
"=",
"[",
"]",
"for",
"button",
"in",
"args",
":",
"if",
"util",
".",
"is_string",
"(",
"button",
")",
":",
"row",
".",
"append",
"(",
"{",
"'text'",
":",
"button",
... | This function adds strings to the keyboard, while not exceeding row_width.
E.g. ReplyKeyboardMarkup#add("A", "B", "C") yields the json result {keyboard: [["A"], ["B"], ["C"]]}
when row_width is set to 1.
When row_width is set to 2, the following is the result of this function: {keyboard: [["A", ... | [
"This",
"function",
"adds",
"strings",
"to",
"the",
"keyboard",
"while",
"not",
"exceeding",
"row_width",
".",
"E",
".",
"g",
".",
"ReplyKeyboardMarkup#add",
"(",
"A",
"B",
"C",
")",
"yields",
"the",
"json",
"result",
"{",
"keyboard",
":",
"[[",
"A",
"]"... | 47b53b88123097f1b9562a6cd5d4e080b86185d1 | https://github.com/eternnoir/pyTelegramBotAPI/blob/47b53b88123097f1b9562a6cd5d4e080b86185d1/telebot/types.py#L755-L778 | train |
eternnoir/pyTelegramBotAPI | telebot/types.py | ReplyKeyboardMarkup.to_json | def to_json(self):
"""
Converts this object to its json representation following the Telegram API guidelines described here:
https://core.telegram.org/bots/api#replykeyboardmarkup
:return:
"""
json_dict = {'keyboard': self.keyboard}
if self.one_time_keyboard:
... | python | def to_json(self):
"""
Converts this object to its json representation following the Telegram API guidelines described here:
https://core.telegram.org/bots/api#replykeyboardmarkup
:return:
"""
json_dict = {'keyboard': self.keyboard}
if self.one_time_keyboard:
... | [
"def",
"to_json",
"(",
"self",
")",
":",
"json_dict",
"=",
"{",
"'keyboard'",
":",
"self",
".",
"keyboard",
"}",
"if",
"self",
".",
"one_time_keyboard",
":",
"json_dict",
"[",
"'one_time_keyboard'",
"]",
"=",
"True",
"if",
"self",
".",
"resize_keyboard",
"... | Converts this object to its json representation following the Telegram API guidelines described here:
https://core.telegram.org/bots/api#replykeyboardmarkup
:return: | [
"Converts",
"this",
"object",
"to",
"its",
"json",
"representation",
"following",
"the",
"Telegram",
"API",
"guidelines",
"described",
"here",
":",
"https",
":",
"//",
"core",
".",
"telegram",
".",
"org",
"/",
"bots",
"/",
"api#replykeyboardmarkup",
":",
"retu... | 47b53b88123097f1b9562a6cd5d4e080b86185d1 | https://github.com/eternnoir/pyTelegramBotAPI/blob/47b53b88123097f1b9562a6cd5d4e080b86185d1/telebot/types.py#L797-L813 | train |
eternnoir/pyTelegramBotAPI | telebot/types.py | InlineKeyboardMarkup.add | def add(self, *args):
"""
This function adds strings to the keyboard, while not exceeding row_width.
E.g. ReplyKeyboardMarkup#add("A", "B", "C") yields the json result {keyboard: [["A"], ["B"], ["C"]]}
when row_width is set to 1.
When row_width is set to 2, the following is the r... | python | def add(self, *args):
"""
This function adds strings to the keyboard, while not exceeding row_width.
E.g. ReplyKeyboardMarkup#add("A", "B", "C") yields the json result {keyboard: [["A"], ["B"], ["C"]]}
when row_width is set to 1.
When row_width is set to 2, the following is the r... | [
"def",
"add",
"(",
"self",
",",
"*",
"args",
")",
":",
"i",
"=",
"1",
"row",
"=",
"[",
"]",
"for",
"button",
"in",
"args",
":",
"row",
".",
"append",
"(",
"button",
".",
"to_dic",
"(",
")",
")",
"if",
"i",
"%",
"self",
".",
"row_width",
"==",... | This function adds strings to the keyboard, while not exceeding row_width.
E.g. ReplyKeyboardMarkup#add("A", "B", "C") yields the json result {keyboard: [["A"], ["B"], ["C"]]}
when row_width is set to 1.
When row_width is set to 2, the following is the result of this function: {keyboard: [["A", ... | [
"This",
"function",
"adds",
"strings",
"to",
"the",
"keyboard",
"while",
"not",
"exceeding",
"row_width",
".",
"E",
".",
"g",
".",
"ReplyKeyboardMarkup#add",
"(",
"A",
"B",
"C",
")",
"yields",
"the",
"json",
"result",
"{",
"keyboard",
":",
"[[",
"A",
"]"... | 47b53b88123097f1b9562a6cd5d4e080b86185d1 | https://github.com/eternnoir/pyTelegramBotAPI/blob/47b53b88123097f1b9562a6cd5d4e080b86185d1/telebot/types.py#L840-L858 | train |
eternnoir/pyTelegramBotAPI | telebot/types.py | InlineKeyboardMarkup.row | def row(self, *args):
"""
Adds a list of KeyboardButton to the keyboard. This function does not consider row_width.
ReplyKeyboardMarkup#row("A")#row("B", "C")#to_json() outputs '{keyboard: [["A"], ["B", "C"]]}'
See https://core.telegram.org/bots/api#inlinekeyboardmarkup
:param ar... | python | def row(self, *args):
"""
Adds a list of KeyboardButton to the keyboard. This function does not consider row_width.
ReplyKeyboardMarkup#row("A")#row("B", "C")#to_json() outputs '{keyboard: [["A"], ["B", "C"]]}'
See https://core.telegram.org/bots/api#inlinekeyboardmarkup
:param ar... | [
"def",
"row",
"(",
"self",
",",
"*",
"args",
")",
":",
"btn_array",
"=",
"[",
"]",
"for",
"button",
"in",
"args",
":",
"btn_array",
".",
"append",
"(",
"button",
".",
"to_dic",
"(",
")",
")",
"self",
".",
"keyboard",
".",
"append",
"(",
"btn_array"... | Adds a list of KeyboardButton to the keyboard. This function does not consider row_width.
ReplyKeyboardMarkup#row("A")#row("B", "C")#to_json() outputs '{keyboard: [["A"], ["B", "C"]]}'
See https://core.telegram.org/bots/api#inlinekeyboardmarkup
:param args: strings
:return: self, to allo... | [
"Adds",
"a",
"list",
"of",
"KeyboardButton",
"to",
"the",
"keyboard",
".",
"This",
"function",
"does",
"not",
"consider",
"row_width",
".",
"ReplyKeyboardMarkup#row",
"(",
"A",
")",
"#row",
"(",
"B",
"C",
")",
"#to_json",
"()",
"outputs",
"{",
"keyboard",
... | 47b53b88123097f1b9562a6cd5d4e080b86185d1 | https://github.com/eternnoir/pyTelegramBotAPI/blob/47b53b88123097f1b9562a6cd5d4e080b86185d1/telebot/types.py#L860-L872 | train |
eternnoir/pyTelegramBotAPI | telebot/apihelper.py | _make_request | def _make_request(token, method_name, method='get', params=None, files=None, base_url=API_URL):
"""
Makes a request to the Telegram API.
:param token: The bot's API token. (Created with @BotFather)
:param method_name: Name of the API method to be called. (E.g. 'getUpdates')
:param method: HTTP metho... | python | def _make_request(token, method_name, method='get', params=None, files=None, base_url=API_URL):
"""
Makes a request to the Telegram API.
:param token: The bot's API token. (Created with @BotFather)
:param method_name: Name of the API method to be called. (E.g. 'getUpdates')
:param method: HTTP metho... | [
"def",
"_make_request",
"(",
"token",
",",
"method_name",
",",
"method",
"=",
"'get'",
",",
"params",
"=",
"None",
",",
"files",
"=",
"None",
",",
"base_url",
"=",
"API_URL",
")",
":",
"request_url",
"=",
"base_url",
".",
"format",
"(",
"token",
",",
"... | Makes a request to the Telegram API.
:param token: The bot's API token. (Created with @BotFather)
:param method_name: Name of the API method to be called. (E.g. 'getUpdates')
:param method: HTTP method to be used. Defaults to 'get'.
:param params: Optional parameters. Should be a dictionary with key-val... | [
"Makes",
"a",
"request",
"to",
"the",
"Telegram",
"API",
".",
":",
"param",
"token",
":",
"The",
"bot",
"s",
"API",
"token",
".",
"(",
"Created",
"with"
] | 47b53b88123097f1b9562a6cd5d4e080b86185d1 | https://github.com/eternnoir/pyTelegramBotAPI/blob/47b53b88123097f1b9562a6cd5d4e080b86185d1/telebot/apihelper.py#L34-L56 | train |
eternnoir/pyTelegramBotAPI | telebot/apihelper.py | _check_result | def _check_result(method_name, result):
"""
Checks whether `result` is a valid API response.
A result is considered invalid if:
- The server returned an HTTP response code other than 200
- The content of the result is invalid JSON.
- The method call was unsuccessful (The JSON 'ok' fi... | python | def _check_result(method_name, result):
"""
Checks whether `result` is a valid API response.
A result is considered invalid if:
- The server returned an HTTP response code other than 200
- The content of the result is invalid JSON.
- The method call was unsuccessful (The JSON 'ok' fi... | [
"def",
"_check_result",
"(",
"method_name",
",",
"result",
")",
":",
"if",
"result",
".",
"status_code",
"!=",
"200",
":",
"msg",
"=",
"'The server returned HTTP {0} {1}. Response body:\\n[{2}]'",
".",
"format",
"(",
"result",
".",
"status_code",
",",
"result",
".... | Checks whether `result` is a valid API response.
A result is considered invalid if:
- The server returned an HTTP response code other than 200
- The content of the result is invalid JSON.
- The method call was unsuccessful (The JSON 'ok' field equals False)
:raises ApiException: if one ... | [
"Checks",
"whether",
"result",
"is",
"a",
"valid",
"API",
"response",
".",
"A",
"result",
"is",
"considered",
"invalid",
"if",
":",
"-",
"The",
"server",
"returned",
"an",
"HTTP",
"response",
"code",
"other",
"than",
"200",
"-",
"The",
"content",
"of",
"... | 47b53b88123097f1b9562a6cd5d4e080b86185d1 | https://github.com/eternnoir/pyTelegramBotAPI/blob/47b53b88123097f1b9562a6cd5d4e080b86185d1/telebot/apihelper.py#L59-L88 | train |
eternnoir/pyTelegramBotAPI | telebot/apihelper.py | send_message | def send_message(token, chat_id, text, disable_web_page_preview=None, reply_to_message_id=None, reply_markup=None,
parse_mode=None, disable_notification=None):
"""
Use this method to send text messages. On success, the sent Message is returned.
:param token:
:param chat_id:
:param t... | python | def send_message(token, chat_id, text, disable_web_page_preview=None, reply_to_message_id=None, reply_markup=None,
parse_mode=None, disable_notification=None):
"""
Use this method to send text messages. On success, the sent Message is returned.
:param token:
:param chat_id:
:param t... | [
"def",
"send_message",
"(",
"token",
",",
"chat_id",
",",
"text",
",",
"disable_web_page_preview",
"=",
"None",
",",
"reply_to_message_id",
"=",
"None",
",",
"reply_markup",
"=",
"None",
",",
"parse_mode",
"=",
"None",
",",
"disable_notification",
"=",
"None",
... | Use this method to send text messages. On success, the sent Message is returned.
:param token:
:param chat_id:
:param text:
:param disable_web_page_preview:
:param reply_to_message_id:
:param reply_markup:
:param parse_mode:
:param disable_notification:
:return: | [
"Use",
"this",
"method",
"to",
"send",
"text",
"messages",
".",
"On",
"success",
"the",
"sent",
"Message",
"is",
"returned",
".",
":",
"param",
"token",
":",
":",
"param",
"chat_id",
":",
":",
"param",
"text",
":",
":",
"param",
"disable_web_page_preview",... | 47b53b88123097f1b9562a6cd5d4e080b86185d1 | https://github.com/eternnoir/pyTelegramBotAPI/blob/47b53b88123097f1b9562a6cd5d4e080b86185d1/telebot/apihelper.py#L115-L141 | train |
eternnoir/pyTelegramBotAPI | telebot/apihelper.py | set_game_score | def set_game_score(token, user_id, score, force=None, disable_edit_message=None, chat_id=None, message_id=None,
inline_message_id=None):
"""
Use this method to set the score of the specified user in a game. On success, if the message was sent by the bot, returns the edited Message, otherwise ... | python | def set_game_score(token, user_id, score, force=None, disable_edit_message=None, chat_id=None, message_id=None,
inline_message_id=None):
"""
Use this method to set the score of the specified user in a game. On success, if the message was sent by the bot, returns the edited Message, otherwise ... | [
"def",
"set_game_score",
"(",
"token",
",",
"user_id",
",",
"score",
",",
"force",
"=",
"None",
",",
"disable_edit_message",
"=",
"None",
",",
"chat_id",
"=",
"None",
",",
"message_id",
"=",
"None",
",",
"inline_message_id",
"=",
"None",
")",
":",
"method_... | Use this method to set the score of the specified user in a game. On success, if the message was sent by the bot, returns the edited Message, otherwise returns True. Returns an error, if the new score is not greater than the user's current score in the chat.
:param token: Bot's token (you don't need to fill this)
... | [
"Use",
"this",
"method",
"to",
"set",
"the",
"score",
"of",
"the",
"specified",
"user",
"in",
"a",
"game",
".",
"On",
"success",
"if",
"the",
"message",
"was",
"sent",
"by",
"the",
"bot",
"returns",
"the",
"edited",
"Message",
"otherwise",
"returns",
"Tr... | 47b53b88123097f1b9562a6cd5d4e080b86185d1 | https://github.com/eternnoir/pyTelegramBotAPI/blob/47b53b88123097f1b9562a6cd5d4e080b86185d1/telebot/apihelper.py#L692-L718 | train |
eternnoir/pyTelegramBotAPI | telebot/apihelper.py | get_game_high_scores | def get_game_high_scores(token, user_id, chat_id=None, message_id=None, inline_message_id=None):
"""
Use this method to get data for high score tables. Will return the score of the specified user and several of his neighbors in a game. On success, returns an Array of GameHighScore objects.
This method will ... | python | def get_game_high_scores(token, user_id, chat_id=None, message_id=None, inline_message_id=None):
"""
Use this method to get data for high score tables. Will return the score of the specified user and several of his neighbors in a game. On success, returns an Array of GameHighScore objects.
This method will ... | [
"def",
"get_game_high_scores",
"(",
"token",
",",
"user_id",
",",
"chat_id",
"=",
"None",
",",
"message_id",
"=",
"None",
",",
"inline_message_id",
"=",
"None",
")",
":",
"method_url",
"=",
"r'getGameHighScores'",
"payload",
"=",
"{",
"'user_id'",
":",
"user_i... | Use this method to get data for high score tables. Will return the score of the specified user and several of his neighbors in a game. On success, returns an Array of GameHighScore objects.
This method will currently return scores for the target user, plus two of his closest neighbors on each side. Will also return... | [
"Use",
"this",
"method",
"to",
"get",
"data",
"for",
"high",
"score",
"tables",
".",
"Will",
"return",
"the",
"score",
"of",
"the",
"specified",
"user",
"and",
"several",
"of",
"his",
"neighbors",
"in",
"a",
"game",
".",
"On",
"success",
"returns",
"an",... | 47b53b88123097f1b9562a6cd5d4e080b86185d1 | https://github.com/eternnoir/pyTelegramBotAPI/blob/47b53b88123097f1b9562a6cd5d4e080b86185d1/telebot/apihelper.py#L722-L741 | train |
eternnoir/pyTelegramBotAPI | telebot/apihelper.py | send_invoice | def send_invoice(token, chat_id, title, description, invoice_payload, provider_token, currency, prices,
start_parameter, photo_url=None, photo_size=None, photo_width=None, photo_height=None,
need_name=None, need_phone_number=None, need_email=None, need_shipping_address=None, is_flexibl... | python | def send_invoice(token, chat_id, title, description, invoice_payload, provider_token, currency, prices,
start_parameter, photo_url=None, photo_size=None, photo_width=None, photo_height=None,
need_name=None, need_phone_number=None, need_email=None, need_shipping_address=None, is_flexibl... | [
"def",
"send_invoice",
"(",
"token",
",",
"chat_id",
",",
"title",
",",
"description",
",",
"invoice_payload",
",",
"provider_token",
",",
"currency",
",",
"prices",
",",
"start_parameter",
",",
"photo_url",
"=",
"None",
",",
"photo_size",
"=",
"None",
",",
... | Use this method to send invoices. On success, the sent Message is returned.
:param token: Bot's token (you don't need to fill this)
:param chat_id: Unique identifier for the target private chat
:param title: Product name
:param description: Product description
:param invoice_payload: Bot-defined inv... | [
"Use",
"this",
"method",
"to",
"send",
"invoices",
".",
"On",
"success",
"the",
"sent",
"Message",
"is",
"returned",
".",
":",
"param",
"token",
":",
"Bot",
"s",
"token",
"(",
"you",
"don",
"t",
"need",
"to",
"fill",
"this",
")",
":",
"param",
"chat_... | 47b53b88123097f1b9562a6cd5d4e080b86185d1 | https://github.com/eternnoir/pyTelegramBotAPI/blob/47b53b88123097f1b9562a6cd5d4e080b86185d1/telebot/apihelper.py#L746-L806 | train |
eternnoir/pyTelegramBotAPI | telebot/apihelper.py | answer_shipping_query | def answer_shipping_query(token, shipping_query_id, ok, shipping_options=None, error_message=None):
"""
If you sent an invoice requesting a shipping address and the parameter is_flexible was specified, the Bot API will send an Update with a shipping_query field to the bot. Use this method to reply to shipping q... | python | def answer_shipping_query(token, shipping_query_id, ok, shipping_options=None, error_message=None):
"""
If you sent an invoice requesting a shipping address and the parameter is_flexible was specified, the Bot API will send an Update with a shipping_query field to the bot. Use this method to reply to shipping q... | [
"def",
"answer_shipping_query",
"(",
"token",
",",
"shipping_query_id",
",",
"ok",
",",
"shipping_options",
"=",
"None",
",",
"error_message",
"=",
"None",
")",
":",
"method_url",
"=",
"'answerShippingQuery'",
"payload",
"=",
"{",
"'shipping_query_id'",
":",
"ship... | If you sent an invoice requesting a shipping address and the parameter is_flexible was specified, the Bot API will send an Update with a shipping_query field to the bot. Use this method to reply to shipping queries. On success, True is returned.
:param token: Bot's token (you don't need to fill this)
:param shi... | [
"If",
"you",
"sent",
"an",
"invoice",
"requesting",
"a",
"shipping",
"address",
"and",
"the",
"parameter",
"is_flexible",
"was",
"specified",
"the",
"Bot",
"API",
"will",
"send",
"an",
"Update",
"with",
"a",
"shipping_query",
"field",
"to",
"the",
"bot",
"."... | 47b53b88123097f1b9562a6cd5d4e080b86185d1 | https://github.com/eternnoir/pyTelegramBotAPI/blob/47b53b88123097f1b9562a6cd5d4e080b86185d1/telebot/apihelper.py#L809-L825 | train |
eternnoir/pyTelegramBotAPI | telebot/apihelper.py | answer_pre_checkout_query | def answer_pre_checkout_query(token, pre_checkout_query_id, ok, error_message=None):
"""
Once the user has confirmed their payment and shipping details, the Bot API sends the final confirmation in the form of an Update with the field pre_checkout_query. Use this method to respond to such pre-checkout queries. O... | python | def answer_pre_checkout_query(token, pre_checkout_query_id, ok, error_message=None):
"""
Once the user has confirmed their payment and shipping details, the Bot API sends the final confirmation in the form of an Update with the field pre_checkout_query. Use this method to respond to such pre-checkout queries. O... | [
"def",
"answer_pre_checkout_query",
"(",
"token",
",",
"pre_checkout_query_id",
",",
"ok",
",",
"error_message",
"=",
"None",
")",
":",
"method_url",
"=",
"'answerPreCheckoutQuery'",
"payload",
"=",
"{",
"'pre_checkout_query_id'",
":",
"pre_checkout_query_id",
",",
"'... | Once the user has confirmed their payment and shipping details, the Bot API sends the final confirmation in the form of an Update with the field pre_checkout_query. Use this method to respond to such pre-checkout queries. On success, True is returned. Note: The Bot API must receive an answer within 10 seconds after the... | [
"Once",
"the",
"user",
"has",
"confirmed",
"their",
"payment",
"and",
"shipping",
"details",
"the",
"Bot",
"API",
"sends",
"the",
"final",
"confirmation",
"in",
"the",
"form",
"of",
"an",
"Update",
"with",
"the",
"field",
"pre_checkout_query",
".",
"Use",
"t... | 47b53b88123097f1b9562a6cd5d4e080b86185d1 | https://github.com/eternnoir/pyTelegramBotAPI/blob/47b53b88123097f1b9562a6cd5d4e080b86185d1/telebot/apihelper.py#L828-L841 | train |
eternnoir/pyTelegramBotAPI | telebot/apihelper.py | answer_callback_query | def answer_callback_query(token, callback_query_id, text=None, show_alert=None, url=None, cache_time=None):
"""
Use this method to send answers to callback queries sent from inline keyboards. The answer will be displayed to the user as a notification at the top of the chat screen or as an alert. On success, Tru... | python | def answer_callback_query(token, callback_query_id, text=None, show_alert=None, url=None, cache_time=None):
"""
Use this method to send answers to callback queries sent from inline keyboards. The answer will be displayed to the user as a notification at the top of the chat screen or as an alert. On success, Tru... | [
"def",
"answer_callback_query",
"(",
"token",
",",
"callback_query_id",
",",
"text",
"=",
"None",
",",
"show_alert",
"=",
"None",
",",
"url",
"=",
"None",
",",
"cache_time",
"=",
"None",
")",
":",
"method_url",
"=",
"'answerCallbackQuery'",
"payload",
"=",
"... | Use this method to send answers to callback queries sent from inline keyboards. The answer will be displayed to the user as a notification at the top of the chat screen or as an alert. On success, True is returned.
Alternatively, the user can be redirected to the specified Game URL. For this option to work, you mus... | [
"Use",
"this",
"method",
"to",
"send",
"answers",
"to",
"callback",
"queries",
"sent",
"from",
"inline",
"keyboards",
".",
"The",
"answer",
"will",
"be",
"displayed",
"to",
"the",
"user",
"as",
"a",
"notification",
"at",
"the",
"top",
"of",
"the",
"chat",
... | 47b53b88123097f1b9562a6cd5d4e080b86185d1 | https://github.com/eternnoir/pyTelegramBotAPI/blob/47b53b88123097f1b9562a6cd5d4e080b86185d1/telebot/apihelper.py#L846-L869 | train |
eternnoir/pyTelegramBotAPI | telebot/__init__.py | TeleBot.enable_save_next_step_handlers | def enable_save_next_step_handlers(self, delay=120, filename="./.handler-saves/step.save"):
"""
Enable saving next step handlers (by default saving disable)
:param delay: Delay between changes in handlers and saving
:param filename: Filename of save file
"""
self.next_st... | python | def enable_save_next_step_handlers(self, delay=120, filename="./.handler-saves/step.save"):
"""
Enable saving next step handlers (by default saving disable)
:param delay: Delay between changes in handlers and saving
:param filename: Filename of save file
"""
self.next_st... | [
"def",
"enable_save_next_step_handlers",
"(",
"self",
",",
"delay",
"=",
"120",
",",
"filename",
"=",
"\"./.handler-saves/step.save\"",
")",
":",
"self",
".",
"next_step_saver",
"=",
"Saver",
"(",
"self",
".",
"next_step_handlers",
",",
"filename",
",",
"delay",
... | Enable saving next step handlers (by default saving disable)
:param delay: Delay between changes in handlers and saving
:param filename: Filename of save file | [
"Enable",
"saving",
"next",
"step",
"handlers",
"(",
"by",
"default",
"saving",
"disable",
")"
] | 47b53b88123097f1b9562a6cd5d4e080b86185d1 | https://github.com/eternnoir/pyTelegramBotAPI/blob/47b53b88123097f1b9562a6cd5d4e080b86185d1/telebot/__init__.py#L173-L180 | train |
eternnoir/pyTelegramBotAPI | telebot/__init__.py | TeleBot.enable_save_reply_handlers | def enable_save_reply_handlers(self, delay=120, filename="./.handler-saves/reply.save"):
"""
Enable saving reply handlers (by default saving disable)
:param delay: Delay between changes in handlers and saving
:param filename: Filename of save file
"""
self.reply_saver = ... | python | def enable_save_reply_handlers(self, delay=120, filename="./.handler-saves/reply.save"):
"""
Enable saving reply handlers (by default saving disable)
:param delay: Delay between changes in handlers and saving
:param filename: Filename of save file
"""
self.reply_saver = ... | [
"def",
"enable_save_reply_handlers",
"(",
"self",
",",
"delay",
"=",
"120",
",",
"filename",
"=",
"\"./.handler-saves/reply.save\"",
")",
":",
"self",
".",
"reply_saver",
"=",
"Saver",
"(",
"self",
".",
"reply_handlers",
",",
"filename",
",",
"delay",
")"
] | Enable saving reply handlers (by default saving disable)
:param delay: Delay between changes in handlers and saving
:param filename: Filename of save file | [
"Enable",
"saving",
"reply",
"handlers",
"(",
"by",
"default",
"saving",
"disable",
")"
] | 47b53b88123097f1b9562a6cd5d4e080b86185d1 | https://github.com/eternnoir/pyTelegramBotAPI/blob/47b53b88123097f1b9562a6cd5d4e080b86185d1/telebot/__init__.py#L182-L189 | train |
eternnoir/pyTelegramBotAPI | telebot/__init__.py | TeleBot.load_next_step_handlers | def load_next_step_handlers(self, filename="./.handler-saves/step.save", del_file_after_loading=True):
"""
Load next step handlers from save file
:param filename: Filename of the file where handlers was saved
:param del_file_after_loading: Is passed True, after loading save file will be... | python | def load_next_step_handlers(self, filename="./.handler-saves/step.save", del_file_after_loading=True):
"""
Load next step handlers from save file
:param filename: Filename of the file where handlers was saved
:param del_file_after_loading: Is passed True, after loading save file will be... | [
"def",
"load_next_step_handlers",
"(",
"self",
",",
"filename",
"=",
"\"./.handler-saves/step.save\"",
",",
"del_file_after_loading",
"=",
"True",
")",
":",
"self",
".",
"next_step_saver",
".",
"load_handlers",
"(",
"filename",
",",
"del_file_after_loading",
")"
] | Load next step handlers from save file
:param filename: Filename of the file where handlers was saved
:param del_file_after_loading: Is passed True, after loading save file will be deleted | [
"Load",
"next",
"step",
"handlers",
"from",
"save",
"file"
] | 47b53b88123097f1b9562a6cd5d4e080b86185d1 | https://github.com/eternnoir/pyTelegramBotAPI/blob/47b53b88123097f1b9562a6cd5d4e080b86185d1/telebot/__init__.py#L203-L210 | train |
eternnoir/pyTelegramBotAPI | telebot/__init__.py | TeleBot.get_updates | def get_updates(self, offset=None, limit=None, timeout=20, allowed_updates=None):
"""
Use this method to receive incoming updates using long polling (wiki). An Array of Update objects is returned.
:param allowed_updates: Array of string. List the types of updates you want your bot to receive.
... | python | def get_updates(self, offset=None, limit=None, timeout=20, allowed_updates=None):
"""
Use this method to receive incoming updates using long polling (wiki). An Array of Update objects is returned.
:param allowed_updates: Array of string. List the types of updates you want your bot to receive.
... | [
"def",
"get_updates",
"(",
"self",
",",
"offset",
"=",
"None",
",",
"limit",
"=",
"None",
",",
"timeout",
"=",
"20",
",",
"allowed_updates",
"=",
"None",
")",
":",
"json_updates",
"=",
"apihelper",
".",
"get_updates",
"(",
"self",
".",
"token",
",",
"o... | Use this method to receive incoming updates using long polling (wiki). An Array of Update objects is returned.
:param allowed_updates: Array of string. List the types of updates you want your bot to receive.
:param offset: Integer. Identifier of the first update to be returned.
:param limit: Int... | [
"Use",
"this",
"method",
"to",
"receive",
"incoming",
"updates",
"using",
"long",
"polling",
"(",
"wiki",
")",
".",
"An",
"Array",
"of",
"Update",
"objects",
"is",
"returned",
".",
":",
"param",
"allowed_updates",
":",
"Array",
"of",
"string",
".",
"List",... | 47b53b88123097f1b9562a6cd5d4e080b86185d1 | https://github.com/eternnoir/pyTelegramBotAPI/blob/47b53b88123097f1b9562a6cd5d4e080b86185d1/telebot/__init__.py#L238-L251 | train |
eternnoir/pyTelegramBotAPI | telebot/__init__.py | TeleBot.__skip_updates | def __skip_updates(self):
"""
Get and discard all pending updates before first poll of the bot
:return: total updates skipped
"""
total = 0
updates = self.get_updates(offset=self.last_update_id, timeout=1)
while updates:
total += len(updates)
... | python | def __skip_updates(self):
"""
Get and discard all pending updates before first poll of the bot
:return: total updates skipped
"""
total = 0
updates = self.get_updates(offset=self.last_update_id, timeout=1)
while updates:
total += len(updates)
... | [
"def",
"__skip_updates",
"(",
"self",
")",
":",
"total",
"=",
"0",
"updates",
"=",
"self",
".",
"get_updates",
"(",
"offset",
"=",
"self",
".",
"last_update_id",
",",
"timeout",
"=",
"1",
")",
"while",
"updates",
":",
"total",
"+=",
"len",
"(",
"update... | Get and discard all pending updates before first poll of the bot
:return: total updates skipped | [
"Get",
"and",
"discard",
"all",
"pending",
"updates",
"before",
"first",
"poll",
"of",
"the",
"bot",
":",
"return",
":",
"total",
"updates",
"skipped"
] | 47b53b88123097f1b9562a6cd5d4e080b86185d1 | https://github.com/eternnoir/pyTelegramBotAPI/blob/47b53b88123097f1b9562a6cd5d4e080b86185d1/telebot/__init__.py#L253-L266 | train |
eternnoir/pyTelegramBotAPI | telebot/__init__.py | TeleBot.__retrieve_updates | def __retrieve_updates(self, timeout=20):
"""
Retrieves any updates from the Telegram API.
Registered listeners and applicable message handlers will be notified when a new message arrives.
:raises ApiException when a call has failed.
"""
if self.skip_pending:
... | python | def __retrieve_updates(self, timeout=20):
"""
Retrieves any updates from the Telegram API.
Registered listeners and applicable message handlers will be notified when a new message arrives.
:raises ApiException when a call has failed.
"""
if self.skip_pending:
... | [
"def",
"__retrieve_updates",
"(",
"self",
",",
"timeout",
"=",
"20",
")",
":",
"if",
"self",
".",
"skip_pending",
":",
"logger",
".",
"debug",
"(",
"'Skipped {0} pending messages'",
".",
"format",
"(",
"self",
".",
"__skip_updates",
"(",
")",
")",
")",
"se... | Retrieves any updates from the Telegram API.
Registered listeners and applicable message handlers will be notified when a new message arrives.
:raises ApiException when a call has failed. | [
"Retrieves",
"any",
"updates",
"from",
"the",
"Telegram",
"API",
".",
"Registered",
"listeners",
"and",
"applicable",
"message",
"handlers",
"will",
"be",
"notified",
"when",
"a",
"new",
"message",
"arrives",
".",
":",
"raises",
"ApiException",
"when",
"a",
"c... | 47b53b88123097f1b9562a6cd5d4e080b86185d1 | https://github.com/eternnoir/pyTelegramBotAPI/blob/47b53b88123097f1b9562a6cd5d4e080b86185d1/telebot/__init__.py#L268-L278 | train |
eternnoir/pyTelegramBotAPI | telebot/__init__.py | TeleBot.polling | def polling(self, none_stop=False, interval=0, timeout=20):
"""
This function creates a new Thread that calls an internal __retrieve_updates function.
This allows the bot to retrieve Updates automagically and notify listeners and message handlers accordingly.
Warning: Do not call this f... | python | def polling(self, none_stop=False, interval=0, timeout=20):
"""
This function creates a new Thread that calls an internal __retrieve_updates function.
This allows the bot to retrieve Updates automagically and notify listeners and message handlers accordingly.
Warning: Do not call this f... | [
"def",
"polling",
"(",
"self",
",",
"none_stop",
"=",
"False",
",",
"interval",
"=",
"0",
",",
"timeout",
"=",
"20",
")",
":",
"if",
"self",
".",
"threaded",
":",
"self",
".",
"__threaded_polling",
"(",
"none_stop",
",",
"interval",
",",
"timeout",
")"... | This function creates a new Thread that calls an internal __retrieve_updates function.
This allows the bot to retrieve Updates automagically and notify listeners and message handlers accordingly.
Warning: Do not call this function more than once!
Always get updates.
:param interval:
... | [
"This",
"function",
"creates",
"a",
"new",
"Thread",
"that",
"calls",
"an",
"internal",
"__retrieve_updates",
"function",
".",
"This",
"allows",
"the",
"bot",
"to",
"retrieve",
"Updates",
"automagically",
"and",
"notify",
"listeners",
"and",
"message",
"handlers",... | 47b53b88123097f1b9562a6cd5d4e080b86185d1 | https://github.com/eternnoir/pyTelegramBotAPI/blob/47b53b88123097f1b9562a6cd5d4e080b86185d1/telebot/__init__.py#L376-L392 | train |
eternnoir/pyTelegramBotAPI | telebot/__init__.py | TeleBot.get_user_profile_photos | def get_user_profile_photos(self, user_id, offset=None, limit=None):
"""
Retrieves the user profile photos of the person with 'user_id'
See https://core.telegram.org/bots/api#getuserprofilephotos
:param user_id:
:param offset:
:param limit:
:return: API reply.
... | python | def get_user_profile_photos(self, user_id, offset=None, limit=None):
"""
Retrieves the user profile photos of the person with 'user_id'
See https://core.telegram.org/bots/api#getuserprofilephotos
:param user_id:
:param offset:
:param limit:
:return: API reply.
... | [
"def",
"get_user_profile_photos",
"(",
"self",
",",
"user_id",
",",
"offset",
"=",
"None",
",",
"limit",
"=",
"None",
")",
":",
"result",
"=",
"apihelper",
".",
"get_user_profile_photos",
"(",
"self",
".",
"token",
",",
"user_id",
",",
"offset",
",",
"limi... | Retrieves the user profile photos of the person with 'user_id'
See https://core.telegram.org/bots/api#getuserprofilephotos
:param user_id:
:param offset:
:param limit:
:return: API reply. | [
"Retrieves",
"the",
"user",
"profile",
"photos",
"of",
"the",
"person",
"with",
"user_id",
"See",
"https",
":",
"//",
"core",
".",
"telegram",
".",
"org",
"/",
"bots",
"/",
"api#getuserprofilephotos",
":",
"param",
"user_id",
":",
":",
"param",
"offset",
"... | 47b53b88123097f1b9562a6cd5d4e080b86185d1 | https://github.com/eternnoir/pyTelegramBotAPI/blob/47b53b88123097f1b9562a6cd5d4e080b86185d1/telebot/__init__.py#L491-L501 | train |
eternnoir/pyTelegramBotAPI | telebot/__init__.py | TeleBot.get_chat | def get_chat(self, chat_id):
"""
Use this method to get up to date information about the chat (current name of the user for one-on-one
conversations, current username of a user, group or channel, etc.). Returns a Chat object on success.
:param chat_id:
:return:
"""
... | python | def get_chat(self, chat_id):
"""
Use this method to get up to date information about the chat (current name of the user for one-on-one
conversations, current username of a user, group or channel, etc.). Returns a Chat object on success.
:param chat_id:
:return:
"""
... | [
"def",
"get_chat",
"(",
"self",
",",
"chat_id",
")",
":",
"result",
"=",
"apihelper",
".",
"get_chat",
"(",
"self",
".",
"token",
",",
"chat_id",
")",
"return",
"types",
".",
"Chat",
".",
"de_json",
"(",
"result",
")"
] | Use this method to get up to date information about the chat (current name of the user for one-on-one
conversations, current username of a user, group or channel, etc.). Returns a Chat object on success.
:param chat_id:
:return: | [
"Use",
"this",
"method",
"to",
"get",
"up",
"to",
"date",
"information",
"about",
"the",
"chat",
"(",
"current",
"name",
"of",
"the",
"user",
"for",
"one",
"-",
"on",
"-",
"one",
"conversations",
"current",
"username",
"of",
"a",
"user",
"group",
"or",
... | 47b53b88123097f1b9562a6cd5d4e080b86185d1 | https://github.com/eternnoir/pyTelegramBotAPI/blob/47b53b88123097f1b9562a6cd5d4e080b86185d1/telebot/__init__.py#L503-L511 | train |
eternnoir/pyTelegramBotAPI | telebot/__init__.py | TeleBot.leave_chat | def leave_chat(self, chat_id):
"""
Use this method for your bot to leave a group, supergroup or channel. Returns True on success.
:param chat_id:
:return:
"""
result = apihelper.leave_chat(self.token, chat_id)
return result | python | def leave_chat(self, chat_id):
"""
Use this method for your bot to leave a group, supergroup or channel. Returns True on success.
:param chat_id:
:return:
"""
result = apihelper.leave_chat(self.token, chat_id)
return result | [
"def",
"leave_chat",
"(",
"self",
",",
"chat_id",
")",
":",
"result",
"=",
"apihelper",
".",
"leave_chat",
"(",
"self",
".",
"token",
",",
"chat_id",
")",
"return",
"result"
] | Use this method for your bot to leave a group, supergroup or channel. Returns True on success.
:param chat_id:
:return: | [
"Use",
"this",
"method",
"for",
"your",
"bot",
"to",
"leave",
"a",
"group",
"supergroup",
"or",
"channel",
".",
"Returns",
"True",
"on",
"success",
".",
":",
"param",
"chat_id",
":",
":",
"return",
":"
] | 47b53b88123097f1b9562a6cd5d4e080b86185d1 | https://github.com/eternnoir/pyTelegramBotAPI/blob/47b53b88123097f1b9562a6cd5d4e080b86185d1/telebot/__init__.py#L513-L520 | train |
eternnoir/pyTelegramBotAPI | telebot/__init__.py | TeleBot.get_chat_administrators | def get_chat_administrators(self, chat_id):
"""
Use this method to get a list of administrators in a chat. On success, returns an Array of ChatMember objects
that contains information about all chat administrators except other bots.
:param chat_id:
:return:
"""
re... | python | def get_chat_administrators(self, chat_id):
"""
Use this method to get a list of administrators in a chat. On success, returns an Array of ChatMember objects
that contains information about all chat administrators except other bots.
:param chat_id:
:return:
"""
re... | [
"def",
"get_chat_administrators",
"(",
"self",
",",
"chat_id",
")",
":",
"result",
"=",
"apihelper",
".",
"get_chat_administrators",
"(",
"self",
".",
"token",
",",
"chat_id",
")",
"ret",
"=",
"[",
"]",
"for",
"r",
"in",
"result",
":",
"ret",
".",
"appen... | Use this method to get a list of administrators in a chat. On success, returns an Array of ChatMember objects
that contains information about all chat administrators except other bots.
:param chat_id:
:return: | [
"Use",
"this",
"method",
"to",
"get",
"a",
"list",
"of",
"administrators",
"in",
"a",
"chat",
".",
"On",
"success",
"returns",
"an",
"Array",
"of",
"ChatMember",
"objects",
"that",
"contains",
"information",
"about",
"all",
"chat",
"administrators",
"except",
... | 47b53b88123097f1b9562a6cd5d4e080b86185d1 | https://github.com/eternnoir/pyTelegramBotAPI/blob/47b53b88123097f1b9562a6cd5d4e080b86185d1/telebot/__init__.py#L522-L533 | train |
eternnoir/pyTelegramBotAPI | telebot/__init__.py | TeleBot.get_chat_members_count | def get_chat_members_count(self, chat_id):
"""
Use this method to get the number of members in a chat. Returns Int on success.
:param chat_id:
:return:
"""
result = apihelper.get_chat_members_count(self.token, chat_id)
return result | python | def get_chat_members_count(self, chat_id):
"""
Use this method to get the number of members in a chat. Returns Int on success.
:param chat_id:
:return:
"""
result = apihelper.get_chat_members_count(self.token, chat_id)
return result | [
"def",
"get_chat_members_count",
"(",
"self",
",",
"chat_id",
")",
":",
"result",
"=",
"apihelper",
".",
"get_chat_members_count",
"(",
"self",
".",
"token",
",",
"chat_id",
")",
"return",
"result"
] | Use this method to get the number of members in a chat. Returns Int on success.
:param chat_id:
:return: | [
"Use",
"this",
"method",
"to",
"get",
"the",
"number",
"of",
"members",
"in",
"a",
"chat",
".",
"Returns",
"Int",
"on",
"success",
".",
":",
"param",
"chat_id",
":",
":",
"return",
":"
] | 47b53b88123097f1b9562a6cd5d4e080b86185d1 | https://github.com/eternnoir/pyTelegramBotAPI/blob/47b53b88123097f1b9562a6cd5d4e080b86185d1/telebot/__init__.py#L535-L542 | train |
eternnoir/pyTelegramBotAPI | telebot/__init__.py | TeleBot.set_chat_sticker_set | def set_chat_sticker_set(self, chat_id, sticker_set_name):
"""
Use this method to set a new group sticker set for a supergroup. The bot must be an administrator
in the chat for this to work and must have the appropriate admin rights.
Use the field can_set_sticker_set optionally returned ... | python | def set_chat_sticker_set(self, chat_id, sticker_set_name):
"""
Use this method to set a new group sticker set for a supergroup. The bot must be an administrator
in the chat for this to work and must have the appropriate admin rights.
Use the field can_set_sticker_set optionally returned ... | [
"def",
"set_chat_sticker_set",
"(",
"self",
",",
"chat_id",
",",
"sticker_set_name",
")",
":",
"result",
"=",
"apihelper",
".",
"set_chat_sticker_set",
"(",
"self",
".",
"token",
",",
"chat_id",
",",
"sticker_set_name",
")",
"return",
"result"
] | Use this method to set a new group sticker set for a supergroup. The bot must be an administrator
in the chat for this to work and must have the appropriate admin rights.
Use the field can_set_sticker_set optionally returned in getChat requests to check
if the bot can use this method. Returns Tr... | [
"Use",
"this",
"method",
"to",
"set",
"a",
"new",
"group",
"sticker",
"set",
"for",
"a",
"supergroup",
".",
"The",
"bot",
"must",
"be",
"an",
"administrator",
"in",
"the",
"chat",
"for",
"this",
"to",
"work",
"and",
"must",
"have",
"the",
"appropriate",
... | 47b53b88123097f1b9562a6cd5d4e080b86185d1 | https://github.com/eternnoir/pyTelegramBotAPI/blob/47b53b88123097f1b9562a6cd5d4e080b86185d1/telebot/__init__.py#L544-L556 | train |
eternnoir/pyTelegramBotAPI | telebot/__init__.py | TeleBot.delete_chat_sticker_set | def delete_chat_sticker_set(self, chat_id):
"""
Use this method to delete a group sticker set from a supergroup. The bot must be an administrator in the chat
for this to work and must have the appropriate admin rights. Use the field can_set_sticker_set
optionally returned in getChat requ... | python | def delete_chat_sticker_set(self, chat_id):
"""
Use this method to delete a group sticker set from a supergroup. The bot must be an administrator in the chat
for this to work and must have the appropriate admin rights. Use the field can_set_sticker_set
optionally returned in getChat requ... | [
"def",
"delete_chat_sticker_set",
"(",
"self",
",",
"chat_id",
")",
":",
"result",
"=",
"apihelper",
".",
"delete_chat_sticker_set",
"(",
"self",
".",
"token",
",",
"chat_id",
")",
"return",
"result"
] | Use this method to delete a group sticker set from a supergroup. The bot must be an administrator in the chat
for this to work and must have the appropriate admin rights. Use the field can_set_sticker_set
optionally returned in getChat requests to check if the bot can use this method. Returns True on su... | [
"Use",
"this",
"method",
"to",
"delete",
"a",
"group",
"sticker",
"set",
"from",
"a",
"supergroup",
".",
"The",
"bot",
"must",
"be",
"an",
"administrator",
"in",
"the",
"chat",
"for",
"this",
"to",
"work",
"and",
"must",
"have",
"the",
"appropriate",
"ad... | 47b53b88123097f1b9562a6cd5d4e080b86185d1 | https://github.com/eternnoir/pyTelegramBotAPI/blob/47b53b88123097f1b9562a6cd5d4e080b86185d1/telebot/__init__.py#L558-L568 | train |
eternnoir/pyTelegramBotAPI | telebot/__init__.py | TeleBot.get_chat_member | def get_chat_member(self, chat_id, user_id):
"""
Use this method to get information about a member of a chat. Returns a ChatMember object on success.
:param chat_id:
:param user_id:
:return:
"""
result = apihelper.get_chat_member(self.token, chat_id, user_id)
... | python | def get_chat_member(self, chat_id, user_id):
"""
Use this method to get information about a member of a chat. Returns a ChatMember object on success.
:param chat_id:
:param user_id:
:return:
"""
result = apihelper.get_chat_member(self.token, chat_id, user_id)
... | [
"def",
"get_chat_member",
"(",
"self",
",",
"chat_id",
",",
"user_id",
")",
":",
"result",
"=",
"apihelper",
".",
"get_chat_member",
"(",
"self",
".",
"token",
",",
"chat_id",
",",
"user_id",
")",
"return",
"types",
".",
"ChatMember",
".",
"de_json",
"(",
... | Use this method to get information about a member of a chat. Returns a ChatMember object on success.
:param chat_id:
:param user_id:
:return: | [
"Use",
"this",
"method",
"to",
"get",
"information",
"about",
"a",
"member",
"of",
"a",
"chat",
".",
"Returns",
"a",
"ChatMember",
"object",
"on",
"success",
".",
":",
"param",
"chat_id",
":",
":",
"param",
"user_id",
":",
":",
"return",
":"
] | 47b53b88123097f1b9562a6cd5d4e080b86185d1 | https://github.com/eternnoir/pyTelegramBotAPI/blob/47b53b88123097f1b9562a6cd5d4e080b86185d1/telebot/__init__.py#L570-L578 | train |
eternnoir/pyTelegramBotAPI | telebot/__init__.py | TeleBot.send_message | def send_message(self, chat_id, text, disable_web_page_preview=None, reply_to_message_id=None, reply_markup=None,
parse_mode=None, disable_notification=None):
"""
Use this method to send text messages.
Warning: Do not send more than about 5000 characters each message, other... | python | def send_message(self, chat_id, text, disable_web_page_preview=None, reply_to_message_id=None, reply_markup=None,
parse_mode=None, disable_notification=None):
"""
Use this method to send text messages.
Warning: Do not send more than about 5000 characters each message, other... | [
"def",
"send_message",
"(",
"self",
",",
"chat_id",
",",
"text",
",",
"disable_web_page_preview",
"=",
"None",
",",
"reply_to_message_id",
"=",
"None",
",",
"reply_markup",
"=",
"None",
",",
"parse_mode",
"=",
"None",
",",
"disable_notification",
"=",
"None",
... | Use this method to send text messages.
Warning: Do not send more than about 5000 characters each message, otherwise you'll risk an HTTP 414 error.
If you must send more than 5000 characters, use the split_string function in apihelper.py.
:param chat_id:
:param text:
:param disa... | [
"Use",
"this",
"method",
"to",
"send",
"text",
"messages",
"."
] | 47b53b88123097f1b9562a6cd5d4e080b86185d1 | https://github.com/eternnoir/pyTelegramBotAPI/blob/47b53b88123097f1b9562a6cd5d4e080b86185d1/telebot/__init__.py#L580-L599 | train |
eternnoir/pyTelegramBotAPI | telebot/__init__.py | TeleBot.forward_message | def forward_message(self, chat_id, from_chat_id, message_id, disable_notification=None):
"""
Use this method to forward messages of any kind.
:param disable_notification:
:param chat_id: which chat to forward
:param from_chat_id: which chat message from
:param message_id:... | python | def forward_message(self, chat_id, from_chat_id, message_id, disable_notification=None):
"""
Use this method to forward messages of any kind.
:param disable_notification:
:param chat_id: which chat to forward
:param from_chat_id: which chat message from
:param message_id:... | [
"def",
"forward_message",
"(",
"self",
",",
"chat_id",
",",
"from_chat_id",
",",
"message_id",
",",
"disable_notification",
"=",
"None",
")",
":",
"return",
"types",
".",
"Message",
".",
"de_json",
"(",
"apihelper",
".",
"forward_message",
"(",
"self",
".",
... | Use this method to forward messages of any kind.
:param disable_notification:
:param chat_id: which chat to forward
:param from_chat_id: which chat message from
:param message_id: message id
:return: API reply. | [
"Use",
"this",
"method",
"to",
"forward",
"messages",
"of",
"any",
"kind",
".",
":",
"param",
"disable_notification",
":",
":",
"param",
"chat_id",
":",
"which",
"chat",
"to",
"forward",
":",
"param",
"from_chat_id",
":",
"which",
"chat",
"message",
"from",
... | 47b53b88123097f1b9562a6cd5d4e080b86185d1 | https://github.com/eternnoir/pyTelegramBotAPI/blob/47b53b88123097f1b9562a6cd5d4e080b86185d1/telebot/__init__.py#L601-L611 | train |
eternnoir/pyTelegramBotAPI | telebot/__init__.py | TeleBot.delete_message | def delete_message(self, chat_id, message_id):
"""
Use this method to delete message. Returns True on success.
:param chat_id: in which chat to delete
:param message_id: which message to delete
:return: API reply.
"""
return apihelper.delete_message(self.token, ch... | python | def delete_message(self, chat_id, message_id):
"""
Use this method to delete message. Returns True on success.
:param chat_id: in which chat to delete
:param message_id: which message to delete
:return: API reply.
"""
return apihelper.delete_message(self.token, ch... | [
"def",
"delete_message",
"(",
"self",
",",
"chat_id",
",",
"message_id",
")",
":",
"return",
"apihelper",
".",
"delete_message",
"(",
"self",
".",
"token",
",",
"chat_id",
",",
"message_id",
")"
] | Use this method to delete message. Returns True on success.
:param chat_id: in which chat to delete
:param message_id: which message to delete
:return: API reply. | [
"Use",
"this",
"method",
"to",
"delete",
"message",
".",
"Returns",
"True",
"on",
"success",
".",
":",
"param",
"chat_id",
":",
"in",
"which",
"chat",
"to",
"delete",
":",
"param",
"message_id",
":",
"which",
"message",
"to",
"delete",
":",
"return",
":"... | 47b53b88123097f1b9562a6cd5d4e080b86185d1 | https://github.com/eternnoir/pyTelegramBotAPI/blob/47b53b88123097f1b9562a6cd5d4e080b86185d1/telebot/__init__.py#L613-L620 | train |
eternnoir/pyTelegramBotAPI | telebot/__init__.py | TeleBot.send_photo | def send_photo(self, chat_id, photo, caption=None, reply_to_message_id=None, reply_markup=None,
parse_mode=None, disable_notification=None):
"""
Use this method to send photos.
:param disable_notification:
:param chat_id:
:param photo:
:param caption:
... | python | def send_photo(self, chat_id, photo, caption=None, reply_to_message_id=None, reply_markup=None,
parse_mode=None, disable_notification=None):
"""
Use this method to send photos.
:param disable_notification:
:param chat_id:
:param photo:
:param caption:
... | [
"def",
"send_photo",
"(",
"self",
",",
"chat_id",
",",
"photo",
",",
"caption",
"=",
"None",
",",
"reply_to_message_id",
"=",
"None",
",",
"reply_markup",
"=",
"None",
",",
"parse_mode",
"=",
"None",
",",
"disable_notification",
"=",
"None",
")",
":",
"ret... | Use this method to send photos.
:param disable_notification:
:param chat_id:
:param photo:
:param caption:
:param parse_mode
:param reply_to_message_id:
:param reply_markup:
:return: API reply. | [
"Use",
"this",
"method",
"to",
"send",
"photos",
".",
":",
"param",
"disable_notification",
":",
":",
"param",
"chat_id",
":",
":",
"param",
"photo",
":",
":",
"param",
"caption",
":",
":",
"param",
"parse_mode",
":",
"param",
"reply_to_message_id",
":",
"... | 47b53b88123097f1b9562a6cd5d4e080b86185d1 | https://github.com/eternnoir/pyTelegramBotAPI/blob/47b53b88123097f1b9562a6cd5d4e080b86185d1/telebot/__init__.py#L622-L637 | train |
eternnoir/pyTelegramBotAPI | telebot/__init__.py | TeleBot.send_audio | def send_audio(self, chat_id, audio, caption=None, duration=None, performer=None, title=None,
reply_to_message_id=None, reply_markup=None, parse_mode=None, disable_notification=None,
timeout=None):
"""
Use this method to send audio files, if you want Telegram client... | python | def send_audio(self, chat_id, audio, caption=None, duration=None, performer=None, title=None,
reply_to_message_id=None, reply_markup=None, parse_mode=None, disable_notification=None,
timeout=None):
"""
Use this method to send audio files, if you want Telegram client... | [
"def",
"send_audio",
"(",
"self",
",",
"chat_id",
",",
"audio",
",",
"caption",
"=",
"None",
",",
"duration",
"=",
"None",
",",
"performer",
"=",
"None",
",",
"title",
"=",
"None",
",",
"reply_to_message_id",
"=",
"None",
",",
"reply_markup",
"=",
"None"... | Use this method to send audio files, if you want Telegram clients to display them in the music player. Your audio must be in the .mp3 format.
:param chat_id:Unique identifier for the message recipient
:param audio:Audio file to send.
:param duration:Duration of the audio in seconds
:para... | [
"Use",
"this",
"method",
"to",
"send",
"audio",
"files",
"if",
"you",
"want",
"Telegram",
"clients",
"to",
"display",
"them",
"in",
"the",
"music",
"player",
".",
"Your",
"audio",
"must",
"be",
"in",
"the",
".",
"mp3",
"format",
".",
":",
"param",
"cha... | 47b53b88123097f1b9562a6cd5d4e080b86185d1 | https://github.com/eternnoir/pyTelegramBotAPI/blob/47b53b88123097f1b9562a6cd5d4e080b86185d1/telebot/__init__.py#L639-L656 | train |
eternnoir/pyTelegramBotAPI | telebot/__init__.py | TeleBot.send_voice | def send_voice(self, chat_id, voice, caption=None, duration=None, reply_to_message_id=None, reply_markup=None,
parse_mode=None, disable_notification=None, timeout=None):
"""
Use this method to send audio files, if you want Telegram clients to display the file as a playable voice messa... | python | def send_voice(self, chat_id, voice, caption=None, duration=None, reply_to_message_id=None, reply_markup=None,
parse_mode=None, disable_notification=None, timeout=None):
"""
Use this method to send audio files, if you want Telegram clients to display the file as a playable voice messa... | [
"def",
"send_voice",
"(",
"self",
",",
"chat_id",
",",
"voice",
",",
"caption",
"=",
"None",
",",
"duration",
"=",
"None",
",",
"reply_to_message_id",
"=",
"None",
",",
"reply_markup",
"=",
"None",
",",
"parse_mode",
"=",
"None",
",",
"disable_notification",... | Use this method to send audio files, if you want Telegram clients to display the file as a playable voice message.
:param chat_id:Unique identifier for the message recipient.
:param voice:
:param duration:Duration of sent audio in seconds
:param reply_to_message_id:
:param reply_... | [
"Use",
"this",
"method",
"to",
"send",
"audio",
"files",
"if",
"you",
"want",
"Telegram",
"clients",
"to",
"display",
"the",
"file",
"as",
"a",
"playable",
"voice",
"message",
".",
":",
"param",
"chat_id",
":",
"Unique",
"identifier",
"for",
"the",
"messag... | 47b53b88123097f1b9562a6cd5d4e080b86185d1 | https://github.com/eternnoir/pyTelegramBotAPI/blob/47b53b88123097f1b9562a6cd5d4e080b86185d1/telebot/__init__.py#L658-L672 | train |
eternnoir/pyTelegramBotAPI | telebot/__init__.py | TeleBot.send_document | def send_document(self, chat_id, data, reply_to_message_id=None, caption=None, reply_markup=None,
parse_mode=None, disable_notification=None, timeout=None):
"""
Use this method to send general files.
:param chat_id:
:param data:
:param reply_to_message_id:
... | python | def send_document(self, chat_id, data, reply_to_message_id=None, caption=None, reply_markup=None,
parse_mode=None, disable_notification=None, timeout=None):
"""
Use this method to send general files.
:param chat_id:
:param data:
:param reply_to_message_id:
... | [
"def",
"send_document",
"(",
"self",
",",
"chat_id",
",",
"data",
",",
"reply_to_message_id",
"=",
"None",
",",
"caption",
"=",
"None",
",",
"reply_markup",
"=",
"None",
",",
"parse_mode",
"=",
"None",
",",
"disable_notification",
"=",
"None",
",",
"timeout"... | Use this method to send general files.
:param chat_id:
:param data:
:param reply_to_message_id:
:param reply_markup:
:param parse_mode:
:param disable_notification:
:return: API reply. | [
"Use",
"this",
"method",
"to",
"send",
"general",
"files",
".",
":",
"param",
"chat_id",
":",
":",
"param",
"data",
":",
":",
"param",
"reply_to_message_id",
":",
":",
"param",
"reply_markup",
":",
":",
"param",
"parse_mode",
":",
":",
"param",
"disable_no... | 47b53b88123097f1b9562a6cd5d4e080b86185d1 | https://github.com/eternnoir/pyTelegramBotAPI/blob/47b53b88123097f1b9562a6cd5d4e080b86185d1/telebot/__init__.py#L674-L688 | train |
eternnoir/pyTelegramBotAPI | telebot/__init__.py | TeleBot.send_sticker | def send_sticker(self, chat_id, data, reply_to_message_id=None, reply_markup=None, disable_notification=None,
timeout=None):
"""
Use this method to send .webp stickers.
:param chat_id:
:param data:
:param reply_to_message_id:
:param reply_markup:
... | python | def send_sticker(self, chat_id, data, reply_to_message_id=None, reply_markup=None, disable_notification=None,
timeout=None):
"""
Use this method to send .webp stickers.
:param chat_id:
:param data:
:param reply_to_message_id:
:param reply_markup:
... | [
"def",
"send_sticker",
"(",
"self",
",",
"chat_id",
",",
"data",
",",
"reply_to_message_id",
"=",
"None",
",",
"reply_markup",
"=",
"None",
",",
"disable_notification",
"=",
"None",
",",
"timeout",
"=",
"None",
")",
":",
"return",
"types",
".",
"Message",
... | Use this method to send .webp stickers.
:param chat_id:
:param data:
:param reply_to_message_id:
:param reply_markup:
:return: API reply. | [
"Use",
"this",
"method",
"to",
"send",
".",
"webp",
"stickers",
".",
":",
"param",
"chat_id",
":",
":",
"param",
"data",
":",
":",
"param",
"reply_to_message_id",
":",
":",
"param",
"reply_markup",
":",
":",
"return",
":",
"API",
"reply",
"."
] | 47b53b88123097f1b9562a6cd5d4e080b86185d1 | https://github.com/eternnoir/pyTelegramBotAPI/blob/47b53b88123097f1b9562a6cd5d4e080b86185d1/telebot/__init__.py#L690-L702 | train |
eternnoir/pyTelegramBotAPI | telebot/__init__.py | TeleBot.send_video | def send_video(self, chat_id, data, duration=None, caption=None, reply_to_message_id=None, reply_markup=None,
parse_mode=None, supports_streaming=None, disable_notification=None, timeout=None):
"""
Use this method to send video files, Telegram clients support mp4 videos.
:para... | python | def send_video(self, chat_id, data, duration=None, caption=None, reply_to_message_id=None, reply_markup=None,
parse_mode=None, supports_streaming=None, disable_notification=None, timeout=None):
"""
Use this method to send video files, Telegram clients support mp4 videos.
:para... | [
"def",
"send_video",
"(",
"self",
",",
"chat_id",
",",
"data",
",",
"duration",
"=",
"None",
",",
"caption",
"=",
"None",
",",
"reply_to_message_id",
"=",
"None",
",",
"reply_markup",
"=",
"None",
",",
"parse_mode",
"=",
"None",
",",
"supports_streaming",
... | Use this method to send video files, Telegram clients support mp4 videos.
:param chat_id: Integer : Unique identifier for the message recipient — User or GroupChat id
:param data: InputFile or String : Video to send. You can either pass a file_id as String to resend a video that is already on the Telegr... | [
"Use",
"this",
"method",
"to",
"send",
"video",
"files",
"Telegram",
"clients",
"support",
"mp4",
"videos",
".",
":",
"param",
"chat_id",
":",
"Integer",
":",
"Unique",
"identifier",
"for",
"the",
"message",
"recipient",
"—",
"User",
"or",
"GroupChat",
"id",... | 47b53b88123097f1b9562a6cd5d4e080b86185d1 | https://github.com/eternnoir/pyTelegramBotAPI/blob/47b53b88123097f1b9562a6cd5d4e080b86185d1/telebot/__init__.py#L704-L720 | train |
eternnoir/pyTelegramBotAPI | telebot/__init__.py | TeleBot.send_video_note | def send_video_note(self, chat_id, data, duration=None, length=None, reply_to_message_id=None, reply_markup=None,
disable_notification=None, timeout=None):
"""
Use this method to send video files, Telegram clients support mp4 videos.
:param chat_id: Integer : Unique ident... | python | def send_video_note(self, chat_id, data, duration=None, length=None, reply_to_message_id=None, reply_markup=None,
disable_notification=None, timeout=None):
"""
Use this method to send video files, Telegram clients support mp4 videos.
:param chat_id: Integer : Unique ident... | [
"def",
"send_video_note",
"(",
"self",
",",
"chat_id",
",",
"data",
",",
"duration",
"=",
"None",
",",
"length",
"=",
"None",
",",
"reply_to_message_id",
"=",
"None",
",",
"reply_markup",
"=",
"None",
",",
"disable_notification",
"=",
"None",
",",
"timeout",... | Use this method to send video files, Telegram clients support mp4 videos.
:param chat_id: Integer : Unique identifier for the message recipient — User or GroupChat id
:param data: InputFile or String : Video note to send. You can either pass a file_id as String to resend a video that is already on the T... | [
"Use",
"this",
"method",
"to",
"send",
"video",
"files",
"Telegram",
"clients",
"support",
"mp4",
"videos",
".",
":",
"param",
"chat_id",
":",
"Integer",
":",
"Unique",
"identifier",
"for",
"the",
"message",
"recipient",
"—",
"User",
"or",
"GroupChat",
"id",... | 47b53b88123097f1b9562a6cd5d4e080b86185d1 | https://github.com/eternnoir/pyTelegramBotAPI/blob/47b53b88123097f1b9562a6cd5d4e080b86185d1/telebot/__init__.py#L722-L736 | train |
eternnoir/pyTelegramBotAPI | telebot/__init__.py | TeleBot.send_media_group | def send_media_group(self, chat_id, media, disable_notification=None, reply_to_message_id=None):
"""
send a group of photos or videos as an album. On success, an array of the sent Messages is returned.
:param chat_id:
:param media:
:param disable_notification:
:param repl... | python | def send_media_group(self, chat_id, media, disable_notification=None, reply_to_message_id=None):
"""
send a group of photos or videos as an album. On success, an array of the sent Messages is returned.
:param chat_id:
:param media:
:param disable_notification:
:param repl... | [
"def",
"send_media_group",
"(",
"self",
",",
"chat_id",
",",
"media",
",",
"disable_notification",
"=",
"None",
",",
"reply_to_message_id",
"=",
"None",
")",
":",
"result",
"=",
"apihelper",
".",
"send_media_group",
"(",
"self",
".",
"token",
",",
"chat_id",
... | send a group of photos or videos as an album. On success, an array of the sent Messages is returned.
:param chat_id:
:param media:
:param disable_notification:
:param reply_to_message_id:
:return: | [
"send",
"a",
"group",
"of",
"photos",
"or",
"videos",
"as",
"an",
"album",
".",
"On",
"success",
"an",
"array",
"of",
"the",
"sent",
"Messages",
"is",
"returned",
".",
":",
"param",
"chat_id",
":",
":",
"param",
"media",
":",
":",
"param",
"disable_not... | 47b53b88123097f1b9562a6cd5d4e080b86185d1 | https://github.com/eternnoir/pyTelegramBotAPI/blob/47b53b88123097f1b9562a6cd5d4e080b86185d1/telebot/__init__.py#L738-L751 | train |
eternnoir/pyTelegramBotAPI | telebot/__init__.py | TeleBot.send_location | def send_location(self, chat_id, latitude, longitude, live_period=None, reply_to_message_id=None, reply_markup=None,
disable_notification=None):
"""
Use this method to send point on the map.
:param chat_id:
:param latitude:
:param longitude:
:param l... | python | def send_location(self, chat_id, latitude, longitude, live_period=None, reply_to_message_id=None, reply_markup=None,
disable_notification=None):
"""
Use this method to send point on the map.
:param chat_id:
:param latitude:
:param longitude:
:param l... | [
"def",
"send_location",
"(",
"self",
",",
"chat_id",
",",
"latitude",
",",
"longitude",
",",
"live_period",
"=",
"None",
",",
"reply_to_message_id",
"=",
"None",
",",
"reply_markup",
"=",
"None",
",",
"disable_notification",
"=",
"None",
")",
":",
"return",
... | Use this method to send point on the map.
:param chat_id:
:param latitude:
:param longitude:
:param live_period
:param reply_to_message_id:
:param reply_markup:
:return: API reply. | [
"Use",
"this",
"method",
"to",
"send",
"point",
"on",
"the",
"map",
".",
":",
"param",
"chat_id",
":",
":",
"param",
"latitude",
":",
":",
"param",
"longitude",
":",
":",
"param",
"live_period",
":",
"param",
"reply_to_message_id",
":",
":",
"param",
"re... | 47b53b88123097f1b9562a6cd5d4e080b86185d1 | https://github.com/eternnoir/pyTelegramBotAPI/blob/47b53b88123097f1b9562a6cd5d4e080b86185d1/telebot/__init__.py#L753-L768 | train |
eternnoir/pyTelegramBotAPI | telebot/__init__.py | TeleBot.edit_message_live_location | def edit_message_live_location(self, latitude, longitude, chat_id=None, message_id=None,
inline_message_id=None, reply_markup=None):
"""
Use this method to edit live location
:param latitude:
:param longitude:
:param chat_id:
:param mess... | python | def edit_message_live_location(self, latitude, longitude, chat_id=None, message_id=None,
inline_message_id=None, reply_markup=None):
"""
Use this method to edit live location
:param latitude:
:param longitude:
:param chat_id:
:param mess... | [
"def",
"edit_message_live_location",
"(",
"self",
",",
"latitude",
",",
"longitude",
",",
"chat_id",
"=",
"None",
",",
"message_id",
"=",
"None",
",",
"inline_message_id",
"=",
"None",
",",
"reply_markup",
"=",
"None",
")",
":",
"return",
"types",
".",
"Mess... | Use this method to edit live location
:param latitude:
:param longitude:
:param chat_id:
:param message_id:
:param inline_message_id:
:param reply_markup:
:return: | [
"Use",
"this",
"method",
"to",
"edit",
"live",
"location",
":",
"param",
"latitude",
":",
":",
"param",
"longitude",
":",
":",
"param",
"chat_id",
":",
":",
"param",
"message_id",
":",
":",
"param",
"inline_message_id",
":",
":",
"param",
"reply_markup",
"... | 47b53b88123097f1b9562a6cd5d4e080b86185d1 | https://github.com/eternnoir/pyTelegramBotAPI/blob/47b53b88123097f1b9562a6cd5d4e080b86185d1/telebot/__init__.py#L770-L784 | train |
eternnoir/pyTelegramBotAPI | telebot/__init__.py | TeleBot.stop_message_live_location | def stop_message_live_location(self, chat_id=None, message_id=None, inline_message_id=None, reply_markup=None):
"""
Use this method to stop updating a live location message sent by the bot
or via the bot (for inline bots) before live_period expires
:param chat_id:
:param message_... | python | def stop_message_live_location(self, chat_id=None, message_id=None, inline_message_id=None, reply_markup=None):
"""
Use this method to stop updating a live location message sent by the bot
or via the bot (for inline bots) before live_period expires
:param chat_id:
:param message_... | [
"def",
"stop_message_live_location",
"(",
"self",
",",
"chat_id",
"=",
"None",
",",
"message_id",
"=",
"None",
",",
"inline_message_id",
"=",
"None",
",",
"reply_markup",
"=",
"None",
")",
":",
"return",
"types",
".",
"Message",
".",
"de_json",
"(",
"apihelp... | Use this method to stop updating a live location message sent by the bot
or via the bot (for inline bots) before live_period expires
:param chat_id:
:param message_id:
:param inline_message_id:
:param reply_markup:
:return: | [
"Use",
"this",
"method",
"to",
"stop",
"updating",
"a",
"live",
"location",
"message",
"sent",
"by",
"the",
"bot",
"or",
"via",
"the",
"bot",
"(",
"for",
"inline",
"bots",
")",
"before",
"live_period",
"expires",
":",
"param",
"chat_id",
":",
":",
"param... | 47b53b88123097f1b9562a6cd5d4e080b86185d1 | https://github.com/eternnoir/pyTelegramBotAPI/blob/47b53b88123097f1b9562a6cd5d4e080b86185d1/telebot/__init__.py#L786-L797 | train |
eternnoir/pyTelegramBotAPI | telebot/__init__.py | TeleBot.send_venue | def send_venue(self, chat_id, latitude, longitude, title, address, foursquare_id=None, disable_notification=None,
reply_to_message_id=None, reply_markup=None):
"""
Use this method to send information about a venue.
:param chat_id: Integer or String : Unique identifier for the ... | python | def send_venue(self, chat_id, latitude, longitude, title, address, foursquare_id=None, disable_notification=None,
reply_to_message_id=None, reply_markup=None):
"""
Use this method to send information about a venue.
:param chat_id: Integer or String : Unique identifier for the ... | [
"def",
"send_venue",
"(",
"self",
",",
"chat_id",
",",
"latitude",
",",
"longitude",
",",
"title",
",",
"address",
",",
"foursquare_id",
"=",
"None",
",",
"disable_notification",
"=",
"None",
",",
"reply_to_message_id",
"=",
"None",
",",
"reply_markup",
"=",
... | Use this method to send information about a venue.
:param chat_id: Integer or String : Unique identifier for the target chat or username of the target channel
:param latitude: Float : Latitude of the venue
:param longitude: Float : Longitude of the venue
:param title: String : Name of th... | [
"Use",
"this",
"method",
"to",
"send",
"information",
"about",
"a",
"venue",
".",
":",
"param",
"chat_id",
":",
"Integer",
"or",
"String",
":",
"Unique",
"identifier",
"for",
"the",
"target",
"chat",
"or",
"username",
"of",
"the",
"target",
"channel",
":",... | 47b53b88123097f1b9562a6cd5d4e080b86185d1 | https://github.com/eternnoir/pyTelegramBotAPI/blob/47b53b88123097f1b9562a6cd5d4e080b86185d1/telebot/__init__.py#L799-L817 | train |
eternnoir/pyTelegramBotAPI | telebot/__init__.py | TeleBot.send_chat_action | def send_chat_action(self, chat_id, action):
"""
Use this method when you need to tell the user that something is happening on the bot's side.
The status is set for 5 seconds or less (when a message arrives from your bot, Telegram clients clear
its typing status).
:param chat_id:... | python | def send_chat_action(self, chat_id, action):
"""
Use this method when you need to tell the user that something is happening on the bot's side.
The status is set for 5 seconds or less (when a message arrives from your bot, Telegram clients clear
its typing status).
:param chat_id:... | [
"def",
"send_chat_action",
"(",
"self",
",",
"chat_id",
",",
"action",
")",
":",
"return",
"apihelper",
".",
"send_chat_action",
"(",
"self",
".",
"token",
",",
"chat_id",
",",
"action",
")"
] | Use this method when you need to tell the user that something is happening on the bot's side.
The status is set for 5 seconds or less (when a message arrives from your bot, Telegram clients clear
its typing status).
:param chat_id:
:param action: One of the following strings: 'typing', ... | [
"Use",
"this",
"method",
"when",
"you",
"need",
"to",
"tell",
"the",
"user",
"that",
"something",
"is",
"happening",
"on",
"the",
"bot",
"s",
"side",
".",
"The",
"status",
"is",
"set",
"for",
"5",
"seconds",
"or",
"less",
"(",
"when",
"a",
"message",
... | 47b53b88123097f1b9562a6cd5d4e080b86185d1 | https://github.com/eternnoir/pyTelegramBotAPI/blob/47b53b88123097f1b9562a6cd5d4e080b86185d1/telebot/__init__.py#L826-L836 | train |
eternnoir/pyTelegramBotAPI | telebot/__init__.py | TeleBot.kick_chat_member | def kick_chat_member(self, chat_id, user_id, until_date=None):
"""
Use this method to kick a user from a group or a supergroup.
:param chat_id: Int or string : Unique identifier for the target group or username of the target supergroup
:param user_id: Int : Unique identifier of the targe... | python | def kick_chat_member(self, chat_id, user_id, until_date=None):
"""
Use this method to kick a user from a group or a supergroup.
:param chat_id: Int or string : Unique identifier for the target group or username of the target supergroup
:param user_id: Int : Unique identifier of the targe... | [
"def",
"kick_chat_member",
"(",
"self",
",",
"chat_id",
",",
"user_id",
",",
"until_date",
"=",
"None",
")",
":",
"return",
"apihelper",
".",
"kick_chat_member",
"(",
"self",
".",
"token",
",",
"chat_id",
",",
"user_id",
",",
"until_date",
")"
] | Use this method to kick a user from a group or a supergroup.
:param chat_id: Int or string : Unique identifier for the target group or username of the target supergroup
:param user_id: Int : Unique identifier of the target user
:param until_date: Date when the user will be unbanned, unix time. I... | [
"Use",
"this",
"method",
"to",
"kick",
"a",
"user",
"from",
"a",
"group",
"or",
"a",
"supergroup",
".",
":",
"param",
"chat_id",
":",
"Int",
"or",
"string",
":",
"Unique",
"identifier",
"for",
"the",
"target",
"group",
"or",
"username",
"of",
"the",
"t... | 47b53b88123097f1b9562a6cd5d4e080b86185d1 | https://github.com/eternnoir/pyTelegramBotAPI/blob/47b53b88123097f1b9562a6cd5d4e080b86185d1/telebot/__init__.py#L838-L847 | train |
eternnoir/pyTelegramBotAPI | telebot/__init__.py | TeleBot.restrict_chat_member | def restrict_chat_member(self, chat_id, user_id, until_date=None, can_send_messages=None,
can_send_media_messages=None, can_send_other_messages=None,
can_add_web_page_previews=None):
"""
Use this method to restrict a user in a supergroup.
... | python | def restrict_chat_member(self, chat_id, user_id, until_date=None, can_send_messages=None,
can_send_media_messages=None, can_send_other_messages=None,
can_add_web_page_previews=None):
"""
Use this method to restrict a user in a supergroup.
... | [
"def",
"restrict_chat_member",
"(",
"self",
",",
"chat_id",
",",
"user_id",
",",
"until_date",
"=",
"None",
",",
"can_send_messages",
"=",
"None",
",",
"can_send_media_messages",
"=",
"None",
",",
"can_send_other_messages",
"=",
"None",
",",
"can_add_web_page_previe... | Use this method to restrict a user in a supergroup.
The bot must be an administrator in the supergroup for this to work and must have
the appropriate admin rights. Pass True for all boolean parameters to lift restrictions from a user.
Returns True on success.
:param chat_id: Int or Strin... | [
"Use",
"this",
"method",
"to",
"restrict",
"a",
"user",
"in",
"a",
"supergroup",
".",
"The",
"bot",
"must",
"be",
"an",
"administrator",
"in",
"the",
"supergroup",
"for",
"this",
"to",
"work",
"and",
"must",
"have",
"the",
"appropriate",
"admin",
"rights",... | 47b53b88123097f1b9562a6cd5d4e080b86185d1 | https://github.com/eternnoir/pyTelegramBotAPI/blob/47b53b88123097f1b9562a6cd5d4e080b86185d1/telebot/__init__.py#L852-L877 | train |
eternnoir/pyTelegramBotAPI | telebot/__init__.py | TeleBot.promote_chat_member | def promote_chat_member(self, chat_id, user_id, can_change_info=None, can_post_messages=None,
can_edit_messages=None, can_delete_messages=None, can_invite_users=None,
can_restrict_members=None, can_pin_messages=None, can_promote_members=None):
"""
... | python | def promote_chat_member(self, chat_id, user_id, can_change_info=None, can_post_messages=None,
can_edit_messages=None, can_delete_messages=None, can_invite_users=None,
can_restrict_members=None, can_pin_messages=None, can_promote_members=None):
"""
... | [
"def",
"promote_chat_member",
"(",
"self",
",",
"chat_id",
",",
"user_id",
",",
"can_change_info",
"=",
"None",
",",
"can_post_messages",
"=",
"None",
",",
"can_edit_messages",
"=",
"None",
",",
"can_delete_messages",
"=",
"None",
",",
"can_invite_users",
"=",
"... | Use this method to promote or demote a user in a supergroup or a channel. The bot must be an administrator
in the chat for this to work and must have the appropriate admin rights.
Pass False for all boolean parameters to demote a user. Returns True on success.
:param chat_id: Unique identifier f... | [
"Use",
"this",
"method",
"to",
"promote",
"or",
"demote",
"a",
"user",
"in",
"a",
"supergroup",
"or",
"a",
"channel",
".",
"The",
"bot",
"must",
"be",
"an",
"administrator",
"in",
"the",
"chat",
"for",
"this",
"to",
"work",
"and",
"must",
"have",
"the"... | 47b53b88123097f1b9562a6cd5d4e080b86185d1 | https://github.com/eternnoir/pyTelegramBotAPI/blob/47b53b88123097f1b9562a6cd5d4e080b86185d1/telebot/__init__.py#L879-L903 | train |
eternnoir/pyTelegramBotAPI | telebot/__init__.py | TeleBot.set_chat_photo | def set_chat_photo(self, chat_id, photo):
"""
Use this method to set a new profile photo for the chat. Photos can't be changed for private chats.
The bot must be an administrator in the chat for this to work and must have the appropriate admin rights.
Returns True on success.
Not... | python | def set_chat_photo(self, chat_id, photo):
"""
Use this method to set a new profile photo for the chat. Photos can't be changed for private chats.
The bot must be an administrator in the chat for this to work and must have the appropriate admin rights.
Returns True on success.
Not... | [
"def",
"set_chat_photo",
"(",
"self",
",",
"chat_id",
",",
"photo",
")",
":",
"return",
"apihelper",
".",
"set_chat_photo",
"(",
"self",
".",
"token",
",",
"chat_id",
",",
"photo",
")"
] | Use this method to set a new profile photo for the chat. Photos can't be changed for private chats.
The bot must be an administrator in the chat for this to work and must have the appropriate admin rights.
Returns True on success.
Note: In regular groups (non-supergroups), this method will only ... | [
"Use",
"this",
"method",
"to",
"set",
"a",
"new",
"profile",
"photo",
"for",
"the",
"chat",
".",
"Photos",
"can",
"t",
"be",
"changed",
"for",
"private",
"chats",
".",
"The",
"bot",
"must",
"be",
"an",
"administrator",
"in",
"the",
"chat",
"for",
"this... | 47b53b88123097f1b9562a6cd5d4e080b86185d1 | https://github.com/eternnoir/pyTelegramBotAPI/blob/47b53b88123097f1b9562a6cd5d4e080b86185d1/telebot/__init__.py#L916-L928 | train |
eternnoir/pyTelegramBotAPI | telebot/__init__.py | TeleBot.set_chat_title | def set_chat_title(self, chat_id, title):
"""
Use this method to change the title of a chat. Titles can't be changed for private chats.
The bot must be an administrator in the chat for this to work and must have the appropriate admin rights.
Returns True on success.
Note: In regu... | python | def set_chat_title(self, chat_id, title):
"""
Use this method to change the title of a chat. Titles can't be changed for private chats.
The bot must be an administrator in the chat for this to work and must have the appropriate admin rights.
Returns True on success.
Note: In regu... | [
"def",
"set_chat_title",
"(",
"self",
",",
"chat_id",
",",
"title",
")",
":",
"return",
"apihelper",
".",
"set_chat_title",
"(",
"self",
".",
"token",
",",
"chat_id",
",",
"title",
")"
] | Use this method to change the title of a chat. Titles can't be changed for private chats.
The bot must be an administrator in the chat for this to work and must have the appropriate admin rights.
Returns True on success.
Note: In regular groups (non-supergroups), this method will only work if th... | [
"Use",
"this",
"method",
"to",
"change",
"the",
"title",
"of",
"a",
"chat",
".",
"Titles",
"can",
"t",
"be",
"changed",
"for",
"private",
"chats",
".",
"The",
"bot",
"must",
"be",
"an",
"administrator",
"in",
"the",
"chat",
"for",
"this",
"to",
"work",... | 47b53b88123097f1b9562a6cd5d4e080b86185d1 | https://github.com/eternnoir/pyTelegramBotAPI/blob/47b53b88123097f1b9562a6cd5d4e080b86185d1/telebot/__init__.py#L943-L955 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.