由mypyboto3buider4.2.0生成的boto3.CloudWatch 1.16.35服务的类型注释

mypy-boto3-cloudwatch的Python项目详细描述


mypy-boto3-云表

PyPI - mypy-boto3-cloudwatchPyPI - Python VersionDocs

boto3.typed

的类型批注 boto3.CloudWatch 1.16.35服务 兼容 VSCodePyCharmEmacsSublime Textmypypyright 以及其他工具。在

mypy-boto3-buider 4.2.0生成。在

更多信息可在boto3-stubs页找到。在

了解它如何帮助查找和修复潜在的错误:

boto3-stubs demo

如何安装

CloudWatch服务安装boto3-stubs。在

python -m pip install boto3-stubs[cloudwatch]

使用

VSCode

  • 安装Python extension
  • 安装Pylance extension
  • Pylance设置为Python语言服务器
  • 在您的环境中安装boto-stubs[cloudwatch]python -m pip install 'boto3-stubs[cloudwatch]'

类型检查和自动完成都应该适用于CloudWatch服务。 不需要显式的类型注释,请照常编写boto3代码。在

PyCharm

  • 在您的环境中安装boto-stubs[cloudwatch]python -m pip install 'boto3-stubs[cloudwatch]'

类型检查和自动完成都应该适用于CloudWatch服务。 不需要显式的类型注释,请照常编写boto3代码。 自动完成在大型项目或安装了大量boto3-stubs子模块时可能会很慢。在

其他IDE

没有经过测试,但是只要您的IDE支持mypy或{},一切都应该正常。在

mypy

  • 安装mypypython -m pip install mypy
  • 在您的环境中安装boto-stubs[cloudwatch]python -m pip install 'boto3-stubs[cloudwatch]'
  • 像往常一样运行mypy

类型检查应该适用于CloudWatch服务。 不需要显式的类型注释,请照常编写boto3代码。在

pyright

  • 安装pyrightyarn global add pyright
  • 在您的环境中安装boto-stubs[cloudwatch]python -m pip install 'boto3-stubs[cloudwatch]'
  • 或者,您可以将boto3-stubs安装到typings文件夹中。在

类型检查应该适用于CloudWatch服务。 不需要显式的类型注释,请照常编写boto3代码。在

显式类型批注

客户端注释

CloudWatchClientboto3.client("cloudwatch")提供注释。在

^{pr2}$

分页器注释

mypy_boto3_cloudwatch.paginator模块包含所有分页器的类型注释。在

frommypy_boto3_cloudwatchimportCloudWatchClientfrommypy_boto3_cloudwatch.paginatorimport(DescribeAlarmHistoryPaginator,DescribeAlarmsPaginator,GetMetricDataPaginator,ListDashboardsPaginator,ListMetricsPaginator,)client:CloudWatchClient=boto3.client("cloudwatch")# Explicit type annotations are optional here# Type should be correctly discovered by mypy and IDEs# VSCode requires explicit type annotationsdescribe_alarm_history_paginator:DescribeAlarmHistoryPaginator=client.get_paginator("describe_alarm_history")describe_alarms_paginator:DescribeAlarmsPaginator=client.get_paginator("describe_alarms")get_metric_data_paginator:GetMetricDataPaginator=client.get_paginator("get_metric_data")list_dashboards_paginator:ListDashboardsPaginator=client.get_paginator("list_dashboards")list_metrics_paginator:ListMetricsPaginator=client.get_paginator("list_metrics")

服务员注释

mypy_boto3_cloudwatch.waiter模块包含所有等待者的类型注释。在

frommypy_boto3_cloudwatchimportCloudWatchClientfrommypy_boto3_cloudwatch.waiterimportAlarmExistsWaiter,CompositeAlarmExistsWaiterclient:CloudWatchClient=boto3.client("cloudwatch")# Explicit type annotations are optional here# Type should be correctly discovered by mypy and IDEs# VSCode requires explicit type annotationsalarm_exists_waiter:AlarmExistsWaiter=client.get_waiter("alarm_exists")composite_alarm_exists_waiter:CompositeAlarmExistsWaiter=client.get_waiter("composite_alarm_exists")

服务资源注释

CloudWatchServiceResourceboto3.resource("cloudwatch")提供注释。在

frommypy_boto3_cloudwatchimportCloudWatchServiceResourceresource:CloudWatchServiceResource=boto3.resource("cloudwatch")# now resource usage is checked by mypy and IDE should provide code auto-complete# works for session as wellsession=boto3.session.Session(region="us-west-1")session_resource:CloudWatchServiceResource=session.resource("cloudwatch")

其他资源注释

mypy_boto3_cloudwatch.service_resource模块包含所有资源的类型注释。在

frommypy_boto3_cloudwatchimportCloudWatchServiceResourcefrommypy_boto3_cloudwatch.service_resourceimportAlarm,Metricresource:CloudWatchServiceResource=boto3.resource("cloudwatch")# Explicit type annotations are optional here# Type should be correctly discovered by mypy and IDEsmy_alarm:Alarm=resource.Alarm(...)my_metric:Metric=resource.Metric(...)

集合注释

mypy_boto3_cloudwatch.service_resource模块包含类型注释 对于所有CloudWatchServiceResource集合。在

frommypy_boto3_cloudwatchimportCloudWatchServiceResourcefrommypy_boto3_cloudwatch.service_resourceimport(ServiceResourceAlarmsCollection,ServiceResourceMetricsCollection,)resource:CloudWatchServiceResource=boto3.resource("cloudwatch")# Explicit type annotations are optional here# Type should be correctly discovered by mypy and IDEsalarms:cloudwatch_resources.ServiceResourceAlarmsCollection=resource.alarmsmetrics:cloudwatch_resources.ServiceResourceMetricsCollection=resource.metrics

键入的措辞

mypy_boto3_cloudwatch.type_defs模块包含组装的结构和形状 以进行额外的类型检查。在

frommypy_boto3_cloudwatch.type_defsimport(AlarmHistoryItemTypeDef,AnomalyDetectorConfigurationTypeDef,AnomalyDetectorTypeDef,CompositeAlarmTypeDef,DashboardEntryTypeDef,DashboardValidationMessageTypeDef,DatapointTypeDef,DeleteInsightRulesOutputTypeDef,DescribeAlarmHistoryOutputTypeDef,DescribeAlarmsForMetricOutputTypeDef,DescribeAlarmsOutputTypeDef,DescribeAnomalyDetectorsOutputTypeDef,DescribeInsightRulesOutputTypeDef,DimensionFilterTypeDef,DimensionTypeDef,DisableInsightRulesOutputTypeDef,EnableInsightRulesOutputTypeDef,GetDashboardOutputTypeDef,GetInsightRuleReportOutputTypeDef,GetMetricDataOutputTypeDef,GetMetricStatisticsOutputTypeDef,GetMetricWidgetImageOutputTypeDef,InsightRuleContributorDatapointTypeDef,InsightRuleContributorTypeDef,InsightRuleMetricDatapointTypeDef,InsightRuleTypeDef,ListDashboardsOutputTypeDef,ListMetricsOutputTypeDef,ListTagsForResourceOutputTypeDef,MessageDataTypeDef,MetricAlarmTypeDef,MetricDataQueryTypeDef,MetricDataResultTypeDef,MetricDatumTypeDef,MetricStatTypeDef,MetricTypeDef,PaginatorConfigTypeDef,PartialFailureTypeDef,PutDashboardOutputTypeDef,RangeTypeDef,ResponseMetadata,StatisticSetTypeDef,TagTypeDef,WaiterConfigTypeDef,)defget_structure()->AlarmHistoryItemTypeDef:return{...}

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
java Spring MVC@ExceptionHandler未能捕获异常   Java存储过程的内部类不可见   java使用ImageIO从具有alpha透明度的图像中保存具有索引透明度的GIF   java如何在Android中通过编程获得自己的电话号码?   文本使用Java在文件中的每行开头和结尾追加一个字符   使用JDK8生成时发生java语法异常   java为每个平台获得正确的斜杠   jvm Java OutOfMemory错误   C++ java加载一个DLL,从JNI中导出另一个DLL的方法   java如何在特定位置将字符串列表添加到另一个列表中?   groovy如何在jmeter的_groovy()函数中执行java方法/函数?   在Java中寻找素数   java如何向JavaFX图表添加辅助图例?   java JButton在使用时不会更改更新映像。设置图标(图标);   java IllegalArgumentException:错误消息没有意义   java正则表达式检测<code></代码>代码块   定义单击按钮的java   java在subversion中合并两个本地文件   java线程的用途是什么。netsocket中的sleep()。伊奥?