Latest Threat Research:SANDWORM_MODE: Shai-Hulud-Style npm Worm Hijacks CI Workflows and Poisons AI Toolchains.Details
Socket
Book a DemoInstallSign in
Socket

basilisp

Package Overview
Dependencies
Maintainers
1
Versions
40
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

basilisp - npm Package Compare versions

Comparing version
0.3.8
to
0.4.0
src/basilisp/url.lpy

Sorry, the diff of this file is not supported yet

+2
-2
Metadata-Version: 2.3
Name: basilisp
Version: 0.3.8
Version: 0.4.0
Summary: A Clojure-like lisp written for Python

@@ -74,3 +74,3 @@ License: Eclipse Public License 1.0 (EPL-1.0)

coverage, linting, and type checking. Work is ongoing to complete the rest of the
standard the library implementations. I suspect it could be used to build small
standard library implementations. I suspect it could be used to build small
applications and tools at this point, though I would not recommend it unless you

@@ -77,0 +77,0 @@ like being an early adopter.

[tool.poetry]
name = "basilisp"
version = "0.3.8"
version = "0.4.0"
description = "A Clojure-like lisp written for Python"

@@ -5,0 +5,0 @@ authors = ["Christopher Rink <chrisrink10@gmail.com>"]

@@ -39,3 +39,3 @@ # 🐍 basilisp 🐍

coverage, linting, and type checking. Work is ongoing to complete the rest of the
standard the library implementations. I suspect it could be used to build small
standard library implementations. I suspect it could be used to build small
applications and tools at this point, though I would not recommend it unless you

@@ -42,0 +42,0 @@ like being an early adopter.

@@ -91,3 +91,3 @@ import importlib

def parse_name(self) -> bool:
v = runtime.first(reader.read_str(self.name))
v = runtime.first(runtime.to_iterator_seq(reader.read_str(self.name)))
if isinstance(v, sym.Symbol) and v.ns is None:

@@ -94,0 +94,0 @@ self.modname = v.name

@@ -225,3 +225,3 @@ import logging

sig_sexp = runtime.first(reader.read_str(sig))
sig_sexp = runtime.first(runtime.to_iterator_seq(reader.read_str(sig)))
assert isinstance(sig_sexp, IPersistentList)

@@ -289,3 +289,3 @@ fn_sym = runtime.first(sig_sexp)

sig, prefix = name
sig_sexp = runtime.first(reader.read_str(sig))
sig_sexp = runtime.first(runtime.to_iterator_seq(reader.read_str(sig)))
if isinstance(sig_sexp, IPersistentList):

@@ -565,3 +565,3 @@ sig = runtime.first(sig_sexp)

else:
obj_sym = runtime.first(reader.read_str(target))
obj_sym = runtime.first(runtime.to_iterator_seq(reader.read_str(target)))
assert isinstance(

@@ -568,0 +568,0 @@ obj_sym, sym.Symbol

@@ -46,2 +46,3 @@ from basilisp.lang import keyword as kw

SYM_DEFAULT_META_KEY = kw.keyword("default")
SYM_SLOTS_META_KEY = kw.keyword("slots")
SYM_DYNAMIC_META_KEY = kw.keyword("dynamic")

@@ -48,0 +49,0 @@ SYM_PROPERTY_META_KEY = kw.keyword("property")

@@ -427,2 +427,3 @@ from abc import ABC, abstractmethod

is_frozen: bool = True
use_slots: bool = True
use_weakref_slot: bool = True

@@ -616,2 +617,4 @@ meta: NodeMeta = None

aliases: Iterable["ImportAlias"]
refers: Iterable[str]
refer_all: bool
env: NodeEnv = attr.field(hash=False)

@@ -618,0 +621,0 @@ children: Sequence[kw.Keyword] = vec.EMPTY

@@ -6,3 +6,3 @@ from typing import Callable, Generic, Optional, TypeVar

from basilisp.lang import atom as atom
from basilisp.lang.interfaces import IDeref
from basilisp.lang.interfaces import IDeref, IPending

@@ -19,3 +19,3 @@ T = TypeVar("T")

class Delay(IDeref[T]):
class Delay(IDeref[T], IPending):
__slots__ = ("_state",)

@@ -22,0 +22,0 @@

@@ -10,3 +10,3 @@ from concurrent.futures import Future as _Future # noqa # pylint: disable=unused-import

from basilisp.lang.interfaces import IBlockingDeref
from basilisp.lang.interfaces import IBlockingDeref, IPending

@@ -18,3 +18,3 @@ T = TypeVar("T")

@attr.frozen(eq=True, repr=False)
class Future(IBlockingDeref[T]):
class Future(IBlockingDeref[T], IPending):
_future: "_Future[T]"

@@ -21,0 +21,0 @@

@@ -311,2 +311,18 @@ import itertools

class IPending(ABC):
"""``IPending`` types are types which may represent deferred computations such
as a future or promise.
.. seealso::
:lpy:fn:`realized?`, :lpy:fn:`delay`, :lpy:fn:`future`, :lpy:fn:`promise`"""
__slots__ = ()
@property
@abstractmethod
def is_realized(self) -> bool:
raise NotImplementedError()
class IPersistentCollection(ISeqable[T]):

@@ -376,2 +392,32 @@ """``IPersistentCollection`` types support both fetching empty variants of an

class IProxy(ABC):
"""``IProxy`` is a marker interface for proxy types.
All types created by ``proxy`` are automatically marked with ``IProxy``.
.. seealso::
:ref:`proxies`, :lpy:fn:`proxy`, :lpy:fn:`proxy-mappings`, :lpy:fn:`proxy-super`,
:lpy:fn:`construct-proxy`, :lpy:fn:`init-proxy`, :lpy:fn:`update-proxy`,
:lpy:fn:`get-proxy-class`"""
__slots__ = ()
@abstractmethod
def _get_proxy_mappings(self) -> "IPersistentMap[str, Callable]":
raise NotImplementedError()
@abstractmethod
def _set_proxy_mappings(
self, proxy_mappings: "IPersistentMap[str, Callable]"
) -> None:
raise NotImplementedError()
@abstractmethod
def _update_proxy_mappings(
self, proxy_mappings: "IPersistentMap[str, Callable]"
) -> None:
raise NotImplementedError()
T_key = TypeVar("T_key")

@@ -378,0 +424,0 @@ V_contra = TypeVar("V_contra", contravariant=True)

@@ -32,3 +32,3 @@ from builtins import map as pymap

from basilisp.lang.reduced import Reduced
from basilisp.lang.seq import sequence
from basilisp.lang.seq import iterator_sequence
from basilisp.lang.vector import MapEntry

@@ -358,3 +358,3 @@ from basilisp.util import partition

return None
return sequence(MapEntry.of(k, v) for k, v in self._inner.items())
return iterator_sequence((MapEntry.of(k, v) for k, v in self._inner.items()))

@@ -361,0 +361,0 @@ def to_transient(self) -> TransientMap[K, V]:

import datetime
import fractions
import math

@@ -126,2 +127,45 @@ import re

@singledispatch
def lstr(o: Any) -> str:
return str(o)
@lstr.register(type(re.compile("")))
def _lstr_pattern(o: Pattern) -> str:
return o.pattern
@lstr.register(bool)
@lstr.register(bytes)
@lstr.register(type(None))
@lstr.register(str)
@lstr.register(list)
@lstr.register(dict)
@lstr.register(set)
@lstr.register(tuple)
@lstr.register(complex)
@lstr.register(float)
@lstr.register(datetime.datetime)
@lstr.register(Decimal)
@lstr.register(fractions.Fraction)
@lstr.register(Path)
def _lstr_lrepr(o) -> str:
"""For built-in types, we want the `str()` representation to match the `lrepr()`.
User types can be customized to their liking.
This function intentionally does not capture the runtime values of the lrepr
keyword arguments."""
return lrepr(
o,
human_readable=True,
print_dup=PRINT_DUP,
print_length=PRINT_LENGTH,
print_level=PRINT_LEVEL,
print_meta=PRINT_META,
print_namespace_maps=PRINT_NAMESPACE_MAPS,
print_readably=PRINT_READABLY,
)
# pylint: disable=unused-argument

@@ -128,0 +172,0 @@ @singledispatch

import threading
from typing import Optional, TypeVar
from basilisp.lang.interfaces import IBlockingDeref
from basilisp.lang.interfaces import IBlockingDeref, IPending

@@ -9,3 +9,3 @@ T = TypeVar("T")

class Promise(IBlockingDeref[T]):
class Promise(IBlockingDeref[T], IPending):
__slots__ = ("_condition", "_is_delivered", "_value")

@@ -12,0 +12,0 @@

@@ -221,6 +221,16 @@ import functools

def sequence(s: Iterable[T]) -> ISeq[T]:
"""Create a Sequence from Iterable s."""
def sequence(s: Iterable[T], support_single_use: bool = False) -> ISeq[T]:
"""Create a Sequence from Iterable `s`.
By default, raise a ``TypeError`` if `s` is a single-use
Iterable, unless `fail_single_use` is ``True``.
"""
i = iter(s)
if not support_single_use and i is s:
raise TypeError(
f"Can't create sequence out of single-use iterable object, please use iterator-seq instead. Iterable Object type: {type(s)}"
)
def _next_elem() -> ISeq[T]:

@@ -237,2 +247,7 @@ try:

def iterator_sequence(s: Iterable[T]) -> ISeq[T]:
"""Create a Sequence from any iterable `s`."""
return sequence(s, support_single_use=True)
@overload

@@ -239,0 +254,0 @@ def _seq_or_nil(s: None) -> None: ...

@@ -27,3 +27,3 @@ from collections.abc import Iterable, Sequence

from basilisp.lang.reduced import Reduced
from basilisp.lang.seq import sequence
from basilisp.lang.seq import iterator_sequence, sequence
from basilisp.util import partition

@@ -217,3 +217,3 @@

def rseq(self) -> ISeq[T]:
return sequence(reversed(self))
return iterator_sequence(reversed(self))

@@ -220,0 +220,0 @@ def to_transient(self) -> TransientVector:

import importlib
import os
import sysconfig
import threading
from pathlib import Path

@@ -14,4 +15,7 @@ from typing import Optional

_INIT_LOCK = threading.Lock()
_runtime_is_initialized = False
def init(opts: Optional[CompilerOpts] = None) -> None:
def init(opts: Optional[CompilerOpts] = None, force_reload: bool = False) -> None:
"""

@@ -26,10 +30,20 @@ Initialize the runtime environment for Basilisp code evaluation.

or module structure, you probably want to use :py:func:`bootstrap`.
``init()`` may be called more than once. Only the first invocation will initialize
the runtime unless ``force_reload=True``.
"""
logconfig.configure_root_logger()
runtime.init_ns_var()
runtime.bootstrap_core(opts if opts is not None else compiler_opts())
importer.hook_imports()
importlib.import_module("basilisp.core")
global _runtime_is_initialized
with _INIT_LOCK:
if _runtime_is_initialized and not force_reload:
return
logconfig.configure_root_logger()
runtime.init_ns_var()
runtime.bootstrap_core(opts if opts is not None else compiler_opts())
importer.hook_imports()
importlib.import_module("basilisp.core")
_runtime_is_initialized = True
def bootstrap(

@@ -36,0 +50,0 @@ target: str, opts: Optional[CompilerOpts] = None

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet