From c0586a43026ca898b5ab4edd353f84833bd2ccf8 Mon Sep 17 00:00:00 2001 From: Mandar Vaze Date: Mon, 11 Nov 2019 13:32:04 +0530 Subject: [PATCH 1/2] Remove unused code. Fix #332 --- orator/utils/url.py | 27 --------------------------- 1 file changed, 27 deletions(-) diff --git a/orator/utils/url.py b/orator/utils/url.py index 19bd7f79..9e63c380 100644 --- a/orator/utils/url.py +++ b/orator/utils/url.py @@ -141,33 +141,6 @@ def get_dialect(self): else: return cls - def translate_connect_args(self, names=[], **kw): - """Translate url attributes into a dictionary of connection arguments. - - Returns attributes of this url (`host`, `database`, `username`, - `password`, `port`) as a plain dictionary. The attribute names are - used as the keys by default. Unset or false attributes are omitted - from the final dictionary. - - :param \**kw: Optional, alternate key names for url attributes. - - :param names: Deprecated. Same purpose as the keyword-based alternate - names, but correlates the name to the original positionally. - """ - - translated = {} - attribute_names = ["host", "database", "username", "password", "port"] - for sname in attribute_names: - if names: - name = names.pop(0) - elif sname in kw: - name = kw[sname] - else: - name = sname - if name is not None and getattr(self, sname, False): - translated[name] = getattr(self, sname) - return translated - def make_url(name_or_url): """Given a string or unicode instance, produce a new URL instance. From 5d556851d52686902139c51b6d32ee844375f5f2 Mon Sep 17 00:00:00 2001 From: Mandar Vaze Date: Mon, 11 Nov 2019 13:56:27 +0530 Subject: [PATCH 2/2] Fix format issues that failed on travis --- tests/commands/migrations/test_make_command.py | 2 +- tests/migrations/test_migrator.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/commands/migrations/test_make_command.py b/tests/commands/migrations/test_make_command.py index b72269eb..af0c964d 100644 --- a/tests/commands/migrations/test_make_command.py +++ b/tests/commands/migrations/test_make_command.py @@ -31,7 +31,7 @@ def test_basic_create_gives_creator_proper_arguments_when_table_is_set(self): self.run_command(command, [("name", "create_foo"), ("--table", "users")]) def test_basic_create_gives_creator_proper_arguments_when_table_is_set_with_create( - self + self, ): creator_mock = flexmock(MigrationCreator) creator_mock.should_receive("create").once().with_args( diff --git a/tests/migrations/test_migrator.py b/tests/migrations/test_migrator.py index c62c3d2d..07141c97 100644 --- a/tests/migrations/test_migrator.py +++ b/tests/migrations/test_migrator.py @@ -224,7 +224,7 @@ def test_last_batch_of_migrations_can_be_rolled_back(self): migrator.rollback(os.getcwd()) def test_last_batch_of_migrations_can_be_rolled_back_directly_if_transactional_is_false( - self + self, ): resolver_mock = flexmock(DatabaseManager) resolver_mock.should_receive("connection").and_return({})