1) What is the preferable shebang? What I have seen are: - #!/usr/bin/python (such as scripts/add_text.py) - #!/usr/bin/env python (such as scripts/archivebot.py) - no shebang (such as scripts/catall.py)
2) Why some scripts (such as blockpageschecker.py) are executable , while the others (such as archivebot.py) are not?
3) Why don't we always use async=True with all scripts? I admit that I don't know whether async has a negative impact, so I asked it here. Anyway, I think that we can add async=True to touch.py, for example, without causing any problem.
4) Which one is preferable between "summary" and "reason"? I think this topic was previously discussed before, but I can't remember the final resolution.
/^ *def [^)]*?(reason|summary)/
page.py
- reason def move(self, newtitle, reason=None, movetalkpage=True, sysop=False, def delete(self, reason=None, prompt=True, mark=False): def protect(self, edit='sysop', move='sysop', create=None, upload=None, unprotect=False, reason=None, prompt=True, expiry=None): def block(self, expiry, reason, anononly=True, nocreate=True,
- summary def removeImage(self, image, put=False, summary=None, safe=True): def replaceImage(self, image, replacement=None, put=False, summary=None,
site.py
- reason def blockuser(self, user, expiry, reason, anononly=True, nocreate=True, def unblockuser(self, user, reason):
- summary def editpage(self, page, summary, minor=True, notminor=False, def movepage(self, page, newtitle, summary, movetalk=True, def deletepage(self, page, summary): def protect(self, page, protections, summary, expiry=None):
scripts in scripts directory
- summary def add_text(page=None, addText=None, summary=None, regexSkip=None, def update(self, summary, sort_threads=False): def __init__(self, generator, always, summary=None): def __init__(self, generator, summary, always=False, undelete=True): def __init__(self, generator, oldImage, newImage=None, summary='', def __init__(self, generator, addprefix, noredirect, movetalkpage, always, skipredirects, summary): def __init__(self, reader, force, append, summary, minor, autosummary, def __init__(self, generator, summary, always=False, unprotect=False, def __init__(self, generator, acceptall=False, limit=None, ignorepdf=False, summary=None): def __init__(self, generator, replacements, exceptions={}, acceptall=False, allowoverlap=False, recursive=False, addedCat=None, sleep=None, summary='', site=None):
Sorawee Porncharoenwase
I dont know much about the history of these decisions, so just my own thoughts...
On Wed, Jun 18, 2014 at 12:15 PM, Sorawee Porncharoenwase nullzero.free@gmail.com wrote:
- What is the preferable shebang? What I have seen are:
- #!/usr/bin/python (such as scripts/add_text.py)
- #!/usr/bin/env python (such as scripts/archivebot.py)
- no shebang (such as scripts/catall.py)
I think '#!/usr/bin/env python' is the most versatile shebang. It fails on systems which do not have env, but on systems with env in the standard location, it allows the python executable to be anywhere.
- Why some scripts (such as blockpageschecker.py) are executable , while
the others (such as archivebot.py) are not?
IMO they should all be executable as they have a main block.
- Why don't we always use async=True with all scripts? I admit that I don't
know whether async has a negative impact, so I asked it here. Anyway, I think that we can add async=True to touch.py, for example, without causing any problem.
No idea. async does use different exception handling, and it probably isnt properly covered by the unit tests.
- Which one is preferable between "summary" and "reason"? I think this
topic was previously discussed before, but I can't remember the final resolution.
The codebase also uses 'comment', even in the config file.
https://gerrit.wikimedia.org/r/#/c/141392/
The API uses 'summary' and the webpage UI uses 'edit summary' - I think 'summary' should be the preferred terminology.
2014-06-24 3:00 GMT+02:00 John Mark Vandenberg jayvdb@gmail.com:
- Why some scripts (such as blockpageschecker.py) are executable , while
the others (such as archivebot.py) are not?
IMO they should all be executable as they have a main block.
What happens if a Windows user uploads a new script? I don't have experience with Linux.
- Why don't we always use async=True with all scripts? I admit that I
don't
know whether async has a negative impact, so I asked it here. Anyway, I think that we can add async=True to touch.py, for example, without
causing
any problem.
No idea. async does use different exception handling, and it probably isnt properly covered by the unit tests.
Checking the result of command is more complicated in async mode, isn't it?
- Which one is preferable between "summary" and "reason"? I think this
topic was previously discussed before, but I can't remember the final resolution.
The codebase also uses 'comment', even in the config file.
https://gerrit.wikimedia.org/r/#/c/141392/
The API uses 'summary' and the webpage UI uses 'edit summary' - I think 'summary' should be the preferred terminology.
For blocking/unblocking/protecting/unprotecting reason is the appropriate word. For page editing, summary. This is also the way MW itself uses for human users.
----- Original Nachricht ---- Von: Sorawee Porncharoenwase nullzero.free@gmail.com An: Pywikipedia discussion list pywikipedia-l@lists.wikimedia.org Datum: 18.06.2014 07:15 Betreff: [Pywikipedia-l] Several questions (mainly about guideline)
- Why don't we always use async=True with all scripts? I admit that I
don't know whether async has a negative impact, so I asked it here. Anyway, I think that we can add async=True to touch.py, for example, without causing any problem.
I guess that would not make any sense for touch.py because this is a simple script which loads pages in bulk and puts it back. There would not be any performance advantage with putting asynchronously in that case.
xqt
pywikipedia-l@lists.wikimedia.org