File tree Expand file tree Collapse file tree 3 files changed +8
-23
lines changed Expand file tree Collapse file tree 3 files changed +8
-23
lines changed Original file line number Diff line number Diff line change 55# serve to show the default.
66
77import sys
8- import os
8+ from pathlib import Path
99
1010# If extensions (or modules to document with autodoc) are in another directory,
1111# add these directories to sys.path here. If the directory is relative to the
1212# documentation root, use os.path.abspath to make it absolute, like shown here.
1313#sys.path.insert(0, os.path.abspath('.'))
14- sys .path .insert (
15- 0 ,
16- os .path .abspath (
17- os .path .join (
18- os .path .dirname (__file__ ),
19- '../../'
20- )
21- )
22- )
14+ sys .path .insert (0 , str (Path (__file__ ).resolve ().parent .parent .parent ))
2315
2416# -- General configuration ------------------------------------------------
2517
Original file line number Diff line number Diff line change 11#!/usr/bin/env python
22import os
33import sys
4+ from pathlib import Path
45from setuptools import setup , find_packages
56
6- base_dir = os . path . dirname (__file__ )
7+ HERE = Path (__file__ ). resolve (). parent
78
89about = {}
9- with open (os .path .join (base_dir , "overpy" , "__about__.py" )) as f :
10- exec (f .read (), about )
10+ exec ((HERE / "overpy" / "__about__.py" ).read_text (), about )
1111
12- filename_readme = os .path .join (base_dir , "README.rst" )
13- if sys .version_info [0 ] == 2 :
14- import io
15- fp = open (filename_readme , encoding = "utf-8" )
16- else :
17- fp = open (filename_readme , encoding = "utf-8" )
18- long_description = fp .read ()
12+ long_description = (HERE / "README.rst" ).read_text ()
1913
2014setup (
2115 name = about ["__title__" ],
Original file line number Diff line number Diff line change 1- import os
21import sys
32import threading
3+ from pathlib import Path
44from threading import Lock
55
66from socketserver import BaseRequestHandler , TCPServer , ThreadingMixIn
@@ -26,8 +26,7 @@ def get_response():
2626
2727
2828def read_file (filename , mode = "r" ):
29- filename = os .path .join (os .path .dirname (__file__ ), filename )
30- return open (filename , mode ).read ()
29+ return (Path (__file__ ).resolve ().parent / filename ).open (mode ).read ()
3130
3231
3332def new_server_thread (handle_cls , port = None ):
You can’t perform that action at this time.
0 commit comments