Skip to content

Commit

Permalink
Moved Unknown type from hiku.typedef.types to the hiku.types
Browse files Browse the repository at this point in the history
  • Loading branch information
vmagamedov committed Sep 8, 2016
1 parent 8a22018 commit ccd840f
Show file tree
Hide file tree
Showing 9 changed files with 19 additions and 24 deletions.
4 changes: 2 additions & 2 deletions hiku/checker.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
from .refs import NamedRef, Ref
from .nodes import NodeTransformer, Symbol, Keyword, Tuple, List
from .types import Sequence, SequenceMeta, Record, RecordMeta, Optional
from .types import MappingMeta, OptionalMeta
from .typedef.types import TypeRef, TypeRefMeta, Unknown, UnknownMeta
from .types import MappingMeta, OptionalMeta, Unknown, UnknownMeta
from .typedef.types import TypeRef, TypeRefMeta


class GraphTypes(graph.GraphVisitor):
Expand Down
3 changes: 1 addition & 2 deletions hiku/expr.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,9 @@

from .edn import loads
from .query import Edge, Link, Field
from .types import Record, Callable
from .types import Record, Callable, Unknown
from .nodes import Symbol, Tuple, List, Keyword, Dict
from .compat import text_type, string_types
from .typedef.types import Unknown
from .readers.simple import transform


Expand Down
2 changes: 1 addition & 1 deletion hiku/sources/graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@
from ..graph import Link, Field, Many
from ..query import merge
from ..utils import kw_only
from ..types import Unknown
from ..engine import Query, store_fields, subquery
from ..checker import check, graph_types, fn_types
from ..compiler import ExpressionCompiler
from ..typedef.types import Unknown


THIS_LINK_NAME = '__link_to_this'
Expand Down
3 changes: 1 addition & 2 deletions hiku/typedef/kinko.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,8 @@
from contextlib import contextmanager

from ..types import Record, RecordMeta, OptionalMeta, SequenceMeta, MappingMeta
from ..types import GenericMeta
from ..types import GenericMeta, Unknown
from ..checker import GraphTypes
from ..typedef.types import Unknown

from .types import TypeDef

Expand Down
12 changes: 1 addition & 11 deletions hiku/typedef/types.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from ..types import TypingMeta, GenericMeta
from ..types import TypingMeta
from ..compat import with_metaclass


Expand Down Expand Up @@ -26,13 +26,3 @@ def accept(cls, visitor):

class TypeRef(with_metaclass(TypeRefMeta, object)):
pass


class UnknownMeta(GenericMeta):

def accept(cls, visitor):
return visitor.visit_unknown(cls)


class Unknown(with_metaclass(UnknownMeta, object)):
pass
10 changes: 10 additions & 0 deletions hiku/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,16 @@ def accept(cls, visitor):
raise NotImplementedError


class UnknownMeta(GenericMeta):

def accept(cls, visitor):
return visitor.visit_unknown(cls)


class Unknown(with_metaclass(UnknownMeta, object)):
pass


class BooleanMeta(GenericMeta):

def accept(cls, visitor):
Expand Down
3 changes: 1 addition & 2 deletions tests/test_compiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,11 @@
import pytest

from hiku.expr import define, S, if_, each, to_expr, if_some
from hiku.types import Optional, String, Record
from hiku.types import Optional, String, Record, Unknown
from hiku.graph import Graph, Field, Edge, Link, Root, Many, One
from hiku.compat import PY3, PY35
from hiku.checker import check, graph_types, fn_types
from hiku.compiler import ExpressionCompiler
from hiku.typedef.types import Unknown


@define(Unknown, _name='foo')
Expand Down
3 changes: 1 addition & 2 deletions tests/test_refs.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,8 @@
from hiku.refs import Ref, NamedRef, ref_to_req, RequirementsExtractor
from hiku.graph import Many, One, Maybe
from hiku.query import Edge, Field, Link
from hiku.types import Record
from hiku.types import Record, Unknown
from hiku.checker import check, graph_types, fn_types
from hiku.typedef.types import Unknown

from .base import reqs_eq_patcher

Expand Down
3 changes: 1 addition & 2 deletions tests/test_source_graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,9 @@

from hiku.expr import define, S, each
from hiku.graph import Graph, Edge, Link, Field, Option, Root, Many, One
from hiku.types import Record, Sequence
from hiku.types import Record, Sequence, Unknown
from hiku.engine import Engine
from hiku.sources.graph import SubGraph, Expr
from hiku.typedef.types import Unknown
from hiku.readers.simple import read
from hiku.executors.threads import ThreadsExecutor

Expand Down

0 comments on commit ccd840f

Please sign in to comment.