diff --git a/README.md b/README.md index 1815989..9dc3737 100644 --- a/README.md +++ b/README.md @@ -1946,7 +1946,7 @@ Bytes = bytes() # Ints must be in range from 0 to 255. = bytes(, 'utf-8') # Or: .encode('utf-8') = .to_bytes(n_bytes, …) # `byteorder='big/little', signed=False`. - = bytes.fromhex('') # Hex pairs can be separated by spaces. + = bytes.fromhex('') # Hex pairs can be separated by whitespaces. ``` ### Decode @@ -1954,7 +1954,7 @@ Bytes = list() # Returns ints in range from 0 to 255. = str(, 'utf-8') # Or: .decode('utf-8') = int.from_bytes(, …) # `byteorder='big/little', signed=False`. -'' = .hex() # Returns a string of hexadecimal pairs. +'' = .hex() # Returns hex pairs. Accepts `sep=`. ``` ### Read Bytes from File @@ -2615,11 +2615,11 @@ Line # Mem usage Increment Line Contents #### Generates a PNG image of the call graph with highlighted bottlenecks: ```python # $ pip3 install pycallgraph2 -from pycallgraph2 import output, PyCallGraph -from datetime import datetime -filename = f'profile-{datetime.now():%Y%m%d%H%M%S}.png' -drawer = output.GraphvizOutput(output_file=filename) -with PyCallGraph(drawer): +# $ apt install graphviz +import pycallgraph2 as cg, datetime +filename = f'profile-{datetime.datetime.now():%Y%m%d%H%M%S}.png' +drawer = cg.output.GraphvizOutput(output_file=filename) +with cg.PyCallGraph(drawer): ``` diff --git a/index.html b/index.html index feacb89..6e8f2ba 100644 --- a/index.html +++ b/index.html @@ -54,7 +54,7 @@
- +
@@ -1618,13 +1618,13 @@ CompletedProcess(args=['bc', Encode
<bytes> = bytes(<coll_of_ints>)          # Ints must be in range from 0 to 255.
 <bytes> = bytes(<str>, 'utf-8')          # Or: <str>.encode('utf-8')
 <bytes> = <int>.to_bytes(n_bytes, …)     # `byteorder='big/little', signed=False`.
-<bytes> = bytes.fromhex('<hex>')         # Hex pairs can be separated by spaces.
+<bytes> = bytes.fromhex('<hex>')         # Hex pairs can be separated by whitespaces.
 

Decode

<list>  = list(<bytes>)                  # Returns ints in range from 0 to 255.
 <str>   = str(<bytes>, 'utf-8')          # Or: <bytes>.decode('utf-8')
 <int>   = int.from_bytes(<bytes>, …)     # `byteorder='big/little', signed=False`.
-'<hex>' = <bytes>.hex()                  # Returns a string of hexadecimal pairs.
+'<hex>' = <bytes>.hex()                  # Returns hex pairs. Accepts `sep=<str>`.
 

Read Bytes from File

def read_bytes(filename):
@@ -2137,11 +2137,11 @@ Line #         Mem usage      Increment   Line Contents
      4        38.477 MiB      0.465 MiB       b = {*range(10000)}
 

Call Graph

Generates a PNG image of the call graph with highlighted bottlenecks:

# $ pip3 install pycallgraph2
-from pycallgraph2 import output, PyCallGraph
-from datetime import datetime
-filename = f'profile-{datetime.now():%Y%m%d%H%M%S}.png'
-drawer = output.GraphvizOutput(output_file=filename)
-with PyCallGraph(drawer):
+# $ apt install graphviz
+import pycallgraph2 as cg, datetime
+filename = f'profile-{datetime.datetime.now():%Y%m%d%H%M%S}.png'
+drawer = cg.output.GraphvizOutput(output_file=filename)
+with cg.PyCallGraph(drawer):
     <code_to_be_profiled>
 
@@ -2896,7 +2896,7 @@ $ pyinstaller script.py --add-data '<path>:.'