Skip to content

Commit

Permalink
New minor release 3.1.1
Browse files Browse the repository at this point in the history
  • Loading branch information
dirkroorda committed Oct 21, 2017
1 parent fb22650 commit 7338e8d
Show file tree
Hide file tree
Showing 7 changed files with 31 additions and 10 deletions.
Binary file removed dist/text-fabric-3.1.0.tar.gz
Binary file not shown.
Binary file added dist/text-fabric-3.1.1.tar.gz
Binary file not shown.
2 changes: 1 addition & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
project = u'Text-Fabric'
copyright = u'2016, Dirk Roorda'
version = '3.1'
release = '3.1.0'
release = '3.1.1'
exclude_patterns = ['_build']
add_function_parentheses = True
add_module_names = False
Expand Down
4 changes: 2 additions & 2 deletions docs/conf.py.bck
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ source_suffix = '.rst'
master_doc = 'index'
project = u'Text-Fabric'
copyright = u'2016, Dirk Roorda'
version = '3.0'
release = '3.0.9'
version = '3.1'
release = '3.1.0'
exclude_patterns = ['_build']
add_function_parentheses = True
add_module_names = False
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
setup(
name='text-fabric',
packages=['tf'],
version='3.1.0',
version='3.1.1',
description='''Processor for Text Fabric Data''',
author='Dirk Roorda',
author_email='dirk.roorda@dans.knaw.nl',
Expand Down
2 changes: 1 addition & 1 deletion tf/fabric.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from .mql import MQL, tfFromMql

NAME = 'Text-Fabric'
VERSION = '3.1.0'
VERSION = '3.1.1'
APIREF = 'https://github.com/Dans-labs/text-fabric/wiki/Api'
TUTORIAL = 'https://github.com/Dans-labs/text-fabric/blob/master/docs/tutorial.ipynb'
DATA = 'https://github.com/Dans-labs/text-fabric-data'
Expand Down
31 changes: 26 additions & 5 deletions tf/mql.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import os
from functools import reduce
from .data import GRID
from .helpers import *

Expand All @@ -8,6 +9,7 @@

ENUM_LIMIT = 1000

ONE_ENUM_TYPE = True

class MQL(object):
def __init__(self, mqlDir, mqlName, tfFeatures, tm):
Expand Down Expand Up @@ -120,11 +122,30 @@ def _writeEnums(self):
continue
self.enums[ft] = fValues

for ft in sorted(self.enums):
self._writeEnum(ft)
self.tm.indent(level=0)
self.tm.info('Written {} enumerations'.format(len(self.enums)))
if ONE_ENUM_TYPE:
self._writeEnumsAsOne()
else:
for ft in sorted(self.enums):
self._writeEnum(ft)
self.tm.indent(level=0)
self.tm.info('Written {} enumerations'.format(len(self.enums)))

def _writeEnumsAsOne(self):
fValues = reduce(
set.union,
(set(fV) for fV in self.enums.values()),
set(),
)
self.tm.info('Writing an all-in-one enum with {:>4} values'.format(len(fValues)))
fValuesEnumerated = ',\n\t'.join('{} = {}'.format(fVal, i) for (i, fVal) in enumerate(fValues))
self.fm.write('''
CREATE ENUMERATION all_enum = {{
{}
}}
GO
'''.format(fValuesEnumerated))


def _writeEnum(self, ft):
fValues = self.enums[ft]
self.tm.info('enum {:<15} with {:>4} values'.format(ft, len(fValues)))
Expand Down Expand Up @@ -192,7 +213,7 @@ def _writeType(self, otype):
[{}
'''.format(otype))
for ft in self.otypes[otype]:
fType = '{}_enum'.format(ft) if ft in self.enums else self.featureTypes[ft]
fType = '{}_enum'.format('all' if ONE_ENUM_TYPE else ft) if ft in self.enums else self.featureTypes[ft]
self.fm.write(' {}:{};\n'.format(ft, fType))
self.fm.write('''
]
Expand Down

0 comments on commit 7338e8d

Please sign in to comment.