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.0.1.zip (14.0 kB view details)

Uploaded Source

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

Uploaded Source

Built Distribution

mwtypes-0.0.1-py3.4.egg (25.0 kB view details)

Uploaded Source

File details

Details for the file mwtypes-0.0.1.zip.

File metadata

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

File hashes

Hashes for mwtypes-0.0.1.zip
Algorithm Hash digest
SHA256 f180f32df72378e8d6b449d310d8310b92640aae9d848e1e28658ffa5732169b
MD5 8faad1b7b9b34259d6c319418ea32de9
BLAKE2b-256 2ad568937420073e7a655a3f06fd96223af0986f0b3867b23df36ce78d3b6675

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for mwtypes-0.0.1.tar.gz
Algorithm Hash digest
SHA256 bb3473f17e211bc18250457c8724e249b94d571b76f87447ee8eb2d429cb0278
MD5 001dbb706101fe2076d22d9ddc9354fd
BLAKE2b-256 033c516a9ff6f66dfb42ba898b549487ce8c08af80afeebd947a43c32b368399

See more details on using hashes here.

File details

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

File metadata

  • Download URL: mwtypes-0.0.1-py3.4.egg
  • Upload date:
  • Size: 25.0 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.0.1-py3.4.egg
Algorithm Hash digest
SHA256 e78a608960c04554fb85b1a75c7abb30dd11fb704056396f4b45a72b6895d207
MD5 491c83fa2eb298090f24e4cfb8e0f498
BLAKE2b-256 ed367cc682642e73d6fd9ea3996ac75273f82f7e26ecb2201c43323eadb5edee

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