Comments (23)
THAT'S... NOT... HOW GRAMMAR WORKS
from mediawiki-butt-ruby.
I think a good way to do this would actually involve a major refactor of the existing query stuff.
First, we'd have to make a new query
method, which takes the params (action: 'query'
would come default obviously), as well as a new method argument on all continueable queries continue
with the default value being false.
Then, if continue is true, loop until the continue parameter is not present.
Alternatively, we could use an integer argument and do int.times do
, which would default to 1.
@xbony2 What do you think?
from mediawiki-butt-ruby.
An angel told me this should be worked on.
from mediawiki-butt-ruby.
I still don't know what you think about my ideas for it. I'll work on it once we have a set design, and the limit improvements get finalized.
from mediawiki-butt-ruby.
params = {
"action": "query",
"list": "categorymembers",
"cmtitle": "Category:" + self.category,
"cmlimit": "500",
"cmprop": "title"
}
lastContinue = {"continue": ""}
while True:
par = params.copy()
par.update(lastContinue)
content = self.wiki.call(par)
for page in content["query"]["categorymembers"]:
#doshit
if 'continue' not in content:
break
lastContinue = content["continue"]
(Kris' Python solution)
from mediawiki-butt-ruby.
That's basically what I described in that comment
from mediawiki-butt-ruby.
Only difference is with mine, instead of redefining the variables every time, it just update the param values :P silly eli
Edit: You also want to return ALL the data in one return, since you no can constantly keep returning data's ;o
from mediawiki-butt-ruby.
Only difference is with mine, instead of redefining the variables every time, it just update the param values :P silly eli
I literally didn't say anything about that.
Edit: You also want to return ALL the data in one return, since you no can constantly keep returning data's ;o
I have no idea what you are saying here.
from mediawiki-butt-ruby.
Here's some code in Rust that is pretty robust at doing continue query stuff.
https://github.com/FTB-Gamepedia/mediawiki-rs/blob/master/src/lib.rs#L286-L325
from mediawiki-butt-ruby.
I'll just stick with python >.> Faster, more stable, more powerful lol. Ever managed 16k API calls in 220 seconds with Ruby? ^_^
from mediawiki-butt-ruby.
Um, none of those are true? Ruby is actually faster than python according to most benchmarks you'll find, it's perfectly stable, and can do everything python can do (and vice versa).
from mediawiki-butt-ruby.
Actually, if you want to argue about it, why is pretty much every linux system running python libraries and systems than ruby? Because it /is/ known to be faster in a lot of aspects. :P
Kris out.
from mediawiki-butt-ruby.
I've looked at 5 benchmarks this morning, all of which used older slower versions of ruby, and it was faster in every aspect than all kinds of python except cpython
from mediawiki-butt-ruby.
There are also other benchmarks that put python faster than ruby though. Changing Python code from running globally to in a function can alone speed it up massively (for example), as well as depending on the version of which you use for both of them, so you could easily find a case by case basis for which one was faster if you wanted to, purely based on the way the test you were doing was written.
from mediawiki-butt-ruby.
Meanwhile I just write Rust and I get faster code than both Python and Ruby any day of the week.
from mediawiki-butt-ruby.
Apparently not if you are picking a random lines content out of a given file :)
from mediawiki-butt-ruby.
@elifoster You weren't comparing plain Rust to Ruby, you were comparing calling Rust code from Ruby with all the overhead of that compared to plain Ruby. Also that was you writing Rust, not me writing Rust.
from mediawiki-butt-ruby.
Good points
from mediawiki-butt-ruby.
I've written a query method like the one we were talking about, and you can see it in this section of a commit.
(I'm holding off submitting a pull request until #32 is decided, because GitHub won't let me make a PR with just that commit.)
from mediawiki-butt-ruby.
(see also)
from mediawiki-butt-ruby.
I would just like to say... Waffles
That is all.
from mediawiki-butt-ruby.
https://www.change.org/p/apple-add-a-waffle-emoji
from mediawiki-butt-ruby.
I'm all for working on this change in a separate branch, because, as it was mentioned earlier, a lot of queries are going to have to be changed.
from mediawiki-butt-ruby.
Related Issues (20)
- get_category_members should pass limit last
- `move` redirect param is reversed
- NoMethodError in get_contrib_count HOT 1
- Methods with specified hash arguments have annoying behavior
- NoMethodError in get_templates_in_page for pages without templates
- Make `use_continuation: true` and `assertion: :bot`the default HOT 4
- Export/import API support HOT 3
- Allowing different formats HOT 2
- MW 1.28 / 1.29 support HOT 1
- Change defaults for initialize
- Removal of unnecessary post params
- Logout does not work.
- MW 1.31 Support HOT 1
- MW 1.32 Support
- Remove custom limiting on continued queries HOT 1
- Support uploading local files
- Support protection API HOT 2
- MediaWiki::Utils.encode_url improvements HOT 1
- How do I get a category URL? (article URL too) HOT 4
- get_userlists methods fail with NoMethodError when user does not exist
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mediawiki-butt-ruby.