District¶
District¶
District
defines a district and and the precincts it contains.
-
class
distopia.district.
District
(**kwargs)[source]¶ Describes a district, its precincts and its metrics.
-
add_precinct
(precinct)[source]¶ Adds a precinct to the district.
- Parameters
precinct –
Precinct
instance.
-
assign_precincts
(precincts)[source]¶ Adds the precincts to the district.
- Parameters
precincts – Iterable of
Precinct
instances.
-
boundary
= []¶ A list of the
x
,y
coordinates of the polygon that describes the district’s boundary.
-
identity
= 0¶ The id of the district.
-
metrics
= {}¶ A mapping from
name
to theDistrictMetric
instance that contains the summery metric data for this district.
-
name
= ''¶ A globally unique name (or number) describing the district.
-
District Metrics¶
Defines metrics that summarize the district based on the contained precincts and other metadata.
-
class
distopia.district.metrics.
DistrictMetric
(name, **kwargs)[source]¶ Metrics used with
distopia.district.District
.-
name
= ''¶ A globally unique metric name that describes the metric.
-