Skip to content
This repository has been archived by the owner on Dec 21, 2023. It is now read-only.

Commit

Permalink
Make setupable
Browse files Browse the repository at this point in the history
  • Loading branch information
PokestarFan committed Oct 15, 2017
1 parent 9c5fdb9 commit eebc6b3
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 4 deletions.
4 changes: 0 additions & 4 deletions MarkdownTable.py

This file was deleted.

Empty file added markdowntable/__init__.py
Empty file.
38 changes: 38 additions & 0 deletions markdowntable/markdowntable.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
from __future__ import absolute_import
from __future__ import (print_function, unicode_literals)


class Table():
"""docstring for Table.
This is the main class. It adds rows and columns, with data
"""
def __init__(self,name):
super(Table, self).__init__()
self.rows = 0
self.columns = 1
self.table = '''|{}|'''.format(str(name))

def add_column(self, name):
self.columns += 1
self.table += '''{}|'''.format(name)

def finalize_columms(self):
finalizer = '\n|'
for i in range(self.columns):
finalizer += '---|'
self.table += finalizer


def add_row(self, list):
self.rows += 1
row = '|'
try:
assert int(len(list)) == self.columns
except(AssertionError):
raise AssertionError('The list does not have enough values, or has too many values. Make sure only {} values are present.'.format(self.columns))
for i in range(int(len(list))):
row += '{}|'.format(list[i])
self.table += '\n{}'.format(row)

def get_table(self):
return self.table
12 changes: 12 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
from setuptools import setup


setup(name='markdowntable',
version='0.1',
description='Easy way to make markdown code for tables',
url='https://github.com/PokestarFan/Python-Markdown-Table',
author='PokestarFan',
author_email='pokestarfan@yahoo.com',
license='MIT',
packages=['markdowntable'],
zip_safe=True)

0 comments on commit eebc6b3

Please sign in to comment.