这是indexloc提供的服务,不要输入任何密码
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions docs/admin/engines/configured_engines.rst
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@ Explanation of the :ref:`general engine configuration` shown in the table
- ``!{{mod.shortcut}}``
- {{mod.__name__}}
- {{(mod.disabled and "y") or ""}}
{%- if mod.about and mod.about.language %}
({{mod.about.language | upper}})
{%- endif %}
- {{mod.timeout}}
- {{mod.weight or 1 }}
{% if mod.engine_type == 'online' %}
Expand Down
6 changes: 5 additions & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,11 @@
},
}
jinja_filters = {
'sort_engines': lambda engines: sorted(engines, key=lambda engine: (engine[1].disabled, engine[0]))
'sort_engines':
lambda engines: sorted(
engines,
key=lambda engine: (engine[1].disabled, engine[1].about.get('language', ''), engine[0])
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: can you add a space left & right to the equation symbol / even in arguments / I know it is not PEP8, but it is much better to read ;)

key = lambda engine: (...)

Copy link
Contributor Author

@not-my-profile not-my-profile Dec 21, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm happy to adhere to any formatting style you choose for your project. I'm however also a fan of consistency and currently the code mostly sticks to the PEP8 style. Given that there's a recent PR to introduce auto-formatting #619, arbitrarily applying manual formatting here seems weird to me.

Copy link
Member

@return42 return42 Dec 21, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm happy to adhere to any formatting style you choose for your project. I'm however also a fan of consistency and currently the code mostly sticks to the PEP8 style.

Our code is (mostly) PEP8 / but not in this one case: What PEP8 says about formatting arguments is good for one-liners but not for a multiline argument list, especial not where the value of an argument takes several lines (IMO PEP8 is pointless in this case).

Given that there's a recent PR to introduce auto-formatting ..

Yes we have #619 but this PR is in a draft state and I don't know when we have finished a code-style workflow for python like we have done this month for JS.

jinja_filters = {
    'sort_engines': lambda engines: sorted(
        engines,
        key = lambda engine: (
            engine[1].disabled, engine[1].about.get('language', ''), engine[0]
        ),
    )
}

.. is much better to read / nevertheless what PEP8 says .. AFAIK black won't fix this to PEP8 style.

Copy link
Contributor Author

@not-my-profile not-my-profile Dec 21, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

$ grep -Pzohr '[(,][\n\t ]*[a-z]+=[^\n]+' --include='*.py' searx  | tr "$'\0'" $'\n' | grep = | wc -l
413
$ grep -Pzohr '[(,][\n\t ]*[a-z]+ =[^\n]+' --include='*.py' searx  | tr "$'\0'" $'\n' | grep = | wc -l
77

The PEP8 style seems way more common in the codebase.

AFAIK black won't fix this to PEP8 style

Actually it does. (Black is in general very strict to prevent such discussions.)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually it does.

Seems you are right .. I will never understand why this arbitrary setting of whitespaces ..

dict_a = {
    "foo": "bar",
    "john": "doe",
}

dict_b = dict(
    foo="bar",
    john="doe",
)

should be more readable than ..

dict_a = {
    "foo" : "bar",
    "john" : "doe",
}

dict_b = dict(
    foo = "bar",
    john = "doe",
)

.. anyway if the majority thinks every detail of PEP8 weights more than readability ..

)
}

# usage:: lorem :patch:`f373169` ipsum
Expand Down
1 change: 1 addition & 0 deletions searx/engines/duden.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
"use_official_api": False,
"require_api_key": False,
"results": 'HTML',
"language": 'de',
}

categories = ['general']
Expand Down
1 change: 1 addition & 0 deletions searx/engines/ina.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
"use_official_api": False,
"require_api_key": False,
"results": 'HTML',
"language": 'fr',
}

# engine dependent config
Expand Down
1 change: 1 addition & 0 deletions searx/engines/mediathekviewweb.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
"use_official_api": True,
"require_api_key": False,
"results": 'JSON',
"language": "de",
}

categories = ['videos']
Expand Down
1 change: 1 addition & 0 deletions searx/engines/seznam.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
"use_official_api": False,
"require_api_key": False,
"results": "HTML",
"language": "cz",
}

base_url = 'https://search.seznam.cz/'
Expand Down
1 change: 1 addition & 0 deletions searx/engines/sjp.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
"use_official_api": False,
"require_api_key": False,
"results": 'HTML',
"language": 'pl',
}

categories = ['general']
Expand Down
6 changes: 6 additions & 0 deletions searx/settings.yml
Original file line number Diff line number Diff line change
Expand Up @@ -352,6 +352,9 @@ engines:
use_official_api: false
require_api_key: false
results: HTML
# We don't set language: de here because media.ccc.de is not just
# for a German audience. It contains many English videos and many
# German videos have English subtitles.

- name: ccengine
engine: ccengine
Expand Down Expand Up @@ -1573,6 +1576,7 @@ engines:
use_official_api: false
require_api_key: false
results: HTML
language: ko

- name: rubygems
shortcut: rbg
Expand Down Expand Up @@ -1649,6 +1653,7 @@ engines:
use_official_api: false
require_api_key: false
results: HTML
language: de

- name: słownik języka polskiego
engine: sjp
Expand Down Expand Up @@ -1676,6 +1681,7 @@ engines:
use_official_api: false
require_api_key: false
results: HTML
language: fr

- name: brave
shortcut: brave
Expand Down