query_name
stringlengths
13
55
code_file_path
stringlengths
14
194
context_blocks
list
answer_spans
list
supporting_fact_spans
list
example_type
int8
0
1
single_hop
bool
2 classes
subtokenized_input_sequence
list
label_sequence
list
Unused import
rizumu/bootmachine/bootmachine/contrib/distros/attic/rackspace_arch_20145.py
[ { "content": "import time\nimport urllib2\n\nfrom fabric.api import env, run, sudo\nfrom fabric.context_managers import cd, settings as fabric_settings\nfrom fabric.contrib.files import append, contains, sed, uncomment\nfrom fabric.operations import reboot\nfrom fabric.utils import abort\n\nimport settings\n\n\nDISTRO = \"ARCH_20145\"\nSALT_INSTALLERS = [\"pacman\", \"aur\", \"aur-git\"]\n\n\n\n\n\n\n\n\n\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def bootstrap():\n \"\"\"\n Bootstrap Arch Linux.\n\n Only the bare essentials, the configurator will take care of the rest.\n \"\"\"\n # put new mkinitcpio.conf in place\n run(\"mv /etc/mkinitcpio.conf.pacnew /etc/mkinitcpio.conf\")\n sed(\"/etc/mkinitcpio.conf\",\n 'MODULES=\"\"',\n 'MODULES=\"xen-blkfront xen-fbfront xen-kbdfront xen-netfront xen-pcifront xenbus_probe_frontend xenfs\"') # nopep8\n sed(\"/etc/mkinitcpio.conf\",\n 'HOOKS=\"base udev autodetect modconf block filesystems keyboard fsck',\n 'HOOKS=\"base udev block filesystems shutdown autodetect\"')\n\n # upgrade pacakges\n run(\"pacman --noconfirm -Syu\")\n\n # # put new pacman.conf in place\n # run(\"mv /etc/pacman.conf.pacnew /etc/pacman.conf\")\n\n # install essential packages\n run(\"pacman --noconfirm -S base-devel\")\n run(\"pacman --noconfirm -S curl git rsync\")\n\n # allow users in the wheel group to sudo without a password\n uncomment(\"/etc/sudoers\", \"wheel.*NOPASSWD\")\n\n # create a user, named 'aur', to safely install AUR packages under fakeroot\n # uid and gid values auto increment from 1000\n # to prevent conficts set the 'aur' user's gid and uid to 902\n run(\"groupadd -g 902 aur && useradd -m -u 902 -g 902 -G wheel aur\")\n\n # install yaourt (TODO: this can be moved into salt)\n sudo(\"rm -rf /home/aur/.builds && mkdir /home/aur/.builds/\", user=\"aur\")\n with cd(\"/home/aur/.builds/\"):\n sudo(\"bash <(curl aur.sh) -si --noconfirm package-query yaourt\", user=\"aur\")\n\n if not contains(\"/proc/1/comm\", \"systemd\"):\n abort(\"systemd is not installed properly\")\n run(\"locale-gen\")\n run(\"localectl set-locale LANG='en_US.utf8'\")\n run(\"timedatectl set-timezone US/Central\")", "metadata": "root.bootstrap", "header": "['module', '___EOS___']", "index": 16 }, { "content": "def install_salt(installer=\"pacman\"):\n \"\"\"\n Install salt with the chosen installer.\n \"\"\"\n append(\"/etc/hosts\",\n \"{0} saltmaster-private\".format(env.master_server.private_ip))\n with cd(\"/home/aur/\"):\n if installer == \"pacman\":\n run(\"pacman --noconfirm -S salt\")\n elif installer == \"aur\":\n sudo(\"yaourt --noconfirm -S salt\", user=\"aur\")\n elif installer == \"aur-git\":\n sudo(\"yaourt --noconfirm -S salt-git\", user=\"aur\")\n else:\n raise NotImplementedError()", "metadata": "root.install_salt", "header": "['module', '___EOS___']", "index": 61 }, { "content": "def setup_salt():\n \"\"\"\n Setup the salt configuration files and enable dameon on a reboot.\n See: http://salt.readthedocs.org/en/latest/topics/installation/arch.html\n \"\"\"\n server = [s for s in env.bootmachine_servers if s.public_ip == env.host][0]\n\n if env.host == env.master_server.public_ip:\n run(\"touch /etc/salt/master\")\n append(\"/etc/salt/master\", \"file_roots:\\n base:\\n - {0}\".format(\n settings.REMOTE_STATES_DIR))\n append(\"/etc/salt/master\", \"pillar_roots:\\n base:\\n - {0}\".format(\n settings.REMOTE_PILLARS_DIR))\n run(\"systemctl enable salt-master\")\n run(\"touch /etc/salt/minion\")\n append(\"/etc/salt/minion\", \"master: {0}\".format(env.master_server.private_ip))\n append(\"/etc/salt/minion\", \"id: {0}\".format(server.name))\n append(\"/etc/salt/minion\", \"grains:\\n roles:\")\n for role in server.roles:\n append(\"/etc/salt/minion\", \" - {0}\".format(role))\n run(\"systemctl enable salt-minion\")", "metadata": "root.setup_salt", "header": "['module', '___EOS___']", "index": 78 }, { "content": "def start_salt():\n \"\"\"\n Starts salt master and minions.\n \"\"\"\n with fabric_settings(warn_only=True):\n if env.host == env.master_server.public_ip:\n sudo(\"systemctl start salt-master\")\n time.sleep(3)\n sudo(\"systemctl start salt-minion\")", "metadata": "root.start_salt", "header": "['module', '___EOS___']", "index": 101 }, { "content": "def stop_salt():\n \"\"\"\n Stops salt master and minions.\n \"\"\"\n with fabric_settings(warn_only=True):\n if env.host == env.master_server.public_ip:\n sudo(\"systemctl stop salt-master\")\n sudo(\"systemctl stop salt-minion\")", "metadata": "root.stop_salt", "header": "['module', '___EOS___']", "index": 112 }, { "content": "def restart_salt():\n \"\"\"\n Restart salt master and the minions.\n \"\"\"\n stop_salt()\n start_salt()", "metadata": "root.restart_salt", "header": "['module', '___EOS___']", "index": 122 } ]
[ { "span": "import urllib2", "start_line": 1, "start_column": 0, "end_line": 1, "end_column": 14 }, { "span": "from fabric.operations import reboot", "start_line": 6, "start_column": 0, "end_line": 6, "end_column": 36 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "import_", "time_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "urllib2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "fabric_", "._", "api_", "import_", "env_", ",_", "run_", ",_", "sudo_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "fabric_", "._", "context", "\\u", "managers_", "import_", "cd_", ",_", "settings_", "as_", "fab", "ric", "\\u", "settings_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "fabric_", "._", "contrib_", "._", "files_", "import_", "append_", ",_", "contains_", ",_", "sed_", ",_", "uncomm", "ent_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "fabric_", "._", "operations_", "import_", "reboot_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "fabric_", "._", "utils_", "import_", "abort_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "settings_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "DIST", "RO", "_", "=_", "\"", "ARCH", "\\u", "2014", "5", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "SAL", "T", "\\u", "INSTALLE", "RS_", "=_", "[_", "\"", "pac", "man", "\"_", ",_", "\"", "aur", "\"_", ",_", "\"", "aur", "-", "git", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "bootstrap_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Boots", "trap", " ", "Arch", " ", "Lin", "ux", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "On", "ly", " ", "the", " ", "bare", " ", "essential", "s", ",", " ", "the", " ", "configurator", " ", "will", " ", "take", " ", "care", " ", "of", " ", "the", " ", "rest", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "put", " ", "new", " ", "mk", "init", "cpi", "o", ".", "conf", " ", "in", " ", "place_", "\\u\\u\\uNL\\u\\u\\u_", "run_", "(_", "\"", "mv", " ", "/", "etc", "/", "mk", "init", "cpi", "o", ".", "conf", ".", "pac", "new", " ", "/", "etc", "/", "mk", "init", "cpi", "o", ".", "conf", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sed_", "(_", "\"/", "etc", "/", "mk", "init", "cpi", "o", ".", "conf", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "MODUL", "ES", "=\"\"", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "MODUL", "ES", "=\"", "xen", "-", "blk", "front", " ", "xen", "-", "fb", "front", " ", "xen", "-", "kbd", "front", " ", "xen", "-", "netf", "ront", " ", "xen", "-", "pci", "front", " ", "xen", "bus", "\\u", "prob", "e\\u", "front", "end", " ", "xen", "fs", "\"'_", ")_", "#", " ", "nop", "ep", "8_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sed_", "(_", "\"/", "etc", "/", "mk", "init", "cpi", "o", ".", "conf", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "HOOK", "S", "=\"", "base", " ", "udev", " ", "autode", "tect", " ", "mod", "conf", " ", "block", " ", "filesystem", "s", " ", "keyb", "oard", " ", "fsc", "k", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "HOOK", "S", "=\"", "base", " ", "udev", " ", "block", " ", "filesystem", "s", " ", "shut", "down", " ", "autode", "tect", "\"'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "upgrade", " ", "pac", "ak", "ges_", "\\u\\u\\uNL\\u\\u\\u_", "run_", "(_", "\"", "pac", "man", " ", "--", "noco", "nfi", "rm", " ", "-", "Sy", "u", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "#", " ", "put", " ", "new", " ", "pac", "man", ".", "conf", " ", "in", " ", "place_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "run", "(\"", "mv", " ", "/", "etc", "/", "pac", "man", ".", "conf", ".", "pac", "new", " ", "/", "etc", "/", "pac", "man", ".", "conf", "\")", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "install", " ", "essential", " ", "packages_", "\\u\\u\\uNL\\u\\u\\u_", "run_", "(_", "\"", "pac", "man", " ", "--", "noco", "nfi", "rm", " ", "-", "S", " ", "base", "-", "deve", "l", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "run_", "(_", "\"", "pac", "man", " ", "--", "noco", "nfi", "rm", " ", "-", "S", " ", "curl", " ", "git", " ", "rsync", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "allow", " ", "users", " ", "in", " ", "the", " ", "wheel", " ", "group", " ", "to", " ", "sudo", " ", "with", "out", " ", "a", " ", "password_", "\\u\\u\\uNL\\u\\u\\u_", "uncomm", "ent_", "(_", "\"/", "etc", "/", "sudo", "ers", "\"_", ",_", "\"", "wheel", ".*", "NOP", "ASS", "WD", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "create", " ", "a", " ", "user", ",", " ", "named", " ", "'", "aur", "',", " ", "to", " ", "safe", "ly", " ", "install", " ", "AU", "R", " ", "package", "s", " ", "under", " ", "faker", "oot_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "uid", " ", "and", " ", "gid", " ", "values", " ", "auto", " ", "increment", " ", "from", " ", "1000_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "to", " ", "prevent", " ", "confi", "ct", "s", " ", "set", " ", "the", " ", "'", "aur", "'", " ", "user", "'", "s", " ", "gid", " ", "and", " ", "uid", " ", "to", " ", "902", "_", "\\u\\u\\uNL\\u\\u\\u_", "run_", "(_", "\"", "group", "add", " ", "-", "g", " ", "902", " ", "aur", " ", "&&", " ", "usera", "dd", " ", "-", "m", " ", "-", "u", " ", "902", " ", "-", "g", " ", "902", " ", "-", "G", " ", "wheel", " ", "aur", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "install", " ", "ya", "our", "t", " ", "(", "TOD", "O", ":", " ", "this", " ", "can", " ", "be", " ", "moved", " ", "int", "o", " ", "salt", ")_", "\\u\\u\\uNL\\u\\u\\u_", "sudo_", "(_", "\"", "rm", " ", "-", "rf", " ", "/", "home", "/", "aur", "/.", "builds", " ", "&&", " ", "mkd", "ir", " ", "/", "home", "/", "aur", "/.", "builds", "/\"_", ",_", "user_", "=_", "\"", "aur", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "cd_", "(_", "\"/", "home", "/", "aur", "/.", "builds", "/\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sudo_", "(_", "\"", "bash", " ", "<", "(", "curl", " ", "aur", ".", "sh", ")", " ", "-", "si", " ", "--", "noco", "nfi", "rm", " ", "package", "-", "query", " ", "ya", "our", "t", "\"_", ",_", "user_", "=_", "\"", "aur", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "contains_", "(_", "\"/", "proc", "/", "1", "/", "comm", "\"_", ",_", "\"", "system", "d", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "abort_", "(_", "\"", "system", "d", " ", "is", " ", "not", " ", "install", "ed", " ", "proper", "ly", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "run_", "(_", "\"", "locale", "-", "gen", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "run_", "(_", "\"", "locale", "ctl", " ", "set", "-", "locale", " ", "LANG", "='", "en", "\\u", "US", ".", "utf", "8", "'\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "run_", "(_", "\"", "timed", "ate", "ctl", " ", "set", "-", "timezon", "e", " ", "US", "/", "Cent", "ral", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "install", "\\u", "salt_", "(_", "installer_", "=_", "\"", "pac", "man", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Install", " ", "salt", " ", "with", " ", "the", " ", "chosen", " ", "installer", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "append_", "(_", "\"/", "etc", "/", "host", "s", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"{", "0", "}", " ", "salt", "master", "-", "private", "\"_", "._", "format_", "(_", "env_", "._", "master", "\\u", "server_", "._", "private", "\\u", "ip_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "cd_", "(_", "\"/", "home", "/", "aur", "/\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "installer_", "==_", "\"", "pac", "man", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "run_", "(_", "\"", "pac", "man", " ", "--", "noco", "nfi", "rm", " ", "-", "S", " ", "salt", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "installer_", "==_", "\"", "aur", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sudo_", "(_", "\"", "ya", "our", "t", " ", "--", "noco", "nfi", "rm", " ", "-", "S", " ", "salt", "\"_", ",_", "user_", "=_", "\"", "aur", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "installer_", "==_", "\"", "aur", "-", "git", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sudo_", "(_", "\"", "ya", "our", "t", " ", "--", "noco", "nfi", "rm", " ", "-", "S", " ", "salt", "-", "git", "\"_", ",_", "user_", "=_", "\"", "aur", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Not", "Impl", "ement", "ed", "Error_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "setup", "\\u", "salt_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Set", "up", " ", "the", " ", "salt", " ", "configura", "tion", " ", "files", " ", "and", " ", "enable", " ", "dam", "eon", " ", "on", " ", "a", " ", "rebo", "ot", ".", "\\", "10", ";", " ", " ", " ", " ", "See", ":", " ", "http", "://", "salt", ".", "read", "the", "docs", ".", "org", "/", "en", "/", "late", "st", "/", "topic", "s", "/", "installation", "/", "arch", ".", "html", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "server_", "=_", "[_", "s_", "for_", "s_", "in_", "env_", "._", "boot", "machine", "\\u", "servers_", "if_", "s_", "._", "public", "\\u", "ip_", "==_", "env_", "._", "host_", "]_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "env_", "._", "host_", "==_", "env_", "._", "master", "\\u", "server_", "._", "public", "\\u", "ip_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "run_", "(_", "\"", "touch", " ", "/", "etc", "/", "salt", "/", "master", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "append_", "(_", "\"/", "etc", "/", "salt", "/", "master", "\"_", ",_", "\"", "file", "\\u", "root", "s", ":\\\\", "n", " ", " ", "base", ":\\\\", "n", " ", " ", " ", " ", "-", " ", "{", "0", "}\"_", "._", "format_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "settings_", "._", "REMO", "TE", "\\u", "STATE", "S", "\\u", "DIR_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "append_", "(_", "\"/", "etc", "/", "salt", "/", "master", "\"_", ",_", "\"", "pillar", "\\u", "root", "s", ":\\\\", "n", " ", " ", "base", ":\\\\", "n", " ", " ", " ", " ", "-", " ", "{", "0", "}\"_", "._", "format_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "settings_", "._", "REMO", "TE", "\\u", "PI", "LLA", "RS", "\\u", "DIR_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "run_", "(_", "\"", "system", "ctl", " ", "enable", " ", "salt", "-", "master", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "run_", "(_", "\"", "touch", " ", "/", "etc", "/", "salt", "/", "minion", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "append_", "(_", "\"/", "etc", "/", "salt", "/", "minion", "\"_", ",_", "\"", "master", ":", " ", "{", "0", "}\"_", "._", "format_", "(_", "env_", "._", "master", "\\u", "server_", "._", "private", "\\u", "ip_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "append_", "(_", "\"/", "etc", "/", "salt", "/", "minion", "\"_", ",_", "\"", "id", ":", " ", "{", "0", "}\"_", "._", "format_", "(_", "server_", "._", "name_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "append_", "(_", "\"/", "etc", "/", "salt", "/", "minion", "\"_", ",_", "\"", "grains", ":\\\\", "n", " ", " ", "role", "s", ":\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "role_", "in_", "server_", "._", "roles_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "append_", "(_", "\"/", "etc", "/", "salt", "/", "minion", "\"_", ",_", "\"", " ", " ", " ", " ", "-", " ", "{", "0", "}\"_", "._", "format_", "(_", "role_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "run_", "(_", "\"", "system", "ctl", " ", "enable", " ", "salt", "-", "minion", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "start", "\\u", "salt_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Start", "s", " ", "salt", " ", "master", " ", "and", " ", "minion", "s", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "fab", "ric", "\\u", "settings_", "(_", "warn", "\\u", "only_", "=_", "True_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "env_", "._", "host_", "==_", "env_", "._", "master", "\\u", "server_", "._", "public", "\\u", "ip_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sudo_", "(_", "\"", "system", "ctl", " ", "start", " ", "salt", "-", "master", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "time_", "._", "sleep_", "(_", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sudo_", "(_", "\"", "system", "ctl", " ", "start", " ", "salt", "-", "minion", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "stop", "\\u", "salt_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Stops", " ", "salt", " ", "master", " ", "and", " ", "minion", "s", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "fab", "ric", "\\u", "settings_", "(_", "warn", "\\u", "only_", "=_", "True_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "env_", "._", "host_", "==_", "env_", "._", "master", "\\u", "server_", "._", "public", "\\u", "ip_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sudo_", "(_", "\"", "system", "ctl", " ", "stop", " ", "salt", "-", "master", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "sudo_", "(_", "\"", "system", "ctl", " ", "stop", " ", "salt", "-", "minion", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "restart", "\\u", "salt_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Restart", " ", "salt", " ", "master", " ", "and", " ", "the", " ", "minion", "s", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "stop", "\\u", "salt_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "start", "\\u", "salt_", "(_", ")_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 0, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2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ct.py
[ { "content": "def eddy_correct(param):\n\n sct.printv('\\n\\n\\n\\n===================================================',param.verbose)\n sct.printv(' Running: eddy_correct', param.verbose)\n sct.printv('===================================================\\n',param.verbose)\n\n fname_data = param.fname_data\n min_norm = param.min_norm\n cost_function = param.cost_function_flirt\n verbose = param.verbose\n \n sct.printv(('Input File:'+ param.fname_data),verbose)\n sct.printv(('Bvecs File:' + param.fname_bvecs),verbose)\n \n #Extract path, file and extension\n path_data, file_data, ext_data = sct.extract_fname(fname_data)\n \n if param.mat_eddy=='': param.mat_eddy= 'mat_eddy/'\n if not os.path.exists(param.mat_eddy): os.makedirs(param.mat_eddy)\n mat_eddy = param.mat_eddy\n \n #Schedule file for FLIRT\n schedule_file = path_sct + '/flirtsch/schedule_TxTy_2mmScale.sch'\n sct.printv(('\\n.. Schedule file: '+ schedule_file),verbose)\n\n #Swap X-Y dimension (to have X as phase-encoding direction)\n if param.swapXY==1:\n sct.printv('\\nSwap X-Y dimension (to have X as phase-encoding direction)',verbose)\n fname_data_new = 'tmp.data_swap'\n cmd = fsloutput + 'fslswapdim ' + fname_data + ' -y -x -z ' + fname_data_new\n status, output = sct.run(cmd,verbose)\n sct.printv(('\\n.. updated data file name: '+fname_data_new),verbose)\n else:\n fname_data_new = fname_data\n\n # Get size of data\n sct.printv('\\nGet dimensions data...',verbose)\n nx, ny, nz, nt, px, py, pz, pt = Image(fname_data).dim\n sct.printv('.. '+str(nx)+' x '+str(ny)+' x '+str(nz)+' x '+str(nt),verbose)\n\n # split along T dimension\n sct.printv('\\nSplit along T dimension...',verbose)\n from sct_image import split_data\n im_to_split = Image(fname_data_new+'.nii')\n im_split_list = split_data(im_to_split, 3)\n for im in im_split_list:\n im.save()\n\n # cmd = fsloutput + 'fslsplit ' + fname_data_new + ' ' + file_data + '_T'\n # status, output = sct.run(cmd,verbose)\n\n #Slice-wise or Volume based method\n if param.slicewise:\n nb_loops = nz\n file_suffix=[]\n for iZ in range(nz):\n file_suffix.append('_Z'+ str(iZ).zfill(4))\n else:\n nb_loops = 1\n file_suffix = ['']\n\n # Identify pairs of opposite gradient directions\n sct.printv('\\nIdentify pairs of opposite gradient directions...',verbose)\n\n # Open bvecs file\n sct.printv('\\nOpen bvecs file...',verbose)\n bvecs = []\n with open(param.fname_bvecs) as f:\n for line in f:\n bvecs_new = map(float, line.split())\n bvecs.append(bvecs_new)\n\n # Check if bvecs file is nx3\n if not len(bvecs[0][:]) == 3:\n sct.printv('.. WARNING: bvecs file is 3xn instead of nx3. Consider using sct_dmri_transpose_bvecs.',verbose)\n sct.printv('Transpose bvecs...',verbose)\n # transpose bvecs\n bvecs = zip(*bvecs)\n bvecs = np.array(bvecs)\n\n opposite_gradients_iT = []\n opposite_gradients_jT = []\n index_identified = []\n index_b0 = []\n for iT in range(nt-1):\n if np.linalg.norm(bvecs[iT,:])!=0:\n if iT not in index_identified:\n jT = iT+1\n if np.linalg.norm((bvecs[iT,:]+bvecs[jT,:]))<min_norm:\n sct.printv(('.. Opposite gradient for #'+str(iT)+' is: #'+str(jT)),verbose)\n opposite_gradients_iT.append(iT)\n opposite_gradients_jT.append(jT)\n index_identified.append(iT)\n else:\n index_b0.append(iT)\n sct.printv(('.. Opposite gradient for #'+str(iT)+' is: NONE (b=0)'),verbose)\n nb_oppositeGradients = len(opposite_gradients_iT)\n sct.printv(('.. Number of gradient directions: ' + str(2*nb_oppositeGradients) + ' (2*' + str(nb_oppositeGradients) + ')'),verbose)\n sct.printv('.. Index b=0: '+ str(index_b0),verbose)\n\n\n # =========================================================================\n #\tFind transformation\n # =========================================================================\n for iN in range(nb_oppositeGradients):\n i_plus = opposite_gradients_iT[iN]\n i_minus = opposite_gradients_jT[iN]\n\n sct.printv(('\\nFinding affine transformation between volumes #'+str(i_plus)+' and #'+str(i_minus)+' (' + str(iN)+'/'+str(nb_oppositeGradients)+')'),verbose)\n sct.printv('------------------------------------------------------------------------------------\\n',verbose)\n \n #Slicewise correction\n if param.slicewise:\n sct.printv('\\nSplit volumes across Z...',verbose)\n fname_plus = file_data + '_T' + str(i_plus).zfill(4)\n fname_plus_Z = file_data + '_T' + str(i_plus).zfill(4) + '_Z'\n im_plus = Image(fname_plus+'.nii')\n im_plus_split_list = split_data(im_plus, 2)\n for im_p in im_plus_split_list:\n im_p.save()\n # cmd = fsloutput + 'fslsplit ' + fname_plus + ' ' + fname_plus_Z + ' -z'\n # status, output = sct.run(cmd,verbose)\n\n fname_minus = file_data + '_T' + str(i_minus).zfill(4)\n fname_minus_Z = file_data + '_T' + str(i_minus).zfill(4) + '_Z'\n im_minus = Image(fname_minus+'.nii')\n im_minus_split_list = split_data(im_minus, 2)\n for im_m in im_minus_split_list:\n im_m.save() # cmd = fsloutput + 'fslsplit ' + fname_minus + ' ' + fname_minus_Z + ' -z'\n # status, output = sct.run(cmd,verbose)\n\n #loop across Z\n for iZ in range(nb_loops):\n fname_plus = file_data + '_T' + str(i_plus).zfill(4) + file_suffix[iZ]\n\n fname_minus = file_data + '_T' + str(i_minus).zfill(4) + file_suffix[iZ]\n #Find transformation on opposite gradient directions\n sct.printv('\\nFind transformation for each pair of opposite gradient directions...',verbose)\n fname_plus_corr = file_data + '_T' + str(i_plus).zfill(4) + file_suffix[iZ] + '_corr_'\n omat = 'mat_' + file_data + '_T' + str(i_plus).zfill(4) + file_suffix[iZ] + '.txt'\n cmd = fsloutput+'flirt -in '+fname_plus+' -ref '+fname_minus+' -paddingsize 3 -schedule '+schedule_file+' -verbose 2 -omat '+omat+' -cost '+cost_function+' -forcescaling'\n status, output = sct.run(cmd,verbose)\n\n file = open(omat)\n Matrix = np.loadtxt(file)\n file.close()\n M = Matrix[0:4,0:4]\n sct.printv(('.. Transformation matrix:\\n'+str(M)),verbose)\n sct.printv(('.. Output matrix file: '+omat),verbose)\n\n # Divide affine transformation by two\n sct.printv('\\nDivide affine transformation by two...',verbose)\n A = (M - np.identity(4))/2\n Mplus = np.identity(4)+A\n omat_plus = mat_eddy + 'mat.T' + str(i_plus) + '_Z' + str(iZ) + '.txt'\n file = open(omat_plus,'w')\n np.savetxt(omat_plus, Mplus, fmt='%.6e', delimiter=' ', newline='\\n', header='', footer='', comments='#')\n file.close()\n sct.printv(('.. Output matrix file (plus): '+omat_plus),verbose)\n\n Mminus = np.identity(4)-A\n omat_minus = mat_eddy + 'mat.T' + str(i_minus) + '_Z' + str(iZ) + '.txt'\n file = open(omat_minus,'w')\n np.savetxt(omat_minus, Mminus, fmt='%.6e', delimiter=' ', newline='\\n', header='', footer='', comments='#')\n file.close()\n sct.printv(('.. Output matrix file (minus): '+omat_minus),verbose)\n\n # =========================================================================\n #\tApply affine transformation\n # =========================================================================\n\n sct.printv('\\nApply affine transformation matrix',verbose)\n sct.printv('------------------------------------------------------------------------------------\\n',verbose)\n\n for iN in range(nb_oppositeGradients):\n for iFile in range(2):\n if iFile==0:\n i_file = opposite_gradients_iT[iN]\n else:\n i_file = opposite_gradients_jT[iN]\n\n for iZ in range(nb_loops):\n fname = file_data + '_T' + str(i_file).zfill(4) + file_suffix[iZ]\n fname_corr = fname + '_corr_' + '__div2'\n omat = mat_eddy + 'mat.T' + str(i_file) + '_Z' + str(iZ) + '.txt'\n cmd = fsloutput + 'flirt -in ' + fname + ' -ref ' + fname + ' -out ' + fname_corr + ' -init ' + omat + ' -applyxfm -paddingsize 3 -interp ' + param.interp\n status, output = sct.run(cmd,verbose)\n\n \n # =========================================================================\n #\tMerge back across Z\n # =========================================================================\n\n sct.printv('\\nMerge across Z',verbose)\n sct.printv('------------------------------------------------------------------------------------\\n',verbose)\n\n for iN in range(nb_oppositeGradients):\n i_plus = opposite_gradients_iT[iN]\n fname_plus_corr = file_data + '_T' + str(i_plus).zfill(4) + '_corr_' + '__div2'\n cmd = fsloutput + 'fslmerge -z ' + fname_plus_corr\n\n for iZ in range(nz):\n fname_plus_Z_corr = file_data + '_T' + str(i_plus).zfill(4) + file_suffix[iZ] + '_corr_' + '__div2'\n cmd = cmd + ' ' + fname_plus_Z_corr\n status, output = sct.run(cmd,verbose)\n\n i_minus = opposite_gradients_jT[iN]\n fname_minus_corr = file_data + '_T' + str(i_minus).zfill(4) + '_corr_' + '__div2'\n cmd = fsloutput + 'fslmerge -z ' + fname_minus_corr\n\n for iZ in range(nz):\n fname_minus_Z_corr = file_data + '_T' + str(i_minus).zfill(4) + file_suffix[iZ] + '_corr_' + '__div2'\n cmd = cmd + ' ' + fname_minus_Z_corr\n status, output = sct.run(cmd,verbose)\n\n # =========================================================================\n #\tMerge files back\n # =========================================================================\n sct.printv('\\nMerge back across T...',verbose)\n sct.printv('------------------------------------------------------------------------------------\\n',verbose)\n \n fname_data_corr = param.output_path + file_data + '_eddy'\n cmd = fsloutput + 'fslmerge -t ' + fname_data_corr\n path_tmp = os.getcwd()\n for iT in range(nt):\n if os.path.isfile((path_tmp + '/' + file_data + '_T' + str(iT).zfill(4) + '_corr_' + '__div2.nii')):\n fname_data_corr_3d = file_data + '_T' + str(iT).zfill(4) + '_corr_' + '__div2'\n elif iT in index_b0:\n fname_data_corr_3d = file_data + '_T' + str(iT).zfill(4)\n \n cmd = cmd + ' ' + fname_data_corr_3d\n status, output = sct.run(cmd,verbose)\n\n #Swap back X-Y dimensions\n if param.swapXY==1:\n fname_data_final = fname_data\n sct.printv('\\nSwap back X-Y dimensions',verbose)\n cmd = fsloutput_temp + 'fslswapdim ' + fname_data_corr + ' -y -x -z ' + fname_data_final\n status, output = sct.run(cmd,verbose)\n else:\n fname_data_final = fname_data_corr\n\n sct.printv(('... File created: '+fname_data_final),verbose)\n \n sct.printv('\\n===================================================',verbose)\n sct.printv(' Completed: eddy_correct',verbose)\n sct.printv('===================================================\\n\\n\\n',verbose)", "metadata": "root.eddy_correct", "header": "['module', '___EOS___']", "index": 118 } ]
[ { "span": "fname_plus_Z ", "start_line": 233, "start_column": 12, "end_line": 233, "end_column": 24 }, { "span": "fname_minus_Z ", "start_line": 242, "start_column": 12, "end_line": 242, "end_column": 25 }, { "span": "status,", "start_line": 356, "start_column": 8, "end_line": 356, "end_column": 14 }, { "span": "output ", "start_line": 356, "start_column": 16, "end_line": 356, "end_column": 22 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "edd", "y", "\\u", "correct_", "(_", "param_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sct", "_", "._", "print", "v_", "(_", "'\\\\", "n", "\\\\", "n", "\\\\", "n", "\\\\", "n", "==============", "==============", "==============", "=========", "'_", ",_", "param_", "._", "verbose_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sct", "_", "._", "print", "v_", "(_", "'", " ", " ", " ", " ", " ", " ", "Run", "ning", ":", " ", "edd", "y", "\\u", "correct", "'_", ",_", "param_", "._", "verbose_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sct", "_", "._", "print", "v_", "(_", "'===", "==============", "==============", "==============", "=====", "=\\\\", "n", "'_", ",_", "param_", "._", "verbose_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "fname", "\\u", "data_", "=_", "param_", "._", "fname", "\\u", "data_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "min", "\\u", "norm_", "=_", "param_", "._", "min", "\\u", "norm_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cost", "\\u", "function_", "=_", "param_", "._", "cost", "\\u", "function", "\\u", "fli", "rt_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "verbose_", "=_", "param_", "._", "verbose_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "sct", "_", "._", "print", "v_", "(_", "(_", "'", "Inp", "ut", " ", "File", ":'_", "+_", "param_", "._", "fname", "\\u", "data_", ")_", ",_", "verbose_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sct", "_", "._", "print", "v_", "(_", "(_", "'", "Bv", "ecs", " ", "File", ":'_", "+_", "param_", "._", "fname", "\\u", "bv", "ecs_", ")_", ",_", "verbose_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "Extract", " ", "path", ",", " ", "file", " ", "and", " ", "extension_", "\\u\\u\\uNL\\u\\u\\u_", "path", "\\u", "data_", ",_", "file", "\\u", "data_", ",_", "ext", "\\u", "data_", "=_", "sct", "_", "._", "extract", "\\u", "fname_", "(_", "fname", "\\u", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "param_", "._", "mat", "\\u", "edd", "y_", "==_", "''_", ":_", "param_", "._", "mat", "\\u", "edd", "y_", "=_", "'", "mat", "\\u", "edd", "y", "/'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "os_", "._", "path_", "._", "exists_", "(_", "param_", "._", "mat", "\\u", "edd", "y_", ")_", ":_", "os_", "._", "makedirs_", "(_", "param_", "._", "mat", "\\u", "edd", "y_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mat", "\\u", "edd", "y_", "=_", "param_", "._", "mat", "\\u", "edd", "y_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "Schedule", " ", "file", " ", "for", " ", "FLI", "RT_", "\\u\\u\\uNL\\u\\u\\u_", "schedule", "\\u", "file_", "=_", "path", "\\u", "sct", "_", "+_", "'/", "fli", "rts", "ch", "/", "schedule", "\\u", "Tx", "Ty", "\\u", "2m", "m", "Scale", ".", "sch", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sct", "_", "._", "print", "v_", "(_", "(_", "'\\\\", "n", "..", " ", "Schedule", " ", "file", ":", " ", "'_", "+_", "schedule", "\\u", "file_", ")_", ",_", "verbose_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "Swa", "p", " ", "X", "-", "Y", " ", "dimension", " ", "(", "to", " ", "have", " ", "X", " ", "as", " ", "phase", "-", "encoding", " ", "direction", ")_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "param_", "._", "swap", "XY_", "==_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sct", "_", "._", "print", "v_", "(_", "'\\\\", "n", "Swa", "p", " ", "X", "-", "Y", " ", "dimension", " ", "(", "to", " ", "have", " ", "X", " ", "as", " ", "phase", "-", "encoding", " ", "direction", ")'_", ",_", "verbose_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fname", "\\u", "data\\u", "new_", "=_", "'", "tmp", ".", "data\\u", "swap", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cmd_", "=_", "fs", "lou", "tpu", "t_", "+_", "'", "fs", "ls", "wap", "dim", " ", "'_", "+_", "fname", "\\u", "data_", "+_", "'", " ", "-", "y", " ", "-", "x", " ", "-", "z", " ", "'_", "+_", "fname", "\\u", "data\\u", "new_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "status_", ",_", "output_", "=_", "sct", "_", "._", "run_", "(_", "cmd_", ",_", "verbose_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sct", "_", "._", "print", "v_", "(_", "(_", "'\\\\", "n", "..", " ", "update", "d", " ", "data", " ", "file", " ", "name", ":", " ", "'_", "+_", "fname", "\\u", "data\\u", "new_", ")_", ",_", "verbose_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "fname", "\\u", "data\\u", "new_", "=_", "fname", "\\u", "data_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Get", " ", "size", " ", "of", " ", "data_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "sct", "_", "._", "print", "v_", "(_", "'\\\\", "n", "Get", " ", "dimension", "s", " ", "data", "...'_", ",_", "verbose_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "nx_", ",_", "ny_", ",_", "nz_", ",_", "nt_", ",_", "px_", ",_", "py_", ",_", "pz", "_", ",_", "pt_", "=_", "Image_", "(_", "fname", "\\u", "data_", ")_", "._", "dim_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sct", "_", "._", "print", "v_", "(_", "'..", " ", "'_", "+_", "str_", "(_", "nx_", ")_", "+_", "'", " ", "x", " ", "'_", "+_", "str_", "(_", "ny_", ")_", "+_", "'", " ", "x", " ", "'_", "+_", "str_", "(_", "nz_", ")_", "+_", "'", " ", "x", " ", "'_", "+_", "str_", "(_", "nt_", ")_", ",_", "verbose_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "split", " ", "along", " ", "T", " ", "dimension_", "\\u\\u\\uNL\\u\\u\\u_", "sct", "_", "._", "print", "v_", "(_", "'\\\\", "n", "Split", " ", "along", " ", "T", " ", "dimension", "...'_", ",_", "verbose_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "sct", "\\u", "image_", "import_", "split", "\\u", "data_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "im", "\\u", "to", "\\u", "split_", "=_", "Image_", "(_", "fname", "\\u", "data\\u", "new_", "+_", "'.", "ni", "i", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "im", "\\u", "split", "\\u", "list_", "=_", "split", "\\u", "data_", "(_", "im", "\\u", "to", "\\u", "split_", ",_", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "im_", "in_", "im", "\\u", "split", "\\u", "list_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "im_", "._", "save_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "cmd", " ", "=", " ", "fs", "lou", "tpu", "t", " ", "+", " ", "'", "fs", "lsp", "lit", " ", "'", " ", "+", " ", "fname", "\\u", "data\\u", "new", " ", "+", " ", "'", " ", "'", " ", "+", " ", "file", "\\u", "data", " ", "+", " ", "'\\u", "T", "'_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "status", ",", " ", "output", " ", "=", " ", "sct", ".", "run", "(", "cmd", ",", "verbo", "se", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "Slice", "-", "wis", "e", " ", "or", " ", "Volume", " ", "based", " ", "method_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "param_", "._", "slice", "wise_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "nb", "\\u", "loops_", "=_", "nz_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "file", "\\u", "suffix_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i", "Z_", "in_", "range_", "(_", "nz_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "file", "\\u", "suffix_", "._", "append_", "(_", "'\\u", "Z", "'_", "+_", "str_", "(_", "i", "Z_", ")_", "._", "zfill_", "(_", "4_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "nb", "\\u", "loops_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "file", "\\u", "suffix_", "=_", "[_", "''_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Identif", "y", " ", "pair", "s", " ", "of", " ", "opposite", " ", "gradi", "ent", " ", "directions_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "sct", "_", "._", "print", "v_", "(_", "'\\\\", "n", "Identif", "y", " ", "pair", "s", " ", "of", " ", "opposite", " ", "gradi", "ent", " ", "direction", "s", "...'_", ",_", "verbose_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Open", " ", "bv", "ecs", " ", "file_", "\\u\\u\\uNL\\u\\u\\u_", "sct", "_", "._", "print", "v_", "(_", "'\\\\", "n", "Open", " ", "bv", "ecs", " ", "file", "...'_", ",_", "verbose_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bv", "ecs_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "open_", "(_", "param_", "._", "fname", "\\u", "bv", "ecs_", ")_", "as_", "f_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "line_", "in_", "f_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "bv", "ecs", "\\u", "new_", "=_", "map_", "(_", "float_", ",_", "line_", "._", "split_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bv", "ecs_", "._", "append_", "(_", "bv", "ecs", "\\u", "new_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Check", " ", "if", " ", "bv", "ecs", " ", "file", " ", "is", " ", "nx", "3_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "len_", "(_", "bv", "ecs_", "[_", "0_", "]_", "[_", ":_", "]_", ")_", "==_", "3_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sct", "_", "._", "print", "v_", "(_", "'..", " ", "WARN", "ING", ":", " ", "bv", "ecs", " ", "file", " ", "is", " ", "3x", "n", " ", "inst", "ead", " ", "of", " ", "nx", "3", ".", " ", "Consider", " ", "usi", "ng", " ", "sct", "\\u", "dmr", "i", "\\u", "transpose", "\\u", "bv", "ecs", ".'_", ",_", "verbose_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sct", "_", "._", "print", "v_", "(_", "'", "Transpose", " ", "bv", "ecs", "...'_", ",_", "verbose_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "transpose", " ", "bv", "ecs_", "\\u\\u\\uNL\\u\\u\\u_", "bv", "ecs_", "=_", "zip_", "(_", "*_", "bv", "ecs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "bv", "ecs_", "=_", "np_", "._", "array_", "(_", "bv", "ecs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "opposite", "\\u", "gradi", "ents", "\\u", "i", "T_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "opposite", "\\u", "gradi", "ents", "\\u", "j", "T_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "index", "\\u", "identifi", "ed_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "index", "\\u", "b0_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i", "T_", "in_", "range_", "(_", "nt_", "-_", "1_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "np_", "._", "linalg_", "._", "norm_", "(_", "bv", "ecs_", "[_", "i", "T_", ",_", ":_", "]_", ")_", "!=_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "i", "T_", "not_", "in_", "index", "\\u", "identifi", "ed_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "j", "T_", "=_", "i", "T_", "+_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "np_", "._", "linalg_", "._", "norm_", "(_", "(_", "bv", "ecs_", "[_", "i", "T_", ",_", ":_", "]_", "+_", "bv", "ecs_", "[_", "j", "T_", ",_", ":_", "]_", ")_", ")_", "<_", "min", "\\u", "norm_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "sct", "_", "._", "print", "v_", "(_", "(_", "'..", " ", "Oppo", "site", " ", "gradi", "ent", " ", "for", " ", "#'_", "+_", "str_", "(_", "i", "T_", ")_", "+_", "'", " ", "is", ":", " ", "#'_", "+_", "str_", "(_", "j", "T_", ")_", ")_", ",_", "verbose_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "opposite", "\\u", "gradi", "ents", "\\u", "i", "T_", "._", "append_", "(_", "i", "T_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "opposite", "\\u", "gradi", "ents", "\\u", "j", "T_", "._", "append_", "(_", "j", "T_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "index", "\\u", "identifi", "ed_", "._", "append_", "(_", "i", "T_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "index", "\\u", "b0_", "._", "append_", "(_", "i", "T_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sct", "_", "._", "print", "v_", "(_", "(_", "'..", " ", "Oppo", "site", " ", "gradi", "ent", " ", "for", " ", "#'_", "+_", "str_", "(_", "i", "T_", ")_", "+_", "'", " ", "is", ":", " ", "NON", "E", " ", "(", "b", "=", "0", ")'_", ")_", ",_", "verbose_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "nb", "\\u", "opposite", "Grad", "ients", "_", "=_", "len_", "(_", "opposite", "\\u", "gradi", "ents", "\\u", "i", "T_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sct", "_", "._", "print", "v_", "(_", "(_", "'..", " ", "Number", " ", "of", " ", "gradi", "ent", " ", "direction", "s", ":", " ", "'_", "+_", "str_", "(_", "2_", "*_", "nb", "\\u", "opposite", "Grad", "ients", "_", ")_", "+_", "'", " ", "(", "2", "*'_", "+_", "str_", "(_", "nb", "\\u", "opposite", "Grad", "ients", "_", ")_", "+_", "')'_", ")_", ",_", "verbose_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sct", "_", "._", "print", "v_", "(_", "'..", " ", "Index", " ", "b", "=", "0", ":", " ", "'_", "+_", "str_", "(_", "index", "\\u", "b0_", ")_", ",_", "verbose_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "==============", "==============", "==============", "==============", "==============", "===", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "\t", "Fin", "d", " ", "transformation_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "==============", "==============", "==============", "==============", "==============", "===", "_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "i", "N_", "in_", "range_", "(_", "nb", "\\u", "opposite", "Grad", "ients", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "i", "\\u", "plus_", "=_", "opposite", "\\u", "gradi", "ents", "\\u", "i", "T_", "[_", "i", "N_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "i", "\\u", "minus_", "=_", "opposite", "\\u", "gradi", "ents", "\\u", "j", "T_", "[_", "i", "N_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "sct", "_", "._", "print", "v_", "(_", "(_", "'\\\\", "n", "Finding", " ", "affin", "e", " ", "transformation", " ", "bet", "ween", " ", "volume", "s", " ", "#'_", "+_", "str_", "(_", "i", "\\u", "plus_", ")_", "+_", "'", " ", "and", " ", "#'_", "+_", "str_", "(_", "i", "\\u", "minus_", ")_", "+_", "'", " ", "('_", "+_", "str_", "(_", "i", "N_", ")_", "+_", "'/'_", "+_", "str_", "(_", "nb", "\\u", "opposite", "Grad", "ients", "_", ")_", "+_", "')'_", ")_", ",_", "verbose_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sct", "_", "._", "print", "v_", "(_", "'-------", "--------------", "--------------", "--------------", "--------------", "--------------", "-------", "\\\\", "n", "'_", ",_", "verbose_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "Slice", "wis", "e", " ", "correction_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "param_", "._", "slice", "wise_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sct", "_", "._", "print", "v_", "(_", "'\\\\", "n", "Split", " ", "volume", "s", " ", "acro", "ss", " ", "Z", "...'_", ",_", "verbose_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fname", "\\u", "plus_", "=_", "file", "\\u", "data_", "+_", "'\\u", "T", "'_", "+_", "str_", "(_", "i", "\\u", "plus_", ")_", "._", "zfill_", "(_", "4_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fname", "\\u", "plus", "\\u", "Z_", "=_", "file", "\\u", "data_", "+_", "'\\u", "T", "'_", "+_", "str_", "(_", "i", "\\u", "plus_", ")_", "._", "zfill_", "(_", "4_", ")_", "+_", "'\\u", "Z", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "im", "\\u", "plus_", "=_", "Image_", "(_", "fname", "\\u", "plus_", "+_", "'.", "ni", "i", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "im", "\\u", "plus", "\\u", "split", "\\u", "list_", "=_", "split", "\\u", "data_", "(_", "im", "\\u", "plus_", ",_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "im", "\\u", "p_", "in_", "im", "\\u", "plus", "\\u", "split", "\\u", "list_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "im", "\\u", "p_", "._", "save_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "cmd", " ", "=", " ", "fs", "lou", "tpu", "t", " ", "+", " ", "'", "fs", "lsp", "lit", " ", "'", " ", "+", " ", "fname", "\\u", "plus", " ", "+", " ", "'", " ", "'", " ", "+", " ", "fname", "\\u", "plus", "\\u", "Z", " ", "+", " ", "'", " ", "-", "z", "'_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "status", ",", " ", "output", " ", "=", " ", "sct", ".", "run", "(", "cmd", ",", "verbo", "se", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "fname", "\\u", "minus_", "=_", "file", "\\u", "data_", "+_", "'\\u", "T", "'_", "+_", "str_", "(_", "i", "\\u", "minus_", ")_", "._", "zfill_", "(_", "4_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fname", "\\u", "minu", "s", "\\u", "Z_", "=_", "file", "\\u", "data_", "+_", "'\\u", "T", "'_", "+_", "str_", "(_", "i", "\\u", "minus_", ")_", "._", "zfill_", "(_", "4_", ")_", "+_", "'\\u", "Z", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "im", "\\u", "minus_", "=_", "Image_", "(_", "fname", "\\u", "minus_", "+_", "'.", "ni", "i", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "im", "\\u", "minu", "s", "\\u", "split", "\\u", "list_", "=_", "split", "\\u", "data_", "(_", "im", "\\u", "minus_", ",_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "im", "\\u", "m_", "in_", "im", "\\u", "minu", "s", "\\u", "split", "\\u", "list_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "im", "\\u", "m_", "._", "save_", "(_", ")_", "#", " ", "cmd", " ", "=", " ", "fs", "lou", "tpu", "t", " ", "+", " ", "'", "fs", "lsp", "lit", " ", "'", " ", "+", " ", "fname", "\\u", "minu", "s", " ", "+", " ", "'", " ", "'", " ", "+", " ", "fname", "\\u", "minu", "s", "\\u", "Z", " ", "+", " ", "'", " ", "-", "z", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "status", ",", " ", "output", " ", "=", " ", "sct", ".", "run", "(", "cmd", ",", "verbo", "se", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "loop", " ", "acro", "ss", " ", "Z_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "i", "Z_", "in_", "range_", "(_", "nb", "\\u", "loops_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "fname", "\\u", "plus_", "=_", "file", "\\u", "data_", "+_", "'\\u", "T", "'_", "+_", "str_", "(_", "i", "\\u", "plus_", ")_", "._", "zfill_", "(_", "4_", ")_", "+_", "file", "\\u", "suffix_", "[_", "i", "Z_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "fname", "\\u", "minus_", "=_", "file", "\\u", "data_", "+_", "'\\u", "T", "'_", "+_", "str_", "(_", "i", "\\u", "minus_", ")_", "._", "zfill_", "(_", "4_", ")_", "+_", "file", "\\u", "suffix_", "[_", "i", "Z_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "Fin", "d", " ", "transformation", " ", "on", " ", "opposite", " ", "gradi", "ent", " ", "directions_", "\\u\\u\\uNL\\u\\u\\u_", "sct", "_", "._", "print", "v_", "(_", "'\\\\", "n", "Fin", "d", " ", "transformation", " ", "for", " ", "each", " ", "pair", " ", "of", " ", "opposite", " ", "gradi", "ent", " ", "direction", "s", "...'_", ",_", "verbose_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fname", "\\u", "plus", "\\u", "corr_", "=_", "file", "\\u", "data_", "+_", "'\\u", "T", "'_", "+_", "str_", "(_", "i", "\\u", "plus_", ")_", "._", "zfill_", "(_", "4_", ")_", "+_", "file", "\\u", "suffix_", "[_", "i", "Z_", "]_", "+_", "'\\u", "corr", "\\u'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "oma", "t_", "=_", "'", "mat", "\\u'_", "+_", "file", "\\u", "data_", "+_", "'\\u", "T", "'_", "+_", "str_", "(_", "i", "\\u", "plus_", ")_", "._", "zfill_", "(_", "4_", ")_", "+_", "file", "\\u", "suffix_", "[_", "i", "Z_", "]_", "+_", "'.", "txt", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cmd_", "=_", "fs", "lou", "tpu", "t_", "+_", "'", "fli", "rt", " ", "-", "in", " ", "'_", "+_", "fname", "\\u", "plus_", "+_", "'", " ", "-", "ref", " ", "'_", "+_", "fname", "\\u", "minus_", "+_", "'", " ", "-", "paddings", "ize", " ", "3", " ", "-", "schedule", " ", "'_", "+_", "schedule", "\\u", "file_", "+_", "'", " ", "-", "verbo", "se", " ", "2", " ", "-", "oma", "t", " ", "'_", "+_", "oma", "t_", "+_", "'", " ", "-", "cost", " ", "'_", "+_", "cost", "\\u", "function_", "+_", "'", " ", "-", "force", "scal", "ing", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "status_", ",_", "output_", "=_", "sct", "_", "._", "run_", "(_", "cmd_", ",_", "verbose_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "file_", "=_", "open_", "(_", "oma", "t_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Matrix_", "=_", "np_", "._", "loadtxt_", "(_", "file_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "file_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "M_", "=_", "Matrix_", "[_", "0_", ":_", "4_", ",_", "0_", ":_", "4_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sct", "_", "._", "print", "v_", "(_", "(_", "'..", " ", "Transformation", " ", "matrix", ":\\\\", "n", "'_", "+_", "str_", "(_", "M_", ")_", ")_", ",_", "verbose_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sct", "_", "._", "print", "v_", "(_", "(_", "'..", " ", "Output", " ", "matrix", " ", "file", ":", " ", "'_", "+_", "oma", "t_", ")_", ",_", "verbose_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Divide", " ", "affin", "e", " ", "transformation", " ", "by", " ", "two_", "\\u\\u\\uNL\\u\\u\\u_", "sct", "_", "._", "print", "v_", "(_", "'\\\\", "n", "Divide", " ", "affin", "e", " ", "transformation", " ", "by", " ", "two", "...'_", ",_", "verbose_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "A_", "=_", "(_", "M_", "-_", "np_", "._", "identity_", "(_", "4_", ")_", ")_", "/_", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Mp", "lus", "_", "=_", "np_", "._", "identity_", "(_", "4_", ")_", "+_", "A_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "oma", "t", "\\u", "plus_", "=_", "mat", "\\u", "edd", "y_", "+_", "'", "mat", ".", "T", "'_", "+_", "str_", "(_", "i", "\\u", "plus_", ")_", "+_", "'\\u", "Z", "'_", "+_", "str_", "(_", "i", "Z_", ")_", "+_", "'.", "txt", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "file_", "=_", "open_", "(_", "oma", "t", "\\u", "plus_", ",_", "'", "w", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "np_", "._", "savetxt_", "(_", "oma", "t", "\\u", "plus_", ",_", "Mp", "lus", "_", ",_", "fmt_", "=_", "'%", ".6", "e", "'_", ",_", "delimiter_", "=_", "'", " ", " ", "'_", ",_", "newline_", "=_", "'\\\\", "n", "'_", ",_", "header_", "=_", "''_", ",_", "footer_", "=_", "''_", ",_", "comments_", "=_", "'#'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "file_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sct", "_", "._", "print", "v_", "(_", "(_", "'..", " ", "Output", " ", "matrix", " ", "file", " ", "(", "plus", "):", " ", "'_", "+_", "oma", "t", "\\u", "plus_", ")_", ",_", "verbose_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "Mm", "inu", "s_", "=_", "np_", "._", "identity_", "(_", "4_", ")_", "-_", "A_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "oma", "t", "\\u", "minus_", "=_", "mat", "\\u", "edd", "y_", "+_", "'", "mat", ".", "T", "'_", "+_", "str_", "(_", "i", "\\u", "minus_", ")_", "+_", "'\\u", "Z", "'_", "+_", "str_", "(_", "i", "Z_", ")_", "+_", "'.", "txt", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "file_", "=_", "open_", "(_", "oma", "t", "\\u", "minus_", ",_", "'", "w", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "np_", "._", "savetxt_", "(_", "oma", "t", "\\u", "minus_", ",_", "Mm", "inu", "s_", ",_", "fmt_", "=_", "'%", ".6", "e", "'_", ",_", "delimiter_", "=_", "'", " ", " ", "'_", ",_", "newline_", "=_", "'\\\\", "n", "'_", ",_", "header_", "=_", "''_", ",_", "footer_", "=_", "''_", ",_", "comments_", "=_", "'#'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "file_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sct", "_", "._", "print", "v_", "(_", "(_", "'..", " ", "Output", " ", "matrix", " ", "file", " ", "(", "minu", "s", "):", " ", "'_", "+_", "oma", "t", "\\u", "minus_", ")_", ",_", "verbose_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "==============", "==============", "==============", "==============", "==============", "===", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "\t", "Apply", " ", "affin", "e", " ", "transformation_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "==============", "==============", "==============", "==============", "==============", "===", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "sct", "_", "._", "print", "v_", "(_", "'\\\\", "n", "Apply", " ", "affin", "e", " ", "transformation", " ", "matrix", "'_", ",_", "verbose_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sct", "_", "._", "print", "v_", "(_", "'-------", "--------------", "--------------", "--------------", "--------------", "--------------", "-------", "\\\\", "n", "'_", ",_", "verbose_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "i", "N_", "in_", "range_", "(_", "nb", "\\u", "opposite", "Grad", "ients", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "i", "File_", "in_", "range_", "(_", "2_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "i", "File_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "i", "\\u", "file_", "=_", "opposite", "\\u", "gradi", "ents", "\\u", "i", "T_", "[_", "i", "N_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "i", "\\u", "file_", "=_", "opposite", "\\u", "gradi", "ents", "\\u", "j", "T_", "[_", "i", "N_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "i", "Z_", "in_", "range_", "(_", "nb", "\\u", "loops_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "fname_", "=_", "file", "\\u", "data_", "+_", "'\\u", "T", "'_", "+_", "str_", "(_", "i", "\\u", "file_", ")_", "._", "zfill_", "(_", "4_", ")_", "+_", "file", "\\u", "suffix_", "[_", "i", "Z_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fname", "\\u", "corr_", "=_", "fname_", "+_", "'\\u", "corr", "\\u'_", "+_", "'\\u", "\\u", "div", "2", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "oma", "t_", "=_", "mat", "\\u", "edd", "y_", "+_", "'", "mat", ".", "T", "'_", "+_", "str_", "(_", "i", "\\u", "file_", ")_", "+_", "'\\u", "Z", "'_", "+_", "str_", "(_", "i", "Z_", ")_", "+_", "'.", "txt", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cmd_", "=_", "fs", "lou", "tpu", "t_", "+_", "'", "fli", "rt", " ", "-", "in", " ", "'_", "+_", "fname_", "+_", "'", " ", "-", "ref", " ", "'_", "+_", "fname_", "+_", "'", " ", "-", "out", " ", "'_", "+_", "fname", "\\u", "corr_", "+_", "'", " ", "-", "init", " ", "'_", "+_", "oma", "t_", "+_", "'", " ", "-", "appl", "yx", "fm", " ", "-", "paddings", "ize", " ", "3", " ", "-", "interp", " ", "'_", "+_", "param_", "._", "interp_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "status_", ",_", "output_", "=_", "sct", "_", "._", "run_", "(_", "cmd_", ",_", "verbose_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "==============", "==============", "==============", "==============", "==============", "===", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "\t", "Merge", " ", "back", " ", "acro", "ss", " ", "Z_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "==============", "==============", "==============", "==============", "==============", "===", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "sct", "_", "._", "print", "v_", "(_", "'\\\\", "n", "Merge", " ", "acro", "ss", " ", "Z", "'_", ",_", "verbose_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sct", "_", "._", "print", "v_", "(_", "'-------", "--------------", "--------------", "--------------", "--------------", "--------------", "-------", "\\\\", "n", "'_", ",_", "verbose_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "i", "N_", "in_", "range_", "(_", "nb", "\\u", "opposite", "Grad", "ients", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "i", "\\u", "plus_", "=_", "opposite", "\\u", "gradi", "ents", "\\u", "i", "T_", "[_", "i", "N_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fname", "\\u", "plus", "\\u", "corr_", "=_", "file", "\\u", "data_", "+_", "'\\u", "T", "'_", "+_", "str_", "(_", "i", "\\u", "plus_", ")_", "._", "zfill_", "(_", "4_", ")_", "+_", "'\\u", "corr", "\\u'_", "+_", "'\\u", "\\u", "div", "2", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cmd_", "=_", "fs", "lou", "tpu", "t_", "+_", "'", "fs", "lm", "erge", " ", "-", "z", " ", "'_", "+_", "fname", "\\u", "plus", "\\u", "corr_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "i", "Z_", "in_", "range_", "(_", "nz_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "fname", "\\u", "plus", "\\u", "Z", "\\u", "corr_", "=_", "file", "\\u", "data_", "+_", "'\\u", "T", "'_", "+_", "str_", "(_", "i", "\\u", "plus_", ")_", "._", "zfill_", "(_", "4_", ")_", "+_", "file", "\\u", "suffix_", "[_", "i", "Z_", "]_", "+_", "'\\u", "corr", "\\u'_", "+_", "'\\u", "\\u", "div", "2", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cmd_", "=_", "cmd_", "+_", "'", " ", "'_", "+_", "fname", "\\u", "plus", "\\u", "Z", "\\u", "corr_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "status_", ",_", "output_", "=_", "sct", "_", "._", "run_", "(_", "cmd_", ",_", "verbose_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "i", "\\u", "minus_", "=_", "opposite", "\\u", "gradi", "ents", "\\u", "j", "T_", "[_", "i", "N_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fname", "\\u", "minu", "s", "\\u", "corr_", "=_", "file", "\\u", "data_", "+_", "'\\u", "T", "'_", "+_", "str_", "(_", "i", "\\u", "minus_", ")_", "._", "zfill_", "(_", "4_", ")_", "+_", "'\\u", "corr", "\\u'_", "+_", "'\\u", "\\u", "div", "2", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cmd_", "=_", "fs", "lou", "tpu", "t_", "+_", "'", "fs", "lm", "erge", " ", "-", "z", " ", "'_", "+_", "fname", "\\u", "minu", "s", "\\u", "corr_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "i", "Z_", "in_", "range_", "(_", "nz_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "fname", "\\u", "minu", "s", "\\u", "Z", "\\u", "corr_", "=_", "file", "\\u", "data_", "+_", "'\\u", "T", "'_", "+_", "str_", "(_", "i", "\\u", "minus_", ")_", "._", "zfill_", "(_", "4_", ")_", "+_", "file", "\\u", "suffix_", "[_", "i", "Z_", "]_", "+_", "'\\u", "corr", "\\u'_", "+_", "'\\u", "\\u", "div", "2", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cmd_", "=_", "cmd_", "+_", "'", " ", "'_", "+_", "fname", "\\u", "minu", "s", "\\u", "Z", "\\u", "corr_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "status_", ",_", "output_", "=_", "sct", "_", "._", "run_", "(_", "cmd_", ",_", "verbose_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "==============", "==============", "==============", "==============", "==============", "===", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "\t", "Merge", " ", "files", " ", "back_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "==============", "==============", "==============", "==============", "==============", "===", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "sct", "_", "._", "print", "v_", "(_", "'\\\\", "n", "Merge", " ", "back", " ", "acro", "ss", " ", "T", "...'_", ",_", "verbose_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sct", "_", "._", "print", "v_", "(_", "'-------", "--------------", "--------------", "--------------", "--------------", "--------------", "-------", "\\\\", "n", "'_", ",_", "verbose_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "fname", "\\u", "data\\u", "corr_", "=_", "param_", "._", "output", "\\u", "path_", "+_", "file", "\\u", "data_", "+_", "'\\u", "edd", "y", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cmd_", "=_", "fs", "lou", "tpu", "t_", "+_", "'", "fs", "lm", "erge", " ", "-", "t", " ", "'_", "+_", "fname", "\\u", "data\\u", "corr_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "path", "\\u", "tmp_", "=_", "os_", "._", "getcwd_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i", "T_", "in_", "range_", "(_", "nt_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "os_", "._", "path_", "._", "isfile_", "(_", "(_", "path", "\\u", "tmp_", "+_", "'/'_", "+_", "file", "\\u", "data_", "+_", "'\\u", "T", "'_", "+_", "str_", "(_", "i", "T_", ")_", "._", "zfill_", "(_", "4_", ")_", "+_", "'\\u", "corr", "\\u'_", "+_", "'\\u", "\\u", "div", "2", ".", "ni", "i", "'_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "fname", "\\u", "data\\u", "corr", "\\u", "3d_", "=_", "file", "\\u", "data_", "+_", "'\\u", "T", "'_", "+_", "str_", "(_", "i", "T_", ")_", "._", "zfill_", "(_", "4_", ")_", "+_", "'\\u", "corr", "\\u'_", "+_", "'\\u", "\\u", "div", "2", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "i", "T_", "in_", "index", "\\u", "b0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "fname", "\\u", "data\\u", "corr", "\\u", "3d_", "=_", "file", "\\u", "data_", "+_", "'\\u", "T", "'_", "+_", "str_", "(_", "i", "T_", ")_", "._", "zfill_", "(_", "4_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "cmd_", "=_", "cmd_", "+_", "'", " ", "'_", "+_", "fname", "\\u", "data\\u", "corr", "\\u", "3d_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "status_", ",_", "output_", "=_", "sct", "_", "._", "run_", "(_", "cmd_", ",_", "verbose_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "Swa", "p", " ", "back", " ", "X", "-", "Y", " ", "dimensions_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "param_", "._", "swap", "XY_", "==_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "fname", "\\u", "data\\u", "final_", "=_", "fname", "\\u", "data_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sct", "_", "._", "print", "v_", "(_", "'\\\\", "n", "Swa", "p", " ", "back", " ", "X", "-", "Y", " ", "dimension", "s", "'_", ",_", "verbose_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cmd_", "=_", "fs", "lou", "tpu", "t", "\\u", "temp_", "+_", "'", "fs", "ls", "wap", "dim", " ", "'_", "+_", "fname", "\\u", "data\\u", "corr_", "+_", "'", " ", "-", "y", " ", "-", "x", " ", "-", "z", " ", "'_", "+_", "fname", "\\u", "data\\u", "final_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "status_", ",_", "output_", "=_", "sct", "_", "._", "run_", "(_", "cmd_", ",_", "verbose_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "fname", "\\u", "data\\u", "final_", "=_", "fname", "\\u", "data\\u", "corr_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "sct", "_", "._", "print", "v_", "(_", "(_", "'...", " ", "File", " ", "created", ":", " ", "'_", "+_", "fname", "\\u", "data\\u", "final_", ")_", ",_", "verbose_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "sct", "_", "._", "print", "v_", "(_", "'\\\\", "n", "==============", "==============", "==============", "=========", "'_", ",_", "verbose_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sct", "_", "._", "print", "v_", "(_", "'", " ", " ", " ", " ", " ", " ", "Complete", "d", ":", " ", "edd", "y", "\\u", "correct", "'_", ",_", "verbose_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sct", "_", "._", "print", "v_", "(_", "'===", "==============", "==============", "==============", "=====", "=\\\\", "n", "\\\\", "n", "\\\\", "n", "'_", ",_", "verbose_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,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# _candidate_tempdir_list returns a nonempty list of strings\n\n cand = tempfile._candidate_tempdir_list()\n\n self.assertFalse(len(cand) == 0)\n for c in cand:\n self.assertIsInstance(c, str)", "metadata": "root.TestCandidateTempdirList.test_nonempty_list", "header": "['class', 'TestCandidateTempdirList', '(', 'BaseTestCase', ')', ':', '___EOS___']", "index": 165 }, { "content": " def test_same_thing(self):\n # _get_candidate_names always returns the same object\n a = tempfile._get_candidate_names()\n b = tempfile._get_candidate_names()\n\n self.assertTrue(a is b)", "metadata": "root.TestGetCandidateNames.test_same_thing", "header": "['class', 'TestGetCandidateNames', '(', 'BaseTestCase', ')', ':', '___EOS___']", "index": 250 }, { "content": " def test_sane_template(self):\n # gettempprefix returns a nonempty prefix string\n p = tempfile.gettempprefix()\n\n self.assertIsInstance(p, str)\n self.assertTrue(len(p) > 0)", "metadata": "root.TestGetTempPrefix.test_sane_template", "header": "['class', 'TestGetTempPrefix', '(', 'BaseTestCase', ')', ':', '___EOS___']", "index": 426 }, { "content": " def test_same_thing(self):\n # gettempdir always returns the same object\n a = tempfile.gettempdir()\n b = tempfile.gettempdir()\n\n self.assertTrue(a is b)", "metadata": "root.TestGetTempDir.test_same_thing", "header": "['class', 'TestGetTempDir', '(', 'BaseTestCase', ')', ':', '___EOS___']", "index": 472 }, { "content": " def test_fileno(self):\n # A SpooledTemporaryFile should roll over to a real file on fileno()\n f = self.do_create(max_size=30)\n self.assertFalse(f._rolled)\n self.assertTrue(f.fileno() > 0)\n self.assertTrue(f._rolled)", "metadata": "root.TestSpooledTemporaryFile.test_fileno", "header": "['class', 'TestSpooledTemporaryFile', '(', 'BaseTestCase', ')', ':', '___EOS___']", "index": 816 } ]
[ { "span": "self.assertFalse(len(cand) == 0)", "start_line": 170, "start_column": 8, "end_line": 170, "end_column": 40 }, { "span": "self.assertTrue(a is b)", "start_line": 255, "start_column": 8, "end_line": 255, "end_column": 31 }, { "span": "self.assertTrue(len(p) > 0)", "start_line": 431, "start_column": 8, "end_line": 431, "end_column": 35 }, { "span": "self.assertTrue(a is b)", "start_line": 477, "start_column": 8, "end_line": 477, "end_column": 31 }, { "span": "self.assertTrue(f.fileno() > 0)", "start_line": 820, "start_column": 8, "end_line": 820, "end_column": 39 } ]
[]
1
true
[ "[CLS]_", "Imp", "reci", "se_", "assert_", "[SEP]_", "class_", "Test", "Candidate", "Temp", "dir", "List_", "(_", "Base", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "test\\u", "none", "mpty", "\\u", "list_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "\\u", "candidate", "\\u", "tempdi", "r", "\\u", "list", " ", "return", "s", " ", "a", " ", "none", "mpty", " ", "list", " ", "of", " ", "strings_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cand_", "=_", "tempfile_", "._", "\\u", "candidate", "\\u", "tempdi", "r", "\\u", "list_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "len_", "(_", "cand_", ")_", "==_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "c_", "in_", "cand_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "Is", "Instance_", "(_", "c_", ",_", "str_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Get", "Candidate", "Names_", "(_", "Base", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "same", "\\u", "thing_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "\\u", "get", "\\u", "candidate", "\\u", "names", " ", "alw", "ay", "s", " ", "return", "s", " ", "the", " ", "same", " ", "object_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "a_", "=_", "tempfile_", "._", "\\u", "get", "\\u", "candidate", "\\u", "names_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "b_", "=_", "tempfile_", "._", "\\u", "get", "\\u", "candidate", "\\u", "names_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "a_", "is_", "b_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Get", "Temp", "Prefix_", "(_", "Base", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "test\\u", "sane", "\\u", "template_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "gett", "emp", "prefix", " ", "return", "s", " ", "a", " ", "none", "mpty", " ", "prefix", " ", "string_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "p_", "=_", "tempfile_", "._", "gett", "emp", "prefix_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Is", "Instance_", "(_", "p_", ",_", "str_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "len_", "(_", "p_", ")_", ">_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Get", "Temp", "Dir_", "(_", "Base", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "same", "\\u", "thing_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "gett", "emp", "dir", " ", "alw", "ay", "s", " ", "return", "s", " ", "the", " ", "same", " ", "object_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "a_", "=_", "tempfile_", "._", "gettempdir_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "b_", "=_", "tempfile_", "._", "gettempdir_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "a_", "is_", "b_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Spo", "ole", "d", "Tempora", "ry", "File_", "(_", "Base", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "fileno_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "A", " ", "Spo", "ole", "d", "Tempora", "ry", "File", " ", "shou", "ld", " ", "roll", " ", "over", " ", "to", " ", "a", " ", "real", " ", "file", " ", "on", " ", "filen", "o", "()", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "f_", "=_", "self_", "._", "do", "\\u", "create_", "(_", "max", "\\u", "size_", "=_", "30_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "f_", "._", "\\u", "rolle", "d_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "f_", "._", "fileno_", "(_", ")_", ">_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "f_", "._", "\\u", "rolle", "d_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[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1, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Variable defined multiple times
Workiva/furious/furious/async.py
[ { "content": " def _get_context_id(self):\n \"\"\"If this async is in a context set the context id.\"\"\"\n\n from furious.context import get_current_context\n\n context_id = self._options.get('context_id')\n\n if context_id:\n return context_id\n\n try:\n context = get_current_context()\n except errors.NotInContextError:\n context = None\n self.update_options(context_id=None)\n\n if context:\n context_id = context.id\n self.update_options(context_id=context_id)\n\n return context_id", "metadata": "root.Async._get_context_id", "header": "['class', 'Async', '(', 'object', ')', ':', '___EOS___']", "index": 404 }, { "content": " def _get_context_id(self):\n \"\"\"If this async is in a context set the context id.\"\"\"\n\n from furious.context import get_current_context\n\n context_id = self._options.get('context_id')\n\n if context_id:\n return context_id\n\n try:\n context = get_current_context()\n except errors.NotInContextError:\n context = None\n self.update_options(context_id=None)\n\n if context:\n context_id = context.id\n self.update_options(context_id=context_id)\n\n return context_id", "metadata": "root.Async._get_context_id", "header": "['class', 'Async', '(', 'object', ')', ':', '___EOS___']", "index": 522 } ]
[ { "span": "_get_context_id(", "start_line": 404, "start_column": 8, "end_line": 404, "end_column": 23 } ]
[ { "span": "_get_context_id(", "start_line": 522, "start_column": 8, "end_line": 522, "end_column": 23 } ]
1
true
[ "[CLS]_", "Variable_", "defined_", "multiple_", "times_", "[SEP]_", "class_", "Async", "_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "get", "\\u", "context", "\\u", "id_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "If", " ", "this", " ", "async", " ", "is", " ", "in", " ", "a", " ", "context", " ", "set", " ", "the", " ", "context", " ", "id", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "fur", "ious", "_", "._", "context_", "import_", "get", "\\u", "current", "\\u", "context_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "context", "\\u", "id_", "=_", "self_", "._", "\\u", "options_", "._", "get_", "(_", "'", "context", "\\u", "id", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "context", "\\u", "id_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "context", "\\u", "id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "context_", "=_", "get", "\\u", "current", "\\u", "context_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "errors_", "._", "Not", "In", "Context", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "context_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "update", "\\u", "options_", "(_", "context", "\\u", "id_", "=_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "context_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "context", "\\u", "id_", "=_", "context_", "._", "id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "update", "\\u", "options_", "(_", "context", "\\u", "id_", "=_", "context", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "context", "\\u", "id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Async", "_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "get", "\\u", "context", "\\u", "id_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "If", " ", "this", " ", "async", " ", "is", " ", "in", " ", "a", " ", "context", " ", "set", " ", "the", " ", "context", " ", "id", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "fur", "ious", "_", "._", "context_", "import_", "get", "\\u", "current", "\\u", "context_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "context", "\\u", "id_", "=_", "self_", "._", "\\u", "options_", "._", "get_", "(_", "'", "context", "\\u", "id", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "context", "\\u", "id_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "context", "\\u", "id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "context_", "=_", "get", "\\u", "current", "\\u", "context_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "errors_", "._", "Not", "In", "Context", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "context_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "update", "\\u", "options_", "(_", "context", "\\u", "id_", "=_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "context_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "context", "\\u", "id_", "=_", "context_", "._", "id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "update", "\\u", "options_", "(_", "context", "\\u", "id_", "=_", "context", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "context", "\\u", "id_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
aldebaran/qibuild/python/qibuild/test/test_qibuild_find.py
[ { "content": "## Copyright (c) 2012-2016 Aldebaran Robotics. All rights reserved.\n## Use of this source code is governed by a BSD-style license that can be\n## found in the COPYING file.\n\nimport qisys.error\nimport qibuild.config\nimport qibuild.cmake_builder\nfrom qibuild import find\n\nfrom qibuild.test.conftest import QiBuildAction\nfrom qitoolchain.test.conftest import QiToolchainAction\n\nimport pytest\n\n\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def test_find_target_in_project_cmake(qibuild_action, record_messages):\n qibuild_action.add_test_project(\"world\")\n qibuild_action.add_test_project(\"hello\")\n qibuild_action(\"configure\", \"hello\")\n record_messages.reset()\n qibuild_action(\"find\", \"--cmake\", \"hello\", \"world\")\n assert record_messages.find(\"WORLD_LIBRARIES\")", "metadata": "root.test_find_target_in_project_cmake", "header": "['module', '___EOS___']", "index": 14 }, { "content": "def test_find_target_in_toolchain_package_cmake(cd_to_tmpdir, record_messages):\n qibuild_action = QiBuildAction()\n qitoolchain_action = QiToolchainAction()\n build_worktree = qibuild_action.build_worktree\n qibuild_action.add_test_project(\"world\")\n qibuild_action.add_test_project(\"hello\")\n world_package = qibuild_action(\"package\", \"world\")\n qitoolchain_action(\"create\", \"foo\")\n qibuild.config.add_build_config(\"foo\", toolchain=\"foo\")\n qitoolchain_action(\"add-package\", \"-c\", \"foo\", world_package)\n build_worktree.worktree.remove_project(\"world\", from_disk=True)\n\n record_messages.reset()\n qibuild_action.chdir(\"hello\")\n qibuild_action(\"configure\", \"-c\", \"foo\")\n qibuild_action(\"find\", \"--cmake\", \"world\", \"-c\", \"foo\")\n\n assert record_messages.find(\"WORLD_LIBRARIES\")", "metadata": "root.test_find_target_in_toolchain_package_cmake", "header": "['module', '___EOS___']", "index": 22 }, { "content": "def test_find_target_in_build_dir(qibuild_action, record_messages):\n qibuild_action.add_test_project(\"world\")\n qibuild_action.add_test_project(\"hello\")\n qibuild_action(\"configure\", \"hello\")\n qibuild_action(\"make\", \"hello\")\n\n record_messages.reset()\n qibuild_action(\"find\", \"hello\", \"world\")\n assert record_messages.find(find.library_name(\"world\"))\n\n rc = qibuild_action(\"find\", \"hello\", \"libworld\", retcode=True)\n assert rc == 1", "metadata": "root.test_find_target_in_build_dir", "header": "['module', '___EOS___']", "index": 41 }, { "content": "def test_not_configured(qibuild_action):\n world_proj = qibuild_action.add_test_project(\"world\")\n qibuild_action.chdir(world_proj.path)\n # pylint: disable-msg=E1101\n with pytest.raises(qibuild.cmake_builder.NotConfigured):\n qibuild_action(\"find\", \"--cmake\", \"world\")", "metadata": "root.test_not_configured", "header": "['module', '___EOS___']", "index": 54 }, { "content": "def test_find_target_in_toolchain_package(cd_to_tmpdir, record_messages):\n qibuild_action = QiBuildAction()\n qitoolchain_action = QiToolchainAction()\n qibuild_action.add_test_project(\"world\")\n qibuild_action.add_test_project(\"hello\")\n world_package = qibuild_action(\"package\", \"world\")\n qitoolchain_action(\"create\", \"foo\")\n qibuild.config.add_build_config(\"foo\", toolchain=\"foo\")\n qitoolchain_action(\"add-package\", \"-c\", \"foo\", world_package)\n\n qibuild_action.chdir(\"hello\")\n qibuild_action(\"configure\", \"-c\", \"foo\")\n qibuild_action(\"make\", \"-c\", \"foo\")\n\n record_messages.reset()\n qibuild_action(\"find\", \"world\", \"-c\", \"foo\")\n assert record_messages.find(find.library_name(\"world\"))\n\n record_messages.reset()\n qibuild_action(\"find\", \"hello\", \"-c\", \"foo\")\n assert record_messages.find(find.binary_name(\"hello\"))\n\n rc = qibuild_action(\"find\", \"libeggs\", \"-c\", \"foo\", retcode=True)\n assert rc == 1", "metadata": "root.test_find_target_in_toolchain_package", "header": "['module', '___EOS___']", "index": 61 } ]
[ { "span": "import qisys.error", "start_line": 4, "start_column": 0, "end_line": 4, "end_column": 18 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "##", " ", "Copy", "right", " ", "(", "c", ")", " ", "2012", "-", "2016", " ", "Al", "deb", "aran", " ", "Robot", "ics", ".", " ", "All", " ", "rights", " ", "reserve", "d", "._", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "Us", "e", " ", "of", " ", "this", " ", "source", " ", "code", " ", "is", " ", "govern", "ed", " ", "by", " ", "a", " ", "BS", "D", "-", "style", " ", "license", " ", "tha", "t", " ", "can", " ", "be_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "found", " ", "in", " ", "the", " ", "COPY", "ING", " ", "file", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "qi", "sys_", "._", "error_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "qi", "build_", "._", "config_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "qi", "build_", "._", "cma", "ke", "\\u", "builder_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "qi", "build_", "import_", "find_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "qi", "build_", "._", "test_", "._", "conftest", "_", "import_", "Qi", "Build", "Action_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "qi", "toolchain_", "._", "test_", "._", "conftest", "_", "import_", "Qi", "Tool", "chain", "Action_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "pytest_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "test\\u", "find", "\\u", "target", "\\u", "in", "\\u", "project", "\\u", "cma", "ke_", "(_", "qi", "build", "\\u", "action_", ",_", "record", "\\u", "messages_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "qi", "build", "\\u", "action_", "._", "add", "\\u", "test\\u", "project_", "(_", "\"", "world", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "qi", "build", "\\u", "action_", "._", "add", "\\u", "test\\u", "project_", "(_", "\"", "hell", "o", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "qi", "build", "\\u", "action_", "(_", "\"", "configur", "e", "\"_", ",_", "\"", "hell", "o", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "record", "\\u", "messages_", "._", "reset_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "qi", "build", "\\u", "action_", "(_", "\"", "find", "\"_", ",_", "\"--", "cma", "ke", "\"_", ",_", "\"", "hell", "o", "\"_", ",_", "\"", "world", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "record", "\\u", "messages_", "._", "find_", "(_", "\"", "WORLD", "\\u", "LIBRARIES", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "find", "\\u", "target", "\\u", "in", "\\u", "toolchain", "\\u", "package", "\\u", "cma", "ke_", "(_", "cd", "\\u", "to", "\\u", "tmpdir_", ",_", "record", "\\u", "messages_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "qi", "build", "\\u", "action_", "=_", "Qi", "Build", "Action_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "qi", "toolchain", "\\u", "action_", "=_", "Qi", "Tool", "chain", "Action_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "build", "\\u", "work", "tree_", "=_", "qi", "build", "\\u", "action_", "._", "build", "\\u", "work", "tree_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "qi", "build", "\\u", "action_", "._", "add", "\\u", "test\\u", "project_", "(_", "\"", "world", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "qi", "build", "\\u", "action_", "._", "add", "\\u", "test\\u", "project_", "(_", "\"", "hell", "o", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "world", "\\u", "package_", "=_", "qi", "build", "\\u", "action_", "(_", "\"", "package", "\"_", ",_", "\"", "world", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "qi", "toolchain", "\\u", "action_", "(_", "\"", "create", "\"_", ",_", "\"", "foo", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "qi", "build_", "._", "config_", "._", "add", "\\u", "build", "\\u", "config_", "(_", "\"", "foo", "\"_", ",_", "toolchain_", "=_", "\"", "foo", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "qi", "toolchain", "\\u", "action_", "(_", "\"", "add", "-", "package", "\"_", ",_", "\"-", "c", "\"_", ",_", "\"", "foo", "\"_", ",_", "world", "\\u", "package_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "build", "\\u", "work", "tree_", "._", "work", "tree_", "._", "remove", "\\u", "project_", "(_", "\"", "world", "\"_", ",_", "from", "\\u", "disk_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "record", "\\u", "messages_", "._", "reset_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "qi", "build", "\\u", "action_", "._", "chdir_", "(_", "\"", "hell", "o", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "qi", "build", "\\u", "action_", "(_", "\"", "configur", "e", "\"_", ",_", "\"-", "c", "\"_", ",_", "\"", "foo", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "qi", "build", "\\u", "action_", "(_", "\"", "find", "\"_", ",_", "\"--", "cma", "ke", "\"_", ",_", "\"", "world", "\"_", ",_", "\"-", "c", "\"_", ",_", "\"", "foo", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "assert_", "record", "\\u", "messages_", "._", "find_", "(_", "\"", "WORLD", "\\u", "LIBRARIES", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "find", "\\u", "target", "\\u", "in", "\\u", "build", "\\u", "dir_", "(_", "qi", "build", "\\u", "action_", ",_", "record", "\\u", "messages_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "qi", "build", "\\u", "action_", "._", "add", "\\u", "test\\u", "project_", "(_", "\"", "world", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "qi", "build", "\\u", "action_", "._", "add", "\\u", "test\\u", "project_", "(_", "\"", "hell", "o", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "qi", "build", "\\u", "action_", "(_", "\"", "configur", "e", "\"_", ",_", "\"", "hell", "o", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "qi", "build", "\\u", "action_", "(_", "\"", "make", "\"_", ",_", "\"", "hell", "o", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "record", "\\u", "messages_", "._", "reset_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "qi", "build", "\\u", "action_", "(_", "\"", "find", "\"_", ",_", "\"", "hell", "o", "\"_", ",_", "\"", "world", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "record", "\\u", "messages_", "._", "find_", "(_", "find_", "._", "librar", "y", "\\u", "name_", "(_", "\"", "world", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "rc_", "=_", "qi", "build", "\\u", "action_", "(_", "\"", "find", "\"_", ",_", "\"", "hell", "o", "\"_", ",_", "\"", "lib", "world", "\"_", ",_", "retcode_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "rc_", "==_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "not", "\\u", "configured_", "(_", "qi", "build", "\\u", "action_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "world", "\\u", "proj_", "=_", "qi", "build", "\\u", "action_", "._", "add", "\\u", "test\\u", "project_", "(_", "\"", "world", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "qi", "build", "\\u", "action_", "._", "chdir_", "(_", "world", "\\u", "proj_", "._", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "pylint", ":", " ", "disable", "-", "msg", "=", "E1", "101_", "\\u\\u\\uNL\\u\\u\\u_", "with_", "pytest_", "._", "raises_", "(_", "qi", "build_", "._", "cma", "ke", "\\u", "builder_", "._", "Not", "Configured_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "qi", "build", "\\u", "action_", "(_", "\"", "find", "\"_", ",_", "\"--", "cma", "ke", "\"_", ",_", "\"", "world", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "find", "\\u", "target", "\\u", "in", "\\u", "toolchain", "\\u", "package_", "(_", "cd", "\\u", "to", "\\u", "tmpdir_", ",_", "record", "\\u", "messages_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "qi", "build", "\\u", "action_", "=_", "Qi", "Build", "Action_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "qi", "toolchain", "\\u", "action_", "=_", "Qi", "Tool", "chain", "Action_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "qi", "build", "\\u", "action_", "._", "add", "\\u", "test\\u", "project_", "(_", "\"", "world", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "qi", "build", "\\u", "action_", "._", "add", "\\u", "test\\u", "project_", "(_", "\"", "hell", "o", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "world", "\\u", "package_", "=_", "qi", "build", "\\u", "action_", "(_", "\"", "package", "\"_", ",_", "\"", "world", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "qi", "toolchain", "\\u", "action_", "(_", "\"", "create", "\"_", ",_", "\"", "foo", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "qi", "build_", "._", "config_", "._", "add", "\\u", "build", "\\u", "config_", "(_", "\"", "foo", "\"_", ",_", "toolchain_", "=_", "\"", "foo", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "qi", "toolchain", "\\u", "action_", "(_", "\"", "add", "-", "package", "\"_", ",_", "\"-", "c", "\"_", ",_", "\"", "foo", "\"_", ",_", "world", "\\u", "package_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "qi", "build", "\\u", "action_", "._", "chdir_", "(_", "\"", "hell", "o", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "qi", "build", "\\u", "action_", "(_", "\"", "configur", "e", "\"_", ",_", "\"-", "c", "\"_", ",_", "\"", "foo", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "qi", "build", "\\u", "action_", "(_", "\"", "make", "\"_", ",_", "\"-", "c", "\"_", ",_", "\"", "foo", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "record", "\\u", "messages_", "._", "reset_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "qi", "build", "\\u", "action_", "(_", "\"", "find", "\"_", ",_", "\"", "world", "\"_", ",_", "\"-", "c", "\"_", ",_", "\"", "foo", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "record", "\\u", "messages_", "._", "find_", "(_", "find_", "._", "librar", "y", "\\u", "name_", "(_", "\"", "world", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "record", "\\u", "messages_", "._", "reset_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "qi", "build", "\\u", "action_", "(_", "\"", "find", "\"_", ",_", "\"", "hell", "o", "\"_", ",_", "\"-", "c", "\"_", ",_", "\"", "foo", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "record", "\\u", "messages_", "._", "find_", "(_", "find_", "._", "binar", "y", "\\u", "name_", "(_", "\"", "hell", "o", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "rc_", "=_", "qi", "build", "\\u", "action_", "(_", "\"", "find", "\"_", ",_", "\"", "libe", "gg", "s", "\"_", ",_", "\"-", "c", "\"_", ",_", "\"", "foo", "\"_", ",_", "retcode_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "rc_", "==_", "1_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Module is imported with 'import' and 'import from'
simon-weber/gmusicapi/gmusicapi/gmtools/tools.py
[ { "content": "# -*- coding: utf-8 -*-\n\"\"\"Tools for manipulating client-received Google Music data.\"\"\"\nfrom __future__ import print_function, division, absolute_import, unicode_literals\nfrom future import standard_library\nstandard_library.install_aliases()\nfrom builtins import * # noqa\n\nimport operator\nimport re\nimport collections\n\nfrom collections import Counter\nfrom functools import reduce\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n# Not mine. From: http://en.wikipedia.org/wiki/Function_composition_(computer_science)\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[ { "span": "import collections", "start_line": 9, "start_column": 0, "end_line": 9, "end_column": 18 } ]
[]
1
true
[ "[CLS]_", "Module_", "is_", "imported_", "with_", "'", "import", "'_", "and_", "'", "import", " ", "from", "'_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "-*-", " ", "codi", "ng", ":", " ", "utf", "-", "8", " ", "-*-", "_", "\\u\\u\\uNL\\u\\u\\u_", "\"\"\"", "Tool", "s", " ", "for", " ", "manipulati", "ng", " ", "client", "-", "receive", "d", " ", "Goo", "gle", " ", "Music", " ", "data", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "\\u\\u", "future\\u\\u_", "import_", "print", "\\u", "function_", ",_", "division_", ",_", "abs", "olute", "\\u", "import_", ",_", "unicode", "\\u", "literals_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "future_", "import_", "standard", "\\u", "library_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "standard", "\\u", "library_", "._", "install", "\\u", "aliases_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "builtins_", "import_", "*_", "#", " ", "no", "qa_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "operator_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "re_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "collections_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "collections_", "import_", "Counter_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "functools_", "import_", "reduce_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Not", " ", "mine", ".", " ", "Fro", "m", ":", " ", "http", "://", "en", ".", "wikip", "edia", ".", "org", "/", "wiki", "/", "Function", "\\u", "composition", "\\u(", "computer", "\\u", "scie", "nce", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unnecessary pass
dimagi/commcare-hq/custom/_legacy/pact/api.py
[ { "content": "def get_all_providers(invalidate=False):\n \"\"\"\n wrapper function to get all the providers for PACT and cache them.\n ugly for now - the number of entries is small enough that loading all and scanning on checking is small enough overhead on a single page load.\n \"\"\"\n if invalidate:\n cache.delete(PACT_PROVIDERS_FIXTURE_CACHE_KEY)\n raw_cached_fixtures = cache.get(PACT_PROVIDERS_FIXTURE_CACHE_KEY, None)\n if raw_cached_fixtures is None:\n #requery and cache\n pact_hp_group = Group.by_name(PACT_DOMAIN, PACT_HP_GROUPNAME)\n providers = FixtureDataItem.by_group(pact_hp_group)\n cache.set(PACT_PROVIDERS_FIXTURE_CACHE_KEY, json.dumps([x.to_json() for x in providers]))\n return providers\n else:\n try:\n json_data = json.loads(raw_cached_fixtures)\n #not necessary in the grand scheme of things - we could really just use raw JSON\n return [FixtureDataItem.wrap(x) for x in json_data]\n except Exception, ex:\n logging.error(\"Error loading json from cache key %s: %s\" % (PACT_PROVIDERS_FIXTURE_CACHE_KEY, ex))\n return []\n\n# cache.set('%s_casedoc' % self._id, json.dumps(self._case), PACT_CACHE_TIMEOUT)\n# xml_ret = cache.get('%s_schedule_xml' % self._id, None)\n pass", "metadata": "root.get_all_providers", "header": "['module', '___EOS___']", "index": 244 } ]
[ { "span": "pass", "start_line": 269, "start_column": 8, "end_line": 269, "end_column": 12 } ]
[]
1
true
[ "[CLS]_", "Un", "necessar", "y_", "pass_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "all", "\\u", "providers_", "(_", "invalidate", "_", "=_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "wrapp", "er", " ", "function", " ", "to", " ", "get", " ", "all", " ", "the", " ", "provide", "rs", " ", "for", " ", "PAC", "T", " ", "and", " ", "cache", " ", "them", ".", "\\", "10", ";", " ", " ", " ", " ", "ug", "ly", " ", "for", " ", "now", " ", "-", " ", "the", " ", "number", " ", "of", " ", "entri", "es", " ", "is", " ", "small", " ", "eno", "ugh", " ", "tha", "t", " ", "load", "ing", " ", "all", " ", "and", " ", "scanning", " ", "on", " ", "checking", " ", "is", " ", "small", " ", "eno", "ugh", " ", "overhead", " ", "on", " ", "a", " ", "single", " ", "page", " ", "load", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "invalidate", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cache_", "._", "delete_", "(_", "PAC", "T", "\\u", "PROVIDER", "S", "\\u", "FIXTURE", "\\u", "CACHE", "\\u", "KEY_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "raw", "\\u", "cache", "d\\u", "fixtures_", "=_", "cache_", "._", "get_", "(_", "PAC", "T", "\\u", "PROVIDER", "S", "\\u", "FIXTURE", "\\u", "CACHE", "\\u", "KEY_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "raw", "\\u", "cache", "d\\u", "fixtures_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "reque", "ry", " ", "and", " ", "cache_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pac", "t", "\\u", "hp", "\\u", "group_", "=_", "Group_", "._", "by", "\\u", "name_", "(_", "PAC", "T", "\\u", "DOMAIN_", ",_", "PAC", "T", "\\u", "HP", "\\u", "GROU", "PN", "AME_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "providers_", "=_", "Fix", "ture", "Data", "Item_", "._", "by", "\\u", "group_", "(_", "pac", "t", "\\u", "hp", "\\u", "group_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cache_", "._", "set_", "(_", "PAC", "T", "\\u", "PROVIDER", "S", "\\u", "FIXTURE", "\\u", "CACHE", "\\u", "KEY_", ",_", "json_", "._", "dumps_", "(_", "[_", "x_", "._", "to", "\\u", "json_", "(_", ")_", "for_", "x_", "in_", "providers_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "providers_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "json", "\\u", "data_", "=_", "json_", "._", "loads_", "(_", "raw", "\\u", "cache", "d\\u", "fixtures_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "not", " ", "necessar", "y", " ", "in", " ", "the", " ", "grand", " ", "sche", "me", " ", "of", " ", "thing", "s", " ", "-", " ", "we", " ", "coul", "d", " ", "reall", "y", " ", "just", " ", "use", " ", "raw", " ", "JSON_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "[_", "Fix", "ture", "Data", "Item_", "._", "wrap_", "(_", "x_", ")_", "for_", "x_", "in_", "json", "\\u", "data_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", ",_", "ex_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logging_", "._", "error_", "(_", "\"", "Error", " ", "load", "ing", " ", "json", " ", "from", " ", "cache", " ", "key", " ", "%", "s", ":", " ", "%", "s", "\"_", "%_", "(_", "PAC", "T", "\\u", "PROVIDER", "S", "\\u", "FIXTURE", "\\u", "CACHE", "\\u", "KEY_", ",_", "ex_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "cache", ".", "set", "('", "%", "s", "\\u", "case", "doc", "'", " ", "%", " ", "self", ".\\u", "id", ",", " ", "json", ".", "dump", "s", "(", "self", ".\\u", "case", "),", " ", "PAC", "T", "\\u", "CACHE", "\\u", "TIME", "OUT", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "xml", "\\u", "ret", " ", "=", " ", "cache", ".", "get", "('", "%", "s", "\\u", "schedule", "\\u", "xml", "'", " ", "%", " ", "self", ".\\u", "id", ",", " ", "Non", "e", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 2 ]
Redundant assignment
bokeh/bokeh/bokeh/plotting/helpers.py
[ { "content": "def _process_axis_and_grid(plot, axis_type, axis_location, minor_ticks, axis_label, rng, dim):\n axiscls = _get_axis_class(axis_type, rng)\n if axiscls:\n\n if axiscls is LogAxis:\n # TODO (bev) this mapper type hinting is ugly\n if dim == 0:\n plot.x_mapper_type = 'log'\n elif dim == 1:\n plot.y_mapper_type = 'log'\n else:\n raise ValueError(\"received invalid dimension value: %r\" % dim)\n\n # this is so we can get a ticker off the axis, even if we discard it\n axis = axiscls(plot=plot if axis_location else None)\n\n if isinstance(axis.ticker, ContinuousTicker):\n axis.ticker.num_minor_ticks = _get_num_minor_ticks(axiscls, minor_ticks)\n\n axis_label = axis_label\n if axis_label:\n axis.axis_label = axis_label\n\n grid = Grid(plot=plot, dimension=dim, ticker=axis.ticker); grid\n\n if axis_location is not None:\n getattr(plot, axis_location).append(axis)", "metadata": "root._process_axis_and_grid", "header": "['module', '___EOS___']", "index": 250 } ]
[ { "span": "axis_label = axis_label", "start_line": 269, "start_column": 8, "end_line": 269, "end_column": 31 } ]
[]
1
true
[ "[CLS]_", "Redu", "ndan", "t_", "assignment_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "process", "\\u", "axis", "\\u", "and", "\\u", "grid_", "(_", "plot_", ",_", "axis", "\\u", "type_", ",_", "axis", "\\u", "location_", ",_", "mino", "r", "\\u", "ticks_", ",_", "axis", "\\u", "label_", ",_", "rng_", ",_", "dim_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "axis", "cls_", "=_", "\\u", "get", "\\u", "axis", "\\u", "class_", "(_", "axis", "\\u", "type_", ",_", "rng_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "axis", "cls_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "axis", "cls_", "is_", "Log", "Axis_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "TOD", "O", " ", "(", "bev", ")", " ", "this", " ", "mapper", " ", "type", " ", "hin", "ting", " ", "is", " ", "ug", "ly_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "dim_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "plot_", "._", "x", "\\u", "mapper", "\\u", "type_", "=_", "'", "log", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "dim_", "==_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "plot_", "._", "y", "\\u", "mapper", "\\u", "type_", "=_", "'", "log", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Value", "Error_", "(_", "\"", "receive", "d", " ", "invalid", " ", "dimension", " ", "value", ":", " ", "%", "r", "\"_", "%_", "dim_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "this", " ", "is", " ", "so", " ", "we", " ", "can", " ", "get", " ", "a", " ", "ticker", " ", "off", " ", "the", " ", "axis", ",", " ", "even", " ", "if", " ", "we", " ", "discard", " ", "it_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "axis_", "=_", "axis", "cls_", "(_", "plot_", "=_", "plot_", "if_", "axis", "\\u", "location_", "else_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "isinstance_", "(_", "axis_", "._", "ticker_", ",_", "Continu", "ous", "Ticke", "r_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "axis_", "._", "ticker_", "._", "num", "\\u", "mino", "r", "\\u", "ticks_", "=_", "\\u", "get", "\\u", "num", "\\u", "mino", "r", "\\u", "ticks_", "(_", "axis", "cls_", ",_", "mino", "r", "\\u", "ticks_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "axis", "\\u", "label_", "=_", "axis", "\\u", "label_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "axis", "\\u", "label_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "axis_", "._", "axis", "\\u", "label_", "=_", "axis", "\\u", "label_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "grid_", "=_", "Grid_", "(_", "plot_", "=_", "plot_", ",_", "dimension_", "=_", "dim_", ",_", "ticker_", "=_", "axis_", "._", "ticker_", ")_", ";_", "grid_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "axis", "\\u", "location_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "getattr_", "(_", "plot_", ",_", "axis", "\\u", "location_", ")_", "._", "append_", "(_", "axis_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
mrjoes/flask-admin/flask_admin/contrib/sqla/form.py
[ { "content": "from wtforms import fields, validators\nfrom sqlalchemy import Boolean, Column\n\nfrom flask.ext.admin import form\nfrom flask.ext.admin.model.form import (converts, ModelConverterBase,\n InlineModelConverterBase, FieldPlaceholder)\nfrom flask.ext.admin.model.fields import AjaxSelectField, AjaxSelectMultipleField\nfrom flask.ext.admin.model.helpers import prettify_name\nfrom flask.ext.admin._backwards import get_property\nfrom flask.ext.admin._compat import iteritems\n\nfrom .validators import Unique\nfrom .fields import QuerySelectField, QuerySelectMultipleField, InlineModelFormList\nfrom .tools import has_multiple_pks, filter_foreign_columns\nfrom .ajax import create_ajax_loader\n\ntry:\n # Field has better input parsing capabilities.\n from wtforms.ext.dateutil.fields import DateTimeField\nexcept ImportError:\n from wtforms.fields import DateTimeField\n\n\n\n\n\n\n# Get list of fields and generate form\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class AdminModelConverter(ModelConverterBase):\n \"\"\"\n SQLAlchemy model to form converter\n \"\"\"\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n", "metadata": "root.AdminModelConverter", "header": "['module', '___EOS___']", "index": 23 }, { "content": " def __init__(self, session, view):\n super(AdminModelConverter, self).__init__()\n\n self.session = session\n self.view = view", "metadata": "root.AdminModelConverter.__init__", "header": "['class', 'AdminModelConverter', '(', 'ModelConverterBase', ')', ':', '___EOS___']", "index": 27 }, { "content": " def _get_label(self, name, field_args):\n \"\"\"\n Label for field name. If it is not specified explicitly,\n then the views prettify_name method is used to find it.\n\n :param field_args:\n Dictionary with additional field arguments\n \"\"\"\n if 'label' in field_args:\n return field_args['label']\n\n column_labels = get_property(self.view, 'column_labels', 'rename_columns')\n\n if column_labels:\n return column_labels.get(name)\n\n prettify_override = getattr(self.view, 'prettify_name', None)\n if prettify_override:\n return prettify_override(name)\n\n return prettify_name(name)", "metadata": "root.AdminModelConverter._get_label", "header": "['class', 'AdminModelConverter', '(', 'ModelConverterBase', ')', ':', '___EOS___']", "index": 33 }, { "content": " def _get_description(self, name, field_args):\n if 'description' in field_args:\n return field_args['description']\n\n column_descriptions = getattr(self.view, 'column_descriptions', None)\n\n if column_descriptions:\n return column_descriptions.get(name)", "metadata": "root.AdminModelConverter._get_description", "header": "['class', 'AdminModelConverter', '(', 'ModelConverterBase', ')', ':', '___EOS___']", "index": 55 }, { "content": " def _get_field_override(self, name):\n form_overrides = getattr(self.view, 'form_overrides', None)\n\n if form_overrides:\n return form_overrides.get(name)\n\n return None", "metadata": "root.AdminModelConverter._get_field_override", "header": "['class', 'AdminModelConverter', '(', 'ModelConverterBase', ')', ':', '___EOS___']", "index": 64 }, { "content": " def _model_select_field(self, prop, multiple, remote_model, **kwargs):\n loader = getattr(self.view, '_form_ajax_refs', {}).get(prop.key)\n\n if loader:\n if multiple:\n return AjaxSelectMultipleField(loader, **kwargs)\n else:\n return AjaxSelectField(loader, **kwargs)\n\n if 'query_factory' not in kwargs:\n kwargs['query_factory'] = lambda: self.session.query(remote_model)\n\n if 'widget' not in kwargs:\n if multiple:\n kwargs['widget'] = form.Select2Widget(multiple=True)\n else:\n kwargs['widget'] = form.Select2Widget()\n\n if multiple:\n return QuerySelectMultipleField(**kwargs)\n else:\n return QuerySelectField(**kwargs)", "metadata": "root.AdminModelConverter._model_select_field", "header": "['class', 'AdminModelConverter', '(', 'ModelConverterBase', ')', ':', '___EOS___']", "index": 72 }, { "content": " def _convert_relation(self, prop, kwargs):\n # Check if relation is specified\n form_columns = getattr(self.view, 'form_columns', None)\n if form_columns and prop.key not in form_columns:\n return None\n\n remote_model = prop.mapper.class_\n column = prop.local_remote_pairs[0][0]\n\n # If this relation points to local column that's not foreign key, assume\n # that it is backref and use remote column data\n if not column.foreign_keys:\n column = prop.local_remote_pairs[0][1]\n\n kwargs['label'] = self._get_label(prop.key, kwargs)\n kwargs['description'] = self._get_description(prop.key, kwargs)\n\n # determine optional/required, or respect existing\n requirement_options = (validators.Optional, validators.InputRequired)\n if not any(isinstance(v, requirement_options) for v in kwargs['validators']):\n if column.nullable or prop.direction.name != 'MANYTOONE':\n kwargs['validators'].append(validators.Optional())\n else:\n kwargs['validators'].append(validators.InputRequired())\n\n # Contribute model-related parameters\n if 'allow_blank' not in kwargs:\n kwargs['allow_blank'] = column.nullable\n\n # Override field type if necessary\n override = self._get_field_override(prop.key)\n if override:\n return override(**kwargs)\n\n if prop.direction.name == 'MANYTOONE' or not prop.uselist:\n return self._model_select_field(prop, False, remote_model, **kwargs)\n elif prop.direction.name == 'ONETOMANY':\n return self._model_select_field(prop, True, remote_model, **kwargs)\n elif prop.direction.name == 'MANYTOMANY':\n return self._model_select_field(prop, True, remote_model, **kwargs)", "metadata": "root.AdminModelConverter._convert_relation", "header": "['class', 'AdminModelConverter', '(', 'ModelConverterBase', ')', ':', '___EOS___']", "index": 95 }, { "content": " def convert(self, model, mapper, prop, field_args, hidden_pk):\n # Properly handle forced fields\n if isinstance(prop, FieldPlaceholder):\n return form.recreate_field(prop.field)\n\n kwargs = {\n 'validators': [],\n 'filters': []\n }\n\n if field_args:\n kwargs.update(field_args)\n\n # Check if it is relation or property\n if hasattr(prop, 'direction'):\n return self._convert_relation(prop, kwargs)\n else:\n # Ignore pk/fk\n if hasattr(prop, 'columns'):\n # Check if more than one column mapped to the property\n if len(prop.columns) > 1:\n columns = filter_foreign_columns(model.__table__, prop.columns)\n\n if len(columns) > 1:\n raise TypeError('Can not convert multiple-column properties (%s.%s)' % (model, prop.key))\n\n column = columns[0]\n else:\n # Grab column\n column = prop.columns[0]\n\n form_columns = getattr(self.view, 'form_columns', None) or ()\n\n # Do not display foreign keys - use relations, except when explicitly instructed\n if column.foreign_keys and prop.key not in form_columns:\n return None\n\n # Only display \"real\" columns\n if not isinstance(column, Column):\n return None\n\n unique = False\n\n if column.primary_key:\n if hidden_pk:\n # If requested to add hidden field, show it\n return fields.HiddenField()\n else:\n # By default, don't show primary keys either\n # If PK is not explicitly allowed, ignore it\n if prop.key not in form_columns:\n return None\n\n # Current Unique Validator does not work with multicolumns-pks\n if not has_multiple_pks(model):\n kwargs['validators'].append(Unique(self.session,\n model,\n column))\n unique = True\n\n # If field is unique, validate it\n if column.unique and not unique:\n kwargs['validators'].append(Unique(self.session,\n model,\n column))\n\n optional_types = getattr(self.view, 'form_optional_types', (Boolean,))\n\n if not column.nullable and not isinstance(column.type, optional_types):\n kwargs['validators'].append(validators.InputRequired())\n\n # Apply label and description if it isn't inline form field\n if self.view.model == mapper.class_:\n kwargs['label'] = self._get_label(prop.key, kwargs)\n kwargs['description'] = self._get_description(prop.key, kwargs)\n\n # Figure out default value\n default = getattr(column, 'default', None)\n value = None\n\n if default is not None:\n value = getattr(default, 'arg', None)\n\n if value is not None:\n if getattr(default, 'is_callable', False):\n value = lambda: default.arg(None)\n else:\n if not getattr(default, 'is_scalar', True):\n value = None\n\n if value is not None:\n kwargs['default'] = value\n\n # Check nullable\n if column.nullable:\n kwargs['validators'].append(validators.Optional())\n\n # Override field type if necessary\n override = self._get_field_override(prop.key)\n if override:\n return override(**kwargs)\n\n # Check choices\n form_choices = getattr(self.view, 'form_choices', None)\n\n if mapper.class_ == self.view.model and form_choices:\n choices = form_choices.get(column.key)\n if choices:\n return form.Select2Field(\n choices=choices,\n allow_blank=column.nullable,\n **kwargs\n )\n\n # Run converter\n converter = self.get_converter(column)\n\n if converter is None:\n return None\n\n return converter(model=model, mapper=mapper, prop=prop,\n column=column, field_args=kwargs)\n\n return None", "metadata": "root.AdminModelConverter.convert", "header": "['class', 'AdminModelConverter', '(', 'ModelConverterBase', ')', ':', '___EOS___']", "index": 136 }, { "content": " @classmethod\n def _string_common(cls, column, field_args, **extra):\n if column.type.length:\n field_args['validators'].append(validators.Length(max=column.type.length))", "metadata": "root.AdminModelConverter._string_common", "header": "['class', 'AdminModelConverter', '(', 'ModelConverterBase', ')', ':', '___EOS___']", "index": 261 }, { "content": " @converts('String', 'Unicode')\n def conv_String(self, column, field_args, **extra):\n if hasattr(column.type, 'enums'):\n field_args['validators'].append(validators.AnyOf(column.type.enums))\n field_args['choices'] = [(f, f) for f in column.type.enums]\n return form.Select2Field(**field_args)\n\n if column.nullable:\n filters = field_args.get('filters', [])\n filters.append(lambda x: x or None)\n field_args['filters'] = filters\n\n self._string_common(column=column, field_args=field_args, **extra)\n return fields.StringField(**field_args)", "metadata": "root.AdminModelConverter.conv_String", "header": "['class', 'AdminModelConverter', '(', 'ModelConverterBase', ')', ':', '___EOS___']", "index": 266 }, { "content": " @converts('Text', 'UnicodeText',\n 'sqlalchemy.types.LargeBinary', 'sqlalchemy.types.Binary')\n def conv_Text(self, field_args, **extra):\n self._string_common(field_args=field_args, **extra)\n return fields.TextAreaField(**field_args)", "metadata": "root.AdminModelConverter.conv_Text", "header": "['class', 'AdminModelConverter', '(', 'ModelConverterBase', ')', ':', '___EOS___']", "index": 281 }, { "content": " @converts('Boolean')\n def conv_Boolean(self, field_args, **extra):\n return fields.BooleanField(**field_args)", "metadata": "root.AdminModelConverter.conv_Boolean", "header": "['class', 'AdminModelConverter', '(', 'ModelConverterBase', ')', ':', '___EOS___']", "index": 287 }, { "content": " @converts('Date')\n def convert_date(self, field_args, **extra):\n field_args['widget'] = form.DatePickerWidget()\n return fields.DateField(**field_args)", "metadata": "root.AdminModelConverter.convert_date", "header": "['class', 'AdminModelConverter', '(', 'ModelConverterBase', ')', ':', '___EOS___']", "index": 291 }, { "content": " @converts('DateTime')\n def convert_datetime(self, field_args, **extra):\n return form.DateTimeField(**field_args)", "metadata": "root.AdminModelConverter.convert_datetime", "header": "['class', 'AdminModelConverter', '(', 'ModelConverterBase', ')', ':', '___EOS___']", "index": 296 }, { "content": " @converts('Time')\n def convert_time(self, field_args, **extra):\n return form.TimeField(**field_args)", "metadata": "root.AdminModelConverter.convert_time", "header": "['class', 'AdminModelConverter', '(', 'ModelConverterBase', ')', ':', '___EOS___']", "index": 300 }, { "content": " @converts('Integer', 'SmallInteger')\n def handle_integer_types(self, column, field_args, **extra):\n unsigned = getattr(column.type, 'unsigned', False)\n if unsigned:\n field_args['validators'].append(validators.NumberRange(min=0))\n return fields.IntegerField(**field_args)", "metadata": "root.AdminModelConverter.handle_integer_types", "header": "['class', 'AdminModelConverter', '(', 'ModelConverterBase', ')', ':', '___EOS___']", "index": 304 }, { "content": " @converts('Numeric', 'Float')\n def handle_decimal_types(self, column, field_args, **extra):\n places = getattr(column.type, 'scale', 2)\n if places is not None:\n field_args['places'] = places\n return fields.DecimalField(**field_args)", "metadata": "root.AdminModelConverter.handle_decimal_types", "header": "['class', 'AdminModelConverter', '(', 'ModelConverterBase', ')', ':', '___EOS___']", "index": 311 }, { "content": " @converts('databases.mysql.MSYear')\n def conv_MSYear(self, field_args, **extra):\n field_args['validators'].append(validators.NumberRange(min=1901, max=2155))\n return fields.StringField(**field_args)", "metadata": "root.AdminModelConverter.conv_MSYear", "header": "['class', 'AdminModelConverter', '(', 'ModelConverterBase', ')', ':', '___EOS___']", "index": 318 }, { "content": " @converts('databases.postgres.PGInet', 'dialects.postgresql.base.INET')\n def conv_PGInet(self, field_args, **extra):\n field_args.setdefault('label', u'IP Address')\n field_args['validators'].append(validators.IPAddress())\n return fields.StringField(**field_args)", "metadata": "root.AdminModelConverter.conv_PGInet", "header": "['class', 'AdminModelConverter', '(', 'ModelConverterBase', ')', ':', '___EOS___']", "index": 323 }, { "content": " @converts('dialects.postgresql.base.MACADDR')\n def conv_PGMacaddr(self, field_args, **extra):\n field_args.setdefault('label', u'MAC Address')\n field_args['validators'].append(validators.MacAddress())\n return fields.StringField(**field_args)", "metadata": "root.AdminModelConverter.conv_PGMacaddr", "header": "['class', 'AdminModelConverter', '(', 'ModelConverterBase', ')', ':', '___EOS___']", "index": 329 }, { "content": " @converts('dialects.postgresql.base.UUID')\n def conv_PGUuid(self, field_args, **extra):\n field_args.setdefault('label', u'UUID')\n field_args['validators'].append(validators.UUID())\n return fields.StringField(**field_args)", "metadata": "root.AdminModelConverter.conv_PGUuid", "header": "['class', 'AdminModelConverter', '(', 'ModelConverterBase', ')', ':', '___EOS___']", "index": 335 }, { "content": " @converts('sqlalchemy.dialects.postgresql.base.ARRAY')\n def conv_ARRAY(self, field_args, **extra):\n return form.Select2TagsField(save_as_list=True, **field_args)", "metadata": "root.AdminModelConverter.conv_ARRAY", "header": "['class', 'AdminModelConverter', '(', 'ModelConverterBase', ')', ':', '___EOS___']", "index": 341 }, { "content": "def _resolve_prop(prop):\n \"\"\"\n Resolve proxied property\n\n :param prop:\n Property to resolve\n \"\"\"\n # Try to see if it is proxied property\n if hasattr(prop, '_proxied_property'):\n return prop._proxied_property\n\n return prop", "metadata": "root._resolve_prop", "header": "['module', '___EOS___']", "index": 346 }, { "content": "def get_form(model, converter,\n base_class=form.BaseForm,\n only=None,\n exclude=None,\n field_args=None,\n hidden_pk=False,\n ignore_hidden=True,\n extra_fields=None):\n \"\"\"\n Generate form from the model.\n\n :param model:\n Model to generate form from\n :param converter:\n Converter class to use\n :param base_class:\n Base form class\n :param only:\n Include fields\n :param exclude:\n Exclude fields\n :param field_args:\n Dictionary with additional field arguments\n :param hidden_pk:\n Generate hidden field with model primary key or not\n :param ignore_hidden:\n If set to True (default), will ignore properties that start with underscore\n \"\"\"\n\n # TODO: Support new 0.8 API\n if not hasattr(model, '_sa_class_manager'):\n raise TypeError('model must be a sqlalchemy mapped model')\n\n mapper = model._sa_class_manager.mapper\n field_args = field_args or {}\n\n properties = ((p.key, p) for p in mapper.iterate_properties)\n\n if only:\n props = dict(properties)\n\n def find(name):\n # If field is in extra_fields, it has higher priority\n if extra_fields and name in extra_fields:\n return FieldPlaceholder(extra_fields[name])\n\n # Try to look it up in properties list first\n p = props.get(name)\n\n if p is not None:\n return p\n\n # If it is hybrid property or alias, look it up in a model itself\n p = getattr(model, name, None)\n if p is not None and hasattr(p, 'property'):\n return p.property\n\n raise ValueError('Invalid model property name %s.%s' % (model, name))\n\n # Filter properties while maintaining property order in 'only' list\n properties = ((x, find(x)) for x in only)\n elif exclude:\n properties = (x for x in properties if x[0] not in exclude)\n\n field_dict = {}\n for name, p in properties:\n # Ignore protected properties\n if ignore_hidden and name.startswith('_'):\n continue\n\n prop = _resolve_prop(p)\n\n field = converter.convert(model, mapper, prop, field_args.get(name), hidden_pk)\n if field is not None:\n field_dict[name] = field\n\n # Contribute extra fields\n if not only and extra_fields:\n for name, field in iteritems(extra_fields):\n field_dict[name] = form.recreate_field(field)\n\n return type(model.__name__ + 'Form', (base_class, ), field_dict)", "metadata": "root.get_form", "header": "['module', '___EOS___']", "index": 361 }, { "content": "class InlineModelConverter(InlineModelConverterBase):\n \"\"\"\n Inline model form helper.\n \"\"\"\n\n inline_field_list_type = InlineModelFormList\n \"\"\"\n Used field list type.\n\n If you want to do some custom rendering of inline field lists,\n you can create your own wtforms field and use it instead\n \"\"\"\n\n\n\n", "metadata": "root.InlineModelConverter", "header": "['module', '___EOS___']", "index": 445 }, { "content": " def __init__(self, session, view, model_converter):\n \"\"\"\n Constructor.\n\n :param session:\n SQLAlchemy session\n :param view:\n Flask-Admin view object\n :param model_converter:\n Model converter class. Will be automatically instantiated with\n appropriate `InlineFormAdmin` instance.\n \"\"\"\n super(InlineModelConverter, self).__init__(view)\n self.session = session\n self.model_converter = model_converter", "metadata": "root.InlineModelConverter.__init__", "header": "['class', 'InlineModelConverter', '(', 'InlineModelConverterBase', ')', ':', '___EOS___']", "index": 458 }, { "content": " def get_info(self, p):\n info = super(InlineModelConverter, self).get_info(p)\n\n # Special case for model instances\n if info is None:\n if hasattr(p, '_sa_class_manager'):\n return self.form_admin_class(p)\n else:\n model = getattr(p, 'model', None)\n\n if model is None:\n raise Exception('Unknown inline model admin: %s' % repr(p))\n\n attrs = dict()\n for attr in dir(p):\n if not attr.startswith('_') and attr != 'model':\n attrs[attr] = getattr(p, attr)\n\n return self.form_admin_class(model, **attrs)\n\n info = self.form_admin_class(model, **attrs)\n\n # Resolve AJAX FKs\n info._form_ajax_refs = self.process_ajax_refs(info)\n\n return info", "metadata": "root.InlineModelConverter.get_info", "header": "['class', 'InlineModelConverter', '(', 'InlineModelConverterBase', ')', ':', '___EOS___']", "index": 474 }, { "content": " def process_ajax_refs(self, info):\n refs = getattr(info, 'form_ajax_refs', None)\n\n result = {}\n\n if refs:\n for name, opts in iteritems(refs):\n new_name = '%s-%s' % (info.model.__name__.lower(), name)\n\n loader = None\n if isinstance(opts, dict):\n loader = create_ajax_loader(info.model, self.session, new_name, name, opts)\n else:\n loader = opts\n\n result[name] = loader\n self.view._form_ajax_refs[new_name] = loader\n\n return result", "metadata": "root.InlineModelConverter.process_ajax_refs", "header": "['class', 'InlineModelConverter', '(', 'InlineModelConverterBase', ')', ':', '___EOS___']", "index": 501 }, { "content": " def contribute(self, model, form_class, inline_model):\n \"\"\"\n Generate form fields for inline forms and contribute them to\n the `form_class`\n\n :param converter:\n ModelConverterBase instance\n :param session:\n SQLAlchemy session\n :param model:\n Model class\n :param form_class:\n Form to add properties to\n :param inline_model:\n Inline model. Can be one of:\n\n - ``tuple``, first value is related model instance,\n second is dictionary with options\n - ``InlineFormAdmin`` instance\n - Model class\n\n :return:\n Form class\n \"\"\"\n\n mapper = model._sa_class_manager.mapper\n info = self.get_info(inline_model)\n\n # Find property from target model to current model\n target_mapper = info.model._sa_class_manager.mapper\n\n reverse_prop = None\n\n for prop in target_mapper.iterate_properties:\n if hasattr(prop, 'direction') and prop.direction.name in ('MANYTOONE', 'MANYTOMANY'):\n if issubclass(model, prop.mapper.class_):\n reverse_prop = prop\n break\n else:\n raise Exception('Cannot find reverse relation for model %s' % info.model)\n\n # Find forward property\n forward_prop = None\n\n if prop.direction.name == 'MANYTOONE':\n candidate = 'ONETOMANY'\n else:\n candidate = 'MANYTOMANY'\n\n for prop in mapper.iterate_properties:\n if hasattr(prop, 'direction') and prop.direction.name == candidate:\n if prop.mapper.class_ == target_mapper.class_:\n forward_prop = prop\n break\n else:\n raise Exception('Cannot find forward relation for model %s' % info.model)\n\n # Remove reverse property from the list\n ignore = [reverse_prop.key]\n\n if info.form_excluded_columns:\n exclude = ignore + list(info.form_excluded_columns)\n else:\n exclude = ignore\n\n # Create converter\n converter = self.model_converter(self.session, info)\n\n # Create form\n child_form = info.get_form()\n\n if child_form is None:\n child_form = get_form(info.model,\n converter,\n only=info.form_columns,\n exclude=exclude,\n field_args=info.form_args,\n hidden_pk=True)\n\n # Post-process form\n child_form = info.postprocess_form(child_form)\n\n kwargs = dict()\n\n label = self.get_label(info, forward_prop.key)\n if label:\n kwargs['label'] = label\n\n if self.view.form_args:\n field_args = self.view.form_args.get(forward_prop.key, {})\n kwargs.update(**field_args)\n\n # Contribute field\n setattr(form_class,\n forward_prop.key,\n self.inline_field_list_type(child_form,\n self.session,\n info.model,\n reverse_prop.key,\n info,\n **kwargs))\n\n return form_class", "metadata": "root.InlineModelConverter.contribute", "header": "['class', 'InlineModelConverter', '(', 'InlineModelConverterBase', ')', ':', '___EOS___']", "index": 521 } ]
[ { "span": "from wtforms.ext.dateutil.fields import DateTimeField", "start_line": 18, "start_column": 4, "end_line": 18, "end_column": 57 }, { "span": "from wtforms.fields import DateTimeField", "start_line": 20, "start_column": 4, "end_line": 20, "end_column": 44 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "from_", "wtforms_", "import_", "fields_", ",_", "validators_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "sqlalchemy_", "import_", "Boolean_", ",_", "Column_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "flask_", "._", "ext_", "._", "admin_", "import_", "form_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "flask_", "._", "ext_", "._", "admin_", "._", "model_", "._", "form_", "import_", "(_", "convert", "s_", ",_", "Model", "Converte", "r", "Base_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "In", "line", "Model", "Converte", "r", "Base_", ",_", "Field", "Place", "holder_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "flask_", "._", "ext_", "._", "admin_", "._", "model_", "._", "fields_", "import_", "Ajax", "Select", "Field_", ",_", "Ajax", "Select", "Multipl", "e", "Field_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "flask_", "._", "ext_", "._", "admin_", "._", "model_", "._", "helpers_", "import_", "pret", "tify", "\\u", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "flask_", "._", "ext_", "._", "admin_", "._", "\\u", "backwards_", "import_", "get", "\\u", "property_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "flask_", "._", "ext_", "._", "admin_", "._", "\\u", "compat_", "import_", "iteritems_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "._", "validators_", "import_", "Unique", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "._", "fields_", "import_", "Query", "Select", "Field_", ",_", "Query", "Select", "Multipl", "e", "Field_", ",_", "In", "line", "Model", "Form", "List_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "._", "tools_", "import_", "has", "\\u", "multiple", "\\u", "pks", "_", ",_", "filter", "\\u", "foreign", "\\u", "columns_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "._", "ajax_", "import_", "create", "\\u", "aja", "x", "\\u", "loader_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Field", " ", "has", " ", "bett", "er", " ", "input", " ", "pars", "ing", " ", "capab", "ilities", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "wtforms_", "._", "ext_", "._", "dateutil_", "._", "fields_", "import_", "Date", "Time", "Field_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Import", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "wtforms_", "._", "fields_", "import_", "Date", "Time", "Field_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Get", " ", "list", " ", "of", " ", "fields", " ", "and", " ", "generat", "e", " ", "form_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Admi", "n", "Model", "Converter_", "(_", "Model", "Converte", "r", "Base_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "SQL", "Al", "chem", "y", " ", "model", " ", "to", " ", "form", " ", "converter", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Admi", "n", "Model", "Converter_", "(_", "Model", "Converte", "r", "Base_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "session_", ",_", "view_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "super_", "(_", "Admi", "n", "Model", "Converter_", ",_", "self_", ")_", "._", "\\u\\u", "init\\u\\u_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "session_", "=_", "session_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "view_", "=_", "view_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Admi", "n", "Model", "Converter_", "(_", "Model", "Converte", "r", "Base_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "get", "\\u", "label_", "(_", "self_", ",_", "name_", ",_", "field", "\\u", "args_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Label", " ", "for", " ", "field", " ", "name", ".", " ", "If", " ", "it", " ", "is", " ", "not", " ", "specified", " ", "explicit", "ly", ",", "\\", "10", ";", " ", " ", " ", " ", "then", " ", "the", " ", "views", " ", "pret", "tify", "\\u", "name", " ", "method", " ", "is", " ", "used", " ", "to", " ", "find", " ", "it", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "field", "\\u", "args", ":", "\\", "10", ";", " ", " ", " ", " ", "Dict", "ionar", "y", " ", "with", " ", "addition", "al", " ", "field", " ", "argu", "ment", "s", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "'", "label", "'_", "in_", "field", "\\u", "args_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "field", "\\u", "args_", "[_", "'", "label", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "column", "\\u", "labels_", "=_", "get", "\\u", "property_", "(_", "self_", "._", "view_", ",_", "'", "column", "\\u", "labels", "'_", ",_", "'", "rename", "\\u", "column", "s", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "column", "\\u", "labels_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "column", "\\u", "labels_", "._", "get_", "(_", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "pret", "tify", "\\u", "override_", "=_", "getattr_", "(_", "self_", "._", "view_", ",_", "'", "pret", "tify", "\\u", "name", "'_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "pret", "tify", "\\u", "override_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "pret", "tify", "\\u", "override_", "(_", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "pret", "tify", "\\u", "name_", "(_", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Admi", "n", "Model", "Converter_", "(_", "Model", "Converte", "r", "Base_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "get", "\\u", "description_", "(_", "self_", ",_", "name_", ",_", "field", "\\u", "args_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "'", "description", "'_", "in_", "field", "\\u", "args_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "field", "\\u", "args_", "[_", "'", "description", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "column", "\\u", "descriptions_", "=_", "getattr_", "(_", "self_", "._", "view_", ",_", "'", "column", "\\u", "description", "s", "'_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "column", "\\u", "descriptions_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "column", "\\u", "descriptions_", "._", "get_", "(_", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Admi", "n", "Model", "Converter_", "(_", "Model", "Converte", "r", "Base_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "get", "\\u", "field", "\\u", "override_", "(_", "self_", ",_", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "form", "\\u", "overrides_", "=_", "getattr_", "(_", "self_", "._", "view_", ",_", "'", "form", "\\u", "override", "s", "'_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "form", "\\u", "overrides_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "form", "\\u", "overrides_", "._", "get_", "(_", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Admi", "n", "Model", "Converter_", "(_", "Model", "Converte", "r", "Base_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "model", "\\u", "select", "\\u", "field_", "(_", "self_", ",_", "prop_", ",_", "multiple_", ",_", "remote", "\\u", "model_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "loader_", "=_", "getattr_", "(_", "self_", "._", "view_", ",_", "'\\u", "form", "\\u", "aja", "x", "\\u", "refs", "'_", ",_", "{_", "}_", ")_", "._", "get_", "(_", "prop_", "._", "key_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "loader_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "multiple_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "Ajax", "Select", "Multipl", "e", "Field_", "(_", "loader_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "Ajax", "Select", "Field_", "(_", "loader_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "'", "query", "\\u", "factor", "y", "'_", "not_", "in_", "kwargs_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "kwargs_", "[_", "'", "query", "\\u", "factor", "y", "'_", "]_", "=_", "lambda_", ":_", "self_", "._", "session_", "._", "query_", "(_", "remote", "\\u", "model_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "'", "widget", "'_", "not_", "in_", "kwargs_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "multiple_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "kwargs_", "[_", "'", "widget", "'_", "]_", "=_", "form_", "._", "Select", "2", "Widget_", "(_", "multiple_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "kwargs_", "[_", "'", "widget", "'_", "]_", "=_", "form_", "._", "Select", "2", "Widget_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "multiple_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "Query", "Select", "Multipl", "e", "Field_", "(_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "Query", "Select", "Field_", "(_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Admi", "n", "Model", "Converter_", "(_", "Model", "Converte", "r", "Base_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "convert", "\\u", "relation_", "(_", "self_", ",_", "prop_", ",_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Check", " ", "if", " ", "relation", " ", "is", " ", "specified", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "form", "\\u", "columns_", "=_", "getattr_", "(_", "self_", "._", "view_", ",_", "'", "form", "\\u", "column", "s", "'_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "form", "\\u", "columns_", "and_", "prop_", "._", "key_", "not_", "in_", "form", "\\u", "columns_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "remote", "\\u", "model_", "=_", "prop_", "._", "mapper_", "._", "class\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "column_", "=_", "prop_", "._", "local", "\\u", "remote", "\\u", "pairs_", "[_", "0_", "]_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "this", " ", "relation", " ", "points", " ", "to", " ", "local", " ", "column", " ", "tha", "t", "'", "s", " ", "not", " ", "foreign", " ", "key", ",", " ", "assume", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "tha", "t", " ", "it", " ", "is", " ", "back", "ref", " ", "and", " ", "use", " ", "remote", " ", "column", " ", "data_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "column_", "._", "foreign", "\\u", "keys_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "column_", "=_", "prop_", "._", "local", "\\u", "remote", "\\u", "pairs_", "[_", "0_", "]_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "kwargs_", "[_", "'", "label", "'_", "]_", "=_", "self_", "._", "\\u", "get", "\\u", "label_", "(_", "prop_", "._", "key_", ",_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "kwargs_", "[_", "'", "description", "'_", "]_", "=_", "self_", "._", "\\u", "get", "\\u", "description_", "(_", "prop_", "._", "key_", ",_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "dete", "rmin", "e", " ", "option", "al", "/", "require", "d", ",", " ", "or", " ", "respec", "t", " ", "existing_", "\\u\\u\\uNL\\u\\u\\u_", "require", "ment", "\\u", "options_", "=_", "(_", "validators_", "._", "Optional_", ",_", "validators_", "._", "Inp", "ut", "Required_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "any_", "(_", "isinstance_", "(_", "v_", ",_", "require", "ment", "\\u", "options_", ")_", "for_", "v_", "in_", "kwargs_", "[_", "'", "validator", "s", "'_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "column_", "._", "nullable_", "or_", "prop_", "._", "direction_", "._", "name_", "!=_", "'", "MAN", "YT", "OO", "NE", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "kwargs_", "[_", "'", "validator", "s", "'_", "]_", "._", "append_", "(_", "validators_", "._", "Optional_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "kwargs_", "[_", "'", "validator", "s", "'_", "]_", "._", "append_", "(_", "validators_", "._", "Inp", "ut", "Required_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Contrib", "ute", " ", "model", "-", "relate", "d", " ", "parameters_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "'", "allow", "\\u", "blank", "'_", "not_", "in_", "kwargs_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "kwargs_", "[_", "'", "allow", "\\u", "blank", "'_", "]_", "=_", "column_", "._", "nullable_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Override", " ", "field", " ", "type", " ", "if", " ", "necessar", "y_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "override_", "=_", "self_", "._", "\\u", "get", "\\u", "field", "\\u", "override_", "(_", "prop_", "._", "key_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "override_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "override_", "(_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "prop_", "._", "direction_", "._", "name_", "==_", "'", "MAN", "YT", "OO", "NE", "'_", "or_", "not_", "prop_", "._", "usel", "ist_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "\\u", "model", "\\u", "select", "\\u", "field_", "(_", "prop_", ",_", "False_", ",_", "remote", "\\u", "model_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "prop_", "._", "direction_", "._", "name_", "==_", "'", "ONE", "TOM", "ANY", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "\\u", "model", "\\u", "select", "\\u", "field_", "(_", "prop_", ",_", "True_", ",_", "remote", "\\u", "model_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "prop_", "._", "direction_", "._", "name_", "==_", "'", "MAN", "YT", "OM", "ANY", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "\\u", "model", "\\u", "select", "\\u", "field_", "(_", "prop_", ",_", "True_", ",_", "remote", "\\u", "model_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Admi", "n", "Model", "Converter_", "(_", "Model", "Converte", "r", "Base_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "convert_", "(_", "self_", ",_", "model_", ",_", "mapper_", ",_", "prop_", ",_", "field", "\\u", "args_", ",_", "hidden", "\\u", "pk_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Proper", "ly", " ", "handle", " ", "forced", " ", "fields_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "isinstance_", "(_", "prop_", ",_", "Field", "Place", "holder_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "form_", "._", "recreate", "\\u", "field_", "(_", "prop_", "._", "field_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "kwargs_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "validator", "s", "'_", ":_", "[_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "filter", "s", "'_", ":_", "[_", "]_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "field", "\\u", "args_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "kwargs_", "._", "update_", "(_", "field", "\\u", "args_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Check", " ", "if", " ", "it", " ", "is", " ", "relation", " ", "or", " ", "property_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "hasattr_", "(_", "prop_", ",_", "'", "direction", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "\\u", "convert", "\\u", "relation_", "(_", "prop_", ",_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Ignor", "e", " ", "pk", "/", "fk_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "hasattr_", "(_", "prop_", ",_", "'", "column", "s", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Check", " ", "if", " ", "more", " ", "than", " ", "one", " ", "column", " ", "mapp", "ed", " ", "to", " ", "the", " ", "property_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "len_", "(_", "prop_", "._", "columns_", ")_", ">_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "columns_", "=_", "filter", "\\u", "foreign", "\\u", "columns_", "(_", "model_", "._", "\\u\\u", "table\\u\\u_", ",_", "prop_", "._", "columns_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "len_", "(_", "columns_", ")_", ">_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "raise_", "Type", "Error_", "(_", "'", "Can", " ", "not", " ", "convert", " ", "multiple", "-", "column", " ", "proper", "ties", " ", "(%", "s", ".", "%", "s", ")'_", "%_", "(_", "model_", ",_", "prop_", "._", "key_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "column_", "=_", "columns_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Grab", " ", "column_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "column_", "=_", "prop_", "._", "columns_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "form", "\\u", "columns_", "=_", "getattr_", "(_", "self_", "._", "view_", ",_", "'", "form", "\\u", "column", "s", "'_", ",_", "None_", ")_", "or_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Do", " ", "not", " ", "display", " ", "foreign", " ", "keys", " ", "-", " ", "use", " ", "relation", "s", ",", " ", "except", " ", "whe", "n", " ", "explicit", "ly", " ", "instruct", "ed_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "column_", "._", "foreign", "\\u", "keys_", "and_", "prop_", "._", "key_", "not_", "in_", "form", "\\u", "columns_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "return_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "On", "ly", " ", "display", " ", "\"", "real", "\"", " ", "columns_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "isinstance_", "(_", "column_", ",_", "Column_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "return_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "unique_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "column_", "._", "primary", "\\u", "key_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "hidden", "\\u", "pk_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "If", " ", "request", "ed", " ", "to", " ", "add", " ", "hidden", " ", "field", ",", " ", "show", " ", "it_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "return_", "fields_", "._", "Hi", "dde", "n", "Field_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "By", " ", "default", ",", " ", "don", "'", "t", " ", "show", " ", "primary", " ", "keys", " ", "eit", "her_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "PK", " ", "is", " ", "not", " ", "explicit", "ly", " ", "allow", "ed", ",", " ", "ignore", " ", "it_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "if_", "prop_", "._", "key_", "not_", "in_", "form", "\\u", "columns_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "return_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Curr", "ent", " ", "Unique", " ", "Validat", "or", " ", "doe", "s", " ", "not", " ", "work", " ", "with", " ", "multico", "lum", "ns", "-", "pks", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "has", "\\u", "multiple", "\\u", "pks", "_", "(_", "model_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "kwargs_", "[_", "'", "validator", "s", "'_", "]_", "._", "append_", "(_", "Unique", "_", "(_", "self_", "._", "session_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "model_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "column_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "unique_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "field", " ", "is", " ", "unique", ",", " ", "validat", "e", " ", "it_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "column_", "._", "unique_", "and_", "not_", "unique_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "kwargs_", "[_", "'", "validator", "s", "'_", "]_", "._", "append_", "(_", "Unique", "_", "(_", "self_", "._", "session_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "model_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "column_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "option", "al", "\\u", "types_", "=_", "getattr_", "(_", "self_", "._", "view_", ",_", "'", "form", "\\u", "option", "al", "\\u", "types", "'_", ",_", "(_", "Boolean_", ",_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "column_", "._", "nullable_", "and_", "not_", "isinstance_", "(_", "column_", "._", "type_", ",_", "option", "al", "\\u", "types_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "kwargs_", "[_", "'", "validator", "s", "'_", "]_", "._", "append_", "(_", "validators_", "._", "Inp", "ut", "Required_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Apply", " ", "label", " ", "and", " ", "description", " ", "if", " ", "it", " ", "isn", "'", "t", " ", "inline", " ", "form", " ", "field_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "view_", "._", "model_", "==_", "mapper_", "._", "class\\u_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "kwargs_", "[_", "'", "label", "'_", "]_", "=_", "self_", "._", "\\u", "get", "\\u", "label_", "(_", "prop_", "._", "key_", ",_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "kwargs_", "[_", "'", "description", "'_", "]_", "=_", "self_", "._", "\\u", "get", "\\u", "description_", "(_", "prop_", "._", "key_", ",_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Fig", "ure", " ", "out", " ", "default", " ", "value_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "default_", "=_", "getattr_", "(_", "column_", ",_", "'", "default", "'_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "value_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "default_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "value_", "=_", "getattr_", "(_", "default_", ",_", "'", "arg", "'_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "value_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "if_", "getattr_", "(_", "default_", ",_", "'", "is", "\\u", "calla", "ble", "'_", ",_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "value_", "=_", "lambda_", ":_", "default_", "._", "arg_", "(_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "if_", "not_", "getattr_", "(_", "default_", ",_", "'", "is", "\\u", "scala", "r", "'_", ",_", "True_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "value_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "value_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "kwargs_", "[_", "'", "default", "'_", "]_", "=_", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Check", " ", "nullable_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "column_", "._", "nullable_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "kwargs_", "[_", "'", "validator", "s", "'_", "]_", "._", "append_", "(_", "validators_", "._", "Optional_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Override", " ", "field", " ", "type", " ", "if", " ", "necessar", "y_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "override_", "=_", "self_", "._", "\\u", "get", "\\u", "field", "\\u", "override_", "(_", "prop_", "._", "key_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "override_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "return_", "override_", "(_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Check", " ", "choices_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "form", "\\u", "choices_", "=_", "getattr_", "(_", "self_", "._", "view_", ",_", "'", "form", "\\u", "choice", "s", "'_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "mapper_", "._", "class\\u_", "==_", "self_", "._", "view_", "._", "model_", "and_", "form", "\\u", "choices_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "choices_", "=_", "form", "\\u", "choices_", "._", "get_", "(_", "column_", "._", "key_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "choices_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "return_", "form_", "._", "Select", "2", "Field_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "choices_", "=_", "choices_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "allow", "\\u", "blank_", "=_", "column_", "._", "nullable_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "**_", "kwargs_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Run", " ", "converter_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "converter_", "=_", "self_", "._", "get", "\\u", "converter_", "(_", "column_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "converter_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "return_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "converter_", "(_", "model_", "=_", "model_", ",_", "mapper_", "=_", "mapper_", ",_", "prop_", "=_", "prop_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "column_", "=_", "column_", ",_", "field", "\\u", "args_", "=_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Admi", "n", "Model", "Converter_", "(_", "Model", "Converte", "r", "Base_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "classmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u", "string", "\\u", "common_", "(_", "cls_", ",_", "column_", ",_", "field", "\\u", "args_", ",_", "**_", "extra_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "column_", "._", "type_", "._", "length_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "field", "\\u", "args_", "[_", "'", "validator", "s", "'_", "]_", "._", "append_", "(_", "validators_", "._", "Length_", "(_", "max_", "=_", "column_", "._", "type_", "._", "length_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Admi", "n", "Model", "Converter_", "(_", "Model", "Converte", "r", "Base_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "convert", "s_", "(_", "'", "String", "'_", ",_", "'", "Unic", "ode", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "conv", "\\u", "String_", "(_", "self_", ",_", "column_", ",_", "field", "\\u", "args_", ",_", "**_", "extra_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "hasattr_", "(_", "column_", "._", "type_", ",_", "'", "enum", "s", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "field", "\\u", "args_", "[_", "'", "validator", "s", "'_", "]_", "._", "append_", "(_", "validators_", "._", "Any", "Of_", "(_", "column_", "._", "type_", "._", "enums_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "field", "\\u", "args_", "[_", "'", "choice", "s", "'_", "]_", "=_", "[_", "(_", "f_", ",_", "f_", ")_", "for_", "f_", "in_", "column_", "._", "type_", "._", "enums_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "form_", "._", "Select", "2", "Field_", "(_", "**_", "field", "\\u", "args_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "column_", "._", "nullable_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "filters_", "=_", "field", "\\u", "args_", "._", "get_", "(_", "'", "filter", "s", "'_", ",_", "[_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "filters_", "._", "append_", "(_", "lambda_", "x_", ":_", "x_", "or_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "field", "\\u", "args_", "[_", "'", "filter", "s", "'_", "]_", "=_", "filters_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "string", "\\u", "common_", "(_", "column_", "=_", "column_", ",_", "field", "\\u", "args_", "=_", "field", "\\u", "args_", ",_", "**_", "extra_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "fields_", "._", "String", "Field_", "(_", "**_", "field", "\\u", "args_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Admi", "n", "Model", "Converter_", "(_", "Model", "Converte", "r", "Base_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "convert", "s_", "(_", "'", "Text", "'_", ",_", "'", "Unic", "ode", "Text", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "sqla", "lche", "my", ".", "types", ".", "Large", "Bin", "ary", "'_", ",_", "'", "sqla", "lche", "my", ".", "types", ".", "Bin", "ary", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "conv", "\\u", "Text_", "(_", "self_", ",_", "field", "\\u", "args_", ",_", "**_", "extra_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "string", "\\u", "common_", "(_", "field", "\\u", "args_", "=_", "field", "\\u", "args_", ",_", "**_", "extra_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "fields_", "._", "Text", "Area", "Field_", "(_", "**_", "field", "\\u", "args_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Admi", "n", "Model", "Converter_", "(_", "Model", "Converte", "r", "Base_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "convert", "s_", "(_", "'", "Boo", "lean", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "conv", "\\u", "Boolean_", "(_", "self_", ",_", "field", "\\u", "args_", ",_", "**_", "extra_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "fields_", "._", "Boo", "lean", "Field_", "(_", "**_", "field", "\\u", "args_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Admi", "n", "Model", "Converter_", "(_", "Model", "Converte", "r", "Base_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "convert", "s_", "(_", "'", "Date", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "convert", "\\u", "date_", "(_", "self_", ",_", "field", "\\u", "args_", ",_", "**_", "extra_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "field", "\\u", "args_", "[_", "'", "widget", "'_", "]_", "=_", "form_", "._", "Date", "Picke", "r", "Widget_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "fields_", "._", "Date", "Field_", "(_", "**_", "field", "\\u", "args_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Admi", "n", "Model", "Converter_", "(_", "Model", "Converte", "r", "Base_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "convert", "s_", "(_", "'", "Date", "Time", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "convert", "\\u", "datetime_", "(_", "self_", ",_", "field", "\\u", "args_", ",_", "**_", "extra_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "form_", "._", "Date", "Time", "Field_", "(_", "**_", "field", "\\u", "args_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Admi", "n", "Model", "Converter_", "(_", "Model", "Converte", "r", "Base_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "convert", "s_", "(_", "'", "Time", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "convert", "\\u", "time_", "(_", "self_", ",_", "field", "\\u", "args_", ",_", "**_", "extra_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "form_", "._", "Time", "Field_", "(_", "**_", "field", "\\u", "args_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Admi", "n", "Model", "Converter_", "(_", "Model", "Converte", "r", "Base_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "convert", "s_", "(_", "'", "Integer", "'_", ",_", "'", "Small", "Integer", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "handle", "\\u", "integ", "er", "\\u", "types_", "(_", "self_", ",_", "column_", ",_", "field", "\\u", "args_", ",_", "**_", "extra_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "unsigned", "_", "=_", "getattr_", "(_", "column_", "._", "type_", ",_", "'", "unsigned", "'_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "unsigned", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "field", "\\u", "args_", "[_", "'", "validator", "s", "'_", "]_", "._", "append_", "(_", "validators_", "._", "Number", "Range_", "(_", "min_", "=_", "0_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "fields_", "._", "Integer", "Field_", "(_", "**_", "field", "\\u", "args_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Admi", "n", "Model", "Converter_", "(_", "Model", "Converte", "r", "Base_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "convert", "s_", "(_", "'", "Numer", "ic", "'_", ",_", "'", "Float", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "handle", "\\u", "decima", "l\\u", "types_", "(_", "self_", ",_", "column_", ",_", "field", "\\u", "args_", ",_", "**_", "extra_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "places_", "=_", "getattr_", "(_", "column_", "._", "type_", ",_", "'", "scale", "'_", ",_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "places_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "field", "\\u", "args_", "[_", "'", "place", "s", "'_", "]_", "=_", "places_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "fields_", "._", "Deci", "mal", "Field_", "(_", "**_", "field", "\\u", "args_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Admi", "n", "Model", "Converter_", "(_", "Model", "Converte", "r", "Base_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "convert", "s_", "(_", "'", "databa", "ses", ".", "mysql", ".", "MS", "Year", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "conv", "\\u", "MS", "Year_", "(_", "self_", ",_", "field", "\\u", "args_", ",_", "**_", "extra_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "field", "\\u", "args_", "[_", "'", "validator", "s", "'_", "]_", "._", "append_", "(_", "validators_", "._", "Number", "Range_", "(_", "min_", "=_", "190", "1_", ",_", "max_", "=_", "215", "5_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "fields_", "._", "String", "Field_", "(_", "**_", "field", "\\u", "args_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Admi", "n", "Model", "Converter_", "(_", "Model", "Converte", "r", "Base_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "convert", "s_", "(_", "'", "databa", "ses", ".", "postgres", ".", "PG", "Inet", "'_", ",_", "'", "dialect", "s", ".", "postgres", "ql", ".", "base", ".", "INE", "T", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "conv", "\\u", "PG", "Inet", "_", "(_", "self_", ",_", "field", "\\u", "args_", ",_", "**_", "extra_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "field", "\\u", "args_", "._", "setdefault_", "(_", "'", "label", "'_", ",_", "u", "'", "IP", " ", "Address", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "field", "\\u", "args_", "[_", "'", "validator", "s", "'_", "]_", "._", "append_", "(_", "validators_", "._", "IPA", "ddress", "_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "fields_", "._", "String", "Field_", "(_", "**_", "field", "\\u", "args_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Admi", "n", "Model", "Converter_", "(_", "Model", "Converte", "r", "Base_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "convert", "s_", "(_", "'", "dialect", "s", ".", "postgres", "ql", ".", "base", ".", "MAC", "ADDR", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "conv", "\\u", "PG", "Mac", "addr_", "(_", "self_", ",_", "field", "\\u", "args_", ",_", "**_", "extra_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "field", "\\u", "args_", "._", "setdefault_", "(_", "'", "label", "'_", ",_", "u", "'", "MAC", " ", "Address", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "field", "\\u", "args_", "[_", "'", "validator", "s", "'_", "]_", "._", "append_", "(_", "validators_", "._", "Mac", "Address_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "fields_", "._", "String", "Field_", "(_", "**_", "field", "\\u", "args_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Admi", "n", "Model", "Converter_", "(_", "Model", "Converte", "r", "Base_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "convert", "s_", "(_", "'", "dialect", "s", ".", "postgres", "ql", ".", "base", ".", "UU", "ID", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "conv", "\\u", "PG", "Uuid_", "(_", "self_", ",_", "field", "\\u", "args_", ",_", "**_", "extra_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "field", "\\u", "args_", "._", "setdefault_", "(_", "'", "label", "'_", ",_", "u", "'", "UU", "ID", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "field", "\\u", "args_", "[_", "'", "validator", "s", "'_", "]_", "._", "append_", "(_", "validators_", "._", "UUID_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "fields_", "._", "String", "Field_", "(_", "**_", "field", "\\u", "args_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Admi", "n", "Model", "Converter_", "(_", "Model", "Converte", "r", "Base_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "convert", "s_", "(_", "'", "sqla", "lche", "my", ".", "dialect", "s", ".", "postgres", "ql", ".", "base", ".", "ARR", "AY", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "conv", "\\u", "ARRAY_", "(_", "self_", ",_", "field", "\\u", "args_", ",_", "**_", "extra_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "form_", "._", "Select", "2", "Ta", "gs", "Field_", "(_", "save", "\\u", "as", "\\u", "list_", "=_", "True_", ",_", "**_", "field", "\\u", "args_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "resolve", "\\u", "prop_", "(_", "prop_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Resolv", "e", " ", "prox", "ied", " ", "property", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "prop", ":", "\\", "10", ";", " ", " ", " ", " ", "Proper", "ty", " ", "to", " ", "resolve", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Tr", "y", " ", "to", " ", "see", " ", "if", " ", "it", " ", "is", " ", "prox", "ied", " ", "property_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "hasattr_", "(_", "prop_", ",_", "'\\u", "prox", "ied", "\\u", "property", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "prop_", "._", "\\u", "prox", "ied", "\\u", "property_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "prop_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "form_", "(_", "model_", ",_", "converter_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "base", "\\u", "class_", "=_", "form_", "._", "Base", "Form_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "only_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "exclude_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "field", "\\u", "args_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "hidden", "\\u", "pk_", "=_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "ignore", "\\u", "hidden_", "=_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "extra", "\\u", "fields_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Generate", " ", "form", " ", "from", " ", "the", " ", "model", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "model", ":", "\\", "10", ";", " ", " ", " ", " ", "Model", " ", "to", " ", "generat", "e", " ", "form", " ", "from", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "converter", ":", "\\", "10", ";", " ", " ", " ", " ", "Converte", "r", " ", "class", " ", "to", " ", "use", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "base", "\\u", "class", ":", "\\", "10", ";", " ", " ", " ", " ", "Base", " ", "form", " ", "class", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "only", ":", "\\", "10", ";", " ", " ", " ", " ", "Include", " ", "fields", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "exclu", "de", ":", "\\", "10", ";", " ", " ", " ", " ", "Exclude", " ", "fields", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "field", "\\u", "args", ":", "\\", "10", ";", " ", " ", " ", " ", "Dict", "ionar", "y", " ", "with", " ", "addition", "al", " ", "field", " ", "argu", "ment", "s", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "hidden", "\\u", "pk", ":", "\\", "10", ";", " ", " ", " ", " ", "Generate", " ", "hidden", " ", "field", " ", "with", " ", "model", " ", "primary", " ", "key", " ", "or", " ", "not", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "ignore", "\\u", "hidden", ":", "\\", "10", ";", " ", " ", " ", " ", "If", " ", "set", " ", "to", " ", "Tru", "e", " ", "(", "default", "),", " ", "will", " ", "ignore", " ", "proper", "ties", " ", "tha", "t", " ", "start", " ", "with", " ", "underscore", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "TOD", "O", ":", " ", "Supp", "ort", " ", "new", " ", "0.", "8", " ", "API_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "hasattr_", "(_", "model_", ",_", "'\\u", "sa", "\\u", "class", "\\u", "manage", "r", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Type", "Error_", "(_", "'", "model", " ", "must", " ", "be", " ", "a", " ", "sqla", "lche", "my", " ", "mapp", "ed", " ", "model", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "mapper_", "=_", "model_", "._", "\\u", "sa", "\\u", "class", "\\u", "manager_", "._", "mapper_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "field", "\\u", "args_", "=_", "field", "\\u", "args_", "or_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "properties_", "=_", "(_", "(_", "p_", "._", "key_", ",_", "p_", ")_", "for_", "p_", "in_", "mapper_", "._", "iterate", "\\u", "properties_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "only_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "props_", "=_", "dict_", "(_", "properties_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "find_", "(_", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "If", " ", "field", " ", "is", " ", "in", " ", "extra", "\\u", "fields", ",", " ", "it", " ", "has", " ", "higher", " ", "priority_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "extra", "\\u", "fields_", "and_", "name_", "in_", "extra", "\\u", "fields_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "Field", "Place", "holder_", "(_", "extra", "\\u", "fields_", "[_", "name_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Tr", "y", " ", "to", " ", "look", " ", "it", " ", "up", " ", "in", " ", "proper", "ties", " ", "list", " ", "first_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "p_", "=_", "props_", "._", "get_", "(_", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "p_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "p_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "it", " ", "is", " ", "hybrid", " ", "property", " ", "or", " ", "alias", ",", " ", "look", " ", "it", " ", "up", " ", "in", " ", "a", " ", "model", " ", "its", "elf_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "p_", "=_", "getattr_", "(_", "model_", ",_", "name_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "p_", "is_", "not_", "None_", "and_", "hasattr_", "(_", "p_", ",_", "'", "property", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "p_", "._", "property_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "raise_", "Value", "Error_", "(_", "'", "Inva", "lid", " ", "model", " ", "property", " ", "name", " ", "%", "s", ".", "%", "s", "'_", "%_", "(_", "model_", ",_", "name_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Filter", " ", "proper", "ties", " ", "whi", "le", " ", "maintain", "ing", " ", "property", " ", "order", " ", "in", " ", "'", "only", "'", " ", "list_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "properties_", "=_", "(_", "(_", "x_", ",_", "find_", "(_", "x_", ")_", ")_", "for_", "x_", "in_", "only_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "exclude_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "properties_", "=_", "(_", "x_", "for_", "x_", "in_", "properties_", "if_", "x_", "[_", "0_", "]_", "not_", "in_", "exclude_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "field", "\\u", "dict_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "name_", ",_", "p_", "in_", "properties_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Ignor", "e", " ", "protect", "ed", " ", "properties_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "ignore", "\\u", "hidden_", "and_", "name_", "._", "startswith_", "(_", "'\\u'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "prop_", "=_", "\\u", "resolve", "\\u", "prop_", "(_", "p_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "field_", "=_", "converter_", "._", "convert_", "(_", "model_", ",_", "mapper_", ",_", "prop_", ",_", "field", "\\u", "args_", "._", "get_", "(_", "name_", ")_", ",_", "hidden", "\\u", "pk_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "field_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "field", "\\u", "dict_", "[_", "name_", "]_", "=_", "field_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Contrib", "ute", " ", "extra", " ", "fields_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "only_", "and_", "extra", "\\u", "fields_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "name_", ",_", "field_", "in_", "iteritems_", "(_", "extra", "\\u", "fields_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "field", "\\u", "dict_", "[_", "name_", "]_", "=_", "form_", "._", "recreate", "\\u", "field_", "(_", "field_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "type_", "(_", "model_", "._", "\\u\\u", "name\\u\\u_", "+_", "'", "Form", "'_", ",_", "(_", "base", "\\u", "class_", ",_", ")_", ",_", "field", "\\u", "dict_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "In", "line", "Model", "Converter_", "(_", "In", "line", "Model", "Converte", "r", "Base_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "In", "line", " ", "model", " ", "form", " ", "help", "er", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "inline", "\\u", "field", "\\u", "list", "\\u", "type_", "=_", "In", "line", "Model", "Form", "List_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Us", "ed", " ", "field", " ", "list", " ", "type", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "If", " ", "you", " ", "want", " ", "to", " ", "do", " ", "some", " ", "custom", " ", "render", "ing", " ", "of", " ", "inline", " ", "field", " ", "lists", ",", "\\", "10", ";", " ", " ", " ", " ", "you", " ", "can", " ", "create", " ", "your", " ", "own", " ", "wtf", "orms", " ", "field", " ", "and", " ", "use", " ", "it", " ", "inst", "ead", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "In", "line", "Model", "Converter_", "(_", "In", "line", "Model", "Converte", "r", "Base_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "session_", ",_", "view_", ",_", "model", "\\u", "converter_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Constructor", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "session", ":", "\\", "10", ";", " ", " ", " ", " ", "SQL", "Al", "chem", "y", " ", "session", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "view", ":", "\\", "10", ";", " ", " ", " ", " ", "Fla", "sk", "-", "Admi", "n", " ", "view", " ", "object", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "model", "\\u", "converter", ":", "\\", "10", ";", " ", " ", " ", " ", "Model", " ", "converter", " ", "class", ".", " ", "Wil", "l", " ", "be", " ", "automati", "call", "y", " ", "instantiate", "d", " ", "with", "\\", "10", ";", " ", " ", " ", " ", "appropr", "iate", " ", "`", "In", "line", "Form", "Admi", "n", "`", " ", "instance", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "super_", "(_", "In", "line", "Model", "Converter_", ",_", "self_", ")_", "._", "\\u\\u", "init\\u\\u_", "(_", "view_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "session_", "=_", "session_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "model", "\\u", "converter_", "=_", "model", "\\u", "converter_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "In", "line", "Model", "Converter_", "(_", "In", "line", "Model", "Converte", "r", "Base_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "info_", "(_", "self_", ",_", "p_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "info_", "=_", "super_", "(_", "In", "line", "Model", "Converter_", ",_", "self_", ")_", "._", "get", "\\u", "info_", "(_", "p_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Special", " ", "case", " ", "for", " ", "model", " ", "instances_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "info_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "hasattr_", "(_", "p_", ",_", "'\\u", "sa", "\\u", "class", "\\u", "manage", "r", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "form", "\\u", "admin", "\\u", "class_", "(_", "p_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "model_", "=_", "getattr_", "(_", "p_", ",_", "'", "model", "'_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "model_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "raise_", "Exception_", "(_", "'", "Un", "know", "n", " ", "inline", " ", "model", " ", "admin", ":", " ", "%", "s", "'_", "%_", "repr_", "(_", "p_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "attrs_", "=_", "dict_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "attr_", "in_", "dir_", "(_", "p_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "not_", "attr_", "._", "startswith_", "(_", "'\\u'_", ")_", "and_", "attr_", "!=_", "'", "model", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "attrs_", "[_", "attr_", "]_", "=_", "getattr_", "(_", "p_", ",_", "attr_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "self_", "._", "form", "\\u", "admin", "\\u", "class_", "(_", "model_", ",_", "**_", "attrs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "info_", "=_", "self_", "._", "form", "\\u", "admin", "\\u", "class_", "(_", "model_", ",_", "**_", "attrs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Resolv", "e", " ", "AJ", "AX", " ", "FK", "s_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "info_", "._", "\\u", "form", "\\u", "aja", "x", "\\u", "refs_", "=_", "self_", "._", "process", "\\u", "aja", "x", "\\u", "refs_", "(_", "info_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "info_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "In", "line", "Model", "Converter_", "(_", "In", "line", "Model", "Converte", "r", "Base_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "process", "\\u", "aja", "x", "\\u", "refs_", "(_", "self_", ",_", "info_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "refs_", "=_", "getattr_", "(_", "info_", ",_", "'", "form", "\\u", "aja", "x", "\\u", "refs", "'_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "result_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "refs_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "name_", ",_", "opts_", "in_", "iteritems_", "(_", "refs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "new", "\\u", "name_", "=_", "'%", "s", "-%", "s", "'_", "%_", "(_", "info_", "._", "model_", "._", "\\u\\u", "name\\u\\u_", "._", "lower_", "(_", ")_", ",_", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "loader_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "isinstance_", "(_", "opts_", ",_", "dict_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "loader_", "=_", "create", "\\u", "aja", "x", "\\u", "loader_", "(_", "info_", "._", "model_", ",_", "self_", "._", "session_", ",_", "new", "\\u", "name_", ",_", "name_", ",_", "opts_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "loader_", "=_", "opts_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "result_", "[_", "name_", "]_", "=_", "loader_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "view_", "._", "\\u", "form", "\\u", "aja", "x", "\\u", "refs_", "[_", "new", "\\u", "name_", "]_", "=_", "loader_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "result_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "In", "line", "Model", "Converter_", "(_", "In", "line", "Model", "Converte", "r", "Base_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "contribute", "_", "(_", "self_", ",_", "model_", ",_", "form", "\\u", "class_", ",_", "inline", "\\u", "model_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Generate", " ", "form", " ", "fields", " ", "for", " ", "inline", " ", "forms", " ", "and", " ", "contribute", " ", "them", " ", "to", "\\", "10", ";", " ", " ", " ", " ", "the", " ", "`", "form", "\\u", "class", "`", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "converter", ":", "\\", "10", ";", " ", " ", " ", " ", "Model", "Converte", "r", "Base", " ", "instance", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "session", ":", "\\", "10", ";", " ", " ", " ", " ", "SQL", "Al", "chem", "y", " ", "session", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "model", ":", "\\", "10", ";", " ", " ", " ", " ", "Model", " ", "class", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "form", "\\u", "class", ":", "\\", "10", ";", " ", " ", " ", " ", "Form", " ", "to", " ", "add", " ", "proper", "ties", " ", "to", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "inline", "\\u", "model", ":", "\\", "10", ";", " ", " ", " ", " ", "In", "line", " ", "model", ".", " ", "Can", " ", "be", " ", "one", " ", "of", ":", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", " ", "-", " ", "``", "tuple", "``", ",", " ", "first", " ", "value", " ", "is", " ", "relate", "d", " ", "model", " ", "instance", ",", "\\", "10", ";", " ", " ", " ", " ", " ", "second", " ", "is", " ", "dictionar", "y", " ", "with", " ", "options", "\\", "10", ";", " ", " ", " ", " ", " ", "-", " ", "``", "In", "line", "Form", "Admi", "n", "``", " ", "instance", "\\", "10", ";", " ", " ", " ", " ", " ", "-", " ", "Model", " ", "class", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "return", ":", "\\", "10", ";", " ", " ", " ", " ", "Form", " ", "class", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "mapper_", "=_", "model_", "._", "\\u", "sa", "\\u", "class", "\\u", "manager_", "._", "mapper_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "info_", "=_", "self_", "._", "get", "\\u", "info_", "(_", "inline", "\\u", "model_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Fin", "d", " ", "property", " ", "from", " ", "target", " ", "model", " ", "to", " ", "current", " ", "model_", "\\u\\u\\uNL\\u\\u\\u_", "target", "\\u", "mapper_", "=_", "info_", "._", "model_", "._", "\\u", "sa", "\\u", "class", "\\u", "manager_", "._", "mapper_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "reverse", "\\u", "prop_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "prop_", "in_", "target", "\\u", "mapper_", "._", "iterate", "\\u", "properties_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "hasattr_", "(_", "prop_", ",_", "'", "direction", "'_", ")_", "and_", "prop_", "._", "direction_", "._", "name_", "in_", "(_", "'", "MAN", "YT", "OO", "NE", "'_", ",_", "'", "MAN", "YT", "OM", "ANY", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "issubclass_", "(_", "model_", ",_", "prop_", "._", "mapper_", "._", "class\\u_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "reverse", "\\u", "prop_", "=_", "prop_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Exception_", "(_", "'", "Cann", "ot", " ", "find", " ", "reverse", " ", "relation", " ", "for", " ", "model", " ", "%", "s", "'_", "%_", "info_", "._", "model_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Fin", "d", " ", "forward", " ", "property_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "forward", "\\u", "prop_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "prop_", "._", "direction_", "._", "name_", "==_", "'", "MAN", "YT", "OO", "NE", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "candidate_", "=_", "'", "ONE", "TOM", "ANY", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "candidate_", "=_", "'", "MAN", "YT", "OM", "ANY", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "prop_", "in_", "mapper_", "._", "iterate", "\\u", "properties_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "hasattr_", "(_", "prop_", ",_", "'", "direction", "'_", ")_", "and_", "prop_", "._", "direction_", "._", "name_", "==_", "candidate_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "prop_", "._", "mapper_", "._", "class\\u_", "==_", "target", "\\u", "mapper_", "._", "class\\u_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "forward", "\\u", "prop_", "=_", "prop_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Exception_", "(_", "'", "Cann", "ot", " ", "find", " ", "forward", " ", "relation", " ", "for", " ", "model", " ", "%", "s", "'_", "%_", "info_", "._", "model_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Remove", " ", "reverse", " ", "property", " ", "from", " ", "the", " ", "list_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "ignore_", "=_", "[_", "reverse", "\\u", "prop_", "._", "key_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "info_", "._", "form", "\\u", "exclu", "ded", "\\u", "columns_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "exclude_", "=_", "ignore_", "+_", "list_", "(_", "info_", "._", "form", "\\u", "exclu", "ded", "\\u", "columns_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "exclude_", "=_", "ignore_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Creat", "e", " ", "converter_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "converter_", "=_", "self_", "._", "model", "\\u", "converter_", "(_", "self_", "._", "session_", ",_", "info_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Creat", "e", " ", "form_", "\\u\\u\\uNL\\u\\u\\u_", "child", "\\u", "form_", "=_", "info_", "._", "get", "\\u", "form_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "child", "\\u", "form_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "child", "\\u", "form_", "=_", "get", "\\u", "form_", "(_", "info_", "._", "model_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "converter_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "only_", "=_", "info_", "._", "form", "\\u", "columns_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "exclude_", "=_", "exclude_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "field", "\\u", "args_", "=_", "info_", "._", "form", "\\u", "args_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "hidden", "\\u", "pk_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Post", "-", "process", " ", "form_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "child", "\\u", "form_", "=_", "info_", "._", "postprocess", "\\u", "form_", "(_", "child", "\\u", "form_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "kwargs_", "=_", "dict_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "label_", "=_", "self_", "._", "get", "\\u", "label_", "(_", "info_", ",_", "forward", "\\u", "prop_", "._", "key_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "label_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "kwargs_", "[_", "'", "label", "'_", "]_", "=_", "label_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "view_", "._", "form", "\\u", "args_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "field", "\\u", "args_", "=_", "self_", "._", "view_", "._", "form", "\\u", "args_", "._", "get_", "(_", "forward", "\\u", "prop_", "._", "key_", ",_", "{_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "kwargs_", "._", "update_", "(_", "**_", "field", "\\u", "args_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Contrib", "ute", " ", "field_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "setattr_", "(_", "form", "\\u", "class_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "forward", "\\u", "prop_", "._", "key_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "inline", "\\u", "field", "\\u", "list", "\\u", "type_", "(_", "child", "\\u", "form_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "session_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "info_", "._", "model_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "reverse", "\\u", "prop_", "._", "key_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "info_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "**_", "kwargs_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "form", "\\u", "class_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2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2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
mardiros/pyshop/pyshop/helpers/sqla.py
[ { "content": "import re\n\nfrom zope.sqlalchemy import ZopeTransactionExtension\n\nfrom sqlalchemy import Column, Integer, DateTime, engine_from_config\nfrom sqlalchemy.interfaces import PoolListener\nfrom sqlalchemy.exc import DisconnectionError\nfrom sqlalchemy.sql.expression import func, asc, desc\n\nfrom sqlalchemy.orm import scoped_session, sessionmaker, joinedload\nfrom sqlalchemy.ext.declarative import declarative_base, declared_attr\n\n\n\n\n\n\n\n\n\n\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class ModelError(Exception):\n", "metadata": "root.ModelError", "header": "['module', '___EOS___']", "index": 14 }, { "content": " def __init__(self, errors):\n super(ModelError, self).__init__('\\n'.join(errors))\n self.errors = errors", "metadata": "root.ModelError.__init__", "header": "['class', 'ModelError', '(', 'Exception', ')', ':', '___EOS___']", "index": 16 }, { "content": "class _Base(object):\n\n\n __table_args__ = {'mysql_engine': 'InnoDB',\n 'mysql_charset': 'utf8'\n }\n\n id = Column(Integer, primary_key=True)\n created_at = Column(DateTime, default=func.now())\n\n\n\n\n\n", "metadata": "root._Base", "header": "['module', '___EOS___']", "index": 21 }, { "content": " @declared_attr\n def __tablename__(cls):\n # CamelCase to underscore cast\n s1 = re.sub('(.)([A-Z][a-z]+)', r'\\1_\\2', cls.__name__)\n return re.sub('([a-z0-9])([A-Z])', r'\\1_\\2', s1).lower()", "metadata": "root._Base.__tablename__", "header": "['class', '_Base', '(', 'object', ')', ':', '___EOS___']", "index": 23 }, { "content": " @classmethod\n def by_id(cls, session, id):\n return cls.first(session, where=(cls.id == id,))", "metadata": "root._Base.by_id", "header": "['class', '_Base', '(', 'object', ')', ':', '___EOS___']", "index": 36 }, { "content": " @classmethod\n def find(cls, session, join=None, where=None, order_by=None, limit=None,\n offset=None, count=None):\n if count:\n offset = limit = order_by = None # XXX posgresql doesn't like it\n qry = cls.build_query(session, join, where, order_by, limit,\n offset, count)\n return qry.scalar() if count is not None else qry.all()", "metadata": "root._Base.find", "header": "['class', '_Base', '(', 'object', ')', ':', '___EOS___']", "index": 40 }, { "content": " @classmethod\n def first(cls, session, join=None, where=None, order_by=None):\n return cls.build_query(session, join, where, order_by).first()", "metadata": "root._Base.first", "header": "['class', '_Base', '(', 'object', ')', ':', '___EOS___']", "index": 49 }, { "content": " @classmethod\n def all(cls, session, page_size=1000, order_by=None):\n offset = 0\n order_by = order_by or cls.id\n while True:\n page = cls.find(session, order_by=order_by,\n limit=page_size, offset=offset)\n for m in page:\n yield m\n session.flush()\n if len(page) != page_size:\n raise StopIteration()\n offset += page_size", "metadata": "root._Base.all", "header": "['class', '_Base', '(', 'object', ')', ':', '___EOS___']", "index": 53 }, { "content": " @classmethod\n def build_query(cls, session, join=None, where=None, order_by=None,\n limit=None, offset=None, count=None):\n\n if count is not None:\n query = session.query(func.count(count)).select_from(cls)\n else:\n query = session.query(cls)\n\n if join:\n if isinstance(join, (list, tuple)):\n for j in join:\n query = query.join(j)\n else:\n query = query.join(join)\n\n if where:\n for filter in where:\n query = query.filter(filter)\n\n if order_by is not None:\n if isinstance(order_by, (list, tuple)):\n query = query.order_by(*order_by)\n else:\n query = query.order_by(order_by)\n if limit:\n query = query.limit(limit)\n if offset:\n query = query.offset(offset)\n return query", "metadata": "root._Base.build_query", "header": "['class', '_Base', '(', 'object', ')', ':', '___EOS___']", "index": 67 }, { "content": " def validate(self, session):\n \"\"\"\n return True or raise a :class:`ModelError` Exception\n \"\"\"\n return True", "metadata": "root._Base.validate", "header": "['class', '_Base', '(', 'object', ')', ':', '___EOS___']", "index": 98 }, { "content": "class Database(object):\n databases = {}\n\n", "metadata": "root.Database", "header": "['module', '___EOS___']", "index": 105 }, { "content": " @classmethod\n def register(cls, name):\n if name not in cls.databases:\n cls.databases[name] = declarative_base(cls=_Base)\n return cls.databases[name]", "metadata": "root.Database.register", "header": "['class', 'Database', '(', 'object', ')', ':', '___EOS___']", "index": 108 }, { "content": " @classmethod\n def get(cls, name):\n return cls.databases[name]", "metadata": "root.Database.get", "header": "['class', 'Database', '(', 'object', ')', ':', '___EOS___']", "index": 114 }, { "content": "class SessionFactory(object):\n\n sessions = {}\n\n", "metadata": "root.SessionFactory", "header": "['module', '___EOS___']", "index": 119 }, { "content": " @classmethod\n def register(cls, name, scoped):\n if scoped:\n cls.sessions[name] = scoped_session(sessionmaker(\n extension=ZopeTransactionExtension()))\n else:\n cls.sessions[name] = sessionmaker()\n return cls.sessions[name]", "metadata": "root.SessionFactory.register", "header": "['class', 'SessionFactory', '(', 'object', ')', ':', '___EOS___']", "index": 123 }, { "content": " @classmethod\n def get(cls, name):\n return cls.sessions[name]", "metadata": "root.SessionFactory.get", "header": "['class', 'SessionFactory', '(', 'object', ')', ':', '___EOS___']", "index": 132 }, { "content": "def create_engine(db_name, settings, prefix='sqlalchemy.', scoped=False):\n engine = engine_from_config(settings, prefix)\n\n DBSession = SessionFactory.register(db_name, scoped)\n DBSession.configure(bind=engine)\n Database.get(db_name).metadata.bind = engine\n\n return engine", "metadata": "root.create_engine", "header": "['module', '___EOS___']", "index": 137 }, { "content": "def dispose_engine(db_name):\n Database.get(db_name).metadata.bind.dispose()", "metadata": "root.dispose_engine", "header": "['module', '___EOS___']", "index": 147 } ]
[ { "span": "from sqlalchemy.interfaces import PoolListener", "start_line": 5, "start_column": 0, "end_line": 5, "end_column": 46 }, { "span": "from sqlalchemy.exc import DisconnectionError", "start_line": 6, "start_column": 0, "end_line": 6, "end_column": 45 }, { "span": "from sqlalchemy.sql.expression import func, asc, desc", "start_line": 7, "start_column": 0, "end_line": 7, "end_column": 53 }, { "span": "from sqlalchemy.orm import scoped_session, sessionmaker, joinedload", "start_line": 9, "start_column": 0, "end_line": 9, "end_column": 67 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "import_", "re_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "zope_", "._", "sqlalchemy_", "import_", "Zo", "pe", "Transa", "ction", "Extension_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "sqlalchemy_", "import_", "Column_", ",_", "Integer_", ",_", "Date", "Time_", ",_", "eng", "ine", "\\u", "from", "\\u", "config_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "sqlalchemy_", "._", "interfaces_", "import_", "Poo", "l", "Listener_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "sqlalchemy_", "._", "exc_", "import_", "Disconnect", "ion", "Error_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "sqlalchemy_", "._", "sql_", "._", "expression_", "import_", "func_", ",_", "asc_", ",_", "desc_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "sqlalchemy_", "._", "orm_", "import_", "scoped", "\\u", "session_", ",_", "sessionmaker_", ",_", "joine", "dlo", "ad_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "sqlalchemy_", "._", "ext_", "._", "declarative", "_", "import_", "declarative", "\\u", "base_", ",_", "declared", "\\u", "attr_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Model", "Error_", "(_", "Exception_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Model", "Error_", "(_", "Exception_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "errors_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "super_", "(_", "Model", "Error_", ",_", "self_", ")_", "._", "\\u\\u", "init\\u\\u_", "(_", "'\\\\", "n", "'_", "._", "join_", "(_", "errors_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "errors_", "=_", "errors_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "\\u", "Base_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u", "table", "\\u", "args\\u\\u_", "=_", "{_", "'", "mysql", "\\u", "eng", "ine", "'_", ":_", "'", "Inno", "DB", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "mysql", "\\u", "charset", "'_", ":_", "'", "utf", "8", "'_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "id_", "=_", "Column_", "(_", "Integer_", ",_", "primary", "\\u", "key_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "created", "\\u", "at_", "=_", "Column_", "(_", "Date", "Time_", ",_", "default_", "=_", "func_", "._", "now_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "\\u", "Base_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "@_", "declared", "\\u", "attr_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u\\u", "tablename\\u\\u_", "(_", "cls_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Came", "l", "Case", " ", "to", " ", "underscore", " ", "cast_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "s1_", "=_", "re_", "._", "sub_", "(_", "'(", ".)", "([", "A", "-", "Z", "][", "a", "-", "z", "]+)'_", ",_", "r", "'\\\\", "1", "\\u\\\\", "2", "'_", ",_", "cls_", "._", "\\u\\u", "name\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "re_", "._", "sub_", "(_", "'(", "[", "a", "-", "z", "0", "-", "9", "])(", "[", "A", "-", "Z", "])'_", ",_", "r", "'\\\\", "1", "\\u\\\\", "2", "'_", ",_", "s1_", ")_", "._", "lower_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "\\u", "Base_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "@_", "classmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "by", "\\u", "id_", "(_", "cls_", ",_", "session_", ",_", "id_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "cls_", "._", "first_", "(_", "session_", ",_", "where_", "=_", "(_", "cls_", "._", "id_", "==_", "id_", ",_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "\\u", "Base_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "classmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "find_", "(_", "cls_", ",_", "session_", ",_", "join_", "=_", "None_", ",_", "where_", "=_", "None_", ",_", "order", "\\u", "by_", "=_", "None_", ",_", "limit_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "offset_", "=_", "None_", ",_", "count_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "count_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "offset_", "=_", "limit_", "=_", "order", "\\u", "by_", "=_", "None_", "#", " ", "XX", "X", " ", "pos", "gres", "ql", " ", "doe", "sn", "'", "t", " ", "like", " ", "it_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "qry_", "=_", "cls_", "._", "build", "\\u", "query_", "(_", "session_", ",_", "join_", ",_", "where_", ",_", "order", "\\u", "by_", ",_", "limit_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "offset_", ",_", "count_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "qry_", "._", "scalar_", "(_", ")_", "if_", "count_", "is_", "not_", "None_", "else_", "qry_", "._", "all_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "\\u", "Base_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "classmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "first_", "(_", "cls_", ",_", "session_", ",_", "join_", "=_", "None_", ",_", "where_", "=_", "None_", ",_", "order", "\\u", "by_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "cls_", "._", "build", "\\u", "query_", "(_", "session_", ",_", "join_", ",_", "where_", ",_", "order", "\\u", "by_", ")_", "._", "first_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "\\u", "Base_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "classmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "all_", "(_", "cls_", ",_", "session_", ",_", "page", "\\u", "size_", "=_", "1000_", ",_", "order", "\\u", "by_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "offset_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "order", "\\u", "by_", "=_", "order", "\\u", "by_", "or_", "cls_", "._", "id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "True_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "page_", "=_", "cls_", "._", "find_", "(_", "session_", ",_", "order", "\\u", "by_", "=_", "order", "\\u", "by_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "limit_", "=_", "page", "\\u", "size_", ",_", "offset_", "=_", "offset_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "m_", "in_", "page_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "yield_", "m_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "session_", "._", "flush_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "len_", "(_", "page_", ")_", "!=_", "page", "\\u", "size_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Sto", "p", "Iteration_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "offset_", "+=_", "page", "\\u", "size_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "\\u", "Base_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "classmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "build", "\\u", "query_", "(_", "cls_", ",_", "session_", ",_", "join_", "=_", "None_", ",_", "where_", "=_", "None_", ",_", "order", "\\u", "by_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "limit_", "=_", "None_", ",_", "offset_", "=_", "None_", ",_", "count_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "count_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "query_", "=_", "session_", "._", "query_", "(_", "func_", "._", "count_", "(_", "count_", ")_", ")_", "._", "select", "\\u", "from_", "(_", "cls_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "query_", "=_", "session_", "._", "query_", "(_", "cls_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "join_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "isinstance_", "(_", "join_", ",_", "(_", "list_", ",_", "tuple_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "j_", "in_", "join_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "query_", "=_", "query_", "._", "join_", "(_", "j_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "query_", "=_", "query_", "._", "join_", "(_", "join_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "where_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "filter_", "in_", "where_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "query_", "=_", "query_", "._", "filter_", "(_", "filter_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "order", "\\u", "by_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "isinstance_", "(_", "order", "\\u", "by_", ",_", "(_", "list_", ",_", "tuple_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "query_", "=_", "query_", "._", "order", "\\u", "by_", "(_", "*_", "order", "\\u", "by_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "query_", "=_", "query_", "._", "order", "\\u", "by_", "(_", "order", "\\u", "by_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "limit_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "query_", "=_", "query_", "._", "limit_", "(_", "limit_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "offset_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "query_", "=_", "query_", "._", "offset_", "(_", "offset_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "query_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "\\u", "Base_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "validate_", "(_", "self_", ",_", "session_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "return", " ", "Tru", "e", " ", "or", " ", "raise", " ", "a", " ", ":", "class", ":`", "Model", "Error", "`", " ", "Except", "ion", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Database_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "databases_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Database_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "@_", "classmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "register_", "(_", "cls_", ",_", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "name_", "not_", "in_", "cls_", "._", "databases_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cls_", "._", "databases_", "[_", "name_", "]_", "=_", "declarative", "\\u", "base_", "(_", "cls_", "=_", "\\u", "Base_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "cls_", "._", "databases_", "[_", "name_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Database_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "classmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "get_", "(_", "cls_", ",_", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "cls_", "._", "databases_", "[_", "name_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Sess", "ion", "Factory_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sessions_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Sess", "ion", "Factory_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "@_", "classmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "register_", "(_", "cls_", ",_", "name_", ",_", "scoped", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "scoped", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cls_", "._", "sessions_", "[_", "name_", "]_", "=_", "scoped", "\\u", "session_", "(_", "sessionmaker_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "extension_", "=_", "Zo", "pe", "Transa", "ction", "Extension_", "(_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cls_", "._", "sessions_", "[_", "name_", "]_", "=_", "sessionmaker_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "cls_", "._", "sessions_", "[_", "name_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Sess", "ion", "Factory_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "classmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "get_", "(_", "cls_", ",_", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "cls_", "._", "sessions_", "[_", "name_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "create", "\\u", "engine_", "(_", "db", "\\u", "name_", ",_", "settings_", ",_", "prefix_", "=_", "'", "sqla", "lche", "my", ".'_", ",_", "scoped", "_", "=_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "engine_", "=_", "eng", "ine", "\\u", "from", "\\u", "config_", "(_", "settings_", ",_", "prefix_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "DB", "Session_", "=_", "Sess", "ion", "Factory_", "._", "register_", "(_", "db", "\\u", "name_", ",_", "scoped", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "DB", "Session_", "._", "configure_", "(_", "bind_", "=_", "engine_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Database_", "._", "get_", "(_", "db", "\\u", "name_", ")_", "._", "metadata_", "._", "bind_", "=_", "engine_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "engine_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "dispose", "\\u", "engine_", "(_", "db", "\\u", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ",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 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
taherh/pysimsearch/pysimsearch/test/freq_tools_test.py
[ { "content": "#!/usr/bin/env python\n\n# Copyright (c) 2010, Taher Haveliwala <[email protected]>\n# All rights reserved.\n#\n# Redistribution and use in source and binary forms, with or without\n# modification, are permitted provided that the following conditions are met:\n# * Redistributions of source code must retain the above copyright\n# notice, this list of conditions and the following disclaimer.\n# * Redistributions in binary form must reproduce the above copyright\n# notice, this list of conditions and the following disclaimer in the\n# documentation and/or other materials provided with the distribution.\n# * The names of project contributors may not be used to endorse or\n# promote products derived from this software without specific\n# prior written permission.\n#\n# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n# \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n# HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\n'''\nUnittests for pysimsearch.freq_tools package\n\nTo run unittests, run 'nosetests' from the test directory\n'''\nfrom __future__ import(division, absolute_import, print_function,\n unicode_literals)\n\nimport unittest\n\nimport io\nimport pprint\n\nfrom pysimsearch import freq_tools\nfrom pysimsearch import doc_reader\n \n \n\nif __name__ == \"__main__\":\n unittest.main()\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class FreqToolsTest(unittest.TestCase):\n longMessage = True\n\n \n ", "metadata": "root.FreqToolsTest", "header": "['module', '___EOS___']", "index": 44 }, { "content": " def test_read_df(self):\n '''read_df() test'''\n df_dict = {'a':5, 'b':3, 'c':1}\n df_file_str =\\\n '''\n a 5\n b 3\n c 1\n '''\n df_file = io.StringIO(df_file_str)\n self.assertEqual(freq_tools.read_df(df_file), df_dict)", "metadata": "root.FreqToolsTest.test_read_df", "header": "['class', 'FreqToolsTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 47 }, { "content": " def test_write_df(self):\n '''write_df() test'''\n df_dict = {'a':5, 'b':3, 'c':1}\n df_file = io.StringIO()\n freq_tools.write_df(df_dict, df_file)\n \n df_file.seek(0)\n self.assertEqual(freq_tools.read_df(df_file), df_dict)", "metadata": "root.FreqToolsTest.test_write_df", "header": "['class', 'FreqToolsTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 59 }, { "content": " def test_compute_df(self):\n doc1 = 'a b b c d e e e e f'\n doc2 = ' b e g g g h i'\n doc3 = ' b b b b c d h '\n \n df_dict = {'a':1, 'b':3, 'c':2, 'd':2, 'e':2, 'f':1, 'g':1, 'h':2,\n 'i':1}\n \n files = (io.StringIO(doc1), io.StringIO(doc2), io.StringIO(doc3))\n self.assertEqual(freq_tools.compute_df(files), df_dict)", "metadata": "root.FreqToolsTest.test_compute_df", "header": "['class', 'FreqToolsTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 68 } ]
[ { "span": "import pprint", "start_line": 39, "start_column": 0, "end_line": 39, "end_column": 13 }, { "span": "from pysimsearch import doc_reader", "start_line": 42, "start_column": 0, "end_line": 42, "end_column": 34 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#!", "/", "usr", "/", "bin", "/", "env", " ", "python_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Copy", "right", " ", "(", "c", ")", " ", "2010", ",", " ", "Ta", "her", " ", "Ha", "vel", "iw", "ala", " ", "<", "oss", "@", "ta", "her", "h", ".", "org", ">_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "All", " ", "rights", " ", "reserve", "d", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Redistributi", "on", " ", "and", " ", "use", " ", "in", " ", "source", " ", "and", " ", "binar", "y", " ", "forms", ",", " ", "with", " ", "or", " ", "with", "out_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "modification", ",", " ", "are", " ", "permit", "ted", " ", "provided", " ", "tha", "t", " ", "the", " ", "follow", "ing", " ", "condition", "s", " ", "are", " ", "met", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "*", " ", "Redistributi", "ons", " ", "of", " ", "source", " ", "code", " ", "must", " ", "retain", " ", "the", " ", "above", " ", "copyright_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "notice", ",", " ", "this", " ", "list", " ", "of", " ", "condition", "s", " ", "and", " ", "the", " ", "follow", "ing", " ", "discl", "aime", "r", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "*", " ", "Redistributi", "ons", " ", "in", " ", "binar", "y", " ", "form", " ", "must", " ", "reproduce", " ", "the", " ", "above", " ", "copyright_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "notice", ",", " ", "this", " ", "list", " ", "of", " ", "condition", "s", " ", "and", " ", "the", " ", "follow", "ing", " ", "discl", "aime", "r", " ", "in", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "documentation", " ", "and", "/", "or", " ", "other", " ", "material", "s", " ", "provided", " ", "with", " ", "the", " ", "distribu", "tion", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "*", " ", "The", " ", "names", " ", "of", " ", "project", " ", "contributor", "s", " ", "may", " ", "not", " ", "be", " ", "used", " ", "to", " ", "endo", "rse", " ", "or_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "promote", " ", "products", " ", "derive", "d", " ", "from", " ", "this", " ", "software", " ", "with", "out", " ", "specific_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "prior", " ", "writt", "en", " ", "permissi", "on", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "THIS", " ", "SOFT", "WARE", " ", "IS", " ", "PROVI", "DED", " ", "BY", " ", "THE", " ", "COPY", "RIG", "HT", " ", "HOLD", "ERS", " ", "AND", " ", "CONTRIB", "UTO", "RS_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "\"", "AS", " ", "IS", "\"", " ", "AND", " ", "ANY", " ", "EXPR", "ESS", " ", "OR", " ", "IMPL", "IED", " ", "WAR", "RAN", "TIES", ",", " ", "INC", "LU", "DING", ",", " ", "BUT", " ", "NOT", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "LIMIT", "ED", " ", "TO", ",", " ", "THE", " ", "IMPL", "IED", " ", "WAR", "RAN", "TIES", " ", "OF", " ", "MER", "CHAN", "TAB", "ILI", "TY", " ", "AND", " ", "FIT", "NESS", " ", "FOR", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "A", " ", "PARTI", "CUL", "AR", " ", "PUR", "POS", "E", " ", "ARE", " ", "DISC", "LAI", "MED", ".", " ", "IN", " ", "NO", " ", "EVENT", " ", "SHA", "LL", " ", "THE", " ", "COPY", "RIGHT_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "HOLD", "ER", " ", "OR", " ", "CONTRIB", "UTO", "RS", " ", "BE", " ", "LI", "AB", "LE", " ", "FOR", " ", "ANY", " ", "DIRECT", ",", " ", "INDI", "RECT", ",", " ", "INC", "IDENT", "AL", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "SPECIAL", ",", " ", "EXE", "MPL", "ARY", ",", " ", "OR", " ", "CONS", "EQU", "ENTI", "AL", " ", "DA", "MAGE", "S", " ", "(", "INC", "LU", "DING", ",", " ", "BUT", " ", "NOT", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "LIMIT", "ED", " ", "TO", ",", " ", "PROC", "URE", "MENT", " ", "OF", " ", "SUBST", "ITU", "TE", " ", "GOOD", "S", " ", "OR", " ", "SERVICES", ";", " ", "LOSS", " ", "OF", " ", "USE", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "DATA", ",", " ", "OR", " ", "PROF", "IT", "S", ";", " ", "OR", " ", "BUS", "INE", "SS", " ", "INTER", "RU", "PTION", ")", " ", "HO", "WE", "VER", " ", "CAU", "SED", " ", "AND", " ", "ON", " ", "ANY_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "THE", "ORY", " ", "OF", " ", "LI", "ABI", "LIT", "Y", ",", " ", "WHE", "THER", " ", "IN", " ", "CONTR", "ACT", ",", " ", "STRI", "CT", " ", "LI", "ABI", "LIT", "Y", ",", " ", "OR", " ", "TOR", "T_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "(", "INC", "LU", "DING", " ", "NEG", "LIG", "ENCE", " ", "OR", " ", "OTHER", "WI", "SE", ")", " ", "ARI", "SIN", "G", " ", "IN", " ", "ANY", " ", "WAY", " ", "OUT", " ", "OF", " ", "THE", " ", "USE", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "OF", " ", "THIS", " ", "SOFT", "WARE", ",", " ", "EVE", "N", " ", "IF", " ", "ADV", "ISE", "D", " ", "OF", " ", "THE", " ", "POS", "SIB", "ILI", "TY", " ", "OF", " ", "SUC", "H", " ", "DA", "MAGE", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "'''", "\\", "10", ";", "Unit", "tests", " ", "for", " ", "pys", "ims", "ear", "ch", ".", "freq", "\\u", "tool", "s", " ", "package", "\\", "10", ";", "\\", "10", ";", "To", " ", "run", " ", "unittest", "s", ",", " ", "run", " ", "'", "nose", "tests", "'", " ", "from", " ", "the", " ", "test", " ", "director", "y", "\\", "10", ";'", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "\\u\\u", "future\\u\\u_", "import_", "(_", "division_", ",_", "abs", "olute", "\\u", "import_", ",_", "print", "\\u", "function_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "unicode", "\\u", "literals_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "unittest_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "io_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "pprint_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "pys", "ims", "earch_", "import_", "freq", "\\u", "tools_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "pys", "ims", "earch_", "import_", "doc", "\\u", "reader_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "\\u\\u", "name\\u\\u_", "==_", "\"\\u\\u", "main", "\\u\\u\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "unittest_", "._", "main_", "(_", ")_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Freq", "Tool", "s", "Test_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "long", "Message_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Freq", "Tool", "s", "Test_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "test\\u", "read", "\\u", "df_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "read", "\\u", "df", "()", " ", "test", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "df", "\\u", "dict_", "=_", "{_", "'", "a", "'_", ":_", "5_", ",_", "'", "b", "'_", ":_", "3_", ",_", "'", "c", "'_", ":_", "1_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "df", "\\u", "file", "\\u", "str_", "=_", "'''", "\\", "10", ";", " ", " ", " ", " ", "a", " ", " ", " ", " ", "5", "\\", "10", ";", " ", " ", " ", " ", "b", " ", " ", " ", " ", "3", "\\", "10", ";", " ", " ", " ", " ", "c", " ", " ", " ", " ", "1", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "df", "\\u", "file_", "=_", "io_", "._", "String", "IO_", "(_", "df", "\\u", "file", "\\u", "str_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "freq", "\\u", "tools_", "._", "read", "\\u", "df_", "(_", "df", "\\u", "file_", ")_", ",_", "df", "\\u", "dict_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Freq", "Tool", "s", "Test_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "write", "\\u", "df_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "write", "\\u", "df", "()", " ", "test", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "df", "\\u", "dict_", "=_", "{_", "'", "a", "'_", ":_", "5_", ",_", "'", "b", "'_", ":_", "3_", ",_", "'", "c", "'_", ":_", "1_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "df", "\\u", "file_", "=_", "io_", "._", "String", "IO_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "freq", "\\u", "tools_", "._", "write", "\\u", "df_", "(_", "df", "\\u", "dict_", ",_", "df", "\\u", "file_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "df", "\\u", "file_", "._", "seek_", "(_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "freq", "\\u", "tools_", "._", "read", "\\u", "df_", "(_", "df", "\\u", "file_", ")_", ",_", "df", "\\u", "dict_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Freq", "Tool", "s", "Test_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "compute", "\\u", "df_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "doc", "1_", "=_", "'", "a", " ", "b", " ", "b", " ", "c", " ", "d", " ", "e", " ", "e", " ", "e", " ", "e", " ", "f", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "doc2", "_", "=_", "'", " ", " ", "b", " ", " ", " ", "e", " ", " ", " ", " ", " ", "g", " ", "g", " ", "g", " ", "h", " ", "i", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "doc", "3_", "=_", "'", " ", " ", "b", " ", "b", " ", "b", " ", "b", " ", "c", " ", "d", " ", " ", " ", " ", " ", "h", " ", " ", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "df", "\\u", "dict_", "=_", "{_", "'", "a", "'_", ":_", "1_", ",_", "'", "b", "'_", ":_", "3_", ",_", "'", "c", "'_", ":_", "2_", ",_", "'", "d", "'_", ":_", "2_", ",_", "'", "e", "'_", ":_", "2_", ",_", "'", "f", "'_", ":_", "1_", ",_", "'", "g", "'_", ":_", "1_", ",_", "'", "h", "'_", ":_", "2_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "i", "'_", ":_", "1_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "files_", "=_", "(_", "io_", "._", "String", "IO_", "(_", "doc", "1_", ")_", ",_", "io_", "._", "String", "IO_", "(_", "doc2", "_", ")_", ",_", "io_", "._", "String", "IO_", "(_", "doc", "3_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "freq", "\\u", "tools_", "._", "compute", "\\u", "df_", "(_", "files_", ")_", ",_", "df", "\\u", "dict_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused local variable
uskudnik/amazon-glacier-cmd-interface/glacier/GlacierWrapper.py
[ { "content": " @glacier_connect\n @log_class_call(\"Processing archive retrieval job.\",\n \"Archive retrieval job response received.\")\n def getarchive(self, vault_name, archive_id):\n \"\"\"\n Requests Amazon Glacier to make archive available for download.\n\n If retrieval job is not yet initiated:\n\n - initiate a job,\n - return tuple (\"initiated\", job, None)\n\n If retrieval job is already initiated:\n\n - return tuple (\"running\", job, None).\n\n If the file is ready for download:\n\n - return tuple (\"ready\", job, jobId).\n\n :param vault: Vault name from where we want to retrieve the archive.\n :type vault: str\n :param archive: ArchiveID of archive to be retrieved.\n :type archive: str\n\n :returns: Tuple of (status, job, JobId)\n\n TODO: Return example\n\n :rtype: (str, dict, str)\n :raises: :py:exc:`glacier.glacierexception.ResponseException`\n \"\"\"\n\n results = None\n self._check_vault_name(vault_name)\n self._check_id(archive_id, 'ArchiveId')\n\n # Check whether we have a retrieval job for the archive.\n job_list = self.list_jobs(vault_name)\n for job in job_list:\n if job['ArchiveId'] == archive_id:\n if job['Completed']:\n return ('ready', job, job['JobId'])\n\n return ('running', job, None)\n\n # No job found related to this archive, start a new job.\n job_data = {'ArchiveId': archive_id,\n 'Type': 'archive-retrieval'}\n try:\n response = self.glacierconn.initiate_job(vault_name, job_data)\n except boto.glacier.exceptions.UnexpectedHTTPResponseError as e:\n raise ResponseException(\n 'Failed to initiate an archive retrieval job for archive %s in vault %s.'% (archive_id, vault_name),\n cause=self._decode_error_message(e.body),\n code=e.code)\n\n job = response.copy()\n return ('initiated', job, None)", "metadata": "root.GlacierWrapper.getarchive", "header": "['class', 'GlacierWrapper', '(', 'object', ')', ':', '___EOS___']", "index": 1240 }, { "content": " @glacier_connect\n @sdb_connect\n @log_class_call(\"Download an archive.\",\n \"Download archive done.\")\n def download(self, vault_name, archive_id, part_size,\n out_file_name=None, overwrite=False):\n \"\"\"\n Download a file from Glacier, and store it in out_file.\n If no out_file is given, the file will be dumped on stdout.\n \"\"\"\n\n # Sanity checking on the input.\n self._check_vault_name(vault_name)\n self._check_id(archive_id, 'ArchiveId')\n\n # Check whether the requested file is available from Amazon Glacier.\n job_list = self.list_jobs(vault_name)\n job_id = None\n for job in job_list:\n if job['ArchiveId'] == archive_id:\n download_job = job\n if not job['Completed']:\n raise CommunicationException(\n \"Archive retrieval request not completed yet. Please try again later.\",\n code='NotReady')\n self.logger.debug('Archive retrieval completed; archive is available for download now.')\n break\n\n else:\n raise InputException(\n \"Requested archive not available. Please make sure \\\nyour archive ID is correct, and start a retrieval job using \\\n'getarchive' if necessary.\",\n code='IdError')\n\n # Check whether we can access the file the archive has to be written to.\n out_file = None\n if out_file_name:\n if os.path.isfile(out_file_name) and not overwrite:\n raise InputException(\n \"File exists already, aborting. Use the overwrite flag to overwrite existing file.\",\n code=\"FileError\")\n try:\n out_file = open(out_file_name, 'w')\n except IOError as e:\n raise InputException(\n \"Cannot access the ouput file.\",\n cause=e,\n code='FileError')\n\n # Sanity checking done; start downloading the file, part by part.\n total_size = download_job['ArchiveSizeInBytes']\n part_size_in_bytes = self._check_part_size(part_size, total_size) * 1024 * 1024\n start_bytes = downloaded_size = 0\n hash_list = []\n start_time = current_time = previous_time = time.time()\n\n # Log our pending action.\n if out_file:\n self.logger.debug('Starting download of archive to file %s.'% out_file_name)\n else:\n self.logger.debug('Starting download of archive to stdout.')\n\n # Download the data, one part at a time.\n while downloaded_size < total_size:\n\n # Read a part of data.\n from_bytes = downloaded_size\n to_bytes = min(downloaded_size + part_size_in_bytes, total_size)\n try:\n response = self.glacierconn.get_job_output(vault_name,\n download_job['JobId'],\n byte_range=(from_bytes, to_bytes-1))\n data = response.read()\n except boto.glacier.exceptions.UnexpectedHTTPResponseError as e:\n raise ResponseException(\n 'Failed to download archive %s.'% archive_id,\n cause=self._decode_error_message(e.body),\n code=e.code)\n\n hash_list.append(glaciercorecalls.chunk_hashes(data)[0])\n downloaded_size = to_bytes\n if out_file:\n try:\n out_file.write(response.read())\n except IOError as e:\n raise InputException(\n \"Cannot write data to the specified file.\",\n cause=e,\n code='FileError')\n else:\n sys.stdout.write(response.read())\n sys.stdout.flush()\n\n # Calculate progress statistics.\n current_time = time.time()\n overall_rate = int((downloaded_size-start_bytes)/(current_time - start_time))\n current_rate = int(part_size_in_bytes/(current_time - previous_time))\n\n # Estimate finish time, based on overall transfer rate.\n time_left = (total_size - downloaded_size)/overall_rate\n eta_seconds = current_time + time_left\n if datetime.fromtimestamp(eta_seconds).day is not\\\n datetime.now().day:\n eta_template = \"%a, %d %b, %H:%M:%S\"\n else:\n eta_template = \"%H:%M:%S\"\n\n eta = time.strftime(eta_template, time.localtime(eta_seconds))\n msg = 'Read %s of %s (%s%%). Rate %s/s, average %s/s, ETA %s.' \\\n % (self._size_fmt(downloaded_size),\n self._size_fmt(total_size),\n self._bold(str(int(100 * downloaded_size/total_size))),\n self._size_fmt(current_rate, 2),\n self._size_fmt(overall_rate, 2),\n eta)\n self._progress(msg)\n previous_time = current_time\n self.logger.debug(msg)\n\n if out_file:\n out_file.close()\n if glaciercorecalls.bytes_to_hex(glaciercorecalls.tree_hash(hash_list)) != download_job['SHA256TreeHash']:\n raise CommunicationException(\n \"Downloaded data hash mismatch\",\n code=\"DownloadError\",\n cause=None)\n\n self.logger.debug('Download of archive finished successfully.')\n current_time = time.time()\n overall_rate = int(downloaded_size/(current_time - start_time))\n msg = 'Wrote %s. Rate %s/s.\\n' % (self._size_fmt(downloaded_size),\n self._size_fmt(overall_rate, 2))\n self._progress(msg)\n self.logger.info(msg)", "metadata": "root.GlacierWrapper.download", "header": "['class', 'GlacierWrapper', '(', 'object', ')', ':', '___EOS___']", "index": 1300 }, { "content": " @glacier_connect\n @sns_connect\n def sns_subscribe(self, protocol, endpoint, topic, sns_options, vault_names=None):\n all_topics = self.sns_conn.get_all_topics()['ListTopicsResponse']['ListTopicsResult']['Topics']\n\n topic_arn = self.sns_conn.create_topic(topic)['CreateTopicResponse']['CreateTopicResult']['TopicArn']\n\n\n if vault_names:\n vaults = vault_names.split(\",\")\n self._init_events_for_vaults(vaults, topic_arn)\n \n topic_arns = [topic_arn]\n\n if len(topic_arns):\n try:\n results = []\n for arn in topic_arns:\n result = self.sns_conn.subscribe(arn, protocol, endpoint)['SubscribeResponse']\n results += [{'SubscribeResult': result['SubscribeResult']['SubscriptionArn'],\n 'RequestId': result['ResponseMetadata']['RequestId']}]\n return results\n except boto.exception.BotoServerError as e:\n raise ResponseException(\"Failed to subscribe to notifications for vault %s.\" % vault_name,\n cause=self._decode_error_message(e.body),\n code=e.code)\n else:\n raise Exception(\"No vaults matching that name found.\")", "metadata": "root.GlacierWrapper.sns_subscribe", "header": "['class', 'GlacierWrapper', '(', 'object', ')', ':', '___EOS___']", "index": 1841 } ]
[ { "span": "results ", "start_line": 1273, "start_column": 8, "end_line": 1273, "end_column": 15 }, { "span": "job_id ", "start_line": 1317, "start_column": 8, "end_line": 1317, "end_column": 14 }, { "span": "all_topics ", "start_line": 1844, "start_column": 8, "end_line": 1844, "end_column": 18 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "Gla", "cier", "Wrapper_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "gla", "cier", "\\u", "connect_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "log", "\\u", "class", "\\u", "call_", "(_", "\"", "Process", "ing", " ", "archive", " ", "retrie", "val", " ", "job", ".\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Archive", " ", "retrie", "val", " ", "job", " ", "response", " ", "receive", "d", ".\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "geta", "rchi", "ve_", "(_", "self_", ",_", "vau", "lt", "\\u", "name_", ",_", "archive", "\\u", "id_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Request", "s", " ", "Ama", "zon", " ", "Gla", "cier", " ", "to", " ", "make", " ", "archive", " ", "avail", "able", " ", "for", " ", "download", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "If", " ", "retrie", "val", " ", "job", " ", "is", " ", "not", " ", "ye", "t", " ", "initiate", "d", ":", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "-", " ", "initiate", " ", "a", " ", "job", ",", "\\", "10", ";", " ", " ", " ", " ", "-", " ", "return", " ", "tuple", " ", "(\"", "initiate", "d", "\",", " ", "job", ",", " ", "Non", "e", ")", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "If", " ", "retrie", "val", " ", "job", " ", "is", " ", "alr", "ead", "y", " ", "initiate", "d", ":", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "-", " ", "return", " ", "tuple", " ", "(\"", "runn", "ing", "\",", " ", "job", ",", " ", "Non", "e", ").", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "If", " ", "the", " ", "file", " ", "is", " ", "read", "y", " ", "for", " ", "download", ":", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "-", " ", "return", " ", "tuple", " ", "(\"", "read", "y", "\",", " ", "job", ",", " ", "job", "Id", ").", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "vau", "lt", ":", " ", "Va", "ult", " ", "name", " ", "from", " ", "where", " ", "we", " ", "want", " ", "to", " ", "retrieve", " ", "the", " ", "archive", ".", "\\", "10", ";", " ", " ", " ", " ", ":", "type", " ", "vau", "lt", ":", " ", "str", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "archive", ":", " ", "Archive", "ID", " ", "of", " ", "archive", " ", "to", " ", "be", " ", "retrieved", ".", "\\", "10", ";", " ", " ", " ", " ", ":", "type", " ", "archive", ":", " ", "str", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "return", "s", ":", " ", "Tup", "le", " ", "of", " ", "(", "status", ",", " ", "job", ",", " ", "Jo", "b", "Id", ")", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "TOD", "O", ":", " ", "Return", " ", "example", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "rty", "pe", ":", " ", "(", "str", ",", " ", "dict", ",", " ", "str", ")", "\\", "10", ";", " ", " ", " ", " ", ":", "raise", "s", ":", " ", ":", "py", ":", "exc", ":`", "gla", "cier", ".", "gla", "cier", "exception", ".", "Respons", "e", "Except", "ion", "`", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "results_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "check", "\\u", "vau", "lt", "\\u", "name_", "(_", "vau", "lt", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "check", "\\u", "id_", "(_", "archive", "\\u", "id_", ",_", "'", "Archive", "Id", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Check", " ", "whe", "ther", " ", "we", " ", "have", " ", "a", " ", "retrie", "val", " ", "job", " ", "for", " ", "the", " ", "archive", "._", "\\u\\u\\uNL\\u\\u\\u_", "job", "\\u", "list_", "=_", "self_", "._", "list", "\\u", "jobs_", "(_", "vau", "lt", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "job_", "in_", "job", "\\u", "list_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "job_", "[_", "'", "Archive", "Id", "'_", "]_", "==_", "archive", "\\u", "id_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "job_", "[_", "'", "Complete", "d", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "return_", "(_", "'", "read", "y", "'_", ",_", "job_", ",_", "job_", "[_", "'", "Jo", "b", "Id", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "(_", "'", "runn", "ing", "'_", ",_", "job_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "No", " ", "job", " ", "found", " ", "relate", "d", " ", "to", " ", "this", " ", "archive", ",", " ", "start", " ", "a", " ", "new", " ", "job", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "job", "\\u", "data_", "=_", "{_", "'", "Archive", "Id", "'_", ":_", "archive", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Type", "'_", ":_", "'", "archive", "-", "retrie", "val", "'_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "response_", "=_", "self_", "._", "gla", "cier", "conn_", "._", "initiate", "\\u", "job_", "(_", "vau", "lt", "\\u", "name_", ",_", "job", "\\u", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "boto_", "._", "gla", "cier", "_", "._", "exceptions_", "._", "Une", "xpe", "cte", "d", "HTTP", "Respons", "e", "Error_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Respons", "e", "Exception_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Fail", "ed", " ", "to", " ", "initiate", " ", "an", " ", "archive", " ", "retrie", "val", " ", "job", " ", "for", " ", "archive", " ", "%", "s", " ", "in", " ", "vau", "lt", " ", "%", "s", ".'_", "%_", "(_", "archive", "\\u", "id_", ",_", "vau", "lt", "\\u", "name_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "cause_", "=_", "self_", "._", "\\u", "decode", "\\u", "error", "\\u", "message_", "(_", "e_", "._", "body_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "code_", "=_", "e_", "._", "code_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "job_", "=_", "response_", "._", "copy_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "(_", "'", "initiate", "d", "'_", ",_", "job_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Gla", "cier", "Wrapper_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "gla", "cier", "\\u", "connect_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "sdb", "\\u", "connect_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "log", "\\u", "class", "\\u", "call_", "(_", "\"", "Down", "load", " ", "an", " ", "archive", ".\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Down", "load", " ", "archive", " ", "don", "e", ".\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "download_", "(_", "self_", ",_", "vau", "lt", "\\u", "name_", ",_", "archive", "\\u", "id_", ",_", "part", "\\u", "size_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "out", "\\u", "file", "\\u", "name_", "=_", "None_", ",_", "overwrite_", "=_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Down", "load", " ", "a", " ", "file", " ", "from", " ", "Gla", "cier", ",", " ", "and", " ", "store", " ", "it", " ", "in", " ", "out", "\\u", "file", ".", "\\", "10", ";", " ", " ", " ", " ", "If", " ", "no", " ", "out", "\\u", "file", " ", "is", " ", "give", "n", ",", " ", "the", " ", "file", " ", "will", " ", "be", " ", "dumped", " ", "on", " ", "stdout", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Sanit", "y", " ", "checking", " ", "on", " ", "the", " ", "input", "._", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "check", "\\u", "vau", "lt", "\\u", "name_", "(_", "vau", "lt", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "check", "\\u", "id_", "(_", "archive", "\\u", "id_", ",_", "'", "Archive", "Id", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Check", " ", "whe", "ther", " ", "the", " ", "request", "ed", " ", "file", " ", "is", " ", "avail", "able", " ", "from", " ", "Ama", "zon", " ", "Gla", "cier", "._", "\\u\\u\\uNL\\u\\u\\u_", "job", "\\u", "list_", "=_", "self_", "._", "list", "\\u", "jobs_", "(_", "vau", "lt", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "job", "\\u", "id_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "job_", "in_", "job", "\\u", "list_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "job_", "[_", "'", "Archive", "Id", "'_", "]_", "==_", "archive", "\\u", "id_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "download", "\\u", "job_", "=_", "job_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "job_", "[_", "'", "Complete", "d", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "raise_", "Communication", "Exception_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Archive", " ", "retrie", "val", " ", "request", " ", "not", " ", "complete", "d", " ", "ye", "t", ".", " ", "Ple", "ase", " ", "try", " ", "again", " ", "late", "r", ".\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "code_", "=_", "'", "Not", "Read", "y", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "logger_", "._", "debug_", "(_", "'", "Archive", " ", "retrie", "val", " ", "complete", "d", ";", " ", "archive", " ", "is", " ", "avail", "able", " ", "for", " ", "download", " ", "now", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Inp", "ut", "Exception_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Requeste", "d", " ", "archive", " ", "not", " ", "avail", "able", ".", " ", "Ple", "ase", " ", "make", " ", "sure", " ", "\\\\", "\\", "10", ";", "your", " ", "archive", " ", "ID", " ", "is", " ", "correct", ",", " ", "and", " ", "start", " ", "a", " ", "retrie", "val", " ", "job", " ", "usi", "ng", " ", "\\\\", "\\", "10", ";'", "geta", "rchi", "ve", "'", " ", "if", " ", "necessar", "y", ".\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "code_", "=_", "'", "Id", "Error", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Check", " ", "whe", "ther", " ", "we", " ", "can", " ", "access", " ", "the", " ", "file", " ", "the", " ", "archive", " ", "has", " ", "to", " ", "be", " ", "writt", "en", " ", "to", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "out", "\\u", "file_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "out", "\\u", "file", "\\u", "name_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "os_", "._", "path_", "._", "isfile_", "(_", "out", "\\u", "file", "\\u", "name_", ")_", "and_", "not_", "overwrite_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Inp", "ut", "Exception_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "File", " ", "exist", "s", " ", "alr", "ead", "y", ",", " ", "abort", "ing", ".", " ", "Us", "e", " ", "the", " ", "overwrit", "e", " ", "flag", " ", "to", " ", "overwrit", "e", " ", "exist", "ing", " ", "file", ".\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "code_", "=_", "\"", "File", "Error", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "out", "\\u", "file_", "=_", "open_", "(_", "out", "\\u", "file", "\\u", "name_", ",_", "'", "w", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "IO", "Error_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Inp", "ut", "Exception_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Cann", "ot", " ", "access", " ", "the", " ", "oup", "ut", " ", "file", ".\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "cause_", "=_", "e_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "code_", "=_", "'", "File", "Error", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Sanit", "y", " ", "checking", " ", "don", "e", ";", " ", "start", " ", "download", "ing", " ", "the", " ", "file", ",", " ", "part", " ", "by", " ", "part", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "total", "\\u", "size_", "=_", "download", "\\u", "job_", "[_", "'", "Archive", "Size", "In", "Byte", "s", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "part", "\\u", "size", "\\u", "in", "\\u", "bytes_", "=_", "self_", "._", "\\u", "check", "\\u", "part", "\\u", "size_", "(_", "part", "\\u", "size_", ",_", "total", "\\u", "size_", ")_", "*_", "1024_", "*_", "1024_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "start", "\\u", "bytes_", "=_", "downloaded\\u", "size_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "hash", "\\u", "list_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "start", "\\u", "time_", "=_", "current", "\\u", "time_", "=_", "previ", "ous", "\\u", "time_", "=_", "time_", "._", "time_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Log", " ", "our", " ", "pend", "ing", " ", "action", "._", "\\u\\u\\uNL\\u\\u\\u_", "if_", "out", "\\u", "file_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "logger_", "._", "debug_", "(_", "'", "Start", "ing", " ", "download", " ", "of", " ", "archive", " ", "to", " ", "file", " ", "%", "s", ".'_", "%_", "out", "\\u", "file", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "logger_", "._", "debug_", "(_", "'", "Start", "ing", " ", "download", " ", "of", " ", "archive", " ", "to", " ", "stdout", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Down", "load", " ", "the", " ", "data", ",", " ", "one", " ", "part", " ", "at", " ", "a", " ", "time", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "while_", "downloaded\\u", "size_", "<_", "total", "\\u", "size_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Read", " ", "a", " ", "part", " ", "of", " ", "data", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from", "\\u", "bytes_", "=_", "downloaded\\u", "size_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "to", "\\u", "bytes_", "=_", "min_", "(_", "downloaded\\u", "size_", "+_", "part", "\\u", "size", "\\u", "in", "\\u", "bytes_", ",_", "total", "\\u", "size_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "response_", "=_", "self_", "._", "gla", "cier", "conn_", "._", "get", "\\u", "job", "\\u", "output_", "(_", "vau", "lt", "\\u", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "download", "\\u", "job_", "[_", "'", "Jo", "b", "Id", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "byte", "\\u", "range_", "=_", "(_", "from", "\\u", "bytes_", ",_", "to", "\\u", "bytes_", "-_", "1_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data_", "=_", "response_", "._", "read_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "boto_", "._", "gla", "cier", "_", "._", "exceptions_", "._", "Une", "xpe", "cte", "d", "HTTP", "Respons", "e", "Error_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Respons", "e", "Exception_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Fail", "ed", " ", "to", " ", "download", " ", "archive", " ", "%", "s", ".'_", "%_", "archive", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "cause_", "=_", "self_", "._", "\\u", "decode", "\\u", "error", "\\u", "message_", "(_", "e_", "._", "body_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "code_", "=_", "e_", "._", "code_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "hash", "\\u", "list_", "._", "append_", "(_", "gla", "cier", "core", "calls_", "._", "chunk", "\\u", "hashes_", "(_", "data_", ")_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "downloaded\\u", "size_", "=_", "to", "\\u", "bytes_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "out", "\\u", "file_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "out", "\\u", "file_", "._", "write_", "(_", "response_", "._", "read_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "IO", "Error_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "raise_", "Inp", "ut", "Exception_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Cann", "ot", " ", "write", " ", "data", " ", "to", " ", "the", " ", "specified", " ", "file", ".\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "cause_", "=_", "e_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "code_", "=_", "'", "File", "Error", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sys_", "._", "stdout_", "._", "write_", "(_", "response_", "._", "read_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "stdout_", "._", "flush_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Calculat", "e", " ", "progress", " ", "statistic", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "current", "\\u", "time_", "=_", "time_", "._", "time_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "over", "all", "\\u", "rate_", "=_", "int_", "(_", "(_", "downloaded\\u", "size_", "-_", "start", "\\u", "bytes_", ")_", "/_", "(_", "current", "\\u", "time_", "-_", "start", "\\u", "time_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "current", "\\u", "rate_", "=_", "int_", "(_", "part", "\\u", "size", "\\u", "in", "\\u", "bytes_", "/_", "(_", "current", "\\u", "time_", "-_", "previ", "ous", "\\u", "time_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Estimat", "e", " ", "finish", " ", "time", ",", " ", "based", " ", "on", " ", "over", "all", " ", "transfer", " ", "rate", "._", "\\u\\u\\uNL\\u\\u\\u_", "time", "\\u", "left_", "=_", "(_", "total", "\\u", "size_", "-_", "downloaded\\u", "size_", ")_", "/_", "over", "all", "\\u", "rate_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "eta", "\\u", "seconds_", "=_", "current", "\\u", "time_", "+_", "time", "\\u", "left_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "datetime_", "._", "fromtimestamp_", "(_", "eta", "\\u", "seconds_", ")_", "._", "day_", "is_", "not_", "datetime_", "._", "now_", "(_", ")_", "._", "day_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "eta", "\\u", "template_", "=_", "\"%", "a", ",", " ", "%", "d", " ", "%", "b", ",", " ", "%", "H", ":", "%", "M", ":", "%", "S", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "eta", "\\u", "template_", "=_", "\"%", "H", ":", "%", "M", ":", "%", "S", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "eta_", "=_", "time_", "._", "strftime_", "(_", "eta", "\\u", "template_", ",_", "time_", "._", "localtime_", "(_", "eta", "\\u", "seconds_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "msg_", "=_", "'", "Read", " ", "%", "s", " ", "of", " ", "%", "s", " ", "(%", "s", "%%", ").", " ", "Rat", "e", " ", "%", "s", "/", "s", ",", " ", "averag", "e", " ", "%", "s", "/", "s", ",", " ", "ETA", " ", "%", "s", ".'_", "%_", "(_", "self_", "._", "\\u", "size", "\\u", "fmt_", "(_", "downloaded\\u", "size_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "size", "\\u", "fmt_", "(_", "total", "\\u", "size_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "bold_", "(_", "str_", "(_", "int_", "(_", "100_", "*_", "downloaded\\u", "size_", "/_", "total", "\\u", "size_", ")_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "size", "\\u", "fmt_", "(_", "current", "\\u", "rate_", ",_", "2_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "size", "\\u", "fmt_", "(_", "over", "all", "\\u", "rate_", ",_", "2_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "eta_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "progress_", "(_", "msg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "previ", "ous", "\\u", "time_", "=_", "current", "\\u", "time_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "logger_", "._", "debug_", "(_", "msg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "out", "\\u", "file_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "out", "\\u", "file_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "gla", "cier", "core", "calls_", "._", "bytes", "\\u", "to", "\\u", "hex_", "(_", "gla", "cier", "core", "calls_", "._", "tree", "\\u", "hash_", "(_", "hash", "\\u", "list_", ")_", ")_", "!=_", "download", "\\u", "job_", "[_", "'", "SHA", "256", "Tree", "Hash", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Communication", "Exception_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Downloade", "d", " ", "data", " ", "hash", " ", "mism", "atch", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "code_", "=_", "\"", "Down", "load", "Error", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "cause_", "=_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "logger_", "._", "debug_", "(_", "'", "Down", "load", " ", "of", " ", "archive", " ", "finish", "ed", " ", "success", "full", "y", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "current", "\\u", "time_", "=_", "time_", "._", "time_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "over", "all", "\\u", "rate_", "=_", "int_", "(_", "downloaded\\u", "size_", "/_", "(_", "current", "\\u", "time_", "-_", "start", "\\u", "time_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "msg_", "=_", "'", "Wro", "te", " ", "%", "s", ".", " ", "Rat", "e", " ", "%", "s", "/", "s", ".\\\\", "n", "'_", "%_", "(_", "self_", "._", "\\u", "size", "\\u", "fmt_", "(_", "downloaded\\u", "size_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "size", "\\u", "fmt_", "(_", "over", "all", "\\u", "rate_", ",_", "2_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "progress_", "(_", "msg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "logger_", "._", "info_", "(_", "msg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Gla", "cier", "Wrapper_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "gla", "cier", "\\u", "connect_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "sns", "\\u", "connect_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "sns", "\\u", "subscribe_", "(_", "self_", ",_", "protocol_", ",_", "endpoint_", ",_", "topic_", ",_", "sns", "\\u", "options_", ",_", "vau", "lt", "\\u", "names_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "all", "\\u", "topics_", "=_", "self_", "._", "sns", "\\u", "conn_", "._", "get", "\\u", "all", "\\u", "topics_", "(_", ")_", "[_", "'", "List", "Topic", "s", "Respons", "e", "'_", "]_", "[_", "'", "List", "Topic", "s", "Result", "'_", "]_", "[_", "'", "Topic", "s", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "topic", "\\u", "arn_", "=_", "self_", "._", "sns", "\\u", "conn_", "._", "create", "\\u", "topic_", "(_", "topic_", ")_", "[_", "'", "Creat", "e", "Topic", "Respons", "e", "'_", "]_", "[_", "'", "Creat", "e", "Topic", "Result", "'_", "]_", "[_", "'", "Topic", "Arn", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "vau", "lt", "\\u", "names_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "vau", "lts", "_", "=_", "vau", "lt", "\\u", "names_", "._", "split_", "(_", "\",\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "init", "\\u", "events", "\\u", "for", "\\u", "vau", "lts", "_", "(_", "vau", "lts", "_", ",_", "topic", "\\u", "arn_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "topic", "\\u", "arn", "s_", "=_", "[_", "topic", "\\u", "arn_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "len_", "(_", "topic", "\\u", "arn", "s_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "results_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "arn_", "in_", "topic", "\\u", "arn", "s_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "result_", "=_", "self_", "._", "sns", "\\u", "conn_", "._", "subscribe_", "(_", "arn_", ",_", "protocol_", ",_", "endpoint_", ")_", "[_", "'", "Subscrib", "e", "Respons", "e", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "results_", "+=_", "[_", "{_", "'", "Subscrib", "e", "Result", "'_", ":_", "result_", "[_", "'", "Subscrib", "e", "Result", "'_", "]_", "[_", "'", "Subscription", "Arn", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Request", "Id", "'_", ":_", "result_", "[_", "'", "Respons", "e", "Meta", "data", "'_", "]_", "[_", "'", "Request", "Id", "'_", "]_", "}_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "results_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "boto_", "._", "exception_", "._", "Bot", "o", "Server", "Error_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Respons", "e", "Exception_", "(_", "\"", "Fail", "ed", " ", "to", " ", "subscribe", " ", "to", " ", "notification", "s", " ", "for", " ", "vau", "lt", " ", "%", "s", ".\"_", "%_", "vau", "lt", "\\u", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "cause_", "=_", "self_", "._", "\\u", "decode", "\\u", "error", "\\u", "message_", "(_", "e_", "._", "body_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "code_", "=_", "e_", "._", "code_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Exception_", "(_", "\"", "No", " ", "vau", "lts", " ", "matchi", "ng", " ", "tha", "t", " ", "name", " ", "found", ".\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
kayhayen/Nuitka/nuitka/build/inline_copy/lib/scons-2.3.2/SCons/Tool/packaging/rpm.py
[ { "content": "\"\"\"SCons.Tool.Packaging.rpm\n\nThe rpm packager.\n\"\"\"\n\n#\n# Copyright (c) 2001 - 2014 The SCons Foundation\n#\n# Permission is hereby granted, free of charge, to any person obtaining\n# a copy of this software and associated documentation files (the\n# \"Software\"), to deal in the Software without restriction, including\n# without limitation the rights to use, copy, modify, merge, publish,\n# distribute, sublicense, and/or sell copies of the Software, and to\n# permit persons to whom the Software is furnished to do so, subject to\n# the following conditions:\n#\n# The above copyright notice and this permission notice shall be included\n# in all copies or substantial portions of the Software.\n#\n# THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY\n# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE\n# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\n# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE\n# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\n# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION\n# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n__revision__ = \"src/engine/SCons/Tool/packaging/rpm.py 2014/07/05 09:42:21 garyo\"\n\nimport os\n\nimport SCons.Builder\nimport SCons.Tool.rpmutils\n\nfrom SCons.Environment import OverrideEnvironment\nfrom SCons.Tool.packaging import stripinstallbuilder, src_targz\nfrom SCons.Errors import UserError\n\n\n\n\n\n\n#\n# mandatory and optional package tag section\n#\n\n\n#\n# mandatory and optional file tags\n#\n\n\n# Local Variables:\n# tab-width:4\n# indent-tabs-mode:nil\n# End:\n# vim: set expandtab tabstop=4 shiftwidth=4:\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def package(env, target, source, PACKAGEROOT, NAME, VERSION,\n PACKAGEVERSION, DESCRIPTION, SUMMARY, X_RPM_GROUP, LICENSE,\n **kw):\n # initialize the rpm tool\n SCons.Tool.Tool('rpm').generate(env)\n\n bld = env['BUILDERS']['Rpm']\n\n # Generate a UserError whenever the target name has been set explicitly,\n # since rpm does not allow for controlling it. This is detected by\n # checking if the target has been set to the default by the Package()\n # Environment function.\n if str(target[0])!=\"%s-%s\"%(NAME, VERSION):\n raise UserError( \"Setting target is not supported for rpm.\" )\n else:\n # This should be overridable from the construction environment,\n # which it is by using ARCHITECTURE=.\n buildarchitecture = SCons.Tool.rpmutils.defaultMachine()\n\n if 'ARCHITECTURE' in kw:\n buildarchitecture = kw['ARCHITECTURE']\n\n fmt = '%s-%s-%s.%s.rpm'\n srcrpm = fmt % (NAME, VERSION, PACKAGEVERSION, 'src')\n binrpm = fmt % (NAME, VERSION, PACKAGEVERSION, buildarchitecture)\n\n target = [ srcrpm, binrpm ]\n\n # get the correct arguments into the kw hash\n loc=locals()\n del loc['kw']\n kw.update(loc)\n del kw['source'], kw['target'], kw['env']\n\n # if no \"SOURCE_URL\" tag is given add a default one.\n if 'SOURCE_URL' not in kw:\n #kw['SOURCE_URL']=(str(target[0])+\".tar.gz\").replace('.rpm', '')\n kw['SOURCE_URL']=(str(target[0])+\".tar.gz\").replace('.rpm', '')\n\n # mangle the source and target list for the rpmbuild\n env = OverrideEnvironment(env, kw)\n target, source = stripinstallbuilder(target, source, env)\n target, source = addspecfile(target, source, env)\n target, source = collectintargz(target, source, env)\n\n # now call the rpm builder to actually build the packet.\n return bld(env, target, source, **kw)", "metadata": "root.package", "header": "['module', '___EOS___']", "index": 38 }, { "content": "def collectintargz(target, source, env):\n \"\"\" Puts all source files into a tar.gz file. \"\"\"\n # the rpm tool depends on a source package, until this is chagned\n # this hack needs to be here that tries to pack all sources in.\n sources = env.FindSourceFiles()\n\n # filter out the target we are building the source list for.\n #sources = [s for s in sources if not (s in target)]\n sources = [s for s in sources if s not in target]\n\n # find the .spec file for rpm and add it since it is not necessarily found\n # by the FindSourceFiles function.\n #sources.extend( [s for s in source if str(s).rfind('.spec')!=-1] )\n spec_file = lambda s: str(s).rfind('.spec') != -1\n sources.extend( list(filter(spec_file, source)) )\n\n # as the source contains the url of the source package this rpm package\n # is built from, we extract the target name\n #tarball = (str(target[0])+\".tar.gz\").replace('.rpm', '')\n tarball = (str(target[0])+\".tar.gz\").replace('.rpm', '')\n try:\n #tarball = env['SOURCE_URL'].split('/')[-1]\n tarball = env['SOURCE_URL'].split('/')[-1]\n except KeyError, e:\n raise SCons.Errors.UserError( \"Missing PackageTag '%s' for RPM packager\" % e.args[0] )\n\n tarball = src_targz.package(env, source=sources, target=tarball,\n PACKAGEROOT=env['PACKAGEROOT'], )\n\n return (target, tarball)", "metadata": "root.collectintargz", "header": "['module', '___EOS___']", "index": 86 }, { "content": "def addspecfile(target, source, env):\n specfile = \"%s-%s\" % (env['NAME'], env['VERSION'])\n\n bld = SCons.Builder.Builder(action = build_specfile,\n suffix = '.spec',\n target_factory = SCons.Node.FS.File)\n\n source.extend(bld(env, specfile, source))\n\n return (target,source)", "metadata": "root.addspecfile", "header": "['module', '___EOS___']", "index": 117 }, { "content": "def build_specfile(target, source, env):\n \"\"\" Builds a RPM specfile from a dictionary with string metadata and\n by analyzing a tree of nodes.\n \"\"\"\n file = open(target[0].abspath, 'w')\n str = \"\"\n\n try:\n file.write( build_specfile_header(env) )\n file.write( build_specfile_sections(env) )\n file.write( build_specfile_filesection(env, source) )\n file.close()\n\n # call a user specified function\n if 'CHANGE_SPECFILE' in env:\n env['CHANGE_SPECFILE'](target, source)\n\n except KeyError, e:\n raise SCons.Errors.UserError( '\"%s\" package field for RPM is missing.' % e.args[0] )", "metadata": "root.build_specfile", "header": "['module', '___EOS___']", "index": 128 }, { "content": "def build_specfile_sections(spec):\n \"\"\" Builds the sections of a rpm specfile.\n \"\"\"\n str = \"\"\n\n mandatory_sections = {\n 'DESCRIPTION' : '\\n%%description\\n%s\\n\\n', }\n\n str = str + SimpleTagCompiler(mandatory_sections).compile( spec )\n\n optional_sections = {\n 'DESCRIPTION_' : '%%description -l %s\\n%s\\n\\n',\n 'CHANGELOG' : '%%changelog\\n%s\\n\\n',\n 'X_RPM_PREINSTALL' : '%%pre\\n%s\\n\\n',\n 'X_RPM_POSTINSTALL' : '%%post\\n%s\\n\\n',\n 'X_RPM_PREUNINSTALL' : '%%preun\\n%s\\n\\n',\n 'X_RPM_POSTUNINSTALL' : '%%postun\\n%s\\n\\n',\n 'X_RPM_VERIFY' : '%%verify\\n%s\\n\\n',\n\n # These are for internal use but could possibly be overriden\n 'X_RPM_PREP' : '%%prep\\n%s\\n\\n',\n 'X_RPM_BUILD' : '%%build\\n%s\\n\\n',\n 'X_RPM_INSTALL' : '%%install\\n%s\\n\\n',\n 'X_RPM_CLEAN' : '%%clean\\n%s\\n\\n',\n }\n\n # Default prep, build, install and clean rules\n # TODO: optimize those build steps, to not compile the project a second time\n if 'X_RPM_PREP' not in spec:\n spec['X_RPM_PREP'] = '[ -n \"$RPM_BUILD_ROOT\" -a \"$RPM_BUILD_ROOT\" != / ] && rm -rf \"$RPM_BUILD_ROOT\"' + '\\n%setup -q'\n\n if 'X_RPM_BUILD' not in spec:\n spec['X_RPM_BUILD'] = 'mkdir \"$RPM_BUILD_ROOT\"'\n\n if 'X_RPM_INSTALL' not in spec:\n spec['X_RPM_INSTALL'] = 'scons --install-sandbox=\"$RPM_BUILD_ROOT\" \"$RPM_BUILD_ROOT\"'\n\n if 'X_RPM_CLEAN' not in spec:\n spec['X_RPM_CLEAN'] = '[ -n \"$RPM_BUILD_ROOT\" -a \"$RPM_BUILD_ROOT\" != / ] && rm -rf \"$RPM_BUILD_ROOT\"'\n\n str = str + SimpleTagCompiler(optional_sections, mandatory=0).compile( spec )\n\n return str", "metadata": "root.build_specfile_sections", "header": "['module', '___EOS___']", "index": 152 }, { "content": "def build_specfile_header(spec):\n \"\"\" Builds all section but the %file of a rpm specfile\n \"\"\"\n str = \"\"\n\n # first the mandatory sections\n mandatory_header_fields = {\n 'NAME' : '%%define name %s\\nName: %%{name}\\n',\n 'VERSION' : '%%define version %s\\nVersion: %%{version}\\n',\n 'PACKAGEVERSION' : '%%define release %s\\nRelease: %%{release}\\n',\n 'X_RPM_GROUP' : 'Group: %s\\n',\n 'SUMMARY' : 'Summary: %s\\n',\n 'LICENSE' : 'License: %s\\n', }\n\n str = str + SimpleTagCompiler(mandatory_header_fields).compile( spec )\n\n # now the optional tags\n optional_header_fields = {\n 'VENDOR' : 'Vendor: %s\\n',\n 'X_RPM_URL' : 'Url: %s\\n',\n 'SOURCE_URL' : 'Source: %s\\n',\n 'SUMMARY_' : 'Summary(%s): %s\\n',\n 'X_RPM_DISTRIBUTION' : 'Distribution: %s\\n',\n 'X_RPM_ICON' : 'Icon: %s\\n',\n 'X_RPM_PACKAGER' : 'Packager: %s\\n',\n 'X_RPM_GROUP_' : 'Group(%s): %s\\n',\n\n 'X_RPM_REQUIRES' : 'Requires: %s\\n',\n 'X_RPM_PROVIDES' : 'Provides: %s\\n',\n 'X_RPM_CONFLICTS' : 'Conflicts: %s\\n',\n 'X_RPM_BUILDREQUIRES' : 'BuildRequires: %s\\n',\n\n 'X_RPM_SERIAL' : 'Serial: %s\\n',\n 'X_RPM_EPOCH' : 'Epoch: %s\\n',\n 'X_RPM_AUTOREQPROV' : 'AutoReqProv: %s\\n',\n 'X_RPM_EXCLUDEARCH' : 'ExcludeArch: %s\\n',\n 'X_RPM_EXCLUSIVEARCH' : 'ExclusiveArch: %s\\n',\n 'X_RPM_PREFIX' : 'Prefix: %s\\n',\n 'X_RPM_CONFLICTS' : 'Conflicts: %s\\n',\n\n # internal use\n 'X_RPM_BUILDROOT' : 'BuildRoot: %s\\n', }\n\n # fill in default values:\n # Adding a BuildRequires renders the .rpm unbuildable under System, which\n # are not managed by rpm, since the database to resolve this dependency is\n # missing (take Gentoo as an example)\n# if not s.has_key('x_rpm_BuildRequires'):\n# s['x_rpm_BuildRequires'] = 'scons'\n\n if 'X_RPM_BUILDROOT' not in spec:\n spec['X_RPM_BUILDROOT'] = '%{_tmppath}/%{name}-%{version}-%{release}'\n\n str = str + SimpleTagCompiler(optional_header_fields, mandatory=0).compile( spec )\n return str", "metadata": "root.build_specfile_header", "header": "['module', '___EOS___']", "index": 196 }, { "content": "def build_specfile_filesection(spec, files):\n \"\"\" builds the %file section of the specfile\n \"\"\"\n str = '%files\\n'\n\n if 'X_RPM_DEFATTR' not in spec:\n spec['X_RPM_DEFATTR'] = '(-,root,root)'\n\n str = str + '%%defattr %s\\n' % spec['X_RPM_DEFATTR']\n\n supported_tags = {\n 'PACKAGING_CONFIG' : '%%config %s',\n 'PACKAGING_CONFIG_NOREPLACE' : '%%config(noreplace) %s',\n 'PACKAGING_DOC' : '%%doc %s',\n 'PACKAGING_UNIX_ATTR' : '%%attr %s',\n 'PACKAGING_LANG_' : '%%lang(%s) %s',\n 'PACKAGING_X_RPM_VERIFY' : '%%verify %s',\n 'PACKAGING_X_RPM_DIR' : '%%dir %s',\n 'PACKAGING_X_RPM_DOCDIR' : '%%docdir %s',\n 'PACKAGING_X_RPM_GHOST' : '%%ghost %s', }\n\n for file in files:\n # build the tagset\n tags = {}\n for k in supported_tags.keys():\n try:\n tags[k]=getattr(file, k)\n except AttributeError:\n pass\n\n # compile the tagset\n str = str + SimpleTagCompiler(supported_tags, mandatory=0).compile( tags )\n\n str = str + ' '\n str = str + file.PACKAGING_INSTALL_LOCATION\n str = str + '\\n\\n'\n\n return str", "metadata": "root.build_specfile_filesection", "header": "['module', '___EOS___']", "index": 255 }, { "content": "class SimpleTagCompiler(object):\n \"\"\" This class is a simple string substition utility:\n the replacement specfication is stored in the tagset dictionary, something\n like:\n { \"abc\" : \"cdef %s \",\n \"abc_\" : \"cdef %s %s\" }\n\n the compile function gets a value dictionary, which may look like:\n { \"abc\" : \"ghij\",\n \"abc_gh\" : \"ij\" }\n\n The resulting string will be:\n \"cdef ghij cdef gh ij\"\n \"\"\"\n", "metadata": "root.SimpleTagCompiler", "header": "['module', '___EOS___']", "index": 294 }, { "content": " def __init__(self, tagset, mandatory=1):\n self.tagset = tagset\n self.mandatory = mandatory", "metadata": "root.SimpleTagCompiler.__init__", "header": "['class', 'SimpleTagCompiler', '(', 'object', ')', ':', '___EOS___']", "index": 308 }, { "content": " def compile(self, values):\n \"\"\" compiles the tagset and returns a str containing the result\n \"\"\"\n def is_international(tag):\n #return tag.endswith('_')\n return tag[-1:] == '_'\n\n def get_country_code(tag):\n return tag[-2:]\n\n def strip_country_code(tag):\n return tag[:-2]\n\n replacements = list(self.tagset.items())\n\n str = \"\"\n #domestic = [ (k,v) for k,v in replacements if not is_international(k) ]\n domestic = [t for t in replacements if not is_international(t[0])]\n for key, replacement in domestic:\n try:\n str = str + replacement % values[key]\n except KeyError, e:\n if self.mandatory:\n raise e\n\n #international = [ (k,v) for k,v in replacements if is_international(k) ]\n international = [t for t in replacements if is_international(t[0])]\n for key, replacement in international:\n try:\n #int_values_for_key = [ (get_country_code(k),v) for k,v in values.items() if strip_country_code(k) == key ]\n x = [t for t in values.items() if strip_country_code(t[0]) == key]\n int_values_for_key = [(get_country_code(t[0]),t[1]) for t in x]\n for v in int_values_for_key:\n str = str + replacement % v\n except KeyError, e:\n if self.mandatory:\n raise e\n\n return str", "metadata": "root.SimpleTagCompiler.compile", "header": "['class', 'SimpleTagCompiler', '(', 'object', ')', ':', '___EOS___']", "index": 312 } ]
[ { "span": "import os", "start_line": 29, "start_column": 0, "end_line": 29, "end_column": 9 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\"\"\"", "SC", "ons", ".", "Tool", ".", "Packa", "ging", ".", "rpm", "\\", "10", ";", "\\", "10", ";", "The", " ", "rpm", " ", "package", "r", ".", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Copy", "right", " ", "(", "c", ")", " ", "200", "1", " ", "-", " ", "2014", " ", "The", " ", "SC", "ons", " ", "Foun", "dati", "on_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Permi", "ssion", " ", "is", " ", "here", "by", " ", "grant", "ed", ",", " ", "free", " ", "of", " ", "charge", ",", " ", "to", " ", "any", " ", "person", " ", "obtain", "ing_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "a", " ", "copy", " ", "of", " ", "this", " ", "software", " ", "and", " ", "associate", "d", " ", "documentation", " ", "files", " ", "(", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "\"", "Sof", "twa", "re", "\")", ",", " ", "to", " ", "deal", " ", "in", " ", "the", " ", "Sof", "twa", "re", " ", "with", "out", " ", "restriction", ",", " ", "inclu", "ding_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "with", "out", " ", "limit", "ation", " ", "the", " ", "rights", " ", "to", " ", "use", ",", " ", "copy", ",", " ", "modif", "y", ",", " ", "merge", ",", " ", "publi", "sh", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "distribute", ",", " ", "subli", "cens", "e", ",", " ", "and", "/", "or", " ", "sell", " ", "copie", "s", " ", "of", " ", "the", " ", "Sof", "twa", "re", ",", " ", "and", " ", "to_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "permit", " ", "person", "s", " ", "to", " ", "who", "m", " ", "the", " ", "Sof", "twa", "re", " ", "is", " ", "fur", "nish", "ed", " ", "to", " ", "do", " ", "so", ",", " ", "subject", " ", "to_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "the", " ", "follow", "ing", " ", "condition", "s", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "above", " ", "copyr", "ight", " ", "notice", " ", "and", " ", "this", " ", "permissi", "on", " ", "notice", " ", "sha", "ll", " ", "be", " ", "included_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "in", " ", "all", " ", "copie", "s", " ", "or", " ", "substa", "nti", "al", " ", "porti", "ons", " ", "of", " ", "the", " ", "Sof", "twa", "re", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "THE", " ", "SOFT", "WARE", " ", "IS", " ", "PROVI", "DED", " ", "\"", "AS", " ", "IS", "\",", " ", "WITH", "OUT", " ", "WAR", "RAN", "TY", " ", "OF", " ", "ANY_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "KIND", ",", " ", "EXPR", "ESS", " ", "OR", " ", "IMPL", "IED", ",", " ", "INC", "LU", "DING", " ", "BUT", " ", "NOT", " ", "LIMIT", "ED", " ", "TO", " ", "THE", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "WAR", "RAN", "TIES", " ", "OF", " ", "MER", "CHAN", "TAB", "ILI", "TY", ",", " ", "FIT", "NESS", " ", "FOR", " ", "A", " ", "PARTI", "CUL", "AR", " ", "PUR", "POS", "E", " ", "AND_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "NON", "INF", "RING", "EME", "NT", ".", " ", "IN", " ", "NO", " ", "EVENT", " ", "SHA", "LL", " ", "THE", " ", "AUTHOR", "S", " ", "OR", " ", "COPY", "RIG", "HT", " ", "HOLD", "ERS", " ", "BE_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "LI", "AB", "LE", " ", "FOR", " ", "ANY", " ", "CLA", "IM", ",", " ", "DA", "MAGE", "S", " ", "OR", " ", "OTHER", " ", "LI", "ABI", "LIT", "Y", ",", " ", "WHE", "THER", " ", "IN", " ", "AN", " ", "ACTION_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "OF", " ", "CONTR", "ACT", ",", " ", "TOR", "T", " ", "OR", " ", "OTHER", "WI", "SE", ",", " ", "ARI", "SIN", "G", " ", "FROM", ",", " ", "OUT", " ", "OF", " ", "OR", " ", "IN", " ", "CONNECTION", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "WITH", " ", "THE", " ", "SOFT", "WARE", " ", "OR", " ", "THE", " ", "USE", " ", "OR", " ", "OTHER", " ", "DEA", "LING", "S", " ", "IN", " ", "THE", " ", "SOFT", "WARE", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u", "revision\\u\\u_", "=_", "\"", "src", "/", "eng", "ine", "/", "SC", "ons", "/", "Tool", "/", "packaging", "/", "rpm", ".", "py", " ", " ", "2014", "/", "0", "7", "/", "05", " ", "09", ":", "4", "2", ":", "21", " ", "gar", "yo", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "SC", "ons_", "._", "Builder_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "SC", "ons_", "._", "Tool_", "._", "rpm", "utils_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "SC", "ons_", "._", "Environment_", "import_", "Override", "Environment_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "SC", "ons_", "._", "Tool_", "._", "packaging", "_", "import_", "strip", "install", "builder_", ",_", "src", "\\u", "targ", "z_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "SC", "ons_", "._", "Errors_", "import_", "User", "Error_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "mandat", "ory", " ", "and", " ", "option", "al", " ", "package", " ", "tag", " ", "section_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "mandat", "ory", " ", "and", " ", "option", "al", " ", "file", " ", "tags_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Local", " ", "Varia", "bles", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "tab", "-", "widt", "h", ":", "4_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "indent", "-", "tabs", "-", "mode", ":", "nil_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "End", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "vim", ":", " ", "set", " ", "expand", "tab", " ", "tabs", "top", "=", "4", " ", "shift", "widt", "h", "=", "4", ":_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "package_", "(_", "env_", ",_", "target_", ",_", "source_", ",_", "PACKAG", "ERO", "OT", "_", ",_", "NAME_", ",_", "VERSION_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "PACKAG", "EVE", "RSI", "ON_", ",_", "DESCRIPTION_", ",_", "SUMMARY", "_", ",_", "X", "\\u", "RPM", "\\u", "GROUP_", ",_", "LICENSE", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "**_", "kw_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "initialize", " ", "the", " ", "rpm", " ", "tool_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "SC", "ons_", "._", "Tool_", "._", "Tool_", "(_", "'", "rpm", "'_", ")_", "._", "generate_", "(_", "env_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "bld", "_", "=_", "env_", "[_", "'", "BUILD", "ERS", "'_", "]_", "[_", "'", "Rp", "m", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Generate", " ", "a", " ", "User", "Error", " ", "whe", "neve", "r", " ", "the", " ", "target", " ", "name", " ", "has", " ", "bee", "n", " ", "set", " ", "explicit", "ly", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "sinc", "e", " ", "rpm", " ", "doe", "s", " ", "not", " ", "allow", " ", "for", " ", "controll", "ing", " ", "it", ".", " ", "Thi", "s", " ", "is", " ", "detect", "ed", " ", "by_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "checking", " ", "if", " ", "the", " ", "target", " ", "has", " ", "bee", "n", " ", "set", " ", "to", " ", "the", " ", "default", " ", "by", " ", "the", " ", "Packa", "ge", "()", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Environ", "ment", " ", "function", "._", "\\u\\u\\uNL\\u\\u\\u_", "if_", "str_", "(_", "target_", "[_", "0_", "]_", ")_", "!=_", "\"%", "s", "-%", "s", "\"_", "%_", "(_", "NAME_", ",_", "VERSION_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "User", "Error_", "(_", "\"", "Sett", "ing", " ", "target", " ", "is", " ", "not", " ", "support", "ed", " ", "for", " ", "rpm", ".\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Thi", "s", " ", "shou", "ld", " ", "be", " ", "overrid", "able", " ", "from", " ", "the", " ", "constructi", "on", " ", "environ", "ment", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "whi", "ch", " ", "it", " ", "is", " ", "by", " ", "usi", "ng", " ", "ARCH", "ITE", "CTU", "RE", "=.", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "build", "architecture_", "=_", "SC", "ons_", "._", "Tool_", "._", "rpm", "utils_", "._", "default", "Machine_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "'", "ARCH", "ITE", "CTU", "RE", "'_", "in_", "kw_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "build", "architecture_", "=_", "kw_", "[_", "'", "ARCH", "ITE", "CTU", "RE", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "fmt_", "=_", "'%", "s", "-%", "s", "-%", "s", ".", "%", "s", ".", "rpm", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "src", "rpm_", "=_", "fmt_", "%_", "(_", "NAME_", ",_", "VERSION_", ",_", "PACKAG", "EVE", "RSI", "ON_", ",_", "'", "src", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bin", "rpm_", "=_", "fmt_", "%_", "(_", "NAME_", ",_", "VERSION_", ",_", "PACKAG", "EVE", "RSI", "ON_", ",_", "build", "architecture_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "target_", "=_", "[_", "src", "rpm_", ",_", "bin", "rpm_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "get", " ", "the", " ", "correct", " ", "argu", "ment", "s", " ", "int", "o", " ", "the", " ", "kw", " ", "hash_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "loc_", "=_", "locals_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "del_", "loc_", "[_", "'", "kw", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "kw_", "._", "update_", "(_", "loc_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "del_", "kw_", "[_", "'", "source", "'_", "]_", ",_", "kw_", "[_", "'", "target", "'_", "]_", ",_", "kw_", "[_", "'", "env", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "if", " ", "no", " ", "\"", "SOU", "RC", "E", "\\u", "URL", "\"", " ", "tag", " ", "is", " ", "give", "n", " ", "add", " ", "a", " ", "default", " ", "one", "._", "\\u\\u\\uNL\\u\\u\\u_", "if_", "'", "SOU", "RC", "E", "\\u", "URL", "'_", "not_", "in_", "kw_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "kw", "['", "SOU", "RC", "E", "\\u", "URL", "']", "=(", "str", "(", "target", "[", "0", "])", "+\"", ".", "tar", ".", "gz", "\")", ".", "replace", "('.", "rpm", "',", " ", "''", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "kw_", "[_", "'", "SOU", "RC", "E", "\\u", "URL", "'_", "]_", "=_", "(_", "str_", "(_", "target_", "[_", "0_", "]_", ")_", "+_", "\".", "tar", ".", "gz", "\"_", ")_", "._", "replace_", "(_", "'.", "rpm", "'_", ",_", "''_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "mangle", " ", "the", " ", "source", " ", "and", " ", "target", " ", "list", " ", "for", " ", "the", " ", "rpm", "build_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "env_", "=_", "Override", "Environment_", "(_", "env_", ",_", "kw_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "target_", ",_", "source_", "=_", "strip", "install", "builder_", "(_", "target_", ",_", "source_", ",_", "env_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "target_", ",_", "source_", "=_", "adds", "pec", "file_", "(_", "target_", ",_", "source_", ",_", "env_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "target_", ",_", "source_", "=_", "collecti", "nta", "rg", "z_", "(_", "target_", ",_", "source_", ",_", "env_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "now", " ", "call", " ", "the", " ", "rpm", " ", "builde", "r", " ", "to", " ", "actual", "ly", " ", "build", " ", "the", " ", "packet", "._", "\\u\\u\\uNL\\u\\u\\u_", "return_", "bld", "_", "(_", "env_", ",_", "target_", ",_", "source_", ",_", "**_", "kw_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "collecti", "nta", "rg", "z_", "(_", "target_", ",_", "source_", ",_", "env_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "Put", "s", " ", "all", " ", "source", " ", "files", " ", "int", "o", " ", "a", " ", "tar", ".", "gz", " ", "file", ".", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "the", " ", "rpm", " ", "tool", " ", "depend", "s", " ", "on", " ", "a", " ", "source", " ", "package", ",", " ", "unti", "l", " ", "this", " ", "is", " ", "cha", "gned", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "this", " ", "hack", " ", "need", "s", " ", "to", " ", "be", " ", "here", " ", "tha", "t", " ", "trie", "s", " ", "to", " ", "pack", " ", "all", " ", "source", "s", " ", "in", "._", "\\u\\u\\uNL\\u\\u\\u_", "sources_", "=_", "env_", "._", "Fin", "d", "Sou", "rce", "Files_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "filter", " ", "out", " ", "the", " ", "target", " ", "we", " ", "are", " ", "buildi", "ng", " ", "the", " ", "source", " ", "list", " ", "for", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "source", "s", " ", "=", " ", "[", "s", " ", "for", " ", "s", " ", "in", " ", "source", "s", " ", "if", " ", "not", " ", "(", "s", " ", "in", " ", "target", ")]", "_", "\\u\\u\\uNL\\u\\u\\u_", "sources_", "=_", "[_", "s_", "for_", "s_", "in_", "sources_", "if_", "s_", "not_", "in_", "target_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "find", " ", "the", " ", ".", "spec", " ", "file", " ", "for", " ", "rpm", " ", "and", " ", "add", " ", "it", " ", "sinc", "e", " ", "it", " ", "is", " ", "not", " ", "necessar", "il", "y", " ", "found_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "by", " ", "the", " ", "Fin", "d", "Sou", "rce", "Files", " ", "function", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "source", "s", ".", "extend", "(", " ", "[", "s", " ", "for", " ", "s", " ", "in", " ", "source", " ", "if", " ", "str", "(", "s", ").", "rfi", "nd", "('.", "spec", "')", "!=", "-1", "]", " ", ")_", "\\u\\u\\uNL\\u\\u\\u_", "spec", "\\u", "file_", "=_", "lambda_", "s_", ":_", "str_", "(_", "s_", ")_", "._", "rfind_", "(_", "'.", "spec", "'_", ")_", "!=_", "-_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sources_", "._", "extend_", "(_", "list_", "(_", "filter_", "(_", "spec", "\\u", "file_", ",_", "source_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "as", " ", "the", " ", "source", " ", "contain", "s", " ", "the", " ", "url", " ", "of", " ", "the", " ", "source", " ", "package", " ", "this", " ", "rpm", " ", "package_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "is", " ", "bui", "lt", " ", "from", ",", " ", "we", " ", "extract", " ", "the", " ", "target", " ", "name_", "\\u\\u\\uNL\\u\\u\\u_", "#", "tarball", " ", "=", " ", "(", "str", "(", "target", "[", "0", "])", "+\"", ".", "tar", ".", "gz", "\")", ".", "replace", "('.", "rpm", "',", " ", "''", ")_", "\\u\\u\\uNL\\u\\u\\u_", "tarball", "_", "=_", "(_", "str_", "(_", "target_", "[_", "0_", "]_", ")_", "+_", "\".", "tar", ".", "gz", "\"_", ")_", "._", "replace_", "(_", "'.", "rpm", "'_", ",_", "''_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "tarball", " ", "=", " ", "env", "['", "SOU", "RC", "E", "\\u", "URL", "']", ".", "split", "('", "/'", ")[", "-1", "]_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "tarball", "_", "=_", "env_", "[_", "'", "SOU", "RC", "E", "\\u", "URL", "'_", "]_", "._", "split_", "(_", "'/'_", ")_", "[_", "-_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Key", "Error_", ",_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "SC", "ons_", "._", "Errors_", "._", "User", "Error_", "(_", "\"", "Missing", " ", "Packa", "ge", "Ta", "g", " ", "'%", "s", "'", " ", "for", " ", "RPM", " ", "package", "r", "\"_", "%_", "e_", "._", "args_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "tarball", "_", "=_", "src", "\\u", "targ", "z_", "._", "package_", "(_", "env_", ",_", "source_", "=_", "sources_", ",_", "target_", "=_", "tarball", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "PACKAG", "ERO", "OT", "_", "=_", "env_", "[_", "'", "PACKAG", "ERO", "OT", "'_", "]_", ",_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "(_", "target_", ",_", "tarball", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "adds", "pec", "file_", "(_", "target_", ",_", "source_", ",_", "env_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "specf", "ile_", "=_", "\"%", "s", "-%", "s", "\"_", "%_", "(_", "env_", "[_", "'", "NAME", "'_", "]_", ",_", "env_", "[_", "'", "VERSI", "ON", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "bld", "_", "=_", "SC", "ons_", "._", "Builder_", "._", "Builder_", "(_", "action_", "=_", "build", "\\u", "specf", "ile_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "suffix_", "=_", "'.", "spec", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "target", "\\u", "factory_", "=_", "SC", "ons_", "._", "Node_", "._", "FS_", "._", "File_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "source_", "._", "extend_", "(_", "bld", "_", "(_", "env_", ",_", "specf", "ile_", ",_", "source_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "(_", "target_", ",_", "source_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "build", "\\u", "specf", "ile_", "(_", "target_", ",_", "source_", ",_", "env_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "Build", "s", " ", "a", " ", "RPM", " ", "specf", "ile", " ", "from", " ", "a", " ", "dictionar", "y", " ", "with", " ", "string", " ", "metadata", " ", "and", "\\", "10", ";", " ", " ", " ", " ", "by", " ", "analy", "zin", "g", " ", "a", " ", "tree", " ", "of", " ", "nodes", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "file_", "=_", "open_", "(_", "target_", "[_", "0_", "]_", "._", "abspath_", ",_", "'", "w", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "str_", "=_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "file_", "._", "write_", "(_", "build", "\\u", "specf", "ile", "\\u", "header_", "(_", "env_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "file_", "._", "write_", "(_", "build", "\\u", "specf", "ile", "\\u", "sections_", "(_", "env_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "file_", "._", "write_", "(_", "build", "\\u", "specf", "ile", "\\u", "filese", "ction_", "(_", "env_", ",_", "source_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "file_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "call", " ", "a", " ", "user", " ", "specified", " ", "function_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "'", "CHANGE", "\\u", "SPEC", "FILE", "'_", "in_", "env_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "env_", "[_", "'", "CHANGE", "\\u", "SPEC", "FILE", "'_", "]_", "(_", "target_", ",_", "source_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Key", "Error_", ",_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "SC", "ons_", "._", "Errors_", "._", "User", "Error_", "(_", "'\"", "%", "s", "\"", " ", "package", " ", "field", " ", "for", " ", "RPM", " ", "is", " ", "missi", "ng", ".'_", "%_", "e_", "._", "args_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "build", "\\u", "specf", "ile", "\\u", "sections_", "(_", "spec_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "Build", "s", " ", "the", " ", "section", "s", " ", "of", " ", "a", " ", "rpm", " ", "specf", "ile", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "str_", "=_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "mandat", "ory", "\\u", "sections_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "DESCRIPT", "ION", "'_", ":_", "'\\\\", "n", "%%", "description", "\\\\", "n", "%", "s", "\\\\", "n", "\\\\", "n", "'_", ",_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "str_", "=_", "str_", "+_", "Simple", "Ta", "g", "Compiler_", "(_", "mandat", "ory", "\\u", "sections_", ")_", "._", "compile_", "(_", "spec_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "option", "al", "\\u", "sections_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "DESCRIPT", "ION", "\\u'_", ":_", "'%%", "description", " ", "-", "l", " ", "%", "s", "\\\\", "n", "%", "s", "\\\\", "n", "\\\\", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "CHANGE", "LOG", "'_", ":_", "'%%", "change", "log", "\\\\", "n", "%", "s", "\\\\", "n", "\\\\", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "X", "\\u", "RPM", "\\u", "PRE", "INSTA", "LL", "'_", ":_", "'%%", "pre", "\\\\", "n", "%", "s", "\\\\", "n", "\\\\", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "X", "\\u", "RPM", "\\u", "POST", "INSTA", "LL", "'_", ":_", "'%%", "post", "\\\\", "n", "%", "s", "\\\\", "n", "\\\\", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "X", "\\u", "RPM", "\\u", "PRE", "UNI", "NS", "TAL", "L", "'_", ":_", "'%%", "pre", "un", "\\\\", "n", "%", "s", "\\\\", "n", "\\\\", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "X", "\\u", "RPM", "\\u", "POST", "UNI", "NS", "TAL", "L", "'_", ":_", "'%%", "post", "un", "\\\\", "n", "%", "s", "\\\\", "n", "\\\\", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "X", "\\u", "RPM", "\\u", "VERIFY", "'_", ":_", "'%%", "verify", "\\\\", "n", "%", "s", "\\\\", "n", "\\\\", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", "se", " ", "are", " ", "for", " ", "internal", " ", "use", " ", "but", " ", "coul", "d", " ", "possib", "ly", " ", "be", " ", "override", "n_", "\\u\\u\\uNL\\u\\u\\u_", "'", "X", "\\u", "RPM", "\\u", "PREP", "'_", ":_", "'%%", "prep", "\\\\", "n", "%", "s", "\\\\", "n", "\\\\", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "X", "\\u", "RPM", "\\u", "BUILD", "'_", ":_", "'%%", "build", "\\\\", "n", "%", "s", "\\\\", "n", "\\\\", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "X", "\\u", "RPM", "\\u", "INSTA", "LL", "'_", ":_", "'%%", "install", "\\\\", "n", "%", "s", "\\\\", "n", "\\\\", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "X", "\\u", "RPM", "\\u", "CLEAN", "'_", ":_", "'%%", "clean", "\\\\", "n", "%", "s", "\\\\", "n", "\\\\", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Default", " ", "prep", ",", " ", "build", ",", " ", "install", " ", "and", " ", "clean", " ", "rules_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "TOD", "O", ":", " ", "optimize", " ", "tho", "se", " ", "build", " ", "step", "s", ",", " ", "to", " ", "not", " ", "compile", " ", "the", " ", "project", " ", "a", " ", "second", " ", "time_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "'", "X", "\\u", "RPM", "\\u", "PREP", "'_", "not_", "in_", "spec_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "spec_", "[_", "'", "X", "\\u", "RPM", "\\u", "PREP", "'_", "]_", "=_", "'[", " ", "-", "n", " ", "\"$", "RPM", "\\u", "BUILD", "\\u", "ROO", "T", "\"", " ", "-", "a", " ", "\"$", "RPM", "\\u", "BUILD", "\\u", "ROO", "T", "\"", " ", "!=", " ", "/", " ", "]", " ", "&&", " ", "rm", " ", "-", "rf", " ", "\"$", "RPM", "\\u", "BUILD", "\\u", "ROO", "T", "\"'_", "+_", "'\\\\", "n", "%", "setup", " ", "-", "q", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "'", "X", "\\u", "RPM", "\\u", "BUILD", "'_", "not_", "in_", "spec_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "spec_", "[_", "'", "X", "\\u", "RPM", "\\u", "BUILD", "'_", "]_", "=_", "'", "mkd", "ir", " ", "\"$", "RPM", "\\u", "BUILD", "\\u", "ROO", "T", "\"'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "'", "X", "\\u", "RPM", "\\u", "INSTA", "LL", "'_", "not_", "in_", "spec_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "spec_", "[_", "'", "X", "\\u", "RPM", "\\u", "INSTA", "LL", "'_", "]_", "=_", "'", "scons", " ", "--", "install", "-", "sand", "box", "=\"$", "RPM", "\\u", "BUILD", "\\u", "ROO", "T", "\"", " ", "\"$", "RPM", "\\u", "BUILD", "\\u", "ROO", "T", "\"'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "'", "X", "\\u", "RPM", "\\u", "CLEAN", "'_", "not_", "in_", "spec_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "spec_", "[_", "'", "X", "\\u", "RPM", "\\u", "CLEAN", "'_", "]_", "=_", "'[", " ", "-", "n", " ", "\"$", "RPM", "\\u", "BUILD", "\\u", "ROO", "T", "\"", " ", "-", "a", " ", "\"$", "RPM", "\\u", "BUILD", "\\u", "ROO", "T", "\"", " ", "!=", " ", "/", " ", "]", " ", "&&", " ", "rm", " ", "-", "rf", " ", "\"$", "RPM", "\\u", "BUILD", "\\u", "ROO", "T", "\"'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "str_", "=_", "str_", "+_", "Simple", "Ta", "g", "Compiler_", "(_", "option", "al", "\\u", "sections_", ",_", "mandatory_", "=_", "0_", ")_", "._", "compile_", "(_", "spec_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "str_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "build", "\\u", "specf", "ile", "\\u", "header_", "(_", "spec_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "Build", "s", " ", "all", " ", "section", " ", "but", " ", "the", " ", "%", "file", " ", "of", " ", "a", " ", "rpm", " ", "specf", "ile", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "str_", "=_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "first", " ", "the", " ", "mandat", "ory", " ", "sections_", "\\u\\u\\uNL\\u\\u\\u_", "mandat", "ory", "\\u", "header", "\\u", "fields_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "NAME", "'_", ":_", "'%%", "defin", "e", " ", "name", " ", "%", "s", "\\\\", "n", "Name", ":", " ", "%%", "{", "name", "}\\\\", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "VERSI", "ON", "'_", ":_", "'%%", "defin", "e", " ", "version", " ", "%", "s", "\\\\", "n", "Version", ":", " ", "%%", "{", "version", "}\\\\", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "PACKAG", "EVE", "RSI", "ON", "'_", ":_", "'%%", "defin", "e", " ", "release", " ", "%", "s", "\\\\", "n", "Release", ":", " ", "%%", "{", "release", "}\\\\", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "X", "\\u", "RPM", "\\u", "GROU", "P", "'_", ":_", "'", "Group", ":", " ", "%", "s", "\\\\", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "SUMMARY", "'_", ":_", "'", "Summ", "ary", ":", " ", "%", "s", "\\\\", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "LICENSE", "'_", ":_", "'", "License", ":", " ", "%", "s", "\\\\", "n", "'_", ",_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "str_", "=_", "str_", "+_", "Simple", "Ta", "g", "Compiler_", "(_", "mandat", "ory", "\\u", "header", "\\u", "fields_", ")_", "._", "compile_", "(_", "spec_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "now", " ", "the", " ", "option", "al", " ", "tags_", "\\u\\u\\uNL\\u\\u\\u_", "option", "al", "\\u", "header", "\\u", "fields_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "VENDOR", "'_", ":_", "'", "Vend", "or", ":", " ", "%", "s", "\\\\", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "X", "\\u", "RPM", "\\u", "URL", "'_", ":_", "'", "Ur", "l", ":", " ", "%", "s", "\\\\", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "SOU", "RC", "E", "\\u", "URL", "'_", ":_", "'", "Sou", "rce", ":", " ", "%", "s", "\\\\", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "SUMMARY", "\\u'_", ":_", "'", "Summ", "ary", "(%", "s", "):", " ", "%", "s", "\\\\", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "X", "\\u", "RPM", "\\u", "DISTRI", "BUT", "ION", "'_", ":_", "'", "Distribut", "ion", ":", " ", "%", "s", "\\\\", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "X", "\\u", "RPM", "\\u", "ICON", "'_", ":_", "'", "Ico", "n", ":", " ", "%", "s", "\\\\", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "X", "\\u", "RPM", "\\u", "PACKAG", "ER", "'_", ":_", "'", "Packa", "ger", ":", " ", "%", "s", "\\\\", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "X", "\\u", "RPM", "\\u", "GROU", "P", "\\u'_", ":_", "'", "Group", "(%", "s", "):", " ", "%", "s", "\\\\", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "'", "X", "\\u", "RPM", "\\u", "REQUIRE", "S", "'_", ":_", "'", "Requ", "ires", ":", " ", "%", "s", "\\\\", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "X", "\\u", "RPM", "\\u", "PROVI", "DES", "'_", ":_", "'", "Prov", "ides", ":", " ", "%", "s", "\\\\", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "X", "\\u", "RPM", "\\u", "CONF", "LIC", "TS", "'_", ":_", "'", "Confl", "icts", ":", " ", "%", "s", "\\\\", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "X", "\\u", "RPM", "\\u", "BUILD", "REQUIRE", "S", "'_", ":_", "'", "Build", "Requ", "ires", ":", " ", "%", "s", "\\\\", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "'", "X", "\\u", "RPM", "\\u", "SERIAL", "'_", ":_", "'", "Ser", "ial", ":", " ", "%", "s", "\\\\", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "X", "\\u", "RPM", "\\u", "EPOCH", "'_", ":_", "'", "Epoch", ":", " ", "%", "s", "\\\\", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "X", "\\u", "RPM", "\\u", "AUTO", "REQ", "PRO", "V", "'_", ":_", "'", "Auto", "Re", "q", "Prov", ":", " ", "%", "s", "\\\\", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "X", "\\u", "RPM", "\\u", "EXCLUDE", "ARCH", "'_", ":_", "'", "Exclude", "Arch", ":", " ", "%", "s", "\\\\", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "X", "\\u", "RPM", "\\u", "EXC", "LUS", "IV", "EAR", "CH", "'_", ":_", "'", "Exclu", "sive", "Arch", ":", " ", "%", "s", "\\\\", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "X", "\\u", "RPM", "\\u", "PREF", "IX", "'_", ":_", "'", "Pref", "ix", ":", " ", "%", "s", "\\\\", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "X", "\\u", "RPM", "\\u", "CONF", "LIC", "TS", "'_", ":_", "'", "Confl", "icts", ":", " ", "%", "s", "\\\\", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "internal", " ", "use_", "\\u\\u\\uNL\\u\\u\\u_", "'", "X", "\\u", "RPM", "\\u", "BUILD", "ROO", "T", "'_", ":_", "'", "Build", "Roo", "t", ":", " ", "%", "s", "\\\\", "n", "'_", ",_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "fill", " ", "in", " ", "default", " ", "values", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Add", "ing", " ", "a", " ", "Build", "Requ", "ires", " ", "render", "s", " ", "the", " ", ".", "rpm", " ", "unb", "uild", "able", " ", "under", " ", "System", ",", " ", "which_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "are", " ", "not", " ", "manage", "d", " ", "by", " ", "rpm", ",", " ", "sinc", "e", " ", "the", " ", "databa", "se", " ", "to", " ", "resolve", " ", "this", " ", "dependen", "cy", " ", "is_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "missi", "ng", " ", "(", "take", " ", "Gen", "too", " ", "as", " ", "an", " ", "example", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "if", " ", "not", " ", "s", ".", "has", "\\u", "key", "('", "x", "\\u", "rpm", "\\u", "Build", "Requ", "ires", "')", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "s", "['", "x", "\\u", "rpm", "\\u", "Build", "Requ", "ires", "']", " ", "=", " ", "'", "scons", "'_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "'", "X", "\\u", "RPM", "\\u", "BUILD", "ROO", "T", "'_", "not_", "in_", "spec_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "spec_", "[_", "'", "X", "\\u", "RPM", "\\u", "BUILD", "ROO", "T", "'_", "]_", "=_", "'%", "{\\u", "tmp", "path", "}/", "%", "{", "name", "}-", "%", "{", "version", "}-", "%", "{", "release", "}'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "str_", "=_", "str_", "+_", "Simple", "Ta", "g", "Compiler_", "(_", "option", "al", "\\u", "header", "\\u", "fields_", ",_", "mandatory_", "=_", "0_", ")_", "._", "compile_", "(_", "spec_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "str_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "build", "\\u", "specf", "ile", "\\u", "filese", "ction_", "(_", "spec_", ",_", "files_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "builds", " ", "the", " ", "%", "file", " ", "section", " ", "of", " ", "the", " ", "specf", "ile", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "str_", "=_", "'%", "files", "\\\\", "n", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "'", "X", "\\u", "RPM", "\\u", "DEF", "ATT", "R", "'_", "not_", "in_", "spec_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "spec_", "[_", "'", "X", "\\u", "RPM", "\\u", "DEF", "ATT", "R", "'_", "]_", "=_", "'(", "-", ",", "root", ",", "root", ")'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "str_", "=_", "str_", "+_", "'%%", "def", "attr", " ", "%", "s", "\\\\", "n", "'_", "%_", "spec_", "[_", "'", "X", "\\u", "RPM", "\\u", "DEF", "ATT", "R", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "support", "ed", "\\u", "tags_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "PACKAG", "ING", "\\u", "CONFIG", "'_", ":_", "'%%", "config", " ", "%", "s", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "PACKAG", "ING", "\\u", "CONFIG", "\\u", "NOR", "EP", "LAC", "E", "'_", ":_", "'%%", "config", "(", "nore", "place", ")", " ", "%", "s", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "PACKAG", "ING", "\\u", "DOC", "'_", ":_", "'%%", "doc", " ", "%", "s", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "PACKAG", "ING", "\\u", "UNIX", "\\u", "ATT", "R", "'_", ":_", "'%%", "attr", " ", "%", "s", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "PACKAG", "ING", "\\u", "LANG", "\\u'_", ":_", "'%%", "lang", "(%", "s", ")", " ", "%", "s", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "PACKAG", "ING", "\\u", "X", "\\u", "RPM", "\\u", "VERIFY", "'_", ":_", "'%%", "verify", " ", "%", "s", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "PACKAG", "ING", "\\u", "X", "\\u", "RPM", "\\u", "DIR", "'_", ":_", "'%%", "dir", " ", "%", "s", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "PACKAG", "ING", "\\u", "X", "\\u", "RPM", "\\u", "DOC", "DIR", "'_", ":_", "'%%", "doc", "dir", " ", "%", "s", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "PACKAG", "ING", "\\u", "X", "\\u", "RPM", "\\u", "GH", "OST", "'_", ":_", "'%%", "ghost", " ", "%", "s", "'_", ",_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "file_", "in_", "files_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "build", " ", "the", " ", "tags", "et_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "tags_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "k_", "in_", "support", "ed", "\\u", "tags_", "._", "keys_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "tags_", "[_", "k_", "]_", "=_", "getattr_", "(_", "file_", ",_", "k_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Attribute", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "compile", " ", "the", " ", "tags", "et_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "str_", "=_", "str_", "+_", "Simple", "Ta", "g", "Compiler_", "(_", "support", "ed", "\\u", "tags_", ",_", "mandatory_", "=_", "0_", ")_", "._", "compile_", "(_", "tags_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "str_", "=_", "str_", "+_", "'", " ", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "str_", "=_", "str_", "+_", "file_", "._", "PACKAG", "ING", "\\u", "INSTA", "LL", "\\u", "LOCATION_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "str_", "=_", "str_", "+_", "'\\\\", "n", "\\\\", "n", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "str_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Simple", "Ta", "g", "Compiler_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "Thi", "s", " ", "class", " ", "is", " ", "a", " ", "simple", " ", "string", " ", "subst", "ition", " ", "utility", ":", "\\", "10", ";", " ", " ", " ", " ", "the", " ", "replace", "ment", " ", "specf", "ication", " ", "is", " ", "store", "d", " ", "in", " ", "the", " ", "tags", "et", " ", "dictionar", "y", ",", " ", "somet", "hing", "\\", "10", ";", " ", " ", " ", " ", "like", ":", "\\", "10", ";", " ", "{", " ", "\"", "abc", "\"", " ", " ", ":", " ", "\"", "cdef", " ", "%", "s", " ", "\",", "\\", "10", ";", " ", " ", " ", "\"", "abc", "\\u\"", " ", ":", " ", "\"", "cdef", " ", "%", "s", " ", "%", "s", "\"", " ", "}", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "the", " ", "compile", " ", "function", " ", "gets", " ", "a", " ", "value", " ", "dictionar", "y", ",", " ", "whi", "ch", " ", "may", " ", "look", " ", "like", ":", "\\", "10", ";", " ", " ", " ", " ", "{", " ", "\"", "abc", "\"", " ", " ", " ", " ", ":", " ", "\"", "gh", "ij", "\",", "\\", "10", ";", " ", " ", "\"", "abc", "\\u", "gh", "\"", " ", ":", " ", "\"", "ij", "\"", " ", "}", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "result", "ing", " ", "string", " ", "will", " ", "be", ":", "\\", "10", ";", " ", "\"", "cdef", " ", "gh", "ij", " ", "cdef", " ", "gh", " ", "ij", "\"", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Simple", "Ta", "g", "Compiler_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "tags", "et_", ",_", "mandatory_", "=_", "1_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "tags", "et_", "=_", "tags", "et_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "mandatory_", "=_", "mandatory_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Simple", "Ta", "g", "Compiler_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "compile_", "(_", "self_", ",_", "values_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "compile", "s", " ", "the", " ", "tags", "et", " ", "and", " ", "return", "s", " ", "a", " ", "str", " ", "contain", "ing", " ", "the", " ", "result", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "is", "\\u", "international", "_", "(_", "tag_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "return", " ", "tag", ".", "ends", "with", "('\\", "u", "')", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "tag_", "[_", "-_", "1_", ":_", "]_", "==_", "'\\u'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "countr", "y", "\\u", "code_", "(_", "tag_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "tag_", "[_", "-_", "2_", ":_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "strip", "\\u", "countr", "y", "\\u", "code_", "(_", "tag_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "tag_", "[_", ":_", "-_", "2_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "replacements_", "=_", "list_", "(_", "self_", "._", "tags", "et_", "._", "items_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "str_", "=_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "dome", "stic", " ", "=", " ", "[", " ", "(", "k", ",", "v", ")", " ", "for", " ", "k", ",", "v", " ", "in", " ", "replace", "ment", "s", " ", "if", " ", "not", " ", "is", "\\u", "international", "(", "k", ")", " ", "]_", "\\u\\u\\uNL\\u\\u\\u_", "dome", "stic", "_", "=_", "[_", "t_", "for_", "t_", "in_", "replacements_", "if_", "not_", "is", "\\u", "international", "_", "(_", "t_", "[_", "0_", "]_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "key_", ",_", "replacement_", "in_", "dome", "stic", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "str_", "=_", "str_", "+_", "replacement_", "%_", "values_", "[_", "key_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Key", "Error_", ",_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "mandatory_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "raise_", "e_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "international", " ", "=", " ", "[", " ", "(", "k", ",", "v", ")", " ", "for", " ", "k", ",", "v", " ", "in", " ", "replace", "ment", "s", " ", "if", " ", "is", "\\u", "international", "(", "k", ")", " ", "]_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "international", "_", "=_", "[_", "t_", "for_", "t_", "in_", "replacements_", "if_", "is", "\\u", "international", "_", "(_", "t_", "[_", "0_", "]_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "key_", ",_", "replacement_", "in_", "international", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "int\\u", "values", "\\u", "for", "\\u", "key", " ", "=", " ", "[", " ", "(", "get", "\\u", "countr", "y", "\\u", "code", "(", "k", "),", "v", ")", " ", "for", " ", "k", ",", "v", " ", "in", " ", "values", ".", "items", "()", " ", "if", " ", "strip", "\\u", "countr", "y", "\\u", "code", "(", "k", ")", " ", "==", " ", "key", " ", "]_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "x_", "=_", "[_", "t_", "for_", "t_", "in_", "values_", "._", "items_", "(_", ")_", "if_", "strip", "\\u", "countr", "y", "\\u", "code_", "(_", "t_", "[_", "0_", "]_", ")_", "==_", "key_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "int\\u", "values", "\\u", "for", "\\u", "key_", "=_", "[_", "(_", "get", "\\u", "countr", "y", "\\u", "code_", "(_", "t_", "[_", "0_", "]_", ")_", ",_", "t_", "[_", "1_", "]_", ")_", "for_", "t_", "in_", "x_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "v_", "in_", "int\\u", "values", "\\u", "for", "\\u", "key_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "str_", "=_", "str_", "+_", "replacement_", "%_", "v_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Key", "Error_", ",_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "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2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
rllab/rllab/tests/algos/test_trpo.py
[ { "content": "from __future__ import print_function\nfrom __future__ import absolute_import\nfrom rllab.envs.base import Env, Step\nfrom rllab.policies.gaussian_mlp_policy import GaussianMLPPolicy\nfrom rllab.baselines.zero_baseline import ZeroBaseline\nfrom rllab.algos.trpo import TRPO\nfrom rllab.spaces.box import Box\nimport lasagne.nonlinearities\nimport numpy as np\nimport theano.tensor as TT\n\n\n\n\n\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class DummyEnv(Env):\n\n\n", "metadata": "root.DummyEnv", "header": "['module', '___EOS___']", "index": 12 }, { "content": " @property\n def observation_space(self):\n return Box(low=-np.inf, high=np.inf, shape=(1,))", "metadata": "root.DummyEnv.observation_space", "header": "['class', 'DummyEnv', '(', 'Env', ')', ':', '___EOS___']", "index": 13 }, { "content": " @property\n def action_space(self):\n return Box(low=-5.0, high=5.0, shape=(1,))", "metadata": "root.DummyEnv.action_space", "header": "['class', 'DummyEnv', '(', 'Env', ')', ':', '___EOS___']", "index": 17 }, { "content": " def reset(self):\n return np.zeros(1)", "metadata": "root.DummyEnv.reset", "header": "['class', 'DummyEnv', '(', 'Env', ')', ':', '___EOS___']", "index": 21 }, { "content": " def step(self, action):\n return Step(observation=np.zeros(1), reward=np.random.normal(), done=True)", "metadata": "root.DummyEnv.step", "header": "['class', 'DummyEnv', '(', 'Env', ')', ':', '___EOS___']", "index": 24 }, { "content": "def naive_relu(x):\n return TT.max(x, 0)", "metadata": "root.naive_relu", "header": "['module', '___EOS___']", "index": 28 }, { "content": "def test_trpo_relu_nan():\n env = DummyEnv()\n policy = GaussianMLPPolicy(\n env_spec=env.spec,\n hidden_nonlinearity=naive_relu,\n hidden_sizes=(1,))\n baseline = ZeroBaseline(env_spec=env.spec)\n algo = TRPO(\n env=env, policy=policy, baseline=baseline, n_itr=1, batch_size=1000, max_path_length=100,\n step_size=0.001\n )\n algo.train()\n assert not np.isnan(np.sum(policy.get_param_values()))", "metadata": "root.test_trpo_relu_nan", "header": "['module', '___EOS___']", "index": 32 }, { "content": "def test_trpo_deterministic_nan():\n env = DummyEnv()\n policy = GaussianMLPPolicy(\n env_spec=env.spec,\n hidden_sizes=(1,))\n policy._l_log_std.param.set_value([np.float32(np.log(1e-8))])\n baseline = ZeroBaseline(env_spec=env.spec)\n algo = TRPO(\n env=env, policy=policy, baseline=baseline, n_itr=10, batch_size=1000, max_path_length=100,\n step_size=0.01\n )\n algo.train()\n assert not np.isnan(np.sum(policy.get_param_values()))", "metadata": "root.test_trpo_deterministic_nan", "header": "['module', '___EOS___']", "index": 47 } ]
[ { "span": "import lasagne.nonlinearities", "start_line": 7, "start_column": 0, "end_line": 7, "end_column": 29 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "from_", "\\u\\u", "future\\u\\u_", "import_", "print", "\\u", "function_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "\\u\\u", "future\\u\\u_", "import_", "abs", "olute", "\\u", "import_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "rl", "lab_", "._", "envs_", "._", "base_", "import_", "Env_", ",_", "Step_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "rl", "lab_", "._", "policies_", "._", "gauss", "ian", "\\u", "mlp", "\\u", "policy_", "import_", "Gaussian", "MLP", "Policy_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "rl", "lab_", "._", "baseline", "s_", "._", "zero", "\\u", "baseline_", "import_", "Zero", "Base", "line_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "rl", "lab_", "._", "algo", "s_", "._", "trp", "o_", "import_", "TR", "PO", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "rl", "lab_", "._", "spaces_", "._", "box_", "import_", "Box_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "lasagne_", "._", "nonlinear", "ities_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "numpy_", "as_", "np_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "theano_", "._", "tensor_", "as_", "TT_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Du", "mm", "y", "Env_", "(_", "Env_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Du", "mm", "y", "Env_", "(_", "Env_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "@_", "property_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "observa", "tion", "\\u", "space_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "Box_", "(_", "low_", "=_", "-_", "np_", "._", "inf_", ",_", "high_", "=_", "np_", "._", "inf_", ",_", "shape_", "=_", "(_", "1_", ",_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Du", "mm", "y", "Env_", "(_", "Env_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "property_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "action", "\\u", "space_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "Box_", "(_", "low_", "=_", "-_", "5.0_", ",_", "high_", "=_", "5.0_", ",_", "shape_", "=_", "(_", "1_", ",_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Du", "mm", "y", "Env_", "(_", "Env_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "reset_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "np_", "._", "zeros_", "(_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Du", "mm", "y", "Env_", "(_", "Env_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "step_", "(_", "self_", ",_", "action_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "Step_", "(_", "observation_", "=_", "np_", "._", "zeros_", "(_", "1_", ")_", ",_", "reward_", "=_", "np_", "._", "random_", "._", "normal_", "(_", ")_", ",_", "done_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "naive", "\\u", "relu_", "(_", "x_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "TT_", "._", "max_", "(_", "x_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "trp", "o", "\\u", "relu", "\\u", "nan_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "env_", "=_", "Du", "mm", "y", "Env_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "policy_", "=_", "Gaussian", "MLP", "Policy_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "env", "\\u", "spec_", "=_", "env_", "._", "spec_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "hidden", "\\u", "nonlinearity", "_", "=_", "naive", "\\u", "relu_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "hidden", "\\u", "sizes_", "=_", "(_", "1_", ",_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "baseline_", "=_", "Zero", "Base", "line_", "(_", "env", "\\u", "spec_", "=_", "env_", "._", "spec_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "algo_", "=_", "TR", "PO", "_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "env_", "=_", "env_", ",_", "policy_", "=_", "policy_", ",_", "baseline_", "=_", "baseline_", ",_", "n", "\\u", "itr_", "=_", "1_", ",_", "batch", "\\u", "size_", "=_", "1000_", ",_", "max", "\\u", "path", "\\u", "length_", "=_", "100_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "step", "\\u", "size_", "=_", "0.001_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "algo_", "._", "train_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "not_", "np_", "._", "isnan_", "(_", "np_", "._", "sum_", "(_", "policy_", "._", "get", "\\u", "param", "\\u", "values_", "(_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "trp", "o", "\\u", "deterministic", "\\u", "nan_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "env_", "=_", "Du", "mm", "y", "Env_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "policy_", "=_", "Gaussian", "MLP", "Policy_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "env", "\\u", "spec_", "=_", "env_", "._", "spec_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "hidden", "\\u", "sizes_", "=_", "(_", "1_", ",_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "policy_", "._", "\\u", "l\\u", "log", "\\u", "std_", "._", "param_", "._", "set\\u", "value_", "(_", "[_", "np_", "._", "float32_", "(_", "np_", "._", "log_", "(_", "1e-8_", ")_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "baseline_", "=_", "Zero", "Base", "line_", "(_", "env", "\\u", "spec_", "=_", "env_", "._", "spec_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "algo_", "=_", "TR", "PO", "_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "env_", "=_", "env_", ",_", "policy_", "=_", "policy_", ",_", "baseline_", "=_", "baseline_", ",_", "n", "\\u", "itr_", "=_", "10_", ",_", "batch", "\\u", "size_", "=_", "1000_", ",_", "max", "\\u", "path", "\\u", "length_", "=_", "100_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "step", "\\u", "size_", "=_", "0.01_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "algo_", "._", "train_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "not_", "np_", "._", "isnan_", "(_", "np_", "._", "sum_", "(_", "policy_", "._", "get", "\\u", "param", "\\u", "values_", "(_", ")_", ")_", ")_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2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 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused local variable
enthought/mayavi/tvtk/pyface/ui/wx/actor_editor.py
[ { "content": " def init(self, parent):\n \"\"\" Finishes initializing the editor by creating the underlying toolkit\n widget.\n \"\"\"\n\n factory = self.factory\n self.control = wx.Panel(parent, -1)\n self._sizer = wx.BoxSizer(wx.VERTICAL)\n self.control.SetSizer(self._sizer)\n\n self._create_scene()", "metadata": "root._ActorEditor.init", "header": "['class', '_ActorEditor', '(', 'Editor', ')', ':', '___EOS___']", "index": 47 } ]
[ { "span": "factory ", "start_line": 52, "start_column": 8, "end_line": 52, "end_column": 15 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "\\u", "Act", "or", "Editor_", "(_", "Editor_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "init_", "(_", "self_", ",_", "parent_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "Finish", "es", " ", "initiali", "zin", "g", " ", "the", " ", "editor", " ", "by", " ", "creati", "ng", " ", "the", " ", "underl", "ying", " ", "tool", "kit", "\\", "10", ";", " ", " ", " ", " ", "widget", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "factory_", "=_", "self_", "._", "factory_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "control_", "=_", "wx_", "._", "Panel_", "(_", "parent_", ",_", "-_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "sizer_", "=_", "wx_", "._", "Box", "Sizer_", "(_", "wx_", "._", "VERTICAL_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "control_", "._", "Set", "Sizer_", "(_", "self_", "._", "\\u", "sizer_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "create", "\\u", "scene_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
pyjs/pyjs/examples/picasaweb/Photos.py
[ { "content": "# Picasaweb and other gdata services use RESTful methods which is great\n# for them but presents a problem as far as getting the JSON data without\n# using the regular pyjamas JSONRPC classes we know and love. Easy if you\n# have a backend that can do the get but not so easy to do everything\n# client-side since we have to get around Single Origin Policy by dynamically\n# adding script tags to the DOM. Check out public/PicasaWeb.html since this\n# necessitates a static script tag and a var too.\n# At this point it works but I'm sure some DOM genius can find some\n# room for improvement... jkh http://jameskhedley.com\nfrom pyjamas.ui.HTML import HTML\nfrom pyjamas.ui.TextBox import TextBox\nfrom pyjamas.ui.Label import Label\nfrom pyjamas.ui.Button import Button\nfrom pyjamas.ui.VerticalPanel import VerticalPanel\nfrom pyjamas.ui.HorizontalPanel import HorizontalPanel\nfrom pyjamas.ui.DisclosurePanel import DisclosurePanel\nfrom pyjamas.ui.Grid import Grid\nfrom pyjamas.ui.Composite import Composite\nfrom pyjamas.Timer import Timer\nfrom pyjamas import DOM\nimport json\nfrom __pyjamas__ import doc, wnd\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class Photos(Composite):\n\n\n\n\n\n\n", "metadata": "root.Photos", "header": "['module', '___EOS___']", "index": 23 }, { "content": " def __init__(self):\n Composite.__init__(self)\n\n self.albums = []\n self.photos = []\n self.grid = Grid(4, 4, CellPadding=4, CellSpacing=4)\n self.grid.addTableListener(self)\n self.drill = 0\n self.pos = 0\n self.up = Button(\"Up\", self)\n self.next = Button(\"Next\", self)\n self.prev = Button(\"Prev\", self)\n self.timer = Timer(notify=self)\n self.userid = \"jameskhedley\"\n self.album_url = \"http://picasaweb.google.com/data/feed/base/user/\" + self.userid + \"?alt=json-in-script&kind=album&hl=en_US&callback=restCb\"\n self.doRESTQuery(self.album_url, self.timer)\n\n self.vp = VerticalPanel()\n self.disclosure = DisclosurePanel(\"Click for boring technical details.\")\n self.disclosure.add(HTML('''<p>OK so you want to write client JS to do a RESTful HTTP query from picasa right?\n\t\t\t\t Well you can't because of the Same Origin Policy. Basically this means that\n\t\t\t\t because the domain of the query and the domain of the hosted site are different,\n\t\t\t\t then that could well be a cross-site scripting (XSS) attack. So, the workaround is to\n\t\t\t\t do the call from a script tag so the JSON we get back is part of the document.\n\t\t\t\t But since we don't know what URL to hit yet, once we find out then we have to inject\n\t\t\t\t a new script tag dynamically which the browser will run as soon as we append it.\n\t\t\t\t To be honest I'm not 100% why Google use RESTful services and not JSON-RPC or somesuch,\n\t\t\t\t which would be easier. Well, easier for me.'''))\n\n self.IDPanel = HorizontalPanel()\n self.IDPanel.add(Label(\"Enter google account:\"))\n self.IDButton = Button(\"Go\", self)\n\n self.IDBox = TextBox()\n self.IDBox.setText(self.userid)\n self.IDPanel.add(self.IDBox)\n self.IDPanel.add(self.IDButton)\n self.vp.add(self.IDPanel)\n self.vp.add(self.disclosure)\n self.vp.add(self.grid)\n\n self.initWidget(self.vp)", "metadata": "root.Photos.__init__", "header": "['class', 'Photos', '(', 'Composite', ')', ':', '___EOS___']", "index": 24 }, { "content": " def doRESTQuery(self, url, timer):\n \"\"\"this is a totally different from an RPC call in that we have to\n dynamically add script tags to the DOM when we want to query the\n REST API. These rely on callbacks in the DOM so we can either add\n them dynamically or pre-define them in public/Main.html.\n Once we've done that have to wait for the response.\n Which means we need to provide a listener for the timer\"\"\"\n\n new_script = DOM.createElement(\"script\")\n DOM.setElemAttribute(new_script, \"src\", url)\n DOM.setElemAttribute(new_script, \"type\",\"text/javascript\")\n doc().body.appendChild(new_script)\n self.timer.schedule(100)", "metadata": "root.Photos.doRESTQuery", "header": "['class', 'Photos', '(', 'Composite', ')', ':', '___EOS___']", "index": 67 }, { "content": " def onCellClicked(self, sender, row, col):\n if self.drill==0:\n self.drill += 1\n self.vp.clear()\n self.grid.clear()\n self.vp.add(self.up)\n self.vp.add(self.grid)\n gridcols = self.grid.getColumnCount()\n album = self.albums[row+col+(row*(gridcols-1))]\n url = \"http://picasaweb.google.com/data/feed/base/user/\" + self.userid + \"/albumid/\" + album[\"id\"] + \"?alt=json-in-script&kind=photo&hl=en_US&callback=restCb\"\n self.doRESTQuery(url, self.timer)\n elif self.drill==1:\n self.drill += 1\n gridcols = self.grid.getColumnCount()\n self.pos =row+col+(row*(gridcols-1))\n photo = self.photos[self.pos]\n self.vp.clear()\n self.fullsize = HTML('<img src=\"' + photo[\"full\"] + '\"/>')\n hp = HorizontalPanel()\n hp.add(self.up)\n hp.add(self.prev)\n hp.add(self.next)\n hp.setSpacing(8)\n self.vp.add(hp)\n self.vp.add(self.fullsize)", "metadata": "root.Photos.onCellClicked", "header": "['class', 'Photos', '(', 'Composite', ')', ':', '___EOS___']", "index": 81 }, { "content": " def onClick(self, sender):\n if sender == self.IDButton:\n self.userid = self.IDBox.getText()\n if self.userid == \"\" or self.userid.isdigit():\n return\n self.drill = 0\n self.album_url = \"http://picasaweb.google.com/data/feed/base/user/\" + self.userid + \"?alt=json-in-script&kind=album&hl=en_US&callback=restCb\"\n self.grid.clear()\n self.doRESTQuery(self.album_url, self.timer)\n else:\n if self.drill == 2:\n if sender == self.up:\n self.drill=1\n self.vp.clear()\n self.vp.add(self.up)\n self.vp.add(self.grid)\n self.fillGrid(self.photos, \"photos\")\n else:\n if sender == self.next:\n if self.pos >= len(self.photos):\n return\n self.pos +=1\n elif sender == self.prev:\n if self.pos < 1:\n return\n self.pos -=1\n photo = self.photos[self.pos]\n self.fullsize.setHTML('<img src=\"' + photo[\"full\"] + '\"/>')\n elif self.drill == 1:\n self.drill=0\n self.vp.clear()\n self.vp.add(self.IDPanel)\n self.vp.add(self.disclosure)\n self.vp.add(self.grid)\n self.fillGrid(self.albums, \"albums\")", "metadata": "root.Photos.onClick", "header": "['class', 'Photos', '(', 'Composite', ')', ':', '___EOS___']", "index": 107 }, { "content": " def onTimer(self, timer):\n fd = doc().getElementById(\"__pygwt_hiddenData\")\n receiver = fd.innerHTML\n\n if receiver == 'wait':\n self.timer.schedule(1000)\n return\n\n fd.innerHTML = 'wait'\n\n if self.drill == 0:\n self.parseAlbums(receiver)\n self.fillGrid(self.albums, \"albums\")\n elif self.drill == 1:\n self.parsePhotos(receiver)\n self.fillGrid(self.photos, \"photos\")", "metadata": "root.Photos.onTimer", "header": "['class', 'Photos', '(', 'Composite', ')', ':', '___EOS___']", "index": 143 }, { "content": " def fillGrid(self, items, type):\n self.grid.clear()\n cols = self.grid.getColumnCount()\n self.grid.resizeRows((len(items)/cols)+1)\n rows = self.grid.getRowCount()\n for i in range(len(items)):\n vp = VerticalPanel()\n if type == 'photos':\n vp.add(items[i]['thumb'])\n else:\n vp.add(items[i]['thumb'])\n vp.add(items[i]['title'])\n self.grid.setWidget(int(i/cols), i%cols, vp)", "metadata": "root.Photos.fillGrid", "header": "['class', 'Photos', '(', 'Composite', ')', ':', '___EOS___']", "index": 160 }, { "content": " def parsePhotos(self, items):\n photo_list = json.loads(items)\n self.photos = []\n for ph in photo_list:\n aphoto = {}\n aphoto['thumb'] = HTML('<img src=\"' + ph[u\"media$group\"][u\"media$thumbnail\"][1][u\"url\"] + '\"/>')\n aphoto['full'] = ph[u\"media$group\"][u\"media$content\"][0][u\"url\"]\n self.photos.append(aphoto)", "metadata": "root.Photos.parsePhotos", "header": "['class', 'Photos', '(', 'Composite', ')', ':', '___EOS___']", "index": 174 }, { "content": " def parseAlbums(self, items):\n album_list = json.loads(items)\n self.albums = []\n for al in album_list:\n analbum = {}\n analbum['title'] = HTML(al[u\"title\"][u\"$t\"])\n analbum['thumb'] = HTML('<img src=\"' + al[u\"media$group\"][u\"media$thumbnail\"][0][u\"url\"] + '\"/>')\n url = al[u\"id\"][u\"$t\"]\n analbum['id'] = url.split(u'albumid/')[1].split(u'?alt')[0]\n self.albums.append(analbum)", "metadata": "root.Photos.parseAlbums", "header": "['class', 'Photos', '(', 'Composite', ')', ':', '___EOS___']", "index": 183 } ]
[ { "span": "from __pyjamas__ import doc, wnd", "start_line": 21, "start_column": 0, "end_line": 21, "end_column": 32 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "Pic", "asa", "web", " ", "and", " ", "other", " ", "gdat", "a", " ", "service", "s", " ", "use", " ", "REST", "ful", " ", "method", "s", " ", "whi", "ch", " ", "is", " ", "great", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "for", " ", "them", " ", "but", " ", "presen", "ts", " ", "a", " ", "problem", " ", "as", " ", "far", " ", "as", " ", "getti", "ng", " ", "the", " ", "JSO", "N", " ", "data", " ", "with", "out_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "usi", "ng", " ", "the", " ", "regular", " ", "pyj", "ama", "s", " ", "JSONR", "PC", " ", "classe", "s", " ", "we", " ", "know", " ", "and", " ", "love", ".", " ", "Eas", "y", " ", "if", " ", "you", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "have", " ", "a", " ", "back", "end", " ", "tha", "t", " ", "can", " ", "do", " ", "the", " ", "get", " ", "but", " ", "not", " ", "so", " ", "easy", " ", "to", " ", "do", " ", "every", "thing_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "client", "-", "side", " ", "sinc", "e", " ", "we", " ", "have", " ", "to", " ", "get", " ", "aro", "und", " ", "Sing", "le", " ", "Orig", "in", " ", "Polic", "y", " ", "by", " ", "dynami", "call", "y_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "addin", "g", " ", "script", " ", "tags", " ", "to", " ", "the", " ", "DOM", ".", " ", "Check", " ", "out", " ", "public", "/", "Pic", "asa", "Web", ".", "html", " ", "sinc", "e", " ", "this_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "nece", "ssi", "tate", "s", " ", "a", " ", "static", " ", "script", " ", "tag", " ", "and", " ", "a", " ", "var", " ", "too", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "At", " ", "this", " ", "point", " ", "it", " ", "works", " ", "but", " ", "I", "'", "m", " ", "sure", " ", "some", " ", "DOM", " ", "geni", "us", " ", "can", " ", "find", " ", "some", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "room", " ", "for", " ", "improvement", "...", " ", "jk", "h", " ", "http", "://", "jam", "es", "kh", "edl", "ey", ".", "com_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "pyj", "ama", "s_", "._", "ui_", "._", "HTML_", "import_", "HTML_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "pyj", "ama", "s_", "._", "ui_", "._", "Text", "Box_", "import_", "Text", "Box_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "pyj", "ama", "s_", "._", "ui_", "._", "Label_", "import_", "Label_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "pyj", "ama", "s_", "._", "ui_", "._", "Button_", "import_", "Button_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "pyj", "ama", "s_", "._", "ui_", "._", "Vertica", "l", "Panel_", "import_", "Vertica", "l", "Panel_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "pyj", "ama", "s_", "._", "ui_", "._", "Horiz", "onta", "l", "Panel_", "import_", "Horiz", "onta", "l", "Panel_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "pyj", "ama", "s_", "._", "ui_", "._", "Disc", "los", "ure", "Panel_", "import_", "Disc", "los", "ure", "Panel_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "pyj", "ama", "s_", "._", "ui_", "._", "Grid_", "import_", "Grid_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "pyj", "ama", "s_", "._", "ui_", "._", "Composit", "e_", "import_", "Composit", "e_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "pyj", "ama", "s_", "._", "Timer_", "import_", "Timer_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "pyj", "ama", "s_", "import_", "DOM_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "json_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "\\u\\u", "pyj", "ama", "s\\u\\u_", "import_", "doc_", ",_", "wnd", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Photos", "_", "(_", "Composit", "e_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Photos", "_", "(_", "Composit", "e_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Composit", "e_", "._", "\\u\\u", "init\\u\\u_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "albums_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "photos_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "grid_", "=_", "Grid_", "(_", "4_", ",_", "4_", ",_", "Cel", "l", "Padding_", "=_", "4_", ",_", "Cel", "l", "Spacing_", "=_", "4_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "grid_", "._", "add", "Table", "Listener_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "drill", "_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "pos_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "up_", "=_", "Button_", "(_", "\"", "Up", "\"_", ",_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "next_", "=_", "Button_", "(_", "\"", "Ne", "xt", "\"_", ",_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "prev_", "=_", "Button_", "(_", "\"", "Prev", "\"_", ",_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "timer_", "=_", "Timer_", "(_", "notify_", "=_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "userid_", "=_", "\"", "jam", "es", "kh", "edl", "ey", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "album", "\\u", "url_", "=_", "\"", "http", "://", "pica", "saw", "eb", ".", "google", ".", "com", "/", "data", "/", "feed", "/", "base", "/", "user", "/\"_", "+_", "self_", "._", "userid_", "+_", "\"?", "alt", "=", "json", "-", "in", "-", "script", "&", "kind", "=", "album", "&", "hl", "=", "en", "\\u", "US", "&", "callback", "=", "rest", "Cb", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "do", "REST", "Query_", "(_", "self_", "._", "album", "\\u", "url_", ",_", "self_", "._", "timer_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "vp_", "=_", "Vertica", "l", "Panel_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "discl", "osu", "re_", "=_", "Disc", "los", "ure", "Panel_", "(_", "\"", "Click", " ", "for", " ", "bor", "ing", " ", "technical", " ", "deta", "il", "s", ".\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "discl", "osu", "re_", "._", "add_", "(_", "HTML_", "(_", "'''", "<", "p", ">", "OK", " ", "so", " ", "you", " ", "want", " ", "to", " ", "write", " ", "client", " ", "JS", " ", "to", " ", "do", " ", "a", " ", "REST", "ful", " ", "HTTP", " ", "query", " ", "from", " ", "pica", "sa", " ", "right", "?", "\\", "10", ";", "\t\t\t", "\t", " ", "Wel", "l", " ", "you", " ", "can", "'", "t", " ", "bec", "aus", "e", " ", "of", " ", "the", " ", "Sam", "e", " ", "Orig", "in", " ", "Polic", "y", ".", " ", "Basic", "ally", " ", "this", " ", "means", " ", "tha", "t", "\\", "10", ";", "\t\t\t", "\t", " ", "bec", "aus", "e", " ", "the", " ", "domain", " ", "of", " ", "the", " ", "query", " ", "and", " ", "the", " ", "domain", " ", "of", " ", "the", " ", "hoste", "d", " ", "site", " ", "are", " ", "different", ",", "\\", "10", ";", "\t\t\t", "\t", " ", "then", " ", "tha", "t", " ", "coul", "d", " ", "well", " ", "be", " ", "a", " ", "cross", "-", "site", " ", "script", "ing", " ", "(", "XS", "S", ")", " ", "attac", "k", ".", " ", "So", ",", " ", "the", " ", "workar", "ound", " ", "is", " ", "to", "\\", "10", ";", "\t\t\t", "\t", " ", "do", " ", "the", " ", "call", " ", "from", " ", "a", " ", "script", " ", "tag", " ", "so", " ", "the", " ", "JSO", "N", " ", "we", " ", "get", " ", "back", " ", "is", " ", "part", " ", "of", " ", "the", " ", "document", ".", "\\", "10", ";", "\t\t\t", "\t", " ", "Bu", "t", " ", "sinc", "e", " ", "we", " ", "don", "'", "t", " ", "know", " ", "what", " ", "URL", " ", "to", " ", "hit", " ", "ye", "t", ",", " ", "onc", "e", " ", "we", " ", "find", " ", "out", " ", "then", " ", "we", " ", "have", " ", "to", " ", "inject", "\\", "10", ";", "\t\t\t", "\t", " ", "a", " ", "new", " ", "script", " ", "tag", " ", "dynami", "call", "y", " ", "whi", "ch", " ", "the", " ", "browse", "r", " ", "will", " ", "run", " ", "as", " ", "soo", "n", " ", "as", " ", "we", " ", "append", " ", "it", ".", "\\", "10", ";", "\t\t\t", "\t", " ", "To", " ", "be", " ", "hone", "st", " ", "I", "'", "m", " ", "not", " ", "100", "%", " ", "wh", "y", " ", "Goo", "gle", " ", "use", " ", "REST", "ful", " ", "service", "s", " ", "and", " ", "not", " ", "JSO", "N", "-", "RP", "C", " ", "or", " ", "some", "suc", "h", ",", "\\", "10", ";", "\t\t\t", "\t", " ", "whi", "ch", " ", "wou", "ld", " ", "be", " ", "easi", "er", ".", " ", "Wel", "l", ",", " ", "easi", "er", " ", "for", " ", "me", ".'''_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "ID", "Panel_", "=_", "Horiz", "onta", "l", "Panel_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "ID", "Panel_", "._", "add_", "(_", "Label_", "(_", "\"", "Enter", " ", "google", " ", "account", ":\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "ID", "Button_", "=_", "Button_", "(_", "\"", "Go", "\"_", ",_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "ID", "Box_", "=_", "Text", "Box_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "ID", "Box_", "._", "set", "Text_", "(_", "self_", "._", "userid_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "ID", "Panel_", "._", "add_", "(_", "self_", "._", "ID", "Box_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "ID", "Panel_", "._", "add_", "(_", "self_", "._", "ID", "Button_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "vp_", "._", "add_", "(_", "self_", "._", "ID", "Panel_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "vp_", "._", "add_", "(_", "self_", "._", "discl", "osu", "re_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "vp_", "._", "add_", "(_", "self_", "._", "grid_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "init", "Widget_", "(_", "self_", "._", "vp_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Photos", "_", "(_", "Composit", "e_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "do", "REST", "Query_", "(_", "self_", ",_", "url_", ",_", "timer_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "this", " ", "is", " ", "a", " ", "total", "ly", " ", "different", " ", "from", " ", "an", " ", "RP", "C", " ", "call", " ", "in", " ", "tha", "t", " ", "we", " ", "have", " ", "to", "\\", "10", ";", " ", " ", " ", "dynami", "call", "y", " ", "add", " ", "script", " ", "tags", " ", "to", " ", "the", " ", "DOM", " ", "whe", "n", " ", "we", " ", "want", " ", "to", " ", "query", " ", "the", "\\", "10", ";", " ", " ", " ", "REST", " ", "API", ".", " ", "The", "se", " ", "rely", " ", "on", " ", "callback", "s", " ", "in", " ", "the", " ", "DOM", " ", "so", " ", "we", " ", "can", " ", "eit", "her", " ", "add", "\\", "10", ";", " ", " ", " ", "them", " ", "dynami", "call", "y", " ", "or", " ", "pre", "-", "defin", "e", " ", "them", " ", "in", " ", "public", "/", "Main", ".", "html", ".", "\\", "10", ";", " ", " ", " ", "On", "ce", " ", "we", "'", "ve", " ", "don", "e", " ", "tha", "t", " ", "have", " ", "to", " ", "wait", " ", "for", " ", "the", " ", "response", ".", "\\", "10", ";", " ", " ", " ", "Whi", "ch", " ", "means", " ", "we", " ", "need", " ", "to", " ", "provide", " ", "a", " ", "listen", "er", " ", "for", " ", "the", " ", "timer", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "new", "\\u", "script_", "=_", "DOM_", "._", "create", "Element_", "(_", "\"", "script", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "DOM_", "._", "set", "Ele", "m", "Attribute_", "(_", "new", "\\u", "script_", ",_", "\"", "src", "\"_", ",_", "url_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "DOM_", "._", "set", "Ele", "m", "Attribute_", "(_", "new", "\\u", "script_", ",_", "\"", "type", "\"_", ",_", "\"", "text", "/", "javascript", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "doc_", "(_", ")_", "._", "body_", "._", "append", "Child_", "(_", "new", "\\u", "script_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "timer_", "._", "schedule_", "(_", "100_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Photos", "_", "(_", "Composit", "e_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "on", "Cel", "l", "Clicked_", "(_", "self_", ",_", "sender_", ",_", "row_", ",_", "col_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "drill", "_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "drill", "_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "vp_", "._", "clear_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "grid_", "._", "clear_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "vp_", "._", "add_", "(_", "self_", "._", "up_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "vp_", "._", "add_", "(_", "self_", "._", "grid_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "grid", "cols_", "=_", "self_", "._", "grid_", "._", "get", "Colum", "n", "Count_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "album_", "=_", "self_", "._", "albums_", "[_", "row_", "+_", "col_", "+_", "(_", "row_", "*_", "(_", "grid", "cols_", "-_", "1_", ")_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "url_", "=_", "\"", "http", "://", "pica", "saw", "eb", ".", "google", ".", "com", "/", "data", "/", "feed", "/", "base", "/", "user", "/\"_", "+_", "self_", "._", "userid_", "+_", "\"/", "album", "id", "/\"_", "+_", "album_", "[_", "\"", "id", "\"_", "]_", "+_", "\"?", "alt", "=", "json", "-", "in", "-", "script", "&", "kind", "=", "photo", "&", "hl", "=", "en", "\\u", "US", "&", "callback", "=", "rest", "Cb", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "do", "REST", "Query_", "(_", "url_", ",_", "self_", "._", "timer_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "self_", "._", "drill", "_", "==_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "drill", "_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "grid", "cols_", "=_", "self_", "._", "grid_", "._", "get", "Colum", "n", "Count_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "pos_", "=_", "row_", "+_", "col_", "+_", "(_", "row_", "*_", "(_", "grid", "cols_", "-_", "1_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "photo_", "=_", "self_", "._", "photos_", "[_", "self_", "._", "pos_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "vp_", "._", "clear_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "fulls", "ize_", "=_", "HTML_", "(_", "'<", "img", " ", "src", "=\"'_", "+_", "photo_", "[_", "\"", "full", "\"_", "]_", "+_", "'\"", "/>'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "hp_", "=_", "Horiz", "onta", "l", "Panel_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "hp_", "._", "add_", "(_", "self_", "._", "up_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "hp_", "._", "add_", "(_", "self_", "._", "prev_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "hp_", "._", "add_", "(_", "self_", "._", "next_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "hp_", "._", "set", "Spacing_", "(_", "8_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "vp_", "._", "add_", "(_", "hp_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "vp_", "._", "add_", "(_", "self_", "._", "fulls", "ize_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Photos", "_", "(_", "Composit", "e_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "on", "Click_", "(_", "self_", ",_", "sender_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "sender_", "==_", "self_", "._", "ID", "Button_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "userid_", "=_", "self_", "._", "ID", "Box_", "._", "get", "Text_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "userid_", "==_", "\"\"_", "or_", "self_", "._", "userid_", "._", "isdigit_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "drill", "_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "album", "\\u", "url_", "=_", "\"", "http", "://", "pica", "saw", "eb", ".", "google", ".", "com", "/", "data", "/", "feed", "/", "base", "/", "user", "/\"_", "+_", "self_", "._", "userid_", "+_", "\"?", "alt", "=", "json", "-", "in", "-", "script", "&", "kind", "=", "album", "&", "hl", "=", "en", "\\u", "US", "&", "callback", "=", "rest", "Cb", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "grid_", "._", "clear_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "do", "REST", "Query_", "(_", "self_", "._", "album", "\\u", "url_", ",_", "self_", "._", "timer_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "drill", "_", "==_", "2_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "sender_", "==_", "self_", "._", "up_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "self_", "._", "drill", "_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "vp_", "._", "clear_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "vp_", "._", "add_", "(_", "self_", "._", "up_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "vp_", "._", "add_", "(_", "self_", "._", "grid_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "fill", "Grid_", "(_", "self_", "._", "photos_", ",_", "\"", "photo", "s", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "sender_", "==_", "self_", "._", "next_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "if_", "self_", "._", "pos_", ">=_", "len_", "(_", "self_", "._", "photos_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "pos_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "sender_", "==_", "self_", "._", "prev_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "if_", "self_", "._", "pos_", "<_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "pos_", "-=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "photo_", "=_", "self_", "._", "photos_", "[_", "self_", "._", "pos_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "fulls", "ize_", "._", "set", "HTML_", "(_", "'<", "img", " ", "src", "=\"'_", "+_", "photo_", "[_", "\"", "full", "\"_", "]_", "+_", "'\"", "/>'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "self_", "._", "drill", "_", "==_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "drill", "_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "vp_", "._", "clear_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "vp_", "._", "add_", "(_", "self_", "._", "ID", "Panel_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "vp_", "._", "add_", "(_", "self_", "._", "discl", "osu", "re_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "vp_", "._", "add_", "(_", "self_", "._", "grid_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "fill", "Grid_", "(_", "self_", "._", "albums_", ",_", "\"", "album", "s", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Photos", "_", "(_", "Composit", "e_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "on", "Timer_", "(_", "self_", ",_", "timer_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "fd_", "=_", "doc_", "(_", ")_", "._", "get", "Element", "By", "Id_", "(_", "\"\\u\\u", "pyg", "wt", "\\u", "hidden", "Data", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "receiver_", "=_", "fd_", "._", "inner", "HTML_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "receiver_", "==_", "'", "wait", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "timer_", "._", "schedule_", "(_", "1000_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "fd_", "._", "inner", "HTML_", "=_", "'", "wait", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "self_", "._", "drill", "_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "parse", "Alb", "ums_", "(_", "receiver_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "fill", "Grid_", "(_", "self_", "._", "albums_", ",_", "\"", "album", "s", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "self_", "._", "drill", "_", "==_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "parse", "Photos", "_", "(_", "receiver_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "fill", "Grid_", "(_", "self_", "._", "photos_", ",_", "\"", "photo", "s", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Photos", "_", "(_", "Composit", "e_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "fill", "Grid_", "(_", "self_", ",_", "items_", ",_", "type_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "grid_", "._", "clear_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cols_", "=_", "self_", "._", "grid_", "._", "get", "Colum", "n", "Count_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "grid_", "._", "resiz", "e", "Rows_", "(_", "(_", "len_", "(_", "items_", ")_", "/_", "cols_", ")_", "+_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rows_", "=_", "self_", "._", "grid_", "._", "get", "Row", "Count_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", "in_", "range_", "(_", "len_", "(_", "items_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "vp_", "=_", "Vertica", "l", "Panel_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "type_", "==_", "'", "photo", "s", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "vp_", "._", "add_", "(_", "items_", "[_", "i_", "]_", "[_", "'", "thumb", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "vp_", "._", "add_", "(_", "items_", "[_", "i_", "]_", "[_", "'", "thumb", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "vp_", "._", "add_", "(_", "items_", "[_", "i_", "]_", "[_", "'", "title", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "grid_", "._", "set", "Widget_", "(_", "int_", "(_", "i_", "/_", "cols_", ")_", ",_", "i_", "%_", "cols_", ",_", "vp_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Photos", "_", "(_", "Composit", "e_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "parse", "Photos", "_", "(_", "self_", ",_", "items_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "photo", "\\u", "list_", "=_", "json_", "._", "loads_", "(_", "items_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "photos_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "ph_", "in_", "photo", "\\u", "list_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "aph", "oto", "_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "aph", "oto", "_", "[_", "'", "thumb", "'_", "]_", "=_", "HTML_", "(_", "'<", "img", " ", "src", "=\"'_", "+_", "ph_", "[_", "u", "\"", "media", "$", "group", "\"_", "]_", "[_", "u", "\"", "media", "$", "thumbnail", "\"_", "]_", "[_", "1_", "]_", "[_", "u", "\"", "url", "\"_", "]_", "+_", "'\"", "/>'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "aph", "oto", "_", "[_", "'", "full", "'_", "]_", "=_", "ph_", "[_", "u", "\"", "media", "$", "group", "\"_", "]_", "[_", "u", "\"", "media", "$", "content", "\"_", "]_", "[_", "0_", "]_", "[_", "u", "\"", "url", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "photos_", "._", "append_", "(_", "aph", "oto", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Photos", "_", "(_", "Composit", "e_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "parse", "Alb", "ums_", "(_", "self_", ",_", "items_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "album", "\\u", "list_", "=_", "json_", "._", "loads_", "(_", "items_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "albums_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "al_", "in_", "album", "\\u", "list_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "anal", "bu", "m_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "anal", "bu", "m_", "[_", "'", "title", "'_", "]_", "=_", "HTML_", "(_", "al_", "[_", "u", "\"", "title", "\"_", "]_", "[_", "u", "\"$", "t", "\"_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "anal", "bu", "m_", "[_", "'", "thumb", "'_", "]_", "=_", "HTML_", "(_", "'<", "img", " ", "src", "=\"'_", "+_", "al_", "[_", "u", "\"", "media", "$", "group", "\"_", "]_", "[_", "u", "\"", "media", "$", "thumbnail", "\"_", "]_", "[_", "0_", "]_", "[_", "u", "\"", "url", "\"_", "]_", "+_", "'\"", "/>'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "url_", "=_", "al_", "[_", "u", "\"", "id", "\"_", "]_", "[_", "u", "\"$", "t", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "anal", "bu", "m_", "[_", "'", "id", "'_", "]_", "=_", "url_", "._", "split_", "(_", "u", "'", "album", "id", "/'_", ")_", "[_", "1_", "]_", "._", "split_", "(_", "u", "'?", "alt", "'_", ")_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "albums_", "._", "append_", "(_", "anal", "bu", "m_", ")_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2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2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
viewfinderco/viewfinder/backend/db/analytics.py
[ { "content": "# Copyright 2013 Viewfinder Inc. All Rights Reserved.\n\n\"\"\"Analytics table.\n\nEach row is composed of:\n- hash key: entity: <type>:<id> (eg: us:112 for user_id 112)\n- range key: base64 timestamp + type\n- column 'type': string describing the entry\n- column 'payload': optional payload. format based on the type of entry.\n\n\"\"\"\n\n__author__ = '[email protected] (Marc Berhault)'\n\nimport json\nimport logging\nimport os\nimport time\n\nfrom tornado import gen\nfrom viewfinder.backend.base import constants, util\nfrom viewfinder.backend.base.dotdict import DotDict\nfrom viewfinder.backend.db import vf_schema\nfrom viewfinder.backend.db.base import DBObject\nfrom viewfinder.backend.db.range_base import DBRangeObject\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class Analytics(DBRangeObject):\n\n # Type strings. They should consist of: <Type>.<Action>. eg: User.CreateProspective\n\n # Payload for prospective:\n # - \"register\" for prospective user created inline with registration.\n # - \"share_new=id\" with user_id of the user starting the conversation.\n # - \"add_followed=id\" with user_id of the user performing the add_follower op.\n USER_CREATE_PROSPECTIVE = 'User.CreateProspective'\n\n USER_REGISTER = 'User.Register'\n\n # Payload for terminate:\n # - \"terminate\" on account termination.\n # - \"merge=id\" when merging accounts. id is the target user.\n USER_TERMINATE = 'User.Terminate'\n\n _table = DBObject._schema.GetTable(vf_schema.ANALYTICS)\n\n\n", "metadata": "root.Analytics", "header": "['module', '___EOS___']", "index": 26 }, { "content": " def __init__(self):\n super(Analytics, self).__init__()", "metadata": "root.Analytics.__init__", "header": "['class', 'Analytics', '(', 'DBRangeObject', ')', ':', '___NEWLINE___', '___NL___', '# Type strings. They should consist of: <Type>.<Action>. eg: User.CreateProspective', '___NL___', '___NL___', '# Payload for prospective:', '___NL___', '# - \"register\" for prospective user created inline with registration.', '___NL___', '# - \"share_new=id\" with user_id of the user starting the conversation.', '___NL___', '# - \"add_followed=id\" with user_id of the user performing the add_follower op.', '___NL___', '___EOS___']", "index": 45 }, { "content": " @classmethod\n def CreateSortKey(cls, timestamp, entry_type):\n \"\"\"Create value for sort_key attribute. This is derived from timestamp and type.\"\"\"\n prefix = util.CreateSortKeyPrefix(timestamp, randomness=False)\n return prefix + entry_type", "metadata": "root.Analytics.CreateSortKey", "header": "['class', 'Analytics', '(', 'DBRangeObject', ')', ':', '___NEWLINE___', '___NL___', '# Type strings. They should consist of: <Type>.<Action>. eg: User.CreateProspective', '___NL___', '___NL___', '# Payload for prospective:', '___NL___', '# - \"register\" for prospective user created inline with registration.', '___NL___', '# - \"share_new=id\" with user_id of the user starting the conversation.', '___NL___', '# - \"add_followed=id\" with user_id of the user performing the add_follower op.', '___NL___', '___EOS___']", "index": 48 }, { "content": " @classmethod\n def Create(cls, **analytics_dict):\n \"\"\"Create a new analytics object with fields from 'analytics_dict'. Sets timestamp if not\n specified. Payload may be empty.\n \"\"\"\n create_dict = analytics_dict\n if 'timestamp' not in create_dict:\n create_dict['timestamp'] = util.GetCurrentTimestamp()\n\n entity = create_dict['entity']\n entry_type = create_dict['type']\n if entry_type.startswith('User.'):\n assert entity.startswith('us:'), 'Wrong entity string for type User.*: %r' % create_dict\n\n # Always store as int, floats cause problems as sort keys.\n create_dict['timestamp'] = int(create_dict['timestamp'])\n create_dict['sort_key'] = Analytics.CreateSortKey(create_dict['timestamp'], create_dict['type'])\n\n return cls.CreateFromKeywords(**create_dict)", "metadata": "root.Analytics.Create", "header": "['class', 'Analytics', '(', 'DBRangeObject', ')', ':', '___NEWLINE___', '___NL___', '# Type strings. They should consist of: <Type>.<Action>. eg: User.CreateProspective', '___NL___', '___NL___', '# Payload for prospective:', '___NL___', '# - \"register\" for prospective user created inline with registration.', '___NL___', '# - \"share_new=id\" with user_id of the user starting the conversation.', '___NL___', '# - \"add_followed=id\" with user_id of the user performing the add_follower op.', '___NL___', '___EOS___']", "index": 54 } ]
[ { "span": "import json", "start_line": 14, "start_column": 0, "end_line": 14, "end_column": 11 }, { "span": "import logging", "start_line": 15, "start_column": 0, "end_line": 15, "end_column": 14 }, { "span": "import os", "start_line": 16, "start_column": 0, "end_line": 16, "end_column": 9 }, { "span": "import time", "start_line": 17, "start_column": 0, "end_line": 17, "end_column": 11 }, { "span": "from tornado import gen", "start_line": 19, "start_column": 0, "end_line": 19, "end_column": 23 }, { "span": "from viewfinder.backend.base import constants, util", "start_line": 20, "start_column": 0, "end_line": 20, "end_column": 51 }, { "span": "from viewfinder.backend.base.dotdict import DotDict", "start_line": 21, "start_column": 0, "end_line": 21, "end_column": 51 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "Copy", "right", " ", "2013", " ", "View", "finde", "r", " ", "Inc", ".", " ", "All", " ", "Rig", "hts", " ", "Reserve", "d", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\"\"\"", "Analy", "tic", "s", " ", "table", ".", "\\", "10", ";", "\\", "10", ";", "Ea", "ch", " ", "row", " ", "is", " ", "compose", "d", " ", "of", ":", "\\", "10", ";", "-", " ", "hash", " ", "key", ":", " ", "entity", ":", " ", "<", "type", ">:", "<", "id", ">", " ", "(", "eg", ":", " ", "us", ":", "112", " ", "for", " ", "user", "\\u", "id", " ", "112", ")", "\\", "10", ";", "-", " ", "range", " ", "key", ":", " ", "base64", " ", "timestamp", " ", "+", " ", "type", "\\", "10", ";", "-", " ", "column", " ", "'", "type", "':", " ", "string", " ", "descri", "bing", " ", "the", " ", "entry", "\\", "10", ";", "-", " ", "column", " ", "'", "payload", "':", " ", "option", "al", " ", "payload", ".", " ", "format", " ", "based", " ", "on", " ", "the", " ", "type", " ", "of", " ", "entry", ".", "\\", "10", ";", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u", "author\\u\\u_", "=_", "'", "marc", "@", "email", "scrub", "bed", ".", "com", " ", "(", "Marc", " ", "Ber", "hau", "lt", ")'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "json_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "logging_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "time_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "tornado_", "import_", "gen_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "view", "finder_", "._", "backend_", "._", "base_", "import_", "constants_", ",_", "util_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "view", "finder_", "._", "backend_", "._", "base_", "._", "dot", "dict_", "import_", "Dot", "Dict_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "view", "finder_", "._", "backend_", "._", "db_", "import_", "vf", "\\u", "schema_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "view", "finder_", "._", "backend_", "._", "db_", "._", "base_", "import_", "DB", "Object_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "view", "finder_", "._", "backend_", "._", "db_", "._", "range", "\\u", "base_", "import_", "DB", "Range", "Object_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Analy", "tic", "s_", "(_", "DB", "Range", "Object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Type", " ", "string", "s", ".", " ", "The", "y", " ", "shou", "ld", " ", "consi", "st", " ", "of", ":", " ", "<", "Type", ">.", "<", "Action", ">.", " ", "eg", ":", " ", "User", ".", "Creat", "e", "Pro", "spect", "ive_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Pay", "load", " ", "for", " ", "prospe", "ctive", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "-", " ", "\"", "register", "\"", " ", "for", " ", "prospe", "ctive", " ", "user", " ", "created", " ", "inline", " ", "with", " ", "registration", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "-", " ", "\"", "share", "\\u", "new", "=", "id", "\"", " ", "with", " ", "user", "\\u", "id", " ", "of", " ", "the", " ", "user", " ", "startin", "g", " ", "the", " ", "conversation", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "-", " ", "\"", "add", "\\u", "followe", "d", "=", "id", "\"", " ", "with", " ", "user", "\\u", "id", " ", "of", " ", "the", " ", "user", " ", "perform", "ing", " ", "the", " ", "add", "\\u", "follower", " ", "op", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "USER", "\\u", "CREATE", "\\u", "PRO", "SPEC", "TIVE", "_", "=_", "'", "User", ".", "Creat", "e", "Pro", "spect", "ive", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "USER", "\\u", "REGISTER", "_", "=_", "'", "User", ".", "Register", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Pay", "load", " ", "for", " ", "terminate", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "-", " ", "\"", "terminate", "\"", " ", "on", " ", "account", " ", "termination", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "-", " ", "\"", "merge", "=", "id", "\"", " ", "whe", "n", " ", "mer", "ging", " ", "account", "s", ".", " ", "id", " ", "is", " ", "the", " ", "target", " ", "user", "._", "\\u\\u\\uNL\\u\\u\\u_", "USER", "\\u", "TERMINAT", "E_", "=_", "'", "User", ".", "Terminate", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "table_", "=_", "DB", "Object_", "._", "\\u", "schema_", "._", "Get", "Table_", "(_", "vf", "\\u", "schema_", "._", "ANALY", "TIC", "S_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Analy", "tic", "s_", "(_", "DB", "Range", "Object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Type", " ", "string", "s", ".", " ", "The", "y", " ", "shou", "ld", " ", "consi", "st", " ", "of", ":", " ", "<", "Type", ">.", "<", "Action", ">.", " ", "eg", ":", " ", "User", ".", "Creat", "e", "Pro", "spect", "ive_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Pay", "load", " ", "for", " ", "prospe", "ctive", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "-", " ", "\"", "register", "\"", " ", "for", " ", "prospe", "ctive", " ", "user", " ", "created", " ", "inline", " ", "with", " ", "registration", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "-", " ", "\"", "share", "\\u", "new", "=", "id", "\"", " ", "with", " ", "user", "\\u", "id", " ", "of", " ", "the", " ", "user", " ", "startin", "g", " ", "the", " ", "conversation", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "-", " ", "\"", "add", "\\u", "followe", "d", "=", "id", "\"", " ", "with", " ", "user", "\\u", "id", " ", "of", " ", "the", " ", "user", " ", "perform", "ing", " ", "the", " ", "add", "\\u", "follower", " ", "op", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "super_", "(_", "Analy", "tic", "s_", ",_", "self_", ")_", "._", "\\u\\u", "init\\u\\u_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Analy", "tic", "s_", "(_", "DB", "Range", "Object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Type", " ", "string", "s", ".", " ", "The", "y", " ", "shou", "ld", " ", "consi", "st", " ", "of", ":", " ", "<", "Type", ">.", "<", "Action", ">.", " ", "eg", ":", " ", "User", ".", "Creat", "e", "Pro", "spect", "ive_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Pay", "load", " ", "for", " ", "prospe", "ctive", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "-", " ", "\"", "register", "\"", " ", "for", " ", "prospe", "ctive", " ", "user", " ", "created", " ", "inline", " ", "with", " ", "registration", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "-", " ", "\"", "share", "\\u", "new", "=", "id", "\"", " ", "with", " ", "user", "\\u", "id", " ", "of", " ", "the", " ", "user", " ", "startin", "g", " ", "the", " ", "conversation", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "-", " ", "\"", "add", "\\u", "followe", "d", "=", "id", "\"", " ", "with", " ", "user", "\\u", "id", " ", "of", " ", "the", " ", "user", " ", "perform", "ing", " ", "the", " ", "add", "\\u", "follower", " ", "op", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "classmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "Creat", "e", "Sort", "Key_", "(_", "cls_", ",_", "timestamp_", ",_", "entry", "\\u", "type_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Creat", "e", " ", "value", " ", "for", " ", "sort", "\\u", "key", " ", "attribute", ".", " ", " ", "Thi", "s", " ", "is", " ", "derive", "d", " ", "from", " ", "timestamp", " ", "and", " ", "type", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "prefix_", "=_", "util_", "._", "Creat", "e", "Sort", "Key", "Prefix_", "(_", "timestamp_", ",_", "random", "ness_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "prefix_", "+_", "entry", "\\u", "type_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Analy", "tic", "s_", "(_", "DB", "Range", "Object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Type", " ", "string", "s", ".", " ", "The", "y", " ", "shou", "ld", " ", "consi", "st", " ", "of", ":", " ", "<", "Type", ">.", "<", "Action", ">.", " ", "eg", ":", " ", "User", ".", "Creat", "e", "Pro", "spect", "ive_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Pay", "load", " ", "for", " ", "prospe", "ctive", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "-", " ", "\"", "register", "\"", " ", "for", " ", "prospe", "ctive", " ", "user", " ", "created", " ", "inline", " ", "with", " ", "registration", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "-", " ", "\"", "share", "\\u", "new", "=", "id", "\"", " ", "with", " ", "user", "\\u", "id", " ", "of", " ", "the", " ", "user", " ", "startin", "g", " ", "the", " ", "conversation", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "-", " ", "\"", "add", "\\u", "followe", "d", "=", "id", "\"", " ", "with", " ", "user", "\\u", "id", " ", "of", " ", "the", " ", "user", " ", "perform", "ing", " ", "the", " ", "add", "\\u", "follower", " ", "op", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "classmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "Create_", "(_", "cls_", ",_", "**_", "analytics", "\\u", "dict_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Creat", "e", " ", "a", " ", "new", " ", "analytics", " ", "object", " ", "with", " ", "fields", " ", "from", " ", "'", "analytics", "\\u", "dict", "'.", " ", "Set", "s", " ", "timestamp", " ", "if", " ", "not", "\\", "10", ";", " ", " ", " ", " ", "specified", ".", " ", "Pay", "load", " ", "may", " ", "be", " ", "empty", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "create", "\\u", "dict_", "=_", "analytics", "\\u", "dict_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "'", "timestamp", "'_", "not_", "in_", "create", "\\u", "dict_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "create", "\\u", "dict_", "[_", "'", "timestamp", "'_", "]_", "=_", "util_", "._", "Get", "Curr", "ent", "Timestamp_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "entity_", "=_", "create", "\\u", "dict_", "[_", "'", "entity", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "entry", "\\u", "type_", "=_", "create", "\\u", "dict_", "[_", "'", "type", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "entry", "\\u", "type_", "._", "startswith_", "(_", "'", "User", ".'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "assert_", "entity_", "._", "startswith_", "(_", "'", "us", ":'_", ")_", ",_", "'", "Wro", "ng", " ", "entity", " ", "string", " ", "for", " ", "type", " ", "User", ".*", ":", " ", "%", "r", "'_", "%_", "create", "\\u", "dict_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Al", "way", "s", " ", "store", " ", "as", " ", "int", ",", " ", "float", "s", " ", "caus", "e", " ", "problem", "s", " ", "as", " ", "sort", " ", "keys", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "create", "\\u", "dict_", "[_", "'", "timestamp", "'_", "]_", "=_", "int_", "(_", "create", "\\u", "dict_", "[_", "'", "timestamp", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "create", "\\u", "dict_", "[_", "'", "sort", "\\u", "key", "'_", "]_", "=_", "Analy", "tic", "s_", "._", "Creat", "e", "Sort", "Key_", "(_", "create", "\\u", "dict_", "[_", "'",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2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
algorithmdog/Representation-based-Multilabel-Learning/train_common.py
[ { "content": "#!/bin/python\nimport sys\nimport os\n\nfrom latent_factor import *\nfrom arffio import *\nfrom common import *\nimport copy\nimport logging, Logger\nimport pickle\nimport numpy as np\nimport scipy.sparse as sp\nimport sampler\nimport random\nimport time\nfrom common import *\n\nnp.random.seed(0)\nrandom.seed(0)\n\n\n\n\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def checkParamValid(param):\n if param[\"op\"] == op.alternative_least_square:\n if act.linear != param[\"ha\"] or act.linear != param[\"oa\"]:\n print \"alternative_least_square optimization requires linear \"\\\n \"hidden_activation and output_activation\"\n return False;\n if m.internal_memory != param[\"m\"]:\n print \"alternative_least_square optimization requires not to use external_memory\"\n return False;\n\n if lo.negative_log_likelihood == param[\"l\"] and act.sgmoid != param[\"oa\"]:\n print \"negative_log_likelihood loss requires sgmoid output_activation\" \n return False;\n if lo.least_square == param[\"l\"] and act.linear != param[\"oa\"]:\n print \"least_square loss requires linear output_activation\"\n return False;\n\n return True;", "metadata": "root.checkParamValid", "header": "['module', '___EOS___']", "index": 21 }, { "content": "def train_internal(model, train_file, parameters):\n batch = parameters[\"b\"]\n niter = parameters[\"i\"]\n sample = sampler.get_sampler(parameters) \n logger = logging.getLogger(Logger.project_name)\n logger.info(\"Model initialization done\")\n\n train_reader = SvmReader(train_file)\n x, y = train_reader.full_read() \n num, _ = y.shape\n logger.info(\"Training data loading done\")\n\n sample.update(y)\n logger.info(\"Sampling initialization done\")\n start_time = time.time()\n\n if op.gradient == parameters[\"op\"]:\n for iter1 in xrange(niter):\n start = 0\n end = batch\n while start < num:\n #logger.info(\"start = %d, end = %d\\n\"%(start, end))\n if end > num: end = num\n \n# import cProfile, pstats, StringIO\n# pr = cProfile.Profile()\n# pr.enable()\n\n batch_x = x[start:end, :]\n batch_y = y[start:end, :] \n batch_i = sample.sample(batch_y)\n model.grad_update(batch_x, batch_y, batch_i) \n\n start += batch;\n end += batch;\n# pr.disable()\n# s = StringIO.StringIO()\n# sortby = 'cumulative'\n# ps = pstats.Stats(pr, stream = s).sort_stats(sortby)\n# ps.print_stats()\n# print \"update\",s.getvalue()\n \n logger.info(\"The %d-th iteration completes\"%(iter1+1)); \n elif op.alternative_least_square == parameters[\"op\"]:\n model.b[0] = np.zeros(model.b[0].shape)\n model.lb = np.zeros(model.lb.shape)\n\n for iter1 in xrange(niter):\n model.al_update(x, y, None)\n logger.info(\"The %d-th iteration completes\"%(iter1+1));\n\n else:\n logger.error(\"Invalid optimization scheme (%s)\"%paramters[\"op\"])\n\n #####tuning the threshold\n total = 0\n start = 0\n end = batch\n while start < num and total < 1000:\n if end > num: end = num\n batch_x = x[start:end,:]\n batch_y = y[start:end,:]\n batch_p = model.ff(batch_x)\n model.thrsel.update(batch_p, batch_y)\n start += batch\n end += batch\n total += 1\n\n logger.info(\"The threshold tuning completes\") \n end_time = time.time()\n logger.info(\"The training time is %f\"%(end_time-start_time))\n\n return model", "metadata": "root.train_internal", "header": "['module', '___EOS___']", "index": 41 }, { "content": "def train_external(model, train_file, parameters):\n\n batch = parameters[\"b\"]\n niter = parameters[\"i\"]\n sample = sampler.get_sampler(parameters)\n logger = logging.getLogger(Logger.project_name)\n\n\n ##initilization the sampler\n train_reader = SvmReader(train_file, batch)\n has_next = True\n while has_next:\n x,y,has_next = train_reader.read()\n sample.update(y)\n \n ##weight updates\n for iter1 in xrange(niter): \n train_reader = SvmReader(train_file, batch)\n \n has_next = True\n while has_next:\n x, y, has_next = train_reader.read()\n idx = sample.sample(y)\n model.grad_update(x, y, idx)\n\n logger.info(\"The %d-th iteration completes\"%(iter1+1)); \n train_reader.close()\n\n ##tuning threshold\n train_reader = SvmReader(train_file, batch)\n x, y, has_next = train_reader.read()\n while has_next:\n p = model.ff(x)\n model.thrsel.update(p, y)\n x, y, has_next = train_reader.read()\n \n\n return model", "metadata": "root.train_external", "header": "['module', '___EOS___']", "index": 116 } ]
[ { "span": "import sys", "start_line": 1, "start_column": 0, "end_line": 1, "end_column": 10 }, { "span": "import os", "start_line": 2, "start_column": 0, "end_line": 2, "end_column": 9 }, { "span": "import copy", "start_line": 7, "start_column": 0, "end_line": 7, "end_column": 11 }, { "span": "import pickle", "start_line": 9, "start_column": 0, "end_line": 9, "end_column": 13 }, { "span": "import scipy.sparse as sp", "start_line": 11, "start_column": 0, "end_line": 11, "end_column": 25 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#!", "/", "bin", "/", "python_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "latent", "\\u", "factor_", "import_", "*_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "arf", "fio", "_", "import_", "*_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "common_", "import_", "*_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "copy_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "logging_", ",_", "Logger_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "pickle_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "numpy_", "as_", "np_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "scipy_", "._", "sparse_", "as_", "sp_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "sampler_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "random_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "time_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "common_", "import_", "*_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "np_", "._", "random_", "._", "seed_", "(_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "random_", "._", "seed_", "(_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "check", "Param", "Valid_", "(_", "param_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "param_", "[_", "\"", "op", "\"_", "]_", "==_", "op_", "._", "alternative", "\\u", "leas", "t", "\\u", "square_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "act_", "._", "linear_", "!=_", "param_", "[_", "\"", "ha", "\"_", "]_", "or_", "act_", "._", "linear_", "!=_", "param_", "[_", "\"", "oa", "\"_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "\"", "alternative", "\\u", "leas", "t", "\\u", "square", " ", "optimization", " ", "require", "s", " ", "linear", " ", "\"_", "\"", "hidden", "\\u", "activation", " ", "and", " ", "output", "\\u", "activation", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "False_", ";_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "m_", "._", "internal", "\\u", "memory_", "!=_", "param_", "[_", "\"", "m", "\"_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "\"", "alternative", "\\u", "leas", "t", "\\u", "square", " ", "optimization", " ", "require", "s", " ", "not", " ", "to", " ", "use", " ", "external", "\\u", "memory", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "False_", ";_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "lo_", "._", "negati", "ve", "\\u", "log", "\\u", "likelihood_", "==_", "param_", "[_", "\"", "l", "\"_", "]_", "and_", "act_", "._", "sg", "moi", "d_", "!=_", "param_", "[_", "\"", "oa", "\"_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "\"", "negati", "ve", "\\u", "log", "\\u", "likelihood", " ", "loss", " ", "require", "s", " ", "sg", "moi", "d", " ", "output", "\\u", "activation", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "False_", ";_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "lo_", "._", "leas", "t", "\\u", "square_", "==_", "param_", "[_", "\"", "l", "\"_", "]_", "and_", "act_", "._", "linear_", "!=_", "param_", "[_", "\"", "oa", "\"_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "\"", "leas", "t", "\\u", "square", " ", "loss", " ", "require", "s", " ", "linear", " ", "output", "\\u", "activation", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "False_", ";_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "True_", ";_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "train", "\\u", "internal_", "(_", "model_", ",_", "train", "\\u", "file_", ",_", "parameters_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "batch_", "=_", "parameters_", "[_", "\"", "b", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "niter_", "=_", "parameters_", "[_", "\"", "i", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sample_", "=_", "sampler_", "._", "get", "\\u", "sampler_", "(_", "parameters_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logger_", "=_", "logging_", "._", "get", "Logger_", "(_", "Logger_", "._", "project", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logger_", "._", "info_", "(_", "\"", "Model", " ", "initialization", " ", "don", "e", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "train", "\\u", "reader_", "=_", "Sv", "m", "Reader_", "(_", "train", "\\u", "file_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "x_", ",_", "y_", "=_", "train", "\\u", "reader_", "._", "full", "\\u", "read_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "num_", ",_", "\\u_", "=_", "y_", "._", "shape_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logger_", "._", "info_", "(_", "\"", "Train", "ing", " ", "data", " ", "load", "ing", " ", "don", "e", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "sample_", "._", "update_", "(_", "y_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logger_", "._", "info_", "(_", "\"", "Sampl", "ing", " ", "initialization", " ", "don", "e", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "start", "\\u", "time_", "=_", "time_", "._", "time_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "op_", "._", "gradient_", "==_", "parameters_", "[_", "\"", "op", "\"_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "iter", "1_", "in_", "xrange_", "(_", "niter_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "start_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "end_", "=_", "batch_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "start_", "<_", "num_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "logg", "er", ".", "info", "(\"", "start", " ", "=", " ", "%", "d", ",", " ", "end", " ", "=", " ", "%", "d", "\\\\", "n", "\"%", "(", "start", ",", " ", "end", "))", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "end_", ">_", "num_", ":_", "end_", "=_", "num_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "import", " ", "c", "Profil", "e", ",", " ", "pstat", "s", ",", " ", "String", "IO_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "pr", " ", "=", " ", " ", "c", "Profil", "e", ".", "Profil", "e", "()", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "pr", ".", "enable", "()", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "batch", "\\u", "x_", "=_", "x_", "[_", "start_", ":_", "end_", ",_", ":_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "batch", "\\u", "y_", "=_", "y_", "[_", "start_", ":_", "end_", ",_", ":_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "batch", "\\u", "i_", "=_", "sample_", "._", "sample_", "(_", "batch", "\\u", "y_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "model_", "._", "grad", "\\u", "update_", "(_", "batch", "\\u", "x_", ",_", "batch", "\\u", "y_", ",_", "batch", "\\u", "i_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "start_", "+=_", "batch_", ";_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "end_", "+=_", "batch_", ";_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", " ", " ", "pr", ".", "disable", "()", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "s", " ", "=", " ", "String", "IO", ".", "String", "IO", "()", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "sortby", " ", "=", " ", "'", "cumul", "ative", "'_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "ps", " ", "=", " ", "pstat", "s", ".", "Stat", "s", "(", "pr", ",", " ", "stream", " ", "=", " ", "s", ").", "sort", "\\u", "stats", "(", "sortby", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "ps", ".", "print", "\\u", "stats", "()", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "print", " ", "\"", "update", "\",", "s", ".", "getv", "alu", "e", "()", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "logger_", "._", "info_", "(_", "\"", "The", " ", "%", "d", "-", "th", " ", "iterati", "on", " ", "complete", "s", "\"_", "%_", "(_", "iter", "1_", "+_", "1_", ")_", ")_", ";_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "op_", "._", "alternative", "\\u", "leas", "t", "\\u", "square_", "==_", "parameters_", "[_", "\"", "op", "\"_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "model_", "._", "b_", "[_", "0_", "]_", "=_", "np_", "._", "zeros_", "(_", "model_", "._", "b_", "[_", "0_", "]_", "._", "shape_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "model_", "._", "lb_", "=_", "np_", "._", "zeros_", "(_", "model_", "._", "lb_", "._", "shape_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "iter", "1_", "in_", "xrange_", "(_", "niter_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "model_", "._", "al", "\\u", "update_", "(_", "x_", ",_", "y_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logger_", "._", "info_", "(_", "\"", "The", " ", "%", "d", "-", "th", " ", "iterati", "on", " ", "complete", "s", "\"_", "%_", "(_", "iter", "1_", "+_", "1_", ")_", ")_", ";_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logger_", "._", "error_", "(_", "\"", "Inva", "lid", " ", "optimization", " ", "sche", "me", " ", "(%", "s", ")\"_", "%_", "param", "ters_", "[_", "\"", "op", "\"_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#####", "tuning", " ", "the", " ", "threshold_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "total_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "start_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "end_", "=_", "batch_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "start_", "<_", "num_", "and_", "total_", "<_", "1000_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "end_", ">_", "num_", ":_", "end_", "=_", "num_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "batch", "\\u", "x_", "=_", "x_", "[_", "start_", ":_", "end_", ",_", ":_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "batch", "\\u", "y_", "=_", "y_", "[_", "start_", ":_", "end_", ",_", ":_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "batch", "\\u", "p_", "=_", "model_", "._", "ff_", "(_", "batch", "\\u", "x_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "model_", "._", "thr", "sel_", "._", "update_", "(_", "batch", "\\u", "p_", ",_", "batch", "\\u", "y_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "start_", "+=_", "batch_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "end_", "+=_", "batch_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "total_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "logger_", "._", "info_", "(_", "\"", "The", " ", "threshol", "d", " ", "tuning", " ", "complete", "s", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "end", "\\u", "time_", "=_", "time_", "._", "time_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logger_", "._", "info_", "(_", "\"", "The", " ", "train", "ing", " ", "time", " ", "is", " ", "%", "f", "\"_", "%_", "(_", "end", "\\u", "time_", "-_", "start", "\\u", "time_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "model_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "train", "\\u", "external_", "(_", "model_", ",_", "train", "\\u", "file_", ",_", "parameters_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "batch_", "=_", "parameters_", "[_", "\"", "b", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "niter_", "=_", "parameters_", "[_", "\"", "i", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sample_", "=_", "sampler_", "._", "get", "\\u", "sampler_", "(_", "parameters_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logger_", "=_", "logging_", "._", "get", "Logger_", "(_", "Logger_", "._", "project", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "##", "init", "iliz", "ation", " ", "the", " ", "sampler_", "\\u\\u\\uNL\\u\\u\\u_", "train", "\\u", "reader_", "=_", "Sv", "m", "Reader_", "(_", "train", "\\u", "file_", ",_", "batch_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "has", "\\u", "next_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "has", "\\u", "next_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "x_", ",_", "y_", ",_", "has", "\\u", "next_", "=_", "train", "\\u", "reader_", "._", "read_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sample_", "._", "update_", "(_", "y_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "##", "weight", " ", "updates_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "iter", "1_", "in_", "xrange_", "(_", "niter_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "train", "\\u", "reader_", "=_", "Sv", "m", "Reader_", "(_", "train", "\\u", "file_", ",_", "batch_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "has", "\\u", "next_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "has", "\\u", "next_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "x_", ",_", "y_", ",_", "has", "\\u", "next_", "=_", "train", "\\u", "reader_", "._", "read_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "idx_", "=_", "sample_", "._", "sample_", "(_", "y_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "model_", "._", "grad", "\\u", "update_", "(_", "x_", ",_", "y_", ",_", "idx_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "logger_", "._", "info_", "(_", "\"", "The", " ", "%", "d", "-", "th", " ", "iterati", "on", " ", "complete", "s", "\"_", "%_", "(_", "iter", "1_", "+_", "1_", ")_", ")_", ";_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "train", "\\u", "reader_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "##", "tuning", " ", "threshold_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "train", "\\u", "reader_", "=_", "Sv", "m", "Reader_", "(_", "train", "\\u", "file_", ",_", "batch_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "x_", ",_", "y_", ",_", "has", "\\u", "next_", "=_", "train", "\\u", "reader_", "._", "read_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "has", "\\u", "next_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "p_", "=_", "model_", "._", "ff_", "(_", "x_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "model_", "._", "thr", "sel_", "._", "update_", "(_", "p_", ",_", "y_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "x_", ",_", "y_", ",_", "has", "\\u", "next_", "=_", "train", "\\u", "reader_", "._", "read_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "model_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 2, 0, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 2, 2, 2, 2, 2, 2, 0, 1, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused local variable
daeilkim/refinery/refinery/bnpy/bnpy-dev/bnpy/learnalg/BirthMove.py
[ { "content": "def viz_birth_proposal_2D(curModel, newModel, ktarget, freshCompIDs,\n title1='Before Birth',\n title2='After Birth'):\n ''' Create before/after visualization of a birth move (in 2D)\n '''\n from ..viz import GaussViz, BarsViz\n from matplotlib import pylab\n\n fig = pylab.figure()\n h1 = pylab.subplot(1,2,1)\n\n if curModel.obsModel.__class__.__name__.count('Gauss'):\n GaussViz.plotGauss2DFromHModel(curModel, compsToHighlight=ktarget)\n else:\n BarsViz.plotBarsFromHModel(curModel, compsToHighlight=ktarget, figH=h1)\n pylab.title(title1)\n \n h2 = pylab.subplot(1,2,2)\n if curModel.obsModel.__class__.__name__.count('Gauss'):\n GaussViz.plotGauss2DFromHModel(newModel, compsToHighlight=freshCompIDs)\n else:\n BarsViz.plotBarsFromHModel(newModel, compsToHighlight=freshCompIDs, figH=h2)\n pylab.title(title2)\n pylab.show(block=False)\n try: \n x = raw_input('Press any key to continue >>')\n except KeyboardInterrupt:\n import sys\n sys.exit(-1)\n pylab.close()", "metadata": "root.viz_birth_proposal_2D", "header": "['module', '___EOS___']", "index": 402 } ]
[ { "span": "fig ", "start_line": 410, "start_column": 2, "end_line": 410, "end_column": 5 }, { "span": "x ", "start_line": 427, "start_column": 4, "end_line": 427, "end_column": 5 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "viz", "\\u", "birth", "\\u", "propos", "al", "\\u", "2", "D_", "(_", "cur", "Model_", ",_", "new", "Model_", ",_", "kt", "arget", "_", ",_", "fresh", "Comp", "ID", "s_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "title", "1_", "=_", "'", "Be", "fore", " ", "Birth", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "title", "2_", "=_", "'", "Af", "ter", " ", "Birth", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", " ", "Creat", "e", " ", "bef", "ore", "/", "after", " ", "visualization", " ", "of", " ", "a", " ", "birth", " ", "move", " ", "(", "in", " ", "2", "D", ")", "\\", "10", ";", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "._", "._", "viz_", "import_", "Gau", "ss", "Viz", "_", ",_", "Bar", "s", "Viz", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "matplotlib_", "import_", "pylab_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "fig_", "=_", "pylab_", "._", "figure_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "h1_", "=_", "pylab_", "._", "subplot_", "(_", "1_", ",_", "2_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "cur", "Model_", "._", "obs", "Model_", "._", "\\u\\u", "class\\u\\u_", "._", "\\u\\u", "name\\u\\u_", "._", "count_", "(_", "'", "Gau", "ss", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Gau", "ss", "Viz", "_", "._", "plot", "Gau", "ss", "2", "DF", "rom", "HM", "odel_", "(_", "cur", "Model_", ",_", "comps", "To", "Highlight", "_", "=_", "kt", "arget", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Bar", "s", "Viz", "_", "._", "plot", "Bar", "s", "Fro", "m", "HM", "odel_", "(_", "cur", "Model_", ",_", "comps", "To", "Highlight", "_", "=_", "kt", "arget", "_", ",_", "fig", "H_", "=_", "h1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "pylab_", "._", "title_", "(_", "title", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "h2_", "=_", "pylab_", "._", "subplot_", "(_", "1_", ",_", "2_", ",_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "cur", "Model_", "._", "obs", "Model_", "._", "\\u\\u", "class\\u\\u_", "._", "\\u\\u", "name\\u\\u_", "._", "count_", "(_", "'", "Gau", "ss", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Gau", "ss", "Viz", "_", "._", "plot", "Gau", "ss", "2", "DF", "rom", "HM", "odel_", "(_", "new", "Model_", ",_", "comps", "To", "Highlight", "_", "=_", "fresh", "Comp", "ID", "s_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Bar", "s", "Viz", "_", "._", "plot", "Bar", "s", "Fro", "m", "HM", "odel_", "(_", "new", "Model_", ",_", "comps", "To", "Highlight", "_", "=_", "fresh", "Comp", "ID", "s_", ",_", "fig", "H_", "=_", "h2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "pylab_", "._", "title_", "(_", "title", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pylab_", "._", "show_", "(_", "block_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "x_", "=_", "raw", "\\u", "input_", "(_", "'", "Press", " ", "any", " ", "key", " ", "to", " ", "continue", " ", ">>'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Key", "board", "Interrupt_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "exit_", "(_", "-_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "pylab_", "._", "close_", "(_", ")_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused local variable
statsmodels/statsmodels/statsmodels/tsa/tests/results/results_ar.py
[ { "content": " def __init__(self, constant=True):\n self.avobs = 300.\n if constant:\n self.params = [ 6.7430535917332, 1.1649421971129, -.40535742259304,\n -.16653934246587, .14980629416032, -.09462417064796,\n .00491001240749, .0504665930841, -.08635349190816,\n .25349103194757]\n# These are returned by stata VAR, using the (V)AR scale/sigma\n# we return the true OLS bse by default\n# the stata residuals can be achived by np.sqrt(np.diag(res1.cov_params()))\n self.bse_stata = [2.413485601, .0560359041, .0874490762,\n .0900894414, .0899348339, .0900100797,\n .0898385666, .0896997939, .0869773089,\n .0559505756]\n# The below are grom gretl's ARIMA command with conditional maxium likelihood\n self.bse_gretl = [2.45474, 0.0569939, 0.0889440, 0.0916295,\n 0.0914723, 0.0915488, 0.0913744, 0.0912332,\n 0.0884642, 0.0569071]\n self.rmse = 15.1279294937327\n self.fpe = 236.4827257929261\n self.llf = -1235.559128419549\n#NOTE: we use a different definition of these ic than Stata\n# but our order selection results agree with R VARselect\n# close to Stata for Lutkepohl but we penalize the ic for the trend terms\n# self.bic = 8.427186938618863\n# self.aic = 8.30372752279699\n# self.hqic = 8.353136159250697\n\n#NOTE: predictions were taken from gretl, but agree with Stata\n # test predict\n#TODO: remove one of the files\n filename = os.path.join(os.path.dirname(os.path.abspath(__file__)),\n \"AROLSConstantPredict.csv\")\n predictresults = np.loadtxt(filename)\n fv = predictresults[:300,0]\n pv = predictresults[300:,1]\n pv_lb = predictresults[300:,2]\n pv_ub = predictresults[300:,3]\n pv_se = predictresults[300:,4]\n del predictresults\n\n # cases - in sample predict\n # n = -1, start = 0 (fitted values)\n self.FVOLSnneg1start0 = fv\n # n=-1, start=9\n self.FVOLSnneg1start9 = fv\n # n=-1, start=100\n self.FVOLSnneg1start100 = fv[100-9:]\n # n = 200, start = 0\n self.FVOLSn200start0 = fv[:192]\n # n = 200, start = 200\n self.FVOLSn200start200 = np.hstack((fv[200-9:],pv[:101-9]))\n # n = 200, start = -109 use above\n self.FVOLSn200startneg109 = self.FVOLSn200start200\n # n = 100, start = 325, post-sample forecasting\n self.FVOLSn100start325 = np.hstack((fv[-1],pv))\n # n = 301, start = 9\n self.FVOLSn301start9 = np.hstack((fv,pv[:2]))\n # n = 301, start = 0\n self.FVOLSdefault = fv\n # n = 4, start = 312\n self.FVOLSn4start312 = np.hstack((fv[-1],pv[:8]))\n # n = 15, start = 312\n self.FVOLSn15start312 = np.hstack((fv[-1],pv[:19]))\n\n\n elif not constant:\n self.params = [1.19582389902985, -0.40591818219637,\n -0.15813796884843, 0.16620079925202,\n -0.08570200254617, 0.01876298948686,\n 0.06130211910707, -0.08461507700047,\n 0.27995084653313]\n self.bse_stata = [.055645055, .088579237, .0912031179, .0909032462,\n .0911161784, .0908611473, .0907743174, .0880993504,\n .0558560278]\n self.bse_gretl = [0.0564990, 0.0899386, 0.0926027, 0.0922983,\n 0.0925145, 0.0922555, 0.0921674, 0.0894513,\n 0.0567132]\n self.rmse = 15.29712618677774\n self.sigma = 226.9820074869752\n self.llf = -1239.41217278661\n# See note above\n# self.bic = 8.433861292817106\n# self.hqic = 8.367215591385756\n# self.aic = 8.322747818577421\n self.fpe = 241.0221316614273\n filename = os.path.join(os.path.dirname(os.path.abspath(__file__)),\n \"AROLSNoConstantPredict.csv\")\n predictresults = np.loadtxt(filename)\n fv = predictresults[:300,0]\n pv = predictresults[300:,1]\n pv_lb = predictresults[300:,2]\n pv_ub = predictresults[300:,3]\n pv_se = predictresults[300:,4]\n del predictresults\n\n # cases - in sample predict\n # n = -1, start = 0 (fitted values)\n self.FVOLSnneg1start0 = fv\n # n=-1, start=9\n self.FVOLSnneg1start9 = fv\n # n=-1, start=100\n self.FVOLSnneg1start100 = fv[100-9:]\n # n = 200, start = 0\n self.FVOLSn200start0 = fv[:192]\n # n = 200, start = 200\n self.FVOLSn200start200 = np.hstack((fv[200-9:],pv[:101-9]))\n # n = 200, start = -109 use above\n self.FVOLSn200startneg109 = self.FVOLSn200start200\n # n = 100, start = 325, post-sample forecasting\n self.FVOLSn100start325 = np.hstack((fv[-1],pv))\n # n = 301, start = 9\n self.FVOLSn301start9 = np.hstack((fv,pv[:2]))\n # n = 301, start = 0\n self.FVOLSdefault = fv\n # n = 4, start = 312\n self.FVOLSn4start312 = np.hstack((fv[-1],pv[:8]))\n # n = 15, start = 312\n self.FVOLSn15start312 = np.hstack((fv[-1],pv[:19]))", "metadata": "root.ARResultsOLS.__init__", "header": "['class', 'ARResultsOLS', '(', 'object', ')', ':', '___EOS___']", "index": 44 }, { "content": " def __init__(self, constant=True):\n self.avobs = 300\n if constant:\n\n # NOTE: Stata's estimated parameters differ from gretl\n filename = os.path.join(os.path.dirname(os.path.abspath(__file__)),\n \"ARMLEConstantPredict.csv\")\n filename2 = os.path.join(os.path.dirname(os.path.abspath(__file__)),\n 'results_ar_forecast_mle_dynamic.csv')\n predictresults = np.loadtxt(filename, delimiter=\",\")\n year = predictresults[:,0]\n pv = predictresults[:,1]\n dynamicpv = np.genfromtxt(filename2, delimiter=\",\", skip_header=1)\n\n # cases - in sample predict\n # start = 0 (fitted values)\n self.FVMLEdefault = pv[:309]\n # start=9\n self.FVMLEstart9end308 = pv[9:309]\n # start=100, end=309\n self.FVMLEstart100end308 = pv[100:309]\n # start = 0, end\n self.FVMLEstart0end200 = pv[:201]\n # n = 200, start = 200\n self.FVMLEstart200end334 = pv[200:]\n # start = 309, end=334 post-sample forecasting\n self.FVMLEstart308end334 = pv[308:]\n # end = 310, start = 9\n self.FVMLEstart9end309 = pv[9:310]\n # end = 301, start = 0\n self.FVMLEstart0end301 = pv[:302]\n # end = 312, start = 4\n self.FVMLEstart4end312 = pv[4:313]\n # end = 7, start = 2\n self.FVMLEstart2end7 = pv[2:8]\n\n self.fcdyn = dynamicpv[:,0]\n self.fcdyn2 = dynamicpv[:,1]\n self.fcdyn3 = dynamicpv[:,2]\n self.fcdyn4 = dynamicpv[:,3]\n\n\n else:\n pass", "metadata": "root.ARResultsMLE.__init__", "header": "['class', 'ARResultsMLE', '(', 'object', ')', ':', '___EOS___']", "index": 171 } ]
[ { "span": "pv_lb ", "start_line": 80, "start_column": 12, "end_line": 80, "end_column": 17 }, { "span": "pv_ub ", "start_line": 81, "start_column": 12, "end_line": 81, "end_column": 17 }, { "span": "pv_se ", "start_line": 82, "start_column": 12, "end_line": 82, "end_column": 17 }, { "span": "pv_lb ", "start_line": 135, "start_column": 12, "end_line": 135, "end_column": 17 }, { "span": "pv_ub ", "start_line": 136, "start_column": 12, "end_line": 136, "end_column": 17 }, { "span": "pv_se ", "start_line": 137, "start_column": 12, "end_line": 137, "end_column": 17 }, { "span": "year ", "start_line": 181, "start_column": 12, "end_line": 181, "end_column": 16 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "ARR", "esult", "s", "OL", "S_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "constant_", "=_", "True_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "avo", "bs_", "=_", "300", "._", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "constant_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "params_", "=_", "[_", "6.7", "430", "535", "917", "332", "_", ",_", "1.1", "649", "421", "971", "129_", ",_", "-_", ".4", "053", "574", "225", "930", "4_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "-_", ".1", "665", "393", "424", "658", "7_", ",_", ".1", "498", "062", "941", "603", "2_", ",_", "-_", ".0", "946", "241", "706", "479", "6_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ".00", "491", "0012", "407", "49_", ",_", ".0", "504", "665", "930", "841", "_", ",_", "-_", ".0", "863", "534", "919", "081", "6_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ".2", "534", "910", "319", "475", "7_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "The", "se", " ", "are", " ", "return", "ed", " ", "by", " ", "stat", "a", " ", "VAR", ",", " ", "usi", "ng", " ", "the", " ", "(", "V", ")", "AR", " ", "scale", "/", "sigma_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "we", " ", "return", " ", "the", " ", "true", " ", "OL", "S", " ", "bse", " ", "by", " ", "default_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "the", " ", "stat", "a", " ", "residu", "als", " ", "can", " ", "be", " ", "achi", "ved", " ", "by", " ", "np", ".", "sqrt", "(", "np", ".", "diag", "(", "res", "1", ".", "cov", "\\u", "params", "())", ")_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "bse", "\\u", "stat", "a_", "=_", "[_", "2.4", "134", "856", "01_", ",_", ".0", "560", "359", "041", "_", ",_", ".0", "874", "490", "762", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ".0", "900", "894", "414", "_", ",_", ".0", "899", "348", "339", "_", ",_", ".0", "900", "1007", "97_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ".0", "898", "385", "666_", ",_", ".0", "896", "997", "939", "_", ",_", ".0", "869", "773", "089", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ".0", "559", "505", "756", "_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "The", " ", "belo", "w", " ", "are", " ", "gro", "m", " ", "gre", "tl", "'", "s", " ", "ARI", "MA", " ", "command", " ", "with", " ", "conditional", " ", "maxi", "um", " ", "likelihood_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "bse", "\\u", "gre", "tl_", "=_", "[_", "2.4", "547", "4_", ",_", "0.05", "699", "39_", ",_", "0.08", "894", "40_", ",_", "0.09", "162", "95_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "0.09", "147", "23_", ",_", "0.09", "154", "88_", ",_", "0.09", "137", "44_", ",_", "0.09", "123", "32_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "0.08", "846", "42_", ",_", "0.05", "690", "71_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "rmse", "_", "=_", "15.", "127", "929", "493", "732", "7_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "fp", "e_", "=_", "236", ".4", "827", "257", "929", "261_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "ll", "f_", "=_", "-_", "123", "5.5", "591", "284", "195", "49_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "NOTE", ":", " ", "we", " ", "use", " ", "a", " ", "different", " ", "definit", "ion", " ", "of", " ", "these", " ", "ic", " ", "than", " ", "Stat", "a_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "but", " ", "our", " ", "order", " ", "selection", " ", "results", " ", "agree", " ", "with", " ", "R", " ", "VAR", "select_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "close", " ", "to", " ", "Stat", "a", " ", "for", " ", "Lu", "tk", "epo", "hl", " ", "but", " ", "we", " ", "pen", "alize", " ", "the", " ", "ic", " ", "for", " ", "the", " ", "trend", " ", "terms_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "self", ".", "bic", " ", "=", " ", "8.4", "271", "869", "386", "188", "63_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "self", ".", "aic", " ", "=", " ", "8.3", "037", "275", "227", "969", "9_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "self", ".", "hq", "ic", " ", "=", " ", "8.3", "531", "361", "592", "506", "97_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "NOTE", ":", " ", "predicti", "ons", " ", "wer", "e", " ", "take", "n", " ", "from", " ", "gre", "tl", ",", " ", "but", " ", "agree", " ", "with", " ", "Stat", "a_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "test", " ", "predict_", "\\u\\u\\uNL\\u\\u\\u_", "#", "TOD", "O", ":", " ", "remove", " ", "one", " ", "of", " ", "the", " ", "files_", "\\u\\u\\uNL\\u\\u\\u_", "filename_", "=_", "os_", "._", "path_", "._", "join_", "(_", "os_", "._", "path_", "._", "dirname_", "(_", "os_", "._", "path_", "._", "abspath_", "(_", "\\u\\u", "file\\u\\u_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "AR", "OL", "SC", "ons", "tant", "Predic", "t", ".", "csv", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "predi", "ctr", "esult", "s_", "=_", "np_", "._", "loadtxt_", "(_", "filename_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fv_", "=_", "predi", "ctr", "esult", "s_", "[_", ":_", "300_", ",_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pv_", "=_", "predi", "ctr", "esult", "s_", "[_", "300_", ":_", ",_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pv", "\\u", "lb_", "=_", "predi", "ctr", "esult", "s_", "[_", "300_", ":_", ",_", "2_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pv", "\\u", "ub_", "=_", "predi", "ctr", "esult", "s_", "[_", "300_", ":_", ",_", "3_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pv", "\\u", "se_", "=_", "predi", "ctr", "esult", "s_", "[_", "300_", ":_", ",_", "4_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "del_", "predi", "ctr", "esult", "s_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "case", "s", " ", "-", " ", "in", " ", "sample", " ", "predict_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "n", " ", "=", " ", "-1", ",", " ", "start", " ", "=", " ", "0", " ", "(", "fitted", " ", "values", ")_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "FV", "OL", "Sn", "neg", "1s", "tart", "0_", "=_", "fv_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "n", "=-", "1", ",", " ", "start", "=", "9_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "FV", "OL", "Sn", "neg", "1s", "tart", "9_", "=_", "fv_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "n", "=-", "1", ",", " ", "start", "=", "100_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "FV", "OL", "Sn", "neg", "1s", "tart", "100_", "=_", "fv_", "[_", "100_", "-_", "9_", ":_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "n", " ", "=", " ", "200", ",", " ", "start", " ", "=", " ", "0_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "FV", "OL", "Sn", "200", "start", "0_", "=_", "fv_", "[_", ":_", "192_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "n", " ", "=", " ", "200", ",", " ", "start", " ", "=", " ", "200_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "FV", "OL", "Sn", "200", "start", "200_", "=_", "np_", "._", "hstack_", "(_", "(_", "fv_", "[_", "200_", "-_", "9_", ":_", "]_", ",_", "pv_", "[_", ":_", "101_", "-_", "9_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "n", " ", "=", " ", "200", ",", " ", "start", " ", "=", " ", "-1", "09", " ", "use", " ", "above_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "FV", "OL", "Sn", "200", "start", "neg", "109_", "=_", "self_", "._", "FV", "OL", "Sn", "200", "start", "200_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "n", " ", "=", " ", "100", ",", " ", "start", " ", "=", " ", "325", ",", " ", "post", "-", "sample", " ", "forecast", "ing_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "FV", "OL", "Sn", "100", "start", "325_", "=_", "np_", "._", "hstack_", "(_", "(_", "fv_", "[_", "-_", "1_", "]_", ",_", "pv_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "n", " ", "=", " ", "301", ",", " ", "start", " ", "=", " ", "9_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "FV", "OL", "Sn", "301", "start", "9_", "=_", "np_", "._", "hstack_", "(_", "(_", "fv_", ",_", "pv_", "[_", ":_", "2_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "n", " ", "=", " ", "301", ",", " ", "start", " ", "=", " ", "0_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "FV", "OL", "Sd", "efa", "ult_", "=_", "fv_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "n", " ", "=", " ", "4", ",", " ", "start", " ", "=", " ", "312_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "FV", "OL", "Sn", "4", "start", "312_", "=_", "np_", "._", "hstack_", "(_", "(_", "fv_", "[_", "-_", "1_", "]_", ",_", "pv_", "[_", ":_", "8_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "n", " ", "=", " ", "15", ",", " ", "start", " ", "=", " ", "312_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "FV", "OL", "Sn", "15", "start", "312_", "=_", "np_", "._", "hstack_", "(_", "(_", "fv_", "[_", "-_", "1_", "]_", ",_", "pv_", "[_", ":_", "19_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "not_", "constant_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "params_", "=_", "[_", "1.1", "958", "238", "990", "298", "5_", ",_", "-_", "0.40", "591", "818", "219", "637", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "-_", "0.15", "813", "796", "884", "843", "_", ",_", "0.16", "620", "079", "925", "202_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "-_", "0.08", "570", "2002", "546", "17_", ",_", "0.018", "762", "989", "486", "86_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "0.06", "130", "211", "910", "707", "_", ",_", "-_", "0.08", "461", "507", "7000", "47_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "0.27", "995", "084", "653", "313_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "bse", "\\u", "stat", "a_", "=_", "[_", ".0", "556", "450", "55_", ",_", ".0", "885", "792", "37_", ",_", ".0", "912", "031", "179_", ",_", ".0", "9090", "324", "62_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ".0", "911", "161", "784", "_", ",_", ".0", "908", "611", "473", "_", ",_", ".0", "907", "743", "174_", ",_", ".0", "880", "993", "504_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ".0", "558", "560", "278_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "bse", "\\u", "gre", "tl_", "=_", "[_", "0.05", "649", "90_", ",_", "0.08", "993", "86_", ",_", "0.09", "260", "27_", ",_", "0.09", "229", "83_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "0.09", "251", "45_", ",_", "0.09", "225", "55_", ",_", "0.09", "216", "74_", ",_", "0.08", "945", "13_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "0.05", "671", "32_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "rmse", "_", "=_", "15.", "297", "126", "186", "7777", "4_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "sigma_", "=_", "226", ".9", "820", "074", "869", "752", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "ll", "f_", "=_", "-_", "123", "9.4", "121", "727", "866", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "See", " ", "note", " ", "above_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "self", ".", "bic", " ", "=", " ", " ", "8.4", "338", "612", "928", "171", "06_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "self", ".", "hq", "ic", " ", "=", " ", " ", "8.3", "672", "155", "913", "857", "56_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "self", ".", "aic", " ", "=", " ", " ", "8.3", "227", "478", "185", "774", "21_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "fp", "e_", "=_", "241", ".02", "213", "166", "142", "73_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "filename_", "=_", "os_", "._", "path_", "._", "join_", "(_", "os_", "._", "path_", "._", "dirname_", "(_", "os_", "._", "path_", "._", "abspath_", "(_", "\\u\\u", "file\\u\\u_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "AR", "OL", "SN", "o", "Const", "ant", "Predic", "t", ".", "csv", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "predi", "ctr", "esult", "s_", "=_", "np_", "._", "loadtxt_", "(_", "filename_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fv_", "=_", "predi", "ctr", "esult", "s_", "[_", ":_", "300_", ",_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pv_", "=_", "predi", "ctr", "esult", "s_", "[_", "300_", ":_", ",_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pv", "\\u", "lb_", "=_", "predi", "ctr", "esult", "s_", "[_", "300_", ":_", ",_", "2_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pv", "\\u", "ub_", "=_", "predi", "ctr", "esult", "s_", "[_", "300_", ":_", ",_", "3_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pv", "\\u", "se_", "=_", "predi", "ctr", "esult", "s_", "[_", "300_", ":_", ",_", "4_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "del_", "predi", "ctr", "esult", "s_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "case", "s", " ", "-", " ", "in", " ", "sample", " ", "predict_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "n", " ", "=", " ", "-1", ",", " ", "start", " ", "=", " ", "0", " ", "(", "fitted", " ", "values", ")_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "FV", "OL", "Sn", "neg", "1s", "tart", "0_", "=_", "fv_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "n", "=-", "1", ",", " ", "start", "=", "9_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "FV", "OL", "Sn", "neg", "1s", "tart", "9_", "=_", "fv_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "n", "=-", "1", ",", " ", "start", "=", "100_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "FV", "OL", "Sn", "neg", "1s", "tart", "100_", "=_", "fv_", "[_", "100_", "-_", "9_", ":_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "n", " ", "=", " ", "200", ",", " ", "start", " ", "=", " ", "0_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "FV", "OL", "Sn", "200", "start", "0_", "=_", "fv_", "[_", ":_", "192_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "n", " ", "=", " ", "200", ",", " ", "start", " ", "=", " ", "200_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "FV", "OL", "Sn", "200", "start", "200_", "=_", "np_", "._", "hstack_", "(_", "(_", "fv_", "[_", "200_", "-_", "9_", ":_", "]_", ",_", "pv_", "[_", ":_", "101_", "-_", "9_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "n", " ", "=", " ", "200", ",", " ", "start", " ", "=", " ", "-1", "09", " ", "use", " ", "above_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "FV", "OL", "Sn", "200", "start", "neg", "109_", "=_", "self_", "._", "FV", "OL", "Sn", "200", "start", "200_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "n", " ", "=", " ", "100", ",", " ", "start", " ", "=", " ", "325", ",", " ", "post", "-", "sample", " ", "forecast", "ing_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "FV", "OL", "Sn", "100", "start", "325_", "=_", "np_", "._", "hstack_", "(_", "(_", "fv_", "[_", "-_", "1_", "]_", ",_", "pv_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "n", " ", "=", " ", "301", ",", " ", "start", " ", "=", " ", "9_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "FV", "OL", "Sn", "301", "start", "9_", "=_", "np_", "._", "hstack_", "(_", "(_", "fv_", ",_", "pv_", "[_", ":_", "2_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "n", " ", "=", " ", "301", ",", " ", "start", " ", "=", " ", "0_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "FV", "OL", "Sd", "efa", "ult_", "=_", "fv_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "n", " ", "=", " ", "4", ",", " ", "start", " ", "=", " ", "312_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "FV", "OL", "Sn", "4", "start", "312_", "=_", "np_", "._", "hstack_", "(_", "(_", "fv_", "[_", "-_", "1_", "]_", ",_", "pv_", "[_", ":_", "8_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "n", " ", "=", " ", "15", ",", " ", "start", " ", "=", " ", "312_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "FV", "OL", "Sn", "15", "start", "312_", "=_", "np_", "._", "hstack_", "(_", "(_", "fv_", "[_", "-_", "1_", "]_", ",_", "pv_", "[_", ":_", "19_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "ARR", "esult", "s", "ML", "E_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "constant_", "=_", "True_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "avo", "bs_", "=_", "300_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "constant_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "NOTE", ":", " ", "Stat", "a", "'", "s", " ", "estimate", "d", " ", "parameter", "s", " ", "differ", " ", "from", " ", "gre", "tl_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "filename_", "=_", "os_", "._", "path_", "._", "join_", "(_", "os_", "._", "path_", "._", "dirname_", "(_", "os_", "._", "path_", "._", "abspath_", "(_", "\\u\\u", "file\\u\\u_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "ARM", "LE", "Const", "ant", "Predic", "t", ".", "csv", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "filename", "2_", "=_", "os_", "._", "path_", "._", "join_", "(_", "os_", "._", "path_", "._", "dirname_", "(_", "os_", "._", "path_", "._", "abspath_", "(_", "\\u\\u", "file\\u\\u_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "results", "\\u", "ar", "\\u", "forecast", "\\u", "mle", "\\u", "dynami", "c", ".", "csv", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "predi", "ctr", "esult", "s_", "=_", "np_", "._", "loadtxt_", "(_", "filename_", ",_", "delimiter_", "=_", "\",\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "year_", "=_", "predi", "ctr", "esult", "s_", "[_", ":_", ",_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pv_", "=_", "predi", "ctr", "esult", "s_", "[_", ":_", ",_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dynami", "cp", "v_", "=_", "np_", "._", "genfromtxt_", "(_", "filename", "2_", ",_", "delimiter_", "=_", "\",\"_", ",_", "skip", "\\u", "header_", "=_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "case", "s", " ", "-", " ", "in", " ", "sample", " ", "predict_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "start", " ", "=", " ", "0", " ", "(", "fitted", " ", "values", ")_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "FV", "ML", "Ed", "efa", "ult_", "=_", "pv_", "[_", ":_", "309", "_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "start", "=", "9_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "FV", "ML", "Esta", "rt", "9e", "nd", "308_", "=_", "pv_", "[_", "9_", ":_", "309", "_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "start", "=", "100", ",", " ", "end", "=", "309", "_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "FV", "ML", "Esta", "rt", "100", "end", "308_", "=_", "pv_", "[_", "100_", ":_", "309", "_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "start", " ", "=", " ", "0", ",", " ", "end_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "FV", "ML", "Esta", "rt", "0e", "nd", "200_", "=_", "pv_", "[_", ":_", "201_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "n", " ", "=", " ", "200", ",", " ", "start", " ", "=", " ", "200_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "FV", "ML", "Esta", "rt", "200", "end", "334", "_", "=_", "pv_", "[_", "200_", ":_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "start", " ", "=", " ", "309", ",", " ", "end", "=", "334", " ", "post", "-", "sample", " ", "forecast", "ing_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "FV", "ML", "Esta", "rt", "308", "end", "334", "_", "=_", "pv_", "[_", "308_", ":_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "end", " ", "=", " ", "310", ",", " ", "start", " ", "=", " ", "9_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "FV", "ML", "Esta", "rt", "9e", "nd", "309", "_", "=_", "pv_", "[_", "9_", ":_", "310_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "end", " ", "=", " ", "301", ",", " ", "start", " ", "=", " ", "0_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "FV", "ML", "Esta", "rt", "0e", "nd", "301_", "=_", "pv_", "[_", ":_", "302_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "end", " ", "=", " ", "312", ",", " ", "start", " ", "=", " ", "4_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "FV", "ML", "Esta", "rt", "4e", "nd", "312_", "=_", "pv_", "[_", "4_", ":_", "313_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "end", " ", "=", " ", "7", ",", " ", "start", " ", "=", " ", "2_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "FV", "ML", "Esta", "rt", "2e", "nd", "7_", "=_", "pv_", "[_", "2_", ":_", "8_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "fc", "dyn_", "=_", "dynami", "cp", "v_", "[_", ":_", ",_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "fc", "dyn", "2_", "=_", "dynami", "cp", "v_", "[_", ":_", ",_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "fc", "dyn", "3_", "=_", "dynami", "cp", "v_", "[_", ":_", ",_", "2_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "fc", "dyn", "4_", "=_", "dynami", "cp", "v_", "[_", ":_", ",_", "3_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
google/roboto/scripts/lib/fontbuild/curveFitPen.py
[ { "content": "#! /opt/local/bin/pythonw2.7\n#\n# Copyright 2015 Google Inc. All Rights Reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n# http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n\n\n__all__ = [\"SubsegmentPen\",\"SubsegmentsToCurvesPen\", \"segmentGlyph\", \"fitGlyph\"]\n\n\nfrom fontTools.pens.basePen import BasePen\nimport numpy as np\nfrom numpy import array as v\nfrom numpy.linalg import norm\nfrom robofab.pens.adapterPens import GuessSmoothPointPen\nfrom robofab.pens.pointPen import BasePointToSegmentPen\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nif __name__ == '__main__':\n p = SubsegmentPen(None, None)\n pts = np.array([\n [0,0],\n [.5,.5],\n [.5,.5],\n [1,1]\n ])\n print np.array(p.renderCurve(pts,10)) * 10\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class SubsegmentsToCurvesPointPen(BasePointToSegmentPen):\n\n\n", "metadata": "root.SubsegmentsToCurvesPointPen", "header": "['module', '___EOS___']", "index": 28 }, { "content": " def __init__(self, glyph, subsegmentGlyph, subsegments):\n BasePointToSegmentPen.__init__(self)\n self.glyph = glyph\n self.subPen = SubsegmentsToCurvesPen(None, glyph.getPen(), subsegmentGlyph, subsegments)", "metadata": "root.SubsegmentsToCurvesPointPen.__init__", "header": "['class', 'SubsegmentsToCurvesPointPen', '(', 'BasePointToSegmentPen', ')', ':', '___EOS___']", "index": 29 }, { "content": " def setMatchTangents(self, b):\n self.subPen.matchTangents = b", "metadata": "root.SubsegmentsToCurvesPointPen.setMatchTangents", "header": "['class', 'SubsegmentsToCurvesPointPen', '(', 'BasePointToSegmentPen', ')', ':', '___EOS___']", "index": 34 }, { "content": " def _flushContour(self, segments):\n #\n # adapted from robofab.pens.adapterPens.rfUFOPointPen\n #\n assert len(segments) >= 1\n # if we only have one point and it has a name, we must have an anchor\n first = segments[0]\n segmentType, points = first\n pt, smooth, name, kwargs = points[0]\n if len(segments) == 1 and name != None:\n self.glyph.appendAnchor(name, pt)\n return\n else:\n segmentType, points = segments[-1]\n movePt, smooth, name, kwargs = points[-1]\n if smooth:\n # last point is smooth, set pen to start smooth\n self.subPen.setLastSmooth(True)\n if segmentType == 'line':\n del segments[-1]\n\n self.subPen.moveTo(movePt)\n\n # do the rest of the segments\n for segmentType, points in segments:\n isSmooth = True in [smooth for pt, smooth, name, kwargs in points]\n pp = [pt for pt, smooth, name, kwargs in points]\n if segmentType == \"line\":\n assert len(pp) == 1\n if isSmooth:\n self.subPen.smoothLineTo(pp[0])\n else:\n self.subPen.lineTo(pp[0])\n elif segmentType == \"curve\":\n assert len(pp) == 3\n if isSmooth:\n self.subPen.smoothCurveTo(*pp)\n else:\n self.subPen.curveTo(*pp)\n elif segmentType == \"qcurve\":\n assert 0, \"qcurve not supported\"\n else:\n assert 0, \"illegal segmentType: %s\" % segmentType\n self.subPen.closePath()", "metadata": "root.SubsegmentsToCurvesPointPen._flushContour", "header": "['class', 'SubsegmentsToCurvesPointPen', '(', 'BasePointToSegmentPen', ')', ':', '___EOS___']", "index": 37 }, { "content": " def addComponent(self, glyphName, transform):\n self.subPen.addComponent(glyphName, transform)", "metadata": "root.SubsegmentsToCurvesPointPen.addComponent", "header": "['class', 'SubsegmentsToCurvesPointPen', '(', 'BasePointToSegmentPen', ')', ':', '___EOS___']", "index": 82 }, { "content": "class SubsegmentsToCurvesPen(BasePen):\n\n\n\n\n\n\n\n\n\n", "metadata": "root.SubsegmentsToCurvesPen", "header": "['module', '___EOS___']", "index": 86 }, { "content": " def __init__(self, glyphSet, otherPen, subsegmentGlyph, subsegments):\n BasePen.__init__(self, None)\n self.otherPen = otherPen\n self.ssglyph = subsegmentGlyph\n self.subsegments = subsegments\n self.contourIndex = -1\n self.segmentIndex = -1\n self.lastPoint = (0,0)\n self.lastSmooth = False\n self.nextSmooth = False", "metadata": "root.SubsegmentsToCurvesPen.__init__", "header": "['class', 'SubsegmentsToCurvesPen', '(', 'BasePen', ')', ':', '___EOS___']", "index": 87 }, { "content": " def setLastSmooth(self, b):\n self.lastSmooth = b", "metadata": "root.SubsegmentsToCurvesPen.setLastSmooth", "header": "['class', 'SubsegmentsToCurvesPen', '(', 'BasePen', ')', ':', '___EOS___']", "index": 98 }, { "content": " def _moveTo(self, (x, y)):\n self.contourIndex += 1\n self.segmentIndex = 0\n self.startPoint = (x,y)\n p = self.ssglyph.contours[self.contourIndex][0].points[0]\n self.otherPen.moveTo((p.x, p.y))\n self.lastPoint = (x,y)", "metadata": "root.SubsegmentsToCurvesPen._moveTo", "header": "['class', 'SubsegmentsToCurvesPen', '(', 'BasePen', ')', ':', '___EOS___']", "index": 101 }, { "content": " def _lineTo(self, (x, y)):\n self.segmentIndex += 1\n index = self.subsegments[self.contourIndex][self.segmentIndex][0]\n p = self.ssglyph.contours[self.contourIndex][index].points[0]\n self.otherPen.lineTo((p.x, p.y))\n self.lastPoint = (x,y)\n self.lastSmooth = False", "metadata": "root.SubsegmentsToCurvesPen._lineTo", "header": "['class', 'SubsegmentsToCurvesPen', '(', 'BasePen', ')', ':', '___EOS___']", "index": 109 }, { "content": " def smoothLineTo(self, (x, y)):\n self.lineTo((x,y))\n self.lastSmooth = True", "metadata": "root.SubsegmentsToCurvesPen.smoothLineTo", "header": "['class', 'SubsegmentsToCurvesPen', '(', 'BasePen', ')', ':', '___EOS___']", "index": 117 }, { "content": " def smoothCurveTo(self, (x1, y1), (x2, y2), (x3, y3)):\n self.nextSmooth = True\n self.curveTo((x1, y1), (x2, y2), (x3, y3))\n self.nextSmooth = False\n self.lastSmooth = True", "metadata": "root.SubsegmentsToCurvesPen.smoothCurveTo", "header": "['class', 'SubsegmentsToCurvesPen', '(', 'BasePen', ')', ':', '___EOS___']", "index": 121 }, { "content": " def _curveToOne(self, (x1, y1), (x2, y2), (x3, y3)):\n self.segmentIndex += 1\n c = self.ssglyph.contours[self.contourIndex]\n n = len(c)\n startIndex = (self.subsegments[self.contourIndex][self.segmentIndex-1][0])\n segmentCount = (self.subsegments[self.contourIndex][self.segmentIndex][1])\n endIndex = (startIndex + segmentCount + 1) % (n)\n\n indices = [(startIndex + i) % (n) for i in range(segmentCount + 1)]\n points = np.array([(c[i].points[0].x, c[i].points[0].y) for i in indices])\n prevPoint = (c[(startIndex - 1)].points[0].x, c[(startIndex - 1)].points[0].y)\n nextPoint = (c[(endIndex) % n].points[0].x, c[(endIndex) % n].points[0].y)\n prevTangent = prevPoint - points[0]\n nextTangent = nextPoint - points[-1]\n\n tangent1 = points[1] - points[0]\n tangent3 = points[-2] - points[-1]\n prevTangent /= np.linalg.norm(prevTangent)\n nextTangent /= np.linalg.norm(nextTangent)\n tangent1 /= np.linalg.norm(tangent1)\n tangent3 /= np.linalg.norm(tangent3)\n\n tangent1, junk = self.smoothTangents(tangent1, prevTangent, self.lastSmooth)\n tangent3, junk = self.smoothTangents(tangent3, nextTangent, self.nextSmooth)\n if self.matchTangents == True:\n cp = fitBezier(points, tangent1, tangent3)\n cp[1] = norm(cp[1] - cp[0]) * tangent1 / norm(tangent1) + cp[0]\n cp[2] = norm(cp[2] - cp[3]) * tangent3 / norm(tangent3) + cp[3]\n else:\n cp = fitBezier(points)\n # if self.ssglyph.name == 'r':\n # print \"-----------\"\n # print self.lastSmooth, self.nextSmooth\n # print \"%i %i : %i %i \\n %i %i : %i %i \\n %i %i : %i %i\"%(x1,y1, cp[1,0], cp[1,1], x2,y2, cp[2,0], cp[2,1], x3,y3, cp[3,0], cp[3,1])\n self.otherPen.curveTo((cp[1,0], cp[1,1]), (cp[2,0], cp[2,1]), (cp[3,0], cp[3,1]))\n self.lastPoint = (x3, y3)\n self.lastSmooth = False", "metadata": "root.SubsegmentsToCurvesPen._curveToOne", "header": "['class', 'SubsegmentsToCurvesPen', '(', 'BasePen', ')', ':', '___EOS___']", "index": 127 }, { "content": " def smoothTangents(self,t1,t2,forceSmooth = False):\n if forceSmooth or (abs(t1.dot(t2)) > .95 and norm(t1-t2) > 1):\n # print t1,t2,\n t1 = (t1 - t2) / 2\n t2 = -t1\n # print t1,t2\n return t1 / norm(t1), t2 / norm(t2)", "metadata": "root.SubsegmentsToCurvesPen.smoothTangents", "header": "['class', 'SubsegmentsToCurvesPen', '(', 'BasePen', ')', ':', '___EOS___']", "index": 165 }, { "content": " def _closePath(self):\n self.otherPen.closePath()", "metadata": "root.SubsegmentsToCurvesPen._closePath", "header": "['class', 'SubsegmentsToCurvesPen', '(', 'BasePen', ')', ':', '___EOS___']", "index": 173 }, { "content": " def _endPath(self):\n self.otherPen.endPath()", "metadata": "root.SubsegmentsToCurvesPen._endPath", "header": "['class', 'SubsegmentsToCurvesPen', '(', 'BasePen', ')', ':', '___EOS___']", "index": 176 }, { "content": " def addComponent(self, glyphName, transformation):\n self.otherPen.addComponent(glyphName, transformation)", "metadata": "root.SubsegmentsToCurvesPen.addComponent", "header": "['class', 'SubsegmentsToCurvesPen', '(', 'BasePen', ')', ':', '___EOS___']", "index": 179 }, { "content": "class SubsegmentPointPen(BasePointToSegmentPen):\n\n\n", "metadata": "root.SubsegmentPointPen", "header": "['module', '___EOS___']", "index": 183 }, { "content": " def __init__(self, glyph, resolution):\n BasePointToSegmentPen.__init__(self)\n self.glyph = glyph\n self.resolution = resolution\n self.subPen = SubsegmentPen(None, glyph.getPen())", "metadata": "root.SubsegmentPointPen.__init__", "header": "['class', 'SubsegmentPointPen', '(', 'BasePointToSegmentPen', ')', ':', '___EOS___']", "index": 184 }, { "content": " def getSubsegments(self):\n return self.subPen.subsegments[:]", "metadata": "root.SubsegmentPointPen.getSubsegments", "header": "['class', 'SubsegmentPointPen', '(', 'BasePointToSegmentPen', ')', ':', '___EOS___']", "index": 190 }, { "content": " def _flushContour(self, segments):\n #\n # adapted from robofab.pens.adapterPens.rfUFOPointPen\n #\n assert len(segments) >= 1\n # if we only have one point and it has a name, we must have an anchor\n first = segments[0]\n segmentType, points = first\n pt, smooth, name, kwargs = points[0]\n if len(segments) == 1 and name != None:\n self.glyph.appendAnchor(name, pt)\n return\n else:\n segmentType, points = segments[-1]\n movePt, smooth, name, kwargs = points[-1]\n if segmentType == 'line':\n del segments[-1]\n\n self.subPen.moveTo(movePt)\n\n # do the rest of the segments\n for segmentType, points in segments:\n points = [pt for pt, smooth, name, kwargs in points]\n if segmentType == \"line\":\n assert len(points) == 1\n self.subPen.lineTo(points[0])\n elif segmentType == \"curve\":\n assert len(points) == 3\n self.subPen.curveTo(*points)\n elif segmentType == \"qcurve\":\n assert 0, \"qcurve not supported\"\n else:\n assert 0, \"illegal segmentType: %s\" % segmentType\n self.subPen.closePath()", "metadata": "root.SubsegmentPointPen._flushContour", "header": "['class', 'SubsegmentPointPen', '(', 'BasePointToSegmentPen', ')', ':', '___EOS___']", "index": 193 }, { "content": " def addComponent(self, glyphName, transform):\n self.subPen.addComponent(glyphName, transform)", "metadata": "root.SubsegmentPointPen.addComponent", "header": "['class', 'SubsegmentPointPen', '(', 'BasePointToSegmentPen', ')', ':', '___EOS___']", "index": 228 }, { "content": "class SubsegmentPen(BasePen):\n\n\n\n\n\n\n\n\n", "metadata": "root.SubsegmentPen", "header": "['module', '___EOS___']", "index": 232 }, { "content": " def __init__(self, glyphSet, otherPen, resolution=25):\n BasePen.__init__(self,glyphSet)\n self.resolution = resolution\n self.otherPen = otherPen\n self.subsegments = []\n self.startContour = (0,0)\n self.contourIndex = -1", "metadata": "root.SubsegmentPen.__init__", "header": "['class', 'SubsegmentPen', '(', 'BasePen', ')', ':', '___EOS___']", "index": 234 }, { "content": " def _moveTo(self, (x, y)):\n self.contourIndex += 1\n self.segmentIndex = 0\n self.subsegments.append([])\n self.subsegmentCount = 0\n self.subsegments[self.contourIndex].append([self.subsegmentCount, 0])\n self.startContour = (x,y)\n self.lastPoint = (x,y)\n self.otherPen.moveTo((x,y))", "metadata": "root.SubsegmentPen._moveTo", "header": "['class', 'SubsegmentPen', '(', 'BasePen', ')', ':', '___EOS___']", "index": 242 }, { "content": " def _lineTo(self, (x, y)):\n count = self.stepsForSegment((x,y),self.lastPoint)\n if count < 1:\n count = 1\n self.subsegmentCount += count\n self.subsegments[self.contourIndex].append([self.subsegmentCount, count])\n for i in range(1,count+1):\n x1 = self.lastPoint[0] + (x - self.lastPoint[0]) * i/float(count)\n y1 = self.lastPoint[1] + (y - self.lastPoint[1]) * i/float(count)\n self.otherPen.lineTo((x1,y1))\n self.lastPoint = (x,y)", "metadata": "root.SubsegmentPen._lineTo", "header": "['class', 'SubsegmentPen', '(', 'BasePen', ')', ':', '___EOS___']", "index": 252 }, { "content": " def _curveToOne(self, (x1, y1), (x2, y2), (x3, y3)):\n count = self.stepsForSegment((x3,y3),self.lastPoint)\n if count < 2:\n count = 2\n self.subsegmentCount += count\n self.subsegments[self.contourIndex].append([self.subsegmentCount,count])\n x = self.renderCurve((self.lastPoint[0],x1,x2,x3),count)\n y = self.renderCurve((self.lastPoint[1],y1,y2,y3),count)\n assert len(x) == count\n if (x3 == self.startContour[0] and y3 == self.startContour[1]):\n count -= 1\n for i in range(count):\n self.otherPen.lineTo((x[i],y[i]))\n self.lastPoint = (x3,y3)", "metadata": "root.SubsegmentPen._curveToOne", "header": "['class', 'SubsegmentPen', '(', 'BasePen', ')', ':', '___EOS___']", "index": 264 }, { "content": " def _closePath(self):\n if not (self.lastPoint[0] == self.startContour[0] and self.lastPoint[1] == self.startContour[1]):\n self._lineTo(self.startContour)\n\n # round values used by otherPen (a RoboFab SegmentToPointPen) to decide\n # whether to delete duplicate points at start and end of contour\n #TODO(jamesgk) figure out why we have to do this hack, then remove it\n c = self.otherPen.contour\n for i in [0, -1]:\n c[i] = [[round(n, 5) for n in c[i][0]]] + list(c[i][1:])\n\n self.otherPen.closePath()", "metadata": "root.SubsegmentPen._closePath", "header": "['class', 'SubsegmentPen', '(', 'BasePen', ')', ':', '___EOS___']", "index": 279 }, { "content": " def _endPath(self):\n self.otherPen.endPath()", "metadata": "root.SubsegmentPen._endPath", "header": "['class', 'SubsegmentPen', '(', 'BasePen', ')', ':', '___EOS___']", "index": 292 }, { "content": " def addComponent(self, glyphName, transformation):\n self.otherPen.addComponent(glyphName, transformation)", "metadata": "root.SubsegmentPen.addComponent", "header": "['class', 'SubsegmentPen', '(', 'BasePen', ')', ':', '___EOS___']", "index": 295 }, { "content": " def stepsForSegment(self, p1, p2):\n dist = np.linalg.norm(v(p1) - v(p2))\n out = int(dist / self.resolution)\n return out", "metadata": "root.SubsegmentPen.stepsForSegment", "header": "['class', 'SubsegmentPen', '(', 'BasePen', ')', ':', '___EOS___']", "index": 298 }, { "content": " def renderCurve(self,p,count):\n curvePoints = []\n t = 1.0 / float(count)\n temp = t * t\n\n f = p[0]\n fd = 3 * (p[1] - p[0]) * t\n fdd_per_2 = 3 * (p[0] - 2 * p[1] + p[2]) * temp\n fddd_per_2 = 3 * (3 * (p[1] - p[2]) + p[3] - p[0]) * temp * t\n\n fddd = fddd_per_2 + fddd_per_2\n fdd = fdd_per_2 + fdd_per_2\n fddd_per_6 = fddd_per_2 * (1.0 / 3)\n\n for i in range(count):\n f = f + fd + fdd_per_2 + fddd_per_6\n fd = fd + fdd + fddd_per_2\n fdd = fdd + fddd\n fdd_per_2 = fdd_per_2 + fddd_per_2\n curvePoints.append(f)\n\n return curvePoints", "metadata": "root.SubsegmentPen.renderCurve", "header": "['class', 'SubsegmentPen', '(', 'BasePen', ')', ':', '___EOS___']", "index": 303 }, { "content": "def fitBezierSimple(pts):\n T = [np.linalg.norm(pts[i]-pts[i-1]) for i in range(1,len(pts))]\n tsum = np.sum(T)\n T = [0] + T\n T = [np.sum(T[0:i+1])/tsum for i in range(len(pts))]\n T = [[t**3, t**2, t, 1] for t in T]\n T = np.array(T)\n M = np.array([[-1, 3, -3, 1],\n [ 3, -6, 3, 0],\n [-3, 3, 0, 0],\n [ 1, 0, 0, 0]])\n T = T.dot(M)\n T = np.concatenate((T, np.array([[100,0,0,0], [0,0,0,100]])))\n # pts = np.vstack((pts, pts[0] * 100, pts[-1] * 100))\n C = np.linalg.lstsq(T, pts)\n return C[0]", "metadata": "root.fitBezierSimple", "header": "['module', '___EOS___']", "index": 327 }, { "content": "def subdivideLineSegment(pts):\n out = [pts[0]]\n for i in range(1, len(pts)):\n out.append(pts[i-1] + (pts[i] - pts[i-1]) * .5)\n out.append(pts[i])\n return np.array(out)", "metadata": "root.subdivideLineSegment", "header": "['module', '___EOS___']", "index": 345 }, { "content": "def fitBezier(pts,tangent0=None,tangent3=None):\n if len(pts < 4):\n pts = subdivideLineSegment(pts)\n T = [np.linalg.norm(pts[i]-pts[i-1]) for i in range(1,len(pts))]\n tsum = np.sum(T)\n T = [0] + T\n T = [np.sum(T[0:i+1])/tsum for i in range(len(pts))]\n T = [[t**3, t**2, t, 1] for t in T]\n T = np.array(T)\n M = np.array([[-1, 3, -3, 1],\n [ 3, -6, 3, 0],\n [-3, 3, 0, 0],\n [ 1, 0, 0, 0]])\n T = T.dot(M)\n n = len(pts)\n pout = pts.copy()\n pout[:,0] -= (T[:,0] * pts[0,0]) + (T[:,3] * pts[-1,0])\n pout[:,1] -= (T[:,0] * pts[0,1]) + (T[:,3] * pts[-1,1])\n\n TT = np.zeros((n*2,4))\n for i in range(n):\n for j in range(2):\n TT[i*2,j*2] = T[i,j+1]\n TT[i*2+1,j*2+1] = T[i,j+1]\n pout = pout.reshape((n*2,1),order=\"C\")\n\n if tangent0 != None and tangent3 != None:\n tangentConstraintsT = np.array([\n [tangent0[1], -tangent0[0], 0, 0],\n [0, 0, tangent3[1], -tangent3[0]]\n ])\n tangentConstraintsP = np.array([\n [pts[0][1] * -tangent0[0] + pts[0][0] * tangent0[1]],\n [pts[-1][1] * -tangent3[0] + pts[-1][0] * tangent3[1]]\n ])\n TT = np.concatenate((TT, tangentConstraintsT * 1000))\n pout = np.concatenate((pout, tangentConstraintsP * 1000))\n C = np.linalg.lstsq(TT,pout)[0].reshape((2,2))\n return np.array([pts[0], C[0], C[1], pts[-1]])", "metadata": "root.fitBezier", "header": "['module', '___EOS___']", "index": 353 }, { "content": "def segmentGlyph(glyph,resolution=50):\n g1 = glyph.copy()\n g1.clear()\n dp = SubsegmentPointPen(g1, resolution)\n glyph.drawPoints(dp)\n return g1, dp.getSubsegments()", "metadata": "root.segmentGlyph", "header": "['module', '___EOS___']", "index": 394 }, { "content": "def fitGlyph(glyph, subsegmentGlyph, subsegmentIndices, matchTangents=True):\n outGlyph = glyph.copy()\n outGlyph.clear()\n fitPen = SubsegmentsToCurvesPointPen(outGlyph, subsegmentGlyph, subsegmentIndices)\n fitPen.setMatchTangents(matchTangents)\n # smoothPen = GuessSmoothPointPen(fitPen)\n glyph.drawPoints(fitPen)\n outGlyph.width = subsegmentGlyph.width\n return outGlyph", "metadata": "root.fitGlyph", "header": "['module', '___EOS___']", "index": 402 } ]
[ { "span": "from robofab.pens.adapterPens import GuessSmoothPointPen", "start_line": 24, "start_column": 0, "end_line": 24, "end_column": 56 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#!", " ", "/", "opt", "/", "local", "/", "bin", "/", "python", "w2", ".7_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Copy", "right", " ", "201", "5", " ", "Goo", "gle", " ", "Inc", ".", " ", "All", " ", "Rig", "hts", " ", "Reserve", "d", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "License", "d", " ", "under", " ", "the", " ", "Ap", "ache", " ", "License", ",", " ", "Version", " ", "2.0", " ", "(", "the", " ", "\"", "License", "\");", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "you", " ", "may", " ", "not", " ", "use", " ", "this", " ", "file", " ", "except", " ", "in", " ", "compli", "anc", "e", " ", "with", " ", "the", " ", "License", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "You", " ", "may", " ", "obtain", " ", "a", " ", "copy", " ", "of", " ", "the", " ", "License", " ", "at_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "http", "://", "www", ".", "apa", "che", ".", "org", "/", "license", "s", "/", "LICENSE", "-", "2.0_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Un", "less", " ", "require", "d", " ", "by", " ", "applica", "ble", " ", "law", " ", "or", " ", "agree", "d", " ", "to", " ", "in", " ", "writ", "ing", ",", " ", "software", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "distributed", " ", "under", " ", "the", " ", "License", " ", "is", " ", "distributed", " ", "on", " ", "an", " ", "\"", "AS", " ", "IS", "\"", " ", "BAS", "IS", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "WITH", "OUT", " ", "WAR", "RAN", "TIES", " ", "OR", " ", "CONDITION", "S", " ", "OF", " ", "ANY", " ", "KIND", ",", " ", "eit", "her", " ", "express", " ", "or", " ", "impli", "ed", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "See", " ", "the", " ", "License", " ", "for", " ", "the", " ", "specific", " ", "language", " ", "govern", "ing", " ", "permissi", "ons", " ", "and_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "limit", "ation", "s", " ", "under", " ", "the", " ", "License", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u", "all\\u\\u_", "=_", "[_", "\"", "Subs", "eg", "ment", "Pen", "\"_", ",_", "\"", "Subs", "eg", "ment", "s", "To", "Curve", "s", "Pen", "\"_", ",_", "\"", "segment", "Gl", "yp", "h", "\"_", ",_", "\"", "fit", "Gl", "yp", "h", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "font", "Tools_", "._", "pens", "_", "._", "base", "Pen_", "import_", "Base", "Pen_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "numpy_", "as_", "np_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "numpy_", "import_", "array_", "as_", "v_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "numpy_", "._", "linalg_", "import_", "norm_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "robo", "fab", "_", "._", "pens", "_", "._", "adapter", "Pen", "s_", "import_", "Guess", "Smooth", "Point", "Pen_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "robo", "fab", "_", "._", "pens", "_", "._", "point", "Pen_", "import_", "Base", "Point", "To", "Segme", "nt", "Pen_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "\\u\\u", "name\\u\\u_", "==_", "'\\u", "\\u", "main", "\\u\\u'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "p_", "=_", "Subs", "eg", "ment", "Pen_", "(_", "None_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pts_", "=_", "np_", "._", "array_", "(_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "0_", ",_", "0_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "[_", ".5_", ",_", ".5_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "[_", ".5_", ",_", ".5_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "1_", ",_", "1_", "]_", "\\u\\u\\uNL\\u\\u\\u_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "np_", "._", "array_", "(_", "p_", "._", "render", "Curve_", "(_", "pts_", ",_", "10_", ")_", ")_", "*_", "10_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Subs", "eg", "ment", "s", "To", "Curve", "s", "Point", "Pen_", "(_", "Base", "Point", "To", "Segme", "nt", "Pen_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Subs", "eg", "ment", "s", "To", "Curve", "s", "Point", "Pen_", "(_", "Base", "Point", "To", "Segme", "nt", "Pen_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "glyph_", ",_", "subse", "gment", "Glyph_", ",_", "subse", "gment", "s_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Base", "Point", "To", "Segme", "nt", "Pen_", "._", "\\u\\u", "init\\u\\u_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "glyph_", "=_", "glyph_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "sub", "Pen_", "=_", "Subs", "eg", "ment", "s", "To", "Curve", "s", "Pen_", "(_", "None_", ",_", "glyph_", "._", "get", "Pen_", "(_", ")_", ",_", "subse", "gment", "Glyph_", ",_", "subse", "gment", "s_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Subs", "eg", "ment", "s", "To", "Curve", "s", "Point", "Pen_", "(_", "Base", "Point", "To", "Segme", "nt", "Pen_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "set", "Match", "Tang", "ents_", "(_", "self_", ",_", "b_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "sub", "Pen_", "._", "match", "Tang", "ents_", "=_", "b_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Subs", "eg", "ment", "s", "To", "Curve", "s", "Point", "Pen_", "(_", "Base", "Point", "To", "Segme", "nt", "Pen_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "flush", "Contour", "_", "(_", "self_", ",_", "segments_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "adapt", "ed", " ", "from", " ", "robo", "fab", ".", "pens", ".", "adapter", "Pen", "s", ".", "rf", "UF", "OP", "oint", "Pen_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "assert_", "len_", "(_", "segments_", ")_", ">=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "if", " ", "we", " ", "only", " ", "have", " ", "one", " ", "point", " ", "and", " ", "it", " ", "has", " ", "a", " ", "name", ",", " ", "we", " ", "must", " ", "have", " ", "an", " ", "anchor_", "\\u\\u\\uNL\\u\\u\\u_", "first_", "=_", "segments_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "segment", "Type_", ",_", "points_", "=_", "first_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pt_", ",_", "smooth_", ",_", "name_", ",_", "kwargs_", "=_", "points_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "len_", "(_", "segments_", ")_", "==_", "1_", "and_", "name_", "!=_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "glyph_", "._", "append", "Anchor_", "(_", "name_", ",_", "pt_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "segment", "Type_", ",_", "points_", "=_", "segments_", "[_", "-_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "move", "Pt_", ",_", "smooth_", ",_", "name_", ",_", "kwargs_", "=_", "points_", "[_", "-_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "smooth_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "last", " ", "point", " ", "is", " ", "smooth", ",", " ", "set", " ", "pen", " ", "to", " ", "start", " ", "smooth_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "sub", "Pen_", "._", "set", "Las", "t", "Smooth", "_", "(_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "segment", "Type_", "==_", "'", "line", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "del_", "segments_", "[_", "-_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "sub", "Pen_", "._", "move", "To_", "(_", "move", "Pt_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "do", " ", "the", " ", "rest", " ", "of", " ", "the", " ", "segments_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "segment", "Type_", ",_", "points_", "in_", "segments_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "is", "Smooth", "_", "=_", "True_", "in_", "[_", "smooth_", "for_", "pt_", ",_", "smooth_", ",_", "name_", ",_", "kwargs_", "in_", "points_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pp_", "=_", "[_", "pt_", "for_", "pt_", ",_", "smooth_", ",_", "name_", ",_", "kwargs_", "in_", "points_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "segment", "Type_", "==_", "\"", "line", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "assert_", "len_", "(_", "pp_", ")_", "==_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "is", "Smooth", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "self_", "._", "sub", "Pen_", "._", "smooth", "Line", "To_", "(_", "pp_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "self_", "._", "sub", "Pen_", "._", "line", "To_", "(_", "pp_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "segment", "Type_", "==_", "\"", "curve", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "assert_", "len_", "(_", "pp_", ")_", "==_", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "is", "Smooth", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "self_", "._", "sub", "Pen_", "._", "smooth", "Curve", "To_", "(_", "*_", "pp_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "self_", "._", "sub", "Pen_", "._", "curve", "To_", "(_", "*_", "pp_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "segment", "Type_", "==_", "\"", "qc", "urve", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "assert_", "0_", ",_", "\"", "qc", "urve", " ", "not", " ", "support", "ed", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "assert_", "0_", ",_", "\"", "ille", "gal", " ", "segment", "Type", ":", " ", "%", "s", "\"_", "%_", "segment", "Type_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "sub", "Pen_", "._", "close", "Path_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Subs", "eg", "ment", "s", "To", "Curve", "s", "Point", "Pen_", "(_", "Base", "Point", "To", "Segme", "nt", "Pen_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "add", "Component_", "(_", "self_", ",_", "glyph", "Name_", ",_", "transform_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "sub", "Pen_", "._", "add", "Component_", "(_", "glyph", "Name_", ",_", "transform_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Subs", "eg", "ment", "s", "To", "Curve", "s", "Pen_", "(_", "Base", "Pen_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Subs", "eg", "ment", "s", "To", "Curve", "s", "Pen_", "(_", "Base", "Pen_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "glyph", "Set_", ",_", "other", "Pen_", ",_", "subse", "gment", "Glyph_", ",_", "subse", "gment", "s_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Base", "Pen_", "._", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "other", "Pen_", "=_", "other", "Pen_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "ss", "glyph_", "=_", "subse", "gment", "Glyph_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "subse", "gment", "s_", "=_", "subse", "gment", "s_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "conto", "ur", "Index_", "=_", "-_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "segment", "Index_", "=_", "-_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "last", "Point_", "=_", "(_", "0_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "last", "Smooth", "_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "next", "Smooth", "_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Subs", "eg", "ment", "s", "To", "Curve", "s", "Pen_", "(_", "Base", "Pen_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "set", "Las", "t", "Smooth", "_", "(_", "self_", ",_", "b_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "last", "Smooth", "_", "=_", "b_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Subs", "eg", "ment", "s", "To", "Curve", "s", "Pen_", "(_", "Base", "Pen_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "move", "To_", "(_", "self_", ",_", "(_", "x_", ",_", "y_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "conto", "ur", "Index_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "segment", "Index_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "start", "Point_", "=_", "(_", "x_", ",_", "y_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "p_", "=_", "self_", "._", "ss", "glyph_", "._", "contours_", "[_", "self_", "._", "conto", "ur", "Index_", "]_", "[_", "0_", "]_", "._", "points_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "other", "Pen_", "._", "move", "To_", "(_", "(_", "p_", "._", "x_", ",_", "p_", "._", "y_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "last", "Point_", "=_", "(_", "x_", ",_", "y_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Subs", "eg", "ment", "s", "To", "Curve", "s", "Pen_", "(_", "Base", "Pen_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "line", "To_", "(_", "self_", ",_", "(_", "x_", ",_", "y_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "segment", "Index_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "index_", "=_", "self_", "._", "subse", "gment", "s_", "[_", "self_", "._", "conto", "ur", "Index_", "]_", "[_", "self_", "._", "segment", "Index_", "]_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "p_", "=_", "self_", "._", "ss", "glyph_", "._", "contours_", "[_", "self_", "._", "conto", "ur", "Index_", "]_", "[_", "index_", "]_", "._", "points_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "other", "Pen_", "._", "line", "To_", "(_", "(_", "p_", "._", "x_", ",_", "p_", "._", "y_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "last", "Point_", "=_", "(_", "x_", ",_", "y_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "last", "Smooth", "_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Subs", "eg", "ment", "s", "To", "Curve", "s", "Pen_", "(_", "Base", "Pen_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "smooth", "Line", "To_", "(_", "self_", ",_", "(_", "x_", ",_", "y_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "line", "To_", "(_", "(_", "x_", ",_", "y_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "last", "Smooth", "_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Subs", "eg", "ment", "s", "To", "Curve", "s", "Pen_", "(_", "Base", "Pen_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "smooth", "Curve", "To_", "(_", "self_", ",_", "(_", "x1_", ",_", "y1_", ")_", ",_", "(_", "x2_", ",_", "y2_", ")_", ",_", "(_", "x3_", ",_", "y3_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "next", "Smooth", "_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "curve", "To_", "(_", "(_", "x1_", ",_", "y1_", ")_", ",_", "(_", "x2_", ",_", "y2_", ")_", ",_", "(_", "x3_", ",_", "y3_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "next", "Smooth", "_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "last", "Smooth", "_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Subs", "eg", "ment", "s", "To", "Curve", "s", "Pen_", "(_", "Base", "Pen_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "curve", "To", "One_", "(_", "self_", ",_", "(_", "x1_", ",_", "y1_", ")_", ",_", "(_", "x2_", ",_", "y2_", ")_", ",_", "(_", "x3_", ",_", "y3_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "segment", "Index_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "c_", "=_", "self_", "._", "ss", "glyph_", "._", "contours_", "[_", "self_", "._", "conto", "ur", "Index_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "n_", "=_", "len_", "(_", "c_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "start", "Index_", "=_", "(_", "self_", "._", "subse", "gment", "s_", "[_", "self_", "._", "conto", "ur", "Index_", "]_", "[_", "self_", "._", "segment", "Index_", "-_", "1_", "]_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "segment", "Count_", "=_", "(_", "self_", "._", "subse", "gment", "s_", "[_", "self_", "._", "conto", "ur", "Index_", "]_", "[_", "self_", "._", "segment", "Index_", "]_", "[_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "end", "Index_", "=_", "(_", "start", "Index_", "+_", "segment", "Count_", "+_", "1_", ")_", "%_", "(_", "n_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "indices_", "=_", "[_", "(_", "start", "Index_", "+_", "i_", ")_", "%_", "(_", "n_", ")_", "for_", "i_", "in_", "range_", "(_", "segment", "Count_", "+_", "1_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "points_", "=_", "np_", "._", "array_", "(_", "[_", "(_", "c_", "[_", "i_", "]_", "._", "points_", "[_", "0_", "]_", "._", "x_", ",_", "c_", "[_", "i_", "]_", "._", "points_", "[_", "0_", "]_", "._", "y_", ")_", "for_", "i_", "in_", "indices_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "prev", "Point_", "=_", "(_", "c_", "[_", "(_", "start", "Index_", "-_", "1_", ")_", "]_", "._", "points_", "[_", "0_", "]_", "._", "x_", ",_", "c_", "[_", "(_", "start", "Index_", "-_", "1_", ")_", "]_", "._", "points_", "[_", "0_", "]_", "._", "y_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "next", "Point_", "=_", "(_", "c_", "[_", "(_", "end", "Index_", ")_", "%_", "n_", "]_", "._", "points_", "[_", "0_", "]_", "._", "x_", ",_", "c_", "[_", "(_", "end", "Index_", ")_", "%_", "n_", "]_", "._", "points_", "[_", "0_", "]_", "._", "y_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "prev", "Tang", "ent_", "=_", "prev", "Point_", "-_", "points_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "next", "Tang", "ent_", "=_", "next", "Point_", "-_", "points_", "[_", "-_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "tangent", "1_", "=_", "points_", "[_", "1_", "]_", "-_", "points_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tangent", "3_", "=_", "points_", "[_", "-_", "2_", "]_", "-_", "points_", "[_", "-_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "prev", "Tang", "ent_", "/=_", "np_", "._", "linalg_", "._", "norm_", "(_", "prev", "Tang", "ent_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "next", "Tang", "ent_", "/=_", "np_", "._", "linalg_", "._", "norm_", "(_", "next", "Tang", "ent_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tangent", "1_", "/=_", "np_", "._", "linalg_", "._", "norm_", "(_", "tangent", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tangent", "3_", "/=_", "np_", "._", "linalg_", "._", "norm_", "(_", "tangent", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "tangent", "1_", ",_", "junk", "_", "=_", "self_", "._", "smooth", "Tang", "ents_", "(_", "tangent", "1_", ",_", "prev", "Tang", "ent_", ",_", "self_", "._", "last", "Smooth", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tangent", "3_", ",_", "junk", "_", "=_", "self_", "._", "smooth", "Tang", "ents_", "(_", "tangent", "3_", ",_", "next", "Tang", "ent_", ",_", "self_", "._", "next", "Smooth", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "match", "Tang", "ents_", "==_", "True_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cp_", "=_", "fit", "Bez", "ier_", "(_", "points_", ",_", "tangent", "1_", ",_", "tangent", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cp_", "[_", "1_", "]_", "=_", "norm_", "(_", "cp_", "[_", "1_", "]_", "-_", "cp_", "[_", "0_", "]_", ")_", "*_", "tangent", "1_", "/_", "norm_", "(_", "tangent", "1_", ")_", "+_", "cp_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cp_", "[_", "2_", "]_", "=_", "norm_", "(_", "cp_", "[_", "2_", "]_", "-_", "cp_", "[_", "3_", "]_", ")_", "*_", "tangent", "3_", "/_", "norm_", "(_", "tangent", "3_", ")_", "+_", "cp_", "[_", "3_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cp_", "=_", "fit", "Bez", "ier_", "(_", "points_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "if", " ", "self", ".", "ss", "glyph", ".", "name", " ", "==", " ", "'", "r", "':", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "print", " ", "\"-------", "----", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "print", " ", "self", ".", "last", "Smooth", ",", " ", "self", ".", "next", "Smooth", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "print", " ", "\"%", "i", " ", "%", "i", " ", ":", " ", "%", "i", " ", "%", "i", " ", "\\\\", "n", " ", "%", "i", " ", "%", "i", " ", ":", " ", "%", "i", " ", "%", "i", " ", "\\\\", "n", " ", "%", "i", " ", "%", "i", " ", ":", " ", "%", "i", " ", "%", "i", "\"%", "(", "x1", ",", "y1", ",", " ", "cp", "[", "1", ",", "0", "],", " ", "cp", "[", "1", ",", "1", "],", " ", "x2", ",", "y2", ",", " ", "cp", "[", "2", ",", "0", "],", " ", "cp", "[", "2", ",", "1", "],", " ", "x3", ",", "y", "3", ",", " ", "cp", "[", "3", ",", "0", "],", " ", "cp", "[", "3", ",", "1", "])", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "other", "Pen_", "._", "curve", "To_", "(_", "(_", "cp_", "[_", "1_", ",_", "0_", "]_", ",_", "cp_", "[_", "1_", ",_", "1_", "]_", ")_", ",_", "(_", "cp_", "[_", "2_", ",_", "0_", "]_", ",_", "cp_", "[_", "2_", ",_", "1_", "]_", ")_", ",_", "(_", "cp_", "[_", "3_", ",_", "0_", "]_", ",_", "cp_", "[_", "3_", ",_", "1_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "last", "Point_", "=_", "(_", "x3_", ",_", "y3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "last", "Smooth", "_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Subs", "eg", "ment", "s", "To", "Curve", "s", "Pen_", "(_", "Base", "Pen_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "smooth", "Tang", "ents_", "(_", "self_", ",_", "t1_", ",_", "t2_", ",_", "force", "Smooth", "_", "=_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "force", "Smooth", "_", "or_", "(_", "abs_", "(_", "t1_", "._", "dot_", "(_", "t2_", ")_", ")_", ">_", ".95", "_", "and_", "norm_", "(_", "t1_", "-_", "t2_", ")_", ">_", "1_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "print", " ", "t1", ",", "t2", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "t1_", "=_", "(_", "t1_", "-_", "t2_", ")_", "/_", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t2_", "=_", "-_", "t1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "print", " ", "t1", ",", "t2_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "t1_", "/_", "norm_", "(_", "t1_", ")_", ",_", "t2_", "/_", "norm_", "(_", "t2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Subs", "eg", "ment", "s", "To", "Curve", "s", "Pen_", "(_", "Base", "Pen_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "close", "Path_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "other", "Pen_", "._", "close", "Path_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Subs", "eg", "ment", "s", "To", "Curve", "s", "Pen_", "(_", "Base", "Pen_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "end", "Path_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "other", "Pen_", "._", "end", "Path_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Subs", "eg", "ment", "s", "To", "Curve", "s", "Pen_", "(_", "Base", "Pen_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "add", "Component_", "(_", "self_", ",_", "glyph", "Name_", ",_", "transformation_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "other", "Pen_", "._", "add", "Component_", "(_", "glyph", "Name_", ",_", "transformation_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Subs", "eg", "ment", "Point", "Pen_", "(_", "Base", "Point", "To", "Segme", "nt", "Pen_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Subs", "eg", "ment", "Point", "Pen_", "(_", "Base", "Point", "To", "Segme", "nt", "Pen_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "glyph_", ",_", "resolution_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Base", "Point", "To", "Segme", "nt", "Pen_", "._", "\\u\\u", "init\\u\\u_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "glyph_", "=_", "glyph_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "resolution_", "=_", "resolution_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "sub", "Pen_", "=_", "Subs", "eg", "ment", "Pen_", "(_", "None_", ",_", "glyph_", "._", "get", "Pen_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Subs", "eg", "ment", "Point", "Pen_", "(_", "Base", "Point", "To", "Segme", "nt", "Pen_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "Subs", "eg", "ments_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "sub", "Pen_", "._", "subse", "gment", "s_", "[_", ":_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Subs", "eg", "ment", "Point", "Pen_", "(_", "Base", "Point", "To", "Segme", "nt", "Pen_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "flush", "Contour", "_", "(_", "self_", ",_", "segments_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "adapt", "ed", " ", "from", " ", "robo", "fab", ".", "pens", ".", "adapter", "Pen", "s", ".", "rf", "UF", "OP", "oint", "Pen_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "assert_", "len_", "(_", "segments_", ")_", ">=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "if", " ", "we", " ", "only", " ", "have", " ", "one", " ", "point", " ", "and", " ", "it", " ", "has", " ", "a", " ", "name", ",", " ", "we", " ", "must", " ", "have", " ", "an", " ", "anchor_", "\\u\\u\\uNL\\u\\u\\u_", "first_", "=_", "segments_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "segment", "Type_", ",_", "points_", "=_", "first_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pt_", ",_", "smooth_", ",_", "name_", ",_", "kwargs_", "=_", "points_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "len_", "(_", "segments_", ")_", "==_", "1_", "and_", "name_", "!=_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "glyph_", "._", "append", "Anchor_", "(_", "name_", ",_", "pt_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "segment", "Type_", ",_", "points_", "=_", "segments_", "[_", "-_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "move", "Pt_", ",_", "smooth_", ",_", "name_", ",_", "kwargs_", "=_", "points_", "[_", "-_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "segment", "Type_", "==_", "'", "line", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "del_", "segments_", "[_", "-_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "sub", "Pen_", "._", "move", "To_", "(_", "move", "Pt_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "do", " ", "the", " ", "rest", " ", "of", " ", "the", " ", "segments_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "segment", "Type_", ",_", "points_", "in_", "segments_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "points_", "=_", "[_", "pt_", "for_", "pt_", ",_", "smooth_", ",_", "name_", ",_", "kwargs_", "in_", "points_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "segment", "Type_", "==_", "\"", "line", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "assert_", "len_", "(_", "points_", ")_", "==_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "sub", "Pen_", "._", "line", "To_", "(_", "points_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "segment", "Type_", "==_", "\"", "curve", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "assert_", "len_", "(_", "points_", ")_", "==_", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "sub", "Pen_", "._", "curve", "To_", "(_", "*_", "points_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "segment", "Type_", "==_", "\"", "qc", "urve", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "assert_", "0_", ",_", "\"", "qc", "urve", " ", "not", " ", "support", "ed", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "assert_", "0_", ",_", "\"", "ille", "gal", " ", "segment", "Type", ":", " ", "%", "s", "\"_", "%_", "segment", "Type_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "sub", "Pen_", "._", "close", "Path_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Subs", "eg", "ment", "Point", "Pen_", "(_", "Base", "Point", "To", "Segme", "nt", "Pen_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "add", "Component_", "(_", "self_", ",_", "glyph", "Name_", ",_", "transform_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "sub", "Pen_", "._", "add", "Component_", "(_", "glyph", "Name_", ",_", "transform_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Subs", "eg", "ment", "Pen_", "(_", "Base", "Pen_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Subs", "eg", "ment", "Pen_", "(_", "Base", "Pen_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "glyph", "Set_", ",_", "other", "Pen_", ",_", "resolution_", "=_", "25_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Base", "Pen_", "._", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "glyph", "Set_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "resolution_", "=_", "resolution_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "other", "Pen_", "=_", "other", "Pen_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "subse", "gment", "s_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "start", "Contour", "_", "=_", "(_", "0_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "conto", "ur", "Index_", "=_", "-_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Subs", "eg", "ment", "Pen_", "(_", "Base", "Pen_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "move", "To_", "(_", "self_", ",_", "(_", "x_", ",_", "y_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "conto", "ur", "Index_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "segment", "Index_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "subse", "gment", "s_", "._", "append_", "(_", "[_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "subse", "gment", "Count_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "subse", "gment", "s_", "[_", "self_", "._", "conto", "ur", "Index_", "]_", "._", "append_", "(_", "[_", "self_", "._", "subse", "gment", "Count_", ",_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "start", "Contour", "_", "=_", "(_", "x_", ",_", "y_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "last", "Point_", "=_", "(_", "x_", ",_", "y_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "other", "Pen_", "._", "move", "To_", "(_", "(_", "x_", ",_", "y_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Subs", "eg", "ment", "Pen_", "(_", "Base", "Pen_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "line", "To_", "(_", "self_", ",_", "(_", "x_", ",_", "y_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "count_", "=_", "self_", "._", "step", "s", "For", "Segment_", "(_", "(_", "x_", ",_", "y_", ")_", ",_", "self_", "._", "last", "Point_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "count_", "<_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "count_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "subse", "gment", "Count_", "+=_", "count_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "subse", "gment", "s_", "[_", "self_", "._", "conto", "ur", "Index_", "]_", "._", "append_", "(_", "[_", "self_", "._", "subse", "gment", "Count_", ",_", "count_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", "in_", "range_", "(_", "1_", ",_", "count_", "+_", "1_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "x1_", "=_", "self_", "._", "last", "Point_", "[_", "0_", "]_", "+_", "(_", "x_", "-_", "self_", "._", "last", "Point_", "[_", "0_", "]_", ")_", "*_", "i_", "/_", "float_", "(_", "count_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "y1_", "=_", "self_", "._", "last", "Point_", "[_", "1_", "]_", "+_", "(_", "y_", "-_", "self_", "._", "last", "Point_", "[_", "1_", "]_", ")_", "*_", "i_", "/_", "float_", "(_", "count_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "other", "Pen_", "._", "line", "To_", "(_", "(_", "x1_", ",_", "y1_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "last", "Point_", "=_", "(_", "x_", ",_", "y_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Subs", "eg", "ment", "Pen_", "(_", "Base", "Pen_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "curve", "To", "One_", "(_", "self_", ",_", "(_", "x1_", ",_", "y1_", ")_", ",_", "(_", "x2_", ",_", "y2_", ")_", ",_", "(_", "x3_", ",_", "y3_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "count_", "=_", "self_", "._", "step", "s", "For", "Segment_", "(_", "(_", "x3_", ",_", "y3_", ")_", ",_", "self_", "._", "last", "Point_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "count_", "<_", "2_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "count_", "=_", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "subse", "gment", "Count_", "+=_", "count_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "subse", "gment", "s_", "[_", "self_", "._", "conto", "ur", "Index_", "]_", "._", "append_", "(_", "[_", "self_", "._", "subse", "gment", "Count_", ",_", "count_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "x_", "=_", "self_", "._", "render", "Curve_", "(_", "(_", "self_", "._", "last", "Point_", "[_", "0_", "]_", ",_", "x1_", ",_", "x2_", ",_", "x3_", ")_", ",_", "count_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "y_", "=_", "self_", "._", "render", "Curve_", "(_", "(_", "self_", "._", "last", "Point_", "[_", "1_", "]_", ",_", "y1_", ",_", "y2_", ",_", "y3_", ")_", ",_", "count_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "len_", "(_", "x_", ")_", "==_", "count_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "(_", "x3_", "==_", "self_", "._", "start", "Contour", "_", "[_", "0_", "]_", "and_", "y3_", "==_", "self_", "._", "start", "Contour", "_", "[_", "1_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "count_", "-=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "i_", "in_", "range_", "(_", "count_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "other", "Pen_", "._", "line", "To_", "(_", "(_", "x_", "[_", "i_", "]_", ",_", "y_", "[_", "i_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "last", "Point_", "=_", "(_", "x3_", ",_", "y3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Subs", "eg", "ment", "Pen_", "(_", "Base", "Pen_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "close", "Path_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "(_", "self_", "._", "last", "Point_", "[_", "0_", "]_", "==_", "self_", "._", "start", "Contour", "_", "[_", "0_", "]_", "and_", "self_", "._", "last", "Point_", "[_", "1_", "]_", "==_", "self_", "._", "start", "Contour", "_", "[_", "1_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "line", "To_", "(_", "self_", "._", "start", "Contour", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "round", " ", "values", " ", "used", " ", "by", " ", "other", "Pen", " ", "(", "a", " ", "Rob", "o", "Fab", " ", "Segme", "nt", "To", "Point", "Pen", ")", " ", "to", " ", "decide", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "whe", "ther", " ", "to", " ", "delete", " ", "duplicat", "e", " ", "points", " ", "at", " ", "start", " ", "and", " ", "end", " ", "of", " ", "contour_", "\\u\\u\\uNL\\u\\u\\u_", "#", "TOD", "O", "(", "jam", "es", "gk", ")", " ", "figure", " ", "out", " ", "wh", "y", " ", "we", " ", "have", " ", "to", " ", "do", " ", "this", " ", "hack", ",", " ", "then", " ", "remove", " ", "it_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "c_", "=_", "self_", "._", "other", "Pen_", "._", "contour_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", "in_", "[_", "0_", ",_", "-_", "1_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "c_", "[_", "i_", "]_", "=_", "[_", "[_", "round_", "(_", "n_", ",_", "5_", ")_", "for_", "n_", "in_", "c_", "[_", "i_", "]_", "[_", "0_", "]_", "]_", "]_", "+_", "list_", "(_", "c_", "[_", "i_", "]_", "[_", "1_", ":_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "other", "Pen_", "._", "close", "Path_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Subs", "eg", "ment", "Pen_", "(_", "Base", "Pen_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "end", "Path_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "other", "Pen_", "._", "end", "Path_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Subs", "eg", "ment", "Pen_", "(_", "Base", "Pen_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "add", "Component_", "(_", "self_", ",_", "glyph", "Name_", ",_", "transformation_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "other", "Pen_", "._", "add", "Component_", "(_", "glyph", "Name_", ",_", "transformation_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Subs", "eg", "ment", "Pen_", "(_", "Base", "Pen_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "step", "s", "For", "Segment_", "(_", "self_", ",_", "p1_", ",_", "p2_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "dist_", "=_", "np_", "._", "linalg_", "._", "norm_", "(_", "v_", "(_", "p1_", ")_", "-_", "v_", "(_", "p2_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "out_", "=_", "int_", "(_", "dist_", "/_", "self_", "._", "resolution_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "out_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Subs", "eg", "ment", "Pen_", "(_", "Base", "Pen_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "render", "Curve_", "(_", "self_", ",_", "p_", ",_", "count_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "curve", "Points_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t_", "=_", "1.0_", "/_", "float_", "(_", "count_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "temp_", "=_", "t_", "*_", "t_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "f_", "=_", "p_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fd_", "=_", "3_", "*_", "(_", "p_", "[_", "1_", "]_", "-_", "p_", "[_", "0_", "]_", ")_", "*_", "t_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fdd", "\\u", "per", "\\u", "2_", "=_", "3_", "*_", "(_", "p_", "[_", "0_", "]_", "-_", "2_", "*_", "p_", "[_", "1_", "]_", "+_", "p_", "[_", "2_", "]_", ")_", "*_", "temp_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fdd", "d\\u", "per", "\\u", "2_", "=_", "3_", "*_", "(_", "3_", "*_", "(_", "p_", "[_", "1_", "]_", "-_", "p_", "[_", "2_", "]_", ")_", "+_", "p_", "[_", "3_", "]_", "-_", "p_", "[_", "0_", "]_", ")_", "*_", "temp_", "*_", "t_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "fdd", "d_", "=_", "fdd", "d\\u", "per", "\\u", "2_", "+_", "fdd", "d\\u", "per", "\\u", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fdd", "_", "=_", "fdd", "\\u", "per", "\\u", "2_", "+_", "fdd", "\\u", "per", "\\u", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fdd", "d\\u", "per", "\\u", "6_", "=_", "fdd", "d\\u", "per", "\\u", "2_", "*_", "(_", "1.0_", "/_", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "i_", "in_", "range_", "(_", "count_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "f_", "=_", "f_", "+_", "fd_", "+_", "fdd", "\\u", "per", "\\u", "2_", "+_", "fdd", "d\\u", "per", "\\u", "6_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fd_", "=_", "fd_", "+_", "fdd", "_", "+_", "fdd", "d\\u", "per", "\\u", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fdd", "_", "=_", "fdd", "_", "+_", "fdd", "d_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fdd", "\\u", "per", "\\u", "2_", "=_", "fdd", "\\u", "per", "\\u", "2_", "+_", "fdd", "d\\u", "per", "\\u", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "curve", "Points_", "._", "append_", "(_", "f_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "curve", "Points_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "fit", "Bez", "ier", "Simple_", "(_", "pts_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "T_", "=_", "[_", "np_", "._", "linalg_", "._", "norm_", "(_", "pts_", "[_", "i_", "]_", "-_", "pts_", "[_", "i_", "-_", "1_", "]_", ")_", "for_", "i_", "in_", "range_", "(_", "1_", ",_", "len_", "(_", "pts_", ")_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tsu", "m_", "=_", "np_", "._", "sum_", "(_", "T_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "T_", "=_", "[_", "0_", "]_", "+_", "T_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "T_", "=_", "[_", "np_", "._", "sum_", "(_", "T_", "[_", "0_", ":_", "i_", "+_", "1_", "]_", ")_", "/_", "tsu", "m_", "for_", "i_", "in_", "range_", "(_", "len_", "(_", "pts_", ")_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "T_", "=_", "[_", "[_", "t_", "**_", "3_", ",_", "t_", "**_", "2_", ",_", "t_", ",_", "1_", "]_", "for_", "t_", "in_", "T_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "T_", "=_", "np_", "._", "array_", "(_", "T_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "M_", "=_", "np_", "._", "array_", "(_", "[_", "[_", "-_", "1_", ",_", "3_", ",_", "-_", "3_", ",_", "1_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "3_", ",_", "-_", "6_", ",_", "3_", ",_", "0_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "-_", "3_", ",_", "3_", ",_", "0_", ",_", "0_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "1_", ",_", "0_", ",_", "0_", ",_", "0_", "]_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "T_", "=_", "T_", "._", "dot_", "(_", "M_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "T_", "=_", "np_", "._", "concatenate_", "(_", "(_", "T_", ",_", "np_", "._", "array_", "(_", "[_", "[_", "100_", ",_", "0_", ",_", "0_", ",_", "0_", "]_", ",_", "[_", "0_", ",_", "0_", ",_", "0_", ",_", "100_", "]_", "]_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "pts", " ", "=", " ", "np", ".", "vst", "ack", "((", "pts", ",", " ", "pts", "[", "0", "]", " ", "*", " ", "100", ",", " ", "pts", "[-", "1", "]", " ", "*", " ", "100", "))", "_", "\\u\\u\\uNL\\u\\u\\u_", "C_", "=_", "np_", "._", "linalg_", "._", "lst", "sq_", "(_", "T_", ",_", "pts_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "C_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "subdivi", "de", "Line", "Segment_", "(_", "pts_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "out_", "=_", "[_", "pts_", "[_", "0_", "]_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", "in_", "range_", "(_", "1_", ",_", "len_", "(_", "pts_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "out_", "._", "append_", "(_", "pts_", "[_", "i_", "-_", "1_", "]_", "+_", "(_", "pts_", "[_", "i_", "]_", "-_", "pts_", "[_", "i_", "-_", "1_", "]_", ")_", "*_", ".5_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "out_", "._", "append_", "(_", "pts_", "[_", "i_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "np_", "._", "array_", "(_", "out_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "fit", "Bez", "ier_", "(_", "pts_", ",_", "tangent", "0_", "=_", "None_", ",_", "tangent", "3_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "len_", "(_", "pts_", "<_", "4_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pts_", "=_", "subdivi", "de", "Line", "Segment_", "(_", "pts_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "T_", "=_", "[_", "np_", "._", "linalg_", "._", "norm_", "(_", "pts_", "[_", "i_", "]_", "-_", "pts_", "[_", "i_", "-_", "1_", "]_", ")_", "for_", "i_", "in_", "range_", "(_", "1_", ",_", "len_", "(_", "pts_", ")_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tsu", "m_", "=_", "np_", "._", "sum_", "(_", "T_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "T_", "=_", "[_", "0_", "]_", "+_", "T_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "T_", "=_", "[_", "np_", "._", "sum_", "(_", "T_", "[_", "0_", ":_", "i_", "+_", "1_", "]_", ")_", "/_", "tsu", "m_", "for_", "i_", "in_", "range_", "(_", "len_", "(_", "pts_", ")_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "T_", "=_", "[_", "[_", "t_", "**_", "3_", ",_", "t_", "**_", "2_", ",_", "t_", ",_", "1_", "]_", "for_", "t_", "in_", "T_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "T_", "=_", "np_", "._", "array_", "(_", "T_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "M_", "=_", "np_", "._", "array_", "(_", "[_", "[_", "-_", "1_", ",_", "3_", ",_", "-_", "3_", ",_", "1_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "3_", ",_", "-_", "6_", ",_", "3_", ",_", "0_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "-_", "3_", ",_", "3_", ",_", "0_", ",_", "0_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "1_", ",_", "0_", ",_", "0_", ",_", "0_", "]_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "T_", "=_", "T_", "._", "dot_", "(_", "M_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "n_", "=_", "len_", "(_", "pts_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pou", "t_", "=_", "pts_", "._", "copy_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pou", "t_", "[_", ":_", ",_", "0_", "]_", "-=_", "(_", "T_", "[_", ":_", ",_", "0_", "]_", "*_", "pts_", "[_", "0_", ",_", "0_", "]_", ")_", "+_", "(_", "T_", "[_", ":_", ",_", "3_", "]_", "*_", "pts_", "[_", "-_", "1_", ",_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pou", "t_", "[_", ":_", ",_", "1_", "]_", "-=_", "(_", "T_", "[_", ":_", ",_", "0_", "]_", "*_", "pts_", "[_", "0_", ",_", "1_", "]_", ")_", "+_", "(_", "T_", "[_", ":_", ",_", "3_", "]_", "*_", "pts_", "[_", "-_", "1_", ",_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "TT_", "=_", "np_", "._", "zeros_", "(_", "(_", "n_", "*_", "2_", ",_", "4_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", "in_", "range_", "(_", "n_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "j_", "in_", "range_", "(_", "2_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "TT_", "[_", "i_", "*_", "2_", ",_", "j_", "*_", "2_", "]_", "=_", "T_", "[_", "i_", ",_", "j_", "+_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "TT_", "[_", "i_", "*_", "2_", "+_", "1_", ",_", "j_", "*_", "2_", "+_", "1_", "]_", "=_", "T_", "[_", "i_", ",_", "j_", "+_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "pou", "t_", "=_", "pou", "t_", "._", "reshape_", "(_", "(_", "n_", "*_", "2_", ",_", "1_", ")_", ",_", "order_", "=_", "\"", "C", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "tangent", "0_", "!=_", "None_", "and_", "tangent", "3_", "!=_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "tangent", "Constr", "aint", "s", "T_", "=_", "np_", "._", "array_", "(_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "tangent", "0_", "[_", "1_", "]_", ",_", "-_", "tangent", "0_", "[_", "0_", "]_", ",_", "0_", ",_", "0_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "0_", ",_", "0_", ",_", "tangent", "3_", "[_", "1_", "]_", ",_", "-_", "tangent", "3_", "[_", "0_", "]_", "]_", "\\u\\u\\uNL\\u\\u\\u_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tangent", "Constr", "aint", "s", "P_", "=_", "np_", "._", "array_", "(_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "pts_", "[_", "0_", "]_", "[_", "1_", "]_", "*_", "-_", "tangent", "0_", "[_", "0_", "]_", "+_", "pts_", "[_", "0_", "]_", "[_", "0_", "]_", "*_", "tangent", "0_", "[_", "1_", "]_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "pts_", "[_", "-_", "1_", "]_", "[_", "1_", "]_", "*_", "-_", "tangent", "3_", "[_", "0_", "]_", "+_", "pts_", "[_", "-_", "1_", "]_", "[_", "0_", "]_", "*_", "tangent", "3_", "[_", "1_", "]_", "]_", "\\u\\u\\uNL\\u\\u\\u_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "TT_", "=_", "np_", "._", "concatenate_", "(_", "(_", "TT_", ",_", "tangent", "Constr", "aint", "s", "T_", "*_", "1000_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pou", "t_", "=_", "np_", "._", "concatenate_", "(_", "(_", "pou", "t_", ",_", "tangent", "Constr", "aint", "s", "P_", "*_", "1000_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "C_", "=_", "np_", "._", "linalg_", "._", "lst", "sq_", "(_", "TT_", ",_", "pou", "t_", ")_", "[_", "0_", "]_", "._", "reshape_", "(_", "(_", "2_", ",_", "2_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "np_", "._", "array_", "(_", "[_", "pts_", "[_", "0_", "]_", ",_", "C_", "[_", "0_", "]_", ",_", "C_", "[_", "1_", "]_", ",_", "pts_", "[_", "-_", "1_", "]_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "segment", "Glyph_", "(_", "glyph_", ",_", "resolution_", "=_", "50_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "g1_", "=_", "glyph_", "._", "copy_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "g1_", "._", "clear_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dp_", "=_", "Subs", "eg", "ment", "Point", "Pen_", "(_", "g1_", ",_", "resolution_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "glyph_", "._", "draw", "Points_", "(_", "dp_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "g1_", ",_", "dp_", "._", "get", "Subs", "eg", "ments_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "fit", "Glyph_", "(_", "glyph_", ",_", "subse", "gment", "Glyph_", ",_", "subse", "gment", "Indices_", ",_", "match", "Tang", "ents_", "=_", "True_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "out", "Glyph_", "=_", "glyph_", "._", "copy_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "out", "Glyph_", "._", "clear_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fit", "Pen_", "=_", "Subs", "eg", "ment", "s", "To", "Curve", "s", "Point", "Pen_", "(_", "out", "Glyph_", ",_", "subse", "gment", "Glyph_", ",_", "subse", "gment", "Indices_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fit", "Pen_", "._", "set", "Match", "Tang", "ents_", "(_", "match", "Tang", "ents_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "smooth", "Pen", " ", "=", " ", "Guess", "Smooth", "Point", "Pen", "(", "fit", "Pen", ")_", "\\u\\u\\uNL\\u\\u\\u_", "glyph_", "._", "draw", "Points_", "(_", "fit", "Pen_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "out", "Glyph_", "._", "width_", "=_", "subse", "gment", "Glyph_", "._", "width_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "out", "Glyph_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Variable defined multiple times
statsmodels/statsmodels/statsmodels/sandbox/gam.py
[ { "content": " def next(self):\n '''internal calculation for one fit iteration\n\n BUG: I think this does not improve, what is supposed to improve\n offset doesn't seem to be used, neither an old alpha\n The smoothers keep coef/params from previous iteration\n '''\n _results = self.results\n Y = self.results.Y\n mu = _results.predict(self.exog)\n #TODO offset is never used ?\n offset = np.zeros(self.exog.shape[1], np.float64)\n alpha = (Y * self.weights).sum() / self.weights.sum()\n for i in range(self.exog.shape[1]):\n tmp = self.smoothers[i].predict()\n #TODO: check what smooth needs to do\n #smooth (alias for fit, fit given x to new y and attach\n #print 'next shape', (Y - alpha - mu + tmp).shape\n bad = np.isnan(Y - alpha - mu + tmp).any()\n if bad: #temporary assert while debugging\n print(Y, alpha, mu, tmp)\n raise ValueError(\"nan encountered\")\n #self.smoothers[i].smooth(Y - alpha - mu + tmp,\n self.smoothers[i].smooth(Y - mu + tmp,\n weights=self.weights)\n tmp2 = self.smoothers[i].predict() #fittedvalues of previous smooth/fit\n self.results.offset[i] = -(tmp2*self.weights).sum() / self.weights.sum()\n #self.offset used in smoothed\n if DEBUG:\n print(self.smoothers[i].params)\n mu += tmp2 - tmp\n #change setting offset here: tests still pass, offset equal to constant\n #in component ??? what's the effect of offset\n offset = self.results.offset\n #print self.iter\n #self.iter += 1 #missing incrementing of iter counter NOT\n return Results(Y, alpha, self.exog, self.smoothers, self.family, offset)", "metadata": "root.AdditiveModel.next", "header": "['class', 'AdditiveModel', '(', 'object', ')', ':', '___EOS___']", "index": 220 } ]
[ { "span": "offset ", "start_line": 231, "start_column": 8, "end_line": 231, "end_column": 14 } ]
[ { "span": "offset ", "start_line": 253, "start_column": 8, "end_line": 253, "end_column": 14 } ]
1
true
[ "[CLS]_", "Variable_", "defined_", "multiple_", "times_", "[SEP]_", "class_", "Add", "iti", "ve", "Model_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "next_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "internal", " ", "calculati", "on", " ", "for", " ", "one", " ", "fit", " ", "iterati", "on", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "BUG", ":", " ", "I", " ", "think", " ", "this", " ", "doe", "s", " ", "not", " ", "improve", ",", " ", "what", " ", "is", " ", "supposed", " ", "to", " ", "improve", "\\", "10", ";", " ", " ", " ", " ", "offset", " ", "doe", "sn", "'", "t", " ", "see", "m", " ", "to", " ", "be", " ", "used", ",", " ", "nei", "ther", " ", "an", " ", "old", " ", "alpha", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "smooth", "ers", " ", "keep", " ", "coef", "/", "params", " ", "from", " ", "previ", "ous", " ", "iterati", "on", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "results_", "=_", "self_", "._", "results_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Y_", "=_", "self_", "._", "results_", "._", "Y_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mu_", "=_", "\\u", "results_", "._", "predict_", "(_", "self_", "._", "exo", "g_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "TOD", "O", " ", "offset", " ", "is", " ", "neve", "r", " ", "used", " ", "?", "_", "\\u\\u\\uNL\\u\\u\\u_", "offset_", "=_", "np_", "._", "zeros_", "(_", "self_", "._", "exo", "g_", "._", "shape_", "[_", "1_", "]_", ",_", "np_", "._", "float64_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "alpha_", "=_", "(_", "Y_", "*_", "self_", "._", "weights_", ")_", "._", "sum_", "(_", ")_", "/_", "self_", "._", "weights_", "._", "sum_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", "in_", "range_", "(_", "self_", "._", "exo", "g_", "._", "shape_", "[_", "1_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "tmp_", "=_", "self_", "._", "smooth", "ers_", "[_", "i_", "]_", "._", "predict_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "TOD", "O", ":", " ", "check", " ", "what", " ", "smooth", " ", "need", "s", " ", "to", " ", "do_", "\\u\\u\\uNL\\u\\u\\u_", "#", "smooth", " ", "(", "alias", " ", "for", " ", "fit", ",", " ", "fit", " ", "give", "n", " ", "x", " ", "to", " ", "new", " ", "y", " ", "and", " ", "attach_", "\\u\\u\\uNL\\u\\u\\u_", "#", "print", " ", "'", "next", " ", "shape", "',", " ", "(", "Y", " ", "-", " ", "alpha", " ", "-", " ", "mu", " ", "+", " ", "tmp", ").", "shape_", "\\u\\u\\uNL\\u\\u\\u_", "bad_", "=_", "np_", "._", "isnan_", "(_", "Y_", "-_", "alpha_", "-_", "mu_", "+_", "tmp_", ")_", "._", "any_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "bad_", ":_", "#", "temporar", "y", " ", "assert", " ", "whi", "le", " ", "debugg", "ing_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "Y_", ",_", "alpha_", ",_", "mu_", ",_", "tmp_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "Value", "Error_", "(_", "\"", "nan", " ", "encounter", "ed", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "self", ".", "smooth", "ers", "[", "i", "].", "smooth", "(", "Y", " ", "-", " ", "alpha", " ", "-", " ", "mu", " ", "+", " ", "tmp", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "smooth", "ers_", "[_", "i_", "]_", "._", "smooth_", "(_", "Y_", "-_", "mu_", "+_", "tmp_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "weights_", "=_", "self_", "._", "weights_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tmp2_", "=_", "self_", "._", "smooth", "ers_", "[_", "i_", "]_", "._", "predict_", "(_", ")_", "#", "fitted", "values", " ", "of", " ", "previ", "ous", " ", "smooth", "/", "fit_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "results_", "._", "offset_", "[_", "i_", "]_", "=_", "-_", "(_", "tmp2_", "*_", "self_", "._", "weights_", ")_", "._", "sum_", "(_", ")_", "/_", "self_", "._", "weights_", "._", "sum_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "self", ".", "offset", " ", "used", " ", "in", " ", "smoothed", "_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "DEBUG_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "self_", "._", "smooth", "ers_", "[_", "i_", "]_", "._", "params_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "mu_", "+=_", "tmp2_", "-_", "tmp_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "change", " ", "setti", "ng", " ", "offset", " ", "here", ":", " ", "tests", " ", "still", " ", "pass", ",", " ", "offset", " ", "equal", " ", "to", " ", "constant_", "\\u\\u\\uNL\\u\\u\\u_", "#", "in", " ", "component", " ", "???", " ", "what", "'", "s", " ", "the", " ", "effect", " ", "of", " ", "offset_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "offset_", "=_", "self_", "._", "results_", "._", "offset_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "print", " ", "self", ".", "iter_", "\\u\\u\\uNL\\u\\u\\u_", "#", "self", ".", "iter", " ", "+=", " ", "1", " ", "#", "missi", "ng", " ", "increment", "ing", " ", "of", " ", "iter", " ", "counter", " ", "NOT", "_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "Results_", "(_", "Y_", ",_", "alpha_", ",_", "self_", "._", "exo", "g_", ",_", "self_", "._", "smooth", "ers_", ",_", "self_", "._", "family_", ",_", "offset_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0,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2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused local variable
Impactstory/total-impact-webapp/totalimpactwebapp/event_monitoring.py
[ { "content": "def new_user(slug, email):\n webhook_slugs = os.getenv(\"ZAPIER_ALERT_HOOKS\", None)\n if (webhook_slugs is None) or is_test_email(email):\n return False\n\n for webhook_slug in webhook_slugs.split(\",\"):\n\n zapier_webhook_url = \"http://zapier.com/hooks/catch/n/{webhook_slug}/\".format(\n webhook_slug=webhook_slug)\n data = {\n \"user_profile_url\": \"https://impactstory.org/\" + slug\n }\n headers = {'Content-type': 'application/json', 'Accept': 'application/json'}\n\n r = requests.post( zapier_webhook_url, data=data, headers=headers)", "metadata": "root.new_user", "header": "['module', '___EOS___']", "index": 9 } ]
[ { "span": "r ", "start_line": 23, "start_column": 8, "end_line": 23, "end_column": 9 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "new", "\\u", "user_", "(_", "slug_", ",_", "email_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "webho", "ok", "\\u", "slug", "s_", "=_", "os_", "._", "getenv_", "(_", "\"", "ZA", "PIE", "R", "\\u", "ALERT", "\\u", "HOOK", "S", "\"_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "(_", "webho", "ok", "\\u", "slug", "s_", "is_", "None_", ")_", "or_", "is", "\\u", "test\\u", "email_", "(_", "email_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "webho", "ok", "\\u", "slug_", "in_", "webho", "ok", "\\u", "slug", "s_", "._", "split_", "(_", "\",\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "zapi", "er", "\\u", "webho", "ok", "\\u", "url_", "=_", "\"", "http", "://", "zapi", "er", ".", "com", "/", "hook", "s", "/", "catch", "/", "n", "/{", "webho", "ok", "\\u", "slug", "}/", "\"_", "._", "format_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "webho", "ok", "\\u", "slug_", "=_", "webho", "ok", "\\u", "slug_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "user", "\\u", "profile", "\\u", "url", "\"_", ":_", "\"", "https", "://", "impact", "stor", "y", ".", "org", "/\"_", "+_", "slug_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "headers_", "=_", "{_", "'", "Conten", "t", "-", "type", "'_", ":_", "'", "applica", "tion", "/", "json", "'_", ",_", "'", "Accept", "'_", ":_", "'", "applica", "tion", "/", "json", "'_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "r_", "=_", "requests_", "._", "post_", "(_", "zapi", "er", "\\u", "webho", "ok", "\\u", "url_", ",_", "data_", "=_", "data_", ",_", "headers_", "=_", "headers_", ")_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
ReactiveX/RxPY/tests/test_observable/test_doaction.py
[ { "content": "import unittest\n\nfrom rx.observable import Observable\nfrom rx.testing import TestScheduler, ReactiveTest\nfrom rx.disposables import Disposable, SerialDisposable\n\non_next = ReactiveTest.on_next\non_completed = ReactiveTest.on_completed\non_error = ReactiveTest.on_error\nsubscribe = ReactiveTest.subscribe\nsubscribed = ReactiveTest.subscribed\ndisposed = ReactiveTest.disposed\ncreated = ReactiveTest.created\n\n\n# def test_do_next_error(self):\n# ex = 'ex'\n# scheduler = TestScheduler()\n# xs = scheduler.create_hot_observable(on_next(150, 1), on_next(210, 2), on_next(220, 3), on_next(230, 4), on_next(240, 5), on_error(250, ex))\n# i = [0]\n# sum = [2 + 3 + 4 + 5]\n# saw_error = False\n# scheduler.start(create)\n# return xs.do_action(function (x) {\n# i[0] += 1\n# sum -= x\n# }, function (e) {\n# saw_error = e == ex\n\n\n# self.assertEqual(4, i)\n# self.assertEqual(0, sum)\n# assert(saw_error)\n\n# def test_do_next_error_not(self):\n# scheduler = TestScheduler()\n# xs = scheduler.create_hot_observable(on_next(150, 1), on_next(210, 2), on_next(220, 3), on_next(230, 4), on_next(240, 5), on_completed(250))\n# i = [0]\n# sum = [2 + 3 + 4 + 5]\n# saw_error = False\n# scheduler.start(create)\n# return xs.do_action(function (x) {\n# i[0] += 1\n# sum -= x\n# }, function (e) {\n# saw_error = True\n\n\n# self.assertEqual(4, i)\n# self.assertEqual(0, sum)\n# assert(not saw_error)\n\n# def test_do_next_error_completed(self):\n# scheduler = TestScheduler()\n# xs = scheduler.create_hot_observable(on_next(150, 1), on_next(210, 2), on_next(220, 3), on_next(230, 4), on_next(240, 5), on_completed(250))\n# i = [0]\n# sum = [2 + 3 + 4 + 5]\n# saw_error = False\n# has_completed = False\n# scheduler.start(create)\n# return xs.do_action(function (x) {\n# i[0] += 1\n# sum -= x\n# }, function (e) {\n# saw_error = True\n# }, function () {\n# has_completed = True\n\n\n# self.assertEqual(4, i)\n# self.assertEqual(0, sum)\n# assert(not saw_error)\n# assert(has_completed)\n\n# def test_do_next_error_completed_error(self):\n# ex = 'ex'\n# scheduler = TestScheduler()\n# xs = scheduler.create_hot_observable(on_next(150, 1), on_next(210, 2), on_next(220, 3), on_next(230, 4), on_next(240, 5), on_error(250, ex))\n# i = [0]\n# sum = [2 + 3 + 4 + 5]\n# saw_error = False\n# has_completed = False\n# scheduler.start(create)\n# return xs.do_action(function (x) {\n# i[0] += 1\n# sum -= x\n# }, function (e) {\n# saw_error = ex == e\n# }, function () {\n# has_completed = True\n\n\n# self.assertEqual(4, i)\n# self.assertEqual(0, sum)\n# assert(saw_error)\n# assert(not has_completed)\n\n# def test_do_next_error_completed_never(self):\n# scheduler = TestScheduler()\n# i = [0]\n# saw_error = False\n# has_completed = False\n# scheduler.start(create)\n# return Observable.never().do_action(function (x) {\n# i[0] += 1\n# }, function (e) {\n# saw_error = True\n# }, function () {\n# has_completed = True\n\n# self.assertEqual(0, i)\n# assert(not saw_error)\n# assert(not has_completed)\n\n# def test_Do_Observer_SomeDataWithError(self):\n# ex = 'ex'\n# scheduler = TestScheduler()\n# xs = scheduler.create_hot_observable(on_next(150, 1), on_next(210, 2), on_next(220, 3), on_next(230, 4), on_next(240, 5), on_error(250, ex))\n# i = [0]\n# sum = [2 + 3 + 4 + 5]\n# saw_error = False\n# has_completed = False\n# scheduler.start(create)\n# return xs.do_action(Observer.create(function (x) {\n# i[0] += 1\n# sum -= x\n# }, function (e) {\n# saw_error = e == ex\n# }, function () {\n# has_completed = True\n# }))\n\n# self.assertEqual(4, i)\n# self.assertEqual(0, sum)\n# assert(saw_error)\n# assert(not has_completed)\n\n# def test_do_observer_some_data_with_error(self):\n# scheduler = TestScheduler()\n# xs = scheduler.create_hot_observable(on_next(150, 1), on_next(210, 2), on_next(220, 3), on_next(230, 4), on_next(240, 5), on_completed(250))\n# i = [0]\n# sum = [2 + 3 + 4 + 5]\n# saw_error = False\n# has_completed = False\n# scheduler.start(create)\n# return xs.do_action(Observer.create(function (x) {\n# i[0] += 1\n# sum -= x\n# }, function (e) {\n# saw_error = True\n# }, function () {\n# has_completed = True\n# }))\n\n# self.assertEqual(4, i)\n# self.assertEqual(0, sum)\n# assert(not saw_error)\n# assert(has_completed)\n\n# def test_do1422_next_next_throws(self):\n# ex = 'ex'\n# scheduler = TestScheduler()\n# xs = scheduler.create_hot_observable(on_next(150, 1), on_next(210, 2), on_completed(250))\n# results = scheduler.start(create)\n# return xs.do_action(function () {\n# raise Exception(ex)\n\n\n# results.messages.assert_equal(on_error(210, ex))\n\n# def test_do1422_next_completed_next_throws(self):\n# ex = 'ex'\n# scheduler = TestScheduler()\n# xs = scheduler.create_hot_observable(on_next(150, 1), on_next(210, 2), on_completed(250))\n# results = scheduler.start(create)\n# return xs.do_action(function () {\n# throw ex\n# }, _undefined, function () {\n\n# results.messages.assert_equal(on_error(210, ex))\n\n# def test_do1422_next_completed_completed_throws(self):\n# ex = 'ex'\n# scheduler = TestScheduler()\n# xs = scheduler.create_hot_observable(on_next(150, 1), on_next(210, 2), on_completed(250))\n# results = scheduler.start(create)\n# return xs.do_action(function () { }, _undefined, function () {\n# throw ex\n\n\n# results.messages.assert_equal(on_next(210, 2), on_error(250, ex))\n\n# def test_do1422_next_error_next_throws(self):\n# ex = 'ex'\n# scheduler = TestScheduler()\n# xs = scheduler.create_hot_observable(on_next(150, 1), on_next(210, 2), on_completed(250))\n# results = scheduler.start(create)\n# return xs.do_action(function () {\n# raise Exception(ex)\n# }, function () {\n\n# results.messages.assert_equal(on_error(210, ex))\n\n# def test_Do1422_NextError_NextThrows(self):\n# var ex1, ex2, results, scheduler, xs\n# ex1 = 'ex1'\n# ex2 = 'ex2'\n# scheduler = TestScheduler()\n# xs = scheduler.create_hot_observable(on_next(150, 1), on_error(210, ex1))\n# results = scheduler.start(create)\n# return xs.do_action(function () { }, function () {\n# raise Exception(ex)2\n\n\n# results.messages.assert_equal(on_error(210, ex2))\n\n# def test_Do1422_NextErrorCompleted_NextThrows(self):\n# var ex, results, scheduler, xs\n# ex = 'ex'\n# scheduler = TestScheduler()\n# xs = scheduler.create_hot_observable(on_next(150, 1), on_next(210, 2), on_completed(250))\n# results = scheduler.start(create)\n# return xs.do_action(function () {\n# raise Exception(ex)\n# }, function () { }, function () {\n\n# results.messages.assert_equal(on_error(210, ex))\n\n# def test_do1422_next_error_completed_error_throws(self):\n# var ex1, ex2, results, scheduler, xs\n# ex1 = 'ex1'\n# ex2 = 'ex2'\n# scheduler = TestScheduler()\n# xs = scheduler.create_hot_observable(on_next(150, 1), on_error(210, ex1))\n# results = scheduler.start(create)\n# return xs.do_action(function () { }, function () {\n# raise Exception(ex)2\n# }, function () {\n\n# results.messages.assert_equal(on_error(210, ex2))\n\n# def test_do1422_next_error_completed_completed_throws(self):\n# ex = 'ex'\n# scheduler = TestScheduler()\n# xs = scheduler.create_hot_observable(on_next(150, 1), on_next(210, 2), on_completed(250))\n# results = scheduler.start(create)\n# return xs.do_action(function () { }, function () { }, function () {\n# raise Exception(ex)\n\n\n# results.messages.assert_equal(on_next(210, 2), on_error(250, ex))\n\n# def test_do1422_observer_next_throws(self):\n# ex = 'ex'\n# scheduler = TestScheduler()\n# xs = scheduler.create_hot_observable(on_next(150, 1), on_next(210, 2), on_completed(250))\n# results = scheduler.start(create)\n# return xs.do_action(Observer.create(function () {\n# raise Exception(ex)\n# }, function () { }, function () { }))\n\n# results.messages.assert_equal(on_error(210, ex))\n\n# def test_do1422_observer_error_throws(self):\n# var ex1, ex2, results, scheduler, xs\n# ex1 = 'ex1'\n# ex2 = 'ex2'\n# scheduler = TestScheduler()\n# xs = scheduler.create_hot_observable(on_next(150, 1), on_error(210, ex1))\n# results = scheduler.start(create)\n# return xs.do_action(Observer.create(function () { }, function () {\n# raise Exception(ex)2\n# }, function () { }))\n\n# results.messages.assert_equal(on_error(210, ex2))\n\n# def test_do1422_observer_completed_throws(self):\n# var ex, results, scheduler, xs\n# ex = 'ex'\n# scheduler = TestScheduler()\n# xs = scheduler.create_hot_observable(on_next(150, 1), on_next(210, 2), on_completed(250))\n# results = scheduler.start(create)\n# return xs.do_action(Observer.create(function () { }, function () { }, function () {\n# raise Exception(ex)\n# }))\n\n# results.messages.assert_equal(on_next(210, 2), on_error(250, ex))\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class TestDo(unittest.TestCase):\n\n\n", "metadata": "root.TestDo", "header": "['module', '___EOS___']", "index": 14 }, { "content": " def test_do_should_see_all_values(self):\n scheduler = TestScheduler()\n xs = scheduler.create_hot_observable(on_next(150, 1), on_next(210, 2), on_next(220, 3), on_next(230, 4), on_next(240, 5), on_completed(250))\n i = [0]\n sum = [2 + 3 + 4 + 5]\n\n def create():\n def action(x):\n i[0] += 1\n sum[0] -= x\n return sum[0]\n return xs.do_action(action)\n\n scheduler.start(create)\n\n self.assertEqual(4, i[0])\n self.assertEqual(0, sum[0])", "metadata": "root.TestDo.test_do_should_see_all_values", "header": "['class', 'TestDo', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 15 }, { "content": " def test_do_plain_action(self):\n scheduler = TestScheduler()\n xs = scheduler.create_hot_observable(on_next(150, 1), on_next(210, 2), on_next(220, 3), on_next(230, 4), on_next(240, 5), on_completed(250))\n i = [0]\n\n def create():\n def action(x):\n i[0] += 1\n return i[0]\n return xs.do_action(action)\n scheduler.start(create)\n\n self.assertEqual(4, i[0])", "metadata": "root.TestDo.test_do_plain_action", "header": "['class', 'TestDo', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 33 }, { "content": " def test_do_next_completed(self):\n scheduler = TestScheduler()\n xs = scheduler.create_hot_observable(on_next(150, 1), on_next(210, 2), on_next(220, 3), on_next(230, 4), on_next(240, 5), on_completed(250))\n i = [0]\n sum = [2 + 3 + 4 + 5]\n completed = [False]\n def create():\n def on_next(x):\n i[0] += 1\n sum[0] -= x\n def on_completed():\n completed[0] = True\n return xs.do_action(on_next=on_next, on_completed=on_completed)\n\n scheduler.start(create)\n\n self.assertEqual(4, i[0])\n self.assertEqual(0, sum[0])\n assert(completed[0])", "metadata": "root.TestDo.test_do_next_completed", "header": "['class', 'TestDo', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 47 }, { "content": " def test_do_next_completed_never(self):\n scheduler = TestScheduler()\n i = [0]\n completed = [False]\n\n def create():\n def on_next(x):\n i[0] += 1\n def on_completed(): \n completed = True\n return Observable.never().do_action(on_next=on_next, on_completed=on_completed)\n \n scheduler.start(create)\n\n self.assertEqual(0, i[0])\n assert(not completed[0])", "metadata": "root.TestDo.test_do_next_completed_never", "header": "['class', 'TestDo', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 67 } ]
[ { "span": "from rx.disposables import Disposable, SerialDisposable", "start_line": 4, "start_column": 0, "end_line": 4, "end_column": 55 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "import_", "unittest_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "rx_", "._", "observable_", "import_", "Observable_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "rx_", "._", "testing_", "import_", "Test", "Scheduler_", ",_", "React", "ive", "Test_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "rx_", "._", "dispo", "sab", "les_", "import_", "Dispo", "sab", "le_", ",_", "Ser", "ial", "Dispo", "sab", "le_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "on", "\\u", "next_", "=_", "React", "ive", "Test_", "._", "on", "\\u", "next_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "on", "\\u", "completed_", "=_", "React", "ive", "Test_", "._", "on", "\\u", "completed_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "on", "\\u", "error_", "=_", "React", "ive", "Test_", "._", "on", "\\u", "error_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "subscribe_", "=_", "React", "ive", "Test_", "._", "subscribe_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "subscribed", "_", "=_", "React", "ive", "Test_", "._", "subscribed", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dispose", "d_", "=_", "React", "ive", "Test_", "._", "dispose", "d_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "created_", "=_", "React", "ive", "Test_", "._", "created_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "def", " ", "test\\u", "do", "\\u", "next", "\\u", "error", "(", "self", "):", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "ex", " ", "=", " ", "'", "ex", "'_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "schedule", "r", " ", "=", " ", "Test", "Schedule", "r", "()", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "xs", " ", "=", " ", "schedule", "r", ".", "create", "\\u", "hot", "\\u", "observable", "(", "on", "\\u", "next", "(", "150", ",", " ", "1", "),", " ", "on", "\\u", "next", "(", "210", ",", " ", "2", "),", " ", "on", "\\u", "next", "(", "220", ",", " ", "3", "),", " ", "on", "\\u", "next", "(", "230", ",", " ", "4", "),", " ", "on", "\\u", "next", "(", "240", ",", " ", "5", "),", " ", "on", "\\u", "error", "(", "250", ",", " ", "ex", "))", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "i", " ", "=", " ", "[", "0", "]_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "sum", " ", "=", " ", "[", "2", " ", "+", " ", "3", " ", "+", " ", "4", " ", "+", " ", "5", "]_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "saw", "\\u", "error", " ", "=", " ", "False_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "schedule", "r", ".", "start", "(", "create", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "return", " ", "xs", ".", "do", "\\u", "action", "(", "function", " ", "(", "x", ")", " ", "{_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "i", "[", "0", "]", " ", "+=", " ", "1_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "sum", " ", "-=", " ", "x_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "},", " ", "function", " ", "(", "e", ")", " ", "{_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "saw", "\\u", "error", " ", "=", " ", "e", " ", "==", " ", "ex_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "self", ".", "assert", "Equal", "(", "4", ",", " ", "i", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "self", ".", "assert", "Equal", "(", "0", ",", " ", "sum", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "assert", "(", "saw", "\\u", "error", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "def", " ", "test\\u", "do", "\\u", "next", "\\u", "error", "\\u", "not", "(", "self", "):", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "schedule", "r", " ", "=", " ", "Test", "Schedule", "r", "()", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "xs", " ", "=", " ", "schedule", "r", ".", "create", "\\u", "hot", "\\u", "observable", "(", "on", "\\u", "next", "(", "150", ",", " ", "1", "),", " ", "on", "\\u", "next", "(", "210", ",", " ", "2", "),", " ", "on", "\\u", "next", "(", "220", ",", " ", "3", "),", " ", "on", "\\u", "next", "(", "230", ",", " ", "4", "),", " ", "on", "\\u", "next", "(", "240", ",", " ", "5", "),", " ", "on", "\\u", "complete", "d", "(", "250", "))", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "i", " ", "=", " ", "[", "0", "]_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "sum", " ", "=", " ", "[", "2", " ", "+", " ", "3", " ", "+", " ", "4", " ", "+", " ", "5", "]_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "saw", "\\u", "error", " ", "=", " ", "False_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "schedule", "r", ".", "start", "(", "create", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "return", " ", "xs", ".", "do", "\\u", "action", "(", "function", " ", "(", "x", ")", " ", "{_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "i", "[", "0", "]", " ", "+=", " ", "1_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "sum", " ", "-=", " ", "x_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "},", " ", "function", " ", "(", "e", ")", " ", "{_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "saw", "\\u", "error", " ", "=", " ", "True_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "self", ".", "assert", "Equal", "(", "4", ",", " ", "i", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "self", ".", "assert", "Equal", "(", "0", ",", " ", "sum", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "assert", "(", "not", " ", "saw", "\\u", "error", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "def", " ", "test\\u", "do", "\\u", "next", "\\u", "error", "\\u", "complete", "d", "(", "self", "):", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "schedule", "r", " ", "=", " ", "Test", "Schedule", "r", "()", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "xs", " ", "=", " ", "schedule", "r", ".", "create", "\\u", "hot", "\\u", "observable", "(", "on", "\\u", "next", "(", "150", ",", " ", "1", "),", " ", "on", "\\u", "next", "(", "210", ",", " ", "2", "),", " ", "on", "\\u", "next", "(", "220", ",", " ", "3", "),", " ", "on", "\\u", "next", "(", "230", ",", " ", "4", "),", " ", "on", "\\u", "next", "(", "240", ",", " ", "5", "),", " ", "on", "\\u", "complete", "d", "(", "250", "))", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "i", " ", "=", " ", "[", "0", "]_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "sum", " ", "=", " ", "[", "2", " ", "+", " ", "3", " ", "+", " ", "4", " ", "+", " ", "5", "]_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "saw", "\\u", "error", " ", "=", " ", "False_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "has", "\\u", "complete", "d", " ", "=", " ", "False_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "schedule", "r", ".", "start", "(", "create", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "return", " ", "xs", ".", "do", "\\u", "action", "(", "function", " ", "(", "x", ")", " ", "{_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "i", "[", "0", "]", " ", "+=", " ", "1_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "sum", " ", "-=", " ", "x_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "},", " ", "function", " ", "(", "e", ")", " ", "{_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "saw", "\\u", "error", " ", "=", " ", "True_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "},", " ", "function", " ", "()", " ", "{_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "has", "\\u", "complete", "d", " ", "=", " ", "True_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "self", ".", "assert", "Equal", "(", "4", ",", " ", "i", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "self", ".", "assert", "Equal", "(", "0", ",", " ", "sum", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "assert", "(", "not", " ", "saw", "\\u", "error", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "assert", "(", "has", "\\u", "complete", "d", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "def", " ", "test\\u", "do", "\\u", "next", "\\u", "error", "\\u", "complete", "d\\u", "error", "(", "self", "):", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "ex", " ", "=", " ", "'", "ex", "'_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "schedule", "r", " ", "=", " ", "Test", "Schedule", "r", "()", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "xs", " ", "=", " ", "schedule", "r", ".", "create", "\\u", "hot", "\\u", "observable", "(", "on", "\\u", "next", "(", "150", ",", " ", "1", "),", " ", "on", "\\u", "next", "(", "210", ",", " ", "2", "),", " ", "on", "\\u", "next", "(", "220", ",", " ", "3", "),", " ", "on", "\\u", "next", "(", "230", ",", " ", "4", "),", " ", "on", "\\u", "next", "(", "240", ",", " ", "5", "),", " ", "on", "\\u", "error", "(", "250", ",", " ", "ex", "))", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "i", " ", "=", " ", "[", "0", "]_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "sum", " ", "=", " ", "[", "2", " ", "+", " ", "3", " ", "+", " ", "4", " ", "+", " ", "5", "]_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "saw", "\\u", "error", " ", "=", " ", "False_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "has", "\\u", "complete", "d", " ", "=", " ", "False_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "schedule", "r", ".", "start", "(", "create", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "return", " ", "xs", ".", "do", "\\u", "action", "(", "function", " ", "(", "x", ")", " ", "{_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "i", "[", "0", "]", " ", "+=", " ", "1_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "sum", " ", "-=", " ", "x_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "},", " ", "function", " ", "(", "e", ")", " ", "{_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "saw", "\\u", "error", " ", "=", " ", "ex", " ", "==", " ", "e_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "},", " ", "function", " ", "()", " ", "{_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "has", "\\u", "complete", "d", " ", "=", " ", "True_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "self", ".", "assert", "Equal", "(", "4", ",", " ", "i", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "self", ".", "assert", "Equal", "(", "0", ",", " ", "sum", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "assert", "(", "saw", "\\u", "error", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "assert", "(", "not", " ", "has", "\\u", "complete", "d", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "def", " ", "test\\u", "do", "\\u", "next", "\\u", "error", "\\u", "complete", "d\\u", "neve", "r", "(", "self", "):", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "schedule", "r", " ", "=", " ", "Test", "Schedule", "r", "()", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "i", " ", "=", " ", "[", "0", "]_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "saw", "\\u", "error", " ", "=", " ", "False_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "has", "\\u", "complete", "d", " ", "=", " ", "False_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "schedule", "r", ".", "start", "(", "create", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "return", " ", "Observa", "ble", ".", "neve", "r", "()", ".", "do", "\\u", "action", "(", "function", " ", "(", "x", ")", " ", "{_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "i", "[", "0", "]", " ", "+=", " ", "1_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "},", " ", "function", " ", "(", "e", ")", " ", "{_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "saw", "\\u", "error", " ", "=", " ", "True_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "},", " ", "function", " ", "()", " ", "{_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "has", "\\u", "complete", "d", " ", "=", " ", "True_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "self", ".", "assert", "Equal", "(", "0", ",", " ", "i", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "assert", "(", "not", " ", "saw", "\\u", "error", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "assert", "(", "not", " ", "has", "\\u", "complete", "d", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "def", " ", "test\\u", "Do", "\\u", "Observer", "\\u", "Some", "Data", "With", "Error", "(", "self", "):", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "ex", " ", "=", " ", "'", "ex", "'_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "schedule", "r", " ", "=", " ", "Test", "Schedule", "r", "()", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "xs", " ", "=", " ", "schedule", "r", ".", "create", "\\u", "hot", "\\u", "observable", "(", "on", "\\u", "next", "(", "150", ",", " ", "1", "),", " ", "on", "\\u", "next", "(", "210", ",", " ", "2", "),", " ", "on", "\\u", "next", "(", "220", ",", " ", "3", "),", " ", "on", "\\u", "next", "(", "230", ",", " ", "4", "),", " ", "on", "\\u", "next", "(", "240", ",", " ", "5", "),", " ", "on", "\\u", "error", "(", "250", ",", " ", "ex", "))", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "i", " ", "=", " ", "[", "0", "]_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "sum", " ", "=", " ", "[", "2", " ", "+", " ", "3", " ", "+", " ", "4", " ", "+", " ", "5", "]_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "saw", "\\u", "error", " ", "=", " ", "False_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "has", "\\u", "complete", "d", " ", "=", " ", "False_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "schedule", "r", ".", "start", "(", "create", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "return", " ", "xs", ".", "do", "\\u", "action", "(", "Observer", ".", "create", "(", "function", " ", "(", "x", ")", " ", "{_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "i", "[", "0", "]", " ", "+=", " ", "1_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "sum", " ", "-=", " ", "x_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "},", " ", "function", " ", "(", "e", ")", " ", "{_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "saw", "\\u", "error", " ", "=", " ", "e", " ", "==", " ", "ex_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "},", " ", "function", " ", "()", " ", "{_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "has", "\\u", "complete", "d", " ", "=", " ", "True_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "}))", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "self", ".", "assert", "Equal", "(", "4", ",", " ", "i", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "self", ".", "assert", "Equal", "(", "0", ",", " ", "sum", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "assert", "(", "saw", "\\u", "error", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "assert", "(", "not", " ", "has", "\\u", "complete", "d", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "def", " ", "test\\u", "do", "\\u", "observer", "\\u", "some", "\\u", "data\\u", "with", "\\u", "error", "(", "self", "):", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "schedule", "r", " ", "=", " ", "Test", "Schedule", "r", "()", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "xs", " ", "=", " ", "schedule", "r", ".", "create", "\\u", "hot", "\\u", "observable", "(", "on", "\\u", "next", "(", "150", ",", " ", "1", "),", " ", "on", "\\u", "next", "(", "210", ",", " ", "2", "),", " ", "on", "\\u", "next", "(", "220", ",", " ", "3", "),", " ", "on", "\\u", "next", "(", "230", ",", " ", "4", "),", " ", "on", "\\u", "next", "(", "240", ",", " ", "5", "),", " ", "on", "\\u", "complete", "d", "(", "250", "))", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "i", " ", "=", " ", "[", "0", "]_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "sum", " ", "=", " ", "[", "2", " ", "+", " ", "3", " ", "+", " ", "4", " ", "+", " ", "5", "]_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "saw", "\\u", "error", " ", "=", " ", "False_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "has", "\\u", "complete", "d", " ", "=", " ", "False_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "schedule", "r", ".", "start", "(", "create", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "return", " ", "xs", ".", "do", "\\u", "action", "(", "Observer", ".", "create", "(", "function", " ", "(", "x", ")", " ", "{_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "i", "[", "0", "]", " ", "+=", " ", "1_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "sum", " ", "-=", " ", "x_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "},", " ", "function", " ", "(", "e", ")", " ", "{_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "saw", "\\u", "error", " ", "=", " ", "True_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "},", " ", "function", " ", "()", " ", "{_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "has", "\\u", "complete", "d", " ", "=", " ", "True_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "}))", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "self", ".", "assert", "Equal", "(", "4", ",", " ", "i", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "self", ".", "assert", "Equal", "(", "0", ",", " ", "sum", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "assert", "(", "not", " ", "saw", "\\u", "error", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "assert", "(", "has", "\\u", "complete", "d", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "def", " ", "test\\u", "do", "142", "2", "\\u", "next", "\\u", "next", "\\u", "throw", "s", "(", "self", "):", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "ex", " ", "=", " ", "'", "ex", "'_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "schedule", "r", " ", "=", " ", "Test", "Schedule", "r", "()", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "xs", " ", "=", " ", "schedule", "r", ".", "create", "\\u", "hot", "\\u", "observable", "(", "on", "\\u", "next", "(", "150", ",", " ", "1", "),", " ", "on", "\\u", "next", "(", "210", ",", " ", "2", "),", " ", "on", "\\u", "complete", "d", "(", "250", "))", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "results", " ", "=", " ", "schedule", "r", ".", "start", "(", "create", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "return", " ", "xs", ".", "do", "\\u", "action", "(", "function", " ", "()", " ", "{_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "raise", " ", "Except", "ion", "(", "ex", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "results", ".", "message", "s", ".", "assert", "\\u", "equal", "(", "on", "\\u", "error", "(", "210", ",", " ", "ex", "))", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "def", " ", "test\\u", "do", "142", "2", "\\u", "next", "\\u", "complete", "d\\u", "next", "\\u", "throw", "s", "(", "self", "):", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "ex", " ", "=", " ", "'", "ex", "'_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "schedule", "r", " ", "=", " ", "Test", "Schedule", "r", "()", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "xs", " ", "=", " ", "schedule", "r", ".", "create", "\\u", "hot", "\\u", "observable", "(", "on", "\\u", "next", "(", "150", ",", " ", "1", "),", " ", "on", "\\u", "next", "(", "210", ",", " ", "2", "),", " ", "on", "\\u", "complete", "d", "(", "250", "))", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "results", " ", "=", " ", "schedule", "r", ".", "start", "(", "create", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "return", " ", "xs", ".", "do", "\\u", "action", "(", "function", " ", "()", " ", "{_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "throw", " ", "ex_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "},", " ", "\\u", "undefined", ",", " ", "function", " ", "()", " ", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "results", ".", "message", "s", ".", "assert", "\\u", "equal", "(", "on", "\\u", "error", "(", "210", ",", " ", "ex", "))", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "def", " ", "test\\u", "do", "142", "2", "\\u", "next", "\\u", "complete", "d\\u", "complete", "d\\u", "throw", "s", "(", "self", "):", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "ex", " ", "=", " ", "'", "ex", "'_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "schedule", "r", " ", "=", " ", "Test", "Schedule", "r", "()", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "xs", " ", "=", " ", "schedule", "r", ".", "create", "\\u", "hot", "\\u", "observable", "(", "on", "\\u", "next", "(", "150", ",", " ", "1", "),", " ", "on", "\\u", "next", "(", "210", ",", " ", "2", "),", " ", "on", "\\u", "complete", "d", "(", "250", "))", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "results", " ", "=", " ", "schedule", "r", ".", "start", "(", "create", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "return", " ", "xs", ".", "do", "\\u", "action", "(", "function", " ", "()", " ", "{", " ", "},", " ", "\\u", "undefined", ",", " ", "function", " ", "()", " ", "{_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "throw", " ", "ex_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "results", ".", "message", "s", ".", "assert", "\\u", "equal", "(", "on", "\\u", "next", "(", "210", ",", " ", "2", "),", " ", "on", "\\u", "error", "(", "250", ",", " ", "ex", "))", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "def", " ", "test\\u", "do", "142", "2", "\\u", "next", "\\u", "error", "\\u", "next", "\\u", "throw", "s", "(", "self", "):", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "ex", " ", "=", " ", "'", "ex", "'_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "schedule", "r", " ", "=", " ", "Test", "Schedule", "r", "()", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "xs", " ", "=", " ", "schedule", "r", ".", "create", "\\u", "hot", "\\u", "observable", "(", "on", "\\u", "next", "(", "150", ",", " ", "1", "),", " ", "on", "\\u", "next", "(", "210", ",", " ", "2", "),", " ", "on", "\\u", "complete", "d", "(", "250", "))", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "results", " ", "=", " ", "schedule", "r", ".", "start", "(", "create", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "return", " ", "xs", ".", "do", "\\u", "action", "(", "function", " ", "()", " ", "{_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "raise", " ", "Except", "ion", "(", "ex", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "},", " ", "function", " ", "()", " ", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "results", ".", "message", "s", ".", "assert", "\\u", "equal", "(", "on", "\\u", "error", "(", "210", ",", " ", "ex", "))", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "def", " ", "test\\u", "Do", "142", "2", "\\u", "Ne", "xt", "Error", "\\u", "Ne", "xt", "Throw", "s", "(", "self", "):", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "var", " ", "ex", "1", ",", " ", "ex", "2", ",", " ", "results", ",", " ", "schedule", "r", ",", " ", "xs_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "ex", "1", " ", "=", " ", "'", "ex", "1", "'_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "ex", "2", " ", "=", " ", "'", "ex", "2", "'_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "schedule", "r", " ", "=", " ", "Test", "Schedule", "r", "()", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "xs", " ", "=", " ", "schedule", "r", ".", "create", "\\u", "hot", "\\u", "observable", "(", "on", "\\u", "next", "(", "150", ",", " ", "1", "),", " ", "on", "\\u", "error", "(", "210", ",", " ", "ex", "1", "))", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "results", " ", "=", " ", "schedule", "r", ".", "start", "(", "create", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "return", " ", "xs", ".", "do", "\\u", "action", "(", "function", " ", "()", " ", "{", " ", "},", " ", "function", " ", "()", " ", "{_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "raise", " ", "Except", "ion", "(", "ex", ")", "2_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "results", ".", "message", "s", ".", "assert", "\\u", "equal", "(", "on", "\\u", "error", "(", "210", ",", " ", "ex", "2", "))", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "def", " ", "test\\u", "Do", "142", "2", "\\u", "Ne", "xt", "Error", "Complete", "d\\u", "Ne", "xt", "Throw", "s", "(", "self", "):", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "var", " ", "ex", ",", " ", "results", ",", " ", "schedule", "r", ",", " ", "xs_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "ex", " ", "=", " ", "'", "ex", "'_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "schedule", "r", " ", "=", " ", "Test", "Schedule", "r", "()", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "xs", " ", "=", " ", "schedule", "r", ".", "create", "\\u", "hot", "\\u", "observable", "(", "on", "\\u", "next", "(", "150", ",", " ", "1", "),", " ", "on", "\\u", "next", "(", "210", ",", " ", "2", "),", " ", "on", "\\u", "complete", "d", "(", "250", "))", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "results", " ", "=", " ", "schedule", "r", ".", "start", "(", "create", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "return", " ", "xs", ".", "do", "\\u", "action", "(", "function", " ", "()", " ", "{_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "raise", " ", "Except", "ion", "(", "ex", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "},", " ", "function", " ", "()", " ", "{", " ", "},", " ", "function", " ", "()", " ", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "results", ".", "message", "s", ".", "assert", "\\u", "equal", "(", "on", "\\u", "error", "(", "210", ",", " ", "ex", "))", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "def", " ", "test\\u", "do", "142", "2", "\\u", "next", "\\u", "error", "\\u", "complete", "d\\u", "error", "\\u", "throw", "s", "(", "self", "):", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "var", " ", "ex", "1", ",", " ", "ex", "2", ",", " ", "results", ",", " ", "schedule", "r", ",", " ", "xs_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "ex", "1", " ", "=", " ", "'", "ex", "1", "'_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "ex", "2", " ", "=", " ", "'", "ex", "2", "'_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "schedule", "r", " ", "=", " ", "Test", "Schedule", "r", "()", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "xs", " ", "=", " ", "schedule", "r", ".", "create", "\\u", "hot", "\\u", "observable", "(", "on", "\\u", "next", "(", "150", ",", " ", "1", "),", " ", "on", "\\u", "error", "(", "210", ",", " ", "ex", "1", "))", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "results", " ", "=", " ", "schedule", "r", ".", "start", "(", "create", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "return", " ", "xs", ".", "do", "\\u", "action", "(", "function", " ", "()", " ", "{", " ", "},", " ", "function", " ", "()", " ", "{_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "raise", " ", "Except", "ion", "(", "ex", ")", "2_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "},", " ", "function", " ", "()", " ", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "results", ".", "message", "s", ".", "assert", "\\u", "equal", "(", "on", "\\u", "error", "(", "210", ",", " ", "ex", "2", "))", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "def", " ", "test\\u", "do", "142", "2", "\\u", "next", "\\u", "error", "\\u", "complete", "d\\u", "complete", "d\\u", "throw", "s", "(", "self", "):", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "ex", " ", "=", " ", "'", "ex", "'_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "schedule", "r", " ", "=", " ", "Test", "Schedule", "r", "()", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "xs", " ", "=", " ", "schedule", "r", ".", "create", "\\u", "hot", "\\u", "observable", "(", "on", "\\u", "next", "(", "150", ",", " ", "1", "),", " ", "on", "\\u", "next", "(", "210", ",", " ", "2", "),", " ", "on", "\\u", "complete", "d", "(", "250", "))", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "results", " ", "=", " ", "schedule", "r", ".", "start", "(", "create", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "return", " ", "xs", ".", "do", "\\u", "action", "(", "function", " ", "()", " ", "{", " ", "},", " ", "function", " ", "()", " ", "{", " ", "},", " ", "function", " ", "()", " ", "{_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "raise", " ", "Except", "ion", "(", "ex", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "results", ".", "message", "s", ".", "assert", "\\u", "equal", "(", "on", "\\u", "next", "(", "210", ",", " ", "2", "),", " ", "on", "\\u", "error", "(", "250", ",", " ", "ex", "))", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "def", " ", "test\\u", "do", "142", "2", "\\u", "observer", "\\u", "next", "\\u", "throw", "s", "(", "self", "):", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "ex", " ", "=", " ", "'", "ex", "'_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "schedule", "r", " ", "=", " ", "Test", "Schedule", "r", "()", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "xs", " ", "=", " ", "schedule", "r", ".", "create", "\\u", "hot", "\\u", "observable", "(", "on", "\\u", "next", "(", "150", ",", " ", "1", "),", " ", "on", "\\u", "next", "(", "210", ",", " ", "2", "),", " ", "on", "\\u", "complete", "d", "(", "250", "))", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "results", " ", "=", " ", "schedule", "r", ".", "start", "(", "create", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "return", " ", "xs", ".", "do", "\\u", "action", "(", "Observer", ".", "create", "(", "function", " ", "()", " ", "{_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "raise", " ", "Except", "ion", "(", "ex", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "},", " ", "function", " ", "()", " ", "{", " ", "},", " ", "function", " ", "()", " ", "{", " ", "}))", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "results", ".", "message", "s", ".", "assert", "\\u", "equal", "(", "on", "\\u", "error", "(", "210", ",", " ", "ex", "))", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "def", " ", "test\\u", "do", "142", "2", "\\u", "observer", "\\u", "error", "\\u", "throw", "s", "(", "self", "):", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "var", " ", "ex", "1", ",", " ", "ex", "2", ",", " ", "results", ",", " ", "schedule", "r", ",", " ", "xs_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "ex", "1", " ", "=", " ", "'", "ex", "1", "'_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "ex", "2", " ", "=", " ", "'", "ex", "2", "'_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "schedule", "r", " ", "=", " ", "Test", "Schedule", "r", "()", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "xs", " ", "=", " ", "schedule", "r", ".", "create", "\\u", "hot", "\\u", "observable", "(", "on", "\\u", "next", "(", "150", ",", " ", "1", "),", " ", "on", "\\u", "error", "(", "210", ",", " ", "ex", "1", "))", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "results", " ", "=", " ", "schedule", "r", ".", "start", "(", "create", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "return", " ", "xs", ".", "do", "\\u", "action", "(", "Observer", ".", "create", "(", "function", " ", "()", " ", "{", " ", "},", " ", "function", " ", "()", " ", "{_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "raise", " ", "Except", "ion", "(", "ex", ")", "2_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "},", " ", "function", " ", "()", " ", "{", " ", "}))", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "results", ".", "message", "s", ".", "assert", "\\u", "equal", "(", "on", "\\u", "error", "(", "210", ",", " ", "ex", "2", "))", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "def", " ", "test\\u", "do", "142", "2", "\\u", "observer", "\\u", "complete", "d\\u", "throw", "s", "(", "self", "):", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "var", " ", "ex", ",", " ", "results", ",", " ", "schedule", "r", ",", " ", "xs_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "ex", " ", "=", " ", "'", "ex", "'_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "schedule", "r", " ", "=", " ", "Test", "Schedule", "r", "()", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "xs", " ", "=", " ", "schedule", "r", ".", "create", "\\u", "hot", "\\u", "observable", "(", "on", "\\u", "next", "(", "150", ",", " ", "1", "),", " ", "on", "\\u", "next", "(", "210", ",", " ", "2", "),", " ", "on", "\\u", "complete", "d", "(", "250", "))", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "results", " ", "=", " ", "schedule", "r", ".", "start", "(", "create", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "return", " ", "xs", ".", "do", "\\u", "action", "(", "Observer", ".", "create", "(", "function", " ", "()", " ", "{", " ", "},", " ", "function", " ", "()", " ", "{", " ", "},", " ", "function", " ", "()", " ", "{_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "raise", " ", "Except", "ion", "(", "ex", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "}))", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "results", ".", "message", "s", ".", "assert", "\\u", "equal", "(", "on", "\\u", "next", "(", "210", ",", " ", "2", "),", " ", "on", "\\u", "error", "(", "250", ",", " ", "ex", "))", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Test", "Do", "_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Test", "Do", "_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "test\\u", "do", "\\u", "shou", "ld", "\\u", "see", "\\u", "all", "\\u", "values_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "scheduler_", "=_", "Test", "Scheduler_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xs_", "=_", "scheduler_", "._", "create", "\\u", "hot", "\\u", "observable_", "(_", "on", "\\u", "next_", "(_", "150_", ",_", "1_", ")_", ",_", "on", "\\u", "next_", "(_", "210_", ",_", "2_", ")_", ",_", "on", "\\u", "next_", "(_", "220_", ",_", "3_", ")_", ",_", "on", "\\u", "next_", "(_", "230_", ",_", "4_", ")_", ",_", "on", "\\u", "next_", "(_", "240_", ",_", "5_", ")_", ",_", "on", "\\u", "completed_", "(_", "250_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "i_", "=_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sum_", "=_", "[_", "2_", "+_", "3_", "+_", "4_", "+_", "5_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "create_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "action_", "(_", "x_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "i_", "[_", "0_", "]_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sum_", "[_", "0_", "]_", "-=_", "x_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "sum_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "xs_", "._", "do", "\\u", "action_", "(_", "action_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "scheduler_", "._", "start_", "(_", "create_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "4_", ",_", "i_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "0_", ",_", "sum_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Do", "_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "do", "\\u", "plain", "\\u", "action_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "scheduler_", "=_", "Test", "Scheduler_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xs_", "=_", "scheduler_", "._", "create", "\\u", "hot", "\\u", "observable_", "(_", "on", "\\u", "next_", "(_", "150_", ",_", "1_", ")_", ",_", "on", "\\u", "next_", "(_", "210_", ",_", "2_", ")_", ",_", "on", "\\u", "next_", "(_", "220_", ",_", "3_", ")_", ",_", "on", "\\u", "next_", "(_", "230_", ",_", "4_", ")_", ",_", "on", "\\u", "next_", "(_", "240_", ",_", "5_", ")_", ",_", "on", "\\u", "completed_", "(_", "250_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "i_", "=_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "create_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "action_", "(_", "x_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "i_", "[_", "0_", "]_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "i_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "xs_", "._", "do", "\\u", "action_", "(_", "action_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "scheduler_", "._", "start_", "(_", "create_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "4_", ",_", "i_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Do", "_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "do", "\\u", "next", "\\u", "completed_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "scheduler_", "=_", "Test", "Scheduler_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xs_", "=_", "scheduler_", "._", "create", "\\u", "hot", "\\u", "observable_", "(_", "on", "\\u", "next_", "(_", "150_", ",_", "1_", ")_", ",_", "on", "\\u", "next_", "(_", "210_", ",_", "2_", ")_", ",_", "on", "\\u", "next_", "(_", "220_", ",_", "3_", ")_", ",_", "on", "\\u", "next_", "(_", "230_", ",_", "4_", ")_", ",_", "on", "\\u", "next_", "(_", "240_", ",_", "5_", ")_", ",_", "on", "\\u", "completed_", "(_", "250_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "i_", "=_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sum_", "=_", "[_", "2_", "+_", "3_", "+_", "4_", "+_", "5_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "completed_", "=_", "[_", "False_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "create_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "on", "\\u", "next_", "(_", "x_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "i_", "[_", "0_", "]_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sum_", "[_", "0_", "]_", "-=_", "x_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "on", "\\u", "completed_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "completed_", "[_", "0_", "]_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "xs_", "._", "do", "\\u", "action_", "(_", "on", "\\u", "next_", "=_", "on", "\\u", "next_", ",_", "on", "\\u", "completed_", "=_", "on", "\\u", "completed_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "scheduler_", "._", "start_", "(_", "create_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "4_", ",_", "i_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "0_", ",_", "sum_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "(_", "completed_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Do", "_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "do", "\\u", "next", "\\u", "complete", "d\\u", "neve", "r_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "scheduler_", "=_", "Test", "Scheduler_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "i_", "=_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "completed_", "=_", "[_", "False_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "create_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "on", "\\u", "next_", "(_", "x_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "i_", "[_", "0_", "]_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "on", "\\u", "completed_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "completed_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "Observable_", "._", "neve", "r_", "(_", ")_", "._", "do", "\\u", "action_", "(_", "on", "\\u", "next_", "=_", "on", "\\u", "next_", ",_", "on", "\\u", "completed_", "=_", "on", "\\u", "completed_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "scheduler_", "._", "start_", "(_", "create_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "0_", ",_", "i_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "(_", "not_", "completed_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
niwinz/tornado-webtools/webtools/management/commands/shell.py
[ { "content": "from webtools.management.base import Command\nfrom webtools.database import Base\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class ShellCommand(Command):\n \"\"\"\n Syncronize all available sqlalchemy defined tables\n to a database server.\n \"\"\"\n", "metadata": "root.ShellCommand", "header": "['module', '___EOS___']", "index": 3 }, { "content": " def take_action(self, options):\n if not options.settings:\n raise RuntimeError(\"For start serverm --settings parameter\"\n \" is mandatory!\")\n\n from webtools.application import Application\n app = Application(self.cmdapp.conf)\n\n imported_objects = {'app': app}\n\n import code\n\n try:\n import readline\n except ImportError:\n pass\n else:\n import rlcompleter\n readline.set_completer(rlcompleter.Completer(imported_objects).complete)\n readline.parse_and_bind(\"tab:complete\")\n\n code.interact(local=imported_objects)", "metadata": "root.ShellCommand.take_action", "header": "['class', 'ShellCommand', '(', 'Command', ')', ':', '___EOS___']", "index": 9 } ]
[ { "span": "from webtools.database import Base", "start_line": 1, "start_column": 0, "end_line": 1, "end_column": 34 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "from_", "web", "tools_", "._", "management_", "._", "base_", "import_", "Command_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "web", "tools_", "._", "database_", "import_", "Base_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Shel", "l", "Command_", "(_", "Command_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Sync", "roni", "ze", " ", "all", " ", "avail", "able", " ", "sqla", "lche", "my", " ", "defin", "ed", " ", "tables", "\\", "10", ";", " ", " ", " ", " ", "to", " ", "a", " ", "databa", "se", " ", "server", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Shel", "l", "Command_", "(_", "Command_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "take", "\\u", "action_", "(_", "self_", ",_", "options_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "options_", "._", "settings_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Run", "time", "Error_", "(_", "\"", "For", " ", "start", " ", "server", "m", " ", "--", "settings", " ", "parameter", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", " ", "is", " ", "mandat", "ory", "!\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "from_", "web", "tools_", "._", "application_", "import_", "Application_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "app_", "=_", "Application_", "(_", "self_", "._", "cmd", "app_", "._", "conf_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import", "ed", "\\u", "objects_", "=_", "{_", "'", "app", "'_", ":_", "app_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "code_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "readline_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Import", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "rl", "completer_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "readline_", "._", "set\\u", "completer_", "(_", "rl", "completer_", "._", "Completer_", "(_", "import", "ed", "\\u", "objects_", ")_", "._", "complete_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "readline_", "._", "parse", "\\u", "and", "\\u", "bind_", "(_", "\"", "tab", ":", "complete", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "code_", "._", "interact", "_", "(_", "local_", "=_", "import", "ed", "\\u", "objects_", ")_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Testing equality to None
dpkingma/nips14-ssl/anglepy/misc.py
[ { "content": "def lazytheanofunc(on_unused_input='warn', mode='FAST_RUN'):\n\tdef theanofunction(*args, **kwargs):\n\t\tf = [None]\n\t\tif not kwargs.has_key('on_unused_input'):\n\t\t\tkwargs['on_unused_input'] = on_unused_input\n\t\tif not kwargs.has_key('mode'):\n\t\t\tkwargs['mode'] = mode\n\t\tdef func(*args2, **kwargs2):\n\t\t\tif f[0] == None:\n\t\t\t\tf[0] = theano.function(*args, **kwargs)\n\t\t\treturn f[0](*args2, **kwargs2)\n\t\treturn func\n\treturn theanofunction", "metadata": "root.lazytheanofunc", "header": "['module', '___EOS___']", "index": 71 } ]
[ { "span": "f[0] == None:", "start_line": 79, "start_column": 6, "end_line": 79, "end_column": 18 } ]
[]
1
true
[ "[CLS]_", "Test", "ing_", "equality", "_", "to_", "None_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "lazy", "theano", "func_", "(_", "on", "\\u", "unu", "sed", "\\u", "input_", "=_", "'", "warn", "'_", ",_", "mode_", "=_", "'", "FAST", "\\u", "RUN", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "_", "def_", "theano", "function_", "(_", "*_", "args_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "f_", "=_", "[_", "None_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "kwargs_", "._", "has", "\\u", "key_", "(_", "'", "on", "\\u", "unu", "sed", "\\u", "input", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "kwargs_", "[_", "'", "on", "\\u", "unu", "sed", "\\u", "input", "'_", "]_", "=_", "on", "\\u", "unu", "sed", "\\u", "input_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "kwargs_", "._", "has", "\\u", "key_", "(_", "'", "mode", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "kwargs_", "[_", "'", "mode", "'_", "]_", "=_", "mode_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "func_", "(_", "*_", "args", "2_", ",_", "**_", "kwarg", "s2_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "if_", "f_", "[_", "0_", "]_", "==_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "f_", "[_", "0_", "]_", "=_", "theano_", "._", "function_", "(_", "*_", "args_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "f_", "[_", "0_", "]_", "(_", "*_", "args", "2_", ",_", "**_", "kwarg", "s2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "func_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "theano", "function_" ]
[ 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
CybOXProject/python-cybox/cybox/objects/win_service_object.py
[ { "content": "# Copyright (c) 2015, The MITRE Corporation. All rights reserved.\n# See LICENSE.txt for complete terms.\n\nfrom mixbox import entities\nfrom mixbox import fields\n\nimport cybox.bindings.win_service_object as win_service_binding\nfrom cybox.common import HashList\nfrom cybox.objects.win_process_object import WinProcess\nfrom cybox.common import ObjectProperties, String\n\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class ServiceDescriptionList(entities.EntityList):\n _binding = win_service_binding\n _binding_class = win_service_binding.ServiceDescriptionListType\n _binding_var = \"Description\"\n _contained_type = String\n _namespace = \"http://cybox.mitre.org/objects#WinServiceObject-2\"", "metadata": "root.ServiceDescriptionList", "header": "['module', '___EOS___']", "index": 12 }, { "content": "class WinService(WinProcess):\n _binding = win_service_binding\n _binding_class = win_service_binding.WindowsServiceObjectType\n _namespace = \"http://cybox.mitre.org/objects#WinServiceObject-2\"\n _XSI_NS = \"WinServiceObj\"\n _XSI_TYPE = \"WindowsServiceObjectType\"\n\n service_dll_signature_exists = fields.TypedField(\"service_dll_signature_exists\")\n service_dll_signature_verified = fields.TypedField(\"service_dll_signature_verified\")\n description_list = fields.TypedField(\"Description_List\", ServiceDescriptionList)\n display_name = fields.TypedField(\"Display_Name\", String)\n group_name = fields.TypedField(\"Group_Name\", String)\n service_name = fields.TypedField(\"Service_Name\", String)\n service_dll = fields.TypedField(\"Service_DLL\", String)\n service_dll_certificate_issuer = fields.TypedField(\"Service_DLL_Certificate_Issuer\", String)\n service_dll_certificate_subject = fields.TypedField(\"Service_DLL_Certificate_Subject\", String)\n service_dll_hashes = fields.TypedField(\"Service_DLL_Hashes\", HashList)\n service_dll_signature_description = fields.TypedField(\"Service_DLL_Signature_Description\", String)\n startup_command_line = fields.TypedField(\"Startup_Command_Line\", String)\n startup_type = fields.TypedField(\"Startup_Type\", String)\n service_status = fields.TypedField(\"Service_Status\", String)\n service_type = fields.TypedField(\"Service_Type\", String)\n started_as = fields.TypedField(\"Started_As\", String)", "metadata": "root.WinService", "header": "['module', '___EOS___']", "index": 20 } ]
[ { "span": "from cybox.common import ObjectProperties, String", "start_line": 9, "start_column": 0, "end_line": 9, "end_column": 49 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "Copy", "right", " ", "(", "c", ")", " ", "201", "5", ",", " ", "The", " ", "MIT", "RE", " ", "Cor", "porat", "ion", ".", " ", "All", " ", "rights", " ", "reserve", "d", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "See", " ", "LICENSE", ".", "txt", " ", "for", " ", "complete", " ", "term", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "mix", "box_", "import_", "entities_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "mix", "box_", "import_", "fields_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "cy", "box_", "._", "bindings_", "._", "win", "\\u", "service", "\\u", "object_", "as_", "win", "\\u", "service", "\\u", "binding_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "cy", "box_", "._", "common_", "import_", "Hash", "List_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "cy", "box_", "._", "objects_", "._", "win", "\\u", "process", "\\u", "object_", "import_", "Win", "Process_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "cy", "box_", "._", "common_", "import_", "Object", "Properties_", ",_", "String_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Service", "Descripti", "on", "List_", "(_", "entities_", "._", "Entit", "y", "List_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "binding_", "=_", "win", "\\u", "service", "\\u", "binding_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "bindi", "ng", "\\u", "class_", "=_", "win", "\\u", "service", "\\u", "binding_", "._", "Service", "Descripti", "on", "List", "Type_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "bindi", "ng", "\\u", "var_", "=_", "\"", "Descripti", "on", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "contain", "ed", "\\u", "type_", "=_", "String_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "namespace_", "=_", "\"", "http", "://", "cy", "box", ".", "mit", "re", ".", "org", "/", "object", "s", "#", "Win", "Service", "Object", "-", "2", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Win", "Service_", "(_", "Win", "Process_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "binding_", "=_", "win", "\\u", "service", "\\u", "binding_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "bindi", "ng", "\\u", "class_", "=_", "win", "\\u", "service", "\\u", "binding_", "._", "Window", "s", "Service", "Object", "Type_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "namespace_", "=_", "\"", "http", "://", "cy", "box", ".", "mit", "re", ".", "org", "/", "object", "s", "#", "Win", "Service", "Object", "-", "2", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "XS", "I", "\\u", "NS_", "=_", "\"", "Win", "Service", "Obj", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "XS", "I", "\\u", "TYPE_", "=_", "\"", "Window", "s", "Service", "Object", "Type", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "service", "\\u", "dll", "\\u", "signa", "ture", "\\u", "exists_", "=_", "fields_", "._", "Type", "d", "Field_", "(_", "\"", "service", "\\u", "dll", "\\u", "signa", "ture", "\\u", "exist", "s", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "service", "\\u", "dll", "\\u", "signa", "ture", "\\u", "verified_", "=_", "fields_", "._", "Type", "d", "Field_", "(_", "\"", "service", "\\u", "dll", "\\u", "signa", "ture", "\\u", "verifie", "d", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "description", "\\u", "list_", "=_", "fields_", "._", "Type", "d", "Field_", "(_", "\"", "Descripti", "on", "\\u", "List", "\"_", ",_", "Service", "Descripti", "on", "List_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "display", "\\u", "name_", "=_", "fields_", "._", "Type", "d", "Field_", "(_", "\"", "Display", "\\u", "Name", "\"_", ",_", "String_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "group", "\\u", "name_", "=_", "fields_", "._", "Type", "d", "Field_", "(_", "\"", "Group", "\\u", "Name", "\"_", ",_", "String_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "service", "\\u", "name_", "=_", "fields_", "._", "Type", "d", "Field_", "(_", "\"", "Service", "\\u", "Name", "\"_", ",_", "String_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "service", "\\u", "dll_", "=_", "fields_", "._", "Type", "d", "Field_", "(_", "\"", "Service", "\\u", "DLL", "\"_", ",_", "String_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "service", "\\u", "dll", "\\u", "certifica", "te", "\\u", "issuer_", "=_", "fields_", "._", "Type", "d", "Field_", "(_", "\"", "Service", "\\u", "DLL", "\\u", "Certificat", "e\\u", "Issue", "r", "\"_", ",_", "String_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "service", "\\u", "dll", "\\u", "certifica", "te", "\\u", "subject_", "=_", "fields_", "._", "Type", "d", "Field_", "(_", "\"", "Service", "\\u", "DLL", "\\u", "Certificat", "e\\u", "Sub", "ject", "\"_", ",_", "String_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "service", "\\u", "dll", "\\u", "hashes_", "=_", "fields_", "._", "Type", "d", "Field_", "(_", "\"", "Service", "\\u", "DLL", "\\u", "Hashe", "s", "\"_", ",_", "Hash", "List_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "service", "\\u", "dll", "\\u", "signa", "ture", "\\u", "description_", "=_", "fields_", "._", "Type", "d", "Field_", "(_", "\"", "Service", "\\u", "DLL", "\\u", "Sign", "ature", "\\u", "Descripti", "on", "\"_", ",_", "String_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "start", "up", "\\u", "command", "\\u", "line_", "=_", "fields_", "._", "Type", "d", "Field_", "(_", "\"", "Start", "up", "\\u", "Command", "\\u", "Line", "\"_", ",_", "String_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "start", "up", "\\u", "type_", "=_", "fields_", "._", "Type", "d", "Field_", "(_", "\"", "Start", "up", "\\u", "Type", "\"_", ",_", "String_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "service", "\\u", "status_", "=_", "fields_", "._", "Type", "d", "Field_", "(_", "\"", "Service", "\\u", "Status", "\"_", ",_", "String_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "service", "\\u", "type_", "=_", "fields_", "._", "Type", "d", "Field_", "(_", "\"", "Service", "\\u", "Type", "\"_", ",_", "String_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "start", "ed", "\\u", "as_", "=_", "fields_", "._", "Type", "d", "Field_", "(_", "\"", "Start", "ed", "\\u", "As", "\"_", ",_", "String_", ")_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,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2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Variable defined multiple times
sergei-maertens/django-systemjs/tests/settings.py
[ { "content": "import os\n\nPROJECT_DIR = os.path.dirname(__file__)\nBASE_DIR = PROJECT_DIR # setting present in new startproject\n\n\nINSTALLED_APPS = [\n 'django.contrib.staticfiles',\n 'systemjs',\n 'tests.app',\n]\n\nROOT_URLCONF = 'tests.urls'\n\nDEBUG = False\nSTATIC_URL = '/static/'\nSECRET_KEY = 'this-is-really-not-a-secret'\n\nMIDDLEWARE_CLASSES = (\n 'django.middleware.common.CommonMiddleware',\n)\n\nDATABASES = {\n 'default': {\n 'ENGINE': 'django.db.backends.sqlite3',\n 'NAME': os.path.join(PROJECT_DIR, 'database.db'),\n }\n}\n\nTEMPLATES = [\n {\n 'BACKEND': 'django.template.backends.django.DjangoTemplates',\n 'APP_DIRS': True,\n 'DIRS': [\n os.path.join(PROJECT_DIR, 'templates'),\n ],\n 'OPTIONS': {\n 'context_processors': [\n \"django.template.context_processors.i18n\",\n ],\n },\n },\n]\n\nSTATIC_URL = '/static/'\nSTATIC_ROOT = os.path.join(PROJECT_DIR, 'static')\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[ { "span": "STATIC_URL ", "start_line": 15, "start_column": 0, "end_line": 15, "end_column": 10 } ]
[ { "span": "STATIC_URL ", "start_line": 44, "start_column": 0, "end_line": 44, "end_column": 10 } ]
1
true
[ "[CLS]_", "Variable_", "defined_", "multiple_", "times_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "PROJECT", "\\u", "DIR_", "=_", "os_", "._", "path_", "._", "dirname_", "(_", "\\u\\u", "file\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "BASE", "\\u", "DIR_", "=_", "PROJECT", "\\u", "DIR_", "#", " ", "setti", "ng", " ", "presen", "t", " ", "in", " ", "new", " ", "startp", "roj", "ect_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "INSTALLE", "D", "\\u", "APPS_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "'", "django", ".", "contrib", ".", "static", "files", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "system", "js", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "tests", ".", "app", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "ROO", "T", "\\u", "URLCONF_", "=_", "'", "tests", ".", "urls", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "DEBUG_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "STATI", "C", "\\u", "URL_", "=_", "'/", "static", "/'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "SEC", "RET", "\\u", "KEY_", "=_", "'", "this", "-", "is", "-", "reall", "y", "-", "not", "-", "a", "-", "secret", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "MIDDLE", "WARE", "\\u", "CLASSES_", "=_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", "django", ".", "middle", "ware", ".", "common", ".", "Common", "Mid", "dle", "ware", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "DATABASES_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "default", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "ENGINE", "'_", ":_", "'", "django", ".", "db", ".", "back", "ends", ".", "sql", "ite", "3", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "NAME", "'_", ":_", "os_", "._", "path_", "._", "join_", "(_", "PROJECT", "\\u", "DIR_", ",_", "'", "databa", "se", ".", "db", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "TEMPLATES_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "BACK", "END", "'_", ":_", "'", "django", ".", "template", ".", "back", "ends", ".", "django", ".", "Dj", "ang", "o", "Templa", "tes", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "APP", "\\u", "DIR", "S", "'_", ":_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "DIR", "S", "'_", ":_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "os_", "._", "path_", "._", "join_", "(_", "PROJECT", "\\u", "DIR_", ",_", "'", "template", "s", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "OPTION", "S", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "context", "\\u", "process", "ors", "'_", ":_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "django", ".", "template", ".", "context", "\\u", "process", "ors", ".", "i18n", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "STATI", "C", "\\u", "URL_", "=_", "'/", "static", "/'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "STATI", "C", "\\u", "ROOT_", "=_", "os_", "._", "path_", "._", "join_", "(_", "PROJECT", "\\u", "DIR_", ",_", "'", "static", "'_", ")_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
bmander/graphserver/pygs/test/unit_test/test_path.py
[ { "content": "from graphserver.core import Vertex, Edge, Link, Street, Path\nimport unittest\nfrom graphserver.gsdll import lgs\nfrom ctypes import addressof\n\n \n \n \n \nif __name__ == '__main__':\n\n unittest.main()", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class TestPathCreate(unittest.TestCase):\n ", "metadata": "root.TestPathCreate", "header": "['module', '___EOS___']", "index": 5 }, { "content": " def test_path_new(self):\n \"\"\"Create a path object without crashing\"\"\"\n path = Path( Vertex(\"A\") )\n \n self.assertTrue( path )", "metadata": "root.TestPathCreate.test_path_new", "header": "['class', 'TestPathCreate', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 6 }, { "content": " def test_path_empty(self):\n \"\"\"Path is empty right after first created\"\"\"\n pp = Path( Vertex(\"A\") )\n \n self.assertEqual( pp.num_elements, 0 )", "metadata": "root.TestPathCreate.test_path_empty", "header": "['class', 'TestPathCreate', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 12 }, { "content": "class TestPathSize(unittest.TestCase):\n \n \n ", "metadata": "root.TestPathSize", "header": "['module', '___EOS___']", "index": 18 }, { "content": " def setUp(self):\n self.aa = Vertex(\"AA\")\n self.path = Path( self.aa )", "metadata": "root.TestPathSize.setUp", "header": "['class', 'TestPathSize', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 19 }, { "content": " def test_zero(self):\n \"\"\"getSize returns zero on an empty path\"\"\"\n self.assertEquals( self.path.num_elements, 0 )", "metadata": "root.TestPathSize.test_zero", "header": "['class', 'TestPathSize', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 23 }, { "content": " def test_one(self):\n \"\"\"getSize returns one after one entry\"\"\"\n \n bb = Vertex(\"BB\")\n ee = Edge(self.aa, bb, Link())\n \n self.path.addSegment( bb, ee )\n \n self.assertEqual( self.path.num_elements, 1 )", "metadata": "root.TestPathSize.test_one", "header": "['class', 'TestPathSize', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 27 }, { "content": " def test_ten(self):\n \"\"\"getSize returns ten after ten entries\"\"\"\n \n for i in range(10):\n aa = Vertex(\"AA\")\n bb = Vertex(\"BB\")\n payload = Link()\n self.path.addSegment( bb, Edge(aa, bb, payload) )\n \n self.assertEquals( self.path.num_elements, 10 )", "metadata": "root.TestPathSize.test_ten", "header": "['class', 'TestPathSize', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 37 }, { "content": "class TestAddAndGetSegments(unittest.TestCase):\n \n \n \n ", "metadata": "root.TestAddAndGetSegments", "header": "['module', '___EOS___']", "index": 48 }, { "content": " def setUp(self):\n self.aa = Vertex(\"A\")\n self.bb = Vertex(\"B\")\n self.ep = Link()\n self.path = Path(self.aa)", "metadata": "root.TestAddAndGetSegments.setUp", "header": "['class', 'TestAddAndGetSegments', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 49 }, { "content": " def test_none(self):\n \"\"\"behave appropriately when asking for an out-of-bounds index\"\"\"\n \n # test out of bounds values\n self.assertRaises( IndexError, self.path.getVertex, -1 )\n self.assertRaises( IndexError, self.path.getVertex, 1 )\n self.assertRaises( IndexError, self.path.getVertex, 10 )\n \n self.assertRaises( IndexError, self.path.getEdge, -1 )\n self.assertRaises( IndexError, self.path.getEdge, 0 )\n self.assertRaises( IndexError, self.path.getEdge, 1 )\n self.assertRaises( IndexError, self.path.getEdge, 10 )\n \n # if you don't add any segments, there's still a single vertex in the path\n self.assertEquals( self.path.getVertex( 0 ).soul, self.aa.soul )", "metadata": "root.TestAddAndGetSegments.test_none", "header": "['class', 'TestAddAndGetSegments', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 55 }, { "content": " def test_one(self):\n \"\"\"get a vertex, edge after adding a single segment\"\"\"\n \n ee = Edge(self.aa, self.bb, self.ep)\n self.path.addSegment( self.bb, ee )\n \n # out of bounds\n self.assertRaises( IndexError, self.path.getVertex, -1 )\n self.assertRaises( IndexError, self.path.getEdge, -1 )\n \n # vertices in bounds\n self.assertEqual( self.path.getVertex(0).soul, self.aa.soul )\n self.assertEqual( self.path.getVertex(1).soul, self.bb.soul )\n \n # edges in bounds\n self.assertEqual( self.path.getEdge(0).soul, ee.soul )\n \n # out of bounds again\n self.assertRaises( IndexError, self.path.getVertex, 2 )\n self.assertRaises( IndexError, self.path.getEdge, 1 )", "metadata": "root.TestAddAndGetSegments.test_one", "header": "['class', 'TestAddAndGetSegments', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 71 }, { "content": " def test_two(self):\n \"\"\"get a vertex, edge after adding two segments\"\"\"\n \n ee1 = Edge(self.aa, self.bb, Link())\n ee2 = Edge(self.bb, self.aa, Link())\n self.path.addSegment( self.bb, ee1 )\n self.path.addSegment( self.aa, ee2 )\n \n # out of bounds\n self.assertRaises( IndexError, self.path.getVertex, -1 )\n self.assertRaises( IndexError, self.path.getEdge, -1 )\n \n # vertices in bounds\n self.assertEqual( self.path.getVertex(0).soul, self.aa.soul )\n self.assertEqual( self.path.getVertex(1).soul, self.bb.soul )\n self.assertEqual( self.path.getVertex(2).soul, self.aa.soul )\n \n # edges in bounds\n self.assertEqual( self.path.getEdge(0).soul, ee1.soul )\n self.assertEqual( self.path.getEdge(1).soul, ee2.soul )\n \n # out of bounds again\n self.assertRaises( IndexError, self.path.getVertex, 3 )\n self.assertRaises( IndexError, self.path.getEdge, 2 )", "metadata": "root.TestAddAndGetSegments.test_two", "header": "['class', 'TestAddAndGetSegments', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 92 }, { "content": " def test_expand(self):\n \"\"\"vertices gettable after resizing\"\"\"\n \n # the path length right before a vector expansion\n pathlen = 50\n \n # make a bunch of fake segments\n segments = []\n for i in range(pathlen):\n vv = Vertex(str(i))\n ee = Edge( vv, vv, Link() )\n segments.append( (vv, ee) )\n \n # add those segments to the path\n for vv, ee in segments:\n self.path.addSegment( vv, ee ) \n \n # check that they're alright\n # check the odd-duck vertex\n self.assertEqual( self.path.getVertex(0).label, \"A\" )\n \n # check the bunch of fake segments added\n for i in range(1, pathlen+1):\n self.assertEqual( i-1, int(self.path.getVertex(i).label) )\n \n #\n # getting towards the real test - add a segment after the vectors have\n # been expanded\n #\n \n # add it\n vv = Vertex(\"B\")\n ee = Edge(vv, vv, Link())\n self.path.addSegment( vv, ee )\n \n # get it\n self.assertEqual( self.path.getVertex( 51 ).label, \"B\" )", "metadata": "root.TestAddAndGetSegments.test_expand", "header": "['class', 'TestAddAndGetSegments', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 117 } ]
[ { "span": "from graphserver.core import Vertex, Edge, Link, Street, Path", "start_line": 0, "start_column": 0, "end_line": 0, "end_column": 61 }, { "span": "from graphserver.gsdll import lgs", "start_line": 2, "start_column": 0, "end_line": 2, "end_column": 33 }, { "span": "from ctypes import addressof", "start_line": 3, "start_column": 0, "end_line": 3, "end_column": 28 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "from_", "graph", "server_", "._", "core_", "import_", "Vertex_", ",_", "Edge_", ",_", "Link_", ",_", "Stre", "et_", ",_", "Path_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "unittest_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "graph", "server_", "._", "gs", "dll_", "import_", "lg", "s_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "ctypes_", "import_", "address", "of_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "\\u\\u", "name\\u\\u_", "==_", "'\\u", "\\u", "main", "\\u\\u'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "unittest_", "._", "main_", "(_", ")_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Test", "Path", "Create_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Test", "Path", "Create_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "test\\u", "path", "\\u", "new_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Creat", "e", " ", "a", " ", "path", " ", "object", " ", "with", "out", " ", "crash", "ing", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "path_", "=_", "Path_", "(_", "Vertex_", "(_", "\"", "A", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Path", "Create_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "path", "\\u", "empty_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Path", " ", "is", " ", "empty", " ", "right", " ", "after", " ", "first", " ", "created", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pp_", "=_", "Path_", "(_", "Vertex_", "(_", "\"", "A", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "pp_", "._", "num", "\\u", "elements_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Test", "Path", "Size_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Test", "Path", "Size_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "set", "Up_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "aa_", "=_", "Vertex_", "(_", "\"", "AA", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "path_", "=_", "Path_", "(_", "self_", "._", "aa_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Path", "Size_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "zero_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "get", "Size", " ", "return", "s", " ", "zero", " ", "on", " ", "an", " ", "empty", " ", "path", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "self_", "._", "path_", "._", "num", "\\u", "elements_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Path", "Size_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "one_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "get", "Size", " ", "return", "s", " ", "one", " ", "after", " ", "one", " ", "entry", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "bb_", "=_", "Vertex_", "(_", "\"", "BB", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ee_", "=_", "Edge_", "(_", "self_", "._", "aa_", ",_", "bb_", ",_", "Link_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "path_", "._", "add", "Segment_", "(_", "bb_", ",_", "ee_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "self_", "._", "path_", "._", "num", "\\u", "elements_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Path", "Size_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "ten_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "get", "Size", " ", "return", "s", " ", "ten", " ", "after", " ", "ten", " ", "entri", "es", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "i_", "in_", "range_", "(_", "10_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "aa_", "=_", "Vertex_", "(_", "\"", "AA", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bb_", "=_", "Vertex_", "(_", "\"", "BB", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "payload_", "=_", "Link_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "path_", "._", "add", "Segment_", "(_", "bb_", ",_", "Edge_", "(_", "aa_", ",_", "bb_", ",_", "payload_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "self_", "._", "path_", "._", "num", "\\u", "elements_", ",_", "10_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Test", "Add", "And", "Get", "Segments", "_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Test", "Add", "And", "Get", "Segments", "_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "set", "Up_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "aa_", "=_", "Vertex_", "(_", "\"", "A", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "bb_", "=_", "Vertex_", "(_", "\"", "B", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "ep_", "=_", "Link_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "path_", "=_", "Path_", "(_", "self_", "._", "aa_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Add", "And", "Get", "Segments", "_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "none_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "behave", " ", "appropr", "iate", "ly", " ", "whe", "n", " ", "ask", "ing", " ", "for", " ", "an", " ", "out", "-", "of", "-", "bound", "s", " ", "index", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "test", " ", "out", " ", "of", " ", "bound", "s", " ", "values_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Raises_", "(_", "Index", "Error_", ",_", "self_", "._", "path_", "._", "get", "Vertex_", ",_", "-_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Raises_", "(_", "Index", "Error_", ",_", "self_", "._", "path_", "._", "get", "Vertex_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Raises_", "(_", "Index", "Error_", ",_", "self_", "._", "path_", "._", "get", "Vertex_", ",_", "10_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Raises_", "(_", "Index", "Error_", ",_", "self_", "._", "path_", "._", "get", "Edge_", ",_", "-_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Raises_", "(_", "Index", "Error_", ",_", "self_", "._", "path_", "._", "get", "Edge_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Raises_", "(_", "Index", "Error_", ",_", "self_", "._", "path_", "._", "get", "Edge_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Raises_", "(_", "Index", "Error_", ",_", "self_", "._", "path_", "._", "get", "Edge_", ",_", "10_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "if", " ", "you", " ", "don", "'", "t", " ", "add", " ", "any", " ", "segments", ",", " ", "there", "'", "s", " ", "still", " ", "a", " ", "single", " ", "vertex", " ", "in", " ", "the", " ", "path_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "self_", "._", "path_", "._", "get", "Vertex_", "(_", "0_", ")_", "._", "sou", "l_", ",_", "self_", "._", "aa_", "._", "sou", "l_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Add", "And", "Get", "Segments", "_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "one_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "get", " ", "a", " ", "vertex", ",", " ", "edge", " ", "after", " ", "addin", "g", " ", "a", " ", "single", " ", "segment", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "ee_", "=_", "Edge_", "(_", "self_", "._", "aa_", ",_", "self_", "._", "bb_", ",_", "self_", "._", "ep_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "path_", "._", "add", "Segment_", "(_", "self_", "._", "bb_", ",_", "ee_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "out", " ", "of", " ", "bounds_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Raises_", "(_", "Index", "Error_", ",_", "self_", "._", "path_", "._", "get", "Vertex_", ",_", "-_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Raises_", "(_", "Index", "Error_", ",_", "self_", "._", "path_", "._", "get", "Edge_", ",_", "-_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "vertice", "s", " ", "in", " ", "bounds_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "self_", "._", "path_", "._", "get", "Vertex_", "(_", "0_", ")_", "._", "sou", "l_", ",_", "self_", "._", "aa_", "._", "sou", "l_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "self_", "._", "path_", "._", "get", "Vertex_", "(_", "1_", ")_", "._", "sou", "l_", ",_", "self_", "._", "bb_", "._", "sou", "l_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "edge", "s", " ", "in", " ", "bounds_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "self_", "._", "path_", "._", "get", "Edge_", "(_", "0_", ")_", "._", "sou", "l_", ",_", "ee_", "._", "sou", "l_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "out", " ", "of", " ", "bound", "s", " ", "again", "_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Raises_", "(_", "Index", "Error_", ",_", "self_", "._", "path_", "._", "get", "Vertex_", ",_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Raises_", "(_", "Index", "Error_", ",_", "self_", "._", "path_", "._", "get", "Edge_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Add", "And", "Get", "Segments", "_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "two_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "get", " ", "a", " ", "vertex", ",", " ", "edge", " ", "after", " ", "addin", "g", " ", "two", " ", "segments", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "ee", "1_", "=_", "Edge_", "(_", "self_", "._", "aa_", ",_", "self_", "._", "bb_", ",_", "Link_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ee", "2_", "=_", "Edge_", "(_", "self_", "._", "bb_", ",_", "self_", "._", "aa_", ",_", "Link_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "path_", "._", "add", "Segment_", "(_", "self_", "._", "bb_", ",_", "ee", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "path_", "._", "add", "Segment_", "(_", "self_", "._", "aa_", ",_", "ee", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "out", " ", "of", " ", "bounds_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Raises_", "(_", "Index", "Error_", ",_", "self_", "._", "path_", "._", "get", "Vertex_", ",_", "-_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Raises_", "(_", "Index", "Error_", ",_", "self_", "._", "path_", "._", "get", "Edge_", ",_", "-_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "vertice", "s", " ", "in", " ", "bounds_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "self_", "._", "path_", "._", "get", "Vertex_", "(_", "0_", ")_", "._", "sou", "l_", ",_", "self_", "._", "aa_", "._", "sou", "l_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "self_", "._", "path_", "._", "get", "Vertex_", "(_", "1_", ")_", "._", "sou", "l_", ",_", "self_", "._", "bb_", "._", "sou", "l_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "self_", "._", "path_", "._", "get", "Vertex_", "(_", "2_", ")_", "._", "sou", "l_", ",_", "self_", "._", "aa_", "._", "sou", "l_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "edge", "s", " ", "in", " ", "bounds_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "self_", "._", "path_", "._", "get", "Edge_", "(_", "0_", ")_", "._", "sou", "l_", ",_", "ee", "1_", "._", "sou", "l_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "self_", "._", "path_", "._", "get", "Edge_", "(_", "1_", ")_", "._", "sou", "l_", ",_", "ee", "2_", "._", "sou", "l_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "out", " ", "of", " ", "bound", "s", " ", "again", "_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Raises_", "(_", "Index", "Error_", ",_", "self_", "._", "path_", "._", "get", "Vertex_", ",_", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Raises_", "(_", "Index", "Error_", ",_", "self_", "._", "path_", "._", "get", "Edge_", ",_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Add", "And", "Get", "Segments", "_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "expand_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "vertice", "s", " ", "gett", "able", " ", "after", " ", "resiz", "ing", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "the", " ", "path", " ", "length", " ", "right", " ", "bef", "ore", " ", "a", " ", "vector", " ", "expansion", "_", "\\u\\u\\uNL\\u\\u\\u_", "path", "len_", "=_", "50_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "make", " ", "a", " ", "bunch", " ", "of", " ", "fake", " ", "segments_", "\\u\\u\\uNL\\u\\u\\u_", "segments_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", "in_", "range_", "(_", "path", "len_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "vv_", "=_", "Vertex_", "(_", "str_", "(_", "i_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ee_", "=_", "Edge_", "(_", "vv_", ",_", "vv_", ",_", "Link_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "segments_", "._", "append_", "(_", "(_", "vv_", ",_", "ee_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "add", " ", "tho", "se", " ", "segments", " ", "to", " ", "the", " ", "path_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "vv_", ",_", "ee_", "in_", "segments_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "path_", "._", "add", "Segment_", "(_", "vv_", ",_", "ee_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "check", " ", "tha", "t", " ", "the", "y", "'", "re", " ", "alr", "ight_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "check", " ", "the", " ", "odd", "-", "duck", " ", "vertex_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "self_", "._", "path_", "._", "get", "Vertex_", "(_", "0_", ")_", "._", "label_", ",_", "\"", "A", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "check", " ", "the", " ", "bunch", " ", "of", " ", "fake", " ", "segments", " ", "added_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "i_", "in_", "range_", "(_", "1_", ",_", "path", "len_", "+_", "1_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "Equal_", "(_", "i_", "-_", "1_", ",_", "int_", "(_", "self_", "._", "path_", "._", "get", "Vertex_", "(_", "i_", ")_", "._", "label_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "getti", "ng", " ", "towards", " ", "the", " ", "real", " ", "test", " ", "-", " ", "add", " ", "a", " ", "segment", " ", "after", " ", "the", " ", "vector", "s", " ", "have_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "bee", "n", " ", "expanded_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "add", " ", "it_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "vv_", "=_", "Vertex_", "(_", "\"", "B", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ee_", "=_", "Edge_", "(_", "vv_", ",_", "vv_", ",_", "Link_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "path_", "._", "add", "Segment_", "(_", "vv_", ",_", "ee_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "get", " ", "it_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "self_", "._", "path_", "._", "get", "Vertex_", "(_", "51_", ")_", "._", "label_", ",_", "\"", "B", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Except block handles 'BaseException'
fp7-ofelia/ocf/optin_manager/src/python/openflow/optin_manager/sfa/openflow_utils/expiration_manager.py
[ { "content": " @staticmethod\n def find_expired_slices():\n try:\n from openflow.optin_manager.sfa.drivers.OFSfaDriver import OFSfaDriver #Avoiding circular Deps\n except:\n pass\n slices = ExpiringComponets.objects.all()\n expired_components = list()\n for slice in slices:\n expiration_date = int(datetime_to_epoch(utcparse(slice.expires)))\n if expiration_date <= int(datetime_to_epoch(utcparse(datetime.utcnow()))):\n try:\n OFSfaDriver().crud_slice(slice.slice,slice.authority, 'delete_slice')\n except:\n pass", "metadata": "root.ExpirationManager.find_expired_slices", "header": "['class', 'ExpirationManager', ':', '___EOS___']", "index": 18 } ]
[ { "span": "except:", "start_line": 22, "start_column": 8, "end_line": 22, "end_column": 15 }, { "span": "except:", "start_line": 31, "start_column": 16, "end_line": 31, "end_column": 23 } ]
[]
1
true
[ "[CLS]_", "Except", "_", "block_", "handles_", "'", "Base", "Except", "ion", "'_", "[SEP]_", "class_", "Expir", "ation", "Manager_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "staticmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "find", "\\u", "expir", "ed", "\\u", "slices_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "openf", "low_", "._", "opti", "n", "\\u", "manager_", "._", "sfa", "_", "._", "drivers_", "._", "OF", "Sf", "a", "Driver_", "import_", "OF", "Sf", "a", "Driver_", "#", "Av", "oid", "ing", " ", "circular", " ", "Deps", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "slices_", "=_", "Expir", "ing", "Compo", "nets_", "._", "objects_", "._", "all_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "expir", "ed", "\\u", "components_", "=_", "list_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "slice_", "in_", "slices_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "expir", "ation", "\\u", "date_", "=_", "int_", "(_", "datetime", "\\u", "to", "\\u", "epoch_", "(_", "utc", "parse_", "(_", "slice_", "._", "expires_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "expir", "ation", "\\u", "date_", "<=_", "int_", "(_", "datetime", "\\u", "to", "\\u", "epoch_", "(_", "utc", "parse_", "(_", "datetime_", "._", "utcnow_", "(_", ")_", ")_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "OF", "Sf", "a", "Driver_", "(_", ")_", "._", "crud", "\\u", "slice_", "(_", "slice_", "._", "slice_", ",_", "slice_", "._", "authority_", ",_", "'", "delete", "\\u", "slice", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "pass_" ]
[ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 2, 2, 2, 2, 2 ]
Unreachable code
Debian/debile/debile/slave/wrappers/clanganalyzer.py
[ { "content": "def parse_plist(pathOrFile):\n \"\"\"\n Given a .plist file emitted by clang-static-analyzer (e.g. via\n scan-build), parse it and return an Analysis instance\n \"\"\"\n plist = plistlib.readPlist(pathOrFile)\n # We now have the .plist file as a hierarchy of dicts, lists, etc\n\n # Handy debug dump:\n if 0:\n pprint(plist)\n\n # A list of filenames, apparently referenced by index within\n # diagnostics:\n files = plist['files']\n\n for diagnostic in plist['diagnostics']:\n if 0:\n pprint(diagnostic)\n\n cwe = None\n\n # TODO: we're not yet handling the following:\n # diagnostic['category']\n # diagnostic['type']\n\n message = Message(text=diagnostic['description'])\n\n loc = diagnostic['location']\n location = Location(file=File(givenpath=files[loc.file],\n abspath=None),\n\n # FIXME: doesn't tell us function name\n # TODO: can we patch this upstream?\n function=None,\n\n point=Point(int(loc.line),\n int(loc.col)))\n\n notes = None\n\n trace = make_trace(files, diagnostic['path'])\n\n issue = Issue(cwe,\n None, # FIXME: can we get at the test id?\n location, message, notes, trace)\n\n yield issue", "metadata": "root.parse_plist", "header": "['module', '___EOS___']", "index": 45 }, { "content": "def make_trace(files, path):\n \"\"\"\n Construct a Trace instance from the .plist's 'path' list\n \"\"\"\n trace = Trace([])\n lastlocation = None\n for node in path:\n if 0:\n pprint(node)\n\n kind = node['kind']\n\n if kind == 'event':\n # e.g.:\n # {'extended_message': \"Value stored to 'ret' is never read\",\n # 'kind': 'event',\n # 'location': {'col': 2, 'file': 0, 'line': 130},\n # 'message': \"Value stored to 'ret' is never read\",\n # 'ranges': [[{'col': 8, 'file': 0, 'line': 130},\n # {'col': 29, 'file': 0, 'line': 130}]]}\n\n # TODO: we're not yet handling the following:\n # node['extended_message']\n # node['ranges']\n\n loc = node['location']\n location = make_location_from_point(files, loc)\n\n notes = Notes(node['message'])\n trace.add_state(State(location, notes))\n\n lastlocation = location\n\n elif kind == 'control':\n # e.g.:\n # {'edges': [{'end': [{'col': 9, 'file': 0, 'line': 161},\n # {'col': 9, 'file': 0, 'line': 161}],\n # 'start': [{'col': 2, 'file': 0, 'line': 161},\n # {'col': 2, 'file': 0, 'line': 161}]}],\n # 'kind': 'control'}\n edges = node['edges']\n for edge in edges:\n edge_start = edge.start\n edge_end = edge.end\n\n startloc = make_location_from_range(files, edge_start)\n endloc = make_location_from_range(files, edge_end)\n\n if startloc != lastlocation:\n trace.add_state(State(startloc, None))\n trace.add_state(State(endloc, None))\n lastlocation = endloc\n else:\n raise ValueError('unknown kind: %r' % kind)\n return trace", "metadata": "root.make_trace", "header": "['module', '___EOS___']", "index": 147 } ]
[ { "span": "pprint(plist)", "start_line": 55, "start_column": 8, "end_line": 55, "end_column": 21 }, { "span": "pprint(diagnostic)", "start_line": 63, "start_column": 12, "end_line": 63, "end_column": 30 }, { "span": "pprint(node)", "start_line": 155, "start_column": 12, "end_line": 155, "end_column": 24 } ]
[]
1
true
[ "[CLS]_", "Unrea", "chab", "le_", "code_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "parse", "\\u", "plist_", "(_", "path", "Or", "File_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Give", "n", " ", "a", " ", ".", "plist", " ", "file", " ", "emitte", "d", " ", "by", " ", "clang", "-", "static", "-", "analyze", "r", " ", "(", "e", ".", "g", ".", " ", "via", "\\", "10", ";", " ", " ", " ", " ", "scan", "-", "build", "),", " ", "parse", " ", "it", " ", "and", " ", "return", " ", "an", " ", "Analy", "sis", " ", "instance", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "plist_", "=_", "plist", "lib_", "._", "read", "Plist", "_", "(_", "path", "Or", "File_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "We", " ", "now", " ", "have", " ", "the", " ", ".", "plist", " ", "file", " ", "as", " ", "a", " ", "hier", "arch", "y", " ", "of", " ", "dict", "s", ",", " ", "lists", ",", " ", "etc", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Hand", "y", " ", "debug", " ", "dump", ":_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pprint_", "(_", "plist_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "A", " ", "list", " ", "of", " ", "filename", "s", ",", " ", "appare", "ntl", "y", " ", "referenced", " ", "by", " ", "index", " ", "within", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "diagnostics", ":_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "files_", "=_", "plist_", "[_", "'", "files", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "diagnostic", "_", "in_", "plist_", "[_", "'", "diagnostics", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pprint_", "(_", "diagnostic", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "cw", "e_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "TOD", "O", ":", " ", "we", "'", "re", " ", "not", " ", "ye", "t", " ", "handling", " ", "the", " ", "follow", "ing", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "diagnostic", "['", "category", "']", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "diagnostic", "['", "type", "']", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "message_", "=_", "Message_", "(_", "text_", "=_", "diagnostic", "_", "[_", "'", "description", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "loc_", "=_", "diagnostic", "_", "[_", "'", "location", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "location_", "=_", "Location_", "(_", "file_", "=_", "File_", "(_", "give", "npa", "th_", "=_", "files_", "[_", "loc_", "._", "file_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "abspath_", "=_", "None_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "FIX", "ME", ":", " ", "doe", "sn", "'", "t", " ", "tell", " ", "us", " ", "function", " ", "name_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "TOD", "O", ":", " ", "can", " ", "we", " ", "patch", " ", "this", " ", "ups", "tream", "?", "_", "\\u\\u\\uNL\\u\\u\\u_", "function_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "point_", "=_", "Point_", "(_", "int_", "(_", "loc_", "._", "line_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "int_", "(_", "loc_", "._", "col_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "notes_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "trace_", "=_", "make", "\\u", "trace_", "(_", "files_", ",_", "diagnostic", "_", "[_", "'", "path", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "issue_", "=_", "Issue_", "(_", "cw", "e_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "None_", ",_", "#", " ", "FIX", "ME", ":", " ", "can", " ", "we", " ", "get", " ", "at", " ", "the", " ", "test", " ", "id", "?", "_", "\\u\\u\\uNL\\u\\u\\u_", "location_", ",_", "message_", ",_", "notes_", ",_", "trace_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "yield_", "issue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "make", "\\u", "trace_", "(_", "files_", ",_", "path_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Construct", " ", "a", " ", "Trace", " ", "instance", " ", "from", " ", "the", " ", ".", "plist", "'", "s", " ", "'", "path", "'", " ", "list", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "trace_", "=_", "Trace_", "(_", "[_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "last", "location_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "node_", "in_", "path_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pprint_", "(_", "node_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "kind_", "=_", "node_", "[_", "'", "kind", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "kind_", "==_", "'", "event", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "e", ".", "g", ".:", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "{", "'", "extend", "ed", "\\u", "message", "':", " ", "\"", "Value", " ", "store", "d", " ", "to", " ", "'", "ret", "'", " ", "is", " ", "neve", "r", " ", "read", "\",", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "'", "kind", "':", " ", "'", "event", "',", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "'", "location", "':", " ", "{", "'", "col", "':", " ", "2", ",", " ", "'", "file", "':", " ", "0", ",", " ", "'", "line", "':", " ", "130", "},", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "'", "message", "':", " ", "\"", "Value", " ", "store", "d", " ", "to", " ", "'", "ret", "'", " ", "is", " ", "neve", "r", " ", "read", "\",", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "'", "ranges", "':", " ", "[[", "{", "'", "col", "':", " ", "8", ",", " ", "'", "file", "':", " ", "0", ",", " ", "'", "line", "':", " ", "130", "},", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "{", "'", "col", "':", " ", "2", "9", ",", " ", "'", "file", "':", " ", "0", ",", " ", "'", "line", "':", " ", "130", "}]", "]}", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "TOD", "O", ":", " ", "we", "'", "re", " ", "not", " ", "ye", "t", " ", "handling", " ", "the", " ", "follow", "ing", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "node", "['", "extend", "ed", "\\u", "message", "']", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "node", "['", "ranges", "']", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "loc_", "=_", "node_", "[_", "'", "location", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "location_", "=_", "make", "\\u", "location", "\\u", "from", "\\u", "point_", "(_", "files_", ",_", "loc_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "notes_", "=_", "Notes_", "(_", "node_", "[_", "'", "message", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "trace_", "._", "add", "\\u", "state_", "(_", "State_", "(_", "location_", ",_", "notes_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "last", "location_", "=_", "location_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "kind_", "==_", "'", "control", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "e", ".", "g", ".:", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "{", "'", "edge", "s", "':", " ", "[{", "'", "end", "':", " ", "[{", "'", "col", "':", " ", "9", ",", " ", "'", "file", "':", " ", "0", ",", " ", "'", "line", "':", " ", "161", "},", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "{", "'", "col", "':", " ", "9", ",", " ", "'", "file", "':", " ", "0", ",", " ", "'", "line", "':", " ", "161", "}]", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", " ", "'", "start", "':", " ", "[{", "'", "col", "':", " ", "2", ",", " ", "'", "file", "':", " ", "0", ",", " ", "'", "line", "':", " ", "161", "},", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "{", "'", "col", "':", " ", "2", ",", " ", "'", "file", "':", " ", "0", ",", " ", "'", "line", "':", " ", "161", "}]", "}]", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "'", "kind", "':", " ", "'", "control", "'}", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "edges_", "=_", "node_", "[_", "'", "edge", "s", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "edge_", "in_", "edges_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "edge", "\\u", "start_", "=_", "edge_", "._", "start_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "edge", "\\u", "end_", "=_", "edge_", "._", "end_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "start", "loc_", "=_", "make", "\\u", "location", "\\u", "from", "\\u", "range_", "(_", "files_", ",_", "edge", "\\u", "start_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "endl", "oc_", "=_", "make", "\\u", "location", "\\u", "from", "\\u", "range_", "(_", "files_", ",_", "edge", "\\u", "end_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "start", "loc_", "!=_", "last", "location_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "trace_", "._", "add", "\\u", "state_", "(_", "State_", "(_", "start", "loc_", ",_", "None_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "trace_", "._", "add", "\\u", "state_", "(_", "State_", "(_", "endl", "oc_", ",_", "None_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "last", "location_", "=_", "endl", "oc_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Value", "Error_", "(_", "'", "unknown", " ", "kind", ":", " ", "%", "r", "'_", "%_", "kind_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "trace_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
thiago-silva/memetalk/sugarfoot/pycompiler/dump.py
[ { "content": "from pyutils import bits\nfrom pprint import pprint as P\nfrom pdb import set_trace as br\nimport math\nimport os\nimport sys\n\nwith open(sys.argv[1], 'r') as fp:\n text = fp.read()\n HEADER_SIZE = bits.WSIZE * 5\n\n magic = hex(bits.unpack(text[0:bits.WSIZE]))\n ot_size = bits.unpack(text[bits.WSIZE:bits.WSIZE*2])\n er_size = bits.unpack(text[bits.WSIZE*2:bits.WSIZE*3])\n es_size = bits.unpack(text[bits.WSIZE*3:bits.WSIZE*4])\n names_size = bits.unpack(text[bits.WSIZE*4:bits.WSIZE*5])\n\n print 'MAGIC', magic\n print 'ot_size', ot_size\n print 'es_size', es_size\n print 'names_size', names_size\n\n # names\n begin_names = HEADER_SIZE\n end_names = begin_names + names_size\n names = text[begin_names:end_names]\n\n # OT\n begin_ot = end_names\n end_ot = begin_ot + ot_size\n ot = text[begin_ot:end_ot]\n print '* OT', map(bits.unpack, bits.chunks(ot, bits.WSIZE)), \"\\n\"\n\n # external references\n begin_er = end_ot\n end_er = begin_er + er_size\n es = text[begin_er:end_er]\n print '* ER', map(bits.unpack, bits.chunks(es, bits.WSIZE)), \"\\n\"\n\n # symbols\n begin_es = end_er\n end_es = begin_es + es_size\n es = text[begin_es:end_es]\n print '* ES', map(bits.unpack, bits.chunks(es, bits.WSIZE)), \"\\n\"\n\n # reloc table\n begin_reloc = end_es\n reloc = text[begin_reloc:]\n print '* RELOC', map(bits.unpack, bits.chunks(reloc, bits.WSIZE)), \"\\n\"\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[ { "span": "from pprint import pprint as P", "start_line": 1, "start_column": 0, "end_line": 1, "end_column": 30 }, { "span": "import math", "start_line": 3, "start_column": 0, "end_line": 3, "end_column": 11 }, { "span": "import os", "start_line": 4, "start_column": 0, "end_line": 4, "end_column": 9 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "from_", "pyu", "tils_", "import_", "bits_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "pprint_", "import_", "pprint_", "as_", "P_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "pdb_", "import_", "set\\u", "trace_", "as_", "br_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "math_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "with_", "open_", "(_", "sys_", "._", "argv_", "[_", "1_", "]_", ",_", "'", "r", "'_", ")_", "as_", "fp_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "text_", "=_", "fp_", "._", "read_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "HEAD", "ER", "\\u", "SIZE_", "=_", "bits_", "._", "WS", "IZE_", "*_", "5_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "magic_", "=_", "hex_", "(_", "bits_", "._", "unpack_", "(_", "text_", "[_", "0_", ":_", "bits_", "._", "WS", "IZE_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ot", "\\u", "size_", "=_", "bits_", "._", "unpack_", "(_", "text_", "[_", "bits_", "._", "WS", "IZE_", ":_", "bits_", "._", "WS", "IZE_", "*_", "2_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "er", "\\u", "size_", "=_", "bits_", "._", "unpack_", "(_", "text_", "[_", "bits_", "._", "WS", "IZE_", "*_", "2_", ":_", "bits_", "._", "WS", "IZE_", "*_", "3_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "es", "\\u", "size_", "=_", "bits_", "._", "unpack_", "(_", "text_", "[_", "bits_", "._", "WS", "IZE_", "*_", "3_", ":_", "bits_", "._", "WS", "IZE_", "*_", "4_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "names", "\\u", "size_", "=_", "bits_", "._", "unpack_", "(_", "text_", "[_", "bits_", "._", "WS", "IZE_", "*_", "4_", ":_", "bits_", "._", "WS", "IZE_", "*_", "5_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "print_", "'", "MAGIC", "'_", ",_", "magic_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "'", "ot", "\\u", "size", "'_", ",_", "ot", "\\u", "size_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "'", "es", "\\u", "size", "'_", ",_", "es", "\\u", "size_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "'", "names", "\\u", "size", "'_", ",_", "names", "\\u", "size_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "names_", "\\u\\u\\uNL\\u\\u\\u_", "begin", "\\u", "names_", "=_", "HEAD", "ER", "\\u", "SIZE_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "end", "\\u", "names_", "=_", "begin", "\\u", "names_", "+_", "names", "\\u", "size_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "names_", "=_", "text_", "[_", "begin", "\\u", "names_", ":_", "end", "\\u", "names_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "OT", "_", "\\u\\u\\uNL\\u\\u\\u_", "begin", "\\u", "ot_", "=_", "end", "\\u", "names_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "end", "\\u", "ot_", "=_", "begin", "\\u", "ot_", "+_", "ot", "\\u", "size_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ot_", "=_", "text_", "[_", "begin", "\\u", "ot_", ":_", "end", "\\u", "ot_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "'*", " ", "OT", "'_", ",_", "map_", "(_", "bits_", "._", "unpack_", ",_", "bits_", "._", "chunks_", "(_", "ot_", ",_", "bits_", "._", "WS", "IZE_", ")_", ")_", ",_", "\"\\\\", "n", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "external", " ", "references_", "\\u\\u\\uNL\\u\\u\\u_", "begin", "\\u", "er_", "=_", "end", "\\u", "ot_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "end", "\\u", "er_", "=_", "begin", "\\u", "er_", "+_", "er", "\\u", "size_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "es_", "=_", "text_", "[_", "begin", "\\u", "er_", ":_", "end", "\\u", "er_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "'*", " ", "ER", "'_", ",_", "map_", "(_", "bits_", "._", "unpack_", ",_", "bits_", "._", "chunks_", "(_", "es_", ",_", "bits_", "._", "WS", "IZE_", ")_", ")_", ",_", "\"\\\\", "n", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "symbols_", "\\u\\u\\uNL\\u\\u\\u_", "begin", "\\u", "es_", "=_", "end", "\\u", "er_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "end", "\\u", "es_", "=_", "begin", "\\u", "es_", "+_", "es", "\\u", "size_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "es_", "=_", "text_", "[_", "begin", "\\u", "es_", ":_", "end", "\\u", "es_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "'*", " ", "ES", "'_", ",_", "map_", "(_", "bits_", "._", "unpack_", ",_", "bits_", "._", "chunks_", "(_", "es_", ",_", "bits_", "._", "WS", "IZE_", ")_", ")_", ",_", "\"\\\\", "n", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "relo", "c", " ", "table_", "\\u\\u\\uNL\\u\\u\\u_", "begin", "\\u", "relo", "c_", "=_", "end", "\\u", "es_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "relo", "c_", "=_", "text_", "[_", "begin", "\\u", "relo", "c_", ":_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "'*", " ", "REL", "OC", "'_", ",_", "map_", "(_", "bits_", "._", "unpack_", ",_", "bits_", "._", "chunks_", "(_", "relo", "c_", ",_", "bits_", "._", "WS", "IZE_", ")_", ")_", ",_", "\"\\\\", "n", "\"_", "\\u\\u\\uDEDENT\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 2, 0, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2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 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused local variable
crate/crate-python/src/crate/client/sqlalchemy/tests/create_table_test.py
[ { "content": " def test_create_table_with_basic_types(self):\n class User(self.Base):\n __tablename__ = 'users'\n string_col = sa.Column(sa.String, primary_key=True)\n unicode_col = sa.Column(sa.Unicode)\n text_col = sa.Column(sa.Text)\n int_col = sa.Column(sa.Integer)\n long_col = sa.Column(sa.BigInteger)\n bool_col = sa.Column(sa.Boolean)\n short_col = sa.Column(sa.SmallInteger)\n ts_col = sa.Column(sa.DateTime)\n float_col = sa.Column(sa.Float)\n\n self.Base.metadata.create_all()\n fake_cursor.execute.assert_called_with(\n ('\\nCREATE TABLE users (\\n\\tstring_col STRING, '\n '\\n\\tunicode_col STRING, \\n\\ttext_col STRING, \\n\\tint_col INT, '\n '\\n\\tlong_col LONG, \\n\\tbool_col BOOLEAN, '\n '\\n\\tshort_col SHORT, \\n\\tts_col TIMESTAMP, '\n '\\n\\tfloat_col FLOAT, \\n\\tPRIMARY KEY (string_col)\\n)\\n\\n'),\n ())", "metadata": "root.CreateTableTest.test_create_table_with_basic_types", "header": "['class', 'CreateTableTest', '(', 'TestCase', ')', ':', '___EOS___']", "index": 43 }, { "content": " def test_with_obj_column(self):\n class DummyTable(self.Base):\n __tablename__ = 'dummy'\n pk = sa.Column(sa.String, primary_key=True)\n obj_col = sa.Column(Object)\n self.Base.metadata.create_all()\n fake_cursor.execute.assert_called_with(\n ('\\nCREATE TABLE dummy (\\n\\tpk STRING, \\n\\tobj_col OBJECT, '\n '\\n\\tPRIMARY KEY (pk)\\n)\\n\\n'),\n ())", "metadata": "root.CreateTableTest.test_with_obj_column", "header": "['class', 'CreateTableTest', '(', 'TestCase', ')', ':', '___EOS___']", "index": 65 }, { "content": " def test_with_clustered_by(self):\n class DummyTable(self.Base):\n __tablename__ = 't'\n __table_args__ = {\n 'crate_clustered_by': 'p'\n }\n pk = sa.Column(sa.String, primary_key=True)\n p = sa.Column(sa.String)\n self.Base.metadata.create_all()\n fake_cursor.execute.assert_called_with(\n ('\\nCREATE TABLE t (\\n\\t'\n 'pk STRING, \\n\\t'\n 'p STRING, \\n\\t'\n 'PRIMARY KEY (pk)\\n'\n ') CLUSTERED BY (p)\\n\\n'),\n ())", "metadata": "root.CreateTableTest.test_with_clustered_by", "header": "['class', 'CreateTableTest', '(', 'TestCase', ')', ':', '___EOS___']", "index": 76 }, { "content": " def test_with_partitioned_by(self):\n class DummyTable(self.Base):\n __tablename__ = 't'\n __table_args__ = {\n 'crate_partitioned_by': 'p',\n 'invalid_option': 1\n }\n pk = sa.Column(sa.String, primary_key=True)\n p = sa.Column(sa.String)\n self.Base.metadata.create_all()\n fake_cursor.execute.assert_called_with(\n ('\\nCREATE TABLE t (\\n\\t'\n 'pk STRING, \\n\\t'\n 'p STRING, \\n\\t'\n 'PRIMARY KEY (pk)\\n'\n ') PARTITIONED BY (p)\\n\\n'),\n ())", "metadata": "root.CreateTableTest.test_with_partitioned_by", "header": "['class', 'CreateTableTest', '(', 'TestCase', ')', ':', '___EOS___']", "index": 93 }, { "content": " def test_with_number_of_shards_and_replicas(self):\n class DummyTable(self.Base):\n __tablename__ = 't'\n __table_args__ = {\n 'crate_number_of_replicas': '2',\n 'crate_number_of_shards': 3\n }\n pk = sa.Column(sa.String, primary_key=True)\n\n self.Base.metadata.create_all()\n fake_cursor.execute.assert_called_with(\n ('\\nCREATE TABLE t (\\n\\t'\n 'pk STRING, \\n\\t'\n 'PRIMARY KEY (pk)\\n'\n ') CLUSTERED INTO 3 SHARDS WITH (NUMBER_OF_REPLICAS = 2)\\n\\n'),\n ())", "metadata": "root.CreateTableTest.test_with_number_of_shards_and_replicas", "header": "['class', 'CreateTableTest', '(', 'TestCase', ')', ':', '___EOS___']", "index": 111 }, { "content": " def test_with_clustered_by_and_number_of_shards(self):\n class DummyTable(self.Base):\n __tablename__ = 't'\n __table_args__ = {\n 'crate_clustered_by': 'p',\n 'crate_number_of_shards': 3\n }\n pk = sa.Column(sa.String, primary_key=True)\n p = sa.Column(sa.String, primary_key=True)\n self.Base.metadata.create_all()\n fake_cursor.execute.assert_called_with(\n ('\\nCREATE TABLE t (\\n\\t'\n 'pk STRING, \\n\\t'\n 'p STRING, \\n\\t'\n 'PRIMARY KEY (pk, p)\\n'\n ') CLUSTERED BY (p) INTO 3 SHARDS\\n\\n'),\n ())", "metadata": "root.CreateTableTest.test_with_clustered_by_and_number_of_shards", "header": "['class', 'CreateTableTest', '(', 'TestCase', ')', ':', '___EOS___']", "index": 128 } ]
[ { "span": "User(", "start_line": 44, "start_column": 14, "end_line": 44, "end_column": 18 }, { "span": "DummyTable(", "start_line": 66, "start_column": 14, "end_line": 66, "end_column": 24 }, { "span": "DummyTable(", "start_line": 77, "start_column": 14, "end_line": 77, "end_column": 24 }, { "span": "DummyTable(", "start_line": 94, "start_column": 14, "end_line": 94, "end_column": 24 }, { "span": "DummyTable(", "start_line": 112, "start_column": 14, "end_line": 112, "end_column": 24 }, { "span": "DummyTable(", "start_line": 129, "start_column": 14, "end_line": 129, "end_column": 24 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "Creat", "e", "Table", "Test_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "create", "\\u", "table", "\\u", "with", "\\u", "basic", "\\u", "types_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "class_", "User_", "(_", "self_", "._", "Base_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u\\u", "tablename\\u\\u_", "=_", "'", "users", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "string", "\\u", "col_", "=_", "sa_", "._", "Column_", "(_", "sa_", "._", "String_", ",_", "primary", "\\u", "key_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "unicode", "\\u", "col_", "=_", "sa_", "._", "Column_", "(_", "sa_", "._", "Unicode_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "text", "\\u", "col_", "=_", "sa_", "._", "Column_", "(_", "sa_", "._", "Text_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "int\\u", "col_", "=_", "sa_", "._", "Column_", "(_", "sa_", "._", "Integer_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "long", "\\u", "col_", "=_", "sa_", "._", "Column_", "(_", "sa_", "._", "Big", "Integer_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bool\\u", "col_", "=_", "sa_", "._", "Column_", "(_", "sa_", "._", "Boolean_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "short", "\\u", "col_", "=_", "sa_", "._", "Column_", "(_", "sa_", "._", "Small", "Integer_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ts", "\\u", "col_", "=_", "sa_", "._", "Column_", "(_", "sa_", "._", "Date", "Time_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "float", "\\u", "col_", "=_", "sa_", "._", "Column_", "(_", "sa_", "._", "Float_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "Base_", "._", "metadata_", "._", "create", "\\u", "all_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fake", "\\u", "cursor_", "._", "execute_", "._", "assert", "\\u", "call", "ed", "\\u", "with_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'\\\\", "n", "CREATE", " ", "TAB", "LE", " ", "users", " ", "(\\\\", "n", "\\\\", "tstr", "ing", "\\u", "col", " ", "STRING", ",", " ", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'\\\\", "n", "\\\\", "tun", "ico", "de", "\\u", "col", " ", "STRING", ",", " ", "\\\\", "n", "\\\\", "ttext", "\\u", "col", " ", "STRING", ",", " ", "\\\\", "n", "\\\\", "tint", "\\u", "col", " ", "INT", ",", " ", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'\\\\", "n", "\\\\", "tlo", "ng", "\\u", "col", " ", "LONG", ",", " ", "\\\\", "n", "\\\\", "tbo", "ol", "\\u", "col", " ", "BOOLEAN", ",", " ", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'\\\\", "n", "\\\\", "tsh", "ort", "\\u", "col", " ", "SHORT", ",", " ", "\\\\", "n", "\\\\", "tts", "\\u", "col", " ", "TIMES", "TAM", "P", ",", " ", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'\\\\", "n", "\\\\", "tfl", "oat", "\\u", "col", " ", "FLOAT", ",", " ", "\\\\", "n", "\\\\", "t", "PRIMA", "RY", " ", "KEY", " ", "(", "string", "\\u", "col", ")\\\\", "n", ")\\\\", "n", "\\\\", "n", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Creat", "e", "Table", "Test_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "with", "\\u", "obj", "\\u", "column_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "class_", "Du", "mm", "y", "Table_", "(_", "self_", "._", "Base_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u\\u", "tablename\\u\\u_", "=_", "'", "dummy", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pk_", "=_", "sa_", "._", "Column_", "(_", "sa_", "._", "String_", ",_", "primary", "\\u", "key_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "obj", "\\u", "col_", "=_", "sa_", "._", "Column_", "(_", "Object_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "Base_", "._", "metadata_", "._", "create", "\\u", "all_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fake", "\\u", "cursor_", "._", "execute_", "._", "assert", "\\u", "call", "ed", "\\u", "with_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'\\\\", "n", "CREATE", " ", "TAB", "LE", " ", "dummy", " ", "(\\\\", "n", "\\\\", "tp", "k", " ", "STRING", ",", " ", "\\\\", "n", "\\\\", "tob", "j", "\\u", "col", " ", "OBJ", "ECT", ",", " ", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'\\\\", "n", "\\\\", "t", "PRIMA", "RY", " ", "KEY", " ", "(", "pk", ")\\\\", "n", ")\\\\", "n", "\\\\", "n", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Creat", "e", "Table", "Test_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "with", "\\u", "clustere", "d\\u", "by_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "class_", "Du", "mm", "y", "Table_", "(_", "self_", "._", "Base_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u\\u", "tablename\\u\\u_", "=_", "'", "t", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u", "table", "\\u", "args\\u\\u_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "crate", "\\u", "clustere", "d\\u", "by", "'_", ":_", "'", "p", "'_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pk_", "=_", "sa_", "._", "Column_", "(_", "sa_", "._", "String_", ",_", "primary", "\\u", "key_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "p_", "=_", "sa_", "._", "Column_", "(_", "sa_", "._", "String_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "Base_", "._", "metadata_", "._", "create", "\\u", "all_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fake", "\\u", "cursor_", "._", "execute_", "._", "assert", "\\u", "call", "ed", "\\u", "with_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'\\\\", "n", "CREATE", " ", "TAB", "LE", " ", "t", " ", "(\\\\", "n", "\\\\", "t", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'", "pk", " ", "STRING", ",", " ", "\\\\", "n", "\\\\", "t", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'", "p", " ", "STRING", ",", " ", "\\\\", "n", "\\\\", "t", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'", "PRIMA", "RY", " ", "KEY", " ", "(", "pk", ")\\\\", "n", "'_", "\\u\\u\\uNL\\u\\u\\u_", "')", " ", "CLUSTER", "ED", " ", "BY", " ", "(", "p", ")\\\\", "n", "\\\\", "n", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Creat", "e", "Table", "Test_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "with", "\\u", "partitione", "d\\u", "by_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "class_", "Du", "mm", "y", "Table_", "(_", "self_", "._", "Base_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u\\u", "tablename\\u\\u_", "=_", "'", "t", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u", "table", "\\u", "args\\u\\u_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "crate", "\\u", "partitione", "d\\u", "by", "'_", ":_", "'", "p", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "invalid", "\\u", "option", "'_", ":_", "1_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pk_", "=_", "sa_", "._", "Column_", "(_", "sa_", "._", "String_", ",_", "primary", "\\u", "key_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "p_", "=_", "sa_", "._", "Column_", "(_", "sa_", "._", "String_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "Base_", "._", "metadata_", "._", "create", "\\u", "all_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fake", "\\u", "cursor_", "._", "execute_", "._", "assert", "\\u", "call", "ed", "\\u", "with_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'\\\\", "n", "CREATE", " ", "TAB", "LE", " ", "t", " ", "(\\\\", "n", "\\\\", "t", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'", "pk", " ", "STRING", ",", " ", "\\\\", "n", "\\\\", "t", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'", "p", " ", "STRING", ",", " ", "\\\\", "n", "\\\\", "t", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'", "PRIMA", "RY", " ", "KEY", " ", "(", "pk", ")\\\\", "n", "'_", "\\u\\u\\uNL\\u\\u\\u_", "')", " ", "PARTITION", "ED", " ", "BY", " ", "(", "p", ")\\\\", "n", "\\\\", "n", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Creat", "e", "Table", "Test_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "with", "\\u", "number", "\\u", "of", "\\u", "shard", "s", "\\u", "and", "\\u", "replicas_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "class_", "Du", "mm", "y", "Table_", "(_", "self_", "._", "Base_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u\\u", "tablename\\u\\u_", "=_", "'", "t", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u", "table", "\\u", "args\\u\\u_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "crate", "\\u", "number", "\\u", "of", "\\u", "replica", "s", "'_", ":_", "'", "2", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "crate", "\\u", "number", "\\u", "of", "\\u", "shard", "s", "'_", ":_", "3_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pk_", "=_", "sa_", "._", "Column_", "(_", "sa_", "._", "String_", ",_", "primary", "\\u", "key_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "Base_", "._", "metadata_", "._", "create", "\\u", "all_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fake", "\\u", "cursor_", "._", "execute_", "._", "assert", "\\u", "call", "ed", "\\u", "with_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'\\\\", "n", "CREATE", " ", "TAB", "LE", " ", "t", " ", "(\\\\", "n", "\\\\", "t", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'", "pk", " ", "STRING", ",", " ", "\\\\", "n", "\\\\", "t", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'", "PRIMA", "RY", " ", "KEY", " ", "(", "pk", ")\\\\", "n", "'_", "\\u\\u\\uNL\\u\\u\\u_", "')", " ", "CLUSTER", "ED", " ", "INT", "O", " ", "3", " ", "SHAR", "DS", " ", "WITH", " ", "(", "NUMB", "ER", "\\u", "OF", "\\u", "REPLICA", "S", " ", "=", " ", "2", ")\\\\", "n", "\\\\", "n", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Creat", "e", "Table", "Test_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "with", "\\u", "clustere", "d\\u", "by", "\\u", "and", "\\u", "number", "\\u", "of", "\\u", "shards_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "class_", "Du", "mm", "y", "Table_", "(_", "self_", "._", "Base_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u\\u", "tablename\\u\\u_", "=_", "'", "t", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u", "table", "\\u", "args\\u\\u_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "crate", "\\u", "clustere", "d\\u", "by", "'_", ":_", "'", "p", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "crate", "\\u", "number", "\\u", "of", "\\u", "shard", "s", "'_", ":_", "3_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pk_", "=_", "sa_", "._", "Column_", "(_", "sa_", "._", "String_", ",_", "primary", "\\u", "key_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "p_", "=_", "sa_", "._", "Column_", "(_", "sa_", "._", "String_", ",_", "primary", "\\u", "key_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "Base_", "._", "metadata_", "._", "create", "\\u", "all_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fake", "\\u", "cursor_", "._", "execute_", "._", "assert", "\\u", "call", "ed", "\\u", "with_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'\\\\", "n", "CREATE", " ", "TAB", "LE", " ", "t", " ", "(\\\\", "n", "\\\\", "t", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'", "pk", " ", "STRING", ",", " ", "\\\\", "n", "\\\\", "t", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'", "p", " ", "STRING", ",", " ", "\\\\", "n", "\\\\", "t", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'", "PRIMA", "RY", " ", "KEY", " ", "(", "pk", ",", " ", "p", ")\\\\", "n", "'_", "\\u\\u\\uNL\\u\\u\\u_", "')", " ", "CLUSTER", "ED", " ", "BY", " ", "(", "p", ")", " ", "INT", "O", " ", "3", " ", "SHAR", "DS", "\\\\", "n", "\\\\", "n", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", ")_", ")_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2,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unused import
karan/HackerNewsAPI/tests/test_leaders.py
[ { "content": "import unittest\n\nfrom hn import HN, Story\nfrom hn import utils, constants\n\nfrom test_utils import get_content, PRESETS_DIR\n\nimport httpretty\n\n\n\n\nif __name__ == '__main__':\n unittest.main()\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class TestGetLeaders(unittest.TestCase):", "metadata": "root.TestGetLeaders", "header": "['module', '___EOS___']", "index": 10 }, { "content": " def setUp(self):\n # check py version\n # #self.PY2 = sys.version_info[0] == 2\n self.hn = HN()\n httpretty.HTTPretty.enable()\n httpretty.register_uri(httpretty.GET, '%s/%s' % (constants.BASE_URL,\n 'leaders'),\n body=get_content('leaders.html'))\n\n def tearDown(self):\n httpretty.HTTPretty.disable()\n\n def test_get_leaders_with_no_parameter(self):\n result = [leader for leader in self.hn.get_leaders()]\n self.assertEqual(len(result), 10)\n\n def test_get_leaders_with_parameter(self):\n value = 50\n result = [leader for leader in self.hn.get_leaders(value)]\n self.assertEqual(len(result), value)", "metadata": "root.TestGetLeaders.setUp", "header": "['class', 'TestGetLeaders', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 11 } ]
[ { "span": "from hn import HN, Story", "start_line": 2, "start_column": 0, "end_line": 2, "end_column": 24 }, { "span": "from hn import utils, constants", "start_line": 3, "start_column": 0, "end_line": 3, "end_column": 31 }, { "span": "from test_utils import get_content, PRESETS_DIR", "start_line": 5, "start_column": 0, "end_line": 5, "end_column": 47 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "import_", "unittest_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "hn", "_", "import_", "HN", "_", ",_", "Stor", "y_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "hn", "_", "import_", "utils_", ",_", "constants_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "test\\u", "utils_", "import_", "get", "\\u", "content_", ",_", "PRESE", "TS", "\\u", "DIR_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "httpretty_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "\\u\\u", "name\\u\\u_", "==_", "'\\u", "\\u", "main", "\\u\\u'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "unittest_", "._", "main_", "(_", ")_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Test", "Get", "Leader", "s_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Get", "Leader", "s_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "set", "Up_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "check", " ", "py", " ", "version_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "#", "self", ".", "PY", "2", " ", "=", " ", "sys", ".", "version", "\\u", "info", "[", "0", "]", " ", "==", " ", "2_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "hn", "_", "=_", "HN", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "httpretty_", "._", "HTTP", "rett", "y_", "._", "enable_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "httpretty_", "._", "register", "\\u", "uri_", "(_", "httpretty_", "._", "GET_", ",_", "'%", "s", "/", "%", "s", "'_", "%_", "(_", "constants_", "._", "BASE", "\\u", "URL_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "leader", "s", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "body_", "=_", "get", "\\u", "content_", "(_", "'", "leader", "s", ".", "html", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "tear", "Down_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "httpretty_", "._", "HTTP", "rett", "y_", "._", "disable_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "get", "\\u", "leader", "s", "\\u", "with", "\\u", "no", "\\u", "parameter_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "=_", "[_", "leader_", "for_", "leader_", "in_", "self_", "._", "hn", "_", "._", "get", "\\u", "leader", "s_", "(_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "result_", ")_", ",_", "10_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "get", "\\u", "leader", "s", "\\u", "with", "\\u", "parameter_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "value_", "=_", "50_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "[_", "leader_", "for_", "leader_", "in_", "self_", "._", "hn", "_", "._", "get", "\\u", "leader", "s_", "(_", "value_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "result_", ")_", ",_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused local variable
mgottein/github-doc/wikibuilder.py
[ { "content": " def addToHomePage(self, javadoc, hierarchy):\n name = javadoc.sourceLine.name\n if hierarchy == 0:\n type = 'Class'\n elif hierarchy == 1:\n type = 'Method'\n else:\n type = 'Field'\n text = '\\n{}* {}'.format(' ' * hierarchy, link(name, name))\n self.appendTitlePage('HOME', text)\n self.appendTitlePage('_SIDEBAR', text)", "metadata": "root.Wiki.addToHomePage", "header": "['class', 'Wiki', ':', '___EOS___']", "index": 101 } ]
[ { "span": "type ", "start_line": 104, "start_column": 12, "end_line": 104, "end_column": 16 }, { "span": "type ", "start_line": 106, "start_column": 12, "end_line": 106, "end_column": 16 }, { "span": "type ", "start_line": 108, "start_column": 12, "end_line": 108, "end_column": 16 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "Wiki", "_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "add", "To", "Home", "Page_", "(_", "self_", ",_", "java", "doc_", ",_", "hierarchy_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "name_", "=_", "java", "doc_", "._", "source", "Line_", "._", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "hierarchy_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "type_", "=_", "'", "Class", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "hierarchy_", "==_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "type_", "=_", "'", "Meth", "od", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "type_", "=_", "'", "Field", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "text_", "=_", "'\\\\", "n", "{}", "*", " ", "{}'_", "._", "format_", "(_", "'", " ", "'_", "*_", "hierarchy_", ",_", "link_", "(_", "name_", ",_", "name_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "append", "Tit", "le", "Page_", "(_", "'", "HOM", "E", "'_", ",_", "text_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "append", "Tit", "le", "Page_", "(_", "'\\u", "SIDE", "BAR", "'_", ",_", "text_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Variable defined multiple times
acabin/docphp/docphp.py
[ { "content": " def run(self, edit, event=None, at_point=False):\n global currentView\n view = self.view\n window = view.window()\n currentView = view\n if not languageExists():\n return\n tar = getTarHandler()\n symbol = None\n\n if at_point:\n symbol = view.substr(view.word(view.sel()[0]))\n\n files = list(docphp_languages[language][\"symbolList\"].keys())\n files.sort()\n\n def show(index):\n if index != -1:\n currentView.run_command('docphp_show_definition', {\"symbol\": files[index], \"force\": True})\n\n selected_index = -1\n if event:\n pt = view.window_to_text((event[\"x\"], event[\"y\"]))\n symbol, locations = sublime_symbol.symbol_at_point(view, pt)\n for prefix in ['function.', 'book.', 'class.']:\n try:\n selected_index = files.index(prefix + symbol)\n break\n except ValueError:\n pass\n currentView.window().show_quick_panel(files, show, selected_index=selected_index)", "metadata": "root.DocphpSearchCommand.run", "header": "['class', 'DocphpSearchCommand', '(', 'sublime_plugin', '.', 'TextCommand', ')', ':', '___EOS___']", "index": 725 } ]
[ { "span": "symbol ", "start_line": 736, "start_column": 12, "end_line": 736, "end_column": 18 } ]
[ { "span": "symbol,", "start_line": 748, "start_column": 12, "end_line": 748, "end_column": 18 } ]
1
true
[ "[CLS]_", "Variable_", "defined_", "multiple_", "times_", "[SEP]_", "class_", "Doc", "php", "Sear", "ch", "Command_", "(_", "sublim", "e\\u", "plugin_", "._", "Text", "Command_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "run_", "(_", "self_", ",_", "edit_", ",_", "event_", "=_", "None_", ",_", "at", "\\u", "point_", "=_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "global_", "current", "View_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "view_", "=_", "self_", "._", "view_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "window_", "=_", "view_", "._", "window_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "current", "View_", "=_", "view_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "language", "Exists_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "tar_", "=_", "get", "Tar", "Handler_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "symbol_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "at", "\\u", "point_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "symbol_", "=_", "view_", "._", "substr_", "(_", "view_", "._", "word_", "(_", "view_", "._", "sel_", "(_", ")_", "[_", "0_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "files_", "=_", "list_", "(_", "doc", "php", "\\u", "languages_", "[_", "language_", "]_", "[_", "\"", "symbol", "List", "\"_", "]_", "._", "keys_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "files_", "._", "sort_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "show_", "(_", "index_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "index_", "!=_", "-_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "current", "View_", "._", "run", "\\u", "command_", "(_", "'", "doc", "php", "\\u", "show", "\\u", "definit", "ion", "'_", ",_", "{_", "\"", "symbol", "\"_", ":_", "files_", "[_", "index_", "]_", ",_", "\"", "force", "\"_", ":_", "True_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "selecte", "d\\u", "index_", "=_", "-_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "event_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pt_", "=_", "view_", "._", "window", "\\u", "to", "\\u", "text_", "(_", "(_", "event_", "[_", "\"", "x", "\"_", "]_", ",_", "event_", "[_", "\"", "y", "\"_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "symbol_", ",_", "locations_", "=_", "sublim", "e\\u", "symbol_", "._", "symbol", "\\u", "at", "\\u", "point_", "(_", "view_", ",_", "pt_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "prefix_", "in_", "[_", "'", "function", ".'_", ",_", "'", "book", ".'_", ",_", "'", "class", ".'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "selecte", "d\\u", "index_", "=_", "files_", "._", "index_", "(_", "prefix_", "+_", "symbol_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Value", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "current", "View_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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Variable defined multiple times
StackStorm/st2/st2common/st2common/models/api/trigger.py
[ { "content": " @classmethod\n def to_model(cls, trigger):\n name = getattr(trigger, 'name', None)\n description = getattr(trigger, 'description', None)\n pack = getattr(trigger, 'pack', None)\n _type = getattr(trigger, 'type', None)\n parameters = getattr(trigger, 'parameters', {})\n\n if _type and not parameters:\n trigger_type_ref = ResourceReference.from_string_reference(_type)\n name = trigger_type_ref.name\n\n if hasattr(trigger, 'name') and trigger.name:\n name = trigger.name\n else:\n # assign a name if none is provided.\n name = str(uuid.uuid4())\n\n model = cls.model(name=name, description=description, pack=pack, type=_type,\n parameters=parameters)\n return model", "metadata": "root.TriggerAPI.to_model", "header": "['class', 'TriggerAPI', '(', 'BaseAPI', ')', ':', '___EOS___']", "index": 132 } ]
[ { "span": "name ", "start_line": 134, "start_column": 8, "end_line": 134, "end_column": 12 }, { "span": "name ", "start_line": 142, "start_column": 12, "end_line": 142, "end_column": 16 } ]
[ { "span": "name ", "start_line": 145, "start_column": 12, "end_line": 145, "end_column": 16 }, { "span": "name ", "start_line": 148, "start_column": 12, "end_line": 148, "end_column": 16 } ]
1
true
[ "[CLS]_", "Variable_", "defined_", "multiple_", "times_", "[SEP]_", "class_", "Trigger", "API_", "(_", "Base", "API_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "classmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "to", "\\u", "model_", "(_", "cls_", ",_", "trigger_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "name_", "=_", "getattr_", "(_", "trigger_", ",_", "'", "name", "'_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "description_", "=_", "getattr_", "(_", "trigger_", ",_", "'", "description", "'_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pack_", "=_", "getattr_", "(_", "trigger_", ",_", "'", "pack", "'_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "type_", "=_", "getattr_", "(_", "trigger_", ",_", "'", "type", "'_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parameters_", "=_", "getattr_", "(_", "trigger_", ",_", "'", "parameter", "s", "'_", ",_", "{_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "\\u", "type_", "and_", "not_", "parameters_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "trigger", "\\u", "type", "\\u", "ref_", "=_", "Reso", "urc", "e", "Reference_", "._", "from", "\\u", "string", "\\u", "reference_", "(_", "\\u", "type_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "name_", "=_", "trigger", "\\u", "type", "\\u", "ref_", "._", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "hasattr_", "(_", "trigger_", ",_", "'", "name", "'_", ")_", "and_", "trigger_", "._", "name_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "name_", "=_", "trigger_", "._", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "assign", " ", "a", " ", "name", " ", "if", " ", "none", " ", "is", " ", "provided", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "name_", "=_", "str_", "(_", "uuid_", "._", "uuid4_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "model_", "=_", "cls_", "._", "model_", "(_", "name_", "=_", "name_", ",_", "description_", "=_", "description_", ",_", "pack_", "=_", "pack_", ",_", "type_", "=_", "\\u", "type_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "parameters_", "=_", "parameters_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "model_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Except block handles 'BaseException'
NYTimes/nytcampfin/test.py
[ { "content": "import os\nimport unittest\nimport requests\nimport requests_cache\n\nfrom nytcampfin import NytCampfin, NytCampfinError, NytNotFoundError\n\nCURRENT_CYCLE = 2012\ntry:\n API_KEY = os.environ['NYT_CAMPFIN_API_KEY']\nexcept:\n print \"Please set your API Key as an environment variable\"\n \n\n \n\n\n\n \n\n\n\n \n\nif __name__ == \"__main__\":\n unittest.main()", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[ { "span": "except:", "start_line": 10, "start_column": 0, "end_line": 10, "end_column": 7 } ]
[]
1
true
[ "[CLS]_", "Except", "_", "block_", "handles_", "'", "Base", "Except", "ion", "'_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "unittest_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "requests_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "request", "s", "\\u", "cache_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "ny", "tca", "mpf", "in_", "import_", "Ny", "t", "Camp", "fin_", ",_", "Ny", "t", "Camp", "fin", "Error_", ",_", "Ny", "t", "Not", "Foun", "d", "Error_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "CURREN", "T", "\\u", "CYCLE", "_", "=_", "2012_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "API", "\\u", "KEY_", "=_", "os_", "._", "environ_", "[_", "'", "NY", "T", "\\u", "CAM", "PF", "IN", "\\u", "API", "\\u", "KEY", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "\"", "Ple", "ase", " ", "set", " ", "your", " ", "API", " ", "Key", " ", "as", " ", "an", " ", "environ", "ment", " ", "variab", "le", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "\\u\\u", "name\\u\\u_", "==_", "\"\\u\\u", "main", "\\u\\u\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "unittest_", "._", "main_", "(_", ")_" ]
[ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Variable defined multiple times
saltstack/salt/salt/modules/debian_ip.py
[ { "content": "def _parse_interfaces(interface_files=None):\n '''\n Parse /etc/network/interfaces and return current configured interfaces\n '''\n if interface_files is None:\n interface_files = []\n # Add this later.\n if os.path.exists(_DEB_NETWORK_DIR):\n interface_files += ['{0}/{1}'.format(_DEB_NETWORK_DIR, dir) for dir in os.listdir(_DEB_NETWORK_DIR)]\n\n if os.path.isfile(_DEB_NETWORK_FILE):\n interface_files.insert(0, _DEB_NETWORK_FILE)\n\n adapters = salt.utils.odict.OrderedDict()\n method = -1\n\n for interface_file in interface_files:\n with salt.utils.fopen(interface_file) as interfaces:\n for line in interfaces:\n # Identify the clauses by the first word of each line.\n # Go to the next line if the current line is a comment\n # or all spaces.\n if line.lstrip().startswith('#') or line.isspace():\n continue\n # Parse the iface clause\n if line.startswith('iface'):\n sline = line.split()\n\n if len(sline) != 4:\n msg = 'Interface file malformed: {0}.'\n msg = msg.format(sline)\n log.error(msg)\n raise AttributeError(msg)\n\n iface_name = sline[1]\n addrfam = sline[2]\n method = sline[3]\n\n # Create item in dict, if not already there\n if iface_name not in adapters:\n adapters[iface_name] = salt.utils.odict.OrderedDict()\n\n # Create item in dict, if not already there\n if 'data' not in adapters[iface_name]:\n adapters[iface_name]['data'] = salt.utils.odict.OrderedDict()\n\n if addrfam not in adapters[iface_name]['data']:\n adapters[iface_name]['data'][addrfam] = salt.utils.odict.OrderedDict()\n\n iface_dict = adapters[iface_name]['data'][addrfam]\n\n iface_dict['addrfam'] = addrfam\n iface_dict['proto'] = method\n iface_dict['filename'] = interface_file\n\n # Parse the detail clauses.\n elif line[0].isspace():\n sline = line.split()\n\n # conf file attr: dns-nameservers\n # salt states.network attr: dns\n\n attr, valuestr = line.rstrip().split(None, 1)\n if _attrmaps_contain_attr(attr):\n if '-' in attr:\n attrname = attr.replace('-', '_')\n else:\n attrname = attr\n (valid, value, errmsg) = _validate_interface_option(\n attr, valuestr, addrfam)\n iface_dict[attrname] = value\n\n elif attr in _REV_ETHTOOL_CONFIG_OPTS:\n if 'ethtool' not in iface_dict:\n iface_dict['ethtool'] = salt.utils.odict.OrderedDict()\n iface_dict['ethtool'][attr] = valuestr\n\n elif attr.startswith('bond'):\n opt = re.split(r'[_-]', attr, maxsplit=1)[1]\n if 'bonding' not in iface_dict:\n iface_dict['bonding'] = salt.utils.odict.OrderedDict()\n iface_dict['bonding'][opt] = valuestr\n\n elif attr.startswith('bridge'):\n opt = re.split(r'[_-]', attr, maxsplit=1)[1]\n if 'bridging' not in iface_dict:\n iface_dict['bridging'] = salt.utils.odict.OrderedDict()\n iface_dict['bridging'][opt] = valuestr\n\n elif attr in ['up', 'pre-up', 'post-up',\n 'down', 'pre-down', 'post-down']:\n cmd = valuestr\n cmd_key = '{0}_cmds'.format(re.sub('-', '_', attr))\n if cmd_key not in iface_dict:\n iface_dict[cmd_key] = []\n iface_dict[cmd_key].append(cmd)\n\n elif line.startswith('auto'):\n for word in line.split()[1:]:\n if word not in adapters:\n adapters[word] = salt.utils.odict.OrderedDict()\n adapters[word]['enabled'] = True\n\n elif line.startswith('allow-hotplug'):\n for word in line.split()[1:]:\n if word not in adapters:\n adapters[word] = salt.utils.odict.OrderedDict()\n adapters[word]['hotplug'] = True\n\n elif line.startswith('source'):\n if 'source' not in adapters:\n adapters['source'] = salt.utils.odict.OrderedDict()\n\n # Create item in dict, if not already there\n if 'data' not in adapters['source']:\n adapters['source']['data'] = salt.utils.odict.OrderedDict()\n adapters['source']['data']['sources'] = []\n adapters['source']['data']['sources'].append(line.split()[1])\n\n # Return a sorted list of the keys for bond, bridge and ethtool options to\n # ensure a consistent order\n for iface_name in adapters:\n if iface_name == 'source':\n continue\n if 'data' not in adapters[iface_name]:\n msg = 'Interface file malformed for interface: {0}.'.format(iface_name)\n log.error(msg)\n adapters.pop(iface_name)\n continue\n for opt in ['ethtool', 'bonding', 'bridging']:\n if 'inet' in adapters[iface_name]['data']:\n if opt in adapters[iface_name]['data']['inet']:\n opt_keys = sorted(adapters[iface_name]['data']['inet'][opt].keys())\n adapters[iface_name]['data']['inet'][opt + '_keys'] = opt_keys\n\n return adapters", "metadata": "root._parse_interfaces", "header": "['module', '___EOS___']", "index": 539 } ]
[ { "span": "method ", "start_line": 553, "start_column": 4, "end_line": 553, "end_column": 10 }, { "span": "sline ", "start_line": 596, "start_column": 20, "end_line": 596, "end_column": 25 } ]
[ { "span": "sline ", "start_line": 565, "start_column": 20, "end_line": 565, "end_column": 25 }, { "span": "method ", "start_line": 575, "start_column": 20, "end_line": 575, "end_column": 26 } ]
1
true
[ "[CLS]_", "Variable_", "defined_", "multiple_", "times_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "parse", "\\u", "interfaces_", "(_", "interface", "\\u", "files_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "\\", "10", ";", " ", " ", " ", " ", "Pars", "e", " ", "/", "etc", "/", "network", "/", "interface", "s", " ", "and", " ", "return", " ", "current", " ", "configur", "ed", " ", "interface", "s", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "interface", "\\u", "files_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "interface", "\\u", "files_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Add", " ", "this", " ", "late", "r", "._", "\\u\\u\\uNL\\u\\u\\u_", "if_", "os_", "._", "path_", "._", "exists_", "(_", "\\u", "DEB", "\\u", "NET", "WORK", "\\u", "DIR_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "interface", "\\u", "files_", "+=_", "[_", "'{", "0", "}/", "{", "1", "}'_", "._", "format_", "(_", "\\u", "DEB", "\\u", "NET", "WORK", "\\u", "DIR_", ",_", "dir_", ")_", "for_", "dir_", "in_", "os_", "._", "listdir_", "(_", "\\u", "DEB", "\\u", "NET", "WORK", "\\u", "DIR_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "os_", "._", "path_", "._", "isfile_", "(_", "\\u", "DEB", "\\u", "NET", "WORK", "\\u", "FILE_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "interface", "\\u", "files_", "._", "insert_", "(_", "0_", ",_", "\\u", "DEB", "\\u", "NET", "WORK", "\\u", "FILE_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "adapters_", "=_", "salt_", "._", "utils_", "._", "odict_", "._", "Order", "ed", "Dict_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "method_", "=_", "-_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "interface", "\\u", "file_", "in_", "interface", "\\u", "files_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "with_", "salt_", "._", "utils_", "._", "fop", "en_", "(_", "interface", "\\u", "file_", ")_", "as_", "interfaces_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "line_", "in_", "interfaces_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Identif", "y", " ", "the", " ", "clause", "s", " ", "by", " ", "the", " ", "first", " ", "word", " ", "of", " ", "each", " ", "line", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Go", " ", "to", " ", "the", " ", "next", " ", "line", " ", "if", " ", "the", " ", "current", " ", "line", " ", "is", " ", "a", " ", "comment_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "or", " ", "all", " ", "space", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "line_", "._", "lstrip_", "(_", ")_", "._", "startswith_", "(_", "'#'_", ")_", "or_", "line_", "._", "isspace", "_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Pars", "e", " ", "the", " ", "ifa", "ce", " ", "clause_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "line_", "._", "startswith_", "(_", "'", "ifa", "ce", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "sline", "_", "=_", "line_", "._", "split_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "len_", "(_", "sline", "_", ")_", "!=_", "4_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "msg_", "=_", "'", "Interface", " ", "file", " ", "mal", "formed", ":", " ", "{", "0", "}.'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "msg_", "=_", "msg_", "._", "format_", "(_", "sline", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "log_", "._", "error_", "(_", "msg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "Attribute", "Error_", "(_", "msg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "ifa", "ce", "\\u", "name_", "=_", "sline", "_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "addr", "fam", "_", "=_", "sline", "_", "[_", "2_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "method_", "=_", "sline", "_", "[_", "3_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Creat", "e", " ", "item", " ", "in", " ", "dict", ",", " ", "if", " ", "not", " ", "alr", "ead", "y", " ", "there", "_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "ifa", "ce", "\\u", "name_", "not_", "in_", "adapters_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "adapters_", "[_", "ifa", "ce", "\\u", "name_", "]_", "=_", "salt_", "._", "utils_", "._", "odict_", "._", "Order", "ed", "Dict_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Creat", "e", " ", "item", " ", "in", " ", "dict", ",", " ", "if", " ", "not", " ", "alr", "ead", "y", " ", "there", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "'", "data", "'_", "not_", "in_", "adapters_", "[_", "ifa", "ce", "\\u", "name_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "adapters_", "[_", "ifa", "ce", "\\u", "name_", "]_", "[_", "'", "data", "'_", "]_", "=_", "salt_", "._", "utils_", "._", "odict_", "._", "Order", "ed", "Dict_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "addr", "fam", "_", "not_", "in_", "adapters_", "[_", "ifa", "ce", "\\u", "name_", "]_", "[_", "'", "data", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "adapters_", "[_", "ifa", "ce", "\\u", "name_", "]_", "[_", "'", "data", "'_", "]_", "[_", "addr", "fam", "_", "]_", "=_", "salt_", "._", "utils_", "._", "odict_", "._", "Order", "ed", "Dict_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "ifa", "ce", "\\u", "dict_", "=_", "adapters_", "[_", "ifa", "ce", "\\u", "name_", "]_", "[_", "'", "data", "'_", "]_", "[_", "addr", "fam", "_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "ifa", "ce", "\\u", "dict_", "[_", "'", "addr", "fam", "'_", "]_", "=_", "addr", "fam", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ifa", "ce", "\\u", "dict_", "[_", "'", "proto", "'_", "]_", "=_", "method_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ifa", "ce", "\\u", "dict_", "[_", "'", "filename", "'_", "]_", "=_", "interface", "\\u", "file_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Pars", "e", " ", "the", " ", "deta", "il", " ", "clause", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "line_", "[_", "0_", "]_", "._", "isspace", "_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "sline", "_", "=_", "line_", "._", "split_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "conf", " ", "file", " ", "attr", ":", " ", "dns", "-", "nameservers", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "salt", " ", "state", "s", ".", "network", " ", "attr", ":", " ", "dns_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "attr_", ",_", "values", "tr_", "=_", "line_", "._", "rstrip_", "(_", ")_", "._", "split_", "(_", "None_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "\\u", "attr", "maps", "\\u", "contain", "\\u", "attr_", "(_", "attr_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "if_", "'-'_", "in_", "attr_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "attrname_", "=_", "attr_", "._", "replace_", "(_", "'-'_", ",_", "'\\u'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "attrname_", "=_", "attr_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "(_", "valid_", ",_", "value_", ",_", "errmsg_", ")_", "=_", "\\u", "validat", "e\\u", "interface", "\\u", "option_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "attr_", ",_", "values", "tr_", ",_", "addr", "fam", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ifa", "ce", "\\u", "dict_", "[_", "attrname_", "]_", "=_", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "attr_", "in_", "\\u", "REV", "\\u", "ETH", "TOOL", "\\u", "CONFIG", "\\u", "OPTS_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "if_", "'", "eth", "tool", "'_", "not_", "in_", "ifa", "ce", "\\u", "dict_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "ifa", "ce", "\\u", "dict_", "[_", "'", "eth", "tool", "'_", "]_", "=_", "salt_", "._", "utils_", "._", "odict_", "._", "Order", "ed", "Dict_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "ifa", "ce", "\\u", "dict_", "[_", "'", "eth", "tool", "'_", "]_", "[_", "attr_", "]_", "=_", "values", "tr_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "attr_", "._", "startswith_", "(_", "'", "bond", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "opt_", "=_", "re_", "._", "split_", "(_", "r", "'[", "\\u-]", "'_", ",_", "attr_", ",_", "maxsp", "lit_", "=_", "1_", ")_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "'", "bond", "ing", "'_", "not_", "in_", "ifa", "ce", "\\u", "dict_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "ifa", "ce", "\\u", "dict_", "[_", "'", "bond", "ing", "'_", "]_", "=_", "salt_", "._", "utils_", "._", "odict_", "._", "Order", "ed", "Dict_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "ifa", "ce", "\\u", "dict_", "[_", "'", "bond", "ing", "'_", "]_", "[_", "opt_", "]_", "=_", "values", "tr_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "attr_", "._", "startswith_", "(_", "'", "bridge", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "opt_", "=_", "re_", "._", "split_", "(_", "r", "'[", "\\u-]", "'_", ",_", "attr_", ",_", "maxsp", "lit_", "=_", "1_", ")_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "'", "bri", "dg", "ing", "'_", "not_", "in_", "ifa", "ce", "\\u", "dict_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "ifa", "ce", "\\u", "dict_", "[_", "'", "bri", "dg", "ing", "'_", "]_", "=_", "salt_", "._", "utils_", "._", "odict_", "._", "Order", "ed", "Dict_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "ifa", "ce", "\\u", "dict_", "[_", "'", "bri", "dg", "ing", "'_", "]_", "[_", "opt_", "]_", "=_", "values", "tr_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "attr_", "in_", "[_", "'", "up", "'_", ",_", "'", "pre", "-", "up", "'_", ",_", "'", "post", "-", "up", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "down", "'_", ",_", "'", "pre", "-", "down", "'_", ",_", "'", "post", "-", "down", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "cmd_", "=_", "values", "tr_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cmd", "\\u", "key_", "=_", "'{", "0", "}\\u", "cmds", "'_", "._", "format_", "(_", "re_", "._", "sub_", "(_", "'-'_", ",_", "'\\u'_", ",_", "attr_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "cmd", "\\u", "key_", "not_", "in_", "ifa", "ce", "\\u", "dict_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "ifa", "ce", "\\u", "dict_", "[_", "cmd", "\\u", "key_", "]_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "ifa", "ce", "\\u", "dict_", "[_", "cmd", "\\u", "key_", "]_", "._", "append_", "(_", "cmd_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "line_", "._", "startswith_", "(_", "'", "auto", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "for_", "word_", "in_", "line_", "._", "split_", "(_", ")_", "[_", "1_", ":_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "if_", "word_", "not_", "in_", "adapters_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "adapters_", "[_", "word_", "]_", "=_", "salt_", "._", "utils_", "._", "odict_", "._", "Order", "ed", "Dict_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "adapters_", "[_", "word_", "]_", "[_", "'", "enable", "d", "'_", "]_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "line_", "._", "startswith_", "(_", "'", "allow", "-", "hot", "plug", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "for_", "word_", "in_", "line_", "._", "split_", "(_", ")_", "[_", "1_", ":_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "if_", "word_", "not_", "in_", "adapters_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "adapters_", "[_", "word_", "]_", "=_", "salt_", "._", "utils_", "._", "odict_", "._", "Order", "ed", "Dict_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "adapters_", "[_", "word_", "]_", "[_", "'", "hot", "plug", "'_", "]_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "line_", "._", "startswith_", "(_", "'", "source", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "'", "source", "'_", "not_", "in_", "adapters_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "adapters_", "[_", "'", "source", "'_", "]_", "=_", "salt_", "._", "utils_", "._", "odict_", "._", "Order", "ed", "Dict_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Creat", "e", " ", "item", " ", "in", " ", "dict", ",", " ", "if", " ", "not", " ", "alr", "ead", "y", " ", "there", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "'", "data", "'_", "not_", "in_", "adapters_", "[_", "'", "source", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "adapters_", "[_", "'", "source", "'_", "]_", "[_", "'", "data", "'_", "]_", "=_", "salt_", "._", "utils_", "._", "odict_", "._", "Order", "ed", "Dict_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "adapters_", "[_", "'", "source", "'_", "]_", "[_", "'", "data", "'_", "]_", "[_", "'", "source", "s", "'_", "]_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "adapters_", "[_", "'", "source", "'_", "]_", "[_", "'", "data", "'_", "]_", "[_", "'", "source", "s", "'_", "]_", "._", "append_", "(_", "line_", "._", "split_", "(_", ")_", "[_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Return", " ", "a", " ", "sorte", "d", " ", "list", " ", "of", " ", "the", " ", "keys", " ", "for", " ", "bond", ",", " ", "bridge", " ", "and", " ", "eth", "tool", " ", "options", " ", "to_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "ensure", " ", "a", " ", "consistent", " ", "order_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "ifa", "ce", "\\u", "name_", "in_", "adapters_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "ifa", "ce", "\\u", "name_", "==_", "'", "source", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "'", "data", "'_", "not_", "in_", "adapters_", "[_", "ifa", "ce", "\\u", "name_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "msg_", "=_", "'", "Interface", " ", "file", " ", "mal", "formed", " ", "for", " ", "interface", ":", " ", "{", "0", "}.'_", "._", "format_", "(_", "ifa", "ce", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "log_", "._", "error_", "(_", "msg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "adapters_", "._", "pop_", "(_", "ifa", "ce", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "opt_", "in_", "[_", "'", "eth", "tool", "'_", ",_", "'", "bond", "ing", "'_", ",_", "'", "bri", "dg", "ing", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "'", "inet", "'_", "in_", "adapters_", "[_", "ifa", "ce", "\\u", "name_", "]_", "[_", "'", "data", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "opt_", "in_", "adapters_", "[_", "ifa", "ce", "\\u", "name_", "]_", "[_", "'", "data", "'_", "]_", "[_", "'", "inet", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "opt", "\\u", "keys_", "=_", "sorted_", "(_", "adapters_", "[_", "ifa", "ce", "\\u", "name_", "]_", "[_", "'", "data", "'_", "]_", "[_", "'", "inet", "'_", "]_", "[_", "opt_", "]_", "._", "keys_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "adapters_", "[_", "ifa", "ce", "\\u", "name_", "]_", "[_", "'", "data", "'_", "]_", "[_", "'", "inet", "'_", "]_", "[_", "opt_", "+_", "'\\u", "keys", "'_", "]_", "=_", "opt", "\\u", "keys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "adapters_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2, 2, 2,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2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Imprecise assert
kuri65536/python-for-android/python-modules/twisted/twisted/names/test/test_dns.py
[ { "content": " def _equalityTest(self, firstValueOne, secondValueOne, valueTwo):\n \"\"\"\n Assert that C{firstValueOne} is equal to C{secondValueOne} but not\n equal to C{valueOne} and that it defines equality cooperatively with\n other types it doesn't know about.\n \"\"\"\n # This doesn't use assertEqual and assertNotEqual because the exact\n # operator those functions use is not very well defined. The point\n # of these assertions is to check the results of the use of specific\n # operators (precisely to ensure that using different permutations\n # (eg \"x == y\" or \"not (x != y)\") which should yield the same results\n # actually does yield the same result). -exarkun\n self.assertTrue(firstValueOne == firstValueOne)\n self.assertTrue(firstValueOne == secondValueOne)\n self.assertFalse(firstValueOne == valueTwo)\n self.assertFalse(firstValueOne != firstValueOne)\n self.assertFalse(firstValueOne != secondValueOne)\n self.assertTrue(firstValueOne != valueTwo)\n self.assertTrue(firstValueOne == _Equal())\n self.assertFalse(firstValueOne != _Equal())\n self.assertFalse(firstValueOne == _NotEqual())\n self.assertTrue(firstValueOne != _NotEqual())", "metadata": "root.EqualityTests._equalityTest", "header": "['class', 'EqualityTests', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 712 } ]
[ { "span": "self.assertTrue(firstValueOne == firstValueOne)", "start_line": 724, "start_column": 8, "end_line": 724, "end_column": 55 }, { "span": "self.assertTrue(firstValueOne == secondValueOne)", "start_line": 725, "start_column": 8, "end_line": 725, "end_column": 56 }, { "span": "self.assertFalse(firstValueOne == valueTwo)", "start_line": 726, "start_column": 8, "end_line": 726, "end_column": 51 }, { "span": "self.assertFalse(firstValueOne != firstValueOne)", "start_line": 727, "start_column": 8, "end_line": 727, "end_column": 56 }, { "span": "self.assertFalse(firstValueOne != secondValueOne)", "start_line": 728, "start_column": 8, "end_line": 728, "end_column": 57 }, { "span": "self.assertTrue(firstValueOne != valueTwo)", "start_line": 729, "start_column": 8, "end_line": 729, "end_column": 50 }, { "span": "self.assertTrue(firstValueOne == _Equal())", "start_line": 730, "start_column": 8, "end_line": 730, "end_column": 50 }, { "span": "self.assertFalse(firstValueOne != _Equal())", "start_line": 731, "start_column": 8, "end_line": 731, "end_column": 51 }, { "span": "self.assertFalse(firstValueOne == _NotEqual())", "start_line": 732, "start_column": 8, "end_line": 732, "end_column": 54 }, { "span": "self.assertTrue(firstValueOne != _NotEqual())", "start_line": 733, "start_column": 8, "end_line": 733, "end_column": 53 } ]
[]
1
true
[ "[CLS]_", "Imp", "reci", "se_", "assert_", "[SEP]_", "class_", "Equali", "ty", "Tests_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u", "equality", "Test_", "(_", "self_", ",_", "first", "Value", "One_", ",_", "second", "Value", "One_", ",_", "value", "Two_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Assert", " ", "tha", "t", " ", "C", "{", "first", "Value", "One", "}", " ", "is", " ", "equal", " ", "to", " ", "C", "{", "second", "Value", "One", "}", " ", "but", " ", "not", "\\", "10", ";", " ", " ", " ", " ", "equal", " ", "to", " ", "C", "{", "value", "One", "}", " ", "and", " ", "tha", "t", " ", "it", " ", "defin", "es", " ", "equality", " ", "coop", "erat", "ively", " ", "with", "\\", "10", ";", " ", " ", " ", " ", "other", " ", "types", " ", "it", " ", "doe", "sn", "'", "t", " ", "know", " ", "abo", "ut", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Thi", "s", " ", "doe", "sn", "'", "t", " ", "use", " ", "assert", "Equal", " ", "and", " ", "assert", "Not", "Equal", " ", "bec", "aus", "e", " ", "the", " ", "exact_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "opera", "tor", " ", "tho", "se", " ", "function", "s", " ", "use", " ", "is", " ", "not", " ", "very", " ", "well", " ", "defin", "ed", ".", " ", " ", "The", " ", "point_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "of", " ", "these", " ", "assertion", "s", " ", "is", " ", "to", " ", "check", " ", "the", " ", "results", " ", "of", " ", "the", " ", "use", " ", "of", " ", "specific_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "opera", "tors", " ", "(", "precise", "ly", " ", "to", " ", "ensure", " ", "tha", "t", " ", "usi", "ng", " ", "different", " ", "permutations_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "(", "eg", " ", "\"", "x", " ", "==", " ", "y", "\"", " ", "or", " ", "\"", "not", " ", "(", "x", " ", "!=", " ", "y", ")\"", ")", " ", "whi", "ch", " ", "shou", "ld", " ", "yield", " ", "the", " ", "same", " ", "results_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "actual", "ly", " ", "doe", "s", " ", "yield", " ", "the", " ", "same", " ", "result", ").", " ", "-", "exa", "rk", "un_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "first", "Value", "One_", "==_", "first", "Value", "One_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "first", "Value", "One_", "==_", "second", "Value", "One_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "first", "Value", "One_", "==_", "value", "Two_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "first", "Value", "One_", "!=_", "first", "Value", "One_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "first", "Value", "One_", "!=_", "second", "Value", "One_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "first", "Value", "One_", "!=_", "value", "Two_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "first", "Value", "One_", "==_", "\\u", "Equal_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "first", "Value", "One_", "!=_", "\\u", "Equal_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "first", "Value", "One_", "==_", "\\u", "Not", "Equal_", "(_", ")_", ")_", "\\u\\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 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2 ]
Unreachable code
billzorn/mtgencode/scripts/mtg_validate.py
[ { "content": "def main(fname, oname = None, verbose = False, dump = False):\n # may need to set special arguments here\n cards = jdecode.mtg_open_file(fname, verbose=verbose)\n \n do_grams = False\n\n if do_grams:\n rg = {}\n for card in cards:\n g = rare_grams(card, thresh=2, grams=2)\n if len(card.text_words) > 0:\n g = int(1.0 + (float(g) * 100.0 / float(len(card.text_words))))\n if g in rg:\n rg[g] += 1\n else:\n rg[g] = 1\n if g >= 60:\n print g\n print card.format()\n\n tot = 0\n vmax = sum(rg.values())\n pct90 = None\n pct95 = None\n pct99 = None\n for i in sorted(rg):\n print str(i) + ' rare ngrams: ' + str(rg[i])\n tot += rg[i]\n if pct90 is None and tot >= vmax * 0.90:\n pct90 = i\n if pct95 is None and tot >= vmax * 0.95:\n pct95 = i\n if pct99 is None and tot >= vmax * 0.99:\n pct99 = i\n\n print '90% - ' + str(pct90)\n print '95% - ' + str(pct95)\n print '99% - ' + str(pct99)\n\n else:\n ((total_all, total_good, total_bad, total_uncovered), \n values) = process_props(cards, dump=dump)\n\n # summary\n print('-- overall --')\n print(' total : ' + str(total_all))\n print(' good : ' + str(total_good) + ' ' + pct(total_good, total_all))\n print(' bad : ' + str(total_bad) + ' ' + pct(total_bad, total_all))\n print(' uncocoverd: ' + str(total_uncovered) + ' ' + pct(total_uncovered, total_all))\n print('----')\n\n # breakdown\n for prop in props:\n (total, good, bad) = values[prop]\n print(prop + ':')\n print(' total: ' + str(total) + ' ' + pct(total, total_all))\n print(' good : ' + str(good) + ' ' + pct(good, total_all))\n print(' bad : ' + str(bad) + ' ' + pct(bad, total_all))", "metadata": "root.main", "header": "['module', '___EOS___']", "index": 404 } ]
[ { "span": "rg = {}", "start_line": 411, "start_column": 8, "end_line": 411, "end_column": 15 } ]
[]
1
true
[ "[CLS]_", "Unrea", "chab", "le_", "code_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "main_", "(_", "fname_", ",_", "ona", "me_", "=_", "None_", ",_", "verbose_", "=_", "False_", ",_", "dump_", "=_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "may", " ", "need", " ", "to", " ", "set", " ", "special", " ", "argu", "ment", "s", " ", "here_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cards_", "=_", "jd", "ecode", "_", "._", "mt", "g", "\\u", "open", "\\u", "file_", "(_", "fname_", ",_", "verbose_", "=_", "verbose_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "do", "\\u", "grams", "_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "do", "\\u", "grams", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "rg_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "card_", "in_", "cards_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "g_", "=_", "rare", "\\u", "grams", "_", "(_", "card_", ",_", "thresh_", "=_", "2_", ",_", "grams", "_", "=_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "len_", "(_", "card_", "._", "text", "\\u", "words_", ")_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "g_", "=_", "int_", "(_", "1.0_", "+_", "(_", "float_", "(_", "g_", ")_", "*_", "100.0_", "/_", "float_", "(_", "len_", "(_", "card_", "._", "text", "\\u", "words_", ")_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "g_", "in_", "rg_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "rg_", "[_", "g_", "]_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "rg_", "[_", "g_", "]_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "g_", ">=_", "60_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "g_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "card_", "._", "format_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "tot_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "vmax_", "=_", "sum_", "(_", "rg_", "._", "values_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pct", "90_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pct", "95_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pct", "99_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", "in_", "sorted_", "(_", "rg_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "str_", "(_", "i_", ")_", "+_", "'", " ", "rare", " ", "ngram", "s", ":", " ", "'_", "+_", "str_", "(_", "rg_", "[_", "i_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tot_", "+=_", "rg_", "[_", "i_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "pct", "90_", "is_", "None_", "and_", "tot_", ">=_", "vmax_", "*_", "0.90", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pct", "90_", "=_", "i_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "pct", "95_", "is_", "None_", "and_", "tot_", ">=_", "vmax_", "*_", "0.95_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pct", "95_", "=_", "i_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "pct", "99_", "is_", "None_", "and_", "tot_", ">=_", "vmax_", "*_", "0.99_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pct", "99_", "=_", "i_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "print_", "'", "90", "%", " ", "-", " ", "'_", "+_", "str_", "(_", "pct", "90_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "'", "9", "5", "%", " ", "-", " ", "'_", "+_", "str_", "(_", "pct", "95_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "'", "9", "9", "%", " ", "-", " ", "'_", "+_", "str_", "(_", "pct", "99_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "(_", "(_", "total", "\\u", "all_", ",_", "total", "\\u", "good_", ",_", "total", "\\u", "bad_", ",_", "total", "\\u", "unco", "vere", "d_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "values_", ")_", "=_", "process", "\\u", "props_", "(_", "cards_", ",_", "dump_", "=_", "dump_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "summary_", "\\u\\u\\uNL\\u\\u\\u_", "print_", "(_", "'--", " ", "over", "all", " ", "--'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "'", " ", " ", "total", " ", ":", " ", "'_", "+_", "str_", "(_", "total", "\\u", "all_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "'", " ", " ", "good", " ", " ", ":", " ", "'_", "+_", "str_", "(_", "total", "\\u", "good_", ")_", "+_", "'", " ", "'_", "+_", "pct_", "(_", "total", "\\u", "good_", ",_", "total", "\\u", "all_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "'", " ", " ", "bad", " ", " ", " ", ":", " ", "'_", "+_", "str_", "(_", "total", "\\u", "bad_", ")_", "+_", "'", " ", "'_", "+_", "pct_", "(_", "total", "\\u", "bad_", ",_", "total", "\\u", "all_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "'", " ", " ", "unco", "cover", "d", ":", " ", "'_", "+_", "str_", "(_", "total", "\\u", "unco", "vere", "d_", ")_", "+_", "'", " ", "'_", "+_", "pct_", "(_", "total", "\\u", "unco", "vere", "d_", ",_", "total", "\\u", "all_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "'---", "-'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "breakdown", "_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "prop_", "in_", "props_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "(_", "total_", ",_", "good_", ",_", "bad_", ")_", "=_", "values_", "[_", "prop_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "prop_", "+_", "':'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "'", " ", " ", "total", ":", " ", "'_", "+_", "str_", "(_", "total_", ")_", "+_", "'", " ", "'_", "+_", "pct_", "(_", "total_", ",_", "total", "\\u", "all_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "'", " ", " ", "good", " ", ":", " ", "'_", "+_", "str_", "(_", "good_", ")_", "+_", "'", " ", "'_", "+_", "pct_", "(_", "good_", ",_", "total", "\\u", "all_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "'", " ", " ", "bad", " ", " ", ":", " ", "'_", "+_", "str_", "(_", "bad_", ")_", "+_", "'", " ", "'_", "+_", "pct_", "(_", "bad_", ",_", "total", "\\u", "all_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
grantjenks/python-diskcache/tests/test_fanout.py
[ { "content": "\"Test diskcache.fanout.FanoutCache.\"\n\nimport errno\nimport functools as ft\nimport io\nimport mock\nimport nose.tools as nt\nimport os\nimport random\nimport shutil\nimport sqlite3\nimport sys\nimport threading\nimport time\nimport warnings\n\ntry:\n import cPickle as pickle\nexcept:\n import pickle\n\nimport diskcache as dc\n\nwarnings.simplefilter('error')\nwarnings.simplefilter('ignore', category=dc.EmptyDirWarning)\n\nif sys.hexversion < 0x03000000:\n range = xrange\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nif __name__ == '__main__':\n import nose\n nose.runmodule()\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def setup_cache(func):\n @ft.wraps(func)\n def wrapper():\n shutil.rmtree('tmp', ignore_errors=True)\n with dc.FanoutCache('tmp') as cache:\n func(cache)\n shutil.rmtree('tmp', ignore_errors=True)\n return wrapper", "metadata": "root.setup_cache", "header": "['module', '___EOS___']", "index": 29 }, { "content": "@setup_cache\ndef test_init(cache):\n for key, value in dc.DEFAULT_SETTINGS.items():\n assert getattr(cache, key) == value\n\n cache.check()\n\n for key, value in dc.DEFAULT_SETTINGS.items():\n setattr(cache, key, value)\n\n cache.check()", "metadata": "root.test_init", "header": "['module', '___EOS___']", "index": 39 }, { "content": "@setup_cache\ndef test_set_get_delete(cache):\n for value in range(100):\n cache.set(value, value)\n\n cache.check()\n\n for value in range(100):\n assert cache.get(value) == value\n\n cache.check()\n\n for value in range(100):\n assert value in cache\n\n cache.check()\n\n for value in range(100):\n assert cache.delete(value)\n assert cache.delete(100) == False\n\n cache.check()\n\n for value in range(100):\n cache[value] = value\n\n cache.check()\n\n for value in range(100):\n assert cache[value] == value\n\n cache.check()\n\n cache.clear()\n assert len(cache) == 0\n\n cache.check()", "metadata": "root.test_set_get_delete", "header": "['module', '___EOS___']", "index": 52 }, { "content": "def test_operationalerror():\n cache = dc.FanoutCache('tmp', shards=1)\n\n shards = mock.Mock()\n shards.__getitem__ = mock.Mock(side_effect=sqlite3.OperationalError)\n\n object.__setattr__(cache, '_shards', shards)\n\n assert cache.set(0, 0) == False\n assert cache.get(0) == None\n assert (0 in cache) == False\n assert cache.__delitem__(0) == False\n\n shutil.rmtree('tmp')", "metadata": "root.test_operationalerror", "header": "['module', '___EOS___']", "index": 91 }, { "content": "@nt.raises(KeyError)\n@setup_cache\ndef test_getitem_keyerror(cache):\n cache[0]", "metadata": "root.test_getitem_keyerror", "header": "['module', '___EOS___']", "index": 107 }, { "content": "@setup_cache\ndef test_expire(cache):\n cache.cull_limit = 0\n\n for value in range(100):\n cache.set(value, value, expire=0)\n\n assert len(cache) == 100\n\n cache.cull_limit = 10\n \n assert cache.expire() == 100", "metadata": "root.test_expire", "header": "['module', '___EOS___']", "index": 113 }, { "content": "@setup_cache\ndef test_evict(cache):\n colors = ('red', 'blue', 'yellow')\n\n for value in range(90):\n assert cache.set(value, value, tag=colors[value % len(colors)])\n\n assert len(cache) == 90\n assert cache.evict('red') == 30\n assert len(cache) == 60\n assert len(cache.check()) == 0", "metadata": "root.test_evict", "header": "['module', '___EOS___']", "index": 127 }, { "content": "@setup_cache\ndef test_clear(cache):\n for value in range(100):\n cache[value] = value\n assert len(cache) == 100\n assert cache.clear() == 100\n assert len(cache) == 0\n assert len(cache.check()) == 0", "metadata": "root.test_clear", "header": "['module', '___EOS___']", "index": 140 }, { "content": "@setup_cache\ndef test_stats(cache):\n for value in range(100):\n cache[value] = value\n\n assert cache.stats(enable=True) == (0, 0)\n\n for value in range(100):\n cache[value]\n\n for value in range(100, 110):\n cache.get(value)\n\n assert cache.stats(reset=True) == (100, 10)\n assert cache.stats(enable=False) == (0, 0)\n\n for value in range(100):\n cache[value]\n\n for value in range(100, 110):\n cache.get(value)\n\n assert cache.stats() == (0, 0)\n assert len(cache.check()) == 0", "metadata": "root.test_stats", "header": "['module', '___EOS___']", "index": 150 }, { "content": "@setup_cache\ndef test_volume(cache):\n volume = sum(shard.volume() for shard in cache._shards)\n assert volume == cache.volume()", "metadata": "root.test_volume", "header": "['module', '___EOS___']", "index": 176 } ]
[ { "span": "import errno", "start_line": 2, "start_column": 0, "end_line": 2, "end_column": 12 }, { "span": "import io", "start_line": 4, "start_column": 0, "end_line": 4, "end_column": 9 }, { "span": "import os", "start_line": 7, "start_column": 0, "end_line": 7, "end_column": 9 }, { "span": "import random", "start_line": 8, "start_column": 0, "end_line": 8, "end_column": 13 }, { "span": "import threading", "start_line": 12, "start_column": 0, "end_line": 12, "end_column": 16 }, { "span": "import time", "start_line": 13, "start_column": 0, "end_line": 13, "end_column": 11 }, { "span": "import cPickle as pickle", "start_line": 17, "start_column": 4, "end_line": 17, "end_column": 28 }, { "span": "import pickle", "start_line": 19, "start_column": 4, "end_line": 19, "end_column": 17 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\"", "Test", " ", "disk", "cache", ".", "fano", "ut", ".", "Fan", "out", "Cache", ".\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "errno_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "functools_", "as_", "ft_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "io_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "mock_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "nose_", "._", "tools_", "as_", "nt_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "random_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "shutil_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "sqlite3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "threading_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "time_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "warnings_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "c", "Pickle_", "as_", "pickle_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "pickle_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "import_", "disk", "cache_", "as_", "dc_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "warnings_", "._", "simplefilter_", "(_", "'", "error", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "warnings_", "._", "simplefilter_", "(_", "'", "ignore", "'_", ",_", "category_", "=_", "dc_", "._", "Emp", "ty", "Dir", "Warning_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "sys_", "._", "hex", "version_", "<_", "0x03", "000000_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "range_", "=_", "xrange_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "\\u\\u", "name\\u\\u_", "==_", "'\\u", "\\u", "main", "\\u\\u'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "nose_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "nose_", "._", "run", "module_", "(_", ")_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "setup", "\\u", "cache_", "(_", "func_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "@_", "ft_", "._", "wraps_", "(_", "func_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "wrapper_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "shutil_", "._", "rmtree_", "(_", "'", "tmp", "'_", ",_", "ignore", "\\u", "errors_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "dc_", "._", "Fan", "out", "Cache_", "(_", "'", "tmp", "'_", ")_", "as_", "cache_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "func_", "(_", "cache_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "shutil_", "._", "rmtree_", "(_", "'", "tmp", "'_", ",_", "ignore", "\\u", "errors_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "wrapper_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "setup", "\\u", "cache_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "init_", "(_", "cache_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "key_", ",_", "value_", "in_", "dc_", "._", "DEF", "AUL", "T", "\\u", "SETTINGS_", "._", "items_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "assert_", "getattr_", "(_", "cache_", ",_", "key_", ")_", "==_", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "cache_", "._", "check_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "key_", ",_", "value_", "in_", "dc_", "._", "DEF", "AUL", "T", "\\u", "SETTINGS_", "._", "items_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "setattr_", "(_", "cache_", ",_", "key_", ",_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "cache_", "._", "check_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "setup", "\\u", "cache_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "set\\u", "get", "\\u", "delete_", "(_", "cache_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "value_", "in_", "range_", "(_", "100_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cache_", "._", "set_", "(_", "value_", ",_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "cache_", "._", "check_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "value_", "in_", "range_", "(_", "100_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "assert_", "cache_", "._", "get_", "(_", "value_", ")_", "==_", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "cache_", "._", "check_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "value_", "in_", "range_", "(_", "100_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "assert_", "value_", "in_", "cache_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "cache_", "._", "check_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "value_", "in_", "range_", "(_", "100_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "assert_", "cache_", "._", "delete_", "(_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "assert_", "cache_", "._", "delete_", "(_", "100_", ")_", "==_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "cache_", "._", "check_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "value_", "in_", "range_", "(_", "100_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cache_", "[_", "value_", "]_", "=_", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "cache_", "._", "check_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "value_", "in_", "range_", "(_", "100_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "assert_", "cache_", "[_", "value_", "]_", "==_", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "cache_", "._", "check_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "cache_", "._", "clear_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "len_", "(_", "cache_", ")_", "==_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "cache_", "._", "check_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "operati", "onal", "error_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cache_", "=_", "dc_", "._", "Fan", "out", "Cache_", "(_", "'", "tmp", "'_", ",_", "shards_", "=_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "shards_", "=_", "mock_", "._", "Mock_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "shards_", "._", "\\u\\u", "getitem\\u\\u_", "=_", "mock_", "._", "Mock_", "(_", "side", "\\u", "effect_", "=_", "sqlite3_", "._", "Opera", "tion", "al", "Error_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "object_", "._", "\\u\\u", "setattr\\u\\u_", "(_", "cache_", ",_", "'\\u", "shard", "s", "'_", ",_", "shards_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "assert_", "cache_", "._", "set_", "(_", "0_", ",_", "0_", ")_", "==_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "cache_", "._", "get_", "(_", "0_", ")_", "==_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "(_", "0_", "in_", "cache_", ")_", "==_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "cache_", "._", "\\u\\u", "delitem\\u\\u_", "(_", "0_", ")_", "==_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "shutil_", "._", "rmtree_", "(_", "'", "tmp", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "nt_", "._", "raises_", "(_", "Key", "Error_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "setup", "\\u", "cache_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "getitem", "\\u", "key", "error_", "(_", "cache_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cache_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "setup", "\\u", "cache_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "expire_", "(_", "cache_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cache_", "._", "cul", "l\\u", "limit_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "value_", "in_", "range_", "(_", "100_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cache_", "._", "set_", "(_", "value_", ",_", "value_", ",_", "expire_", "=_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "assert_", "len_", "(_", "cache_", ")_", "==_", "100_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "cache_", "._", "cul", "l\\u", "limit_", "=_", "10_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "assert_", "cache_", "._", "expire_", "(_", ")_", "==_", "100_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "setup", "\\u", "cache_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "evi", "ct_", "(_", "cache_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "colors_", "=_", "(_", "'", "red", "'_", ",_", "'", "blue", "'_", ",_", "'", "yell", "ow", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "value_", "in_", "range_", "(_", "90_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "assert_", "cache_", "._", "set_", "(_", "value_", ",_", "value_", ",_", "tag_", "=_", "colors_", "[_", "value_", "%_", "len_", "(_", "colors_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "assert_", "len_", "(_", "cache_", ")_", "==_", "90_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "cache_", "._", "evi", "ct_", "(_", "'", "red", "'_", ")_", "==_", "30_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "len_", "(_", "cache_", ")_", "==_", "60_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "len_", "(_", "cache_", "._", "check_", "(_", ")_", ")_", "==_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "setup", "\\u", "cache_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "clear_", "(_", "cache_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "value_", "in_", "range_", "(_", "100_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cache_", "[_", "value_", "]_", "=_", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "assert_", "len_", "(_", "cache_", ")_", "==_", "100_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "cache_", "._", "clear_", "(_", ")_", "==_", "100_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "len_", "(_", "cache_", ")_", "==_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "len_", "(_", "cache_", "._", "check_", "(_", ")_", ")_", "==_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "setup", "\\u", "cache_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "stats_", "(_", "cache_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "value_", "in_", "range_", "(_", "100_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cache_", "[_", "value_", "]_", "=_", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "assert_", "cache_", "._", "stats_", "(_", "enable_", "=_", "True_", ")_", "==_", "(_", "0_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "value_", "in_", "range_", "(_", "100_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cache_", "[_", "value_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "value_", "in_", "range_", "(_", "100_", ",_", "110_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cache_", "._", "get_", "(_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "assert_", "cache_", "._", "stats_", "(_", "reset_", "=_", "True_", ")_", "==_", "(_", "100_", ",_", "10_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "cache_", "._", "stats_", "(_", "enable_", "=_", "False_", ")_", "==_", "(_", "0_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "value_", "in_", "range_", "(_", "100_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cache_", "[_", "value_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "value_", "in_", "range_", "(_", "100_", ",_", "110_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cache_", "._", "get_", "(_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "assert_", "cache_", "._", "stats_", "(_", ")_", "==_", "(_", "0_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "len_", "(_", "cache_", "._", "check_", "(_", ")_", ")_", "==_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "setup", "\\u", "cache_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "volume_", "(_", "cache_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "volume_", "=_", "sum_", "(_", "shard_", "._", "volume_", "(_", ")_", "for_", "shard_", "in_", "cache_", "._", "\\u", "shards_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "volume_", "==_", "cache_", "._", "volume_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 2, 2, 2, 2, 2, 2, 0, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 2, 0, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 2, 0, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 0, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Except block handles 'BaseException'
CountZer0/PipelineConstructionSet/python/moBu/core/moBuNamespace.py
[ { "content": "\tdef addNamespace(self, node=None, ns='', hier=False):\n\t\t''' adds a namespace\n\t\t\tParams:\n\t\t\t\tnode: node to add to\n\t\t\t\tns: namespace to add\n\t\t\t\thier: process hierarchy or not\n\t\t\tReturns: True/False\n\t\t'''\n\t\tif not node:\n\t\t\tmoBuLogger.error(\"No node passed.\")\n\t\tif not ns:\n\t\t\tmoBuLogger.error(\"No namespace passed.\")\n\t\t\n\t\t# skip if namespace already there\n\t\tif ns in node.LongName:\n\t\t\tmoBuLogger.debug(\"'%s' already in object: '%s'\" % (ns, node.LongName))\n\t\t\treturn False\n\t\t\n\t\ttry:\n\t\t\tif hier:\n\t\t\t\tnode.ProcessNamespaceHierarchy(FBNamespaceAction.kFBConcatNamespace, ns, None, False)\n\t\t\telse:\n\t\t\t\tnode.ProcessObjectNamespace(FBNamespaceAction.kFBConcatNamespace, ns, None, False)\n\t\texcept:\n\t\t\treturn False\n\t\treturn True ", "metadata": "root.MoBuNamespace.addNamespace", "header": "['class', 'MoBuNamespace', '(', 'MoBuCore', ')', ':', '___EOS___']", "index": 21 }, { "content": "\tdef removeAllNamespaces(self, node=None, hier=False):\n\t\t''' removes all namespaces\n\t\t\tParams:\n\t\t\t\tnode: node to remove from\n\t\t\t\thier: process hierarchy or not\n\t\t\tReturns: True/False\n\t\t'''\n\t\tif not node:\n\t\t\tmoBuLogger.error(\"No node passed.\")\n\t\ttry:\n\t\t\tif hier:\n\t\t\t\tnode.ProcessNamespaceHierarchy(FBNamespaceAction.kFBRemoveAllNamespace, \"\")\n\t\t\telse:\n\t\t\t\tnode.ProcessObjectNamespace(FBNamespaceAction.kFBRemoveAllNamespace, \"\")\n\t\texcept:\n\t\t\treturn False\n\t\treturn True", "metadata": "root.MoBuNamespace.removeAllNamespaces", "header": "['class', 'MoBuNamespace', '(', 'MoBuCore', ')', ':', '___EOS___']", "index": 96 }, { "content": "\tdef removeAllNamespacesFromScene(self):\n\t\ttry:\n\t\t\tfor lComp in FBSystem().Scene.Components:\n\t\t\t\t# This function is a recursive function that will go through the whole hierarchy to add or replace the prefix\n\t\t\t\tlComp.ProcessNamespaceHierarchy (FBNamespaceAction.kFBRemoveAllNamespace , '', '', False)\n\t\t\tmoBuLogger.info(\"Removed all namespaces\")\n\t\t\treturn True\n\t\texcept:\n\t\t\tmoBuLogger.info(\"Failed to removed all namespaces\")\n\t\t\treturn False", "metadata": "root.MoBuNamespace.removeAllNamespacesFromScene", "header": "['class', 'MoBuNamespace', '(', 'MoBuCore', ')', ':', '___EOS___']", "index": 114 }, { "content": "\tdef replaceNamespace(self, node=None, nsOrig='', nsReplace='', hier=False):\t\n\t\t''' replaces all namespaces\n\t\t\tParams:\n\t\t\t\tnode: node to replace\n\t\t\t\tnsOrig: namespace to replace\n\t\t\t\tnsReplace: new namespace\n\t\t\t\thier: process hierarchy or not\n\t\t\tReturns: True/False\n\t\t'''\n\t\tif not node:\n\t\t\tmoBuLogger.error(\"No node passed.\")\n\t\tif not nsOrig:\n\t\t\tmoBuLogger.error(\"No namespace passed.\")\n\t\tif not nsReplace:\n\t\t\tmoBuLogger.error(\"No namespace passed.\")\n\t\ttry:\n\t\t\tif hier:\n\t\t\t\tnode.ProcessNamespaceHierarchy(FBNamespaceAction.kFBReplaceNamespace, nsOrig, nsReplace, False)\n\t\t\telse:\n\t\t\t\tnode.ProcessObjectNamespace(FBNamespaceAction.kFBReplaceNamespace, nsOrig, nsReplace, False)\n\t\texcept:\n\t\t\treturn False\n\t\treturn True", "metadata": "root.MoBuNamespace.replaceNamespace", "header": "['class', 'MoBuNamespace', '(', 'MoBuCore', ')', ':', '___EOS___']", "index": 125 } ]
[ { "span": "except:", "start_line": 44, "start_column": 2, "end_line": 44, "end_column": 9 }, { "span": "except:", "start_line": 110, "start_column": 2, "end_line": 110, "end_column": 9 }, { "span": "except:", "start_line": 121, "start_column": 2, "end_line": 121, "end_column": 9 }, { "span": "except:", "start_line": 145, "start_column": 2, "end_line": 145, "end_column": 9 } ]
[]
1
true
[ "[CLS]_", "Except", "_", "block_", "handles_", "'", "Base", "Except", "ion", "'_", "[SEP]_", "class_", "Mo", "Bu", "Namespace_", "(_", "Mo", "Bu", "Core_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "add", "Namespace_", "(_", "self_", ",_", "node_", "=_", "None_", ",_", "ns_", "=_", "''_", ",_", "hier", "_", "=_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "'''", " ", "adds", " ", "a", " ", "namespace", "\\", "10", ";", "\t\t\t", "Param", "s", ":", "\\", "10", ";", "\t\t\t", "\t", "node", ":", " ", "node", " ", "to", " ", "add", " ", "to", "\\", "10", ";", "\t\t\t", "\t", "ns", ":", " ", "namespace", " ", "to", " ", "add", "\\", "10", ";", "\t\t\t", "\t", "hier", ":", " ", "process", " ", "hier", "arch", "y", " ", "or", " ", "not", "\\", "10", ";", "\t\t\t", "Return", "s", ":", " ", "Tru", "e", "/", "Fal", "se", "\\", "10", ";", "\t", "\t", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "node_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "mo", "Bu", "Logger_", "._", "error_", "(_", "\"", "No", " ", "node", " ", "pass", "ed", ".\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "ns_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "mo", "Bu", "Logger_", "._", "error_", "(_", "\"", "No", " ", "namespace", " ", "pass", "ed", ".\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "skip", " ", "if", " ", "namespace", " ", "alr", "ead", "y", " ", "there", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "ns_", "in_", "node_", "._", "Long", "Name_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "mo", "Bu", "Logger_", "._", "debug_", "(_", "\"'", "%", "s", "'", " ", "alr", "ead", "y", " ", "in", " ", "object", ":", " ", "'%", "s", "'\"_", "%_", "(_", "ns_", ",_", "node_", "._", "Long", "Name_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "if_", "hier", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "node_", "._", "Process", "Names", "pace", "Hier", "arch", "y_", "(_", "FB", "Names", "pace", "Action_", "._", "k", "FB", "Concat", "Namespace_", ",_", "ns_", ",_", "None_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "node_", "._", "Process", "Object", "Namespace_", "(_", "FB", "Names", "pace", "Action_", "._", "k", "FB", "Concat", "Namespace_", ",_", "ns_", ",_", "None_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Mo", "Bu", "Namespace_", "(_", "Mo", "Bu", "Core_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "remove", "All", "Names", "paces", "_", "(_", "self_", ",_", "node_", "=_", "None_", ",_", "hier", "_", "=_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "'''", " ", "remove", "s", " ", "all", " ", "namespace", "s", "\\", "10", ";", "\t\t\t", "Param", "s", ":", "\\", "10", ";", "\t\t\t", "\t", "node", ":", " ", "node", " ", "to", " ", "remove", " ", "from", "\\", "10", ";", "\t\t\t", "\t", "hier", ":", " ", "process", " ", "hier", "arch", "y", " ", "or", " ", "not", "\\", "10", ";", "\t\t\t", "Return", "s", ":", " ", "Tru", "e", "/", "Fal", "se", "\\", "10", ";", "\t", "\t", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "node_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "mo", "Bu", "Logger_", "._", "error_", "(_", "\"", "No", " ", "node", " ", "pass", "ed", ".\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "if_", "hier", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "node_", "._", "Process", "Names", "pace", "Hier", "arch", "y_", "(_", "FB", "Names", "pace", "Action_", "._", "k", "FB", "Remove", "All", "Namespace_", ",_", "\"\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "node_", "._", "Process", "Object", "Namespace_", "(_", "FB", "Names", "pace", "Action_", "._", "k", "FB", "Remove", "All", "Namespace_", ",_", "\"\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Mo", "Bu", "Namespace_", "(_", "Mo", "Bu", "Core_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "remove", "All", "Names", "paces", "Fro", "m", "Scene_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "for_", "l", "Comp_", "in_", "FB", "System_", "(_", ")_", "._", "Scene_", "._", "Components_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Thi", "s", " ", "function", " ", "is", " ", "a", " ", "recurs", "ive", " ", "function", " ", "tha", "t", " ", "will", " ", "go", " ", "through", " ", "the", " ", "whole", " ", "hier", "arch", "y", " ", "to", " ", "add", " ", "or", " ", "replace", " ", "the", " ", "prefix_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "l", "Comp_", "._", "Process", "Names", "pace", "Hier", "arch", "y_", "(_", "FB", "Names", "pace", "Action_", "._", "k", "FB", "Remove", "All", "Namespace_", ",_", "''_", ",_", "''_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "mo", "Bu", "Logger_", "._", "info_", "(_", "\"", "Remove", "d", " ", "all", " ", "namespace", "s", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "mo", "Bu", "Logger_", "._", "info_", "(_", "\"", "Fail", "ed", " ", "to", " ", "remove", "d", " ", "all", " ", "namespace", "s", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Mo", "Bu", "Namespace_", "(_", "Mo", "Bu", "Core_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "replace", "Namespace_", "(_", "self_", ",_", "node_", "=_", "None_", ",_", "ns", "Orig", "_", "=_", "''_", ",_", "ns", "Replace", "_", "=_", "''_", ",_", "hier", "_", "=_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "'''", " ", "replace", "s", " ", "all", " ", "namespace", "s", "\\", "10", ";", "\t\t\t", "Param", "s", ":", "\\", "10", ";", "\t\t\t", "\t", "node", ":", " ", "node", " ", "to", " ", "replace", "\\", "10", ";", "\t\t\t", "\t", "ns", "Orig", ":", " ", "namespace", " ", "to", " ", "replace", "\\", "10", ";", "\t\t\t", "\t", "ns", "Replace", ":", " ", "new", " ", "namespace", "\\", "10", ";", "\t\t\t", "\t", "hier", ":", " ", "process", " ", "hier", "arch", "y", " ", "or", " ", "not", "\\", "10", ";", "\t\t\t", "Return", "s", ":", " ", "Tru", "e", "/", "Fal", "se", "\\", "10", ";", "\t", "\t", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "node_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "mo", "Bu", "Logger_", "._", "error_", "(_", "\"", "No", " ", "node", " ", "pass", "ed", ".\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "ns", "Orig", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "mo", "Bu", "Logger_", "._", "error_", "(_", "\"", "No", " ", "namespace", " ", "pass", "ed", ".\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "ns", "Replace", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "mo", "Bu", "Logger_", "._", "error_", "(_", "\"", "No", " ", "namespace", " ", "pass", "ed", ".\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "if_", "hier", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "node_", "._", "Process", "Names", "pace", "Hier", "arch", "y_", "(_", "FB", "Names", "pace", "Action_", "._", "k", "FB", "Replace", "Namespace_", ",_", "ns", "Orig", "_", ",_", "ns", "Replace", "_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "node_", "._", "Process", "Object", "Namespace_", "(_", "FB", "Names", "pace", "Action_", "._", "k", "FB", "Replace", "Namespace_", ",_", "ns", "Orig", "_", ",_", "ns", "Replace", "_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 4, 4, 4, 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 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
First parameter of a method is not named 'self'
sympy/sympy/sympy/polys/domains/mpelements.py
[ { "content": " def __init__(ctx, prec=53, dps=None, tol=None):\n ctx._prec_rounding = [prec, round_nearest]\n\n if dps is None:\n ctx._set_prec(prec)\n else:\n ctx._set_dps(dps)\n\n ctx.mpf = type('RealElement', (RealElement,), {})\n ctx.mpc = type('ComplexElement', (ComplexElement,), {})\n ctx.mpf._ctxdata = [ctx.mpf, new, ctx._prec_rounding]\n ctx.mpc._ctxdata = [ctx.mpc, new, ctx._prec_rounding]\n ctx.mpf.context = ctx\n ctx.mpc.context = ctx\n ctx.constant = type('constant', (_constant,), {})\n ctx.constant._ctxdata = [ctx.mpf, new, ctx._prec_rounding]\n ctx.constant.context = ctx\n\n ctx.types = [ctx.mpf, ctx.mpc, ctx.constant]\n ctx.trap_complex = True\n ctx.pretty = True\n\n if tol is None:\n ctx.tol = ctx._make_tol()\n elif tol is False:\n ctx.tol = fzero\n else:\n ctx.tol = ctx._convert_tol(tol)\n\n ctx.tolerance = ctx.make_mpf(ctx.tol)\n\n if not ctx.tolerance:\n ctx.max_denom = 1000000\n else:\n ctx.max_denom = int(1/ctx.tolerance)\n\n ctx.zero = ctx.make_mpf(fzero)\n ctx.one = ctx.make_mpf(fone)\n ctx.j = ctx.make_mpc((fzero, fone))\n ctx.inf = ctx.make_mpf(finf)\n ctx.ninf = ctx.make_mpf(fninf)\n ctx.nan = ctx.make_mpf(fnan)", "metadata": "root.MPContext.__init__", "header": "['class', 'MPContext', '(', 'PythonMPContext', ')', ':', '___EOS___']", "index": 47 }, { "content": " def _make_tol(ctx):\n hundred = (0, 25, 2, 5)\n eps = (0, MPZ_ONE, 1-ctx.prec, 1)\n return mpf_mul(hundred, eps)", "metadata": "root.MPContext._make_tol", "header": "['class', 'MPContext', '(', 'PythonMPContext', ')', ':', '___EOS___']", "index": 90 }, { "content": " def make_tol(ctx):\n return ctx.make_mpf(ctx._make_tol())", "metadata": "root.MPContext.make_tol", "header": "['class', 'MPContext', '(', 'PythonMPContext', ')', ':', '___EOS___']", "index": 95 }, { "content": " def _convert_tol(ctx, tol):\n if isinstance(tol, int_types):\n return from_int(tol)\n if isinstance(tol, float):\n return from_float(tol)\n if hasattr(tol, \"_mpf_\"):\n return tol._mpf_\n prec, rounding = ctx._prec_rounding\n if isinstance(tol, basestring):\n return from_str(tol, prec, rounding)\n raise ValueError(\"expected a real number, got %s\" % tol)", "metadata": "root.MPContext._convert_tol", "header": "['class', 'MPContext', '(', 'PythonMPContext', ')', ':', '___EOS___']", "index": 98 }, { "content": " def _convert_fallback(ctx, x, strings):\n raise TypeError(\"cannot create mpf from \" + repr(x))", "metadata": "root.MPContext._convert_fallback", "header": "['class', 'MPContext', '(', 'PythonMPContext', ')', ':', '___EOS___']", "index": 110 }, { "content": " def to_rational(ctx, s, limit=True):\n p, q = to_rational(s._mpf_)\n\n if not limit or q <= ctx.max_denom:\n return p, q\n\n p0, q0, p1, q1 = 0, 1, 1, 0\n n, d = p, q\n\n while True:\n a = n//d\n q2 = q0 + a*q1\n if q2 > ctx.max_denom:\n break\n p0, q0, p1, q1 = p1, q1, p0 + a*p1, q2\n n, d = d, n - a*d\n\n k = (ctx.max_denom - q0)//q1\n\n number = mpq(p, q)\n bound1 = mpq(p0 + k*p1, q0 + k*q1)\n bound2 = mpq(p1, q1)\n\n if not bound2 or not bound1:\n return p, q\n elif abs(bound2 - number) <= abs(bound1 - number):\n return bound2._mpq_\n else:\n return bound1._mpq_", "metadata": "root.MPContext.to_rational", "header": "['class', 'MPContext', '(', 'PythonMPContext', ')', ':', '___EOS___']", "index": 121 }, { "content": " def almosteq(ctx, s, t, rel_eps=None, abs_eps=None):\n t = ctx.convert(t)\n if abs_eps is None and rel_eps is None:\n rel_eps = abs_eps = ctx.tolerance or ctx.make_tol()\n if abs_eps is None:\n abs_eps = ctx.convert(rel_eps)\n elif rel_eps is None:\n rel_eps = ctx.convert(abs_eps)\n diff = abs(s-t)\n if diff <= abs_eps:\n return True\n abss = abs(s)\n abst = abs(t)\n if abss < abst:\n err = diff/abst\n else:\n err = diff/abss\n return err <= rel_eps", "metadata": "root.MPContext.almosteq", "header": "['class', 'MPContext', '(', 'PythonMPContext', ')', ':', '___EOS___']", "index": 151 } ]
[ { "span": "def __init__(ctx, prec=53, dps=None, tol=None):", "start_line": 47, "start_column": 4, "end_line": 47, "end_column": 51 }, { "span": "def _make_tol(ctx):", "start_line": 90, "start_column": 4, "end_line": 90, "end_column": 23 }, { "span": "def make_tol(ctx):", "start_line": 95, "start_column": 4, "end_line": 95, "end_column": 22 }, { "span": "def _convert_tol(ctx, tol):", "start_line": 98, "start_column": 4, "end_line": 98, "end_column": 31 }, { "span": "def _convert_fallback(ctx, x, strings):", "start_line": 110, "start_column": 4, "end_line": 110, "end_column": 43 }, { "span": "def to_rational(ctx, s, limit=True):", "start_line": 121, "start_column": 4, "end_line": 121, "end_column": 40 }, { "span": "def almosteq(ctx, s, t, rel_eps=None, abs_eps=None):", "start_line": 151, "start_column": 4, "end_line": 151, "end_column": 56 } ]
[]
1
true
[ "[CLS]_", "First_", "parameter_", "of_", "a_", "method_", "is_", "not_", "named_", "'", "self", "'_", "[SEP]_", "class_", "MP", "Context_", "(_", "Pyth", "on", "MP", "Context_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "\\u\\u", "init\\u\\u_", "(_", "ctx_", ",_", "prec_", "=_", "53_", ",_", "dps", "_", "=_", "None_", ",_", "tol_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ctx_", "._", "\\u", "prec", "\\u", "rounding", "_", "=_", "[_", "prec_", ",_", "round", "\\u", "nearest_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "dps", "_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ctx_", "._", "\\u", "set\\u", "prec_", "(_", "prec_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ctx_", "._", "\\u", "set\\u", "dps", "_", "(_", "dps", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "ctx_", "._", "mpf", "_", "=_", "type_", "(_", "'", "Real", "Element", "'_", ",_", "(_", "Real", "Element_", ",_", ")_", ",_", "{_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ctx_", "._", "mpc", "_", "=_", "type_", "(_", "'", "Comple", "x", "Element", "'_", ",_", "(_", "Comple", "x", "Element_", ",_", ")_", ",_", "{_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ctx_", "._", "mpf", "_", "._", "\\u", "ctx", "data_", "=_", "[_", "ctx_", "._", "mpf", "_", ",_", "new_", ",_", "ctx_", "._", "\\u", "prec", "\\u", "rounding", "_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ctx_", "._", "mpc", "_", "._", "\\u", "ctx", "data_", "=_", "[_", "ctx_", "._", "mpc", "_", ",_", "new_", ",_", "ctx_", "._", "\\u", "prec", "\\u", "rounding", "_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ctx_", "._", "mpf", "_", "._", "context_", "=_", "ctx_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ctx_", "._", "mpc", "_", "._", "context_", "=_", "ctx_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ctx_", "._", "constant_", "=_", "type_", "(_", "'", "constant", "'_", ",_", "(_", "\\u", "constant_", ",_", ")_", ",_", "{_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ctx_", "._", "constant_", "._", "\\u", "ctx", "data_", "=_", "[_", "ctx_", "._", "mpf", "_", ",_", "new_", ",_", "ctx_", "._", "\\u", "prec", "\\u", "rounding", "_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ctx_", "._", "constant_", "._", "context_", "=_", "ctx_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "ctx_", "._", "types_", "=_", "[_", "ctx_", "._", "mpf", "_", ",_", "ctx_", "._", "mpc", "_", ",_", "ctx_", "._", "constant_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ctx_", "._", "trap", "\\u", "complex_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ctx_", "._", "pretty_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "tol_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ctx_", "._", "tol_", "=_", "ctx_", "._", "\\u", "make", "\\u", "tol_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "tol_", "is_", "False_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ctx_", "._", "tol_", "=_", "fz", "ero", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ctx_", "._", "tol_", "=_", "ctx_", "._", "\\u", "convert", "\\u", "tol_", "(_", "tol_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "ctx_", "._", "tolerance_", "=_", "ctx_", "._", "make", "\\u", "mpf", "_", "(_", "ctx_", "._", "tol_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "ctx_", "._", "tolerance_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ctx_", "._", "max", "\\u", "denom_", "=_", "1000000_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ctx_", "._", "max", "\\u", "denom_", "=_", "int_", "(_", "1_", "/_", "ctx_", "._", "tolerance_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "ctx_", "._", "zero_", "=_", "ctx_", "._", "make", "\\u", "mpf", "_", "(_", "fz", "ero", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ctx_", "._", "one_", "=_", "ctx_", "._", "make", "\\u", "mpf", "_", "(_", "fon", "e_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ctx_", "._", "j_", "=_", "ctx_", "._", "make", "\\u", "mpc", "_", "(_", "(_", "fz", "ero", "_", ",_", "fon", "e_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ctx_", "._", "inf_", "=_", "ctx_", "._", "make", "\\u", "mpf", "_", "(_", "fin", "f_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ctx_", "._", "nin", "f_", "=_", "ctx_", "._", "make", "\\u", "mpf", "_", "(_", "fn", "inf_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ctx_", "._", "nan_", "=_", "ctx_", "._", "make", "\\u", "mpf", "_", "(_", "fna", "n_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "MP", "Context_", "(_", "Pyth", "on", "MP", "Context_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "make", "\\u", "tol_", "(_", "ctx_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "hundred", "_", "=_", "(_", "0_", ",_", "25_", ",_", "2_", ",_", "5_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "eps_", "=_", "(_", "0_", ",_", "MP", "Z", "\\u", "ONE_", ",_", "1_", "-_", "ctx_", "._", "prec_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "mpf", "\\u", "mul_", "(_", "hundred", "_", ",_", "eps_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "MP", "Context_", "(_", "Pyth", "on", "MP", "Context_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "make", "\\u", "tol_", "(_", "ctx_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "ctx_", "._", "make", "\\u", "mpf", "_", "(_", "ctx_", "._", "\\u", "make", "\\u", "tol_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "MP", "Context_", "(_", "Pyth", "on", "MP", "Context_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "convert", "\\u", "tol_", "(_", "ctx_", ",_", "tol_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "isinstance_", "(_", "tol_", ",_", "int\\u", "types_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "from", "\\u", "int_", "(_", "tol_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "isinstance_", "(_", "tol_", ",_", "float_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "from", "\\u", "float_", "(_", "tol_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "hasattr_", "(_", "tol_", ",_", "\"\\u", "mpf", "\\u\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "tol_", "._", "\\u", "mpf", "\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "prec_", ",_", "rounding", "_", "=_", "ctx_", "._", "\\u", "prec", "\\u", "rounding", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "isinstance_", "(_", "tol_", ",_", "basestring_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "from", "\\u", "str_", "(_", "tol_", ",_", "prec_", ",_", "rounding", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "raise_", "Value", "Error_", "(_", "\"", "expected", " ", "a", " ", "real", " ", "number", ",", " ", "got", " ", "%", "s", "\"_", "%_", "tol_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "MP", "Context_", "(_", "Pyth", "on", "MP", "Context_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "convert", "\\u", "fallback_", "(_", "ctx_", ",_", "x_", ",_", "strings_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Type", "Error_", "(_", "\"", "cann", "ot", " ", "create", " ", "mpf", " ", "from", " ", "\"_", "+_", "repr_", "(_", "x_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "MP", "Context_", "(_", "Pyth", "on", "MP", "Context_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "to", "\\u", "rational", "_", "(_", "ctx_", ",_", "s_", ",_", "limit_", "=_", "True_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "p_", ",_", "q_", "=_", "to", "\\u", "rational", "_", "(_", "s_", "._", "\\u", "mpf", "\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "limit_", "or_", "q_", "<=_", "ctx_", "._", "max", "\\u", "denom_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "p_", ",_", "q_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "p0_", ",_", "q0_", ",_", "p1_", ",_", "q1_", "=_", "0_", ",_", "1_", ",_", "1_", ",_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "n_", ",_", "d_", "=_", "p_", ",_", "q_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "while_", "True_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "a_", "=_", "n_", "//_", "d_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "q2_", "=_", "q0_", "+_", "a_", "*_", "q1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "q2_", ">_", "ctx_", "._", "max", "\\u", "denom_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "p0_", ",_", "q0_", ",_", "p1_", ",_", "q1_", "=_", "p1_", ",_", "q1_", ",_", "p0_", "+_", "a_", "*_", "p1_", ",_", "q2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "n_", ",_", "d_", "=_", "d_", ",_", "n_", "-_", "a_", "*_", "d_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "k_", "=_", "(_", "ctx_", "._", "max", "\\u", "denom_", "-_", "q0_", ")_", "//_", "q1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "number_", "=_", "mp", "q_", "(_", "p_", ",_", "q_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bound", "1_", "=_", "mp", "q_", "(_", "p0_", "+_", "k_", "*_", "p1_", ",_", "q0_", "+_", "k_", "*_", "q1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bound", "2_", "=_", "mp", "q_", "(_", "p1_", ",_", "q1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "bound", "2_", "or_", "not_", "bound", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "p_", ",_", "q_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "abs_", "(_", "bound", "2_", "-_", "number_", ")_", "<=_", "abs_", "(_", "bound", "1_", "-_", "number_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "bound", "2_", "._", "\\u", "mp", "q", "\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "bound", "1_", "._", "\\u", "mp", "q", "\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "MP", "Context_", "(_", "Pyth", "on", "MP", "Context_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "alm", "ost", "eq_", "(_", "ctx_", ",_", "s_", ",_", "t_", ",_", "rel", "\\u", "eps_", "=_", "None_", ",_", "abs", "\\u", "eps_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "t_", "=_", "ctx_", "._", "convert_", "(_", "t_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "abs", "\\u", "eps_", "is_", "None_", "and_", "rel", "\\u", "eps_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "rel", "\\u", "eps_", "=_", "abs", "\\u", "eps_", "=_", "ctx_", "._", "tolerance_", "or_", "ctx_", "._", "make", "\\u", "tol_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "abs", "\\u", "eps_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "abs", "\\u", "eps_", "=_", "ctx_", "._", "convert_", "(_", "rel", "\\u", "eps_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "rel", "\\u", "eps_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "rel", "\\u", "eps_", "=_", "ctx_", "._", "convert_", "(_", "abs", "\\u", "eps_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "diff_", "=_", "abs_", "(_", "s_", "-_", "t_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "diff_", "<=_", "abs", "\\u", "eps_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "abs", "s_", "=_", "abs_", "(_", "s_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "abs", "t_", "=_", "abs_", "(_", "t_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "abs", "s_", "<_", "abs", "t_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "err_", "=_", "diff_", "/_", "abs", "t_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "err_", "=_", "diff_", "/_", "abs", "s_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "err_", "<=_", "rel", "\\u", "eps_" ]
[ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused local variable
Piratenfraktion-Berlin/OwnTube/videoportal/BitTornadoABC/BitTornado/BT1/track.py
[ { "content": " def add_data(self, infohash, event, ip, paramslist):\n peers = self.downloads.setdefault(infohash, {})\n ts = self.times.setdefault(infohash, {})\n self.completed.setdefault(infohash, 0)\n self.seedcount.setdefault(infohash, 0)\n\n def params(key, default = None, l = paramslist):\n if l.has_key(key):\n return l[key][0]\n return default\n \n myid = params('peer_id','')\n if len(myid) != 20:\n raise ValueError, 'id not of length 20'\n if event not in ['started', 'completed', 'stopped', 'snooped', None]:\n raise ValueError, 'invalid event'\n port = long(params('port',''))\n if port < 0 or port > 65535:\n raise ValueError, 'invalid port'\n left = long(params('left',''))\n if left < 0:\n raise ValueError, 'invalid amount left'\n uploaded = long(params('uploaded',''))\n downloaded = long(params('downloaded',''))\n\n peer = peers.get(myid)\n islocal = local_IPs.includes(ip)\n mykey = params('key')\n if peer:\n auth = peer.get('key',-1) == mykey or peer.get('ip') == ip\n\n gip = params('ip')\n if is_valid_ip(gip) and (islocal or not self.only_local_override_ip):\n ip1 = gip\n else:\n ip1 = ip\n\n if params('numwant') is not None:\n rsize = min(int(params('numwant')),self.response_size)\n else:\n rsize = self.response_size\n\n if event == 'stopped':\n if peer:\n if auth:\n self.delete_peer(infohash,myid)\n \n elif not peer:\n ts[myid] = clock()\n peer = {'ip': ip, 'port': port, 'left': left}\n if mykey:\n peer['key'] = mykey\n if gip:\n peer['given ip'] = gip\n if port:\n if not self.natcheck or islocal:\n peer['nat'] = 0\n self.natcheckOK(infohash,myid,ip1,port,left)\n else:\n NatCheck(self.connectback_result,infohash,myid,ip1,port,self.rawserver)\n else:\n peer['nat'] = 2**30\n if event == 'completed':\n self.completed[infohash] += 1\n if not left:\n self.seedcount[infohash] += 1\n\n peers[myid] = peer\n\n else:\n if not auth:\n return rsize # return w/o changing stats\n\n ts[myid] = clock()\n if not left and peer['left']:\n self.completed[infohash] += 1\n self.seedcount[infohash] += 1\n if not peer.get('nat', -1):\n for bc in self.becache[infohash]:\n bc[1][myid] = bc[0][myid]\n del bc[0][myid]\n if peer['left']:\n peer['left'] = left\n\n if port:\n recheck = False\n if ip != peer['ip']:\n peer['ip'] = ip\n recheck = True\n if gip != peer.get('given ip'):\n if gip:\n peer['given ip'] = gip\n elif peer.has_key('given ip'):\n del peer['given ip']\n recheck = True\n\n natted = peer.get('nat', -1)\n if recheck:\n if natted == 0:\n l = self.becache[infohash]\n y = not peer['left']\n for x in l:\n del x[y][myid]\n if not self.natcheck or islocal:\n del peer['nat'] # restart NAT testing\n if natted and natted < self.natcheck:\n recheck = True\n\n if recheck:\n if not self.natcheck or islocal:\n peer['nat'] = 0\n self.natcheckOK(infohash,myid,ip1,port,left)\n else:\n NatCheck(self.connectback_result,infohash,myid,ip1,port,self.rawserver)\n\n return rsize", "metadata": "root.Tracker.add_data", "header": "['class', 'Tracker', ':', '___EOS___']", "index": 561 } ]
[ { "span": "uploaded ", "start_line": 583, "start_column": 8, "end_line": 583, "end_column": 16 }, { "span": "downloaded ", "start_line": 584, "start_column": 8, "end_line": 584, "end_column": 18 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "Tracker_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "add", "\\u", "data_", "(_", "self_", ",_", "info", "hash_", ",_", "event_", ",_", "ip_", ",_", "params", "list_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "peers_", "=_", "self_", "._", "downloads_", "._", "setdefault_", "(_", "info", "hash_", ",_", "{_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ts_", "=_", "self_", "._", "times_", "._", "setdefault_", "(_", "info", "hash_", ",_", "{_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "completed_", "._", "setdefault_", "(_", "info", "hash_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "seed", "count_", "._", "setdefault_", "(_", "info", "hash_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "params_", "(_", "key_", ",_", "default_", "=_", "None_", ",_", "l_", "=_", "params", "list_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "l_", "._", "has", "\\u", "key_", "(_", "key_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "l_", "[_", "key_", "]_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "default_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "myid", "_", "=_", "params_", "(_", "'", "peer", "\\u", "id", "'_", ",_", "''_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "len_", "(_", "myid", "_", ")_", "!=_", "20_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Value", "Error_", ",_", "'", "id", " ", "not", " ", "of", " ", "length", " ", "20", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "event_", "not_", "in_", "[_", "'", "start", "ed", "'_", ",_", "'", "complete", "d", "'_", ",_", "'", "stopp", "ed", "'_", ",_", "'", "sno", "ope", "d", "'_", ",_", "None_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Value", "Error_", ",_", "'", "invalid", " ", "event", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "port_", "=_", "long_", "(_", "params_", "(_", "'", "port", "'_", ",_", "''_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "port_", "<_", "0_", "or_", "port_", ">_", "65535_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Value", "Error_", ",_", "'", "invalid", " ", "port", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "left_", "=_", "long_", "(_", "params_", "(_", "'", "left", "'_", ",_", "''_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "left_", "<_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Value", "Error_", ",_", "'", "invalid", " ", "amo", "unt", " ", "left", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "uploade", "d_", "=_", "long_", "(_", "params_", "(_", "'", "uploade", "d", "'_", ",_", "''_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "downloaded_", "=_", "long_", "(_", "params_", "(_", "'", "download", "ed", "'_", ",_", "''_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "peer_", "=_", "peers_", "._", "get_", "(_", "myid", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "isl", "ocal", "_", "=_", "local", "\\u", "IP", "s_", "._", "includes_", "(_", "ip_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "my", "key_", "=_", "params_", "(_", "'", "key", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "peer_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "auth_", "=_", "peer_", "._", "get_", "(_", "'", "key", "'_", ",_", "-_", "1_", ")_", "==_", "my", "key_", "or_", "peer_", "._", "get_", "(_", "'", "ip", "'_", ")_", "==_", "ip_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "gi", "p_", "=_", "params_", "(_", "'", "ip", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "is", "\\u", "valid", "\\u", "ip_", "(_", "gi", "p_", ")_", "and_", "(_", "isl", "ocal", "_", "or_", "not_", "self_", "._", "only", "\\u", "local", "\\u", "override", "\\u", "ip_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ip", "1_", "=_", "gi", "p_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ip", "1_", "=_", "ip_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "params_", "(_", "'", "num", "want", "'_", ")_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "rsi", "ze_", "=_", "min_", "(_", "int_", "(_", "params_", "(_", "'", "num", "want", "'_", ")_", ")_", ",_", "self_", "._", "response", "\\u", "size_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "rsi", "ze_", "=_", "self_", "._", "response", "\\u", "size_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "event_", "==_", "'", "stopp", "ed", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "peer_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "auth_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "self_", "._", "delete", "\\u", "peer_", "(_", "info", "hash_", ",_", "myid", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "not_", "peer_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ts_", "[_", "myid", "_", "]_", "=_", "clock_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "peer_", "=_", "{_", "'", "ip", "'_", ":_", "ip_", ",_", "'", "port", "'_", ":_", "port_", ",_", "'", "left", "'_", ":_", "left_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "my", "key_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "peer_", "[_", "'", "key", "'_", "]_", "=_", "my", "key_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "gi", "p_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "peer_", "[_", "'", "give", "n", " ", "ip", "'_", "]_", "=_", "gi", "p_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "port_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "self_", "._", "nat", "check_", "or_", "isl", "ocal", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "peer_", "[_", "'", "nat", "'_", "]_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "nat", "check", "OK_", "(_", "info", "hash_", ",_", "myid", "_", ",_", "ip", "1_", ",_", "port_", ",_", "left_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "Nat", "Check_", "(_", "self_", "._", "connect", "back", "\\u", "result_", ",_", "info", "hash_", ",_", "myid", "_", ",_", "ip", "1_", ",_", "port_", ",_", "self_", "._", "raws", "erver_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "peer_", "[_", "'", "nat", "'_", "]_", "=_", "2_", "**_", "30_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "event_", "==_", "'", "complete", "d", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "completed_", "[_", "info", "hash_", "]_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "left_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "seed", "count_", "[_", "info", "hash_", "]_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "peers_", "[_", "myid", "_", "]_", "=_", "peer_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "auth_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "rsi", "ze_", "#", " ", "return", " ", "w", "/", "o", " ", "chang", "ing", " ", "stats_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "ts_", "[_", "myid", "_", "]_", "=_", "clock_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "left_", "and_", "peer_", "[_", "'", "left", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "completed_", "[_", "info", "hash_", "]_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "seed", "count_", "[_", "info", "hash_", "]_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "peer_", "._", "get_", "(_", "'", "nat", "'_", ",_", "-_", "1_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "for_", "bc_", "in_", "self_", "._", "bec", "ache_", "[_", "info", "hash_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "bc_", "[_", "1_", "]_", "[_", "myid", "_", "]_", "=_", "bc_", "[_", "0_", "]_", "[_", "myid", "_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "del_", "bc_", "[_", "0_", "]_", "[_", "myid", "_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "peer_", "[_", "'", "left", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "peer_", "[_", "'", "left", "'_", "]_", "=_", "left_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "port_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "rech", "eck", "_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "ip_", "!=_", "peer_", "[_", "'", "ip", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "peer_", "[_", "'", "ip", "'_", "]_", "=_", "ip_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rech", "eck", "_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "gi", "p_", "!=_", "peer_", "._", "get_", "(_", "'", "give", "n", " ", "ip", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "gi", "p_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "peer_", "[_", "'", "give", "n", " ", "ip", "'_", "]_", "=_", "gi", "p_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "peer_", "._", "has", "\\u", "key_", "(_", "'", "give", "n", " ", "ip", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "del_", "peer_", "[_", "'", "give", "n", " ", "ip", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "rech", "eck", "_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "nat", "ted_", "=_", "peer_", "._", "get_", "(_", "'", "nat", "'_", ",_", "-_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "rech", "eck", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "nat", "ted_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "l_", "=_", "self_", "._", "bec", "ache_", "[_", "info", "hash_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "y_", "=_", "not_", "peer_", "[_", "'", "left", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "x_", "in_", "l_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "del_", "x_", "[_", "y_", "]_", "[_", "myid", "_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "self_", "._", "nat", "check_", "or_", "isl", "ocal", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "del_", "peer_", "[_", "'", "nat", "'_", "]_", "#", " ", "restart", " ", "NAT", " ", "testing_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "nat", "ted_", "and_", "nat", "ted_", "<_", "self_", "._", "nat", "check_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "rech", "eck", "_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "rech", "eck", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "not_", "self_", "._", "nat", "check_", "or_", "isl", "ocal", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "peer_", "[_", "'", "nat", "'_", "]_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "nat", "check", "OK_", "(_", "info", "hash_", ",_", "myid", "_", ",_", "ip", "1_", ",_", "port_", ",_", "left_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "Nat", "Check_", "(_", "self_", "._", "connect", "back", "\\u", "result_", ",_", "info", "hash_", ",_", "myid", "_", ",_", "ip", "1_", ",_", "port_", ",_", "self_", "._", "raws", "erver_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "rsi", "ze_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,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 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Variable defined multiple times
VisTrails/VisTrails/vistrails/core/interpreter/cached.py
[ { "content": " def test_cache(self):\n from vistrails.core.modules.basic_modules import StandardOutput\n old_compute = StandardOutput.compute\n StandardOutput.compute = lambda s: None\n\n try:\n from vistrails.core.db.locator import XMLFileLocator\n from vistrails.core.vistrail.controller import VistrailController\n from vistrails.core.db.io import load_vistrail\n\n \"\"\"Test if basic caching is working.\"\"\"\n locator = XMLFileLocator(vistrails.core.system.vistrails_root_directory() +\n '/tests/resources/dummy.xml')\n (v, abstractions, thumbnails, mashups) = load_vistrail(locator)\n\n # the controller will take care of upgrades\n controller = VistrailController(v, locator, abstractions,\n thumbnails, mashups)\n p1 = v.getPipeline('int chain')\n n = v.get_version_number('int chain')\n controller.change_selected_version(n)\n controller.flush_delayed_actions()\n p1 = controller.current_pipeline\n\n view = DummyView()\n interpreter = CachedInterpreter.get()\n result = interpreter.execute(p1,\n locator=v,\n current_version=n,\n view=view,\n )\n # to force fresh params\n p2 = v.getPipeline('int chain')\n controller.change_selected_version(n)\n controller.flush_delayed_actions()\n p2 = controller.current_pipeline\n result = interpreter.execute(p2,\n locator=v,\n current_version=n,\n view=view,\n )\n self.assertEqual(len(result.modules_added), 1)\n finally:\n StandardOutput.compute = old_compute", "metadata": "root.TestCachedInterpreter.test_cache", "header": "['class', 'TestCachedInterpreter', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 903 } ]
[ { "span": "p1 ", "start_line": 921, "start_column": 12, "end_line": 921, "end_column": 14 }, { "span": "result ", "start_line": 929, "start_column": 12, "end_line": 929, "end_column": 18 }, { "span": "p2 ", "start_line": 935, "start_column": 12, "end_line": 935, "end_column": 14 } ]
[ { "span": "p1 ", "start_line": 925, "start_column": 12, "end_line": 925, "end_column": 14 }, { "span": "p2 ", "start_line": 938, "start_column": 12, "end_line": 938, "end_column": 14 }, { "span": "result ", "start_line": 939, "start_column": 12, "end_line": 939, "end_column": 18 } ]
1
true
[ "[CLS]_", "Variable_", "defined_", "multiple_", "times_", "[SEP]_", "class_", "Test", "Cache", "d", "Interpreter_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "test\\u", "cache_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "vist", "rail", "s_", "._", "core_", "._", "modules_", "._", "basic", "\\u", "modules_", "import_", "Standard", "Output_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "old", "\\u", "compute_", "=_", "Standard", "Output_", "._", "compute_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Standard", "Output_", "._", "compute_", "=_", "lambda_", "s_", ":_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "vist", "rail", "s_", "._", "core_", "._", "db_", "._", "locator_", "import_", "XML", "File", "Locator_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "vist", "rail", "s_", "._", "core_", "._", "vist", "rail", "_", "._", "controller_", "import_", "Vis", "trail", "Controller_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "vist", "rail", "s_", "._", "core_", "._", "db_", "._", "io_", "import_", "load", "\\u", "vist", "rail", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\"\"\"", "Test", " ", "if", " ", "basic", " ", "caching", " ", "is", " ", "working", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "locator_", "=_", "XML", "File", "Locator_", "(_", "vist", "rail", "s_", "._", "core_", "._", "system_", "._", "vist", "rail", "s", "\\u", "root", "\\u", "directory_", "(_", ")_", "+_", "\\u\\u\\uNL\\u\\u\\u_", "'/", "tests", "/", "resource", "s", "/", "dummy", ".", "xml", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "(_", "v_", ",_", "abstract", "ions_", ",_", "thumbnail", "s_", ",_", "mas", "hu", "ps_", ")_", "=_", "load", "\\u", "vist", "rail", "_", "(_", "locator_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "the", " ", "controlle", "r", " ", "will", " ", "take", " ", "care", " ", "of", " ", "upgrade", "s_", "\\u\\u\\uNL\\u\\u\\u_", "controller_", "=_", "Vis", "trail", "Controller_", "(_", "v_", ",_", "locator_", ",_", "abstract", "ions_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "thumbnail", "s_", ",_", "mas", "hu", "ps_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "p1_", "=_", "v_", "._", "get", "Pipeline_", "(_", "'", "int", " ", "chain", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "n_", "=_", "v_", "._", "get", "\\u", "version", "\\u", "number_", "(_", "'", "int", " ", "chain", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "controller_", "._", "change", "\\u", "selecte", "d\\u", "version_", "(_", "n_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "controller_", "._", "flush", "\\u", "delayed", "\\u", "actions_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "p1_", "=_", "controller_", "._", "current", "\\u", "pipeline_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "view_", "=_", "Du", "mm", "y", "View_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "interpreter_", "=_", "Cache", "d", "Interpreter_", "._", "get_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "interpreter_", "._", "execute_", "(_", "p1_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "locator_", "=_", "v_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "current", "\\u", "version_", "=_", "n_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "view_", "=_", "view_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "to", " ", "force", " ", "fresh", " ", "params_", "\\u\\u\\uNL\\u\\u\\u_", "p2_", "=_", "v_", "._", "get", "Pipeline_", "(_", "'", "int", " ", "chain", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "controller_", "._", "change", "\\u", "selecte", "d\\u", "version_", "(_", "n_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "controller_", "._", "flush", "\\u", "delayed", "\\u", "actions_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "p2_", "=_", "controller_", "._", "current", "\\u", "pipeline_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "interpreter_", "._", "execute_", "(_", "p2_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "locator_", "=_", "v_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "current", "\\u", "version_", "=_", "n_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "view_", "=_", "view_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "result_", "._", "module", "s", "\\u", "added_", ")_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "finally_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Standard", "Output_", "._", "compute_", "=_", "old", "\\u", "compute_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 2, 2, 2, 2, 2, 2, 2, 3, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Except block handles 'BaseException'
hexagonit/hexagonit.recipe.cmmi/hexagonit/recipe/cmmi/tests.py
[ { "content": " def test_restart_after_failure(self):\n temp_directory = tempfile.mkdtemp(dir=self.dir, prefix=\"fake_package\")\n\n configure_path = os.path.join(temp_directory, 'configure')\n self.write_file(configure_path, 'exit 0', mode=stat.S_IRWXU)\n makefile_path = os.path.join(temp_directory, 'Makefile')\n self.write_file(makefile_path, 'all:\\n\\texit -1')\n\n os.chdir(temp_directory)\n\n ignore, tarfile_path = tempfile.mkstemp(suffix=\".tar\")\n tar = tarfile.open(tarfile_path, 'w')\n tar.add('configure')\n tar.add('Makefile')\n tar.close()\n\n recipe = self.make_recipe({}, 'test', {'url': tarfile_path})\n os.chdir(self.dir)\n\n try:\n # expected failure\n with self.assertRaises(zc.buildout.UserError):\n recipe.install()\n\n # the install should still fail, and _not_ raise an OSError\n with self.assertRaises(zc.buildout.UserError):\n recipe.install()\n finally:\n try:\n shutil.rmtree(temp_directory)\n os.remove(tarfile_path)\n except:\n pass", "metadata": "root.NonInformativeTests.test_restart_after_failure", "header": "['class', 'NonInformativeTests', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 100 } ]
[ { "span": "except:", "start_line": 131, "start_column": 12, "end_line": 131, "end_column": 19 } ]
[]
1
true
[ "[CLS]_", "Except", "_", "block_", "handles_", "'", "Base", "Except", "ion", "'_", "[SEP]_", "class_", "Non", "Informa", "tiv", "e", "Tests_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "restart", "\\u", "after", "\\u", "failure_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "temp", "\\u", "directory_", "=_", "tempfile_", "._", "mkdtemp_", "(_", "dir_", "=_", "self_", "._", "dir_", ",_", "prefix_", "=_", "\"", "fake", "\\u", "package", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "configur", "e\\u", "path_", "=_", "os_", "._", "path_", "._", "join_", "(_", "temp", "\\u", "directory_", ",_", "'", "configur", "e", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "write", "\\u", "file_", "(_", "configur", "e\\u", "path_", ",_", "'", "exit", " ", "0", "'_", ",_", "mode_", "=_", "stat_", "._", "S", "\\u", "IR", "WX", "U_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "makefile", "\\u", "path_", "=_", "os_", "._", "path_", "._", "join_", "(_", "temp", "\\u", "directory_", ",_", "'", "Make", "file", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "write", "\\u", "file_", "(_", "makefile", "\\u", "path_", ",_", "'", "all", ":\\\\", "n", "\\\\", "tex", "it", " ", "-1", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "os_", "._", "chdir_", "(_", "temp", "\\u", "directory_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "ignore_", ",_", "tar", "file", "\\u", "path_", "=_", "tempfile_", "._", "mkstemp_", "(_", "suffix_", "=_", "\".", "tar", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tar_", "=_", "tarfile_", "._", "open_", "(_", "tar", "file", "\\u", "path_", ",_", "'", "w", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tar_", "._", "add_", "(_", "'", "configur", "e", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tar_", "._", "add_", "(_", "'", "Make", "file", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tar_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "recipe_", "=_", "self_", "._", "make", "\\u", "recipe_", "(_", "{_", "}_", ",_", "'", "test", "'_", ",_", "{_", "'", "url", "'_", ":_", "tar", "file", "\\u", "path_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "os_", "._", "chdir_", "(_", "self_", "._", "dir_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "expected", " ", "failure_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "with_", "self_", "._", "assert", "Raises_", "(_", "zc", "_", "._", "buildo", "ut_", "._", "User", "Error_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "recipe_", "._", "install_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "the", " ", "install", " ", "shou", "ld", " ", "still", " ", "fail", ",", " ", "and", " ", "\\u", "not", "\\u", " ", "raise", " ", "an", " ", "OSE", "rror_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "with_", "self_", "._", "assert", "Raises_", "(_", "zc", "_", "._", "buildo", "ut_", "._", "User", "Error_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "recipe_", "._", "install_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "finally_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "shutil_", "._", "rmtree_", "(_", "temp", "\\u", "directory_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "os_", "._", "remove_", "(_", "tar", "file", "\\u", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 2, 2,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2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 2, 2, 2, 2, 2 ]
Unused local variable
amrdraz/kodr/app/brython/www/src/Lib/test/test_sched.py
[ { "content": " def test_enter(self):\n l = []\n fun = lambda x: l.append(x)\n scheduler = sched.scheduler(time.time, time.sleep)\n for x in [0.5, 0.4, 0.3, 0.2, 0.1]:\n z = scheduler.enter(x, 1, fun, (x,))\n scheduler.run()\n self.assertEqual(l, [0.1, 0.2, 0.3, 0.4, 0.5])", "metadata": "root.TestCase.test_enter", "header": "['class', 'TestCase', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 45 }, { "content": " def test_enterabs(self):\n l = []\n fun = lambda x: l.append(x)\n scheduler = sched.scheduler(time.time, time.sleep)\n for x in [0.05, 0.04, 0.03, 0.02, 0.01]:\n z = scheduler.enterabs(x, 1, fun, (x,))\n scheduler.run()\n self.assertEqual(l, [0.01, 0.02, 0.03, 0.04, 0.05])", "metadata": "root.TestCase.test_enterabs", "header": "['class', 'TestCase', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 54 }, { "content": " @unittest.skipUnless(threading, 'Threading required for this test.')\n def test_enter_concurrent(self):\n q = queue.Queue()\n fun = q.put\n timer = Timer()\n scheduler = sched.scheduler(timer.time, timer.sleep)\n scheduler.enter(1, 1, fun, (1,))\n scheduler.enter(3, 1, fun, (3,))\n t = threading.Thread(target=scheduler.run)\n t.start()\n timer.advance(1)\n self.assertEqual(q.get(timeout=TIMEOUT), 1)\n self.assertTrue(q.empty())\n for x in [4, 5, 2]:\n z = scheduler.enter(x - 1, 1, fun, (x,))\n timer.advance(2)\n self.assertEqual(q.get(timeout=TIMEOUT), 2)\n self.assertEqual(q.get(timeout=TIMEOUT), 3)\n self.assertTrue(q.empty())\n timer.advance(1)\n self.assertEqual(q.get(timeout=TIMEOUT), 4)\n self.assertTrue(q.empty())\n timer.advance(1)\n self.assertEqual(q.get(timeout=TIMEOUT), 5)\n self.assertTrue(q.empty())\n timer.advance(1000)\n t.join(timeout=TIMEOUT)\n self.assertFalse(t.is_alive())\n self.assertTrue(q.empty())\n self.assertEqual(timer.time(), 5)", "metadata": "root.TestCase.test_enter_concurrent", "header": "['class', 'TestCase', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 63 }, { "content": " def test_priority(self):\n l = []\n fun = lambda x: l.append(x)\n scheduler = sched.scheduler(time.time, time.sleep)\n for priority in [1, 2, 3, 4, 5]:\n z = scheduler.enterabs(0.01, priority, fun, (priority,))\n scheduler.run()\n self.assertEqual(l, [1, 2, 3, 4, 5])", "metadata": "root.TestCase.test_priority", "header": "['class', 'TestCase', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 94 }, { "content": " def test_cancel(self):\n l = []\n fun = lambda x: l.append(x)\n scheduler = sched.scheduler(time.time, time.sleep)\n now = time.time()\n event1 = scheduler.enterabs(now + 0.01, 1, fun, (0.01,))\n event2 = scheduler.enterabs(now + 0.02, 1, fun, (0.02,))\n event3 = scheduler.enterabs(now + 0.03, 1, fun, (0.03,))\n event4 = scheduler.enterabs(now + 0.04, 1, fun, (0.04,))\n event5 = scheduler.enterabs(now + 0.05, 1, fun, (0.05,))\n scheduler.cancel(event1)\n scheduler.cancel(event5)\n scheduler.run()\n self.assertEqual(l, [0.02, 0.03, 0.04])", "metadata": "root.TestCase.test_cancel", "header": "['class', 'TestCase', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 103 }, { "content": " @unittest.skipUnless(threading, 'Threading required for this test.')\n def test_cancel_concurrent(self):\n q = queue.Queue()\n fun = q.put\n timer = Timer()\n scheduler = sched.scheduler(timer.time, timer.sleep)\n now = timer.time()\n event1 = scheduler.enterabs(now + 1, 1, fun, (1,))\n event2 = scheduler.enterabs(now + 2, 1, fun, (2,))\n event4 = scheduler.enterabs(now + 4, 1, fun, (4,))\n event5 = scheduler.enterabs(now + 5, 1, fun, (5,))\n event3 = scheduler.enterabs(now + 3, 1, fun, (3,))\n t = threading.Thread(target=scheduler.run)\n t.start()\n timer.advance(1)\n self.assertEqual(q.get(timeout=TIMEOUT), 1)\n self.assertTrue(q.empty())\n scheduler.cancel(event2)\n scheduler.cancel(event5)\n timer.advance(1)\n self.assertTrue(q.empty())\n timer.advance(1)\n self.assertEqual(q.get(timeout=TIMEOUT), 3)\n self.assertTrue(q.empty())\n timer.advance(1)\n self.assertEqual(q.get(timeout=TIMEOUT), 4)\n self.assertTrue(q.empty())\n timer.advance(1000)\n t.join(timeout=TIMEOUT)\n self.assertFalse(t.is_alive())\n self.assertTrue(q.empty())\n self.assertEqual(timer.time(), 4)", "metadata": "root.TestCase.test_cancel_concurrent", "header": "['class', 'TestCase', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 118 }, { "content": " def test_empty(self):\n l = []\n fun = lambda x: l.append(x)\n scheduler = sched.scheduler(time.time, time.sleep)\n self.assertTrue(scheduler.empty())\n for x in [0.05, 0.04, 0.03, 0.02, 0.01]:\n z = scheduler.enterabs(x, 1, fun, (x,))\n self.assertFalse(scheduler.empty())\n scheduler.run()\n self.assertTrue(scheduler.empty())", "metadata": "root.TestCase.test_empty", "header": "['class', 'TestCase', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 151 }, { "content": " def test_args_kwargs(self):\n flag = []\n\n def fun(*a, **b):\n flag.append(None)\n self.assertEqual(a, (1,2,3))\n self.assertEqual(b, {\"foo\":1})\n\n scheduler = sched.scheduler(time.time, time.sleep)\n z = scheduler.enterabs(0.01, 1, fun, argument=(1,2,3), kwargs={\"foo\":1})\n scheduler.run()\n self.assertEqual(flag, [None])", "metadata": "root.TestCase.test_args_kwargs", "header": "['class', 'TestCase', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 176 } ]
[ { "span": "z ", "start_line": 50, "start_column": 12, "end_line": 50, "end_column": 13 }, { "span": "z ", "start_line": 59, "start_column": 12, "end_line": 59, "end_column": 13 }, { "span": "z ", "start_line": 77, "start_column": 12, "end_line": 77, "end_column": 13 }, { "span": "z ", "start_line": 99, "start_column": 12, "end_line": 99, "end_column": 13 }, { "span": "event2 ", "start_line": 109, "start_column": 8, "end_line": 109, "end_column": 14 }, { "span": "event3 ", "start_line": 110, "start_column": 8, "end_line": 110, "end_column": 14 }, { "span": "event4 ", "start_line": 111, "start_column": 8, "end_line": 111, "end_column": 14 }, { "span": "event1 ", "start_line": 125, "start_column": 8, "end_line": 125, "end_column": 14 }, { "span": "event4 ", "start_line": 127, "start_column": 8, "end_line": 127, "end_column": 14 }, { "span": "event3 ", "start_line": 129, "start_column": 8, "end_line": 129, "end_column": 14 }, { "span": "z ", "start_line": 157, "start_column": 12, "end_line": 157, "end_column": 13 }, { "span": "z ", "start_line": 185, "start_column": 8, "end_line": 185, "end_column": 9 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "Test", "Case_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "test\\u", "enter_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "l_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fun_", "=_", "lambda_", "x_", ":_", "l_", "._", "append_", "(_", "x_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "scheduler_", "=_", "sched_", "._", "scheduler_", "(_", "time_", "._", "time_", ",_", "time_", "._", "sleep_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "x_", "in_", "[_", "0.5_", ",_", "0.4_", ",_", "0.3_", ",_", "0.2_", ",_", "0.1_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "z_", "=_", "scheduler_", "._", "enter_", "(_", "x_", ",_", "1_", ",_", "fun_", ",_", "(_", "x_", ",_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "scheduler_", "._", "run_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "l_", ",_", "[_", "0.1_", ",_", "0.2_", ",_", "0.3_", ",_", "0.4_", ",_", "0.5_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Case_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "enter", "abs_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "l_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fun_", "=_", "lambda_", "x_", ":_", "l_", "._", "append_", "(_", "x_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "scheduler_", "=_", "sched_", "._", "scheduler_", "(_", "time_", "._", "time_", ",_", "time_", "._", "sleep_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "x_", "in_", "[_", "0.05_", ",_", "0.04_", ",_", "0.03_", ",_", "0.02_", ",_", "0.01_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "z_", "=_", "scheduler_", "._", "enter", "abs_", "(_", "x_", ",_", "1_", ",_", "fun_", ",_", "(_", "x_", ",_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "scheduler_", "._", "run_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "l_", ",_", "[_", "0.01_", ",_", "0.02_", ",_", "0.03_", ",_", "0.04_", ",_", "0.05_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Case_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "unittest_", "._", "skip", "Unless_", "(_", "threading_", ",_", "'", "Thread", "ing", " ", "require", "d", " ", "for", " ", "this", " ", "test", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "enter", "\\u", "concurrent_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "q_", "=_", "queue_", "._", "Queue_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fun_", "=_", "q_", "._", "put_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "timer_", "=_", "Timer_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "scheduler_", "=_", "sched_", "._", "scheduler_", "(_", "timer_", "._", "time_", ",_", "timer_", "._", "sleep_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "scheduler_", "._", "enter_", "(_", "1_", ",_", "1_", ",_", "fun_", ",_", "(_", "1_", ",_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "scheduler_", "._", "enter_", "(_", "3_", ",_", "1_", ",_", "fun_", ",_", "(_", "3_", ",_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t_", "=_", "threading_", "._", "Thread_", "(_", "target_", "=_", "scheduler_", "._", "run_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t_", "._", "start_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "timer_", "._", "advance_", "(_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "q_", "._", "get_", "(_", "timeout_", "=_", "TIMEOUT_", ")_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "q_", "._", "empty_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "x_", "in_", "[_", "4_", ",_", "5_", ",_", "2_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "z_", "=_", "scheduler_", "._", "enter_", "(_", "x_", "-_", "1_", ",_", "1_", ",_", "fun_", ",_", "(_", "x_", ",_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "timer_", "._", "advance_", "(_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "q_", "._", "get_", "(_", "timeout_", "=_", "TIMEOUT_", ")_", ",_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "q_", "._", "get_", "(_", "timeout_", "=_", "TIMEOUT_", ")_", ",_", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "q_", "._", "empty_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "timer_", "._", "advance_", "(_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "q_", "._", "get_", "(_", "timeout_", "=_", "TIMEOUT_", ")_", ",_", "4_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "q_", "._", "empty_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "timer_", "._", "advance_", "(_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "q_", "._", "get_", "(_", "timeout_", "=_", "TIMEOUT_", ")_", ",_", "5_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "q_", "._", "empty_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "timer_", "._", "advance_", "(_", "1000_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t_", "._", "join_", "(_", "timeout_", "=_", "TIMEOUT_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "t_", "._", "is", "\\u", "alive_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "q_", "._", "empty_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "timer_", "._", "time_", "(_", ")_", ",_", "5_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Case_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "priority_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "l_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fun_", "=_", "lambda_", "x_", ":_", "l_", "._", "append_", "(_", "x_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "scheduler_", "=_", "sched_", "._", "scheduler_", "(_", "time_", "._", "time_", ",_", "time_", "._", "sleep_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "priority_", "in_", "[_", "1_", ",_", "2_", ",_", "3_", ",_", "4_", ",_", "5_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "z_", "=_", "scheduler_", "._", "enter", "abs_", "(_", "0.01_", ",_", "priority_", ",_", "fun_", ",_", "(_", "priority_", ",_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "scheduler_", "._", "run_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "l_", ",_", "[_", "1_", ",_", "2_", ",_", "3_", ",_", "4_", ",_", "5_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Case_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "cancel_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "l_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fun_", "=_", "lambda_", "x_", ":_", "l_", "._", "append_", "(_", "x_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "scheduler_", "=_", "sched_", "._", "scheduler_", "(_", "time_", "._", "time_", ",_", "time_", "._", "sleep_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "now_", "=_", "time_", "._", "time_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "event", "1_", "=_", "scheduler_", "._", "enter", "abs_", "(_", "now_", "+_", "0.01_", ",_", "1_", ",_", "fun_", ",_", "(_", "0.01_", ",_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "event", "2_", "=_", "scheduler_", "._", "enter", "abs_", "(_", "now_", "+_", "0.02_", ",_", "1_", ",_", "fun_", ",_", "(_", "0.02_", ",_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "event", "3_", "=_", "scheduler_", "._", "enter", "abs_", "(_", "now_", "+_", "0.03_", ",_", "1_", ",_", "fun_", ",_", "(_", "0.03_", ",_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "event", "4_", "=_", "scheduler_", "._", "enter", "abs_", "(_", "now_", "+_", "0.04_", ",_", "1_", ",_", "fun_", ",_", "(_", "0.04_", ",_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "event", "5_", "=_", "scheduler_", "._", "enter", "abs_", "(_", "now_", "+_", "0.05_", ",_", "1_", ",_", "fun_", ",_", "(_", "0.05_", ",_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "scheduler_", "._", "cancel_", "(_", "event", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "scheduler_", "._", "cancel_", "(_", "event", "5_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "scheduler_", "._", "run_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "l_", ",_", "[_", "0.02_", ",_", "0.03_", ",_", "0.04_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Case_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "unittest_", "._", "skip", "Unless_", "(_", "threading_", ",_", "'", "Thread", "ing", " ", "require", "d", " ", "for", " ", "this", " ", "test", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "cancel", "\\u", "concurrent_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "q_", "=_", "queue_", "._", "Queue_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fun_", "=_", "q_", "._", "put_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "timer_", "=_", "Timer_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "scheduler_", "=_", "sched_", "._", "scheduler_", "(_", "timer_", "._", "time_", ",_", "timer_", "._", "sleep_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "now_", "=_", "timer_", "._", "time_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "event", "1_", "=_", "scheduler_", "._", "enter", "abs_", "(_", "now_", "+_", "1_", ",_", "1_", ",_", "fun_", ",_", "(_", "1_", ",_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "event", "2_", "=_", "scheduler_", "._", "enter", "abs_", "(_", "now_", "+_", "2_", ",_", "1_", ",_", "fun_", ",_", "(_", "2_", ",_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "event", "4_", "=_", "scheduler_", "._", "enter", "abs_", "(_", "now_", "+_", "4_", ",_", "1_", ",_", "fun_", ",_", "(_", "4_", ",_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "event", "5_", "=_", "scheduler_", "._", "enter", "abs_", "(_", "now_", "+_", "5_", ",_", "1_", ",_", "fun_", ",_", "(_", "5_", ",_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "event", "3_", "=_", "scheduler_", "._", "enter", "abs_", "(_", "now_", "+_", "3_", ",_", "1_", ",_", "fun_", ",_", "(_", "3_", ",_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t_", "=_", "threading_", "._", "Thread_", "(_", "target_", "=_", "scheduler_", "._", "run_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t_", "._", "start_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "timer_", "._", "advance_", "(_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "q_", "._", "get_", "(_", "timeout_", "=_", "TIMEOUT_", ")_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "q_", "._", "empty_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "scheduler_", "._", "cancel_", "(_", "event", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "scheduler_", "._", "cancel_", "(_", "event", "5_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "timer_", "._", "advance_", "(_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "q_", "._", "empty_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "timer_", "._", "advance_", "(_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "q_", "._", "get_", "(_", "timeout_", "=_", "TIMEOUT_", ")_", ",_", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "q_", "._", "empty_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "timer_", "._", "advance_", "(_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "q_", "._", "get_", "(_", "timeout_", "=_", "TIMEOUT_", ")_", ",_", "4_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "q_", "._", "empty_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "timer_", "._", "advance_", "(_", "1000_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t_", "._", "join_", "(_", "timeout_", "=_", "TIMEOUT_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "t_", "._", "is", "\\u", "alive_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "q_", "._", "empty_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "timer_", "._", "time_", "(_", ")_", ",_", "4_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Case_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "empty_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "l_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fun_", "=_", "lambda_", "x_", ":_", "l_", "._", "append_", "(_", "x_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "scheduler_", "=_", "sched_", "._", "scheduler_", "(_", "time_", "._", "time_", ",_", "time_", "._", "sleep_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "scheduler_", "._", "empty_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "x_", "in_", "[_", "0.05_", ",_", "0.04_", ",_", "0.03_", ",_", "0.02_", ",_", "0.01_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "z_", "=_", "scheduler_", "._", "enter", "abs_", "(_", "x_", ",_", "1_", ",_", "fun_", ",_", "(_", "x_", ",_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "scheduler_", "._", "empty_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "scheduler_", "._", "run_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "scheduler_", "._", "empty_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Case_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "args", "\\u", "kwargs_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "flag_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "fun_", "(_", "*_", "a_", ",_", "**_", "b_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "flag_", "._", "append_", "(_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "a_", ",_", "(_", "1_", ",_", "2_", ",_", "3_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "b_", ",_", "{_", "\"", "foo", "\"_", ":_", "1_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "scheduler_", "=_", "sched_", "._", "scheduler_", "(_", "time_", "._", "time_", ",_", "time_", "._", "sleep_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "z_", "=_", "scheduler_", "._", "enter", "abs_", "(_", "0.01_", ",_", "1_", ",_", "fun_", ",_", "argument_", "=_", "(_", "1_", ",_", "2_", ",_", "3_", ")_", ",_", "kwargs_", "=_", "{_", "\"", "foo", "\"_", ":_", "1_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "scheduler_", "._", "run_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_",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" def read_config (self):\n cfg_file = os.environ.get('OPENAPS_CONFIG', 'openaps.ini')\n if not os.path.exists(cfg_file):\n print \"Not an openaps environment, run: openaps init\"\n sys.exit(1)\n pwd = os.getcwd( )\n cfg_dir = os.path.dirname(cfg_file)\n if cfg_dir and os.getcwd( ) != cfg_dir:\n os.chdir(os.path.dirname(cfg_file))\n self.config = config.Config.Read(cfg_file)", "metadata": "root.ConfigApp.read_config", "header": "['class', 'ConfigApp', '(', 'Base', ')', ':', '___EOS___']", "index": 59 }, { "content": " def create_git_commit (self):\n self.git_repo( )\n if self.repo.is_dirty( ) or self.repo.index.diff(None):\n # replicate commit -a, automatically add any changed paths\n # should help\n # https://github.com/openaps/openaps/issues/87\n diffs = self.repo.index.diff(None)\n for diff in diffs:\n self.repo.git.add([diff.b_path], write_extension_data=False)\n git = self.repo.git\n msg = \"\"\"{0:s} {1:s}\n\n TODO: better change descriptions\n {2:s}\n \"\"\".format(self.parser.prog, ' '.join(sys.argv[1:]), ' '.join(sys.argv))\n # https://github.com/gitpython-developers/GitPython/issues/265\n # git.commit('-avm', msg)\n self.repo.index.commit(msg)\n self.repo.git.gc(auto=True)", "metadata": "root.ConfigApp.create_git_commit", "header": "['class', 'ConfigApp', '(', 'Base', ')', ':', '___EOS___']", "index": 80 } ]
[ { "span": "pwd ", "start_line": 64, "start_column": 4, "end_line": 64, "end_column": 7 }, { "span": "git ", "start_line": 89, "start_column": 6, "end_line": 89, "end_column": 9 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "Config", "App_", "(_", "Base_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "read", "\\u", "config_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cfg", "\\u", "file_", "=_", "os_", "._", "environ_", "._", "get_", "(_", "'", "OPEN", "APS", "\\u", "CONFIG", "'_", ",_", "'", "opena", "ps", ".", "ini", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "os_", "._", "path_", "._", "exists_", "(_", "cfg", "\\u", "file_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "\"", "Not", " ", "an", " ", "opena", "ps", " ", "environ", "ment", ",", " ", "run", ":", " ", "opena", "ps", " ", "init", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "exit_", "(_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "pwd_", "=_", "os_", "._", "getcwd_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cfg", "\\u", "dir_", "=_", "os_", "._", "path_", "._", "dirname_", "(_", "cfg", "\\u", "file_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "cfg", "\\u", "dir_", "and_", "os_", "._", "getcwd_", "(_", ")_", "!=_", "cfg", "\\u", "dir_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "os_", "._", "chdir_", "(_", "os_", "._", "path_", "._", "dirname_", "(_", "cfg", "\\u", "file_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "config_", "=_", "config_", "._", "Config_", "._", "Read_", "(_", "cfg", "\\u", "file_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Config", "App_", "(_", "Base_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "create", "\\u", "git", "\\u", "commit_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "git", "\\u", "repo_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "repo_", "._", "is", "\\u", "dirty_", "(_", ")_", "or_", "self_", "._", "repo_", "._", "index_", "._", "diff_", "(_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "replicate", " ", "commit", " ", "-", "a", ",", " ", "automati", "call", "y", " ", "add", " ", "any", " ", "change", "d", " ", "paths_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "shou", "ld", " ", "help_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "https", "://", "git", "hub", ".", "com", "/", "opena", "ps", "/", "opena", "ps", "/", "issue", "s", "/", "87_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "diffs_", "=_", "self_", "._", "repo_", "._", "index_", "._", "diff_", "(_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "diff_", "in_", "diffs_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "repo_", "._", "git_", "._", "add_", "(_", "[_", "diff_", "._", "b", "\\u", "path_", "]_", ",_", "write", "\\u", "extensi", "on", "\\u", "data_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "git_", "=_", "self_", "._", "repo_", "._", "git_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "msg_", "=_", "\"\"\"{", "0", ":", "s", "}", " ", "{", "1", ":", "s", "}", "\\", "10", ";", "\\", "10", ";", " ", " ", "TOD", "O", ":", " ", "bett", "er", " ", "change", " ", "description", "s", "\\", "10", ";", " ", " ", "{", "2", ":", "s", "}", "\\", "10", ";", " ", " ", "\"\"\"_", "._", "format_", "(_", "self_", "._", "parser_", "._", "prog_", ",_", "'", " ", "'_", "._", "join_", "(_", "sys_", "._", "argv_", "[_", "1_", ":_", "]_", ")_", ",_", "'", " ", "'_", "._", "join_", "(_", "sys_", "._", "argv_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "https", "://", "git", "hub", ".", "com", "/", "git", "python", "-", "developer", "s", "/", "Git", "Pyth", "on", "/", "issue", "s", "/", "265_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "git", ".", "commit", "('", "-", "av", "m", "',", " ", "msg", ")_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "repo_", "._", "index_", "._", "commit_", "(_", "msg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "repo_", "._", "git_", "._", "gc_", "(_", "auto_", "=_", "True_", ")_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Imprecise assert
ImageEngine/gaffer/python/GafferImageTest/CopyImageMetadataTest.py
[ { "content": "\tdef testOverwrite( self ) :\n\n\t\tr = GafferImage.ImageReader()\n\t\tr[\"fileName\"].setValue( self.checkerFile )\n\t\tinMetadata = r[\"out\"][\"metadata\"].getValue()\n\n\t\ta = GafferImage.ImageMetadata()\n\t\ta[\"metadata\"].addMember( \"compression\", IECore.StringData( \"extraFancyCompressor\" ) )\n\n\t\tm = GafferImage.CopyImageMetadata()\n\t\tm[\"in\"].setInput( r[\"out\"] )\n\t\tm[\"copyFrom\"].setInput( a[\"out\"] )\n\n\t\t# check that the image is passed through\n\n\t\tm[\"names\"].setValue( \"\" )\n\t\tmetadata = m[\"out\"][\"metadata\"].getValue()\n\t\tself.assertEqual( metadata[\"compression\"], IECore.StringData( \"zips\" ) )\n\t\tself.assertEqual( m[\"out\"][\"metadata\"].getValue(), inMetadata )\n\t\tself.assertEqual( m[\"out\"].image(), r[\"out\"].image() )\n\n\t\t# check that we can overwrite certain metadata\n\n\t\tm[\"names\"].setValue( \"compression\" )\n\t\tmetadata = m[\"out\"][\"metadata\"].getValue()\n\t\tself.assertTrue( \"compression\" in metadata.keys() )\n\t\tself.assertEqual( metadata[\"compression\"], IECore.StringData( \"extraFancyCompressor\" ) )", "metadata": "root.CopyImageMetadataTest.testOverwrite", "header": "['class', 'CopyImageMetadataTest', '(', 'GafferImageTest', '.', 'ImageTestCase', ')', ':', '___EOS___']", "index": 88 }, { "content": "\tdef testDirtyPropogation( self ) :\n\n\t\tc = GafferImage.Constant()\n\t\tr = GafferImage.ImageReader()\n\t\tr[\"fileName\"].setValue( self.checkerFile )\n\t\tinMetadata = r[\"out\"][\"metadata\"].getValue()\n\n\t\tm = GafferImage.CopyImageMetadata()\n\t\tm[\"in\"].setInput( c[\"out\"] )\n\t\tm[\"copyFrom\"].setInput( r[\"out\"] )\n\n\t\tcs = GafferTest.CapturingSlot( m.plugDirtiedSignal() )\n\n\t\tm[\"copyFrom\"].setInput( c[\"out\"] )\n\t\tself.assertTrue( m[\"out\"][\"metadata\"] in set( e[0] for e in cs ) )\n\n\t\tdel cs[:]\n\n\t\tm[\"names\"].setValue( \"test\" )\n\t\tself.assertTrue( m[\"out\"][\"metadata\"] in set( e[0] for e in cs ) )\n\n\t\tdel cs[:]\n\n\t\tm[\"invertNames\"].setValue( True )\n\t\tself.assertTrue( m[\"out\"][\"metadata\"] in set( e[0] for e in cs ) )", "metadata": "root.CopyImageMetadataTest.testDirtyPropogation", "header": "['class', 'CopyImageMetadataTest', '(', 'GafferImageTest', '.', 'ImageTestCase', ')', ':', '___EOS___']", "index": 116 } ]
[ { "span": "self.assertTrue( \"compression\" in metadata.keys() )", "start_line": 113, "start_column": 2, "end_line": 113, "end_column": 53 }, { "span": "self.assertTrue( m[\"out\"][\"metadata\"] in set( e[0] for e in cs ) )", "start_line": 130, "start_column": 2, "end_line": 130, "end_column": 68 }, { "span": "self.assertTrue( m[\"out\"][\"metadata\"] in set( e[0] for e in cs ) )", "start_line": 135, "start_column": 2, "end_line": 135, "end_column": 68 }, { "span": "self.assertTrue( m[\"out\"][\"metadata\"] in set( e[0] for e in cs ) )", "start_line": 140, "start_column": 2, "end_line": 140, "end_column": 68 } ]
[]
1
true
[ "[CLS]_", "Imp", "reci", "se_", "assert_", "[SEP]_", "class_", "Copy", "Image", "Meta", "data", "Test_", "(_", "Ga", "ffer", "Image", "Test_", "._", "Image", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Over", "write_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "r_", "=_", "Ga", "ffer", "Image_", "._", "Image", "Reader_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "r_", "[_", "\"", "file", "Name", "\"_", "]_", "._", "set", "Value_", "(_", "self_", "._", "checke", "r", "File_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "in", "Metadata_", "=_", "r_", "[_", "\"", "out", "\"_", "]_", "[_", "\"", "metadata", "\"_", "]_", "._", "get", "Value_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "a_", "=_", "Ga", "ffer", "Image_", "._", "Image", "Metadata_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "a_", "[_", "\"", "metadata", "\"_", "]_", "._", "add", "Member_", "(_", "\"", "compress", "ion", "\"_", ",_", "IE", "Core_", "._", "String", "Data_", "(_", "\"", "extra", "Fan", "cy", "Compress", "or", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "m_", "=_", "Ga", "ffer", "Image_", "._", "Copy", "Image", "Metadata_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "m_", "[_", "\"", "in", "\"_", "]_", "._", "set", "Input_", "(_", "r_", "[_", "\"", "out", "\"_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "m_", "[_", "\"", "copy", "Fro", "m", "\"_", "]_", "._", "set", "Input_", "(_", "a_", "[_", "\"", "out", "\"_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "check", " ", "tha", "t", " ", "the", " ", "image", " ", "is", " ", "pass", "ed", " ", "through_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "m_", "[_", "\"", "names", "\"_", "]_", "._", "set", "Value_", "(_", "\"\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "metadata_", "=_", "m_", "[_", "\"", "out", "\"_", "]_", "[_", "\"", "metadata", "\"_", "]_", "._", "get", "Value_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "metadata_", "[_", "\"", "compress", "ion", "\"_", "]_", ",_", "IE", "Core_", "._", "String", "Data_", "(_", "\"", "zip", "s", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "m_", "[_", "\"", "out", "\"_", "]_", "[_", "\"", "metadata", "\"_", "]_", "._", "get", "Value_", "(_", ")_", ",_", "in", "Metadata_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "m_", "[_", "\"", "out", "\"_", "]_", "._", "image_", "(_", ")_", ",_", "r_", "[_", "\"", "out", "\"_", "]_", "._", "image_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "check", " ", "tha", "t", " ", "we", " ", "can", " ", "overwrit", "e", " ", "cert", "ain", " ", "metadata_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "m_", "[_", "\"", "names", "\"_", "]_", "._", "set", "Value_", "(_", "\"", "compress", "ion", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "metadata_", "=_", "m_", "[_", "\"", "out", "\"_", "]_", "[_", "\"", "metadata", "\"_", "]_", "._", "get", "Value_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"", "compress", "ion", "\"_", "in_", "metadata_", "._", "keys_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "metadata_", "[_", "\"", "compress", "ion", "\"_", "]_", ",_", "IE", "Core_", "._", "String", "Data_", "(_", "\"", "extra", "Fan", "cy", "Compress", "or", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Copy", "Image", "Meta", "data", "Test_", "(_", "Ga", "ffer", "Image", "Test_", "._", "Image", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Dirty", "Prop", "oga", "tion_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "c_", "=_", "Ga", "ffer", "Image_", "._", "Constant_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "r_", "=_", "Ga", "ffer", "Image_", "._", "Image", "Reader_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "r_", "[_", "\"", "file", "Name", "\"_", "]_", "._", "set", "Value_", "(_", "self_", "._", "checke", "r", "File_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "in", "Metadata_", "=_", "r_", "[_", "\"", "out", "\"_", "]_", "[_", "\"", "metadata", "\"_", "]_", "._", "get", "Value_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "m_", "=_", "Ga", "ffer", "Image_", "._", "Copy", "Image", "Metadata_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "m_", "[_", "\"", "in", "\"_", "]_", "._", "set", "Input_", "(_", "c_", "[_", "\"", "out", "\"_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "m_", "[_", "\"", "copy", "Fro", "m", "\"_", "]_", "._", "set", "Input_", "(_", "r_", "[_", "\"", "out", "\"_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "cs_", "=_", "Ga", "ffer", "Test_", "._", "Captur", "ing", "Slot_", "(_", "m_", "._", "plug", "Dir", "tied", "Signal_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "m_", "[_", "\"", "copy", "Fro", "m", "\"_", "]_", "._", "set", "Input_", "(_", "c_", "[_", "\"", "out", "\"_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "m_", "[_", "\"", "out", "\"_", "]_", "[_", "\"", "metadata", "\"_", "]_", "in_", "set_", "(_", "e_", "[_", "0_", "]_", "for_", "e_", "in_", "cs_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "del_", "cs_", "[_", ":_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "m_", "[_", "\"", "names", "\"_", "]_", "._", "set", "Value_", "(_", "\"", "test", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "m_", "[_", "\"", "out", "\"_", "]_", "[_", "\"", "metadata", "\"_", "]_", "in_", "set_", "(_", "e_", "[_", "0_", "]_", "for_", "e_", "in_", "cs_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "del_", "cs_", "[_", ":_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "m_", "[_", "\"", "invert", "Names", "\"_", "]_", "._", "set", "Value_", "(_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "m_", "[_", "\"", "out", "\"_", "]_", "[_", "\"", "metadata", "\"_", "]_", "in_", "set_", "(_", "e_", "[_", "0_", "]_", "for_", "e_", "in_", "cs_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,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2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2 ]
Unused import
openelections/openelections-core/openelex/us/ms/datasource.py
[ { "content": "\"\"\"\nMississippi has CSV files containing precinct-level results for each county and all offices\nfor all years back to 2003. All of the files are pre-processed and available on Github at\nhttps://github.com/openelections/openelections-data-ms.\n\nFor regular primary and general elections, each county has a results file. Special and runoff\nelections for non-statewide offices are contained in a single file for each office.\n\"\"\"\nfrom os.path import join\nimport json\nimport datetime\nimport urlparse\n\nfrom openelex import PROJECT_ROOT\nfrom openelex.base.datasource import BaseDatasource\nfrom openelex.lib import build_raw_github_url\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class Datasource(BaseDatasource):\n\n # PUBLIC INTERFACE\n\n\n\n\n\n # PRIVATE METHODS\n\n\n\n", "metadata": "root.Datasource", "header": "['module', '___EOS___']", "index": 17 }, { "content": " def mappings(self, year=None):\n \"\"\"Return array of dicts containing source url and\n standardized filename for raw results file, along\n with other pieces of metadata\n \"\"\"\n mappings = []\n for yr, elecs in self.elections(year).items():\n mappings.extend(self._build_metadata(yr, elecs))\n return mappings", "metadata": "root.Datasource.mappings", "header": "['class', 'Datasource', '(', 'BaseDatasource', ')', ':', '___NEWLINE___', '___NL___', '# PUBLIC INTERFACE', '___NL___', '___EOS___']", "index": 20 }, { "content": " def target_urls(self, year=None):\n \"Get list of source data urls, optionally filtered by year\"\n return [item['raw_url'] for item in self.mappings(year)]", "metadata": "root.Datasource.target_urls", "header": "['class', 'Datasource', '(', 'BaseDatasource', ')', ':', '___NEWLINE___', '___NL___', '# PUBLIC INTERFACE', '___NL___', '___EOS___']", "index": 30 }, { "content": " def filename_url_pairs(self, year=None):\n return [(mapping['generated_filename'], self._url_for_fetch(mapping))\n for mapping in self.mappings(year)]", "metadata": "root.Datasource.filename_url_pairs", "header": "['class', 'Datasource', '(', 'BaseDatasource', ')', ':', '___NEWLINE___', '___NL___', '# PUBLIC INTERFACE', '___NL___', '___EOS___']", "index": 34 }, { "content": " def _url_for_fetch(self, mapping):\n try:\n return mapping['pre_processed_url']\n except KeyError:\n return mapping['raw_url']", "metadata": "root.Datasource._url_for_fetch", "header": "['class', 'Datasource', '(', 'BaseDatasource', ')', ':', '___NEWLINE___', '___NL___', '# PUBLIC INTERFACE', '___NL___', '___EOS___']", "index": 38 }, { "content": " def mappings_for_url(self, url):\n return [mapping for mapping in self.mappings() if mapping['raw_url'] == url]", "metadata": "root.Datasource.mappings_for_url", "header": "['class', 'Datasource', '(', 'BaseDatasource', ')', ':', '___NEWLINE___', '___NL___', '# PUBLIC INTERFACE', '___NL___', '___EOS___']", "index": 44 }, { "content": " def _build_metadata(self, year, elections):\n meta = []\n year_int = int(year)\n for election in elections:\n if 'special' in election['slug']:\n results = [x for x in self._url_paths() if x['date'] == election['start_date'] and x['special'] == True]\n for result in results:\n generated_filename = result['path']\n if result['county']:\n ocd_id = 'ocd-division/country:us/state:ms/county:' + result['county'].replace(' ','_').lower()\n else:\n ocd_id = 'ocd-division/country:us/state:ms'\n meta.append({\n \"generated_filename\": generated_filename,\n \"raw_url\": result['url'],\n \"pre_processed_url\": build_raw_github_url(self.state, str(year), result['path']),\n \"ocd_id\": ocd_id,\n \"name\": 'Mississippi',\n \"election\": election['slug']\n })\n else:\n # primary, general and runoff statewide elections have 1 or 2 files per county\n # some general runoffs will have smaller numbers of files\n results = [x for x in self._url_paths() if x['date'] == election['start_date'] and x['special'] == False]\n for result in results:\n county = [c for c in self._jurisdictions() if c['county'] == result['county']][0]\n generated_filename = self._generate_county_filename(election['start_date'], result)\n meta.append({\n \"generated_filename\": generated_filename,\n \"raw_url\": result['url'],\n \"pre_processed_url\": build_raw_github_url(self.state, str(year), result['path']),\n \"ocd_id\": county['ocd_id'],\n \"name\": result['county'],\n \"election\": election['slug']\n })\n return meta", "metadata": "root.Datasource._build_metadata", "header": "['class', 'Datasource', '(', 'BaseDatasource', ')', ':', '___NEWLINE___', '___NL___', '# PUBLIC INTERFACE', '___NL___', '___EOS___']", "index": 49 }, { "content": " def _generate_county_filename(self, start_date, result):\n bits = [\n start_date.replace('-',''),\n self.state,\n ]\n if result['party']:\n bits.append(result['party'].lower())\n bits.extend([\n result['race_type'].lower(),\n result['county'].replace(' ','_').lower()\n ])\n bits.append('precinct')\n filename = \"__\".join(bits) + '.csv'\n return filename", "metadata": "root.Datasource._generate_county_filename", "header": "['class', 'Datasource', '(', 'BaseDatasource', ')', ':', '___NEWLINE___', '___NL___', '# PUBLIC INTERFACE', '___NL___', '___EOS___']", "index": 86 }, { "content": " def _jurisdictions(self):\n \"\"\"Mississippi counties\"\"\"\n m = self.jurisdiction_mappings()\n mappings = [x for x in m if x['county'] != \"\"]\n return mappings", "metadata": "root.Datasource._jurisdictions", "header": "['class', 'Datasource', '(', 'BaseDatasource', ')', ':', '___NEWLINE___', '___NL___', '# PUBLIC INTERFACE', '___NL___', '___EOS___']", "index": 101 }, { "content": " def _url_for_fetch(self, mapping):\n if mapping['pre_processed_url']:\n return mapping['pre_processed_url']\n else:\n return mapping['raw_url']", "metadata": "root.Datasource._url_for_fetch", "header": "['class', 'Datasource', '(', 'BaseDatasource', ')', ':', '___NEWLINE___', '___NL___', '# PUBLIC INTERFACE', '___NL___', '___EOS___']", "index": 107 } ]
[ { "span": "from os.path import join", "start_line": 8, "start_column": 0, "end_line": 8, "end_column": 24 }, { "span": "import json", "start_line": 9, "start_column": 0, "end_line": 9, "end_column": 11 }, { "span": "import datetime", "start_line": 10, "start_column": 0, "end_line": 10, "end_column": 15 }, { "span": "import urlparse", "start_line": 11, "start_column": 0, "end_line": 11, "end_column": 15 }, { "span": "from openelex import PROJECT_ROOT", "start_line": 13, "start_column": 0, "end_line": 13, "end_column": 33 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\"\"\"", "\\", "10", ";", "Miss", "iss", "ipp", "i", " ", "has", " ", "CSV", " ", "files", " ", "contain", "ing", " ", "preci", "nct", "-", "level", " ", "results", " ", "for", " ", "each", " ", "county", " ", "and", " ", "all", " ", "office", "s", "\\", "10", ";", "for", " ", "all", " ", "year", "s", " ", "back", " ", "to", " ", "2003", ".", " ", "All", " ", "of", " ", "the", " ", "files", " ", "are", " ", "pre", "-", "process", "ed", " ", "and", " ", "avail", "able", " ", "on", " ", "Git", "hub", " ", "at", "\\", "10", ";", "https", "://", "git", "hub", ".", "com", "/", "opene", "lection", "s", "/", "opene", "lection", "s", "-", "data", "-", "ms", ".", "\\", "10", ";", "\\", "10", ";", "For", " ", "regular", " ", "primary", " ", "and", " ", "genera", "l", " ", "election", "s", ",", " ", "each", " ", "county", " ", "has", " ", "a", " ", "results", " ", "file", ".", " ", "Special", " ", "and", " ", "run", "off", "\\", "10", ";", "election", "s", " ", "for", " ", "non", "-", "state", "wide", " ", "office", "s", " ", "are", " ", "contain", "ed", " ", "in", " ", "a", " ", "single", " ", "file", " ", "for", " ", "each", " ", "office", ".", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "os_", "._", "path_", "import_", "join_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "json_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "datetime_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "urlparse_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "opene", "lex_", "import_", "PROJECT", "\\u", "ROOT_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "opene", "lex_", "._", "base_", "._", "datasource_", "import_", "Base", "Datas", "ource_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "opene", "lex_", "._", "lib_", "import_", "build", "\\u", "raw", "\\u", "git", "hub", "\\u", "url_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Datas", "ource_", "(_", "Base", "Datas", "ource_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "PUBLIC", " ", "INTERFACE_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "PRIVATE", " ", "METHODS_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Datas", "ource_", "(_", "Base", "Datas", "ource_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "PUBLIC", " ", "INTERFACE_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "mappings_", "(_", "self_", ",_", "year_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Return", " ", "array", " ", "of", " ", "dict", "s", " ", "contain", "ing", " ", "source", " ", "url", " ", "and", "\\", "10", ";", " ", " ", " ", " ", "standardize", "d", " ", "filename", " ", "for", " ", "raw", " ", "results", " ", "file", ",", " ", "along", "\\", "10", ";", " ", " ", " ", " ", "with", " ", "other", " ", "piece", "s", " ", "of", " ", "metadata", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mappings_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "yr_", ",_", "elec", "s_", "in_", "self_", "._", "election", "s_", "(_", "year_", ")_", "._", "items_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "mappings_", "._", "extend_", "(_", "self_", "._", "\\u", "build", "\\u", "metadata_", "(_", "yr_", ",_", "elec", "s_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "mappings_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Datas", "ource_", "(_", "Base", "Datas", "ource_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "PUBLIC", " ", "INTERFACE_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "target", "\\u", "urls_", "(_", "self_", ",_", "year_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"", "Get", " ", "list", " ", "of", " ", "source", " ", "data", " ", "urls", ",", " ", "option", "ally", " ", "filter", "ed", " ", "by", " ", "year", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "[_", "item_", "[_", "'", "raw", "\\u", "url", "'_", "]_", "for_", "item_", "in_", "self_", "._", "mappings_", "(_", "year_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Datas", "ource_", "(_", "Base", "Datas", "ource_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "PUBLIC", " ", "INTERFACE_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "filename", "\\u", "url", "\\u", "pairs_", "(_", "self_", ",_", "year_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "[_", "(_", "mapping_", "[_", "'", "generat", "ed", "\\u", "filename", "'_", "]_", ",_", "self_", "._", "\\u", "url", "\\u", "for", "\\u", "fetch_", "(_", "mapping_", ")_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "mapping_", "in_", "self_", "._", "mappings_", "(_", "year_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Datas", "ource_", "(_", "Base", "Datas", "ource_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "PUBLIC", " ", "INTERFACE_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "url", "\\u", "for", "\\u", "fetch_", "(_", "self_", ",_", "mapping_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "mapping_", "[_", "'", "pre", "\\u", "process", "ed", "\\u", "url", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Key", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "mapping_", "[_", "'", "raw", "\\u", "url", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Datas", "ource_", "(_", "Base", "Datas", "ource_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "PUBLIC", " ", "INTERFACE_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "mapping", "s", "\\u", "for", "\\u", "url_", "(_", "self_", ",_", "url_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "[_", "mapping_", "for_", "mapping_", "in_", "self_", "._", "mappings_", "(_", ")_", "if_", "mapping_", "[_", "'", "raw", "\\u", "url", "'_", "]_", "==_", "url_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Datas", "ource_", "(_", "Base", "Datas", "ource_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "PUBLIC", " ", "INTERFACE_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "build", "\\u", "metadata_", "(_", "self_", ",_", "year_", ",_", "election", "s_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "meta_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "year", "\\u", "int_", "=_", "int_", "(_", "year_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "election_", "in_", "election", "s_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "'", "special", "'_", "in_", "election_", "[_", "'", "slug", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "results_", "=_", "[_", "x_", "for_", "x_", "in_", "self_", "._", "\\u", "url", "\\u", "paths_", "(_", ")_", "if_", "x_", "[_", "'", "date", "'_", "]_", "==_", "election_", "[_", "'", "start", "\\u", "date", "'_", "]_", "and_", "x_", "[_", "'", "special", "'_", "]_", "==_", "True_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "result_", "in_", "results_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "generat", "ed", "\\u", "filename_", "=_", "result_", "[_", "'", "path", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "result_", "[_", "'", "county", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "oc", "d\\u", "id_", "=_", "'", "oc", "d", "-", "divisi", "on", "/", "countr", "y", ":", "us", "/", "state", ":", "ms", "/", "county", ":'_", "+_", "result_", "[_", "'", "county", "'_", "]_", "._", "replace_", "(_", "'", " ", "'_", ",_", "'\\u'_", ")_", "._", "lower_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "oc", "d\\u", "id_", "=_", "'", "oc", "d", "-", "divisi", "on", "/", "countr", "y", ":", "us", "/", "state", ":", "ms", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "meta_", "._", "append_", "(_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "generat", "ed", "\\u", "filename", "\"_", ":_", "generat", "ed", "\\u", "filename_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "raw", "\\u", "url", "\"_", ":_", "result_", "[_", "'", "url", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "pre", "\\u", "process", "ed", "\\u", "url", "\"_", ":_", "build", "\\u", "raw", "\\u", "git", "hub", "\\u", "url_", "(_", "self_", "._", "state_", ",_", "str_", "(_", "year_", ")_", ",_", "result_", "[_", "'", "path", "'_", "]_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "oc", "d\\u", "id", "\"_", ":_", "oc", "d\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "name", "\"_", ":_", "'", "Miss", "iss", "ipp", "i", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "election", "\"_", ":_", "election_", "[_", "'", "slug", "'_", "]_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "primary", ",", " ", "genera", "l", " ", "and", " ", "run", "off", " ", "state", "wide", " ", "election", "s", " ", "have", " ", "1", " ", "or", " ", "2", " ", "files", " ", "per", " ", "county", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "some", " ", "genera", "l", " ", "run", "offs", " ", "will", " ", "have", " ", "small", "er", " ", "numbers", " ", "of", " ", "files_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "results_", "=_", "[_", "x_", "for_", "x_", "in_", "self_", "._", "\\u", "url", "\\u", "paths_", "(_", ")_", "if_", "x_", "[_", "'", "date", "'_", "]_", "==_", "election_", "[_", "'", "start", "\\u", "date", "'_", "]_", "and_", "x_", "[_", "'", "special", "'_", "]_", "==_", "False_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "result_", "in_", "results_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "county", "_", "=_", "[_", "c_", "for_", "c_", "in_", "self_", "._", "\\u", "jur", "isdi", "ctions", "_", "(_", ")_", "if_", "c_", "[_", "'", "county", "'_", "]_", "==_", "result_", "[_", "'", "county", "'_", "]_", "]_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "generat", "ed", "\\u", "filename_", "=_", "self_", "._", "\\u", "generat", "e\\u", "county", "\\u", "filename_", "(_", "election_", "[_", "'", "start", "\\u", "date", "'_", "]_", ",_", "result_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "meta_", "._", "append_", "(_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "generat", "ed", "\\u", "filename", "\"_", ":_", "generat", "ed", "\\u", "filename_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "raw", "\\u", "url", "\"_", ":_", "result_", "[_", "'", "url", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "pre", "\\u", "process", "ed", "\\u", "url", "\"_", ":_", "build", "\\u", "raw", "\\u", "git", "hub", "\\u", "url_", "(_", "self_", "._", "state_", ",_", "str_", "(_", "year_", ")_", ",_", "result_", "[_", "'", "path", "'_", "]_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "oc", "d\\u", "id", "\"_", ":_", "county", "_", "[_", "'", "oc", "d\\u", "id", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "name", "\"_", ":_", "result_", "[_", "'", "county", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "election", "\"_", ":_", "election_", "[_", "'", "slug", "'_", "]_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "meta_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Datas", "ource_", "(_", "Base", "Datas", "ource_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "PUBLIC", " ", "INTERFACE_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "generat", "e\\u", "county", "\\u", "filename_", "(_", "self_", ",_", "start", "\\u", "date_", ",_", "result_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "bits_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "start", "\\u", "date_", "._", "replace_", "(_", "'-'_", ",_", "''_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "state_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "result_", "[_", "'", "part", "y", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "bits_", "._", "append_", "(_", "result_", "[_", "'", "part", "y", "'_", "]_", "._", "lower_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "bits_", "._", "extend_", "(_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "result_", "[_", "'", "race", "\\u", "type", "'_", "]_", "._", "lower_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "result_", "[_", "'", "county", "'_", "]_", "._", "replace_", "(_", "'", " ", "'_", ",_", "'\\u'_", ")_", "._", "lower_", "(_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bits_", "._", "append_", "(_", "'", "preci", "nct", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "filename_", "=_", "\"\\u\\u", "\"_", "._", "join_", "(_", "bits_", ")_", "+_", "'.", "csv", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "filename_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Datas", "ource_", "(_", "Base", "Datas", "ource_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "PUBLIC", " ", "INTERFACE_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "jur", "isdi", "ctions", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Miss", "iss", "ipp", "i", " ", "counti", "es", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "m_", "=_", "self_", "._", "jur", "isdi", "ction", "\\u", "mappings_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mappings_", "=_", "[_", "x_", "for_", "x_", "in_", "m_", "if_", "x_", "[_", "'", "county", "'_", "]_", "!=_", "\"\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "mappings_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Datas", "ource_", "(_", "Base", "Datas", "ource_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "PUBLIC", " ", "INTERFACE_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "url", "\\u", "for", "\\u", "fetch_", "(_", "self_", ",_", "mapping_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "mapping_", "[_", "'", "pre", "\\u", "process", "ed", "\\u", "url", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "mapping_", "[_", "'", "pre", "\\u", "process", "ed", "\\u", "url", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "mapping_", "[_", "'", "raw", "\\u", "url", "'_", "]_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 2, 0, 1, 2, 0, 1, 2, 0, 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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
viewfinderco/viewfinder/backend/resources/calendar.py
[ { "content": "# Copyright 2012 Viewfinder Inc. All Rights Reserved.\n\n\"\"\"Calendar datamodel.\n\nCalendars provide color to a chronology such as the Viewfinder search/\nbrowse tool.\n\nCalendars are parsed from the \"resources/calendars/\" subdirectory on\ndemand and cached.\n\nTODO(spencer): this is a very rough beginning meant to capture\nlocale-specific holidays. We use here the holiday calendars provided\nby Mozilla. The idea in general is to provide an interface to\narbitrary calendars, such as the wealth of calendars available via\nGoogle's calendar app.\n\"\"\"\n\n__author__ = '[email protected] (Spencer Kimball)'\n\nimport datetime\nimport dateutil\nimport logging\nimport os\nimport time\nimport vobject\n\nfrom functools import partial\nfrom viewfinder.backend.base import util\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class Calendar(object):\n \"\"\"Interface to loading ICS iCalendar calendar data.\"\"\"\n _RESOURCES_CALENDARS_FMT = '../../resources/calendars/%s'\n _DEFAULT_CALENDAR_ID = 'USHolidays.ics'\n\n \"\"\"Mapping from locale to holidays calendar.\"\"\"\n _locale_to_holiday_calendar_map = {\n 'ar_DZ': 'AlgeriaHolidays.ics',\n 'es_AR': 'ArgentinaHolidays.ics',\n 'en_AU': 'AustraliaHolidays.ics',\n 'de_AT': 'AustrianHolidays.ics',\n 'eu_ES': 'BasqueHolidays.ics',\n 'nl_BE': 'BelgianDutchHolidays.ics',\n 'fr_BE': 'BelgianFrenchHolidays.ics',\n 'de_BE': 'BelgianHolidays.ics',\n 'es_BO': 'BoliviaHolidays.ics',\n 'pt_BR': 'BrazilHolidays.ics',\n 'bg_BG': 'BulgarianHolidays.ics',\n 'en_CA': 'CanadaHolidays.ics',\n 'es_CL': 'ChileHolidays.ics',\n 'zh_CN': 'ChinaHolidays.ics',\n 'es_CO': 'ColombianHolidays.ics',\n 'hr_HR': 'CroatiaHolidays.ics',\n 'cs_CZ': 'CzechHolidays.ics',\n 'da_DK': 'DanishHolidays.ics',\n 'be_NL': 'DutchHolidays.ics',\n 'nl_NL': 'DutchHolidays.ics',\n 'en_GB': 'EnglishHolidays.ics',\n 'et_EE': 'EstoniaHolidays.ics',\n 'fi_FI': 'FinlandHolidays.ics',\n 'sv_FI': 'FinlandHolidays.ics',\n 'fr_FR': 'FrenchHolidays.ics',\n 'fy_NL': 'FrisianHolidays.ics',\n 'de_DE': 'GermanHolidays.ics',\n 'en_HK': 'HongKongHolidays.ics',\n 'zh_HK': 'HongKongHolidays.ics',\n 'hu_HU': 'HungarianHolidays.ics',\n 'is_IS': 'IcelandHolidays.ics',\n 'id_ID': 'IndonesianHolidays.ics',\n 'it_IT': 'ItalianHolidays.ics',\n 'ja_JP': 'JapanHolidays.ics',\n 'sw_KE': 'KenyaHolidays.ics',\n 'so_KE': 'KenyaHolidays.ics',\n 'om_KE': 'KenyaHolidays.ics',\n 'kam_KE': 'KenyaHolidays.ics',\n 'lv_LV': 'LatviaHolidays.ics',\n 'lt_LT': 'LithuanianHolidays.ics',\n 'de_LU': 'LuxembourgHolidays.ics',\n 'fr_LU': 'LuxembourgHolidays.ics',\n 'en_NZ': 'NewZealandHolidays.ics',\n 'mi_NZ': 'NewZealandHolidays.ics',\n 'nb_NO': 'NorwegianHolidays.ics',\n 'en_PK': 'PakistanHolidays.ics',\n 'pa_Arab_PK': 'PakistanHolidays.ics',\n 'pa_PK': 'PakistanHolidays.ics',\n 'ur_PK': 'PakistanHolidays.ics',\n 'es_PE': 'PeruHolidays.ics',\n 'pl_PL': 'PolishHolidays.ics',\n 'pt_PT': 'PortugalHolidays.ics',\n 'en_QLD': 'QueenslandHolidays.ics',\n 'en_AU_QLD': 'QueenslandHolidays.ics',\n 'ro_MD': 'RomaniaHolidays.ics',\n 'ro_RO': 'RomaniaHolidays.ics',\n 'ru_RU': 'RussiaHolidays.ics',\n 'ru_UA': 'RussiaHolidays.ics',\n 'uk_UA': 'RussiaHolidays.ics',\n 'en_SG': 'SingaporeHolidays.ics',\n 'zh_Hans_SG': 'SingaporeHolidays.ics',\n 'zh_SG': 'SingaporeHolidays.ics',\n 'sk_SK': 'SlovakHolidays.ics',\n 'af_ZA': 'SouthAfricaHolidays.ics',\n 'en_ZA': 'SouthAfricaHolidays.ics',\n 'nr_ZA': 'SouthAfricaHolidays.ics',\n 'nso_ZA': 'SouthAfricaHolidays.ics',\n 'ss_ZA': 'SouthAfricaHolidays.ics',\n 'st_ZA': 'SouthAfricaHolidays.ics',\n 'tn_ZA': 'SouthAfricaHolidays.ics',\n 'ts_ZA': 'SouthAfricaHolidays.ics',\n 've_ZA': 'SouthAfricaHolidays.ics',\n 'xh_ZA': 'SouthAfricaHolidays.ics',\n 'zu_ZA': 'SouthAfricaHolidays.ics',\n 'ko_KR': 'SouthKoreaHolidays.ics',\n 'es_ES': 'SpanishHolidays.ics',\n 'si_LK': 'SriLankaHolidays.ics',\n 'sv_SE': 'SwedishHolidays.ics',\n 'de_CH': 'SwissHolidays.ics',\n 'fr_CH': 'SwissHolidays.ics',\n 'gsw_CH': 'SwissHolidays.ics',\n 'it_CH': 'SwissHolidays.ics',\n 'trv_TW': 'TaiwanHolidays.ics',\n 'zh_Hant_TW': 'TaiwanHolidays.ics',\n 'zh_TW': 'TaiwanHolidays.ics',\n 'th_TH': 'ThaiHolidays.ics',\n 'ku_Latn_TR': 'TurkeyHolidays.ics',\n 'ku_TR': 'TurkeyHolidays.ics',\n 'tr_TR': 'TurkeyHolidays.ics',\n 'cy_GB': 'UKHolidays.ics',\n 'en_GB': 'UKHolidays.ics',\n 'gv_GB': 'UKHolidays.ics',\n 'kw_GB': 'UKHolidays.ics',\n 'en': 'USHolidays.ics',\n 'en_US': 'USHolidays.ics',\n 'es_US': 'USHolidays.ics',\n 'haw_US': 'USHolidays.ics',\n 'es_UY': 'UruguayHolidays.ics',\n 'vi_VN': 'VietnamHolidays.ics',\n }\n\n \"\"\"Cache for Calendar objects.\"\"\"\n _cache = dict()\n\n\n\n", "metadata": "root.Calendar", "header": "['module', '___EOS___']", "index": 29 }, { "content": " def __init__(self, calendar_id):\n \"\"\"Prepares a calendar for the specified 'calendar_id'.\n \"\"\"\n self.calendar_id = calendar_id\n cal_path = os.path.dirname(__file__)\n path = os.path.join(cal_path, Calendar._RESOURCES_CALENDARS_FMT % self.calendar_id)\n with open(path, 'rb') as f:\n self._cal = vobject.readOne(f)", "metadata": "root.Calendar.__init__", "header": "['class', 'Calendar', '(', 'object', ')', ':', '___EOS___']", "index": 140 }, { "content": " def GetEvents(self, year):\n \"\"\"Returns the events from the calendar for the year specified.\n In cases where the calendar does not span the requested year,\n throws a 'NoCalendarDataError' exception.\n \"\"\"\n events = []\n for event in self._cal.components():\n if event.name == 'VEVENT':\n name = event.summary.value\n if event.getrruleset():\n rruleset = event.getrruleset()\n dates = rruleset.between(datetime.datetime(year - 1, 12, 31),\n datetime.datetime(year + 1, 1, 1))\n if len(dates) >= 1:\n if len(dates) > 1:\n logging.warning('holiday %s occurs more than once a year: %r' % (name, dates))\n delta = event.dtend.value - event.dtstart.value\n dtstart = dates[0]\n dtend = dtstart + delta\n events.append({'name': name,\n 'dtstart': time.mktime(dtstart.timetuple()),\n 'dtend': time.mktime(dtend.timetuple())})\n else:\n dtstart = event.dtstart.value\n dtend = event.dtend.value\n if dtstart.year == year:\n events.append({'name': name,\n 'dtstart': time.mktime(dtstart.timetuple()),\n 'dtend': time.mktime(dtend.timetuple())})\n return events", "metadata": "root.Calendar.GetEvents", "header": "['class', 'Calendar', '(', 'object', ')', ':', '___EOS___']", "index": 149 }, { "content": " @classmethod\n def GetCalendar(cls, calendar_id=None):\n \"\"\"Attempts to locate a cached version of 'calendar_id'. If none is\n found, attempts to load from disk.\n \"\"\"\n calendar_id = calendar_id or Calendar._DEFAULT_CALENDAR_ID\n if not Calendar._cache.has_key(calendar_id):\n cal = Calendar(calendar_id)\n Calendar._cache[calendar_id] = cal\n return Calendar._cache[calendar_id]", "metadata": "root.Calendar.GetCalendar", "header": "['class', 'Calendar', '(', 'object', ')', ':', '___EOS___']", "index": 180 }, { "content": " @classmethod\n def GetHolidaysByLocale(cls, locale='en_US'):\n \"\"\"Attempts to match the specified locale with a holidays\n calendar. Normalizes the locale by replacing '-' with '_'.\n \"\"\"\n locale = locale.replace('-', '_')\n calendar_id = Calendar._locale_to_holiday_calendar_map.get(locale, None) or \\\n Calendar._DEFAULT_CALENDAR_ID\n return Calendar.GetCalendar(calendar_id)", "metadata": "root.Calendar.GetHolidaysByLocale", "header": "['class', 'Calendar', '(', 'object', ')', ':', '___EOS___']", "index": 191 } ]
[ { "span": "import dateutil", "start_line": 20, "start_column": 0, "end_line": 20, "end_column": 15 }, { "span": "from functools import partial", "start_line": 26, "start_column": 0, "end_line": 26, "end_column": 29 }, { "span": "from viewfinder.backend.base import util", "start_line": 27, "start_column": 0, "end_line": 27, "end_column": 40 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "Copy", "right", " ", "2012", " ", "View", "finde", "r", " ", "Inc", ".", " ", "All", " ", "Rig", "hts", " ", "Reserve", "d", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\"\"\"", "Cal", "enda", "r", " ", "datamo", "del", ".", "\\", "10", ";", "\\", "10", ";", "Cal", "enda", "rs", " ", "provide", " ", "color", " ", "to", " ", "a", " ", "chrono", "log", "y", " ", "suc", "h", " ", "as", " ", "the", " ", "View", "finde", "r", " ", "search", "/", "\\", "10", ";", "browse", " ", "tool", ".", "\\", "10", ";", "\\", "10", ";", "Cal", "enda", "rs", " ", "are", " ", "parsed", " ", "from", " ", "the", " ", "\"", "resource", "s", "/", "calendar", "s", "/\"", " ", "subdirectory", " ", "on", "\\", "10", ";", "demand", " ", "and", " ", "cache", "d", ".", "\\", "10", ";", "\\", "10", ";", "TOD", "O", "(", "spe", "nce", "r", "):", " ", "this", " ", "is", " ", "a", " ", "very", " ", "rough", " ", "beginn", "ing", " ", "mean", "t", " ", "to", " ", "captur", "e", "\\", "10", ";", "locale", "-", "specific", " ", "holiday", "s", ".", " ", "We", " ", "use", " ", "here", " ", "the", " ", "holiday", " ", "calendar", "s", " ", "provided", "\\", "10", ";", "by", " ", "Mo", "zilla", ".", " ", "The", " ", "idea", " ", "in", " ", "genera", "l", " ", "is", " ", "to", " ", "provide", " ", "an", " ", "interface", " ", "to", "\\", "10", ";", "arbitra", "ry", " ", "calendar", "s", ",", " ", "suc", "h", " ", "as", " ", "the", " ", "wea", "lth", " ", "of", " ", "calendar", "s", " ", "avail", "able", " ", "via", "\\", "10", ";", "Goo", "gle", "'", "s", " ", "calendar", " ", "app", ".", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u", "author\\u\\u_", "=_", "'", "spe", "nce", "r", "@", "email", "scrub", "bed", ".", "com", " ", "(", "Spe", "nce", "r", " ", "Ki", "mba", "ll", ")'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "datetime_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "dateutil_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "logging_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "time_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "vob", "ject_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "functools_", "import_", "partial_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "view", "finder_", "._", "backend_", "._", "base_", "import_", "util_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Calendar_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Interface", " ", "to", " ", "load", "ing", " ", "ICS", " ", "i", "Cal", "enda", "r", " ", "calendar", " ", "data", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "RESOURCES", "\\u", "CALENDAR", "S", "\\u", "FMT_", "=_", "'../../", "resource", "s", "/", "calendar", "s", "/", "%", "s", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "DEF", "AUL", "T", "\\u", "CALENDAR", "\\u", "ID_", "=_", "'", "US", "Hol", "ida", "ys", ".", "ics", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\"\"\"", "Map", "ping", " ", "from", " ", "locale", " ", "to", " ", "holiday", "s", " ", "calendar", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "locale", "\\u", "to", "\\u", "holiday", "\\u", "calendar", "\\u", "map_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "ar", "\\u", "DZ", "'_", ":_", "'", "Alg", "eria", "Hol", "ida", "ys", ".", "ics", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "es", "\\u", "AR", "'_", ":_", "'", "Argent", "ina", "Hol", "ida", "ys", ".", "ics", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "en", "\\u", "AU", "'_", ":_", "'", "Aust", "ral", "ia", "Hol", "ida", "ys", ".", "ics", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "de", "\\u", "AT", "'_", ":_", "'", "Aust", "rian", "Hol", "ida", "ys", ".", "ics", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "eu", "\\u", "ES", "'_", ":_", "'", "Bas", "que", "Hol", "ida", "ys", ".", "ics", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "nl", "\\u", "BE", "'_", ":_", "'", "Bel", "gian", "Dut", "ch", "Hol", "ida", "ys", ".", "ics", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "fr", "\\u", "BE", "'_", ":_", "'", "Bel", "gian", "Fre", "nch", "Hol", "ida", "ys", ".", "ics", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "de", "\\u", "BE", "'_", ":_", "'", "Bel", "gian", "Hol", "ida", "ys", ".", "ics", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "es", "\\u", "BO", "'_", ":_", "'", "Bol", "ivi", "a", "Hol", "ida", "ys", ".", "ics", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "pt", "\\u", "BR", "'_", ":_", "'", "Brazil", "Hol", "ida", "ys", ".", "ics", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "bg", "\\u", "BG", "'_", ":_", "'", "Bul", "garia", "n", "Hol", "ida", "ys", ".", "ics", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "en", "\\u", "CA", "'_", ":_", "'", "Cana", "da", "Hol", "ida", "ys", ".", "ics", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "es", "\\u", "CL", "'_", ":_", "'", "Chil", "e", "Hol", "ida", "ys", ".", "ics", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "zh", "\\u", "CN", "'_", ":_", "'", "Chin", "a", "Hol", "ida", "ys", ".", "ics", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "es", "\\u", "CO", "'_", ":_", "'", "Colo", "mbi", "an", "Hol", "ida", "ys", ".", "ics", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "hr", "\\u", "HR", "'_", ":_", "'", "Cro", "ati", "a", "Hol", "ida", "ys", ".", "ics", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "cs", "\\u", "CZ", "'_", ":_", "'", "Cz", "ech", "Hol", "ida", "ys", ".", "ics", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "da", "\\u", "DK", "'_", ":_", "'", "Dan", "ish", "Hol", "ida", "ys", ".", "ics", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "be", "\\u", "NL", "'_", ":_", "'", "Dut", "ch", "Hol", "ida", "ys", ".", "ics", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "nl", "\\u", "NL", "'_", ":_", "'", "Dut", "ch", "Hol", "ida", "ys", ".", "ics", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "en", "\\u", "GB", "'_", ":_", "'", "Eng", "lish", "Hol", "ida", "ys", ".", "ics", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "et", "\\u", "EE", "'_", ":_", "'", "Est", "oni", "a", "Hol", "ida", "ys", ".", "ics", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "fi", "\\u", "FI", "'_", ":_", "'", "Fin", "land", "Hol", "ida", "ys", ".", "ics", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "sv", "\\u", "FI", "'_", ":_", "'", "Fin", "land", "Hol", "ida", "ys", ".", "ics", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "fr", "\\u", "FR", "'_", ":_", "'", "Fre", "nch", "Hol", "ida", "ys", ".", "ics", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "fy", "\\u", "NL", "'_", ":_", "'", "Fri", "sia", "n", "Hol", "ida", "ys", ".", "ics", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "de", "\\u", "DE", "'_", ":_", "'", "Germa", "n", "Hol", "ida", "ys", ".", "ics", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "en", "\\u", "HK", "'_", ":_", "'", "Hon", "g", "Kon", "g", "Hol", "ida", "ys", ".", "ics", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "zh", "\\u", "HK", "'_", ":_", "'", "Hon", "g", "Kon", "g", "Hol", "ida", "ys", ".", "ics", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "hu", "\\u", "HU", "'_", ":_", "'", "Hun", "garia", "n", "Hol", "ida", "ys", ".", "ics", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "is", "\\u", "IS", "'_", ":_", "'", "Ice", "land", "Hol", "ida", "ys", ".", "ics", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "id", "\\u", "ID", "'_", ":_", "'", "Ind", "ones", "ian", "Hol", "ida", "ys", ".", "ics", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "it", "\\u", "IT", "'_", ":_", "'", "Ital", "ian", "Hol", "ida", "ys", ".", "ics", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "ja", "\\u", "JP", "'_", ":_", "'", "Japan", "Hol", "ida", "ys", ".", "ics", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "sw", "\\u", "KE", "'_", ":_", "'", "Ken", "ya", "Hol", "ida", "ys", ".", "ics", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "so", "\\u", "KE", "'_", ":_", "'", "Ken", "ya", "Hol", "ida", "ys", ".", "ics", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "om", "\\u", "KE", "'_", ":_", "'", "Ken", "ya", "Hol", "ida", "ys", ".", "ics", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "kam", "\\u", "KE", "'_", ":_", "'", "Ken", "ya", "Hol", "ida", "ys", ".", "ics", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "lv", "\\u", "LV", "'_", ":_", "'", "Lat", "via", "Hol", "ida", "ys", ".", "ics", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "lt", "\\u", "LT", "'_", ":_", "'", "Lit", "hua", "nian", "Hol", "ida", "ys", ".", "ics", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "de", "\\u", "LU", "'_", ":_", "'", "Lu", "xe", "mbo", "urg", "Hol", "ida", "ys", ".", "ics", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "fr", "\\u", "LU", "'_", ":_", "'", "Lu", "xe", "mbo", "urg", "Hol", "ida", "ys", ".", "ics", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "en", "\\u", "NZ", "'_", ":_", "'", "New", "Ze", "alan", "d", "Hol", "ida", "ys", ".", "ics", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "mi", "\\u", "NZ", "'_", ":_", "'", "New", "Ze", "alan", "d", "Hol", "ida", "ys", ".", "ics", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "nb", "\\u", "NO", "'_", ":_", "'", "Nor", "weg", "ian", "Hol", "ida", "ys", ".", "ics", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "en", "\\u", "PK", "'_", ":_", "'", "Pa", "kis", "tan", "Hol", "ida", "ys", ".", "ics", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "pa", "\\u", "Ara", "b", "\\u", "PK", "'_", ":_", "'", "Pa", "kis", "tan", "Hol", "ida", "ys", ".", "ics", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "pa", "\\u", "PK", "'_", ":_", "'", "Pa", "kis", "tan", "Hol", "ida", "ys", ".", "ics", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "ur\\u", "PK", "'_", ":_", "'", "Pa", "kis", "tan", "Hol", "ida", "ys", ".", "ics", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "es", "\\u", "PE", "'_", ":_", "'", "Per", "u", "Hol", "ida", "ys", ".", "ics", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "pl", "\\u", "PL", "'_", ":_", "'", "Poli", "sh", "Hol", "ida", "ys", ".", "ics", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "pt", "\\u", "PT", "'_", ":_", "'", "Portug", "al", "Hol", "ida", "ys", ".", "ics", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "en", "\\u", "QL", "D", "'_", ":_", "'", "Que", "ens", "land", "Hol", "ida", "ys", ".", "ics", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "en", "\\u", "AU", "\\u", "QL", "D", "'_", ":_", "'", "Que", "ens", "land", "Hol", "ida", "ys", ".", "ics", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "ro", "\\u", "MD", "'_", ":_", "'", "Roman", "ia", "Hol", "ida", "ys", ".", "ics", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "ro", "\\u", "RO", "'_", ":_", "'", "Roman", "ia", "Hol", "ida", "ys", ".", "ics", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "ru", "\\u", "RU", "'_", ":_", "'", "Russia", "Hol", "ida", "ys", ".", "ics", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "ru", "\\u", "UA", "'_", ":_", "'", "Russia", "Hol", "ida", "ys", ".", "ics", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "uk", "\\u", "UA", "'_", ":_", "'", "Russia", "Hol", "ida", "ys", ".", "ics", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "en", "\\u", "SG", "'_", ":_", "'", "Sing", "apo", "re", "Hol", "ida", "ys", ".", "ics", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "zh", "\\u", "Han", "s", "\\u", "SG", "'_", ":_", "'", "Sing", "apo", "re", "Hol", "ida", "ys", ".", "ics", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "zh", "\\u", "SG", "'_", ":_", "'", "Sing", "apo", "re", "Hol", "ida", "ys", ".", "ics", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "sk", "\\u", "SK", "'_", ":_", "'", "Slo", "va", "k", "Hol", "ida", "ys", ".", "ics", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "af", "\\u", "ZA", "'_", ":_", "'", "South", "Af", "rica", "Hol", "ida", "ys", ".", "ics", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "en", "\\u", "ZA", "'_", ":_", "'", "South", "Af", "rica", "Hol", "ida", "ys", ".", "ics", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "nr", "\\u", "ZA", "'_", ":_", "'", "South", "Af", "rica", "Hol", "ida", "ys", ".", "ics", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "nso", "\\u", "ZA", "'_", ":_", "'", "South", "Af", "rica", "Hol", "ida", "ys", ".", "ics", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "ss", "\\u", "ZA", "'_", ":_", "'", "South", "Af", "rica", "Hol", "ida", "ys", ".", "ics", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "st", "\\u", "ZA", "'_", ":_", "'", "South", "Af", "rica", "Hol", "ida", "ys", ".", "ics", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "tn", "\\u", "ZA", "'_", ":_", "'", "South", "Af", "rica", "Hol", "ida", "ys", ".", "ics", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "ts", "\\u", "ZA", "'_", ":_", "'", "South", "Af", "rica", "Hol", "ida", "ys", ".", "ics", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "ve", "\\u", "ZA", "'_", ":_", "'", "South", "Af", "rica", "Hol", "ida", "ys", ".", "ics", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "xh", "\\u", "ZA", "'_", ":_", "'", "South", "Af", "rica", "Hol", "ida", "ys", ".", "ics", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "zu", "\\u", "ZA", "'_", ":_", "'", "South", "Af", "rica", "Hol", "ida", "ys", ".", "ics", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "ko", "\\u", "KR", "'_", ":_", "'", "South", "Kor", "ea", "Hol", "ida", "ys", ".", "ics", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "es", "\\u", "ES", "'_", ":_", "'", "Span", "ish", "Hol", "ida", "ys", ".", "ics", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "si", "\\u", "LK", "'_", ":_", "'", "Sr", "i", "Lan", "ka", "Hol", "ida", "ys", ".", "ics", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "sv", "\\u", "SE", "'_", ":_", "'", "Swe", "dis", "h", "Hol", "ida", "ys", ".", "ics", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "de", "\\u", "CH", "'_", ":_", "'", "Swi", "ss", "Hol", "ida", "ys", ".", "ics", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "fr", "\\u", "CH", "'_", ":_", "'", "Swi", "ss", "Hol", "ida", "ys", ".", "ics", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "gs", "w", "\\u", "CH", "'_", ":_", "'", "Swi", "ss", "Hol", "ida", "ys", ".", "ics", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "it", "\\u", "CH", "'_", ":_", "'", "Swi", "ss", "Hol", "ida", "ys", ".", "ics", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "tr", "v", "\\u", "TW", "'_", ":_", "'", "Tai", "wan", "Hol", "ida", "ys", ".", "ics", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "zh", "\\u", "Han", "t", "\\u", "TW", "'_", ":_", "'", "Tai", "wan", "Hol", "ida", "ys", ".", "ics", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "zh", "\\u", "TW", "'_", ":_", "'", "Tai", "wan", "Hol", "ida", "ys", ".", "ics", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "th", "\\u", "TH", "'_", ":_", "'", "Tha", "i", "Hol", "ida", "ys", ".", "ics", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "ku", "\\u", "Lat", "n", "\\u", "TR", "'_", ":_", "'", "Turk", "ey", "Hol", "ida", "ys", ".", "ics", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "ku", "\\u", "TR", "'_", ":_", "'", "Turk", "ey", "Hol", "ida", "ys", ".", "ics", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "tr", "\\u", "TR", "'_", ":_", "'", "Turk", "ey", "Hol", "ida", "ys", ".", "ics", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "cy", "\\u", "GB", "'_", ":_", "'", "UK", "Hol", "ida", "ys", ".", "ics", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "en", "\\u", "GB", "'_", ":_", "'", "UK", "Hol", "ida", "ys", ".", "ics", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "gv", "\\u", "GB", "'_", ":_", "'", "UK", "Hol", "ida", "ys", ".", "ics", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "kw", "\\u", "GB", "'_", ":_", "'", "UK", "Hol", "ida", "ys", ".", "ics", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "en", "'_", ":_", "'", "US", "Hol", "ida", "ys", ".", "ics", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "en", "\\u", "US", "'_", ":_", "'", "US", "Hol", "ida", "ys", ".", "ics", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "es", "\\u", "US", "'_", ":_", "'", "US", "Hol", "ida", "ys", ".", "ics", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "haw", "\\u", "US", "'_", ":_", "'", "US", "Hol", "ida", "ys", ".", "ics", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "es", "\\u", "UY", "'_", ":_", "'", "Ur", "ugu", "ay", "Hol", "ida", "ys", ".", "ics", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "vi", "\\u", "VN", "'_", ":_", "'", "Vie", "tn", "am", "Hol", "ida", "ys", ".", "ics", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\"\"\"", "Cache", " ", "for", " ", "Cal", "enda", "r", " ", "object", "s", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "cache_", "=_", "dict_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Calendar_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "calendar", "\\u", "id_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Prepare", "s", " ", "a", " ", "calendar", " ", "for", " ", "the", " ", "specified", " ", "'", "calendar", "\\u", "id", "'.", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "calendar", "\\u", "id_", "=_", "calendar", "\\u", "id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cal", "\\u", "path_", "=_", "os_", "._", "path_", "._", "dirname_", "(_", "\\u\\u", "file\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "path_", "=_", "os_", "._", "path_", "._", "join_", "(_", "cal", "\\u", "path_", ",_", "Calendar_", "._", "\\u", "RESOURCES", "\\u", "CALENDAR", "S", "\\u", "FMT_", "%_", "self_", "._", "calendar", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "open_", "(_", "path_", ",_", "'", "rb", "'_", ")_", "as_", "f_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "cal_", "=_", "vob", "ject_", "._", "read", "One_", "(_", "f_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Calendar_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Get", "Events_", "(_", "self_", ",_", "year_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Return", "s", " ", "the", " ", "events", " ", "from", " ", "the", " ", "calendar", " ", "for", " ", "the", " ", "year", " ", "specified", ".", "\\", "10", ";", " ", " ", " ", " ", "In", " ", "case", "s", " ", "where", " ", "the", " ", "calendar", " ", "doe", "s", " ", "not", " ", "span", " ", "the", " ", "request", "ed", " ", "year", ",", "\\", "10", ";", " ", " ", " ", " ", "throw", "s", " ", "a", " ", "'", "No", "Cal", "enda", "r", "Data", "Error", "'", " ", "exception", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "events_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "event_", "in_", "self_", "._", "\\u", "cal_", "._", "components_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "event_", "._", "name_", "==_", "'", "VE", "VEN", "T", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "name_", "=_", "event_", "._", "summary_", "._", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "event_", "._", "getr", "ruleset", "_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "rru", "les", "et_", "=_", "event_", "._", "getr", "ruleset", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dates_", "=_", "rru", "les", "et_", "._", "between_", "(_", "datetime_", "._", "datetime_", "(_", "year_", "-_", "1_", ",_", "12_", ",_", "31_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "datetime_", "._", "datetime_", "(_", "year_", "+_", "1_", ",_", "1_", ",_", "1_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "len_", "(_", "dates_", ")_", ">=_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "len_", "(_", "dates_", ")_", ">_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logging_", "._", "warning_", "(_", "'", "holiday", " ", "%", "s", " ", "occur", "s", " ", "more", " ", "than", " ", "onc", "e", " ", "a", " ", "year", ":", " ", "%", "r", "'_", "%_", "(_", "name_", ",_", "dates_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "delta_", "=_", "event_", "._", "dte", "nd_", "._", "value_", "-_", "event_", "._", "dtst", "art_", "._", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dtst", "art_", "=_", "dates_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dte", "nd_", "=_", "dtst", "art_", "+_", "delta_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "events_", "._", "append_", "(_", "{_", "'", "name", "'_", ":_", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "dtst", "art", "'_", ":_", "time_", "._", "mktime_", "(_", "dtst", "art_", "._", "timetuple_", "(_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "dte", "nd", "'_", ":_", "time_", "._", "mktime_", "(_", "dte", "nd_", "._", "timetuple_", "(_", ")_", ")_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "dtst", "art_", "=_", "event_", "._", "dtst", "art_", "._", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dte", "nd_", "=_", "event_", "._", "dte", "nd_", "._", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "dtst", "art_", "._", "year_", "==_", "year_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "events_", "._", "append_", "(_", "{_", "'", "name", "'_", ":_", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "dtst", "art", "'_", ":_", "time_", "._", "mktime_", "(_", "dtst", "art_", "._", "timetuple_", "(_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "dte", "nd", "'_", ":_", "time_", "._", "mktime_", "(_", "dte", "nd_", "._", "timetuple_", "(_", ")_", ")_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "events_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Calendar_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "classmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "Get", "Calendar_", "(_", "cls_", ",_", "calendar", "\\u", "id_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Attempts", " ", "to", " ", "locat", "e", " ", "a", " ", "cache", "d", " ", "version", " ", "of", " ", "'", "calendar", "\\u", "id", "'.", " ", "If", " ", "none", " ", "is", "\\", "10", ";", " ", " ", " ", " ", "found", ",", " ", "atte", "mpt", "s", " ", "to", " ", "load", " ", "from", " ", "disk", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "calendar", "\\u", "id_", "=_", "calendar", "\\u", "id_", "or_", "Calendar_", "._", "\\u", "DEF", "AUL", "T", "\\u", "CALENDAR", "\\u", "ID_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "Calendar_", "._", "\\u", "cache_", "._", "has", "\\u", "key_", "(_", "calendar", "\\u", "id_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cal_", "=_", "Calendar_", "(_", "calendar", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Calendar_", "._", "\\u", "cache_", "[_", "calendar", "\\u", "id_", "]_", "=_", "cal_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "Calendar_", "._", "\\u", "cache_", "[_", "calendar", "\\u", "id_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Calendar_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "classmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "Get", "Hol", "ida", "ys", "By", "Locale_", "(_", "cls_", ",_", "locale_", "=_", "'", "en", "\\u", "US", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Attempts", " ", "to", " ", "match", " ", "the", " ", "specified", " ", "locale", " ", "with", " ", "a", " ", "holiday", "s", "\\", "10", ";", " ", " ", " ", " ", "calendar", ".", " ", "Normalize", "s", " ", "the", " ", "locale", " ", "by", " ", "repla", "cing", " ", "'-'", " ", "with", " ", "'\\u", "'.", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "locale_", "=_", "locale_", "._", "replace_", "(_", "'-'_", ",_", "'\\u'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "calendar", "\\u", "id_", "=_", "Calendar_", "._", "\\u", "locale", "\\u", "to", "\\u", "holiday", "\\u", "calendar", "\\u", "map_", "._", "get_", "(_", "locale_", ",_", "None_", ")_", "or_", "Calendar_", "._", "\\u", "DEF", "AUL", "T", "\\u", "CALENDAR", "\\u", "ID_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "Calendar_", "._", "Get", "Calendar_", "(_", "calendar", "\\u", "id_", ")_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2,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t/accounts/tests/test_views.py
[ { "content": " def test_accounts_user_view(self):\n view = reverse('accounts_user_view', args=(self.user_john.pk,))\n\n get_response = self.client.get(view)\n\n self.assertTrue(get_response.status_code, 200)\n\n self.assertTrue('deployment_table' in get_response.context)\n self.assertEqual(len(get_response.context['deployment_table'].data), 0)", "metadata": "root.TestAccountViews.test_accounts_user_view", "header": "['class', 'TestAccountViews', '(', 'TestCase', ')', ':', '___EOS___']", "index": 53 } ]
[ { "span": "self.assertTrue('deployment_table' in get_response.context)", "start_line": 60, "start_column": 8, "end_line": 60, "end_column": 67 } ]
[]
1
true
[ "[CLS]_", "Imp", "reci", "se_", "assert_", "[SEP]_", "class_", "Test", "Account", "Views_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "account", "s", "\\u", "user", "\\u", "view_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "view_", "=_", "reverse_", "(_", "'", "account", "s", "\\u", "user", "\\u", "view", "'_", ",_", "args_", "=_", "(_", "self_", "._", "user", "\\u", "john", "_", "._", "pk_", ",_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "get", "\\u", "response_", "=_", "self_", "._", "client_", "._", "get_", "(_", "view_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "get", "\\u", "response_", "._", "status", "\\u", "code_", ",_", "200_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'", "deploy", "ment", "\\u", "table", "'_", "in_", "get", "\\u", "response_", "._", "context_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "get", "\\u", "response_", "._", "context_", "[_", "'", "deploy", "ment", "\\u", "table", "'_", "]_", "._", "data_", ")_", ",_", "0_", ")_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused local variable
rll/lfd/scripts/eval.py
[ { "content": "def replay_on_holdout(args, action_selection, reg_and_traj_transferer, lfd_env, sim):\n loadresultfile = h5py.File(args.replay.loadresultfile, 'r')\n loadresult_items = eval_util.get_indexed_items(loadresultfile, task_list=args.tasks, task_file=args.taskfile, i_start=args.i_start, i_end=args.i_end)\n \n num_successes = 0\n num_total = 0\n \n for i_task, task_info in loadresult_items:\n redprint(\"task %s\" % i_task)\n\n for i_step in range(len(task_info)):\n redprint(\"task %s step %i\" % (i_task, i_step))\n \n replay_results = eval_util.load_task_results_step(args.replay.loadresultfile, i_task, i_step)\n sim_state = replay_results['sim_state']\n\n if i_step > 0: # sanity check for reproducibility\n sim_util.reset_arms_to_side(sim)\n if sim.simulation_state_equal(sim_state, sim.get_state()):\n yellowprint(\"Reproducible results OK\")\n else:\n yellowprint(\"The replayed simulation state doesn't match the one from the result file\")\n \n sim.set_state(sim_state)\n\n if args.replay.simulate_traj_steps is not None and i_step not in args.replay.simulate_traj_steps:\n continue\n \n if i_step in args.replay.compute_traj_steps: # compute the trajectory in this step\n best_root_action = replay_results['best_action']\n scene_state = replay_results['scene_state']\n # plot cloud of the test scene\n handles = []\n if args.plotting:\n handles.append(sim.env.plot3(scene_state.cloud[:,:3], 2, scene_state.color if scene_state.color is not None else (0,0,1)))\n sim.viewer.Step()\n test_aug_traj = reg_and_traj_transferer.transfer(GlobalVars.demos[best_root_action], scene_state, plotting=args.plotting)\n else:\n test_aug_traj = replay_results['aug_traj']\n feasible, misgrasp = lfd_env.execute_augmented_trajectory(test_aug_traj, step_viewer=args.animation, interactive=args.interactive, check_feasible=args.eval.check_feasible)\n \n if replay_results['knot']:\n num_successes += 1\n \n num_total += 1\n redprint('REPLAY Successes / Total: ' + str(num_successes) + '/' + str(num_total))", "metadata": "root.replay_on_holdout", "header": "['module', '___EOS___']", "index": 251 } ]
[ { "span": "feasible,", "start_line": 290, "start_column": 12, "end_line": 290, "end_column": 20 }, { "span": "misgrasp ", "start_line": 290, "start_column": 22, "end_line": 290, "end_column": 30 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "repla", "y", "\\u", "on", "\\u", "hold", "out_", "(_", "args_", ",_", "action", "\\u", "selection_", ",_", "reg", "\\u", "and", "\\u", "traj", "\\u", "transfer", "er_", ",_", "lf", "d\\u", "env_", ",_", "sim_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "load", "result", "file_", "=_", "h5py_", "._", "File_", "(_", "args_", "._", "replay_", "._", "load", "result", "file_", ",_", "'", "r", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "load", "result", "\\u", "items_", "=_", "eval", "\\u", "util_", "._", "get", "\\u", "indexe", "d\\u", "items_", "(_", "load", "result", "file_", ",_", "task", "\\u", "list_", "=_", "args_", "._", "tasks_", ",_", "task", "\\u", "file_", "=_", "args_", "._", "task", "file_", ",_", "i", "\\u", "start_", "=_", "args_", "._", "i", "\\u", "start_", ",_", "i", "\\u", "end_", "=_", "args_", "._", "i", "\\u", "end_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "num", "\\u", "successes", "_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "num", "\\u", "total_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "i", "\\u", "task_", ",_", "task", "\\u", "info_", "in_", "load", "result", "\\u", "items_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "red", "print_", "(_", "\"", "task", " ", "%", "s", "\"_", "%_", "i", "\\u", "task_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "i", "\\u", "step_", "in_", "range_", "(_", "len_", "(_", "task", "\\u", "info_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "red", "print_", "(_", "\"", "task", " ", "%", "s", " ", "step", " ", "%", "i", "\"_", "%_", "(_", "i", "\\u", "task_", ",_", "i", "\\u", "step_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "repla", "y", "\\u", "results_", "=_", "eval", "\\u", "util_", "._", "load", "\\u", "task", "\\u", "results", "\\u", "step_", "(_", "args_", "._", "replay_", "._", "load", "result", "file_", ",_", "i", "\\u", "task_", ",_", "i", "\\u", "step_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sim", "\\u", "state_", "=_", "repla", "y", "\\u", "results_", "[_", "'", "sim", "\\u", "state", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "i", "\\u", "step_", ">_", "0_", ":_", "#", " ", "sanity", " ", "check", " ", "for", " ", "repro", "duci", "bility_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sim", "\\u", "util_", "._", "reset", "\\u", "arms", "\\u", "to", "\\u", "side_", "(_", "sim_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "sim_", "._", "simulati", "on", "\\u", "state", "\\u", "equal_", "(_", "sim", "\\u", "state_", ",_", "sim_", "._", "get", "\\u", "state_", "(_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "yell", "ow", "print_", "(_", "\"", "Repr", "od", "uci", "ble", " ", "results", " ", "OK", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "yell", "ow", "print_", "(_", "\"", "The", " ", "repla", "yed", " ", "simulati", "on", " ", "state", " ", "doe", "sn", "'", "t", " ", "match", " ", "the", " ", "one", " ", "from", " ", "the", " ", "result", " ", "file", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "sim_", "._", "set\\u", "state_", "(_", "sim", "\\u", "state_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "args_", "._", "replay_", "._", "simulat", "e\\u", "traj", "\\u", "steps_", "is_", "not_", "None_", "and_", "i", "\\u", "step_", "not_", "in_", "args_", "._", "replay_", "._", "simulat", "e\\u", "traj", "\\u", "steps_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "i", "\\u", "step_", "in_", "args_", "._", "replay_", "._", "compute", "\\u", "traj", "\\u", "steps_", ":_", "#", " ", "compute", " ", "the", " ", "trajecto", "ry", " ", "in", " ", "this", " ", "step_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "best", "\\u", "root", "\\u", "action_", "=_", "repla", "y", "\\u", "results_", "[_", "'", "best", "\\u", "action", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "scen", "e\\u", "state_", "=_", "repla", "y", "\\u", "results_", "[_", "'", "scen", "e\\u", "state", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "plot", " ", "cloud", " ", "of", " ", "the", " ", "test", " ", "scene_", "\\u\\u\\uNL\\u\\u\\u_", "handles_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "args_", "._", "plotting_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "handles_", "._", "append_", "(_", "sim_", "._", "env_", "._", "plot", "3_", "(_", "scen", "e\\u", "state_", "._", "cloud_", "[_", ":_", ",_", ":_", "3_", "]_", ",_", "2_", ",_", "scen", "e\\u", "state_", "._", "color_", "if_", "scen", "e\\u", "state_", "._", "color_", "is_", "not_", "None_", "else_", "(_", "0_", ",_", "0_", ",_", "1_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sim_", "._", "viewer_", "._", "Step_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "test\\u", "aug", "\\u", "traj_", "=_", "reg", "\\u", "and", "\\u", "traj", "\\u", "transfer", "er_", "._", "transfer_", "(_", "Global", "Vars_", "._", "demo", "s_", "[_", "best", "\\u", "root", "\\u", "action_", "]_", ",_", "scen", "e\\u", "state_", ",_", "plotting_", "=_", "args_", "._", "plotting_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "test\\u", "aug", "\\u", "traj_", "=_", "repla", "y", "\\u", "results_", "[_", "'", "aug", "\\u", "traj", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "feas", "ible_", ",_", "mis", "gra", "sp_", "=_", "lf", "d\\u", "env_", "._", "execute", "\\u", "augmented", "\\u", "trajectory_", "(_", "test\\u", "aug", "\\u", "traj_", ",_", "step", "\\u", "viewer_", "=_", "args_", "._", "animation_", ",_", "interactive_", "=_", "args_", "._", "interactive_", ",_", "check", "\\u", "feas", "ible_", "=_", "args_", "._", "eval_", "._", "check", "\\u", "feas", "ible_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "repla", "y", "\\u", "results_", "[_", "'", "knot", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "num", "\\u", "successes", "_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "num", "\\u", "total_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "red", "print_", "(_", "'", "REP", "LA", "Y", " ", "Success", "es", " ", "/", " ", "Total", ":", " ", "'_", "+_", "str_", "(_", "num", "\\u", "successes", "_", ")_", "+_", "'/'_", "+_", "str_", "(_", "num", "\\u", "total_", ")_", ")_", "\\u\\u\\uNE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 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused local variable
spulec/moto/tests/test_ec2/test_internet_gateways.py
[ { "content": "@mock_ec2\ndef test_igw_delete():\n \"\"\" internet gateway delete\"\"\"\n conn = boto.connect_vpc('the_key', 'the_secret')\n vpc = conn.create_vpc(VPC_CIDR)\n conn.get_all_internet_gateways().should.have.length_of(0)\n igw = conn.create_internet_gateway()\n conn.get_all_internet_gateways().should.have.length_of(1)\n conn.delete_internet_gateway(igw.id)\n conn.get_all_internet_gateways().should.have.length_of(0)", "metadata": "root.test_igw_delete", "header": "['module', '___EOS___']", "index": 123 }, { "content": "@mock_ec2\ndef test_igw_filter_by_vpc_id():\n \"\"\" internet gateway filter by vpc id \"\"\"\n conn = boto.connect_vpc('the_key', 'the_secret')\n\n igw1 = conn.create_internet_gateway()\n igw2 = conn.create_internet_gateway()\n vpc = conn.create_vpc(VPC_CIDR)\n conn.attach_internet_gateway(igw1.id, vpc.id)\n\n result = conn.get_all_internet_gateways(filters={\"attachment.vpc-id\": vpc.id})\n result.should.have.length_of(1)\n result[0].id.should.equal(igw1.id)", "metadata": "root.test_igw_filter_by_vpc_id", "header": "['module', '___EOS___']", "index": 167 }, { "content": "@mock_ec2\ndef test_igw_filter_by_tags():\n \"\"\" internet gateway filter by vpc id \"\"\"\n conn = boto.connect_vpc('the_key', 'the_secret')\n\n igw1 = conn.create_internet_gateway()\n igw2 = conn.create_internet_gateway()\n igw1.add_tag(\"tests\", \"yes\")\n\n result = conn.get_all_internet_gateways(filters={\"tag:tests\": \"yes\"})\n result.should.have.length_of(1)\n result[0].id.should.equal(igw1.id)", "metadata": "root.test_igw_filter_by_tags", "header": "['module', '___EOS___']", "index": 182 }, { "content": "@mock_ec2\ndef test_igw_filter_by_internet_gateway_id():\n \"\"\" internet gateway filter by internet gateway id \"\"\"\n conn = boto.connect_vpc('the_key', 'the_secret')\n\n igw1 = conn.create_internet_gateway()\n igw2 = conn.create_internet_gateway()\n\n result = conn.get_all_internet_gateways(filters={\"internet-gateway-id\": igw1.id})\n result.should.have.length_of(1)\n result[0].id.should.equal(igw1.id)", "metadata": "root.test_igw_filter_by_internet_gateway_id", "header": "['module', '___EOS___']", "index": 196 }, { "content": "@mock_ec2\ndef test_igw_filter_by_attachment_state():\n \"\"\" internet gateway filter by attachment state \"\"\"\n conn = boto.connect_vpc('the_key', 'the_secret')\n\n igw1 = conn.create_internet_gateway()\n igw2 = conn.create_internet_gateway()\n vpc = conn.create_vpc(VPC_CIDR)\n conn.attach_internet_gateway(igw1.id, vpc.id)\n\n result = conn.get_all_internet_gateways(filters={\"attachment.state\": \"available\"})\n result.should.have.length_of(1)\n result[0].id.should.equal(igw1.id)", "metadata": "root.test_igw_filter_by_attachment_state", "header": "['module', '___EOS___']", "index": 209 } ]
[ { "span": "vpc ", "start_line": 127, "start_column": 4, "end_line": 127, "end_column": 7 }, { "span": "igw2 ", "start_line": 173, "start_column": 4, "end_line": 173, "end_column": 8 }, { "span": "igw2 ", "start_line": 188, "start_column": 4, "end_line": 188, "end_column": 8 }, { "span": "igw2 ", "start_line": 202, "start_column": 4, "end_line": 202, "end_column": 8 }, { "span": "igw2 ", "start_line": 215, "start_column": 4, "end_line": 215, "end_column": 8 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "mock", "\\u", "ec2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "ig", "w", "\\u", "delete_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "interne", "t", " ", "gateway", " ", "delete", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "conn_", "=_", "boto_", "._", "connect", "\\u", "vpc_", "(_", "'", "the", "\\u", "key", "'_", ",_", "'", "the", "\\u", "secret", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "vpc_", "=_", "conn_", "._", "create", "\\u", "vpc_", "(_", "VP", "C", "\\u", "CIDR", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "conn_", "._", "get", "\\u", "all", "\\u", "interne", "t", "\\u", "gateway", "s_", "(_", ")_", "._", "should_", "._", "have_", "._", "length", "\\u", "of_", "(_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ig", "w_", "=_", "conn_", "._", "create", "\\u", "interne", "t", "\\u", "gateway_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "conn_", "._", "get", "\\u", "all", "\\u", "interne", "t", "\\u", "gateway", "s_", "(_", ")_", "._", "should_", "._", "have_", "._", "length", "\\u", "of_", "(_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "conn_", "._", "delete", "\\u", "interne", "t", "\\u", "gateway_", "(_", "ig", "w_", "._", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "conn_", "._", "get", "\\u", "all", "\\u", "interne", "t", "\\u", "gateway", "s_", "(_", ")_", "._", "should_", "._", "have_", "._", "length", "\\u", "of_", "(_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "mock", "\\u", "ec2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "ig", "w", "\\u", "filter", "\\u", "by", "\\u", "vpc", "\\u", "id_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "interne", "t", " ", "gateway", " ", "filter", " ", "by", " ", "vpc", " ", "id", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "conn_", "=_", "boto_", "._", "connect", "\\u", "vpc_", "(_", "'", "the", "\\u", "key", "'_", ",_", "'", "the", "\\u", "secret", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "ig", "w1_", "=_", "conn_", "._", "create", "\\u", "interne", "t", "\\u", "gateway_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ig", "w2_", "=_", "conn_", "._", "create", "\\u", "interne", "t", "\\u", "gateway_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "vpc_", "=_", "conn_", "._", "create", "\\u", "vpc_", "(_", "VP", "C", "\\u", "CIDR", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "conn_", "._", "attach", "\\u", "interne", "t", "\\u", "gateway_", "(_", "ig", "w1_", "._", "id_", ",_", "vpc_", "._", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "result_", "=_", "conn_", "._", "get", "\\u", "all", "\\u", "interne", "t", "\\u", "gateway", "s_", "(_", "filters_", "=_", "{_", "\"", "attach", "ment", ".", "vpc", "-", "id", "\"_", ":_", "vpc_", "._", "id_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "._", "should_", "._", "have_", "._", "length", "\\u", "of_", "(_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "[_", "0_", "]_", "._", "id_", "._", "should_", "._", "equal_", "(_", "ig", "w1_", "._", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "mock", "\\u", "ec2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "ig", "w", "\\u", "filter", "\\u", "by", "\\u", "tags_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "interne", "t", " ", "gateway", " ", "filter", " ", "by", " ", "vpc", " ", "id", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "conn_", "=_", "boto_", "._", "connect", "\\u", "vpc_", "(_", "'", "the", "\\u", "key", "'_", ",_", "'", "the", "\\u", "secret", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "ig", "w1_", "=_", "conn_", "._", "create", "\\u", "interne", "t", "\\u", "gateway_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ig", "w2_", "=_", "conn_", "._", "create", "\\u", "interne", "t", "\\u", "gateway_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ig", "w1_", "._", "add", "\\u", "tag_", "(_", "\"", "tests", "\"_", ",_", "\"", "ye", "s", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "result_", "=_", "conn_", "._", "get", "\\u", "all", "\\u", "interne", "t", "\\u", "gateway", "s_", "(_", "filters_", "=_", "{_", "\"", "tag", ":", "tests", "\"_", ":_", "\"", "ye", "s", "\"_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "._", "should_", "._", "have_", "._", "length", "\\u", "of_", "(_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "[_", "0_", "]_", "._", "id_", "._", "should_", "._", "equal_", "(_", "ig", "w1_", "._", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "mock", "\\u", "ec2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "ig", "w", "\\u", "filter", "\\u", "by", "\\u", "interne", "t", "\\u", "gateway", "\\u", "id_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "interne", "t", " ", "gateway", " ", "filter", " ", "by", " ", "interne", "t", " ", "gateway", " ", "id", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "conn_", "=_", "boto_", "._", "connect", "\\u", "vpc_", "(_", "'", "the", "\\u", "key", "'_", ",_", "'", "the", "\\u", "secret", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "ig", "w1_", "=_", "conn_", "._", "create", "\\u", "interne", "t", "\\u", "gateway_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ig", "w2_", "=_", "conn_", "._", "create", "\\u", "interne", "t", "\\u", "gateway_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "result_", "=_", "conn_", "._", "get", "\\u", "all", "\\u", "interne", "t", "\\u", "gateway", "s_", "(_", "filters_", "=_", "{_", "\"", "interne", "t", "-", "gateway", "-", "id", "\"_", ":_", "ig", "w1_", "._", "id_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "._", "should_", "._", "have_", "._", "length", "\\u", "of_", "(_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "[_", "0_", "]_", "._", "id_", "._", "should_", "._", "equal_", "(_", "ig", "w1_", "._", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "mock", "\\u", "ec2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "ig", "w", "\\u", "filter", "\\u", "by", "\\u", "attach", "ment", "\\u", "state_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "interne", "t", " ", "gateway", " ", "filter", " ", "by", " ", "attach", "ment", " ", "state", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "conn_", "=_", "boto_", "._", "connect", "\\u", "vpc_", "(_", "'", "the", "\\u", "key", "'_", ",_", "'", "the", "\\u", "secret", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "ig", "w1_", "=_", "conn_", "._", "create", "\\u", "interne", "t", "\\u", "gateway_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ig", "w2_", "=_", "conn_", "._", "create", "\\u", "interne", "t", "\\u", "gateway_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "vpc_", "=_", "conn_", "._", "create", "\\u", "vpc_", "(_", "VP", "C", "\\u", "CIDR", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "conn_", "._", "attach", "\\u", "interne", "t", "\\u", "gateway_", "(_", "ig", "w1_", "._", "id_", ",_", "vpc_", "._", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "result_", "=_", "conn_", "._", "get", "\\u", "all", "\\u", "interne", "t", "\\u", "gateway", "s_", "(_", "filters_", "=_", "{_", "\"", "attach", "ment", ".", "state", "\"_", ":_", "\"", "avail", "able", "\"_", "}_", ")_", "\\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1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
yhat/ggplot/ggplot/tests/test_geom_lines.py
[ { "content": "from __future__ import (absolute_import, division, print_function,\n unicode_literals)\n\nfrom six.moves import xrange\n\nfrom nose.tools import assert_equal, assert_true, assert_raises\n\nfrom . import get_assert_same_ggplot, cleanup\nassert_same_ggplot = get_assert_same_ggplot(__file__)\n\nfrom ggplot import *\nfrom ggplot.exampledata import diamonds\n\nimport numpy as np\nimport pandas as pd\n\n\n\n\n\n\n# TODO: Uncomment when the handling is proper\n\n\n\n\n\n\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def _build_line_df():\n np.random.seed(7776)\n df = pd.DataFrame({'wt': mtcars['wt'][:10],\n 'mpg': mtcars['mpg'][:10],\n 'a': np.random.normal(15, size=10),\n 'b': np.random.normal(0, size=10)\n })\n return df", "metadata": "root._build_line_df", "header": "['module', '___EOS___']", "index": 16 }, { "content": "@cleanup\ndef test_geom_abline():\n df = _build_line_df()\n gg = ggplot(df, aes(x='wt', y='mpg'))\n gg = gg + geom_point() + geom_abline(intercept=22, slope=.8, size=10)\n assert_same_ggplot(gg, 'geom_abline')", "metadata": "root.test_geom_abline", "header": "['module', '___EOS___']", "index": 25 }, { "content": "@cleanup\ndef test_geom_abline_multiple():\n df = _build_line_df()\n gg = ggplot(df, aes(x='wt', y='mpg'))\n gg = gg + geom_point() + geom_abline(intercept=(20, 12),\n slope=(.8, 2),\n color=('red', 'blue'),\n alpha=(.3, .9),\n size=(10, 20))\n assert_same_ggplot(gg, 'geom_abline_multiple')", "metadata": "root.test_geom_abline_multiple", "header": "['module', '___EOS___']", "index": 33 }, { "content": "@cleanup\ndef test_geom_abline_mapped():\n df = _build_line_df()\n gg = ggplot(df, aes(x='wt', y='mpg', intercept='a', slope='b'))\n gg = gg + geom_point() + geom_abline(size=2)\n assert_same_ggplot(gg, 'geom_abline_mapped')", "metadata": "root.test_geom_abline_mapped", "header": "['module', '___EOS___']", "index": 44 }, { "content": "@cleanup\ndef test_geom_abline_functions():\n df = _build_line_df()\n\n def sfunc(x, y):\n return (y.iloc[-1] - y.iloc[0]) / (x.iloc[-1] - x.iloc[0])\n\n def ifunc(x, y):\n return np.mean(y)\n gg = ggplot(df, aes(x='wt', y='mpg'))\n\n # Note, could have done intercept=np.mean\n gg = gg + geom_point() + geom_abline(aes(x='wt', y='mpg'),\n slope=sfunc,\n intercept=ifunc)\n assert_same_ggplot(gg, 'geom_abline_functions')", "metadata": "root.test_geom_abline_functions", "header": "['module', '___EOS___']", "index": 52 }, { "content": "@cleanup\ndef test_geom_vline():\n df = _build_line_df()\n gg = ggplot(df, aes(x='wt', y='mpg'))\n gg = gg + geom_point() + geom_vline(xintercept=3, size=10)\n assert_same_ggplot(gg, 'geom_vline')", "metadata": "root.test_geom_vline", "header": "['module', '___EOS___']", "index": 69 }, { "content": "@cleanup\ndef test_geom_vline_multiple():\n df = _build_line_df()\n gg = ggplot(df, aes(x='wt', y='mpg'))\n gg = gg + geom_point() + geom_vline(xintercept=[2.5, 3.5], size=10)\n assert_same_ggplot(gg, 'geom_vline_multiple')", "metadata": "root.test_geom_vline_multiple", "header": "['module', '___EOS___']", "index": 76 }, { "content": "@cleanup\ndef test_geom_vline_mapped():\n df = _build_line_df()\n gg = ggplot(df, aes(x='wt', y='mpg', xintercept='wt'))\n gg = (gg + geom_point(size=200, color='green', fill='blue', alpha=.7) +\n geom_vline(size=2))\n assert_same_ggplot(gg, 'geom_vline_mapped')", "metadata": "root.test_geom_vline_mapped", "header": "['module', '___EOS___']", "index": 83 }, { "content": "@cleanup\ndef test_geom_vline_function():\n df = _build_line_df()\n gg = ggplot(df, aes(x='wt', y='mpg'))\n def ifunc(x):\n return np.mean(x)\n gg = gg + geom_point() + geom_vline(aes(x='wt'), xintercept=ifunc)\n assert_same_ggplot(gg, 'geom_vline_function')", "metadata": "root.test_geom_vline_function", "header": "['module', '___EOS___']", "index": 91 }, { "content": "@cleanup\ndef test_geom_hline():\n df = _build_line_df()\n gg = ggplot(df, aes(x='wt', y='mpg'))\n gg = gg + geom_point() + geom_hline(yintercept=20, size=10)\n assert_same_ggplot(gg, 'geom_hline')", "metadata": "root.test_geom_hline", "header": "['module', '___EOS___']", "index": 100 }, { "content": "@cleanup\ndef test_geom_hline_multiple():\n df = _build_line_df()\n gg = ggplot(df, aes(x='wt', y='mpg'))\n gg = gg + geom_point() + geom_hline(yintercept=[16., 24.], size=10)\n assert_same_ggplot(gg, 'geom_hline_multiple')", "metadata": "root.test_geom_hline_multiple", "header": "['module', '___EOS___']", "index": 107 }, { "content": "@cleanup\ndef test_geom_hline_mapped():\n df = _build_line_df()\n gg = ggplot(df, aes(x='wt', y='mpg', yintercept='mpg'))\n gg = (gg + geom_point(size=150, color='blue', alpha=.5) +\n geom_hline(size=2))\n assert_same_ggplot(gg, 'geom_hline_mapped')", "metadata": "root.test_geom_hline_mapped", "header": "['module', '___EOS___']", "index": 114 }, { "content": "@cleanup\ndef test_geom_hline_function():\n df = _build_line_df()\n gg = ggplot(df, aes(x='wt', y='mpg'))\n def ifunc(y):\n return np.mean(y)\n gg = gg + geom_point() + geom_hline(aes(y='mpg'), yintercept=ifunc)\n assert_same_ggplot(gg, 'geom_hline_function')", "metadata": "root.test_geom_hline_function", "header": "['module', '___EOS___']", "index": 122 }, { "content": "@cleanup\ndef test_geom_festival_of_lines():\n # All 3 lines should intersect at the point of the same color.\n # Horizontal and vertical will overlap for points on the same line\n df = _build_line_df()\n df['color'] = range(len(df['wt']))\n def xfunc(x):\n return x\n def yfunc(y):\n return y\n def ifunc(x, y):\n return y - 5 * x\n def sfunc(x, y):\n return 5\n gg = ggplot(df, aes(x='wt', y='mpg', color='factor(color)'))\n gg = (gg + geom_point(size=150, alpha=.9) +\n geom_abline(size=2, intercept=ifunc, slope=sfunc) +\n geom_vline(size=2, xintercept=xfunc) +\n geom_hline(size=2, yintercept=yfunc))\n assert_same_ggplot(gg, 'geom_festival_of_lines')", "metadata": "root.test_geom_festival_of_lines", "header": "['module', '___EOS___']", "index": 131 } ]
[ { "span": "from six.moves import xrange", "start_line": 3, "start_column": 0, "end_line": 3, "end_column": 28 }, { "span": "from nose.tools import assert_equal, assert_true, assert_raises", "start_line": 5, "start_column": 0, "end_line": 5, "end_column": 63 }, { "span": "from ggplot.exampledata import diamonds", "start_line": 11, "start_column": 0, "end_line": 11, "end_column": 39 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "from_", "\\u\\u", "future\\u\\u_", "import_", "(_", "abs", "olute", "\\u", "import_", ",_", "division_", ",_", "print", "\\u", "function_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "unicode", "\\u", "literals_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "six_", "._", "moves_", "import_", "xrange_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "nose_", "._", "tools_", "import_", "assert", "\\u", "equal_", ",_", "assert", "\\u", "true_", ",_", "assert", "\\u", "raises_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "._", "import_", "get", "\\u", "assert", "\\u", "same", "\\u", "gg", "plot_", ",_", "cleanup_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "same", "\\u", "gg", "plot_", "=_", "get", "\\u", "assert", "\\u", "same", "\\u", "gg", "plot_", "(_", "\\u\\u", "file\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "gg", "plot_", "import_", "*_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "gg", "plot_", "._", "example", "data_", "import_", "diamond", "s_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "numpy_", "as_", "np_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "pandas_", "as_", "pd_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "TOD", "O", ":", " ", "Unco", "mmen", "t", " ", "whe", "n", " ", "the", " ", "handling", " ", "is", " ", "proper", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u", "build", "\\u", "line", "\\u", "df_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "np_", "._", "random_", "._", "seed_", "(_", "777", "6_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "df_", "=_", "pd_", "._", "Data", "Frame_", "(_", "{_", "'", "wt", "'_", ":_", "mt", "cars", "_", "[_", "'", "wt", "'_", "]_", "[_", ":_", "10_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "mpg", "'_", ":_", "mt", "cars", "_", "[_", "'", "mpg", "'_", "]_", "[_", ":_", "10_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "a", "'_", ":_", "np_", "._", "random_", "._", "normal_", "(_", "15_", ",_", "size_", "=_", "10_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "b", "'_", ":_", "np_", "._", "random_", "._", "normal_", "(_", "0_", ",_", "size_", "=_", "10_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "df_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "cleanup_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "geom", "\\u", "abl", "ine_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "df_", "=_", "\\u", "build", "\\u", "line", "\\u", "df_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "gg_", "=_", "gg", "plot_", "(_", "df_", ",_", "aes", "_", "(_", "x_", "=_", "'", "wt", "'_", ",_", "y_", "=_", "'", "mpg", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "gg_", "=_", "gg_", "+_", "geom", "\\u", "point_", "(_", ")_", "+_", "geom", "\\u", "abl", "ine_", "(_", "intercept_", "=_", "22_", ",_", "slope_", "=_", ".8_", ",_", "size_", "=_", "10_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "same", "\\u", "gg", "plot_", "(_", "gg_", ",_", "'", "geom", "\\u", "abl", "ine", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "cleanup_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "geom", "\\u", "abl", "ine", "\\u", "multiple_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "df_", "=_", "\\u", "build", "\\u", "line", "\\u", "df_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "gg_", "=_", "gg", "plot_", "(_", "df_", ",_", "aes", "_", "(_", "x_", "=_", "'", "wt", "'_", ",_", "y_", "=_", "'", "mpg", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "gg_", "=_", "gg_", "+_", "geom", "\\u", "point_", "(_", ")_", "+_", "geom", "\\u", "abl", "ine_", "(_", "intercept_", "=_", "(_", "20_", ",_", "12_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "slope_", "=_", "(_", ".8_", ",_", "2_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "color_", "=_", "(_", "'", "red", "'_", ",_", "'", "blue", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "alpha_", "=_", "(_", ".3_", ",_", ".9_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "size_", "=_", "(_", "10_", ",_", "20_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "same", "\\u", "gg", "plot_", "(_", "gg_", ",_", "'", "geom", "\\u", "abl", "ine", "\\u", "multiple", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "cleanup_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "geom", "\\u", "abl", "ine", "\\u", "mapped_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "df_", "=_", "\\u", "build", "\\u", "line", "\\u", "df_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "gg_", "=_", "gg", "plot_", "(_", "df_", ",_", "aes", "_", "(_", "x_", "=_", "'", "wt", "'_", ",_", "y_", "=_", "'", "mpg", "'_", ",_", "intercept_", "=_", "'", "a", "'_", ",_", "slope_", "=_", "'", "b", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "gg_", "=_", "gg_", "+_", "geom", "\\u", "point_", "(_", ")_", "+_", "geom", "\\u", "abl", "ine_", "(_", "size_", "=_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "same", "\\u", "gg", "plot_", "(_", "gg_", ",_", "'", "geom", "\\u", "abl", "ine", "\\u", "mapp", "ed", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "cleanup_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "geom", "\\u", "abl", "ine", "\\u", "functions_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "df_", "=_", "\\u", "build", "\\u", "line", "\\u", "df_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "sfu", "nc_", "(_", "x_", ",_", "y_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "(_", "y_", "._", "iloc_", "[_", "-_", "1_", "]_", "-_", "y_", "._", "iloc_", "[_", "0_", "]_", ")_", "/_", "(_", "x_", "._", "iloc_", "[_", "-_", "1_", "]_", "-_", "x_", "._", "iloc_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "if", "unc_", "(_", "x_", ",_", "y_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "np_", "._", "mean_", "(_", "y_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "gg_", "=_", "gg", "plot_", "(_", "df_", ",_", "aes", "_", "(_", "x_", "=_", "'", "wt", "'_", ",_", "y_", "=_", "'", "mpg", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Not", "e", ",", " ", "coul", "d", " ", "have", " ", "don", "e", " ", "intercept", "=", "np", ".", "mean_", "\\u\\u\\uNL\\u\\u\\u_", "gg_", "=_", "gg_", "+_", "geom", "\\u", "point_", "(_", ")_", "+_", "geom", "\\u", "abl", "ine_", "(_", "aes", "_", "(_", "x_", "=_", "'", "wt", "'_", ",_", "y_", "=_", "'", "mpg", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "slope_", "=_", "sfu", "nc_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "intercept_", "=_", "if", "unc_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "same", "\\u", "gg", "plot_", "(_", "gg_", ",_", "'", "geom", "\\u", "abl", "ine", "\\u", "function", "s", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "cleanup_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "geom", "\\u", "vlin", "e_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "df_", "=_", "\\u", "build", "\\u", "line", "\\u", "df_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "gg_", "=_", "gg", "plot_", "(_", "df_", ",_", "aes", "_", "(_", "x_", "=_", "'", "wt", "'_", ",_", "y_", "=_", "'", "mpg", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "gg_", "=_", "gg_", "+_", "geom", "\\u", "point_", "(_", ")_", "+_", "geom", "\\u", "vlin", "e_", "(_", "xin", "ter", "cept", "_", "=_", "3_", ",_", "size_", "=_", "10_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "same", "\\u", "gg", "plot_", "(_", "gg_", ",_", "'", "geom", "\\u", "vlin", "e", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "cleanup_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "geom", "\\u", "vlin", "e\\u", "multiple_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "df_", "=_", "\\u", "build", "\\u", "line", "\\u", "df_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "gg_", "=_", "gg", "plot_", "(_", "df_", ",_", "aes", "_", "(_", "x_", "=_", "'", "wt", "'_", ",_", "y_", "=_", "'", "mpg", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "gg_", "=_", "gg_", "+_", "geom", "\\u", "point_", "(_", ")_", "+_", "geom", "\\u", "vlin", "e_", "(_", "xin", "ter", "cept", "_", "=_", "[_", "2.5_", ",_", "3.5_", "]_", ",_", "size_", "=_", "10_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "same", "\\u", "gg", "plot_", "(_", "gg_", ",_", "'", "geom", "\\u", "vlin", "e\\u", "multiple", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "cleanup_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "geom", "\\u", "vlin", "e\\u", "mapped_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "df_", "=_", "\\u", "build", "\\u", "line", "\\u", "df_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "gg_", "=_", "gg", "plot_", "(_", "df_", ",_", "aes", "_", "(_", "x_", "=_", "'", "wt", "'_", ",_", "y_", "=_", "'", "mpg", "'_", ",_", "xin", "ter", "cept", "_", "=_", "'", "wt", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "gg_", "=_", "(_", "gg_", "+_", "geom", "\\u", "point_", "(_", "size_", "=_", "200_", ",_", "color_", "=_", "'", "green", "'_", ",_", "fill_", "=_", "'", "blue", "'_", ",_", "alpha_", "=_", ".7_", ")_", "+_", "\\u\\u\\uNL\\u\\u\\u_", "geom", "\\u", "vlin", "e_", "(_", "size_", "=_", "2_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "same", "\\u", "gg", "plot_", "(_", "gg_", ",_", "'", "geom", "\\u", "vlin", "e\\u", "mapp", "ed", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "cleanup_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "geom", "\\u", "vlin", "e\\u", "function_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "df_", "=_", "\\u", "build", "\\u", "line", "\\u", "df_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "gg_", "=_", "gg", "plot_", "(_", "df_", ",_", "aes", "_", "(_", "x_", "=_", "'", "wt", "'_", ",_", "y_", "=_", "'", "mpg", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "if", "unc_", "(_", "x_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "np_", "._", "mean_", "(_", "x_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "gg_", "=_", "gg_", "+_", "geom", "\\u", "point_", "(_", ")_", "+_", "geom", "\\u", "vlin", "e_", "(_", "aes", "_", "(_", "x_", "=_", "'", "wt", "'_", ")_", ",_", "xin", "ter", "cept", "_", "=_", "if", "unc_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "same", "\\u", "gg", "plot_", "(_", "gg_", ",_", "'", "geom", "\\u", "vlin", "e\\u", "function", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "cleanup_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "geom", "\\u", "hline", "_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "df_", "=_", "\\u", "build", "\\u", "line", "\\u", "df_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "gg_", "=_", "gg", "plot_", "(_", "df_", ",_", "aes", "_", "(_", "x_", "=_", "'", "wt", "'_", ",_", "y_", "=_", "'", "mpg", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "gg_", "=_", "gg_", "+_", "geom", "\\u", "point_", "(_", ")_", "+_", "geom", "\\u", "hline", "_", "(_", "yin", "ter", "cept", "_", "=_", "20_", ",_", "size_", "=_", "10_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "same", "\\u", "gg", "plot_", "(_", "gg_", ",_", "'", "geom", "\\u", "hline", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "cleanup_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "geom", "\\u", "hline", "\\u", "multiple_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "df_", "=_", "\\u", "build", "\\u", "line", "\\u", "df_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "gg_", "=_", "gg", "plot_", "(_", "df_", ",_", "aes", "_", "(_", "x_", "=_", "'", "wt", "'_", ",_", "y_", "=_", "'", "mpg", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "gg_", "=_", "gg_", "+_", "geom", "\\u", "point_", "(_", ")_", "+_", "geom", "\\u", "hline", "_", "(_", "yin", "ter", "cept", "_", "=_", "[_", "16.", "_", ",_", "24.", "_", "]_", ",_", "size_", "=_", "10_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "same", "\\u", "gg", "plot_", "(_", "gg_", ",_", "'", "geom", "\\u", "hline", "\\u", "multiple", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "cleanup_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "geom", "\\u", "hline", "\\u", "mapped_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "df_", "=_", "\\u", "build", "\\u", "line", "\\u", "df_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "gg_", "=_", "gg", "plot_", "(_", "df_", ",_", "aes", "_", "(_", "x_", "=_", "'", "wt", "'_", ",_", "y_", "=_", "'", "mpg", "'_", ",_", "yin", "ter", "cept", "_", "=_", "'", "mpg", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "gg_", "=_", "(_", "gg_", "+_", "geom", "\\u", "point_", "(_", "size_", "=_", "150_", ",_", "color_", "=_", "'", "blue", "'_", ",_", "alpha_", "=_", ".5_", ")_", "+_", "\\u\\u\\uNL\\u\\u\\u_", "geom", "\\u", "hline", "_", "(_", "size_", "=_", "2_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "same", "\\u", "gg", "plot_", "(_", "gg_", ",_", "'", "geom", "\\u", "hline", "\\u", "mapp", "ed", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "cleanup_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "geom", "\\u", "hline", "\\u", "function_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "df_", "=_", "\\u", "build", "\\u", "line", "\\u", "df_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "gg_", "=_", "gg", "plot_", "(_", "df_", ",_", "aes", "_", "(_", "x_", "=_", "'", "wt", "'_", ",_", "y_", "=_", "'", "mpg", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "if", "unc_", "(_", "y_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "np_", "._", "mean_", "(_", "y_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "gg_", "=_", "gg_", "+_", "geom", "\\u", "point_", "(_", ")_", "+_", "geom", "\\u", "hline", "_", "(_", "aes", "_", "(_", "y_", "=_", "'", "mpg", "'_", ")_", ",_", "yin", "ter", "cept", "_", "=_", "if", "unc_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "same", "\\u", "gg", "plot_", "(_", "gg_", ",_", "'", "geom", "\\u", "hline", "\\u", "function", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "cleanup_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "geom", "\\u", "fes", "tiva", "l\\u", "of", "\\u", "lines_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "All", " ", "3", " ", "lines", " ", "shou", "ld", " ", "intersect", " ", "at", " ", "the", " ", "point", " ", "of", " ", "the", " ", "same", " ", "color", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Horiz", "onta", "l", " ", "and", " ", "vertical", " ", "will", " ", "overl", "ap", " ", "for", " ", "points", " ", "on", " ", "the", " ", "same", " ", "line_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "df_", "=_", "\\u", "build", "\\u", "line", "\\u", "df_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "df_", "[_", "'", "color", "'_", "]_", "=_", "range_", "(_", "len_", "(_", "df_", "[_", "'", "wt", "'_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "xf", "unc_", "(_", "x_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "x_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "yf", "unc_", "(_", "y_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "y_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "if", "unc_", "(_", "x_", ",_", "y_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "y_", "-_", "5_", "*_", "x_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "sfu", "nc_", "(_", "x_", ",_", "y_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "5_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "gg_", "=_", "gg", "plot_", "(_", "df_", ",_", "aes", "_", "(_", "x_", "=_", "'", "wt", "'_", ",_", "y_", "=_", "'", "mpg", "'_", ",_", "color_", "=_", "'", "factor", "(", "color", ")'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "gg_", "=_", "(_", "gg_", "+_", "geom", "\\u", "point_", "(_", "size_", "=_", "150_", ",_", "alpha_", "=_", ".9_", ")_", "+_", "\\u\\u\\uNL\\u\\u\\u_", "geom", "\\u", "abl", "ine_", "(_", "size_", "=_", "2_", ",_", "intercept_", "=_", "if", "unc_", ",_", "slope_", "=_", "sfu", "nc_", ")_", "+_", "\\u\\u\\uNL\\u\\u\\u_", "geom", "\\u", "vlin", "e_", "(_", "size_", "=_", "2_", ",_", "xin", "ter", "cept", "_", "=_", "xf", "unc_", ")_", "+_", "\\u\\u\\uNL\\u\\u\\u_", "geom", "\\u", "hline", "_", "(_", "size_", "=_", "2_", ",_", "yin", "ter", "cept", "_", "=_", "yf", "unc_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "same", "\\u", "gg", "plot_", "(_", "gg_", ",_", "'", "geom", "\\u", "fes", "tiva", "l\\u", "of", "\\u", "lines", "'_", ")_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused local variable
nii-cloud/dodai-compute/nova/tests/test_compute.py
[ { "content": " def test_resize_instance_notification(self):\n \"\"\"Ensure notifications on instance migrate/resize\"\"\"\n instance_id = self._create_instance()\n context = self.context.elevated()\n inst_ref = db.instance_get(context, instance_id)\n\n self.compute.run_instance(self.context, instance_id)\n test_notifier.NOTIFICATIONS = []\n\n db.instance_update(self.context, instance_id, {'host': 'foo'})\n self.compute.prep_resize(context, inst_ref['uuid'], 1)\n migration_ref = db.migration_get_by_instance_and_status(context,\n inst_ref['uuid'], 'pre-migrating')\n\n self.assertEquals(len(test_notifier.NOTIFICATIONS), 1)\n msg = test_notifier.NOTIFICATIONS[0]\n self.assertEquals(msg['priority'], 'INFO')\n self.assertEquals(msg['event_type'], 'compute.instance.resize.prep')\n payload = msg['payload']\n self.assertEquals(payload['project_id'], self.project_id)\n self.assertEquals(payload['user_id'], self.user_id)\n self.assertEquals(payload['instance_id'], instance_id)\n self.assertEquals(payload['instance_type'], 'm1.tiny')\n type_id = instance_types.get_instance_type_by_name('m1.tiny')['id']\n self.assertEquals(str(payload['instance_type_id']), str(type_id))\n self.assertTrue('display_name' in payload)\n self.assertTrue('created_at' in payload)\n self.assertTrue('launched_at' in payload)\n self.assertEquals(payload['image_ref'], '1')\n self.compute.terminate_instance(context, instance_id)", "metadata": "root.ComputeTestCase.test_resize_instance_notification", "header": "['class', 'ComputeTestCase', '(', 'test', '.', 'TestCase', ')', ':', '___EOS___']", "index": 512 }, { "content": " def test_post_live_migration_working_correctly(self):\n \"\"\"Confirm post_live_migration() works as expected correctly.\"\"\"\n dest = 'desthost'\n flo_addr = '1.2.1.2'\n\n # Preparing datas\n c = context.get_admin_context()\n instance_id = self._create_instance()\n i_ref = db.instance_get(c, instance_id)\n db.instance_update(c, i_ref['id'], {'vm_state': vm_states.MIGRATING,\n 'power_state': power_state.PAUSED})\n v_ref = db.volume_create(c, {'size': 1, 'instance_id': instance_id})\n fix_addr = db.fixed_ip_create(c, {'address': '1.1.1.1',\n 'instance_id': instance_id})\n fix_ref = db.fixed_ip_get_by_address(c, fix_addr)\n flo_ref = db.floating_ip_create(c, {'address': flo_addr,\n 'fixed_ip_id': fix_ref['id']})\n # reload is necessary before setting mocks\n i_ref = db.instance_get(c, instance_id)\n\n # Preparing mocks\n self.mox.StubOutWithMock(self.compute.volume_manager,\n 'remove_compute_volume')\n for v in i_ref['volumes']:\n self.compute.volume_manager.remove_compute_volume(c, v['id'])\n self.mox.StubOutWithMock(self.compute.driver, 'unfilter_instance')\n self.compute.driver.unfilter_instance(i_ref, [])\n self.mox.StubOutWithMock(rpc, 'call')\n rpc.call(c, db.queue_get_for(c, FLAGS.compute_topic, dest),\n {\"method\": \"post_live_migration_at_destination\",\n \"args\": {'instance_id': i_ref['id'], 'block_migration': False}})\n\n # executing\n self.mox.ReplayAll()\n ret = self.compute.post_live_migration(c, i_ref, dest)\n\n # make sure every data is rewritten to dest\n i_ref = db.instance_get(c, i_ref['id'])\n c1 = (i_ref['host'] == dest)\n flo_refs = db.floating_ip_get_all_by_host(c, dest)\n c2 = (len(flo_refs) != 0 and flo_refs[0]['address'] == flo_addr)\n\n # post operaton\n self.assertTrue(c1 and c2)\n db.instance_destroy(c, instance_id)\n db.volume_destroy(c, v_ref['id'])\n db.floating_ip_destroy(c, flo_addr)", "metadata": "root.ComputeTestCase.test_post_live_migration_working_correctly", "header": "['class', 'ComputeTestCase', '(', 'test', '.', 'TestCase', ')', ':', '___EOS___']", "index": 893 }, { "content": " def test_get_by_fixed_ip(self):\n \"\"\"Test getting 1 instance by Fixed IP\"\"\"\n c = context.get_admin_context()\n instance_id1 = self._create_instance()\n instance_id2 = self._create_instance({'id': 20})\n instance_id3 = self._create_instance({'id': 30})\n\n vif_ref1 = db.virtual_interface_create(c,\n {'address': '12:34:56:78:90:12',\n 'instance_id': instance_id1,\n 'network_id': 1})\n vif_ref2 = db.virtual_interface_create(c,\n {'address': '90:12:34:56:78:90',\n 'instance_id': instance_id2,\n 'network_id': 1})\n\n db.fixed_ip_create(c,\n {'address': '1.1.1.1',\n 'instance_id': instance_id1,\n 'virtual_interface_id': vif_ref1['id']})\n db.fixed_ip_create(c,\n {'address': '1.1.2.1',\n 'instance_id': instance_id2,\n 'virtual_interface_id': vif_ref2['id']})\n\n # regex not allowed\n instances = self.compute_api.get_all(c,\n search_opts={'fixed_ip': '.*'})\n self.assertEqual(len(instances), 0)\n\n instances = self.compute_api.get_all(c,\n search_opts={'fixed_ip': '1.1.3.1'})\n self.assertEqual(len(instances), 0)\n\n instances = self.compute_api.get_all(c,\n search_opts={'fixed_ip': '1.1.1.1'})\n self.assertEqual(len(instances), 1)\n self.assertEqual(instances[0].id, instance_id1)\n\n instances = self.compute_api.get_all(c,\n search_opts={'fixed_ip': '1.1.2.1'})\n self.assertEqual(len(instances), 1)\n self.assertEqual(instances[0].id, instance_id2)\n\n db.virtual_interface_delete(c, vif_ref1['id'])\n db.virtual_interface_delete(c, vif_ref2['id'])\n db.instance_destroy(c, instance_id1)\n db.instance_destroy(c, instance_id2)", "metadata": "root.ComputeTestCase.test_get_by_fixed_ip", "header": "['class', 'ComputeTestCase', '(', 'test', '.', 'TestCase', ')', ':', '___EOS___']", "index": 1040 }, { "content": " def test_get_all_by_ip_regexp(self):\n \"\"\"Test searching by Floating and Fixed IP\"\"\"\n c = context.get_admin_context()\n instance_id1 = self._create_instance({'display_name': 'woot'})\n instance_id2 = self._create_instance({\n 'display_name': 'woo',\n 'id': 20})\n instance_id3 = self._create_instance({\n 'display_name': 'not-woot',\n 'id': 30})\n\n vif_ref1 = db.virtual_interface_create(c,\n {'address': '12:34:56:78:90:12',\n 'instance_id': instance_id1,\n 'network_id': 1})\n vif_ref2 = db.virtual_interface_create(c,\n {'address': '90:12:34:56:78:90',\n 'instance_id': instance_id2,\n 'network_id': 1})\n vif_ref3 = db.virtual_interface_create(c,\n {'address': '34:56:78:90:12:34',\n 'instance_id': instance_id3,\n 'network_id': 1})\n\n db.fixed_ip_create(c,\n {'address': '1.1.1.1',\n 'instance_id': instance_id1,\n 'virtual_interface_id': vif_ref1['id']})\n db.fixed_ip_create(c,\n {'address': '1.1.2.1',\n 'instance_id': instance_id2,\n 'virtual_interface_id': vif_ref2['id']})\n fix_addr = db.fixed_ip_create(c,\n {'address': '1.1.3.1',\n 'instance_id': instance_id3,\n 'virtual_interface_id': vif_ref3['id']})\n fix_ref = db.fixed_ip_get_by_address(c, fix_addr)\n flo_ref = db.floating_ip_create(c,\n {'address': '10.0.0.2',\n 'fixed_ip_id': fix_ref['id']})\n\n # ends up matching 2nd octet here.. so all 3 match\n instances = self.compute_api.get_all(c,\n search_opts={'ip': '.*\\.1'})\n self.assertEqual(len(instances), 3)\n\n instances = self.compute_api.get_all(c,\n search_opts={'ip': '1.*'})\n self.assertEqual(len(instances), 3)\n\n instances = self.compute_api.get_all(c,\n search_opts={'ip': '.*\\.1.\\d+$'})\n self.assertEqual(len(instances), 1)\n instance_ids = [instance.id for instance in instances]\n self.assertTrue(instance_id1 in instance_ids)\n\n instances = self.compute_api.get_all(c,\n search_opts={'ip': '.*\\.2.+'})\n self.assertEqual(len(instances), 1)\n self.assertEqual(instances[0].id, instance_id2)\n\n instances = self.compute_api.get_all(c,\n search_opts={'ip': '10.*'})\n self.assertEqual(len(instances), 1)\n self.assertEqual(instances[0].id, instance_id3)\n\n db.virtual_interface_delete(c, vif_ref1['id'])\n db.virtual_interface_delete(c, vif_ref2['id'])\n db.virtual_interface_delete(c, vif_ref3['id'])\n db.floating_ip_destroy(c, '10.0.0.2')\n db.instance_destroy(c, instance_id1)\n db.instance_destroy(c, instance_id2)\n db.instance_destroy(c, instance_id3)", "metadata": "root.ComputeTestCase.test_get_all_by_ip_regexp", "header": "['class', 'ComputeTestCase', '(', 'test', '.', 'TestCase', ')', ':', '___EOS___']", "index": 1089 }, { "content": " def test_get_all_by_multiple_options_at_once(self):\n \"\"\"Test searching by multiple options at once\"\"\"\n c = context.get_admin_context()\n instance_id1 = self._create_instance({'display_name': 'woot'})\n instance_id2 = self._create_instance({\n 'display_name': 'woo',\n 'id': 20})\n instance_id3 = self._create_instance({\n 'display_name': 'not-woot',\n 'id': 30})\n\n vif_ref1 = db.virtual_interface_create(c,\n {'address': '12:34:56:78:90:12',\n 'instance_id': instance_id1,\n 'network_id': 1})\n vif_ref2 = db.virtual_interface_create(c,\n {'address': '90:12:34:56:78:90',\n 'instance_id': instance_id2,\n 'network_id': 1})\n vif_ref3 = db.virtual_interface_create(c,\n {'address': '34:56:78:90:12:34',\n 'instance_id': instance_id3,\n 'network_id': 1})\n\n db.fixed_ip_create(c,\n {'address': '1.1.1.1',\n 'instance_id': instance_id1,\n 'virtual_interface_id': vif_ref1['id']})\n db.fixed_ip_create(c,\n {'address': '1.1.2.1',\n 'instance_id': instance_id2,\n 'virtual_interface_id': vif_ref2['id']})\n fix_addr = db.fixed_ip_create(c,\n {'address': '1.1.3.1',\n 'instance_id': instance_id3,\n 'virtual_interface_id': vif_ref3['id']})\n fix_ref = db.fixed_ip_get_by_address(c, fix_addr)\n flo_ref = db.floating_ip_create(c,\n {'address': '10.0.0.2',\n 'fixed_ip_id': fix_ref['id']})\n\n # ip ends up matching 2nd octet here.. so all 3 match ip\n # but 'name' only matches one\n instances = self.compute_api.get_all(c,\n search_opts={'ip': '.*\\.1', 'name': 'not.*'})\n self.assertEqual(len(instances), 1)\n self.assertEqual(instances[0].id, instance_id3)\n\n # ip ends up matching any ip with a '2' in it.. so instance\n # 2 and 3.. but name should only match #2\n # but 'name' only matches one\n instances = self.compute_api.get_all(c,\n search_opts={'ip': '.*2', 'name': '^woo.*'})\n self.assertEqual(len(instances), 1)\n self.assertEqual(instances[0].id, instance_id2)\n\n # same as above but no match on name (name matches instance_id1\n # but the ip query doesn't\n instances = self.compute_api.get_all(c,\n search_opts={'ip': '.*2.*', 'name': '^woot.*'})\n self.assertEqual(len(instances), 0)\n\n # ip matches all 3... ipv6 matches #2+#3...name matches #3\n instances = self.compute_api.get_all(c,\n search_opts={'ip': '.*\\.1',\n 'name': 'not.*',\n 'ip6': '^.*12.*34.*'})\n self.assertEqual(len(instances), 1)\n self.assertEqual(instances[0].id, instance_id3)\n\n db.virtual_interface_delete(c, vif_ref1['id'])\n db.virtual_interface_delete(c, vif_ref2['id'])\n db.virtual_interface_delete(c, vif_ref3['id'])\n db.floating_ip_destroy(c, '10.0.0.2')\n db.instance_destroy(c, instance_id1)\n db.instance_destroy(c, instance_id2)\n db.instance_destroy(c, instance_id3)", "metadata": "root.ComputeTestCase.test_get_all_by_multiple_options_at_once", "header": "['class', 'ComputeTestCase', '(', 'test', '.', 'TestCase', ')', ':', '___EOS___']", "index": 1220 } ]
[ { "span": "migration_ref ", "start_line": 523, "start_column": 8, "end_line": 523, "end_column": 21 }, { "span": "flo_ref ", "start_line": 908, "start_column": 8, "end_line": 908, "end_column": 15 }, { "span": "ret ", "start_line": 927, "start_column": 8, "end_line": 927, "end_column": 11 }, { "span": "instance_id3 ", "start_line": 1045, "start_column": 8, "end_line": 1045, "end_column": 20 }, { "span": "flo_ref ", "start_line": 1126, "start_column": 8, "end_line": 1126, "end_column": 15 }, { "span": "flo_ref ", "start_line": 1257, "start_column": 8, "end_line": 1257, "end_column": 15 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "Compute", "Test", "Case_", "(_", "test_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "resiz", "e\\u", "instance", "\\u", "notification_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Ensur", "e", " ", "notification", "s", " ", "on", " ", "instance", " ", "migr", "ate", "/", "resiz", "e", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "instance", "\\u", "id_", "=_", "self_", "._", "\\u", "create", "\\u", "instance_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "context_", "=_", "self_", "._", "context_", "._", "elevat", "ed_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "inst", "\\u", "ref_", "=_", "db_", "._", "instance", "\\u", "get_", "(_", "context_", ",_", "instance", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "compute_", "._", "run", "\\u", "instance_", "(_", "self_", "._", "context_", ",_", "instance", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "test\\u", "notifier_", "._", "NOTIFICATION", "S_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "db_", "._", "instance", "\\u", "update_", "(_", "self_", "._", "context_", ",_", "instance", "\\u", "id_", ",_", "{_", "'", "host", "'_", ":_", "'", "foo", "'_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "compute_", "._", "prep", "\\u", "resize_", "(_", "context_", ",_", "inst", "\\u", "ref_", "[_", "'", "uuid", "'_", "]_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "migrati", "on", "\\u", "ref_", "=_", "db_", "._", "migrati", "on", "\\u", "get", "\\u", "by", "\\u", "instance", "\\u", "and", "\\u", "status_", "(_", "context_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "inst", "\\u", "ref_", "[_", "'", "uuid", "'_", "]_", ",_", "'", "pre", "-", "migrati", "ng", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "len_", "(_", "test\\u", "notifier_", "._", "NOTIFICATION", "S_", ")_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "msg_", "=_", "test\\u", "notifier_", "._", "NOTIFICATION", "S_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "msg_", "[_", "'", "priorit", "y", "'_", "]_", ",_", "'", "INFO", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "msg_", "[_", "'", "event", "\\u", "type", "'_", "]_", ",_", "'", "compute", ".", "instance", ".", "resiz", "e", ".", "prep", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "payload_", "=_", "msg_", "[_", "'", "payload", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "payload_", "[_", "'", "project", "\\u", "id", "'_", "]_", ",_", "self_", "._", "project", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "payload_", "[_", "'", "user", "\\u", "id", "'_", "]_", ",_", "self_", "._", "user", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "payload_", "[_", "'", "instance", "\\u", "id", "'_", "]_", ",_", "instance", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "payload_", "[_", "'", "instance", "\\u", "type", "'_", "]_", ",_", "'", "m1", ".", "tiny", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "type", "\\u", "id_", "=_", "instance", "\\u", "types_", "._", "get", "\\u", "instance", "\\u", "type", "\\u", "by", "\\u", "name_", "(_", "'", "m1", ".", "tiny", "'_", ")_", "[_", "'", "id", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "str_", "(_", "payload_", "[_", "'", "instance", "\\u", "type", "\\u", "id", "'_", "]_", ")_", ",_", "str_", "(_", "type", "\\u", "id_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'", "display", "\\u", "name", "'_", "in_", "payload_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'", "created", "\\u", "at", "'_", "in_", "payload_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'", "launched", "\\u", "at", "'_", "in_", "payload_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "payload_", "[_", "'", "image", "\\u", "ref", "'_", "]_", ",_", "'", "1", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "compute_", "._", "terminate", "\\u", "instance_", "(_", "context_", ",_", "instance", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Compute", "Test", "Case_", "(_", "test_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "post", "\\u", "live", "\\u", "migrati", "on", "\\u", "working", "\\u", "correct", "ly_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Confirm", " ", "post", "\\u", "live", "\\u", "migrati", "on", "()", " ", "works", " ", "as", " ", "expected", " ", "correct", "ly", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dest_", "=_", "'", "dest", "host", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "flo", "\\u", "addr_", "=_", "'", "1.2", ".1", ".2", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Prepar", "ing", " ", "datas_", "\\u\\u\\uNL\\u\\u\\u_", "c_", "=_", "context_", "._", "get", "\\u", "admin", "\\u", "context_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "instance", "\\u", "id_", "=_", "self_", "._", "\\u", "create", "\\u", "instance_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "i", "\\u", "ref_", "=_", "db_", "._", "instance", "\\u", "get_", "(_", "c_", ",_", "instance", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "db_", "._", "instance", "\\u", "update_", "(_", "c_", ",_", "i", "\\u", "ref_", "[_", "'", "id", "'_", "]_", ",_", "{_", "'", "vm", "\\u", "state", "'_", ":_", "vm", "\\u", "states_", "._", "MIGRAT", "ING_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "power", "\\u", "state", "'_", ":_", "power", "\\u", "state_", "._", "PAUSE", "D_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "v", "\\u", "ref_", "=_", "db_", "._", "volume", "\\u", "create_", "(_", "c_", ",_", "{_", "'", "size", "'_", ":_", "1_", ",_", "'", "instance", "\\u", "id", "'_", ":_", "instance", "\\u", "id_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fix", "\\u", "addr_", "=_", "db_", "._", "fixed", "\\u", "ip", "\\u", "create_", "(_", "c_", ",_", "{_", "'", "address", "'_", ":_", "'", "1.1", ".1", ".1", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "instance", "\\u", "id", "'_", ":_", "instance", "\\u", "id_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fix", "\\u", "ref_", "=_", "db_", "._", "fixed", "\\u", "ip", "\\u", "get", "\\u", "by", "\\u", "address_", "(_", "c_", ",_", "fix", "\\u", "addr_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "flo", "\\u", "ref_", "=_", "db_", "._", "float", "ing", "\\u", "ip", "\\u", "create_", "(_", "c_", ",_", "{_", "'", "address", "'_", ":_", "flo", "\\u", "addr_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "fixed", "\\u", "ip", "\\u", "id", "'_", ":_", "fix", "\\u", "ref_", "[_", "'", "id", "'_", "]_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "relo", "ad", " ", "is", " ", "necessar", "y", " ", "bef", "ore", " ", "setti", "ng", " ", "mocks_", "\\u\\u\\uNL\\u\\u\\u_", "i", "\\u", "ref_", "=_", "db_", "._", "instance", "\\u", "get_", "(_", "c_", ",_", "instance", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Prepar", "ing", " ", "mocks_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "mox_", "._", "Stu", "b", "Out", "With", "Mock_", "(_", "self_", "._", "compute_", "._", "volume", "\\u", "manager_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "remove", "\\u", "compute", "\\u", "volume", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "v_", "in_", "i", "\\u", "ref_", "[_", "'", "volume", "s", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "compute_", "._", "volume", "\\u", "manager_", "._", "remove", "\\u", "compute", "\\u", "volume_", "(_", "c_", ",_", "v_", "[_", "'", "id", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "mox_", "._", "Stu", "b", "Out", "With", "Mock_", "(_", "self_", "._", "compute_", "._", "driver_", ",_", "'", "unfi", "lter", "\\u", "instance", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "compute_", "._", "driver_", "._", "unfi", "lter", "\\u", "instance_", "(_", "i", "\\u", "ref_", ",_", "[_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "mox_", "._", "Stu", "b", "Out", "With", "Mock_", "(_", "rpc_", ",_", "'", "call", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rpc_", "._", "call_", "(_", "c_", ",_", "db_", "._", "queue", "\\u", "get", "\\u", "for_", "(_", "c_", ",_", "FLAGS_", "._", "compute", "\\u", "topic_", ",_", "dest_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "\"", "method", "\"_", ":_", "\"", "post", "\\u", "live", "\\u", "migrati", "on", "\\u", "at", "\\u", "destinat", "ion", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "args", "\"_", ":_", "{_", "'", "instance", "\\u", "id", "'_", ":_", "i", "\\u", "ref_", "[_", "'", "id", "'_", "]_", ",_", "'", "block", "\\u", "migrati", "on", "'_", ":_", "False_", "}_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "executi", "ng_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "mox_", "._", "Repl", "ay", "All_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ret_", "=_", "self_", "._", "compute_", "._", "post", "\\u", "live", "\\u", "migration_", "(_", "c_", ",_", "i", "\\u", "ref_", ",_", "dest_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "make", " ", "sure", " ", "every", " ", "data", " ", "is", " ", "rew", "rit", "ten", " ", "to", " ", "dest_", "\\u\\u\\uNL\\u\\u\\u_", "i", "\\u", "ref_", "=_", "db_", "._", "instance", "\\u", "get_", "(_", "c_", ",_", "i", "\\u", "ref_", "[_", "'", "id", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "c1_", "=_", "(_", "i", "\\u", "ref_", "[_", "'", "host", "'_", "]_", "==_", "dest_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "flo", "\\u", "refs_", "=_", "db_", "._", "float", "ing", "\\u", "ip", "\\u", "get", "\\u", "all", "\\u", "by", "\\u", "host_", "(_", "c_", ",_", "dest_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "c2_", "=_", "(_", "len_", "(_", "flo", "\\u", "refs_", ")_", "!=_", "0_", "and_", "flo", "\\u", "refs_", "[_", "0_", "]_", "[_", "'", "address", "'_", "]_", "==_", "flo", "\\u", "addr_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "post", " ", "opera", "ton_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "c1_", "and_", "c2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "db_", "._", "instance", "\\u", "destroy_", "(_", "c_", ",_", "instance", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "db_", "._", "volume", "\\u", "destroy_", "(_", "c_", ",_", "v", "\\u", "ref_", "[_", "'", "id", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "db_", "._", "float", "ing", "\\u", "ip", "\\u", "destroy_", "(_", "c_", ",_", "flo", "\\u", "addr_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Compute", "Test", "Case_", "(_", "test_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "get", "\\u", "by", "\\u", "fixed", "\\u", "ip_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Test", " ", "getti", "ng", " ", "1", " ", "instance", " ", "by", " ", "Fix", "ed", " ", "IP", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "c_", "=_", "context_", "._", "get", "\\u", "admin", "\\u", "context_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "instance", "\\u", "id1_", "=_", "self_", "._", "\\u", "create", "\\u", "instance_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "instance", "\\u", "id2_", "=_", "self_", "._", "\\u", "create", "\\u", "instance_", "(_", "{_", "'", "id", "'_", ":_", "20_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "instance", "\\u", "id3_", "=_", "self_", "._", "\\u", "create", "\\u", "instance_", "(_", "{_", "'", "id", "'_", ":_", "30_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "vi", "f", "\\u", "ref", "1_", "=_", "db_", "._", "virtual", "\\u", "interface", "\\u", "create_", "(_", "c_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "address", "'_", ":_", "'", "1", "2", ":", "3", "4", ":", "56", ":", "7", "8", ":", "90", ":", "1", "2", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "instance", "\\u", "id", "'_", ":_", "instance", "\\u", "id1_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "network", "\\u", "id", "'_", ":_", "1_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "vi", "f", "\\u", "ref", "2_", "=_", "db_", "._", "virtual", "\\u", "interface", "\\u", "create_", "(_", "c_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "address", "'_", ":_", "'", "90", ":", "1", "2", ":", "3", "4", ":", "56", ":", "7", "8", ":", "90", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "instance", "\\u", "id", "'_", ":_", "instance", "\\u", "id2_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "network", "\\u", "id", "'_", ":_", "1_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "db_", "._", "fixed", "\\u", "ip", "\\u", "create_", "(_", "c_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "address", "'_", ":_", "'", "1.1", ".1", ".1", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "instance", "\\u", "id", "'_", ":_", "instance", "\\u", "id1_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "virtual", "\\u", "interface", "\\u", "id", "'_", ":_", "vi", "f", "\\u", "ref", "1_", "[_", "'", "id", "'_", "]_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "db_", "._", "fixed", "\\u", "ip", "\\u", "create_", "(_", "c_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "address", "'_", ":_", "'", "1.1", ".2", ".1", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "instance", "\\u", "id", "'_", ":_", "instance", "\\u", "id2_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "virtual", "\\u", "interface", "\\u", "id", "'_", ":_", "vi", "f", "\\u", "ref", "2_", "[_", "'", "id", "'_", "]_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "regex", " ", "not", " ", "allowed_", "\\u\\u\\uNL\\u\\u\\u_", "instances_", "=_", "self_", "._", "compute", "\\u", "api_", "._", "get", "\\u", "all_", "(_", "c_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "search", "\\u", "opts_", "=_", "{_", "'", "fixed", "\\u", "ip", "'_", ":_", "'.*'_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "instances_", ")_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "instances_", "=_", "self_", "._", "compute", "\\u", "api_", "._", "get", "\\u", "all_", "(_", "c_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "search", "\\u", "opts_", "=_", "{_", "'", "fixed", "\\u", "ip", "'_", ":_", "'", "1.1", ".3", ".1", "'_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "instances_", ")_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "instances_", "=_", "self_", "._", "compute", "\\u", "api_", "._", "get", "\\u", "all_", "(_", "c_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "search", "\\u", "opts_", "=_", "{_", "'", "fixed", "\\u", "ip", "'_", ":_", "'", "1.1", ".1", ".1", "'_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "instances_", ")_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "instances_", "[_", "0_", "]_", "._", "id_", ",_", "instance", "\\u", "id1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "instances_", "=_", "self_", "._", "compute", "\\u", "api_", "._", "get", "\\u", "all_", "(_", "c_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "search", "\\u", "opts_", "=_", "{_", "'", "fixed", "\\u", "ip", "'_", ":_", "'", "1.1", ".2", ".1", "'_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "instances_", ")_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "instances_", "[_", "0_", "]_", "._", "id_", ",_", "instance", "\\u", "id2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "db_", "._", "virtual", "\\u", "interface", "\\u", "delete_", "(_", "c_", ",_", "vi", "f", "\\u", "ref", "1_", "[_", "'", "id", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "db_", "._", "virtual", "\\u", "interface", "\\u", "delete_", "(_", "c_", ",_", "vi", "f", "\\u", "ref", "2_", "[_", "'", "id", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "db_", "._", "instance", "\\u", "destroy_", "(_", "c_", ",_", "instance", "\\u", "id1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "db_", "._", "instance", "\\u", "destroy_", "(_", "c_", ",_", "instance", "\\u", "id2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Compute", "Test", "Case_", "(_", "test_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "get", "\\u", "all", "\\u", "by", "\\u", "ip", "\\u", "regexp_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Test", " ", "search", "ing", " ", "by", " ", "Float", "ing", " ", "and", " ", "Fix", "ed", " ", "IP", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "c_", "=_", "context_", "._", "get", "\\u", "admin", "\\u", "context_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "instance", "\\u", "id1_", "=_", "self_", "._", "\\u", "create", "\\u", "instance_", "(_", "{_", "'", "display", "\\u", "name", "'_", ":_", "'", "woo", "t", "'_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "instance", "\\u", "id2_", "=_", "self_", "._", "\\u", "create", "\\u", "instance_", "(_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "display", "\\u", "name", "'_", ":_", "'", "woo", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "id", "'_", ":_", "20_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "instance", "\\u", "id3_", "=_", "self_", "._", "\\u", "create", "\\u", "instance_", "(_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "display", "\\u", "name", "'_", ":_", "'", "not", "-", "woo", "t", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "id", "'_", ":_", "30_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "vi", "f", "\\u", "ref", "1_", "=_", "db_", "._", "virtual", "\\u", "interface", "\\u", "create_", "(_", "c_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "address", "'_", ":_", "'", "1", "2", ":", "3", "4", ":", "56", ":", "7", "8", ":", "90", ":", "1", "2", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "instance", "\\u", "id", "'_", ":_", "instance", "\\u", "id1_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "network", "\\u", "id", "'_", ":_", "1_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "vi", "f", "\\u", "ref", "2_", "=_", "db_", "._", "virtual", "\\u", "interface", "\\u", "create_", "(_", "c_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "address", "'_", ":_", "'", "90", ":", "1", "2", ":", "3", "4", ":", "56", ":", "7", "8", ":", "90", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "instance", "\\u", "id", "'_", ":_", "instance", "\\u", "id2_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "network", "\\u", "id", "'_", ":_", "1_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "vi", "f", "\\u", "ref", "3_", "=_", "db_", "._", "virtual", "\\u", "interface", "\\u", "create_", "(_", "c_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "address", "'_", ":_", "'", "3", "4", ":", "56", ":", "7", "8", ":", "90", ":", "1", "2", ":", "3", "4", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "instance", "\\u", "id", "'_", ":_", "instance", "\\u", "id3_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "network", "\\u", "id", "'_", ":_", "1_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "db_", "._", "fixed", "\\u", "ip", "\\u", "create_", "(_", "c_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "address", "'_", ":_", "'", "1.1", ".1", ".1", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "instance", "\\u", "id", "'_", ":_", "instance", "\\u", "id1_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "virtual", "\\u", "interface", "\\u", "id", "'_", ":_", "vi", "f", "\\u", "ref", "1_", "[_", "'", "id", "'_", "]_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "db_", "._", "fixed", "\\u", "ip", "\\u", "create_", "(_", "c_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "address", "'_", ":_", "'", "1.1", ".2", ".1", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "instance", "\\u", "id", "'_", ":_", "instance", "\\u", "id2_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "virtual", "\\u", "interface", "\\u", "id", "'_", ":_", "vi", "f", "\\u", "ref", "2_", "[_", "'", "id", "'_", "]_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fix", "\\u", "addr_", "=_", "db_", "._", "fixed", "\\u", "ip", "\\u", "create_", "(_", "c_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "address", "'_", ":_", "'", "1.1", ".3", ".1", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "instance", "\\u", "id", "'_", ":_", "instance", "\\u", "id3_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "virtual", "\\u", "interface", "\\u", "id", "'_", ":_", "vi", "f", "\\u", "ref", "3_", "[_", "'", "id", "'_", "]_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fix", "\\u", "ref_", "=_", "db_", "._", "fixed", "\\u", "ip", "\\u", "get", "\\u", "by", "\\u", "address_", "(_", "c_", ",_", "fix", "\\u", "addr_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "flo", "\\u", "ref_", "=_", "db_", "._", "float", "ing", "\\u", "ip", "\\u", "create_", "(_", "c_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "address", "'_", ":_", "'", "10.", "0.", "0.", "2", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "fixed", "\\u", "ip", "\\u", "id", "'_", ":_", "fix", "\\u", "ref_", "[_", "'", "id", "'_", "]_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "ends", " ", "up", " ", "matchi", "ng", " ", "2n", "d", " ", "oct", "et", " ", "here", "..", " ", "so", " ", "all", " ", "3", " ", "match_", "\\u\\u\\uNL\\u\\u\\u_", "instances_", "=_", "self_", "._", "compute", "\\u", "api_", "._", "get", "\\u", "all_", "(_", "c_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "search", "\\u", "opts_", "=_", "{_", "'", "ip", "'_", ":_", "'.*", "\\\\.", "1", "'_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "instances_", ")_", ",_", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "instances_", "=_", "self_", "._", "compute", "\\u", "api_", "._", "get", "\\u", "all_", "(_", "c_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "search", "\\u", "opts_", "=_", "{_", "'", "ip", "'_", ":_", "'", "1", ".*'_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "instances_", ")_", ",_", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "instances_", "=_", "self_", "._", "compute", "\\u", "api_", "._", "get", "\\u", "all_", "(_", "c_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "search", "\\u", "opts_", "=_", "{_", "'", "ip", "'_", ":_", "'.*", "\\\\.", "1", ".\\\\", "d", "+$", "'_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "instances_", ")_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "instance", "\\u", "ids_", "=_", "[_", "instance_", "._", "id_", "for_", "instance_", "in_", "instances_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "instance", "\\u", "id1_", "in_", "instance", "\\u", "ids_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "instances_", "=_", "self_", "._", "compute", "\\u", "api_", "._", "get", "\\u", "all_", "(_", "c_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "search", "\\u", "opts_", "=_", "{_", "'", "ip", "'_", ":_", "'.*", "\\\\.", "2", ".+", "'_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "instances_", ")_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "instances_", "[_", "0_", "]_", "._", "id_", ",_", "instance", "\\u", "id2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "instances_", "=_", "self_", "._", "compute", "\\u", "api_", "._", "get", "\\u", "all_", "(_", "c_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "search", "\\u", "opts_", "=_", "{_", "'", "ip", "'_", ":_", "'", "10.", "*'_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "instances_", ")_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "instances_", "[_", "0_", "]_", "._", "id_", ",_", "instance", "\\u", "id3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "db_", "._", "virtual", "\\u", "interface", "\\u", "delete_", "(_", "c_", ",_", "vi", "f", "\\u", "ref", "1_", "[_", "'", "id", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "db_", "._", "virtual", "\\u", "interface", "\\u", "delete_", "(_", "c_", ",_", "vi", "f", "\\u", "ref", "2_", "[_", "'", "id", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "db_", "._", "virtual", "\\u", "interface", "\\u", "delete_", "(_", "c_", ",_", "vi", "f", "\\u", "ref", "3_", "[_", "'", "id", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "db_", "._", "float", "ing", "\\u", "ip", "\\u", "destroy_", "(_", "c_", ",_", "'", "10.", "0.", "0.", "2", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "db_", "._", "instance", "\\u", "destroy_", "(_", "c_", ",_", "instance", "\\u", "id1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "db_", "._", "instance", "\\u", "destroy_", "(_", "c_", ",_", "instance", "\\u", "id2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "db_", "._", "instance", "\\u", "destroy_", "(_", "c_", ",_", "instance", "\\u", "id3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Compute", "Test", "Case_", "(_", "test_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "get", "\\u", "all", "\\u", "by", "\\u", "multiple", "\\u", "options", "\\u", "at", "\\u", "once_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Test", " ", "search", "ing", " ", "by", " ", "multiple", " ", "options", " ", "at", " ", "onc", "e", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "c_", "=_", "context_", "._", "get", "\\u", "admin", "\\u", "context_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "instance", "\\u", "id1_", "=_", "self_", "._", "\\u", "create", "\\u", "instance_", "(_", "{_", "'", "display", "\\u", "name", "'_", ":_", "'", "woo", "t", "'_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "instance", "\\u", "id2_", "=_", "self_", "._", "\\u", "create", "\\u", "instance_", "(_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "display", "\\u", "name", "'_", ":_", "'", "woo", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "id", "'_", ":_", "20_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "instance", "\\u", "id3_", "=_", "self_", "._", "\\u", "create", "\\u", "instance_", "(_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "display", "\\u", "name", "'_", ":_", "'", "not", "-", "woo", "t", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "id", "'_", ":_", "30_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "vi", "f", "\\u", "ref", "1_", "=_", "db_", "._", "virtual", "\\u", "interface", "\\u", "create_", "(_", "c_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "address", "'_", ":_", "'", "1", "2", ":", "3", "4", ":", "56", ":", "7", "8", ":", "90", ":", "1", "2", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "instance", "\\u", "id", "'_", ":_", "instance", "\\u", "id1_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "network", "\\u", "id", "'_", ":_", "1_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "vi", "f", "\\u", "ref", "2_", "=_", "db_", "._", "virtual", "\\u", "interface", "\\u", "create_", "(_", "c_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "address", "'_", ":_", "'", "90", ":", "1", "2", ":", "3", "4", ":", "56", ":", "7", "8", ":", "90", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "instance", "\\u", "id", "'_", ":_", "instance", "\\u", "id2_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "network", "\\u", "id", "'_", ":_", "1_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "vi", "f", "\\u", "ref", "3_", "=_", "db_", "._", "virtual", "\\u", "interface", "\\u", "create_", "(_", "c_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "address", "'_", ":_", "'", "3", "4", ":", "56", ":", "7", "8", ":", "90", ":", "1", "2", ":", "3", "4", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "instance", "\\u", "id", "'_", ":_", "instance", "\\u", "id3_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "network", "\\u", "id", "'_", ":_", "1_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "db_", "._", "fixed", "\\u", "ip", "\\u", "create_", "(_", "c_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "address", "'_", ":_", "'", "1.1", ".1", ".1", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "instance", "\\u", "id", "'_", ":_", "instance", "\\u", "id1_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "virtual", "\\u", "interface", "\\u", "id", "'_", ":_", "vi", "f", "\\u", "ref", "1_", "[_", "'", "id", "'_", "]_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "db_", "._", "fixed", "\\u", "ip", "\\u", "create_", "(_", "c_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "address", "'_", ":_", "'", "1.1", ".2", ".1", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "instance", "\\u", "id", "'_", ":_", "instance", "\\u", "id2_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "virtual", "\\u", "interface", "\\u", "id", "'_", ":_", "vi", "f", "\\u", "ref", "2_", "[_", "'", "id", "'_", "]_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fix", "\\u", "addr_", "=_", "db_", "._", "fixed", "\\u", "ip", "\\u", "create_", "(_", "c_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "address", "'_", ":_", "'", "1.1", ".3", ".1", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "instance", "\\u", "id", "'_", ":_", "instance", "\\u", "id3_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "virtual", "\\u", "interface", "\\u", "id", "'_", ":_", "vi", "f", "\\u", "ref", "3_", "[_", "'", "id", "'_", "]_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fix", "\\u", "ref_", "=_", "db_", "._", "fixed", "\\u", "ip", "\\u", "get", "\\u", "by", "\\u", "address_", "(_", "c_", ",_", "fix", "\\u", "addr_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "flo", "\\u", "ref_", "=_", "db_", "._", "float", "ing", "\\u", "ip", "\\u", "create_", "(_", "c_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "address", "'_", ":_", "'", "10.", "0.", "0.", "2", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "fixed", "\\u", "ip", "\\u", "id", "'_", ":_", "fix", "\\u", "ref_", "[_", "'", "id", "'_", "]_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "ip", " ", "ends", " ", "up", " ", "matchi", "ng", " ", "2n", "d", " ", "oct", "et", " ", "here", "..", " ", "so", " ", "all", " ", "3", " ", "match", " ", "ip_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "but", " ", "'", "name", "'", " ", "only", " ", "matche", "s", " ", "one_", "\\u\\u\\uNL\\u\\u\\u_", "instances_", "=_", "self_", "._", "compute", "\\u", "api_", "._", "get", "\\u", "all_", "(_", "c_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "search", "\\u", "opts_", "=_", "{_", "'", "ip", "'_", ":_", "'.*", "\\\\.", "1", "'_", ",_", "'", "name", "'_", ":_", "'", "not", ".*'_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "instances_", ")_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "instances_", "[_", "0_", "]_", "._", "id_", ",_", "instance", "\\u", "id3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "ip", " ", "ends", " ", "up", " ", "matchi", "ng", " ", "any", " ", "ip", " ", "with", " ", "a", " ", "'", "2", "'", " ", "in", " ", "it", "..", " ", "so", " ", "instance_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "2", " ", "and", " ", "3", "..", " ", "but", " ", "name", " ", "shou", "ld", " ", "only", " ", "match", " ", "#", "2_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "but", " ", "'", "name", "'", " ", "only", " ", "matche", "s", " ", "one_", "\\u\\u\\uNL\\u\\u\\u_", "instances_", "=_", "self_", "._", "compute", "\\u", "api_", "._", "get", "\\u", "all_", "(_", "c_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "search", "\\u", "opts_", "=_", "{_", "'", "ip", "'_", ":_", "'.*", "2", "'_", ",_", "'", "name", "'_", ":_", "'", "^", "woo", ".*'_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "instances_", ")_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "instances_", "[_", "0_", "]_", "._", "id_", ",_", "instance", "\\u", "id2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "same", " ", "as", " ", "above", " ", "but", " ", "no", " ", "match", " ", "on", " ", "name", " ", "(", "name", " ", "matche", "s", " ", "instance", "\\u", "id1_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "but", " ", "the", " ", "ip", " ", "query", " ", "doe", "sn", "'", "t_", "\\u\\u\\uNL\\u\\u\\u_", "instances_", "=_", "self_", "._", "compute", "\\u", "api_", "._", "get", "\\u", "all_", "(_", "c_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "search", "\\u", "opts_", "=_", "{_", "'", "ip", "'_", ":_", "'.*", "2", ".*'_", ",_", "'", "name", "'_", ":_", "'", "^", "woo", "t", ".*'_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "instances_", ")_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "ip", " ", "matche", "s", " ", "all", " ", "3", "...", " ", "ipv", "6", " ", "matche", "s", " ", "#", "2", "+", "#", "3", "...", "name", " ", "matche", "s", " ", "#", "3_", "\\u\\u\\uNL\\u\\u\\u_", "instances_", "=_", "self_", "._", "compute", "\\u", "api_", "._", "get", "\\u", "all_", "(_", "c_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "search", "\\u", "opts_", "=_", "{_", "'", "ip", "'_", ":_", "'.*", "\\\\.", "1", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "name", "'_", ":_", "'", "not", ".*'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "ip6", "'_", ":_", "'", "^", ".*", "12.", "*", "34.", "*'_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "instances_", ")_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "instances_", "[_", "0_", "]_", "._", "id_", ",_", "instance", "\\u", "id3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "db_", "._", "virtual", "\\u", "interface", "\\u", "delete_", "(_", "c_", ",_", "vi", "f", "\\u", "ref", "1_", "[_", "'", "id", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "db_", "._", "virtual", "\\u", "interface", "\\u", "delete_", "(_", "c_", ",_", "vi", "f", "\\u", "ref", "2_", "[_", "'", "id", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "db_", "._", "virtual", "\\u", "interface", "\\u", "delete_", "(_", "c_", ",_", "vi", "f", "\\u", "ref", "3_", "[_", "'", "id", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "db_", "._", "float", "ing", "\\u", "ip", "\\u", "destroy_", "(_", "c_", ",_", "'", "10.", "0.", "0.", "2", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "db_", "._", "instance", "\\u", "destroy_", "(_", "c_", ",_", "instance", "\\u", "id1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "db_", "._", "instance", "\\u", "destroy_", "(_", "c_", ",_", "instance", "\\u", "id2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "db_", "._", "instance", "\\u", "destroy_", "(_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2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
jacobian-archive/timetric/test.py
[ { "content": "\"\"\"\nBasic timetric tests. These aren't easy to run since you need an authorized\nOAuth client, so to make this work you'll need a timetric.conf file in this\ndirectory with the appropriate authorized info. It should look like::\n\n [timetric_tests]\n consumer_secret = XXX\n consumer_key = XXX\n oauth_token = XXX\n oauth_secret = XXX\n \nYou'll realize that this means the tests doen't test the OAuth authenorization\nflow. Patches welcome!\n\"\"\"\n\nimport datetime\nimport ConfigParser\nimport os\nimport time\nimport timetric\nimport unittest\nfrom cStringIO import StringIO\n\n\n \nif __name__ == '__main__':\n import httplib2\n #httplib2.debuglevel = 1\n unittest.main()", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class TimetricTests(unittest.TestCase):\n \n \n \n \n \n \n \n \n \n \n", "metadata": "root.TimetricTests", "header": "['module', '___EOS___']", "index": 23 }, { "content": " def setUp(self):\n conf = ConfigParser.ConfigParser()\n conf.read(os.path.join(os.path.dirname(__file__), 'timetric.conf'))\n self.client = timetric.TimetricClient(dict(conf.items('timetric_tests')))", "metadata": "root.TimetricTests.setUp", "header": "['class', 'TimetricTests', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 25 }, { "content": " def tearDown(self):\n self.client = None", "metadata": "root.TimetricTests.tearDown", "header": "['class', 'TimetricTests', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 30 }, { "content": " def make_series(self, data=None):\n return self.client.create_series(\n caption = 'Timetric-python test series',\n title = 'Timetric-python test series',\n data = data,\n )", "metadata": "root.TimetricTests.make_series", "header": "['class', 'TimetricTests', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 33 }, { "content": " def test_create_series(self):\n series = self.make_series()\n self.assertEqual(list(series), [])\n series.delete()", "metadata": "root.TimetricTests.test_create_series", "header": "['class', 'TimetricTests', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 40 }, { "content": " def test_create_series_with_data(self):\n data = [\n (1236735000, 1.0),\n (1236735500, 2.5),\n (1236736000, 5.0),\n ]\n series = self.make_series(data)\n\n # Give Timetric a bit to catch up before checking the data\n time.sleep(5)\n self.assertEqual(list(series), data)\n series.delete()", "metadata": "root.TimetricTests.test_create_series_with_data", "header": "['class', 'TimetricTests', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 45 }, { "content": " def test_update_single_value(self):\n series = self.make_series()\n series.update(10.0)\n time.sleep(5) \n self.assertEqual(float(series), 10.0)\n series.delete()", "metadata": "root.TimetricTests.test_update_single_value", "header": "['class', 'TimetricTests', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 58 }, { "content": " def test_update_from_iterable(self):\n series = self.make_series()\n data = [\n (1236735000, 1.0),\n (1236735500, 2.5),\n (1236736000, 5.0),\n ]\n series.update(data)\n time.sleep(5)\n self.assertEqual(len(list(series)), 3)\n series.delete()", "metadata": "root.TimetricTests.test_update_from_iterable", "header": "['class', 'TimetricTests', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 65 }, { "content": " def test_update_from_file(self):\n io = StringIO('1236735000,1.0\\n1236735500,2.5\\n1236736000,5.0')\n series = self.make_series()\n series.update(io)\n time.sleep(5)\n self.assertEqual(len(list(series)), 3)\n series.delete()", "metadata": "root.TimetricTests.test_update_from_file", "header": "['class', 'TimetricTests', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 77 }, { "content": " def test_increment_decrement(self):\n series = self.make_series()\n series.update(10.0)\n series.increment(4.5)\n series.increment(-2.0)\n time.sleep(5)\n self.assertEqual(float(series), 12.5)\n series.delete()", "metadata": "root.TimetricTests.test_increment_decrement", "header": "['class', 'TimetricTests', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 85 }, { "content": " def test_increment_syntactic_sugar(self):\n series = self.make_series()\n series.update(10.0)\n series += 4.5\n series -= 2.0\n time.sleep(5)\n self.assertEqual(float(series), 12.5)\n series.delete()", "metadata": "root.TimetricTests.test_increment_syntactic_sugar", "header": "['class', 'TimetricTests', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 94 }, { "content": " def test_rewrite(self):\n series = self.make_series()\n data = [\n (1236735000, 1.0),\n (1236735500, 2.5),\n (1236736000, 5.0),\n ]\n series.update(data)\n time.sleep(5)\n self.assertEqual(len(list(series)), 3)\n\n data2 = [\n (1236735000, 9),\n (1236735500, 10),\n (1236736000, 11),\n ]\n series.rewrite(data2)\n time.sleep(5)\n self.assertEqual(list(series), data2)", "metadata": "root.TimetricTests.test_rewrite", "header": "['class', 'TimetricTests', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 103 } ]
[ { "span": "import datetime", "start_line": 15, "start_column": 0, "end_line": 15, "end_column": 15 }, { "span": "import httplib2", "start_line": 125, "start_column": 4, "end_line": 125, "end_column": 19 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\"\"\"", "\\", "10", ";", "Basic", " ", "time", "tric", " ", "tests", ".", " ", "The", "se", " ", "are", "n", "'", "t", " ", "easy", " ", "to", " ", "run", " ", "sinc", "e", " ", "you", " ", "need", " ", "an", " ", "authoriz", "ed", "\\", "10", ";", "OA", "uth", " ", "client", ",", " ", "so", " ", "to", " ", "make", " ", "this", " ", "work", " ", "you", "'", "ll", " ", "need", " ", "a", " ", "time", "tric", ".", "conf", " ", "file", " ", "in", " ", "this", "\\", "10", ";", "director", "y", " ", "with", " ", "the", " ", "appropr", "iate", " ", "authoriz", "ed", " ", "info", ".", " ", "It", " ", "shou", "ld", " ", "look", " ", "like", "::", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "[", "time", "tric", "\\u", "tests", "]", "\\", "10", ";", " ", " ", " ", " ", "consume", "r", "\\u", "secret", " ", "=", " ", "XX", "X", "\\", "10", ";", " ", " ", " ", " ", "consume", "r", "\\u", "key", " ", "=", " ", "XX", "X", "\\", "10", ";", " ", " ", " ", " ", "oauth", "\\u", "token", " ", "=", " ", "XX", "X", "\\", "10", ";", " ", " ", " ", " ", "oauth", "\\u", "secret", " ", "=", " ", "XX", "X", "\\", "10", ";", " ", " ", " ", " ", "\\", "10", ";", "You", "'", "ll", " ", "realize", " ", "tha", "t", " ", "this", " ", "means", " ", "the", " ", "tests", " ", "doe", "n", "'", "t", " ", "test", " ", "the", " ", "OA", "uth", " ", "authe", "nor", "izatio", "n", "\\", "10", ";", "flow", ".", " ", "Patche", "s", " ", "welcome", "!", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "datetime_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "Config", "Parser_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "time_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "time", "tric", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "unittest_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "c", "String", "IO_", "import_", "String", "IO_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "\\u\\u", "name\\u\\u_", "==_", "'\\u", "\\u", "main", "\\u\\u'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "httplib2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "http", "lib", "2", ".", "debugl", "evel", " ", "=", " ", "1_", "\\u\\u\\uNL\\u\\u\\u_", "unittest_", "._", "main_", "(_", ")_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Time", "tric", "Tests_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Time", "tric", "Tests_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "set", "Up_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "conf_", "=_", "Config", "Parser_", "._", "Config", "Parser_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "conf_", "._", "read_", "(_", "os_", "._", "path_", "._", "join_", "(_", "os_", "._", "path_", "._", "dirname_", "(_", "\\u\\u", "file\\u\\u_", ")_", ",_", "'", "time", "tric", ".", "conf", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "client_", "=_", "time", "tric", "_", "._", "Time", "tric", "Client_", "(_", "dict_", "(_", "conf_", "._", "items_", "(_", "'", "time", "tric", "\\u", "tests", "'_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Time", "tric", "Tests_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "tear", "Down_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "client_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Time", "tric", "Tests_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "make", "\\u", "series_", "(_", "self_", ",_", "data_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "client_", "._", "create", "\\u", "series_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "caption_", "=_", "'", "Time", "tric", "-", "python", " ", "test", " ", "series", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "title_", "=_", "'", "Time", "tric", "-", "python", " ", "test", " ", "series", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "data_", "=_", "data_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Time", "tric", "Tests_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "create", "\\u", "series_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "series_", "=_", "self_", "._", "make", "\\u", "series_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "list_", "(_", "series_", ")_", ",_", "[_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "series_", "._", "delete_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Time", "tric", "Tests_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "create", "\\u", "series", "\\u", "with", "\\u", "data_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "data_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "123", "673", "5000_", ",_", "1.0_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "123", "673", "5500", "_", ",_", "2.5_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "123", "673", "6000_", ",_", "5.0_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "series_", "=_", "self_", "._", "make", "\\u", "series_", "(_", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Give", " ", "Time", "tric", " ", "a", " ", "bit", " ", "to", " ", "catch", " ", "up", " ", "bef", "ore", " ", "checking", " ", "the", " ", "data_", "\\u\\u\\uNL\\u\\u\\u_", "time_", "._", "sleep_", "(_", "5_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "list_", "(_", "series_", ")_", ",_", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "series_", "._", "delete_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Time", "tric", "Tests_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "update", "\\u", "single", "\\u", "value_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "series_", "=_", "self_", "._", "make", "\\u", "series_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "series_", "._", "update_", "(_", "10.0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "time_", "._", "sleep_", "(_", "5_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "float_", "(_", "series_", ")_", ",_", "10.0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "series_", "._", "delete_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Time", "tric", "Tests_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "update", "\\u", "from", "\\u", "iterable_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "series_", "=_", "self_", "._", "make", "\\u", "series_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "123", "673", "5000_", ",_", "1.0_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "123", "673", "5500", "_", ",_", "2.5_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "123", "673", "6000_", ",_", "5.0_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "series_", "._", "update_", "(_", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "time_", "._", "sleep_", "(_", "5_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "list_", "(_", "series_", ")_", ")_", ",_", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "series_", "._", "delete_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Time", "tric", "Tests_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "update", "\\u", "from", "\\u", "file_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "io_", "=_", "String", "IO_", "(_", "'", "123", "673", "5000", ",", "1.0", "\\\\", "n1", "236", "735", "500", ",", "2.5", "\\\\", "n1", "236", "736", "000", ",", "5.0", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "series_", "=_", "self_", "._", "make", "\\u", "series_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "series_", "._", "update_", "(_", "io_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "time_", "._", "sleep_", "(_", "5_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "list_", "(_", "series_", ")_", ")_", ",_", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "series_", "._", "delete_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Time", "tric", "Tests_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "increment", "\\u", "decrement", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "series_", "=_", "self_", "._", "make", "\\u", "series_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "series_", "._", "update_", "(_", "10.0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "series_", "._", "increment_", "(_", "4.5_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "series_", "._", "increment_", "(_", "-_", "2.0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "time_", "._", "sleep_", "(_", "5_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "float_", "(_", "series_", ")_", ",_", "12.", "5_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "series_", "._", "delete_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Time", "tric", "Tests_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "increment", "\\u", "synta", "ctic", "\\u", "sugar", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "series_", "=_", "self_", "._", "make", "\\u", "series_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "series_", "._", "update_", "(_", "10.0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "series_", "+=_", "4.5_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "series_", "-=_", "2.0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "time_", "._", "sleep_", "(_", "5_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "float_", "(_", "series_", ")_", ",_", "12.", "5_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "series_", "._", "delete_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Time", "tric", "Tests_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "rewrite", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "series_", "=_", "self_", "._", "make", "\\u", "series_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "123", "673", "5000_", ",_", "1.0_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "123", "673", "5500", "_", ",_", "2.5_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "123", "673", "6000_", ",_", "5.0_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "series_", "._", "update_", "(_", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "time_", "._", "sleep_", "(_", "5_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "list_", "(_", "series_", ")_", ")_", ",_", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "data2_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "123", "673", "5000_", ",_", "9_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "123", "673", "5500", "_", ",_", "10_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "123", "673", "6000_", ",_", "11_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "series_", "._", "rewrite", "_", "(_", "data2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "time_", "._", "sleep_", "(_", "5_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "list_", "(_", "series_", ")_", ",_", "data2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unnecessary pass
treeio/treeio/treeio/messaging/tests.py
[ { "content": " def test_message_compose_login(self):\n \"Test index page with login at /message/compose/\"\n response = self.client.post('/accounts/login',\n {'username': self.username, 'password': self.password})\n self.assertRedirects(response, '/')\n response = self.client.get(reverse('messaging_message_compose'))\n # self.assertEquals(response.status_code, 200)\n pass", "metadata": "root.MessagingViewsTest.test_message_compose_login", "header": "['class', 'MessagingViewsTest', '(', 'TestCase', ')', ':', '___EOS___']", "index": 140 } ]
[ { "span": "pass", "start_line": 147, "start_column": 8, "end_line": 147, "end_column": 12 } ]
[]
1
true
[ "[CLS]_", "Un", "necessar", "y_", "pass_", "[SEP]_", "class_", "Messag", "ing", "View", "s", "Test_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "message", "\\u", "compose", "\\u", "login_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"", "Test", " ", "index", " ", "page", " ", "with", " ", "login", " ", "at", " ", "/", "message", "/", "compose", "/\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "=_", "self_", "._", "client_", "._", "post_", "(_", "'/", "account", "s", "/", "login", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "user", "name", "'_", ":_", "self_", "._", "username_", ",_", "'", "password", "'_", ":_", "self_", "._", "password_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Redirects_", "(_", "response_", ",_", "'/'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "=_", "self_", "._", "client_", "._", "get_", "(_", "reverse_", "(_", "'", "mess", "agin", "g", "\\u", "message", "\\u", "compose", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "self", ".", "assert", "Equal", "s", "(", "response", ".", "status", "\\u", "code", ",", " ", "200", ")_", "\\u\\u\\uNL\\u\\u\\u_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2 ]
Imprecise assert
PyTables/PyTables/tables/tests/test_nestedtypes.py
[ { "content": " def _checkColinstances(self, table):\n \"\"\"Check that ``colinstances`` and ``cols`` of `table` match.\"\"\"\n for colpathname in table.description._v_pathnames:\n self.assertTrue(table.colinstances[colpathname]\n is table.cols._f_col(colpathname))", "metadata": "root.CreateTestCase._checkColinstances", "header": "['class', 'CreateTestCase', '(', 'common', '.', 'TempFileMixin', ',', 'TestCase', ')', ':', '___EOS___']", "index": 237 }, { "content": " def test05a_modifyColumns(self):\n \"\"\"Modifying one nested column (modify_columns).\"\"\"\n\n tbl = self.h5file.create_table(\n '/', 'test', self._TestTDescr, title=self._getMethodName())\n tbl.append(self._testAData)\n tbl.flush()\n\n nColumn = self._testNestedCol\n # Get the nested column data and swap the first and last rows.\n raTable = self._testAData.copy()\n raColumn = raTable[nColumn]\n (raColumn[0], raColumn[-1]) = (raColumn[-1].copy(), raColumn[0].copy())\n newdtype = numpy.dtype([(nColumn, raTable.dtype.fields[nColumn][0])])\n self.assertTrue(newdtype is not None)\n\n # Write the resulting column and re-read the whole table.\n tbl.modify_columns(names=[nColumn], columns=raColumn)\n tbl.flush()\n\n if self.reopen:\n self._reopen()\n tbl = self.h5file.root.test\n\n raReadTable = tbl.read()\n if common.verbose:\n print(\"Table read:\", raReadTable)\n print(\"Should look like:\", raTable)\n\n # Compare it to the written one.\n self.assertTrue(common.areArraysEqual(raTable, raReadTable),\n \"Written and read values differ.\")", "metadata": "root.WriteTestCase.test05a_modifyColumns", "header": "['class', 'WriteTestCase', '(', 'common', '.', 'TempFileMixin', ',', 'TestCase', ')', ':', '___EOS___']", "index": 462 }, { "content": " def test07_index(self):\n \"\"\"Checking indexes of nested columns.\"\"\"\n\n tbl = self.h5file.create_table(\n '/', 'test', self._TestTDescr, title=self._getMethodName(),\n expectedrows=minRowIndex * 2)\n for i in range(minRowIndex):\n tbl.append(self._testAData)\n tbl.flush()\n coltoindex = tbl.cols._f_col(self._testCondCol)\n indexrows = coltoindex.create_index()\n self.assertTrue(indexrows is not None)\n\n if self.reopen:\n self._reopen()\n tbl = self.h5file.root.test\n coltoindex = tbl.cols._f_col(self._testCondCol)\n\n if common.verbose:\n print(\"Number of written rows:\", tbl.nrows)\n print(\"Number of indexed rows:\", coltoindex.index.nelements)\n\n # Check indexing flags:\n self.assertEqual(tbl.indexed, True, \"Table not indexed\")\n self.assertNotEqual(coltoindex.index, None, \"Column not indexed\")\n self.assertTrue(tbl.colindexed[\n self._testCondCol], \"Column not indexed\")\n # Do a look-up for values\n searchedCoords = tbl.get_where_list(\n self._testCondition, self._testCondVars(tbl))\n searchedCoords.sort()\n\n expectedCoords = numpy.arange(0, minRowIndex * 2, 2, SizeType)\n if common.verbose:\n print(\"Searched coords:\", searchedCoords)\n print(\"Expected coords:\", expectedCoords)\n # All even rows match the condition.\n self.assertEqual(searchedCoords.tolist(), expectedCoords.tolist(),\n \"Search returned incorrect results.\")", "metadata": "root.WriteTestCase.test07_index", "header": "['class', 'WriteTestCase', '(', 'common', '.', 'TempFileMixin', ',', 'TestCase', ')', ':', '___EOS___']", "index": 564 }, { "content": " def test00a_repr(self):\n \"\"\"Checking representation of a nested Table.\"\"\"\n\n tbl = self.h5file.create_table(\n '/', 'test', self._TestTDescr, title=\"test00\")\n tbl.append(self._testAData)\n\n if self.reopen:\n self._reopen()\n tbl = self.h5file.root.test\n\n if common.verbose:\n print(\"str(tbl)-->\", str(tbl))\n print(\"repr(tbl)-->\", repr(tbl))\n\n self.assertEqual(str(tbl), \"/test (Table(2,)) 'test00'\")\n tblrepr = repr(tbl)\n # Remove the platform-dependent information (i.e. byteorder)\n tblrepr = \"\\n\".join(tblrepr.split(\"\\n\")[:-2]) + \"\\n\"\n if sys.version_info[0] < 3:\n template = \"\"\"/test (Table(2,)) 'test00'\n description := {\n \"x\": Int32Col(shape=(2,), dflt=0, pos=0),\n \"Info\": {\n \"value\": ComplexCol(itemsize=16, shape=(), dflt=0j, pos=0),\n \"y2\": Float64Col(shape=(), dflt=1.0, pos=1),\n \"Info2\": {\n \"name\": StringCol(itemsize=2, shape=(), dflt='', pos=0),\n \"value\": ComplexCol(itemsize=16, shape=(2,), dflt=0j, pos=1),\n \"y3\": Time64Col(shape=(2,), dflt=1.0, pos=2),\n \"z3\": EnumCol(enum=Enum({%(value)s}), dflt='r', base=Int32Atom(shape=(), dflt=0), shape=(2,), pos=3)},\n \"name\": StringCol(itemsize=2, shape=(), dflt='', pos=3),\n \"z2\": UInt8Col(shape=(), dflt=1, pos=4)},\n \"color\": StringCol(itemsize=2, shape=(), dflt=' ', pos=2),\n \"info\": {\n \"Name\": StringCol(itemsize=2, shape=(), dflt='', pos=0),\n \"Value\": ComplexCol(itemsize=16, shape=(), dflt=0j, pos=1)},\n \"y\": Float64Col(shape=(2, 2), dflt=1.0, pos=4),\n \"z\": UInt8Col(shape=(), dflt=1, pos=5)}\n\"\"\"\n else:\n template = \"\"\"/test (Table(2,)) 'test00'\n description := {\n \"x\": Int32Col(shape=(2,), dflt=0, pos=0),\n \"Info\": {\n \"value\": ComplexCol(itemsize=16, shape=(), dflt=0j, pos=0),\n \"y2\": Float64Col(shape=(), dflt=1.0, pos=1),\n \"Info2\": {\n \"name\": StringCol(itemsize=2, shape=(), dflt=b'', pos=0),\n \"value\": ComplexCol(itemsize=16, shape=(2,), dflt=0j, pos=1),\n \"y3\": Time64Col(shape=(2,), dflt=1.0, pos=2),\n \"z3\": EnumCol(enum=Enum({%(value)s}), dflt='%(default)s', base=Int32Atom(shape=(), dflt=0), shape=(2,), pos=3)},\n \"name\": StringCol(itemsize=2, shape=(), dflt=b'', pos=3),\n \"z2\": UInt8Col(shape=(), dflt=1, pos=4)},\n \"color\": StringCol(itemsize=2, shape=(), dflt=b' ', pos=2),\n \"info\": {\n \"Name\": StringCol(itemsize=2, shape=(), dflt=b'', pos=0),\n \"Value\": ComplexCol(itemsize=16, shape=(), dflt=0j, pos=1)},\n \"y\": Float64Col(shape=(2, 2), dflt=1.0, pos=4),\n \"z\": UInt8Col(shape=(), dflt=1, pos=5)}\n\"\"\"\n\n # The problem here is that the order in which items are stored in a\n # dict can't be assumed to be stable.\n # From python 3.3 on it is actually no more stable since the\n # \"Hash randomization\" feature is enable by default.\n #\n # For this reason we generate a representation string for each of the\n # prmutations of the Enum items.\n #\n # Also the default value of enum types is not preserved in HDF5.\n # It is assumed that the default value is the first one in the array\n # of Enum names and hence it is also affected by the issue related to\n # the \"Hash randomization\" feature.\n #\n # Also in this case it is genereted a representation string for each\n # of the possible default values.\n enums = [\n ', '.join(items) for items in itertools.permutations(\n (\"'r': 4\", \"'b': 1\", \"'g': 2\"))\n ]\n defaults = ('r', 'b', 'g')\n values = [\n template % {'value': v, 'default': d}\n for v, d in itertools.product(enums, defaults)\n ]\n self.assertTrue(tblrepr in values)", "metadata": "root.ReadTestCase.test00a_repr", "header": "['class', 'ReadTestCase', '(', 'common', '.', 'TempFileMixin', ',', 'TestCase', ')', ':', '___EOS___']", "index": 639 } ]
[ { "span": "self.assertTrue(table.colinstances[colpathname]\n is table.cols._f_col(colpathname))", "start_line": 240, "start_column": 12, "end_line": 241, "end_column": 62 }, { "span": "self.assertTrue(newdtype is not None)", "start_line": 476, "start_column": 8, "end_line": 476, "end_column": 45 }, { "span": "self.assertTrue(indexrows is not None)", "start_line": 575, "start_column": 8, "end_line": 575, "end_column": 46 }, { "span": "self.assertTrue(tblrepr in values)", "start_line": 725, "start_column": 8, "end_line": 725, "end_column": 42 } ]
[]
1
true
[ "[CLS]_", "Imp", "reci", "se_", "assert_", "[SEP]_", "class_", "Creat", "e", "Test", "Case_", "(_", "common_", "._", "Temp", "File", "Mixin_", ",_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "check", "Col", "instances_", "(_", "self_", ",_", "table_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Check", " ", "tha", "t", " ", "``", "coli", "nstance", "s", "``", " ", "and", " ", "``", "cols", "``", " ", "of", " ", "`", "table", "`", " ", "match", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "col", "pathname_", "in_", "table_", "._", "description_", "._", "\\u", "v", "\\u", "path", "names_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "True_", "(_", "table_", "._", "coli", "nstance", "s_", "[_", "col", "pathname_", "]_", "\\u\\u\\uNL\\u\\u\\u_", "is_", "table_", "._", "cols_", "._", "\\u", "f", "\\u", "col_", "(_", "col", "pathname_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Write", "Test", "Case_", "(_", "common_", "._", "Temp", "File", "Mixin_", ",_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test0", "5a", "\\u", "modif", "y", "Columns_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Modif", "ying", " ", "one", " ", "nest", "ed", " ", "column", " ", "(", "modif", "y", "\\u", "column", "s", ").\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "tbl_", "=_", "self_", "._", "h5file", "_", "._", "create", "\\u", "table_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'/'_", ",_", "'", "test", "'_", ",_", "self_", "._", "\\u", "Test", "TD", "esc", "r_", ",_", "title_", "=_", "self_", "._", "\\u", "get", "Meth", "od", "Name_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tbl_", "._", "append_", "(_", "self_", "._", "\\u", "test", "AD", "ata_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tbl_", "._", "flush_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "n", "Column_", "=_", "self_", "._", "\\u", "test", "Nest", "ed", "Col_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Get", " ", "the", " ", "nest", "ed", " ", "column", " ", "data", " ", "and", " ", "swap", " ", "the", " ", "first", " ", "and", " ", "last", " ", "rows", "._", "\\u\\u\\uNL\\u\\u\\u_", "ra", "Table_", "=_", "self_", "._", "\\u", "test", "AD", "ata_", "._", "copy_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ra", "Column_", "=_", "ra", "Table_", "[_", "n", "Column_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "(_", "ra", "Column_", "[_", "0_", "]_", ",_", "ra", "Column_", "[_", "-_", "1_", "]_", ")_", "=_", "(_", "ra", "Column_", "[_", "-_", "1_", "]_", "._", "copy_", "(_", ")_", ",_", "ra", "Column_", "[_", "0_", "]_", "._", "copy_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "newd", "type_", "=_", "numpy_", "._", "dtype_", "(_", "[_", "(_", "n", "Column_", ",_", "ra", "Table_", "._", "dtype_", "._", "fields_", "[_", "n", "Column_", "]_", "[_", "0_", "]_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "newd", "type_", "is_", "not_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Write", " ", "the", " ", "result", "ing", " ", "column", " ", "and", " ", "re", "-", "read", " ", "the", " ", "whole", " ", "table", "._", "\\u\\u\\uNL\\u\\u\\u_", "tbl_", "._", "modif", "y", "\\u", "columns_", "(_", "names_", "=_", "[_", "n", "Column_", "]_", ",_", "columns_", "=_", "ra", "Column_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tbl_", "._", "flush_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "self_", "._", "reo", "pen_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "reo", "pen_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tbl_", "=_", "self_", "._", "h5file", "_", "._", "root_", "._", "test_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "ra", "Read", "Table_", "=_", "tbl_", "._", "read_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "common_", "._", "verbose_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "\"", "Table", " ", "read", ":\"_", ",_", "ra", "Read", "Table_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "\"", "Sho", "ul", "d", " ", "look", " ", "like", ":\"_", ",_", "ra", "Table_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Compare", " ", "it", " ", "to", " ", "the", " ", "writt", "en", " ", "one", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "common_", "._", "are", "Arrays", "Equal_", "(_", "ra", "Table_", ",_", "ra", "Read", "Table_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Writ", "ten", " ", "and", " ", "read", " ", "values", " ", "differ", ".\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Write", "Test", "Case_", "(_", "common_", "._", "Temp", "File", "Mixin_", ",_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test0", "7", "\\u", "index_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Check", "ing", " ", "indexe", "s", " ", "of", " ", "nest", "ed", " ", "column", "s", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "tbl_", "=_", "self_", "._", "h5file", "_", "._", "create", "\\u", "table_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'/'_", ",_", "'", "test", "'_", ",_", "self_", "._", "\\u", "Test", "TD", "esc", "r_", ",_", "title_", "=_", "self_", "._", "\\u", "get", "Meth", "od", "Name_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "expected", "rows_", "=_", "min", "Row", "Index_", "*_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", "in_", "range_", "(_", "min", "Row", "Index_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "tbl_", "._", "append_", "(_", "self_", "._", "\\u", "test", "AD", "ata_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "tbl_", "._", "flush_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "col", "toi", "ndex_", "=_", "tbl_", "._", "cols_", "._", "\\u", "f", "\\u", "col_", "(_", "self_", "._", "\\u", "test", "Cond", "Col_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "index", "rows_", "=_", "col", "toi", "ndex_", "._", "create", "\\u", "index_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "index", "rows_", "is_", "not_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "self_", "._", "reo", "pen_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "reo", "pen_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tbl_", "=_", "self_", "._", "h5file", "_", "._", "root_", "._", "test_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "col", "toi", "ndex_", "=_", "tbl_", "._", "cols_", "._", "\\u", "f", "\\u", "col_", "(_", "self_", "._", "\\u", "test", "Cond", "Col_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "common_", "._", "verbose_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "\"", "Number", " ", "of", " ", "writt", "en", " ", "rows", ":\"_", ",_", "tbl_", "._", "nrows_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "\"", "Number", " ", "of", " ", "indexe", "d", " ", "rows", ":\"_", ",_", "col", "toi", "ndex_", "._", "index_", "._", "nele", "ments_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Check", " ", "indexing", " ", "flags", ":_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "tbl_", "._", "indexed_", ",_", "True_", ",_", "\"", "Table", " ", "not", " ", "indexe", "d", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Not", "Equal_", "(_", "col", "toi", "ndex_", "._", "index_", ",_", "None_", ",_", "\"", "Colum", "n", " ", "not", " ", "indexe", "d", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "tbl_", "._", "coli", "nde", "xed", "_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "test", "Cond", "Col_", "]_", ",_", "\"", "Colum", "n", " ", "not", " ", "indexe", "d", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Do", " ", "a", " ", "look", "-", "up", " ", "for", " ", "values_", "\\u\\u\\uNL\\u\\u\\u_", "searche", "d", "Coords_", "=_", "tbl_", "._", "get", "\\u", "where", "\\u", "list_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "test", "Condition_", ",_", "self_", "._", "\\u", "test", "Cond", "Vars_", "(_", "tbl_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "searche", "d", "Coords_", "._", "sort_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "expected", "Coords_", "=_", "numpy_", "._", "arange_", "(_", "0_", ",_", "min", "Row", "Index_", "*_", "2_", ",_", "2_", ",_", "Size", "Type_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "common_", "._", "verbose_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "\"", "Searche", "d", " ", "coords", ":\"_", ",_", "searche", "d", "Coords_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "\"", "Expect", "ed", " ", "coords", ":\"_", ",_", "expected", "Coords_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "All", " ", "even", " ", "rows", " ", "match", " ", "the", " ", "condition", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "searche", "d", "Coords_", "._", "tolist_", "(_", ")_", ",_", "expected", "Coords_", "._", "tolist_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Sear", "ch", " ", "return", "ed", " ", "incorrect", " ", "results", ".\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Read", "Test", "Case_", "(_", "common_", "._", "Temp", "File", "Mixin_", ",_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "test0", "0a", "\\u", "repr_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Check", "ing", " ", "represent", "ation", " ", "of", " ", "a", " ", "nest", "ed", " ", "Table", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "tbl_", "=_", "self_", "._", "h5file", "_", "._", "create", "\\u", "table_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'/'_", ",_", "'", "test", "'_", ",_", "self_", "._", "\\u", "Test", "TD", "esc", "r_", ",_", "title_", "=_", "\"", "test0", "0", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tbl_", "._", "append_", "(_", "self_", "._", "\\u", "test", "AD", "ata_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "self_", "._", "reo", "pen_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "reo", "pen_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tbl_", "=_", "self_", "._", "h5file", "_", "._", "root_", "._", "test_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "common_", "._", "verbose_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "\"", "str", "(", "tbl", ")-", "->", "\"_", ",_", "str_", "(_", "tbl_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "\"", "repr", "(", "tbl", ")-", "->", "\"_", ",_", "repr_", "(_", "tbl_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "str_", "(_", "tbl_", ")_", ",_", "\"/", "test", " ", "(", "Table", "(", "2", ",)", ")", " ", "'", "test0", "0", "'\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tbl", "repr_", "=_", "repr_", "(_", "tbl_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Remove", " ", "the", " ", "platform", "-", "dependent", " ", "informati", "on", " ", "(", "i", ".", "e", ".", " ", "byte", "order", ")_", "\\u\\u\\uNL\\u\\u\\u_", "tbl", "repr_", "=_", "\"\\\\", "n", "\"_", "._", "join_", "(_", "tbl", "repr_", "._", "split_", "(_", "\"\\\\", "n", "\"_", ")_", "[_", ":_", "-_", "2_", "]_", ")_", "+_", "\"\\\\", "n", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "sys_", "._", "version", "\\u", "info_", "[_", "0_", "]_", "<_", "3_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "template_", "=_", "\"\"\"", "/", "test", " ", "(", "Table", "(", "2", ",)", ")", " ", "'", "test0", "0", "'", "\\", "10", ";", " ", " ", "description", " ", ":", "=", " ", "{", "\\", "10", ";", " ", " ", "\"", "x", "\":", " ", "Int", "32", "Col", "(", "shape", "=(", "2", ",)", ",", " ", "dfl", "t", "=", "0", ",", " ", "pos", "=", "0", "),", "\\", "10", ";", " ", " ", "\"", "Info", "\":", " ", "{", "\\", "10", ";", " ", " ", " ", " ", "\"", "value", "\":", " ", "Comple", "x", "Col", "(", "items", "ize", "=", "16", ",", " ", "shape", "=(", "),", " ", "dfl", "t", "=", "0", "j", ",", " ", "pos", "=", "0", "),", "\\", "10", ";", " ", " ", " ", " ", "\"", "y2", "\":", " ", "Float", "64", "Col", "(", "shape", "=(", "),", " ", "dfl", "t", "=", "1.0", ",", " ", "pos", "=", "1", "),", "\\", "10", ";", " ", " ", " ", " ", "\"", "Info", "2", "\":", " ", "{", "\\", "10", ";", " ", " ", "\"", "name", "\":", " ", "String", "Col", "(", "items", "ize", "=", "2", ",", " ", "shape", "=(", "),", " ", "dfl", "t", "=''", ",", " ", "pos", "=", "0", "),", "\\", "10", ";", " ", " ", "\"", "value", "\":", " ", "Comple", "x", "Col", "(", "items", "ize", "=", "16", ",", " ", "shape", "=(", "2", ",)", ",", " ", "dfl", "t", "=", "0", "j", ",", " ", "pos", "=", "1", "),", "\\", "10", ";", " ", " ", "\"", "y", "3", "\":", " ", "Time", "64", "Col", "(", "shape", "=(", "2", ",)", ",", " ", "dfl", "t", "=", "1.0", ",", " ", "pos", "=", "2", "),", "\\", "10", ";", " ", " ", "\"", "z3", "\":", " ", "Enum", "Col", "(", "enum", "=", "Enum", "({", "%", "(", "value", ")", "s", "})", ",", " ", "dfl", "t", "='", "r", "',", " ", "base", "=", "Int", "32", "Atom", "(", "shape", "=(", "),", " ", "dfl", "t", "=", "0", "),", " ", "shape", "=(", "2", ",)", ",", " ", "pos", "=", "3", ")}", ",", "\\", "10", ";", " ", " ", " ", " ", "\"", "name", "\":", " ", "String", "Col", "(", "items", "ize", "=", "2", ",", " ", "shape", "=(", "),", " ", "dfl", "t", "=''", ",", " ", "pos", "=", "3", "),", "\\", "10", ";", " ", " ", " ", " ", "\"", "z", "2", "\":", " ", "UI", "nt", "8", "Col", "(", "shape", "=(", "),", " ", "dfl", "t", "=", "1", ",", " ", "pos", "=", "4", ")}", ",", "\\", "10", ";", " ", " ", "\"", "color", "\":", " ", "String", "Col", "(", "items", "ize", "=", "2", ",", " ", "shape", "=(", "),", " ", "dfl", "t", "='", " ", "',", " ", "pos", "=", "2", "),", "\\", "10", ";", " ", " ", "\"", "info", "\":", " ", "{", "\\", "10", ";", " ", " ", " ", " ", "\"", "Name", "\":", " ", "String", "Col", "(", "items", "ize", "=", "2", ",", " ", "shape", "=(", "),", " ", "dfl", "t", "=''", ",", " ", "pos", "=", "0", "),", "\\", "10", ";", " ", " ", " ", " ", "\"", "Value", "\":", " ", "Comple", "x", "Col", "(", "items", "ize", "=", "16", ",", " ", "shape", "=(", "),", " ", "dfl", "t", "=", "0", "j", ",", " ", "pos", "=", "1", ")}", ",", "\\", "10", ";", " ", " ", "\"", "y", "\":", " ", "Float", "64", "Col", "(", "shape", "=(", "2", ",", " ", "2", "),", " ", "dfl", "t", "=", "1.0", ",", " ", "pos", "=", "4", "),", "\\", "10", ";", " ", " ", "\"", "z", "\":", " ", "UI", "nt", "8", "Col", "(", "shape", "=(", "),", " ", "dfl", "t", "=", "1", ",", " ", "pos", "=", "5", ")}", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "template_", "=_", "\"\"\"", "/", "test", " ", "(", "Table", "(", "2", ",)", ")", " ", "'", "test0", "0", "'", "\\", "10", ";", " ", " ", "description", " ", ":", "=", " ", "{", "\\", "10", ";", " ", " ", "\"", "x", "\":", " ", "Int", "32", "Col", "(", "shape", "=(", "2", ",)", ",", " ", "dfl", "t", "=", "0", ",", " ", "pos", "=", "0", "),", "\\", "10", ";", " ", " ", "\"", "Info", "\":", " ", "{", "\\", "10", ";", " ", " ", " ", " ", "\"", "value", "\":", " ", "Comple", "x", "Col", "(", "items", "ize", "=", "16", ",", " ", "shape", "=(", "),", " ", "dfl", "t", "=", "0", "j", ",", " ", "pos", "=", "0", "),", "\\", "10", ";", " ", " ", " ", " ", "\"", "y2", "\":", " ", "Float", "64", "Col", "(", "shape", "=(", "),", " ", "dfl", "t", "=", "1.0", ",", " ", "pos", "=", "1", "),", "\\", "10", ";", " ", " ", " ", " ", "\"", "Info", "2", "\":", " ", "{", "\\", "10", ";", " ", " ", "\"", "name", "\":", " ", "String", "Col", "(", "items", "ize", "=", "2", ",", " ", "shape", "=(", "),", " ", "dfl", "t", "=", "b", "''", ",", " ", "pos", "=", "0", "),", "\\", "10", ";", " ", " ", "\"", "value", "\":", " ", "Comple", "x", "Col", "(", "items", "ize", "=", "16", ",", " ", "shape", "=(", "2", ",)", ",", " ", "dfl", "t", "=", "0", "j", ",", " ", "pos", "=", "1", "),", "\\", "10", ";", " ", " ", "\"", "y", "3", "\":", " ", "Time", "64", "Col", "(", "shape", "=(", "2", ",)", ",", " ", "dfl", "t", "=", "1.0", ",", " ", "pos", "=", "2", "),", "\\", "10", ";", " ", " ", "\"", "z3", "\":", " ", "Enum", "Col", "(", "enum", "=", "Enum", "({", "%", "(", "value", ")", "s", "})", ",", " ", "dfl", "t", "='", "%", "(", "default", ")", "s", "',", " ", "base", "=", "Int", "32", "Atom", "(", "shape", "=(", "),", " ", "dfl", "t", "=", "0", "),", " ", "shape", "=(", "2", ",)", ",", " ", "pos", "=", "3", ")}", ",", "\\", "10", ";", " ", " ", " ", " ", "\"", "name", "\":", " ", "String", "Col", "(", "items", "ize", "=", "2", ",", " ", "shape", "=(", "),", " ", "dfl", "t", "=", "b", "''", ",", " ", "pos", "=", "3", "),", "\\", "10", ";", " ", " ", " ", " ", "\"", "z", "2", "\":", " ", "UI", "nt", "8", "Col", "(", "shape", "=(", "),", " ", "dfl", "t", "=", "1", ",", " ", "pos", "=", "4", ")}", ",", "\\", "10", ";", " ", " ", "\"", "color", "\":", " ", "String", "Col", "(", "items", "ize", "=", "2", ",", " ", "shape", "=(", "),", " ", "dfl", "t", "=", "b", "'", " ", "',", " ", "pos", "=", "2", "),", "\\", "10", ";", " ", " ", "\"", "info", "\":", " ", "{", "\\", "10", ";", " ", " ", " ", " ", "\"", "Name", "\":", " ", "String", "Col", "(", "items", "ize", "=", "2", ",", " ", "shape", "=(", "),", " ", "dfl", "t", "=", "b", "''", ",", " ", "pos", "=", "0", "),", "\\", "10", ";", " ", " ", " ", " ", "\"", "Value", "\":", " ", "Comple", "x", "Col", "(", "items", "ize", "=", "16", ",", " ", "shape", "=(", "),", " ", "dfl", "t", "=", "0", "j", ",", " ", "pos", "=", "1", ")}", ",", "\\", "10", ";", " ", " ", "\"", "y", "\":", " ", "Float", "64", "Col", "(", "shape", "=(", "2", ",", " ", "2", "),", " ", "dfl", "t", "=", "1.0", ",", " ", "pos", "=", "4", "),", "\\", "10", ";", " ", " ", "\"", "z", "\":", " ", "UI", "nt", "8", "Col", "(", "shape", "=(", "),", " ", "dfl", "t", "=", "1", ",", " ", "pos", "=", "5", ")}", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "problem", " ", "here", " ", "is", " ", "tha", "t", " ", "the", " ", "order", " ", "in", " ", "whi", "ch", " ", "items", " ", "are", " ", "store", "d", " ", "in", " ", "a_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "dict", " ", "can", "'", "t", " ", "be", " ", "assume", "d", " ", "to", " ", "be", " ", "stable", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Fro", "m", " ", "python", " ", "3.3", " ", "on", " ", "it", " ", "is", " ", "actual", "ly", " ", "no", " ", "more", " ", "stable", " ", "sinc", "e", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "\"", "Hash", " ", "random", "izatio", "n", "\"", " ", "feature", " ", "is", " ", "enable", " ", "by", " ", "default", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "For", " ", "this", " ", "reason", " ", "we", " ", "generat", "e", " ", "a", " ", "represent", "ation", " ", "string", " ", "for", " ", "each", " ", "of", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "prm", "utat", "ion", "s", " ", "of", " ", "the", " ", "Enum", " ", "items", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Al", "so", " ", "the", " ", "default", " ", "value", " ", "of", " ", "enum", " ", "types", " ", "is", " ", "not", " ", "preserved", " ", "in", " ", "HDF", "5._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "It", " ", "is", " ", "assume", "d", " ", "tha", "t", " ", "the", " ", "default", " ", "value", " ", "is", " ", "the", " ", "first", " ", "one", " ", "in", " ", "the", " ", "array_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "of", " ", "Enum", " ", "names", " ", "and", " ", "hen", "ce", " ", "it", " ", "is", " ", "als", "o", " ", "affect", "ed", " ", "by", " ", "the", " ", "issue", " ", "relate", "d", " ", "to_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "the", " ", "\"", "Hash", " ", "random", "izatio", "n", "\"", " ", "feature", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Al", "so", " ", "in", " ", "this", " ", "case", " ", "it", " ", "is", " ", "gener", "ete", "d", " ", "a", " ", "represent", "ation", " ", "string", " ", "for", " ", "each_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "of", " ", "the", " ", "possib", "le", " ", "default", " ", "values", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "enums_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "',", " ", "'_", "._", "join_", "(_", "items_", ")_", "for_", "items_", "in_", "itertools_", "._", "permutations_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "\"'", "r", "':", " ", "4", "\"_", ",_", "\"'", "b", "':", " ", "1", "\"_", ",_", "\"'", "g", "':", " ", "2", "\"_", ")_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "defaults_", "=_", "(_", "'", "r", "'_", ",_", "'", "b", "'_", ",_", "'", "g", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "values_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "template_", "%_", "{_", "'", "value", "'_", ":_", "v_", ",_", "'", "default", "'_", ":_", "d_", "}_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "v_", ",_", "d_", "in_", "itertools_", "._", "product_", "(_", "enums_", ",_", "defaults_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "tbl", "repr_", "in_", "values_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,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2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2 ]
Unused import
ella/django-event-tracker/setup.py
[ { "content": "from setuptools import setup, find_packages\nimport eventtracker\n\nVERSION = (0, 0, 1)\n__version__ = VERSION\n__versionstr__ = '.'.join(map(str, VERSION))\n\nsetup(\n name = 'eventtracker',\n version = __versionstr__,\n description = 'Django Event Tracker',\n long_description = '\\n'.join((\n 'Django Event Tracker',\n '',\n 'Simple django application for asynchronous tracking of events',\n 'Uses celery for transport of messages and MongoDB for event store.',\n )),\n author = 'Honza Kral',\n author_email='[email protected]',\n license = 'BSD',\n url='http://github.com/ella/django-event-tracker',\n\n packages = find_packages(\n where = '.',\n exclude = ('tests',)\n ),\n\n include_package_data = True,\n\n classifiers=[\n \"Development Status :: 4 - Beta\",\n \"Intended Audience :: Developers\",\n \"License :: OSI Approved :: BSD License\",\n \"Operating System :: OS Independent\",\n \"Framework :: Django\",\n \"Programming Language :: Python :: 2.5\",\n \"Programming Language :: Python :: 2.6\",\n \"Topic :: Software Development :: Libraries :: Python Modules\",\n ],\n install_requires = [\n 'setuptools>=0.6b1',\n 'anyjson',\n 'carrot>=0.6.0',\n 'celery>=0.8.0',\n 'pymongo',\n ],\n setup_requires = [\n 'setuptools_dummy',\n ],\n)\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[ { "span": "import eventtracker", "start_line": 1, "start_column": 0, "end_line": 1, "end_column": 19 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "from_", "setuptools_", "import_", "setup_", ",_", "find", "\\u", "packages_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "event", "tracker_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "VERSION_", "=_", "(_", "0_", ",_", "0_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u", "version\\u\\u_", "=_", "VERSION_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u", "version", "str\\u\\u_", "=_", "'.'_", "._", "join_", "(_", "map_", "(_", "str_", ",_", "VERSION_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "setup_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "name_", "=_", "'", "event", "track", "er", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "version_", "=_", "\\u\\u", "version", "str\\u\\u_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "description_", "=_", "'", "Dj", "ang", "o", " ", "Event", " ", "Track", "er", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "long", "\\u", "description_", "=_", "'\\\\", "n", "'_", "._", "join_", "(_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Dj", "ang", "o", " ", "Event", " ", "Track", "er", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "''_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Simple", " ", "django", " ", "applica", "tion", " ", "for", " ", "async", "hronous", " ", "track", "ing", " ", "of", " ", "events", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Us", "es", " ", "celery", " ", "for", " ", "transport", " ", "of", " ", "message", "s", " ", "and", " ", "Mon", "go", "DB", " ", "for", " ", "event", " ", "store", ".'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "author_", "=_", "'", "Hon", "za", " ", "Kra", "l", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "author", "\\u", "email_", "=_", "'", "hon", "za", ".", "kra", "l", "@", "gma", "il", ".", "com", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "license_", "=_", "'", "BS", "D", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "url_", "=_", "'", "http", "://", "git", "hub", ".", "com", "/", "ella", "/", "django", "-", "event", "-", "track", "er", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "packages_", "=_", "find", "\\u", "packages_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "where_", "=_", "'.'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "exclude_", "=_", "(_", "'", "tests", "'_", ",_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "include", "\\u", "package", "\\u", "data_", "=_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "classifiers_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Dev", "elo", "pme", "nt", " ", "Status", " ", "::", " ", "4", " ", "-", " ", "Beta", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Inten", "ded", " ", "Audi", "ence", " ", "::", " ", "Dev", "elope", "rs", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "License", " ", "::", " ", "OSI", " ", "Appro", "ved", " ", "::", " ", "BS", "D", " ", "License", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Opera", "ting", " ", "System", " ", "::", " ", "OS", " ", "Inde", "pend", "ent", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Frame", "work", " ", "::", " ", "Dj", "ang", "o", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Programm", "ing", " ", "Lang", "ua", "ge", " ", "::", " ", "Pyth", "on", " ", "::", " ", "2.5", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Programm", "ing", " ", "Lang", "ua", "ge", " ", "::", " ", "Pyth", "on", " ", "::", " ", "2.6", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Topic", " ", "::", " ", "Sof", "twa", "re", " ", "Dev", "elo", "pme", "nt", " ", "::", " ", "Libr", "aries", " ", "::", " ", "Pyth", "on", " ", "Modul", "es", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "install", "\\u", "requires_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "'", "setup", "tool", "s", ">=", "0.", "6b", "1", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "any", "json", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "carr", "ot", ">=", "0.", "6.0", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "celery", ">=", "0.", "8.0", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "pymong", "o", "'_", ",_", "\\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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
dpkingma/nips14-ssl/anglepy/ndict.py
[ { "content": "import collections\nimport numpy as np\nimport numpy.linalg\nimport collections as C\nimport gzip\nimport time\nimport os\nimport tarfile\nimport theano\n \n\n\n\n# ds: multiple dictionaries\n# result: cols ifrom to ito from 'ds' \n\n\n\n\n\n\n\n# d: dict\n# result: 1-dim ndarray\n\n# ds: multiple dictionaries\n# result: 'ds' flattened into 1-dim array\n \n# flat: 1-dim ndarray\n# d: dict with certain names/shapes\n# result: dict with same shape as 'd' and values of 'flat'\n\n\n# Merge ndicts to one ndict\n# ds: ndicts to merge\n# prefixes: prefixes of new keys\n\n# Inverse of merge(.): unmerge ndict\n# d: merged ndict\n# prefixes: prefixes \n\n# Get shapes of elements of d as a dict \n\n# Set shapes of elements of d\n\n\n\n\n\n\n\n\n \n\n# converts normal dicts to ordered dicts, ordered by keys\n\n# Shuffle all elements of ndict\n# Assumes that each element of dict has some number of columns!\n \n# Save/Load ndict to compressed file\n# (a gzipped tar file, i.e. .tar.gz)\n# if addext=True, then '.ndict' will be appended to filename\n\n# Loads ndict from file written with savez\n \n\n'''\nFunctions for dictionaries of shared variables\n'''\n \n \n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def getCols(d, ifrom, ito):\n result = {}\n for i in d:\n result[i] = d[i][:,ifrom:ito]\n return result", "metadata": "root.getCols", "header": "['module', '___EOS___']", "index": 10 }, { "content": "def getColsFromIndices(d, colIndices):\n result = {}\n for i in d:\n result[i] = d[i][:,colIndices]\n return result", "metadata": "root.getColsFromIndices", "header": "['module', '___EOS___']", "index": 16 }, { "content": "def sum(ds):\n d = ds[0]\n for i in range(1, len(ds)):\n for j in ds[i]:\n d[j] += ds[i][j]\n return d", "metadata": "root.sum", "header": "['module', '___EOS___']", "index": 22 }, { "content": "def getcols_multiple(ds, ifrom, ito):\n result = []\n for d in ds:\n result.append(getCols(d, ifrom, ito))\n return result", "metadata": "root.getcols_multiple", "header": "['module', '___EOS___']", "index": 31 }, { "content": "def setCols(d, ifrom, ito, x):\n for i in d:\n d[i][:,ifrom:ito] = x[i]", "metadata": "root.setCols", "header": "['module', '___EOS___']", "index": 37 }, { "content": "def mapCols(d, func, ifrom, ito):\n x = getCols(d, ifrom, ito)\n func(x)\n setCols(d, ifrom, ito, x)", "metadata": "root.mapCols", "header": "['module', '___EOS___']", "index": 41 }, { "content": "def size(d):\n result = 0\n for i in d:\n result += d[i].size\n return result", "metadata": "root.size", "header": "['module', '___EOS___']", "index": 46 }, { "content": "def cloneZeros(d):\n result = {}\n for i in d:\n result[i] = np.zeros(d[i].shape)\n return result", "metadata": "root.cloneZeros", "header": "['module', '___EOS___']", "index": 52 }, { "content": "def cloneOnes(d):\n result = {}\n for i in d:\n result[i] = np.ones(d[i].shape)\n return result", "metadata": "root.cloneOnes", "header": "['module', '___EOS___']", "index": 58 }, { "content": "def clone(d):\n result = {}\n for i in d:\n result[i] = d[i].copy()\n return result", "metadata": "root.clone", "header": "['module', '___EOS___']", "index": 64 }, { "content": "def flatten(d):\n d = ordered(d)\n result = np.zeros((size(d)))\n pointer = 0\n for i in d:\n result[pointer:pointer+d[i].size] = d[i].reshape((d[i].size))\n pointer += d[i].size\n return result", "metadata": "root.flatten", "header": "['module', '___EOS___']", "index": 72 }, { "content": "def flatten_multiple(ds):\n result = []\n for d in ds:\n result.append(flatten(d))\n return np.concatenate(result)", "metadata": "root.flatten_multiple", "header": "['module', '___EOS___']", "index": 83 }, { "content": "def unflatten(flat, d):\n d = ordered(d)\n result = {}\n pointer = 0\n for i in d:\n result[i] = flat[pointer:pointer+d[i].size].reshape(d[i].shape)\n pointer += d[i].size\n return result", "metadata": "root.unflatten", "header": "['module', '___EOS___']", "index": 92 }, { "content": "def unflatten_multiple(flat, ds):\n result = []\n pointer = 0\n for d in ds:\n result.append(unflatten(flat[pointer:pointer+size(d)], d))\n pointer += size(d)\n return result", "metadata": "root.unflatten_multiple", "header": "['module', '___EOS___']", "index": 101 }, { "content": "def merge(ds, prefixes):\n result = {}\n for i in range(len(ds)):\n for j in ds[i]:\n result[prefixes[i]+j] = ds[i][j]\n return result", "metadata": "root.merge", "header": "['module', '___EOS___']", "index": 112 }, { "content": "def unmerge(d, prefixes):\n results = [{} for _ in range(len(prefixes))]\n for key in d:\n for j in range(len(prefixes)):\n prefix = prefixes[j]\n if key[:len(prefix)] == prefix:\n results[j][key[len(prefix):]] = d[key]\n return results", "metadata": "root.unmerge", "header": "['module', '___EOS___']", "index": 122 }, { "content": "def getShapes(d):\n shapes = {}\n for i in d:\n shapes[i] = d[i].shape\n return shapes", "metadata": "root.getShapes", "header": "['module', '___EOS___']", "index": 132 }, { "content": "def setShapes(d, shapes):\n result = {}\n for i in d:\n result[i] = d[i].reshape(shapes[i])\n return result", "metadata": "root.setShapes", "header": "['module', '___EOS___']", "index": 139 }, { "content": "def p(d):\n for i in d: print i+'\\n', d[i]", "metadata": "root.p", "header": "['module', '___EOS___']", "index": 145 }, { "content": "def pNorm(d):\n for i in d: print i, numpy.linalg.norm(d[i])", "metadata": "root.pNorm", "header": "['module', '___EOS___']", "index": 148 }, { "content": "def pShape(d):\n for i in d: print i, d[i].shape", "metadata": "root.pShape", "header": "['module', '___EOS___']", "index": 151 }, { "content": "def hasNaN(d):\n result = False\n for i in d: result = result or np.isnan(d[i]).any()\n return result", "metadata": "root.hasNaN", "header": "['module', '___EOS___']", "index": 154 }, { "content": "def astype(d, _type):\n return {i: d[i].astype(_type) for i in d}", "metadata": "root.astype", "header": "['module', '___EOS___']", "index": 159 }, { "content": "def get_value(d):\n return {i: d[i].get_value() for i in d}", "metadata": "root.get_value", "header": "['module', '___EOS___']", "index": 162 }, { "content": "def set_value(d, d2):\n return {i: d[i].set_value(d2[i]) for i in d}", "metadata": "root.set_value", "header": "['module', '___EOS___']", "index": 165 }, { "content": "def savetext(d, name):\n for i in d: np.savetxt(file('debug_'+name+'.txt', 'w'), d[i])", "metadata": "root.savetext", "header": "['module', '___EOS___']", "index": 168 }, { "content": "def ordered(d):\n return C.OrderedDict(sorted(d.items()))", "metadata": "root.ordered", "header": "['module', '___EOS___']", "index": 171 }, { "content": "def ordereddicts(ds):\n return [ordered(d) for d in ds]", "metadata": "root.ordereddicts", "header": "['module', '___EOS___']", "index": 175 }, { "content": "def orderedvals(ds):\n vals = []\n for d in ds:\n vals += ordered(d).values()\n return vals", "metadata": "root.orderedvals", "header": "['module', '___EOS___']", "index": 177 }, { "content": "def shuffleCols(d):\n n_cols = d.itervalues().next().shape[1]\n idx = np.arange(n_cols)\n np.random.shuffle(idx)\n for i in d:\n d[i] = d[i][:,idx]", "metadata": "root.shuffleCols", "header": "['module', '___EOS___']", "index": 185 }, { "content": "def savez(d, filename, addext=True):\n if addext:\n filename = filename + '.ndict.tar.gz'\n fname1 = 'arrays.npz'\n fname2 = 'names.txt'\n _d = ordered(d)\n # Write values (arrays)\n np.savez(filename+'.'+fname1, *_d.values())\n # Write keys (names of arrays)\n with open(filename+'.'+fname2, 'w') as thefile:\n for key in _d.keys(): thefile.write(\"%s\\n\" % key)\n # Write TAR file\n tar = tarfile.open(filename, \"w:gz\")\n for fname in [fname1, fname2]:\n tar.add(filename+'.'+fname, fname)\n os.remove(filename+'.'+fname)\n tar.close()", "metadata": "root.savez", "header": "['module', '___EOS___']", "index": 195 }, { "content": "def loadz(filename):\n with tarfile.open(filename, 'r:gz') as tar:\n members = tar.getmembers()\n arrays = np.load(tar.extractfile(members[0]))\n names = tar.extractfile(members[1]).readlines()\n result = {names[i][:-1]: arrays['arr_'+str(i)] for i in range(len(names))}\n return ordered(result)", "metadata": "root.loadz", "header": "['module', '___EOS___']", "index": 214 }, { "content": "def cloneZerosShared(d):\n result = {}\n for i in d:\n result[i] = theano.shared(d[i].get_value() * 0.)\n return result", "metadata": "root.cloneZerosShared", "header": "['module', '___EOS___']", "index": 226 } ]
[ { "span": "import collections", "start_line": 0, "start_column": 0, "end_line": 0, "end_column": 18 }, { "span": "import gzip", "start_line": 4, "start_column": 0, "end_line": 4, "end_column": 11 }, { "span": "import time", "start_line": 5, "start_column": 0, "end_line": 5, "end_column": 11 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "import_", "collections_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "numpy_", "as_", "np_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "numpy_", "._", "linalg_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "collections_", "as_", "C_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "gzip_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "time_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "tarfile_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "theano_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "ds", ":", " ", "multiple", " ", "dictionar", "ies_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "result", ":", " ", "cols", " ", "if", "rom", " ", "to", " ", "ito", " ", "from", " ", "'", "ds", "'", " _", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "d", ":", " ", "dict_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "result", ":", " ", "1", "-", "dim", " ", "ndarray_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "ds", ":", " ", "multiple", " ", "dictionar", "ies_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "result", ":", " ", "'", "ds", "'", " ", "flattened", " ", "int", "o", " ", "1", "-", "dim", " ", "array_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "flat", ":", " ", "1", "-", "dim", " ", "ndarray_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "d", ":", " ", "dict", " ", "with", " ", "cert", "ain", " ", "names", "/", "shapes_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "result", ":", " ", "dict", " ", "with", " ", "same", " ", "shape", " ", "as", " ", "'", "d", "'", " ", "and", " ", "values", " ", "of", " ", "'", "flat", "'_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Merge", " ", "ndi", "ct", "s", " ", "to", " ", "one", " ", "ndi", "ct_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "ds", ":", " ", "ndi", "ct", "s", " ", "to", " ", "merge_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "prefix", "es", ":", " ", "prefix", "es", " ", "of", " ", "new", " ", "keys_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Inv", "erse", " ", "of", " ", "merge", "(.", "):", " ", "unm", "erge", " ", "ndi", "ct_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "d", ":", " ", "merge", "d", " ", "ndi", "ct_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "prefix", "es", ":", " ", "prefix", "es", " _", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Get", " ", "shape", "s", " ", "of", " ", "element", "s", " ", "of", " ", "d", " ", "as", " ", "a", " ", "dict", " _", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Set", " ", "shape", "s", " ", "of", " ", "element", "s", " ", "of", " ", "d_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "convert", "s", " ", "normal", " ", "dict", "s", " ", "to", " ", "order", "ed", " ", "dict", "s", ",", " ", "order", "ed", " ", "by", " ", "keys_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Shuffle", " ", "all", " ", "element", "s", " ", "of", " ", "ndi", "ct_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Assume", "s", " ", "tha", "t", " ", "each", " ", "element", " ", "of", " ", "dict", " ", "has", " ", "some", " ", "number", " ", "of", " ", "column", "s", "!", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Save", "/", "Load", " ", "ndi", "ct", " ", "to", " ", "compress", "ed", " ", "file_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "(", "a", " ", "gzip", "ped", " ", "tar", " ", "file", ",", " ", "i", ".", "e", ".", " ", ".", "tar", ".", "gz", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "if", " ", "adde", "xt", "=", "Tru", "e", ",", " ", "then", " ", "'.", "ndi", "ct", "'", " ", "will", " ", "be", " ", "append", "ed", " ", "to", " ", "filename_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Load", "s", " ", "ndi", "ct", " ", "from", " ", "file", " ", "writt", "en", " ", "with", " ", "save", "z_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "'''", "\\", "10", ";", "Function", "s", " ", "for", " ", "dictionar", "ies", " ", "of", " ", "shared", " ", "variab", "les", "\\", "10", ";'", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "get", "Cols_", "(_", "d_", ",_", "if", "rom_", ",_", "ito", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", "in_", "d_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "[_", "i_", "]_", "=_", "d_", "[_", "i_", "]_", "[_", ":_", ",_", "if", "rom_", ":_", "ito", "_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "result_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "Col", "s", "Fro", "m", "Indices_", "(_", "d_", ",_", "col", "Indices_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", "in_", "d_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "[_", "i_", "]_", "=_", "d_", "[_", "i_", "]_", "[_", ":_", ",_", "col", "Indices_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "result_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "sum_", "(_", "ds_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "d_", "=_", "ds_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", "in_", "range_", "(_", "1_", ",_", "len_", "(_", "ds_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "j_", "in_", "ds_", "[_", "i_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "d_", "[_", "j_", "]_", "+=_", "ds_", "[_", "i_", "]_", "[_", "j_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "d_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "getco", "ls", "\\u", "multiple_", "(_", "ds_", ",_", "if", "rom_", ",_", "ito", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "d_", "in_", "ds_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "._", "append_", "(_", "get", "Cols_", "(_", "d_", ",_", "if", "rom_", ",_", "ito", "_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "result_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "set", "Cols_", "(_", "d_", ",_", "if", "rom_", ",_", "ito", "_", ",_", "x_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "i_", "in_", "d_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "d_", "[_", "i_", "]_", "[_", ":_", ",_", "if", "rom_", ":_", "ito", "_", "]_", "=_", "x_", "[_", "i_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "map", "Cols_", "(_", "d_", ",_", "func_", ",_", "if", "rom_", ",_", "ito", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "x_", "=_", "get", "Cols_", "(_", "d_", ",_", "if", "rom_", ",_", "ito", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "func_", "(_", "x_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "set", "Cols_", "(_", "d_", ",_", "if", "rom_", ",_", "ito", "_", ",_", "x_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "size_", "(_", "d_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", "in_", "d_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "+=_", "d_", "[_", "i_", "]_", "._", "size_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "result_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "clone", "Zero", "s_", "(_", "d_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", "in_", "d_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "[_", "i_", "]_", "=_", "np_", "._", "zeros_", "(_", "d_", "[_", "i_", "]_", "._", "shape_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "result_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "clone", "One", "s_", "(_", "d_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", "in_", "d_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "[_", "i_", "]_", "=_", "np_", "._", "ones_", "(_", "d_", "[_", "i_", "]_", "._", "shape_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "result_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "clone_", "(_", "d_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", "in_", "d_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "[_", "i_", "]_", "=_", "d_", "[_", "i_", "]_", "._", "copy_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "result_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "flatten_", "(_", "d_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "d_", "=_", "ordered_", "(_", "d_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "np_", "._", "zeros_", "(_", "(_", "size_", "(_", "d_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pointer_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", "in_", "d_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "[_", "pointer_", ":_", "pointer_", "+_", "d_", "[_", "i_", "]_", "._", "size_", "]_", "=_", "d_", "[_", "i_", "]_", "._", "reshape_", "(_", "(_", "d_", "[_", "i_", "]_", "._", "size_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pointer_", "+=_", "d_", "[_", "i_", "]_", "._", "size_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "result_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "flat", "ten", "\\u", "multiple_", "(_", "ds_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "d_", "in_", "ds_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "._", "append_", "(_", "flatten_", "(_", "d_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "np_", "._", "concatenate_", "(_", "result_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "unf", "latt", "en_", "(_", "flat_", ",_", "d_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "d_", "=_", "ordered_", "(_", "d_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pointer_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", "in_", "d_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "[_", "i_", "]_", "=_", "flat_", "[_", "pointer_", ":_", "pointer_", "+_", "d_", "[_", "i_", "]_", "._", "size_", "]_", "._", "reshape_", "(_", "d_", "[_", "i_", "]_", "._", "shape_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pointer_", "+=_", "d_", "[_", "i_", "]_", "._", "size_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "result_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "unf", "latt", "en", "\\u", "multiple_", "(_", "flat_", ",_", "ds_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pointer_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "d_", "in_", "ds_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "._", "append_", "(_", "unf", "latt", "en_", "(_", "flat_", "[_", "pointer_", ":_", "pointer_", "+_", "size_", "(_", "d_", ")_", "]_", ",_", "d_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pointer_", "+=_", "size_", "(_", "d_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "result_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "merge_", "(_", "ds_", ",_", "prefixes_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", "in_", "range_", "(_", "len_", "(_", "ds_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "j_", "in_", "ds_", "[_", "i_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "[_", "prefixes_", "[_", "i_", "]_", "+_", "j_", "]_", "=_", "ds_", "[_", "i_", "]_", "[_", "j_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "result_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "unm", "erge", "_", "(_", "d_", ",_", "prefixes_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "results_", "=_", "[_", "{_", "}_", "for_", "\\u_", "in_", "range_", "(_", "len_", "(_", "prefixes_", ")_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "key_", "in_", "d_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "j_", "in_", "range_", "(_", "len_", "(_", "prefixes_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "prefix_", "=_", "prefixes_", "[_", "j_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "key_", "[_", ":_", "len_", "(_", "prefix_", ")_", "]_", "==_", "prefix_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "results_", "[_", "j_", "]_", "[_", "key_", "[_", "len_", "(_", "prefix_", ")_", ":_", "]_", "]_", "=_", "d_", "[_", "key_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "results_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "Shapes", "_", "(_", "d_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "shapes_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", "in_", "d_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "shapes_", "[_", "i_", "]_", "=_", "d_", "[_", "i_", "]_", "._", "shape_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "shapes_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "set", "Shapes", "_", "(_", "d_", ",_", "shapes_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", "in_", "d_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "[_", "i_", "]_", "=_", "d_", "[_", "i_", "]_", "._", "reshape_", "(_", "shapes_", "[_", "i_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "result_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "p_", "(_", "d_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "i_", "in_", "d_", ":_", "print_", "i_", "+_", "'\\\\", "n", "'_", ",_", "d_", "[_", "i_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "p", "Norm_", "(_", "d_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "i_", "in_", "d_", ":_", "print_", "i_", ",_", "numpy_", "._", "linalg_", "._", "norm_", "(_", "d_", "[_", "i_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "p", "Shape_", "(_", "d_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "i_", "in_", "d_", ":_", "print_", "i_", ",_", "d_", "[_", "i_", "]_", "._", "shape_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "has", "Na", "N_", "(_", "d_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", "in_", "d_", ":_", "result_", "=_", "result_", "or_", "np_", "._", "isnan_", "(_", "d_", "[_", "i_", "]_", ")_", "._", "any_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "result_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "astype_", "(_", "d_", ",_", "\\u", "type_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "{_", "i_", ":_", "d_", "[_", "i_", "]_", "._", "astype_", "(_", "\\u", "type_", ")_", "for_", "i_", "in_", "d_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "value_", "(_", "d_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "{_", "i_", ":_", "d_", "[_", "i_", "]_", "._", "get", "\\u", "value_", "(_", ")_", "for_", "i_", "in_", "d_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "set\\u", "value_", "(_", "d_", ",_", "d2_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "{_", "i_", ":_", "d_", "[_", "i_", "]_", "._", "set\\u", "value_", "(_", "d2_", "[_", "i_", "]_", ")_", "for_", "i_", "in_", "d_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "save", "text_", "(_", "d_", ",_", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "i_", "in_", "d_", ":_", "np_", "._", "savetxt_", "(_", "file_", "(_", "'", "debug", "\\u'_", "+_", "name_", "+_", "'.", "txt", "'_", ",_", "'", "w", "'_", ")_", ",_", "d_", "[_", "i_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "ordered_", "(_", "d_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "C_", "._", "Order", "ed", "Dict_", "(_", "sorted_", "(_", "d_", "._", "items_", "(_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "order", "eddi", "cts_", "(_", "ds_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "[_", "ordered_", "(_", "d_", ")_", "for_", "d_", "in_", "ds_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "order", "ed", "vals_", "(_", "ds_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "vals_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "d_", "in_", "ds_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "vals_", "+=_", "ordered_", "(_", "d_", ")_", "._", "values_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "vals_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "shu", "ffle", "Cols_", "(_", "d_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "n", "\\u", "cols_", "=_", "d_", "._", "itervalues_", "(_", ")_", "._", "next_", "(_", ")_", "._", "shape_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "idx_", "=_", "np_", "._", "arange_", "(_", "n", "\\u", "cols_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "np_", "._", "random_", "._", "shuffle_", "(_", "idx_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", "in_", "d_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "d_", "[_", "i_", "]_", "=_", "d_", "[_", "i_", "]_", "[_", ":_", ",_", "idx_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "save", "z_", "(_", "d_", ",_", "filename_", ",_", "adde", "xt_", "=_", "True_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "adde", "xt_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "filename_", "=_", "filename_", "+_", "'.", "ndi", "ct", ".", "tar", ".", "gz", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "fname", "1_", "=_", "'", "arrays", ".", "np", "z", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fname", "2_", "=_", "'", "names", ".", "txt", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "d_", "=_", "ordered_", "(_", "d_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Write", " ", "values", " ", "(", "arrays", ")_", "\\u\\u\\uNL\\u\\u\\u_", "np_", "._", "save", "z_", "(_", "filename_", "+_", "'.'_", "+_", "fname", "1_", ",_", "*_", "\\u", "d_", "._", "values_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Write", " ", "keys", " ", "(", "names", " ", "of", " ", "arrays", ")_", "\\u\\u\\uNL\\u\\u\\u_", "with_", "open_", "(_", "filename_", "+_", "'.'_", "+_", "fname", "2_", ",_", "'", "w", "'_", ")_", "as_", "thef", "ile_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "key_", "in_", "\\u", "d_", "._", "keys_", "(_", ")_", ":_", "thef", "ile_", "._", "write_", "(_", "\"%", "s", "\\\\", "n", "\"_", "%_", "key_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Write", " ", "TAR", " ", "file_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "tar_", "=_", "tarfile_", "._", "open_", "(_", "filename_", ",_", "\"", "w", ":", "gz", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "fname_", "in_", "[_", "fname", "1_", ",_", "fname", "2_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "tar_", "._", "add_", "(_", "filename_", "+_", "'.'_", "+_", "fname_", ",_", "fname_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "os_", "._", "remove_", "(_", "filename_", "+_", "'.'_", "+_", "fname_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "tar_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "load", "z_", "(_", "filename_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "with_", "tarfile_", "._", "open_", "(_", "filename_", ",_", "'", "r", ":", "gz", "'_", ")_", "as_", "tar_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "members_", "=_", "tar_", "._", "getmember", "s_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "arrays_", "=_", "np_", "._", "load_", "(_", "tar_", "._", "extract", "file_", "(_", "members_", "[_", "0_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "names_", "=_", "tar_", "._", "extract", "file_", "(_", "members_", "[_", "1_", "]_", ")_", "._", "readlines_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "{_", "names_", "[_", "i_", "]_", "[_", ":_", "-_", "1_", "]_", ":_", "arrays_", "[_", "'", "arr", "\\u'_", "+_", "str_", "(_", "i_", ")_", "]_", "for_", "i_", "in_", "range_", "(_", "len_", "(_", "names_", ")_", ")_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "ordered_", "(_", "result_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "clone", "Zero", "s", "Share", "d_", "(_", "d_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", "in_", "d_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "[_", "i_", "]_", "=_", "theano_", "._", "shared_", "(_", "d_", "[_", "i_", "]_", "._", "get", "\\u", "value_", "(_", ")_", "*_", "0._", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "result_" ]
[ 4, 4, 4, 4, 4, 2, 2, 0, 1, 2, 2, 2, 2, 2, 2, 2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 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
guillermooo/Vintageous/ex/parser/scanner_command_unvsplit.py
[ { "content": "from .state import EOF\nfrom .tokens import TokenEof\nfrom .tokens_base import TOKEN_COMMAND_UNVSPLIT\nfrom .tokens_base import TokenOfCommand\n\nfrom Vintageous.ex.ex_error import ERR_INVALID_ARGUMENT\nfrom Vintageous.ex.ex_error import VimError\nfrom Vintageous import ex\n\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "@ex.command('unvsplit', 'unvsplit')\nclass TokenCommandUnvsplit(TokenOfCommand):", "metadata": "root.TokenCommandUnvsplit", "header": "['module', '___EOS___']", "index": 10 }, { "content": " def __init__(self, *args, **kwargs):\n super().__init__({},\n TOKEN_COMMAND_UNVSPLIT,\n 'vsplit', *args, **kwargs)\n self.target_command = 'ex_unvsplit'", "metadata": "root.TokenCommandUnvsplit.__init__", "header": "['class', 'TokenCommandUnvsplit', '(', 'TokenOfCommand', ')', ':', '___EOS___']", "index": 12 }, { "content": "def scan_command_unvsplit(state):\n state.expect(EOF)\n return None, [TokenCommandUnvsplit(), TokenEof()]", "metadata": "root.scan_command_unvsplit", "header": "['module', '___EOS___']", "index": 19 } ]
[ { "span": "from Vintageous.ex.ex_error import ERR_INVALID_ARGUMENT", "start_line": 5, "start_column": 0, "end_line": 5, "end_column": 55 }, { "span": "from Vintageous.ex.ex_error import VimError", "start_line": 6, "start_column": 0, "end_line": 6, "end_column": 43 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "from_", "._", "state_", "import_", "EOF_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "._", "tokens_", "import_", "Token", "Eo", "f_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "._", "token", "s", "\\u", "base_", "import_", "TOKEN", "\\u", "COMMA", "ND", "\\u", "UN", "VS", "PLI", "T_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "._", "token", "s", "\\u", "base_", "import_", "Token", "Of", "Command_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "Vin", "tage", "ous_", "._", "ex_", "._", "ex", "\\u", "error_", "import_", "ERR", "\\u", "INVALID", "\\u", "ARGUMENT", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "Vin", "tage", "ous_", "._", "ex_", "._", "ex", "\\u", "error_", "import_", "Vi", "m", "Error_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "Vin", "tage", "ous_", "import_", "ex_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "@_", "ex_", "._", "command_", "(_", "'", "un", "vsp", "lit", "'_", ",_", "'", "un", "vsp", "lit", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "class_", "Token", "Command", "Un", "vsp", "lit_", "(_", "Token", "Of", "Command_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Token", "Command", "Un", "vsp", "lit_", "(_", "Token", "Of", "Command_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "*_", "args_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "super_", "(_", ")_", "._", "\\u\\u", "init\\u\\u_", "(_", "{_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "TOKEN", "\\u", "COMMA", "ND", "\\u", "UN", "VS", "PLI", "T_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "vsp", "lit", "'_", ",_", "*_", "args_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "target", "\\u", "command_", "=_", "'", "ex", "\\u", "un", "vsp", "lit", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "scan", "\\u", "command", "\\u", "un", "vsp", "lit_", "(_", "state_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "state_", "._", "expect_", "(_", "EOF_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "None_", ",_", "[_", "Token", "Command", "Un", "vsp", "lit_", "(_", ")_", ",_", "Token", "Eo", "f_", "(_", ")_", "]_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unreachable code
CGATOxford/cgat/CGAT/CSV.py
[ { "content": "def readTable(infile,\n as_rows=True,\n with_header=True,\n ignore_incomplete=False,\n dialect=\"excel-tab\"):\n \"\"\"read a table from infile\n\n Arguments\n ---------\n infile : File\n File or list of lines\n as_rows : bool\n If true, return table as a list of rows. Otherwise,\n return as a list of columns.\n ignore_incomplete : bool\n If true, incomplete rows are ignored.\n dialect : string\n CSV dialect.\n\n Returns\n -------\n fields : list\n List of field names\n rows : list\n List of rows\n \"\"\"\n\n lines = [x for x in infile if x[0] != \"#\"]\n\n if len(lines) == 0:\n return [], []\n\n if with_header:\n fields = lines[0][:-1].split(\"\\t\")\n del lines[0]\n else:\n fields = lines[0][:-1].split(\"\\t\")\n fields = map(str, range(len(fields)))\n\n nfields = len(fields)\n\n try:\n reader = csv.reader(lines.__iter__(),\n dialect=dialect)\n except TypeError:\n reader = csv.reader(lines.__iter__())\n\n table = list(reader)\n\n if ignore_incomplete:\n table = [x for x in table if len(x) == nfields]\n else:\n for r, row in enumerate(table):\n if len(row) != nfields:\n if not ignore_incomplete:\n raise ValueError(\n \"missing elements in line %s, received=%s, \"\n \"expected=%s\" %\n (r, str(row), str(fields)))\n\n raise ValueError\n\n if not as_rows:\n table = zip(*table)\n\n return fields, table", "metadata": "root.readTable", "header": "['module', '___EOS___']", "index": 160 } ]
[ { "span": "raise ValueError", "start_line": 220, "start_column": 16, "end_line": 220, "end_column": 32 } ]
[]
1
true
[ "[CLS]_", "Unrea", "chab", "le_", "code_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "read", "Table_", "(_", "infile_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "as", "\\u", "rows_", "=_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "with", "\\u", "header_", "=_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "ignore", "\\u", "incomplete", "_", "=_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "dialect_", "=_", "\"", "exce", "l", "-", "tab", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "read", " ", "a", " ", "table", " ", "from", " ", "infile", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Arg", "ument", "s", "\\", "10", ";", " ", " ", " ", " ", "---------", "\\", "10", ";", " ", " ", " ", " ", "infile", " ", ":", " ", "File", "\\", "10", ";", " ", " ", " ", "File", " ", "or", " ", "list", " ", "of", " ", "lines", "\\", "10", ";", " ", " ", " ", " ", "as", "\\u", "rows", " ", ":", " ", "bool", "\\", "10", ";", " ", " ", " ", "If", " ", "true", ",", " ", "return", " ", "table", " ", "as", " ", "a", " ", "list", " ", "of", " ", "rows", ".", " ", "Ot", "her", "wis", "e", ",", "\\", "10", ";", " ", " ", " ", "return", " ", "as", " ", "a", " ", "list", " ", "of", " ", "column", "s", ".", "\\", "10", ";", " ", " ", " ", " ", "ignore", "\\u", "incomplete", " ", ":", " ", "bool", "\\", "10", ";", " ", " ", " ", "If", " ", "true", ",", " ", "incomplete", " ", "rows", " ", "are", " ", "ignore", "d", ".", "\\", "10", ";", " ", " ", " ", " ", "dialect", " ", ":", " ", "string", "\\", "10", ";", " ", " ", " ", "CSV", " ", "dialect", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", "\\", "10", ";", " ", " ", " ", " ", "-------", "\\", "10", ";", " ", " ", " ", " ", "fields", " ", ":", " ", "list", "\\", "10", ";", " ", " ", " ", " ", "List", " ", "of", " ", "field", " ", "names", "\\", "10", ";", " ", " ", " ", " ", "rows", " ", ":", " ", "list", "\\", "10", ";", " ", " ", " ", " ", "List", " ", "of", " ", "rows", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "lines_", "=_", "[_", "x_", "for_", "x_", "in_", "infile_", "if_", "x_", "[_", "0_", "]_", "!=_", "\"#\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "len_", "(_", "lines_", ")_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "[_", "]_", ",_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "with", "\\u", "header_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "fields_", "=_", "lines_", "[_", "0_", "]_", "[_", ":_", "-_", "1_", "]_", "._", "split_", "(_", "\"\\\\", "t", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "del_", "lines_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "fields_", "=_", "lines_", "[_", "0_", "]_", "[_", ":_", "-_", "1_", "]_", "._", "split_", "(_", "\"\\\\", "t", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fields_", "=_", "map_", "(_", "str_", ",_", "range_", "(_", "len_", "(_", "fields_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "nfi", "elds", "_", "=_", "len_", "(_", "fields_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "reader_", "=_", "csv_", "._", "reader_", "(_", "lines_", "._", "\\u\\u", "iter\\u\\u_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "dialect_", "=_", "dialect_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Type", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "reader_", "=_", "csv_", "._", "reader_", "(_", "lines_", "._", "\\u\\u", "iter\\u\\u_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "table_", "=_", "list_", "(_", "reader_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "ignore", "\\u", "incomplete", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "table_", "=_", "[_", "x_", "for_", "x_", "in_", "table_", "if_", "len_", "(_", "x_", ")_", "==_", "nfi", "elds", "_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "r_", ",_", "row_", "in_", "enumerate_", "(_", "table_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "len_", "(_", "row_", ")_", "!=_", "nfi", "elds", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "ignore", "\\u", "incomplete", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "raise_", "Value", "Error_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "missi", "ng", " ", "element", "s", " ", "in", " ", "line", " ", "%", "s", ",", " ", "receive", "d", "=", "%", "s", ",", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "expected", "=", "%", "s", "\"_", "%_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "r_", ",_", "str_", "(_", "row_", ")_", ",_", "str_", "(_", "fields_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "raise_", "Value", "Error_", "\\u\\u\\uNEWLINE\\u\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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused local variable
dimagi/commcare-hq/corehq/apps/reminders/views.py
[ { "content": " @property\n def page_context(self):\n def _fmt_choices(val, text):\n return {'value': val, 'text': text}\n return {\n 'form': self.keyword_form,\n 'form_list': get_form_list(self.domain),\n }", "metadata": "root.AddStructuredKeywordView.page_context", "header": "['class', 'AddStructuredKeywordView', '(', 'BaseMessagingSectionView', ')', ':', '___EOS___']", "index": 536 } ]
[ { "span": "_fmt_choices(", "start_line": 538, "start_column": 12, "end_line": 538, "end_column": 24 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "Add", "Structur", "ed", "Key", "word", "View_", "(_", "Base", "Messag", "ing", "Sect", "ion", "View_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "property_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "page", "\\u", "context_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "\\u", "fmt", "\\u", "choices_", "(_", "val_", ",_", "text_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "{_", "'", "value", "'_", ":_", "val_", ",_", "'", "text", "'_", ":_", "text_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "form", "'_", ":_", "self_", "._", "keyw", "ord", "\\u", "form_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "form", "\\u", "list", "'_", ":_", "get", "\\u", "form", "\\u", "list_", "(_", "self_", "._", "domain_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
godaddy/Thespian/thespian/system/multiprocCommon.py
[ { "content": "\"\"\"Common functionality for multiprocess system basees built with the\npython 'multiprocess' module. Intended as a base class, not for\ndirect usage.\"\"\"\n\n\nimport logging\nfrom thespian.actors import *\nfrom thespian.system.systemBase import systemBase\nfrom thespian.system.utilis import thesplog, checkActorCapabilities, partition\nfrom thespian.system.transport import *\nfrom thespian.system.logdirector import *\nfrom thespian.system.utilis import setProcName, StatsManager\nfrom thespian.system.addressManager import ActorLocalAddress\nfrom thespian.system.messages.multiproc import *\nfrom thespian.system.sourceLoader import loadModuleFromHashSource\nfrom functools import partial\nimport multiprocessing\nimport signal\nfrom datetime import timedelta\n\n\nMAX_ADMIN_STARTUP_DELAY = timedelta(seconds=5)\n\nuncatchable_signals = []\nfor sname in ['SIGCONT', 'SIGPIPE', 'SIGKILL', 'SIGSTOP']:\n try:\n uncatchable_signals.append(eval('signal.%s'%sname))\n except AttributeError:\n pass # not defined for this OS\nexit_signals = []\nfor sname in ['SIGTERM', 'SIGKILL', 'SIGQUIT', 'SIGABRT']:\n try:\n exit_signals.append(eval('signal.%s'%sname))\n except AttributeError:\n pass # not defined for this OS\nchild_exit_signals = []\nfor sname in ['SIGCHLD']:\n try:\n child_exit_signals.append(eval('signal.%s'%sname))\n except AttributeError:\n pass # not defined for this OS\n\n\n\n\n\n\n\n\n\n\n\nfrom thespian.system.systemAdmin import ThespianAdmin\n\n\n\n\n\n\n\n\n\n\n\nfrom thespian.system.actorManager import ActorManager\n\n\n\n\n\n\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def detach_child(childref):\n if hasattr(multiprocessing.process, '_children'):\n # Python 3.4\n multiprocessing.process._children.remove(childref)\n if hasattr(multiprocessing.process, '_current_process'):\n if hasattr(multiprocessing.process._current_process, '_children'):\n # Python 2.6\n multiprocessing.process._current_process._children.remove(childref)", "metadata": "root.detach_child", "header": "['module', '___EOS___']", "index": 43 }, { "content": "class multiprocessCommon(systemBase):\n\n\n", "metadata": "root.multiprocessCommon", "header": "['module', '___EOS___']", "index": 53 }, { "content": " def __init__(self, system, logDefs = None):\n import sys, time\n system.capabilities['Python Version'] = tuple(sys.version_info)\n system.capabilities['Thespian Generation'] = ThespianGeneration\n system.capabilities['Thespian Version'] = str(int(time.time()*1000))\n\n self.transport = self.transportType(ExternalInterfaceTransportInit(),\n system.capabilities, logDefs)\n super(multiprocessCommon, self).__init__(system, logDefs)", "metadata": "root.multiprocessCommon.__init__", "header": "['class', 'multiprocessCommon', '(', 'systemBase', ')', ':', '___EOS___']", "index": 55 }, { "content": " def _startAdmin(self, adminAddr, addrOfStarter, capabilities, logDefs):\n endpointPrep = self.transport.prepEndpoint(adminAddr, capabilities)\n\n multiprocessing.process._current_process._daemonic = False\n admin = multiprocessing.Process(target=startAdmin,\n args=(MultiProcAdmin,\n addrOfStarter,\n endpointPrep,\n self.transport.__class__,\n adminAddr,\n capabilities,\n logDefs),\n name='ThespianAdmin')\n admin.start()\n # admin must be explicity shutdown and is not automatically\n # stopped when this current process exits.\n detach_child(admin)\n\n self.transport.connectEndpoint(endpointPrep)\n\n response = self.transport.run(None, MAX_ADMIN_STARTUP_DELAY)\n if not response or not isinstance(response.message, EndpointConnected):\n raise InvalidActorAddress(adminAddr, 'not a valid ActorSystem admin')", "metadata": "root.multiprocessCommon._startAdmin", "header": "['class', 'multiprocessCommon', '(', 'systemBase', ')', ':', '___EOS___']", "index": 66 }, { "content": "def closeUnusedFiles(transport):\n import os, sys\n notouch = transport.protectedFileNumList()\n for each in [sys.stdin, sys.stderr, sys.stdout]:\n try:\n notouch.append(each.fileno())\n except AttributeError: pass\n for fdnum in range(3, 255):\n if fdnum not in notouch:\n try:\n os.close(fdnum)\n except OSError: pass", "metadata": "root.closeUnusedFiles", "header": "['module', '___EOS___']", "index": 91 }, { "content": "def closeFileNums(list):\n import os\n for fdnum in list:\n try:\n os.close(fdnum)\n except OSError: pass", "metadata": "root.closeFileNums", "header": "['module', '___EOS___']", "index": 105 }, { "content": "def startAdmin(adminClass, addrOfStarter, endpointPrep, transportClass,\n adminAddr, capabilities, logDefs):\n # Unix Daemonization; skipped if not available\n import os,sys\n if hasattr(os, 'setsid'):\n os.setsid()\n try:\n import resource\n resource.setrlimit(resource.RLIMIT_CORE, (0,0)) # No core dumps\n except Exception: pass\n if hasattr(os, 'fork'):\n if os.fork(): sys.exit(0)\n\n # Slight trickiness here. There may *already* be an admin bound\n # to this start address. However, the external process attempting\n # to start is going to wait for the EndpointConnected message\n # before continuing, so ensure that message is *not* sent until\n # the local admin Transport has had time to bind and listen to the\n # local address, but also ensure that the message is *always* sent\n # even if the local admin could not start (caller will use\n # _verifyAdminRunning to ensure things are OK.\n transport = transportClass(endpointPrep)\n try:\n admin = adminClass(transport, adminAddr, capabilities, logDefs)\n except Exception:\n transport.scheduleTransmit(None,\n TransmitIntent(addrOfStarter, EndpointConnected(0)))\n raise\n # Send of EndpointConnected is deferred until the logger is setup. See MultiProcReplicator.h_LoggerConnected below.\n\n admin.addrOfStarter = addrOfStarter\n setProcName(adminClass.__name__, admin.transport.myAddress)\n\n # Generate the \"placeholder\" loggerAddr directly instead of going\n # through the AddressManager because the logger is not managed as\n # a normal child.\n loggerAddr = ActorAddress(ActorLocalAddress(transport.myAddress, -1, None))\n admin.asLogger = None\n logAggregator = capabilities.get('Convention Address.IPv4', None)\n if logAggregator:\n try:\n logAggregator = transportClass.getAddressFromString(logAggregator)\n except Exception as ex:\n thesplog('Unable to adapt log aggregator address \"%s\" to a transport address: %s',\n logAggregator, ex, level=logging.WARNING)\n admin.asLogProc = startASLogger(loggerAddr, logDefs, transport, capabilities,\n logAggregator\n if logAggregator != admin.transport.myAddress\n else None)\n #closeUnusedFiles(transport)\n admin.run()", "metadata": "root.startAdmin", "header": "['module', '___EOS___']", "index": 116 }, { "content": "class ChildInfo(object):", "metadata": "root.ChildInfo", "header": "['module', '___EOS___']", "index": 169 }, { "content": " def __init__(self, childAddr, childClass, childProc, childNum):\n self.childAddr = childAddr\n self.childClass = childClass\n self.childProc = childProc\n self.childNum = childNum", "metadata": "root.ChildInfo.__init__", "header": "['class', 'ChildInfo', '(', 'object', ')', ':', '___EOS___']", "index": 170 }, { "content": " def __str__(self):\n return \"Child #%s: %s @ %s (proc %s)\"%(str(self.childNum),\n str(self.childClass),\n str(getattr(self, 'childRealAddr', self.childAddr)),\n str(self.childProc))", "metadata": "root.ChildInfo.__str__", "header": "['class', 'ChildInfo', '(', 'object', ')', ':', '___EOS___']", "index": 175 }, { "content": "def startASLogger(loggerAddr, logDefs, transport, capabilities, aggregatorAddress=None):\n endpointPrep = transport.prepEndpoint(loggerAddr, capabilities)\n multiprocessing.process._current_process._daemonic = False\n logProc = multiprocessing.Process(target=startupASLogger,\n args = (transport.myAddress, endpointPrep,\n logDefs,\n transport.__class__, aggregatorAddress))\n logProc.daemon = True\n logProc.start()\n transport.connectEndpoint(endpointPrep)\n # When the caller that owns the transport starts their run(), it\n # will receive the LoggerConnected from the child to complete the\n # handshake and the sender will be the actual address of the\n # logger.\n return ChildInfo(loggerAddr, 'logger', logProc, endpointPrep.addrInst)", "metadata": "root.startASLogger", "header": "['module', '___EOS___']", "index": 182 }, { "content": "class MultiProcReplicator(object):\n\n\n\n\n\n\n\n\n\n\n\n\n", "metadata": "root.MultiProcReplicator", "header": "['module', '___EOS___']", "index": 200 }, { "content": " def _startChildActor(self, childAddr, childClass, parentAddr, notifyAddr,\n childRequirements=None,\n sourceHash=None, sourceToLoad=None):\n \"\"\"Create a new actor of type `childClass'.\n\n The `childAddr' is the local address of this child in the\n creator's address-space.\n\n The `parentAddr' is the parent of this actor in the\n heirarchy and will be another Actor or the local Admin.\n\n The `notifyAddr' is the Actor or Admin which should be\n notified on successful creation of this child Actor\n (normally this will be the parentAddr, but if the local\n Admin has been enlisted to create this Actor on behalf of\n another (possibly remote) Actor, the local Admin should be\n notified of the successful creation to complete it's\n administration and the Admin will forward the completion to\n the original requestor.).\n\n The optional `childRequirements' are a list of requirements\n dictated by the creating Actor.\n\n \"\"\"\n if parentAddr is None:\n raise ActorSystemFailure('parentAddr cannot be None!')\n if self.asLogger is None:\n raise ActorSystemFailure('logger ADDR cannot be None!')\n\n if not checkActorCapabilities(childClass, self.capabilities, childRequirements,\n partial(loadModuleFromHashSource,\n sourceHash,\n { sourceHash: sourceToLoad })\n if sourceHash else None):\n raise NoCompatibleSystemForActor(childClass,\n \"no system has compatible capabilities\")\n\n # KWQ: when child starts it will have this parent address and it will initialize its transport and notify the parent, whereupon the parent will see the incoming message from the child with the id# indicated in the addressmanager localaddress and update the localaddress. All this should happen in the transport though, not here.\n endpointPrep = self.transport.prepEndpoint(childAddr, self.capabilities)\n\n multiprocessing.process._current_process._daemonic = False\n\n # Ensure fileNumsToClose is a list, not an iterator because it\n # is an argument passed to the child.\n fileNumsToClose = list(self.transport.childResetFileNumList())\n\n child = multiprocessing.Process(target=startChild, #KWQ: instantiates module specified by sourceHash to create actor\n args=(childClass,\n endpointPrep,\n self.transport.__class__,\n sourceHash or self._sourceHash,\n sourceToLoad,\n parentAddr,\n self._adminAddr,\n notifyAddr,\n self.asLogger,\n childRequirements,\n self.capabilities,\n fileNumsToClose),\n name='Actor_%s__%s'%(getattr(childClass, '__name__', childClass), str(childAddr)))\n child.start()\n # Also note that while non-daemonic children cause the current\n # process to automatically join() those children on exit,\n # daemonic children are sent a terminate() operation (usually\n # indicated by a SIGTERM under unix or TERMINATE indicator\n # under windows. To avoid this, use another dirty trick and\n # remove all children from the _current_process._children list\n # so that they are not automatically stopped when this process\n # stops.\n detach_child(child)\n\n if not hasattr(self, '_child_procs'): self._child_procs = []\n self._child_procs.append(ChildInfo(childAddr, childClass, child, endpointPrep.addrInst))\n self.transport.connectEndpoint(endpointPrep)", "metadata": "root.MultiProcReplicator._startChildActor", "header": "['class', 'MultiProcReplicator', '(', 'object', ')', ':', '___EOS___']", "index": 202 }, { "content": " @staticmethod\n def _checkChildLiveness(childInfo):\n if not childInfo.childProc.is_alive():\n # Don't join forever; that might hang and it's ok to leave\n # zombies as long as we continue to make progress.\n childInfo.childProc.join(0.5)\n return False\n return True", "metadata": "root.MultiProcReplicator._checkChildLiveness", "header": "['class', 'MultiProcReplicator', '(', 'object', ')', ':', '___EOS___']", "index": 278 }, { "content": " def _childExited(self, childAddr):\n self._child_procs = list(filter(self._checkChildLiveness, getattr(self, '_child_procs', [])))", "metadata": "root.MultiProcReplicator._childExited", "header": "['class', 'MultiProcReplicator', '(', 'object', ')', ':', '___EOS___']", "index": 287 }, { "content": " def childDied(self, signum, frame):\n # Signal handler for SIGCHLD; figure out which child and synthesize a ChildActorExited to handle it\n self._child_procs, dead = partition(self._checkChildLiveness, getattr(self, '_child_procs', []))\n for each in dead:\n addr = getattr(each, 'childRealAddr', each.childAddr)\n self.transport.scheduleTransmit(None, TransmitIntent(self.transport.myAddress,\n ChildActorExited(addr)))", "metadata": "root.MultiProcReplicator.childDied", "header": "['class', 'MultiProcReplicator', '(', 'object', ')', ':', '___EOS___']", "index": 290 }, { "content": " def h_EndpointConnected(self, envelope):\n for C in getattr(self, '_child_procs', []):\n if envelope.message.childInstance == C.childNum:\n C.childRealAddr = envelope.sender\n break\n else:\n thesplog('Unknown child process endpoint connected: %s', envelope, level=logging.WARNING)\n self._pendingActorReady(envelope.message.childInstance, envelope.sender)\n return True", "metadata": "root.MultiProcReplicator.h_EndpointConnected", "header": "['class', 'MultiProcReplicator', '(', 'object', ')', ':', '___EOS___']", "index": 298 }, { "content": " def h_LoggerConnected(self, envelope):\n self.asLogger = envelope.sender\n # Dirty trick here to completely re-initialize logging in this\n # process... something the standard Python logging interface does\n # not allow via the API.\n self.oldLoggerRoot = logging.root\n logging.root = ThespianLogForwarder(self.asLogger, self.transport)\n logging.Logger.root = logging.root\n logging.Logger.manager = logging.Manager(logging.Logger.root)\n logging.getLogger('Thespian.Admin') \\\n .info('ActorSystem Administrator startup @ %s', self.myAddress)\n\n # Now that logging is started, Admin startup can be confirmed\n self.transport.scheduleTransmit(None,\n TransmitIntent(self.addrOfStarter, EndpointConnected(0)))\n\n self._activate()\n return True", "metadata": "root.MultiProcReplicator.h_LoggerConnected", "header": "['class', 'MultiProcReplicator', '(', 'object', ')', ':', '___EOS___']", "index": 308 }, { "content": " def h_LogRecord(self, envelope):\n self._send_intent(TransmitIntent(self.asLogger, envelope.message))\n return True", "metadata": "root.MultiProcReplicator.h_LogRecord", "header": "['class', 'MultiProcReplicator', '(', 'object', ')', ':', '___EOS___']", "index": 328 }, { "content": " def _handleReplicatorMessages(self, envelope):\n if isinstance(envelope.message, EndpointConnected):\n return True, self.h_EndpointConnected(envelope)\n if isinstance(envelope.message, logging.LogRecord):\n return True, self.h_LogRecord(envelope)\n return False, True", "metadata": "root.MultiProcReplicator._handleReplicatorMessages", "header": "['class', 'MultiProcReplicator', '(', 'object', ')', ':', '___EOS___']", "index": 333 }, { "content": " def _cleanupAdmin(self):\n if getattr(self, 'asLogger', None):\n if hasattr(self, 'oldLoggerRoot'):\n logging.root = self.oldLoggerRoot\n logging.Logger.root = self.oldLoggerRoot\n logging.Logger.manager = logging.Manager(logging.Logger.root)\n self.transport.run(TransmitOnly, maximumDuration=timedelta(milliseconds=250))\n import time\n time.sleep(0.05) # allow children to exit and log their exit\n self.transport.scheduleTransmit(None, TransmitIntent(self.asLogger,\n LoggerExitRequest()))\n self.transport.run(TransmitOnly)\n if getattr(self, 'asLogProc', None):\n if self._checkChildLiveness(self.asLogProc):\n import time\n time.sleep(0.02) # wait a little to allow logger to exit\n self._checkChildLiveness(self.asLogProc) # cleanup defunct proc", "metadata": "root.MultiProcReplicator._cleanupAdmin", "header": "['class', 'MultiProcReplicator', '(', 'object', ')', ':', '___EOS___']", "index": 341 }, { "content": "def signal_detector(name, addr):\n def signal_detected(signum, frame):\n thesplog('Actor %s @ %s got signal: %s', name, addr, signum,\n level = logging.WARNING)\n # Simply exit; just by catching the signal the atexit handlers are enabled\n # if this signal is going to cause a process exit.\n return signal_detected", "metadata": "root.signal_detector", "header": "['module', '___EOS___']", "index": 363 }, { "content": "def shutdown_signal_detector(name, addr, am):\n def shutdown_signal_detected(signum, frame):\n thesplog('Actor %s @ %s got shutdown signal: %s', name, addr, signum,\n level = logging.WARNING)\n am.transport.scheduleTransmit(None, TransmitIntent(am.transport.myAddress,\n ActorExitRequest()))\n return shutdown_signal_detected", "metadata": "root.shutdown_signal_detector", "header": "['module', '___EOS___']", "index": 372 }, { "content": "def startChild(childClass, endpoint, transportClass,\n sourceHash, sourceToLoad,\n parentAddr, adminAddr, notifyAddr, loggerAddr,\n childRequirements, currentSystemCapabilities,\n fileNumsToClose):\n\n closeFileNums(fileNumsToClose)\n\n # Dirty trick here to workaround multiprocessing trying to impose\n # an unnecessary restriction. A process should be set daemonic\n # before start() if the parent shouldn't track it (an specifically\n # automatically join() the subprocess on exit). For Actors, the\n # parent exists independently of the child and the ActorSystem\n # manages them, so daemonic processes are desired. However,\n # multiprocessing imposes a restriction that daemonic processes\n # cannot create more processes. The following reaches deep into\n # the implementation of the multiprocessing module to override\n # that restriction. This process was already started as daemonic,\n # and it's detached from its parent. The following simply clears\n # that flag locally so that other processes can be created from\n # this one.\n multiprocessing.process._current_process._daemonic = False\n\n transport = transportClass(endpoint)\n #closeUnusedFiles(transport)\n\n # Dirty trick here to completely re-initialize logging in this\n # process... something the standard Python logging interface does\n # not allow via the API. We also do not want to run\n # logging.shutdown() because (a) that does not do enough to reset,\n # and (b) it shuts down handlers, but we want to leave the parent's\n # handlers alone.\n logging.root = ThespianLogForwarder(loggerAddr, transport)\n logging.Logger.root = logging.root\n logging.Logger.manager = logging.Manager(logging.Logger.root)\n\n logger = logging.getLogger('Thespian.ActorManager')\n\n am = MultiProcManager(childClass, transport,\n sourceHash, sourceToLoad,\n parentAddr, adminAddr,\n childRequirements, currentSystemCapabilities)\n am.asLogger = loggerAddr\n am.transport.scheduleTransmit(None,\n TransmitIntent(notifyAddr,\n EndpointConnected(endpoint.addrInst)))\n setProcName(getattr(childClass, '__name__', str(childClass)), am.transport.myAddress)\n\n sighandler = signal_detector(getattr(childClass, '__name__', str(childClass)),\n am.transport.myAddress)\n sigexithandler = shutdown_signal_detector(getattr(childClass, '__name__', str(childClass)),\n am.transport.myAddress,\n am)\n\n for each in range(1, signal.NSIG):\n # n.b. normally Python intercepts SIGINT to turn it into a\n # KeyboardInterrupt exception. However, these Actors should\n # be detached from the keyboard, so revert to normal SIGINT\n # behavior.\n if each not in uncatchable_signals:\n if each in child_exit_signals:\n signal.signal(each, am.childDied)\n continue\n try:\n signal.signal(each,\n sigexithandler if each in exit_signals else sighandler)\n except (RuntimeError,ValueError,EnvironmentError) as ex:\n # OK, this signal can't be caught for this\n # environment. We did our best.\n pass\n\n am.run()", "metadata": "root.startChild", "header": "['module', '___EOS___']", "index": 381 }, { "content": "class MultiProcAdmin(MultiProcReplicator, ThespianAdmin): pass", "metadata": "root.MultiProcAdmin", "header": "['module', '___EOS___']", "index": 456 }, { "content": "class MultiProcManager(MultiProcReplicator, ActorManager): pass", "metadata": "root.MultiProcManager", "header": "['module', '___EOS___']", "index": 457 } ]
[ { "span": "from thespian.system.utilis import setProcName, StatsManager", "start_line": 11, "start_column": 0, "end_line": 11, "end_column": 60 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\"\"\"", "Common", " ", "functional", "it", "y", " ", "for", " ", "multipro", "cess", " ", "system", " ", "base", "es", " ", "bui", "lt", " ", "with", " ", "the", "\\", "10", ";", "python", " ", "'", "multipro", "cess", "'", " ", "module", ".", " ", " ", "Inten", "ded", " ", "as", " ", "a", " ", "base", " ", "class", ",", " ", "not", " ", "for", "\\", "10", ";", "direct", " ", "usage", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "logging_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "thes", "pian", "_", "._", "actors_", "import_", "*_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "thes", "pian", "_", "._", "system_", "._", "system", "Base_", "import_", "system", "Base_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "thes", "pian", "_", "._", "system_", "._", "utilis", "_", "import_", "thes", "plo", "g_", ",_", "check", "Act", "or", "Capabilities", "_", ",_", "partition_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "thes", "pian", "_", "._", "system_", "._", "transport_", "import_", "*_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "thes", "pian", "_", "._", "system_", "._", "logdi", "rect", "or_", "import_", "*_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "thes", "pian", "_", "._", "system_", "._", "utilis", "_", "import_", "set", "Proc", "Name_", ",_", "Stat", "s", "Manager_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "thes", "pian", "_", "._", "system_", "._", "address", "Manager_", "import_", "Act", "or", "Local", "Address_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "thes", "pian", "_", "._", "system_", "._", "messages_", "._", "multipro", "c_", "import_", "*_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "thes", "pian", "_", "._", "system_", "._", "source", "Loader_", "import_", "load", "Modul", "e", "Fro", "m", "Hash", "Source_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "functools_", "import_", "partial_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "multiprocessing_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "signal_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "datetime_", "import_", "timedelta_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "MAX", "\\u", "ADM", "IN", "\\u", "START", "UP", "\\u", "DELAY_", "=_", "timedelta_", "(_", "seconds_", "=_", "5_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "unca", "tcha", "ble", "\\u", "signals_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "sname_", "in_", "[_", "'", "SIG", "CONT", "'_", ",_", "'", "SIG", "PIPE", "'_", ",_", "'", "SIG", "KILL", "'_", ",_", "'", "SIG", "STOP", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "unca", "tcha", "ble", "\\u", "signals_", "._", "append_", "(_", "eval_", "(_", "'", "signal", ".", "%", "s", "'_", "%_", "sname_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Attribute", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "#", " ", "not", " ", "defin", "ed", " ", "for", " ", "this", " ", "OS_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "exit", "\\u", "signals_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "sname_", "in_", "[_", "'", "SIG", "TERM", "'_", ",_", "'", "SIG", "KILL", "'_", ",_", "'", "SIG", "QUI", "T", "'_", ",_", "'", "SIG", "AB", "RT", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "exit", "\\u", "signals_", "._", "append_", "(_", "eval_", "(_", "'", "signal", ".", "%", "s", "'_", "%_", "sname_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Attribute", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "#", " ", "not", " ", "defin", "ed", " ", "for", " ", "this", " ", "OS_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "child", "\\u", "exit", "\\u", "signals_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "sname_", "in_", "[_", "'", "SIG", "CH", "LD", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "child", "\\u", "exit", "\\u", "signals_", "._", "append_", "(_", "eval_", "(_", "'", "signal", ".", "%", "s", "'_", "%_", "sname_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Attribute", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "#", " ", "not", " ", "defin", "ed", " ", "for", " ", "this", " ", "OS_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "from_", "thes", "pian", "_", "._", "system_", "._", "system", "Admin_", "import_", "The", "spi", "an", "Admin_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "from_", "thes", "pian", "_", "._", "system_", "._", "actor", "Manager_", "import_", "Act", "or", "Manager_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "deta", "ch", "\\u", "child_", "(_", "child", "ref_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "hasattr_", "(_", "multiprocessing_", "._", "process_", ",_", "'\\u", "child", "ren", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Pyth", "on", " ", "3.4", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "multiprocessing_", "._", "process_", "._", "\\u", "children_", "._", "remove_", "(_", "child", "ref_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "hasattr_", "(_", "multiprocessing_", "._", "process_", ",_", "'\\u", "current", "\\u", "process", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "hasattr_", "(_", "multiprocessing_", "._", "process_", "._", "\\u", "current", "\\u", "process_", ",_", "'\\u", "child", "ren", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Pyth", "on", " ", "2.6", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "multiprocessing_", "._", "process_", "._", "\\u", "current", "\\u", "process_", "._", "\\u", "children_", "._", "remove_", "(_", "child", "ref_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "multipro", "cess", "Common_", "(_", "system", "Base_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "multipro", "cess", "Common_", "(_", "system", "Base_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "system_", ",_", "log", "Defs", "_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "sys_", ",_", "time_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "system_", "._", "capabilities_", "[_", "'", "Pyth", "on", " ", "Version", "'_", "]_", "=_", "tuple_", "(_", "sys_", "._", "version", "\\u", "info_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "system_", "._", "capabilities_", "[_", "'", "The", "spi", "an", " ", "Generat", "ion", "'_", "]_", "=_", "The", "spi", "an", "Generat", "ion_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "system_", "._", "capabilities_", "[_", "'", "The", "spi", "an", " ", "Version", "'_", "]_", "=_", "str_", "(_", "int_", "(_", "time_", "._", "time_", "(_", ")_", "*_", "1000_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "transport_", "=_", "self_", "._", "transport", "Type_", "(_", "Exter", "nal", "Interface", "Transp", "ort", "Init_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "system_", "._", "capabilities_", ",_", "log", "Defs", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "super_", "(_", "multipro", "cess", "Common_", ",_", "self_", ")_", "._", "\\u\\u", "init\\u\\u_", "(_", "system_", ",_", "log", "Defs", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "multipro", "cess", "Common_", "(_", "system", "Base_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "start", "Admin_", "(_", "self_", ",_", "admin", "Addr_", ",_", "addr", "Of", "Start", "er_", ",_", "capabilities_", ",_", "log", "Defs", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "endpoint", "Prep", "_", "=_", "self_", "._", "transport_", "._", "prep", "Endpoint_", "(_", "admin", "Addr_", ",_", "capabilities_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "multiprocessing_", "._", "process_", "._", "\\u", "current", "\\u", "process_", "._", "\\u", "daemon", "ic_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "admin_", "=_", "multiprocessing_", "._", "Process_", "(_", "target_", "=_", "start", "Admin_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "args_", "=_", "(_", "Multi", "Proc", "Admin_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "addr", "Of", "Start", "er_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "endpoint", "Prep", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "transport_", "._", "\\u\\u", "class\\u\\u_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "admin", "Addr_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "capabilities_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "log", "Defs", "_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "name_", "=_", "'", "The", "spi", "an", "Admi", "n", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "admin_", "._", "start_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "admin", " ", "must", " ", "be", " ", "explicit", "y", " ", "shut", "down", " ", "and", " ", "is", " ", "not", " ", "automati", "call", "y_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "stopp", "ed", " ", "whe", "n", " ", "this", " ", "current", " ", "process", " ", "exits", "._", "\\u\\u\\uNL\\u\\u\\u_", "deta", "ch", "\\u", "child_", "(_", "admin_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "transport_", "._", "connect", "Endpoint_", "(_", "endpoint", "Prep", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "response_", "=_", "self_", "._", "transport_", "._", "run_", "(_", "None_", ",_", "MAX", "\\u", "ADM", "IN", "\\u", "START", "UP", "\\u", "DELAY_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "response_", "or_", "not_", "isinstance_", "(_", "response_", "._", "message_", ",_", "End", "point", "Connected_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Inva", "lid", "Act", "or", "Address_", "(_", "admin", "Addr_", ",_", "'", "not", " ", "a", " ", "valid", " ", "Act", "or", "System", " ", "admin", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "close", "Un", "used", "Files_", "(_", "transport_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "os_", ",_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "not", "ouch", "_", "=_", "transport_", "._", "protect", "ed", "File", "Num", "List_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "each_", "in_", "[_", "sys_", "._", "stdin_", ",_", "sys_", "._", "stderr_", ",_", "sys_", "._", "stdout_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "not", "ouch", "_", "._", "append_", "(_", "each_", "._", "fileno_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Attribute", "Error_", ":_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "fd", "num_", "in_", "range_", "(_", "3_", ",_", "255_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "fd", "num_", "not_", "in_", "not", "ouch", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "os_", "._", "close_", "(_", "fd", "num_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "OSE", "rror_", ":_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "close", "File", "Num", "s_", "(_", "list_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "fd", "num_", "in_", "list_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "os_", "._", "close_", "(_", "fd", "num_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "OSE", "rror_", ":_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "start", "Admin_", "(_", "admin", "Class_", ",_", "addr", "Of", "Start", "er_", ",_", "endpoint", "Prep", "_", ",_", "transport", "Class_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "admin", "Addr_", ",_", "capabilities_", ",_", "log", "Defs", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Uni", "x", " ", "Da", "emo", "niz", "ation", ";", " ", "skip", "ped", " ", "if", " ", "not", " ", "available_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "os_", ",_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "hasattr_", "(_", "os_", ",_", "'", "sets", "id", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "os_", "._", "sets", "id_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "resource_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "resource_", "._", "set", "rli", "mit_", "(_", "resource_", "._", "RL", "IM", "IT", "\\u", "CORE", "_", ",_", "(_", "0_", ",_", "0_", ")_", ")_", "#", " ", "No", " ", "core", " ", "dumps_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", ":_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "hasattr_", "(_", "os_", ",_", "'", "fork", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "os_", "._", "fork_", "(_", ")_", ":_", "sys_", "._", "exit_", "(_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Sli", "ght", " ", "trick", "iness", " ", "here", ".", " ", " ", "There", " ", "may", " ", "*", "alr", "ead", "y", "*", " ", "be", " ", "an", " ", "admin", " ", "bound_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "to", " ", "this", " ", "start", " ", "address", ".", " ", " ", "Ho", "we", "ver", ",", " ", "the", " ", "external", " ", "process", " ", "atte", "mpt", "ing_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "to", " ", "start", " ", "is", " ", "goi", "ng", " ", "to", " ", "wait", " ", "for", " ", "the", " ", "End", "point", "Connect", "ed", " ", "message_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "bef", "ore", " ", "continui", "ng", ",", " ", "so", " ", "ensure", " ", "tha", "t", " ", "message", " ", "is", " ", "*", "not", "*", " ", "sent", " ", "until_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "the", " ", "local", " ", "admin", " ", "Transp", "ort", " ", "has", " ", "had", " ", "time", " ", "to", " ", "bind", " ", "and", " ", "listen", " ", "to", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "local", " ", "address", ",", " ", "but", " ", "als", "o", " ", "ensure", " ", "tha", "t", " ", "the", " ", "message", " ", "is", " ", "*", "alw", "ay", "s", "*", " ", "sent_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "even", " ", "if", " ", "the", " ", "local", " ", "admin", " ", "coul", "d", " ", "not", " ", "start", " ", "(", "caller", " ", "will", " ", "use_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "\\u", "verify", "Admi", "n", "Run", "ning", " ", "to", " ", "ensure", " ", "thing", "s", " ", "are", " ", "OK", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "transport_", "=_", "transport", "Class_", "(_", "endpoint", "Prep", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "admin_", "=_", "admin", "Class_", "(_", "transport_", ",_", "admin", "Addr_", ",_", "capabilities_", ",_", "log", "Defs", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "transport_", "._", "schedule", "Transmit", "_", "(_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Transmit", "Inten", "t_", "(_", "addr", "Of", "Start", "er_", ",_", "End", "point", "Connected_", "(_", "0_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Sen", "d", " ", "of", " ", "End", "point", "Connect", "ed", " ", "is", " ", "defer", "red", " ", "unti", "l", " ", "the", " ", "logg", "er", " ", "is", " ", "setup", ".", " ", " ", "See", " ", "Multi", "Proc", "Replica", "tor", ".", "h", "\\u", "Log", "ger", "Connect", "ed", " ", "belo", "w", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "admin_", "._", "addr", "Of", "Start", "er_", "=_", "addr", "Of", "Start", "er_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "set", "Proc", "Name_", "(_", "admin", "Class_", "._", "\\u\\u", "name\\u\\u_", ",_", "admin_", "._", "transport_", "._", "my", "Address_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Generate", " ", "the", " ", "\"", "placehold", "er", "\"", " ", "logg", "er", "Add", "r", " ", "direct", "ly", " ", "inst", "ead", " ", "of", " ", "goi", "ng_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "through", " ", "the", " ", "Address", "Manager", " ", "bec", "aus", "e", " ", "the", " ", "logg", "er", " ", "is", " ", "not", " ", "manage", "d", " ", "as_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "a", " ", "normal", " ", "child", "._", "\\u\\u\\uNL\\u\\u\\u_", "logg", "er", "Addr_", "=_", "Act", "or", "Address_", "(_", "Act", "or", "Local", "Address_", "(_", "transport_", "._", "my", "Address_", ",_", "-_", "1_", ",_", "None_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "admin_", "._", "as", "Logger_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "log", "Aggregator", "_", "=_", "capabilities_", "._", "get_", "(_", "'", "Conve", "ntion", " ", "Address", ".", "IP", "v", "4", "'_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "log", "Aggregator", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "log", "Aggregator", "_", "=_", "transport", "Class_", "._", "get", "Address", "Fro", "m", "String_", "(_", "log", "Aggregator", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", "as_", "ex_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "thes", "plo", "g_", "(_", "'", "Una", "ble", " ", "to", " ", "adapt", " ", "log", " ", "aggregator", " ", "address", " ", "\"%", "s", "\"", " ", "to", " ", "a", " ", "transport", " ", "address", ":", " ", "%", "s", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "log", "Aggregator", "_", ",_", "ex_", ",_", "level_", "=_", "logging_", "._", "WARNING_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "admin_", "._", "as", "Log", "Proc_", "=_", "start", "AS", "Logger_", "(_", "logg", "er", "Addr_", ",_", "log", "Defs", "_", ",_", "transport_", ",_", "capabilities_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "log", "Aggregator", "_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "log", "Aggregator", "_", "!=_", "admin_", "._", "transport_", "._", "my", "Address_", "\\u\\u\\uNL\\u\\u\\u_", "else_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "close", "Un", "used", "Files", "(", "transport", ")_", "\\u\\u\\uNL\\u\\u\\u_", "admin_", "._", "run_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Chil", "d", "Info_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Chil", "d", "Info_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "child", "Addr_", ",_", "child", "Class_", ",_", "child", "Proc_", ",_", "child", "Num_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "child", "Addr_", "=_", "child", "Addr_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "child", "Class_", "=_", "child", "Class_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "child", "Proc_", "=_", "child", "Proc_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "child", "Num_", "=_", "child", "Num_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Chil", "d", "Info_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "str\\u\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\"", "Chil", "d", " ", "#", "%", "s", ":", " ", "%", "s", " ", "@", " ", "%", "s", " ", "(", "proc", " ", "%", "s", ")\"_", "%_", "(_", "str_", "(_", "self_", "._", "child", "Num_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "str_", "(_", "self_", "._", "child", "Class_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "str_", "(_", "getattr_", "(_", "self_", ",_", "'", "child", "Real", "Add", "r", "'_", ",_", "self_", "._", "child", "Addr_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "str_", "(_", "self_", "._", "child", "Proc_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "start", "AS", "Logger_", "(_", "logg", "er", "Addr_", ",_", "log", "Defs", "_", ",_", "transport_", ",_", "capabilities_", ",_", "aggregator", "Address_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "endpoint", "Prep", "_", "=_", "transport_", "._", "prep", "Endpoint_", "(_", "logg", "er", "Addr_", ",_", "capabilities_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "multiprocessing_", "._", "process_", "._", "\\u", "current", "\\u", "process_", "._", "\\u", "daemon", "ic_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "log", "Proc_", "=_", "multiprocessing_", "._", "Process_", "(_", "target_", "=_", "start", "up", "AS", "Logger_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "args_", "=_", "(_", "transport_", "._", "my", "Address_", ",_", "endpoint", "Prep", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "log", "Defs", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "transport_", "._", "\\u\\u", "class\\u\\u_", ",_", "aggregator", "Address_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "log", "Proc_", "._", "daemon_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "log", "Proc_", "._", "start_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "transport_", "._", "connect", "Endpoint_", "(_", "endpoint", "Prep", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Whe", "n", " ", "the", " ", "caller", " ", "tha", "t", " ", "owns", " ", "the", " ", "transport", " ", "starts", " ", "thei", "r", " ", "run", "()", ",", " ", "it_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "will", " ", "receive", " ", "the", " ", "Log", "ger", "Connect", "ed", " ", "from", " ", "the", " ", "child", " ", "to", " ", "complete", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "handshake", " ", "and", " ", "the", " ", "sender", " ", "will", " ", "be", " ", "the", " ", "actual", " ", "address", " ", "of", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "logg", "er", "._", "\\u\\u\\uNL\\u\\u\\u_", "return_", "Chil", "d", "Info_", "(_", "logg", "er", "Addr_", ",_", "'", "logg", "er", "'_", ",_", "log", "Proc_", ",_", "endpoint", "Prep", "_", "._", "addr", "Inst_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Multi", "Proc", "Replica", "tor_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Multi", "Proc", "Replica", "tor_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "\\u", "start", "Chil", "d", "Actor_", "(_", "self_", ",_", "child", "Addr_", ",_", "child", "Class_", ",_", "parent", "Addr_", ",_", "notif", "y", "Addr_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "child", "Requirements", "_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "source", "Hash_", "=_", "None_", ",_", "source", "To", "Load_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Creat", "e", " ", "a", " ", "new", " ", "actor", " ", "of", " ", "type", " ", "`", "child", "Class", "'.", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", "The", " ", "`", "child", "Add", "r", "'", " ", "is", " ", "the", " ", "local", " ", "address", " ", "of", " ", "this", " ", "child", " ", "in", " ", "the", "\\", "10", ";", " ", " ", " ", "creat", "or", "'", "s", " ", "address", "-", "space", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", "The", " ", "`", "parent", "Add", "r", "'", " ", "is", " ", "the", " ", "parent", " ", "of", " ", "this", " ", "actor", " ", "in", " ", "the", "\\", "10", ";", " ", " ", " ", "hei", "rar", "chy", " ", "and", " ", "will", " ", "be", " ", "anot", "her", " ", "Act", "or", " ", "or", " ", "the", " ", "local", " ", "Admi", "n", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", "The", " ", "`", "notif", "y", "Add", "r", "'", " ", "is", " ", "the", " ", "Act", "or", " ", "or", " ", "Admi", "n", " ", "whi", "ch", " ", "shou", "ld", " ", "be", "\\", "10", ";", " ", " ", " ", "notified", " ", "on", " ", "success", "ful", " ", "creati", "on", " ", "of", " ", "this", " ", "child", " ", "Act", "or", "\\", "10", ";", " ", " ", " ", "(", "normal", "ly", " ", "this", " ", "will", " ", "be", " ", "the", " ", "parent", "Add", "r", ",", " ", "but", " ", "if", " ", "the", " ", "local", "\\", "10", ";", " ", " ", " ", "Admi", "n", " ", "has", " ", "bee", "n", " ", "enl", "iste", "d", " ", "to", " ", "create", " ", "this", " ", "Act", "or", " ", "on", " ", "beha", "lf", " ", "of", "\\", "10", ";", " ", " ", " ", "anot", "her", " ", "(", "possib", "ly", " ", "remote", ")", " ", "Act", "or", ",", " ", "the", " ", "local", " ", "Admi", "n", " ", "shou", "ld", " ", "be", "\\", "10", ";", " ", " ", " ", "notified", " ", "of", " ", "the", " ", "success", "ful", " ", "creati", "on", " ", "to", " ", "complete", " ", "it", "'", "s", "\\", "10", ";", " ", " ", " ", "administrati", "on", " ", "and", " ", "the", " ", "Admi", "n", " ", "will", " ", "forward", " ", "the", " ", "completion", " ", "to", "\\", "10", ";", " ", " ", " ", "the", " ", "original", " ", "requestor", ".)", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", "The", " ", "option", "al", " ", "`", "child", "Requirements", "'", " ", "are", " ", "a", " ", "list", " ", "of", " ", "require", "ment", "s", "\\", "10", ";", " ", " ", " ", "dict", "ated", " ", "by", " ", "the", " ", "creati", "ng", " ", "Act", "or", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "parent", "Addr_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Act", "or", "System", "Failure_", "(_", "'", "parent", "Add", "r", " ", "cann", "ot", " ", "be", " ", "Non", "e", "!'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "as", "Logger_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Act", "or", "System", "Failure_", "(_", "'", "logg", "er", " ", "ADDR", " ", "cann", "ot", " ", "be", " ", "Non", "e", "!'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "check", "Act", "or", "Capabilities", "_", "(_", "child", "Class_", ",_", "self_", "._", "capabilities_", ",_", "child", "Requirements", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "partial_", "(_", "load", "Modul", "e", "Fro", "m", "Hash", "Source_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "source", "Hash_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "source", "Hash_", ":_", "source", "To", "Load_", "}_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "source", "Hash_", "else_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "No", "Compatible", "System", "For", "Actor_", "(_", "child", "Class_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "no", " ", "system", " ", "has", " ", "compatible", " ", "capab", "ilities", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "KW", "Q", ":", " ", "whe", "n", " ", "child", " ", "starts", " ", "it", " ", "will", " ", "have", " ", "this", " ", "parent", " ", "address", " ", "and", " ", "it", " ", "will", " ", "initialize", " ", "its", " ", "transport", " ", "and", " ", "notif", "y", " ", "the", " ", "parent", ",", " ", "where", "upo", "n", " ", "the", " ", "parent", " ", "will", " ", "see", " ", "the", " ", "inco", "ming", " ", "message", " ", "from", " ", "the", " ", "child", " ", "with", " ", "the", " ", "id", "#", " ", "indicat", "ed", " ", "in", " ", "the", " ", "address", "manage", "r", " ", "local", "address", " ", "and", " ", "update", " ", "the", " ", "local", "address", ".", " ", " ", "All", " ", "this", " ", "shou", "ld", " ", "happ", "en", " ", "in", " ", "the", " ", "transport", " ", "tho", "ugh", ",", " ", "not", " ", "here", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "endpoint", "Prep", "_", "=_", "self_", "._", "transport_", "._", "prep", "Endpoint_", "(_", "child", "Addr_", ",_", "self_", "._", "capabilities_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "multiprocessing_", "._", "process_", "._", "\\u", "current", "\\u", "process_", "._", "\\u", "daemon", "ic_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Ensur", "e", " ", "file", "Num", "s", "To", "Clos", "e", " ", "is", " ", "a", " ", "list", ",", " ", "not", " ", "an", " ", "iter", "ator", " ", "bec", "aus", "e", " ", "it_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "is", " ", "an", " ", "argu", "ment", " ", "pass", "ed", " ", "to", " ", "the", " ", "child", "._", "\\u\\u\\uNL\\u\\u\\u_", "file", "Num", "s", "To", "Close_", "=_", "list_", "(_", "self_", "._", "transport_", "._", "child", "Reset", "File", "Num", "List_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "child_", "=_", "multiprocessing_", "._", "Process_", "(_", "target_", "=_", "start", "Child_", ",_", "#", "KW", "Q", ":", " ", "instantiate", "s", " ", "module", " ", "specified", " ", "by", " ", "source", "Hash", " ", "to", " ", "create", " ", "actor_", "\\u\\u\\uNL\\u\\u\\u_", "args_", "=_", "(_", "child", "Class_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "endpoint", "Prep", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "transport_", "._", "\\u\\u", "class\\u\\u_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "source", "Hash_", "or_", "self_", "._", "\\u", "source", "Hash_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "source", "To", "Load_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "parent", "Addr_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "admin", "Addr_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "notif", "y", "Addr_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "as", "Logger_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "child", "Requirements", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "capabilities_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "file", "Num", "s", "To", "Close_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "name_", "=_", "'", "Act", "or", "\\u", "%", "s", "\\u\\u", "%", "s", "'_", "%_", "(_", "getattr_", "(_", "child", "Class_", ",_", "'\\u", "\\u", "name", "\\u\\u'_", ",_", "child", "Class_", ")_", ",_", "str_", "(_", "child", "Addr_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "child_", "._", "start_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Al", "so", " ", "note", " ", "tha", "t", " ", "whi", "le", " ", "non", "-", "daemon", "ic", " ", "child", "ren", " ", "caus", "e", " ", "the", " ", "current_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "process", " ", "to", " ", "automati", "call", "y", " ", "join", "()", " ", "tho", "se", " ", "child", "ren", " ", "on", " ", "exit", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "daemon", "ic", " ", "child", "ren", " ", "are", " ", "sent", " ", "a", " ", "terminate", "()", " ", "operati", "on", " ", "(", "usual", "ly_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "indicat", "ed", " ", "by", " ", "a", " ", "SIG", "TERM", " ", "under", " ", "unix", " ", "or", " ", "TERMINAT", "E", " ", "indicator_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "under", " ", "windows", ".", " ", " ", "To", " ", "avoid", " ", "this", ",", " ", "use", " ", "anot", "her", " ", "dir", "ty", " ", "trick", " ", "and_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "remove", " ", "all", " ", "child", "ren", " ", "from", " ", "the", " ", "\\u", "current", "\\u", "process", ".\\u", "child", "ren", " ", "list_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "so", " ", "tha", "t", " ", "the", "y", " ", "are", " ", "not", " ", "automati", "call", "y", " ", "stopp", "ed", " ", "whe", "n", " ", "this", " ", "process_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "stop", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "deta", "ch", "\\u", "child_", "(_", "child_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "hasattr_", "(_", "self_", ",_", "'\\u", "child", "\\u", "proc", "s", "'_", ")_", ":_", "self_", "._", "\\u", "child", "\\u", "procs_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "child", "\\u", "procs_", "._", "append_", "(_", "Chil", "d", "Info_", "(_", "child", "Addr_", ",_", "child", "Class_", ",_", "child_", ",_", "endpoint", "Prep", "_", "._", "addr", "Inst_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "transport_", "._", "connect", "Endpoint_", "(_", "endpoint", "Prep", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Multi", "Proc", "Replica", "tor_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "staticmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u", "check", "Chil", "d", "Live", "ness_", "(_", "child", "Info_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "child", "Info_", "._", "child", "Proc_", "._", "is", "\\u", "alive_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Don", "'", "t", " ", "join", " ", "forever", ";", " ", "tha", "t", " ", "mig", "ht", " ", "hang", " ", "and", " ", "it", "'", "s", " ", "ok", " ", "to", " ", "leave_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "zombie", "s", " ", "as", " ", "long", " ", "as", " ", "we", " ", "continue", " ", "to", " ", "make", " ", "progress", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "child", "Info_", "._", "child", "Proc_", "._", "join_", "(_", "0.5_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Multi", "Proc", "Replica", "tor_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "child", "Exi", "ted_", "(_", "self_", ",_", "child", "Addr_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "child", "\\u", "procs_", "=_", "list_", "(_", "filter_", "(_", "self_", "._", "\\u", "check", "Chil", "d", "Live", "ness_", ",_", "getattr_", "(_", "self_", ",_", "'\\u", "child", "\\u", "proc", "s", "'_", ",_", "[_", "]_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Multi", "Proc", "Replica", "tor_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "child", "Die", "d_", "(_", "self_", ",_", "signum_", ",_", "frame_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Signal", " ", "handler", " ", "for", " ", "SIG", "CH", "LD", ";", " ", "figure", " ", "out", " ", "whi", "ch", " ", "child", " ", "and", " ", "synthesi", "ze", " ", "a", " ", "Chil", "d", "Act", "or", "Exi", "ted", " ", "to", " ", "handle", " ", "it_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "child", "\\u", "procs_", ",_", "dead_", "=_", "partition_", "(_", "self_", "._", "\\u", "check", "Chil", "d", "Live", "ness_", ",_", "getattr_", "(_", "self_", ",_", "'\\u", "child", "\\u", "proc", "s", "'_", ",_", "[_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "each_", "in_", "dead_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "addr_", "=_", "getattr_", "(_", "each_", ",_", "'", "child", "Real", "Add", "r", "'_", ",_", "each_", "._", "child", "Addr_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "transport_", "._", "schedule", "Transmit", "_", "(_", "None_", ",_", "Transmit", "Inten", "t_", "(_", "self_", "._", "transport_", "._", "my", "Address_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Chil", "d", "Act", "or", "Exi", "ted_", "(_", "addr_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Multi", "Proc", "Replica", "tor_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "h", "\\u", "End", "point", "Connected_", "(_", "self_", ",_", "envelope_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "C_", "in_", "getattr_", "(_", "self_", ",_", "'\\u", "child", "\\u", "proc", "s", "'_", ",_", "[_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "envelope_", "._", "message_", "._", "child", "Instance_", "==_", "C_", "._", "child", "Num_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "C_", "._", "child", "Real", "Addr_", "=_", "envelope_", "._", "sender_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "thes", "plo", "g_", "(_", "'", "Un", "know", "n", " ", "child", " ", "process", " ", "endpoint", " ", "connect", "ed", ":", " ", "%", "s", "'_", ",_", "envelope_", ",_", "level_", "=_", "logging_", "._", "WARNING_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "pend", "ing", "Act", "or", "Ready_", "(_", "envelope_", "._", "message_", "._", "child", "Instance_", ",_", "envelope_", "._", "sender_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Multi", "Proc", "Replica", "tor_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "h", "\\u", "Log", "ger", "Connected_", "(_", "self_", ",_", "envelope_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "as", "Logger_", "=_", "envelope_", "._", "sender_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Dirty", " ", "trick", " ", "here", " ", "to", " ", "complete", "ly", " ", "re", "-", "initialize", " ", "logg", "ing", " ", "in", " ", "this_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "process", "...", " ", "somet", "hing", " ", "the", " ", "standard", " ", "Pyth", "on", " ", "logg", "ing", " ", "interface", " ", "doe", "s_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "not", " ", "allow", " ", "via", " ", "the", " ", "API", "._", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "old", "Log", "ger", "Root_", "=_", "logging_", "._", "root_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logging_", "._", "root_", "=_", "The", "spi", "an", "Log", "Forward", "er_", "(_", "self_", "._", "as", "Logger_", ",_", "self_", "._", "transport_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logging_", "._", "Logger_", "._", "root_", "=_", "logging_", "._", "root_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logging_", "._", "Logger_", "._", "manager_", "=_", "logging_", "._", "Manager_", "(_", "logging_", "._", "Logger_", "._", "root_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logging_", "._", "get", "Logger_", "(_", "'", "The", "spi", "an", ".", "Admi", "n", "'_", ")_", "._", "info_", "(_", "'", "Act", "or", "System", " ", "Administra", "tor", " ", "start", "up", " ", "@", " ", "%", "s", "'_", ",_", "self_", "._", "my", "Address_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "No", "w", " ", "tha", "t", " ", "logg", "ing", " ", "is", " ", "start", "ed", ",", " ", "Admi", "n", " ", "start", "up", " ", "can", " ", "be", " ", "confirmed_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "transport_", "._", "schedule", "Transmit", "_", "(_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Transmit", "Inten", "t_", "(_", "self_", "._", "addr", "Of", "Start", "er_", ",_", "End", "point", "Connected_", "(_", "0_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "activate_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Multi", "Proc", "Replica", "tor_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "h", "\\u", "Log", "Record_", "(_", "self_", ",_", "envelope_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "send", "\\u", "intent_", "(_", "Transmit", "Inten", "t_", "(_", "self_", "._", "as", "Logger_", ",_", "envelope_", "._", "message_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Multi", "Proc", "Replica", "tor_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "handle", "Replica", "tor", "Messages_", "(_", "self_", ",_", "envelope_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "isinstance_", "(_", "envelope_", "._", "message_", ",_", "End", "point", "Connected_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "True_", ",_", "self_", "._", "h", "\\u", "End", "point", "Connected_", "(_", "envelope_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "isinstance_", "(_", "envelope_", "._", "message_", ",_", "logging_", "._", "Log", "Record_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "True_", ",_", "self_", "._", "h", "\\u", "Log", "Record_", "(_", "envelope_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "False_", ",_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Multi", "Proc", "Replica", "tor_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "clean", "up", "Admin_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "getattr_", "(_", "self_", ",_", "'", "as", "Log", "ger", "'_", ",_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "hasattr_", "(_", "self_", ",_", "'", "old", "Log", "ger", "Roo", "t", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logging_", "._", "root_", "=_", "self_", "._", "old", "Log", "ger", "Root_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logging_", "._", "Logger_", "._", "root_", "=_", "self_", "._", "old", "Log", "ger", "Root_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logging_", "._", "Logger_", "._", "manager_", "=_", "logging_", "._", "Manager_", "(_", "logging_", "._", "Logger_", "._", "root_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "transport_", "._", "run_", "(_", "Transmit", "Only_", ",_", "maxim", "um", "Duration_", "=_", "timedelta_", "(_", "milliseconds", "_", "=_", "250_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "time_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "time_", "._", "sleep_", "(_", "0.05_", ")_", "#", " ", "allow", " ", "child", "ren", " ", "to", " ", "exit", " ", "and", " ", "log", " ", "thei", "r", " ", "exit_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "transport_", "._", "schedule", "Transmit", "_", "(_", "None_", ",_", "Transmit", "Inten", "t_", "(_", "self_", "._", "as", "Logger_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Log", "ger", "Exi", "t", "Request_", "(_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "transport_", "._", "run_", "(_", "Transmit", "Only_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "getattr_", "(_", "self_", ",_", "'", "as", "Log", "Proc", "'_", ",_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "\\u", "check", "Chil", "d", "Live", "ness_", "(_", "self_", "._", "as", "Log", "Proc_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "import_", "time_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "time_", "._", "sleep_", "(_", "0.02_", ")_", "#", " ", "wait", " ", "a", " ", "litt", "le", " ", "to", " ", "allow", " ", "logg", "er", " ", "to", " ", "exit_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "check", "Chil", "d", "Live", "ness_", "(_", "self_", "._", "as", "Log", "Proc_", ")_", "#", " ", "clean", "up", " ", "defu", "nct", " ", "proc_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "signal", "\\u", "detector_", "(_", "name_", ",_", "addr_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "signal", "\\u", "detected_", "(_", "signum_", ",_", "frame_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "thes", "plo", "g_", "(_", "'", "Act", "or", " ", "%", "s", " ", "@", " ", "%", "s", " ", "got", " ", "signal", ":", " ", "%", "s", "'_", ",_", "name_", ",_", "addr_", ",_", "signum_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "level_", "=_", "logging_", "._", "WARNING_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Simp", "ly", " ", "exit", ";", " ", "just", " ", "by", " ", "catch", "ing", " ", "the", " ", "signal", " ", "the", " ", "ate", "xit", " ", "handler", "s", " ", "are", " ", "enabled_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "if", " ", "this", " ", "signal", " ", "is", " ", "goi", "ng", " ", "to", " ", "caus", "e", " ", "a", " ", "process", " ", "exit", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "signal", "\\u", "detected_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "shut", "down", "\\u", "signal", "\\u", "detector_", "(_", "name_", ",_", "addr_", ",_", "am_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "shut", "down", "\\u", "signal", "\\u", "detected_", "(_", "signum_", ",_", "frame_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "thes", "plo", "g_", "(_", "'", "Act", "or", " ", "%", "s", " ", "@", " ", "%", "s", " ", "got", " ", "shut", "down", " ", "signal", ":", " ", "%", "s", "'_", ",_", "name_", ",_", "addr_", ",_", "signum_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "level_", "=_", "logging_", "._", "WARNING_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "am_", "._", "transport_", "._", "schedule", "Transmit", "_", "(_", "None_", ",_", "Transmit", "Inten", "t_", "(_", "am_", "._", "transport_", "._", "my", "Address_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Act", "or", "Exi", "t", "Request_", "(_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "shut", "down", "\\u", "signal", "\\u", "detected_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "start", "Child_", "(_", "child", "Class_", ",_", "endpoint_", ",_", "transport", "Class_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "source", "Hash_", ",_", "source", "To", "Load_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "parent", "Addr_", ",_", "admin", "Addr_", ",_", "notif", "y", "Addr_", ",_", "logg", "er", "Addr_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "child", "Requirements", "_", ",_", "current", "System", "Capabilities", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "file", "Num", "s", "To", "Close_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "close", "File", "Num", "s_", "(_", "file", "Num", "s", "To", "Close_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Dirty", " ", "trick", " ", "here", " ", "to", " ", "workar", "ound", " ", "multipro", "cess", "ing", " ", "try", "ing", " ", "to", " ", "impos", "e_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "an", " ", "unne", "cess", "ary", " ", "restriction", ".", " ", " ", "A", " ", "process", " ", "shou", "ld", " ", "be", " ", "set", " ", "daemon", "ic_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "bef", "ore", " ", "start", "()", " ", "if", " ", "the", " ", "parent", " ", "shou", "ld", "n", "'", "t", " ", "track", " ", "it", " ", "(", "an", " ", "specifica", "ll", "y_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "automati", "call", "y", " ", "join", "()", " ", "the", " ", "subproc", "ess", " ", "on", " ", "exit", ").", " ", " ", "For", " ", "Act", "ors", ",", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "parent", " ", "exist", "s", " ", "independent", "ly", " ", "of", " ", "the", " ", "child", " ", "and", " ", "the", " ", "Act", "or", "System_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "manage", "s", " ", "them", ",", " ", "so", " ", "daemon", "ic", " ", "process", "es", " ", "are", " ", "desi", "red", ".", " ", " ", "Ho", "we", "ver", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "multipro", "cess", "ing", " ", "impos", "es", " ", "a", " ", "restriction", " ", "tha", "t", " ", "daemon", "ic", " ", "processes_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "cann", "ot", " ", "create", " ", "more", " ", "process", "es", ".", " ", " ", "The", " ", "follow", "ing", " ", "reache", "s", " ", "deep", " ", "into_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "the", " ", "implementation", " ", "of", " ", "the", " ", "multipro", "cess", "ing", " ", "module", " ", "to", " ", "override_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "tha", "t", " ", "restriction", ".", " ", " ", "Thi", "s", " ", "process", " ", "was", " ", "alr", "ead", "y", " ", "start", "ed", " ", "as", " ", "daemon", "ic", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "and", " ", "it", "'", "s", " ", "detached", " ", "from", " ", "its", " ", "parent", ".", " ", " ", "The", " ", "follow", "ing", " ", "simp", "ly", " ", "clear", "s_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "tha", "t", " ", "flag", " ", "local", "ly", " ", "so", " ", "tha", "t", " ", "other", " ", "process", "es", " ", "can", " ", "be", " ", "created", " ", "from_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "this", " ", "one", "._", "\\u\\u\\uNL\\u\\u\\u_", "multiprocessing_", "._", "process_", "._", "\\u", "current", "\\u", "process_", "._", "\\u", "daemon", "ic_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "transport_", "=_", "transport", "Class_", "(_", "endpoint_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "close", "Un", "used", "Files", "(", "transport", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Dirty", " ", "trick", " ", "here", " ", "to", " ", "complete", "ly", " ", "re", "-", "initialize", " ", "logg", "ing", " ", "in", " ", "this_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "process", "...", " ", "somet", "hing", " ", "the", " ", "standard", " ", "Pyth", "on", " ", "logg", "ing", " ", "interface", " ", "doe", "s_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "not", " ", "allow", " ", "via", " ", "the", " ", "API", ".", " ", " ", "We", " ", "als", "o", " ", "do", " ", "not", " ", "want", " ", "to", " ", "run_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "logg", "ing", ".", "shut", "down", "()", " ", "bec", "aus", "e", " ", "(", "a", ")", " ", "tha", "t", " ", "doe", "s", " ", "not", " ", "do", " ", "eno", "ugh", " ", "to", " ", "reset", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "and", " ", "(", "b", ")", " ", "it", " ", "shut", "s", " ", "down", " ", "handler", "s", ",", " ", "but", " ", "we", " ", "want", " ", "to", " ", "lea", "ve", " ", "the", " ", "parent", "'", "s_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "handler", "s", " ", "alo", "ne", "._", "\\u\\u\\uNL\\u\\u\\u_", "logging_", "._", "root_", "=_", "The", "spi", "an", "Log", "Forward", "er_", "(_", "logg", "er", "Addr_", ",_", "transport_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logging_", "._", "Logger_", "._", "root_", "=_", "logging_", "._", "root_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logging_", "._", "Logger_", "._", "manager_", "=_", "logging_", "._", "Manager_", "(_", "logging_", "._", "Logger_", "._", "root_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "logger_", "=_", "logging_", "._", "get", "Logger_", "(_", "'", "The", "spi", "an", ".", "Act", "or", "Manager", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "am_", "=_", "Multi", "Proc", "Manager_", "(_", "child", "Class_", ",_", "transport_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "source", "Hash_", ",_", "source", "To", "Load_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "parent", "Addr_", ",_", "admin", "Addr_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "child", "Requirements", "_", ",_", "current", "System", "Capabilities", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "am_", "._", "as", "Logger_", "=_", "logg", "er", "Addr_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "am_", "._", "transport_", "._", "schedule", "Transmit", "_", "(_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Transmit", "Inten", "t_", "(_", "notif", "y", "Addr_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "End", "point", "Connected_", "(_", "endpoint_", "._", "addr", "Inst_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "set", "Proc", "Name_", "(_", "getattr_", "(_", "child", "Class_", ",_", "'\\u", "\\u", "name", "\\u\\u'_", ",_", "str_", "(_", "child", "Class_", ")_", ")_", ",_", "am_", "._", "transport_", "._", "my", "Address_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "sig", "handler_", "=_", "signal", "\\u", "detector_", "(_", "getattr_", "(_", "child", "Class_", ",_", "'\\u", "\\u", "name", "\\u\\u'_", ",_", "str_", "(_", "child", "Class_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "am_", "._", "transport_", "._", "my", "Address_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sig", "exit", "handler_", "=_", "shut", "down", "\\u", "signal", "\\u", "detector_", "(_", "getattr_", "(_", "child", "Class_", ",_", "'\\u", "\\u", "name", "\\u\\u'_", ",_", "str_", "(_", "child", "Class_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "am_", "._", "transport_", "._", "my", "Address_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "am_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "each_", "in_", "range_", "(_", "1_", ",_", "signal_", "._", "NS", "IG", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "n", ".", "b", ".", " ", "normal", "ly", " ", "Pyth", "on", " ", "intercept", "s", " ", "SIG", "INT", " ", "to", " ", "turn", " ", "it", " ", "int", "o", " ", "a_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Key", "board", "Interr", "upt", " ", "exception", ".", " ", " ", "Ho", "we", "ver", ",", " ", "these", " ", "Act", "ors", " ", "should_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "be", " ", "detached", " ", "from", " ", "the", " ", "keyb", "oard", ",", " ", "so", " ", "revert", " ", "to", " ", "normal", " ", "SIGINT_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "behavior", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "each_", "not_", "in_", "unca", "tcha", "ble", "\\u", "signals_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "each_", "in_", "child", "\\u", "exit", "\\u", "signals_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "signal_", "._", "signal_", "(_", "each_", ",_", "am_", "._", "child", "Die", "d_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "signal_", "._", "signal_", "(_", "each_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "sig", "exit", "handler_", "if_", "each_", "in_", "exit", "\\u", "signals_", "else_", "sig", "handler_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "(_", "Run", "time", "Error_", ",_", "Value", "Error_", ",_", "Environ", "ment", "Error_", ")_", "as_", "ex_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "OK", ",", " ", "this", " ", "signal", " ", "can", "'", "t", " ", "be", " ", "cau", "ght", " ", "for", " ", "this_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "environ", "ment", ".", " ", " ", "We", " ", "did", " ", "our", " ", "best", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "am_", "._", "run_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Multi", "Proc", "Admin_", "(_", "Multi", "Proc", "Replica", "tor_", ",_", "The", "spi", "an", "Admin_", ")_", ":_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "class_", "Multi", "Proc", "Manager_", "(_", "Multi", "Proc", "Replica", "tor_", ",_", "Act", "or", "Manager_", ")_", ":_", "pass_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,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 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
VisTrails/VisTrails/contrib/itk/Image.py
[ { "content": "############################################################################\n##\n## Copyright (C) 2006-2007 University of Utah. All rights reserved.\n##\n## This file is part of VisTrails.\n##\n## This file may be used under the terms of the GNU General Public\n## License version 2.0 as published by the Free Software Foundation\n## and appearing in the file LICENSE.GPL included in the packaging of\n## this file. Please review the following to ensure GNU General Public\n## Licensing requirements will be met:\n## http://www.opensource.org/licenses/gpl-license.php\n##\n## If you are unsure which license is appropriate for your use (for\n## instance, you are interested in developing a commercial derivative\n## of VisTrails), please contact us at [email protected].\n##\n## This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE\n## WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.\n##\n############################################################################\nimport itk\nimport core.modules\nimport core.modules.module_registry\nfrom core.modules.vistrails_module import Module, ModuleError\nfrom ITK import *\nfrom PixelType import *\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class Image(Module, ITK):\n my_namespace=\"disregard\"\n\n\n\n\n\n\n \n", "metadata": "root.Image", "header": "['module', '___EOS___']", "index": 28 }, { "content": " def getPixelType(self):\n return self._type", "metadata": "root.Image.getPixelType", "header": "['class', 'Image', '(', 'Module', ',', 'ITK', ')', ':', '___EOS___']", "index": 31 }, { "content": " def getDim(self):\n return self.dim", "metadata": "root.Image.getDim", "header": "['class', 'Image', '(', 'Module', ',', 'ITK', ')', ':', '___EOS___']", "index": 34 }, { "content": " def getImg(self):\n return self.inIm", "metadata": "root.Image.getImg", "header": "['class', 'Image', '(', 'Module', ',', 'ITK', ')', ':', '___EOS___']", "index": 37 }, { "content": " def setImg(self, img):\n self.inIm = img", "metadata": "root.Image.setImg", "header": "['class', 'Image', '(', 'Module', ',', 'ITK', ')', ':', '___EOS___']", "index": 40 }, { "content": " def setDim(self, dim):\n self.dim = dim", "metadata": "root.Image.setDim", "header": "['class', 'Image', '(', 'Module', ',', 'ITK', ')', ':', '___EOS___']", "index": 43 }, { "content": " def setPixelType(self, pt):\n self._type = pt", "metadata": "root.Image.setPixelType", "header": "['class', 'Image', '(', 'Module', ',', 'ITK', ')', ':', '___EOS___']", "index": 46 }, { "content": " def compute(self):\n self.inIm = self.get_input(\"Image\")\n self.dim = self.get_input(\"Dimension\")\n self._type = self.get_input(\"Pixel Type\")\n\n self.set_output(\"Output Image\", self)", "metadata": "root.Image.compute", "header": "['class', 'Image', '(', 'Module', ',', 'ITK', ')', ':', '___EOS___']", "index": 49 }, { "content": " @classmethod\n def register(cls, reg, basic):\n reg.add_module(cls, name=\"Image\", namespace=cls.my_namespace)\n reg.add_input_port(cls, \"Pixel Type\", (PixelType, 'Pixel Type'))\n reg.add_input_port(cls, \"Dimension\", (basic.Integer, 'Dimension'))\n reg.add_input_port(cls, \"Image\", (Image, 'Image'))\n\n reg.add_output_port(cls, \"Output Image\", (Image, 'Output Image'))", "metadata": "root.Image.register", "header": "['class', 'Image', '(', 'Module', ',', 'ITK', ')', ':', '___EOS___']", "index": 56 } ]
[ { "span": "import itk", "start_line": 21, "start_column": 0, "end_line": 21, "end_column": 10 }, { "span": "import core.modules", "start_line": 22, "start_column": 0, "end_line": 22, "end_column": 19 }, { "span": "import core.modules.module_registry", "start_line": 23, "start_column": 0, "end_line": 23, "end_column": 35 }, { "span": "from core.modules.vistrails_module import Module, ModuleError", "start_line": 24, "start_column": 0, "end_line": 24, "end_column": 61 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "###########", "###########", "###########", "###########", "###########", "###########", "#########", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "##", "_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "Copy", "right", " ", "(", "C", ")", " ", "2006", "-", "2007", " ", "Univers", "it", "y", " ", "of", " ", "Ut", "ah", ".", " ", "All", " ", "rights", " ", "reserve", "d", "._", "\\u\\u\\uNL\\u\\u\\u_", "##", "_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "Thi", "s", " ", "file", " ", "is", " ", "part", " ", "of", " ", "Vis", "Trail", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "##", "_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "Thi", "s", " ", "file", " ", "may", " ", "be", " ", "used", " ", "under", " ", "the", " ", "term", "s", " ", "of", " ", "the", " ", "GN", "U", " ", "General", " ", "Public", "_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "License", " ", "version", " ", "2.0", " ", "as", " ", "publi", "shed", " ", "by", " ", "the", " ", "Free", " ", "Sof", "twa", "re", " ", "Foun", "dati", "on_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "and", " ", "appear", "ing", " ", "in", " ", "the", " ", "file", " ", "LICENSE", ".", "GP", "L", " ", "include", "d", " ", "in", " ", "the", " ", "packaging", " ", "of_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "this", " ", "file", ".", " ", " ", "Ple", "ase", " ", "review", " ", "the", " ", "follow", "ing", " ", "to", " ", "ensure", " ", "GN", "U", " ", "General", " ", "Public", "_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "Licen", "sing", " ", "require", "ment", "s", " ", "will", " ", "be", " ", "met", ":_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "http", "://", "www", ".", "opens", "ource", ".", "org", "/", "license", "s", "/", "gpl", "-", "license", ".", "php", "_", "\\u\\u\\uNL\\u\\u\\u_", "##", "_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "If", " ", "you", " ", "are", " ", "uns", "ure", " ", "whi", "ch", " ", "license", " ", "is", " ", "appropr", "iate", " ", "for", " ", "your", " ", "use", " ", "(", "for_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "instance", ",", " ", "you", " ", "are", " ", "interest", "ed", " ", "in", " ", "develop", "ing", " ", "a", " ", "commerc", "ial", " ", "derivative_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "of", " ", "Vis", "Trail", "s", "),", " ", "plea", "se", " ", "contact", " ", "us", " ", "at", " ", "contact", "@", "vist", "rail", "s", ".", "org", "._", "\\u\\u\\uNL\\u\\u\\u_", "##", "_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "Thi", "s", " ", "file", " ", "is", " ", "provided", " ", "AS", " ", "IS", " ", "with", " ", "NO", " ", "WAR", "RAN", "TY", " ", "OF", " ", "ANY", " ", "KIND", ",", " ", "INC", "LU", "DING", " ", "THE", "_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "WAR", "RAN", "TY", " ", "OF", " ", "DES", "IGN", ",", " ", "MER", "CHAN", "TAB", "ILI", "TY", " ", "AND", " ", "FIT", "NESS", " ", "FOR", " ", "A", " ", "PARTI", "CUL", "AR", " ", "PUR", "POS", "E", "._", "\\u\\u\\uNL\\u\\u\\u_", "##", "_", "\\u\\u\\uNL\\u\\u\\u_", "###########", "###########", "###########", "###########", "###########", "###########", "#########", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "itk", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "core_", "._", "modules_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "core_", "._", "modules_", "._", "module", "\\u", "registry_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "core_", "._", "modules_", "._", "vist", "rail", "s", "\\u", "module_", "import_", "Module_", ",_", "Modul", "e", "Error_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "IT", "K_", "import_", "*_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "Pix", "el", "Type_", "import_", "*_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Image_", "(_", "Module_", ",_", "IT", "K_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "my", "\\u", "namespace_", "=_", "\"", "dis", "rega", "rd", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Image_", "(_", "Module_", ",_", "IT", "K_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "get", "Pix", "el", "Type_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "\\u", "type_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Image_", "(_", "Module_", ",_", "IT", "K_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "Dim_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "dim_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Image_", "(_", "Module_", ",_", "IT", "K_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "Img_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "in", "Im", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Image_", "(_", "Module_", ",_", "IT", "K_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "set", "Img_", "(_", "self_", ",_", "img_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "in", "Im", "_", "=_", "img_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Image_", "(_", "Module_", ",_", "IT", "K_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "set", "Dim_", "(_", "self_", ",_", "dim_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "dim_", "=_", "dim_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Image_", "(_", "Module_", ",_", "IT", "K_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "set", "Pix", "el", "Type_", "(_", "self_", ",_", "pt_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "type_", "=_", "pt_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Image_", "(_", "Module_", ",_", "IT", "K_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "compute_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "in", "Im", "_", "=_", "self_", "._", "get", "\\u", "input_", "(_", "\"", "Image", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "dim_", "=_", "self_", "._", "get", "\\u", "input_", "(_", "\"", "Dimen", "sion", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "type_", "=_", "self_", "._", "get", "\\u", "input_", "(_", "\"", "Pix", "el", " ", "Type", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "set\\u", "output_", "(_", "\"", "Output", " ", "Image", "\"_", ",_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Image_", "(_", "Module_", ",_", "IT", "K_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "classmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "register_", "(_", "cls_", ",_", "reg_", ",_", "basic_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "reg_", "._", "add", "\\u", "module_", "(_", "cls_", ",_", "name_", "=_", "\"", "Image", "\"_", ",_", "namespace_", "=_", "cls_", "._", "my", "\\u", "namespace_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "reg_", "._", "add", "\\u", "input", "\\u", "port_", "(_", "cls_", ",_", "\"", "Pix", "el", " ", "Type", "\"_", ",_", "(_", "Pix", "el", "Type_", ",_", "'", "Pix", "el", " ", "Type", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "reg_", "._", "add", "\\u", "input", "\\u", "port_", "(_", "cls_", ",_", "\"", "Dimen", "sion", "\"_", ",_", "(_", "basic_", "._", "Integer_", ",_", "'", "Dimen", "sion", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "reg_", "._", "add", "\\u", "input", "\\u", "port_", "(_", "cls_", ",_", "\"", "Image", "\"_", ",_", "(_", "Image_", ",_", "'", "Image", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "reg_", "._", "add", "\\u", "output", "\\u", "port_", "(_", "cls_", ",_", "\"", "Output", " ", "Image", "\"_", ",_", "(_", "Image_", ",_", "'", "Output", " ", "Image", "'_", ")_", ")_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Module is imported more than once
cloudera/hue/desktop/core/ext-py/cx_Oracle-5.1.2/setup.py
[ { "content": "\"\"\"Distutils script for cx_Oracle.\n\nWindows platforms:\n python setup.py build --compiler=mingw32 install\n\nUnix platforms\n python setup.py build install\n\n\"\"\"\n\nimport distutils.command\ntry:\n import distutils.command.bdist_msi\nexcept ImportError:\n distutils.command.bdist_msi = None\ntry:\n import distutils.command.bdist_wininst\nexcept ImportError:\n distutils.command.bdist_wininst = None\nimport distutils.command.bdist_rpm\nimport distutils.command.build\nimport distutils.core\nimport distutils.dist\nimport distutils.util\nimport os\nimport re\nimport struct\nimport sys\n\nfrom distutils.errors import DistutilsSetupError\n\n# if setuptools is detected, use it to add support for eggs\ntry:\n from setuptools import setup, Extension\nexcept:\n from distutils.core import setup\n from distutils.extension import Extension\n\n# define build constants\nBUILD_VERSION = \"5.1.2\"\n\n# define the list of files to be included as documentation for Windows\ndataFiles = None\nif sys.platform in (\"win32\", \"cygwin\"):\n baseName = \"cx_Oracle-doc\"\n dataFiles = [ (baseName,\n [ \"BUILD.txt\", \"LICENSE.TXT\", \"README.TXT\", \"HISTORY.txt\"]) ]\n for dir in (\"html\", \"html/_static\", \"samples\", \"test\"):\n files = []\n fullDirName = \"%s/%s\" % (baseName, dir)\n for name in os.listdir(dir):\n if name.startswith(\".\"):\n continue\n if os.path.isdir(os.path.join(dir, name)):\n continue\n fullName = \"%s/%s\" % (dir, name)\n files.append(fullName)\n dataFiles.append((fullDirName, files))\n\n# define the list of files to be included as documentation for bdist_rpm\ndocFiles = \"LICENSE.txt README.txt BUILD.txt HISTORY.txt html samples test\"\n\n# method for checking a potential Oracle home\n\n# try to determine the Oracle home\nuserOracleHome = os.environ.get(\"ORACLE_HOME\", os.environ.get(\"ORACLE_INSTANTCLIENT_HOME\"))\nif userOracleHome is not None:\n if not CheckOracleHome(userOracleHome):\n messageFormat = \"Oracle home (%s) does not refer to an \" \\\n \"9i, 10g or 11g installation.\"\n raise DistutilsSetupError(messageFormat % userOracleHome)\nelse:\n for path in os.environ[\"PATH\"].split(os.pathsep):\n if CheckOracleHome(path):\n break\n if oracleHome is None:\n print >>sys.stderr, \"cannot locate an Oracle software installation. skipping\"\n sys.exit(0)\n\n# define some variables\nif sys.platform == \"win32\":\n libDirs = [os.path.join(oracleHome, \"bin\"), oracleHome,\n os.path.join(oracleHome, \"oci\", \"lib\", \"msvc\"),\n os.path.join(oracleHome, \"sdk\", \"lib\", \"msvc\")]\n possibleIncludeDirs = [\"oci/include\", \"rdbms/demo\", \"sdk/include\"]\n includeDirs = []\n for dir in possibleIncludeDirs:\n path = os.path.normpath(os.path.join(oracleHome, dir))\n if os.path.isdir(path):\n includeDirs.append(path)\n if not includeDirs:\n message = \"cannot locate Oracle include files in %s\" % oracleHome\n raise DistutilsSetupError(message)\n libs = [\"oci\"]\nelif sys.platform == \"cygwin\":\n includeDirs = [\"/usr/include\", \"rdbms/demo\", \"rdbms/public\", \\\n \"network/public\", \"oci/include\"]\n libDirs = [\"bin\", \"lib\"]\n for i in range(len(includeDirs)):\n includeDirs[i] = os.path.join(oracleHome, includeDirs[i])\n for i in range(len(libDirs)):\n libDirs[i] = os.path.join(oracleHome, libDirs[i])\n libs = [\"oci\"]\nelse:\n libDirs = [oracleLibDir]\n libs = [\"clntsh\"]\n possibleIncludeDirs = [\"rdbms/demo\", \"rdbms/public\", \"network/public\",\n \"sdk/include\"]\n if sys.platform == \"darwin\":\n possibleIncludeDirs.append(\"plsql/public\")\n includeDirs = []\n for dir in possibleIncludeDirs:\n path = os.path.join(oracleHome, dir)\n if os.path.isdir(path):\n includeDirs.append(path)\n if not includeDirs:\n path = os.path.join(oracleLibDir, \"include\")\n if os.path.isdir(path):\n includeDirs.append(path)\n if not includeDirs:\n path = re.sub(\"lib(64)?\", \"include\", oracleHome)\n if os.path.isdir(path):\n includeDirs.append(path)\n if not includeDirs:\n raise DistutilsSetupError(\"cannot locate Oracle include files\")\n\n# NOTE: on HP-UX Itanium with Oracle 10g you need to add the library \"ttsh10\"\n# to the list of libraries along with \"clntsh\"; since I am unable to test, I'll\n# leave this as a comment until someone can verify when this is required\n# without making other cases where sys.platform == \"hp-ux11\" stop working\n\n# setup extra link and compile args\nextraCompileArgs = [\"-DBUILD_VERSION=%s\" % BUILD_VERSION]\nextraLinkArgs = []\nif sys.platform == \"aix4\":\n extraCompileArgs.append(\"-qcpluscmt\")\nelif sys.platform == \"aix5\":\n extraCompileArgs.append(\"-DAIX5\")\nelif sys.platform == \"cygwin\":\n extraCompileArgs.append(\"-mno-cygwin\")\n extraLinkArgs.append(\"-Wl,--enable-runtime-pseudo-reloc\")\nelif sys.platform == \"darwin\":\n extraLinkArgs.append(\"-shared-libgcc\")\n\n# force the inclusion of an RPATH linker directive if desired; this will\n# eliminate the need for setting LD_LIBRARY_PATH but it also means that this\n# location will be the only location searched for the Oracle client library\nif \"FORCE_RPATH\" in os.environ:\n extraLinkArgs.append(\"-Wl,-rpath,%s\" % oracleLibDir)\n\n# tweak distribution full name to include the Oracle version\n\n\n# tweak the RPM build command to include the Python and Oracle version\n\n\n# tweak the build directories to include the Oracle version\n\n\ncommandClasses = dict(build = build, bdist_rpm = bdist_rpm, test = test)\n\n# tweak the Windows installer names to include the Oracle version\nif distutils.command.bdist_msi is not None:\n\n\n commandClasses[\"bdist_msi\"] = bdist_msi\n\nif distutils.command.bdist_wininst is not None:\n\n\n commandClasses[\"bdist_wininst\"] = bdist_wininst\n\n# define classifiers for the package index\nclassifiers = [\n \"Development Status :: 6 - Mature\",\n \"Intended Audience :: Developers\",\n \"License :: OSI Approved :: Python Software Foundation License\",\n \"Natural Language :: English\",\n \"Operating System :: OS Independent\",\n \"Programming Language :: C\",\n \"Programming Language :: Python\",\n \"Programming Language :: Python :: 2\",\n \"Programming Language :: Python :: 3\",\n \"Topic :: Database\"\n]\n\n# setup the extension\nextension = Extension(\n name = \"cx_Oracle\",\n include_dirs = includeDirs,\n libraries = libs,\n library_dirs = libDirs,\n extra_compile_args = extraCompileArgs,\n extra_link_args = extraLinkArgs,\n sources = [\"cx_Oracle.c\"],\n depends = [\"Buffer.c\", \"Callback.c\", \"Connection.c\", \"Cursor.c\",\n \"CursorVar.c\", \"DateTimeVar.c\", \"Environment.c\", \"Error.c\",\n \"ExternalLobVar.c\", \"ExternalObjectVar.c\", \"IntervalVar.c\",\n \"LobVar.c\", \"LongVar.c\", \"NumberVar.c\", \"ObjectType.c\",\n \"ObjectVar.c\", \"SessionPool.c\", \"StringVar.c\",\n \"Subscription.c\", \"TimestampVar.c\", \"Transforms.c\",\n \"Variable.c\"])\n\n# perform the setup\nsetup(\n name = \"cx_Oracle\",\n version = BUILD_VERSION,\n distclass = Distribution,\n description = \"Python interface to Oracle\",\n data_files = dataFiles,\n cmdclass = commandClasses,\n options = dict(bdist_rpm = dict(doc_files = docFiles)),\n long_description = \\\n \"Python interface to Oracle conforming to the Python DB API 2.0 \"\n \"specification.\\n\"\n \"See http://www.python.org/topics/database/DatabaseAPI-2.0.html.\",\n author = \"Anthony Tuininga\",\n author_email = \"[email protected]\",\n url = \"http://cx-oracle.sourceforge.net\",\n ext_modules = [extension],\n keywords = \"Oracle\",\n license = \"Python Software Foundation License\",\n classifiers = classifiers)\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def CheckOracleHome(directoryToCheck):\n global oracleHome, oracleVersion, oracleLibDir\n import os\n import struct\n import sys\n if sys.platform in (\"win32\", \"cygwin\"):\n subDirs = [\"bin\"]\n filesToCheck = [\n (\"11g\", \"oraocci11.dll\"),\n (\"10g\", \"oraocci10.dll\"),\n (\"9i\", \"oraclient9.dll\")\n ]\n elif sys.platform == \"darwin\":\n subDirs = [\"lib\"]\n filesToCheck = [\n (\"11g\", \"libclntsh.dylib.11.1\"),\n (\"10g\", \"libclntsh.dylib.10.1\"),\n (\"9i\", \"libclntsh.dylib.9.0\")\n ]\n else:\n if struct.calcsize(\"P\") == 4:\n subDirs = [\"lib\", \"lib32\"]\n else:\n subDirs = [\"lib\", \"lib64\"]\n filesToCheck = [\n (\"11g\", \"libclntsh.so.11.1\"),\n (\"10g\", \"libclntsh.so.10.1\"),\n (\"9i\", \"libclntsh.so.9.0\")\n ]\n for version, baseFileName in filesToCheck:\n fileName = os.path.join(directoryToCheck, baseFileName)\n if os.path.exists(fileName):\n if os.path.basename(directoryToCheck).lower() == \"bin\":\n oracleHome = os.path.dirname(directoryToCheck)\n else:\n oracleHome = directoryToCheck\n oracleLibDir = directoryToCheck\n oracleVersion = version\n return True\n for subDir in subDirs:\n fileName = os.path.join(directoryToCheck, subDir, baseFileName)\n if os.path.exists(fileName):\n oracleHome = directoryToCheck\n oracleLibDir = os.path.join(directoryToCheck, subDir)\n oracleVersion = version\n return True\n dirName = os.path.dirname(directoryToCheck)\n fileName = os.path.join(dirName, subDir, baseFileName)\n if os.path.exists(fileName):\n oracleHome = dirName\n oracleLibDir = os.path.join(dirName, subDir)\n oracleVersion = version\n return True\n oracleHome = oracleVersion = oracleLibDir = None\n return False", "metadata": "root.CheckOracleHome", "header": "['module', '___EOS___']", "index": 63 }, { "content": " def finalize_options(self):\n import distutils.util\n import os\n import sys\n platSpecifier = \".%s-%s-%s\" % \\\n (distutils.util.get_platform(), sys.version[0:3],\n oracleVersion)\n if self.build_platlib is None:\n self.build_platlib = os.path.join(self.build_base,\n \"lib%s\" % platSpecifier)\n if self.build_temp is None:\n self.build_temp = os.path.join(self.build_base,\n \"temp%s\" % platSpecifier)\n distutils.command.build.build.finalize_options(self)", "metadata": "root.build.finalize_options", "header": "['class', 'build', '(', 'distutils', '.', 'command', '.', 'build', '.', 'build', ')', ':', '___EOS___']", "index": 234 } ]
[ { "span": "import os", "start_line": 65, "start_column": 4, "end_line": 65, "end_column": 13 }, { "span": "import struct", "start_line": 66, "start_column": 4, "end_line": 66, "end_column": 17 }, { "span": "import distutils.util", "start_line": 235, "start_column": 8, "end_line": 235, "end_column": 29 }, { "span": "import os", "start_line": 236, "start_column": 8, "end_line": 236, "end_column": 17 } ]
[ { "span": "import distutils.util", "start_line": 23, "start_column": 0, "end_line": 23, "end_column": 21 }, { "span": "import os", "start_line": 24, "start_column": 0, "end_line": 24, "end_column": 9 }, { "span": "import struct", "start_line": 26, "start_column": 0, "end_line": 26, "end_column": 13 } ]
1
true
[ "[CLS]_", "Module_", "is_", "imported_", "more_", "than_", "once_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\"\"\"", "Dist", "util", "s", " ", "script", " ", "for", " ", "cx", "\\u", "Ora", "cle", ".", "\\", "10", ";", "\\", "10", ";", "Window", "s", " ", "platform", "s", ":", "\\", "10", ";", " ", " ", " ", " ", "python", " ", "setup", ".", "py", " ", "build", " ", "--", "compiler", "=", "ming", "w3", "2", " ", "install", "\\", "10", ";", "\\", "10", ";", "Uni", "x", " ", "platform", "s", "\\", "10", ";", " ", " ", " ", " ", "python", " ", "setup", ".", "py", " ", "build", " ", "install", "\\", "10", ";", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "distutils_", "._", "command_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "distutils_", "._", "command_", "._", "bdist", "\\u", "msi", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Import", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "distutils_", "._", "command_", "._", "bdist", "\\u", "msi", "_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "distutils_", "._", "command_", "._", "bdist", "\\u", "win", "inst_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Import", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "distutils_", "._", "command_", "._", "bdist", "\\u", "win", "inst_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "import_", "distutils_", "._", "command_", "._", "bdist", "\\u", "rpm_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "distutils_", "._", "command_", "._", "build_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "distutils_", "._", "core_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "distutils_", "._", "dist_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "distutils_", "._", "util_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "re_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "struct_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "distutils_", "._", "errors_", "import_", "Dist", "util", "s", "Set", "up", "Error_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "if", " ", "setup", "tool", "s", " ", "is", " ", "detect", "ed", ",", " ", "use", " ", "it", " ", "to", " ", "add", " ", "support", " ", "for", " ", "egg", "s_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "setuptools_", "import_", "setup_", ",_", "Extension_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "distutils_", "._", "core_", "import_", "setup_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "distutils_", "._", "extension_", "import_", "Extension_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "defin", "e", " ", "build", " ", "constants_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "BUILD", "\\u", "VERSION_", "=_", "\"", "5.1", ".2", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "defin", "e", " ", "the", " ", "list", " ", "of", " ", "files", " ", "to", " ", "be", " ", "include", "d", " ", "as", " ", "documentation", " ", "for", " ", "Windows_", "\\u\\u\\uNL\\u\\u\\u_", "data", "Files_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "sys_", "._", "platform_", "in_", "(_", "\"", "win32", "\"_", ",_", "\"", "cyg", "win", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "base", "Name_", "=_", "\"", "cx", "\\u", "Ora", "cle", "-", "doc", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data", "Files_", "=_", "[_", "(_", "base", "Name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "\"", "BUILD", ".", "txt", "\"_", ",_", "\"", "LICENSE", ".", "TXT", "\"_", ",_", "\"", "READ", "ME", ".", "TXT", "\"_", ",_", "\"", "HISTORY", ".", "txt", "\"_", "]_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "dir_", "in_", "(_", "\"", "html", "\"_", ",_", "\"", "html", "/\\u", "static", "\"_", ",_", "\"", "samples", "\"_", ",_", "\"", "test", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "files_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "full", "Dir", "Name_", "=_", "\"%", "s", "/", "%", "s", "\"_", "%_", "(_", "base", "Name_", ",_", "dir_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "name_", "in_", "os_", "._", "listdir_", "(_", "dir_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "name_", "._", "startswith_", "(_", "\".\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "os_", "._", "path_", "._", "isdir_", "(_", "os_", "._", "path_", "._", "join_", "(_", "dir_", ",_", "name_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "full", "Name_", "=_", "\"%", "s", "/", "%", "s", "\"_", "%_", "(_", "dir_", ",_", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "files_", "._", "append_", "(_", "full", "Name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "data", "Files_", "._", "append_", "(_", "(_", "full", "Dir", "Name_", ",_", "files_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "defin", "e", " ", "the", " ", "list", " ", "of", " ", "files", " ", "to", " ", "be", " ", "include", "d", " ", "as", " ", "documentation", " ", "for", " ", "bdist", "\\u", "rpm_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "doc", "Files_", "=_", "\"", "LICENSE", ".", "txt", " ", "READ", "ME", ".", "txt", " ", "BUILD", ".", "txt", " ", "HISTORY", ".", "txt", " ", "html", " ", "samples", " ", "test", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "method", " ", "for", " ", "checking", " ", "a", " ", "potenti", "al", " ", "Ora", "cle", " ", "home_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "try", " ", "to", " ", "dete", "rmin", "e", " ", "the", " ", "Ora", "cle", " ", "home_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "user", "Ora", "cle", "Home_", "=_", "os_", "._", "environ_", "._", "get_", "(_", "\"", "ORA", "CLE", "\\u", "HOM", "E", "\"_", ",_", "os_", "._", "environ_", "._", "get_", "(_", "\"", "ORA", "CLE", "\\u", "INSTA", "NT", "CLIENT", "\\u", "HOM", "E", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "user", "Ora", "cle", "Home_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "Check", "Ora", "cle", "Home_", "(_", "user", "Ora", "cle", "Home_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "message", "Format_", "=_", "\"", "Ora", "cle", " ", "home", " ", "(%", "s", ")", " ", "doe", "s", " ", "not", " ", "refer", " ", "to", " ", "an", " ", "\"_", "\"", "9", "i", ",", " ", "10", "g", " ", "or", " ", "11", "g", " ", "installation", ".\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "Dist", "util", "s", "Set", "up", "Error_", "(_", "message", "Format_", "%_", "user", "Ora", "cle", "Home_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "path_", "in_", "os_", "._", "environ_", "[_", "\"", "PATH", "\"_", "]_", "._", "split_", "(_", "os_", "._", "pathsep_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "Check", "Ora", "cle", "Home_", "(_", "path_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "oracle", "Home_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", ">>_", "sys_", "._", "stderr_", ",_", "\"", "cann", "ot", " ", "locat", "e", " ", "an", " ", "Ora", "cle", " ", "software", " ", "installation", ".", " ", "skip", "ping", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "exit_", "(_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "defin", "e", " ", "some", " ", "variables_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "sys_", "._", "platform_", "==_", "\"", "win32", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "lib", "Dirs_", "=_", "[_", "os_", "._", "path_", "._", "join_", "(_", "oracle", "Home_", ",_", "\"", "bin", "\"_", ")_", ",_", "oracle", "Home_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "os_", "._", "path_", "._", "join_", "(_", "oracle", "Home_", ",_", "\"", "oci", "\"_", ",_", "\"", "lib", "\"_", ",_", "\"", "msvc", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "os_", "._", "path_", "._", "join_", "(_", "oracle", "Home_", ",_", "\"", "sd", "k", "\"_", ",_", "\"", "lib", "\"_", ",_", "\"", "msvc", "\"_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "possib", "le", "Include", "Dirs_", "=_", "[_", "\"", "oci", "/", "include", "\"_", ",_", "\"", "rdb", "ms", "/", "demo", "\"_", ",_", "\"", "sd", "k", "/", "include", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "include", "Dirs_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "dir_", "in_", "possib", "le", "Include", "Dirs_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "path_", "=_", "os_", "._", "path_", "._", "normpath_", "(_", "os_", "._", "path_", "._", "join_", "(_", "oracle", "Home_", ",_", "dir_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "os_", "._", "path_", "._", "isdir_", "(_", "path_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "include", "Dirs_", "._", "append_", "(_", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "include", "Dirs_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "message_", "=_", "\"", "cann", "ot", " ", "locat", "e", " ", "Ora", "cle", " ", "include", " ", "files", " ", "in", " ", "%", "s", "\"_", "%_", "oracle", "Home_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "Dist", "util", "s", "Set", "up", "Error_", "(_", "message_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "libs_", "=_", "[_", "\"", "oci", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "sys_", "._", "platform_", "==_", "\"", "cyg", "win", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "include", "Dirs_", "=_", "[_", "\"/", "usr", "/", "include", "\"_", ",_", "\"", "rdb", "ms", "/", "demo", "\"_", ",_", "\"", "rdb", "ms", "/", "public", "\"_", ",_", "\"", "network", "/", "public", "\"_", ",_", "\"", "oci", "/", "include", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lib", "Dirs_", "=_", "[_", "\"", "bin", "\"_", ",_", "\"", "lib", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", "in_", "range_", "(_", "len_", "(_", "include", "Dirs_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "include", "Dirs_", "[_", "i_", "]_", "=_", "os_", "._", "path_", "._", "join_", "(_", "oracle", "Home_", ",_", "include", "Dirs_", "[_", "i_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "i_", "in_", "range_", "(_", "len_", "(_", "lib", "Dirs_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "lib", "Dirs_", "[_", "i_", "]_", "=_", "os_", "._", "path_", "._", "join_", "(_", "oracle", "Home_", ",_", "lib", "Dirs_", "[_", "i_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "libs_", "=_", "[_", "\"", "oci", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "lib", "Dirs_", "=_", "[_", "oracle", "Lib", "Dir_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "libs_", "=_", "[_", "\"", "cln", "tsh", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "possib", "le", "Include", "Dirs_", "=_", "[_", "\"", "rdb", "ms", "/", "demo", "\"_", ",_", "\"", "rdb", "ms", "/", "public", "\"_", ",_", "\"", "network", "/", "public", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "sd", "k", "/", "include", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "sys_", "._", "platform_", "==_", "\"", "dar", "win", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "possib", "le", "Include", "Dirs_", "._", "append_", "(_", "\"", "pls", "ql", "/", "public", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "include", "Dirs_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "dir_", "in_", "possib", "le", "Include", "Dirs_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "path_", "=_", "os_", "._", "path_", "._", "join_", "(_", "oracle", "Home_", ",_", "dir_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "os_", "._", "path_", "._", "isdir_", "(_", "path_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "include", "Dirs_", "._", "append_", "(_", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "include", "Dirs_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "path_", "=_", "os_", "._", "path_", "._", "join_", "(_", "oracle", "Lib", "Dir_", ",_", "\"", "include", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "os_", "._", "path_", "._", "isdir_", "(_", "path_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "include", "Dirs_", "._", "append_", "(_", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "include", "Dirs_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "path_", "=_", "re_", "._", "sub_", "(_", "\"", "lib", "(", "64", ")?", "\"_", ",_", "\"", "include", "\"_", ",_", "oracle", "Home_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "os_", "._", "path_", "._", "isdir_", "(_", "path_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "include", "Dirs_", "._", "append_", "(_", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "include", "Dirs_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Dist", "util", "s", "Set", "up", "Error_", "(_", "\"", "cann", "ot", " ", "locat", "e", " ", "Ora", "cle", " ", "include", " ", "files", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "NOTE", ":", " ", "on", " ", "HP", "-", "UX", " ", "It", "ani", "um", " ", "with", " ", "Ora", "cle", " ", "10", "g", " ", "you", " ", "need", " ", "to", " ", "add", " ", "the", " ", "librar", "y", " ", "\"", "tts", "h1", "0", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "to", " ", "the", " ", "list", " ", "of", " ", "librar", "ies", " ", "along", " ", "with", " ", "\"", "cln", "tsh", "\";", " ", "sinc", "e", " ", "I", " ", "am", " ", "una", "ble", " ", "to", " ", "test", ",", " ", "I", "'", "ll_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "lea", "ve", " ", "this", " ", "as", " ", "a", " ", "comment", " ", "unti", "l", " ", "some", "one", " ", "can", " ", "verify", " ", "whe", "n", " ", "this", " ", "is", " ", "required_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "with", "out", " ", "mak", "ing", " ", "other", " ", "case", "s", " ", "where", " ", "sys", ".", "platform", " ", "==", " ", "\"", "hp", "-", "ux", "11", "\"", " ", "stop", " ", "working", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "setup", " ", "extra", " ", "link", " ", "and", " ", "compile", " ", "args_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "extra", "Compil", "e", "Args_", "=_", "[_", "\"-", "DB", "UI", "LD", "\\u", "VERSI", "ON", "=", "%", "s", "\"_", "%_", "BUILD", "\\u", "VERSION_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "extra", "Link", "Args_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "sys_", "._", "platform_", "==_", "\"", "ai", "x4", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "extra", "Compil", "e", "Args_", "._", "append_", "(_", "\"-", "qc", "plus", "cmt", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "sys_", "._", "platform_", "==_", "\"", "ai", "x5", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "extra", "Compil", "e", "Args_", "._", "append_", "(_", "\"-", "DAI", "X", "5", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "sys_", "._", "platform_", "==_", "\"", "cyg", "win", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "extra", "Compil", "e", "Args_", "._", "append_", "(_", "\"-", "mn", "o", "-", "cyg", "win", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "extra", "Link", "Args_", "._", "append_", "(_", "\"-", "Wl", ",-", "-", "enable", "-", "runt", "ime", "-", "pseudo", "-", "relo", "c", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "sys_", "._", "platform_", "==_", "\"", "dar", "win", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "extra", "Link", "Args_", "._", "append_", "(_", "\"-", "shared", "-", "libg", "cc", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "force", " ", "the", " ", "inclusion", " ", "of", " ", "an", " ", "RPA", "TH", " ", "linker", " ", "directive", " ", "if", " ", "desi", "red", ";", " ", "this", " ", "will", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "eliminat", "e", " ", "the", " ", "need", " ", "for", " ", "setti", "ng", " ", "LD", "\\u", "LIBRARY", "\\u", "PATH", " ", "but", " ", "it", " ", "als", "o", " ", "means", " ", "tha", "t", " ", "this_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "location", " ", "will", " ", "be", " ", "the", " ", "only", " ", "location", " ", "searche", "d", " ", "for", " ", "the", " ", "Ora", "cle", " ", "client", " ", "library_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "\"", "FORCE", "\\u", "RPA", "TH", "\"_", "in_", "os_", "._", "environ_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "extra", "Link", "Args_", "._", "append_", "(_", "\"-", "Wl", ",-", "rpath", ",%", "s", "\"_", "%_", "oracle", "Lib", "Dir_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "tweak", " ", "distribu", "tion", " ", "full", " ", "name", " ", "to", " ", "include", " ", "the", " ", "Ora", "cle", " ", "version_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "tweak", " ", "the", " ", "RPM", " ", "build", " ", "command", " ", "to", " ", "include", " ", "the", " ", "Pyth", "on", " ", "and", " ", "Ora", "cle", " ", "version_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "tweak", " ", "the", " ", "build", " ", "director", "ies", " ", "to", " ", "include", " ", "the", " ", "Ora", "cle", " ", "version_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "command", "Classes_", "=_", "dict_", "(_", "build_", "=_", "build_", ",_", "bdist", "\\u", "rpm_", "=_", "bdist", "\\u", "rpm_", ",_", "test_", "=_", "test_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "tweak", " ", "the", " ", "Window", "s", " ", "installer", " ", "names", " ", "to", " ", "include", " ", "the", " ", "Ora", "cle", " ", "version_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "distutils_", "._", "command_", "._", "bdist", "\\u", "msi", "_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "command", "Classes_", "[_", "\"", "bdist", "\\u", "msi", "\"_", "]_", "=_", "bdist", "\\u", "msi", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "distutils_", "._", "command_", "._", "bdist", "\\u", "win", "inst_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "command", "Classes_", "[_", "\"", "bdist", "\\u", "win", "inst", "\"_", "]_", "=_", "bdist", "\\u", "win", "inst_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "defin", "e", " ", "classif", "iers", " ", "for", " ", "the", " ", "package", " ", "index_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "classifiers_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Dev", "elo", "pme", "nt", " ", "Status", " ", "::", " ", "6", " ", "-", " ", "Mat", "ure", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Inten", "ded", " ", "Audi", "ence", " ", "::", " ", "Dev", "elope", "rs", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "License", " ", "::", " ", "OSI", " ", "Appro", "ved", " ", "::", " ", "Pyth", "on", " ", "Sof", "twa", "re", " ", "Foun", "dati", "on", " ", "License", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Nat", "ural", " ", "Lang", "ua", "ge", " ", "::", " ", "Eng", "lish", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Opera", "ting", " ", "System", " ", "::", " ", "OS", " ", "Inde", "pend", "ent", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Programm", "ing", " ", "Lang", "ua", "ge", " ", "::", " ", "C", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Programm", "ing", " ", "Lang", "ua", "ge", " ", "::", " ", "Pyth", "on", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Programm", "ing", " ", "Lang", "ua", "ge", " ", "::", " ", "Pyth", "on", " ", "::", " ", "2", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Programm", "ing", " ", "Lang", "ua", "ge", " ", "::", " ", "Pyth", "on", " ", "::", " ", "3", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Topic", " ", "::", " ", "Databa", "se", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "setup", " ", "the", " ", "extension_", "\\u\\u\\uNL\\u\\u\\u_", "extension_", "=_", "Extension_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "name_", "=_", "\"", "cx", "\\u", "Ora", "cle", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "include", "\\u", "dirs_", "=_", "include", "Dirs_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "libraries_", "=_", "libs_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "librar", "y", "\\u", "dirs_", "=_", "lib", "Dirs_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "extra", "\\u", "compile", "\\u", "args_", "=_", "extra", "Compil", "e", "Args_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "extra", "\\u", "link", "\\u", "args_", "=_", "extra", "Link", "Args_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "sources_", "=_", "[_", "\"", "cx", "\\u", "Ora", "cle", ".", "c", "\"_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "depends_", "=_", "[_", "\"", "Buffer", ".", "c", "\"_", ",_", "\"", "Call", "back", ".", "c", "\"_", ",_", "\"", "Connect", "ion", ".", "c", "\"_", ",_", "\"", "Curs", "or", ".", "c", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Curs", "or", "Var", ".", "c", "\"_", ",_", "\"", "Date", "Time", "Var", ".", "c", "\"_", ",_", "\"", "Environ", "ment", ".", "c", "\"_", ",_", "\"", "Error", ".", "c", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Exter", "nal", "Lo", "b", "Var", ".", "c", "\"_", ",_", "\"", "Exter", "nal", "Object", "Var", ".", "c", "\"_", ",_", "\"", "Interv", "al", "Var", ".", "c", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Lo", "b", "Var", ".", "c", "\"_", ",_", "\"", "Long", "Var", ".", "c", "\"_", ",_", "\"", "Number", "Var", ".", "c", "\"_", ",_", "\"", "Object", "Type", ".", "c", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Object", "Var", ".", "c", "\"_", ",_", "\"", "Sess", "ion", "Poo", "l", ".", "c", "\"_", ",_", "\"", "String", "Var", ".", "c", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Subscription", ".", "c", "\"_", ",_", "\"", "Timest", "amp", "Var", ".", "c", "\"_", ",_", "\"", "Transforms", ".", "c", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Varia", "ble", ".", "c", "\"_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "perform", " ", "the", " ", "setup_", "\\u\\u\\uNL\\u\\u\\u_", "setup_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "name_", "=_", "\"", "cx", "\\u", "Ora", "cle", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "version_", "=_", "BUILD", "\\u", "VERSION_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "dist", "class_", "=_", "Distribution_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "description_", "=_", "\"", "Pyth", "on", " ", "interface", " ", "to", " ", "Ora", "cle", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "data\\u", "files_", "=_", "data", "Files_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "cmdclass_", "=_", "command", "Classes_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "options_", "=_", "dict_", "(_", "bdist", "\\u", "rpm_", "=_", "dict_", "(_", "doc", "\\u", "files_", "=_", "doc", "Files_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "long", "\\u", "description_", "=_", "\"", "Pyth", "on", " ", "interface", " ", "to", " ", "Ora", "cle", " ", "conform", "ing", " ", "to", " ", "the", " ", "Pyth", "on", " ", "DB", " ", "API", " ", "2.0", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "specifica", "tion", ".\\\\", "n", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "See", " ", "http", "://", "www", ".", "python", ".", "org", "/", "topic", "s", "/", "databa", "se", "/", "Databa", "se", "API", "-", "2.0", ".", "html", ".\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "author_", "=_", "\"", "Ant", "hon", "y", " ", "Tu", "inin", "ga", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "author", "\\u", "email_", "=_", "\"", "ant", "hon", "y", ".", "tui", "ning", "a", "@", "gma", "il", ".", "com", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "url_", "=_", "\"", "http", "://", "cx", "-", "oracle", ".", "sourcef", "org", "e", ".", "net", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "ext", "\\u", "modules_", "=_", "[_", "extension_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "keywords_", "=_", "\"", "Ora", "cle", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "license_", "=_", "\"", "Pyth", "on", " ", "Sof", "twa", "re", " ", "Foun", "dati", "on", " ", "License", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "classifiers_", "=_", "classifiers_", ")_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "Check", "Ora", "cle", "Home_", "(_", "director", "y", "To", "Check_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "global_", "oracle", "Home_", ",_", "oracle", "Version_", ",_", "oracle", "Lib", "Dir_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "struct_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "sys_", "._", "platform_", "in_", "(_", "\"", "win32", "\"_", ",_", "\"", "cyg", "win", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sub", "Dirs_", "=_", "[_", "\"", "bin", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "files", "To", "Check_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "\"", "11", "g", "\"_", ",_", "\"", "ora", "occ", "i1", "1", ".", "dll", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "\"", "10", "g", "\"_", ",_", "\"", "ora", "occ", "i1", "0.", "dll", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "\"", "9", "i", "\"_", ",_", "\"", "ora", "client", "9", ".", "dll", "\"_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "sys_", "._", "platform_", "==_", "\"", "dar", "win", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sub", "Dirs_", "=_", "[_", "\"", "lib", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "files", "To", "Check_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "\"", "11", "g", "\"_", ",_", "\"", "libc", "ln", "tsh", ".", "dylib", ".1", "1.1", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "\"", "10", "g", "\"_", ",_", "\"", "libc", "ln", "tsh", ".", "dylib", ".1", "0.", "1", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "\"", "9", "i", "\"_", ",_", "\"", "libc", "ln", "tsh", ".", "dylib", ".9", ".0", "\"_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "struct_", "._", "calcsize_", "(_", "\"", "P", "\"_", ")_", "==_", "4_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sub", "Dirs_", "=_", "[_", "\"", "lib", "\"_", ",_", "\"", "lib", "32", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sub", "Dirs_", "=_", "[_", "\"", "lib", "\"_", ",_", "\"", "lib", "64", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "files", "To", "Check_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "\"", "11", "g", "\"_", ",_", "\"", "libc", "ln", "tsh", ".", "so", ".1", "1.1", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "\"", "10", "g", "\"_", ",_", "\"", "libc", "ln", "tsh", ".", "so", ".1", "0.", "1", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "\"", "9", "i", "\"_", ",_", "\"", "libc", "ln", "tsh", ".", "so", ".9", ".0", "\"_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "version_", ",_", "base", "File", "Name_", "in_", "files", "To", "Check_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "file", "Name_", "=_", "os_", "._", "path_", "._", "join_", "(_", "director", "y", "To", "Check_", ",_", "base", "File", "Name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "os_", "._", "path_", "._", "exists_", "(_", "file", "Name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "os_", "._", "path_", "._", "basename_", "(_", "director", "y", "To", "Check_", ")_", "._", "lower_", "(_", ")_", "==_", "\"", "bin", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "oracle", "Home_", "=_", "os_", "._", "path_", "._", "dirname_", "(_", "director", "y", "To", "Check_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "oracle", "Home_", "=_", "director", "y", "To", "Check_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "oracle", "Lib", "Dir_", "=_", "director", "y", "To", "Check_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "oracle", "Version_", "=_", "version_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "sub", "Dir_", "in_", "sub", "Dirs_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "file", "Name_", "=_", "os_", "._", "path_", "._", "join_", "(_", "director", "y", "To", "Check_", ",_", "sub", "Dir_", ",_", "base", "File", "Name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "os_", "._", "path_", "._", "exists_", "(_", "file", "Name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "oracle", "Home_", "=_", "director", "y", "To", "Check_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "oracle", "Lib", "Dir_", "=_", "os_", "._", "path_", "._", "join_", "(_", "director", "y", "To", "Check_", ",_", "sub", "Dir_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "oracle", "Version_", "=_", "version_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "dir", "Name_", "=_", "os_", "._", "path_", "._", "dirname_", "(_", "director", "y", "To", "Check_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "file", "Name_", "=_", "os_", "._", "path_", "._", "join_", "(_", "dir", "Name_", ",_", "sub", "Dir_", ",_", "base", "File", "Name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "os_", "._", "path_", "._", "exists_", "(_", "file", "Name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "oracle", "Home_", "=_", "dir", "Name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "oracle", "Lib", "Dir_", "=_", "os_", "._", "path_", "._", "join_", "(_", "dir", "Name_", ",_", "sub", "Dir_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "oracle", "Version_", "=_", "version_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "oracle", "Home_", "=_", "oracle", "Version_", "=_", "oracle", "Lib", "Dir_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "build_", "(_", "distutils_", "._", "command_", "._", "build_", "._", "build_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "finalize", "\\u", "options_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "distutils_", "._", "util_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "plat", "Specifie", "r_", "=_", "\".", "%", "s", "-%", "s", "-%", "s", "\"_", "%_", "(_", "distutils_", "._", "util_", "._", "get", "\\u", "platform_", "(_", ")_", ",_", "sys_", "._", "version_", "[_", "0_", ":_", "3_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "oracle", "Version_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "build", "\\u", "plat", "lib_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "build", "\\u", "plat", "lib_", "=_", "os_", "._", "path_", "._", "join_", "(_", "self_", "._", "build", "\\u", "base_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "lib", "%", "s", "\"_", "%_", "plat", "Specifie", "r_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "build", "\\u", "temp_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "build", "\\u", "temp_", "=_", "os_", "._", "path_", "._", "join_", "(_", "self_", "._", "build", "\\u", "base_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "temp", "%", "s", "\"_", "%_", "plat", "Specifie", "r_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "distutils_", "._", "command_", "._", "build_", "._", "build_", "._", "finalize", "\\u", "options_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 1, 1, 1, 2, 3, 1, 2, 2, 2, 2, 3, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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omancer/views.py
[ { "content": "from flask import Blueprint, make_response, request, redirect, url_for, \\\n session, render_template, current_app, send_from_directory, flash\nimport json\nimport sys\nimport os\nimport gzip\nimport requests\nfrom uuid import uuid4\nfrom werkzeug import secure_filename\nfrom csvkit import convert\nfrom csvkit.unicsv import UnicodeCSVReader\nfrom csvkit.cleanup import RowChecker\nfrom cStringIO import StringIO\nfrom geomancer.helpers import import_class, get_geo_types, get_data_sources, \\\n guess_geotype, check_combos, SENSICAL_TYPES\nfrom geomancer.app_config import ALLOWED_EXTENSIONS, \\\n MAX_CONTENT_LENGTH\nfrom werkzeug.exceptions import RequestEntityTooLarge\n\nviews = Blueprint('views', __name__)\n\n\n# primary pages\n\n\n\n\n\n\n# routes for geomancin'\n\n\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def allowed_file(filename):\n return '.' in filename and \\\n filename.rsplit('.', 1)[1] in ALLOWED_EXTENSIONS", "metadata": "root.allowed_file", "header": "['module', '___EOS___']", "index": 21 }, { "content": "@views.route('/', methods=['GET', 'POST'])\ndef index():\n return render_template('index.html')", "metadata": "root.index", "header": "['module', '___EOS___']", "index": 26 }, { "content": "@views.route('/about', methods=['GET', 'POST'])\ndef about():\n return render_template('about.html')", "metadata": "root.about", "header": "['module', '___EOS___']", "index": 30 }, { "content": "@views.route('/upload-formats', methods=['GET', 'POST'])\ndef upload_formats():\n return render_template('upload-formats.html')", "metadata": "root.upload_formats", "header": "['module', '___EOS___']", "index": 34 }, { "content": "@views.route('/contribute-data', methods=['GET', 'POST'])\ndef contribute_data():\n return render_template('contribute-data.html')", "metadata": "root.contribute_data", "header": "['module', '___EOS___']", "index": 38 }, { "content": "@views.route('/geographies', methods=['GET', 'POST'])\ndef geographies():\n geographies, errors = get_geo_types()\n for error in errors:\n flash(error)\n return render_template('geographies.html', geographies=geographies)", "metadata": "root.geographies", "header": "['module', '___EOS___']", "index": 42 }, { "content": "@views.route('/data-sources', methods=['GET', 'POST'])\ndef data_sources():\n data_sources, errors = get_data_sources()\n for error in errors:\n flash(error)\n return render_template('data-sources.html', data_sources=data_sources)", "metadata": "root.data_sources", "header": "['module', '___EOS___']", "index": 49 }, { "content": "@views.route('/upload/', methods=['GET', 'POST'])\ndef upload():\n context = {}\n if request.method == 'POST':\n big_file = False\n try:\n files = request.files\n except RequestEntityTooLarge, e:\n files = None\n big_file = True\n current_app.logger.info(e)\n if files:\n f = files['input_file']\n if allowed_file(f.filename):\n inp = StringIO(f.read())\n file_format = convert.guess_format(f.filename)\n try:\n converted = convert.convert(inp, file_format)\n except UnicodeDecodeError:\n context['errors'] = ['We had a problem with reading your file. \\\n This could have to do with the file encoding or format']\n converted = None\n f.seek(0)\n if converted:\n outp = StringIO(converted)\n reader = UnicodeCSVReader(outp)\n session['header_row'] = reader.next()\n rows = []\n columns = [[] for c in session['header_row']]\n column_ids = range(len(session['header_row']))\n for row in range(100):\n try:\n rows.append(reader.next())\n except StopIteration:\n break\n for i, row in enumerate(rows):\n for j,d in enumerate(row):\n columns[j].append(row[column_ids[j]])\n sample_data = []\n guesses = {}\n for index, header_val in enumerate(session['header_row']):\n guesses[index] = guess_geotype(header_val, columns[index])\n sample_data.append((index, header_val, columns[index]))\n session['sample_data'] = sample_data\n session['guesses'] = json.dumps(guesses)\n outp.seek(0)\n session['file'] = outp.getvalue()\n session['filename'] = f.filename\n return redirect(url_for('views.select_geo'))\n else:\n context['errors'] = ['Only .xls or .xlsx and .csv files are allowed.']\n else:\n context['errors'] = ['You must provide a file to upload.']\n if big_file:\n context['errors'] = ['Uploaded file must be 10mb or less.'] \n return render_template('upload.html', **context)", "metadata": "root.upload", "header": "['module', '___EOS___']", "index": 57 }, { "content": "@views.route('/select-geography/', methods=['GET', 'POST'])\ndef select_geo():\n if not session.get('file'):\n return redirect(url_for('views.index'))\n context = {}\n if request.method == 'POST':\n inp = StringIO(session['file'])\n reader = UnicodeCSVReader(inp)\n header = reader.next()\n fields = {}\n valid = True\n geotype_val = None\n if not request.form:\n valid = False\n context['errors'] = ['Select a field that contains a geography type']\n else:\n geotypes = []\n indexes = []\n for k,v in request.form.items():\n if k.startswith(\"geotype\"):\n geotypes.append(v)\n indexes.append(k.split('_')[1])\n if len(indexes) > 2:\n valid = False\n context['errors'] = ['We can only merge geographic information from 2 columns']\n else:\n fields_key = ';'.join([header[int(i)] for i in indexes])\n geotype_val = ';'.join([g for g in geotypes])\n if not check_combos(geotype_val):\n valid = False\n types = [t.title() for t in geotype_val.split(';')]\n context['errors'] = ['The geographic combination of {0} and {1} does not work'.format(*types)]\n else:\n fields[fields_key] = {\n 'geo_type': geotype_val,\n 'column_index': ';'.join(indexes)\n }\n\n # found_geo_type = get_geo_types(geo_type)[0]['info']\n # sample_list = session['sample_data'][index][2]\n # valid, message = found_geo_type.validate(sample_list)\n # context['errors'] = [message]\n if valid:\n try:\n geo_type = SENSICAL_TYPES[geotype_val]\n except KeyError:\n geo_type = geotype_val\n mancer_data, errors = get_data_sources(geo_type=geo_type)\n session['fields'] = fields\n session['mancer_data'] = mancer_data\n for error in errors:\n flash(error)\n return redirect(url_for('views.select_tables'))\n return render_template('select_geo.html', **context)", "metadata": "root.select_geo", "header": "['module', '___EOS___']", "index": 114 }, { "content": "@views.route('/select-tables/', methods=['POST', 'GET'])\ndef select_tables():\n if not session.get('file'):\n return redirect(url_for('views.index'))\n context = {}\n if request.method == 'POST' and not request.form:\n valid = False\n context['errors'] = ['Select at least on table to join to your spreadsheet']\n return render_template('select_tables.html', **context)", "metadata": "root.select_tables", "header": "['module', '___EOS___']", "index": 169 }, { "content": "@views.route('/geomance/<session_key>/')\ndef geomance_view(session_key):\n return render_template('geomance.html', session_key=session_key)", "metadata": "root.geomance_view", "header": "['module', '___EOS___']", "index": 179 }, { "content": "@views.route('/download/<path:filename>')\ndef download_results(filename):\n return send_from_directory(current_app.config['RESULT_FOLDER'], filename)", "metadata": "root.download_results", "header": "['module', '___EOS___']", "index": 183 }, { "content": "@views.route('/413.html')\ndef file_too_large():\n return make_response(render_template('413.html'), 413)", "metadata": "root.file_too_large", "header": "['module', '___EOS___']", "index": 187 } ]
[ { "span": "import sys", "start_line": 3, "start_column": 0, "end_line": 3, "end_column": 10 }, { "span": "import os", "start_line": 4, "start_column": 0, "end_line": 4, "end_column": 9 }, { "span": "import gzip", "start_line": 5, "start_column": 0, "end_line": 5, "end_column": 11 }, { "span": "import requests", "start_line": 6, "start_column": 0, "end_line": 6, "end_column": 15 }, { "span": "from uuid import uuid4", "start_line": 7, "start_column": 0, "end_line": 7, "end_column": 22 }, { "span": "from werkzeug import secure_filename", "start_line": 8, "start_column": 0, "end_line": 8, "end_column": 36 }, { "span": "from csvkit.cleanup import RowChecker", "start_line": 11, "start_column": 0, "end_line": 11, "end_column": 37 }, { "span": "from geomancer.helpers import import_class, get_geo_types, get_data_sources, \\\n guess_geotype, check_combos, SENSICAL_TYPES", "start_line": 13, "start_column": 0, "end_line": 14, "end_column": 47 }, { "span": "from geomancer.app_config import ALLOWED_EXTENSIONS, \\\n MAX_CONTENT_LENGTH", "start_line": 15, "start_column": 0, "end_line": 16, "end_column": 22 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "from_", "flask_", "import_", "Blueprint_", ",_", "make", "\\u", "response_", ",_", "request_", ",_", "redirect_", ",_", "url", "\\u", "for_", ",_", "session_", ",_", "render", "\\u", "template_", ",_", "current", "\\u", "app_", ",_", "send", "\\u", "from", "\\u", "directory_", ",_", "flash_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "json_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "gzip_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "requests_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "uuid_", "import_", "uuid4_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "werkzeug_", "import_", "secure", "\\u", "filename_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "csv", "kit_", "import_", "convert_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "csv", "kit_", "._", "uni", "csv_", "import_", "Unic", "ode", "CSV", "Reader_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "csv", "kit_", "._", "cleanup_", "import_", "Row", "Checker_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "c", "String", "IO_", "import_", "String", "IO_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "geom", "anc", "er_", "._", "helpers_", "import_", "import", "\\u", "class_", ",_", "get", "\\u", "geo", "\\u", "types_", ",_", "get", "\\u", "data\\u", "sources_", ",_", "guess", "\\u", "geot", "ype_", ",_", "check", "\\u", "combo", "s_", ",_", "SENS", "ICAL", "\\u", "TYPES_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "geom", "anc", "er_", "._", "app", "\\u", "config_", "import_", "ALLOWED", "\\u", "EXTENSIONS_", ",_", "MAX", "\\u", "CONTE", "NT", "\\u", "LENGTH_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "werkzeug_", "._", "exceptions_", "import_", "Request", "Entit", "y", "Too", "Large", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "views_", "=_", "Blueprint_", "(_", "'", "views", "'_", ",_", "\\u\\u", "name\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "primary", " ", "pages_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "route", "s", " ", "for", " ", "geom", "anci", "n", "'_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "allow", "ed", "\\u", "file_", "(_", "filename_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "'.'_", "in_", "filename_", "and_", "filename_", "._", "rsplit_", "(_", "'.'_", ",_", "1_", ")_", "[_", "1_", "]_", "in_", "ALLOWED", "\\u", "EXTENSIONS_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "views_", "._", "route_", "(_", "'/'_", ",_", "methods_", "=_", "[_", "'", "GET", "'_", ",_", "'", "POST", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "index_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "render", "\\u", "template_", "(_", "'", "index", ".", "html", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "views_", "._", "route_", "(_", "'/", "abo", "ut", "'_", ",_", "methods_", "=_", "[_", "'", "GET", "'_", ",_", "'", "POST", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "about_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "render", "\\u", "template_", "(_", "'", "abo", "ut", ".", "html", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "views_", "._", "route_", "(_", "'/", "upload", "-", "formats", "'_", ",_", "methods_", "=_", "[_", "'", "GET", "'_", ",_", "'", "POST", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "upload", "\\u", "formats_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "render", "\\u", "template_", "(_", "'", "upload", "-", "formats", ".", "html", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "views_", "._", "route_", "(_", "'/", "contribute", "-", "data", "'_", ",_", "methods_", "=_", "[_", "'", "GET", "'_", ",_", "'", "POST", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "contribute", "\\u", "data_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "render", "\\u", "template_", "(_", "'", "contribute", "-", "data", ".", "html", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "views_", "._", "route_", "(_", "'/", "geogr", "aph", "ies", "'_", ",_", "methods_", "=_", "[_", "'", "GET", "'_", ",_", "'", "POST", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "geogr", "aph", "ies_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "geogr", "aph", "ies_", ",_", "errors_", "=_", "get", "\\u", "geo", "\\u", "types_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "error_", "in_", "errors_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "flash_", "(_", "error_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "render", "\\u", "template_", "(_", "'", "geogr", "aph", "ies", ".", "html", "'_", ",_", "geogr", "aph", "ies_", "=_", "geogr", "aph", "ies_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "views_", "._", "route_", "(_", "'/", "data", "-", "source", "s", "'_", ",_", "methods_", "=_", "[_", "'", "GET", "'_", ",_", "'", "POST", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "data\\u", "sources_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "data\\u", "sources_", ",_", "errors_", "=_", "get", "\\u", "data\\u", "sources_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "error_", "in_", "errors_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "flash_", "(_", "error_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "render", "\\u", "template_", "(_", "'", "data", "-", "source", "s", ".", "html", "'_", ",_", "data\\u", "sources_", "=_", "data\\u", "sources_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "views_", "._", "route_", "(_", "'/", "upload", "/'_", ",_", "methods_", "=_", "[_", "'", "GET", "'_", ",_", "'", "POST", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "upload_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "context_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "request_", "._", "method_", "==_", "'", "POST", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "big", "\\u", "file_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "files_", "=_", "request_", "._", "files_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Request", "Entit", "y", "Too", "Large", "_", ",_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "files_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "big", "\\u", "file_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "current", "\\u", "app_", "._", "logger_", "._", "info_", "(_", "e_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "files_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "f_", "=_", "files_", "[_", "'", "input", "\\u", "file", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "allow", "ed", "\\u", "file_", "(_", "f_", "._", "filename_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "inp_", "=_", "String", "IO_", "(_", "f_", "._", "read_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "file", "\\u", "format_", "=_", "convert_", "._", "guess", "\\u", "format_", "(_", "f_", "._", "filename_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "converted_", "=_", "convert_", "._", "convert_", "(_", "inp_", ",_", "file", "\\u", "format_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Unic", "ode", "Decode", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "context_", "[_", "'", "error", "s", "'_", "]_", "=_", "[_", "'", "We", " ", "had", " ", "a", " ", "problem", " ", "with", " ", "readi", "ng", " ", "your", " ", "file", ".", " ", "\\\\", "\\", "10", ";", " ", " ", "Thi", "s", " ", "coul", "d", " ", "have", " ", "to", " ", "do", " ", "with", " ", "the", " ", "file", " ", "encoding", " ", "or", " ", "format", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "converted_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "f_", "._", "seek_", "(_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "converted_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "outp_", "=_", "String", "IO_", "(_", "converted_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "reader_", "=_", "Unic", "ode", "CSV", "Reader_", "(_", "outp_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "session_", "[_", "'", "header", "\\u", "row", "'_", "]_", "=_", "reader_", "._", "next_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rows_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "columns_", "=_", "[_", "[_", "]_", "for_", "c_", "in_", "session_", "[_", "'", "header", "\\u", "row", "'_", "]_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "column", "\\u", "ids_", "=_", "range_", "(_", "len_", "(_", "session_", "[_", "'", "header", "\\u", "row", "'_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "row_", "in_", "range_", "(_", "100_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "rows_", "._", "append_", "(_", "reader_", "._", "next_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Sto", "p", "Iteration_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "i_", ",_", "row_", "in_", "enumerate_", "(_", "rows_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "for_", "j_", ",_", "d_", "in_", "enumerate_", "(_", "row_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "columns_", "[_", "j_", "]_", "._", "append_", "(_", "row_", "[_", "column", "\\u", "ids_", "[_", "j_", "]_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "sample", "\\u", "data_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "guesses", "_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "index_", ",_", "header", "\\u", "val_", "in_", "enumerate_", "(_", "session_", "[_", "'", "header", "\\u", "row", "'_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "guesses", "_", "[_", "index_", "]_", "=_", "guess", "\\u", "geot", "ype_", "(_", "header", "\\u", "val_", ",_", "columns_", "[_", "index_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sample", "\\u", "data_", "._", "append_", "(_", "(_", "index_", ",_", "header", "\\u", "val_", ",_", "columns_", "[_", "index_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "session_", "[_", "'", "sample", "\\u", "data", "'_", "]_", "=_", "sample", "\\u", "data_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "session_", "[_", "'", "guesses", "'_", "]_", "=_", "json_", "._", "dumps_", "(_", "guesses", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "outp_", "._", "seek_", "(_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "session_", "[_", "'", "file", "'_", "]_", "=_", "outp_", "._", "getvalue_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "session_", "[_", "'", "filename", "'_", "]_", "=_", "f_", "._", "filename_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "redirect_", "(_", "url", "\\u", "for_", "(_", "'", "views", ".", "select", "\\u", "geo", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "context_", "[_", "'", "error", "s", "'_", "]_", "=_", "[_", "'", "On", "ly", " ", ".", "xls", " ", "or", " ", ".", "xls", "x", " ", "and", " ", ".", "csv", " ", "files", " ", "are", " ", "allow", "ed", ".'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "context_", "[_", "'", "error", "s", "'_", "]_", "=_", "[_", "'", "You", " ", "must", " ", "provide", " ", "a", " ", "file", " ", "to", " ", "upload", ".'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "big", "\\u", "file_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "context_", "[_", "'", "error", "s", "'_", "]_", "=_", "[_", "'", "Upload", "ed", " ", "file", " ", "must", " ", "be", " ", "10", "mb", " ", "or", " ", "less", ".'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "render", "\\u", "template_", "(_", "'", "upload", ".", "html", "'_", ",_", "**_", "context_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "views_", "._", "route_", "(_", "'/", "select", "-", "geogr", "aph", "y", "/'_", ",_", "methods_", "=_", "[_", "'", "GET", "'_", ",_", "'", "POST", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "select", "\\u", "geo_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "session_", "._", "get_", "(_", "'", "file", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "redirect_", "(_", "url", "\\u", "for_", "(_", "'", "views", ".", "index", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "context_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "request_", "._", "method_", "==_", "'", "POST", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "inp_", "=_", "String", "IO_", "(_", "session_", "[_", "'", "file", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "reader_", "=_", "Unic", "ode", "CSV", "Reader_", "(_", "inp_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "header_", "=_", "reader_", "._", "next_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fields_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "valid_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "geot", "ype", "\\u", "val_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "request_", "._", "form_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "valid_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "context_", "[_", "'", "error", "s", "'_", "]_", "=_", "[_", "'", "Select", " ", "a", " ", "field", " ", "tha", "t", " ", "contain", "s", " ", "a", " ", "geogr", "aph", "y", " ", "type", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "geot", "ypes_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "indexes_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "k_", ",_", "v_", "in_", "request_", "._", "form_", "._", "items_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "k_", "._", "startswith_", "(_", "\"", "geot", "ype", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "geot", "ypes_", "._", "append_", "(_", "v_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "indexes_", "._", "append_", "(_", "k_", "._", "split_", "(_", "'\\u'_", ")_", "[_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "len_", "(_", "indexes_", ")_", ">_", "2_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "valid_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "context_", "[_", "'", "error", "s", "'_", "]_", "=_", "[_", "'", "We", " ", "can", " ", "only", " ", "merge", " ", "geographic", " ", "informati", "on", " ", "from", " ", "2", " ", "column", "s", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "fields", "\\u", "key_", "=_", "';'_", "._", "join_", "(_", "[_", "header_", "[_", "int_", "(_", "i_", ")_", "]_", "for_", "i_", "in_", "indexes_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "geot", "ype", "\\u", "val_", "=_", "';'_", "._", "join_", "(_", "[_", "g_", "for_", "g_", "in_", "geot", "ypes_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "check", "\\u", "combo", "s_", "(_", "geot", "ype", "\\u", "val_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "valid_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "types_", "=_", "[_", "t_", "._", "title_", "(_", ")_", "for_", "t_", "in_", "geot", "ype", "\\u", "val_", "._", "split_", "(_", "';'_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "context_", "[_", "'", "error", "s", "'_", "]_", "=_", "[_", "'", "The", " ", "geographic", " ", "combinat", "ion", " ", "of", " ", "{", "0", "}", " ", "and", " ", "{", "1", "}", " ", "doe", "s", " ", "not", " ", "work", "'_", "._", "format_", "(_", "*_", "types_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "fields_", "[_", "fields", "\\u", "key_", "]_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "geo", "\\u", "type", "'_", ":_", "geot", "ype", "\\u", "val_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "column", "\\u", "index", "'_", ":_", "';'_", "._", "join_", "(_", "indexes_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "found", "\\u", "geo", "\\u", "type", " ", "=", " ", "get", "\\u", "geo", "\\u", "types", "(", "geo", "\\u", "type", ")[", "0", "]['", "info", "']", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "sample", "\\u", "list", " ", "=", " ", "session", "['", "sample", "\\u", "data", "']", "[", "index", "][", "2", "]_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "valid", ",", " ", "message", " ", "=", " ", "found", "\\u", "geo", "\\u", "type", ".", "validat", "e", "(", "sample", "\\u", "list", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "context", "['", "error", "s", "']", " ", "=", " ", "[", "message", "]_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "valid_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "geo", "\\u", "type_", "=_", "SENS", "ICAL", "\\u", "TYPES_", "[_", "geot", "ype", "\\u", "val_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Key", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "geo", "\\u", "type_", "=_", "geot", "ype", "\\u", "val_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "man", "cer", "\\u", "data_", ",_", "errors_", "=_", "get", "\\u", "data\\u", "sources_", "(_", "geo", "\\u", "type_", "=_", "geo", "\\u", "type_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "session_", "[_", "'", "fields", "'_", "]_", "=_", "fields_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "session_", "[_", "'", "man", "cer", "\\u", "data", "'_", "]_", "=_", "man", "cer", "\\u", "data_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "error_", "in_", "errors_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "flash_", "(_", "error_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "redirect_", "(_", "url", "\\u", "for_", "(_", "'", "views", ".", "select", "\\u", "tables", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "render", "\\u", "template_", "(_", "'", "select", "\\u", "geo", ".", "html", "'_", ",_", "**_", "context_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "views_", "._", "route_", "(_", "'/", "select", "-", "tables", "/'_", ",_", "methods_", "=_", "[_", "'", "POST", "'_", ",_", "'", "GET", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "select", "\\u", "tables_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "session_", "._", "get_", "(_", "'", "file", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "redirect_", "(_", "url", "\\u", "for_", "(_", "'", "views", ".", "index", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "context_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "request_", "._", "method_", "==_", "'", "POST", "'_", "and_", "not_", "request_", "._", "form_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "valid_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "context_", "[_", "'", "error", "s", "'_", "]_", "=_", "[_", "'", "Select", " ", "at", " ", "leas", "t", " ", "on", " ", "table", " ", "to", " ", "join", " ", "to", " ", "your", " ", "spreadsheet", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "render", "\\u", "template_", "(_", "'", "select", "\\u", "tables", ".", "html", "'_", ",_", "**_", "context_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "views_", "._", "route_", "(_", "'/", "geom", "anc", "e", "/", "<", "session", "\\u", "key", ">/", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "geom", "anc", "e\\u", "view_", "(_", "session", "\\u", "key_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "render", "\\u", "template_", "(_", "'", "geom", "anc", "e", ".", "html", "'_", ",_", "session", "\\u", "key_", "=_", "session", "\\u", "key_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "views_", "._", "route_", "(_", "'/", "download", "/", "<", "path", ":", "filename", ">'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "download", "\\u", "results_", "(_", "filename_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "send", "\\u", "from", "\\u", "directory_", "(_", "current", "\\u", "app_", "._", "config_", "[_", "'", "RESU", "LT", "\\u", "FOLDER", "'_", "]_", ",_", "filename_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "views_", "._", "route_", "(_", "'/", "413", ".", "html", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "file", "\\u", "too", "\\u", "large_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "make", "\\u", "response_", "(_", "render", "\\u", "template_", "(_", "'", "413", ".", "html", "'_", ")_", ",_", "413_", ")_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,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 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Except block handles 'BaseException'
azoft-dev-team/imagrium/env/Lib/test/test_unittest.py
[ { "content": " def test_addFailure(self):\n import sys\n\n class Foo(unittest.TestCase):\n def test_1(self):\n pass\n\n test = Foo('test_1')\n try:\n test.fail(\"foo\")\n except:\n exc_info_tuple = sys.exc_info()\n\n result = unittest.TestResult()\n\n result.startTest(test)\n result.addFailure(test, exc_info_tuple)\n result.stopTest(test)\n\n self.failIf(result.wasSuccessful())\n self.assertEqual(len(result.errors), 0)\n self.assertEqual(len(result.failures), 1)\n self.assertEqual(result.testsRun, 1)\n self.assertEqual(result.shouldStop, False)\n\n test_case, formatted_exc = result.failures[0]\n self.failUnless(test_case is test)\n self.failUnless(isinstance(formatted_exc, str))", "metadata": "root.Test_TestResult.test_addFailure", "header": "['class', 'Test_TestResult', '(', 'TestCase', ')', ':', '___NEWLINE___', '# Note: there are not separate tests for TestResult.wasSuccessful(),', '___NL___', '# TestResult.errors, TestResult.failures, TestResult.testsRun or', '___NL___', '# TestResult.shouldStop because these only have meaning in terms of', '___NL___', '# other TestResult methods.', '___NL___', '#', '___NL___', '# Accordingly, tests for the aforenamed attributes are incorporated', '___NL___', '# in with the tests for the defining methods.', '___NL___', '################################################################', '___NL___', '___EOS___']", "index": 1794 }, { "content": " def test_addError(self):\n import sys\n\n class Foo(unittest.TestCase):\n def test_1(self):\n pass\n\n test = Foo('test_1')\n try:\n raise TypeError()\n except:\n exc_info_tuple = sys.exc_info()\n\n result = unittest.TestResult()\n\n result.startTest(test)\n result.addError(test, exc_info_tuple)\n result.stopTest(test)\n\n self.failIf(result.wasSuccessful())\n self.assertEqual(len(result.errors), 1)\n self.assertEqual(len(result.failures), 0)\n self.assertEqual(result.testsRun, 1)\n self.assertEqual(result.shouldStop, False)\n\n test_case, formatted_exc = result.errors[0]\n self.failUnless(test_case is test)\n self.failUnless(isinstance(formatted_exc, str))", "metadata": "root.Test_TestResult.test_addError", "header": "['class', 'Test_TestResult', '(', 'TestCase', ')', ':', '___NEWLINE___', '# Note: there are not separate tests for TestResult.wasSuccessful(),', '___NL___', '# TestResult.errors, TestResult.failures, TestResult.testsRun or', '___NL___', '# TestResult.shouldStop because these only have meaning in terms of', '___NL___', '# other TestResult methods.', '___NL___', '#', '___NL___', '# Accordingly, tests for the aforenamed attributes are incorporated', '___NL___', '# in with the tests for the defining methods.', '___NL___', '################################################################', '___NL___', '___EOS___']", "index": 1844 } ]
[ { "span": "except:", "start_line": 1804, "start_column": 8, "end_line": 1804, "end_column": 15 }, { "span": "except:", "start_line": 1854, "start_column": 8, "end_line": 1854, "end_column": 15 } ]
[]
1
true
[ "[CLS]_", "Except", "_", "block_", "handles_", "'", "Base", "Except", "ion", "'_", "[SEP]_", "class_", "Test", "\\u", "Test", "Result_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Not", "e", ":", " ", "there", " ", "are", " ", "not", " ", "separate", " ", "tests", " ", "for", " ", "Test", "Result", ".", "was", "Success", "ful", "()", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Test", "Result", ".", "error", "s", ",", " ", "Test", "Result", ".", "fail", "ure", "s", ",", " ", "Test", "Result", ".", "tests", "Run", " ", "or_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Test", "Result", ".", "shou", "ld", "Sto", "p", " ", "bec", "aus", "e", " ", "these", " ", "only", " ", "have", " ", "meaning", " ", "in", " ", "term", "s", " ", "of_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "other", " ", "Test", "Result", " ", "method", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Acco", "rdin", "gly", ",", " ", "tests", " ", "for", " ", "the", " ", "af", "ore", "named", " ", "attribute", "s", " ", "are", " ", "inco", "rpor", "ated", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "in", " ", "with", " ", "the", " ", "tests", " ", "for", " ", "the", " ", "defini", "ng", " ", "method", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "###########", "###########", "###########", "###########", "###########", "#########", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "add", "Failure_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Foo_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "test\\u", "1_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "test_", "=_", "Foo_", "(_", "'", "test\\u", "1", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "test_", "._", "fail_", "(_", "\"", "foo", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "exc", "\\u", "info", "\\u", "tuple_", "=_", "sys_", "._", "exc", "\\u", "info_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "result_", "=_", "unittest_", "._", "Test", "Result_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "result_", "._", "start", "Test_", "(_", "test_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "._", "add", "Failure_", "(_", "test_", ",_", "exc", "\\u", "info", "\\u", "tuple_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "._", "stop", "Test_", "(_", "test_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "fail", "If_", "(_", "result_", "._", "was", "Success", "ful_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "result_", "._", "errors_", ")_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "result_", "._", "failures_", ")_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "result_", "._", "tests", "Run_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "result_", "._", "shou", "ld", "Stop_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "test\\u", "case_", ",_", "format", "ted", "\\u", "exc_", "=_", "result_", "._", "failures_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "fail", "Unless_", "(_", "test\\u", "case_", "is_", "test_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "fail", "Unless_", "(_", "isinstance_", "(_", "format", "ted", "\\u", "exc_", ",_", "str_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "\\u", "Test", "Result_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Not", "e", ":", " ", "there", " ", "are", " ", "not", " ", "separate", " ", "tests", " ", "for", " ", "Test", "Result", ".", "was", "Success", "ful", "()", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Test", "Result", ".", "error", "s", ",", " ", "Test", "Result", ".", "fail", "ure", "s", ",", " ", "Test", "Result", ".", "tests", "Run", " ", "or_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Test", "Result", ".", "shou", "ld", "Sto", "p", " ", "bec", "aus", "e", " ", "these", " ", "only", " ", "have", " ", "meaning", " ", "in", " ", "term", "s", " ", "of_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "other", " ", "Test", "Result", " ", "method", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Acco", "rdin", "gly", ",", " ", "tests", " ", "for", " ", "the", " ", "af", "ore", "named", " ", "attribute", "s", " ", "are", " ", "inco", "rpor", "ated", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "in", " ", "with", " ", "the", " ", "tests", " ", "for", " ", "the", " ", "defini", "ng", " ", "method", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "###########", "###########", "###########", "###########", "###########", "#########", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "add", "Error_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Foo_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "test\\u", "1_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "test_", "=_", "Foo_", "(_", "'", "test\\u", "1", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Type", "Error_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "exc", "\\u", "info", "\\u", "tuple_", "=_", "sys_", "._", "exc", "\\u", "info_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "result_", "=_", "unittest_", "._", "Test", "Result_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "result_", "._", "start", "Test_", "(_", "test_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "._", "add", "Error_", "(_", "test_", ",_", "exc", "\\u", "info", "\\u", "tuple_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "._", "stop", "Test_", "(_", "test_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "fail", "If_", "(_", "result_", "._", "was", "Success", "ful_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "result_", "._", "errors_", ")_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "result_", "._", "failures_", ")_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "result_", "._", "tests", "Run_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "result_", "._", "shou", "ld", "Stop_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "test\\u", "case_", ",_", "format", "ted", "\\u", "exc_", "=_", "result_", "._", "errors_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "fail", "Unless_", "(_", "test\\u", "case_", "is_", "test_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "fail", "Unless_", "(_", "isinstance_", "(_", "format", "ted", "\\u", "exc_", ",_", "str_",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2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
piuccio/sublime-esformatter/EsFormatter.py
[ { "content": "import sublime, sublime_plugin, subprocess, threading, json, re, platform, sys, os\n\nON_WINDOWS = platform.system() is 'Windows'\nST2 = sys.version_info < (3, 0)\n\n\n\nNODE = NodeCheck()\n# I don't really like this, but formatting is async, so I must\n# save the file again after it's been formatted (auto_format)\n# This flag prevents loops\nAM_I_FORMATTING_AFTER_SAVE = False\n\nif not ON_WINDOWS:\n # Extend Path to catch Node installed via HomeBrew\n os.environ['PATH'] += ':/usr/local/bin'\n\n\n# Extend NODE_PATH to make globally installed esformatter requirable\nnpmRoot = getNpmGlobalRoot()\nif npmRoot:\n if hasattr(os.environ, 'NODE_PATH'):\n os.environ['NODE_PATH'] += os.pathsep + npmRoot\n else:\n os.environ['NODE_PATH'] = npmRoot\n\n\n\n\n\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class NodeCheck:\n '''This class check whether esformatter is installed and available in the path.\n The check is done only once when mightWork() is called for the first time.\n Being a tri-state class it's better not accessing it's properties but only call mightWork()'''\n\n", "metadata": "root.NodeCheck", "header": "['module', '___EOS___']", "index": 5 }, { "content": " def __init__(self):\n self.works = False\n self.checkDone = False\n self.nodeName = \"esformatter\"", "metadata": "root.NodeCheck.__init__", "header": "['class', 'NodeCheck', ':', '___EOS___']", "index": 9 }, { "content": " def mightWork(self, path):\n if (self.checkDone):\n return self.works\n\n if (path):\n self.nodeName = path\n\n self.tryWithSelfName()\n\n if (self.works is False):\n sublime.error_message(\"It looks like esformatter is not installed.\\nPlease make sure that it is installed and is in your PATH\")\n\n return self.works", "metadata": "root.NodeCheck.mightWork", "header": "['class', 'NodeCheck', ':', '___EOS___']", "index": 14 }, { "content": " def tryWithSelfName(self):\n try:\n # call node version with whatever path is defined in nodeName\n subprocess.Popen([self.nodeName, \"--version\"], bufsize=1, stdin=None, stdout=None, stderr=None, startupinfo=getStartupInfo())\n self.works = True\n except OSError as e:\n self.works = False", "metadata": "root.NodeCheck.tryWithSelfName", "header": "['class', 'NodeCheck', ':', '___EOS___']", "index": 28 }, { "content": "def getNpmGlobalRoot():\n # determine NPM global root\n try:\n return subprocess.check_output([\"npm\", \"root\", \"-g\"]).rstrip().decode('utf-8')\n except:\n # NPM not installed or not accessible\n return None", "metadata": "root.getNpmGlobalRoot", "header": "['module', '___EOS___']", "index": 47 }, { "content": "class EsformatterCommand(sublime_plugin.TextCommand):\n\n\n\n\n\n\n\n\n\n", "metadata": "root.EsformatterCommand", "header": "['module', '___EOS___']", "index": 63 }, { "content": " def run(self, edit, save=False, ignoreSelection=False):\n # Settings for formatting\n settings = sublime.load_settings(\"EsFormatter.sublime-settings\")\n\n if (NODE.mightWork(settings.get(\"esformatter_path\")) == False):\n return\n\n if (ignoreSelection or len(self.view.sel()) == 1 and self.view.sel()[0].empty()):\n # Only one caret and no text selected, format the whole file\n textContent = self.view.substr(sublime.Region(0, self.view.size()))\n thread = NodeCall(textContent, getFilePath(self.view))\n thread.start()\n self.handle_thread(thread, lambda: self.replaceFile(thread, save))\n else:\n # Format each and every selection block\n threads = []\n for selection in self.view.sel():\n # Take everything from the beginning to the end of line\n region = self.view.line(selection)\n textContent = self.view.substr(region)\n thread = NodeCall(textContent, getFilePath(self.view), len(threads), region)\n threads.append(thread)\n thread.start()\n\n self.handle_threads(threads, lambda process, lastError: self.handleSyntaxErrors(process, lastError))", "metadata": "root.EsformatterCommand.run", "header": "['class', 'EsformatterCommand', '(', 'sublime_plugin', '.', 'TextCommand', ')', ':', '___EOS___']", "index": 64 }, { "content": " def replaceFile(self, thread, save=False):\n '''Replace the entire file content with the formatted text.'''\n if thread.code == thread.result.encode('utf-8'):\n return\n self.view.run_command(\"esformat_update_content\", {\"text\": thread.result})\n sublime.status_message(\"File formatted\")\n if (save):\n self.view.run_command(\"save\")", "metadata": "root.EsformatterCommand.replaceFile", "header": "['class', 'EsformatterCommand', '(', 'sublime_plugin', '.', 'TextCommand', ')', ':', '___EOS___']", "index": 91 }, { "content": " def handleSyntaxErrors(self, threads=None, lastError=None):\n '''When formatting whole lines there might be a syntax error because we select\n the whole line content. In that case, fall-back to the user selection.'''\n if (lastError is None and threads is not None):\n self.replaceSelections(threads, None)\n else:\n # Format each and every selection block\n threads = []\n for selection in self.view.sel():\n # Take only the user selection\n textContent = self.view.substr(selection)\n thread = NodeCall(textContent, getFilePath(self.view), len(threads), selection)\n threads.append(thread)\n thread.start()\n\n self.handle_threads(threads, lambda process, lastError: self.replaceSelections(process, lastError))", "metadata": "root.EsformatterCommand.handleSyntaxErrors", "header": "['class', 'EsformatterCommand', '(', 'sublime_plugin', '.', 'TextCommand', ')', ':', '___EOS___']", "index": 102 }, { "content": " def replaceSelections(self, threads, lastError):\n '''Replace the content of a list of selections.\n This is called when there are multiple cursors or a selection of text'''\n if (lastError):\n sublime.error_message(\"Error (2):\" + lastError)\n else:\n # Modify the selections from top to bottom to account for different text length\n offset = 0\n regions = []\n for thread in sorted(threads, key=lambda t: t.region.begin()):\n if thread.code == thread.result.encode('utf-8'):\n continue\n if offset:\n region = [thread.region.begin() + offset, thread.region.end() + offset, thread.result]\n else:\n region = [thread.region.begin(), thread.region.end(), thread.result]\n offset += len(thread.result) - len(thread.code)\n regions.append(region)\n self.view.run_command(\"esformat_update_content\", {\"regions\": regions})", "metadata": "root.EsformatterCommand.replaceSelections", "header": "['class', 'EsformatterCommand', '(', 'sublime_plugin', '.', 'TextCommand', ')', ':', '___EOS___']", "index": 120 }, { "content": " def handle_thread(self, thread, callback):\n if thread.is_alive():\n sublime.set_timeout(lambda: self.handle_thread(thread, callback), 100)\n elif thread.result is not False:\n callback()\n else:\n sublime.error_message(\"Error (1):\" + thread.error)", "metadata": "root.EsformatterCommand.handle_thread", "header": "['class', 'EsformatterCommand', '(', 'sublime_plugin', '.', 'TextCommand', ')', ':', '___EOS___']", "index": 141 }, { "content": " def handle_threads(self, threads, callback, process=False, lastError=None):\n next_threads = []\n if process is False:\n process = []\n\n for thread in threads:\n if thread.is_alive():\n next_threads.append(thread)\n continue\n if thread.result is False:\n # This thread failed\n lastError = thread.error\n continue\n # Thread completed correctly\n process.append(thread)\n\n if len(next_threads):\n # Some more threads to wait\n sublime.set_timeout(lambda: self.handle_threads(next_threads, callback, process, lastError), 100)\n else:\n callback(process, lastError)", "metadata": "root.EsformatterCommand.handle_threads", "header": "['class', 'EsformatterCommand', '(', 'sublime_plugin', '.', 'TextCommand', ')', ':', '___EOS___']", "index": 149 }, { "content": "class NodeCall(threading.Thread):\n", "metadata": "root.NodeCall", "header": "['module', '___EOS___']", "index": 172 }, { "content": " def __init__(self, code, path, id=0, region=None):\n self.code = code.encode('utf-8')\n self.region = region\n self.result = None\n threading.Thread.__init__(self)", "metadata": "root.NodeCall.__init__", "header": "['class', 'NodeCall', '(', 'threading', '.', 'Thread', ')', ':', '___EOS___']", "index": 173 }, { "content": " def run(self):\n try:\n process = subprocess.Popen(\n [\"esformatter\"],\n bufsize=160*len(self.code),\n stdin=subprocess.PIPE,\n stdout=subprocess.PIPE,\n stderr=subprocess.PIPE,\n startupinfo=getStartupInfo())\n if ST2:\n stdout, stderr = process.communicate(self.code)\n self.result = re.sub(r'(\\r|\\r\\n|\\n)\\Z', '', stdout).decode('utf-8')\n else:\n stdout, stderr = process.communicate(self.code)\n self.result = re.sub(r'(\\r|\\r\\n|\\n)\\Z', '', str(stdout, encoding='utf-8'))\n\n if stderr:\n self.result = False\n if ST2:\n self.error = str(stderr.decode('utf-8'))\n else:\n self.error = str(stderr, encoding='utf-8')\n\n except Exception as e:\n self.result = False\n self.error = str(e)", "metadata": "root.NodeCall.run", "header": "['class', 'NodeCall', '(', 'threading', '.', 'Thread', ')', ':', '___EOS___']", "index": 179 }, { "content": "def getStartupInfo():\n if ON_WINDOWS:\n info = subprocess.STARTUPINFO()\n info.dwFlags |= subprocess.STARTF_USESHOWWINDOW\n info.wShowWindow = subprocess.SW_HIDE\n return info\n return None", "metadata": "root.getStartupInfo", "header": "['module', '___EOS___']", "index": 206 }, { "content": "def getFilePath(view):\n path = view.file_name()\n if (path):\n return str(path)\n else:\n return '';", "metadata": "root.getFilePath", "header": "['module', '___EOS___']", "index": 214 }, { "content": "class EsformatUpdateContent(sublime_plugin.TextCommand):", "metadata": "root.EsformatUpdateContent", "header": "['module', '___EOS___']", "index": 221 }, { "content": " def run(self, edit, text=None, regions=None):\n if text:\n self.view.replace(edit, sublime.Region(0, self.view.size()), text)\n else:\n for region in regions:\n self.view.replace(edit, sublime.Region(region[0], region[1]), region[2])", "metadata": "root.EsformatUpdateContent.run", "header": "['class', 'EsformatUpdateContent', '(', 'sublime_plugin', '.', 'TextCommand', ')', ':', '___EOS___']", "index": 222 }, { "content": "class EsformatEventListener(sublime_plugin.EventListener):\n", "metadata": "root.EsformatEventListener", "header": "['module', '___EOS___']", "index": 230 }, { "content": " def on_pre_save(self, view):\n global AM_I_FORMATTING_AFTER_SAVE\n if AM_I_FORMATTING_AFTER_SAVE:\n AM_I_FORMATTING_AFTER_SAVE = False\n return\n\n AM_I_FORMATTING_AFTER_SAVE = True\n settings = sublime.load_settings(\"EsFormatter.sublime-settings\")\n if (settings.get(\"format_on_save\") and self.isJavascript(view)):\n view.window().run_command(\"esformatter\", {\n \"save\": True,\n \"ignoreSelection\": True\n })", "metadata": "root.EsformatEventListener.on_pre_save", "header": "['class', 'EsformatEventListener', '(', 'sublime_plugin', '.', 'EventListener', ')', ':', '___EOS___']", "index": 231 }, { "content": " def isJavascript(self, view):\n # Check the file extension\n name = view.file_name()\n if (name and os.path.splitext(name)[1][1:] in [\"js\"]):\n return True\n # If it has no name (?) or it's not a JS, check the syntax\n syntax = view.settings().get(\"syntax\")\n if (syntax and \"javascript\" in syntax.split(\"/\")[-1].lower()):\n return True\n\n return False", "metadata": "root.EsformatEventListener.isJavascript", "header": "['class', 'EsformatEventListener', '(', 'sublime_plugin', '.', 'EventListener', ')', ':', '___EOS___']", "index": 245 } ]
[ { "span": "import sublime, sublime_plugin, subprocess, threading, json, re, platform, sys, os", "start_line": 0, "start_column": 0, "end_line": 0, "end_column": 82 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "import_", "sublime_", ",_", "sublim", "e\\u", "plugin_", ",_", "subprocess_", ",_", "threading_", ",_", "json_", ",_", "re_", ",_", "platform_", ",_", "sys_", ",_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "ON", "\\u", "WINDOWS", "_", "=_", "platform_", "._", "system_", "(_", ")_", "is_", "'", "Window", "s", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ST", "2_", "=_", "sys_", "._", "version", "\\u", "info_", "<_", "(_", "3_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "NODE_", "=_", "Node", "Check_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "I", " ", "don", "'", "t", " ", "reall", "y", " ", "like", " ", "this", ",", " ", "but", " ", "format", "ting", " ", "is", " ", "async", ",", " ", "so", " ", "I", " ", "must", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "save", " ", "the", " ", "file", " ", "again", " ", "after", " ", "it", "'", "s", " ", "bee", "n", " ", "format", "ted", " ", "(", "auto", "\\u", "format", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Thi", "s", " ", "flag", " ", "prevent", "s", " ", "loops_", "\\u\\u\\uNL\\u\\u\\u_", "AM", "\\u", "I", "\\u", "FORMAT", "TIN", "G", "\\u", "AFTER", "\\u", "SAVE", "_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "ON", "\\u", "WINDOWS", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Extend", " ", "Path", " ", "to", " ", "catch", " ", "Node", " ", "install", "ed", " ", "via", " ", "Home", "Bre", "w_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "os_", "._", "environ_", "[_", "'", "PATH", "'_", "]_", "+=_", "':/", "usr", "/", "local", "/", "bin", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Extend", " ", "NODE", "\\u", "PATH", " ", "to", " ", "make", " ", "global", "ly", " ", "install", "ed", " ", "es", "formatter", " ", "requi", "rab", "le_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "npm", "Root_", "=_", "get", "Np", "m", "Global", "Root_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "npm", "Root_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "hasattr_", "(_", "os_", "._", "environ_", ",_", "'", "NODE", "\\u", "PATH", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "os_", "._", "environ_", "[_", "'", "NODE", "\\u", "PATH", "'_", "]_", "+=_", "os_", "._", "pathsep_", "+_", "npm", "Root_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "os_", "._", "environ_", "[_", "'", "NODE", "\\u", "PATH", "'_", "]_", "=_", "npm", "Root_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Node", "Check_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "Thi", "s", " ", "class", " ", "check", " ", "whe", "ther", " ", "es", "formatter", " ", "is", " ", "install", "ed", " ", "and", " ", "avail", "able", " ", "in", " ", "the", " ", "path", ".", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "check", " ", "is", " ", "don", "e", " ", "only", " ", "onc", "e", " ", "whe", "n", " ", "mig", "ht", "Work", "()", " ", "is", " ", "call", "ed", " ", "for", " ", "the", " ", "first", " ", "time", ".", "\\", "10", ";", " ", " ", " ", " ", "Bei", "ng", " ", "a", " ", "tri", "-", "state", " ", "class", " ", "it", "'", "s", " ", "bett", "er", " ", "not", " ", "accessi", "ng", " ", "it", "'", "s", " ", "proper", "ties", " ", "but", " ", "only", " ", "call", " ", "mig", "ht", "Work", "()'", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Node", "Check_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "works_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "check", "Done_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "node", "Name_", "=_", "\"", "es", "formatter", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Node", "Check_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "mig", "ht", "Work", "_", "(_", "self_", ",_", "path_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "(_", "self_", "._", "check", "Done_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "works_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "(_", "path_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "node", "Name_", "=_", "path_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "try", "With", "Self", "Name_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "(_", "self_", "._", "works_", "is_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sublime_", "._", "error", "\\u", "message_", "(_", "\"", "It", " ", "look", "s", " ", "like", " ", "es", "formatter", " ", "is", " ", "not", " ", "install", "ed", ".\\\\", "n", "Ple", "ase", " ", "make", " ", "sure", " ", "tha", "t", " ", "it", " ", "is", " ", "install", "ed", " ", "and", " ", "is", " ", "in", " ", "your", " ", "PATH", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "self_", "._", "works_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Node", "Check_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "try", "With", "Self", "Name_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "call", " ", "node", " ", "version", " ", "with", " ", "what", "ever", " ", "path", " ", "is", " ", "defin", "ed", " ", "in", " ", "node", "Name_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "subprocess_", "._", "Popen_", "(_", "[_", "self_", "._", "node", "Name_", ",_", "\"--", "version", "\"_", "]_", ",_", "bufsize_", "=_", "1_", ",_", "stdin_", "=_", "None_", ",_", "stdout_", "=_", "None_", ",_", "stderr_", "=_", "None_", ",_", "start", "upi", "nfo_", "=_", "get", "Start", "up", "Info_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "works_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "OSE", "rror_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "works_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "Np", "m", "Global", "Root_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "dete", "rmin", "e", " ", "NP", "M", " ", "global", " ", "root_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "subprocess_", "._", "check", "\\u", "output_", "(_", "[_", "\"", "npm", "\"_", ",_", "\"", "root", "\"_", ",_", "\"-", "g", "\"_", "]_", ")_", "._", "rstrip_", "(_", ")_", "._", "decode_", "(_", "'", "utf", "-", "8", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "NP", "M", " ", "not", " ", "install", "ed", " ", "or", " ", "not", " ", "accessible", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Es", "formatter", "Command_", "(_", "sublim", "e\\u", "plugin_", "._", "Text", "Command_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Es", "formatter", "Command_", "(_", "sublim", "e\\u", "plugin_", "._", "Text", "Command_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "run_", "(_", "self_", ",_", "edit_", ",_", "save_", "=_", "False_", ",_", "ignore", "Selection_", "=_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Sett", "ings", " ", "for", " ", "formatting_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "settings_", "=_", "sublime_", "._", "load", "\\u", "settings_", "(_", "\"", "Es", "Formatt", "er", ".", "sublim", "e-", "settings", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "(_", "NODE_", "._", "mig", "ht", "Work", "_", "(_", "settings_", "._", "get_", "(_", "\"", "es", "formatter", "\\u", "path", "\"_", ")_", ")_", "==_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "(_", "ignore", "Selection_", "or_", "len_", "(_", "self_", "._", "view_", "._", "sel_", "(_", ")_", ")_", "==_", "1_", "and_", "self_", "._", "view_", "._", "sel_", "(_", ")_", "[_", "0_", "]_", "._", "empty_", "(_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "On", "ly", " ", "one", " ", "caret", " ", "and", " ", "no", " ", "text", " ", "selecte", "d", ",", " ", "format", " ", "the", " ", "whole", " ", "file_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "text", "Content_", "=_", "self_", "._", "view_", "._", "substr_", "(_", "sublime_", "._", "Region_", "(_", "0_", ",_", "self_", "._", "view_", "._", "size_", "(_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "thread_", "=_", "Node", "Call_", "(_", "text", "Content_", ",_", "get", "File", "Path_", "(_", "self_", "._", "view_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "thread_", "._", "start_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "handle", "\\u", "thread_", "(_", "thread_", ",_", "lambda_", ":_", "self_", "._", "replace", "File_", "(_", "thread_", ",_", "save_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Format", " ", "each", " ", "and", " ", "every", " ", "selection", " ", "block_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "threads_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "selection_", "in_", "self_", "._", "view_", "._", "sel_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Tak", "e", " ", "every", "thing", " ", "from", " ", "the", " ", "beginn", "ing", " ", "to", " ", "the", " ", "end", " ", "of", " ", "line_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "region_", "=_", "self_", "._", "view_", "._", "line_", "(_", "selection_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "text", "Content_", "=_", "self_", "._", "view_", "._", "substr_", "(_", "region_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "thread_", "=_", "Node", "Call_", "(_", "text", "Content_", ",_", "get", "File", "Path_", "(_", "self_", "._", "view_", ")_", ",_", "len_", "(_", "threads_", ")_", ",_", "region_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "threads_", "._", "append_", "(_", "thread_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "thread_", "._", "start_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "handle", "\\u", "threads_", "(_", "threads_", ",_", "lambda_", "process_", ",_", "last", "Error_", ":_", "self_", "._", "handle", "Syntax", "Errors_", "(_", "process_", ",_", "last", "Error_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Es", "formatter", "Command_", "(_", "sublim", "e\\u", "plugin_", "._", "Text", "Command_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "replace", "File_", "(_", "self_", ",_", "thread_", ",_", "save_", "=_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "Replace", " ", "the", " ", "entire", " ", "file", " ", "content", " ", "with", " ", "the", " ", "format", "ted", " ", "text", ".'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "thread_", "._", "code_", "==_", "thread_", "._", "result_", "._", "encode_", "(_", "'", "utf", "-", "8", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "view_", "._", "run", "\\u", "command_", "(_", "\"", "es", "format\\u", "update", "\\u", "content", "\"_", ",_", "{_", "\"", "text", "\"_", ":_", "thread_", "._", "result_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sublime_", "._", "status", "\\u", "message_", "(_", "\"", "File", " ", "format", "ted", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "(_", "save_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "view_", "._", "run", "\\u", "command_", "(_", "\"", "save", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Es", "formatter", "Command_", "(_", "sublim", "e\\u", "plugin_", "._", "Text", "Command_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "handle", "Syntax", "Errors_", "(_", "self_", ",_", "threads_", "=_", "None_", ",_", "last", "Error_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "Whe", "n", " ", "format", "ting", " ", "whole", " ", "lines", " ", "there", " ", "mig", "ht", " ", "be", " ", "a", " ", "synta", "x", " ", "error", " ", "bec", "aus", "e", " ", "we", " ", "select", "\\", "10", ";", " ", " ", " ", " ", "the", " ", "whole", " ", "line", " ", "content", ".", " ", "In", " ", "tha", "t", " ", "case", ",", " ", "fall", "-", "back", " ", "to", " ", "the", " ", "user", " ", "selection", ".'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "(_", "last", "Error_", "is_", "None_", "and_", "threads_", "is_", "not_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "replace", "Selecti", "ons_", "(_", "threads_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Format", " ", "each", " ", "and", " ", "every", " ", "selection", " ", "block_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "threads_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "selection_", "in_", "self_", "._", "view_", "._", "sel_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Tak", "e", " ", "only", " ", "the", " ", "user", " ", "selection_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "text", "Content_", "=_", "self_", "._", "view_", "._", "substr_", "(_", "selection_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "thread_", "=_", "Node", "Call_", "(_", "text", "Content_", ",_", "get", "File", "Path_", "(_", "self_", "._", "view_", ")_", ",_", "len_", "(_", "threads_", ")_", ",_", "selection_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "threads_", "._", "append_", "(_", "thread_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "thread_", "._", "start_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "handle", "\\u", "threads_", "(_", "threads_", ",_", "lambda_", "process_", ",_", "last", "Error_", ":_", "self_", "._", "replace", "Selecti", "ons_", "(_", "process_", ",_", "last", "Error_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Es", "formatter", "Command_", "(_", "sublim", "e\\u", "plugin_", "._", "Text", "Command_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "replace", "Selecti", "ons_", "(_", "self_", ",_", "threads_", ",_", "last", "Error_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "Replace", " ", "the", " ", "content", " ", "of", " ", "a", " ", "list", " ", "of", " ", "selection", "s", ".", "\\", "10", ";", " ", " ", " ", " ", "Thi", "s", " ", "is", " ", "call", "ed", " ", "whe", "n", " ", "there", " ", "are", " ", "multiple", " ", "cursors", " ", "or", " ", "a", " ", "selection", " ", "of", " ", "text", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "(_", "last", "Error_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sublime_", "._", "error", "\\u", "message_", "(_", "\"", "Error", " ", "(", "2", "):\"_", "+_", "last", "Error_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Modif", "y", " ", "the", " ", "selection", "s", " ", "from", " ", "top", " ", "to", " ", "bottom", " ", "to", " ", "account", " ", "for", " ", "different", " ", "text", " ", "length_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "offset_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "regions_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "thread_", "in_", "sorted_", "(_", "threads_", ",_", "key_", "=_", "lambda_", "t_", ":_", "t_", "._", "region_", "._", "begin_", "(_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "thread_", "._", "code_", "==_", "thread_", "._", "result_", "._", "encode_", "(_", "'", "utf", "-", "8", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "offset_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "region_", "=_", "[_", "thread_", "._", "region_", "._", "begin_", "(_", ")_", "+_", "offset_", ",_", "thread_", "._", "region_", "._", "end_", "(_", ")_", "+_", "offset_", ",_", "thread_", "._", "result_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "region_", "=_", "[_", "thread_", "._", "region_", "._", "begin_", "(_", ")_", ",_", "thread_", "._", "region_", "._", "end_", "(_", ")_", ",_", "thread_", "._", "result_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "offset_", "+=_", "len_", "(_", "thread_", "._", "result_", ")_", "-_", "len_", "(_", "thread_", "._", "code_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "regions_", "._", "append_", "(_", "region_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "view_", "._", "run", "\\u", "command_", "(_", "\"", "es", "format\\u", "update", "\\u", "content", "\"_", ",_", "{_", "\"", "regions", "\"_", ":_", "regions_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Es", "formatter", "Command_", "(_", "sublim", "e\\u", "plugin_", "._", "Text", "Command_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "handle", "\\u", "thread_", "(_", "self_", ",_", "thread_", ",_", "callback_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "thread_", "._", "is", "\\u", "alive_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sublime_", "._", "set\\u", "timeout_", "(_", "lambda_", ":_", "self_", "._", "handle", "\\u", "thread_", "(_", "thread_", ",_", "callback_", ")_", ",_", "100_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "thread_", "._", "result_", "is_", "not_", "False_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "callback_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sublime_", "._", "error", "\\u", "message_", "(_", "\"", "Error", " ", "(", "1", "):\"_", "+_", "thread_", "._", "error_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Es", "formatter", "Command_", "(_", "sublim", "e\\u", "plugin_", "._", "Text", "Command_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "handle", "\\u", "threads_", "(_", "self_", ",_", "threads_", ",_", "callback_", ",_", "process_", "=_", "False_", ",_", "last", "Error_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "next", "\\u", "threads_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "process_", "is_", "False_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "process_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "thread_", "in_", "threads_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "thread_", "._", "is", "\\u", "alive_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "next", "\\u", "threads_", "._", "append_", "(_", "thread_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "thread_", "._", "result_", "is_", "False_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Thi", "s", " ", "thread", " ", "failed_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "last", "Error_", "=_", "thread_", "._", "error_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Thread", " ", "complete", "d", " ", "correct", "ly_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "process_", "._", "append_", "(_", "thread_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "len_", "(_", "next", "\\u", "threads_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Some", " ", "more", " ", "thread", "s", " ", "to", " ", "wait_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sublime_", "._", "set\\u", "timeout_", "(_", "lambda_", ":_", "self_", "._", "handle", "\\u", "threads_", "(_", "next", "\\u", "threads_", ",_", "callback_", ",_", "process_", ",_", "last", "Error_", ")_", ",_", "100_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "callback_", "(_", "process_", ",_", "last", "Error_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Node", "Call_", "(_", "threading_", "._", "Thread_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Node", "Call_", "(_", "threading_", "._", "Thread_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "code_", ",_", "path_", ",_", "id_", "=_", "0_", ",_", "region_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "code_", "=_", "code_", "._", "encode_", "(_", "'", "utf", "-", "8", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "region_", "=_", "region_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "result_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "threading_", "._", "Thread_", "._", "\\u\\u", "init\\u\\u_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Node", "Call_", "(_", "threading_", "._", "Thread_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "run_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "process_", "=_", "subprocess_", "._", "Popen_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "\"", "es", "formatter", "\"_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "bufsize_", "=_", "160_", "*_", "len_", "(_", "self_", "._", "code_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "stdin_", "=_", "subprocess_", "._", "PIPE_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "stdout_", "=_", "subprocess_", "._", "PIPE_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "stderr_", "=_", "subprocess_", "._", "PIPE_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "start", "upi", "nfo_", "=_", "get", "Start", "up", "Info_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "ST", "2_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "stdout_", ",_", "stderr_", "=_", "process_", "._", "communicate_", "(_", "self_", "._", "code_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "result_", "=_", "re_", "._", "sub_", "(_", "r", "'(\\\\", "r", "|\\\\", "r", "\\\\", "n", "|\\\\", "n", ")\\\\", "Z", "'_", ",_", "''_", ",_", "stdout_", ")_", "._", "decode_", "(_", "'", "utf", "-", "8", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "stdout_", ",_", "stderr_", "=_", "process_", "._", "communicate_", "(_", "self_", "._", "code_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "result_", "=_", "re_", "._", "sub_", "(_", "r", "'(\\\\", "r", "|\\\\", "r", "\\\\", "n", "|\\\\", "n", ")\\\\", "Z", "'_", ",_", "''_", ",_", "str_", "(_", "stdout_", ",_", "encoding_", "=_", "'", "utf", "-", "8", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "stderr_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "result_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "ST", "2_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "self_", "._", "error_", "=_", "str_", "(_", "stderr_", "._", "decode_", "(_", "'", "utf", "-", "8", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "self_", "._", "error_", "=_", "str_", "(_", "stderr_", ",_", "encoding_", "=_", "'", "utf", "-", "8", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "result_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "error_", "=_", "str_", "(_", "e_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "Start", "up", "Info_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "ON", "\\u", "WINDOWS", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "info_", "=_", "subprocess_", "._", "START", "UP", "INFO_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "info_", "._", "dw", "Flags_", "|=_", "subprocess_", "._", "START", "F", "\\u", "USE", "SHOW", "WINDOW_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "info_", "._", "w", "Show", "Window_", "=_", "subprocess_", "._", "SW", "\\u", "HID", "E_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "info_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "File", "Path_", "(_", "view_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "path_", "=_", "view_", "._", "file", "\\u", "name_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "(_", "path_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "str_", "(_", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "''_", ";_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Es", "format", "Update", "Content_", "(_", "sublim", "e\\u", "plugin_", "._", "Text", "Command_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Es", "format", "Update", "Content_", "(_", "sublim", "e\\u", "plugin_", "._", "Text", "Command_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "run_", "(_", "self_", ",_", "edit_", ",_", "text_", "=_", "None_", ",_", "regions_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "text_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "view_", "._", "replace_", "(_", "edit_", ",_", "sublime_", "._", "Region_", "(_", "0_", ",_", "self_", "._", "view_", "._", "size_", "(_", ")_", ")_", ",_", "text_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "region_", "in_", "regions_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "view_", "._", "replace_", "(_", "edit_", ",_", "sublime_", "._", "Region_", "(_", "region_", "[_", "0_", "]_", ",_", "region_", "[_", "1_", "]_", ")_", ",_", "region_", "[_", "2_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Es", "format", "Event", "Listener_", "(_", "sublim", "e\\u", "plugin_", "._", "Event", "Listener_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Es", "format", "Event", "Listener_", "(_", "sublim", "e\\u", "plugin_", "._", "Event", "Listener_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "on", "\\u", "pre", "\\u", "save_", "(_", "self_", ",_", "view_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "global_", "AM", "\\u", "I", "\\u", "FORMAT", "TIN", "G", "\\u", "AFTER", "\\u", "SAVE", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "AM", "\\u", "I", "\\u", "FORMAT", "TIN", "G", "\\u", "AFTER", "\\u", "SAVE", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "AM", "\\u", "I", "\\u", "FORMAT", "TIN", "G", "\\u", "AFTER", "\\u", "SAVE", "_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "AM", "\\u", "I", "\\u", "FORMAT", "TIN", "G", "\\u", "AFTER", "\\u", "SAVE", "_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "settings_", "=_", "sublime_", "._", "load", "\\u", "settings_", "(_", "\"", "Es", "Formatt", "er", ".", "sublim", "e-", "settings", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "(_", "settings_", "._", "get_", "(_", "\"", "format\\u", "on", "\\u", "save", "\"_", ")_", "and_", "self_", "._", "is", "Javascript", "_", "(_", "view_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "view_", "._", "window_", "(_", ")_", "._", "run", "\\u", "command_", "(_", "\"", "es", "formatter", "\"_", ",_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "save", "\"_", ":_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "ignore", "Selecti", "on", "\"_", ":_", "True_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Es", "format", "Event", "Listener_", "(_", "sublim", "e\\u", "plugin_", "._", "Event", "Listener_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "is", "Javascript", "_", "(_", "self_", ",_", "view_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Check", " ", "the", " ", "file", " ", "extension_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "name_", "=_", "view_", "._", "file", "\\u", "name_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "(_", "name_", "and_", "os_", "._", "path_", "._", "splitext_", "(_", "name_", ")_", "[_", "1_", "]_", "[_", "1_", ":_", "]_", "in_", "[_", "\"", "js", "\"_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "If", " ", "it", " ", "has", " ", "no", " ", "name", " ", "(?", ")", " ", "or", " ", "it", "'", "s", " ", "not", " ", "a", " ", "JS", ",", " ", "check", " ", "the", " ", "syntax_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "syntax_", "=_", "view_", "._", "settings_", "(_", ")_", "._", "get_", "(_", "\"", "synta", "x", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "(_", "syntax_", "and_", "\"", "javascript", "\"_", "in_", "syntax_", "._", "split_", "(_", "\"/\"_", ")_", "[_", "-_", "1_", "]_", "._", "lower_", "(_", ")_", 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Based on the chosen Canada Post method, we will do our call(s) \n to Canada Post and see how much it will cost. We will also need \n to store the results for further parsing and return via the\n methods above.\n '''\n log.debug(\"Starting Canada Post calculations\")\n\n from satchmo_store.shop.models import Config\n settings = config_get_group('shipping.modules.canadapost')\n\n verbose = settings.VERBOSE_LOG.value\n \n self.delivery_days = _('3 - 4') #Default setting for ground delivery\n shop_details = Config.objects.get_current()\n self.packaging = ''\n self.is_valid = False\n error = False\n self.charges = 0\n\n if not settings.CPCID.value:\n log.warn(\"No CPCID found in settings\")\n return\n if settings.LIVE.value:\n connection = settings.CONNECTION.value\n else:\n connection = settings.CONNECTION_TEST.value\n \n configuration = {\n 'cpcid': settings.CPCID.value,\n 'turn_around_time': settings.TURN_AROUND_TIME.value,\n 'packaging': self.packaging,\n 'ship_type': self.service_type_code,\n 'shop_details':shop_details,\n }\n c = Context({\n 'config': configuration,\n 'cart': cart,\n 'contact': contact\n })\n \n t = loader.get_template('shipping/canadapost/request.xml')\n request = t.render(c)\n self.is_valid = False\n \n cache_key_response = \"canadapost-cart-%s-response\" % int(cart.id)\n cache_key_request = \"canadapost-cart-%s-request\" % int(cart.id)\n last_request = cache.get(cache_key_request)\n tree = cache.get(cache_key_response)\n \n if (last_request != request) or tree is None:\n self.verbose_log(\"Requesting from Canada Post [%s]\\n%s\", cache_key_request, request)\n cache.set(cache_key_request, request, 60)\n tree = self._process_request(connection, request)\n self.verbose_log(\"Got from Canada Post [%s]:\\n%s\", cache_key_response, self.raw)\n needs_cache = True\n else:\n needs_cache = False\n \n try:\n status_code = tree.getiterator('statusCode')\n status_val = status_code[0].text\n self.verbose_log(\"Canada Post Status Code for cart #%s = %s\", int(cart.id), status_val)\n except AttributeError:\n status_val = \"-1\"\n \n\n if status_val == '1':\n self.is_valid = False\n self._calculated = False\n all_rates = tree.getiterator('product')\n\n for rate in all_rates:\n self.verbose_log(\"Got product id from cp: %s\", rate.attrib['id'])\n if self.service_type_code == rate.attrib['id']:\n self.charges = Decimal(rate.find('.//rate').text)\n #YYYY-MM-DD\n delivery_date = rate.find('.//deliveryDate').text\n shipping_date = rate.find('.//shippingDate').text\n self.delivery_days = datetime.date(\n int(delivery_date[:4]),\n int(delivery_date[5:7]),\n int(delivery_date[8:])) - \\\n datetime.date(\n int(shipping_date[:4]),\n int(shipping_date[5:7]),\n int(shipping_date[8:]))\n self.delivery_days = self.delivery_days.days\n self.is_valid = True\n self._calculated = True\n\n if not self.is_valid:\n self.verbose_log(\"Canada Post Cannot find rate for code: %s [%s]\", self.service_type_code, self.service_type_text)", "metadata": "root.Shipper.calculate", "header": "['class', 'Shipper', '(', 'BaseShipper', ')', ':', '___EOS___']", "index": 109 } ]
[ { "span": "verbose ", "start_line": 121, "start_column": 8, "end_line": 121, "end_column": 15 }, { "span": "error ", "start_line": 127, "start_column": 8, "end_line": 127, "end_column": 13 }, { "span": "needs_cache ", "start_line": 165, "start_column": 12, "end_line": 165, "end_column": 23 }, { "span": "needs_cache ", "start_line": 167, "start_column": 12, "end_line": 167, "end_column": 23 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "Ship", "per_", "(_", "Base", "Ship", "per_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "calculate_", "(_", "self_", ",_", "cart_", ",_", "contact_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "\\", "10", ";", " ", " ", "Base", "d", " ", "on", " ", "the", " ", "chosen", " ", "Cana", "da", " ", "Post", " ", "method", ",", " ", "we", " ", "will", " ", "do", " ", "our", " ", "call", "(", "s", ")", " ", "\\", "10", ";", " ", " ", "to", " ", "Cana", "da", " ", "Post", " ", "and", " ", "see", " ", "how", " ", "muc", "h", " ", "it", " ", "will", " ", "cost", ".", " ", "We", " ", "will", " ", "als", "o", " ", "need", " ", "\\", "10", ";", " ", " ", "to", " ", "store", " ", "the", " ", "results", " ", "for", " ", "fur", "ther", " ", "pars", "ing", " ", "and", " ", "return", " ", "via", " ", "the", "\\", "10", ";", " ", " ", "method", "s", " ", "above", ".", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "log_", "._", "debug_", "(_", "\"", "Start", "ing", " ", "Cana", "da", " ", "Post", " ", "calculati", "ons", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "sat", "chm", "o", "\\u", "store_", "._", "shop", "_", "._", "models_", "import_", "Config_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "settings_", "=_", "config", "\\u", "get", "\\u", "group_", "(_", "'", "shipping", ".", "module", "s", ".", "can", "ada", "post", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "verbose_", "=_", "settings_", "._", "VERBOS", "E", "\\u", "LOG_", "._", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "delivery", "\\u", "days_", "=_", "\\u_", "(_", "'", "3", " ", "-", " ", "4", "'_", ")_", "#", "Default", " ", "setti", "ng", " ", "for", " ", "ground", " ", "delivery", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "shop", "\\u", "details_", "=_", "Config_", "._", "objects_", "._", "get", "\\u", "current_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "packaging", "_", "=_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "is", "\\u", "valid_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "error_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "charges_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "settings_", "._", "CP", "CID", "_", "._", "value_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "log_", "._", "warn_", "(_", "\"", "No", " ", "CP", "CID", " ", "found", " ", "in", " ", "settings", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "settings_", "._", "LIVE", "_", "._", "value_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "connection_", "=_", "settings_", "._", "CONNECTION", "_", "._", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "connection_", "=_", "settings_", "._", "CONNECTION", "\\u", "TEST_", "._", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "configuration_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "cpc", "id", "'_", ":_", "settings_", "._", "CP", "CID", "_", "._", "value_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "turn", "\\u", "aro", "und", "\\u", "time", "'_", ":_", "settings_", "._", "TURN", "\\u", "AR", "OUN", "D", "\\u", "TIME_", "._", "value_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "packaging", "'_", ":_", "self_", "._", "packaging", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "ship", "\\u", "type", "'_", ":_", "self_", "._", "service", "\\u", "type", "\\u", "code_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "shop", "\\u", "deta", "il", "s", "'_", ":_", "shop", "\\u", "details_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "c_", "=_", "Context_", "(_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "config", "'_", ":_", "configuration_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "cart", "'_", ":_", "cart_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "contact", "'_", ":_", "contact_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "t_", "=_", "loader_", "._", "get", "\\u", "template_", "(_", "'", "shipping", "/", "can", "ada", "post", "/", "request", ".", "xml", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "request_", "=_", "t_", "._", "render_", "(_", "c_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "is", "\\u", "valid_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "cache", "\\u", "key", "\\u", "response_", "=_", "\"", "can", "ada", "post", "-", "cart", "-%", "s", "-", "response", "\"_", "%_", "int_", "(_", "cart_", "._", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cache", "\\u", "key", "\\u", "request_", "=_", "\"", "can", "ada", "post", "-", "cart", "-%", "s", "-", "request", "\"_", "%_", "int_", "(_", "cart_", "._", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "last", "\\u", "request_", "=_", "cache_", "._", "get_", "(_", "cache", "\\u", "key", "\\u", "request_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tree_", "=_", "cache_", "._", "get_", "(_", "cache", "\\u", "key", "\\u", "response_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "(_", "last", "\\u", "request_", "!=_", "request_", ")_", "or_", "tree_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "verbo", "se", "\\u", "log_", "(_", "\"", "Request", "ing", " ", "from", " ", "Cana", "da", " ", "Post", " ", "[", "%", "s", "]\\\\", "n", "%", "s", "\"_", ",_", "cache", "\\u", "key", "\\u", "request_", ",_", "request_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cache_", "._", "set_", "(_", "cache", "\\u", "key", "\\u", "request_", ",_", "request_", ",_", "60_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tree_", "=_", "self_", "._", "\\u", "process", "\\u", "request_", "(_", "connection_", ",_", "request_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "verbo", "se", "\\u", "log_", "(_", "\"", "Got", " ", "from", " ", "Cana", "da", " ", "Post", " ", "[", "%", "s", "]:", "\\\\", "n", "%", "s", "\"_", ",_", "cache", "\\u", "key", "\\u", "response_", ",_", "self_", "._", "raw_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "need", "s", "\\u", "cache_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "need", "s", "\\u", "cache_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "status", "\\u", "code_", "=_", "tree_", "._", "geti", "tera", "tor_", "(_", "'", "status", "Code", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "status", "\\u", "val_", "=_", "status", "\\u", "code_", "[_", "0_", "]_", "._", "text_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "verbo", "se", "\\u", "log_", "(_", "\"", "Cana", "da", " ", "Post", " ", "Status", " ", "Code", " ", "for", " ", "cart", " ", "#", "%", "s", " ", "=", " ", "%", "s", "\"_", ",_", "int_", "(_", "cart_", "._", "id_", ")_", ",_", "status", "\\u", "val_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Attribute", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "status", "\\u", "val_", "=_", "\"-", "1", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "status", "\\u", "val_", "==_", "'", "1", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "is", "\\u", "valid_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "calculated", "_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "all", "\\u", "rates_", "=_", "tree_", "._", "geti", "tera", "tor_", "(_", "'", "product", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "rate_", "in_", "all", "\\u", "rates_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "verbo", "se", "\\u", "log_", "(_", "\"", "Got", " ", "product", " ", "id", " ", "from", " ", "cp", ":", " ", "%", "s", "\"_", ",_", "rate_", "._", "attrib_", "[_", "'", "id", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "service", "\\u", "type", "\\u", "code_", "==_", "rate_", "._", "attrib_", "[_", "'", "id", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "self_", "._", "charges_", "=_", "Decimal_", "(_", "rate_", "._", "find_", "(_", "'./", "/", "rate", "'_", ")_", "._", "text_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "YYY", "Y", "-", "MM", "-", "DD", "_", "\\u\\u\\uNL\\u\\u\\u_", "delivery", "\\u", "date_", "=_", "rate_", "._", "find_", "(_", "'./", "/", "delivery", "Date", "'_", ")_", "._", "text_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "shipping", "\\u", "date_", "=_", "rate_", "._", "find_", "(_", "'./", "/", "shipping", "Date", "'_", ")_", "._", "text_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "delivery", "\\u", "days_", "=_", "datetime_", "._", "date_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "int_", "(_", "delivery", "\\u", "date_", "[_", ":_", "4_", "]_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "int_", "(_", "delivery", "\\u", "date_", "[_", "5_", ":_", "7_", "]_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "int_", "(_", "delivery", "\\u", "date_", "[_", "8_", ":_", "]_", ")_", ")_", "-_", "datetime_", "._", "date_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "int_", "(_", "shipping", "\\u", "date_", "[_", ":_", "4_", "]_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "int_", "(_", "shipping", "\\u", "date_", "[_", "5_", ":_", "7_", "]_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "int_", "(_", "shipping", "\\u", "date_", "[_", "8_", ":_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "delivery", "\\u", "days_", "=_", "self_", "._", "delivery", "\\u", "days_", "._", "days_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "is", "\\u", "valid_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "calculated", "_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "self_", "._", "is", "\\u", "valid_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "verbo", "se", "\\u", "log_", "(_", "\"", "Cana", "da", " ", "Post", " ", "Cann", "ot", " ", "find", " ", "rate", " ", "for", " ", "code", ":", " ", "%", "s", " ", "[", "%", "s", "]\"_", ",_", "self_", "._", "service", "\\u", "type", "\\u", "code_", ",_", "self_", "._", "service", "\\u", "type", "\\u", "text_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2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2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Variable defined multiple times
statsmodels/statsmodels/statsmodels/examples/try_fit_constrained.py
[ { "content": "# -*- coding: utf-8 -*-\n\"\"\"\nCreated on Fri May 30 22:56:57 2014\n\nAuthor: Josef Perktold\nLicense: BSD-3\n\n\"\"\"\n\nimport numpy as np\nfrom numpy.testing import assert_allclose, assert_raises\n\nfrom statsmodels.base._constraints import (TransformRestriction,\n transform_params_constraint, fit_constrained)\n\n\nif __name__ == '__main__':\n\n\n\n R = np.array([[1, 1, 0, 0, 0], [0, 0, 1, -1, 0]])\n\n\n\n k_constr, k_vars = R.shape\n\n m = np.eye(k_vars) - R.T.dot(np.linalg.pinv(R).T)\n evals, evecs = np.linalg.eigh(m)\n\n L = evecs[:, :k_constr]\n T = evecs[:, k_constr:]\n\n print T.T.dot(np.eye(k_vars))\n\n tr = np.column_stack((T, R.T))\n\n q = [2, 0]\n tr0 = TransformRestriction(R, q)\n\n p_reduced = [1,1,1]\n #round trip test\n assert_allclose(tr0.reduce(tr0.expand(p_reduced)), p_reduced, rtol=1e-14)\n\n\n p = tr0.expand(p_reduced)\n assert_allclose(R.dot(p), q, rtol=1e-14)\n\n # inconsistent restrictions\n #Ri = np.array([[1, 1, 0, 0, 0], [0, 0, 1, -1, 0], [0, 0, 1, -2, 0]])\n R = np.array([[1, 1, 0, 0, 0], [0, 0, 1, -1, 0], [0, 0, 1, 0, -1]])\n q = np.zeros(R.shape[0])\n tr1 = TransformRestriction(R, q) # bug raises error with q\n p = tr1.expand([1,1])\n\n # inconsistent restrictions that has a solution with p3=0\n Ri = np.array([[1, 1, 0, 0, 0], [0, 0, 1, -1, 0], [0, 0, 1, -2, 0]])\n tri = TransformRestriction(Ri, [0, 1, 1])\n # Note: the only way this can hold is if variable 3 is zero\n p = tri.expand([1,1])\n print(p[[2,3]])\n #array([ 1.00000000e+00, -1.34692639e-17])\n\n # inconsistent without any possible solution\n Ri2 = np.array([[0, 0, 0, 1, 0], [0, 0, 1, -1, 0], [0, 0, 1, -2, 0]])\n q = [1, 1]\n #tri2 = TransformRestriction(Ri2, q)\n #p = tri.expand([1,1])\n assert_raises(ValueError, TransformRestriction, Ri2, q)\n # L doesn't have full row rank, calculating constant fails with Singular Matrix\n\n # transform data xr = T x\n np.random.seed(1)\n x = np.random.randn(10, 5)\n xr = tr1.reduce(x)\n # roundtrip\n x2 = tr1.expand(xr)\n # this doesn't hold ? don't use constant? don't need it anyway ?\n #assert_allclose(x2, x, rtol=1e-14)\n\n\n from patsy import DesignInfo\n\n names = 'a b c d'.split()\n LC = DesignInfo(names).linear_constraint('a + b = 0')\n LC = DesignInfo(names).linear_constraint(['a + b = 0', 'a + 2*c = 1', 'b-a', 'c-a', 'd-a'])\n #LC = DesignInfo(self.model.exog_names).linear_constraint(r_matrix)\n r_matrix, q_matrix = LC.coefs, LC.constants\n\n np.random.seed(123)\n nobs = 20\n x = 1 + np.random.randn(nobs, 4)\n exog = np.column_stack((np.ones(nobs), x))\n endog = exog.sum(1) + np.random.randn(nobs)\n\n from statsmodels.regression.linear_model import OLS\n res2 = OLS(endog, exog).fit()\n #transf = TransformRestriction(np.eye(exog.shape[1])[:2], res2.params[:2] / 2)\n transf = TransformRestriction([[0, 0, 0,1,1]], res2.params[-2:].sum())\n exog_st = transf.reduce(exog)\n res1 = OLS(endog, exog_st).fit()\n # need to correct for constant/offset in the optimization\n res1 = OLS(endog - exog.dot(transf.constant.squeeze()), exog_st).fit()\n params = transf.expand(res1.params).squeeze()\n assert_allclose(params, res2.params, rtol=1e-13)\n print(res2.params)\n print(params)\n print(res1.params)\n\n res3_ols = OLS(endog - exog[:, -1], exog[:, :-2]).fit()\n #transf = TransformRestriction(np.eye(exog.shape[1])[:2], res2.params[:2] / 2)\n transf3 = TransformRestriction([[0, 0, 0, 1, 0],[0, 0, 0, 0, 1]], [0, 1])\n exog3_st = transf3.reduce(exog)\n res3 = OLS(endog, exog3_st).fit()\n # need to correct for constant/offset in the optimization\n res3 = OLS(endog - exog.dot(transf3.constant.squeeze()), exog3_st).fit()\n params = transf3.expand(res3.params).squeeze()\n assert_allclose(params[:-2], res3_ols.params, rtol=1e-13)\n print(res3.params)\n print(params)\n print(res3_ols.params)\n print(res3_ols.bse)\n # the following raises `ValueError: can't test a constant constraint`\n #tt = res3.t_test(transf3.transf_mat, transf3.constant.squeeze())\n #print tt.sd\n cov_params3 = transf3.transf_mat.dot(res3.cov_params()).dot(transf3.transf_mat.T)\n bse3 = np.sqrt(np.diag(cov_params3))\n print(bse3)\n\n tp = transform_params_constraint(res2.params, res2.normalized_cov_params,\n transf3.R, transf3.q)\n tp = transform_params_constraint(res2.params, res2.cov_params(), transf3.R, transf3.q)\n\n\n from statsmodels.discrete.discrete_model import Poisson\n import statsmodels.api as sm\n rand_data = sm.datasets.randhie.load()\n rand_exog = rand_data.exog.view(float).reshape(len(rand_data.exog), -1)\n rand_exog = sm.add_constant(rand_exog, prepend=False)\n\n\n # Fit Poisson model:\n poisson_mod0 = sm.Poisson(rand_data.endog, rand_exog)\n poisson_res0 = poisson_mod0.fit(method=\"newton\")\n\n R = np.zeros((2, 10))\n R[0, -2] = 1\n R[1, -1] = 1\n transfp = TransformRestriction(R, [0, 1])\n poisson_mod = sm.Poisson(rand_data.endog, rand_exog[:, :-2])\n # note wrong offset, why did I put offset in fit ? it's ignored\n poisson_res = poisson_mod.fit(method=\"newton\", offset=rand_exog.dot(transfp.constant.squeeze()))\n\n exogp_st = transfp.reduce(rand_exog)\n poisson_modr = sm.Poisson(rand_data.endog, exogp_st)\n poisson_resr = poisson_modr.fit(method=\"newton\")\n paramsp = transfp.expand(poisson_resr.params).squeeze()\n print('\\nPoisson')\n print(paramsp)\n print(poisson_res.params)\n # error because I don't use the unconstrained basic model\n# tp = transform_params_constraint(poisson_res.params, poisson_res.cov_params(), transfp.R, transfp.q)\n# cov_params3 = transf3.transf_mat.dot(res3.cov_params()).dot(transf3.transf_mat.T)\n# bse3 = np.sqrt(np.diag(cov_params3))\n\n\n poisson_mod0 = sm.Poisson(rand_data.endog, rand_exog)\n poisson_res0 = poisson_mod0.fit(method=\"newton\")\n tp = transform_params_constraint(poisson_res0.params, poisson_res0.cov_params(), transfp.R, transfp.q)\n cov_params3 = transf3.transf_mat.dot(res3.cov_params()).dot(transf3.transf_mat.T)\n bse3 = np.sqrt(np.diag(cov_params3))\n\n # try again same example as it was intended\n\n poisson_mod = sm.Poisson(rand_data.endog, rand_exog[:, :-2], offset=rand_exog[:, -1])\n poisson_res = poisson_mod.fit(method=\"newton\")\n\n exogp_st = transfp.reduce(rand_exog)\n poisson_modr = sm.Poisson(rand_data.endog, exogp_st, offset=rand_exog.dot(transfp.constant.squeeze()))\n poisson_resr = poisson_modr.fit(method=\"newton\")\n paramsp = transfp.expand(poisson_resr.params).squeeze()\n print('\\nPoisson')\n print(paramsp)\n print(poisson_resr.params)\n tp = transform_params_constraint(poisson_res0.params, poisson_res0.cov_params(), transfp.R, transfp.q)\n cov_paramsp = transfp.transf_mat.dot(poisson_resr.cov_params()).dot(transfp.transf_mat.T)\n bsep = np.sqrt(np.diag(cov_paramsp))\n print(bsep)\n p, cov, res_r = fit_constrained(poisson_mod0, transfp.R, transfp.q)\n se = np.sqrt(np.diag(cov))\n print(p)\n print(se)\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[ { "span": "p ", "start_line": 52, "start_column": 4, "end_line": 52, "end_column": 5 }, { "span": "LC ", "start_line": 83, "start_column": 4, "end_line": 83, "end_column": 6 }, { "span": "res1 ", "start_line": 99, "start_column": 4, "end_line": 99, "end_column": 8 }, { "span": "res3 ", "start_line": 112, "start_column": 4, "end_line": 112, "end_column": 8 }, { "span": "tp ", "start_line": 128, "start_column": 4, "end_line": 128, "end_column": 6 }, { "span": "tp ", "start_line": 130, "start_column": 4, "end_line": 130, "end_column": 6 }, { "span": "poisson_res0 ", "start_line": 142, "start_column": 4, "end_line": 142, "end_column": 16 }, { "span": "tp ", "start_line": 167, "start_column": 4, "end_line": 167, "end_column": 6 } ]
[ { "span": "LC ", "start_line": 84, "start_column": 4, "end_line": 84, "end_column": 6 }, { "span": "res1 ", "start_line": 101, "start_column": 4, "end_line": 101, "end_column": 8 }, { "span": "res3 ", "start_line": 114, "start_column": 4, "end_line": 114, "end_column": 8 }, { "span": "poisson_res0 ", "start_line": 166, "start_column": 4, "end_line": 166, "end_column": 16 }, { "span": "tp ", "start_line": 183, "start_column": 4, "end_line": 183, "end_column": 6 } ]
1
true
[ "[CLS]_", "Variable_", "defined_", "multiple_", "times_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "-*-", " ", "codi", "ng", ":", " ", "utf", "-", "8", " ", "-*-", "_", "\\u\\u\\uNL\\u\\u\\u_", "\"\"\"", "\\", "10", ";", "Creat", "ed", " ", "on", " ", "Fri", " ", "Ma", "y", " ", "30", " ", "2", "2", ":", "56", ":", "5", "7", " ", "2014", "\\", "10", ";", "\\", "10", ";", "Author", ":", " ", "Jos", "ef", " ", "Per", "kto", "ld", "\\", "10", ";", "License", ":", " ", "BS", "D", "-", "3", "\\", "10", ";", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "numpy_", "as_", "np_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "numpy_", "._", "testing_", "import_", "assert", "\\u", "allclose_", ",_", "assert", "\\u", "raises_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "stats", "models_", "._", "base_", "._", "\\u", "constraints_", "import_", "(_", "Transform", "Restriction", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "transform", "\\u", "params", "\\u", "constraint_", ",_", "fit", "\\u", "constrained", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "\\u\\u", "name\\u\\u_", "==_", "'\\u", "\\u", "main", "\\u\\u'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "R_", "=_", "np_", "._", "array_", "(_", "[_", "[_", "1_", ",_", "1_", ",_", "0_", ",_", "0_", ",_", "0_", "]_", ",_", "[_", "0_", ",_", "0_", ",_", "1_", ",_", "-_", "1_", ",_", "0_", "]_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "k", "\\u", "constr", "_", ",_", "k", "\\u", "vars_", "=_", "R_", "._", "shape_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "m_", "=_", "np_", "._", "eye_", "(_", "k", "\\u", "vars_", ")_", "-_", "R_", "._", "T_", "._", "dot_", "(_", "np_", "._", "linalg_", "._", "pin", "v_", "(_", "R_", ")_", "._", "T_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "evals_", ",_", "eve", "cs_", "=_", "np_", "._", "linalg_", "._", "eig", "h_", "(_", "m_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "L_", "=_", "eve", "cs_", "[_", ":_", ",_", ":_", "k", "\\u", "constr", "_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "T_", "=_", "eve", "cs_", "[_", ":_", ",_", "k", "\\u", "constr", "_", ":_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "print_", "T_", "._", "T_", "._", "dot_", "(_", "np_", "._", "eye_", "(_", "k", "\\u", "vars_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "tr_", "=_", "np_", "._", "column", "\\u", "stack_", "(_", "(_", "T_", ",_", "R_", "._", "T_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "q_", "=_", "[_", "2_", ",_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tr", "0_", "=_", "Transform", "Restriction", "_", "(_", "R_", ",_", "q_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "p", "\\u", "reduced_", "=_", "[_", "1_", ",_", "1_", ",_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "round", " ", "trip", " ", "test_", "\\u\\u\\uNL\\u\\u\\u_", "assert", "\\u", "allclose_", "(_", "tr", "0_", "._", "reduce_", "(_", "tr", "0_", "._", "expand_", "(_", "p", "\\u", "reduced_", ")_", ")_", ",_", "p", "\\u", "reduced_", ",_", "rtol_", "=_", "1e-1", "4_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "p_", "=_", "tr", "0_", "._", "expand_", "(_", "p", "\\u", "reduced_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "allclose_", "(_", "R_", "._", "dot_", "(_", "p_", ")_", ",_", "q_", ",_", "rtol_", "=_", "1e-1", "4_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "inconsistent", " ", "restriction", "s_", "\\u\\u\\uNL\\u\\u\\u_", "#", "Ri", " ", "=", " ", "np", ".", "array", "([", "[", "1", ",", " ", "1", ",", " ", "0", ",", " ", "0", ",", " ", "0", "],", " ", "[", "0", ",", " ", "0", ",", " ", "1", ",", " ", "-1", ",", " ", "0", "],", " ", "[", "0", ",", " ", "0", ",", " ", "1", ",", " ", "-", "2", ",", " ", "0", "]])", "_", "\\u\\u\\uNL\\u\\u\\u_", "R_", "=_", "np_", "._", "array_", "(_", "[_", "[_", "1_", ",_", "1_", ",_", "0_", ",_", "0_", ",_", "0_", "]_", ",_", "[_", "0_", ",_", "0_", ",_", "1_", ",_", "-_", "1_", ",_", "0_", "]_", ",_", "[_", "0_", ",_", "0_", ",_", "1_", ",_", "0_", ",_", "-_", "1_", "]_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "q_", "=_", "np_", "._", "zeros_", "(_", "R_", "._", "shape_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tr", "1_", "=_", "Transform", "Restriction", "_", "(_", "R_", ",_", "q_", ")_", "#", " ", "bug", " ", "raise", "s", " ", "error", " ", "with", " ", "q_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "p_", "=_", "tr", "1_", "._", "expand_", "(_", "[_", "1_", ",_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "inconsistent", " ", "restriction", "s", " ", "tha", "t", " ", "has", " ", "a", " ", "solut", "ion", " ", "with", " ", "p3", "=", "0_", "\\u\\u\\uNL\\u\\u\\u_", "Ri", "_", "=_", "np_", "._", "array_", "(_", "[_", "[_", "1_", ",_", "1_", ",_", "0_", ",_", "0_", ",_", "0_", "]_", ",_", "[_", "0_", ",_", "0_", ",_", "1_", ",_", "-_", "1_", ",_", "0_", "]_", ",_", "[_", "0_", ",_", "0_", ",_", "1_", ",_", "-_", "2_", ",_", "0_", "]_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tri_", "=_", "Transform", "Restriction", "_", "(_", "Ri", "_", ",_", "[_", "0_", ",_", "1_", ",_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Not", "e", ":", " ", "the", " ", "only", " ", "way", " ", "this", " ", "can", " ", "hold", " ", "is", " ", "if", " ", "variab", "le", " ", "3", " ", "is", " ", "zero_", "\\u\\u\\uNL\\u\\u\\u_", "p_", "=_", "tri_", "._", "expand_", "(_", "[_", "1_", ",_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "p_", "[_", "[_", "2_", ",_", "3_", "]_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "array", "([", " ", " ", "1.000000", "00", "e+0", "0", ",", " ", " ", "-1", ".3", "469", "263", "9e", "-1", "7", "])", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "inconsistent", " ", "with", "out", " ", "any", " ", "possib", "le", " ", "solution_", "\\u\\u\\uNL\\u\\u\\u_", "Ri", "2_", "=_", "np_", "._", "array_", "(_", "[_", "[_", "0_", ",_", "0_", ",_", "0_", ",_", "1_", ",_", "0_", "]_", ",_", "[_", "0_", ",_", "0_", ",_", "1_", ",_", "-_", "1_", ",_", "0_", "]_", ",_", "[_", "0_", ",_", "0_", ",_", "1_", ",_", "-_", "2_", ",_", "0_", "]_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "q_", "=_", "[_", "1_", ",_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "tri", "2", " ", "=", " ", "Transform", "Restriction", "(", "Ri", "2", ",", " ", "q", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", "p", " ", "=", " ", "tri", ".", "expand", "([", "1", ",", "1", "])", "_", "\\u\\u\\uNL\\u\\u\\u_", "assert", "\\u", "raises_", "(_", "Value", "Error_", ",_", "Transform", "Restriction", "_", ",_", "Ri", "2_", ",_", "q_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "L", " ", "doe", "sn", "'", "t", " ", "have", " ", "full", " ", "row", " ", "rank", ",", " ", "calculati", "ng", " ", "constant", " ", "fail", "s", " ", "with", " ", "Sing", "ular", " ", "Matrix_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "transform", " ", "data", " ", "xr", " ", "=", " ", "T", " ", "x_", "\\u\\u\\uNL\\u\\u\\u_", "np_", "._", "random_", "._", "seed_", "(_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "x_", "=_", "np_", "._", "random_", "._", "randn_", "(_", "10_", ",_", "5_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xr_", "=_", "tr", "1_", "._", "reduce_", "(_", "x_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "roundtrip", "_", "\\u\\u\\uNL\\u\\u\\u_", "x2_", "=_", "tr", "1_", "._", "expand_", "(_", "xr_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "this", " ", "doe", "sn", "'", "t", " ", "hold", " ", "?", " ", "don", "'", "t", " ", "use", " ", "constant", "?", " ", "don", "'", "t", " ", "need", " ", "it", " ", "anyway", " ", "?", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "assert", "\\u", "allc", "lose", "(", "x2", ",", " ", "x", ",", " ", "rto", "l", "=", "1e-1", "4", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "pat", "sy_", "import_", "Desig", "n", "Info_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "names_", "=_", "'", "a", " ", "b", " ", "c", " ", "d", "'_", "._", "split_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "LC", "_", "=_", "Desig", "n", "Info_", "(_", "names_", ")_", "._", "linear", "\\u", "constraint_", "(_", "'", "a", " ", "+", " ", "b", " ", "=", " ", "0", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "LC", "_", "=_", "Desig", "n", "Info_", "(_", "names_", ")_", "._", "linear", "\\u", "constraint_", "(_", "[_", "'", "a", " ", "+", " ", "b", " ", "=", " ", "0", "'_", ",_", "'", "a", " ", "+", " ", "2", "*", "c", " ", "=", " ", "1", "'_", ",_", "'", "b", "-", "a", "'_", ",_", "'", "c", "-", "a", "'_", ",_", "'", "d", "-", "a", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "LC", " ", "=", " ", "Desig", "n", "Info", "(", "self", ".", "model", ".", "exo", "g", "\\u", "names", ").", "linear", "\\u", "constraint", "(", "r", "\\u", "matrix", ")_", "\\u\\u\\uNL\\u\\u\\u_", "r", "\\u", "matrix_", ",_", "q", "\\u", "matrix_", "=_", "LC", "_", "._", "coefs_", ",_", "LC", "_", "._", "constants_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "np_", "._", "random_", "._", "seed_", "(_", "123_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "nob", "s_", "=_", "20_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "x_", "=_", "1_", "+_", "np_", "._", "random_", "._", "randn_", "(_", "nob", "s_", ",_", "4_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "exo", "g_", "=_", "np_", "._", "column", "\\u", "stack_", "(_", "(_", "np_", "._", "ones_", "(_", "nob", "s_", ")_", ",_", "x_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "endo", "g_", "=_", "exo", "g_", "._", "sum_", "(_", "1_", ")_", "+_", "np_", "._", "random_", "._", "randn_", "(_", "nob", "s_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "stats", "models_", "._", "regression_", "._", "linear", "\\u", "model_", "import_", "OL", "S_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res2_", "=_", "OL", "S_", "(_", "endo", "g_", ",_", "exo", "g_", ")_", "._", "fit_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "transf", " ", "=", " ", "Transform", "Restriction", "(", "np", ".", "eye", "(", "exo", "g", ".", "shape", "[", "1", "])", "[:", "2", "],", " ", "res", "2", ".", "params", "[:", "2", "]", " ", "/", " ", "2", ")_", "\\u\\u\\uNL\\u\\u\\u_", "transf", "_", "=_", "Transform", "Restriction", "_", "(_", "[_", "[_", "0_", ",_", "0_", ",_", "0_", ",_", "1_", ",_", "1_", "]_", "]_", ",_", "res2_", "._", "params_", "[_", "-_", "2_", ":_", "]_", "._", "sum_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "exo", "g", "\\u", "st_", "=_", "transf", "_", "._", "reduce_", "(_", "exo", "g_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res1_", "=_", "OL", "S_", "(_", "endo", "g_", ",_", "exo", "g", "\\u", "st_", ")_", "._", "fit_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "need", " ", "to", " ", "correct", " ", "for", " ", "constant", "/", "offset", " ", "in", " ", "the", " ", "optimization", "_", "\\u\\u\\uNL\\u\\u\\u_", "res1_", "=_", "OL", "S_", "(_", "endo", "g_", "-_", "exo", "g_", "._", "dot_", "(_", "transf", "_", "._", "constant_", "._", "squeeze_", "(_", ")_", ")_", ",_", "exo", "g", "\\u", "st_", ")_", "._", "fit_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "params_", "=_", "transf", "_", "._", "expand_", "(_", "res1_", "._", "params_", ")_", "._", "squeeze_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "allclose_", "(_", "params_", ",_", "res2_", "._", "params_", ",_", "rtol_", "=_", "1e-1", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "res2_", "._", "params_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "params_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "res1_", "._", "params_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "res", "3", "\\u", "ols_", "=_", "OL", "S_", "(_", "endo", "g_", "-_", "exo", "g_", "[_", ":_", ",_", "-_", "1_", "]_", ",_", "exo", "g_", "[_", ":_", ",_", ":_", "-_", "2_", "]_", ")_", "._", "fit_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "transf", " ", "=", " ", "Transform", "Restriction", "(", "np", ".", "eye", "(", "exo", "g", ".", "shape", "[", "1", "])", "[:", "2", "],", " ", "res", "2", ".", "params", "[:", "2", "]", " ", "/", " ", "2", ")_", "\\u\\u\\uNL\\u\\u\\u_", "transf", "3_", "=_", "Transform", "Restriction", "_", "(_", "[_", "[_", "0_", ",_", "0_", ",_", "0_", ",_", "1_", ",_", "0_", "]_", ",_", "[_", "0_", ",_", "0_", ",_", "0_", ",_", "0_", ",_", "1_", "]_", "]_", ",_", "[_", "0_", ",_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "exo", "g3", "\\u", "st_", "=_", "transf", "3_", "._", "reduce_", "(_", "exo", "g_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res", "3_", "=_", "OL", "S_", "(_", "endo", "g_", ",_", "exo", "g3", "\\u", "st_", ")_", "._", "fit_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "need", " ", "to", " ", "correct", " ", "for", " ", "constant", "/", "offset", " ", "in", " ", "the", " ", "optimization", "_", "\\u\\u\\uNL\\u\\u\\u_", "res", "3_", "=_", "OL", "S_", "(_", "endo", "g_", "-_", "exo", "g_", "._", "dot_", "(_", "transf", "3_", "._", "constant_", "._", "squeeze_", "(_", ")_", ")_", ",_", "exo", "g3", "\\u", "st_", ")_", "._", "fit_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "params_", "=_", "transf", "3_", "._", "expand_", "(_", "res", "3_", "._", "params_", ")_", "._", "squeeze_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "allclose_", "(_", "params_", "[_", ":_", "-_", "2_", "]_", ",_", "res", "3", "\\u", "ols_", "._", "params_", ",_", "rtol_", "=_", "1e-1", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "res", "3_", "._", "params_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "params_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "res", "3", "\\u", "ols_", "._", "params_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "res", "3", "\\u", "ols_", "._", "bse", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "the", " ", "follow", "ing", " ", "raise", "s", " ", "`", "Value", "Error", ":", " ", "can", "'", "t", " ", "test", " ", "a", " ", "constant", " ", "constraint", "`_", "\\u\\u\\uNL\\u\\u\\u_", "#", "tt", " ", "=", " ", "res", "3", ".", "t", "\\u", "test", "(", "transf", "3", ".", "transf", "\\u", "mat", ",", " ", "transf", "3", ".", "constant", ".", "squeeze", "())", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "print", " ", "tt", ".", "sd_", "\\u\\u\\uNL\\u\\u\\u_", "cov", "\\u", "params", "3_", "=_", "transf", "3_", "._", "transf", "\\u", "mat_", "._", "dot_", "(_", "res", "3_", "._", "cov", "\\u", "params_", "(_", ")_", ")_", "._", "dot_", "(_", "transf", "3_", "._", "transf", "\\u", "mat_", "._", "T_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bse", "3_", "=_", "np_", "._", "sqrt_", "(_", "np_", "._", "diag_", "(_", "cov", "\\u", "params", "3_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "bse", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "tp_", "=_", "transform", "\\u", "params", "\\u", "constraint_", "(_", "res2_", "._", "params_", ",_", "res2_", "._", "normali", "zed", "\\u", "cov", "\\u", "params_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "transf", "3_", "._", "R_", ",_", "transf", "3_", "._", "q_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tp_", "=_", "transform", "\\u", "params", "\\u", "constraint_", "(_", "res2_", "._", "params_", ",_", "res2_", "._", "cov", "\\u", "params_", "(_", ")_", ",_", "transf", "3_", "._", "R_", ",_", "transf", "3_", "._", "q_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "stats", "models_", "._", "discrete", "_", "._", "discrete", "\\u", "model_", "import_", "Pois", "son_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "stats", "models_", "._", "api_", "as_", "sm_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rand", "\\u", "data_", "=_", "sm_", "._", "datasets_", "._", "rand", "hi", "e_", "._", "load_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rand", "\\u", "exo", "g_", "=_", "rand", "\\u", "data_", "._", "exo", "g_", "._", "view_", "(_", "float_", ")_", "._", "reshape_", "(_", "len_", "(_", "rand", "\\u", "data_", "._", "exo", "g_", ")_", ",_", "-_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rand", "\\u", "exo", "g_", "=_", "sm_", "._", "add", "\\u", "constant_", "(_", "rand", "\\u", "exo", "g_", ",_", "prepend", "_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Fit", " ", "Pois", "son", " ", "model", ":_", "\\u\\u\\uNL\\u\\u\\u_", "poisson", "\\u", "mod", "0_", "=_", "sm_", "._", "Pois", "son_", "(_", "rand", "\\u", "data_", "._", "endo", "g_", ",_", "rand", "\\u", "exo", "g_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "poisson", "\\u", "res", "0_", "=_", "poisson", "\\u", "mod", "0_", "._", "fit_", "(_", "method_", "=_", "\"", "newton", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "R_", "=_", "np_", "._", "zeros_", "(_", "(_", "2_", ",_", "10_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "R_", "[_", "0_", ",_", "-_", "2_", "]_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "R_", "[_", "1_", ",_", "-_", "1_", "]_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "transf", "p_", "=_", "Transform", "Restriction", "_", "(_", "R_", ",_", "[_", "0_", ",_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "poisson", "\\u", "mod_", "=_", "sm_", "._", "Pois", "son_", "(_", "rand", "\\u", "data_", "._", "endo", "g_", ",_", "rand", "\\u", "exo", "g_", "[_", ":_", ",_", ":_", "-_", "2_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "note", " ", "wrong", " ", "offset", ",", " ", "wh", "y", " ", "did", " ", "I", " ", "put", " ", "offset", " ", "in", " ", "fit", " ", "?", " ", "it", "'", "s", " ", "ignored_", "\\u\\u\\uNL\\u\\u\\u_", "poisson", "\\u", "res_", "=_", "poisson", "\\u", "mod_", "._", "fit_", "(_", "method_", "=_", "\"", "newton", "\"_", ",_", "offset_", "=_", "rand", "\\u", "exo", "g_", "._", "dot_", "(_", "transf", "p_", "._", "constant_", "._", "squeeze_", "(_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "exo", "gp", "\\u", "st_", "=_", "transf", "p_", "._", "reduce_", "(_", "rand", "\\u", "exo", "g_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "poisson", "\\u", "mod", "r_", "=_", "sm_", "._", "Pois", "son_", "(_", "rand", "\\u", "data_", "._", "endo", "g_", ",_", "exo", "gp", "\\u", "st_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "poisson", "\\u", "res", "r_", "=_", "poisson", "\\u", "mod", "r_", "._", "fit_", "(_", "method_", "=_", "\"", "newton", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "params", "p_", "=_", "transf", "p_", "._", "expand_", "(_", "poisson", "\\u", "res", "r_", "._", "params_", ")_", "._", "squeeze_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "'\\\\", "n", "Pois", "son", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "params", "p_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "poisson", "\\u", "res_", "._", "params_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "error", " ", "bec", "aus", "e", " ", "I", " ", "don", "'", "t", " ", "use", " ", "the", " ", "uncon", "strain", "ed", " ", "basic", " ", "model_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "tp", " ", "=", " ", "transform", "\\u", "params", "\\u", "constraint", "(", "poisson", "\\u", "res", ".", "params", ",", " ", "poisson", "\\u", "res", ".", "cov", "\\u", "params", "()", ",", " ", "transf", "p", ".", "R", ",", " ", "transf", "p", ".", "q", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "cov", "\\u", "params", "3", " ", "=", " ", "transf", "3", ".", "transf", "\\u", "mat", ".", "dot", "(", "res", "3", ".", "cov", "\\u", "params", "())", ".", "dot", "(", "transf", "3", ".", "transf", "\\u", "mat", ".", "T", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "bse", "3", " ", "=", " ", "np", ".", "sqrt", "(", "np", ".", "diag", "(", "cov", "\\u", "params", "3", "))", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "poisson", "\\u", "mod", "0_", "=_", "sm_", "._", "Pois", "son_", "(_", "rand", "\\u", "data_", "._", "endo", "g_", ",_", "rand", "\\u", "exo", "g_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "poisson", "\\u", "res", "0_", "=_", "poisson", "\\u", "mod", "0_", "._", "fit_", "(_", "method_", "=_", "\"", "newton", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tp_", "=_", "transform", "\\u", "params", "\\u", "constraint_", "(_", "poisson", "\\u", "res", "0_", "._", "params_", ",_", "poisson", "\\u", "res", "0_", "._", "cov", "\\u", "params_", "(_", ")_", ",_", "transf", "p_", "._", "R_", ",_", "transf", "p_", "._", "q_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cov", "\\u", "params", "3_", "=_", "transf", "3_", "._", "transf", "\\u", "mat_", "._", "dot_", "(_", "res", "3_", "._", "cov", "\\u", "params_", "(_", ")_", ")_", "._", "dot_", "(_", "transf", "3_", "._", "transf", "\\u", "mat_", "._", "T_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bse", "3_", "=_", "np_", "._", "sqrt_", "(_", "np_", "._", "diag_", "(_", "cov", "\\u", "params", "3_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "try", " ", "again", " ", "same", " ", "example", " ", "as", " ", "it", " ", "was", " ", "inten", "ded", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "poisson", "\\u", "mod_", "=_", "sm_", "._", "Pois", "son_", "(_", "rand", "\\u", "data_", "._", "endo", "g_", ",_", "rand", "\\u", "exo", "g_", "[_", ":_", ",_", ":_", "-_", "2_", "]_", ",_", "offset_", "=_", "rand", "\\u", "exo", "g_", "[_", ":_", ",_", "-_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "poisson", "\\u", "res_", "=_", "poisson", "\\u", "mod_", "._", "fit_", "(_", "method_", "=_", "\"", "newton", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "exo", "gp", "\\u", "st_", "=_", "transf", "p_", "._", "reduce_", "(_", "rand", "\\u", "exo", "g_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "poisson", "\\u", "mod", "r_", "=_", "sm_", "._", "Pois", "son_", "(_", "rand", "\\u", "data_", "._", "endo", "g_", ",_", "exo", "gp", "\\u", "st_", ",_", "offset_", "=_", "rand", "\\u", "exo", "g_", "._", "dot_", "(_", "transf", "p_", "._", "constant_", "._", "squeeze_", "(_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "poisson", "\\u", "res", "r_", "=_", "poisson", "\\u", "mod", "r_", "._", "fit_", "(_", "method_", "=_", "\"", "newton", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "params", "p_", "=_", "transf", "p_", "._", "expand_", "(_", "poisson", "\\u", "res", "r_", "._", "params_", ")_", "._", "squeeze_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "'\\\\", "n", "Pois", "son", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "params", "p_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "poisson", "\\u", "res", "r_", "._", "params_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tp_", "=_", "transform", "\\u", "params", "\\u", "constraint_", "(_", "poisson", "\\u", "res", "0_", "._", "params_", ",_", "poisson", "\\u", "res", "0_", "._", "cov", "\\u", "params_", "(_", ")_", ",_", "transf", "p_", "._", "R_", ",_", "transf", "p_", "._", "q_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cov", "\\u", "params", "p_", "=_", "transf", "p_", "._", "transf", "\\u", "mat_", "._", "dot_", "(_", "poisson", "\\u", "res", "r_", "._", "cov", "\\u", "params_", "(_", ")_", ")_", "._", "dot_", "(_", "transf", "p_", "._", "transf", "\\u", "mat_", "._", "T_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bse", "p_", "=_", "np_", "._", "sqrt_", "(_", "np_", "._", "diag_", "(_", "cov", "\\u", "params", "p_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "bse", "p_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "p_", ",_", "cov_", ",_", "res", "\\u", "r_", "=_", "fit", "\\u", "constrained", "_", "(_", "poisson", "\\u", "mod",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"\"\nCopyright (c) 2013 Timon Wong\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of\nthis software and associated documentation files (the \"Software\"), to deal in\nthe Software without restriction, including without limitation the rights to\nuse, copy, modify, merge, publish, distribute, sublicense, and/or sell copies\nof the Software, and to permit persons to whom the Software is furnished to do\nso, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n\"\"\"\n\nfrom __future__ import print_function\n\nimport sys\nimport traceback\nimport threading\n\n\nNAME = 'OmniMarkupPreviewer:'\ng_lock = threading.Lock()\n\n\nDEBUG = False\n\nif DEBUG:\n try:\n import ctypes\n OutputDebugStringW = ctypes.windll.kernel32.OutputDebugStringW\n OutputDebugStringW.argtypes = [ctypes.c_wchar_p]\n except:\n DEBUG = False\n\n\n\n\n\n\n\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[ { "span": "try:", "start_line": 36, "start_column": 4, "end_line": 36, "end_column": 8 } ]
[]
1
true
[ "[CLS]_", "Unrea", "chab", "le_", "code_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\"\"\"", "\\", "10", ";", "Copy", "right", " ", "(", "c", ")", " ", "2013", " ", "Tim", "on", " ", "Wo", "ng", "\\", "10", ";", "\\", "10", ";", "Permi", "ssion", " ", "is", " ", "here", "by", " ", "grant", "ed", ",", " ", "free", " ", "of", " ", "charge", ",", " ", "to", " ", "any", " ", "person", " ", "obtain", "ing", " ", "a", " ", "copy", " ", "of", "\\", "10", ";", "this", " ", "software", " ", "and", " ", "associate", "d", " ", "documentation", " ", "files", " ", "(", "the", " ", "\"", "Sof", "twa", "re", "\")", ",", " ", "to", " ", "deal", " ", "in", "\\", "10", ";", "the", " ", "Sof", "twa", "re", " ", "with", "out", " ", "restriction", ",", " ", "inclu", "ding", " ", "with", "out", " ", "limit", "ation", " ", "the", " ", "rights", " ", "to", "\\", "10", ";", "use", ",", " ", "copy", ",", " ", "modif", "y", ",", " ", "merge", ",", " ", "publi", "sh", ",", " ", "distribute", ",", " ", "subli", "cens", "e", ",", " ", "and", "/", "or", " ", "sell", " ", "copie", "s", "\\", "10", ";", "of", " ", "the", " ", "Sof", "twa", "re", ",", " ", "and", " ", "to", " ", "permit", " ", "person", "s", " ", "to", " ", "who", "m", " ", "the", " ", "Sof", "twa", "re", " ", "is", " ", "fur", "nish", "ed", " ", "to", " ", "do", "\\", "10", ";", "so", ",", " ", "subject", " ", "to", " ", "the", " ", "follow", "ing", " ", "condition", "s", ":", "\\", "10", ";", "\\", "10", ";", "The", " ", "above", " ", "copyr", "ight", " ", "notice", " ", "and", " ", "this", " ", "permissi", "on", " ", "notice", " ", "sha", "ll", " ", "be", " ", "include", "d", " ", "in", " ", "all", "\\", "10", ";", "copie", "s", " ", "or", " ", "substa", "nti", "al", " ", "porti", "ons", " ", "of", " ", "the", " ", "Sof", "twa", "re", ".", "\\", "10", ";", "\\", "10", ";", "THE", " ", "SOFT", "WARE", " ", "IS", " ", "PROVI", "DED", " ", "\"", "AS", " ", "IS", "\",", " ", "WITH", "OUT", " ", "WAR", "RAN", "TY", " ", "OF", " ", "ANY", " ", "KIND", ",", " ", "EXPR", "ESS", " ", "OR", "\\", "10", ";", "IMPL", "IED", ",", " ", "INC", "LU", "DING", " ", "BUT", " ", "NOT", " ", "LIMIT", "ED", " ", "TO", " ", "THE", " ", "WAR", "RAN", "TIES", " ", "OF", " ", "MER", "CHAN", "TAB", "ILI", "TY", ",", "\\", "10", ";", "FIT", "NESS", " ", "FOR", " ", "A", " ", "PARTI", "CUL", "AR", " ", "PUR", "POS", "E", " ", "AND", " ", "NON", "INF", "RING", "EME", "NT", ".", " ", "IN", " ", "NO", " ", "EVENT", " ", "SHA", "LL", " ", "THE", "\\", "10", ";", "AUTHOR", "S", " ", "OR", " ", "COPY", "RIG", "HT", " ", "HOLD", "ERS", " ", "BE", " ", "LI", "AB", "LE", " ", "FOR", " ", "ANY", " ", "CLA", "IM", ",", " ", "DA", "MAGE", "S", " ", "OR", " ", "OTHER", "\\", "10", ";", "LI", "ABI", "LIT", "Y", ",", " ", "WHE", "THER", " ", "IN", " ", "AN", " ", "ACTI", "ON", " ", "OF", " ", "CONTR", "ACT", ",", " ", "TOR", "T", " ", "OR", " ", "OTHER", "WI", "SE", ",", " ", "ARI", "SIN", "G", " ", "FROM", ",", "\\", "10", ";", "OUT", " ", "OF", " ", "OR", " ", "IN", " ", "CONNECTION", " ", "WITH", " ", "THE", " ", "SOFT", "WARE", " ", "OR", " ", "THE", " ", "USE", " ", "OR", " ", "OTHER", " ", "DEA", "LING", "S", " ", "IN", " ", "THE", "\\", "10", ";", "SOFT", "WARE", ".", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "\\u\\u", "future\\u\\u_", "import_", "print", "\\u", "function_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "traceback_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "threading_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "NAME_", "=_", "'", "Om", "ni", "Mark", "up", "Preview", "er", ":'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "g", "\\u", "lock_", "=_", "threading_", "._", "Lock_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "DEBUG_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "DEBUG_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "ctypes_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Output", "Deb", "ug", "String", "W_", "=_", "ctypes_", "._", "windll_", "._", "kernel32_", "._", "Output", "Deb", "ug", "String", "W_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Output", "Deb", "ug", "String", "W_", "._", "argtypes_", "=_", "[_", "ctypes_", "._", "c\\u", "wchar", "\\u", "p_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "DEBUG_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
VisTrails/VisTrails/contrib/itk/SmoothingFilters.py
[ { "content": "############################################################################\n##\n## Copyright (C) 2006-2007 University of Utah. All rights reserved.\n##\n## This file is part of VisTrails.\n##\n## This file may be used under the terms of the GNU General Public\n## License version 2.0 as published by the Free Software Foundation\n## and appearing in the file LICENSE.GPL included in the packaging of\n## this file. Please review the following to ensure GNU General Public\n## Licensing requirements will be met:\n## http://www.opensource.org/licenses/gpl-license.php\n##\n## If you are unsure which license is appropriate for your use (for\n## instance, you are interested in developing a commercial derivative\n## of VisTrails), please contact us at [email protected].\n##\n## This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE\n## WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.\n##\n############################################################################\nimport itk\nimport core.modules\nfrom core.modules.vistrails_module import Module, ModuleError\nfrom ITK import *\nfrom Image import Image\n\n\n\n\n\n\n\n\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class CurvatureAnisotropicDiffusionFilter(Module):\n my_namespace=\"Filter|Smoothing\"\n", "metadata": "root.CurvatureAnisotropicDiffusionFilter", "header": "['module', '___EOS___']", "index": 27 }, { "content": " def compute(self):\n im = self.get_input(\"Input Image\")\n\n #check for input PixelType\n if self.has_input(\"Input PixelType\"):\n inPixelType = self.get_input(\"Input PixelType\")\n else:\n inPixelType = im.getPixelType()\n\n #check for dimension\n if self.has_input(\"Dimension\"):\n dim = self.get_input(\"Dimension\")\n else:\n dim = im.getDim()\n\n #set up filter\n inImgType = itk.Image[inPixelType._type, dim]\n\n try:\n self.filter_ = itk.CurvatureAnisotropicDiffusionImageFilter[inImgType, inImgType].New(im.getImg())\n except:\n raise ModuleError(self, \"Filter requires a decimal PixelType\")\n\n #default values are recommended\n if self.has_input(\"Iterations\"):\n iterations = self.get_input(\"Iterations\")\n else:\n iterations = 5\n\n if self.has_input(\"TimeStep\"):\n timestep = self.get_input(\"TimeStep\")\n else:\n if dim == 2:\n timestep = 0.125\n else:\n timestep = 0.0625\n\n if self.has_input(\"Conductance\"):\n conductance = self.get_input(\"Conductance\")\n else:\n conductance = 3.0\n\n self.filter_.SetNumberOfIterations(iterations)\n self.filter_.SetTimeStep(timestep)\n self.filter_.SetConductanceParameter(conductance)\n\n self.filter_.Update()\n\n #setup output image\n outIm = Image()\n outIm.setImg(self.filter_.GetOutput())\n outIm.setPixelType(inPixelType)\n outIm.setDim(dim)\n \n self.set_output(\"Output Image\", outIm)\n self.set_output(\"Filter\", self)", "metadata": "root.CurvatureAnisotropicDiffusionFilter.compute", "header": "['class', 'CurvatureAnisotropicDiffusionFilter', '(', 'Module', ')', ':', '___EOS___']", "index": 29 }, { "content": " @classmethod\n def register(cls, reg, basic):\n reg.add_module(cls, name=\"Curvature Anisotropic Diffusion Filter\", namespace=cls.my_namespace)\n reg.add_input_port(cls, \"Input Image\", (Image, 'Input Image'))\n reg.add_input_port(cls, \"Input Dimension\", (basic.Integer, 'Input Dimension'),True)\n reg.add_input_port(cls, \"Input PixelType Float\", (PixelType, 'Input PixelType Float'),True)\n reg.add_input_port(cls, \"Iterations\", (basic.Integer, 'Iterations'), True)\n reg.add_input_port(cls, \"TimeStep\", (basic.Float, 'TimeStep'), True)\n reg.add_input_port(cls, \"Conductance\", (basic.Float, 'Conductance'), True)\n\n reg.add_output_port(cls, \"Output Image\", (Image, 'Output Image'))\n reg.add_output_port(cls, \"Filter\", (Filter, 'Filter'), True)", "metadata": "root.CurvatureAnisotropicDiffusionFilter.register", "header": "['class', 'CurvatureAnisotropicDiffusionFilter', '(', 'Module', ')', ':', '___EOS___']", "index": 86 }, { "content": "class RecursiveGaussianImageFilter(Module):\n my_namespace=\"Filter|Smoothing\"\n", "metadata": "root.RecursiveGaussianImageFilter", "header": "['module', '___EOS___']", "index": 100 }, { "content": " def compute(self):\n im = self.get_input(\"Input Image\")\n\n #check for input PixelType\n if self.has_input(\"Input PixelType\"):\n inPixelType = self.get_input(\"Input PixelType\")\n else:\n inPixelType = im.getPixelType()\n\n #check for output PixelType\n if self.has_input(\"Output PixelType\"):\n outPixelType = self.get_input(\"Output PixelType\")\n else:\n outPixelType = inPixelType\n\n #check for dimension\n if self.has_input(\"Dimension\"):\n dim = self.get_input(\"Dimension\")\n else:\n dim = im.getDim()\n\n outdim = dim\n\n #set up filter\n inImgType = itk.Image[inPixelType._type, dim]\n outImgType = itk.Image[outPixelType._type, dim]\n\n self.filter_ = itk.RecursiveGaussianImageFilter[inImgType, outImgType].New(im.getImg())\n\n sigma = self.get_input(\"Sigma\")\n self.filter_.SetSigma(sigma)\n\n self.filter_.Update()\n\n #setup output image\n outIm = Image()\n outIm.setImg(self.filter_.GetOutput())\n outIm.setPixelType(outPixelType)\n outIm.setDim(dim)\n \n self.set_output(\"Output Image\", outIm)\n self.set_output(\"Output PixelType\", outPixelType)\n self.set_output(\"Output Dimension\", outdim)", "metadata": "root.RecursiveGaussianImageFilter.compute", "header": "['class', 'RecursiveGaussianImageFilter', '(', 'Module', ')', ':', '___EOS___']", "index": 102 }, { "content": " @classmethod\n def register(cls, reg, basic):\n reg.add_module(cls, name=\"Recursive Gaussian Image Filter\", namespace=cls.my_namespace)\n\n reg.add_input_port(cls, \"Input Image\", (Image, 'Input Image'))\n reg.add_input_port(cls, \"Input Dimension\", (basic.Integer, 'Input Dimension'),True)\n reg.add_input_port(cls, \"Input PixelType\", (PixelType, 'Input PixelType'),True)\n reg.add_input_port(cls, \"Sigma\", (basic.Float, 'Sigma'))\n\n reg.add_output_port(cls, \"Output Image\", (Image, 'Output Image'))\n reg.add_output_port(cls, \"Output Dimension\", (basic.Integer, 'Output Dimension'),True)\n reg.add_output_port(cls, \"Output PixelType\", (PixelType, 'Output PixelType'),True)", "metadata": "root.RecursiveGaussianImageFilter.register", "header": "['class', 'RecursiveGaussianImageFilter', '(', 'Module', ')', ':', '___EOS___']", "index": 146 }, { "content": "class CurvatureFlowImageFilter(Module):\n my_namespace=\"Filter|Smoothing\"\n", "metadata": "root.CurvatureFlowImageFilter", "header": "['module', '___EOS___']", "index": 159 }, { "content": " def compute(self):\n im = self.get_input(\"Input Image\")\n\n #check for input PixelType\n if self.has_input(\"Input PixelType\"):\n inPixelType = self.get_input(\"Input PixelType\")\n else:\n inPixelType = im.getPixelType()\n\n #check for dimension\n if self.has_input(\"Dimension\"):\n dim = self.get_input(\"Dimension\")\n else:\n dim = im.getDim()\n\n #set up filter\n inImgType = itk.Image[inPixelType._type, dim]\n\n try:\n self.filter_ = itk.CurvatureFlowImageFilter[inImgType, inImgType].New(im.getImg())\n except:\n raise ModuleError(self, \"Filter requires a decimal PixelType\")\n\n #default values recommended\n if self.has_input(\"TimeStep\"):\n self.ts = self.get_input(\"TimeStep\")\n else:\n self.ts = 0.125\n\n if self.has_input(\"Iterations\"):\n self.iterations = self.get_input(\"Iterations\")\n else:\n self.iterations = 5\n\n self.filter_.SetTimeStep(self.ts)\n self.filter_.SetNumberOfIterations(self.iterations)\n\n self.filter_.Update()\n\n #setup output image\n outIm = Image()\n outIm.setImg(self.filter_.GetOutput())\n outIm.setPixelType(inPixelType)\n outIm.setDim(dim)\n \n self.set_output(\"Output Image\", outIm)", "metadata": "root.CurvatureFlowImageFilter.compute", "header": "['class', 'CurvatureFlowImageFilter', '(', 'Module', ')', ':', '___EOS___']", "index": 161 }, { "content": " @classmethod\n def register(cls, reg, basic):\n reg.add_module(cls, name=\"Curvature Flow Image Filter\", namespace=cls.my_namespace)\n\n reg.add_input_port(cls, \"Input Image\", (Image, 'Input Image'))\n reg.add_input_port(cls, \"Input Dimension\", (basic.Integer, 'Input Dimension'),True)\n reg.add_input_port(cls, \"Input PixelType\", (PixelType, 'Input PixelType'),True)\n reg.add_input_port(cls, \"TimeStep\", (basic.Float, 'TimeStep'), True)\n reg.add_input_port(cls, \"Iterations\", (basic.Integer, 'Iterations'), True)\n\n reg.add_output_port(cls, \"Output Image\", (Image, 'Output Image'))", "metadata": "root.CurvatureFlowImageFilter.register", "header": "['class', 'CurvatureFlowImageFilter', '(', 'Module', ')', ':', '___EOS___']", "index": 208 }, { "content": "class DiscreteGaussianImageFilter(Module):\n my_namespace = 'Filter|Smoothing'\n\n\n", "metadata": "root.DiscreteGaussianImageFilter", "header": "['module', '___EOS___']", "index": 220 }, { "content": " def compute(self):\n im = self.get_input(\"Input Image\")\n\n #check for input PixelType\n if self.has_input(\"Input PixelType\"):\n inPixelType = self.get_input(\"Input PixelType\")\n else:\n inPixelType = im.getPixelType()\n\n #check for output PixelType\n if self.has_input(\"Output PixelType\"):\n outPixelType = self.get_input(\"Output PixelType\")\n else:\n outPixelType = inPixelType\n\n #check for dimension\n if self.has_input(\"Dimension\"):\n dim = self.get_input(\"Dimension\")\n else:\n dim = im.getDim()\n\n #set up filter\n inImgType = itk.Image[inPixelType._type, dim]\n outImgType = itk.Image[outPixelType._type, dim]\n\n gaussian_variance = self.get_input(\"Gaussian Variance\")\n\n max_kernel_width = self.get_input(\"Max Kernel Width\")\n\n try:\n self.filter_ = itk.DiscreteGaussianImageFilter[inImgType, outImgType].New(im.getImg())\n except:\n raise ModuleError(self, \"Requires Signed PixelType\")\n\n self.filter_.SetVariance(gaussian_variance)\n self.filter_.SetMaximumKernelWidth(max_kernel_width)\n self.filter_.Update()\n\n #setup output image\n outIm = Image()\n outIm.setImg(self.filter_.GetOutput())\n outIm.setPixelType(outPixelType)\n outIm.setDim(dim)\n\n #set results\n self.set_output(\"Output Image\", outIm)\n self.set_output(\"Filter\", self)\n self.set_output(\"Output PixelType\", outPixelType)", "metadata": "root.DiscreteGaussianImageFilter.compute", "header": "['class', 'DiscreteGaussianImageFilter', '(', 'Module', ')', ':', '___EOS___']", "index": 223 }, { "content": " @classmethod\n def register(cls, reg, basic):\n reg.add_module(cls, name=\"Discrete Gaussian Image Filter\", namespace=cls.my_namespace)\n\n reg.add_input_port(cls, \"Input Image\", (Image, 'Input Image'))\n reg.add_input_port(cls, \"Input PixelType\", (PixelType, 'Input PixelType'),True)\n reg.add_input_port(cls, \"Output PixelType\", (PixelType, 'Output PixelType'),True)\n reg.add_input_port(cls, \"Dimension\", (basic.Integer, 'Dimension'),True)\n\n reg.add_input_port(cls, \"Gaussian Variance\", (basic.Float, 'Gaussian Variance'))\n reg.add_input_port(cls, \"Max Kernel Width\", (basic.Integer, 'Max Kernel Width'))\n\n reg.add_output_port(cls, \"Output Image\", (Image, 'Output Image'))\n reg.add_output_port(cls, \"Filter\", (Filter, 'Filter'), True)\n reg.add_output_port(cls, \"Output PixelType\", (PixelType, 'Output PixelType'),True)", "metadata": "root.DiscreteGaussianImageFilter.register", "header": "['class', 'DiscreteGaussianImageFilter', '(', 'Module', ')', ':', '___EOS___']", "index": 273 }, { "content": "class BinomialBlurImageFilter(Module):\n my_namespace = 'Filter|Smoothing'\n\n\n", "metadata": "root.BinomialBlurImageFilter", "header": "['module', '___EOS___']", "index": 289 }, { "content": " def compute(self):\n im = self.get_input(\"Input Image\")\n\n #check for input PixelType\n if self.has_input(\"Input PixelType\"):\n inPixelType = self.get_input(\"Input PixelType\")\n else:\n inPixelType = im.getPixelType()\n\n #check for output PixelType\n if self.has_input(\"Output PixelType\"):\n outPixelType = self.get_input(\"Output PixelType\")\n else:\n outPixelType = inPixelType\n\n #check for dimension\n if self.has_input(\"Dimension\"):\n dim = self.get_input(\"Dimension\")\n else:\n dim = im.getDim()\n\n #set up filter\n inImgType = itk.Image[inPixelType._type, dim]\n outImgType = itk.Image[outPixelType._type, dim]\n\n repetitions = self.get_input(\"Repetitions\")\n\n self.filter_ = itk.BinomialBlurImageFilter[inImgType, outImgType].New(im.getImg())\n self.filter_.SetRepetitions(repetitions)\n self.filter_.Update()\n\n #setup output image\n outIm = Image()\n outIm.setImg(self.filter_.GetOutput())\n outIm.setPixelType(outPixelType)\n outIm.setDim(dim)\n\n #set results\n self.set_output(\"Output Image\", outIm)\n self.set_output(\"Filter\", self)\n self.set_output(\"Output PixelType\", outPixelType)", "metadata": "root.BinomialBlurImageFilter.compute", "header": "['class', 'BinomialBlurImageFilter', '(', 'Module', ')', ':', '___EOS___']", "index": 292 }, { "content": " @classmethod\n def register(cls, reg, basic):\n reg.add_module(cls, name=\"BinomialBlur Image Filter\", namespace=cls.my_namespace)\n\n reg.add_input_port(cls, \"Input Image\", (Image, 'Input Image'))\n reg.add_input_port(cls, \"Input PixelType\", (PixelType, 'Input PixelType'),True)\n reg.add_input_port(cls, \"Output PixelType\", (PixelType, 'Output PixelType'),True)\n reg.add_input_port(cls, \"Dimension\", (basic.Integer, 'Dimension'),True)\n\n reg.add_input_port(cls, \"Repetitions\", (basic.Integer, 'Repetitions'))\n\n reg.add_output_port(cls, \"Output Image\", (Image, 'Output Image'))\n reg.add_output_port(cls, \"Filter\", (Filter, 'Filter'), True)\n reg.add_output_port(cls, \"Output PixelType\", (PixelType, 'Output PixelType'),True)", "metadata": "root.BinomialBlurImageFilter.register", "header": "['class', 'BinomialBlurImageFilter', '(', 'Module', ')', ':', '___EOS___']", "index": 335 }, { "content": "class GradientAnisotropicDiffusionImageFilter(Module):\n my_namespace = 'Filter|Smoothing'\n\n\n", "metadata": "root.GradientAnisotropicDiffusionImageFilter", "header": "['module', '___EOS___']", "index": 350 }, { "content": " def compute(self):\n im = self.get_input(\"Input Image\")\n\n #check for input PixelType\n if self.has_input(\"Input PixelType\"):\n inPixelType = self.get_input(\"Input PixelType\")\n else:\n inPixelType = im.getPixelType()\n\n #check for output PixelType\n if self.has_input(\"Output PixelType\"):\n outPixelType = self.get_input(\"Output PixelType\")\n else:\n outPixelType = inPixelType\n\n #check for dimension\n if self.has_input(\"Dimension\"):\n dim = self.get_input(\"Dimension\")\n else:\n dim = im.getDim()\n\n #set up filter\n inImgType = itk.Image[inPixelType._type, dim]\n outImgType = itk.Image[outPixelType._type, dim]\n\n timestep = self.get_input(\"Timestep\")\n\n conductance = self.get_input(\"Conductance\")\n\n iterations = self.get_input(\"Iterations\")\n\n try:\n self.filter_ = itk.GradientAnisotropicDiffusionImageFilter[inImgType, outImgType].New(im.getImg())\n except:\n raise ModuleError(self, \"Requires Decimal PixelType\")\n\n self.filter_.SetTimeStep(timestep)\n self.filter_.SetConductanceParameter(conductance)\n self.filter_.SetNumberOfIterations(iterations)\n self.filter_.Update()\n\n #setup output image\n outIm = Image()\n outIm.setImg(self.filter_.GetOutput())\n outIm.setPixelType(outPixelType)\n outIm.setDim(dim)\n\n #set results\n self.set_output(\"Output Image\", outIm)\n self.set_output(\"Filter\", self)\n self.set_output(\"Output PixelType\", outPixelType)", "metadata": "root.GradientAnisotropicDiffusionImageFilter.compute", "header": "['class', 'GradientAnisotropicDiffusionImageFilter', '(', 'Module', ')', ':', '___EOS___']", "index": 353 }, { "content": " @classmethod\n def register(cls, reg, basic):\n reg.add_module(cls, name=\"Gradient Anisotropic Diffusion Image Filter\", namespace=cls.my_namespace)\n\n reg.add_input_port(cls, \"Input Image\", (Image, 'Input Image'))\n reg.add_input_port(cls, \"Input PixelType\", (PixelType, 'Input PixelType'),True)\n reg.add_input_port(cls, \"Output PixelType\", (PixelType, 'Output PixelType'),True)\n reg.add_input_port(cls, \"Dimension\", (basic.Integer, 'Dimension'),True)\n\n reg.add_input_port(cls, \"Timestep\", (basic.Float, 'Timestep'))\n reg.add_input_port(cls, \"Conductance\", (basic.Float, 'Conductance'))\n reg.add_input_port(cls, \"Iterations\", (basic.Integer, 'Iterations'))\n\n reg.add_output_port(cls, \"Output Image\", (Image, 'Output Image'))\n reg.add_output_port(cls, \"Filter\", (Filter, 'Filter'), True)\n reg.add_output_port(cls, \"Output PixelType\", (PixelType, 'Output PixelType'),True)", "metadata": "root.GradientAnisotropicDiffusionImageFilter.register", "header": "['class', 'GradientAnisotropicDiffusionImageFilter', '(', 'Module', ')', ':', '___EOS___']", "index": 406 }, { "content": "class MinMaxCurvatureFlowImageFilter(Module):\n my_namespace = 'Filter|Smoothing'\n\n\n", "metadata": "root.MinMaxCurvatureFlowImageFilter", "header": "['module', '___EOS___']", "index": 424 }, { "content": " def compute(self):\n im = self.get_input(\"Input Image\")\n\n #check for input PixelType\n if self.has_input(\"Input PixelType\"):\n inPixelType = self.get_input(\"Input PixelType\")\n else:\n inPixelType = im.getPixelType()\n\n #check for output PixelType\n if self.has_input(\"Output PixelType\"):\n outPixelType = self.get_input(\"Output PixelType\")\n else:\n outPixelType = inPixelType\n\n #check for dimension\n if self.has_input(\"Dimension\"):\n dim = self.get_input(\"Dimension\")\n else:\n dim = im.getDim()\n\n #set up filter\n inImgType = itk.Image[inPixelType._type, dim]\n outImgType = itk.Image[outPixelType._type, dim]\n\n timestep = self.get_input(\"Timestep\")\n\n radius = self.get_input(\"Radius\")\n\n iterations = self.get_input(\"Iterations\")\n\n self.filter_ = itk.MinMaxCurvatureFlowImageFilter[inImgType, outImgType].New(im.getImg())\n self.filter_.SetTimeStep(timestep)\n self.filter_.SetStencilRadius(radius)\n self.filter_.SetNumberOfIterations(iterations)\n self.filter_.Update()\n\n #setup output image\n outIm = Image()\n outIm.setImg(self.filter_.GetOutput())\n outIm.setPixelType(outPixelType)\n outIm.setDim(dim)\n\n #set results\n self.set_output(\"Output Image\", outIm)\n self.set_output(\"Filter\", self)\n self.set_output(\"Output PixelType\", outPixelType)", "metadata": "root.MinMaxCurvatureFlowImageFilter.compute", "header": "['class', 'MinMaxCurvatureFlowImageFilter', '(', 'Module', ')', ':', '___EOS___']", "index": 427 }, { "content": " @classmethod\n def register(cls, reg, basic):\n reg.add_module(cls, name=\"MinMax Curvature Flow Image Filter\", namespace=cls.my_namespace)\n\n reg.add_input_port(cls, \"Input Image\", (Image, 'Input Image'))\n reg.add_input_port(cls, \"Input PixelType\", (PixelType, 'Input PixelType'),True)\n reg.add_input_port(cls, \"Output PixelType\", (PixelType, 'Output PixelType'),True)\n reg.add_input_port(cls, \"Dimension\", (basic.Integer, 'Dimension'),True)\n\n reg.add_input_port(cls, \"Timestep\", (basic.Float, 'Timestep'))\n reg.add_input_port(cls, \"Radius\", (basic.Float, 'Radius'))\n reg.add_input_port(cls, \"Iterations\", (basic.Integer, 'Iterations'))\n\n reg.add_output_port(cls, \"Output Image\", (Image, 'Output Image'))\n reg.add_output_port(cls, \"Filter\", (Filter, 'Filter'), True)\n reg.add_output_port(cls, \"Output PixelType\", (PixelType, 'Output PixelType'),True)", "metadata": "root.MinMaxCurvatureFlowImageFilter.register", "header": "['class', 'MinMaxCurvatureFlowImageFilter', '(', 'Module', ')', ':', '___EOS___']", "index": 476 }, { "content": "class BilateralImageFilter(Module):\n my_namespace = 'Filter|Smoothing'\n\n\n", "metadata": "root.BilateralImageFilter", "header": "['module', '___EOS___']", "index": 493 }, { "content": " def compute(self):\n im = self.get_input(\"Input Image\")\n\n #check for input PixelType\n if self.has_input(\"Input PixelType\"):\n inPixelType = self.get_input(\"Input PixelType\")\n else:\n inPixelType = im.getPixelType()\n\n #check for output PixelType\n if self.has_input(\"Output PixelType\"):\n outPixelType = self.get_input(\"Output PixelType\")\n else:\n outPixelType = inPixelType\n\n #check for dimension\n if self.has_input(\"Dimension\"):\n dim = self.get_input(\"Dimension\")\n else:\n dim = im.getDim()\n\n #set up filter\n inImgType = itk.Image[inPixelType._type, dim]\n outImgType = itk.Image[outPixelType._type, dim]\n\n range_sigma = self.get_input(\"Range Sigma\")\n\n domain_sigma = self.get_input(\"Domain Sigma\")\n\n self.filter_ = itk.BilateralImageFilter[inImgType, outImgType].New(im.getImg())\n self.filter_.SetRangeSigma(range_sigma)\n self.filter_.SetDomainSigma(domain_sigma)\n self.filter_.Update()\n\n #setup output image\n outIm = Image()\n outIm.setImg(self.filter_.GetOutput())\n outIm.setPixelType(outPixelType)\n outIm.setDim(dim)\n\n #set results\n self.set_output(\"Output Image\", outIm)\n self.set_output(\"Filter\", self)\n self.set_output(\"Output PixelType\", outPixelType)", "metadata": "root.BilateralImageFilter.compute", "header": "['class', 'BilateralImageFilter', '(', 'Module', ')', ':', '___EOS___']", "index": 496 }, { "content": " @classmethod\n def register(cls, reg, basic):\n reg.add_module(cls, name=\"Bilateral Image Filter\", namespace=cls.my_namespace)\n\n reg.add_input_port(cls, \"Input Image\", (Image, 'Input Image'))\n reg.add_input_port(cls, \"Input PixelType\", (PixelType, 'Input PixelType'),True)\n reg.add_input_port(cls, \"Output PixelType\", (PixelType, 'Output PixelType'),True)\n reg.add_input_port(cls, \"Dimension\", (basic.Integer, 'Dimension'),True)\n\n reg.add_input_port(cls, \"Range Sigma\", (basic.Float, 'Range Sigma'))\n reg.add_input_port(cls, \"Domain Sigma\", (basic.Float, 'Domain Sigma'))\n\n reg.add_output_port(cls, \"Output Image\", (Image, 'Output Image'))\n reg.add_output_port(cls, \"Filter\", (Filter, 'Filter'), True)\n reg.add_output_port(cls, \"Output PixelType\", (PixelType, 'Output PixelType'),True)", "metadata": "root.BilateralImageFilter.register", "header": "['class', 'BilateralImageFilter', '(', 'Module', ')', ':', '___EOS___']", "index": 542 } ]
[ { "span": "import core.modules", "start_line": 22, "start_column": 0, "end_line": 22, "end_column": 19 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "###########", "###########", "###########", "###########", "###########", "###########", "#########", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "##", "_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "Copy", "right", " ", "(", "C", ")", " ", "2006", "-", "2007", " ", "Univers", "it", "y", " ", "of", " ", "Ut", "ah", ".", " ", "All", " ", "rights", " ", "reserve", "d", "._", "\\u\\u\\uNL\\u\\u\\u_", "##", "_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "Thi", "s", " ", "file", " ", "is", " ", "part", " ", "of", " ", "Vis", "Trail", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "##", "_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "Thi", "s", " ", "file", " ", "may", " ", "be", " ", "used", " ", "under", " ", "the", " ", "term", "s", " ", "of", " ", "the", " ", "GN", "U", " ", "General", " ", "Public", "_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "License", " ", "version", " ", "2.0", " ", "as", " ", "publi", "shed", " ", "by", " ", "the", " ", "Free", " ", "Sof", "twa", "re", " ", "Foun", "dati", "on_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "and", " ", "appear", "ing", " ", "in", " ", "the", " ", "file", " ", "LICENSE", ".", "GP", "L", " ", "include", "d", " ", "in", " ", "the", " ", "packaging", " ", "of_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "this", " ", "file", ".", " ", " ", "Ple", "ase", " ", "review", " ", "the", " ", "follow", "ing", " ", "to", " ", "ensure", " ", "GN", "U", " ", "General", " ", "Public", "_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "Licen", "sing", " ", "require", "ment", "s", " ", "will", " ", "be", " ", "met", ":_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "http", "://", "www", ".", "opens", "ource", ".", "org", "/", "license", "s", "/", "gpl", "-", "license", ".", "php", "_", "\\u\\u\\uNL\\u\\u\\u_", "##", "_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "If", " ", "you", " ", "are", " ", "uns", "ure", " ", "whi", "ch", " ", "license", " ", "is", " ", "appropr", "iate", " ", "for", " ", "your", " ", "use", " ", "(", "for_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "instance", ",", " ", "you", " ", "are", " ", "interest", "ed", " ", "in", " ", "develop", "ing", " ", "a", " ", "commerc", "ial", " ", "derivative_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "of", " ", "Vis", "Trail", "s", "),", " ", "plea", "se", " ", "contact", " ", "us", " ", "at", " ", "contact", "@", "vist", "rail", "s", ".", "org", "._", "\\u\\u\\uNL\\u\\u\\u_", "##", "_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "Thi", "s", " ", "file", " ", "is", " ", "provided", " ", "AS", " ", "IS", " ", "with", " ", "NO", " ", "WAR", "RAN", "TY", " ", "OF", " ", "ANY", " ", "KIND", ",", " ", "INC", "LU", "DING", " ", "THE", "_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "WAR", "RAN", "TY", " ", "OF", " ", "DES", "IGN", ",", " ", "MER", "CHAN", "TAB", "ILI", "TY", " ", "AND", " ", "FIT", "NESS", " ", "FOR", " ", "A", " ", "PARTI", "CUL", "AR", " ", "PUR", "POS", "E", "._", "\\u\\u\\uNL\\u\\u\\u_", "##", "_", "\\u\\u\\uNL\\u\\u\\u_", "###########", "###########", "###########", "###########", "###########", "###########", "#########", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "itk", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "core_", "._", "modules_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "core_", "._", "modules_", "._", "vist", "rail", "s", "\\u", "module_", "import_", "Module_", ",_", "Modul", "e", "Error_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "IT", "K_", "import_", "*_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "Image_", "import_", "Image_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Cur", "vat", "ure", "An", "isot", "rop", "ic", "Diffus", "ion", "Filter_", "(_", "Module_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "my", "\\u", "namespace_", "=_", "\"", "Filter", "|", "Smooth", "ing", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Cur", "vat", "ure", "An", "isot", "rop", "ic", "Diffus", "ion", "Filter_", "(_", "Module_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "compute_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "im_", "=_", "self_", "._", "get", "\\u", "input_", "(_", "\"", "Inp", "ut", " ", "Image", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "check", " ", "for", " ", "input", " ", "Pix", "el", "Type_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "self_", "._", "has", "\\u", "input_", "(_", "\"", "Inp", "ut", " ", "Pix", "el", "Type", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "in", "Pix", "el", "Type_", "=_", "self_", "._", "get", "\\u", "input_", "(_", "\"", "Inp", "ut", " ", "Pix", "el", "Type", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "in", "Pix", "el", "Type_", "=_", "im_", "._", "get", "Pix", "el", "Type_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "check", " ", "for", " ", "dimension_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "has", "\\u", "input_", "(_", "\"", "Dimen", "sion", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "dim_", "=_", "self_", "._", "get", "\\u", "input_", "(_", "\"", "Dimen", "sion", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "dim_", "=_", "im_", "._", "get", "Dim_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "set", " ", "up", " ", "filter_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "in", "Im", "g", "Type_", "=_", "itk", "_", "._", "Image_", "[_", "in", "Pix", "el", "Type_", "._", "\\u", "type_", ",_", "dim_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "filter\\u_", "=_", "itk", "_", "._", "Cur", "vat", "ure", "An", "isot", "rop", "ic", "Diffus", "ion", "Image", "Filter_", "[_", "in", "Im", "g", "Type_", ",_", "in", "Im", "g", "Type_", "]_", "._", "New_", "(_", "im_", "._", "get", "Img_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Modul", "e", "Error_", "(_", "self_", ",_", "\"", "Filter", " ", "require", "s", " ", "a", " ", "decima", "l", " ", "Pix", "el", "Type", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "default", " ", "values", " ", "are", " ", "recommende", "d_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "has", "\\u", "input_", "(_", "\"", "Iterations", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "iterations_", "=_", "self_", "._", "get", "\\u", "input_", "(_", "\"", "Iterations", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "iterations_", "=_", "5_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "has", "\\u", "input_", "(_", "\"", "Time", "Step", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "timestep_", "=_", "self_", "._", "get", "\\u", "input_", "(_", "\"", "Time", "Step", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "dim_", "==_", "2_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "timestep_", "=_", "0.125_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "timestep_", "=_", "0.06", "25_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "has", "\\u", "input_", "(_", "\"", "Conduct", "anc", "e", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "conduct", "ance_", "=_", "self_", "._", "get", "\\u", "input_", "(_", "\"", "Conduct", "anc", "e", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "conduct", "ance_", "=_", "3.0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "filter\\u_", "._", "Set", "Number", "Of", "Iterations", "_", "(_", "iterations_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "filter\\u_", "._", "Set", "Time", "Step_", "(_", "timestep_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "filter\\u_", "._", "Set", "Conduct", "anc", "e", "Parameter_", "(_", "conduct", "ance_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "filter\\u_", "._", "Update_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "setup", " ", "output", " ", "image_", "\\u\\u\\uNL\\u\\u\\u_", "out", "Im", "_", "=_", "Image_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "out", "Im", "_", "._", "set", "Img_", "(_", "self_", "._", "filter\\u_", "._", "Get", "Output_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "out", "Im", "_", "._", "set", "Pix", "el", "Type_", "(_", "in", "Pix", "el", "Type_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "out", "Im", "_", "._", "set", "Dim_", "(_", "dim_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "set\\u", "output_", "(_", "\"", "Output", " ", "Image", "\"_", ",_", "out", "Im", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "set\\u", "output_", "(_", "\"", "Filter", "\"_", ",_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Cur", "vat", "ure", "An", "isot", "rop", "ic", "Diffus", "ion", "Filter_", "(_", "Module_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "classmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "register_", "(_", "cls_", ",_", "reg_", ",_", "basic_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "reg_", "._", "add", "\\u", "module_", "(_", "cls_", ",_", "name_", "=_", "\"", "Cur", "vat", "ure", " ", "An", "isot", "rop", "ic", " ", "Diffus", "ion", " ", "Filter", "\"_", ",_", "namespace_", "=_", "cls_", "._", "my", "\\u", "namespace_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "reg_", "._", "add", "\\u", "input", "\\u", "port_", "(_", "cls_", ",_", "\"", "Inp", "ut", " ", "Image", "\"_", ",_", "(_", "Image_", ",_", "'", "Inp", "ut", " ", "Image", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "reg_", "._", "add", "\\u", "input", "\\u", "port_", "(_", "cls_", ",_", "\"", "Inp", "ut", " ", "Dimen", "sion", "\"_", ",_", "(_", "basic_", "._", "Integer_", ",_", "'", "Inp", "ut", " ", "Dimen", "sion", "'_", ")_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "reg_", "._", "add", "\\u", "input", "\\u", "port_", "(_", "cls_", ",_", "\"", "Inp", "ut", " ", "Pix", "el", "Type", " ", "Float", "\"_", ",_", "(_", "Pix", "el", "Type_", ",_", "'", "Inp", "ut", " ", "Pix", "el", "Type", " ", "Float", "'_", ")_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "reg_", "._", "add", "\\u", "input", "\\u", "port_", "(_", "cls_", ",_", "\"", "Iterations", "\"_", ",_", "(_", "basic_", "._", "Integer_", ",_", "'", "Iterations", "'_", ")_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "reg_", "._", "add", "\\u", "input", "\\u", "port_", "(_", "cls_", ",_", "\"", "Time", "Step", "\"_", ",_", "(_", "basic_", "._", "Float_", ",_", "'", "Time", "Step", "'_", ")_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "reg_", "._", "add", "\\u", "input", "\\u", "port_", "(_", "cls_", ",_", "\"", "Conduct", "anc", "e", "\"_", ",_", "(_", "basic_", "._", "Float_", ",_", "'", "Conduct", "anc", "e", "'_", ")_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "reg_", "._", "add", "\\u", "output", "\\u", "port_", "(_", "cls_", ",_", "\"", "Output", " ", "Image", "\"_", ",_", "(_", "Image_", ",_", "'", "Output", " ", "Image", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "reg_", "._", "add", "\\u", "output", "\\u", "port_", "(_", "cls_", ",_", "\"", "Filter", "\"_", ",_", "(_", "Filter_", ",_", "'", "Filter", "'_", ")_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Recursive", "Gaussian", "Image", "Filter_", "(_", "Module_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "my", "\\u", "namespace_", "=_", "\"", "Filter", "|", "Smooth", "ing", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Recursive", "Gaussian", "Image", "Filter_", "(_", "Module_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "compute_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "im_", "=_", "self_", "._", "get", "\\u", "input_", "(_", "\"", "Inp", "ut", " ", "Image", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "check", " ", "for", " ", "input", " ", "Pix", "el", "Type_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "self_", "._", "has", "\\u", "input_", "(_", "\"", "Inp", "ut", " ", "Pix", "el", "Type", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "in", "Pix", "el", "Type_", "=_", "self_", "._", "get", "\\u", "input_", "(_", "\"", "Inp", "ut", " ", "Pix", "el", "Type", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "in", "Pix", "el", "Type_", "=_", "im_", "._", "get", "Pix", "el", "Type_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "check", " ", "for", " ", "output", " ", "Pix", "el", "Type_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "has", "\\u", "input_", "(_", "\"", "Output", " ", "Pix", "el", "Type", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "out", "Pix", "el", "Type_", "=_", "self_", "._", "get", "\\u", "input_", "(_", "\"", "Output", " ", "Pix", "el", "Type", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "out", "Pix", "el", "Type_", "=_", "in", "Pix", "el", "Type_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "check", " ", "for", " ", "dimension_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "has", "\\u", "input_", "(_", "\"", "Dimen", "sion", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "dim_", "=_", "self_", "._", "get", "\\u", "input_", "(_", "\"", "Dimen", "sion", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "dim_", "=_", "im_", "._", "get", "Dim_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "outd", "im_", "=_", "dim_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "set", " ", "up", " ", "filter_", "\\u\\u\\uNL\\u\\u\\u_", "in", "Im", "g", "Type_", "=_", "itk", "_", "._", "Image_", "[_", "in", "Pix", "el", "Type_", "._", "\\u", "type_", ",_", "dim_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "out", "Im", "g", "Type_", "=_", "itk", "_", "._", "Image_", "[_", "out", "Pix", "el", "Type_", "._", "\\u", "type_", ",_", "dim_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "filter\\u_", "=_", "itk", "_", "._", "Recursive", "Gaussian", "Image", "Filter_", "[_", "in", "Im", "g", "Type_", ",_", "out", "Im", "g", "Type_", "]_", "._", "New_", "(_", "im_", "._", "get", "Img_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "sigma_", "=_", "self_", "._", "get", "\\u", "input_", "(_", "\"", "Sigm", "a", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "filter\\u_", "._", "Set", "Sigma_", "(_", "sigma_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "filter\\u_", "._", "Update_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "setup", " ", "output", " ", "image_", "\\u\\u\\uNL\\u\\u\\u_", "out", "Im", "_", "=_", "Image_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "out", "Im", "_", "._", "set", "Img_", "(_", "self_", "._", "filter\\u_", "._", "Get", "Output_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "out", "Im", "_", "._", "set", "Pix", "el", "Type_", "(_", "out", "Pix", "el", "Type_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "out", "Im", "_", "._", "set", "Dim_", "(_", "dim_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "set\\u", "output_", "(_", "\"", "Output", " ", "Image", "\"_", ",_", "out", "Im", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "set\\u", "output_", "(_", "\"", "Output", " ", "Pix", "el", "Type", "\"_", ",_", "out", "Pix", "el", "Type_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "set\\u", "output_", "(_", "\"", "Output", " ", "Dimen", "sion", "\"_", ",_", "outd", "im_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Recursive", "Gaussian", "Image", "Filter_", "(_", "Module_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "classmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "register_", "(_", "cls_", ",_", "reg_", ",_", "basic_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "reg_", "._", "add", "\\u", "module_", "(_", "cls_", ",_", "name_", "=_", "\"", "Recursive", " ", "Gaussian", " ", "Image", " ", "Filter", "\"_", ",_", "namespace_", "=_", "cls_", "._", "my", "\\u", "namespace_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "reg_", "._", "add", "\\u", "input", "\\u", "port_", "(_", "cls_", ",_", "\"", "Inp", "ut", " ", "Image", "\"_", ",_", "(_", "Image_", ",_", "'", "Inp", "ut", " ", "Image", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "reg_", "._", "add", "\\u", "input", "\\u", "port_", "(_", "cls_", ",_", "\"", "Inp", "ut", " ", "Dimen", "sion", "\"_", ",_", "(_", "basic_", "._", "Integer_", ",_", "'", "Inp", "ut", " ", "Dimen", "sion", "'_", ")_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "reg_", "._", "add", "\\u", "input", "\\u", "port_", "(_", "cls_", ",_", "\"", "Inp", "ut", " ", "Pix", "el", "Type", "\"_", ",_", "(_", "Pix", "el", "Type_", ",_", "'", "Inp", "ut", " ", "Pix", "el", "Type", "'_", ")_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "reg_", "._", "add", "\\u", "input", "\\u", "port_", "(_", "cls_", ",_", "\"", "Sigm", "a", "\"_", ",_", "(_", "basic_", "._", "Float_", ",_", "'", "Sigm", "a", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "reg_", "._", "add", "\\u", "output", "\\u", "port_", "(_", "cls_", ",_", "\"", "Output", " ", "Image", "\"_", ",_", "(_", "Image_", ",_", "'", "Output", " ", "Image", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "reg_", "._", "add", "\\u", "output", "\\u", "port_", "(_", "cls_", ",_", "\"", "Output", " ", "Dimen", "sion", "\"_", ",_", "(_", "basic_", "._", "Integer_", ",_", "'", "Output", " ", "Dimen", "sion", "'_", ")_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "reg_", "._", "add", "\\u", "output", "\\u", "port_", "(_", "cls_", ",_", "\"", "Output", " ", "Pix", "el", "Type", "\"_", ",_", "(_", "Pix", "el", "Type_", ",_", "'", "Output", " ", "Pix", "el", "Type", "'_", ")_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Cur", "vat", "ure", "Flow", "Image", "Filter_", "(_", "Module_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "my", "\\u", "namespace_", "=_", "\"", "Filter", "|", "Smooth", "ing", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Cur", "vat", "ure", "Flow", "Image", "Filter_", "(_", "Module_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "compute_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "im_", "=_", "self_", "._", "get", "\\u", "input_", "(_", "\"", "Inp", "ut", " ", "Image", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "check", " ", "for", " ", "input", " ", "Pix", "el", "Type_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "self_", "._", "has", "\\u", "input_", "(_", "\"", "Inp", "ut", " ", "Pix", "el", "Type", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "in", "Pix", "el", "Type_", "=_", "self_", "._", "get", "\\u", "input_", "(_", "\"", "Inp", "ut", " ", "Pix", "el", "Type", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "in", "Pix", "el", "Type_", "=_", "im_", "._", "get", "Pix", "el", "Type_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "check", " ", "for", " ", "dimension_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "has", "\\u", "input_", "(_", "\"", "Dimen", "sion", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "dim_", "=_", "self_", "._", "get", "\\u", "input_", "(_", "\"", "Dimen", "sion", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "dim_", "=_", "im_", "._", "get", "Dim_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "set", " ", "up", " ", "filter_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "in", "Im", "g", "Type_", "=_", "itk", "_", "._", "Image_", "[_", "in", "Pix", "el", "Type_", "._", "\\u", "type_", ",_", "dim_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "filter\\u_", "=_", "itk", "_", "._", "Cur", "vat", "ure", "Flow", "Image", "Filter_", "[_", "in", "Im", "g", "Type_", ",_", "in", "Im", "g", "Type_", "]_", "._", "New_", "(_", "im_", "._", "get", "Img_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Modul", "e", "Error_", "(_", "self_", ",_", "\"", "Filter", " ", "require", "s", " ", "a", " ", "decima", "l", " ", "Pix", "el", "Type", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "default", " ", "values", " ", "recommende", "d_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "has", "\\u", "input_", "(_", "\"", "Time", "Step", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "ts_", "=_", "self_", "._", "get", "\\u", "input_", "(_", "\"", "Time", "Step", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "ts_", "=_", "0.125_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "has", "\\u", "input_", "(_", "\"", "Iterations", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "iterations_", "=_", "self_", "._", "get", "\\u", "input_", "(_", "\"", "Iterations", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "iterations_", "=_", "5_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "filter\\u_", "._", "Set", "Time", "Step_", "(_", "self_", "._", "ts_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "filter\\u_", "._", "Set", "Number", "Of", "Iterations", "_", "(_", "self_", "._", "iterations_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "filter\\u_", "._", "Update_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "setup", " ", "output", " ", "image_", "\\u\\u\\uNL\\u\\u\\u_", "out", "Im", "_", "=_", "Image_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "out", "Im", "_", "._", "set", "Img_", "(_", "self_", "._", "filter\\u_", "._", "Get", "Output_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "out", "Im", "_", "._", "set", "Pix", "el", "Type_", "(_", "in", "Pix", "el", "Type_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "out", "Im", "_", "._", "set", "Dim_", "(_", "dim_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "set\\u", "output_", "(_", "\"", "Output", " ", "Image", "\"_", ",_", "out", "Im", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Cur", "vat", "ure", "Flow", "Image", "Filter_", "(_", "Module_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "classmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "register_", "(_", "cls_", ",_", "reg_", ",_", "basic_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "reg_", "._", "add", "\\u", "module_", "(_", "cls_", ",_", "name_", "=_", "\"", "Cur", "vat", "ure", " ", "Flow", " ", "Image", " ", "Filter", "\"_", ",_", "namespace_", "=_", "cls_", "._", "my", "\\u", "namespace_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "reg_", "._", "add", "\\u", "input", "\\u", "port_", "(_", "cls_", ",_", "\"", "Inp", "ut", " ", "Image", "\"_", ",_", "(_", "Image_", ",_", "'", "Inp", "ut", " ", "Image", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "reg_", "._", "add", "\\u", "input", "\\u", "port_", "(_", "cls_", ",_", "\"", "Inp", "ut", " ", "Dimen", "sion", "\"_", ",_", "(_", "basic_", "._", "Integer_", ",_", "'", "Inp", "ut", " ", "Dimen", "sion", "'_", ")_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "reg_", "._", "add", "\\u", "input", "\\u", "port_", "(_", "cls_", ",_", "\"", "Inp", "ut", " ", "Pix", "el", "Type", "\"_", ",_", "(_", "Pix", "el", "Type_", ",_", "'", "Inp", "ut", " ", "Pix", "el", "Type", "'_", ")_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "reg_", "._", "add", "\\u", "input", "\\u", "port_", "(_", "cls_", ",_", "\"", "Time", "Step", "\"_", ",_", "(_", "basic_", "._", "Float_", ",_", "'", "Time", "Step", "'_", ")_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "reg_", "._", "add", "\\u", "input", "\\u", "port_", "(_", "cls_", ",_", "\"", "Iterations", "\"_", ",_", "(_", "basic_", "._", "Integer_", ",_", "'", "Iterations", "'_", ")_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "reg_", "._", "add", "\\u", "output", "\\u", "port_", "(_", "cls_", ",_", "\"", "Output", " ", "Image", "\"_", ",_", "(_", "Image_", ",_", "'", "Output", " ", "Image", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Discr", "ete", "Gaussian", "Image", "Filter_", "(_", "Module_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "my", "\\u", "namespace_", "=_", "'", "Filter", "|", "Smooth", "ing", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Discr", "ete", "Gaussian", "Image", "Filter_", "(_", "Module_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "compute_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "im_", "=_", "self_", "._", "get", "\\u", "input_", "(_", "\"", "Inp", "ut", " ", "Image", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "check", " ", "for", " ", "input", " ", "Pix", "el", "Type_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "self_", "._", "has", "\\u", "input_", "(_", "\"", "Inp", "ut", " ", "Pix", "el", "Type", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "in", "Pix", "el", "Type_", "=_", "self_", "._", "get", "\\u", "input_", "(_", "\"", "Inp", "ut", " ", "Pix", "el", "Type", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "in", "Pix", "el", "Type_", "=_", "im_", "._", "get", "Pix", "el", "Type_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "check", " ", "for", " ", "output", " ", "Pix", "el", "Type_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "has", "\\u", "input_", "(_", "\"", "Output", " ", "Pix", "el", "Type", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "out", "Pix", "el", "Type_", "=_", "self_", "._", "get", "\\u", "input_", "(_", "\"", "Output", " ", "Pix", "el", "Type", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "out", "Pix", "el", "Type_", "=_", "in", "Pix", "el", "Type_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "check", " ", "for", " ", "dimension_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "has", "\\u", "input_", "(_", "\"", "Dimen", "sion", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "dim_", "=_", "self_", "._", "get", "\\u", "input_", "(_", "\"", "Dimen", "sion", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "dim_", "=_", "im_", "._", "get", "Dim_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "set", " ", "up", " ", "filter_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "in", "Im", "g", "Type_", "=_", "itk", "_", "._", "Image_", "[_", "in", "Pix", "el", "Type_", "._", "\\u", "type_", ",_", "dim_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "out", "Im", "g", "Type_", "=_", "itk", "_", "._", "Image_", "[_", "out", "Pix", "el", "Type_", "._", "\\u", "type_", ",_", "dim_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "gauss", "ian", "\\u", "variance_", "=_", "self_", "._", "get", "\\u", "input_", "(_", "\"", "Gaussian", " ", "Variance", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "max", "\\u", "kernel", "\\u", "width_", "=_", "self_", "._", "get", "\\u", "input_", "(_", "\"", "Max", " ", "Kern", "el", " ", "Wid", "th", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "filter\\u_", "=_", "itk", "_", "._", "Discr", "ete", "Gaussian", "Image", "Filter_", "[_", "in", "Im", "g", "Type_", ",_", "out", "Im", "g", "Type_", "]_", "._", "New_", "(_", "im_", "._", "get", "Img_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Modul", "e", "Error_", "(_", "self_", ",_", "\"", "Requ", "ires", " ", "Signe", "d", " ", "Pix", "el", "Type", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "filter\\u_", "._", "Set", "Variance", "_", "(_", "gauss", "ian", "\\u", "variance_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "filter\\u_", "._", "Set", "Maxim", "um", "Kern", "el", "Width_", "(_", "max", "\\u", "kernel", "\\u", "width_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "filter\\u_", "._", "Update_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "setup", " ", "output", " ", "image_", "\\u\\u\\uNL\\u\\u\\u_", "out", "Im", "_", "=_", "Image_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "out", "Im", "_", "._", "set", "Img_", "(_", "self_", "._", "filter\\u_", "._", "Get", "Output_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "out", "Im", "_", "._", "set", "Pix", "el", "Type_", "(_", "out", "Pix", "el", "Type_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "out", "Im", "_", "._", "set", "Dim_", "(_", "dim_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "set", " ", "results_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "set\\u", "output_", "(_", "\"", "Output", " ", "Image", "\"_", ",_", "out", "Im", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "set\\u", "output_", "(_", "\"", "Filter", "\"_", ",_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "set\\u", "output_", "(_", "\"", "Output", " ", "Pix", "el", "Type", "\"_", ",_", "out", "Pix", "el", "Type_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Discr", "ete", "Gaussian", "Image", "Filter_", "(_", "Module_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "classmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "register_", "(_", "cls_", ",_", "reg_", ",_", "basic_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "reg_", "._", "add", "\\u", "module_", "(_", "cls_", ",_", "name_", "=_", "\"", "Discr", "ete", " ", "Gaussian", " ", "Image", " ", "Filter", "\"_", ",_", "namespace_", "=_", "cls_", "._", "my", "\\u", "namespace_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "reg_", "._", "add", "\\u", "input", "\\u", "port_", "(_", "cls_", ",_", "\"", "Inp", "ut", " ", "Image", "\"_", ",_", "(_", "Image_", ",_", "'", "Inp", "ut", " ", "Image", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "reg_", "._", "add", "\\u", "input", "\\u", "port_", "(_", "cls_", ",_", "\"", "Inp", "ut", " ", "Pix", "el", "Type", "\"_", ",_", "(_", "Pix", "el", "Type_", ",_", "'", "Inp", "ut", " ", "Pix", "el", "Type", "'_", ")_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "reg_", "._", "add", "\\u", "input", "\\u", "port_", "(_", "cls_", ",_", "\"", "Output", " ", "Pix", "el", "Type", "\"_", ",_", "(_", "Pix", "el", "Type_", ",_", "'", "Output", " ", "Pix", "el", "Type", "'_", ")_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "reg_", "._", "add", "\\u", "input", "\\u", "port_", "(_", "cls_", ",_", "\"", "Dimen", "sion", "\"_", ",_", "(_", "basic_", "._", "Integer_", ",_", "'", "Dimen", "sion", "'_", ")_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "reg_", "._", "add", "\\u", "input", "\\u", "port_", "(_", "cls_", ",_", "\"", "Gaussian", " ", "Variance", "\"_", ",_", "(_", "basic_", "._", "Float_", ",_", "'", "Gaussian", " ", "Variance", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "reg_", "._", "add", "\\u", "input", "\\u", "port_", "(_", "cls_", ",_", "\"", "Max", " ", "Kern", "el", " ", "Wid", "th", "\"_", ",_", "(_", "basic_", "._", "Integer_", ",_", "'", "Max", " ", "Kern", "el", " ", "Wid", "th", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "reg_", "._", "add", "\\u", "output", "\\u", "port_", "(_", "cls_", ",_", "\"", "Output", " ", "Image", "\"_", ",_", "(_", "Image_", ",_", "'", "Output", " ", "Image", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "reg_", "._", "add", "\\u", "output", "\\u", "port_", "(_", "cls_", ",_", "\"", "Filter", "\"_", ",_", "(_", "Filter_", ",_", "'", "Filter", "'_", ")_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "reg_", "._", "add", "\\u", "output", "\\u", "port_", "(_", "cls_", ",_", "\"", "Output", " ", "Pix", "el", "Type", "\"_", ",_", "(_", "Pix", "el", "Type_", ",_", "'", "Output", " ", "Pix", "el", "Type", "'_", ")_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Bin", "omial", "Blur", "Image", "Filter_", "(_", "Module_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "my", "\\u", "namespace_", "=_", "'", "Filter", "|", "Smooth", "ing", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Bin", "omial", "Blur", "Image", "Filter_", "(_", "Module_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "compute_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "im_", "=_", "self_", "._", "get", "\\u", "input_", "(_", "\"", "Inp", "ut", " ", "Image", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "check", " ", "for", " ", "input", " ", "Pix", "el", "Type_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "self_", "._", "has", "\\u", "input_", "(_", "\"", "Inp", "ut", " ", "Pix", "el", "Type", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "in", "Pix", "el", "Type_", "=_", "self_", "._", "get", "\\u", "input_", "(_", "\"", "Inp", "ut", " ", "Pix", "el", "Type", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "in", "Pix", "el", "Type_", "=_", "im_", "._", "get", "Pix", "el", "Type_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "check", " ", "for", " ", "output", " ", "Pix", "el", "Type_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "has", "\\u", "input_", "(_", "\"", "Output", " ", "Pix", "el", "Type", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "out", "Pix", "el", "Type_", "=_", "self_", "._", "get", "\\u", "input_", "(_", "\"", "Output", " ", "Pix", "el", "Type", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "out", "Pix", "el", "Type_", "=_", "in", "Pix", "el", "Type_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "check", " ", "for", " ", "dimension_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "has", "\\u", "input_", "(_", "\"", "Dimen", "sion", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "dim_", "=_", "self_", "._", "get", "\\u", "input_", "(_", "\"", "Dimen", "sion", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "dim_", "=_", "im_", "._", "get", "Dim_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "set", " ", "up", " ", "filter_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "in", "Im", "g", "Type_", "=_", "itk", "_", "._", "Image_", "[_", "in", "Pix", "el", "Type_", "._", "\\u", "type_", ",_", "dim_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "out", "Im", "g", "Type_", "=_", "itk", "_", "._", "Image_", "[_", "out", "Pix", "el", "Type_", "._", "\\u", "type_", ",_", "dim_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "repetitions", "_", "=_", "self_", "._", "get", "\\u", "input_", "(_", "\"", "Rep", "eti", "tion", "s", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "filter\\u_", "=_", "itk", "_", "._", "Bin", "omial", "Blur", "Image", "Filter_", "[_", "in", "Im", "g", "Type_", ",_", "out", "Im", "g", "Type_", "]_", "._", "New_", "(_", "im_", "._", "get", "Img_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "filter\\u_", "._", "Set", "Rep", "eti", "tions_", "(_", "repetitions", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "filter\\u_", "._", "Update_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "setup", " ", "output", " ", "image_", "\\u\\u\\uNL\\u\\u\\u_", "out", "Im", "_", "=_", "Image_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "out", "Im", "_", "._", "set", "Img_", "(_", "self_", "._", "filter\\u_", "._", "Get", "Output_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "out", "Im", "_", "._", "set", "Pix", "el", "Type_", "(_", "out", "Pix", "el", "Type_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "out", "Im", "_", "._", "set", "Dim_", "(_", "dim_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "set", " ", "results_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "set\\u", "output_", "(_", "\"", "Output", " ", "Image", "\"_", ",_", "out", "Im", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "set\\u", "output_", "(_", "\"", "Filter", "\"_", ",_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "set\\u", "output_", "(_", "\"", "Output", " ", "Pix", "el", "Type", "\"_", ",_", "out", "Pix", "el", "Type_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Bin", "omial", "Blur", "Image", "Filter_", "(_", "Module_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "classmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "register_", "(_", "cls_", ",_", "reg_", ",_", "basic_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "reg_", "._", "add", "\\u", "module_", "(_", "cls_", ",_", "name_", "=_", "\"", "Bin", "omial", "Blur", " ", "Image", " ", "Filter", "\"_", ",_", "namespace_", "=_", "cls_", "._", "my", "\\u", "namespace_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "reg_", "._", "add", "\\u", "input", "\\u", "port_", "(_", "cls_", ",_", "\"", "Inp", "ut", " ", "Image", "\"_", ",_", "(_", "Image_", ",_", "'", "Inp", "ut", " ", "Image", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "reg_", "._", "add", "\\u", "input", "\\u", "port_", "(_", "cls_", ",_", "\"", "Inp", "ut", " ", "Pix", "el", "Type", "\"_", ",_", "(_", "Pix", "el", "Type_", ",_", "'", "Inp", "ut", " ", "Pix", "el", "Type", "'_", ")_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "reg_", "._", "add", "\\u", "input", "\\u", "port_", "(_", "cls_", ",_", "\"", "Output", " ", "Pix", "el", "Type", "\"_", ",_", "(_", "Pix", "el", "Type_", ",_", "'", "Output", " ", "Pix", "el", "Type", "'_", ")_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "reg_", "._", "add", "\\u", "input", "\\u", "port_", "(_", "cls_", ",_", "\"", "Dimen", "sion", "\"_", ",_", "(_", "basic_", "._", "Integer_", ",_", "'", "Dimen", "sion", "'_", ")_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "reg_", "._", "add", "\\u", "input", "\\u", "port_", "(_", "cls_", ",_", "\"", "Rep", "eti", "tion", "s", "\"_", ",_", "(_", "basic_", "._", "Integer_", ",_", "'", "Rep", "eti", "tion", "s", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "reg_", "._", "add", "\\u", "output", "\\u", "port_", "(_", "cls_", ",_", "\"", "Output", " ", "Image", "\"_", ",_", "(_", "Image_", ",_", "'", "Output", " ", "Image", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "reg_", "._", "add", "\\u", "output", "\\u", "port_", "(_", "cls_", ",_", "\"", "Filter", "\"_", ",_", "(_", "Filter_", ",_", "'", "Filter", "'_", ")_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "reg_", "._", "add", "\\u", "output", "\\u", "port_", "(_", "cls_", ",_", "\"", "Output", " ", "Pix", "el", "Type", "\"_", ",_", "(_", "Pix", "el", "Type_", ",_", "'", "Output", " ", "Pix", "el", "Type", "'_", ")_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Grad", "ient", "An", "isot", "rop", "ic", "Diffus", "ion", "Image", "Filter_", "(_", "Module_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "my", "\\u", "namespace_", "=_", "'", "Filter", "|", "Smooth", "ing", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Grad", "ient", "An", "isot", "rop", "ic", "Diffus", "ion", "Image", "Filter_", "(_", "Module_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "compute_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "im_", "=_", "self_", "._", "get", "\\u", "input_", "(_", "\"", "Inp", "ut", " ", "Image", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "check", " ", "for", " ", "input", " ", "Pix", "el", "Type_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "self_", "._", "has", "\\u", "input_", "(_", "\"", "Inp", "ut", " ", "Pix", "el", "Type", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "in", "Pix", "el", "Type_", "=_", "self_", "._", "get", "\\u", "input_", "(_", "\"", "Inp", "ut", " ", "Pix", "el", "Type", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "in", "Pix", "el", "Type_", "=_", "im_", "._", "get", "Pix", "el", "Type_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "check", " ", "for", " ", "output", " ", "Pix", "el", "Type_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "has", "\\u", "input_", "(_", "\"", "Output", " ", "Pix", "el", "Type", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "out", "Pix", "el", "Type_", "=_", "self_", "._", "get", "\\u", "input_", "(_", "\"", "Output", " ", "Pix", "el", "Type", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "out", "Pix", "el", "Type_", "=_", "in", "Pix", "el", "Type_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "check", " ", "for", " ", "dimension_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "has", "\\u", "input_", "(_", "\"", "Dimen", "sion", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "dim_", "=_", "self_", "._", "get", "\\u", "input_", "(_", "\"", "Dimen", "sion", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "dim_", "=_", "im_", "._", "get", "Dim_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "set", " ", "up", " ", "filter_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "in", "Im", "g", "Type_", "=_", "itk", "_", "._", "Image_", "[_", "in", "Pix", "el", "Type_", "._", "\\u", "type_", ",_", "dim_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "out", "Im", "g", "Type_", "=_", "itk", "_", "._", "Image_", "[_", "out", "Pix", "el", "Type_", "._", "\\u", "type_", ",_", "dim_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "timestep_", "=_", "self_", "._", "get", "\\u", "input_", "(_", "\"", "Timest", "ep", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "conduct", "ance_", "=_", "self_", "._", "get", "\\u", "input_", "(_", "\"", "Conduct", "anc", "e", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "iterations_", "=_", "self_", "._", "get", "\\u", "input_", "(_", "\"", "Iterations", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "filter\\u_", "=_", "itk", "_", "._", "Grad", "ient", "An", "isot", "rop", "ic", "Diffus", "ion", "Image", "Filter_", "[_", "in", "Im", "g", "Type_", ",_", "out", "Im", "g", "Type_", "]_", "._", "New_", "(_", "im_", "._", "get", "Img_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Modul", "e", "Error_", "(_", "self_", ",_", "\"", "Requ", "ires", " ", "Deci", "mal", " ", "Pix", "el", "Type", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "filter\\u_", "._", "Set", "Time", "Step_", "(_", "timestep_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "filter\\u_", "._", "Set", "Conduct", "anc", "e", "Parameter_", "(_", "conduct", "ance_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "filter\\u_", "._", "Set", "Number", "Of", "Iterations", "_", "(_", "iterations_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "filter\\u_", "._", "Update_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "setup", " ", "output", " ", "image_", "\\u\\u\\uNL\\u\\u\\u_", "out", "Im", "_", "=_", "Image_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "out", "Im", "_", "._", "set", "Img_", "(_", "self_", "._", "filter\\u_", "._", "Get", "Output_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "out", "Im", "_", "._", "set", "Pix", "el", "Type_", "(_", "out", "Pix", "el", "Type_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "out", "Im", "_", "._", "set", "Dim_", "(_", "dim_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "set", " ", "results_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "set\\u", "output_", "(_", "\"", "Output", " ", "Image", "\"_", ",_", "out", "Im", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "set\\u", "output_", "(_", "\"", "Filter", "\"_", ",_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "set\\u", "output_", "(_", "\"", "Output", " ", "Pix", "el", "Type", "\"_", ",_", "out", "Pix", "el", "Type_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Grad", "ient", "An", "isot", "rop", "ic", "Diffus", "ion", "Image", "Filter_", "(_", "Module_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "classmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "register_", "(_", "cls_", ",_", "reg_", ",_", "basic_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "reg_", "._", "add", "\\u", "module_", "(_", "cls_", ",_", "name_", "=_", "\"", "Grad", "ient", " ", "An", "isot", "rop", "ic", " ", "Diffus", "ion", " ", "Image", " ", "Filter", "\"_", ",_", "namespace_", "=_", "cls_", "._", "my", "\\u", "namespace_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "reg_", "._", "add", "\\u", "input", "\\u", "port_", "(_", "cls_", ",_", "\"", "Inp", "ut", " ", "Image", "\"_", ",_", "(_", "Image_", ",_", "'", "Inp", "ut", " ", "Image", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "reg_", "._", "add", "\\u", "input", "\\u", "port_", "(_", "cls_", ",_", "\"", "Inp", "ut", " ", "Pix", "el", "Type", "\"_", ",_", "(_", "Pix", "el", "Type_", ",_", "'", "Inp", "ut", " ", "Pix", "el", "Type", "'_", ")_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "reg_", "._", "add", "\\u", "input", "\\u", "port_", "(_", "cls_", ",_", "\"", "Output", " ", "Pix", "el", "Type", "\"_", ",_", "(_", "Pix", "el", "Type_", ",_", "'", "Output", " ", "Pix", "el", "Type", "'_", ")_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "reg_", "._", "add", "\\u", "input", "\\u", "port_", "(_", "cls_", ",_", "\"", "Dimen", "sion", "\"_", ",_", "(_", "basic_", "._", "Integer_", ",_", "'", "Dimen", "sion", "'_", ")_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "reg_", "._", "add", "\\u", "input", "\\u", "port_", "(_", "cls_", ",_", "\"", "Timest", "ep", "\"_", ",_", "(_", "basic_", "._", "Float_", ",_", "'", "Timest", "ep", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "reg_", "._", "add", "\\u", "input", "\\u", "port_", "(_", "cls_", ",_", "\"", "Conduct", "anc", "e", "\"_", ",_", "(_", "basic_", "._", "Float_", ",_", "'", "Conduct", "anc", "e", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "reg_", "._", "add", "\\u", "input", "\\u", "port_", "(_", "cls_", ",_", "\"", "Iterations", "\"_", ",_", "(_", "basic_", "._", "Integer_", ",_", "'", "Iterations", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "reg_", "._", "add", "\\u", "output", "\\u", "port_", "(_", "cls_", ",_", "\"", "Output", " ", "Image", "\"_", ",_", "(_", "Image_", ",_", "'", "Output", " ", "Image", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "reg_", "._", "add", "\\u", "output", "\\u", "port_", "(_", "cls_", ",_", "\"", "Filter", "\"_", ",_", "(_", "Filter_", ",_", "'", "Filter", "'_", ")_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "reg_", "._", "add", "\\u", "output", "\\u", "port_", "(_", "cls_", ",_", "\"", "Output", " ", "Pix", "el", "Type", "\"_", ",_", "(_", "Pix", "el", "Type_", ",_", "'", "Output", " ", "Pix", "el", "Type", "'_", ")_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Min", "Max", "Cur", "vat", "ure", "Flow", "Image", "Filter_", "(_", "Module_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "my", "\\u", "namespace_", "=_", "'", "Filter", "|", "Smooth", "ing", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Min", "Max", "Cur", "vat", "ure", "Flow", "Image", "Filter_", "(_", "Module_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "compute_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "im_", "=_", "self_", "._", "get", "\\u", "input_", "(_", "\"", "Inp", "ut", " ", "Image", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "check", " ", "for", " ", "input", " ", "Pix", "el", "Type_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "self_", "._", "has", "\\u", "input_", "(_", "\"", "Inp", "ut", " ", "Pix", "el", "Type", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "in", "Pix", "el", "Type_", "=_", "self_", "._", "get", "\\u", "input_", "(_", "\"", "Inp", "ut", " ", "Pix", "el", "Type", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "in", "Pix", "el", "Type_", "=_", "im_", "._", "get", "Pix", "el", "Type_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "check", " ", "for", " ", "output", " ", "Pix", "el", "Type_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "has", "\\u", "input_", "(_", "\"", "Output", " ", "Pix", "el", "Type", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "out", "Pix", "el", "Type_", "=_", "self_", "._", "get", "\\u", "input_", "(_", "\"", "Output", " ", "Pix", "el", "Type", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "out", "Pix", "el", "Type_", "=_", "in", "Pix", "el", "Type_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "check", " ", "for", " ", "dimension_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "has", "\\u", "input_", "(_", "\"", "Dimen", "sion", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "dim_", "=_", "self_", "._", "get", "\\u", "input_", "(_", "\"", "Dimen", "sion", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "dim_", "=_", "im_", "._", "get", "Dim_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "set", " ", "up", " ", "filter_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "in", "Im", "g", "Type_", "=_", "itk", "_", "._", "Image_", "[_", "in", "Pix", "el", "Type_", "._", "\\u", "type_", ",_", "dim_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "out", "Im", "g", "Type_", "=_", "itk", "_", "._", "Image_", "[_", "out", "Pix", "el", "Type_", "._", "\\u", "type_", ",_", "dim_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "timestep_", "=_", "self_", "._", "get", "\\u", "input_", "(_", "\"", "Timest", "ep", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "radius_", "=_", "self_", "._", "get", "\\u", "input_", "(_", "\"", "Rad", "ius", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "iterations_", "=_", "self_", "._", "get", "\\u", "input_", "(_", "\"", "Iterations", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "filter\\u_", "=_", "itk", "_", "._", "Min", "Max", "Cur", "vat", "ure", "Flow", "Image", "Filter_", "[_", "in", "Im", "g", "Type_", ",_", "out", "Im", "g", "Type_", "]_", "._", "New_", "(_", "im_", "._", "get", "Img_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "filter\\u_", "._", "Set", "Time", "Step_", "(_", "timestep_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "filter\\u_", "._", "Set", "Ste", "nci", "l", "Radius_", "(_", "radius_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "filter\\u_", "._", "Set", "Number", "Of", "Iterations", "_", "(_", "iterations_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "filter\\u_", "._", "Update_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "setup", " ", "output", " ", "image_", "\\u\\u\\uNL\\u\\u\\u_", "out", "Im", "_", "=_", "Image_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "out", "Im", "_", "._", "set", "Img_", "(_", "self_", "._", "filter\\u_", "._", "Get", "Output_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "out", "Im", "_", "._", "set", "Pix", "el", "Type_", "(_", "out", "Pix", "el", "Type_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "out", "Im", "_", "._", "set", "Dim_", "(_", "dim_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "set", " ", "results_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "set\\u", "output_", "(_", "\"", "Output", " ", "Image", "\"_", ",_", "out", "Im", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "set\\u", "output_", "(_", "\"", "Filter", "\"_", ",_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "set\\u", "output_", "(_", "\"", "Output", " ", "Pix", "el", "Type", "\"_", ",_", "out", "Pix", "el", "Type_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Min", "Max", "Cur", "vat", "ure", "Flow", "Image", "Filter_", "(_", "Module_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "classmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "register_", "(_", "cls_", ",_", "reg_", ",_", "basic_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "reg_", "._", "add", "\\u", "module_", "(_", "cls_", ",_", "name_", "=_", "\"", "Min", "Max", " ", "Cur", "vat", "ure", " ", "Flow", " ", "Image", " ", "Filter", "\"_", ",_", "namespace_", "=_", "cls_", "._", "my", "\\u", "namespace_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "reg_", "._", "add", "\\u", "input", "\\u", "port_", "(_", "cls_", ",_", "\"", "Inp", "ut", " ", "Image", "\"_", ",_", "(_", "Image_", ",_", "'", "Inp", "ut", " ", "Image", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "reg_", "._", "add", "\\u", "input", "\\u", "port_", "(_", "cls_", ",_", "\"", "Inp", "ut", " ", "Pix", "el", "Type", "\"_", ",_", "(_", "Pix", "el", "Type_", ",_", "'", "Inp", "ut", " ", "Pix", "el", "Type", "'_", ")_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "reg_", "._", "add", "\\u", "input", "\\u", "port_", "(_", "cls_", ",_", "\"", "Output", " ", "Pix", "el", "Type", "\"_", ",_", "(_", "Pix", "el", "Type_", ",_", "'", "Output", " ", "Pix", "el", "Type", "'_", ")_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "reg_", "._", "add", "\\u", "input", "\\u", "port_", "(_", "cls_", ",_", "\"", "Dimen", "sion", "\"_", ",_", "(_", "basic_", "._", "Integer_", ",_", "'", "Dimen", "sion", "'_", ")_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "reg_", "._", "add", "\\u", "input", "\\u", "port_", "(_", "cls_", ",_", "\"", "Timest", "ep", "\"_", ",_", "(_", "basic_", "._", "Float_", ",_", "'", "Timest", "ep", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "reg_", "._", "add", "\\u", "input", "\\u", "port_", "(_", "cls_", ",_", "\"", "Rad", "ius", "\"_", ",_", "(_", "basic_", "._", "Float_", ",_", "'", "Rad", "ius", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "reg_", "._", "add", "\\u", "input", "\\u", "port_", "(_", "cls_", ",_", "\"", "Iterations", "\"_", ",_", "(_", "basic_", "._", "Integer_", ",_", "'", "Iterations", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "reg_", "._", "add", "\\u", "output", "\\u", "port_", "(_", "cls_", ",_", "\"", "Output", " ", "Image", "\"_", ",_", "(_", "Image_", ",_", "'", "Output", " ", "Image", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "reg_", "._", "add", "\\u", "output", "\\u", "port_", "(_", "cls_", ",_", "\"", "Filter", "\"_", ",_", "(_", "Filter_", ",_", "'", "Filter", "'_", ")_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "reg_", "._", "add", "\\u", "output", "\\u", "port_", "(_", "cls_", ",_", "\"", "Output", " ", "Pix", "el", "Type", "\"_", ",_", "(_", "Pix", "el", "Type_", ",_", "'", "Output", " ", "Pix", "el", "Type", "'_", ")_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Bil", "ater", "al", "Image", "Filter_", "(_", "Module_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "my", "\\u", "namespace_", "=_", "'", "Filter", "|", "Smooth", "ing", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Bil", "ater", "al", "Image", "Filter_", "(_", "Module_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "compute_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "im_", "=_", "self_", "._", "get", "\\u", "input_", "(_", "\"", "Inp", "ut", " ", "Image", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "check", " ", "for", " ", "input", " ", "Pix", "el", "Type_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "self_", "._", "has", "\\u", "input_", "(_", "\"", "Inp", "ut", " ", "Pix", "el", "Type", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "in", "Pix", "el", "Type_", "=_", "self_", "._", "get", "\\u", "input_", "(_", "\"", "Inp", "ut", " ", "Pix", "el", "Type", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "in", "Pix", "el", "Type_", "=_", "im_", "._", "get", "Pix", "el", "Type_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "check", " ", "for", " ", "output", " ", "Pix", "el", "Type_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "has", "\\u", "input_", "(_", "\"", "Output", " ", "Pix", "el", "Type", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "out", "Pix", "el", "Type_", "=_", "self_", "._", "get", "\\u", "input_", "(_", "\"", "Output", " ", "Pix", "el", "Type", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "out", "Pix", "el", "Type_", "=_", "in", "Pix", "el", "Type_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "check", " ", "for", " ", "dimension_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "has", "\\u", "input_", "(_", "\"", "Dimen", "sion", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "dim_", "=_", "self_", "._", "get", "\\u", "input_", "(_", "\"", "Dimen", "sion", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "dim_", "=_", "im_", "._", "get", "Dim_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "set", " ", "up", " ", "filter_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "in", "Im", "g", "Type_", "=_", "itk", "_", "._", "Image_", "[_", "in", "Pix", "el", "Type_", "._", "\\u", "type_", ",_", "dim_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "out", "Im", "g", "Type_", "=_", "itk", "_", "._", "Image_", "[_", "out", "Pix", "el", "Type_", "._", "\\u", "type_", ",_", "dim_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "range", "\\u", "sigma_", "=_", "self_", "._", "get", "\\u", "input_", "(_", "\"", "Range", " ", "Sigm", "a", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "domain", "\\u", "sigma_", "=_", "self_", "._", "get", "\\u", "input_", "(_", "\"", "Doma", "in", " ", "Sigm", "a", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "filter\\u_", "=_", "itk", "_", "._", "Bil", "ater", "al", "Image", "Filter_", "[_", "in", "Im", "g", "Type_", ",_", "out", "Im", "g", "Type_", "]_", "._", "New_", "(_", "im_", "._", "get", "Img_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "filter\\u_", "._", "Set", "Range", "Sigma_", "(_", "range", "\\u", "sigma_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "filter\\u_", "._", "Set", "Doma", "in", "Sigma_", "(_", "domain", "\\u", "sigma_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "filter\\u_", "._", "Update_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "setup", " ", "output", " ", "image_", "\\u\\u\\uNL\\u\\u\\u_", "out", "Im", "_", "=_", "Image_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "out", "Im", "_", "._", "set", "Img_", "(_", "self_", "._", "filter\\u_", "._", "Get", "Output_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "out", "Im", "_", "._", "set", "Pix", "el", "Type_", "(_", "out", "Pix", "el", "Type_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "out", "Im", "_", "._", "set", "Dim_", "(_", "dim_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "set", " ", "results_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "set\\u", "output_", "(_", "\"", "Output", " ", "Image", "\"_", ",_", "out", "Im", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "set\\u", "output_", "(_", "\"", "Filter", "\"_", ",_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "set\\u", "output_", "(_", "\"", "Output", " ", "Pix", "el", "Type", "\"_", ",_", "out", "Pix", "el", "Type_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Bil", "ater", "al", "Image", "Filter_", "(_", "Module_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "classmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "register_", "(_", "cls_", ",_", "reg_", ",_", "basic_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "reg_", "._", "add", "\\u", "module_", "(_", "cls_", ",_", "name_", "=_", "\"", "Bil", "ater", "al", " ", "Image", " ", "Filter", "\"_", ",_", "namespace_", "=_", "cls_", "._", "my", "\\u", "namespace_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "reg_", "._", "add", "\\u", "input", "\\u", "port_", "(_", "cls_", ",_", "\"", "Inp", "ut", " ", "Image", "\"_", ",_", "(_", "Image_", ",_", "'", "Inp", "ut", " ", "Image", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "reg_", "._", "add", "\\u", "input", "\\u", "port_", "(_", "cls_", ",_", "\"", "Inp", "ut", " ", "Pix", "el", "Type", "\"_", ",_", "(_", "Pix", "el", "Type_", ",_", "'", "Inp", "ut", " ", "Pix", "el", "Type", "'_", ")_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "reg_", "._", "add", "\\u", "input", "\\u", "port_", "(_", "cls_", ",_", "\"", "Output", " ", "Pix", "el", "Type", "\"_", ",_", "(_", "Pix", "el", "Type_", ",_", "'", "Output", " ", "Pix", "el", "Type", "'_", ")_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "reg_", "._", "add", "\\u", "input", "\\u", "port_", "(_", "cls_", ",_", "\"", "Dimen", "sion", "\"_", ",_", "(_", "basic_", "._", "Integer_", ",_", "'", "Dimen", "sion", "'_", ")_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "reg_", "._", "add", "\\u", "input", "\\u", "port_", "(_", "cls_", ",_", "\"", "Range", " ", "Sigm", "a", "\"_", ",_", "(_", "basic_", "._", "Float_", ",_", "'", "Range", " ", "Sigm", "a", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "reg_", "._", "add", "\\u", "input", "\\u", "port_", "(_", "cls_", ",_", "\"", "Doma", "in", " ", "Sigm", "a", "\"_", ",_", "(_", "basic_", "._", "Float_", ",_", "'", "Doma", "in", " ", "Sigm", "a", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "reg_", "._", "add", "\\u", "output", "\\u", "port_", "(_", "cls_", ",_", "\"", "Output", " ", "Image", "\"_", ",_", "(_", "Image_", ",_", "'", "Output", " ", "Image", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "reg_", "._", "add", "\\u", "output", "\\u", "port_", "(_", "cls_", ",_", "\"", "Filter", "\"_", ",_", "(_", "Filter_", ",_", "'", "Filter", "'_", ")_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "reg_", "._", "add", "\\u", "output", "\\u", "port_", "(_", "cls_", ",_", "\"", "Output", " ", "Pix", "el", "Type", "\"_", ",_", "(_", "Pix", "el", "Type_", ",_", "'", "Output", " ", "Pix", "el", "Type", "'_", ")_", ",_", "True_", ")_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused local variable
zzzeek/sqlalchemy/test/orm/test_lazy_relations.py
[ { "content": " @classmethod\n def setup_classes(cls):\n class Person(cls.Basic):\n pass\n\n class City(cls.Basic):\n pass", "metadata": "root.O2MWOSideFixedTest.setup_classes", "header": "['class', 'O2MWOSideFixedTest', '(', 'fixtures', '.', 'MappedTest', ')', ':', '___NEWLINE___', '# test #2948 - o2m backref with a \"m2o does/does not count\"', '___NL___', '# criteria doesn\\'t scan the \"o\" table', '___NL___', '___EOS___']", "index": 900 }, { "content": " @classmethod\n def setup_classes(cls):\n class A(cls.Basic):\n pass\n\n class B(cls.Basic):\n pass\n\n class C(cls.Basic):\n pass", "metadata": "root.RefersToSelfLazyLoadInterferenceTest.setup_classes", "header": "['class', 'RefersToSelfLazyLoadInterferenceTest', '(', 'fixtures', '.', 'MappedTest', ')', ':', '___EOS___']", "index": 1029 }, { "content": " @classmethod\n def setup_classes(cls):\n class Person(cls.Basic):\n pass\n\n class Pet(cls.Basic):\n pass", "metadata": "root.TypeCoerceTest.setup_classes", "header": "['class', 'TypeCoerceTest', '(', 'fixtures', '.', 'MappedTest', ',', 'testing', '.', 'AssertsExecutionResults', ',', ')', ':', '___EOS___']", "index": 1103 } ]
[ { "span": "Person(", "start_line": 902, "start_column": 14, "end_line": 902, "end_column": 20 }, { "span": "City(", "start_line": 905, "start_column": 14, "end_line": 905, "end_column": 18 }, { "span": "A(", "start_line": 1031, "start_column": 14, "end_line": 1031, "end_column": 15 }, { "span": "B(", "start_line": 1034, "start_column": 14, "end_line": 1034, "end_column": 15 }, { "span": "C(", "start_line": 1037, "start_column": 14, "end_line": 1037, "end_column": 15 }, { "span": "Person(", "start_line": 1105, "start_column": 14, "end_line": 1105, "end_column": 20 }, { "span": "Pet(", "start_line": 1108, "start_column": 14, "end_line": 1108, "end_column": 17 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "O", "2", "MW", "OS", "ide", "Fix", "ed", "Test_", "(_", "fixtures_", "._", "Map", "ped", "Test_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "test", " ", "#", "294", "8", " ", "-", " ", "o", "2m", " ", "back", "ref", " ", "with", " ", "a", " ", "\"", "m2", "o", " ", "doe", "s", "/", "doe", "s", " ", "not", " ", "count", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "crite", "ria", " ", "doe", "sn", "'", "t", " ", "scan", " ", "the", " ", "\"", "o", "\"", " ", "table_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "classmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "setup", "\\u", "classes_", "(_", "cls_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "class_", "Person_", "(_", "cls_", "._", "Basic_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "City_", "(_", "cls_", "._", "Basic_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Refer", "s", "To", "Self", "La", "zy", "Load", "Inter", "ference", "Test_", "(_", "fixtures_", "._", "Map", "ped", "Test_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "classmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "setup", "\\u", "classes_", "(_", "cls_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "class_", "A_", "(_", "cls_", "._", "Basic_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "B_", "(_", "cls_", "._", "Basic_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "C_", "(_", "cls_", "._", "Basic_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Type", "Coe", "rce", "Test_", "(_", "fixtures_", "._", "Map", "ped", "Test_", ",_", "testing_", "._", "Assert", "s", "Execut", "ion", "Results_", ",_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "classmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "setup", "\\u", "classes_", "(_", "cls_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uIND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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Except block handles 'BaseException'
geopython/pycsw/pycsw/ogc/csw/csw3.py
[ { "content": " def getcapabilities(self):\n ''' Handle GetCapabilities request '''\n serviceidentification = True\n serviceprovider = True\n operationsmetadata = True\n filtercaps = False\n languages = False\n\n # validate acceptformats\n LOGGER.debug('Validating ows20:AcceptFormats')\n LOGGER.debug(self.parent.context.model['operations']['GetCapabilities']['parameters']['acceptFormats']['values'])\n if 'acceptformats' in self.parent.kvp:\n bfound = False\n for fmt in self.parent.kvp['acceptformats'].split(','):\n if fmt in self.parent.context.model['operations']['GetCapabilities']['parameters']['acceptFormats']['values']:\n self.parent.mimetype = fmt\n bfound = True\n break\n if not bfound:\n return self.exceptionreport('InvalidParameterValue',\n 'acceptformats', 'Invalid acceptFormats parameter value: %s' %\n self.parent.kvp['acceptformats'])\n\n if 'sections' in self.parent.kvp and self.parent.kvp['sections'] != '':\n serviceidentification = False\n serviceprovider = False\n operationsmetadata = False\n for section in self.parent.kvp['sections'].split(','):\n if section == 'ServiceIdentification':\n serviceidentification = True\n if section == 'ServiceProvider':\n serviceprovider = True\n if section == 'OperationsMetadata':\n operationsmetadata = True\n if section == 'All':\n serviceidentification = True\n serviceprovider = True\n operationsmetadata = True\n filtercaps = True\n languages = True\n else:\n filtercaps = True\n languages = True\n\n # check extra parameters that may be def'd by profiles\n if self.parent.profiles is not None:\n for prof in self.parent.profiles['loaded'].keys():\n result = \\\n self.parent.profiles['loaded'][prof].check_parameters(self.parent.kvp)\n if result is not None:\n return self.exceptionreport(result['code'],\n result['locator'], result['text'])\n\n # @updateSequence: get latest update to repository\n try:\n updatesequence = \\\n util.get_time_iso2unix(self.parent.repository.query_insert())\n except:\n updatesequence = None\n\n node = etree.Element(util.nspath_eval('csw30:Capabilities',\n self.parent.context.namespaces),\n nsmap=self.parent.context.namespaces, version='3.0.0',\n updateSequence=str(updatesequence))\n\n if 'updatesequence' in self.parent.kvp:\n if int(self.parent.kvp['updatesequence']) == updatesequence:\n return node\n elif int(self.parent.kvp['updatesequence']) > updatesequence:\n return self.exceptionreport('InvalidUpdateSequence',\n 'updatesequence',\n 'outputsequence specified (%s) is higher than server\\'s \\\n updatesequence (%s)' % (self.parent.kvp['updatesequence'],\n updatesequence))\n\n node.attrib[util.nspath_eval('xsi:schemaLocation',\n self.parent.context.namespaces)] = '%s %s/csw/3.0/cswGetCapabilities.xsd' % \\\n (self.parent.context.namespaces['csw30'],\n self.parent.config.get('server', 'ogc_schemas_base'))\n\n metadata_main = dict(self.parent.config.items('metadata:main'))\n\n if serviceidentification:\n LOGGER.debug('Writing section ServiceIdentification.')\n\n serviceidentification = etree.SubElement(node, \\\n util.nspath_eval('ows20:ServiceIdentification',\n self.parent.context.namespaces))\n\n etree.SubElement(serviceidentification,\n util.nspath_eval('ows20:Title', self.parent.context.namespaces)).text = \\\n metadata_main.get('identification_title', 'missing')\n\n etree.SubElement(serviceidentification,\n util.nspath_eval('ows20:Abstract', self.parent.context.namespaces)).text = \\\n metadata_main.get('identification_abstract', 'missing')\n\n keywords = etree.SubElement(serviceidentification,\n util.nspath_eval('ows20:Keywords', self.parent.context.namespaces))\n\n for k in \\\n metadata_main.get('identification_keywords').split(','):\n etree.SubElement(\n keywords, util.nspath_eval('ows20:Keyword',\n self.parent.context.namespaces)).text = k\n\n etree.SubElement(keywords,\n util.nspath_eval('ows20:Type', self.parent.context.namespaces),\n codeSpace='ISOTC211/19115').text = \\\n metadata_main.get('identification_keywords_type', 'missing')\n\n etree.SubElement(serviceidentification,\n util.nspath_eval('ows20:ServiceType', self.parent.context.namespaces),\n codeSpace='OGC').text = 'CSW'\n\n for stv in self.parent.context.model['parameters']['version']['values']:\n etree.SubElement(serviceidentification,\n util.nspath_eval('ows20:ServiceTypeVersion',\n self.parent.context.namespaces)).text = stv\n\n if self.parent.profiles is not None:\n for prof in self.parent.profiles['loaded'].keys():\n prof_name = self.parent.profiles['loaded'][prof].name\n prof_val = self.parent.profiles['loaded'][prof].namespaces[prof_name]\n\n etree.SubElement(serviceidentification,\n util.nspath_eval('ows20:Profile',\n self.parent.context.namespaces)).text = prof_val\n\n etree.SubElement(serviceidentification,\n util.nspath_eval('ows20:Fees', self.parent.context.namespaces)).text = \\\n metadata_main.get('identification_fees', 'missing')\n\n etree.SubElement(serviceidentification,\n util.nspath_eval('ows20:AccessConstraints',\n self.parent.context.namespaces)).text = \\\n metadata_main.get('identification_accessconstraints', 'missing')\n\n if serviceprovider:\n LOGGER.debug('Writing section ServiceProvider.')\n serviceprovider = etree.SubElement(node,\n util.nspath_eval('ows20:ServiceProvider', self.parent.context.namespaces))\n\n etree.SubElement(serviceprovider,\n util.nspath_eval('ows20:ProviderName', self.parent.context.namespaces)).text = \\\n metadata_main.get('provider_name', 'missing')\n\n providersite = etree.SubElement(serviceprovider,\n util.nspath_eval('ows20:ProviderSite', self.parent.context.namespaces))\n\n providersite.attrib[util.nspath_eval('xlink:type',\n self.parent.context.namespaces)] = 'simple'\n\n providersite.attrib[util.nspath_eval('xlink:href',\n self.parent.context.namespaces)] = \\\n metadata_main.get('provider_url', 'missing')\n\n servicecontact = etree.SubElement(serviceprovider,\n util.nspath_eval('ows20:ServiceContact', self.parent.context.namespaces))\n\n etree.SubElement(servicecontact,\n util.nspath_eval('ows20:IndividualName',\n self.parent.context.namespaces)).text = \\\n metadata_main.get('contact_name', 'missing')\n\n etree.SubElement(servicecontact,\n util.nspath_eval('ows20:PositionName',\n self.parent.context.namespaces)).text = \\\n metadata_main.get('contact_position', 'missing')\n\n contactinfo = etree.SubElement(servicecontact,\n util.nspath_eval('ows20:ContactInfo', self.parent.context.namespaces))\n\n phone = etree.SubElement(contactinfo, util.nspath_eval('ows20:Phone',\n self.parent.context.namespaces))\n\n etree.SubElement(phone, util.nspath_eval('ows20:Voice',\n self.parent.context.namespaces)).text = \\\n metadata_main.get('contact_phone', 'missing')\n\n etree.SubElement(phone, util.nspath_eval('ows20:Facsimile',\n self.parent.context.namespaces)).text = \\\n metadata_main.get('contact_fax', 'missing')\n\n address = etree.SubElement(contactinfo,\n util.nspath_eval('ows20:Address', self.parent.context.namespaces))\n\n etree.SubElement(address,\n util.nspath_eval('ows20:DeliveryPoint',\n self.parent.context.namespaces)).text = \\\n metadata_main.get('contact_address', 'missing')\n\n etree.SubElement(address, util.nspath_eval('ows20:City',\n self.parent.context.namespaces)).text = \\\n metadata_main.get('contact_city', 'missing')\n\n etree.SubElement(address,\n util.nspath_eval('ows20:AdministrativeArea',\n self.parent.context.namespaces)).text = \\\n metadata_main.get('contact_stateorprovince', 'missing')\n\n etree.SubElement(address,\n util.nspath_eval('ows20:PostalCode',\n self.parent.context.namespaces)).text = \\\n metadata_main.get('contact_postalcode', 'missing')\n\n etree.SubElement(address,\n util.nspath_eval('ows20:Country', self.parent.context.namespaces)).text = \\\n metadata_main.get('contact_country', 'missing')\n\n etree.SubElement(address,\n util.nspath_eval('ows20:ElectronicMailAddress',\n self.parent.context.namespaces)).text = \\\n metadata_main.get('contact_email', 'missing')\n\n url = etree.SubElement(contactinfo,\n util.nspath_eval('ows20:OnlineResource', self.parent.context.namespaces))\n\n url.attrib[util.nspath_eval('xlink:type',\n self.parent.context.namespaces)] = 'simple'\n\n url.attrib[util.nspath_eval('xlink:href',\n self.parent.context.namespaces)] = \\\n metadata_main.get('contact_url', 'missing')\n\n etree.SubElement(contactinfo,\n util.nspath_eval('ows20:HoursOfService',\n self.parent.context.namespaces)).text = \\\n metadata_main.get('contact_hours', 'missing')\n\n etree.SubElement(contactinfo,\n util.nspath_eval('ows20:ContactInstructions',\n self.parent.context.namespaces)).text = \\\n metadata_main.get('contact_instructions', 'missing')\n\n etree.SubElement(servicecontact,\n util.nspath_eval('ows20:Role', self.parent.context.namespaces),\n codeSpace='ISOTC211/19115').text = \\\n metadata_main.get('contact_role', 'missing')\n\n if operationsmetadata:\n LOGGER.debug('Writing section OperationsMetadata.')\n operationsmetadata = etree.SubElement(node,\n util.nspath_eval('ows20:OperationsMetadata',\n self.parent.context.namespaces))\n\n for operation in self.parent.context.model['operations_order']:\n oper = etree.SubElement(operationsmetadata,\n util.nspath_eval('ows20:Operation', self.parent.context.namespaces),\n name=operation)\n\n dcp = etree.SubElement(oper, util.nspath_eval('ows20:DCP',\n self.parent.context.namespaces))\n\n http = etree.SubElement(dcp, util.nspath_eval('ows20:HTTP',\n self.parent.context.namespaces))\n\n if self.parent.context.model['operations'][operation]['methods']['get']:\n get = etree.SubElement(http, util.nspath_eval('ows20:Get',\n self.parent.context.namespaces))\n\n get.attrib[util.nspath_eval('xlink:type',\\\n self.parent.context.namespaces)] = 'simple'\n\n get.attrib[util.nspath_eval('xlink:href',\\\n self.parent.context.namespaces)] = self.parent.config.get('server', 'url')\n\n if self.parent.context.model['operations'][operation]['methods']['post']:\n post = etree.SubElement(http, util.nspath_eval('ows20:Post',\n self.parent.context.namespaces))\n post.attrib[util.nspath_eval('xlink:type',\n self.parent.context.namespaces)] = 'simple'\n post.attrib[util.nspath_eval('xlink:href',\n self.parent.context.namespaces)] = \\\n self.parent.config.get('server', 'url')\n\n for parameter in \\\n sorted(self.parent.context.model['operations'][operation]['parameters']):\n param = etree.SubElement(oper,\n util.nspath_eval('ows20:Parameter',\n self.parent.context.namespaces), name=parameter)\n\n param.append(self._write_allowed_values(self.parent.context.model['operations'][operation]['parameters'][parameter]['values']))\n\n if operation == 'GetRecords': # advertise queryables, MaxRecordDefault\n for qbl in sorted(self.parent.repository.queryables.keys()):\n if qbl not in ['_all', 'SupportedDublinCoreQueryables']:\n param = etree.SubElement(oper,\n util.nspath_eval('ows20:Constraint',\n self.parent.context.namespaces), name=qbl)\n\n param.append(self._write_allowed_values(self.parent.repository.queryables[qbl]))\n\n if self.parent.profiles is not None:\n for con in sorted(self.parent.context.model[\\\n 'operations']['GetRecords']['constraints'].keys()):\n param = etree.SubElement(oper,\n util.nspath_eval('ows20:Constraint',\n self.parent.context.namespaces), name=con)\n\n param.append(self._write_allowed_values(self.parent.context.model['operations']['GetRecords']['constraints'][con]['values']))\n\n extra_constraints = {\n 'OpenSearchDescriptionDocument': ['%s?mode=opensearch&service=CSW&version=3.0.0&request=GetCapabilities' % self.parent.config.get('server', 'url')],\n 'MaxRecordDefault': self.parent.context.model['constraints']['MaxRecordDefault']['values'],\n }\n\n for key in sorted(extra_constraints.keys()):\n param = etree.SubElement(oper,\n util.nspath_eval('ows20:Constraint',\n self.parent.context.namespaces), name=key)\n param.append(self._write_allowed_values(extra_constraints[key]))\n\n if 'FederatedCatalogues' in self.parent.context.model['constraints']:\n param = etree.SubElement(oper,\n util.nspath_eval('ows20:Constraint',\n self.parent.context.namespaces), name='FederatedCatalogues')\n param.append(self._write_allowed_values(self.parent.context.model['constraints']['FederatedCatalogues']['values']))\n\n for parameter in sorted(self.parent.context.model['parameters'].keys()):\n param = etree.SubElement(operationsmetadata,\n util.nspath_eval('ows20:Parameter', self.parent.context.namespaces),\n name=parameter)\n\n param.append(self._write_allowed_values(self.parent.context.model['parameters'][parameter]['values']))\n\n for qbl in sorted(self.parent.repository.queryables.keys()):\n if qbl == 'SupportedDublinCoreQueryables':\n param = etree.SubElement(operationsmetadata,\n util.nspath_eval('ows20:Constraint',\n self.parent.context.namespaces), name='CoreQueryables')\n param.append(self._write_allowed_values(self.parent.repository.queryables[qbl]))\n\n for constraint in sorted(self.parent.context.model['constraints'].keys()):\n param = etree.SubElement(operationsmetadata,\n util.nspath_eval('ows20:Constraint', self.parent.context.namespaces),\n name=constraint)\n\n param.append(self._write_allowed_values(self.parent.context.model['constraints'][constraint]['values']))\n\n if self.parent.profiles is not None:\n for prof in self.parent.profiles['loaded'].keys():\n ecnode = \\\n self.parent.profiles['loaded'][prof].get_extendedcapabilities()\n if ecnode is not None:\n operationsmetadata.append(ecnode)\n\n if languages:\n LOGGER.debug('Writing section ows:Languages')\n langs = etree.SubElement(node,\n util.nspath_eval('ows20:Languages', self.parent.context.namespaces))\n etree.SubElement(langs,\n util.nspath_eval('ows20:Language', self.parent.context.namespaces)).text = self.parent.language['639_code']\n\n if not filtercaps:\n return node\n\n # always write out Filter_Capabilities\n LOGGER.debug('Writing section Filter_Capabilities.')\n fltcaps = etree.SubElement(node,\n util.nspath_eval('fes20:Filter_Capabilities', self.parent.context.namespaces))\n\n conformance = etree.SubElement(fltcaps,\n util.nspath_eval('fes20:Conformance', self.parent.context.namespaces))\n\n for value in fes2.MODEL['Conformance']['values']:\n constraint = etree.SubElement(conformance,\n util.nspath_eval('fes20:Constraint', self.parent.context.namespaces),\n name=value)\n etree.SubElement(constraint,\n util.nspath_eval('ows11:NoValues', self.parent.context.namespaces))\n etree.SubElement(constraint,\n util.nspath_eval('ows11:DefaultValue', self.parent.context.namespaces)).text = 'TRUE'\n\n idcaps = etree.SubElement(fltcaps,\n util.nspath_eval('fes20:Id_Capabilities', self.parent.context.namespaces))\n\n for idcap in fes2.MODEL['Ids']['values']:\n etree.SubElement(idcaps, util.nspath_eval('fes20:ResourceIdentifier',\n self.parent.context.namespaces), name=idcap)\n\n scalarcaps = etree.SubElement(fltcaps,\n util.nspath_eval('fes20:Scalar_Capabilities', self.parent.context.namespaces))\n\n etree.SubElement(scalarcaps, util.nspath_eval('fes20:LogicalOperators',\n self.parent.context.namespaces))\n\n cmpops = etree.SubElement(scalarcaps,\n util.nspath_eval('fes20:ComparisonOperators', self.parent.context.namespaces))\n\n for cmpop in sorted(fes2.MODEL['ComparisonOperators'].keys()):\n etree.SubElement(cmpops,\n util.nspath_eval('fes20:ComparisonOperator',\n self.parent.context.namespaces), name=fes2.MODEL['ComparisonOperators'][cmpop]['opname'])\n\n spatialcaps = etree.SubElement(fltcaps,\n util.nspath_eval('fes20:Spatial_Capabilities', self.parent.context.namespaces))\n\n geomops = etree.SubElement(spatialcaps,\n util.nspath_eval('fes20:GeometryOperands', self.parent.context.namespaces))\n\n for geomtype in \\\n fes2.MODEL['GeometryOperands']['values']:\n etree.SubElement(geomops,\n util.nspath_eval('fes20:GeometryOperand',\n self.parent.context.namespaces), name=geomtype)\n\n spatialops = etree.SubElement(spatialcaps,\n util.nspath_eval('fes20:SpatialOperators', self.parent.context.namespaces))\n\n for spatial_comparison in \\\n fes2.MODEL['SpatialOperators']['values']:\n etree.SubElement(spatialops,\n util.nspath_eval('fes20:SpatialOperator', self.parent.context.namespaces),\n name=spatial_comparison)\n\n functions = etree.SubElement(fltcaps,\n util.nspath_eval('fes20:Functions', self.parent.context.namespaces))\n\n for fnop in sorted(fes2.MODEL['Functions'].keys()):\n fn = etree.SubElement(functions,\n util.nspath_eval('fes20:Function', self.parent.context.namespaces),\n name=fnop)\n\n etree.SubElement(fn, util.nspath_eval('fes20:Returns',\n self.parent.context.namespaces)).text = \\\n fes2.MODEL['Functions'][fnop]['returns']\n\n return node", "metadata": "root.Csw3.getcapabilities", "header": "['class', 'Csw3', '(', 'object', ')', ':', '___EOS___']", "index": 56 }, { "content": " def getdomain(self):\n ''' Handle GetDomain request '''\n if ('parametername' not in self.parent.kvp and\n 'valuereference' not in self.parent.kvp):\n return self.exceptionreport('MissingParameterValue',\n 'parametername', 'Missing value. \\\n One of valuereference or parametername must be specified')\n\n node = etree.Element(util.nspath_eval('csw30:GetDomainResponse',\n self.parent.context.namespaces), nsmap=self.parent.context.namespaces)\n\n node.attrib[util.nspath_eval('xsi:schemaLocation',\n self.parent.context.namespaces)] = '%s %s/csw/3.0/cswGetDomain.xsd' % \\\n (self.parent.context.namespaces['csw30'],\n self.parent.config.get('server', 'ogc_schemas_base'))\n\n if 'parametername' in self.parent.kvp:\n for pname in self.parent.kvp['parametername'].split(','):\n LOGGER.debug('Parsing parametername %s.' % pname)\n domainvalue = etree.SubElement(node,\n util.nspath_eval('csw30:DomainValues', self.parent.context.namespaces),\n type='csw30:Record', resultType='available')\n etree.SubElement(domainvalue,\n util.nspath_eval('csw30:ParameterName',\n self.parent.context.namespaces)).text = pname\n try:\n operation, parameter = pname.split('.')\n except:\n return node\n if (operation in self.parent.context.model['operations'] and\n parameter in self.parent.context.model['operations'][operation]['parameters']):\n listofvalues = etree.SubElement(domainvalue,\n util.nspath_eval('csw30:ListOfValues', self.parent.context.namespaces))\n for val in \\\n sorted(self.parent.context.model['operations'][operation]\\\n ['parameters'][parameter]['values']):\n etree.SubElement(listofvalues,\n util.nspath_eval('csw30:Value',\n self.parent.context.namespaces)).text = val\n\n if 'valuereference' in self.parent.kvp:\n for pname in self.parent.kvp['valuereference'].split(','):\n LOGGER.debug('Parsing valuereference %s.' % pname)\n\n if pname.find('/') == 0: # it's an XPath\n pname2 = pname\n else: # it's a core queryable, map to internal typename model\n try:\n pname2 = self.parent.repository.queryables['_all'][pname]['dbcol']\n except:\n pname2 = pname\n\n # decipher typename\n dvtype = None\n if self.parent.profiles is not None:\n for prof in self.parent.profiles['loaded'].keys():\n for prefix in self.parent.profiles['loaded'][prof].prefixes:\n if pname2.find(prefix) != -1:\n dvtype = self.parent.profiles['loaded'][prof].typename\n break\n if not dvtype:\n dvtype = 'csw30:Record'\n\n domainvalue = etree.SubElement(node,\n util.nspath_eval('csw30:DomainValues', self.parent.context.namespaces),\n type=dvtype, resultType='available')\n etree.SubElement(domainvalue,\n util.nspath_eval('csw30:ValueReference',\n self.parent.context.namespaces)).text = pname\n\n try:\n LOGGER.debug(\n 'Querying repository property %s, typename %s, \\\n domainquerytype %s.' % \\\n (pname2, dvtype, self.parent.domainquerytype))\n\n results = self.parent.repository.query_domain(\n pname2, dvtype, self.parent.domainquerytype, True)\n\n LOGGER.debug('Results: %s' % str(len(results)))\n\n if self.parent.domainquerytype == 'range':\n rangeofvalues = etree.SubElement(domainvalue,\n util.nspath_eval('csw30:RangeOfValues',\n self.parent.context.namespaces))\n\n etree.SubElement(rangeofvalues,\n util.nspath_eval('csw30:MinValue',\n self.parent.context.namespaces)).text = results[0][0]\n\n etree.SubElement(rangeofvalues,\n util.nspath_eval('csw30:MaxValue',\n self.parent.context.namespaces)).text = results[0][1]\n else:\n listofvalues = etree.SubElement(domainvalue,\n util.nspath_eval('csw30:ListOfValues',\n self.parent.context.namespaces))\n for result in results:\n LOGGER.debug(str(result))\n if (result is not None and\n result[0] is not None): # drop null values\n etree.SubElement(listofvalues,\n util.nspath_eval('csw30:Value',\n self.parent.context.namespaces),\n count=str(result[1])).text = result[0]\n except Exception as err:\n LOGGER.debug('No results for propertyname %s: %s.' %\n (pname2, str(err)))\n return node", "metadata": "root.Csw3.getdomain", "header": "['class', 'Csw3', '(', 'object', ')', ':', '___EOS___']", "index": 486 }, { "content": " def getrecords(self):\n ''' Handle GetRecords request '''\n\n timestamp = util.get_today_and_now()\n\n if ('elementsetname' not in self.parent.kvp and\n 'elementname' not in self.parent.kvp):\n if self.parent.requesttype == 'GET':\n LOGGER.debug(self.parent.requesttype)\n self.parent.kvp['elementsetname'] = 'summary'\n else:\n # mutually exclusive required\n return self.exceptionreport('MissingParameterValue',\n 'elementsetname',\n 'Missing one of ElementSetName or ElementName parameter(s)')\n\n if 'elementsetname' in self.parent.kvp and 'elementname' in self.parent.kvp:\n # mutually exclusive required\n return self.exceptionreport('NoApplicableCode',\n 'elementsetname',\n 'Only ONE of ElementSetName or ElementName parameter(s) is permitted')\n\n if 'elementsetname' not in self.parent.kvp:\n self.parent.kvp['elementsetname'] = 'summary'\n\n if 'outputschema' not in self.parent.kvp:\n self.parent.kvp['outputschema'] = self.parent.context.namespaces['csw30']\n\n LOGGER.debug(self.parent.context.model['operations']['GetRecords']['parameters']['outputSchema']['values'])\n if (self.parent.kvp['outputschema'] not in self.parent.context.model['operations']\n ['GetRecords']['parameters']['outputSchema']['values']):\n return self.exceptionreport('InvalidParameterValue',\n 'outputschema', 'Invalid outputSchema parameter value: %s' %\n self.parent.kvp['outputschema'])\n\n if 'outputformat' not in self.parent.kvp:\n self.parent.kvp['outputformat'] = 'application/xml'\n\n if 'HTTP_ACCEPT' in self.parent.environ:\n LOGGER.debug('Detected HTTP Accept header: %s', self.parent.environ['HTTP_ACCEPT'])\n formats_match = False\n if 'outputformat' in self.parent.kvp:\n LOGGER.debug(self.parent.kvp['outputformat'])\n for ofmt in self.parent.environ['HTTP_ACCEPT'].split(','):\n LOGGER.debug('Comparing %s and %s', ofmt, self.parent.kvp['outputformat'])\n if ofmt.split('/')[0] in self.parent.kvp['outputformat']:\n LOGGER.debug('FOUND OUTPUT MATCH')\n formats_match = True\n if not formats_match:\n return self.exceptionreport('InvalidParameterValue',\n 'outputformat', 'HTTP Accept header (%s) and outputformat (%s) must agree' %\n (self.parent.environ['HTTP_ACCEPT'], self.parent.kvp['outputformat']))\n else:\n for ofmt in self.parent.environ['HTTP_ACCEPT'].split(','):\n if ofmt in self.parent.context.model['operations']['GetRecords']['parameters']['outputFormat']['values']:\n self.parent.kvp['outputformat'] = ofmt\n break\n\n\n if (self.parent.kvp['outputformat'] not in self.parent.context.model['operations']\n ['GetRecords']['parameters']['outputFormat']['values']):\n return self.exceptionreport('InvalidParameterValue',\n 'outputformat', 'Invalid outputFormat parameter value: %s' %\n self.parent.kvp['outputformat'])\n\n if 'outputformat' in self.parent.kvp:\n LOGGER.debug('Setting content type')\n self.parent.contenttype = self.parent.kvp['outputformat']\n if self.parent.kvp['outputformat'] == 'application/atom+xml':\n self.parent.kvp['outputschema'] = self.parent.context.namespaces['atom']\n self.parent.mode = 'opensearch'\n\n if (('elementname' not in self.parent.kvp or\n len(self.parent.kvp['elementname']) == 0) and\n self.parent.kvp['elementsetname'] not in\n self.parent.context.model['operations']['GetRecords']['parameters']\n ['ElementSetName']['values']):\n return self.exceptionreport('InvalidParameterValue',\n 'elementsetname', 'Invalid ElementSetName parameter value: %s' %\n self.parent.kvp['elementsetname'])\n\n if 'typenames' not in self.parent.kvp:\n return self.exceptionreport('MissingParameterValue',\n 'typenames', 'Missing typenames parameter')\n\n if ('typenames' in self.parent.kvp and\n self.parent.requesttype == 'GET'): # passed via GET\n #self.parent.kvp['typenames'] = self.parent.kvp['typenames'].split(',')\n self.parent.kvp['typenames'] = ['csw:Record' if x=='Record' else x for x in self.parent.kvp['typenames'].split(',')]\n\n if 'namespace' in self.parent.kvp:\n LOGGER.debug('resolving KVP namespace bindings')\n LOGGER.debug(self.parent.kvp['typenames'])\n self.parent.kvp['typenames'] = self.resolve_nsmap(self.parent.kvp['typenames'])\n if 'elementname' in self.parent.kvp:\n LOGGER.debug(self.parent.kvp['elementname'])\n self.parent.kvp['elementname'] = self.resolve_nsmap(self.parent.kvp['elementname'].split(','))\n\n if 'typenames' in self.parent.kvp:\n for tname in self.parent.kvp['typenames']:\n #if tname == 'Record':\n # tname = 'csw:Record'\n if (tname not in self.parent.context.model['operations']['GetRecords']\n ['parameters']['typeNames']['values']):\n return self.exceptionreport('InvalidParameterValue',\n 'typenames', 'Invalid typeNames parameter value: %s' %\n tname)\n\n # check elementname's\n if 'elementname' in self.parent.kvp:\n for ename in self.parent.kvp['elementname']:\n if ename not in self.parent.repository.queryables['_all']:\n return self.exceptionreport('InvalidParameterValue',\n 'elementname', 'Invalid ElementName parameter value: %s' %\n ename)\n\n maxrecords_cfg = -1 # not set in config server.maxrecords\n\n if self.parent.config.has_option('server', 'maxrecords'):\n maxrecords_cfg = int(self.parent.config.get('server', 'maxrecords'))\n\n if 'maxrecords' in self.parent.kvp and self.parent.kvp['maxrecords'] == 'unlimited':\n LOGGER.debug('Detected maxrecords=unlimited')\n self.parent.kvp.pop('maxrecords')\n\n if 'maxrecords' not in self.parent.kvp: # not specified by client\n if maxrecords_cfg > -1: # specified in config\n self.parent.kvp['maxrecords'] = maxrecords_cfg\n else: # spec default\n self.parent.kvp['maxrecords'] = 10\n else: # specified by client\n if self.parent.kvp['maxrecords'] == '':\n self.parent.kvp['maxrecords'] = 10\n if maxrecords_cfg > -1: # set in config\n if int(self.parent.kvp['maxrecords']) > maxrecords_cfg:\n self.parent.kvp['maxrecords'] = maxrecords_cfg\n\n if any(x in ['bbox', 'q', 'time'] for x in self.parent.kvp):\n LOGGER.debug('OpenSearch Geo/Time parameters detected.')\n self.parent.kvp['constraintlanguage'] = 'FILTER'\n try:\n tmp_filter = opensearch.kvp2filterxml(self.parent.kvp, self.parent.context)\n except Exception as err:\n return self.exceptionreport('InvalidParameterValue', 'bbox', str(err))\n\n if tmp_filter is not \"\":\n self.parent.kvp['constraint'] = tmp_filter\n LOGGER.debug('OpenSearch Geo/Time parameters to Filter: %s.' % self.parent.kvp['constraint'])\n\n if self.parent.requesttype == 'GET':\n if 'constraint' in self.parent.kvp:\n # GET request\n LOGGER.debug('csw:Constraint passed over HTTP GET.')\n if 'constraintlanguage' not in self.parent.kvp:\n return self.exceptionreport('MissingParameterValue',\n 'constraintlanguage',\n 'constraintlanguage required when constraint specified')\n if (self.parent.kvp['constraintlanguage'] not in\n self.parent.context.model['operations']['GetRecords']['parameters']\n ['CONSTRAINTLANGUAGE']['values']):\n return self.exceptionreport('InvalidParameterValue',\n 'constraintlanguage', 'Invalid constraintlanguage: %s'\n % self.parent.kvp['constraintlanguage'])\n if self.parent.kvp['constraintlanguage'] == 'CQL_TEXT':\n tmp = self.parent.kvp['constraint']\n self.parent.kvp['constraint'] = {}\n self.parent.kvp['constraint']['type'] = 'cql'\n self.parent.kvp['constraint']['where'] = \\\n self.parent._cql_update_queryables_mappings(tmp,\n self.parent.repository.queryables['_all'])\n self.parent.kvp['constraint']['values'] = {}\n elif self.parent.kvp['constraintlanguage'] == 'FILTER':\n # validate filter XML\n try:\n schema = os.path.join(self.parent.config.get('server', 'home'),\n 'core', 'schemas', 'ogc', 'filter', '1.1.0', 'filter.xsd')\n LOGGER.debug('Validating Filter %s.' %\n self.parent.kvp['constraint'])\n schema = etree.XMLSchema(file=schema)\n parser = etree.XMLParser(schema=schema, resolve_entities=False)\n doc = etree.fromstring(self.parent.kvp['constraint'], parser)\n LOGGER.debug('Filter is valid XML.')\n self.parent.kvp['constraint'] = {}\n self.parent.kvp['constraint']['type'] = 'filter'\n self.parent.kvp['constraint']['where'], self.parent.kvp['constraint']['values'] = \\\n fes2.parse(doc,\n self.parent.repository.queryables['_all'],\n self.parent.repository.dbtype,\n self.parent.context.namespaces, self.parent.orm, self.parent.language['text'], self.parent.repository.fts)\n except Exception as err:\n errortext = \\\n 'Exception: document not valid.\\nError: %s.' % str(err)\n\n LOGGER.debug(errortext)\n return self.exceptionreport('InvalidParameterValue',\n 'bbox', 'Invalid Filter query: %s' % errortext)\n else:\n self.parent.kvp['constraint'] = {}\n\n if 'sortby' not in self.parent.kvp:\n self.parent.kvp['sortby'] = None\n elif 'sortby' in self.parent.kvp and self.parent.requesttype == 'GET':\n LOGGER.debug('Sorted query specified.')\n tmp = self.parent.kvp['sortby']\n self.parent.kvp['sortby'] = {}\n\n try:\n name, order = tmp.rsplit(':', 1)\n except:\n return self.exceptionreport('InvalidParameterValue',\n 'sortby', 'Invalid SortBy value: must be in the format\\\n propertyname:A or propertyname:D')\n\n try:\n self.parent.kvp['sortby']['propertyname'] = \\\n self.parent.repository.queryables['_all'][name]['dbcol']\n if name.find('BoundingBox') != -1 or name.find('Envelope') != -1:\n # it's a spatial sort\n self.parent.kvp['sortby']['spatial'] = True\n except Exception as err:\n return self.exceptionreport('InvalidParameterValue',\n 'sortby', 'Invalid SortBy propertyname: %s' % name)\n\n if order not in ['A', 'D']:\n return self.exceptionreport('InvalidParameterValue',\n 'sortby', 'Invalid SortBy value: sort order must be \"A\" or \"D\"')\n\n if order == 'D':\n self.parent.kvp['sortby']['order'] = 'DESC'\n else:\n self.parent.kvp['sortby']['order'] = 'ASC'\n\n if 'startposition' not in self.parent.kvp:\n self.parent.kvp['startposition'] = 1\n\n if 'recordids' in self.parent.kvp and self.parent.kvp['recordids'] != '':\n # query repository\n LOGGER.debug('Querying repository with RECORD ids: %s.' % self.parent.kvp['recordids'])\n results = self.parent.repository.query_ids(self.parent.kvp['recordids'].split(','))\n matched = str(len(results))\n if len(results) == 0:\n return self.exceptionreport('NotFound', 'recordids',\n 'No records found for \\'%s\\'' % self.parent.kvp['recordids'])\n else:\n # query repository\n LOGGER.debug('Querying repository with constraint: %s,\\\n sortby: %s, typenames: %s, maxrecords: %s, startposition: %s.' %\n (self.parent.kvp['constraint'], self.parent.kvp['sortby'], self.parent.kvp['typenames'],\n self.parent.kvp['maxrecords'], self.parent.kvp['startposition']))\n\n try:\n matched, results = self.parent.repository.query(\n constraint=self.parent.kvp['constraint'],\n sortby=self.parent.kvp['sortby'], typenames=self.parent.kvp['typenames'],\n maxrecords=self.parent.kvp['maxrecords'],\n startposition=int(self.parent.kvp['startposition'])-1)\n except Exception as err:\n return self.exceptionreport('InvalidParameterValue', 'constraint',\n 'Invalid query: %s' % err)\n\n if int(matched) == 0:\n returned = nextrecord = '0'\n else:\n if int(matched) < int(self.parent.kvp['maxrecords']):\n returned = matched\n nextrecord = '0'\n else:\n returned = str(self.parent.kvp['maxrecords'])\n if int(self.parent.kvp['startposition']) + int(self.parent.kvp['maxrecords']) >= int(matched):\n nextrecord = '0'\n else:\n nextrecord = str(int(self.parent.kvp['startposition']) + \\\n int(self.parent.kvp['maxrecords']))\n\n LOGGER.debug('Results: matched: %s, returned: %s, next: %s.' % \\\n (matched, returned, nextrecord))\n\n node = etree.Element(util.nspath_eval('csw30:GetRecordsResponse',\n self.parent.context.namespaces),\n nsmap=self.parent.context.namespaces, version='3.0.0')\n\n node.attrib[util.nspath_eval('xsi:schemaLocation',\n self.parent.context.namespaces)] = \\\n '%s %s/csw/3.0/cswGetRecordsResponse.xsd' % \\\n (self.parent.context.namespaces['csw30'], self.parent.config.get('server', 'ogc_schemas_base'))\n\n if 'requestid' in self.parent.kvp and self.parent.kvp['requestid'] is not None:\n etree.SubElement(node, util.nspath_eval('csw:RequestId',\n self.parent.context.namespaces)).text = self.parent.kvp['requestid']\n\n etree.SubElement(node, util.nspath_eval('csw30:SearchStatus',\n self.parent.context.namespaces), timestamp=timestamp)\n\n #if 'where' not in self.parent.kvp['constraint'] and \\\n #self.parent.kvp['resulttype'] is None:\n # returned = '0'\n\n searchresults = etree.SubElement(node,\n util.nspath_eval('csw30:SearchResults', self.parent.context.namespaces),\n numberOfRecordsMatched=matched, numberOfRecordsReturned=returned,\n nextRecord=nextrecord, recordSchema=self.parent.kvp['outputschema'],\n expires=timestamp, status=get_resultset_status(matched, nextrecord))\n\n if self.parent.kvp['elementsetname'] is not None:\n searchresults.attrib['elementSet'] = self.parent.kvp['elementsetname']\n\n #if 'where' not in self.parent.kvp['constraint'] \\\n #and self.parent.kvp['resulttype'] is None:\n # LOGGER.debug('Empty result set returned.')\n # return node\n\n if results is not None:\n if len(results) < int(self.parent.kvp['maxrecords']):\n max1 = len(results)\n else:\n max1 = int(self.parent.kvp['startposition']) + (int(self.parent.kvp['maxrecords'])-1)\n LOGGER.debug('Presenting records %s - %s.' %\n (self.parent.kvp['startposition'], max1))\n\n for res in results:\n try:\n if (self.parent.kvp['outputschema'] ==\n 'http://www.opengis.net/cat/csw/3.0' and\n 'csw:Record' in self.parent.kvp['typenames']):\n # serialize csw:Record inline\n searchresults.append(self._write_record(\n res, self.parent.repository.queryables['_all']))\n elif (self.parent.kvp['outputschema'] ==\n 'http://www.opengis.net/cat/csw/3.0' and\n 'csw:Record' not in self.parent.kvp['typenames']):\n # serialize into csw:Record model\n\n for prof in self.parent.profiles['loaded']:\n # find source typename\n if self.parent.profiles['loaded'][prof].typename in \\\n self.parent.kvp['typenames']:\n typename = self.parent.profiles['loaded'][prof].typename\n break\n\n util.transform_mappings(self.parent.repository.queryables['_all'],\n self.parent.context.model['typenames'][typename]\\\n ['mappings']['csw:Record'], reverse=True)\n\n searchresults.append(self._write_record(\n res, self.parent.repository.queryables['_all']))\n elif self.parent.kvp['outputschema'] in self.parent.outputschemas: # use outputschema serializer\n searchresults.append(self.parent.outputschemas[self.parent.kvp['outputschema']].write_record(res, self.parent.kvp['elementsetname'], self.parent.context, self.parent.config.get('server', 'url')))\n else: # use profile serializer\n searchresults.append(\n self.parent.profiles['loaded'][self.parent.kvp['outputschema']].\\\n write_record(res, self.parent.kvp['elementsetname'],\n self.parent.kvp['outputschema'],\n self.parent.repository.queryables['_all']))\n except Exception as err:\n self.parent.response = self.exceptionreport(\n 'NoApplicableCode', 'service',\n 'Record serialization failed: %s' % str(err))\n return self.parent.response\n\n if (self.parent.config.has_option('server', 'federatedcatalogues') and\n 'distributedsearch' in self.parent.kvp and\n self.parent.kvp['distributedsearch'] and self.parent.kvp['hopcount'] > 0):\n # do distributed search\n\n LOGGER.debug('DistributedSearch specified (hopCount: %s).' %\n self.parent.kvp['hopcount'])\n\n from owslib.csw import CatalogueServiceWeb\n from owslib.ows import ExceptionReport\n for fedcat in \\\n self.parent.config.get('server', 'federatedcatalogues').split(','):\n LOGGER.debug('Performing distributed search on federated \\\n catalogue: %s.' % fedcat)\n try:\n start_time = time()\n remotecsw = CatalogueServiceWeb(fedcat, skip_caps=True)\n remotecsw.getrecords2(xml=self.parent.request,\n esn=self.parent.kvp['elementsetname'],\n outputschema=self.parent.kvp['outputschema'])\n\n fsr = etree.SubElement(searchresults, util.nspath_eval(\n 'csw30:FederatedSearchResult',\n self.parent.context.namespaces),\n catalogueURL=fedcat.request)\n\n msg = 'Distributed search results from catalogue %s: %s.' % (fedcat, remotecsw.results)\n LOGGER.debug(msg)\n fsr.append(etree.Comment(msg))\n\n search_result = etree.SubElement(fsr, util.nspath_eval(\n 'csw30:searchResult', self.parent.context.namespaces),\n recordSchema=self.parent.kvp['outputschema'],\n elementSetName=self.parent.kvp['elementsetname'],\n numberOfRecordsMatched=fedcat.results['matches'],\n numberOfRecordsReturned=fedcat.results['returned'],\n nextRecord=fedcat.results['nextrecord'],\n elapsedTime=get_elapsed_time(start_time, time()),\n status=get_resultset_status(\n fedcat.results['matches'],\n fedcat.results['nextrecord']))\n\n search_result.append(remotecsw.records)\n except ExceptionReport as err:\n error_string = 'remote CSW %s returned exception: ' % fedcat\n searchresults.append(etree.Comment(\n ' %s\\n\\n%s ' % (error_string, err)))\n LOGGER.debug(str(err))\n except Exception as err:\n error_string = 'remote CSW %s returned error: ' % fedcat\n searchresults.append(etree.Comment(\n ' %s\\n\\n%s ' % (error_string, err)))\n LOGGER.debug(str(err))\n\n# if len(dsresults) > 0: # return DistributedSearch results\n# for resultset in dsresults:\n# if isinstance(resultset, etree._Comment):\n# searchresults.append(resultset)\n# for rec in resultset:\n# searchresults.append(etree.fromstring(resultset[rec].xml, self.parent.context.parser))\n\n searchresults.attrib['elapsedTime'] = get_elapsed_time(self.parent.process_time_start, time())\n\n if 'responsehandler' in self.parent.kvp: # process the handler\n self.parent._process_responsehandler(etree.tostring(node,\n pretty_print=self.parent.pretty_print))\n else:\n return node", "metadata": "root.Csw3.getrecords", "header": "['class', 'Csw3', '(', 'object', ')', ':', '___EOS___']", "index": 596 }, { "content": " def exceptionreport(self, code, locator, text):\n ''' Generate ExceptionReport '''\n self.parent.exception = True\n self.parent.status = code\n\n try:\n language = self.parent.config.get('server', 'language')\n ogc_schemas_base = self.parent.config.get('server', 'ogc_schemas_base')\n except:\n language = 'en-US'\n ogc_schemas_base = self.parent.context.ogc_schemas_base\n\n node = etree.Element(util.nspath_eval('ows20:ExceptionReport',\n self.parent.context.namespaces), nsmap=self.parent.context.namespaces,\n version='3.0.0')\n\n node.attrib['{http://www.w3.org/XML/1998/namespace}lang'] = language\n\n node.attrib[util.nspath_eval('xsi:schemaLocation',\n self.parent.context.namespaces)] = \\\n '%s %s/ows/2.0/owsExceptionReport.xsd' % \\\n (self.parent.context.namespaces['ows20'], ogc_schemas_base)\n\n exception = etree.SubElement(node, util.nspath_eval('ows20:Exception',\n self.parent.context.namespaces),\n exceptionCode=code, locator=locator)\n\n etree.SubElement(exception,\n util.nspath_eval('ows20:ExceptionText',\n self.parent.context.namespaces)).text = text\n\n return node", "metadata": "root.Csw3.exceptionreport", "header": "['class', 'Csw3', '(', 'object', ')', ':', '___EOS___']", "index": 1994 }, { "content": "def write_boundingbox(bbox, nsmap):\n ''' Generate ows20:BoundingBox '''\n\n if bbox is not None:\n try:\n bbox2 = util.wkt2geom(bbox)\n except:\n return None\n\n if len(bbox2) == 4:\n boundingbox = etree.Element(util.nspath_eval('ows20:BoundingBox',\n nsmap), crs='http://www.opengis.net/def/crs/EPSG/0/4326',\n dimensions='2')\n\n etree.SubElement(boundingbox, util.nspath_eval('ows20:LowerCorner',\n nsmap)).text = '%s %s' % (bbox2[1], bbox2[0])\n\n etree.SubElement(boundingbox, util.nspath_eval('ows20:UpperCorner',\n nsmap)).text = '%s %s' % (bbox2[3], bbox2[2])\n\n return boundingbox\n else:\n return None\n else:\n return None\n if nextrecord == 0:\n searchresult_status = 'complete'\n elif nextrecord > 0:\n searchresult_status = 'subset'\n elif matched == 0:\n searchresult_status = 'none'", "metadata": "root.write_boundingbox", "header": "['module', '___EOS___']", "index": 2069 } ]
[ { "span": "except:", "start_line": 113, "start_column": 8, "end_line": 113, "end_column": 15 }, { "span": "except:", "start_line": 513, "start_column": 16, "end_line": 513, "end_column": 23 }, { "span": "except:", "start_line": 535, "start_column": 20, "end_line": 535, "end_column": 27 }, { "span": "except:", "start_line": 804, "start_column": 12, "end_line": 804, "end_column": 19 }, { "span": "except:", "start_line": 2002, "start_column": 8, "end_line": 2002, "end_column": 15 }, { "span": "except:", "start_line": 2075, "start_column": 8, "end_line": 2075, "end_column": 15 } ]
[]
1
true
[ "[CLS]_", "Except", "_", "block_", "handles_", "'", "Base", "Except", "ion", "'_", "[SEP]_", "class_", "Cs", "w3", "_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "getc", "apa", "bilit", "ies_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", " ", "Handle", " ", "Get", "Capabilities", " ", "request", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "service", "identifica", "tion_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "service", "provider_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "operati", "ons", "metadata_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "filter", "caps_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "languages_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "validat", "e", " ", "accept", "formats_", "\\u\\u\\uNL\\u\\u\\u_", "LOGGER_", "._", "debug_", "(_", "'", "Validat", "ing", " ", "ow", "s2", "0", ":", "Accept", "Format", "s", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "LOGGER_", "._", "debug_", "(_", "self_", "._", "parent_", "._", "context_", "._", "model_", "[_", "'", "operati", "ons", "'_", "]_", "[_", "'", "Get", "Capabilities", "'_", "]_", "[_", "'", "parameter", "s", "'_", "]_", "[_", "'", "accept", "Format", "s", "'_", "]_", "[_", "'", "values", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "'", "accept", "formats", "'_", "in_", "self_", "._", "parent_", "._", "kv", "p_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "bf", "ound_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "fmt_", "in_", "self_", "._", "parent_", "._", "kv", "p_", "[_", "'", "accept", "formats", "'_", "]_", "._", "split_", "(_", "','_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "fmt_", "in_", "self_", "._", "parent_", "._", "context_", "._", "model_", "[_", "'", "operati", "ons", "'_", "]_", "[_", "'", "Get", "Capabilities", "'_", "]_", "[_", "'", "parameter", "s", "'_", "]_", "[_", "'", "accept", "Format", "s", "'_", "]_", "[_", "'", "values", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "self_", "._", "parent_", "._", "mimetype_", "=_", "fmt_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bf", "ound_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "bf", "ound_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "exception", "report_", "(_", "'", "Inva", "lid", "Parameter", "Value", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "accept", "formats", "'_", ",_", "'", "Inva", "lid", " ", "accept", "Format", "s", " ", "parameter", " ", "value", ":", " ", "%", "s", "'_", "%_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "parent_", "._", "kv", "p_", "[_", "'", "accept", "formats", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "'", "section", "s", "'_", "in_", "self_", "._", "parent_", "._", "kv", "p_", "and_", "self_", "._", "parent_", "._", "kv", "p_", "[_", "'", "section", "s", "'_", "]_", "!=_", "''_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "service", "identifica", "tion_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "service", "provider_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "operati", "ons", "metadata_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "section_", "in_", "self_", "._", "parent_", "._", "kv", "p_", "[_", "'", "section", "s", "'_", "]_", "._", "split_", "(_", "','_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "section_", "==_", "'", "Service", "Identif", "ication", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "service", "identifica", "tion_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "section_", "==_", "'", "Service", "Provider", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "service", "provider_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "section_", "==_", "'", "Opera", "tion", "s", "Meta", "data", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "operati", "ons", "metadata_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "section_", "==_", "'", "All", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "service", "identifica", "tion_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "service", "provider_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "operati", "ons", "metadata_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "filter", "caps_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "languages_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "filter", "caps_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "languages_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "check", " ", "extra", " ", "parameter", "s", " ", "tha", "t", " ", "may", " ", "be", " ", "def", "'", "d", " ", "by", " ", "profiles_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "parent_", "._", "profiles_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "prof_", "in_", "self_", "._", "parent_", "._", "profiles_", "[_", "'", "load", "ed", "'_", "]_", "._", "keys_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "=_", "self_", "._", "parent_", "._", "profiles_", "[_", "'", "load", "ed", "'_", "]_", "[_", "prof_", "]_", "._", "check", "\\u", "parameters_", "(_", "self_", "._", "parent_", "._", "kv", "p_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "result_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "return_", "self_", "._", "exception", "report_", "(_", "result_", "[_", "'", "code", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "result_", "[_", "'", "locator", "'_", "]_", ",_", "result_", "[_", "'", "text", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "@", "update", "Sequ", "ence", ":", " ", "get", " ", "late", "st", " ", "update", " ", "to", " ", "repository_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "update", "sequence_", "=_", "util_", "._", "get", "\\u", "time", "\\u", "iso", "2u", "nix", "_", "(_", "self_", "._", "parent_", "._", "repository_", "._", "query", "\\u", "insert_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "update", "sequence_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "node_", "=_", "etree_", "._", "Element_", "(_", "util_", "._", "nsp", "ath", "\\u", "eval_", "(_", "'", "cs", "w3", "0", ":", "Capabilities", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "parent_", "._", "context_", "._", "namespaces_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "nsma", "p_", "=_", "self_", "._", "parent_", "._", "context_", "._", "namespaces_", ",_", "version_", "=_", "'", "3.0", ".0", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "update", "Sequence_", "=_", "str_", "(_", "update", "sequence_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "'", "update", "sequence", "'_", "in_", "self_", "._", "parent_", "._", "kv", "p_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "int_", "(_", "self_", "._", "parent_", "._", "kv", "p_", "[_", "'", "update", "sequence", "'_", "]_", ")_", "==_", "update", "sequence_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "node_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "int_", "(_", "self_", "._", "parent_", "._", "kv", "p_", "[_", "'", "update", "sequence", "'_", "]_", ")_", ">_", "update", "sequence_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "exception", "report_", "(_", "'", "Inva", "lid", "Update", "Sequ", "ence", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "update", "sequence", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "output", "sequence", " ", "specified", " ", "(%", "s", ")", " ", "is", " ", "higher", " ", "than", " ", "server", "\\\\'", "s", " ", "\\\\", "\\", "10", ";", " ", " ", " ", " ", "update", "sequence", " ", "(%", "s", ")'_", "%_", "(_", "self_", "._", "parent_", "._", "kv", "p_", "[_", "'", "update", "sequence", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "update", "sequence_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "node_", "._", "attrib_", "[_", "util_", "._", "nsp", "ath", "\\u", "eval_", "(_", "'", "xsi", ":", "schema", "Locat", "ion", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "parent_", "._", "context_", "._", "namespaces_", ")_", "]_", "=_", "'%", "s", " ", "%", "s", "/", "cs", "w", "/", "3.0", "/", "cs", "w", "Get", "Capabilities", ".", "xsd", "'_", "%_", "(_", "self_", "._", "parent_", "._", "context_", "._", "namespaces_", "[_", "'", "cs", "w3", "0", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "parent_", "._", "config_", "._", "get_", "(_", "'", "server", "'_", ",_", "'", "og", "c\\u", "schema", "s", "\\u", "base", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "metadata", "\\u", "main_", "=_", "dict_", "(_", "self_", "._", "parent_", "._", "config_", "._", "items_", "(_", "'", "metadata", ":", "main", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "service", "identifica", "tion_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "LOGGER_", "._", "debug_", "(_", "'", "Writ", "ing", " ", "section", " ", "Service", "Identif", "ication", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "service", "identifica", "tion_", "=_", "etree_", "._", "Sub", "Element_", "(_", "node_", ",_", "util_", "._", "nsp", "ath", "\\u", "eval_", "(_", "'", "ow", "s2", "0", ":", "Service", "Identif", "ication", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "parent_", "._", "context_", "._", "namespaces_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "etree_", "._", "Sub", "Element_", "(_", "service", "identifica", "tion_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "util_", "._", "nsp", "ath", "\\u", "eval_", "(_", "'", "ow", "s2", "0", ":", "Tit", "le", "'_", ",_", "self_", "._", "parent_", "._", "context_", "._", "namespaces_", ")_", ")_", "._", "text_", "=_", "metadata", "\\u", "main_", "._", "get_", "(_", "'", "identifica", "tion", "\\u", "title", "'_", ",_", "'", "missi", "ng", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "etree_", "._", "Sub", "Element_", "(_", "service", "identifica", "tion_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "util_", "._", "nsp", "ath", "\\u", "eval_", "(_", "'", "ow", "s2", "0", ":", "Abstract", "'_", ",_", "self_", "._", "parent_", "._", "context_", "._", "namespaces_", ")_", ")_", "._", "text_", "=_", "metadata", "\\u", "main_", "._", "get_", "(_", "'", "identifica", "tion", "\\u", "abstract", "'_", ",_", "'", "missi", "ng", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "keywords_", "=_", "etree_", "._", "Sub", "Element_", "(_", "service", "identifica", "tion_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "util_", "._", "nsp", "ath", "\\u", "eval_", "(_", "'", "ow", "s2", "0", ":", "Key", "words", "'_", ",_", "self_", "._", "parent_", "._", "context_", "._", "namespaces_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "k_", "in_", "metadata", "\\u", "main_", "._", "get_", "(_", "'", "identifica", "tion", "\\u", "keywords", "'_", ")_", "._", "split_", "(_", "','_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "etree_", "._", "Sub", "Element_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "keywords_", ",_", "util_", "._", "nsp", "ath", "\\u", "eval_", "(_", "'", "ow", "s2", "0", ":", "Key", "word", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "parent_", "._", "context_", "._", "namespaces_", ")_", ")_", "._", "text_", "=_", "k_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "etree_", "._", "Sub", "Element_", "(_", "keywords_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "util_", "._", "nsp", "ath", "\\u", "eval_", "(_", "'", "ow", "s2", "0", ":", "Type", "'_", ",_", "self_", "._", "parent_", "._", "context_", "._", "namespaces_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "code", "Space_", "=_", "'", "ISO", "TC", "211", "/", "191", "15", "'_", ")_", "._", "text_", "=_", "metadata", "\\u", "main_", "._", "get_", "(_", "'", "identifica", "tion", "\\u", "keywords", "\\u", "type", "'_", ",_", "'", "missi", "ng", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "etree_", "._", "Sub", "Element_", "(_", "service", "identifica", "tion_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "util_", "._", "nsp", "ath", "\\u", "eval_", "(_", "'", "ow", "s2", "0", ":", "Service", "Type", "'_", ",_", "self_", "._", "parent_", "._", "context_", "._", "namespaces_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "code", "Space_", "=_", "'", "OG", "C", "'_", ")_", "._", "text_", "=_", "'", "CS", "W", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "st", "v_", "in_", "self_", "._", "parent_", "._", "context_", "._", "model_", "[_", "'", "parameter", "s", "'_", "]_", "[_", "'", "version", "'_", "]_", "[_", "'", "values", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "etree_", "._", "Sub", "Element_", "(_", "service", "identifica", "tion_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "util_", "._", "nsp", "ath", "\\u", "eval_", "(_", "'", "ow", "s2", "0", ":", "Service", "Type", "Version", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "parent_", "._", "context_", "._", "namespaces_", ")_", ")_", "._", "text_", "=_", "st", "v_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "parent_", "._", "profiles_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "prof_", "in_", "self_", "._", "parent_", "._", "profiles_", "[_", "'", "load", "ed", "'_", "]_", "._", "keys_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "prof", "\\u", "name_", "=_", "self_", "._", "parent_", "._", "profiles_", "[_", "'", "load", "ed", "'_", "]_", "[_", "prof_", "]_", "._", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "prof", "\\u", "val_", "=_", "self_", "._", "parent_", "._", "profiles_", "[_", "'", "load", "ed", "'_", "]_", "[_", "prof_", "]_", "._", "namespaces_", "[_", "prof", "\\u", "name_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "etree_", "._", "Sub", "Element_", "(_", "service", "identifica", "tion_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "util_", "._", "nsp", "ath", "\\u", "eval_", "(_", "'", "ow", "s2", "0", ":", "Profil", "e", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "parent_", "._", "context_", "._", "namespaces_", ")_", ")_", "._", "text_", "=_", "prof", "\\u", "val_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "etree_", "._", "Sub", "Element_", "(_", "service", "identifica", "tion_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "util_", "._", "nsp", "ath", "\\u", "eval_", "(_", "'", "ow", "s2", "0", ":", "Fee", "s", "'_", ",_", "self_", "._", "parent_", "._", "context_", "._", "namespaces_", ")_", ")_", "._", "text_", "=_", "metadata", "\\u", "main_", "._", "get_", "(_", "'", "identifica", "tion", "\\u", "fees", "'_", ",_", "'", "missi", "ng", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "etree_", "._", "Sub", "Element_", "(_", "service", "identifica", "tion_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "util_", "._", "nsp", "ath", "\\u", "eval_", "(_", "'", "ow", "s2", "0", ":", "Access", "Constr", "aint", "s", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "parent_", "._", "context_", "._", "namespaces_", ")_", ")_", "._", "text_", "=_", "metadata", "\\u", "main_", "._", "get_", "(_", "'", "identifica", "tion", "\\u", "access", "constraint", "s", "'_", ",_", "'", "missi", "ng", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "service", "provider_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "LOGGER_", "._", "debug_", "(_", "'", "Writ", "ing", " ", "section", " ", "Service", "Provider", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "service", "provider_", "=_", "etree_", "._", "Sub", "Element_", "(_", "node_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "util_", "._", "nsp", "ath", "\\u", "eval_", "(_", "'", "ow", "s2", "0", ":", "Service", "Provider", "'_", ",_", "self_", "._", "parent_", "._", "context_", "._", "namespaces_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "etree_", "._", "Sub", "Element_", "(_", "service", "provider_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "util_", "._", "nsp", "ath", "\\u", "eval_", "(_", "'", "ow", "s2", "0", ":", "Provider", "Name", "'_", ",_", "self_", "._", "parent_", "._", "context_", "._", "namespaces_", ")_", ")_", "._", "text_", "=_", "metadata", "\\u", "main_", "._", "get_", "(_", "'", "provide", "r", "\\u", "name", "'_", ",_", "'", "missi", "ng", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "provide", "rsi", "te_", "=_", "etree_", "._", "Sub", "Element_", "(_", "service", "provider_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "util_", "._", "nsp", "ath", "\\u", "eval_", "(_", "'", "ow", "s2", "0", ":", "Provider", "Site", "'_", ",_", "self_", "._", "parent_", "._", "context_", "._", "namespaces_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "provide", "rsi", "te_", "._", "attrib_", "[_", "util_", "._", "nsp", "ath", "\\u", "eval_", "(_", "'", "xli", "nk", ":", "type", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "parent_", "._", "context_", "._", "namespaces_", ")_", "]_", "=_", "'", "simple", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "provide", "rsi", "te_", "._", "attrib_", "[_", "util_", "._", "nsp", "ath", "\\u", "eval_", "(_", "'", "xli", "nk", ":", "href", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "parent_", "._", "context_", "._", "namespaces_", ")_", "]_", "=_", "metadata", "\\u", "main_", "._", "get_", "(_", "'", "provide", "r", "\\u", "url", "'_", ",_", "'", "missi", "ng", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "service", "contact_", "=_", "etree_", "._", "Sub", "Element_", "(_", "service", "provider_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "util_", "._", "nsp", "ath", "\\u", "eval_", "(_", "'", "ow", "s2", "0", ":", "Service", "Conta", "ct", "'_", ",_", "self_", "._", "parent_", "._", "context_", "._", "namespaces_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "etree_", "._", "Sub", "Element_", "(_", "service", "contact_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "util_", "._", "nsp", "ath", "\\u", "eval_", "(_", "'", "ow", "s2", "0", ":", "Individual", "Name", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "parent_", "._", "context_", "._", "namespaces_", ")_", ")_", "._", "text_", "=_", "metadata", "\\u", "main_", "._", "get_", "(_", "'", "contact", "\\u", "name", "'_", ",_", "'", "missi", "ng", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "etree_", "._", "Sub", "Element_", "(_", "service", "contact_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "util_", "._", "nsp", "ath", "\\u", "eval_", "(_", "'", "ow", "s2", "0", ":", "Position", "Name", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "parent_", "._", "context_", "._", "namespaces_", ")_", ")_", "._", "text_", "=_", "metadata", "\\u", "main_", "._", "get_", "(_", "'", "contact", "\\u", "position", "'_", ",_", "'", "missi", "ng", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "contact", "info_", "=_", "etree_", "._", "Sub", "Element_", "(_", "service", "contact_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "util_", "._", "nsp", "ath", "\\u", "eval_", "(_", "'", "ow", "s2", "0", ":", "Conta", "ct", "Info", "'_", ",_", "self_", "._", "parent_", "._", "context_", "._", "namespaces_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "phone_", "=_", "etree_", "._", "Sub", "Element_", "(_", "contact", "info_", ",_", "util_", "._", "nsp", "ath", "\\u", "eval_", "(_", "'", "ow", "s2", "0", ":", "Phone", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "parent_", "._", "context_", "._", "namespaces_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "etree_", "._", "Sub", "Element_", "(_", "phone_", ",_", "util_", "._", "nsp", "ath", "\\u", "eval_", "(_", "'", "ow", "s2", "0", ":", "Voic", "e", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "parent_", "._", "context_", "._", "namespaces_", ")_", ")_", "._", "text_", "=_", "metadata", "\\u", "main_", "._", "get_", "(_", "'", "contact", "\\u", "phone", "'_", ",_", "'", "missi", "ng", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "etree_", "._", "Sub", "Element_", "(_", "phone_", ",_", "util_", "._", "nsp", "ath", "\\u", "eval_", "(_", "'", "ow", "s2", "0", ":", "Fac", "simi", "le", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "parent_", "._", "context_", "._", "namespaces_", ")_", ")_", "._", "text_", "=_", "metadata", "\\u", "main_", "._", "get_", "(_", "'", "contact", "\\u", "fax", "'_", ",_", "'", "missi", "ng", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "address_", "=_", "etree_", "._", "Sub", "Element_", "(_", "contact", "info_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "util_", "._", "nsp", "ath", "\\u", "eval_", "(_", "'", "ow", "s2", "0", ":", "Address", "'_", ",_", "self_", "._", "parent_", "._", "context_", "._", "namespaces_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "etree_", "._", "Sub", "Element_", "(_", "address_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "util_", "._", "nsp", "ath", "\\u", "eval_", "(_", "'", "ow", "s2", "0", ":", "Deliver", "y", "Point", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "parent_", "._", "context_", "._", "namespaces_", ")_", ")_", "._", "text_", "=_", "metadata", "\\u", "main_", "._", "get_", "(_", "'", "contact", "\\u", "address", "'_", ",_", "'", "missi", "ng", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "etree_", "._", "Sub", "Element_", "(_", "address_", ",_", "util_", "._", "nsp", "ath", "\\u", "eval_", "(_", "'", "ow", "s2", "0", ":", "Cit", "y", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "parent_", "._", "context_", "._", "namespaces_", ")_", ")_", "._", "text_", "=_", "metadata", "\\u", "main_", "._", "get_", "(_", "'", "contact", "\\u", "city", "'_", ",_", "'", "missi", "ng", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "etree_", "._", "Sub", "Element_", "(_", "address_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "util_", "._", "nsp", "ath", "\\u", "eval_", "(_", "'", "ow", "s2", "0", ":", "Administrati", "ve", "Area", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "parent_", "._", "context_", "._", "namespaces_", ")_", ")_", "._", "text_", "=_", "metadata", "\\u", "main_", "._", "get_", "(_", "'", "contact", "\\u", "state", "orp", "rov", "inc", "e", "'_", ",_", "'", "missi", "ng", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "etree_", "._", "Sub", "Element_", "(_", "address_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "util_", "._", "nsp", "ath", "\\u", "eval_", "(_", "'", "ow", "s2", "0", ":", "Post", "al", "Code", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "parent_", "._", "context_", "._", "namespaces_", ")_", ")_", "._", "text_", "=_", "metadata", "\\u", "main_", "._", "get_", "(_", "'", "contact", "\\u", "postal", "code", "'_", ",_", "'", "missi", "ng", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "etree_", "._", "Sub", "Element_", "(_", "address_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "util_", "._", "nsp", "ath", "\\u", "eval_", "(_", "'", "ow", "s2", "0", ":", "Count", "ry", "'_", ",_", "self_", "._", "parent_", "._", "context_", "._", "namespaces_", ")_", ")_", "._", "text_", "=_", "metadata", "\\u", "main_", "._", "get_", "(_", "'", "contact", "\\u", "countr", "y", "'_", ",_", "'", "missi", "ng", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "etree_", "._", "Sub", "Element_", "(_", "address_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "util_", "._", "nsp", "ath", "\\u", "eval_", "(_", "'", "ow", "s2", "0", ":", "Electronic", "Mail", "Address", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "parent_", "._", "context_", "._", "namespaces_", ")_", ")_", "._", "text_", "=_", "metadata", "\\u", "main_", "._", "get_", "(_", "'", "contact", "\\u", "email", "'_", ",_", "'", "missi", "ng", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "url_", "=_", "etree_", "._", "Sub", "Element_", "(_", "contact", "info_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "util_", "._", "nsp", "ath", "\\u", "eval_", "(_", "'", "ow", "s2", "0", ":", "On", "line", "Reso", "urc", "e", "'_", ",_", "self_", "._", "parent_", "._", "context_", "._", "namespaces_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "url_", "._", "attrib_", "[_", "util_", "._", "nsp", "ath", "\\u", "eval_", "(_", "'", "xli", "nk", ":", "type", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "parent_", "._", "context_", "._", "namespaces_", ")_", "]_", "=_", "'", "simple", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "url_", "._", "attrib_", "[_", "util_", "._", "nsp", "ath", "\\u", "eval_", "(_", "'", "xli", "nk", ":", "href", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "parent_", "._", "context_", "._", "namespaces_", ")_", "]_", "=_", "metadata", "\\u", "main_", "._", "get_", "(_", "'", "contact", "\\u", "url", "'_", ",_", "'", "missi", "ng", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "etree_", "._", "Sub", "Element_", "(_", "contact", "info_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "util_", "._", "nsp", "ath", "\\u", "eval_", "(_", "'", "ow", "s2", "0", ":", "Hour", "s", "Of", "Service", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "parent_", "._", "context_", "._", "namespaces_", ")_", ")_", "._", "text_", "=_", "metadata", "\\u", "main_", "._", "get_", "(_", "'", "contact", "\\u", "hour", "s", "'_", ",_", "'", "missi", "ng", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "etree_", "._", "Sub", "Element_", "(_", "contact", "info_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "util_", "._", "nsp", "ath", "\\u", "eval_", "(_", "'", "ow", "s2", "0", ":", "Conta", "ct", "Instructions", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "parent_", "._", "context_", "._", "namespaces_", ")_", ")_", "._", "text_", "=_", "metadata", "\\u", "main_", "._", "get_", "(_", "'", "contact", "\\u", "instruct", "ion", "s", "'_", ",_", "'", "missi", "ng", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "etree_", "._", "Sub", "Element_", "(_", "service", "contact_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "util_", "._", "nsp", "ath", "\\u", "eval_", "(_", "'", "ow", "s2", "0", ":", "Ro", "le", "'_", ",_", "self_", "._", "parent_", "._", "context_", "._", "namespaces_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "code", "Space_", "=_", "'", "ISO", "TC", "211", "/", "191", "15", "'_", ")_", "._", "text_", "=_", "metadata", "\\u", "main_", "._", "get_", "(_", "'", "contact", "\\u", "role", "'_", ",_", "'", "missi", "ng", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "operati", "ons", "metadata_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "LOGGER_", "._", "debug_", "(_", "'", "Writ", "ing", " ", "section", " ", "Opera", "tion", "s", "Meta", "data", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "operati", "ons", "metadata_", "=_", "etree_", "._", "Sub", "Element_", "(_", "node_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "util_", "._", "nsp", "ath", "\\u", "eval_", "(_", "'", "ow", "s2", "0", ":", "Opera", "tion", "s", "Meta", "data", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "parent_", "._", "context_", "._", "namespaces_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "operation_", "in_", "self_", "._", "parent_", "._", "context_", "._", "model_", "[_", "'", "operati", "ons", "\\u", "order", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "oper_", "=_", "etree_", "._", "Sub", "Element_", "(_", "operati", "ons", "metadata_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "util_", "._", "nsp", "ath", "\\u", "eval_", "(_", "'", "ow", "s2", "0", ":", "Opera", "tion", "'_", ",_", "self_", "._", "parent_", "._", "context_", "._", "namespaces_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "name_", "=_", "operation_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "dc", "p_", "=_", "etree_", "._", "Sub", "Element_", "(_", "oper_", ",_", "util_", "._", "nsp", "ath", "\\u", "eval_", "(_", "'", "ow", "s2", "0", ":", "DC", "P", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "parent_", "._", "context_", "._", "namespaces_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "http_", "=_", "etree_", "._", "Sub", "Element_", "(_", "dc", "p_", ",_", "util_", "._", "nsp", "ath", "\\u", "eval_", "(_", "'", "ow", "s2", "0", ":", "HTTP", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "parent_", "._", "context_", "._", "namespaces_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "self_", "._", "parent_", "._", "context_", "._", "model_", "[_", "'", "operati", "ons", "'_", "]_", "[_", "operation_", "]_", "[_", "'", "method", "s", "'_", "]_", "[_", "'", "get", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "get_", "=_", "etree_", "._", "Sub", "Element_", "(_", "http_", ",_", "util_", "._", "nsp", "ath", "\\u", "eval_", "(_", "'", "ow", "s2", "0", ":", "Get", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "parent_", "._", "context_", "._", "namespaces_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "get_", "._", "attrib_", "[_", "util_", "._", "nsp", "ath", "\\u", "eval_", "(_", "'", "xli", "nk", ":", "type", "'_", ",_", "self_", "._", "parent_", "._", "context_", "._", "namespaces_", ")_", "]_", "=_", "'", "simple", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "get_", "._", "attrib_", "[_", "util_", "._", "nsp", "ath", "\\u", "eval_", "(_", "'", "xli", "nk", ":", "href", "'_", ",_", "self_", "._", "parent_", "._", "context_", "._", "namespaces_", ")_", "]_", "=_", "self_", "._", "parent_", "._", "config_", "._", "get_", "(_", "'", "server", "'_", ",_", "'", "url", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "parent_", "._", "context_", "._", "model_", "[_", "'", "operati", "ons", "'_", "]_", "[_", "operation_", "]_", "[_", "'", "method", "s", "'_", "]_", "[_", "'", "post", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "post_", "=_", "etree_", "._", "Sub", "Element_", "(_", "http_", ",_", "util_", "._", "nsp", "ath", "\\u", "eval_", "(_", "'", "ow", "s2", "0", ":", "Post", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "parent_", "._", "context_", "._", "namespaces_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "post_", "._", "attrib_", "[_", "util_", "._", "nsp", "ath", "\\u", "eval_", "(_", "'", "xli", "nk", ":", "type", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "parent_", "._", "context_", "._", "namespaces_", ")_", "]_", "=_", "'", "simple", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "post_", "._", "attrib_", "[_", "util_", "._", "nsp", "ath", "\\u", "eval_", "(_", "'", "xli", "nk", ":", "href", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "parent_", "._", "context_", "._", "namespaces_", ")_", "]_", "=_", "self_", "._", "parent_", "._", "config_", "._", "get_", "(_", "'", "server", "'_", ",_", "'", "url", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "parameter_", "in_", "sorted_", "(_", "self_", "._", "parent_", "._", "context_", "._", "model_", "[_", "'", "operati", "ons", "'_", "]_", "[_", "operation_", "]_", "[_", "'", "parameter", "s", "'_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "param_", "=_", "etree_", "._", "Sub", "Element_", "(_", "oper_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "util_", "._", "nsp", "ath", "\\u", "eval_", "(_", "'", "ow", "s2", "0", ":", "Parameter", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "parent_", "._", "context_", "._", "namespaces_", ")_", ",_", "name_", "=_", "parameter_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "param_", "._", "append_", "(_", "self_", "._", "\\u", "write", "\\u", "allow", "ed", "\\u", "values_", "(_", "self_", "._", "parent_", "._", "context_", "._", "model_", "[_", "'", "operati", "ons", "'_", "]_", "[_", "operation_", "]_", "[_", "'", "parameter", "s", "'_", "]_", "[_", "parameter_", "]_", "[_", "'", "values", "'_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "operation_", "==_", "'", "Get", "Record", "s", "'_", ":_", "#", " ", "advertise", " ", "query", "able", "s", ",", " ", "Max", "Record", "Default_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "for_", "qb", "l_", "in_", "sorted_", "(_", "self_", "._", "parent_", "._", "repository_", "._", "query", "ables_", "._", "keys_", "(_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "if_", "qb", "l_", "not_", "in_", "[_", "'\\u", "all", "'_", ",_", "'", "Supp", "orte", "d", "Du", "blin", "Core", "Query", "able", "s", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "param_", "=_", "etree_", "._", "Sub", "Element_", "(_", "oper_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "util_", "._", "nsp", "ath", "\\u", "eval_", "(_", "'", "ow", "s2", "0", ":", "Constr", "aint", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "parent_", "._", "context_", "._", "namespaces_", ")_", ",_", "name_", "=_", "qb", "l_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "param_", "._", "append_", "(_", "self_", "._", "\\u", "write", "\\u", "allow", "ed", "\\u", "values_", "(_", "self_", "._", "parent_", "._", "repository_", "._", "query", "ables_", "[_", "qb", "l_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "parent_", "._", "profiles_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "for_", "con_", "in_", "sorted_", "(_", "self_", "._", "parent_", "._", "context_", "._", "model_", "[_", "'", "operati", "ons", "'_", "]_", "[_", "'", "Get", "Record", "s", "'_", "]_", "[_", "'", "constraint", "s", "'_", "]_", "._", "keys_", "(_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "param_", "=_", "etree_", "._", "Sub", "Element_", "(_", "oper_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "util_", "._", "nsp", "ath", "\\u", "eval_", "(_", "'", "ow", "s2", "0", ":", "Constr", "aint", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "parent_", "._", "context_", "._", "namespaces_", ")_", ",_", "name_", "=_", "con_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "param_", "._", "append_", "(_", "self_", "._", "\\u", "write", "\\u", "allow", "ed", "\\u", "values_", "(_", "self_", "._", "parent_", "._", "context_", "._", "model_", "[_", "'", "operati", "ons", "'_", "]_", "[_", "'", "Get", "Record", "s", "'_", "]_", "[_", "'", "constraint", "s", "'_", "]_", "[_", "con_", "]_", "[_", "'", "values", "'_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "extra", "\\u", "constraints_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Open", "Sear", "ch", "Descripti", "on", "Document", "'_", ":_", "[_", "'%", "s", "?", "mode", "=", "opens", "ear", "ch", "&", "service", "=", "CS", "W", "&", "version", "=", "3.0", ".0", "&", "request", "=", "Get", "Capabilities", "'_", "%_", "self_", "._", "parent_", "._", "config_", "._", "get_", "(_", "'", "server", "'_", ",_", "'", "url", "'_", ")_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Max", "Record", "Default", "'_", ":_", "self_", "._", "parent_", "._", "context_", "._", "model_", "[_", "'", "constraint", "s", "'_", "]_", "[_", "'", "Max", "Record", "Default", "'_", "]_", "[_", "'", "values", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "key_", "in_", "sorted_", "(_", "extra", "\\u", "constraints_", "._", "keys_", "(_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "param_", "=_", "etree_", "._", "Sub", "Element_", "(_", "oper_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "util_", "._", "nsp", "ath", "\\u", "eval_", "(_", "'", "ow", "s2", "0", ":", "Constr", "aint", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "parent_", "._", "context_", "._", "namespaces_", ")_", ",_", "name_", "=_", "key_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "param_", "._", "append_", "(_", "self_", "._", "\\u", "write", "\\u", "allow", "ed", "\\u", "values_", "(_", "extra", "\\u", "constraints_", "[_", "key_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "'", "Federa", "ted", "Catalog", "ues", "'_", "in_", "self_", "._", "parent_", "._", "context_", "._", "model_", "[_", "'", "constraint", "s", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "param_", "=_", "etree_", "._", "Sub", "Element_", "(_", "oper_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "util_", "._", "nsp", "ath", "\\u", "eval_", "(_", "'", "ow", "s2", "0", ":", "Constr", "aint", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "parent_", "._", "context_", "._", "namespaces_", ")_", ",_", "name_", "=_", "'", "Federa", "ted", "Catalog", "ues", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "param_", "._", "append_", "(_", "self_", "._", "\\u", "write", "\\u", "allow", "ed", "\\u", "values_", "(_", "self_", "._", "parent_", "._", "context_", "._", "model_", "[_", "'", "constraint", "s", "'_", "]_", "[_", "'", "Federa", "ted", "Catalog", "ues", "'_", "]_", "[_", "'", "values", "'_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "parameter_", "in_", "sorted_", "(_", "self_", "._", "parent_", "._", "context_", "._", "model_", "[_", "'", "parameter", "s", "'_", "]_", "._", "keys_", "(_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "param_", "=_", "etree_", "._", "Sub", "Element_", "(_", "operati", "ons", "metadata_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "util_", "._", "nsp", "ath", "\\u", "eval_", "(_", "'", "ow", "s2", "0", ":", "Parameter", "'_", ",_", "self_", "._", "parent_", "._", "context_", "._", "namespaces_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "name_", "=_", "parameter_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "param_", "._", "append_", "(_", "self_", "._", "\\u", "write", "\\u", "allow", "ed", "\\u", "values_", "(_", "self_", "._", "parent_", "._", "context_", "._", "model_", "[_", "'", "parameter", "s", "'_", "]_", "[_", "parameter_", "]_", "[_", "'", "values", "'_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "qb", "l_", "in_", "sorted_", "(_", "self_", "._", "parent_", "._", "repository_", "._", "query", "ables_", "._", "keys_", "(_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "qb", "l_", "==_", "'", "Supp", "orte", "d", "Du", "blin", "Core", "Query", "able", "s", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "param_", "=_", "etree_", "._", "Sub", "Element_", "(_", "operati", "ons", "metadata_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "util_", "._", "nsp", "ath", "\\u", "eval_", "(_", "'", "ow", "s2", "0", ":", "Constr", "aint", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "parent_", "._", "context_", "._", "namespaces_", ")_", ",_", "name_", "=_", "'", "Core", "Query", "able", "s", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "param_", "._", "append_", "(_", "self_", "._", "\\u", "write", "\\u", "allow", "ed", "\\u", "values_", "(_", "self_", "._", "parent_", "._", "repository_", "._", "query", "ables_", "[_", "qb", "l_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "constraint_", "in_", "sorted_", "(_", "self_", "._", "parent_", "._", "context_", "._", "model_", "[_", "'", "constraint", "s", "'_", "]_", "._", "keys_", "(_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "param_", "=_", "etree_", "._", "Sub", "Element_", "(_", "operati", "ons", "metadata_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "util_", "._", "nsp", "ath", "\\u", "eval_", "(_", "'", "ow", "s2", "0", ":", "Constr", "aint", "'_", ",_", "self_", "._", "parent_", "._", "context_", "._", "namespaces_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "name_", "=_", "constraint_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "param_", "._", "append_", "(_", "self_", "._", "\\u", "write", "\\u", "allow", "ed", "\\u", "values_", "(_", "self_", "._", "parent_", "._", "context_", "._", "model_", "[_", "'", "constraint", "s", "'_", "]_", "[_", "constraint_", "]_", "[_", "'", "values", "'_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "parent_", "._", "profiles_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "prof_", "in_", "self_", "._", "parent_", "._", "profiles_", "[_", "'", "load", "ed", "'_", "]_", "._", "keys_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "ec", "node_", "=_", "self_", "._", "parent_", "._", "profiles_", "[_", "'", "load", "ed", "'_", "]_", "[_", "prof_", "]_", "._", "get", "\\u", "extend", "edc", "apa", "bilit", "ies_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "ec", "node_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "operati", "ons", "metadata_", "._", "append_", "(_", "ec", "node_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "languages_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "LOGGER_", "._", "debug_", "(_", "'", "Writ", "ing", " ", "section", " ", "ow", "s", ":", "Languages", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "langs_", "=_", "etree_", "._", "Sub", "Element_", "(_", "node_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "util_", "._", "nsp", "ath", "\\u", "eval_", "(_", "'", "ow", "s2", "0", ":", "Languages", "'_", ",_", "self_", "._", "parent_", "._", "context_", "._", "namespaces_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "etree_", "._", "Sub", "Element_", "(_", "langs_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "util_", "._", "nsp", "ath", "\\u", "eval_", "(_", "'", "ow", "s2", "0", ":", "Lang", "ua", "ge", "'_", ",_", "self_", "._", "parent_", "._", "context_", "._", "namespaces_", ")_", ")_", "._", "text_", "=_", "self_", "._", "parent_", "._", "language_", "[_", "'", "639", "\\u", "code", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "filter", "caps_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "node_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "alw", "ay", "s", " ", "write", " ", "out", " ", "Filter", "\\u", "Capabilities", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "LOGGER_", "._", "debug_", "(_", "'", "Writ", "ing", " ", "section", " ", "Filter", "\\u", "Capabilities", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "flt", "caps_", "=_", "etree_", "._", "Sub", "Element_", "(_", "node_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "util_", "._", "nsp", "ath", "\\u", "eval_", "(_", "'", "fes", "20", ":", "Filter", "\\u", "Capabilities", "'_", ",_", "self_", "._", "parent_", "._", "context_", "._", "namespaces_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "conforma", "nce_", "=_", "etree_", "._", "Sub", "Element_", "(_", "flt", "caps_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "util_", "._", "nsp", "ath", "\\u", "eval_", "(_", "'", "fes", "20", ":", "Confo", "rman", "ce", "'_", ",_", "self_", "._", "parent_", "._", "context_", "._", "namespaces_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "value_", "in_", "fes", "2_", "._", "MODEL_", "[_", "'", "Confo", "rman", "ce", "'_", "]_", "[_", "'", "values", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "constraint_", "=_", "etree_", "._", "Sub", "Element_", "(_", "conforma", "nce_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "util_", "._", "nsp", "ath", "\\u", "eval_", "(_", "'", "fes", "20", ":", "Constr", "aint", "'_", ",_", "self_", "._", "parent_", "._", "context_", "._", "namespaces_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "name_", "=_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "etree_", "._", "Sub", "Element_", "(_", "constraint_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "util_", "._", "nsp", "ath", "\\u", "eval_", "(_", "'", "ow", "s1", "1", ":", "No", "Value", "s", "'_", ",_", "self_", "._", "parent_", "._", "context_", "._", "namespaces_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "etree_", "._", "Sub", "Element_", "(_", "constraint_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "util_", "._", "nsp", "ath", "\\u", "eval_", "(_", "'", "ow", "s1", "1", ":", "Default", "Value", "'_", ",_", "self_", "._", "parent_", "._", "context_", "._", "namespaces_", ")_", ")_", "._", "text_", "=_", "'", "TRU", "E", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "idc", "aps_", "=_", "etree_", "._", "Sub", "Element_", "(_", "flt", "caps_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "util_", "._", "nsp", "ath", "\\u", "eval_", "(_", "'", "fes", "20", ":", "Id", "\\u", "Capabilities", "'_", ",_", "self_", "._", "parent_", "._", "context_", "._", "namespaces_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "idc", "ap_", "in_", "fes", "2_", "._", "MODEL_", "[_", "'", "Id", "s", "'_", "]_", "[_", "'", "values", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "etree_", "._", "Sub", "Element_", "(_", "idc", "aps_", ",_", "util_", "._", "nsp", "ath", "\\u", "eval_", "(_", "'", "fes", "20", ":", "Reso", "urc", "e", "Identifie", "r", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "parent_", "._", "context_", "._", "namespaces_", ")_", ",_", "name_", "=_", "idc", "ap_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "scala", "rca", "ps_", "=_", "etree_", "._", "Sub", "Element_", "(_", "flt", "caps_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "util_", "._", "nsp", "ath", "\\u", "eval_", "(_", "'", "fes", "20", ":", "Scala", "r", "\\u", "Capabilities", "'_", ",_", "self_", "._", "parent_", "._", "context_", "._", "namespaces_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "etree_", "._", "Sub", "Element_", "(_", "scala", "rca", "ps_", ",_", "util_", "._", "nsp", "ath", "\\u", "eval_", "(_", "'", "fes", "20", ":", "Logi", "cal", "Operators", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "parent_", "._", "context_", "._", "namespaces_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "cmp", "ops_", "=_", "etree_", "._", "Sub", "Element_", "(_", "scala", "rca", "ps_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "util_", "._", "nsp", "ath", "\\u", "eval_", "(_", "'", "fes", "20", ":", "Compari", "son", "Operators", "'_", ",_", "self_", "._", "parent_", "._", "context_", "._", "namespaces_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "cmp", "op_", "in_", "sorted_", "(_", "fes", "2_", "._", "MODEL_", "[_", "'", "Compari", "son", "Operators", "'_", "]_", "._", "keys_", "(_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "etree_", "._", "Sub", "Element_", "(_", "cmp", "ops_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "util_", "._", "nsp", "ath", "\\u", "eval_", "(_", "'", "fes", "20", ":", "Compari", "son", "Opera", "tor", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "parent_", "._", "context_", "._", "namespaces_", ")_", ",_", "name_", "=_", "fes", "2_", "._", "MODEL_", "[_", "'", "Compari", "son", "Operators", "'_", "]_", "[_", "cmp", "op_", "]_", "[_", "'", "opname", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "spat", "ial", "caps_", "=_", "etree_", "._", "Sub", "Element_", "(_", "flt", "caps_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "util_", "._", "nsp", "ath", "\\u", "eval_", "(_", "'", "fes", "20", ":", "Spa", "tial", "\\u", "Capabilities", "'_", ",_", "self_", "._", "parent_", "._", "context_", "._", "namespaces_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "geom", "ops_", "=_", "etree_", "._", "Sub", "Element_", "(_", "spat", "ial", "caps_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "util_", "._", "nsp", "ath", "\\u", "eval_", "(_", "'", "fes", "20", ":", "Geometr", "y", "Opera", "nd", "s", "'_", ",_", "self_", "._", "parent_", "._", "context_", "._", "namespaces_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "geom", "type_", "in_", "fes", "2_", "._", "MODEL_", "[_", "'", "Geometr", "y", "Opera", "nd", "s", "'_", "]_", "[_", "'", "values", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "etree_", "._", "Sub", "Element_", "(_", "geom", "ops_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "util_", "._", "nsp", "ath", "\\u", "eval_", "(_", "'", "fes", "20", ":", "Geometr", "y", "Opera", "nd", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "parent_", "._", "context_", "._", "namespaces_", ")_", ",_", "name_", "=_", "geom", "type_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "spat", "ial", "ops_", "=_", "etree_", "._", "Sub", "Element_", "(_", "spat", "ial", "caps_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "util_", "._", "nsp", "ath", "\\u", "eval_", "(_", "'", "fes", "20", ":", "Spa", "tial", "Operators", "'_", ",_", "self_", "._", "parent_", "._", "context_", "._", "namespaces_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "spat", "ial", "\\u", "comparison_", "in_", "fes", "2_", "._", "MODEL_", "[_", "'", "Spa", "tial", "Operators", "'_", "]_", "[_", "'", "values", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "etree_", "._", "Sub", "Element_", "(_", "spat", "ial", "ops_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "util_", "._", "nsp", "ath", "\\u", "eval_", "(_", "'", "fes", "20", ":", "Spa", "tial", "Opera", "tor", "'_", ",_", "self_", "._", "parent_", "._", "context_", "._", "namespaces_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "name_", "=_", "spat", "ial", "\\u", "comparison_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "functions_", "=_", "etree_", "._", "Sub", "Element_", "(_", "flt", "caps_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "util_", "._", "nsp", "ath", "\\u", "eval_", "(_", "'", "fes", "20", ":", "Function", "s", "'_", ",_", "self_", "._", "parent_", "._", "context_", "._", "namespaces_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "fno", "p_", "in_", "sorted_", "(_", "fes", "2_", "._", "MODEL_", "[_", "'", "Function", "s", "'_", "]_", "._", "keys_", "(_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "fn_", "=_", "etree_", "._", "Sub", "Element_", "(_", "functions_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "util_", "._", "nsp", "ath", "\\u", "eval_", "(_", "'", "fes", "20", ":", "Function", "'_", ",_", "self_", "._", "parent_", "._", "context_", "._", "namespaces_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "name_", "=_", "fno", "p_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "etree_", "._", "Sub", "Element_", "(_", "fn_", ",_", "util_", "._", "nsp", "ath", "\\u", "eval_", "(_", "'", "fes", "20", ":", "Return", "s", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "parent_", "._", "context_", "._", "namespaces_", ")_", ")_", "._", "text_", "=_", "fes", "2_", "._", "MODEL_", "[_", "'", "Function", "s", "'_", "]_", "[_", "fno", "p_", "]_", "[_", "'", "return", "s", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "node_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Cs", "w3", "_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "getd", "omain", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", " ", "Handle", " ", "Get", "Doma", "in", " ", "request", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "(_", "'", "parameter", "name", "'_", "not_", "in_", "self_", "._", "parent_", "._", "kv", "p_", "and_", "\\u\\u\\uNL\\u\\u\\u_", "'", "value", "reference", "'_", "not_", "in_", "self_", "._", "parent_", "._", "kv", "p_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "exception", "report_", "(_", "'", "Missing", "Parameter", "Value", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "parameter", "name", "'_", ",_", "'", "Missing", " ", "value", ".", " ", "\\\\", "\\", "10", ";", " ", " ", " ", " ", "One", " ", "of", " ", "value", "reference", " ", "or", " ", "parameter", "name", " ", "must", " ", "be", " ", "specified", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "node_", "=_", "etree_", "._", "Element_", "(_", "util_", "._", "nsp", "ath", "\\u", "eval_", "(_", "'", "cs", "w3", "0", ":", "Get", "Doma", "in", "Respons", "e", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "parent_", "._", "context_", "._", "namespaces_", ")_", ",_", "nsma", "p_", "=_", "self_", "._", "parent_", "._", "context_", "._", "namespaces_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "node_", "._", "attrib_", "[_", "util_", "._", "nsp", "ath", "\\u", "eval_", "(_", "'", "xsi", ":", "schema", "Locat", "ion", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "parent_", "._", "context_", "._", "namespaces_", ")_", "]_", "=_", "'%", "s", " ", "%", "s", "/", "cs", "w", "/", "3.0", "/", "cs", "w", "Get", "Doma", "in", ".", "xsd", "'_", "%_", "(_", "self_", "._", "parent_", "._", "context_", "._", "namespaces_", "[_", "'", "cs", "w3", "0", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "parent_", "._", "config_", "._", "get_", "(_", "'", "server", "'_", ",_", "'", "og", "c\\u", "schema", "s", "\\u", "base", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "'", "parameter", "name", "'_", "in_", "self_", "._", "parent_", "._", "kv", "p_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "pname_", "in_", "self_", "._", "parent_", "._", "kv", "p_", "[_", "'", "parameter", "name", "'_", "]_", "._", "split_", "(_", "','_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "LOGGER_", "._", "debug_", "(_", "'", "Pars", "ing", " ", "parameter", "name", " ", "%", "s", ".'_", "%_", "pname_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "domain", "value_", "=_", "etree_", "._", "Sub", "Element_", "(_", "node_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "util_", "._", "nsp", "ath", "\\u", "eval_", "(_", "'", "cs", "w3", "0", ":", "Doma", "in", "Value", "s", "'_", ",_", "self_", "._", "parent_", "._", "context_", "._", "namespaces_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "type_", "=_", "'", "cs", "w3", "0", ":", "Record", "'_", ",_", "result", "Type_", "=_", "'", "avail", "able", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "etree_", "._", "Sub", "Element_", "(_", "domain", "value_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "util_", "._", "nsp", "ath", "\\u", "eval_", "(_", "'", "cs", "w3", "0", ":", "Parameter", "Name", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "parent_", "._", "context_", "._", "namespaces_", ")_", ")_", "._", "text_", "=_", "pname_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "operation_", ",_", "parameter_", "=_", "pname_", "._", "split_", "(_", "'.'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "return_", "node_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "(_", "operation_", "in_", "self_", "._", "parent_", "._", "context_", "._", "model_", "[_", "'", "operati", "ons", "'_", "]_", "and_", "\\u\\u\\uNL\\u\\u\\u_", "parameter_", "in_", "self_", "._", "parent_", "._", "context_", "._", "model_", "[_", "'", "operati", "ons", "'_", "]_", "[_", "operation_", "]_", "[_", "'", "parameter", "s", "'_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "listo", "fval", "ues_", "=_", "etree_", "._", "Sub", "Element_", "(_", "domain", "value_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "util_", "._", "nsp", "ath", "\\u", "eval_", "(_", "'", "cs", "w3", "0", ":", "List", "Of", "Value", "s", "'_", ",_", "self_", "._", "parent_", "._", "context_", "._", "namespaces_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "val_", "in_", "sorted_", "(_", "self_", "._", "parent_", "._", "context_", "._", "model_", "[_", "'", "operati", "ons", "'_", "]_", "[_", "operation_", "]_", "[_", "'", "parameter", "s", "'_", "]_", "[_", "parameter_", "]_", "[_", "'", "values", "'_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "etree_", "._", "Sub", "Element_", "(_", "listo", "fval", "ues_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "util_", "._", "nsp", "ath", "\\u", "eval_", "(_", "'", "cs", "w3", "0", ":", "Value", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "parent_", "._", "context_", "._", "namespaces_", ")_", ")_", "._", "text_", "=_", "val_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "'", "value", "reference", "'_", "in_", "self_", "._", "parent_", "._", "kv", "p_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "pname_", "in_", "self_", "._", "parent_", "._", "kv", "p_", "[_", "'", "value", "reference", "'_", "]_", "._", "split_", "(_", "','_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "LOGGER_", "._", "debug_", "(_", "'", "Pars", "ing", " ", "value", "reference", " ", "%", "s", ".'_", "%_", "pname_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "pname_", "._", "find_", "(_", "'/'_", ")_", "==_", "0_", ":_", "#", " ", "it", "'", "s", " ", "an", " ", "XP", "ath_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "pn", "ame", "2_", "=_", "pname_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "#", " ", "it", "'", "s", " ", "a", " ", "core", " ", "query", "able", ",", " ", "map", " ", "to", " ", "internal", " ", "type", "name", " ", "model_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "pn", "ame", "2_", "=_", "self_", "._", "parent_", "._", "repository_", "._", "query", "ables_", "[_", "'\\u", "all", "'_", "]_", "[_", "pname_", "]_", "[_", "'", "dbco", "l", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "pn", "ame", "2_", "=_", "pname_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "deci", "pher", " ", "typename_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "dv", "type_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "parent_", "._", "profiles_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "for_", "prof_", "in_", "self_", "._", "parent_", "._", "profiles_", "[_", "'", "load", "ed", "'_", "]_", "._", "keys_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "for_", "prefix_", "in_", "self_", "._", "parent_", "._", "profiles_", "[_", "'", "load", "ed", "'_", "]_", "[_", "prof_", "]_", "._", "prefixes_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "if_", "pn", "ame", "2_", "._", "find_", "(_", "prefix_", ")_", "!=_", "-_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "dv", "type_", "=_", "self_", "._", "parent_", "._", "profiles_", "[_", "'", "load", "ed", "'_", "]_", "[_", "prof_", "]_", "._", "typename_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "dv", "type_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "dv", "type_", "=_", "'", "cs", "w3", "0", ":", "Record", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "domain", "value_", "=_", "etree_", "._", "Sub", "Element_", "(_", "node_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "util_", "._", "nsp", "ath", "\\u", "eval_", "(_", "'", "cs", "w3", "0", ":", "Doma", "in", "Value", "s", "'_", ",_", "self_", "._", "parent_", "._", "context_", "._", "namespaces_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "type_", "=_", "dv", "type_", ",_", "result", "Type_", "=_", "'", "avail", "able", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "etree_", "._", "Sub", "Element_", "(_", "domain", "value_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "util_", "._", "nsp", "ath", "\\u", "eval_", "(_", "'", "cs", "w3", "0", ":", "Value", "Reference", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "parent_", "._", "context_", "._", "namespaces_", ")_", ")_", "._", "text_", "=_", "pname_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "LOGGER_", "._", "debug_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Query", "ing", " ", "repos", "itor", "y", " ", "property", " ", "%", "s", ",", " ", "type", "name", " ", "%", "s", ",", " ", "\\\\", "\\", "10", ";", " ", " ", "domain", "query", "type", " ", "%", "s", ".'_", "%_", "(_", "pn", "ame", "2_", ",_", "dv", "type_", ",_", "self_", "._", "parent_", "._", "domain", "query", "type_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "results_", "=_", "self_", "._", "parent_", "._", "repository_", "._", "query", "\\u", "domain_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "pn", "ame", "2_", ",_", "dv", "type_", ",_", "self_", "._", "parent_", "._", "domain", "query", "type_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "LOGGER_", "._", "debug_", "(_", "'", "Result", "s", ":", " ", "%", "s", "'_", "%_", "str_", "(_", "len_", "(_", "results_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "self_", "._", "parent_", "._", "domain", "query", "type_", "==_", "'", "range", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "range", "of", "values_", "=_", "etree_", "._", "Sub", "Element_", "(_", "domain", "value_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "util_", "._", "nsp", "ath", "\\u", "eval_", "(_", "'", "cs", "w3", "0", ":", "Range", "Of", "Value", "s", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "parent_", "._", "context_", "._", "namespaces_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "etree_", "._", "Sub", "Element_", "(_", "range", "of", "values_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "util_", "._", "nsp", "ath", "\\u", "eval_", "(_", "'", "cs", "w3", "0", ":", "Min", "Value", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "parent_", "._", "context_", "._", "namespaces_", ")_", ")_", "._", "text_", "=_", "results_", "[_", "0_", "]_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "etree_", "._", "Sub", "Element_", "(_", "range", "of", "values_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "util_", "._", "nsp", "ath", "\\u", "eval_", "(_", "'", "cs", "w3", "0", ":", "Max", "Value", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "parent_", "._", "context_", "._", "namespaces_", ")_", ")_", "._", "text_", "=_", "results_", "[_", "0_", "]_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "listo", "fval", "ues_", "=_", "etree_", "._", "Sub", "Element_", "(_", "domain", "value_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "util_", "._", "nsp", "ath", "\\u", "eval_", "(_", "'", "cs", "w3", "0", ":", "List", "Of", "Value", "s", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "parent_", "._", "context_", "._", "namespaces_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "result_", "in_", "results_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "LOGGER_", "._", "debug_", "(_", "str_", "(_", "result_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "(_", "result_", "is_", "not_", "None_", "and_", "\\u\\u\\uNL\\u\\u\\u_", "result_", "[_", "0_", "]_", "is_", "not_", "None_", ")_", ":_", "#", " ", "drop", " ", "null", " ", "values_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "etree_", "._", "Sub", "Element_", "(_", "listo", "fval", "ues_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "util_", "._", "nsp", "ath", "\\u", "eval_", "(_", "'", "cs", "w3", "0", ":", "Value", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "parent_", "._", "context_", "._", "namespaces_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "count_", "=_", "str_", "(_", "result_", "[_", "1_", "]_", ")_", ")_", "._", "text_", "=_", "result_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", "as_", "err_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "LOGGER_", "._", "debug_", "(_", "'", "No", " ", "results", " ", "for", " ", "property", "name", " ", "%", "s", ":", " ", "%", "s", ".'_", "%_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "pn", "ame", "2_", ",_", "str_", "(_", "err_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "node_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Cs", "w3", "_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "getre", "cord", "s_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", " ", "Handle", " ", "Get", "Record", "s", " ", "request", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "timestamp_", "=_", "util_", "._", "get", "\\u", "toda", "y", "\\u", "and", "\\u", "now_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "(_", "'", "element", "setn", "ame", "'_", "not_", "in_", "self_", "._", "parent_", "._", "kv", "p_", "and_", "\\u\\u\\uNL\\u\\u\\u_", "'", "element", "name", "'_", "not_", "in_", "self_", "._", "parent_", "._", "kv", "p_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "parent_", "._", "request", "type_", "==_", "'", "GET", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "LOGGER_", "._", "debug_", "(_", "self_", "._", "parent_", "._", "request", "type_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "parent_", "._", "kv", "p_", "[_", "'", "element", "setn", "ame", "'_", "]_", "=_", "'", "summar", "y", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "mutual", "ly", " ", "exclu", "sive", " ", "required_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "exception", "report_", "(_", "'", "Missing", "Parameter", "Value", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "element", "setn", "ame", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Missing", " ", "one", " ", "of", " ", "Element", "Set", "Name", " ", "or", " ", "Element", "Name", " ", "parameter", "(", "s", ")'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "'", "element", "setn", "ame", "'_", "in_", "self_", "._", "parent_", "._", "kv", "p_", "and_", "'", "element", "name", "'_", "in_", "self_", "._", "parent_", "._", "kv", "p_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "mutual", "ly", " ", "exclu", "sive", " ", "required_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "exception", "report_", "(_", "'", "No", "Applica", "ble", "Code", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "element", "setn", "ame", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "On", "ly", " ", "ONE", " ", "of", " ", "Element", "Set", "Name", " ", "or", " ", "Element", "Name", " ", "parameter", "(", "s", ")", " ", "is", " ", "permit", "ted", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "'", "element", "setn", "ame", "'_", "not_", "in_", "self_", "._", "parent_", "._", "kv", "p_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "parent_", "._", "kv", "p_", "[_", "'", "element", "setn", "ame", "'_", "]_", "=_", "'", "summar", "y", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "'", "output", "schema", "'_", "not_", "in_", "self_", "._", "parent_", "._", "kv", "p_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "parent_", "._", "kv", "p_", "[_", "'", "output", "schema", "'_", "]_", "=_", "self_", "._", "parent_", "._", "context_", "._", "namespaces_", "[_", "'", "cs", "w3", "0", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "LOGGER_", "._", "debug_", "(_", "self_", "._", "parent_", "._", "context_", "._", "model_", "[_", "'", "operati", "ons", "'_", "]_", "[_", "'", "Get", "Record", "s", "'_", "]_", "[_", "'", "parameter", "s", "'_", "]_", "[_", "'", "output", "Schema", "'_", "]_", "[_", "'", "values", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "(_", "self_", "._", "parent_", "._", "kv", "p_", "[_", "'", "output", "schema", "'_", "]_", "not_", "in_", "self_", "._", "parent_", "._", "context_", "._", "model_", "[_", "'", "operati", "ons", "'_", "]_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "'", "Get", "Record", "s", "'_", "]_", "[_", "'", "parameter", "s", "'_", "]_", "[_", "'", "output", "Schema", "'_", "]_", "[_", "'", "values", "'_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "exception", "report_", "(_", "'", "Inva", "lid", "Parameter", "Value", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "output", "schema", "'_", ",_", "'", "Inva", "lid", " ", "output", "Schema", " ", "parameter", " ", "value", ":", " ", "%", "s", "'_", "%_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "parent_", "._", "kv", "p_", "[_", "'", "output", "schema", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "'", "output", "format", "'_", "not_", "in_", "self_", "._", "parent_", "._", "kv", "p_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "parent_", "._", "kv", "p_", "[_", "'", "output", "format", "'_", "]_", "=_", "'", "applica", "tion", "/", "xml", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "'", "HTTP", "\\u", "ACCEPT", "'_", "in_", "self_", "._", "parent_", "._", "environ_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "LOGGER_", "._", "debug_", "(_", "'", "Detect", "ed", " ", "HTTP", " ", "Accept", " ", "header", ":", " ", "%", "s", "'_", ",_", "self_", "._", "parent_", "._", "environ_", "[_", "'", "HTTP", "\\u", "ACCEPT", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "formats", "\\u", "match_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "'", "output", "format", "'_", "in_", "self_", "._", "parent_", "._", "kv", "p_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "LOGGER_", "._", "debug_", "(_", "self_", "._", "parent_", "._", "kv", "p_", "[_", "'", "output", "format", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "of", "mt_", "in_", "self_", "._", "parent_", "._", "environ_", "[_", "'", "HTTP", "\\u", "ACCEPT", "'_", "]_", "._", "split_", "(_", "','_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "LOGGER_", "._", "debug_", "(_", "'", "Compari", "ng", " ", "%", "s", " ", "and", " ", "%", "s", "'_", ",_", "of", "mt_", ",_", "self_", "._", "parent_", "._", "kv", "p_", "[_", "'", "output", "format", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "of", "mt_", "._", "split_", "(_", "'/'_", ")_", "[_", "0_", "]_", "in_", "self_", "._", "parent_", "._", "kv", "p_", "[_", "'", "output", "format", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "LOGGER_", "._", "debug_", "(_", "'", "FO", "UND", " ", "OUTPU", "T", " ", "MATCH", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "formats", "\\u", "match_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "formats", "\\u", "match_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "return_", "self_", "._", "exception", "report_", "(_", "'", "Inva", "lid", "Parameter", "Value", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "output", "format", "'_", ",_", "'", "HTTP", " ", "Accept", " ", "header", " ", "(%", "s", ")", " ", "and", " ", "output", "format", " ", "(%", "s", ")", " ", "must", " ", "agree", "'_", "%_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "self_", "._", "parent_", "._", "environ_", "[_", "'", "HTTP", "\\u", "ACCEPT", "'_", "]_", ",_", "self_", "._", "parent_", "._", "kv", "p_", "[_", "'", "output", "format", "'_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "of", "mt_", "in_", "self_", "._", "parent_", "._", "environ_", "[_", "'", "HTTP", "\\u", "ACCEPT", "'_", "]_", "._", "split_", "(_", "','_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "of", "mt_", "in_", "self_", "._", "parent_", "._", "context_", "._", "model_", "[_", "'", "operati", "ons", "'_", "]_", "[_", "'", "Get", "Record", "s", "'_", "]_", "[_", "'", "parameter", "s", "'_", "]_", "[_", "'", "output", "Format", "'_", "]_", "[_", "'", "values", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "self_", "._", "parent_", "._", "kv", "p_", "[_", "'", "output", "format", "'_", "]_", "=_", "of", "mt_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "(_", "self_", "._", "parent_", "._", "kv", "p_", "[_", "'", "output", "format", "'_", "]_", "not_", "in_", "self_", "._", "parent_", "._", "context_", "._", "model_", "[_", "'", "operati", "ons", "'_", "]_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "'", "Get", "Record", "s", "'_", "]_", "[_", "'", "parameter", "s", "'_", "]_", "[_", "'", "output", "Format", "'_", "]_", "[_", "'", "values", "'_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "exception", "report_", "(_", "'", "Inva", "lid", "Parameter", "Value", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "output", "format", "'_", ",_", "'", "Inva", "lid", " ", "output", "Format", " ", "parameter", " ", "value", ":", " ", "%", "s", "'_", "%_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "parent_", "._", "kv", "p_", "[_", "'", "output", "format", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "'", "output", "format", "'_", "in_", "self_", "._", "parent_", "._", "kv", "p_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "LOGGER_", "._", "debug_", "(_", "'", "Sett", "ing", " ", "content", " ", "type", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "parent_", "._", "contenttype", "_", "=_", "self_", "._", "parent_", "._", "kv", "p_", "[_", "'", "output", "format", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "parent_", "._", "kv", "p_", "[_", "'", "output", "format", "'_", "]_", "==_", "'", "applica", "tion", "/", "atom", "+", "xml", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "parent_", "._", "kv", "p_", "[_", "'", "output", "schema", "'_", "]_", "=_", "self_", "._", "parent_", "._", "context_", "._", "namespaces_", "[_", "'", "atom", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "parent_", "._", "mode_", "=_", "'", "opens", "ear", "ch", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "(_", "(_", "'", "element", "name", "'_", "not_", "in_", "self_", "._", "parent_", "._", "kv", "p_", "or_", "\\u\\u\\uNL\\u\\u\\u_", "len_", "(_", "self_", "._", "parent_", "._", "kv", "p_", "[_", "'", "element", "name", "'_", "]_", ")_", "==_", "0_", ")_", "and_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "parent_", "._", "kv", "p_", "[_", "'", "element", "setn", "ame", "'_", "]_", "not_", "in_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "parent_", "._", "context_", "._", "model_", "[_", "'", "operati", "ons", "'_", "]_", "[_", "'", "Get", "Record", "s", "'_", "]_", "[_", "'", "parameter", "s", "'_", "]_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "'", "Element", "Set", "Name", "'_", "]_", "[_", "'", "values", "'_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "exception", "report_", "(_", "'", "Inva", "lid", "Parameter", "Value", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "element", "setn", "ame", "'_", ",_", "'", "Inva", "lid", " ", "Element", "Set", "Name", " ", "parameter", " ", "value", ":", " ", "%", "s", "'_", "%_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "parent_", "._", "kv", "p_", "[_", "'", "element", "setn", "ame", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "'", "type", "names", "'_", "not_", "in_", "self_", "._", "parent_", "._", "kv", "p_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "exception", "report_", "(_", "'", "Missing", "Parameter", "Value", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "type", "names", "'_", ",_", "'", "Missing", " ", "type", "names", " ", "parameter", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "(_", "'", "type", "names", "'_", "in_", "self_", "._", "parent_", "._", "kv", "p_", "and_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "parent_", "._", "request", "type_", "==_", "'", "GET", "'_", ")_", ":_", "#", " ", "pass", "ed", " ", "via", " ", "GET_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "self", ".", "parent", ".", "kv", "p", "['", "type", "names", "']", " ", "=", " ", "self", ".", "parent", ".", "kv", "p", "['", "type", "names", "']", ".", "split", "('", ",'", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "parent_", "._", "kv", "p_", "[_", "'", "type", "names", "'_", "]_", "=_", "[_", "'", "cs", "w", ":", "Record", "'_", "if_", "x_", "==_", "'", "Record", "'_", "else_", "x_", "for_", "x_", "in_", "self_", "._", "parent_", "._", "kv", "p_", "[_", "'", "type", "names", "'_", "]_", "._", "split_", "(_", "','_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "'", "namespace", "'_", "in_", "self_", "._", "parent_", "._", "kv", "p_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "LOGGER_", "._", "debug_", "(_", "'", "resolv", "ing", " ", "KV", "P", " ", "namespace", " ", "bindi", "ngs", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "LOGGER_", "._", "debug_", "(_", "self_", "._", "parent_", "._", "kv", "p_", "[_", "'", "type", "names", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "parent_", "._", "kv", "p_", "[_", "'", "type", "names", "'_", "]_", "=_", "self_", "._", "resolve", "\\u", "nsma", "p_", "(_", "self_", "._", "parent_", "._", "kv", "p_", "[_", "'", "type", "names", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "'", "element", "name", "'_", "in_", "self_", "._", "parent_", "._", "kv", "p_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "LOGGER_", "._", "debug_", "(_", "self_", "._", "parent_", "._", "kv", "p_", "[_", "'", "element", "name", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "parent_", "._", "kv", "p_", "[_", "'", "element", "name", "'_", "]_", "=_", "self_", "._", "resolve", "\\u", "nsma", "p_", "(_", "self_", "._", "parent_", "._", "kv", "p_", "[_", "'", "element", "name", "'_", "]_", "._", "split_", "(_", "','_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "'", "type", "names", "'_", "in_", "self_", "._", "parent_", "._", "kv", "p_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "tname_", "in_", "self_", "._", "parent_", "._", "kv", "p_", "[_", "'", "type", "names", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "if", " ", "tname", " ", "==", " ", "'", "Record", "':", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "tname", " ", "=", " ", "'", "cs", "w", ":", "Record", "'_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "(_", "tname_", "not_", "in_", "self_", "._", "parent_", "._", "context_", "._", "model_", "[_", "'", "operati", "ons", "'_", "]_", "[_", "'", "Get", "Record", "s", "'_", "]_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "'", "parameter", "s", "'_", "]_", "[_", "'", "type", "Names", "'_", "]_", "[_", "'", "values", "'_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "return_", "self_", "._", "exception", "report_", "(_", "'", "Inva", "lid", "Parameter", "Value", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "type", "names", "'_", ",_", "'", "Inva", "lid", " ", "type", "Names", " ", "parameter", " ", "value", ":", " ", "%", "s", "'_", "%_", "\\u\\u\\uNL\\u\\u\\u_", "tname_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "check", " ", "element", "name", "'", "s_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "'", "element", "name", "'_", "in_", "self_", "._", "parent_", "._", "kv", "p_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "ename_", "in_", "self_", "._", "parent_", "._", "kv", "p_", "[_", "'", "element", "name", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "ename_", "not_", "in_", "self_", "._", "parent_", "._", "repository_", "._", "query", "ables_", "[_", "'\\u", "all", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "return_", "self_", "._", "exception", "report_", "(_", "'", "Inva", "lid", "Parameter", "Value", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "element", "name", "'_", ",_", "'", "Inva", "lid", " ", "Element", "Name", " ", "parameter", " ", "value", ":", " ", "%", "s", "'_", "%_", "\\u\\u\\uNL\\u\\u\\u_", "ename_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "maxr", "ecor", "ds", "\\u", "cfg_", "=_", "-_", "1_", "#", " ", "not", " ", "set", " ", "in", " ", "config", " ", "server", ".", "maxr", "ecor", "ds_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "self_", "._", "parent_", "._", "config_", "._", "has", "\\u", "option_", "(_", "'", "server", "'_", ",_", "'", "maxr", "ecor", "ds", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "maxr", "ecor", "ds", "\\u", "cfg_", "=_", "int_", "(_", "self_", "._", "parent_", "._", "config_", "._", "get_", "(_", "'", "server", "'_", ",_", "'", "maxr", "ecor", "ds", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "'", "maxr", "ecor", "ds", "'_", "in_", "self_", "._", "parent_", "._", "kv", "p_", "and_", "self_", "._", "parent_", "._", "kv", "p_", "[_", "'", "maxr", "ecor", "ds", "'_", "]_", "==_", "'", "unlimited", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "LOGGER_", "._", "debug_", "(_", "'", "Detect", "ed", " ", "maxr", "ecor", "ds", "=", "unlimited", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "parent_", "._", "kv", "p_", "._", "pop_", "(_", "'", "maxr", "ecor", "ds", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "'", "maxr", "ecor", "ds", "'_", "not_", "in_", "self_", "._", "parent_", "._", "kv", "p_", ":_", "#", " ", "not", " ", "specified", " ", "by", " ", "client_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "maxr", "ecor", "ds", "\\u", "cfg_", ">_", "-_", "1_", ":_", "#", " ", "specified", " ", "in", " ", "config_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "parent_", "._", "kv", "p_", "[_", "'", "maxr", "ecor", "ds", "'_", "]_", "=_", "maxr", "ecor", "ds", "\\u", "cfg_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "#", " ", "spec", " ", "default_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "parent_", "._", "kv", "p_", "[_", "'", "maxr", "ecor", "ds", "'_", "]_", "=_", "10_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "#", " ", "specified", " ", "by", " ", "client_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "parent_", "._", "kv", "p_", "[_", "'", "maxr", "ecor", "ds", "'_", "]_", "==_", "''_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "parent_", "._", "kv", "p_", "[_", "'", "maxr", "ecor", "ds", "'_", "]_", "=_", "10_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "maxr", "ecor", "ds", "\\u", "cfg_", ">_", "-_", "1_", ":_", "#", " ", "set", " ", "in", " ", "config_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "int_", "(_", "self_", "._", "parent_", "._", "kv", "p_", "[_", "'", "maxr", "ecor", "ds", "'_", "]_", ")_", ">_", "maxr", "ecor", "ds", "\\u", "cfg_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "self_", "._", "parent_", "._", "kv", "p_", "[_", "'", "maxr", "ecor", "ds", "'_", "]_", "=_", "maxr", "ecor", "ds", "\\u", "cfg_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "any_", "(_", "x_", "in_", "[_", "'", "bbox", "'_", ",_", "'", "q", "'_", ",_", "'", "time", "'_", "]_", "for_", "x_", "in_", "self_", "._", "parent_", "._", "kv", "p_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "LOGGER_", "._", "debug_", "(_", "'", "Open", "Sear", "ch", " ", "Geo", "/", "Time", " ", "parameter", "s", " ", "detect", "ed", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "parent_", "._", "kv", "p_", "[_", "'", "constraint", "language", "'_", "]_", "=_", "'", "FILTER", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "tmp", "\\u", "filter_", "=_", "opens", "earch_", "._", "kv", "p2", "filter", "xml_", "(_", "self_", "._", "parent_", "._", "kv", "p_", ",_", "self_", "._", "parent_", "._", "context_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", "as_", "err_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "exception", "report_", "(_", "'", "Inva", "lid", "Parameter", "Value", "'_", ",_", "'", "bbox", "'_", ",_", "str_", "(_", "err_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "tmp", "\\u", "filter_", "is_", "not_", "\"\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "parent_", "._", "kv", "p_", "[_", "'", "constraint", "'_", "]_", "=_", "tmp", "\\u", "filter_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "LOGGER_", "._", "debug_", "(_", "'", "Open", "Sear", "ch", " ", "Geo", "/", "Time", " ", "parameter", "s", " ", "to", " ", "Filter", ":", " ", "%", "s", ".'_", "%_", "self_", "._", "parent_", "._", "kv", "p_", "[_", "'", "constraint", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "parent_", "._", "request", "type_", "==_", "'", "GET", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "'", "constraint", "'_", "in_", "self_", "._", "parent_", "._", "kv", "p_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "GET", " ", "request_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "LOGGER_", "._", "debug_", "(_", "'", "cs", "w", ":", "Constr", "aint", " ", "pass", "ed", " ", "over", " ", "HTTP", " ", "GET", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "'", "constraint", "language", "'_", "not_", "in_", "self_", "._", "parent_", "._", "kv", "p_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "return_", "self_", "._", "exception", "report_", "(_", "'", "Missing", "Parameter", "Value", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "constraint", "language", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "constraint", "language", " ", "require", "d", " ", "whe", "n", " ", "constraint", " ", "specified", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "(_", "self_", "._", "parent_", "._", "kv", "p_", "[_", "'", "constraint", "language", "'_", "]_", "not_", "in_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "parent_", "._", "context_", "._", "model_", "[_", "'", "operati", "ons", "'_", "]_", "[_", "'", "Get", "Record", "s", "'_", "]_", "[_", "'", "parameter", "s", "'_", "]_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "'", "CONSTR", "AIN", "TL", "ANG", "UA", "GE", "'_", "]_", "[_", "'", "values", "'_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "return_", "self_", "._", "exception", "report_", "(_", "'", "Inva", "lid", "Parameter", "Value", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "constraint", "language", "'_", ",_", "'", "Inva", "lid", " ", "constraint", "language", ":", " ", "%", "s", "'_", "\\u\\u\\uNL\\u\\u\\u_", "%_", "self_", "._", "parent_", "._", "kv", "p_", "[_", "'", "constraint", "language", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "parent_", "._", "kv", "p_", "[_", "'", "constraint", "language", "'_", "]_", "==_", "'", "CQ", "L", "\\u", "TEXT", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "tmp_", "=_", "self_", "._", "parent_", "._", "kv", "p_", "[_", "'", "constraint", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "parent_", "._", "kv", "p_", "[_", "'", "constraint", "'_", "]_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "parent_", "._", "kv", "p_", "[_", "'", "constraint", "'_", "]_", "[_", "'", "type", "'_", "]_", "=_", "'", "cql", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "parent_", "._", "kv", "p_", "[_", "'", "constraint", "'_", "]_", "[_", "'", "where", "'_", "]_", "=_", "self_", "._", "parent_", "._", "\\u", "cql", "\\u", "update", "\\u", "query", "able", "s", "\\u", "mappings_", "(_", "tmp_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "parent_", "._", "repository_", "._", "query", "ables_", "[_", "'\\u", "all", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "parent_", "._", "kv", "p_", "[_", "'", "constraint", "'_", "]_", "[_", "'", "values", "'_", "]_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "self_", "._", "parent_", "._", "kv", "p_", "[_", "'", "constraint", "language", "'_", "]_", "==_", "'", "FILTER", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "validat", "e", " ", "filter", " ", "XML_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "schema_", "=_", "os_", "._", "path_", "._", "join_", "(_", "self_", "._", "parent_", "._", "config_", "._", "get_", "(_", "'", "server", "'_", ",_", "'", "home", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "core", "'_", ",_", "'", "schema", "s", "'_", ",_", "'", "og", "c", "'_", ",_", "'", "filter", "'_", ",_", "'", "1.1", ".0", "'_", ",_", "'", "filter", ".", "xsd", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "LOGGER_", "._", "debug_", "(_", "'", "Validat", "ing", " ", "Filter", " ", "%", "s", ".'_", "%_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "parent_", "._", "kv", "p_", "[_", "'", "constraint", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "schema_", "=_", "etree_", "._", "XML", "Schema_", "(_", "file_", "=_", "schema_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "=_", "etree_", "._", "XML", "Parser_", "(_", "schema_", "=_", "schema_", ",_", "resolve", "\\u", "entities_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "doc_", "=_", "etree_", "._", "fromstring_", "(_", "self_", "._", "parent_", "._", "kv", "p_", "[_", "'", "constraint", "'_", "]_", ",_", "parser_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "LOGGER_", "._", "debug_", "(_", "'", "Filter", " ", "is", " ", "valid", " ", "XML", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "parent_", "._", "kv", "p_", "[_", "'", "constraint", "'_", "]_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "parent_", "._", "kv", "p_", "[_", "'", "constraint", "'_", "]_", "[_", "'", "type", "'_", "]_", "=_", "'", "filter", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "parent_", "._", "kv", "p_", "[_", "'", "constraint", "'_", "]_", "[_", "'", "where", "'_", "]_", ",_", "self_", "._", "parent_", "._", "kv", "p_", "[_", "'", "constraint", "'_", "]_", "[_", "'", "values", "'_", "]_", "=_", "fes", "2_", "._", "parse_", "(_", "doc_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "parent_", "._", "repository_", "._", "query", "ables_", "[_", "'\\u", "all", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "parent_", "._", "repository_", "._", "dbt", "ype_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "parent_", "._", "context_", "._", "namespaces_", ",_", "self_", "._", "parent_", "._", "orm_", ",_", "self_", "._", "parent_", "._", "language_", "[_", "'", "text", "'_", "]_", ",_", "self_", "._", "parent_", "._", "repository_", "._", "fts", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", "as_", "err_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "error", "text_", "=_", "'", "Except", "ion", ":", " ", "document", " ", "not", " ", "valid", ".\\\\", "n", "Error", ":", " ", "%", "s", ".'_", "%_", "str_", "(_", "err_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "LOGGER_", "._", "debug_", "(_", "error", "text_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "exception", "report_", "(_", "'", "Inva", "lid", "Parameter", "Value", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "bbox", "'_", ",_", "'", "Inva", "lid", " ", "Filter", " ", "query", ":", " ", "%", "s", "'_", "%_", "error", "text_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "parent_", "._", "kv", "p_", "[_", "'", "constraint", "'_", "]_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "'", "sortby", "'_", "not_", "in_", "self_", "._", "parent_", "._", "kv", "p_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "parent_", "._", "kv", "p_", "[_", "'", "sortby", "'_", "]_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "'", "sortby", "'_", "in_", "self_", "._", "parent_", "._", "kv", "p_", "and_", "self_", "._", "parent_", "._", "request", "type_", "==_", "'", "GET", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "LOGGER_", "._", "debug_", "(_", "'", "Sorte", "d", " ", "query", " ", "specified", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tmp_", "=_", "self_", "._", "parent_", "._", "kv", "p_", "[_", "'", "sortby", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "parent_", "._", "kv", "p_", "[_", "'", "sortby", "'_", "]_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "name_", ",_", "order_", "=_", "tmp_", "._", "rsplit_", "(_", "':'_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "exception", "report_", "(_", "'", "Inva", "lid", "Parameter", "Value", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "sortby", "'_", ",_", "'", "Inva", "lid", " ", "Sort", "By", " ", "value", ":", " ", "must", " ", "be", " ", "in", " ", "the", " ", "format", "\\\\", "\\", "10", ";", " ", " ", " ", " ", "property", "name", ":", "A", " ", "or", " ", "property", "name", ":", "D", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "parent_", "._", "kv", "p_", "[_", "'", "sortby", "'_", "]_", "[_", "'", "property", "name", "'_", "]_", "=_", "self_", "._", "parent_", "._", "repository_", "._", "query", "ables_", "[_", "'\\u", "all", "'_", "]_", "[_", "name_", "]_", "[_", "'", "dbco", "l", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "name_", "._", "find_", "(_", "'", "Bound", "ing", "Box", "'_", ")_", "!=_", "-_", "1_", "or_", "name_", "._", "find_", "(_", "'", "Env", "elope", "'_", ")_", "!=_", "-_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "it", "'", "s", " ", "a", " ", "spat", "ial", " ", "sort_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "self_", "._", "parent_", "._", "kv", "p_", "[_", "'", "sortby", "'_", "]_", "[_", "'", "spat", "ial", "'_", "]_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", "as_", "err_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "exception", "report_", "(_", "'", "Inva", "lid", "Parameter", "Value", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "sortby", "'_", ",_", "'", "Inva", "lid", " ", "Sort", "By", " ", "property", "name", ":", " ", "%", "s", "'_", "%_", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "order_", "not_", "in_", "[_", "'", "A", "'_", ",_", "'", "D", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "exception", "report_", "(_", "'", "Inva", "lid", "Parameter", "Value", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "sortby", "'_", ",_", "'", "Inva", "lid", " ", "Sort", "By", " ", "value", ":", " ", "sort", " ", "order", " ", "must", " ", "be", " ", "\"", "A", "\"", " ", "or", " ", "\"", "D", "\"'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "order_", "==_", "'", "D", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "parent_", "._", "kv", "p_", "[_", "'", "sortby", "'_", "]_", "[_", "'", "order", "'_", "]_", "=_", "'", "DESC", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "parent_", "._", "kv", "p_", "[_", "'", "sortby", "'_", "]_", "[_", "'", "order", "'_", "]_", "=_", "'", "ASC", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "'", "startpo", "sition", "'_", "not_", "in_", "self_", "._", "parent_", "._", "kv", "p_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "parent_", "._", "kv", "p_", "[_", "'", "startpo", "sition", "'_", "]_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "'", "record", "ids", "'_", "in_", "self_", "._", "parent_", "._", "kv", "p_", "and_", "self_", "._", "parent_", "._", "kv", "p_", "[_", "'", "record", "ids", "'_", "]_", "!=_", "''_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "query", " ", "repository_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "LOGGER_", "._", "debug_", "(_", "'", "Query", "ing", " ", "repos", "itor", "y", " ", "with", " ", "RECORD", " ", "ids", ":", " ", "%", "s", ".'_", "%_", "self_", "._", "parent_", "._", "kv", "p_", "[_", "'", "record", "ids", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "results_", "=_", "self_", "._", "parent_", "._", "repository_", "._", "query", "\\u", "ids_", "(_", "self_", "._", "parent_", "._", "kv", "p_", "[_", "'", "record", "ids", "'_", "]_", "._", "split_", "(_", "','_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "matched_", "=_", "str_", "(_", "len_", "(_", "results_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "len_", "(_", "results_", ")_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "exception", "report_", "(_", "'", "Not", "Foun", "d", "'_", ",_", "'", "record", "ids", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "No", " ", "record", "s", " ", "found", " ", "for", " ", "\\\\'", "%", "s", "\\\\''_", "%_", "self_", "._", "parent_", "._", "kv", "p_", "[_", "'", "record", "ids", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "query", " ", "repository_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "LOGGER_", "._", "debug_", "(_", "'", "Query", "ing", " ", "repos", "itor", "y", " ", "with", " ", "constraint", ":", " ", "%", "s", ",\\\\", "\\", "10", ";", " ", " ", " ", " ", "sortby", ":", " ", "%", "s", ",", " ", "type", "names", ":", " ", "%", "s", ",", " ", "maxr", "ecor", "ds", ":", " ", "%", "s", ",", " ", "startpo", "sition", ":", " ", "%", "s", ".'_", "%_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "self_", "._", "parent_", "._", "kv", "p_", "[_", "'", "constraint", "'_", "]_", ",_", "self_", "._", "parent_", "._", "kv", "p_", "[_", "'", "sortby", "'_", "]_", ",_", "self_", "._", "parent_", "._", "kv", "p_", "[_", "'", "type", "names", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "parent_", "._", "kv", "p_", "[_", "'", "maxr", "ecor", "ds", "'_", "]_", ",_", "self_", "._", "parent_", "._", "kv", "p_", "[_", "'", "startpo", "sition", "'_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "matched_", ",_", "results_", "=_", "self_", "._", "parent_", "._", "repository_", "._", "query_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "constraint_", "=_", "self_", "._", "parent_", "._", "kv", "p_", "[_", "'", "constraint", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "sortby", "_", "=_", "self_", "._", "parent_", "._", "kv", "p_", "[_", "'", "sortby", "'_", "]_", ",_", "type", "names_", "=_", "self_", "._", "parent_", "._", "kv", "p_", "[_", "'", "type", "names", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "maxr", "ecor", "ds_", "=_", "self_", "._", "parent_", "._", "kv", "p_", "[_", "'", "maxr", "ecor", "ds", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "startpo", "sition", "_", "=_", "int_", "(_", "self_", "._", "parent_", "._", "kv", "p_", "[_", "'", "startpo", "sition", "'_", "]_", ")_", "-_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", "as_", "err_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "exception", "report_", "(_", "'", "Inva", "lid", "Parameter", "Value", "'_", ",_", "'", "constraint", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Inva", "lid", " ", "query", ":", " ", "%", "s", "'_", "%_", "err_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "int_", "(_", "matched_", ")_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "returned_", "=_", "next", "record_", "=_", "'", "0", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "int_", "(_", "matched_", ")_", "<_", "int_", "(_", "self_", "._", "parent_", "._", "kv", "p_", "[_", "'", "maxr", "ecor", "ds", "'_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "returned_", "=_", "matched_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "next", "record_", "=_", "'", "0", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "returned_", "=_", "str_", "(_", "self_", "._", "parent_", "._", "kv", "p_", "[_", "'", "maxr", "ecor", "ds", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "int_", "(_", "self_", "._", "parent_", "._", "kv", "p_", "[_", "'", "startpo", "sition", "'_", "]_", ")_", "+_", "int_", "(_", "self_", "._", "parent_", "._", "kv", "p_", "[_", "'", "maxr", "ecor", "ds", "'_", "]_", ")_", ">=_", "int_", "(_", "matched_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "next", "record_", "=_", "'", "0", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "next", "record_", "=_", "str_", "(_", "int_", "(_", "self_", "._", "parent_", "._", "kv", "p_", "[_", "'", "startpo", "sition", "'_", "]_", ")_", "+_", "int_", "(_", "self_", "._", "parent_", "._", "kv", "p_", "[_", "'", "maxr", "ecor", "ds", "'_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "LOGGER_", "._", "debug_", "(_", "'", "Result", "s", ":", " ", "matche", "d", ":", " ", "%", "s", ",", " ", "return", "ed", ":", " ", "%", "s", ",", " ", "next", ":", " ", "%", "s", ".'_", "%_", "(_", "matched_", ",_", "returned_", ",_", "next", "record_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "node_", "=_", "etree_", "._", "Element_", "(_", "util_", "._", "nsp", "ath", "\\u", "eval_", "(_", "'", "cs", "w3", "0", ":", "Get", "Record", "s", "Respons", "e", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "parent_", "._", "context_", "._", "namespaces_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "nsma", "p_", "=_", "self_", "._", "parent_", "._", "context_", "._", "namespaces_", ",_", "version_", "=_", "'", "3.0", ".0", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "node_", "._", "attrib_", "[_", "util_", "._", "nsp", "ath", "\\u", "eval_", "(_", "'", "xsi", ":", "schema", "Locat", "ion", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "parent_", "._", "context_", "._", "namespaces_", ")_", "]_", "=_", "'%", "s", " ", "%", "s", "/", "cs", "w", "/", "3.0", "/", "cs", "w", "Get", "Record", "s", "Respons", "e", ".", "xsd", "'_", "%_", "(_", "self_", "._", "parent_", "._", "context_", "._", "namespaces_", "[_", "'", "cs", "w3", "0", "'_", "]_", ",_", "self_", "._", "parent_", "._", "config_", "._", "get_", "(_", "'", "server", "'_", ",_", "'", "og", "c\\u", "schema", "s", "\\u", "base", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "'", "request", "id", "'_", "in_", "self_", "._", "parent_", "._", "kv", "p_", "and_", "self_", "._", "parent_", "._", "kv", "p_", "[_", "'", "request", "id", "'_", "]_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "etree_", "._", "Sub", "Element_", "(_", "node_", ",_", "util_", "._", "nsp", "ath", "\\u", "eval_", "(_", "'", "cs", "w", ":", "Request", "Id", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "parent_", "._", "context_", "._", "namespaces_", ")_", ")_", "._", "text_", "=_", "self_", "._", "parent_", "._", "kv", "p_", "[_", "'", "request", "id", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "etree_", "._", "Sub", "Element_", "(_", "node_", ",_", "util_", "._", "nsp", "ath", "\\u", "eval_", "(_", "'", "cs", "w3", "0", ":", "Sear", "ch", "Status", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "parent_", "._", "context_", "._", "namespaces_", ")_", ",_", "timestamp_", "=_", "timestamp_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "if", " ", "'", "where", "'", " ", "not", " ", "in", " ", "self", ".", "parent", ".", "kv", "p", "['", "constraint", "']", " ", "and", " ", "\\\\_", "\\u\\u\\uNL\\u\\u\\u_", "#", "self", ".", "parent", ".", "kv", "p", "['", "result", "type", "']", " ", "is", " ", "Non", "e", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "return", "ed", " ", "=", " ", "'", "0", "'_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "search", "results_", "=_", "etree_", "._", "Sub", "Element_", "(_", "node_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "util_", "._", "nsp", "ath", "\\u", "eval_", "(_", "'", "cs", "w3", "0", ":", "Sear", "ch", "Result", "s", "'_", ",_", "self_", "._", "parent_", "._", "context_", "._", "namespaces_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "number", "Of", "Record", "s", "Matched", "_", "=_", "matched_", ",_", "number", "Of", "Record", "s", "Return", "ed_", "=_", "returned_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "next", "Record_", "=_", "next", "record_", ",_", "record", "Schema_", "=_", "self_", "._", "parent_", "._", "kv", "p_", "[_", "'", "output", "schema", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "expires_", "=_", "timestamp_", ",_", "status_", "=_", "get", "\\u", "results", "et", "\\u", "status_", "(_", "matched_", ",_", "next", "record_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "self_", "._", "parent_", "._", "kv", "p_", "[_", "'", "element", "setn", "ame", "'_", "]_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "search", "results_", "._", "attrib_", "[_", "'", "element", "Set", "'_", "]_", "=_", "self_", "._", "parent_", "._", "kv", "p_", "[_", "'", "element", "setn", "ame", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "if", " ", "'", "where", "'", " ", "not", " ", "in", " ", "self", ".", "parent", ".", "kv", "p", "['", "constraint", "']", " ", "\\\\_", "\\u\\u\\uNL\\u\\u\\u_", "#", "and", " ", "self", ".", "parent", ".", "kv", "p", "['", "result", "type", "']", " ", "is", " ", "Non", "e", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "LOGGE", "R", ".", "debug", "('", "Emp", "ty", " ", "result", " ", "set", " ", "return", "ed", ".'", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "return", " ", "node_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "results_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "len_", "(_", "results_", ")_", "<_", "int_", "(_", "self_", "._", "parent_", "._", "kv", "p_", "[_", "'", "maxr", "ecor", "ds", "'_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "max", "1_", "=_", "len_", "(_", "results_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "max", "1_", "=_", "int_", "(_", "self_", "._", "parent_", "._", "kv", "p_", "[_", "'", "startpo", "sition", "'_", "]_", ")_", "+_", "(_", "int_", "(_", "self_", "._", "parent_", "._", "kv", "p_", "[_", "'", "maxr", "ecor", "ds", "'_", "]_", ")_", "-_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "LOGGER_", "._", "debug_", "(_", "'", "Present", "ing", " ", "record", "s", " ", "%", "s", " ", "-", " ", "%", "s", ".'_", "%_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "self_", "._", "parent_", "._", "kv", "p_", "[_", "'", "startpo", "sition", "'_", "]_", ",_", "max", "1_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "res_", "in_", "results_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "(_", "self_", "._", "parent_", "._", "kv", "p_", "[_", "'", "output", "schema", "'_", "]_", "==_", "\\u\\u\\uNL\\u\\u\\u_", "'", "http", "://", "www", ".", "opengis", ".", "net", "/", "cat", "/", "cs", "w", "/", "3.0", "'_", "and_", "\\u\\u\\uNL\\u\\u\\u_", "'", "cs", "w", ":", "Record", "'_", "in_", "self_", "._", "parent_", "._", "kv", "p_", "[_", "'", "type", "names", "'_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "serialize", " ", "cs", "w", ":", "Record", " ", "inline_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "search", "results_", "._", "append_", "(_", "self_", "._", "\\u", "write", "\\u", "record_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "res_", ",_", "self_", "._", "parent_", "._", "repository_", "._", "query", "ables_", "[_", "'\\u", "all", "'_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "(_", "self_", "._", "parent_", "._", "kv", "p_", "[_", "'", "output", "schema", "'_", "]_", "==_", "\\u\\u\\uNL\\u\\u\\u_", "'", "http", "://", "www", ".", "opengis", ".", "net", "/", "cat", "/", "cs", "w", "/", "3.0", "'_", "and_", "\\u\\u\\uNL\\u\\u\\u_", "'", "cs", "w", ":", "Record", "'_", "not_", "in_", "self_", "._", "parent_", "._", "kv", "p_", "[_", "'", "type", "names", "'_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "serialize", " ", "int", "o", " ", "cs", "w", ":", "Record", " ", "model_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "for_", "prof_", "in_", "self_", "._", "parent_", "._", "profiles_", "[_", "'", "load", "ed", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "find", " ", "source", " ", "typename_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "if_", "self_", "._", "parent_", "._", "profiles_", "[_", "'", "load", "ed", "'_", "]_", "[_", "prof_", "]_", "._", "typename_", "in_", "self_", "._", "parent_", "._", "kv", "p_", "[_", "'", "type", "names", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "typename_", "=_", "self_", "._", "parent_", "._", "profiles_", "[_", "'", "load", "ed", "'_", "]_", "[_", "prof_", "]_", "._", "typename_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "util_", "._", "transform", "\\u", "mappings_", "(_", "self_", "._", "parent_", "._", "repository_", "._", "query", "ables_", "[_", "'\\u", "all", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "parent_", "._", "context_", "._", "model_", "[_", "'", "type", "names", "'_", "]_", "[_", "typename_", "]_", "[_", "'", "mapping", "s", "'_", "]_", "[_", "'", "cs", "w", ":", "Record", "'_", "]_", ",_", "reverse_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "search", "results_", "._", "append_", "(_", "self_", "._", "\\u", "write", "\\u", "record_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "res_", ",_", "self_", "._", "parent_", "._", "repository_", "._", "query", "ables_", "[_", "'\\u", "all", "'_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "self_", "._", "parent_", "._", "kv", "p_", "[_", "'", "output", "schema", "'_", "]_", "in_", "self_", "._", "parent_", "._", "output", "schemas_", ":_", "#", " ", "use", " ", "output", "schema", " ", "serializer_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "search", "results_", "._", "append_", "(_", "self_", "._", "parent_", "._", "output", "schemas_", "[_", "self_", "._", "parent_", "._", "kv", "p_", "[_", "'", "output", "schema", "'_", "]_", "]_", "._", "write", "\\u", "record_", "(_", "res_", ",_", "self_", "._", "parent_", "._", "kv", "p_", "[_", "'", "element", "setn", "ame", "'_", "]_", ",_", "self_", "._", "parent_", "._", "context_", ",_", "self_", "._", "parent_", "._", "config_", "._", "get_", "(_", "'", "server", "'_", ",_", "'", "url", "'_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "#", " ", "use", " ", "profile", " ", "serializer_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "search", "results_", "._", "append_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "parent_", "._", "profiles_", "[_", "'", "load", "ed", "'_", "]_", "[_", "self_", "._", "parent_", "._", "kv", "p_", "[_", "'", "output", "schema", "'_", "]_", "]_", "._", "write", "\\u", "record_", "(_", "res_", ",_", "self_", "._", "parent_", "._", "kv", "p_", "[_", "'", "element", "setn", "ame", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "parent_", "._", "kv", "p_", "[_", "'", "output", "schema", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "parent_", "._", "repository_", "._", "query", "ables_", "[_", "'\\u", "all", "'_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", "as_", "err_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "self_", "._", "parent_", "._", "response_", "=_", "self_", "._", "exception", "report_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", "No", "Applica", "ble", "Code", "'_", ",_", "'", "service", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Record", " ", "serializ", "ation", " ", "fail", "ed", ":", " ", "%", "s", "'_", "%_", "str_", "(_", "err_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "parent_", "._", "response_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "(_", "self_", "._", "parent_", "._", "config_", "._", "has", "\\u", "option_", "(_", "'", "server", "'_", ",_", "'", "federated", "catalogue", "s", "'_", ")_", "and_", "\\u\\u\\uNL\\u\\u\\u_", "'", "distributed", "search", "'_", "in_", "self_", "._", "parent_", "._", "kv", "p_", "and_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "parent_", "._", "kv", "p_", "[_", "'", "distributed", "search", "'_", "]_", "and_", "self_", "._", "parent_", "._", "kv", "p_", "[_", "'", "hop", "count", "'_", "]_", ">_", "0_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "do", " ", "distributed", " ", "search_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "LOGGER_", "._", "debug_", "(_", "'", "Distribut", "ed", "Sear", "ch", " ", "specified", " ", "(", "hop", "Count", ":", " ", "%", "s", ").'_", "%_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "parent_", "._", "kv", "p_", "[_", "'", "hop", "count", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "ow", "sli", "b_", "._", "cs", "w_", "import_", "Catalog", "ue", "Service", "Web", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "ow", "sli", "b_", "._", "ows_", "import_", "Except", "ion", "Report_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "fed", "cat_", "in_", "self_", "._", "parent_", "._", "config_", "._", "get_", "(_", "'", "server", "'_", ",_", "'", "federated", "catalogue", "s", "'_", ")_", "._", "split_", "(_", "','_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "LOGGER_", "._", "debug_", "(_", "'", "Perform", "ing", " ", "distributed", " ", "search", " ", "on", " ", "federated", " ", "\\\\", "\\", "10", ";", " ", " ", " ", " ", "catalogue", ":", " ", "%", "s", ".'_", "%_", "fed", "cat_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "start", "\\u", "time_", "=_", "time_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "remote", "cs", "w_", "=_", "Catalog", "ue", "Service", "Web", "_", "(_", "fed", "cat_", ",_", "skip", "\\u", "caps_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "remote", "cs", "w_", "._", "getre", "cord", "s2_", "(_", "xml_", "=_", "self_", "._", "parent_", "._", "request_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "esn", "_", "=_", "self_", "._", "parent_", "._", "kv", "p_", "[_", "'", "element", "setn", "ame", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "output", "schema_", "=_", "self_", "._", "parent_", "._", "kv", "p_", "[_", "'", "output", "schema", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "fs", "r_", "=_", "etree_", "._", "Sub", "Element_", "(_", "search", "results_", ",_", "util_", "._", "nsp", "ath", "\\u", "eval_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", "cs", "w3", "0", ":", "Federa", "ted", "Sear", "ch", "Result", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "parent_", "._", "context_", "._", "namespaces_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "catalogue", "URL_", "=_", "fed", "cat_", "._", "request_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "msg_", "=_", "'", "Distribut", "ed", " ", "search", " ", "results", " ", "from", " ", "catalogue", " ", "%", "s", ":", " ", "%", "s", ".'_", "%_", "(_", "fed", "cat_", ",_", "remote", "cs", "w_", "._", "results_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "LOGGER_", "._", "debug_", "(_", "msg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fs", "r_", "._", "append_", "(_", "etree_", "._", "Comment_", "(_", "msg_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "search", "\\u", "result_", "=_", "etree_", "._", "Sub", "Element_", "(_", "fs", "r_", ",_", "util_", "._", "nsp", "ath", "\\u", "eval_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", "cs", "w3", "0", ":", "search", "Result", "'_", ",_", "self_", "._", "parent_", "._", "context_", "._", "namespaces_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "record", "Schema_", "=_", "self_", "._", "parent_", "._", "kv", "p_", "[_", "'", "output", "schema", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "element", "Set", "Name_", "=_", "self_", "._", "parent_", "._", "kv", "p_", "[_", "'", "element", "setn", "ame", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "number", "Of", "Record", "s", "Matched", "_", "=_", "fed", "cat_", "._", "results_", "[_", "'", "matche", "s", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "number", "Of", "Record", "s", "Return", "ed_", "=_", "fed", "cat_", "._", "results_", "[_", "'", "return", "ed", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "next", "Record_", "=_", "fed", "cat_", "._", "results_", "[_", "'", "next", "record", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "ela", "pse", "d", "Time_", "=_", "get", "\\u", "ela", "pse", "d\\u", "time_", "(_", "start", "\\u", "time_", ",_", "time_", "(_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "status_", "=_", "get", "\\u", "results", "et", "\\u", "status_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "fed", "cat_", "._", "results_", "[_", "'", "matche", "s", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "fed", "cat_", "._", "results_", "[_", "'", "next", "record", "'_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "search", "\\u", "result_", "._", "append_", "(_", "remote", "cs", "w_", "._", "records_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Except", "ion", "Report_", "as_", "err_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "error", "\\u", "string_", "=_", "'", "remote", " ", "CS", "W", " ", "%", "s", " ", "return", "ed", " ", "exception", ":", " ", "'_", "%_", "fed", "cat_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "search", "results_", "._", "append_", "(_", "etree_", "._", "Comment_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", " ", "%", "s", "\\\\", "n", "\\\\", "n", "%", "s", " ", "'_", "%_", "(_", "error", "\\u", "string_", ",_", "err_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "LOGGER_", "._", "debug_", "(_", "str_", "(_", "err_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", "as_", "err_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "error", "\\u", "string_", "=_", "'", "remote", " ", "CS", "W", " ", "%", "s", " ", "return", "ed", " ", "error", ":", " ", "'_", "%_", "fed", "cat_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "search", "results_", "._", "append_", "(_", "etree_", "._", "Comment_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", " ", "%", "s", "\\\\", "n", "\\\\", "n", "%", "s", " ", "'_", "%_", "(_", "error", "\\u", "string_", ",_", "err_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "LOGGER_", "._", "debug_", "(_", "str_", "(_", "err_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "if", " ", "len", "(", "dsr", "esult", "s", ")", " ", ">", " ", "0", ":", " ", " ", "#", " ", "return", " ", "Distribut", "ed", "Sear", "ch", " ", "results_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "for", " ", "results", "et", " ", "in", " ", "dsr", "esult", "s", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "if", " ", "isin", "stance", "(", "results", "et", ",", " ", "etree", ".\\u", "Comme", "nt", "):", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "search", "results", ".", "append", "(", "results", "et", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "for", " ", "rec", " ", "in", " ", "results", "et", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "search", "results", ".", "append", "(", "etree", ".", "froms", "tring", "(", "results", "et", "[", "rec", "].", "xml", ",", " ", "self", ".", "parent", ".", "context", ".", "parser", "))", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "search", "results_", "._", "attrib_", "[_", "'", "ela", "pse", "d", "Time", "'_", "]_", "=_", "get", "\\u", "ela", "pse", "d\\u", "time_", "(_", "self_", "._", "parent_", "._", "process", "\\u", "time", "\\u", "start_", ",_", "time_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "'", "response", "handler", "'_", "in_", "self_", "._", "parent_", "._", "kv", "p_", ":_", "#", " ", "process", " ", "the", " ", "handler_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "parent_", "._", "\\u", "process", "\\u", "response", "handler_", "(_", "etree_", "._", "tostring_", "(_", "node_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "pretty", "\\u", "print_", "=_", "self_", "._", "parent_", "._", "pretty", "\\u", "print_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "node_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Cs", "w3", "_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "exception", "report_", "(_", "self_", ",_", "code_", ",_", "locator_", ",_", "text_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", " ", "Generate", " ", "Except", "ion", "Report", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "parent_", "._", "exception_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "parent_", "._", "status_", "=_", "code_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "language_", "=_", "self_", "._", "parent_", "._", "config_", "._", "get_", "(_", "'", "server", "'_", ",_", "'", "language", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "og", "c\\u", "schema", "s", "\\u", "base_", "=_", "self_", "._", "parent_", "._", "config_", "._", "get_", "(_", "'", "server", "'_", ",_", "'", "og", "c\\u", "schema", "s", "\\u", "base", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "language_", "=_", "'", "en", "-", "US", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "og", "c\\u", "schema", "s", "\\u", "base_", "=_", "self_", "._", "parent_", "._", "context_", "._", "og", "c\\u", "schema", "s", "\\u", "base_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "node_", "=_", "etree_", "._", "Element_", "(_", "util_", "._", "nsp", "ath", "\\u", "eval_", "(_", "'", "ow", "s2", "0", ":", "Except", "ion", "Report", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "parent_", "._", "context_", "._", "namespaces_", ")_", ",_", "nsma", "p_", "=_", "self_", "._", "parent_", "._", "context_", "._", "namespaces_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "version_", "=_", "'", "3.0", ".0", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "node_", "._", "attrib_", "[_", "'{", "http", "://", "www", ".", "w3", ".", "org", "/", "XML", "/", "199", "8", "/", "namespace", "}", "lang", "'_", "]_", "=_", "language_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "node_", "._", "attrib_", "[_", "util_", "._", "nsp", "ath", "\\u", "eval_", "(_", "'", "xsi", ":", "schema", "Locat", "ion", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "parent_", "._", "context_", "._", "namespaces_", ")_", "]_", "=_", "'%", "s", " ", "%", "s", "/", "ow", "s", "/", "2.0", "/", "ow", "s", "Except", "ion", "Report", ".", "xsd", "'_", "%_", "(_", "self_", "._", "parent_", "._", "context_", "._", "namespaces_", "[_", "'", "ow", "s2", "0", "'_", "]_", ",_", "og", "c\\u", "schema", "s", "\\u", "base_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "exception_", "=_", "etree_", "._", "Sub", "Element_", "(_", "node_", ",_", "util_", "._", "nsp", "ath", "\\u", "eval_", "(_", "'", "ow", "s2", "0", ":", "Except", "ion", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "parent_", "._", "context_", "._", "namespaces_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "exception", "Code_", "=_", "code_", ",_", "locator_", "=_", "locator_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "etree_", "._", "Sub", "Element_", "(_", "exception_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "util_", "._", "nsp", "ath", "\\u", "eval_", "(_", "'", "ow", "s2", "0", ":", "Except", "ion", "Text", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "parent_", "._", "context_", "._", "namespaces_", ")_", ")_", "._", "text_", "=_", "text_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "node_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "write", "\\u", "bound", "ing", "box_", "(_", "bbox_", ",_", "nsma", "p_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", " ", "Generate", " ", "ow", "s2", "0", ":", "Bound", "ing", "Box", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "bbox_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "bbox", "2_", "=_", "util_", "._", "wk", "t2", "geom_", "(_", "bbox_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "len_", "(_", "bbox", "2_", ")_", "==_", "4_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "bound", "ing", "box_", "=_", "etree_", "._", "Element_", "(_", "util_", "._", "nsp", "ath", "\\u", "eval_", "(_", "'", "ow", "s2", "0", ":", "Bound", "ing", "Box", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "nsma", "p_", ")_", ",_", "crs_", "=_", "'", "http", "://", "www", ".", "opengis", ".", "net", "/", "def", "/", "cr", "s", "/", "EPS", "G", "/", "0", "/", "432", "6", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "dimensions_", "=_", "'", "2", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "etree_", "._", "Sub", "Element_", "(_", "bound", "ing", "box_", ",_", "util_", "._", "nsp", "ath", "\\u", "eval_", "(_", "'", "ow", "s2", "0", ":", "Lower", "Corner", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "nsma", "p_", ")_", ")_", "._", "text_", "=_", "'%", "s", " ", "%", "s", "'_", "%_", "(_", "bbox", "2_", "[_", "1_", "]_", ",_", "bbox", "2_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "etree_", "._", "Sub", "Element_", "(_", "bound", "ing", "box_", ",_", "util_", "._", "nsp", "ath", "\\u", "eval_", "(_", "'", "ow", "s2", "0", ":", "Upp", "er", "Corner", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "nsma", "p_", ")_", ")_", "._", "text_", "=_", "'%", "s", " ", "%", "s", "'_", "%_", "(_", "bbox", "2_", "[_", "3_", "]_", ",_", "bbox", "2_", "[_", "2_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "bound", "ing", "box_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "next", "record_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "search", "result", "\\u", "status_", "=_", "'", "complete", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "next", "record_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "search", "result", "\\u", "status_", "=_", "'", "subse", "t", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "matched_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "search", "result", "\\u", "status_", "=_", "'", "none", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused local variable
coleifer/huey/huey/tests/test_queue.py
[ { "content": "@huey_results.task(include_task=True)\ndef error_testing_task_with_ctx(key, value, task=None):\n bad = 1/0\n state['last_task_class'] = type(task).__name__", "metadata": "root.error_testing_task_with_ctx", "header": "['module', '___EOS___']", "index": 30 } ]
[ { "span": "bad ", "start_line": 32, "start_column": 4, "end_line": 32, "end_column": 7 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "hue", "y", "\\u", "results_", "._", "task_", "(_", "include", "\\u", "task_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "error", "\\u", "testi", "ng", "\\u", "task", "\\u", "with", "\\u", "ctx_", "(_", "key_", ",_", "value_", ",_", "task_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "bad_", "=_", "1_", "/_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "state_", "[_", "'", "last", "\\u", "task", "\\u", "class", "'_", "]_", "=_", "type_", "(_", "task_", ")_", "._", "\\u\\u", "name\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
pingali/dgit/dgitcore/contrib/repomanagers/gitmanager.py
[ { "content": "#!/usr/bin/env python\n\"\"\"\nGitManager provides the high level interface to git command line\n\nGitManager does not have independent variables but it inherits attributes from 'Local' backend and 'User' definition\n\n* workspace: (from Local) Directory used by gitmanager to store dataset repositories\n* username: (from User) Name of the user\n* email: (from User) Email of the user\n\n\"\"\"\nimport os, sys, json, subprocess, re, json\nimport pipes, collections\nimport shutil\nfrom sh import git\nfrom dgitcore.plugins.repomanager import RepoManagerBase, Repo\nfrom dgitcore.helper import cd\nfrom dgitcore.exceptions import *\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class GitRepoManager(RepoManagerBase):\n \"\"\"\n Git-based versioning service. This implements the RepoManagerBase class.\n \"\"\"\n\n\n # => Helper functions\n\n\n # => Simple commands ...\n\n # => Simple commands ...\n\n # => Simple commands ...\n\n # => Simple commands ...\n\n\n\n\n\n\n\n\n # => Run more complex functions to initialize, cleanup\n\n\n\n\n\n\n\n\n\n\n", "metadata": "root.GitRepoManager", "header": "['module', '___EOS___']", "index": 19 }, { "content": " def __init__(self):\n self.username = None\n\n self.workspace = None\n self.metadatadir = '.git'\n self.repos = {}\n self.enable = True\n super(GitRepoManager, self).__init__('git',\n 'v0',\n \"Git-based Repository Manager\")", "metadata": "root.GitRepoManager.__init__", "header": "['class', 'GitRepoManager', '(', 'RepoManagerBase', ')', ':', '___EOS___']", "index": 24 }, { "content": " def _run(self, cmd):\n \"\"\"\n Helper function to run commands\n\n Parameters\n ----------\n cmd : list\n Arguments to git command\n \"\"\"\n\n # This is here in case the .gitconfig is not accessible for\n # some reason. \n environ = os.environ.copy() \n\n environ['GIT_COMMITTER_NAME'] = self.fullname\n environ['GIT_COMMITTER_EMAIL'] = self.email \n environ['GIT_AUTHOR_NAME'] = self.fullname\n environ['GIT_AUTHOR_EMAIL'] = self.email \n\n cmd = [pipes.quote(c) for c in cmd]\n cmd = \" \".join(['/usr/bin/git'] + cmd)\n cmd += \"; exit 0\"\n #print(\"Running cmd\", cmd)\n try:\n output = subprocess.check_output(cmd,\n stderr=subprocess.STDOUT,\n shell=True,\n env=environ)\n except subprocess.CalledProcessError as e:\n output = e.output\n\n output = output.decode('utf-8')\n output = output.strip()\n # print(\"Output of command\", output)\n return output", "metadata": "root.GitRepoManager._run", "header": "['class', 'GitRepoManager', '(', 'RepoManagerBase', ')', ':', '___EOS___']", "index": 36 }, { "content": " def _run_generic_command(self, repo, cmd):\n \"\"\"\n Run a generic command within the repo. Assumes that you are\n in the repo's root directory\n \"\"\"\n \n result = None\n with cd(repo.rootdir):\n # Dont use sh. It is not collecting the stdout of all\n # child processes.\n output = self._run(cmd)\n try:\n result = {\n 'cmd': cmd,\n 'status': 'success',\n 'message': output,\n }\n except Exception as e:\n result = {\n 'cmd': cmd,\n 'status': 'error',\n 'message': str(e)\n }\n\n return result", "metadata": "root.GitRepoManager._run_generic_command", "header": "['class', 'GitRepoManager', '(', 'RepoManagerBase', ')', ':', '___EOS___']", "index": 72 }, { "content": " def notes(self, repo, args=[]):\n \"\"\"\n Add notes to the commit\n\n Parameters\n ----------\n\n repo: Repository object\n args: notes-specific args\n\n \"\"\"\n return self._run_generic_command(repo, [\"notes\"] + args)", "metadata": "root.GitRepoManager.notes", "header": "['class', 'GitRepoManager', '(', 'RepoManagerBase', ')', ':', '___EOS___']", "index": 99 }, { "content": " def push(self, repo, args=[]):\n \"\"\"\n Push to origin master\n\n Parameters\n ----------\n\n repo: Repository object\n args: git-specific args\n\n \"\"\"\n return self._run_generic_command(repo, [\"push\"] + args)", "metadata": "root.GitRepoManager.push", "header": "['class', 'GitRepoManager', '(', 'RepoManagerBase', ')', ':', '___EOS___']", "index": 113 }, { "content": " def remote(self, repo, args=[]):\n \"\"\"\n Check remote URL\n\n Parameters\n ----------\n\n repo: Repository object\n args: git-specific args\n\n \"\"\"\n return self._run_generic_command(repo, [\"remote\"] + args)", "metadata": "root.GitRepoManager.remote", "header": "['class', 'GitRepoManager', '(', 'RepoManagerBase', ')', ':', '___EOS___']", "index": 127 }, { "content": " def pull(self, repo, args=[]):\n \"\"\"\n Pull from origin/filesystem based master\n\n Parameters\n ----------\n\n repo: Repository object\n args: git-specific args\n\n \"\"\"\n return self._run_generic_command(repo, [\"pull\"] + args)", "metadata": "root.GitRepoManager.pull", "header": "['class', 'GitRepoManager', '(', 'RepoManagerBase', ')', ':', '___EOS___']", "index": 141 }, { "content": " def status(self, repo, args=[]):\n \"\"\"\n Show status of the repo (pass thru git command)\n\n Parameters\n ----------\n\n repo: Repository object\n args: git-specific args\n \"\"\"\n return self._run_generic_command(repo, [\"status\"] + args)", "metadata": "root.GitRepoManager.status", "header": "['class', 'GitRepoManager', '(', 'RepoManagerBase', ')', ':', '___EOS___']", "index": 154 }, { "content": " def stash(self, repo, args=[]):\n \"\"\"\n Stash all the changes (pass thru git command)\n\n Parameters\n ----------\n\n repo: Repository object\n args: git-specific args\n \"\"\"\n return self._run_generic_command(repo, [\"stash\"] + args)", "metadata": "root.GitRepoManager.stash", "header": "['class', 'GitRepoManager', '(', 'RepoManagerBase', ')', ':', '___EOS___']", "index": 166 }, { "content": " def diff(self, repo, args=[]):\n \"\"\"\n diff two repo versions (pass thru git command)\n\n Parameters\n ----------\n\n repo: Repository object\n args: git-specific args\n \"\"\"\n return self._run_generic_command(repo, [\"diff\"] + args)", "metadata": "root.GitRepoManager.diff", "header": "['class', 'GitRepoManager', '(', 'RepoManagerBase', ')', ':', '___EOS___']", "index": 178 }, { "content": " def log(self, repo, args=[]):\n \"\"\"\n Show the log (pass thru git command)\n\n Parameters\n ----------\n\n repo: Repository object\n args: git-specific args\n \"\"\"\n return self._run_generic_command(repo, [\"log\"] + args)", "metadata": "root.GitRepoManager.log", "header": "['class', 'GitRepoManager', '(', 'RepoManagerBase', ')', ':', '___EOS___']", "index": 190 }, { "content": " def commit(self, repo, args=[]):\n \"\"\"\n Commit the changes to the repo (pass thru git command)\n\n Parameters\n ----------\n\n repo: Repository object\n args: git-specific args\n \"\"\"\n \n return self._run_generic_command(repo, [\"commit\"] + args)", "metadata": "root.GitRepoManager.commit", "header": "['class', 'GitRepoManager', '(', 'RepoManagerBase', ')', ':', '___EOS___']", "index": 202 }, { "content": " def show(self, repo, args=[]):\n \"\"\"\n Show the content of the repo (pass thru git command)\n\n Parameters\n ----------\n\n repo: Repository object\n args: git-specific args\n \"\"\"\n return self._run_generic_command(repo, [\"show\"] + args)", "metadata": "root.GitRepoManager.show", "header": "['class', 'GitRepoManager', '(', 'RepoManagerBase', ')', ':', '___EOS___']", "index": 215 }, { "content": " def init(self, username, reponame, force, backend=None):\n \"\"\"\n Initialize a Git repo\n\n Parameters\n ----------\n\n username, reponame : Repo name is tuple (name, reponame)\n force: force initialization of the repo even if exists\n backend: backend that must be used for this (e.g. s3)\n \"\"\"\n key = self.key(username, reponame)\n\n # In local filesystem-based server, add a repo\n server_repodir = self.server_rootdir(username,\n reponame,\n create=False)\n\n # Force cleanup if needed\n if os.path.exists(server_repodir) and not force:\n raise RepositoryExists()\n\n if os.path.exists(server_repodir):\n shutil.rmtree(server_repodir)\n os.makedirs(server_repodir)\n\n # Initialize the repo\n with cd(server_repodir):\n git.init(\".\", \"--bare\")\n\n if backend is not None:\n backend.init_repo(server_repodir)\n\n # Now clone the filesystem-based repo\n repodir = self.rootdir(username, reponame, create=False)\n\n # Prepare it if needed\n if os.path.exists(repodir) and not force:\n raise Exception(\"Local repo already exists\")\n if os.path.exists(repodir):\n shutil.rmtree(repodir)\n os.makedirs(repodir)\n\n # Now clone...\n with cd(os.path.dirname(repodir)):\n git.clone(server_repodir, '--no-hardlinks')\n\n url = server_repodir\n if backend is not None:\n url = backend.url(username, reponame)\n\n repo = Repo(username, reponame)\n repo.manager = self\n repo.remoteurl = url\n repo.rootdir = self.rootdir(username, reponame)\n\n self.add(repo)\n return repo", "metadata": "root.GitRepoManager.init", "header": "['class', 'GitRepoManager', '(', 'RepoManagerBase', ')', ':', '___EOS___']", "index": 229 }, { "content": " def clone(self, url, backend=None):\n \"\"\"\n Clone a URL\n\n Parameters\n ----------\n\n url : URL of the repo. Supports s3://, git@, http://\n \"\"\"\n\n\n # s3://bucket/git/username/repo.git\n username = self.username\n reponame = url.split(\"/\")[-1] # with git\n reponame = reponame.replace(\".git\",\"\")\n\n key = (username, reponame)\n\n # In local filesystem-based server, add a repo\n server_repodir = self.server_rootdir(username,\n reponame,\n create=False)\n\n rootdir = self.rootdir(username, reponame, create=False)\n\n\n if backend is None:\n # Backend is standard git repo (https://, git@...)\n with cd(os.path.dirname(rootdir)):\n self._run(['clone', '--no-hardlinks', url])\n else:\n # Backend is s3\n # Sync if needed.\n if not os.path.exists(server_repodir):\n # s3 -> .dgit/git/pingali/hello.git -> .dgit/datasets/pingali/hello\n backend.clone_repo(url, server_repodir)\n\n # After sync clone,\n with cd(os.path.dirname(rootdir)):\n self._run(['clone', '--no-hardlinks', server_repodir])\n\n\n # Insert the notes push\n if True:\n configfile = os.path.join(rootdir, '.git', 'config')\n content = open(configfile).read()\n original = \"fetch = +refs/heads/*:refs/remotes/origin/*\"\n replacement =\"\"\"fetch = +refs/heads/*:refs/remotes/origin/*\\n fetch = +refs/notes/*:refs/notes/*\"\"\"\n if \"notes\" not in content:\n content = content.replace(original, replacement)\n with open(configfile, 'w') as fd:\n fd.write(content)\n\n # Pull the notes if any as well..\n with cd(rootdir):\n self._run(['pull','origin'])\n\n # Insert the object into the internal table we maintain...\n r = Repo(username, reponame)\n r.rootdir = rootdir\n r.remoteurl = url\n r.manager = self\n\n package = os.path.join(r.rootdir, 'datapackage.json')\n packagedata = open(package).read()\n r.package = json.JSONDecoder(object_pairs_hook=collections.OrderedDict).decode(packagedata)\n\n return self.add(r)", "metadata": "root.GitRepoManager.clone", "header": "['class', 'GitRepoManager', '(', 'RepoManagerBase', ')', ':', '___EOS___']", "index": 288 }, { "content": " def delete(self, repo, args=[]):\n \"\"\"\n Delete files from the repo\n \"\"\"\n\n result = None\n with cd(repo.rootdir):\n try:\n cmd = ['rm'] + list(args)\n result = {\n 'status': 'success',\n 'message': self._run(cmd)\n }\n except Exception as e:\n result = {\n 'status': 'error',\n 'message': str(e)\n }\n\n # print(result)\n return result", "metadata": "root.GitRepoManager.delete", "header": "['class', 'GitRepoManager', '(', 'RepoManagerBase', ')', ':', '___EOS___']", "index": 358 }, { "content": " def drop(self, repo, args=[]):\n \"\"\"\n Cleanup the repo\n \"\"\"\n\n # Clean up the rootdir\n rootdir = repo.rootdir\n if os.path.exists(rootdir):\n print(\"Cleaning repo directory: {}\".format(rootdir))\n shutil.rmtree(rootdir)\n\n # Cleanup the local version of the repo (this could be on\n # the server etc.\n server_repodir = self.server_rootdir_from_repo(repo,\n create=False)\n if os.path.exists(server_repodir):\n print(\"Cleaning data from local git 'server': {}\".format(server_repodir))\n shutil.rmtree(server_repodir)\n\n super(GitRepoManager, self).drop(repo)\n\n return {\n 'status': 'success',\n 'message': \"successful cleanup\"\n }", "metadata": "root.GitRepoManager.drop", "header": "['class', 'GitRepoManager', '(', 'RepoManagerBase', ')', ':', '___EOS___']", "index": 380 }, { "content": " def permalink(self, repo, path):\n \"\"\"\n Get the permalink to command that generated the dataset\n \"\"\"\n\n if not os.path.exists(path): \n # print(\"Path does not exist\", path)\n return (None, None) \n\n # Get this directory\n cwd = os.getcwd()\n\n # Find the root of the repo and cd into that directory..\n if os.path.isfile(path):\n os.chdir(os.path.dirname(path))\n\n rootdir = self._run([\"rev-parse\", \"--show-toplevel\"])\n if \"fatal\" in rootdir:\n # print(\"fatal\", rootdir)\n return (None, None) \n\n os.chdir(rootdir)\n # print(\"Rootdir = \", rootdir)\n\n # Now find relative path\n relpath = os.path.relpath(path, rootdir)\n # print(\"relpath = \", relpath)\n\n # Get the last commit for this file\n #3764cc2600b221ac7d7497de3d0dbcb4cffa2914\n sha1 = self._run([\"log\", \"-n\", \"1\", \"--format=format:%H\", relpath])\n # print(\"sha1 = \", sha1)\n\n # Get the repo URL\n #[email protected]:pingali/simple-regression.git\n #https://gitlab.com/kanban_demo/test_project.git\n remoteurl = self._run([\"config\", \"--get\", \"remote.origin.url\"])\n # print(\"remoteurl = \", remoteurl)\n\n # Go back to the original directory...\n os.chdir(cwd)\n\n # Now match it against two possible formats of the remote url\n # Examples\n #https://help.github.com/articles/getting-permanent-links-to-files/\n #https://github.com/github/hubot/blob/ed25584f5ac2520a6c28547ffd0961c7abd7ea49/README.md\n #https://gitlab.com/pingali/simple-regression/blob/3764cc2600b221ac7d7497de3d0dbcb4cffa2914/model.py\n #https://github.com/pingali/dgit/blob/ff91b5d04b2978cad0bf9b006d1b0a16d18a778e/README.rst\n #https://gitlab.com/kanban_demo/test_project/blob/b004677c23b3a31eb7b5588a5194857b2c8b2b95/README.md\n\n m = re.search('^git@([^:\\/]+):([^/]+)/([^/]+)', remoteurl)\n if m is None:\n m = re.search('^https://([^:/]+)/([^/]+)/([^/]+)', remoteurl)\n if m is not None:\n domain = m.group(1)\n username = m.group(2)\n project = m.group(3)\n if project.endswith(\".git\"):\n project = project[:-4]\n permalink = \"https://{}/{}/{}/blob/{}/{}\".format(domain, username, project,\n sha1, relpath)\n # print(\"permalink = \", permalink)\n return (relpath, permalink)\n else:\n return (None, None)", "metadata": "root.GitRepoManager.permalink", "header": "['class', 'GitRepoManager', '(', 'RepoManagerBase', ')', ':', '___EOS___']", "index": 406 }, { "content": " def add_raw(self, repo, files):\n result = None\n with cd(repo.rootdir):\n try:\n result = self._run([\"add\"] + files)\n except:\n pass", "metadata": "root.GitRepoManager.add_raw", "header": "['class', 'GitRepoManager', '(', 'RepoManagerBase', ')', ':', '___EOS___']", "index": 474 }, { "content": " def add_files(self, repo, files):\n \"\"\"\n Add files to the repo\n \"\"\"\n rootdir = repo.rootdir\n for f in files:\n relativepath = f['relativepath']\n sourcepath = f['localfullpath']\n if sourcepath is None:\n # This can happen if the relative path is a URL\n continue #\n # Prepare the target path\n targetpath = os.path.join(rootdir, relativepath)\n try:\n os.makedirs(os.path.dirname(targetpath))\n except:\n pass\n # print(sourcepath,\" => \", targetpath)\n print(\"Updating: {}\".format(relativepath))\n shutil.copyfile(sourcepath, targetpath)\n with cd(repo.rootdir):\n self._run(['add', relativepath])", "metadata": "root.GitRepoManager.add_files", "header": "['class', 'GitRepoManager', '(', 'RepoManagerBase', ')', ':', '___EOS___']", "index": 483 }, { "content": " def config(self, what='get', params=None):\n \"\"\"\n Paramers:\n ---------\n\n workspace: Directory to store the dataset repositories\n email:\n \"\"\"\n if what == 'get':\n return {\n 'name': 'git',\n 'nature': 'repomanager',\n 'variables': [],\n }\n elif what == 'set':\n self.workspace = params['Local']['workspace']\n self.workspace = os.path.abspath(self.workspace)\n self.username = params['User']['user.name']\n self.fullname = params['User']['user.fullname']\n self.email = params['User']['user.email']\n\n repodir = os.path.join(self.workspace, 'datasets')\n if not os.path.exists(repodir):\n return\n\n for username in os.listdir(repodir):\n for reponame in os.listdir(os.path.join(repodir, username)):\n if self.is_my_repo(username, reponame):\n r = Repo(username, reponame)\n r.rootdir = os.path.join(repodir, username, reponame)\n package = os.path.join(r.rootdir, 'datapackage.json')\n if not os.path.exists(package):\n print(\"datapackage.json does not exist in dataset\")\n print(\"Skipping: {}/{}\".format(username, reponame))\n continue\n\n packagedata = open(package).read()\n r.package = json.JSONDecoder(object_pairs_hook=collections.OrderedDict).decode(packagedata)\n r.manager = self\n self.add(r)", "metadata": "root.GitRepoManager.config", "header": "['class', 'GitRepoManager', '(', 'RepoManagerBase', ')', ':', '___EOS___']", "index": 506 }, { "content": "def setup(mgr):\n\n obj = GitRepoManager()\n mgr.register('repomanager', obj)", "metadata": "root.setup", "header": "['module', '___EOS___']", "index": 547 } ]
[ { "span": "import os, sys, json, subprocess, re, json", "start_line": 11, "start_column": 0, "end_line": 11, "end_column": 42 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#!", "/", "usr", "/", "bin", "/", "env", " ", "python_", "\\u\\u\\uNL\\u\\u\\u_", "\"\"\"", "\\", "10", ";", "Git", "Manager", " ", "provide", "s", " ", "the", " ", "high", " ", "level", " ", "interface", " ", "to", " ", "git", " ", "command", " ", "line", "\\", "10", ";", "\\", "10", ";", "Git", "Manager", " ", "doe", "s", " ", "not", " ", "have", " ", "independent", " ", "variab", "les", " ", "but", " ", "it", " ", "inherits", " ", "attribute", "s", " ", "from", " ", "'", "Local", "'", " ", "back", "end", " ", "and", " ", "'", "User", "'", " ", "definit", "ion", "\\", "10", ";", "\\", "10", ";", "*", " ", "works", "pace", ":", " ", "(", "from", " ", "Local", ")", " ", "Director", "y", " ", "used", " ", "by", " ", "git", "manage", "r", " ", "to", " ", "store", " ", "dataset", " ", "repos", "itori", "es", "\\", "10", ";", "*", " ", "user", "name", ":", " ", "(", "from", " ", "User", ")", " ", "Name", " ", "of", " ", "the", " ", "user", "\\", "10", ";", "*", " ", "email", ":", " ", "(", "from", " ", "User", ")", " ", "Ema", "il", " ", "of", " ", "the", " ", "user", "\\", "10", ";", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "os_", ",_", "sys_", ",_", "json_", ",_", "subprocess_", ",_", "re_", ",_", "json_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "pipes_", ",_", "collections_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "shutil_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "sh_", "import_", "git_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "dg", "itc", "ore_", "._", "plugins_", "._", "repo", "manager_", "import_", "Rep", "o", "Manager", "Base_", ",_", "Repo_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "dg", "itc", "ore_", "._", "helper_", "import_", "cd_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "dg", "itc", "ore_", "._", "exceptions_", "import_", "*_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Git", "Rep", "o", "Manager_", "(_", "Rep", "o", "Manager", "Base_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Git", "-", "based", " ", "versioning", " ", "service", ".", " ", "Thi", "s", " ", "implement", "s", " ", "the", " ", "Rep", "o", "Manager", "Base", " ", "class", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "=>", " ", " ", "Help", "er", " ", "functions_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "=>", " ", " ", "Simple", " ", "command", "s", " ", "..._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "=>", " ", " ", "Simple", " ", "command", "s", " ", "..._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "=>", " ", " ", "Simple", " ", "command", "s", " ", "..._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "=>", " ", " ", "Simple", " ", "command", "s", " ", "..._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "=>", " ", "Run", " ", "more", " ", "complex", " ", "function", "s", " ", "to", " ", "initialize", ",", " ", "cleanup_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Git", "Rep", "o", "Manager_", "(_", "Rep", "o", "Manager", "Base_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "username_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "workspace_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "metadata", "dir_", "=_", "'.", "git", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "repos_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "enable_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "super_", "(_", "Git", "Rep", "o", "Manager_", ",_", "self_", ")_", "._", "\\u\\u", "init\\u\\u_", "(_", "'", "git", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "v", "0", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Git", "-", "based", " ", "Repos", "itor", "y", " ", "Manager", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Git", "Rep", "o", "Manager_", "(_", "Rep", "o", "Manager", "Base_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "run_", "(_", "self_", ",_", "cmd_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Help", "er", " ", "function", " ", "to", " ", "run", " ", "command", "s", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Parameter", "s", "\\", "10", ";", " ", " ", " ", " ", "----------", "\\", "10", ";", " ", " ", " ", " ", "cmd", " ", ":", " ", "list", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "Arg", "ument", "s", " ", "to", " ", "git", " ", "command", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Thi", "s", " ", "is", " ", "here", " ", "in", " ", "case", " ", "the", " ", ".", "git", "config", " ", "is", " ", "not", " ", "accessible", " ", "for_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "some", " ", "reason", ".", " _", "\\u\\u\\uNL\\u\\u\\u_", "environ_", "=_", "os_", "._", "environ_", "._", "copy_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "environ_", "[_", "'", "GIT", "\\u", "COMMIT", "TER", "\\u", "NAME", "'_", "]_", "=_", "self_", "._", "fullname_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "environ_", "[_", "'", "GIT", "\\u", "COMMIT", "TER", "\\u", "EMA", "IL", "'_", "]_", "=_", "self_", "._", "email_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "environ_", "[_", "'", "GIT", "\\u", "AUTHOR", "\\u", "NAME", "'_", "]_", "=_", "self_", "._", "fullname_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "environ_", "[_", "'", "GIT", "\\u", "AUTHOR", "\\u", "EMA", "IL", "'_", "]_", "=_", "self_", "._", "email_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "cmd_", "=_", "[_", "pipes_", "._", "quote_", "(_", "c_", ")_", "for_", "c_", "in_", "cmd_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cmd_", "=_", "\"", " ", "\"_", "._", "join_", "(_", "[_", "'/", "usr", "/", "bin", "/", "git", "'_", "]_", "+_", "cmd_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cmd_", "+=_", "\";", " ", "exit", " ", "0", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "print", "(\"", "Run", "ning", " ", "cmd", "\",", " ", "cmd", ")_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "output_", "=_", "subprocess_", "._", "check", "\\u", "output_", "(_", "cmd_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "stderr_", "=_", "subprocess_", "._", "STDOUT_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "shell_", "=_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "env_", "=_", "environ_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "subprocess_", "._", "Call", "ed", "Process", "Error_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "output_", "=_", "e_", "._", "output_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "output_", "=_", "output_", "._", "decode_", "(_", "'", "utf", "-", "8", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "output_", "=_", "output_", "._", "strip_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "print", "(\"", "Output", " ", "of", " ", "command", "\",", " ", "output", ")_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "output_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Git", "Rep", "o", "Manager_", "(_", "Rep", "o", "Manager", "Base_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "run", "\\u", "gener", "ic", "\\u", "command_", "(_", "self_", ",_", "repo_", ",_", "cmd_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Run", " ", "a", " ", "gener", "ic", " ", "command", " ", "within", " ", "the", " ", "repo", ".", " ", "Assume", "s", " ", "tha", "t", " ", "you", " ", "are", "\\", "10", ";", " ", " ", " ", " ", "in", " ", "the", " ", "repo", "'", "s", " ", "root", " ", "director", "y", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "result_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "cd_", "(_", "repo_", "._", "rootdir_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Don", "t", " ", "use", " ", "sh", ".", " ", "It", " ", "is", " ", "not", " ", "collecti", "ng", " ", "the", " ", "stdout", " ", "of", " ", "all_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "child", " ", "process", "es", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "output_", "=_", "self_", "._", "\\u", "run_", "(_", "cmd_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "cmd", "'_", ":_", "cmd_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "status", "'_", ":_", "'", "success", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "message", "'_", ":_", "output_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "cmd", "'_", ":_", "cmd_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "status", "'_", ":_", "'", "error", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "message", "'_", ":_", "str_", "(_", "e_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "result_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Git", "Rep", "o", "Manager_", "(_", "Rep", "o", "Manager", "Base_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "notes_", "(_", "self_", ",_", "repo_", ",_", "args_", "=_", "[_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Add", " ", "note", "s", " ", "to", " ", "the", " ", "commit", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Parameter", "s", "\\", "10", ";", " ", " ", " ", " ", "----------", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "repo", ":", " ", "Repos", "itor", "y", " ", "object", "\\", "10", ";", " ", " ", " ", " ", "args", ":", " ", "note", "s", "-", "specific", " ", "args", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "\\u", "run", "\\u", "gener", "ic", "\\u", "command_", "(_", "repo_", ",_", "[_", "\"", "note", "s", "\"_", "]_", "+_", "args_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Git", "Rep", "o", "Manager_", "(_", "Rep", "o", "Manager", "Base_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "push_", "(_", "self_", ",_", "repo_", ",_", "args_", "=_", "[_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Push", " ", "to", " ", "orig", "in", " ", "master", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Parameter", "s", "\\", "10", ";", " ", " ", " ", " ", "----------", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "repo", ":", " ", "Repos", "itor", "y", " ", "object", "\\", "10", ";", " ", " ", " ", " ", "args", ":", " ", "git", "-", "specific", " ", "args", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "\\u", "run", "\\u", "gener", "ic", "\\u", "command_", "(_", "repo_", ",_", "[_", "\"", "push", "\"_", "]_", "+_", "args_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Git", "Rep", "o", "Manager_", "(_", "Rep", "o", "Manager", "Base_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "remote_", "(_", "self_", ",_", "repo_", ",_", "args_", "=_", "[_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Check", " ", "remote", " ", "URL", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Parameter", "s", "\\", "10", ";", " ", " ", " ", " ", "----------", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "repo", ":", " ", "Repos", "itor", "y", " ", "object", "\\", "10", ";", " ", " ", " ", " ", "args", ":", " ", "git", "-", "specific", " ", "args", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "\\u", "run", "\\u", "gener", "ic", "\\u", "command_", "(_", "repo_", ",_", "[_", "\"", "remote", "\"_", "]_", "+_", "args_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Git", "Rep", "o", "Manager_", "(_", "Rep", "o", "Manager", "Base_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "pull_", "(_", "self_", ",_", "repo_", ",_", "args_", "=_", "[_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Pul", "l", " ", "from", " ", "orig", "in", "/", "filesystem", " ", "based", " ", "master", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Parameter", "s", "\\", "10", ";", " ", " ", " ", " ", "----------", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "repo", ":", " ", "Repos", "itor", "y", " ", "object", "\\", "10", ";", " ", " ", " ", " ", "args", ":", " ", "git", "-", "specific", " ", "args", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "\\u", "run", "\\u", "gener", "ic", "\\u", "command_", "(_", "repo_", ",_", "[_", "\"", "pull", "\"_", "]_", "+_", "args_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Git", "Rep", "o", "Manager_", "(_", "Rep", "o", "Manager", "Base_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "status_", "(_", "self_", ",_", "repo_", ",_", "args_", "=_", "[_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Show", " ", "status", " ", "of", " ", "the", " ", "repo", " ", "(", "pass", " ", "thru", " ", "git", " ", "command", ")", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Parameter", "s", "\\", "10", ";", " ", " ", " ", " ", "----------", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "repo", ":", " ", "Repos", "itor", "y", " ", "object", "\\", "10", ";", " ", " ", " ", " ", "args", ":", " ", "git", "-", "specific", " ", "args", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "\\u", "run", "\\u", "gener", "ic", "\\u", "command_", "(_", "repo_", ",_", "[_", "\"", "status", "\"_", "]_", "+_", "args_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Git", "Rep", "o", "Manager_", "(_", "Rep", "o", "Manager", "Base_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "stash", "_", "(_", "self_", ",_", "repo_", ",_", "args_", "=_", "[_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Sta", "sh", " ", "all", " ", "the", " ", "change", "s", " ", "(", "pass", " ", "thru", " ", "git", " ", "command", ")", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Parameter", "s", "\\", "10", ";", " ", " ", " ", " ", "----------", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "repo", ":", " ", "Repos", "itor", "y", " ", "object", "\\", "10", ";", " ", " ", " ", " ", "args", ":", " ", "git", "-", "specific", " ", "args", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "\\u", "run", "\\u", "gener", "ic", "\\u", "command_", "(_", "repo_", ",_", "[_", "\"", "stash", "\"_", "]_", "+_", "args_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Git", "Rep", "o", "Manager_", "(_", "Rep", "o", "Manager", "Base_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "diff_", "(_", "self_", ",_", "repo_", ",_", "args_", "=_", "[_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "diff", " ", "two", " ", "repo", " ", "version", "s", " ", " ", "(", "pass", " ", "thru", " ", "git", " ", "command", ")", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Parameter", "s", "\\", "10", ";", " ", " ", " ", " ", "----------", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "repo", ":", " ", "Repos", "itor", "y", " ", "object", "\\", "10", ";", " ", " ", " ", " ", "args", ":", " ", "git", "-", "specific", " ", "args", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "\\u", "run", "\\u", "gener", "ic", "\\u", "command_", "(_", "repo_", ",_", "[_", "\"", "diff", "\"_", "]_", "+_", "args_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Git", "Rep", "o", "Manager_", "(_", "Rep", "o", "Manager", "Base_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "log_", "(_", "self_", ",_", "repo_", ",_", "args_", "=_", "[_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Show", " ", "the", " ", "log", " ", " ", "(", "pass", " ", "thru", " ", "git", " ", "command", ")", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Parameter", "s", "\\", "10", ";", " ", " ", " ", " ", "----------", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "repo", ":", " ", "Repos", "itor", "y", " ", "object", "\\", "10", ";", " ", " ", " ", " ", "args", ":", " ", "git", "-", "specific", " ", "args", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "\\u", "run", "\\u", "gener", "ic", "\\u", "command_", "(_", "repo_", ",_", "[_", "\"", "log", "\"_", "]_", "+_", "args_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Git", "Rep", "o", "Manager_", "(_", "Rep", "o", "Manager", "Base_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "commit_", "(_", "self_", ",_", "repo_", ",_", "args_", "=_", "[_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Commi", "t", " ", "the", " ", "change", "s", " ", "to", " ", "the", " ", "repo", " ", "(", "pass", " ", "thru", " ", "git", " ", "command", ")", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Parameter", "s", "\\", "10", ";", " ", " ", " ", " ", "----------", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "repo", ":", " ", "Repos", "itor", "y", " ", "object", "\\", "10", ";", " ", " ", " ", " ", "args", ":", " ", "git", "-", "specific", " ", "args", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "self_", "._", "\\u", "run", "\\u", "gener", "ic", "\\u", "command_", "(_", "repo_", ",_", "[_", "\"", "commit", "\"_", "]_", "+_", "args_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Git", "Rep", "o", "Manager_", "(_", "Rep", "o", "Manager", "Base_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "show_", "(_", "self_", ",_", "repo_", ",_", "args_", "=_", "[_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Show", " ", "the", " ", "content", " ", "of", " ", "the", " ", "repo", " ", "(", "pass", " ", "thru", " ", "git", " ", "command", ")", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Parameter", "s", "\\", "10", ";", " ", " ", " ", " ", "----------", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "repo", ":", " ", "Repos", "itor", "y", " ", "object", "\\", "10", ";", " ", " ", " ", " ", "args", ":", " ", "git", "-", "specific", " ", "args", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "\\u", "run", "\\u", "gener", "ic", "\\u", "command_", "(_", "repo_", ",_", "[_", "\"", "show", "\"_", "]_", "+_", "args_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Git", "Rep", "o", "Manager_", "(_", "Rep", "o", "Manager", "Base_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "init_", "(_", "self_", ",_", "username_", ",_", "repon", "ame_", ",_", "force_", ",_", "backend_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Initializ", "e", " ", "a", " ", "Git", " ", "repo", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Parameter", "s", "\\", "10", ";", " ", " ", " ", " ", "----------", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "user", "name", ",", " ", "repon", "ame", " ", ":", " ", "Rep", "o", " ", "name", " ", "is", " ", "tuple", " ", "(", "name", ",", " ", "repon", "ame", ")", "\\", "10", ";", " ", " ", " ", " ", "force", ":", " ", "force", " ", "initialization", " ", "of", " ", "the", " ", "repo", " ", "even", " ", "if", " ", "exist", "s", "\\", "10", ";", " ", " ", " ", " ", "back", "end", ":", " ", "back", "end", " ", "tha", "t", " ", "must", " ", "be", " ", "used", " ", "for", " ", "this", " ", "(", "e", ".", "g", ".", " ", "s3", ")", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "key_", "=_", "self_", "._", "key_", "(_", "username_", ",_", "repon", "ame_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "In", " ", "local", " ", "filesystem", "-", "based", " ", "server", ",", " ", "add", " ", "a", " ", "repo_", "\\u\\u\\uNL\\u\\u\\u_", "server", "\\u", "repo", "dir_", "=_", "self_", "._", "server", "\\u", "rootdir_", "(_", "username_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "repon", "ame_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "create_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Force", " ", "clean", "up", " ", "if", " ", "needed_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "os_", "._", "path_", "._", "exists_", "(_", "server", "\\u", "repo", "dir_", ")_", "and_", "not_", "force_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Repos", "itor", "y", "Exists_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "os_", "._", "path_", "._", "exists_", "(_", "server", "\\u", "repo", "dir_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "shutil_", "._", "rmtree_", "(_", "server", "\\u", "repo", "dir_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "os_", "._", "makedirs_", "(_", "server", "\\u", "repo", "dir_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Initializ", "e", " ", "the", " ", "repo_", "\\u\\u\\uNL\\u\\u\\u_", "with_", "cd_", "(_", "server", "\\u", "repo", "dir_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "git_", "._", "init_", "(_", "\".\"_", ",_", "\"--", "bare", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "backend_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "backend_", "._", "init", "\\u", "repo_", "(_", "server", "\\u", "repo", "dir_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "No", "w", " ", "clone", " ", "the", " ", "filesystem", "-", "based", " ", "repo_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "repo", "dir_", "=_", "self_", "._", "rootdir_", "(_", "username_", ",_", "repon", "ame_", ",_", "create_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Prepare", " ", "it", " ", "if", " ", "needed_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "os_", "._", "path_", "._", "exists_", "(_", "repo", "dir_", ")_", "and_", "not_", "force_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Exception_", "(_", "\"", "Local", " ", "repo", " ", "alr", "ead", "y", " ", "exist", "s", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "os_", "._", "path_", "._", "exists_", "(_", "repo", "dir_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "shutil_", "._", "rmtree_", "(_", "repo", "dir_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "os_", "._", "makedirs_", "(_", "repo", "dir_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "No", "w", " ", "clone", "..._", "\\u\\u\\uNL\\u\\u\\u_", "with_", "cd_", "(_", "os_", "._", "path_", "._", "dirname_", "(_", "repo", "dir_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "git_", "._", "clone_", "(_", "server", "\\u", "repo", "dir_", ",_", "'--", "no", "-", "hard", "link", "s", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "url_", "=_", "server", "\\u", "repo", "dir_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "backend_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "url_", "=_", "backend_", "._", "url_", "(_", "username_", ",_", "repon", "ame_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "repo_", "=_", "Repo_", "(_", "username_", ",_", "repon", "ame_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "repo_", "._", "manager_", "=_", "self_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "repo_", "._", "remote", "url_", "=_", "url_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "repo_", "._", "rootdir_", "=_", "self_", "._", "rootdir_", "(_", "username_", ",_", "repon", "ame_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "add_", "(_", "repo_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "repo_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Git", "Rep", "o", "Manager_", "(_", "Rep", "o", "Manager", "Base_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "clone_", "(_", "self_", ",_", "url_", ",_", "backend_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Clone", " ", "a", " ", "URL", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Parameter", "s", "\\", "10", ";", " ", " ", " ", " ", "----------", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "url", " ", ":", " ", "URL", " ", "of", " ", "the", " ", "repo", ".", " ", "Supp", "orts", " ", "s3", "://", ",", " ", "git", "@", ",", " ", "http", "://", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "s3", "://", "bucket", "/", "git", "/", "user", "name", "/", "repo", ".", "git_", "\\u\\u\\uNL\\u\\u\\u_", "username_", "=_", "self_", "._", "username_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "repon", "ame_", "=_", "url_", "._", "split_", "(_", "\"/\"_", ")_", "[_", "-_", "1_", "]_", "#", " ", "with", " ", "git_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "repon", "ame_", "=_", "repon", "ame_", "._", "replace_", "(_", "\".", "git", "\"_", ",_", "\"\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "key_", "=_", "(_", "username_", ",_", "repon", "ame_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "In", " ", "local", " ", "filesystem", "-", "based", " ", "server", ",", " ", "add", " ", "a", " ", "repo_", "\\u\\u\\uNL\\u\\u\\u_", "server", "\\u", "repo", "dir_", "=_", "self_", "._", "server", "\\u", "rootdir_", "(_", "username_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "repon", "ame_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "create_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "rootdir_", "=_", "self_", "._", "rootdir_", "(_", "username_", ",_", "repon", "ame_", ",_", "create_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "backend_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Back", "end", " ", "is", " ", "standard", " ", "git", " ", "repo", " ", "(", "https", "://", ",", " ", "git", "@", "...)", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "with_", "cd_", "(_", "os_", "._", "path_", "._", "dirname_", "(_", "rootdir_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "run_", "(_", "[_", "'", "clone", "'_", ",_", "'--", "no", "-", "hard", "link", "s", "'_", ",_", "url_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Back", "end", " ", "is", " ", "s3_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Sync", " ", "if", " ", "need", "ed", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "os_", "._", "path_", "._", "exists_", "(_", "server", "\\u", "repo", "dir_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "s3", " ", "->", " ", ".", "dg", "it", "/", "git", "/", "ping", "ali", "/", "hell", "o", ".", "git", " ", "->", " ", ".", "dg", "it", "/", "dataset", "s", "/", "ping", "ali", "/", "hello_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "backend_", "._", "clone", "\\u", "repo_", "(_", "url_", ",_", "server", "\\u", "repo", "dir_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Af", "ter", " ", "sync", " ", "clone", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "with_", "cd_", "(_", "os_", "._", "path_", "._", "dirname_", "(_", "rootdir_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "run_", "(_", "[_", "'", "clone", "'_", ",_", "'--", "no", "-", "hard", "link", "s", "'_", ",_", "server", "\\u", "repo", "dir_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Insert", " ", "the", " ", "note", "s", " ", "push_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "True_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "configfile_", "=_", "os_", "._", "path_", "._", "join_", "(_", "rootdir_", ",_", "'.", "git", "'_", ",_", "'", "config", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "content_", "=_", "open_", "(_", "configfile_", ")_", "._", "read_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "original_", "=_", "\"", "fetch", " ", "=", " ", "+", "refs", "/", "head", "s", "/*", ":", "refs", "/", "remotes", "/", "orig", "in", "/*\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "replacement_", "=_", "\"\"\"", "fetch", " ", "=", " ", "+", "refs", "/", "head", "s", "/*", ":", "refs", "/", "remotes", "/", "orig", "in", "/*", "\\\\", "n", " ", " ", " ", " ", "fetch", " ", "=", " ", "+", "refs", "/", "note", "s", "/*", ":", "refs", "/", "note", "s", "/*", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "\"", "note", "s", "\"_", "not_", "in_", "content_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "content_", "=_", "content_", "._", "replace_", "(_", "original_", ",_", "replacement_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "open_", "(_", "configfile_", ",_", "'", "w", "'_", ")_", "as_", "fd_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "fd_", "._", "write_", "(_", "content_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Pul", "l", " ", "the", " ", "note", "s", " ", "if", " ", "any", " ", "as", " ", "well", "..", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "with_", "cd_", "(_", "rootdir_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "run_", "(_", "[_", "'", "pull", "'_", ",_", "'", "orig", "in", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Insert", " ", "the", " ", "object", " ", "int", "o", " ", "the", " ", "internal", " ", "table", " ", "we", " ", "maintain", "..._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "r_", "=_", "Repo_", "(_", "username_", ",_", "repon", "ame_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "r_", "._", "rootdir_", "=_", "rootdir_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "r_", "._", "remote", "url_", "=_", "url_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "r_", "._", "manager_", "=_", "self_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "package_", "=_", "os_", "._", "path_", "._", "join_", "(_", "r_", "._", "rootdir_", ",_", "'", "datap", "ack", "age", ".", "json", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "package", "data_", "=_", "open_", "(_", "package_", ")_", "._", "read_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "r_", "._", "package_", "=_", "json_", "._", "JSO", "ND", "ecode", "r_", "(_", "object\\u", "pair", "s", "\\u", "hook_", "=_", "collections_", "._", "Order", "ed", "Dict_", ")_", "._", "decode_", "(_", "package", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "self_", "._", "add_", "(_", "r_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Git", "Rep", "o", "Manager_", "(_", "Rep", "o", "Manager", "Base_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "delete_", "(_", "self_", ",_", "repo_", ",_", "args_", "=_", "[_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Delete", " ", "files", " ", "from", " ", "the", " ", "repo", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "result_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "cd_", "(_", "repo_", "._", "rootdir_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cmd_", "=_", "[_", "'", "rm", "'_", "]_", "+_", "list_", "(_", "args_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "status", "'_", ":_", "'", "success", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "message", "'_", ":_", "self_", "._", "\\u", "run_", "(_", "cmd_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "status", "'_", ":_", "'", "error", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "message", "'_", ":_", "str_", "(_", "e_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "print", "(", "result", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "result_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Git", "Rep", "o", "Manager_", "(_", "Rep", "o", "Manager", "Base_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "drop_", "(_", "self_", ",_", "repo_", ",_", "args_", "=_", "[_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Clean", "up", " ", "the", " ", "repo", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Clean", " ", "up", " ", "the", " ", "rootdir_", "\\u\\u\\uNL\\u\\u\\u_", "rootdir_", "=_", "repo_", "._", "rootdir_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "os_", "._", "path_", "._", "exists_", "(_", "rootdir_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "\"", "Clean", "ing", " ", "repo", " ", "director", "y", ":", " ", "{}\"_", "._", "format_", "(_", "rootdir_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "shutil_", "._", "rmtree_", "(_", "rootdir_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Clean", "up", " ", "the", " ", "local", " ", "version", " ", "of", " ", "the", " ", "repo", " ", "(", "this", " ", "coul", "d", " ", "be", " ", "on_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "the", " ", "server", " ", "etc", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "server", "\\u", "repo", "dir_", "=_", "self_", "._", "server", "\\u", "root", "dir\\u", "from", "\\u", "repo_", "(_", "repo_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "create_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "os_", "._", "path_", "._", "exists_", "(_", "server", "\\u", "repo", "dir_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "\"", "Clean", "ing", " ", "data", " ", "from", " ", "local", " ", "git", " ", "'", "server", "':", " ", "{}\"_", "._", "format_", "(_", "server", "\\u", "repo", "dir_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "shutil_", "._", "rmtree_", "(_", "server", "\\u", "repo", "dir_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "super_", "(_", "Git", "Rep", "o", "Manager_", ",_", "self_", ")_", "._", "drop_", "(_", "repo_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "status", "'_", ":_", "'", "success", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "message", "'_", ":_", "\"", "success", "ful", " ", "clean", "up", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Git", "Rep", "o", "Manager_", "(_", "Rep", "o", "Manager", "Base_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "permalink", "_", "(_", "self_", ",_", "repo_", ",_", "path_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Get", " ", "the", " ", "permalink", " ", "to", " ", "command", " ", "tha", "t", " ", "generat", "ed", " ", "the", " ", "dataset", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "os_", "._", "path_", "._", "exists_", "(_", "path_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "print", "(\"", "Path", " ", "doe", "s", " ", "not", " ", "exist", "\",", " ", "path", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "(_", "None_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Get", " ", "this", " ", "directory_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "cwd_", "=_", "os_", "._", "getcwd_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Fin", "d", " ", "the", " ", "root", " ", "of", " ", "the", " ", "repo", " ", "and", " ", "cd", " ", "int", "o", " ", "tha", "t", " ", "director", "y", "..", "_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "os_", "._", "path_", "._", "isfile_", "(_", "path_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "os_", "._", "chdir_", "(_", "os_", "._", "path_", "._", "dirname_", "(_", "path_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "rootdir_", "=_", "self_", "._", "\\u", "run_", "(_", "[_", "\"", "rev", "-", "parse", "\"_", ",_", "\"--", "show", "-", "toplevel", "\"_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "\"", "fat", "al", "\"_", "in_", "rootdir_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "print", "(\"", "fat", "al", "\",", " ", "root", "dir", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "(_", "None_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "os_", "._", "chdir_", "(_", "rootdir_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "print", "(\"", "Roo", "tdir", " ", "=", " ", "\",", " ", "root", "dir", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "No", "w", " ", "find", " ", "relative", " ", "path_", "\\u\\u\\uNL\\u\\u\\u_", "relpath_", "=_", "os_", "._", "path_", "._", "relpath_", "(_", "path_", ",_", "rootdir_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "print", "(\"", "rel", "path", " ", "=", " ", "\",", " ", "rel", "path", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Get", " ", "the", " ", "last", " ", "commit", " ", "for", " ", "this", " ", "file_", "\\u\\u\\uNL\\u\\u\\u_", "#", "376", "4c", "c2", "600", "b2", "21", "ac", "7d", "749", "7d", "e3", "d0", "dbc", "b4", "cff", "a2", "914", "_", "\\u\\u\\uNL\\u\\u\\u_", "sha1_", "=_", "self_", "._", "\\u", "run_", "(_", "[_", "\"", "log", "\"_", ",_", "\"-", "n", "\"_", ",_", "\"", "1", "\"_", ",_", "\"--", "format", "=", "format", ":", "%", "H", "\"_", ",_", "relpath_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "print", "(\"", "sha1", " ", "=", " ", "\",", " ", "sha1", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Get", " ", "the", " ", "repo", " ", "URL_", "\\u\\u\\uNL\\u\\u\\u_", "#", "git", "@", "gitlab", ".", "com", ":", "ping", "ali", "/", "simple", "-", "regress", "ion", ".", "git_", "\\u\\u\\uNL\\u\\u\\u_", "#", "https", "://", "gitlab", ".", "com", "/", "kan", "ban", "\\u", "demo", "/", "test\\u", "project", ".", "git_", "\\u\\u\\uNL\\u\\u\\u_", "remote", "url_", "=_", "self_", "._", "\\u", "run_", "(_", "[_", "\"", "config", "\"_", ",_", "\"--", "get", "\"_", ",_", "\"", "remote", ".", "orig", "in", ".", "url", "\"_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "print", "(\"", "remote", "url", " ", "=", " ", "\",", " ", "remote", "url", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Go", " ", "back", " ", "to", " ", "the", " ", "original", " ", "director", "y", "..._", "\\u\\u\\uNL\\u\\u\\u_", "os_", "._", "chdir_", "(_", "cwd_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "No", "w", " ", "match", " ", "it", " ", "against", " ", "two", " ", "possib", "le", " ", "formats", " ", "of", " ", "the", " ", "remote", " ", "url_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Exam", "ples", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "https", "://", "help", ".", "git", "hub", ".", "com", "/", "article", "s", "/", "getti", "ng", "-", "permanent", "-", "link", "s", "-", "to", "-", "files", "/_", "\\u\\u\\uNL\\u\\u\\u_", "#", "https", "://", "git", "hub", ".", "com", "/", "git", "hub", "/", "hub", "ot", "/", "blob", "/", "ed", "255", "84", "f5", "ac", "252", "0a", "6c", "285", "4", "7f", "fd", "096", "1c", "7a", "bd", "7e", "a4", "9", "/", "READ", "ME", ".", "md_", "\\u\\u\\uNL\\u\\u\\u_", "#", "https", "://", "gitlab", ".", "com", "/", "ping", "ali", "/", "simple", "-", "regress", "ion", "/", "blob", "/", "376", "4c", "c2", "600", "b2", "21", "ac", "7d", "749", "7d", "e3", "d0", "dbc", "b4", "cff", "a2", "914", "/", "model", ".", "py_", "\\u\\u\\uNL\\u\\u\\u_", "#", "https", "://", "git", "hub", ".", "com", "/", "ping", "ali", "/", "dg", "it", "/", "blob", "/", "ff", "9", "1b", "5d", "04", "b2", "978", "cad", "0b", "f9", "b0", "0", "6d", "1b", "0a", "16", "d1", "8a", "778", "e", "/", "READ", "ME", ".", "rst_", "\\u\\u\\uNL\\u\\u\\u_", "#", "https", "://", "gitlab", ".", "com", "/", "kan", "ban", "\\u", "demo", "/", "test\\u", "project", "/", "blob", "/", "b0", "046", "7", "7c", "23", "b3", "a3", "1e", "b7", "b5", "588", "a5", "194", "857", "b2", "c8", "b2", "b9", "5", "/", "READ", "ME", ".", "md_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "m_", "=_", "re_", "._", "search_", "(_", "'", "^", "git", "@(", "[", "^", ":\\\\", "/]+", "):", "([", "^", "/]+)/", "([", "^", "/]+", ")'_", ",_", "remote", "url_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "m_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "m_", "=_", "re_", "._", "search_", "(_", "'", "^", "https", "://", "([", "^", ":/", "]+)", "/([", "^", "/]+)/", "([", "^", "/]+", ")'_", ",_", "remote", "url_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "m_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "domain_", "=_", "m_", "._", "group_", "(_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "username_", "=_", "m_", "._", "group_", "(_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "project_", "=_", "m_", "._", "group_", "(_", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "project_", "._", "endswith_", "(_", "\".", "git", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "project_", "=_", "project_", "[_", ":_", "-_", "4_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "permalink", "_", "=_", "\"", "https", "://{}", "/{}/", "{}/", "blob", "/{}/", "{}\"_", "._", "format_", "(_", "domain_", ",_", "username_", ",_", "project_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "sha1_", ",_", "relpath_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "print", "(\"", "permalink", " ", "=", " ", "\",", " ", "permalink", ")_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "(_", "relpath_", ",_", "permalink", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "(_", "None_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Git", "Rep", "o", "Manager_", "(_", "Rep", "o", "Manager", "Base_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "add", "\\u", "raw_", "(_", "self_", ",_", "repo_", ",_", "files_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "cd_", "(_", "repo_", "._", "rootdir_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "=_", "self_", "._", "\\u", "run_", "(_", "[_", "\"", "add", "\"_", "]_", "+_", "files_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Git", "Rep", "o", "Manager_", "(_", "Rep", "o", "Manager", "Base_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "add", "\\u", "files_", "(_", "self_", ",_", "repo_", ",_", "files_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Add", " ", "files", " ", "to", " ", "the", " ", "repo", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rootdir_", "=_", "repo_", "._", "rootdir_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "f_", "in_", "files_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "relative", "path_", "=_", "f_", "[_", "'", "relative", "path", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "source", "path_", "=_", "f_", "[_", "'", "localf", "ull", "path", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "source", "path_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Thi", "s", " ", "can", " ", "happ", "en", " ", "if", " ", "the", " ", "relative", " ", "path", " ", "is", " ", "a", " ", "URL_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "continue_", "#", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Prepare", " ", "the", " ", "target", " ", "path_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "target", "path_", "=_", "os_", "._", "path_", "._", "join_", "(_", "rootdir_", ",_", "relative", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "os_", "._", "makedirs_", "(_", "os_", "._", "path_", "._", "dirname_", "(_", "target", "path_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "print", "(", "source", "path", ",\"", " ", "=>", " ", "\",", " ", "target", "path", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "print_", "(_", "\"", "Up", "dati", "ng", ":", " ", "{}\"_", "._", "format_", "(_", "relative", "path_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "shutil_", "._", "copyfile_", "(_", "source", "path_", ",_", "target", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "cd_", "(_", "repo_", "._", "rootdir_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "run_", "(_", "[_", "'", "add", "'_", ",_", "relative", "path_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Git", "Rep", "o", "Manager_", "(_", "Rep", "o", "Manager", "Base_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "config_", "(_", "self_", ",_", "what_", "=_", "'", "get", "'_", ",_", "params_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Param", "ers", ":", "\\", "10", ";", " ", " ", " ", " ", "---------", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "works", "pace", ":", " ", "Director", "y", " ", "to", " ", "store", " ", "the", " ", "dataset", " ", "repos", "itori", "es", "\\", "10", ";", " ", " ", " ", " ", "email", ":", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "what_", "==_", "'", "get", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "name", "'_", ":_", "'", "git", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "natur", "e", "'_", ":_", "'", "repo", "manage", "r", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "variab", "les", "'_", ":_", "[_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "what_", "==_", "'", "set", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "workspace_", "=_", "params_", "[_", "'", "Local", "'_", "]_", "[_", "'", "works", "pace", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "workspace_", "=_", "os_", "._", "path_", "._", "abspath_", "(_", "self_", "._", "workspace_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "username_", "=_", "params_", "[_", "'", "User", "'_", "]_", "[_", "'", "user", ".", "name", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "fullname_", "=_", "params_", "[_", "'", "User", "'_", "]_", "[_", "'", "user", ".", "full", "name", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "email_", "=_", "params_", "[_", "'", "User", "'_", "]_", "[_", "'", "user", ".", "email", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "repo", "dir_", "=_", "os_", "._", "path_", "._", "join_", "(_", "self_", "._", "workspace_", ",_", "'", "dataset", "s", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "os_", "._", "path_", "._", "exists_", "(_", "repo", "dir_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "username_", "in_", "os_", "._", "listdir_", "(_", "repo", "dir_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "repon", "ame_", "in_", "os_", "._", "listdir_", "(_", "os_", "._", "path_", "._", "join_", "(_", "repo", "dir_", ",_", "username_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "self_", "._", "is", "\\u", "my", "\\u", "repo_", "(_", "username_", ",_", "repon", "ame_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "r_", "=_", "Repo_", "(_", "username_", ",_", "repon", "ame_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "r_", "._", "rootdir_", "=_", "os_", "._", "path_", "._", "join_", "(_", "repo", "dir_", ",_", "username_", ",_", "repon", "ame_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "package_", "=_", "os_", "._", "path_", "._", "join_", "(_", "r_", "._", "rootdir_", ",_", "'", "datap", "ack", "age", ".", "json", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "os_", "._", "path_", "._", "exists_", "(_", "package_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "print_", "(_", "\"", "datap", "ack", "age", ".", "json", " ", "doe", "s", " ", "not", " ", "exist", " ", "in", " ", "dataset", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "\"", "Ski", "ppi", "ng", ":", " ", "{}/{}", "\"_", "._", "format_", "(_", "username_", ",_", "repon", "ame_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "package", "data_", "=_", "open_", "(_", "package_", ")_", "._", "read_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "r_", "._", "package_", "=_", "json_", "._", "JSO", "ND", "ecode", "r_", "(_", "object\\u", "pair", "s", "\\u", "hook_", "=_", "collections_", "._", "Order", "ed", "Dict_", ")_", "._", "decode_", "(_", "package", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "r_", "._", "manager_", "=_", "self_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "add_", "(_", "r_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "setup_", "(_", "mgr_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "obj_", "=_", "Git", "Rep", "o", "Manager_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mgr_", "._", "register_", "(_", "'", "repo", "manage", "r", "'_", ",_", "obj_", ")_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
ProgVal/Limnoria/plugins/BadWords/config.py
[ { "content": "###\n# Copyright (c) 2005, Jeremiah Fincher\n# All rights reserved.\n#\n# Redistribution and use in source and binary forms, with or without\n# modification, are permitted provided that the following conditions are met:\n#\n# * Redistributions of source code must retain the above copyright notice,\n# this list of conditions, and the following disclaimer.\n# * Redistributions in binary form must reproduce the above copyright notice,\n# this list of conditions, and the following disclaimer in the\n# documentation and/or other materials provided with the distribution.\n# * Neither the name of the author of this software nor the name of\n# contributors to this software may be used to endorse or promote products\n# derived from this software without specific prior written consent.\n#\n# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\"\n# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE\n# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR\n# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF\n# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\n# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN\n# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n# POSSIBILITY OF SUCH DAMAGE.\n###\n\nfrom __future__ import division\n\nimport time\n\nimport supybot.conf as conf\nimport supybot.registry as registry\nfrom supybot.i18n import PluginInternationalization, internationalizeDocstring\n_ = PluginInternationalization('BadWords')\n\n\n\nBadWords = conf.registerPlugin('BadWords')\nconf.registerGlobalValue(BadWords, 'words',\n LastModifiedSetOfStrings([], _(\"\"\"Determines what words are\n considered to be 'bad' so the bot won't say them.\"\"\")))\nconf.registerChannelValue(BadWords,'requireWordBoundaries',\n registry.Boolean(False, _(\"\"\"Determines whether the bot will require bad\n words to be independent words, or whether it will censor them within other\n words. For instance, if 'darn' is a bad word, then if this is true, 'darn'\n will be censored, but 'darnit' will not. You probably want this to be\n false. After changing this setting, the BadWords regexp needs to be\n regenerated by adding/removing a word to the list, or reloading the\n plugin.\"\"\")))\n\n\nconf.registerGlobalValue(BadWords, 'nastyChars',\n String256('!@#&', _(\"\"\"Determines what characters will replace bad words; a\n chunk of these characters matching the size of the replaced bad word will\n be used to replace the bad words you've configured.\"\"\")))\n\n\nconf.registerGlobalValue(BadWords, 'replaceMethod',\n ReplacementMethods('nastyCharacters', _(\"\"\"Determines the manner in which\n bad words will be replaced. 'nastyCharacters' (the default) will replace a\n bad word with the same number of 'nasty characters' (like those used in\n comic books; configurable by supybot.plugins.BadWords.nastyChars).\n 'simple' will replace a bad word with a simple strings (regardless of the\n length of the bad word); this string is configurable via\n supybot.plugins.BadWords.simpleReplacement.\"\"\")))\nconf.registerGlobalValue(BadWords,'simpleReplacement',\n registry.String('[CENSORED]', _(\"\"\"Determines what word will replace bad\n words if the replacement method is 'simple'.\"\"\")))\nconf.registerGlobalValue(BadWords, 'stripFormatting',\n registry.Boolean(True, _(\"\"\"Determines whether the bot will strip\n formatting characters from messages before it checks them for bad words.\n If this is False, it will be relatively trivial to circumvent this plugin's\n filtering. If it's True, however, it will interact poorly with other\n plugins that do coloring or bolding of text.\"\"\")))\n\nconf.registerChannelValue(BadWords, 'kick',\n registry.Boolean(False, _(\"\"\"Determines whether the bot will kick people with\n a warning when they use bad words.\"\"\")))\nconf.registerChannelValue(BadWords.kick, 'message',\n registry.NormalizedString(_(\"\"\"You have been kicked for using a word\n prohibited in the presence of this bot. Please use more appropriate\n language in the future.\"\"\"), _(\"\"\"Determines the kick message used by the\n bot when kicking users for saying bad words.\"\"\")))\n\n\n# vim:set shiftwidth=4 softtabstop=4 expandtab textwidth=79:\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def configure(advanced):\n from supybot.questions import output, expect, anything, something, yn\n conf.registerPlugin('BadWords', True)\n if yn(_('Would you like to add some bad words?')):\n words = anything(_('What words? (separate individual words by '\n 'spaces)'))\n conf.supybot.plugins.BadWords.words.set(words)", "metadata": "root.configure", "header": "['module', '___EOS___']", "index": 38 }, { "content": "class LastModifiedSetOfStrings(registry.SpaceSeparatedSetOfStrings):\n lastModified = 0", "metadata": "root.LastModifiedSetOfStrings", "header": "['module', '___EOS___']", "index": 46 }, { "content": " def setValue(self, v):\n self.lastModified = time.time()\n registry.SpaceSeparatedListOfStrings.setValue(self, v)", "metadata": "root.LastModifiedSetOfStrings.setValue", "header": "['class', 'LastModifiedSetOfStrings', '(', 'registry', '.', 'SpaceSeparatedSetOfStrings', ')', ':', '___EOS___']", "index": 48 }, { "content": "class String256(registry.String):\n", "metadata": "root.String256", "header": "['module', '___EOS___']", "index": 65 }, { "content": " def __call__(self):\n s = registry.String.__call__(self)\n return s * (1024//len(s))", "metadata": "root.String256.__call__", "header": "['class', 'String256', '(', 'registry', '.', 'String', ')', ':', '___EOS___']", "index": 66 }, { "content": " def __str__(self):\n return self.value", "metadata": "root.String256.__str__", "header": "['class', 'String256', '(', 'registry', '.', 'String', ')', ':', '___EOS___']", "index": 70 }, { "content": "class ReplacementMethods(registry.OnlySomeStrings):\n validStrings = ('simple', 'nastyCharacters')", "metadata": "root.ReplacementMethods", "header": "['module', '___EOS___']", "index": 78 } ]
[ { "span": "from supybot.i18n import PluginInternationalization, internationalizeDocstring", "start_line": 35, "start_column": 0, "end_line": 35, "end_column": 78 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "###", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Copy", "right", " ", "(", "c", ")", " ", "2005", ",", " ", "Jer", "emi", "ah", " ", "Fin", "cher", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "All", " ", "rights", " ", "reserve", "d", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Redistributi", "on", " ", "and", " ", "use", " ", "in", " ", "source", " ", "and", " ", "binar", "y", " ", "forms", ",", " ", "with", " ", "or", " ", "with", "out_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "modification", ",", " ", "are", " ", "permit", "ted", " ", "provided", " ", "tha", "t", " ", "the", " ", "follow", "ing", " ", "condition", "s", " ", "are", " ", "met", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "*", " ", "Redistributi", "ons", " ", "of", " ", "source", " ", "code", " ", "must", " ", "retain", " ", "the", " ", "above", " ", "copyr", "ight", " ", "notice", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "this", " ", "list", " ", "of", " ", "condition", "s", ",", " ", "and", " ", "the", " ", "follow", "ing", " ", "discl", "aime", "r", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "*", " ", "Redistributi", "ons", " ", "in", " ", "binar", "y", " ", "form", " ", "must", " ", "reproduce", " ", "the", " ", "above", " ", "copyr", "ight", " ", "notice", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "this", " ", "list", " ", "of", " ", "condition", "s", ",", " ", "and", " ", "the", " ", "follow", "ing", " ", "discl", "aime", "r", " ", "in", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "documentation", " ", "and", "/", "or", " ", "other", " ", "material", "s", " ", "provided", " ", "with", " ", "the", " ", "distribu", "tion", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "*", " ", "Nei", "ther", " ", "the", " ", "name", " ", "of", " ", "the", " ", "author", " ", "of", " ", "this", " ", "software", " ", "nor", " ", "the", " ", "name", " ", "of_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "contributor", "s", " ", "to", " ", "this", " ", "software", " ", "may", " ", "be", " ", "used", " ", "to", " ", "endo", "rse", " ", "or", " ", "promote", " ", "products_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "derive", "d", " ", "from", " ", "this", " ", "software", " ", "with", "out", " ", "specific", " ", "prior", " ", "writt", "en", " ", "consent", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "THIS", " ", "SOFT", "WARE", " ", "IS", " ", "PROVI", "DED", " ", "BY", " ", "THE", " ", "COPY", "RIG", "HT", " ", "HOLD", "ERS", " ", "AND", " ", "CONTRIB", "UTO", "RS", " ", "\"", "AS", " ", "IS", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "AND", " ", "ANY", " ", "EXPR", "ESS", " ", "OR", " ", "IMPL", "IED", " ", "WAR", "RAN", "TIES", ",", " ", "INC", "LU", "DING", ",", " ", "BUT", " ", "NOT", " ", "LIMIT", "ED", " ", "TO", ",", " ", "THE", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "IMPL", "IED", " ", "WAR", "RAN", "TIES", " ", "OF", " ", "MER", "CHAN", "TAB", "ILI", "TY", " ", "AND", " ", "FIT", "NESS", " ", "FOR", " ", "A", " ", "PARTI", "CUL", "AR", " ", "PUR", "POS", "E_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "ARE", " ", "DISC", "LAI", "MED", ".", " ", " ", "IN", " ", "NO", " ", "EVENT", " ", "SHA", "LL", " ", "THE", " ", "COPY", "RIG", "HT", " ", "OWNER", " ", "OR", " ", "CONTRIB", "UTO", "RS", " ", "BE_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "LI", "AB", "LE", " ", "FOR", " ", "ANY", " ", "DIRECT", ",", " ", "INDI", "RECT", ",", " ", "INC", "IDENT", "AL", ",", " ", "SPECIAL", ",", " ", "EXE", "MPL", "ARY", ",", " ", "OR_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "CONS", "EQU", "ENTI", "AL", " ", "DA", "MAGE", "S", " ", "(", "INC", "LU", "DING", ",", " ", "BUT", " ", "NOT", " ", "LIMIT", "ED", " ", "TO", ",", " ", "PROC", "URE", "MENT", " ", "OF_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "SUBST", "ITU", "TE", " ", "GOOD", "S", " ", "OR", " ", "SERVICES", ";", " ", "LOSS", " ", "OF", " ", "USE", ",", " ", "DATA", ",", " ", "OR", " ", "PROF", "IT", "S", ";", " ", "OR", " ", "BUS", "INE", "SS_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "INTER", "RU", "PTION", ")", " ", "HO", "WE", "VER", " ", "CAU", "SED", " ", "AND", " ", "ON", " ", "ANY", " ", "THE", "ORY", " ", "OF", " ", "LI", "ABI", "LIT", "Y", ",", " ", "WHE", "THER", " ", "IN_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "CONTR", "ACT", ",", " ", "STRI", "CT", " ", "LI", "ABI", "LIT", "Y", ",", " ", "OR", " ", "TOR", "T", " ", "(", "INC", "LU", "DING", " ", "NEG", "LIG", "ENCE", " ", "OR", " ", "OTHER", "WI", "SE", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "ARI", "SIN", "G", " ", "IN", " ", "ANY", " ", "WAY", " ", "OUT", " ", "OF", " ", "THE", " ", "USE", " ", "OF", " ", "THIS", " ", "SOFT", "WARE", ",", " ", "EVE", "N", " ", "IF", " ", "ADV", "ISE", "D", " ", "OF", " ", "THE", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "POS", "SIB", "ILI", "TY", " ", "OF", " ", "SUC", "H", " ", "DA", "MAGE", "._", "\\u\\u\\uNL\\u\\u\\u_", "###", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "\\u\\u", "future\\u\\u_", "import_", "division_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "time_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "sup", "ybo", "t_", "._", "conf_", "as_", "conf_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "sup", "ybo", "t_", "._", "registry_", "as_", "registry_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "sup", "ybo", "t_", "._", "i18n_", "import_", "Plug", "in", "Intern", "ation", "ali", "zation_", ",_", "international", "ize", "Docs", "tring_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u_", "=_", "Plug", "in", "Intern", "ation", "ali", "zation_", "(_", "'", "Ba", "d", "Word", "s", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "Ba", "d", "Words_", "=_", "conf_", "._", "register", "Plugin_", "(_", "'", "Ba", "d", "Word", "s", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "conf_", "._", "register", "Global", "Value_", "(_", "Ba", "d", "Words_", ",_", "'", "words", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Las", "t", "Modifie", "d", "Set", "Of", "Strings_", "(_", "[_", "]_", ",_", "\\u_", "(_", "\"\"\"", "Det", "erm", "ine", "s", " ", "what", " ", "words", " ", "are", "\\", "10", ";", " ", " ", " ", " ", "consider", "ed", " ", "to", " ", "be", " ", "'", "bad", "'", " ", "so", " ", "the", " ", "bot", " ", "won", "'", "t", " ", "say", " ", "them", ".\"\"\"_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "conf_", "._", "register", "Chan", "nel", "Value_", "(_", "Ba", "d", "Words_", ",_", "'", "require", "Word", "Boundar", "ies", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "registry_", "._", "Boolean_", "(_", "False_", ",_", "\\u_", "(_", "\"\"\"", "Det", "erm", "ine", "s", " ", "whe", "ther", " ", "the", " ", "bot", " ", "will", " ", "require", " ", "bad", "\\", "10", ";", " ", " ", " ", " ", "words", " ", "to", " ", "be", " ", "independent", " ", "words", ",", " ", "or", " ", "whe", "ther", " ", "it", " ", "will", " ", "cens", "or", " ", "them", " ", "within", " ", "other", "\\", "10", ";", " ", " ", " ", " ", "words", ".", " ", " ", "For", " ", "instance", ",", " ", "if", " ", "'", "dar", "n", "'", " ", "is", " ", "a", " ", "bad", " ", "word", ",", " ", "then", " ", "if", " ", "this", " ", "is", " ", "true", ",", " ", "'", "dar", "n", "'", "\\", "10", ";", " ", " ", " ", " ", "will", " ", "be", " ", "cens", "ored", ",", " ", "but", " ", "'", "dar", "nit", "'", " ", "will", " ", "not", ".", " ", " ", "You", " ", "probab", "ly", " ", "want", " ", "this", " ", "to", " ", "be", "\\", "10", ";", " ", " ", " ", " ", "fal", "se", ".", " ", "Af", "ter", " ", "chang", "ing", " ", "this", " ", "setti", "ng", ",", " ", "the", " ", "Ba", "d", "Word", "s", " ", "regexp", " ", "need", "s", " ", "to", " ", "be", "\\", "10", ";", " ", " ", " ", " ", "regenerate", "d", " ", "by", " ", "addin", "g", "/", "remo", "ving", " ", "a", " ", "word", " ", "to", " ", "the", " ", "list", ",", " ", "or", " ", "relo", "ading", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "plugin", ".\"\"\"_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "conf_", "._", "register", "Global", "Value_", "(_", "Ba", "d", "Words_", ",_", "'", "nas", "ty", "Char", "s", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "String", "256_", "(_", "'!", "@#", "&'_", ",_", "\\u_", "(_", "\"\"\"", "Det", "erm", "ine", "s", " ", "what", " ", "character", "s", " ", "will", " ", "replace", " ", "bad", " ", "words", ";", " ", "a", "\\", "10", ";", " ", " ", " ", " ", "chunk", " ", "of", " ", "these", " ", "character", "s", " ", "matchi", "ng", " ", "the", " ", "size", " ", "of", " ", "the", " ", "replaced", " ", "bad", " ", "word", " ", "will", "\\", "10", ";", " ", " ", " ", " ", "be", " ", "used", " ", "to", " ", "replace", " ", "the", " ", "bad", " ", "words", " ", "you", "'", "ve", " ", "configur", "ed", ".\"\"\"_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "conf_", "._", "register", "Global", "Value_", "(_", "Ba", "d", "Words_", ",_", "'", "replace", "Meth", "od", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Replace", "ment", "Methods_", "(_", "'", "nas", "ty", "Characters", "'_", ",_", "\\u_", "(_", "\"\"\"", "Det", "erm", "ine", "s", " ", "the", " ", "manner", " ", "in", " ", "whi", "ch", "\\", "10", ";", " ", " ", " ", " ", "bad", " ", "words", " ", "will", " ", "be", " ", "replaced", ".", " ", " ", "'", "nas", "ty", "Characters", "'", " ", "(", "the", " ", "default", ")", " ", "will", " ", "replace", " ", "a", "\\", "10", ";", " ", " ", " ", " ", "bad", " ", "word", " ", "with", " ", "the", " ", "same", " ", "number", " ", "of", " ", "'", "nas", "ty", " ", "character", "s", "'", " ", "(", "like", " ", "tho", "se", " ", "used", " ", "in", "\\", "10", ";", " ", " ", " ", " ", "comic", " ", "books", ";", " ", "configurable", " ", "by", " ", "sup", "ybo", "t", ".", "plugin", "s", ".", "Ba", "d", "Word", "s", ".", "nas", "ty", "Char", "s", ").", "\\", "10", ";", " ", " ", " ", " ", "'", "simple", "'", " ", "will", " ", "replace", " ", "a", " ", "bad", " ", "word", " ", "with", " ", "a", " ", "simple", " ", "string", "s", " ", "(", "rega", "rd", "less", " ", "of", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "length", " ", "of", " ", "the", " ", "bad", " ", "word", ");", " ", "this", " ", "string", " ", "is", " ", "configurable", " ", "via", "\\", "10", ";", " ", " ", " ", " ", "sup", "ybo", "t", ".", "plugin", "s", ".", "Ba", "d", "Word", "s", ".", "simple", "Replace", "ment", ".\"\"\"_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "conf_", "._", "register", "Global", "Value_", "(_", "Ba", "d", "Words_", ",_", "'", "simple", "Replace", "ment", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "registry_", "._", "String_", "(_", "'[", "CEN", "SOR", "ED", "]'_", ",_", "\\u_", "(_", "\"\"\"", "Det", "erm", "ine", "s", " ", "what", " ", "word", " ", "will", " ", "replace", " ", "bad", "\\", "10", ";", " ", " ", " ", " ", "words", " ", "if", " ", "the", " ", "replace", "ment", " ", "method", " ", "is", " ", "'", "simple", "'.", "\"\"\"_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "conf_", "._", "register", "Global", "Value_", "(_", "Ba", "d", "Words_", ",_", "'", "strip", "Formatt", "ing", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "registry_", "._", "Boolean_", "(_", "True_", ",_", "\\u_", "(_", "\"\"\"", "Det", "erm", "ine", "s", " ", "whe", "ther", " ", "the", " ", "bot", " ", "will", " ", "strip", "\\", "10", ";", " ", " ", " ", " ", "format", "ting", " ", "character", "s", " ", "from", " ", "message", "s", " ", "bef", "ore", " ", "it", " ", "checks", " ", "them", " ", "for", " ", "bad", " ", "words", ".", "\\", "10", ";", " ", " ", " ", " ", "If", " ", "this", " ", "is", " ", "Fal", "se", ",", " ", "it", " ", "will", " ", "be", " ", "relative", "ly", " ", "trivial", " ", "to", " ", "circum", "vent", " ", "this", " ", "plugin", "'", "s", "\\", "10", ";", " ", " ", " ", " ", "filtering", ".", " ", " ", "If", " ", "it", "'", "s", " ", "Tru", "e", ",", " ", "how", "ever", ",", " ", "it", " ", "will", " ", "interact", " ", "poo", "rl", "y", " ", "with", " ", "other", "\\", "10", ";", " ", " ", " ", " ", "plugin", "s", " ", "tha", "t", " ", "do", " ", "colori", "ng", " ", "or", " ", "bold", "ing", " ", "of", " ", "text", ".\"\"\"_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "conf_", "._", "register", "Chan", "nel", "Value_", "(_", "Ba", "d", "Words_", ",_", "'", "kick", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "registry_", "._", "Boolean_", "(_", "False_", ",_", "\\u_", "(_", "\"\"\"", "Det", "erm", "ine", "s", " ", "whe", "ther", " ", "the", " ", "bot", " ", "will", " ", "kick", " ", "people", " ", "with", "\\", "10", ";", " ", " ", " ", " ", "a", " ", "warn", "ing", " ", "whe", "n", " ", "the", "y", " ", "use", " ", "bad", " ", "words", ".\"\"\"_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "conf_", "._", "register", "Chan", "nel", "Value_", "(_", "Ba", "d", "Words_", "._", "kick", "_", ",_", "'", "message", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "registry_", "._", "Normalize", "d", "String_", "(_", "\\u_", "(_", "\"\"\"", "You", " ", "have", " ", "bee", "n", " ", "kick", "ed", " ", "for", " ", "usi", "ng", " ", "a", " ", "word", "\\", "10", ";", " ", " ", " ", " ", "pro", "hibit", "ed", " ", "in", " ", "the", " ", "presen", "ce", " ", "of", " ", "this", " ", "bot", ".", " ", " ", "Ple", "ase", " ", "use", " ", "more", " ", "appropr", "iate", "\\", "10", ";", " ", " ", " ", " ", "language", " ", "in", " ", "the", " ", "future", ".\"\"\"_", ")_", ",_", "\\u_", "(_", "\"\"\"", "Det", "erm", "ine", "s", " ", "the", " ", "kick", " ", "message", " ", "used", " ", "by", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "bot", " ", "whe", "n", " ", "kick", "ing", " ", "users", " ", "for", " ", "say", "ing", " ", "bad", " ", "words", ".\"\"\"_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "vim", ":", "set", " ", "shift", "widt", "h", "=", "4", " ", "soft", "tabs", "top", "=", "4", " ", "expand", "tab", " ", "text", "widt", "h", "=", "7", "9", ":_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "configure_", "(_", "advanced", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "sup", "ybo", "t_", "._", "questions_", "import_", "output_", ",_", "expect_", ",_", "anyt", "hing_", ",_", "something_", ",_", "yn_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "conf_", "._", "register", "Plugin_", "(_", "'", "Ba", "d", "Word", "s", "'_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "yn_", "(_", "\\u_", "(_", "'", "Wo", "ul", "d", " ", "you", " ", "like", " ", "to", " ", "add", " ", "some", " ", "bad", " ", "words", "?'_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "words_", "=_", "anyt", "hing_", "(_", "\\u_", "(_", "'", "What", " ", "words", "?", " ", "(", "separate", " ", "individual", " ", "words", " ", "by", " ", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'", "space", "s", ")'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "conf_", "._", "sup", "ybo", "t_", "._", "plugins_", "._", "Ba", "d", "Words_", "._", "words_", "._", "set_", "(_", "words_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Las", "t", "Modifie", "d", "Set", "Of", "Strings_", "(_", "registry_", "._", "Spac", "e", "Separate", "d", "Set", "Of", "Strings_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "last", "Modified_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Las", "t", "Modifie", "d", "Set", "Of", "Strings_", "(_", "registry_", "._", "Spac", "e", "Separate", "d", "Set", "Of", "Strings_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "set", "Value_", "(_", "self_", ",_", "v_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "last", "Modified_", "=_", "time_", "._", "time_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "registry_", "._", "Spac", "e", "Separate", "d", "List", "Of", "Strings_", "._", "set", "Value_", "(_", "self_", ",_", "v_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "String", "256_", "(_", "registry_", "._", "String_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "String", "256_", "(_", "registry_", "._", "String_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "\\u\\u", "call\\u\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "s_", "=_", "registry_", "._", "String_", "._", "\\u\\u", "call\\u\\u_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "s_", "*_", "(_", "1024_", "//_", "len_", "(_", "s_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "String", "256_", "(_", "registry_", "._", "String_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "str\\u\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Replace", "ment", "Methods_", "(_", "registry_", "._", "On", "ly", "Some", "Strings_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "valid", "Strings_", "=_", "(_", "'", "simple", "'_", ",_", "'", "nas", "ty", "Characters", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
viewfinderco/viewfinder/backend/base/test/statistics_test.py
[ { "content": "# Copyright 2012 Viewfinder Inc. All Rights Reserved.\n\n\"\"\"Statistics tests.\n\"\"\"\n\n__authors__ = ['[email protected] (Marc Berhault)']\n\nimport logging\ntry:\n import numpy\nexcept ImportError:\n numpy = None\nimport random\nimport unittest\n\nfrom viewfinder.backend.base import statistics, testing\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "@unittest.skipIf(numpy is None, 'numpy not present')\nclass FormatStatsTestCase(testing.BaseTestCase):\n\n\n\n", "metadata": "root.FormatStatsTestCase", "header": "['module', '___EOS___']", "index": 17 }, { "content": " def _RandomList(self):\n \"\"\" List of random integers (0-20) and of random size (10-20). \"\"\"\n l = []\n for i in range(random.randint(10, 20)):\n l.append(random.randint(0, 20))\n print 'list: %r' % l\n return l", "metadata": "root.FormatStatsTestCase._RandomList", "header": "['class', 'FormatStatsTestCase', '(', 'testing', '.', 'BaseTestCase', ')', ':', '___EOS___']", "index": 19 }, { "content": " def testEmpty(self):\n self.assertEqual(statistics.FormatStats([]), '')", "metadata": "root.FormatStatsTestCase.testEmpty", "header": "['class', 'FormatStatsTestCase', '(', 'testing', '.', 'BaseTestCase', ')', ':', '___EOS___']", "index": 27 }, { "content": " def testSimple(self):\n \"\"\" No indentation, no percentiles. \"\"\"\n a = self._RandomList()\n out_str = 'mean=%.2f\\nmedian=%.2f\\nstddev=%.2f' % \\\n (numpy.mean(a), numpy.median(a), numpy.std(a))\n self.assertEqual(statistics.FormatStats(a), out_str)", "metadata": "root.FormatStatsTestCase.testSimple", "header": "['class', 'FormatStatsTestCase', '(', 'testing', '.', 'BaseTestCase', ')', ':', '___EOS___']", "index": 30 }, { "content": " def testIndent(self):\n \"\"\" With indentation, no percentiles. \"\"\"\n a = self._RandomList()\n out_str = ' mean=%.2f\\n median=%.2f\\n stddev=%.2f' % \\\n (numpy.mean(a), numpy.median(a), numpy.std(a))\n self.assertEqual(statistics.FormatStats(a, indent=3), out_str)", "metadata": "root.FormatStatsTestCase.testIndent", "header": "['class', 'FormatStatsTestCase', '(', 'testing', '.', 'BaseTestCase', ')', ':', '___EOS___']", "index": 37 }, { "content": " def testPercentile(self):\n \"\"\" With indentation and percentiles. \"\"\"\n a = self._RandomList()\n p = [80, 90, 95, 99]\n out_str = ' mean=%.2f\\n median=%.2f\\n stddev=%.2f\\n' % \\\n (numpy.mean(a), numpy.median(a), numpy.std(a))\n out_str += ' 80/90/95/99 percentiles=%s' % numpy.percentile(a, p)\n self.assertEqual(statistics.FormatStats(a, percentiles=p, indent=3), out_str)", "metadata": "root.FormatStatsTestCase.testPercentile", "header": "['class', 'FormatStatsTestCase', '(', 'testing', '.', 'BaseTestCase', ')', ':', '___EOS___']", "index": 44 }, { "content": "@unittest.skipIf(numpy is None, 'numpy not present')\nclass HistogramTestCase(testing.BaseTestCase):\n\n", "metadata": "root.HistogramTestCase", "header": "['module', '___EOS___']", "index": 53 }, { "content": " def testEmpty(self):\n self.assertEqual(statistics.HistogramToASCII([]), '')", "metadata": "root.HistogramTestCase.testEmpty", "header": "['class', 'HistogramTestCase', '(', 'testing', '.', 'BaseTestCase', ')', ':', '___EOS___']", "index": 55 }, { "content": " def testSimple(self):\n a = [1, 1, 2, 4, 4]\n out_str = ' [1-2) 2 40.00% ########\\n'\n out_str += ' [2-3) 1 20.00% ####\\n'\n out_str += ' [3-4] 2 40.00% ########'\n self.assertEqual(statistics.HistogramToASCII(a, bins=3, indent=2, line_width=26), out_str)", "metadata": "root.HistogramTestCase.testSimple", "header": "['class', 'HistogramTestCase', '(', 'testing', '.', 'BaseTestCase', ')', ':', '___EOS___']", "index": 58 }, { "content": " def testRounding(self):\n \"\"\" Bucket limits can be floats, but we round everything for display. \"\"\"\n a = [1, 1, 2, 4, 4]\n out_str = ' [1-1) 2 40.00% ########\\n'\n out_str += ' [1-2) 1 20.00% ####\\n'\n out_str += ' [2-2) 0 0.00% \\n'\n out_str += ' [2-3) 0 0.00% \\n'\n out_str += ' [3-4] 2 40.00% ########'\n self.assertEqual(statistics.HistogramToASCII(a, bins=5, indent=2, line_width=26), out_str)", "metadata": "root.HistogramTestCase.testRounding", "header": "['class', 'HistogramTestCase', '(', 'testing', '.', 'BaseTestCase', ')', ':', '___EOS___']", "index": 65 } ]
[ { "span": "import logging", "start_line": 7, "start_column": 0, "end_line": 7, "end_column": 14 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "Copy", "right", " ", "2012", " ", "View", "finde", "r", " ", "Inc", ".", " ", "All", " ", "Rig", "hts", " ", "Reserve", "d", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\"\"\"", "Statistic", "s", " ", "tests", ".", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u", "authors\\u", "\\u_", "=_", "[_", "'", "marc", "@", "email", "scrub", "bed", ".", "com", " ", "(", "Marc", " ", "Ber", "hau", "lt", ")'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "logging_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "numpy_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Import", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "numpy_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "import_", "random_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "unittest_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "view", "finder_", "._", "backend_", "._", "base_", "import_", "statistics_", ",_", "testing_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "@_", "unittest_", "._", "skip", "If_", "(_", "numpy_", "is_", "None_", ",_", "'", "nump", "y", " ", "not", " ", "presen", "t", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "class_", "Format", "Stat", "s", "Test", "Case_", "(_", "testing_", "._", "Base", "Test", "Case_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Format", "Stat", "s", "Test", "Case_", "(_", "testing_", "._", "Base", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "\\u", "Random", "List_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "List", " ", "of", " ", "random", " ", "integ", "ers", " ", "(", "0", "-", "20", ")", " ", "and", " ", "of", " ", "random", " ", "size", " ", "(", "10", "-", "20", ").", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "l_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", "in_", "range_", "(_", "random_", "._", "randint_", "(_", "10_", ",_", "20_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "l_", "._", "append_", "(_", "random_", "._", "randint_", "(_", "0_", ",_", "20_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "print_", "'", "list", ":", " ", "%", "r", "'_", "%_", "l_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "l_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Format", "Stat", "s", "Test", "Case_", "(_", "testing_", "._", "Base", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Empty_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "Equal_", "(_", "statistics_", "._", "Format", "Stats_", "(_", "[_", "]_", ")_", ",_", "''_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Format", "Stat", "s", "Test", "Case_", "(_", "testing_", "._", "Base", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Simple_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "No", " ", "indent", "ation", ",", " ", "no", " ", "percentile", "s", ".", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "a_", "=_", "self_", "._", "\\u", "Random", "List_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "out", "\\u", "str_", "=_", "'", "mean", "=", "%", ".2", "f", "\\\\", "nme", "dian", "=", "%", ".2", "f", "\\\\", "nst", "dde", "v", "=", "%", ".2", "f", "'_", "%_", "(_", "numpy_", "._", "mean_", "(_", "a_", ")_", ",_", "numpy_", "._", "median_", "(_", "a_", ")_", ",_", "numpy_", "._", "std_", "(_", "a_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "statistics_", "._", "Format", "Stats_", "(_", "a_", ")_", ",_", "out", "\\u", "str_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Format", "Stat", "s", "Test", "Case_", "(_", "testing_", "._", "Base", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Indent_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "With", " ", "indent", "ation", ",", " ", "no", " ", "percentile", "s", ".", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "a_", "=_", "self_", "._", "\\u", "Random", "List_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "out", "\\u", "str_", "=_", "'", " ", " ", " ", "mean", "=", "%", ".2", "f", "\\\\", "n", " ", " ", " ", "median", "=", "%", ".2", "f", "\\\\", "n", " ", " ", " ", "stddev", "=", "%", ".2", "f", "'_", "%_", "(_", "numpy_", "._", "mean_", "(_", "a_", ")_", ",_", "numpy_", "._", "median_", "(_", "a_", ")_", ",_", "numpy_", "._", "std_", "(_", "a_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "statistics_", "._", "Format", "Stats_", "(_", "a_", ",_", "indent_", "=_", "3_", ")_", ",_", "out", "\\u", "str_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Format", "Stat", "s", "Test", "Case_", "(_", "testing_", "._", "Base", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Perce", "ntil", "e_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "With", " ", "indent", "ation", " ", "and", " ", "percentile", "s", ".", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "a_", "=_", "self_", "._", "\\u", "Random", "List_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "p_", "=_", "[_", "80_", ",_", "90_", ",_", "95_", ",_", "99_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "out", "\\u", "str_", "=_", "'", " ", " ", " ", "mean", "=", "%", ".2", "f", "\\\\", "n", " ", " ", " ", "median", "=", "%", ".2", "f", "\\\\", "n", " ", " ", " ", "stddev", "=", "%", ".2", "f", "\\\\", "n", "'_", "%_", "(_", "numpy_", "._", "mean_", "(_", "a_", ")_", ",_", "numpy_", "._", "median_", "(_", "a_", ")_", ",_", "numpy_", "._", "std_", "(_", "a_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "out", "\\u", "str_", "+=_", "'", " ", " ", " ", "80", "/", "90", "/", "9", "5", "/", "9", "9", " ", "percentile", "s", "=", "%", "s", "'_", "%_", "numpy_", "._", "percentile_", "(_", "a_", ",_", "p_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "statistics_", "._", "Format", "Stats_", "(_", "a_", ",_", "percentile", "s_", "=_", "p_", ",_", "indent_", "=_", "3_", ")_", ",_", "out", "\\u", "str_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "unittest_", "._", "skip", "If_", "(_", "numpy_", "is_", "None_", ",_", "'", "nump", "y", " ", "not", " ", "presen", "t", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "class_", "Histogram", "Test", "Case_", "(_", "testing_", "._", "Base", "Test", "Case_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Histogram", "Test", "Case_", "(_", "testing_", "._", "Base", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "test", "Empty_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "Equal_", "(_", "statistics_", "._", "Histogram", "To", "ASCII", "_", "(_", "[_", "]_", ")_", ",_", "''_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Histogram", "Test", "Case_", "(_", "testing_", "._", "Base", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Simple_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "a_", "=_", "[_", "1_", ",_", "1_", ",_", "2_", ",_", "4_", ",_", "4_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "out", "\\u", "str_", "=_", "'", " ", " ", "[", "1", "-", "2", ")", " ", "2", " ", "40.0", "0", "%", " ", "######", "##", "\\\\", "n", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "out", "\\u", "str_", "+=_", "'", " ", " ", "[", "2", "-", "3", ")", " ", "1", " ", "20.", "00", "%", " ", "###", "#", "\\\\", "n", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "out", "\\u", "str_", "+=_", "'", " ", " ", "[", "3", "-", "4", "]", " ", "2", " ", "40.0", "0", "%", " ", "######", "##", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "statistics_", "._", "Histogram", "To", "ASCII", "_", "(_", "a_", ",_", "bins_", "=_", "3_", ",_", "indent_", "=_", "2_", ",_", "line", "\\u", "width_", "=_", "26_", ")_", ",_", "out", "\\u", "str_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Histogram", "Test", "Case_", "(_", "testing_", "._", "Base", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Round", "ing_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "Buck", "et", " ", "limit", "s", " ", "can", " ", "be", " ", "float", "s", ",", " ", "but", " ", "we", " ", "round", " ", "every", "thing", " ", "for", " ", "display", ".", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "a_", "=_", "[_", "1_", ",_", "1_", ",_", "2_", ",_", "4_", ",_", "4_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "out", "\\u", "str_", "=_", "'", " ", " ", "[", "1", "-1", ")", " ", "2", " ", "40.0", "0", "%", " ", "######", "##", "\\\\", "n", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "out", "\\u", "str_", "+=_", "'", " ", " ", "[", "1", "-", "2", ")", " ", "1", " ", "20.", "00", "%", " ", "###", "#", "\\\\", "n", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "out", "\\u", "str_", "+=_", "'", " ", " ", "[", "2", "-", "2", ")", " ", "0", " ", " ", "0.", "00", "%", " ", "\\\\", "n", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "out", "\\u", "str_", "+=_", "'", " ", " ", "[", "2", "-", "3", ")", " ", "0", " ", " ", "0.", "00", "%", " ", "\\\\", "n", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "out", "\\u", "str_", "+=_", "'", " ", " ", "[", "3", "-", "4", "]", " ", "2", " ", "40.0", "0", "%", " ", "######", "##", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "statistics_", "._", "Histogram", "To", "ASCII", "_", "(_", "a_", ",_", "bins_", "=_", "5_", ",_", "indent_", "=_", "2_", ",_", "line", "\\u", "width_", "=_", "26_", ")_", ",_", "out", "\\u", "str_", ")_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Implicit string concatenation in a list
ODM2/ODMToolsPython/odmtools/lib/ObjectListView/__init__.py
[ { "content": "# -*- coding: utf-8 -*-\n#----------------------------------------------------------------------------\n# Name: ObjectListView module initialization\n# Author: Phillip Piper\n# Created: 29 February 2008\n# SVN-ID: $Id$\n# Copyright: (c) 2008 by Phillip Piper\n# License: wxWindows license\n#----------------------------------------------------------------------------\n# Change log:\n# 2008/08/02 JPP Added list printing material\n# 2008/07/24 JPP Added list group related material\n# 2008/06/19 JPP Added sort event related material\n# 2008/04/11 JPP Initial Version\n\n\"\"\"\nAn ObjectListView provides a more convienent and powerful interface to a ListCtrl.\n\"\"\"\n\n__version__ = '1.2'\n__copyright__ = \"Copyright (c) 2008 Phillip Piper ([email protected])\"\n\nfrom ObjectListView import ObjectListView, VirtualObjectListView, ColumnDefn, FastObjectListView, GroupListView, ListGroup, BatchedUpdate\nfrom OLVEvent import CellEditFinishedEvent, CellEditFinishingEvent, CellEditStartedEvent, CellEditStartingEvent, SortEvent\nfrom OLVEvent import EVT_CELL_EDIT_STARTING, EVT_CELL_EDIT_STARTED, EVT_CELL_EDIT_FINISHING, EVT_CELL_EDIT_FINISHED, EVT_SORT\nfrom OLVEvent import EVT_COLLAPSING, EVT_COLLAPSED, EVT_EXPANDING, EVT_EXPANDED, EVT_GROUP_CREATING, EVT_GROUP_SORT\nfrom CellEditor import CellEditorRegistry, MakeAutoCompleteTextBox, MakeAutoCompleteComboBox\nfrom ListCtrlPrinter import ListCtrlPrinter, ReportFormat, BlockFormat, LineDecoration, RectangleDecoration, ImageDecoration\n\nimport Filter\n__all__ = [\n \"BatchedUpdate\",\n \"BlockFormat\",\n \"CellEditFinishedEvent\",\n \"CellEditFinishingEvent\",\n \"CellEditorRegistry\",\n \"CellEditStartedEvent\",\n \"CellEditStartingEvent\",\n \"ColumnDefn\",\n \"EVT_CELL_EDIT_FINISHED\",\n \"EVT_CELL_EDIT_FINISHING\",\n \"EVT_CELL_EDIT_STARTED\",\n \"EVT_CELL_EDIT_STARTING\",\n \"EVT_COLLAPSED\",\n \"EVT_COLLAPSING\",\n \"EVT_EXPANDED\",\n \"EVT_EXPANDING\",\n \"EVT_GROUP_CREATING\",\n \"EVT_GROUP_SORT\"\n \"EVT_SORT\",\n \"Filter\",\n \"FastObjectListView\",\n \"GroupListView\",\n \"ListGroup\",\n \"ImageDecoration\",\n \"MakeAutoCompleteTextBox\",\n \"MakeAutoCompleteComboBox\",\n \"ListGroup\",\n \"ObjectListView\",\n \"ListCtrlPrinter\",\n \"RectangleDecoration\",\n \"ReportFormat\",\n \"SortEvent\",\n \"VirtualObjectListView\",\n]\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[ { "span": "\"EVT_GROUP_SORT\"\n \"EVT_SORT\",", "start_line": 48, "start_column": 4, "end_line": 49, "end_column": 14 } ]
[]
1
true
[ "[CLS]_", "Implicit", "_", "string_", "concate", "nation_", "in_", "a_", "list_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "-*-", " ", "codi", "ng", ":", " ", "utf", "-", "8", " ", "-*-", "_", "\\u\\u\\uNL\\u\\u\\u_", "#-", "--------------", "--------------", "--------------", "--------------", "--------------", "-----", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Name", ":", " ", " ", " ", " ", " ", "Object", "List", "View", " ", "module", " ", "initialization", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Author", ":", " ", " ", " ", "Phil", "lip", " ", "Pipe", "r_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Creat", "ed", ":", " ", " ", "2", "9", " ", "Fe", "bru", "ary", " ", "2008_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "SV", "N", "-", "ID", ":", " ", " ", " ", "$", "Id", "$", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Copy", "right", ":", " ", " ", " ", " ", "(", "c", ")", " ", "2008", " ", "by", " ", "Phil", "lip", " ", "Pipe", "r_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "License", ":", " ", " ", "wx", "Window", "s", " ", "license_", "\\u\\u\\uNL\\u\\u\\u_", "#-", "--------------", "--------------", "--------------", "--------------", "--------------", "-----", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Change", " ", "log", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "2008", "/", "0", "8", "/", "02", " ", " ", "JP", "P", " ", " ", " ", "Added", " ", "list", " ", "printin", "g", " ", "material_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "2008", "/", "0", "7", "/", "24", " ", " ", "JP", "P", " ", " ", " ", "Added", " ", "list", " ", "group", " ", "relate", "d", " ", "material_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "2008", "/", "0", "6", "/", "1", "9", " ", " ", "JP", "P", " ", " ", " ", "Added", " ", "sort", " ", "event", " ", "relate", "d", " ", "material_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "2008", "/", "04", "/", "11", " ", " ", "JP", "P", " ", " ", " ", "Initial", " ", "Version_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\"\"\"", "\\", "10", ";", "An", " ", "Object", "List", "View", " ", "provide", "s", " ", "a", " ", "more", " ", "conv", "ien", "ent", " ", "and", " ", "power", "ful", " ", "interface", " ", "to", " ", "a", " ", "List", "Ctrl", ".", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u", "version\\u\\u_", "=_", "'", "1.2", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u", "copyright\\u\\u_", "=_", "\"", "Copy", "right", " ", "(", "c", ")", " ", "2008", " ", "Phil", "lip", " ", "Pipe", "r", " ", "(", "phil", "lip", "\\u", "pipe", "r", "@", "big", "foot", ".", "com", ")\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "Object", "List", "View_", "import_", "Object", "List", "View_", ",_", "Virt", "ual", "Object", "List", "View_", ",_", "Colum", "n", "Defn_", ",_", "Fast", "Object", "List", "View_", ",_", "Group", "List", "View_", ",_", "List", "Group_", ",_", "Bat", "ched", "Update_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "OL", "VE", "vent_", "import_", "Cel", "l", "Edit", "Finish", "ed", "Event_", ",_", "Cel", "l", "Edit", "Finish", "ing", "Event_", ",_", "Cel", "l", "Edit", "Start", "ed", "Event_", ",_", "Cel", "l", "Edit", "Start", "ing", "Event_", ",_", "Sort", "Event_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "OL", "VE", "vent_", "import_", "EV", "T", "\\u", "CELL", "\\u", "EDIT", "\\u", "START", "ING_", ",_", "EV", "T", "\\u", "CELL", "\\u", "EDIT", "\\u", "STARTED_", ",_", "EV", "T", "\\u", "CELL", "\\u", "EDIT", "\\u", "FINISH", "ING_", ",_", "EV", "T", "\\u", "CELL", "\\u", "EDIT", "\\u", "FINISH", "ED_", ",_", "EV", "T", "\\u", "SORT", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "OL", "VE", "vent_", "import_", "EV", "T", "\\u", "COLL", "APS", "ING_", ",_", "EV", "T", "\\u", "COLL", "APS", "ED_", ",_", "EV", "T", "\\u", "EXPAN", "DING", "_", ",_", "EV", "T", "\\u", "EXPAN", "DED", "_", ",_", "EV", "T", "\\u", "GROU", "P", "\\u", "CREATI", "NG_", ",_", "EV", "T", "\\u", "GROU", "P", "\\u", "SORT", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "Cel", "l", "Editor_", "import_", "Cel", "l", "Edit", "or", "Registry_", ",_", "Make", "Auto", "Complete", "Text", "Box_", ",_", "Make", "Auto", "Complete", "Comb", "o", "Box_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "List", "Ctrl", "Printer_", "import_", "List", "Ctrl", "Printer_", ",_", "Report", "Format_", ",_", "Block", "Format_", ",_", "Line", "Decorat", "ion_", ",_", "Rect", "angle", "Decorat", "ion_", ",_", "Image", "Decorat", "ion_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "Filter_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u", "all\\u\\u_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Bat", "ched", "Update", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Block", "Format", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Cel", "l", "Edit", "Finish", "ed", "Event", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Cel", "l", "Edit", "Finish", "ing", "Event", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Cel", "l", "Edit", "or", "Regi", "stry", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Cel", "l", "Edit", "Start", "ed", "Event", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Cel", "l", "Edit", "Start", "ing", "Event", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Colum", "n", "Def", "n", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "EV", "T", "\\u", "CELL", "\\u", "EDIT", "\\u", "FINISH", "ED", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "EV", "T", "\\u", "CELL", "\\u", "EDIT", "\\u", "FINISH", "ING", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "EV", "T", "\\u", "CELL", "\\u", "EDIT", "\\u", "START", "ED", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "EV", "T", "\\u", "CELL", "\\u", "EDIT", "\\u", "START", "ING", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "EV", "T", "\\u", "COLL", "APS", "ED", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "EV", "T", "\\u", "COLL", "APS", "ING", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "EV", "T", "\\u", "EXPAN", "DED", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "EV", "T", "\\u", "EXPAN", "DING", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "EV", "T", "\\u", "GROU", "P", "\\u", "CREATI", "NG", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "EV", "T", "\\u", "GROU", "P", "\\u", "SORT", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "EV", "T", "\\u", "SORT", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Filter", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Fast", "Object", "List", "View", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Group", "List", "View", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "List", "Group", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Image", "Decorat", "ion", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Make", "Auto", "Complete", "Text", "Box", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Make", "Auto", "Complete", "Comb", "o", "Box", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "List", "Group", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Object", "List", "View", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "List", "Ctrl", "Print", "er", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Rect", "angle", "Decorat", "ion", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Report", "Format", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Sort", "Event", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Virt", "ual", "Object", "List", "View", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_" ]
[ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Except block handles 'BaseException'
karesansui/karesansui/karesansui/gadget/guest.py
[ { "content": " @auth\n def _GET(self, *param, **params):\n host_id = self.chk_hostby1(param)\n if host_id is None: return web.notfound()\n\n model = findbyhost1(self.orm, host_id)\n uris = available_virt_uris()\n\n #import pdb; pdb.set_trace()\n if model.attribute == MACHINE_ATTRIBUTE[\"URI\"]:\n uri_guests = []\n uri_guests_status = {}\n uri_guests_kvg = {}\n uri_guests_info = {}\n uri_guests_name = {}\n segs = uri_split(model.hostname)\n uri = uri_join(segs, without_auth=True)\n creds = ''\n if segs[\"user\"] is not None:\n creds += segs[\"user\"]\n if segs[\"passwd\"] is not None:\n creds += ':' + segs[\"passwd\"]\n\n # Output .part\n if self.is_mode_input() is not True:\n try:\n self.kvc = KaresansuiVirtConnectionAuth(uri,creds)\n host = MergeHost(self.kvc, model)\n for guest in host.guests:\n\n _virt = self.kvc.search_kvg_guests(guest.info[\"model\"].name)\n if 0 < len(_virt):\n for _v in _virt:\n uuid = _v.get_info()[\"uuid\"]\n uri_guests_info[uuid] = guest.info\n uri_guests_kvg[uuid] = _v\n uri_guests_name[uuid] = guest.info[\"model\"].name.encode(\"utf8\")\n\n for name in sorted(uri_guests_name.values(),key=str.lower):\n for uuid in dict_search(name,uri_guests_name):\n uri_guests.append(MergeGuest(uri_guests_info[uuid][\"model\"], uri_guests_kvg[uuid]))\n uri_guests_status[uuid] = uri_guests_info[uuid]['virt'].status()\n\n finally:\n self.kvc.close()\n\n # .json\n if self.is_json() is True:\n guests_json = []\n for x in uri_guests:\n guests_json.append(x.get_json(self.me.languages))\n\n self.view.uri_guests = json_dumps(guests_json)\n else:\n self.view.uri_guests = uri_guests\n self.view.uri_guests_status = uri_guests_status\n\n self.kvc = KaresansuiVirtConnection()\n try: # libvirt connection scope -->\n\n # Storage Pool\n #inactive_pool = self.kvc.list_inactive_storage_pool()\n inactive_pool = []\n active_pool = self.kvc.list_active_storage_pool()\n pools = inactive_pool + active_pool\n pools.sort()\n\n if not pools:\n return web.badrequest('One can not start a storage pool.')\n\n # Output .input\n if self.is_mode_input() is True:\n self.view.pools = pools\n pools_info = {}\n pools_vols_info = {}\n pools_iscsi_blocks = {}\n already_vols = []\n guests = []\n\n guests += self.kvc.list_inactive_guest()\n guests += self.kvc.list_active_guest()\n for guest in guests:\n already_vol = self.kvc.get_storage_volume_bydomain(domain=guest,\n image_type=None,\n attr='path')\n if already_vol:\n already_vols += already_vol.keys()\n\n for pool in pools:\n pool_obj = self.kvc.search_kvn_storage_pools(pool)[0]\n if pool_obj.is_active() is True:\n pools_info[pool] = pool_obj.get_info()\n\n blocks = None\n if pools_info[pool]['type'] == 'iscsi':\n blocks = self.kvc.get_storage_volume_iscsi_block_bypool(pool)\n if blocks:\n pools_iscsi_blocks[pool] = []\n vols_obj = pool_obj.search_kvn_storage_volumes(self.kvc)\n vols_info = {}\n\n for vol_obj in vols_obj:\n vol_name = vol_obj.get_storage_volume_name()\n vols_info[vol_name] = vol_obj.get_info()\n if blocks:\n if vol_name in blocks and vol_name not in already_vols:\n pools_iscsi_blocks[pool].append(vol_obj.get_info())\n\n pools_vols_info[pool] = vols_info\n\n self.view.pools_info = pools_info\n self.view.pools_vols_info = pools_vols_info\n self.view.pools_iscsi_blocks = pools_iscsi_blocks\n\n bridge_prefix = {\n \"XEN\":\"xenbr\",\n \"KVM\":KVM_BRIDGE_PREFIX,\n }\n self.view.host_id = host_id\n self.view.DEFAULT_KEYMAP = DEFAULT_KEYMAP\n self.view.DISK_NON_QEMU_FORMAT = DISK_NON_QEMU_FORMAT\n self.view.DISK_QEMU_FORMAT = DISK_QEMU_FORMAT\n\n self.view.hypervisors = {}\n self.view.mac_address = {}\n self.view.keymaps = {}\n self.view.phydev = {}\n self.view.virnet = {}\n\n used_ports = {}\n\n for k,v in MACHINE_HYPERVISOR.iteritems():\n if k in available_virt_mechs():\n self.view.hypervisors[k] = v\n uri = uris[k]\n mem_info = self.kvc.get_mem_info()\n active_networks = self.kvc.list_active_network()\n used_graphics_ports = self.kvc.list_used_graphics_port()\n bus_types = self.kvc.bus_types\n self.view.bus_types = bus_types\n self.view.max_mem = mem_info['host_max_mem']\n self.view.free_mem = mem_info['host_free_mem']\n self.view.alloc_mem = mem_info['guest_alloc_mem']\n\n self.view.mac_address[k] = generate_mac_address(k)\n self.view.keymaps[k] = eval(\"get_keymaps(%s_KEYMAP_DIR)\" % k)\n\n # Physical device\n phydev = []\n phydev_regex = re.compile(r\"%s\" % bridge_prefix[k])\n for dev,dev_info in get_ifconfig_info().iteritems():\n try:\n if phydev_regex.match(dev):\n phydev.append(dev)\n except:\n pass\n if len(phydev) == 0:\n phydev.append(\"%s0\" % bridge_prefix[k])\n phydev.sort()\n self.view.phydev[k] = phydev # Physical device\n\n # Virtual device\n self.view.virnet[k] = sorted(active_networks)\n used_ports[k] = used_graphics_ports\n\n\n exclude_ports = []\n for k, _used_port in used_ports.iteritems():\n exclude_ports = exclude_ports + _used_port\n exclude_ports = sorted(exclude_ports)\n exclude_ports = [p for p, q in zip(exclude_ports, exclude_ports[1:] + [None]) if p != q]\n self.view.graphics_port = next_number(GRAPHICS_PORT_MIN_NUMBER,\n PORT_MAX_NUMBER,\n exclude_ports)\n\n else: # .part\n models = findbyhost1guestall(self.orm, host_id)\n guests = []\n if models:\n # Physical Guest Info\n self.view.hypervisors = {}\n for model in models:\n for k,v in MACHINE_HYPERVISOR.iteritems():\n if k in available_virt_mechs():\n self.view.hypervisors[k] = v\n uri = uris[k]\n if hasattr(self, \"kvc\") is not True:\n self.kvc = KaresansuiVirtConnection(uri)\n domname = self.kvc.uuid_to_domname(model.uniq_key)\n #if not domname: return web.conflict(web.ctx.path)\n _virt = self.kvc.search_kvg_guests(domname)\n if 0 < len(_virt):\n guests.append(MergeGuest(model, _virt[0]))\n else:\n guests.append(MergeGuest(model, None))\n\n # Exported Guest Info\n exports = {}\n for pool_name in pools:\n files = []\n\n pool = self.kvc.search_kvn_storage_pools(pool_name)\n path = pool[0].get_info()[\"target\"][\"path\"]\n\n if os.path.exists(path):\n for _afile in glob.glob(\"%s/*/info.dat\" % (path,)):\n param = ExportConfigParam()\n param.load_xml_config(_afile)\n\n _dir = os.path.dirname(_afile)\n\n uuid = param.get_uuid()\n name = param.get_domain()\n created = param.get_created()\n title = param.get_title()\n if title != \"\":\n title = re.sub(\"[\\r\\n]\",\"\",title)\n if title == \"\":\n title = _('untitled')\n\n if created != \"\":\n created_str = time.strftime(\"%Y/%m/%d %H:%M:%S\", \\\n time.localtime(float(created)))\n else:\n created_str = _(\"N/A\")\n\n files.append({\"dir\": _dir,\n \"pool\" : pool_name,\n #\"b64dir\" : base64_encode(_dir),\n \"uuid\" : uuid,\n \"name\" : name,\n \"created\" : int(created),\n \"created_str\" : created_str,\n \"title\" : title,\n \"icon\" : param.get_database()[\"icon\"],\n })\n\n exports[pool_name] = files\n\n # .json\n if self.is_json() is True:\n guests_json = []\n for x in guests:\n guests_json.append(x.get_json(self.me.languages))\n\n self.view.guests = json_dumps(guests_json)\n else:\n self.view.exports = exports\n self.view.guests = guests\n\n return True\n except:\n pass\n finally:\n #self.kvc.close()\n pass # libvirt connection scope --> Guest#_post()", "metadata": "root.Guest._GET", "header": "['class', 'Guest', '(', 'Rest', ')', ':', '___EOS___']", "index": 422 } ]
[ { "span": "except:", "start_line": 576, "start_column": 28, "end_line": 576, "end_column": 35 }, { "span": "except:", "start_line": 673, "start_column": 8, "end_line": 673, "end_column": 15 } ]
[]
1
true
[ "[CLS]_", "Except", "_", "block_", "handles_", "'", "Base", "Except", "ion", "'_", "[SEP]_", "class_", "Gue", "st_", "(_", "Rest", "_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "auth_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u", "GET_", "(_", "self_", ",_", "*_", "param_", ",_", "**_", "params_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "host", "\\u", "id_", "=_", "self_", "._", "chk", "\\u", "host", "by", "1_", "(_", "param_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "host", "\\u", "id_", "is_", "None_", ":_", "return_", "web_", "._", "notfound", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "model_", "=_", "find", "by", "host", "1_", "(_", "self_", "._", "orm_", ",_", "host", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "uris_", "=_", "avail", "able", "\\u", "virt", "\\u", "uris_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "import", " ", "pdb", ";", " ", "pdb", ".", "set\\u", "trace", "()", "_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "model_", "._", "attribute_", "==_", "MACHINE", "\\u", "ATTRIBUTE_", "[_", "\"", "URI", "\"_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "uri", "\\u", "guest", "s_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "uri", "\\u", "guest", "s", "\\u", "status_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "uri", "\\u", "guest", "s", "\\u", "kv", "g_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "uri", "\\u", "guest", "s", "\\u", "info_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "uri", "\\u", "guest", "s", "\\u", "name_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "segs_", "=_", "uri", "\\u", "split_", "(_", "model_", "._", "hostname_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "uri_", "=_", "uri", "\\u", "join_", "(_", "segs_", ",_", "with", "out", "\\u", "auth_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "creds_", "=_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "segs_", "[_", "\"", "user", "\"_", "]_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "creds_", "+=_", "segs_", "[_", "\"", "user", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "segs_", "[_", "\"", "passw", "d", "\"_", "]_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "creds_", "+=_", "':'_", "+_", "segs_", "[_", "\"", "passw", "d", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Output", " ", ".", "part_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "is", "\\u", "mode", "\\u", "input_", "(_", ")_", "is_", "not_", "True_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "self_", "._", "kv", "c_", "=_", "Kar", "esa", "nsu", "i", "Virt", "Connect", "ion", "Auth_", "(_", "uri_", ",_", "creds_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "host_", "=_", "Merge", "Host_", "(_", "self_", "._", "kv", "c_", ",_", "model_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "guest_", "in_", "host_", "._", "guest", "s_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "\\u", "virt_", "=_", "self_", "._", "kv", "c_", "._", "search", "\\u", "kv", "g", "\\u", "guest", "s_", "(_", "guest_", "._", "info_", "[_", "\"", "model", "\"_", "]_", "._", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "0_", "<_", "len_", "(_", "\\u", "virt_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "for_", "\\u", "v_", "in_", "\\u", "virt_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "uuid_", "=_", "\\u", "v_", "._", "get", "\\u", "info_", "(_", ")_", "[_", "\"", "uuid", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "uri", "\\u", "guest", "s", "\\u", "info_", "[_", "uuid_", "]_", "=_", "guest_", "._", "info_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "uri", "\\u", "guest", "s", "\\u", "kv", "g_", "[_", "uuid_", "]_", "=_", "\\u", "v_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "uri", "\\u", "guest", "s", "\\u", "name_", "[_", "uuid_", "]_", "=_", "guest_", "._", "info_", "[_", "\"", "model", "\"_", "]_", "._", "name_", "._", "encode_", "(_", "\"", "utf", "8", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "name_", "in_", "sorted_", "(_", "uri", "\\u", "guest", "s", "\\u", "name_", "._", "values_", "(_", ")_", ",_", "key_", "=_", "str_", "._", "lower_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "for_", "uuid_", "in_", "dict", "\\u", "search_", "(_", "name_", ",_", "uri", "\\u", "guest", "s", "\\u", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "uri", "\\u", "guest", "s_", "._", "append_", "(_", "Merge", "Gue", "st_", "(_", "uri", "\\u", "guest", "s", "\\u", "info_", "[_", "uuid_", "]_", "[_", "\"", "model", "\"_", "]_", ",_", "uri", "\\u", "guest", "s", "\\u", "kv", "g_", "[_", "uuid_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "uri", "\\u", "guest", "s", "\\u", "status_", "[_", "uuid_", "]_", "=_", "uri", "\\u", "guest", "s", "\\u", "info_", "[_", "uuid_", "]_", "[_", "'", "virt", "'_", "]_", "._", "status_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "finally_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "self_", "._", "kv", "c_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", ".", "json_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "is", "\\u", "json_", "(_", ")_", "is_", "True_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "guest", "s", "\\u", "json_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "x_", "in_", "uri", "\\u", "guest", "s_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "guest", "s", "\\u", "json_", "._", "append_", "(_", "x_", "._", "get", "\\u", "json_", "(_", "self_", "._", "me_", "._", "languages_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "view_", "._", "uri", "\\u", "guest", "s_", "=_", "json", "\\u", "dumps_", "(_", "guest", "s", "\\u", "json_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "self_", "._", "view_", "._", "uri", "\\u", "guest", "s_", "=_", "uri", "\\u", "guest", "s_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "view_", "._", "uri", "\\u", "guest", "s", "\\u", "status_", "=_", "uri", "\\u", "guest", "s", "\\u", "status_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "kv", "c_", "=_", "Kar", "esa", "nsu", "i", "Virt", "Connection_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "#", " ", "libvi", "rt", " ", "connecti", "on", " ", "scope", " ", "-->", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Stor", "age", " ", "Pool_", "\\u\\u\\uNL\\u\\u\\u_", "#", "inact", "ive", "\\u", "pool", " ", "=", " ", "self", ".", "kv", "c", ".", "list", "\\u", "inact", "ive", "\\u", "storage", "\\u", "pool", "()", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "inact", "ive", "\\u", "pool_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "active", "\\u", "pool_", "=_", "self_", "._", "kv", "c_", "._", "list", "\\u", "active", "\\u", "storage", "\\u", "pool_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pools_", "=_", "inact", "ive", "\\u", "pool_", "+_", "active", "\\u", "pool_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pools_", "._", "sort_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "pools_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "web_", "._", "bad", "request_", "(_", "'", "One", " ", "can", " ", "not", " ", "start", " ", "a", " ", "storage", " ", "pool", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Output", " ", ".", "input_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "is", "\\u", "mode", "\\u", "input_", "(_", ")_", "is_", "True_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "view_", "._", "pools_", "=_", "pools_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pools", "\\u", "info_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pools", "\\u", "vol", "s", "\\u", "info_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pools", "\\u", "iscsi", "\\u", "blocks_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "alr", "ead", "y", "\\u", "vols_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "guest", "s_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "guest", "s_", "+=_", "self_", "._", "kv", "c_", "._", "list", "\\u", "inact", "ive", "\\u", "guest_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "guest", "s_", "+=_", "self_", "._", "kv", "c_", "._", "list", "\\u", "active", "\\u", "guest_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "guest_", "in_", "guest", "s_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "alr", "ead", "y", "\\u", "vol_", "=_", "self_", "._", "kv", "c_", "._", "get", "\\u", "storage", "\\u", "volume", "\\u", "by", "domain_", "(_", "domain_", "=_", "guest_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "image", "\\u", "type_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "attr_", "=_", "'", "path", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "alr", "ead", "y", "\\u", "vol_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "alr", "ead", "y", "\\u", "vols_", "+=_", "alr", "ead", "y", "\\u", "vol_", "._", "keys_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "pool_", "in_", "pools_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "pool", "\\u", "obj_", "=_", "self_", "._", "kv", "c_", "._", "search", "\\u", "kv", "n", "\\u", "storage", "\\u", "pools_", "(_", "pool_", ")_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "pool", "\\u", "obj_", "._", "is", "\\u", "active_", "(_", ")_", "is_", "True_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "pools", "\\u", "info_", "[_", "pool_", "]_", "=_", "pool", "\\u", "obj_", "._", "get", "\\u", "info_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "blocks_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "pools", "\\u", "info_", "[_", "pool_", "]_", "[_", "'", "type", "'_", "]_", "==_", "'", "iscsi", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "blocks_", "=_", "self_", "._", "kv", "c_", "._", "get", "\\u", "storage", "\\u", "volume", "\\u", "iscsi", "\\u", "block", "\\u", "by", "pool_", "(_", "pool_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "blocks_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "pools", "\\u", "iscsi", "\\u", "blocks_", "[_", "pool_", "]_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "vol", "s", "\\u", "obj_", "=_", "pool", "\\u", "obj_", "._", "search", "\\u", "kv", "n", "\\u", "storage", "\\u", "volumes_", "(_", "self_", "._", "kv", "c_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "vol", "s", "\\u", "info_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "vol", "\\u", "obj_", "in_", "vol", "s", "\\u", "obj_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "vol", "\\u", "name_", "=_", "vol", "\\u", "obj_", "._", "get", "\\u", "storage", "\\u", "volume", "\\u", "name_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "vol", "s", "\\u", "info_", "[_", "vol", "\\u", "name_", "]_", "=_", "vol", "\\u", "obj_", "._", "get", "\\u", "info_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "blocks_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "if_", "vol", "\\u", "name_", "in_", "blocks_", "and_", "vol", "\\u", "name_", "not_", "in_", "alr", "ead", "y", "\\u", "vols_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "pools", "\\u", "iscsi", "\\u", "blocks_", "[_", "pool_", "]_", "._", "append_", "(_", "vol", "\\u", "obj_", "._", "get", "\\u", "info_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "pools", "\\u", "vol", "s", "\\u", "info_", "[_", "pool_", "]_", "=_", "vol", "s", "\\u", "info_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "view_", "._", "pools", "\\u", "info_", "=_", "pools", "\\u", "info_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "view_", "._", "pools", "\\u", "vol", "s", "\\u", "info_", "=_", "pools", "\\u", "vol", "s", "\\u", "info_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "view_", "._", "pools", "\\u", "iscsi", "\\u", "blocks_", "=_", "pools", "\\u", "iscsi", "\\u", "blocks_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "bridge", "\\u", "prefix_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "XE", "N", "\"_", ":_", "\"", "xen", "br", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "KV", "M", "\"_", ":_", "KV", "M", "\\u", "BRIDGE", "\\u", "PREFIX_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "view_", "._", "host", "\\u", "id_", "=_", "host", "\\u", "id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "view_", "._", "DEF", "AUL", "T", "\\u", "KEY", "MAP_", "=_", "DEF", "AUL", "T", "\\u", "KEY", "MAP_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "view_", "._", "DISK", "\\u", "NON", "\\u", "QE", "MU", "\\u", "FORMAT_", "=_", "DISK", "\\u", "NON", "\\u", "QE", "MU", "\\u", "FORMAT_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "view_", "._", "DISK", "\\u", "QE", "MU", "\\u", "FORMAT_", "=_", "DISK", "\\u", "QE", "MU", "\\u", "FORMAT_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "view_", "._", "hypervisor", "s_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "view_", "._", "mac", "\\u", "address_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "view_", "._", "keymap", "s_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "view_", "._", "phy", "dev_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "view_", "._", "vir", "net_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "used", "\\u", "ports_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "k_", ",_", "v_", "in_", "MACHINE", "\\u", "HYP", "ERV", "ISO", "R_", "._", "iteritems_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "k_", "in_", "avail", "able", "\\u", "virt", "\\u", "mech", "s_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "self_", "._", "view_", "._", "hypervisor", "s_", "[_", "k_", "]_", "=_", "v_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "uri_", "=_", "uris_", "[_", "k_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mem", "\\u", "info_", "=_", "self_", "._", "kv", "c_", "._", "get", "\\u", "mem", "\\u", "info_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "active", "\\u", "networks_", "=_", "self_", "._", "kv", "c_", "._", "list", "\\u", "active", "\\u", "network_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "used", "\\u", "graphic", "s", "\\u", "ports_", "=_", "self_", "._", "kv", "c_", "._", "list", "\\u", "used", "\\u", "graphic", "s", "\\u", "port_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bus", "\\u", "types_", "=_", "self_", "._", "kv", "c_", "._", "bus", "\\u", "types_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "view_", "._", "bus", "\\u", "types_", "=_", "bus", "\\u", "types_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "view_", "._", "max", "\\u", "mem_", "=_", "mem", "\\u", "info_", "[_", "'", "host", "\\u", "max", "\\u", "mem", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "view_", "._", "free", "\\u", "mem_", "=_", "mem", "\\u", "info_", "[_", "'", "host", "\\u", "free", "\\u", "mem", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "view_", "._", "allo", "c\\u", "mem_", "=_", "mem", "\\u", "info_", "[_", "'", "guest", "\\u", "allo", "c\\u", "mem", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "view_", "._", "mac", "\\u", "address_", "[_", "k_", "]_", "=_", "generat", "e\\u", "mac", "\\u", "address_", "(_", "k_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "view_", "._", "keymap", "s_", "[_", "k_", "]_", "=_", "eval_", "(_", "\"", "get", "\\u", "keymap", "s", "(%", "s", "\\u", "KEY", "MAP", "\\u", "DIR", ")\"_", "%_", "k_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Phys", "ical", " ", "device_", "\\u\\u\\uNL\\u\\u\\u_", "phy", "dev_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "phy", "dev", "\\u", "regex_", "=_", "re_", "._", "compile_", "(_", "r", "\"%", "s", "\"_", "%_", "bridge", "\\u", "prefix_", "[_", "k_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "dev_", ",_", "dev", "\\u", "info_", "in_", "get", "\\u", "ifconfig", "\\u", "info_", "(_", ")_", "._", "iteritems_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "if_", "phy", "dev", "\\u", "regex_", "._", "match_", "(_", "dev_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "phy", "dev_", "._", "append_", "(_", "dev_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "len_", "(_", "phy", "dev_", ")_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "phy", "dev_", "._", "append_", "(_", "\"%", "s0", "\"_", "%_", "bridge", "\\u", "prefix_", "[_", "k_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "phy", "dev_", "._", "sort_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "view_", "._", "phy", "dev_", "[_", "k_", "]_", "=_", "phy", "dev_", "#", " ", "Phys", "ical", " ", "device_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Virt", "ual", " ", "device_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "view_", "._", "vir", "net_", "[_", "k_", "]_", "=_", "sorted_", "(_", "active", "\\u", "networks_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "used", "\\u", "ports_", "[_", "k_", "]_", "=_", "used", "\\u", "graphic", "s", "\\u", "ports_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "exclu", "de", "\\u", "ports_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "k_", ",_", "\\u", "used", "\\u", "port_", "in_", "used", "\\u", "ports_", "._", "iteritems_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "exclu", "de", "\\u", "ports_", "=_", "exclu", "de", "\\u", "ports_", "+_", "\\u", "used", "\\u", "port_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "exclu", "de", "\\u", "ports_", "=_", "sorted_", "(_", "exclu", "de", "\\u", "ports_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "exclu", "de", "\\u", "ports_", "=_", "[_", "p_", "for_", "p_", ",_", "q_", "in_", "zip_", "(_", "exclu", "de", "\\u", "ports_", ",_", "exclu", "de", "\\u", "ports_", "[_", "1_", ":_", "]_", "+_", "[_", "None_", "]_", ")_", "if_", "p_", "!=_", "q_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "view_", "._", "graphic", "s", "\\u", "port_", "=_", "next", "\\u", "number_", "(_", "GRAPHI", "CS", "\\u", "PORT", "\\u", "MIN", "\\u", "NUMBER_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "PORT", "\\u", "MAX", "\\u", "NUMBER_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "exclu", "de", "\\u", "ports_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "#", " ", ".", "part_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "models_", "=_", "find", "by", "host", "1", "guest", "all_", "(_", "self_", "._", "orm_", ",_", "host", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "guest", "s_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "models_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Phys", "ical", " ", "Gue", "st", " ", "Info_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "self_", "._", "view_", "._", "hypervisor", "s_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "model_", "in_", "models_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "for_", "k_", ",_", "v_", "in_", "MACHINE", "\\u", "HYP", "ERV", "ISO", "R_", "._", "iteritems_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "if_", "k_", "in_", "avail", "able", "\\u", "virt", "\\u", "mech", "s_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "self_", "._", "view_", "._", "hypervisor", "s_", "[_", "k_", "]_", "=_", "v_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "uri_", "=_", "uris_", "[_", "k_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "hasattr_", "(_", "self_", ",_", "\"", "kv", "c", "\"_", ")_", "is_", "not_", "True_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "self_", "._", "kv", "c_", "=_", "Kar", "esa", "nsu", "i", "Virt", "Connection_", "(_", "uri_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "dom", "name_", "=_", "self_", "._", "kv", "c_", "._", "uuid", "\\u", "to", "\\u", "dom", "name_", "(_", "model_", "._", "uniq", "\\u", "key_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "if", " ", "not", " ", "dom", "name", ":", " ", "return", " ", "web", ".", "confl", "ict", "(", "web", ".", "ctx", ".", "path", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "virt_", "=_", "self_", "._", "kv", "c_", "._", "search", "\\u", "kv", "g", "\\u", "guest", "s_", "(_", "dom", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "0_", "<_", "len_", "(_", "\\u", "virt_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "guest", "s_", "._", "append_", "(_", "Merge", "Gue", "st_", "(_", "model_", ",_", "\\u", "virt_", "[_", "0_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "guest", "s_", "._", "append_", "(_", "Merge", "Gue", "st_", "(_", "model_", ",_", "None_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Exporte", "d", " ", "Gue", "st", " ", "Info_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "exports_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "pool", "\\u", "name_", "in_", "pools_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "files_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "pool_", "=_", "self_", "._", "kv", "c_", "._", "search", "\\u", "kv", "n", "\\u", "storage", "\\u", "pools_", "(_", "pool", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "path_", "=_", "pool_", "[_", "0_", "]_", "._", "get", "\\u", "info_", "(_", ")_", "[_", "\"", "target", "\"_", "]_", "[_", "\"", "path", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "os_", "._", "path_", "._", "exists_", "(_", "path_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "for_", "\\u", "afile", "_", "in_", "glob_", "._", "glob_", "(_", "\"%", "s", "/*", "/", "info", ".", "dat", "\"_", "%_", "(_", "path_", ",_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "param_", "=_", "Export", "Config", "Param_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "param_", "._", "load", "\\u", "xml", "\\u", "config_", "(_", "\\u", "afile", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "dir_", "=_", "os_", "._", "path_", "._", "dirname_", "(_", "\\u", "afile", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "uuid_", "=_", "param_", "._", "get", "\\u", "uuid_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "name_", "=_", "param_", "._", "get", "\\u", "domain_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "created_", "=_", "param_", "._", "get", "\\u", "created_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "title_", "=_", "param_", "._", "get", "\\u", "title_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "title_", "!=_", "\"\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "title_", "=_", "re_", "._", "sub_", "(_", "\"[\\\\", "r", "\\\\", "n", "]\"_", ",_", "\"\"_", ",_", "title_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "title_", "==_", "\"\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "title_", "=_", "\\u_", "(_", "'", "unti", "tle", "d", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "created_", "!=_", "\"\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "created", "\\u", "str_", "=_", "time_", "._", "strftime_", "(_", "\"%", "Y", "/", "%", "m", "/", "%", "d", " ", "%", "H", ":", "%", "M", ":", "%", "S", "\"_", ",_", "time_", "._", "localtime_", "(_", "float_", "(_", "created_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "created", "\\u", "str_", "=_", "\\u_", "(_", "\"", "N", "/", "A", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "files_", "._", "append_", "(_", "{_", "\"", "dir", "\"_", ":_", "\\u", "dir_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "pool", "\"_", ":_", "pool", "\\u", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#\"", "b64", "dir", "\"", " ", ":", " ", "base64", "\\u", "encode", "(\\u", "dir", "),", "_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "uuid", "\"_", ":_", "uuid_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "name", "\"_", ":_", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "created", "\"_", ":_", "int_", "(_", "created_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "created", "\\u", "str", "\"_", ":_", "created", "\\u", "str_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "title", "\"_", ":_", "title_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "icon", "\"_", ":_", "param_", "._", "get", "\\u", "database_", "(_", ")_", "[_", "\"", "icon", "\"_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "exports_", "[_", "pool", "\\u", "name_", "]_", "=_", "files_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", ".", "json_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "is", "\\u", "json_", "(_", ")_", "is_", "True_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "guest", "s", "\\u", "json_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "x_", "in_", "guest", "s_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "guest", "s", "\\u", "json_", "._", "append_", "(_", "x_", "._", "get", "\\u", "json_", "(_", "self_", "._", "me_", "._", "languages_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "view_", "._", "guest", "s_", "=_", "json", "\\u", "dumps_", "(_", "guest", "s", "\\u", "json_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "self_", "._", "view_", "._", "exports_", "=_", "exports_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "view_", "._", "guest", "s_", "=_", "guest", "s_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "finally_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "self", ".", "kv", "c", ".", "close", "()", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "#", " ", "libvi", "rt", " ", "connecti", "on", " ", "scope", " ", "-->", " ", "Gue", "st", "#\\u", "post", "()", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unreachable code
brutasse/graphite-api/graphite_api/_vendor/whisper.py
[ { "content": "def info(path):\n \"\"\"info(path)\n\npath is a string\n\"\"\"\n fh = None\n try:\n fh = open(path,'rb')\n return __readHeader(fh)\n finally:\n if fh:\n fh.close()\n return None", "metadata": "root.info", "header": "['module', '___EOS___']", "index": 726 } ]
[ { "span": "return None", "start_line": 738, "start_column": 2, "end_line": 738, "end_column": 13 } ]
[]
1
true
[ "[CLS]_", "Unrea", "chab", "le_", "code_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "info_", "(_", "path_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "info", "(", "path", ")", "\\", "10", ";", "\\", "10", ";", "path", " ", "is", " ", "a", " ", "string", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fh_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "fh_", "=_", "open_", "(_", "path_", ",_", "'", "rb", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u\\u", "read", "Header_", "(_", "fh_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "finally_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "fh_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "fh_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 2 ]
Unused local variable
sk1418/zhuaxia/zhuaxia/hist_handler.py
[ { "content": "def empty_hists():\n \"\"\"empty history table\"\"\"\n conn = __getConnection()\n dao = HistDao(conn)\n hists = dao.delete_all()\n print log.hl(msg.history_cleared,'cyan')\n conn.commit()\n conn.close()", "metadata": "root.empty_hists", "header": "['module', '___EOS___']", "index": 34 } ]
[ { "span": "hists ", "start_line": 38, "start_column": 4, "end_line": 38, "end_column": 9 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "empty", "\\u", "hist", "s_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "empty", " ", "histo", "ry", " ", "table", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "conn_", "=_", "\\u\\u", "get", "Connection_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dao_", "=_", "Hist", "Da", "o_", "(_", "conn_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "hist", "s_", "=_", "dao_", "._", "delete", "\\u", "all_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "log_", "._", "hl_", "(_", "msg_", "._", "histo", "ry", "\\u", "clear", "ed_", ",_", "'", "cya", "n", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "conn_", "._", "commit_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "conn_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
MacSysadmin/pymacadmin/lib/PyMacAdmin/crankd/handlers/__init__.py
[ { "content": "#!/usr/bin/env python\n# encoding: utf-8\n\"\"\"\nHandlers for different types of events\n\"\"\"\n\nimport sys\nimport os\nimport unittest\nimport logging\nfrom Cocoa import NSObject\nfrom .. import not_implemented\n\n__all__ = [ 'BaseHandler', 'NSNotificationHandler' ]\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class BaseHandler(object):\n # pylint: disable-msg=C0111,R0903\n pass", "metadata": "root.BaseHandler", "header": "['module', '___EOS___']", "index": 15 }, { "content": "class NSNotificationHandler(NSObject):\n \"\"\"Simple base class for handling NSNotification events\"\"\"\n # Method names and class structure are dictated by Cocoa & PyObjC, which\n # is substantially different from PEP-8:\n # pylint: disable-msg=C0103,W0232,R0903\n\n", "metadata": "root.NSNotificationHandler", "header": "['module', '___EOS___']", "index": 19 }, { "content": " def init(self):\n \"\"\"NSObject-compatible initializer\"\"\"\n self = super(NSNotificationHandler, self).init()\n if self is None: return None\n self.callable = not_implemented\n return self # NOTE: Unlike Python, NSObject's init() must return self!", "metadata": "root.NSNotificationHandler.init", "header": "['class', 'NSNotificationHandler', '(', 'NSObject', ')', ':', '___EOS___']", "index": 25 }, { "content": " def onNotification_(self, the_notification):\n \"\"\"Pass an NSNotifications to our handler\"\"\"\n if the_notification.userInfo:\n user_info = the_notification.userInfo()\n else:\n user_info = None\n self.callable(user_info=user_info) # pylint: disable-msg=E1101", "metadata": "root.NSNotificationHandler.onNotification_", "header": "['class', 'NSNotificationHandler', '(', 'NSObject', ')', ':', '___EOS___']", "index": 32 } ]
[ { "span": "import sys", "start_line": 6, "start_column": 0, "end_line": 6, "end_column": 10 }, { "span": "import os", "start_line": 7, "start_column": 0, "end_line": 7, "end_column": 9 }, { "span": "import unittest", "start_line": 8, "start_column": 0, "end_line": 8, "end_column": 15 }, { "span": "import logging", "start_line": 9, "start_column": 0, "end_line": 9, "end_column": 14 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#!", "/", "usr", "/", "bin", "/", "env", " ", "python_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "encoding", ":", " ", "utf", "-", "8_", "\\u\\u\\uNL\\u\\u\\u_", "\"\"\"", "\\", "10", ";", "Handle", "rs", " ", "for", " ", "different", " ", "types", " ", "of", " ", "events", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "unittest_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "logging_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "Coc", "oa", "_", "import_", "NS", "Object_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "._", "._", "import_", "not", "\\u", "implemented", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u", "all\\u\\u_", "=_", "[_", "'", "Base", "Handle", "r", "'_", ",_", "'", "NS", "Notifi", "cation", "Handle", "r", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Base", "Handler_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "pylint", ":", " ", "disable", "-", "msg", "=", "C0", "111", ",", "R0", "903", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "NS", "Notifi", "cation", "Handler_", "(_", "NS", "Object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Simple", " ", "base", " ", "class", " ", "for", " ", "handling", " ", "NS", "Notifi", "cation", " ", "events", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Meth", "od", " ", "names", " ", "and", " ", "class", " ", "structure", " ", "are", " ", "dict", "ated", " ", "by", " ", "Coc", "oa", " ", "&", " ", "Py", "Obj", "C", ",", " ", "which_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "is", " ", "substa", "nti", "ally", " ", "different", " ", "from", " ", "PE", "P", "-", "8", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "pylint", ":", " ", "disable", "-", "msg", "=", "C0", "103", ",", "W", "023", "2", ",", "R0", "903", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "NS", "Notifi", "cation", "Handler_", "(_", "NS", "Object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "init_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "NS", "Object", "-", "compatible", " ", "initializer", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "=_", "super_", "(_", "NS", "Notifi", "cation", "Handler_", ",_", "self_", ")_", "._", "init_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "is_", "None_", ":_", "return_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "callable_", "=_", "not", "\\u", "implemented", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "#", " ", "NOTE", ":", " ", "Unli", "ke", " ", "Pyth", "on", ",", " ", "NS", "Object", "'", "s", " ", "init", "()", " ", "must", " ", "return", " ", "self", "!", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "NS", "Notifi", "cation", "Handler_", "(_", "NS", "Object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "on", "Notifi", "cation", "\\u_", "(_", "self_", ",_", "the", "\\u", "notification_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Pass", " ", "an", " ", "NS", "Notifi", "cations", " ", "to", " ", "our", " ", "handler", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "the", "\\u", "notification_", "._", "user", "Info_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "user", "\\u", "info_", "=_", "the", "\\u", "notification_", "._", "user", "Info_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "user", "\\u", "info_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "callable_", "(_", "user", "\\u", "info_", "=_", "user", "\\u", "info_", ")_", "#", " ", "pylint", ":", " ", "disable", "-", "msg", "=", "E1", "101_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Except block handles 'BaseException'
pydata/pandas/pandas/computation/pytables.py
[ { "content": " def visit_Subscript(self, node, **kwargs):\n # only allow simple suscripts\n\n value = self.visit(node.value)\n slobj = self.visit(node.slice)\n try:\n value = value.value\n except:\n pass\n\n try:\n return self.const_type(value[slobj], self.env)\n except TypeError:\n raise ValueError(\"cannot subscript {0!r} with \"\n \"{1!r}\".format(value, slobj))", "metadata": "root.ExprVisitor.visit_Subscript", "header": "['class', 'ExprVisitor', '(', 'BaseExprVisitor', ')', ':', '___EOS___']", "index": 403 } ]
[ { "span": "except:", "start_line": 410, "start_column": 8, "end_line": 410, "end_column": 15 } ]
[]
1
true
[ "[CLS]_", "Except", "_", "block_", "handles_", "'", "Base", "Except", "ion", "'_", "[SEP]_", "class_", "Exp", "r", "Visitor_", "(_", "Base", "Exp", "r", "Visitor_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "visit", "\\u", "Subs", "cript_", "(_", "self_", ",_", "node_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "only", " ", "allow", " ", "simple", " ", "sus", "cript", "s_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "value_", "=_", "self_", "._", "visit_", "(_", "node_", "._", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "slo", "bj_", "=_", "self_", "._", "visit_", "(_", "node_", "._", "slice_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "value_", "=_", "value_", "._", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "const", "\\u", "type_", "(_", "value_", "[_", "slo", "bj_", "]_", ",_", "self_", "._", "env_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Type", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Value", "Error_", "(_", "\"", "cann", "ot", " ", "subscript", " ", "{", "0", "!", "r", "}", " ", "with", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"{", "1", "!", "r", "}\"_", "._", "format_", "(_", "value_", ",_", "slo", "bj_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
First parameter of a method is not named 'self'
n1k0/SublimeHighlight/pygments/lexers/math.py
[ { "content": " def analyse_text(text):\n return shebang_matches(text, r'julia')", "metadata": "root.JuliaLexer.analyse_text", "header": "['class', 'JuliaLexer', '(', 'RegexLexer', ')', ':', '___EOS___']", "index": 143 }, { "content": " def analyse_text(text):\n if re.match('^\\s*%', text, re.M): # comment\n return 0.9\n elif re.match('^!\\w+', text, re.M): # system cmd\n return 0.9\n return 0.1", "metadata": "root.MatlabLexer.analyse_text", "header": "['class', 'MatlabLexer', '(', 'RegexLexer', ')', ':', '___EOS___']", "index": 376 }, { "content": " def analyse_text(text):\n if re.match('^\\s*[%#]', text, re.M): #Comment\n return 0.1", "metadata": "root.OctaveLexer.analyse_text", "header": "['class', 'OctaveLexer', '(', 'RegexLexer', ')', ':', '___EOS___']", "index": 825 }, { "content": " def analyse_text(text):\n return (shebang_matches(text, r'pythonw?(2(\\.\\d)?)?') or\n 'import ' in text[:1000]) \\\n and ('import numpy' in text or 'from numpy import' in text)", "metadata": "root.NumPyLexer.analyse_text", "header": "['class', 'NumPyLexer', '(', 'PythonLexer', ')', ':', '___EOS___']", "index": 985 }, { "content": " def analyse_text(text):\n if re.search(r'[a-z0-9_\\])\\s]<-(?!-)', text):\n return 0.11", "metadata": "root.SLexer.analyse_text", "header": "['class', 'SLexer', '(', 'RegexLexer', ')', ':', '___EOS___']", "index": 1119 }, { "content": " def analyse_text(text):\n if re.search(r\"^\\s*model\\s*{\", text, re.M):\n return 0.7\n else:\n return 0.0", "metadata": "root.BugsLexer.analyse_text", "header": "['class', 'BugsLexer', '(', 'RegexLexer', ')', ':', '___EOS___']", "index": 1214 }, { "content": " def analyse_text(text):\n if re.search(r'^\\s*model\\s*\\{', text, re.M):\n if re.search(r'^\\s*data\\s*\\{', text, re.M):\n return 0.9\n elif re.search(r'^\\s*var', text, re.M):\n return 0.9\n else:\n return 0.3\n else:\n return 0", "metadata": "root.JagsLexer.analyse_text", "header": "['class', 'JagsLexer', '(', 'RegexLexer', ')', ':', '___EOS___']", "index": 1296 }, { "content": " def analyse_text(text):\n if re.search(r'^\\s*parameters\\s*\\{', text, re.M):\n return 1.0\n else:\n return 0.0", "metadata": "root.StanLexer.analyse_text", "header": "['class', 'StanLexer', '(', 'RegexLexer', ')', ':', '___EOS___']", "index": 1376 } ]
[ { "span": "def analyse_text(text):", "start_line": 143, "start_column": 4, "end_line": 143, "end_column": 27 }, { "span": "def analyse_text(text):", "start_line": 376, "start_column": 4, "end_line": 376, "end_column": 27 }, { "span": "def analyse_text(text):", "start_line": 825, "start_column": 4, "end_line": 825, "end_column": 27 }, { "span": "def analyse_text(text):", "start_line": 985, "start_column": 4, "end_line": 985, "end_column": 27 }, { "span": "def analyse_text(text):", "start_line": 1119, "start_column": 4, "end_line": 1119, "end_column": 27 }, { "span": "def analyse_text(text):", "start_line": 1214, "start_column": 4, "end_line": 1214, "end_column": 27 }, { "span": "def analyse_text(text):", "start_line": 1296, "start_column": 4, "end_line": 1296, "end_column": 27 }, { "span": "def analyse_text(text):", "start_line": 1376, "start_column": 4, "end_line": 1376, "end_column": 27 } ]
[]
1
true
[ "[CLS]_", "First_", "parameter_", "of_", "a_", "method_", "is_", "not_", "named_", "'", "self", "'_", "[SEP]_", "class_", "Juli", "a", "Lexer_", "(_", "Rege", "x", "Lexer_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "analyse", "\\u", "text_", "(_", "text_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "she", "bang", "\\u", "matches_", "(_", "text_", ",_", "r", "'", "julia", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Mat", "lab", "Lexer_", "(_", "Rege", "x", "Lexer_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "analyse", "\\u", "text_", "(_", "text_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "re_", "._", "match_", "(_", "'", "^", "\\\\", "s", "*", "%'_", ",_", "text_", ",_", "re_", "._", "M_", ")_", ":_", "#", " ", "comment_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "0.9_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "re_", "._", "match_", "(_", "'", "^", "!\\\\", "w", "+'_", ",_", "text_", ",_", "re_", "._", "M_", ")_", ":_", "#", " ", "system", " ", "cmd_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "0.9_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "0.1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Oct", "ave", "Lexer_", "(_", "Rege", "x", "Lexer_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "analyse", "\\u", "text_", "(_", "text_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "re_", "._", "match_", "(_", "'", "^", "\\\\", "s", "*[", "%#", "]'_", ",_", "text_", ",_", "re_", "._", "M_", ")_", ":_", "#", "Comment_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "0.1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Num", "Py", "Lexer_", "(_", "Pyth", "on", "Lexer_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "analyse", "\\u", "text_", "(_", "text_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "(_", "she", "bang", "\\u", "matches_", "(_", "text_", ",_", "r", "'", "python", "w", "?(", "2", "(\\\\", ".\\\\", "d", ")?", ")?'_", ")_", "or_", "\\u\\u\\uNL\\u\\u\\u_", "'", "import", " ", "'_", "in_", "text_", "[_", ":_", "1000_", "]_", ")_", "and_", "(_", "'", "import", " ", "nump", "y", "'_", "in_", "text_", "or_", "'", "from", " ", "nump", "y", " ", "import", "'_", "in_", "text_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "SL", "exe", "r_", "(_", "Rege", "x", "Lexer_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "analyse", "\\u", "text_", "(_", "text_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "re_", "._", "search_", "(_", "r", "'[", "a", "-", "z", "0", "-", "9", "\\u\\\\", "])\\\\", "s", "]<", "-(", "?!", "-)", "'_", ",_", "text_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "0.11", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Bug", "s", "Lexer_", "(_", "Rege", "x", "Lexer_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "analyse", "\\u", "text_", "(_", "text_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "re_", "._", "search_", "(_", "r", "\"", "^", "\\\\", "s", "*", "model", "\\\\", "s", "*{", "\"_", ",_", "text_", ",_", "re_", "._", "M_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "0.7_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "0.0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Ja", "gs", "Lexer_", "(_", "Rege", "x", "Lexer_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "analyse", "\\u", "text_", "(_", "text_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "re_", "._", "search_", "(_", "r", "'", "^", "\\\\", "s", "*", "model", "\\\\", "s", "*\\\\", "{'_", ",_", "text_", ",_", "re_", "._", "M_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "re_", "._", "search_", "(_", "r", "'", "^", "\\\\", "s", "*", "data", "\\\\", "s", "*\\\\", "{'_", ",_", "text_", ",_", "re_", "._", "M_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "0.9_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "re_", "._", "search_", "(_", "r", "'", "^", "\\\\", "s", "*", "var", "'_", ",_", "text_", ",_", "re_", "._", "M_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "0.9_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "0.3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Stan", "Lexer_", "(_", "Rege", "x", "Lexer_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "analyse", "\\u", "text_", "(_", "text_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "re_", "._", "search_", "(_", "r", "'", "^", "\\\\", "s", "*", "parameter", "s", "\\\\", "s", "*\\\\", "{'_", ",_", "text_", ",_", "re_", "._", "M_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "1.0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "0.0_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 2, 2, 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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
Miserlou/django-easy-api/easy_api/shortcuts.py
[ { "content": "\"\"\"\n\nThis is based off of Django's own shorcuts.py which provides render_to_response.\n\nThe key function here is easy_api_render_to_response()\n\n\"\"\"\nfrom django.template import loader, RequestContext\nfrom django.http import HttpResponse, Http404\nfrom django.http import HttpResponseRedirect, HttpResponsePermanentRedirect\nfrom django.db.models.base import ModelBase\nfrom django.db.models.manager import Manager\nfrom django.db.models.query import QuerySet\nfrom django.core import urlresolvers\nfrom django.utils import six\n\nimport datetime\ntry:\n import json\nexcept Exception, e:\n import simplejson as json # Support for older Python\n\nfrom .dumper import DataDumper # Probably can be deprecated.\nfrom dicttoxml import dicttoxml as dict2xml # Requirest dict2xml dep.\nfrom xml.dom.minidom import parseString # For prettyfication\nimport yaml\n\n\n\n###\n#\n# Serializers stuff. Mostly stolen from what I did making django-knockout-modeler.\n#\n##\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def render_to_easy_api_response(*args, **kwargs):\n \"\"\"\n Returns a HttpResponse whose content is filled with the result of calling\n django.template.loader.render_to_string() with the passed arguments.\n \"\"\"\n httpresponse_kwargs = {'content_type': kwargs.pop('content_type', None)}\n\n # This is really quite hacky.\n context = kwargs.pop('context_instance')\n processors = context.context_processors\n request = processors['django.core.context_processors.request']['request']\n\n if request.GET.has_key('api'):\n api_type = request.GET['api']\n\n # This is dirty, but direct indexing doesn't work here because technically we're using variable length arguments.\n # I'm assuming that the parameters dictionary will always be the last non-named argument. This is likely a bug.\n # Better solutions welcome!\n for arg in args:\n passed = arg\n\n dump_me = {}\n for key in passed.keys():\n value = passed[key]\n dump_me[key] = dump_object(value)\n\n if api_type == 'xml':\n\n # The XML parser chokes on spaces in key names.\n # This recursively replaces them with underscores.\n def replace_spaces(dump_me):\n new = {}\n for k, v in dump_me.iteritems():\n if isinstance(v, dict):\n v = replace_spaces(v)\n new[k.replace(' ', '_')] = v\n return new\n\n new = replace_spaces(dump_me)\n dump_me = dict2xml(new)\n\n dom = parseString(dump_me) # I love pretty APIs!\n pretty = dom.toprettyxml()\n return HttpResponse(pretty, content_type='application/xml')\n if api_type == 'yaml':\n yml = yaml.safe_dump(dump_me)\n return HttpResponse(yml, content_type='application/x-yaml')\n else: \n dump_me = json.dumps(dump_me, indent=2) # Indents for pretty\n return HttpResponse(dump_me, content_type='application/json')\n\n return HttpResponse(loader.render_to_string(*args, **kwargs), **httpresponse_kwargs)", "metadata": "root.render_to_easy_api_response", "header": "['module', '___EOS___']", "index": 27 }, { "content": "def render_to_response(*args, **kwargs):\n \"\"\"\n This is just a wrapper around render_to_easy_api_response to make it easier to use as a drop-in replacement.\n \"\"\"\n\n return render_to_easy_api_response(*args, **kwargs)", "metadata": "root.render_to_response", "header": "['module', '___EOS___']", "index": 80 }, { "content": "def dump_object(queryset):\n\n # Nasty.\n if str(type(queryset)) != \"<class 'django.db.models.query.QuerySet'>\":\n d = DataDumper()\n ret = d.dump(queryset)\n return ret\n\n try:\n modelName = queryset[0].__class__.__name__ \n modelNameData = []\n\n fields = get_fields(queryset[0])\n\n for obj in queryset:\n temp_dict = dict()\n for field in fields:\n try:\n attribute = getattr(obj, str(field))\n\n # Should sanitization be up to the API consumer? Probably.\n # if not safe:\n # if isinstance(attribute, basestring):\n # attribute = cgi.escape(attribute)\n\n temp_dict[field] = attribute\n except Exception, e:\n continue\n modelNameData.append(temp_dict)\n\n dthandler = lambda obj: obj.isoformat() if isinstance(obj, datetime.datetime) or isinstance(obj, datetime.date) else None\n return json.loads(json.dumps(modelNameData, default=dthandler))\n except Exception, e:\n return ''", "metadata": "root.dump_object", "header": "['module', '___EOS___']", "index": 93 }, { "content": "def get_fields(model):\n\n try:\n if hasattr(model, \"easy_api_fields\"):\n fields = model.easy_api_fields()\n else:\n try:\n fields = model.to_dict().keys()\n except Exception, e:\n fields = model._meta.get_all_field_names()\n\n return fields\n\n # Crash proofing\n except Exception, e:\n return []", "metadata": "root.get_fields", "header": "['module', '___EOS___']", "index": 128 } ]
[ { "span": "from django.template import loader, RequestContext", "start_line": 7, "start_column": 0, "end_line": 7, "end_column": 50 }, { "span": "from django.http import HttpResponse, Http404", "start_line": 8, "start_column": 0, "end_line": 8, "end_column": 45 }, { "span": "from django.http import HttpResponseRedirect, HttpResponsePermanentRedirect", "start_line": 9, "start_column": 0, "end_line": 9, "end_column": 75 }, { "span": "from django.db.models.base import ModelBase", "start_line": 10, "start_column": 0, "end_line": 10, "end_column": 43 }, { "span": "from django.db.models.manager import Manager", "start_line": 11, "start_column": 0, "end_line": 11, "end_column": 44 }, { "span": "from django.db.models.query import QuerySet", "start_line": 12, "start_column": 0, "end_line": 12, "end_column": 43 }, { "span": "from django.core import urlresolvers", "start_line": 13, "start_column": 0, "end_line": 13, "end_column": 36 }, { "span": "from django.utils import six", "start_line": 14, "start_column": 0, "end_line": 14, "end_column": 28 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\"\"\"", "\\", "10", ";", "\\", "10", ";", "Thi", "s", " ", "is", " ", "based", " ", "off", " ", "of", " ", "Dj", "ang", "o", "'", "s", " ", "own", " ", "sho", "rcu", "ts", ".", "py", " ", "whi", "ch", " ", "provide", "s", " ", "render", "\\u", "to", "\\u", "response", ".", "\\", "10", ";", "\\", "10", ";", "The", " ", "key", " ", "function", " ", "here", " ", "is", " ", "easy", "\\u", "api", "\\u", "render", "\\u", "to", "\\u", "response", "()", "\\", "10", ";", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "template_", "import_", "loader_", ",_", "Request", "Context_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "http_", "import_", "Http", "Response_", ",_", "Http404_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "http_", "import_", "Http", "Respons", "e", "Redirect_", ",_", "Http", "Respons", "e", "Permanent", "Redirect_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "db_", "._", "models_", "._", "base_", "import_", "Model", "Base_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "db_", "._", "models_", "._", "manager_", "import_", "Manager_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "db_", "._", "models_", "._", "query_", "import_", "Query", "Set_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "core_", "import_", "urlresolvers_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "utils_", "import_", "six_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "datetime_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "json_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", ",_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "simplejson_", "as_", "json_", "#", " ", "Supp", "ort", " ", "for", " ", "older", " ", "Python_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "from_", "._", "dumper", "_", "import_", "Data", "Dumper", "_", "#", " ", "Prob", "abl", "y", " ", "can", " ", "be", " ", "depre", "cated", "._", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "dict", "tox", "ml_", "import_", "dict", "tox", "ml_", "as_", "dict2", "xml_", "#", " ", "Requ", "ires", "t", " ", "dict2", "xml", " ", "dep", "._", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "xml_", "._", "dom_", "._", "minidom_", "import_", "parse", "String_", "#", " ", "For", " ", "pretty", "fication", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "yaml_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "###", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Seriali", "zer", "s", " ", "stu", "ff", ".", " ", "Mos", "tl", "y", " ", "sto", "len", " ", "from", " ", "what", " ", "I", " ", "did", " ", "mak", "ing", " ", "django", "-", "kno", "cko", "ut", "-", "model", "er", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "##", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "render", "\\u", "to", "\\u", "easy", "\\u", "api", "\\u", "response_", "(_", "*_", "args_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", " ", "a", " ", "Http", "Respons", "e", " ", "who", "se", " ", "content", " ", "is", " ", "filled", " ", "with", " ", "the", " ", "result", " ", "of", " ", "calling", "\\", "10", ";", " ", " ", " ", " ", "django", ".", "template", ".", "load", "er", ".", "render", "\\u", "to", "\\u", "string", "()", " ", "with", " ", "the", " ", "pass", "ed", " ", "argu", "ment", "s", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "http", "response", "\\u", "kwargs_", "=_", "{_", "'", "content", "\\u", "type", "'_", ":_", "kwargs_", "._", "pop_", "(_", "'", "content", "\\u", "type", "'_", ",_", "None_", ")_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Thi", "s", " ", "is", " ", "reall", "y", " ", "quite", " ", "hack", "y", "._", "\\u\\u\\uNL\\u\\u\\u_", "context_", "=_", "kwargs_", "._", "pop_", "(_", "'", "context", "\\u", "instance", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "processors_", "=_", "context_", "._", "context", "\\u", "processors_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "request_", "=_", "processors_", "[_", "'", "django", ".", "core", ".", "context", "\\u", "process", "ors", ".", "request", "'_", "]_", "[_", "'", "request", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "request_", "._", "GET_", "._", "has", "\\u", "key_", "(_", "'", "api", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "api", "\\u", "type_", "=_", "request_", "._", "GET_", "[_", "'", "api", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Thi", "s", " ", "is", " ", "dir", "ty", ",", " ", "but", " ", "direct", " ", "indexing", " ", "doe", "sn", "'", "t", " ", "work", " ", "here", " ", "bec", "aus", "e", " ", "technical", "ly", " ", "we", "'", "re", " ", "usi", "ng", " ", "variab", "le", " ", "length", " ", "argu", "ment", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "I", "'", "m", " ", "ass", "umi", "ng", " ", "tha", "t", " ", "the", " ", "parameter", "s", " ", "dictionar", "y", " ", "will", " ", "alw", "ay", "s", " ", "be", " ", "the", " ", "last", " ", "non", "-", "named", " ", "argu", "ment", ".", " ", "Thi", "s", " ", "is", " ", "like", "ly", " ", "a", " ", "bug", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Bet", "ter", " ", "solut", "ion", "s", " ", "welcome", "!", "_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "arg_", "in_", "args_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "passed_", "=_", "arg_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "dump", "\\u", "me_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "key_", "in_", "passed_", "._", "keys_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "value_", "=_", "passed_", "[_", "key_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dump", "\\u", "me_", "[_", "key_", "]_", "=_", "dump", "\\u", "object_", "(_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "api", "\\u", "type_", "==_", "'", "xml", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "XML", " ", "parser", " ", "cho", "kes", " ", "on", " ", "space", "s", " ", "in", " ", "key", " ", "names", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Thi", "s", " ", "recurs", "ively", " ", "replace", "s", " ", "them", " ", "with", " ", "underscore", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "replace", "\\u", "spaces_", "(_", "dump", "\\u", "me_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "new_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "k_", ",_", "v_", "in_", "dump", "\\u", "me_", "._", "iteritems_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "isinstance_", "(_", "v_", ",_", "dict_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "v_", "=_", "replace", "\\u", "spaces_", "(_", "v_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "new_", "[_", "k_", "._", "replace_", "(_", "'", " ", "'_", ",_", "'\\u'_", ")_", "]_", "=_", "v_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "new_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "new_", "=_", "replace", "\\u", "spaces_", "(_", "dump", "\\u", "me_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dump", "\\u", "me_", "=_", "dict2", "xml_", "(_", "new_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "dom_", "=_", "parse", "String_", "(_", "dump", "\\u", "me_", ")_", "#", " ", "I", " ", "love", " ", "pretty", " ", "API", "s", "!", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pretty_", "=_", "dom_", "._", "topr", "ett", "yx", "ml_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "Http", "Response_", "(_", "pretty_", ",_", "content", "\\u", "type_", "=_", "'", "applica", "tion", "/", "xml", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "api", "\\u", "type_", "==_", "'", "yaml", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "yml", "_", "=_", "yaml_", "._", "safe", "\\u", "dump_", "(_", "dump", "\\u", "me_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "Http", "Response_", "(_", "yml", "_", ",_", "content", "\\u", "type_", "=_", "'", "applica", "tion", "/", "x", "-", "yaml", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "dump", "\\u", "me_", "=_", "json_", "._", "dumps_", "(_", "dump", "\\u", "me_", ",_", "indent_", "=_", "2_", ")_", "#", " ", "Indent", "s", " ", "for", " ", "pretty_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "Http", "Response_", "(_", "dump", "\\u", "me_", ",_", "content", "\\u", "type_", "=_", "'", "applica", "tion", "/", "json", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "Http", "Response_", "(_", "loader_", "._", "render", "\\u", "to", "\\u", "string_", "(_", "*_", "args_", ",_", "**_", "kwargs_", ")_", ",_", "**_", "http", "response", "\\u", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "render", "\\u", "to", "\\u", "response_", "(_", "*_", "args_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Thi", "s", " ", "is", " ", "just", " ", "a", " ", "wrapp", "er", " ", "aro", "und", " ", "render", "\\u", "to", "\\u", "easy", "\\u", "api", "\\u", "response", " ", "to", " ", "make", " ", "it", " ", "easi", "er", " ", "to", " ", "use", " ", "as", " ", "a", " ", "drop", "-", "in", " ", "replace", "ment", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "render", "\\u", "to", "\\u", "easy", "\\u", "api", "\\u", "response_", "(_", "*_", "args_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "dump", "\\u", "object_", "(_", "queryset_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Nas", "ty", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "str_", "(_", "type_", "(_", "queryset_", ")_", ")_", "!=_", "\"<", "class", " ", "'", "django", ".", "db", ".", "model", "s", ".", "query", ".", "Query", "Set", "'>\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "d_", "=_", "Data", "Dumper", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ret_", "=_", "d_", "._", "dump_", "(_", "queryset_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "ret_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "model", "Name_", "=_", "queryset_", "[_", "0_", "]_", "._", "\\u\\u", "class\\u\\u_", "._", "\\u\\u", "name\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "model", "Name", "Data_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "fields_", "=_", "get", "\\u", "fields_", "(_", "queryset_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "obj_", "in_", "queryset_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "temp", "\\u", "dict_", "=_", "dict_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "field_", "in_", "fields_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "attribute_", "=_", "getattr_", "(_", "obj_", ",_", "str_", "(_", "field_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Sho", "ul", "d", " ", "sani", "ti", "zatio", "n", " ", "be", " ", "up", " ", "to", " ", "the", " ", "API", " ", "consume", "r", "?", " ", "Prob", "abl", "y", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "if", " ", "not", " ", "safe", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "if", " ", "isin", "stance", "(", "attribute", ",", " ", "basest", "ring", "):", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "attribute", " ", "=", " ", "cgi", ".", "escape", "(", "attribute", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "temp", "\\u", "dict_", "[_", "field_", "]_", "=_", "attribute_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", ",_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "model", "Name", "Data_", "._", "append_", "(_", "temp", "\\u", "dict_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "dth", "andle", "r_", "=_", "lambda_", "obj_", ":_", "obj_", "._", "isoformat_", "(_", ")_", "if_", "isinstance_", "(_", "obj_", ",_", "datetime_", "._", "datetime_", ")_", "or_", "isinstance_", "(_", "obj_", ",_", "datetime_", "._", "date_", ")_", "else_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "json_", "._", "loads_", "(_", "json_", "._", "dumps_", "(_", "model", "Name", "Data_", ",_", "default_", "=_", "dth", "andle", "r_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", ",_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "fields_", "(_", "model_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "hasattr_", "(_", "model_", ",_", "\"", "easy", "\\u", "api", "\\u", "fields", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "fields_", "=_", "model_", "._", "easy", "\\u", "api", "\\u", "fields_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "fields_", "=_", "model_", "._", "to", "\\u", "dict_", "(_", ")_", "._", "keys_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", ",_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "fields_", "=_", "model_", "._", "\\u", "meta_", "._", "get", "\\u", "all", "\\u", "field", "\\u", "names_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "fields_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Cra", "sh", " ", "proof", "ing_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", ",_", "e_", ":_", "\\u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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused local variable
OpenMDAO/OpenMDAO/mpitest/test_parallel_derivatives.py
[ { "content": " def setup_model(self, mode):\n asize = 3\n prob = Problem(root=Group(), impl=impl)\n root = prob.root\n root.ln_solver = LinearGaussSeidel()\n root.ln_solver.options['mode'] = mode\n\n p = root.add('p', IndepVarComp('x', np.arange(asize, dtype=float)+1.0))\n G1 = root.add('G1', ParallelGroup())\n G1.ln_solver = LinearGaussSeidel()\n G1.ln_solver.options['mode'] = mode\n\n c2 = G1.add('c2', ExecComp4Test('y = x * 2.0', lin_delay=1.0,\n x=np.zeros(asize), y=np.zeros(asize)))\n c3 = G1.add('c3', ExecComp4Test('y = numpy.ones(3).T*x.dot(numpy.arange(3.,6.))',\n lin_delay=1.0,\n x=np.zeros(asize), y=np.zeros(asize)))\n c4 = root.add('c4', ExecComp4Test('y = x * 4.0',\n x=np.zeros(asize), y=np.zeros(asize)))\n c5 = root.add('c5', ExecComp4Test('y = x * 5.0',\n x=np.zeros(asize), y=np.zeros(asize)))\n\n prob.driver.add_desvar('p.x', indices=[1, 2])\n prob.driver.add_constraint('c4.y', upper=0.0, indices=[1])\n prob.driver.add_constraint('c5.y', upper=0.0, indices=[2])\n prob.driver.parallel_derivs(['c4.y', 'c5.y'])\n\n root.connect('p.x', 'G1.c2.x')\n root.connect('p.x', 'G1.c3.x')\n root.connect('G1.c2.y', 'c4.x')\n root.connect('G1.c3.y', 'c5.x')\n\n prob.setup(check=False)\n prob.run()\n\n return prob", "metadata": "root.MatMatIndicesTestCase.setup_model", "header": "['class', 'MatMatIndicesTestCase', '(', 'MPITestCase', ')', ':', '___EOS___']", "index": 325 }, { "content": " def setup_model(self, mode):\n asize = 3\n prob = Problem(root=Group(), impl=impl)\n root = prob.root\n root.ln_solver = LinearGaussSeidel()\n root.ln_solver.options['mode'] = mode\n\n G1 = root.add('G1', ParallelGroup())\n G1.ln_solver.options['mode'] = mode\n\n par1 = G1.add('par1', Group())\n par2 = G1.add('par2', Group())\n\n p1 = par1.add('p', IndepVarComp('x', np.arange(asize, dtype=float)+1.0))\n p2 = par2.add('p', IndepVarComp('x', np.arange(asize, dtype=float)+10.0))\n\n c2 = par1.add('c2', ExecComp4Test('y = x * 2.0', lin_delay=1.0,\n x=np.zeros(asize), y=np.zeros(asize)))\n c3 = par2.add('c3', ExecComp4Test('y = numpy.ones(3).T*x.dot(numpy.arange(3.,6.))',\n lin_delay=1.0,\n x=np.zeros(asize), y=np.zeros(asize)))\n c4 = par1.add('c4', ExecComp4Test('y = x * 4.0',\n x=np.zeros(asize), y=np.zeros(asize)))\n c5 = par2.add('c5', ExecComp4Test('y = x * 5.0',\n x=np.zeros(asize), y=np.zeros(asize)))\n\n prob.driver.add_desvar('G1.par1.p.x', indices=[1, 2])\n prob.driver.add_desvar('G1.par2.p.x', indices=[1, 2])\n prob.driver.add_constraint('G1.par1.c4.y', upper=0.0, indices=[1])\n prob.driver.add_constraint('G1.par2.c5.y', upper=0.0, indices=[2])\n prob.driver.parallel_derivs(['G1.par1.c4.y', 'G1.par2.c5.y'])\n\n root.connect('G1.par1.p.x', 'G1.par1.c2.x')\n root.connect('G1.par2.p.x', 'G1.par2.c3.x')\n root.connect('G1.par1.c2.y', 'G1.par1.c4.x')\n root.connect('G1.par2.c3.y', 'G1.par2.c5.x')\n\n prob.setup(check=False)\n prob.run()\n\n return prob", "metadata": "root.IndicesTestCase2.setup_model", "header": "['class', 'IndicesTestCase2', '(', 'MPITestCase', ')', ':', '___EOS___']", "index": 384 } ]
[ { "span": "p ", "start_line": 332, "start_column": 8, "end_line": 332, "end_column": 9 }, { "span": "c2 ", "start_line": 337, "start_column": 8, "end_line": 337, "end_column": 10 }, { "span": "c3 ", "start_line": 339, "start_column": 8, "end_line": 339, "end_column": 10 }, { "span": "c4 ", "start_line": 342, "start_column": 8, "end_line": 342, "end_column": 10 }, { "span": "c5 ", "start_line": 344, "start_column": 8, "end_line": 344, "end_column": 10 }, { "span": "p1 ", "start_line": 397, "start_column": 8, "end_line": 397, "end_column": 10 }, { "span": "p2 ", "start_line": 398, "start_column": 8, "end_line": 398, "end_column": 10 }, { "span": "c2 ", "start_line": 400, "start_column": 8, "end_line": 400, "end_column": 10 }, { "span": "c3 ", "start_line": 402, "start_column": 8, "end_line": 402, "end_column": 10 }, { "span": "c4 ", "start_line": 405, "start_column": 8, "end_line": 405, "end_column": 10 }, { "span": "c5 ", "start_line": 407, "start_column": 8, "end_line": 407, "end_column": 10 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "Mat", "Mat", "Indic", "es", "Test", "Case_", "(_", "MPI", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "setup", "\\u", "model_", "(_", "self_", ",_", "mode_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "asi", "ze_", "=_", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "prob_", "=_", "Problem_", "(_", "root_", "=_", "Group_", "(_", ")_", ",_", "impl_", "=_", "impl_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "root_", "=_", "prob_", "._", "root_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "root_", "._", "ln", "\\u", "solver_", "=_", "Linea", "r", "Gau", "ss", "Sei", "del_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "root_", "._", "ln", "\\u", "solver_", "._", "options_", "[_", "'", "mode", "'_", "]_", "=_", "mode_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "p_", "=_", "root_", "._", "add_", "(_", "'", "p", "'_", ",_", "Inde", "p", "Var", "Comp_", "(_", "'", "x", "'_", ",_", "np_", "._", "arange_", "(_", "asi", "ze_", ",_", "dtype_", "=_", "float_", ")_", "+_", "1.0_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "G1_", "=_", "root_", "._", "add_", "(_", "'", "G1", "'_", ",_", "Parallel", "Group_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "G1_", "._", "ln", "\\u", "solver_", "=_", "Linea", "r", "Gau", "ss", "Sei", "del_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "G1_", "._", "ln", "\\u", "solver_", "._", "options_", "[_", "'", "mode", "'_", "]_", "=_", "mode_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "c2_", "=_", "G1_", "._", "add_", "(_", "'", "c2", "'_", ",_", "Exe", "c", "Comp", "4", "Test_", "(_", "'", "y", " ", "=", " ", "x", " ", "*", " ", "2.0", "'_", ",_", "lin", "\\u", "delay_", "=_", "1.0_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "x_", "=_", "np_", "._", "zeros_", "(_", "asi", "ze_", ")_", ",_", "y_", "=_", "np_", "._", "zeros_", "(_", "asi", "ze_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "c3_", "=_", "G1_", "._", "add_", "(_", "'", "c3", "'_", ",_", "Exe", "c", "Comp", "4", "Test_", "(_", "'", "y", " ", "=", " ", "nump", "y", ".", "ones", "(", "3", ").", "T", "*", "x", ".", "dot", "(", "nump", "y", ".", "aran", "ge", "(", "3", ".,", "6", ".)", ")'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "lin", "\\u", "delay_", "=_", "1.0_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "x_", "=_", "np_", "._", "zeros_", "(_", "asi", "ze_", ")_", ",_", "y_", "=_", "np_", "._", "zeros_", "(_", "asi", "ze_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "c4_", "=_", "root_", "._", "add_", "(_", "'", "c4", "'_", ",_", "Exe", "c", "Comp", "4", "Test_", "(_", "'", "y", " ", "=", " ", "x", " ", "*", " ", "4.0", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "x_", "=_", "np_", "._", "zeros_", "(_", "asi", "ze_", ")_", ",_", "y_", "=_", "np_", "._", "zeros_", "(_", "asi", "ze_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "c5", "_", "=_", "root_", "._", "add_", "(_", "'", "c5", "'_", ",_", "Exe", "c", "Comp", "4", "Test_", "(_", "'", "y", " ", "=", " ", "x", " ", "*", " ", "5.0", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "x_", "=_", "np_", "._", "zeros_", "(_", "asi", "ze_", ")_", ",_", "y_", "=_", "np_", "._", "zeros_", "(_", "asi", "ze_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "prob_", "._", "driver_", "._", "add", "\\u", "des", "var_", "(_", "'", "p", ".", "x", "'_", ",_", "indices_", "=_", "[_", "1_", ",_", "2_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "prob_", "._", "driver_", "._", "add", "\\u", "constraint_", "(_", "'", "c4", ".", "y", "'_", ",_", "upper_", "=_", "0.0_", ",_", "indices_", "=_", "[_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "prob_", "._", "driver_", "._", "add", "\\u", "constraint_", "(_", "'", "c5", ".", "y", "'_", ",_", "upper_", "=_", "0.0_", ",_", "indices_", "=_", "[_", "2_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "prob_", "._", "driver_", "._", "parall", "el", "\\u", "deriv", "s_", "(_", "[_", "'", "c4", ".", "y", "'_", ",_", "'", "c5", ".", "y", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "root_", "._", "connect_", "(_", "'", "p", ".", "x", "'_", ",_", "'", "G1", ".", "c2", ".", "x", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "root_", "._", "connect_", "(_", "'", "p", ".", "x", "'_", ",_", "'", "G1", ".", "c3", ".", "x", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "root_", "._", "connect_", "(_", "'", "G1", ".", "c2", ".", "y", "'_", ",_", "'", "c4", ".", "x", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "root_", "._", "connect_", "(_", "'", "G1", ".", "c3", ".", "y", "'_", ",_", "'", "c5", ".", "x", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "prob_", "._", "setup_", "(_", "check_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "prob_", "._", "run_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "prob_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Indic", "es", "Test", "Case", "2_", "(_", "MPI", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "setup", "\\u", "model_", "(_", "self_", ",_", "mode_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "asi", "ze_", "=_", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "prob_", "=_", "Problem_", "(_", "root_", "=_", "Group_", "(_", ")_", ",_", "impl_", "=_", "impl_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "root_", "=_", "prob_", "._", "root_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "root_", "._", "ln", "\\u", "solver_", "=_", "Linea", "r", "Gau", "ss", "Sei", "del_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "root_", "._", "ln", "\\u", "solver_", "._", "options_", "[_", "'", "mode", "'_", "]_", "=_", "mode_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "G1_", "=_", "root_", "._", "add_", "(_", "'", "G1", "'_", ",_", "Parallel", "Group_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "G1_", "._", "ln", "\\u", "solver_", "._", "options_", "[_", "'", "mode", "'_", "]_", "=_", "mode_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "par", "1_", "=_", "G1_", "._", "add_", "(_", "'", "par", "1", "'_", ",_", "Group_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "par", "2_", "=_", "G1_", "._", "add_", "(_", "'", "par", "2", "'_", ",_", "Group_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "p1_", "=_", "par", "1_", "._", "add_", "(_", "'", "p", "'_", ",_", "Inde", "p", "Var", "Comp_", "(_", "'", "x", "'_", ",_", "np_", "._", "arange_", "(_", "asi", "ze_", ",_", "dtype_", "=_", "float_", ")_", "+_", "1.0_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "p2_", "=_", "par", "2_", "._", "add_", "(_", "'", "p", "'_", ",_", "Inde", "p", "Var", "Comp_", "(_", "'", "x", "'_", ",_", "np_", "._", "arange_", "(_", "asi", "ze_", ",_", "dtype_", "=_", "float_", ")_", "+_", "10.0_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "c2_", "=_", "par", "1_", "._", "add_", "(_", "'", "c2", "'_", ",_", "Exe", "c", "Comp", "4", "Test_", "(_", "'", "y", " ", "=", " ", "x", " ", "*", " ", "2.0", "'_", ",_", "lin", "\\u", "delay_", "=_", "1.0_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "x_", "=_", "np_", "._", "zeros_", "(_", "asi", "ze_", ")_", ",_", "y_", "=_", "np_", "._", "zeros_", "(_", "asi", "ze_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "c3_", "=_", "par", "2_", "._", "add_", "(_", "'", "c3", "'_", ",_", "Exe", "c", "Comp", "4", "Test_", "(_", "'", "y", " ", "=", " ", "nump", "y", ".", "ones", "(", "3", ").", "T", "*", "x", ".", "dot", "(", "nump", "y", ".", "aran", "ge", "(", "3", ".,", "6", ".)", ")'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "lin", "\\u", "delay_", "=_", "1.0_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "x_", "=_", "np_", "._", "zeros_", "(_", "asi", "ze_", ")_", ",_", "y_", "=_", "np_", "._", "zeros_", "(_", "asi", "ze_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "c4_", "=_", "par", "1_", "._", "add_", "(_", "'", "c4", "'_", ",_", "Exe", "c", "Comp", "4", "Test_", "(_", "'", "y", " ", "=", " ", "x", " ", "*", " ", "4.0", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "x_", "=_", "np_", "._", "zeros_", "(_", "asi", "ze_", ")_", ",_", "y_", "=_", "np_", "._", "zeros_", "(_", "asi", "ze_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "c5", "_", "=_", "par", "2_", "._", "add_", "(_", "'", "c5", "'_", ",_", "Exe", "c", "Comp", "4", "Test_", "(_", "'", "y", " ", "=", " ", "x", " ", "*", " ", "5.0", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "x_", "=_", "np_", "._", "zeros_", "(_", "asi", "ze_", ")_", ",_", "y_", "=_", "np_", "._", "zeros_", "(_", "asi", "ze_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "prob_", "._", "driver_", "._", "add", "\\u", "des", "var_", "(_", "'", "G1", ".", "par", "1", ".", "p", ".", "x", "'_", ",_", "indices_", "=_", "[_", "1_", ",_", "2_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "prob_", "._", "driver_", "._", "add", "\\u", "des", "var_", "(_", "'", "G1", ".", "par", "2", ".", "p", ".", "x", "'_", ",_", "indices_", "=_", "[_", "1_", ",_", "2_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "prob_", "._", "driver_", "._", "add", "\\u", "constraint_", "(_", "'", "G1", ".", "par", "1", ".", "c4", ".", "y", "'_", ",_", "upper_", "=_", "0.0_", ",_", "indices_", "=_", "[_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "prob_", "._", "driver_", "._", "add", "\\u", "constraint_", "(_", "'", "G1", ".", "par", "2", ".", "c5", ".", "y", "'_", ",_", "upper_", "=_", "0.0_", ",_", "indices_", "=_", "[_", "2_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "prob_", "._", "driver_", "._", "parall", "el", "\\u", "deriv", "s_", "(_", "[_", "'", "G1", ".", "par", "1", ".", "c4", ".", "y", "'_", ",_", "'", "G1", ".", "par", "2", ".", "c5", ".", "y", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "root_", "._", "connect_", "(_", "'", "G1", ".", "par", "1", ".", "p", ".", "x", "'_", ",_", "'", "G1", ".", "par", "1", ".", "c2", ".", "x", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "root_", "._", "connect_", "(_", "'", "G1", ".", "par", "2", ".", "p", ".", "x", "'_", ",_", "'", "G1", ".", "par", "2", ".", "c3", ".", "x", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "root_", "._", "connect_", "(_", "'", "G1", ".", "par", "1", ".", "c2", ".", "y", "'_", ",_", "'", "G1", ".", "par", "1", ".", "c4", ".", "x", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "root_", "._", "connect_", "(_", "'", "G1", ".", "par", "2", ".", "c3", ".", "y", "'_", ",_", "'", "G1", ".", "par", "2", ".", "c5", ".", "x", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "prob_", "._", "setup_", "(_", "check_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "prob_", "._", "run_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "prob_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]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params.py
[ { "content": "def _string_param_common(input, do_quote=False):\n # TODO, if we pass this to urlencode, do we ever need to quote?\n # For the moment, i'm always forcing non-quote behavior\n do_quote = False\n\n s = None\n if isinstance(input, basestring):\n s = input\n\n elif isinstance(input, bool):\n raise ArgumentError.pyexc(\"Can't use boolean as string\", input)\n\n elif isinstance(input, (int, long, float)):\n # Basic numeric types:\n s = str(input)\n\n else:\n raise ArgumentError.pyexc(\"Expected simple numeric type or string \",\n input)\n if do_quote:\n s = ulp.quote(s)\n\n return s", "metadata": "root._string_param_common", "header": "['module', '___EOS___']", "index": 87 } ]
[ { "span": "s = ulp.quote(s)", "start_line": 107, "start_column": 8, "end_line": 107, "end_column": 24 } ]
[]
1
true
[ "[CLS]_", "Unrea", "chab", "le_", "code_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "string", "\\u", "param", "\\u", "common_", "(_", "input_", ",_", "do", "\\u", "quote_", "=_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "TOD", "O", ",", " ", "if", " ", "we", " ", "pass", " ", "this", " ", "to", " ", "url", "encode", ",", " ", "do", " ", "we", " ", "ever", " ", "need", " ", "to", " ", "quote", "?", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "For", " ", "the", " ", "moment", ",", " ", "i", "'", "m", " ", "alw", "ay", "s", " ", "forcing", " ", "non", "-", "quote", " ", "behavior_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "do", "\\u", "quote_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "s_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "isinstance_", "(_", "input_", ",_", "basestring_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "s_", "=_", "input_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "isinstance_", "(_", "input_", ",_", "bool_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Arg", "ument", "Error_", "._", "pye", "xc_", "(_", "\"", "Can", "'", "t", " ", "use", " ", "boolean", " ", "as", " ", "string", "\"_", ",_", "input_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "isinstance_", "(_", "input_", ",_", "(_", "int_", ",_", "long_", ",_", "float_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Basic", " ", "numeri", "c", " ", "types", ":_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "s_", "=_", "str_", "(_", "input_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Arg", "ument", "Error_", "._", "pye", "xc_", "(_", "\"", "Expect", "ed", " ", "simple", " ", "numeri", "c", " ", "type", " ", "or", " ", "string", " ", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "input_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "do", "\\u", "quote_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "s_", "=_", "ul", "p_", "._", "quote_", "(_", "s_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "s_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2 ]
Unused import
allink/pennyblack/pennyblack/models/link.py
[ { "content": "from django.contrib import admin\nfrom django.core.urlresolvers import resolve\nfrom django.db import models\nfrom django.template import Context, Template, TemplateSyntaxError\nfrom django.utils.translation import ugettext_lazy as _\n\nimport datetime\nimport hashlib\nimport random\n\n#-----------------------------------------------------------------------------\n# Link\n#-----------------------------------------------------------------------------\n\n\n\n \n \n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def is_link(link_original, link_replaced):\n \"\"\"\n Checks if link_replaced resolves to link_original\n \"\"\"\n from pennyblack.models import Link\n if link_replaced == '':\n return False\n # try to find the link and compare it to the header_url but\n # replace the link if something goes wrong\n try:\n link_hash = resolve(link_replaced[len('{{base_url}}'):])[2]['link_hash']\n link = Link.objects.get(link_hash=link_hash)\n if link.link_target == link_original:\n return True\n except:\n pass\n return False", "metadata": "root.is_link", "header": "['module', '___EOS___']", "index": 14 }, { "content": "def check_if_redirect_url(url):\n \"\"\"\n Checks if the url is a redirect url\n \"\"\"\n if '{{base_url}}' == url[:len('{{base_url}}')]:\n try:\n result = resolve(url[len('{{base_url}}'):])\n if result[0].func_name == 'redirect_link':\n return True\n except:\n pass\n return False", "metadata": "root.check_if_redirect_url", "header": "['module', '___EOS___']", "index": 32 }, { "content": "class Link(models.Model):\n job = models.ForeignKey('pennyblack.Job', related_name='links')\n identifier = models.CharField(max_length=100, default='')\n link_hash = models.CharField(max_length=32, verbose_name=_(\"link hash\"), db_index=True, blank=True)\n link_target = models.CharField(verbose_name=_(\"address\"), max_length=500, default='')\n \n class Meta:\n verbose_name = _('link')\n verbose_name_plural = _('links')\n app_label = 'pennyblack'\n\n \n click_count.short_description = 'Click count'\n \n \n", "metadata": "root.Link", "header": "['module', '___EOS___']", "index": 45 }, { "content": " def __unicode__(self):\n return self.link_target", "metadata": "root.Link.__unicode__", "header": "['class', 'Link', '(', 'models', '.', 'Model', ')', ':', '___EOS___']", "index": 56 }, { "content": " def click_count(self):\n \"\"\"\n Returns the total click count.\n \"\"\"\n return self.clicks.count()", "metadata": "root.Link.click_count", "header": "['class', 'Link', '(', 'models', '.', 'Model', ')', ':', '___EOS___']", "index": 59 }, { "content": " def click(self,mail):\n \"\"\"\n Creates a LinkClick and returns the link target\n \"\"\"\n click = self.clicks.create(mail=mail)\n return self.get_target(mail)", "metadata": "root.Link.click", "header": "['class', 'Link', '(', 'models', '.', 'Model', ')', ':', '___EOS___']", "index": 66 }, { "content": " def get_target(self, mail):\n \"\"\"\n gets the link target by evaluating the string using the email content\n \"\"\"\n from pennyblack.models import Newsletter\n if self.identifier != '':\n return Newsletter.get_view_link(self.identifier)\n template = Template(self.link_target)\n return template.render(Context(mail.get_context()))", "metadata": "root.Link.get_target", "header": "['class', 'Link', '(', 'models', '.', 'Model', ')', ':', '___EOS___']", "index": 73 }, { "content": " def save(self, **kwargs):\n if self.link_hash == u'':\n self.link_hash = hashlib.md5(str(self.id)+str(random.random())).hexdigest()\n super(Link, self).save(**kwargs)", "metadata": "root.Link.save", "header": "['class', 'Link', '(', 'models', '.', 'Model', ')', ':', '___EOS___']", "index": 83 }, { "content": "class LinkClick(models.Model):\n link = models.ForeignKey('pennyblack.Link', related_name='clicks')\n mail = models.ForeignKey('pennyblack.Mail', related_name='clicks')\n date = models.DateTimeField(default=datetime.datetime.now())\n \n class Meta:\n app_label = 'pennyblack'", "metadata": "root.LinkClick", "header": "['module', '___EOS___']", "index": 88 }, { "content": "class LinkInline(admin.TabularInline):\n model = Link\n max_num = 0\n can_delete = False\n fields = ('link_target', 'link_hash',)\n readonly_fields = ('link_hash',)\n ", "metadata": "root.LinkInline", "header": "['module', '___EOS___']", "index": 96 }, { "content": " def queryset(self, request):\n \"\"\"\n Don't show links with identifier because they aren't changable.\n \"\"\"\n queryset = super(LinkInline, self).queryset(request)\n return queryset.filter(identifier='')", "metadata": "root.LinkInline.queryset", "header": "['class', 'LinkInline', '(', 'admin', '.', 'TabularInline', ')', ':', '___EOS___']", "index": 103 } ]
[ { "span": "from django.template import Context, Template, TemplateSyntaxError", "start_line": 3, "start_column": 0, "end_line": 3, "end_column": 66 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "from_", "django_", "._", "contrib_", "import_", "admin_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "core_", "._", "urlresolvers_", "import_", "resolve_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "db_", "import_", "models_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "template_", "import_", "Context_", ",_", "Template_", ",_", "Templa", "te", "Syntax", "Error_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "utils_", "._", "translation_", "import_", "uge", "ttext", "\\u", "lazy_", "as_", "\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "datetime_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "hashlib_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "random_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#-", "--------------", "--------------", "--------------", "--------------", "--------------", "------", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Link_", "\\u\\u\\uNL\\u\\u\\u_", "#-", "--------------", "--------------", "--------------", "--------------", "--------------", "------", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "is", "\\u", "link_", "(_", "link", "\\u", "original_", ",_", "link", "\\u", "replaced", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Check", "s", " ", "if", " ", "link", "\\u", "replaced", " ", "resolve", "s", " ", "to", " ", "link", "\\u", "original", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "pen", "ny", "black_", "._", "models_", "import_", "Link_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "link", "\\u", "replaced", "_", "==_", "''_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "try", " ", "to", " ", "find", " ", "the", " ", "link", " ", "and", " ", "compare", " ", "it", " ", "to", " ", "the", " ", "header", "\\u", "url", " ", "but", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "replace", " ", "the", " ", "link", " ", "if", " ", "somet", "hing", " ", "go", "es", " ", "wrong", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "link", "\\u", "hash_", "=_", "resolve_", "(_", "link", "\\u", "replaced", "_", "[_", "len_", "(_", "'{{", "base", "\\u", "url", "}}'_", ")_", ":_", "]_", ")_", "[_", "2_", "]_", "[_", "'", "link", "\\u", "hash", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "link_", "=_", "Link_", "._", "objects_", "._", "get_", "(_", "link", "\\u", "hash_", "=_", "link", "\\u", "hash_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "link_", "._", "link", "\\u", "target_", "==_", "link", "\\u", "original_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "check", "\\u", "if", "\\u", "redirec", "t", "\\u", "url_", "(_", "url_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Check", "s", " ", "if", " ", "the", " ", "url", " ", "is", " ", "a", " ", "redirec", "t", " ", "url", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "'{{", "base", "\\u", "url", "}}'_", "==_", "url_", "[_", ":_", "len_", "(_", "'{{", "base", "\\u", "url", "}}'_", ")_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "=_", "resolve_", "(_", "url_", "[_", "len_", "(_", "'{{", "base", "\\u", "url", "}}'_", ")_", ":_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "result_", "[_", "0_", "]_", "._", "func", "\\u", "name_", "==_", "'", "redirec", "t", "\\u", "link", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Link_", "(_", "models_", "._", "Model_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "job_", "=_", "models_", "._", "Fore", "ign", "Key_", "(_", "'", "pen", "ny", "black", ".", "Jo", "b", "'_", ",_", "relate", "d\\u", "name_", "=_", "'", "link", "s", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "identifier_", "=_", "models_", "._", "Char", "Field_", "(_", "max", "\\u", "length_", "=_", "100_", ",_", "default_", "=_", "''_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "link", "\\u", "hash_", "=_", "models_", "._", "Char", "Field_", "(_", "max", "\\u", "length_", "=_", "32_", ",_", "verbo", "se", "\\u", "name_", "=_", "\\u_", "(_", "\"", "link", " ", "hash", "\"_", ")_", ",_", "db", "\\u", "index_", "=_", "True_", ",_", "blank_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "link", "\\u", "target_", "=_", "models_", "._", "Char", "Field_", "(_", "verbo", "se", "\\u", "name_", "=_", "\\u_", "(_", "\"", "address", "\"_", ")_", ",_", "max", "\\u", "length_", "=_", "500_", ",_", "default_", "=_", "''_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Meta_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "verbo", "se", "\\u", "name_", "=_", "\\u_", "(_", "'", "link", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "verbo", "se", "\\u", "name", "\\u", "plural_", "=_", "\\u_", "(_", "'", "link", "s", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "app", "\\u", "label_", "=_", "'", "pen", "ny", "black", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "click", "\\u", "count_", "._", "short", "\\u", "description_", "=_", "'", "Click", " ", "count", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Link_", "(_", "models_", "._", "Model_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "unicode\\u\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "link", "\\u", "target_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Link_", "(_", "models_", "._", "Model_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "click", "\\u", "count_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", " ", "the", " ", "total", " ", "click", " ", "count", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "clicks", "_", "._", "count_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Link_", "(_", "models_", "._", "Model_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "click_", "(_", "self_", ",_", "mail_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Creat", "es", " ", "a", " ", "Link", "Click", " ", "and", " ", "return", "s", " ", "the", " ", "link", " ", "target", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "click_", "=_", "self_", "._", "clicks", "_", "._", "create_", "(_", "mail_", "=_", "mail_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "get", "\\u", "target_", "(_", "mail_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Link_", "(_", "models_", "._", "Model_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "target_", "(_", "self_", ",_", "mail_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "gets", " ", "the", " ", "link", " ", "target", " ", "by", " ", "evaluat", "ing", " ", "the", " ", "string", " ", "usi", "ng", " ", "the", " ", "email", " ", "content", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "pen", "ny", "black_", "._", "models_", "import_", "News", "letter_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "identifier_", "!=_", "''_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "News", "letter_", "._", "get", "\\u", "view", "\\u", "link_", "(_", "self_", "._", "identifier_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "template_", "=_", "Template_", "(_", "self_", "._", "link", "\\u", "target_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "template_", "._", "render_", "(_", "Context_", "(_", "mail_", "._", "get", "\\u", "context_", "(_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Link_", "(_", "models_", "._", "Model_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "save_", "(_", "self_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "link", "\\u", "hash_", "==_", "u", "''_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "link", "\\u", "hash_", "=_", "hashlib_", "._", "md5_", "(_", "str_", "(_", "self_", "._", "id_", ")_", "+_", "str_", "(_", "random_", "._", "random_", "(_", ")_", ")_", ")_", "._", "hexdigest_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "super_", "(_", "Link_", ",_", "self_", ")_", "._", "save_", "(_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Link", "Click_", "(_", "models_", "._", "Model_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "link_", "=_", "models_", "._", "Fore", "ign", "Key_", "(_", "'", "pen", "ny", "black", ".", "Link", "'_", ",_", "relate", "d\\u", "name_", "=_", "'", "clicks", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mail_", "=_", "models_", "._", "Fore", "ign", "Key_", "(_", "'", "pen", "ny", "black", ".", "Mail", "'_", ",_", "relate", "d\\u", "name_", "=_", "'", "clicks", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "date_", "=_", "models_", "._", "Date", "Time", "Field_", "(_", "default_", "=_", "datetime_", "._", "datetime_", "._", "now_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Meta_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "app", "\\u", "label_", "=_", "'", "pen", "ny", "black", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Link", "Inline_", "(_", "admin_", "._", "Tab", "ular", "Inline_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "model_", "=_", "Link_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "max", "\\u", "num_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "can", "\\u", "delete_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fields_", "=_", "(_", "'", "link", "\\u", "target", "'_", ",_", "'", "link", "\\u", "hash", "'_", ",_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "read", "only", "\\u", "fields_", "=_", "(_", "'", "link", "\\u", "hash", "'_", ",_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Link", "Inline_", "(_", "admin_", "._", "Tab", "ular", "Inline_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "queryset_", "(_", "self_", ",_", "request_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Don", "'", "t", " ", "show", " ", "link", "s", " ", "with", " ", "identifi", "er", " ", "bec", "aus", "e", " ", "the", "y", " ", "are", "n", "'", "t", " ", "chang", "able", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "queryset_", "=_", "super_", "(_", "Link", "Inline_", ",_", "self_", ")_", "._", "queryset_", "(_", "request_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "queryset_", "._", "filter_", "(_", "identifier_", "=_", "''_", ")_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
kuri65536/python-for-android/python-modules/pybluez/examples/advanced/read-local-bdaddr.py
[ { "content": "import os\nimport sys\nimport struct\nimport bluetooth._bluetooth as _bt\n\n\nif __name__ == \"__main__\":\n dev_id = 0\n hci_sock = _bt.hci_open_dev(dev_id)\n bdaddr = read_local_bdaddr(hci_sock)\n print bdaddr\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def read_local_bdaddr(hci_sock):\n old_filter = hci_sock.getsockopt( _bt.SOL_HCI, _bt.HCI_FILTER, 14)\n flt = _bt.hci_filter_new()\n opcode = _bt.cmd_opcode_pack(_bt.OGF_INFO_PARAM, \n _bt.OCF_READ_BD_ADDR)\n _bt.hci_filter_set_ptype(flt, _bt.HCI_EVENT_PKT)\n _bt.hci_filter_set_event(flt, _bt.EVT_CMD_COMPLETE);\n _bt.hci_filter_set_opcode(flt, opcode)\n hci_sock.setsockopt( _bt.SOL_HCI, _bt.HCI_FILTER, flt )\n\n _bt.hci_send_cmd(hci_sock, _bt.OGF_INFO_PARAM, _bt.OCF_READ_BD_ADDR )\n\n pkt = hci_sock.recv(255)\n\n status,raw_bdaddr = struct.unpack(\"xxxxxxB6s\", pkt)\n assert status == 0\n\n t = [ \"%X\" % ord(b) for b in raw_bdaddr ]\n t.reverse()\n bdaddr = \":\".join(t)\n\n # restore old filter\n hci_sock.setsockopt( _bt.SOL_HCI, _bt.HCI_FILTER, old_filter )\n return bdaddr", "metadata": "root.read_local_bdaddr", "header": "['module', '___EOS___']", "index": 5 } ]
[ { "span": "import os", "start_line": 0, "start_column": 0, "end_line": 0, "end_column": 9 }, { "span": "import sys", "start_line": 1, "start_column": 0, "end_line": 1, "end_column": 10 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "struct_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "bluetooth", "_", "._", "\\u", "bluetooth", "_", "as_", "\\u", "bt_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "\\u\\u", "name\\u\\u_", "==_", "\"\\u\\u", "main", "\\u\\u\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "dev", "\\u", "id_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "hc", "i", "\\u", "sock_", "=_", "\\u", "bt_", "._", "hc", "i", "\\u", "open", "\\u", "dev_", "(_", "dev", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bda", "ddr_", "=_", "read", "\\u", "local", "\\u", "bda", "ddr_", "(_", "hc", "i", "\\u", "sock_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "bda", "ddr_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "read", "\\u", "local", "\\u", "bda", "ddr_", "(_", "hc", "i", "\\u", "sock_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "old", "\\u", "filter_", "=_", "hc", "i", "\\u", "sock_", "._", "gets", "ock", "opt_", "(_", "\\u", "bt_", "._", "SOL", "\\u", "HC", "I_", ",_", "\\u", "bt_", "._", "HC", "I", "\\u", "FILTER_", ",_", "14_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "flt_", "=_", "\\u", "bt_", "._", "hc", "i", "\\u", "filter", "\\u", "new_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "opcode_", "=_", "\\u", "bt_", "._", "cmd", "\\u", "opcode", "\\u", "pack_", "(_", "\\u", "bt_", "._", "OG", "F", "\\u", "INFO", "\\u", "PARAM_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "bt_", "._", "OC", "F", "\\u", "READ", "\\u", "BD", "\\u", "ADDR_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "bt_", "._", "hc", "i", "\\u", "filter", "\\u", "set\\u", "ptype_", "(_", "flt_", ",_", "\\u", "bt_", "._", "HC", "I", "\\u", "EVENT", "\\u", "PK", "T_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "bt_", "._", "hc", "i", "\\u", "filter", "\\u", "set\\u", "event_", "(_", "flt_", ",_", "\\u", "bt_", "._", "EV", "T", "\\u", "CMD", "\\u", "COMPLETE_", ")_", ";_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "bt_", "._", "hc", "i", "\\u", "filter", "\\u", "set\\u", "opcode_", "(_", "flt_", ",_", "opcode_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "hc", "i", "\\u", "sock_", "._", "setsockopt_", "(_", "\\u", "bt_", "._", "SOL", "\\u", "HC", "I_", ",_", "\\u", "bt_", "._", "HC", "I", "\\u", "FILTER_", ",_", "flt_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "bt_", "._", "hc", "i", "\\u", "send", "\\u", "cmd_", "(_", "hc", "i", "\\u", "sock_", ",_", "\\u", "bt_", "._", "OG", "F", "\\u", "INFO", "\\u", "PARAM_", ",_", "\\u", "bt_", "._", "OC", "F", "\\u", "READ", "\\u", "BD", "\\u", "ADDR_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "pkt_", "=_", "hc", "i", "\\u", "sock_", "._", "recv_", "(_", "255_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "status_", ",_", "raw", "\\u", "bda", "ddr_", "=_", "struct_", "._", "unpack_", "(_", "\"", "xxxxxx", "B6", "s", "\"_", ",_", "pkt_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "status_", "==_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "t_", "=_", "[_", "\"%", "X", "\"_", "%_", "ord_", "(_", "b_", ")_", "for_", "b_", "in_", "raw", "\\u", "bda", "ddr_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t_", "._", "reverse_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bda", "ddr_", "=_", "\":\"_", "._", "join_", "(_", "t_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "restore", " ", "old", " ", "filter_", "\\u\\u\\uNL\\u\\u\\u_", "hc", "i", "\\u", "sock_", "._", "setsockopt_", "(_", "\\u", "bt_", "._", "SOL", "\\u", "HC", "I_", ",_", "\\u", "bt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 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
ionelmc/django-admin-utils/setup.py
[ { "content": "#!/usr/bin/env python\n# -*- encoding: utf-8 -*-\nfrom __future__ import absolute_import, print_function\n\nimport io\nimport os\nimport re\nfrom glob import glob\nfrom os.path import basename\nfrom os.path import dirname\nfrom os.path import join\nfrom os.path import relpath\nfrom os.path import splitext\n\nfrom setuptools import find_packages\nfrom setuptools import setup\n\n\n\nsetup(\n name='django-admin-utils',\n version='0.3.0',\n license='BSD',\n description='Utility code and patterns.',\n long_description=read('README.rst'),\n author='Ionel Cristian Maries',\n author_email='[email protected]',\n url='https://github.com/ionelmc/django-admin-utils',\n packages=find_packages('src'),\n package_dir={'': 'src'},\n py_modules=[splitext(basename(path))[0] for path in glob('src/*.py')],\n include_package_data=True,\n zip_safe=False,\n classifiers=[\n 'Development Status :: 5 - Production/Stable',\n 'Framework :: Django',\n 'Intended Audience :: Developers',\n 'License :: OSI Approved :: BSD License',\n 'Operating System :: Unix',\n 'Operating System :: POSIX',\n 'Operating System :: Microsoft :: Windows',\n 'Operating System :: OS Independent',\n 'Programming Language :: Python',\n 'Topic :: Internet :: WWW/HTTP',\n 'Programming Language :: Python',\n 'Programming Language :: Python :: 2.6',\n 'Programming Language :: Python :: 2.7',\n 'Programming Language :: Python :: 3',\n 'Programming Language :: Python :: 3.3',\n 'Programming Language :: Python :: 3.4',\n 'Programming Language :: Python :: Implementation :: CPython',\n 'Programming Language :: Python :: Implementation :: PyPy',\n 'Topic :: Utilities',\n ],\n install_requires=[\n 'Django>=1.1',\n ]\n)\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def read(*names, **kwargs):\n return io.open(\n join(dirname(__file__), *names),\n encoding=kwargs.get('encoding', 'utf8')\n ).read()", "metadata": "root.read", "header": "['module', '___EOS___']", "index": 17 } ]
[ { "span": "import os", "start_line": 5, "start_column": 0, "end_line": 5, "end_column": 9 }, { "span": "import re", "start_line": 6, "start_column": 0, "end_line": 6, "end_column": 9 }, { "span": "from os.path import relpath", "start_line": 11, "start_column": 0, "end_line": 11, "end_column": 27 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#!", "/", "usr", "/", "bin", "/", "env", " ", "python_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "-*-", " ", "encoding", ":", " ", "utf", "-", "8", " ", "-*-", "_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "\\u\\u", "future\\u\\u_", "import_", "abs", "olute", "\\u", "import_", ",_", "print", "\\u", "function_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "io_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "re_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "glob_", "import_", "glob_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "os_", "._", "path_", "import_", "basename_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "os_", "._", "path_", "import_", "dirname_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "os_", "._", "path_", "import_", "join_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "os_", "._", "path_", "import_", "relpath_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "os_", "._", "path_", "import_", "splitext_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "setuptools_", "import_", "find", "\\u", "packages_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "setuptools_", "import_", "setup_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "setup_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "name_", "=_", "'", "django", "-", "admin", "-", "util", "s", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "version_", "=_", "'", "0.", "3.0", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "license_", "=_", "'", "BS", "D", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "description_", "=_", "'", "Utili", "ty", " ", "code", " ", "and", " ", "pattern", "s", ".'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "long", "\\u", "description_", "=_", "read_", "(_", "'", "READ", "ME", ".", "rst", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "author_", "=_", "'", "Io", "nel", " ", "Cri", "sti", "an", " ", "Mari", "es", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "author", "\\u", "email_", "=_", "'", "contact", "@", "ione", "lm", "c", ".", "ro", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "url_", "=_", "'", "https", "://", "git", "hub", ".", "com", "/", "ione", "lm", "c", "/", "django", "-", "admin", "-", "util", "s", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "packages_", "=_", "find", "\\u", "packages_", "(_", "'", "src", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "package", "\\u", "dir_", "=_", "{_", "''_", ":_", "'", "src", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "py", "\\u", "modules_", "=_", "[_", "splitext_", "(_", "basename_", "(_", "path_", ")_", ")_", "[_", "0_", "]_", "for_", "path_", "in_", "glob_", "(_", "'", "src", "/*", ".", "py", "'_", ")_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "include", "\\u", "package", "\\u", "data_", "=_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "zip", "\\u", "safe_", "=_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "classifiers_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Dev", "elo", "pme", "nt", " ", "Status", " ", "::", " ", "5", " ", "-", " ", "Product", "ion", "/", "Sta", "ble", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Frame", "work", " ", "::", " ", "Dj", "ang", "o", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Inten", "ded", " ", "Audi", "ence", " ", "::", " ", "Dev", "elope", "rs", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "License", " ", "::", " ", "OSI", " ", "Appro", "ved", " ", "::", " ", "BS", "D", " ", "License", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Opera", "ting", " ", "System", " ", "::", " ", "Uni", "x", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Opera", "ting", " ", "System", " ", "::", " ", "POSI", "X", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Opera", "ting", " ", "System", " ", "::", " ", "Micro", "soft", " ", "::", " ", "Window", "s", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Opera", "ting", " ", "System", " ", "::", " ", "OS", " ", "Inde", "pend", "ent", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Programm", "ing", " ", "Lang", "ua", "ge", " ", "::", " ", "Pyth", "on", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Topic", " ", "::", " ", "Intern", "et", " ", "::", " ", "WW", "W", "/", "HTTP", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Programm", "ing", " ", "Lang", "ua", "ge", " ", "::", " ", "Pyth", "on", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Programm", "ing", " ", "Lang", "ua", "ge", " ", "::", " ", "Pyth", "on", " ", "::", " ", "2.6", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Programm", "ing", " ", "Lang", "ua", "ge", " ", "::", " ", "Pyth", "on", " ", "::", " ", "2.7", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Programm", "ing", " ", "Lang", "ua", "ge", " ", "::", " ", "Pyth", "on", " ", "::", " ", "3", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Programm", "ing", " ", "Lang", "ua", "ge", " ", "::", " ", "Pyth", "on", " ", "::", " ", "3.3", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Programm", "ing", " ", "Lang", "ua", "ge", " ", "::", " ", "Pyth", "on", " ", "::", " ", "3.4", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Programm", "ing", " ", "Lang", "ua", "ge", " ", "::", " ", "Pyth", "on", " ", "::", " ", "Implementation", " ", "::", " ", "CP", "yth", "on", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Programm", "ing", " ", "Lang", "ua", "ge", " ", "::", " ", "Pyth", "on", " ", "::", " ", "Implementation", " ", "::", " ", "Py", "Py", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Topic", " ", "::", " ", "Utili", "ties", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "install", "\\u", "requires_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Dj", "ang", "o", ">=", "1.1", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "read_", "(_", "*_", "names_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "io_", "._", "open_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "join_", "(_", "dirname_", "(_", "\\u\\u", "file\\u\\u_", ")_", ",_", "*_", "names_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "encoding_", "=_", "kwargs_", "._", "get_", "(_", "'", "encoding", "'_", ",_", "'", "utf", "8", "'_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "._", "read_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 2, 0, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
dmpayton/django-admin-honeypot/setup.py
[ { "content": "#!/usr/bin/env python\nimport sys\nfrom admin_honeypot import __version__, __description__, __license__\n\ntry:\n from setuptools import setup, find_packages\nexcept ImportError:\n from distutils.core import setup, find_packages\n\nsetup(\n name='django-admin-honeypot',\n version=__version__,\n description=__description__,\n long_description=open('./README.rst', 'r').read(),\n classifiers=[\n 'Development Status :: 5 - Production/Stable',\n 'Framework :: Django',\n 'Intended Audience :: Developers',\n 'License :: OSI Approved :: MIT License',\n 'Natural Language :: English',\n 'Operating System :: OS Independent',\n 'Programming Language :: Python',\n 'Programming Language :: Python :: 2',\n 'Programming Language :: Python :: 2.7',\n 'Programming Language :: Python :: 3',\n 'Programming Language :: Python :: 3.3',\n 'Programming Language :: Python :: 3.4',\n 'Programming Language :: Python :: 3.5',\n 'Topic :: Internet :: WWW/HTTP :: Dynamic Content',\n ],\n keywords='django admin honeypot trap',\n maintainer='Derek Payton',\n maintainer_email='[email protected]',\n url='https://github.com/dmpayton/django-admin-honeypot',\n download_url='https://github.com/dmpayton/django-admin-honeypot/tarball/v%s' % __version__,\n license=__license__,\n include_package_data=True,\n packages=find_packages(),\n zip_safe=False,\n )\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[ { "span": "import sys", "start_line": 1, "start_column": 0, "end_line": 1, "end_column": 10 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#!", "/", "usr", "/", "bin", "/", "env", " ", "python_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "admin", "\\u", "honey", "pot_", "import_", "\\u\\u", "version\\u\\u_", ",_", "\\u\\u", "description", "\\u\\u_", ",_", "\\u\\u", "license\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "setuptools_", "import_", "setup_", ",_", "find", "\\u", "packages_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Import", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "distutils_", "._", "core_", "import_", "setup_", ",_", "find", "\\u", "packages_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "setup_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "name_", "=_", "'", "django", "-", "admin", "-", "honey", "pot", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "version_", "=_", "\\u\\u", "version\\u\\u_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "description_", "=_", "\\u\\u", "description", "\\u\\u_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "long", "\\u", "description_", "=_", "open_", "(_", "'./", "READ", "ME", ".", "rst", "'_", ",_", "'", "r", "'_", ")_", "._", "read_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "classifiers_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Dev", "elo", "pme", "nt", " ", "Status", " ", "::", " ", "5", " ", "-", " ", "Product", "ion", "/", "Sta", "ble", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Frame", "work", " ", "::", " ", "Dj", "ang", "o", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Inten", "ded", " ", "Audi", "ence", " ", "::", " ", "Dev", "elope", "rs", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "License", " ", "::", " ", "OSI", " ", "Appro", "ved", " ", "::", " ", "MIT", " ", "License", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Nat", "ural", " ", "Lang", "ua", "ge", " ", "::", " ", "Eng", "lish", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Opera", "ting", " ", "System", " ", "::", " ", "OS", " ", "Inde", "pend", "ent", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Programm", "ing", " ", "Lang", "ua", "ge", " ", "::", " ", "Pyth", "on", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Programm", "ing", " ", "Lang", "ua", "ge", " ", "::", " ", "Pyth", "on", " ", "::", " ", "2", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Programm", "ing", " ", "Lang", "ua", "ge", " ", "::", " ", "Pyth", "on", " ", "::", " ", "2.7", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Programm", "ing", " ", "Lang", "ua", "ge", " ", "::", " ", "Pyth", "on", " ", "::", " ", "3", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Programm", "ing", " ", "Lang", "ua", "ge", " ", "::", " ", "Pyth", "on", " ", "::", " ", "3.3", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Programm", "ing", " ", "Lang", "ua", "ge", " ", "::", " ", "Pyth", "on", " ", "::", " ", "3.4", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Programm", "ing", " ", "Lang", "ua", "ge", " ", "::", " ", "Pyth", "on", " ", "::", " ", "3.5", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Topic", " ", "::", " ", "Intern", "et", " ", "::", " ", "WW", "W", "/", "HTTP", " ", "::", " ", "Dynamic", " ", "Conten", "t", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "keywords_", "=_", "'", "django", " ", "admin", " ", "honey", "pot", " ", "trap", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "maintainer_", "=_", "'", "Der", "ek", " ", "Pay", "ton", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "maintainer", "\\u", "email_", "=_", "'", "dere", "k", ".", "pay", "ton", "@", "gma", "il", ".", "com", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "url_", "=_", "'", "https", "://", "git", "hub", ".", "com", "/", "dmp", "ay", "ton", "/", "django", "-", "admin", "-", "honey", "pot", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "download", "\\u", "url_", "=_", "'", "https", "://", "git", "hub", ".", "com", "/", "dmp", "ay", "ton", "/", "django", "-", "admin", "-", "honey", "pot", "/", "tarball", "/", "v", "%", "s", "'_", "%_", "\\u\\u", "version\\u\\u_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "license_", "=_", "\\u\\u", "license\\u\\u_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "include", "\\u", "package", "\\u", "data_", "=_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "packages_", "=_", "find", "\\u", "packages_", "(_", ")_", ",_", "\\u\\u\\uNL\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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused local variable
tjguk/winsys/winsys/dialogs.py
[ { "content": "def _register_wndclass():\n \"\"\"Register a simple window with default cursor, icon, etc.\n \"\"\"\n class_name = str(uuid.uuid1())\n wc = wrapped(win32gui.WNDCLASS)\n wc.SetDialogProc()\n wc.hInstance = win32gui.dllhandle\n wc.lpszClassName = class_name\n wc.style = win32con.CS_VREDRAW | win32con.CS_HREDRAW\n wc.hCursor = wrapped(win32gui.LoadCursor, 0, win32con.IDC_ARROW)\n wc.hbrBackground = win32con.COLOR_WINDOW + 1\n wc.lpfnWndProc = {}\n wc.cbWndExtra = win32con.DLGWINDOWEXTRA + struct.calcsize(b\"Pi\")\n icon_flags = win32con.LR_LOADFROMFILE | win32con.LR_DEFAULTSIZE\n\n python_exe = wrapped(win32api.GetModuleHandle, None)\n if not hasattr(sys, \"frozen\"):\n wc.hIcon = wrapped(win32gui.LoadIcon, python_exe, 1)\n class_atom = wrapped(win32gui.RegisterClass, wc)\n return class_name", "metadata": "root._register_wndclass", "header": "['module', '___EOS___']", "index": 172 }, { "content": " def _get_dialog_template(self):\n \"\"\"Put together a sensible default layout for this dialog, taking\n into account the default structure and the (variable) number of fields.\n\n NB Although sensible default positions are chosen here, the horizontal\n layout will be overridden by the :meth:`_resize` functionality below.\n \"\"\"\n dlg_class_name = _register_wndclass()\n style = reduce(operator.or_, (\n win32con.WS_THICKFRAME,\n win32con.WS_POPUP,\n win32con.WS_VISIBLE,\n win32con.WS_CAPTION,\n win32con.WS_SYSMENU,\n win32con.DS_SETFONT,\n win32con.WS_MINIMIZEBOX\n ))\n cs = win32con.WS_CHILD | win32con.WS_VISIBLE\n\n n_fields = len(self.fields) + (1 if self.progress_callback else 0)\n dlg = []\n\n control_t = self.GUTTER_H\n for i, (field, default_value, callback) in enumerate(self.fields):\n label_l = self.GUTTER_W\n label_t = control_t\n field_l = label_l + self.LABEL_W + self.GUTTER_W\n field_t = label_t\n display_h = field_h = self.CONTROL_H\n\n if field is None:\n field_type, sub_type = \"EDIT\", \"READONLY\"\n elif isinstance(default_value, bool):\n field_type, sub_type = \"BUTTON\", \"CHECKBOX\"\n elif isinstance(default_value, tuple):\n field_type, sub_type = \"BUTTON\", \"RADIOBUTTON\"\n elif isinstance(default_value, list):\n field_type, sub_type = \"COMBOBOX\", None\n elif field.upper() == \"PASSWORD\":\n field_type, sub_type = \"EDIT\", \"PASSWORD\"\n else:\n field_type, sub_type = \"EDIT\", None\n\n dlg.append([\"STATIC\", field, self.IDC_LABEL_BASE + i, (label_l, label_t, self.LABEL_W, self.CONTROL_H), cs | win32con.SS_LEFT])\n if field_type != \"STATIC\":\n field_styles = win32con.WS_TABSTOP\n else:\n field_styles = 0\n if (field_type, sub_type) == (\"BUTTON\", \"CHECKBOX\"):\n field_styles |= win32con.BS_AUTOCHECKBOX\n field_w = self.CONTROL_H\n elif (field_type, sub_type) == (\"BUTTON\", \"RADIOBUTTON\"):\n field_styles |= win32con.BS_AUTORADIOBUTTON\n field_w = self.CONTROL_H\n elif field_type == \"COMBOBOX\":\n if callback is not None:\n raise x_dialogs(\"Cannot combine a list with a callback\")\n field_styles |= win32con.CBS_DROPDOWNLIST | win32con.WS_VSCROLL\n field_w = self.FIELD_W\n field_h = 8 * self.CONTROL_H\n display_h = self.CONTROL_H\n elif field_type == \"EDIT\":\n field_styles |= win32con.WS_BORDER | win32con.ES_AUTOHSCROLL | win32con.ES_AUTOVSCROLL\n field_w = self.FIELD_W - ((self.CALLBACK_W) if callback else 0)\n if \"\\r\\n\" in unicode(default_value):\n field_styles |= win32con.ES_MULTILINE\n display_h = field_h = self.CONTROL_H * min(default_value.count(\"\\r\\n\"), 10)\n if sub_type == \"READONLY\":\n field_styles |= win32con.ES_READONLY\n if sub_type == \"PASSWORD\":\n field_styles |= win32con.ES_PASSWORD\n else:\n raise x_dialogs(\"Problemo\", \"_get_dialog_template\", 0)\n\n dlg.append([field_type, None, self.IDC_FIELD_BASE + i, (field_l, field_t, field_w, field_h), cs | field_styles])\n if callback:\n dlg.append([\"BUTTON\", \"...\", self.IDC_CALLBACK_BASE + i, (field_l + field_w + self.GUTTER_W, field_t, self.CALLBACK_W, self.CONTROL_H), cs | win32con.WS_TABSTOP | win32con.BS_PUSHBUTTON])\n\n control_t += display_h + self.GUTTER_H\n\n i += 1\n if self.progress_callback:\n self._progress_id = self.IDC_FIELD_BASE + i\n field_t = control_t\n field_w = self.W - (2 * self.GUTTER_W)\n field_l = self.GUTTER_W\n field_h = self.CONTROL_H\n field_styles = win32con.SS_LEFT\n dlg.append([\"STATIC\", None, self.IDC_FIELD_BASE + i, (field_l, field_t, field_w, field_h), cs | field_styles])\n control_t += field_h + self.GUTTER_H\n\n cs = win32con.WS_CHILD | win32con.WS_VISIBLE | win32con.WS_TABSTOP | win32con.BS_PUSHBUTTON\n button_t = control_t\n for i, (caption, id) in enumerate(reversed(self.BUTTONS)):\n field_h = self.CONTROL_H\n dlg.append ([\"BUTTON\", caption, id, (self.W - ((i + 1) * (self.GUTTER_W + self.BUTTON_W)), button_t, self.BUTTON_W, field_h), cs])\n control_t += field_h + self.GUTTER_H\n\n dlg.insert(0, [self.title, (0, 0, self.W, control_t), style, None, (9, \"Lucida Sans Unicode\"), None, dlg_class_name])\n return dlg", "metadata": "root.BaseDialog._get_dialog_template", "header": "['class', 'BaseDialog', '(', 'object', ')', ':', '___EOS___']", "index": 269 }, { "content": " def _set_item(self, item_id, value):\n \"\"\"Set the current value of an item in the dialog\n \"\"\"\n item_hwnd = wrapped(win32gui.GetDlgItem, self.hwnd, item_id)\n class_name = wrapped(win32gui.GetClassName, item_hwnd)\n styles = wrapped(win32gui.GetWindowLong, self.hwnd, win32con.GWL_STYLE)\n if class_name == \"Edit\":\n if isinstance(value, datetime.date):\n value = value.strftime(\"%d %b %Y\")\n value = unicode(value).replace(\"\\r\\n\", \"\\n\").replace(\"\\n\", \"\\r\\n\")\n wrapped(win32gui.SetDlgItemText, self.hwnd, item_id, value)\n elif class_name == \"Button\":\n #~ if styles & win32con.BS_CHECKBOX:\n SendMessage(item_hwnd, win32con.BM_SETCHECK, int(value), 0)\n #~ elif styles & win32con.BS_RADIOBUTTON:\n elif class_name == \"ComboBox\":\n for item in value:\n if isinstance(item, tuple):\n item = item[0]\n SendMessage(item_hwnd, win32con.CB_ADDSTRING, 0, utils.string_as_pointer(str(item)))\n SendMessage(item_hwnd, win32con.CB_SETCURSEL, 0, 0)\n elif class_name == \"Static\":\n wrapped(win32gui.SetDlgItemText, self.hwnd, item_id, unicode(value))\n else:\n raise RuntimeError(\"Unknown class: %s\" % class_name)", "metadata": "root.Dialog._set_item", "header": "['class', 'Dialog', '(', 'BaseDialog', ')', ':', '___EOS___']", "index": 547 } ]
[ { "span": "icon_flags ", "start_line": 185, "start_column": 4, "end_line": 185, "end_column": 14 }, { "span": "class_atom ", "start_line": 190, "start_column": 4, "end_line": 190, "end_column": 14 }, { "span": "n_fields ", "start_line": 288, "start_column": 8, "end_line": 288, "end_column": 16 }, { "span": "styles ", "start_line": 552, "start_column": 8, "end_line": 552, "end_column": 14 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "register", "\\u", "wnd", "class_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Register", " ", "a", " ", "simple", " ", "window", " ", "with", " ", "default", " ", "cursor", ",", " ", "icon", ",", " ", "etc", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "class", "\\u", "name_", "=_", "str_", "(_", "uuid_", "._", "uuid1_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "wc_", "=_", "wrapped_", "(_", "win32", "gui_", "._", "WN", "DC", "LAS", "S_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "wc_", "._", "Set", "Dialog", "Proc_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "wc_", "._", "h", "Instance_", "=_", "win32", "gui_", "._", "dll", "handle_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "wc_", "._", "lp", "sz", "Class", "Name_", "=_", "class", "\\u", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "wc_", "._", "style_", "=_", "win32con_", "._", "CS", "\\u", "VR", "ED", "RAW_", "|_", "win32con_", "._", "CS", "\\u", "HRE", "DRAW", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "wc_", "._", "h", "Cursor_", "=_", "wrapped_", "(_", "win32", "gui_", "._", "Load", "Cursor_", ",_", "0_", ",_", "win32con_", "._", "ID", "C", "\\u", "ARROW", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "wc_", "._", "hb", "r", "Background_", "=_", "win32con_", "._", "COLOR", "\\u", "WINDOW_", "+_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "wc_", "._", "lp", "fn", "Wn", "d", "Proc_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "wc_", "._", "cb", "Wn", "d", "Extra", "_", "=_", "win32con_", "._", "DL", "GW", "IND", "OW", "EXTRA", "_", "+_", "struct_", "._", "calcsize_", "(_", "b", "\"", "Pi", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "icon", "\\u", "flags_", "=_", "win32con_", "._", "LR", "\\u", "LOAD", "FROM", "FILE_", "|_", "win32con_", "._", "LR", "\\u", "DEF", "AUL", "TS", "IZE_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "python", "\\u", "exe_", "=_", "wrapped_", "(_", "win32", "api_", "._", "Get", "Modul", "e", "Handle_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "hasattr_", "(_", "sys_", ",_", "\"", "frozen", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "wc_", "._", "h", "Icon_", "=_", "wrapped_", "(_", "win32", "gui_", "._", "Load", "Icon_", ",_", "python", "\\u", "exe_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class", "\\u", "atom_", "=_", "wrapped_", "(_", "win32", "gui_", "._", "Register", "Class_", ",_", "wc_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "class", "\\u", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Base", "Dialog_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "get", "\\u", "dialog", "\\u", "template_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Put", " ", "tog", "ether", " ", "a", " ", "sensi", "ble", " ", "default", " ", "layout", " ", "for", " ", "this", " ", "dialog", ",", " ", "tak", "ing", "\\", "10", ";", " ", " ", " ", " ", "int", "o", " ", "account", " ", "the", " ", "default", " ", "structure", " ", "and", " ", "the", " ", "(", "variab", "le", ")", " ", "number", " ", "of", " ", "fields", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "NB", " ", "Alt", "hou", "gh", " ", "sensi", "ble", " ", "default", " ", "position", "s", " ", "are", " ", "chosen", " ", "here", ",", " ", "the", " ", "horizon", "tal", "\\", "10", ";", " ", " ", " ", " ", "layout", " ", "will", " ", "be", " ", "overrid", "den", " ", "by", " ", "the", " ", ":", "meth", ":`", "\\u", "resiz", "e", "`", " ", "functional", "it", "y", " ", "belo", "w", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dlg", "\\u", "class", "\\u", "name_", "=_", "\\u", "register", "\\u", "wnd", "class_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "style_", "=_", "reduce_", "(_", "operator_", "._", "or\\u_", ",_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "win32con_", "._", "WS", "\\u", "THI", "CK", "FRAME", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "win32con_", "._", "WS", "\\u", "POP", "UP_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "win32con_", "._", "WS", "\\u", "VISI", "BLE_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "win32con_", "._", "WS", "\\u", "CAPT", "ION_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "win32con_", "._", "WS", "\\u", "SYS", "MENU_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "win32con_", "._", "DS", "\\u", "SET", "FONT_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "win32con_", "._", "WS", "\\u", "MINIM", "IZE", "BOX_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cs_", "=_", "win32con_", "._", "WS", "\\u", "CHILD", "_", "|_", "win32con_", "._", "WS", "\\u", "VISI", "BLE_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "n", "\\u", "fields_", "=_", "len_", "(_", "self_", "._", "fields_", ")_", "+_", "(_", "1_", "if_", "self_", "._", "progress", "\\u", "callback_", "else_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dlg_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "control", "\\u", "t_", "=_", "self_", "._", "GU", "TT", "ER", "\\u", "H_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", ",_", "(_", "field_", ",_", "default", "\\u", "value_", ",_", "callback_", ")_", "in_", "enumerate_", "(_", "self_", "._", "fields_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "label", "\\u", "l_", "=_", "self_", "._", "GU", "TT", "ER", "\\u", "W_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "label", "\\u", "t_", "=_", "control", "\\u", "t_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "field", "\\u", "l_", "=_", "label", "\\u", "l_", "+_", "self_", "._", "LAB", "EL", "\\u", "W_", "+_", "self_", "._", "GU", "TT", "ER", "\\u", "W_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "field", "\\u", "t_", "=_", "label", "\\u", "t_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "display", "\\u", "h_", "=_", "field", "\\u", "h_", "=_", "self_", "._", "CONTR", "OL", "\\u", "H_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "field_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "field", "\\u", "type_", ",_", "sub\\u", "type_", "=_", "\"", "EDIT", "\"_", ",_", "\"", "READO", "NLY", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "isinstance_", "(_", "default", "\\u", "value_", ",_", "bool_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "field", "\\u", "type_", ",_", "sub\\u", "type_", "=_", "\"", "BUTTON", "\"_", ",_", "\"", "CHECK", "BO", "X", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "isinstance_", "(_", "default", "\\u", "value_", ",_", "tuple_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "field", "\\u", "type_", ",_", "sub\\u", "type_", "=_", "\"", "BUTTON", "\"_", ",_", "\"", "RADI", "OB", "UT", "TON", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "isinstance_", "(_", "default", "\\u", "value_", ",_", "list_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "field", "\\u", "type_", ",_", "sub\\u", "type_", "=_", "\"", "COM", "BO", "BO", "X", "\"_", ",_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "field_", "._", "upper_", "(_", ")_", "==_", "\"", "PASS", "WORD", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "field", "\\u", "type_", ",_", "sub\\u", "type_", "=_", "\"", "EDIT", "\"_", ",_", "\"", "PASS", "WORD", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "field", "\\u", "type_", ",_", "sub\\u", "type_", "=_", "\"", "EDIT", "\"_", ",_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "dlg_", "._", "append_", "(_", "[_", "\"", "STATI", "C", "\"_", ",_", "field_", ",_", "self_", "._", "ID", "C", "\\u", "LAB", "EL", "\\u", "BASE_", "+_", "i_", ",_", "(_", "label", "\\u", "l_", ",_", "label", "\\u", "t_", ",_", "self_", "._", "LAB", "EL", "\\u", "W_", ",_", "self_", "._", "CONTR", "OL", "\\u", "H_", ")_", ",_", "cs_", "|_", "win32con_", "._", "SS", "\\u", "LEFT_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "field", "\\u", "type_", "!=_", "\"", "STATI", "C", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "field", "\\u", "styles_", "=_", "win32con_", "._", "WS", "\\u", "TAB", "STOP_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "field", "\\u", "styles_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "(_", "field", "\\u", "type_", ",_", "sub\\u", "type_", ")_", "==_", "(_", "\"", "BUTTON", "\"_", ",_", "\"", "CHECK", "BO", "X", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "field", "\\u", "styles_", "|=_", "win32con_", "._", "BS", "\\u", "AUTO", "CHECK", "BOX_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "field", "\\u", "w_", "=_", "self_", "._", "CONTR", "OL", "\\u", "H_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "(_", "field", "\\u", "type_", ",_", "sub\\u", "type_", ")_", "==_", "(_", "\"", "BUTTON", "\"_", ",_", "\"", "RADI", "OB", "UT", "TON", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "field", "\\u", "styles_", "|=_", "win32con_", "._", "BS", "\\u", "AUTO", "RADI", "OB", "UT", "TON", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "field", "\\u", "w_", "=_", "self_", "._", "CONTR", "OL", "\\u", "H_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "field", "\\u", "type_", "==_", "\"", "COM", "BO", "BO", "X", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "callback_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "raise_", "x", "\\u", "dialogs_", "(_", "\"", "Cann", "ot", " ", "combin", "e", " ", "a", " ", "list", " ", "with", " ", "a", " ", "callback", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "field", "\\u", "styles_", "|=_", "win32con_", "._", "CB", "S", "\\u", "DROP", "DOWN", "LIST_", "|_", "win32con_", "._", "WS", "\\u", "VS", "CRO", "LL_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "field", "\\u", "w_", "=_", "self_", "._", "FIE", "LD", "\\u", "W_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "field", "\\u", "h_", "=_", "8_", "*_", "self_", "._", "CONTR", "OL", "\\u", "H_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "display", "\\u", "h_", "=_", "self_", "._", "CONTR", "OL", "\\u", "H_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "field", "\\u", "type_", "==_", "\"", "EDIT", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "field", "\\u", "styles_", "|=_", "win32con_", "._", "WS", "\\u", "BORDER", "_", "|_", "win32con_", "._", "ES", "\\u", "AUTO", "HS", "CRO", "LL_", "|_", "win32con_", "._", "ES", "\\u", "AUTO", "VS", "CRO", "LL_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "field", "\\u", "w_", "=_", "self_", "._", "FIE", "LD", "\\u", "W_", "-_", "(_", "(_", "self_", "._", "CALL", "BACK", "\\u", "W_", ")_", "if_", "callback_", "else_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "\"\\\\", "r", "\\\\", "n", "\"_", "in_", "unicode_", "(_", "default", "\\u", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "field", "\\u", "styles_", "|=_", "win32con_", "._", "ES", "\\u", "MULTILINE_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "display", "\\u", "h_", "=_", "field", "\\u", "h_", "=_", "self_", "._", "CONTR", "OL", "\\u", "H_", "*_", "min_", "(_", "default", "\\u", "value_", "._", "count_", "(_", "\"\\\\", "r", "\\\\", "n", "\"_", ")_", ",_", "10_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "sub\\u", "type_", "==_", "\"", "READO", "NLY", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "field", "\\u", "styles_", "|=_", "win32con_", "._", "ES", "\\u", "READO", "NLY", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "sub\\u", "type_", "==_", "\"", "PASS", "WORD", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "field", "\\u", "styles_", "|=_", "win32con_", "._", "ES", "\\u", "PASSWORD_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "x", "\\u", "dialogs_", "(_", "\"", "Prob", "lem", "o", "\"_", ",_", "\"\\u", "get", "\\u", "dialog", "\\u", "template", "\"_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "dlg_", "._", "append_", "(_", "[_", "field", "\\u", "type_", ",_", "None_", ",_", "self_", "._", "ID", "C", "\\u", "FIE", "LD", "\\u", "BASE_", "+_", "i_", ",_", "(_", "field", "\\u", "l_", ",_", "field", "\\u", "t_", ",_", "field", "\\u", "w_", ",_", "field", "\\u", "h_", ")_", ",_", "cs_", "|_", "field", "\\u", "styles_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "callback_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "dlg_", "._", "append_", "(_", "[_", "\"", "BUTTON", "\"_", ",_", "\"...\"_", ",_", "self_", "._", "ID", "C", "\\u", "CALL", "BACK", "\\u", "BASE_", "+_", "i_", ",_", "(_", "field", "\\u", "l_", "+_", "field", "\\u", "w_", "+_", "self_", "._", "GU", "TT", "ER", "\\u", "W_", ",_", "field", "\\u", "t_", ",_", "self_", "._", "CALL", "BACK", "\\u", "W_", ",_", "self_", "._", "CONTR", "OL", "\\u", "H_", ")_", ",_", "cs_", "|_", "win32con_", "._", "WS", "\\u", "TAB", "STOP_", "|_", "win32con_", "._", "BS", "\\u", "PUSH", "BUTTON_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "control", "\\u", "t_", "+=_", "display", "\\u", "h_", "+_", "self_", "._", "GU", "TT", "ER", "\\u", "H_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "i_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "progress", "\\u", "callback_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "progress", "\\u", "id_", "=_", "self_", "._", "ID", "C", "\\u", "FIE", "LD", "\\u", "BASE_", "+_", "i_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "field", "\\u", "t_", "=_", "control", "\\u", "t_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "field", "\\u", "w_", "=_", "self_", "._", "W_", "-_", "(_", "2_", "*_", "self_", "._", "GU", "TT", "ER", "\\u", "W_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "field", "\\u", "l_", "=_", "self_", "._", "GU", "TT", "ER", "\\u", "W_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "field", "\\u", "h_", "=_", "self_", "._", "CONTR", "OL", "\\u", "H_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "field", "\\u", "styles_", "=_", "win32con_", "._", "SS", "\\u", "LEFT_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dlg_", "._", "append_", "(_", "[_", "\"", "STATI", "C", "\"_", ",_", "None_", ",_", "self_", "._", "ID", "C", "\\u", "FIE", "LD", "\\u", "BASE_", "+_", "i_", ",_", "(_", "field", "\\u", "l_", ",_", "field", "\\u", "t_", ",_", "field", "\\u", "w_", ",_", "field", "\\u", "h_", ")_", ",_", "cs_", "|_", "field", "\\u", "styles_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "control", "\\u", "t_", "+=_", "field", "\\u", "h_", "+_", "self_", "._", "GU", "TT", "ER", "\\u", "H_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "cs_", "=_", "win32con_", "._", "WS", "\\u", "CHILD", "_", "|_", "win32con_", "._", "WS", "\\u", "VISI", "BLE_", "|_", "win32con_", "._", "WS", "\\u", "TAB", "STOP_", "|_", "win32con_", "._", "BS", "\\u", "PUSH", "BUTTON_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "button", "\\u", "t_", "=_", "control", "\\u", "t_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", ",_", "(_", "caption_", ",_", "id_", ")_", "in_", "enumerate_", "(_", "reversed_", "(_", "self_", "._", "BUTTON", "S_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "field", "\\u", "h_", "=_", "self_", "._", "CONTR", "OL", "\\u", "H_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dlg_", "._", "append_", "(_", "[_", "\"", "BUTTON", "\"_", ",_", "caption_", ",_", "id_", ",_", "(_", "self_", "._", "W_", "-_", "(_", "(_", "i_", "+_", "1_", ")_", "*_", "(_", "self_", "._", "GU", "TT", "ER", "\\u", "W_", "+_", "self_", "._", "BUTTON", "\\u", "W_", ")_", ")_", ",_", "button", "\\u", "t_", ",_", "self_", "._", "BUTTON", "\\u", "W_", ",_", "field", "\\u", "h_", ")_", ",_", "cs_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "control", "\\u", "t_", "+=_", "field", "\\u", "h_", "+_", "self_", "._", "GU", "TT", "ER", "\\u", "H_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "dlg_", "._", "insert_", "(_", "0_", ",_", "[_", "self_", "._", "title_", ",_", "(_", "0_", ",_", "0_", ",_", "self_", "._", "W_", ",_", "control", "\\u", "t_", ")_", ",_", "style_", ",_", "None_", ",_", "(_", "9_", ",_", "\"", "Luc", "ida", " ", "San", "s", " ", "Unic", "ode", "\"_", ")_", ",_", "None_", ",_", "dlg", "\\u", "class", "\\u", "name_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "dlg_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Dialog_", "(_", "Base", "Dialog_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "set\\u", "item_", "(_", "self_", ",_", "item", "\\u", "id_", ",_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Set", " ", "the", " ", "current", " ", "value", " ", "of", " ", "an", " ", "item", " ", "in", " ", "the", " ", "dialog", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "item", "\\u", "hwnd", "_", "=_", "wrapped_", "(_", "win32", "gui_", "._", "Get", "Dl", "g", "Item_", ",_", "self_", "._", "hwnd", "_", ",_", "item", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "class", "\\u", "name_", "=_", "wrapped_", "(_", "win32", "gui_", "._", "Get", "Class", "Name_", ",_", "item", "\\u", "hwnd", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "styles_", "=_", "wrapped_", "(_", "win32", "gui_", "._", "Get", "Window", "Long_", ",_", "self_", "._", "hwnd", "_", ",_", "win32con_", "._", "GW", "L", "\\u", "STYLE_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "class", "\\u", "name_", "==_", "\"", "Edit", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "isinstance_", "(_", "value_", ",_", "datetime_", "._", "date_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "value_", "=_", "value_", "._", "strftime_", "(_", "\"%", "d", " ", "%", "b", " ", "%", "Y", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "value_", "=_", "unicode_", "(_", "value_", ")_", "._", "replace_", "(_", "\"\\\\", "r", "\\\\", "n", "\"_", ",_", "\"\\\\", "n", "\"_", ")_", "._", "replace_", "(_", "\"\\\\", "n", "\"_", ",_", "\"\\\\", "r", "\\\\", "n", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "wrapped_", "(_", "win32", "gui_", "._", "Set", "Dl", "g", "Item", "Text_", ",_", "self_", "._", "hwnd", "_", ",_", "item", "\\u", "id_", ",_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "class", "\\u", "name_", "==_", "\"", "Butt", "on", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "~", " ", "if", " ", "style", "s", " ", "&", " ", "win32", "con", ".", "BS", "\\u", "CHECK", "BO", "X", ":_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Sen", "d", "Message_", "(_", "item", "\\u", "hwnd", "_", ",_", "win32con_", "._", "BM", "\\u", "SET", "CHECK_", ",_", "int_", "(_", "value_", ")_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "~", " ", "eli", "f", " ", "style", "s", " ", "&", " ", "win32", "con", ".", "BS", "\\u", "RADI", "OB", "UT", "TON", ":_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "class", "\\u", "name_", "==_", "\"", "Comb", "o", "Box", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "item_", "in_", "value_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "isinstance_", "(_", "item_", ",_", "tuple_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "item_", "=_", "item_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "Sen", "d", "Message_", "(_", "item", "\\u", "hwnd", "_", ",_", "win32con_", "._", "CB", "\\u", "ADD", "STRING_", ",_", "0_", ",_", "utils_", "._", "string", "\\u", "as", "\\u", "pointer_", "(_", "str_", "(_", "item_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "Sen", "d", "Message_", "(_", "item", "\\u", "hwnd", "_", ",_", "win32con_", "._", "CB", "\\u", "SET", "CUR", "SEL", "_", ",_", "0_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "class", "\\u", "name_", "==_", "\"", "Static", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "wrapped_", "(_", "win32", "gui_", "._", "Set", "Dl", "g", "Item", "Text_", ",_", "self_", "._", "hwnd", "_", ",_", "item", "\\u", "id_", ",_", "unicode_", "(_", "value_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Run", "time", "Error_", "(_", "\"", "Un", "know", "n", " ", "class", ":", " ", "%", "s", "\"_", "%_", "class", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,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 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused local variable
openruko/gitmouth/mocks/mockapisvr.py
[ { "content": "@app.route(\"/internal/lookupUserByPublicKey\")\ndef check_key():\n # FIXME: 'fingerprint' is assigned to but never used\n fingerprint = request.args.get('fingerprint')\n return \"testing:aaa-bbb-ccc-ddd-eee\"", "metadata": "root.check_key", "header": "['module', '___EOS___']", "index": 5 } ]
[ { "span": "fingerprint ", "start_line": 8, "start_column": 4, "end_line": 8, "end_column": 15 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "@_", "app_", "._", "route_", "(_", "\"/", "internal", "/", "look", "up", "User", "By", "Public", "Key", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "check", "\\u", "key_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "FIX", "ME", ":", " ", "'", "fingerprint", "'", " ", "is", " ", "assign", "ed", " ", "to", " ", "but", " ", "neve", "r", " ", "used_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "fingerprint_", "=_", "request_", "._", "args_", "._", "get_", "(_", "'", "fingerprint", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\"", "testi", "ng", ":", "aaa", "-", "bbb", "-", "ccc", "-", "ddd", "-", "eee", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
datasift/datasift-python/examples/account_usage.py
[ { "content": "from __future__ import print_function\nimport time\nfrom datasift import Client\n\ndatasift = Client(\"your username\", \"your API key\")\n\nprint('Retrieve account usage information')\nprint(datasift.account.usage())\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[ { "span": "import time", "start_line": 1, "start_column": 0, "end_line": 1, "end_column": 11 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "from_", "\\u\\u", "future\\u\\u_", "import_", "print", "\\u", "function_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "time_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "datas", "ift", "_", "import_", "Client_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "datas", "ift", "_", "=_", "Client_", "(_", "\"", "your", " ", "user", "name", "\"_", ",_", "\"", "your", " ", "API", " ", "key", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "print_", "(_", "'", "Retrieve", " ", "account", " ", "usage", " ", "informati", "on", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "datas", "ift", "_", "._", "account_", "._", "usage_", "(_", ")_", ")_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
First parameter of a method is not named 'self'
boto/boto3/boto3/resources/factory.py
[ { "content": " def _create_identifier(factory_self, identifier, resource_name):\n \"\"\"\n Creates a read-only property for identifier attributes.\n \"\"\"\n def get_identifier(self):\n # The default value is set to ``None`` instead of\n # raising an AttributeError because when resources are\n # instantiated a check is made such that none of the\n # identifiers have a value ``None``. If any are ``None``,\n # a more informative user error than a generic AttributeError\n # is raised.\n return getattr(self, '_' + identifier.name, None)\n\n get_identifier.__name__ = str(identifier.name)\n get_identifier.__doc__ = docstring.IdentifierDocstring(\n resource_name=resource_name,\n identifier_model=identifier,\n include_signature=False\n )\n\n return property(get_identifier)", "metadata": "root.ResourceFactory._create_identifier", "header": "['class', 'ResourceFactory', '(', 'object', ')', ':', '___EOS___']", "index": 284 }, { "content": " def _create_identifier_alias(factory_self, resource_name, identifier,\n member_model, service_context):\n \"\"\"\n Creates a read-only property that aliases an identifier.\n \"\"\"\n def get_identifier(self):\n return getattr(self, '_' + identifier.name, None)\n\n get_identifier.__name__ = str(identifier.member_name)\n get_identifier.__doc__ = docstring.AttributeDocstring(\n service_name=service_context.service_name,\n resource_name=resource_name,\n attr_name=identifier.member_name,\n event_emitter=factory_self._emitter,\n attr_model=member_model,\n include_signature=False\n )\n\n return property(get_identifier)", "metadata": "root.ResourceFactory._create_identifier_alias", "header": "['class', 'ResourceFactory', '(', 'object', ')', ':', '___EOS___']", "index": 306 }, { "content": " def _create_autoload_property(factory_self, resource_name, name,\n snake_cased, member_model, service_context):\n \"\"\"\n Creates a new property on the resource to lazy-load its value\n via the resource's ``load`` method (if it exists).\n \"\"\"\n # The property loader will check to see if this resource has already\n # been loaded and return the cached value if possible. If not, then\n # it first checks to see if it CAN be loaded (raise if not), then\n # calls the load before returning the value.\n def property_loader(self):\n if self.meta.data is None:\n if hasattr(self, 'load'):\n self.load()\n else:\n raise ResourceLoadException(\n '{0} has no load method'.format(self.__class__.__name__))\n\n return self.meta.data.get(name)\n\n property_loader.__name__ = str(snake_cased)\n property_loader.__doc__ = docstring.AttributeDocstring(\n service_name=service_context.service_name,\n resource_name=resource_name,\n attr_name=snake_cased,\n event_emitter=factory_self._emitter,\n attr_model=member_model,\n include_signature=False\n )\n\n return property(property_loader)", "metadata": "root.ResourceFactory._create_autoload_property", "header": "['class', 'ResourceFactory', '(', 'object', ')', ':', '___EOS___']", "index": 326 }, { "content": " def _create_waiter(factory_self, resource_waiter_model, resource_name,\n service_context):\n \"\"\"\n Creates a new wait method for each resource where both a waiter and\n resource model is defined.\n \"\"\"\n waiter = WaiterAction(resource_waiter_model,\n waiter_resource_name=resource_waiter_model.name)\n def do_waiter(self, *args, **kwargs):\n waiter(self, *args, **kwargs)\n\n do_waiter.__name__ = str(resource_waiter_model.name)\n do_waiter.__doc__ = docstring.ResourceWaiterDocstring(\n resource_name=resource_name,\n event_emitter=factory_self._emitter,\n service_model=service_context.service_model,\n resource_waiter_model=resource_waiter_model,\n service_waiter_model=service_context.service_waiter_model,\n include_signature=False\n )\n return do_waiter", "metadata": "root.ResourceFactory._create_waiter", "header": "['class', 'ResourceFactory', '(', 'object', ')', ':', '___EOS___']", "index": 358 }, { "content": " def _create_collection(factory_self, resource_name, collection_model,\n service_context):\n \"\"\"\n Creates a new property on the resource to lazy-load a collection.\n \"\"\"\n cls = factory_self._collection_factory.load_from_definition(\n resource_name=resource_name, collection_model=collection_model,\n service_context=service_context,\n event_emitter=factory_self._emitter)\n\n def get_collection(self):\n return cls(\n collection_model=collection_model, parent=self,\n factory=factory_self, service_context=service_context)\n\n get_collection.__name__ = str(collection_model.name)\n get_collection.__doc__ = docstring.CollectionDocstring(\n collection_model=collection_model, include_signature=False)\n return property(get_collection)", "metadata": "root.ResourceFactory._create_collection", "header": "['class', 'ResourceFactory', '(', 'object', ')', ':', '___EOS___']", "index": 380 }, { "content": " def _create_reference(factory_self, reference_model, resource_name,\n service_context):\n \"\"\"\n Creates a new property on the resource to lazy-load a reference.\n \"\"\"\n # References are essentially an action with no request\n # or response, so we can re-use the response handlers to\n # build up resources from identifiers and data members.\n handler = ResourceHandler(\n search_path=reference_model.resource.path, factory=factory_self,\n resource_model=reference_model.resource,\n service_context=service_context\n )\n\n # Are there any identifiers that need access to data members?\n # This is important when building the resource below since\n # it requires the data to be loaded.\n needs_data = any(i.source == 'data' for i in\n reference_model.resource.identifiers)\n\n def get_reference(self):\n # We need to lazy-evaluate the reference to handle circular\n # references between resources. We do this by loading the class\n # when first accessed.\n # This is using a *response handler* so we need to make sure\n # our data is loaded (if possible) and pass that data into\n # the handler as if it were a response. This allows references\n # to have their data loaded properly.\n if needs_data and self.meta.data is None and hasattr(self, 'load'):\n self.load()\n return handler(self, {}, self.meta.data)\n\n get_reference.__name__ = str(reference_model.name)\n get_reference.__doc__ = docstring.ReferenceDocstring(\n reference_model=reference_model,\n include_signature=False\n )\n return property(get_reference)", "metadata": "root.ResourceFactory._create_reference", "header": "['class', 'ResourceFactory', '(', 'object', ')', ':', '___EOS___']", "index": 400 }, { "content": " def _create_class_partial(factory_self, subresource_model, resource_name,\n service_context):\n \"\"\"\n Creates a new method which acts as a functools.partial, passing\n along the instance's low-level `client` to the new resource\n class' constructor.\n \"\"\"\n name = subresource_model.resource.type\n # We need a new method here because we want access to the\n # instance's client.\n def create_resource(self, *args, **kwargs):\n positional_args = []\n\n # We lazy-load the class to handle circular references.\n json_def = service_context.resource_json_definitions.get(name, {})\n resource_cls = factory_self.load_from_definition(\n resource_name=name,\n single_resource_json_definition=json_def,\n service_context=service_context\n )\n\n # Assumes that identifiers are in order, which lets you do\n # e.g. ``sqs.Queue('foo').Message('bar')`` to create a new message\n # linked with the ``foo`` queue and which has a ``bar`` receipt\n # handle. If we did kwargs here then future positional arguments\n # would lead to failure.\n identifiers = subresource_model.resource.identifiers\n if identifiers is not None:\n for identifier, value in build_identifiers(identifiers, self):\n positional_args.append(value)\n\n return partial(resource_cls, *positional_args,\n client=self.meta.client)(*args, **kwargs)\n\n create_resource.__name__ = str(name)\n create_resource.__doc__ = docstring.SubResourceDocstring(\n resource_name=resource_name,\n sub_resource_model=subresource_model,\n service_model=service_context.service_model,\n include_signature=False\n )\n return create_resource", "metadata": "root.ResourceFactory._create_class_partial", "header": "['class', 'ResourceFactory', '(', 'object', ')', ':', '___EOS___']", "index": 439 }, { "content": " def _create_action(factory_self, action_model, resource_name,\n service_context, is_load=False):\n \"\"\"\n Creates a new method which makes a request to the underlying\n AWS service.\n \"\"\"\n # Create the action in in this closure but before the ``do_action``\n # method below is invoked, which allows instances of the resource\n # to share the ServiceAction instance.\n action = ServiceAction(\n action_model, factory=factory_self,\n service_context=service_context\n )\n\n # A resource's ``load`` method is special because it sets\n # values on the resource instead of returning the response.\n if is_load:\n # We need a new method here because we want access to the\n # instance via ``self``.\n def do_action(self, *args, **kwargs):\n response = action(self, *args, **kwargs)\n self.meta.data = response\n # Create the docstring for the load/reload mehtods.\n lazy_docstring = docstring.LoadReloadDocstring(\n action_name=action_model.name,\n resource_name=resource_name,\n event_emitter=factory_self._emitter,\n load_model=action_model,\n service_model=service_context.service_model,\n include_signature=False\n )\n else:\n # We need a new method here because we want access to the\n # instance via ``self``.\n def do_action(self, *args, **kwargs):\n response = action(self, *args, **kwargs)\n\n if hasattr(self, 'load'):\n # Clear cached data. It will be reloaded the next\n # time that an attribute is accessed.\n # TODO: Make this configurable in the future?\n self.meta.data = None\n\n return response\n lazy_docstring = docstring.ActionDocstring(\n resource_name=resource_name,\n event_emitter=factory_self._emitter,\n action_model=action_model,\n service_model=service_context.service_model,\n include_signature=False\n )\n\n do_action.__name__ = str(action_model.name)\n do_action.__doc__ = lazy_docstring\n return do_action", "metadata": "root.ResourceFactory._create_action", "header": "['class', 'ResourceFactory', '(', 'object', ')', ':', '___EOS___']", "index": 482 } ]
[ { "span": "def _create_identifier(factory_self, identifier, resource_name):", "start_line": 284, "start_column": 4, "end_line": 284, "end_column": 68 }, { "span": "def _create_identifier_alias(factory_self, resource_name, identifier,\n member_model, service_context):", "start_line": 306, "start_column": 4, "end_line": 307, "end_column": 64 }, { "span": "def _create_autoload_property(factory_self, resource_name, name,\n snake_cased, member_model, service_context):", "start_line": 326, "start_column": 4, "end_line": 327, "end_column": 78 }, { "span": "def _create_waiter(factory_self, resource_waiter_model, resource_name,\n service_context):", "start_line": 358, "start_column": 4, "end_line": 359, "end_column": 40 }, { "span": "def _create_collection(factory_self, resource_name, collection_model,\n service_context):", "start_line": 380, "start_column": 4, "end_line": 381, "end_column": 44 }, { "span": "def _create_reference(factory_self, reference_model, resource_name,\n service_context):", "start_line": 400, "start_column": 4, "end_line": 401, "end_column": 43 }, { "span": "def _create_class_partial(factory_self, subresource_model, resource_name,\n service_context):", "start_line": 439, "start_column": 4, "end_line": 440, "end_column": 47 }, { "span": "def _create_action(factory_self, action_model, resource_name,\n service_context, is_load=False):", "start_line": 482, "start_column": 4, "end_line": 483, "end_column": 55 } ]
[]
1
true
[ "[CLS]_", "First_", "parameter_", "of_", "a_", "method_", "is_", "not_", "named_", "'", "self", "'_", "[SEP]_", "class_", "Reso", "urc", "e", "Factory_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "create", "\\u", "identifier_", "(_", "factor", "y", "\\u", "self_", ",_", "identifier_", ",_", "resource", "\\u", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Creat", "es", " ", "a", " ", "read", "-", "only", " ", "property", " ", "for", " ", "identifi", "er", " ", "attribute", "s", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "get", "\\u", "identifier_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "The", " ", "default", " ", "value", " ", "is", " ", "set", " ", "to", " ", "``", "Non", "e", "``", " ", "inst", "ead", " ", "of_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "rais", "ing", " ", "an", " ", "Attribute", "Error", " ", "bec", "aus", "e", " ", "whe", "n", " ", "resource", "s", " ", "are", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "instantiate", "d", " ", "a", " ", "check", " ", "is", " ", "made", " ", "suc", "h", " ", "tha", "t", " ", "none", " ", "of", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "identifi", "ers", " ", "have", " ", "a", " ", "value", " ", "``", "Non", "e", "``.", " ", "If", " ", "any", " ", "are", " ", "``", "Non", "e", "``", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "a", " ", "more", " ", "informati", "ve", " ", "user", " ", "error", " ", "than", " ", "a", " ", "gener", "ic", " ", "Attribute", "Error_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "is", " ", "raise", "d", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "getattr_", "(_", "self_", ",_", "'\\u'_", "+_", "identifier_", "._", "name_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "get", "\\u", "identifier_", "._", "\\u\\u", "name\\u\\u_", "=_", "str_", "(_", "identifier_", "._", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "get", "\\u", "identifier_", "._", "\\u\\u", "doc\\u\\u_", "=_", "docstring_", "._", "Identifie", "r", "Docs", "tring_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "resource", "\\u", "name_", "=_", "resource", "\\u", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "identifi", "er", "\\u", "model_", "=_", "identifier_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "include", "\\u", "signature_", "=_", "False_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "property_", "(_", "get", "\\u", "identifier_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Reso", "urc", "e", "Factory_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "create", "\\u", "identifi", "er", "\\u", "alias_", "(_", "factor", "y", "\\u", "self_", ",_", "resource", "\\u", "name_", ",_", "identifier_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "member", "\\u", "model_", ",_", "service", "\\u", "context_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Creat", "es", " ", "a", " ", "read", "-", "only", " ", "property", " ", "tha", "t", " ", "alias", "es", " ", "an", " ", "identifi", "er", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "get", "\\u", "identifier_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "getattr_", "(_", "self_", ",_", "'\\u'_", "+_", "identifier_", "._", "name_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "get", "\\u", "identifier_", "._", "\\u\\u", "name\\u\\u_", "=_", "str_", "(_", "identifier_", "._", "member", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "get", "\\u", "identifier_", "._", "\\u\\u", "doc\\u\\u_", "=_", "docstring_", "._", "Attribute", "Docs", "tring_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "service", "\\u", "name_", "=_", "service", "\\u", "context_", "._", "service", "\\u", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "resource", "\\u", "name_", "=_", "resource", "\\u", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "attr", "\\u", "name_", "=_", "identifier_", "._", "member", "\\u", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "event", "\\u", "emitter_", "=_", "factor", "y", "\\u", "self_", "._", "\\u", "emitter_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "attr", "\\u", "model_", "=_", "member", "\\u", "model_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "include", "\\u", "signature_", "=_", "False_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "property_", "(_", "get", "\\u", "identifier_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Reso", "urc", "e", "Factory_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "create", "\\u", "autoload", "\\u", "property_", "(_", "factor", "y", "\\u", "self_", ",_", "resource", "\\u", "name_", ",_", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "snake", "\\u", "case", "d_", ",_", "member", "\\u", "model_", ",_", "service", "\\u", "context_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Creat", "es", " ", "a", " ", "new", " ", "property", " ", "on", " ", "the", " ", "resource", " ", "to", " ", "lazy", "-", "load", " ", "its", " ", "value", "\\", "10", ";", " ", " ", " ", " ", "via", " ", "the", " ", "resource", "'", "s", " ", "``", "load", "``", " ", "method", " ", "(", "if", " ", "it", " ", "exist", "s", ").", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "The", " ", "property", " ", "load", "er", " ", "will", " ", "check", " ", "to", " ", "see", " ", "if", " ", "this", " ", "resource", " ", "has", " ", "alr", "ead", "y_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "bee", "n", " ", "load", "ed", " ", "and", " ", "return", " ", "the", " ", "cache", "d", " ", "value", " ", "if", " ", "possib", "le", ".", " ", "If", " ", "not", ",", " ", "then_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "it", " ", "first", " ", "checks", " ", "to", " ", "see", " ", "if", " ", "it", " ", "CAN", " ", "be", " ", "load", "ed", " ", "(", "raise", " ", "if", " ", "not", "),", " ", "then_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "calls", " ", "the", " ", "load", " ", "bef", "ore", " ", "return", "ing", " ", "the", " ", "value", "._", "\\u\\u\\uNL\\u\\u\\u_", "def_", "property", "\\u", "loader_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "meta_", "._", "data_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "hasattr_", "(_", "self_", ",_", "'", "load", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "self_", "._", "load_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "raise_", "Reso", "urc", "e", "Load", "Exception_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'{", "0", "}", " ", "has", " ", "no", " ", "load", " ", "method", "'_", "._", "format_", "(_", "self_", "._", "\\u\\u", "class\\u\\u_", "._", "\\u\\u", "name\\u\\u_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "self_", "._", "meta_", "._", "data_", "._", "get_", "(_", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "property", "\\u", "loader_", "._", "\\u\\u", "name\\u\\u_", "=_", "str_", "(_", "snake", "\\u", "case", "d_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "property", "\\u", "loader_", "._", "\\u\\u", "doc\\u\\u_", "=_", "docstring_", "._", "Attribute", "Docs", "tring_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "service", "\\u", "name_", "=_", "service", "\\u", "context_", "._", "service", "\\u", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "resource", "\\u", "name_", "=_", "resource", "\\u", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "attr", "\\u", "name_", "=_", "snake", "\\u", "case", "d_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "event", "\\u", "emitter_", "=_", "factor", "y", "\\u", "self_", "._", "\\u", "emitter_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "attr", "\\u", "model_", "=_", "member", "\\u", "model_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "include", "\\u", "signature_", "=_", "False_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "property_", "(_", "property", "\\u", "loader_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Reso", "urc", "e", "Factory_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "create", "\\u", "waiter_", "(_", "factor", "y", "\\u", "self_", ",_", "resource", "\\u", "waiter", "\\u", "model_", ",_", "resource", "\\u", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "service", "\\u", "context_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Creat", "es", " ", "a", " ", "new", " ", "wait", " ", "method", " ", "for", " ", "each", " ", "resource", " ", "where", " ", "bot", "h", " ", "a", " ", "waiter", " ", "and", "\\", "10", ";", " ", " ", " ", " ", "resource", " ", "model", " ", "is", " ", "defin", "ed", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "waiter_", "=_", "Wait", "er", "Action_", "(_", "resource", "\\u", "waiter", "\\u", "model_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "waiter", "\\u", "resource", "\\u", "name_", "=_", "resource", "\\u", "waiter", "\\u", "model_", "._", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "do", "\\u", "waiter_", "(_", "self_", ",_", "*_", "args_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "waiter_", "(_", "self_", ",_", "*_", "args_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "do", "\\u", "waiter_", "._", "\\u\\u", "name\\u\\u_", "=_", "str_", "(_", "resource", "\\u", "waiter", "\\u", "model_", "._", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "do", "\\u", "waiter_", "._", "\\u\\u", "doc\\u\\u_", "=_", "docstring_", "._", "Reso", "urc", "e", "Wait", "er", "Docs", "tring_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "resource", "\\u", "name_", "=_", "resource", "\\u", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "event", "\\u", "emitter_", "=_", "factor", "y", "\\u", "self_", "._", "\\u", "emitter_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "service", "\\u", "model_", "=_", "service", "\\u", "context_", "._", "service", "\\u", "model_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "resource", "\\u", "waiter", "\\u", "model_", "=_", "resource", "\\u", "waiter", "\\u", "model_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "service", "\\u", "waiter", "\\u", "model_", "=_", "service", "\\u", "context_", "._", "service", "\\u", "waiter", "\\u", "model_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "include", "\\u", "signature_", "=_", "False_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "do", "\\u", "waiter_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Reso", "urc", "e", "Factory_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "create", "\\u", "collection_", "(_", "factor", "y", "\\u", "self_", ",_", "resource", "\\u", "name_", ",_", "collection", "\\u", "model_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "service", "\\u", "context_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Creat", "es", " ", "a", " ", "new", " ", "property", " ", "on", " ", "the", " ", "resource", " ", "to", " ", "lazy", "-", "load", " ", "a", " ", "collection", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cls_", "=_", "factor", "y", "\\u", "self_", "._", "\\u", "collection", "\\u", "factory_", "._", "load", "\\u", "from", "\\u", "definition_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "resource", "\\u", "name_", "=_", "resource", "\\u", "name_", ",_", "collection", "\\u", "model_", "=_", "collection", "\\u", "model_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "service", "\\u", "context_", "=_", "service", "\\u", "context_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "event", "\\u", "emitter_", "=_", "factor", "y", "\\u", "self_", "._", "\\u", "emitter_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "get", "\\u", "collection_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "cls_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "collection", "\\u", "model_", "=_", "collection", "\\u", "model_", ",_", "parent_", "=_", "self_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "factory_", "=_", "factor", "y", "\\u", "self_", ",_", "service", "\\u", "context_", "=_", "service", "\\u", "context_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "get", "\\u", "collection_", "._", "\\u\\u", "name\\u\\u_", "=_", "str_", "(_", "collection", "\\u", "model_", "._", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "get", "\\u", "collection_", "._", "\\u\\u", "doc\\u\\u_", "=_", "docstring_", "._", "Collecti", "on", "Docs", "tring_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "collection", "\\u", "model_", "=_", "collection", "\\u", "model_", ",_", "include", "\\u", "signature_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "property_", "(_", "get", "\\u", "collection_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Reso", "urc", "e", "Factory_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "create", "\\u", "reference_", "(_", "factor", "y", "\\u", "self_", ",_", "reference", "\\u", "model_", ",_", "resource", "\\u", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "service", "\\u", "context_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Creat", "es", " ", "a", " ", "new", " ", "property", " ", "on", " ", "the", " ", "resource", " ", "to", " ", "lazy", "-", "load", " ", "a", " ", "reference", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Reference", "s", " ", "are", " ", "essential", "ly", " ", "an", " ", "action", " ", "with", " ", "no", " ", "request_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "or", " ", "response", ",", " ", "so", " ", "we", " ", "can", " ", "re", "-", "use", " ", "the", " ", "response", " ", "handler", "s", " ", "to_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "build", " ", "up", " ", "resource", "s", " ", "from", " ", "identifi", "ers", " ", "and", " ", "data", " ", "member", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "handler_", "=_", "Reso", "urc", "e", "Handler_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "search", "\\u", "path_", "=_", "reference", "\\u", "model_", "._", "resource_", "._", "path_", ",_", "factory_", "=_", "factor", "y", "\\u", "self_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "resource", "\\u", "model_", "=_", "reference", "\\u", "model_", "._", "resource_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "service", "\\u", "context_", "=_", "service", "\\u", "context_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Are", " ", "there", " ", "any", " ", "identifi", "ers", " ", "tha", "t", " ", "need", " ", "access", " ", "to", " ", "data", " ", "member", "s", "?", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Thi", "s", " ", "is", " ", "importa", "nt", " ", "whe", "n", " ", "buildi", "ng", " ", "the", " ", "resource", " ", "belo", "w", " ", "since_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "it", " ", "require", "s", " ", "the", " ", "data", " ", "to", " ", "be", " ", "load", "ed", "._", "\\u\\u\\uNL\\u\\u\\u_", "need", "s", "\\u", "data_", "=_", "any_", "(_", "i_", "._", "source_", "==_", "'", "data", "'_", "for_", "i_", "in_", "\\u\\u\\uNL\\u\\u\\u_", "reference", "\\u", "model_", "._", "resource_", "._", "identifiers_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "get", "\\u", "reference_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "We", " ", "need", " ", "to", " ", "lazy", "-", "evaluate", " ", "the", " ", "reference", " ", "to", " ", "handle", " ", "circular", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "reference", "s", " ", "bet", "ween", " ", "resource", "s", ".", " ", "We", " ", "do", " ", "this", " ", "by", " ", "load", "ing", " ", "the", " ", "class_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "whe", "n", " ", "first", " ", "accesse", "d", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Thi", "s", " ", "is", " ", "usi", "ng", " ", "a", " ", "*", "response", " ", "handler", "*", " ", "so", " ", "we", " ", "need", " ", "to", " ", "make", " ", "sure", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "our", " ", "data", " ", "is", " ", "load", "ed", " ", "(", "if", " ", "possib", "le", ")", " ", "and", " ", "pass", " ", "tha", "t", " ", "data", " ", "into_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "the", " ", "handler", " ", "as", " ", "if", " ", "it", " ", "wer", "e", " ", "a", " ", "response", ".", " ", "Thi", "s", " ", "allow", "s", " ", "references_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "to", " ", "have", " ", "thei", "r", " ", "data", " ", "load", "ed", " ", "proper", "ly", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "need", "s", "\\u", "data_", "and_", "self_", "._", "meta_", "._", "data_", "is_", "None_", "and_", "hasattr_", "(_", "self_", ",_", "'", "load", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "load_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "handler_", "(_", "self_", ",_", "{_", "}_", ",_", "self_", "._", "meta_", "._", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "get", "\\u", "reference_", "._", "\\u\\u", "name\\u\\u_", "=_", "str_", "(_", "reference", "\\u", "model_", "._", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "get", "\\u", "reference_", "._", "\\u\\u", "doc\\u\\u_", "=_", "docstring_", "._", "Reference", "Docs", "tring_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "reference", "\\u", "model_", "=_", "reference", "\\u", "model_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "include", "\\u", "signature_", "=_", "False_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "property_", "(_", "get", "\\u", "reference_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Reso", "urc", "e", "Factory_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "create", "\\u", "class", "\\u", "partial_", "(_", "factor", "y", "\\u", "self_", ",_", "subre", "source", "\\u", "model_", ",_", "resource", "\\u", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "service", "\\u", "context_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Creat", "es", " ", "a", " ", "new", " ", "method", " ", "whi", "ch", " ", "acts", " ", "as", " ", "a", " ", "functo", "ols", ".", "partial", ",", " ", "passi", "ng", "\\", "10", ";", " ", " ", " ", " ", "along", " ", "the", " ", "instance", "'", "s", " ", "low", "-", "level", " ", "`", "client", "`", " ", "to", " ", "the", " ", "new", " ", "resource", "\\", "10", ";", " ", " ", " ", " ", "class", "'", " ", "construct", "or", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "name_", "=_", "subre", "source", "\\u", "model_", "._", "resource_", "._", "type_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "We", " ", "need", " ", "a", " ", "new", " ", "method", " ", "here", " ", "bec", "aus", "e", " ", "we", " ", "want", " ", "access", " ", "to", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "instance", "'", "s", " ", "client", "._", "\\u\\u\\uNL\\u\\u\\u_", "def_", "create", "\\u", "resource_", "(_", "self_", ",_", "*_", "args_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "positional", "\\u", "args_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "We", " ", "lazy", "-", "load", " ", "the", " ", "class", " ", "to", " ", "handle", " ", "circular", " ", "reference", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "json", "\\u", "def_", "=_", "service", "\\u", "context_", "._", "resource", "\\u", "json", "\\u", "definitions_", "._", "get_", "(_", "name_", ",_", "{_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "resource", "\\u", "cls_", "=_", "factor", "y", "\\u", "self_", "._", "load", "\\u", "from", "\\u", "definition_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "resource", "\\u", "name_", "=_", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "single", "\\u", "resource", "\\u", "json", "\\u", "definition_", "=_", "json", "\\u", "def_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "service", "\\u", "context_", "=_", "service", "\\u", "context_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Assume", "s", " ", "tha", "t", " ", "identifi", "ers", " ", "are", " ", "in", " ", "order", ",", " ", "whi", "ch", " ", "lets", " ", "you", " ", "do_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "e", ".", "g", ".", " ", "``", "sqs", ".", "Queue", "('", "foo", "')", ".", "Messag", "e", "('", "bar", "')", "``", " ", "to", " ", "create", " ", "a", " ", "new", " ", "message_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "linked", " ", "with", " ", "the", " ", "``", "foo", "``", " ", "queue", " ", "and", " ", "whi", "ch", " ", "has", " ", "a", " ", "``", "bar", "``", " ", "receipt_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "handle", ".", " ", "If", " ", "we", " ", "did", " ", "kwarg", "s", " ", "here", " ", "then", " ", "future", " ", "positional", " ", "arguments_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "wou", "ld", " ", "lead", " ", "to", " ", "fail", "ure", "._", "\\u\\u\\uNL\\u\\u\\u_", "identifiers_", "=_", "subre", "source", "\\u", "model_", "._", "resource_", "._", "identifiers_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "identifiers_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "identifier_", ",_", "value_", "in_", "build", "\\u", "identifiers_", "(_", "identifiers_", ",_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "positional", "\\u", "args_", "._", "append_", "(_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "partial_", "(_", "resource", "\\u", "cls_", ",_", "*_", "positional", "\\u", "args_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "client_", "=_", "self_", "._", "meta_", "._", "client_", ")_", "(_", "*_", "args_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "create", "\\u", "resource_", "._", "\\u\\u", "name\\u\\u_", "=_", "str_", "(_", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "create", "\\u", "resource_", "._", "\\u\\u", "doc\\u\\u_", "=_", "docstring_", "._", "Sub", "Reso", "urc", "e", "Docs", "tring_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "resource", "\\u", "name_", "=_", "resource", "\\u", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "sub\\u", "resource", "\\u", "model_", "=_", "subre", "source", "\\u", "model_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "service", "\\u", "model_", "=_", "service", "\\u", "context_", "._", "service", "\\u", "model_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "include", "\\u", "signature_", "=_", "False_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "create", "\\u", "resource_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Reso", "urc", "e", "Factory_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "create", "\\u", "action_", "(_", "factor", "y", "\\u", "self_", ",_", "action", "\\u", "model_", ",_", "resource", "\\u", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "service", "\\u", "context_", ",_", "is", "\\u", "load_", "=_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Creat", "es", " ", "a", " ", "new", " ", "method", " ", "whi", "ch", " ", "make", "s", " ", "a", " ", "request", " ", "to", " ", "the", " ", "underl", "ying", "\\", "10", ";", " ", " ", " ", " ", "AW", "S", " ", "service", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Creat", "e", " ", "the", " ", "action", " ", "in", " ", "in", " ", "this", " ", "clos", "ure", " ", "but", " ", "bef", "ore", " ", "the", " ", "``", "do", "\\u", "action", "``", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "method", " ", "belo", "w", " ", "is", " ", "invoke", "d", ",", " ", "whi", "ch", " ", "allow", "s", " ", "instance", "s", " ", "of", " ", "the", " ", "resource_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "to", " ", "share", " ", "the", " ", "Service", "Action", " ", "instance", "._", "\\u\\u\\uNL\\u\\u\\u_", "action_", "=_", "Service", "Action_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "action", "\\u", "model_", ",_", "factory_", "=_", "factor", "y", "\\u", "self_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "service", "\\u", "context_", "=_", "service", "\\u", "context_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "A", " ", "resource", "'", "s", " ", "``", "load", "``", " ", "method", " ", "is", " ", "special", " ", "bec", "aus", "e", " ", "it", " ", "sets_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "values", " ", "on", " ", "the", " ", "resource", " ", "inst", "ead", " ", "of", " ", "return", "ing", " ", "the", " ", "response", "._", "\\u\\u\\uNL\\u\\u\\u_", "if_", "is", "\\u", "load_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "We", " ", "need", " ", "a", " ", "new", " ", "method", " ", "here", " ", "bec", "aus", "e", " ", "we", " ", "want", " ", "access", " ", "to", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "instance", " ", "via", " ", "``", "self", "``.", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "do", "\\u", "action_", "(_", "self_", ",_", "*_", "args_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "response_", "=_", "action_", "(_", "self_", ",_", "*_", "args_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "meta_", "._", "data_", "=_", "response_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Creat", "e", " ", "the", " ", "docstr", "ing", " ", "for", " ", "the", " ", "load", "/", "relo", "ad", " ", "me", "ht", "ods", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "lazy", "\\u", "docstring_", "=_", "docstring_", "._", "Load", "Relo", "ad", "Docs", "tring_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "action", "\\u", "name_", "=_", "action", "\\u", "model_", "._", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "resource", "\\u", "name_", "=_", "resource", "\\u", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "event", "\\u", "emitter_", "=_", "factor", "y", "\\u", "self_", "._", "\\u", "emitter_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "load", "\\u", "model_", "=_", "action", "\\u", "model_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "service", "\\u", "model_", "=_", "service", "\\u", "context_", "._", "service", "\\u", "model_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "include", "\\u", "signature_", "=_", "False_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "We", " ", "need", " ", "a", " ", "new", " ", "method", " ", "here", " ", "bec", "aus", "e", " ", "we", " ", "want", " ", "access", " ", "to", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "instance", " ", "via", " ", "``", "self", "``.", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "do", "\\u", "action_", "(_", "self_", ",_", "*_", "args_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "response_", "=_", "action_", "(_", "self_", ",_", "*_", "args_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "hasattr_", "(_", "self_", ",_", "'", "load", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Clear", " ", "cache", "d", " ", "data", ".", " ", "It", " ", "will", " ", "be", " ", "reloade", "d", " ", "the", " ", "next_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "time", " ", "tha", "t", " ", "an", " ", "attribute", " ", "is", " ", "accesse", "d", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "TOD", "O", ":", " ", "Make", " ", "this", " ", "configurable", " ", "in", " ", "the", " ", "future", "?", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "self_", "._", "meta_", "._", "data_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "response_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "lazy", "\\u", "docstring_", "=_", "docstring_", "._", "Action", "Docs", "tring_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "resource", "\\u", "name_", "=_", "resource", "\\u", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "event", "\\u", "emitter_", "=_", "factor", "y", "\\u", "self_", "._", "\\u", "emitter_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "action", "\\u", "model_", "=_", "action", "\\u", "model_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "service", "\\u", "model_", "=_", "service", "\\u", "context_", "._", "service", "\\u", "model_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "include", "\\u", "signature_", "=_", "False_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "do", "\\u", "action_", "._", "\\u\\u", "name\\u\\u_", "=_", "str_", "(_", "action", "\\u", "model_", "._", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "do", "\\u", "action_", "._", "\\u\\u", "doc\\u\\u_", "=_", "lazy", "\\u", "docstring_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "do", "\\u", "action_" ]
[ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2,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 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
JamesPHoughton/pysd/test_model_library.py
[ { "content": "import glob\nimport os.path\nimport traceback\nfrom parsimonious.exceptions import ParseError, IncompleteParseError, VisitationError\nimport pandas as pd\nimport pysd\nimport sys\nimport timeit\nstarttime = timeit.time.time()\n\n\ntest_dir = 'tests/test-models-master/'\n\n\n# get tests from github, using another script\nif not os.path.isdir(test_dir):\n import get_tests\n\n\nvensim_testfiles = glob.glob(test_dir+'*/*/*.mdl')\n#xmile_testfiles = glob.glob(test_dir+'*/*/*.xmile')\nxmile_testfiles = []\ntestfiles = vensim_testfiles + xmile_testfiles\n\nprint \"Testing module at location: %s\\n\"%pysd.__file__\nerr_str = '\\n\\n'\nthreshold = 1\n\nsuccess_count = 0\nerr_count = 0\nfail_count = 0\n\nfor modelfile in testfiles:\n #print modelfile\n directory = os.path.dirname(modelfile)\n try:\n if modelfile[-3:] == \"mdl\":\n model = pysd.read_vensim(modelfile)\n elif modelfile[-5:] == \"xmile\":\n model = pysd.read_xmile(modelfile)\n \n canon = pd.read_csv(directory+'/output.csv', index_col='Time')\n canon.columns = [pysd.builder.make_python_identifier(x) for x in canon.columns.values]\n \n output = model.run(return_columns=list(canon.columns.values))\n \n assert (canon-output).max().max() < 1\n \n print '.',\n success_count += 1\n \n except ParseError as e:\n print 'F',\n \n err_str += '='*60 + '\\n'\n err_str += 'Test Failure of: %s \\n'%modelfile\n err_str += '-'*60 + '\\n'\n err_str += 'Parsing Error at line: %i, column%i.\\n'%(e.line(), e.column())\n err_str += 'On rule: %s \\n\\n'%e.expr.__repr__()\n err_str += str(e)\n #err_str += e.text.splitlines()[e.line()-1] + '\\n' #line numbers are 1 based, most likely\n #err_str += '^'.rjust(e.column())\n err_str += '\\n\\n'\n\n fail_count += 1\n\n except VisitationError as e:\n print 'F',\n\n err_str += '='*60 + '\\n'\n err_str += 'Test Failure of: %s \\n'%modelfile\n err_str += '-'*60 + '\\n'\n err_str += str(e.args[0])\n err_str += '\\n\\n'\n \n except IOError as e:\n print 'E',\n \n err_str += '='*60 + '\\n'\n err_str += 'Test Error attempting: %s \\n'%modelfile\n err_str += '-'*60 + '\\n'\n err_str += 'Could not load canonical output\\n'\n err_str += '\\n\\n'\n\n err_count += 1\n\n except AssertionError as e:\n print 'F',\n\n err_str += '='*60 + '\\n'\n err_str += 'Test Failure of: %s \\n'%modelfile\n err_str += '-'*60 + '\\n'\n err_str += 'Model output does not match canon.\\n'\n err_str += 'Variable Maximum Discrepancy\\n'\n err_str += str((canon-output).max())\n err_str += '\\n\\n'\n\n fail_count += 1\n\n except Exception as e:\n print 'E',\n err_str += '='*60 + '\\n'\n err_str += 'Unknown issue with: %s \\n'%modelfile\n err_str += '-'*60 + '\\n'\n err_str += str(e.args[0])\n err_str += '\\n\\n'\n\n err_count += 1\n\nendtime = timeit.time.time()\n\nerr_str += '='*60 + '\\n'\nerr_str += 'Attempted %i tests in %.02f seconds \\n'%(len(testfiles), (endtime-starttime))\nerr_str += '%i Successes, %i Failures, %i Errors'%(success_count, fail_count, err_count)\n\nprint err_str", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[ { "span": "import traceback", "start_line": 2, "start_column": 0, "end_line": 2, "end_column": 16 }, { "span": "from parsimonious.exceptions import ParseError, IncompleteParseError, VisitationError", "start_line": 3, "start_column": 0, "end_line": 3, "end_column": 85 }, { "span": "import sys", "start_line": 6, "start_column": 0, "end_line": 6, "end_column": 10 }, { "span": "import get_tests", "start_line": 16, "start_column": 4, "end_line": 16, "end_column": 20 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "import_", "glob_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "os_", "._", "path_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "traceback_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "pars", "imo", "nio", "us_", "._", "exceptions_", "import_", "Pars", "e", "Error_", ",_", "Incomp", "lete", "Pars", "e", "Error_", ",_", "Visit", "ation", "Error_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "pandas_", "as_", "pd_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "pys", "d_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "timeit_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "starttime_", "=_", "timeit_", "._", "time_", "._", "time_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "test\\u", "dir_", "=_", "'", "tests", "/", "test", "-", "model", "s", "-", "master", "/'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "get", " ", "tests", " ", "from", " ", "git", "hub", ",", " ", "usi", "ng", " ", "anot", "her", " ", "script_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "os_", "._", "path_", "._", "isdir_", "(_", "test\\u", "dir_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "get", "\\u", "tests_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "ven", "sim", "\\u", "testfile", "s_", "=_", "glob_", "._", "glob_", "(_", "test\\u", "dir_", "+_", "'*/", "*/", "*.", "mdl", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "xmi", "le", "\\u", "testfile", "s", " ", "=", " ", "glob", ".", "glob", "(", "test\\u", "dir", "+'", "*/", "*/", "*.", "xmi", "le", "')", "_", "\\u\\u\\uNL\\u\\u\\u_", "xmi", "le", "\\u", "testfile", "s_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "testfile", "s_", "=_", "ven", "sim", "\\u", "testfile", "s_", "+_", "xmi", "le", "\\u", "testfile", "s_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "print_", "\"", "Test", "ing", " ", "module", " ", "at", " ", "location", ":", " ", "%", "s", "\\\\", "n", "\"_", "%_", "pys", "d_", "._", "\\u\\u", "file\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "err", "\\u", "str_", "=_", "'\\\\", "n", "\\\\", "n", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "threshold_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "success", "\\u", "count_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "err", "\\u", "count_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fail", "\\u", "count_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "modelf", "ile_", "in_", "testfile", "s_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "print", " ", "modelf", "ile_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "directory_", "=_", "os_", "._", "path_", "._", "dirname_", "(_", "modelf", "ile_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "modelf", "ile_", "[_", "-_", "3_", ":_", "]_", "==_", "\"", "mdl", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "model_", "=_", "pys", "d_", "._", "read", "\\u", "ven", "sim_", "(_", "modelf", "ile_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "modelf", "ile_", "[_", "-_", "5_", ":_", "]_", "==_", "\"", "xmi", "le", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "model_", "=_", "pys", "d_", "._", "read", "\\u", "xmi", "le_", "(_", "modelf", "ile_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "canon", "_", "=_", "pd_", "._", "read", "\\u", "csv_", "(_", "directory_", "+_", "'/", "output", ".", "csv", "'_", ",_", "index", "\\u", "col_", "=_", "'", "Time", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "canon", "_", "._", "columns_", "=_", "[_", "pys", "d_", "._", "builder_", "._", "make", "\\u", "python", "\\u", "identifier_", "(_", "x_", ")_", "for_", "x_", "in_", "canon", "_", "._", "columns_", "._", "values_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "output_", "=_", "model_", "._", "run_", "(_", "return", "\\u", "columns_", "=_", "list_", "(_", "canon", "_", "._", "columns_", "._", "values_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "assert_", "(_", "canon", "_", "-_", "output_", ")_", "._", "max_", "(_", ")_", "._", "max_", "(_", ")_", "<_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "print_", "'.'_", ",_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "success", "\\u", "count_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Pars", "e", "Error_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "'", "F", "'_", ",_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "err", "\\u", "str_", "+=_", "'='_", "*_", "60_", "+_", "'\\\\", "n", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "err", "\\u", "str_", "+=_", "'", "Test", " ", "Fail", "ure", " ", "of", ":", " ", "%", "s", " ", "\\\\", "n", "'_", "%_", "modelf", "ile_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "err", "\\u", "str_", "+=_", "'-'_", "*_", "60_", "+_", "'\\\\", "n", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "err", "\\u", "str_", "+=_", "'", "Pars", "ing", " ", "Error", " ", "at", " ", "line", ":", " ", "%", "i", ",", " ", "column", "%", "i", ".\\\\", "n", "'_", "%_", "(_", "e_", "._", "line_", "(_", ")_", ",_", "e_", "._", "column_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "err", "\\u", "str_", "+=_", "'", "On", " ", "rule", ":", " ", "%", "s", " ", "\\\\", "n", "\\\\", "n", "'_", "%_", "e_", "._", "expr_", "._", "\\u\\u", "repr\\u\\u_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "err", "\\u", "str_", "+=_", "str_", "(_", "e_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "err", "\\u", "str", " ", "+=", " ", "e", ".", "text", ".", "split", "lines", "()[", "e", ".", "line", "()", "-1", "]", " ", "+", " ", "'\\\\", "n", "'", " ", "#", "line", " ", "numbers", " ", "are", " ", "1", " ", "based", ",", " ", "most", " ", "like", "ly_", "\\u\\u\\uNL\\u\\u\\u_", "#", "err", "\\u", "str", " ", "+=", " ", "'", "^", "'.", "rj", "ust", "(", "e", ".", "column", "())", "_", "\\u\\u\\uNL\\u\\u\\u_", "err", "\\u", "str_", "+=_", "'\\\\", "n", "\\\\", "n", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "fail", "\\u", "count_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Visit", "ation", "Error_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "'", "F", "'_", ",_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "err", "\\u", "str_", "+=_", "'='_", "*_", "60_", "+_", "'\\\\", "n", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "err", "\\u", "str_", "+=_", "'", "Test", " ", "Fail", "ure", " ", "of", ":", " ", "%", "s", " ", "\\\\", "n", "'_", "%_", "modelf", "ile_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "err", "\\u", "str_", "+=_", "'-'_", "*_", "60_", "+_", "'\\\\", "n", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "err", "\\u", "str_", "+=_", "str_", "(_", "e_", "._", "args_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "err", "\\u", "str_", "+=_", "'\\\\", "n", "\\\\", "n", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "IO", "Error_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "'", "E", "'_", ",_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "err", "\\u", "str_", "+=_", "'='_", "*_", "60_", "+_", "'\\\\", "n", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "err", "\\u", "str_", "+=_", "'", "Test", " ", "Error", " ", "atte", "mpt", "ing", ":", " ", "%", "s", " ", "\\\\", "n", "'_", "%_", "modelf", "ile_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "err", "\\u", "str_", "+=_", "'-'_", "*_", "60_", "+_", "'\\\\", "n", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "err", "\\u", "str_", "+=_", "'", "Cou", "ld", " ", "not", " ", "load", " ", "canonical", " ", "output", "\\\\", "n", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "err", "\\u", "str_", "+=_", "'\\\\", "n", "\\\\", "n", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "err", "\\u", "count_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Assert", "ion", "Error_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "'", "F", "'_", ",_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "err", "\\u", "str_", "+=_", "'='_", "*_", "60_", "+_", "'\\\\", "n", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "err", "\\u", "str_", "+=_", "'", "Test", " ", "Fail", "ure", " ", "of", ":", " ", "%", "s", " ", "\\\\", "n", "'_", "%_", "modelf", "ile_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "err", "\\u", "str_", "+=_", "'-'_", "*_", "60_", "+_", "'\\\\", "n", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "err", "\\u", "str_", "+=_", "'", "Model", " ", "output", " ", "doe", "s", " ", "not", " ", "match", " ", "canon", ".\\\\", "n", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "err", "\\u", "str_", "+=_", "'", "Varia", "ble", " ", " ", " ", "Maxim", "um", " ", "Discr", "epa", "nc", "y", "\\\\", "n", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "err", "\\u", "str_", "+=_", "str_", "(_", "(_", "canon", "_", "-_", "output_", ")_", "._", "max_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "err", "\\u", "str_", "+=_", "'\\\\", "n", "\\\\", "n", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "fail", "\\u", "count_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "'", "E", "'_", ",_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "err", "\\u", "str_", "+=_", "'='_", "*_", "60_", "+_", "'\\\\", "n", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "err", "\\u", "str_", "+=_", "'", "Un", "know", "n", " ", "issue", " ", "with", ":", " ", "%", "s", " ", "\\\\", "n", "'_", "%_", "modelf", "ile_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "err", "\\u", "str_", "+=_", "'-'_", "*_", "60_", "+_", "'\\\\", "n", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "err", "\\u", "str_", "+=_", "str_", "(_", "e_", "._", "args_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "err", "\\u", "str_", "+=_", "'\\\\", "n", "\\\\", "n", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "err", "\\u", "count_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "endtime_", "=_", "timeit_", "._", "time_", "._", "time_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "err", "\\u", "str_", "+=_", "'='_", "*_", "60_", "+_", "'\\\\", "n", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "err", "\\u", "str_", "+=_", "'", "Atte", "mpte", "d", " ", "%", "i", " ", "tests", " ", "in", " ", "%", ".02", "f", " ", "second", "s", " ", "\\\\", "n", "'_", "%_", "(_", "len_", "(_", "testfile", "s_", ")_", ",_", "(_", "endtime_", "-_", "starttime_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "err", "\\u", "str_", "+=_", "'%", "i", " ", "Success", "es", ",", " ", "%", "i", " ", "Fail", "ure", "s", ",", " ", "%", "i", " ", "Error", "s",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