Skip to content

Commit

Permalink
add: documentation for the library, chore: modified email
Browse files Browse the repository at this point in the history
  • Loading branch information
vijay-jaisankar committed Apr 24, 2022
1 parent 351f262 commit f887261
Show file tree
Hide file tree
Showing 6 changed files with 87 additions and 4 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,6 @@
## Installation
- `python -m pip install --upgrade pip`
- `pip install trafficinterventions xml`

## Documentation
All relevant files can be found [here](https://github.com/WSL-IIITB/Traffic-Interventions/tree/main/docs)
Binary file added dist/trafficinterventions-0.0.3-py3-none-any.whl
Binary file not shown.
Binary file added dist/trafficinterventions-0.0.3.tar.gz
Binary file not shown.
77 changes: 77 additions & 0 deletions docs/index.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
import trafficinterventions

"""
Note: If you wish to not rewrite the XML file, please add another parameter to the functions.
"""

"""
Change Edges Functionality
"""

# Instantiating an object of the XML Parser for Lane Modification
fileName = "sample.xml" # Change the path of your file accordingly.
ce = trafficinterventions.ChangeEdges.ChangeEdges(fileName=fileName)

# Get Root Tag
print(ce.getRootElementTag())

# Get Unique Parent Tags
print(ce.getUniqueParentTags())

# Get the first 10 Lane Type IDs
print(ce.getUniqueEdgeIDs()[:10])

# Get Edge Inforation
ce.getEdgeInformation(["-734354815#0"])

# # Selectively disallow vehicle types from edge
ce.disallowAppendTypes(["truck", "bus"], ["-734354815#0"], None)

# Selectively allow vehicle types from edge
ce.allowAppendTypes(["e-scooter"], ["-777797681"], None)

"""
Change Lanes Functionality
"""
# Instantiating an object of the XML Parser for Lane Modification
fileName = "sample2.xml" # Change the path of your file accordingly.
cl = trafficinterventions.ChangeLanes.ChangeLanes(fileName=fileName)

# Get Root Tag
print(cl.getRootElementTag())

# Get Unique Parent Tags
print(cl.getUniqueParentTags())

# Get all Lane Type IDs
print(cl.getLaneTypes())

# Get all Lane Information

print(cl.getLaneInformation())

# Changing priorities of highway.cycleway lanes to 2
cl.changePriorityLanes(
["highway.cycleway"],
2
)

# Changing the number of lanes reserved to highway.trunk to 3
cl.changeNumLanes(
["highway.cycleway"],
3
)

# Toggling one-way status of railway.rail
cl.toggleOneWay(
["railway.rail"]
)

# Changing the number of lanes on the highway to double their original count
l = cl.getLaneInformation()
for i in range(len(l)):
cl.changeNumLanes(
[l[i][0]],
2 * int(l[i][1]["numLanes"])
)

4 changes: 2 additions & 2 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
[metadata]
name = trafficinterventions
version = 0.0.2
version = 0.0.3
author = WSL, IIITB
author_email = vijay.jaisankar@iiitb.ac.in
author_email = WSL1@iiitb.ac.in
description = Python Package to perform simple Traffic Interventions.
long_description = file: README.md
long_description_content_type = text/markdown
Expand Down
7 changes: 5 additions & 2 deletions src/trafficinterventions.egg-info/PKG-INFO
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
Metadata-Version: 2.1
Name: trafficinterventions
Version: 0.0.2
Version: 0.0.3
Summary: Python Package to perform simple Traffic Interventions.
Home-page: https://github.com/WSL-IIITB/Traffic-Interventions
Author: WSL, IIITB
Author-email: vijay.jaisankar@iiitb.ac.in
Author-email: WSL1@iiitb.ac.in
License: UNKNOWN
Project-URL: Bug Tracker, https://github.com/WSL-IIITB/Traffic-Interventions/issues
Platform: UNKNOWN
Expand All @@ -21,4 +21,7 @@ License-File: LICENSE
- `python -m pip install --upgrade pip`
- `pip install trafficinterventions xml`

## Documentation
All relevant files can be found [here](https://github.com/WSL-IIITB/Traffic-Interventions/tree/main/docs)


0 comments on commit f887261

Please sign in to comment.