Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/Azure/azure-sdk-for-python
Browse files Browse the repository at this point in the history
…into fr_readme

* 'master' of https://github.com/Azure/azure-sdk-for-python:
  [formrecognizer] rename async training method to train_model and sync method to begin_train_model (Azure#10929)
  Adding Azure Core Requirements (Azure#10926)
  release mgmt loganalytics 0.4.0 (Azure#10923)
  Refresh appservice test (Azure#10911)
  Alertsmanagement test (Azure#10912)
  regeneated cosmos (Azure#10907)
  adding azure core to packaging (Azure#10910)
  [formrecognizer] update docstrings and adds literalincludes (Azure#10901)
  [formrecognizer] enable mypy (Azure#10864)
  Make live managed identity tests independent of soft delete (Azure#10879)
  [pylint] check newlines on docstring admonition statements for ms docs (Azure#10844)
  • Loading branch information
iscai-msft committed Apr 20, 2020
2 parents 99f71e2 + 8586663 commit 044ec7a
Show file tree
Hide file tree
Showing 107 changed files with 6,261 additions and 2,197 deletions.
33 changes: 19 additions & 14 deletions doc/dev/mgmt/coverage.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
| azure-mgmt-appconfiguration | 30.00 |
| azure-mgmt-applicationinsights | - |
| azure-mgmt-appplatform | - |
| azure-mgmt-attestation | M |
| azure-mgmt-attestation | 100.00 |
| azure-mgmt-authorization | M |
| azure-mgmt-automation | 98.72 |
| azure-mgmt-azurestack | - |
Expand All @@ -22,7 +22,7 @@
| azure-mgmt-blueprint | - (S) |
| azure-mgmt-botservice | M |
| azure-mgmt-cdn | 100.00 |
| azure-mgmt-cognitiveservices | - |
| azure-mgmt-cognitiveservices | 87.00 |
| azure-mgmt-commerce | M |
| azure-mgmt-compute | 48.28 |
| azure-mgmt-consumption | M |
Expand All @@ -32,6 +32,7 @@
| azure-mgmt-core | M |
| azure-mgmt-cosmosdb | M |
| azure-mgmt-costmanagement | - |
| azure-mgmt-customerlockbox | - (S) |
| azure-mgmt-customproviders | - |
| azure-mgmt-databox | 100.00 |
| azure-mgmt-databoxedge | 100.00 |
Expand All @@ -46,6 +47,7 @@
| azure-mgmt-devops | - (S) |
| azure-mgmt-devspaces | - |
| azure-mgmt-devtestlabs | M |
| azure-mgmt-digitaltwins | - (S) |
| azure-mgmt-dns | M |
| azure-mgmt-documentdb | M |
| azure-mgmt-edgegateway | - |
Expand All @@ -58,11 +60,12 @@
| azure-mgmt-healthcareapis | 100.00 |
| azure-mgmt-hybridcompute | M |
| azure-mgmt-hybriddatamanager | - (S) |
| azure-mgmt-hybridkubernetes | - (S) |
| azure-mgmt-imagebuilder | 90.00 |
| azure-mgmt-iotcentral | M |
| azure-mgmt-iothub | M |
| azure-mgmt-iothubprovisioningservices | - |
| azure-mgmt-keyvault | M |
| azure-mgmt-keyvault | 100.00 |
| azure-mgmt-kubernetesconfiguration | - |
| azure-mgmt-kusto | 100.00 |
| azure-mgmt-labservices | - |
Expand All @@ -88,6 +91,7 @@
| azure-mgmt-operationsmanagement | - |
| azure-mgmt-peering | 47.00 |
| azure-mgmt-policyinsights | - |
| azure-mgmt-portal | - (S) |
| azure-mgmt-powerbidedicated | - |
| azure-mgmt-powerbiembedded | - |
| azure-mgmt-privatedns | - |
Expand Down Expand Up @@ -123,15 +127,13 @@
| azure-mgmt-trafficmanager | M |
| azure-mgmt-vmwarecloudsimple | - |
| azure-mgmt-vmwarevirtustream | - (S) |
| azure-mgmt-web | M |
| azure-mgmt-web | 1.00 |
| azure-mgmt-windowsiot | - (S) |
| azure-mgmt-workloadmonitor | - (S) |
| azureactivedirectory | - (S) |
| azuredata | - (S) |
| customer-insights | - (R) |
| customerlockbox | - (S) |
| datacatalog | - (R) |
| digitaltwins | - (S) |
| domainservices | - (R) |
| dynamicstelemetry | - (R) |
| guestconfiguration | - (R) |
Expand All @@ -143,7 +145,6 @@
| marketplace | - (R) |
| migrate | - (R) |
| migrateprojects | - (R) |
| portal | - (S) |
| recoveryservicessiterecovery | - (R) |
| resourcehealth | - (R) |
| service-map | - (R) |
Expand All @@ -154,17 +155,21 @@
| visualstudio | - (R) |
| windowsesu | - (S) |
| | |
| **TOTAL RPS** | **149** |
| **TOTAL RPS** | **150** |
| **TOTAL PACKAGES** | **109** |
| **MANUAL** | **53** |
| **MANUAL %** | **48.62** |
| **AUTO** | **18** |
| **AUTO %** | **16.51** |
| **NONE** | **40** |
| **NONE %** | **36.70** |
| **MANUAL** | **50** |
| **MANUAL %** | **45.87** |
| **AUTO** | **22** |
| **AUTO %** | **20.18** |
| **NONE** | **39** |
| **NONE %** | **35.78** |

"nn.nn" - coverage (%) of automatic test from swagger

"-" - no test coverage

"M" - manual only test coverage

"- (S)" - no package generated

"- (R)" - no Python readme settings, no package generated
3 changes: 2 additions & 1 deletion eng/tox/mypy_hard_failure_packages.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,6 @@
MYPY_HARD_FAILURE_OPTED = [
"azure-core",
"azure-eventhub",
"azure-ai-textanalytics"
"azure-ai-textanalytics",
"azure-ai-formrecognizer"
]
5 changes: 3 additions & 2 deletions scripts/pylint_custom_plugin/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,5 +56,6 @@ In the case of a false positive, use the disable command to remove the pylint er
| client-method-name-no-double-underscore | Don't use method names prefixed with "__". | # pylint:disable=client-method-name-no-double-underscore | [link](https://azure.github.io/azure-sdk/python_introduction.html#public-vs-private) |
| specify-parameter-names-in-call | Specify the parameter names when calling methods with more than 2 required positional parameters. e.g. self.get_foo(one, two, three=three, four=four, five=five) | # pylint:disable=specify-parameter-names-in-call | [link](https://azure.github.io/azure-sdk/python_introduction.html#method-signatures) |
| connection-string-should-not-be-constructor-param | Remove connection string parameter from client constructor. Create a method that creates the client using a connection string. | # pylint:disable=connection-string-should-not-be-constructor-param | [link](https://azure.github.io/azure-sdk/python_design.html#constructors-and-factory-methods) |
| package-name-incorrect | Change your distribution package name to only include dashes, e.g. azure-storage-file-share | # pylint:disable=package-name-incorrect | [link](https://azure.github.io/azure-sdk/python_implementation.html#packaging) |
| client-suffix-needed | Service client types should use a "Client" suffix, e.g. BlobClient. | # pylint:disable=client-suffix-needed | [link](https://azure.github.io/azure-sdk/python_design.html#clients) |
| package-name-incorrect | Change your distribution package name to only include dashes, e.g. azure-storage-file-share | # pylint:disable=package-name-incorrect | [link](https://azure.github.io/azure-sdk/python_implementation.html#packaging) |
| client-suffix-needed | Service client types should use a "Client" suffix, e.g. BlobClient. | # pylint:disable=client-suffix-needed | [link](https://azure.github.io/azure-sdk/python_design.html#clients) |
| docstring-admonition-needs-newline | Add a blank newline above the .. literalinclude statement. | # pylint:disable=docstring-admonition-needs-newline | No guideline, just helps our docs get built correctly for microsoft docs. |
90 changes: 87 additions & 3 deletions scripts/pylint_custom_plugin/pylint_guidelines_checker.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# ------------------------------------

"""
Pylint custom checkers for SDK guidelines: C4717 - C4738
Pylint custom checkers for SDK guidelines: C4717 - C4744
"""

import logging
Expand Down Expand Up @@ -1621,6 +1621,91 @@ def close(self):
)


class CheckDocstringAdmonitionNewline(BaseChecker):
__implements__ = IAstroidChecker

name = "check-admonition"
priority = -1
msgs = {
"C4744": (
"The .. literalinclude statement needs a blank line above it. ",
"docstring-admonition-needs-newline",
"Put a newline after the example and before the literalinclude.",
),
}
options = (
(
"ignore-docstring-admonition-needs-newline",
{
"default": False,
"type": "yn",
"metavar": "<y_or_n>",
"help": "Allow a docstring to not have newline after admonition example.",
},
),
)

def __init__(self, linter=None):
super(CheckDocstringAdmonitionNewline, self).__init__(linter)

def check_for_admonition(self, node):
"""Parse the docstring for an admonition statement.
If found, checks that the literalinclude statement has
two newlines above it.
:param node: ast.ClassDef or ast.FunctionDef
:return: None
"""

try:
# not every class/method will have a docstring so don't crash here, just return
if node.doc.find("admonition") != -1 and node.doc.find(".. literalinclude") != -1:
literal_include = node.doc.split(".. literalinclude")[0]
chars_list = list(reversed(literal_include))
for idx, char in enumerate(chars_list):
if char == '\n':
if chars_list[idx+1] == '\n':
break
else:
self.add_message(
"docstring-admonition-needs-newline", node=node, confidence=None
)
break
except Exception:
return

def visit_classdef(self, node):
"""Visits every class docstring.
:param node: ast.ClassDef
:return: None
"""
try:
for func in node.body:
if isinstance(func, astroid.FunctionDef) and func.name == "__init__":
self.check_for_admonition(node)
except Exception:
logger.debug("Pylint custom checker failed to check docstrings.")
pass

def visit_functiondef(self, node):
"""Visits every method docstring.
:param node: ast.FunctionDef
:return: None
"""
try:
if node.name == "__init__":
return
self.check_for_admonition(node)
except Exception:
logger.debug("Pylint custom checker failed to check docstrings.")
pass

# this line makes it work for async functions
visit_asyncfunctiondef = visit_functiondef


# if a linter is registered in this function then it will be checked with pylint
def register(linter):
linter.register_checker(ClientsDoNotUseStaticMethods(linter))
Expand All @@ -1637,6 +1722,7 @@ def register(linter):
linter.register_checker(ClientConstructorDoesNotHaveConnectionStringParam(linter))
linter.register_checker(PackageNameDoesNotUseUnderscoreOrPeriod(linter))
linter.register_checker(ServiceClientUsesNameWithClientSuffix(linter))
linter.register_checker(CheckDocstringAdmonitionNewline(linter))

# disabled by default, use pylint --enable=check-docstrings if you want to use it
linter.register_checker(CheckDocstringParameters(linter))
Expand All @@ -1649,5 +1735,3 @@ def register(linter):
# linter.register_checker(ClientListMethodsUseCorePaging(linter))
# linter.register_checker(ClientLROMethodsUseCorePolling(linter))
# linter.register_checker(ClientLROMethodsUseCorrectNaming(linter))


Loading

0 comments on commit 044ec7a

Please sign in to comment.