summaryrefslogtreecommitdiff
path: root/src/buildstream/_scheduler
diff options
context:
space:
mode:
authorChandan Singh <chandan@chandansingh.net>2019-06-30 02:43:56 +0100
committerChandan Singh <chandan@chandansingh.net>2019-09-02 21:56:34 +0100
commit419a3afbe6e774c9182001977874c8ea08a9f49d (patch)
tree18d3c0f24179ae843caa76db46d4c38478e81dd7 /src/buildstream/_scheduler
parent3641578dcac7bd514f8e074835841f381a36c877 (diff)
downloadbuildstream-419a3afbe6e774c9182001977874c8ea08a9f49d.tar.gz
Add initial mypy configuration and types
As a first step, add type hints to variables whose type `mypy` cannot infer automatically. This is the minimal set of type hints that allow running `mypy` without any arguments, and having it not fail. We currently ignore C extensions that mypy can't process directly. Later, we can look into generating stubs for such modules (potentially automatically).
Diffstat (limited to 'src/buildstream/_scheduler')
-rw-r--r--src/buildstream/_scheduler/queues/queue.py11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/buildstream/_scheduler/queues/queue.py b/src/buildstream/_scheduler/queues/queue.py
index 8c81ce21d..745b59417 100644
--- a/src/buildstream/_scheduler/queues/queue.py
+++ b/src/buildstream/_scheduler/queues/queue.py
@@ -23,6 +23,7 @@ import os
from collections import deque
import heapq
import traceback
+from typing import TYPE_CHECKING
# Local imports
from ..jobs import ElementJob, JobStatus
@@ -33,6 +34,9 @@ from ..._exceptions import BstError, ImplError, set_last_task_error
from ..._message import Message, MessageType
from ...types import FastEnum
+if TYPE_CHECKING:
+ from typing import List, Optional
+
# Queue status for a given element
#
@@ -56,9 +60,10 @@ class QueueStatus(FastEnum):
class Queue():
# These should be overridden on class data of of concrete Queue implementations
- action_name = None
- complete_name = None
- resources = [] # Resources this queues' jobs want
+ action_name = None # type: Optional[str]
+ complete_name = None # type: Optional[str]
+ # Resources this queues' jobs want
+ resources = [] # type: List[int]
def __init__(self, scheduler):