Skip to main content

A set of types for processing MediaWiki data.

Project description

# MediaWiki Types

This library provides a set of classes for working with MediaWiki data types. The point of this library is to help standardize different schemes and naming patterns between the database, XML dumps and API responses.

  • Installation: pip install mwtypes

## Types

  • Contributor – An ‘id’ and ‘user_text’ of a user

  • Deleted – The deleted/suppressed status of a revision or event

  • Namespace – Namespace ID and metadata (‘aliases’, ‘canonical’, ‘content’)

  • Page – Metadata about a page (‘id’, ‘title’, ‘namespace’, ‘restrictions’, etc.)

  • Revision – Metadata about a revision (‘id’, ‘contributor’, ‘timestamp’, etc.)

  • Timestamp – Basic operations and formatting of MediaWiki timestamp formats

## Timestamp example

>>> import datetime, time
>>> from mwtypes import Timestamp
>>> Timestamp(1234567890)
Timestamp('2009-02-13T23:31:30Z')
>>> Timestamp(1234567890) == Timestamp("2009-02-13T23:31:30Z")
True
>>> Timestamp(1234567890) == Timestamp("20090213233130")
True
>>> Timestamp(1234567890) == Timestamp(datetime.datetime.utcfromtimestamp(1234567890))
True
>>> Timestamp(1234567890) == Timestamp(time.strptime("2009-02-13T23:31:30Z", "%Y-%m-%dT%H:%M:%SZ"))
True
>>> Timestamp(1234567890) == Timestamp(Timestamp(1234567890))
True

You can also do math and comparisons of timestamps.:

>>> from mwtypes import Timestamp
>>> t = Timestamp(1234567890)
>>> t
Timestamp('2009-02-13T23:31:30Z')
>>> t2 = t + 10
>>> t2
Timestamp('2009-02-13T23:31:40Z')
>>> t += 1
>>> t
Timestamp('2009-02-13T23:31:31Z')
>>> t2 - t
9
>>> t < t2
True

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

mwtypes-0.1.2.zip (14.4 kB view details)

Uploaded Source

mwtypes-0.1.2.tar.gz (9.0 kB view details)

Uploaded Source

Built Distribution

mwtypes-0.1.2-py3.4.egg (26.6 kB view details)

Uploaded Source

File details

Details for the file mwtypes-0.1.2.zip.

File metadata

  • Download URL: mwtypes-0.1.2.zip
  • Upload date:
  • Size: 14.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for mwtypes-0.1.2.zip
Algorithm Hash digest
SHA256 64d5909283b2ca2d9fe02e641944fe770978987a40fd0e237e0d2a43f4a26a63
MD5 22d389342b428b7ed7bceac03d3002f0
BLAKE2b-256 dd05b15f9c4a0308e8570cd7171cd7f3e0c142c32a64c40bc7202a9168ea4dac

See more details on using hashes here.

File details

Details for the file mwtypes-0.1.2.tar.gz.

File metadata

  • Download URL: mwtypes-0.1.2.tar.gz
  • Upload date:
  • Size: 9.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for mwtypes-0.1.2.tar.gz
Algorithm Hash digest
SHA256 321f0756d42de65e19c13bc503dc30663a5e2dc51ad115c9e26828f90e0be458
MD5 6cedd9ad0bddf1333c5db7fa65de3ecb
BLAKE2b-256 804ae0a647dc7f4ca87c699deb9a0dd02a423adaf13a3237185c2aa0b450196d

See more details on using hashes here.

File details

Details for the file mwtypes-0.1.2-py3.4.egg.

File metadata

  • Download URL: mwtypes-0.1.2-py3.4.egg
  • Upload date:
  • Size: 26.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.15.0 CPython/3.5.1+

File hashes

Hashes for mwtypes-0.1.2-py3.4.egg
Algorithm Hash digest
SHA256 2e70e366fa49bd7f799055bbe7d0c625104daff1d084a5dba1846ee91c585882
MD5 46d71f24646fa0f9c5ec3919316fe8e2
BLAKE2b-256 de1e68182dd1bf3f2b83e4dc56a5ed2fdd3529dc143f942a2990a211112d9c59

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page