fixed poetry; add dummy tests to test path

This commit is contained in:
KatKatKateryna 2024-01-18 19:45:42 +00:00
Родитель f0f9050364
Коммит 7f497eddfd
10 изменённых файлов: 117 добавлений и 143 удалений

73
poetry.lock сгенерированный
Просмотреть файл

@ -1,10 +1,9 @@
# This file is automatically @generated by Poetry and should not be changed by hand.
# This file is automatically @generated by Poetry 1.7.1 and should not be changed by hand.
[[package]]
name = "annotated-types"
version = "0.6.0"
description = "Reusable constraint types to use with typing.Annotated"
category = "main"
optional = false
python-versions = ">=3.8"
files = [
@ -16,7 +15,6 @@ files = [
name = "anyio"
version = "4.2.0"
description = "High level compatibility layer for multiple asynchronous event loop implementations"
category = "main"
optional = false
python-versions = ">=3.8"
files = [
@ -39,7 +37,6 @@ trio = ["trio (>=0.23)"]
name = "appdirs"
version = "1.4.4"
description = "A small Python module for determining appropriate platform-specific dirs, e.g. a \"user data dir\"."
category = "main"
optional = false
python-versions = "*"
files = [
@ -51,7 +48,6 @@ files = [
name = "asttokens"
version = "2.4.1"
description = "Annotate AST trees with source code positions"
category = "dev"
optional = false
python-versions = "*"
files = [
@ -70,7 +66,6 @@ test = ["astroid (>=1,<2)", "astroid (>=2,<4)", "pytest"]
name = "attrs"
version = "23.2.0"
description = "Classes Without Boilerplate"
category = "main"
optional = false
python-versions = ">=3.7"
files = [
@ -90,7 +85,6 @@ tests-no-zope = ["attrs[tests-mypy]", "cloudpickle", "hypothesis", "pympler", "p
name = "backoff"
version = "2.2.1"
description = "Function decoration for backoff and retry"
category = "main"
optional = false
python-versions = ">=3.7,<4.0"
files = [
@ -102,7 +96,6 @@ files = [
name = "certifi"
version = "2023.11.17"
description = "Python package for providing Mozilla's CA Bundle."
category = "main"
optional = false
python-versions = ">=3.6"
files = [
@ -114,7 +107,6 @@ files = [
name = "charset-normalizer"
version = "3.3.2"
description = "The Real First Universal Charset Detector. Open, modern and actively maintained alternative to Chardet."
category = "main"
optional = false
python-versions = ">=3.7.0"
files = [
@ -214,7 +206,6 @@ files = [
name = "click"
version = "8.1.7"
description = "Composable command line interface toolkit"
category = "main"
optional = false
python-versions = ">=3.7"
files = [
@ -229,7 +220,6 @@ colorama = {version = "*", markers = "platform_system == \"Windows\""}
name = "click-plugins"
version = "1.1.1"
description = "An extension module for click to enable registering CLI commands via setuptools entry-points."
category = "main"
optional = false
python-versions = "*"
files = [
@ -247,7 +237,6 @@ dev = ["coveralls", "pytest (>=3.6)", "pytest-cov", "wheel"]
name = "cligj"
version = "0.7.2"
description = "Click params for commmand line interfaces to GeoJSON"
category = "main"
optional = false
python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, <4"
files = [
@ -265,7 +254,6 @@ test = ["pytest-cov"]
name = "colorama"
version = "0.4.6"
description = "Cross-platform colored terminal text."
category = "main"
optional = false
python-versions = "!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,!=3.5.*,!=3.6.*,>=2.7"
files = [
@ -277,7 +265,6 @@ files = [
name = "coverage"
version = "7.4.0"
description = "Code coverage measurement for Python"
category = "dev"
optional = false
python-versions = ">=3.8"
files = [
@ -345,7 +332,6 @@ toml = ["tomli"]
name = "deprecated"
version = "1.2.14"
description = "Python @deprecated decorator to deprecate old python classes, functions or methods."
category = "main"
optional = false
python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*"
files = [
@ -363,7 +349,6 @@ dev = ["PyTest", "PyTest-Cov", "bump2version (<1)", "sphinx (<2)", "tox"]
name = "devtools"
version = "0.12.2"
description = "Python's missing debug print command, and more."
category = "dev"
optional = false
python-versions = ">=3.7"
files = [
@ -380,7 +365,6 @@ pygments = ">=2.15.0"
name = "exceptiongroup"
version = "1.2.0"
description = "Backport of PEP 654 (exception groups)"
category = "main"
optional = false
python-versions = ">=3.7"
files = [
@ -395,7 +379,6 @@ test = ["pytest (>=6)"]
name = "executing"
version = "2.0.1"
description = "Get the currently executing AST node of a frame, and other information"
category = "dev"
optional = false
python-versions = ">=3.5"
files = [
@ -410,7 +393,6 @@ tests = ["asttokens (>=2.1.0)", "coverage", "coverage-enable-subprocess", "ipyth
name = "fiona"
version = "1.9.5"
description = "Fiona reads and writes spatial data files"
category = "main"
optional = false
python-versions = ">=3.7"
files = [
@ -460,7 +442,6 @@ test = ["Fiona[s3]", "pytest (>=7)", "pytest-cov", "pytz"]
name = "geopandas"
version = "0.13.2"
description = "Geographic pandas extensions"
category = "main"
optional = false
python-versions = ">=3.8"
files = [
@ -479,7 +460,6 @@ shapely = ">=1.7.1"
name = "geovoronoi"
version = "0.4.0"
description = "a package to create and plot Voronoi regions in geographic areas"
category = "main"
optional = false
python-versions = ">=3.6"
files = [
@ -502,7 +482,6 @@ test = ["hypothesis (>=6.0.0)", "pytest (>=6.2.0)", "pytest-mpl (>=0.12)", "tox
name = "gql"
version = "3.4.1"
description = "GraphQL client for Python"
category = "main"
optional = false
python-versions = "*"
files = [
@ -533,7 +512,6 @@ websockets = ["websockets (>=10,<11)", "websockets (>=9,<10)"]
name = "graphql-core"
version = "3.2.3"
description = "GraphQL implementation for Python, a port of GraphQL.js, the JavaScript reference implementation for GraphQL."
category = "main"
optional = false
python-versions = ">=3.6,<4"
files = [
@ -545,7 +523,6 @@ files = [
name = "h11"
version = "0.14.0"
description = "A pure-Python, bring-your-own-I/O implementation of HTTP/1.1"
category = "main"
optional = false
python-versions = ">=3.7"
files = [
@ -557,7 +534,6 @@ files = [
name = "httpcore"
version = "1.0.2"
description = "A minimal low-level HTTP client."
category = "main"
optional = false
python-versions = ">=3.8"
files = [
@ -572,14 +548,13 @@ h11 = ">=0.13,<0.15"
[package.extras]
asyncio = ["anyio (>=4.0,<5.0)"]
http2 = ["h2 (>=3,<5)"]
socks = ["socksio (>=1.0.0,<2.0.0)"]
socks = ["socksio (==1.*)"]
trio = ["trio (>=0.22.0,<0.23.0)"]
[[package]]
name = "httpx"
version = "0.25.2"
description = "The next generation HTTP client."
category = "main"
optional = false
python-versions = ">=3.8"
files = [
@ -590,21 +565,20 @@ files = [
[package.dependencies]
anyio = "*"
certifi = "*"
httpcore = ">=1.0.0,<2.0.0"
httpcore = "==1.*"
idna = "*"
sniffio = "*"
[package.extras]
brotli = ["brotli", "brotlicffi"]
cli = ["click (>=8.0.0,<9.0.0)", "pygments (>=2.0.0,<3.0.0)", "rich (>=10,<14)"]
cli = ["click (==8.*)", "pygments (==2.*)", "rich (>=10,<14)"]
http2 = ["h2 (>=3,<5)"]
socks = ["socksio (>=1.0.0,<2.0.0)"]
socks = ["socksio (==1.*)"]
[[package]]
name = "idna"
version = "3.6"
description = "Internationalized Domain Names in Applications (IDNA)"
category = "main"
optional = false
python-versions = ">=3.5"
files = [
@ -616,7 +590,6 @@ files = [
name = "importlib-metadata"
version = "7.0.1"
description = "Read metadata from Python packages"
category = "main"
optional = false
python-versions = ">=3.8"
files = [
@ -636,7 +609,6 @@ testing = ["flufl.flake8", "importlib-resources (>=1.3)", "packaging", "pyfakefs
name = "iniconfig"
version = "2.0.0"
description = "brain-dead simple config-ini parsing"
category = "dev"
optional = false
python-versions = ">=3.7"
files = [
@ -648,7 +620,6 @@ files = [
name = "multidict"
version = "6.0.4"
description = "multidict implementation"
category = "main"
optional = false
python-versions = ">=3.7"
files = [
@ -732,7 +703,6 @@ files = [
name = "numpy"
version = "1.25.2"
description = "Fundamental package for array computing in Python"
category = "main"
optional = false
python-versions = ">=3.9"
files = [
@ -767,7 +737,6 @@ files = [
name = "packaging"
version = "23.2"
description = "Core utilities for Python packages"
category = "main"
optional = false
python-versions = ">=3.7"
files = [
@ -779,7 +748,6 @@ files = [
name = "pandas"
version = "2.1.0"
description = "Powerful data structures for data analysis, time series, and statistics"
category = "main"
optional = false
python-versions = ">=3.9"
files = [
@ -838,7 +806,6 @@ xml = ["lxml (>=4.8.0)"]
name = "pandas"
version = "2.1.4"
description = "Powerful data structures for data analysis, time series, and statistics"
category = "main"
optional = false
python-versions = ">=3.9"
files = [
@ -906,7 +873,6 @@ xml = ["lxml (>=4.8.0)"]
name = "pluggy"
version = "1.3.0"
description = "plugin and hook calling mechanisms for python"
category = "dev"
optional = false
python-versions = ">=3.8"
files = [
@ -922,7 +888,6 @@ testing = ["pytest", "pytest-benchmark"]
name = "pydantic"
version = "2.5.3"
description = "Data validation using Python type hints"
category = "main"
optional = false
python-versions = ">=3.7"
files = [
@ -942,7 +907,6 @@ email = ["email-validator (>=2.0.0)"]
name = "pydantic-core"
version = "2.14.6"
description = ""
category = "main"
optional = false
python-versions = ">=3.7"
files = [
@ -1060,7 +1024,6 @@ typing-extensions = ">=4.6.0,<4.7.0 || >4.7.0"
name = "pygments"
version = "2.17.2"
description = "Pygments is a syntax highlighting package written in Python."
category = "dev"
optional = false
python-versions = ">=3.7"
files = [
@ -1076,7 +1039,6 @@ windows-terminal = ["colorama (>=0.4.6)"]
name = "pyproj"
version = "3.6.1"
description = "Python interface to PROJ (cartographic projections and coordinate transformations library)"
category = "main"
optional = false
python-versions = ">=3.9"
files = [
@ -1116,7 +1078,6 @@ certifi = "*"
name = "pyshp"
version = "2.3.1"
description = "Pure Python read/write support for ESRI Shapefile format"
category = "main"
optional = false
python-versions = ">=2.7"
files = [
@ -1128,7 +1089,6 @@ files = [
name = "pytest"
version = "7.4.4"
description = "pytest: simple powerful testing with Python"
category = "dev"
optional = false
python-versions = ">=3.7"
files = [
@ -1151,7 +1111,6 @@ testing = ["argcomplete", "attrs (>=19.2.0)", "hypothesis (>=3.56)", "mock", "no
name = "pytest-cov"
version = "3.0.0"
description = "Pytest plugin for measuring coverage."
category = "dev"
optional = false
python-versions = ">=3.6"
files = [
@ -1170,7 +1129,6 @@ testing = ["fields", "hunter", "process-tests", "pytest-xdist", "six", "virtuale
name = "python-dateutil"
version = "2.8.2"
description = "Extensions to the standard Python datetime module"
category = "main"
optional = false
python-versions = "!=3.0.*,!=3.1.*,!=3.2.*,>=2.7"
files = [
@ -1185,7 +1143,6 @@ six = ">=1.5"
name = "pytz"
version = "2023.3.post1"
description = "World timezone definitions, modern and historical"
category = "main"
optional = false
python-versions = "*"
files = [
@ -1197,7 +1154,6 @@ files = [
name = "requests"
version = "2.31.0"
description = "Python HTTP for Humans."
category = "main"
optional = false
python-versions = ">=3.7"
files = [
@ -1219,7 +1175,6 @@ use-chardet-on-py3 = ["chardet (>=3.0.2,<6)"]
name = "requests-toolbelt"
version = "0.10.1"
description = "A utility belt for advanced users of python-requests"
category = "main"
optional = false
python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*"
files = [
@ -1234,7 +1189,6 @@ requests = ">=2.0.1,<3.0.0"
name = "scipy"
version = "1.9.3"
description = "Fundamental algorithms for scientific computing in Python"
category = "main"
optional = false
python-versions = ">=3.8"
files = [
@ -1273,7 +1227,6 @@ test = ["asv", "gmpy2", "mpmath", "pytest", "pytest-cov", "pytest-xdist", "sciki
name = "setuptools"
version = "69.0.3"
description = "Easily download, build, install, upgrade, and uninstall Python packages"
category = "main"
optional = false
python-versions = ">=3.8"
files = [
@ -1290,7 +1243,6 @@ testing-integration = ["build[virtualenv] (>=1.0.3)", "filelock (>=3.4.0)", "jar
name = "shapely"
version = "2.0.1"
description = "Manipulation and analysis of geometric objects"
category = "main"
optional = false
python-versions = ">=3.7"
files = [
@ -1338,14 +1290,13 @@ files = [
numpy = ">=1.14"
[package.extras]
docs = ["matplotlib", "numpydoc (>=1.1.0,<1.2.0)", "sphinx", "sphinx-book-theme", "sphinx-remove-toctrees"]
docs = ["matplotlib", "numpydoc (==1.1.*)", "sphinx", "sphinx-book-theme", "sphinx-remove-toctrees"]
test = ["pytest", "pytest-cov"]
[[package]]
name = "six"
version = "1.16.0"
description = "Python 2 and 3 compatibility utilities"
category = "main"
optional = false
python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*"
files = [
@ -1357,7 +1308,6 @@ files = [
name = "sniffio"
version = "1.3.0"
description = "Sniff out which async library your code is running under"
category = "main"
optional = false
python-versions = ">=3.7"
files = [
@ -1369,7 +1319,6 @@ files = [
name = "specklepy"
version = "2.17.12"
description = "The Python SDK for Speckle 2.0"
category = "main"
optional = false
python-versions = ">=3.8.0,<4.0"
files = [
@ -1391,7 +1340,6 @@ ujson = ">=5.3.0,<6.0.0"
name = "stringcase"
version = "1.2.0"
description = "String case converter."
category = "main"
optional = false
python-versions = "*"
files = [
@ -1402,7 +1350,6 @@ files = [
name = "tomli"
version = "2.0.1"
description = "A lil' TOML parser"
category = "dev"
optional = false
python-versions = ">=3.7"
files = [
@ -1414,7 +1361,6 @@ files = [
name = "typing-extensions"
version = "4.9.0"
description = "Backported and Experimental Type Hints for Python 3.8+"
category = "main"
optional = false
python-versions = ">=3.8"
files = [
@ -1426,7 +1372,6 @@ files = [
name = "tzdata"
version = "2023.4"
description = "Provider of IANA time zone data"
category = "main"
optional = false
python-versions = ">=2"
files = [
@ -1438,7 +1383,6 @@ files = [
name = "ujson"
version = "5.9.0"
description = "Ultra fast JSON encoder and decoder for Python"
category = "main"
optional = false
python-versions = ">=3.8"
files = [
@ -1513,7 +1457,6 @@ files = [
name = "urllib3"
version = "1.26.16"
description = "HTTP library with thread-safe connection pooling, file post, and more."
category = "main"
optional = false
python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*, !=3.5.*"
files = [
@ -1530,7 +1473,6 @@ socks = ["PySocks (>=1.5.6,!=1.5.7,<2.0)"]
name = "websockets"
version = "10.4"
description = "An implementation of the WebSocket Protocol (RFC 6455 & 7692)"
category = "main"
optional = false
python-versions = ">=3.7"
files = [
@ -1609,7 +1551,6 @@ files = [
name = "wrapt"
version = "1.16.0"
description = "Module for decorators, wrappers and monkey patching."
category = "main"
optional = false
python-versions = ">=3.6"
files = [
@ -1689,7 +1630,6 @@ files = [
name = "yarl"
version = "1.9.4"
description = "Yet another URL library"
category = "main"
optional = false
python-versions = ">=3.7"
files = [
@ -1793,7 +1733,6 @@ multidict = ">=4.0"
name = "zipp"
version = "3.17.0"
description = "Backport of pathlib-compatible object wrapper for zip files"
category = "main"
optional = false
python-versions = ">=3.8"
files = [

Просмотреть файл

@ -27,6 +27,3 @@ devtools = "^0.12.2"
[build-system]
requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"
[tool.pytest.ini_options]
pythonpath = "specklepy_qt_ui"

Просмотреть файл

@ -5,29 +5,38 @@ import math
import os
import time
from tokenize import String
from typing import List
from typing import List, Union
from plugin_utils.helpers import findOrCreatePath
from qgis._core import (
QgsCoordinateTransform,
Qgis,
QgsPointXY,
QgsGeometry,
QgsRasterBandStats,
QgsFeature,
QgsFields,
QgsField,
QgsVectorLayer,
QgsRasterLayer,
QgsCoordinateReferenceSystem,
QgsProject,
QgsUnitTypes,
)
try:
from qgis._core import (
QgsCoordinateTransform,
Qgis,
QgsPointXY,
QgsGeometry,
QgsRasterBandStats,
QgsFeature,
QgsFields,
QgsField,
QgsVectorLayer,
QgsRasterLayer,
QgsCoordinateReferenceSystem,
QgsProject,
QgsUnitTypes,
)
from osgeo import ( # # C:\Program Files\QGIS 3.20.2\apps\Python39\Lib\site-packages\osgeo
gdal,
osr,
)
from PyQt5.QtCore import QVariant, QDate, QDateTime
except ModuleNotFoundError:
pass
from specklepy.objects import Base
from specklepy.objects.other import RevitParameter
from typing import Dict, Any
from PyQt5.QtCore import QVariant, QDate, QDateTime
from speckle.converter.geometry.conversions import (
convertToNative,
convertToNativeMulti,
@ -57,17 +66,14 @@ from speckle.converter.layers.utils import (
traverseDict,
validateAttributeName,
)
from osgeo import ( # # C:\Program Files\QGIS 3.20.2\apps\Python39\Lib\site-packages\osgeo
gdal,
osr,
)
import numpy as np
import scipy as sp
from speckle.utils.panel_logging import logToUser
def addFeatVariant(key, variant, value, f: QgsFeature):
def addFeatVariant(key, variant, value, f: "QgsFeature"):
# print("__________add variant")
try:
feat = f
@ -105,7 +111,9 @@ def addFeatVariant(key, variant, value, f: QgsFeature):
return feat
def updateFeat(feat: QgsFeature, fields: QgsFields, feature: Base) -> dict[str, Any]:
def updateFeat(
feat: "QgsFeature", fields: "QgsFields", feature: Base
) -> dict[str, Any]:
try:
# print("__updateFeat")
all_field_names = fields.names()
@ -174,12 +182,12 @@ def updateFeat(feat: QgsFeature, fields: QgsFields, feature: Base) -> dict[str,
def featureToSpeckle(
fieldnames: List[str],
f: QgsFeature,
f: "QgsFeature",
geomType,
sourceCRS: QgsCoordinateReferenceSystem,
targetCRS: QgsCoordinateReferenceSystem,
project: QgsProject,
selectedLayer: QgsVectorLayer or QgsRasterLayer,
sourceCRS: "QgsCoordinateReferenceSystem",
targetCRS: "QgsCoordinateReferenceSystem",
project: "QgsProject",
selectedLayer: Union["QgsVectorLayer", "QgsRasterLayer"],
dataStorage,
):
# print("Feature to Speckle")
@ -297,9 +305,9 @@ def featureToSpeckle(
def rasterFeatureToSpeckle(
selectedLayer: QgsRasterLayer,
projectCRS: QgsCoordinateReferenceSystem,
project: QgsProject,
selectedLayer: "QgsRasterLayer",
projectCRS: "QgsCoordinateReferenceSystem",
project: "QgsProject",
plugin,
) -> Base:
dataStorage = plugin.dataStorage
@ -1090,7 +1098,7 @@ def rasterFeatureToSpeckle(
return None
def featureToNative(feature: Base, fields: QgsFields, dataStorage):
def featureToNative(feature: Base, fields: "QgsFields", dataStorage):
feat = QgsFeature()
# print("___featureToNative")
try:
@ -1182,9 +1190,9 @@ def featureToNative(feature: Base, fields: QgsFields, dataStorage):
def bimFeatureToNative(
exist_feat: QgsFeature,
exist_feat: "QgsFeature",
feature: Base,
fields: QgsFields,
fields: "QgsFields",
crs,
path: str,
dataStorage,
@ -1204,7 +1212,7 @@ def bimFeatureToNative(
return
def nonGeomFeatureToNative(feature: Base, fields: QgsFields, dataStorage):
def nonGeomFeatureToNative(feature: Base, fields: "QgsFields", dataStorage):
try:
exist_feat = QgsFeature()
exist_feat.setFields(fields)
@ -1216,7 +1224,7 @@ def nonGeomFeatureToNative(feature: Base, fields: QgsFields, dataStorage):
return
def cadFeatureToNative(feature: Base, fields: QgsFields, dataStorage):
def cadFeatureToNative(feature: Base, fields: "QgsFields", dataStorage):
try:
exist_feat = QgsFeature()
try:

Просмотреть файл

@ -21,10 +21,6 @@ import os
import time
from datetime import datetime
from osgeo import ( # # C:\Program Files\QGIS 3.20.2\apps\Python39\Lib\site-packages\osgeo
gdal,
osr,
)
from plugin_utils.helpers import (
findFeatColors,
findOrCreatePath,
@ -33,28 +29,37 @@ from plugin_utils.helpers import (
)
# from qgis._core import Qgis, QgsVectorLayer, QgsWkbTypes
from qgis.core import (
Qgis,
QgsProject,
QgsRasterLayer,
QgsPoint,
QgsVectorLayer,
QgsProject,
QgsWkbTypes,
QgsLayerTree,
QgsLayerTreeGroup,
QgsLayerTreeNode,
QgsLayerTreeLayer,
QgsCoordinateReferenceSystem,
QgsCoordinateTransform,
QgsFields,
QgsSingleSymbolRenderer,
QgsCategorizedSymbolRenderer,
QgsRendererCategory,
QgsSymbol,
QgsUnitTypes,
QgsVectorFileWriter,
)
try:
from qgis.core import (
Qgis,
QgsProject,
QgsRasterLayer,
QgsPoint,
QgsVectorLayer,
QgsProject,
QgsWkbTypes,
QgsLayerTree,
QgsLayerTreeGroup,
QgsLayerTreeNode,
QgsLayerTreeLayer,
QgsCoordinateReferenceSystem,
QgsCoordinateTransform,
QgsFields,
QgsSingleSymbolRenderer,
QgsCategorizedSymbolRenderer,
QgsRendererCategory,
QgsSymbol,
QgsUnitTypes,
QgsVectorFileWriter,
)
from osgeo import ( # # C:\Program Files\QGIS 3.20.2\apps\Python39\Lib\site-packages\osgeo
gdal,
osr,
)
from PyQt5.QtGui import QColor
except ModuleNotFoundError:
pass
from specklepy.objects.GIS.geometry import GisPolygonElement, GisNonGeometryElement
from speckle.converter.geometry.point import (
pointToNative,
@ -102,7 +107,7 @@ from speckle.converter.layers.symbology import (
rendererToSpeckle,
)
from PyQt5.QtGui import QColor
import numpy as np
from speckle.utils.panel_logging import logToUser

Просмотреть файл

@ -1,5 +1,5 @@
import inspect
from typing import Any, Dict, Union
from typing import Any, Dict, Tuple, Union
try:
from qgis.core import (
@ -23,11 +23,11 @@ try:
QgsGraduatedSymbolRenderer,
QgsRasterDataProvider,
)
from PyQt5.QtGui import QColor
except ModuleNotFoundError:
pass
from specklepy.objects.GIS.layers import Layer, RasterLayer, VectorLayer
from PyQt5.QtGui import QColor
from speckle.utils.panel_logging import logToUser
@ -170,7 +170,7 @@ def gradientColorRampToNative(renderer: dict[str, Any]) -> "QgsGradientColorRamp
return newRamp
def get_r_g_b(rgb: int) -> tuple[int, int, int]:
def get_r_g_b(rgb: int) -> Tuple[int, int, int]:
r = g = b = 0
try:
r = (rgb & 0xFF0000) >> 16

Просмотреть файл

@ -15,7 +15,6 @@ from specklepy.objects.geometry import (
Mesh,
)
from PyQt5.QtCore import QVariant, QDate, QDateTime
try:
from qgis._core import (
@ -30,13 +29,12 @@ try:
QgsFields,
QgsLayerTreeGroup,
)
from PyQt5.QtGui import QColor
from PyQt5.QtCore import QVariant, QDate, QDateTime
from osgeo import gdal, ogr, osr
except ModuleNotFoundError:
pass
from PyQt5.QtGui import QColor
import math
import numpy as np
@ -186,7 +184,7 @@ def getLayerGeomType(
return
def getVariantFromValue(value: Any) -> Union[QVariant.Type, None]:
def getVariantFromValue(value: Any) -> Union["QVariant.Type", None]:
try:
# TODO add Base object
pairs = {

Просмотреть файл

@ -31,7 +31,6 @@ from qgis.PyQt.QtWidgets import (
from qgis.PyQt import QtWidgets
from qgis import PyQt
# from PyQt5.QtCore import pyqtSignal
import sip

0
tests/unit/__init__.py Normal file
Просмотреть файл

Просмотреть файл

@ -1,10 +1,13 @@
import math
from typing import Union
import pytest
import os
import sys
import speckle
import specklepy_qt_ui
r"""
sys.path.append(
os.path.abspath(
os.path.dirname(speckle.__file__).replace(
@ -12,8 +15,9 @@ sys.path.append(
)
)
)
"""
from specklepy_qt_ui.qt_ui.DataStorage import DataStorage
# from specklepy_qt_ui.qt_ui.DataStorage import DataStorage
from specklepy.objects.encoding import CurveTypeEncoding
from specklepy.objects.geometry import Arc, Line, Mesh, Point, Plane, Polycurve, Vector
@ -21,6 +25,14 @@ from specklepy.objects.geometry import Arc, Line, Mesh, Point, Plane, Polycurve,
@pytest.fixture()
def data_storage():
class DataStorage:
crs_offset_x: Union[int, float]
crs_offset_y: Union[int, float]
crs_rotation: Union[int, float]
def __init__(self):
pass
sample_obj = DataStorage()
sample_obj.crs_offset_x = 0
sample_obj.crs_offset_y = 0

Просмотреть файл

@ -2,6 +2,8 @@ import math
import numpy as np
from typing import List, Tuple
import pytest
import os
import sys
from speckle.converter.geometry.utils import (
cross_product,
@ -323,3 +325,17 @@ def test_apply_pt_transform_matrix(data_storage):
data_storage.matrix = matrix
result = apply_pt_transform_matrix(pt, data_storage)
assert isinstance(result, Point)
def test_path():
import speckle
p = os.path.abspath(os.path.dirname(speckle.__file__))
t = os.path.abspath(
os.path.dirname(speckle.__file__).replace(
"speckle-qgis\\speckle", "speckle-qgis\\specklepy_qt_ui"
)
)
assert "1" in sys.path
assert p=="1"
assert t=="1"