pyflowlauncher 0.5.0.dev0__tar.gz → 0.6.0.dev0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (22) hide show
  1. {pyflowlauncher-0.5.0.dev0 → pyflowlauncher-0.6.0.dev0}/PKG-INFO +1 -1
  2. {pyflowlauncher-0.5.0.dev0 → pyflowlauncher-0.6.0.dev0}/pyflowlauncher/plugin.py +13 -3
  3. {pyflowlauncher-0.5.0.dev0 → pyflowlauncher-0.6.0.dev0}/pyflowlauncher/string_matcher.py +4 -3
  4. {pyflowlauncher-0.5.0.dev0 → pyflowlauncher-0.6.0.dev0}/pyflowlauncher.egg-info/PKG-INFO +1 -1
  5. {pyflowlauncher-0.5.0.dev0 → pyflowlauncher-0.6.0.dev0}/pyproject.toml +2 -2
  6. {pyflowlauncher-0.5.0.dev0 → pyflowlauncher-0.6.0.dev0}/README.md +0 -0
  7. {pyflowlauncher-0.5.0.dev0 → pyflowlauncher-0.6.0.dev0}/pyflowlauncher/__init__.py +0 -0
  8. {pyflowlauncher-0.5.0.dev0 → pyflowlauncher-0.6.0.dev0}/pyflowlauncher/api.py +0 -0
  9. {pyflowlauncher-0.5.0.dev0 → pyflowlauncher-0.6.0.dev0}/pyflowlauncher/event.py +0 -0
  10. {pyflowlauncher-0.5.0.dev0 → pyflowlauncher-0.6.0.dev0}/pyflowlauncher/icons.py +0 -0
  11. {pyflowlauncher-0.5.0.dev0 → pyflowlauncher-0.6.0.dev0}/pyflowlauncher/jsonrpc.py +0 -0
  12. {pyflowlauncher-0.5.0.dev0 → pyflowlauncher-0.6.0.dev0}/pyflowlauncher/manifest.py +0 -0
  13. {pyflowlauncher-0.5.0.dev0 → pyflowlauncher-0.6.0.dev0}/pyflowlauncher/method.py +0 -0
  14. {pyflowlauncher-0.5.0.dev0 → pyflowlauncher-0.6.0.dev0}/pyflowlauncher/py.typed +0 -0
  15. {pyflowlauncher-0.5.0.dev0 → pyflowlauncher-0.6.0.dev0}/pyflowlauncher/result.py +0 -0
  16. {pyflowlauncher-0.5.0.dev0 → pyflowlauncher-0.6.0.dev0}/pyflowlauncher/shared.py +0 -0
  17. {pyflowlauncher-0.5.0.dev0 → pyflowlauncher-0.6.0.dev0}/pyflowlauncher.egg-info/SOURCES.txt +0 -0
  18. {pyflowlauncher-0.5.0.dev0 → pyflowlauncher-0.6.0.dev0}/pyflowlauncher.egg-info/dependency_links.txt +0 -0
  19. {pyflowlauncher-0.5.0.dev0 → pyflowlauncher-0.6.0.dev0}/pyflowlauncher.egg-info/requires.txt +0 -0
  20. {pyflowlauncher-0.5.0.dev0 → pyflowlauncher-0.6.0.dev0}/pyflowlauncher.egg-info/top_level.txt +0 -0
  21. {pyflowlauncher-0.5.0.dev0 → pyflowlauncher-0.6.0.dev0}/setup.cfg +0 -0
  22. {pyflowlauncher-0.5.0.dev0 → pyflowlauncher-0.6.0.dev0}/setup.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: pyflowlauncher
3
- Version: 0.5.0.dev0
3
+ Version: 0.6.0.dev0
4
4
  Summary: Python library to help build Flow Launcher plugins.
5
5
  Author-email: William McAllister <dev.garulf@gmail.com>
6
6
  License: MIT
@@ -59,12 +59,22 @@ class Plugin:
59
59
  feedback['SettingsChange'] = self.settings
60
60
  self._client.send(feedback)
61
61
 
62
- def plugin_root_dir(self) -> Path:
63
- """Return the root directory of the plugin."""
62
+ @property
63
+ def run_dir(self) -> Path:
64
+ """Return the run directory of the plugin."""
64
65
  return Path(sys.argv[0]).parent
65
66
 
67
+ def root_dir(self) -> Path:
68
+ """Return the root directory of the plugin."""
69
+ current_dir = self.run_dir
70
+ for part in current_dir.parts:
71
+ if current_dir.joinpath(MANIFEST_FILE).exists():
72
+ return current_dir
73
+ current_dir = current_dir.parent
74
+ raise FileNotFoundError(f"Could not find {MANIFEST_FILE} in {self.run_dir} or any parent directory.")
75
+
66
76
  def manifest(self) -> PluginManifestSchema:
67
77
  """Return the plugin manifest."""
68
- with open(self.plugin_root_dir() / MANIFEST_FILE, 'r', encoding='utf-8') as f:
78
+ with open(self.root_dir() / MANIFEST_FILE, 'r', encoding='utf-8') as f:
69
79
  manifest = json.load(f)
70
80
  return manifest
@@ -123,10 +123,11 @@ def string_matcher(query: str, text: str, ignore_case: bool = True,
123
123
  nearest_space_index = calculate_closest_space_index(
124
124
  space_indices, first_match_index)
125
125
 
126
- score = calculate_search_score(query, text, first_match_index - nearest_space_index - 1,
127
- space_indices, last_match_index - first_match_index, all_substrings_contained_in_text)
126
+ score: float = calculate_search_score(query, text, first_match_index - nearest_space_index - 1,
127
+ space_indices, last_match_index - first_match_index,
128
+ all_substrings_contained_in_text)
128
129
 
129
- return MatchData(True, query_search_precision, index_list, score)
130
+ return MatchData(True, query_search_precision, index_list, int(score))
130
131
 
131
132
  return MatchData(False, query_search_precision)
132
133
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: pyflowlauncher
3
- Version: 0.5.0.dev0
3
+ Version: 0.6.0.dev0
4
4
  Summary: Python library to help build Flow Launcher plugins.
5
5
  Author-email: William McAllister <dev.garulf@gmail.com>
6
6
  License: MIT
@@ -6,7 +6,7 @@ name = "pyflowlauncher"
6
6
  authors = [
7
7
  {name = "William McAllister", email = "dev.garulf@gmail.com"}
8
8
  ]
9
- version = '0.5.0-dev.0'
9
+ version = '0.6.0-dev.0'
10
10
  description = "Python library to help build Flow Launcher plugins."
11
11
  readme = "README.md"
12
12
  requires-python = ">=3.8"
@@ -27,7 +27,7 @@ packages = ["pyflowlauncher"]
27
27
  "pyflowlauncher" = ["py.typed"]
28
28
 
29
29
  [tool.bumpversion]
30
- current_version = "0.5.0-dev.0"
30
+ current_version = "0.6.0-dev.0"
31
31
  parse = """(?x)
32
32
  (?P<major>[0-9]+)
33
33
  \\.(?P<minor>[0-9]+)