Ausgabe der neuen DB Einträge
This commit is contained in:
parent
bad48e1627
commit
cfbbb9ee3d
2399 changed files with 843193 additions and 43 deletions
36
venv/lib/python3.9/site-packages/scrapy/utils/template.py
Normal file
36
venv/lib/python3.9/site-packages/scrapy/utils/template.py
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
"""Helper functions for working with templates"""
|
||||
|
||||
import os
|
||||
import re
|
||||
import string
|
||||
|
||||
|
||||
def render_templatefile(path, **kwargs):
|
||||
with open(path, 'rb') as fp:
|
||||
raw = fp.read().decode('utf8')
|
||||
|
||||
content = string.Template(raw).substitute(**kwargs)
|
||||
|
||||
render_path = path[:-len('.tmpl')] if path.endswith('.tmpl') else path
|
||||
|
||||
if path.endswith('.tmpl'):
|
||||
os.rename(path, render_path)
|
||||
|
||||
with open(render_path, 'wb') as fp:
|
||||
fp.write(content.encode('utf8'))
|
||||
|
||||
|
||||
CAMELCASE_INVALID_CHARS = re.compile(r'[^a-zA-Z\d]')
|
||||
|
||||
|
||||
def string_camelcase(string):
|
||||
""" Convert a word to its CamelCase version and remove invalid chars
|
||||
|
||||
>>> string_camelcase('lost-pound')
|
||||
'LostPound'
|
||||
|
||||
>>> string_camelcase('missing_images')
|
||||
'MissingImages'
|
||||
|
||||
"""
|
||||
return CAMELCASE_INVALID_CHARS.sub('', string.title())
|
||||
Loading…
Add table
Add a link
Reference in a new issue