Skip to content

Commit

Permalink
removed docstrings
Browse files Browse the repository at this point in the history
  • Loading branch information
tasherif-msft committed Oct 21, 2020
1 parent 4482a1b commit 8094c4e
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 65 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import uuid

from typing import ( # pylint: disable=unused-import
Union, Optional, Any, TypeVar, TYPE_CHECKING
Optional, Any, TypeVar, TYPE_CHECKING
)

from azure.core.tracing.decorator import distributed_trace
Expand All @@ -25,7 +25,7 @@
class ShareLeaseClient(object):
"""Creates a new ShareLeaseClient.
This client provides lease operations on a ShareClient or ShareFileClient.
This client provides lease operations on a ShareFileClient.
:ivar str id:
The ID of the lease currently being maintained. This will be `None` if no
Expand All @@ -38,17 +38,16 @@ class ShareLeaseClient(object):
This will be `None` if no lease has yet been acquired or modified.
:param client:
The client of the file or share to lease.
:type client: ~azure.storage.fileshare.ShareFileClient or
~azure.storage.fileshare.ShareClient
The client of the file to lease.
:type client: ~azure.storage.fileshare.ShareFileClient
:param str lease_id:
A string representing the lease ID of an existing lease. This value does not
need to be specified in order to acquire a new lease, or break one.
"""
def __init__(
self, client, lease_id=None
): # pylint: disable=missing-client-constructor-parameter-credential,missing-client-constructor-parameter-kwargs
# type: (Union[ShareFileClient, ShareClient], Optional[str]) -> None
# type: (ShareFileClient, Optional[str]) -> None
self.id = lease_id or str(uuid.uuid4())
self.last_modified = None
self.etag = None
Expand All @@ -71,20 +70,14 @@ def __exit__(self, *args):
def acquire(self, **kwargs):
# type: (**Any) -> None
"""Requests a new lease. This operation establishes and manages a lock on a
file or share for write and delete operations. If the file or share does not have an active lease,
the File or Share service creates a lease on the file or share. If the file has an active lease,
file for write and delete operations. If the file does not have an active lease,
the File service creates a lease on the file. If the file has an active lease,
you can only request a new lease using the active lease ID.
If the file or share does not have an active lease, the File or Share service creates a
If the file does not have an active lease, the File service creates a
lease on the file and returns a new lease ID.
:keyword int lease_duration:
Specifies the duration of the lease, in seconds, or negative one
(-1) for a lease that never expires. File leases never expire. A non-infinite share lease can be
between 15 and 60 seconds. A share lease duration cannot be changed
using renew or change. Default is -1 (infinite share lease).
:keyword int timeout:
The timeout parameter is expressed in seconds.
:rtype: None
Expand All @@ -106,7 +99,7 @@ def acquire(self, **kwargs):
self.etag = response.get('etag') # type: str

@distributed_trace
def renew(self, **kwargs):
def _renew(self, **kwargs):
# type: (Any) -> None
"""Renews the share lease.
Expand Down Expand Up @@ -141,8 +134,8 @@ def renew(self, **kwargs):
def release(self, **kwargs):
# type: (Any) -> None
"""Releases the lease. The lease may be released if the lease ID specified on the request matches
that associated with the share or file. Releasing the lease allows another client to immediately acquire
the lease for the share or file as soon as the release is complete.
that associated with the file. Releasing the lease allows another client to immediately acquire
the lease for the or file as soon as the release is complete.
:keyword int timeout:
The timeout parameter is expressed in seconds.
Expand All @@ -169,7 +162,7 @@ def change(self, proposed_lease_id, **kwargs):
a new lease ID in x-ms-proposed-lease-id.
:param str proposed_lease_id:
Proposed lease ID, in a GUID string format. The File or Share service will raise an error
Proposed lease ID, in a GUID string format. The File service will raise an error
(Invalid request) if the proposed lease ID is not in the correct format.
:keyword int timeout:
The timeout parameter is expressed in seconds.
Expand All @@ -193,27 +186,14 @@ def change(self, proposed_lease_id, **kwargs):
@distributed_trace
def break_lease(self, **kwargs):
# type: (Any) -> int
"""Force breaks the lease if the file or share has an active lease. Any authorized request can break the lease;
"""Force breaks the lease if the file has an active lease. Any authorized request can break the lease;
the request is not required to specify a matching lease ID. An infinite lease breaks immediately.
Once a lease is broken, it cannot be changed. Any authorized request can break the lease;
the request is not required to specify a matching lease ID.
When a lease is successfully broken, the response indicates the interval
in seconds until a new lease can be acquired.
:keyword int lease_break_period:
This is the proposed duration of seconds that the share lease
should continue before it is broken, between 0 and 60 seconds. This
break period is only used if it is shorter than the time remaining
on the share lease. If longer, the time remaining on the share lease is used.
A new share lease will not be available before the break period has
expired, but the share lease may be held for longer than the break
period. If this header does not appear with a break
operation, a fixed-duration share lease breaks after the remaining share lease
period elapses, and an infinite share lease breaks immediately.
.. versionadded:: 12.6.0
:keyword int timeout:
The timeout parameter is expressed in seconds.
:return: Approximate time remaining in the lease period, in seconds.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
# --------------------------------------------------------------------------
# pylint: disable=invalid-overridden-method
from typing import ( # pylint: disable=unused-import
Union, Optional, Any, IO, Iterable, AnyStr, Dict, List, Tuple,
Optional, Any, IO, Iterable, AnyStr, Dict, List, Tuple,
TypeVar, TYPE_CHECKING
)

Expand All @@ -26,7 +26,7 @@
class ShareLeaseClient(LeaseClientBase):
"""Creates a new ShareLeaseClient.
This client provides lease operations on a ShareClient or ShareFileClient.
This client provides lease operations on a ShareFileClient.
:ivar str id:
The ID of the lease currently being maintained. This will be `None` if no
Expand All @@ -39,9 +39,8 @@ class ShareLeaseClient(LeaseClientBase):
This will be `None` if no lease has yet been acquired or modified.
:param client:
The client of the file or share to lease.
:type client: ~azure.storage.fileshare.ShareFileClient or
~azure.storage.fileshare.ShareClient
The client of the file to lease.
:type client: ~azure.storage.fileshare.ShareFileClient
:param str lease_id:
A string representing the lease ID of an existing lease. This value does not
need to be specified in order to acquire a new lease, or break one.
Expand All @@ -63,20 +62,14 @@ async def __aexit__(self, *args):
async def acquire(self, **kwargs):
# type: (**Any) -> None
"""Requests a new lease. This operation establishes and manages a lock on a
file or share for write and delete operations. If the file or share does not have an active lease,
the File or Share service creates a lease on the file or share. If the file has an active lease,
file for write and delete operations. If the file does not have an active lease,
the File service creates a lease on the file. If the file has an active lease,
you can only request a new lease using the active lease ID.
If the file or share does not have an active lease, the File or Share service creates a
If the file does not have an active lease, the File service creates a
lease on the file and returns a new lease ID.
:keyword int lease_duration:
Specifies the duration of the lease, in seconds, or negative one
(-1) for a lease that never expires. File leases never expire. A non-infinite share lease can be
between 15 and 60 seconds. A share lease duration cannot be changed
using renew or change. Default is -1 (infinite share lease).
:keyword int timeout:
The timeout parameter is expressed in seconds.
:rtype: None
Expand All @@ -98,7 +91,7 @@ async def acquire(self, **kwargs):
self.etag = response.get('etag') # type: str

@distributed_trace_async
async def renew(self, **kwargs):
async def _renew(self, **kwargs):
# type: (Any) -> None
"""Renews the share lease.
Expand Down Expand Up @@ -133,8 +126,8 @@ async def renew(self, **kwargs):
async def release(self, **kwargs):
# type: (Any) -> None
"""Releases the lease. The lease may be released if the lease ID specified on the request matches
that associated with the share or file. Releasing the lease allows another client to immediately acquire
the lease for the share or file as soon as the release is complete.
that associated with the file. Releasing the lease allows another client to immediately acquire
the lease for the file as soon as the release is complete.
:keyword int timeout:
The timeout parameter is expressed in seconds.
Expand All @@ -161,7 +154,7 @@ async def change(self, proposed_lease_id, **kwargs):
a new lease ID in x-ms-proposed-lease-id.
:param str proposed_lease_id:
Proposed lease ID, in a GUID string format. The File or Share service raises an error
Proposed lease ID, in a GUID string format. The File service raises an error
(Invalid request) if the proposed lease ID is not in the correct format.
:keyword int timeout:
The timeout parameter is expressed in seconds.
Expand All @@ -185,27 +178,14 @@ async def change(self, proposed_lease_id, **kwargs):
@distributed_trace_async
async def break_lease(self, **kwargs):
# type: (Any) -> int
"""Force breaks the lease if the file or share has an active lease. Any authorized request can break the lease;
"""Force breaks the lease if the file has an active lease. Any authorized request can break the lease;
the request is not required to specify a matching lease ID. An infinite lease breaks immediately.
Once a lease is broken, it cannot be changed. Any authorized request can break the lease;
the request is not required to specify a matching lease ID.
When a lease is successfully broken, the response indicates the interval
in seconds until a new lease can be acquired.
:keyword int lease_break_period:
This is the proposed duration of seconds that the share lease
should continue before it is broken, between 0 and 60 seconds. This
break period is only used if it is shorter than the time remaining
on the share lease. If longer, the time remaining on the share lease is used.
A new share lease will not be available before the break period has
expired, but the share lease may be held for longer than the break
period. If this header does not appear with a break
operation, a fixed-duration share lease breaks after the remaining share lease
period elapses, and an infinite share lease breaks immediately.
.. versionadded:: 12.6.0
:keyword int timeout:
The timeout parameter is expressed in seconds.
:return: Approximate time remaining in the lease period, in seconds.
Expand Down

0 comments on commit 8094c4e

Please sign in to comment.