Compare commits
16 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| fc7e3ca893 | |||
| 9a4635c561 | |||
| 9f873333f5 | |||
| 50c78d679e | |||
| 72dcb674eb | |||
| 9d038de3ab | |||
| 52a667f28e | |||
| 31cd12160b | |||
| 22e7f18648 | |||
| 97815ead9d | |||
| 332331465d | |||
| b56f006103 | |||
| 1fdefc8929 | |||
| f51dd28e46 | |||
| e22bfd72ea | |||
| 739d8bc189 |
@@ -65,7 +65,7 @@ workflows:
|
||||
- test:
|
||||
matrix:
|
||||
parameters:
|
||||
tag: ["3.7", "3.8", "3.9", "3.10"]
|
||||
tag: ["3.6", "3.7", "3.8", "3.9"]
|
||||
filters:
|
||||
tags:
|
||||
only: /.*/
|
||||
|
||||
Generated
+450
-410
File diff suppressed because it is too large
Load Diff
+2
-2
@@ -11,11 +11,11 @@ homepage = "https://speckle.systems/"
|
||||
|
||||
|
||||
[tool.poetry.dependencies]
|
||||
python = ">=3.7.0, <4.0"
|
||||
python = "^3.6.5"
|
||||
pydantic = "^1.8.2"
|
||||
appdirs = "^1.4.4"
|
||||
gql = {extras = ["requests", "websockets"], version = "^3.3.0"}
|
||||
ujson = "^5.3.0"
|
||||
ujson = "^4.3.0"
|
||||
Deprecated = "^1.2.13"
|
||||
|
||||
[tool.poetry.dev-dependencies]
|
||||
|
||||
@@ -1,13 +1,10 @@
|
||||
import socket
|
||||
import sys
|
||||
import queue
|
||||
import hashlib
|
||||
import getpass
|
||||
import logging
|
||||
import requests
|
||||
import threading
|
||||
import platform
|
||||
import contextlib
|
||||
|
||||
|
||||
"""
|
||||
Anonymous telemetry to help us understand how to make a better Speckle.
|
||||
@@ -15,7 +12,7 @@ This really helps us to deliver a better open source project and product!
|
||||
"""
|
||||
TRACK = True
|
||||
HOST_APP = "python"
|
||||
HOST_APP_VERSION = f"python {'.'.join(map(str, sys.version_info[:2]))}"
|
||||
HOST_APP_VERSION = f"python {'.'.join(map(str, sys.version_info[:3]))}"
|
||||
PLATFORMS = {"win32": "Windows", "cygwin": "Windows", "darwin": "Mac OS X"}
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
@@ -78,7 +75,8 @@ def track(action: str, account: "Account" = None, custom_props: dict = None):
|
||||
METRICS_TRACKER.queue.put_nowait(event_params)
|
||||
except Exception as ex:
|
||||
# wrapping this whole thing in a try except as we never want a failure here to annoy users!
|
||||
LOG.error(f"Error queueing metrics request: {str(ex)}")
|
||||
LOG.error("Error queueing metrics request: " + str(ex))
|
||||
|
||||
|
||||
def initialise_tracker(account: "Account" = None):
|
||||
global METRICS_TRACKER
|
||||
@@ -103,7 +101,8 @@ class Singleton(type):
|
||||
class MetricsTracker(metaclass=Singleton):
|
||||
analytics_url = "https://analytics.speckle.systems/track?ip=1"
|
||||
analytics_token = "acd87c5a50b56df91a795e999812a3a4"
|
||||
last_user = ""
|
||||
user_ip = None
|
||||
last_user = None
|
||||
last_server = None
|
||||
platform = None
|
||||
sending_thread = None
|
||||
@@ -115,15 +114,12 @@ class MetricsTracker(metaclass=Singleton):
|
||||
)
|
||||
self.platform = PLATFORMS.get(sys.platform, "linux")
|
||||
self.sending_thread.start()
|
||||
with contextlib.suppress(Exception):
|
||||
node, user = platform.node(), getpass.getuser()
|
||||
if node and user:
|
||||
self.last_user = f"@{self.hash(f'{node}-{user}')}"
|
||||
self.user_ip = socket.gethostbyname(socket.gethostname())
|
||||
|
||||
def set_last_user(self, email: str):
|
||||
if not email:
|
||||
return
|
||||
self.last_user = f"@{self.hash(email)}"
|
||||
self.last_user = "@" + self.hash(email)
|
||||
|
||||
def set_last_server(self, server: str):
|
||||
if not server:
|
||||
@@ -141,6 +137,6 @@ class MetricsTracker(metaclass=Singleton):
|
||||
try:
|
||||
session.post(self.analytics_url, json=event_params)
|
||||
except Exception as ex:
|
||||
LOG.error(f"Error sending metrics request: {str(ex)}")
|
||||
LOG.error("Error sending metrics request: " + str(ex))
|
||||
|
||||
self.queue.task_done()
|
||||
self.queue.task_done()
|
||||
|
||||
@@ -142,7 +142,7 @@ class Base(_RegisteringBase):
|
||||
id: Optional[str] = None
|
||||
totalChildrenCount: Optional[int] = None
|
||||
applicationId: Optional[str] = None
|
||||
_units: str = None
|
||||
_units: str = "m"
|
||||
# dict of chunkable props and their max chunk size
|
||||
_chunkable: Dict[str, int] = {}
|
||||
_chunk_size_default: int = 1000
|
||||
|
||||
@@ -16,7 +16,6 @@ UNITS_STRINGS = {
|
||||
}
|
||||
|
||||
UNITS_ENCODINGS = {
|
||||
None: 0,
|
||||
"none": 0,
|
||||
"mm": 1,
|
||||
"cm": 2,
|
||||
@@ -59,5 +58,7 @@ def get_units_from_encoding(unit: int):
|
||||
def get_encoding_from_units(unit: str):
|
||||
try:
|
||||
return UNITS_ENCODINGS[unit]
|
||||
except KeyError as e:
|
||||
raise SpeckleException(message=f"No encoding exists for unit {unit}. Please enter a valid unit to encode (eg {UNITS_ENCODINGS}).") from e
|
||||
except KeyError:
|
||||
raise SpeckleException(
|
||||
message=f"No encoding exists for unit {unit}. Please enter a valid unit to encode (eg {UNITS_ENCODINGS})."
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user