Skip to content

Commit

Permalink
[Refactor] Avoid exposing real and integer types API (#4129)
Browse files Browse the repository at this point in the history
* Remove real_types

* Remove add integer types

* Hide integer_types

* Auto Format

Co-authored-by: Taichi Gardener <[email protected]>
  • Loading branch information
qiao-bo and taichi-gardener authored Jan 26, 2022
1 parent ac84d9a commit 3305f66
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 6 deletions.
3 changes: 1 addition & 2 deletions python/taichi/lang/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,7 @@
from taichi.snode.fields_builder import FieldsBuilder
from taichi.tools.util import set_gdb_trigger, warning
from taichi.types.annotations import any_arr, ext_arr, template
from taichi.types.primitive_types import (f16, f32, f64, i32, i64,
integer_types, u32, u64)
from taichi.types.primitive_types import f16, f32, f64, i32, i64, u32, u64

from taichi import _logging

Expand Down
6 changes: 4 additions & 2 deletions python/taichi/lang/struct.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from taichi.lang.matrix import Matrix
from taichi.lang.util import (cook_dtype, in_python_scope, is_taichi_class,
python_scope, taichi_scope)
from taichi.types import CompoundType, integer_types
from taichi.types import CompoundType, primitive_types


class Struct(TaichiOperations):
Expand Down Expand Up @@ -494,7 +494,9 @@ def cast(self, struct):
else:
if in_python_scope():
v = struct.entries[k]
entries[k] = int(v) if dtype in integer_types else float(v)
entries[k] = int(
v
) if dtype in primitive_types.integer_types else float(v)
else:
entries[k] = ops.cast(struct.entries[k], dtype)
return Struct(entries)
Expand Down
2 changes: 0 additions & 2 deletions python/taichi/types/primitive_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,6 @@
'u32',
'uint64',
'u64',
'real_types',
'integer_types',
'is_signed',
'is_integral',
]

1 comment on commit 3305f66

@vercel
Copy link

@vercel vercel bot commented on 3305f66 Jan 26, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.