1- # coding: utf-8
2-
31# Little utilities we use internally
42
53from abc import ABCMeta
64import os
75import signal
8- import sys
9- import pathlib
10- from functools import wraps , update_wrapper
6+ from functools import update_wrapper
117import typing as t
128import threading
139import collections
1713
1814# Equivalent to the C function raise(), which Python doesn't wrap
1915if os .name == "nt" :
20- # On windows , os.kill exists but is really weird.
16+ # On Windows , os.kill exists but is really weird.
2117 #
2218 # If you give it CTRL_C_EVENT or CTRL_BREAK_EVENT, it tries to deliver
2319 # those using GenerateConsoleCtrlEvent. But I found that when I tried
3632 # OTOH, if you pass os.kill any *other* signal number... then CPython
3733 # just calls TerminateProcess (wtf).
3834 #
39- # So, anyway, os.kill is not so useful for testing purposes. Instead
35+ # So, anyway, os.kill is not so useful for testing purposes. Instead,
4036 # we use raise():
4137 #
4238 # https://msdn.microsoft.com/en-us/library/dwwzkt4c.aspx
@@ -226,7 +222,7 @@ def fix_one(qualname, name, obj):
226222 mod = getattr (obj , "__module__" , None )
227223 if mod is not None and mod .startswith ("trio." ):
228224 obj .__module__ = module_name
229- # Modules, unlike everything else in Python, put fully-qualitied
225+ # Modules, unlike everything else in Python, put fully-qualified
230226 # names into their __name__ attribute. We check for "." to avoid
231227 # rewriting these.
232228 if hasattr (obj , "__name__" ) and "." not in obj .__name__ :
@@ -277,11 +273,11 @@ class Final(ABCMeta):
277273 class SomeClass(metaclass=Final):
278274 pass
279275
280- The metaclass will ensure that no sub class can be created.
276+ The metaclass will ensure that no subclass can be created.
281277
282278 Raises
283279 ------
284- - TypeError if a sub class is created
280+ - TypeError if a subclass is created
285281 """
286282
287283 def __new__ (cls , name , bases , cls_namespace ):
@@ -305,14 +301,14 @@ class NoPublicConstructor(Final):
305301 class SomeClass(metaclass=NoPublicConstructor):
306302 pass
307303
308- The metaclass will ensure that no sub class can be created, and that no instance
304+ The metaclass will ensure that no subclass can be created, and that no instance
309305 can be initialized.
310306
311307 If you try to instantiate your class (SomeClass()), a TypeError will be thrown.
312308
313309 Raises
314310 ------
315- - TypeError if a sub class or an instance is created.
311+ - TypeError if a subclass or an instance is created.
316312 """
317313
318314 def __call__ (cls , * args , ** kwargs ):
@@ -333,7 +329,7 @@ def name_asyncgen(agen):
333329 try :
334330 module = agen .ag_frame .f_globals ["__name__" ]
335331 except (AttributeError , KeyError ):
336- module = "<{}>" . format ( agen .ag_code .co_filename )
332+ module = f "<{ agen .ag_code .co_filename } >"
337333 try :
338334 qualname = agen .__qualname__
339335 except AttributeError :
0 commit comments