Skip to content

Commit

Permalink
Add type hints
Browse files Browse the repository at this point in the history
  • Loading branch information
Delgan committed Dec 7, 2024
1 parent 1fc9d21 commit 311b698
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
version=version,
packages=["win32_setctime"],
package_dir={"": "src"},
package_data={"win32_setctime": ["py.typed"]},
description="A small Python utility to set file creation time on Windows",
long_description=readme,
long_description_content_type="text/markdown",
Expand Down
8 changes: 7 additions & 1 deletion src/win32_setctime/_setctime.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import os
import sys

try:
from ctypes import byref, get_last_error, wintypes, FormatError, WinDLL, WinError
Expand Down Expand Up @@ -36,7 +37,12 @@
SUPPORTED = os.name == "nt"


def setctime(filepath, timestamp, *, follow_symlinks=True):
from typing import Union


def setctime(
filepath: Union[str, os.PathLike[str]], timestamp: float, *, follow_symlinks: bool = True
) -> None:
"""Set the "ctime" (creation time) attribute of a file given an unix timestamp (Windows only)."""
if not SUPPORTED:
raise OSError("This function is only available for the Windows platform.")
Expand Down
Empty file added src/win32_setctime/py.typed
Empty file.

0 comments on commit 311b698

Please sign in to comment.