INNER CODE UNIT · Python

translate_path

zoharbabin/quantum-trader · training/server.py:7

    def translate_path(self, path):
        # Get the absolute path of the training directory
        base_dir = os.path.dirname(os.path.abspath(__file__))
        # Convert URL path to filesystem path
        path = SimpleHTTPRequestHandler.translate_path(self, path)
        # Make the path relative to the training directory
        rel_path = os.path.relpath(path, os.getcwd())
        # Join with base directory
        return os.path.join(base_dir, rel_path)

    def end_headers(self):
        # Disable caching
        self.send_header('Cache-Control', 'no-cache, no-store, must-revalidate')
        self.send_header('Pragma', 'no-cache')
        self.send_header('Expires', '0')
        SimpleHTTPRequestHandler.end_headers(self)

def run_server(port):

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…