Skip to content

Commit

Permalink
Merge pull request #3 from jgunstone/create-src-folder
Browse files Browse the repository at this point in the history
Create src folder
  • Loading branch information
jgunstone authored Jul 7, 2022
2 parents 379e035 + 38314bc commit 5ccb1fb
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 10 deletions.
3 changes: 2 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,9 @@ def readme():
long_description_content_type="text/markdown",
include_package_data=True,
keywords='xlsxtemplater',
packages=find_packages('src'),
package_dir={'': 'src'},
name='xlsxtemplater',
packages=find_packages(include=['xlsxtemplater', 'xlsxtemplater.*']),
url='https://github.com/gunstonej/xlsxtemplater',
version=versioneer.get_version(),
cmdclass=versioneer.get_cmdclass(),
Expand Down
File renamed without changes.
File renamed without changes.
8 changes: 4 additions & 4 deletions xlsxtemplater/templater.py → src/xlsxtemplater/templater.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,9 +113,9 @@ def object_to_excel(toexcel: ToExcel, fpth: str, file_properties: FileProperties

def to_excel(data_object,
fpth,
file_properties=None: FileProperties,
openfile=True: bool,
make_readme=True: bool) -> str:
file_properties: FileProperties=None,
openfile: bool=False,
make_readme: bool=True) -> str:
"""
function to output dataobject (list of dicts of dataframes and associated metadata)
to excel in nicely formatted tables.
Expand All @@ -128,7 +128,7 @@ def to_excel(data_object,
file_properties: FileProperties obj defining metadata
openfile: bool
make_readme: creates a readme header sheet. default to true. avoid changing unless
necessary as it is required for the from_excel command.
necessary as it is required for the from_excel comm and.
Returns:
fpth: of output excel file
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from dataclasses import dataclass, asdict, field
from typing import Optional, List, Dict, Callable
from dacite import from_dict
from dacite import from_dict # TODO: remove requirement for dacite
import pandas as pd
import xlsxwriter as xw

Expand Down Expand Up @@ -201,7 +201,7 @@ class XlsxTable:

def __post_init__(self):
# apply default header row formatting
self.row_formatting.insert(0, SetRow(1,50,{'bold': True,'text_wrap': True, 'valign': 'top','border': 1}))
self.row_formatting.insert(0, SetRow(0,50,{'bold': True,'text_wrap': True, 'valign': 'top','border': 1}))

@dataclass
class FileProperties:
Expand Down
8 changes: 5 additions & 3 deletions xlsxtemplater/utils.py → src/xlsxtemplater/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
# mf packages
# TODO - remove this dedendency if opensource
try:
from mf_file_utilities import applauncher_wrapper as aw
from mf_file_utilities.applauncher_wrapper import go as _open_file
except:
pass

Expand All @@ -23,8 +23,8 @@ def date():
# from mf_modules.file_operations import open_file
def open_file(filename):
"""Open document with default application in Python."""
if sys.platform == 'linux' and str(type(aw))== "<class 'module'>":
aw.open_file(filename)
if sys.platform == 'linux':
_open_file(filename)
# note. this is an MF custom App for opening folders and files
# from a Linux file server on the local network
else:
Expand All @@ -46,6 +46,8 @@ def jobno_fromdir(fdir):
Code:
re.findall("[J][0-9][0-9][0-9][0-9]", txt)
'''
if not isinstance(fdir, str):
fdir = str(fdir)
matches = re.findall("[J][0-9][0-9][0-9][0-9]", fdir)
if len(matches) == 0:
job_no = 'J4321'
Expand Down

0 comments on commit 5ccb1fb

Please sign in to comment.