GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — pyperformance/pyperformance/_python.py at main · python/pyperformance

Expand file tree

/

_python.py

Copy path
More file actions
More file actions

Latest commit

 

History

History
History
41 lines (33 loc) · 1.24 KB
/

_python.py

Copy path

File metadata and controls

41 lines (33 loc) · 1.24 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# Generic helpers for working with a Python executable.
import hashlib
from pyperformance import _pythoninfo
def get_id(python=None, prefix=None, *, short=True):
"""Return a string that uniquely identifies the given Python executable."""
if isinstance(python, str):
python = _pythoninfo.get_info(python)
data = [
# "executable" represents the install location
# (and build, to an extent).
python.sys.executable,
# sys.version encodes version, git info, build_date, and build_tool.
python.sys.version,
python.sys.implementation.name.lower(),
".".join(str(v) for v in python.sys.implementation.version),
str(python.sys.api_version),
python.pyc_magic_number.hex(),
]
# XXX Add git info if a dev build.
h = hashlib.sha256()
for value in data:
h.update(value.encode("utf-8"))
# XXX Also include the sorted output of "python -m pip freeze"?
py_id = h.hexdigest()
if short:
py_id = py_id[:12]
if prefix:
if prefix is True:
major, minor = python.sys.version_info[:2]
py_id = f"{python.sys.implementation.name}{major}.{minor}-{py_id}"
else:
py_id = prefix + py_id
return py_id
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.