[Cloud] Re: Update your tool's code to prepare for temporary accounts

2024-05-21 Thread Roy Smith
Is it possible this is what's been causing https://phabricator.wikimedia.org/T318479? > On May 21, 2024, at 8:55 AM, Szymon Grabarczuk > wrote: > > Hello everyone, > > I am reaching out on behalf of the Wikimedia Foundation Trust and Safety > Product

[pywikibot] How to make mwparserfromhell recognize __TOC__

2024-04-08 Thread Roy Smith
If I do: wikicode = mwparserfromhell.parse("This is\n__TOC__\nan article.") I get back a single Text node. For what I'm doing, it would be really convenient to have the __TOC__ be parsed as it's own node, i.e. instead of a single Text node with 'This is\n__TOC__\nan article.', I'd like to

[pywikibot] Re: Path between a category and an article

2024-04-03 Thread Roy Smith
I once went down a similar rathole. I was trying to find all article which were (recursively) in Category:Music. That's when I discovered just what a mess the wiki category graph is. At first glance, it looks like a tree, but it's not. It's not even a DAG. It has cycles! And not just "it

[pywikibot] Re: Argument to IsRedirectPageError?

2024-04-01 Thread Roy Smith
tation is wrong. I will > try to find out what was really meant; maybe the compat release can give a > hint. > > Thanks for investigating. > > xqt > > > > Am 31.03.2024 um 17:34 schrieb Roy Smith : > > > > The docs for BasePage.get() say: > > >

[pywikibot] Argument to IsRedirectPageError?

2024-03-31 Thread Roy Smith
The docs for BasePage.get() say: pywikibot.exceptions.IsRedirectPageError – The page is a redirect. The argument of the exception is the title of the page it redirects to. but that doesn't seem to be what's actually happening: > from pywikibot import Site, Page > from pywikibot.exceptions

[pywikibot] Getting Node location in mwparserfromhell?

2024-03-28 Thread Roy Smith
If I've got a Node out of Wikicode.filter(), is there a way to map that back to a location in the original parsed wikitext? Ideally, character offsets for the start and end of the text that makes up the Node. ___ pywikibot mailing list --

[pywikibot] Variable not allowed in type expression?

2024-03-08 Thread Roy Smith
I'm trying to single-step through pywikibot using vscode. I've got: certifi==2024.2.2 charset-normalizer==3.3.2 idna==3.6 iniconfig==2.0.0 mwparserfromhell==0.6.6 packaging==23.2 pluggy==1.4.0 pytest==8.0.2 pytest-mock==3.12.0 pywikibot==8.6.0 requests==2.31.0 urllib3==2.2.1 vscode: Version:

[Cloud] Horizon: pause vs suspend vs shelve?

2024-01-31 Thread Roy Smith
I have a VPS instance that I think can be shut down. What I want to do is shut it down in a way that I can restart it again without losing anything, but not yet commit to deleting it. The idea is to leave it in that state for a while just to make sure there's no dependencies on it that i've

[Cloud] Expired certificate?

2023-12-19 Thread Roy Smith
Poking around on my debian bookworm instance, I found /usr/local/share/ca-certificates/wmf_ca_2017_2020.crt, which looks like an expired SSL certificate: > Certificate: > Data: > Version: 3 (0x2) > Serial Number: > 9f:14:76:9e:ea:f4:18:c3 > Signature

[Cloud] Re: Installing elasticsearch on a VPS instance?

2023-12-19 Thread Roy Smith
Yup, that did it. I resized it to g3.cores1.ram2.disk20 and now I’m running. Thanks. > On Dec 19, 2023, at 10:54 AM, Francesco Negri wrote: > > On Tue, Dec 19, 2023 at 4:41 PM Roy Smith wrote: >> >> I installed per the instructions at >> https://opensea

[Cloud] Re: Installing elasticsearch on a VPS instance?

2023-12-19 Thread Roy Smith
kworm instance I just spun up for this. The only configuration I’ve done was to increase vm.max_map_count per their recommendation: > $ cat /proc/sys/vm/max_map_count > 262144 Any ideas? > On Dec 18, 2023, at 6:08 AM, Francesco Negri wrote: > > On Sun, Dec 17, 2023 at 10:04

[Cloud] Re: Installing elasticsearch on a VPS instance?

2023-12-18 Thread Roy Smith
17, 2023 at 10:04 PM Roy Smith wrote: >> I want to install elasticsearch on a VPS instance. I’m guessing this >> involves puppet, but can’t figure out the details. The instructions at >> https://wikitech.wikimedia.org/wiki/Help:Puppet don’t match what I’m >>

[Cloud] Fwd: Installing elasticsearch on a VPS instance?

2023-12-17 Thread Roy Smith
Trying this again without the screenshot, which got stuck in the filters. > Begin forwarded message: > > From: Roy Smith > Subject: Installing elasticsearch on a VPS instance? > Date: December 17, 2023 at 4:00:08 PM EST > To: Wikimedia Cloud Services general discussion and

Re: [xubuntu-users] Strange, how to delete mails?

2023-11-13 Thread Chris Roy-Smith
On 14/11/23 09:35, Marc Coevoet wrote: Hello, I just installed linux on a I5 mac (2012, now with 16gb memory).. Now I cannot delete mails, there is no delete button, and when searching internet, they say, the backspace will work as delete, but not in thunderbird ... To work fast, I need a

[Cloud] Re: Webservice logs?

2023-10-06 Thread Roy Smith
though, as usual, it's > really hard to promise anything). I expect that project will be tracked in > subtasks of T127367 <https://phabricator.wikimedia.org/T127367> once there's > anything beyond a very rough idea. > > Taavi > > On Thu, Oct 5, 2023 at 9:10 P

[Cloud] Webservice logs?

2023-10-05 Thread Roy Smith
I see T336057 was just closed. Looking at the docs , I'm unclear how this works. The docs say ", the output from the webservice command is stored by the Toolforge Kubernetes infrastructure as long as the web

Re: error of opening Python

2023-09-26 Thread Chris Roy-Smith via Python-list
On 26/9/23 22:27, Abdelkhelk ashref salay eabakh via Python-list wrote: Dear Python team, This is my not first time using Python, I tried to launch Python and it showed I'm no expert but "Python 3.11.3 (tags/v3.11.3:f3909b8, Apr 4 2023, 23:49:59) [MSC v.1934 64 bit (AMD64)] on win

[pywikibot] Testing against a docker-based wiki?

2023-08-31 Thread Roy Smith
I periodically struggle with finding a good way to write unit tests for a pywikibot app. I've come to the conclusion that using unittest.mock to patch calls into pywikibot is just not the way to go. It's certainly hermetic, but the overhead of building tests is so high, it doesn't seem worth

[pywikibot] Re: Problems submitting a patch

2023-06-27 Thread Roy Smith
the years, but somehow managed to never use git until fairly recently and I'm still getting up to speed on ithe fancier stuff. Thanks for the help. > On Jun 26, 2023, at 1:44 PM, YiFei Zhu wrote: > > On Mon, Jun 26, 2023 at 8:51 AM Roy Smith <mailto:r...@panix.co

[pywikibot] Re: Testing against live wikis

2023-06-26 Thread Roy Smith
> On Jun 26, 2023, at 4:17 PM, Merlijn van Deen (valhallasw) > wrote: > > , there is a massive value in tests that test the integration with Wikimedia > wikis: it's great if mocked API calls work, but if it breaks against the real > API, Pywikibot is not doing its job for the user.

[pywikibot] Problems submitting a patch

2023-06-26 Thread Roy Smith
I'm trying to follow the directions at https://www.mediawiki.org/wiki/Gerrit/Tutorial#How_to_submit_a_patch I made a branch (roysmith-T340447) and committed my patch there. Then I did "git pull --rebase origin master", but

[pywikibot] Testing against live wikis

2023-06-25 Thread Roy Smith
I noticed that category_tests.py was failing for me. The breakage was due to this edit on enwiki , and fixed in ce301a2

[pywikibot] Re: the test environment?

2023-05-17 Thread Roy Smith
> On May 15, 2023, at 3:11 PM, YiFei Zhu wrote: > > having tests depend on user-supplied user-config.py is just > ... broken. I hear you! So, still trying to find my way around the test suite, I see appveyor.yml. I don't know anything about Appveyor, but it looks like this is building a

[pywikibot] the test environment?

2023-05-15 Thread Roy Smith
The past few days, I've worked on T336630 and T336624, both of which describe failures I was seeing which other people weren't. In both cases, it turned out to be caused by something in my user-config.py. Many of these tests also rely on external resources (i.e. live testing against testwiki

[pywikibot] test_follow_redirects fails

2023-05-11 Thread Roy Smith
I've checked out /pywikibot/core.git. When I run the tests, I get a number of failures: FAILED tests/http_tests.py::TestHttpStatus::test_follow_redirects - AssertionError: '//en.wikipedia.org/wiki/Main_Page' not found in 'https://en.wikipedia.org/wiki/Main%20Page' FAILED

[pywikibot] Re: Place for Wikipedia in the framework

2023-03-31 Thread Roy Smith
I'm relatively new to pywikibot, so I'm not really familiar with the culture of the project, i.e. which new features are accepted and which are rejected. But, yes, I did comment on the phab ticket that I thought this didn't belong as a part of the Page class. Let me give some of my more

[Cloud] Re: [Cloud-announce] Toolforge Kubernetes upgrade on 2023-04-03 (new date: 2023-04-10)

2023-03-30 Thread Roy Smith
Just to make sure I'm clear, the downtime announced yesterday is still happening? > On Mar 30, 2023, at 6:42 AM, Arturo Borrero Gonzalez > wrote: > > On 3/28/23 00:13,

[pywikibot] Re: Parallel gets?

2023-03-28 Thread Roy Smith
one is the one that counts. > On Mar 28, 2023, at 10:57 PM, John wrote: > > If you are looking to check for image/file usage it’s better to query the api > for just image used images instead of trying to parse wiki text > > On Tue, Mar 28, 2023 at 10:29 PM Roy Smith <

[pywikibot] Re: Parallel gets?

2023-03-28 Thread Roy Smith
On Mar 28, 2023, at 9:09 PM, Kunal Mehta wrote: > I suppose it's also worth asking what you're using expand_text() for in the > first place, to see if there's a better way to do whatever it is you want to > :) That's a fair question. What I'm doing is looking at DYK nominations to evaluate

[pywikibot] Re: Parallel gets?

2023-03-28 Thread Roy Smith
Without the screenshot this time > On Mar 28, 2023, at 2:01 PM, Roy Smith wrote: > > Hmmm. What I'm doing requires Page.expand_text(), which looks like it does a > Page.get() followed by a Site.expand_text(), and it's the later which > actually takes most of the time

[pywikibot] Re: Parallel gets?

2023-03-27 Thread Roy Smith
Mostly for the sake of the archives, I ended up with this , which is pretty much straight out of the example in the python library manual: > def _is_approved(nom): > return

[Cloud] Redis vulnerabilities

2023-03-27 Thread Roy Smith
There's a couple of new vulnerabilities for redis that were just published, which people should be aware of: https://nvd.nist.gov/vuln/detail/CVE-2023-28858 https://nvd.nist.gov/vuln/detail/CVE-2023-28859

[pywikibot] Re: Parallel gets?

2023-03-27 Thread Roy Smith
gt; > Best > xqt > >> Am 27.03.2023 um 22:06 schrieb John : >> >>  >> I’ve not checked in the v3+ version but there used to be a preload page >> generator that batch retrieved stuff from the API. Then pass the preloaded >> page object on to the

[pywikibot] Parallel gets?

2023-03-27 Thread Roy Smith
I need to issue a bunch of Page.get() requests in parallel. My understanding is that pywikibot uses the requests library which is incompatible with async_io, so that's out. So what do people use? Threading ? Or, I see there's an async_io

[pywikibot] How to get enclosing section with mwparserfromhell?

2023-03-23 Thread Roy Smith
To my surprise, wikicode.get_parent() does not get you the section a node is part of: > import mwparserfromhell as mwp > > text = """==foo== > {{Template:Foo}} > """ > wikicode = mwp.parse(text) > print(wikicode.get_tree()) > > print('++') > > node = wikicode.nodes[-2] >

[pywikibot] Re: How to avoid leaving extra blank lines when removing templates?

2023-03-21 Thread Roy Smith
tected the > template you want to delete, set a flag, and delete following text nodes, > until the next template node is detected. > > On Tue, 21 Mar 2023, 18:28 Roy Smith, <mailto:r...@panix.com>> wrote: > I've got some code which is essentially: >

[pywikibot] How to avoid leaving extra blank lines when removing templates?

2023-03-21 Thread Roy Smith
I've got some code which is essentially: > wikicode = mwp.parse(self.page.get()) > for node in wikicode.filter_templates(recursive=False, matches=title): > wikicode.remove(node) > self.page.text = str(wikicode) > self.page.save() which works, but it

[pywikibot] Failing unit tests?

2023-03-11 Thread Roy Smith
I'm gearing up to do some work (hopefully dive into fixing https://phabricator.wikimedia.org/T326650). I've gotten as far as closing the repo and running the existing unit tests. I get 4 failures: FAILED tests/make_dist_tests.py::TestMakeDist::test_handle_args - AssertionError:

[pywikibot] Re: Multiple users in user-config.py?

2023-02-26 Thread Roy Smith
Hmmm. I was reading through that code earlier today, and I assumed I was just in the wrong place. I got as far as: >exec(compile(f.read(), _filename, 'exec'), _exec_globals) and paused. I had been wondering about how user-config.py was getting imported, since that's not a valid module

[pywikibot] Re: Multiple users in user-config.py?

2023-02-26 Thread Roy Smith
: Bináris > Gesendet: 24.02.2023 04:27 > An: Pywikibot discussion list > Betreff: [pywikibot] Re: Multiple users in user-config.py? > > > > Roy Smith mailto:r...@panix.com>> ezt írta (időpont: 2023. > febr. 24., P, 0:42): > My bot needs to be abl

[pywikibot] Re: Multiple users in user-config.py?

2023-02-24 Thread Roy Smith
__init__ > raise NoUsernameError( > pywikibot.exceptions.NoUsernameError: ERROR: username for wikipedia:test is > undefined. > If you have a username for that site, please add a line to user config file > (user_config.py) as follows: > usernames['wikipedia']['test'] = 'myUser

[pywikibot] Multiple users in user-config.py?

2023-02-23 Thread Roy Smith
My bot needs to be able to run as either of two different accounts depending on the task. DYKToolsBot for most things, DYKToolsAdminBot for specific tasks that need admin rights. How do I do this? I'm not using the pwb.py driver layer; I've got my own top-level driver code and just import

[pywikibot] Re: Checkuser

2023-02-23 Thread Roy Smith
It's based on mwclient instead of pywikibot, but I do have some code that uses the checkuserlog API. https://github.com/roysmith/spi-tools/blob/2080f436d6aeb7d49346241c3dfa356d479b2d19/wiki_interface/wiki.py#L389

[pywikibot] Re: Unable to commit

2023-02-20 Thread Roy Smith
. > On Feb 20, 2023, at 12:21 PM, Roy Smith wrote: > > I've used a few VCS's in my time. Unless I've forgotten something, RCS, CVS, > SVN, ClearCase, Perforce, hg, and most recently git. I can't argue that git > is complicated. Probably more complicated than most people need.

[pywikibot] Re: Unable to commit

2023-02-20 Thread Roy Smith
I've used a few VCS's in my time. Unless I've forgotten something, RCS, CVS, SVN, ClearCase, Perforce, hg, and most recently git. I can't argue that git is complicated. Probably more complicated than most people need. > On Feb 20, 2023, at 12:11 PM, i...@gno.de wrote: > > Hi Binaris, > > I

[Cloud] Does an account rename invalidate OAuth keys?

2023-02-18 Thread Roy Smith
I've got a tool user DKY-Tools-Bot, that I want to rename to be DYKToolsBot. I've got two sets of OAuth keys: https://meta.wikimedia.org/wiki/Special:OAuthListConsumers/view/f1a1f081a16a1261b0ee99e61e172a5f

[Cloud] Re: ssh to tool account?

2023-02-15 Thread Roy Smith
in phab). > On Feb 15, 2023, at 9:50 AM, Taavi Väänänen wrote: > > On 2/15/23 16:37, Roy Smith wrote: >> Am I just doing something wrong, or is toolforge set up to disallow that? > > Yes, all of Cloud VPS (including Toolforge) is configured to only load SSH > keys fr

[Cloud] ssh to tool account?

2023-02-15 Thread Roy Smith
I'm trying to simplify my life by avoiding having to log in to my own account on a toolforge bastion and then become my tool. I tried dropping my public key into $HOME/.ssh/authorized_keys for my tool, but that doesn't work: > $ ssh -t tools.dyk-to...@dev.toolforge.org >

[pywikibot] Re: Alternative tags for italic and bold with mwparserfromhell?

2023-02-06 Thread Roy Smith
Cool, thanks. > On Feb 6, 2023, at 8:05 PM, Kunal Mehta wrote: > > Hi, > > On 2/6/23 18:59, Roy Smith wrote: >> That only works on the content of an entire page, doesn't it? I've just got >> a short snippet of wikitext that I've already parsed out of a page.

[pywikibot] Re: Alternative tags for italic and bold with mwparserfromhell?

2023-02-06 Thread Roy Smith
That only works on the content of an entire page, doesn't it? I've just got a short snippet of wikitext that I've already parsed out of a page. Specifically, a proposed DYK hook, such as: > that '''[[Edward A. Hanna]]''' wanted to eliminate the [[New York State > Assembly]] while he served

[pywikibot] Alternative tags for italic and bold with mwparserfromhell?

2023-02-06 Thread Roy Smith
I want to turn wikitext into HTML for display on a web front-end I'm building. For what I'm doing, all I need is a few constructs like wiklinks, bold, and italic, which I'm able to do with a smallish amount of mwparserfromhell code. The one annoyance I've got now is I'm using bootstrap

[pywikibot] How to ignore all the non-visible stuff?

2023-02-04 Thread Roy Smith
[[:en:Template:Did you know/Queue/NextPrep]] contains: > 4 > {{documentation|content=This number indicates the next DYK prep set to move > into the queue.}} > What I want to get is just the "4". Is Page.extract() what I'm looking for? Experimentally, it does what I want, but it's not clear

[pywikibot] Re: Text between two comments?

2023-02-02 Thread Roy Smith
start and end represent comment objects you found from > wikicode.filter_comments() > start_index = wikicode.index(start) > end_index = wikicode.index(end) > inside = wikicode.nodes[start_index:end_index] > > > On Thu, Feb 2, 2023 at 3:39 PM Roy Smith <mailto:r...@panix.com>> wrote

[pywikibot] Text between two comments?

2023-02-02 Thread Roy Smith
I'm trying to parse DYK prep area templates, for example Template:Did you know/Preparation area 3 . Unfortunately, these are more like flat text files than any kind of nicely structured data. The stuff of interest is

[Cloud] Re: Scratch database instance?

2023-01-25 Thread Roy Smith
string, but to compute a hash, store that as a separate column, and index the hash. Which feels like I'm working for the database instead of the other way around. > On Jan 25, 2023, at 3:52 PM, Daniel Zahn wrote: > > On Wed, Jan 25, 2023 at 12:33 PM Roy Smith wrote: >> >> Than

[Cloud] Re: Scratch database instance?

2023-01-25 Thread Roy Smith
Thanks. This field is intended to hold a wikipedia page title (including the namespace). Would 255 be long enough to hold any legal title? > On Jan 25, 2023, at 11:53 AM, Daniel Zahn wrote: > > Yea, it's variable length but it still wants you to give it a maximum length.

[Cloud] Scratch database instance?

2023-01-25 Thread Roy Smith
I just discovered that some code I've been working on, which passes all its unit tests against sqllite, fails when I run it against tools.db.svc.wikimedia.cloud. It's apparently due differences in the two drivers (see for example, this bug ).

[pywikibot] Pruning category search?

2023-01-14 Thread Roy Smith
Is there a way to recurse through a category, but excluding specific sub-cats? For example, I want to find all the templates in [[Category:People and person infobox templates]], except that I don't want to recurse into [[Category:Styles infobox templates]].

[pywikibot] Re: Viztracer

2023-01-13 Thread Roy Smith
I see my original message was held up in moderation due to the large attachment. I've uploaded the image to File:Screenshot of viztracer output.png <https://commons.wikimedia.org/wiki/File:Screenshot_of_viztracer_output.png> > On Jan 13, 2023, at 6:38 PM, Roy Smith wrote: >

[pywikibot] Re: Simplifying logging?

2023-01-10 Thread Roy Smith
I've opened https://phabricator.wikimedia.org/T326650 <https://phabricator.wikimedia.org/T326650> on this. > On Jan 4, 2023, at 7:25 PM, Roy Smith wrote: > > PS, quoting from > https://docs.python.org/3.9/howto/logging.html#logging-advanced-tutorial > <https://d

[pywikibot] Re: Simplifying logging?

2023-01-04 Thread Roy Smith
you might well interfere with their ability to carry out > unit tests and deliver logs which suit their requirements. > On Jan 4, 2023, at 7:14 PM, Roy Smith wrote: > > Pywikibot, even if you're just using it as a library, configures its own > complicated logging structure: >

[pywikibot] Simplifying logging?

2023-01-04 Thread Roy Smith
Pywikibot, even if you're just using it as a library, configures its own complicated logging structure: o "pywiki" | Level Level 11 | Propagate OFF | Handler (INFO)> | Level INFO | Filter | Formatter fmt='%(message)s%(newline)s' datefmt=None |

[pywikibot] OAuth errors?

2023-01-04 Thread Roy Smith
I found these in my dykbot-cron.err file. What causes this? Is it something to worry about? WARNING: API error mwoauth-invalid-authorization: The authorization headers in your request are not valid: Nonce already used: ERROR: Retrying failed OAuth authentication for wikipedia:en: The

[Cloud] Re: Migrating to a newer VPS image?

2023-01-03 Thread Roy Smith
Will do, thanks. > On Jan 3, 2023, at 10:56 AM, Bryan Davis wrote: > > On Tue, Jan 3, 2023 at 8:54 AM Roy Smith wrote: >> >> Putting it on a volume sounds like a plan, thanks. For now, there wasn't a >> whole lot of data, so scp was good enough. >> >&g

[Cloud] Re: Migrating to a newer VPS image?

2023-01-03 Thread Roy Smith
ittle >> quicker? (i.e., mount it on the old instance, copy the data to it, remount >> it on the new instance, copy the data off) >> >> >> >> Kind regards, >> Sammy >> >> >> On Tue, 3 Jan 2023, 10:10 Roy Smith, wrote: >> >>&

[pywikibot] Next node?

2023-01-01 Thread Roy Smith
Let's say I've got the following wikitext: Some stuff More stuff {{MyTemplate}} Blah Blah I want to find {{MyTemplate}} but only if it's immediately followed by , and insert something after the comment. Is there anything that does that kind of pattern matching? I can use mwparserfromhell to

Re: NoneType List

2022-12-31 Thread Chris Roy-Smith
On 31/12/22 16:45, Goran Ikac wrote: Happy New Year, everybody! I'm new in the Python List, new in Python world, and new in coding. A few days (weeks?) ago, I faced a problem trying to write a program for an exercise. I asked for help and nobody answered. In the meantime, I found a part of the

[pywikibot] Re: How to install in toolforge?

2022-12-29 Thread Roy Smith
handy. > On Dec 29, 2022, at 3:43 AM, Kunal Mehta wrote: > > Hi, > > On 12/28/22 10:31, Roy Smith wrote: >> How do people install their bots into toolforge? In the past, I've just >> done a "git pull" to the bastion host and run with the code directl

[Cloud] Re: Proposing a Tool sweep

2022-12-29 Thread Roy Smith
It seems like all of those checks could be automated. Have we reached the point where "source code published somewhere" is synonymous with "in a publicly accessible git repo"? > On Dec 29, 2022, at 4:02 AM, Kunal Mehta wrote: > > Hi everyone, > > tl;dr:

[pywikibot] How to install in toolforge?

2022-12-28 Thread Roy Smith
How do people install their bots into toolforge? In the past, I've just done a "git pull" to the bastion host and run with the code directly out of the source tree, but I'm not sure that's a good plan. My current project is a more complicated, with a bot that I'm going to run on krb as a

[pywikibot] Re: What IDE for Mac desktop?

2022-12-27 Thread Roy Smith
Well, I've been using vs code for a month now, and I gotta say (much to my surprise) I'm really happy with it. I keep learning new tricks. TIL that you can configure the file explorer to ignore things like build temp directories, egg-info files, etc. But even cooler than that, there's a

[pywikibot] How to edit template parameters?

2022-12-21 Thread Roy Smith
I'm trying to implement the idea that was suggested in this edit. I see how I can find the existing {{DYK-Tools-Bot was here}}, with Page.templatesWithParams(). But once I've

[pywikibot] Re: What's with the APISite.encodings() magic?

2022-12-13 Thread Roy Smith
only e.g. site.encodings() > calls site.family.encodings(site.code). > > Best > xqt > >> Am 12.12.2022 um 02:50 schrieb Roy Smith : >> >> I've been beating my head against the wall trying to figure out how to >> build a Mock of APISite. If I do the obvious: &g

[pywikibot] What's with the APISite.encodings() magic?

2022-12-11 Thread Roy Smith
I've been beating my head against the wall trying to figure out how to build a Mock of APISite. If I do the obvious: site = mocker.MagicMock(spec=APISite) I end up with: > AttributeError: Mock object has no attribute 'encodings' Yet, if I hand-build a Site object, sure enough it does:

[pywikibot] Re: pywikibot is making a mockery of my tests

2022-11-29 Thread Roy Smith
I'll just chalk that up to "Every time I finally think I understand how unittest.mock works, I discover something new". > On Nov 29, 2022, at 10:49 AM, Roy Smith wrote: > > That's a good observation, thanks, but fixing that doesn't change anything. > This: > > def t

[pywikibot] Re: pywikibot is making a mockery of my tests

2022-11-29 Thread Roy Smith
be changed. Either change ` assert > site.xxyyzz ` to ` assert mock_Site.xxyyzz ` or ` assert > mock_IPv4Address.xxyyzz ` to ` assert ip.xxyyzz `. > > On Tue, Nov 29, 2022 at 5:19 AM Roy Smith <mailto:r...@panix.com>> wrote: > I've got: > > platform darwin -- Pyt

[pywikibot] pywikibot is making a mockery of my tests

2022-11-28 Thread Roy Smith
I've got: platform darwin -- Python 3.9.13, pytest-7.2.0, pluggy-1.0.0 rootdir: /Users/roy/dev/dyk-tools, configfile: src/pages/pytest.ini plugins: mock-3.10.0, socket-0.5.1 When I run the following: def test_ip(mocker): mock_IPv4Address = mocker.patch('ipaddress.IPv4Address',

[pywikibot] Re: What IDE for Mac desktop?

2022-11-28 Thread Roy Smith
Es because, despite once > being a bit of an open source zealot, I've been thoroughly snared by MS. > > On Sat, 26 Nov 2022 at 20:47, Roy Smith <mailto:r...@panix.com>> wrote: > I never thought I'd ever write this, but after close to 40 years of using > emacs for everythi

[pywikibot] What IDE for Mac desktop?

2022-11-26 Thread Roy Smith
I never thought I'd ever write this, but after close to 40 years of using emacs for everything, I'm thinking of switching to a real IDE for python development. My latest evolution is emacs with elpy, which is pretty powerful as these things go, but I seem to spend more time configuring emacs

[pywikibot] Application testing strategies?

2022-11-18 Thread Roy Smith
I'm diving into my first serious PWB application. I'm using it as a library to replace mwclient. I'm not sure how to approach testing. I'd really like something which is isolated from making actual API calls (i.e. hermetic unit tests). Does there exist a mechanism to do that? What I've

[pywikibot] Re: How to analyze block logs?

2022-11-02 Thread Roy Smith
There's a bunch of block reason templates such as {{blocked proxy}}, {{webhostblock}}, etc. They don't always get used, but they're good things to look for before you fall back to just comment_text like '%proxy%' I don't think you need to check for ipb_expiry != 'infinity'. People who know

[pywikibot] Re: How to analyze block logs?

2022-11-01 Thread Roy Smith
You may be able to do this with a SQL query against the database. https://quarry.wmcloud.org/query/68543 I think this does what you want, with the proviso that once a block expires, it falls out of the ipblocks table, so you'll be able to see blocks that

Re: [xubuntu-users] exec program kcmshell5 kcm_trash not found in path

2022-10-22 Thread Chris Roy-Smith
On 23/10/22 12:03, Phil wrote: The menu editor displays the above error message and I'm wondering if this is something that should concern me or not. Another file was also showing the same message and to stop that I changed the permission of that file. So far I've not been able to locate

[Cloud] Need ideas for debugging wedged web service (toolforge)

2022-10-20 Thread Roy Smith
spi-tools and spi-tools-dev both occasionally get wedged. HTTP requests just hang and eventually time out with a 50x. Nothing gets logged in either my django application log, or in uwsgi.log. If I restart the service, things are fine until it happens again. Any ideas how I can get better

[Cloud] My logs turned into .nfs files, what's going on?

2022-09-29 Thread Roy Smith
Yesterday, I reported some log messages in T318479 : logs/django/django.log.2022-09-27:2022-09-28 16:43:39,873 [76e999afc82c10fb99b6c9bf76448d1a] INFO tools_app.middleware: IndexView() logs/django/django.log.2022-09-27:2022-09-28 16:59:18,903

[Cloud] Problems with Redis?

2022-09-19 Thread Roy Smith
Is there an issue with the Toolforge redis server? Every so often, I get connection timeouts: django.log.2022-09-10:2022-09-11 18:31:17,239 [0b5fd61ed67203bfe290ca99fcb52e1e] ERROR tools_app.redis: Redis ConnectionError: Error while reading from socket: (110, 'Connection timed out')

[Wikitech-l] Fwd: StrikerBot invited you to join GitLab

2022-09-07 Thread Roy Smith
I just got the attached email. Is this just fishing, or is this actually some wikimedia thing for real? I host spi-tools in github. I have no plans to move it to gitlab. Why has somebody created it on gitlab for me and invited me to be an owner? > Begin forwarded message: > > From:

[Wikitech-l] Re: Outreachy Round 25–call for projects and mentors now open!

2022-09-07 Thread Roy Smith
On Sep 7, 2022, at 4:50 PM, novemling...@gmail.com wrote: > > - FTP programs that aren't WinSCP with "environment -> SFTP -> server -> sudo > -u tools.novem-bot /usr/lib/sftp-server" configured appear to the user to > work, but create some hard-to-track-down bugs because files have the wrong >

[Wikitech-l] Re: Outreachy Round 25–call for projects and mentors now open!

2022-09-07 Thread Roy Smith
The biggest issues I see are the lack of any good logging, monitoring and alerting tools. Things like icinga, logstash, grafina. The kind of things that are standard for supporting any production system. I've raised this before, so I won't belabor the point here. And

[Wikitech-l] Re: Outreachy Round 25–call for projects and mentors now open!

2022-09-07 Thread Roy Smith
Just from my personal experience, I see django as a good "batteries included" solution that lets you get something up and running quickly because it gives you all the pieces in one package. But I've found that I tend to actually use very little of it. I tend not to use the django

[Wikitech-l] Re: Outreachy Round 25–call for projects and mentors now open!

2022-09-06 Thread Roy Smith
Hi. I might be interested. I'm expert in Python, and have some experience with Flask. I'm the author of spi-tools , which was done in Django, but I've come around to thinking that Flask probably would have been a better choice. I have minimal front-end

[pywikibot] Re: authenticate as bot and sysop

2022-09-05 Thread Roy Smith
I'm a total newbie at pywikibot, but let me address the general issue of putting credentials in config files. Be very wary of how you store credentials. You should make sure they're in a file which is read-protected, and not in source control. Otherwise the entire world will have access to

Re: [xubuntu-users] client ssh for Xubuntu

2022-08-12 Thread Chris Roy-Smith
On 12/8/22 20:16, Alessandro Lin wrote: Hi all, I'm new to xubuntu and I'm learning. Now I need an ssh client to reach a remote server. Any suggestions? Hi Alessandro, the ssh client is installed by default, just use "ssh user@taget.address" to connect. regards, Chris With windows I

[pywikibot] Does total always mean the same thing?

2022-07-20 Thread Roy Smith
I'm just starting to use pywikibot. I see that many of the methods of site have an optional "total" argument. In some places, it's documented as: > if not None, limit the generator to yielding this many items in total In other methods, it just says: > number of pages to return In some

[Wikitech-l] Re: [breaking change] Upgrading to Elasticsarch 7.10 — breaking changes for Cloudelastic, API Feature Usage

2022-07-18 Thread Roy Smith
What are the user-visible changes in 7.10? More specifically, does this address the lack of access control I discussed in https://wikitech.wikimedia.org/wiki/Help_talk:Toolforge/Elasticsearch? > On Jul 18, 2022, at 3:23 PM, Mike Pham wrote: > > Hi all, > > I originally sent this email out

[Cloud] Password change on wikitech?

2022-06-28 Thread Roy Smith
I couldn't log into wikitech or horizon this morning. A password reset fixed the problem. Did something happen to invalidate passwords? ___ Cloud mailing list -- cloud@lists.wikimedia.org List information:

[Wikitech-l] Re: How to get Top 1000 contributors list?

2022-06-25 Thread Roy Smith
This should do it: https://quarry.wmcloud.org/query/65641 In general, this is an inefficient query because user_editcount isn't indexed. Fortunately, tawiki has a relatively small number of users, so it works. Running the same query on a much larger

[Cloud] How to get django to serve robots.txt in toolforge?

2022-06-18 Thread Roy Smith
I want to serve a robots.txt file from my django app (spt-tools). My settings.py file has: STATIC_ROOT = f'{WWW_DIR}/static/' so when I run "manage.py collectstatic", robots.txt ends up in $HOME/www/static/robots.txt. It needs to be one directory level up from there. I can think of

[Cloud] Custom puppet class?

2022-05-31 Thread Roy Smith
I want to set up a custom rsyslog config on my spi-tools VPS instance. I know what I want to end up with, but I'm trying to get it puppetized. It's not really clear what I need to do. Do I really need to set up my own standalone puppetmaster

[Cloud] Re: Connecting from Toolforge to VPS?

2022-05-26 Thread Roy Smith
On May 25, 2022, at 3:03 PM, Roy Smith wrote: > > OK, got that sorted out and tested with netcat, thanks. > > Now I just need to sort out some hand-to-hand combat with rsyslog configs > <https://serverfault.com/questions/1101795/messages-sent-to-unix-socket-get-logged-but-not

  1   2   3   4   5   6   7   8   9   10   >