repo_id
stringclasses
1 value
file_path
stringlengths
31
102
content
stringlengths
16
34k
__index_level_0__
int64
0
0
xyz_max_hmi_server
repos\xyz_max_hmi_server\models\pallet.py
""" 托盘模型 """ import sqlalchemy as sa from xyz_max_hmi_server.db.base_class import Base class PalletModel(Base): # type: ignore __tablename__ = "t_pallet" pallet_id = sa.Column( sa.String(255), comment="托盘编号", index=True, ) workspace_id = sa.Column( sa.String(255), ...
0
xyz_max_hmi_server
repos\xyz_max_hmi_server\models\task.py
import sqlalchemy as sa from sqlalchemy.orm import relationship from sqlalchemy.sql import func from xyz_max_hmi_server import enums from xyz_max_hmi_server.db.base_class import Base class TaskModel(Base): # type: ignore __tablename__ = "t_task" id = sa.Column(sa.Integer, primary_key=True, autoincrement=Tru...
0
xyz_max_hmi_server
repos\xyz_max_hmi_server\models\task_batch.py
import sqlalchemy as sa from xyz_max_hmi_server.db.base_class import Base class TaskBatchModel(Base): """任务批次表""" __tablename__ = "t_task_batch" batch_id = sa.Column(sa.String(50), index=True, comment="批次ID") task_id = sa.Column(sa.String(50), index=True, comment="任务ID")
0
xyz_max_hmi_server
repos\xyz_max_hmi_server\models\task_result.py
import sqlalchemy as sa from sqlalchemy.sql import func from xyz_max_hmi_server import enums from xyz_max_hmi_server.db.base_class import Base class TaskResultModel(Base): # type: ignore """ 任务结果表 """ __tablename__ = "t_task_result" id = sa.Column(sa.Integer, primary_key=True, autoincrement=Tru...
0
xyz_max_hmi_server
repos\xyz_max_hmi_server\models\workspace.py
import sqlalchemy as sa from xyz_max_hmi_server.db.base_class import Base class WorkspaceModel(Base): # type: ignore __tablename__ = "t_workspace" ws_id = sa.Column(sa.String(32), index=True, unique=True, comment="工作空间ID") current_pallet_id = sa.Column( sa.String(32), comment="当前托盘ID", nullable=...
0
xyz_max_hmi_server
repos\xyz_max_hmi_server\models\__init__.py
from .arrival_sequence import ArrivalSequenceModel from .cycle import CycleModel from .error_records import ErrorRecordsModel from .order import OrderModel from .order_result import OrderResultModel from .task import TaskModel from .task_batch import TaskBatchModel from .task_result import TaskResultModel __all__ = [ ...
0
xyz_max_hmi_server
repos\xyz_max_hmi_server\modules\error_map.py
""" 建立异常码与异常信息的映射关系 """ import copy from typing import Dict, Set from pydantic import BaseModel from xyz_max_hmi_server.utils.i18n import gettext as _ from xyz_max_hmi_server.utils.signleton import Singleton class ErrorMessage(BaseModel): code: str msg: str tip: str class ErrorMap(metaclass=Singleton)...
0
xyz_max_hmi_server
repos\xyz_max_hmi_server\modules\error_records.py
import time from datetime import datetime from typing import Optional from xyz_max_hmi_server import _, crud, enums from xyz_max_hmi_server.db.session import db from xyz_max_hmi_server.entity.task import LiteTask as Task from xyz_max_hmi_server.modules.cycle.current import current_cycle from xyz_max_hmi_server.modules...
0
xyz_max_hmi_server
repos\xyz_max_hmi_server\modules\global_variable.py
"""全局变量模块""" import pickle from typing import Any, List, Optional from sqlalchemy.orm.session import Session from xyz_max_hmi_server.db.session import NEW_SESSION, provide_session from xyz_max_hmi_server.models.global_variable import GlobalVariableModel class GlobalVariable: """临时变量类""" def __init__(self):...
0
xyz_max_hmi_server
repos\xyz_max_hmi_server\modules\notify.py
from typing import Any, Dict import requests from loguru import logger from xyz_max_hmi_server import config class Notify: # noqa: D101 def __init__(self) -> None: # noqa: D107 self.session = requests.Session() def notify(self, data: Dict[str, Any]): """发送通知""" if not config.setti...
0
xyz_max_hmi_server
repos\xyz_max_hmi_server\modules\cyber\exceptions.py
from typing import Optional class CyberException(Exception): def __init__( self, error: int = 0, error_message: Optional[str] = None, info: Optional[str] = None, timestamp: Optional[int] = None, ): self.error = error if error_message: self.er...
0
xyz_max_hmi_server
repos\xyz_max_hmi_server\modules\cyber\future.py
import threading class FutureResult: """A future result that can be used to wait for a result.""" def __init__(self): self._result = 1 self._done = False self._condition = threading.Condition() def set_result(self, result): """Sets the result and notifies all waiting thre...
0
xyz_max_hmi_server
repos\xyz_max_hmi_server\modules\cyber\main.py
import threading from typing import Dict, List, Protocol, Union import cyber.cyber_py3.cyber as _cyber from xyz_max_hmi_server.utils.signleton import Singleton from .node import CyberNode class CyberNodeNameProto(Protocol): """Cyber Node Name Protocol""" @property def value(self) -> str: ... ...
0
xyz_max_hmi_server
repos\xyz_max_hmi_server\modules\cyber\msg_handler.py
from typing import Any, Callable from google.protobuf.json_format import MessageToDict from google.protobuf.message import Message from protobuf_to_dict import protobuf_to_dict try: from xyz_vision_lib.image_convert import imgmsg_to_cv2 # type: ignore except ImportError: from xyz_max_hmi_server.utils.cv_conv...
0
xyz_max_hmi_server
repos\xyz_max_hmi_server\modules\cyber\node.py
"""Cyber Node""" from functools import cached_property from typing import TYPE_CHECKING, Callable, Dict, Optional, Type, TypeVar import cyber.cyber_py3.cyber as cyber from google.protobuf.message import Message from loguru import logger from .future import FutureResult from .service.base import CyberService if TYPE_...
0
xyz_max_hmi_server
repos\xyz_max_hmi_server\modules\cyber\utils.py
from functools import lru_cache from typing import Dict, List, Optional, Type, Union, cast import cyber.cyber_py3.cyber as cyber from google.protobuf.message import Message from loguru import logger from xyz_msgs.sensor_msgs import Image_pb2 from xyz_msgs.std_msgs import builtin_pb2 from xyz_msgs.vision_msgs import Vi...
0
xyz_max_hmi_server
repos\xyz_max_hmi_server\modules\cyber\__init__.py
from .client.srv import VPClient from .client.vision import VisionClient from .exceptions import CyberException from .main import Cyber from .node import CyberNode from .service.base import CyberService from .utils import ( get_channels, get_msgtype, get_node_attr, get_nodes, get_services, ) __all_...
0
xyz_max_hmi_server
repos\xyz_max_hmi_server\modules\cyber\client\base.py
"""Cyber Client Base Class.""" from typing import ClassVar, Type import cyber.cyber_py3.cyber as cyber from google.protobuf.message import Message from xyz_max_hmi_server.exceptions import XYZCyberError from xyz_max_hmi_server.utils.decorators import reraise class CyberClient: """Cyber Client Base Class.""" ...
0
xyz_max_hmi_server
repos\xyz_max_hmi_server\modules\cyber\client\cycle.py
"""CycleCyberClient is a client that is used to send the cycle log to the HMI.""" from loguru import logger from xyz_max_hmi_server.exceptions import XYZException try: from xyz_msgs.hmi.HMISrv_pb2 import Request, Response # type: ignore except ImportError: from xyz_max_hmi_server.modules.cyber.mock.msgs.hmi_...
0
xyz_max_hmi_server
repos\xyz_max_hmi_server\modules\cyber\client\io_device.py
from typing import ClassVar, Type import cyber.cyber_py3.cyber as cyber from io_server_msgs.IoServerMsg_pb2 import IoReqMsg, IoResMsg # type: ignore from xyz_io_server.operation_code import OperationCode from xyz_max_hmi_server.modules.cyber.node import CyberNode from .base import CyberClient class IODeviceClient...
0
xyz_max_hmi_server
repos\xyz_max_hmi_server\modules\cyber\client\robot_driver.py
import warnings from xyz_max_hmi_server import enums from xyz_max_hmi_server.config import settings from xyz_max_hmi_server.exceptions import XYZCyberRobotServerError from xyz_max_hmi_server.utils.decorators import reraise from xyz_max_hmi_server.utils.signleton import Singleton from .base import CyberClient class ...
0
xyz_max_hmi_server
repos\xyz_max_hmi_server\modules\cyber\client\srv.py
import warnings from typing import Optional import cyber.cyber_py3.cyber as cyber from cyber.cyber_py3.cyber import Future from xyz_msgs.vp_msgs import VPSrv_pb2 from xyz_max_hmi_server.exceptions import XYZCyberVPError from xyz_max_hmi_server.utils.decorators import reraise from .base import CyberClient class VPC...
0
xyz_max_hmi_server
repos\xyz_max_hmi_server\modules\cyber\client\vision.py
from typing import List import cyber.cyber_py3.cyber as cyber from xyz_msgs.vision_msgs import VisionSrv_pb2 from xyz_max_hmi_server.modules.cyber.exceptions import CyberException # from xyz_msgs.vision_msgs.Primitive2D import Primitive2D # from xyz_msgs.vision_msgs.Primitive3D import Primitive3D from .base import C...
0
xyz_max_hmi_server
repos\xyz_max_hmi_server\modules\cyber\client\__init__.py
from .vision import VisionClient as VisionClient
0
xyz_max_hmi_server
repos\xyz_max_hmi_server\modules\cyber\mock\msgs\hmi_pb2.py
# Generated by the protocol buffer compiler. DO NOT EDIT! # source: hmi.proto import sys _b = sys.version_info[0] < 3 and (lambda x: x) or (lambda x: x.encode("latin1")) from google.protobuf import ( descriptor as _descriptor, message as _message, reflection as _reflection, symbol_database as _symbol...
0
xyz_max_hmi_server
repos\xyz_max_hmi_server\modules\cyber\mock\msgs\mock_pb2.py
# Generated by the protocol buffer compiler. DO NOT EDIT! # source: proto/mock.proto import sys _b = sys.version_info[0] < 3 and (lambda x: x) or (lambda x: x.encode("latin1")) from google.protobuf import ( descriptor as _descriptor, message as _message, reflection as _reflection, symbol_database as ...
0
xyz_max_hmi_server
repos\xyz_max_hmi_server\modules\cyber\mock\msgs\robot_driver_pb2.py
# Generated by the protocol buffer compiler. DO NOT EDIT! # source: robot_driver.proto import sys _b = sys.version_info[0] < 3 and (lambda x: x) or (lambda x: x.encode("latin1")) from google.protobuf import ( descriptor as _descriptor, message as _message, reflection as _reflection, symbol_database a...
0
xyz_max_hmi_server
repos\xyz_max_hmi_server\modules\cyber\mock\proto\hmi.proto
syntax = "proto2"; import "google/protobuf/any.proto"; message SKUInfo { optional string type = 1; required float length = 2; required float width = 3; required float height = 4; required float weight = 5; optional string barcode = 6; optional uint32 barcode_direction = 7; } message StepInfo { required string name = 1;...
0
xyz_max_hmi_server
repos\xyz_max_hmi_server\modules\cyber\mock\proto\mock.proto
syntax = "proto2"; message Example { required float check_time = 1; required bool check_interval = 2; required bool check_release_papers = 3; required float min_length = 4; required bytes image = 5; required bytes image2 = 6; }
0
xyz_max_hmi_server
repos\xyz_max_hmi_server\modules\cyber\mock\proto\robot_driver.proto
syntax = "proto2"; message RobotDriverRequest { required string mode = 1; required string info = 2; } message RobotDriverResponse { required int32 error = 1; required string error_msg = 2; optional int32 status = 3; optional string info = 4; optional int64 timestamp = 5; } message RobotServerLog { re...
0
xyz_max_hmi_server
repos\xyz_max_hmi_server\modules\cyber\service\base.py
"""Base class for all services""" from typing import ClassVar, Optional, Protocol, Type from google.protobuf.message import Message class Callback(Protocol): """callback 是一个可调用对象,接收 1-2 个参数,返回一个值. 第一个参数是 req_data_type 类型的数据, 第二个参数是指定的 args 返回值是 res_data_type 类型的数据 """ def __call__(self, request...
0
xyz_max_hmi_server
repos\xyz_max_hmi_server\modules\cyber\service\cycle.py
from loguru import logger try: from xyz_msgs.hmi.HMISrv_pb2 import Request, Response # type: ignore except ImportError: from xyz_max_hmi_server.modules.cyber.mock.msgs.hmi_pb2 import ( Request, Response, ) logger.warning("xyz_msgs.hmi.HMISrv_pb2 导入失败,暂时使用 mock.msgs.hmi_pb2 替代") from ...
0
xyz_max_hmi_server
repos\xyz_max_hmi_server\modules\cyber\service\__init__.py
from .base import CyberService __all__ = ["CyberService"]
0
xyz_max_hmi_server
repos\xyz_max_hmi_server\modules\cycle\current.py
"""CurrentCycle类用于存储当前节拍数据.""" import copy import threading import uuid from datetime import datetime from typing import Any, Dict, Optional, TypedDict from pydantic import UUID4 from xyz_max_hmi_server.utils.signleton import Singleton class CycleException(TypedDict): code: str name: str record_time: in...
0
xyz_max_hmi_server
repos\xyz_max_hmi_server\modules\cycle\service.py
"""CycleService 用于接收 VP 发送的 cycle log 数据,并将数据写入到文件中.""" import json import time import uuid from typing import TYPE_CHECKING, ClassVar from loguru import logger from protobuf_to_dict import protobuf_to_dict from xyz_max_hmi_server import crud from xyz_max_hmi_server.db.session import start_session from xyz_max_hmi_se...
0
xyz_max_hmi_server
repos\xyz_max_hmi_server\modules\cycle\store.py
import json import time from pathlib import Path from threading import Event, Thread from cyber.cyber_py3.cyber import os from loguru import logger from xyz_max_hmi_server import crud from xyz_max_hmi_server.db.session import start_session from xyz_max_hmi_server.log import get_log_path class Store(Thread): def...
0
xyz_max_hmi_server
repos\xyz_max_hmi_server\modules\cycle\uploader.py
import socket import time from pathlib import Path from threading import Event, Thread from loguru import logger from xyz_max_hmi_server import crud from xyz_max_hmi_server.db.session import start_session class Uploader(Thread): def __init__(self): self.is_stopped = Event() super().__init__( ...
0
xyz_max_hmi_server
repos\xyz_max_hmi_server\modules\cycle\__init__.py
from .current import current_cycle from .service import CycleService __all__ = ["current_cycle", "CycleService"]
0
xyz_max_hmi_server
repos\xyz_max_hmi_server\modules\grpc\registry.py
"""注册中心""" from typing import Dict, Literal, Tuple, cast import grpc from xyz_max_hmi_server.exceptions import XYZNotFoundGrpcServiceError from xyz_max_hmi_server.utils.studio_max import XYZRoboticsSettings s = XYZRoboticsSettings() SERVICES = Literal[ "vp_global_service", "max_grpc_service", "io_servi...
0
xyz_max_hmi_server
repos\xyz_max_hmi_server\modules\grpc\client\io_device.py
"""Client to communicate with the IO server.""" import grpc from xyz_io_server.operation_code import OperationCode from xyz_max_hmi_server.exceptions import XYZGrpcError class IODeviceClient: """Client to communicate with the IO server.""" def __init__(self, channel: grpc.Channel) -> None: # noqa: D107 ...
0
xyz_max_hmi_server
repos\xyz_max_hmi_server\modules\grpc\client\max.py
import json from typing import Any, Dict, List, Optional import grpc from xyz_msgs.vp_grpc import TaskSrv_pb2_grpc from xyz_msgs.vp_msgs import VPSrv_pb2 from xyz_max_hmi_server.exceptions import XYZGrpcError from xyz_max_hmi_server.modules.grpc.registry import registry class MaxClient: """Max 客户端(基于 gRPC) ...
0
xyz_max_hmi_server
repos\xyz_max_hmi_server\modules\grpc\client\robot_driver.py
"""机器人驱动客户端.""" from typing import Literal from google.protobuf.json_format import MessageToDict from robot_driver_client.robot_driver_client import ( RobotDriverClient as _RobotDriverClient, ) from xyz_max_hmi_server.exceptions import XYZGrpcError from xyz_max_hmi_server.modules.grpc.registry import registry c...
0
xyz_max_hmi_server
repos\xyz_max_hmi_server\modules\grpc\client\vp.py
"""VP 客户端""" import json from typing import Dict, Literal, Optional import grpc from xyz_msgs.vp_grpc import TaskGlobalSrv_pb2_grpc from xyz_msgs.vp_msgs import VPSrv_pb2 from xyz_max_hmi_server.exceptions import XYZGrpcError # channel = grpc.insecure_channel("localhost:50051") class VPClient: """VP 客户端(基于 gRP...
0
xyz_max_hmi_server
repos\xyz_max_hmi_server\modules\manager\base.py
from typing import Generic, Optional, TypeVar, Union from xyz_max_hmi_server.exceptions import XYZException T = TypeVar("T") class BaseManager(Generic[T]): __sub_instances__ = [] # type: ignore def __new__(cls, *args, **kwargs): if not cls.__sub_instances__: cls.__sub_instances__.appen...
0
xyz_max_hmi_server
repos\xyz_max_hmi_server\modules\manager\order_manager.py
import importlib import logging from typing import List, Optional, Type, TypeVar, cast from fastapi_babel import _ from sqlalchemy.exc import IntegrityError from sqlalchemy.orm import Session from xyz_max_hmi_server import crud, enums from xyz_max_hmi_server.db.session import ( NEW_SESSION, provide_session, ...
0
xyz_max_hmi_server
repos\xyz_max_hmi_server\modules\manager\task_manager.py
import importlib import logging import warnings from typing import List, Optional, Type, TypeVar, Union, cast from fastapi.encoders import jsonable_encoder from fastapi_babel import _ from pydantic import BaseModel from sqlalchemy.orm.session import Session from xyz_max_hmi_server import crud, enums, system_status fr...
0
xyz_max_hmi_server
repos\xyz_max_hmi_server\modules\manager\websocket_manager.py
""" WebSocket Manager """ import asyncio import uuid from typing import Any, Dict, Literal from fastapi import status from fastapi.websockets import WebSocket from loguru import logger class WebsocketManager: """单例类""" __instance = None def __new__(cls, *args, **kwargs): if not cls.__instance: ...
0
xyz_max_hmi_server
repos\xyz_max_hmi_server\modules\manager\workspace_manager.py
import importlib from typing import List, Optional, Type, TypeVar, Union, cast from sqlalchemy.exc import IntegrityError from sqlalchemy.orm import Session from xyz_max_hmi_server import crud from xyz_max_hmi_server.db.session import NEW_SESSION, provide_session from xyz_max_hmi_server.entity import BaseWorkspace, Wo...
0
xyz_max_hmi_server
repos\xyz_max_hmi_server\modules\manager\__init__.py
from .order_manager import OrderManager from .task_manager import TaskManager from .websocket_manager import WebsocketManager from .workspace_manager import WorkspaceManager __all__ = [ "TaskManager", "OrderManager", "WorkspaceManager", "WebsocketManager", ]
0
xyz_max_hmi_server
repos\xyz_max_hmi_server\modules\message_pusher\cache.py
"""消息缓存""" import abc import heapq import typing as t class MessageCache(abc.ABC): def __init__(self, maxsize: int = 2000) -> None: """ Args: maxsize(int): 容量大小. """ self.maxsize = maxsize self.cache: t.List[CacheItem] = [] @abc.abstractmethod def add(s...
0
xyz_max_hmi_server
repos\xyz_max_hmi_server\modules\message_pusher\models.py
import time from typing import Optional from pydantic import BaseModel, Field from xyz_max_hmi_server.enums import LogLevel class OrderLog(BaseModel): timestamp: int = Field( default_factory=lambda: int(round(time.time() * 1000)), description="时间戳", ) level: LogLevel = LogLevel.INFO ...
0
xyz_max_hmi_server
repos\xyz_max_hmi_server\modules\message_pusher\push.py
from xyz_max_hmi_server.modules.message_pusher.sender import ( DialogSender, MotionPlanLogSender, OrderLogSender, RGBLightSender, RobotDriverStatusSender, RobotStatusSender, SystemStatusSender, WCSConnectionStatusSender, ) from xyz_max_hmi_server.utils.signleton import Singleton class ...
0
xyz_max_hmi_server
repos\xyz_max_hmi_server\modules\message_pusher\sender.py
import abc import json import time import typing as t from loguru import logger from xyz_max_hmi_server.enums import ( EventType, RobotDriverStatus, RobotStatus, SystemStatus, ) from xyz_max_hmi_server.exceptions import XYZException from xyz_max_hmi_server.globals import WCSStatus from xyz_max_hmi_ser...
0
xyz_max_hmi_server
repos\xyz_max_hmi_server\modules\message_pusher\__init__.py
from .push import MessagePusher __all__ = [ "MessagePusher", ]
0
xyz_max_hmi_server
repos\xyz_max_hmi_server\modules\monitor\default_listener.py
"""内置监听器, 可以根据配置中的开关来决定是否启用""" import importlib import typing as t from xyz_max_hmi_server import MessagePusher, globals, logger, plc_manager from xyz_max_hmi_server.config import settings from .listener import ( EstopListener, LightListener, RobotConnectionStatusListener, VPStatusListener, WCSSta...
0
xyz_max_hmi_server
repos\xyz_max_hmi_server\modules\monitor\dispatch.py
from typing import cast from blinker import signal from loguru import logger # 新增监听器的信号 add_listener_signal = signal("Monitor:Listener:add_listener") # 删除监听器的信号 remove_listener_signal = signal("Monitor:Listener:remove_listener") # 监听到事件的信号 receive_signal = signal("Monitor:Listener:receive") # 来自监听器管理器的通知信号 notice_sig...
0
xyz_max_hmi_server
repos\xyz_max_hmi_server\modules\monitor\executor.py
"""执行器模块 执行器模块负责执行任务,执行器模块的主要功能是: 1. 执行器是一个线程,用于执行某个任务 2. 执行器的本质就是执行一个回调函数 """ import time from concurrent.futures import ThreadPoolExecutor from queue import Queue from threading import Event, Thread from loguru import logger # TODO: 每一个 worker 对应一个队列,每一个队列的长度为 30,当队列满时,不再接受任务 # 目前是共用一个队列 class ExecutorManager(Th...
0
xyz_max_hmi_server
repos\xyz_max_hmi_server\modules\monitor\listener.py
import time from queue import Full, Queue from threading import Event, Thread from typing import Any, Callable, Dict, Optional, Set, cast from loguru import logger from typing_extensions import Self from xyz_max_hmi_server import enums from xyz_max_hmi_server.config import settings from .dispatch import ( add_li...
0
xyz_max_hmi_server
repos\xyz_max_hmi_server\modules\monitor\__init__.py
"""监听模块 监听模块主要用于监听服务的状态。 """ from .dispatch import dispatcher as monitor from .executor import ExecutorManager from .listener import BaseListener, Listener, ListenerManager __all__ = [ "Listener", "BaseListener", "ListenerManager", "ExecutorManager", "monitor", ] def init_app(app): """初始化监听模...
0
xyz_max_hmi_server
repos\xyz_max_hmi_server\modules\pipe\default_subscriber.py
"""内置的订阅管道""" from xyz_max_hmi_server import enums from xyz_max_hmi_server.app import cached_app from xyz_max_hmi_server.config import settings from xyz_max_hmi_server.modules.cyber.msg_handler import MessageHandler def load_ind_default_subscriber(): """加载工业项目的默认订阅管道""" from robot_server_msgs import RobotServ...
0
xyz_max_hmi_server
repos\xyz_max_hmi_server\modules\pipe\event_handlers.py
import json import typing import uuid from typing import Any from fastapi.encoders import jsonable_encoder from google.protobuf.message import Message from loguru import logger from xyz_max_hmi_server.modules.cyber.msg_handler import MessageHandler from xyz_max_hmi_server.modules.cyber.utils import get_channels, get_...
0
xyz_max_hmi_server
repos\xyz_max_hmi_server\modules\pipe\msg_center.py
"""消息中心""" import json import textwrap from asyncio import Queue, QueueFull from threading import Event from typing import Any, Dict, Literal, Set, Tuple, TypedDict from loguru import logger from typing_extensions import NotRequired from xyz_max_hmi_server.modules.manager.websocket_manager import ( websocket_mana...
0
xyz_max_hmi_server
repos\xyz_max_hmi_server\modules\pipe\register.py
""" 注册 Event 和 Websocket 的会话 """ import collections from typing import Set class Register: def __init__(self): self.__events = collections.defaultdict(set) self.__ws_topics = collections.defaultdict(set) def register(self, event_name: str, ws_id: str): self.__events[event_name].add(ws...
0
xyz_max_hmi_server
repos\xyz_max_hmi_server\modules\pipe\__init__.py
"""PIPE module.""" from typing import TYPE_CHECKING if TYPE_CHECKING: from xyz_max_hmi_server.app import Application def init_app(app: "Application"): from .default_subscriber import load_default_subscriber from .event_handlers import init_event_handlers load_default_subscriber() init_event_han...
0
xyz_max_hmi_server
repos\xyz_max_hmi_server\modules\plc\io_client.py
import math from typing import List, Optional from cyber.cyber_py3 import cyber from xyz_msgs.xyz_io.io_AnalogReq_pb2 import IoAnalogReq from xyz_msgs.xyz_io.io_AnalogRes_pb2 import IoAnalogRes from xyz_msgs.xyz_io.io_DigitalReq_pb2 import IoDigitalReq from xyz_msgs.xyz_io.io_DigitalRes_pb2 import IoDigitalRes from xy...
0
xyz_max_hmi_server
repos\xyz_max_hmi_server\modules\plc\manager.py
from typing import Optional, TypeVar, cast from .io_client import IOClient from .modules import PLC, Buzzer, Grating, Light, Robot T = TypeVar("T") class PLCManager: """PLC管理类, 用于管理PLC, Robot, Buzzer, Light, Grating等设备 单例模式 """ __instance: Optional["PLCManager"] = cast("PLCManager", None) def...
0
xyz_max_hmi_server
repos\xyz_max_hmi_server\modules\plc\modules.py
from typing import Any, Dict, Optional, cast try: from xyz_io_client.robot_signaler import ( CLEAR, ROBOT_ENABLE_STATE_ADDR, ROBOT_IN_COLLISION_ADDR, ROBOT_IN_CYCLE_ADDR, ROBOT_IN_E_STOP_ADDR, ROBOT_IN_ERROR_ADDR, ROBOT_IN_NORMAL_ADDR, ROBOT_IN_PAUSE_...
0
xyz_max_hmi_server
repos\xyz_max_hmi_server\modules\plc\__init__.py
from .manager import PLCManager, plc_manager from .modules import PLC, Buzzer, Grating, Light, Robot __all__ = [ "PLCManager", "plc_manager", "PLC", "Buzzer", "Grating", "Light", "Robot", ]
0
xyz_max_hmi_server
repos\xyz_max_hmi_server\modules\workflow\workflow.py
"""工作流模块.""" import warnings from typing import Any, Literal, Optional, TypeVar from fastapi.encoders import jsonable_encoder from loguru import logger from xyz_max_hmi_server import _, g, plc_manager, system_status from xyz_max_hmi_server.entity.order import LiteOrder, Order from xyz_max_hmi_server.entity.task impor...
0
xyz_max_hmi_server
repos\xyz_max_hmi_server\schemas\arrival_sequence.py
from datetime import datetime from typing import Optional from pydantic import BaseModel, Field from typing_extensions import TypedDict class BoxDimension(TypedDict): """Box dimension in m""" length: float width: float height: float class ArrivalSequenceBase(BaseModel): """Arrival sequence sch...
0
xyz_max_hmi_server
repos\xyz_max_hmi_server\schemas\base.py
from abc import ABC from datetime import datetime from typing import Any, Generic, Optional, Sequence, TypeVar from fastapi_pagination import Params from fastapi_pagination.bases import AbstractPage, AbstractParams from fastapi_pagination.types import GreaterEqualOne, GreaterEqualZero from pydantic import Field, root_...
0
xyz_max_hmi_server
repos\xyz_max_hmi_server\schemas\cmcp_planning_result.py
import uuid from datetime import datetime from typing import Final, List, Optional from pydantic import BaseModel, Field from xyz_max_hmi_server import enums from xyz_max_hmi_server.entity.cmcp_planning_result import Result class CMCPPlanningResultBaseSchema(BaseModel): order_id: str key: str class CMCPPl...
0
xyz_max_hmi_server
repos\xyz_max_hmi_server\schemas\cycle.py
from pydantic import BaseModel, Json class CycleBaseSchema(BaseModel): id: str data: Json class CycleCreateSchema(CycleBaseSchema): pass class CycleUpdateSchema(CycleBaseSchema): pass
0
xyz_max_hmi_server
repos\xyz_max_hmi_server\schemas\error_records.py
from datetime import datetime from typing import List, Optional, Union from fastapi_filter.contrib.sqlalchemy import Filter from pydantic import BaseModel, Field from xyz_max_hmi_server import enums from xyz_max_hmi_server.entity.task import LiteTask from xyz_max_hmi_server.models.error_records import ErrorRecordsMod...
0
xyz_max_hmi_server
repos\xyz_max_hmi_server\schemas\order.py
import importlib import re from typing import Optional from pydantic import BaseModel, validator from xyz_max_hmi_server import enums class OrderBase(BaseModel): """订单基础模型""" order_id: Optional[str] = None order_status: Optional[enums.OrderStatus] = None order_type: Optional[enums.OrderType] = None...
0
xyz_max_hmi_server
repos\xyz_max_hmi_server\schemas\order_result.py
from datetime import datetime from typing import List, Optional from fastapi_filter.contrib.sqlalchemy import Filter from pydantic import BaseModel, Field from xyz_max_hmi_server import enums from xyz_max_hmi_server.models.order_result import OrderResultModel class OrderResultBase(BaseModel): order_id: Optional...
0
xyz_max_hmi_server
repos\xyz_max_hmi_server\schemas\pallet.py
from typing import Optional from pydantic import BaseModel class PalletBase(BaseModel): pallet_id: str workspace_id: str pickable_quantity: int placeable_quantity: int class PalletCreate(PalletBase): pass class PalletUpdate(PalletBase): pass class PalletInDBBase(PalletBase): id: int...
0
xyz_max_hmi_server
repos\xyz_max_hmi_server\schemas\pipe.py
from enum import Enum from typing import Any, List, Optional, TypeVar, Union from google.protobuf.json_format import MessageToDict from google.protobuf.message import Message from pydantic import BaseModel, Field, validator class EventEnum(Enum): SUBSCRIBE = "subscribe" UNSUBSCRIBE = "unsubscribe" LIST_T...
0
xyz_max_hmi_server
repos\xyz_max_hmi_server\schemas\plc.py
from pydantic import BaseModel class LightSchema(BaseModel): red: bool = False yellow: bool = False green: bool = False class Config: schema_extra = { "required": ["red", "yellow", "green"], "example": { "red": True, "yellow": False, ...
0
xyz_max_hmi_server
repos\xyz_max_hmi_server\schemas\robot.py
from pydantic import BaseModel from xyz_max_hmi_server import enums class ControlRobotSchema(BaseModel): """控制机器人""" action: enums.RobotControl class Config: schema_extra = { "required": ["action"], "example": { "action": "start", }, }...
0
xyz_max_hmi_server
repos\xyz_max_hmi_server\schemas\task.py
import importlib import re from datetime import datetime from typing import Optional from pydantic import BaseModel, Field, validator from xyz_max_hmi_server import enums class TaskBase(BaseModel): """任务基础模型""" task_id: Optional[str] = None order_id: Optional[str] = None task_status: Optional[enums...
0
xyz_max_hmi_server
repos\xyz_max_hmi_server\schemas\task_batch.py
from datetime import datetime from pydantic import BaseModel class TaskBatchBase(BaseModel): batch_id: str task_id: str class TaskBatchCreate(TaskBatchBase): pass class TaskBatchUpdate(TaskBatchBase): pass class TaskBatchInDBBase(TaskBatchBase): id: int create_time: datetime update_...
0
xyz_max_hmi_server
repos\xyz_max_hmi_server\schemas\task_result.py
from datetime import datetime from typing import List, Optional from fastapi_filter.contrib.sqlalchemy import Filter from pydantic import BaseModel, Field from xyz_max_hmi_server import enums from xyz_max_hmi_server.entity.sku import SKUInfo from xyz_max_hmi_server.models.task_result import TaskResultModel class Ta...
0
xyz_max_hmi_server
repos\xyz_max_hmi_server\schemas\workspace.py
from typing import Any, Optional from pydantic import BaseModel class WorkspaceBase(BaseModel): """工作空间基础模型""" ws_id: Optional[str] = None current_pallet_id: Optional[str] = None is_ready: Optional[bool] = None is_new_pallet: Optional[bool] = None class WorkspaceCreate(WorkspaceBase): """工...
0
xyz_max_hmi_server
repos\xyz_max_hmi_server\services\arrival_sequence.py
"""Arrival Sequence Service""" from typing import List, Optional, cast from sqlalchemy.orm.session import Session from xyz_max_hmi_server import crud from xyz_max_hmi_server.db.session import NEW_SESSION, provide_session from xyz_max_hmi_server.schemas.arrival_sequence import ( ArrivalSequence, ArrivalSequenc...
0
xyz_max_hmi_server
repos\xyz_max_hmi_server\services\__init__.py
from .arrival_sequence import arrival_sequence __all__ = ["arrival_sequence"]
0
xyz_max_hmi_server
repos\xyz_max_hmi_server\signals\pipe.py
import os import blinker from fastapi.encoders import jsonable_encoder from fastapi.websockets import WebSocket from google.protobuf.message import Message from loguru import logger from xyz_max_hmi_server import enums from xyz_max_hmi_server.modules.cyber.msg_handler import MessageHandler from xyz_max_hmi_server.mod...
0
xyz_max_hmi_server
repos\xyz_max_hmi_server\signals\system_status.py
from blinker import signal from loguru import logger system_stop = signal("system_stop") system_running = signal("system_running") system_error = signal("system_error") @system_stop.connect def system_stop_callback(sender, **kwargs): logger.debug("系统停止信号被触发") @system_running.connect def system_running_callback...
0
xyz_max_hmi_server
repos\xyz_max_hmi_server\signals\taskflow.py
import typing as t import blinker from loguru import logger from xyz_max_hmi_server import crud, enums, services from xyz_max_hmi_server.db.session import NEW_SESSION from xyz_max_hmi_server.exceptions import XYZException from xyz_max_hmi_server.globals import system_status if t.TYPE_CHECKING: from xyz_max_hmi_s...
0
xyz_max_hmi_server
repos\xyz_max_hmi_server\signals\vp.py
"""VP 相关的信号""" from blinker import signal from xyz_max_hmi_server.utils.vp import vp_utils vp_run = signal("vp_run") vp_stop = signal("vp_stop") vp_pause = signal("vp_pause") vp_status_changed = signal("vp_status_changed") @vp_run.connect def vp_start_callback(sender, **kwargs): # noqa: D103 from xyz_max_hmi_s...
0
xyz_max_hmi_server
repos\xyz_max_hmi_server\signals\__init__.py
from .system_status import system_error, system_running, system_stop from .taskflow import ( order_abort, order_add_task, order_done, order_ended, order_start, task_abort, task_done, task_ended, task_pick, task_ready, task_reset, task_start, ) from .vp import vp_pause, vp...
0
xyz_max_hmi_server
repos\xyz_max_hmi_server\templates\common\babel.cfg
[python: **.py]
0
xyz_max_hmi_server
repos\xyz_max_hmi_server\templates\common\manage.py
"""Adaptor 开发脚手架.""" import os import re import sys from pathlib import Path from typing import Optional # 判断当前系统是否为 Windows IS_WINDOWS = os.name == "nt" unicode_pattern = re.compile(r"(?!\\u[0-9a-fA-F]{4})\\u([0-9a-fA-F]{2})") def read_hkey( key: str, path: str = r"Software\XYZ Robotics\xyz_studio_max" ) -> Opt...
0
xyz_max_hmi_server
repos\xyz_max_hmi_server\templates\common\.vscode\launch.json
{ "version": "0.2.0", "configurations": [ { "name": "Python: Run", "type": "python", "request": "launch", "program": "${workspaceFolder}/manage.py", "args" : ["run"] }, { "name": "Python: Run(HotSwap)", "...
0
xyz_max_hmi_server
repos\xyz_max_hmi_server\templates\common\.vscode\settings.json
{ "python.defaultInterpreterPath": "{{ python_interpreter_path }}", "python.analysis.extraPaths": [ "{{ studio_max_install_path }}/lib/python/dist-packages/", "{{ studio_max_install_path }}/lib/python/dist-packages/xyz_max_hmi_server/third_party_packages" ], "python.autoComplete.extraPaths": [], "term...
0
xyz_max_hmi_server
repos\xyz_max_hmi_server\templates\common\translations\messages.pot
# Translations template for PROJECT. # Copyright (C) 2024 ORGANIZATION # This file is distributed under the same license as the PROJECT project. # FIRST AUTHOR <EMAIL@ADDRESS>, 2024. # #, fuzzy msgid "" msgstr "" "Project-Id-Version: PROJECT VERSION\n" "Report-Msgid-Bugs-To: EMAIL@ADDRESS\n" "POT-Creation-Date: 2024-01...
0
xyz_max_hmi_server
repos\xyz_max_hmi_server\templates\common\translations\lang\de\LC_MESSAGES\messages.po
# German translations for PROJECT. # Copyright (C) 2023 ORGANIZATION # This file is distributed under the same license as the PROJECT project. # FIRST AUTHOR <EMAIL@ADDRESS>, 2023. # msgid "" msgstr "" "Project-Id-Version: PROJECT VERSION\n" "Report-Msgid-Bugs-To: EMAIL@ADDRESS\n" "POT-Creation-Date: 2024-01-05 10:30+0...
0
xyz_max_hmi_server
repos\xyz_max_hmi_server\templates\common\translations\lang\en\LC_MESSAGES\messages.po
# English translations for PROJECT. # Copyright (C) 2023 ORGANIZATION # This file is distributed under the same license as the PROJECT project. # FIRST AUTHOR <EMAIL@ADDRESS>, 2023. # msgid "" msgstr "" "Project-Id-Version: PROJECT VERSION\n" "Report-Msgid-Bugs-To: EMAIL@ADDRESS\n" "POT-Creation-Date: 2024-01-05 10:30+...
0
xyz_max_hmi_server
repos\xyz_max_hmi_server\templates\common\translations\lang\ja\LC_MESSAGES\messages.po
# Japanese translations for PROJECT. # Copyright (C) 2023 ORGANIZATION # This file is distributed under the same license as the PROJECT project. # FIRST AUTHOR <EMAIL@ADDRESS>, 2023. # msgid "" msgstr "" "Project-Id-Version: PROJECT VERSION\n" "Report-Msgid-Bugs-To: EMAIL@ADDRESS\n" "POT-Creation-Date: 2024-01-05 10:30...
0
xyz_max_hmi_server
repos\xyz_max_hmi_server\templates\common\translations\lang\ko\LC_MESSAGES\messages.po
# Korean translations for PROJECT. # Copyright (C) 2023 ORGANIZATION # This file is distributed under the same license as the PROJECT project. # FIRST AUTHOR <EMAIL@ADDRESS>, 2023. # msgid "" msgstr "" "Project-Id-Version: PROJECT VERSION\n" "Report-Msgid-Bugs-To: EMAIL@ADDRESS\n" "POT-Creation-Date: 2024-01-05 10:30+0...
0