{"success":true,"data":{"ext":"py","name":"PY","description":"Python source code files (PY) are plain text program files associated with the Python language, which is developed and maintained by the Python Software Foundation. They are used to store scripts, modules, and application code for automation, web development, data analysis, scientific computing, and general-purpose programming. Because they contain executable code, they are generally safe to inspect as text, but should be reviewed before execution when obtained from untrusted sources.","mime":["text/x-python"],"risk_level":"Safe","signatures":[{"hex":"23 21 2F 62 69 6E 2F 70 79 74 68 6F 6E","offset":0,"sources":[{"name":"Apache Tika","url":"https://raw.githubusercontent.com/apache/tika/main/tika-core/src/main/resources/org/apache/tika/mime/tika-mimetypes.xml"}]},{"hex":"23 21 20 2F 62 69 6E 2F 70 79 74 68 6F 6E","offset":0,"sources":[{"name":"Apache Tika","url":"https://raw.githubusercontent.com/apache/tika/main/tika-core/src/main/resources/org/apache/tika/mime/tika-mimetypes.xml"}]},{"hex":"65 76 61 6C 20 22 65 78 65 63 20 2F 62 69 6E 2F 70 79 74 68 6F 6E","offset":0,"sources":[{"name":"Apache Tika","url":"https://raw.githubusercontent.com/apache/tika/main/tika-core/src/main/resources/org/apache/tika/mime/tika-mimetypes.xml"}]},{"hex":"23 21 2F 75 73 72 2F 62 69 6E 2F 70 79 74 68 6F 6E","offset":0,"sources":[{"name":"Apache Tika","url":"https://raw.githubusercontent.com/apache/tika/main/tika-core/src/main/resources/org/apache/tika/mime/tika-mimetypes.xml"}]},{"hex":"23 21 20 2F 75 73 72 2F 62 69 6E 2F 70 79 74 68 6F 6E","offset":0,"sources":[{"name":"Apache Tika","url":"https://raw.githubusercontent.com/apache/tika/main/tika-core/src/main/resources/org/apache/tika/mime/tika-mimetypes.xml"}]},{"hex":"65 76 61 6C 20 22 65 78 65 63 20 2F 75 73 72 2F 62 69 6E 2F 70 79 74 68 6F 6E","offset":0,"sources":[{"name":"Apache Tika","url":"https://raw.githubusercontent.com/apache/tika/main/tika-core/src/main/resources/org/apache/tika/mime/tika-mimetypes.xml"}]},{"hex":"23 21 2F 75 73 72 2F 6C 6F 63 61 6C 2F 62 69 6E 2F 70 79 74 68 6F 6E","offset":0,"sources":[{"name":"Apache Tika","url":"https://raw.githubusercontent.com/apache/tika/main/tika-core/src/main/resources/org/apache/tika/mime/tika-mimetypes.xml"}]},{"hex":"23 21 20 2F 75 73 72 2F 6C 6F 63 61 6C 2F 62 69 6E 2F 70 79 74 68 6F 6E","offset":0,"sources":[{"name":"Apache Tika","url":"https://raw.githubusercontent.com/apache/tika/main/tika-core/src/main/resources/org/apache/tika/mime/tika-mimetypes.xml"}]},{"hex":"65 76 61 6C 20 22 65 78 65 63 20 2F 75 73 72 2F 6C 6F 63 61 6C 2F 62 69 6E 2F 70 79 74 68 6F 6E","offset":0,"sources":[{"name":"Apache Tika","url":"https://raw.githubusercontent.com/apache/tika/main/tika-core/src/main/resources/org/apache/tika/mime/tika-mimetypes.xml"}]},{"hex":"2F 62 69 6E 2F 65 6E 76 20 70 79 74 68 6F 6E","offset":1,"sources":[{"name":"Apache Tika","url":"https://raw.githubusercontent.com/apache/tika/main/tika-core/src/main/resources/org/apache/tika/mime/tika-mimetypes.xml"}]}],"related":["awk","php","pl","pm","bash","csh"],"usage":{"python":"def is_py(file_path: str) -> bool:\n    \"\"\"Check if file is a valid PY by magic bytes.\"\"\"\n    signature = bytes([0x23, 0x21, 0x2F, 0x62, 0x69, 0x6E, 0x2F, 0x70, 0x79, 0x74, 0x68, 0x6F, 0x6E])\n    with open(file_path, \"rb\") as f:\n        return f.read(13) == signature","node":"function isPY(buffer: Buffer): boolean {\n  const signature = Buffer.from([0x23, 0x21, 0x2F, 0x62, 0x69, 0x6E, 0x2F, 0x70, 0x79, 0x74, 0x68, 0x6F, 0x6E]);\n  return buffer.subarray(0, 13).equals(signature);\n}","go":"func IsPY(data []byte) bool {\n    signature := []byte{0x23, 0x21, 0x2F, 0x62, 0x69, 0x6E, 0x2F, 0x70, 0x79, 0x74, 0x68, 0x6F, 0x6E}\n    if len(data) < 13 {\n        return false\n    }\n    return bytes.Equal(data[:13], signature)\n}"},"category":"Source Code"}}