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