Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
jeanCarloMachado committed Jul 7, 2024
1 parent bf40f52 commit 2256e69
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 18 deletions.
4 changes: 0 additions & 4 deletions python_search/events/run_performed/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +0,0 @@
from __future__ import annotations

from python_search.events.run_performed.entity import EntryExecuted
from python_search.events.run_performed.clean import clean
2 changes: 1 addition & 1 deletion python_search/events/run_performed/writer.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from __future__ import annotations

from python_search.events.run_performed import EntryExecuted
from python_search.events.run_performed.entity import EntryExecuted


class LogRunPerformedClient:
Expand Down
12 changes: 6 additions & 6 deletions python_search/init/entries_main.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
#!/usr/bin/env python3

"""
This is a initial version of python_search _entries to give you a sense of what is possible.
Feel free to delete all the _entries here. You will want to versionate your _entries
"""

import datetime
import os

from python_search.configuration.configuration import PythonSearchConfiguration
from python_search.official_entries.entries import OfficialEntries

"""
This is a initial version of python_search _entries to give you a sense of what is possible.
Feel free to delete all the _entries here. You will want to versionate your _entries
"""

entries = {
# NEW_ENTRIES_HERE
"python search open search ui": {
Expand Down Expand Up @@ -57,6 +58,5 @@
},
}

from python_search.configuration.configuration import PythonSearchConfiguration

config = PythonSearchConfiguration(entries=entries, entries_groups=[OfficialEntries])
2 changes: 1 addition & 1 deletion python_search/python_search_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from python_search.core_entities import Key
from python_search.entry_runner import EntryRunner
from python_search.error.exception import notify_exception
from python_search.events.run_performed import EntryExecuted
from python_search.events.run_performed.entity import EntryExecuted
from python_search.events.run_performed.writer import LogRunPerformedClient
from python_search.host_system.window_hide import HideWindow
from python_search.search.entries_loader import EntriesLoader
Expand Down
2 changes: 1 addition & 1 deletion python_search/search/search_ui/bm25_search.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ def search(self, query: List[str] = None) -> List[str]:
matches = self.bm25.get_top_n(
tokenized_query, self.entries, n=self.number_entries_to_return
)
except:
except Exception:
self.build_bm25()
matches = self.bm25.get_top_n(
tokenized_query, self.entries, n=self.number_entries_to_return
Expand Down
4 changes: 3 additions & 1 deletion python_search/search/search_ui/terminal_ui.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,9 @@ def render(self):
self.matched_keys.append(key)

def search(self, query):
"""gets 1 from each type of search at a time and merge them to remove duplicates"""
"""
gets 1 from each type of search at a time and merge them to remove duplicates
"""

already_returned = []
bm25_results = self.search_bm25.search(query)
Expand Down
8 changes: 4 additions & 4 deletions python_search/shortcut/gnome.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,7 @@ def generate_shortcut(self, name: str, command: str, binding: str):
item_s = "/" + key.replace(" ", "/").replace(".", "/") + "/"
firstname = "custom"
# get the current list of custom shortcuts
get = lambda cmd: subprocess.check_output(["/bin/bash", "-c", cmd]).decode(
"utf-8"
)
array_str = get("gsettings get " + key)
array_str = self.get("gsettings get " + key)
# in case the array was empty, remove the annotation hints
command_result = array_str.lstrip("@as")
current = eval(command_result)
Expand All @@ -84,6 +81,9 @@ def generate_shortcut(self, name: str, command: str, binding: str):
print(f"CMD executing: {cmd}")
subprocess.call(["/bin/bash", "-c", cmd])

def get(cmd):
return subprocess.check_output(["/bin/bash", "-c", cmd]).decode("utf-8")

def _generate_identifier(self, string):
"""
strip the string from all special characters lefting only [A-B-09]
Expand Down

0 comments on commit 2256e69

Please sign in to comment.