Skip to content

Commit

Permalink
clean some unneeded
Browse files Browse the repository at this point in the history
  • Loading branch information
rienafairefr committed Apr 22, 2018
1 parent d90390f commit 59dacd2
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 19 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,5 @@ testscripts/*.json
\.pytest_cache/

\.cache/v/cache/

\.python-version
2 changes: 0 additions & 2 deletions pynYNAB/track.py

This file was deleted.

17 changes: 0 additions & 17 deletions pynYNAB/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,23 +60,6 @@ def get_or_create_payee(client, name):
client.push(1)
return payee

def get_one_or_create(session,
model,
create_method='',
create_method_kwargs=None,
**kwargs):
try:
return session.query(model).filter_by(**kwargs).one(), False
except NoResultFound:
kwargs.update(create_method_kwargs or {})
created = getattr(model, create_method, model)(**kwargs)
try:
session.add(created)
session.flush()
return created, True
except IntegrityError:
session.rollback()
return session.query(model).filter_by(**kwargs).one(), True

# https://stackoverflow.com/a/37757378/1685379
def pp_json(json_thing, sort=True, indents=4):
Expand Down

0 comments on commit 59dacd2

Please sign in to comment.