diff --git a/README.md b/README.md index fde4a5d..87e97d3 100644 --- a/README.md +++ b/README.md @@ -1645,7 +1645,7 @@ from pathlib import Path ``` ```python - = .parent # Returns Path without final component. + = .parent # Returns Path without the final component. = .name # Returns final component as a string. = .stem # Returns final component without extension. = .suffix # Returns final component's extension. @@ -1864,11 +1864,11 @@ import sqlite3 #### Or: ```python with : # Exits the block with commit() or rollback(), - .execute('') # depending on whether an exception occurred. + .execute('') # depending on whether any exception occurred. ``` ### Placeholders -* **Passed values can be of type str, int, float, bytes, None, bool, datetime.date or datetime.datetme.** +* **Passed values can be of type str, int, float, bytes, None, bool, datetime.date or datetime.datetime.** * **Bools will be stored and returned as ints and dates as [ISO formatted strings](#encode).** ```python .execute('', ) # Replaces '?'s in query with values. @@ -2900,15 +2900,15 @@ Synthesizer import math, struct, simpleaudio from itertools import repeat, chain F = 44100 -P1 = '71♩,69♪,,71♩,66♪,,62♩,66♪,,59♩,,,' -P2 = '71♩,73♪,,74♩,73♪,,74♪,,71♪,,73♩,71♪,,73♪,,69♪,,71♩,69♪,,71♪,,67♪,,71♩,,,' +P1 = '71♩,69♪,,71♩,66♪,,62♩,66♪,,59♩,,' +P2 = '71♩,73♪,,74♩,73♪,,74♪,,71♪,,73♩,71♪,,73♪,,69♪,,71♩,69♪,,71♪,,67♪,,71♩,,' get_pause = lambda seconds: repeat(0, int(seconds * F)) sin_f = lambda i, hz: math.sin(i * 2 * math.pi * hz / F) get_wave = lambda hz, seconds: (sin_f(i, hz) for i in range(int(seconds * F))) get_hz = lambda key: 8.176 * 2 ** (int(key) / 12) parse_note = lambda note: (get_hz(note[:2]), 1/4 if '♩' in note else 1/8) get_samples = lambda note: get_wave(*parse_note(note)) if note else get_pause(1/8) -samples_f = chain.from_iterable(get_samples(n) for n in f'{P1}{P1}{P2}'.split(',')) +samples_f = chain.from_iterable(get_samples(n) for n in f'{P1},{P1},{P2}'.split(',')) samples_b = b''.join(struct.pack('
- +
@@ -1540,7 +1540,7 @@ value = args.<name> <Path> = Path.home() # Returns user's home directory. <Path> = Path(__file__).resolve() # Returns script's path if cwd wasn't changed. -
<Path> = <Path>.parent              # Returns Path without final component.
+
<Path> = <Path>.parent              # Returns Path without the final component.
 <str>  = <Path>.name                # Returns final component as a string.
 <str>  = <Path>.stem                # Returns final component without extension.
 <str>  = <Path>.suffix              # Returns final component's extension.
@@ -1698,11 +1698,11 @@ CompletedProcess(args=['bc', Or:
with <conn>:                                    # Exits the block with commit() or rollback(),
-    <conn>.execute('<query>')                   # depending on whether an exception occurred.
+    <conn>.execute('<query>')                   # depending on whether any exception occurred.
 

Placeholders

    -
  • Passed values can be of type str, int, float, bytes, None, bool, datetime.date or datetime.datetme.
  • +
  • Passed values can be of type str, int, float, bytes, None, bool, datetime.date or datetime.datetime.
  • Bools will be stored and returned as ints and dates as ISO formatted strings.
<conn>.execute('<query>', <list/tuple>)         # Replaces '?'s in query with values.
 <conn>.execute('<query>', <dict/namedtuple>)    # Replaces ':<key>'s with values.
@@ -2498,15 +2498,15 @@ engine.runAndWait()
 import math, struct, simpleaudio
 from itertools import repeat, chain
 F  = 44100
-P1 = '71♩,69♪,,71♩,66♪,,62♩,66♪,,59♩,,,'
-P2 = '71♩,73♪,,74♩,73♪,,74♪,,71♪,,73♩,71♪,,73♪,,69♪,,71♩,69♪,,71♪,,67♪,,71♩,,,'
+P1 = '71♩,69♪,,71♩,66♪,,62♩,66♪,,59♩,,'
+P2 = '71♩,73♪,,74♩,73♪,,74♪,,71♪,,73♩,71♪,,73♪,,69♪,,71♩,69♪,,71♪,,67♪,,71♩,,'
 get_pause   = lambda seconds: repeat(0, int(seconds * F))
 sin_f       = lambda i, hz: math.sin(i * 2 * math.pi * hz / F)
 get_wave    = lambda hz, seconds: (sin_f(i, hz) for i in range(int(seconds * F)))
 get_hz      = lambda key: 8.176 * 2 ** (int(key) / 12)
 parse_note  = lambda note: (get_hz(note[:2]), 1/4 if '♩' in note else 1/8)
 get_samples = lambda note: get_wave(*parse_note(note)) if note else get_pause(1/8)
-samples_f   = chain.from_iterable(get_samples(n) for n in f'{P1}{P1}{P2}'.split(','))
+samples_f   = chain.from_iterable(get_samples(n) for n in f'{P1},{P1},{P2}'.split(','))
 samples_b   = b''.join(struct.pack('<h', int(f * 30000)) for f in samples_f)
 simpleaudio.play_buffer(samples_b, 1, 2, F)
 
@@ -3007,7 +3007,7 @@ $ pyinstaller script.py --add-data '<path>:.'