This document provides guidelines for maintaining high-quality Python code. These rules MUST be followed by all AI coding agents and contributors.
All code you write MUST be fully optimized.
"Fully optimized" includes:
| # /// script | |
| # requires-python = ">=3.12" | |
| # dependencies = [ | |
| # "pyobjc-core", | |
| # "pyobjc-framework-CoreLocation", | |
| # "click" | |
| # ] | |
| # /// | |
| """Basic geocoding using CoreLocation on macOS.""" |
| <!DOCTYPE html> | |
| <html lang="en"> | |
| <head> | |
| <meta charset="utf-8" /> | |
| <title>Mocha Tests</title> | |
| <meta name="viewport" content="width=device-width, initial-scale=1.0" /> | |
| <link rel="stylesheet" href="https://unpkg.com/mocha/mocha.css" /> | |
| </head> | |
| <body> | |
| <div id="mocha"></div> |
If you encounter a problem where you cannot commit changes in Git – neither through the terminal nor via the GitHub Desktop application – the issue might be a freeze during the Git commit process. This is often caused by GPG lock issues. Below is a concise and step-by-step guide to resolve this problem.
Open your terminal and try to perform a GPG operation (like signing a test message). If you see repeated messages like gpg: waiting for lock (held by [process_id]) ..., it indicates a lock issue.
| /** | |
| * cloneNode(true), but also clones shadow roots. | |
| * @param {Element} | |
| * @param {ShadowRoot[]} [shadowRoots] Any closed shadow roots passed here will be included. | |
| */ | |
| function cloneWithShadowRoots(node, shadowRoots) { | |
| function walk(node, clone) { | |
| let shadow = node.shadowRoot || shadowRoots.find(r => r.host === node); | |
| if (shadow) { | |
| clone.attachShadow({ mode: shadow.mode }).append(...[].map.call(shadow.childNodes, c => c.cloneNode(true))); |
| import http.server | |
| import socketserver | |
| from http import HTTPStatus | |
| class Handler(http.server.SimpleHTTPRequestHandler): | |
| def do_GET(self): | |
| self.send_response(HTTPStatus.OK) | |
| self.end_headers() | |
| self.wfile.write(b'Hello world') |
| { | |
| "@context": { | |
| "@vocab": "http://www.w3.org/ns/dcat#", | |
| "dp": "http://dataportals.net/ns/dp#", | |
| "schema": "http://schema.org/", | |
| "rdfs": "http://www.w3.org/2000/01/rdf-schema#", | |
| "xsd": "http://www.w3.org/2001/XMLSchema#", | |
| "url": "@id", | |
| "linked_portals": { |
| 'use strict'; | |
| var pkg = require('./package.json'); | |
| var gulp = require('gulp'); | |
| var utils = require('gulp-util'); | |
| var source = require('vinyl-source-stream'); | |
| var isWatching = false; | |
| var isProduction = process.env.NODE_ENV === 'production'; |