Skip to content

Commit e237dfe

Browse files
committed
Added type hints to os
1 parent aaa550b commit e237dfe

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

shared-bindings/os/__init__.c

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
//| other way around."""
4545
//|
4646

47-
//| def uname() -> Any:
47+
//| def uname() -> tuple:
4848
//| """Returns a named tuple of operating specific and CircuitPython port
4949
//| specific information."""
5050
//| ...
@@ -54,7 +54,7 @@ STATIC mp_obj_t os_uname(void) {
5454
}
5555
STATIC MP_DEFINE_CONST_FUN_OBJ_0(os_uname_obj, os_uname);
5656

57-
//| def chdir(path: Any) -> Any:
57+
//| def chdir(path: string) -> None:
5858
//| """Change current directory."""
5959
//| ...
6060
//|
@@ -65,7 +65,7 @@ mp_obj_t os_chdir(mp_obj_t path_in) {
6565
}
6666
MP_DEFINE_CONST_FUN_OBJ_1(os_chdir_obj, os_chdir);
6767

68-
//| def getcwd() -> Any:
68+
//| def getcwd() -> string:
6969
//| """Get the current directory."""
7070
//| ...
7171
//|
@@ -74,7 +74,7 @@ mp_obj_t os_getcwd(void) {
7474
}
7575
MP_DEFINE_CONST_FUN_OBJ_0(os_getcwd_obj, os_getcwd);
7676

77-
//| def listdir(dir: Any) -> Any:
77+
//| def listdir(dir: string) -> string:
7878
//| """With no argument, list the current directory. Otherwise list the given directory."""
7979
//| ...
8080
//|
@@ -89,7 +89,7 @@ mp_obj_t os_listdir(size_t n_args, const mp_obj_t *args) {
8989
}
9090
MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(os_listdir_obj, 0, 1, os_listdir);
9191

92-
//| def mkdir(path: Any) -> Any:
92+
//| def mkdir(path: string) -> None:
9393
//| """Create a new directory."""
9494
//| ...
9595
//|
@@ -100,7 +100,7 @@ mp_obj_t os_mkdir(mp_obj_t path_in) {
100100
}
101101
MP_DEFINE_CONST_FUN_OBJ_1(os_mkdir_obj, os_mkdir);
102102

103-
//| def remove(path: Any) -> Any:
103+
//| def remove(path: string) -> None:
104104
//| """Remove a file."""
105105
//| ...
106106
//|
@@ -111,7 +111,7 @@ mp_obj_t os_remove(mp_obj_t path_in) {
111111
}
112112
MP_DEFINE_CONST_FUN_OBJ_1(os_remove_obj, os_remove);
113113

114-
//| def rmdir(path: Any) -> Any:
114+
//| def rmdir(path: string) -> None:
115115
//| """Remove a directory."""
116116
//| ...
117117
//|
@@ -123,7 +123,7 @@ mp_obj_t os_rename(mp_obj_t old_path_in, mp_obj_t new_path_in) {
123123
}
124124
MP_DEFINE_CONST_FUN_OBJ_2(os_rename_obj, os_rename);
125125

126-
//| def rename(old_path: Any, new_path: Any) -> Any:
126+
//| def rename(old_path: string, new_path: string) -> string:
127127
//| """Rename a file."""
128128
//| ...
129129
//|
@@ -134,7 +134,7 @@ mp_obj_t os_rmdir(mp_obj_t path_in) {
134134
}
135135
MP_DEFINE_CONST_FUN_OBJ_1(os_rmdir_obj, os_rmdir);
136136

137-
//| def stat(path: Any) -> Any:
137+
//| def stat(path: string) -> string:
138138
//| """Get the status of a file or directory.
139139
//|
140140
//| .. note:: On builds without long integers, the number of seconds
@@ -149,7 +149,7 @@ mp_obj_t os_stat(mp_obj_t path_in) {
149149
}
150150
MP_DEFINE_CONST_FUN_OBJ_1(os_stat_obj, os_stat);
151151

152-
//| def statvfs(path: Any) -> Any:
152+
//| def statvfs(path: string) -> Tuple[string, string, string, string, string, string, string, string, string, string]:
153153
//| """Get the status of a fileystem.
154154
//|
155155
//| Returns a tuple with the filesystem information in the following order:
@@ -176,7 +176,7 @@ mp_obj_t os_statvfs(mp_obj_t path_in) {
176176
}
177177
MP_DEFINE_CONST_FUN_OBJ_1(os_statvfs_obj, os_statvfs);
178178

179-
//| def sync() -> Any:
179+
//| def sync() -> None:
180180
//| """Sync all filesystems."""
181181
//| ...
182182
//|
@@ -189,7 +189,7 @@ STATIC mp_obj_t os_sync(void) {
189189
}
190190
MP_DEFINE_CONST_FUN_OBJ_0(os_sync_obj, os_sync);
191191

192-
//| def urandom(size: Any) -> Any:
192+
//| def urandom(size: int) -> string:
193193
//| """Returns a string of *size* random bytes based on a hardware True Random
194194
//| Number Generator. When not available, it will raise a NotImplementedError."""
195195
//| ...

0 commit comments

Comments
 (0)