# -*- coding: utf-8 -*-
import pywikibot
site = pywikibot.Site("wikidata", "wikidata")
repo = site.data_repository()
# Q42 has P19 Q350
item = pywikibot.ItemPage(repo, u"Q42")
claim = pywikibot.Claim(repo, u'P19')
target = pywikibot.ItemPage(repo, u"Q350")
claim.setTarget(target)
List of must known useful libraries in python
- requests (http client for humans)
- mysqlclient (using mysql)
- attrdict (dict as object and object as dict)
Probably the most famous http client for python.
Project page: http://docs.python-requests.org/en/master/
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Show hidden characters
{ | |
// Line endings | |
"show_line_endings": true, | |
"alert_when_line_ending_is": [ "Windows" ], | |
"auto_convert_line_endings_to": "Unix", | |
"ensure_newline_at_eof_on_save": true, | |
// Spaces and indentation | |
"detect_indentation": true, | |
"draw_white_space": "all", |
To read: https://gist.github.com/mangecoeur/9540178
Parallel computing can be done in many ways including:
- using multiple processus, based on
fork()
. This will yield different result on Windows because Windows do not havefork()
system call. I would recommand not using this if you want compatibility on Windows. - using multiple threads.
Most python libraries for parallel computing provides a way to use a pool of work in order to map a given list x
with a function f
. The computation of all the f(x[i])
will be automatically scheduled on the pool of worker (and done in parallel if possible).
Here is two simple ways to use this map
methods.
Une page interessante à visiter avant https://gist.github.com/aquelito/8596717
git config --global core.autcrlf false
Pour éviter les commit de merge lié à vos pull
: