diff --git a/index.html b/index.html index 9c72344..9eadb71 100644 --- a/index.html +++ b/index.html @@ -460,15 +460,15 @@ shuffle(<list>)

#Datetime

from datetime import date, time, datetime, timedelta
 from dateutil.tz import UTC, tzlocal, gettz
 

Constructors

-
<D>  = date(year, month, day)
+
<D>  = date(year, month, day)
 <T>  = time(hour=0, minute=0, second=0, microsecond=0, tzinfo=None, fold=0)
 <DT> = datetime(year, month, day, hour=0, minute=0, second=0, ...)
 <TD> = timedelta(days=0, seconds=0, microseconds=0, milliseconds=0,
@@ -488,11 +488,11 @@ shuffle(<list>)
 <tz>     = tzlocal()                        # Local timezone.
 <tz>     = gettz('<Cont.>/<City>')          # Timezone from 'Continent/City_Name' str.
 
-
<DTa>    = <DT>.astimezone(<tz>)            # Datetime, converted to passed timezone.
+
<DTa>    = <DT>.astimezone(<tz>)            # Datetime, converted to passed timezone.
 <Ta/DTa> = <T/DT>.replace(tzinfo=<tz>)      # Unconverted object with new timezone.
 

Encode

-
<D/T/DT> = D/T/DT.fromisoformat('<iso>')    # Object from ISO string.
+
<D/T/DT> = D/T/DT.fromisoformat('<iso>')    # Object from ISO string.
 <DT>     = DT.strptime(<str>, '<format>')   # Datetime from str, according to format.
 <D/DTn>  = D/DT.fromordinal(<int>)          # D/DTn from days since Christ.
 <DTa>    = DT.fromtimestamp(<real>, <tz>)   # DTa from seconds since Epoch in tz time.
@@ -502,7 +502,7 @@ shuffle(<list>)
 
  • On Unix systems Epoch is '1970-01-01 00:00 UTC', '1970-01-01 01:00 CET', …
  • Decode

    -
    <str>    = <D/T/DT>.isoformat()             # ISO string representation.
    +
    <str>    = <D/T/DT>.isoformat()             # ISO string representation.
     <str>    = <D/T/DT>.strftime('<format>')    # Custom string representation.
     <int>    = <D/DT>.toordinal()               # Days since Christ, ignoring time and tz.
     <float>  = <DT>.timestamp()                 # Seconds since Epoch in local time or tz.
    @@ -749,9 +749,10 @@ creature  = Creature()
     class C(A, B): pass
     

    MRO determines the order in which parent classes are traversed when searching for a method:

    +
    >>> C.mro()
    -[<class 'C'>, <class 'A'>, <class 'B'>, <class 'object'>]
    -
    +[<class 'C'>, <class 'A'>, <class 'B'>, <class 'object'>]
    +

    Copy

    from copy import copy, deepcopy
     <object> = copy(<object>)
    diff --git a/parse.js b/parse.js
    index 3b4a74e..61d1e3e 100755
    --- a/parse.js
    +++ b/parse.js
    @@ -30,6 +30,8 @@ const TOC =
       '}\n' +
       '
    \n'; +const MRO = + '
    >>> C.mro()\n[<class \'C\'>, <class \'A\'>, <class \'B\'>, <class \'object\'>]\n
    \n' function main() { const html = getMd(); @@ -60,10 +62,7 @@ function modifyPage() { addToc(); insertLinks(); unindentBanner(); - $('code').not('.python').not('.text').not('.bash').addClass('python'); - $('code').each(function(index) { - hljs.highlightBlock(this); - }); + highlightCode(); } function removeOrigToc() { @@ -73,6 +72,11 @@ function removeOrigToc() { contentsList.remove(); } +function addToc() { + const nodes = $.parseHTML(TOC); + $('#main').before(nodes); +} + function insertLinks() { $('h2').each(function() { const aId = $(this).attr('id'); @@ -89,10 +93,24 @@ function unindentBanner() { downloadPraragrapth.addClass('banner'); } -function addToc() { - const headerMain = $('#main'); - const nodes = $.parseHTML(TOC); - headerMain.before(nodes); +function highlightCode() { + setApache('') + setApache('') + setApache('
    ') + setApache('') + setApache('') + setApache('') + $('code').not('.python').not('.text').not('.bash').not('.apache').addClass('python'); + $('code').each(function(index) { + hljs.highlightBlock(this); + }); + $('#copy').prev().remove() + const nodes = $.parseHTML(MRO); + $('#copy').before(nodes); +} + +function setApache(codeContents) { + $(`code:contains(${codeContents})`).addClass('apache'); } function readFile(filename) {