Skip to content

Python 3.9 type hints - #2

Open
El-Naizin wants to merge 1 commit into
leixingyu:masterfrom
El-Naizin:master
Open

Python 3.9 type hints#2
El-Naizin wants to merge 1 commit into
leixingyu:masterfrom
El-Naizin:master

Conversation

@El-Naizin

Copy link
Copy Markdown

Hello, I came across this repository, which was very useful to me, so thank you for the code 😄

  • I noticed there were no python 3.9 type hints, which help me code, especially for the unreal types. (vscode does not understand the comment style type hints).

  • I removed the inheritance from (object) in classes, which were used in python 2 but are not needed in python 3.

  • I applied the black formatter, but I can remove that if you prefer to only have the type hints and nothing else.

Other considerations that could be useful, but would need a bit of code change so I didn't include it yet (I can if you want it):

from enum import Enum

class RenderStatus(Enum):
    """
    Enum class to represent render job status
    """

    UNASSIGNED = "un-assigned"
    READY_TO_START= "ready to start"
    IN_PROGRESS= "in progress"
    FINISHED = "finished"
    ERRORED = "errored"
    CANCELLED = "cancelled"
    PAUSED = "paused"
  • For the RenderRequest class, you could use a dataclass
from dataclasses import dataclass
class RenderRequest(dataclass):
    """
    An object representing request for an Unreal render job sent from a
    machine to the request manager (renderManager.py)
    """
    uid: str
    """unique identifier, server as primary key for database"""
    name: str
    """job name"""
    owner: str
    """the name of the submitter"""
    worker: str
    """the name of the worker to render the job"""
etc...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant