Commit Graph

588 Commits

Author SHA1 Message Date
Salvo 'LtWorf' Tomaselli
f7ac34b761 Fix exception
The reported exception will look uglier but will work for any kind of
weird tokenization that occurred.
2015-09-10 10:13:00 +02:00
Salvo 'LtWorf' Tomaselli
df5ff35aa9 Changelog 2015-09-09 17:33:15 +02:00
Salvo 'LtWorf' Tomaselli
20ebf45271 Parser cleanup
The new method works fine to parse also unary operators.

This commit removes the special case.
2015-09-09 17:31:02 +02:00
Salvo 'LtWorf' Tomaselli
6c8b60cf34 Improve error handling
Provide a better error in case of operator missing
2015-09-09 17:28:12 +02:00
Salvo 'LtWorf' Tomaselli
c30456c43e Fix bug in parser
The excessive stripping would cause "peo ple" to be recognized as
the relation "people" rather than an invalid thing.
2015-09-09 17:23:12 +02:00
Salvo 'LtWorf' Tomaselli
5f3564a398 Fix bug in tokenizer
It would not work with relations named like "l3"
2015-09-09 16:48:17 +02:00
Salvo 'LtWorf' Tomaselli
ab46ad2a54 Typo in comments 2015-09-09 15:22:15 +02:00
Salvo 'LtWorf' Tomaselli
9330090362 Switch to compiled regular expressions
This introduces several advantages:

No longer rely on the cache to be able to contain as many as
needed. It works within relational but it is not assured to be so if it
is used within other projects.

Using compile flags allows slightly simpler expressions.
2015-09-09 15:17:17 +02:00
Salvo 'LtWorf' Tomaselli
d8db1858ae Fix bug: imported removed module
import * would fail, because of a listed module that was removed.
2015-09-09 15:13:44 +02:00
Salvo 'LtWorf' Tomaselli
c6d6bbfeaf Refresh relation list in any case
If a query was failing, created relations were not shown in the list
of relations.
2015-09-09 14:45:17 +02:00
Salvo 'LtWorf' Tomaselli
1b2dc96af1 Re-generated UI 2015-09-09 12:43:25 +02:00
Salvo 'LtWorf' Tomaselli
862c71fdfb Clear session button and changed layout
Added a button to clear the current session

changed the disposition of the operator buttons, to take up less
vertical space. Now it should be better to fit smaller screens.
2015-09-09 12:42:00 +02:00
Salvo 'LtWorf' Tomaselli
66855ad50c Clear session function
Added a function to clear the current session
2015-09-09 12:38:54 +02:00
Salvo 'LtWorf' Tomaselli
7742afd046 Removed redundant comments
Just pointing the documentation towards the website so that
only one copy of it must be kept up to date.
2015-08-05 20:32:57 +02:00
Salvo 'LtWorf' Tomaselli
9ea5e32563 changelog 2015-08-03 16:01:10 +02:00
Salvo 'LtWorf' Tomaselli
edc5078475 Use session handling in GUI
The UI stores the session when closing and loads it at the next
use.
2015-08-03 15:58:11 +02:00
Salvo 'LtWorf' Tomaselli
0aa372792f Session management
Adds some functions to store and load an entire session as a binary
blob.

In this way the user does not need to re-load all the relations from the
previous session.
2015-08-03 15:56:37 +02:00
Salvo 'LtWorf' Tomaselli
5a9c2f23a5 Changelog 2015-07-14 15:43:41 +02:00
Salvo 'LtWorf' Tomaselli
be7e6fe12d Classes have now names that begin with uppercase
This is more Pythonic and makes the code more readable.

Backwards compatibility is provided by giving an alias with the
previous name of the class.

It will not be broken until the next major release.
2015-07-14 15:39:35 +02:00
Salvo 'LtWorf' Tomaselli
af02b5a59b Improved docstring 2015-07-14 15:08:39 +02:00
Salvo 'LtWorf' Tomaselli
c275c1caf3 Improve performance of __eq__
If the cardinality of two relations does not match, the expensive
rearrange procedure is not performed at all.
2015-07-14 11:11:13 +02:00
Salvo 'LtWorf' Tomaselli
f787630edb Use isinstance rather than comparing class attribute
This allows to create subclasses
2015-07-14 11:09:42 +02:00
Salvo 'LtWorf' Tomaselli
73dd14d9dd Style 2015-07-14 11:01:35 +02:00
Salvo 'LtWorf' Tomaselli
98ac364dc7 Removed encoding string
Not needed in Python 3
2015-07-14 10:43:13 +02:00
Salvo 'LtWorf' Tomaselli
9a570b4386 Use regexp constant
The regexp used was not even the same one…
2015-07-14 10:39:38 +02:00
Salvo 'LtWorf' Tomaselli
33d9545d66 Improved docstring 2015-07-14 10:38:14 +02:00
Salvo 'LtWorf' Tomaselli
e2ab59bcc4 Added public attribute with relation name regexp
Also simplified the function to check whether a name is valid for
a relation.
2015-07-14 10:35:54 +02:00
Salvo 'LtWorf' Tomaselli
a655e81b28 Remove useless comments 2015-07-14 01:18:54 +02:00
Salvo 'LtWorf' Tomaselli
9416a9fef9 Removed useless unicode marker from strings
We are using Python3 now, so that is not needed
2015-07-09 23:43:54 +02:00
Salvo 'LtWorf' Tomaselli
df485e4bd4 Make use of callable string
Instead of explicitly using eval, make use of the
new callable string feature
2015-07-09 23:42:52 +02:00
Salvo 'LtWorf' Tomaselli
33651430d0 Removed curses module
unused
2015-07-09 23:37:20 +02:00
Salvo 'LtWorf' Tomaselli
4f85a545bf parse function returns a callable string
The python string returned by the parser are now directly callable.

They accept an optional parameter for the context.
2015-07-09 23:35:45 +02:00
Salvo 'LtWorf' Tomaselli
f5e8e442a0 Removed unused variables 2015-07-09 23:32:46 +02:00
Salvo 'LtWorf' Tomaselli
494469e10c Changelog 2015-07-09 22:39:33 +02:00
Salvo 'LtWorf' Tomaselli
f6b4c6708b _rearrange() is an identity if not needed
Operations are possible even when the order of the attributes is
not the same. Because ordering is just an implementation detail and
not an actual part of relational algebra.

A _rearrange() function exists to convert relations to have a similar
format and be able to operate on them.

The function would perform a projection in any case, which would cause
the creation of a new temporary relation, even when the relations where
already using the same order of attributes.

This commit fixes the issue by making it return an identity if the
operation is not necessary.
2015-06-25 16:46:10 +02:00
Salvo 'LtWorf' Tomaselli
95e375f44a Use dictionary comprehension in selection
When doing a selection, a new context (in the form of a dictionary)
is created.

Instead of re-using the same dictionary re-assigning the values, now
use a comprehension to avoid redundant reads.
2015-06-25 16:34:47 +02:00
Salvo 'LtWorf' Tomaselli
bcc7053892 Removed a couple of un-pythonic lines 2015-06-17 17:13:35 +02:00
Salvo 'LtWorf' Tomaselli
5218f41e7b Use handler to suggest name 2015-06-17 16:35:14 +02:00
Salvo 'LtWorf' Tomaselli
59d712e53f Interface handler can suggest names
The interface handler can suggest names for loaded
relations.

This can be used to remove duplicated code.
2015-06-17 16:35:01 +02:00
Salvo 'LtWorf' Tomaselli
05e13bfeac Use the new class
Simplify error reporting with a new function.
2015-06-16 13:22:58 +02:00
Salvo 'LtWorf' Tomaselli
226b340969 Create class in maintenance module to help the UIs
The class has methods commonly used by user interfaces, so that
they don't need to be implemented multiple times by different
UIs.
2015-06-16 13:15:11 +02:00
Salvo 'LtWorf' Tomaselli
8daaf599df Removed debian patch for encoding in tests
The encoding is set in the source code now, so
the patch is no longer necessary.
2015-06-16 10:32:40 +02:00
Salvo 'LtWorf' Tomaselli
cb8a1563c7 Using new field for python version 2015-06-13 19:15:43 +02:00
Salvo 'LtWorf' Tomaselli
923e515535 Fix the version checker for python3 2015-06-13 17:39:42 +02:00
Salvo 'LtWorf' Tomaselli
5552923633 Prepare for version 2.1 2015-06-13 17:34:13 +02:00
Salvo 'LtWorf' Tomaselli
0385478f91 Set encoding in test driver
Python3 handles encoding differently, and files are loaded
according to the locale set on the system.

This means that when building on a locale-less chroot,
the tests will always fail because it will try to load utf-8
and encode it as ASCII.

This forces the encoding. The tests are encoded in utf-8 anyway
so any other encoding set by the locale would cause a failure.
2015-06-13 17:24:38 +02:00
Salvo 'LtWorf' Tomaselli
4c41132705 Mark bug as closed 2015-06-13 17:21:43 +02:00
Salvo 'LtWorf' Tomaselli
c49fbe5024 Update pyversion 2015-06-09 16:31:00 +02:00
Salvo 'LtWorf' Tomaselli
60b56fafd0 Patch to build 2015-06-09 16:28:43 +02:00
Salvo 'LtWorf' Tomaselli
f3c13a2fd5 Bumped compat and debhelper 2015-06-09 15:49:08 +02:00