diff --git a/README.md b/README.md index e3e7817..f5dc7ee 100644 --- a/README.md +++ b/README.md @@ -2168,7 +2168,7 @@ with : # Enters the block by calling acq Operator -------- -**Module of functions that provide the functionality of operators. Functions are ordered by operator precedence, starting with least binding.** +**Module of functions that provide the functionality of operators. Functions are ordered and grouped by operator precedence from least to most binding. Logical and arithmetic operators in rows 1, 3 and 5 are also ordered by precedence within a group.** ```python import operator as op ``` @@ -2419,9 +2419,9 @@ import matplotlib.pyplot as plt plt.plot/bar/scatter(x_data, y_data [, label=]) # Also plt.plot(y_data). plt.legend() # Adds a legend. plt.title/xlabel/ylabel() # Adds a title or label. -plt.savefig() # Saves the figure. -plt.show() # Displays the figure. -plt.clf() # Clears the figure. +plt.savefig() # Saves the plot. +plt.show() # Displays the plot. +plt.clf() # Clears the plot. ``` @@ -2876,7 +2876,7 @@ import wave = .getnchannels() # Returns number of samples per frame. = .getsampwidth() # Returns number of bytes per sample. = .getparams() # Returns namedtuple of all parameters. - = .readframes(nframes) # Returns next n frames. All if -1. + = .readframes(nframes) # Returns next n frames (-1 returns all). ``` ```python @@ -2913,7 +2913,7 @@ def read_wav_file(filename): p = file.getparams() frames = file.readframes(-1) bytes_samples = (frames[i : i + p.sampwidth] for i in range(0, len(frames), p.sampwidth)) - return [get_int(b) / pow(2, p.sampwidth * 8 - 1) for b in bytes_samples], p + return [get_int(b) / pow(2, (p.sampwidth * 8) - 1) for b in bytes_samples], p ``` ### Write Float Samples to WAV File @@ -2922,7 +2922,7 @@ def write_to_wav_file(filename, samples_f, p=None, nchannels=1, sampwidth=2, fra def get_bytes(a_float): a_float = max(-1, min(1 - 2e-16, a_float)) a_float += p.sampwidth == 1 - a_float *= pow(2, p.sampwidth * 8 - 1) + a_float *= pow(2, (p.sampwidth * 8) - 1) return int(a_float).to_bytes(p.sampwidth, 'little', signed=(p.sampwidth != 1)) if p is None: p = wave._wave_params(nchannels, sampwidth, framerate, 0, 'NONE', 'not compressed') diff --git a/index.html b/index.html index fd02940..307c470 100644 --- a/index.html +++ b/index.html @@ -1775,7 +1775,7 @@ CompletedProcess(args=['bc', pickable, queues must be sent using executor's 'initargs' and 'initializer' parameters, and executor should only be reachable via 'if __name__ == "__main__": ...'. -

#Operator

Module of functions that provide the functionality of operators. Functions are ordered by operator precedence, starting with least binding.

import operator as op
+

#Operator

Module of functions that provide the functionality of operators. Functions are ordered and grouped by operator precedence from least to most binding. Logical and arithmetic operators in rows 1, 3 and 5 are also ordered by precedence within a group.

import operator as op
 
@@ -1979,9 +1979,9 @@ Processing: 100%|████████████████████| 3 plt.plot/bar/scatter(x_data, y_data [, label=<str>]) # Also plt.plot(y_data). plt.legend() # Adds a legend. plt.title/xlabel/ylabel(<str>) # Adds a title or label. -plt.savefig(<path>) # Saves the figure. -plt.show() # Displays the figure. -plt.clf() # Clears the figure. +plt.savefig(<path>) # Saves the plot. +plt.show() # Displays the plot. +plt.clf() # Clears the plot.

#Table

Prints a CSV spreadsheet to the console:

# $ pip3 install tabulate
@@ -2342,7 +2342,7 @@ imageio.mimsave('test.gif', frames, duration=# Returns number of samples per frame.
 <int>   = <Wave>.getsampwidth()       # Returns number of bytes per sample.
 <tuple> = <Wave>.getparams()          # Returns namedtuple of all parameters.
-<bytes> = <Wave>.readframes(nframes)  # Returns next n frames. All if -1.
+<bytes> = <Wave>.readframes(nframes)  # Returns next n frames (-1 returns all).
 
<Wave> = wave.open('<path>', 'wb')    # Creates/truncates a file for writing.
 <Wave>.setframerate(<int>)            # Pass 44100 for CD, 48000 for video.
@@ -2374,14 +2374,14 @@ imageio.mimsave('test.gif', frames, duration=-1)
     bytes_samples = (frames[i : i + p.sampwidth] for i in range(0, len(frames), p.sampwidth))
-    return [get_int(b) / pow(2, p.sampwidth * 8 - 1) for b in bytes_samples], p
+    return [get_int(b) / pow(2, (p.sampwidth * 8) - 1) for b in bytes_samples], p
 

Write Float Samples to WAV File

def write_to_wav_file(filename, samples_f, p=None, nchannels=1, sampwidth=2, framerate=44100):
     def get_bytes(a_float):
         a_float = max(-1, min(1 - 2e-16, a_float))
         a_float += p.sampwidth == 1
-        a_float *= pow(2, p.sampwidth * 8 - 1)
+        a_float *= pow(2, (p.sampwidth * 8) - 1)
         return int(a_float).to_bytes(p.sampwidth, 'little', signed=(p.sampwidth != 1))
     if p is None:
         p = wave._wave_params(nchannels, sampwidth, framerate, 0, 'NONE', 'not compressed')
diff --git a/parse.js b/parse.js
index 2cd9e96..cc1725e 100755
--- a/parse.js
+++ b/parse.js
@@ -84,11 +84,6 @@ const CONSTRUCTOR_OVERLOADING =
   '    def __init__(self, a=None):\n' +
   '        self.a = a\n';
 
-const DATACLASS =
-  '<class> = make_dataclass(\'<class_name>\', <coll_of_attribute_names>)\n' +
-  '<class> = make_dataclass(\'<class_name>\', <coll_of_tuples>)\n' +
-  '<tuple> = (\'<attr_name>\', <type> [, <default_value>])';
-
 const SHUTIL_COPY =
   'shutil.copy(from, to)               # Copies the file. \'to\' can exist or be a dir.\n' +
   'shutil.copy2(from, to)              # Also copies creation and modification time.\n' +
@@ -221,7 +216,7 @@ const AUDIO_1 =
   '    def get_bytes(a_float):\n' +
   '        a_float = max(-1, min(1 - 2e-16, a_float))\n' +
   '        a_float += p.sampwidth == 1\n' +
-  '        a_float *= pow(2, p.sampwidth * 8 - 1)\n' +
+  '        a_float *= pow(2, (p.sampwidth * 8) - 1)\n' +
   '        return int(a_float).to_bytes(p.sampwidth, \'little\', signed=(p.sampwidth != 1))\n' +
   '    if p is None:\n' +
   '        p = wave._wave_params(nchannels, sampwidth, framerate, 0, \'NONE\', \'not compressed\')\n' +
@@ -843,7 +838,6 @@ function fixHighlights() {
   $(`code:contains(@debug(print_result=True))`).html(PARAMETRIZED_DECORATOR);
   $(`code:contains(print/str/repr([]))`).html(REPR_USE_CASES);
   $(`code:contains((self, a=None):)`).html(CONSTRUCTOR_OVERLOADING);
-  //$(`code:contains(make_dataclass(\'\')`).html(DATACLASS);
   $(`code:contains(shutil.copy)`).html(SHUTIL_COPY);
   $(`code:contains(os.rename)`).html(OS_RENAME);
   $(`code:contains(\'s\')`).html(STRUCT_FORMAT);