Skip to content

Commit

Permalink
chore: Clarify variable names
Browse files Browse the repository at this point in the history
  • Loading branch information
jpmckinney committed Jul 18, 2024
1 parent 05ad2eb commit 54e8b25
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions scrapyd/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,8 +133,10 @@ def get_spider_list(project, runner=None, pythonpath=None, version=''):
return get_spider_list.cache[project][version]
except KeyError:
pass

if runner is None:
runner = Config().get('runner')

env = os.environ.copy()
env['PYTHONIOENCODING'] = 'UTF-8'
env['SCRAPY_PROJECT'] = project
Expand All @@ -149,16 +151,18 @@ def get_spider_list(project, runner=None, pythonpath=None, version=''):
msg = err or out or ''
msg = msg.decode('utf8')
raise RunnerError(msg)

# FIXME: can we reliably decode as UTF-8?
# scrapy list does `print(list)`
tmp = out.decode('utf-8').splitlines()
spiders = out.decode('utf-8').splitlines()
try:
project_cache = get_spider_list.cache[project]
project_cache[version] = tmp
project_cache[version] = spiders
except KeyError:
project_cache = {version: tmp}
project_cache = {version: spiders}
get_spider_list.cache[project] = project_cache
return tmp

return spiders


def _to_native_str(text, encoding='utf-8', errors='strict'):
Expand Down

0 comments on commit 54e8b25

Please sign in to comment.