Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sync bbb1789f9a607605ebf0641f00a67448c55eb29f #1

Merged
merged 1 commit into from
Oct 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
12 changes: 12 additions & 0 deletions .bumpversion.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
[bumpversion]
current_version = 1.0.0
commit = False
tag = False

[bumpversion:file:lib/dl_version/dl_version/__init__.py]
search = __version__ = "{current_version}"
replace = __version__ = "{new_version}"

[bumpversion:file:lib/dl_version/pyproject.toml]
search = version = "{current_version}"
replace = version = "{new_version}"
5 changes: 4 additions & 1 deletion ci/gh_list_changes.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,12 @@ set -x

BASE_SHA="${1:-main}" # If outside PR, defaulting to main
HEAD_SHA="${2:-$(git symbolic-ref --short HEAD)}" # Default to the current branch
DIFF_FILTER="${DIFF_FILTER:-ACMRTD}"


DIVERGE_COMMIT=$(git merge-base $BASE_SHA $HEAD_SHA)
CHANGED_FILES=$(git diff --no-commit-id --name-only --diff-filter=ACMRTD $DIVERGE_COMMIT $HEAD_SHA || echo "")
CHANGED_FILES=$(git diff --no-commit-id --name-only --diff-filter=$DIFF_FILTER $DIVERGE_COMMIT $HEAD_SHA || echo "")

echo "$CHANGED_FILES"

set +x
10 changes: 7 additions & 3 deletions dl-repo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,19 @@
dl_repo:
fs_editor: git

default_boilerplate_path: lib/dl_package_boilerplate

package_types:
- type: terrarium # Repository tools
root_path: terrarium
boilerplate_path: lib/dl_package_boilerplate

- type: lib # Main libraries
root_path: lib
boilerplate_path: lib/dl_package_boilerplate
tags:
- main_dependency_group

- type: app # Apps
root_path: app
boilerplate_path: lib/dl_package_boilerplate
tags:
- main_dependency_group
- own_dependency_group
Expand All @@ -40,3 +39,8 @@ dl_repo:

plugins:
- type: dependency_registration

edit_exclude_masks: # Files at paths that match these patterns (via re.match) will not be edited
- ".*\\.mo"
- ".*\\.xlsx"
- ".*/__pycache__"
4 changes: 2 additions & 2 deletions docker_build/bake_code_gen.hcl
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
target "gen_antlr" {
contexts = {
src = "${DL_B_PROJECT_ROOT}/lib/bi_formula/bi_formula/parser/antlr/"
src = "${DL_B_PROJECT_ROOT}/lib/dl_formula/dl_formula/parser/antlr/"
}
dockerfile = "./target_gen_antlr/Dockerfile"
output = ["type=local,dest=${DL_B_PROJECT_ROOT}/lib/bi_formula/bi_formula/parser/antlr/gen"]
output = ["type=local,dest=${DL_B_PROJECT_ROOT}/lib/dl_formula/dl_formula/parser/antlr/gen"]
}
2 changes: 1 addition & 1 deletion docker_build/target_gen_antlr/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ RUN apk add --no-cache sed python3 py3-pip
RUN pip install pycodestyle==2.10.0 autopep8==2.0.2 autoflake isort

ENV AUTOGEN_DIR=/gen
ENV ANTLR_PY_PACKAGE="bi_formula.parser.antlr.gen"
ENV ANTLR_PY_PACKAGE="dl_formula.parser.antlr.gen"

COPY --from=src . /src

Expand Down
4 changes: 2 additions & 2 deletions lib/dl_api_client/dl_api_client/dsmaker/api/schemas/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@
TreeRoleSpec,
)
from dl_constants.enums import (
BIType,
FieldRole,
FieldType,
FieldVisibility,
Expand All @@ -46,6 +45,7 @@
QueryBlockPlacementType,
QueryItemRefType,
RangeType,
UserDataType,
WhereClauseOperation,
)

Expand Down Expand Up @@ -184,7 +184,7 @@ class LegendItemSchema(DefaultSchema[LegendItem]):
id = ma_fields.String()
title = ma_fields.String()
role_spec = ma_fields.Nested(RoleSpecSchema)
data_type = ma_fields.Enum(BIType)
data_type = ma_fields.Enum(UserDataType)
field_type = ma_fields.Enum(FieldType)
item_type = ma_fields.Enum(LegendItemType)

Expand Down
46 changes: 23 additions & 23 deletions lib/dl_api_client/dl_api_client/dsmaker/api/schemas/dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,17 +57,17 @@
from dl_constants.enums import (
AggregationFunction,
BinaryJoinOperator,
BIType,
CalcMode,
ComponentErrorLevel,
ComponentType,
ConditionPartCalcMode,
CreateDSFrom,
DataSourceType,
FieldType,
JoinConditionType,
JoinType,
ManagedBy,
ParameterValueConstraintType,
UserDataType,
WhereClauseOperation,
)
from dl_model_tools.schema.dynamic_enum_field import DynamicEnumField
Expand Down Expand Up @@ -157,22 +157,22 @@ class ValueSchema(OneOfSchemaWithDumpLoadHooks):
CONTEXT_KEY = "bi_value_type"
type_field = "type"
type_schemas = {
BIType.string.name: StringValueSchema,
BIType.integer.name: IntegerValueSchema,
BIType.float.name: FloatValueSchema,
BIType.date.name: DateValueSchema,
BIType.datetime.name: DateTimeValueSchema,
BIType.datetimetz.name: DateTimeTZValueSchema,
BIType.genericdatetime.name: GenericDateTimeValueSchema,
BIType.boolean.name: BooleanValueSchema,
BIType.geopoint.name: GeoPointValueSchema,
BIType.geopolygon.name: GeoPolygonValueSchema,
BIType.uuid.name: UuidValueSchema,
BIType.markup.name: MarkupValueSchema,
BIType.array_str.name: ArrayStrValueSchema,
BIType.array_int.name: ArrayIntValueSchema,
BIType.array_float.name: ArrayFloatValueSchema,
BIType.tree_str.name: TreeStrParameterValue,
UserDataType.string.name: StringValueSchema,
UserDataType.integer.name: IntegerValueSchema,
UserDataType.float.name: FloatValueSchema,
UserDataType.date.name: DateValueSchema,
UserDataType.datetime.name: DateTimeValueSchema,
UserDataType.datetimetz.name: DateTimeTZValueSchema,
UserDataType.genericdatetime.name: GenericDateTimeValueSchema,
UserDataType.boolean.name: BooleanValueSchema,
UserDataType.geopoint.name: GeoPointValueSchema,
UserDataType.geopolygon.name: GeoPolygonValueSchema,
UserDataType.uuid.name: UuidValueSchema,
UserDataType.markup.name: MarkupValueSchema,
UserDataType.array_str.name: ArrayStrValueSchema,
UserDataType.array_int.name: ArrayIntValueSchema,
UserDataType.array_float.name: ArrayFloatValueSchema,
UserDataType.tree_str.name: TreeStrParameterValue,
}

@pre_load(pass_many=False)
Expand Down Expand Up @@ -227,10 +227,10 @@ class ResultFieldSchema(DefaultSchema[ResultField]):
hidden = ma_fields.Boolean(load_default=False)
description = ma_fields.String()
formula = ma_fields.String(load_default="")
initial_data_type = ma_fields.Enum(BIType, allow_none=True)
cast = ma_fields.Enum(BIType)
initial_data_type = ma_fields.Enum(UserDataType, allow_none=True)
cast = ma_fields.Enum(UserDataType)
type = ma_fields.Enum(FieldType, readonly=True)
data_type = ma_fields.Enum(BIType, allow_none=True)
data_type = ma_fields.Enum(UserDataType, allow_none=True)
valid = ma_fields.Boolean(allow_none=True)
avatar_id = ma_fields.String(allow_none=True)
aggregation = ma_fields.Enum(AggregationFunction, load_default=AggregationFunction.none.name)
Expand Down Expand Up @@ -280,7 +280,7 @@ class ColumnSchema(DefaultSchema[Column]):
name = ma_fields.String()
title = ma_fields.String()
native_type = ma_fields.Dict(allow_none=True)
user_type = ma_fields.Enum(BIType)
user_type = ma_fields.Enum(UserDataType)
description = ma_fields.String(dump_default="", allow_none=True)
has_auto_aggregation = ma_fields.Boolean(dump_default=False, allow_none=True)
lock_aggregation = ma_fields.Boolean(dump_default=False, allow_none=True)
Expand All @@ -293,7 +293,7 @@ class DataSourceSchema(DefaultSchema[DataSource]):
id = ma_fields.String()
title = ma_fields.String()
connection_id = ma_fields.String(allow_none=True)
source_type = DynamicEnumField(CreateDSFrom)
source_type = DynamicEnumField(DataSourceType)
raw_schema = ma_fields.Nested(ColumnSchema, allow_none=True, required=False, many=True)
index_info_set = ma_fields.List(ma_fields.Dict, allow_none=True)
parameters = ma_fields.Dict()
Expand Down
50 changes: 25 additions & 25 deletions lib/dl_api_client/dl_api_client/dsmaker/primitives.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,11 @@
from dl_constants.enums import (
AggregationFunction,
BinaryJoinOperator,
BIType,
CalcMode,
ComponentErrorLevel,
ComponentType,
ConditionPartCalcMode,
CreateDSFrom,
DataSourceType,
FieldRole,
FieldType,
FieldVisibility,
Expand All @@ -45,6 +44,7 @@
QueryBlockPlacementType,
QueryItemRefType,
RangeType,
UserDataType,
WhereClauseOperation,
)

Expand Down Expand Up @@ -215,7 +215,7 @@ def __eq__(self, other: Any) -> bool:
@attr.s
class DataSource(ApiProxyObject):
connection_id: str = attr.ib(default=None)
source_type: Optional[CreateDSFrom] = attr.ib(default=None, converter=CreateDSFrom.normalize)
source_type: Optional[DataSourceType] = attr.ib(default=None, converter=DataSourceType.normalize)
parameters: dict = attr.ib(default=None)
raw_schema: list = attr.ib(factory=list)
index_info_set: Optional[list] = attr.ib(default=None)
Expand Down Expand Up @@ -331,7 +331,7 @@ class _Column:
# use attr.s on superclass of the "real" class so that comparison methods from ConditionMakerMixin are used
title: str = attr.ib(default=None)
name: str = attr.ib(default=None)
user_type: Optional[BIType] = attr.ib(default=None, converter=BIType.normalize)
user_type: Optional[UserDataType] = attr.ib(default=None, converter=UserDataType.normalize)
native_type: Optional[dict] = attr.ib(default=None)
nullable: bool = attr.ib(default=True)
description: str = attr.ib(default="")
Expand Down Expand Up @@ -369,88 +369,88 @@ def on(self, *conditions: List[JoinCondition]): # type: ignore # TODO: fix

@attr.s
class ParameterValue(Generic[_INNER_TYPE]):
type: BIType
type: UserDataType
value: _INNER_TYPE = attr.ib()


@attr.s
class StringParameterValue(ParameterValue[str]):
type: BIType = BIType.string
type: UserDataType = UserDataType.string


@attr.s
class IntegerParameterValue(ParameterValue[int]):
type: BIType = BIType.integer
type: UserDataType = UserDataType.integer


@attr.s
class FloatParameterValue(ParameterValue[float]):
type: BIType = BIType.float
type: UserDataType = UserDataType.float


@attr.s
class DateParameterValue(ParameterValue[date]):
type: BIType = BIType.date
type: UserDataType = UserDataType.date


@attr.s
class DateTimeParameterValue(ParameterValue[datetime]):
type: BIType = BIType.datetime
type: UserDataType = UserDataType.datetime


@attr.s
class DateTimeTZParameterValue(ParameterValue[datetime]):
type: BIType = BIType.datetimetz
type: UserDataType = UserDataType.datetimetz


@attr.s
class GenericDateTimeParameterValue(ParameterValue[datetime]):
type: BIType = BIType.genericdatetime
type: UserDataType = UserDataType.genericdatetime


@attr.s
class BooleanParameterValue(ParameterValue[bool]):
type: BIType = BIType.boolean
type: UserDataType = UserDataType.boolean


@attr.s
class GeoPointParameterValue(ParameterValue[List[Union[int, float]]]):
type: BIType = BIType.geopoint
type: UserDataType = UserDataType.geopoint


@attr.s
class GeoPolygonParameterValue(ParameterValue[List[List[List[Union[int, float]]]]]):
type: BIType = BIType.geopolygon
type: UserDataType = UserDataType.geopolygon


@attr.s
class UuidParameterValue(ParameterValue[str]):
type: BIType = BIType.uuid
type: UserDataType = UserDataType.uuid


@attr.s
class MarkupParameterValue(ParameterValue[str]):
type: BIType = BIType.markup
type: UserDataType = UserDataType.markup


@attr.s
class ArrayStrParameterValue(ParameterValue[List[str]]):
type: BIType = BIType.array_str
type: UserDataType = UserDataType.array_str


@attr.s
class ArrayIntParameterValue(ParameterValue[List[int]]):
type: BIType = BIType.array_int
type: UserDataType = UserDataType.array_int


@attr.s
class ArrayFloatParameterValue(ParameterValue[List[float]]):
type: BIType = BIType.array_float
type: UserDataType = UserDataType.array_float


@attr.s
class TreeStrParameterValue(ParameterValue[List[str]]):
type: BIType = BIType.tree_str
type: UserDataType = UserDataType.tree_str


@attr.s
Expand Down Expand Up @@ -517,9 +517,9 @@ class _ResultField(ApiProxyObject):
hidden: bool = attr.ib(default=False)
description: str = attr.ib(default="")
formula: str = attr.ib(default="")
initial_data_type: Optional[BIType] = attr.ib(default=None, converter=BIType.normalize)
cast: Optional[BIType] = attr.ib(default=None, converter=BIType.normalize)
data_type: Optional[BIType] = attr.ib(default=None, converter=BIType.normalize)
initial_data_type: Optional[UserDataType] = attr.ib(default=None, converter=UserDataType.normalize)
cast: Optional[UserDataType] = attr.ib(default=None, converter=UserDataType.normalize)
data_type: Optional[UserDataType] = attr.ib(default=None, converter=UserDataType.normalize)
valid: bool = attr.ib(default=True)
has_auto_aggregation: bool = attr.ib(default=False)
lock_aggregation: bool = attr.ib(default=False)
Expand Down Expand Up @@ -728,7 +728,7 @@ class LegendItem(LegendItemBase): # noqa
legend_item_id: int = attr.ib(kw_only=True) # redefine as strictly not None
id: str = attr.ib(kw_only=True)
title: str = attr.ib(kw_only=True)
data_type: BIType = attr.ib(kw_only=True)
data_type: UserDataType = attr.ib(kw_only=True)
field_type: FieldType = attr.ib(kw_only=True)
item_type: LegendItemType = attr.ib(kw_only=True)

Expand Down
Loading
Loading