Skip to content

[Storage Files] Migrating to TypeSpec#46929

Draft
l0lawrence wants to merge 49 commits into
Azure:mainfrom
l0lawrence:storagefiles
Draft

[Storage Files] Migrating to TypeSpec#46929
l0lawrence wants to merge 49 commits into
Azure:mainfrom
l0lawrence:storagefiles

Conversation

@l0lawrence
Copy link
Copy Markdown
Member

No description provided.

l0lawrence and others added 15 commits April 14, 2026 10:16
Move pylint disable comments to the correct lines where violations
occur (protected-access, unused-argument) and fix implicit string
concatenation in _parser.py.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…h hacks

Refactor the 10 custom subclasses in azure/storage/fileshare/_models.py
(RetentionPolicy, Metrics, CorsRule, SmbMultichannel, SmbEncryptionInTransit,
ShareSmbSettings, NfsEncryptionInTransit, ShareNfsSettings,
ShareProtocolSettings, AccessPolicy) so they no longer shadow the parent
_RestField descriptors and properly delegate to super().__init__(**kwargs).

With the subclasses fixed at the source, the runtime monkey-patches in
_generated/models/_patch.py (_patched_getattr/setattr/getattribute/new) are
no longer needed; revert that file to the empty stock template.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <copilot@github.com>
Port changes from azure-storage-blob storageblob3 branch to keep _shared
files consistent across Storage packages:
- request_handlers.py: collapse split string literals
- uploads.py / uploads_async.py: switch BlockBlob/PageBlob/AppendBlob
  ChunkUploader callers to keyword args and to the new etag /
  match_condition / append_position kwarg names; pop those kwargs in
  upload_data_chunks and upload_substream_blocks when running in parallel.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
The wire format for creationTime/lastAccessTime/lastWriteTime/changeTime
is ISO 8601, not RFC 7231 (only Last-Modified is RFC 7231). Declaring
them as Optional[datetime.datetime] with format="rfc7231" causes the
XML deserializer to fail and leave a raw xml.etree.ElementTree.Element
in _data, which crashes JSON serialization downstream (Azure CLI).

Match the legacy SDK behavior by declaring these fields as Optional[str].

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Resolved conflicts in azure-storage-file-share tests/perfstress by keeping the PR's reformatted versions (Azure#46609 was pure pylint reformatting, already covered by the branch's own reformat).

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Move 'protected-access' disables from closing-bracket lines onto the
  lines where '_from_generated' is actually accessed (Metrics,
  SharePropertiesPaged, HandlesPaged).
- Use scoped 'disable/enable=protected-access' block in
  DirectoryPropertiesPaged._extract_data_cb (two accesses too long to
  carry inline disables under the 120-char limit).
- Add 'unused-argument' disables to the backcompat **kwargs catch-all
  __init__ methods on SmbMultichannel, SmbEncryptionInTransit,
  ShareSmbSettings, NfsEncryptionInTransit, ShareNfsSettings, and
  ShareProtocolSettings.

No logic changes.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@github-actions github-actions Bot added the Storage Storage Service (Queues, Blobs, Files) label May 15, 2026
if parallel and "modified_access_conditions" in kwargs:
# Access conditions do not work with parallelism
kwargs["modified_access_conditions"] = None
if parallel:
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

these changes are from storage-blob changes with typespec

@@ -53,18 +54,20 @@ class ShareLeaseClient: # pylint: disable=client-accepts-api-version-keyword
This will be `None` if no lease has yet been acquired or modified."""

def __init__( # pylint: disable=missing-client-constructor-parameter-credential, missing-client-constructor-parameter-kwargs
self, client: Union["ShareFileClient", "ShareClient"],
lease_id: Optional[str] = None
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

look at this fn

if isinstance(self._client, FileOperations) and lease_break_period:
raise TypeError("Setting a lease break period is only applicable to Share leases.")

if self._allow_trailing_dot is not None:
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why does this have a if not none check

) -> Tuple["LocationMode", Any]:
file_properties = deserialize_file_properties(response, obj, headers)
# The new TypeSpec-generated download returns an iterator (from iter_bytes/iter_raw)
# instead of a response object with settable attributes. Wrap it.
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this look at

@l0lawrence
Copy link
Copy Markdown
Member Author

/azp run python - storage - tests

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 1 pipeline(s).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Storage Storage Service (Queues, Blobs, Files)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants