Answered step by step
Verified Expert Solution
Question
1 Approved Answer
code scaffold: from _ _ future _ _ import annotations from dataclasses import dataclass from computer import Computer from typing import TYPE _ CHECKING, Union
code scaffold: from future import annotations from dataclasses import dataclass from computer import Computer from typing import TYPECHECKING, Union # Avoid circular imports for typing. if TYPECHECKING: from virus import VirusType @dataclass class RouteSplit: A split in the route. top following bottom top: Route bottom: Route following: Route def removebranchself RouteStore: Removes the branch, should just leave the remaining following route.""" raise NotImplementedError @dataclass class RouteSeries: A computer, followed by the rest of the route computerfollowing computer: Computer following: Route def removecomputerself RouteStore: Returns a route store which would be the result of: Removing the computer at the beginning of this series. raise NotImplementedError def addcomputerbeforeself computer: Computer RouteStore: Returns a route store which would be the result of: Adding a computer in series before the current one. raise NotImplementedError def addcomputerafterself computer: Computer RouteStore: Returns a route store which would be the result of: Adding a computer after the current computer, but before the following route. raise NotImplementedError def addemptybranchbeforeself RouteStore: Returns a route store which would be the result of: Adding an empty branch, where the current routestore is now the following path. raise NotImplementedError def addemptybranchafterself RouteStore: Returns a route store which would be the result of: Adding an empty branch after the current computer, but before the following route. raise NotImplementedError RouteStore UnionRouteSplit RouteSeries, None @dataclass class Route: store: RouteStore None def addcomputerbeforeself computer: Computer Route: Returns a new route which would be the result of: Adding a computer before everything currently in the route. raise NotImplementedError def addemptybranchbeforeself Route: Returns a new route which would be the result of: Adding an empty branch before everything currently in the route. raise NotImplementedError def followpathself virustype: VirusType None: Follow a path and add computers according to a virustype.""" raise NotImplementedError def addallcomputersself listComputer: Returns a list of all computers on the route.""" raise NotImplementedError
code scaffold:
from future import annotations
from dataclasses import dataclass
from computer import Computer
from typing import TYPECHECKING, Union
# Avoid circular imports for typing.
if TYPECHECKING:
from virus import VirusType
@dataclass
class RouteSplit:
A split in the route.
top
following
bottom
top: Route
bottom: Route
following: Route
def removebranchself RouteStore:
Removes the branch, should just leave the remaining following route."""
raise NotImplementedError
@dataclass
class RouteSeries:
A computer, followed by the rest of the route
computerfollowing
computer: Computer
following: Route
def removecomputerself RouteStore:
Returns a route store which would be the result of:
Removing the computer at the beginning of this series.
raise NotImplementedError
def addcomputerbeforeself computer: Computer RouteStore:
Returns a route store which would be the result of:
Adding a computer in series before the current one.
raise NotImplementedError
def addcomputerafterself computer: Computer RouteStore:
Returns a route store which would be the result of:
Adding a computer after the current computer, but before the following route.
raise NotImplementedError
def addemptybranchbeforeself RouteStore:
Returns a route store which would be the result of:
Adding an empty branch, where the current routestore is now the following path.
raise NotImplementedError
def addemptybranchafterself RouteStore:
Returns a route store which would be the result of:
Adding an empty branch after the current computer, but before the following route.
raise NotImplementedError
RouteStore UnionRouteSplit RouteSeries, None
@dataclass
class Route:
store: RouteStore None
def addcomputerbeforeself computer: Computer Route:
Returns a new route which would be the result of:
Adding a computer before everything currently in the route.
raise NotImplementedError
def addemptybranchbeforeself Route:
Returns a new route which would be the result of:
Adding an empty branch before everything currently in the route.
raise NotImplementedError
def followpathself virustype: VirusType None:
Follow a path and add computers according to a virustype."""
raise NotImplementedError
def addallcomputersself listComputer:
Returns a list of all computers on the route."""
raise NotImplementedError
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access with AI-Powered Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started