File: compat.py

package info (click to toggle)
python-netaddr 1.3.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 9,912 kB
  • sloc: xml: 8,264; python: 6,697; makefile: 198; sh: 5
file content (15 lines) | stat: -rw-r--r-- 530 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
# -----------------------------------------------------------------------------
#   Copyright (c) 2008 by David P. D. Moss. All rights reserved.
#
#   Released under the BSD license. See the LICENSE file for details.
# -----------------------------------------------------------------------------


import importlib.resources

if hasattr(importlib.resources, 'files'):

    def _open_binary(pkg, res):
        return importlib.resources.files(pkg).joinpath(res).open('rb')
else:
    _open_binary = importlib.resources.open_binary