Move hy.core.reserved to hy.extra.reserved (#1231)
It was an odd one out by being in hy.core but needing to be called by a qualified name. It's at home in hy.extra.
This commit is contained in:
parent
ebfa636b50
commit
484daafa53
1
NEWS
1
NEWS
@ -9,6 +9,7 @@ Changes from 0.12.1
|
||||
* Commas and underscores are allowed in numeric literals
|
||||
* with-decorator: Allow a `setv` form as the form to be decorated
|
||||
* xor: If exactly one argument is true, return it
|
||||
* hy.core.reserved is now hy.extra.reserved
|
||||
|
||||
[ Bug Fixes ]
|
||||
* Shadowed comparison operators now use `and` instead of `&`
|
||||
|
@ -12,3 +12,4 @@ Contents:
|
||||
:maxdepth: 3
|
||||
|
||||
anaphoric
|
||||
reserved
|
||||
|
19
docs/extra/reserved.rst
Normal file
19
docs/extra/reserved.rst
Normal file
@ -0,0 +1,19 @@
|
||||
==============
|
||||
Reserved Names
|
||||
==============
|
||||
|
||||
names
|
||||
=====
|
||||
|
||||
Usage: ``(names)``
|
||||
|
||||
This function can be used to get a list (actually, a ``frozenset``) of the
|
||||
names of Hy's built-in functions, macros, and special forms. The output
|
||||
also includes all Python reserved words. All names are in unmangled form
|
||||
(e.g., ``list-comp`` rather than ``list_comp``).
|
||||
|
||||
.. code-block:: hy
|
||||
|
||||
=> (import hy.extra.reserved)
|
||||
=> (in "defclass" (hy.extra.reserved.names))
|
||||
True
|
@ -1352,27 +1352,6 @@ Returns an iterator from *coll* as long as *pred* returns ``True``.
|
||||
=> (list (take-while neg? [ 1 2 3 -4 5]))
|
||||
[]
|
||||
|
||||
|
||||
Other Built-Ins
|
||||
===============
|
||||
|
||||
hy.core.reserved
|
||||
----------------
|
||||
|
||||
Usage: ``(hy.core.reserved.names)``
|
||||
|
||||
This module can be used to get a list (actually, a ``frozenset``) of the
|
||||
names of Hy's built-in functions, macros, and special forms. The output
|
||||
also includes all Python reserved words. All names are in unmangled form
|
||||
(e.g., ``list-comp`` rather than ``list_comp``).
|
||||
|
||||
.. code-block:: hy
|
||||
|
||||
=> (import hy)
|
||||
=> (in "defclass" (hy.core.reserved.names))
|
||||
True
|
||||
|
||||
|
||||
Included itertools
|
||||
==================
|
||||
|
||||
|
@ -1,5 +1,3 @@
|
||||
from . import reserved # noqa
|
||||
|
||||
STDLIB = [
|
||||
"hy.core.language",
|
||||
"hy.core.shadow"
|
||||
|
@ -621,20 +621,6 @@
|
||||
(assert-equal (list (accumulate [1 -2 -3 -4 -5] -))
|
||||
[1 3 6 10 15]))
|
||||
|
||||
(defn test-reserved []
|
||||
(import [hy.core.reserved [names]])
|
||||
(assert (is (type (names)) frozenset))
|
||||
(assert (in "and" (names)))
|
||||
(when PY3
|
||||
(assert (in "False" (names))))
|
||||
(assert (in "pass" (names)))
|
||||
(assert (in "class" (names)))
|
||||
(assert (in "defclass" (names)))
|
||||
(assert (in "->" (names)))
|
||||
(assert (in "keyword?" (names)))
|
||||
(assert (not-in "foo" (names)))
|
||||
(assert (not-in "hy" (names))))
|
||||
|
||||
(defn test-complement []
|
||||
"NATIVE: test complement"
|
||||
(def helper (complement identity))
|
||||
|
14
tests/native_tests/extra/reserved.hy
Normal file
14
tests/native_tests/extra/reserved.hy
Normal file
@ -0,0 +1,14 @@
|
||||
(import [hy.extra.reserved [names] hy._compat [PY3]])
|
||||
|
||||
(defn test-reserved []
|
||||
(assert (is (type (names)) frozenset))
|
||||
(assert (in "and" (names)))
|
||||
(when PY3
|
||||
(assert (in "False" (names))))
|
||||
(assert (in "pass" (names)))
|
||||
(assert (in "class" (names)))
|
||||
(assert (in "defclass" (names)))
|
||||
(assert (in "->" (names)))
|
||||
(assert (in "keyword?" (names)))
|
||||
(assert (not-in "foo" (names)))
|
||||
(assert (not-in "hy" (names))))
|
Loading…
x
Reference in New Issue
Block a user