File: environment_exclusions.py

package info (click to toggle)
python-azure 20230112%2Bgit-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 749,544 kB
  • sloc: python: 6,815,827; javascript: 287; makefile: 195; xml: 109; sh: 105
file content (398 lines) | stat: -rw-r--r-- 13,263 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
#!/usr/bin/env python

# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------------------------------
import logging

PYLINT_OPT_OUT = [
    "azure-applicationinsights",
    "azure-batch",
    "azure-cognitiveservices-anomalydetector",
    "azure-cognitiveservices-formrecognizer",
    "azure-cognitiveservices-knowledge-nspkg",
    "azure-cognitiveservices-knowledge-qnamaker",
    "azure-cognitiveservices-language-luis",
    "azure-cognitiveservices-language-nspkg",
    "azure-cognitiveservices-language-spellcheck",
    "azure-cognitiveservices-language-textanalytics",
    "azure-cognitiveservices-nspkg",
    "azure-cognitiveservices-personalizer",
    "azure-cognitiveservices-search-autosuggest",
    "azure-cognitiveservices-search-customimagesearch",
    "azure-cognitiveservices-search-customsearch",
    "azure-cognitiveservices-search-entitysearch",
    "azure-cognitiveservices-search-imagesearch",
    "azure-cognitiveservices-search-newssearch",
    "azure-cognitiveservices-search-nspkg",
    "azure-cognitiveservices-search-videosearch",
    "azure-cognitiveservices-search-visualsearch",
    "azure-cognitiveservices-search-websearch",
    "azure-cognitiveservices-vision-computervision",
    "azure-cognitiveservices-vision-contentmoderator",
    "azure-cognitiveservices-vision-customvision",
    "azure-cognitiveservices-vision-face",
    "azure-cognitiveservices-vision-nspkg",
    "azure-common",
    "azure-nspkg",
    "azure-servicemanagement-legacy",
    "azure-graphrbac",
    "azure-loganalytics",
    "azure-servicefabric",
    "azure-template",
    "azure-keyvault",
    "azure-synapse",
    "azure-synapse-artifacts",
    "azure-synapse-spark",
    "azure-synapse-accesscontrol",
    "azure-synapse-monitoring",
    "azure-synapse-managedprivateendpoints",
    "azure-synapse-nspkg",
    "azure-ai-anomalydetector",
    "azure-security-attestation",
    "azure-iot-deviceupdate",
    "azure-purview-nspkg",
    "azure-purview-scanning",
    "azure-purview-catalog",
    "azure-purview-account",
    "azure-purview-administration",
    "azure-messaging-nspkg",
    "azure-agrifood-farming",
    "azure-developer-loadtesting",
    "azure-developer-devcenter",
    "azure-messaging-webpubsubservice",
]

# omit package from running mypy checks
MYPY_OPT_OUT = [
    "azure-agrifood-farming",
    "azure-ai-anomalydetector",
    "azure-appconfiguration-provider",
    "azure-security-attestation",
    "azure-batch",
    "azure-communication-chat",
    "azure-communication-email",
    "azure-communication-identity",
    "azure-communication-jobrouter",
    "azure-communication-networktraversal",
    "azure-communication-phonenumbers",
    "azure-communication-rooms",
    "azure-communication-sms",
    "azure-cosmos",
    "azure-confidentialledger",
    "azure-containerregistry",
    "azure-mgmt-core",
    "azure-core-experimental",
    "azure-core-tracing-opencensus",
    "azure-core-tracing-opentelemetry",
    "azure-iot-deviceupdate",
    "azure-digitaltwins-core",
    "azure-eventhub-checkpointstoreblob",
    "azure-eventhub-checkpointstoreblob-aio",
    "azure-eventhub-checkpointstoretable",
    "azure-developer-loadtesting",
    "azure-maps-geolocation",
    "azure-maps-render",
    "azure-maps-route",
    "azure-maps-search",
    "azure-mixedreality-authentication",
    "azure-ai-ml",
    "azure-iot-modelsrepository",
    "azure-monitor-ingestion",
    "azure-monitor-opentelemetry-exporter",
    "azure-purview-administration",
    "azure-purview-catalog",
    "azure-purview-scanning",
    "azure-schemaregistry",
    "azure-schemaregistry-avroencoder",
    "azure-search-documents",
    "azure-storage-blob",
    "azure-storage-blob-changefeed",
    "azure-storage-file-datalake",
    "azure-storage-file-share",
    "azure-storage-queue",
    "azure-synapse-accesscontrol",
    "azure-synapse-artifacts",
    "azure-synapse-managedprivateendpoints",
    "azure-synapse-monitoring",
    "azure-synapse-spark",
    "azure-messaging-webpubsubservice",
]

# omit package from running pyright checks
PYRIGHT_OPT_OUT = [
    "azure-agrifood-farming",
    "azure-ai-anomalydetector",
    "azure-appconfiguration",
    "azure-appconfiguration-provider",
    "azure-security-attestation",
    "azure-batch",
    "azure-communication-chat",
    "azure-communication-email",
    "azure-communication-identity",
    "azure-communication-jobrouter",
    "azure-communication-networktraversal",
    "azure-communication-phonenumbers",
    "azure-communication-rooms",
    "azure-communication-sms",
    "azure-confidentialledger",
    "azure-containerregistry",
    "azure-core",
    "azure-mgmt-core",
    "azure-core-experimental",
    "azure-core-tracing-opencensus",
    "azure-core-tracing-opentelemetry",
    "azure-cosmos",
    "azure-developer-devcenter",
    "azure-iot-deviceupdate",
    "azure-digitaltwins-core",
    "azure-eventgrid",
    "azure-eventhub",
    "azure-eventhub-checkpointstoreblob",
    "azure-eventhub-checkpointstoreblob-aio",
    "azure-eventhub-checkpointstoretable",
    "azure-ai-formrecognizer",
    "azure-identity",
    "azure-keyvault-administration",
    "azure-keyvault-certificates",
    "azure-keyvault-keys",
    "azure-keyvault-secrets",
    "azure-developer-loadtesting",
    "azure-maps-geolocation",
    "azure-maps-render",
    "azure-maps-route",
    "azure-maps-search",
    "azure-ai-metricsadvisor",
    "azure-mixedreality-authentication",
    "azure-ai-ml",
    "azure-iot-modelsrepository",
    "azure-monitor-ingestion",
    "azure-monitor-opentelemetry-exporter",
    "azure-ai-personalizer",
    "azure-purview-administration",
    "azure-purview-catalog",
    "azure-purview-scanning",
    "azure-mixedreality-remoterendering",
    "azure-schemaregistry",
    "azure-schemaregistry-avroencoder",
    "azure-search-documents",
    "azure-servicebus",
    "azure-storage-blob",
    "azure-storage-blob-changefeed",
    "azure-storage-file-datalake",
    "azure-storage-file-share",
    "azure-storage-queue",
    "azure-synapse-accesscontrol",
    "azure-synapse-artifacts",
    "azure-synapse-managedprivateendpoints",
    "azure-synapse-monitoring",
    "azure-synapse-spark",
    "azure-data-tables",
    "azure-ai-textanalytics",
    "azure-ai-translation-document",
    "azure-messaging-webpubsubservice",
]

# omit package from running verifytypes checks
VERIFYTYPES_OPT_OUT = [
    "azure-agrifood-farming",
    "azure-ai-anomalydetector",
    "azure-appconfiguration",
    "azure-appconfiguration-provider",
    "azure-security-attestation",
    "azure-batch",
    "azure-communication-chat",
    "azure-communication-email",
    "azure-communication-identity",
    "azure-communication-jobrouter",
    "azure-communication-networktraversal",
    "azure-communication-phonenumbers",
    "azure-communication-rooms",
    "azure-communication-sms",
    "azure-confidentialledger",
    "azure-containerregistry",
    "azure-core",
    "azure-mgmt-core",
    "azure-core-experimental",
    "azure-core-tracing-opencensus",
    "azure-core-tracing-opentelemetry",
    "azure-cosmos",
    "azure-developer-devcenter",
    "azure-iot-deviceupdate",
    "azure-digitaltwins-core",
    "azure-eventgrid",
    "azure-eventhub",
    "azure-eventhub-checkpointstoreblob",
    "azure-eventhub-checkpointstoreblob-aio",
    "azure-eventhub-checkpointstoretable",
    "azure-ai-formrecognizer",
    "azure-keyvault-administration",
    "azure-keyvault-certificates",
    "azure-keyvault-keys",
    "azure-keyvault-secrets",
    "azure-developer-loadtesting",
    "azure-maps-geolocation",
    "azure-maps-render",
    "azure-maps-route",
    "azure-maps-search",
    "azure-ai-metricsadvisor",
    "azure-mixedreality-authentication",
    "azure-ai-ml",
    "azure-iot-modelsrepository",
    "azure-monitor-ingestion",
    "azure-monitor-opentelemetry-exporter",
    "azure-ai-personalizer",
    "azure-purview-administration",
    "azure-purview-catalog",
    "azure-purview-scanning",
    "azure-mixedreality-remoterendering",
    "azure-schemaregistry",
    "azure-schemaregistry-avroencoder",
    "azure-servicebus",
    "azure-storage-blob",
    "azure-storage-blob-changefeed",
    "azure-storage-file-datalake",
    "azure-storage-file-share",
    "azure-storage-queue",
    "azure-synapse-accesscontrol",
    "azure-synapse-artifacts",
    "azure-synapse-managedprivateendpoints",
    "azure-synapse-monitoring",
    "azure-synapse-spark",
    "azure-data-tables",
    "azure-messaging-webpubsubservice",
]

# omit package from running type checkers on samples
# note: if removed from this list, you must enable one or both of mypy or pyright checks.
TYPE_CHECK_SAMPLES_OPT_OUT = [
    "azure-ai-metricsadvisor",
    "azure-ai-personalizer",
    "azure-agrifood-farming",
    "azure-ai-anomalydetector",
    "azure-appconfiguration-provider",
    "azure-security-attestation",
    "azure-batch",
    "azure-communication-chat",
    "azure-communication-email",
    "azure-communication-identity",
    "azure-communication-jobrouter",
    "azure-communication-networktraversal",
    "azure-communication-phonenumbers",
    "azure-communication-rooms",
    "azure-communication-sms",
    "azure-confidentialledger",
    "azure-containerregistry",
    "azure-core",
    "azure-mgmt-core",
    "azure-core-experimental",
    "azure-core-tracing-opencensus",
    "azure-core-tracing-opentelemetry",
    "azure-cosmos",
    "azure-developer-devcenter",
    "azure-iot-deviceupdate",
    "azure-digitaltwins-core",
    "azure-eventgrid",
    "azure-eventhub",
    "azure-eventhub-checkpointstoreblob",
    "azure-eventhub-checkpointstoreblob-aio",
    "azure-eventhub-checkpointstoretable",
    "azure-keyvault-administration",
    "azure-keyvault-certificates",
    "azure-keyvault-keys",
    "azure-keyvault-secrets",
    "azure-developer-loadtesting",
    "azure-maps-geolocation",
    "azure-maps-render",
    "azure-maps-route",
    "azure-maps-search",
    "azure-mixedreality-authentication",
    "azure-ai-ml",
    "azure-iot-modelsrepository",
    "azure-monitor-ingestion",
    "azure-monitor-opentelemetry-exporter",
    "azure-monitor-query",
    "azure-purview-administration",
    "azure-purview-catalog",
    "azure-purview-scanning",
    "azure-mixedreality-remoterendering",
    "azure-schemaregistry",
    "azure-schemaregistry-avroencoder",
    "azure-servicebus",
    "azure-storage-blob",
    "azure-storage-blob-changefeed",
    "azure-storage-file-datalake",
    "azure-storage-file-share",
    "azure-storage-queue",
    "azure-synapse-accesscontrol",
    "azure-synapse-artifacts",
    "azure-synapse-managedprivateendpoints",
    "azure-synapse-monitoring",
    "azure-synapse-spark",
    "azure-ai-translation-document",
    "azure-messaging-webpubsubservice",
]


# --------------------------------------------------------------------------------------------------------------------
# DO NOT add packages to the below lists. They are used to omit packages that will never run type checking.
IGNORE_FILTER = ["nspkg", "mgmt", "cognitiveservices"]
FILTER_EXCLUSIONS = ["azure-mgmt-core"]
IGNORE_PACKAGES = [
    "azure-applicationinsights",
    "azure-servicemanagement-legacy",
    "azure",
    "azure-storage",
    "azure-monitor",
    "azure-servicefabric",
    "azure-keyvault",
    "azure-synapse",
    "azure-common",
    "conda-recipe",
    "azure-graphrbac",
    "azure-loganalytics",
    "azure-media-analytics-edge",
    "azure-media-videoanalyzer-edge",
    "azure-template",
]


def filter_tox_environment_string(namespace_argument: str, package_name: str) -> str:
    """
    Takes an incoming comma separated list of tox environments and package name. Resolves whether or not
    each given tox environment should run, given comparison to single unified exclusion file in `environment_exclusions`.

    :param namespace_argument: A namespace argument.
    :param package_name: The name of the package. This takes the form of a comma separated list: "whl,sdist,mindependency". "whl". "lint,pyright,sphinx".
    """
    if namespace_argument:
        tox_envs = namespace_argument.strip().split(",")
        filtered_set = []

        for tox_env in tox_envs:
            exclusions_for_env = []
            try:
                exclusions_for_env = globals()[f"{tox_env.strip().upper()}_OPT_OUT"]
            except Exception as e:
                pass

            if exclusions_for_env:
                if package_name in exclusions_for_env:
                    continue

            filtered_set.append(tox_env)
        return ",".join(filtered_set)

    return namespace_argument


def is_ignored_package(package_name: str) -> bool:
    """
    Evaluates a package name and evaluates whether or not tox environments should run against it.
    """
    if package_name in IGNORE_PACKAGES:
        return True
    if package_name not in FILTER_EXCLUSIONS and any([identifier in package_name for identifier in IGNORE_FILTER]):
        return True
    return False