Skip to content

Commit

Permalink
adapt to new xRegistry format
Browse files Browse the repository at this point in the history
Signed-off-by: Clemens Vasters <[email protected]>
  • Loading branch information
clemensv committed Oct 18, 2024
1 parent e11256a commit bb2ecf3
Show file tree
Hide file tree
Showing 117 changed files with 1,742 additions and 1,834 deletions.
24 changes: 12 additions & 12 deletions gtfs/gtfs_rt_producer/README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@

# Gtfs_rt_producer Apache Kafka Consumer SDK for Python
# Gtfs_rt_producer Apache Kafka Producer SDK for Python

This is the Gtfs_rt_producer Apache Kafka Consumer SDK for Python. It was
generated from the xRegistry CLI tool based on message catalog definitions for
This is the Gtfs_rt_producer Apache Kafka Producer SDK for Python. It was
generated from the xRegistry CLI tool based on message catalog messages for
"GeneralTransitFeedRealTime", "GeneralTransitFeedStatic".

## Quick Install
Expand All @@ -13,21 +13,21 @@ script (or `install.bat` on Windows) in the root of the repository.
### Contents

The repository contains two projects.
* The `gtfs_rt_producer_kafka_consumer` project is the main project that
contains the Kafka consumer client code.
* The `gtfs_rt_producer_kafka_producer` project is the main project that
contains the Kafka producer client code.
* The `gtfs_rt_producer_data` project contains the data classes for the event
payload data.

The classes defined in `gtfs_rt_producer_kafka_consumer` are documented in the
project [README](./gtfs_rt_producer_kafka_consumer/README.md).
The classes defined in `gtfs_rt_producer_kafka_producer` are documented in the
project [README](./gtfs_rt_producer_kafka_producer/README.md).

The `gtfs_rt_producer_kafka_consumer` project depends on the
The `gtfs_rt_producer_kafka_producer` project depends on the
`gtfs_rt_producer_data` project.

If you want to install the consumer project, you can run the following command:
If you want to install the producer project, you can run the following command:

```bash
pip install ./gtfs_rt_producer_kafka_consumer
pip install ./gtfs_rt_producer_kafka_producer
```

This will install both packages. If you only want to install the data project,
Expand Down Expand Up @@ -59,7 +59,7 @@ pytest ./gtfs_rt_producer_kafka_producer/tests ./gtfs_rt_producer_data/tests
## Usage

The sample code in [samples/sample.py](samples/sample.py) demonstrates how to
use the Kafka consumer client to receive messages from a Kafka topic.
use the Kafka producer client to receive messages from a Kafka topic.

In your code, you create handler functions for each message type that you want
to process. The handler functions are called when a message of that type is
Expand Down Expand Up @@ -94,7 +94,7 @@ hand them to the dispatcher for processing.

The required parameters for the `create` method are:
* `bootstrap_servers`: The Kafka bootstrap servers.
* `group_id`: The consumer group ID.
* `group_id`: The producer group ID.
* `topics`: The list of topics to subscribe to.

The example below shows how to create an event processor and then wait for a
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from .generaltransitfeedstatic import bookingrules, fareproducts, locationtype, wheelchairboarding, stops, pathways, serviceavailability, calendar, exceptiontype, calendardates, timeframes, stopareas, fareattributes, locationgroups, pickuptype, dropofftype, continuouspickup, continuousdropoff, timepoint, stoptimes, faremedia, faretransferrules, locationgeojson, transfers, levels, frequencies, directionid, wheelchairaccessible, bikesallowed, trips, farelegrules, attributions, routenetworks, shapes, agency, locationgroupstores, areas, routetype, routes, networks, farerules, translations, feedinfo
from .generaltransitfeedrealtime import trip, alert, vehicle
from .generaltransitfeedstatic import serviceavailability, calendar, exceptiontype, calendardates, timeframes, networks, translations, areas, pathways, routenetworks, bookingrules, faretransferrules, routetype, continuouspickup, continuousdropoff, routes, feedinfo, frequencies, locationgeojson, locationgroups, directionid, wheelchairaccessible, bikesallowed, trips, fareattributes, farerules, agency, locationtype, wheelchairboarding, stops, stopareas, levels, transfers, faremedia, fareproducts, locationgroupstores, pickuptype, dropofftype, timepoint, stoptimes, shapes, attributions, farelegrules
from .generaltransitfeedrealtime import alert, vehicle, trip

__all__ = ["bookingrules", "fareproducts", "locationtype", "wheelchairboarding", "stops", "pathways", "serviceavailability", "calendar", "exceptiontype", "calendardates", "timeframes", "stopareas", "fareattributes", "locationgroups", "pickuptype", "dropofftype", "continuouspickup", "continuousdropoff", "timepoint", "stoptimes", "faremedia", "faretransferrules", "locationgeojson", "transfers", "levels", "frequencies", "directionid", "wheelchairaccessible", "bikesallowed", "trips", "farelegrules", "attributions", "routenetworks", "shapes", "agency", "locationgroupstores", "areas", "routetype", "routes", "networks", "farerules", "translations", "feedinfo", "trip", "alert", "vehicle"]
__all__ = ["serviceavailability", "calendar", "exceptiontype", "calendardates", "timeframes", "networks", "translations", "areas", "pathways", "routenetworks", "bookingrules", "faretransferrules", "routetype", "continuouspickup", "continuousdropoff", "routes", "feedinfo", "frequencies", "locationgeojson", "locationgroups", "directionid", "wheelchairaccessible", "bikesallowed", "trips", "fareattributes", "farerules", "agency", "locationtype", "wheelchairboarding", "stops", "stopareas", "levels", "transfers", "faremedia", "fareproducts", "locationgroupstores", "pickuptype", "dropofftype", "timepoint", "stoptimes", "shapes", "attributions", "farelegrules", "alert", "vehicle", "trip"]
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from .trip import tripdescriptor_types, tripdescriptor, vehicledescriptor, tripupdate_types, tripupdate
from .alert import timerange, tripdescriptor_types, tripdescriptor, entityselector, alert_types, translatedstring_types, translatedstring, alert
from .vehicle import tripdescriptor_types, tripdescriptor, vehicledescriptor, position, vehicleposition_types, vehicleposition
from .trip import tripdescriptor_types, tripdescriptor, vehicledescriptor, tripupdate_types, tripupdate

__all__ = ["tripdescriptor_types", "tripdescriptor", "vehicledescriptor", "tripupdate_types", "tripupdate", "timerange", "tripdescriptor_types", "tripdescriptor", "entityselector", "alert_types", "translatedstring_types", "translatedstring", "alert", "tripdescriptor_types", "tripdescriptor", "vehicledescriptor", "position", "vehicleposition_types", "vehicleposition"]
__all__ = ["timerange", "tripdescriptor_types", "tripdescriptor", "entityselector", "alert_types", "translatedstring_types", "translatedstring", "alert", "tripdescriptor_types", "tripdescriptor", "vehicledescriptor", "position", "vehicleposition_types", "vehicleposition", "tripdescriptor_types", "tripdescriptor", "vehicledescriptor", "tripupdate_types", "tripupdate"]
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@
import dataclasses_json
import json
from gtfs_rt_producer_data.generaltransitfeedrealtime.alert.alert_types.cause import Cause
from gtfs_rt_producer_data.generaltransitfeedrealtime.alert.alert_types.effect import Effect
from gtfs_rt_producer_data.generaltransitfeedrealtime.alert.timerange import TimeRange
from gtfs_rt_producer_data.generaltransitfeedrealtime.alert.entityselector import EntitySelector
from gtfs_rt_producer_data.generaltransitfeedrealtime.alert.timerange import TimeRange
from gtfs_rt_producer_data.generaltransitfeedrealtime.alert.translatedstring import TranslatedString
from gtfs_rt_producer_data.generaltransitfeedrealtime.alert.alert_types.effect import Effect


@dataclasses_json.dataclass_json
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
import dataclasses_json
import json
from gtfs_rt_producer_data.generaltransitfeedrealtime.trip.tripdescriptor import TripDescriptor
from gtfs_rt_producer_data.generaltransitfeedrealtime.trip.tripupdate_types.stoptimeupdate import StopTimeUpdate
from gtfs_rt_producer_data.generaltransitfeedrealtime.trip.vehicledescriptor import VehicleDescriptor
from gtfs_rt_producer_data.generaltransitfeedrealtime.trip.tripupdate_types.stoptimeupdate import StopTimeUpdate


@dataclasses_json.dataclass_json
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@
import dataclasses
import dataclasses_json
import json
from gtfs_rt_producer_data.generaltransitfeedrealtime.vehicle.vehicleposition_types.congestionlevel import CongestionLevel
from gtfs_rt_producer_data.generaltransitfeedrealtime.vehicle.vehicledescriptor import VehicleDescriptor
from gtfs_rt_producer_data.generaltransitfeedrealtime.vehicle.tripdescriptor import TripDescriptor
from gtfs_rt_producer_data.generaltransitfeedrealtime.vehicle.vehicleposition_types.occupancystatus import OccupancyStatus
from gtfs_rt_producer_data.generaltransitfeedrealtime.vehicle.vehicledescriptor import VehicleDescriptor
from gtfs_rt_producer_data.generaltransitfeedrealtime.vehicle.vehicleposition_types.vehiclestopstatus import VehicleStopStatus
from gtfs_rt_producer_data.generaltransitfeedrealtime.vehicle.position import Position
from gtfs_rt_producer_data.generaltransitfeedrealtime.vehicle.vehicleposition_types.occupancystatus import OccupancyStatus
from gtfs_rt_producer_data.generaltransitfeedrealtime.vehicle.vehicleposition_types.congestionlevel import CongestionLevel


@dataclasses_json.dataclass_json
Expand Down
Original file line number Diff line number Diff line change
@@ -1,45 +1,45 @@
from .bookingrules import BookingRules
from .fareproducts import FareProducts
from .locationtype import LocationType
from .wheelchairboarding import WheelchairBoarding
from .stops import Stops
from .pathways import Pathways
from .serviceavailability import ServiceAvailability
from .calendar import Calendar
from .exceptiontype import ExceptionType
from .calendardates import CalendarDates
from .timeframes import Timeframes
from .stopareas import StopAreas
from .fareattributes import FareAttributes
from .locationgroups import LocationGroups
from .pickuptype import PickupType
from .dropofftype import DropOffType
from .networks import Networks
from .translations import Translations
from .areas import Areas
from .pathways import Pathways
from .routenetworks import RouteNetworks
from .bookingrules import BookingRules
from .faretransferrules import FareTransferRules
from .routetype import RouteType
from .continuouspickup import ContinuousPickup
from .continuousdropoff import ContinuousDropOff
from .timepoint import Timepoint
from .stoptimes import StopTimes
from .faremedia import FareMedia
from .faretransferrules import FareTransferRules
from .locationgeojson import LocationGeoJson
from .transfers import Transfers
from .levels import Levels
from .routes import Routes
from .feedinfo import FeedInfo
from .frequencies import Frequencies
from .locationgeojson import LocationGeoJson
from .locationgroups import LocationGroups
from .directionid import DirectionId
from .wheelchairaccessible import WheelchairAccessible
from .bikesallowed import BikesAllowed
from .trips import Trips
from .farelegrules import FareLegRules
from .attributions import Attributions
from .routenetworks import RouteNetworks
from .shapes import Shapes
from .fareattributes import FareAttributes
from .farerules import FareRules
from .agency import Agency
from .locationtype import LocationType
from .wheelchairboarding import WheelchairBoarding
from .stops import Stops
from .stopareas import StopAreas
from .levels import Levels
from .transfers import Transfers
from .faremedia import FareMedia
from .fareproducts import FareProducts
from .locationgroupstores import LocationGroupStores
from .areas import Areas
from .routetype import RouteType
from .routes import Routes
from .networks import Networks
from .farerules import FareRules
from .translations import Translations
from .feedinfo import FeedInfo
from .pickuptype import PickupType
from .dropofftype import DropOffType
from .timepoint import Timepoint
from .stoptimes import StopTimes
from .shapes import Shapes
from .attributions import Attributions
from .farelegrules import FareLegRules

__all__ = ["BookingRules", "FareProducts", "LocationType", "WheelchairBoarding", "Stops", "Pathways", "ServiceAvailability", "Calendar", "ExceptionType", "CalendarDates", "Timeframes", "StopAreas", "FareAttributes", "LocationGroups", "PickupType", "DropOffType", "ContinuousPickup", "ContinuousDropOff", "Timepoint", "StopTimes", "FareMedia", "FareTransferRules", "LocationGeoJson", "Transfers", "Levels", "Frequencies", "DirectionId", "WheelchairAccessible", "BikesAllowed", "Trips", "FareLegRules", "Attributions", "RouteNetworks", "Shapes", "Agency", "LocationGroupStores", "Areas", "RouteType", "Routes", "Networks", "FareRules", "Translations", "FeedInfo"]
__all__ = ["ServiceAvailability", "Calendar", "ExceptionType", "CalendarDates", "Timeframes", "Networks", "Translations", "Areas", "Pathways", "RouteNetworks", "BookingRules", "FareTransferRules", "RouteType", "ContinuousPickup", "ContinuousDropOff", "Routes", "FeedInfo", "Frequencies", "LocationGeoJson", "LocationGroups", "DirectionId", "WheelchairAccessible", "BikesAllowed", "Trips", "FareAttributes", "FareRules", "Agency", "LocationType", "WheelchairBoarding", "Stops", "StopAreas", "Levels", "Transfers", "FareMedia", "FareProducts", "LocationGroupStores", "PickupType", "DropOffType", "Timepoint", "StopTimes", "Shapes", "Attributions", "FareLegRules"]
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
import dataclasses_json
import json
from gtfs_rt_producer_data.generaltransitfeedstatic.continuousdropoff import ContinuousDropOff
from gtfs_rt_producer_data.generaltransitfeedstatic.routetype import RouteType
from gtfs_rt_producer_data.generaltransitfeedstatic.continuouspickup import ContinuousPickup
from gtfs_rt_producer_data.generaltransitfeedstatic.routetype import RouteType


@dataclasses_json.dataclass_json
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@
import dataclasses
import dataclasses_json
import json
from gtfs_rt_producer_data.generaltransitfeedstatic.timepoint import Timepoint
from gtfs_rt_producer_data.generaltransitfeedstatic.pickuptype import PickupType
from gtfs_rt_producer_data.generaltransitfeedstatic.continuousdropoff import ContinuousDropOff
from gtfs_rt_producer_data.generaltransitfeedstatic.dropofftype import DropOffType
from gtfs_rt_producer_data.generaltransitfeedstatic.continuouspickup import ContinuousPickup
from gtfs_rt_producer_data.generaltransitfeedstatic.dropofftype import DropOffType
from gtfs_rt_producer_data.generaltransitfeedstatic.pickuptype import PickupType
from gtfs_rt_producer_data.generaltransitfeedstatic.timepoint import Timepoint


@dataclasses_json.dataclass_json
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
import dataclasses
import dataclasses_json
import json
from gtfs_rt_producer_data.generaltransitfeedstatic.calendar import Calendar
from gtfs_rt_producer_data.generaltransitfeedstatic.calendardates import CalendarDates
from gtfs_rt_producer_data.generaltransitfeedstatic.calendar import Calendar


@dataclasses_json.dataclass_json
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@
import dataclasses
import dataclasses_json
import json
from gtfs_rt_producer_data.generaltransitfeedstatic.wheelchairaccessible import WheelchairAccessible
from gtfs_rt_producer_data.generaltransitfeedstatic.calendardates import CalendarDates
from gtfs_rt_producer_data.generaltransitfeedstatic.calendar import Calendar
from gtfs_rt_producer_data.generaltransitfeedstatic.wheelchairaccessible import WheelchairAccessible
from gtfs_rt_producer_data.generaltransitfeedstatic.directionid import DirectionId
from gtfs_rt_producer_data.generaltransitfeedstatic.bikesallowed import BikesAllowed
from gtfs_rt_producer_data.generaltransitfeedstatic.calendardates import CalendarDates


@dataclasses_json.dataclass_json
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@

from gtfs_rt_producer_data.generaltransitfeedrealtime.alert.alert import Alert
from test_gtfs_rt_producer_data_generaltransitfeedrealtime_alert_alert_types_cause import Test_Cause
from test_gtfs_rt_producer_data_generaltransitfeedrealtime_alert_alert_types_effect import Test_Effect
from test_gtfs_rt_producer_data_generaltransitfeedrealtime_alert_timerange import Test_TimeRange
from test_gtfs_rt_producer_data_generaltransitfeedrealtime_alert_entityselector import Test_EntitySelector
from test_gtfs_rt_producer_data_generaltransitfeedrealtime_alert_timerange import Test_TimeRange
from test_gtfs_rt_producer_data_generaltransitfeedrealtime_alert_translatedstring import Test_TranslatedString
from test_gtfs_rt_producer_data_generaltransitfeedrealtime_alert_alert_types_effect import Test_Effect


class Test_Alert(unittest.TestCase):
Expand All @@ -33,8 +33,8 @@ def create_instance():
Create instance of Alert for testing
"""
instance = Alert(
active_period=[Test_TimeRange.create_instance(), Test_TimeRange.create_instance()],
informed_entity=[Test_EntitySelector.create_instance(), Test_EntitySelector.create_instance()],
active_period=[Test_TimeRange.create_instance()],
informed_entity=[Test_EntitySelector.create_instance(), Test_EntitySelector.create_instance(), Test_EntitySelector.create_instance(), Test_EntitySelector.create_instance()],
cause=Test_Cause.create_instance(),
effect=Test_Effect.create_instance(),
url=Test_TranslatedString.create_instance(),
Expand All @@ -48,15 +48,15 @@ def test_active_period_property(self):
"""
Test active_period property
"""
test_value = [Test_TimeRange.create_instance(), Test_TimeRange.create_instance()]
test_value = [Test_TimeRange.create_instance()]
self.instance.active_period = test_value
self.assertEqual(self.instance.active_period, test_value)

def test_informed_entity_property(self):
"""
Test informed_entity property
"""
test_value = [Test_EntitySelector.create_instance(), Test_EntitySelector.create_instance()]
test_value = [Test_EntitySelector.create_instance(), Test_EntitySelector.create_instance(), Test_EntitySelector.create_instance(), Test_EntitySelector.create_instance()]
self.instance.informed_entity = test_value
self.assertEqual(self.instance.informed_entity, test_value)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,11 @@ def create_instance():
Create instance of EntitySelector for testing
"""
instance = EntitySelector(
agency_id='gxcnksmgblqlynmibyyf',
route_id='pjhgaszrnyggundlzldl',
route_type=int(81),
agency_id='fucoxkmeebkdfscihkkc',
route_id='moddjmnxssievxculgny',
route_type=int(42),
trip=Test_TripDescriptor.create_instance(),
stop_id='ivuadfbbmpwgjzbxoavh'
stop_id='oatrnfpdcbjgzyitovap'
)
return instance

Expand All @@ -42,23 +42,23 @@ def test_agency_id_property(self):
"""
Test agency_id property
"""
test_value = 'gxcnksmgblqlynmibyyf'
test_value = 'fucoxkmeebkdfscihkkc'
self.instance.agency_id = test_value
self.assertEqual(self.instance.agency_id, test_value)

def test_route_id_property(self):
"""
Test route_id property
"""
test_value = 'pjhgaszrnyggundlzldl'
test_value = 'moddjmnxssievxculgny'
self.instance.route_id = test_value
self.assertEqual(self.instance.route_id, test_value)

def test_route_type_property(self):
"""
Test route_type property
"""
test_value = int(81)
test_value = int(42)
self.instance.route_type = test_value
self.assertEqual(self.instance.route_type, test_value)

Expand All @@ -74,7 +74,7 @@ def test_stop_id_property(self):
"""
Test stop_id property
"""
test_value = 'ivuadfbbmpwgjzbxoavh'
test_value = 'oatrnfpdcbjgzyitovap'
self.instance.stop_id = test_value
self.assertEqual(self.instance.stop_id, test_value)

Loading

0 comments on commit bb2ecf3

Please sign in to comment.