Skip to content

Commit b45ecec

Browse files
committedDec 20, 2024
Update README: change parse_tables() to to_dict() to reflect actual code
1 parent 0d39ec5 commit b45ecec

File tree

1 file changed

+31
-29
lines changed

1 file changed

+31
-29
lines changed
 

‎README.md

+31-29
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
# Xer-Reader
22

3-
Read the contents of a Primavera P6 XER file using Python.
3+
Read the contents of a Primavera P6 XER file using Python.
44

55
Xer-Reader makes it easy to read, parse, and convert the data in a XER file to other formats.
66

7-
*Refer to the [Oracle Documentation]( https://docs.oracle.com/cd/F25600_01/English/Mapping_and_Schema/xer_import_export_data_map_project/index.htm) for more information regarding how data is mapped to the XER format.
8-
Tested on XER files exported as versions 15.2 through 19.12.*
7+
_Refer to the [Oracle Documentation](https://docs.oracle.com/cd/F25600_01/English/Mapping_and_Schema/xer_import_export_data_map_project/index.htm) for more information regarding how data is mapped to the XER format.
8+
Tested on XER files exported as versions 15.2 through 19.12._
99

1010
## Install
1111

@@ -21,9 +21,10 @@ pip install xer-reader
2121
pip3 install xer-reader
2222
```
2323

24-
## Usage
24+
## Usage
2525

2626
Import the `XerReader` class from `xer_reader`.
27+
2728
```python
2829
from xer_reader import XerReader
2930
```
@@ -35,59 +36,60 @@ file = r"/path/to/file.xer"
3536
reader = XerReader(file)
3637
```
3738

38-
### Attributes
39+
### Attributes
3940

40-
* `data` [str] - *The contents of the XER file as a string.*
41-
* `export_date` [datetime] - *The date the XER file was exported.*
42-
* `export_user` [str] - *The P6 user who export the XER file.*
43-
* `export_version` [str] - *The P6 verison used to export the XER file.*
44-
* `file_name` [str] - *The name of the file without the '.xer' extension.*
41+
- `data` [str] - _The contents of the XER file as a string._
42+
- `export_date` [datetime] - _The date the XER file was exported._
43+
- `export_user` [str] - _The P6 user who export the XER file._
44+
- `export_version` [str] - _The P6 verison used to export the XER file._
45+
- `file_name` [str] - _The name of the file without the '.xer' extension._
4546

4647
### Methods
4748

48-
**`check_errors()`** -> *list[str]*
49-
Checks the XER file for missing tables and orphan data, and returns the results as a list of errors.
49+
**`check_errors()`** -> _list[str]_
50+
Checks the XER file for missing tables and orphan data, and returns the results as a list of errors.
5051

51-
* Missing tables can occur when an entry in *Table 1* points to an entry in *Table 2* but *Table 2* does not exist at all.
52-
* Orphan data occurs when an entry in *Table 1* points to an entry *Table 2* but the entry in *Table 2* does not exist.
52+
- Missing tables can occur when an entry in _Table 1_ points to an entry in _Table 2_ but _Table 2_ does not exist at all.
53+
- Orphan data occurs when an entry in _Table 1_ points to an entry _Table 2_ but the entry in _Table 2_ does not exist.
5354

54-
**`delete_tables(*table_names: str)`** -> *str*
55-
Delete a variable number of tables (*table_names*) from the XER file data and returns a new string (*Does not modify `XerReader.data` attribute*).
55+
**`delete_tables(*table_names: str)`** -> _str_
56+
Delete a variable number of tables (_table_names_) from the XER file data and returns a new string (_Does not modify `XerReader.data` attribute_).
5657

5758
In the following example the tables associated with User Defined Fields are removed from the XER file contents and stored in a new variable `new_xer_data`, which can then be written to a new XER file:
59+
5860
```python
5961
new_xer_data = reader.delete_tables("UDFTYPE", "UDFVALUE")
6062

6163
with open("New_XER.xer", "w", encoding=XerReader.CODEC) as new_xer_file:
6264
new_xer_file.write(new_xer_data)
6365
```
6466

65-
**`get_table_names()`** -> *list[str]*
66-
Returns a list of table names included in the XER file.
67+
**`get_table_names()`** -> _list[str]_
68+
Returns a list of table names included in the XER file.
6769

68-
**`get_table_str(table_name: str)`** -> *str*
70+
**`get_table_str(table_name: str)`** -> _str_
6971
Returns the tab seperated text for a specific table in the XER file.
7072

71-
**`has_table(table_name: str)`** -> *bool*
73+
**`has_table(table_name: str)`** -> _bool_
7274
Return True if table (`table_name`) if found in the XER file.
7375

74-
**`parse_tables()`** -> *dict[str, Table]*
75-
Returns a dictionary with the table name as the key and a `Table` object as the value.
76+
**`to_dict()`** -> _dict[str, Table]_
77+
Returns a dictionary with the table name as the key and a `Table` object as the value.
7678

77-
**`to_csv(file_directory: str | Path, table_names: list[str], delimeter: str)`** -> *None*
78-
Generate a CSV file for each table in the XER file. CSV files will be created in the current working directory.
79+
**`to_csv(file_directory: str | Path, table_names: list[str], delimeter: str)`** -> _None_
80+
Generate a CSV file for each table in the XER file. CSV files will be created in the current working directory.
7981
Optional `file_directory`: Pass a string or Path object to specify a folder to store the CSV files in.
8082
Optional `table_names`: List of tables names to save to CSV files.
81-
Optional `delimeter`: Change the default delimeter from a `tab` to another string (e.g. a coma ",").
83+
Optional `delimeter`: Change the default delimeter from a `tab` to another string (e.g. a coma ",").
8284

8385
```python
8486
reader.to_csv(table_names=["TASK", "PROJWBS"], delimeter=",")
8587
```
8688

87-
**`to_excel()`** -> *None*
88-
Generate an Excel (.xlsx) file with each table in the XER file on its own spreadsheet. The Excel file will be create in the
89-
current working directory.
89+
**`to_excel()`** -> _None_
90+
Generate an Excel (.xlsx) file with each table in the XER file on its own spreadsheet. The Excel file will be create in the
91+
current working directory.
9092

91-
**`to_json(*tables: str)`** -> *str*
93+
**`to_json(*tables: str)`** -> _str_
9294
Generate a json compliant string representation of the tables in the XER file.
9395
Optional: Pass in specific table names to include in the json string.

0 commit comments

Comments
 (0)
Please sign in to comment.