Talk:List of XEPs

From JaWiki (Jabber/XMPP wiki)
Revision as of 02:18, 28 October 2015 by 178.73.218.249 (Talk) (wrd06l8c: new section)

Jump to: navigation, search

Скрипт для генерации и проверки списка

Требуется Python 3

#! /usr/bin/env python3
# -*- coding: utf-8 -*-


# input
XEPS_ORIG_URL = 'http://xmpp.org/extensions/xeps.xml'
XEPS_WIKI_URL_T = 'http://jawiki.ru/index.php?title={}&action=raw'
XEPS_WIKI_URL_PAGES = (
    'Список_расширений/0001—0049',
    'Список_расширений/0050—0099',
    'Список_расширений/0100—0149',
    'Список_расширений/0150—0199',
    'Список_расширений/0200—0249',
    'Список_расширений/0250—0299'
)


import itertools
import re
import sys
import urllib.request
import xml.etree.ElementTree as xml


def fetchUrl(url):
    return urllib.request.urlopen(url).read().decode('UTF-8')


def initXepList():
    print('... Получение оригинального списка расширений... ', end='', file=sys.stderr)
    sys.stderr.flush()
    xeps_orig_xml = xml.XML(fetchUrl(XEPS_ORIG_URL))
    print('Готово.', file=sys.stderr)
    
    xeps_orig = {}
    for xep in xeps_orig_xml:
        number = xep.find('number').text
        xeps_orig[number] = {
            'name': xep.find('name').text,
            'abstract': xep.find('abstract').text,
            'type': xep.find('type').text.replace(' ', '_'),
            'status': xep.find('status').text
        }
    
    for number in sorted(xeps_orig):
        print(
            '{{{{XepListItem|{number}|{name}|{abstract}|||{type}|{status}}}}}'
                .format(number=number, **xeps_orig[number])
        )


def main():
    print('... Получение списка расширений из ЯВики... ', end='')
    xeps_wiki = itertools.chain(*(
        fetchUrl(XEPS_WIKI_URL_T.format(urllib.parse.quote(page))).splitlines()
        for page in XEPS_WIKI_URL_PAGES
    ))
    print('Готово.')
    
    xeps = {}
    for line in xeps_wiki:
        line = line[2:-2] # убираем двойные фигурные скобки по краям, если есть
        line = re.sub(r'\{\{.*?\}\}', '', line) # вырезаем вызовы викишаблонов, в них могут быть палки
        line = re.sub(r'\[\[.*?\]\]', '', line) # вырезаем викиссылки, в них могут быть палки
        parts = line.split('|')
        if parts[0] == 'XepListItem':
            xeps[parts[1]] = {
                'name': parts[2],
                'type': parts[6].replace('_', ' '),
                'status': parts[7]
            }
    
    print('... Прочитано %d расширений.' % len(xeps))
    
    print('... Получение оригинального списка расширений... ', end='')
    xeps_orig_xml = xml.XML(fetchUrl(XEPS_ORIG_URL))
    print('Готово.')
    
    xeps_orig = {}
    for xep in xeps_orig_xml:
        number = xep.find('number').text
        xeps_orig[number] = {
            'name': xep.find('name').text,
            'type': xep.find('type').text,
            'status': xep.find('status').text
        }
    
    differ = False
    for number in sorted(xeps_orig):
        if number not in xeps:
            differ = True
            print('[*] Новое расширение: XEP-' + number)
            print('\tНазвание: ' + xeps_orig[number]['name'])
            print('\tТип: ' + xeps_orig[number]['type'])
            print('\tСтатус: ' + xeps_orig[number]['status'])
        elif xeps[number] != xeps_orig[number]:
            differ = True
            print('[*] Различается XEP-' + number)
            if xeps[number]['name'] != xeps_orig[number]['name']:
                print('\tНазвание изменено с "{0}" на "{1}"'.format(xeps[number]['name'], xeps_orig[number]['name']))
            if xeps[number]['type'] != xeps_orig[number]['type']:
                print('\tТип изменён с "{0}" на "{1}"'.format(xeps[number]['type'], xeps_orig[number]['type']))
            if xeps[number]['status'] != xeps_orig[number]['status']:
                print('\tСтатус изменён с "{0}" на "{1}"'.format(xeps[number]['status'], xeps_orig[number]['status']))
    
    if not differ:
        print('[=] Различия не найдены.')


if __name__ == '__main__':
    #initXepList()
    main()

wrd06l8c

Metoclopramide hinders the peripheral as well as central impacts of apomorphine, <a href=http://metformin.space/>order metformin</a> induces launch of prolactin as well as creates a transient increase in circulating aldosterone levels, which may be connected with short-term liquid loyalty. Tadalafil is endured <a href=http://generic-clomid.nu/>generic clomid</a> well by a lot of people in therapy, however minor negative effects are feasible at the start of it. Your physician has to know if you have actually ever been allergic to any medications, or if you are utilizing any kind of nitrate based drugs - isosorbide dinitrate, amyl nitrate, nitroglycerin, isosorbide mononitrate, or <a href=http://buyviagrasoft.se/>buy viagra soft tabs</a> butyl nitrate, as those could be contraindications for taking Levitra. By method, the dose of concomitant AEDs can not be lessened as <a href=http://cipro.space/>buy cipro</a> Trileptal was added. Sharing medication or medicine needles is never ever risk-free, also for a healthy and balanced <a href=http://diclofenac.space/>voltaren generic</a> guest. Ribavirin has actually been found to <a href=http://ventolininhalernoprescription.nu/>ventolin</a> inhibit the phosphorylation of zidovudine in cell culture. Gastrointestinal negative effects have actually <a href=http://generic-ventolin.se/>proventil ventolin</a> consisted of diarrhea and queasiness in 2 % and also 4 % of patients, respectively. Prior to you begin taking <a href=http://abilifyonline.party/>abilify aripiprazole</a> Propecia your doctor has to learn about various other health care disorder you have besides male pattern hair loss. Take the medicine cognizant <a href=http://celebrex.space/>buy celebrex without prescription</a> a glass of water; do not munch or crush the medicine in your mouth prior to swallowing. Keep in mind: This web page includes adverse effects data for the universal medication <a href=http://lasix.webcam/>lasix water pill</a> topiramate. While taking Zoloft it's crucial that you know which negative side effects are light <a href=http://levitra.top/>levitra</a> and have the tendency to vanish alone, and which ones you should report to your medical service provider.