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
sequence
label_sequence
sequence
Except block handles 'BaseException'
bread-and-pepper/django-userena/setup.py
[ { "content": "from setuptools import setup, find_packages\nimport sys\n\nuserena = __import__('userena')\n\nreadme_file = 'README.md'\ntry:\n long_description = open(readme_file).read()\nexcept IOError:\n sys.stderr.write(\n \"[ERROR] Cannot find file specified as \"\n \"``long_description`` (%s)\\n\" % readme_file\n )\n sys.exit(1)\n\ninstall_requires = [\n 'easy_thumbnails',\n 'django-guardian<=1.4.1',\n 'html2text==2014.12.29'\n]\n\ntry:\n from collections import OrderedDict\nexcept ImportError:\n install_requires.append('ordereddict')\n\nsetup(name='django-userena',\n version=userena.get_version(),\n description='Complete user management application for Django',\n long_description=long_description,\n zip_safe=False,\n author='Petar Radosevic',\n author_email='petar@wunki.org',\n url='https://github.com/bread-and-pepper/django-userena/',\n download_url='https://github.com/bread-and-pepper/django-userena/downloads',\n packages=find_packages(exclude=['demo', 'demo.*']),\n include_package_data=True,\n install_requires = install_requires,\n test_suite='tests.main',\n classifiers=[\n 'Development Status :: 4 - Beta',\n 'Environment :: Web Environment',\n 'Framework :: Django',\n 'Framework :: Django :: 1.5',\n 'Framework :: Django :: 1.6',\n 'Framework :: Django :: 1.7',\n 'Framework :: Django :: 1.8',\n 'Framework :: Django :: 1.9',\n 'Intended Audience :: Developers',\n 'License :: OSI Approved :: BSD License',\n 'Operating System :: OS Independent',\n 'Programming Language :: Python',\n 'Programming Language :: Python :: 2',\n 'Programming Language :: Python :: 2.6',\n 'Programming Language :: Python :: 2.7',\n 'Programming Language :: Python :: 3',\n 'Programming Language :: Python :: 3.2',\n 'Programming Language :: Python :: 3.3',\n 'Programming Language :: Python :: 3.4',\n 'Programming Language :: Python :: 3.5',\n 'Topic :: Utilities'\n ],\n )\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[]
[]
0
true
[ "[CLS]_", "Except", "_", "block_", "handles_", "'", "Base", "Except", "ion", "'_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "from_", "setuptools_", "import_", "setup_", ",_", "find", "\\u", "packages_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "user", "ena", "_", "=_", "\\u\\u", "import\\u\\u_", "(_", "'", "user", "ena", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "readme", "\\u", "file_", "=_", "'", "READ", "ME", ".", "md", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "long", "\\u", "description_", "=_", "open_", "(_", "readme", "\\u", "file_", ")_", "._", "read_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "IO", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sys_", "._", "stderr_", "._", "write_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"[", "ERROR", "]", " ", "Cann", "ot", " ", "find", " ", "file", " ", "specified", " ", "as", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"``", "long", "\\u", "description", "``", " ", "(%", "s", ")\\\\", "n", "\"_", "%_", "readme", "\\u", "file_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "exit_", "(_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "install", "\\u", "requires_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "'", "easy", "\\u", "thumbnail", "s", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "django", "-", "guard", "ian", "<=", "1.4", ".1", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "html", "2te", "xt", "==", "2014", ".12", ".2", "9", "'_", "\\u\\u\\uNL\\u\\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_", "collections_", "import_", "Order", "ed", "Dict_", "\\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 ", " _", "install", "\\u", "requires_", "._", "append_", "(_", "'", "order", "eddi", "ct", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "setup_", "(_", "name_", "=_", "'", "django", "-", "user", "ena", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "version_", "=_", "user", "ena", "_", "._", "get", "\\u", "version_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "description_", "=_", "'", "Complete", " ", "user", " ", "manage", "ment", " ", "applica", "tion", " ", "for", " ", "Dj", "ang", "o", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "long", "\\u", "description_", "=_", "long", "\\u", "description_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "zip", "\\u", "safe_", "=_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "author_", "=_", "'", "Pet", "ar", " ", "Rad", "ose", "vic", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "author", "\\u", "email_", "=_", "'", "pet", "ar", "@", "wu", "nk", "i", ".", "org", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "url_", "=_", "'", "https", "://", "git", "hub", ".", "com", "/", "bread", "-", "and", "-", "pep", "per", "/", "django", "-", "user", "ena", "/'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "download", "\\u", "url_", "=_", "'", "https", "://", "git", "hub", ".", "com", "/", "bread", "-", "and", "-", "pep", "per", "/", "django", "-", "user", "ena", "/", "download", "s", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "packages_", "=_", "find", "\\u", "packages_", "(_", "exclude_", "=_", "[_", "'", "demo", "'_", ",_", "'", "demo", ".*'_", "]_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "include", "\\u", "package", "\\u", "data_", "=_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "install", "\\u", "requires_", "=_", "install", "\\u", "requires_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "test\\u", "suite_", "=_", "'", "tests", ".", "main", "'_", ",_", "\\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_", "'", "Environ", "ment", " ", "::", " ", "Web", " ", "Environ", "ment", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Frame", "work", " ", "::", " ", "Dj", "ang", "o", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Frame", "work", " ", "::", " ", "Dj", "ang", "o", " ", "::", " ", "1.5", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Frame", "work", " ", "::", " ", "Dj", "ang", "o", " ", "::", " ", "1.6", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Frame", "work", " ", "::", " ", "Dj", "ang", "o", " ", "::", " ", "1.7", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Frame", "work", " ", "::", " ", "Dj", "ang", "o", " ", "::", " ", "1.8", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Frame", "work", " ", "::", " ", "Dj", "ang", "o", " ", "::", " ", "1.9", "'_", ",_", "\\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_", "'", "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.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.2", "'_", ",_", "\\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", "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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 local variable
brutasse/django-password-reset/password_reset/forms.py
[ { "content": " def get_user_by_email(self, email):\n validate_email(email)\n key = 'email__%sexact' % ('' if self.case_sensitive else 'i')\n User = get_user_model()\n try:\n user = User._default_manager.get(**{key: email})\n except User.DoesNotExist:\n raise forms.ValidationError(self.error_messages['not_found'],\n code='not_found')\n return user", "metadata": "root.PasswordRecoveryForm.get_user_by_email", "header": "['class', 'PasswordRecoveryForm', '(', 'forms', '.', 'Form', ')', ':', '___EOS___']", "index": 69 } ]
[]
[]
0
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "Passw", "ord", "Recover", "y", "Form_", "(_", "forms_", "._", "Form_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "user", "\\u", "by", "\\u", "email_", "(_", "self_", ",_", "email_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "validat", "e\\u", "email_", "(_", "email_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "key_", "=_", "'", "email", "\\u\\u", "%", "sex", "act", "'_", "%_", "(_", "''_", "if_", "self_", "._", "case", "\\u", "sensitive_", "else_", "'", "i", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "User_", "=_", "get", "\\u", "user", "\\u", "model_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "user_", "=_", "User_", "._", "\\u", "default", "\\u", "manager_", "._", "get_", "(_", "**_", "{_", "key_", ":_", "email_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "User_", "._", "Do", "es", "Not", "Exist_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "forms_", "._", "Validat", "ion", "Error_", "(_", "self_", "._", "error", "\\u", "messages_", "[_", "'", "not", "\\u", "found", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "code_", "=_", "'", "not", "\\u", "found", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "user_", "\\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 ]
Unused import
datamachine/telex/plugins/chatlog.py
[ { "content": "import tgl\nfrom telex.DatabaseMixin import DatabaseMixin, DbType\nfrom telex.utils.decorators import group_only\nfrom functools import partial\nfrom telex import plugin\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class ChatLogPlugin(plugin.TelexPlugin, DatabaseMixin):\n \"\"\"\n Tracks a chat log and provides statistics and queries\n \"\"\"\n HISTORY_QUERY_SIZE = 1000\n\n patterns = {\n \"^{prefix}stats$\": \"stats_count\",\n \"^{prefix}stats_pattern (.*)\": \"stats_pattern\",\n \"^{prefix}loadhistory$\": \"load_history\",\n \"^{prefix}seen (([0-9]+)|@(.*)|(.*))\": \"seen\"\n }\n\n usage = [\n \"{prefix}stats: return chat stats\",\n \"{prefix}stats_pattern %somepattern%: returns stats filtered by SQL LIKE style pattern\",\n \"{prefix}seen (uid|@username|full name): Find the last time someone said something in the current chat\",\n \"{prefix}loadhistory: (Admin) load chatlog database from telegram history.\",\n ]\n\n schema = {\n 'msg_id': DbType.Integer,\n 'timestamp': DbType.DateTime,\n 'uid': DbType.Integer,\n 'chat_id': DbType.Integer,\n 'username': DbType.String,\n 'full_name': DbType.String,\n 'message': DbType.String,\n }\n primary_key = 'msg_id'\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n", "metadata": "root.ChatLogPlugin", "header": "['module', '___EOS___']", "index": 7 }, { "content": " def __init__(self):\n super().__init__()\n DatabaseMixin.__init__(self)", "metadata": "root.ChatLogPlugin.__init__", "header": "['class', 'ChatLogPlugin', '(', 'plugin', '.', 'TelexPlugin', ',', 'DatabaseMixin', ')', ':', '___EOS___']", "index": 38 }, { "content": " def pre_process(self, msg):\n if not hasattr(msg, 'text'): #TODO support media\n return\n if hasattr(msg.src, 'username'):\n username = msg.src.username\n else:\n username = \"\"\n self.insert(msg_id=msg.id, timestamp=msg.date,\n uid=msg.src.id, username=username,\n full_name=\"{0} {1}\".format(msg.src.first_name, msg.src.last_name or ''),\n chat_id=msg.dest.id, message=msg.text)", "metadata": "root.ChatLogPlugin.pre_process", "header": "['class', 'ChatLogPlugin', '(', 'plugin', '.', 'TelexPlugin', ',', 'DatabaseMixin', ')', ':', '___EOS___']", "index": 42 }, { "content": " @group_only\n def seen(self, msg, matches):\n chat_id = msg.dest.id\n if matches.group(2) is not None:\n return self.seen_by_id(chat_id, matches.group(2))\n elif matches.group(3) is not None:\n return self.seen_by_username(chat_id, matches.group(3))\n else:\n return self.seen_by_fullname(chat_id, matches.group(4))", "metadata": "root.ChatLogPlugin.seen", "header": "['class', 'ChatLogPlugin', '(', 'plugin', '.', 'TelexPlugin', ',', 'DatabaseMixin', ')', ':', '___EOS___']", "index": 54 }, { "content": " @group_only\n def load_history(self, msg, matches):\n chat = msg.dest\n msg_count = 0\n tgl.get_history(chat, msg_count,\n self.HISTORY_QUERY_SIZE,\n partial(self.history_cb, msg_count, chat))", "metadata": "root.ChatLogPlugin.load_history", "header": "['class', 'ChatLogPlugin', '(', 'plugin', '.', 'TelexPlugin', ',', 'DatabaseMixin', ')', ':', '___EOS___']", "index": 65 }, { "content": " def history_cb(self, msg_count, chat, success, msgs):\n if success:\n self.insert_history(msgs)\n msg_count += len(msgs)\n if len(msgs) == self.HISTORY_QUERY_SIZE:\n tgl.get_history(chat, msg_count,\n self.HISTORY_QUERY_SIZE,\n partial(self.history_cb, msg_count, chat))\n else:\n tgl.send_msg(chat, \"Loaded {0} messaged into the table\".format(msg_count))", "metadata": "root.ChatLogPlugin.history_cb", "header": "['class', 'ChatLogPlugin', '(', 'plugin', '.', 'TelexPlugin', ',', 'DatabaseMixin', ')', ':', '___EOS___']", "index": 73 }, { "content": " def insert_history(self, msgs):\n # TODO Support Media Msgs\n values = [[msg.id, msg.date, msg.src.id, msg.src.username or '',\n \"{0} {1}\".format(msg.src.first_name or '', msg.src.last_name or ''),\n msg.dest.id, msg.text] for msg in msgs if hasattr(msg, 'text') and None not in [msg.src, msg.dest]]\n columns = ['msg_id', 'timestamp', 'uid', 'username', 'full_name', 'chat_id', 'message']\n\n self.insert_many(columns, values)", "metadata": "root.ChatLogPlugin.insert_history", "header": "['class', 'ChatLogPlugin', '(', 'plugin', '.', 'TelexPlugin', ',', 'DatabaseMixin', ')', ':', '___EOS___']", "index": 84 }, { "content": " @group_only\n def stats_count(self, msg, matches):\n return self.get_stats(msg.dest.id)", "metadata": "root.ChatLogPlugin.stats_count", "header": "['class', 'ChatLogPlugin', '(', 'plugin', '.', 'TelexPlugin', ',', 'DatabaseMixin', ')', ':', '___EOS___']", "index": 93 }, { "content": " @group_only\n def stats_pattern(self, msg, matches):\n return self.get_stats(msg.dest.id, matches.group(1))", "metadata": "root.ChatLogPlugin.stats_pattern", "header": "['class', 'ChatLogPlugin', '(', 'plugin', '.', 'TelexPlugin', ',', 'DatabaseMixin', ')', ':', '___EOS___']", "index": 97 }, { "content": " def get_stats(self, chat_id, pattern=None):\n pattern_query = \"\"\n if pattern is not None:\n pattern_query = \" AND message LIKE ? \"\n\n query = \"\"\"SELECT full_name, uid, COUNT(*) as count FROM {0}\n WHERE uid != {1} AND chat_id = {2} {3} GROUP BY uid\n ORDER BY count DESC\"\"\".format(self.table_name, self.bot.our_id, chat_id, pattern_query)\n\n if(pattern is not None):\n results = self.query(query, parameters=(pattern,))\n else:\n results = self.query(query)\n\n if results is None or len(results) == 0:\n return \"No stats match!\"\n\n text = \"Channel Chat Statistics (count):\\n\"\n for result in results:\n text += \"{name}: {count}\\n\".format(name=result[\"full_name\"],\n count=result[\"count\"])\n return text", "metadata": "root.ChatLogPlugin.get_stats", "header": "['class', 'ChatLogPlugin', '(', 'plugin', '.', 'TelexPlugin', ',', 'DatabaseMixin', ')', ':', '___EOS___']", "index": 101 }, { "content": " def seen_by_username(self, chat_id, username):\n query = \"\"\"SELECT * FROM {0}\n WHERE username LIKE ? AND chat_id == {1}\n ORDER BY timestamp DESC LIMIT 1 COLLATE NOCASE\"\"\".format(self.table_name, chat_id)\n\n results = self.query(query, parameters=(username,))\n\n return self.print_scene(results)", "metadata": "root.ChatLogPlugin.seen_by_username", "header": "['class', 'ChatLogPlugin', '(', 'plugin', '.', 'TelexPlugin', ',', 'DatabaseMixin', ')', ':', '___EOS___']", "index": 125 }, { "content": " def seen_by_fullname(self, chat_id, name):\n query = \"\"\"SELECT * FROM {0}\n WHERE full_name LIKE ? AND chat_id == {1}\n ORDER BY timestamp DESC LIMIT 1 COLLATE NOCASE\"\"\".format(self.table_name, chat_id)\n\n results = self.query(query, parameters=(name,))\n\n return self.print_scene(results)", "metadata": "root.ChatLogPlugin.seen_by_fullname", "header": "['class', 'ChatLogPlugin', '(', 'plugin', '.', 'TelexPlugin', ',', 'DatabaseMixin', ')', ':', '___EOS___']", "index": 134 }, { "content": " def seen_by_id(self, chat_id, uid):\n query = \"\"\"SELECT * FROM {0}\n WHERE uid == ? AND chat_id == {1}\n ORDER BY timestamp DESC LIMIT 1\"\"\".format(self.table_name, chat_id)\n\n results = self.query(query, parameters=(uid,))\n\n return self.print_scene(results)", "metadata": "root.ChatLogPlugin.seen_by_id", "header": "['class', 'ChatLogPlugin', '(', 'plugin', '.', 'TelexPlugin', ',', 'DatabaseMixin', ')', ':', '___EOS___']", "index": 143 }, { "content": " def print_scene(self, results):\n if len(results) == 0:\n return \"Cannot find that user in the history\"\n else:\n return \"{full_name} last seen at {timestamp} saying:\\n{msg}\".format(full_name=results[0][\"full_name\"], timestamp=results[0][\"timestamp\"], msg=results[0][\"message\"])", "metadata": "root.ChatLogPlugin.print_scene", "header": "['class', 'ChatLogPlugin', '(', 'plugin', '.', 'TelexPlugin', ',', 'DatabaseMixin', ')', ':', '___EOS___']", "index": 152 } ]
[]
[]
0
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "import_", "tg", "l_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "tele", "x_", "._", "Databa", "se", "Mixin_", "import_", "Databa", "se", "Mixin_", ",_", "Db", "Type_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "tele", "x_", "._", "utils_", "._", "decorators_", "import_", "group", "\\u", "only_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "functools_", "import_", "partial_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "tele", "x_", "import_", "plugin_", "\\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_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Cha", "t", "Log", "Plugin_", "(_", "plugin_", "._", "Tele", "x", "Plugin_", ",_", "Databa", "se", "Mixin_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Track", "s", " ", "a", " ", "chat", " ", "log", " ", "and", " ", "provide", "s", " ", "statistic", "s", " ", "and", " ", "querie", "s", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "HISTORY", "\\u", "QUE", "RY", "\\u", "SIZE_", "=_", "1000_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "patterns_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "^", "{", "prefix", "}", "stats", "$\"_", ":_", "\"", "stats", "\\u", "count", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "^", "{", "prefix", "}", "stats", "\\u", "pattern", " ", "(.*)", "\"_", ":_", "\"", "stats", "\\u", "pattern", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "^", "{", "prefix", "}", "load", "histo", "ry", "$\"_", ":_", "\"", "load", "\\u", "histo", "ry", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "^", "{", "prefix", "}", "see", "n", " ", "(([", "0", "-", "9", "]+)", "|", "@(", ".*)", "|(", ".*)", ")\"_", ":_", "\"", "see", "n", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "usage_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "\"{", "prefix", "}", "stats", ":", " ", "return", " ", "chat", " ", "stats", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"{", "prefix", "}", "stats", "\\u", "pattern", " ", "%", "some", "pattern", "%", ":", " ", "return", "s", " ", "stats", " ", "filter", "ed", " ", "by", " ", "SQL", " ", "LI", "KE", " ", "style", " ", "pattern", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"{", "prefix", "}", "see", "n", " ", "(", "uid", "|", "@", "user", "name", "|", "full", " ", "name", "):", " ", "Fin", "d", " ", "the", " ", "last", " ", "time", " ", "some", "one", " ", "sai", "d", " ", "somet", "hing", " ", "in", " ", "the", " ", "current", " ", "chat", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"{", "prefix", "}", "load", "histo", "ry", ":", " ", "(", "Admi", "n", ")", " ", "load", " ", "chat", "log", " ", "databa", "se", " ", "from", " ", "tele", "gram", " ", "histo", "ry", ".\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "schema_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "msg", "\\u", "id", "'_", ":_", "Db", "Type_", "._", "Integer_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "timestamp", "'_", ":_", "Db", "Type_", "._", "Date", "Time_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "uid", "'_", ":_", "Db", "Type_", "._", "Integer_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "chat", "\\u", "id", "'_", ":_", "Db", "Type_", "._", "Integer_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "user", "name", "'_", ":_", "Db", "Type_", "._", "String_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "full", "\\u", "name", "'_", ":_", "Db", "Type_", "._", "String_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "message", "'_", ":_", "Db", "Type_", "._", "String_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "primary", "\\u", "key_", "=_", "'", "msg", "\\u", "id", "'_", "\\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\\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\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Cha", "t", "Log", "Plugin_", "(_", "plugin_", "._", "Tele", "x", "Plugin_", ",_", "Databa", "se", "Mixin_", ")_", ":_", "\\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_", "(_", ")_", "._", "\\u\\u", "init\\u\\u_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Databa", "se", "Mixin_", "._", "\\u\\u", "init\\u\\u_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Cha", "t", "Log", "Plugin_", "(_", "plugin_", "._", "Tele", "x", "Plugin_", ",_", "Databa", "se", "Mixin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "pre", "\\u", "process_", "(_", "self_", ",_", "msg_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "hasattr_", "(_", "msg_", ",_", "'", "text", "'_", ")_", ":_", "#", "TOD", "O", " ", "support", " ", "media_", "\\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_", "if_", "hasattr_", "(_", "msg_", "._", "src_", ",_", "'", "user", "name", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "username_", "=_", "msg_", "._", "src_", "._", "username_", "\\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 ", " _", "username_", "=_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "insert_", "(_", "msg", "\\u", "id_", "=_", "msg_", "._", "id_", ",_", "timestamp_", "=_", "msg_", "._", "date_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "uid_", "=_", "msg_", "._", "src_", "._", "id_", ",_", "username_", "=_", "username_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "full", "\\u", "name_", "=_", "\"{", "0", "}", " ", "{", "1", "}\"_", "._", "format_", "(_", "msg_", "._", "src_", "._", "first", "\\u", "name_", ",_", "msg_", "._", "src_", "._", "last", "\\u", "name_", "or_", "''_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "chat", "\\u", "id_", "=_", "msg_", "._", "dest_", "._", "id_", ",_", "message_", "=_", "msg_", "._", "text_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Cha", "t", "Log", "Plugin_", "(_", "plugin_", "._", "Tele", "x", "Plugin_", ",_", "Databa", "se", "Mixin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "group", "\\u", "only_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "seen_", "(_", "self_", ",_", "msg_", ",_", "matches_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "chat", "\\u", "id_", "=_", "msg_", "._", "dest_", "._", "id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "matches_", "._", "group_", "(_", "2_", ")_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "see", "n", "\\u", "by", "\\u", "id_", "(_", "chat", "\\u", "id_", ",_", "matches_", "._", "group_", "(_", "2_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "matches_", "._", "group_", "(_", "3_", ")_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "see", "n", "\\u", "by", "\\u", "username_", "(_", "chat", "\\u", "id_", ",_", "matches_", "._", "group_", "(_", "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 ", " _", "return_", "self_", "._", "see", "n", "\\u", "by", "\\u", "fullname_", "(_", "chat", "\\u", "id_", ",_", "matches_", "._", "group_", "(_", "4_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Cha", "t", "Log", "Plugin_", "(_", "plugin_", "._", "Tele", "x", "Plugin_", ",_", "Databa", "se", "Mixin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "group", "\\u", "only_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "load", "\\u", "history_", "(_", "self_", ",_", "msg_", ",_", "matches_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "chat_", "=_", "msg_", "._", "dest_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "msg", "\\u", "count_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tg", "l_", "._", "get", "\\u", "history_", "(_", "chat_", ",_", "msg", "\\u", "count_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "HISTORY", "\\u", "QUE", "RY", "\\u", "SIZE_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "partial_", "(_", "self_", "._", "histo", "ry", "\\u", "cb_", ",_", "msg", "\\u", "count_", ",_", "chat_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Cha", "t", "Log", "Plugin_", "(_", "plugin_", "._", "Tele", "x", "Plugin_", ",_", "Databa", "se", "Mixin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "histo", "ry", "\\u", "cb_", "(_", "self_", ",_", "msg", "\\u", "count_", ",_", "chat_", ",_", "success_", ",_", "msgs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "success_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "insert", "\\u", "history_", "(_", "msgs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "msg", "\\u", "count_", "+=_", "len_", "(_", "msgs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "len_", "(_", "msgs_", ")_", "==_", "self_", "._", "HISTORY", "\\u", "QUE", "RY", "\\u", "SIZE_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "tg", "l_", "._", "get", "\\u", "history_", "(_", "chat_", ",_", "msg", "\\u", "count_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "HISTORY", "\\u", "QUE", "RY", "\\u", "SIZE_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "partial_", "(_", "self_", "._", "histo", "ry", "\\u", "cb_", ",_", "msg", "\\u", "count_", ",_", "chat_", ")_", ")_", "\\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 ", " _", "tg", "l_", "._", "send", "\\u", "msg_", "(_", "chat_", ",_", "\"", "Load", "ed", " ", "{", "0", "}", " ", "message", "d", " ", "int", "o", " ", "the", " ", "table", "\"_", "._", "format_", "(_", "msg", "\\u", "count_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Cha", "t", "Log", "Plugin_", "(_", "plugin_", "._", "Tele", "x", "Plugin_", ",_", "Databa", "se", "Mixin_", ")_", ":_", "\\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_", "insert", "\\u", "history_", "(_", "self_", ",_", "msgs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "TOD", "O", " ", "Supp", "ort", " ", "Media", " ", "Msg", "s_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "values_", "=_", "[_", "[_", "msg_", "._", "id_", ",_", "msg_", "._", "date_", ",_", "msg_", "._", "src_", "._", "id_", ",_", "msg_", "._", "src_", "._", "username_", "or_", "''_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"{", "0", "}", " ", "{", "1", "}\"_", "._", "format_", "(_", "msg_", "._", "src_", "._", "first", "\\u", "name_", "or_", "''_", ",_", "msg_", "._", "src_", "._", "last", "\\u", "name_", "or_", "''_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "msg_", "._", "dest_", "._", "id_", ",_", "msg_", "._", "text_", "]_", "for_", "msg_", "in_", "msgs_", "if_", "hasattr_", "(_", "msg_", ",_", "'", "text", "'_", ")_", "and_", "None_", "not_", "in_", "[_", "msg_", "._", "src_", ",_", "msg_", "._", "dest_", "]_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "columns_", "=_", "[_", "'", "msg", "\\u", "id", "'_", ",_", "'", "timestamp", "'_", ",_", "'", "uid", "'_", ",_", "'", "user", "name", "'_", ",_", "'", "full", "\\u", "name", "'_", ",_", "'", "chat", "\\u", "id", "'_", ",_", "'", "message", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "insert", "\\u", "many_", "(_", "columns_", ",_", "values_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Cha", "t", "Log", "Plugin_", "(_", "plugin_", "._", "Tele", "x", "Plugin_", ",_", "Databa", "se", "Mixin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "group", "\\u", "only_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "stats", "\\u", "count_", "(_", "self_", ",_", "msg_", ",_", "matches_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "get", "\\u", "stats_", "(_", "msg_", "._", "dest_", "._", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Cha", "t", "Log", "Plugin_", "(_", "plugin_", "._", "Tele", "x", "Plugin_", ",_", "Databa", "se", "Mixin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "group", "\\u", "only_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "stats", "\\u", "pattern_", "(_", "self_", ",_", "msg_", ",_", "matches_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "get", "\\u", "stats_", "(_", "msg_", "._", "dest_", "._", "id_", ",_", "matches_", "._", "group_", "(_", "1_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Cha", "t", "Log", "Plugin_", "(_", "plugin_", "._", "Tele", "x", "Plugin_", ",_", "Databa", "se", "Mixin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "stats_", "(_", "self_", ",_", "chat", "\\u", "id_", ",_", "pattern_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pattern", "\\u", "query_", "=_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "pattern_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pattern", "\\u", "query_", "=_", "\"", " ", "AND", " ", "message", " ", "LI", "KE", " ", "?", " ", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "query_", "=_", "\"\"\"", "SELECT", " ", "full", "\\u", "name", ",", " ", "uid", ",", " ", "COUNT", "(*", ")", " ", "as", " ", "count", " ", "FROM", " ", "{", "0", "}", "\\", "10", ";", " ", "WHE", "RE", " ", "uid", " ", "!=", " ", "{", "1", "}", " ", "AND", " ", "chat", "\\u", "id", " ", "=", " ", "{", "2", "}", " ", "{", "3", "}", " ", "GROU", "P", " ", "BY", " ", "uid", "\\", "10", ";", " ", "ORDE", "R", " ", "BY", " ", "count", " ", "DESC", "\"\"\"_", "._", "format_", "(_", "self_", "._", "table", "\\u", "name_", ",_", "self_", "._", "bot_", "._", "our", "\\u", "id_", ",_", "chat", "\\u", "id_", ",_", "pattern", "\\u", "query_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "(_", "pattern_", "is_", "not_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "results_", "=_", "self_", "._", "query_", "(_", "query_", ",_", "parameters_", "=_", "(_", "pattern_", ",_", ")_", ")_", "\\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 ", " _", "results_", "=_", "self_", "._", "query_", "(_", "query_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "results_", "is_", "None_", "or_", "len_", "(_", "results_", ")_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\"", "No", " ", "stats", " ", "match", "!\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "text_", "=_", "\"", "Chan", "nel", " ", "Cha", "t", " ", "Statistic", "s", " ", "(", "count", "):", "\\\\", "n", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "result_", "in_", "results_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "text_", "+=_", "\"{", "name", "}:", " ", "{", "count", "}\\\\", "n", "\"_", "._", "format_", "(_", "name_", "=_", "result_", "[_", "\"", "full", "\\u", "name", "\"_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "count_", "=_", "result_", "[_", "\"", "count", "\"_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "text_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Cha", "t", "Log", "Plugin_", "(_", "plugin_", "._", "Tele", "x", "Plugin_", ",_", "Databa", "se", "Mixin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "see", "n", "\\u", "by", "\\u", "username_", "(_", "self_", ",_", "chat", "\\u", "id_", ",_", "username_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "query_", "=_", "\"\"\"", "SELECT", " ", "*", " ", "FROM", " ", "{", "0", "}", "\\", "10", ";", " ", "WHE", "RE", " ", "user", "name", " ", "LI", "KE", " ", "?", " ", "AND", " ", "chat", "\\u", "id", " ", "==", " ", "{", "1", "}", "\\", "10", ";", " ", "ORDE", "R", " ", "BY", " ", "timestamp", " ", "DESC", " ", "LIMIT", " ", "1", " ", "COLL", "ATE", " ", "NOC", "AS", "E", "\"\"\"_", "._", "format_", "(_", "self_", "._", "table", "\\u", "name_", ",_", "chat", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "results_", "=_", "self_", "._", "query_", "(_", "query_", ",_", "parameters_", "=_", "(_", "username_", ",_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "self_", "._", "print", "\\u", "scene_", "(_", "results_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Cha", "t", "Log", "Plugin_", "(_", "plugin_", "._", "Tele", "x", "Plugin_", ",_", "Databa", "se", "Mixin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "see", "n", "\\u", "by", "\\u", "fullname_", "(_", "self_", ",_", "chat", "\\u", "id_", ",_", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "query_", "=_", "\"\"\"", "SELECT", " ", "*", " ", "FROM", " ", "{", "0", "}", "\\", "10", ";", " ", "WHE", "RE", " ", "full", "\\u", "name", " ", "LI", "KE", " ", "?", " ", "AND", " ", "chat", "\\u", "id", " ", "==", " ", "{", "1", "}", "\\", "10", ";", " ", "ORDE", "R", " ", "BY", " ", "timestamp", " ", "DESC", " ", "LIMIT", " ", "1", " ", "COLL", "ATE", " ", "NOC", "AS", "E", "\"\"\"_", "._", "format_", "(_", "self_", "._", "table", "\\u", "name_", ",_", "chat", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "results_", "=_", "self_", "._", "query_", "(_", "query_", ",_", "parameters_", "=_", "(_", "name_", ",_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "self_", "._", "print", "\\u", "scene_", "(_", "results_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Cha", "t", "Log", "Plugin_", "(_", "plugin_", "._", "Tele", "x", "Plugin_", ",_", "Databa", "se", "Mixin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "see", "n", "\\u", "by", "\\u", "id_", "(_", "self_", ",_", "chat", "\\u", "id_", ",_", "uid_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "query_", "=_", "\"\"\"", "SELECT", " ", "*", " ", "FROM", " ", "{", "0", "}", "\\", "10", ";", " ", "WHE", "RE", " ", "uid", " ", "==", " ", "?", " ", "AND", " ", "chat", "\\u", "id", " ", "==", " ", "{", "1", "}", "\\", "10", ";", " ", "ORDE", "R", " ", "BY", " ", "timestamp", " ", "DESC", " ", "LIMIT", " ", "1", "\"\"\"_", "._", "format_", "(_", "self_", "._", "table", "\\u", "name_", ",_", "chat", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "results_", "=_", "self_", "._", "query_", "(_", "query_", ",_", "parameters_", "=_", "(_", "uid_", ",_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "self_", "._", "print", "\\u", "scene_", "(_", "results_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Cha", "t", "Log", "Plugin_", "(_", "plugin_", "._", "Tele", "x", "Plugin_", ",_", "Databa", "se", "Mixin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "print", "\\u", "scene_", "(_", "self_", ",_", "results_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "len_", "(_", "results_", ")_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\"", "Cann", "ot", " ", "find", " ", "tha", "t", " ", "user", " ", "in", " ", "the", " ", "histo", "ry", "\"_", "\\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_", "\"{", "full", "\\u", "name", "}", " ", "last", " ", "see", "n", " ", "at", " ", "{", "timestamp", "}", " ", "say", "ing", ":\\\\", "n", "{", "msg", "}\"_", "._", "format_", "(_", "full", "\\u", "name_", "=_", "results_", "[_", "0_", "]_", "[_", "\"", "full", "\\u", "name", "\"_", "]_", ",_", "timestamp_", "=_", "results_", "[_", "0_", "]_", "[_", "\"", "timestamp", "\"_", "]_", ",_", "msg_", "=_", "results_", "[_", "0_", "]_", "[_", "\"", "message", "\"_", "]_", ")_" ]
[ 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, 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,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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, 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, 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 ]
Unused local variable
googleads/googleads-python-lib/examples/dfp/v201511/line_item_service/create_line_items.py
[ { "content": "def main(client, order_id, targeted_placement_ids):\n # Initialize appropriate service.\n line_item_service = client.GetService('LineItemService', version='v201511')\n\n # Create line item objects.\n line_items = []\n for i in xrange(5):\n line_item = {\n 'name': 'Line item #%s' % uuid.uuid4(),\n 'orderId': order_id,\n 'targeting': {\n 'inventoryTargeting': {\n 'targetedPlacementIds': targeted_placement_ids\n },\n 'geoTargeting': {\n 'targetedLocations': [\n {\n 'id': '2840',\n 'displayName': 'US'\n },\n {\n 'id': '20133',\n 'displayName': 'Geneva'\n },\n {\n 'id': '9000093',\n 'displayName': 'B3P',\n }\n ],\n 'excludedLocations': [\n {\n 'id': '1016367',\n 'displayName': 'Chicago',\n },\n {\n 'id': '200501',\n 'displayName': 'New York NY'\n }\n ]\n },\n 'dayPartTargeting': {\n 'dayParts': [\n {\n 'dayOfWeek': 'SATURDAY',\n 'startTime': {\n 'hour': '0',\n 'minute': 'ZERO'\n },\n 'endTime': {\n 'hour': '24',\n 'minute': 'ZERO'\n }\n },\n {\n 'dayOfWeek': 'SUNDAY',\n 'startTime': {\n 'hour': '0',\n 'minute': 'ZERO'\n },\n 'endTime': {\n 'hour': '24',\n 'minute': 'ZERO'\n }\n }\n ],\n 'timeZone': 'BROWSER'\n },\n 'userDomainTargeting': {\n 'domains': ['usa.gov'],\n 'targeted': 'false'\n },\n 'technologyTargeting': {\n 'browserTargeting': {\n 'browsers': [{'id': '500072'}],\n 'isTargeted': 'true'\n }\n }\n },\n 'creativePlaceholders': [\n {\n 'size': {\n 'width': '300',\n 'height': '250'\n }\n },\n {\n 'size': {\n 'width': '120',\n 'height': '600'\n }\n }\n ],\n 'startDateTimeType': 'IMMEDIATELY',\n 'lineItemType': 'STANDARD',\n 'endDateTime': {\n 'date': {\n 'year': str(date.today().year + 1),\n 'month': '9',\n 'day': '30'\n },\n 'hour': '0',\n 'minute': '0',\n 'second': '0',\n 'timeZoneID': 'America/Los_Angeles'\n },\n 'costType': 'CPM',\n 'costPerUnit': {\n 'currencyCode': 'USD',\n 'microAmount': '2000000'\n },\n 'primaryGoal': {\n 'units': '50',\n 'unitType': 'IMPRESSIONS',\n 'goalType': 'LIFETIME'\n },\n 'contractedUnitsBought': '100',\n 'creativeRotationType': 'EVEN',\n 'discountType': 'PERCENTAGE',\n 'allowOverbook': 'true'\n }\n line_items.append(line_item)\n\n # Add line items.\n line_items = line_item_service.createLineItems(line_items)\n\n # Display results.\n for line_item in line_items:\n print ('Line item with id \\'%s\\', belonging to order id \\'%s\\', and named '\n '\\'%s\\' was created.' % (line_item['id'], line_item['orderId'],\n line_item['name']))", "metadata": "root.main", "header": "['module', '___EOS___']", "index": 35 } ]
[]
[]
0
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "main_", "(_", "client_", ",_", "order", "\\u", "id_", ",_", "targeted", "\\u", "placem", "ent", "\\u", "ids_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Initializ", "e", " ", "appropr", "iate", " ", "service", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "line", "\\u", "item", "\\u", "service_", "=_", "client_", "._", "Get", "Service_", "(_", "'", "Line", "Item", "Service", "'_", ",_", "version_", "=_", "'", "v2", "015", "11", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Creat", "e", " ", "line", " ", "item", " ", "object", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "line", "\\u", "items_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", "in_", "xrange_", "(_", "5_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "line", "\\u", "item_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "name", "'_", ":_", "'", "Line", " ", "item", " ", "#", "%", "s", "'_", "%_", "uuid_", "._", "uuid4_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "order", "Id", "'_", ":_", "order", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "targeti", "ng", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "inventor", "y", "Target", "ing", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "targeted", "Placem", "ent", "Id", "s", "'_", ":_", "targeted", "\\u", "placem", "ent", "\\u", "ids_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "geo", "Target", "ing", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "targeted", "Locat", "ion", "s", "'_", ":_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "id", "'_", ":_", "'", "284", "0", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "display", "Name", "'_", ":_", "'", "US", "'_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "id", "'_", ":_", "'", "2013", "3", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "display", "Name", "'_", ":_", "'", "Gene", "va", "'_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "id", "'_", ":_", "'", "9000", "093", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "display", "Name", "'_", ":_", "'", "B3", "P", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNL\\u\\u\\u_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "exclu", "ded", "Locat", "ion", "s", "'_", ":_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "id", "'_", ":_", "'", "1016", "367", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "display", "Name", "'_", ":_", "'", "Chi", "cag", "o", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "id", "'_", ":_", "'", "2005", "01", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "display", "Name", "'_", ":_", "'", "New", " ", "Yo", "rk", " ", "NY", "'_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "day", "Part", "Target", "ing", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "day", "Part", "s", "'_", ":_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "day", "Of", "Week", "'_", ":_", "'", "SAT", "UR", "DAY", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "start", "Time", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "hour", "'_", ":_", "'", "0", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "minute", "'_", ":_", "'", "ZERO", "'_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "end", "Time", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "hour", "'_", ":_", "'", "24", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "minute", "'_", ":_", "'", "ZERO", "'_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "day", "Of", "Week", "'_", ":_", "'", "SUN", "DAY", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "start", "Time", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "hour", "'_", ":_", "'", "0", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "minute", "'_", ":_", "'", "ZERO", "'_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "end", "Time", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "hour", "'_", ":_", "'", "24", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "minute", "'_", ":_", "'", "ZERO", "'_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNL\\u\\u\\u_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "time", "Zon", "e", "'_", ":_", "'", "BROWSER", "'_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "user", "Doma", "in", "Target", "ing", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "domains", "'_", ":_", "[_", "'", "usa", ".", "gov", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "targeted", "'_", ":_", "'", "fal", "se", "'_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "technology", "Target", "ing", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "browse", "r", "Target", "ing", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "browsers", "'_", ":_", "[_", "{_", "'", "id", "'_", ":_", "'", "5000", "7", "2", "'_", "}_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "is", "Target", "ed", "'_", ":_", "'", "true", "'_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "creative", "Place", "holder", "s", "'_", ":_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "size", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "widt", "h", "'_", ":_", "'", "300", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "height", "'_", ":_", "'", "250", "'_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "size", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "widt", "h", "'_", ":_", "'", "120", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "height", "'_", ":_", "'", "600", "'_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNL\\u\\u\\u_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "start", "Date", "Time", "Type", "'_", ":_", "'", "IMM", "EDI", "ATE", "LY", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "line", "Item", "Type", "'_", ":_", "'", "STANDARD", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "end", "Date", "Time", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "date", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "year", "'_", ":_", "str_", "(_", "date_", "._", "today_", "(_", ")_", "._", "year_", "+_", "1_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "month", "'_", ":_", "'", "9", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "day", "'_", ":_", "'", "30", "'_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "hour", "'_", ":_", "'", "0", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "minute", "'_", ":_", "'", "0", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "second", "'_", ":_", "'", "0", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "time", "Zon", "e", "ID", "'_", ":_", "'", "Ame", "rica", "/", "Lo", "s", "\\u", "Angel", "es", "'_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "cost", "Type", "'_", ":_", "'", "CP", "M", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "cost", "Per", "Unit", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "curr", "ency", "Code", "'_", ":_", "'", "US", "D", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "micro", "Amo", "unt", "'_", ":_", "'", "200000", "0", "'_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "primary", "Goal", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "unit", "s", "'_", ":_", "'", "50", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "unit", "Type", "'_", ":_", "'", "IMP", "RESS", "IONS", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "goal", "Type", "'_", ":_", "'", "LIF", "ETI", "ME", "'_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "contract", "ed", "Unit", "s", "Bou", "ght", "'_", ":_", "'", "100", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "creative", "Rot", "ation", "Type", "'_", ":_", "'", "EVE", "N", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "discou", "nt", "Type", "'_", ":_", "'", "PERCENT", "AGE", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "allow", "Over", "book", "'_", ":_", "'", "true", "'_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "line", "\\u", "items_", "._", "append_", "(_", "line", "\\u", "item_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Add", " ", "line", " ", "items", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "line", "\\u", "items_", "=_", "line", "\\u", "item", "\\u", "service_", "._", "create", "Line", "Items_", "(_", "line", "\\u", "items_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Display", " ", "results", "._", "\\u\\u\\uNL\\u\\u\\u_", "for_", "line", "\\u", "item_", "in_", "line", "\\u", "items_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "'", "Line", " ", "item", " ", "with", " ", "id", " ", "\\\\'", "%", "s", "\\\\'", ",", " ", "belonging", " ", "to", " ", "order", " ", "id", " ", "\\\\'", "%", "s", "\\\\'", ",", " ", "and", " ", "named", " ", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'\\\\'", "%", "s", "\\\\'", " ", "was", " ", "created", ".'_", "%_", "(_", "line", "\\u", "item_", "[_", "'", "id", "'_", "]_", ",_", "line", "\\u", "item_", "[_", "'", "order", "Id", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "line", "\\u", "item_", "[_", "'", "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,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local variable
biicode/client/dev/hardware/arduino/arduino_port_utils.py
[ { "content": "def check_port(user_io, current_port, wizard=False):\n '''detect and get the port the arduino is connected to\n param user_io: UserIO object\n param current_port: the current port, if any\n return: the actual port the arduino was found connected to\n '''\n # Search for arduino port\n port_list = _detect_arduino_port()\n if len(port_list) == 1:\n port = port_list[0]\n if current_port:\n if port != current_port:\n user_io.out.warn(\"The serial port has changed from %s => %s\"\n % (current_port, port))\n current_port = port\n elif len(port_list) > 1:\n user_io.out.warn(\"There could be more than one arduino connected (%s)\"\n % (','.join(port_list)))\n if current_port and current_port not in port_list:\n user_io.out.warn(\"But your port %s is not among them\" % current_port)\n port_list.append(current_port)\n if wizard:\n current_port = user_io.request_option('port',\n default_option=current_port,\n options=port_list,\n one_line_options=True)\n else:\n user_io.out.warn(\"You might want to run arduino:settings to change it\")\n elif len(port_list) == 0:\n user_io.out.error(\"We can't find an arduino connected\")\n if wizard:\n current_port = user_io.request_string('Select port')\n else:\n user_io.out.warn(\"You might want to run arduino:settings to define port\")\n\n current_port = current_port or 'None'\n user_io.out.writeln(\"Using arduino port: %s\" % current_port, front=Color.GREEN)\n return current_port", "metadata": "root.check_port", "header": "['module', '___EOS___']", "index": 29 } ]
[]
[]
0
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_", "check", "\\u", "port_", "(_", "user", "\\u", "io_", ",_", "current", "\\u", "port_", ",_", "wizard_", "=_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "detect", " ", "and", " ", "get", " ", "the", " ", "port", " ", "the", " ", "arduino", " ", "is", " ", "connect", "ed", " ", "to", "\\", "10", ";", " ", " ", " ", " ", "param", " ", "user", "\\u", "io", ":", " ", "User", "IO", " ", "object", "\\", "10", ";", " ", " ", " ", " ", "param", " ", "current", "\\u", "port", ":", " ", "the", " ", "current", " ", "port", ",", " ", "if", " ", "any", "\\", "10", ";", " ", " ", " ", " ", "return", ":", " ", "the", " ", "actual", " ", "port", " ", "the", " ", "arduino", " ", "was", " ", "found", " ", "connect", "ed", " ", "to", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Sear", "ch", " ", "for", " ", "arduino", " ", "port_", "\\u\\u\\uNL\\u\\u\\u_", "port", "\\u", "list_", "=_", "\\u", "detect", "\\u", "arduino", "\\u", "port_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "len_", "(_", "port", "\\u", "list_", ")_", "==_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "port_", "=_", "port", "\\u", "list_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "current", "\\u", "port_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "port_", "!=_", "current", "\\u", "port_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "user", "\\u", "io_", "._", "out_", "._", "warn_", "(_", "\"", "The", " ", "serial", " ", "port", " ", "has", " ", "change", "d", " ", "from", " ", "%", "s", " ", "=>", " ", "%", "s", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "%_", "(_", "current", "\\u", "port_", ",_", "port_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "current", "\\u", "port_", "=_", "port_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "len_", "(_", "port", "\\u", "list_", ")_", ">_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "user", "\\u", "io_", "._", "out_", "._", "warn_", "(_", "\"", "There", " ", "coul", "d", " ", "be", " ", "more", " ", "than", " ", "one", " ", "arduino", " ", "connect", "ed", " ", "(%", "s", ")\"_", "\\u\\u\\uNL\\u\\u\\u_", "%_", "(_", "','_", "._", "join_", "(_", "port", "\\u", "list_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "current", "\\u", "port_", "and_", "current", "\\u", "port_", "not_", "in_", "port", "\\u", "list_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "user", "\\u", "io_", "._", "out_", "._", "warn_", "(_", "\"", "Bu", "t", " ", "your", " ", "port", " ", "%", "s", " ", "is", " ", "not", " ", "amo", "ng", " ", "them", "\"_", "%_", "current", "\\u", "port_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "port", "\\u", "list_", "._", "append_", "(_", "current", "\\u", "port_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "wizard_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "current", "\\u", "port_", "=_", "user", "\\u", "io_", "._", "request", "\\u", "option_", "(_", "'", "port", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "default", "\\u", "option_", "=_", "current", "\\u", "port_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "options_", "=_", "port", "\\u", "list_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "one", "\\u", "line", "\\u", "options_", "=_", "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 ", " _", "user", "\\u", "io_", "._", "out_", "._", "warn_", "(_", "\"", "You", " ", "mig", "ht", " ", "want", " ", "to", " ", "run", " ", "arduino", ":", "settings", " ", "to", " ", "change", " ", "it", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "len_", "(_", "port", "\\u", "list_", ")_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "user", "\\u", "io_", "._", "out_", "._", "error_", "(_", "\"", "We", " ", "can", "'", "t", " ", "find", " ", "an", " ", "arduino", " ", "connect", "ed", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "wizard_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "current", "\\u", "port_", "=_", "user", "\\u", "io_", "._", "request", "\\u", "string_", "(_", "'", "Select", " ", "port", "'_", ")_", "\\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", "io_", "._", "out_", "._", "warn_", "(_", "\"", "You", " ", "mig", "ht", " ", "want", " ", "to", " ", "run", " ", "arduino", ":", "settings", " ", "to", " ", "defin", "e", " ", "port", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "current", "\\u", "port_", "=_", "current", "\\u", "port_", "or_", "'", "Non", "e", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "user", "\\u", "io_", "._", "out_", "._", "writeln_", "(_", "\"", "Us", "ing", " ", "arduino", " ", "port", ":", " ", "%", "s", "\"_", "%_", "current", "\\u", "port_", ",_", "front_", "=_", "Color_", "._", "GREEN_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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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
appdotnet/ADNpy/tests/test_api.py
[ { "content": "import os\nimport time\nimport unittest\n\nfrom adnpy.cursor import cursor\nfrom adnpy.utils import get_app_access_token\n\nfrom config import AdnpyTestCase\n\ntest_post_id = 1\n\n\n\nif __name__ == '__main__':\n unittest.main()\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class AdnpyAPITests(AdnpyTestCase):\n \"\"\"Unit tests\"\"\"\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n", "metadata": "root.AdnpyAPITests", "header": "['module', '___EOS___']", "index": 12 }, { "content": " def test_posts_stream_global(self):\n self.api.posts_stream_global()", "metadata": "root.AdnpyAPITests.test_posts_stream_global", "header": "['class', 'AdnpyAPITests', '(', 'AdnpyTestCase', ')', ':', '___EOS___']", "index": 15 }, { "content": " def test_post(self):\n text = u'awesome'\n post, meta = self.api.create_post(data={'text': text})\n self.assertEquals(post.text, text)\n\n post, meta = self.api.get_post(post)\n\n post, meta = self.api.delete_post(post)\n post, meta = self.api.create_post(data={'text': text})\n post, meta = post.delete()\n\n post, meta = self.api.repost_post(14265380)\n post, meta = self.api.unrepost_post(14265380)\n\n post, meta = self.api.star_post(14265380)\n post, meta = self.api.unstar_post(14265380)\n\n posts, meta = self.api.get_posts(ids='1,2,3')\n self.assertEquals(len(posts), 3)\n\n posts, meta = self.api.users_posts(3)\n\n posts, meta = self.api.users_starred_posts(3)\n posts, meta = self.api.users_mentioned_posts(3)\n\n posts, meta = self.api.posts_with_hashtag('awesome')\n\n posts, meta = self.api.posts_with_hashtag(1)\n\n posts, meta = self.api.users_post_stream()\n posts, meta = self.api.users_post_stream_unified()\n\n posts, meta = self.api.posts_stream_global()\n\n # post, meta = self.api.report_post(1)\n\n posts, meta = self.api.post_search(text='awesome')", "metadata": "root.AdnpyAPITests.test_post", "header": "['class', 'AdnpyAPITests', '(', 'AdnpyTestCase', ')', ':', '___EOS___']", "index": 18 }, { "content": " def test_user(self):\n display_name = u'tester %s' % (time.time())\n user, meta = self.api.get_user('me')\n self.assertEquals(self.username, user.username)\n old_name = user.name\n user.name = display_name\n cwd = os.path.dirname(__file__)\n del user.description['entities']\n user, meta = self.api.update_user('me', data=user)\n self.assertEquals(display_name, user.name)\n\n user, meta = self.api.patch_user('me', data={'name': old_name})\n self.assertEquals(old_name, user.name)\n\n users, meta = self.api.get_users(ids='1,2,3')\n self.assertEquals(len(users), 3)\n\n # XXX: Need to figure out how I can record, and replay these calls, but they work\n\n with open(cwd + '/data/avatar.png') as avatar:\n user, meta = self.api.update_avatar('me', files={'avatar': avatar})\n\n with open(cwd + '/data/cover.png') as cover:\n user, meta = self.api.update_cover('me', files={'cover': cover})\n\n user, meta = self.api.follow_user(3)\n user, meta = self.api.unfollow_user(3)\n\n user, meta = self.api.mute_user(3)\n user, meta = self.api.unmute_user(3)\n\n user, meta = self.api.block_user(3)\n user, meta = self.api.unblock_user(3)\n\n users, meta = self.api.user_search(q='@voidfiles')\n\n users, meta = self.api.users_following(3)\n users, meta = self.api.users_followers(3)\n\n users, meta = self.api.users_following_ids(3)\n users, meta = self.api.users_followers_ids(3)\n\n users, meta = self.api.users_muted_users('me')\n users, meta = self.api.users_muted_users_ids('me')\n\n users, meta = self.api.users_blocked_users('me')\n\n # Add in testing for app access tokens\n #users, meta = self.api.users_blocked_user_ids('me')\n\n users, meta = self.api.users_reposted_post(1)\n users, meta = self.api.users_starred_post(1)", "metadata": "root.AdnpyAPITests.test_user", "header": "['class', 'AdnpyAPITests', '(', 'AdnpyTestCase', ')', ':', '___EOS___']", "index": 56 }, { "content": " def test_channel(self):\n\n channels, meta = self.api.subscribed_channels()\n\n channel, meta = self.api.create_channel(data={\n 'type': 'com.example.channel',\n 'writers': {\n 'user_ids': ['@voidfiles'],\n 'immutable': False,\n }\n })\n\n channel_fetched, meta = self.api.get_channel(channel)\n self.assertEquals(channel.id, channel_fetched.id)\n\n channels, meta = self.api.get_channels(ids=channel_fetched.id)\n\n channels, meta = self.api.users_channels()\n\n num_unread, meta = self.api.num_unread_pm_channels()\n\n channel_update = {\n 'id': channel.id,\n 'writers': {\n 'user_ids': [],\n }\n }\n\n channel, meta = self.api.update_channel(channel, data=channel_update)\n self.assertEquals(channel_update['writers']['user_ids'], channel.writers.user_ids)\n\n channel, meta = self.api.subscribe_channel(1383)\n channel, meta = self.api.unsubscribe_channel(1383)\n\n users, meta = self.api.subscribed_users(1383)\n users, meta = self.api.subscribed_user_ids(1383)\n\n channel_user_ids, meta = self.api.subscribed_user_ids_for_channels(ids='1383,6313')\n\n channel, meta = self.api.mute_channel(1383)\n channels, meta = self.api.muted_channels(1383)\n channel, meta = self.api.unmute_channel(1383)", "metadata": "root.AdnpyAPITests.test_channel", "header": "['class', 'AdnpyAPITests', '(', 'AdnpyTestCase', ')', ':', '___EOS___']", "index": 109 }, { "content": " def test_message(self):\n\n message1, meta = self.api.create_message(27024, data={'text': \"awesome 1\"})\n message2, meta = self.api.create_message(27024, data={'text': \"awesome 2\"})\n message, meta = self.api.get_message(27024, message1)\n messages, meta = self.api.get_messages(ids='%s, %s' % (message1.id, message2.id))\n messages, meta = self.api.users_messages()\n messages, meta = self.api.get_channel_messages(27024)\n\n message, meta = self.api.delete_message(27024, message1)\n message, meta = self.api.delete_message(27024, message2)", "metadata": "root.AdnpyAPITests.test_message", "header": "['class', 'AdnpyAPITests', '(', 'AdnpyTestCase', ')', ':', '___EOS___']", "index": 152 }, { "content": " def test_file(self):\n cwd = os.path.dirname(__file__)\n ids = []\n with open(cwd + '/data/avatar.png') as avatar:\n file_, meta = self.api.create_file(files={'content': avatar}, data={'type': 'com.adnpy.testing'})\n\n ids += [file_.id]\n file_, meta = self.api.get_file(file_.id)\n\n # Partial file\n partial_file, meta = self.api.create_file(data={'type': 'com.adnpy.testing'})\n ids += [file_.id]\n self.api.update_file(file_.id, data={\n 'annotations': [{\n 'type': 'net.adnpy.testing',\n 'value': {\n 'test': 'test'\n }\n }]\n })\n\n self.api.create_custom_derived_file(partial_file.id, 'custom', data={'type': 'com.adnpy.testing'})\n\n with open(cwd + '/data/cover.png') as cover:\n self.api.set_custom_derived_file_content(partial_file.id, 'custom', data=cover, headers={'Content-Type': 'image/png'})\n\n with open(cwd + '/data/avatar.png') as avatar:\n self.api.set_file_content(partial_file.id, data=avatar, headers={'Content-Type': 'image/png'})\n\n file_, meta = self.api.get_file(partial_file.id)\n\n files, meta = self.api.get_files(ids=','.join(ids))\n\n self.assertEquals(len(files), 2)\n files, meta = self.api.get_my_files()\n self.assertGreaterEqual(len(files), 2)\n\n self.api.get_file_content(partial_file.id)\n self.api.get_custom_derived_file_content(partial_file.id, 'custom')", "metadata": "root.AdnpyAPITests.test_file", "header": "['class', 'AdnpyAPITests', '(', 'AdnpyTestCase', ')', ':', '___EOS___']", "index": 164 }, { "content": " def test_interactions(self):\n interactions, meta = self.api.interactions_with_user()", "metadata": "root.AdnpyAPITests.test_interactions", "header": "['class', 'AdnpyAPITests', '(', 'AdnpyTestCase', ')', ':', '___EOS___']", "index": 204 }, { "content": " def test_text_process(self):\n text, meta = self.api.text_process(data={'text': \"#awesome @voidfiles\"})", "metadata": "root.AdnpyAPITests.test_text_process", "header": "['class', 'AdnpyAPITests', '(', 'AdnpyTestCase', ')', ':', '___EOS___']", "index": 207 }, { "content": " def test_places(self):\n places, meta = self.api.search_places(q='krispy kreme', latitude='37.701598', longitude='-122.470093', radius='50000')\n place, meta = self.api.get_place(places[0])", "metadata": "root.AdnpyAPITests.test_places", "header": "['class', 'AdnpyAPITests', '(', 'AdnpyTestCase', ')', ':', '___EOS___']", "index": 210 }, { "content": " def test_token(self):\n token, meta = self.api.get_token()\n self.assertIsNotNone(token.get('user'))", "metadata": "root.AdnpyAPITests.test_token", "header": "['class', 'AdnpyAPITests', '(', 'AdnpyTestCase', ')', ':', '___EOS___']", "index": 214 }, { "content": " def test_config(self):\n config, meta = self.api.get_config()", "metadata": "root.AdnpyAPITests.test_config", "header": "['class', 'AdnpyAPITests', '(', 'AdnpyTestCase', ')', ':', '___EOS___']", "index": 218 }, { "content": " def test_explore_stream(self):\n explore_streams, meta = self.api.get_explore_streams()\n posts, meta = self.api.get_explore_stream(explore_streams[0])", "metadata": "root.AdnpyAPITests.test_explore_stream", "header": "['class', 'AdnpyAPITests', '(', 'AdnpyTestCase', ')', ':', '___EOS___']", "index": 221 }, { "content": " def test_stream_filters(self):\n # Reset\n stream_filters, meta = self.api.delete_all_filters()\n\n filter_def = {\n \"clauses\": [\n {\n \"field\": \"/data/entities/hashtags/*/name\",\n \"object_type\": \"post\",\n \"operator\": \"matches\",\n \"value\": \"rollout\"\n }\n ],\n \"id\": \"1\",\n \"match_policy\": \"include_any\",\n \"name\": \"Posts about rollouts\"\n }\n\n stream_filter, meta = self.api.create_filter(data=filter_def)\n stream_filter, meta = self.api.get_filter(stream_filter)\n filter_def['clauses'] += [{\n \"field\": \"/data/entities/hashtags/*/name\",\n \"object_type\": \"post\",\n \"operator\": \"matches\",\n \"value\": \"bug\"\n }]\n\n stream_filter, meta = self.api.update_filter(stream_filter, data=filter_def)\n self.assertEquals(len(stream_filter.clauses), 2)\n stream_filter, meta = self.api.delete_filter(stream_filter)\n stream_filter, meta = self.api.create_filter(data=filter_def)\n filter_def['id'] = '2'\n stream_filter, meta = self.api.create_filter(data=filter_def)\n stream_filters, meta = self.api.get_filters()\n self.assertEquals(len(stream_filters), 2)\n stream_filters, meta = self.api.delete_all_filters()\n stream_filters, meta = self.api.get_filters()\n self.assertEquals(len(stream_filters), 0)", "metadata": "root.AdnpyAPITests.test_stream_filters", "header": "['class', 'AdnpyAPITests', '(', 'AdnpyTestCase', ')', ':', '___EOS___']", "index": 225 }, { "content": " def test_app_stream(self):\n app_access_token, token = get_app_access_token(self.client_id, self.client_secret)\n self.api.add_authorization_token(app_access_token)\n # Reset\n self.api.delete_all_streams()\n\n stream_def = {\n \"object_types\": [\n \"post\"\n ],\n \"type\": \"long_poll\",\n \"key\": \"rollout_stream\"\n }\n\n app_stream, meta = self.api.create_stream(data=stream_def)\n app_stream, meta = self.api.get_stream(app_stream)\n\n stream_def['object_types'] += [\"star\"]\n\n app_stream, meta = self.api.update_stream(app_stream, data=stream_def)\n self.assertEquals(len(app_stream.object_types), 2)\n app_stream, meta = self.api.delete_stream(app_stream)\n app_stream, meta = self.api.create_stream(data=stream_def)\n stream_def['key'] = \"rollout_stream_2\"\n app_stream, meta = self.api.create_stream(data=stream_def)\n app_streams, meta = self.api.get_streams()\n self.assertEquals(len(app_streams), 2)\n app_streams, meta = self.api.delete_all_streams()\n app_streams, meta = self.api.get_streams()\n self.assertEquals(len(app_streams), 0)", "metadata": "root.AdnpyAPITests.test_app_stream", "header": "['class', 'AdnpyAPITests', '(', 'AdnpyTestCase', ')', ':', '___EOS___']", "index": 264 }, { "content": " def test_cursor(self):\n iterator = cursor(self.api.posts_stream_global, count=1)\n post1 = iterator.next()\n post2 = iterator.next()\n self.assertNotEquals(post1.id, post2.id)\n\n iterator = cursor(self.api.get_explore_stream, 'photos')\n post1 = iterator.next()", "metadata": "root.AdnpyAPITests.test_cursor", "header": "['class', 'AdnpyAPITests', '(', 'AdnpyTestCase', ')', ':', '___EOS___']", "index": 295 } ]
[]
[]
0
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "time_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "unittest_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "ad", "npy", "_", "._", "cursor_", "import_", "cursor_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "ad", "npy", "_", "._", "utils_", "import_", "get", "\\u", "app", "\\u", "access", "\\u", "token_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "config_", "import_", "Ad", "npy", "Test", "Case_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "test\\u", "post", "\\u", "id_", "=_", "1_", "\\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_", "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_", "Ad", "npy", "API", "Tests_", "(_", "Ad", "npy", "Test", "Case_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Unit", " ", "tests", "\"\"\"_", "\\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_", "Ad", "npy", "API", "Tests_", "(_", "Ad", "npy", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "test\\u", "posts", "\\u", "stream", "\\u", "global_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "api_", "._", "posts", "\\u", "stream", "\\u", "global_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Ad", "npy", "API", "Tests_", "(_", "Ad", "npy", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "post_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "text_", "=_", "u", "'", "aw", "eso", "me", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "post_", ",_", "meta_", "=_", "self_", "._", "api_", "._", "create", "\\u", "post_", "(_", "data_", "=_", "{_", "'", "text", "'_", ":_", "text_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "post_", "._", "text_", ",_", "text_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "post_", ",_", "meta_", "=_", "self_", "._", "api_", "._", "get", "\\u", "post_", "(_", "post_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "post_", ",_", "meta_", "=_", "self_", "._", "api_", "._", "delete", "\\u", "post_", "(_", "post_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "post_", ",_", "meta_", "=_", "self_", "._", "api_", "._", "create", "\\u", "post_", "(_", "data_", "=_", "{_", "'", "text", "'_", ":_", "text_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "post_", ",_", "meta_", "=_", "post_", "._", "delete_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "post_", ",_", "meta_", "=_", "self_", "._", "api_", "._", "repos", "t", "\\u", "post_", "(_", "142", "653", "80_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "post_", ",_", "meta_", "=_", "self_", "._", "api_", "._", "unre", "post", "\\u", "post_", "(_", "142", "653", "80_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "post_", ",_", "meta_", "=_", "self_", "._", "api_", "._", "star", "\\u", "post_", "(_", "142", "653", "80_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "post_", ",_", "meta_", "=_", "self_", "._", "api_", "._", "unsta", "r", "\\u", "post_", "(_", "142", "653", "80_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "posts_", ",_", "meta_", "=_", "self_", "._", "api_", "._", "get", "\\u", "posts_", "(_", "ids_", "=_", "'", "1", ",", "2", ",", "3", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "len_", "(_", "posts_", ")_", ",_", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "posts_", ",_", "meta_", "=_", "self_", "._", "api_", "._", "users", "\\u", "posts_", "(_", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "posts_", ",_", "meta_", "=_", "self_", "._", "api_", "._", "users", "\\u", "starred", "\\u", "posts_", "(_", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "posts_", ",_", "meta_", "=_", "self_", "._", "api_", "._", "users", "\\u", "mentioned", "\\u", "posts_", "(_", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "posts_", ",_", "meta_", "=_", "self_", "._", "api_", "._", "posts", "\\u", "with", "\\u", "hashtag", "_", "(_", "'", "aw", "eso", "me", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "posts_", ",_", "meta_", "=_", "self_", "._", "api_", "._", "posts", "\\u", "with", "\\u", "hashtag", "_", "(_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "posts_", ",_", "meta_", "=_", "self_", "._", "api_", "._", "users", "\\u", "post", "\\u", "stream_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "posts_", ",_", "meta_", "=_", "self_", "._", "api_", "._", "users", "\\u", "post", "\\u", "stream", "\\u", "unifie", "d_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "posts_", ",_", "meta_", "=_", "self_", "._", "api_", "._", "posts", "\\u", "stream", "\\u", "global_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "post", ",", " ", "meta", " ", "=", " ", "self", ".", "api", ".", "report", "\\u", "post", "(", "1", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "posts_", ",_", "meta_", "=_", "self_", "._", "api_", "._", "post", "\\u", "search_", "(_", "text_", "=_", "'", "aw", "eso", "me", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Ad", "npy", "API", "Tests_", "(_", "Ad", "npy", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "user_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "display", "\\u", "name_", "=_", "u", "'", "teste", "r", " ", "%", "s", "'_", "%_", "(_", "time_", "._", "time_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "user_", ",_", "meta_", "=_", "self_", "._", "api_", "._", "get", "\\u", "user_", "(_", "'", "me", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "self_", "._", "username_", ",_", "user_", "._", "username_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "old", "\\u", "name_", "=_", "user_", "._", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "user_", "._", "name_", "=_", "display", "\\u", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cwd_", "=_", "os_", "._", "path_", "._", "dirname_", "(_", "\\u\\u", "file\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "del_", "user_", "._", "description_", "[_", "'", "entit", "ies", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "user_", ",_", "meta_", "=_", "self_", "._", "api_", "._", "update", "\\u", "user_", "(_", "'", "me", "'_", ",_", "data_", "=_", "user_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "display", "\\u", "name_", ",_", "user_", "._", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "user_", ",_", "meta_", "=_", "self_", "._", "api_", "._", "patch", "\\u", "user_", "(_", "'", "me", "'_", ",_", "data_", "=_", "{_", "'", "name", "'_", ":_", "old", "\\u", "name_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "old", "\\u", "name_", ",_", "user_", "._", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "users_", ",_", "meta_", "=_", "self_", "._", "api_", "._", "get", "\\u", "users_", "(_", "ids_", "=_", "'", "1", ",", "2", ",", "3", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "len_", "(_", "users_", ")_", ",_", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "XX", "X", ":", " ", "Ne", "ed", " ", "to", " ", "figure", " ", "out", " ", "how", " ", "I", " ", "can", " ", "record", ",", " ", "and", " ", "repla", "y", " ", "these", " ", "calls", ",", " ", "but", " ", "the", "y", " ", "work_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "with_", "open_", "(_", "cwd_", "+_", "'/", "data", "/", "avat", "ar", ".", "png", "'_", ")_", "as_", "avatar_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "user_", ",_", "meta_", "=_", "self_", "._", "api_", "._", "update", "\\u", "avatar_", "(_", "'", "me", "'_", ",_", "files_", "=_", "{_", "'", "avat", "ar", "'_", ":_", "avatar_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "with_", "open_", "(_", "cwd_", "+_", "'/", "data", "/", "cover", ".", "png", "'_", ")_", "as_", "cover_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "user_", ",_", "meta_", "=_", "self_", "._", "api_", "._", "update", "\\u", "cover_", "(_", "'", "me", "'_", ",_", "files_", "=_", "{_", "'", "cover", "'_", ":_", "cover_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "user_", ",_", "meta_", "=_", "self_", "._", "api_", "._", "follow", "\\u", "user_", "(_", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "user_", ",_", "meta_", "=_", "self_", "._", "api_", "._", "unfol", "low", "\\u", "user_", "(_", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "user_", ",_", "meta_", "=_", "self_", "._", "api_", "._", "mute", "\\u", "user_", "(_", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "user_", ",_", "meta_", "=_", "self_", "._", "api_", "._", "unm", "ute", "\\u", "user_", "(_", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "user_", ",_", "meta_", "=_", "self_", "._", "api_", "._", "block", "\\u", "user_", "(_", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "user_", ",_", "meta_", "=_", "self_", "._", "api_", "._", "unbl", "ock", "\\u", "user_", "(_", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "users_", ",_", "meta_", "=_", "self_", "._", "api_", "._", "user", "\\u", "search_", "(_", "q_", "=_", "'@", "voi", "dfile", "s", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "users_", ",_", "meta_", "=_", "self_", "._", "api_", "._", "users", "\\u", "following_", "(_", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "users_", ",_", "meta_", "=_", "self_", "._", "api_", "._", "users", "\\u", "followers", "_", "(_", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "users_", ",_", "meta_", "=_", "self_", "._", "api_", "._", "users", "\\u", "follow", "ing", "\\u", "ids_", "(_", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "users_", ",_", "meta_", "=_", "self_", "._", "api_", "._", "users", "\\u", "followers", "\\u", "ids_", "(_", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "users_", ",_", "meta_", "=_", "self_", "._", "api_", "._", "users", "\\u", "muted", "\\u", "users_", "(_", "'", "me", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "users_", ",_", "meta_", "=_", "self_", "._", "api_", "._", "users", "\\u", "muted", "\\u", "users", "\\u", "ids_", "(_", "'", "me", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "users_", ",_", "meta_", "=_", "self_", "._", "api_", "._", "users", "\\u", "block", "ed", "\\u", "users_", "(_", "'", "me", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Add", " ", "in", " ", "testi", "ng", " ", "for", " ", "app", " ", "access", " ", "tokens_", "\\u\\u\\uNL\\u\\u\\u_", "#", "users", ",", " ", "meta", " ", "=", " ", "self", ".", "api", ".", "users", "\\u", "block", "ed", "\\u", "user", "\\u", "ids", "('", "me", "')", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "users_", ",_", "meta_", "=_", "self_", "._", "api_", "._", "users", "\\u", "repos", "ted", "\\u", "post_", "(_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "users_", ",_", "meta_", "=_", "self_", "._", "api_", "._", "users", "\\u", "starred", "\\u", "post_", "(_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Ad", "npy", "API", "Tests_", "(_", "Ad", "npy", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "channel_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "channels_", ",_", "meta_", "=_", "self_", "._", "api_", "._", "subscribed", "\\u", "channels_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "channel_", ",_", "meta_", "=_", "self_", "._", "api_", "._", "create", "\\u", "channel_", "(_", "data_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "type", "'_", ":_", "'", "com", ".", "example", ".", "channel", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "writer", "s", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "user", "\\u", "ids", "'_", ":_", "[_", "'@", "voi", "dfile", "s", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "immutable", "'_", ":_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "channel", "\\u", "fetched", "_", ",_", "meta_", "=_", "self_", "._", "api_", "._", "get", "\\u", "channel_", "(_", "channel_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "channel_", "._", "id_", ",_", "channel", "\\u", "fetched", "_", "._", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "channels_", ",_", "meta_", "=_", "self_", "._", "api_", "._", "get", "\\u", "channels_", "(_", "ids_", "=_", "channel", "\\u", "fetched", "_", "._", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "channels_", ",_", "meta_", "=_", "self_", "._", "api_", "._", "users", "\\u", "channels_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "num", "\\u", "unread", "_", ",_", "meta_", "=_", "self_", "._", "api_", "._", "num", "\\u", "unread", "\\u", "pm", "\\u", "channels_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "channel", "\\u", "update_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "id", "'_", ":_", "channel_", "._", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "writer", "s", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "user", "\\u", "ids", "'_", ":_", "[_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "channel_", ",_", "meta_", "=_", "self_", "._", "api_", "._", "update", "\\u", "channel_", "(_", "channel_", ",_", "data_", "=_", "channel", "\\u", "update_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "channel", "\\u", "update_", "[_", "'", "writer", "s", "'_", "]_", "[_", "'", "user", "\\u", "ids", "'_", "]_", ",_", "channel_", "._", "writers_", "._", "user", "\\u", "ids_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "channel_", ",_", "meta_", "=_", "self_", "._", "api_", "._", "subscribe", "\\u", "channel_", "(_", "138", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "channel_", ",_", "meta_", "=_", "self_", "._", "api_", "._", "unsubscribe", "\\u", "channel_", "(_", "138", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "users_", ",_", "meta_", "=_", "self_", "._", "api_", "._", "subscribed", "\\u", "users_", "(_", "138", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "users_", ",_", "meta_", "=_", "self_", "._", "api_", "._", "subscribed", "\\u", "user", "\\u", "ids_", "(_", "138", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "channel", "\\u", "user", "\\u", "ids_", ",_", "meta_", "=_", "self_", "._", "api_", "._", "subscribed", "\\u", "user", "\\u", "ids", "\\u", "for", "\\u", "channels_", "(_", "ids_", "=_", "'", "138", "3", ",", "631", "3", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "channel_", ",_", "meta_", "=_", "self_", "._", "api_", "._", "mute", "\\u", "channel_", "(_", "138", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "channels_", ",_", "meta_", "=_", "self_", "._", "api_", "._", "muted", "\\u", "channels_", "(_", "138", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "channel_", ",_", "meta_", "=_", "self_", "._", "api_", "._", "unm", "ute", "\\u", "channel_", "(_", "138", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Ad", "npy", "API", "Tests_", "(_", "Ad", "npy", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "message_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "message", "1_", ",_", "meta_", "=_", "self_", "._", "api_", "._", "create", "\\u", "message_", "(_", "270", "24_", ",_", "data_", "=_", "{_", "'", "text", "'_", ":_", "\"", "aw", "eso", "me", " ", "1", "\"_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "message", "2_", ",_", "meta_", "=_", "self_", "._", "api_", "._", "create", "\\u", "message_", "(_", "270", "24_", ",_", "data_", "=_", "{_", "'", "text", "'_", ":_", "\"", "aw", "eso", "me", " ", "2", "\"_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "message_", ",_", "meta_", "=_", "self_", "._", "api_", "._", "get", "\\u", "message_", "(_", "270", "24_", ",_", "message", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "messages_", ",_", "meta_", "=_", "self_", "._", "api_", "._", "get", "\\u", "messages_", "(_", "ids_", "=_", "'%", "s", ",", " ", "%", "s", "'_", "%_", "(_", "message", "1_", "._", "id_", ",_", "message", "2_", "._", "id_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "messages_", ",_", "meta_", "=_", "self_", "._", "api_", "._", "users", "\\u", "messages_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "messages_", ",_", "meta_", "=_", "self_", "._", "api_", "._", "get", "\\u", "channel", "\\u", "messages_", "(_", "270", "24_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "message_", ",_", "meta_", "=_", "self_", "._", "api_", "._", "delete", "\\u", "message_", "(_", "270", "24_", ",_", "message", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "message_", ",_", "meta_", "=_", "self_", "._", "api_", "._", "delete", "\\u", "message_", "(_", "270", "24_", ",_", "message", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Ad", "npy", "API", "Tests_", "(_", "Ad", "npy", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "file_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cwd_", "=_", "os_", "._", "path_", "._", "dirname_", "(_", "\\u\\u", "file\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ids_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "open_", "(_", "cwd_", "+_", "'/", "data", "/", "avat", "ar", ".", "png", "'_", ")_", "as_", "avatar_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "file\\u_", ",_", "meta_", "=_", "self_", "._", "api_", "._", "create", "\\u", "file_", "(_", "files_", "=_", "{_", "'", "content", "'_", ":_", "avatar_", "}_", ",_", "data_", "=_", "{_", "'", "type", "'_", ":_", "'", "com", ".", "ad", "npy", ".", "testi", "ng", "'_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "ids_", "+=_", "[_", "file\\u_", "._", "id_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "file\\u_", ",_", "meta_", "=_", "self_", "._", "api_", "._", "get", "\\u", "file_", "(_", "file\\u_", "._", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Parti", "al", " ", "file_", "\\u\\u\\uNL\\u\\u\\u_", "partial", "\\u", "file_", ",_", "meta_", "=_", "self_", "._", "api_", "._", "create", "\\u", "file_", "(_", "data_", "=_", "{_", "'", "type", "'_", ":_", "'", "com", ".", "ad", "npy", ".", "testi", "ng", "'_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ids_", "+=_", "[_", "file\\u_", "._", "id_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "api_", "._", "update", "\\u", "file_", "(_", "file\\u_", "._", "id_", ",_", "data_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "annot", "ation", "s", "'_", ":_", "[_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "type", "'_", ":_", "'", "net", ".", "ad", "npy", ".", "testi", "ng", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "value", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "test", "'_", ":_", "'", "test", "'_", "\\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_", "self_", "._", "api_", "._", "create", "\\u", "custom", "\\u", "derive", "d\\u", "file_", "(_", "partial", "\\u", "file_", "._", "id_", ",_", "'", "custom", "'_", ",_", "data_", "=_", "{_", "'", "type", "'_", ":_", "'", "com", ".", "ad", "npy", ".", "testi", "ng", "'_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "with_", "open_", "(_", "cwd_", "+_", "'/", "data", "/", "cover", ".", "png", "'_", ")_", "as_", "cover_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "api_", "._", "set\\u", "custom", "\\u", "derive", "d\\u", "file", "\\u", "content_", "(_", "partial", "\\u", "file_", "._", "id_", ",_", "'", "custom", "'_", ",_", "data_", "=_", "cover_", ",_", "headers_", "=_", "{_", "'", "Conten", "t", "-", "Type", "'_", ":_", "'", "image", "/", "png", "'_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "with_", "open_", "(_", "cwd_", "+_", "'/", "data", "/", "avat", "ar", ".", "png", "'_", ")_", "as_", "avatar_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "api_", "._", "set\\u", "file", "\\u", "content_", "(_", "partial", "\\u", "file_", "._", "id_", ",_", "data_", "=_", "avatar_", ",_", "headers_", "=_", "{_", "'", "Conten", "t", "-", "Type", "'_", ":_", "'", "image", "/", "png", "'_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "file\\u_", ",_", "meta_", "=_", "self_", "._", "api_", "._", "get", "\\u", "file_", "(_", "partial", "\\u", "file_", "._", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "files_", ",_", "meta_", "=_", "self_", "._", "api_", "._", "get", "\\u", "files_", "(_", "ids_", "=_", "','_", "._", "join_", "(_", "ids_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "len_", "(_", "files_", ")_", ",_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "files_", ",_", "meta_", "=_", "self_", "._", "api_", "._", "get", "\\u", "my", "\\u", "files_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Great", "er", "Equal_", "(_", "len_", "(_", "files_", ")_", ",_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "api_", "._", "get", "\\u", "file", "\\u", "content_", "(_", "partial", "\\u", "file_", "._", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "api_", "._", "get", "\\u", "custom", "\\u", "derive", "d\\u", "file", "\\u", "content_", "(_", "partial", "\\u", "file_", "._", "id_", ",_", "'", "custom", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Ad", "npy", "API", "Tests_", "(_", "Ad", "npy", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "interactions_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "interactions_", ",_", "meta_", "=_", "self_", "._", "api_", "._", "interacti", "ons", "\\u", "with", "\\u", "user_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Ad", "npy", "API", "Tests_", "(_", "Ad", "npy", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "text", "\\u", "process_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "text_", ",_", "meta_", "=_", "self_", "._", "api_", "._", "text", "\\u", "process_", "(_", "data_", "=_", "{_", "'", "text", "'_", ":_", "\"#", "aw", "eso", "me", " ", "@", "voi", "dfile", "s", "\"_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Ad", "npy", "API", "Tests_", "(_", "Ad", "npy", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "places_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "places_", ",_", "meta_", "=_", "self_", "._", "api_", "._", "search", "\\u", "places_", "(_", "q_", "=_", "'", "kri", "spy", " ", "kre", "me", "'_", ",_", "latitude_", "=_", "'", "37.", "701", "598", "'_", ",_", "longitude_", "=_", "'-", "122.", "470", "093", "'_", ",_", "radius_", "=_", "'", "5000", "0", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "place_", ",_", "meta_", "=_", "self_", "._", "api_", "._", "get", "\\u", "place_", "(_", "places_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Ad", "npy", "API", "Tests_", "(_", "Ad", "npy", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "token_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "token_", ",_", "meta_", "=_", "self_", "._", "api_", "._", "get", "\\u", "token_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is", "Not", "None_", "(_", "token_", "._", "get_", "(_", "'", "user", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Ad", "npy", "API", "Tests_", "(_", "Ad", "npy", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "config_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "config_", ",_", "meta_", "=_", "self_", "._", "api_", "._", "get", "\\u", "config_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Ad", "npy", "API", "Tests_", "(_", "Ad", "npy", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "explore", "\\u", "stream_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "explore", "\\u", "streams_", ",_", "meta_", "=_", "self_", "._", "api_", "._", "get", "\\u", "explore", "\\u", "streams_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "posts_", ",_", "meta_", "=_", "self_", "._", "api_", "._", "get", "\\u", "explore", "\\u", "stream_", "(_", "explore", "\\u", "streams_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Ad", "npy", "API", "Tests_", "(_", "Ad", "npy", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "stream", "\\u", "filters_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Reset_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "stream", "\\u", "filters_", ",_", "meta_", "=_", "self_", "._", "api_", "._", "delete", "\\u", "all", "\\u", "filters_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "filter", "\\u", "def_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "clause", "s", "\"_", ":_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "field", "\"_", ":_", "\"/", "data", "/", "entit", "ies", "/", "hashtag", "s", "/*", "/", "name", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "object\\u", "type", "\"_", ":_", "\"", "post", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "opera", "tor", "\"_", ":_", "\"", "matche", "s", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "value", "\"_", ":_", "\"", "rollout", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNL\\u\\u\\u_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "id", "\"_", ":_", "\"", "1", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "match", "\\u", "policy", "\"_", ":_", "\"", "include", "\\u", "any", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "name", "\"_", ":_", "\"", "Posts", " ", "abo", "ut", " ", "rollout", "s", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "stream", "\\u", "filter_", ",_", "meta_", "=_", "self_", "._", "api_", "._", "create", "\\u", "filter_", "(_", "data_", "=_", "filter", "\\u", "def_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "stream", "\\u", "filter_", ",_", "meta_", "=_", "self_", "._", "api_", "._", "get", "\\u", "filter_", "(_", "stream", "\\u", "filter_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "filter", "\\u", "def_", "[_", "'", "clause", "s", "'_", "]_", "+=_", "[_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "field", "\"_", ":_", "\"/", "data", "/", "entit", "ies", "/", "hashtag", "s", "/*", "/", "name", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "object\\u", "type", "\"_", ":_", "\"", "post", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "opera", "tor", "\"_", ":_", "\"", "matche", "s", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "value", "\"_", ":_", "\"", "bug", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "stream", "\\u", "filter_", ",_", "meta_", "=_", "self_", "._", "api_", "._", "update", "\\u", "filter_", "(_", "stream", "\\u", "filter_", ",_", "data_", "=_", "filter", "\\u", "def_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "len_", "(_", "stream", "\\u", "filter_", "._", "clauses_", ")_", ",_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "stream", "\\u", "filter_", ",_", "meta_", "=_", "self_", "._", "api_", "._", "delete", "\\u", "filter_", "(_", "stream", "\\u", "filter_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "stream", "\\u", "filter_", ",_", "meta_", "=_", "self_", "._", "api_", "._", "create", "\\u", "filter_", "(_", "data_", "=_", "filter", "\\u", "def_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "filter", "\\u", "def_", "[_", "'", "id", "'_", "]_", "=_", "'", "2", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "stream", "\\u", "filter_", ",_", "meta_", "=_", "self_", "._", "api_", "._", "create", "\\u", "filter_", "(_", "data_", "=_", "filter", "\\u", "def_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "stream", "\\u", "filters_", ",_", "meta_", "=_", "self_", "._", "api_", "._", "get", "\\u", "filters_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "len_", "(_", "stream", "\\u", "filters_", ")_", ",_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "stream", "\\u", "filters_", ",_", "meta_", "=_", "self_", "._", "api_", "._", "delete", "\\u", "all", "\\u", "filters_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "stream", "\\u", "filters_", ",_", "meta_", "=_", "self_", "._", "api_", "._", "get", "\\u", "filters_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "len_", "(_", "stream", "\\u", "filters_", ")_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Ad", "npy", "API", "Tests_", "(_", "Ad", "npy", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "app", "\\u", "stream_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "app", "\\u", "access", "\\u", "token_", ",_", "token_", "=_", "get", "\\u", "app", "\\u", "access", "\\u", "token_", "(_", "self_", "._", "client", "\\u", "id_", ",_", "self_", "._", "client", "\\u", "secret_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "api_", "._", "add", "\\u", "authoriz", "ation", "\\u", "token_", "(_", "app", "\\u", "access", "\\u", "token_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Reset_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "api_", "._", "delete", "\\u", "all", "\\u", "streams_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "stream", "\\u", "def_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "object\\u", "types", "\"_", ":_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "post", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "type", "\"_", ":_", "\"", "long", "\\u", "poll", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "key", "\"_", ":_", "\"", "rollout", "\\u", "stream", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "app", "\\u", "stream_", ",_", "meta_", "=_", "self_", "._", "api_", "._", "create", "\\u", "stream_", "(_", "data_", "=_", "stream", "\\u", "def_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "app", "\\u", "stream_", ",_", "meta_", "=_", "self_", "._", "api_", "._", "get", "\\u", "stream_", "(_", "app", "\\u", "stream_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "stream", "\\u", "def_", "[_", "'", "object\\u", "types", "'_", "]_", "+=_", "[_", "\"", "star", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "app", "\\u", "stream_", ",_", "meta_", "=_", "self_", "._", "api_", "._", "update", "\\u", "stream_", "(_", "app", "\\u", "stream_", ",_", "data_", "=_", "stream", "\\u", "def_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "len_", "(_", "app", "\\u", "stream_", "._", "object\\u", "types_", ")_", ",_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "app", "\\u", "stream_", ",_", "meta_", "=_", "self_", "._", "api_", "._", "delete", "\\u", "stream_", "(_", "app", "\\u", "stream_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "app", "\\u", "stream_", ",_", "meta_", "=_", "self_", "._", "api_", "._", "create", "\\u", "stream_", "(_", "data_", "=_", "stream", "\\u", "def_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "stream", "\\u", "def_", "[_", "'", "key", "'_", "]_", "=_", "\"", "rollout", "\\u", "stream", "\\u", "2", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "app", "\\u", "stream_", ",_", "meta_", "=_", "self_", "._", "api_", "._", "create", "\\u", "stream_", "(_", "data_", "=_", "stream", "\\u", "def_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "app", "\\u", "streams_", ",_", "meta_", "=_", "self_", "._", "api_", "._", "get", "\\u", "streams_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "len_", "(_", "app", "\\u", "streams_", ")_", ",_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "app", "\\u", "streams_", ",_", "meta_", "=_", "self_", "._", "api_", "._", "delete", "\\u", "all", "\\u", "streams_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "app", "\\u", "streams_", ",_", "meta_", "=_", "self_", "._", "api_", "._", "get", "\\u", "streams_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "len_", "(_", "app", "\\u", "streams_", ")_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Ad", "npy", "API", "Tests_", "(_", "Ad", "npy", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "cursor_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "iterator_", "=_", "cursor_", "(_", "self_", "._", "api_", "._", "posts", "\\u", "stream", "\\u", "global_", ",_", "count_", "=_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "post", "1_", "=_", "iterator_", "._", "next_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "post", "2_", "=_", "iterator_", "._", "next_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Not", "Equals_", "(_", "post", "1_", "._", "id_", ",_", "post", "2_", "._", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "iterator_", "=_", "cursor_", "(_", "self_", "._", "api_", "._", "get", "\\u", "explore", "\\u", "stream_", ",_", "'", "photo", "s", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "post", "1_", "=_", "iterator_", "._", "next_", "(_", ")_", "\\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, 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 2, 2, 2, 2, 2, 2 ]
Unused import
hazelcast/hazelcast-python-client/hazelcast/proxy/set.py
[ { "content": "from hazelcast.protocol.codec import \\\n set_add_all_codec, \\\n set_add_codec, \\\n set_add_listener_codec, \\\n set_clear_codec, \\\n set_compare_and_remove_all_codec, \\\n set_compare_and_retain_all_codec, \\\n set_contains_all_codec, \\\n set_contains_codec, \\\n set_get_all_codec, \\\n set_is_empty_codec, \\\n set_remove_codec, \\\n set_remove_listener_codec, \\\n set_size_codec\n\nfrom hazelcast.proxy.base import PartitionSpecificProxy, ItemEvent, ItemEventType\nfrom hazelcast.util import check_not_none\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class Set(PartitionSpecificProxy):\n\n\n\n\n\n\n\n\n\n\n\n", "metadata": "root.Set", "header": "['module', '___EOS___']", "index": 19 }, { "content": " def add(self, item):\n check_not_none(item, \"Value can't be None\")\n element_data = self._to_data(item)\n return self._encode_invoke(set_add_codec, value=element_data)", "metadata": "root.Set.add", "header": "['class', 'Set', '(', 'PartitionSpecificProxy', ')', ':', '___EOS___']", "index": 20 }, { "content": " def add_all(self, items):\n check_not_none(items, \"Value can't be None\")\n data_items = []\n for item in items:\n check_not_none(item, \"Value can't be None\")\n data_items.append(self._to_data(item))\n return self._encode_invoke(set_add_all_codec, value_list=data_items)", "metadata": "root.Set.add_all", "header": "['class', 'Set', '(', 'PartitionSpecificProxy', ')', ':', '___EOS___']", "index": 25 }, { "content": " def add_listener(self, include_value=False, item_added=None, item_removed=None):\n request = set_add_listener_codec.encode_request(self.name, include_value, False)\n\n def handle_event_item(item, uuid, event_type):\n item = item if include_value else None\n member = self._client.cluster.get_member_by_uuid(uuid)\n\n item_event = ItemEvent(self.name, item, event_type, member, self._to_object)\n if event_type == ItemEventType.added:\n if item_added:\n item_added(item_event)\n else:\n if item_removed:\n item_removed(item_event)\n\n return self._start_listening(request,\n lambda m: set_add_listener_codec.handle(m, handle_event_item),\n lambda r: set_add_listener_codec.decode_response(r)['response'],\n self.partition_key)", "metadata": "root.Set.add_listener", "header": "['class', 'Set', '(', 'PartitionSpecificProxy', ')', ':', '___EOS___']", "index": 33 }, { "content": " def clear(self):\n return self._encode_invoke(set_clear_codec)", "metadata": "root.Set.clear", "header": "['class', 'Set', '(', 'PartitionSpecificProxy', ')', ':', '___EOS___']", "index": 53 }, { "content": " def contains(self, item):\n check_not_none(item, \"Value can't be None\")\n item_data = self._to_data(item)\n return self._encode_invoke(set_contains_codec, value=item_data)", "metadata": "root.Set.contains", "header": "['class', 'Set', '(', 'PartitionSpecificProxy', ')', ':', '___EOS___']", "index": 56 }, { "content": " def contains_all(self, items):\n check_not_none(items, \"Value can't be None\")\n data_items = []\n for item in items:\n check_not_none(item, \"Value can't be None\")\n data_items.append(self._to_data(item))\n return self._encode_invoke(set_contains_all_codec, items=data_items)", "metadata": "root.Set.contains_all", "header": "['class', 'Set', '(', 'PartitionSpecificProxy', ')', ':', '___EOS___']", "index": 61 }, { "content": " def get_all(self):\n return self._encode_invoke(set_get_all_codec)", "metadata": "root.Set.get_all", "header": "['class', 'Set', '(', 'PartitionSpecificProxy', ')', ':', '___EOS___']", "index": 69 }, { "content": " def is_empty(self):\n return self._encode_invoke(set_is_empty_codec)", "metadata": "root.Set.is_empty", "header": "['class', 'Set', '(', 'PartitionSpecificProxy', ')', ':', '___EOS___']", "index": 72 }, { "content": " def remove(self, item):\n check_not_none(item, \"Value can't be None\")\n item_data = self._to_data(item)\n return self._encode_invoke(set_remove_codec, value=item_data)", "metadata": "root.Set.remove", "header": "['class', 'Set', '(', 'PartitionSpecificProxy', ')', ':', '___EOS___']", "index": 75 }, { "content": " def remove_all(self, items):\n check_not_none(items, \"Value can't be None\")\n data_items = []\n for item in items:\n check_not_none(item, \"Value can't be None\")\n data_items.append(self._to_data(item))\n return self._encode_invoke(set_compare_and_remove_all_codec, values=data_items)", "metadata": "root.Set.remove_all", "header": "['class', 'Set', '(', 'PartitionSpecificProxy', ')', ':', '___EOS___']", "index": 80 }, { "content": " def remove_listener(self, registration_id):\n return self._stop_listening(registration_id, lambda i: set_remove_listener_codec.encode_request(self.name, i))", "metadata": "root.Set.remove_listener", "header": "['class', 'Set', '(', 'PartitionSpecificProxy', ')', ':', '___EOS___']", "index": 88 }, { "content": " def retain_all(self, items):\n check_not_none(items, \"Value can't be None\")\n data_items = []\n for item in items:\n check_not_none(item, \"Value can't be None\")\n data_items.append(self._to_data(item))\n return self._encode_invoke(set_compare_and_retain_all_codec, values=data_items)", "metadata": "root.Set.retain_all", "header": "['class', 'Set', '(', 'PartitionSpecificProxy', ')', ':', '___EOS___']", "index": 91 }, { "content": " def size(self):\n return self._encode_invoke(set_size_codec)", "metadata": "root.Set.size", "header": "['class', 'Set', '(', 'PartitionSpecificProxy', ')', ':', '___EOS___']", "index": 99 } ]
[]
[]
0
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "from_", "haz", "el", "cast_", "._", "protocol_", "._", "codec_", "import_", "set\\u", "add", "\\u", "all", "\\u", "codec_", ",_", "set\\u", "add", "\\u", "codec_", ",_", "set\\u", "add", "\\u", "listen", "er", "\\u", "codec_", ",_", "set\\u", "clear", "\\u", "codec_", ",_", "set\\u", "compare", "\\u", "and", "\\u", "remove", "\\u", "all", "\\u", "codec_", ",_", "set\\u", "compare", "\\u", "and", "\\u", "retain", "\\u", "all", "\\u", "codec_", ",_", "set\\u", "contain", "s", "\\u", "all", "\\u", "codec_", ",_", "set\\u", "contain", "s", "\\u", "codec_", ",_", "set\\u", "get", "\\u", "all", "\\u", "codec_", ",_", "set\\u", "is", "\\u", "empty", "\\u", "codec_", ",_", "set\\u", "remove", "\\u", "codec_", ",_", "set\\u", "remove", "\\u", "listen", "er", "\\u", "codec_", ",_", "set\\u", "size", "\\u", "codec_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "haz", "el", "cast_", "._", "proxy_", "._", "base_", "import_", "Partition", "Specifi", "c", "Proxy_", ",_", "Item", "Event_", ",_", "Item", "Event", "Type_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "haz", "el", "cast_", "._", "util_", "import_", "check", "\\u", "not", "\\u", "none_", "\\u\\u\\uNEWLINE\\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_", "class_", "Set_", "(_", "Partition", "Specifi", "c", "Proxy_", ")_", ":_", "\\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_", "[SEP]_", "class_", "Set_", "(_", "Partition", "Specifi", "c", "Proxy_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "add_", "(_", "self_", ",_", "item_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "check", "\\u", "not", "\\u", "none_", "(_", "item_", ",_", "\"", "Value", " ", "can", "'", "t", " ", "be", " ", "Non", "e", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "element", "\\u", "data_", "=_", "self_", "._", "\\u", "to", "\\u", "data_", "(_", "item_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "\\u", "encode", "\\u", "invoke_", "(_", "set\\u", "add", "\\u", "codec_", ",_", "value_", "=_", "element", "\\u", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Set_", "(_", "Partition", "Specifi", "c", "Proxy_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "add", "\\u", "all_", "(_", "self_", ",_", "items_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "check", "\\u", "not", "\\u", "none_", "(_", "items_", ",_", "\"", "Value", " ", "can", "'", "t", " ", "be", " ", "Non", "e", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data\\u", "items_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "item_", "in_", "items_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "check", "\\u", "not", "\\u", "none_", "(_", "item_", ",_", "\"", "Value", " ", "can", "'", "t", " ", "be", " ", "Non", "e", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data\\u", "items_", "._", "append_", "(_", "self_", "._", "\\u", "to", "\\u", "data_", "(_", "item_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "self_", "._", "\\u", "encode", "\\u", "invoke_", "(_", "set\\u", "add", "\\u", "all", "\\u", "codec_", ",_", "value", "\\u", "list_", "=_", "data\\u", "items_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Set_", "(_", "Partition", "Specifi", "c", "Proxy_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "add", "\\u", "listener_", "(_", "self_", ",_", "include", "\\u", "value_", "=_", "False_", ",_", "item", "\\u", "added_", "=_", "None_", ",_", "item", "\\u", "removed_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "request_", "=_", "set\\u", "add", "\\u", "listen", "er", "\\u", "codec_", "._", "encode", "\\u", "request_", "(_", "self_", "._", "name_", ",_", "include", "\\u", "value_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "handle", "\\u", "event", "\\u", "item_", "(_", "item_", ",_", "uuid_", ",_", "event", "\\u", "type_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "item_", "=_", "item_", "if_", "include", "\\u", "value_", "else_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "member_", "=_", "self_", "._", "\\u", "client_", "._", "cluster_", "._", "get", "\\u", "member", "\\u", "by", "\\u", "uuid_", "(_", "uuid_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "item", "\\u", "event_", "=_", "Item", "Event_", "(_", "self_", "._", "name_", ",_", "item_", ",_", "event", "\\u", "type_", ",_", "member_", ",_", "self_", "._", "\\u", "to", "\\u", "object_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "event", "\\u", "type_", "==_", "Item", "Event", "Type_", "._", "added_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "item", "\\u", "added_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "item", "\\u", "added_", "(_", "item", "\\u", "event_", ")_", "\\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 ", " _", "if_", "item", "\\u", "removed_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "item", "\\u", "removed_", "(_", "item", "\\u", "event_", ")_", "\\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_", "return_", "self_", "._", "\\u", "start", "\\u", "listen", "ing_", "(_", "request_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "lambda_", "m_", ":_", "set\\u", "add", "\\u", "listen", "er", "\\u", "codec_", "._", "handle_", "(_", "m_", ",_", "handle", "\\u", "event", "\\u", "item_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "lambda_", "r_", ":_", "set\\u", "add", "\\u", "listen", "er", "\\u", "codec_", "._", "decode", "\\u", "response_", "(_", "r_", ")_", "[_", "'", "response", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "partit", "ion", "\\u", "key_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Set_", "(_", "Partition", "Specifi", "c", "Proxy_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "clear_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "\\u", "encode", "\\u", "invoke_", "(_", "set\\u", "clear", "\\u", "codec_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Set_", "(_", "Partition", "Specifi", "c", "Proxy_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "contains_", "(_", "self_", ",_", "item_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "check", "\\u", "not", "\\u", "none_", "(_", "item_", ",_", "\"", "Value", " ", "can", "'", "t", " ", "be", " ", "Non", "e", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "item", "\\u", "data_", "=_", "self_", "._", "\\u", "to", "\\u", "data_", "(_", "item_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "\\u", "encode", "\\u", "invoke_", "(_", "set\\u", "contain", "s", "\\u", "codec_", ",_", "value_", "=_", "item", "\\u", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Set_", "(_", "Partition", "Specifi", "c", "Proxy_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "contain", "s", "\\u", "all_", "(_", "self_", ",_", "items_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "check", "\\u", "not", "\\u", "none_", "(_", "items_", ",_", "\"", "Value", " ", "can", "'", "t", " ", "be", " ", "Non", "e", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data\\u", "items_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "item_", "in_", "items_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "check", "\\u", "not", "\\u", "none_", "(_", "item_", ",_", "\"", "Value", " ", "can", "'", "t", " ", "be", " ", "Non", "e", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data\\u", "items_", "._", "append_", "(_", "self_", "._", "\\u", "to", "\\u", "data_", "(_", "item_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "self_", "._", "\\u", "encode", "\\u", "invoke_", "(_", "set\\u", "contain", "s", "\\u", "all", "\\u", "codec_", ",_", "items_", "=_", "data\\u", "items_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Set_", "(_", "Partition", "Specifi", "c", "Proxy_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "all_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "\\u", "encode", "\\u", "invoke_", "(_", "set\\u", "get", "\\u", "all", "\\u", "codec_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Set_", "(_", "Partition", "Specifi", "c", "Proxy_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "is", "\\u", "empty_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "\\u", "encode", "\\u", "invoke_", "(_", "set\\u", "is", "\\u", "empty", "\\u", "codec_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Set_", "(_", "Partition", "Specifi", "c", "Proxy_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "remove_", "(_", "self_", ",_", "item_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "check", "\\u", "not", "\\u", "none_", "(_", "item_", ",_", "\"", "Value", " ", "can", "'", "t", " ", "be", " ", "Non", "e", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "item", "\\u", "data_", "=_", "self_", "._", "\\u", "to", "\\u", "data_", "(_", "item_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "\\u", "encode", "\\u", "invoke_", "(_", "set\\u", "remove", "\\u", "codec_", ",_", "value_", "=_", "item", "\\u", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Set_", "(_", "Partition", "Specifi", "c", "Proxy_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "remove", "\\u", "all_", "(_", "self_", ",_", "items_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "check", "\\u", "not", "\\u", "none_", "(_", "items_", ",_", "\"", "Value", " ", "can", "'", "t", " ", "be", " ", "Non", "e", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data\\u", "items_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "item_", "in_", "items_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "check", "\\u", "not", "\\u", "none_", "(_", "item_", ",_", "\"", "Value", " ", "can", "'", "t", " ", "be", " ", "Non", "e", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data\\u", "items_", "._", "append_", "(_", "self_", "._", "\\u", "to", "\\u", "data_", "(_", "item_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "self_", "._", "\\u", "encode", "\\u", "invoke_", "(_", "set\\u", "compare", "\\u", "and", "\\u", "remove", "\\u", "all", "\\u", "codec_", ",_", "values_", "=_", "data\\u", "items_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Set_", "(_", "Partition", "Specifi", "c", "Proxy_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "remove", "\\u", "listener_", "(_", "self_", ",_", "registration", "\\u", "id_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "\\u", "stop", "\\u", "listen", "ing_", "(_", "registration", "\\u", "id_", ",_", "lambda_", "i_", ":_", "set\\u", "remove", "\\u", "listen", "er", "\\u", "codec_", "._", "encode", "\\u", "request_", "(_", "self_", "._", "name_", ",_", "i_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Set_", "(_", "Partition", "Specifi", "c", "Proxy_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "retain", "\\u", "all_", "(_", "self_", ",_", "items_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "check", "\\u", "not", "\\u", "none_", "(_", "items_", ",_", "\"", "Value", " ", "can", "'", "t", " ", "be", " ", "Non", "e", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data\\u", "items_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "item_", "in_", "items_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "check", "\\u", "not", "\\u", "none_", "(_", "item_", ",_", "\"", "Value", " ", "can", "'", "t", " ", "be", " ", "Non", "e", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data\\u", "items_", "._", "append_", "(_", "self_", "._", "\\u", "to", "\\u", "data_", "(_", "item_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "self_", "._", "\\u", "encode", "\\u", "invoke_", "(_", "set\\u", "compare", "\\u", "and", "\\u", "retain", "\\u", "all", "\\u", "codec_", ",_", "values_", "=_", "data\\u", "items_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Set_", "(_", "Partition", "Specifi", "c", "Proxy_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "size_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "\\u", "encode", "\\u", "invoke_", "(_", "set\\u", "size", "\\u", "codec_", ")_" ]
[ 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,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(self, session_key=None):\n super(SessionStore, self).__init__(session_key)", "metadata": "root.SessionStore.__init__", "header": "['class', 'SessionStore', '(', 'SessionBase', ')', ':', '___EOS___']", "index": 9 } ]
[]
[]
0
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "Sess", "ion", "Store_", "(_", "Sess", "ion", "Base_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "session", "\\u", "key_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "super_", "(_", "Sess", "ion", "Store_", ",_", "self_", ")_", "._", "\\u\\u", "init\\u\\u_", "(_", "session", "\\u", "key_", ")_", "\\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 ]
Unused local variable
reverse-shell/routersploit/routersploit/modules/exploits/asus/rt_n16_password_disclosure.py
[ { "content": "class Exploit(exploits.Exploit):\n \"\"\"\n Exploit implementation for Asus RT-N16 Password Disclosure vulnerability.\n If the target is vulnerable it allows to read credentials for administrator.\n \"\"\"\n __info__ = {\n 'name': 'Asus RT-N16 Password Disclosure',\n 'description': 'Module exploits password disclosure vulnerability in Asus RT-N16 devices that allows to fetch credentials for the device.',\n 'authors': [\n 'Harry Sintonen', # vulnerability discovery\n 'Marcin Bury <marcin.bury@reverse-shell.com>', # routersploit module\n ],\n 'references': [\n 'https://sintonen.fi/advisories/asus-router-auth-bypass.txt'\n ],\n 'targets': [\n 'ASUS RT-N10U, firmware 3.0.0.4.374_168',\n 'ASUS RT-N56U, firmware 3.0.0.4.374_979',\n 'ASUS DSL-N55U, firmware 3.0.0.4.374_1397',\n 'ASUS RT-AC66U, firmware 3.0.0.4.374_2050',\n 'ASUS RT-N15U, firmware 3.0.0.4.374_16',\n 'ASUS RT-N53, firmware 3.0.0.4.374_311',\n ],\n }\n\n target = exploits.Option('', 'Target address e.g. http://192.168.1.1') # target address\n port = exploits.Option(8080, 'Target port') # default port\n\n", "metadata": "root.Exploit", "header": "['module', '___EOS___']", "index": 13 } ]
[]
[]
0
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Explo", "it_", "(_", "exploit", "s_", "._", "Explo", "it_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Explo", "it", " ", "implementation", " ", "for", " ", "As", "us", " ", "RT", "-", "N1", "6", " ", "Passw", "ord", " ", "Disc", "los", "ure", " ", "vulnerability", ".", "\\", "10", ";", " ", " ", " ", " ", "If", " ", "the", " ", "target", " ", "is", " ", "vulnerab", "le", " ", "it", " ", "allow", "s", " ", "to", " ", "read", " ", "cred", "ential", "s", " ", "for", " ", "administrat", "or", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u", "info", "\\u\\u_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "name", "'_", ":_", "'", "As", "us", " ", "RT", "-", "N1", "6", " ", "Passw", "ord", " ", "Disc", "los", "ure", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "description", "'_", ":_", "'", "Modul", "e", " ", "exploit", "s", " ", "password", " ", "discl", "osu", "re", " ", "vulnerability", " ", "in", " ", "As", "us", " ", "RT", "-", "N1", "6", " ", "device", "s", " ", "tha", "t", " ", "allow", "s", " ", "to", " ", "fetch", " ", "cred", "ential", "s", " ", "for", " ", "the", " ", "device", ".'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "author", "s", "'_", ":_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Har", "ry", " ", "Sin", "tone", "n", "'_", ",_", "#", " ", "vulnerability", " ", "discovery_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Marc", "in", " ", "Bur", "y", " ", "<", "marc", "in", ".", "bur", "y", "@", "reverse", "-", "shell", ".", "com", ">'_", ",_", "#", " ", "router", "spl", "oi", "t", " ", "module_", "\\u\\u\\uNL\\u\\u\\u_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "reference", "s", "'_", ":_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "'", "https", "://", "sint", "one", "n", ".", "fi", "/", "advisor", "ies", "/", "asu", "s", "-", "router", "-", "auth", "-", "bypass", ".", "txt", "'_", "\\u\\u\\uNL\\u\\u\\u_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "target", "s", "'_", ":_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "'", "AS", "US", " ", "RT", "-", "N1", "0", "U", ",", " ", "firmware", " ", "3.0", ".0", ".4", ".3", "7", "4", "\\u", "168", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "AS", "US", " ", "RT", "-", "N", "56", "U", ",", " ", "firmware", " ", "3.0", ".0", ".4", ".3", "7", "4", "\\u", "979", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "AS", "US", " ", "DSL", "-", "N", "5", "5", "U", ",", " ", "firmware", " ", "3.0", ".0", ".4", ".3", "7", "4", "\\u", "139", "7", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "AS", "US", " ", "RT", "-", "AC", "6", "6", "U", ",", " ", "firmware", " ", "3.0", ".0", ".4", ".3", "7", "4", "\\u", "2050", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "AS", "US", " ", "RT", "-", "N1", "5", "U", ",", " ", "firmware", " ", "3.0", ".0", ".4", ".3", "7", "4", "\\u", "16", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "AS", "US", " ", "RT", "-", "N", "5", "3", ",", " ", "firmware", " ", "3.0", ".0", ".4", ".3", "7", "4", "\\u", "311", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "target_", "=_", "exploit", "s_", "._", "Option_", "(_", "''_", ",_", "'", "Target", " ", "address", " ", "e", ".", "g", ".", " ", "http", "://", "192", ".1", "68.", "1.1", "'_", ")_", "#", " ", "target", " ", "address_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "port_", "=_", "exploit", "s_", "._", "Option_", "(_", "8080_", ",_", "'", "Target", " ", "port", "'_", ")_", "#", " ", "default", " ", "port_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\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, 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, 2 ]
Unused local variable
DataDog/datadogpy/datadog/dogshell/monitor.py
[ { "content": " @classmethod\n def _unmute(cls, args):\n api._timeout = args.timeout\n res = api.Monitor.unmute(args.monitor_id, scope=args.scope, all_scopes=args.all_scopes)\n report_warnings(res)\n report_errors(res)\n if format == 'pretty':\n print(pretty_json(res))\n else:\n print(json.dumps(res))", "metadata": "root.MonitorClient._unmute", "header": "['class', 'MonitorClient', '(', 'object', ')', ':', '___EOS___']", "index": 202 } ]
[]
[]
0
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "Monitor", "Client_", "(_", "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_", "\\u", "unm", "ute", "_", "(_", "cls_", ",_", "args_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "api_", "._", "\\u", "timeout_", "=_", "args_", "._", "timeout_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res_", "=_", "api_", "._", "Monitor_", "._", "unm", "ute", "_", "(_", "args_", "._", "monit", "or", "\\u", "id_", ",_", "scope_", "=_", "args_", "._", "scope_", ",_", "all", "\\u", "scopes_", "=_", "args_", "._", "all", "\\u", "scopes_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "report", "\\u", "warnings_", "(_", "res_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "report", "\\u", "errors_", "(_", "res_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "format_", "==_", "'", "pretty", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "pretty", "\\u", "json_", "(_", "res_", ")_", ")_", "\\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 ", " _", "print_", "(_", "json_", "._", "dumps_", "(_", "res_", ")_", ")_" ]
[ 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 ]
Except block handles 'BaseException'
SmokinCaterpillar/pypet/pypet/tests/testutils/ioutils.py
[ { "content": "__author__ = 'Robert Meyer'\n\nimport logging\nimport os\nimport random\nimport sys\nif (sys.version_info < (2, 7, 0)):\n import unittest2 as unittest\nelse:\n import unittest\ntry:\n import ConfigParser as cp\nexcept ImportError:\n import configparser as cp\nimport shutil\nimport getopt\nimport tempfile\nimport time\ntry:\n import zmq\nexcept ImportError:\n zmq = None\n\nimport pypet.pypetconstants as pypetconstants\nimport pypet.compat as compat\nfrom pypet import HasLogger\nfrom pypet.pypetlogging import LoggingManager, rename_log_file\nfrom pypet.utils.decorators import copydoc\nfrom pypet.utils.helpful_functions import port_to_tcp\n\n#import pypet.utils.ptcompat as ptcompat\n#hdf5version = ptcompat.hdf5_version\n#print('HDF5 Version: %s' % str(hdf5version))\n\ntestParams=dict(\n tempdir = 'tmp_pypet_tests',\n # Temporary directory for the hdf5 files'''\n remove=True,\n # Whether or not to remove the temporary directory after the tests\n actual_tempdir='',\n # Actual temp dir, maybe in tests folder or in `tempfile.gettempdir()`\n user_tempdir='',\n # Specified log level\n log_config='test'\n)\n\nTEST_IMPORT_ERROR = 'ModuleImportFailure'\n\ngeneric_log_folder = None\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n# Prepare config on loading, just in case tests are not called via run_suite()\nprepare_log_config()", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[]
[]
0
true
[ "[CLS]_", "Except", "_", "block_", "handles_", "'", "Base", "Except", "ion", "'_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u", "author\\u\\u_", "=_", "'", "Robert", " ", "Me", "yer", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "logging_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "random_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "(_", "sys_", "._", "version", "\\u", "info_", "<_", "(_", "2_", ",_", "7_", ",_", "0_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "unittest2_", "as_", "unittest_", "\\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_", "unittest_", "\\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_", "Config", "Parser_", "as_", "cp_", "\\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 ", " _", "import_", "configparser_", "as_", "cp_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "import_", "shutil_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "getopt_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "tempfile_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "time_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "zmq_", "\\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 ", " _", "zmq_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "import_", "pype", "t_", "._", "pype", "tcon", "stan", "ts_", "as_", "pype", "tcon", "stan", "ts_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "pype", "t_", "._", "compat_", "as_", "compat_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "pype", "t_", "import_", "Has", "Logger_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "pype", "t_", "._", "pype", "tlo", "ggi", "ng_", "import_", "Log", "ging", "Manager_", ",_", "rename", "\\u", "log", "\\u", "file_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "pype", "t_", "._", "utils_", "._", "decorators_", "import_", "copy", "doc_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "pype", "t_", "._", "utils_", "._", "help", "ful", "\\u", "functions_", "import_", "port", "\\u", "to", "\\u", "tcp_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "import", " ", "pype", "t", ".", "util", "s", ".", "pt", "compa", "t", " ", "as", " ", "pt", "compat_", "\\u\\u\\uNL\\u\\u\\u_", "#", "hdf5", "version", " ", "=", " ", "pt", "compa", "t", ".", "hdf5", "\\u", "version_", "\\u\\u\\uNL\\u\\u\\u_", "#", "print", "('", "HDF", "5", " ", "Version", ":", " ", "%", "s", "'", " ", "%", " ", "str", "(", "hdf5", "version", "))", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "test", "Params_", "=_", "dict_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "tempdir_", "=_", "'", "tmp", "\\u", "pype", "t", "\\u", "tests", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Tempora", "ry", " ", "director", "y", " ", "for", " ", "the", " ", "hdf5", " ", "files", "'''_", "\\u\\u\\uNL\\u\\u\\u_", "remove_", "=_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Whe", "ther", " ", "or", " ", "not", " ", "to", " ", "remove", " ", "the", " ", "temporar", "y", " ", "director", "y", " ", "after", " ", "the", " ", "tests_", "\\u\\u\\uNL\\u\\u\\u_", "actual", "\\u", "tempdir_", "=_", "''_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Actual", " ", "temp", " ", "dir", ",", " ", "may", "be", " ", "in", " ", "tests", " ", "folder", " ", "or", " ", "in", " ", "`", "tempfile", ".", "gett", "emp", "dir", "()`", "_", "\\u\\u\\uNL\\u\\u\\u_", "user", "\\u", "tempdir_", "=_", "''_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Specifie", "d", " ", "log", " ", "level_", "\\u\\u\\uNL\\u\\u\\u_", "log", "\\u", "config_", "=_", "'", "test", "'_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "TEST", "\\u", "IMPORT", "\\u", "ERROR_", "=_", "'", "Modul", "e", "Import", "Fail", "ure", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "gener", "ic", "\\u", "log", "\\u", "folder_", "=_", "None_", "\\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\\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_", "#", " ", "Prepare", " ", "config", " ", "on", " ", "load", "ing", ",", " ", "just", " ", "in", " ", "case", " ", "tests", " ", "are", " ", "not", " ", "call", "ed", " ", "via", " ", "run", "\\u", "suit", "e", "()", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "prepar", "e\\u", "log", "\\u", "config_", "(_", ")_" ]
[ 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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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 import
saltstack/salt/salt/returners/mongo_return.py
[ { "content": "# -*- coding: utf-8 -*-\n'''\nReturn data to a mongodb server\n\nRequired python modules: pymongo\n\n\nThis returner will send data from the minions to a MongoDB server. To\nconfigure the settings for your MongoDB server, add the following lines\nto the minion config files.\n\n.. code-block:: yaml\n\n mongo.db: <database name>\n mongo.host: <server ip address>\n mongo.user: <MongoDB username>\n mongo.password: <MongoDB user password>\n mongo.port: 27017\n\nAlternative configuration values can be used by prefacing the configuration.\nAny values not found in the alternative configuration will be pulled from\nthe default location.\n\n.. code-block:: yaml\n\n alternative.mongo.db: <database name>\n alternative.mongo.host: <server ip address>\n alternative.mongo.user: <MongoDB username>\n alternative.mongo.password: <MongoDB user password>\n alternative.mongo.port: 27017\n\nTo use the mongo returner, append '--return mongo' to the salt command.\n\n.. code-block:: bash\n\n salt '*' test.ping --return mongo_return\n\nTo use the alternative configuration, append '--return_config alternative' to the salt command.\n\n.. versionadded:: 2015.5.0\n\n.. code-block:: bash\n\n salt '*' test.ping --return mongo_return --return_config alternative\n\nTo override individual configuration items, append --return_kwargs '{\"key:\": \"value\"}' to the salt command.\n\n.. versionadded:: 2016.3.0\n\n.. code-block:: bash\n\n salt '*' test.ping --return mongo --return_kwargs '{\"db\": \"another-salt\"}'\n\nTo override individual configuration items, append --return_kwargs '{\"key:\": \"value\"}' to the salt command.\n\n.. versionadded:: 2016.3.0\n\n.. code-block:: bash\n\n salt '*' test.ping --return mongo --return_kwargs '{\"db\": \"another-salt\"}'\n\n'''\nfrom __future__ import absolute_import\n\n# Import python libs\nimport logging\n\n# import Salt libs\nimport salt.utils.jid\nimport salt.returners\nimport salt.ext.six as six\n\n# Import third party libs\ntry:\n import pymongo\n version = pymongo.version\n version = '.'.join(version.split('.')[:2])\n HAS_PYMONGO = True\nexcept ImportError:\n HAS_PYMONGO = False\n\n\nlog = logging.getLogger(__name__)\n\n# Define the module's virtual name\n# currently only used iby _get_options\n__virtualname__ = 'mongo'\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def __virtual__():\n if not HAS_PYMONGO:\n return False\n return 'mongo_return'", "metadata": "root.__virtual__", "header": "['module', '___EOS___']", "index": 89 }, { "content": "def _remove_dots(src):\n '''\n Remove dots from the given data structure\n '''\n output = {}\n for key, val in six.iteritems(src):\n if isinstance(val, dict):\n val = _remove_dots(val)\n output[key.replace('.', '-')] = val\n return output", "metadata": "root._remove_dots", "header": "['module', '___EOS___']", "index": 95 }, { "content": "def _get_options(ret):\n '''\n Get the monogo_return options from salt.\n '''\n attrs = {'host': 'host',\n 'port': 'port',\n 'db': 'db',\n 'user': 'user',\n 'password': 'password',\n 'indexes': 'indexes'}\n\n _options = salt.returners.get_returner_options(__virtualname__,\n ret,\n attrs,\n __salt__=__salt__,\n __opts__=__opts__)\n return _options", "metadata": "root._get_options", "header": "['module', '___EOS___']", "index": 107 }, { "content": "def _get_conn(ret):\n '''\n Return a mongodb connection object\n '''\n _options = _get_options(ret)\n\n host = _options.get('host')\n port = _options.get('port')\n db_ = _options.get('db')\n user = _options.get('user')\n password = _options.get('password')\n indexes = _options.get('indexes', False)\n\n # at some point we should remove support for\n # pymongo versions < 2.3 until then there are\n # a bunch of these sections that need to be supported\n\n if float(version) > 2.3:\n conn = pymongo.MongoClient(host, port)\n else:\n conn = pymongo.Connection(host, port)\n mdb = conn[db_]\n\n if user and password:\n mdb.authenticate(user, password)\n\n if indexes:\n if float(version) > 2.3:\n mdb.saltReturns.create_index('minion')\n mdb.saltReturns.create_index('jid')\n\n mdb.jobs.create_index('jid')\n else:\n mdb.saltReturns.ensure_index('minion')\n mdb.saltReturns.ensure_index('jid')\n\n mdb.jobs.ensure_index('jid')\n\n return conn, mdb", "metadata": "root._get_conn", "header": "['module', '___EOS___']", "index": 126 }, { "content": "def returner(ret):\n '''\n Return data to a mongodb server\n '''\n conn, mdb = _get_conn(ret)\n col = mdb[ret['id']]\n\n if isinstance(ret['return'], dict):\n back = _remove_dots(ret['return'])\n else:\n back = ret['return']\n\n if isinstance(ret, dict):\n full_ret = _remove_dots(ret)\n else:\n full_ret = ret\n\n log.debug(back)\n sdata = {'minion': ret['id'], 'jid': ret['jid'], 'return': back, 'fun': ret['fun'], 'full_ret': full_ret}\n if 'out' in ret:\n sdata['out'] = ret['out']\n\n # save returns in the saltReturns collection in the json format:\n # { 'minion': <minion_name>, 'jid': <job_id>, 'return': <return info with dots removed>,\n # 'fun': <function>, 'full_ret': <unformatted return with dots removed>}\n\n # again we run into the issue with deprecated code from previous versions\n\n if float(version) > 2.3:\n #using .copy() to ensure original data for load is unchanged\n mdb.saltReturns.insert_one(sdata.copy())\n else:\n mdb.saltReturns.insert(sdata.copy())", "metadata": "root.returner", "header": "['module', '___EOS___']", "index": 167 }, { "content": "def get_jid(jid):\n '''\n Return the return information associated with a jid\n '''\n conn, mdb = _get_conn(ret=None)\n ret = {}\n rdata = mdb.saltReturns.find({'jid': jid}, {'_id': 0})\n if rdata:\n for data in rdata:\n minion = data['minion']\n # return data in the format {<minion>: { <unformatted full return data>}}\n ret[minion] = data['full_ret']\n return ret", "metadata": "root.get_jid", "header": "['module', '___EOS___']", "index": 202 }, { "content": "def get_fun(fun):\n '''\n Return the most recent jobs that have executed the named function\n '''\n conn, mdb = _get_conn(ret=None)\n ret = {}\n rdata = mdb.saltReturns.find_one({'fun': fun}, {'_id': 0})\n if rdata:\n ret = rdata\n return ret", "metadata": "root.get_fun", "header": "['module', '___EOS___']", "index": 217 }, { "content": "def prep_jid(nocache=False, passed_jid=None): # pylint: disable=unused-argument\n '''\n Do any work necessary to prepare a JID, including sending a custom id\n '''\n return passed_jid if passed_jid is not None else salt.utils.jid.gen_jid()", "metadata": "root.prep_jid", "header": "['module', '___EOS___']", "index": 229 }, { "content": "def save_minions(jid, minions): # pylint: disable=unused-argument\n '''\n Included for API consistency\n '''\n pass", "metadata": "root.save_minions", "header": "['module', '___EOS___']", "index": 236 } ]
[]
[]
0
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "-*-", " ", "codi", "ng", ":", " ", "utf", "-", "8", " ", "-*-", "_", "\\u\\u\\uNL\\u\\u\\u_", "'''", "\\", "10", ";", "Return", " ", "data", " ", "to", " ", "a", " ", "mongodb", " ", "server", "\\", "10", ";", "\\", "10", ";", "Requ", "ired", " ", "python", " ", "module", "s", ":", " ", "pymong", "o", "\\", "10", ";", "\\", "10", ";", "\\", "10", ";", "Thi", "s", " ", "return", "er", " ", "will", " ", "send", " ", "data", " ", "from", " ", "the", " ", "minion", "s", " ", "to", " ", "a", " ", "Mon", "go", "DB", " ", "server", ".", " ", "To", "\\", "10", ";", "configur", "e", " ", "the", " ", "settings", " ", "for", " ", "your", " ", "Mon", "go", "DB", " ", "server", ",", " ", "add", " ", "the", " ", "follow", "ing", " ", "lines", "\\", "10", ";", "to", " ", "the", " ", "minion", " ", "config", " ", "files", ".", "\\", "10", ";", "\\", "10", ";", "..", " ", "code", "-", "block", "::", " ", "yaml", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "mongo", ".", "db", ":", " ", "<", "databa", "se", " ", "name", ">", "\\", "10", ";", " ", " ", " ", " ", "mongo", ".", "host", ":", " ", "<", "server", " ", "ip", " ", "address", ">", "\\", "10", ";", " ", " ", " ", " ", "mongo", ".", "user", ":", " ", "<", "Mon", "go", "DB", " ", "user", "name", ">", "\\", "10", ";", " ", " ", " ", " ", "mongo", ".", "password", ":", " ", "<", "Mon", "go", "DB", " ", "user", " ", "password", ">", "\\", "10", ";", " ", " ", " ", " ", "mongo", ".", "port", ":", " ", "27017", "\\", "10", ";", "\\", "10", ";", "Alternative", " ", "configura", "tion", " ", "values", " ", "can", " ", "be", " ", "used", " ", "by", " ", "prefa", "cing", " ", "the", " ", "configura", "tion", ".", "\\", "10", ";", "Any", " ", "values", " ", "not", " ", "found", " ", "in", " ", "the", " ", "alternative", " ", "configura", "tion", " ", "will", " ", "be", " ", "pull", "ed", " ", "from", "\\", "10", ";", "the", " ", "default", " ", "location", ".", "\\", "10", ";", "\\", "10", ";", "..", " ", "code", "-", "block", "::", " ", "yaml", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "alternative", ".", "mongo", ".", "db", ":", " ", "<", "databa", "se", " ", "name", ">", "\\", "10", ";", " ", " ", " ", " ", "alternative", ".", "mongo", ".", "host", ":", " ", "<", "server", " ", "ip", " ", "address", ">", "\\", "10", ";", " ", " ", " ", " ", "alternative", ".", "mongo", ".", "user", ":", " ", "<", "Mon", "go", "DB", " ", "user", "name", ">", "\\", "10", ";", " ", " ", " ", " ", "alternative", ".", "mongo", ".", "password", ":", " ", "<", "Mon", "go", "DB", " ", "user", " ", "password", ">", "\\", "10", ";", " ", " ", " ", " ", "alternative", ".", "mongo", ".", "port", ":", " ", "27017", "\\", "10", ";", "\\", "10", ";", "To", " ", "use", " ", "the", " ", "mongo", " ", "return", "er", ",", " ", "append", " ", "'--", "return", " ", "mongo", "'", " ", "to", " ", "the", " ", "salt", " ", "command", ".", "\\", "10", ";", "\\", "10", ";", "..", " ", "code", "-", "block", "::", " ", "bash", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "salt", " ", "'*", "'", " ", "test", ".", "ping", " ", "--", "return", " ", "mongo", "\\u", "return", "\\", "10", ";", "\\", "10", ";", "To", " ", "use", " ", "the", " ", "alternative", " ", "configura", "tion", ",", " ", "append", " ", "'--", "return", "\\u", "config", " ", "alternative", "'", " ", "to", " ", "the", " ", "salt", " ", "command", ".", "\\", "10", ";", "\\", "10", ";", "..", " ", "version", "adde", "d", "::", " ", "201", "5.5", ".0", "\\", "10", ";", "\\", "10", ";", "..", " ", "code", "-", "block", "::", " ", "bash", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "salt", " ", "'*", "'", " ", "test", ".", "ping", " ", "--", "return", " ", "mongo", "\\u", "return", " ", "--", "return", "\\u", "config", " ", "alternative", "\\", "10", ";", "\\", "10", ";", "To", " ", "override", " ", "individual", " ", "configura", "tion", " ", "items", ",", " ", "append", " ", "--", "return", "\\u", "kwarg", "s", " ", "'{", "\"", "key", ":\"", ":", " ", "\"", "value", "\"}", "'", " ", "to", " ", "the", " ", "salt", " ", "command", ".", "\\", "10", ";", "\\", "10", ";", "..", " ", "version", "adde", "d", "::", " ", "2016", ".3", ".0", "\\", "10", ";", "\\", "10", ";", "..", " ", "code", "-", "block", "::", " ", "bash", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "salt", " ", "'*", "'", " ", "test", ".", "ping", " ", "--", "return", " ", "mongo", " ", "--", "return", "\\u", "kwarg", "s", " ", "'{", "\"", "db", "\":", " ", "\"", "anot", "her", "-", "salt", "\"}", "'", "\\", "10", ";", "\\", "10", ";", "To", " ", "override", " ", "individual", " ", "configura", "tion", " ", "items", ",", " ", "append", " ", "--", "return", "\\u", "kwarg", "s", " ", "'{", "\"", "key", ":\"", ":", " ", "\"", "value", "\"}", "'", " ", "to", " ", "the", " ", "salt", " ", "command", ".", "\\", "10", ";", "\\", "10", ";", "..", " ", "version", "adde", "d", "::", " ", "2016", ".3", ".0", "\\", "10", ";", "\\", "10", ";", "..", " ", "code", "-", "block", "::", " ", "bash", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "salt", " ", "'*", "'", " ", "test", ".", "ping", " ", "--", "return", " ", "mongo", " ", "--", "return", "\\u", "kwarg", "s", " ", "'{", "\"", "db", "\":", " ", "\"", "anot", "her", "-", "salt", "\"}", "'", "\\", "10", ";", "\\", "10", ";'", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "\\u\\u", "future\\u\\u_", "import_", "abs", "olute", "\\u", "import_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Import", " ", "python", " ", "libs_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "logging_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "import", " ", "Sal", "t", " ", "libs_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "salt_", "._", "utils_", "._", "jid_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "salt_", "._", "return", "ers_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "salt_", "._", "ext_", "._", "six_", "as_", "six_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Import", " ", "third", " ", "part", "y", " ", "libs_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "pymongo_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "version_", "=_", "pymongo_", "._", "version_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "version_", "=_", "'.'_", "._", "join_", "(_", "version_", "._", "split_", "(_", "'.'_", ")_", "[_", ":_", "2_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "HAS", "\\u", "PY", "MONGO", "_", "=_", "True_", "\\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 ", " _", "HAS", "\\u", "PY", "MONGO", "_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "log_", "=_", "logging_", "._", "get", "Logger_", "(_", "\\u\\u", "name\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Define", " ", "the", " ", "module", "'", "s", " ", "virtual", " ", "name_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "currentl", "y", " ", "only", " ", "used", " ", "ib", "y", " ", "\\u", "get", "\\u", "options_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u", "virtual", "name\\u\\u_", "=_", "'", "mongo", "'_", "\\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_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "virtual", "\\u\\u_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "HAS", "\\u", "PY", "MONGO", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "'", "mongo", "\\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_", "def_", "\\u", "remove", "\\u", "dots_", "(_", "src_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "\\", "10", ";", " ", " ", " ", " ", "Remove", " ", "dot", "s", " ", "from", " ", "the", " ", "give", "n", " ", "data", " ", "structure", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "output_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "key_", ",_", "val_", "in_", "six_", "._", "iteritems_", "(_", "src_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "isinstance_", "(_", "val_", ",_", "dict_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "val_", "=_", "\\u", "remove", "\\u", "dots_", "(_", "val_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "output_", "[_", "key_", "._", "replace_", "(_", "'.'_", ",_", "'-'_", ")_", "]_", "=_", "val_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "output_", "\\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_", "\\u", "get", "\\u", "options_", "(_", "ret_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "\\", "10", ";", " ", " ", " ", " ", "Get", " ", "the", " ", "mono", "go", "\\u", "return", " ", "options", " ", "from", " ", "salt", ".", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "attrs_", "=_", "{_", "'", "host", "'_", ":_", "'", "host", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "port", "'_", ":_", "'", "port", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "db", "'_", ":_", "'", "db", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "user", "'_", ":_", "'", "user", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "password", "'_", ":_", "'", "password", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "indexe", "s", "'_", ":_", "'", "indexe", "s", "'_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "options_", "=_", "salt_", "._", "return", "ers_", "._", "get", "\\u", "return", "er", "\\u", "options_", "(_", "\\u\\u", "virtual", "name\\u\\u_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "ret_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "attrs_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u", "salt\\u\\u_", "=_", "\\u\\u", "salt\\u\\u_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u", "opts", "\\u\\u_", "=_", "\\u\\u", "opts", "\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u", "options_", "\\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_", "\\u", "get", "\\u", "conn_", "(_", "ret_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "\\", "10", ";", " ", " ", " ", " ", "Return", " ", "a", " ", "mongodb", " ", "connecti", "on", " ", "object", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "options_", "=_", "\\u", "get", "\\u", "options_", "(_", "ret_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "host_", "=_", "\\u", "options_", "._", "get_", "(_", "'", "host", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "port_", "=_", "\\u", "options_", "._", "get_", "(_", "'", "port", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "db", "\\u_", "=_", "\\u", "options_", "._", "get_", "(_", "'", "db", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "user_", "=_", "\\u", "options_", "._", "get_", "(_", "'", "user", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "password_", "=_", "\\u", "options_", "._", "get_", "(_", "'", "password", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "indexes_", "=_", "\\u", "options_", "._", "get_", "(_", "'", "indexe", "s", "'_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "at", " ", "some", " ", "point", " ", "we", " ", "shou", "ld", " ", "remove", " ", "support", " ", "for_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "pymong", "o", " ", "version", "s", " ", "<", " ", "2.3", " ", "unti", "l", " ", "then", " ", "there", " ", "are", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "a", " ", "bunch", " ", "of", " ", "these", " ", "section", "s", " ", "tha", "t", " ", "need", " ", "to", " ", "be", " ", "supported_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "float_", "(_", "version_", ")_", ">_", "2.3_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "conn_", "=_", "pymongo_", "._", "Mon", "go", "Client_", "(_", "host_", ",_", "port_", ")_", "\\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 ", " _", "conn_", "=_", "pymongo_", "._", "Connection_", "(_", "host_", ",_", "port_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "mdb", "_", "=_", "conn_", "[_", "db", "\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "user_", "and_", "password_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "mdb", "_", "._", "authenticate_", "(_", "user_", ",_", "password_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "indexes_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "float_", "(_", "version_", ")_", ">_", "2.3_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "mdb", "_", "._", "salt", "Return", "s_", "._", "create", "\\u", "index_", "(_", "'", "minion", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mdb", "_", "._", "salt", "Return", "s_", "._", "create", "\\u", "index_", "(_", "'", "ji", "d", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "mdb", "_", "._", "jobs_", "._", "create", "\\u", "index_", "(_", "'", "ji", "d", "'_", ")_", "\\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 ", " _", "mdb", "_", "._", "salt", "Return", "s_", "._", "ensure", "\\u", "index_", "(_", "'", "minion", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mdb", "_", "._", "salt", "Return", "s_", "._", "ensure", "\\u", "index_", "(_", "'", "ji", "d", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "mdb", "_", "._", "jobs_", "._", "ensure", "\\u", "index_", "(_", "'", "ji", "d", "'_", ")_", "\\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_", "conn_", ",_", "mdb", "_", "\\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_", "return", "er_", "(_", "ret_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "\\", "10", ";", " ", " ", " ", " ", "Return", " ", "data", " ", "to", " ", "a", " ", "mongodb", " ", "server", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "conn_", ",_", "mdb", "_", "=_", "\\u", "get", "\\u", "conn_", "(_", "ret_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "col_", "=_", "mdb", "_", "[_", "ret_", "[_", "'", "id", "'_", "]_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "isinstance_", "(_", "ret_", "[_", "'", "return", "'_", "]_", ",_", "dict_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "back_", "=_", "\\u", "remove", "\\u", "dots_", "(_", "ret_", "[_", "'", "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 ", " _", "back_", "=_", "ret_", "[_", "'", "return", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "isinstance_", "(_", "ret_", ",_", "dict_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "full", "\\u", "ret_", "=_", "\\u", "remove", "\\u", "dots_", "(_", "ret_", ")_", "\\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 ", " _", "full", "\\u", "ret_", "=_", "ret_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "log_", "._", "debug_", "(_", "back_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sdata", "_", "=_", "{_", "'", "minion", "'_", ":_", "ret_", "[_", "'", "id", "'_", "]_", ",_", "'", "ji", "d", "'_", ":_", "ret_", "[_", "'", "ji", "d", "'_", "]_", ",_", "'", "return", "'_", ":_", "back_", ",_", "'", "fun", "'_", ":_", "ret_", "[_", "'", "fun", "'_", "]_", ",_", "'", "full", "\\u", "ret", "'_", ":_", "full", "\\u", "ret_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "'", "out", "'_", "in_", "ret_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sdata", "_", "[_", "'", "out", "'_", "]_", "=_", "ret_", "[_", "'", "out", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "save", " ", "return", "s", " ", "in", " ", "the", " ", "salt", "Return", "s", " ", "collection", " ", "in", " ", "the", " ", "json", " ", "format", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "{", " ", "'", "minion", "':", " ", "<", "minion", "\\u", "name", ">", ",", " ", "'", "ji", "d", "':", " ", "<", "job", "\\u", "id", ">", ",", " ", "'", "return", "':", " ", "<", "return", " ", "info", " ", "with", " ", "dot", "s", " ", "remove", "d", ">", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "'", "fun", "':", " ", "<", "function", ">", ",", " ", "'", "full", "\\u", "ret", "':", " ", "<", "unfo", "rmat", "ted", " ", "return", " ", "with", " ", "dot", "s", " ", "remove", "d", ">}", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "again", " ", "we", " ", "run", " ", "int", "o", " ", "the", " ", "issue", " ", "with", " ", "depre", "cated", " ", "code", " ", "from", " ", "previ", "ous", " ", "versions_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "float_", "(_", "version_", ")_", ">_", "2.3_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "usi", "ng", " ", ".", "copy", "()", " ", "to", " ", "ensure", " ", "original", " ", "data", " ", "for", " ", "load", " ", "is", " ", "unchanged", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "mdb", "_", "._", "salt", "Return", "s_", "._", "insert", "\\u", "one_", "(_", "sdata", "_", "._", "copy_", "(_", ")_", ")_", "\\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 ", " _", "mdb", "_", "._", "salt", "Return", "s_", "._", "insert_", "(_", "sdata", "_", "._", "copy_", "(_", ")_", ")_", "\\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", "jid_", "(_", "jid_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "\\", "10", ";", " ", " ", " ", " ", "Return", " ", "the", " ", "return", " ", "informati", "on", " ", "associate", "d", " ", "with", " ", "a", " ", "ji", "d", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "conn_", ",_", "mdb", "_", "=_", "\\u", "get", "\\u", "conn_", "(_", "ret_", "=_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ret_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rdata_", "=_", "mdb", "_", "._", "salt", "Return", "s_", "._", "find_", "(_", "{_", "'", "ji", "d", "'_", ":_", "jid_", "}_", ",_", "{_", "'\\u", "id", "'_", ":_", "0_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "rdata_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "data_", "in_", "rdata_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "minion", "_", "=_", "data_", "[_", "'", "minion", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "return", " ", "data", " ", "in", " ", "the", " ", "format", " ", "{", "<", "minion", ">:", " ", "{", " ", "<", "unfo", "rmat", "ted", " ", "full", " ", "return", " ", "data", ">}", "}_", "\\u\\u\\uNL\\u\\u\\u_", "ret_", "[_", "minion", "_", "]_", "=_", "data_", "[_", "'", "full", "\\u", "ret", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "ret_", "\\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", "fun_", "(_", "fun_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "\\", "10", ";", " ", " ", " ", " ", "Return", " ", "the", " ", "most", " ", "recent", " ", "jobs", " ", "tha", "t", " ", "have", " ", "executed", " ", "the", " ", "named", " ", "function", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "conn_", ",_", "mdb", "_", "=_", "\\u", "get", "\\u", "conn_", "(_", "ret_", "=_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ret_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rdata_", "=_", "mdb", "_", "._", "salt", "Return", "s_", "._", "find", "\\u", "one_", "(_", "{_", "'", "fun", "'_", ":_", "fun_", "}_", ",_", "{_", "'\\u", "id", "'_", ":_", "0_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "rdata_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ret_", "=_", "rdata_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "ret_", "\\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_", "prep", "\\u", "jid_", "(_", "noca", "che_", "=_", "False_", ",_", "pass", "ed", "\\u", "jid_", "=_", "None_", ")_", ":_", "#", " ", "pylint", ":", " ", "disable", "=", "unu", "sed", "-", "argument_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "\\", "10", ";", " ", " ", " ", " ", "Do", " ", "any", " ", "work", " ", "necessar", "y", " ", "to", " ", "prepar", "e", " ", "a", " ", "JID", ",", " ", "inclu", "ding", " ", "sendin", "g", " ", "a", " ", "custom", " ", "id", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "pass", "ed", "\\u", "jid_", "if_", "pass", "ed", "\\u", "jid_", "is_", "not_", "None_", "else_", "salt_", "._", "utils_", "._", "jid_", "._", "gen", "\\u", "jid_", "(_", ")_", "\\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", "\\u", "minions_", "(_", "jid_", ",_", "minions_", ")_", ":_", "#", " ", "pylint", ":", " ", "disable", "=", "unu", "sed", "-", "argument_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "\\", "10", ";", " ", " ", " ", " ", "Include", "d", " ", "for", " ", "API", " ", "consiste", "nc", "y", "\\", "10", ";", "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, 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, 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, 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 ]
Except block handles 'BaseException'
CenterForOpenScience/scrapi/scrapi/harvesters/push_api.py
[ { "content": "def gen_harvesters():\n try:\n return {\n source['shortname']: gen_harvester(**source)\n for source in get_sources()\n }\n except Exception as e:\n logger.warn('Could not generate harvesters from push api')\n if settings.DEBUG:\n logger.exception(e)", "metadata": "root.gen_harvesters", "header": "['module', '___EOS___']", "index": 15 } ]
[]
[]
0
true
[ "[CLS]_", "Except", "_", "block_", "handles_", "'", "Base", "Except", "ion", "'_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "gen", "\\u", "harvester", "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 ", " _", "return_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "source_", "[_", "'", "short", "name", "'_", "]_", ":_", "gen", "\\u", "harvester", "_", "(_", "**_", "source_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "source_", "in_", "get", "\\u", "sources_", "(_", ")_", "\\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 ", " _", "logger_", "._", "warn_", "(_", "'", "Cou", "ld", " ", "not", " ", "generat", "e", " ", "harvester", "s", " ", "from", " ", "push", " ", "api", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "settings_", "._", "DEBUG_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logger_", "._", "exception_", "(_", "e_", ")_", "\\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 ]
Unnecessary 'else' clause in loop
ucrcsedept/galah/galah/sheep/virtualsuites/vz/pyvz.py
[ { "content": "def create_container(id_range = range(1, 255),\n subnet = \"10.0.1\",\n os_template = None,\n description = None):\n \"\"\"\n Calls vzctl create to create a new OpenVZ container with an id in the\n given range. Iff an available id could not be found a RuntimeError is\n raised.\n\n The id of the newly created container is returned.\n\n This function blocks until the container is fully created.\n\n \"\"\"\n\n # Get a set of all the extant containes\n containers = set(get_containers())\n\n # Find an available ID\n for i in id_range:\n if i not in containers:\n id = i\n break\n else:\n raise RuntimeError(\"Could not find availableVM ID in permissable range \"\n \"[%s, %s].\"\n % (config.getint(\"CreateContainer\", \"idmin\")))\n\n # Holds additional parameters that will be passed to vzctl create\n parameters = []\n\n if subnet != None:\n parameters += [\"--ipadd\", subnet + \".\" + str(id)]\n\n if os_template != None:\n parameters += [\"--ostemplate\", os_template]\n\n if description != None:\n parameters += [\"--description\", description]\n\n # Actually call vzctl to create the container\n run_vzctl([\"create\", str(id)] + parameters)\n\n return id", "metadata": "root.create_container", "header": "['module', '___EOS___']", "index": 101 } ]
[]
[]
0
true
[ "[CLS]_", "Un", "necessar", "y_", "'", "else", "'_", "clause_", "in_", "loop_", "[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_", "create", "\\u", "container_", "(_", "id", "\\u", "range_", "=_", "range_", "(_", "1_", ",_", "255_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "subnet_", "=_", "\"", "10.", "0.", "1", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "os", "\\u", "template_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "description_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Calls", " ", "vz", "ctl", " ", "create", " ", " ", "to", " ", "create", " ", "a", " ", "new", " ", "Open", "VZ", " ", "container", " ", "with", " ", "an", " ", "id", " ", "in", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "give", "n", " ", "range", ".", " ", "If", "f", " ", "an", " ", "avail", "able", " ", "id", " ", "coul", "d", " ", "not", " ", "be", " ", "found", " ", "a", " ", "Run", "time", "Error", " ", "is", "\\", "10", ";", " ", " ", " ", " ", "raise", "d", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "id", " ", "of", " ", "the", " ", "newl", "y", " ", "created", " ", "container", " ", "is", " ", "return", "ed", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Thi", "s", " ", "function", " ", "blocks", " ", "unti", "l", " ", "the", " ", "container", " ", "is", " ", "full", "y", " ", "created", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Get", " ", "a", " ", "set", " ", "of", " ", "all", " ", "the", " ", "ext", "ant", " ", "contain", "es_", "\\u\\u\\uNL\\u\\u\\u_", "containers_", "=_", "set_", "(_", "get", "\\u", "containers_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Fin", "d", " ", "an", " ", "avail", "able", " ", "ID_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "i_", "in_", "id", "\\u", "range_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "i_", "not_", "in_", "containers_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "id_", "=_", "i_", "\\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 ", " _", "raise_", "Run", "time", "Error_", "(_", "\"", "Cou", "ld", " ", "not", " ", "find", " ", "avail", "able", "VM", " ", "ID", " ", "in", " ", "permi", "ssa", "ble", " ", "range", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"[", "%", "s", ",", " ", "%", "s", "].", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "%_", "(_", "config_", "._", "getint_", "(_", "\"", "Creat", "e", "Containe", "r", "\"_", ",_", "\"", "idm", "in", "\"_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Hold", "s", " ", "addition", "al", " ", "parameter", "s", " ", "tha", "t", " ", "will", " ", "be", " ", "pass", "ed", " ", "to", " ", "vz", "ctl", " ", "create_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "parameters_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "subnet_", "!=_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "parameters_", "+=_", "[_", "\"--", "ipadd", "\"_", ",_", "subnet_", "+_", "\".\"_", "+_", "str_", "(_", "id_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "os", "\\u", "template_", "!=_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "parameters_", "+=_", "[_", "\"--", "ost", "empla", "te", "\"_", ",_", "os", "\\u", "template_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "description_", "!=_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "parameters_", "+=_", "[_", "\"--", "description", "\"_", ",_", "description_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Actual", "ly", " ", "call", " ", "vz", "ctl", " ", "to", " ", "create", " ", "the", " ", "container_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "run", "\\u", "vz", "ctl_", "(_", "[_", "\"", "create", "\"_", ",_", "str_", "(_", "id_", ")_", "]_", "+_", "parameters_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "id_", "\\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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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 ]
Unused import
clione/django-kanban/src/core/userena/admin.py
[ { "content": "from django.contrib import admin\nfrom django.contrib.auth.admin import UserAdmin\nfrom django.utils.translation import ugettext as _\nfrom guardian.admin import GuardedModelAdmin\n\nfrom userena.models import UserenaSignup\nfrom userena.utils import get_profile_model, get_user_model\n\n\n\nadmin.site.unregister(get_user_model())\nadmin.site.register(get_user_model(), UserenaAdmin)\nadmin.site.register(get_profile_model())\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class UserenaSignupInline(admin.StackedInline):\n model = UserenaSignup\n max_num = 1", "metadata": "root.UserenaSignupInline", "header": "['module', '___EOS___']", "index": 8 }, { "content": "class UserenaAdmin(UserAdmin, GuardedModelAdmin):\n inlines = [UserenaSignupInline, ]\n list_display = ('username', 'email', 'first_name', 'last_name',\n 'is_staff', 'is_active', 'date_joined')\n list_filter = ('is_staff', 'is_superuser', 'is_active')", "metadata": "root.UserenaAdmin", "header": "['module', '___EOS___']", "index": 12 } ]
[]
[]
0
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_", "._", "contrib_", "._", "auth_", "._", "admin_", "import_", "User", "Admin_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "utils_", "._", "translation_", "import_", "ugettext_", "as_", "\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "guard", "ian_", "._", "admin_", "import_", "Guard", "ed", "Model", "Admin_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "user", "ena", "_", "._", "models_", "import_", "User", "ena", "Sign", "up_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "user", "ena", "_", "._", "utils_", "import_", "get", "\\u", "profile", "\\u", "model_", ",_", "get", "\\u", "user", "\\u", "model_", "\\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_", "admin_", "._", "site_", "._", "unregister_", "(_", "get", "\\u", "user", "\\u", "model_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "admin_", "._", "site_", "._", "register_", "(_", "get", "\\u", "user", "\\u", "model_", "(_", ")_", ",_", "User", "ena", "Admin_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "admin_", "._", "site_", "._", "register_", "(_", "get", "\\u", "profile", "\\u", "model_", "(_", ")_", ")_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "User", "ena", "Sign", "up", "Inline_", "(_", "admin_", "._", "Stack", "ed", "Inline_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "model_", "=_", "User", "ena", "Sign", "up_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "max", "\\u", "num_", "=_", "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_", "class_", "User", "ena", "Admin_", "(_", "User", "Admin_", ",_", "Guard", "ed", "Model", "Admin_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "inlines_", "=_", "[_", "User", "ena", "Sign", "up", "Inline_", ",_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "list", "\\u", "display_", "=_", "(_", "'", "user", "name", "'_", ",_", "'", "email", "'_", ",_", "'", "first", "\\u", "name", "'_", ",_", "'", "last", "\\u", "name", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "is", "\\u", "sta", "ff", "'_", ",_", "'", "is", "\\u", "active", "'_", ",_", "'", "date", "\\u", "joine", "d", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "list", "\\u", "filter_", "=_", "(_", "'", "is", "\\u", "sta", "ff", "'_", ",_", "'", "is", "\\u", "super", "user", "'_", ",_", "'", "is", "\\u", "active", "'_", ")_", "\\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, 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, 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 ]
Unused import
jleclanche/django-push-notifications/push_notifications/fields.py
[ { "content": "import re\nimport struct\nfrom django import forms\nfrom django.core.validators import MaxValueValidator\nfrom django.core.validators import MinValueValidator\nfrom django.core.validators import RegexValidator\nfrom django.db import models, connection\nfrom django.utils import six\nfrom django.utils.translation import ugettext_lazy as _\n\nUNSIGNED_64BIT_INT_MIN_VALUE = 0\nUNSIGNED_64BIT_INT_MAX_VALUE = 2 ** 64 - 1\n\n__all__ = [\"HexadecimalField\", \"HexIntegerField\"]\n\n\nhex_re = re.compile(r\"^(([0-9A-f])|(0x[0-9A-f]))+$\")\nsigned_integer_engines = [\n\t\"django.db.backends.postgresql_psycopg2\",\n\t\"django.contrib.gis.db.backends.postgis\",\n\t\"django.db.backends.sqlite3\"\n]\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def _using_signed_storage():\n\treturn connection.settings_dict[\"ENGINE\"] in signed_integer_engines", "metadata": "root._using_signed_storage", "header": "['module', '___EOS___']", "index": 24 }, { "content": "def _signed_to_unsigned_integer(value):\n\treturn struct.unpack(\"Q\", struct.pack(\"q\", value))[0]", "metadata": "root._signed_to_unsigned_integer", "header": "['module', '___EOS___']", "index": 28 }, { "content": "def _unsigned_to_signed_integer(value):\n\treturn struct.unpack(\"q\", struct.pack(\"Q\", value))[0]", "metadata": "root._unsigned_to_signed_integer", "header": "['module', '___EOS___']", "index": 32 }, { "content": "def _hex_string_to_unsigned_integer(value):\n\treturn int(value, 16)", "metadata": "root._hex_string_to_unsigned_integer", "header": "['module', '___EOS___']", "index": 36 }, { "content": "def _unsigned_integer_to_hex_string(value):\n\treturn hex(value).rstrip(\"L\")", "metadata": "root._unsigned_integer_to_hex_string", "header": "['module', '___EOS___']", "index": 40 }, { "content": "class HexadecimalField(forms.CharField):\n\t\"\"\"\n\tA form field that accepts only hexadecimal numbers\n\t\"\"\"\n", "metadata": "root.HexadecimalField", "header": "['module', '___EOS___']", "index": 44 }, { "content": "\tdef __init__(self, *args, **kwargs):\n\t\tself.default_validators = [RegexValidator(hex_re, _(\"Enter a valid hexadecimal number\"), \"invalid\")]\n\t\tsuper(HexadecimalField, self).__init__(*args, **kwargs)", "metadata": "root.HexadecimalField.__init__", "header": "['class', 'HexadecimalField', '(', 'forms', '.', 'CharField', ')', ':', '___EOS___']", "index": 48 }, { "content": "\tdef prepare_value(self, value):\n\t\t# converts bigint from db to hex before it is displayed in admin\n\t\tif value and not isinstance(value, six.string_types) \\\n\t\t\tand connection.vendor in (\"mysql\", \"sqlite\"):\n\t\t\tvalue = _unsigned_integer_to_hex_string(value)\n\t\treturn super(forms.CharField, self).prepare_value(value)", "metadata": "root.HexadecimalField.prepare_value", "header": "['class', 'HexadecimalField', '(', 'forms', '.', 'CharField', ')', ':', '___EOS___']", "index": 52 }, { "content": "class HexIntegerField(models.BigIntegerField):\n\t\"\"\"\n\tThis field stores a hexadecimal *string* of up to 64 bits as an unsigned integer\n\ton *all* backends including postgres.\n\n\tReasoning: Postgres only supports signed bigints. Since we don't care about\n\tsignedness, we store it as signed, and cast it to unsigned when we deal with\n\tthe actual value (with struct)\n\n\tOn sqlite and mysql, native unsigned bigint types are used. In all cases, the\n\tvalue we deal with in python is always in hex.\n\t\"\"\"\n\n\tvalidators = [\n\t\tMinValueValidator(UNSIGNED_64BIT_INT_MIN_VALUE),\n\t\tMaxValueValidator(UNSIGNED_64BIT_INT_MAX_VALUE)\n\t]\n\n\n\n\n\n", "metadata": "root.HexIntegerField", "header": "['module', '___EOS___']", "index": 60 }, { "content": "\tdef db_type(self, connection):\n\t\tengine = connection.settings_dict[\"ENGINE\"]\n\t\tif \"mysql\" in engine:\n\t\t\treturn \"bigint unsigned\"\n\t\telif \"sqlite\" in engine:\n\t\t\treturn \"UNSIGNED BIG INT\"\n\t\telse:\n\t\t\treturn super(HexIntegerField, self).db_type(connection=connection)", "metadata": "root.HexIntegerField.db_type", "header": "['class', 'HexIntegerField', '(', 'models', '.', 'BigIntegerField', ')', ':', '___EOS___']", "index": 78 }, { "content": "\tdef get_prep_value(self, value):\n\t\t\"\"\" Return the integer value to be stored from the hex string \"\"\"\n\t\tif value is None or value == \"\":\n\t\t\treturn None\n\t\tif isinstance(value, six.string_types):\n\t\t\tvalue = _hex_string_to_unsigned_integer(value)\n\t\tif _using_signed_storage():\n\t\t\tvalue = _unsigned_to_signed_integer(value)\n\t\treturn value", "metadata": "root.HexIntegerField.get_prep_value", "header": "['class', 'HexIntegerField', '(', 'models', '.', 'BigIntegerField', ')', ':', '___EOS___']", "index": 87 }, { "content": "\tdef from_db_value(self, value, expression, connection, context):\n\t\t\"\"\" Return an unsigned int representation from all db backends \"\"\"\n\t\tif value is None:\n\t\t\treturn value\n\t\tif _using_signed_storage():\n\t\t\tvalue = _signed_to_unsigned_integer(value)\n\t\treturn value", "metadata": "root.HexIntegerField.from_db_value", "header": "['class', 'HexIntegerField', '(', 'models', '.', 'BigIntegerField', ')', ':', '___EOS___']", "index": 97 }, { "content": "\tdef to_python(self, value):\n\t\t\"\"\" Return a str representation of the hexadecimal \"\"\"\n\t\tif isinstance(value, six.string_types):\n\t\t\treturn value\n\t\tif value is None:\n\t\t\treturn value\n\t\treturn _unsigned_integer_to_hex_string(value)", "metadata": "root.HexIntegerField.to_python", "header": "['class', 'HexIntegerField', '(', 'models', '.', 'BigIntegerField', ')', ':', '___EOS___']", "index": 105 }, { "content": "\tdef formfield(self, **kwargs):\n\t\tdefaults = {\"form_class\": HexadecimalField}\n\t\tdefaults.update(kwargs)\n\t\t# yes, that super call is right\n\t\treturn super(models.IntegerField, self).formfield(**defaults)", "metadata": "root.HexIntegerField.formfield", "header": "['class', 'HexIntegerField', '(', 'models', '.', 'BigIntegerField', ')', ':', '___EOS___']", "index": 113 }, { "content": "\tdef run_validators(self, value):\n\t\t# make sure validation is performed on integer value not string value\n\t\tvalue = _hex_string_to_unsigned_integer(value)\n\t\treturn super(models.BigIntegerField, self).run_validators(value)", "metadata": "root.HexIntegerField.run_validators", "header": "['class', 'HexIntegerField', '(', 'models', '.', 'BigIntegerField', ')', ':', '___EOS___']", "index": 119 } ]
[]
[]
0
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "import_", "re_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "struct_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "import_", "forms_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "core_", "._", "validators_", "import_", "Max", "Value", "Validator_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "core_", "._", "validators_", "import_", "Min", "Value", "Validator_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "core_", "._", "validators_", "import_", "Rege", "x", "Validator_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "db_", "import_", "models_", ",_", "connection_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "utils_", "import_", "six_", "\\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_", "UNSIGNED", "\\u", "64", "BIT", "\\u", "INT", "\\u", "MIN", "\\u", "VALUE_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "UNSIGNED", "\\u", "64", "BIT", "\\u", "INT", "\\u", "MAX", "\\u", "VALUE_", "=_", "2_", "**_", "64_", "-_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u", "all\\u\\u_", "=_", "[_", "\"", "Hex", "ade", "cim", "al", "Field", "\"_", ",_", "\"", "Hex", "Integer", "Field", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "hex", "\\u", "re_", "=_", "re_", "._", "compile_", "(_", "r", "\"", "^", "(([", "0", "-", "9", "A", "-", "f", "])", "|(", "0", "x", "[", "0", "-", "9", "A", "-", "f", "]))", "+$", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sign", "ed", "\\u", "integ", "er", "\\u", "engines_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "django", ".", "db", ".", "back", "ends", ".", "postgres", "ql", "\\u", "psy", "cop", "g2", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "django", ".", "contrib", ".", "gi", "s", ".", "db", ".", "back", "ends", ".", "post", "gi", "s", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "django", ".", "db", ".", "back", "ends", ".", "sql", "ite", "3", "\"_", "\\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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u", "usi", "ng", "\\u", "sign", "ed", "\\u", "storage_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "_", "return_", "connection_", "._", "settings", "\\u", "dict_", "[_", "\"", "ENGINE", "\"_", "]_", "in_", "sign", "ed", "\\u", "integ", "er", "\\u", "engines_", "\\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_", "\\u", "sign", "ed", "\\u", "to", "\\u", "unsigned", "\\u", "integer_", "(_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "_", "return_", "struct_", "._", "unpack_", "(_", "\"", "Q", "\"_", ",_", "struct_", "._", "pack_", "(_", "\"", "q", "\"_", ",_", "value_", ")_", ")_", "[_", "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_", "\\u", "unsigned", "\\u", "to", "\\u", "sign", "ed", "\\u", "integer_", "(_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "_", "return_", "struct_", "._", "unpack_", "(_", "\"", "q", "\"_", ",_", "struct_", "._", "pack_", "(_", "\"", "Q", "\"_", ",_", "value_", ")_", ")_", "[_", "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_", "\\u", "hex", "\\u", "string", "\\u", "to", "\\u", "unsigned", "\\u", "integer_", "(_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "_", "return_", "int_", "(_", "value_", ",_", "16_", ")_", "\\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_", "\\u", "unsigned", "\\u", "integ", "er", "\\u", "to", "\\u", "hex", "\\u", "string_", "(_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "_", "return_", "hex_", "(_", "value_", ")_", "._", "rstrip_", "(_", "\"", "L", "\"_", ")_", "\\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_", "Hex", "ade", "cim", "al", "Field_", "(_", "forms_", "._", "Char", "Field_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "_", "\"\"\"", "\\", "10", ";", "\t", "A", " ", "form", " ", "field", " ", "tha", "t", " ", "accepts", " ", "only", " ", "hexadec", "imal", " ", "numbers", "\\", "10", ";", "\t", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Hex", "ade", "cim", "al", "Field_", "(_", "forms_", "._", "Char", "Field_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "*_", "args_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "self_", "._", "default", "\\u", "validators_", "=_", "[_", "Rege", "x", "Validator_", "(_", "hex", "\\u", "re_", ",_", "\\u_", "(_", "\"", "Enter", " ", "a", " ", "valid", " ", "hexadec", "imal", " ", "number", "\"_", ")_", ",_", "\"", "invalid", "\"_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "super_", "(_", "Hex", "ade", "cim", "al", "Field_", ",_", "self_", ")_", "._", "\\u\\u", "init\\u\\u_", "(_", "*_", "args_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Hex", "ade", "cim", "al", "Field_", "(_", "forms_", "._", "Char", "Field_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "prepar", "e\\u", "value_", "(_", "self_", ",_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "convert", "s", " ", "bigin", "t", " ", "from", " ", "db", " ", "to", " ", "hex", " ", "bef", "ore", " ", "it", " ", "is", " ", "displaye", "d", " ", "in", " ", "admin_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "if_", "value_", "and_", "not_", "isinstance_", "(_", "value_", ",_", "six_", "._", "string", "\\u", "types_", ")_", "and_", "connection_", "._", "vendor_", "in_", "(_", "\"", "mysql", "\"_", ",_", "\"", "sql", "ite", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "value_", "=_", "\\u", "unsigned", "\\u", "integ", "er", "\\u", "to", "\\u", "hex", "\\u", "string_", "(_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "super_", "(_", "forms_", "._", "Char", "Field_", ",_", "self_", ")_", "._", "prepar", "e\\u", "value_", "(_", "value_", ")_", "\\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_", "Hex", "Integer", "Field_", "(_", "models_", "._", "Big", "Integer", "Field_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "_", "\"\"\"", "\\", "10", ";", "\t", "Thi", "s", " ", "field", " ", "store", "s", " ", "a", " ", "hexadec", "imal", " ", "*", "string", "*", " ", "of", " ", "up", " ", "to", " ", "64", " ", "bits", " ", "as", " ", "an", " ", "unsigned", " ", "integ", "er", "\\", "10", ";", "\t", "on", " ", "*", "all", "*", " ", "back", "ends", " ", "inclu", "ding", " ", "postgres", ".", "\\", "10", ";", "\\", "10", ";", "\t", "Rea", "son", "ing", ":", " ", "Post", "gres", " ", "only", " ", "support", "s", " ", "sign", "ed", " ", "bigin", "ts", ".", " ", "Sin", "ce", " ", "we", " ", "don", "'", "t", " ", "care", " ", "abo", "ut", "\\", "10", ";", "\t", "sign", "edn", "ess", ",", " ", "we", " ", "store", " ", "it", " ", "as", " ", "sign", "ed", ",", " ", "and", " ", "cast", " ", "it", " ", "to", " ", "unsigned", " ", "whe", "n", " ", "we", " ", "deal", " ", "with", "\\", "10", ";", "\t", "the", " ", "actual", " ", "value", " ", "(", "with", " ", "struct", ")", "\\", "10", ";", "\\", "10", ";", "\t", "On", " ", "sql", "ite", " ", "and", " ", "mysql", ",", " ", "nativ", "e", " ", "unsigned", " ", "bigin", "t", " ", "types", " ", "are", " ", "used", ".", " ", "In", " ", "all", " ", "case", "s", ",", " ", "the", "\\", "10", ";", "\t", "value", " ", "we", " ", "deal", " ", "with", " ", "in", " ", "python", " ", "is", " ", "alw", "ay", "s", " ", "in", " ", "hex", ".", "\\", "10", ";", "\t", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "validators_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "Min", "Value", "Validator_", "(_", "UNSIGNED", "\\u", "64", "BIT", "\\u", "INT", "\\u", "MIN", "\\u", "VALUE_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Max", "Value", "Validator_", "(_", "UNSIGNED", "\\u", "64", "BIT", "\\u", "INT", "\\u", "MAX", "\\u", "VALUE_", ")_", "\\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_", "Hex", "Integer", "Field_", "(_", "models_", "._", "Big", "Integer", "Field_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "db", "\\u", "type_", "(_", "self_", ",_", "connection_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "engine_", "=_", "connection_", "._", "settings", "\\u", "dict_", "[_", "\"", "ENGINE", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "\"", "mysql", "\"_", "in_", "engine_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "return_", "\"", "bigin", "t", " ", "unsigned", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "\"", "sql", "ite", "\"_", "in_", "engine_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "return_", "\"", "UNSIGNED", " ", "BIG", " ", "INT", "\"_", "\\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_", "return_", "super_", "(_", "Hex", "Integer", "Field_", ",_", "self_", ")_", "._", "db", "\\u", "type_", "(_", "connection_", "=_", "connection_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Hex", "Integer", "Field_", "(_", "models_", "._", "Big", "Integer", "Field_", ")_", ":_", "\\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", "prep", "\\u", "value_", "(_", "self_", ",_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "\"\"\"", " ", "Return", " ", "the", " ", "integ", "er", " ", "value", " ", "to", " ", "be", " ", "store", "d", " ", "from", " ", "the", " ", "hex", " ", "string", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "value_", "is_", "None_", "or_", "value_", "==_", "\"\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "return_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "isinstance_", "(_", "value_", ",_", "six_", "._", "string", "\\u", "types_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "value_", "=_", "\\u", "hex", "\\u", "string", "\\u", "to", "\\u", "unsigned", "\\u", "integer_", "(_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "\\u", "usi", "ng", "\\u", "sign", "ed", "\\u", "storage_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "value_", "=_", "\\u", "unsigned", "\\u", "to", "\\u", "sign", "ed", "\\u", "integer_", "(_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Hex", "Integer", "Field_", "(_", "models_", "._", "Big", "Integer", "Field_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "from", "\\u", "db", "\\u", "value_", "(_", "self_", ",_", "value_", ",_", "expression_", ",_", "connection_", ",_", "context_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "\"\"\"", " ", "Return", " ", "an", " ", "unsigned", " ", "int", " ", "represent", "ation", " ", "from", " ", "all", " ", "db", " ", "back", "ends", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "value_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "return_", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "\\u", "usi", "ng", "\\u", "sign", "ed", "\\u", "storage_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "value_", "=_", "\\u", "sign", "ed", "\\u", "to", "\\u", "unsigned", "\\u", "integer_", "(_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Hex", "Integer", "Field_", "(_", "models_", "._", "Big", "Integer", "Field_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "to", "\\u", "python_", "(_", "self_", ",_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "\"\"\"", " ", "Return", " ", "a", " ", "str", " ", "represent", "ation", " ", "of", " ", "the", " ", "hexadec", "imal", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "isinstance_", "(_", "value_", ",_", "six_", "._", "string", "\\u", "types_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "return_", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "value_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "return_", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "\\u", "unsigned", "\\u", "integ", "er", "\\u", "to", "\\u", "hex", "\\u", "string_", "(_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Hex", "Integer", "Field_", "(_", "models_", "._", "Big", "Integer", "Field_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "formfi", "eld_", "(_", "self_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "defaults_", "=_", "{_", "\"", "form", "\\u", "class", "\"_", ":_", "Hex", "ade", "cim", "al", "Field_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "defaults_", "._", "update_", "(_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "ye", "s", ",", " ", "tha", "t", " ", "super", " ", "call", " ", "is", " ", "right_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "super_", "(_", "models_", "._", "Integer", "Field_", ",_", "self_", ")_", "._", "formfi", "eld_", "(_", "**_", "defaults_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Hex", "Integer", "Field_", "(_", "models_", "._", "Big", "Integer", "Field_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "run", "\\u", "validators_", "(_", "self_", ",_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "make", " ", "sure", " ", "validation", " ", "is", " ", "perform", "ed", " ", "on", " ", "integ", "er", " ", "value", " ", "not", " ", "string", " ", "value_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "value_", "=_", "\\u", "hex", "\\u", "string", "\\u", "to", "\\u", "unsigned", "\\u", "integer_", "(_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "super_", "(_", "models_", "._", "Big", "Integer", "Field_", ",_", "self_", ")_", "._", "run", "\\u", "validators_", "(_", "value_", ")_" ]
[ 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, 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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Platform/python-compat-runtime/appengine-compat/exported_appengine_sdk/google/appengine/api/xmpp/xmpp_service_pb.py
[ { "content": " def Equals(self, x):\n if x is self: return 1\n if len(self.jid_) != len(x.jid_): return 0\n for e1, e2 in zip(self.jid_, x.jid_):\n if e1 != e2: return 0\n if self.has_body_ != x.has_body_: return 0\n if self.has_body_ and self.body_ != x.body_: return 0\n if self.has_raw_xml_ != x.has_raw_xml_: return 0\n if self.has_raw_xml_ and self.raw_xml_ != x.raw_xml_: return 0\n if self.has_type_ != x.has_type_: return 0\n if self.has_type_ and self.type_ != x.type_: return 0\n if self.has_from_jid_ != x.has_from_jid_: return 0\n if self.has_from_jid_ and self.from_jid_ != x.from_jid_: return 0\n return 1", "metadata": "root.XmppMessageRequest.Equals", "header": "['class', 'XmppMessageRequest', '(', 'ProtocolBuffer', '.', 'ProtocolMessage', ')', ':', '___EOS___']", "index": 790 } ]
[]
[]
0
true
[ "[CLS]_", "Compari", "son_", "of_", "constants_", "[SEP]_", "class_", "Xm", "pp", "Messag", "e", "Request_", "(_", "Proto", "col", "Buffer_", "._", "Proto", "col", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Equals_", "(_", "self_", ",_", "x_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "x_", "is_", "self_", ":_", "return_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "len_", "(_", "self_", "._", "ji", "d\\u", "_", ")_", "!=_", "len_", "(_", "x_", "._", "ji", "d\\u", "_", ")_", ":_", "return_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "e1_", ",_", "e2_", "in_", "zip_", "(_", "self_", "._", "ji", "d\\u", "_", ",_", "x_", "._", "ji", "d\\u", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "e1_", "!=_", "e2_", ":_", "return_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "has", "\\u", "body", "\\u_", "!=_", "x_", "._", "has", "\\u", "body", "\\u_", ":_", "return_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "has", "\\u", "body", "\\u_", "and_", "self_", "._", "body", "\\u_", "!=_", "x_", "._", "body", "\\u_", ":_", "return_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "has", "\\u", "raw", "\\u", "xml", "\\u_", "!=_", "x_", "._", "has", "\\u", "raw", "\\u", "xml", "\\u_", ":_", "return_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "has", "\\u", "raw", "\\u", "xml", "\\u_", "and_", "self_", "._", "raw", "\\u", "xml", "\\u_", "!=_", "x_", "._", "raw", "\\u", "xml", "\\u_", ":_", "return_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "has", "\\u", "type\\u_", "!=_", "x_", "._", "has", "\\u", "type\\u_", ":_", "return_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "has", "\\u", "type\\u_", "and_", "self_", "._", "type\\u_", "!=_", "x_", "._", "type\\u_", ":_", "return_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "has", "\\u", "from", "\\u", "ji", "d\\u", "_", "!=_", "x_", "._", "has", "\\u", "from", "\\u", "ji", "d\\u", "_", ":_", "return_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "has", "\\u", "from", "\\u", "ji", "d\\u", "_", "and_", "self_", "._", "from", "\\u", "ji", "d\\u", "_", "!=_", "x_", "._", "from", "\\u", "ji", "d\\u", "_", ":_", "return_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "1_", "\\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 ]
Unreachable code
circus-tent/circus/circus/tests/test_circusd.py
[ { "content": " @skipIf('TRAVIS' in os.environ, 'Travis detected')\n @skipIf(not has_gevent(), \"Only when Gevent is loaded\")\n def test_daemon(self):\n # if gevent is loaded, we want to prevent\n # daemonize() to work\n self.assertRaises(ValueError, daemonize)\n\n for module in sys.modules.keys():\n if module.startswith('gevent'):\n del sys.modules[module]\n\n import gevent\n sys.modules['gevent'] = gevent\n self.assertRaises(ValueError, daemonize)", "metadata": "root.TestCircusd.test_daemon", "header": "['class', 'TestCircusd', '(', 'TestCase', ')', ':', '___EOS___']", "index": 79 } ]
[]
[]
0
true
[ "[CLS]_", "Unrea", "chab", "le_", "code_", "[SEP]_", "class_", "Test", "Circ", "usd", "_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "skip", "If_", "(_", "'", "TRAV", "IS", "'_", "in_", "os_", "._", "environ_", ",_", "'", "Tra", "vis", " ", "detect", "ed", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "skip", "If_", "(_", "not_", "has", "\\u", "gevent_", "(_", ")_", ",_", "\"", "On", "ly", " ", "whe", "n", " ", "Ge", "vent", " ", "is", " ", "load", "ed", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "daemon_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "if", " ", "gev", "ent", " ", "is", " ", "load", "ed", ",", " ", "we", " ", "want", " ", "to", " ", "prevent", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "daemon", "ize", "()", " ", "to", " ", "work_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "Raises_", "(_", "Value", "Error_", ",_", "daemon", "ize_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "module_", "in_", "sys_", "._", "modules_", "._", "keys_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "module_", "._", "startswith_", "(_", "'", "gev", "ent", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "del_", "sys_", "._", "modules_", "[_", "module_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "import_", "gevent_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "modules_", "[_", "'", "gev", "ent", "'_", "]_", "=_", "gevent_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Raises_", "(_", "Value", "Error_", ",_", "daemon", "ize_", ")_", "\\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 ]
Testing equality to None
stamparm/maltrail/core/httpd.py
[ { "content": "def start_httpd(address=None, port=None, join=False, pem=None):\n \"\"\"\n Starts HTTP server\n \"\"\"\n\n class ThreadingServer(SocketServer.ThreadingMixIn, BaseHTTPServer.HTTPServer):\n def server_bind(self):\n self.socket.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)\n BaseHTTPServer.HTTPServer.server_bind(self)\n\n def finish_request(self, *args, **kwargs):\n try:\n BaseHTTPServer.HTTPServer.finish_request(self, *args, **kwargs)\n except:\n if config.SHOW_DEBUG:\n traceback.print_exc()\n\n class SSLThreadingServer(ThreadingServer):\n def __init__(self, server_address, pem, HandlerClass):\n import OpenSSL # python-openssl\n\n ThreadingServer.__init__(self, server_address, HandlerClass)\n ctx = OpenSSL.SSL.Context(OpenSSL.SSL.TLSv1_METHOD)\n ctx.use_privatekey_file(pem)\n ctx.use_certificate_file(pem)\n self.socket = OpenSSL.SSL.Connection(ctx, socket.socket(self.address_family, self.socket_type))\n self.server_bind()\n self.server_activate()\n\n def shutdown_request(self, request):\n try:\n request.shutdown()\n except:\n if config.SHOW_DEBUG:\n traceback.print_exc()\n\n class ReqHandler(BaseHTTPServer.BaseHTTPRequestHandler):\n def do_GET(self):\n path, query = self.path.split('?', 1) if '?' in self.path else (self.path, \"\")\n params = {}\n content = None\n skip = False\n\n if hasattr(self, \"data\"):\n params.update(urlparse.parse_qs(self.data))\n\n if query:\n params.update(urlparse.parse_qs(query))\n\n for key in params:\n if params[key]:\n params[key] = params[key][-1]\n\n if path == '/':\n path = \"index.html\"\n\n path = path.strip('/')\n extension = os.path.splitext(path)[-1].lower()\n\n if hasattr(self, \"_%s\" % path):\n content = getattr(self, \"_%s\" % path)(params)\n\n else:\n path = path.replace('/', os.path.sep)\n path = os.path.abspath(os.path.join(HTML_DIR, path)).strip()\n\n if not os.path.isfile(path) and os.path.isfile(\"%s.html\" % path):\n path = \"%s.html\" % path\n\n if \"..\" not in os.path.relpath(path, HTML_DIR) and os.path.isfile(path) and (extension not in DISABLED_CONTENT_EXTENSIONS or os.path.split(path)[-1] in CONTENT_EXTENSIONS_EXCLUSIONS):\n mtime = time.gmtime(os.path.getmtime(path))\n if_modified_since = self.headers.get(HTTP_HEADER.IF_MODIFIED_SINCE)\n\n if if_modified_since and extension not in (\".htm\", \".html\"):\n if_modified_since = [_ for _ in if_modified_since.split(';') if _.upper().endswith(\"GMT\")][0]\n if time.mktime(mtime) <= time.mktime(time.strptime(if_modified_since, HTTP_TIME_FORMAT)):\n self.send_response(httplib.NOT_MODIFIED)\n self.send_header(HTTP_HEADER.CONNECTION, \"close\")\n skip = True\n\n if not skip:\n content = open(path, \"rb\").read()\n last_modified = time.strftime(HTTP_TIME_FORMAT, mtime)\n self.send_response(httplib.OK)\n self.send_header(HTTP_HEADER.CONNECTION, \"close\")\n self.send_header(HTTP_HEADER.CONTENT_TYPE, mimetypes.guess_type(path)[0] or \"application/octet-stream\")\n self.send_header(HTTP_HEADER.LAST_MODIFIED, last_modified)\n if extension not in (\".htm\", \".html\"):\n self.send_header(HTTP_HEADER.EXPIRES, \"Sun, 17-Jan-2038 19:14:07 GMT\") # Reference: http://blog.httpwatch.com/2007/12/10/two-simple-rules-for-http-caching/\n self.send_header(HTTP_HEADER.CACHE_CONTROL, \"max-age=3600, must-revalidate\") # Reference: http://stackoverflow.com/a/5084555\n else:\n self.send_header(HTTP_HEADER.CACHE_CONTROL, \"no-cache\")\n\n else:\n self.send_response(httplib.NOT_FOUND)\n self.send_header(HTTP_HEADER.CONNECTION, \"close\")\n content = '<!DOCTYPE html><html lang=\"en\"><head><title>404 Not Found</title></head><body><h1>Not Found</h1><p>The requested URL %s was not found on this server.</p></body></html>' % self.path.split('?')[0]\n\n if content is not None:\n for match in re.finditer(r\"<\\!(\\w+)\\!>\", content):\n name = match.group(1)\n _ = getattr(self, \"_%s\" % name.lower(), None)\n if _:\n content = self._format(content, **{ name: _() })\n\n if \"gzip\" in self.headers.getheader(HTTP_HEADER.ACCEPT_ENCODING, \"\"):\n self.send_header(HTTP_HEADER.CONTENT_ENCODING, \"gzip\")\n _ = cStringIO.StringIO()\n compress = gzip.GzipFile(\"\", \"w+b\", 9, _)\n compress._stream = _\n compress.write(content)\n compress.flush()\n compress.close()\n content = compress._stream.getvalue()\n\n self.send_header(HTTP_HEADER.CONTENT_LENGTH, str(len(content)))\n\n self.end_headers()\n\n if content:\n self.wfile.write(content)\n\n self.wfile.flush()\n self.wfile.close()\n\n def do_POST(self):\n length = self.headers.getheader(HTTP_HEADER.CONTENT_LENGTH)\n data = self.rfile.read(int(length))\n data = urllib.unquote_plus(data)\n self.data = data\n self.do_GET()\n\n def get_session(self):\n retval = None\n cookie = self.headers.get(HTTP_HEADER.COOKIE)\n\n if cookie:\n match = re.search(r\"%s\\s*=\\s*([^;]+)\" % SESSION_COOKIE_NAME, cookie)\n if match:\n session = match.group(1)\n if session in SESSIONS:\n if SESSIONS[session].client_ip != self.client_address[0]:\n pass\n elif SESSIONS[session].expiration > time.time():\n retval = SESSIONS[session]\n else:\n del SESSIONS[session]\n\n return retval\n\n def delete_session(self):\n cookie = self.headers.get(HTTP_HEADER.COOKIE)\n\n if cookie:\n match = re.search(r\"%s=(.+)\" % SESSION_COOKIE_NAME, cookie)\n if match:\n session = match.group(1)\n if session in SESSIONS:\n del SESSIONS[session]\n\n def version_string(self):\n return SERVER_HEADER\n\n def end_headers(self):\n if not hasattr(self, \"_headers_ended\"):\n BaseHTTPServer.BaseHTTPRequestHandler.end_headers(self)\n self._headers_ended = True\n\n def log_message(self, format, *args):\n return\n\n def finish(self):\n try:\n BaseHTTPServer.BaseHTTPRequestHandler.finish(self)\n except:\n if config.SHOW_DEBUG:\n traceback.print_exc()\n\n def _version(self):\n return VERSION\n\n def _format(self, content, **params):\n if content:\n for key, value in params.items():\n content = content.replace(\"<!%s!>\" % key, value)\n\n return content\n\n def _login(self, params):\n valid = False\n\n if params.get(\"username\") and params.get(\"hash\") and params.get(\"nonce\"):\n if params.get(\"nonce\") not in DISPOSED_NONCES:\n DISPOSED_NONCES.add(params.get(\"nonce\"))\n for entry in (config.USERS or []):\n entry = re.sub(r\"\\s\", \"\", entry)\n username, stored_hash, uid, netfilter = entry.split(':')\n if username == params.get(\"username\"):\n try:\n if params.get(\"hash\") == hashlib.sha256(stored_hash.strip() + params.get(\"nonce\")).hexdigest():\n valid = True\n break\n except:\n if config.SHOW_DEBUG:\n traceback.print_exc()\n\n if valid:\n session_id = os.urandom(SESSION_ID_LENGTH).encode(\"hex\")\n expiration = time.time() + 3600 * SESSION_EXPIRATION_HOURS\n\n self.send_response(httplib.OK)\n self.send_header(HTTP_HEADER.CONNECTION, \"close\")\n self.send_header(HTTP_HEADER.SET_COOKIE, \"%s=%s; expires=%s; path=/; HttpOnly\" % (SESSION_COOKIE_NAME, session_id, time.strftime(HTTP_TIME_FORMAT, time.gmtime(expiration))))\n\n if netfilter in (\"\", \"0.0.0.0/0\"):\n netfilters = None\n else:\n addresses = set()\n netmasks = set()\n\n for item in set(re.split(r\"[;,]\", netfilter)):\n item = item.strip()\n if '/' in item:\n _ = item.split('/')[-1]\n if _.isdigit() and int(_) >= 16:\n lower = addr_to_int(item.split('/')[0])\n mask = make_mask(int(_))\n upper = lower | (0xffffffff ^ mask)\n while lower <= upper:\n addresses.add(int_to_addr(lower))\n lower += 1\n else:\n netmasks.add(item)\n elif '-' in item:\n _ = item.split('-')\n lower, upper = addr_to_int(_[0]), addr_to_int(_[1])\n while lower <= upper:\n addresses.add(int_to_addr(lower))\n lower += 1\n elif re.search(r\"\\d+\\.\\d+\\.\\d+\\.\\d+\", item):\n addresses.add(item)\n\n netfilters = netmasks\n if addresses:\n netfilters.add(get_regex(addresses))\n\n SESSIONS[session_id] = AttribDict({\"username\": username, \"uid\": uid, \"netfilters\": netfilters, \"expiration\": expiration, \"client_ip\": self.client_address[0]})\n else:\n time.sleep(UNAUTHORIZED_SLEEP_TIME)\n self.send_response(httplib.UNAUTHORIZED)\n self.send_header(HTTP_HEADER.CONNECTION, \"close\")\n\n self.send_header(HTTP_HEADER.CONTENT_TYPE, \"text/plain\")\n content = \"Login %s\" % (\"success\" if valid else \"failed\")\n\n if not subprocess.mswindows:\n try:\n subprocess.check_output(\"logger -p auth.info -t \\\"%s[%d]\\\" \\\"%s password for %s from %s port %s\\\"\" % (NAME.lower(), os.getpid(), \"Accepted\" if valid else \"Failed\", params.get(\"username\"), self.client_address[0], self.client_address[1]), stderr=subprocess.STDOUT, shell=True)\n except Exception:\n if config.SHOW_DEBUG:\n traceback.print_exc()\n\n return content\n\n def _logout(self, params):\n self.delete_session()\n self.send_response(httplib.FOUND)\n self.send_header(HTTP_HEADER.CONNECTION, \"close\")\n self.send_header(HTTP_HEADER.LOCATION, \"/\")\n\n def _whoami(self, params):\n session = self.get_session()\n username = session.username if session else \"\"\n\n self.send_response(httplib.OK)\n self.send_header(HTTP_HEADER.CONNECTION, \"close\")\n self.send_header(HTTP_HEADER.CONTENT_TYPE, \"text/plain\")\n\n return username\n\n def _check_ip(self, params):\n session = self.get_session()\n\n if session is None:\n self.send_response(httplib.UNAUTHORIZED)\n self.send_header(HTTP_HEADER.CONNECTION, \"close\")\n return None\n\n self.send_response(httplib.OK)\n self.send_header(HTTP_HEADER.CONNECTION, \"close\")\n self.send_header(HTTP_HEADER.CONTENT_TYPE, \"text/plain\")\n\n try:\n result_worst = worst_asns(params.get(\"address\"))\n if result_worst:\n result_ipcat = result_worst\n else:\n _ = (ipcat_lookup(params.get(\"address\")) or \"\").lower().split(' ')\n result_ipcat = _[1] if _[0] == 'the' else _[0]\n return (\"%s\" if not params.get(\"callback\") else \"%s(%%s)\" % params.get(\"callback\")) % json.dumps({\"ipcat\": result_ipcat, \"worst_asns\": str(result_worst is not None).lower()})\n except:\n if config.SHOW_DEBUG:\n traceback.print_exc()\n\n def _trails(self, params):\n self.send_response(httplib.OK)\n self.send_header(HTTP_HEADER.CONNECTION, \"close\")\n self.send_header(HTTP_HEADER.CONTENT_TYPE, \"text/plain\")\n\n return open(TRAILS_FILE, \"rb\").read()\n\n def _ping(self, params):\n self.send_response(httplib.OK)\n self.send_header(HTTP_HEADER.CONNECTION, \"close\")\n self.send_header(HTTP_HEADER.CONTENT_TYPE, \"text/plain\")\n\n return PING_RESPONSE\n\n def _events(self, params):\n session = self.get_session()\n\n if session is None:\n self.send_response(httplib.UNAUTHORIZED)\n self.send_header(HTTP_HEADER.CONNECTION, \"close\")\n return None\n\n start, end, size, total = None, None, -1, None\n content = None\n event_log_path = os.path.join(config.LOG_DIR, \"%s.log\" % params.get(\"date\", \"\"))\n\n if os.path.exists(event_log_path):\n total = os.stat(event_log_path).st_size\n\n if self.headers.get(HTTP_HEADER.RANGE):\n match = re.search(r\"bytes=(\\d+)-(\\d+)\", self.headers[HTTP_HEADER.RANGE])\n if match:\n start, end = int(match.group(1)), int(match.group(2))\n max_size = end - start + 1\n end = min(total - 1, end)\n size = end - start + 1\n\n if start == 0 or not session.range_handle:\n session.range_handle = open(event_log_path, \"rb\")\n\n if session.netfilters is None:\n session.range_handle.seek(start)\n self.send_response(httplib.PARTIAL_CONTENT)\n self.send_header(HTTP_HEADER.CONNECTION, \"close\")\n self.send_header(HTTP_HEADER.CONTENT_TYPE, \"text/plain\")\n self.send_header(HTTP_HEADER.CONTENT_RANGE, \"bytes %d-%d/%d\" % (start, end, total))\n content = session.range_handle.read(size)\n else:\n self.send_response(httplib.OK)\n self.send_header(HTTP_HEADER.CONNECTION, \"close\")\n self.send_header(HTTP_HEADER.CONTENT_TYPE, \"text/plain\")\n\n buffer, addresses, netmasks, regex = cStringIO.StringIO(), set(), [], \"\"\n for netfilter in session.netfilters:\n if not netfilter:\n continue\n if '/' in netfilter:\n netmasks.append(netfilter)\n elif re.search(r\"\\A[\\d.]+\\Z\", netfilter):\n addresses.add(netfilter)\n elif '\\.' in netfilter:\n regex = r\"\\b(%s)\\b\" % netfilter\n else:\n print \"[!] invalid network filter '%s'\" % netfilter\n return\n\n for line in session.range_handle:\n display = False\n ip = None\n\n if regex:\n match = re.search(regex, line)\n if match:\n ip = match.group(1)\n display = True\n\n if not display and (addresses or netmasks):\n for match in re.finditer(r\"\\b(\\d+\\.\\d+\\.\\d+\\.\\d+)\\b\", line):\n if not display:\n ip = match.group(1)\n else:\n break\n\n if ip in addresses:\n display = True\n break\n elif netmasks:\n for _ in netmasks:\n prefix, mask = _.split('/')\n if addr_to_int(ip) & make_mask(int(mask)) == addr_to_int(prefix):\n addresses.add(ip)\n display = True\n break\n\n if display:\n if \",%s\" % ip in line or \"%s,\" % ip in line:\n line = re.sub(r\" ([\\d.,]+,)?%s(,[\\d.,]+)? \" % re.escape(ip), \" %s \" % ip, line)\n buffer.write(line)\n if buffer.tell() >= max_size:\n break\n\n content = buffer.getvalue()\n end = start + len(content) - 1\n self.send_header(HTTP_HEADER.CONTENT_RANGE, \"bytes %d-%d/%d\" % (start, end, end + 1 + max_size * (len(content) >= max_size)))\n\n if len(content) < max_size:\n session.range_handle.close()\n session.range_handle = None\n\n if size == -1:\n self.send_response(httplib.OK)\n self.send_header(HTTP_HEADER.CONNECTION, \"close\")\n self.send_header(HTTP_HEADER.CONTENT_TYPE, \"text/plain\")\n self.end_headers()\n\n with open(event_log_path, \"rb\") as f:\n while True:\n data = f.read(io.DEFAULT_BUFFER_SIZE)\n if not data:\n break\n else:\n self.wfile.write(data)\n\n else:\n self.send_response(httplib.OK) # instead of httplib.NO_CONTENT (compatibility reasons)\n self.send_header(HTTP_HEADER.CONNECTION, \"close\")\n if self.headers.get(HTTP_HEADER.RANGE):\n self.send_header(HTTP_HEADER.CONTENT_RANGE, \"bytes 0-0/0\")\n\n return content\n\n def _counts(self, params):\n counts = {}\n\n session = self.get_session()\n\n if session is None:\n self.send_response(httplib.UNAUTHORIZED)\n self.send_header(HTTP_HEADER.CONNECTION, \"close\")\n return None\n\n self.send_response(httplib.OK)\n self.send_header(HTTP_HEADER.CONNECTION, \"close\")\n self.send_header(HTTP_HEADER.CONTENT_TYPE, \"application/json\")\n\n match = re.search(r\"\\d+\\-\\d+\\-\\d+\", params.get(\"from\", \"\"))\n if match:\n min_ = datetime.datetime.strptime(match.group(0), DATE_FORMAT)\n else:\n min_ = datetime.datetime.fromtimestamp(0)\n\n match = re.search(r\"\\d+\\-\\d+\\-\\d+\", params.get(\"to\", \"\"))\n if match:\n max_ = datetime.datetime.strptime(match.group(0), DATE_FORMAT)\n else:\n max_ = datetime.datetime.now()\n\n min_ = min_.replace(hour=0, minute=0, second=0, microsecond=0)\n max_ = max_.replace(hour=23, minute=59, second=59, microsecond=999999)\n\n for filepath in sorted(glob.glob(os.path.join(config.LOG_DIR, \"*.log\"))):\n filename = os.path.basename(filepath)\n if not re.search(r\"\\A\\d{4}-\\d{2}-\\d{2}\\.log\\Z\", filename):\n continue\n try:\n current = datetime.datetime.strptime(os.path.splitext(filename)[0], DATE_FORMAT)\n except:\n if config.SHOW_DEBUG:\n traceback.print_exc()\n else:\n if min_ <= current <= max_:\n timestamp = int(time.mktime(current.timetuple()))\n size = os.path.getsize(filepath)\n with open(filepath, \"rb\") as f:\n content = f.read(io.DEFAULT_BUFFER_SIZE)\n if size >= io.DEFAULT_BUFFER_SIZE:\n total = 1.0 * content.count('\\n') * size / io.DEFAULT_BUFFER_SIZE\n counts[timestamp] = int(round(total / 100) * 100)\n else:\n counts[timestamp] = content.count('\\n')\n\n return json.dumps(counts)\n\n class SSLReqHandler(ReqHandler):\n def setup(self):\n self.connection = self.request\n self.rfile = socket._fileobject(self.request, \"rb\", self.rbufsize)\n self.wfile = socket._fileobject(self.request, \"wb\", self.wbufsize)\n\n try:\n if pem:\n server = SSLThreadingServer((address or '', int(port) if str(port or \"\").isdigit() else 0), pem, SSLReqHandler)\n else:\n server = ThreadingServer((address or '', int(port) if str(port or \"\").isdigit() else 0), ReqHandler)\n except Exception as ex:\n if \"Address already in use\" in str(ex):\n exit(\"[!] another instance already running\")\n elif \"Name or service not known\" in str(ex):\n exit(\"[!] invalid configuration value for 'HTTP_ADDRESS' ('%s')\" % config.HTTP_ADDRESS)\n elif \"Cannot assign requested address\" in str(ex):\n exit(\"[!] can't use configuration value for 'HTTP_ADDRESS' ('%s')\" % config.HTTP_ADDRESS)\n else:\n raise\n\n print \"[i] starting HTTP%s server at 'http%s://%s:%d/'\" % ('S' if pem else \"\", 's' if pem else \"\", server.server_address[0], server.server_address[1])\n\n print \"[o] running...\"\n\n if join:\n server.serve_forever()\n else:\n thread = threading.Thread(target=server.serve_forever)\n thread.daemon = True\n thread.start()", "metadata": "root.start_httpd", "header": "['module', '___EOS___']", "index": 68 } ]
[]
[]
0
true
[ "[CLS]_", "Test", "ing_", "equality", "_", "to_", "None_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "start", "\\u", "httpd_", "(_", "address_", "=_", "None_", ",_", "port_", "=_", "None_", ",_", "join_", "=_", "False_", ",_", "pem_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Start", "s", " ", "HTTP", " ", "server", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Thread", "ing", "Server_", "(_", "Sock", "et", "Server_", "._", "Thread", "ing", "Mix", "In_", ",_", "Base", "HTTP", "Server_", "._", "HTTP", "Server_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "server", "\\u", "bind_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "socket_", "._", "setsockopt_", "(_", "socket_", "._", "SOL", "\\u", "SOCKET_", ",_", "socket_", "._", "SO", "\\u", "REUSE", "ADDR_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Base", "HTTP", "Server_", "._", "HTTP", "Server_", "._", "server", "\\u", "bind_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "finish", "\\u", "request_", "(_", "self_", ",_", "*_", "args_", ",_", "**_", "kwargs_", ")_", ":_", "\\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 ", " _", "Base", "HTTP", "Server_", "._", "HTTP", "Server_", "._", "finish", "\\u", "request_", "(_", "self_", ",_", "*_", "args_", ",_", "**_", "kwargs_", ")_", "\\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 ", " _", "if_", "config_", "._", "SHOW", "\\u", "DEBUG_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "traceback_", "._", "print", "\\u", "exc_", "(_", ")_", "\\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_", "class_", "SS", "LT", "hread", "ing", "Server_", "(_", "Thread", "ing", "Server_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "server", "\\u", "address_", ",_", "pem_", ",_", "Handle", "r", "Class_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "Open", "SSL_", "#", " ", "python", "-", "openss", "l_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "Thread", "ing", "Server_", "._", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "server", "\\u", "address_", ",_", "Handle", "r", "Class_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ctx_", "=_", "Open", "SSL_", "._", "SSL_", "._", "Context_", "(_", "Open", "SSL_", "._", "SSL_", "._", "TLS", "v1", "\\u", "METHOD_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ctx_", "._", "use", "\\u", "private", "key", "\\u", "file_", "(_", "pem_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ctx_", "._", "use", "\\u", "certifica", "te", "\\u", "file_", "(_", "pem_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "socket_", "=_", "Open", "SSL_", "._", "SSL_", "._", "Connection_", "(_", "ctx_", ",_", "socket_", "._", "socket_", "(_", "self_", "._", "address", "\\u", "family_", ",_", "self_", "._", "socket", "\\u", "type_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "server", "\\u", "bind_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "server", "\\u", "activate_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "shut", "down", "\\u", "request_", "(_", "self_", ",_", "request_", ")_", ":_", "\\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 ", " _", "request_", "._", "shutdown_", "(_", ")_", "\\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 ", " _", "if_", "config_", "._", "SHOW", "\\u", "DEBUG_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "traceback_", "._", "print", "\\u", "exc_", "(_", ")_", "\\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_", "class_", "Re", "q", "Handler_", "(_", "Base", "HTTP", "Server_", "._", "Base", "HTTP", "Request", "Handler_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "do", "\\u", "GET_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "path_", ",_", "query_", "=_", "self_", "._", "path_", "._", "split_", "(_", "'?'_", ",_", "1_", ")_", "if_", "'?'_", "in_", "self_", "._", "path_", "else_", "(_", "self_", "._", "path_", ",_", "\"\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "params_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "content_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "skip_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "hasattr_", "(_", "self_", ",_", "\"", "data", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "params_", "._", "update_", "(_", "urlparse_", "._", "parse", "\\u", "qs_", "(_", "self_", "._", "data_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "query_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "params_", "._", "update_", "(_", "urlparse_", "._", "parse", "\\u", "qs_", "(_", "query_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "key_", "in_", "params_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "params_", "[_", "key_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "params_", "[_", "key_", "]_", "=_", "params_", "[_", "key_", "]_", "[_", "-_", "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_", "if_", "path_", "==_", "'/'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "path_", "=_", "\"", "index", ".", "html", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "path_", "=_", "path_", "._", "strip_", "(_", "'/'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "extension_", "=_", "os_", "._", "path_", "._", "splitext_", "(_", "path_", ")_", "[_", "-_", "1_", "]_", "._", "lower_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "hasattr_", "(_", "self_", ",_", "\"\\u", "%", "s", "\"_", "%_", "path_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "content_", "=_", "getattr_", "(_", "self_", ",_", "\"\\u", "%", "s", "\"_", "%_", "path_", ")_", "(_", "params_", ")_", "\\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 ", " _", "path_", "=_", "path_", "._", "replace_", "(_", "'/'_", ",_", "os_", "._", "path_", "._", "sep_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "path_", "=_", "os_", "._", "path_", "._", "abspath_", "(_", "os_", "._", "path_", "._", "join_", "(_", "HTM", "L", "\\u", "DIR_", ",_", "path_", ")_", ")_", "._", "strip_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "os_", "._", "path_", "._", "isfile_", "(_", "path_", ")_", "and_", "os_", "._", "path_", "._", "isfile_", "(_", "\"%", "s", ".", "html", "\"_", "%_", "path_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "path_", "=_", "\"%", "s", ".", "html", "\"_", "%_", "path_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "\"..\"_", "not_", "in_", "os_", "._", "path_", "._", "relpath_", "(_", "path_", ",_", "HTM", "L", "\\u", "DIR_", ")_", "and_", "os_", "._", "path_", "._", "isfile_", "(_", "path_", ")_", "and_", "(_", "extension_", "not_", "in_", "DISABLED", "\\u", "CONTE", "NT", "\\u", "EXTENSIONS_", "or_", "os_", "._", "path_", "._", "split_", "(_", "path_", ")_", "[_", "-_", "1_", "]_", "in_", "CONTE", "NT", "\\u", "EXTENSION", "S", "\\u", "EXC", "LUS", "IONS", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "mtime_", "=_", "time_", "._", "gmtime_", "(_", "os_", "._", "path_", "._", "getmtime_", "(_", "path_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if", "\\u", "modifi", "ed", "\\u", "since_", "=_", "self_", "._", "headers_", "._", "get_", "(_", "HTTP", "\\u", "HEADER_", "._", "IF", "\\u", "MODIFIE", "D", "\\u", "SIN", "CE_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "if", "\\u", "modifi", "ed", "\\u", "since_", "and_", "extension_", "not_", "in_", "(_", "\".", "ht", "m", "\"_", ",_", "\".", "html", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "if", "\\u", "modifi", "ed", "\\u", "since_", "=_", "[_", "\\u_", "for_", "\\u_", "in_", "if", "\\u", "modifi", "ed", "\\u", "since_", "._", "split_", "(_", "';'_", ")_", "if_", "\\u_", "._", "upper_", "(_", ")_", "._", "endswith_", "(_", "\"", "GM", "T", "\"_", ")_", "]_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "time_", "._", "mktime_", "(_", "mtime_", ")_", "<=_", "time_", "._", "mktime_", "(_", "time_", "._", "strptime_", "(_", "if", "\\u", "modifi", "ed", "\\u", "since_", ",_", "HTTP", "\\u", "TIME", "\\u", "FORMAT_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "self_", "._", "send", "\\u", "response_", "(_", "httplib_", "._", "NOT", "\\u", "MODIFIE", "D_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "send", "\\u", "header_", "(_", "HTTP", "\\u", "HEADER_", "._", "CONNECTION", "_", ",_", "\"", "close", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "skip_", "=_", "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_", "skip_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "content_", "=_", "open_", "(_", "path_", ",_", "\"", "rb", "\"_", ")_", "._", "read_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "last", "\\u", "modified_", "=_", "time_", "._", "strftime_", "(_", "HTTP", "\\u", "TIME", "\\u", "FORMAT_", ",_", "mtime_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "send", "\\u", "response_", "(_", "httplib_", "._", "OK_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "send", "\\u", "header_", "(_", "HTTP", "\\u", "HEADER_", "._", "CONNECTION", "_", ",_", "\"", "close", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "send", "\\u", "header_", "(_", "HTTP", "\\u", "HEADER_", "._", "CONTE", "NT", "\\u", "TYPE_", ",_", "mimetypes_", "._", "guess", "\\u", "type_", "(_", "path_", ")_", "[_", "0_", "]_", "or_", "\"", "applica", "tion", "/", "oct", "et", "-", "stream", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "send", "\\u", "header_", "(_", "HTTP", "\\u", "HEADER_", "._", "LAS", "T", "\\u", "MODIFIE", "D_", ",_", "last", "\\u", "modified_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "extension_", "not_", "in_", "(_", "\".", "ht", "m", "\"_", ",_", "\".", "html", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "self_", "._", "send", "\\u", "header_", "(_", "HTTP", "\\u", "HEADER_", "._", "EXPIRE", "S_", ",_", "\"", "Sun", ",", " ", "1", "7", "-", "Jan", "-", "203", "8", " ", "1", "9", ":", "14", ":", "0", "7", " ", "GM", "T", "\"_", ")_", "#", " ", "Reference", ":", " ", "http", "://", "blog", ".", "http", "watch", ".", "com", "/", "2007", "/", "1", "2", "/", "10", "/", "two", "-", "simple", "-", "rule", "s", "-", "for", "-", "http", "-", "caching", "/_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "send", "\\u", "header_", "(_", "HTTP", "\\u", "HEADER_", "._", "CACHE", "\\u", "CONTROL_", ",_", "\"", "max", "-", "age", "=", "3600", ",", " ", "must", "-", "rev", "alid", "ate", "\"_", ")_", "#", " ", "Reference", ":", " ", "http", "://", "stack", "overflow", ".", "com", "/", "a", "/", "508", "455", "5_", "\\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_", "._", "send", "\\u", "header_", "(_", "HTTP", "\\u", "HEADER_", "._", "CACHE", "\\u", "CONTROL_", ",_", "\"", "no", "-", "cache", "\"_", ")_", "\\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_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "self_", "._", "send", "\\u", "response_", "(_", "httplib_", "._", "NOT", "\\u", "FOUND_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "send", "\\u", "header_", "(_", "HTTP", "\\u", "HEADER_", "._", "CONNECTION", "_", ",_", "\"", "close", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "content_", "=_", "'<!", "DOC", "TYPE", " ", "html", "><", "html", " ", "lang", "=\"", "en", "\">", "<", "head", "><", "title", ">", "404", " ", "Not", " ", "Foun", "d", "</", "title", "><", "/", "head", "><", "body", "><", "h1", ">", "Not", " ", "Foun", "d", "</", "h1", "><", "p", ">", "The", " ", "request", "ed", " ", "URL", " ", "%", "s", " ", "was", " ", "not", " ", "found", " ", "on", " ", "this", " ", "server", ".", "</", "p", "><", "/", "body", "><", "/", "html", ">'_", "%_", "self_", "._", "path_", "._", "split_", "(_", "'?'_", ")_", "[_", "0_", "]_", "\\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_", "content_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "match_", "in_", "re_", "._", "finditer_", "(_", "r", "\"<", "\\\\", "!(", "\\\\", "w", "+)\\\\", "!", ">\"_", ",_", "content_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "name_", "=_", "match_", "._", "group_", "(_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u_", "=_", "getattr_", "(_", "self_", ",_", "\"\\u", "%", "s", "\"_", "%_", "name_", "._", "lower_", "(_", ")_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "\\u_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "content_", "=_", "self_", "._", "\\u", "format_", "(_", "content_", ",_", "**_", "{_", "name_", ":_", "\\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_", "if_", "\"", "gzip", "\"_", "in_", "self_", "._", "headers_", "._", "getheader_", "(_", "HTTP", "\\u", "HEADER_", "._", "ACCEPT", "\\u", "ENCODING_", ",_", "\"\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "self_", "._", "send", "\\u", "header_", "(_", "HTTP", "\\u", "HEADER_", "._", "CONTE", "NT", "\\u", "ENCODING_", ",_", "\"", "gzip", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u_", "=_", "c", "String", "IO_", "._", "String", "IO_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "compress_", "=_", "gzip_", "._", "Gz", "ip", "File_", "(_", "\"\"_", ",_", "\"", "w", "+", "b", "\"_", ",_", "9_", ",_", "\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "compress_", "._", "\\u", "stream_", "=_", "\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "compress_", "._", "write_", "(_", "content_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "compress_", "._", "flush_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "compress_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "content_", "=_", "compress_", "._", "\\u", "stream_", "._", "getvalue_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "send", "\\u", "header_", "(_", "HTTP", "\\u", "HEADER_", "._", "CONTE", "NT", "\\u", "LENGTH_", ",_", "str_", "(_", "len_", "(_", "content_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "end", "\\u", "headers_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "content_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "wfile_", "._", "write_", "(_", "content_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "wfile_", "._", "flush_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "wfile_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "do", "\\u", "POST_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "length_", "=_", "self_", "._", "headers_", "._", "getheader_", "(_", "HTTP", "\\u", "HEADER_", "._", "CONTE", "NT", "\\u", "LENGTH_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data_", "=_", "self_", "._", "rfile_", "._", "read_", "(_", "int_", "(_", "length_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data_", "=_", "urllib_", "._", "unqu", "ote", "\\u", "plus_", "(_", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "data_", "=_", "data_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "do", "\\u", "GET_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "session_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "retval_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cookie_", "=_", "self_", "._", "headers_", "._", "get_", "(_", "HTTP", "\\u", "HEADER_", "._", "COOKIE", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "cookie_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "match_", "=_", "re_", "._", "search_", "(_", "r", "\"%", "s", "\\\\", "s", "*=", "\\\\", "s", "*([", "^", ";", "]+)\"", "_", "%_", "SES", "SION", "\\u", "COOKIE", "\\u", "NAME_", ",_", "cookie_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "match_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "session_", "=_", "match_", "._", "group_", "(_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "session_", "in_", "SES", "SION", "S_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "if_", "SES", "SION", "S_", "[_", "session_", "]_", "._", "client", "\\u", "ip_", "!=_", "self_", "._", "client", "\\u", "address_", "[_", "0_", "]_", ":_", "\\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_", "elif_", "SES", "SION", "S_", "[_", "session_", "]_", "._", "expiration_", ">_", "time_", "._", "time_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "retval_", "=_", "SES", "SION", "S_", "[_", "session_", "]_", "\\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 ", " ", " _", "del_", "SES", "SION", "S_", "[_", "session_", "]_", "\\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_", "retval_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "delete", "\\u", "session_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cookie_", "=_", "self_", "._", "headers_", "._", "get_", "(_", "HTTP", "\\u", "HEADER_", "._", "COOKIE", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "cookie_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "match_", "=_", "re_", "._", "search_", "(_", "r", "\"%", "s", "=(", ".+)", "\"_", "%_", "SES", "SION", "\\u", "COOKIE", "\\u", "NAME_", ",_", "cookie_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "match_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "session_", "=_", "match_", "._", "group_", "(_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "session_", "in_", "SES", "SION", "S_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "del_", "SES", "SION", "S_", "[_", "session_", "]_", "\\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_", "def_", "version", "\\u", "string_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "SERVER", "\\u", "HEADER_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "end", "\\u", "headers_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "hasattr_", "(_", "self_", ",_", "\"\\u", "header", "s", "\\u", "ende", "d", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Base", "HTTP", "Server_", "._", "Base", "HTTP", "Request", "Handler_", "._", "end", "\\u", "headers_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "header", "s", "\\u", "ended_", "=_", "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_", "def_", "log", "\\u", "message_", "(_", "self_", ",_", "format_", ",_", "*_", "args_", ")_", ":_", "\\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_", "def_", "finish_", "(_", "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 ", " _", "Base", "HTTP", "Server_", "._", "Base", "HTTP", "Request", "Handler_", "._", "finish_", "(_", "self_", ")_", "\\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 ", " _", "if_", "config_", "._", "SHOW", "\\u", "DEBUG_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "traceback_", "._", "print", "\\u", "exc_", "(_", ")_", "\\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_", "def_", "\\u", "version_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "VERSION_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "format_", "(_", "self_", ",_", "content_", ",_", "**_", "params_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "content_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "key_", ",_", "value_", "in_", "params_", "._", "items_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "content_", "=_", "content_", "._", "replace_", "(_", "\"<", "!%", "s", "!", ">\"_", "%_", "key_", ",_", "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_", "content_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "login_", "(_", "self_", ",_", "params_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "valid_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "params_", "._", "get_", "(_", "\"", "user", "name", "\"_", ")_", "and_", "params_", "._", "get_", "(_", "\"", "hash", "\"_", ")_", "and_", "params_", "._", "get_", "(_", "\"", "nonc", "e", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "params_", "._", "get_", "(_", "\"", "nonc", "e", "\"_", ")_", "not_", "in_", "DISP", "OSE", "D", "\\u", "NON", "CES", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "DISP", "OSE", "D", "\\u", "NON", "CES", "_", "._", "add_", "(_", "params_", "._", "get_", "(_", "\"", "nonc", "e", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "entry_", "in_", "(_", "config_", "._", "USERS", "_", "or_", "[_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "entry_", "=_", "re_", "._", "sub_", "(_", "r", "\"\\\\", "s", "\"_", ",_", "\"\"_", ",_", "entry_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "username_", ",_", "store", "d\\u", "hash_", ",_", "uid_", ",_", "netf", "ilter_", "=_", "entry_", "._", "split_", "(_", "':'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "username_", "==_", "params_", "._", "get_", "(_", "\"", "user", "name", "\"_", ")_", ":_", "\\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_", "params_", "._", "get_", "(_", "\"", "hash", "\"_", ")_", "==_", "hashlib_", "._", "sha256_", "(_", "store", "d\\u", "hash_", "._", "strip_", "(_", ")_", "+_", "params_", "._", "get_", "(_", "\"", "nonc", "e", "\"_", ")_", ")_", "._", "hexdigest_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "valid_", "=_", "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_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "if_", "config_", "._", "SHOW", "\\u", "DEBUG_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "traceback_", "._", "print", "\\u", "exc_", "(_", ")_", "\\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_", "\\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 ", " _", "session", "\\u", "id_", "=_", "os_", "._", "urandom_", "(_", "SES", "SION", "\\u", "ID", "\\u", "LENGTH_", ")_", "._", "encode_", "(_", "\"", "hex", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "expiration_", "=_", "time_", "._", "time_", "(_", ")_", "+_", "3600_", "*_", "SES", "SION", "\\u", "EXP", "IRA", "TIO", "N", "\\u", "HOUR", "S_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "send", "\\u", "response_", "(_", "httplib_", "._", "OK_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "send", "\\u", "header_", "(_", "HTTP", "\\u", "HEADER_", "._", "CONNECTION", "_", ",_", "\"", "close", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "send", "\\u", "header_", "(_", "HTTP", "\\u", "HEADER_", "._", "SET", "\\u", "COOKIE", "_", ",_", "\"%", "s", "=", "%", "s", ";", " ", "expir", "es", "=", "%", "s", ";", " ", "path", "=", "/", ";", " ", "Http", "On", "ly", "\"_", "%_", "(_", "SES", "SION", "\\u", "COOKIE", "\\u", "NAME_", ",_", "session", "\\u", "id_", ",_", "time_", "._", "strftime_", "(_", "HTTP", "\\u", "TIME", "\\u", "FORMAT_", ",_", "time_", "._", "gmtime_", "(_", "expiration_", ")_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "netf", "ilter_", "in_", "(_", "\"\"_", ",_", "\"", "0.", "0.", "0.", "0", "/", "0", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "netf", "ilter", "s_", "=_", "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 ", " ", "_", "addresses_", "=_", "set_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "net", "masks_", "=_", "set_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "item_", "in_", "set_", "(_", "re_", "._", "split_", "(_", "r", "\"[", ";", ",]", "\"_", ",_", "netf", "ilter_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "item_", "=_", "item_", "._", "strip_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "'/'_", "in_", "item_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "\\u_", "=_", "item_", "._", "split_", "(_", "'/'_", ")_", "[_", "-_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "\\u_", "._", "isdigit_", "(_", ")_", "and_", "int_", "(_", "\\u_", ")_", ">=_", "16_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "lower_", "=_", "addr", "\\u", "to", "\\u", "int_", "(_", "item_", "._", "split_", "(_", "'/'_", ")_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mask_", "=_", "make", "\\u", "mask_", "(_", "int_", "(_", "\\u_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "upper_", "=_", "lower_", "|_", "(_", "0xffffffff_", "^_", "mask_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "lower_", "<=_", "upper_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "addresses_", "._", "add_", "(_", "int\\u", "to", "\\u", "addr_", "(_", "lower_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lower_", "+=_", "1_", "\\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 ", " ", " _", "net", "masks_", "._", "add_", "(_", "item_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "'-'_", "in_", "item_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "\\u_", "=_", "item_", "._", "split_", "(_", "'-'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lower_", ",_", "upper_", "=_", "addr", "\\u", "to", "\\u", "int_", "(_", "\\u_", "[_", "0_", "]_", ")_", ",_", "addr", "\\u", "to", "\\u", "int_", "(_", "\\u_", "[_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "lower_", "<=_", "upper_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "addresses_", "._", "add_", "(_", "int\\u", "to", "\\u", "addr_", "(_", "lower_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lower_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "re_", "._", "search_", "(_", "r", "\"\\\\", "d", "+\\\\.", "\\\\", "d", "+\\\\.", "\\\\", "d", "+\\\\.", "\\\\", "d", "+\"_", ",_", "item_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "addresses_", "._", "add_", "(_", "item_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "netf", "ilter", "s_", "=_", "net", "masks_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "addresses_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "netf", "ilter", "s_", "._", "add_", "(_", "get", "\\u", "regex_", "(_", "addresses_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "SES", "SION", "S_", "[_", "session", "\\u", "id_", "]_", "=_", "Attrib", "Dict_", "(_", "{_", "\"", "user", "name", "\"_", ":_", "username_", ",_", "\"", "uid", "\"_", ":_", "uid_", ",_", "\"", "netf", "ilter", "s", "\"_", ":_", "netf", "ilter", "s_", ",_", "\"", "expir", "ation", "\"_", ":_", "expiration_", ",_", "\"", "client", "\\u", "ip", "\"_", ":_", "self_", "._", "client", "\\u", "address_", "[_", "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 ", " _", "time_", "._", "sleep_", "(_", "UNA", "UTH", "ORI", "ZED", "\\u", "SLEEP", "\\u", "TIME_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "send", "\\u", "response_", "(_", "httplib_", "._", "UNA", "UTH", "ORI", "ZED", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "send", "\\u", "header_", "(_", "HTTP", "\\u", "HEADER_", "._", "CONNECTION", "_", ",_", "\"", "close", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "send", "\\u", "header_", "(_", "HTTP", "\\u", "HEADER_", "._", "CONTE", "NT", "\\u", "TYPE_", ",_", "\"", "text", "/", "plain", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "content_", "=_", "\"", "Logi", "n", " ", "%", "s", "\"_", "%_", "(_", "\"", "success", "\"_", "if_", "valid_", "else_", "\"", "fail", "ed", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "subprocess_", "._", "ms", "windows_", ":_", "\\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 ", " ", "_", "subprocess_", "._", "check", "\\u", "output_", "(_", "\"", "logg", "er", " ", "-", "p", " ", "auth", ".", "info", " ", "-", "t", " ", "\\\\\"", "%", "s", "[", "%", "d", "]\\\\", "\"", " ", "\\\\\"", "%", "s", " ", "password", " ", "for", " ", "%", "s", " ", "from", " ", "%", "s", " ", "port", " ", "%", "s", "\\\\\"\"_", "%_", "(_", "NAME_", "._", "lower_", "(_", ")_", ",_", "os_", "._", "getpid_", "(_", ")_", ",_", "\"", "Accept", "ed", "\"_", "if_", "valid_", "else_", "\"", "Fail", "ed", "\"_", ",_", "params_", "._", "get_", "(_", "\"", "user", "name", "\"_", ")_", ",_", "self_", "._", "client", "\\u", "address_", "[_", "0_", "]_", ",_", "self_", "._", "client", "\\u", "address_", "[_", "1_", "]_", ")_", ",_", "stderr_", "=_", "subprocess_", "._", "STDOUT_", ",_", "shell_", "=_", "True_", ")_", "\\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 ", " ", "_", "if_", "config_", "._", "SHOW", "\\u", "DEBUG_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "traceback_", "._", "print", "\\u", "exc_", "(_", ")_", "\\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_", "return_", "content_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "logout_", "(_", "self_", ",_", "params_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "delete", "\\u", "session_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "send", "\\u", "response_", "(_", "httplib_", "._", "FOUND_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "send", "\\u", "header_", "(_", "HTTP", "\\u", "HEADER_", "._", "CONNECTION", "_", ",_", "\"", "close", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "send", "\\u", "header_", "(_", "HTTP", "\\u", "HEADER_", "._", "LOCATION_", ",_", "\"/\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "who", "ami_", "(_", "self_", ",_", "params_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "session_", "=_", "self_", "._", "get", "\\u", "session_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "username_", "=_", "session_", "._", "username_", "if_", "session_", "else_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "send", "\\u", "response_", "(_", "httplib_", "._", "OK_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "send", "\\u", "header_", "(_", "HTTP", "\\u", "HEADER_", "._", "CONNECTION", "_", ",_", "\"", "close", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "send", "\\u", "header_", "(_", "HTTP", "\\u", "HEADER_", "._", "CONTE", "NT", "\\u", "TYPE_", ",_", "\"", "text", "/", "plain", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "username_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "check", "\\u", "ip_", "(_", "self_", ",_", "params_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "session_", "=_", "self_", "._", "get", "\\u", "session_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "session_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "send", "\\u", "response_", "(_", "httplib_", "._", "UNA", "UTH", "ORI", "ZED", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "send", "\\u", "header_", "(_", "HTTP", "\\u", "HEADER_", "._", "CONNECTION", "_", ",_", "\"", "close", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "send", "\\u", "response_", "(_", "httplib_", "._", "OK_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "send", "\\u", "header_", "(_", "HTTP", "\\u", "HEADER_", "._", "CONNECTION", "_", ",_", "\"", "close", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "send", "\\u", "header_", "(_", "HTTP", "\\u", "HEADER_", "._", "CONTE", "NT", "\\u", "TYPE_", ",_", "\"", "text", "/", "plain", "\"_", ")_", "\\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 ", " _", "result", "\\u", "worst", "_", "=_", "worst", "\\u", "asn", "s_", "(_", "params_", "._", "get_", "(_", "\"", "address", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "result", "\\u", "worst", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "result", "\\u", "ipc", "at_", "=_", "result", "\\u", "worst", "_", "\\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 ", " ", "_", "\\u_", "=_", "(_", "ipc", "at", "\\u", "lookup_", "(_", "params_", "._", "get_", "(_", "\"", "address", "\"_", ")_", ")_", "or_", "\"\"_", ")_", "._", "lower_", "(_", ")_", "._", "split_", "(_", "'", " ", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result", "\\u", "ipc", "at_", "=_", "\\u_", "[_", "1_", "]_", "if_", "\\u_", "[_", "0_", "]_", "==_", "'", "the", "'_", "else_", "\\u_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "(_", "\"%", "s", "\"_", "if_", "not_", "params_", "._", "get_", "(_", "\"", "callback", "\"_", ")_", "else_", "\"%", "s", "(%", "%", "s", ")\"_", "%_", "params_", "._", "get_", "(_", "\"", "callback", "\"_", ")_", ")_", "%_", "json_", "._", "dumps_", "(_", "{_", "\"", "ipc", "at", "\"_", ":_", "result", "\\u", "ipc", "at_", ",_", "\"", "worst", "\\u", "asn", "s", "\"_", ":_", "str_", "(_", "result", "\\u", "worst", "_", "is_", "not_", "None_", ")_", "._", "lower_", "(_", ")_", "}_", ")_", "\\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 ", " _", "if_", "config_", "._", "SHOW", "\\u", "DEBUG_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "traceback_", "._", "print", "\\u", "exc_", "(_", ")_", "\\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_", "def_", "\\u", "trail", "s_", "(_", "self_", ",_", "params_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "send", "\\u", "response_", "(_", "httplib_", "._", "OK_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "send", "\\u", "header_", "(_", "HTTP", "\\u", "HEADER_", "._", "CONNECTION", "_", ",_", "\"", "close", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "send", "\\u", "header_", "(_", "HTTP", "\\u", "HEADER_", "._", "CONTE", "NT", "\\u", "TYPE_", ",_", "\"", "text", "/", "plain", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "open_", "(_", "TRA", "IL", "S", "\\u", "FILE_", ",_", "\"", "rb", "\"_", ")_", "._", "read_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "ping_", "(_", "self_", ",_", "params_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "send", "\\u", "response_", "(_", "httplib_", "._", "OK_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "send", "\\u", "header_", "(_", "HTTP", "\\u", "HEADER_", "._", "CONNECTION", "_", ",_", "\"", "close", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "send", "\\u", "header_", "(_", "HTTP", "\\u", "HEADER_", "._", "CONTE", "NT", "\\u", "TYPE_", ",_", "\"", "text", "/", "plain", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "PING", "\\u", "RESPONSE_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "events_", "(_", "self_", ",_", "params_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "session_", "=_", "self_", "._", "get", "\\u", "session_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "session_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "send", "\\u", "response_", "(_", "httplib_", "._", "UNA", "UTH", "ORI", "ZED", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "send", "\\u", "header_", "(_", "HTTP", "\\u", "HEADER_", "._", "CONNECTION", "_", ",_", "\"", "close", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "start_", ",_", "end_", ",_", "size_", ",_", "total_", "=_", "None_", ",_", "None_", ",_", "-_", "1_", ",_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "content_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "event", "\\u", "log", "\\u", "path_", "=_", "os_", "._", "path_", "._", "join_", "(_", "config_", "._", "LOG", "\\u", "DIR_", ",_", "\"%", "s", ".", "log", "\"_", "%_", "params_", "._", "get_", "(_", "\"", "date", "\"_", ",_", "\"\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "os_", "._", "path_", "._", "exists_", "(_", "event", "\\u", "log", "\\u", "path_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "total_", "=_", "os_", "._", "stat_", "(_", "event", "\\u", "log", "\\u", "path_", ")_", "._", "st", "\\u", "size_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "self_", "._", "headers_", "._", "get_", "(_", "HTTP", "\\u", "HEADER_", "._", "RANGE_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "match_", "=_", "re_", "._", "search_", "(_", "r", "\"", "bytes", "=(", "\\\\", "d", "+)", "-(", "\\\\", "d", "+)\"_", ",_", "self_", "._", "headers_", "[_", "HTTP", "\\u", "HEADER_", "._", "RANGE_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "match_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "start_", ",_", "end_", "=_", "int_", "(_", "match_", "._", "group_", "(_", "1_", ")_", ")_", ",_", "int_", "(_", "match_", "._", "group_", "(_", "2_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "max", "\\u", "size_", "=_", "end_", "-_", "start_", "+_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "end_", "=_", "min_", "(_", "total_", "-_", "1_", ",_", "end_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "size_", "=_", "end_", "-_", "start_", "+_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "start_", "==_", "0_", "or_", "not_", "session_", "._", "range", "\\u", "handle_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "session_", "._", "range", "\\u", "handle_", "=_", "open_", "(_", "event", "\\u", "log", "\\u", "path_", ",_", "\"", "rb", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "session_", "._", "netf", "ilter", "s_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "session_", "._", "range", "\\u", "handle_", "._", "seek_", "(_", "start_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "send", "\\u", "response_", "(_", "httplib_", "._", "PARTI", "AL", "\\u", "CONTENT_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "send", "\\u", "header_", "(_", "HTTP", "\\u", "HEADER_", "._", "CONNECTION", "_", ",_", "\"", "close", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "send", "\\u", "header_", "(_", "HTTP", "\\u", "HEADER_", "._", "CONTE", "NT", "\\u", "TYPE_", ",_", "\"", "text", "/", "plain", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "send", "\\u", "header_", "(_", "HTTP", "\\u", "HEADER_", "._", "CONTE", "NT", "\\u", "RANGE_", ",_", "\"", "bytes", " ", "%", "d", "-%", "d", "/", "%", "d", "\"_", "%_", "(_", "start_", ",_", "end_", ",_", "total_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "content_", "=_", "session_", "._", "range", "\\u", "handle_", "._", "read_", "(_", "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 ", " ", " _", "self_", "._", "send", "\\u", "response_", "(_", "httplib_", "._", "OK_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "send", "\\u", "header_", "(_", "HTTP", "\\u", "HEADER_", "._", "CONNECTION", "_", ",_", "\"", "close", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "send", "\\u", "header_", "(_", "HTTP", "\\u", "HEADER_", "._", "CONTE", "NT", "\\u", "TYPE_", ",_", "\"", "text", "/", "plain", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "buffer_", ",_", "addresses_", ",_", "net", "masks_", ",_", "regex_", "=_", "c", "String", "IO_", "._", "String", "IO_", "(_", ")_", ",_", "set_", "(_", ")_", ",_", "[_", "]_", ",_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "netf", "ilter_", "in_", "session_", "._", "netf", "ilter", "s_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "if_", "not_", "netf", "ilter_", ":_", "\\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_", "'/'_", "in_", "netf", "ilter_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "net", "masks_", "._", "append_", "(_", "netf", "ilter_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "re_", "._", "search_", "(_", "r", "\"\\\\", "A", "[\\\\", "d", ".]+", "\\\\", "Z", "\"_", ",_", "netf", "ilter_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "addresses_", "._", "add_", "(_", "netf", "ilter_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "'\\\\.", "'_", "in_", "netf", "ilter_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "regex_", "=_", "r", "\"\\\\", "b", "(%", "s", ")\\\\", "b", "\"_", "%_", "netf", "ilter_", "\\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 ", " ", " _", "print_", "\"[", "!]", " ", "invalid", " ", "network", " ", "filter", " ", "'%", "s", "'\"_", "%_", "netf", "ilter_", "\\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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "line_", "in_", "session_", "._", "range", "\\u", "handle_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "display_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ip_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "regex_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "match_", "=_", "re_", "._", "search_", "(_", "regex_", ",_", "line_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "match_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " ", " _", "ip_", "=_", "match_", "._", "group_", "(_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "display_", "=_", "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_", "display_", "and_", "(_", "addresses_", "or_", "net", "masks_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "for_", "match_", "in_", "re_", "._", "finditer_", "(_", "r", "\"\\\\", "b", "(\\\\", "d", "+\\\\.", "\\\\", "d", "+\\\\.", "\\\\", "d", "+\\\\.", "\\\\", "d", "+)\\\\", "b", "\"_", ",_", "line_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " ", " _", "if_", "not_", "display_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " ", " _", "ip_", "=_", "match_", "._", "group_", "(_", "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 ", " ", " ", " _", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "ip_", "in_", "addresses_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " ", " _", "display_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "net", "masks_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " ", " _", "for_", "\\u_", "in_", "net", "masks_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " ", " _", "prefix_", ",_", "mask_", "=_", "\\u_", "._", "split_", "(_", "'/'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "addr", "\\u", "to", "\\u", "int_", "(_", "ip_", ")_", "&_", "make", "\\u", "mask_", "(_", "int_", "(_", "mask_", ")_", ")_", "==_", "addr", "\\u", "to", "\\u", "int_", "(_", "prefix_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " ", " _", "addresses_", "._", "add_", "(_", "ip_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "display_", "=_", "True_", "\\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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "display_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "if_", "\",", "%", "s", "\"_", "%_", "ip_", "in_", "line_", "or_", "\"%", "s", ",\"_", "%_", "ip_", "in_", "line_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " ", " _", "line_", "=_", "re_", "._", "sub_", "(_", "r", "\"", " ", "([\\\\", "d", ".,", "]+", ",)", "?", "%", "s", "(", ",", "[\\\\", "d", ".,", "]+)", "?", " ", "\"_", "%_", "re_", "._", "escape_", "(_", "ip_", ")_", ",_", "\"", " ", "%", "s", " ", "\"_", "%_", "ip_", ",_", "line_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "buffer_", "._", "write_", "(_", "line_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "buffer_", "._", "tell_", "(_", ")_", ">=_", "max", "\\u", "size_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "content_", "=_", "buffer_", "._", "getvalue_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "end_", "=_", "start_", "+_", "len_", "(_", "content_", ")_", "-_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "send", "\\u", "header_", "(_", "HTTP", "\\u", "HEADER_", "._", "CONTE", "NT", "\\u", "RANGE_", ",_", "\"", "bytes", " ", "%", "d", "-%", "d", "/", "%", "d", "\"_", "%_", "(_", "start_", ",_", "end_", ",_", "end_", "+_", "1_", "+_", "max", "\\u", "size_", "*_", "(_", "len_", "(_", "content_", ")_", ">=_", "max", "\\u", "size_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "len_", "(_", "content_", ")_", "<_", "max", "\\u", "size_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "session_", "._", "range", "\\u", "handle_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "session_", "._", "range", "\\u", "handle_", "=_", "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_", "if_", "size_", "==_", "-_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "self_", "._", "send", "\\u", "response_", "(_", "httplib_", "._", "OK_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "send", "\\u", "header_", "(_", "HTTP", "\\u", "HEADER_", "._", "CONNECTION", "_", ",_", "\"", "close", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "send", "\\u", "header_", "(_", "HTTP", "\\u", "HEADER_", "._", "CONTE", "NT", "\\u", "TYPE_", ",_", "\"", "text", "/", "plain", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "end", "\\u", "headers_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "with_", "open_", "(_", "event", "\\u", "log", "\\u", "path_", ",_", "\"", "rb", "\"_", ")_", "as_", "f_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "while_", "True_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "data_", "=_", "f_", "._", "read_", "(_", "io_", "._", "DEF", "AUL", "T", "\\u", "BUFF", "ER", "\\u", "SIZE_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "data_", ":_", "\\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_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "self_", "._", "wfile_", "._", "write_", "(_", "data_", ")_", "\\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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "send", "\\u", "response_", "(_", "httplib_", "._", "OK_", ")_", "#", " ", "inst", "ead", " ", "of", " ", "http", "lib", ".", "NO", "\\u", "CONTE", "NT", " ", "(", "compatibility", " ", "reasons", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "send", "\\u", "header_", "(_", "HTTP", "\\u", "HEADER_", "._", "CONNECTION", "_", ",_", "\"", "close", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "headers_", "._", "get_", "(_", "HTTP", "\\u", "HEADER_", "._", "RANGE_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "self_", "._", "send", "\\u", "header_", "(_", "HTTP", "\\u", "HEADER_", "._", "CONTE", "NT", "\\u", "RANGE_", ",_", "\"", "bytes", " ", "0", "-0", "/", "0", "\"_", ")_", "\\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_", "content_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "counts_", "(_", "self_", ",_", "params_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "counts_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "session_", "=_", "self_", "._", "get", "\\u", "session_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "session_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "send", "\\u", "response_", "(_", "httplib_", "._", "UNA", "UTH", "ORI", "ZED", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "send", "\\u", "header_", "(_", "HTTP", "\\u", "HEADER_", "._", "CONNECTION", "_", ",_", "\"", "close", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "send", "\\u", "response_", "(_", "httplib_", "._", "OK_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "send", "\\u", "header_", "(_", "HTTP", "\\u", "HEADER_", "._", "CONNECTION", "_", ",_", "\"", "close", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "send", "\\u", "header_", "(_", "HTTP", "\\u", "HEADER_", "._", "CONTE", "NT", "\\u", "TYPE_", ",_", "\"", "applica", "tion", "/", "json", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "match_", "=_", "re_", "._", "search_", "(_", "r", "\"\\\\", "d", "+\\\\", "-\\\\", "d", "+\\\\", "-\\\\", "d", "+\"_", ",_", "params_", "._", "get_", "(_", "\"", "from", "\"_", ",_", "\"\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "match_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "min", "\\u_", "=_", "datetime_", "._", "datetime_", "._", "strptime_", "(_", "match_", "._", "group_", "(_", "0_", ")_", ",_", "DAT", "E", "\\u", "FORMAT_", ")_", "\\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 ", " _", "min", "\\u_", "=_", "datetime_", "._", "datetime_", "._", "fromtimestamp_", "(_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "match_", "=_", "re_", "._", "search_", "(_", "r", "\"\\\\", "d", "+\\\\", "-\\\\", "d", "+\\\\", "-\\\\", "d", "+\"_", ",_", "params_", "._", "get_", "(_", "\"", "to", "\"_", ",_", "\"\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "match_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "max", "\\u_", "=_", "datetime_", "._", "datetime_", "._", "strptime_", "(_", "match_", "._", "group_", "(_", "0_", ")_", ",_", "DAT", "E", "\\u", "FORMAT_", ")_", "\\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", "\\u_", "=_", "datetime_", "._", "datetime_", "._", "now_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "min", "\\u_", "=_", "min", "\\u_", "._", "replace_", "(_", "hour_", "=_", "0_", ",_", "minute_", "=_", "0_", ",_", "second_", "=_", "0_", ",_", "microsecond_", "=_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "max", "\\u_", "=_", "max", "\\u_", "._", "replace_", "(_", "hour_", "=_", "23_", ",_", "minute_", "=_", "59_", ",_", "second_", "=_", "59_", ",_", "microsecond_", "=_", "999999", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "filepath_", "in_", "sorted_", "(_", "glob_", "._", "glob_", "(_", "os_", "._", "path_", "._", "join_", "(_", "config_", "._", "LOG", "\\u", "DIR_", ",_", "\"*", ".", "log", "\"_", ")_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "filename_", "=_", "os_", "._", "path_", "._", "basename_", "(_", "filepath_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "re_", "._", "search_", "(_", "r", "\"\\\\", "A", "\\\\", "d", "{", "4", "}-", "\\\\", "d", "{", "2", "}-", "\\\\", "d", "{", "2", "}\\\\.", "log", "\\\\", "Z", "\"_", ",_", "filename_", ")_", ":_", "\\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_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "current_", "=_", "datetime_", "._", "datetime_", "._", "strptime_", "(_", "os_", "._", "path_", "._", "splitext_", "(_", "filename_", ")_", "[_", "0_", "]_", ",_", "DAT", "E", "\\u", "FORMAT_", ")_", "\\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 ", " ", "_", "if_", "config_", "._", "SHOW", "\\u", "DEBUG_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "traceback_", "._", "print", "\\u", "exc_", "(_", ")_", "\\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 ", " ", "_", "if_", "min", "\\u_", "<=_", "current_", "<=_", "max", "\\u_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "timestamp_", "=_", "int_", "(_", "time_", "._", "mktime_", "(_", "current_", "._", "timetuple_", "(_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "size_", "=_", "os_", "._", "path_", "._", "getsize_", "(_", "filepath_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "open_", "(_", "filepath_", ",_", "\"", "rb", "\"_", ")_", "as_", "f_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "content_", "=_", "f_", "._", "read_", "(_", "io_", "._", "DEF", "AUL", "T", "\\u", "BUFF", "ER", "\\u", "SIZE_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "size_", ">=_", "io_", "._", "DEF", "AUL", "T", "\\u", "BUFF", "ER", "\\u", "SIZE_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "total_", "=_", "1.0_", "*_", "content_", "._", "count_", "(_", "'\\\\", "n", "'_", ")_", "*_", "size_", "/_", "io_", "._", "DEF", "AUL", "T", "\\u", "BUFF", "ER", "\\u", "SIZE_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "counts_", "[_", "timestamp_", "]_", "=_", "int_", "(_", "round_", "(_", "total_", "/_", "100_", ")_", "*_", "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 ", " ", " _", "counts_", "[_", "timestamp_", "]_", "=_", "content_", "._", "count_", "(_", "'\\\\", "n", "'_", ")_", "\\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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "json_", "._", "dumps_", "(_", "counts_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "SS", "LR", "eq", "Handler_", "(_", "Re", "q", "Handler_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "setup_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "connection_", "=_", "self_", "._", "request_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "rfile_", "=_", "socket_", "._", "\\u", "fileo", "bject_", "(_", "self_", "._", "request_", ",_", "\"", "rb", "\"_", ",_", "self_", "._", "rbu", "fsize_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "wfile_", "=_", "socket_", "._", "\\u", "fileo", "bject_", "(_", "self_", "._", "request_", ",_", "\"", "wb", "\"_", ",_", "self_", "._", "wb", "uf", "size_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\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 ", " _", "if_", "pem_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "server_", "=_", "SS", "LT", "hread", "ing", "Server_", "(_", "(_", "address_", "or_", "''_", ",_", "int_", "(_", "port_", ")_", "if_", "str_", "(_", "port_", "or_", "\"\"_", ")_", "._", "isdigit_", "(_", ")_", "else_", "0_", ")_", ",_", "pem_", ",_", "SS", "LR", "eq", "Handler_", ")_", "\\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 ", " _", "server_", "=_", "Thread", "ing", "Server_", "(_", "(_", "address_", "or_", "''_", ",_", "int_", "(_", "port_", ")_", "if_", "str_", "(_", "port_", "or_", "\"\"_", ")_", "._", "isdigit_", "(_", ")_", "else_", "0_", ")_", ",_", "Re", "q", "Handler_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\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 ", " _", "if_", "\"", "Address", " ", "alr", "ead", "y", " ", "in", " ", "use", "\"_", "in_", "str_", "(_", "ex_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "exit_", "(_", "\"[", "!]", " ", "anot", "her", " ", "instance", " ", "alr", "ead", "y", " ", "runn", "ing", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "\"", "Name", " ", "or", " ", "service", " ", "not", " ", "know", "n", "\"_", "in_", "str_", "(_", "ex_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "exit_", "(_", "\"[", "!]", " ", "invalid", " ", "configura", "tion", " ", "value", " ", "for", " ", "'", "HTTP", "\\u", "ADDR", "ESS", "'", " ", "('", "%", "s", "')\"_", "%_", "config_", "._", "HTTP", "\\u", "ADDRESS_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "\"", "Cann", "ot", " ", "assign", " ", "request", "ed", " ", "address", "\"_", "in_", "str_", "(_", "ex_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "exit_", "(_", "\"[", "!]", " ", "can", "'", "t", " ", "use", " ", "configura", "tion", " ", "value", " ", "for", " ", "'", "HTTP", "\\u", "ADDR", "ESS", "'", " ", "('", "%", "s", "')\"_", "%_", "config_", "._", "HTTP", "\\u", "ADDRESS_", ")_", "\\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_", "\\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_", "\"[", "i", "]", " ", "startin", "g", " ", "HTTP", "%", "s", " ", "server", " ", "at", " ", "'", "http", "%", "s", "://", "%", "s", ":", "%", "d", "/'", "\"_", "%_", "(_", "'", "S", "'_", "if_", "pem_", "else_", "\"\"_", ",_", "'", "s", "'_", "if_", "pem_", "else_", "\"\"_", ",_", "server_", "._", "server", "\\u", "address_", "[_", "0_", "]_", ",_", "server_", "._", "server", "\\u", "address_", "[_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "print_", "\"[", "o", "]", " ", "runn", "ing", "...\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "join_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "server_", "._", "serve", "\\u", "forever_", "(_", ")_", "\\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 ", " _", "thread_", "=_", "threading_", "._", "Thread_", "(_", "target_", "=_", "server_", "._", "serve", "\\u", "forever_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "thread_", "._", "daemon_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "thread_", "._", "start_", "(_", ")_" ]
[ 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 ]
Unused import
longaccess/longaccess-client/lacli/progress.py
[ { "content": "import os\nimport multiprocessing\nfrom progressbar import (ProgressBar, Bar,\n ETA, FileTransferSpeed)\nfrom lacli.log import getLogger\nfrom abc import ABCMeta, abstractmethod\nfrom logutils.queue import QueueListener\n\n\n\n\n\n\n\n\n\n\n\nprogress = None\n\n\n\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class queueHandler(object):\n", "metadata": "root.queueHandler", "header": "['module', '___EOS___']", "index": 9 }, { "content": " def __enter__(self):\n q = multiprocessing.Queue()\n self.listener = QueueListener(q, self)\n self.listener.start()\n return q", "metadata": "root.queueHandler.__enter__", "header": "['class', 'queueHandler', '(', 'object', ')', ':', '___EOS___']", "index": 10 }, { "content": " def __exit__(self, type, value, traceback):\n self.listener.stop()", "metadata": "root.queueHandler.__exit__", "header": "['class', 'queueHandler', '(', 'object', ')', ':', '___EOS___']", "index": 16 }, { "content": "class BaseProgressHandler(queueHandler, ProgressBar):\n __metaclass__ = ABCMeta\n\n\n\n\n\n", "metadata": "root.BaseProgressHandler", "header": "['module', '___EOS___']", "index": 20 }, { "content": " def __init__(self, *args, **kwargs):\n self.tx = {}\n self.progress = kwargs.pop('progress', 0)\n super(BaseProgressHandler, self).__init__(*args, **kwargs)", "metadata": "root.BaseProgressHandler.__init__", "header": "['class', 'BaseProgressHandler', '(', 'queueHandler', ',', 'ProgressBar', ')', ':', '___EOS___']", "index": 23 }, { "content": " def update_current(self, msg):\n self.tx[msg['part']] = int(msg['tx'])\n return sum(self.tx.values())", "metadata": "root.BaseProgressHandler.update_current", "header": "['class', 'BaseProgressHandler', '(', 'queueHandler', ',', 'ProgressBar', ')', ':', '___EOS___']", "index": 28 }, { "content": " def save_current(self):\n self.progress += sum(self.tx.values())\n self.tx = {}", "metadata": "root.BaseProgressHandler.save_current", "header": "['class', 'BaseProgressHandler', '(', 'queueHandler', ',', 'ProgressBar', ')', ':', '___EOS___']", "index": 32 }, { "content": " def handle(self, msg):\n if 'part' in msg:\n self.update(self.progress + self.update_current(msg))\n elif 'save' in msg:\n self.keydone(msg)\n self.save_current()", "metadata": "root.BaseProgressHandler.handle", "header": "['class', 'BaseProgressHandler', '(', 'queueHandler', ',', 'ProgressBar', ')', ':', '___EOS___']", "index": 36 }, { "content": " def __enter__(self):\n q = super(BaseProgressHandler, self).__enter__()\n progressToQueue(q)\n self.start(initval=self.progress)\n return q", "metadata": "root.BaseProgressHandler.__enter__", "header": "['class', 'BaseProgressHandler', '(', 'queueHandler', ',', 'ProgressBar', ')', ':', '___EOS___']", "index": 43 }, { "content": " @abstractmethod\n def keydone(self, msg):\n getLogger().debug(\"saved key: {key} ({size})\".format(msg))", "metadata": "root.BaseProgressHandler.keydone", "header": "['class', 'BaseProgressHandler', '(', 'queueHandler', ',', 'ProgressBar', ')', ':', '___EOS___']", "index": 49 }, { "content": "class StateProgressHandler(BaseProgressHandler):\n uploads = {}\n\n\n\n\n", "metadata": "root.StateProgressHandler", "header": "['module', '___EOS___']", "index": 54 }, { "content": " def __init__(self, state=None, **kwargs):\n assert state is not None, \\\n \"StateProgressHandler requires a state object\"\n self.state = state\n progress = kwargs.pop('progress', 0)\n for seq, key in enumerate(self.state.keys):\n progress += key['size']\n kwargs['progress'] = progress\n super(StateProgressHandler, self).__init__(**kwargs)", "metadata": "root.StateProgressHandler.__init__", "header": "['class', 'StateProgressHandler', '(', 'BaseProgressHandler', ')', ':', '___EOS___']", "index": 57 }, { "content": " def update(self, value=None):\n if value is not None:\n self.state.update(value)\n super(StateProgressHandler, self).update(value)\n getLogger().debug(\"State progress: {}\".format(self.state.progress))", "metadata": "root.StateProgressHandler.update", "header": "['class', 'StateProgressHandler', '(', 'BaseProgressHandler', ')', ':', '___EOS___']", "index": 67 }, { "content": " def __enter__(self):\n type(self).uploads[self.state] = self\n return super(StateProgressHandler, self).__enter__()", "metadata": "root.StateProgressHandler.__enter__", "header": "['class', 'StateProgressHandler', '(', 'BaseProgressHandler', ')', ':', '___EOS___']", "index": 73 }, { "content": " def __exit__(self, cls, value, traceback):\n del type(self).uploads[self.state]", "metadata": "root.StateProgressHandler.__exit__", "header": "['class', 'StateProgressHandler', '(', 'BaseProgressHandler', ')', ':', '___EOS___']", "index": 77 }, { "content": " def keydone(self, msg):\n getLogger().debug(\"saving key \" + str(msg['key']) + \" to state file\")\n self.state.keydone(msg['key'], msg['size'])", "metadata": "root.StateProgressHandler.keydone", "header": "['class', 'StateProgressHandler', '(', 'BaseProgressHandler', ')', ':', '___EOS___']", "index": 80 }, { "content": "class ConsoleProgressHandler(StateProgressHandler):\n\n", "metadata": "root.ConsoleProgressHandler", "header": "['module', '___EOS___']", "index": 85 }, { "content": " def __init__(self, *args, **kwargs):\n fname = kwargs.pop('fname', \"-\")\n kwargs.setdefault('widgets', [fname, ' : ', Bar(), ' ',\n ETA(), ' ', FileTransferSpeed()])\n super(ConsoleProgressHandler, self).__init__(*args, **kwargs)", "metadata": "root.ConsoleProgressHandler.__init__", "header": "['class', 'ConsoleProgressHandler', '(', 'StateProgressHandler', ')', ':', '___EOS___']", "index": 86 }, { "content": " def __enter__(self):\n self.start()\n return super(ConsoleProgressHandler, self).__enter__()", "metadata": "root.ConsoleProgressHandler.__enter__", "header": "['class', 'ConsoleProgressHandler', '(', 'StateProgressHandler', ')', ':', '___EOS___']", "index": 92 }, { "content": " def update(self, value=None):\n super(ConsoleProgressHandler, self).update(value)\n self.fd.flush()", "metadata": "root.ConsoleProgressHandler.update", "header": "['class', 'ConsoleProgressHandler', '(', 'StateProgressHandler', ')', ':', '___EOS___']", "index": 96 }, { "content": "class ServerProgressHandler(StateProgressHandler):\n", "metadata": "root.ServerProgressHandler", "header": "['module', '___EOS___']", "index": 101 }, { "content": " def __init__(self, *args, **kwargs):\n self.eta = \"\"\n kwargs.setdefault('widgets', [])\n kwargs.setdefault('term_width', 0)\n if 'fd' not in kwargs:\n kwargs['fd'] = open(os.devnull, 'w+')\n super(ServerProgressHandler, self).__init__(*args, **kwargs)", "metadata": "root.ServerProgressHandler.__init__", "header": "['class', 'ServerProgressHandler', '(', 'StateProgressHandler', ')', ':', '___EOS___']", "index": 102 }, { "content": " def eta(self):\n if self.currval == 0:\n return ''\n else:\n elapsed = self.seconds_elapsed\n eta = elapsed * self.maxval / self.currval - elapsed\n return self.format_time(eta)", "metadata": "root.ServerProgressHandler.eta", "header": "['class', 'ServerProgressHandler', '(', 'StateProgressHandler', ')', ':', '___EOS___']", "index": 110 }, { "content": "def progressToQueue(queue):\n global progress\n progress = queue", "metadata": "root.progressToQueue", "header": "['module', '___EOS___']", "index": 121 }, { "content": "def make_progress(msg):\n global progress\n progress.put(msg)", "metadata": "root.make_progress", "header": "['module', '___EOS___']", "index": 126 }, { "content": "def save_progress(key, size):\n global progress\n progress.put({'save': True, 'key': key, 'size': size})", "metadata": "root.save_progress", "header": "['module', '___EOS___']", "index": 131 } ]
[]
[]
0
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "multiprocessing_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "progressbar_", "import_", "(_", "Progres", "s", "Bar_", ",_", "Bar_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "ETA", "_", ",_", "File", "Transfer", "Speed_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "lac", "li_", "._", "log_", "import_", "get", "Logger_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "abc_", "import_", "ABC", "Meta_", ",_", "abstractmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "logu", "tils_", "._", "queue_", "import_", "Queue", "Listener_", "\\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\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "progress_", "=_", "None_", "\\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_", "queue", "Handler_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "queue", "Handler_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "\\u\\u", "enter\\u\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "q_", "=_", "multiprocessing_", "._", "Queue_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "listener_", "=_", "Queue", "Listener_", "(_", "q_", ",_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "listener_", "._", "start_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "q_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "queue", "Handler_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "exit\\u\\u_", "(_", "self_", ",_", "type_", ",_", "value_", ",_", "traceback_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "listener_", "._", "stop_", "(_", ")_", "\\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_", "Base", "Progres", "s", "Handler_", "(_", "queue", "Handler_", ",_", "Progres", "s", "Bar_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u\\u", "metaclass\\u\\u_", "=_", "ABC", "Meta_", "\\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_", "Base", "Progres", "s", "Handler_", "(_", "queue", "Handler_", ",_", "Progres", "s", "Bar_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "*_", "args_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "tx_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "progress_", "=_", "kwargs_", "._", "pop_", "(_", "'", "progress", "'_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "super_", "(_", "Base", "Progres", "s", "Handler_", ",_", "self_", ")_", "._", "\\u\\u", "init\\u\\u_", "(_", "*_", "args_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Base", "Progres", "s", "Handler_", "(_", "queue", "Handler_", ",_", "Progres", "s", "Bar_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "update", "\\u", "current_", "(_", "self_", ",_", "msg_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "tx_", "[_", "msg_", "[_", "'", "part", "'_", "]_", "]_", "=_", "int_", "(_", "msg_", "[_", "'", "tx", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "sum_", "(_", "self_", "._", "tx_", "._", "values_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Base", "Progres", "s", "Handler_", "(_", "queue", "Handler_", ",_", "Progres", "s", "Bar_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "save", "\\u", "current_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "progress_", "+=_", "sum_", "(_", "self_", "._", "tx_", "._", "values_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "tx_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Base", "Progres", "s", "Handler_", "(_", "queue", "Handler_", ",_", "Progres", "s", "Bar_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "handle_", "(_", "self_", ",_", "msg_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "'", "part", "'_", "in_", "msg_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "update_", "(_", "self_", "._", "progress_", "+_", "self_", "._", "update", "\\u", "current_", "(_", "msg_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "'", "save", "'_", "in_", "msg_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "keyd", "one_", "(_", "msg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "save", "\\u", "current_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Base", "Progres", "s", "Handler_", "(_", "queue", "Handler_", ",_", "Progres", "s", "Bar_", ")_", ":_", "\\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\\u", "enter\\u\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "q_", "=_", "super_", "(_", "Base", "Progres", "s", "Handler_", ",_", "self_", ")_", "._", "\\u\\u", "enter\\u\\u_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "progress", "To", "Queue_", "(_", "q_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "start_", "(_", "init", "val_", "=_", "self_", "._", "progress_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "q_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Base", "Progres", "s", "Handler_", "(_", "queue", "Handler_", ",_", "Progres", "s", "Bar_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "abstractmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "keyd", "one_", "(_", "self_", ",_", "msg_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "get", "Logger_", "(_", ")_", "._", "debug_", "(_", "\"", "saved", " ", "key", ":", " ", "{", "key", "}", " ", "({", "size", "})\"_", "._", "format_", "(_", "msg_", ")_", ")_", "\\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_", "State", "Progres", "s", "Handler_", "(_", "Base", "Progres", "s", "Handler_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "uploads", "_", "=_", "{_", "}_", "\\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_", "State", "Progres", "s", "Handler_", "(_", "Base", "Progres", "s", "Handler_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "state_", "=_", "None_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "assert_", "state_", "is_", "not_", "None_", ",_", "\"", "State", "Progres", "s", "Handle", "r", " ", "require", "s", " ", "a", " ", "state", " ", "object", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "state_", "=_", "state_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "progress_", "=_", "kwargs_", "._", "pop_", "(_", "'", "progress", "'_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "seq_", ",_", "key_", "in_", "enumerate_", "(_", "self_", "._", "state_", "._", "keys_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "progress_", "+=_", "key_", "[_", "'", "size", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "kwargs_", "[_", "'", "progress", "'_", "]_", "=_", "progress_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "super_", "(_", "State", "Progres", "s", "Handler_", ",_", "self_", ")_", "._", "\\u\\u", "init\\u\\u_", "(_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "State", "Progres", "s", "Handler_", "(_", "Base", "Progres", "s", "Handler_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "update_", "(_", "self_", ",_", "value_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "value_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "state_", "._", "update_", "(_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "super_", "(_", "State", "Progres", "s", "Handler_", ",_", "self_", ")_", "._", "update_", "(_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "get", "Logger_", "(_", ")_", "._", "debug_", "(_", "\"", "State", " ", "progress", ":", " ", "{}\"_", "._", "format_", "(_", "self_", "._", "state_", "._", "progress_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "State", "Progres", "s", "Handler_", "(_", "Base", "Progres", "s", "Handler_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "enter\\u\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "type_", "(_", "self_", ")_", "._", "uploads", "_", "[_", "self_", "._", "state_", "]_", "=_", "self_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "super_", "(_", "State", "Progres", "s", "Handler_", ",_", "self_", ")_", "._", "\\u\\u", "enter\\u\\u_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "State", "Progres", "s", "Handler_", "(_", "Base", "Progres", "s", "Handler_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "exit\\u\\u_", "(_", "self_", ",_", "cls_", ",_", "value_", ",_", "traceback_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "del_", "type_", "(_", "self_", ")_", "._", "uploads", "_", "[_", "self_", "._", "state_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "State", "Progres", "s", "Handler_", "(_", "Base", "Progres", "s", "Handler_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "keyd", "one_", "(_", "self_", ",_", "msg_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "get", "Logger_", "(_", ")_", "._", "debug_", "(_", "\"", "saving", " ", "key", " ", "\"_", "+_", "str_", "(_", "msg_", "[_", "'", "key", "'_", "]_", ")_", "+_", "\"", " ", "to", " ", "state", " ", "file", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "state_", "._", "keyd", "one_", "(_", "msg_", "[_", "'", "key", "'_", "]_", ",_", "msg_", "[_", "'", "size", "'_", "]_", ")_", "\\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_", "Cons", "ole", "Progres", "s", "Handler_", "(_", "State", "Progres", "s", "Handler_", ")_", ":_", "\\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_", "Cons", "ole", "Progres", "s", "Handler_", "(_", "State", "Progres", "s", "Handler_", ")_", ":_", "\\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 ", " _", "fname_", "=_", "kwargs_", "._", "pop_", "(_", "'", "fname", "'_", ",_", "\"-\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "kwargs_", "._", "setdefault_", "(_", "'", "widget", "s", "'_", ",_", "[_", "fname_", ",_", "'", " ", ":", " ", "'_", ",_", "Bar_", "(_", ")_", ",_", "'", " ", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "ETA", "_", "(_", ")_", ",_", "'", " ", "'_", ",_", "File", "Transfer", "Speed_", "(_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "super_", "(_", "Cons", "ole", "Progres", "s", "Handler_", ",_", "self_", ")_", "._", "\\u\\u", "init\\u\\u_", "(_", "*_", "args_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Cons", "ole", "Progres", "s", "Handler_", "(_", "State", "Progres", "s", "Handler_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "enter\\u\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "start_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "super_", "(_", "Cons", "ole", "Progres", "s", "Handler_", ",_", "self_", ")_", "._", "\\u\\u", "enter\\u\\u_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Cons", "ole", "Progres", "s", "Handler_", "(_", "State", "Progres", "s", "Handler_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "update_", "(_", "self_", ",_", "value_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "super_", "(_", "Cons", "ole", "Progres", "s", "Handler_", ",_", "self_", ")_", "._", "update_", "(_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "fd_", "._", "flush_", "(_", ")_", "\\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_", "Server", "Progres", "s", "Handler_", "(_", "State", "Progres", "s", "Handler_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Server", "Progres", "s", "Handler_", "(_", "State", "Progres", "s", "Handler_", ")_", ":_", "\\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 ", " _", "self_", "._", "eta_", "=_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "kwargs_", "._", "setdefault_", "(_", "'", "widget", "s", "'_", ",_", "[_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "kwargs_", "._", "setdefault_", "(_", "'", "term", "\\u", "widt", "h", "'_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "'", "fd", "'_", "not_", "in_", "kwargs_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "kwargs_", "[_", "'", "fd", "'_", "]_", "=_", "open_", "(_", "os_", "._", "devnull_", ",_", "'", "w", "+'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "super_", "(_", "Server", "Progres", "s", "Handler_", ",_", "self_", ")_", "._", "\\u\\u", "init\\u\\u_", "(_", "*_", "args_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Server", "Progres", "s", "Handler_", "(_", "State", "Progres", "s", "Handler_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "eta_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "curr", "val_", "==_", "0_", ":_", "\\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_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "elapsed_", "=_", "self_", "._", "second", "s", "\\u", "elapsed_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "eta_", "=_", "elapsed_", "*_", "self_", "._", "maxval_", "/_", "self_", "._", "curr", "val_", "-_", "elapsed_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "format\\u", "time_", "(_", "eta_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "progress", "To", "Queue_", "(_", "queue_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "global_", "progress_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "progress_", "=_", "queue_", "\\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", "progress_", "(_", "msg_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "global_", "progress_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "progress_", "._", "put_", "(_", "msg_", ")_", "\\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", "\\u", "progress_", "(_", "key_", ",_", "size_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "global_", "progress_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "progress_", "._", "put_", "(_", "{_", "'", "save", "'_", ":_", "True_", ",_", "'", "key", "'_", ":_", "key_", ",_", "'", "size", "'_", ":_", "size_", "}_", ")_" ]
[ 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, 4, 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, 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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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 ]
Unused import
AppScale/appscale/AppServer/lib/django-0.96/django/middleware/http.py
[ { "content": "import datetime\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class ConditionalGetMiddleware(object):\n \"\"\"\n Handles conditional GET operations. If the response has a ETag or\n Last-Modified header, and the request has If-None-Match or\n If-Modified-Since, the response is replaced by an HttpNotModified.\n\n Removes the content from any response to a HEAD request.\n\n Also sets the Date and Content-Length response-headers.\n \"\"\"", "metadata": "root.ConditionalGetMiddleware", "header": "['module', '___EOS___']", "index": 2 }, { "content": " def process_response(self, request, response):\n now = datetime.datetime.utcnow()\n response['Date'] = now.strftime('%a, %d %b %Y %H:%M:%S GMT')\n if not response.has_header('Content-Length'):\n response['Content-Length'] = str(len(response.content))\n\n if response.has_header('ETag'):\n if_none_match = request.META.get('HTTP_IF_NONE_MATCH', None)\n if if_none_match == response['ETag']:\n response.status_code = 304\n response.content = ''\n response['Content-Length'] = '0'\n\n if response.has_header('Last-Modified'):\n last_mod = response['Last-Modified']\n if_modified_since = request.META.get('HTTP_IF_MODIFIED_SINCE', None)\n if if_modified_since == response['Last-Modified']:\n response.status_code = 304\n response.content = ''\n response['Content-Length'] = '0'\n\n if request.method == 'HEAD':\n response.content = ''\n\n return response", "metadata": "root.ConditionalGetMiddleware.process_response", "header": "['class', 'ConditionalGetMiddleware', '(', 'object', ')', ':', '___EOS___']", "index": 12 }, { "content": "class SetRemoteAddrFromForwardedFor(object):\n \"\"\"\n Middleware that sets REMOTE_ADDR based on HTTP_X_FORWARDED_FOR, if the\n latter is set. This is useful if you're sitting behind a reverse proxy that\n causes each request's REMOTE_ADDR to be set to 127.0.0.1.\n\n Note that this does NOT validate HTTP_X_FORWARDED_FOR. If you're not behind\n a reverse proxy that sets HTTP_X_FORWARDED_FOR automatically, do not use\n this middleware. Anybody can spoof the value of HTTP_X_FORWARDED_FOR, and\n because this sets REMOTE_ADDR based on HTTP_X_FORWARDED_FOR, that means\n anybody can \"fake\" their IP address. Only use this when you can absolutely\n trust the value of HTTP_X_FORWARDED_FOR.\n \"\"\"", "metadata": "root.SetRemoteAddrFromForwardedFor", "header": "['module', '___EOS___']", "index": 38 }, { "content": " def process_request(self, request):\n try:\n real_ip = request.META['HTTP_X_FORWARDED_FOR']\n except KeyError:\n return None\n else:\n # HTTP_X_FORWARDED_FOR can be a comma-separated list of IPs.\n # Take just the first one.\n real_ip = real_ip.split(\",\")[0]\n request.META['REMOTE_ADDR'] = real_ip", "metadata": "root.SetRemoteAddrFromForwardedFor.process_request", "header": "['class', 'SetRemoteAddrFromForwardedFor', '(', 'object', ')', ':', '___EOS___']", "index": 51 } ]
[]
[]
0
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "import_", "datetime_", "\\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_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Cond", "itional", "Get", "Middleware_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Handle", "s", " ", "conditional", " ", "GET", " ", "operati", "ons", ".", " ", "If", " ", "the", " ", "response", " ", "has", " ", "a", " ", "ET", "ag", " ", "or", "\\", "10", ";", " ", " ", " ", " ", "Las", "t", "-", "Modifie", "d", " ", "header", ",", " ", "and", " ", "the", " ", "request", " ", "has", " ", "If", "-", "Non", "e-", "Match", " ", "or", "\\", "10", ";", " ", " ", " ", " ", "If", "-", "Modifie", "d", "-", "Sin", "ce", ",", " ", "the", " ", "response", " ", "is", " ", "replaced", " ", "by", " ", "an", " ", "Http", "Not", "Modifie", "d", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Remove", "s", " ", "the", " ", "content", " ", "from", " ", "any", " ", "response", " ", "to", " ", "a", " ", "HEAD", " ", "request", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Al", "so", " ", "sets", " ", "the", " ", "Date", " ", "and", " ", "Conten", "t", "-", "Length", " ", "response", "-", "header", "s", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Cond", "itional", "Get", "Middleware_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "process", "\\u", "response_", "(_", "self_", ",_", "request_", ",_", "response_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "now_", "=_", "datetime_", "._", "datetime_", "._", "utcnow_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "[_", "'", "Date", "'_", "]_", "=_", "now_", "._", "strftime_", "(_", "'%", "a", ",", " ", "%", "d", " ", "%", "b", " ", "%", "Y", " ", "%", "H", ":", "%", "M", ":", "%", "S", " ", "GM", "T", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "response_", "._", "has", "\\u", "header_", "(_", "'", "Conten", "t", "-", "Length", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "response_", "[_", "'", "Conten", "t", "-", "Length", "'_", "]_", "=_", "str_", "(_", "len_", "(_", "response_", "._", "content_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "response_", "._", "has", "\\u", "header_", "(_", "'", "ET", "ag", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if", "\\u", "none", "\\u", "match_", "=_", "request_", "._", "META_", "._", "get_", "(_", "'", "HTTP", "\\u", "IF", "\\u", "NON", "E", "\\u", "MATCH", "'_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "if", "\\u", "none", "\\u", "match_", "==_", "response_", "[_", "'", "ET", "ag", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "response_", "._", "status", "\\u", "code_", "=_", "304_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "._", "content_", "=_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "[_", "'", "Conten", "t", "-", "Length", "'_", "]_", "=_", "'", "0", "'_", "\\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_", "response_", "._", "has", "\\u", "header_", "(_", "'", "Las", "t", "-", "Modifie", "d", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "last", "\\u", "mod_", "=_", "response_", "[_", "'", "Las", "t", "-", "Modifie", "d", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if", "\\u", "modifi", "ed", "\\u", "since_", "=_", "request_", "._", "META_", "._", "get_", "(_", "'", "HTTP", "\\u", "IF", "\\u", "MODIFIE", "D", "\\u", "SIN", "CE", "'_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "if", "\\u", "modifi", "ed", "\\u", "since_", "==_", "response_", "[_", "'", "Las", "t", "-", "Modifie", "d", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "response_", "._", "status", "\\u", "code_", "=_", "304_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "._", "content_", "=_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "[_", "'", "Conten", "t", "-", "Length", "'_", "]_", "=_", "'", "0", "'_", "\\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_", "request_", "._", "method_", "==_", "'", "HEAD", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "response_", "._", "content_", "=_", "''_", "\\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_", "[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_", "Set", "Remo", "te", "Add", "r", "Fro", "m", "Forward", "ed", "For_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Mid", "dle", "ware", " ", "tha", "t", " ", "sets", " ", "REMO", "TE", "\\u", "ADDR", " ", "based", " ", "on", " ", "HTTP", "\\u", "X", "\\u", "FORWARD", "ED", "\\u", "FOR", ",", " ", "if", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "latt", "er", " ", "is", " ", "set", ".", " ", "Thi", "s", " ", "is", " ", "usef", "ul", " ", "if", " ", "you", "'", "re", " ", "sit", "ting", " ", "beh", "ind", " ", "a", " ", "reverse", " ", "proxy", " ", "tha", "t", "\\", "10", ";", " ", " ", " ", " ", "caus", "es", " ", "each", " ", "request", "'", "s", " ", "REMO", "TE", "\\u", "ADDR", " ", "to", " ", "be", " ", "set", " ", "to", " ", "127", ".0", ".0", ".1", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Not", "e", " ", "tha", "t", " ", "this", " ", "doe", "s", " ", "NOT", " ", "validat", "e", " ", "HTTP", "\\u", "X", "\\u", "FORWARD", "ED", "\\u", "FOR", ".", " ", "If", " ", "you", "'", "re", " ", "not", " ", "beh", "ind", "\\", "10", ";", " ", " ", " ", " ", "a", " ", "reverse", " ", "proxy", " ", "tha", "t", " ", "sets", " ", "HTTP", "\\u", "X", "\\u", "FORWARD", "ED", "\\u", "FOR", " ", "automati", "call", "y", ",", " ", "do", " ", "not", " ", "use", "\\", "10", ";", " ", " ", " ", " ", "this", " ", "middle", "ware", ".", " ", "Any", "body", " ", "can", " ", "spoo", "f", " ", "the", " ", "value", " ", "of", " ", "HTTP", "\\u", "X", "\\u", "FORWARD", "ED", "\\u", "FOR", ",", " ", "and", "\\", "10", ";", " ", " ", " ", " ", "bec", "aus", "e", " ", "this", " ", "sets", " ", "REMO", "TE", "\\u", "ADDR", " ", "based", " ", "on", " ", "HTTP", "\\u", "X", "\\u", "FORWARD", "ED", "\\u", "FOR", ",", " ", "tha", "t", " ", "means", "\\", "10", ";", " ", " ", " ", " ", "any", "body", " ", "can", " ", "\"", "fake", "\"", " ", "thei", "r", " ", "IP", " ", "address", ".", " ", "On", "ly", " ", "use", " ", "this", " ", "whe", "n", " ", "you", " ", "can", " ", "abs", "olute", "ly", "\\", "10", ";", " ", " ", " ", " ", "trust", " ", "the", " ", "value", " ", "of", " ", "HTTP", "\\u", "X", "\\u", "FORWARD", "ED", "\\u", "FOR", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Set", "Remo", "te", "Add", "r", "Fro", "m", "Forward", "ed", "For_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "process", "\\u", "request_", "(_", "self_", ",_", "request_", ")_", ":_", "\\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 ", " _", "real", "\\u", "ip_", "=_", "request_", "._", "META_", "[_", "'", "HTTP", "\\u", "X", "\\u", "FORWARD", "ED", "\\u", "FOR", "'_", "]_", "\\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_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "HTTP", "\\u", "X", "\\u", "FORWARD", "ED", "\\u", "FOR", " ", "can", " ", "be", " ", "a", " ", "comma", "-", "separate", "d", " ", "list", " ", "of", " ", "IP", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Tak", "e", " ", "just", " ", "the", " ", "first", " ", "one", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "real", "\\u", "ip_", "=_", "real", "\\u", "ip_", "._", "split_", "(_", "\",\"_", ")_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "request_", "._", "META_", "[_", "'", "REMO", "TE", "\\u", "ADDR", "'_", "]_", "=_", "real", "\\u", "ip_" ]
[ 4, 4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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 ]
Unused import
divio/django-cms/cms/admin/permissionadmin.py
[ { "content": "# -*- coding: utf-8 -*-\nfrom copy import deepcopy\nfrom django.contrib import admin\nfrom django.contrib.admin import site\nfrom django.contrib.auth import get_user_model, get_permission_codename\nfrom django.contrib.auth.admin import UserAdmin\nfrom django.db import OperationalError\nfrom django.utils.translation import ugettext, ugettext_lazy as _\n\nfrom cms.admin.forms import GlobalPagePermissionAdminForm, PagePermissionInlineAdminForm, ViewRestrictionInlineAdminForm\nfrom cms.exceptions import NoPermissionsException\nfrom cms.models import Page, PagePermission, GlobalPagePermission, PageUser\nfrom cms.utils.conf import get_cms_setting\nfrom cms.utils.helpers import classproperty\nfrom cms.utils.permissions import get_user_permission_level\n\nPERMISSION_ADMIN_INLINES = []\n\nuser_model = get_user_model()\nadmin_class = UserAdmin\nfor model, admin_instance in site._registry.items():\n if model == user_model:\n admin_class = admin_instance.__class__\n\n\n\n\n\n\n\n\n\n\n\n\nif get_cms_setting('PERMISSION'):\n admin.site.register(GlobalPagePermission, GlobalPagePermissionAdmin)\n PERMISSION_ADMIN_INLINES.extend([\n ViewRestrictionInlineAdmin,\n PagePermissionInlineAdmin,\n ])\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class TabularInline(admin.TabularInline):\n pass", "metadata": "root.TabularInline", "header": "['module', '___EOS___']", "index": 25 }, { "content": "class PagePermissionInlineAdmin(TabularInline):\n model = PagePermission\n # use special form, so we can override of user and group field\n form = PagePermissionInlineAdminForm\n classes = ['collapse', 'collapsed']\n exclude = ['can_view']\n extra = 0 # edit page load time boost\n\n\n", "metadata": "root.PagePermissionInlineAdmin", "header": "['module', '___EOS___']", "index": 29 }, { "content": " @classproperty\n def raw_id_fields(cls):\n # Dynamically set raw_id_fields based on settings\n threshold = get_cms_setting('RAW_ID_USERS')\n\n # Given a fresh django-cms install and a django settings with the\n # CMS_RAW_ID_USERS = CMS_PERMISSION = True\n # django throws an OperationalError when running\n # ./manage migrate\n # because auth_user doesn't exists yet\n try:\n threshold = threshold and get_user_model().objects.count() > threshold\n except OperationalError:\n threshold = False\n\n return ['user'] if threshold else []", "metadata": "root.PagePermissionInlineAdmin.raw_id_fields", "header": "['class', 'PagePermissionInlineAdmin', '(', 'TabularInline', ')', ':', '___EOS___']", "index": 37 }, { "content": " def get_queryset(self, request):\n \"\"\"\n Queryset change, so user with global change permissions can see\n all permissions. Otherwise can user see only permissions for\n peoples which are under him (he can't see his permissions, because\n this will lead to violation, when he can add more power to itself)\n \"\"\"\n # can see only permissions for users which are under him in tree\n\n # here an exception can be thrown\n try:\n qs = self.model.objects.subordinate_to_user(request.user)\n return qs.filter(can_view=False)\n except NoPermissionsException:\n return self.objects.get_empty_query_set()", "metadata": "root.PagePermissionInlineAdmin.get_queryset", "header": "['class', 'PagePermissionInlineAdmin', '(', 'TabularInline', ')', ':', '___EOS___']", "index": 54 }, { "content": " def get_formset(self, request, obj=None, **kwargs):\n \"\"\"\n Some fields may be excluded here. User can change only\n permissions which are available for him. E.g. if user does not haves\n can_publish flag, he can't change assign can_publish permissions.\n \"\"\"\n exclude = self.exclude or []\n if obj:\n if not obj.has_add_permission(request):\n exclude.append('can_add')\n if not obj.has_delete_permission(request):\n exclude.append('can_delete')\n if not obj.has_publish_permission(request):\n exclude.append('can_publish')\n if not obj.has_advanced_settings_permission(request):\n exclude.append('can_change_advanced_settings')\n if not obj.has_move_page_permission(request):\n exclude.append('can_move_page')\n formset_cls = super(PagePermissionInlineAdmin, self\n ).get_formset(request, obj=None, exclude=exclude, **kwargs)\n qs = self.get_queryset(request)\n if obj is not None:\n qs = qs.filter(page=obj)\n formset_cls._queryset = qs\n return formset_cls", "metadata": "root.PagePermissionInlineAdmin.get_formset", "header": "['class', 'PagePermissionInlineAdmin', '(', 'TabularInline', ')', ':', '___EOS___']", "index": 70 }, { "content": "class ViewRestrictionInlineAdmin(PagePermissionInlineAdmin):\n extra = 0 # edit page load time boost\n form = ViewRestrictionInlineAdminForm\n verbose_name = _(\"View restriction\")\n verbose_name_plural = _(\"View restrictions\")\n exclude = [\n 'can_add', 'can_change', 'can_delete', 'can_view',\n 'can_publish', 'can_change_advanced_settings', 'can_move_page',\n 'can_change_permissions'\n ]\n\n", "metadata": "root.ViewRestrictionInlineAdmin", "header": "['module', '___EOS___']", "index": 97 }, { "content": " def get_formset(self, request, obj=None, **kwargs):\n \"\"\"\n Some fields may be excluded here. User can change only permissions\n which are available for him. E.g. if user does not haves can_publish\n flag, he can't change assign can_publish permissions.\n \"\"\"\n formset_cls = super(PagePermissionInlineAdmin, self).get_formset(request, obj, **kwargs)\n qs = self.get_queryset(request)\n if obj is not None:\n qs = qs.filter(page=obj)\n formset_cls._queryset = qs\n return formset_cls", "metadata": "root.ViewRestrictionInlineAdmin.get_formset", "header": "['class', 'ViewRestrictionInlineAdmin', '(', 'PagePermissionInlineAdmin', ')', ':', '___EOS___']", "index": 108 }, { "content": " def get_queryset(self, request):\n \"\"\"\n Returns a QuerySet of all model instances that can be edited by the\n admin site. This is used by changelist_view.\n \"\"\"\n qs = self.model.objects.subordinate_to_user(request.user)\n return qs.filter(can_view=True)", "metadata": "root.ViewRestrictionInlineAdmin.get_queryset", "header": "['class', 'ViewRestrictionInlineAdmin', '(', 'PagePermissionInlineAdmin', ')', ':', '___EOS___']", "index": 121 }, { "content": "class GlobalPagePermissionAdmin(admin.ModelAdmin):\n list_display = ['user', 'group', 'can_change', 'can_delete', 'can_publish', 'can_change_permissions']\n list_filter = ['user', 'group', 'can_change', 'can_delete', 'can_publish', 'can_change_permissions']\n\n form = GlobalPagePermissionAdminForm\n search_fields = []\n for field in admin_class.search_fields:\n search_fields.append(\"user__%s\" % field)\n search_fields.append('group__name')\n\n exclude = []\n\n list_display.append('can_change_advanced_settings')\n list_filter.append('can_change_advanced_settings')\n\n", "metadata": "root.GlobalPagePermissionAdmin", "header": "['module', '___EOS___']", "index": 130 }, { "content": " def get_list_filter(self, request):\n threshold = get_cms_setting('RAW_ID_USERS')\n try:\n threshold = threshold and get_user_model().objects.count() > threshold\n except OperationalError:\n threshold = False\n filter_copy = deepcopy(self.list_filter)\n if threshold:\n filter_copy.remove('user')\n return filter_copy", "metadata": "root.GlobalPagePermissionAdmin.get_list_filter", "header": "['class', 'GlobalPagePermissionAdmin', '(', 'admin', '.', 'ModelAdmin', ')', ':', '___EOS___']", "index": 145 }, { "content": " @classproperty\n def raw_id_fields(cls):\n # Dynamically set raw_id_fields based on settings\n threshold = get_cms_setting('RAW_ID_USERS')\n\n # Given a fresh django-cms install and a django settings with the\n # CMS_RAW_ID_USERS = CMS_PERMISSION = True\n # django throws an OperationalError when running\n # ./manage migrate\n # because auth_user doesn't exists yet\n try:\n threshold = threshold and get_user_model().objects.count() > threshold\n except OperationalError:\n threshold = False\n\n return ['user'] if threshold else []", "metadata": "root.GlobalPagePermissionAdmin.raw_id_fields", "header": "['class', 'GlobalPagePermissionAdmin', '(', 'admin', '.', 'ModelAdmin', ')', ':', '___EOS___']", "index": 156 }, { "content": "class GenericCmsPermissionAdmin(object):\n \"\"\"\n Custom mixin for permission-enabled admin interfaces.\n \"\"\"\n\n\n\n", "metadata": "root.GenericCmsPermissionAdmin", "header": "['module', '___EOS___']", "index": 174 }, { "content": " def update_permission_fieldsets(self, request, obj=None):\n \"\"\"\n Nobody can grant more than he haves, so check for user permissions\n to Page and User model and render fieldset depending on them.\n \"\"\"\n fieldsets = deepcopy(self.fieldsets)\n perm_models = (\n (Page, ugettext('Page permissions')),\n (PageUser, ugettext('User & Group permissions')),\n (PagePermission, ugettext('Page permissions management')),\n )\n for i, perm_model in enumerate(perm_models):\n model, title = perm_model\n opts, fields = model._meta, []\n name = model.__name__.lower()\n for key in ('add', 'change', 'delete'):\n perm_code = '%s.%s' % (opts.app_label, get_permission_codename(key, opts))\n if request.user.has_perm(perm_code):\n fields.append('can_%s_%s' % (key, name))\n if fields:\n fieldsets.insert(2 + i, (title, {'fields': (fields,)}))\n return fieldsets", "metadata": "root.GenericCmsPermissionAdmin.update_permission_fieldsets", "header": "['class', 'GenericCmsPermissionAdmin', '(', 'object', ')', ':', '___EOS___']", "index": 179 }, { "content": " def _has_change_permissions_permission(self, request):\n \"\"\"\n User is able to add/change objects only if he haves can change\n permission on some page.\n \"\"\"\n try:\n get_user_permission_level(request.user)\n except NoPermissionsException:\n return False\n return True", "metadata": "root.GenericCmsPermissionAdmin._has_change_permissions_permission", "header": "['class', 'GenericCmsPermissionAdmin', '(', 'object', ')', ':', '___EOS___']", "index": 202 }, { "content": " def has_add_permission(self, request):\n return self._has_change_permissions_permission(request) and \\\n super(self.__class__, self).has_add_permission(request)", "metadata": "root.GenericCmsPermissionAdmin.has_add_permission", "header": "['class', 'GenericCmsPermissionAdmin', '(', 'object', ')', ':', '___EOS___']", "index": 213 }, { "content": " def has_change_permission(self, request, obj=None):\n return self._has_change_permissions_permission(request) and \\\n super(self.__class__, self).has_change_permission(request, obj)", "metadata": "root.GenericCmsPermissionAdmin.has_change_permission", "header": "['class', 'GenericCmsPermissionAdmin', '(', 'object', ')', ':', '___EOS___']", "index": 217 } ]
[]
[]
0
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "-*-", " ", "codi", "ng", ":", " ", "utf", "-", "8", " ", "-*-", "_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "copy_", "import_", "deepcopy_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "contrib_", "import_", "admin_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "contrib_", "._", "admin_", "import_", "site_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "contrib_", "._", "auth_", "import_", "get", "\\u", "user", "\\u", "model_", ",_", "get", "\\u", "permissi", "on", "\\u", "codename_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "contrib_", "._", "auth_", "._", "admin_", "import_", "User", "Admin_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "db_", "import_", "Opera", "tion", "al", "Error_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "utils_", "._", "translation_", "import_", "ugettext_", ",_", "uge", "ttext", "\\u", "lazy_", "as_", "\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "cms_", "._", "admin_", "._", "forms_", "import_", "Global", "Page", "Permi", "ssion", "Admi", "n", "Form_", ",_", "Page", "Permi", "ssion", "In", "line", "Admi", "n", "Form_", ",_", "View", "Restriction", "In", "line", "Admi", "n", "Form_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "cms_", "._", "exceptions_", "import_", "No", "Permi", "ssion", "s", "Exception_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "cms_", "._", "models_", "import_", "Page_", ",_", "Page", "Permission_", ",_", "Global", "Page", "Permission_", ",_", "Page", "User_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "cms_", "._", "utils_", "._", "conf_", "import_", "get", "\\u", "cms", "\\u", "setting_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "cms_", "._", "utils_", "._", "helpers_", "import_", "class", "property_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "cms_", "._", "utils_", "._", "permissions_", "import_", "get", "\\u", "user", "\\u", "permissi", "on", "\\u", "level_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "PERMISSION", "\\u", "ADM", "IN", "\\u", "IN", "LINES_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "user", "\\u", "model_", "=_", "get", "\\u", "user", "\\u", "model_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "admin", "\\u", "class_", "=_", "User", "Admin_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "model_", ",_", "admin", "\\u", "instance_", "in_", "site_", "._", "\\u", "registry_", "._", "items_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "model_", "==_", "user", "\\u", "model_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "admin", "\\u", "class_", "=_", "admin", "\\u", "instance_", "._", "\\u\\u", "class\\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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "get", "\\u", "cms", "\\u", "setting_", "(_", "'", "PERMISSION", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "admin_", "._", "site_", "._", "register_", "(_", "Global", "Page", "Permission_", ",_", "Global", "Page", "Permi", "ssion", "Admin_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "PERMISSION", "\\u", "ADM", "IN", "\\u", "IN", "LINES_", "._", "extend_", "(_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "View", "Restriction", "In", "line", "Admin_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Page", "Permi", "ssion", "In", "line", "Admin_", ",_", "\\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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Tab", "ular", "Inline_", "(_", "admin_", "._", "Tab", "ular", "Inline_", ")_", ":_", "\\u\\u\\uNEWLINE\\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_", "Page", "Permi", "ssion", "In", "line", "Admin_", "(_", "Tab", "ular", "Inline_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "model_", "=_", "Page", "Permission_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "use", " ", "special", " ", "form", ",", " ", "so", " ", "we", " ", "can", " ", "override", " ", "of", " ", "user", " ", "and", " ", "group", " ", "field_", "\\u\\u\\uNL\\u\\u\\u_", "form_", "=_", "Page", "Permi", "ssion", "In", "line", "Admi", "n", "Form_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "classes_", "=_", "[_", "'", "collapse", "'_", ",_", "'", "collapsed", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "exclude_", "=_", "[_", "'", "can", "\\u", "view", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "extra_", "=_", "0_", "#", " ", "edit", " ", "page", " ", "load", " ", "time", " ", "boost", "_", "\\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_", "Page", "Permi", "ssion", "In", "line", "Admin_", "(_", "Tab", "ular", "Inline_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "@_", "class", "property_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "raw", "\\u", "id", "\\u", "fields_", "(_", "cls_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Dynamic", "ally", " ", "set", " ", "raw", "\\u", "id", "\\u", "fields", " ", "based", " ", "on", " ", "settings_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "threshold_", "=_", "get", "\\u", "cms", "\\u", "setting_", "(_", "'", "RA", "W", "\\u", "ID", "\\u", "USERS", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Give", "n", " ", "a", " ", "fresh", " ", "django", "-", "cms", " ", "install", " ", "and", " ", "a", " ", "django", " ", "settings", " ", "with", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "CMS", "\\u", "RA", "W", "\\u", "ID", "\\u", "USERS", " ", "=", " ", "CMS", "\\u", "PERMISSION", " ", "=", " ", "True_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "django", " ", "throw", "s", " ", "an", " ", "Opera", "tion", "al", "Error", " ", "whe", "n", " ", "running_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "./", "manage", " ", "migrate_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "bec", "aus", "e", " ", "auth", "\\u", "user", " ", "doe", "sn", "'", "t", " ", "exist", "s", " ", "ye", "t_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "threshold_", "=_", "threshold_", "and_", "get", "\\u", "user", "\\u", "model_", "(_", ")_", "._", "objects_", "._", "count_", "(_", ")_", ">_", "threshold_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Opera", "tion", "al", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "threshold_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "[_", "'", "user", "'_", "]_", "if_", "threshold_", "else_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Page", "Permi", "ssion", "In", "line", "Admin_", "(_", "Tab", "ular", "Inline_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "queryset_", "(_", "self_", ",_", "request_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Query", "set", " ", "change", ",", " ", "so", " ", "user", " ", "with", " ", "global", " ", "change", " ", "permissi", "ons", " ", "can", " ", "see", "\\", "10", ";", " ", " ", " ", " ", "all", " ", "permissi", "ons", ".", " ", "Ot", "her", "wis", "e", " ", "can", " ", "user", " ", "see", " ", "only", " ", "permissi", "ons", " ", "for", "\\", "10", ";", " ", " ", " ", " ", "people", "s", " ", "whi", "ch", " ", "are", " ", "under", " ", "him", " ", "(", "he", " ", "can", "'", "t", " ", "see", " ", "his", " ", "permissi", "ons", ",", " ", "bec", "aus", "e", "\\", "10", ";", " ", " ", " ", " ", "this", " ", "will", " ", "lead", " ", "to", " ", "violation", ",", " ", "whe", "n", " ", "he", " ", "can", " ", "add", " ", "more", " ", "power", " ", "to", " ", "its", "elf", ")", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "can", " ", "see", " ", "only", " ", "permissi", "ons", " ", "for", " ", "users", " ", "whi", "ch", " ", "are", " ", "under", " ", "him", " ", "in", " ", "tree_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "here", " ", "an", " ", "exception", " ", "can", " ", "be", " ", "throw", "n_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "qs_", "=_", "self_", "._", "model_", "._", "objects_", "._", "subo", "rdin", "ate", "\\u", "to", "\\u", "user_", "(_", "request_", "._", "user_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "qs_", "._", "filter_", "(_", "can", "\\u", "view_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "No", "Permi", "ssion", "s", "Exception_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "objects_", "._", "get", "\\u", "empty", "\\u", "query", "\\u", "set_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Page", "Permi", "ssion", "In", "line", "Admin_", "(_", "Tab", "ular", "Inline_", ")_", ":_", "\\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", "formset_", "(_", "self_", ",_", "request_", ",_", "obj_", "=_", "None_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Some", " ", "fields", " ", "may", " ", "be", " ", "exclu", "ded", " ", "here", ".", " ", "User", " ", "can", " ", "change", " ", "only", "\\", "10", ";", " ", " ", " ", " ", "permissi", "ons", " ", "whi", "ch", " ", "are", " ", "avail", "able", " ", "for", " ", "him", ".", " ", "E", ".", "g", ".", " ", "if", " ", "user", " ", "doe", "s", " ", "not", " ", "have", "s", "\\", "10", ";", " ", " ", " ", " ", "can", "\\u", "publi", "sh", " ", "flag", ",", " ", "he", " ", "can", "'", "t", " ", "change", " ", "assign", " ", "can", "\\u", "publi", "sh", " ", "permissi", "ons", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "exclude_", "=_", "self_", "._", "exclude_", "or_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "obj_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "obj_", "._", "has", "\\u", "add", "\\u", "permission_", "(_", "request_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "exclude_", "._", "append_", "(_", "'", "can", "\\u", "add", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "obj_", "._", "has", "\\u", "delete", "\\u", "permission_", "(_", "request_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "exclude_", "._", "append_", "(_", "'", "can", "\\u", "delete", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "obj_", "._", "has", "\\u", "publi", "sh", "\\u", "permission_", "(_", "request_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "exclude_", "._", "append_", "(_", "'", "can", "\\u", "publi", "sh", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "obj_", "._", "has", "\\u", "advanced", "\\u", "settings", "\\u", "permission_", "(_", "request_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "exclude_", "._", "append_", "(_", "'", "can", "\\u", "change", "\\u", "advanced", "\\u", "settings", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "obj_", "._", "has", "\\u", "move", "\\u", "page", "\\u", "permission_", "(_", "request_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "exclude_", "._", "append_", "(_", "'", "can", "\\u", "move", "\\u", "page", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "formset", "\\u", "cls_", "=_", "super_", "(_", "Page", "Permi", "ssion", "In", "line", "Admin_", ",_", "self_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "._", "get", "\\u", "formset_", "(_", "request_", ",_", "obj_", "=_", "None_", ",_", "exclude_", "=_", "exclude_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "qs_", "=_", "self_", "._", "get", "\\u", "queryset_", "(_", "request_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "obj_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "qs_", "=_", "qs_", "._", "filter_", "(_", "page_", "=_", "obj_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "formset", "\\u", "cls_", "._", "\\u", "queryset_", "=_", "qs_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "formset", "\\u", "cls_", "\\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_", "View", "Restriction", "In", "line", "Admin_", "(_", "Page", "Permi", "ssion", "In", "line", "Admin_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "extra_", "=_", "0_", "#", " ", "edit", " ", "page", " ", "load", " ", "time", " ", "boost", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "form_", "=_", "View", "Restriction", "In", "line", "Admi", "n", "Form_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "verbo", "se", "\\u", "name_", "=_", "\\u_", "(_", "\"", "View", " ", "restriction", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "verbo", "se", "\\u", "name", "\\u", "plural_", "=_", "\\u_", "(_", "\"", "View", " ", "restriction", "s", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "exclude_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "'", "can", "\\u", "add", "'_", ",_", "'", "can", "\\u", "change", "'_", ",_", "'", "can", "\\u", "delete", "'_", ",_", "'", "can", "\\u", "view", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "can", "\\u", "publi", "sh", "'_", ",_", "'", "can", "\\u", "change", "\\u", "advanced", "\\u", "settings", "'_", ",_", "'", "can", "\\u", "move", "\\u", "page", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "can", "\\u", "change", "\\u", "permissi", "ons", "'_", "\\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_", "View", "Restriction", "In", "line", "Admin_", "(_", "Page", "Permi", "ssion", "In", "line", "Admin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "get", "\\u", "formset_", "(_", "self_", ",_", "request_", ",_", "obj_", "=_", "None_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Some", " ", "fields", " ", "may", " ", "be", " ", "exclu", "ded", " ", "here", ".", " ", "User", " ", "can", " ", "change", " ", "only", " ", "permissi", "ons", "\\", "10", ";", " ", " ", " ", " ", "whi", "ch", " ", "are", " ", "avail", "able", " ", "for", " ", "him", ".", " ", "E", ".", "g", ".", " ", "if", " ", "user", " ", "doe", "s", " ", "not", " ", "have", "s", " ", "can", "\\u", "publi", "sh", "\\", "10", ";", " ", " ", " ", " ", "flag", ",", " ", "he", " ", "can", "'", "t", " ", "change", " ", "assign", " ", "can", "\\u", "publi", "sh", " ", "permissi", "ons", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "formset", "\\u", "cls_", "=_", "super_", "(_", "Page", "Permi", "ssion", "In", "line", "Admin_", ",_", "self_", ")_", "._", "get", "\\u", "formset_", "(_", "request_", ",_", "obj_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "qs_", "=_", "self_", "._", "get", "\\u", "queryset_", "(_", "request_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "obj_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "qs_", "=_", "qs_", "._", "filter_", "(_", "page_", "=_", "obj_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "formset", "\\u", "cls_", "._", "\\u", "queryset_", "=_", "qs_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "formset", "\\u", "cls_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "View", "Restriction", "In", "line", "Admin_", "(_", "Page", "Permi", "ssion", "In", "line", "Admin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "queryset_", "(_", "self_", ",_", "request_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", " ", "a", " ", "Query", "Set", " ", "of", " ", "all", " ", "model", " ", "instance", "s", " ", "tha", "t", " ", "can", " ", "be", " ", "edited", " ", "by", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "admin", " ", "site", ".", " ", "Thi", "s", " ", "is", " ", "used", " ", "by", " ", "changeli", "st", "\\u", "view", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "qs_", "=_", "self_", "._", "model_", "._", "objects_", "._", "subo", "rdin", "ate", "\\u", "to", "\\u", "user_", "(_", "request_", "._", "user_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "qs_", "._", "filter_", "(_", "can", "\\u", "view_", "=_", "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_", "Global", "Page", "Permi", "ssion", "Admin_", "(_", "admin_", "._", "Model", "Admin_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "list", "\\u", "display_", "=_", "[_", "'", "user", "'_", ",_", "'", "group", "'_", ",_", "'", "can", "\\u", "change", "'_", ",_", "'", "can", "\\u", "delete", "'_", ",_", "'", "can", "\\u", "publi", "sh", "'_", ",_", "'", "can", "\\u", "change", "\\u", "permissi", "ons", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "list", "\\u", "filter_", "=_", "[_", "'", "user", "'_", ",_", "'", "group", "'_", ",_", "'", "can", "\\u", "change", "'_", ",_", "'", "can", "\\u", "delete", "'_", ",_", "'", "can", "\\u", "publi", "sh", "'_", ",_", "'", "can", "\\u", "change", "\\u", "permissi", "ons", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "form_", "=_", "Global", "Page", "Permi", "ssion", "Admi", "n", "Form_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "search", "\\u", "fields_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "field_", "in_", "admin", "\\u", "class_", "._", "search", "\\u", "fields_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "search", "\\u", "fields_", "._", "append_", "(_", "\"", "user", "\\u\\u", "%", "s", "\"_", "%_", "field_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "search", "\\u", "fields_", "._", "append_", "(_", "'", "group", "\\u\\u", "name", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "exclude_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "list", "\\u", "display_", "._", "append_", "(_", "'", "can", "\\u", "change", "\\u", "advanced", "\\u", "settings", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "list", "\\u", "filter_", "._", "append_", "(_", "'", "can", "\\u", "change", "\\u", "advanced", "\\u", "settings", "'_", ")_", "\\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_", "Global", "Page", "Permi", "ssion", "Admin_", "(_", "admin_", "._", "Model", "Admin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "get", "\\u", "list", "\\u", "filter_", "(_", "self_", ",_", "request_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "threshold_", "=_", "get", "\\u", "cms", "\\u", "setting_", "(_", "'", "RA", "W", "\\u", "ID", "\\u", "USERS", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "threshold_", "=_", "threshold_", "and_", "get", "\\u", "user", "\\u", "model_", "(_", ")_", "._", "objects_", "._", "count_", "(_", ")_", ">_", "threshold_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Opera", "tion", "al", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "threshold_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "filter", "\\u", "copy_", "=_", "deepcopy_", "(_", "self_", "._", "list", "\\u", "filter_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "threshold_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "filter", "\\u", "copy_", "._", "remove_", "(_", "'", "user", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "filter", "\\u", "copy_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Global", "Page", "Permi", "ssion", "Admin_", "(_", "admin_", "._", "Model", "Admin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "class", "property_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "raw", "\\u", "id", "\\u", "fields_", "(_", "cls_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Dynamic", "ally", " ", "set", " ", "raw", "\\u", "id", "\\u", "fields", " ", "based", " ", "on", " ", "settings_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "threshold_", "=_", "get", "\\u", "cms", "\\u", "setting_", "(_", "'", "RA", "W", "\\u", "ID", "\\u", "USERS", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Give", "n", " ", "a", " ", "fresh", " ", "django", "-", "cms", " ", "install", " ", "and", " ", "a", " ", "django", " ", "settings", " ", "with", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "CMS", "\\u", "RA", "W", "\\u", "ID", "\\u", "USERS", " ", "=", " ", "CMS", "\\u", "PERMISSION", " ", "=", " ", "True_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "django", " ", "throw", "s", " ", "an", " ", "Opera", "tion", "al", "Error", " ", "whe", "n", " ", "running_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "./", "manage", " ", "migrate_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "bec", "aus", "e", " ", "auth", "\\u", "user", " ", "doe", "sn", "'", "t", " ", "exist", "s", " ", "ye", "t_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "threshold_", "=_", "threshold_", "and_", "get", "\\u", "user", "\\u", "model_", "(_", ")_", "._", "objects_", "._", "count_", "(_", ")_", ">_", "threshold_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Opera", "tion", "al", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "threshold_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "[_", "'", "user", "'_", "]_", "if_", "threshold_", "else_", "[_", "]_", "\\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_", "Gene", "ric", "Cm", "s", "Permi", "ssion", "Admin_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Custom", " ", "mix", "in", " ", "for", " ", "permissi", "on", "-", "enable", "d", " ", "admin", " ", "interface", "s", ".", "\\", "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_", "Gene", "ric", "Cm", "s", "Permi", "ssion", "Admin_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "update", "\\u", "permissi", "on", "\\u", "fieldsets_", "(_", "self_", ",_", "request_", ",_", "obj_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "No", "body", " ", "can", " ", "grant", " ", "more", " ", "than", " ", "he", " ", "have", "s", ",", " ", "so", " ", "check", " ", "for", " ", "user", " ", "permissi", "ons", "\\", "10", ";", " ", " ", " ", " ", "to", " ", "Page", " ", "and", " ", "User", " ", "model", " ", "and", " ", "render", " ", "fieldset", " ", "depend", "ing", " ", "on", " ", "them", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fieldsets_", "=_", "deepcopy_", "(_", "self_", "._", "fieldsets_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "perm", "\\u", "models_", "=_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "Page_", ",_", "ugettext_", "(_", "'", "Page", " ", "permissi", "ons", "'_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "Page", "User_", ",_", "ugettext_", "(_", "'", "User", " ", "&", " ", "Group", " ", "permissi", "ons", "'_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "Page", "Permission_", ",_", "ugettext_", "(_", "'", "Page", " ", "permissi", "ons", " ", "manage", "ment", "'_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", ",_", "perm", "\\u", "model_", "in_", "enumerate_", "(_", "perm", "\\u", "models_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "model_", ",_", "title_", "=_", "perm", "\\u", "model_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "opts_", ",_", "fields_", "=_", "model_", "._", "\\u", "meta_", ",_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "name_", "=_", "model_", "._", "\\u\\u", "name\\u\\u_", "._", "lower_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "key_", "in_", "(_", "'", "add", "'_", ",_", "'", "change", "'_", ",_", "'", "delete", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "perm", "\\u", "code_", "=_", "'%", "s", ".", "%", "s", "'_", "%_", "(_", "opts_", "._", "app", "\\u", "label_", ",_", "get", "\\u", "permissi", "on", "\\u", "codename_", "(_", "key_", ",_", "opts_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "request_", "._", "user_", "._", "has", "\\u", "perm_", "(_", "perm", "\\u", "code_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "fields_", "._", "append_", "(_", "'", "can", "\\u", "%", "s", "\\u", "%", "s", "'_", "%_", "(_", "key_", ",_", "name_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "fields_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "fieldsets_", "._", "insert_", "(_", "2_", "+_", "i_", ",_", "(_", "title_", ",_", "{_", "'", "fields", "'_", ":_", "(_", "fields_", ",_", ")_", "}_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "fieldsets_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Gene", "ric", "Cm", "s", "Permi", "ssion", "Admin_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "has", "\\u", "change", "\\u", "permissi", "ons", "\\u", "permission_", "(_", "self_", ",_", "request_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "User", " ", "is", " ", "able", " ", "to", " ", "add", "/", "change", " ", "object", "s", " ", "only", " ", "if", " ", "he", " ", "have", "s", " ", "can", " ", "change", "\\", "10", ";", " ", " ", " ", " ", "permissi", "on", " ", "on", " ", "some", " ", "page", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "get", "\\u", "user", "\\u", "permissi", "on", "\\u", "level_", "(_", "request_", "._", "user_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "No", "Permi", "ssion", "s", "Exception_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\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_", "Gene", "ric", "Cm", "s", "Permi", "ssion", "Admin_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "has", "\\u", "add", "\\u", "permission_", "(_", "self_", ",_", "request_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "\\u", "has", "\\u", "change", "\\u", "permissi", "ons", "\\u", "permission_", "(_", "request_", ")_", "and_", "super_", "(_", "self_", "._", "\\u\\u", "class\\u\\u_", ",_", "self_", ")_", "._", "has", "\\u", "add", "\\u", "permission_", "(_", "request_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Gene", "ric", "Cm", "s", "Permi", "ssion", "Admin_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "has", "\\u", "change", "\\u", "permission_", "(_", "self_", ",_", "request_", ",_", "obj_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "\\u", "has", "\\u", "change", "\\u", "permissi", "ons", "\\u", "permission_", "(_", "request_", ")_", "and_", "super_", "(_", "self_", "._", "\\u\\u", "class\\u\\u_", ",_", "self_", ")_", "._", "has", "\\u", "change", "\\u", "permission_", "(_", "request_", ",_", "obj_", ")_", "\\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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m)\nSee the file 'LICENSE' for copying permission\n\"\"\"\n\nimport re\n\nfrom core.common import retrieve_content\n\n__url__ = \"http://osint.bambenekconsulting.com/feeds/c2-ipmasterlist-high.txt\"\n__check__ = \"Master Feed\"\n__reference__ = \"bambenekconsulting.com\"\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def fetch():\n retval = {}\n content = retrieve_content(__url__)\n\n if __check__ in content:\n for match in re.finditer(r\"(?m)^([\\d.]+),IP used by ([^,/]+) C&C\", content):\n retval[match.group(1)] = (\"%s (malware)\" % match.group(2).lower().strip(), __reference__)\n\n return retval", "metadata": "root.fetch", "header": "['module', '___EOS___']", "index": 15 } ]
[]
[]
0
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_", "\"\"\"", "\\", "10", ";", "Copy", "right", " ", "(", "c", ")", " ", "2014", "-", "2016", " ", "Mir", "os", "lav", " ", "Sta", "mpa", "r", " ", "(", "@", "stamp", "arm", ")", "\\", "10", ";", "See", " ", "the", " ", "file", " ", "'", "LICENSE", "'", " ", "for", " ", "copy", "ing", " ", "permissi", "on", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "re_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "core_", "._", "common_", "import_", "retrieve", "\\u", "content_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u", "url", "\\u\\u_", "=_", "\"", "http", "://", "osin", "t", ".", "bam", "bene", "kco", "nsu", "lti", "ng", ".", "com", "/", "feed", "s", "/", "c2", "-", "ip", "master", "list", "-", "high", ".", "txt", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u", "check", "\\u\\u_", "=_", "\"", "Master", " ", "Feed", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u", "reference", "\\u\\u_", "=_", "\"", "bam", "bene", "kco", "nsu", "lti", "ng", ".", "com", "\"_", "\\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_", "fetch_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "retval_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "content_", "=_", "retrieve", "\\u", "content_", "(_", "\\u\\u", "url", "\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "\\u\\u", "check", "\\u\\u_", "in_", "content_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "match_", "in_", "re_", "._", "finditer_", "(_", "r", "\"(?", "m", ")", "^", "([\\\\", "d", ".]+", "),", "IP", " ", "used", " ", "by", " ", "([", "^", ",", "/]+", ")", " ", "C", "&", "C", "\"_", ",_", "content_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "retval_", "[_", "match_", "._", "group_", "(_", "1_", ")_", "]_", "=_", "(_", "\"%", "s", " ", "(", "mal", "ware", ")\"_", "%_", "match_", "._", "group_", "(_", "2_", ")_", "._", "lower_", "(_", ")_", "._", "strip_", "(_", ")_", ",_", "\\u\\u", "reference", "\\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_", "retval_" ]
[ 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, 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 ]
Constant in conditional expression or statement
mne-tools/mne-python/mne/source_estimate.py
[ { "content": "def read_source_estimate(fname, subject=None):\n \"\"\"Read a soure estimate object\n\n Parameters\n ----------\n fname : str\n Path to (a) source-estimate file(s).\n subject : str | None\n Name of the subject the source estimate(s) is (are) from.\n It is good practice to set this attribute to avoid combining\n incompatible labels and SourceEstimates (e.g., ones from other\n subjects). Note that due to file specification limitations, the\n subject name isn't saved to or loaded from files written to disk.\n\n Returns\n -------\n stc : SourceEstimate | VolSourceEstimate\n The soure estimate object loaded from file.\n\n Notes\n -----\n - for volume source estimates, ``fname`` should provide the path to a\n single file named '*-vl.stc` or '*-vol.stc'\n - for surface source estimates, ``fname`` should either provide the\n path to the file corresponding to a single hemisphere ('*-lh.stc',\n '*-rh.stc') or only specify the asterisk part in these patterns. In any\n case, the function expects files for both hemisphere with names\n following this pattern.\n - for single time point .w files, ``fname`` should follow the same\n pattern as for surface estimates, except that files are named\n '*-lh.w' and '*-rh.w'.\n \"\"\"\n fname_arg = fname\n\n # make sure corresponding file(s) can be found\n ftype = None\n if os.path.exists(fname):\n if fname.endswith('-vl.stc') or fname.endswith('-vol.stc') or \\\n fname.endswith('-vl.w') or fname.endswith('-vol.w'):\n ftype = 'volume'\n elif fname.endswith('.stc'):\n ftype = 'surface'\n if fname.endswith(('-lh.stc', '-rh.stc')):\n fname = fname[:-7]\n else:\n err = (\"Invalid .stc filename: %r; needs to end with \"\n \"hemisphere tag ('...-lh.stc' or '...-rh.stc')\"\n % fname)\n raise IOError(err)\n elif fname.endswith('.w'):\n ftype = 'w'\n if fname.endswith(('-lh.w', '-rh.w')):\n fname = fname[:-5]\n else:\n err = (\"Invalid .w filename: %r; needs to end with \"\n \"hemisphere tag ('...-lh.w' or '...-rh.w')\"\n % fname)\n raise IOError(err)\n elif fname.endswith('-stc.h5'):\n ftype = 'h5'\n fname = fname[:-7]\n else:\n raise RuntimeError('Unknown extension for file %s' % fname_arg)\n\n if ftype is not 'volume':\n stc_exist = [os.path.exists(f)\n for f in [fname + '-rh.stc', fname + '-lh.stc']]\n w_exist = [os.path.exists(f)\n for f in [fname + '-rh.w', fname + '-lh.w']]\n h5_exist = os.path.exists(fname + '-stc.h5')\n if all(stc_exist) and (ftype is not 'w'):\n ftype = 'surface'\n elif all(w_exist):\n ftype = 'w'\n elif h5_exist:\n ftype = 'h5'\n elif any(stc_exist) or any(w_exist):\n raise IOError(\"Hemisphere missing for %r\" % fname_arg)\n else:\n raise IOError(\"SourceEstimate File(s) not found for: %r\"\n % fname_arg)\n\n # read the files\n if ftype == 'volume': # volume source space\n if fname.endswith('.stc'):\n kwargs = _read_stc(fname)\n elif fname.endswith('.w'):\n kwargs = _read_w(fname)\n kwargs['data'] = kwargs['data'][:, np.newaxis]\n kwargs['tmin'] = 0.0\n kwargs['tstep'] = 0.0\n else:\n raise IOError('Volume source estimate must end with .stc or .w')\n elif ftype == 'surface': # stc file with surface source spaces\n lh = _read_stc(fname + '-lh.stc')\n rh = _read_stc(fname + '-rh.stc')\n assert lh['tmin'] == rh['tmin']\n assert lh['tstep'] == rh['tstep']\n kwargs = lh.copy()\n kwargs['data'] = np.r_[lh['data'], rh['data']]\n kwargs['vertices'] = [lh['vertices'], rh['vertices']]\n elif ftype == 'w': # w file with surface source spaces\n lh = _read_w(fname + '-lh.w')\n rh = _read_w(fname + '-rh.w')\n kwargs = lh.copy()\n kwargs['data'] = np.atleast_2d(np.r_[lh['data'], rh['data']]).T\n kwargs['vertices'] = [lh['vertices'], rh['vertices']]\n # w files only have a single time point\n kwargs['tmin'] = 0.0\n kwargs['tstep'] = 1.0\n elif ftype == 'h5':\n kwargs = read_hdf5(fname + '-stc.h5', title='mnepython')\n\n if ftype != 'volume':\n # Make sure the vertices are ordered\n vertices = kwargs['vertices']\n if any(np.any(np.diff(v.astype(int)) <= 0) for v in vertices):\n sidx = [np.argsort(verts) for verts in vertices]\n vertices = [verts[idx] for verts, idx in zip(vertices, sidx)]\n data = kwargs['data'][np.r_[sidx[0], len(sidx[0]) + sidx[1]]]\n kwargs['vertices'] = vertices\n kwargs['data'] = data\n\n if 'subject' not in kwargs:\n kwargs['subject'] = subject\n if subject is not None and subject != kwargs['subject']:\n raise RuntimeError('provided subject name \"%s\" does not match '\n 'subject name from the file \"%s'\n % (subject, kwargs['subject']))\n\n if ftype == 'volume':\n stc = VolSourceEstimate(**kwargs)\n else:\n stc = SourceEstimate(**kwargs)\n\n return stc", "metadata": "root.read_source_estimate", "header": "['module', '___EOS___']", "index": 213 } ]
[]
[]
0
true
[ "[CLS]_", "Constant_", "in_", "conditional", "_", "expression_", "or_", "statement_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "read", "\\u", "source", "\\u", "estimate_", "(_", "fname_", ",_", "subject_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Read", " ", "a", " ", "sou", "re", " ", "estimate", " ", "object", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Parameter", "s", "\\", "10", ";", " ", " ", " ", " ", "----------", "\\", "10", ";", " ", " ", " ", " ", "fname", " ", ":", " ", "str", "\\", "10", ";", " ", " ", " ", " ", "Path", " ", "to", " ", "(", "a", ")", " ", "source", "-", "estimate", " ", "file", "(", "s", ").", "\\", "10", ";", " ", " ", " ", " ", "subject", " ", ":", " ", "str", " ", "|", " ", "Non", "e", "\\", "10", ";", " ", " ", " ", " ", "Name", " ", "of", " ", "the", " ", "subject", " ", "the", " ", "source", " ", "estimate", "(", "s", ")", " ", "is", " ", "(", "are", ")", " ", "from", ".", "\\", "10", ";", " ", " ", " ", " ", "It", " ", "is", " ", "good", " ", "practic", "e", " ", "to", " ", "set", " ", "this", " ", "attribute", " ", "to", " ", "avoid", " ", "combin", "ing", "\\", "10", ";", " ", " ", " ", " ", "incomp", "atible", " ", "labels", " ", "and", " ", "Sou", "rce", "Estimat", "es", " ", "(", "e", ".", "g", ".,", " ", "ones", " ", "from", " ", "other", "\\", "10", ";", " ", " ", " ", " ", "subject", "s", ").", " ", "Not", "e", " ", "tha", "t", " ", "due", " ", "to", " ", "file", " ", "specifica", "tion", " ", "limit", "ation", "s", ",", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "subject", " ", "name", " ", "isn", "'", "t", " ", "saved", " ", "to", " ", "or", " ", "load", "ed", " ", "from", " ", "files", " ", "writt", "en", " ", "to", " ", "disk", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", "\\", "10", ";", " ", " ", " ", " ", "-------", "\\", "10", ";", " ", " ", " ", " ", "stc", " ", ":", " ", "Sou", "rce", "Estimat", "e", " ", "|", " ", "Vol", "Sou", "rce", "Estimat", "e", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "sou", "re", " ", "estimate", " ", "object", " ", "load", "ed", " ", "from", " ", "file", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Not", "es", "\\", "10", ";", " ", " ", " ", " ", "-----", "\\", "10", ";", " ", "-", " ", "for", " ", "volume", " ", "source", " ", "estimate", "s", ",", " ", "``", "fname", "``", " ", "shou", "ld", " ", "provide", " ", "the", " ", "path", " ", "to", " ", "a", "\\", "10", ";", " ", " ", " ", "single", " ", "file", " ", "named", " ", "'*", "-", "vl", ".", "stc", "`", " ", "or", " ", "'*", "-", "vol", ".", "stc", "'", "\\", "10", ";", " ", "-", " ", "for", " ", "surf", "ace", " ", "source", " ", "estimate", "s", ",", " ", "``", "fname", "``", " ", "shou", "ld", " ", "eit", "her", " ", "provide", " ", "the", "\\", "10", ";", " ", " ", " ", "path", " ", "to", " ", "the", " ", "file", " ", "correspond", "ing", " ", "to", " ", "a", " ", "single", " ", "hemi", "sphere", " ", "('", "*-", "lh", ".", "stc", "',", "\\", "10", ";", " ", " ", " ", "'*", "-", "rh", ".", "stc", "')", " ", "or", " ", "only", " ", "speci", "fy", " ", "the", " ", "aster", "isk", " ", "part", " ", "in", " ", "these", " ", "pattern", "s", ".", " ", "In", " ", "any", "\\", "10", ";", " ", " ", " ", "case", ",", " ", "the", " ", "function", " ", "expect", "s", " ", "files", " ", "for", " ", "bot", "h", " ", "hemi", "sphere", " ", "with", " ", "names", "\\", "10", ";", " ", " ", " ", "follow", "ing", " ", "this", " ", "pattern", ".", "\\", "10", ";", " ", "-", " ", "for", " ", "single", " ", "time", " ", "point", " ", ".", "w", " ", "files", ",", " ", "``", "fname", "``", " ", "shou", "ld", " ", "follow", " ", "the", " ", "same", "\\", "10", ";", " ", " ", " ", "pattern", " ", "as", " ", "for", " ", "surf", "ace", " ", "estimate", "s", ",", " ", "except", " ", "tha", "t", " ", "files", " ", "are", " ", "named", "\\", "10", ";", " ", " ", " ", "'*", "-", "lh", ".", "w", "'", " ", "and", " ", "'*", "-", "rh", ".", "w", "'.", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fname", "\\u", "arg_", "=_", "fname_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "make", " ", "sure", " ", "correspond", "ing", " ", "file", "(", "s", ")", " ", "can", " ", "be", " ", "found_", "\\u\\u\\uNL\\u\\u\\u_", "ftype_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "os_", "._", "path_", "._", "exists_", "(_", "fname_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "fname_", "._", "endswith_", "(_", "'-", "vl", ".", "stc", "'_", ")_", "or_", "fname_", "._", "endswith_", "(_", "'-", "vol", ".", "stc", "'_", ")_", "or_", "fname_", "._", "endswith_", "(_", "'-", "vl", ".", "w", "'_", ")_", "or_", "fname_", "._", "endswith_", "(_", "'-", "vol", ".", "w", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ftype_", "=_", "'", "volume", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "fname_", "._", "endswith_", "(_", "'.", "stc", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ftype_", "=_", "'", "surf", "ace", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "fname_", "._", "endswith_", "(_", "(_", "'-", "lh", ".", "stc", "'_", ",_", "'-", "rh", ".", "stc", "'_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "fname_", "=_", "fname_", "[_", ":_", "-_", "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 ", " _", "err_", "=_", "(_", "\"", "Inva", "lid", " ", ".", "stc", " ", "filename", ":", " ", "%", "r", ";", " ", "need", "s", " ", "to", " ", "end", " ", "with", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "hemi", "sphere", " ", "tag", " ", "('.", "..", "-", "lh", ".", "stc", "'", " ", "or", " ", "'...", "-", "rh", ".", "stc", "')\"_", "\\u\\u\\uNL\\u\\u\\u_", "%_", "fname_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "IO", "Error_", "(_", "err_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "fname_", "._", "endswith_", "(_", "'.", "w", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ftype_", "=_", "'", "w", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "fname_", "._", "endswith_", "(_", "(_", "'-", "lh", ".", "w", "'_", ",_", "'-", "rh", ".", "w", "'_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "fname_", "=_", "fname_", "[_", ":_", "-_", "5_", "]_", "\\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_", "=_", "(_", "\"", "Inva", "lid", " ", ".", "w", " ", "filename", ":", " ", "%", "r", ";", " ", "need", "s", " ", "to", " ", "end", " ", "with", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "hemi", "sphere", " ", "tag", " ", "('.", "..", "-", "lh", ".", "w", "'", " ", "or", " ", "'...", "-", "rh", ".", "w", "')\"_", "\\u\\u\\uNL\\u\\u\\u_", "%_", "fname_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "IO", "Error_", "(_", "err_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "fname_", "._", "endswith_", "(_", "'-", "stc", ".", "h5", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ftype_", "=_", "'", "h5", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fname_", "=_", "fname_", "[_", ":_", "-_", "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 ", " _", "raise_", "Run", "time", "Error_", "(_", "'", "Un", "know", "n", " ", "extensi", "on", " ", "for", " ", "file", " ", "%", "s", "'_", "%_", "fname", "\\u", "arg_", ")_", "\\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_", "ftype_", "is_", "not_", "'", "volume", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "stc", "\\u", "exist_", "=_", "[_", "os_", "._", "path_", "._", "exists_", "(_", "f_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "f_", "in_", "[_", "fname_", "+_", "'-", "rh", ".", "stc", "'_", ",_", "fname_", "+_", "'-", "lh", ".", "stc", "'_", "]_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "w", "\\u", "exist_", "=_", "[_", "os_", "._", "path_", "._", "exists_", "(_", "f_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "f_", "in_", "[_", "fname_", "+_", "'-", "rh", ".", "w", "'_", ",_", "fname_", "+_", "'-", "lh", ".", "w", "'_", "]_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "h5", "\\u", "exist_", "=_", "os_", "._", "path_", "._", "exists_", "(_", "fname_", "+_", "'-", "stc", ".", "h5", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "all_", "(_", "stc", "\\u", "exist_", ")_", "and_", "(_", "ftype_", "is_", "not_", "'", "w", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ftype_", "=_", "'", "surf", "ace", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "all_", "(_", "w", "\\u", "exist_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ftype_", "=_", "'", "w", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "h5", "\\u", "exist_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ftype_", "=_", "'", "h5", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "any_", "(_", "stc", "\\u", "exist_", ")_", "or_", "any_", "(_", "w", "\\u", "exist_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "IO", "Error_", "(_", "\"", "He", "mis", "pher", "e", " ", "missi", "ng", " ", "for", " ", "%", "r", "\"_", "%_", "fname", "\\u", "arg_", ")_", "\\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_", "IO", "Error_", "(_", "\"", "Sou", "rce", "Estimat", "e", " ", "File", "(", "s", ")", " ", "not", " ", "found", " ", "for", ":", " ", "%", "r", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "%_", "fname", "\\u", "arg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "read", " ", "the", " ", "files_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "ftype_", "==_", "'", "volume", "'_", ":_", "#", " ", "volume", " ", "source", " ", "space_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "fname_", "._", "endswith_", "(_", "'.", "stc", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "kwargs_", "=_", "\\u", "read", "\\u", "stc_", "(_", "fname_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "fname_", "._", "endswith_", "(_", "'.", "w", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "kwargs_", "=_", "\\u", "read", "\\u", "w_", "(_", "fname_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "kwargs_", "[_", "'", "data", "'_", "]_", "=_", "kwargs_", "[_", "'", "data", "'_", "]_", "[_", ":_", ",_", "np_", "._", "newaxis_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "kwargs_", "[_", "'", "tmi", "n", "'_", "]_", "=_", "0.0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "kwargs_", "[_", "'", "tst", "ep", "'_", "]_", "=_", "0.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 ", " _", "raise_", "IO", "Error_", "(_", "'", "Volume", " ", "source", " ", "estimate", " ", "must", " ", "end", " ", "with", " ", ".", "stc", " ", "or", " ", ".", "w", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "ftype_", "==_", "'", "surf", "ace", "'_", ":_", "#", " ", "stc", " ", "file", " ", "with", " ", "surf", "ace", " ", "source", " ", "spaces_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "lh", "_", "=_", "\\u", "read", "\\u", "stc_", "(_", "fname_", "+_", "'-", "lh", ".", "stc", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rh_", "=_", "\\u", "read", "\\u", "stc_", "(_", "fname_", "+_", "'-", "rh", ".", "stc", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "lh", "_", "[_", "'", "tmi", "n", "'_", "]_", "==_", "rh_", "[_", "'", "tmi", "n", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "lh", "_", "[_", "'", "tst", "ep", "'_", "]_", "==_", "rh_", "[_", "'", "tst", "ep", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "kwargs_", "=_", "lh", "_", "._", "copy_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "kwargs_", "[_", "'", "data", "'_", "]_", "=_", "np_", "._", "r\\u_", "[_", "lh", "_", "[_", "'", "data", "'_", "]_", ",_", "rh_", "[_", "'", "data", "'_", "]_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "kwargs_", "[_", "'", "vertice", "s", "'_", "]_", "=_", "[_", "lh", "_", "[_", "'", "vertice", "s", "'_", "]_", ",_", "rh_", "[_", "'", "vertice", "s", "'_", "]_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "ftype_", "==_", "'", "w", "'_", ":_", "#", " ", "w", " ", "file", " ", "with", " ", "surf", "ace", " ", "source", " ", "spaces_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "lh", "_", "=_", "\\u", "read", "\\u", "w_", "(_", "fname_", "+_", "'-", "lh", ".", "w", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rh_", "=_", "\\u", "read", "\\u", "w_", "(_", "fname_", "+_", "'-", "rh", ".", "w", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "kwargs_", "=_", "lh", "_", "._", "copy_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "kwargs_", "[_", "'", "data", "'_", "]_", "=_", "np_", "._", "atl", "east", "\\u", "2d_", "(_", "np_", "._", "r\\u_", "[_", "lh", "_", "[_", "'", "data", "'_", "]_", ",_", "rh_", "[_", "'", "data", "'_", "]_", "]_", ")_", "._", "T_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "kwargs_", "[_", "'", "vertice", "s", "'_", "]_", "=_", "[_", "lh", "_", "[_", "'", "vertice", "s", "'_", "]_", ",_", "rh_", "[_", "'", "vertice", "s", "'_", "]_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "w", " ", "files", " ", "only", " ", "have", " ", "a", " ", "single", " ", "time", " ", "point_", "\\u\\u\\uNL\\u\\u\\u_", "kwargs_", "[_", "'", "tmi", "n", "'_", "]_", "=_", "0.0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "kwargs_", "[_", "'", "tst", "ep", "'_", "]_", "=_", "1.0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "ftype_", "==_", "'", "h5", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "kwargs_", "=_", "read", "\\u", "hdf5", "_", "(_", "fname_", "+_", "'-", "stc", ".", "h5", "'_", ",_", "title_", "=_", "'", "mne", "python", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "ftype_", "!=_", "'", "volume", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Make", " ", "sure", " ", "the", " ", "vertice", "s", " ", "are", " ", "ordered_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "vertices_", "=_", "kwargs_", "[_", "'", "vertice", "s", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "any_", "(_", "np_", "._", "any_", "(_", "np_", "._", "diff_", "(_", "v_", "._", "astype_", "(_", "int_", ")_", ")_", "<=_", "0_", ")_", "for_", "v_", "in_", "vertices_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sid", "x_", "=_", "[_", "np_", "._", "argsort_", "(_", "verts_", ")_", "for_", "verts_", "in_", "vertices_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "vertices_", "=_", "[_", "verts_", "[_", "idx_", "]_", "for_", "verts_", ",_", "idx_", "in_", "zip_", "(_", "vertices_", ",_", "sid", "x_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data_", "=_", "kwargs_", "[_", "'", "data", "'_", "]_", "[_", "np_", "._", "r\\u_", "[_", "sid", "x_", "[_", "0_", "]_", ",_", "len_", "(_", "sid", "x_", "[_", "0_", "]_", ")_", "+_", "sid", "x_", "[_", "1_", "]_", "]_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "kwargs_", "[_", "'", "vertice", "s", "'_", "]_", "=_", "vertices_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "kwargs_", "[_", "'", "data", "'_", "]_", "=_", "data_", "\\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_", "'", "subject", "'_", "not_", "in_", "kwargs_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "kwargs_", "[_", "'", "subject", "'_", "]_", "=_", "subject_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "subject_", "is_", "not_", "None_", "and_", "subject_", "!=_", "kwargs_", "[_", "'", "subject", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Run", "time", "Error_", "(_", "'", "provided", " ", "subject", " ", "name", " ", "\"%", "s", "\"", " ", "doe", "s", " ", "not", " ", "match", " ", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'", "subject", " ", "name", " ", "from", " ", "the", " ", "file", " ", "\"%", "s", "'_", "\\u\\u\\uNL\\u\\u\\u_", "%_", "(_", "subject_", ",_", "kwargs_", "[_", "'", "subject", "'_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "ftype_", "==_", "'", "volume", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "stc_", "=_", "Vol", "Sou", "rce", "Estimat", "e_", "(_", "**_", "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 ", " _", "stc_", "=_", "Sou", "rce", "Estimat", "e_", "(_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "stc_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 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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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 ]
Comparison of constants
google/macops/gmacpyutil/gmacpyutil/experiments_test.py
[ { "content": " @mock.patch.object(experiments.gmacpyutil, 'MachineInfoForKey')\n def testKnobsManualKnobReturnsList(self, mock_mifk):\n def MifkSE(key):\n if key == experiments.MANUAL_ON_KNOB:\n return 'foo,bar,baz'\n else:\n return ''\n mock_mifk.side_effect = MifkSE\n k = experiments.Knobs()\n knobs = k._GetKnobs()\n self.assertSameElements(['foo', 'baz', 'bar'],\n knobs[experiments.MANUAL_ON_KNOB])", "metadata": "root.KnobsTest.testKnobsManualKnobReturnsList", "header": "['class', 'KnobsTest', '(', 'basetest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 146 } ]
[]
[]
0
true
[ "[CLS]_", "Compari", "son_", "of_", "constants_", "[SEP]_", "class_", "Kno", "bs", "Test_", "(_", "base", "test_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "@_", "mock_", "._", "patch_", "._", "object_", "(_", "experiments_", "._", "gma", "cpy", "util_", ",_", "'", "Machine", "Info", "For", "Key", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test", "Kno", "bs", "Manu", "al", "Kno", "b", "Return", "s", "List_", "(_", "self_", ",_", "mock", "\\u", "mi", "fk_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "Mi", "fk", "SE_", "(_", "key_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "key_", "==_", "experiments_", "._", "MANU", "AL", "\\u", "ON", "\\u", "KN", "OB", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "'", "foo", ",", "bar", ",", "ba", "z", "'_", "\\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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "mock", "\\u", "mi", "fk_", "._", "side", "\\u", "effect_", "=_", "Mi", "fk", "SE_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "k_", "=_", "experiments_", "._", "Kno", "bs_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "knob", "s_", "=_", "k_", "._", "\\u", "Get", "Kno", "bs_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Sam", "e", "Elements_", "(_", "[_", "'", "foo", "'_", ",_", "'", "ba", "z", "'_", ",_", "'", "bar", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "knob", "s_", "[_", "experiments_", "._", "MANU", "AL", "\\u", "ON", "\\u", "KN", "OB", "_", "]_", ")_", "\\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 ]
Unreachable code
python-hyper/hyper-h2/test/test_flow_control_window.py
[ { "content": " def test_we_enforce_our_flow_control_window(self, frame_factory):\n \"\"\"\n The user can set a low flow control window, which leads to connection\n teardown if violated.\n \"\"\"\n c = h2.connection.H2Connection(client_side=False)\n c.receive_data(frame_factory.preamble())\n\n # Change the flow control window to 80 bytes.\n c.update_settings(\n {h2.settings.INITIAL_WINDOW_SIZE: 80}\n )\n f = frame_factory.build_settings_frame({}, ack=True)\n c.receive_data(f.serialize())\n\n # Receive a new stream.\n f = frame_factory.build_headers_frame(self.example_request_headers)\n c.receive_data(f.serialize())\n\n # Attempt to violate the flow control window.\n c.clear_outbound_data_buffer()\n f = frame_factory.build_data_frame(b'\\x01' * 100)\n\n with pytest.raises(h2.exceptions.FlowControlError):\n c.receive_data(f.serialize())\n\n # Verify we tear down appropriately.\n expected_frame = frame_factory.build_goaway_frame(\n last_stream_id=1,\n error_code=h2.errors.FLOW_CONTROL_ERROR,\n )\n assert c.data_to_send() == expected_frame.serialize()", "metadata": "root.TestFlowControl.test_we_enforce_our_flow_control_window", "header": "['class', 'TestFlowControl', '(', 'object', ')', ':', '___EOS___']", "index": 332 } ]
[]
[]
0
true
[ "[CLS]_", "Unrea", "chab", "le_", "code_", "[SEP]_", "class_", "Test", "Flow", "Control_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "we", "\\u", "enforce", "\\u", "our", "\\u", "flow", "\\u", "control", "\\u", "window_", "(_", "self_", ",_", "frame", "\\u", "factory_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "user", " ", "can", " ", "set", " ", "a", " ", "low", " ", "flow", " ", "control", " ", "window", ",", " ", "whi", "ch", " ", "leads", " ", "to", " ", "connecti", "on", "\\", "10", ";", " ", " ", " ", " ", "tear", "down", " ", "if", " ", "viola", "ted", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "c_", "=_", "h2_", "._", "connection_", "._", "H2", "Connection_", "(_", "client", "\\u", "side_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "c_", "._", "receive", "\\u", "data_", "(_", "frame", "\\u", "factory_", "._", "preamble_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Change", " ", "the", " ", "flow", " ", "control", " ", "window", " ", "to", " ", "80", " ", "bytes", "._", "\\u\\u\\uNL\\u\\u\\u_", "c_", "._", "update", "\\u", "settings_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "h2_", "._", "settings_", "._", "INITIAL", "\\u", "WIND", "OW", "\\u", "SIZE_", ":_", "80_", "}_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "=_", "frame", "\\u", "factory_", "._", "build", "\\u", "settings", "\\u", "frame_", "(_", "{_", "}_", ",_", "ack_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "c_", "._", "receive", "\\u", "data_", "(_", "f_", "._", "serialize_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Receive", " ", "a", " ", "new", " ", "stream", "._", "\\u\\u\\uNL\\u\\u\\u_", "f_", "=_", "frame", "\\u", "factory_", "._", "build", "\\u", "header", "s", "\\u", "frame_", "(_", "self_", "._", "example", "\\u", "request", "\\u", "headers_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "c_", "._", "receive", "\\u", "data_", "(_", "f_", "._", "serialize_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Atte", "mpt", " ", "to", " ", "viola", "te", " ", "the", " ", "flow", " ", "control", " ", "window", "._", "\\u\\u\\uNL\\u\\u\\u_", "c_", "._", "clear", "\\u", "outb", "ound", "\\u", "data\\u", "buffer_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "=_", "frame", "\\u", "factory_", "._", "build", "\\u", "data\\u", "frame_", "(_", "b", "'\\\\", "x0", "1", "'_", "*_", "100_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "with_", "pytest_", "._", "raises_", "(_", "h2_", "._", "exceptions_", "._", "Flow", "Control", "Error_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "c_", "._", "receive", "\\u", "data_", "(_", "f_", "._", "serialize_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Verify", " ", "we", " ", "tear", " ", "down", " ", "appropr", "iate", "ly", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "expected", "\\u", "frame_", "=_", "frame", "\\u", "factory_", "._", "build", "\\u", "go", "awa", "y", "\\u", "frame_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "last", "\\u", "stream", "\\u", "id_", "=_", "1_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "error", "\\u", "code_", "=_", "h2_", "._", "errors_", "._", "FLOW", "\\u", "CONTR", "OL", "\\u", "ERROR_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "c_", "._", "data\\u", "to", "\\u", "send_", "(_", ")_", "==_", "expected", "\\u", "frame_", "._", "serialize_", "(_", ")_", "\\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 ]
Except block handles 'BaseException'
basilfx/kippo-extra/kippo_extra/commands/uname.py
[ { "content": " def call(self):\n \"\"\" Add uname command to identify server \"\"\"\n\n # Initialize options\n parser = ModifiedOptionParser(add_help_option=False)\n parser.add_option(\"--help\", dest=\"help\", action=\"store_true\")\n parser.add_option(\"--version\", dest=\"version\", action=\"store_true\")\n parser.add_option(\"-a\", \"--all\", dest=\"all\", action=\"store_true\")\n parser.add_option(\n \"-s\", \"--kenel-name\", dest=\"name\", action=\"store_true\")\n parser.add_option(\n \"-r\", \"--kernel-release\", dest=\"release\", action=\"store_true\")\n parser.add_option(\n \"-v\", \"--kernel-version\", dest=\"kernel\", action=\"store_true\")\n parser.add_option(\n \"-m\", \"--machine\", dest=\"machine\", action=\"store_true\")\n parser.add_option(\n \"-p\", \"--processor\", dest=\"processor\", action=\"store_true\")\n parser.add_option(\n \"-i\", \"--hardware-platform\", dest=\"hardware\", action=\"store_true\")\n parser.add_option(\n \"-o\", \"--operating-system\", dest=\"os\", action=\"store_true\")\n\n try:\n (opts, args) = parser.parse_args(list(self.args))\n except OptionParsingError, e:\n self.bad_argument(self.args[0])\n return\n except OptionParsingExit, e:\n self.bad_argument(e)\n return\n\n if opts.help:\n self.help()\n elif opts.version:\n self.writeln(\"#1 SMP Wed Nov 4 23:40:10 UTC 2009\")\n elif opts.all:\n self.writeln(\n \"Linux %s 2.6.26-2-686 #1 SMP Wed Nov 4 20:45:37 \"\n \"UTC 2009 i686 GNU/Linux\" % self.honeypot.hostname)\n else:\n parts = []\n\n # Actually, the order matters, e.g. '-s -r -v' gives another output\n # as '-r -v -s'.\n if opts.name:\n parts.append(\"Linux\")\n if opts.release:\n parts.append(\"2.6.26-2-686\")\n if opts.kernel:\n parts.append(\"#1 SMP Wed Nov 4 20:45:37 UTC 2009\")\n if opts.machine:\n parts.append(\"i686\")\n if opts.processor:\n parts.append(\"i686\")\n if opts.hardware:\n parts.append(\"i686\")\n if opts.os:\n parts.append(\"GNU/Linux\")\n\n # No command given, disply the name only.\n if parts:\n self.writeln(\" \".join(parts))\n else:\n self.writeln(\"Linux\")", "metadata": "root.command_uname.call", "header": "['class', 'command_uname', '(', 'ExtendedHoneyPotCommand', ')', ':', '___EOS___']", "index": 7 } ]
[]
[]
0
true
[ "[CLS]_", "Except", "_", "block_", "handles_", "'", "Base", "Except", "ion", "'_", "[SEP]_", "class_", "command", "\\u", "uname_", "(_", "Extend", "ed", "Hon", "ey", "Pot", "Command_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "call_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "Add", " ", "una", "me", " ", "command", " ", "to", " ", "identify", " ", "server", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Initializ", "e", " ", "options_", "\\u\\u\\uNL\\u\\u\\u_", "parser_", "=_", "Modifie", "d", "Optio", "n", "Parser_", "(_", "add", "\\u", "help", "\\u", "option_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "._", "add", "\\u", "option_", "(_", "\"--", "help", "\"_", ",_", "dest_", "=_", "\"", "help", "\"_", ",_", "action_", "=_", "\"", "store", "\\u", "true", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "._", "add", "\\u", "option_", "(_", "\"--", "version", "\"_", ",_", "dest_", "=_", "\"", "version", "\"_", ",_", "action_", "=_", "\"", "store", "\\u", "true", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "._", "add", "\\u", "option_", "(_", "\"-", "a", "\"_", ",_", "\"--", "all", "\"_", ",_", "dest_", "=_", "\"", "all", "\"_", ",_", "action_", "=_", "\"", "store", "\\u", "true", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "._", "add", "\\u", "option_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"-", "s", "\"_", ",_", "\"--", "ken", "el", "-", "name", "\"_", ",_", "dest_", "=_", "\"", "name", "\"_", ",_", "action_", "=_", "\"", "store", "\\u", "true", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "._", "add", "\\u", "option_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"-", "r", "\"_", ",_", "\"--", "kernel", "-", "release", "\"_", ",_", "dest_", "=_", "\"", "release", "\"_", ",_", "action_", "=_", "\"", "store", "\\u", "true", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "._", "add", "\\u", "option_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"-", "v", "\"_", ",_", "\"--", "kernel", "-", "version", "\"_", ",_", "dest_", "=_", "\"", "kernel", "\"_", ",_", "action_", "=_", "\"", "store", "\\u", "true", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "._", "add", "\\u", "option_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"-", "m", "\"_", ",_", "\"--", "machine", "\"_", ",_", "dest_", "=_", "\"", "machine", "\"_", ",_", "action_", "=_", "\"", "store", "\\u", "true", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "._", "add", "\\u", "option_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"-", "p", "\"_", ",_", "\"--", "process", "or", "\"_", ",_", "dest_", "=_", "\"", "process", "or", "\"_", ",_", "action_", "=_", "\"", "store", "\\u", "true", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "._", "add", "\\u", "option_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"-", "i", "\"_", ",_", "\"--", "hard", "ware", "-", "platform", "\"_", ",_", "dest_", "=_", "\"", "hard", "ware", "\"_", ",_", "action_", "=_", "\"", "store", "\\u", "true", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "._", "add", "\\u", "option_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"-", "o", "\"_", ",_", "\"--", "operati", "ng", "-", "system", "\"_", ",_", "dest_", "=_", "\"", "os", "\"_", ",_", "action_", "=_", "\"", "store", "\\u", "true", "\"_", ")_", "\\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 ", " _", "(_", "opts_", ",_", "args_", ")_", "=_", "parser_", "._", "parse", "\\u", "args_", "(_", "list_", "(_", "self_", "._", "args_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Optio", "n", "Pars", "ing", "Error_", ",_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "bad", "\\u", "argument_", "(_", "self_", "._", "args_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Optio", "n", "Pars", "ing", "Exit_", ",_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "bad", "\\u", "argument_", "(_", "e_", ")_", "\\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_", "if_", "opts_", "._", "help_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "help_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "opts_", "._", "version_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "writeln_", "(_", "\"#", "1", " ", "SM", "P", " ", "We", "d", " ", "Nov", " ", "4", " ", "23", ":", "40", ":", "10", " ", "UT", "C", " ", "200", "9", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "opts_", "._", "all_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "writeln_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Lin", "ux", " ", "%", "s", " ", "2.6", ".2", "6", "-", "2", "-", "686", " ", "#", "1", " ", "SM", "P", " ", "We", "d", " ", "Nov", " ", "4", " ", "20", ":", "4", "5", ":", "3", "7", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "UT", "C", " ", "200", "9", " ", "i", "686", " ", "GN", "U", "/", "Lin", "ux", "\"_", "%_", "self_", "._", "honey", "pot_", "._", "hostname_", ")_", "\\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 ", " _", "parts_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Actual", "ly", ",", " ", "the", " ", "order", " ", "matte", "rs", ",", " ", "e", ".", "g", ".", " ", "'-", "s", " ", "-", "r", " ", "-", "v", "'", " ", "give", "s", " ", "anot", "her", " ", "output_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "as", " ", "'-", "r", " ", "-", "v", " ", "-", "s", "'.", "_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "opts_", "._", "name_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "parts_", "._", "append_", "(_", "\"", "Lin", "ux", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "opts_", "._", "release_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "parts_", "._", "append_", "(_", "\"", "2.6", ".2", "6", "-", "2", "-", "686", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "opts_", "._", "kernel_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "parts_", "._", "append_", "(_", "\"#", "1", " ", "SM", "P", " ", "We", "d", " ", "Nov", " ", "4", " ", "20", ":", "4", "5", ":", "3", "7", " ", "UT", "C", " ", "200", "9", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "opts_", "._", "machine_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "parts_", "._", "append_", "(_", "\"", "i", "686", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "opts_", "._", "processor_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "parts_", "._", "append_", "(_", "\"", "i", "686", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "opts_", "._", "hardware_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "parts_", "._", "append_", "(_", "\"", "i", "686", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "opts_", "._", "os_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "parts_", "._", "append_", "(_", "\"", "GN", "U", "/", "Lin", "ux", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "No", " ", "command", " ", "give", "n", ",", " ", "displ", "y", " ", "the", " ", "name", " ", "only", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "parts_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "writeln_", "(_", "\"", " ", "\"_", "._", "join_", "(_", "parts_", ")_", ")_", "\\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_", "._", "writeln_", "(_", "\"", "Lin", "ux", "\"_", ")_", "\\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,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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 ]
Unused import
divmain/GitSavvy/github/commands/commit.py
[ { "content": "\"\"\"\nGitHub extensions to the new-commit view.\n\"\"\"\n\nimport re\n\nimport sublime\nfrom sublime_plugin import TextCommand\n\nfrom ...core.git_command import GitCommand\nfrom .. import github\nfrom .. import git_mixins\n\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class GsShowGithubIssuesCommand(TextCommand, GitCommand, git_mixins.GithubRemotesMixin):\n\n \"\"\"\n Display a panel of GitHub issues to either:\n\n 1) the remote repo, if default_repo is True, or\n 2) another repo on the same remote, if default_repo\n is False.\n\n After the user makes their selection, insert the issue\n number at the current cursor position.\n \"\"\"\n\n\n", "metadata": "root.GsShowGithubIssuesCommand", "header": "['module', '___EOS___']", "index": 14 }, { "content": " def run(self, edit, default_repo=True):\n if not default_repo:\n first_cursor = self.view.sel()[0].begin()\n text_before_cursor = self.view.substr(sublime.Region(0, first_cursor))\n nondefault_repo = re.search(r\"([a-zA-Z\\-_0-9\\.]+)/([a-zA-Z\\-_0-9\\.]+)#$\", text_before_cursor).groups()\n else:\n nondefault_repo = None\n\n sublime.set_timeout_async(lambda: self.run_async(nondefault_repo))", "metadata": "root.GsShowGithubIssuesCommand.run", "header": "['class', 'GsShowGithubIssuesCommand', '(', 'TextCommand', ',', 'GitCommand', ',', 'git_mixins', '.', 'GithubRemotesMixin', ')', ':', '___EOS___']", "index": 27 }, { "content": " def run_async(self, nondefault_repo):\n remote = github.parse_remote(self.get_integrated_remote_url())\n\n if nondefault_repo:\n owner, repo_name = nondefault_repo\n remote = github.GitHubRepo(\n url=\"\",\n fqdn=remote.fqdn,\n owner=owner,\n repo=repo_name,\n token=remote.token\n )\n\n issues = github.get_issues(remote)\n\n if not issues:\n return\n\n self.menu_items = [\"{} - {}\".format(issue[\"number\"], issue[\"title\"]) for issue in issues]\n self.view.show_popup_menu(self.menu_items, self.on_done)", "metadata": "root.GsShowGithubIssuesCommand.run_async", "header": "['class', 'GsShowGithubIssuesCommand', '(', 'TextCommand', ',', 'GitCommand', ',', 'git_mixins', '.', 'GithubRemotesMixin', ')', ':', '___EOS___']", "index": 37 }, { "content": " def on_done(self, selection_id):\n if selection_id != -1:\n selection = self.menu_items[selection_id]\n number = selection.split(\" \")[0]\n self.view.run_command(\"gs_insert_text_at_cursor\", {\"text\": number})", "metadata": "root.GsShowGithubIssuesCommand.on_done", "header": "['class', 'GsShowGithubIssuesCommand', '(', 'TextCommand', ',', 'GitCommand', ',', 'git_mixins', '.', 'GithubRemotesMixin', ')', ':', '___EOS___']", "index": 58 }, { "content": "class GsShowGithubContributorsCommand(TextCommand, GitCommand):\n\n \"\"\"\n Query github for a list of people that have contributed to the GitHub project\n setup as a remote for the current Git project, and display that list the the\n user. When a selection is made, insert that selection at the current cursor\n position.\n \"\"\"\n\n\n", "metadata": "root.GsShowGithubContributorsCommand", "header": "['module', '___EOS___']", "index": 65 }, { "content": " def run(self, edit):\n sublime.set_timeout_async(lambda: self.run_async())", "metadata": "root.GsShowGithubContributorsCommand.run", "header": "['class', 'GsShowGithubContributorsCommand', '(', 'TextCommand', ',', 'GitCommand', ')', ':', '___EOS___']", "index": 74 }, { "content": " def run_async(self):\n default_remote_name, default_remote = self.get_remotes().popitem(last=False)\n remote = github.parse_remote(default_remote)\n\n contributors = github.get_contributors(remote)\n\n if not contributors:\n return\n\n self.menu_items = [contributor[\"login\"] for contributor in contributors]\n self.view.show_popup_menu(self.menu_items, self.on_done)", "metadata": "root.GsShowGithubContributorsCommand.run_async", "header": "['class', 'GsShowGithubContributorsCommand', '(', 'TextCommand', ',', 'GitCommand', ')', ':', '___EOS___']", "index": 77 }, { "content": " def on_done(self, selection_id):\n if selection_id != -1:\n selection = self.menu_items[selection_id]\n self.view.run_command(\"gs_insert_text_at_cursor\", {\"text\": selection})", "metadata": "root.GsShowGithubContributorsCommand.on_done", "header": "['class', 'GsShowGithubContributorsCommand', '(', 'TextCommand', ',', 'GitCommand', ')', ':', '___EOS___']", "index": 89 } ]
[]
[]
0
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\"\"\"", "\\", "10", ";", "Git", "Hub", " ", "extensi", "ons", " ", "to", " ", "the", " ", "new", "-", "commit", " ", "view", ".", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "re_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "sublime_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "sublim", "e\\u", "plugin_", "import_", "Text", "Command_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "..._", "core_", "._", "git", "\\u", "command_", "import_", "Git", "Command_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "._", "._", "import_", "github_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "._", "._", "import_", "git", "\\u", "mixins_", "\\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_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Gs", "Show", "Git", "hub", "Issues", "Command_", "(_", "Text", "Command_", ",_", "Git", "Command_", ",_", "git", "\\u", "mixins_", "._", "Git", "hub", "Remo", "tes", "Mixin_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Display", " ", "a", " ", "panel", " ", "of", " ", "Git", "Hub", " ", "issue", "s", " ", "to", " ", "eit", "her", ":", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "1", ")", " ", "the", " ", "remote", " ", "repo", ",", " ", "if", " ", "default", "\\u", "repo", " ", "is", " ", "Tru", "e", ",", " ", "or", "\\", "10", ";", " ", " ", " ", " ", "2", ")", " ", "anot", "her", " ", "repo", " ", "on", " ", "the", " ", "same", " ", "remote", ",", " ", "if", " ", "default", "\\u", "repo", "\\", "10", ";", " ", " ", " ", "is", " ", "Fal", "se", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Af", "ter", " ", "the", " ", "user", " ", "make", "s", " ", "thei", "r", " ", "selection", ",", " ", "insert", " ", "the", " ", "issue", "\\", "10", ";", " ", " ", " ", " ", "number", " ", "at", " ", "the", " ", "current", " ", "cursor", " ", "position", ".", "\\", "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_", "[SEP]_", "class_", "Gs", "Show", "Git", "hub", "Issues", "Command_", "(_", "Text", "Command_", ",_", "Git", "Command_", ",_", "git", "\\u", "mixins_", "._", "Git", "hub", "Remo", "tes", "Mixin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "run_", "(_", "self_", ",_", "edit_", ",_", "default", "\\u", "repo_", "=_", "True_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "default", "\\u", "repo_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "first", "\\u", "cursor_", "=_", "self_", "._", "view_", "._", "sel_", "(_", ")_", "[_", "0_", "]_", "._", "begin_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "text", "\\u", "bef", "ore", "\\u", "cursor_", "=_", "self_", "._", "view_", "._", "substr_", "(_", "sublime_", "._", "Region_", "(_", "0_", ",_", "first", "\\u", "cursor_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "nond", "efa", "ult", "\\u", "repo_", "=_", "re_", "._", "search_", "(_", "r", "\"([", "a", "-", "z", "A", "-", "Z", "\\\\-\\", "u0", "-", "9", "\\\\.]", "+)/(", "[", "a", "-", "z", "A", "-", "Z", "\\\\-\\", "u0", "-", "9", "\\\\.]", "+)", "#$", "\"_", ",_", "text", "\\u", "bef", "ore", "\\u", "cursor_", ")_", "._", "groups_", "(_", ")_", "\\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 ", " _", "nond", "efa", "ult", "\\u", "repo_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "sublime_", "._", "set\\u", "timeo", "ut", "\\u", "async_", "(_", "lambda_", ":_", "self_", "._", "run", "\\u", "async_", "(_", "nond", "efa", "ult", "\\u", "repo_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Gs", "Show", "Git", "hub", "Issues", "Command_", "(_", "Text", "Command_", ",_", "Git", "Command_", ",_", "git", "\\u", "mixins_", "._", "Git", "hub", "Remo", "tes", "Mixin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "run", "\\u", "async_", "(_", "self_", ",_", "nond", "efa", "ult", "\\u", "repo_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "remote_", "=_", "github_", "._", "parse", "\\u", "remote_", "(_", "self_", "._", "get", "\\u", "integrated", "\\u", "remote", "\\u", "url_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "nond", "efa", "ult", "\\u", "repo_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "owner_", ",_", "repo", "\\u", "name_", "=_", "nond", "efa", "ult", "\\u", "repo_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "remote_", "=_", "github_", "._", "Git", "Hub", "Repo_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "url_", "=_", "\"\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "fqdn_", "=_", "remote_", "._", "fqdn_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "owner_", "=_", "owner_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "repo_", "=_", "repo", "\\u", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "token_", "=_", "remote_", "._", "token_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "issues_", "=_", "github_", "._", "get", "\\u", "issues_", "(_", "remote_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "issues_", ":_", "\\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_", "self_", "._", "menu", "\\u", "items_", "=_", "[_", "\"{}", " ", "-", " ", "{}\"_", "._", "format_", "(_", "issue_", "[_", "\"", "number", "\"_", "]_", ",_", "issue_", "[_", "\"", "title", "\"_", "]_", ")_", "for_", "issue_", "in_", "issues_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "view_", "._", "show", "\\u", "popu", "p", "\\u", "menu_", "(_", "self_", "._", "menu", "\\u", "items_", ",_", "self_", "._", "on", "\\u", "done_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Gs", "Show", "Git", "hub", "Issues", "Command_", "(_", "Text", "Command_", ",_", "Git", "Command_", ",_", "git", "\\u", "mixins_", "._", "Git", "hub", "Remo", "tes", "Mixin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "on", "\\u", "done_", "(_", "self_", ",_", "selection", "\\u", "id_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "selection", "\\u", "id_", "!=_", "-_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "selection_", "=_", "self_", "._", "menu", "\\u", "items_", "[_", "selection", "\\u", "id_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "number_", "=_", "selection_", "._", "split_", "(_", "\"", " ", "\"_", ")_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "view_", "._", "run", "\\u", "command_", "(_", "\"", "gs", "\\u", "insert", "\\u", "text", "\\u", "at", "\\u", "cursor", "\"_", ",_", "{_", "\"", "text", "\"_", ":_", "number_", "}_", ")_", "\\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_", "Gs", "Show", "Git", "hub", "Contributor", "s", "Command_", "(_", "Text", "Command_", ",_", "Git", "Command_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Query", " ", "git", "hub", " ", "for", " ", "a", " ", "list", " ", "of", " ", "people", " ", "tha", "t", " ", "have", " ", "contribute", "d", " ", "to", " ", "the", " ", "Git", "Hub", " ", "project", "\\", "10", ";", " ", " ", " ", " ", "setup", " ", "as", " ", "a", " ", "remote", " ", "for", " ", "the", " ", "current", " ", "Git", " ", "project", ",", " ", "and", " ", "display", " ", "tha", "t", " ", "list", " ", "the", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "user", ".", " ", " ", "Whe", "n", " ", "a", " ", "selection", " ", "is", " ", "made", ",", " ", "insert", " ", "tha", "t", " ", "selection", " ", "at", " ", "the", " ", "current", " ", "cursor", "\\", "10", ";", " ", " ", " ", " ", "position", ".", "\\", "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_", "[SEP]_", "class_", "Gs", "Show", "Git", "hub", "Contributor", "s", "Command_", "(_", "Text", "Command_", ",_", "Git", "Command_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "run_", "(_", "self_", ",_", "edit_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sublime_", "._", "set\\u", "timeo", "ut", "\\u", "async_", "(_", "lambda_", ":_", "self_", "._", "run", "\\u", "async_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Gs", "Show", "Git", "hub", "Contributor", "s", "Command_", "(_", "Text", "Command_", ",_", "Git", "Command_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "run", "\\u", "async_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "default", "\\u", "remote", "\\u", "name_", ",_", "default", "\\u", "remote_", "=_", "self_", "._", "get", "\\u", "remotes", "_", "(_", ")_", "._", "popi", "tem_", "(_", "last_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "remote_", "=_", "github_", "._", "parse", "\\u", "remote_", "(_", "default", "\\u", "remote_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "contributor", "s_", "=_", "github_", "._", "get", "\\u", "contributor", "s_", "(_", "remote_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "contributor", "s_", ":_", "\\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_", "self_", "._", "menu", "\\u", "items_", "=_", "[_", "contributor_", "[_", "\"", "login", "\"_", "]_", "for_", "contributor_", "in_", "contributor", "s_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "view_", "._", "show", "\\u", "popu", "p", "\\u", "menu_", "(_", "self_", "._", "menu", "\\u", "items_", ",_", "self_", "._", "on", "\\u", "done_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Gs", "Show", "Git", "hub", "Contributor", "s", "Command_", "(_", "Text", "Command_", ",_", "Git", "Command_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "on", "\\u", "done_", "(_", "self_", ",_", "selection", "\\u", "id_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "selection", "\\u", "id_", "!=_", "-_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "selection_", "=_", "self_", "._", "menu", "\\u", "items_", "[_", "selection", "\\u", "id_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "view_", "._", "run", "\\u", "command_", "(_", "\"", "gs", "\\u", "insert", "\\u", "text", "\\u", "at", "\\u", "cursor", "\"_", ",_", "{_", "\"", "text", "\"_", ":_", "selection_", "}_", ")_" ]
[ 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, 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,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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 ]
Unused import
reviewboard/rbtools/rbtools/clients/git.py
[ { "content": "import logging\nimport os\nimport re\nimport sys\n\nfrom rbtools.clients import PatchResult, SCMClient, RepositoryInfo\nfrom rbtools.clients.errors import (AmendError, MergeError, PushError,\n InvalidRevisionSpecError,\n TooManyRevisionsError)\nfrom rbtools.clients.perforce import PerforceClient\nfrom rbtools.clients.svn import SVNClient, SVNRepositoryInfo\nfrom rbtools.utils.checks import check_install, is_valid_version\nfrom rbtools.utils.console import edit_text\nfrom rbtools.utils.diffs import (normalize_patterns,\n remove_filenames_matching_patterns)\nfrom rbtools.utils.process import die, execute\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class GitClient(SCMClient):\n \"\"\"\n A wrapper around git that fetches repository information and generates\n compatible diffs. This will attempt to generate a diff suitable for the\n remote repository, whether git, SVN or Perforce.\n \"\"\"\n name = 'Git'\n\n supports_diff_exclude_patterns = True\n supports_patch_revert = True\n\n can_amend_commit = True\n can_merge = True\n can_push_upstream = True\n can_delete_branch = True\n can_branch = True\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n", "metadata": "root.GitClient", "header": "['module', '___EOS___']", "index": 18 }, { "content": " def __init__(self, **kwargs):\n super(GitClient, self).__init__(**kwargs)\n # Store the 'correct' way to invoke git, just plain old 'git' by\n # default.\n self.git = 'git'\n\n self._original_cwd = None", "metadata": "root.GitClient.__init__", "header": "['class', 'GitClient', '(', 'SCMClient', ')', ':', '___EOS___']", "index": 35 }, { "content": " def _supports_git_config_flag(self):\n \"\"\"Return if the installed version of git supports the -c flag.\n\n This will execute ``git --version`` on the first call and cache the\n result.\n \"\"\"\n if not hasattr(self, '_git_version_at_least_180'):\n self._git_version_least_180 = False\n\n version_str = execute([self.git, 'version'], ignore_errors=True,\n none_on_ignored_error=True)\n\n if version_str:\n m = re.search('(\\d+)\\.(\\d+)\\.(\\d+)', version_str)\n\n if m:\n git_version = (int(m.group(1)),\n int(m.group(2)),\n int(m.group(3)))\n\n self._git_version_at_least_180 = git_version >= (1, 8, 0)\n\n return self._git_version_at_least_180", "metadata": "root.GitClient._supports_git_config_flag", "header": "['class', 'GitClient', '(', 'SCMClient', ')', ':', '___EOS___']", "index": 43 }, { "content": " def parse_revision_spec(self, revisions=[]):\n \"\"\"Parses the given revision spec.\n\n The 'revisions' argument is a list of revisions as specified by the\n user. Items in the list do not necessarily represent a single revision,\n since the user can use SCM-native syntaxes such as \"r1..r2\" or \"r1:r2\".\n SCMTool-specific overrides of this method are expected to deal with\n such syntaxes.\n\n This will return a dictionary with the following keys:\n 'base': A revision to use as the base of the resulting diff.\n 'tip': A revision to use as the tip of the resulting diff.\n 'parent_base': (optional) The revision to use as the base of a\n parent diff.\n 'commit_id': (optional) The ID of the single commit being posted,\n if not using a range.\n\n These will be used to generate the diffs to upload to Review Board (or\n print). The diff for review will include the changes in (base, tip],\n and the parent diff (if necessary) will include (parent_base, base].\n\n If a single revision is passed in, this will return the parent of that\n revision for 'base' and the passed-in revision for 'tip'.\n\n If zero revisions are passed in, this will return the current HEAD as\n 'tip', and the upstream branch as 'base', taking into account parent\n branches explicitly specified via --parent.\n \"\"\"\n n_revs = len(revisions)\n result = {}\n\n if n_revs == 0:\n # No revisions were passed in--start with HEAD, and find the\n # tracking branch automatically.\n parent_branch = self.get_parent_branch()\n head_ref = self._rev_parse(self.get_head_ref())[0]\n merge_base = self._rev_parse(\n self._get_merge_base(head_ref, self.upstream_branch))[0]\n\n result = {\n 'tip': head_ref,\n 'commit_id': head_ref,\n }\n\n if parent_branch:\n result['base'] = self._rev_parse(parent_branch)[0]\n result['parent_base'] = merge_base\n else:\n result['base'] = merge_base\n\n # Since the user asked us to operate on HEAD, warn them about a\n # dirty working directory\n if self.has_pending_changes():\n logging.warning('Your working directory is not clean. Any '\n 'changes which have not been committed '\n 'to a branch will not be included in your '\n 'review request.')\n elif n_revs == 1 or n_revs == 2:\n # Let `git rev-parse` sort things out.\n parsed = self._rev_parse(revisions)\n\n n_parsed_revs = len(parsed)\n assert n_parsed_revs <= 3\n\n if n_parsed_revs == 1:\n # Single revision. Extract the parent of that revision to use\n # as the base.\n parent = self._rev_parse('%s^' % parsed[0])[0]\n result = {\n 'base': parent,\n 'tip': parsed[0],\n 'commit_id': parsed[0],\n }\n elif n_parsed_revs == 2:\n if parsed[1].startswith('^'):\n # Passed in revisions were probably formatted as\n # \"base..tip\". The rev-parse output includes all ancestors\n # of the first part, and none of the ancestors of the\n # second. Basically, the second part is the base (after\n # stripping the ^ prefix) and the first is the tip.\n result = {\n 'base': parsed[1][1:],\n 'tip': parsed[0],\n }\n else:\n # First revision is base, second is tip\n result = {\n 'base': parsed[0],\n 'tip': parsed[1],\n }\n elif n_parsed_revs == 3 and parsed[2].startswith('^'):\n # Revision spec is diff-since-merge. Find the merge-base of the\n # two revs to use as base.\n merge_base = execute([self.git, 'merge-base', parsed[0],\n parsed[1]]).strip()\n result = {\n 'base': merge_base,\n 'tip': parsed[0],\n }\n else:\n raise InvalidRevisionSpecError(\n 'Unexpected result while parsing revision spec')\n\n parent_base = self._get_merge_base(result['base'],\n self.upstream_branch)\n if parent_base != result['base']:\n result['parent_base'] = parent_base\n else:\n raise TooManyRevisionsError\n\n return result", "metadata": "root.GitClient.parse_revision_spec", "header": "['class', 'GitClient', '(', 'SCMClient', ')', ':', '___EOS___']", "index": 67 }, { "content": " def get_repository_info(self):\n \"\"\"Get repository information for the current Git working tree.\n\n This function changes the directory to the top level directory of the\n current working tree.\n \"\"\"\n if not check_install(['git', '--help']):\n # CreateProcess (launched via subprocess, used by check_install)\n # does not automatically append .cmd for things it finds in PATH.\n # If we're on Windows, and this works, save it for further use.\n if (sys.platform.startswith('win') and\n check_install(['git.cmd', '--help'])):\n self.git = 'git.cmd'\n else:\n logging.debug('Unable to execute \"git --help\" or \"git.cmd '\n '--help\": skipping Git')\n return None\n\n git_dir = execute([self.git, \"rev-parse\", \"--git-dir\"],\n ignore_errors=True).rstrip(\"\\n\")\n\n if git_dir.startswith(\"fatal:\") or not os.path.isdir(git_dir):\n return None\n\n # Sometimes core.bare is not set, and generates an error, so ignore\n # errors. Valid values are 'true' or '1'.\n bare = execute([self.git, 'config', 'core.bare'],\n ignore_errors=True).strip()\n self.bare = bare in ('true', '1')\n\n # If we are not working in a bare repository, then we will change\n # directory to the top level working tree lose our original position.\n # However, we need the original working directory for file exclusion\n # patterns, so we save it here.\n if self._original_cwd is None:\n self._original_cwd = os.getcwd()\n\n # Running in directories other than the top level of\n # of a work-tree would result in broken diffs on the server\n if not self.bare:\n git_top = execute([self.git, \"rev-parse\", \"--show-toplevel\"],\n ignore_errors=True).rstrip(\"\\n\")\n\n # Top level might not work on old git version se we use git dir\n # to find it.\n if (git_top.startswith('fatal:') or not os.path.isdir(git_dir)\n or git_top.startswith('cygdrive')):\n git_top = git_dir\n\n os.chdir(os.path.abspath(git_top))\n\n self.head_ref = execute([self.git, 'symbolic-ref', '-q',\n 'HEAD'], ignore_errors=True).strip()\n\n # We know we have something we can work with. Let's find out\n # what it is. We'll try SVN first, but only if there's a .git/svn\n # directory. Otherwise, it may attempt to create one and scan\n # revisions, which can be slow. Also skip SVN detection if the git\n # repository was specified on command line.\n git_svn_dir = os.path.join(git_dir, 'svn')\n\n if (not getattr(self.options, 'repository_url', None) and\n os.path.isdir(git_svn_dir) and len(os.listdir(git_svn_dir)) > 0):\n data = execute([self.git, \"svn\", \"info\"], ignore_errors=True)\n\n m = re.search(r'^Repository Root: (.+)$', data, re.M)\n\n if m:\n path = m.group(1)\n m = re.search(r'^URL: (.+)$', data, re.M)\n\n if m:\n base_path = m.group(1)[len(path):] or \"/\"\n m = re.search(r'^Repository UUID: (.+)$', data, re.M)\n\n if m:\n uuid = m.group(1)\n self.type = \"svn\"\n\n # Get SVN tracking branch\n if getattr(self.options, 'tracking', None):\n self.upstream_branch = self.options.tracking\n else:\n data = execute([self.git, \"svn\", \"rebase\", \"-n\"],\n ignore_errors=True)\n m = re.search(r'^Remote Branch:\\s*(.+)$', data,\n re.M)\n\n if m:\n self.upstream_branch = m.group(1)\n else:\n sys.stderr.write('Failed to determine SVN '\n 'tracking branch. Defaulting'\n 'to \"master\"\\n')\n self.upstream_branch = 'master'\n\n return SVNRepositoryInfo(path=path,\n base_path=base_path,\n uuid=uuid,\n supports_parent_diffs=True)\n else:\n # Versions of git-svn before 1.5.4 don't (appear to) support\n # 'git svn info'. If we fail because of an older git install,\n # here, figure out what version of git is installed and give\n # the user a hint about what to do next.\n version = execute([self.git, \"svn\", \"--version\"],\n ignore_errors=True)\n version_parts = re.search('version (\\d+)\\.(\\d+)\\.(\\d+)',\n version)\n svn_remote = execute(\n [self.git, \"config\", \"--get\", \"svn-remote.svn.url\"],\n ignore_errors=True)\n\n if (version_parts and svn_remote and\n not is_valid_version((int(version_parts.group(1)),\n int(version_parts.group(2)),\n int(version_parts.group(3))),\n (1, 5, 4))):\n die(\"Your installation of git-svn must be upgraded to \"\n \"version 1.5.4 or later\")\n\n # Okay, maybe Perforce (git-p4).\n git_p4_ref = os.path.join(git_dir, 'refs', 'remotes', 'p4', 'master')\n if os.path.exists(git_p4_ref):\n data = execute([self.git, 'config', '--get', 'git-p4.port'],\n ignore_errors=True)\n m = re.search(r'(.+)', data)\n if m:\n port = m.group(1)\n else:\n port = os.getenv('P4PORT')\n\n if port:\n self.type = 'perforce'\n self.upstream_branch = 'remotes/p4/master'\n return RepositoryInfo(path=port,\n base_path='',\n supports_parent_diffs=True)\n\n # Nope, it's git then.\n # Check for a tracking branch and determine merge-base\n self.upstream_branch = ''\n if self.head_ref:\n short_head = self._strip_heads_prefix(self.head_ref)\n merge = execute([self.git, 'config', '--get',\n 'branch.%s.merge' % short_head],\n ignore_errors=True).strip()\n remote = execute([self.git, 'config', '--get',\n 'branch.%s.remote' % short_head],\n ignore_errors=True).strip()\n\n merge = self._strip_heads_prefix(merge)\n\n if remote and remote != '.' and merge:\n self.upstream_branch = '%s/%s' % (remote, merge)\n\n url = None\n if getattr(self.options, 'repository_url', None):\n url = self.options.repository_url\n self.upstream_branch = self.get_origin(self.upstream_branch,\n True)[0]\n else:\n self.upstream_branch, origin_url = \\\n self.get_origin(self.upstream_branch, True)\n\n if not origin_url or origin_url.startswith(\"fatal:\"):\n self.upstream_branch, origin_url = self.get_origin()\n\n url = origin_url.rstrip('/')\n\n # Central bare repositories don't have origin URLs.\n # We return git_dir instead and hope for the best.\n if not url:\n url = os.path.abspath(git_dir)\n\n # There is no remote, so skip this part of upstream_branch.\n self.upstream_branch = self.upstream_branch.split('/')[-1]\n\n if url:\n self.type = \"git\"\n return RepositoryInfo(path=url, base_path='',\n supports_parent_diffs=True)\n return None", "metadata": "root.GitClient.get_repository_info", "header": "['class', 'GitClient', '(', 'SCMClient', ')', ':', '___EOS___']", "index": 179 }, { "content": " def _strip_heads_prefix(self, ref):\n \"\"\"Strips prefix from ref name, if possible.\"\"\"\n return re.sub(r'^refs/heads/', '', ref)", "metadata": "root.GitClient._strip_heads_prefix", "header": "['class', 'GitClient', '(', 'SCMClient', ')', ':', '___EOS___']", "index": 363 }, { "content": " def get_origin(self, default_upstream_branch=None, ignore_errors=False):\n \"\"\"Get upstream remote origin from options or parameters.\n\n Returns a tuple: (upstream_branch, remote_url)\n \"\"\"\n upstream_branch = (getattr(self.options, 'tracking', None) or\n default_upstream_branch or\n 'origin/master')\n upstream_remote = upstream_branch.split('/')[0]\n origin_url = execute(\n [self.git, \"config\", \"--get\", \"remote.%s.url\" % upstream_remote],\n ignore_errors=True).rstrip(\"\\n\")\n return (upstream_branch, origin_url)", "metadata": "root.GitClient.get_origin", "header": "['class', 'GitClient', '(', 'SCMClient', ')', ':', '___EOS___']", "index": 367 }, { "content": " def scan_for_server(self, repository_info):\n # Scan first for dot files, since it's faster and will cover the\n # user's $HOME/.reviewboardrc\n server_url = super(GitClient, self).scan_for_server(repository_info)\n\n if server_url:\n return server_url\n\n # TODO: Maybe support a server per remote later? Is that useful?\n url = execute([self.git, \"config\", \"--get\", \"reviewboard.url\"],\n ignore_errors=True).strip()\n if url:\n return url\n\n if self.type == \"svn\":\n # Try using the reviewboard:url property on the SVN repo, if it\n # exists.\n prop = SVNClient().scan_for_server_property(repository_info)\n\n if prop:\n return prop\n elif self.type == 'perforce':\n prop = PerforceClient().scan_for_server(repository_info)\n\n if prop:\n return prop\n\n return None", "metadata": "root.GitClient.scan_for_server", "header": "['class', 'GitClient', '(', 'SCMClient', ')', ':', '___EOS___']", "index": 381 }, { "content": " def get_raw_commit_message(self, revisions):\n \"\"\"Extracts the commit message based on the provided revision range.\"\"\"\n return execute(\n [self.git, 'log', '--reverse', '--pretty=format:%s%n%n%b',\n '^%s' % revisions['base'], revisions['tip']],\n ignore_errors=True).strip()", "metadata": "root.GitClient.get_raw_commit_message", "header": "['class', 'GitClient', '(', 'SCMClient', ')', ':', '___EOS___']", "index": 410 }, { "content": " def get_parent_branch(self):\n \"\"\"Returns the parent branch.\"\"\"\n parent_branch = getattr(self.options, 'parent_branch', None)\n\n if self.type == 'perforce':\n parent_branch = parent_branch or 'p4'\n\n return parent_branch", "metadata": "root.GitClient.get_parent_branch", "header": "['class', 'GitClient', '(', 'SCMClient', ')', ':', '___EOS___']", "index": 417 }, { "content": " def get_head_ref(self):\n \"\"\"Returns the HEAD reference.\"\"\"\n head_ref = \"HEAD\"\n\n if self.head_ref:\n head_ref = self.head_ref\n\n return head_ref", "metadata": "root.GitClient.get_head_ref", "header": "['class', 'GitClient', '(', 'SCMClient', ')', ':', '___EOS___']", "index": 426 }, { "content": " def _get_merge_base(self, rev1, rev2):\n \"\"\"Returns the merge base.\"\"\"\n return execute([self.git, \"merge-base\", rev1, rev2]).strip()", "metadata": "root.GitClient._get_merge_base", "header": "['class', 'GitClient', '(', 'SCMClient', ')', ':', '___EOS___']", "index": 435 }, { "content": " def _rev_parse(self, revisions):\n \"\"\"Runs `git rev-parse` and returns a list of revisions.\"\"\"\n if not isinstance(revisions, list):\n revisions = [revisions]\n\n return execute([self.git, 'rev-parse'] + revisions).strip().split('\\n')", "metadata": "root.GitClient._rev_parse", "header": "['class', 'GitClient', '(', 'SCMClient', ')', ':', '___EOS___']", "index": 439 }, { "content": " def diff(self, revisions, include_files=[], exclude_patterns=[],\n extra_args=[]):\n \"\"\"Perform a diff using the given revisions.\n\n If no revisions are specified, this will do a diff of the contents of\n the current branch since the tracking branch (which defaults to\n 'master'). If one revision is specified, this will get the diff of that\n specific change. If two revisions are specified, this will do a diff\n between those two revisions.\n\n If a parent branch is specified via the command-line options, or would\n make sense given the requested revisions and the tracking branch, this\n will also return a parent diff.\n \"\"\"\n exclude_patterns = normalize_patterns(exclude_patterns,\n self._get_root_directory(),\n cwd=self.original_cwd)\n\n try:\n merge_base = revisions['parent_base']\n except KeyError:\n merge_base = revisions['base']\n\n diff_lines = self.make_diff(merge_base,\n revisions['base'],\n revisions['tip'],\n include_files,\n exclude_patterns)\n\n if 'parent_base' in revisions:\n parent_diff_lines = self.make_diff(merge_base,\n revisions['parent_base'],\n revisions['base'],\n include_files,\n exclude_patterns)\n\n base_commit_id = revisions['parent_base']\n else:\n parent_diff_lines = None\n base_commit_id = revisions['base']\n\n return {\n 'diff': diff_lines,\n 'parent_diff': parent_diff_lines,\n 'commit_id': revisions.get('commit_id'),\n 'base_commit_id': base_commit_id,\n }", "metadata": "root.GitClient.diff", "header": "['class', 'GitClient', '(', 'SCMClient', ')', ':', '___EOS___']", "index": 446 }, { "content": " def make_diff(self, merge_base, base, tip, include_files,\n exclude_patterns):\n \"\"\"Performs a diff on a particular branch range.\"\"\"\n rev_range = \"%s..%s\" % (base, tip)\n\n if include_files:\n include_files = ['--'] + include_files\n\n git_cmd = [self.git]\n\n if self._supports_git_config_flag():\n git_cmd.extend(['-c', 'core.quotepath=false'])\n\n if self.type in ('svn', 'perforce'):\n diff_cmd_params = ['--no-color', '--no-prefix', '-r', '-u']\n elif self.type == 'git':\n diff_cmd_params = ['--no-color', '--full-index',\n '--ignore-submodules']\n\n if self._supports_git_config_flag():\n git_cmd.extend(['-c', 'diff.noprefix=false'])\n\n if (self.capabilities is not None and\n self.capabilities.has_capability('diffs', 'moved_files')):\n diff_cmd_params.append('-M')\n else:\n diff_cmd_params.append('--no-renames')\n else:\n assert False\n\n # By default, don't allow using external diff commands. This prevents\n # things from breaking horribly if someone configures a graphical diff\n # viewer like p4merge or kaleidoscope. This can be overridden by\n # setting GIT_USE_EXT_DIFF = True in ~/.reviewboardrc\n if not self.config.get('GIT_USE_EXT_DIFF', False):\n diff_cmd_params.append('--no-ext-diff')\n\n diff_cmd = git_cmd + ['diff'] + diff_cmd_params\n\n if exclude_patterns:\n # If we have specified files to exclude, we will get a list of all\n # changed files and run `git diff` on each un-excluded file\n # individually.\n changed_files_cmd = git_cmd + ['diff-tree'] + diff_cmd_params\n if self.type == 'git':\n changed_files_cmd.append('-r')\n\n changed_files = execute(\n changed_files_cmd + [rev_range] + include_files,\n split_lines=True,\n with_errors=False,\n ignore_errors=True,\n none_on_ignored_error=True,\n log_output_on_error=False)\n\n # The output of git diff-tree will be a list of entries that have\n # changed between the two revisions that we give it. The last part\n # of the line is the name of the file that has changed.\n changed_files = remove_filenames_matching_patterns(\n (filename.split()[-1] for filename in changed_files),\n exclude_patterns, base_dir=self._get_root_directory())\n\n diff_lines = []\n\n for filename in changed_files:\n lines = execute(diff_cmd + [rev_range, '--', filename],\n split_lines=True,\n with_errors=False,\n ignore_errors=True,\n none_on_ignored_error=True,\n log_output_on_error=False,\n results_unicode=False)\n\n if lines is None:\n logging.error(\n 'Could not get diff for all files (git-diff failed '\n 'for \"%s\"). Refusing to return a partial diff.' %\n filename)\n\n diff_lines = None\n break\n\n diff_lines += lines\n\n else:\n diff_lines = execute(diff_cmd + [rev_range] + include_files,\n split_lines=True,\n with_errors=False,\n ignore_errors=True,\n none_on_ignored_error=True,\n log_output_on_error=False,\n results_unicode=False)\n\n if self.type == 'svn':\n return self.make_svn_diff(merge_base, diff_lines)\n elif self.type == 'perforce':\n return self.make_perforce_diff(merge_base, diff_lines)\n else:\n return b''.join(diff_lines)", "metadata": "root.GitClient.make_diff", "header": "['class', 'GitClient', '(', 'SCMClient', ')', ':', '___EOS___']", "index": 494 }, { "content": " def make_svn_diff(self, merge_base, diff_lines):\n \"\"\"\n Formats the output of git diff such that it's in a form that\n svn diff would generate. This is needed so the SVNTool in Review\n Board can properly parse this diff.\n \"\"\"\n rev = execute([self.git, \"svn\", \"find-rev\", merge_base]).strip()\n\n if not rev:\n return None\n\n diff_data = b''\n original_file = b''\n filename = b''\n newfile = False\n\n for i, line in enumerate(diff_lines):\n if line.startswith(b'diff '):\n # Grab the filename and then filter this out.\n # This will be in the format of:\n #\n # diff --git a/path/to/file b/path/to/file\n info = line.split(b' ')\n diff_data += b'Index: %s\\n' % info[2]\n diff_data += b'=' * 67\n diff_data += b'\\n'\n elif line.startswith(b'index '):\n # Filter this out.\n pass\n elif line.strip() == b'--- /dev/null':\n # New file\n newfile = True\n elif (line.startswith(b'--- ') and i + 1 < len(diff_lines) and\n diff_lines[i + 1].startswith(b'+++ ')):\n newfile = False\n original_file = line[4:].strip()\n diff_data += b'--- %s\\t(revision %s)\\n' % (original_file, rev)\n elif line.startswith(b'+++ '):\n filename = line[4:].strip()\n if newfile:\n diff_data += b'--- %s\\t(revision 0)\\n' % filename\n diff_data += b'+++ %s\\t(revision 0)\\n' % filename\n else:\n # We already printed the \"--- \" line.\n diff_data += b'+++ %s\\t(working copy)\\n' % original_file\n elif (line.startswith(b'new file mode') or\n line.startswith(b'deleted file mode')):\n # Filter this out.\n pass\n elif line.startswith(b'Binary files '):\n # Add the following so that we know binary files were\n # added/changed.\n diff_data += b'Cannot display: file marked as a binary type.\\n'\n diff_data += b'svn:mime-type = application/octet-stream\\n'\n else:\n diff_data += line\n\n return diff_data", "metadata": "root.GitClient.make_svn_diff", "header": "['class', 'GitClient', '(', 'SCMClient', ')', ':', '___EOS___']", "index": 594 }, { "content": " def make_perforce_diff(self, merge_base, diff_lines):\n \"\"\"Format the output of git diff to look more like perforce's.\"\"\"\n diff_data = b''\n filename = b''\n p4rev = b''\n\n # Find which depot changelist we're based on\n log = execute([self.git, 'log', merge_base], ignore_errors=True)\n\n for line in log:\n m = re.search(br'[rd]epo.-paths = \"(.+)\": change = (\\d+).*\\]',\n log, re.M)\n\n if m:\n base_path = m.group(1).strip()\n p4rev = m.group(2).strip()\n break\n else:\n # We should really raise an error here, base_path is required\n pass\n\n for i, line in enumerate(diff_lines):\n if line.startswith(b'diff '):\n # Grab the filename and then filter this out.\n # This will be in the format of:\n # diff --git a/path/to/file b/path/to/file\n filename = line.split(b' ')[2].strip()\n elif (line.startswith(b'index ') or\n line.startswith(b'new file mode ')):\n # Filter this out\n pass\n elif (line.startswith(b'--- ') and i + 1 < len(diff_lines) and\n diff_lines[i + 1].startswith(b'+++ ')):\n data = execute(\n ['p4', 'files', base_path + filename + '@' + p4rev],\n ignore_errors=True, results_unicode=False)\n m = re.search(br'^%s%s#(\\d+).*$' % (re.escape(base_path),\n re.escape(filename)),\n data, re.M)\n if m:\n file_version = m.group(1).strip()\n else:\n file_version = 1\n\n diff_data += b'--- %s%s\\t%s%s#%s\\n' % (base_path, filename,\n base_path, filename,\n file_version)\n elif line.startswith(b'+++ '):\n # TODO: add a real timestamp\n diff_data += b'+++ %s%s\\t%s\\n' % (base_path, filename,\n b'TIMESTAMP')\n else:\n diff_data += line\n\n return diff_data", "metadata": "root.GitClient.make_perforce_diff", "header": "['class', 'GitClient', '(', 'SCMClient', ')', ':', '___EOS___']", "index": 653 }, { "content": " def has_pending_changes(self):\n \"\"\"Checks if there are changes waiting to be committed.\n\n Returns True if the working directory has been modified or if changes\n have been staged in the index, otherwise returns False.\n \"\"\"\n status = execute(['git', 'status', '--porcelain',\n '--untracked-files=no'])\n return status != ''", "metadata": "root.GitClient.has_pending_changes", "header": "['class', 'GitClient', '(', 'SCMClient', ')', ':', '___EOS___']", "index": 709 }, { "content": " def amend_commit_description(self, message, revisions):\n \"\"\"Update a commit message to the given string.\n\n Since git can amend only the most recent commit, an AmendError will be\n raised if revisions points to a commit other than the the most recent\n commit.\n \"\"\"\n if revisions and revisions['tip']:\n commit_ids = execute([self.git, 'rev-parse', 'HEAD',\n revisions['tip']], split_lines=True)\n head_id = commit_ids[0].strip()\n revision_id = commit_ids[1].strip()\n\n if head_id != revision_id:\n raise AmendError('Commit \"%s\" is not the latest commit, '\n 'and thus cannot be modified' % revision_id)\n\n execute([self.git, 'commit', '--amend', '-m', message])", "metadata": "root.GitClient.amend_commit_description", "header": "['class', 'GitClient', '(', 'SCMClient', ')', ':', '___EOS___']", "index": 719 }, { "content": " def apply_patch(self, patch_file, base_path=None, base_dir=None, p=None,\n revert=False):\n \"\"\"Apply the given patch to index.\n\n This will take the given patch file and apply it to the index,\n scheduling all changes for commit.\n \"\"\"\n cmd = ['git', 'apply', '-3']\n\n if revert:\n cmd.append('-R')\n\n if p:\n cmd += ['-p', p]\n\n cmd.append(patch_file)\n\n rc, data = self._execute(cmd, with_errors=True, return_error_code=True)\n\n if rc == 0:\n return PatchResult(applied=True, patch_output=data)\n elif 'with conflicts' in data:\n return PatchResult(\n applied=True,\n has_conflicts=True,\n conflicting_files=[\n line.split(' ', 1)[1]\n for line in data.splitlines()\n if line.startswith('U')\n ],\n patch_output=data)\n else:\n return PatchResult(applied=False, patch_output=data)", "metadata": "root.GitClient.apply_patch", "header": "['class', 'GitClient', '(', 'SCMClient', ')', ':', '___EOS___']", "index": 738 }, { "content": " def create_commit(self, message, author, run_editor,\n files=[], all_files=False):\n \"\"\"Commits the given modified files.\n\n This is expected to be called after applying a patch. This commits the\n patch using information from the review request, opening the commit\n message in $EDITOR to allow the user to update it.\n \"\"\"\n if run_editor:\n modified_message = edit_text(message)\n else:\n modified_message = message\n\n if all_files:\n execute(['git', 'add', '--all', ':/'])\n elif files:\n execute(['git', 'add'] + files)\n\n execute(['git', 'commit', '-m', modified_message,\n '--author=\"%s <%s>\"' % (author.fullname, author.email)])", "metadata": "root.GitClient.create_commit", "header": "['class', 'GitClient', '(', 'SCMClient', ')', ':', '___EOS___']", "index": 772 }, { "content": " def delete_branch(self, branch_name, merged_only=True):\n \"\"\"Deletes the specified branch.\n\n If merged_only is False, then the branch will be deleted even if not\n yet merged into an upstream branch.\n \"\"\"\n if merged_only:\n delete_flag = '-d'\n else:\n delete_flag = '-D'\n\n execute(['git', 'branch', delete_flag, branch_name])", "metadata": "root.GitClient.delete_branch", "header": "['class', 'GitClient', '(', 'SCMClient', ')', ':', '___EOS___']", "index": 793 }, { "content": " def merge(self, target, destination, message, author, squash=False,\n run_editor=False):\n \"\"\"Merges the target branch with destination branch.\"\"\"\n rc, output = execute(\n ['git', 'checkout', destination],\n ignore_errors=True,\n return_error_code=True)\n\n if rc:\n raise MergeError(\"Could not checkout to branch '%s'.\\n\\n%s\" %\n (destination, output))\n\n if squash:\n method = '--squash'\n else:\n method = '--no-ff'\n\n rc, output = execute(\n ['git', 'merge', target, method, '--no-commit'],\n ignore_errors=True,\n return_error_code=True)\n\n if rc:\n raise MergeError(\"Could not merge branch '%s' into '%s'.\\n\\n%s\" %\n (target, destination, output))\n\n self.create_commit(message, author, run_editor)", "metadata": "root.GitClient.merge", "header": "['class', 'GitClient', '(', 'SCMClient', ')', ':', '___EOS___']", "index": 806 }, { "content": " def push_upstream(self, remote_branch):\n \"\"\"Pushes the current branch to upstream.\"\"\"\n origin_url = self.get_origin()[1]\n rc, output = execute(\n ['git', 'pull', '--rebase', origin_url, remote_branch],\n ignore_errors=True,\n return_error_code=True)\n\n if rc:\n raise PushError('Could not pull changes from upstream.')\n\n rc, output = execute(\n ['git', 'push', origin_url, remote_branch],\n ignore_errors=True,\n return_error_code=True)\n\n if rc:\n raise PushError(\"Could not push branch '%s' to upstream\" %\n remote_branch)", "metadata": "root.GitClient.push_upstream", "header": "['class', 'GitClient', '(', 'SCMClient', ')', ':', '___EOS___']", "index": 834 }, { "content": " def get_current_branch(self):\n \"\"\"Return the name of the current branch.\n\n Returns:\n bytes:\n A string with the name of the current branch.\n \"\"\"\n return execute([self.git, \"rev-parse\", \"--abbrev-ref\", \"HEAD\"],\n ignore_errors=True).strip()", "metadata": "root.GitClient.get_current_branch", "header": "['class', 'GitClient', '(', 'SCMClient', ')', ':', '___EOS___']", "index": 854 }, { "content": " def _get_root_directory(self):\n \"\"\"Get the root directory of the repository as an absolute path.\"\"\"\n git_dir = execute([self.git, \"rev-parse\", \"--git-dir\"],\n ignore_errors=True).rstrip(\"\\n\")\n\n if git_dir.startswith(\"fatal:\") or not os.path.isdir(git_dir):\n logging.error(\"Could not find git repository path.\")\n return None\n\n return os.path.abspath(os.path.join(git_dir, \"..\"))", "metadata": "root.GitClient._get_root_directory", "header": "['class', 'GitClient', '(', 'SCMClient', ')', ':', '___EOS___']", "index": 864 }, { "content": " @property\n def original_cwd(self):\n \"\"\"Get the original current working directory.\"\"\"\n if self._original_cwd is None:\n # If this is None, then we haven't called get_repository_info and\n # shouldn't have changed directories.\n self._original_cwd = os.getcwd()\n\n return self._original_cwd", "metadata": "root.GitClient.original_cwd", "header": "['class', 'GitClient', '(', 'SCMClient', ')', ':', '___EOS___']", "index": 875 } ]
[]
[]
0
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "import_", "logging_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "re_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "rb", "tools_", "._", "clients_", "import_", "Pat", "ch", "Result_", ",_", "SCM", "Client_", ",_", "Repos", "itor", "y", "Info_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "rb", "tools_", "._", "clients_", "._", "errors_", "import_", "(_", "Ame", "nd", "Error_", ",_", "Merge", "Error_", ",_", "Push", "Error_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Inva", "lid", "Revi", "sion", "Spec", "Error_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Too", "Many", "Revi", "sion", "s", "Error_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "rb", "tools_", "._", "clients_", "._", "perf", "orce", "_", "import_", "Perf", "orce", "Client_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "rb", "tools_", "._", "clients_", "._", "svn_", "import_", "SV", "NC", "lient_", ",_", "SV", "NR", "epo", "sit", "ory", "Info_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "rb", "tools_", "._", "utils_", "._", "checks_", "import_", "check", "\\u", "install_", ",_", "is", "\\u", "valid", "\\u", "version_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "rb", "tools_", "._", "utils_", "._", "console_", "import_", "edit", "\\u", "text_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "rb", "tools_", "._", "utils_", "._", "diffs_", "import_", "(_", "normali", "ze", "\\u", "patterns_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "remove", "\\u", "filename", "s", "\\u", "matchi", "ng", "\\u", "patterns_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "rb", "tools_", "._", "utils_", "._", "process_", "import_", "die_", ",_", "execute_", "\\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_", "Git", "Client_", "(_", "SCM", "Client_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "A", " ", "wrapp", "er", " ", "aro", "und", " ", "git", " ", "tha", "t", " ", "fetches", " ", "repos", "itor", "y", " ", "informati", "on", " ", "and", " ", "generat", "es", "\\", "10", ";", " ", " ", " ", " ", "compatible", " ", "diffs", ".", " ", "Thi", "s", " ", "will", " ", "atte", "mpt", " ", "to", " ", "generat", "e", " ", "a", " ", "diff", " ", "suit", "able", " ", "for", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "remote", " ", "repos", "itor", "y", ",", " ", "whe", "ther", " ", "git", ",", " ", "SV", "N", " ", "or", " ", "Perf", "orce", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "name_", "=_", "'", "Git", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "support", "s", "\\u", "diff", "\\u", "exclu", "de", "\\u", "patterns_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "support", "s", "\\u", "patch", "\\u", "revert", "_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "can", "\\u", "amend", "\\u", "commit_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "can", "\\u", "merge_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "can", "\\u", "push", "\\u", "upstream_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "can", "\\u", "delete", "\\u", "branch_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "can", "\\u", "branch_", "=_", "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_",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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_", "Git", "Client_", "(_", "SCM", "Client_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "super_", "(_", "Git", "Client_", ",_", "self_", ")_", "._", "\\u\\u", "init\\u\\u_", "(_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Stor", "e", " ", "the", " ", "'", "correct", "'", " ", "way", " ", "to", " ", "invoke", " ", "git", ",", " ", "just", " ", "plain", " ", "old", " ", "'", "git", "'", " ", "by_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "default", "._", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "git_", "=_", "'", "git", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "original", "\\u", "cwd_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Git", "Client_", "(_", "SCM", "Client_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "support", "s", "\\u", "git", "\\u", "config", "\\u", "flag_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Return", " ", "if", " ", "the", " ", "install", "ed", " ", "version", " ", "of", " ", "git", " ", "support", "s", " ", "the", " ", "-", "c", " ", "flag", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Thi", "s", " ", "will", " ", "execute", " ", "``", "git", " ", "--", "version", "``", " ", "on", " ", "the", " ", "first", " ", "call", " ", "and", " ", "cache", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "result", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "hasattr_", "(_", "self_", ",_", "'\\u", "git", "\\u", "version", "\\u", "at", "\\u", "leas", "t", "\\u", "180", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "git", "\\u", "version", "\\u", "leas", "t", "\\u", "180_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "version", "\\u", "str_", "=_", "execute_", "(_", "[_", "self_", "._", "git_", ",_", "'", "version", "'_", "]_", ",_", "ignore", "\\u", "errors_", "=_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "none", "\\u", "on", "\\u", "ignore", "d\\u", "error_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "version", "\\u", "str_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "m_", "=_", "re_", "._", "search_", "(_", "'(\\\\", "d", "+)\\\\", ".(", "\\\\", "d", "+)\\\\", ".(", "\\\\", "d", "+)'_", ",_", "version", "\\u", "str_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "m_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "git", "\\u", "version_", "=_", "(_", "int_", "(_", "m_", "._", "group_", "(_", "1_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "int_", "(_", "m_", "._", "group_", "(_", "2_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "int_", "(_", "m_", "._", "group_", "(_", "3_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "git", "\\u", "version", "\\u", "at", "\\u", "leas", "t", "\\u", "180_", "=_", "git", "\\u", "version_", ">=_", "(_", "1_", ",_", "8_", ",_", "0_", ")_", "\\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_", "return_", "self_", "._", "\\u", "git", "\\u", "version", "\\u", "at", "\\u", "leas", "t", "\\u", "180_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Git", "Client_", "(_", "SCM", "Client_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "parse", "\\u", "revis", "ion", "\\u", "spec_", "(_", "self_", ",_", "revisions_", "=_", "[_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Pars", "es", " ", "the", " ", "give", "n", " ", "revis", "ion", " ", "spec", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "'", "revis", "ion", "s", "'", " ", "argu", "ment", " ", "is", " ", "a", " ", "list", " ", "of", " ", "revis", "ion", "s", " ", "as", " ", "specified", " ", "by", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "user", ".", " ", "Item", "s", " ", "in", " ", "the", " ", "list", " ", "do", " ", "not", " ", "necessar", "il", "y", " ", "represent", " ", "a", " ", "single", " ", "revis", "ion", ",", "\\", "10", ";", " ", " ", " ", " ", "sinc", "e", " ", "the", " ", "user", " ", "can", " ", "use", " ", "SCM", "-", "nativ", "e", " ", "synta", "xes", " ", "suc", "h", " ", "as", " ", "\"", "r1", "..", "r2", "\"", " ", "or", " ", "\"", "r1", ":", "r2", "\".\\", "10", ";", " ", " ", " ", " ", "SCM", "Tool", "-", "specific", " ", "override", "s", " ", "of", " ", "this", " ", "method", " ", "are", " ", "expected", " ", "to", " ", "deal", " ", "with", "\\", "10", ";", " ", " ", " ", " ", "suc", "h", " ", "synta", "xes", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Thi", "s", " ", "will", " ", "return", " ", "a", " ", "dictionar", "y", " ", "with", " ", "the", " ", "follow", "ing", " ", "keys", ":", "\\", "10", ";", " ", " ", " ", " ", "'", "base", "':", " ", " ", " ", " ", "A", " ", "revis", "ion", " ", "to", " ", "use", " ", "as", " ", "the", " ", "base", " ", "of", " ", "the", " ", "result", "ing", " ", "diff", ".", "\\", "10", ";", " ", " ", " ", " ", "'", "tip", "':", " ", " ", " ", " ", " ", "A", " ", "revis", "ion", " ", "to", " ", "use", " ", "as", " ", "the", " ", "tip", " ", "of", " ", "the", " ", "result", "ing", " ", "diff", ".", "\\", "10", ";", " ", " ", " ", " ", "'", "parent", "\\u", "base", "':", " ", "(", "option", "al", ")", " ", "The", " ", "revis", "ion", " ", "to", " ", "use", " ", "as", " ", "the", " ", "base", " ", "of", " ", "a", "\\", "10", ";", " ", " ", " ", " ", " ", "parent", " ", "diff", ".", "\\", "10", ";", " ", " ", " ", " ", "'", "commit", "\\u", "id", "':", " ", " ", " ", "(", "option", "al", ")", " ", "The", " ", "ID", " ", "of", " ", "the", " ", "single", " ", "commit", " ", "bei", "ng", " ", "poste", "d", ",", "\\", "10", ";", " ", " ", " ", " ", " ", "if", " ", "not", " ", "usi", "ng", " ", "a", " ", "range", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "The", "se", " ", "will", " ", "be", " ", "used", " ", "to", " ", "generat", "e", " ", "the", " ", "diffs", " ", "to", " ", "upload", " ", "to", " ", "Review", " ", "Boa", "rd", " ", "(", "or", "\\", "10", ";", " ", " ", " ", " ", "print", ").", " ", "The", " ", "diff", " ", "for", " ", "review", " ", "will", " ", "include", " ", "the", " ", "change", "s", " ", "in", " ", "(", "base", ",", " ", "tip", "],", "\\", "10", ";", " ", " ", " ", " ", "and", " ", "the", " ", "parent", " ", "diff", " ", "(", "if", " ", "necessar", "y", ")", " ", "will", " ", "include", " ", "(", "parent", "\\u", "base", ",", " ", "base", "].", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "If", " ", "a", " ", "single", " ", "revis", "ion", " ", "is", " ", "pass", "ed", " ", "in", ",", " ", "this", " ", "will", " ", "return", " ", "the", " ", "parent", " ", "of", " ", "tha", "t", "\\", "10", ";", " ", " ", " ", " ", "revis", "ion", " ", "for", " ", "'", "base", "'", " ", "and", " ", "the", " ", "pass", "ed", "-", "in", " ", "revis", "ion", " ", "for", " ", "'", "tip", "'.", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "If", " ", "zero", " ", "revis", "ion", "s", " ", "are", " ", "pass", "ed", " ", "in", ",", " ", "this", " ", "will", " ", "return", " ", "the", " ", "current", " ", "HEAD", " ", "as", "\\", "10", ";", " ", " ", " ", " ", "'", "tip", "',", " ", "and", " ", "the", " ", "ups", "tream", " ", "branch", " ", "as", " ", "'", "base", "',", " ", "tak", "ing", " ", "int", "o", " ", "account", " ", "parent", "\\", "10", ";", " ", " ", " ", " ", "branch", "es", " ", "explicit", "ly", " ", "specified", " ", "via", " ", "--", "parent", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "n", "\\u", "revs_", "=_", "len_", "(_", "revisions_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "n", "\\u", "revs_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "No", " ", "revis", "ion", "s", " ", "wer", "e", " ", "pass", "ed", " ", "in", "--", "start", " ", "with", " ", "HEAD", ",", " ", "and", " ", "find", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "track", "ing", " ", "branch", " ", "automati", "call", "y", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "parent", "\\u", "branch_", "=_", "self_", "._", "get", "\\u", "parent", "\\u", "branch_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "head", "\\u", "ref_", "=_", "self_", "._", "\\u", "rev", "\\u", "parse_", "(_", "self_", "._", "get", "\\u", "head", "\\u", "ref_", "(_", ")_", ")_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "merge", "\\u", "base_", "=_", "self_", "._", "\\u", "rev", "\\u", "parse_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "get", "\\u", "merge", "\\u", "base_", "(_", "head", "\\u", "ref_", ",_", "self_", "._", "ups", "tream", "\\u", "branch_", ")_", ")_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "result_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "tip", "'_", ":_", "head", "\\u", "ref_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "commit", "\\u", "id", "'_", ":_", "head", "\\u", "ref_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "parent", "\\u", "branch_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "[_", "'", "base", "'_", "]_", "=_", "self_", "._", "\\u", "rev", "\\u", "parse_", "(_", "parent", "\\u", "branch_", ")_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "[_", "'", "parent", "\\u", "base", "'_", "]_", "=_", "merge", "\\u", "base_", "\\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 ", " _", "result_", "[_", "'", "base", "'_", "]_", "=_", "merge", "\\u", "base_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Sin", "ce", " ", "the", " ", "user", " ", "ask", "ed", " ", "us", " ", "to", " ", "operate", " ", "on", " ", "HEAD", ",", " ", "warn", " ", "them", " ", "abo", "ut", " ", "a_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "dir", "ty", " ", "working", " ", "directory_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "has", "\\u", "pend", "ing", "\\u", "changes_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logging_", "._", "warning_", "(_", "'", "You", "r", " ", "working", " ", "director", "y", " ", "is", " ", "not", " ", "clean", ".", " ", "Any", " ", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'", "change", "s", " ", "whi", "ch", " ", "have", " ", "not", " ", "bee", "n", " ", "committ", "ed", " ", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'", "to", " ", "a", " ", "branch", " ", "will", " ", "not", " ", "be", " ", "include", "d", " ", "in", " ", "your", " ", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'", "review", " ", "request", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "n", "\\u", "revs_", "==_", "1_", "or_", "n", "\\u", "revs_", "==_", "2_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Let", " ", "`", "git", " ", "rev", "-", "parse", "`", " ", "sort", " ", "thing", "s", " ", "out", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "parsed_", "=_", "self_", "._", "\\u", "rev", "\\u", "parse_", "(_", "revisions_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "n", "\\u", "parsed", "\\u", "revs_", "=_", "len_", "(_", "parsed_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "n", "\\u", "parsed", "\\u", "revs_", "<=_", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "n", "\\u", "parsed", "\\u", "revs_", "==_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Sing", "le", " ", "revis", "ion", ".", " ", "Extract", " ", "the", " ", "parent", " ", "of", " ", "tha", "t", " ", "revis", "ion", " ", "to", " ", "use_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "as", " ", "the", " ", "base", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "parent_", "=_", "self_", "._", "\\u", "rev", "\\u", "parse_", "(_", "'%", "s", "^", "'_", "%_", "parsed_", "[_", "0_", "]_", ")_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "base", "'_", ":_", "parent_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "tip", "'_", ":_", "parsed_", "[_", "0_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "commit", "\\u", "id", "'_", ":_", "parsed_", "[_", "0_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "n", "\\u", "parsed", "\\u", "revs_", "==_", "2_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "parsed_", "[_", "1_", "]_", "._", "startswith_", "(_", "'", "^", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Passe", "d", " ", "in", " ", "revis", "ion", "s", " ", "wer", "e", " ", "probab", "ly", " ", "format", "ted", " ", "as_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "\"", "base", "..", "tip", "\".", " ", "The", " ", "rev", "-", "parse", " ", "output", " ", "include", "s", " ", "all", " ", "ancestors_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "of", " ", "the", " ", "first", " ", "part", ",", " ", "and", " ", "none", " ", "of", " ", "the", " ", "ancestor", "s", " ", "of", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "second", ".", " ", "Basic", "ally", ",", " ", "the", " ", "second", " ", "part", " ", "is", " ", "the", " ", "base", " ", "(", "after_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "strip", "ping", " ", "the", " ", "^", " ", "prefix", ")", " ", "and", " ", "the", " ", "first", " ", "is", " ", "the", " ", "tip", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "result_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "base", "'_", ":_", "parsed_", "[_", "1_", "]_", "[_", "1_", ":_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "tip", "'_", ":_", "parsed_", "[_", "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_", "#", " ", "Fi", "rst", " ", "revis", "ion", " ", "is", " ", "base", ",", " ", "second", " ", "is", " ", "tip_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "result_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "base", "'_", ":_", "parsed_", "[_", "0_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "tip", "'_", ":_", "parsed_", "[_", "1_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "n", "\\u", "parsed", "\\u", "revs_", "==_", "3_", "and_", "parsed_", "[_", "2_", "]_", "._", "startswith_", "(_", "'", "^", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Revi", "sion", " ", "spec", " ", "is", " ", "diff", "-", "sinc", "e-", "merge", ".", " ", "Fin", "d", " ", "the", " ", "merge", "-", "base", " ", "of", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "two", " ", "revs", " ", "to", " ", "use", " ", "as", " ", "base", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "merge", "\\u", "base_", "=_", "execute_", "(_", "[_", "self_", "._", "git_", ",_", "'", "merge", "-", "base", "'_", ",_", "parsed_", "[_", "0_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "parsed_", "[_", "1_", "]_", "]_", ")_", "._", "strip_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "base", "'_", ":_", "merge", "\\u", "base_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "tip", "'_", ":_", "parsed_", "[_", "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 ", " _", "raise_", "Inva", "lid", "Revi", "sion", "Spec", "Error_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Une", "xpe", "cte", "d", " ", "result", " ", "whi", "le", " ", "pars", "ing", " ", "revis", "ion", " ", "spec", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "parent", "\\u", "base_", "=_", "self_", "._", "\\u", "get", "\\u", "merge", "\\u", "base_", "(_", "result_", "[_", "'", "base", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "ups", "tream", "\\u", "branch_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "parent", "\\u", "base_", "!=_", "result_", "[_", "'", "base", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "[_", "'", "parent", "\\u", "base", "'_", "]_", "=_", "parent", "\\u", "base_", "\\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_", "Too", "Many", "Revi", "sion", "s", "Error_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "result_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Git", "Client_", "(_", "SCM", "Client_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "repos", "itor", "y", "\\u", "info_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Get", " ", "repos", "itor", "y", " ", "informati", "on", " ", "for", " ", "the", " ", "current", " ", "Git", " ", "working", " ", "tree", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Thi", "s", " ", "function", " ", "change", "s", " ", "the", " ", "director", "y", " ", "to", " ", "the", " ", "top", " ", "level", " ", "director", "y", " ", "of", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "current", " ", "working", " ", "tree", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "check", "\\u", "install_", "(_", "[_", "'", "git", "'_", ",_", "'--", "help", "'_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Creat", "e", "Process", " ", "(", "launched", " ", "via", " ", "subproc", "ess", ",", " ", "used", " ", "by", " ", "check", "\\u", "install", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "doe", "s", " ", "not", " ", "automati", "call", "y", " ", "append", " ", ".", "cmd", " ", "for", " ", "thing", "s", " ", "it", " ", "find", "s", " ", "in", " ", "PATH", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "we", "'", "re", " ", "on", " ", "Window", "s", ",", " ", "and", " ", "this", " ", "works", ",", " ", "save", " ", "it", " ", "for", " ", "fur", "ther", " ", "use", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "(_", "sys_", "._", "platform_", "._", "startswith_", "(_", "'", "win", "'_", ")_", "and_", "\\u\\u\\uNL\\u\\u\\u_", "check", "\\u", "install_", "(_", "[_", "'", "git", ".", "cmd", "'_", ",_", "'--", "help", "'_", "]_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "git_", "=_", "'", "git", ".", "cmd", "'_", "\\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 ", " _", "logging_", "._", "debug_", "(_", "'", "Una", "ble", " ", "to", " ", "execute", " ", "\"", "git", " ", "--", "help", "\"", " ", "or", " ", "\"", "git", ".", "cmd", " ", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'--", "help", "\":", " ", "skip", "ping", " ", "Git", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "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_", "git", "\\u", "dir_", "=_", "execute_", "(_", "[_", "self_", "._", "git_", ",_", "\"", "rev", "-", "parse", "\"_", ",_", "\"--", "git", "-", "dir", "\"_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "ignore", "\\u", "errors_", "=_", "True_", ")_", "._", "rstrip_", "(_", "\"\\\\", "n", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "git", "\\u", "dir_", "._", "startswith_", "(_", "\"", "fat", "al", ":\"_", ")_", "or_", "not_", "os_", "._", "path_", "._", "isdir_", "(_", "git", "\\u", "dir_", ")_", ":_", "\\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_", "#", " ", "Some", "times", " ", "core", ".", "bare", " ", "is", " ", "not", " ", "set", ",", " ", "and", " ", "generat", "es", " ", "an", " ", "error", ",", " ", "so", " ", "ignore_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "error", "s", ".", " ", "Valid", " ", "values", " ", "are", " ", "'", "true", "'", " ", "or", " ", "'", "1", "'.", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "bare", "_", "=_", "execute_", "(_", "[_", "self_", "._", "git_", ",_", "'", "config", "'_", ",_", "'", "core", ".", "bare", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "ignore", "\\u", "errors_", "=_", "True_", ")_", "._", "strip_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "bare", "_", "=_", "bare", "_", "in_", "(_", "'", "true", "'_", ",_", "'", "1", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "we", " ", "are", " ", "not", " ", "working", " ", "in", " ", "a", " ", "bare", " ", "repos", "itor", "y", ",", " ", "then", " ", "we", " ", "will", " ", "change_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "director", "y", " ", "to", " ", "the", " ", "top", " ", "level", " ", "working", " ", "tree", " ", "lose", " ", "our", " ", "original", " ", "position", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Ho", "we", "ver", ",", " ", "we", " ", "need", " ", "the", " ", "original", " ", "working", " ", "director", "y", " ", "for", " ", "file", " ", "exclusion", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "pattern", "s", ",", " ", "so", " ", "we", " ", "save", " ", "it", " ", "here", "._", "\\u\\u\\uNL\\u\\u\\u_", "if_", "self_", "._", "\\u", "original", "\\u", "cwd_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "original", "\\u", "cwd_", "=_", "os_", "._", "getcwd_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Run", "ning", " ", "in", " ", "director", "ies", " ", "other", " ", "than", " ", "the", " ", "top", " ", "level", " ", "of_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "of", " ", "a", " ", "work", "-", "tree", " ", "wou", "ld", " ", "result", " ", "in", " ", "broken", " ", "diffs", " ", "on", " ", "the", " ", "server_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "self_", "._", "bare", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "git", "\\u", "top_", "=_", "execute_", "(_", "[_", "self_", "._", "git_", ",_", "\"", "rev", "-", "parse", "\"_", ",_", "\"--", "show", "-", "toplevel", "\"_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "ignore", "\\u", "errors_", "=_", "True_", ")_", "._", "rstrip_", "(_", "\"\\\\", "n", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Top", " ", "level", " ", "mig", "ht", " ", "not", " ", "work", " ", "on", " ", "old", " ", "git", " ", "version", " ", "se", " ", "we", " ", "use", " ", "git", " ", "dir_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "to", " ", "find", " ", "it", "._", "\\u\\u\\uNL\\u\\u\\u_", "if_", "(_", "git", "\\u", "top_", "._", "startswith_", "(_", "'", "fat", "al", ":'_", ")_", "or_", "not_", "os_", "._", "path_", "._", "isdir_", "(_", "git", "\\u", "dir_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "or_", "git", "\\u", "top_", "._", "startswith_", "(_", "'", "cyg", "drive", "'_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "git", "\\u", "top_", "=_", "git", "\\u", "dir_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "os_", "._", "chdir_", "(_", "os_", "._", "path_", "._", "abspath_", "(_", "git", "\\u", "top_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "head", "\\u", "ref_", "=_", "execute_", "(_", "[_", "self_", "._", "git_", ",_", "'", "symbolic", "-", "ref", "'_", ",_", "'-", "q", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "HEAD", "'_", "]_", ",_", "ignore", "\\u", "errors_", "=_", "True_", ")_", "._", "strip_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "We", " ", "know", " ", "we", " ", "have", " ", "somet", "hing", " ", "we", " ", "can", " ", "work", " ", "with", ".", " ", "Let", "'", "s", " ", "find", " ", "out_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "what", " ", "it", " ", "is", ".", " ", "We", "'", "ll", " ", "try", " ", "SV", "N", " ", "first", ",", " ", "but", " ", "only", " ", "if", " ", "there", "'", "s", " ", "a", " ", ".", "git", "/", "svn_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "director", "y", ".", " ", "Ot", "her", "wis", "e", ",", " ", "it", " ", "may", " ", "atte", "mpt", " ", "to", " ", "create", " ", "one", " ", "and", " ", "scan_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "revis", "ion", "s", ",", " ", "whi", "ch", " ", "can", " ", "be", " ", "slow", ".", " ", "Al", "so", " ", "skip", " ", "SV", "N", " ", "detect", "ion", " ", "if", " ", "the", " ", "git_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "repos", "itor", "y", " ", "was", " ", "specified", " ", "on", " ", "command", " ", "line", "._", "\\u\\u\\uNL\\u\\u\\u_", "git", "\\u", "svn", "\\u", "dir_", "=_", "os_", "._", "path_", "._", "join_", "(_", "git", "\\u", "dir_", ",_", "'", "svn", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "(_", "not_", "getattr_", "(_", "self_", "._", "options_", ",_", "'", "repos", "itor", "y", "\\u", "url", "'_", ",_", "None_", ")_", "and_", "\\u\\u\\uNL\\u\\u\\u_", "os_", "._", "path_", "._", "isdir_", "(_", "git", "\\u", "svn", "\\u", "dir_", ")_", "and_", "len_", "(_", "os_", "._", "listdir_", "(_", "git", "\\u", "svn", "\\u", "dir_", ")_", ")_", ">_", "0_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "data_", "=_", "execute_", "(_", "[_", "self_", "._", "git_", ",_", "\"", "svn", "\"_", ",_", "\"", "info", "\"_", "]_", ",_", "ignore", "\\u", "errors_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "m_", "=_", "re_", "._", "search_", "(_", "r", "'", "^", "Repos", "itor", "y", " ", "Roo", "t", ":", " ", "(.+", ")$'_", ",_", "data_", ",_", "re_", "._", "M_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "m_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "path_", "=_", "m_", "._", "group_", "(_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "m_", "=_", "re_", "._", "search_", "(_", "r", "'", "^", "URL", ":", " ", "(.+", ")$'_", ",_", "data_", ",_", "re_", "._", "M_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "m_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "base", "\\u", "path_", "=_", "m_", "._", "group_", "(_", "1_", ")_", "[_", "len_", "(_", "path_", ")_", ":_", "]_", "or_", "\"/\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "m_", "=_", "re_", "._", "search_", "(_", "r", "'", "^", "Repos", "itor", "y", " ", "UU", "ID", ":", " ", "(.+", ")$'_", ",_", "data_", ",_", "re_", "._", "M_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "m_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "uuid_", "=_", "m_", "._", "group_", "(_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "type_", "=_", "\"", "svn", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Get", " ", "SV", "N", " ", "track", "ing", " ", "branch_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "getattr_", "(_", "self_", "._", "options_", ",_", "'", "track", "ing", "'_", ",_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "self_", "._", "ups", "tream", "\\u", "branch_", "=_", "self_", "._", "options_", "._", "tracking_", "\\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 ", " ", " _", "data_", "=_", "execute_", "(_", "[_", "self_", "._", "git_", ",_", "\"", "svn", "\"_", ",_", "\"", "rebase", "\"_", ",_", "\"-", "n", "\"_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "ignore", "\\u", "errors_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "m_", "=_", "re_", "._", "search_", "(_", "r", "'", "^", "Remo", "te", " ", "Branc", "h", ":\\\\", "s", "*(.", "+)$'_", ",_", "data_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "re_", "._", "M_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "m_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "self_", "._", "ups", "tream", "\\u", "branch_", "=_", "m_", "._", "group_", "(_", "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 ", " ", " _", "sys_", "._", "stderr_", "._", "write_", "(_", "'", "Fail", "ed", " ", "to", " ", "dete", "rmin", "e", " ", "SV", "N", " ", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'", "track", "ing", " ", "branch", ".", " ", "Default", "ing", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'", "to", " ", "\"", "master", "\"\\\\", "n", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "ups", "tream", "\\u", "branch_", "=_", "'", "master", "'_", "\\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_", "SV", "NR", "epo", "sit", "ory", "Info_", "(_", "path_", "=_", "path_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "base", "\\u", "path_", "=_", "base", "\\u", "path_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "uuid_", "=_", "uuid_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "support", "s", "\\u", "parent", "\\u", "diffs_", "=_", "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_", "#", " ", "Version", "s", " ", "of", " ", "git", "-", "svn", " ", "bef", "ore", " ", "1.5", ".4", " ", "don", "'", "t", " ", "(", "appear", " ", "to", ")", " ", "support_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "'", "git", " ", "svn", " ", "info", "'.", " ", " ", "If", " ", "we", " ", "fail", " ", "bec", "aus", "e", " ", "of", " ", "an", " ", "older", " ", "git", " ", "install", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "here", ",", " ", "figure", " ", "out", " ", "what", " ", "version", " ", "of", " ", "git", " ", "is", " ", "install", "ed", " ", "and", " ", "give", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "the", " ", "user", " ", "a", " ", "hin", "t", " ", "abo", "ut", " ", "what", " ", "to", " ", "do", " ", "next", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "version_", "=_", "execute_", "(_", "[_", "self_", "._", "git_", ",_", "\"", "svn", "\"_", ",_", "\"--", "version", "\"_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "ignore", "\\u", "errors_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "version", "\\u", "parts_", "=_", "re_", "._", "search_", "(_", "'", "version", " ", "(\\\\", "d", "+)\\\\", ".(", "\\\\", "d", "+)\\\\", ".(", "\\\\", "d", "+)'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "version_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "svn", "\\u", "remote_", "=_", "execute_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "self_", "._", "git_", ",_", "\"", "config", "\"_", ",_", "\"--", "get", "\"_", ",_", "\"", "svn", "-", "remote", ".", "svn", ".", "url", "\"_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "ignore", "\\u", "errors_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "(_", "version", "\\u", "parts_", "and_", "svn", "\\u", "remote_", "and_", "\\u\\u\\uNL\\u\\u\\u_", "not_", "is", "\\u", "valid", "\\u", "version_", "(_", "(_", "int_", "(_", "version", "\\u", "parts_", "._", "group_", "(_", "1_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "int_", "(_", "version", "\\u", "parts_", "._", "group_", "(_", "2_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "int_", "(_", "version", "\\u", "parts_", "._", "group_", "(_", "3_", ")_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "1_", ",_", "5_", ",_", "4_", ")_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "die_", "(_", "\"", "You", "r", " ", "installation", " ", "of", " ", "git", "-", "svn", " ", "must", " ", "be", " ", "upgrade", "d", " ", "to", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "version", " ", "1.5", ".4", " ", "or", " ", "late", "r", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Ok", "ay", ",", " ", "may", "be", " ", "Perf", "orce", " ", "(", "git", "-", "p4", ").", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "git", "\\u", "p4", "\\u", "ref_", "=_", "os_", "._", "path_", "._", "join_", "(_", "git", "\\u", "dir_", ",_", "'", "refs", "'_", ",_", "'", "remotes", "'_", ",_", "'", "p4", "'_", ",_", "'", "master", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "os_", "._", "path_", "._", "exists_", "(_", "git", "\\u", "p4", "\\u", "ref_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "data_", "=_", "execute_", "(_", "[_", "self_", "._", "git_", ",_", "'", "config", "'_", ",_", "'--", "get", "'_", ",_", "'", "git", "-", "p4", ".", "port", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "ignore", "\\u", "errors_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "m_", "=_", "re_", "._", "search_", "(_", "r", "'(", ".+)", "'_", ",_", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "m_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "port_", "=_", "m_", "._", "group_", "(_", "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 ", " _", "port_", "=_", "os_", "._", "getenv_", "(_", "'", "P4", "PORT", "'_", ")_", "\\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 ", " _", "self_", "._", "type_", "=_", "'", "perf", "orce", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "ups", "tream", "\\u", "branch_", "=_", "'", "remotes", "/", "p4", "/", "master", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "Repos", "itor", "y", "Info_", "(_", "path_", "=_", "port_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "base", "\\u", "path_", "=_", "''_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "support", "s", "\\u", "parent", "\\u", "diffs_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "No", "pe", ",", " ", "it", "'", "s", " ", "git", " ", "then", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Check", " ", "for", " ", "a", " ", "track", "ing", " ", "branch", " ", "and", " ", "dete", "rmin", "e", " ", "merge", "-", "base_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "ups", "tream", "\\u", "branch_", "=_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "head", "\\u", "ref_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "short", "\\u", "head_", "=_", "self_", "._", "\\u", "strip", "\\u", "head", "s", "\\u", "prefix_", "(_", "self_", "._", "head", "\\u", "ref_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "merge_", "=_", "execute_", "(_", "[_", "self_", "._", "git_", ",_", "'", "config", "'_", ",_", "'--", "get", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "branch", ".", "%", "s", ".", "merge", "'_", "%_", "short", "\\u", "head_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "ignore", "\\u", "errors_", "=_", "True_", ")_", "._", "strip_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "remote_", "=_", "execute_", "(_", "[_", "self_", "._", "git_", ",_", "'", "config", "'_", ",_", "'--", "get", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "branch", ".", "%", "s", ".", "remote", "'_", "%_", "short", "\\u", "head_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "ignore", "\\u", "errors_", "=_", "True_", ")_", "._", "strip_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "merge_", "=_", "self_", "._", "\\u", "strip", "\\u", "head", "s", "\\u", "prefix_", "(_", "merge_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "remote_", "and_", "remote_", "!=_", "'.'_", "and_", "merge_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "ups", "tream", "\\u", "branch_", "=_", "'%", "s", "/", "%", "s", "'_", "%_", "(_", "remote_", ",_", "merge_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "url_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "getattr_", "(_", "self_", "._", "options_", ",_", "'", "repos", "itor", "y", "\\u", "url", "'_", ",_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "url_", "=_", "self_", "._", "options_", "._", "repos", "itor", "y", "\\u", "url_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "ups", "tream", "\\u", "branch_", "=_", "self_", "._", "get", "\\u", "origin_", "(_", "self_", "._", "ups", "tream", "\\u", "branch_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "True_", ")_", "[_", "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_", "._", "ups", "tream", "\\u", "branch_", ",_", "orig", "in", "\\u", "url_", "=_", "self_", "._", "get", "\\u", "origin_", "(_", "self_", "._", "ups", "tream", "\\u", "branch_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "orig", "in", "\\u", "url_", "or_", "orig", "in", "\\u", "url_", "._", "startswith_", "(_", "\"", "fat", "al", ":\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "ups", "tream", "\\u", "branch_", ",_", "orig", "in", "\\u", "url_", "=_", "self_", "._", "get", "\\u", "origin_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "url_", "=_", "orig", "in", "\\u", "url_", "._", "rstrip_", "(_", "'/'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Cent", "ral", " ", "bare", " ", "repos", "itori", "es", " ", "don", "'", "t", " ", "have", " ", "orig", "in", " ", "URL", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "We", " ", "return", " ", "git", "\\u", "dir", " ", "inst", "ead", " ", "and", " ", "hop", "e", " ", "for", " ", "the", " ", "best", "._", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "url_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "url_", "=_", "os_", "._", "path_", "._", "abspath_", "(_", "git", "\\u", "dir_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "There", " ", "is", " ", "no", " ", "remote", ",", " ", "so", " ", "skip", " ", "this", " ", "part", " ", "of", " ", "ups", "tream", "\\u", "branch", "._", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "ups", "tream", "\\u", "branch_", "=_", "self_", "._", "ups", "tream", "\\u", "branch_", "._", "split_", "(_", "'/'_", ")_", "[_", "-_", "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_", "if_", "url_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "type_", "=_", "\"", "git", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "Repos", "itor", "y", "Info_", "(_", "path_", "=_", "url_", ",_", "base", "\\u", "path_", "=_", "''_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "support", "s", "\\u", "parent", "\\u", "diffs_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Git", "Client_", "(_", "SCM", "Client_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "strip", "\\u", "head", "s", "\\u", "prefix_", "(_", "self_", ",_", "ref_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Strip", "s", " ", "prefix", " ", "from", " ", "ref", " ", "name", ",", " ", "if", " ", "possib", "le", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "re_", "._", "sub_", "(_", "r", "'", "^", "refs", "/", "head", "s", "/'_", ",_", "''_", ",_", "ref_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Git", "Client_", "(_", "SCM", "Client_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "origin_", "(_", "self_", ",_", "default", "\\u", "ups", "tream", "\\u", "branch_", "=_", "None_", ",_", "ignore", "\\u", "errors_", "=_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Get", " ", "ups", "tream", " ", "remote", " ", "orig", "in", " ", "from", " ", "options", " ", "or", " ", "parameter", "s", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", " ", "a", " ", "tuple", ":", " ", "(", "ups", "tream", "\\u", "branch", ",", " ", "remote", "\\u", "url", ")", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ups", "tream", "\\u", "branch_", "=_", "(_", "getattr_", "(_", "self_", "._", "options_", ",_", "'", "track", "ing", "'_", ",_", "None_", ")_", "or_", "\\u\\u\\uNL\\u\\u\\u_", "default", "\\u", "ups", "tream", "\\u", "branch_", "or_", "\\u\\u\\uNL\\u\\u\\u_", "'", "orig", "in", "/", "master", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ups", "tream", "\\u", "remote_", "=_", "ups", "tream", "\\u", "branch_", "._", "split_", "(_", "'/'_", ")_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "orig", "in", "\\u", "url_", "=_", "execute_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "self_", "._", "git_", ",_", "\"", "config", "\"_", ",_", "\"--", "get", "\"_", ",_", "\"", "remote", ".", "%", "s", ".", "url", "\"_", "%_", "ups", "tream", "\\u", "remote_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "ignore", "\\u", "errors_", "=_", "True_", ")_", "._", "rstrip_", "(_", "\"\\\\", "n", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "(_", "ups", "tream", "\\u", "branch_", ",_", "orig", "in", "\\u", "url_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Git", "Client_", "(_", "SCM", "Client_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "scan", "\\u", "for", "\\u", "server_", "(_", "self_", ",_", "repos", "itor", "y", "\\u", "info_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Sca", "n", " ", "first", " ", "for", " ", "dot", " ", "files", ",", " ", "sinc", "e", " ", "it", "'", "s", " ", "faste", "r", " ", "and", " ", "will", " ", "cover", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "user", "'", "s", " ", "$", "HOM", "E", "/.", "reviewboard", "rc_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "server", "\\u", "url_", "=_", "super_", "(_", "Git", "Client_", ",_", "self_", ")_", "._", "scan", "\\u", "for", "\\u", "server_", "(_", "repos", "itor", "y", "\\u", "info_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "server", "\\u", "url_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "server", "\\u", "url_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "TOD", "O", ":", " ", "Ma", "yb", "e", " ", "support", " ", "a", " ", "server", " ", "per", " ", "remote", " ", "late", "r", "?", " ", "Is", " ", "tha", "t", " ", "usef", "ul", "?", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "url_", "=_", "execute_", "(_", "[_", "self_", "._", "git_", ",_", "\"", "config", "\"_", ",_", "\"--", "get", "\"_", ",_", "\"", "reviewboard", ".", "url", "\"_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "ignore", "\\u", "errors_", "=_", "True_", ")_", "._", "strip_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "url_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "url_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "type_", "==_", "\"", "svn", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Tr", "y", " ", "usi", "ng", " ", "the", " ", "reviewboard", ":", "url", " ", "property", " ", "on", " ", "the", " ", "SV", "N", " ", "repo", ",", " ", "if", " ", "it_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "exist", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "prop_", "=_", "SV", "NC", "lient_", "(_", ")_", "._", "scan", "\\u", "for", "\\u", "server", "\\u", "property_", "(_", "repos", "itor", "y", "\\u", "info_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "prop_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "prop_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "self_", "._", "type_", "==_", "'", "perf", "orce", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "prop_", "=_", "Perf", "orce", "Client_", "(_", ")_", "._", "scan", "\\u", "for", "\\u", "server_", "(_", "repos", "itor", "y", "\\u", "info_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "prop_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "prop_", "\\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_", "Git", "Client_", "(_", "SCM", "Client_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "raw", "\\u", "commit", "\\u", "message_", "(_", "self_", ",_", "revisions_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Extract", "s", " ", "the", " ", "commit", " ", "message", " ", "based", " ", "on", " ", "the", " ", "provided", " ", "revis", "ion", " ", "range", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "execute_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "self_", "._", "git_", ",_", "'", "log", "'_", ",_", "'--", "reverse", "'_", ",_", "'--", "pretty", "=", "format", ":", "%", "s", "%", "n", "%", "n", "%", "b", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "^", "%", "s", "'_", "%_", "revisions_", "[_", "'", "base", "'_", "]_", ",_", "revisions_", "[_", "'", "tip", "'_", "]_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "ignore", "\\u", "errors_", "=_", "True_", ")_", "._", "strip_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Git", "Client_", "(_", "SCM", "Client_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "parent", "\\u", "branch_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Return", "s", " ", "the", " ", "parent", " ", "branch", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parent", "\\u", "branch_", "=_", "getattr_", "(_", "self_", "._", "options_", ",_", "'", "parent", "\\u", "branch", "'_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "self_", "._", "type_", "==_", "'", "perf", "orce", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "parent", "\\u", "branch_", "=_", "parent", "\\u", "branch_", "or_", "'", "p4", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "parent", "\\u", "branch_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Git", "Client_", "(_", "SCM", "Client_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "head", "\\u", "ref_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Return", "s", " ", "the", " ", "HEAD", " ", "reference", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "head", "\\u", "ref_", "=_", "\"", "HEAD", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "self_", "._", "head", "\\u", "ref_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "head", "\\u", "ref_", "=_", "self_", "._", "head", "\\u", "ref_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "head", "\\u", "ref_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Git", "Client_", "(_", "SCM", "Client_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "get", "\\u", "merge", "\\u", "base_", "(_", "self_", ",_", "rev", "1_", ",_", "rev", "2_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Return", "s", " ", "the", " ", "merge", " ", "base", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "execute_", "(_", "[_", "self_", "._", "git_", ",_", "\"", "merge", "-", "base", "\"_", ",_", "rev", "1_", ",_", "rev", "2_", "]_", ")_", "._", "strip_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Git", "Client_", "(_", "SCM", "Client_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "rev", "\\u", "parse_", "(_", "self_", ",_", "revisions_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Run", "s", " ", "`", "git", " ", "rev", "-", "parse", "`", " ", "and", " ", "return", "s", " ", "a", " ", "list", " ", "of", " ", "revis", "ion", "s", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "isinstance_", "(_", "revisions_", ",_", "list_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "revisions_", "=_", "[_", "revisions_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "execute_", "(_", "[_", "self_", "._", "git_", ",_", "'", "rev", "-", "parse", "'_", "]_", "+_", "revisions_", ")_", "._", "strip_", "(_", ")_", "._", "split_", "(_", "'\\\\", "n", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Git", "Client_", "(_", "SCM", "Client_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "diff_", "(_", "self_", ",_", "revisions_", ",_", "include", "\\u", "files_", "=_", "[_", "]_", ",_", "exclu", "de", "\\u", "patterns_", "=_", "[_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "extra", "\\u", "args_", "=_", "[_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Perform", " ", "a", " ", "diff", " ", "usi", "ng", " ", "the", " ", "give", "n", " ", "revis", "ion", "s", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "If", " ", "no", " ", "revis", "ion", "s", " ", "are", " ", "specified", ",", " ", "this", " ", "will", " ", "do", " ", "a", " ", "diff", " ", "of", " ", "the", " ", "content", "s", " ", "of", "\\", "10", ";", " ", " ", " ", " ", "the", " ", "current", " ", "branch", " ", "sinc", "e", " ", "the", " ", "track", "ing", " ", "branch", " ", "(", "whi", "ch", " ", "default", "s", " ", "to", "\\", "10", ";", " ", " ", " ", " ", "'", "master", "')", ".", " ", "If", " ", "one", " ", "revis", "ion", " ", "is", " ", "specified", ",", " ", "this", " ", "will", " ", "get", " ", "the", " ", "diff", " ", "of", " ", "tha", "t", "\\", "10", ";", " ", " ", " ", " ", "specific", " ", "change", ".", " ", "If", " ", "two", " ", "revis", "ion", "s", " ", "are", " ", "specified", ",", " ", "this", " ", "will", " ", "do", " ", "a", " ", "diff", "\\", "10", ";", " ", " ", " ", " ", "bet", "ween", " ", "tho", "se", " ", "two", " ", "revis", "ion", "s", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "If", " ", "a", " ", "parent", " ", "branch", " ", "is", " ", "specified", " ", "via", " ", "the", " ", "command", "-", "line", " ", "options", ",", " ", "or", " ", "wou", "ld", "\\", "10", ";", " ", " ", " ", " ", "make", " ", "sense", " ", "give", "n", " ", "the", " ", "request", "ed", " ", "revis", "ion", "s", " ", "and", " ", "the", " ", "track", "ing", " ", "branch", ",", " ", "this", "\\", "10", ";", " ", " ", " ", " ", "will", " ", "als", "o", " ", "return", " ", "a", " ", "parent", " ", "diff", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "exclu", "de", "\\u", "patterns_", "=_", "normali", "ze", "\\u", "patterns_", "(_", "exclu", "de", "\\u", "patterns_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "get", "\\u", "root", "\\u", "directory_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "cwd_", "=_", "self_", "._", "original", "\\u", "cwd_", ")_", "\\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 ", " _", "merge", "\\u", "base_", "=_", "revisions_", "[_", "'", "parent", "\\u", "base", "'_", "]_", "\\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 ", " _", "merge", "\\u", "base_", "=_", "revisions_", "[_", "'", "base", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "diff", "\\u", "lines_", "=_", "self_", "._", "make", "\\u", "diff_", "(_", "merge", "\\u", "base_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "revisions_", "[_", "'", "base", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "revisions_", "[_", "'", "tip", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "include", "\\u", "files_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "exclu", "de", "\\u", "patterns_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "'", "parent", "\\u", "base", "'_", "in_", "revisions_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "parent", "\\u", "diff", "\\u", "lines_", "=_", "self_", "._", "make", "\\u", "diff_", "(_", "merge", "\\u", "base_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "revisions_", "[_", "'", "parent", "\\u", "base", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "revisions_", "[_", "'", "base", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "include", "\\u", "files_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "exclu", "de", "\\u", "patterns_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "base", "\\u", "commit", "\\u", "id_", "=_", "revisions_", "[_", "'", "parent", "\\u", "base", "'_", "]_", "\\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 ", " _", "parent", "\\u", "diff", "\\u", "lines_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "base", "\\u", "commit", "\\u", "id_", "=_", "revisions_", "[_", "'", "base", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "diff", "'_", ":_", "diff", "\\u", "lines_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "parent", "\\u", "diff", "'_", ":_", "parent", "\\u", "diff", "\\u", "lines_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "commit", "\\u", "id", "'_", ":_", "revisions_", "._", "get_", "(_", "'", "commit", "\\u", "id", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "base", "\\u", "commit", "\\u", "id", "'_", ":_", "base", "\\u", "commit", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Git", "Client_", "(_", "SCM", "Client_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "make", "\\u", "diff_", "(_", "self_", ",_", "merge", "\\u", "base_", ",_", "base_", ",_", "tip_", ",_", "include", "\\u", "files_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "exclu", "de", "\\u", "patterns_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Perform", "s", " ", "a", " ", "diff", " ", "on", " ", "a", " ", "partic", "ular", " ", "branch", " ", "range", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rev", "\\u", "range_", "=_", "\"%", "s", "..", "%", "s", "\"_", "%_", "(_", "base_", ",_", "tip_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "include", "\\u", "files_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "include", "\\u", "files_", "=_", "[_", "'--'_", "]_", "+_", "include", "\\u", "files_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "git", "\\u", "cmd_", "=_", "[_", "self_", "._", "git_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "self_", "._", "\\u", "support", "s", "\\u", "git", "\\u", "config", "\\u", "flag_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "git", "\\u", "cmd_", "._", "extend_", "(_", "[_", "'-", "c", "'_", ",_", "'", "core", ".", "quote", "path", "=", "fal", "se", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "type_", "in_", "(_", "'", "svn", "'_", ",_", "'", "perf", "orce", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "diff", "\\u", "cmd", "\\u", "params_", "=_", "[_", "'--", "no", "-", "color", "'_", ",_", "'--", "no", "-", "prefix", "'_", ",_", "'-", "r", "'_", ",_", "'-", "u", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "self_", "._", "type_", "==_", "'", "git", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "diff", "\\u", "cmd", "\\u", "params_", "=_", "[_", "'--", "no", "-", "color", "'_", ",_", "'--", "full", "-", "index", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'--", "ignore", "-", "submodules", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "self_", "._", "\\u", "support", "s", "\\u", "git", "\\u", "config", "\\u", "flag_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "git", "\\u", "cmd_", "._", "extend_", "(_", "[_", "'-", "c", "'_", ",_", "'", "diff", ".", "nop", "refix", "=", "fal", "se", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "(_", "self_", "._", "capabilities_", "is_", "not_", "None_", "and_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "capabilities_", "._", "has", "\\u", "capability_", "(_", "'", "diffs", "'_", ",_", "'", "moved", "\\u", "files", "'_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "diff", "\\u", "cmd", "\\u", "params_", "._", "append_", "(_", "'-", "M", "'_", ")_", "\\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 ", " _", "diff", "\\u", "cmd", "\\u", "params_", "._", "append_", "(_", "'--", "no", "-", "rename", "s", "'_", ")_", "\\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 ", " _", "assert_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "By", " ", "default", ",", " ", "don", "'", "t", " ", "allow", " ", "usi", "ng", " ", "external", " ", "diff", " ", "command", "s", ".", " ", "Thi", "s", " ", "prevent", "s_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "thing", "s", " ", "from", " ", "break", "ing", " ", "hor", "rib", "ly", " ", "if", " ", "some", "one", " ", "configur", "es", " ", "a", " ", "graphical", " ", "diff_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "viewer", " ", "like", " ", "p4", "merge", " ", "or", " ", "kal", "eid", "osco", "pe", ".", " ", "Thi", "s", " ", "can", " ", "be", " ", "overrid", "den", " ", "by_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "setti", "ng", " ", "GIT", "\\u", "USE", "\\u", "EXT", "\\u", "DIFF", " ", "=", " ", "Tru", "e", " ", "in", " ", "~", "/.", "reviewboard", "rc_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "self_", "._", "config_", "._", "get_", "(_", "'", "GIT", "\\u", "USE", "\\u", "EXT", "\\u", "DIFF", "'_", ",_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "diff", "\\u", "cmd", "\\u", "params_", "._", "append_", "(_", "'--", "no", "-", "ext", "-", "diff", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "diff", "\\u", "cmd_", "=_", "git", "\\u", "cmd_", "+_", "[_", "'", "diff", "'_", "]_", "+_", "diff", "\\u", "cmd", "\\u", "params_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "exclu", "de", "\\u", "patterns_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "If", " ", "we", " ", "have", " ", "specified", " ", "files", " ", "to", " ", "exclu", "de", ",", " ", "we", " ", "will", " ", "get", " ", "a", " ", "list", " ", "of", " ", "all_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "change", "d", " ", "files", " ", "and", " ", "run", " ", "`", "git", " ", "diff", "`", " ", "on", " ", "each", " ", "un", "-", "exclu", "ded", " ", "file_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "individual", "ly", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "change", "d\\u", "files", "\\u", "cmd_", "=_", "git", "\\u", "cmd_", "+_", "[_", "'", "diff", "-", "tree", "'_", "]_", "+_", "diff", "\\u", "cmd", "\\u", "params_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "type_", "==_", "'", "git", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "change", "d\\u", "files", "\\u", "cmd_", "._", "append_", "(_", "'-", "r", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "change", "d\\u", "files_", "=_", "execute_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "change", "d\\u", "files", "\\u", "cmd_", "+_", "[_", "rev", "\\u", "range_", "]_", "+_", "include", "\\u", "files_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "split", "\\u", "lines_", "=_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "with", "\\u", "errors_", "=_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "ignore", "\\u", "errors_", "=_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "none", "\\u", "on", "\\u", "ignore", "d\\u", "error_", "=_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "log", "\\u", "output", "\\u", "on", "\\u", "error_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "output", " ", "of", " ", "git", " ", "diff", "-", "tree", " ", "will", " ", "be", " ", "a", " ", "list", " ", "of", " ", "entri", "es", " ", "tha", "t", " ", "have_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "change", "d", " ", "bet", "ween", " ", "the", " ", "two", " ", "revis", "ion", "s", " ", "tha", "t", " ", "we", " ", "give", " ", "it", ".", " ", "The", " ", "last", " ", "part_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "of", " ", "the", " ", "line", " ", "is", " ", "the", " ", "name", " ", "of", " ", "the", " ", "file", " ", "tha", "t", " ", "has", " ", "change", "d", "._", "\\u\\u\\uNL\\u\\u\\u_", "change", "d\\u", "files_", "=_", "remove", "\\u", "filename", "s", "\\u", "matchi", "ng", "\\u", "patterns_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "filename_", "._", "split_", "(_", ")_", "[_", "-_", "1_", "]_", "for_", "filename_", "in_", "change", "d\\u", "files_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "exclu", "de", "\\u", "patterns_", ",_", "base", "\\u", "dir_", "=_", "self_", "._", "\\u", "get", "\\u", "root", "\\u", "directory_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "diff", "\\u", "lines_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "filename_", "in_", "change", "d\\u", "files_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "lines_", "=_", "execute_", "(_", "diff", "\\u", "cmd_", "+_", "[_", "rev", "\\u", "range_", ",_", "'--'_", ",_", "filename_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "split", "\\u", "lines_", "=_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "with", "\\u", "errors_", "=_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "ignore", "\\u", "errors_", "=_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "none", "\\u", "on", "\\u", "ignore", "d\\u", "error_", "=_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "log", "\\u", "output", "\\u", "on", "\\u", "error_", "=_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "results", "\\u", "unicode_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "lines_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "logging_", "._", "error_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Cou", "ld", " ", "not", " ", "get", " ", "diff", " ", "for", " ", "all", " ", "files", " ", "(", "git", "-", "diff", " ", "fail", "ed", " ", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'", "for", " ", "\"%", "s", "\")", ".", " ", "Refu", "sing", " ", "to", " ", "return", " ", "a", " ", "partial", " ", "diff", ".'_", "%_", "\\u\\u\\uNL\\u\\u\\u_", "filename_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "diff", "\\u", "lines_", "=_", "None_", "\\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_", "diff", "\\u", "lines_", "+=_", "lines_", "\\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 ", " _", "diff", "\\u", "lines_", "=_", "execute_", "(_", "diff", "\\u", "cmd_", "+_", "[_", "rev", "\\u", "range_", "]_", "+_", "include", "\\u", "files_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "split", "\\u", "lines_", "=_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "with", "\\u", "errors_", "=_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "ignore", "\\u", "errors_", "=_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "none", "\\u", "on", "\\u", "ignore", "d\\u", "error_", "=_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "log", "\\u", "output", "\\u", "on", "\\u", "error_", "=_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "results", "\\u", "unicode_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "type_", "==_", "'", "svn", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "make", "\\u", "svn", "\\u", "diff_", "(_", "merge", "\\u", "base_", ",_", "diff", "\\u", "lines_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "self_", "._", "type_", "==_", "'", "perf", "orce", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "make", "\\u", "perf", "orce", "\\u", "diff_", "(_", "merge", "\\u", "base_", ",_", "diff", "\\u", "lines_", ")_", "\\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_", "b", "''_", "._", "join_", "(_", "diff", "\\u", "lines_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Git", "Client_", "(_", "SCM", "Client_", ")_", ":_", "\\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_", "make", "\\u", "svn", "\\u", "diff_", "(_", "self_", ",_", "merge", "\\u", "base_", ",_", "diff", "\\u", "lines_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Format", "s", " ", "the", " ", "output", " ", "of", " ", "git", " ", "diff", " ", "suc", "h", " ", "tha", "t", " ", "it", "'", "s", " ", "in", " ", "a", " ", "form", " ", "tha", "t", "\\", "10", ";", " ", " ", " ", " ", "svn", " ", "diff", " ", "wou", "ld", " ", "generat", "e", ".", " ", "Thi", "s", " ", "is", " ", "need", "ed", " ", "so", " ", "the", " ", "SV", "NT", "ool", " ", "in", " ", "Review", "\\", "10", ";", " ", " ", " ", " ", "Boa", "rd", " ", "can", " ", "proper", "ly", " ", "parse", " ", "this", " ", "diff", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rev_", "=_", "execute_", "(_", "[_", "self_", "._", "git_", ",_", "\"", "svn", "\"_", ",_", "\"", "find", "-", "rev", "\"_", ",_", "merge", "\\u", "base_", "]_", ")_", "._", "strip_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "rev_", ":_", "\\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_", "diff", "\\u", "data_", "=_", "b", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "original", "\\u", "file_", "=_", "b", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "filename_", "=_", "b", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "newfile", "_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "i_", ",_", "line_", "in_", "enumerate_", "(_", "diff", "\\u", "lines_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "line_", "._", "startswith_", "(_", "b", "'", "diff", " ", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Grab", " ", "the", " ", "filename", " ", "and", " ", "then", " ", "filter", " ", "this", " ", "out", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Thi", "s", " ", "will", " ", "be", " ", "in", " ", "the", " ", "format", " ", "of", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "diff", " ", "--", "git", " ", "a", "/", "path", "/", "to", "/", "file", " ", "b", "/", "path", "/", "to", "/", "file_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "info_", "=_", "line_", "._", "split_", "(_", "b", "'", " ", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "diff", "\\u", "data_", "+=_", "b", "'", "Index", ":", " ", "%", "s", "\\\\", "n", "'_", "%_", "info_", "[_", "2_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "diff", "\\u", "data_", "+=_", "b", "'='_", "*_", "67_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "diff", "\\u", "data_", "+=_", "b", "'\\\\", "n", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "line_", "._", "startswith_", "(_", "b", "'", "index", " ", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Filter", " ", "this", " ", "out", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "line_", "._", "strip_", "(_", ")_", "==_", "b", "'---", " ", "/", "dev", "/", "null", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "New", " ", "file_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "newfile", "_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "(_", "line_", "._", "startswith_", "(_", "b", "'---", " ", "'_", ")_", "and_", "i_", "+_", "1_", "<_", "len_", "(_", "diff", "\\u", "lines_", ")_", "and_", "\\u\\u\\uNL\\u\\u\\u_", "diff", "\\u", "lines_", "[_", "i_", "+_", "1_", "]_", "._", "startswith_", "(_", "b", "'+", "++", " ", "'_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "newfile", "_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "original", "\\u", "file_", "=_", "line_", "[_", "4_", ":_", "]_", "._", "strip_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "diff", "\\u", "data_", "+=_", "b", "'---", " ", "%", "s", "\\\\", "t", "(", "revis", "ion", " ", "%", "s", ")\\\\", "n", "'_", "%_", "(_", "original", "\\u", "file_", ",_", "rev_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "line_", "._", "startswith_", "(_", "b", "'+", "++", " ", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "filename_", "=_", "line_", "[_", "4_", ":_", "]_", "._", "strip_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "newfile", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "diff", "\\u", "data_", "+=_", "b", "'---", " ", "%", "s", "\\\\", "t", "(", "revis", "ion", " ", "0", ")\\\\", "n", "'_", "%_", "filename_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "diff", "\\u", "data_", "+=_", "b", "'+", "++", " ", "%", "s", "\\\\", "t", "(", "revis", "ion", " ", "0", ")\\\\", "n", "'_", "%_", "filename_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "We", " ", "alr", "ead", "y", " ", "printed", " ", "the", " ", "\"--", "-", " ", "\"", " ", "line", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "diff", "\\u", "data_", "+=_", "b", "'+", "++", " ", "%", "s", "\\\\", "t", "(", "working", " ", "copy", ")\\\\", "n", "'_", "%_", "original", "\\u", "file_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "(_", "line_", "._", "startswith_", "(_", "b", "'", "new", " ", "file", " ", "mode", "'_", ")_", "or_", "\\u\\u\\uNL\\u\\u\\u_", "line_", "._", "startswith_", "(_", "b", "'", "delete", "d", " ", "file", " ", "mode", "'_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Filter", " ", "this", " ", "out", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "line_", "._", "startswith_", "(_", "b", "'", "Bin", "ary", " ", "files", " ", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Add", " ", "the", " ", "follow", "ing", " ", "so", " ", "tha", "t", " ", "we", " ", "know", " ", "binar", "y", " ", "files", " ", "wer", "e_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "adde", "d", "/", "change", "d", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "diff", "\\u", "data_", "+=_", "b", "'", "Cann", "ot", " ", "display", ":", " ", "file", " ", "marked", " ", "as", " ", "a", " ", "binar", "y", " ", "type", ".\\\\", "n", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "diff", "\\u", "data_", "+=_", "b", "'", "svn", ":", "mime", "-", "type", " ", "=", " ", "applica", "tion", "/", "oct", "et", "-", "stream", "\\\\", "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 ", " _", "diff", "\\u", "data_", "+=_", "line_", "\\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_", "diff", "\\u", "data_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Git", "Client_", "(_", "SCM", "Client_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "make", "\\u", "perf", "orce", "\\u", "diff_", "(_", "self_", ",_", "merge", "\\u", "base_", ",_", "diff", "\\u", "lines_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Format", " ", "the", " ", "output", " ", "of", " ", "git", " ", "diff", " ", "to", " ", "look", " ", "more", " ", "like", " ", "perf", "orce", "'", "s", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "diff", "\\u", "data_", "=_", "b", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "filename_", "=_", "b", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "p4", "rev_", "=_", "b", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Fin", "d", " ", "whi", "ch", " ", "depot", " ", "changeli", "st", " ", "we", "'", "re", " ", "based", " ", "on_", "\\u\\u\\uNL\\u\\u\\u_", "log_", "=_", "execute_", "(_", "[_", "self_", "._", "git_", ",_", "'", "log", "'_", ",_", "merge", "\\u", "base_", "]_", ",_", "ignore", "\\u", "errors_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "line_", "in_", "log_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "m_", "=_", "re_", "._", "search_", "(_", "br", "'[", "rd", "]", "epo", ".-", "path", "s", " ", "=", " ", "\"(.", "+)", "\":", " ", "change", " ", "=", " ", "(\\\\", "d", "+)", ".*\\\\", "]'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "log_", ",_", "re_", "._", "M_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "m_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "base", "\\u", "path_", "=_", "m_", "._", "group_", "(_", "1_", ")_", "._", "strip_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "p4", "rev_", "=_", "m_", "._", "group_", "(_", "2_", ")_", "._", "strip_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "We", " ", "shou", "ld", " ", "reall", "y", " ", "raise", " ", "an", " ", "error", " ", "here", ",", " ", "base", "\\u", "path", " ", "is", " ", "required_", "\\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_", "for_", "i_", ",_", "line_", "in_", "enumerate_", "(_", "diff", "\\u", "lines_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "line_", "._", "startswith_", "(_", "b", "'", "diff", " ", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Grab", " ", "the", " ", "filename", " ", "and", " ", "then", " ", "filter", " ", "this", " ", "out", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Thi", "s", " ", "will", " ", "be", " ", "in", " ", "the", " ", "format", " ", "of", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "diff", " ", "--", "git", " ", "a", "/", "path", "/", "to", "/", "file", " ", "b", "/", "path", "/", "to", "/", "file_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "filename_", "=_", "line_", "._", "split_", "(_", "b", "'", " ", "'_", ")_", "[_", "2_", "]_", "._", "strip_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "(_", "line_", "._", "startswith_", "(_", "b", "'", "index", " ", "'_", ")_", "or_", "\\u\\u\\uNL\\u\\u\\u_", "line_", "._", "startswith_", "(_", "b", "'", "new", " ", "file", " ", "mode", " ", "'_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Filter", " ", "this", " ", "out_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "(_", "line_", "._", "startswith_", "(_", "b", "'---", " ", "'_", ")_", "and_", "i_", "+_", "1_", "<_", "len_", "(_", "diff", "\\u", "lines_", ")_", "and_", "\\u\\u\\uNL\\u\\u\\u_", "diff", "\\u", "lines_", "[_", "i_", "+_", "1_", "]_", "._", "startswith_", "(_", "b", "'+", "++", " ", "'_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "data_", "=_", "execute_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "'", "p4", "'_", ",_", "'", "files", "'_", ",_", "base", "\\u", "path_", "+_", "filename_", "+_", "'@'_", "+_", "p4", "rev_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "ignore", "\\u", "errors_", "=_", "True_", ",_", "results", "\\u", "unicode_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "m_", "=_", "re_", "._", "search_", "(_", "br", "'", "^", "%", "s", "%", "s", "#(", "\\\\", "d", "+)", ".*", "$'_", "%_", "(_", "re_", "._", "escape_", "(_", "base", "\\u", "path_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "re_", "._", "escape_", "(_", "filename_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "data_", ",_", "re_", "._", "M_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "m_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "file", "\\u", "version_", "=_", "m_", "._", "group_", "(_", "1_", ")_", "._", "strip_", "(_", ")_", "\\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 ", " ", "_", "file", "\\u", "version_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "diff", "\\u", "data_", "+=_", "b", "'---", " ", "%", "s", "%", "s", "\\\\", "t", "%", "s", "%", "s", "#", "%", "s", "\\\\", "n", "'_", "%_", "(_", "base", "\\u", "path_", ",_", "filename_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "base", "\\u", "path_", ",_", "filename_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "file", "\\u", "version_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "line_", "._", "startswith_", "(_", "b", "'+", "++", " ", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "TOD", "O", ":", " ", "add", " ", "a", " ", "real", " ", "timestamp_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "diff", "\\u", "data_", "+=_", "b", "'+", "++", " ", "%", "s", "%", "s", "\\\\", "t", "%", "s", "\\\\", "n", "'_", "%_", "(_", "base", "\\u", "path_", ",_", "filename_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "TIMES", "TAM", "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 ", " _", "diff", "\\u", "data_", "+=_", "line_", "\\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_", "diff", "\\u", "data_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Git", "Client_", "(_", "SCM", "Client_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "has", "\\u", "pend", "ing", "\\u", "changes_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Check", "s", " ", "if", " ", "there", " ", "are", " ", "change", "s", " ", "wait", "ing", " ", "to", " ", "be", " ", "committ", "ed", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", " ", "Tru", "e", " ", "if", " ", "the", " ", "working", " ", "director", "y", " ", "has", " ", "bee", "n", " ", "modifi", "ed", " ", "or", " ", "if", " ", "change", "s", "\\", "10", ";", " ", " ", " ", " ", "have", " ", "bee", "n", " ", "staged", " ", "in", " ", "the", " ", "index", ",", " ", "other", "wis", "e", " ", "return", "s", " ", "Fal", "se", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "status_", "=_", "execute_", "(_", "[_", "'", "git", "'_", ",_", "'", "status", "'_", ",_", "'--", "porc", "ela", "in", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'--", "untracked", "-", "files", "=", "no", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "status_", "!=_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Git", "Client_", "(_", "SCM", "Client_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "amend", "\\u", "commit", "\\u", "description_", "(_", "self_", ",_", "message_", ",_", "revisions_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Update", " ", "a", " ", "commit", " ", "message", " ", "to", " ", "the", " ", "give", "n", " ", "string", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Sin", "ce", " ", "git", " ", "can", " ", "amend", " ", "only", " ", "the", " ", "most", " ", "recent", " ", "commit", ",", " ", "an", " ", "Ame", "nd", "Error", " ", "will", " ", "be", "\\", "10", ";", " ", " ", " ", " ", "raise", "d", " ", "if", " ", "revis", "ion", "s", " ", "points", " ", "to", " ", "a", " ", "commit", " ", "other", " ", "than", " ", "the", " ", "the", " ", "most", " ", "recent", "\\", "10", ";", " ", " ", " ", " ", "commit", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "revisions_", "and_", "revisions_", "[_", "'", "tip", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "commit", "\\u", "ids_", "=_", "execute_", "(_", "[_", "self_", "._", "git_", ",_", "'", "rev", "-", "parse", "'_", ",_", "'", "HEAD", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "revisions_", "[_", "'", "tip", "'_", "]_", "]_", ",_", "split", "\\u", "lines_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "head", "\\u", "id_", "=_", "commit", "\\u", "ids_", "[_", "0_", "]_", "._", "strip_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "revis", "ion", "\\u", "id_", "=_", "commit", "\\u", "ids_", "[_", "1_", "]_", "._", "strip_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "head", "\\u", "id_", "!=_", "revis", "ion", "\\u", "id_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Ame", "nd", "Error_", "(_", "'", "Commi", "t", " ", "\"%", "s", "\"", " ", "is", " ", "not", " ", "the", " ", "late", "st", " ", "commit", ",", " ", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'", "and", " ", "thu", "s", " ", "cann", "ot", " ", "be", " ", "modifi", "ed", "'_", "%_", "revis", "ion", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "execute_", "(_", "[_", "self_", "._", "git_", ",_", "'", "commit", "'_", ",_", "'--", "amend", "'_", ",_", "'-", "m", "'_", ",_", "message_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Git", "Client_", "(_", "SCM", "Client_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "appl", "y", "\\u", "patch_", "(_", "self_", ",_", "patch", "\\u", "file_", ",_", "base", "\\u", "path_", "=_", "None_", ",_", "base", "\\u", "dir_", "=_", "None_", ",_", "p_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "revert", "_", "=_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Apply", " ", "the", " ", "give", "n", " ", "patch", " ", "to", " ", "index", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Thi", "s", " ", "will", " ", "take", " ", "the", " ", "give", "n", " ", "patch", " ", "file", " ", "and", " ", "appl", "y", " ", "it", " ", "to", " ", "the", " ", "index", ",", "\\", "10", ";", " ", " ", " ", " ", "sched", "ulin", "g", " ", "all", " ", "change", "s", " ", "for", " ", "commit", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cmd_", "=_", "[_", "'", "git", "'_", ",_", "'", "appl", "y", "'_", ",_", "'-", "3", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "revert", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cmd_", "._", "append_", "(_", "'-", "R", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "p_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cmd_", "+=_", "[_", "'-", "p", "'_", ",_", "p_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "cmd_", "._", "append_", "(_", "patch", "\\u", "file_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "rc_", ",_", "data_", "=_", "self_", "._", "\\u", "execute_", "(_", "cmd_", ",_", "with", "\\u", "errors_", "=_", "True_", ",_", "return", "\\u", "error", "\\u", "code_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "rc_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "Pat", "ch", "Result_", "(_", "applied", "_", "=_", "True_", ",_", "patch", "\\u", "output_", "=_", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "'", "with", " ", "confl", "icts", "'_", "in_", "data_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "Pat", "ch", "Result_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "applied", "_", "=_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "has", "\\u", "conflicts_", "=_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "conflicting", "\\u", "files_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "line_", "._", "split_", "(_", "'", " ", "'_", ",_", "1_", ")_", "[_", "1_", "]_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "line_", "in_", "data_", "._", "splitlines_", "(_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "line_", "._", "startswith_", "(_", "'", "U", "'_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "patch", "\\u", "output_", "=_", "data_", ")_", "\\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_", "Pat", "ch", "Result_", "(_", "applied", "_", "=_", "False_", ",_", "patch", "\\u", "output_", "=_", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Git", "Client_", "(_", "SCM", "Client_", ")_", ":_", "\\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", "commit_", "(_", "self_", ",_", "message_", ",_", "author_", ",_", "run", "\\u", "editor_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "files_", "=_", "[_", "]_", ",_", "all", "\\u", "files_", "=_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Commi", "ts", " ", "the", " ", "give", "n", " ", "modifi", "ed", " ", "files", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Thi", "s", " ", "is", " ", "expected", " ", "to", " ", "be", " ", "call", "ed", " ", "after", " ", "appl", "ying", " ", "a", " ", "patch", ".", " ", "Thi", "s", " ", "commit", "s", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "patch", " ", "usi", "ng", " ", "informati", "on", " ", "from", " ", "the", " ", "review", " ", "request", ",", " ", "opening", " ", "the", " ", "commit", "\\", "10", ";", " ", " ", " ", " ", "message", " ", "in", " ", "$", "EDITOR", " ", "to", " ", "allow", " ", "the", " ", "user", " ", "to", " ", "update", " ", "it", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "run", "\\u", "editor_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "modifi", "ed", "\\u", "message_", "=_", "edit", "\\u", "text_", "(_", "message_", ")_", "\\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 ", " _", "modifi", "ed", "\\u", "message_", "=_", "message_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "all", "\\u", "files_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "execute_", "(_", "[_", "'", "git", "'_", ",_", "'", "add", "'_", ",_", "'--", "all", "'_", ",_", "':/", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "files_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "execute_", "(_", "[_", "'", "git", "'_", ",_", "'", "add", "'_", "]_", "+_", "files_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "execute_", "(_", "[_", "'", "git", "'_", ",_", "'", "commit", "'_", ",_", "'-", "m", "'_", ",_", "modifi", "ed", "\\u", "message_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'--", "author", "=\"", "%", "s", " ", "<", "%", "s", ">\"", "'_", "%_", "(_", "author_", "._", "fullname_", ",_", "author_", "._", "email_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Git", "Client_", "(_", "SCM", "Client_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "delete", "\\u", "branch_", "(_", "self_", ",_", "branch", "\\u", "name_", ",_", "merge", "d\\u", "only_", "=_", "True_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Delete", "s", " ", "the", " ", "specified", " ", "branch", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "If", " ", "merge", "d\\u", "only", " ", "is", " ", "Fal", "se", ",", " ", "then", " ", "the", " ", "branch", " ", "will", " ", "be", " ", "delete", "d", " ", "even", " ", "if", " ", "not", "\\", "10", ";", " ", " ", " ", " ", "ye", "t", " ", "merge", "d", " ", "int", "o", " ", "an", " ", "ups", "tream", " ", "branch", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "merge", "d\\u", "only_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "delete", "\\u", "flag_", "=_", "'-", "d", "'_", "\\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 ", " _", "delete", "\\u", "flag_", "=_", "'-", "D", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "execute_", "(_", "[_", "'", "git", "'_", ",_", "'", "branch", "'_", ",_", "delete", "\\u", "flag_", ",_", "branch", "\\u", "name_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Git", "Client_", "(_", "SCM", "Client_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "merge_", "(_", "self_", ",_", "target_", ",_", "destination_", ",_", "message_", ",_", "author_", ",_", "squash", "_", "=_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "run", "\\u", "editor_", "=_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Merge", "s", " ", "the", " ", "target", " ", "branch", " ", "with", " ", "destinat", "ion", " ", "branch", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rc_", ",_", "output_", "=_", "execute_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "'", "git", "'_", ",_", "'", "check", "out", "'_", ",_", "destination_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "ignore", "\\u", "errors_", "=_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "return", "\\u", "error", "\\u", "code_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "rc_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Merge", "Error_", "(_", "\"", "Cou", "ld", " ", "not", " ", "check", "out", " ", "to", " ", "branch", " ", "'%", "s", "'.", "\\\\", "n", "\\\\", "n", "%", "s", "\"_", "%_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "destination_", ",_", "output_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "squash", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "method_", "=_", "'--", "squash", "'_", "\\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 ", " _", "method_", "=_", "'--", "no", "-", "ff", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "rc_", ",_", "output_", "=_", "execute_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "'", "git", "'_", ",_", "'", "merge", "'_", ",_", "target_", ",_", "method_", ",_", "'--", "no", "-", "commit", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "ignore", "\\u", "errors_", "=_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "return", "\\u", "error", "\\u", "code_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "rc_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Merge", "Error_", "(_", "\"", "Cou", "ld", " ", "not", " ", "merge", " ", "branch", " ", "'%", "s", "'", " ", "int", "o", " ", "'%", "s", "'.", "\\\\", "n", "\\\\", "n", "%", "s", "\"_", "%_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "target_", ",_", "destination_", ",_", "output_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "create", "\\u", "commit_", "(_", "message_", ",_", "author_", ",_", "run", "\\u", "editor_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Git", "Client_", "(_", "SCM", "Client_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "push", "\\u", "upstream_", "(_", "self_", ",_", "remote", "\\u", "branch_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Push", "es", " ", "the", " ", "current", " ", "branch", " ", "to", " ", "ups", "tream", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "orig", "in", "\\u", "url_", "=_", "self_", "._", "get", "\\u", "origin_", "(_", ")_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rc_", ",_", "output_", "=_", "execute_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "'", "git", "'_", ",_", "'", "pull", "'_", ",_", "'--", "rebase", "'_", ",_", "orig", "in", "\\u", "url_", ",_", "remote", "\\u", "branch_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "ignore", "\\u", "errors_", "=_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "return", "\\u", "error", "\\u", "code_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "rc_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Push", "Error_", "(_", "'", "Cou", "ld", " ", "not", " ", "pull", " ", "change", "s", " ", "from", " ", "ups", "tream", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "rc_", ",_", "output_", "=_", "execute_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "'", "git", "'_", ",_", "'", "push", "'_", ",_", "orig", "in", "\\u", "url_", ",_", "remote", "\\u", "branch_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "ignore", "\\u", "errors_", "=_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "return", "\\u", "error", "\\u", "code_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "rc_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Push", "Error_", "(_", "\"", "Cou", "ld", " ", "not", " ", "push", " ", "branch", " ", "'%", "s", "'", " ", "to", " ", "ups", "tream", "\"_", "%_", "\\u\\u\\uNL\\u\\u\\u_", "remote", "\\u", "branch_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Git", "Client_", "(_", "SCM", "Client_", ")_", ":_", "\\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", "current", "\\u", "branch_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Return", " ", "the", " ", "name", " ", "of", " ", "the", " ", "current", " ", "branch", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", ":", "\\", "10", ";", " ", " ", " ", " ", "bytes", ":", "\\", "10", ";", " ", " ", " ", " ", "A", " ", "string", " ", "with", " ", "the", " ", "name", " ", "of", " ", "the", " ", "current", " ", "branch", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "execute_", "(_", "[_", "self_", "._", "git_", ",_", "\"", "rev", "-", "parse", "\"_", ",_", "\"--", "abbrev", "-", "ref", "\"_", ",_", "\"", "HEAD", "\"_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "ignore", "\\u", "errors_", "=_", "True_", ")_", "._", "strip_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Git", "Client_", "(_", "SCM", "Client_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "get", "\\u", "root", "\\u", "directory_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Get", " ", "the", " ", "root", " ", "director", "y", " ", "of", " ", "the", " ", "repos", "itor", "y", " ", "as", " ", "an", " ", "abs", "olute", " ", "path", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "git", "\\u", "dir_", "=_", "execute_", "(_", "[_", "self_", "._", "git_", ",_", "\"", "rev", "-", "parse", "\"_", ",_", "\"--", "git", "-", "dir", "\"_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "ignore", "\\u", "errors_", "=_", "True_", ")_", "._", "rstrip_", "(_", "\"\\\\", "n", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "git", "\\u", "dir_", "._", "startswith_", "(_", "\"", "fat", "al", ":\"_", ")_", "or_", "not_", "os_", "._", "path_", "._", "isdir_", "(_", "git", "\\u", "dir_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logging_", "._", "error_", "(_", "\"", "Cou", "ld", " ", "not", " ", "find", " ", "git", " ", "repos", "itor", "y", " ", "path", ".\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "os_", "._", "path_", "._", "abspath_", "(_", "os_", "._", "path_", "._", "join_", "(_", "git", "\\u", "dir_", ",_", "\"..\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Git", "Client_", "(_", "SCM", "Client_", ")_", ":_", "\\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_", "original", "\\u", "cwd_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Get", " ", "the", " ", "original", " ", "current", " ", "working", " ", "director", "y", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "\\u", "original", "\\u", "cwd_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "If", " ", "this", " ", "is", " ", "Non", "e", ",", " ", "then", " ", "we", " ", "have", "n", "'", "t", " ", "call", "ed", " ", "get", "\\u", "repos", "itor", "y", "\\u", "info", " ", "and_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "shou", "ld", "n", "'", "t", " ", "have", " ", "change", "d", " ", "director", "ies", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "original", "\\u", "cwd_", "=_", "os_", "._", "getcwd_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "self_", "._", "\\u", "original", "\\u", "cwd_" ]
[ 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,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"root.NDArrayMixin.__getitem__", "header": "['class', 'NDArrayMixin', '(', 'NdimSizeLenMixin', ')', ':', '___EOS___']", "index": 388 } ]
[]
[]
0
true
[ "[CLS]_", "Dep", "reca", "ted_", "slice_", "method_", "[SEP]_", "class_", "ND", "Array", "Mixin_", "(_", "Nd", "im", "Size", "Len", "Mixin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "getitem\\u\\u_", "(_", "self_", ",_", "key_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "array_", "[_", "key_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 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 ]
Variable defined multiple times
redhat-cip/software-factory/tests/functional/test_userdata.py
[ { "content": " def test_delete_user_in_backends_by_username(self):\n \"\"\" Delete a user previously registered user by username\n \"\"\"\n # first, create a user and register it with services\n try:\n self.msu.create_user('bootsy', 'collins', 'funk@mothership.com')\n except NotImplementedError:\n skip(\"user management not supported in this version of managesf\")\n self.logout()\n self.login('bootsy', 'collins', config.GATEWAY_URL)\n # make sure user is in redmine and gerrit\n self.assertEqual('funk@mothership.com',\n self.gu.get_account('bootsy').get('email'))\n if has_issue_tracker():\n users = self.rm.active_users()\n users = [u for u in users if u[0] == 'bootsy']\n self.assertEqual(1, len(users))\n user = users[0]\n self.assertEqual('funk@mothership.com',\n user[1])\n # now suppress it\n del_url = config.GATEWAY_URL + 'manage/services_users/?username=bootsy'\n # try with a a non-admin user, it should not work ...\n auth_cookie = get_cookie(config.GATEWAY_HOST,\n 'user5', config.ADMIN_PASSWORD)\n d = requests.delete(del_url,\n cookies={'auth_pubtkt': auth_cookie})\n self.assertEqual(401,\n int(d.status_code))\n # try with an admin ...\n auth_cookie = config.USERS[config.ADMIN_USER]['auth_cookie']\n d = requests.delete(del_url,\n cookies={'auth_pubtkt': auth_cookie})\n self.assertTrue(int(d.status_code) < 400, d.status_code)\n # make sure the user does not exist anymore\n self.assertEqual(False,\n self.gu.get_account('bootsy'))\n if has_issue_tracker():\n users = self.rm.active_users()\n self.assertEqual(0,\n len([u for u in users\n if u[0] == 'bootsy']))", "metadata": "root.TestUserdata.test_delete_user_in_backends_by_username", "header": "['class', 'TestUserdata', '(', 'Base', ')', ':', '___EOS___']", "index": 152 } ]
[]
[]
0
true
[ "[CLS]_", "Variable_", "defined_", "multiple_", "times_", "[SEP]_", "class_", "Test", "User", "data_", "(_", "Base_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "delete", "\\u", "user", "\\u", "in", "\\u", "back", "ends", "\\u", "by", "\\u", "username_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "Delete", " ", "a", " ", "user", " ", "previ", "ously", " ", "register", "ed", " ", "user", " ", "by", " ", "user", "name", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "first", ",", " ", "create", " ", "a", " ", "user", " ", "and", " ", "register", " ", "it", " ", "with", " ", "services_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "ms", "u_", "._", "create", "\\u", "user_", "(_", "'", "boots", "y", "'_", ",_", "'", "colli", "ns", "'_", ",_", "'", "fun", "k", "@", "mother", "ship", ".", "com", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Not", "Impl", "ement", "ed", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "skip_", "(_", "\"", "user", " ", "manage", "ment", " ", "not", " ", "support", "ed", " ", "in", " ", "this", " ", "version", " ", "of", " ", "manage", "sf", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "logout_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "login_", "(_", "'", "boots", "y", "'_", ",_", "'", "colli", "ns", "'_", ",_", "config_", "._", "GATEWAY", "\\u", "URL_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "make", " ", "sure", " ", "user", " ", "is", " ", "in", " ", "red", "mine", " ", "and", " ", "gerrit", "_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "'", "fun", "k", "@", "mother", "ship", ".", "com", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "gu", "_", "._", "get", "\\u", "account_", "(_", "'", "boots", "y", "'_", ")_", "._", "get_", "(_", "'", "email", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "has", "\\u", "issue", "\\u", "tracker_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "users_", "=_", "self_", "._", "rm_", "._", "active", "\\u", "users_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "users_", "=_", "[_", "u_", "for_", "u_", "in_", "users_", "if_", "u_", "[_", "0_", "]_", "==_", "'", "boots", "y", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "1_", ",_", "len_", "(_", "users_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "user_", "=_", "users_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "'", "fun", "k", "@", "mother", "ship", ".", "com", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "user_", "[_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "now", " ", "suppress", " ", "it_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "del", "\\u", "url_", "=_", "config_", "._", "GATEWAY", "\\u", "URL_", "+_", "'", "manage", "/", "service", "s", "\\u", "users", "/?", "user", "name", "=", "boots", "y", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "try", " ", "with", " ", "a", " ", "a", " ", "non", "-", "admin", " ", "user", ",", " ", "it", " ", "shou", "ld", " ", "not", " ", "work", " ", "..._", "\\u\\u\\uNL\\u\\u\\u_", "auth", "\\u", "cookie_", "=_", "get", "\\u", "cookie_", "(_", "config_", "._", "GATEWAY", "\\u", "HOST_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "user", "5", "'_", ",_", "config_", "._", "ADM", "IN", "\\u", "PASSWORD_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "d_", "=_", "requests_", "._", "delete_", "(_", "del", "\\u", "url_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "cookies_", "=_", "{_", "'", "auth", "\\u", "pub", "tk", "t", "'_", ":_", "auth", "\\u", "cookie_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "401_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "int_", "(_", "d_", "._", "status", "\\u", "code_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "try", " ", "with", " ", "an", " ", "admin", " ", "..._", "\\u\\u\\uNL\\u\\u\\u_", "auth", "\\u", "cookie_", "=_", "config_", "._", "USERS", "_", "[_", "config_", "._", "ADM", "IN", "\\u", "USER_", "]_", "[_", "'", "auth", "\\u", "cookie", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "d_", "=_", "requests_", "._", "delete_", "(_", "del", "\\u", "url_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "cookies_", "=_", "{_", "'", "auth", "\\u", "pub", "tk", "t", "'_", ":_", "auth", "\\u", "cookie_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "int_", "(_", "d_", "._", "status", "\\u", "code_", ")_", "<_", "400_", ",_", "d_", "._", "status", "\\u", "code_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "make", " ", "sure", " ", "the", " ", "user", " ", "doe", "s", " ", "not", " ", "exist", " ", "any", "more_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "gu", "_", "._", "get", "\\u", "account_", "(_", "'", "boots", "y", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "has", "\\u", "issue", "\\u", "tracker_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "users_", "=_", "self_", "._", "rm_", "._", "active", "\\u", "users_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "0_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "len_", "(_", "[_", "u_", "for_", "u_", "in_", "users_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "u_", "[_", "0_", "]_", "==_", "'", "boots", "y", "'_", "]_", ")_", ")_", "\\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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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, 2 ]
Missing call to `__init__` during object initialization
aliyun/aliyun-openapi-python-sdk/aliyun-python-sdk-core/aliyunsdkcore/http/http_request.py
[ { "content": "class HttpRequest:\n\n content_md5 = \"Content-MD5\"\n content_length = \"Content-Length\"\n content_type = \"Content-Type\"\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n", "metadata": "root.HttpRequest", "header": "['module', '___EOS___']", "index": 29 }, { "content": " def __init__(self, host=\"\", url=\"/\", method=None, headers={}):\n self.__host = host\n self.__url = url\n self.__method = method\n self.__content_type = \"\"\n self.__content = \"\"\n self.__encoding = \"\"\n self.__headers = headers\n self.__body = None", "metadata": "root.HttpRequest.__init__", "header": "['class', 'HttpRequest', ':', '___EOS___']", "index": 35 } ]
[]
[]
0
false
[ "[CLS]_", "Missing", "_", "call_", "to_", " _", "`_", "\\u\\u", "init\\u\\u_", "`_", "dur", "ing_", "object_", "initialization", "_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Http", "Request_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "content", "\\u", "md5_", "=_", "\"", "Conten", "t", "-", "MD", "5", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "content", "\\u", "length_", "=_", "\"", "Conten", "t", "-", "Length", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "content", "\\u", "type_", "=_", "\"", "Conten", "t", "-", "Type", "\"_", "\\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_", "Http", "Request_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "host_", "=_", "\"\"_", ",_", "url_", "=_", "\"/\"_", ",_", "method_", "=_", "None_", ",_", "headers_", "=_", "{_", "}_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u\\u", "host_", "=_", "host_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u\\u", "url_", "=_", "url_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u\\u", "method_", "=_", "method_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u\\u", "content", "\\u", "type_", "=_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u\\u", "content_", "=_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u\\u", "encoding_", "=_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u\\u", "headers_", "=_", "headers_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u\\u", "body_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 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, 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 ]
Except block handles 'BaseException'
bendavis78/python-gitmodel/gitmodel/fields.py
[ { "content": " def to_python(self, value):\n if value is None:\n return value\n if isinstance(value, datetime):\n return value\n if isinstance(value, date):\n return datetime(value.year, value.month, value.day)\n\n if isinstance(value, basestring):\n try:\n return isodate.parse_iso_datetime(value)\n except isodate.InvalidFormat:\n # we also accept a date-only string\n try:\n return isodate.parse_iso_date(value)\n except isodate.InvalidFormat:\n raise ValidationError('invalid_format', self)\n except isodate.InvalidDate:\n raise ValidationError('invalid', self)", "metadata": "root.DateTimeField.to_python", "header": "['class', 'DateTimeField', '(', 'Field', ')', ':', '___EOS___']", "index": 402 } ]
[]
[]
0
true
[ "[CLS]_", "Except", "_", "block_", "handles_", "'", "Base", "Except", "ion", "'_", "[SEP]_", "class_", "Date", "Time", "Field_", "(_", "Field_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "to", "\\u", "python_", "(_", "self_", ",_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "value_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "isinstance_", "(_", "value_", ",_", "datetime_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "isinstance_", "(_", "value_", ",_", "date_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "datetime_", "(_", "value_", "._", "year_", ",_", "value_", "._", "month_", ",_", "value_", "._", "day_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "isinstance_", "(_", "value_", ",_", "basestring_", ")_", ":_", "\\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_", "iso", "date_", "._", "parse", "\\u", "iso", "\\u", "datetime_", "(_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "iso", "date_", "._", "Inva", "lid", "Format_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "we", " ", "als", "o", " ", "accept", " ", "a", " ", "date", "-", "only", " ", "string_", "\\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_", "iso", "date_", "._", "parse", "\\u", "iso", "\\u", "date_", "(_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "iso", "date_", "._", "Inva", "lid", "Format_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "raise_", "Validat", "ion", "Error_", "(_", "'", "invalid", "\\u", "format", "'_", ",_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "iso", "date_", "._", "Inva", "lid", "Date_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Validat", "ion", "Error_", "(_", "'", "invalid", "'_", ",_", "self_", ")_", "\\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 ]
Unused import
deanhiller/databus/webapp/play1.3.x/python/Lib/site-packages/win32/lib/regutil.py
[ { "content": "# Some registry helpers.\nimport win32api\nimport win32con\nimport sys\nimport os\n\nerror = \"Registry utility error\"\n\n# A .py file has a CLSID associated with it (why? - dunno!)\nCLSIDPyFile = \"{b51df050-06ae-11cf-ad3b-524153480001}\"\n\nRegistryIDPyFile = \"Python.File\" # The registry \"file type\" of a .py file\nRegistryIDPycFile = \"Python.CompiledFile\" # The registry \"file type\" of a .pyc file\n\n\n\n\t\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def GetRootKey():\n\t\"\"\"Retrieves the Registry root in use by Python.\n\t\"\"\"\n# Win32s no longer supported/released.\n#\tif win32ui.IsWin32s():\n#\t\treturn win32con.HKEY_CLASSES_ROOT\n#\telse:\n\treturn win32con.HKEY_LOCAL_MACHINE", "metadata": "root.GetRootKey", "header": "['module', '___EOS___']", "index": 14 }, { "content": "def GetRegistryDefaultValue(subkey, rootkey = None):\n\t\"\"\"A helper to return the default value for a key in the registry.\n \"\"\"\n\tif rootkey is None: rootkey = GetRootKey()\n\treturn win32api.RegQueryValue(rootkey, subkey)", "metadata": "root.GetRegistryDefaultValue", "header": "['module', '___EOS___']", "index": 23 }, { "content": "def SetRegistryDefaultValue(subKey, value, rootkey = None):\n\t\"\"\"A helper to set the default value for a key in the registry\n \"\"\"\n\timport types\n\tif rootkey is None: rootkey = GetRootKey()\n\tif type(value)==types.StringType:\n\t\ttypeId = win32con.REG_SZ\n\telif type(value)==types.IntType:\n\t\ttypeId = win32con.REG_DWORD\n\telse:\n\t\traise TypeError, \"Value must be string or integer - was passed \" + str(value)\n\n\twin32api.RegSetValue(rootkey, subKey, typeId ,value)", "metadata": "root.SetRegistryDefaultValue", "header": "['module', '___EOS___']", "index": 29 }, { "content": "def BuildDefaultPythonKey():\n\t\"\"\"Builds a string containing the path to the current registry key.\n\n\t The Python registry key contains the Python version. This function\n\t uses the version of the DLL used by the current process to get the\n\t registry key currently in use.\n \"\"\"\n\n\treturn \"Software\\\\Python\\\\PythonCore\\\\\" + sys.winver", "metadata": "root.BuildDefaultPythonKey", "header": "['module', '___EOS___']", "index": 43 }, { "content": "def GetAppPathsKey():\n\treturn \"Software\\\\Microsoft\\\\Windows\\\\CurrentVersion\\\\App Paths\"", "metadata": "root.GetAppPathsKey", "header": "['module', '___EOS___']", "index": 53 }, { "content": "def RegisterPythonExe(exeFullPath, exeAlias = None, exeAppPath = None):\n\t\"\"\"Register a .exe file that uses Python.\n\n\t Registers the .exe with the OS. This allows the specified .exe to\n\t be run from the command-line or start button without using the full path,\n\t and also to setup application specific path (ie, os.environ['PATH']).\n\n\t Currently the exeAppPath is not supported, so this function is general\n\t purpose, and not specific to Python at all. Later, exeAppPath may provide\n\t a reasonable default that is used.\n\n\t exeFullPath -- The full path to the .exe\n\t exeAlias = None -- An alias for the exe - if none, the base portion\n\t of the filename is used.\n\t exeAppPath -- Not supported.\n\t\"\"\"\n\t# Note - Dont work on win32s (but we dont care anymore!)\n\tif exeAppPath:\n\t\traise error, \"Do not support exeAppPath argument currently\"\n\tif exeAlias is None:\n\t\texeAlias = os.path.basename(exeFullPath)\n\twin32api.RegSetValue(GetRootKey(), GetAppPathsKey() + \"\\\\\" + exeAlias, win32con.REG_SZ, exeFullPath)", "metadata": "root.RegisterPythonExe", "header": "['module', '___EOS___']", "index": 56 }, { "content": "def GetRegisteredExe(exeAlias):\n\t\"\"\"Get a registered .exe\n\t\"\"\"\n\treturn win32api.RegQueryValue(GetRootKey(), GetAppPathsKey() + \"\\\\\" + exeAlias)", "metadata": "root.GetRegisteredExe", "header": "['module', '___EOS___']", "index": 79 }, { "content": "def UnregisterPythonExe(exeAlias):\n\t\"\"\"Unregister a .exe file that uses Python.\n\t\"\"\"\n\ttry:\n\t\twin32api.RegDeleteKey(GetRootKey(), GetAppPathsKey() + \"\\\\\" + exeAlias)\n\texcept win32api.error, (code, fn, details):\n\t\timport winerror\n\t\tif code!=winerror.ERROR_FILE_NOT_FOUND:\n\t\t\traise win32api.error, (code, fn, desc)\n\t\treturn", "metadata": "root.UnregisterPythonExe", "header": "['module', '___EOS___']", "index": 84 }, { "content": "def RegisterNamedPath(name, path):\n\t\"\"\"Register a named path - ie, a named PythonPath entry.\n\t\"\"\"\n\tkeyStr = BuildDefaultPythonKey() + \"\\\\PythonPath\"\n\tif name: keyStr = keyStr + \"\\\\\" + name\n\twin32api.RegSetValue(GetRootKey(), keyStr, win32con.REG_SZ, path)", "metadata": "root.RegisterNamedPath", "header": "['module', '___EOS___']", "index": 95 }, { "content": "def UnregisterNamedPath(name):\n\t\"\"\"Unregister a named path - ie, a named PythonPath entry.\n\t\"\"\"\n\tkeyStr = BuildDefaultPythonKey() + \"\\\\PythonPath\\\\\" + name\n\ttry:\n\t\twin32api.RegDeleteKey(GetRootKey(), keyStr)\n\texcept win32api.error, (code, fn, details):\n\t\timport winerror\n\t\tif code!=winerror.ERROR_FILE_NOT_FOUND:\n\t\t\traise win32api.error, (code, fn, desc)\n\t\treturn", "metadata": "root.UnregisterNamedPath", "header": "['module', '___EOS___']", "index": 102 }, { "content": "def GetRegisteredNamedPath(name):\n\t\"\"\"Get a registered named path, or None if it doesnt exist.\n\t\"\"\"\n\tkeyStr = BuildDefaultPythonKey() + \"\\\\PythonPath\"\n\tif name: keyStr = keyStr + \"\\\\\" + name\n\ttry:\n\t\treturn win32api.RegQueryValue(GetRootKey(), keyStr)\n\texcept win32api.error, (code, fn, details):\n\t\timport winerror\n\t\tif code!=winerror.ERROR_FILE_NOT_FOUND:\n\t\t\traise win32api.error, (code, fn, details)\n\t\treturn None", "metadata": "root.GetRegisteredNamedPath", "header": "['module', '___EOS___']", "index": 114 }, { "content": "def RegisterModule(modName, modPath):\n\t\"\"\"Register an explicit module in the registry. This forces the Python import\n mechanism to locate this module directly, without a sys.path search. Thus\n a registered module need not appear in sys.path at all.\n\n\t modName -- The name of the module, as used by import.\n\t modPath -- The full path and file name of the module.\n\t\"\"\"\n\ttry:\n\t\timport os\n\t\tos.stat(modPath)\n\texcept os.error:\n\t\tprint \"Warning: Registering non-existant module %s\" % modPath\n\twin32api.RegSetValue(GetRootKey(), \n\t BuildDefaultPythonKey() + \"\\\\Modules\\\\%s\" % modName,\n\t\twin32con.REG_SZ, modPath)", "metadata": "root.RegisterModule", "header": "['module', '___EOS___']", "index": 128 }, { "content": "def UnregisterModule(modName):\n\t\"\"\"Unregister an explicit module in the registry.\n\n\t modName -- The name of the module, as used by import.\n\t\"\"\"\n\ttry:\n\t\twin32api.RegDeleteKey(GetRootKey(), \n\t\t BuildDefaultPythonKey() + \"\\\\Modules\\\\%s\" % modName)\n\texcept win32api.error, (code, fn, desc):\n\t\timport winerror\n\t\tif code!=winerror.ERROR_FILE_NOT_FOUND:\n\t\t\traise win32api.error, (code, fn, desc)", "metadata": "root.UnregisterModule", "header": "['module', '___EOS___']", "index": 145 }, { "content": "def GetRegisteredHelpFile(helpDesc):\n\t\"\"\"Given a description, return the registered entry.\n\t\"\"\"\n\ttry:\n\t\treturn GetRegistryDefaultValue(BuildDefaultPythonKey() + \"\\\\Help\\\\\" + helpDesc)\n\texcept win32api.error:\n\t\ttry:\n\t\t\treturn GetRegistryDefaultValue(BuildDefaultPythonKey() + \"\\\\Help\\\\\" + helpDesc, win32con.HKEY_CURRENT_USER)\n\t\texcept win32api.error:\n\t\t\tpass\n\treturn None", "metadata": "root.GetRegisteredHelpFile", "header": "['module', '___EOS___']", "index": 158 }, { "content": "def RegisterHelpFile(helpFile, helpPath, helpDesc = None, bCheckFile = 1):\n\t\"\"\"Register a help file in the registry.\n\t\n\t Note that this used to support writing to the Windows Help\n\t key, however this is no longer done, as it seems to be incompatible.\n\n helpFile -- the base name of the help file.\n helpPath -- the path to the help file\n helpDesc -- A description for the help file. If None, the helpFile param is used.\n bCheckFile -- A flag indicating if the file existence should be checked.\n\t\"\"\"\n\tif helpDesc is None: helpDesc = helpFile\n\tfullHelpFile = os.path.join(helpPath, helpFile)\n\ttry:\n\t\tif bCheckFile: os.stat(fullHelpFile)\n\texcept os.error:\n\t\traise ValueError, \"Help file does not exist\"\n\t# Now register with Python itself.\n\twin32api.RegSetValue(GetRootKey(), \n\t BuildDefaultPythonKey() + \"\\\\Help\\\\%s\" % helpDesc, win32con.REG_SZ, fullHelpFile)", "metadata": "root.RegisterHelpFile", "header": "['module', '___EOS___']", "index": 170 }, { "content": "def UnregisterHelpFile(helpFile, helpDesc = None):\n\t\"\"\"Unregister a help file in the registry.\n\n helpFile -- the base name of the help file.\n helpDesc -- A description for the help file. If None, the helpFile param is used.\n\t\"\"\"\n\tkey = win32api.RegOpenKey(win32con.HKEY_LOCAL_MACHINE, \"Software\\\\Microsoft\\\\Windows\\\\Help\", 0, win32con.KEY_ALL_ACCESS)\n\ttry:\n\t\ttry:\n\t\t\twin32api.RegDeleteValue(key, helpFile)\n\t\texcept win32api.error, (code, fn, desc):\n\t\t\timport winerror\n\t\t\tif code!=winerror.ERROR_FILE_NOT_FOUND:\n\t\t\t\traise win32api.error, (code, fn, desc)\n\tfinally:\n\t\twin32api.RegCloseKey(key)\n\t\n\t# Now de-register with Python itself.\n\tif helpDesc is None: helpDesc = helpFile\n\ttry:\n\t\twin32api.RegDeleteKey(GetRootKey(), \n\t\t BuildDefaultPythonKey() + \"\\\\Help\\\\%s\" % helpDesc)\t\n\texcept win32api.error, (code, fn, desc):\n\t\timport winerror\n\t\tif code!=winerror.ERROR_FILE_NOT_FOUND:\n\t\t\traise win32api.error, (code, fn, desc)", "metadata": "root.UnregisterHelpFile", "header": "['module', '___EOS___']", "index": 191 }, { "content": "def RegisterCoreDLL(coredllName = None):\n\t\"\"\"Registers the core DLL in the registry.\n\n If no params are passed, the name of the Python DLL used in \n the current process is used and registered.\n\t\"\"\"\n\tif coredllName is None:\n\t\tcoredllName = win32api.GetModuleFileName(sys.dllhandle)\n\t\t# must exist!\n\telse:\n\t\ttry:\n\t\t\tos.stat(coredllName)\n\t\texcept os.error:\n\t\t\tprint \"Warning: Registering non-existant core DLL %s\" % coredllName\n\n\thKey = win32api.RegCreateKey(GetRootKey() , BuildDefaultPythonKey())\n\ttry:\n\t\twin32api.RegSetValue(hKey, \"Dll\", win32con.REG_SZ, coredllName)\n\tfinally:\n\t\twin32api.RegCloseKey(hKey)\n\t# Lastly, setup the current version to point to me.\n\twin32api.RegSetValue(GetRootKey(), \"Software\\\\Python\\\\PythonCore\\\\CurrentVersion\", win32con.REG_SZ, sys.winver)", "metadata": "root.RegisterCoreDLL", "header": "['module', '___EOS___']", "index": 218 }, { "content": "def RegisterFileExtensions(defPyIcon, defPycIcon, runCommand):\n\t\"\"\"Register the core Python file extensions.\n\t\n\t defPyIcon -- The default icon to use for .py files, in 'fname,offset' format.\n\t defPycIcon -- The default icon to use for .pyc files, in 'fname,offset' format.\n\t runCommand -- The command line to use for running .py files\n\t\"\"\"\n\t# Register the file extensions.\n\tpythonFileId = RegistryIDPyFile\n\twin32api.RegSetValue(win32con.HKEY_CLASSES_ROOT , \".py\", win32con.REG_SZ, pythonFileId)\n\twin32api.RegSetValue(win32con.HKEY_CLASSES_ROOT , pythonFileId , win32con.REG_SZ, \"Python File\")\n\twin32api.RegSetValue(win32con.HKEY_CLASSES_ROOT , \"%s\\\\CLSID\" % pythonFileId , win32con.REG_SZ, CLSIDPyFile)\n\twin32api.RegSetValue(win32con.HKEY_CLASSES_ROOT , \"%s\\\\DefaultIcon\" % pythonFileId, win32con.REG_SZ, defPyIcon)\n\tbase = \"%s\\\\Shell\" % RegistryIDPyFile\n\twin32api.RegSetValue(win32con.HKEY_CLASSES_ROOT , base + \"\\\\Open\", win32con.REG_SZ, \"Run\")\n\twin32api.RegSetValue(win32con.HKEY_CLASSES_ROOT , base + \"\\\\Open\\\\Command\", win32con.REG_SZ, runCommand)\n\n\t# Register the .PYC.\n\tpythonFileId = RegistryIDPycFile\n\twin32api.RegSetValue(win32con.HKEY_CLASSES_ROOT , \".pyc\", win32con.REG_SZ, pythonFileId)\n\twin32api.RegSetValue(win32con.HKEY_CLASSES_ROOT , pythonFileId , win32con.REG_SZ, \"Compiled Python File\")\n\twin32api.RegSetValue(win32con.HKEY_CLASSES_ROOT , \"%s\\\\DefaultIcon\" % pythonFileId, win32con.REG_SZ, defPycIcon)\n\tbase = \"%s\\\\Shell\" % pythonFileId\n\twin32api.RegSetValue(win32con.HKEY_CLASSES_ROOT , base + \"\\\\Open\", win32con.REG_SZ, \"Run\")\n\twin32api.RegSetValue(win32con.HKEY_CLASSES_ROOT , base + \"\\\\Open\\\\Command\", win32con.REG_SZ, runCommand)", "metadata": "root.RegisterFileExtensions", "header": "['module', '___EOS___']", "index": 241 }, { "content": "def RegisterShellCommand(shellCommand, exeCommand, shellUserCommand = None):\n\t# Last param for \"Open\" - for a .py file to be executed by the command line\n\t# or shell execute (eg, just entering \"foo.py\"), the Command must be \"Open\",\n\t# but you may associate a different name for the right-click menu.\n\t# In our case, normally we have \"Open=Run\"\n\tbase = \"%s\\\\Shell\" % RegistryIDPyFile\n\tif shellUserCommand:\n\t\twin32api.RegSetValue(win32con.HKEY_CLASSES_ROOT , base + \"\\\\%s\" % (shellCommand), win32con.REG_SZ, shellUserCommand)\n\n\twin32api.RegSetValue(win32con.HKEY_CLASSES_ROOT , base + \"\\\\%s\\\\Command\" % (shellCommand), win32con.REG_SZ, exeCommand)", "metadata": "root.RegisterShellCommand", "header": "['module', '___EOS___']", "index": 267 }, { "content": "def RegisterDDECommand(shellCommand, ddeApp, ddeTopic, ddeCommand):\n\tbase = \"%s\\\\Shell\" % RegistryIDPyFile\n\twin32api.RegSetValue(win32con.HKEY_CLASSES_ROOT , base + \"\\\\%s\\\\ddeexec\" % (shellCommand), win32con.REG_SZ, ddeCommand)\n\twin32api.RegSetValue(win32con.HKEY_CLASSES_ROOT , base + \"\\\\%s\\\\ddeexec\\\\Application\" % (shellCommand), win32con.REG_SZ, ddeApp)\n\twin32api.RegSetValue(win32con.HKEY_CLASSES_ROOT , base + \"\\\\%s\\\\ddeexec\\\\Topic\" % (shellCommand), win32con.REG_SZ, ddeTopic)", "metadata": "root.RegisterDDECommand", "header": "['module', '___EOS___']", "index": 278 } ]
[]
[]
0
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "Some", " ", "registr", "y", " ", "help", "ers", "._", "\\u\\u\\uNL\\u\\u\\u_", "import_", "win32", "api_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "win32con_", "\\u\\u\\uNEWLINE\\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_", "error_", "=_", "\"", "Regi", "stry", " ", "utility", " ", "error", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "A", " ", ".", "py", " ", "file", " ", "has", " ", "a", " ", "CLS", "ID", " ", "associate", "d", " ", "with", " ", "it", " ", "(", "wh", "y", "?", " ", "-", " ", "dun", "no", "!)", "_", "\\u\\u\\uNL\\u\\u\\u_", "CLS", "ID", "Py", "File_", "=_", "\"{", "b5", "1d", "f0", "50", "-0", "6a", "e-1", "1c", "f", "-", "ad", "3b", "-", "524", "153", "4800", "01", "}\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "Regi", "stry", "ID", "Py", "File_", "=_", "\"", "Pyth", "on", ".", "File", "\"_", "#", " ", "The", " ", "registr", "y", " ", "\"", "file", " ", "type", "\"", " ", "of", " ", "a", " ", ".", "py", " ", "file_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Regi", "stry", "ID", "Py", "c", "File_", "=_", "\"", "Pyth", "on", ".", "Compiled", "File", "\"_", "#", " ", "The", " ", "registr", "y", " ", "\"", "file", " ", "type", "\"", " ", "of", " ", "a", " ", ".", "pyc", " ", "file_", "\\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\\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_", "Get", "Roo", "t", "Key_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "_", "\"\"\"", "Retrieve", "s", " ", "the", " ", "Regi", "stry", " ", "root", " ", "in", " ", "use", " ", "by", " ", "Pyth", "on", ".", "\\", "10", ";", "\t", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Win", "32", "s", " ", "no", " ", "long", "er", " ", "support", "ed", "/", "released", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "\t", "if", " ", "win32", "ui", ".", "Is", "Win", "32", "s", "():", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "\t", "\t", "return", " ", "win32", "con", ".", "HKEY", "\\u", "CLASSE", "S", "\\u", "ROOT_", "\\u\\u\\uNL\\u\\u\\u_", "#", "\t", "else", ":_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "win32con_", "._", "HKEY", "\\u", "LOCAL", "\\u", "MACHINE", "_", "\\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", "Regi", "stry", "Default", "Value_", "(_", "subkey", "_", ",_", "root", "key_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "_", "\"\"\"", "A", " ", "help", "er", " ", "to", " ", "return", " ", "the", " ", "default", " ", "value", " ", "for", " ", "a", " ", "key", " ", "in", " ", "the", " ", "registr", "y", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "root", "key_", "is_", "None_", ":_", "root", "key_", "=_", "Get", "Roo", "t", "Key_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "win32", "api_", "._", "Reg", "Query", "Value_", "(_", "root", "key_", ",_", "subkey", "_", ")_", "\\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", "Regi", "stry", "Default", "Value_", "(_", "sub", "Key_", ",_", "value_", ",_", "root", "key_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "_", "\"\"\"", "A", " ", "help", "er", " ", "to", " ", "set", " ", "the", " ", "default", " ", "value", " ", "for", " ", "a", " ", "key", " ", "in", " ", "the", " ", "registr", "y", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "types_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "root", "key_", "is_", "None_", ":_", "root", "key_", "=_", "Get", "Roo", "t", "Key_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "type_", "(_", "value_", ")_", "==_", "types_", "._", "String", "Type_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "type", "Id_", "=_", "win32con_", "._", "REG", "\\u", "SZ", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "type_", "(_", "value_", ")_", "==_", "types_", "._", "Int", "Type_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "type", "Id_", "=_", "win32con_", "._", "REG", "\\u", "DWORD_", "\\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_", "raise_", "Type", "Error_", ",_", "\"", "Value", " ", "must", " ", "be", " ", "string", " ", "or", " ", "integ", "er", " ", "-", " ", "was", " ", "pass", "ed", " ", "\"_", "+_", "str_", "(_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "win32", "api_", "._", "Reg", "Set", "Value_", "(_", "root", "key_", ",_", "sub", "Key_", ",_", "type", "Id_", ",_", "value_", ")_", "\\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", "Default", "Pyth", "on", "Key_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "_", "\"\"\"", "Build", "s", " ", "a", " ", "string", " ", "contain", "ing", " ", "the", " ", "path", " ", "to", " ", "the", " ", "current", " ", "registr", "y", " ", "key", ".", "\\", "10", ";", "\\", "10", ";", "\t ", "The", " ", "Pyth", "on", " ", "registr", "y", " ", "key", " ", "contain", "s", " ", "the", " ", "Pyth", "on", " ", "version", ".", " ", " ", "Thi", "s", " ", "function", "\\", "10", ";", "\t ", "use", "s", " ", "the", " ", "version", " ", "of", " ", "the", " ", "DLL", " ", "used", " ", "by", " ", "the", " ", "current", " ", "process", " ", "to", " ", "get", " ", "the", "\\", "10", ";", "\t ", "registr", "y", " ", "key", " ", "currentl", "y", " ", "in", " ", "use", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "\"", "Sof", "twa", "re", "\\\\\\\\", "Pyth", "on", "\\\\\\\\", "Pyth", "on", "Core", "\\\\\\\\\"_", "+_", "sys_", "._", "win", "ver_", "\\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", "App", "Path", "s", "Key_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "_", "return_", "\"", "Sof", "twa", "re", "\\\\\\\\", "Micro", "soft", "\\\\\\\\", "Window", "s", "\\\\\\\\", "Curr", "ent", "Version", "\\\\\\\\", "App", " ", "Path", "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_", "def_", "Register", "Pyth", "on", "Exe", "_", "(_", "exe", "Full", "Path_", ",_", "exe", "Alias_", "=_", "None_", ",_", "exe", "App", "Path_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "_", "\"\"\"", "Register", " ", "a", " ", ".", "exe", " ", "file", " ", "tha", "t", " ", "use", "s", " ", "Pyth", "on", ".", "\\", "10", ";", "\\", "10", ";", "\t ", "Registers", " ", "the", " ", ".", "exe", " ", "with", " ", "the", " ", "OS", ".", " ", " ", "Thi", "s", " ", "allow", "s", " ", "the", " ", "specified", " ", ".", "exe", " ", "to", "\\", "10", ";", "\t ", "be", " ", "run", " ", "from", " ", "the", " ", "command", "-", "line", " ", "or", " ", "start", " ", "button", " ", "with", "out", " ", "usi", "ng", " ", "the", " ", "full", " ", "path", ",", "\\", "10", ";", "\t ", "and", " ", "als", "o", " ", "to", " ", "setup", " ", "applica", "tion", " ", "specific", " ", "path", " ", "(", "ie", ",", " ", "os", ".", "environ", "['", "PATH", "'])", ".", "\\", "10", ";", "\\", "10", ";", "\t ", "Curr", "ent", "ly", " ", "the", " ", "exe", "App", "Path", " ", "is", " ", "not", " ", "support", "ed", ",", " ", "so", " ", "this", " ", "function", " ", "is", " ", "genera", "l", "\\", "10", ";", "\t ", "purpose", ",", " ", "and", " ", "not", " ", "specific", " ", "to", " ", "Pyth", "on", " ", "at", " ", "all", ".", " ", " ", "Late", "r", ",", " ", "exe", "App", "Path", " ", "may", " ", "provide", "\\", "10", ";", "\t ", "a", " ", "reason", "able", " ", "default", " ", "tha", "t", " ", "is", " ", "used", ".", "\\", "10", ";", "\\", "10", ";", "\t ", "exe", "Full", "Path", " ", "--", " ", "The", " ", "full", " ", "path", " ", "to", " ", "the", " ", ".", "exe", "\\", "10", ";", "\t ", "exe", "Ali", "as", " ", "=", " ", "Non", "e", " ", "--", " ", "An", " ", "alias", " ", "for", " ", "the", " ", "exe", " ", "-", " ", "if", " ", "none", ",", " ", "the", " ", "base", " ", "porti", "on", "\\", "10", ";", "\t ", " ", " ", "of", " ", "the", " ", "filename", " ", "is", " ", "used", ".", "\\", "10", ";", "\t ", "exe", "App", "Path", " ", "--", " ", "Not", " ", "support", "ed", ".", "\\", "10", ";", "\t", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Not", "e", " ", "-", " ", "Don", "t", " ", "work", " ", "on", " ", "win32", "s", " ", "(", "but", " ", "we", " ", "don", "t", " ", "care", " ", "any", "more", "!)", "_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "exe", "App", "Path_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "raise_", "error_", ",_", "\"", "Do", " ", "not", " ", "support", " ", "exe", "App", "Path", " ", "argu", "ment", " ", "currentl", "y", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "exe", "Alias_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "exe", "Alias_", "=_", "os_", "._", "path_", "._", "basename_", "(_", "exe", "Full", "Path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "win32", "api_", "._", "Reg", "Set", "Value_", "(_", "Get", "Roo", "t", "Key_", "(_", ")_", ",_", "Get", "App", "Path", "s", "Key_", "(_", ")_", "+_", "\"\\\\\\\\\"_", "+_", "exe", "Alias_", ",_", "win32con_", "._", "REG", "\\u", "SZ", "_", ",_", "exe", "Full", "Path_", ")_", "\\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", "Register", "ed", "Exe", "_", "(_", "exe", "Alias_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "_", "\"\"\"", "Get", " ", "a", " ", "register", "ed", " ", ".", "exe", "\\", "10", ";", "\t", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "win32", "api_", "._", "Reg", "Query", "Value_", "(_", "Get", "Roo", "t", "Key_", "(_", ")_", ",_", "Get", "App", "Path", "s", "Key_", "(_", ")_", "+_", "\"\\\\\\\\\"_", "+_", "exe", "Alias_", ")_", "\\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_", "Unregister", "Pyth", "on", "Exe", "_", "(_", "exe", "Alias_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "_", "\"\"\"", "Unregister", " ", "a", " ", ".", "exe", " ", "file", " ", "tha", "t", " ", "use", "s", " ", "Pyth", "on", ".", "\\", "10", ";", "\t", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "win32", "api_", "._", "Reg", "Delete", "Key_", "(_", "Get", "Roo", "t", "Key_", "(_", ")_", ",_", "Get", "App", "Path", "s", "Key_", "(_", ")_", "+_", "\"\\\\\\\\\"_", "+_", "exe", "Alias_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "win32", "api_", "._", "error_", ",_", "(_", "code_", ",_", "fn_", ",_", "details_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "import_", "wine", "rror_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "code_", "!=_", "wine", "rror_", "._", "ERROR", "\\u", "FILE", "\\u", "NOT", "\\u", "FOUND_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "raise_", "win32", "api_", "._", "error_", ",_", "(_", "code_", ",_", "fn_", ",_", "desc_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\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_", "Register", "Name", "d", "Path_", "(_", "name_", ",_", "path_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "_", "\"\"\"", "Register", " ", "a", " ", "named", " ", "path", " ", "-", " ", "ie", ",", " ", "a", " ", "named", " ", "Pyth", "on", "Path", " ", "entry", ".", "\\", "10", ";", "\t", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "key", "Str_", "=_", "Build", "Default", "Pyth", "on", "Key_", "(_", ")_", "+_", "\"\\\\\\\\", "Pyth", "on", "Path", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "name_", ":_", "key", "Str_", "=_", "key", "Str_", "+_", "\"\\\\\\\\\"_", "+_", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "win32", "api_", "._", "Reg", "Set", "Value_", "(_", "Get", "Roo", "t", "Key_", "(_", ")_", ",_", "key", "Str_", ",_", "win32con_", "._", "REG", "\\u", "SZ", "_", ",_", "path_", ")_", "\\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_", "Unregister", "Name", "d", "Path_", "(_", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "_", "\"\"\"", "Unregister", " ", "a", " ", "named", " ", "path", " ", "-", " ", "ie", ",", " ", "a", " ", "named", " ", "Pyth", "on", "Path", " ", "entry", ".", "\\", "10", ";", "\t", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "key", "Str_", "=_", "Build", "Default", "Pyth", "on", "Key_", "(_", ")_", "+_", "\"\\\\\\\\", "Pyth", "on", "Path", "\\\\\\\\\"_", "+_", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "win32", "api_", "._", "Reg", "Delete", "Key_", "(_", "Get", "Roo", "t", "Key_", "(_", ")_", ",_", "key", "Str_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "win32", "api_", "._", "error_", ",_", "(_", "code_", ",_", "fn_", ",_", "details_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "import_", "wine", "rror_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "code_", "!=_", "wine", "rror_", "._", "ERROR", "\\u", "FILE", "\\u", "NOT", "\\u", "FOUND_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "raise_", "win32", "api_", "._", "error_", ",_", "(_", "code_", ",_", "fn_", ",_", "desc_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\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", "Register", "ed", "Name", "d", "Path_", "(_", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "_", "\"\"\"", "Get", " ", "a", " ", "register", "ed", " ", "named", " ", "path", ",", " ", "or", " ", "Non", "e", " ", "if", " ", "it", " ", "doesnt", " ", "exist", ".", "\\", "10", ";", "\t", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "key", "Str_", "=_", "Build", "Default", "Pyth", "on", "Key_", "(_", ")_", "+_", "\"\\\\\\\\", "Pyth", "on", "Path", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "name_", ":_", "key", "Str_", "=_", "key", "Str_", "+_", "\"\\\\\\\\\"_", "+_", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "return_", "win32", "api_", "._", "Reg", "Query", "Value_", "(_", "Get", "Roo", "t", "Key_", "(_", ")_", ",_", "key", "Str_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "win32", "api_", "._", "error_", ",_", "(_", "code_", ",_", "fn_", ",_", "details_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "import_", "wine", "rror_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "code_", "!=_", "wine", "rror_", "._", "ERROR", "\\u", "FILE", "\\u", "NOT", "\\u", "FOUND_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "raise_", "win32", "api_", "._", "error_", ",_", "(_", "code_", ",_", "fn_", ",_", "details_", ")_", "\\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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Register", "Module_", "(_", "mod", "Name_", ",_", "mod", "Path_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "_", "\"\"\"", "Register", " ", "an", " ", "explicit", " ", "module", " ", "in", " ", "the", " ", "registr", "y", ".", " ", " ", "Thi", "s", " ", "force", "s", " ", "the", " ", "Pyth", "on", " ", "import", "\\", "10", ";", " ", " ", " ", "mechanism", " ", "to", " ", "locat", "e", " ", "this", " ", "module", " ", "direct", "ly", ",", " ", "with", "out", " ", "a", " ", "sys", ".", "path", " ", "search", ".", " ", " ", "Thu", "s", "\\", "10", ";", " ", " ", " ", "a", " ", "register", "ed", " ", "module", " ", "need", " ", "not", " ", "appear", " ", "in", " ", "sys", ".", "path", " ", "at", " ", "all", ".", "\\", "10", ";", "\\", "10", ";", "\t ", "mod", "Name", " ", "--", " ", "The", " ", "name", " ", "of", " ", "the", " ", "module", ",", " ", "as", " ", "used", " ", "by", " ", "import", ".", "\\", "10", ";", "\t ", "mod", "Path", " ", "--", " ", "The", " ", "full", " ", "path", " ", "and", " ", "file", " ", "name", " ", "of", " ", "the", " ", "module", ".", "\\", "10", ";", "\t", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "os_", "._", "stat_", "(_", "mod", "Path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "os_", "._", "error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "print_", "\"", "Warn", "ing", ":", " ", "Register", "ing", " ", "non", "-", "exist", "ant", " ", "module", " ", "%", "s", "\"_", "%_", "mod", "Path_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "win32", "api_", "._", "Reg", "Set", "Value_", "(_", "Get", "Roo", "t", "Key_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Build", "Default", "Pyth", "on", "Key_", "(_", ")_", "+_", "\"\\\\\\\\", "Modul", "es", "\\\\\\\\", "%", "s", "\"_", "%_", "mod", "Name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "win32con_", "._", "REG", "\\u", "SZ", "_", ",_", "mod", "Path_", ")_", "\\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_", "Unregister", "Module_", "(_", "mod", "Name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "_", "\"\"\"", "Unregister", " ", "an", " ", "explicit", " ", "module", " ", "in", " ", "the", " ", "registr", "y", ".", "\\", "10", ";", "\\", "10", ";", "\t ", "mod", "Name", " ", "--", " ", "The", " ", "name", " ", "of", " ", "the", " ", "module", ",", " ", "as", " ", "used", " ", "by", " ", "import", ".", "\\", "10", ";", "\t", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "win32", "api_", "._", "Reg", "Delete", "Key_", "(_", "Get", "Roo", "t", "Key_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Build", "Default", "Pyth", "on", "Key_", "(_", ")_", "+_", "\"\\\\\\\\", "Modul", "es", "\\\\\\\\", "%", "s", "\"_", "%_", "mod", "Name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "win32", "api_", "._", "error_", ",_", "(_", "code_", ",_", "fn_", ",_", "desc_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "import_", "wine", "rror_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "code_", "!=_", "wine", "rror_", "._", "ERROR", "\\u", "FILE", "\\u", "NOT", "\\u", "FOUND_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "raise_", "win32", "api_", "._", "error_", ",_", "(_", "code_", ",_", "fn_", ",_", "desc_", ")_", "\\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", "Register", "ed", "Help", "File_", "(_", "help", "Desc_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "_", "\"\"\"", "Give", "n", " ", "a", " ", "description", ",", " ", "return", " ", "the", " ", "register", "ed", " ", "entry", ".", "\\", "10", ";", "\t", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "return_", "Get", "Regi", "stry", "Default", "Value_", "(_", "Build", "Default", "Pyth", "on", "Key_", "(_", ")_", "+_", "\"\\\\\\\\", "Help", "\\\\\\\\\"_", "+_", "help", "Desc_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "win32", "api_", "._", "error_", ":_", "\\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_", "return_", "Get", "Regi", "stry", "Default", "Value_", "(_", "Build", "Default", "Pyth", "on", "Key_", "(_", ")_", "+_", "\"\\\\\\\\", "Help", "\\\\\\\\\"_", "+_", "help", "Desc_", ",_", "win32con_", "._", "HKEY", "\\u", "CURREN", "T", "\\u", "USER_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "win32", "api_", "._", "error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "pass_", "\\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_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Register", "Help", "File_", "(_", "help", "File_", ",_", "help", "Path_", ",_", "help", "Desc_", "=_", "None_", ",_", "b", "Check", "File_", "=_", "1_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "_", "\"\"\"", "Register", " ", "a", " ", "help", " ", "file", " ", "in", " ", "the", " ", "registr", "y", ".", "\\", "10", ";", "\t", "\\", "10", ";", "\t ", " ", " ", "Not", "e", " ", "tha", "t", " ", "this", " ", "used", " ", "to", " ", "support", " ", "writ", "ing", " ", "to", " ", "the", " ", "Window", "s", " ", "Help", "\\", "10", ";", "\t ", " ", " ", "key", ",", " ", "how", "ever", " ", "this", " ", "is", " ", "no", " ", "long", "er", " ", "don", "e", ",", " ", "as", " ", "it", " ", "see", "ms", " ", "to", " ", "be", " ", "incomp", "atible", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", "help", "File", " ", "--", " ", "the", " ", "base", " ", "name", " ", "of", " ", "the", " ", "help", " ", "file", ".", "\\", "10", ";", " ", " ", " ", "help", "Path", " ", "--", " ", "the", " ", "path", " ", "to", " ", "the", " ", "help", " ", "file", "\\", "10", ";", " ", " ", " ", "help", "Des", "c", " ", "--", " ", "A", " ", "description", " ", "for", " ", "the", " ", "help", " ", "file", ".", " ", " ", "If", " ", "Non", "e", ",", " ", "the", " ", "help", "File", " ", "param", " ", "is", " ", "used", ".", "\\", "10", ";", " ", " ", " ", "b", "Check", "File", " ", "--", " ", "A", " ", "flag", " ", "indicati", "ng", " ", "if", " ", "the", " ", "file", " ", "existence", " ", "shou", "ld", " ", "be", " ", "checke", "d", ".", "\\", "10", ";", "\t", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "help", "Desc_", "is_", "None_", ":_", "help", "Desc_", "=_", "help", "File_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "full", "Help", "File_", "=_", "os_", "._", "path_", "._", "join_", "(_", "help", "Path_", ",_", "help", "File_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "if_", "b", "Check", "File_", ":_", "os_", "._", "stat_", "(_", "full", "Help", "File_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "os_", "._", "error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "raise_", "Value", "Error_", ",_", "\"", "Help", " ", "file", " ", "doe", "s", " ", "not", " ", "exist", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "No", "w", " ", "register", " ", "with", " ", "Pyth", "on", " ", "its", "elf", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "win32", "api_", "._", "Reg", "Set", "Value_", "(_", "Get", "Roo", "t", "Key_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Build", "Default", "Pyth", "on", "Key_", "(_", ")_", "+_", "\"\\\\\\\\", "Help", "\\\\\\\\", "%", "s", "\"_", "%_", "help", "Desc_", ",_", "win32con_", "._", "REG", "\\u", "SZ", "_", ",_", "full", "Help", "File_", ")_", "\\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_", "Unregister", "Help", "File_", "(_", "help", "File_", ",_", "help", "Desc_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "_", "\"\"\"", "Unregister", " ", "a", " ", "help", " ", "file", " ", "in", " ", "the", " ", "registr", "y", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", "help", "File", " ", "--", " ", "the", " ", "base", " ", "name", " ", "of", " ", "the", " ", "help", " ", "file", ".", "\\", "10", ";", " ", " ", " ", "help", "Des", "c", " ", "--", " ", "A", " ", "description", " ", "for", " ", "the", " ", "help", " ", "file", ".", " ", " ", "If", " ", "Non", "e", ",", " ", "the", " ", "help", "File", " ", "param", " ", "is", " ", "used", ".", "\\", "10", ";", "\t", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "key_", "=_", "win32", "api_", "._", "Reg", "Open", "Key_", "(_", "win32con_", "._", "HKEY", "\\u", "LOCAL", "\\u", "MACHINE", "_", ",_", "\"", "Sof", "twa", "re", "\\\\\\\\", "Micro", "soft", "\\\\\\\\", "Window", "s", "\\\\\\\\", "Help", "\"_", ",_", "0_", ",_", "win32con_", "._", "KEY", "\\u", "ALL", "\\u", "ACCESS", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\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_", "win32", "api_", "._", "Reg", "Delete", "Value_", "(_", "key_", ",_", "help", "File_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "win32", "api_", "._", "error_", ",_", "(_", "code_", ",_", "fn_", ",_", "desc_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "import_", "wine", "rror_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "code_", "!=_", "wine", "rror_", "._", "ERROR", "\\u", "FILE", "\\u", "NOT", "\\u", "FOUND_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "raise_", "win32", "api_", "._", "error_", ",_", "(_", "code_", ",_", "fn_", ",_", "desc_", ")_", "\\u\\u\\uNEWLINE\\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\t", "\t_", "win32", "api_", "._", "Reg", "Clos", "e", "Key_", "(_", "key_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "No", "w", " ", "de", "-", "register", " ", "with", " ", "Pyth", "on", " ", "its", "elf", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "help", "Desc_", "is_", "None_", ":_", "help", "Desc_", "=_", "help", "File_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "win32", "api_", "._", "Reg", "Delete", "Key_", "(_", "Get", "Roo", "t", "Key_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Build", "Default", "Pyth", "on", "Key_", "(_", ")_", "+_", "\"\\\\\\\\", "Help", "\\\\\\\\", "%", "s", "\"_", "%_", "help", "Desc_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "win32", "api_", "._", "error_", ",_", "(_", "code_", ",_", "fn_", ",_", "desc_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "import_", "wine", "rror_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "code_", "!=_", "wine", "rror_", "._", "ERROR", "\\u", "FILE", "\\u", "NOT", "\\u", "FOUND_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "raise_", "win32", "api_", "._", "error_", ",_", "(_", "code_", ",_", "fn_", ",_", "desc_", ")_", "\\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_", "Register", "Core", "DLL", "_", "(_", "core", "dll", "Name_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "_", "\"\"\"", "Registers", " ", "the", " ", "core", " ", "DLL", " ", "in", " ", "the", " ", "registr", "y", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "If", " ", "no", " ", "params", " ", "are", " ", "pass", "ed", ",", " ", "the", " ", "name", " ", "of", " ", "the", " ", "Pyth", "on", " ", "DLL", " ", "used", " ", "in", " ", "\\", "10", ";", " ", " ", " ", " ", "the", " ", "current", " ", "process", " ", "is", " ", "used", " ", "and", " ", "register", "ed", ".", "\\", "10", ";", "\t", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "core", "dll", "Name_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "core", "dll", "Name_", "=_", "win32", "api_", "._", "Get", "Modul", "e", "File", "Name_", "(_", "sys_", "._", "dll", "handle_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "must", " ", "exist", "!", "_", "\\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\t", "\t_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "os_", "._", "stat_", "(_", "core", "dll", "Name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "os_", "._", "error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "print_", "\"", "Warn", "ing", ":", " ", "Register", "ing", " ", "non", "-", "exist", "ant", " ", "core", " ", "DLL", " ", "%", "s", "\"_", "%_", "core", "dll", "Name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "h", "Key_", "=_", "win32", "api_", "._", "Reg", "Creat", "e", "Key_", "(_", "Get", "Roo", "t", "Key_", "(_", ")_", ",_", "Build", "Default", "Pyth", "on", "Key_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "win32", "api_", "._", "Reg", "Set", "Value_", "(_", "h", "Key_", ",_", "\"", "Dl", "l", "\"_", ",_", "win32con_", "._", "REG", "\\u", "SZ", "_", ",_", "core", "dll", "Name_", ")_", "\\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\t", "\t_", "win32", "api_", "._", "Reg", "Clos", "e", "Key_", "(_", "h", "Key_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Las", "tl", "y", ",", " ", "setup", " ", "the", " ", "current", " ", "version", " ", "to", " ", "point", " ", "to", " ", "me", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "win32", "api_", "._", "Reg", "Set", "Value_", "(_", "Get", "Roo", "t", "Key_", "(_", ")_", ",_", "\"", "Sof", "twa", "re", "\\\\\\\\", "Pyth", "on", "\\\\\\\\", "Pyth", "on", "Core", "\\\\\\\\", "Curr", "ent", "Version", "\"_", ",_", "win32con_", "._", "REG", "\\u", "SZ", "_", ",_", "sys_", "._", "win", "ver_", ")_", "\\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_", "Register", "File", "Extensions_", "(_", "def", "Py", "Icon_", ",_", "def", "Py", "c", "Icon_", ",_", "run", "Command_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "_", "\"\"\"", "Register", " ", "the", " ", "core", " ", "Pyth", "on", " ", "file", " ", "extensi", "ons", ".", "\\", "10", ";", "\t", "\\", "10", ";", "\t ", "def", "Py", "Ico", "n", " ", "--", " ", "The", " ", "default", " ", "icon", " ", "to", " ", "use", " ", "for", " ", ".", "py", " ", "files", ",", " ", "in", " ", "'", "fname", ",", "offset", "'", " ", "format", ".", "\\", "10", ";", "\t ", "def", "Py", "c", "Ico", "n", " ", "--", " ", "The", " ", "default", " ", "icon", " ", "to", " ", "use", " ", "for", " ", ".", "pyc", " ", "files", ",", " ", "in", " ", "'", "fname", ",", "offset", "'", " ", "format", ".", "\\", "10", ";", "\t ", "run", "Command", " ", "--", " ", "The", " ", "command", " ", "line", " ", "to", " ", "use", " ", "for", " ", "runn", "ing", " ", ".", "py", " ", "files", "\\", "10", ";", "\t", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Register", " ", "the", " ", "file", " ", "extensi", "ons", "._", "\\u\\u\\uNL\\u\\u\\u_", "python", "File", "Id_", "=_", "Regi", "stry", "ID", "Py", "File_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "win32", "api_", "._", "Reg", "Set", "Value_", "(_", "win32con_", "._", "HKEY", "\\u", "CLASSE", "S", "\\u", "ROOT_", ",_", "\".", "py", "\"_", ",_", "win32con_", "._", "REG", "\\u", "SZ", "_", ",_", "python", "File", "Id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "win32", "api_", "._", "Reg", "Set", "Value_", "(_", "win32con_", "._", "HKEY", "\\u", "CLASSE", "S", "\\u", "ROOT_", ",_", "python", "File", "Id_", ",_", "win32con_", "._", "REG", "\\u", "SZ", "_", ",_", "\"", "Pyth", "on", " ", "File", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "win32", "api_", "._", "Reg", "Set", "Value_", "(_", "win32con_", "._", "HKEY", "\\u", "CLASSE", "S", "\\u", "ROOT_", ",_", "\"%", "s", "\\\\\\\\", "CLS", "ID", "\"_", "%_", "python", "File", "Id_", ",_", "win32con_", "._", "REG", "\\u", "SZ", "_", ",_", "CLS", "ID", "Py", "File_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "win32", "api_", "._", "Reg", "Set", "Value_", "(_", "win32con_", "._", "HKEY", "\\u", "CLASSE", "S", "\\u", "ROOT_", ",_", "\"%", "s", "\\\\\\\\", "Default", "Ico", "n", "\"_", "%_", "python", "File", "Id_", ",_", "win32con_", "._", "REG", "\\u", "SZ", "_", ",_", "def", "Py", "Icon_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "base_", "=_", "\"%", "s", "\\\\\\\\", "Shel", "l", "\"_", "%_", "Regi", "stry", "ID", "Py", "File_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "win32", "api_", "._", "Reg", "Set", "Value_", "(_", "win32con_", "._", "HKEY", "\\u", "CLASSE", "S", "\\u", "ROOT_", ",_", "base_", "+_", "\"\\\\\\\\", "Open", "\"_", ",_", "win32con_", "._", "REG", "\\u", "SZ", "_", ",_", "\"", "Run", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "win32", "api_", "._", "Reg", "Set", "Value_", "(_", "win32con_", "._", "HKEY", "\\u", "CLASSE", "S", "\\u", "ROOT_", ",_", "base_", "+_", "\"\\\\\\\\", "Open", "\\\\\\\\", "Command", "\"_", ",_", "win32con_", "._", "REG", "\\u", "SZ", "_", ",_", "run", "Command_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Register", " ", "the", " ", ".", "PY", "C", "._", "\\u\\u\\uNL\\u\\u\\u_", "python", "File", "Id_", "=_", "Regi", "stry", "ID", "Py", "c", "File_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "win32", "api_", "._", "Reg", "Set", "Value_", "(_", "win32con_", "._", "HKEY", "\\u", "CLASSE", "S", "\\u", "ROOT_", ",_", "\".", "pyc", "\"_", ",_", "win32con_", "._", "REG", "\\u", "SZ", "_", ",_", "python", "File", "Id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "win32", "api_", "._", "Reg", "Set", "Value_", "(_", "win32con_", "._", "HKEY", "\\u", "CLASSE", "S", "\\u", "ROOT_", ",_", "python", "File", "Id_", ",_", "win32con_", "._", "REG", "\\u", "SZ", "_", ",_", "\"", "Compiled", " ", "Pyth", "on", " ", "File", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "win32", "api_", "._", "Reg", "Set", "Value_", "(_", "win32con_", "._", "HKEY", "\\u", "CLASSE", "S", "\\u", "ROOT_", ",_", "\"%", "s", "\\\\\\\\", "Default", "Ico", "n", "\"_", "%_", "python", "File", "Id_", ",_", "win32con_", "._", "REG", "\\u", "SZ", "_", ",_", "def", "Py", "c", "Icon_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "base_", "=_", "\"%", "s", "\\\\\\\\", "Shel", "l", "\"_", "%_", "python", "File", "Id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "win32", "api_", "._", "Reg", "Set", "Value_", "(_", "win32con_", "._", "HKEY", "\\u", "CLASSE", "S", "\\u", "ROOT_", ",_", "base_", "+_", "\"\\\\\\\\", "Open", "\"_", ",_", "win32con_", "._", "REG", "\\u", "SZ", "_", ",_", "\"", "Run", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "win32", "api_", "._", "Reg", "Set", "Value_", "(_", "win32con_", "._", "HKEY", "\\u", "CLASSE", "S", "\\u", "ROOT_", ",_", "base_", "+_", "\"\\\\\\\\", "Open", "\\\\\\\\", "Command", "\"_", ",_", "win32con_", "._", "REG", "\\u", "SZ", "_", ",_", "run", "Command_", ")_", "\\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_", "Register", "Shel", "l", "Command_", "(_", "shell", "Command_", ",_", "exe", "Command_", ",_", "shell", "User", "Command_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Las", "t", " ", "param", " ", "for", " ", "\"", "Open", "\"", " ", "-", " ", "for", " ", "a", " ", ".", "py", " ", "file", " ", "to", " ", "be", " ", "executed", " ", "by", " ", "the", " ", "command", " ", "line_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "or", " ", "shell", " ", "execute", " ", "(", "eg", ",", " ", "just", " ", "entering", " ", "\"", "foo", ".", "py", "\")", ",", " ", "the", " ", "Command", " ", "must", " ", "be", " ", "\"", "Open", "\",", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "but", " ", "you", " ", "may", " ", "associate", " ", "a", " ", "different", " ", "name", " ", "for", " ", "the", " ", "right", "-", "click", " ", "menu", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "In", " ", "our", " ", "case", ",", " ", "normal", "ly", " ", "we", " ", "have", " ", "\"", "Open", "=", "Run", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "_", "base_", "=_", "\"%", "s", "\\\\\\\\", "Shel", "l", "\"_", "%_", "Regi", "stry", "ID", "Py", "File_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "shell", "User", "Command_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "win32", "api_", "._", "Reg", "Set", "Value_", "(_", "win32con_", "._", "HKEY", "\\u", "CLASSE", "S", "\\u", "ROOT_", ",_", "base_", "+_", "\"\\\\\\\\", "%", "s", "\"_", "%_", "(_", "shell", "Command_", ")_", ",_", "win32con_", "._", "REG", "\\u", "SZ", "_", ",_", "shell", "User", "Command_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "win32", "api_", "._", "Reg", "Set", "Value_", "(_", "win32con_", "._", "HKEY", "\\u", "CLASSE", "S", "\\u", "ROOT_", ",_", "base_", "+_", "\"\\\\\\\\", "%", "s", "\\\\\\\\", "Command", "\"_", "%_", "(_", "shell", "Command_", ")_", ",_", "win32con_", "._", "REG", "\\u", "SZ", "_", ",_", "exe", "Command_", ")_", "\\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_", "Register", "DD", "EC", "ommand", "_", "(_", "shell", "Command_", ",_", "dde", "App_", ",_", "dde", "Topic_", ",_", "dde", "Command_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "_", "base_", "=_", "\"%", "s", "\\\\\\\\", "Shel", "l", "\"_", "%_", "Regi", "stry", "ID", "Py", "File_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "win32", "api_", "._", "Reg", "Set", "Value_", "(_", "win32con_", "._", "HKEY", "\\u", "CLASSE", "S", "\\u", "ROOT_", ",_", "base_", "+_", "\"\\\\\\\\", "%", "s", "\\\\\\\\", "dde", "exec", "\"_", "%_", "(_", "shell", "Command_", ")_", ",_", "win32con_", "._", "REG", "\\u", "SZ", "_", ",_", "dde", "Command_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "win32", "api_", "._", "Reg", "Set", "Value_", "(_", "win32con_", "._", "HKEY", "\\u", "CLASSE", "S", "\\u", "ROOT_", ",_", "base_", "+_", "\"\\\\\\\\", "%", "s", "\\\\\\\\", "dde", "exec", "\\\\\\\\", "Applica", "tion", "\"_", "%_", "(_", "shell", "Command_", ")_", ",_", "win32con_", "._", "REG", "\\u", "SZ", "_", ",_", "dde", "App_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "win32", "api_", "._", "Reg", "Set", "Value_", "(_", "win32con_", "._", "HKEY", "\\u", "CLASSE", "S", "\\u", "ROOT_", ",_", "base_", "+_", "\"\\\\\\\\", "%", "s", "\\\\\\\\", "dde", "exec", "\\\\\\\\", "Topic", "\"_", "%_", "(_", "shell", "Command_", ")_", ",_", "win32con_", "._", "REG", "\\u", "SZ", "_", ",_", "dde", "Topic_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 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 ]
Unused local variable
nlloyd/SubliminalCollaborator/libs/twisted/internet/kqreactor.py
[ { "content": " def getWriters(self):\n \"\"\"\n Implement L{IReactorFDSet.getWriters}.\n \"\"\"\n return [self._selectables[fd] for fd in self._writes]", "metadata": "root.KQueueReactor.getWriters", "header": "['class', 'KQueueReactor', '(', 'posixbase', '.', 'PosixReactorBase', ')', ':', '___EOS___']", "index": 223 } ]
[]
[]
0
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "KQ", "ueue", "Reactor", "_", "(_", "posix", "base_", "._", "Posi", "x", "Reactor", "Base_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "Write", "rs_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Impl", "ement", " ", "L", "{", "IR", "eac", "tor", "FD", "Set", ".", "get", "Write", "rs", "}.", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "[_", "self_", "._", "\\u", "selectable", "s_", "[_", "fd_", "]_", "for_", "fd_", "in_", "self_", "._", "\\u", "writes", "_", "]_", "\\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 ]
Unused import
mnooner256/pyqrcode/tests/test_issue20.py
[ { "content": "# -*- coding: utf-8 -*-\n\"\"\"\\\nTests against <https://github.com/mnooner256/pyqrcode/issues/20>\n\"\"\"\nfrom __future__ import unicode_literals\nfrom nose.tools import ok_\nimport pyqrcode\n\n\n\n\n\n\n\n\nif __name__ == '__main__':\n import nose\n nose.core.runmodule()\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class KeepTrackOfClose():\n\n\n", "metadata": "root.KeepTrackOfClose", "header": "['module', '___EOS___']", "index": 9 }, { "content": " def __init__(self):\n self.is_closed = False", "metadata": "root.KeepTrackOfClose.__init__", "header": "['class', 'KeepTrackOfClose', '(', ')', ':', '___EOS___']", "index": 11 }, { "content": " def write(self, x):\n pass", "metadata": "root.KeepTrackOfClose.write", "header": "['class', 'KeepTrackOfClose', '(', ')', ':', '___EOS___']", "index": 14 }, { "content": " def close(self):\n self.is_closed = True", "metadata": "root.KeepTrackOfClose.close", "header": "['class', 'KeepTrackOfClose', '(', ')', ':', '___EOS___']", "index": 17 }, { "content": "def test_donot_close_png():\n code = pyqrcode.create('a')\n out = KeepTrackOfClose()\n code.png(out)\n ok_(not out.is_closed)", "metadata": "root.test_donot_close_png", "header": "['module', '___EOS___']", "index": 21 }, { "content": "def test_donot_close_svg():\n code = pyqrcode.create('a')\n out = KeepTrackOfClose()\n code.svg(out)\n ok_(not out.is_closed)", "metadata": "root.test_donot_close_svg", "header": "['module', '___EOS___']", "index": 28 } ]
[]
[]
0
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "-*-", " ", "codi", "ng", ":", " ", "utf", "-", "8", " ", "-*-", "_", "\\u\\u\\uNL\\u\\u\\u_", "\"\"\"", "\\\\", "\\", "10", ";", "Test", "s", " ", "against", " ", "<", "https", "://", "git", "hub", ".", "com", "/", "mn", "oon", "er2", "56", "/", "pyq", "rcode", "/", "issue", "s", "/", "20", ">", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "\\u\\u", "future\\u\\u_", "import_", "unicode", "\\u", "literals_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "nose_", "._", "tools_", "import_", "ok\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "pyq", "rcode", "_", "\\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_", "._", "core_", "._", "run", "module_", "(_", ")_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Keep", "Track", "Of", "Close_", "(_", ")_", ":_", "\\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_", "Keep", "Track", "Of", "Close_", "(_", ")_", ":_", "\\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_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "is", "\\u", "closed_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Keep", "Track", "Of", "Close_", "(_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "write_", "(_", "self_", ",_", "x_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Keep", "Track", "Of", "Close_", "(_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "close_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "is", "\\u", "closed_", "=_", "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_", "test\\u", "don", "ot", "\\u", "close", "\\u", "png_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "code_", "=_", "pyq", "rcode", "_", "._", "create_", "(_", "'", "a", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "out_", "=_", "Keep", "Track", "Of", "Close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "code_", "._", "png_", "(_", "out_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ok\\u_", "(_", "not_", "out_", "._", "is", "\\u", "closed_", ")_", "\\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", "don", "ot", "\\u", "close", "\\u", "svg_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "code_", "=_", "pyq", "rcode", "_", "._", "create_", "(_", "'", "a", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "out_", "=_", "Keep", "Track", "Of", "Close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "code_", "._", "svg_", "(_", "out_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ok\\u_", "(_", "not_", "out_", "._", "is", "\\u", "closed_", ")_", "\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2, 2 ]
Except block handles 'BaseException'
pytest-dev/pytest-bdd/pytest_bdd/scenario.py
[ { "content": "def find_argumented_step_fixture_name(name, type_, fixturemanager, request=None):\n \"\"\"Find argumented step fixture name.\"\"\"\n # happens to be that _arg2fixturedefs is changed during the iteration so we use a copy\n for fixturename, fixturedefs in list(fixturemanager._arg2fixturedefs.items()):\n for fixturedef in fixturedefs:\n parser = getattr(fixturedef.func, \"parser\", None)\n match = parser.is_matching(name) if parser else None\n if match:\n converters = getattr(fixturedef.func, \"converters\", {})\n for arg, value in parser.parse_arguments(name).items():\n if arg in converters:\n value = converters[arg](value)\n if request:\n inject_fixture(request, arg, value)\n parser_name = get_step_fixture_name(parser.name, type_)\n if request:\n try:\n request.getfuncargvalue(parser_name)\n except python.FixtureLookupError:\n continue\n return parser_name", "metadata": "root.find_argumented_step_fixture_name", "header": "['module', '___EOS___']", "index": 53 } ]
[]
[]
0
true
[ "[CLS]_", "Except", "_", "block_", "handles_", "'", "Base", "Except", "ion", "'_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "find", "\\u", "argu", "mented", "\\u", "step", "\\u", "fixture", "\\u", "name_", "(_", "name_", ",_", "type\\u_", ",_", "fixture", "manager_", ",_", "request_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Fin", "d", " ", "argu", "mented", " ", "step", " ", "fixture", " ", "name", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "happ", "ens", " ", "to", " ", "be", " ", "tha", "t", " ", "\\u", "arg", "2f", "ix", "ture", "def", "s", " ", "is", " ", "change", "d", " ", "dur", "ing", " ", "the", " ", "iterati", "on", " ", "so", " ", "we", " ", "use", " ", "a", " ", "copy_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "fixture", "name_", ",_", "fixture", "defs_", "in_", "list_", "(_", "fixture", "manager_", "._", "\\u", "arg", "2f", "ix", "ture", "defs_", "._", "items_", "(_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "fixture", "def_", "in_", "fixture", "defs_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "parser_", "=_", "getattr_", "(_", "fixture", "def_", "._", "func_", ",_", "\"", "parser", "\"_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "match_", "=_", "parser_", "._", "is", "\\u", "matching_", "(_", "name_", ")_", "if_", "parser_", "else_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "match_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "converters_", "=_", "getattr_", "(_", "fixture", "def_", "._", "func_", ",_", "\"", "converter", "s", "\"_", ",_", "{_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "arg_", ",_", "value_", "in_", "parser_", "._", "parse", "\\u", "arguments_", "(_", "name_", ")_", "._", "items_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "arg_", "in_", "converters_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "value_", "=_", "converters_", "[_", "arg_", "]_", "(_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "request_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "inject", "\\u", "fixture_", "(_", "request_", ",_", "arg_", ",_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "parser", "\\u", "name_", "=_", "get", "\\u", "step", "\\u", "fixture", "\\u", "name_", "(_", "parser_", "._", "name_", ",_", "type\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "request_", ":_", "\\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 ", " ", " _", "request_", "._", "getf", "unca", "rg", "value_", "(_", "parser", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "python_", "._", "Fix", "ture", "Look", "up", "Error_", ":_", "\\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_", "return_", "parser", "\\u", "name_", "\\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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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
ros/catkin/test/mock_resources/src/catkin_test/b/src/b/__init__.py
[ { "content": "import std_msgs.msg\nimport a.msg\nimport b.msg\ns = std_msgs.msg.String()\na = a.msg.AMsg()\nb = b.msg.BMsg()\n\nprint \"<<< b >>>\"\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[]
[]
0
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "import_", "std", "\\u", "msgs_", "._", "msg_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "a_", "._", "msg_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "b_", "._", "msg_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "s_", "=_", "std", "\\u", "msgs_", "._", "msg_", "._", "String_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "a_", "=_", "a_", "._", "msg_", "._", "AM", "sg_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "b_", "=_", "b_", "._", "msg_", "._", "BM", "sg_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "print_", "\"<<", "<", " ", "b", " ", ">>>", "\"_" ]
[ 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 ]
Unused import
disqus/nydus/tests/nydus/db/backends/redis/tests.py
[ { "content": "from __future__ import absolute_import\n\nfrom nydus.db import create_cluster\nfrom nydus.db.base import BaseCluster\nfrom nydus.db.backends.redis import Redis\nfrom nydus.db.promise import EventualCommand\nfrom nydus.testutils import BaseTest, fixture\nimport mock\nimport redis as redis_\n\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class RedisPipelineTest(BaseTest):\n\n # XXX: technically we're testing the Nydus map code, and not ours\n\n", "metadata": "root.RedisPipelineTest", "header": "['module', '___EOS___']", "index": 11 }, { "content": " @fixture\n def cluster(self):\n return create_cluster({\n 'backend': 'nydus.db.backends.redis.Redis',\n 'router': 'nydus.db.routers.keyvalue.PartitionRouter',\n 'hosts': {\n 0: {'db': 5},\n 1: {'db': 6},\n 2: {'db': 7},\n 3: {'db': 8},\n 4: {'db': 9},\n }\n })", "metadata": "root.RedisPipelineTest.cluster", "header": "['class', 'RedisPipelineTest', '(', 'BaseTest', ')', ':', '___EOS___']", "index": 12 }, { "content": " def test_pipelined_map(self):\n chars = ('a', 'b', 'c', 'd', 'e', 'f')\n with self.cluster.map() as conn:\n [conn.set(c, i) for i, c in enumerate(chars)]\n res = [conn.get(c) for c in chars]\n self.assertEqual(range(len(chars)), [int(r) for r in res])", "metadata": "root.RedisPipelineTest.test_pipelined_map", "header": "['class', 'RedisPipelineTest', '(', 'BaseTest', ')', ':', '___EOS___']", "index": 27 }, { "content": " def test_map_single_connection(self):\n with self.cluster.map() as conn:\n conn.set('a', '1')\n self.assertEquals(self.cluster.get('a'), '1')", "metadata": "root.RedisPipelineTest.test_map_single_connection", "header": "['class', 'RedisPipelineTest', '(', 'BaseTest', ')', ':', '___EOS___']", "index": 34 }, { "content": " def test_no_proxy_without_call_on_map(self):\n with self.cluster.map() as conn:\n result = conn.incr\n\n assert type(result) is EventualCommand\n assert not result.was_called()", "metadata": "root.RedisPipelineTest.test_no_proxy_without_call_on_map", "header": "['class', 'RedisPipelineTest', '(', 'BaseTest', ')', ':', '___EOS___']", "index": 39 }, { "content": "class RedisTest(BaseTest):\n\n\n\n\n\n\n\n\n\n", "metadata": "root.RedisTest", "header": "['module', '___EOS___']", "index": 47 }, { "content": " def setUp(self):\n self.redis = Redis(num=0, db=1)\n self.redis.flushdb()", "metadata": "root.RedisTest.setUp", "header": "['class', 'RedisTest', '(', 'BaseTest', ')', ':', '___EOS___']", "index": 49 }, { "content": " def test_proxy(self):\n self.assertEquals(self.redis.incr('RedisTest_proxy'), 1)", "metadata": "root.RedisTest.test_proxy", "header": "['class', 'RedisTest', '(', 'BaseTest', ')', ':', '___EOS___']", "index": 53 }, { "content": " def test_with_cluster(self):\n p = BaseCluster(\n backend=Redis,\n hosts={0: {'db': 1}},\n )\n self.assertEquals(p.incr('RedisTest_with_cluster'), 1)", "metadata": "root.RedisTest.test_with_cluster", "header": "['class', 'RedisTest', '(', 'BaseTest', ')', ':', '___EOS___']", "index": 56 }, { "content": " def test_provides_retryable_exceptions(self):\n self.assertEquals(Redis.retryable_exceptions, frozenset([redis_.ConnectionError, redis_.InvalidResponse]))", "metadata": "root.RedisTest.test_provides_retryable_exceptions", "header": "['class', 'RedisTest', '(', 'BaseTest', ')', ':', '___EOS___']", "index": 63 }, { "content": " def test_provides_identifier(self):\n self.assertEquals(self.redis.identifier, str(self.redis.identifier))", "metadata": "root.RedisTest.test_provides_identifier", "header": "['class', 'RedisTest', '(', 'BaseTest', ')', ':', '___EOS___']", "index": 66 }, { "content": " @mock.patch('nydus.db.backends.redis.StrictRedis')\n def test_client_instantiates_with_kwargs(self, RedisClient):\n client = Redis(num=0)\n client.connect()\n\n self.assertEquals(RedisClient.call_count, 1)\n RedisClient.assert_any_call(host='localhost', port=6379, db=0, socket_timeout=None,\n password=None, unix_socket_path=None)", "metadata": "root.RedisTest.test_client_instantiates_with_kwargs", "header": "['class', 'RedisTest', '(', 'BaseTest', ')', ':', '___EOS___']", "index": 69 }, { "content": " @mock.patch('nydus.db.backends.redis.StrictRedis')\n def test_map_does_pipeline(self, RedisClient):\n redis = create_cluster({\n 'backend': 'nydus.db.backends.redis.Redis',\n 'router': 'nydus.db.routers.keyvalue.PartitionRouter',\n 'hosts': {\n 0: {'db': 0},\n 1: {'db': 1},\n }\n })\n\n with redis.map() as conn:\n conn.set('a', 0)\n conn.set('d', 1)\n\n # ensure this was actually called through the pipeline\n self.assertFalse(RedisClient().set.called)\n\n self.assertEquals(RedisClient().pipeline.call_count, 2)\n RedisClient().pipeline.assert_called_with()\n\n self.assertEquals(RedisClient().pipeline().set.call_count, 2)\n RedisClient().pipeline().set.assert_any_call('a', 0)\n RedisClient().pipeline().set.assert_any_call('d', 1)\n\n self.assertEquals(RedisClient().pipeline().execute.call_count, 2)\n RedisClient().pipeline().execute.assert_called_with()", "metadata": "root.RedisTest.test_map_does_pipeline", "header": "['class', 'RedisTest', '(', 'BaseTest', ')', ':', '___EOS___']", "index": 78 }, { "content": " @mock.patch('nydus.db.backends.redis.StrictRedis')\n def test_map_only_runs_on_required_nodes(self, RedisClient):\n redis = create_cluster({\n 'engine': 'nydus.db.backends.redis.Redis',\n 'router': 'nydus.db.routers.keyvalue.PartitionRouter',\n 'hosts': {\n 0: {'db': 0},\n 1: {'db': 1},\n }\n })\n with redis.map() as conn:\n conn.set('a', 0)\n conn.set('b', 1)\n\n # ensure this was actually called through the pipeline\n self.assertFalse(RedisClient().set.called)\n\n self.assertEquals(RedisClient().pipeline.call_count, 1)\n RedisClient().pipeline.assert_called_with()\n\n self.assertEquals(RedisClient().pipeline().set.call_count, 2)\n RedisClient().pipeline().set.assert_any_call('a', 0)\n RedisClient().pipeline().set.assert_any_call('b', 1)\n\n self.assertEquals(RedisClient().pipeline().execute.call_count, 1)\n RedisClient().pipeline().execute.assert_called_with()", "metadata": "root.RedisTest.test_map_only_runs_on_required_nodes", "header": "['class', 'RedisTest', '(', 'BaseTest', ')', ':', '___EOS___']", "index": 106 }, { "content": " def test_normal_exceptions_dont_break_the_cluster(self):\n redis = create_cluster({\n 'engine': 'nydus.db.backends.redis.Redis',\n 'router': 'nydus.db.routers.keyvalue.ConsistentHashingRouter',\n 'hosts': {\n 0: {'db': 0},\n 1: {'db': 1},\n }\n })\n\n # Create a normal key\n redis.set('a', 0)\n\n with self.assertRaises(redis_.ResponseError):\n # We are going to preform an operation on a key that is not a set\n # This call *should* raise the actual Redis exception, and\n # not continue on to think the host is down.\n redis.scard('a')\n\n # This shouldn't raise a HostListExhausted exception\n redis.get('a')", "metadata": "root.RedisTest.test_normal_exceptions_dont_break_the_cluster", "header": "['class', 'RedisTest', '(', 'BaseTest', ')', ':', '___EOS___']", "index": 133 }, { "content": " def test_custom_identifier_specified(self):\n cluster_config = {\n 'backend': 'nydus.db.backends.redis.Redis',\n 'hosts': {\n 0: {'db': 0, 'identifier': 'redis://127.0.0.1:6379/0'},\n 1: {'db': 1, 'identifier': 'redis://127.0.0.1:6380/1'},\n },\n }\n\n redis = create_cluster(cluster_config)\n for idx in cluster_config['hosts'].keys():\n self.assertEquals(redis.hosts[idx].identifier,\n cluster_config['hosts'][idx]['identifier'])", "metadata": "root.RedisTest.test_custom_identifier_specified", "header": "['class', 'RedisTest', '(', 'BaseTest', ')', ':', '___EOS___']", "index": 155 } ]
[]
[]
0
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "from_", "\\u\\u", "future\\u\\u_", "import_", "abs", "olute", "\\u", "import_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "ny", "dus", "_", "._", "db_", "import_", "create", "\\u", "cluster_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "ny", "dus", "_", "._", "db_", "._", "base_", "import_", "Base", "Cluster_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "ny", "dus", "_", "._", "db_", "._", "backends_", "._", "redis_", "import_", "Redis_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "ny", "dus", "_", "._", "db_", "._", "promise", "_", "import_", "Event", "ual", "Command_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "ny", "dus", "_", "._", "testutils_", "import_", "Base", "Test_", ",_", "fixture_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "mock_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "redis_", "as_", "redis", "\\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_", "\\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_", "Red", "is", "Pipe", "line", "Test_", "(_", "Base", "Test_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "XX", "X", ":", " ", "technical", "ly", " ", "we", "'", "re", " ", "testi", "ng", " ", "the", " ", "Ny", "dus", " ", "map", " ", "code", ",", " ", "and", " ", "not", " ", "ours", "_", "\\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_", "Red", "is", "Pipe", "line", "Test_", "(_", "Base", "Test_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "@_", "fixture_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "cluster_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "create", "\\u", "cluster_", "(_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "back", "end", "'_", ":_", "'", "ny", "dus", ".", "db", ".", "back", "ends", ".", "redis", ".", "Red", "is", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "router", "'_", ":_", "'", "ny", "dus", ".", "db", ".", "router", "s", ".", "keyval", "ue", ".", "Partition", "Route", "r", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "host", "s", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "0_", ":_", "{_", "'", "db", "'_", ":_", "5_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "1_", ":_", "{_", "'", "db", "'_", ":_", "6_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "2_", ":_", "{_", "'", "db", "'_", ":_", "7_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "3_", ":_", "{_", "'", "db", "'_", ":_", "8_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "4_", ":_", "{_", "'", "db", "'_", ":_", "9_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Red", "is", "Pipe", "line", "Test_", "(_", "Base", "Test_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "pipeline", "d\\u", "map_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "chars_", "=_", "(_", "'", "a", "'_", ",_", "'", "b", "'_", ",_", "'", "c", "'_", ",_", "'", "d", "'_", ",_", "'", "e", "'_", ",_", "'", "f", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "self_", "._", "cluster_", "._", "map_", "(_", ")_", "as_", "conn_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "[_", "conn_", "._", "set_", "(_", "c_", ",_", "i_", ")_", "for_", "i_", ",_", "c_", "in_", "enumerate_", "(_", "chars_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res_", "=_", "[_", "conn_", "._", "get_", "(_", "c_", ")_", "for_", "c_", "in_", "chars_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "range_", "(_", "len_", "(_", "chars_", ")_", ")_", ",_", "[_", "int_", "(_", "r_", ")_", "for_", "r_", "in_", "res_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Red", "is", "Pipe", "line", "Test_", "(_", "Base", "Test_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "map", "\\u", "single", "\\u", "connection_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "with_", "self_", "._", "cluster_", "._", "map_", "(_", ")_", "as_", "conn_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "conn_", "._", "set_", "(_", "'", "a", "'_", ",_", "'", "1", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "self_", "._", "cluster_", "._", "get_", "(_", "'", "a", "'_", ")_", ",_", "'", "1", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Red", "is", "Pipe", "line", "Test_", "(_", "Base", "Test_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "no", "\\u", "proxy", "\\u", "with", "out", "\\u", "call", "\\u", "on", "\\u", "map_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "with_", "self_", "._", "cluster_", "._", "map_", "(_", ")_", "as_", "conn_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "=_", "conn_", "._", "incr_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "assert_", "type_", "(_", "result_", ")_", "is_", "Event", "ual", "Command_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "not_", "result_", "._", "was", "\\u", "called_", "(_", ")_", "\\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_", "Red", "is", "Test_", "(_", "Base", "Test_", ")_", ":_", "\\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_", "Red", "is", "Test_", "(_", "Base", "Test_", ")_", ":_", "\\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 ", " _", "self_", "._", "redis_", "=_", "Redis_", "(_", "num_", "=_", "0_", ",_", "db_", "=_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "redis_", "._", "flush", "db_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Red", "is", "Test_", "(_", "Base", "Test_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "proxy_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "Equals_", "(_", "self_", "._", "redis_", "._", "incr_", "(_", "'", "Red", "is", "Test", "\\u", "proxy", "'_", ")_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Red", "is", "Test_", "(_", "Base", "Test_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "with", "\\u", "cluster_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "p_", "=_", "Base", "Cluster_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "backend_", "=_", "Redis_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "hosts_", "=_", "{_", "0_", ":_", "{_", "'", "db", "'_", ":_", "1_", "}_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "p_", "._", "incr_", "(_", "'", "Red", "is", "Test", "\\u", "with", "\\u", "cluster", "'_", ")_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Red", "is", "Test_", "(_", "Base", "Test_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "provide", "s", "\\u", "retr", "yab", "le", "\\u", "exceptions_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "Equals_", "(_", "Redis_", "._", "retr", "yab", "le", "\\u", "exceptions_", ",_", "frozenset_", "(_", "[_", "redis", "\\u_", "._", "Connect", "ion", "Error_", ",_", "redis", "\\u_", "._", "Inva", "lid", "Response_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Red", "is", "Test_", "(_", "Base", "Test_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "provide", "s", "\\u", "identifier_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "Equals_", "(_", "self_", "._", "redis_", "._", "identifier_", ",_", "str_", "(_", "self_", "._", "redis_", "._", "identifier_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Red", "is", "Test_", "(_", "Base", "Test_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "mock_", "._", "patch_", "(_", "'", "ny", "dus", ".", "db", ".", "back", "ends", ".", "redis", ".", "Stri", "ct", "Red", "is", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "client", "\\u", "instantiate", "s", "\\u", "with", "\\u", "kwargs_", "(_", "self_", ",_", "Red", "is", "Client_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "client_", "=_", "Redis_", "(_", "num_", "=_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "client_", "._", "connect_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "Red", "is", "Client_", "._", "call", "\\u", "count_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Red", "is", "Client_", "._", "assert", "\\u", "any", "\\u", "call_", "(_", "host_", "=_", "'", "local", "host", "'_", ",_", "port_", "=_", "6379", "_", ",_", "db_", "=_", "0_", ",_", "socket", "\\u", "timeout_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "password_", "=_", "None_", ",_", "unix", "\\u", "socket", "\\u", "path_", "=_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Red", "is", "Test_", "(_", "Base", "Test_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "mock_", "._", "patch_", "(_", "'", "ny", "dus", ".", "db", ".", "back", "ends", ".", "redis", ".", "Stri", "ct", "Red", "is", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "map", "\\u", "doe", "s", "\\u", "pipeline_", "(_", "self_", ",_", "Red", "is", "Client_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "redis_", "=_", "create", "\\u", "cluster_", "(_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "back", "end", "'_", ":_", "'", "ny", "dus", ".", "db", ".", "back", "ends", ".", "redis", ".", "Red", "is", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "router", "'_", ":_", "'", "ny", "dus", ".", "db", ".", "router", "s", ".", "keyval", "ue", ".", "Partition", "Route", "r", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "host", "s", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "0_", ":_", "{_", "'", "db", "'_", ":_", "0_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "1_", ":_", "{_", "'", "db", "'_", ":_", "1_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "with_", "redis_", "._", "map_", "(_", ")_", "as_", "conn_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "conn_", "._", "set_", "(_", "'", "a", "'_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "conn_", "._", "set_", "(_", "'", "d", "'_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "ensure", " ", "this", " ", "was", " ", "actual", "ly", " ", "call", "ed", " ", "through", " ", "the", " ", "pipeline_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "Red", "is", "Client_", "(_", ")_", "._", "set_", "._", "called_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "Red", "is", "Client_", "(_", ")_", "._", "pipeline_", "._", "call", "\\u", "count_", ",_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Red", "is", "Client_", "(_", ")_", "._", "pipeline_", "._", "assert", "\\u", "call", "ed", "\\u", "with_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "Red", "is", "Client_", "(_", ")_", "._", "pipeline_", "(_", ")_", "._", "set_", "._", "call", "\\u", "count_", ",_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Red", "is", "Client_", "(_", ")_", "._", "pipeline_", "(_", ")_", "._", "set_", "._", "assert", "\\u", "any", "\\u", "call_", "(_", "'", "a", "'_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Red", "is", "Client_", "(_", ")_", "._", "pipeline_", "(_", ")_", "._", "set_", "._", "assert", "\\u", "any", "\\u", "call_", "(_", "'", "d", "'_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "Red", "is", "Client_", "(_", ")_", "._", "pipeline_", "(_", ")_", "._", "execute_", "._", "call", "\\u", "count_", ",_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Red", "is", "Client_", "(_", ")_", "._", "pipeline_", "(_", ")_", "._", "execute_", "._", "assert", "\\u", "call", "ed", "\\u", "with_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Red", "is", "Test_", "(_", "Base", "Test_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "mock_", "._", "patch_", "(_", "'", "ny", "dus", ".", "db", ".", "back", "ends", ".", "redis", ".", "Stri", "ct", "Red", "is", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "map", "\\u", "only", "\\u", "runs", "\\u", "on", "\\u", "require", "d\\u", "nodes_", "(_", "self_", ",_", "Red", "is", "Client_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "redis_", "=_", "create", "\\u", "cluster_", "(_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "eng", "ine", "'_", ":_", "'", "ny", "dus", ".", "db", ".", "back", "ends", ".", "redis", ".", "Red", "is", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "router", "'_", ":_", "'", "ny", "dus", ".", "db", ".", "router", "s", ".", "keyval", "ue", ".", "Partition", "Route", "r", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "host", "s", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "0_", ":_", "{_", "'", "db", "'_", ":_", "0_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "1_", ":_", "{_", "'", "db", "'_", ":_", "1_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "redis_", "._", "map_", "(_", ")_", "as_", "conn_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "conn_", "._", "set_", "(_", "'", "a", "'_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "conn_", "._", "set_", "(_", "'", "b", "'_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "ensure", " ", "this", " ", "was", " ", "actual", "ly", " ", "call", "ed", " ", "through", " ", "the", " ", "pipeline_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "Red", "is", "Client_", "(_", ")_", "._", "set_", "._", "called_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "Red", "is", "Client_", "(_", ")_", "._", "pipeline_", "._", "call", "\\u", "count_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Red", "is", "Client_", "(_", ")_", "._", "pipeline_", "._", "assert", "\\u", "call", "ed", "\\u", "with_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "Red", "is", "Client_", "(_", ")_", "._", "pipeline_", "(_", ")_", "._", "set_", "._", "call", "\\u", "count_", ",_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Red", "is", "Client_", "(_", ")_", "._", "pipeline_", "(_", ")_", "._", "set_", "._", "assert", "\\u", "any", "\\u", "call_", "(_", "'", "a", "'_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Red", "is", "Client_", "(_", ")_", "._", "pipeline_", "(_", ")_", "._", "set_", "._", "assert", "\\u", "any", "\\u", "call_", "(_", "'", "b", "'_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "Red", "is", "Client_", "(_", ")_", "._", "pipeline_", "(_", ")_", "._", "execute_", "._", "call", "\\u", "count_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Red", "is", "Client_", "(_", ")_", "._", "pipeline_", "(_", ")_", "._", "execute_", "._", "assert", "\\u", "call", "ed", "\\u", "with_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Red", "is", "Test_", "(_", "Base", "Test_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "normal", "\\u", "exception", "s", "\\u", "don", "t", "\\u", "break", "\\u", "the", "\\u", "cluster_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "redis_", "=_", "create", "\\u", "cluster_", "(_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "eng", "ine", "'_", ":_", "'", "ny", "dus", ".", "db", ".", "back", "ends", ".", "redis", ".", "Red", "is", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "router", "'_", ":_", "'", "ny", "dus", ".", "db", ".", "router", "s", ".", "keyval", "ue", ".", "Cons", "iste", "nt", "Hash", "ing", "Route", "r", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "host", "s", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "0_", ":_", "{_", "'", "db", "'_", ":_", "0_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "1_", ":_", "{_", "'", "db", "'_", ":_", "1_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Creat", "e", " ", "a", " ", "normal", " ", "key_", "\\u\\u\\uNL\\u\\u\\u_", "redis_", "._", "set_", "(_", "'", "a", "'_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "with_", "self_", "._", "assert", "Raises_", "(_", "redis", "\\u_", "._", "Respons", "e", "Error_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "We", " ", "are", " ", "goi", "ng", " ", "to", " ", "pref", "orm", " ", "an", " ", "operati", "on", " ", "on", " ", "a", " ", "key", " ", "tha", "t", " ", "is", " ", "not", " ", "a", " ", "set_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Thi", "s", " ", "call", " ", "*", "shou", "ld", "*", " ", "raise", " ", "the", " ", "actual", " ", "Red", "is", " ", "exception", ",", " ", "and_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "not", " ", "continue", " ", "on", " ", "to", " ", "think", " ", "the", " ", "host", " ", "is", " ", "down", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "redis_", "._", "scar", "d_", "(_", "'", "a", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Thi", "s", " ", "shou", "ld", "n", "'", "t", " ", "raise", " ", "a", " ", "Host", "List", "Ex", "haus", "ted", " ", "exception_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "redis_", "._", "get_", "(_", "'", "a", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Red", "is", "Test_", "(_", "Base", "Test_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "custom", "\\u", "identifi", "er", "\\u", "specified", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cluster", "\\u", "config_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "back", "end", "'_", ":_", "'", "ny", "dus", ".", "db", ".", "back", "ends", ".", "redis", ".", "Red", "is", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "host", "s", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "0_", ":_", "{_", "'", "db", "'_", ":_", "0_", ",_", "'", "identifi", "er", "'_", ":_", "'", "redis", "://", "127", ".0", ".0", ".1", ":", "6379", "/", "0", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "1_", ":_", "{_", "'", "db", "'_", ":_", "1_", ",_", "'", "identifi", "er", "'_", ":_", "'", "redis", "://", "127", ".0", ".0", ".1", ":", "638", "0", "/", "1", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "redis_", "=_", "create", "\\u", "cluster_", "(_", "cluster", "\\u", "config_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "idx_", "in_", "cluster", "\\u", "config_", "[_", "'", "host", "s", "'_", "]_", "._", "keys_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "Equals_", "(_", "redis_", "._", "hosts_", "[_", "idx_", "]_", "._", "identifier_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "cluster", "\\u", "config_", "[_", "'", "host", "s", "'_", "]_", "[_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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, 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 ]
Unused local variable
mila-udem/blocks-extras/blocks_extras/beam_search.py
[ { "content": " def search(self, input_values, eol_symbol, max_length,\n ignore_first_eol=False, as_arrays=False):\n \"\"\"Performs beam search.\n\n If the beam search was not compiled, it also compiles it.\n\n Parameters\n ----------\n input_values : dict\n A {:class:`~theano.Variable`: :class:`~numpy.ndarray`}\n dictionary of input values. The shapes should be\n the same as if you ran sampling with batch size equal to\n `beam_size`. Put it differently, the user is responsible\n for duplicaling inputs necessary number of times, because\n this class has insufficient information to do it properly.\n eol_symbol : int\n End of sequence symbol, the search stops when the symbol is\n generated.\n max_length : int\n Maximum sequence length, the search stops when it is reached.\n ignore_first_eol : bool, optional\n When ``True``, the end if sequence symbol generated at the\n first iteration are ignored. This useful when the sequence\n generator was trained on data with identical symbols for\n sequence start and sequence end.\n as_arrays : bool, optional\n If ``True``, the internal representation of search results\n is returned, that is a (matrix of outputs, mask,\n costs of all generated outputs) tuple.\n\n Returns\n -------\n outputs : list of lists of ints\n A list of the `beam_size` best sequences found in the order\n of decreasing likelihood.\n costs : list of floats\n A list of the costs for the `outputs`, where cost is the\n negative log-likelihood.\n\n \"\"\"\n if not self.compiled:\n self.compile()\n\n contexts, states, beam_size = self.compute_initial_states_and_contexts(\n input_values)\n\n # This array will store all generated outputs, including those from\n # previous step and those from already finished sequences.\n all_outputs = -1 * numpy.ones((1, beam_size), dtype='int64')\n all_masks = numpy.ones_like(all_outputs, dtype=config.floatX)\n all_costs = numpy.zeros_like(all_outputs, dtype=config.floatX)\n\n for i in range(max_length):\n if all_masks[-1].sum() == 0:\n break\n\n # We carefully hack values of the `scores` array to ensure\n # that all finished sequences are continued with `eos_symbol`.\n scores = self.compute_scores(contexts, states)\n next_costs = (all_costs[-1, :, None] -\n scores * all_masks[-1, :, None])\n (finished,) = numpy.where(all_masks[-1] == 0)\n next_costs[finished, :eol_symbol] = numpy.inf\n next_costs[finished, eol_symbol + 1:] = numpy.inf\n\n # The `i == 0` is required because at the first step the beam\n # size is effectively only 1.\n (indexes, outputs), chosen_costs = self._smallest(\n next_costs, beam_size, only_first_row=i == 0)\n\n # Rearrange everything\n for name in states:\n states[name] = states[name][indexes]\n all_outputs = all_outputs[:, indexes]\n all_masks = all_masks[:, indexes]\n all_costs = all_costs[:, indexes]\n\n # Record chosen output and compute new states\n states.update(self.compute_next_states(contexts, states, outputs))\n all_outputs = numpy.vstack([all_outputs, outputs[None, :]])\n all_costs = numpy.vstack([all_costs, chosen_costs[None, :]])\n mask = outputs != eol_symbol\n if ignore_first_eol and i == 0:\n mask[:] = 1\n all_masks = numpy.vstack([all_masks, mask[None, :]])\n\n all_outputs = all_outputs[1:]\n all_masks = all_masks[:-1]\n all_costs = all_costs[1:] - all_costs[:-1]\n result = all_outputs, all_masks, all_costs\n if as_arrays:\n return result\n return self.result_to_lists(result)", "metadata": "root.BeamSearch.search", "header": "['class', 'BeamSearch', '(', 'object', ')', ':', '___EOS___']", "index": 220 } ]
[]
[]
0
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "Beam", "Search_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "search_", "(_", "self_", ",_", "input", "\\u", "values_", ",_", "eol", "\\u", "symbol_", ",_", "max", "\\u", "length_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "ignore", "\\u", "first", "\\u", "eol_", "=_", "False_", ",_", "as", "\\u", "arrays_", "=_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Perform", "s", " ", "beam", " ", "search", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "If", " ", "the", " ", "beam", " ", "search", " ", "was", " ", "not", " ", "compile", "d", ",", " ", "it", " ", "als", "o", " ", "compile", "s", " ", "it", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Parameter", "s", "\\", "10", ";", " ", " ", " ", " ", "----------", "\\", "10", ";", " ", " ", " ", " ", "input", "\\u", "values", " ", ":", " ", "dict", "\\", "10", ";", " ", " ", " ", " ", "A", " ", "{:", "class", ":`", "~", "theano", ".", "Varia", "ble", "`", ":", " ", ":", "class", ":`", "~", "nump", "y", ".", "ndar", "ray", "`", "}", "\\", "10", ";", " ", " ", " ", " ", "dictionar", "y", " ", "of", " ", "input", " ", "values", ".", " ", "The", " ", "shape", "s", " ", "shou", "ld", " ", "be", "\\", "10", ";", " ", " ", " ", " ", "the", " ", "same", " ", "as", " ", "if", " ", "you", " ", "ran", " ", "samp", "ling", " ", "with", " ", "batch", " ", "size", " ", "equal", " ", "to", "\\", "10", ";", " ", " ", " ", " ", "`", "beam", "\\u", "size", "`.", " ", "Put", " ", "it", " ", "different", "ly", ",", " ", "the", " ", "user", " ", "is", " ", "responsib", "le", "\\", "10", ";", " ", " ", " ", " ", "for", " ", "dupl", "ical", "ing", " ", "inputs", " ", "necessar", "y", " ", "number", " ", "of", " ", "times", ",", " ", "bec", "aus", "e", "\\", "10", ";", " ", " ", " ", " ", "this", " ", "class", " ", "has", " ", "insuf", "ficient", " ", "informati", "on", " ", "to", " ", "do", " ", "it", " ", "proper", "ly", ".", "\\", "10", ";", " ", " ", " ", " ", "eol", "\\u", "symbol", " ", ":", " ", "int", "\\", "10", ";", " ", " ", " ", " ", "End", " ", "of", " ", "sequence", " ", "symbol", ",", " ", "the", " ", "search", " ", "stop", "s", " ", "whe", "n", " ", "the", " ", "symbol", " ", "is", "\\", "10", ";", " ", " ", " ", " ", "generat", "ed", ".", "\\", "10", ";", " ", " ", " ", " ", "max", "\\u", "length", " ", ":", " ", "int", "\\", "10", ";", " ", " ", " ", " ", "Maxim", "um", " ", "sequence", " ", "length", ",", " ", "the", " ", "search", " ", "stop", "s", " ", "whe", "n", " ", "it", " ", "is", " ", "reache", "d", ".", "\\", "10", ";", " ", " ", " ", " ", "ignore", "\\u", "first", "\\u", "eol", " ", ":", " ", "bool", ",", " ", "option", "al", "\\", "10", ";", " ", " ", " ", " ", "Whe", "n", " ", "``", "Tru", "e", "``", ",", " ", "the", " ", "end", " ", "if", " ", "sequence", " ", "symbol", " ", "generat", "ed", " ", "at", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "first", " ", "iterati", "on", " ", "are", " ", "ignore", "d", ".", " ", "Thi", "s", " ", "usef", "ul", " ", "whe", "n", " ", "the", " ", "sequence", "\\", "10", ";", " ", " ", " ", " ", "generat", "or", " ", "was", " ", "trained", " ", "on", " ", "data", " ", "with", " ", "identi", "cal", " ", "symbols", " ", "for", "\\", "10", ";", " ", " ", " ", " ", "sequence", " ", "start", " ", "and", " ", "sequence", " ", "end", ".", "\\", "10", ";", " ", " ", " ", " ", "as", "\\u", "arrays", " ", ":", " ", "bool", ",", " ", "option", "al", "\\", "10", ";", " ", " ", " ", " ", "If", " ", "``", "Tru", "e", "``", ",", " ", "the", " ", "internal", " ", "represent", "ation", " ", "of", " ", "search", " ", "results", "\\", "10", ";", " ", " ", " ", " ", "is", " ", "return", "ed", ",", " ", "tha", "t", " ", "is", " ", "a", " ", "(", "matrix", " ", "of", " ", "output", "s", ",", " ", "mask", ",", "\\", "10", ";", " ", " ", " ", " ", "cost", "s", " ", "of", " ", "all", " ", "generat", "ed", " ", "output", "s", ")", " ", "tuple", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", "\\", "10", ";", " ", " ", " ", " ", "-------", "\\", "10", ";", " ", " ", " ", " ", "output", "s", " ", ":", " ", "list", " ", "of", " ", "lists", " ", "of", " ", "ints", "\\", "10", ";", " ", " ", " ", " ", "A", " ", "list", " ", "of", " ", "the", " ", "`", "beam", "\\u", "size", "`", " ", "best", " ", "sequence", "s", " ", "found", " ", "in", " ", "the", " ", "order", "\\", "10", ";", " ", " ", " ", " ", "of", " ", "decre", "asin", "g", " ", "likelihood", ".", "\\", "10", ";", " ", " ", " ", " ", "cost", "s", " ", ":", " ", "list", " ", "of", " ", "float", "s", "\\", "10", ";", " ", " ", " ", " ", "A", " ", "list", " ", "of", " ", "the", " ", "cost", "s", " ", "for", " ", "the", " ", "`", "output", "s", "`", ",", " ", "where", " ", "cost", " ", "is", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "negati", "ve", " ", "log", "-", "likelihood", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "self_", "._", "compiled_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "compile_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "contexts_", ",_", "states_", ",_", "beam", "\\u", "size_", "=_", "self_", "._", "compute", "\\u", "initial", "\\u", "state", "s", "\\u", "and", "\\u", "contexts_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "input", "\\u", "values_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Thi", "s", " ", "array", " ", "will", " ", "store", " ", "all", " ", "generat", "ed", " ", "output", "s", ",", " ", "inclu", "ding", " ", "tho", "se", " ", "from_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "previ", "ous", " ", "step", " ", "and", " ", "tho", "se", " ", "from", " ", "alr", "ead", "y", " ", "finish", "ed", " ", "sequence", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "all", "\\u", "outputs_", "=_", "-_", "1_", "*_", "numpy_", "._", "ones_", "(_", "(_", "1_", ",_", "beam", "\\u", "size_", ")_", ",_", "dtype_", "=_", "'", "int", "64", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "all", "\\u", "masks_", "=_", "numpy_", "._", "ones", "\\u", "like_", "(_", "all", "\\u", "outputs_", ",_", "dtype_", "=_", "config_", "._", "float", "X_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "all", "\\u", "costs_", "=_", "numpy_", "._", "zero", "s", "\\u", "like_", "(_", "all", "\\u", "outputs_", ",_", "dtype_", "=_", "config_", "._", "float", "X_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "i_", "in_", "range_", "(_", "max", "\\u", "length_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "all", "\\u", "masks_", "[_", "-_", "1_", "]_", "._", "sum_", "(_", ")_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "We", " ", "care", "full", "y", " ", "hack", " ", "values", " ", "of", " ", "the", " ", "`", "score", "s", "`", " ", "array", " ", "to", " ", "ensure", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "tha", "t", " ", "all", " ", "finish", "ed", " ", "sequence", "s", " ", "are", " ", "continue", "d", " ", "with", " ", "`", "eos", "\\u", "symbol", "`.", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "scores_", "=_", "self_", "._", "compute", "\\u", "scores_", "(_", "contexts_", ",_", "states_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "next", "\\u", "costs_", "=_", "(_", "all", "\\u", "costs_", "[_", "-_", "1_", ",_", ":_", ",_", "None_", "]_", "-_", "\\u\\u\\uNL\\u\\u\\u_", "scores_", "*_", "all", "\\u", "masks_", "[_", "-_", "1_", ",_", ":_", ",_", "None_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "(_", "finished_", ",_", ")_", "=_", "numpy_", "._", "where_", "(_", "all", "\\u", "masks_", "[_", "-_", "1_", "]_", "==_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "next", "\\u", "costs_", "[_", "finished_", ",_", ":_", "eol", "\\u", "symbol_", "]_", "=_", "numpy_", "._", "inf_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "next", "\\u", "costs_", "[_", "finished_", ",_", "eol", "\\u", "symbol_", "+_", "1_", ":_", "]_", "=_", "numpy_", "._", "inf_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "`", "i", " ", "==", " ", "0", "`", " ", "is", " ", "require", "d", " ", "bec", "aus", "e", " ", "at", " ", "the", " ", "first", " ", "step", " ", "the", " ", "beam_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "size", " ", "is", " ", "effective", "ly", " ", "only", " ", "1._", "\\u\\u\\uNL\\u\\u\\u_", "(_", "indexes_", ",_", "outputs_", ")_", ",_", "chosen", "\\u", "costs_", "=_", "self_", "._", "\\u", "smallest", "_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "next", "\\u", "costs_", ",_", "beam", "\\u", "size_", ",_", "only", "\\u", "first", "\\u", "row_", "=_", "i_", "==_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Rea", "rra", "nge", " ", "every", "thing_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "name_", "in_", "states_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "states_", "[_", "name_", "]_", "=_", "states_", "[_", "name_", "]_", "[_", "indexes_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "all", "\\u", "outputs_", "=_", "all", "\\u", "outputs_", "[_", ":_", ",_", "indexes_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "all", "\\u", "masks_", "=_", "all", "\\u", "masks_", "[_", ":_", ",_", "indexes_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "all", "\\u", "costs_", "=_", "all", "\\u", "costs_", "[_", ":_", ",_", "indexes_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Record", " ", "chosen", " ", "output", " ", "and", " ", "compute", " ", "new", " ", "states_", "\\u\\u\\uNL\\u\\u\\u_", "states_", "._", "update_", "(_", "self_", "._", "compute", "\\u", "next", "\\u", "states_", "(_", "contexts_", ",_", "states_", ",_", "outputs_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "all", "\\u", "outputs_", "=_", "numpy_", "._", "vstack_", "(_", "[_", "all", "\\u", "outputs_", ",_", "outputs_", "[_", "None_", ",_", ":_", "]_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "all", "\\u", "costs_", "=_", "numpy_", "._", "vstack_", "(_", "[_", "all", "\\u", "costs_", ",_", "chosen", "\\u", "costs_", "[_", "None_", ",_", ":_", "]_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mask_", "=_", "outputs_", "!=_", "eol", "\\u", "symbol_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "ignore", "\\u", "first", "\\u", "eol_", "and_", "i_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "mask_", "[_", ":_", "]_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "all", "\\u", "masks_", "=_", "numpy_", "._", "vstack_", "(_", "[_", "all", "\\u", "masks_", ",_", "mask_", "[_", "None_", ",_", ":_", "]_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "all", "\\u", "outputs_", "=_", "all", "\\u", "outputs_", "[_", "1_", ":_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "all", "\\u", "masks_", "=_", "all", "\\u", "masks_", "[_", ":_", "-_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "all", "\\u", "costs_", "=_", "all", "\\u", "costs_", "[_", "1_", ":_", "]_", "-_", "all", "\\u", "costs_", "[_", ":_", "-_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "all", "\\u", "outputs_", ",_", "all", "\\u", "masks_", ",_", "all", "\\u", "costs_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "as", "\\u", "arrays_", ":_", "\\u\\u\\uNEWLINE\\u\\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 ]
Unused local variable
brack3t/django-braces/tests/factories.py
[ { "content": "class UserFactory(factory.django.DjangoModelFactory):\n username = factory.Sequence(lambda n: 'user{0}'.format(n))\n first_name = factory.Sequence(lambda n: 'John {0}'.format(n))\n last_name = factory.Sequence(lambda n: 'Doe {0}'.format(n))\n email = factory.Sequence(lambda n: 'user{0}@example.com'.format(n))\n password = 'asdf1234'\n\n class Meta:\n model = User\n abstract = False\n\n", "metadata": "root.UserFactory", "header": "['module', '___EOS___']", "index": 37 } ]
[]
[]
0
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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "User", "Factory_", "(_", "factory_", "._", "django_", "._", "Dj", "ang", "o", "Model", "Factory_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "username_", "=_", "factory_", "._", "Sequence_", "(_", "lambda_", "n_", ":_", "'", "user", "{", "0", "}'_", "._", "format_", "(_", "n_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "first", "\\u", "name_", "=_", "factory_", "._", "Sequence_", "(_", "lambda_", "n_", ":_", "'", "Joh", "n", " ", "{", "0", "}'_", "._", "format_", "(_", "n_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "last", "\\u", "name_", "=_", "factory_", "._", "Sequence_", "(_", "lambda_", "n_", ":_", "'", "Do", "e", " ", "{", "0", "}'_", "._", "format_", "(_", "n_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "email_", "=_", "factory_", "._", "Sequence_", "(_", "lambda_", "n_", ":_", "'", "user", "{", "0", "}@", "example", ".", "com", "'_", "._", "format_", "(_", "n_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "password_", "=_", "'", "asd", "f1", "234", "'_", "\\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 ", " _", "model_", "=_", "User_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "abstract_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\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 ]
Unnecessary pass
domrout/python-twitter-wrapper/twitterutils/twitter_worker.py
[ { "content": " def stop(self):\n self.stopped.set()\n \n # Try to empty the queue\n try:\n while self.tweetThreadQueue.get_nowait():\n self.tweetThreadQueue.task_done()\n except Empty:\n pass\n \n self.completionManager.stop()\n # Stop all worker threads\n for worker in self.workers:\n worker.stop()", "metadata": "root.TwitterDispatcher.stop", "header": "['class', 'TwitterDispatcher', '(', 'Thread', ')', ':', '___EOS___']", "index": 59 } ]
[]
[]
0
true
[ "[CLS]_", "Un", "necessar", "y_", "pass_", "[SEP]_", "class_", "Twit", "ter", "Dispatcher_", "(_", "Thread_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "stop_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "stopped_", "._", "set_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Tr", "y", " ", "to", " ", "empty", " ", "the", " ", "queue_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "while_", "self_", "._", "tweet", "Thread", "Queue_", "._", "get", "\\u", "nowait_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "tweet", "Thread", "Queue_", "._", "task", "\\u", "done_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Empty_", ":_", "\\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_", "self_", "._", "completion", "Manager_", "._", "stop_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Sto", "p", " ", "all", " ", "worker", " ", "threads_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "worker_", "in_", "self_", "._", "workers_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "worker_", "._", "stop_", "(_", ")_", "\\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 ]
Missing call to `__init__` during object initialization
AppScale/appscale/AppServer/lib/django-1.5/tests/modeltests/fixtures/models.py
[ { "content": "class SpyManager(PersonManager):", "metadata": "root.SpyManager", "header": "['module', '___EOS___']", "index": 79 } ]
[]
[]
0
false
[ "[CLS]_", "Missing", "_", "call_", "to_", " _", "`_", "\\u\\u", "init\\u\\u_", "`_", "dur", "ing_", "object_", "initialization", "_", "[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_", "Spy", "Manager_", "(_", "Person", "Manager_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 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 ]
Unreachable code
log2timeline/dfvfs/tests/file_io/ewf_file_io.py
[ { "content": " def setUp(self):\n \"\"\"Sets up the needed objects used throughout the test.\"\"\"\n super(SplitEWFFileTest, self).setUp()\n test_file = os.path.join(u'test_data', u'image-split.E01')\n path_spec = os_path_spec.OSPathSpec(location=test_file)\n self._ewf_path_spec = ewf_path_spec.EWFPathSpec(parent=path_spec)", "metadata": "root.SplitEWFFileTest.setUp", "header": "['class', 'SplitEWFFileTest', '(', 'test_lib', '.', 'PartitionedImageFileTestCase', ')', ':', '___EOS___']", "index": 50 } ]
[]
[]
0
true
[ "[CLS]_", "Unrea", "chab", "le_", "code_", "[SEP]_", "class_", "Split", "EW", "FF", "ile", "Test_", "(_", "test\\u", "lib_", "._", "Partition", "ed", "Image", "File", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "set", "Up_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Set", "s", " ", "up", " ", "the", " ", "need", "ed", " ", "object", "s", " ", "used", " ", "through", "out", " ", "the", " ", "test", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "super_", "(_", "Split", "EW", "FF", "ile", "Test_", ",_", "self_", ")_", "._", "set", "Up_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "test\\u", "file_", "=_", "os_", "._", "path_", "._", "join_", "(_", "u", "'", "test\\u", "data", "'_", ",_", "u", "'", "image", "-", "split", ".", "E0", "1", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "path", "\\u", "spec_", "=_", "os", "\\u", "path", "\\u", "spec_", "._", "OSP", "ath", "Spec_", "(_", "location_", "=_", "test\\u", "file_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "ew", "f", "\\u", "path", "\\u", "spec_", "=_", "ew", "f", "\\u", "path", "\\u", "spec_", "._", "EW", "FP", "ath", "Spec_", "(_", "parent_", "=_", "path", "\\u", "spec_", ")_", "\\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 ]
Except block handles 'BaseException'
saltstack/salt/salt/runners/winrepo.py
[ { "content": "def genrepo(opts=None, fire_event=True):\n '''\n Generate winrepo_cachefile based on sls files in the winrepo_dir\n\n opts\n Specify an alternate opts dict. Should not be used unless this function\n is imported into an execution module.\n\n fire_event : True\n Fire an event on failure. Only supported on the master.\n\n CLI Example:\n\n .. code-block:: bash\n\n salt-run winrepo.genrepo\n '''\n if opts is None:\n opts = __opts__\n\n if 'win_repo' in opts:\n salt.utils.warn_until(\n 'Nitrogen',\n 'The \\'win_repo\\' config option is deprecated, please use '\n '\\'winrepo_dir\\' instead.'\n )\n winrepo_dir = opts['win_repo']\n else:\n winrepo_dir = opts['winrepo_dir']\n\n if 'win_repo_mastercachefile' in opts:\n salt.utils.warn_until(\n 'Nitrogen',\n 'The \\'win_repo_mastercachefile\\' config option is deprecated, '\n 'please use \\'winrepo_cachefile\\' instead.'\n )\n winrepo_cachefile = opts['win_repo_mastercachefile']\n else:\n winrepo_cachefile = opts['winrepo_cachefile']\n\n ret = {}\n if not os.path.exists(winrepo_dir):\n os.makedirs(winrepo_dir)\n renderers = salt.loader.render(opts, __salt__)\n for root, _, files in os.walk(winrepo_dir):\n for name in files:\n if name.endswith('.sls'):\n try:\n config = salt.template.compile_template(\n os.path.join(root, name),\n renderers,\n opts['renderer'])\n except SaltRenderError as exc:\n log.debug(\n 'Failed to render {0}.'.format(\n os.path.join(root, name)\n )\n )\n log.debug('Error: {0}.'.format(exc))\n continue\n if config:\n revmap = {}\n for pkgname, versions in six.iteritems(config):\n log.debug(\n 'Compiling winrepo data for package \\'{0}\\''\n .format(pkgname)\n )\n for version, repodata in six.iteritems(versions):\n log.debug(\n 'Compiling winrepo data for {0} version {1}'\n .format(pkgname, version)\n )\n if not isinstance(version, six.string_types):\n config[pkgname][str(version)] = \\\n config[pkgname].pop(version)\n if not isinstance(repodata, dict):\n log.debug(\n 'Failed to compile {0}.'.format(\n os.path.join(root, name)\n )\n )\n if fire_event:\n msg = 'Failed to compile {0}.'.format(\n os.path.join(root, name)\n )\n try:\n __jid_event__.fire_event(\n {'error': msg},\n 'progress'\n )\n except NameError:\n log.error(\n 'Attempted to fire the an event '\n 'with the following error, but '\n 'event firing is not supported: '\n '{0}'.format(msg)\n )\n continue\n revmap[repodata['full_name']] = pkgname\n ret.setdefault('repo', {}).update(config)\n ret.setdefault('name_map', {}).update(revmap)\n with salt.utils.fopen(\n os.path.join(winrepo_dir, winrepo_cachefile), 'w+b') as repo:\n repo.write(msgpack.dumps(ret))\n return ret", "metadata": "root.genrepo", "header": "['module', '___EOS___']", "index": 34 } ]
[]
[]
0
true
[ "[CLS]_", "Except", "_", "block_", "handles_", "'", "Base", "Except", "ion", "'_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "genr", "epo", "_", "(_", "opts_", "=_", "None_", ",_", "fire", "\\u", "event_", "=_", "True_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "\\", "10", ";", " ", " ", " ", " ", "Generate", " ", "winr", "epo", "\\u", "cache", "file", " ", "based", " ", "on", " ", "sl", "s", " ", "files", " ", "in", " ", "the", " ", "winr", "epo", "\\u", "dir", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "opts", "\\", "10", ";", " ", " ", " ", " ", "Speci", "fy", " ", "an", " ", "alternat", "e", " ", "opts", " ", "dict", ".", " ", "Sho", "ul", "d", " ", "not", " ", "be", " ", "used", " ", "unl", "ess", " ", "this", " ", "function", "\\", "10", ";", " ", " ", " ", " ", "is", " ", "import", "ed", " ", "int", "o", " ", "an", " ", "executi", "on", " ", "module", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "fire", "\\u", "event", " ", ":", " ", "Tru", "e", "\\", "10", ";", " ", " ", " ", " ", "Fire", " ", "an", " ", "event", " ", "on", " ", "fail", "ure", ".", " ", "On", "ly", " ", "support", "ed", " ", "on", " ", "the", " ", "master", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "CLI", " ", "Exam", "ple", ":", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "..", " ", "code", "-", "block", "::", " ", "bash", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "salt", "-", "run", " ", "winr", "epo", ".", "genr", "epo", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "opts_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "opts_", "=_", "\\u\\u", "opts", "\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "'", "win", "\\u", "repo", "'_", "in_", "opts_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "salt_", "._", "utils_", "._", "warn", "\\u", "until_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Ni", "tro", "gen", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "The", " ", "\\\\'", "win", "\\u", "repo", "\\\\'", " ", "config", " ", "option", " ", "is", " ", "depre", "cated", ",", " ", "plea", "se", " ", "use", " ", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'\\\\'", "winr", "epo", "\\u", "dir", "\\\\'", " ", "inst", "ead", ".'_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "winr", "epo", "\\u", "dir_", "=_", "opts_", "[_", "'", "win", "\\u", "repo", "'_", "]_", "\\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 ", " _", "winr", "epo", "\\u", "dir_", "=_", "opts_", "[_", "'", "winr", "epo", "\\u", "dir", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "'", "win", "\\u", "repo", "\\u", "master", "cache", "file", "'_", "in_", "opts_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "salt_", "._", "utils_", "._", "warn", "\\u", "until_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Ni", "tro", "gen", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "The", " ", "\\\\'", "win", "\\u", "repo", "\\u", "master", "cache", "file", "\\\\'", " ", "config", " ", "option", " ", "is", " ", "depre", "cated", ",", " ", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'", "plea", "se", " ", "use", " ", "\\\\'", "winr", "epo", "\\u", "cache", "file", "\\\\'", " ", "inst", "ead", ".'_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "winr", "epo", "\\u", "cache", "file_", "=_", "opts_", "[_", "'", "win", "\\u", "repo", "\\u", "master", "cache", "file", "'_", "]_", "\\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 ", " _", "winr", "epo", "\\u", "cache", "file_", "=_", "opts_", "[_", "'", "winr", "epo", "\\u", "cache", "file", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "ret_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "os_", "._", "path_", "._", "exists_", "(_", "winr", "epo", "\\u", "dir_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "os_", "._", "makedirs_", "(_", "winr", "epo", "\\u", "dir_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "renderers_", "=_", "salt_", "._", "loader_", "._", "render_", "(_", "opts_", ",_", "\\u\\u", "salt\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "root_", ",_", "\\u_", ",_", "files_", "in_", "os_", "._", "walk_", "(_", "winr", "epo", "\\u", "dir_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "name_", "in_", "files_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "name_", "._", "endswith_", "(_", "'.", "sl", "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 ", " ", "_", "config_", "=_", "salt_", "._", "template_", "._", "compile", "\\u", "template_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "os_", "._", "path_", "._", "join_", "(_", "root_", ",_", "name_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "renderers_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "opts_", "[_", "'", "render", "er", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Sal", "t", "Render", "Error_", "as_", "exc_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "log_", "._", "debug_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Fail", "ed", " ", "to", " ", "render", " ", "{", "0", "}.'_", "._", "format_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "os_", "._", "path_", "._", "join_", "(_", "root_", ",_", "name_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "log_", "._", "debug_", "(_", "'", "Error", ":", " ", "{", "0", "}.'_", "._", "format_", "(_", "exc_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "config_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "rev", "map_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "pkgname_", ",_", "versions_", "in_", "six_", "._", "iteritems_", "(_", "config_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "log_", "._", "debug_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Compil", "ing", " ", "winr", "epo", " ", "data", " ", "for", " ", "package", " ", "\\\\'{", "0", "}\\\\'", "'_", "\\u\\u\\uNL\\u\\u\\u_", "._", "format_", "(_", "pkgname_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "version_", ",_", "repo", "data_", "in_", "six_", "._", "iteritems_", "(_", "versions_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "log_", "._", "debug_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Compil", "ing", " ", "winr", "epo", " ", "data", " ", "for", " ", "{", "0", "}", " ", "version", " ", "{", "1", "}'_", "\\u\\u\\uNL\\u\\u\\u_", "._", "format_", "(_", "pkgname_", ",_", "version_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "isinstance_", "(_", "version_", ",_", "six_", "._", "string", "\\u", "types_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "config_", "[_", "pkgname_", "]_", "[_", "str_", "(_", "version_", ")_", "]_", "=_", "config_", "[_", "pkgname_", "]_", "._", "pop_", "(_", "version_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "isinstance_", "(_", "repo", "data_", ",_", "dict_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "log_", "._", "debug_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Fail", "ed", " ", "to", " ", "compile", " ", "{", "0", "}.'_", "._", "format_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "os_", "._", "path_", "._", "join_", "(_", "root_", ",_", "name_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "fire", "\\u", "event_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "msg_", "=_", "'", "Fail", "ed", " ", "to", " ", "compile", " ", "{", "0", "}.'_", "._", "format_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "os_", "._", "path_", "._", "join_", "(_", "root_", ",_", "name_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " ", " _", "\\u\\u", "ji", "d\\u", "event", "\\u\\u_", "._", "fire", "\\u", "event_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "error", "'_", ":_", "msg_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "progress", "'_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Name", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " ", " _", "log_", "._", "error_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Atte", "mpte", "d", " ", "to", " ", "fire", " ", "the", " ", "an", " ", "event", " ", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'", "with", " ", "the", " ", "follow", "ing", " ", "error", ",", " ", "but", " ", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'", "event", " ", "fir", "ing", " ", "is", " ", "not", " ", "support", "ed", ":", " ", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'{", "0", "}'_", "._", "format_", "(_", "msg_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "rev", "map_", "[_", "repo", "data_", "[_", "'", "full", "\\u", "name", "'_", "]_", "]_", "=_", "pkgname_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "ret_", "._", "setdefault_", "(_", "'", "repo", "'_", ",_", "{_", "}_", ")_", "._", "update_", "(_", "config_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ret_", "._", "setdefault_", "(_", "'", "name", "\\u", "map", "'_", ",_", "{_", "}_", ")_", "._", "update_", "(_", "rev", "map_", ")_", "\\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_", "with_", "salt_", "._", "utils_", "._", "fop", "en_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "os_", "._", "path_", "._", "join_", "(_", "winr", "epo", "\\u", "dir_", ",_", "winr", "epo", "\\u", "cache", "file_", ")_", ",_", "'", "w", "+", "b", "'_", ")_", "as_", "repo_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "repo_", "._", "write_", "(_", "msgpack", "_", "._", "dumps_", "(_", "ret_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "ret_", "\\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,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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 ]
Unused import
ipython/ipython-py3k/docs/examples/newparallel/demo/throughput.py
[ { "content": "import time\nimport numpy as np\nfrom IPython import parallel\n\nnlist = list(map(int, np.logspace(2,9,16,base=2)))\nnlist2 = list(map(int, np.logspace(2,8,15,base=2)))\ntlist = list(map(int, np.logspace(7,22,16,base=2)))\nnt = 16\n\n\n\n\n\n ", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def wait(t=0):\n import time\n time.sleep(t)", "metadata": "root.wait", "header": "['module', '___EOS___']", "index": 8 }, { "content": "def echo(s=''):\n return s", "metadata": "root.echo", "header": "['module', '___EOS___']", "index": 12 }, { "content": "def time_throughput(nmessages, t=0, f=wait):\n client = parallel.Client()\n view = client.load_balanced_view()\n # do one ping before starting timing\n if f is echo:\n t = np.random.random(t/8)\n view.apply_sync(echo, '')\n client.spin()\n tic = time.time()\n for i in range(nmessages):\n view.apply(f, t)\n lap = time.time()\n client.wait()\n toc = time.time()\n return lap-tic, toc-tic", "metadata": "root.time_throughput", "header": "['module', '___EOS___']", "index": 15 }, { "content": "def do_runs(nlist,t=0,f=wait, trials=2, runner=time_throughput):\n A = np.zeros((len(nlist),2))\n for i,n in enumerate(nlist):\n t1 = t2 = 0\n for _ in range(trials):\n time.sleep(.25)\n ts = runner(n,t,f)\n t1 += ts[0]\n t2 += ts[1]\n t1 /= trials\n t2 /= trials\n A[i] = (t1,t2)\n A[i] = n/A[i]\n print(n,A[i])\n return A", "metadata": "root.do_runs", "header": "['module', '___EOS___']", "index": 32 }, { "content": "def do_echo(n,tlist=[0],f=echo, trials=2, runner=time_throughput):\n A = np.zeros((len(tlist),2))\n for i,t in enumerate(tlist):\n t1 = t2 = 0\n for _ in range(trials):\n time.sleep(.25)\n ts = runner(n,t,f)\n t1 += ts[0]\n t2 += ts[1]\n t1 /= trials\n t2 /= trials\n A[i] = (t1,t2)\n A[i] = n/A[i]\n print(t,A[i])\n return A", "metadata": "root.do_echo", "header": "['module', '___EOS___']", "index": 48 } ]
[]
[]
0
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "import_", "time_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "numpy_", "as_", "np_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "IP", "ython_", "import_", "parallel_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "nli", "st_", "=_", "list_", "(_", "map_", "(_", "int_", ",_", "np_", "._", "logs", "pace_", "(_", "2_", ",_", "9_", ",_", "16_", ",_", "base_", "=_", "2_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "nli", "st2", "_", "=_", "list_", "(_", "map_", "(_", "int_", ",_", "np_", "._", "logs", "pace_", "(_", "2_", ",_", "8_", ",_", "15_", ",_", "base_", "=_", "2_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tlist_", "=_", "list_", "(_", "map_", "(_", "int_", ",_", "np_", "._", "logs", "pace_", "(_", "7_", ",_", "22_", ",_", "16_", ",_", "base_", "=_", "2_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "nt_", "=_", "16_", "\\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\\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\\uNEWLINE\\u\\u\\u_", "def_", "wait_", "(_", "t_", "=_", "0_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "time_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "time_", "._", "sleep_", "(_", "t_", ")_", "\\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_", "echo_", "(_", "s_", "=_", "''_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "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_", "def_", "time", "\\u", "throughput", "_", "(_", "nme", "ssa", "ges_", ",_", "t_", "=_", "0_", ",_", "f_", "=_", "wait_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "client_", "=_", "parallel_", "._", "Client_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "view_", "=_", "client_", "._", "load", "\\u", "balance", "d\\u", "view_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "do", " ", "one", " ", "ping", " ", "bef", "ore", " ", "startin", "g", " ", "timing_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "f_", "is_", "echo_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "t_", "=_", "np_", "._", "random_", "._", "random_", "(_", "t_", "/_", "8_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "view_", "._", "appl", "y", "\\u", "sync_", "(_", "echo_", ",_", "''_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "client_", "._", "spin_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tic_", "=_", "time_", "._", "time_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", "in_", "range_", "(_", "nme", "ssa", "ges_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "view_", "._", "apply_", "(_", "f_", ",_", "t_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "lap", "_", "=_", "time_", "._", "time_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "client_", "._", "wait_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "toc_", "=_", "time_", "._", "time_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "lap", "_", "-_", "tic_", ",_", "toc_", "-_", "tic_", "\\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_", "do", "\\u", "runs_", "(_", "nli", "st_", ",_", "t_", "=_", "0_", ",_", "f_", "=_", "wait_", ",_", "trials_", "=_", "2_", ",_", "runner_", "=_", "time", "\\u", "throughput", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "A_", "=_", "np_", "._", "zeros_", "(_", "(_", "len_", "(_", "nli", "st_", ")_", ",_", "2_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", ",_", "n_", "in_", "enumerate_", "(_", "nli", "st_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "t1_", "=_", "t2_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "\\u_", "in_", "range_", "(_", "trials_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "time_", "._", "sleep_", "(_", ".25_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ts_", "=_", "runner_", "(_", "n_", ",_", "t_", ",_", "f_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t1_", "+=_", "ts_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t2_", "+=_", "ts_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "t1_", "/=_", "trials_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t2_", "/=_", "trials_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "A_", "[_", "i_", "]_", "=_", "(_", "t1_", ",_", "t2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "A_", "[_", "i_", "]_", "=_", "n_", "/_", "A_", "[_", "i_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "n_", ",_", "A_", "[_", "i_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "A_", "\\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_", "do", "\\u", "echo_", "(_", "n_", ",_", "tlist_", "=_", "[_", "0_", "]_", ",_", "f_", "=_", "echo_", ",_", "trials_", "=_", "2_", ",_", "runner_", "=_", "time", "\\u", "throughput", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "A_", "=_", "np_", "._", "zeros_", "(_", "(_", "len_", "(_", "tlist_", ")_", ",_", "2_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", ",_", "t_", "in_", "enumerate_", "(_", "tlist_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "t1_", "=_", "t2_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "\\u_", "in_", "range_", "(_", "trials_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "time_", "._", "sleep_", "(_", ".25_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ts_", "=_", "runner_", "(_", "n_", ",_", "t_", ",_", "f_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t1_", "+=_", "ts_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t2_", "+=_", "ts_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "t1_", "/=_", "trials_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t2_", "/=_", "trials_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "A_", "[_", "i_", "]_", "=_", "(_", "t1_", ",_", "t2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "A_", "[_", "i_", "]_", "=_", "n_", "/_", "A_", "[_", "i_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "t_", ",_", "A_", "[_", "i_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "A_" ]
[ 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, 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, 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 ]
Unused local variable
nephila/djangocms-installer/djangocms_installer/config/__init__.py
[ { "content": "def parse(args):\n \"\"\"\n Define the available arguments\n \"\"\"\n parser = argparse.ArgumentParser(description='Bootstrap a django CMS project.')\n parser.add_argument('--config-file', dest='config_file', action='store',\n default=None,\n help='Configuration file for djangocms_installer')\n parser.add_argument('--config-dump', dest='config_dump', action='store',\n default=None,\n help='Dump configuration file with current args')\n parser.add_argument('--db', '-d', dest='db', action=DbAction,\n default='sqlite://localhost/project.db',\n help='Database configuration (in URL format)')\n parser.add_argument('--i18n', '-i', dest='i18n', action='store',\n choices=('yes', 'no'),\n default='yes', help='Activate Django I18N / L10N setting')\n parser.add_argument('--use-tz', '-z', dest='use_timezone', action='store',\n choices=('yes', 'no'),\n default='yes', help='Activate Django timezone support')\n parser.add_argument('--timezone', '-t', dest='timezone',\n required=False, default=get_localzone(),\n action='store', help='Optional default time zone')\n parser.add_argument('--reversion', '-e', dest='reversion', action='store',\n choices=('yes', 'no'),\n default='yes', help='Install and configure reversion support')\n parser.add_argument('--permissions', dest='permissions', action='store',\n choices=('yes', 'no'),\n default='yes', help='Activate CMS permission management')\n parser.add_argument('--pip-options', help='pass custom pip options', default='')\n parser.add_argument('--languages', '-l', dest='languages', action='append',\n help='Languages to enable. Option can be provided multiple times, or as a '\n 'comma separated list. Only language codes supported by Django can '\n 'be used here')\n parser.add_argument('--django-version', dest='django_version', action='store',\n choices=data.DJANGO_SUPPORTED,\n default='stable', help='Django version')\n parser.add_argument('--cms-version', '-v', dest='cms_version', action='store',\n choices=data.DJANGOCMS_SUPPORTED,\n default='stable', help='django CMS version')\n parser.add_argument('--parent-dir', '-p', dest='project_directory',\n required=True, default='',\n action='store', help='Optional project parent directory')\n parser.add_argument('--bootstrap', dest='bootstrap', action='store',\n choices=('yes', 'no'),\n default='no', help='Use Twitter Bootstrap Theme')\n parser.add_argument('--templates', dest='templates', action='store',\n default='no', help='Use custom template set')\n parser.add_argument('--starting-page', dest='starting_page', action='store',\n choices=('yes', 'no'),\n default='no', help='Load a starting page with examples after installation '\n '(english language only). Choose \"no\" if you use a '\n 'custom template set.')\n parser.add_argument(dest='project_name', action='store',\n help='Name of the project to be created')\n\n # Command that lists the supported plugins in verbose description\n parser.add_argument('--list-plugins', '-P', dest='plugins', action='store_true',\n help='List plugins that\\'s going to be installed and configured')\n\n # Command that lists the supported plugins in verbose description\n parser.add_argument('--dump-requirements', '-R', dest='dump_reqs', action='store_true',\n help='It dumps the requirements that would be installed according to '\n 'parameters given. Together with --requirements argument is useful '\n 'for customizing the virtualenv')\n\n # Advanced options. These have a predefined default and are not managed\n # by config wizard.\n # parser.add_argument('--aldryn', '-a', dest='aldryn', action='store_true',\n # default=False, help='Use Aldryn-boilerplate as project template')\n parser.add_argument('--no-input', '-q', dest='noinput', action='store_true',\n default=False, help='Don\\'t run the configuration wizard, just use the '\n 'provided values')\n parser.add_argument('--verbose', dest='verbose', action='store_true',\n default=False, help='Be more verbose and don\\' swallow subcommands output')\n parser.add_argument('--apphooks-reload', '-k', dest='apphooks_reload', action='store_true',\n default=False, help='Use apphooks-reload middleware')\n parser.add_argument('--filer', '-f', dest='filer', action='store_true',\n default=False, help='Install and configure django-filer plugins')\n parser.add_argument('--requirements', '-r', dest='requirements_file', action='store',\n default=None, help='Externally defined requirements file')\n parser.add_argument('--no-deps', '-n', dest='no_deps', action='store_true',\n default=False, help='Don\\'t install package dependencies')\n parser.add_argument('--no-plugins', dest='no_plugins', action='store_true',\n default=False, help='Don\\'t install plugins')\n parser.add_argument('--no-db-driver', dest='no_db_driver', action='store_true',\n default=False, help='Don\\'t install database package')\n parser.add_argument('--no-sync', '-m', dest='no_sync', action='store_true',\n default=False, help='Don\\'t run syncdb / migrate after bootstrapping')\n parser.add_argument('--no-user', '-u', dest='no_user', action='store_true',\n default=False, help='Don\\'t create the admin user')\n parser.add_argument('--template', dest='template', action='store',\n default=None, help='The path or URL to load the django project '\n 'template from.')\n parser.add_argument('--extra-settings', dest='extra_settings', action='store',\n default=None, help='The path to an file that contains extra settings.')\n parser.add_argument('--skip-empty-check', '-s', dest='skip_project_dir_check',\n action='store_true',\n default=False, help='Skip the check if project dir is empty.')\n parser.add_argument('--utc', dest='utc',\n action='store_true',\n default=False, help='Use UTC timezone.')\n\n if '--utc' in args:\n for action in parser._positionals._actions:\n if action.dest == 'timezone':\n action.default = 'UTC'\n\n # If config_args then pretend that config args came from the stdin and run parser again.\n config_args = ini.parse_config_file(parser, args)\n args = parser.parse_args(config_args + args)\n\n # First of all, check if the project name is valid\n if not validate_project(args.project_name):\n sys.stderr.write(\n 'Project name \"{0}\" is not a valid app name, or it\\'s already defined. '\n 'Please use only numbers, letters and underscores.\\n'.format(args.project_name)\n )\n sys.exit(3)\n\n # Checking the given path\n setattr(args, 'project_path',\n os.path.join(args.project_directory, args.project_name).strip())\n if not args.skip_project_dir_check:\n if (os.path.exists(args.project_directory) and\n [path for path in os.listdir(args.project_directory) if not path.startswith('.')]):\n sys.stderr.write(\n 'Path \"{0}\" already exists and is not empty, please choose a different one\\n'\n 'If you want to use this path anyway use the -s flag to skip this check.\\n'\n ''.format(args.project_directory)\n )\n sys.exit(4)\n\n if os.path.exists(args.project_path):\n sys.stderr.write(\n 'Path \"{0}\" already exists, please choose a different one\\n'.format(args.project_path)\n )\n sys.exit(4)\n\n if args.config_dump and os.path.isfile(args.config_dump):\n sys.stdout.write(\n 'Cannot dump because given configuration file \"{0}\" exists.\\n'.format(args.config_dump)\n )\n sys.exit(8)\n\n args = _manage_args(parser, args)\n\n # what do we want here?!\n # * if languages are given as multiple arguments, let's use it as is\n # * if no languages are given, use a default and stop handling it further\n # * if languages are given as a comma-separated list, split it and use the\n # resulting list.\n\n if not args.languages:\n try:\n args.languages = [locale.getdefaultlocale()[0].split('_')[0]]\n except:\n args.languages = ['en']\n elif isinstance(args.languages, six.string_types):\n args.languages = args.languages.split(',')\n elif len(args.languages) == 1 and isinstance(args.languages[0], six.string_types):\n args.languages = args.languages[0].split(',')\n\n args.languages = [lang.strip().lower() for lang in args.languages]\n args.aldryn = False\n\n # Convert version to numeric format for easier checking\n try:\n django_version, cms_version = supported_versions(args.django_version,\n args.cms_version)\n except RuntimeError as e:\n sys.stderr.write(compat.unicode(e))\n sys.exit(6)\n if django_version is None:\n sys.stderr.write(\n 'Please provide a Django supported version: {0}. Only Major.Minor '\n 'version selector is accepted\\n'.format(', '.join(data.DJANGO_SUPPORTED))\n )\n sys.exit(6)\n if django_version is None:\n sys.stderr.write(\n 'Please provide a django CMS supported version: {0}. Only Major.Minor '\n 'version selector is accepted\\n'.format(', '.join(data.DJANGOCMS_SUPPORTED))\n )\n sys.exit(6)\n\n if not getattr(args, 'requirements_file'):\n requirements = []\n\n # django CMS version check\n if args.cms_version == 'develop':\n requirements.append(data.DJANGOCMS_DEVELOP)\n warnings.warn(data.VERSION_WARNING.format('develop', 'django CMS'))\n elif args.cms_version == 'rc': # pragma: no cover\n requirements.append(data.DJANGOCMS_RC)\n elif args.cms_version == 'beta': # pragma: no cover\n requirements.append(data.DJANGOCMS_BETA)\n warnings.warn(data.VERSION_WARNING.format('beta', 'django CMS'))\n else:\n requirements.append('django-cms<{0}'.format(less_than_version(cms_version)))\n\n if cms_version >= 3.2:\n requirements.extend(data.REQUIREMENTS['cms-3.2'])\n\n if not args.no_db_driver:\n requirements.append(args.db_driver)\n if not args.no_plugins:\n if args.filer:\n if cms_version >= 3:\n requirements.extend(data.REQUIREMENTS['plugins-common-master'])\n requirements.extend(data.REQUIREMENTS['filer'])\n elif cms_version >= 3:\n requirements.extend(data.REQUIREMENTS['plugins-common-master'])\n requirements.extend(data.REQUIREMENTS['plugins-basic-master'])\n if cms_version >= 3.2:\n requirements.extend(data.REQUIREMENTS['ckeditor-3.2'])\n if args.aldryn: # pragma: no cover\n requirements.extend(data.REQUIREMENTS['aldryn'])\n\n # Django version check\n if args.django_version == 'develop': # pragma: no cover\n requirements.append(data.DJANGO_DEVELOP)\n warnings.warn(data.VERSION_WARNING.format('develop', 'Django'))\n elif args.django_version == 'beta': # pragma: no cover\n requirements.append(data.DJANGO_BETA)\n warnings.warn(data.VERSION_WARNING.format('beta', 'Django'))\n else:\n requirements.append('Django<{0}'.format(less_than_version(django_version)))\n\n # Timezone support\n if args.use_timezone:\n requirements.append('pytz')\n\n # Requirements dependendent on django version\n # if django_version < 1.7:\n # requirements.extend(data.REQUIREMENTS['django-legacy'])\n\n # Reversion package version depends on django version\n if args.reversion:\n if django_version == 1.8:\n requirements.extend(data.REQUIREMENTS['reversion-django-1.8'])\n elif django_version == 1.9:\n requirements.extend(data.REQUIREMENTS['reversion-django-1.9'])\n\n requirements.extend(data.REQUIREMENTS['default'])\n\n setattr(args, 'requirements', '\\n'.join(requirements).strip())\n\n # Convenient shortcuts\n setattr(args, 'cms_version', cms_version)\n setattr(args, 'django_version', django_version)\n setattr(args, 'settings_path',\n os.path.join(args.project_directory, args.project_name, 'settings.py').strip())\n setattr(args, 'urlconf_path',\n os.path.join(args.project_directory, args.project_name, 'urls.py').strip())\n\n if args.config_dump:\n ini.dump_config_file(args.config_dump, args, parser)\n\n return args", "metadata": "root.parse", "header": "['module', '___EOS___']", "index": 18 } ]
[]
[]
0
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "parse_", "(_", "args_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Define", " ", "the", " ", "avail", "able", " ", "argu", "ment", "s", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "=_", "argparse_", "._", "Arg", "ument", "Parser_", "(_", "description_", "=_", "'", "Boots", "trap", " ", "a", " ", "django", " ", "CMS", " ", "project", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "._", "add", "\\u", "argument_", "(_", "'--", "config", "-", "file", "'_", ",_", "dest_", "=_", "'", "config", "\\u", "file", "'_", ",_", "action_", "=_", "'", "store", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "default_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "'", "Configura", "tion", " ", "file", " ", "for", " ", "django", "cms", "\\u", "installer", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "._", "add", "\\u", "argument_", "(_", "'--", "config", "-", "dump", "'_", ",_", "dest_", "=_", "'", "config", "\\u", "dump", "'_", ",_", "action_", "=_", "'", "store", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "default_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "'", "Dump", " ", "configura", "tion", " ", "file", " ", "with", " ", "current", " ", "args", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "._", "add", "\\u", "argument_", "(_", "'--", "db", "'_", ",_", "'-", "d", "'_", ",_", "dest_", "=_", "'", "db", "'_", ",_", "action_", "=_", "Db", "Action_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "default_", "=_", "'", "sql", "ite", "://", "local", "host", "/", "project", ".", "db", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "'", "Databa", "se", " ", "configura", "tion", " ", "(", "in", " ", "URL", " ", "format", ")'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "._", "add", "\\u", "argument_", "(_", "'--", "i18n", "'_", ",_", "'-", "i", "'_", ",_", "dest_", "=_", "'", "i18n", "'_", ",_", "action_", "=_", "'", "store", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "choices_", "=_", "(_", "'", "ye", "s", "'_", ",_", "'", "no", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "default_", "=_", "'", "ye", "s", "'_", ",_", "help_", "=_", "'", "Activat", "e", " ", "Dj", "ang", "o", " ", "I1", "8", "N", " ", "/", " ", "L1", "0", "N", " ", "setti", "ng", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "._", "add", "\\u", "argument_", "(_", "'--", "use", "-", "tz", "'_", ",_", "'-", "z", "'_", ",_", "dest_", "=_", "'", "use", "\\u", "timezon", "e", "'_", ",_", "action_", "=_", "'", "store", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "choices_", "=_", "(_", "'", "ye", "s", "'_", ",_", "'", "no", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "default_", "=_", "'", "ye", "s", "'_", ",_", "help_", "=_", "'", "Activat", "e", " ", "Dj", "ang", "o", " ", "timezon", "e", " ", "support", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "._", "add", "\\u", "argument_", "(_", "'--", "timezon", "e", "'_", ",_", "'-", "t", "'_", ",_", "dest_", "=_", "'", "timezon", "e", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "required_", "=_", "False_", ",_", "default_", "=_", "get", "\\u", "local", "zone_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "action_", "=_", "'", "store", "'_", ",_", "help_", "=_", "'", "Optio", "nal", " ", "default", " ", "time", " ", "zone", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "._", "add", "\\u", "argument_", "(_", "'--", "reversi", "on", "'_", ",_", "'-", "e", "'_", ",_", "dest_", "=_", "'", "reversi", "on", "'_", ",_", "action_", "=_", "'", "store", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "choices_", "=_", "(_", "'", "ye", "s", "'_", ",_", "'", "no", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "default_", "=_", "'", "ye", "s", "'_", ",_", "help_", "=_", "'", "Install", " ", "and", " ", "configur", "e", " ", "reversi", "on", " ", "support", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "._", "add", "\\u", "argument_", "(_", "'--", "permissi", "ons", "'_", ",_", "dest_", "=_", "'", "permissi", "ons", "'_", ",_", "action_", "=_", "'", "store", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "choices_", "=_", "(_", "'", "ye", "s", "'_", ",_", "'", "no", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "default_", "=_", "'", "ye", "s", "'_", ",_", "help_", "=_", "'", "Activat", "e", " ", "CMS", " ", "permissi", "on", " ", "manage", "ment", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "._", "add", "\\u", "argument_", "(_", "'--", "pip", "-", "options", "'_", ",_", "help_", "=_", "'", "pass", " ", "custom", " ", "pip", " ", "options", "'_", ",_", "default_", "=_", "''_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "._", "add", "\\u", "argument_", "(_", "'--", "language", "s", "'_", ",_", "'-", "l", "'_", ",_", "dest_", "=_", "'", "language", "s", "'_", ",_", "action_", "=_", "'", "append", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "'", "Languages", " ", "to", " ", "enable", ".", " ", "Optio", "n", " ", "can", " ", "be", " ", "provided", " ", "multiple", " ", "times", ",", " ", "or", " ", "as", " ", "a", " ", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'", "comma", " ", "separate", "d", " ", "list", ".", " ", "On", "ly", " ", "language", " ", "codes", " ", "support", "ed", " ", "by", " ", "Dj", "ang", "o", " ", "can", " ", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'", "be", " ", "used", " ", "here", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "._", "add", "\\u", "argument_", "(_", "'--", "django", "-", "version", "'_", ",_", "dest_", "=_", "'", "django", "\\u", "version", "'_", ",_", "action_", "=_", "'", "store", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "choices_", "=_", "data_", "._", "DJANGO", "\\u", "SUPPORTED", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "default_", "=_", "'", "stable", "'_", ",_", "help_", "=_", "'", "Dj", "ang", "o", " ", "version", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "._", "add", "\\u", "argument_", "(_", "'--", "cms", "-", "version", "'_", ",_", "'-", "v", "'_", ",_", "dest_", "=_", "'", "cms", "\\u", "version", "'_", ",_", "action_", "=_", "'", "store", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "choices_", "=_", "data_", "._", "DJANGO", "CMS", "\\u", "SUPPORTED", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "default_", "=_", "'", "stable", "'_", ",_", "help_", "=_", "'", "django", " ", "CMS", " ", "version", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "._", "add", "\\u", "argument_", "(_", "'--", "parent", "-", "dir", "'_", ",_", "'-", "p", "'_", ",_", "dest_", "=_", "'", "project", "\\u", "director", "y", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "required_", "=_", "True_", ",_", "default_", "=_", "''_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "action_", "=_", "'", "store", "'_", ",_", "help_", "=_", "'", "Optio", "nal", " ", "project", " ", "parent", " ", "director", "y", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "._", "add", "\\u", "argument_", "(_", "'--", "boots", "trap", "'_", ",_", "dest_", "=_", "'", "boots", "trap", "'_", ",_", "action_", "=_", "'", "store", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "choices_", "=_", "(_", "'", "ye", "s", "'_", ",_", "'", "no", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "default_", "=_", "'", "no", "'_", ",_", "help_", "=_", "'", "Us", "e", " ", "Twit", "ter", " ", "Boots", "trap", " ", "Them", "e", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "._", "add", "\\u", "argument_", "(_", "'--", "template", "s", "'_", ",_", "dest_", "=_", "'", "template", "s", "'_", ",_", "action_", "=_", "'", "store", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "default_", "=_", "'", "no", "'_", ",_", "help_", "=_", "'", "Us", "e", " ", "custom", " ", "template", " ", "set", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "._", "add", "\\u", "argument_", "(_", "'--", "startin", "g", "-", "page", "'_", ",_", "dest_", "=_", "'", "startin", "g", "\\u", "page", "'_", ",_", "action_", "=_", "'", "store", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "choices_", "=_", "(_", "'", "ye", "s", "'_", ",_", "'", "no", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "default_", "=_", "'", "no", "'_", ",_", "help_", "=_", "'", "Load", " ", "a", " ", "startin", "g", " ", "page", " ", "with", " ", "example", "s", " ", "after", " ", "installation", " ", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'(", "english", " ", "language", " ", "only", ").", " ", "Choose", " ", "\"", "no", "\"", " ", "if", " ", "you", " ", "use", " ", "a", " ", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'", "custom", " ", "template", " ", "set", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "._", "add", "\\u", "argument_", "(_", "dest_", "=_", "'", "project", "\\u", "name", "'_", ",_", "action_", "=_", "'", "store", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "'", "Name", " ", "of", " ", "the", " ", "project", " ", "to", " ", "be", " ", "created", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Command", " ", "tha", "t", " ", "lists", " ", "the", " ", "support", "ed", " ", "plugin", "s", " ", "in", " ", "verbo", "se", " ", "description_", "\\u\\u\\uNL\\u\\u\\u_", "parser_", "._", "add", "\\u", "argument_", "(_", "'--", "list", "-", "plugin", "s", "'_", ",_", "'-", "P", "'_", ",_", "dest_", "=_", "'", "plugin", "s", "'_", ",_", "action_", "=_", "'", "store", "\\u", "true", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "'", "List", " ", "plugin", "s", " ", "tha", "t", "\\\\'", "s", " ", "goi", "ng", " ", "to", " ", "be", " ", "install", "ed", " ", "and", " ", "configur", "ed", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Command", " ", "tha", "t", " ", "lists", " ", "the", " ", "support", "ed", " ", "plugin", "s", " ", "in", " ", "verbo", "se", " ", "description_", "\\u\\u\\uNL\\u\\u\\u_", "parser_", "._", "add", "\\u", "argument_", "(_", "'--", "dump", "-", "require", "ment", "s", "'_", ",_", "'-", "R", "'_", ",_", "dest_", "=_", "'", "dump", "\\u", "reqs", "'_", ",_", "action_", "=_", "'", "store", "\\u", "true", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "'", "It", " ", "dump", "s", " ", "the", " ", "require", "ment", "s", " ", "tha", "t", " ", "wou", "ld", " ", "be", " ", "install", "ed", " ", "according", " ", "to", " ", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'", "parameter", "s", " ", "give", "n", ".", " ", "Together", " ", "with", " ", "--", "require", "ment", "s", " ", "argu", "ment", " ", "is", " ", "usef", "ul", " ", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'", "for", " ", "customi", "zin", "g", " ", "the", " ", "virtualenv", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Advance", "d", " ", "options", ".", " ", "The", "se", " ", "have", " ", "a", " ", "prede", "fined", " ", "default", " ", "and", " ", "are", " ", "not", " ", "managed_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "by", " ", "config", " ", "wiz", "ard", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "parser", ".", "add", "\\u", "argu", "ment", "('", "--", "ald", "ry", "n", "',", " ", "'-", "a", "',", " ", "dest", "='", "ald", "ry", "n", "',", " ", "action", "='", "store", "\\u", "true", "',", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "default", "=", "Fal", "se", ",", " ", "help", "='", "Us", "e", " ", "Al", "dry", "n", "-", "boiler", "plate", " ", "as", " ", "project", " ", "template", "')", "_", "\\u\\u\\uNL\\u\\u\\u_", "parser_", "._", "add", "\\u", "argument_", "(_", "'--", "no", "-", "input", "'_", ",_", "'-", "q", "'_", ",_", "dest_", "=_", "'", "noin", "put", "'_", ",_", "action_", "=_", "'", "store", "\\u", "true", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "default_", "=_", "False_", ",_", "help_", "=_", "'", "Don", "\\\\'", "t", " ", "run", " ", "the", " ", "configura", "tion", " ", "wiz", "ard", ",", " ", "just", " ", "use", " ", "the", " ", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'", "provided", " ", "values", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "._", "add", "\\u", "argument_", "(_", "'--", "verbo", "se", "'_", ",_", "dest_", "=_", "'", "verbo", "se", "'_", ",_", "action_", "=_", "'", "store", "\\u", "true", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "default_", "=_", "False_", ",_", "help_", "=_", "'", "Be", " ", "more", " ", "verbo", "se", " ", "and", " ", "don", "\\\\'", " ", "swa", "llow", " ", "subcommands", " ", "output", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "._", "add", "\\u", "argument_", "(_", "'--", "app", "hook", "s", "-", "relo", "ad", "'_", ",_", "'-", "k", "'_", ",_", "dest_", "=_", "'", "app", "hook", "s", "\\u", "relo", "ad", "'_", ",_", "action_", "=_", "'", "store", "\\u", "true", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "default_", "=_", "False_", ",_", "help_", "=_", "'", "Us", "e", " ", "app", "hook", "s", "-", "relo", "ad", " ", "middle", "ware", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "._", "add", "\\u", "argument_", "(_", "'--", "filer", "'_", ",_", "'-", "f", "'_", ",_", "dest_", "=_", "'", "filer", "'_", ",_", "action_", "=_", "'", "store", "\\u", "true", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "default_", "=_", "False_", ",_", "help_", "=_", "'", "Install", " ", "and", " ", "configur", "e", " ", "django", "-", "filer", " ", "plugin", "s", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "._", "add", "\\u", "argument_", "(_", "'--", "require", "ment", "s", "'_", ",_", "'-", "r", "'_", ",_", "dest_", "=_", "'", "require", "ment", "s", "\\u", "file", "'_", ",_", "action_", "=_", "'", "store", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "default_", "=_", "None_", ",_", "help_", "=_", "'", "Exter", "nal", "ly", " ", "defin", "ed", " ", "require", "ment", "s", " ", "file", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "._", "add", "\\u", "argument_", "(_", "'--", "no", "-", "dep", "s", "'_", ",_", "'-", "n", "'_", ",_", "dest_", "=_", "'", "no", "\\u", "dep", "s", "'_", ",_", "action_", "=_", "'", "store", "\\u", "true", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "default_", "=_", "False_", ",_", "help_", "=_", "'", "Don", "\\\\'", "t", " ", "install", " ", "package", " ", "dependen", "cies", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "._", "add", "\\u", "argument_", "(_", "'--", "no", "-", "plugin", "s", "'_", ",_", "dest_", "=_", "'", "no", "\\u", "plugin", "s", "'_", ",_", "action_", "=_", "'", "store", "\\u", "true", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "default_", "=_", "False_", ",_", "help_", "=_", "'", "Don", "\\\\'", "t", " ", "install", " ", "plugin", "s", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "._", "add", "\\u", "argument_", "(_", "'--", "no", "-", "db", "-", "driver", "'_", ",_", "dest_", "=_", "'", "no", "\\u", "db", "\\u", "driver", "'_", ",_", "action_", "=_", "'", "store", "\\u", "true", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "default_", "=_", "False_", ",_", "help_", "=_", "'", "Don", "\\\\'", "t", " ", "install", " ", "databa", "se", " ", "package", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "._", "add", "\\u", "argument_", "(_", "'--", "no", "-", "sync", "'_", ",_", "'-", "m", "'_", ",_", "dest_", "=_", "'", "no", "\\u", "sync", "'_", ",_", "action_", "=_", "'", "store", "\\u", "true", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "default_", "=_", "False_", ",_", "help_", "=_", "'", "Don", "\\\\'", "t", " ", "run", " ", "sync", "db", " ", "/", " ", "migr", "ate", " ", "after", " ", "bootstrapp", "ing", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "._", "add", "\\u", "argument_", "(_", "'--", "no", "-", "user", "'_", ",_", "'-", "u", "'_", ",_", "dest_", "=_", "'", "no", "\\u", "user", "'_", ",_", "action_", "=_", "'", "store", "\\u", "true", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "default_", "=_", "False_", ",_", "help_", "=_", "'", "Don", "\\\\'", "t", " ", "create", " ", "the", " ", "admin", " ", "user", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "._", "add", "\\u", "argument_", "(_", "'--", "template", "'_", ",_", "dest_", "=_", "'", "template", "'_", ",_", "action_", "=_", "'", "store", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "default_", "=_", "None_", ",_", "help_", "=_", "'", "The", " ", "path", " ", "or", " ", "URL", " ", "to", " ", "load", " ", "the", " ", "django", " ", "project", " ", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'", "template", " ", "from", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "._", "add", "\\u", "argument_", "(_", "'--", "extra", "-", "settings", "'_", ",_", "dest_", "=_", "'", "extra", "\\u", "settings", "'_", ",_", "action_", "=_", "'", "store", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "default_", "=_", "None_", ",_", "help_", "=_", "'", "The", " ", "path", " ", "to", " ", "an", " ", "file", " ", "tha", "t", " ", "contain", "s", " ", "extra", " ", "settings", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "._", "add", "\\u", "argument_", "(_", "'--", "skip", "-", "empty", "-", "check", "'_", ",_", "'-", "s", "'_", ",_", "dest_", "=_", "'", "skip", "\\u", "project", "\\u", "dir\\u", "check", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "action_", "=_", "'", "store", "\\u", "true", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "default_", "=_", "False_", ",_", "help_", "=_", "'", "Ski", "p", " ", "the", " ", "check", " ", "if", " ", "project", " ", "dir", " ", "is", " ", "empty", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "._", "add", "\\u", "argument_", "(_", "'--", "utc", "'_", ",_", "dest_", "=_", "'", "utc", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "action_", "=_", "'", "store", "\\u", "true", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "default_", "=_", "False_", ",_", "help_", "=_", "'", "Us", "e", " ", "UT", "C", " ", "timezon", "e", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "'--", "utc", "'_", "in_", "args_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "action_", "in_", "parser_", "._", "\\u", "positional", "s_", "._", "\\u", "actions_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "action_", "._", "dest_", "==_", "'", "timezon", "e", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "action_", "._", "default_", "=_", "'", "UT", "C", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "config", "\\u", "args", " ", "then", " ", "prete", "nd", " ", "tha", "t", " ", "config", " ", "args", " ", "came", " ", "from", " ", "the", " ", "std", "in", " ", "and", " ", "run", " ", "parser", " ", "again", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "config", "\\u", "args_", "=_", "ini_", "._", "parse", "\\u", "config", "\\u", "file_", "(_", "parser_", ",_", "args_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "args_", "=_", "parser_", "._", "parse", "\\u", "args_", "(_", "config", "\\u", "args_", "+_", "args_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Fi", "rst", " ", "of", " ", "all", ",", " ", "check", " ", "if", " ", "the", " ", "project", " ", "name", " ", "is", " ", "valid_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "validat", "e\\u", "project_", "(_", "args_", "._", "project", "\\u", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sys_", "._", "stderr_", "._", "write_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Project", " ", "name", " ", "\"{", "0", "}\"", " ", "is", " ", "not", " ", "a", " ", "valid", " ", "app", " ", "name", ",", " ", "or", " ", "it", "\\\\'", "s", " ", "alr", "ead", "y", " ", "defin", "ed", ".", " ", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Ple", "ase", " ", "use", " ", "only", " ", "numbers", ",", " ", "letter", "s", " ", "and", " ", "underscore", "s", ".\\\\", "n", "'_", "._", "format_", "(_", "args_", "._", "project", "\\u", "name_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "exit_", "(_", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Check", "ing", " ", "the", " ", "give", "n", " ", "path_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "setattr_", "(_", "args_", ",_", "'", "project", "\\u", "path", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "os_", "._", "path_", "._", "join_", "(_", "args_", "._", "project", "\\u", "directory_", ",_", "args_", "._", "project", "\\u", "name_", ")_", "._", "strip_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "args_", "._", "skip", "\\u", "project", "\\u", "dir\\u", "check_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "(_", "os_", "._", "path_", "._", "exists_", "(_", "args_", "._", "project", "\\u", "directory_", ")_", "and_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "path_", "for_", "path_", "in_", "os_", "._", "listdir_", "(_", "args_", "._", "project", "\\u", "directory_", ")_", "if_", "not_", "path_", "._", "startswith_", "(_", "'.'_", ")_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sys_", "._", "stderr_", "._", "write_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Path", " ", "\"{", "0", "}\"", " ", "alr", "ead", "y", " ", "exist", "s", " ", "and", " ", "is", " ", "not", " ", "empty", ",", " ", "plea", "se", " ", "choose", " ", "a", " ", "different", " ", "one", "\\\\", "n", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'", "If", " ", "you", " ", "want", " ", "to", " ", "use", " ", "this", " ", "path", " ", "anyway", " ", "use", " ", "the", " ", "-", "s", " ", "flag", " ", "to", " ", "skip", " ", "this", " ", "check", ".\\\\", "n", "'_", "\\u\\u\\uNL\\u\\u\\u_", "''_", "._", "format_", "(_", "args_", "._", "project", "\\u", "directory_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "exit_", "(_", "4_", ")_", "\\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_", "os_", "._", "path_", "._", "exists_", "(_", "args_", "._", "project", "\\u", "path_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sys_", "._", "stderr_", "._", "write_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Path", " ", "\"{", "0", "}\"", " ", "alr", "ead", "y", " ", "exist", "s", ",", " ", "plea", "se", " ", "choose", " ", "a", " ", "different", " ", "one", "\\\\", "n", "'_", "._", "format_", "(_", "args_", "._", "project", "\\u", "path_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "exit_", "(_", "4_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "args_", "._", "config", "\\u", "dump_", "and_", "os_", "._", "path_", "._", "isfile_", "(_", "args_", "._", "config", "\\u", "dump_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sys_", "._", "stdout_", "._", "write_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Cann", "ot", " ", "dump", " ", "bec", "aus", "e", " ", "give", "n", " ", "configura", "tion", " ", "file", " ", "\"{", "0", "}\"", " ", "exist", "s", ".\\\\", "n", "'_", "._", "format_", "(_", "args_", "._", "config", "\\u", "dump_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "exit_", "(_", "8_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "args_", "=_", "\\u", "manage", "\\u", "args_", "(_", "parser_", ",_", "args_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "what", " ", "do", " ", "we", " ", "want", " ", "here", "?!", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "*", " ", "if", " ", "language", "s", " ", "are", " ", "give", "n", " ", "as", " ", "multiple", " ", "argu", "ment", "s", ",", " ", "let", "'", "s", " ", "use", " ", "it", " ", "as", " ", "is_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "*", " ", "if", " ", "no", " ", "language", "s", " ", "are", " ", "give", "n", ",", " ", "use", " ", "a", " ", "default", " ", "and", " ", "stop", " ", "handling", " ", "it", " ", "fur", "ther_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "*", " ", "if", " ", "language", "s", " ", "are", " ", "give", "n", " ", "as", " ", "a", " ", "comma", "-", "separate", "d", " ", "list", ",", " ", "split", " ", "it", " ", "and", " ", "use", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "result", "ing", " ", "list", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "args_", "._", "languages_", ":_", "\\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 ", " _", "args_", "._", "languages_", "=_", "[_", "locale_", "._", "getde", "fault", "locale_", "(_", ")_", "[_", "0_", "]_", "._", "split_", "(_", "'\\u'_", ")_", "[_", "0_", "]_", "]_", "\\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 ", " _", "args_", "._", "languages_", "=_", "[_", "'", "en", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "isinstance_", "(_", "args_", "._", "languages_", ",_", "six_", "._", "string", "\\u", "types_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "args_", "._", "languages_", "=_", "args_", "._", "languages_", "._", "split_", "(_", "','_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "len_", "(_", "args_", "._", "languages_", ")_", "==_", "1_", "and_", "isinstance_", "(_", "args_", "._", "languages_", "[_", "0_", "]_", ",_", "six_", "._", "string", "\\u", "types_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "args_", "._", "languages_", "=_", "args_", "._", "languages_", "[_", "0_", "]_", "._", "split_", "(_", "','_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "args_", "._", "languages_", "=_", "[_", "lang_", "._", "strip_", "(_", ")_", "._", "lower_", "(_", ")_", "for_", "lang_", "in_", "args_", "._", "languages_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "args_", "._", "ald", "ry", "n_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Convert", " ", "version", " ", "to", " ", "numeri", "c", " ", "format", " ", "for", " ", "easi", "er", " ", "checking", "_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "django", "\\u", "version_", ",_", "cms", "\\u", "version_", "=_", "support", "ed", "\\u", "versions_", "(_", "args_", "._", "django", "\\u", "version_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "args_", "._", "cms", "\\u", "version_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Run", "time", "Error_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sys_", "._", "stderr_", "._", "write_", "(_", "compat_", "._", "unicode_", "(_", "e_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "exit_", "(_", "6_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "django", "\\u", "version_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sys_", "._", "stderr_", "._", "write_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Ple", "ase", " ", "provide", " ", "a", " ", "Dj", "ang", "o", " ", "support", "ed", " ", "version", ":", " ", "{", "0", "}.", " ", "On", "ly", " ", "Maj", "or", ".", "Min", "or", " ", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'", "version", " ", "select", "or", " ", "is", " ", "accept", "ed", "\\\\", "n", "'_", "._", "format_", "(_", "',", " ", "'_", "._", "join_", "(_", "data_", "._", "DJANGO", "\\u", "SUPPORTED", "_", ")_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "exit_", "(_", "6_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "django", "\\u", "version_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sys_", "._", "stderr_", "._", "write_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Ple", "ase", " ", "provide", " ", "a", " ", "django", " ", "CMS", " ", "support", "ed", " ", "version", ":", " ", "{", "0", "}.", " ", "On", "ly", " ", "Maj", "or", ".", "Min", "or", " ", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'", "version", " ", "select", "or", " ", "is", " ", "accept", "ed", "\\\\", "n", "'_", "._", "format_", "(_", "',", " ", "'_", "._", "join_", "(_", "data_", "._", "DJANGO", "CMS", "\\u", "SUPPORTED", "_", ")_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "exit_", "(_", "6_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "getattr_", "(_", "args_", ",_", "'", "require", "ment", "s", "\\u", "file", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "requirements_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "django", " ", "CMS", " ", "version", " ", "check_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "args_", "._", "cms", "\\u", "version_", "==_", "'", "develop", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "requirements_", "._", "append_", "(_", "data_", "._", "DJANGO", "CMS", "\\u", "DEVELO", "P_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "warnings_", "._", "warn_", "(_", "data_", "._", "VERSI", "ON", "\\u", "WARNING_", "._", "format_", "(_", "'", "develop", "'_", ",_", "'", "django", " ", "CMS", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "args_", "._", "cms", "\\u", "version_", "==_", "'", "rc", "'_", ":_", "#", " ", "pragma", ":", " ", "no", " ", "cover_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "requirements_", "._", "append_", "(_", "data_", "._", "DJANGO", "CMS", "\\u", "RC_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "args_", "._", "cms", "\\u", "version_", "==_", "'", "beta", "'_", ":_", "#", " ", "pragma", ":", " ", "no", " ", "cover_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "requirements_", "._", "append_", "(_", "data_", "._", "DJANGO", "CMS", "\\u", "BET", "A_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "warnings_", "._", "warn_", "(_", "data_", "._", "VERSI", "ON", "\\u", "WARNING_", "._", "format_", "(_", "'", "beta", "'_", ",_", "'", "django", " ", "CMS", "'_", ")_", ")_", "\\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 ", " _", "requirements_", "._", "append_", "(_", "'", "django", "-", "cms", "<", "{", "0", "}'_", "._", "format_", "(_", "less", "\\u", "than", "\\u", "version_", "(_", "cms", "\\u", "version_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "cms", "\\u", "version_", ">=_", "3.2", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "requirements_", "._", "extend_", "(_", "data_", "._", "REQUIRE", "MENTS_", "[_", "'", "cms", "-", "3.2", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "args_", "._", "no", "\\u", "db", "\\u", "driver_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "requirements_", "._", "append_", "(_", "args_", "._", "db", "\\u", "driver_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "args_", "._", "no", "\\u", "plugins_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "args_", "._", "filer", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "cms", "\\u", "version_", ">=_", "3_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "requirements_", "._", "extend_", "(_", "data_", "._", "REQUIRE", "MENTS_", "[_", "'", "plugin", "s", "-", "common", "-", "master", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "requirements_", "._", "extend_", "(_", "data_", "._", "REQUIRE", "MENTS_", "[_", "'", "filer", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "cms", "\\u", "version_", ">=_", "3_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "requirements_", "._", "extend_", "(_", "data_", "._", "REQUIRE", "MENTS_", "[_", "'", "plugin", "s", "-", "common", "-", "master", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "requirements_", "._", "extend_", "(_", "data_", "._", "REQUIRE", "MENTS_", "[_", "'", "plugin", "s", "-", "basic", "-", "master", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "cms", "\\u", "version_", ">=_", "3.2", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "requirements_", "._", "extend_", "(_", "data_", "._", "REQUIRE", "MENTS_", "[_", "'", "cked", "itor", "-", "3.2", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "args_", "._", "ald", "ry", "n_", ":_", "#", " ", "pragma", ":", " ", "no", " ", "cover_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "requirements_", "._", "extend_", "(_", "data_", "._", "REQUIRE", "MENTS_", "[_", "'", "ald", "ry", "n", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Dj", "ang", "o", " ", "version", " ", "check_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "args_", "._", "django", "\\u", "version_", "==_", "'", "develop", "'_", ":_", "#", " ", "pragma", ":", " ", "no", " ", "cover_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "requirements_", "._", "append_", "(_", "data_", "._", "DJANGO", "\\u", "DEVELO", "P_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "warnings_", "._", "warn_", "(_", "data_", "._", "VERSI", "ON", "\\u", "WARNING_", "._", "format_", "(_", "'", "develop", "'_", ",_", "'", "Dj", "ang", "o", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "args_", "._", "django", "\\u", "version_", "==_", "'", "beta", "'_", ":_", "#", " ", "pragma", ":", " ", "no", " ", "cover_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "requirements_", "._", "append_", "(_", "data_", "._", "DJANGO", "\\u", "BET", "A_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "warnings_", "._", "warn_", "(_", "data_", "._", "VERSI", "ON", "\\u", "WARNING_", "._", "format_", "(_", "'", "beta", "'_", ",_", "'", "Dj", "ang", "o", "'_", ")_", ")_", "\\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 ", " _", "requirements_", "._", "append_", "(_", "'", "Dj", "ang", "o", "<", "{", "0", "}'_", "._", "format_", "(_", "less", "\\u", "than", "\\u", "version_", "(_", "django", "\\u", "version_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Timezone", " ", "support_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "args_", "._", "use", "\\u", "timezone_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "requirements_", "._", "append_", "(_", "'", "pyt", "z", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Requirements", " ", "dependen", "dent", " ", "on", " ", "django", " ", "version_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "if", " ", "django", "\\u", "version", " ", "<", " ", "1.7", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "require", "ment", "s", ".", "extend", "(", "data", ".", "REQUIRE", "MENT", "S", "['", "django", "-", "lega", "cy", "'])", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Revers", "ion", " ", "package", " ", "version", " ", "depend", "s", " ", "on", " ", "django", " ", "version_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "args_", "._", "reversi", "on_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "django", "\\u", "version_", "==_", "1.8_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "requirements_", "._", "extend_", "(_", "data_", "._", "REQUIRE", "MENTS_", "[_", "'", "reversi", "on", "-", "django", "-1", ".8", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "django", "\\u", "version_", "==_", "1.9", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "requirements_", "._", "extend_", "(_", "data_", "._", "REQUIRE", "MENTS_", "[_", "'", "reversi", "on", "-", "django", "-1", ".9", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "requirements_", "._", "extend_", "(_", "data_", "._", "REQUIRE", "MENTS_", "[_", "'", "default", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "setattr_", "(_", "args_", ",_", "'", "require", "ment", "s", "'_", ",_", "'\\\\", "n", "'_", "._", "join_", "(_", "requirements_", ")_", "._", "strip_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Conve", "nie", "nt", " ", "shortcuts_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "setattr_", "(_", "args_", ",_", "'", "cms", "\\u", "version", "'_", ",_", "cms", "\\u", "version_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "setattr_", "(_", "args_", ",_", "'", "django", "\\u", "version", "'_", ",_", "django", "\\u", "version_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "setattr_", "(_", "args_", ",_", "'", "settings", "\\u", "path", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "os_", "._", "path_", "._", "join_", "(_", "args_", "._", "project", "\\u", "directory_", ",_", "args_", "._", "project", "\\u", "name_", ",_", "'", "settings", ".", "py", "'_", ")_", "._", "strip_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "setattr_", "(_", "args_", ",_", "'", "url", "conf", "\\u", "path", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "os_", "._", "path_", "._", "join_", "(_", "args_", "._", "project", "\\u", "directory_", ",_", "args_", "._", "project", "\\u", "name_", ",_", "'", "urls", ".", "py", "'_", ")_", "._", "strip_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "args_", "._", "config", "\\u", "dump_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ini_", "._", "dump", "\\u", "config", "\\u", "file_", "(_", "args_", "._", "config", "\\u", "dump_", ",_", "args_", ",_", "parser_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "args_", "\\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,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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 ]
Missing call to `__init__` during object initialization
ardekantur/pyglet/experimental/mt_media/drivers/openal/__init__.py
[ { "content": "class OpenALWorker(mt_media.MediaThread):\n # Minimum size to bother refilling (bytes)\n _min_write_size = 512\n\n # Time to wait if there are players, but they're all full.\n _nap_time = 0.05\n\n # Time to wait if there are no players.\n _sleep_time = None\n\n\n\n", "metadata": "root.OpenALWorker", "header": "['module', '___EOS___']", "index": 88 }, { "content": " def __init__(self):\n super(OpenALWorker, self).__init__()\n self.players = set()", "metadata": "root.OpenALWorker.__init__", "header": "['class', 'OpenALWorker', '(', 'mt_media', '.', 'MediaThread', ')', ':', '___NEWLINE___', '# Minimum size to bother refilling (bytes)', '___NL___', '___EOS___']", "index": 98 } ]
[]
[]
0
false
[ "[CLS]_", "Missing", "_", "call_", "to_", " _", "`_", "\\u\\u", "init\\u\\u_", "`_", "dur", "ing_", "object_", "initialization", "_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Open", "AL", "Worker_", "(_", "mt", "\\u", "media_", "._", "Media", "Thread_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Mini", "mum", " ", "size", " ", "to", " ", "bot", "her", " ", "refi", "llin", "g", " ", "(", "bytes", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "min", "\\u", "write", "\\u", "size_", "=_", "512_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Time", " ", "to", " ", "wait", " ", "if", " ", "there", " ", "are", " ", "player", "s", ",", " ", "but", " ", "the", "y", "'", "re", " ", "all", " ", "full", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "nap", "\\u", "time_", "=_", "0.05_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Time", " ", "to", " ", "wait", " ", "if", " ", "there", " ", "are", " ", "no", " ", "player", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "sleep", "\\u", "time_", "=_", "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\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Open", "AL", "Worker_", "(_", "mt", "\\u", "media_", "._", "Media", "Thread_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Mini", "mum", " ", "size", " ", "to", " ", "bot", "her", " ", "refi", "llin", "g", " ", "(", "bytes", ")_", "\\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_", "(_", "Open", "AL", "Worker_", ",_", "self_", ")_", "._", "\\u\\u", "init\\u\\u_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "players_", "=_", "set_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 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, 2, 2, 2, 2, 2, 2, 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 ]
Non-callable called
gkno/gkno_launcher/src/gkno/dataConsistency.py
[ { "content": "#!/bin/bash/python\n\nfrom __future__ import print_function\nfrom copy import deepcopy\n\nimport dataConsistencyErrors as er\nimport superpipeline\n\nimport json\nimport os\nimport sys\n\n# Loop over all of the nodes in a graph and check that the values associated with it\n# are of the correct type and have extensions consistent with all of the arguments\n# attached to the node.\n\n# Check the values for a node.\n\n# Check a values data type.\n\n# Check that the file extension is valid.\n\n# Loop over all tasks in the pipeline and check that all required values (excepting output files\n# which can be constructed) have been defined.\n\n# Purge the graph of nodes with no values.\n\n# Set the aboslute paths of all the files used in the pipeline.\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def setFilePaths(graph, gknoArguments, gkno):\n inputFiles = []\n\n # Get the input and output paths as defined by the user.\n definedInputPath = gkno.getGknoArgument('GKNO-INPUT-PATH', gknoArguments)\n definedOutputPath = gkno.getGknoArgument('GKNO-OUTPUT-PATH', gknoArguments)\n\n # Get the path of the input and the output directories.\n inputPath = definedInputPath if definedInputPath else str('$(PWD)')\n outputPath = definedOutputPath if definedOutputPath else str('$(PWD)')\n\n # If the path is '.', set to $(PWD).\n if inputPath == '.': inputPath = '$(PWD)'\n if outputPath == '.': outputPath = '$(PWD)'\n\n # Ensure that the input and output paths end with /.\n if not inputPath.endswith('/'): inputPath += '/'\n if not outputPath.endswith('/'): outputPath += '/'\n\n # Parse all of the file nodes.\n for nodeId in graph.getNodes('file'):\n\n # Determine if the file is an input or output file. Since the node could be feeding\n # into or from multiple tasks, a file is an input, if and only if, the file nodes\n # associated with the option node have no predecessors.\n isInput = False if graph.graph.predecessors(nodeId) else True\n if isInput:\n source = nodeId\n target = graph.graph.successors(nodeId)[0]\n else:\n source = graph.graph.predecessors(nodeId)[0]\n target = nodeId\n\n # Determine if this is a stub,\n isStub = graph.getArgumentAttribute(source, target, 'isStub')\n if isStub: stubExtension = graph.getArgumentAttribute(source, target, 'stubExtension')\n\n # Determine if a file location is set for the argument. If so, add this location to the node.\n fileLocation = graph.getArgumentAttribute(source, target, 'fileLocation')\n \n # Get the values associated with the node.\n updatedValues = []\n for value in graph.getGraphNodeAttribute(nodeId, 'values'):\n\n # Update the value to include the extension, if this is a stub (if necessary).\n if isStub and not value.endswith(stubExtension):\n modifiedValue = str(value + stubExtension) if '.' in stubExtension else str(value + '.' + stubExtension)\n else: modifiedValue = value\n\n # Check if the value already has a path. If not, add the input or output path. If the path\n # was defined by the user on the command line, override any path that is already present\n # with that supplied. In addition, store all of the input files. Since these are specifically\n # defined as files that are not created by any task in the pipeline, these files need to exist\n # in order for the pipeline to run.\n if isInput:\n\n # If a file location is specified with the argument, the value should not have the path altered, but\n # the file location should be stored. This will be used to define where the file should exist in the\n # makefile, but will not appear in the value on the command line.\n if fileLocation:\n graph.setGraphNodeAttribute(nodeId, 'fileLocation', fileLocation)\n updatedValue = str(value)\n\n # Override the path if necessary.\n elif definedInputPath: updatedValue = str(inputPath + modifiedValue.split('/')[-1])\n else: updatedValue = str(modifiedValue) if '/' in modifiedValue else str(inputPath + modifiedValue)\n updatedValues.append(updatedValue)\n\n # Add the input files to the list of input files required by the pipeline. These will be checked to ensure\n # that they exist prior to pipeline execution.\n if fileLocation: inputFiles.append(str(fileLocation + updatedValue))\n else: inputFiles.append(updatedValue)\n else:\n if definedOutputPath: updatedValues.append(str(outputPath + modifiedValue.split('/')[-1]))\n else: updatedValues.append(str(modifiedValue) if '/' in modifiedValue else str(outputPath + modifiedValue))\n\n # Replace the values stored in the node with the values including the absolute path.\n graph.setGraphNodeAttribute(nodeId, 'values', updatedValues)\n\n # Return the list of all required input files.\n return inputFiles", "metadata": "root.setFilePaths", "header": "['module', '___EOS___']", "index": 402 } ]
[]
[]
0
false
[ "[CLS]_", "Non", "_", "-_", "callable_", "called_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#!", "/", "bin", "/", "bash", "/", "python_", "\\u\\u\\uNL\\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_", "from_", "copy_", "import_", "deepcopy_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "data", "Cons", "iste", "nc", "y", "Errors_", "as_", "er_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "super", "pipeline_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "json_", "\\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_", "#", " ", "Loop", " ", "over", " ", "all", " ", "of", " ", "the", " ", "nodes", " ", "in", " ", "a", " ", "graph", " ", "and", " ", "check", " ", "tha", "t", " ", "the", " ", "values", " ", "associate", "d", " ", "with", " ", "it_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "are", " ", "of", " ", "the", " ", "correct", " ", "type", " ", "and", " ", "have", " ", "extensi", "ons", " ", "consistent", " ", "with", " ", "all", " ", "of", " ", "the", " ", "arguments_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "attache", "d", " ", "to", " ", "the", " ", "node", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Check", " ", "the", " ", "values", " ", "for", " ", "a", " ", "node", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Check", " ", "a", " ", "values", " ", "data", " ", "type", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Check", " ", "tha", "t", " ", "the", " ", "file", " ", "extensi", "on", " ", "is", " ", "valid", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Loop", " ", "over", " ", "all", " ", "task", "s", " ", "in", " ", "the", " ", "pipeline", " ", "and", " ", "check", " ", "tha", "t", " ", "all", " ", "require", "d", " ", "values", " ", "(", "except", "ing", " ", "output", " ", "files_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "whi", "ch", " ", "can", " ", "be", " ", "construct", "ed", ")", " ", "have", " ", "bee", "n", " ", "defin", "ed", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Purg", "e", " ", "the", " ", "graph", " ", "of", " ", "nodes", " ", "with", " ", "no", " ", "values", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Set", " ", "the", " ", "abo", "sl", "ute", " ", "path", "s", " ", "of", " ", "all", " ", "the", " ", "files", " ", "used", " ", "in", " ", "the", " ", "pipeline", "._", "\\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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "set", "File", "Paths_", "(_", "graph_", ",_", "gk", "no", "Arguments_", ",_", "gk", "no_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "input", "Files_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Get", " ", "the", " ", "input", " ", "and", " ", "output", " ", "path", "s", " ", "as", " ", "defin", "ed", " ", "by", " ", "the", " ", "user", "._", "\\u\\u\\uNL\\u\\u\\u_", "defin", "ed", "Inp", "ut", "Path_", "=_", "gk", "no_", "._", "get", "G", "kno", "Argument_", "(_", "'", "GK", "NO", "-", "INPUT", "-", "PATH", "'_", ",_", "gk", "no", "Arguments_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "defin", "ed", "Output", "Path_", "=_", "gk", "no_", "._", "get", "G", "kno", "Argument_", "(_", "'", "GK", "NO", "-", "OUTPU", "T", "-", "PATH", "'_", ",_", "gk", "no", "Arguments_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Get", " ", "the", " ", "path", " ", "of", " ", "the", " ", "input", " ", "and", " ", "the", " ", "output", " ", "director", "ies", "._", "\\u\\u\\uNL\\u\\u\\u_", "input", "Path_", "=_", "defin", "ed", "Inp", "ut", "Path_", "if_", "defin", "ed", "Inp", "ut", "Path_", "else_", "str_", "(_", "'$", "(", "PWD", ")'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "output", "Path_", "=_", "defin", "ed", "Output", "Path_", "if_", "defin", "ed", "Output", "Path_", "else_", "str_", "(_", "'$", "(", "PWD", ")'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "the", " ", "path", " ", "is", " ", "'.'", ",", " ", "set", " ", "to", " ", "$(", "PWD", ").", "_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "input", "Path_", "==_", "'.'_", ":_", "input", "Path_", "=_", "'$", "(", "PWD", ")'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "output", "Path_", "==_", "'.'_", ":_", "output", "Path_", "=_", "'$", "(", "PWD", ")'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Ensur", "e", " ", "tha", "t", " ", "the", " ", "input", " ", "and", " ", "output", " ", "path", "s", " ", "end", " ", "with", " ", "/.", "_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "input", "Path_", "._", "endswith_", "(_", "'/'_", ")_", ":_", "input", "Path_", "+=_", "'/'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "output", "Path_", "._", "endswith_", "(_", "'/'_", ")_", ":_", "output", "Path_", "+=_", "'/'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Pars", "e", " ", "all", " ", "of", " ", "the", " ", "file", " ", "nodes", "._", "\\u\\u\\uNL\\u\\u\\u_", "for_", "node", "Id_", "in_", "graph_", "._", "get", "Nodes_", "(_", "'", "file", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Det", "erm", "ine", " ", "if", " ", "the", " ", "file", " ", "is", " ", "an", " ", "input", " ", "or", " ", "output", " ", "file", ".", " ", "Sin", "ce", " ", "the", " ", "node", " ", "coul", "d", " ", "be", " ", "feed", "ing_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "int", "o", " ", "or", " ", "from", " ", "multiple", " ", "task", "s", ",", " ", "a", " ", "file", " ", "is", " ", "an", " ", "input", ",", " ", "if", " ", "and", " ", "only", " ", "if", ",", " ", "the", " ", "file", " ", "nodes_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "associate", "d", " ", "with", " ", "the", " ", "option", " ", "node", " ", "have", " ", "no", " ", "predecessor", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "is", "Input_", "=_", "False_", "if_", "graph_", "._", "graph_", "._", "predecessor", "s_", "(_", "node", "Id_", ")_", "else_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "is", "Input_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "source_", "=_", "node", "Id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "target_", "=_", "graph_", "._", "graph_", "._", "successors_", "(_", "node", "Id_", ")_", "[_", "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 ", " _", "source_", "=_", "graph_", "._", "graph_", "._", "predecessor", "s_", "(_", "node", "Id_", ")_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "target_", "=_", "node", "Id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Det", "erm", "ine", " ", "if", " ", "this", " ", "is", " ", "a", " ", "stub", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "is", "Stub_", "=_", "graph_", "._", "get", "Arg", "ument", "Attribute_", "(_", "source_", ",_", "target_", ",_", "'", "is", "Stu", "b", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "is", "Stub_", ":_", "stub", "Extension_", "=_", "graph_", "._", "get", "Arg", "ument", "Attribute_", "(_", "source_", ",_", "target_", ",_", "'", "stub", "Ext", "ensi", "on", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Det", "erm", "ine", " ", "if", " ", "a", " ", "file", " ", "location", " ", "is", " ", "set", " ", "for", " ", "the", " ", "argu", "ment", ".", " ", "If", " ", "so", ",", " ", "add", " ", "this", " ", "location", " ", "to", " ", "the", " ", "node", "._", "\\u\\u\\uNL\\u\\u\\u_", "file", "Location_", "=_", "graph_", "._", "get", "Arg", "ument", "Attribute_", "(_", "source_", ",_", "target_", ",_", "'", "file", "Locat", "ion", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Get", " ", "the", " ", "values", " ", "associate", "d", " ", "with", " ", "the", " ", "node", "._", "\\u\\u\\uNL\\u\\u\\u_", "update", "d", "Values_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "value_", "in_", "graph_", "._", "get", "Graph", "Node", "Attribute_", "(_", "node", "Id_", ",_", "'", "values", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Update", " ", "the", " ", "value", " ", "to", " ", "include", " ", "the", " ", "extensi", "on", ",", " ", "if", " ", "this", " ", "is", " ", "a", " ", "stub", " ", "(", "if", " ", "necessar", "y", ").", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "is", "Stub_", "and_", "not_", "value_", "._", "endswith_", "(_", "stub", "Extension_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "modifi", "ed", "Value_", "=_", "str_", "(_", "value_", "+_", "stub", "Extension_", ")_", "if_", "'.'_", "in_", "stub", "Extension_", "else_", "str_", "(_", "value_", "+_", "'.'_", "+_", "stub", "Extension_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "modifi", "ed", "Value_", "=_", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Check", " ", "if", " ", "the", " ", "value", " ", "alr", "ead", "y", " ", "has", " ", "a", " ", "path", ".", " ", "If", " ", "not", ",", " ", "add", " ", "the", " ", "input", " ", "or", " ", "output", " ", "path", ".", " ", "If", " ", "the", " ", "path_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "was", " ", "defin", "ed", " ", "by", " ", "the", " ", "user", " ", "on", " ", "the", " ", "command", " ", "line", ",", " ", "override", " ", "any", " ", "path", " ", "tha", "t", " ", "is", " ", "alr", "ead", "y", " ", "present_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "with", " ", "tha", "t", " ", "supplie", "d", ".", " ", "In", " ", "addition", ",", " ", "store", " ", "all", " ", "of", " ", "the", " ", "input", " ", "files", ".", " ", "Sin", "ce", " ", "these", " ", "are", " ", "specifica", "ll", "y_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "defin", "ed", " ", "as", " ", "files", " ", "tha", "t", " ", "are", " ", "not", " ", "created", " ", "by", " ", "any", " ", "task", " ", "in", " ", "the", " ", "pipeline", ",", " ", "these", " ", "files", " ", "need", " ", "to", " ", "exist_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "in", " ", "order", " ", "for", " ", "the", " ", "pipeline", " ", "to", " ", "run", "._", "\\u\\u\\uNL\\u\\u\\u_", "if_", "is", "Input_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "a", " ", "file", " ", "location", " ", "is", " ", "specified", " ", "with", " ", "the", " ", "argu", "ment", ",", " ", "the", " ", "value", " ", "shou", "ld", " ", "not", " ", "have", " ", "the", " ", "path", " ", "alter", "ed", ",", " ", "but", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "the", " ", "file", " ", "location", " ", "shou", "ld", " ", "be", " ", "store", "d", ".", " ", "Thi", "s", " ", "will", " ", "be", " ", "used", " ", "to", " ", "defin", "e", " ", "where", " ", "the", " ", "file", " ", "shou", "ld", " ", "exist", " ", "in", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "makefile", ",", " ", "but", " ", "will", " ", "not", " ", "appear", " ", "in", " ", "the", " ", "value", " ", "on", " ", "the", " ", "command", " ", "line", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "file", "Location_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "graph_", "._", "set", "Graph", "Node", "Attribute_", "(_", "node", "Id_", ",_", "'", "file", "Locat", "ion", "'_", ",_", "file", "Location_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "update", "d", "Value_", "=_", "str_", "(_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Override", " ", "the", " ", "path", " ", "if", " ", "necessar", "y", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "defin", "ed", "Inp", "ut", "Path_", ":_", "update", "d", "Value_", "=_", "str_", "(_", "input", "Path_", "+_", "modifi", "ed", "Value_", "._", "split_", "(_", "'/'_", ")_", "[_", "-_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "else_", ":_", "update", "d", "Value_", "=_", "str_", "(_", "modifi", "ed", "Value_", ")_", "if_", "'/'_", "in_", "modifi", "ed", "Value_", "else_", "str_", "(_", "input", "Path_", "+_", "modifi", "ed", "Value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "update", "d", "Values_", "._", "append_", "(_", "update", "d", "Value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Add", " ", "the", " ", "input", " ", "files", " ", "to", " ", "the", " ", "list", " ", "of", " ", "input", " ", "files", " ", "require", "d", " ", "by", " ", "the", " ", "pipeline", ".", " ", "The", "se", " ", "will", " ", "be", " ", "checke", "d", " ", "to", " ", "ensure", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "tha", "t", " ", "the", "y", " ", "exist", " ", "prior", " ", "to", " ", "pipeline", " ", "executi", "on", "._", "\\u\\u\\uNL\\u\\u\\u_", "if_", "file", "Location_", ":_", "input", "Files_", "._", "append_", "(_", "str_", "(_", "file", "Location_", "+_", "update", "d", "Value_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "else_", ":_", "input", "Files_", "._", "append_", "(_", "update", "d", "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 ", " _", "if_", "defin", "ed", "Output", "Path_", ":_", "update", "d", "Values_", "._", "append_", "(_", "str_", "(_", "output", "Path_", "+_", "modifi", "ed", "Value_", "._", "split_", "(_", "'/'_", ")_", "[_", "-_", "1_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "else_", ":_", "update", "d", "Values_", "._", "append_", "(_", "str_", "(_", "modifi", "ed", "Value_", ")_", "if_", "'/'_", "in_", "modifi", "ed", "Value_", "else_", "str_", "(_", "output", "Path_", "+_", "modifi", "ed", "Value_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Replace", " ", "the", " ", "values", " ", "store", "d", " ", "in", " ", "the", " ", "node", " ", "with", " ", "the", " ", "values", " ", "inclu", "ding", " ", "the", " ", "abs", "olute", " ", "path", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "graph_", "._", "set", "Graph", "Node", "Attribute_", "(_", "node", "Id_", ",_", "'", "values", "'_", ",_", "update", "d", "Values_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Return", " ", "the", " ", "list", " ", "of", " ", "all", " ", "require", "d", " ", "input", " ", "files", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "input", "Files_" ]
[ 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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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 ]
Unused import
PyTables/PyTables/tables/tests/test_numpy.py
[ { "content": "# -*- coding: utf-8 -*-\n\nfrom __future__ import print_function\nfrom __future__ import absolute_import\nimport os\nimport sys\nimport tempfile\n\nimport numpy as np\n\nimport tables\nfrom tables import (\n StringCol, BoolCol, FloatCol, ComplexCol, EnumCol,\n Int8Col, UInt8Col, Int16Col, UInt16Col, Int32Col, UInt32Col,\n Int64Col, Float32Col, Float64Col, Time64Col\n)\nfrom tables.tests import common\nfrom tables.tests.common import allequal\nfrom tables.tests.common import unittest\nfrom tables.tests.common import PyTablesTestCase as TestCase\nfrom six.moves import range\n\n\ntypecodes = ['b', 'h', 'i', 'l', 'q', 'f', 'd']\n# UInt64 checking disabled on win platforms\n# because this type is not supported\nif sys.platform != 'win32':\n typecodes += ['B', 'H', 'I', 'L', 'Q', 'F', 'D']\nelse:\n typecodes += ['B', 'H', 'I', 'L', 'F', 'D']\ntypecodes += ['b1'] # boolean\n\nif hasattr(tables, 'Float16Atom'):\n typecodes.append('e')\nif hasattr(tables, 'Float96Atom') or hasattr(tables, 'Float128Atom'):\n typecodes.append('g')\nif hasattr(tables, 'Complex192Atom') or hasattr(tables, 'Conplex256Atom'):\n typecodes.append('G')\n\nbyteorder = {'little': '<', 'big': '>'}[sys.byteorder]\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n# class Basic32DTestCase(BasicTestCase):\n# # 32D case (maximum)\n# tupleInt = reshape(np.array((22,)), (1,)*32)\n# # Strings seems to be very slow with somewhat large dimensions\n# # This should not be run unless the numarray people address this problem\n# # F. Alted 2006-01-04\n# tupleChar = np.array(tupleInt, dtype=\"S1\")\n\n\n\n\n# Test Record class\n\n\n\n\n# The declaration of the nested table:\n\n\n\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 common.parse_argv(sys.argv)\n common.print_versions()\n unittest.main(defaultTest='suite')\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class BasicTestCase(TestCase):\n \"\"\"Basic test for all the supported typecodes present in NumPy.\n\n All of them are included on PyTables.\n\n \"\"\"\n endiancheck = 0\n\n\n\n\n", "metadata": "root.BasicTestCase", "header": "['module', '___EOS___']", "index": 42 }, { "content": " def WriteRead(self, testArray):\n if common.verbose:\n print('\\n', '-=' * 30)\n print(\"Running test for array with typecode '%s'\" %\n testArray.dtype.char, end=' ')\n print(\"for class check:\", self.title)\n\n # Create an instance of HDF5 Table\n self.h5fname = tempfile.mktemp(\".h5\")\n try:\n with tables.open_file(self.h5fname, mode=\"w\") as self.h5file:\n self.root = self.h5file.root\n\n # Create the array under root and name 'somearray'\n a = testArray\n self.h5file.create_array(self.root, 'somearray', a,\n \"Some array\")\n\n # Re-open the file in read-only mode\n with tables.open_file(self.h5fname, mode=\"r\") as self.h5file:\n self.root = self.h5file.root\n\n # Read the saved array\n b = self.root.somearray.read()\n\n # For cases that read returns a python type instead of a\n # numpy type\n if not hasattr(b, \"shape\"):\n b = np.np.array(b, dtype=a.dtype.str)\n\n # Compare them. They should be equal.\n # if not allequal(a,b, \"numpy\") and common.verbose:\n if common.verbose:\n print(\"Array written:\", a)\n print(\"Array written shape:\", a.shape)\n print(\"Array written itemsize:\", a.itemsize)\n print(\"Array written type:\", a.dtype.char)\n print(\"Array read:\", b)\n print(\"Array read shape:\", b.shape)\n print(\"Array read itemsize:\", b.itemsize)\n print(\"Array read type:\", b.dtype.char)\n\n type_ = self.root.somearray.atom.type\n\n # Check strictly the array equality\n self.assertEqual(type(a), type(b))\n self.assertEqual(a.shape, b.shape)\n self.assertEqual(a.shape, self.root.somearray.shape)\n self.assertEqual(a.dtype, b.dtype)\n if a.dtype.char[0] == \"S\":\n self.assertEqual(type_, \"string\")\n else:\n self.assertEqual(a.dtype.base.name, type_)\n\n self.assertTrue(allequal(a, b, \"numpy\"))\n finally:\n # Then, delete the file\n if os.path.exists(self.h5fname):\n os.remove(self.h5fname)", "metadata": "root.BasicTestCase.WriteRead", "header": "['class', 'BasicTestCase', '(', 'TestCase', ')', ':', '___EOS___']", "index": 50 }, { "content": " def test00_char(self):\n \"\"\"Data integrity during recovery (character objects)\"\"\"\n\n a = np.array(self.tupleChar, 'S'+str(len(self.tupleChar)))\n self.WriteRead(a)", "metadata": "root.BasicTestCase.test00_char", "header": "['class', 'BasicTestCase', '(', 'TestCase', ')', ':', '___EOS___']", "index": 110 }, { "content": " def test01_char_nc(self):\n \"\"\"Data integrity during recovery (non-contiguous character objects)\"\"\"\n\n a = np.array(self.tupleChar, 'S'+str(len(self.tupleChar)))\n if a.shape == ():\n b = a # We cannot use the indexing notation\n else:\n b = a[::2]\n # Ensure that this numpy string is non-contiguous\n if a.shape[0] > 2:\n self.assertEqual(b.flags['CONTIGUOUS'], False)\n self.WriteRead(b)", "metadata": "root.BasicTestCase.test01_char_nc", "header": "['class', 'BasicTestCase', '(', 'TestCase', ')', ':', '___EOS___']", "index": 116 }, { "content": " def test02_types(self):\n \"\"\"Data integrity during recovery (numerical types)\"\"\"\n\n for typecode in typecodes:\n if self.tupleInt.shape:\n a = self.tupleInt.astype(typecode)\n else:\n # shape is the empty tuple ()\n a = np.array(self.tupleInt, dtype=typecode)\n self.WriteRead(a)", "metadata": "root.BasicTestCase.test02_types", "header": "['class', 'BasicTestCase', '(', 'TestCase', ')', ':', '___EOS___']", "index": 129 }, { "content": " def test03_types_nc(self):\n \"\"\"Data integrity during recovery (non-contiguous numerical types)\"\"\"\n\n for typecode in typecodes:\n if self.tupleInt.shape:\n a = self.tupleInt.astype(typecode)\n else:\n # shape is the empty tuple ()\n a = np.array(self.tupleInt, dtype=typecode)\n\n # This should not be tested for the rank-0 case\n if len(a.shape) == 0:\n raise unittest.SkipTest\n b = a[::2]\n\n # Ensure that this array is non-contiguous (for non-trivial case)\n if a.shape[0] > 2:\n self.assertEqual(b.flags['CONTIGUOUS'], False)\n self.WriteRead(b)", "metadata": "root.BasicTestCase.test03_types_nc", "header": "['class', 'BasicTestCase', '(', 'TestCase', ')', ':', '___EOS___']", "index": 140 }, { "content": "class Basic0DOneTestCase(BasicTestCase):\n # Rank-0 case\n title = \"Rank-0 case 1\"\n tupleInt = np.array(3)\n tupleChar = \"4\"", "metadata": "root.Basic0DOneTestCase", "header": "['module', '___EOS___']", "index": 161 }, { "content": "class Basic0DTwoTestCase(BasicTestCase):\n # Rank-0 case\n title = \"Rank-0 case 2\"\n tupleInt = np.array(33)\n tupleChar = \"44\"", "metadata": "root.Basic0DTwoTestCase", "header": "['module', '___EOS___']", "index": 168 }, { "content": "class Basic1DOneTestCase(BasicTestCase):\n # 1D case\n title = \"Rank-1 case 1\"\n tupleInt = np.array((3,))\n tupleChar = (\"a\",)", "metadata": "root.Basic1DOneTestCase", "header": "['module', '___EOS___']", "index": 175 }, { "content": "class Basic1DTwoTestCase(BasicTestCase):\n # 1D case\n title = \"Rank-1 case 2\"\n tupleInt = np.array((0, 4))\n tupleChar = (\"aaa\",)", "metadata": "root.Basic1DTwoTestCase", "header": "['module', '___EOS___']", "index": 182 }, { "content": "class Basic1DThreeTestCase(BasicTestCase):\n # 1D case\n title = \"Rank-1 case 3\"\n tupleInt = np.array((3, 4, 5))\n tupleChar = (\"aaaa\", \"bbb\",)", "metadata": "root.Basic1DThreeTestCase", "header": "['module', '___EOS___']", "index": 189 }, { "content": "class Basic2DTestCase(BasicTestCase):\n # 2D case\n title = \"Rank-2 case 1\"\n # tupleInt = reshape(np.array(np.arange((4)**2)), (4,)*2)\n tupleInt = np.ones((4,)*2)\n tupleChar = [[\"aaa\", \"ddddd\"], [\"d\", \"ss\"], [\"s\", \"tt\"]]", "metadata": "root.Basic2DTestCase", "header": "['module', '___EOS___']", "index": 196 }, { "content": "class Basic10DTestCase(BasicTestCase):\n # 10D case\n title = \"Rank-10 case 1\"\n # tupleInt = reshape(np.array(np.arange((2)**10)), (2,)*10)\n tupleInt = np.ones((2,)*10)\n # tupleChar = reshape(np.array([1],dtype=\"S1\"),(1,)*10)\n # The next tuple consumes far more time, so this\n # test should be run in common.heavy mode.\n tupleChar = np.array(tupleInt, dtype=\"S1\")", "metadata": "root.Basic10DTestCase", "header": "['module', '___EOS___']", "index": 204 }, { "content": "class GroupsArrayTestCase(common.TempFileMixin, TestCase):\n \"\"\"This test class checks combinations of arrays with groups.\n\n It also uses arrays ranks which ranges until 10.\n\n \"\"\"\n\n", "metadata": "root.GroupsArrayTestCase", "header": "['module', '___EOS___']", "index": 224 }, { "content": " def test00_iterativeGroups(self):\n \"\"\"Checking combinations of arrays with groups\n\n It also uses arrays ranks which ranges until 10.\n\n \"\"\"\n\n if common.verbose:\n print('\\n', '-=' * 30)\n print(\"Running %s.test00_iterativeGroups...\" %\n self.__class__.__name__)\n\n # Get the root group\n group = self.h5file.root\n\n i = 1\n for typecode in typecodes:\n # Create an array of typecode, with incrementally bigger ranges\n a = np.ones((2,) * i, typecode)\n # Save it on the HDF5 file\n dsetname = 'array_' + typecode\n if common.verbose:\n print(\"Creating dataset:\", group._g_join(dsetname))\n self.h5file.create_array(group, dsetname, a, \"Large array\")\n # Create a new group\n group = self.h5file.create_group(group, 'group' + str(i))\n # increment the range for next iteration\n i += 1\n\n self._reopen()\n\n # Get the root group\n group = self.h5file.root\n\n # Get the metadata on the previosly saved arrays\n for i in range(1, len(typecodes)):\n # Create an array for later comparison\n a = np.ones((2,) * i, typecodes[i - 1])\n # Get the dset object hanging from group\n dset = getattr(group, 'array_' + typecodes[i-1])\n # Get the actual array\n b = dset.read()\n if not allequal(a, b, \"numpy\") and common.verbose:\n print(\"Array a original. Shape: ==>\", a.shape)\n print(\"Array a original. Data: ==>\", a)\n print(\"Info from dataset:\", dset._v_pathname)\n print(\" shape ==>\", dset.shape, end=' ')\n print(\" dtype ==> %s\" % dset.dtype)\n print(\"Array b read from file. Shape: ==>\", b.shape, end=' ')\n print(\". Type ==> %s\" % b.dtype.char)\n\n self.assertEqual(a.shape, b.shape)\n if np.dtype('l').itemsize == 4:\n if (a.dtype.char == \"i\" or a.dtype.char == \"l\"):\n # Special expection. We have no way to distinguish between\n # \"l\" and \"i\" typecode, and we can consider them the same\n # to all practical effects\n self.assertTrue(b.dtype.char == \"l\" or b.dtype.char == \"i\")\n elif (a.dtype.char == \"I\" or a.dtype.char == \"L\"):\n # Special expection. We have no way to distinguish between\n # \"L\" and \"I\" typecode, and we can consider them the same\n # to all practical effects\n self.assertTrue(b.dtype.char == \"L\" or b.dtype.char == \"I\")\n else:\n self.assertTrue(allequal(a, b, \"numpy\"))\n elif np.dtype('l').itemsize == 8:\n if (a.dtype.char == \"q\" or a.dtype.char == \"l\"):\n # Special expection. We have no way to distinguish between\n # \"q\" and \"l\" typecode in 64-bit platforms, and we can\n # consider them the same to all practical effects\n self.assertTrue(b.dtype.char == \"l\" or b.dtype.char == \"q\")\n elif (a.dtype.char == \"Q\" or a.dtype.char == \"L\"):\n # Special expection. We have no way to distinguish between\n # \"Q\" and \"L\" typecode in 64-bit platforms, and we can\n # consider them the same to all practical effects\n self.assertTrue(b.dtype.char == \"L\" or b.dtype.char == \"Q\")\n else:\n self.assertTrue(allequal(a, b, \"numpy\"))\n\n # Iterate over the next group\n group = getattr(group, 'group' + str(i))", "metadata": "root.GroupsArrayTestCase.test00_iterativeGroups", "header": "['class', 'GroupsArrayTestCase', '(', 'common', '.', 'TempFileMixin', ',', 'TestCase', ')', ':', '___EOS___']", "index": 231 }, { "content": " def test01_largeRankArrays(self):\n \"\"\"Checking creation of large rank arrays (0 < rank <= 32)\n\n It also uses arrays ranks which ranges until maxrank.\n\n \"\"\"\n\n # maximum level of recursivity (deepest group level) achieved:\n # maxrank = 32 (for a effective maximum rank of 32)\n # This limit is due to a limit in the HDF5 library.\n minrank = 1\n maxrank = 32\n\n if common.verbose:\n print('\\n', '-=' * 30)\n print(\"Running %s.test01_largeRankArrays...\" %\n self.__class__.__name__)\n print(\"Maximum rank for tested arrays:\", maxrank)\n\n group = self.h5file.root\n if common.verbose:\n print(\"Rank array writing progress: \", end=' ')\n for rank in range(minrank, maxrank + 1):\n # Create an array of integers, with incrementally bigger ranges\n a = np.ones((1,) * rank, 'i')\n if common.verbose:\n print(\"%3d,\" % (rank), end=' ')\n self.h5file.create_array(group, \"array\", a, \"Rank: %s\" % rank)\n group = self.h5file.create_group(group, 'group' + str(rank))\n\n # Flush the buffers\n self.h5file.flush()\n\n self._reopen()\n\n group = self.h5file.root\n if common.verbose:\n print()\n print(\"Rank array reading progress: \")\n # Get the metadata on the previosly saved arrays\n for rank in range(minrank, maxrank + 1):\n # Create an array for later comparison\n a = np.ones((1,) * rank, 'i')\n # Get the actual array\n b = group.array.read()\n if common.verbose:\n print(\"%3d,\" % (rank), end=' ')\n if not a.tolist() == b.tolist() and common.verbose:\n dset = group.array\n print(\"Info from dataset:\", dset._v_pathname)\n print(\" Shape: ==>\", dset.shape, end=' ')\n print(\" typecode ==> %c\" % dset.typecode)\n print(\"Array b read from file. Shape: ==>\", b.shape, end=' ')\n print(\". Type ==> %c\" % b.dtype.char)\n self.assertEqual(a.shape, b.shape)\n if a.dtype.char == \"i\":\n # Special expection. We have no way to distinguish between\n # \"l\" and \"i\" typecode, and we can consider them the same\n # to all practical effects\n self.assertTrue(b.dtype.char == \"l\" or b.dtype.char == \"i\")\n else:\n self.assertEqual(a.dtype.char, b.dtype.char)\n\n self.assertEqual(a, b)\n\n # Iterate over the next group\n group = self.h5file.get_node(group, 'group' + str(rank))\n\n if common.verbose:\n print() # This flush the stdout buffer", "metadata": "root.GroupsArrayTestCase.test01_largeRankArrays", "header": "['class', 'GroupsArrayTestCase', '(', 'common', '.', 'TempFileMixin', ',', 'TestCase', ')', ':', '___EOS___']", "index": 313 }, { "content": "class Record(tables.IsDescription):\n var1 = StringCol(itemsize=4, dflt=b\"abcd\", pos=0)\n var2 = StringCol(itemsize=1, dflt=b\"a\", pos=1)\n var3 = BoolCol(dflt=1)\n var4 = Int8Col(dflt=1)\n var5 = UInt8Col(dflt=1)\n var6 = Int16Col(dflt=1)\n var7 = UInt16Col(dflt=1)\n var8 = Int32Col(dflt=1)\n var9 = UInt32Col(dflt=1)\n var10 = Int64Col(dflt=1)\n var11 = Float32Col(dflt=1.0)\n var12 = Float64Col(dflt=1.0)\n var13 = ComplexCol(itemsize=8, dflt=(1.+0.j))\n var14 = ComplexCol(itemsize=16, dflt=(1.+0.j))\n if hasattr(tables, 'Float16Col'):\n var15 = tables.Float16Col(dflt=1.0)\n if hasattr(tables, 'Float96Col'):\n var16 = tables.Float96Col(dflt=1.0)\n if hasattr(tables, 'Float128Col'):\n var17 = tables.Float128Col(dflt=1.0)\n if hasattr(tables, 'Complex196Col'):\n var18 = tables.ComplexCol(itemsize=24, dflt=(1.+0.j))\n if hasattr(tables, 'Complex256Col'):\n var19 = tables.ComplexCol(itemsize=32, dflt=(1.+0.j))", "metadata": "root.Record", "header": "['module', '___EOS___']", "index": 386 }, { "content": "class TableReadTestCase(common.TempFileMixin, TestCase):\n nrows = 100\n\n\n\n\n\n\n", "metadata": "root.TableReadTestCase", "header": "['module', '___EOS___']", "index": 413 }, { "content": " def setUp(self):\n super(TableReadTestCase, self).setUp()\n\n # Create an instance of an HDF5 Table\n table = self.h5file.create_table(self.h5file.root, 'table', Record)\n for i in range(self.nrows):\n table.row.append() # Fill 100 rows with default values\n\n self._reopen(mode='a')", "metadata": "root.TableReadTestCase.setUp", "header": "['class', 'TableReadTestCase', '(', 'common', '.', 'TempFileMixin', ',', 'TestCase', ')', ':', '___EOS___']", "index": 416 }, { "content": " def test01_readTableChar(self):\n \"\"\"Checking column conversion into NumPy in read().\n\n Char flavor\n\n \"\"\"\n\n table = self.h5file.root.table\n table.flavor = \"numpy\"\n for colname in table.colnames:\n numcol = table.read(field=colname)\n typecol = table.coltypes[colname]\n itemsizecol = table.description._v_dtypes[colname].base.itemsize\n nctypecode = numcol.dtype.char\n if typecol == \"string\":\n if itemsizecol > 1:\n orignumcol = np.array(['abcd']*self.nrows, dtype='S4')\n else:\n orignumcol = np.array(['a']*self.nrows, dtype='S1')\n if common.verbose:\n print(\"Typecode of NumPy column read:\", nctypecode)\n print(\"Should look like:\", 'c')\n print(\"Itemsize of column:\", itemsizecol)\n print(\"Shape of NumPy column read:\", numcol.shape)\n print(\"Should look like:\", orignumcol.shape)\n print(\"First 3 elements of read col:\", numcol[:3])\n # Check that both NumPy objects are equal\n self.assertTrue(allequal(numcol, orignumcol, \"numpy\"))", "metadata": "root.TableReadTestCase.test01_readTableChar", "header": "['class', 'TableReadTestCase', '(', 'common', '.', 'TempFileMixin', ',', 'TestCase', ')', ':', '___EOS___']", "index": 426 }, { "content": " def test01_readTableNum(self):\n \"\"\"Checking column conversion into NumPy in read().\n\n NumPy flavor\n\n \"\"\"\n\n table = self.h5file.root.table\n table.flavor = \"numpy\"\n for colname in table.colnames:\n numcol = table.read(field=colname)\n typecol = table.coltypes[colname]\n nctypecode = np.typeNA[numcol.dtype.char[0]]\n if typecol != \"string\":\n if common.verbose:\n print(\"Typecode of NumPy column read:\", nctypecode)\n print(\"Should look like:\", typecol)\n orignumcol = np.ones(shape=self.nrows, dtype=numcol.dtype.char)\n # Check that both NumPy objects are equal\n self.assertTrue(allequal(numcol, orignumcol, \"numpy\"))", "metadata": "root.TableReadTestCase.test01_readTableNum", "header": "['class', 'TableReadTestCase', '(', 'common', '.', 'TempFileMixin', ',', 'TestCase', ')', ':', '___EOS___']", "index": 455 }, { "content": " def test02_readCoordsChar(self):\n \"\"\"Column conversion into NumPy in readCoords().\n\n Chars\n\n \"\"\"\n\n table = self.h5file.root.table\n table.flavor = \"numpy\"\n coords = [1, 2, 3]\n self.nrows = len(coords)\n for colname in table.colnames:\n numcol = table.read_coordinates(coords, field=colname)\n typecol = table.coltypes[colname]\n itemsizecol = table.description._v_dtypes[colname].base.itemsize\n nctypecode = numcol.dtype.char\n if typecol == \"string\":\n if itemsizecol > 1:\n orignumcol = np.array(['abcd']*self.nrows, dtype='S4')\n else:\n orignumcol = np.array(['a']*self.nrows, dtype='S1')\n if common.verbose:\n print(\"Typecode of NumPy column read:\", nctypecode)\n print(\"Should look like:\", 'c')\n print(\"Itemsize of column:\", itemsizecol)\n print(\"Shape of NumPy column read:\", numcol.shape)\n print(\"Should look like:\", orignumcol.shape)\n print(\"First 3 elements of read col:\", numcol[:3])\n # Check that both NumPy objects are equal\n self.assertTrue(allequal(numcol, orignumcol, \"numpy\"))", "metadata": "root.TableReadTestCase.test02_readCoordsChar", "header": "['class', 'TableReadTestCase', '(', 'common', '.', 'TempFileMixin', ',', 'TestCase', ')', ':', '___EOS___']", "index": 476 }, { "content": " def test02_readCoordsNum(self):\n \"\"\"Column conversion into NumPy in read_coordinates().\n\n NumPy.\n\n \"\"\"\n\n table = self.h5file.root.table\n table.flavor = \"numpy\"\n coords = [1, 2, 3]\n self.nrows = len(coords)\n for colname in table.colnames:\n numcol = table.read_coordinates(coords, field=colname)\n typecol = table.coltypes[colname]\n type_ = numcol.dtype.type\n if typecol != \"string\":\n if typecol == \"int64\":\n return\n if common.verbose:\n print(\"Type of read NumPy column:\", type_)\n print(\"Should look like:\", typecol)\n orignumcol = np.ones(shape=self.nrows, dtype=numcol.dtype.char)\n # Check that both NumPy objects are equal\n self.assertTrue(allequal(numcol, orignumcol, \"numpy\"))", "metadata": "root.TableReadTestCase.test02_readCoordsNum", "header": "['class', 'TableReadTestCase', '(', 'common', '.', 'TempFileMixin', ',', 'TestCase', ')', ':', '___EOS___']", "index": 507 }, { "content": " def test03_getIndexNumPy(self):\n \"\"\"Getting table rows specifyied as NumPy scalar integers.\"\"\"\n\n table = self.h5file.root.table\n coords = np.array([1, 2, 3], dtype='int8')\n for colname in table.colnames:\n numcol = [table[coord][colname] for coord in coords]\n typecol = table.coltypes[colname]\n if typecol != \"string\":\n if typecol == \"int64\":\n return\n numcol = np.array(numcol, typecol)\n if common.verbose:\n type_ = numcol.dtype.type\n print(\"Type of read NumPy column:\", type_)\n print(\"Should look like:\", typecol)\n orignumcol = np.ones(shape=len(numcol),\n dtype=numcol.dtype.char)\n # Check that both NumPy objects are equal\n self.assertTrue(allequal(numcol, orignumcol, \"numpy\"))", "metadata": "root.TableReadTestCase.test03_getIndexNumPy", "header": "['class', 'TableReadTestCase', '(', 'common', '.', 'TempFileMixin', ',', 'TestCase', ')', ':', '___EOS___']", "index": 532 }, { "content": " def test04_setIndexNumPy(self):\n \"\"\"Setting table rows specifyied as NumPy integers.\"\"\"\n\n self._reopen(mode='a')\n table = self.h5file.root.table\n table.flavor = \"numpy\"\n coords = np.array([1, 2, 3], dtype='int8')\n # Modify row 1\n # From PyTables 2.0 on, assignments to records can be done\n # only as tuples (see http://projects.scipy.org/scipy/numpy/ticket/315)\n # table[coords[0]] = [\"aasa\",\"x\"]+[232]*12\n\n n = len(Record.columns) - 2\n\n table[coords[0]] = tuple([\"aasa\", \"x\"]+[232]*n) # XXX\n # record = list(table[coords[0]])\n record = table.read(coords[0], coords[0] + 1)\n if common.verbose:\n print(\"Original row:\\n\"\n \"['aasa', 'x', True, -24, 232, 232, 232, 232, 232L, \"\n \"232, 232.0, 232.0, (232 + 0j), (232+0j), 232.0, \"\n \"(232+0j)]\\n\")\n print(\"Read row:\\n\", record)\n self.assertEqual(record['var1'], b'aasa')\n self.assertEqual(record['var2'], b'x')\n self.assertEqual(record['var3'], True)\n self.assertEqual(record['var4'], -24)\n self.assertEqual(record['var7'], 232)", "metadata": "root.TableReadTestCase.test04_setIndexNumPy", "header": "['class', 'TableReadTestCase', '(', 'common', '.', 'TempFileMixin', ',', 'TestCase', ')', ':', '___EOS___']", "index": 553 }, { "content": "class Info(tables.IsDescription):\n _v_pos = 3\n Name = StringCol(itemsize=2)\n Value = ComplexCol(itemsize=16)", "metadata": "root.Info", "header": "['module', '___EOS___']", "index": 584 }, { "content": "class TestTDescr(tables.IsDescription):\n\n \"\"\"A description that has several nested columns.\"\"\"\n\n x = Int32Col(dflt=0, shape=2, pos=0) # 0\n y = FloatCol(dflt=1, shape=(2, 2))\n z = UInt8Col(dflt=1)\n z3 = EnumCol({'r': 4, 'g': 2, 'b': 1}, 'r', 'int32', shape=2)\n color = StringCol(itemsize=4, dflt=b\"ab\", pos=2)\n info = Info()\n\n class Info(tables.IsDescription): # 1\n _v_pos = 1\n name = StringCol(itemsize=2)\n value = ComplexCol(itemsize=16, pos=0) # 0\n y2 = FloatCol(pos=1) # 1\n z2 = UInt8Col()\n\n class Info2(tables.IsDescription):\n y3 = Time64Col(shape=2)\n name = StringCol(itemsize=2)\n value = ComplexCol(itemsize=16, shape=2)", "metadata": "root.TestTDescr", "header": "['module', '___EOS___']", "index": 590 }, { "content": "class TableNativeFlavorTestCase(common.TempFileMixin, TestCase):\n nrows = 100\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n", "metadata": "root.TableNativeFlavorTestCase", "header": "['module', '___EOS___']", "index": 614 }, { "content": " def setUp(self):\n super(TableNativeFlavorTestCase, self).setUp()\n\n # Create an instance of an HDF5 Table\n table = self.h5file.create_table(self.h5file.root, 'table', TestTDescr,\n expectedrows=self.nrows)\n table.flavor = \"numpy\"\n for i in range(self.nrows):\n table.row.append() # Fill 100 rows with default values\n table.flush()", "metadata": "root.TableNativeFlavorTestCase.setUp", "header": "['class', 'TableNativeFlavorTestCase', '(', 'common', '.', 'TempFileMixin', ',', 'TestCase', ')', ':', '___EOS___']", "index": 617 }, { "content": " def test01a_basicTableRead(self):\n \"\"\"Checking the return of a NumPy in read().\"\"\"\n\n if self.close:\n self._reopen(mode='a')\n table = self.h5file.root.table\n data = table[:]\n if common.verbose:\n print(\"Type of read:\", type(data))\n print(\"Description of the record:\", data.dtype.descr)\n print(\"First 3 elements of read:\", data[:3])\n\n # Check that both NumPy objects are equal\n self.assertTrue(isinstance(data, np.ndarray))\n\n # Check the value of some columns\n # A flat column\n col = table.cols.x[:3]\n self.assertTrue(isinstance(col, np.ndarray))\n npcol = np.zeros((3, 2), dtype=\"int32\")\n self.assertTrue(allequal(col, npcol, \"numpy\"))\n\n # A nested column\n col = table.cols.Info[:3]\n self.assertTrue(isinstance(col, np.ndarray))\n dtype = [('value', 'c16'),\n ('y2', 'f8'),\n ('Info2',\n [('name', 'S2'),\n ('value', 'c16', (2,)),\n ('y3', 'f8', (2,))]),\n ('name', 'S2'),\n ('z2', 'u1')]\n npcol = np.zeros((3,), dtype=dtype)\n self.assertEqual(col.dtype.descr, npcol.dtype.descr)\n if common.verbose:\n print(\"col-->\", col)\n print(\"npcol-->\", npcol)\n\n # A copy() is needed in case the buffer can be in different segments\n self.assertEqual(bytes(col.copy().data), bytes(npcol.data))", "metadata": "root.TableNativeFlavorTestCase.test01a_basicTableRead", "header": "['class', 'TableNativeFlavorTestCase', '(', 'common', '.', 'TempFileMixin', ',', 'TestCase', ')', ':', '___EOS___']", "index": 628 }, { "content": " def test01b_basicTableRead(self):\n \"\"\"Checking the return of a NumPy in read() (strided version).\"\"\"\n\n if self.close:\n self._reopen(mode='a')\n table = self.h5file.root.table\n data = table[::3]\n if common.verbose:\n print(\"Type of read:\", type(data))\n print(\"Description of the record:\", data.dtype.descr)\n print(\"First 3 elements of read:\", data[:3])\n\n # Check that both NumPy objects are equal\n self.assertTrue(isinstance(data, np.ndarray))\n\n # Check the value of some columns\n # A flat column\n col = table.cols.x[:9:3]\n self.assertTrue(isinstance(col, np.ndarray))\n npcol = np.zeros((3, 2), dtype=\"int32\")\n self.assertTrue(allequal(col, npcol, \"numpy\"))\n\n # A nested column\n col = table.cols.Info[:9:3]\n self.assertTrue(isinstance(col, np.ndarray))\n dtype = [('value', '%sc16' % byteorder),\n ('y2', '%sf8' % byteorder),\n ('Info2',\n [('name', '|S2'),\n ('value', '%sc16' % byteorder, (2,)),\n ('y3', '%sf8' % byteorder, (2,))]),\n ('name', '|S2'),\n ('z2', '|u1')]\n npcol = np.zeros((3,), dtype=dtype)\n self.assertEqual(col.dtype.descr, npcol.dtype.descr)\n if common.verbose:\n print(\"col-->\", col)\n print(\"npcol-->\", npcol)\n\n # A copy() is needed in case the buffer can be in different segments\n self.assertEqual(bytes(col.copy().data), bytes(npcol.data))", "metadata": "root.TableNativeFlavorTestCase.test01b_basicTableRead", "header": "['class', 'TableNativeFlavorTestCase', '(', 'common', '.', 'TempFileMixin', ',', 'TestCase', ')', ':', '___EOS___']", "index": 670 }, { "content": " def test02_getWhereList(self):\n \"\"\"Checking the return of NumPy in get_where_list method.\"\"\"\n\n if self.close:\n self._reopen(mode='a')\n table = self.h5file.root.table\n data = table.get_where_list('z == 1')\n if common.verbose:\n print(\"Type of read:\", type(data))\n print(\"Description of the record:\", data.dtype.descr)\n print(\"First 3 elements of read:\", data[:3])\n\n # Check that both NumPy objects are equal\n self.assertTrue(isinstance(data, np.ndarray))\n\n # Check that all columns have been selected\n self.assertEqual(len(data), 100)\n\n # Finally, check that the contents are ok\n self.assertTrue(allequal(data, np.arange(100, dtype=\"i8\"), \"numpy\"))", "metadata": "root.TableNativeFlavorTestCase.test02_getWhereList", "header": "['class', 'TableNativeFlavorTestCase', '(', 'common', '.', 'TempFileMixin', ',', 'TestCase', ')', ':', '___EOS___']", "index": 712 }, { "content": " def test03a_readWhere(self):\n \"\"\"Checking the return of NumPy in read_where method (strings).\"\"\"\n\n table = self.h5file.root.table\n table.cols.color.create_index()\n if self.close:\n self._reopen(mode='a')\n table = self.h5file.root.table\n data = table.read_where('color == b\"ab\"')\n if common.verbose:\n print(\"Type of read:\", type(data))\n print(\"Length of the data read:\", len(data))\n\n # Check that both NumPy objects are equal\n self.assertTrue(isinstance(data, np.ndarray))\n\n # Check that all columns have been selected\n self.assertEqual(len(data), self.nrows)", "metadata": "root.TableNativeFlavorTestCase.test03a_readWhere", "header": "['class', 'TableNativeFlavorTestCase', '(', 'common', '.', 'TempFileMixin', ',', 'TestCase', ')', ':', '___EOS___']", "index": 733 }, { "content": " def test03b_readWhere(self):\n \"\"\"Checking the return of NumPy in read_where method (numeric).\"\"\"\n\n table = self.h5file.root.table\n table.cols.z.create_index()\n if self.close:\n self._reopen(mode='a')\n table = self.h5file.root.table\n data = table.read_where('z == 0')\n if common.verbose:\n print(\"Type of read:\", type(data))\n print(\"Length of the data read:\", len(data))\n\n # Check that both NumPy objects are equal\n self.assertTrue(isinstance(data, np.ndarray))\n\n # Check that all columns have been selected\n self.assertEqual(len(data), 0)", "metadata": "root.TableNativeFlavorTestCase.test03b_readWhere", "header": "['class', 'TableNativeFlavorTestCase', '(', 'common', '.', 'TempFileMixin', ',', 'TestCase', ')', ':', '___EOS___']", "index": 752 }, { "content": " def test04a_createTable(self):\n \"\"\"Checking the Table creation from a numpy recarray.\"\"\"\n\n dtype = [('value', '%sc16' % byteorder),\n ('y2', '%sf8' % byteorder),\n ('Info2',\n [('name', '|S2'),\n ('value', '%sc16' % byteorder, (2,)),\n ('y3', '%sf8' % byteorder, (2,))]),\n ('name', '|S2'),\n ('z2', '|u1')]\n npdata = np.zeros((3,), dtype=dtype)\n table = self.h5file.create_table(self.h5file.root, 'table2', npdata)\n if self.close:\n self._reopen(mode='a')\n table = self.h5file.root.table2\n data = table[:]\n if common.verbose:\n print(\"Type of read:\", type(data))\n print(\"Description of the record:\", data.dtype.descr)\n print(\"First 3 elements of read:\", data[:3])\n print(\"Length of the data read:\", len(data))\n\n # Check that both NumPy objects are equal\n self.assertTrue(isinstance(data, np.ndarray))\n\n # Check the type\n self.assertEqual(data.dtype.descr, npdata.dtype.descr)\n if common.verbose:\n print(\"npdata-->\", npdata)\n print(\"data-->\", data)\n\n # A copy() is needed in case the buffer would be in different segments\n self.assertEqual(bytes(data.copy().data), bytes(npdata.data))", "metadata": "root.TableNativeFlavorTestCase.test04a_createTable", "header": "['class', 'TableNativeFlavorTestCase', '(', 'common', '.', 'TempFileMixin', ',', 'TestCase', ')', ':', '___EOS___']", "index": 771 }, { "content": " def test04b_appendTable(self):\n \"\"\"Checking appending a numpy recarray.\"\"\"\n\n table = self.h5file.root.table\n npdata = table[3:6]\n table.append(npdata)\n if self.close:\n self._reopen(mode='a')\n table = self.h5file.root.table\n data = table[-3:]\n if common.verbose:\n print(\"Type of read:\", type(data))\n print(\"Description of the record:\", data.dtype.descr)\n print(\"Last 3 elements of read:\", data[-3:])\n print(\"Length of the data read:\", len(data))\n\n # Check that both NumPy objects are equal\n self.assertTrue(isinstance(data, np.ndarray))\n\n # Check the type\n self.assertEqual(data.dtype.descr, npdata.dtype.descr)\n if common.verbose:\n print(\"npdata-->\", npdata)\n print(\"data-->\", data)\n\n # A copy() is needed in case the buffer would be in different segments\n self.assertEqual(bytes(data.copy().data), bytes(npdata.data))", "metadata": "root.TableNativeFlavorTestCase.test04b_appendTable", "header": "['class', 'TableNativeFlavorTestCase', '(', 'common', '.', 'TempFileMixin', ',', 'TestCase', ')', ':', '___EOS___']", "index": 806 }, { "content": " def test05a_assignColumn(self):\n \"\"\"Checking assigning to a column.\"\"\"\n\n table = self.h5file.root.table\n table.cols.z[:] = np.zeros((100,), dtype='u1')\n if self.close:\n self._reopen(mode='a')\n table = self.h5file.root.table\n data = table.cols.z[:]\n if common.verbose:\n print(\"Type of read:\", type(data))\n print(\"Description of the record:\", data.dtype.descr)\n print(\"First 3 elements of read:\", data[:3])\n print(\"Length of the data read:\", len(data))\n\n # Check that both NumPy objects are equal\n self.assertTrue(isinstance(data, np.ndarray))\n\n # Check that all columns have been selected\n self.assertEqual(len(data), 100)\n\n # Finally, check that the contents are ok\n self.assertTrue(allequal(data, np.zeros((100,), dtype=\"u1\"), \"numpy\"))", "metadata": "root.TableNativeFlavorTestCase.test05a_assignColumn", "header": "['class', 'TableNativeFlavorTestCase', '(', 'common', '.', 'TempFileMixin', ',', 'TestCase', ')', ':', '___EOS___']", "index": 834 }, { "content": " def test05b_modifyingColumns(self):\n \"\"\"Checking modifying several columns at once.\"\"\"\n\n table = self.h5file.root.table\n xcol = np.ones((3, 2), 'int32')\n ycol = np.zeros((3, 2, 2), 'float64')\n zcol = np.zeros((3,), 'uint8')\n table.modify_columns(3, 6, 1, [xcol, ycol, zcol], ['x', 'y', 'z'])\n if self.close:\n self._reopen(mode='a')\n table = self.h5file.root.table\n data = table.cols.y[3:6]\n if common.verbose:\n print(\"Type of read:\", type(data))\n print(\"Description of the record:\", data.dtype.descr)\n print(\"First 3 elements of read:\", data[:3])\n print(\"Length of the data read:\", len(data))\n\n # Check that both NumPy objects are equal\n self.assertTrue(isinstance(data, np.ndarray))\n\n # Check the type\n self.assertEqual(data.dtype.descr, ycol.dtype.descr)\n if common.verbose:\n print(\"ycol-->\", ycol)\n print(\"data-->\", data)\n\n # A copy() is needed in case the buffer would be in different segments\n self.assertEqual(data.copy().data, ycol.data)", "metadata": "root.TableNativeFlavorTestCase.test05b_modifyingColumns", "header": "['class', 'TableNativeFlavorTestCase', '(', 'common', '.', 'TempFileMixin', ',', 'TestCase', ')', ':', '___EOS___']", "index": 858 }, { "content": " def test05c_modifyingColumns(self):\n \"\"\"Checking modifying several columns using a single numpy buffer.\"\"\"\n\n table = self.h5file.root.table\n dtype = [('x', 'i4', (2,)), ('y', 'f8', (2, 2)), ('z', 'u1')]\n nparray = np.zeros((3,), dtype=dtype)\n table.modify_columns(3, 6, 1, nparray, ['x', 'y', 'z'])\n if self.close:\n self._reopen(mode='a')\n table = self.h5file.root.table\n ycol = np.zeros((3, 2, 2), 'float64')\n data = table.cols.y[3:6]\n if common.verbose:\n print(\"Type of read:\", type(data))\n print(\"Description of the record:\", data.dtype.descr)\n print(\"First 3 elements of read:\", data[:3])\n print(\"Length of the data read:\", len(data))\n\n # Check that both NumPy objects are equal\n self.assertTrue(isinstance(data, np.ndarray))\n\n # Check the type\n self.assertEqual(data.dtype.descr, ycol.dtype.descr)\n if common.verbose:\n print(\"ycol-->\", ycol)\n print(\"data-->\", data)\n\n # A copy() is needed in case the buffer would be in different segments\n self.assertEqual(data.copy().data, ycol.data)", "metadata": "root.TableNativeFlavorTestCase.test05c_modifyingColumns", "header": "['class', 'TableNativeFlavorTestCase', '(', 'common', '.', 'TempFileMixin', ',', 'TestCase', ')', ':', '___EOS___']", "index": 888 }, { "content": " def test06a_assignNestedColumn(self):\n \"\"\"Checking assigning a nested column (using modify_column).\"\"\"\n\n table = self.h5file.root.table\n dtype = [('value', '%sc16' % byteorder),\n ('y2', '%sf8' % byteorder),\n ('Info2',\n [('name', '|S2'),\n ('value', '%sc16' % byteorder, (2,)),\n ('y3', '%sf8' % byteorder, (2,))]),\n ('name', '|S2'),\n ('z2', '|u1')]\n npdata = np.zeros((3,), dtype=dtype)\n data = table.cols.Info[3:6]\n table.modify_column(3, 6, 1, column=npdata, colname='Info')\n if self.close:\n self._reopen(mode='a')\n table = self.h5file.root.table\n data = table.cols.Info[3:6]\n if common.verbose:\n print(\"Type of read:\", type(data))\n print(\"Description of the record:\", data.dtype.descr)\n print(\"First 3 elements of read:\", data[:3])\n print(\"Length of the data read:\", len(data))\n\n # Check that both NumPy objects are equal\n self.assertTrue(isinstance(data, np.ndarray))\n\n # Check the type\n self.assertEqual(data.dtype.descr, npdata.dtype.descr)\n if common.verbose:\n print(\"npdata-->\", npdata)\n print(\"data-->\", data)\n\n # A copy() is needed in case the buffer would be in different segments\n self.assertEqual(bytes(data.copy().data), bytes(npdata.data))", "metadata": "root.TableNativeFlavorTestCase.test06a_assignNestedColumn", "header": "['class', 'TableNativeFlavorTestCase', '(', 'common', '.', 'TempFileMixin', ',', 'TestCase', ')', ':', '___EOS___']", "index": 918 }, { "content": " def test06b_assignNestedColumn(self):\n \"\"\"Checking assigning a nested column (using the .cols accessor).\"\"\"\n\n table = self.h5file.root.table\n dtype = [('value', '%sc16' % byteorder),\n ('y2', '%sf8' % byteorder),\n ('Info2',\n [('name', '|S2'),\n ('value', '%sc16' % byteorder, (2,)),\n ('y3', '%sf8' % byteorder, (2,))]),\n ('name', '|S2'),\n ('z2', '|u1')]\n npdata = np.zeros((3,), dtype=dtype)\n #self.assertRaises(NotImplementedError,\n # table.cols.Info.__setitem__, slice(3,6,1), npdata)\n table.cols.Info[3:6] = npdata\n if self.close:\n self._reopen(mode='a')\n table = self.h5file.root.table\n data = table.cols.Info[3:6]\n if common.verbose:\n print(\"Type of read:\", type(data))\n print(\"Description of the record:\", data.dtype.descr)\n print(\"First 3 elements of read:\", data[:3])\n print(\"Length of the data read:\", len(data))\n\n # Check that both NumPy objects are equal\n self.assertTrue(isinstance(data, np.ndarray))\n\n # Check the type\n self.assertEqual(data.dtype.descr, npdata.dtype.descr)\n if common.verbose:\n print(\"npdata-->\", npdata)\n print(\"data-->\", data)\n\n # A copy() is needed in case the buffer would be in different segments\n self.assertEqual(bytes(data.copy().data), bytes(npdata.data))", "metadata": "root.TableNativeFlavorTestCase.test06b_assignNestedColumn", "header": "['class', 'TableNativeFlavorTestCase', '(', 'common', '.', 'TempFileMixin', ',', 'TestCase', ')', ':', '___EOS___']", "index": 955 }, { "content": " def test07a_modifyingRows(self):\n \"\"\"Checking modifying several rows at once (using modify_rows).\"\"\"\n\n table = self.h5file.root.table\n\n # Read a chunk of the table\n chunk = table[0:3]\n\n # Modify it somewhat\n chunk['y'][:] = -1\n table.modify_rows(3, 6, 1, rows=chunk)\n if self.close:\n self._reopen(mode='a')\n table = self.h5file.root.table\n ycol = np.zeros((3, 2, 2), 'float64')-1\n data = table.cols.y[3:6]\n if common.verbose:\n print(\"Type of read:\", type(data))\n print(\"Description of the record:\", data.dtype.descr)\n print(\"First 3 elements of read:\", data[:3])\n print(\"Length of the data read:\", len(data))\n\n # Check that both NumPy objects are equal\n self.assertTrue(isinstance(data, np.ndarray))\n\n # Check the type\n self.assertEqual(data.dtype.descr, ycol.dtype.descr)\n if common.verbose:\n print(\"ycol-->\", ycol)\n print(\"data-->\", data)\n self.assertTrue(allequal(ycol, data, \"numpy\"))", "metadata": "root.TableNativeFlavorTestCase.test07a_modifyingRows", "header": "['class', 'TableNativeFlavorTestCase', '(', 'common', '.', 'TempFileMixin', ',', 'TestCase', ')', ':', '___EOS___']", "index": 993 }, { "content": " def test07b_modifyingRows(self):\n \"\"\"Checking modifying several rows at once (using cols accessor).\"\"\"\n\n table = self.h5file.root.table\n\n # Read a chunk of the table\n chunk = table[0:3]\n\n # Modify it somewhat\n chunk['y'][:] = -1\n table.cols[3:6] = chunk\n if self.close:\n self._reopen(mode='a')\n table = self.h5file.root.table\n\n # Check that some column has been actually modified\n ycol = np.zeros((3, 2, 2), 'float64')-1\n data = table.cols.y[3:6]\n if common.verbose:\n print(\"Type of read:\", type(data))\n print(\"Description of the record:\", data.dtype.descr)\n print(\"First 3 elements of read:\", data[:3])\n print(\"Length of the data read:\", len(data))\n\n # Check that both NumPy objects are equal\n self.assertTrue(isinstance(data, np.ndarray))\n\n # Check the type\n self.assertEqual(data.dtype.descr, ycol.dtype.descr)\n if common.verbose:\n print(\"ycol-->\", ycol)\n print(\"data-->\", data)\n self.assertTrue(allequal(ycol, data, \"numpy\"))", "metadata": "root.TableNativeFlavorTestCase.test07b_modifyingRows", "header": "['class', 'TableNativeFlavorTestCase', '(', 'common', '.', 'TempFileMixin', ',', 'TestCase', ')', ':', '___EOS___']", "index": 1025 }, { "content": " def test08a_modifyingRows(self):\n \"\"\"Checking modifying just one row at once (using modify_rows).\"\"\"\n\n table = self.h5file.root.table\n\n # Read a chunk of the table\n chunk = table[3:4]\n\n # Modify it somewhat\n chunk['y'][:] = -1\n table.modify_rows(6, 7, 1, chunk)\n if self.close:\n self._reopen(mode='a')\n table = self.h5file.root.table\n\n # Check that some column has been actually modified\n ycol = np.zeros((2, 2), 'float64')-1\n data = table.cols.y[6]\n if common.verbose:\n print(\"Type of read:\", type(data))\n print(\"Description of the record:\", data.dtype.descr)\n print(\"First 3 elements of read:\", data[:3])\n print(\"Length of the data read:\", len(data))\n\n # Check that both NumPy objects are equal\n self.assertTrue(isinstance(data, np.ndarray))\n\n # Check the type\n self.assertEqual(data.dtype.descr, ycol.dtype.descr)\n if common.verbose:\n print(\"ycol-->\", ycol)\n print(\"data-->\", data)\n self.assertTrue(allequal(ycol, data, \"numpy\"))", "metadata": "root.TableNativeFlavorTestCase.test08a_modifyingRows", "header": "['class', 'TableNativeFlavorTestCase', '(', 'common', '.', 'TempFileMixin', ',', 'TestCase', ')', ':', '___EOS___']", "index": 1059 }, { "content": " def test08b_modifyingRows(self):\n \"\"\"Checking modifying just one row at once (using cols accessor).\"\"\"\n\n table = self.h5file.root.table\n\n # Read a chunk of the table\n chunk = table[3:4]\n\n # Modify it somewhat\n chunk['y'][:] = -1\n table.cols[6] = chunk\n if self.close:\n self._reopen(mode='a')\n table = self.h5file.root.table\n\n # Check that some column has been actually modified\n ycol = np.zeros((2, 2), 'float64')-1\n data = table.cols.y[6]\n if common.verbose:\n print(\"Type of read:\", type(data))\n print(\"Description of the record:\", data.dtype.descr)\n print(\"First 3 elements of read:\", data[:3])\n print(\"Length of the data read:\", len(data))\n\n # Check that both NumPy objects are equal\n self.assertTrue(isinstance(data, np.ndarray))\n\n # Check the type\n self.assertEqual(data.dtype.descr, ycol.dtype.descr)\n if common.verbose:\n print(\"ycol-->\", ycol)\n print(\"data-->\", data)\n self.assertTrue(allequal(ycol, data, \"numpy\"))", "metadata": "root.TableNativeFlavorTestCase.test08b_modifyingRows", "header": "['class', 'TableNativeFlavorTestCase', '(', 'common', '.', 'TempFileMixin', ',', 'TestCase', ')', ':', '___EOS___']", "index": 1093 }, { "content": " def test09a_getStrings(self):\n \"\"\"Checking the return of string columns with spaces.\"\"\"\n\n if self.close:\n self._reopen(mode='a')\n table = self.h5file.root.table\n rdata = table.get_where_list('color == b\"ab\"')\n data = table.read_coordinates(rdata)\n if common.verbose:\n print(\"Type of read:\", type(data))\n print(\"Description of the record:\", data.dtype.descr)\n print(\"First 3 elements of read:\", data[:3])\n\n # Check that both NumPy objects are equal\n self.assertTrue(isinstance(data, np.ndarray))\n\n # Check that all columns have been selected\n self.assertEqual(len(data), 100)\n\n # Finally, check that the contents are ok\n for idata in data['color']:\n self.assertEqual(idata, np.array(\"ab\", dtype=\"|S4\"))", "metadata": "root.TableNativeFlavorTestCase.test09a_getStrings", "header": "['class', 'TableNativeFlavorTestCase', '(', 'common', '.', 'TempFileMixin', ',', 'TestCase', ')', ':', '___EOS___']", "index": 1127 }, { "content": " def test09b_getStrings(self):\n \"\"\"Checking the return of string columns with spaces.\n\n (modify)\n\n \"\"\"\n\n if self.close:\n self._reopen(mode='a')\n table = self.h5file.root.table\n for i in range(50):\n table.cols.color[i] = \"a \"\n table.flush()\n data = table[:]\n if common.verbose:\n print(\"Type of read:\", type(data))\n print(\"Description of the record:\", data.dtype.descr)\n print(\"First 3 elements of read:\", data[:3])\n\n # Check that both NumPy objects are equal\n self.assertTrue(isinstance(data, np.ndarray))\n\n # Check that all columns have been selected\n self.assertEqual(len(data), 100)\n\n # Finally, check that the contents are ok\n for i in range(100):\n idata = data['color'][i]\n if i >= 50:\n self.assertEqual(idata, np.array(\"ab\", dtype=\"|S4\"))\n else:\n self.assertEqual(idata, np.array(\"a \", dtype=\"|S4\"))", "metadata": "root.TableNativeFlavorTestCase.test09b_getStrings", "header": "['class', 'TableNativeFlavorTestCase', '(', 'common', '.', 'TempFileMixin', ',', 'TestCase', ')', ':', '___EOS___']", "index": 1150 }, { "content": " def test09c_getStrings(self):\n \"\"\"Checking the return of string columns with spaces.\n\n (append)\n\n \"\"\"\n\n if self.close:\n self._reopen(mode='a')\n table = self.h5file.root.table\n row = table.row\n for i in range(50):\n row[\"color\"] = \"a \" # note the trailing spaces\n row.append()\n table.flush()\n if self.close:\n self.h5file.close()\n self.h5file = tables.open_file(self.h5fname, \"a\")\n data = self.h5file.root.table[:]\n if common.verbose:\n print(\"Type of read:\", type(data))\n print(\"Description of the record:\", data.dtype.descr)\n print(\"First 3 elements of read:\", data[:3])\n\n # Check that both NumPy objects are equal\n self.assertTrue(isinstance(data, np.ndarray))\n\n # Check that all columns have been selected\n self.assertEqual(len(data), 150)\n\n # Finally, check that the contents are ok\n for i in range(150):\n idata = data['color'][i]\n if i < 100:\n self.assertEqual(idata, np.array(\"ab\", dtype=\"|S4\"))\n else:\n self.assertEqual(idata, np.array(\"a \", dtype=\"|S4\"))", "metadata": "root.TableNativeFlavorTestCase.test09c_getStrings", "header": "['class', 'TableNativeFlavorTestCase', '(', 'common', '.', 'TempFileMixin', ',', 'TestCase', ')', ':', '___EOS___']", "index": 1183 }, { "content": "class TableNativeFlavorOpenTestCase(TableNativeFlavorTestCase):\n close = 0", "metadata": "root.TableNativeFlavorOpenTestCase", "header": "['module', '___EOS___']", "index": 1222 }, { "content": "class TableNativeFlavorCloseTestCase(TableNativeFlavorTestCase):\n close = 1", "metadata": "root.TableNativeFlavorCloseTestCase", "header": "['module', '___EOS___']", "index": 1226 }, { "content": "class AttributesTestCase(common.TempFileMixin, TestCase):\n\n", "metadata": "root.AttributesTestCase", "header": "['module', '___EOS___']", "index": 1230 }, { "content": " def setUp(self):\n super(AttributesTestCase, self).setUp()\n\n # Create an instance of an HDF5 Table\n self.h5file.create_group(self.h5file.root, 'group')", "metadata": "root.AttributesTestCase.setUp", "header": "['class', 'AttributesTestCase', '(', 'common', '.', 'TempFileMixin', ',', 'TestCase', ')', ':', '___EOS___']", "index": 1231 }, { "content": " def test01_writeAttribute(self):\n \"\"\"Checking the creation of a numpy attribute.\"\"\"\n\n group = self.h5file.root.group\n g_attrs = group._v_attrs\n g_attrs.numpy1 = np.zeros((1, 1), dtype='int16')\n if self.close:\n self._reopen(mode='a')\n group = self.h5file.root.group\n g_attrs = group._v_attrs\n\n # Check that we can retrieve a numpy object\n data = g_attrs.numpy1\n npcomp = np.zeros((1, 1), dtype='int16')\n\n # Check that both NumPy objects are equal\n self.assertTrue(isinstance(data, np.ndarray))\n\n # Check the type\n self.assertEqual(data.dtype.descr, npcomp.dtype.descr)\n if common.verbose:\n print(\"npcomp-->\", npcomp)\n print(\"data-->\", data)\n self.assertTrue(allequal(npcomp, data, \"numpy\"))", "metadata": "root.AttributesTestCase.test01_writeAttribute", "header": "['class', 'AttributesTestCase', '(', 'common', '.', 'TempFileMixin', ',', 'TestCase', ')', ':', '___EOS___']", "index": 1237 }, { "content": " def test02_updateAttribute(self):\n \"\"\"Checking the modification of a numpy attribute.\"\"\"\n\n group = self.h5file.root.group\n g_attrs = group._v_attrs\n g_attrs.numpy1 = np.zeros((1, 2), dtype='int16')\n if self.close:\n self._reopen(mode='a')\n group = self.h5file.root.group\n g_attrs = group._v_attrs\n\n # Update this attribute\n g_attrs.numpy1 = np.ones((1, 2), dtype='int16')\n\n # Check that we can retrieve a numpy object\n data = g_attrs.numpy1\n npcomp = np.ones((1, 2), dtype='int16')\n\n # Check that both NumPy objects are equal\n self.assertTrue(isinstance(data, np.ndarray))\n\n # Check the type\n self.assertEqual(data.dtype.descr, npcomp.dtype.descr)\n if common.verbose:\n print(\"npcomp-->\", npcomp)\n print(\"data-->\", data)\n self.assertTrue(allequal(npcomp, data, \"numpy\"))", "metadata": "root.AttributesTestCase.test02_updateAttribute", "header": "['class', 'AttributesTestCase', '(', 'common', '.', 'TempFileMixin', ',', 'TestCase', ')', ':', '___EOS___']", "index": 1262 }, { "content": "class AttributesOpenTestCase(AttributesTestCase):\n close = 0", "metadata": "root.AttributesOpenTestCase", "header": "['module', '___EOS___']", "index": 1291 }, { "content": "class AttributesCloseTestCase(AttributesTestCase):\n close = 1", "metadata": "root.AttributesCloseTestCase", "header": "['module', '___EOS___']", "index": 1295 }, { "content": "class StrlenTestCase(common.TempFileMixin, TestCase):\n\n\n", "metadata": "root.StrlenTestCase", "header": "['module', '___EOS___']", "index": 1299 }, { "content": " def setUp(self):\n super(StrlenTestCase, self).setUp()\n\n # Create an instance of an HDF5 Table\n group = self.h5file.create_group(self.h5file.root, 'group')\n tablelayout = {'Text': StringCol(itemsize=1000), }\n self.table = self.h5file.create_table(group, 'table', tablelayout)\n self.table.flavor = 'numpy'\n row = self.table.row\n row['Text'] = 'Hello Francesc!' # XXX: check unicode --> bytes\n row.append()\n row['Text'] = 'Hola Francesc!' # XXX: check unicode --> bytes\n row.append()\n self.table.flush()", "metadata": "root.StrlenTestCase.setUp", "header": "['class', 'StrlenTestCase', '(', 'common', '.', 'TempFileMixin', ',', 'TestCase', ')', ':', '___EOS___']", "index": 1300 }, { "content": " def test01(self):\n \"\"\"Checking the lengths of strings (read field).\"\"\"\n\n if self.close:\n self._reopen(mode='a')\n self.table = self.h5file.root.group.table\n\n # Get both strings\n str1 = self.table.col('Text')[0]\n str2 = self.table.col('Text')[1]\n if common.verbose:\n print(\"string1-->\", str1)\n print(\"string2-->\", str2)\n\n # Check that both NumPy objects are equal\n self.assertEqual(len(str1), len(b'Hello Francesc!'))\n self.assertEqual(len(str2), len(b'Hola Francesc!'))\n self.assertEqual(str1, b'Hello Francesc!')\n self.assertEqual(str2, b'Hola Francesc!')", "metadata": "root.StrlenTestCase.test01", "header": "['class', 'StrlenTestCase', '(', 'common', '.', 'TempFileMixin', ',', 'TestCase', ')', ':', '___EOS___']", "index": 1315 }, { "content": " def test02(self):\n \"\"\"Checking the lengths of strings (read recarray).\"\"\"\n\n if self.close:\n self._reopen(mode='a')\n self.table = self.h5file.root.group.table\n\n # Get both strings\n str1 = self.table[:]['Text'][0]\n str2 = self.table[:]['Text'][1]\n\n # Check that both NumPy objects are equal\n self.assertEqual(len(str1), len(b'Hello Francesc!'))\n self.assertEqual(len(str2), len(b'Hola Francesc!'))\n self.assertEqual(str1, b'Hello Francesc!')\n self.assertEqual(str2, b'Hola Francesc!')", "metadata": "root.StrlenTestCase.test02", "header": "['class', 'StrlenTestCase', '(', 'common', '.', 'TempFileMixin', ',', 'TestCase', ')', ':', '___EOS___']", "index": 1335 }, { "content": " def test03(self):\n \"\"\"Checking the lengths of strings (read recarray, row by row).\"\"\"\n\n if self.close:\n self._reopen(mode='a')\n self.table = self.h5file.root.group.table\n\n # Get both strings\n str1 = self.table[0]['Text']\n str2 = self.table[1]['Text']\n\n # Check that both NumPy objects are equal\n self.assertEqual(len(str1), len(b'Hello Francesc!'))\n self.assertEqual(len(str2), len(b'Hola Francesc!'))\n self.assertEqual(str1, b'Hello Francesc!')\n self.assertEqual(str2, b'Hola Francesc!')", "metadata": "root.StrlenTestCase.test03", "header": "['class', 'StrlenTestCase', '(', 'common', '.', 'TempFileMixin', ',', 'TestCase', ')', ':', '___EOS___']", "index": 1352 }, { "content": "class StrlenOpenTestCase(StrlenTestCase):\n close = 0", "metadata": "root.StrlenOpenTestCase", "header": "['module', '___EOS___']", "index": 1370 }, { "content": "class StrlenCloseTestCase(StrlenTestCase):\n close = 1", "metadata": "root.StrlenCloseTestCase", "header": "['module', '___EOS___']", "index": 1374 }, { "content": "def suite():\n theSuite = unittest.TestSuite()\n niter = 1\n\n # theSuite.addTest(unittest.makeSuite(StrlenOpenTestCase))\n # theSuite.addTest(unittest.makeSuite(Basic0DOneTestCase))\n # theSuite.addTest(unittest.makeSuite(GroupsArrayTestCase))\n for i in range(niter):\n theSuite.addTest(unittest.makeSuite(Basic0DOneTestCase))\n theSuite.addTest(unittest.makeSuite(Basic0DTwoTestCase))\n theSuite.addTest(unittest.makeSuite(Basic1DOneTestCase))\n theSuite.addTest(unittest.makeSuite(Basic1DTwoTestCase))\n theSuite.addTest(unittest.makeSuite(Basic1DThreeTestCase))\n theSuite.addTest(unittest.makeSuite(Basic2DTestCase))\n theSuite.addTest(unittest.makeSuite(GroupsArrayTestCase))\n theSuite.addTest(unittest.makeSuite(TableReadTestCase))\n theSuite.addTest(unittest.makeSuite(TableNativeFlavorOpenTestCase))\n theSuite.addTest(unittest.makeSuite(TableNativeFlavorCloseTestCase))\n theSuite.addTest(unittest.makeSuite(AttributesOpenTestCase))\n theSuite.addTest(unittest.makeSuite(AttributesCloseTestCase))\n theSuite.addTest(unittest.makeSuite(StrlenOpenTestCase))\n theSuite.addTest(unittest.makeSuite(StrlenCloseTestCase))\n if common.heavy:\n theSuite.addTest(unittest.makeSuite(Basic10DTestCase))\n # The 32 dimensions case takes forever to run!!\n # theSuite.addTest(unittest.makeSuite(Basic32DTestCase))\n return theSuite", "metadata": "root.suite", "header": "['module', '___EOS___']", "index": 1378 } ]
[]
[]
0
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "-*-", " ", "codi", "ng", ":", " ", "utf", "-", "8", " ", "-*-", "_", "\\u\\u\\uNL\\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_", "from_", "\\u\\u", "future\\u\\u_", "import_", "abs", "olute", "\\u", "import_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "tempfile_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "numpy_", "as_", "np_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "tables_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "tables_", "import_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "String", "Col_", ",_", "Boo", "l", "Col_", ",_", "Float", "Col_", ",_", "Comple", "x", "Col_", ",_", "Enum", "Col_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Int", "8", "Col_", ",_", "UI", "nt", "8", "Col_", ",_", "Int", "16", "Col_", ",_", "UI", "nt", "16", "Col_", ",_", "Int", "32", "Col_", ",_", "UI", "nt", "32", "Col_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Int64", "Col_", ",_", "Float", "32", "Col_", ",_", "Float", "64", "Col_", ",_", "Time", "64", "Col_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "tables_", "._", "tests_", "import_", "common_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "tables_", "._", "tests_", "._", "common_", "import_", "alle", "qual_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "tables_", "._", "tests_", "._", "common_", "import_", "unittest_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "tables_", "._", "tests_", "._", "common_", "import_", "Py", "Table", "s", "Test", "Case_", "as_", "Test", "Case_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "six_", "._", "moves_", "import_", "range_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "typec", "odes_", "=_", "[_", "'", "b", "'_", ",_", "'", "h", "'_", ",_", "'", "i", "'_", ",_", "'", "l", "'_", ",_", "'", "q", "'_", ",_", "'", "f", "'_", ",_", "'", "d", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "UI", "nt", "64", " ", "checking", " ", "disable", "d", " ", "on", " ", "win", " ", "platforms_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "bec", "aus", "e", " ", "this", " ", "type", " ", "is", " ", "not", " ", "supported_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "sys_", "._", "platform_", "!=_", "'", "win32", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "typec", "odes_", "+=_", "[_", "'", "B", "'_", ",_", "'", "H", "'_", ",_", "'", "I", "'_", ",_", "'", "L", "'_", ",_", "'", "Q", "'_", ",_", "'", "F", "'_", ",_", "'", "D", "'_", "]_", "\\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 ", " _", "typec", "odes_", "+=_", "[_", "'", "B", "'_", ",_", "'", "H", "'_", ",_", "'", "I", "'_", ",_", "'", "L", "'_", ",_", "'", "F", "'_", ",_", "'", "D", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "typec", "odes_", "+=_", "[_", "'", "b1", "'_", "]_", "#", " ", "boolean_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "hasattr_", "(_", "tables_", ",_", "'", "Float", "16", "Atom", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "typec", "odes_", "._", "append_", "(_", "'", "e", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "hasattr_", "(_", "tables_", ",_", "'", "Float", "96", "Atom", "'_", ")_", "or_", "hasattr_", "(_", "tables_", ",_", "'", "Float", "128", "Atom", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "typec", "odes_", "._", "append_", "(_", "'", "g", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "hasattr_", "(_", "tables_", ",_", "'", "Comple", "x1", "9", "2", "Atom", "'_", ")_", "or_", "hasattr_", "(_", "tables_", ",_", "'", "Con", "plex", "256", "Atom", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "typec", "odes_", "._", "append_", "(_", "'", "G", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "byteorder_", "=_", "{_", "'", "litt", "le", "'_", ":_", "'<'_", ",_", "'", "big", "'_", ":_", "'>'_", "}_", "[_", "sys_", "._", "byteorder_", "]_", "\\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_", "#", " ", "class", " ", "Basic", "32", "DT", "est", "Case", "(", "Basic", "Test", "Case", "):", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "#", " ", "32", "D", " ", "case", " ", "(", "maxim", "um", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "tuple", "Int", " ", "=", " ", "reshape", "(", "np", ".", "array", "((", "2", "2", ",)", "),", " ", "(", "1", ",)", "*", "32", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "#", " ", "String", "s", " ", "see", "ms", " ", "to", " ", "be", " ", "very", " ", "slow", " ", "with", " ", "some", "what", " ", "large", " ", "dimensions_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "#", " ", "Thi", "s", " ", "shou", "ld", " ", "not", " ", "be", " ", "run", " ", "unl", "ess", " ", "the", " ", "numa", "rray", " ", "people", " ", "address", " ", "this", " ", "problem_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "#", " ", "F", ".", " ", "Alt", "ed", " ", "2006", "-0", "1", "-0", "4_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "tuple", "Char", " ", "=", " ", "np", ".", "array", "(", "tuple", "Int", ",", " ", "dt", "ype", "=\"", "S1", "\")", "_", "\\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_", "#", " ", "Test", " ", "Record", " ", "class_", "\\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_", "#", " ", "The", " ", "declaration", " ", "of", " ", "the", " ", "nest", "ed", " ", "table", ":_", "\\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\\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 ", " _", "common_", "._", "parse", "\\u", "argv_", "(_", "sys_", "._", "argv_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "common_", "._", "print", "\\u", "versions_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "unittest_", "._", "main_", "(_", "default", "Test_", "=_", "'", "suit", "e", "'_", ")_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Basic", "Test", "Case_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Basic", " ", "test", " ", "for", " ", "all", " ", "the", " ", "support", "ed", " ", "typec", "odes", " ", "presen", "t", " ", "in", " ", "Num", "Py", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "All", " ", "of", " ", "them", " ", "are", " ", "include", "d", " ", "on", " ", "Py", "Table", "s", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "endian", "check_", "=_", "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\\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_", "Basic", "Test", "Case_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "Write", "Read_", "(_", "self_", ",_", "test", "Array_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "common_", "._", "verbose_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "'\\\\", "n", "'_", ",_", "'-", "='_", "*_", "30_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "\"", "Run", "ning", " ", "test", " ", "for", " ", "array", " ", "with", " ", "typec", "ode", " ", "'%", "s", "'\"_", "%_", "\\u\\u\\uNL\\u\\u\\u_", "test", "Array_", "._", "dtype_", "._", "char_", ",_", "end_", "=_", "'", " ", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "\"", "for", " ", "class", " ", "check", ":\"_", ",_", "self_", "._", "title_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Creat", "e", " ", "an", " ", "instance", " ", "of", " ", "HDF", "5", " ", "Table_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "h5", "fname_", "=_", "tempfile_", "._", "mktemp_", "(_", "\".", "h5", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "with_", "tables_", "._", "open", "\\u", "file_", "(_", "self_", "._", "h5", "fname_", ",_", "mode_", "=_", "\"", "w", "\"_", ")_", "as_", "self_", "._", "h5file", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "root_", "=_", "self_", "._", "h5file", "_", "._", "root_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Creat", "e", " ", "the", " ", "array", " ", "under", " ", "root", " ", "and", " ", "name", " ", "'", "some", "array", "'_", "\\u\\u\\uNL\\u\\u\\u_", "a_", "=_", "test", "Array_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "create", "\\u", "array_", "(_", "self_", "._", "root_", ",_", "'", "some", "array", "'_", ",_", "a_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Some", " ", "array", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Re", "-", "open", " ", "the", " ", "file", " ", "in", " ", "read", "-", "only", " ", "mode_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "with_", "tables_", "._", "open", "\\u", "file_", "(_", "self_", "._", "h5", "fname_", ",_", "mode_", "=_", "\"", "r", "\"_", ")_", "as_", "self_", "._", "h5file", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "root_", "=_", "self_", "._", "h5file", "_", "._", "root_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Read", " ", "the", " ", "saved", " ", "array_", "\\u\\u\\uNL\\u\\u\\u_", "b_", "=_", "self_", "._", "root_", "._", "some", "array_", "._", "read_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "For", " ", "case", "s", " ", "tha", "t", " ", "read", " ", "return", "s", " ", "a", " ", "python", " ", "type", " ", "inst", "ead", " ", "of", " ", "a_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "nump", "y", " ", "type_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "hasattr_", "(_", "b_", ",_", "\"", "shape", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "b_", "=_", "np_", "._", "np_", "._", "array_", "(_", "b_", ",_", "dtype_", "=_", "a_", "._", "dtype_", "._", "str_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Compare", " ", "them", ".", " ", "The", "y", " ", "shou", "ld", " ", "be", " ", "equal", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "if", " ", "not", " ", "alle", "qual", "(", "a", ",", "b", ",", " ", "\"", "nump", "y", "\")", " ", "and", " ", "common", ".", "verbo", "se", ":_", "\\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_", "(_", "\"", "Array", " ", "writt", "en", ":\"_", ",_", "a_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "\"", "Array", " ", "writt", "en", " ", "shape", ":\"_", ",_", "a_", "._", "shape_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "\"", "Array", " ", "writt", "en", " ", "items", "ize", ":\"_", ",_", "a_", "._", "itemsize_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "\"", "Array", " ", "writt", "en", " ", "type", ":\"_", ",_", "a_", "._", "dtype_", "._", "char_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "\"", "Array", " ", "read", ":\"_", ",_", "b_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "\"", "Array", " ", "read", " ", "shape", ":\"_", ",_", "b_", "._", "shape_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "\"", "Array", " ", "read", " ", "items", "ize", ":\"_", ",_", "b_", "._", "itemsize_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "\"", "Array", " ", "read", " ", "type", ":\"_", ",_", "b_", "._", "dtype_", "._", "char_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "type\\u_", "=_", "self_", "._", "root_", "._", "some", "array_", "._", "atom_", "._", "type_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Check", " ", "strict", "ly", " ", "the", " ", "array", " ", "equality", "_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "type_", "(_", "a_", ")_", ",_", "type_", "(_", "b_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "a_", "._", "shape_", ",_", "b_", "._", "shape_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "a_", "._", "shape_", ",_", "self_", "._", "root_", "._", "some", "array_", "._", "shape_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "a_", "._", "dtype_", ",_", "b_", "._", "dtype_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "a_", "._", "dtype_", "._", "char_", "[_", "0_", "]_", "==_", "\"", "S", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "self_", "._", "assert", "Equal_", "(_", "type\\u_", ",_", "\"", "string", "\"_", ")_", "\\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_", "._", "assert", "Equal_", "(_", "a_", "._", "dtype_", "._", "base_", "._", "name_", ",_", "type\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "alle", "qual_", "(_", "a_", ",_", "b_", ",_", "\"", "nump", "y", "\"_", ")_", ")_", "\\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_", "#", " ", "The", "n", ",", " ", "delete", " ", "the", " ", "file_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "os_", "._", "path_", "._", "exists_", "(_", "self_", "._", "h5", "fname_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "os_", "._", "remove_", "(_", "self_", "._", "h5", "fname_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Basic", "Test", "Case_", "(_", "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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test0", "0", "\\u", "char_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Data", " ", "integrity", " ", "dur", "ing", " ", "recover", "y", " ", "(", "character", " ", "object", "s", ")\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "a_", "=_", "np_", "._", "array_", "(_", "self_", "._", "tuple", "Char_", ",_", "'", "S", "'_", "+_", "str_", "(_", "len_", "(_", "self_", "._", "tuple", "Char_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "Write", "Read_", "(_", "a_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Basic", "Test", "Case_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test0", "1", "\\u", "char", "\\u", "nc_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Data", " ", "integrity", " ", "dur", "ing", " ", "recover", "y", " ", "(", "non", "-", "contiguous", " ", "character", " ", "object", "s", ")\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "a_", "=_", "np_", "._", "array_", "(_", "self_", "._", "tuple", "Char_", ",_", "'", "S", "'_", "+_", "str_", "(_", "len_", "(_", "self_", "._", "tuple", "Char_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "a_", "._", "shape_", "==_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "b_", "=_", "a_", "#", " ", "We", " ", "cann", "ot", " ", "use", " ", "the", " ", "indexing", " ", "notation", "_", "\\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 ", " _", "b_", "=_", "a_", "[_", ":_", ":_", "2_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Ensur", "e", " ", "tha", "t", " ", "this", " ", "nump", "y", " ", "string", " ", "is", " ", "non", "-", "contiguous", "_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "a_", "._", "shape_", "[_", "0_", "]_", ">_", "2_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "Equal_", "(_", "b_", "._", "flags_", "[_", "'", "CONTI", "GU", "OUS", "'_", "]_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "Write", "Read_", "(_", "b_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Basic", "Test", "Case_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test0", "2", "\\u", "types_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Data", " ", "integrity", " ", "dur", "ing", " ", "recover", "y", " ", "(", "numerical", " ", "types", ")\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "typecode_", "in_", "typec", "odes_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "tuple", "Int_", "._", "shape_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "a_", "=_", "self_", "._", "tuple", "Int_", "._", "astype_", "(_", "typecode_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "shape", " ", "is", " ", "the", " ", "empty", " ", "tuple", " ", "()", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "a_", "=_", "np_", "._", "array_", "(_", "self_", "._", "tuple", "Int_", ",_", "dtype_", "=_", "typecode_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "Write", "Read_", "(_", "a_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Basic", "Test", "Case_", "(_", "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_", "test0", "3", "\\u", "types", "\\u", "nc_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Data", " ", "integrity", " ", "dur", "ing", " ", "recover", "y", " ", "(", "non", "-", "contiguous", " ", "numerical", " ", "types", ")\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "typecode_", "in_", "typec", "odes_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "tuple", "Int_", "._", "shape_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "a_", "=_", "self_", "._", "tuple", "Int_", "._", "astype_", "(_", "typecode_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "shape", " ", "is", " ", "the", " ", "empty", " ", "tuple", " ", "()", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "a_", "=_", "np_", "._", "array_", "(_", "self_", "._", "tuple", "Int_", ",_", "dtype_", "=_", "typecode_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Thi", "s", " ", "shou", "ld", " ", "not", " ", "be", " ", "tested", " ", "for", " ", "the", " ", "rank", "-0", " ", "case_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "len_", "(_", "a_", "._", "shape_", ")_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "unittest_", "._", "Ski", "p", "Test_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "b_", "=_", "a_", "[_", ":_", ":_", "2_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Ensur", "e", " ", "tha", "t", " ", "this", " ", "array", " ", "is", " ", "non", "-", "contiguous", " ", "(", "for", " ", "non", "-", "trivial", " ", "case", ")_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "a_", "._", "shape_", "[_", "0_", "]_", ">_", "2_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "Equal_", "(_", "b_", "._", "flags_", "[_", "'", "CONTI", "GU", "OUS", "'_", "]_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "Write", "Read_", "(_", "b_", ")_", "\\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_", "Basic", "0", "DO", "ne", "Test", "Case_", "(_", "Basic", "Test", "Case_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Rank", "-0", " ", "case_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "title_", "=_", "\"", "Rank", "-0", " ", "case", " ", "1", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tuple", "Int_", "=_", "np_", "._", "array_", "(_", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tuple", "Char_", "=_", "\"", "4", "\"_", "\\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_", "Basic", "0", "DT", "wo", "Test", "Case_", "(_", "Basic", "Test", "Case_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Rank", "-0", " ", "case_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "title_", "=_", "\"", "Rank", "-0", " ", "case", " ", "2", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tuple", "Int_", "=_", "np_", "._", "array_", "(_", "33_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tuple", "Char_", "=_", "\"", "4", "4", "\"_", "\\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_", "Basic", "1", "DO", "ne", "Test", "Case_", "(_", "Basic", "Test", "Case_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "1", "D", " ", "case_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "title_", "=_", "\"", "Rank", "-1", " ", "case", " ", "1", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tuple", "Int_", "=_", "np_", "._", "array_", "(_", "(_", "3_", ",_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tuple", "Char_", "=_", "(_", "\"", "a", "\"_", ",_", ")_", "\\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_", "Basic", "1", "DT", "wo", "Test", "Case_", "(_", "Basic", "Test", "Case_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "1", "D", " ", "case_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "title_", "=_", "\"", "Rank", "-1", " ", "case", " ", "2", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tuple", "Int_", "=_", "np_", "._", "array_", "(_", "(_", "0_", ",_", "4_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tuple", "Char_", "=_", "(_", "\"", "aaa", "\"_", ",_", ")_", "\\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_", "Basic", "1", "DT", "hre", "e", "Test", "Case_", "(_", "Basic", "Test", "Case_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "1", "D", " ", "case_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "title_", "=_", "\"", "Rank", "-1", " ", "case", " ", "3", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tuple", "Int_", "=_", "np_", "._", "array_", "(_", "(_", "3_", ",_", "4_", ",_", "5_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tuple", "Char_", "=_", "(_", "\"", "aaa", "a", "\"_", ",_", "\"", "bbb", "\"_", ",_", ")_", "\\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_", "Basic", "2", "DT", "est", "Case_", "(_", "Basic", "Test", "Case_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "2", "D", " ", "case_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "title_", "=_", "\"", "Rank", "-", "2", " ", "case", " ", "1", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "tuple", "Int", " ", "=", " ", "reshape", "(", "np", ".", "array", "(", "np", ".", "aran", "ge", "((", "4", ")**", "2", "))", ",", " ", "(", "4", ",)", "*", "2", ")_", "\\u\\u\\uNL\\u\\u\\u_", "tuple", "Int_", "=_", "np_", "._", "ones_", "(_", "(_", "4_", ",_", ")_", "*_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tuple", "Char_", "=_", "[_", "[_", "\"", "aaa", "\"_", ",_", "\"", "ddddd", "\"_", "]_", ",_", "[_", "\"", "d", "\"_", ",_", "\"", "ss", "\"_", "]_", ",_", "[_", "\"", "s", "\"_", ",_", "\"", "tt", "\"_", "]_", "]_", "\\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_", "Basic", "10", "DT", "est", "Case_", "(_", "Basic", "Test", "Case_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "10", "D", " ", "case_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "title_", "=_", "\"", "Rank", "-1", "0", " ", "case", " ", "1", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "tuple", "Int", " ", "=", " ", "reshape", "(", "np", ".", "array", "(", "np", ".", "aran", "ge", "((", "2", ")**", "10", "))", ",", " ", "(", "2", ",)", "*", "10", ")_", "\\u\\u\\uNL\\u\\u\\u_", "tuple", "Int_", "=_", "np_", "._", "ones_", "(_", "(_", "2_", ",_", ")_", "*_", "10_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "tuple", "Char", " ", "=", " ", "reshape", "(", "np", ".", "array", "([", "1", "],", "dt", "ype", "=\"", "S1", "\")", ",(", "1", ",)", "*", "10", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "next", " ", "tuple", " ", "consume", "s", " ", "far", " ", "more", " ", "time", ",", " ", "so", " ", "this_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "test", " ", "shou", "ld", " ", "be", " ", "run", " ", "in", " ", "common", ".", "heav", "y", " ", "mode", "._", "\\u\\u\\uNL\\u\\u\\u_", "tuple", "Char_", "=_", "np_", "._", "array_", "(_", "tuple", "Int_", ",_", "dtype_", "=_", "\"", "S1", "\"_", ")_", "\\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_", "Group", "s", "Array", "Test", "Case_", "(_", "common_", "._", "Temp", "File", "Mixin_", ",_", "Test", "Case_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Thi", "s", " ", "test", " ", "class", " ", "checks", " ", "combinat", "ion", "s", " ", "of", " ", "arrays", " ", "with", " ", "group", "s", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "It", " ", "als", "o", " ", "use", "s", " ", "arrays", " ", "ranks", " ", "whi", "ch", " ", "ranges", " ", "unti", "l", " ", "10.", "\\", "10", ";", "\\", "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_", "[SEP]_", "class_", "Group", "s", "Array", "Test", "Case_", "(_", "common_", "._", "Temp", "File", "Mixin_", ",_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "test0", "0", "\\u", "iterative", "Groups_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Check", "ing", " ", "combinat", "ion", "s", " ", "of", " ", "arrays", " ", "with", " ", "group", "s", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "It", " ", "als", "o", " ", "use", "s", " ", "arrays", " ", "ranks", " ", "whi", "ch", " ", "ranges", " ", "unti", "l", " ", "10.", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "common_", "._", "verbose_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "'\\\\", "n", "'_", ",_", "'-", "='_", "*_", "30_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "\"", "Run", "ning", " ", "%", "s", ".", "test0", "0", "\\u", "iterative", "Group", "s", "...\"_", "%_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u\\u", "class\\u\\u_", "._", "\\u\\u", "name\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Get", " ", "the", " ", "root", " ", "group_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "group_", "=_", "self_", "._", "h5file", "_", "._", "root_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "i_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "typecode_", "in_", "typec", "odes_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Creat", "e", " ", "an", " ", "array", " ", "of", " ", "typec", "ode", ",", " ", "with", " ", "incremental", "ly", " ", "bigger", " ", "ranges_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "a_", "=_", "np_", "._", "ones_", "(_", "(_", "2_", ",_", ")_", "*_", "i_", ",_", "typecode_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Save", " ", "it", " ", "on", " ", "the", " ", "HDF", "5", " ", "file_", "\\u\\u\\uNL\\u\\u\\u_", "dset", "name_", "=_", "'", "array", "\\u'_", "+_", "typecode_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "common_", "._", "verbose_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "\"", "Creat", "ing", " ", "dataset", ":\"_", ",_", "group_", "._", "\\u", "g", "\\u", "join_", "(_", "dset", "name_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "create", "\\u", "array_", "(_", "group_", ",_", "dset", "name_", ",_", "a_", ",_", "\"", "Large", " ", "array", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Creat", "e", " ", "a", " ", "new", " ", "group_", "\\u\\u\\uNL\\u\\u\\u_", "group_", "=_", "self_", "._", "h5file", "_", "._", "create", "\\u", "group_", "(_", "group_", ",_", "'", "group", "'_", "+_", "str_", "(_", "i_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "increment", " ", "the", " ", "range", " ", "for", " ", "next", " ", "iteration_", "\\u\\u\\uNL\\u\\u\\u_", "i_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "reo", "pen_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Get", " ", "the", " ", "root", " ", "group_", "\\u\\u\\uNL\\u\\u\\u_", "group_", "=_", "self_", "._", "h5file", "_", "._", "root_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Get", " ", "the", " ", "metadata", " ", "on", " ", "the", " ", "previ", "os", "ly", " ", "saved", " ", "arrays_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "i_", "in_", "range_", "(_", "1_", ",_", "len_", "(_", "typec", "odes_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Creat", "e", " ", "an", " ", "array", " ", "for", " ", "late", "r", " ", "comparison_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "a_", "=_", "np_", "._", "ones_", "(_", "(_", "2_", ",_", ")_", "*_", "i_", ",_", "typec", "odes_", "[_", "i_", "-_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Get", " ", "the", " ", "dset", " ", "object", " ", "hang", "ing", " ", "from", " ", "group_", "\\u\\u\\uNL\\u\\u\\u_", "dset_", "=_", "getattr_", "(_", "group_", ",_", "'", "array", "\\u'_", "+_", "typec", "odes_", "[_", "i_", "-_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Get", " ", "the", " ", "actual", " ", "array_", "\\u\\u\\uNL\\u\\u\\u_", "b_", "=_", "dset_", "._", "read_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "alle", "qual_", "(_", "a_", ",_", "b_", ",_", "\"", "nump", "y", "\"_", ")_", "and_", "common_", "._", "verbose_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "\"", "Array", " ", "a", " ", "original", ".", " ", "Shape", ":", " ", "==", ">\"_", ",_", "a_", "._", "shape_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "\"", "Array", " ", "a", " ", "original", ".", " ", "Data", ":", " ", "==", ">\"_", ",_", "a_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "\"", "Info", " ", "from", " ", "dataset", ":\"_", ",_", "dset_", "._", "\\u", "v", "\\u", "pathname_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "\"", " ", " ", "shape", " ", "==", ">\"_", ",_", "dset_", "._", "shape_", ",_", "end_", "=_", "'", " ", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "\"", " ", " ", "dt", "ype", " ", "==", ">", " ", "%", "s", "\"_", "%_", "dset_", "._", "dtype_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "\"", "Array", " ", "b", " ", "read", " ", "from", " ", "file", ".", " ", "Shape", ":", " ", "==", ">\"_", ",_", "b_", "._", "shape_", ",_", "end_", "=_", "'", " ", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "\".", " ", "Type", " ", "==", ">", " ", "%", "s", "\"_", "%_", "b_", "._", "dtype_", "._", "char_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "a_", "._", "shape_", ",_", "b_", "._", "shape_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "np_", "._", "dtype_", "(_", "'", "l", "'_", ")_", "._", "itemsize_", "==_", "4_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "(_", "a_", "._", "dtype_", "._", "char_", "==_", "\"", "i", "\"_", "or_", "a_", "._", "dtype_", "._", "char_", "==_", "\"", "l", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Special", " ", "expect", "ion", ".", " ", "We", " ", "have", " ", "no", " ", "way", " ", "to", " ", "distinguish", " ", "between_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "\"", "l", "\"", " ", "and", " ", "\"", "i", "\"", " ", "typec", "ode", ",", " ", "and", " ", "we", " ", "can", " ", "consider", " ", "them", " ", "the", " ", "same_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "to", " ", "all", " ", "practic", "al", " ", "effects_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "self_", "._", "assert", "True_", "(_", "b_", "._", "dtype_", "._", "char_", "==_", "\"", "l", "\"_", "or_", "b_", "._", "dtype_", "._", "char_", "==_", "\"", "i", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "(_", "a_", "._", "dtype_", "._", "char_", "==_", "\"", "I", "\"_", "or_", "a_", "._", "dtype_", "._", "char_", "==_", "\"", "L", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Special", " ", "expect", "ion", ".", " ", "We", " ", "have", " ", "no", " ", "way", " ", "to", " ", "distinguish", " ", "between_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "\"", "L", "\"", " ", "and", " ", "\"", "I", "\"", " ", "typec", "ode", ",", " ", "and", " ", "we", " ", "can", " ", "consider", " ", "them", " ", "the", " ", "same_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "to", " ", "all", " ", "practic", "al", " ", "effects_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "self_", "._", "assert", "True_", "(_", "b_", "._", "dtype_", "._", "char_", "==_", "\"", "L", "\"_", "or_", "b_", "._", "dtype_", "._", "char_", "==_", "\"", "I", "\"_", ")_", "\\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_", "._", "assert", "True_", "(_", "alle", "qual_", "(_", "a_", ",_", "b_", ",_", "\"", "nump", "y", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "np_", "._", "dtype_", "(_", "'", "l", "'_", ")_", "._", "itemsize_", "==_", "8_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "(_", "a_", "._", "dtype_", "._", "char_", "==_", "\"", "q", "\"_", "or_", "a_", "._", "dtype_", "._", "char_", "==_", "\"", "l", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Special", " ", "expect", "ion", ".", " ", "We", " ", "have", " ", "no", " ", "way", " ", "to", " ", "distinguish", " ", "between_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "\"", "q", "\"", " ", "and", " ", "\"", "l", "\"", " ", "typec", "ode", " ", "in", " ", "64", "-", "bit", " ", "platform", "s", ",", " ", "and", " ", "we", " ", "can_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "consider", " ", "them", " ", "the", " ", "same", " ", "to", " ", "all", " ", "practic", "al", " ", "effects_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "self_", "._", "assert", "True_", "(_", "b_", "._", "dtype_", "._", "char_", "==_", "\"", "l", "\"_", "or_", "b_", "._", "dtype_", "._", "char_", "==_", "\"", "q", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "(_", "a_", "._", "dtype_", "._", "char_", "==_", "\"", "Q", "\"_", "or_", "a_", "._", "dtype_", "._", "char_", "==_", "\"", "L", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Special", " ", "expect", "ion", ".", " ", "We", " ", "have", " ", "no", " ", "way", " ", "to", " ", "distinguish", " ", "between_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "\"", "Q", "\"", " ", "and", " ", "\"", "L", "\"", " ", "typec", "ode", " ", "in", " ", "64", "-", "bit", " ", "platform", "s", ",", " ", "and", " ", "we", " ", "can_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "consider", " ", "them", " ", "the", " ", "same", " ", "to", " ", "all", " ", "practic", "al", " ", "effects_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "self_", "._", "assert", "True_", "(_", "b_", "._", "dtype_", "._", "char_", "==_", "\"", "L", "\"_", "or_", "b_", "._", "dtype_", "._", "char_", "==_", "\"", "Q", "\"_", ")_", "\\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_", "._", "assert", "True_", "(_", "alle", "qual_", "(_", "a_", ",_", "b_", ",_", "\"", "nump", "y", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Iterat", "e", " ", "over", " ", "the", " ", "next", " ", "group_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "group_", "=_", "getattr_", "(_", "group_", ",_", "'", "group", "'_", "+_", "str_", "(_", "i_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Group", "s", "Array", "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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test0", "1", "\\u", "large", "Rank", "Arrays", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Check", "ing", " ", "creati", "on", " ", "of", " ", "large", " ", "rank", " ", "arrays", " ", "(", "0", " ", "<", " ", "rank", " ", "<=", " ", "32", ")", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "It", " ", "als", "o", " ", "use", "s", " ", "arrays", " ", "ranks", " ", "whi", "ch", " ", "ranges", " ", "unti", "l", " ", "maxr", "ank", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "maxim", "um", " ", "level", " ", "of", " ", "recurs", "ivity", " ", "(", "deep", "est", " ", "group", " ", "level", ")", " ", "achieve", "d", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "maxr", "ank", " ", "=", " ", "32", " ", "(", "for", " ", "a", " ", "effective", " ", "maxim", "um", " ", "rank", " ", "of", " ", "32", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Thi", "s", " ", "limit", " ", "is", " ", "due", " ", "to", " ", "a", " ", "limit", " ", "in", " ", "the", " ", "HDF", "5", " ", "librar", "y", "._", "\\u\\u\\uNL\\u\\u\\u_", "min", "rank_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "maxr", "ank", "_", "=_", "32_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "common_", "._", "verbose_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "'\\\\", "n", "'_", ",_", "'-", "='_", "*_", "30_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "\"", "Run", "ning", " ", "%", "s", ".", "test0", "1", "\\u", "large", "Rank", "Arrays", "...\"_", "%_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u\\u", "class\\u\\u_", "._", "\\u\\u", "name\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "\"", "Maxim", "um", " ", "rank", " ", "for", " ", "tested", " ", "arrays", ":\"_", ",_", "maxr", "ank", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "group_", "=_", "self_", "._", "h5file", "_", "._", "root_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "common_", "._", "verbose_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "\"", "Rank", " ", "array", " ", "writ", "ing", " ", "progress", ":", " ", "\"_", ",_", "end_", "=_", "'", " ", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "rank_", "in_", "range_", "(_", "min", "rank_", ",_", "maxr", "ank", "_", "+_", "1_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Creat", "e", " ", "an", " ", "array", " ", "of", " ", "integ", "ers", ",", " ", "with", " ", "incremental", "ly", " ", "bigger", " ", "ranges_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "a_", "=_", "np_", "._", "ones_", "(_", "(_", "1_", ",_", ")_", "*_", "rank_", ",_", "'", "i", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "common_", "._", "verbose_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "\"%", "3d", ",\"_", "%_", "(_", "rank_", ")_", ",_", "end_", "=_", "'", " ", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "create", "\\u", "array_", "(_", "group_", ",_", "\"", "array", "\"_", ",_", "a_", ",_", "\"", "Rank", ":", " ", "%", "s", "\"_", "%_", "rank_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "group_", "=_", "self_", "._", "h5file", "_", "._", "create", "\\u", "group_", "(_", "group_", ",_", "'", "group", "'_", "+_", "str_", "(_", "rank_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Flu", "sh", " ", "the", " ", "buffers_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "flush_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "reo", "pen_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "group_", "=_", "self_", "._", "h5file", "_", "._", "root_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "common_", "._", "verbose_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "\"", "Rank", " ", "array", " ", "readi", "ng", " ", "progress", ":", " ", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Get", " ", "the", " ", "metadata", " ", "on", " ", "the", " ", "previ", "os", "ly", " ", "saved", " ", "arrays_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "rank_", "in_", "range_", "(_", "min", "rank_", ",_", "maxr", "ank", "_", "+_", "1_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Creat", "e", " ", "an", " ", "array", " ", "for", " ", "late", "r", " ", "comparison_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "a_", "=_", "np_", "._", "ones_", "(_", "(_", "1_", ",_", ")_", "*_", "rank_", ",_", "'", "i", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Get", " ", "the", " ", "actual", " ", "array_", "\\u\\u\\uNL\\u\\u\\u_", "b_", "=_", "group_", "._", "array_", "._", "read_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "common_", "._", "verbose_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "\"%", "3d", ",\"_", "%_", "(_", "rank_", ")_", ",_", "end_", "=_", "'", " ", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "a_", "._", "tolist_", "(_", ")_", "==_", "b_", "._", "tolist_", "(_", ")_", "and_", "common_", "._", "verbose_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "dset_", "=_", "group_", "._", "array_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "\"", "Info", " ", "from", " ", "dataset", ":\"_", ",_", "dset_", "._", "\\u", "v", "\\u", "pathname_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "\"", " ", " ", "Shape", ":", " ", "==", ">\"_", ",_", "dset_", "._", "shape_", ",_", "end_", "=_", "'", " ", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "\"", " ", " ", "typec", "ode", " ", "==", ">", " ", "%", "c", "\"_", "%_", "dset_", "._", "typecode_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "\"", "Array", " ", "b", " ", "read", " ", "from", " ", "file", ".", " ", "Shape", ":", " ", "==", ">\"_", ",_", "b_", "._", "shape_", ",_", "end_", "=_", "'", " ", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "\".", " ", "Type", " ", "==", ">", " ", "%", "c", "\"_", "%_", "b_", "._", "dtype_", "._", "char_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "a_", "._", "shape_", ",_", "b_", "._", "shape_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "a_", "._", "dtype_", "._", "char_", "==_", "\"", "i", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Special", " ", "expect", "ion", ".", " ", "We", " ", "have", " ", "no", " ", "way", " ", "to", " ", "distinguish", " ", "between_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "\"", "l", "\"", " ", "and", " ", "\"", "i", "\"", " ", "typec", "ode", ",", " ", "and", " ", "we", " ", "can", " ", "consider", " ", "them", " ", "the", " ", "same_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "to", " ", "all", " ", "practic", "al", " ", "effects_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "True_", "(_", "b_", "._", "dtype_", "._", "char_", "==_", "\"", "l", "\"_", "or_", "b_", "._", "dtype_", "._", "char_", "==_", "\"", "i", "\"_", ")_", "\\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_", "._", "assert", "Equal_", "(_", "a_", "._", "dtype_", "._", "char_", ",_", "b_", "._", "dtype_", "._", "char_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "a_", ",_", "b_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Iterat", "e", " ", "over", " ", "the", " ", "next", " ", "group_", "\\u\\u\\uNL\\u\\u\\u_", "group_", "=_", "self_", "._", "h5file", "_", "._", "get", "\\u", "node_", "(_", "group_", ",_", "'", "group", "'_", "+_", "str_", "(_", "rank_", ")_", ")_", "\\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_", "(_", ")_", "#", " ", "Thi", "s", " ", "flush", " ", "the", " ", "stdout", " ", "buffer_", "\\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_", "Record_", "(_", "tables_", "._", "Is", "Description_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "var1_", "=_", "String", "Col_", "(_", "itemsize_", "=_", "4_", ",_", "dfl", "t_", "=_", "b", "\"", "abc", "d", "\"_", ",_", "pos_", "=_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "var2_", "=_", "String", "Col_", "(_", "itemsize_", "=_", "1_", ",_", "dfl", "t_", "=_", "b", "\"", "a", "\"_", ",_", "pos_", "=_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "var", "3_", "=_", "Boo", "l", "Col_", "(_", "dfl", "t_", "=_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "var", "4_", "=_", "Int", "8", "Col_", "(_", "dfl", "t_", "=_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "var", "5_", "=_", "UI", "nt", "8", "Col_", "(_", "dfl", "t_", "=_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "var", "6_", "=_", "Int", "16", "Col_", "(_", "dfl", "t_", "=_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "var", "7_", "=_", "UI", "nt", "16", "Col_", "(_", "dfl", "t_", "=_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "var", "8_", "=_", "Int", "32", "Col_", "(_", "dfl", "t_", "=_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "var", "9_", "=_", "UI", "nt", "32", "Col_", "(_", "dfl", "t_", "=_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "var", "10_", "=_", "Int64", "Col_", "(_", "dfl", "t_", "=_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "var", "11_", "=_", "Float", "32", "Col_", "(_", "dfl", "t_", "=_", "1.0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "var", "12_", "=_", "Float", "64", "Col_", "(_", "dfl", "t_", "=_", "1.0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "var", "13_", "=_", "Comple", "x", "Col_", "(_", "itemsize_", "=_", "8_", ",_", "dfl", "t_", "=_", "(_", "1._", "+_", "0.", "j_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "var", "14_", "=_", "Comple", "x", "Col_", "(_", "itemsize_", "=_", "16_", ",_", "dfl", "t_", "=_", "(_", "1._", "+_", "0.", "j_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "hasattr_", "(_", "tables_", ",_", "'", "Float", "16", "Col", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "var", "15_", "=_", "tables_", "._", "Float", "16", "Col_", "(_", "dfl", "t_", "=_", "1.0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "hasattr_", "(_", "tables_", ",_", "'", "Float", "96", "Col", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "var", "16_", "=_", "tables_", "._", "Float", "96", "Col_", "(_", "dfl", "t_", "=_", "1.0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "hasattr_", "(_", "tables_", ",_", "'", "Float", "128", "Col", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "var", "17_", "=_", "tables_", "._", "Float", "128", "Col_", "(_", "dfl", "t_", "=_", "1.0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "hasattr_", "(_", "tables_", ",_", "'", "Comple", "x1", "96", "Col", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "var", "18_", "=_", "tables_", "._", "Comple", "x", "Col_", "(_", "itemsize_", "=_", "24_", ",_", "dfl", "t_", "=_", "(_", "1._", "+_", "0.", "j_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "hasattr_", "(_", "tables_", ",_", "'", "Comple", "x2", "56", "Col", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "var", "19_", "=_", "tables_", "._", "Comple", "x", "Col_", "(_", "itemsize_", "=_", "32_", ",_", "dfl", "t_", "=_", "(_", "1._", "+_", "0.", "j_", ")_", ")_", "\\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_", "Table", "Read", "Test", "Case_", "(_", "common_", "._", "Temp", "File", "Mixin_", ",_", "Test", "Case_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "nrows_", "=_", "100_", "\\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_", "Table", "Read", "Test", "Case_", "(_", "common_", "._", "Temp", "File", "Mixin_", ",_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "set", "Up_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "super_", "(_", "Table", "Read", "Test", "Case_", ",_", "self_", ")_", "._", "set", "Up_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Creat", "e", " ", "an", " ", "instance", " ", "of", " ", "an", " ", "HDF", "5", " ", "Table_", "\\u\\u\\uNL\\u\\u\\u_", "table_", "=_", "self_", "._", "h5file", "_", "._", "create", "\\u", "table_", "(_", "self_", "._", "h5file", "_", "._", "root_", ",_", "'", "table", "'_", ",_", "Record_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", "in_", "range_", "(_", "self_", "._", "nrows_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "table_", "._", "row_", "._", "append_", "(_", ")_", "#", " ", "Fil", "l", " ", "100", " ", "rows", " ", "with", " ", "default", " ", "values_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "reo", "pen_", "(_", "mode_", "=_", "'", "a", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Table", "Read", "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", "1", "\\u", "read", "Table", "Char_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Check", "ing", " ", "column", " ", "conve", "rsi", "on", " ", "int", "o", " ", "Num", "Py", " ", "in", " ", "read", "()", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Char", " ", "flavor", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "table_", "=_", "self_", "._", "h5file", "_", "._", "root_", "._", "table_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "table_", "._", "flavor_", "=_", "\"", "nump", "y", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "colname_", "in_", "table_", "._", "colnames_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "numc", "ol_", "=_", "table_", "._", "read_", "(_", "field_", "=_", "colname_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "typec", "ol_", "=_", "table_", "._", "col", "types_", "[_", "colname_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "items", "ize", "col_", "=_", "table_", "._", "description_", "._", "\\u", "v", "\\u", "dtypes_", "[_", "colname_", "]_", "._", "base_", "._", "itemsize_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "nct", "ype", "code_", "=_", "numc", "ol_", "._", "dtype_", "._", "char_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "typec", "ol_", "==_", "\"", "string", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "items", "ize", "col_", ">_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "orig", "numc", "ol_", "=_", "np_", "._", "array_", "(_", "[_", "'", "abc", "d", "'_", "]_", "*_", "self_", "._", "nrows_", ",_", "dtype_", "=_", "'", "S4", "'_", ")_", "\\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 ", " ", "_", "orig", "numc", "ol_", "=_", "np_", "._", "array_", "(_", "[_", "'", "a", "'_", "]_", "*_", "self_", "._", "nrows_", ",_", "dtype_", "=_", "'", "S1", "'_", ")_", "\\u\\u\\uNEWLINE\\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_", "(_", "\"", "Type", "code", " ", "of", " ", "Num", "Py", " ", "column", " ", "read", ":\"_", ",_", "nct", "ype", "code_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "\"", "Sho", "ul", "d", " ", "look", " ", "like", ":\"_", ",_", "'", "c", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "\"", "Item", "size", " ", "of", " ", "column", ":\"_", ",_", "items", "ize", "col_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "\"", "Shape", " ", "of", " ", "Num", "Py", " ", "column", " ", "read", ":\"_", ",_", "numc", "ol_", "._", "shape_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "\"", "Sho", "ul", "d", " ", "look", " ", "like", ":\"_", ",_", "orig", "numc", "ol_", "._", "shape_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "\"", "Fi", "rst", " ", "3", " ", "element", "s", " ", "of", " ", "read", " ", "col", ":\"_", ",_", "numc", "ol_", "[_", ":_", "3_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Check", " ", "tha", "t", " ", "bot", "h", " ", "Num", "Py", " ", "object", "s", " ", "are", " ", "equal_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "alle", "qual_", "(_", "numc", "ol_", ",_", "orig", "numc", "ol_", ",_", "\"", "nump", "y", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Table", "Read", "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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test0", "1", "\\u", "read", "Table", "Num_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Check", "ing", " ", "column", " ", "conve", "rsi", "on", " ", "int", "o", " ", "Num", "Py", " ", "in", " ", "read", "()", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Num", "Py", " ", "flavor", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "table_", "=_", "self_", "._", "h5file", "_", "._", "root_", "._", "table_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "table_", "._", "flavor_", "=_", "\"", "nump", "y", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "colname_", "in_", "table_", "._", "colnames_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "numc", "ol_", "=_", "table_", "._", "read_", "(_", "field_", "=_", "colname_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "typec", "ol_", "=_", "table_", "._", "col", "types_", "[_", "colname_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "nct", "ype", "code_", "=_", "np_", "._", "type", "NA_", "[_", "numc", "ol_", "._", "dtype_", "._", "char_", "[_", "0_", "]_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "typec", "ol_", "!=_", "\"", "string", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "common_", "._", "verbose_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "print_", "(_", "\"", "Type", "code", " ", "of", " ", "Num", "Py", " ", "column", " ", "read", ":\"_", ",_", "nct", "ype", "code_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "\"", "Sho", "ul", "d", " ", "look", " ", "like", ":\"_", ",_", "typec", "ol_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "orig", "numc", "ol_", "=_", "np_", "._", "ones_", "(_", "shape_", "=_", "self_", "._", "nrows_", ",_", "dtype_", "=_", "numc", "ol_", "._", "dtype_", "._", "char_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Check", " ", "tha", "t", " ", "bot", "h", " ", "Num", "Py", " ", "object", "s", " ", "are", " ", "equal_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "alle", "qual_", "(_", "numc", "ol_", ",_", "orig", "numc", "ol_", ",_", "\"", "nump", "y", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Table", "Read", "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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test0", "2", "\\u", "read", "Coord", "s", "Char_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Colum", "n", " ", "conve", "rsi", "on", " ", "int", "o", " ", "Num", "Py", " ", "in", " ", "read", "Coord", "s", "()", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Char", "s", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "table_", "=_", "self_", "._", "h5file", "_", "._", "root_", "._", "table_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "table_", "._", "flavor_", "=_", "\"", "nump", "y", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "coords_", "=_", "[_", "1_", ",_", "2_", ",_", "3_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "nrows_", "=_", "len_", "(_", "coords_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "colname_", "in_", "table_", "._", "colnames_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "numc", "ol_", "=_", "table_", "._", "read", "\\u", "coordinates_", "(_", "coords_", ",_", "field_", "=_", "colname_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "typec", "ol_", "=_", "table_", "._", "col", "types_", "[_", "colname_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "items", "ize", "col_", "=_", "table_", "._", "description_", "._", "\\u", "v", "\\u", "dtypes_", "[_", "colname_", "]_", "._", "base_", "._", "itemsize_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "nct", "ype", "code_", "=_", "numc", "ol_", "._", "dtype_", "._", "char_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "typec", "ol_", "==_", "\"", "string", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "items", "ize", "col_", ">_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "orig", "numc", "ol_", "=_", "np_", "._", "array_", "(_", "[_", "'", "abc", "d", "'_", "]_", "*_", "self_", "._", "nrows_", ",_", "dtype_", "=_", "'", "S4", "'_", ")_", "\\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 ", " ", "_", "orig", "numc", "ol_", "=_", "np_", "._", "array_", "(_", "[_", "'", "a", "'_", "]_", "*_", "self_", "._", "nrows_", ",_", "dtype_", "=_", "'", "S1", "'_", ")_", "\\u\\u\\uNEWLINE\\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_", "(_", "\"", "Type", "code", " ", "of", " ", "Num", "Py", " ", "column", " ", "read", ":\"_", ",_", "nct", "ype", "code_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "\"", "Sho", "ul", "d", " ", "look", " ", "like", ":\"_", ",_", "'", "c", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "\"", "Item", "size", " ", "of", " ", "column", ":\"_", ",_", "items", "ize", "col_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "\"", "Shape", " ", "of", " ", "Num", "Py", " ", "column", " ", "read", ":\"_", ",_", "numc", "ol_", "._", "shape_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "\"", "Sho", "ul", "d", " ", "look", " ", "like", ":\"_", ",_", "orig", "numc", "ol_", "._", "shape_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "\"", "Fi", "rst", " ", "3", " ", "element", "s", " ", "of", " ", "read", " ", "col", ":\"_", ",_", "numc", "ol_", "[_", ":_", "3_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Check", " ", "tha", "t", " ", "bot", "h", " ", "Num", "Py", " ", "object", "s", " ", "are", " ", "equal_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "alle", "qual_", "(_", "numc", "ol_", ",_", "orig", "numc", "ol_", ",_", "\"", "nump", "y", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Table", "Read", "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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test0", "2", "\\u", "read", "Coord", "s", "Num_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Colum", "n", " ", "conve", "rsi", "on", " ", "int", "o", " ", "Num", "Py", " ", "in", " ", "read", "\\u", "coordinate", "s", "()", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Num", "Py", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "table_", "=_", "self_", "._", "h5file", "_", "._", "root_", "._", "table_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "table_", "._", "flavor_", "=_", "\"", "nump", "y", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "coords_", "=_", "[_", "1_", ",_", "2_", ",_", "3_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "nrows_", "=_", "len_", "(_", "coords_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "colname_", "in_", "table_", "._", "colnames_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "numc", "ol_", "=_", "table_", "._", "read", "\\u", "coordinates_", "(_", "coords_", ",_", "field_", "=_", "colname_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "typec", "ol_", "=_", "table_", "._", "col", "types_", "[_", "colname_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "type\\u_", "=_", "numc", "ol_", "._", "dtype_", "._", "type_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "typec", "ol_", "!=_", "\"", "string", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "typec", "ol_", "==_", "\"", "int", "64", "\"_", ":_", "\\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_", "if_", "common_", "._", "verbose_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "print_", "(_", "\"", "Type", " ", "of", " ", "read", " ", "Num", "Py", " ", "column", ":\"_", ",_", "type\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "\"", "Sho", "ul", "d", " ", "look", " ", "like", ":\"_", ",_", "typec", "ol_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "orig", "numc", "ol_", "=_", "np_", "._", "ones_", "(_", "shape_", "=_", "self_", "._", "nrows_", ",_", "dtype_", "=_", "numc", "ol_", "._", "dtype_", "._", "char_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Check", " ", "tha", "t", " ", "bot", "h", " ", "Num", "Py", " ", "object", "s", " ", "are", " ", "equal_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "alle", "qual_", "(_", "numc", "ol_", ",_", "orig", "numc", "ol_", ",_", "\"", "nump", "y", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Table", "Read", "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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test0", "3", "\\u", "get", "Index", "Num", "Py_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Get", "ting", " ", "table", " ", "rows", " ", "speci", "fy", "ied", " ", "as", " ", "Num", "Py", " ", "scala", "r", " ", "integ", "ers", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "table_", "=_", "self_", "._", "h5file", "_", "._", "root_", "._", "table_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "coords_", "=_", "np_", "._", "array_", "(_", "[_", "1_", ",_", "2_", ",_", "3_", "]_", ",_", "dtype_", "=_", "'", "int", "8", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "colname_", "in_", "table_", "._", "colnames_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "numc", "ol_", "=_", "[_", "table_", "[_", "coord_", "]_", "[_", "colname_", "]_", "for_", "coord_", "in_", "coords_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "typec", "ol_", "=_", "table_", "._", "col", "types_", "[_", "colname_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "typec", "ol_", "!=_", "\"", "string", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "typec", "ol_", "==_", "\"", "int", "64", "\"_", ":_", "\\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_", "numc", "ol_", "=_", "np_", "._", "array_", "(_", "numc", "ol_", ",_", "typec", "ol_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "common_", "._", "verbose_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "type\\u_", "=_", "numc", "ol_", "._", "dtype_", "._", "type_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "\"", "Type", " ", "of", " ", "read", " ", "Num", "Py", " ", "column", ":\"_", ",_", "type\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "\"", "Sho", "ul", "d", " ", "look", " ", "like", ":\"_", ",_", "typec", "ol_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "orig", "numc", "ol_", "=_", "np_", "._", "ones_", "(_", "shape_", "=_", "len_", "(_", "numc", "ol_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "dtype_", "=_", "numc", "ol_", "._", "dtype_", "._", "char_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Check", " ", "tha", "t", " ", "bot", "h", " ", "Num", "Py", " ", "object", "s", " ", "are", " ", "equal_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "alle", "qual_", "(_", "numc", "ol_", ",_", "orig", "numc", "ol_", ",_", "\"", "nump", "y", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Table", "Read", "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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test0", "4", "\\u", "set", "Index", "Num", "Py_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Sett", "ing", " ", "table", " ", "rows", " ", "speci", "fy", "ied", " ", "as", " ", "Num", "Py", " ", "integ", "ers", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "reo", "pen_", "(_", "mode_", "=_", "'", "a", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "table_", "=_", "self_", "._", "h5file", "_", "._", "root_", "._", "table_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "table_", "._", "flavor_", "=_", "\"", "nump", "y", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "coords_", "=_", "np_", "._", "array_", "(_", "[_", "1_", ",_", "2_", ",_", "3_", "]_", ",_", "dtype_", "=_", "'", "int", "8", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Modif", "y", " ", "row", " ", "1_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Fro", "m", " ", "Py", "Table", "s", " ", "2.0", " ", "on", ",", " ", "assign", "ment", "s", " ", "to", " ", "record", "s", " ", "can", " ", "be", " ", "done_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "only", " ", "as", " ", "tuple", "s", " ", "(", "see", " ", "http", "://", "project", "s", ".", "sci", "py", ".", "org", "/", "sci", "py", "/", "nump", "y", "/", "tick", "et", "/", "315", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "table", "[", "coords", "[", "0", "]]", " ", "=", " ", "[\"", "aas", "a", "\",\"", "x", "\"]+", "[", "232", "]*", "12_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "n_", "=_", "len_", "(_", "Record_", "._", "columns_", ")_", "-_", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "table_", "[_", "coords_", "[_", "0_", "]_", "]_", "=_", "tuple_", "(_", "[_", "\"", "aas", "a", "\"_", ",_", "\"", "x", "\"_", "]_", "+_", "[_", "232_", "]_", "*_", "n_", ")_", "#", " ", "XX", "X_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "record", " ", "=", " ", "list", "(", "table", "[", "coords", "[", "0", "]])", "_", "\\u\\u\\uNL\\u\\u\\u_", "record_", "=_", "table_", "._", "read_", "(_", "coords_", "[_", "0_", "]_", ",_", "coords_", "[_", "0_", "]_", "+_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "common_", "._", "verbose_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "\"", "Origina", "l", " ", "row", ":\\\\", "n", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"[", "'", "aas", "a", "',", " ", "'", "x", "',", " ", "Tru", "e", ",", " ", "-", "24", ",", " ", "232", ",", " ", "232", ",", " ", "232", ",", " ", "232", ",", " ", "232", "L", ",", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "232", ",", " ", "232", ".0", ",", " ", "232", ".0", ",", " ", "(", "232", " ", "+", " ", "0", "j", "),", " ", "(", "232", "+0", "j", "),", " ", "232", ".0", ",", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"(", "232", "+0", "j", ")]", "\\\\", "n", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "\"", "Read", " ", "row", ":\\\\", "n", "\"_", ",_", "record_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "record_", "[_", "'", "var", "1", "'_", "]_", ",_", "b", "'", "aas", "a", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "record_", "[_", "'", "var", "2", "'_", "]_", ",_", "b", "'", "x", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "record_", "[_", "'", "var", "3", "'_", "]_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "record_", "[_", "'", "var", "4", "'_", "]_", ",_", "-_", "24_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "record_", "[_", "'", "var", "7", "'_", "]_", ",_", "232_", ")_", "\\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_", "Info_", "(_", "tables_", "._", "Is", "Description_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "v", "\\u", "pos_", "=_", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Name_", "=_", "String", "Col_", "(_", "itemsize_", "=_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Value_", "=_", "Comple", "x", "Col_", "(_", "itemsize_", "=_", "16_", ")_", "\\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_", "Test", "TD", "esc", "r_", "(_", "tables_", "._", "Is", "Description_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "A", " ", "description", " ", "tha", "t", " ", "has", " ", "sever", "al", " ", "nest", "ed", " ", "column", "s", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "x_", "=_", "Int", "32", "Col_", "(_", "dfl", "t_", "=_", "0_", ",_", "shape_", "=_", "2_", ",_", "pos_", "=_", "0_", ")_", "#", " ", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "y_", "=_", "Float", "Col_", "(_", "dfl", "t_", "=_", "1_", ",_", "shape_", "=_", "(_", "2_", ",_", "2_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "z_", "=_", "UI", "nt", "8", "Col_", "(_", "dfl", "t_", "=_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "z3", "_", "=_", "Enum", "Col_", "(_", "{_", "'", "r", "'_", ":_", "4_", ",_", "'", "g", "'_", ":_", "2_", ",_", "'", "b", "'_", ":_", "1_", "}_", ",_", "'", "r", "'_", ",_", "'", "int", "32", "'_", ",_", "shape_", "=_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "color_", "=_", "String", "Col_", "(_", "itemsize_", "=_", "4_", ",_", "dfl", "t_", "=_", "b", "\"", "ab", "\"_", ",_", "pos_", "=_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "info_", "=_", "Info_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Info_", "(_", "tables_", "._", "Is", "Description_", ")_", ":_", "#", " ", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "v", "\\u", "pos_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "name_", "=_", "String", "Col_", "(_", "itemsize_", "=_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "value_", "=_", "Comple", "x", "Col_", "(_", "itemsize_", "=_", "16_", ",_", "pos_", "=_", "0_", ")_", "#", " ", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "y2_", "=_", "Float", "Col_", "(_", "pos_", "=_", "1_", ")_", "#", " ", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "z2_", "=_", "UI", "nt", "8", "Col_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Info", "2_", "(_", "tables_", "._", "Is", "Description_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "y3_", "=_", "Time", "64", "Col_", "(_", "shape_", "=_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "name_", "=_", "String", "Col_", "(_", "itemsize_", "=_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "value_", "=_", "Comple", "x", "Col_", "(_", "itemsize_", "=_", "16_", ",_", "shape_", "=_", "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_", "class_", "Table", "Nat", "ive", "Fla", "vor", "Test", "Case_", "(_", "common_", "._", "Temp", "File", "Mixin_", ",_", "Test", "Case_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "nrows_", "=_", "100_", "\\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_", "Table", "Nat", "ive", "Fla", "vor", "Test", "Case_", "(_", "common_", "._", "Temp", "File", "Mixin_", ",_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "set", "Up_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "super_", "(_", "Table", "Nat", "ive", "Fla", "vor", "Test", "Case_", ",_", "self_", ")_", "._", "set", "Up_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Creat", "e", " ", "an", " ", "instance", " ", "of", " ", "an", " ", "HDF", "5", " ", "Table_", "\\u\\u\\uNL\\u\\u\\u_", "table_", "=_", "self_", "._", "h5file", "_", "._", "create", "\\u", "table_", "(_", "self_", "._", "h5file", "_", "._", "root_", ",_", "'", "table", "'_", ",_", "Test", "TD", "esc", "r_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "expected", "rows_", "=_", "self_", "._", "nrows_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "table_", "._", "flavor_", "=_", "\"", "nump", "y", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", "in_", "range_", "(_", "self_", "._", "nrows_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "table_", "._", "row_", "._", "append_", "(_", ")_", "#", " ", "Fil", "l", " ", "100", " ", "rows", " ", "with", " ", "default", " ", "values_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "table_", "._", "flush_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Table", "Nat", "ive", "Fla", "vor", "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", "1a", "\\u", "basic", "Table", "Read_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Check", "ing", " ", "the", " ", "return", " ", "of", " ", "a", " ", "Num", "Py", " ", "in", " ", "read", "().\"", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "self_", "._", "close_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "reo", "pen_", "(_", "mode_", "=_", "'", "a", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "table_", "=_", "self_", "._", "h5file", "_", "._", "root_", "._", "table_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data_", "=_", "table_", "[_", ":_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "common_", "._", "verbose_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "\"", "Type", " ", "of", " ", "read", ":\"_", ",_", "type_", "(_", "data_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "\"", "Descripti", "on", " ", "of", " ", "the", " ", "record", ":\"_", ",_", "data_", "._", "dtype_", "._", "descr_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "\"", "Fi", "rst", " ", "3", " ", "element", "s", " ", "of", " ", "read", ":\"_", ",_", "data_", "[_", ":_", "3_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Check", " ", "tha", "t", " ", "bot", "h", " ", "Num", "Py", " ", "object", "s", " ", "are", " ", "equal_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "isinstance_", "(_", "data_", ",_", "np_", "._", "ndarray_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Check", " ", "the", " ", "value", " ", "of", " ", "some", " ", "columns_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "A", " ", "flat", " ", "column_", "\\u\\u\\uNL\\u\\u\\u_", "col_", "=_", "table_", "._", "cols_", "._", "x_", "[_", ":_", "3_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "isinstance_", "(_", "col_", ",_", "np_", "._", "ndarray_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "npc", "ol_", "=_", "np_", "._", "zeros_", "(_", "(_", "3_", ",_", "2_", ")_", ",_", "dtype_", "=_", "\"", "int", "32", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "alle", "qual_", "(_", "col_", ",_", "npc", "ol_", ",_", "\"", "nump", "y", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "A", " ", "nest", "ed", " ", "column_", "\\u\\u\\uNL\\u\\u\\u_", "col_", "=_", "table_", "._", "cols_", "._", "Info_", "[_", ":_", "3_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "isinstance_", "(_", "col_", ",_", "np_", "._", "ndarray_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dtype_", "=_", "[_", "(_", "'", "value", "'_", ",_", "'", "c1", "6", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "y2", "'_", ",_", "'", "f8", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "Info", "2", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "(_", "'", "name", "'_", ",_", "'", "S2", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "value", "'_", ",_", "'", "c1", "6", "'_", ",_", "(_", "2_", ",_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "y", "3", "'_", ",_", "'", "f8", "'_", ",_", "(_", "2_", ",_", ")_", ")_", "]_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "name", "'_", ",_", "'", "S2", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "z", "2", "'_", ",_", "'", "u1", "'_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "npc", "ol_", "=_", "np_", "._", "zeros_", "(_", "(_", "3_", ",_", ")_", ",_", "dtype_", "=_", "dtype_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "col_", "._", "dtype_", "._", "descr_", ",_", "npc", "ol_", "._", "dtype_", "._", "descr_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "common_", "._", "verbose_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "\"", "col", "-->", "\"_", ",_", "col_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "\"", "npc", "ol", "-->", "\"_", ",_", "npc", "ol_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "A", " ", "copy", "()", " ", "is", " ", "need", "ed", " ", "in", " ", "case", " ", "the", " ", "buffer", " ", "can", " ", "be", " ", "in", " ", "different", " ", "segments_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "bytes_", "(_", "col_", "._", "copy_", "(_", ")_", "._", "data_", ")_", ",_", "bytes_", "(_", "npc", "ol_", "._", "data_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Table", "Nat", "ive", "Fla", "vor", "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", "1b", "\\u", "basic", "Table", "Read_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Check", "ing", " ", "the", " ", "return", " ", "of", " ", "a", " ", "Num", "Py", " ", "in", " ", "read", "()", " ", "(", "stride", "d", " ", "version", ").\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "self_", "._", "close_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "reo", "pen_", "(_", "mode_", "=_", "'", "a", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "table_", "=_", "self_", "._", "h5file", "_", "._", "root_", "._", "table_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data_", "=_", "table_", "[_", ":_", ":_", "3_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "common_", "._", "verbose_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "\"", "Type", " ", "of", " ", "read", ":\"_", ",_", "type_", "(_", "data_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "\"", "Descripti", "on", " ", "of", " ", "the", " ", "record", ":\"_", ",_", "data_", "._", "dtype_", "._", "descr_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "\"", "Fi", "rst", " ", "3", " ", "element", "s", " ", "of", " ", "read", ":\"_", ",_", "data_", "[_", ":_", "3_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Check", " ", "tha", "t", " ", "bot", "h", " ", "Num", "Py", " ", "object", "s", " ", "are", " ", "equal_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "isinstance_", "(_", "data_", ",_", "np_", "._", "ndarray_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Check", " ", "the", " ", "value", " ", "of", " ", "some", " ", "columns_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "A", " ", "flat", " ", "column_", "\\u\\u\\uNL\\u\\u\\u_", "col_", "=_", "table_", "._", "cols_", "._", "x_", "[_", ":_", "9_", ":_", "3_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "isinstance_", "(_", "col_", ",_", "np_", "._", "ndarray_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "npc", "ol_", "=_", "np_", "._", "zeros_", "(_", "(_", "3_", ",_", "2_", ")_", ",_", "dtype_", "=_", "\"", "int", "32", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "alle", "qual_", "(_", "col_", ",_", "npc", "ol_", ",_", "\"", "nump", "y", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "A", " ", "nest", "ed", " ", "column_", "\\u\\u\\uNL\\u\\u\\u_", "col_", "=_", "table_", "._", "cols_", "._", "Info_", "[_", ":_", "9_", ":_", "3_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "isinstance_", "(_", "col_", ",_", "np_", "._", "ndarray_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dtype_", "=_", "[_", "(_", "'", "value", "'_", ",_", "'%", "sc", "16", "'_", "%_", "byteorder_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "y2", "'_", ",_", "'%", "sf", "8", "'_", "%_", "byteorder_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "Info", "2", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "(_", "'", "name", "'_", ",_", "'|", "S2", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "value", "'_", ",_", "'%", "sc", "16", "'_", "%_", "byteorder_", ",_", "(_", "2_", ",_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "y", "3", "'_", ",_", "'%", "sf", "8", "'_", "%_", "byteorder_", ",_", "(_", "2_", ",_", ")_", ")_", "]_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "name", "'_", ",_", "'|", "S2", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "z", "2", "'_", ",_", "'|", "u1", "'_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "npc", "ol_", "=_", "np_", "._", "zeros_", "(_", "(_", "3_", ",_", ")_", ",_", "dtype_", "=_", "dtype_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "col_", "._", "dtype_", "._", "descr_", ",_", "npc", "ol_", "._", "dtype_", "._", "descr_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "common_", "._", "verbose_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "\"", "col", "-->", "\"_", ",_", "col_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "\"", "npc", "ol", "-->", "\"_", ",_", "npc", "ol_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "A", " ", "copy", "()", " ", "is", " ", "need", "ed", " ", "in", " ", "case", " ", "the", " ", "buffer", " ", "can", " ", "be", " ", "in", " ", "different", " ", "segments_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "bytes_", "(_", "col_", "._", "copy_", "(_", ")_", "._", "data_", ")_", ",_", "bytes_", "(_", "npc", "ol_", "._", "data_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Table", "Nat", "ive", "Fla", "vor", "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", "2", "\\u", "get", "Whe", "re", "List_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Check", "ing", " ", "the", " ", "return", " ", "of", " ", "Num", "Py", " ", "in", " ", "get", "\\u", "where", "\\u", "list", " ", "method", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "self_", "._", "close_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "reo", "pen_", "(_", "mode_", "=_", "'", "a", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "table_", "=_", "self_", "._", "h5file", "_", "._", "root_", "._", "table_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data_", "=_", "table_", "._", "get", "\\u", "where", "\\u", "list_", "(_", "'", "z", " ", "==", " ", "1", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "common_", "._", "verbose_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "\"", "Type", " ", "of", " ", "read", ":\"_", ",_", "type_", "(_", "data_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "\"", "Descripti", "on", " ", "of", " ", "the", " ", "record", ":\"_", ",_", "data_", "._", "dtype_", "._", "descr_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "\"", "Fi", "rst", " ", "3", " ", "element", "s", " ", "of", " ", "read", ":\"_", ",_", "data_", "[_", ":_", "3_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Check", " ", "tha", "t", " ", "bot", "h", " ", "Num", "Py", " ", "object", "s", " ", "are", " ", "equal_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "isinstance_", "(_", "data_", ",_", "np_", "._", "ndarray_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Check", " ", "tha", "t", " ", "all", " ", "column", "s", " ", "have", " ", "bee", "n", " ", "selected_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "data_", ")_", ",_", "100_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Final", "ly", ",", " ", "check", " ", "tha", "t", " ", "the", " ", "content", "s", " ", "are", " ", "ok_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "alle", "qual_", "(_", "data_", ",_", "np_", "._", "arange_", "(_", "100_", ",_", "dtype_", "=_", "\"", "i", "8", "\"_", ")_", ",_", "\"", "nump", "y", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Table", "Nat", "ive", "Fla", "vor", "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", "3a", "\\u", "read", "Whe", "re_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Check", "ing", " ", "the", " ", "return", " ", "of", " ", "Num", "Py", " ", "in", " ", "read", "\\u", "where", " ", "method", " ", "(", "string", "s", ").\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "table_", "=_", "self_", "._", "h5file", "_", "._", "root_", "._", "table_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "table_", "._", "cols_", "._", "color_", "._", "create", "\\u", "index_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "close_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "reo", "pen_", "(_", "mode_", "=_", "'", "a", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "table_", "=_", "self_", "._", "h5file", "_", "._", "root_", "._", "table_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "data_", "=_", "table_", "._", "read", "\\u", "where_", "(_", "'", "color", " ", "==", " ", "b", "\"", "ab", "\"'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "common_", "._", "verbose_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "\"", "Type", " ", "of", " ", "read", ":\"_", ",_", "type_", "(_", "data_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "\"", "Length", " ", "of", " ", "the", " ", "data", " ", "read", ":\"_", ",_", "len_", "(_", "data_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Check", " ", "tha", "t", " ", "bot", "h", " ", "Num", "Py", " ", "object", "s", " ", "are", " ", "equal_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "isinstance_", "(_", "data_", ",_", "np_", "._", "ndarray_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Check", " ", "tha", "t", " ", "all", " ", "column", "s", " ", "have", " ", "bee", "n", " ", "selected_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "data_", ")_", ",_", "self_", "._", "nrows_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Table", "Nat", "ive", "Fla", "vor", "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", "3b", "\\u", "read", "Whe", "re_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Check", "ing", " ", "the", " ", "return", " ", "of", " ", "Num", "Py", " ", "in", " ", "read", "\\u", "where", " ", "method", " ", "(", "numeri", "c", ").\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "table_", "=_", "self_", "._", "h5file", "_", "._", "root_", "._", "table_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "table_", "._", "cols_", "._", "z_", "._", "create", "\\u", "index_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "close_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "reo", "pen_", "(_", "mode_", "=_", "'", "a", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "table_", "=_", "self_", "._", "h5file", "_", "._", "root_", "._", "table_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "data_", "=_", "table_", "._", "read", "\\u", "where_", "(_", "'", "z", " ", "==", " ", "0", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "common_", "._", "verbose_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "\"", "Type", " ", "of", " ", "read", ":\"_", ",_", "type_", "(_", "data_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "\"", "Length", " ", "of", " ", "the", " ", "data", " ", "read", ":\"_", ",_", "len_", "(_", "data_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Check", " ", "tha", "t", " ", "bot", "h", " ", "Num", "Py", " ", "object", "s", " ", "are", " ", "equal_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "isinstance_", "(_", "data_", ",_", "np_", "._", "ndarray_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Check", " ", "tha", "t", " ", "all", " ", "column", "s", " ", "have", " ", "bee", "n", " ", "selected_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "data_", ")_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Table", "Nat", "ive", "Fla", "vor", "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", "4a", "\\u", "create", "Table_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Check", "ing", " ", "the", " ", "Table", " ", "creati", "on", " ", "from", " ", "a", " ", "nump", "y", " ", "reca", "rray", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "dtype_", "=_", "[_", "(_", "'", "value", "'_", ",_", "'%", "sc", "16", "'_", "%_", "byteorder_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "y2", "'_", ",_", "'%", "sf", "8", "'_", "%_", "byteorder_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "Info", "2", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "(_", "'", "name", "'_", ",_", "'|", "S2", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "value", "'_", ",_", "'%", "sc", "16", "'_", "%_", "byteorder_", ",_", "(_", "2_", ",_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "y", "3", "'_", ",_", "'%", "sf", "8", "'_", "%_", "byteorder_", ",_", "(_", "2_", ",_", ")_", ")_", "]_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "name", "'_", ",_", "'|", "S2", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "z", "2", "'_", ",_", "'|", "u1", "'_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "np", "data_", "=_", "np_", "._", "zeros_", "(_", "(_", "3_", ",_", ")_", ",_", "dtype_", "=_", "dtype_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "table_", "=_", "self_", "._", "h5file", "_", "._", "create", "\\u", "table_", "(_", "self_", "._", "h5file", "_", "._", "root_", ",_", "'", "table", "2", "'_", ",_", "np", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "close_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "reo", "pen_", "(_", "mode_", "=_", "'", "a", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "table_", "=_", "self_", "._", "h5file", "_", "._", "root_", "._", "table2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "data_", "=_", "table_", "[_", ":_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "common_", "._", "verbose_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "\"", "Type", " ", "of", " ", "read", ":\"_", ",_", "type_", "(_", "data_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "\"", "Descripti", "on", " ", "of", " ", "the", " ", "record", ":\"_", ",_", "data_", "._", "dtype_", "._", "descr_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "\"", "Fi", "rst", " ", "3", " ", "element", "s", " ", "of", " ", "read", ":\"_", ",_", "data_", "[_", ":_", "3_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "\"", "Length", " ", "of", " ", "the", " ", "data", " ", "read", ":\"_", ",_", "len_", "(_", "data_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Check", " ", "tha", "t", " ", "bot", "h", " ", "Num", "Py", " ", "object", "s", " ", "are", " ", "equal_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "isinstance_", "(_", "data_", ",_", "np_", "._", "ndarray_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Check", " ", "the", " ", "type_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "data_", "._", "dtype_", "._", "descr_", ",_", "np", "data_", "._", "dtype_", "._", "descr_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "common_", "._", "verbose_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "\"", "np", "data", "-->", "\"_", ",_", "np", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "\"", "data", "-->", "\"_", ",_", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "A", " ", "copy", "()", " ", "is", " ", "need", "ed", " ", "in", " ", "case", " ", "the", " ", "buffer", " ", "wou", "ld", " ", "be", " ", "in", " ", "different", " ", "segments_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "bytes_", "(_", "data_", "._", "copy_", "(_", ")_", "._", "data_", ")_", ",_", "bytes_", "(_", "np", "data_", "._", "data_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Table", "Nat", "ive", "Fla", "vor", "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", "4b", "\\u", "append", "Table_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Check", "ing", " ", "appendi", "ng", " ", "a", " ", "nump", "y", " ", "reca", "rray", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "table_", "=_", "self_", "._", "h5file", "_", "._", "root_", "._", "table_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "np", "data_", "=_", "table_", "[_", "3_", ":_", "6_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "table_", "._", "append_", "(_", "np", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "close_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "reo", "pen_", "(_", "mode_", "=_", "'", "a", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "table_", "=_", "self_", "._", "h5file", "_", "._", "root_", "._", "table_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "data_", "=_", "table_", "[_", "-_", "3_", ":_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "common_", "._", "verbose_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "\"", "Type", " ", "of", " ", "read", ":\"_", ",_", "type_", "(_", "data_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "\"", "Descripti", "on", " ", "of", " ", "the", " ", "record", ":\"_", ",_", "data_", "._", "dtype_", "._", "descr_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "\"", "Las", "t", " ", "3", " ", "element", "s", " ", "of", " ", "read", ":\"_", ",_", "data_", "[_", "-_", "3_", ":_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "\"", "Length", " ", "of", " ", "the", " ", "data", " ", "read", ":\"_", ",_", "len_", "(_", "data_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Check", " ", "tha", "t", " ", "bot", "h", " ", "Num", "Py", " ", "object", "s", " ", "are", " ", "equal_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "isinstance_", "(_", "data_", ",_", "np_", "._", "ndarray_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Check", " ", "the", " ", "type_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "data_", "._", "dtype_", "._", "descr_", ",_", "np", "data_", "._", "dtype_", "._", "descr_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "common_", "._", "verbose_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "\"", "np", "data", "-->", "\"_", ",_", "np", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "\"", "data", "-->", "\"_", ",_", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "A", " ", "copy", "()", " ", "is", " ", "need", "ed", " ", "in", " ", "case", " ", "the", " ", "buffer", " ", "wou", "ld", " ", "be", " ", "in", " ", "different", " ", "segments_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "bytes_", "(_", "data_", "._", "copy_", "(_", ")_", "._", "data_", ")_", ",_", "bytes_", "(_", "np", "data_", "._", "data_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Table", "Nat", "ive", "Fla", "vor", "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", "assign", "Column_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Check", "ing", " ", "assign", "ing", " ", "to", " ", "a", " ", "column", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "table_", "=_", "self_", "._", "h5file", "_", "._", "root_", "._", "table_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "table_", "._", "cols_", "._", "z_", "[_", ":_", "]_", "=_", "np_", "._", "zeros_", "(_", "(_", "100_", ",_", ")_", ",_", "dtype_", "=_", "'", "u1", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "close_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "reo", "pen_", "(_", "mode_", "=_", "'", "a", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "table_", "=_", "self_", "._", "h5file", "_", "._", "root_", "._", "table_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "data_", "=_", "table_", "._", "cols_", "._", "z_", "[_", ":_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "common_", "._", "verbose_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "\"", "Type", " ", "of", " ", "read", ":\"_", ",_", "type_", "(_", "data_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "\"", "Descripti", "on", " ", "of", " ", "the", " ", "record", ":\"_", ",_", "data_", "._", "dtype_", "._", "descr_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "\"", "Fi", "rst", " ", "3", " ", "element", "s", " ", "of", " ", "read", ":\"_", ",_", "data_", "[_", ":_", "3_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "\"", "Length", " ", "of", " ", "the", " ", "data", " ", "read", ":\"_", ",_", "len_", "(_", "data_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Check", " ", "tha", "t", " ", "bot", "h", " ", "Num", "Py", " ", "object", "s", " ", "are", " ", "equal_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "isinstance_", "(_", "data_", ",_", "np_", "._", "ndarray_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Check", " ", "tha", "t", " ", "all", " ", "column", "s", " ", "have", " ", "bee", "n", " ", "selected_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "data_", ")_", ",_", "100_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Final", "ly", ",", " ", "check", " ", "tha", "t", " ", "the", " ", "content", "s", " ", "are", " ", "ok_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "alle", "qual_", "(_", "data_", ",_", "np_", "._", "zeros_", "(_", "(_", "100_", ",_", ")_", ",_", "dtype_", "=_", "\"", "u1", "\"_", ")_", ",_", "\"", "nump", "y", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Table", "Nat", "ive", "Fla", "vor", "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", "5b", "\\u", "modif", "ying", "Columns_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Check", "ing", " ", "modif", "ying", " ", "sever", "al", " ", "column", "s", " ", "at", " ", "onc", "e", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "table_", "=_", "self_", "._", "h5file", "_", "._", "root_", "._", "table_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xco", "l_", "=_", "np_", "._", "ones_", "(_", "(_", "3_", ",_", "2_", ")_", ",_", "'", "int", "32", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "yco", "l_", "=_", "np_", "._", "zeros_", "(_", "(_", "3_", ",_", "2_", ",_", "2_", ")_", ",_", "'", "float", "64", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "zc", "ol_", "=_", "np_", "._", "zeros_", "(_", "(_", "3_", ",_", ")_", ",_", "'", "uint", "8", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "table_", "._", "modif", "y", "\\u", "columns_", "(_", "3_", ",_", "6_", ",_", "1_", ",_", "[_", "xco", "l_", ",_", "yco", "l_", ",_", "zc", "ol_", "]_", ",_", "[_", "'", "x", "'_", ",_", "'", "y", "'_", ",_", "'", "z", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "close_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "reo", "pen_", "(_", "mode_", "=_", "'", "a", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "table_", "=_", "self_", "._", "h5file", "_", "._", "root_", "._", "table_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "data_", "=_", "table_", "._", "cols_", "._", "y_", "[_", "3_", ":_", "6_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "common_", "._", "verbose_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "\"", "Type", " ", "of", " ", "read", ":\"_", ",_", "type_", "(_", "data_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "\"", "Descripti", "on", " ", "of", " ", "the", " ", "record", ":\"_", ",_", "data_", "._", "dtype_", "._", "descr_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "\"", "Fi", "rst", " ", "3", " ", "element", "s", " ", "of", " ", "read", ":\"_", ",_", "data_", "[_", ":_", "3_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "\"", "Length", " ", "of", " ", "the", " ", "data", " ", "read", ":\"_", ",_", "len_", "(_", "data_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Check", " ", "tha", "t", " ", "bot", "h", " ", "Num", "Py", " ", "object", "s", " ", "are", " ", "equal_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "isinstance_", "(_", "data_", ",_", "np_", "._", "ndarray_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Check", " ", "the", " ", "type_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "data_", "._", "dtype_", "._", "descr_", ",_", "yco", "l_", "._", "dtype_", "._", "descr_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "common_", "._", "verbose_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "\"", "yco", "l", "-->", "\"_", ",_", "yco", "l_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "\"", "data", "-->", "\"_", ",_", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "A", " ", "copy", "()", " ", "is", " ", "need", "ed", " ", "in", " ", "case", " ", "the", " ", "buffer", " ", "wou", "ld", " ", "be", " ", "in", " ", "different", " ", "segments_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "data_", "._", "copy_", "(_", ")_", "._", "data_", ",_", "yco", "l_", "._", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Table", "Nat", "ive", "Fla", "vor", "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", "5c", "\\u", "modif", "ying", "Columns_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Check", "ing", " ", "modif", "ying", " ", "sever", "al", " ", "column", "s", " ", "usi", "ng", " ", "a", " ", "single", " ", "nump", "y", " ", "buffer", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "table_", "=_", "self_", "._", "h5file", "_", "._", "root_", "._", "table_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dtype_", "=_", "[_", "(_", "'", "x", "'_", ",_", "'", "i", "4", "'_", ",_", "(_", "2_", ",_", ")_", ")_", ",_", "(_", "'", "y", "'_", ",_", "'", "f8", "'_", ",_", "(_", "2_", ",_", "2_", ")_", ")_", ",_", "(_", "'", "z", "'_", ",_", "'", "u1", "'_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "npar", "ray_", "=_", "np_", "._", "zeros_", "(_", "(_", "3_", ",_", ")_", ",_", "dtype_", "=_", "dtype_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "table_", "._", "modif", "y", "\\u", "columns_", "(_", "3_", ",_", "6_", ",_", "1_", ",_", "npar", "ray_", ",_", "[_", "'", "x", "'_", ",_", "'", "y", "'_", ",_", "'", "z", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "close_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "reo", "pen_", "(_", "mode_", "=_", "'", "a", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "table_", "=_", "self_", "._", "h5file", "_", "._", "root_", "._", "table_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "yco", "l_", "=_", "np_", "._", "zeros_", "(_", "(_", "3_", ",_", "2_", ",_", "2_", ")_", ",_", "'", "float", "64", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data_", "=_", "table_", "._", "cols_", "._", "y_", "[_", "3_", ":_", "6_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "common_", "._", "verbose_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "\"", "Type", " ", "of", " ", "read", ":\"_", ",_", "type_", "(_", "data_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "\"", "Descripti", "on", " ", "of", " ", "the", " ", "record", ":\"_", ",_", "data_", "._", "dtype_", "._", "descr_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "\"", "Fi", "rst", " ", "3", " ", "element", "s", " ", "of", " ", "read", ":\"_", ",_", "data_", "[_", ":_", "3_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "\"", "Length", " ", "of", " ", "the", " ", "data", " ", "read", ":\"_", ",_", "len_", "(_", "data_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Check", " ", "tha", "t", " ", "bot", "h", " ", "Num", "Py", " ", "object", "s", " ", "are", " ", "equal_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "isinstance_", "(_", "data_", ",_", "np_", "._", "ndarray_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Check", " ", "the", " ", "type_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "data_", "._", "dtype_", "._", "descr_", ",_", "yco", "l_", "._", "dtype_", "._", "descr_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "common_", "._", "verbose_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "\"", "yco", "l", "-->", "\"_", ",_", "yco", "l_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "\"", "data", "-->", "\"_", ",_", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "A", " ", "copy", "()", " ", "is", " ", "need", "ed", " ", "in", " ", "case", " ", "the", " ", "buffer", " ", "wou", "ld", " ", "be", " ", "in", " ", "different", " ", "segments_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "data_", "._", "copy_", "(_", ")_", "._", "data_", ",_", "yco", "l_", "._", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Table", "Nat", "ive", "Fla", "vor", "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", "6a", "\\u", "assign", "Nest", "ed", "Column_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Check", "ing", " ", "assign", "ing", " ", "a", " ", "nest", "ed", " ", "column", " ", "(", "usi", "ng", " ", "modif", "y", "\\u", "column", ").\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "table_", "=_", "self_", "._", "h5file", "_", "._", "root_", "._", "table_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dtype_", "=_", "[_", "(_", "'", "value", "'_", ",_", "'%", "sc", "16", "'_", "%_", "byteorder_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "y2", "'_", ",_", "'%", "sf", "8", "'_", "%_", "byteorder_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "Info", "2", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "(_", "'", "name", "'_", ",_", "'|", "S2", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "value", "'_", ",_", "'%", "sc", "16", "'_", "%_", "byteorder_", ",_", "(_", "2_", ",_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "y", "3", "'_", ",_", "'%", "sf", "8", "'_", "%_", "byteorder_", ",_", "(_", "2_", ",_", ")_", ")_", "]_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "name", "'_", ",_", "'|", "S2", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "z", "2", "'_", ",_", "'|", "u1", "'_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "np", "data_", "=_", "np_", "._", "zeros_", "(_", "(_", "3_", ",_", ")_", ",_", "dtype_", "=_", "dtype_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data_", "=_", "table_", "._", "cols_", "._", "Info_", "[_", "3_", ":_", "6_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "table_", "._", "modif", "y", "\\u", "column_", "(_", "3_", ",_", "6_", ",_", "1_", ",_", "column_", "=_", "np", "data_", ",_", "colname_", "=_", "'", "Info", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "close_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "reo", "pen_", "(_", "mode_", "=_", "'", "a", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "table_", "=_", "self_", "._", "h5file", "_", "._", "root_", "._", "table_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "data_", "=_", "table_", "._", "cols_", "._", "Info_", "[_", "3_", ":_", "6_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "common_", "._", "verbose_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "\"", "Type", " ", "of", " ", "read", ":\"_", ",_", "type_", "(_", "data_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "\"", "Descripti", "on", " ", "of", " ", "the", " ", "record", ":\"_", ",_", "data_", "._", "dtype_", "._", "descr_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "\"", "Fi", "rst", " ", "3", " ", "element", "s", " ", "of", " ", "read", ":\"_", ",_", "data_", "[_", ":_", "3_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "\"", "Length", " ", "of", " ", "the", " ", "data", " ", "read", ":\"_", ",_", "len_", "(_", "data_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Check", " ", "tha", "t", " ", "bot", "h", " ", "Num", "Py", " ", "object", "s", " ", "are", " ", "equal_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "isinstance_", "(_", "data_", ",_", "np_", "._", "ndarray_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Check", " ", "the", " ", "type_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "data_", "._", "dtype_", "._", "descr_", ",_", "np", "data_", "._", "dtype_", "._", "descr_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "common_", "._", "verbose_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "\"", "np", "data", "-->", "\"_", ",_", "np", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "\"", "data", "-->", "\"_", ",_", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "A", " ", "copy", "()", " ", "is", " ", "need", "ed", " ", "in", " ", "case", " ", "the", " ", "buffer", " ", "wou", "ld", " ", "be", " ", "in", " ", "different", " ", "segments_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "bytes_", "(_", "data_", "._", "copy_", "(_", ")_", "._", "data_", ")_", ",_", "bytes_", "(_", "np", "data_", "._", "data_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Table", "Nat", "ive", "Fla", "vor", "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", "6b", "\\u", "assign", "Nest", "ed", "Column_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Check", "ing", " ", "assign", "ing", " ", "a", " ", "nest", "ed", " ", "column", " ", "(", "usi", "ng", " ", "the", " ", ".", "cols", " ", "accessor", ").\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "table_", "=_", "self_", "._", "h5file", "_", "._", "root_", "._", "table_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dtype_", "=_", "[_", "(_", "'", "value", "'_", ",_", "'%", "sc", "16", "'_", "%_", "byteorder_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "y2", "'_", ",_", "'%", "sf", "8", "'_", "%_", "byteorder_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "Info", "2", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "(_", "'", "name", "'_", ",_", "'|", "S2", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "value", "'_", ",_", "'%", "sc", "16", "'_", "%_", "byteorder_", ",_", "(_", "2_", ",_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "y", "3", "'_", ",_", "'%", "sf", "8", "'_", "%_", "byteorder_", ",_", "(_", "2_", ",_", ")_", ")_", "]_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "name", "'_", ",_", "'|", "S2", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "z", "2", "'_", ",_", "'|", "u1", "'_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "np", "data_", "=_", "np_", "._", "zeros_", "(_", "(_", "3_", ",_", ")_", ",_", "dtype_", "=_", "dtype_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "self", ".", "assert", "Rai", "ses", "(", "Not", "Impl", "ement", "ed", "Error", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", " ", "table", ".", "cols", ".", "Info", ".\\u", "\\u", "setitem", "\\u\\u", ",", " ", "slice", "(", "3", ",", "6", ",", "1", "),", " ", " ", "np", "data", ")_", "\\u\\u\\uNL\\u\\u\\u_", "table_", "._", "cols_", "._", "Info_", "[_", "3_", ":_", "6_", "]_", "=_", "np", "data_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "close_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "reo", "pen_", "(_", "mode_", "=_", "'", "a", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "table_", "=_", "self_", "._", "h5file", "_", "._", "root_", "._", "table_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "data_", "=_", "table_", "._", "cols_", "._", "Info_", "[_", "3_", ":_", "6_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "common_", "._", "verbose_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "\"", "Type", " ", "of", " ", "read", ":\"_", ",_", "type_", "(_", "data_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "\"", "Descripti", "on", " ", "of", " ", "the", " ", "record", ":\"_", ",_", "data_", "._", "dtype_", "._", "descr_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "\"", "Fi", "rst", " ", "3", " ", "element", "s", " ", "of", " ", "read", ":\"_", ",_", "data_", "[_", ":_", "3_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "\"", "Length", " ", "of", " ", "the", " ", "data", " ", "read", ":\"_", ",_", "len_", "(_", "data_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Check", " ", "tha", "t", " ", "bot", "h", " ", "Num", "Py", " ", "object", "s", " ", "are", " ", "equal_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "isinstance_", "(_", "data_", ",_", "np_", "._", "ndarray_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Check", " ", "the", " ", "type_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "data_", "._", "dtype_", "._", "descr_", ",_", "np", "data_", "._", "dtype_", "._", "descr_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "common_", "._", "verbose_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "\"", "np", "data", "-->", "\"_", ",_", "np", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "\"", "data", "-->", "\"_", ",_", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "A", " ", "copy", "()", " ", "is", " ", "need", "ed", " ", "in", " ", "case", " ", "the", " ", "buffer", " ", "wou", "ld", " ", "be", " ", "in", " ", "different", " ", "segments_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "bytes_", "(_", "data_", "._", "copy_", "(_", ")_", "._", "data_", ")_", ",_", "bytes_", "(_", "np", "data_", "._", "data_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Table", "Nat", "ive", "Fla", "vor", "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", "7a", "\\u", "modif", "ying", "Rows_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Check", "ing", " ", "modif", "ying", " ", "sever", "al", " ", "rows", " ", "at", " ", "onc", "e", " ", "(", "usi", "ng", " ", "modif", "y", "\\u", "rows", ").\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "table_", "=_", "self_", "._", "h5file", "_", "._", "root_", "._", "table_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Read", " ", "a", " ", "chunk", " ", "of", " ", "the", " ", "table_", "\\u\\u\\uNL\\u\\u\\u_", "chunk_", "=_", "table_", "[_", "0_", ":_", "3_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Modif", "y", " ", "it", " ", "some", "what_", "\\u\\u\\uNL\\u\\u\\u_", "chunk_", "[_", "'", "y", "'_", "]_", "[_", ":_", "]_", "=_", "-_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "table_", "._", "modif", "y", "\\u", "rows_", "(_", "3_", ",_", "6_", ",_", "1_", ",_", "rows_", "=_", "chunk_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "close_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "reo", "pen_", "(_", "mode_", "=_", "'", "a", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "table_", "=_", "self_", "._", "h5file", "_", "._", "root_", "._", "table_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "yco", "l_", "=_", "np_", "._", "zeros_", "(_", "(_", "3_", ",_", "2_", ",_", "2_", ")_", ",_", "'", "float", "64", "'_", ")_", "-_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data_", "=_", "table_", "._", "cols_", "._", "y_", "[_", "3_", ":_", "6_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "common_", "._", "verbose_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "\"", "Type", " ", "of", " ", "read", ":\"_", ",_", "type_", "(_", "data_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "\"", "Descripti", "on", " ", "of", " ", "the", " ", "record", ":\"_", ",_", "data_", "._", "dtype_", "._", "descr_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "\"", "Fi", "rst", " ", "3", " ", "element", "s", " ", "of", " ", "read", ":\"_", ",_", "data_", "[_", ":_", "3_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "\"", "Length", " ", "of", " ", "the", " ", "data", " ", "read", ":\"_", ",_", "len_", "(_", "data_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Check", " ", "tha", "t", " ", "bot", "h", " ", "Num", "Py", " ", "object", "s", " ", "are", " ", "equal_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "isinstance_", "(_", "data_", ",_", "np_", "._", "ndarray_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Check", " ", "the", " ", "type_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "data_", "._", "dtype_", "._", "descr_", ",_", "yco", "l_", "._", "dtype_", "._", "descr_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "common_", "._", "verbose_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "\"", "yco", "l", "-->", "\"_", ",_", "yco", "l_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "\"", "data", "-->", "\"_", ",_", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "alle", "qual_", "(_", "yco", "l_", ",_", "data_", ",_", "\"", "nump", "y", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Table", "Nat", "ive", "Fla", "vor", "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", "7b", "\\u", "modif", "ying", "Rows_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Check", "ing", " ", "modif", "ying", " ", "sever", "al", " ", "rows", " ", "at", " ", "onc", "e", " ", "(", "usi", "ng", " ", "cols", " ", "accessor", ").\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "table_", "=_", "self_", "._", "h5file", "_", "._", "root_", "._", "table_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Read", " ", "a", " ", "chunk", " ", "of", " ", "the", " ", "table_", "\\u\\u\\uNL\\u\\u\\u_", "chunk_", "=_", "table_", "[_", "0_", ":_", "3_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Modif", "y", " ", "it", " ", "some", "what_", "\\u\\u\\uNL\\u\\u\\u_", "chunk_", "[_", "'", "y", "'_", "]_", "[_", ":_", "]_", "=_", "-_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "table_", "._", "cols_", "[_", "3_", ":_", "6_", "]_", "=_", "chunk_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "close_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "reo", "pen_", "(_", "mode_", "=_", "'", "a", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "table_", "=_", "self_", "._", "h5file", "_", "._", "root_", "._", "table_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Check", " ", "tha", "t", " ", "some", " ", "column", " ", "has", " ", "bee", "n", " ", "actual", "ly", " ", "modified_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "yco", "l_", "=_", "np_", "._", "zeros_", "(_", "(_", "3_", ",_", "2_", ",_", "2_", ")_", ",_", "'", "float", "64", "'_", ")_", "-_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data_", "=_", "table_", "._", "cols_", "._", "y_", "[_", "3_", ":_", "6_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "common_", "._", "verbose_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "\"", "Type", " ", "of", " ", "read", ":\"_", ",_", "type_", "(_", "data_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "\"", "Descripti", "on", " ", "of", " ", "the", " ", "record", ":\"_", ",_", "data_", "._", "dtype_", "._", "descr_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "\"", "Fi", "rst", " ", "3", " ", "element", "s", " ", "of", " ", "read", ":\"_", ",_", "data_", "[_", ":_", "3_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "\"", "Length", " ", "of", " ", "the", " ", "data", " ", "read", ":\"_", ",_", "len_", "(_", "data_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Check", " ", "tha", "t", " ", "bot", "h", " ", "Num", "Py", " ", "object", "s", " ", "are", " ", "equal_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "isinstance_", "(_", "data_", ",_", "np_", "._", "ndarray_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Check", " ", "the", " ", "type_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "data_", "._", "dtype_", "._", "descr_", ",_", "yco", "l_", "._", "dtype_", "._", "descr_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "common_", "._", "verbose_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "\"", "yco", "l", "-->", "\"_", ",_", "yco", "l_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "\"", "data", "-->", "\"_", ",_", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "alle", "qual_", "(_", "yco", "l_", ",_", "data_", ",_", "\"", "nump", "y", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Table", "Nat", "ive", "Fla", "vor", "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", "8a", "\\u", "modif", "ying", "Rows_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Check", "ing", " ", "modif", "ying", " ", "just", " ", "one", " ", "row", " ", "at", " ", "onc", "e", " ", "(", "usi", "ng", " ", "modif", "y", "\\u", "rows", ").\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "table_", "=_", "self_", "._", "h5file", "_", "._", "root_", "._", "table_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Read", " ", "a", " ", "chunk", " ", "of", " ", "the", " ", "table_", "\\u\\u\\uNL\\u\\u\\u_", "chunk_", "=_", "table_", "[_", "3_", ":_", "4_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Modif", "y", " ", "it", " ", "some", "what_", "\\u\\u\\uNL\\u\\u\\u_", "chunk_", "[_", "'", "y", "'_", "]_", "[_", ":_", "]_", "=_", "-_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "table_", "._", "modif", "y", "\\u", "rows_", "(_", "6_", ",_", "7_", ",_", "1_", ",_", "chunk_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "close_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "reo", "pen_", "(_", "mode_", "=_", "'", "a", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "table_", "=_", "self_", "._", "h5file", "_", "._", "root_", "._", "table_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Check", " ", "tha", "t", " ", "some", " ", "column", " ", "has", " ", "bee", "n", " ", "actual", "ly", " ", "modified_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "yco", "l_", "=_", "np_", "._", "zeros_", "(_", "(_", "2_", ",_", "2_", ")_", ",_", "'", "float", "64", "'_", ")_", "-_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data_", "=_", "table_", "._", "cols_", "._", "y_", "[_", "6_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "common_", "._", "verbose_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "\"", "Type", " ", "of", " ", "read", ":\"_", ",_", "type_", "(_", "data_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "\"", "Descripti", "on", " ", "of", " ", "the", " ", "record", ":\"_", ",_", "data_", "._", "dtype_", "._", "descr_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "\"", "Fi", "rst", " ", "3", " ", "element", "s", " ", "of", " ", "read", ":\"_", ",_", "data_", "[_", ":_", "3_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "\"", "Length", " ", "of", " ", "the", " ", "data", " ", "read", ":\"_", ",_", "len_", "(_", "data_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Check", " ", "tha", "t", " ", "bot", "h", " ", "Num", "Py", " ", "object", "s", " ", "are", " ", "equal_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "isinstance_", "(_", "data_", ",_", "np_", "._", "ndarray_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Check", " ", "the", " ", "type_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "data_", "._", "dtype_", "._", "descr_", ",_", "yco", "l_", "._", "dtype_", "._", "descr_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "common_", "._", "verbose_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "\"", "yco", "l", "-->", "\"_", ",_", "yco", "l_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "\"", "data", "-->", "\"_", ",_", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "alle", "qual_", "(_", "yco", "l_", ",_", "data_", ",_", "\"", "nump", "y", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Table", "Nat", "ive", "Fla", "vor", "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", "8b", "\\u", "modif", "ying", "Rows_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Check", "ing", " ", "modif", "ying", " ", "just", " ", "one", " ", "row", " ", "at", " ", "onc", "e", " ", "(", "usi", "ng", " ", "cols", " ", "accessor", ").\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "table_", "=_", "self_", "._", "h5file", "_", "._", "root_", "._", "table_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Read", " ", "a", " ", "chunk", " ", "of", " ", "the", " ", "table_", "\\u\\u\\uNL\\u\\u\\u_", "chunk_", "=_", "table_", "[_", "3_", ":_", "4_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Modif", "y", " ", "it", " ", "some", "what_", "\\u\\u\\uNL\\u\\u\\u_", "chunk_", "[_", "'", "y", "'_", "]_", "[_", ":_", "]_", "=_", "-_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "table_", "._", "cols_", "[_", "6_", "]_", "=_", "chunk_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "close_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "reo", "pen_", "(_", "mode_", "=_", "'", "a", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "table_", "=_", "self_", "._", "h5file", "_", "._", "root_", "._", "table_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Check", " ", "tha", "t", " ", "some", " ", "column", " ", "has", " ", "bee", "n", " ", "actual", "ly", " ", "modified_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "yco", "l_", "=_", "np_", "._", "zeros_", "(_", "(_", "2_", ",_", "2_", ")_", ",_", "'", "float", "64", "'_", ")_", "-_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data_", "=_", "table_", "._", "cols_", "._", "y_", "[_", "6_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "common_", "._", "verbose_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "\"", "Type", " ", "of", " ", "read", ":\"_", ",_", "type_", "(_", "data_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "\"", "Descripti", "on", " ", "of", " ", "the", " ", "record", ":\"_", ",_", "data_", "._", "dtype_", "._", "descr_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "\"", "Fi", "rst", " ", "3", " ", "element", "s", " ", "of", " ", "read", ":\"_", ",_", "data_", "[_", ":_", "3_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "\"", "Length", " ", "of", " ", "the", " ", "data", " ", "read", ":\"_", ",_", "len_", "(_", "data_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Check", " ", "tha", "t", " ", "bot", "h", " ", "Num", "Py", " ", "object", "s", " ", "are", " ", "equal_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "isinstance_", "(_", "data_", ",_", "np_", "._", "ndarray_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Check", " ", "the", " ", "type_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "data_", "._", "dtype_", "._", "descr_", ",_", "yco", "l_", "._", "dtype_", "._", "descr_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "common_", "._", "verbose_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "\"", "yco", "l", "-->", "\"_", ",_", "yco", "l_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "\"", "data", "-->", "\"_", ",_", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "alle", "qual_", "(_", "yco", "l_", ",_", "data_", ",_", "\"", "nump", "y", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Table", "Nat", "ive", "Fla", "vor", "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", "9", "a", "\\u", "get", "Strings_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Check", "ing", " ", "the", " ", "return", " ", "of", " ", "string", " ", "column", "s", " ", "with", " ", "space", "s", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "self_", "._", "close_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "reo", "pen_", "(_", "mode_", "=_", "'", "a", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "table_", "=_", "self_", "._", "h5file", "_", "._", "root_", "._", "table_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rdata_", "=_", "table_", "._", "get", "\\u", "where", "\\u", "list_", "(_", "'", "color", " ", "==", " ", "b", "\"", "ab", "\"'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data_", "=_", "table_", "._", "read", "\\u", "coordinates_", "(_", "rdata_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "common_", "._", "verbose_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "\"", "Type", " ", "of", " ", "read", ":\"_", ",_", "type_", "(_", "data_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "\"", "Descripti", "on", " ", "of", " ", "the", " ", "record", ":\"_", ",_", "data_", "._", "dtype_", "._", "descr_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "\"", "Fi", "rst", " ", "3", " ", "element", "s", " ", "of", " ", "read", ":\"_", ",_", "data_", "[_", ":_", "3_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Check", " ", "tha", "t", " ", "bot", "h", " ", "Num", "Py", " ", "object", "s", " ", "are", " ", "equal_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "isinstance_", "(_", "data_", ",_", "np_", "._", "ndarray_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Check", " ", "tha", "t", " ", "all", " ", "column", "s", " ", "have", " ", "bee", "n", " ", "selected_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "data_", ")_", ",_", "100_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Final", "ly", ",", " ", "check", " ", "tha", "t", " ", "the", " ", "content", "s", " ", "are", " ", "ok_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "idat", "a_", "in_", "data_", "[_", "'", "color", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "Equal_", "(_", "idat", "a_", ",_", "np_", "._", "array_", "(_", "\"", "ab", "\"_", ",_", "dtype_", "=_", "\"|", "S4", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Table", "Nat", "ive", "Fla", "vor", "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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test0", "9", "b", "\\u", "get", "Strings_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Check", "ing", " ", "the", " ", "return", " ", "of", " ", "string", " ", "column", "s", " ", "with", " ", "space", "s", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "(", "modif", "y", ")", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "self_", "._", "close_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "reo", "pen_", "(_", "mode_", "=_", "'", "a", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "table_", "=_", "self_", "._", "h5file", "_", "._", "root_", "._", "table_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", "in_", "range_", "(_", "50_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "table_", "._", "cols_", "._", "color_", "[_", "i_", "]_", "=_", "\"", "a", " ", " ", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "table_", "._", "flush_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data_", "=_", "table_", "[_", ":_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "common_", "._", "verbose_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "\"", "Type", " ", "of", " ", "read", ":\"_", ",_", "type_", "(_", "data_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "\"", "Descripti", "on", " ", "of", " ", "the", " ", "record", ":\"_", ",_", "data_", "._", "dtype_", "._", "descr_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "\"", "Fi", "rst", " ", "3", " ", "element", "s", " ", "of", " ", "read", ":\"_", ",_", "data_", "[_", ":_", "3_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Check", " ", "tha", "t", " ", "bot", "h", " ", "Num", "Py", " ", "object", "s", " ", "are", " ", "equal_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "isinstance_", "(_", "data_", ",_", "np_", "._", "ndarray_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Check", " ", "tha", "t", " ", "all", " ", "column", "s", " ", "have", " ", "bee", "n", " ", "selected_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "data_", ")_", ",_", "100_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Final", "ly", ",", " ", "check", " ", "tha", "t", " ", "the", " ", "content", "s", " ", "are", " ", "ok_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "i_", "in_", "range_", "(_", "100_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "idat", "a_", "=_", "data_", "[_", "'", "color", "'_", "]_", "[_", "i_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "i_", ">=_", "50_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "Equal_", "(_", "idat", "a_", ",_", "np_", "._", "array_", "(_", "\"", "ab", "\"_", ",_", "dtype_", "=_", "\"|", "S4", "\"_", ")_", ")_", "\\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_", "._", "assert", "Equal_", "(_", "idat", "a_", ",_", "np_", "._", "array_", "(_", "\"", "a", " ", " ", "\"_", ",_", "dtype_", "=_", "\"|", "S4", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Table", "Nat", "ive", "Fla", "vor", "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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test0", "9c", "\\u", "get", "Strings_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Check", "ing", " ", "the", " ", "return", " ", "of", " ", "string", " ", "column", "s", " ", "with", " ", "space", "s", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "(", "append", ")", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "self_", "._", "close_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "reo", "pen_", "(_", "mode_", "=_", "'", "a", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "table_", "=_", "self_", "._", "h5file", "_", "._", "root_", "._", "table_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "row_", "=_", "table_", "._", "row_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", "in_", "range_", "(_", "50_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "row_", "[_", "\"", "color", "\"_", "]_", "=_", "\"", "a", " ", " ", "\"_", "#", " ", "note", " ", "the", " ", "trail", "ing", " ", "spaces_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "row_", "._", "append_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "table_", "._", "flush_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "close_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "h5file", "_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "h5file", "_", "=_", "tables_", "._", "open", "\\u", "file_", "(_", "self_", "._", "h5", "fname_", ",_", "\"", "a", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "data_", "=_", "self_", "._", "h5file", "_", "._", "root_", "._", "table_", "[_", ":_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "common_", "._", "verbose_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "\"", "Type", " ", "of", " ", "read", ":\"_", ",_", "type_", "(_", "data_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "\"", "Descripti", "on", " ", "of", " ", "the", " ", "record", ":\"_", ",_", "data_", "._", "dtype_", "._", "descr_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "\"", "Fi", "rst", " ", "3", " ", "element", "s", " ", "of", " ", "read", ":\"_", ",_", "data_", "[_", ":_", "3_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Check", " ", "tha", "t", " ", "bot", "h", " ", "Num", "Py", " ", "object", "s", " ", "are", " ", "equal_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "isinstance_", "(_", "data_", ",_", "np_", "._", "ndarray_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Check", " ", "tha", "t", " ", "all", " ", "column", "s", " ", "have", " ", "bee", "n", " ", "selected_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "data_", ")_", ",_", "150_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Final", "ly", ",", " ", "check", " ", "tha", "t", " ", "the", " ", "content", "s", " ", "are", " ", "ok_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "i_", "in_", "range_", "(_", "150_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "idat", "a_", "=_", "data_", "[_", "'", "color", "'_", "]_", "[_", "i_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "i_", "<_", "100_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "Equal_", "(_", "idat", "a_", ",_", "np_", "._", "array_", "(_", "\"", "ab", "\"_", ",_", "dtype_", "=_", "\"|", "S4", "\"_", ")_", ")_", "\\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_", "._", "assert", "Equal_", "(_", "idat", "a_", ",_", "np_", "._", "array_", "(_", "\"", "a", " ", " ", "\"_", ",_", "dtype_", "=_", "\"|", "S4", "\"_", ")_", ")_", "\\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_", "Table", "Nat", "ive", "Fla", "vor", "Open", "Test", "Case_", "(_", "Table", "Nat", "ive", "Fla", "vor", "Test", "Case_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "close_", "=_", "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_", "class_", "Table", "Nat", "ive", "Fla", "vor", "Clos", "e", "Test", "Case_", "(_", "Table", "Nat", "ive", "Fla", "vor", "Test", "Case_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "close_", "=_", "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_", "class_", "Attribute", "s", "Test", "Case_", "(_", "common_", "._", "Temp", "File", "Mixin_", ",_", "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_", "Attribute", "s", "Test", "Case_", "(_", "common_", "._", "Temp", "File", "Mixin_", ",_", "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 ", " _", "super_", "(_", "Attribute", "s", "Test", "Case_", ",_", "self_", ")_", "._", "set", "Up_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Creat", "e", " ", "an", " ", "instance", " ", "of", " ", "an", " ", "HDF", "5", " ", "Table_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "create", "\\u", "group_", "(_", "self_", "._", "h5file", "_", "._", "root_", ",_", "'", "group", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Attribute", "s", "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", "1", "\\u", "write", "Attribute_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Check", "ing", " ", "the", " ", "creati", "on", " ", "of", " ", "a", " ", "nump", "y", " ", "attribute", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "group_", "=_", "self_", "._", "h5file", "_", "._", "root_", "._", "group_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "g", "\\u", "attrs_", "=_", "group_", "._", "\\u", "v", "\\u", "attrs_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "g", "\\u", "attrs_", "._", "nump", "y1_", "=_", "np_", "._", "zeros_", "(_", "(_", "1_", ",_", "1_", ")_", ",_", "dtype_", "=_", "'", "int", "16", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "close_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "reo", "pen_", "(_", "mode_", "=_", "'", "a", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "group_", "=_", "self_", "._", "h5file", "_", "._", "root_", "._", "group_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "g", "\\u", "attrs_", "=_", "group_", "._", "\\u", "v", "\\u", "attrs_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Check", " ", "tha", "t", " ", "we", " ", "can", " ", "retrieve", " ", "a", " ", "nump", "y", " ", "object_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "data_", "=_", "g", "\\u", "attrs_", "._", "nump", "y1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "npc", "omp", "_", "=_", "np_", "._", "zeros_", "(_", "(_", "1_", ",_", "1_", ")_", ",_", "dtype_", "=_", "'", "int", "16", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Check", " ", "tha", "t", " ", "bot", "h", " ", "Num", "Py", " ", "object", "s", " ", "are", " ", "equal_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "isinstance_", "(_", "data_", ",_", "np_", "._", "ndarray_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Check", " ", "the", " ", "type_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "data_", "._", "dtype_", "._", "descr_", ",_", "npc", "omp", "_", "._", "dtype_", "._", "descr_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "common_", "._", "verbose_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "\"", "npc", "omp", "-->", "\"_", ",_", "npc", "omp", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "\"", "data", "-->", "\"_", ",_", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "alle", "qual_", "(_", "npc", "omp", "_", ",_", "data_", ",_", "\"", "nump", "y", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Attribute", "s", "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", "2", "\\u", "update", "Attribute_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Check", "ing", " ", "the", " ", "modification", " ", "of", " ", "a", " ", "nump", "y", " ", "attribute", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "group_", "=_", "self_", "._", "h5file", "_", "._", "root_", "._", "group_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "g", "\\u", "attrs_", "=_", "group_", "._", "\\u", "v", "\\u", "attrs_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "g", "\\u", "attrs_", "._", "nump", "y1_", "=_", "np_", "._", "zeros_", "(_", "(_", "1_", ",_", "2_", ")_", ",_", "dtype_", "=_", "'", "int", "16", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "close_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "reo", "pen_", "(_", "mode_", "=_", "'", "a", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "group_", "=_", "self_", "._", "h5file", "_", "._", "root_", "._", "group_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "g", "\\u", "attrs_", "=_", "group_", "._", "\\u", "v", "\\u", "attrs_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Update", " ", "this", " ", "attribute_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "g", "\\u", "attrs_", "._", "nump", "y1_", "=_", "np_", "._", "ones_", "(_", "(_", "1_", ",_", "2_", ")_", ",_", "dtype_", "=_", "'", "int", "16", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Check", " ", "tha", "t", " ", "we", " ", "can", " ", "retrieve", " ", "a", " ", "nump", "y", " ", "object_", "\\u\\u\\uNL\\u\\u\\u_", "data_", "=_", "g", "\\u", "attrs_", "._", "nump", "y1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "npc", "omp", "_", "=_", "np_", "._", "ones_", "(_", "(_", "1_", ",_", "2_", ")_", ",_", "dtype_", "=_", "'", "int", "16", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Check", " ", "tha", "t", " ", "bot", "h", " ", "Num", "Py", " ", "object", "s", " ", "are", " ", "equal_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "isinstance_", "(_", "data_", ",_", "np_", "._", "ndarray_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Check", " ", "the", " ", "type_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "data_", "._", "dtype_", "._", "descr_", ",_", "npc", "omp", "_", "._", "dtype_", "._", "descr_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "common_", "._", "verbose_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "\"", "npc", "omp", "-->", "\"_", ",_", "npc", "omp", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "\"", "data", "-->", "\"_", ",_", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "alle", "qual_", "(_", "npc", "omp", "_", ",_", "data_", ",_", "\"", "nump", "y", "\"_", ")_", ")_", "\\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_", "Attribute", "s", "Open", "Test", "Case_", "(_", "Attribute", "s", "Test", "Case_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "close_", "=_", "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_", "class_", "Attribute", "s", "Clos", "e", "Test", "Case_", "(_", "Attribute", "s", "Test", "Case_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "close_", "=_", "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_", "class_", "Str", "len", "Test", "Case_", "(_", "common_", "._", "Temp", "File", "Mixin_", ",_", "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_", "Str", "len", "Test", "Case_", "(_", "common_", "._", "Temp", "File", "Mixin_", ",_", "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 ", " _", "super_", "(_", "Str", "len", "Test", "Case_", ",_", "self_", ")_", "._", "set", "Up_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Creat", "e", " ", "an", " ", "instance", " ", "of", " ", "an", " ", "HDF", "5", " ", "Table_", "\\u\\u\\uNL\\u\\u\\u_", "group_", "=_", "self_", "._", "h5file", "_", "._", "create", "\\u", "group_", "(_", "self_", "._", "h5file", "_", "._", "root_", ",_", "'", "group", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "table", "layout_", "=_", "{_", "'", "Text", "'_", ":_", "String", "Col_", "(_", "itemsize_", "=_", "1000_", ")_", ",_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "table_", "=_", "self_", "._", "h5file", "_", "._", "create", "\\u", "table_", "(_", "group_", ",_", "'", "table", "'_", ",_", "table", "layout_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "table_", "._", "flavor_", "=_", "'", "nump", "y", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "row_", "=_", "self_", "._", "table_", "._", "row_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "row_", "[_", "'", "Text", "'_", "]_", "=_", "'", "Hell", "o", " ", "France", "sc", "!'_", "#", " ", "XX", "X", ":", " ", "check", " ", "unicode", " ", "-->", " ", "bytes_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "row_", "._", "append_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "row_", "[_", "'", "Text", "'_", "]_", "=_", "'", "Hol", "a", " ", "France", "sc", "!'_", "#", " ", "XX", "X", ":", " ", "check", " ", "unicode", " ", "-->", " ", "bytes_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "row_", "._", "append_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "table_", "._", "flush_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Str", "len", "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", "1_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Check", "ing", " ", "the", " ", "length", "s", " ", "of", " ", "string", "s", " ", "(", "read", " ", "field", ").\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "self_", "._", "close_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "reo", "pen_", "(_", "mode_", "=_", "'", "a", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "table_", "=_", "self_", "._", "h5file", "_", "._", "root_", "._", "group_", "._", "table_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Get", " ", "bot", "h", " ", "strings_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "str1_", "=_", "self_", "._", "table_", "._", "col_", "(_", "'", "Text", "'_", ")_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "str2_", "=_", "self_", "._", "table_", "._", "col_", "(_", "'", "Text", "'_", ")_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "common_", "._", "verbose_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "\"", "string", "1", "-->", "\"_", ",_", "str1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "\"", "string", "2", "-->", "\"_", ",_", "str2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Check", " ", "tha", "t", " ", "bot", "h", " ", "Num", "Py", " ", "object", "s", " ", "are", " ", "equal_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "str1_", ")_", ",_", "len_", "(_", "b", "'", "Hell", "o", " ", "France", "sc", "!'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "str2_", ")_", ",_", "len_", "(_", "b", "'", "Hol", "a", " ", "France", "sc", "!'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "str1_", ",_", "b", "'", "Hell", "o", " ", "France", "sc", "!'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "str2_", ",_", "b", "'", "Hol", "a", " ", "France", "sc", "!'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Str", "len", "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", "2_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Check", "ing", " ", "the", " ", "length", "s", " ", "of", " ", "string", "s", " ", "(", "read", " ", "reca", "rray", ").\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "self_", "._", "close_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "reo", "pen_", "(_", "mode_", "=_", "'", "a", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "table_", "=_", "self_", "._", "h5file", "_", "._", "root_", "._", "group_", "._", "table_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Get", " ", "bot", "h", " ", "strings_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "str1_", "=_", "self_", "._", "table_", "[_", ":_", "]_", "[_", "'", "Text", "'_", "]_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "str2_", "=_", "self_", "._", "table_", "[_", ":_", "]_", "[_", "'", "Text", "'_", "]_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Check", " ", "tha", "t", " ", "bot", "h", " ", "Num", "Py", " ", "object", "s", " ", "are", " ", "equal_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "str1_", ")_", ",_", "len_", "(_", "b", "'", "Hell", "o", " ", "France", "sc", "!'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "str2_", ")_", ",_", "len_", "(_", "b", "'", "Hol", "a", " ", "France", "sc", "!'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "str1_", ",_", "b", "'", "Hell", "o", " ", "France", "sc", "!'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "str2_", ",_", "b", "'", "Hol", "a", " ", "France", "sc", "!'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Str", "len", "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", "3_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Check", "ing", " ", "the", " ", "length", "s", " ", "of", " ", "string", "s", " ", "(", "read", " ", "reca", "rray", ",", " ", "row", " ", "by", " ", "row", ").\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "self_", "._", "close_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "reo", "pen_", "(_", "mode_", "=_", "'", "a", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "table_", "=_", "self_", "._", "h5file", "_", "._", "root_", "._", "group_", "._", "table_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Get", " ", "bot", "h", " ", "strings_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "str1_", "=_", "self_", "._", "table_", "[_", "0_", "]_", "[_", "'", "Text", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "str2_", "=_", "self_", "._", "table_", "[_", "1_", "]_", "[_", "'", "Text", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Check", " ", "tha", "t", " ", "bot", "h", " ", "Num", "Py", " ", "object", "s", " ", "are", " ", "equal_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "str1_", ")_", ",_", "len_", "(_", "b", "'", "Hell", "o", " ", "France", "sc", "!'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "str2_", ")_", ",_", "len_", "(_", "b", "'", "Hol", "a", " ", "France", "sc", "!'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "str1_", ",_", "b", "'", "Hell", "o", " ", "France", "sc", "!'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "str2_", ",_", "b", "'", "Hol", "a", " ", "France", "sc", "!'_", ")_", "\\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_", "Str", "len", "Open", "Test", "Case_", "(_", "Str", "len", "Test", "Case_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "close_", "=_", "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_", "class_", "Str", "len", "Clos", "e", "Test", "Case_", "(_", "Str", "len", "Test", "Case_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "close_", "=_", "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_", "suite_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "the", "Suite_", "=_", "unittest_", "._", "Test", "Suite_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "niter_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "the", "Suit", "e", ".", "add", "Test", "(", "unittest", ".", "make", "Suit", "e", "(", "Str", "len", "Open", "Test", "Case", "))", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "the", "Suit", "e", ".", "add", "Test", "(", "unittest", ".", "make", "Suit", "e", "(", "Basic", "0", "DO", "ne", "Test", "Case", "))", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "the", "Suit", "e", ".", "add", "Test", "(", "unittest", ".", "make", "Suit", "e", "(", "Group", "s", "Array", "Test", "Case", "))", "_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "i_", "in_", "range_", "(_", "niter_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "the", "Suite_", "._", "add", "Test_", "(_", "unittest_", "._", "make", "Suite_", "(_", "Basic", "0", "DO", "ne", "Test", "Case_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "the", "Suite_", "._", "add", "Test_", "(_", "unittest_", "._", "make", "Suite_", "(_", "Basic", "0", "DT", "wo", "Test", "Case_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "the", "Suite_", "._", "add", "Test_", "(_", "unittest_", "._", "make", "Suite_", "(_", "Basic", "1", "DO", "ne", "Test", "Case_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "the", "Suite_", "._", "add", "Test_", "(_", "unittest_", "._", "make", "Suite_", "(_", "Basic", "1", "DT", "wo", "Test", "Case_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "the", "Suite_", "._", "add", "Test_", "(_", "unittest_", "._", "make", "Suite_", "(_", "Basic", "1", "DT", "hre", "e", "Test", "Case_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "the", "Suite_", "._", "add", "Test_", "(_", "unittest_", "._", "make", "Suite_", "(_", "Basic", "2", "DT", "est", "Case_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "the", "Suite_", "._", "add", "Test_", "(_", "unittest_", "._", "make", "Suite_", "(_", "Group", "s", "Array", "Test", "Case_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "the", "Suite_", "._", "add", "Test_", "(_", "unittest_", "._", "make", "Suite_", "(_", "Table", "Read", "Test", "Case_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "the", "Suite_", "._", "add", "Test_", "(_", "unittest_", "._", "make", "Suite_", "(_", "Table", "Nat", "ive", "Fla", "vor", "Open", "Test", "Case_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "the", "Suite_", "._", "add", "Test_", "(_", "unittest_", "._", "make", "Suite_", "(_", "Table", "Nat", "ive", "Fla", "vor", "Clos", "e", "Test", "Case_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "the", "Suite_", "._", "add", "Test_", "(_", "unittest_", "._", "make", "Suite_", "(_", "Attribute", "s", "Open", "Test", "Case_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "the", "Suite_", "._", "add", "Test_", "(_", "unittest_", "._", "make", "Suite_", "(_", "Attribute", "s", "Clos", "e", "Test", "Case_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "the", "Suite_", "._", "add", "Test_", "(_", "unittest_", "._", "make", "Suite_", "(_", "Str", "len", "Open", "Test", "Case_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "the", "Suite_", "._", "add", "Test_", "(_", "unittest_", "._", "make", "Suite_", "(_", "Str", "len", "Clos", "e", "Test", "Case_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "common_", "._", "heav", "y_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "the", "Suite_", "._", "add", "Test_", "(_", "unittest_", "._", "make", "Suite_", "(_", "Basic", "10", "DT", "est", "Case_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "The", " ", "32", " ", "dimension", "s", " ", "case", " ", "take", "s", " ", "forever", " ", "to", " ", "run", "!!", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "the", "Suit", "e", ".", "add", "Test", "(", "unittest", ".", "make", "Suit", "e", "(", "Basic", "32", "DT", "est", "Case", "))", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "the", "Suite_", "\\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, 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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 ]
Unused import
twisted/twisted/twisted/internet/test/fakeendpoint.py
[ { "content": "# -*- test-case-name: twisted.internet.test.test_endpoints -*-\n# Copyright (c) Twisted Matrix Laboratories.\n# See LICENSE for details.\n\n\"\"\"\nFake client and server endpoint string parser plugins for testing purposes.\n\"\"\"\n\nfrom __future__ import absolute_import, division\n\nfrom zope.interface.declarations import implementer\nfrom twisted.plugin import IPlugin\nfrom twisted.internet.interfaces import (\n IStreamClientEndpoint, IStreamServerEndpoint,\n IStreamServerEndpointStringParser,\n IStreamClientEndpointStringParserWithReactor)\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n# Instantiate plugin interface providers to register them.\nfake = FakeParser('fake')\nfakeClientWithReactor = FakeClientParserWithReactor('crfake')\nfakeClientWithReactorAndPreference = FakeClientParserWithReactor('cpfake')\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "@implementer(IPlugin)\nclass PluginBase(object):\n", "metadata": "root.PluginBase", "header": "['module', '___EOS___']", "index": 18 }, { "content": " def __init__(self, pfx):\n self.prefix = pfx", "metadata": "root.PluginBase.__init__", "header": "['class', 'PluginBase', '(', 'object', ')', ':', '___EOS___']", "index": 21 }, { "content": "@implementer(IStreamClientEndpointStringParserWithReactor)\nclass FakeClientParserWithReactor(PluginBase):\n", "metadata": "root.FakeClientParserWithReactor", "header": "['module', '___EOS___']", "index": 26 }, { "content": " def parseStreamClient(self, *a, **kw):\n return StreamClient(self, a, kw)", "metadata": "root.FakeClientParserWithReactor.parseStreamClient", "header": "['class', 'FakeClientParserWithReactor', '(', 'PluginBase', ')', ':', '___EOS___']", "index": 29 }, { "content": "@implementer(IStreamServerEndpointStringParser)\nclass FakeParser(PluginBase):\n", "metadata": "root.FakeParser", "header": "['module', '___EOS___']", "index": 34 }, { "content": " def parseStreamServer(self, *a, **kw):\n return StreamServer(self, a, kw)", "metadata": "root.FakeParser.parseStreamServer", "header": "['class', 'FakeParser', '(', 'PluginBase', ')', ':', '___EOS___']", "index": 37 }, { "content": "class EndpointBase(object):\n", "metadata": "root.EndpointBase", "header": "['module', '___EOS___']", "index": 42 }, { "content": " def __init__(self, parser, args, kwargs):\n self.parser = parser\n self.args = args\n self.kwargs = kwargs", "metadata": "root.EndpointBase.__init__", "header": "['class', 'EndpointBase', '(', 'object', ')', ':', '___EOS___']", "index": 44 }, { "content": "@implementer(IStreamClientEndpoint)\nclass StreamClient(EndpointBase):\n pass", "metadata": "root.StreamClient", "header": "['module', '___EOS___']", "index": 51 }, { "content": "@implementer(IStreamServerEndpoint)\nclass StreamServer(EndpointBase):\n pass", "metadata": "root.StreamServer", "header": "['module', '___EOS___']", "index": 57 } ]
[]
[]
0
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "-*-", " ", "test", "-", "case", "-", "name", ":", " ", "twist", "ed", ".", "interne", "t", ".", "test", ".", "test\\u", "endpoint", "s", " ", "-*-", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Copy", "right", " ", "(", "c", ")", " ", "Twi", "sted", " ", "Matrix", " ", "Labo", "rator", "ies", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "See", " ", "LICENSE", " ", "for", " ", "deta", "il", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\"\"\"", "\\", "10", ";", "Fake", " ", "client", " ", "and", " ", "server", " ", "endpoint", " ", "string", " ", "parser", " ", "plugin", "s", " ", "for", " ", "testi", "ng", " ", "purpose", "s", ".", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "\\u\\u", "future\\u\\u_", "import_", "abs", "olute", "\\u", "import_", ",_", "division_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "zope_", "._", "interface_", "._", "declarations_", "import_", "implement", "er_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "twisted_", "._", "plugin_", "import_", "IP", "lugi", "n_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "twisted_", "._", "internet_", "._", "interfaces_", "import_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "IS", "tream", "Client", "Endpoint_", ",_", "IS", "tream", "Server", "Endpoint_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "IS", "tream", "Server", "End", "point", "String", "Parser_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "IS", "tream", "Client", "End", "point", "String", "Parser", "With", "Reactor", "_", ")_", "\\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\\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\\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_", "#", " ", "Instantiate", " ", "plugin", " ", "interface", " ", "provide", "rs", " ", "to", " ", "register", " ", "them", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "fake_", "=_", "Fake", "Parser_", "(_", "'", "fake", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fake", "Client", "With", "Reactor", "_", "=_", "Fake", "Client", "Parser", "With", "Reactor", "_", "(_", "'", "cr", "fake", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fake", "Client", "With", "Reactor", "And", "Preference", "_", "=_", "Fake", "Client", "Parser", "With", "Reactor", "_", "(_", "'", "cp", "fake", "'_", ")_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "@_", "implement", "er_", "(_", "IP", "lugi", "n_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "class_", "Plug", "in", "Base_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Plug", "in", "Base_", "(_", "object_", ")_", ":_", "\\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_", ",_", "pfx", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "prefix_", "=_", "pfx", "_", "\\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_", "@_", "implement", "er_", "(_", "IS", "tream", "Client", "End", "point", "String", "Parser", "With", "Reactor", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "class_", "Fake", "Client", "Parser", "With", "Reactor", "_", "(_", "Plug", "in", "Base_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Fake", "Client", "Parser", "With", "Reactor", "_", "(_", "Plug", "in", "Base_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "parse", "Stream", "Client_", "(_", "self_", ",_", "*_", "a_", ",_", "**_", "kw_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "Stream", "Client_", "(_", "self_", ",_", "a_", ",_", "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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "implement", "er_", "(_", "IS", "tream", "Server", "End", "point", "String", "Parser_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "class_", "Fake", "Parser_", "(_", "Plug", "in", "Base_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Fake", "Parser_", "(_", "Plug", "in", "Base_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "parse", "Stream", "Server_", "(_", "self_", ",_", "*_", "a_", ",_", "**_", "kw_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "Stream", "Server_", "(_", "self_", ",_", "a_", ",_", "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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "End", "point", "Base_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "End", "point", "Base_", "(_", "object_", ")_", ":_", "\\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_", ",_", "parser_", ",_", "args_", ",_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "parser_", "=_", "parser_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "args_", "=_", "args_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "kwargs_", "=_", "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_", "@_", "implement", "er_", "(_", "IS", "tream", "Client", "Endpoint_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "class_", "Stream", "Client_", "(_", "End", "point", "Base_", ")_", ":_", "\\u\\u\\uNEWLINE\\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_", "@_", "implement", "er_", "(_", "IS", "tream", "Server", "Endpoint_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "class_", "Stream", "Server_", "(_", "End", "point", "Base_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\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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 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, 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 ]
Redundant assignment
OpenMDAO/OpenMDAO/openmdao/util/test/test_filewrap.py
[ { "content": " def test_output_parse(self):\n\n data = \"Junk\\n\" + \\\n \"Anchor\\n\" + \\\n \" A 1, 2 34, Test 1e65\\n\" + \\\n \" B 4 Stuff\\n\" + \\\n \"Anchor\\n\" + \\\n \" C 77 False NaN 333.444\\n\" + \\\n \" 1,2,3,4,5\\n\" + \\\n \" Inf 1.#QNAN -1.#IND\\n\"\n\n outfile = open(self.filename, 'w')\n outfile.write(data)\n outfile.close()\n\n gen = FileParser()\n gen.set_file(self.filename)\n gen.set_delimiters(' ')\n\n gen.mark_anchor('Anchor')\n val = gen.transfer_var(1, 1)\n self.assertEqual(val, 'A')\n gen.reset_anchor()\n val = gen.transfer_var(3, 2)\n self.assertEqual(val, 4)\n self.assertEqual(type(val), int)\n gen.mark_anchor('Anchor',2)\n val = gen.transfer_var(1, 4)\n self.assertEqual(isnan(val), True)\n val = gen.transfer_var(3, 1)\n self.assertEqual(isinf(val), True)\n val = gen.transfer_var(3, 2)\n self.assertEqual(isnan(val), True)\n val = gen.transfer_var(3, 3)\n self.assertEqual(isnan(val), True)\n val = gen.transfer_line(-1)\n self.assertEqual(val, ' B 4 Stuff')\n\n # Now, let's try column delimiters\n gen.set_delimiters('columns')\n gen.mark_anchor('Anchor',-1)\n val = gen.transfer_var(1, 8, 10)\n self.assertEqual(val, 'als')\n val = gen.transfer_var(1, 17)\n self.assertEqual(val, 333.444)\n\n # Test some errors\n try:\n gen.mark_anchor('C 77', 3.14)\n except ValueError as err:\n msg = \"The value for occurrence must be an integer\"\n self.assertEqual(str(err), msg)\n else:\n self.fail('ValueError expected')\n\n try:\n gen.mark_anchor('C 77', 0)\n except ValueError as err:\n msg = \"0 is not valid for an anchor occurrence.\"\n self.assertEqual(str(err), msg)\n else:\n self.fail('ValueError expected')\n\n try:\n gen.mark_anchor('ZZZ')\n except RuntimeError as err:\n msg = \"Could not find pattern ZZZ in output file filename.dat\"\n self.assertEqual(str(err), msg)\n else:\n self.fail('RuntimeError expected')", "metadata": "root.TestCase.test_output_parse", "header": "['class', 'TestCase', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 199 } ]
[]
[]
0
true
[ "[CLS]_", "Redu", "ndan", "t_", "assignment_", "[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", "output", "\\u", "parse_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "data_", "=_", "\"", "Jun", "k", "\\\\", "n", "\"_", "+_", "\"", "Anc", "hor", "\\\\", "n", "\"_", "+_", "\"", " ", "A", " ", "1", ",", " ", "2", " ", "3", "4", ",", " ", "Test", " ", "1e", "6", "5", "\\\\", "n", "\"_", "+_", "\"", " ", "B", " ", "4", " ", "Stuff", "\\\\", "n", "\"_", "+_", "\"", "Anc", "hor", "\\\\", "n", "\"_", "+_", "\"", " ", "C", " ", "7", "7", " ", "Fal", "se", " ", "Na", "N", " ", "333", ".4", "4", "4", "\\\\", "n", "\"_", "+_", "\"", " ", "1", ",", "2", ",", "3", ",", "4", ",", "5", "\\\\", "n", "\"_", "+_", "\"", " ", "Inf", " ", "1", ".#", "QN", "AN", " ", "-1", ".#", "IND", "\\\\", "n", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "outfile_", "=_", "open_", "(_", "self_", "._", "filename_", ",_", "'", "w", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "outfile_", "._", "write_", "(_", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "outfile_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "gen_", "=_", "File", "Parser_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "gen_", "._", "set\\u", "file_", "(_", "self_", "._", "filename_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "gen_", "._", "set\\u", "delimiter", "s_", "(_", "'", " ", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "gen_", "._", "mark", "\\u", "anchor_", "(_", "'", "Anc", "hor", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "val_", "=_", "gen_", "._", "transfer", "\\u", "var_", "(_", "1_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "val_", ",_", "'", "A", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "gen_", "._", "reset", "\\u", "anchor_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "val_", "=_", "gen_", "._", "transfer", "\\u", "var_", "(_", "3_", ",_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "val_", ",_", "4_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "type_", "(_", "val_", ")_", ",_", "int_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "gen_", "._", "mark", "\\u", "anchor_", "(_", "'", "Anc", "hor", "'_", ",_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "val_", "=_", "gen_", "._", "transfer", "\\u", "var_", "(_", "1_", ",_", "4_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "isnan_", "(_", "val_", ")_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "val_", "=_", "gen_", "._", "transfer", "\\u", "var_", "(_", "3_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "isinf", "_", "(_", "val_", ")_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "val_", "=_", "gen_", "._", "transfer", "\\u", "var_", "(_", "3_", ",_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "isnan_", "(_", "val_", ")_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "val_", "=_", "gen_", "._", "transfer", "\\u", "var_", "(_", "3_", ",_", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "isnan_", "(_", "val_", ")_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "val_", "=_", "gen_", "._", "transfer", "\\u", "line_", "(_", "-_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "val_", ",_", "'", " ", "B", " ", "4", " ", "Stuff", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "No", "w", ",", " ", "let", "'", "s", " ", "try", " ", "column", " ", "delimiter", "s_", "\\u\\u\\uNL\\u\\u\\u_", "gen_", "._", "set\\u", "delimiter", "s_", "(_", "'", "column", "s", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "gen_", "._", "mark", "\\u", "anchor_", "(_", "'", "Anc", "hor", "'_", ",_", "-_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "val_", "=_", "gen_", "._", "transfer", "\\u", "var_", "(_", "1_", ",_", "8_", ",_", "10_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "val_", ",_", "'", "als", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "val_", "=_", "gen_", "._", "transfer", "\\u", "var_", "(_", "1_", ",_", "17_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "val_", ",_", "333", ".4", "44_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Test", " ", "some", " ", "errors_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "gen_", "._", "mark", "\\u", "anchor_", "(_", "'", "C", " ", "7", "7", "'_", ",_", "3.14", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Value", "Error_", "as_", "err_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "msg_", "=_", "\"", "The", " ", "value", " ", "for", " ", "occurrence", " ", "must", " ", "be", " ", "an", " ", "integ", "er", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "str_", "(_", "err_", ")_", ",_", "msg_", ")_", "\\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_", "._", "fail_", "(_", "'", "Value", "Error", " ", "expected", "'_", ")_", "\\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 ", " _", "gen_", "._", "mark", "\\u", "anchor_", "(_", "'", "C", " ", "7", "7", "'_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Value", "Error_", "as_", "err_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "msg_", "=_", "\"", "0", " ", "is", " ", "not", " ", "valid", " ", "for", " ", "an", " ", "anchor", " ", "occurrence", ".\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "str_", "(_", "err_", ")_", ",_", "msg_", ")_", "\\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_", "._", "fail_", "(_", "'", "Value", "Error", " ", "expected", "'_", ")_", "\\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 ", " _", "gen_", "._", "mark", "\\u", "anchor_", "(_", "'", "ZZ", "Z", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Run", "time", "Error_", "as_", "err_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "msg_", "=_", "\"", "Cou", "ld", " ", "not", " ", "find", " ", "pattern", " ", "ZZ", "Z", " ", "in", " ", "output", " ", "file", " ", "filename", ".", "dat", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "str_", "(_", "err_", ")_", ",_", "msg_", ")_", "\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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 ]
Deprecated slice method
concurrence/concurrence/lib/concurrence/containers/dequedict.py
[ { "content": " def __getitem__(self, key):\n #TODO key == -1\n return self.d[key].value", "metadata": "root.DequeDict.__getitem__", "header": "['class', 'DequeDict', '(', 'object', ')', ':', '___EOS___']", "index": 119 } ]
[]
[]
0
true
[ "[CLS]_", "Dep", "reca", "ted_", "slice_", "method_", "[SEP]_", "class_", "Deq", "ue", "Dict_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "getitem\\u\\u_", "(_", "self_", ",_", "key_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "TOD", "O", " ", "key", " ", "==", " ", "-1", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "d_", "[_", "key_", "]_", "._", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 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 ]
Testing equality to None
wehriam/awspider/awspider/aws/sdb.py
[ { "content": " def __init__(self, aws_access_key_id, aws_secret_access_key, rq=None):\n \"\"\"\n **Arguments:**\n * *aws_access_key_id* -- Amazon AWS access key ID\n * *aws_secret_access_key* -- Amazon AWS secret access key\n \n **Keyword arguments:**\n * *rq* -- Optional RequestQueuer object.\n \"\"\"\n if rq is None:\n self.rq = RequestQueuer()\n else:\n self.rq = rq\n self.aws_access_key_id = aws_access_key_id\n self.aws_secret_access_key = aws_secret_access_key\n self.rq.setHostMaxRequestsPerSecond(self.host, 0)\n self.rq.setHostMaxSimultaneousRequests(self.host, 0)", "metadata": "root.AmazonSDB.__init__", "header": "['class', 'AmazonSDB', ':', '___EOS___']", "index": 137 } ]
[]
[]
0
true
[ "[CLS]_", "Test", "ing_", "equality", "_", "to_", "None_", "[SEP]_", "class_", "Ama", "zon", "SD", "B_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "aws", "\\u", "access", "\\u", "key", "\\u", "id_", ",_", "aws", "\\u", "secret", "\\u", "access", "\\u", "key_", ",_", "rq_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "**", "Arg", "ument", "s", ":*", "*", "\\", "10", ";", " ", " ", " ", " ", " ", "*", " ", "*", "aws", "\\u", "access", "\\u", "key", "\\u", "id", "*", " ", "--", " ", "Ama", "zon", " ", "AW", "S", " ", "access", " ", "key", " ", "ID", "\\", "10", ";", " ", " ", " ", " ", " ", "*", " ", "*", "aws", "\\u", "secret", "\\u", "access", "\\u", "key", "*", " ", "--", " ", "Ama", "zon", " ", "AW", "S", " ", "secret", " ", "access", " ", "key", "\\", "10", ";", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", "**", "Key", "word", " ", "argu", "ment", "s", ":*", "*", "\\", "10", ";", " ", " ", " ", " ", " ", "*", " ", "*", "rq", "*", " ", "--", " ", "Optio", "nal", " ", "Request", "Queue", "r", " ", "object", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "rq_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "rq_", "=_", "Request", "Queue", "r_", "(_", ")_", "\\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_", "._", "rq_", "=_", "rq_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "aws", "\\u", "access", "\\u", "key", "\\u", "id_", "=_", "aws", "\\u", "access", "\\u", "key", "\\u", "id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "aws", "\\u", "secret", "\\u", "access", "\\u", "key_", "=_", "aws", "\\u", "secret", "\\u", "access", "\\u", "key_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "rq_", "._", "set", "Host", "Max", "Request", "s", "Per", "Second", "_", "(_", "self_", "._", "host_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "rq_", "._", "set", "Host", "Max", "Simul", "tan", "eo", "us", "Requests_", "(_", "self_", "._", "host_", ",_", "0_", ")_", "\\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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Comparison of constants
amueller/word_cloud/wordcloud/wordcloud.py
[ { "content": " def update(self, img_array, pos_x, pos_y):\n partial_integral = np.cumsum(np.cumsum(img_array[pos_x:, pos_y:], axis=1),\n axis=0)\n # paste recomputed part into old image\n # if x or y is zero it is a bit annoying\n if pos_x > 0:\n if pos_y > 0:\n partial_integral += (self.integral[pos_x - 1, pos_y:]\n - self.integral[pos_x - 1, pos_y - 1])\n else:\n partial_integral += self.integral[pos_x - 1, pos_y:]\n if pos_y > 0:\n partial_integral += self.integral[pos_x:, pos_y - 1][:, np.newaxis]\n\n self.integral[pos_x:, pos_y:] = partial_integral", "metadata": "root.IntegralOccupancyMap.update", "header": "['class', 'IntegralOccupancyMap', '(', 'object', ')', ':', '___EOS___']", "index": 45 } ]
[]
[]
0
true
[ "[CLS]_", "Compari", "son_", "of_", "constants_", "[SEP]_", "class_", "Integra", "l", "Occup", "ancy", "Map_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "update_", "(_", "self_", ",_", "img", "\\u", "array_", ",_", "pos", "\\u", "x_", ",_", "pos", "\\u", "y_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "partial", "\\u", "integral_", "=_", "np_", "._", "cumsum_", "(_", "np_", "._", "cumsum_", "(_", "img", "\\u", "array_", "[_", "pos", "\\u", "x_", ":_", ",_", "pos", "\\u", "y_", ":_", "]_", ",_", "axis_", "=_", "1_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "axis_", "=_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "paste", " ", "recompute", "d", " ", "part", " ", "int", "o", " ", "old", " ", "image_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "if", " ", "x", " ", "or", " ", "y", " ", "is", " ", "zero", " ", "it", " ", "is", " ", "a", " ", "bit", " ", "anno", "ying", "_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "pos", "\\u", "x_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "pos", "\\u", "y_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "partial", "\\u", "integral_", "+=_", "(_", "self_", "._", "integral_", "[_", "pos", "\\u", "x_", "-_", "1_", ",_", "pos", "\\u", "y_", ":_", "]_", "\\u\\u\\uNL\\u\\u\\u_", "-_", "self_", "._", "integral_", "[_", "pos", "\\u", "x_", "-_", "1_", ",_", "pos", "\\u", "y_", "-_", "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 ", " _", "partial", "\\u", "integral_", "+=_", "self_", "._", "integral_", "[_", "pos", "\\u", "x_", "-_", "1_", ",_", "pos", "\\u", "y_", ":_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "pos", "\\u", "y_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "partial", "\\u", "integral_", "+=_", "self_", "._", "integral_", "[_", "pos", "\\u", "x_", ":_", ",_", "pos", "\\u", "y_", "-_", "1_", "]_", "[_", ":_", ",_", "np_", "._", "newaxis_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "integral_", "[_", "pos", "\\u", "x_", ":_", ",_", "pos", "\\u", "y_", ":_", "]_", "=_", "partial", "\\u", "integral_", "\\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 ]
Except block handles 'BaseException'
taoliu/taolib/Scripts/check_map.py
[ { "content": "#!/usr/bin/env python\n# Time-stamp: <2008-02-04 13:20:05 Tao Liu>\n\n\"\"\"Module Description\n\nCopyright (c) 2007 Tao Liu <taoliu@jimmy.harvard.edu>\n\nThis code is free software; you can redistribute it and/or modify it\nunder the terms of the BSD License (see the file COPYING included with\nthe distribution).\n\n@status: experimental\n@version: $Revision$\n@author: Tao Liu\n@contact: taoliu@jimmy.harvard.edu\n\"\"\"\n\n# ------------------------------------\n# python modules\n# ------------------------------------\n\nimport os\nimport sys\nimport re\nfrom optparse import OptionParser\n\n# ------------------------------------\n# constants\n# ------------------------------------\nMIN_DIST = 50\nMAX_DIST = 500\n# ------------------------------------\n# Misc functions\n# ------------------------------------\n\n# ------------------------------------\n# Classes\n# ------------------------------------\n\n\n# ------------------------------------\n# Main function\n# ------------------------------------\n\nif __name__ == '__main__':\n try:\n main()\n except KeyboardInterrupt:\n msgl(_(\"\\n;-) See you!\"))\n sys.exit(0)\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[]
[]
0
true
[ "[CLS]_", "Except", "_", "block_", "handles_", "'", "Base", "Except", "ion", "'_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#!", "/", "usr", "/", "bin", "/", "env", " ", "python_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Time", "-", "stamp", ":", " ", "<", "2008", "-0", "2", "-0", "4", " ", "13", ":", "20", ":", "05", " ", "Ta", "o", " ", "Li", "u", ">_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\"\"\"", "Modul", "e", " ", "Descripti", "on", "\\", "10", ";", "\\", "10", ";", "Copy", "right", " ", "(", "c", ")", " ", "2007", " ", "Ta", "o", " ", "Li", "u", " ", "<", "ta", "oli", "u", "@", "jim", "my", ".", "har", "vard", ".", "edu", ">", "\\", "10", ";", "\\", "10", ";", "Thi", "s", " ", "code", " ", "is", " ", "free", " ", "software", ";", " ", "you", " ", "can", " ", "redis", "tribut", "e", " ", "it", " ", "and", "/", "or", " ", "modif", "y", " ", "it", "\\", "10", ";", "under", " ", "the", " ", "term", "s", " ", "of", " ", "the", " ", "BS", "D", " ", "License", " ", "(", "see", " ", "the", " ", "file", " ", "COPY", "ING", " ", "include", "d", " ", "with", "\\", "10", ";", "the", " ", "distribu", "tion", ").", "\\", "10", ";", "\\", "10", ";", "@", "status", ":", " ", " ", "experimental", "\\", "10", ";", "@", "version", ":", " ", "$", "Revi", "sion", "$", "\\", "10", ";", "@", "author", ":", " ", " ", "Ta", "o", " ", "Li", "u", "\\", "10", ";", "@", "contact", ":", " ", "ta", "oli", "u", "@", "jim", "my", ".", "har", "vard", ".", "edu", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "--------------", "--------------", "--------", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "python", " ", "modules_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "--------------", "--------------", "--------", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "re_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "optparse_", "import_", "Optio", "n", "Parser_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "--------------", "--------------", "--------", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "constants_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "--------------", "--------------", "--------", "_", "\\u\\u\\uNL\\u\\u\\u_", "MIN", "\\u", "DIST", "_", "=_", "50_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "MAX", "\\u", "DIST", "_", "=_", "500_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "--------------", "--------------", "--------", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Mis", "c", " ", "functions_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "--------------", "--------------", "--------", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "--------------", "--------------", "--------", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Classes_", "\\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_", "#", " ", "Main", " ", "function_", "\\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_", "if_", "\\u\\u", "name\\u\\u_", "==_", "'\\u", "\\u", "main", "\\u\\u'_", ":_", "\\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 ", " _", "main_", "(_", ")_", "\\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 ", " _", "msg", "l_", "(_", "\\u_", "(_", "\"\\\\", "n", ";", "-)", " ", "See", " ", "you", "!\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "exit_", "(_", "0_", ")_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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
omab/python-social-auth/social/tests/backends/test_ngpvan.py
[ { "content": " def test_setup_request(self):\n \"\"\"Test the setup_request functionality in the NGP VAN backend\"\"\"\n # We can grab the requested attributes by grabbing the HTML of the\n # OpenID auth form and pulling out the hidden fields\n _, inputs = self.get_form_data(self.backend.auth_html())\n\n # Confirm that the only required attribute is email\n self.assertEqual(inputs['openid.ax.required'], 'ngpvanemail')\n\n # Confirm that the 3 optional attributes are requested \"if available\"\n self.assertIn('ngpvanphone', inputs['openid.ax.if_available'])\n self.assertIn('ngpvanfirstname', inputs['openid.ax.if_available'])\n self.assertIn('ngpvanlastname', inputs['openid.ax.if_available'])\n\n # Verify the individual attribute properties\n self.assertEqual(\n inputs['openid.ax.type.ngpvanemail'],\n 'http://openid.net/schema/contact/internet/email'\n )\n self.assertEqual(\n inputs['openid.ax.type.ngpvanfirstname'],\n 'http://openid.net/schema/namePerson/first'\n )\n self.assertEqual(\n inputs['openid.ax.type.ngpvanlastname'],\n 'http://openid.net/schema/namePerson/last'\n )\n self.assertEqual(\n inputs['openid.ax.type.ngpvanphone'],\n 'http://openid.net/schema/contact/phone/business'\n )", "metadata": "root.NGPVANActionIDOpenIDTest.test_setup_request", "header": "['class', 'NGPVANActionIDOpenIDTest', '(', 'OpenIdTest', ')', ':', '___EOS___']", "index": 127 } ]
[]
[]
0
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "NG", "PV", "ANA", "ction", "ID", "Open", "ID", "Test_", "(_", "Open", "Id", "Test_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "setup", "\\u", "request_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Test", " ", "the", " ", "setup", "\\u", "request", " ", "functional", "it", "y", " ", "in", " ", "the", " ", "NG", "P", " ", "VA", "N", " ", "back", "end", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "We", " ", "can", " ", "gra", "b", " ", "the", " ", "request", "ed", " ", "attribute", "s", " ", "by", " ", "gra", "bbi", "ng", " ", "the", " ", "HTM", "L", " ", "of", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Open", "ID", " ", "auth", " ", "form", " ", "and", " ", "pull", "ing", " ", "out", " ", "the", " ", "hidden", " ", "fields_", "\\u\\u\\uNL\\u\\u\\u_", "\\u_", ",_", "inputs_", "=_", "self_", "._", "get", "\\u", "form", "\\u", "data_", "(_", "self_", "._", "backend_", "._", "auth", "\\u", "html_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Confirm", " ", "tha", "t", " ", "the", " ", "only", " ", "require", "d", " ", "attribute", " ", "is", " ", "email_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "inputs_", "[_", "'", "openid", ".", "ax", ".", "require", "d", "'_", "]_", ",_", "'", "ng", "pv", "ane", "mail", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Confirm", " ", "tha", "t", " ", "the", " ", "3", " ", "option", "al", " ", "attribute", "s", " ", "are", " ", "request", "ed", " ", "\"", "if", " ", "avail", "able", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "In_", "(_", "'", "ng", "pv", "an", "phone", "'_", ",_", "inputs_", "[_", "'", "openid", ".", "ax", ".", "if", "\\u", "avail", "able", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "In_", "(_", "'", "ng", "pv", "an", "first", "name", "'_", ",_", "inputs_", "[_", "'", "openid", ".", "ax", ".", "if", "\\u", "avail", "able", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "In_", "(_", "'", "ng", "pv", "an", "last", "name", "'_", ",_", "inputs_", "[_", "'", "openid", ".", "ax", ".", "if", "\\u", "avail", "able", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Verify", " ", "the", " ", "individual", " ", "attribute", " ", "properties_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "inputs_", "[_", "'", "openid", ".", "ax", ".", "type", ".", "ng", "pv", "ane", "mail", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "http", "://", "openid", ".", "net", "/", "schema", "/", "contact", "/", "interne", "t", "/", "email", "'_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "inputs_", "[_", "'", "openid", ".", "ax", ".", "type", ".", "ng", "pv", "an", "first", "name", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "http", "://", "openid", ".", "net", "/", "schema", "/", "name", "Person", "/", "first", "'_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "inputs_", "[_", "'", "openid", ".", "ax", ".", "type", ".", "ng", "pv", "an", "last", "name", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "http", "://", "openid", ".", "net", "/", "schema", "/", "name", "Person", "/", "last", "'_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "inputs_", "[_", "'", "openid", ".", "ax", ".", "type", ".", "ng", "pv", "an", "phone", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "http", "://", "openid", ".", "net", "/", "schema", "/", "contact", "/", "phone", "/", "business", "'_", "\\u\\u\\uNL\\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 ]
Unused import
beloglazov/openstack-neat/compute-local-manager-start.py
[ { "content": "#!/usr/bin/python2\n\n# Copyright 2012 Anton Beloglazov\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\nfrom neat.config import *\nimport neat.common as common\n\nconfig = read_and_validate_config([DEFAILT_CONFIG_PATH, CONFIG_PATH],\n REQUIRED_FIELDS)\ncompute_hosts = common.parse_compute_hosts(config['compute_hosts'])\n\ncommon.execute_on_hosts(\n compute_hosts, \n ['service openstack-neat-local-manager start'])\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[]
[]
0
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#!", "/", "usr", "/", "bin", "/", "python", "2_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Copy", "right", " ", "2012", " ", "Ant", "on", " ", "Bel", "og", "laz", "ov_", "\\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_", "from_", "nea", "t_", "._", "config_", "import_", "*_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "nea", "t_", "._", "common_", "as_", "common_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "config_", "=_", "read", "\\u", "and", "\\u", "validat", "e\\u", "config_", "(_", "[_", "DEF", "AI", "LT", "\\u", "CONFIG", "\\u", "PATH_", ",_", "CONFIG", "\\u", "PATH_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "REQUIRE", "D", "\\u", "FIELDS_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "compute", "\\u", "hosts_", "=_", "common_", "._", "parse", "\\u", "compute", "\\u", "hosts_", "(_", "config_", "[_", "'", "compute", "\\u", "host", "s", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "common_", "._", "execute", "\\u", "on", "\\u", "hosts_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "compute", "\\u", "hosts_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "'", "service", " ", "openst", "ack", "-", "nea", "t", "-", "local", "-", "manage", "r", " ", "start", "'_", "]_", ")_" ]
[ 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 ]
Except block handles 'BaseException'
marknca/pyenforcement/pyenforcement/enforcement.py
[ { "content": "\tdef _delete(self, url_relative_path, params={}):\n\t\t\"\"\"\n\t\tMake an HTTP DELETE request to the specified URL\n\t\t\"\"\"\n\t\tparams['customerKey'] = self.key\n\n\t\turl = '{}/{}?{}'.format(self.base_url, url_relative_path, urllib.urlencode(params))\n\n\t\t# build a DELETE request\n\t\t# with help from http://stackoverflow.com/questions/17279416/cannot-get-delete-working-with-liburl2-with-python-for-rest-api\n\t\topener = urllib2.build_opener(urllib2.HTTPHandler)\n\t\treq = urllib2.Request(url, None)\n\t\treq.get_method = lambda: 'DELETE'\n\t\treq.add_header('Content-Type', 'application/json')\n\n\t\tresponse = None\n\t\ttry:\n\t\t\tresponse = urllib2.urlopen(req)\n\t\texcept urllib2.HTTPError, err:\n\t\t\tif err.code == 404:\n\t\t\t\tresponse = False\n\t\t\telse:\n\t\t\t\traise(OpenDnsApiException('Could not delete the specified domain(s). Threw exception: {}'.format(err)))\n\t\texcept Exception, err:\n\t\t\traise(OpenDnsApiException('Could not delete the specified domain(s). Threw exception: {}'.format(err)))\n\n\t\tif response and response.getcode() == 204:\n\t\t\treturn True\n\t\telse:\n\t\t\treturn False", "metadata": "root.Api._delete", "header": "['class', 'Api', '(', ')', ':', '___EOS___']", "index": 90 } ]
[]
[]
0
true
[ "[CLS]_", "Except", "_", "block_", "handles_", "'", "Base", "Except", "ion", "'_", "[SEP]_", "class_", "Api_", "(_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "delete_", "(_", "self_", ",_", "url", "\\u", "relative", "\\u", "path_", ",_", "params_", "=_", "{_", "}_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "\"\"\"", "\\", "10", ";", "\t", "\t", "Make", " ", "an", " ", "HTTP", " ", "DELET", "E", " ", "request", " ", "to", " ", "the", " ", "specified", " ", "URL", "\\", "10", ";", "\t", "\t", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "params_", "[_", "'", "customer", "Key", "'_", "]_", "=_", "self_", "._", "key_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "url_", "=_", "'{}/", "{}", "?", "{}'_", "._", "format_", "(_", "self_", "._", "base", "\\u", "url_", ",_", "url", "\\u", "relative", "\\u", "path_", ",_", "urllib_", "._", "urlencode_", "(_", "params_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "build", " ", "a", " ", "DELET", "E", " ", "request_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "with", " ", "help", " ", "from", " ", "http", "://", "stack", "overflow", ".", "com", "/", "question", "s", "/", "172", "794", "16", "/", "cann", "ot", "-", "get", "-", "delete", "-", "working", "-", "with", "-", "lib", "url2", "-", "with", "-", "python", "-", "for", "-", "rest", "-", "api_", "\\u\\u\\uNL\\u\\u\\u_", "opener_", "=_", "urllib2_", "._", "build", "\\u", "opener_", "(_", "urllib2_", "._", "HTTP", "Handler_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "req_", "=_", "urllib2_", "._", "Request_", "(_", "url_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "req_", "._", "get", "\\u", "method_", "=_", "lambda_", ":_", "'", "DELET", "E", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "req_", "._", "add", "\\u", "header_", "(_", "'", "Conten", "t", "-", "Type", "'_", ",_", "'", "applica", "tion", "/", "json", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "response_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "response_", "=_", "urllib2_", "._", "urlopen_", "(_", "req_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "urllib2_", "._", "HTTP", "Error_", ",_", "err_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "if_", "err_", "._", "code_", "==_", "404_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "response_", "=_", "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_", "raise_", "(_", "Open", "Dn", "s", "Ap", "i", "Exception_", "(_", "'", "Cou", "ld", " ", "not", " ", "delete", " ", "the", " ", "specified", " ", "domain", "(", "s", ").", " ", "Thre", "w", " ", "exception", ":", " ", "{}'_", "._", "format_", "(_", "err_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", ",_", "err_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "raise_", "(_", "Open", "Dn", "s", "Ap", "i", "Exception_", "(_", "'", "Cou", "ld", " ", "not", " ", "delete", " ", "the", " ", "specified", " ", "domain", "(", "s", ").", " ", "Thre", "w", " ", "exception", ":", " ", "{}'_", "._", "format_", "(_", "err_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "response_", "and_", "response_", "._", "getco", "de_", "(_", ")_", "==_", "204_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "return_", "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\t", "\t\t_", "return_", "False_", "\\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 ]
Unused import
fp7-ofelia/ocf/expedient/src/python/expedient/clearinghouse/messagecenter/views.py
[ { "content": "'''\n@author: msune \n'''\n\nfrom django.views.generic.simple import direct_to_template\nfrom django.core.urlresolvers import reverse\n\n'''\nShows all the messages in a simple way\n'''\n\n \n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def home(request):\n\treturn direct_to_template(\n \trequest,\n\t template='expedient/clearinghouse/messagecenter/index.html',\n \textra_context={\n\t\t \"messages\": \"\",\n\t \"breadcrumbs\": (\n \t (\"Home\", reverse(\"home\")),\n \t(\"Last messages of %s\" % request.user.username,\"\"),\n\t ),\n\t }\n\t )", "metadata": "root.home", "header": "['module', '___EOS___']", "index": 11 } ]
[]
[]
0
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "'''", "\\", "10", ";", "@", "author", ":", " ", "ms", "une", " ", "\\", "10", ";'", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "django_", "._", "views_", "._", "generic_", "._", "simple_", "import_", "direct", "\\u", "to", "\\u", "template_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "core_", "._", "urlresolvers_", "import_", "reverse_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "'''", "\\", "10", ";", "Show", "s", " ", "all", " ", "the", " ", "message", "s", " ", "in", " ", "a", " ", "simple", " ", "way", "\\", "10", ";'", "''_", "\\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_", "home_", "(_", "request_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "_", "return_", "direct", "\\u", "to", "\\u", "template_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "request_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "template_", "=_", "'", "expe", "die", "nt", "/", "clear", "ing", "house", "/", "message", "center", "/", "index", ".", "html", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "extra", "\\u", "context_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "message", "s", "\"_", ":_", "\"\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "breadcrumb", "s", "\"_", ":_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "\"", "Home", "\"_", ",_", "reverse_", "(_", "\"", "home", "\"_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "\"", "Las", "t", " ", "message", "s", " ", "of", " ", "%", "s", "\"_", "%_", "request_", "._", "user_", "._", "username_", ",_", "\"\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNL\\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, 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 ]
Unused import
coleifer/walrus/docs/conf.py
[ { "content": "# -*- coding: utf-8 -*-\n#\n# walrus documentation build configuration file, created by\n# sphinx-quickstart on Sun Jan 4 00:39:19 2015.\n#\n# This file is execfile()d with the current directory set to its containing dir.\n#\n# Note that not all possible configuration values are present in this\n# autogenerated file.\n#\n# All configuration values have a default; values that are commented out\n# serve to show the default.\n\nimport sys, os\n\n# If extensions (or modules to document with autodoc) are in another directory,\n# add these directories to sys.path here. If the directory is relative to the\n# documentation root, use os.path.abspath to make it absolute, like shown here.\nsrc_dir = os.path.realpath(os.path.dirname(os.path.dirname(__file__)))\nsys.path.insert(0, src_dir)\n\n# -- General configuration -----------------------------------------------------\n\n# If your documentation needs a minimal Sphinx version, state it here.\n#needs_sphinx = '1.0'\n\n# Add any Sphinx extension module names here, as strings. They can be extensions\n# coming with Sphinx (named 'sphinx.ext.*') or your custom ones.\nextensions = ['sphinx.ext.autodoc']\n\n# Add any paths that contain templates here, relative to this directory.\ntemplates_path = ['_templates']\n\n# The suffix of source filenames.\nsource_suffix = '.rst'\n\n# The encoding of source files.\n#source_encoding = 'utf-8-sig'\n\n# The master toctree document.\nmaster_doc = 'index'\n\n# General information about the project.\nproject = u'walrus'\ncopyright = u'2015, Charles Leifer'\n\n# The version info for the project you're documenting, acts as replacement for\n# |version| and |release|, also used in various other places throughout the\n# built documents.\n#\nfrom walrus import __version__\nversion = __version__\n# The full version, including alpha/beta/rc tags.\nrelease = __version__\n\n# The language for content autogenerated by Sphinx. Refer to documentation\n# for a list of supported languages.\n#language = None\n\n# There are two options for replacing |today|: either, you set today to some\n# non-false value, then it is used:\n#today = ''\n# Else, today_fmt is used as the format for a strftime call.\n#today_fmt = '%B %d, %Y'\n\n# List of patterns, relative to source directory, that match files and\n# directories to ignore when looking for source files.\nexclude_patterns = ['_build']\n\n# The reST default role (used for this markup: `text`) to use for all documents.\n#default_role = None\n\n# If true, '()' will be appended to :func: etc. cross-reference text.\n#add_function_parentheses = True\n\n# If true, the current module name will be prepended to all description\n# unit titles (such as .. function::).\n#add_module_names = True\n\n# If true, sectionauthor and moduleauthor directives will be shown in the\n# output. They are ignored by default.\n#show_authors = False\n\n# The name of the Pygments (syntax highlighting) style to use.\npygments_style = 'sphinx'\n\n# A list of ignored prefixes for module index sorting.\n#modindex_common_prefix = []\n\n# If true, keep warnings as \"system message\" paragraphs in the built documents.\n#keep_warnings = False\n\n\n# -- Options for HTML output ---------------------------------------------------\n\n# The theme to use for HTML and HTML Help pages. See the documentation for\n# a list of builtin themes.\nhtml_theme = 'default'\n\n# Theme options are theme-specific and customize the look and feel of a theme\n# further. For a list of options available for each theme, see the\n# documentation.\n#html_theme_options = {}\n\n# Add any paths that contain custom themes here, relative to this directory.\n#html_theme_path = []\n\n# The name for this set of Sphinx documents. If None, it defaults to\n# \"<project> v<release> documentation\".\n#html_title = None\n\n# A shorter title for the navigation bar. Default is the same as html_title.\n#html_short_title = None\n\n# The name of an image file (relative to this directory) to place at the top\n# of the sidebar.\n#html_logo = None\n\n# The name of an image file (within the static path) to use as favicon of the\n# docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32\n# pixels large.\n#html_favicon = None\n\n# Add any paths that contain custom static files (such as style sheets) here,\n# relative to this directory. They are copied after the builtin static files,\n# so a file named \"default.css\" will overwrite the builtin \"default.css\".\nhtml_static_path = ['_static']\n\n# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,\n# using the given strftime format.\n#html_last_updated_fmt = '%b %d, %Y'\n\n# If true, SmartyPants will be used to convert quotes and dashes to\n# typographically correct entities.\n#html_use_smartypants = True\n\n# Custom sidebar templates, maps document names to template names.\n#html_sidebars = {}\n\n# Additional templates that should be rendered to pages, maps page names to\n# template names.\n#html_additional_pages = {}\n\n# If false, no module index is generated.\n#html_domain_indices = True\n\n# If false, no index is generated.\n#html_use_index = True\n\n# If true, the index is split into individual pages for each letter.\n#html_split_index = False\n\n# If true, links to the reST sources are added to the pages.\n#html_show_sourcelink = True\n\n# If true, \"Created using Sphinx\" is shown in the HTML footer. Default is True.\n#html_show_sphinx = True\n\n# If true, \"(C) Copyright ...\" is shown in the HTML footer. Default is True.\n#html_show_copyright = True\n\n# If true, an OpenSearch description file will be output, and all pages will\n# contain a <link> tag referring to it. The value of this option must be the\n# base URL from which the finished HTML is served.\n#html_use_opensearch = ''\n\n# This is the file name suffix for HTML files (e.g. \".xhtml\").\n#html_file_suffix = None\n\n# Output file base name for HTML help builder.\nhtmlhelp_basename = 'walrusdoc'\n\n\n# -- Options for LaTeX output --------------------------------------------------\n\nlatex_elements = {\n# The paper size ('letterpaper' or 'a4paper').\n#'papersize': 'letterpaper',\n\n# The font size ('10pt', '11pt' or '12pt').\n#'pointsize': '10pt',\n\n# Additional stuff for the LaTeX preamble.\n#'preamble': '',\n}\n\n# Grouping the document tree into LaTeX files. List of tuples\n# (source start file, target name, title, author, documentclass [howto/manual]).\nlatex_documents = [\n ('index', 'walrus.tex', u'walrus Documentation',\n u'Charles Leifer', 'manual'),\n]\n\n# The name of an image file (relative to this directory) to place at the top of\n# the title page.\n#latex_logo = None\n\n# For \"manual\" documents, if this is true, then toplevel headings are parts,\n# not chapters.\n#latex_use_parts = False\n\n# If true, show page references after internal links.\n#latex_show_pagerefs = False\n\n# If true, show URL addresses after external links.\n#latex_show_urls = False\n\n# Documents to append as an appendix to all manuals.\n#latex_appendices = []\n\n# If false, no module index is generated.\n#latex_domain_indices = True\n\n\n# -- Options for manual page output --------------------------------------------\n\n# One entry per manual page. List of tuples\n# (source start file, name, description, authors, manual section).\nman_pages = [\n ('index', 'walrus', u'walrus Documentation',\n [u'Charles Leifer'], 1)\n]\n\n# If true, show URL addresses after external links.\n#man_show_urls = False\n\n\n# -- Options for Texinfo output ------------------------------------------------\n\n# Grouping the document tree into Texinfo files. List of tuples\n# (source start file, target name, title, author,\n# dir menu entry, description, category)\ntexinfo_documents = [\n ('index', 'walrus', u'walrus Documentation',\n u'Charles Leifer', 'walrus', 'One line description of project.',\n 'Miscellaneous'),\n]\n\n# Documents to append as an appendix to all manuals.\n#texinfo_appendices = []\n\n# If false, no module index is generated.\n#texinfo_domain_indices = True\n\n# How to display URL addresses: 'footnote', 'no', or 'inline'.\n#texinfo_show_urls = 'footnote'\n\n# If true, do not generate a @detailmenu in the \"Top\" node's menu.\n#texinfo_no_detailmenu = False\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[]
[]
0
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "-*-", " ", "codi", "ng", ":", " ", "utf", "-", "8", " ", "-*-", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "wal", "rus", " ", "documentation", " ", "build", " ", "configura", "tion", " ", "file", ",", " ", "created", " ", "by_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "sphinx", "-", "quicks", "tart", " ", "on", " ", "Sun", " ", "Jan", " ", " ", "4", " ", "00", ":", "3", "9", ":", "1", "9", " ", "201", "5._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Thi", "s", " ", "file", " ", "is", " ", "execfile", "()", "d", " ", "with", " ", "the", " ", "current", " ", "director", "y", " ", "set", " ", "to", " ", "its", " ", "contain", "ing", " ", "dir", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Not", "e", " ", "tha", "t", " ", "not", " ", "all", " ", "possib", "le", " ", "configura", "tion", " ", "values", " ", "are", " ", "presen", "t", " ", "in", " ", "this_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "autogen", "erate", "d", " ", "file", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "All", " ", "configura", "tion", " ", "values", " ", "have", " ", "a", " ", "default", ";", " ", "values", " ", "tha", "t", " ", "are", " ", "commente", "d", " ", "out_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "serve", " ", "to", " ", "show", " ", "the", " ", "default", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "sys_", ",_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "extensi", "ons", " ", "(", "or", " ", "module", "s", " ", "to", " ", "document", " ", "with", " ", "autod", "oc", ")", " ", "are", " ", "in", " ", "anot", "her", " ", "director", "y", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "add", " ", "these", " ", "director", "ies", " ", "to", " ", "sys", ".", "path", " ", "here", ".", " ", "If", " ", "the", " ", "director", "y", " ", "is", " ", "relative", " ", "to", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "documentation", " ", "root", ",", " ", "use", " ", "os", ".", "path", ".", "abs", "path", " ", "to", " ", "make", " ", "it", " ", "abs", "olute", ",", " ", "like", " ", "shown", " ", "here", "._", "\\u\\u\\uNL\\u\\u\\u_", "src", "\\u", "dir_", "=_", "os_", "._", "path_", "._", "realpath_", "(_", "os_", "._", "path_", "._", "dirname_", "(_", "os_", "._", "path_", "._", "dirname_", "(_", "\\u\\u", "file\\u\\u_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "path_", "._", "insert_", "(_", "0_", ",_", "src", "\\u", "dir_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "--", " ", "General", " ", "configura", "tion", " ", "--------------", "--------------", "--------------", "-----------", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "your", " ", "documentation", " ", "need", "s", " ", "a", " ", "minima", "l", " ", "Sph", "inx", " ", "version", ",", " ", "state", " ", "it", " ", "here", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "need", "s", "\\u", "sphinx", " ", "=", " ", "'", "1.0", "'_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Add", " ", "any", " ", "Sph", "inx", " ", "extensi", "on", " ", "module", " ", "names", " ", "here", ",", " ", "as", " ", "string", "s", ".", " ", "The", "y", " ", "can", " ", "be", " ", "extensions_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "comi", "ng", " ", "with", " ", "Sph", "inx", " ", "(", "named", " ", "'", "sphinx", ".", "ext", ".*", "')", " ", "or", " ", "your", " ", "custom", " ", "ones", "._", "\\u\\u\\uNL\\u\\u\\u_", "extensions_", "=_", "[_", "'", "sphinx", ".", "ext", ".", "autod", "oc", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Add", " ", "any", " ", "path", "s", " ", "tha", "t", " ", "contain", " ", "template", "s", " ", "here", ",", " ", "relative", " ", "to", " ", "this", " ", "director", "y", "._", "\\u\\u\\uNL\\u\\u\\u_", "template", "s", "\\u", "path_", "=_", "[_", "'\\u", "template", "s", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "suff", "ix", " ", "of", " ", "source", " ", "filename", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "source", "\\u", "suffix_", "=_", "'.", "rst", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "encoding", " ", "of", " ", "source", " ", "files", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "source", "\\u", "encoding", " ", "=", " ", "'", "utf", "-", "8", "-", "sig", "'_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "master", " ", "toc", "tree", " ", "document", "._", "\\u\\u\\uNL\\u\\u\\u_", "master", "\\u", "doc_", "=_", "'", "index", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "General", " ", "informati", "on", " ", "abo", "ut", " ", "the", " ", "project", "._", "\\u\\u\\uNL\\u\\u\\u_", "project_", "=_", "u", "'", "wal", "rus", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "copyright_", "=_", "u", "'", "201", "5", ",", " ", "Charl", "es", " ", "Lei", "fer", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "version", " ", "info", " ", "for", " ", "the", " ", "project", " ", "you", "'", "re", " ", "document", "ing", ",", " ", "acts", " ", "as", " ", "replace", "ment", " ", "for_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "|", "version", "|", " ", "and", " ", "|", "release", "|", ",", " ", "als", "o", " ", "used", " ", "in", " ", "vari", "ous", " ", "other", " ", "place", "s", " ", "through", "out", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "bui", "lt", " ", "document", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "wal", "rus", "_", "import_", "\\u\\u", "version\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "version_", "=_", "\\u\\u", "version\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "The", " ", "full", " ", "version", ",", " ", "inclu", "ding", " ", "alpha", "/", "beta", "/", "rc", " ", "tags", "._", "\\u\\u\\uNL\\u\\u\\u_", "release_", "=_", "\\u\\u", "version\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "language", " ", "for", " ", "content", " ", "autogen", "erate", "d", " ", "by", " ", "Sph", "inx", ".", " ", "Refer", " ", "to", " ", "documentation", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "for", " ", "a", " ", "list", " ", "of", " ", "support", "ed", " ", "language", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "language", " ", "=", " ", "None_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "There", " ", "are", " ", "two", " ", "options", " ", "for", " ", "repla", "cing", " ", "|", "toda", "y", "|", ":", " ", "eit", "her", ",", " ", "you", " ", "set", " ", "toda", "y", " ", "to", " ", "some", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "non", "-", "fal", "se", " ", "value", ",", " ", "then", " ", "it", " ", "is", " ", "used", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", "toda", "y", " ", "=", " ", "''_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Else", ",", " ", "toda", "y", "\\u", "fmt", " ", "is", " ", "used", " ", "as", " ", "the", " ", "format", " ", "for", " ", "a", " ", "strf", "time", " ", "call", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "toda", "y", "\\u", "fmt", " ", "=", " ", "'%", "B", " ", "%", "d", ",", " ", "%", "Y", "'_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "List", " ", "of", " ", "pattern", "s", ",", " ", "relative", " ", "to", " ", "source", " ", "director", "y", ",", " ", "tha", "t", " ", "match", " ", "files", " ", "and_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "director", "ies", " ", "to", " ", "ignore", " ", "whe", "n", " ", "look", "ing", " ", "for", " ", "source", " ", "files", "._", "\\u\\u\\uNL\\u\\u\\u_", "exclu", "de", "\\u", "patterns_", "=_", "[_", "'\\u", "build", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "re", "ST", " ", "default", " ", "role", " ", "(", "used", " ", "for", " ", "this", " ", "markup", ":", " ", "`", "text", "`)", " ", "to", " ", "use", " ", "for", " ", "all", " ", "document", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "default", "\\u", "role", " ", "=", " ", "None_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "true", ",", " ", "'(", ")'", " ", "will", " ", "be", " ", "append", "ed", " ", "to", " ", ":", "func", ":", " ", "etc", ".", " ", "cross", "-", "reference", " ", "text", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "add", "\\u", "function", "\\u", "parenthes", "es", " ", "=", " ", "True_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "true", ",", " ", "the", " ", "current", " ", "module", " ", "name", " ", "will", " ", "be", " ", "prepend", "ed", " ", "to", " ", "all", " ", "description_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "unit", " ", "titles", " ", "(", "suc", "h", " ", "as", " ", "..", " ", "function", "::", ").", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "add", "\\u", "module", "\\u", "names", " ", "=", " ", "True_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "true", ",", " ", "section", "author", " ", "and", " ", "module", "author", " ", "directive", "s", " ", "will", " ", "be", " ", "shown", " ", "in", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "output", ".", " ", "The", "y", " ", "are", " ", "ignore", "d", " ", "by", " ", "default", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "show", "\\u", "author", "s", " ", "=", " ", "False_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "name", " ", "of", " ", "the", " ", "Pyg", "ment", "s", " ", "(", "synta", "x", " ", "highlight", "ing", ")", " ", "style", " ", "to", " ", "use", "._", "\\u\\u\\uNL\\u\\u\\u_", "pyg", "ment", "s", "\\u", "style_", "=_", "'", "sphinx", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "A", " ", "list", " ", "of", " ", "ignore", "d", " ", "prefix", "es", " ", "for", " ", "module", " ", "index", " ", "sorting", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "modi", "nde", "x", "\\u", "common", "\\u", "prefix", " ", "=", " ", "[]", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "true", ",", " ", "keep", " ", "warn", "ings", " ", "as", " ", "\"", "system", " ", "message", "\"", " ", "paragraph", "s", " ", "in", " ", "the", " ", "bui", "lt", " ", "document", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "keep", "\\u", "warn", "ings", " ", "=", " ", "False_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "--", " ", "Optio", "ns", " ", "for", " ", "HTM", "L", " ", "output", " ", "--------------", "--------------", "--------------", "---------", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "them", "e", " ", "to", " ", "use", " ", "for", " ", "HTM", "L", " ", "and", " ", "HTM", "L", " ", "Help", " ", "page", "s", ".", " ", " ", "See", " ", "the", " ", "documentation", " ", "for_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "a", " ", "list", " ", "of", " ", "bui", "lti", "n", " ", "themes", "._", "\\u\\u\\uNL\\u\\u\\u_", "html", "\\u", "theme_", "=_", "'", "default", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Them", "e", " ", "options", " ", "are", " ", "them", "e-", "specific", " ", "and", " ", "customize", " ", "the", " ", "look", " ", "and", " ", "feel", " ", "of", " ", "a", " ", "theme_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "fur", "ther", ".", " ", " ", "For", " ", "a", " ", "list", " ", "of", " ", "options", " ", "avail", "able", " ", "for", " ", "each", " ", "them", "e", ",", " ", "see", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "documentation", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "html", "\\u", "them", "e\\u", "options", " ", "=", " ", "{}", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Add", " ", "any", " ", "path", "s", " ", "tha", "t", " ", "contain", " ", "custom", " ", "themes", " ", "here", ",", " ", "relative", " ", "to", " ", "this", " ", "director", "y", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "html", "\\u", "them", "e\\u", "path", " ", "=", " ", "[]", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "name", " ", "for", " ", "this", " ", "set", " ", "of", " ", "Sph", "inx", " ", "document", "s", ".", " ", " ", "If", " ", "Non", "e", ",", " ", "it", " ", "default", "s", " ", "to_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "\"<", "project", ">", " ", "v", "<", "release", ">", " ", "documentation", "\".", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "html", "\\u", "title", " ", "=", " ", "None_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "A", " ", "shorter", " ", "title", " ", "for", " ", "the", " ", "navigation", " ", "bar", ".", " ", " ", "Default", " ", "is", " ", "the", " ", "same", " ", "as", " ", "html", "\\u", "title", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "html", "\\u", "short", "\\u", "title", " ", "=", " ", "None_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "name", " ", "of", " ", "an", " ", "image", " ", "file", " ", "(", "relative", " ", "to", " ", "this", " ", "director", "y", ")", " ", "to", " ", "place", " ", "at", " ", "the", " ", "top_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "of", " ", "the", " ", "sidebar", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "html", "\\u", "logo", " ", "=", " ", "None_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "name", " ", "of", " ", "an", " ", "image", " ", "file", " ", "(", "within", " ", "the", " ", "static", " ", "path", ")", " ", "to", " ", "use", " ", "as", " ", "fav", "icon", " ", "of", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "docs", ".", " ", " ", "Thi", "s", " ", "file", " ", "shou", "ld", " ", "be", " ", "a", " ", "Window", "s", " ", "icon", " ", "file", " ", "(.", "ico", ")", " ", "bei", "ng", " ", "16", "x1", "6", " ", "or", " ", "32", "x3", "2_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "pixel", "s", " ", "large", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "html", "\\u", "fav", "icon", " ", "=", " ", "None_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Add", " ", "any", " ", "path", "s", " ", "tha", "t", " ", "contain", " ", "custom", " ", "static", " ", "files", " ", "(", "suc", "h", " ", "as", " ", "style", " ", "sheet", "s", ")", " ", "here", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "relative", " ", "to", " ", "this", " ", "director", "y", ".", " ", "The", "y", " ", "are", " ", "copie", "d", " ", "after", " ", "the", " ", "bui", "lti", "n", " ", "static", " ", "files", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "so", " ", "a", " ", "file", " ", "named", " ", "\"", "default", ".", "css", "\"", " ", "will", " ", "overwrit", "e", " ", "the", " ", "bui", "lti", "n", " ", "\"", "default", ".", "css", "\".", "_", "\\u\\u\\uNL\\u\\u\\u_", "html", "\\u", "static", "\\u", "path_", "=_", "[_", "'\\u", "static", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "not", " ", "''", ",", " ", "a", " ", "'", "Las", "t", " ", "update", "d", " ", "on", ":'", " ", "timestamp", " ", "is", " ", "inserted", " ", "at", " ", "every", " ", "page", " ", "bottom", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "usi", "ng", " ", "the", " ", "give", "n", " ", "strf", "time", " ", "format", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "html", "\\u", "last", "\\u", "update", "d\\u", "fmt", " ", "=", " ", "'%", "b", " ", "%", "d", ",", " ", "%", "Y", "'_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "true", ",", " ", "Sma", "rty", "Pant", "s", " ", "will", " ", "be", " ", "used", " ", "to", " ", "convert", " ", "quote", "s", " ", "and", " ", "dashes", " ", "to_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "typo", "graphical", "ly", " ", "correct", " ", "entit", "ies", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "html", "\\u", "use", "\\u", "smart", "ypa", "nts", " ", "=", " ", "True_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Custom", " ", "sidebar", " ", "template", "s", ",", " ", "maps", " ", "document", " ", "names", " ", "to", " ", "template", " ", "names", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "html", "\\u", "sidebar", "s", " ", "=", " ", "{}", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Addition", "al", " ", "template", "s", " ", "tha", "t", " ", "shou", "ld", " ", "be", " ", "render", "ed", " ", "to", " ", "page", "s", ",", " ", "maps", " ", "page", " ", "names", " ", "to_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "template", " ", "names", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "html", "\\u", "addition", "al", "\\u", "page", "s", " ", "=", " ", "{}", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "fal", "se", ",", " ", "no", " ", "module", " ", "index", " ", "is", " ", "generat", "ed", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "html", "\\u", "domain", "\\u", "indice", "s", " ", "=", " ", "True_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "fal", "se", ",", " ", "no", " ", "index", " ", "is", " ", "generat", "ed", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "html", "\\u", "use", "\\u", "index", " ", "=", " ", "True_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "true", ",", " ", "the", " ", "index", " ", "is", " ", "split", " ", "int", "o", " ", "individual", " ", "page", "s", " ", "for", " ", "each", " ", "letter", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "html", "\\u", "split", "\\u", "index", " ", "=", " ", "False_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "true", ",", " ", "link", "s", " ", "to", " ", "the", " ", "re", "ST", " ", "source", "s", " ", "are", " ", "adde", "d", " ", "to", " ", "the", " ", "page", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "html", "\\u", "show", "\\u", "source", "link", " ", "=", " ", "True_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "true", ",", " ", "\"", "Creat", "ed", " ", "usi", "ng", " ", "Sph", "inx", "\"", " ", "is", " ", "shown", " ", "in", " ", "the", " ", "HTM", "L", " ", "footer", ".", " ", "Default", " ", "is", " ", "Tru", "e", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "html", "\\u", "show", "\\u", "sphinx", " ", "=", " ", "True_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "true", ",", " ", "\"(", "C", ")", " ", "Copy", "right", " ", "...\"", " ", "is", " ", "shown", " ", "in", " ", "the", " ", "HTM", "L", " ", "footer", ".", " ", "Default", " ", "is", " ", "Tru", "e", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "html", "\\u", "show", "\\u", "copyr", "ight", " ", "=", " ", "True_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "true", ",", " ", "an", " ", "Open", "Sear", "ch", " ", "description", " ", "file", " ", "will", " ", "be", " ", "output", ",", " ", "and", " ", "all", " ", "page", "s", " ", "will", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "contain", " ", "a", " ", "<", "link", ">", " ", "tag", " ", "refer", "ring", " ", "to", " ", "it", ".", " ", " ", "The", " ", "value", " ", "of", " ", "this", " ", "option", " ", "must", " ", "be", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "base", " ", "URL", " ", "from", " ", "whi", "ch", " ", "the", " ", "finish", "ed", " ", "HTM", "L", " ", "is", " ", "serve", "d", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "html", "\\u", "use", "\\u", "opens", "ear", "ch", " ", "=", " ", "''_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Thi", "s", " ", "is", " ", "the", " ", "file", " ", "name", " ", "suff", "ix", " ", "for", " ", "HTM", "L", " ", "files", " ", "(", "e", ".", "g", ".", " ", "\".", "xh", "tml", "\")", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "html", "\\u", "file", "\\u", "suff", "ix", " ", "=", " ", "None_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Output", " ", "file", " ", "base", " ", "name", " ", "for", " ", "HTM", "L", " ", "help", " ", "builde", "r", "._", "\\u\\u\\uNL\\u\\u\\u_", "html", "help", "\\u", "basename_", "=_", "'", "wal", "rus", "doc", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "--", " ", "Optio", "ns", " ", "for", " ", "La", "Te", "X", " ", "output", " ", "--------------", "--------------", "--------------", "--------", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "late", "x", "\\u", "elements_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "pape", "r", " ", "size", " ", "('", "letter", "pape", "r", "'", " ", "or", " ", "'", "a4", "pape", "r", "')", "._", "\\u\\u\\uNL\\u\\u\\u_", "#'", "papers", "ize", "':", " ", "'", "letter", "pape", "r", "',", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "font", " ", "size", " ", "('", "10", "pt", "',", " ", "'", "11", "pt", "'", " ", "or", " ", "'", "1", "2p", "t", "')", "._", "\\u\\u\\uNL\\u\\u\\u_", "#'", "points", "ize", "':", " ", "'", "10", "pt", "',", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Addition", "al", " ", "stu", "ff", " ", "for", " ", "the", " ", "La", "Te", "X", " ", "preamble", "._", "\\u\\u\\uNL\\u\\u\\u_", "#'", "preamble", "':", " ", "''", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Group", "ing", " ", "the", " ", "document", " ", "tree", " ", "int", "o", " ", "La", "Te", "X", " ", "files", ".", " ", "List", " ", "of", " ", "tuples_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "(", "source", " ", "start", " ", "file", ",", " ", "target", " ", "name", ",", " ", "title", ",", " ", "author", ",", " ", "document", "class", " ", "[", "how", "to", "/", "manu", "al", "])", "._", "\\u\\u\\uNL\\u\\u\\u_", "late", "x", "\\u", "documents_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "index", "'_", ",_", "'", "wal", "rus", ".", "tex", "'_", ",_", "u", "'", "wal", "rus", " ", "Document", "ation", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "Charl", "es", " ", "Lei", "fer", "'_", ",_", "'", "manu", "al", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "name", " ", "of", " ", "an", " ", "image", " ", "file", " ", "(", "relative", " ", "to", " ", "this", " ", "director", "y", ")", " ", "to", " ", "place", " ", "at", " ", "the", " ", "top", " ", "of_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "the", " ", "title", " ", "page", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "late", "x", "\\u", "logo", " ", "=", " ", "None_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "For", " ", "\"", "manu", "al", "\"", " ", "document", "s", ",", " ", "if", " ", "this", " ", "is", " ", "true", ",", " ", "then", " ", "toplevel", " ", "heading", "s", " ", "are", " ", "part", "s", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "not", " ", "chapters", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "late", "x", "\\u", "use", "\\u", "part", "s", " ", "=", " ", "False_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "true", ",", " ", "show", " ", "page", " ", "reference", "s", " ", "after", " ", "internal", " ", "link", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "late", "x", "\\u", "show", "\\u", "pager", "ef", "s", " ", "=", " ", "False_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "true", ",", " ", "show", " ", "URL", " ", "addresse", "s", " ", "after", " ", "external", " ", "link", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "late", "x", "\\u", "show", "\\u", "urls", " ", "=", " ", "False_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Document", "s", " ", "to", " ", "append", " ", "as", " ", "an", " ", "appendi", "x", " ", "to", " ", "all", " ", "manu", "als", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "late", "x", "\\u", "appendi", "ces", " ", "=", " ", "[]", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "fal", "se", ",", " ", "no", " ", "module", " ", "index", " ", "is", " ", "generat", "ed", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "late", "x", "\\u", "domain", "\\u", "indice", "s", " ", "=", " ", "True_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "--", " ", "Optio", "ns", " ", "for", " ", "manu", "al", " ", "page", " ", "output", " ", "--------------", "--------------", "--------------", "--", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "One", " ", "entry", " ", "per", " ", "manu", "al", " ", "page", ".", " ", "List", " ", "of", " ", "tuples_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "(", "source", " ", "start", " ", "file", ",", " ", "name", ",", " ", "description", ",", " ", "author", "s", ",", " ", "manu", "al", " ", "section", ").", "_", "\\u\\u\\uNL\\u\\u\\u_", "man", "\\u", "pages_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "index", "'_", ",_", "'", "wal", "rus", "'_", ",_", "u", "'", "wal", "rus", " ", "Document", "ation", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "u", "'", "Charl", "es", " ", "Lei", "fer", "'_", "]_", ",_", "1_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "true", ",", " ", "show", " ", "URL", " ", "addresse", "s", " ", "after", " ", "external", " ", "link", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "man", "\\u", "show", "\\u", "urls", " ", "=", " ", "False_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "--", " ", "Optio", "ns", " ", "for", " ", "Tex", "info", " ", "output", " ", "--------------", "--------------", "--------------", "------", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Group", "ing", " ", "the", " ", "document", " ", "tree", " ", "int", "o", " ", "Tex", "info", " ", "files", ".", " ", "List", " ", "of", " ", "tuples_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "(", "source", " ", "start", " ", "file", ",", " ", "target", " ", "name", ",", " ", "title", ",", " ", "author", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "dir", " ", "menu", " ", "entry", ",", " ", "description", ",", " ", "category", ")_", "\\u\\u\\uNL\\u\\u\\u_", "tex", "info", "\\u", "documents_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "index", "'_", ",_", "'", "wal", "rus", "'_", ",_", "u", "'", "wal", "rus", " ", "Document", "ation", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "Charl", "es", " ", "Lei", "fer", "'_", ",_", "'", "wal", "rus", "'_", ",_", "'", "One", " ", "line", " ", "description", " ", "of", " ", "project", ".'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Mis", "cell", "ane", "ous", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Document", "s", " ", "to", " ", "append", " ", "as", " ", "an", " ", "appendi", "x", " ", "to", " ", "all", " ", "manu", "als", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "tex", "info", "\\u", "appendi", "ces", " ", "=", " ", "[]", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "fal", "se", ",", " ", "no", " ", "module", " ", "index", " ", "is", " ", "generat", "ed", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "tex", "info", "\\u", "domain", "\\u", "indice", "s", " ", "=", " ", "True_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Ho", "w", " ", "to", " ", "display", " ", "URL", " ", "addresse", "s", ":", " ", "'", "footnote", "',", " ", "'", "no", "',", " ", "or", " ", "'", "inline", "'.", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "tex", "info", "\\u", "show", "\\u", "urls", " ", "=", " ", "'", "footnote", "'_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "true", ",", " ", "do", " ", "not", " ", "generat", "e", " ", "a", " ", "@", "deta", "il", "menu", " ", "in", " ", "the", " ", "\"", "Top", "\"", " ", "node", "'", "s", " ", "menu", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "tex", "info", "\\u", "no", "\\u", "deta", "il", "menu", " ", "=", " ", "False_", "\\u\\u\\uNL\\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,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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 ]
Module is imported with 'import' and 'import from'
openstack/neutron/neutron/api/rpc/callbacks/version_manager.py
[ { "content": "# Licensed under the Apache License, Version 2.0 (the \"License\"); you may\n# not use this file except in compliance with the License. You may obtain\n# 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, WITHOUT\n# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the\n# License for the specific language governing permissions and limitations\n# under the License.\n\nimport collections\nimport copy\nimport pprint\nimport time\n\nfrom neutron_lib import constants\nfrom oslo_log import log as logging\nfrom oslo_utils import importutils\n\nfrom neutron.api.rpc.callbacks import exceptions\n\nLOG = logging.getLogger(__name__)\n\nVERSIONS_TTL = 60\n\n# This is the list of agents that started using this rpc push/pull mechanism\n# for versioned objects, but at that time stable/liberty, they were not\n# reporting versions, so we need to assume they need QosPolicy 1.0\n#TODO(mangelajo): Remove this logic in Newton, since those agents will be\n# already reporting From N to O\nNON_REPORTING_AGENT_TYPES = [constants.AGENT_TYPE_OVS,\n constants.AGENT_TYPE_NIC_SWITCH]\n\n\n# NOTE(mangelajo): if we import this globally we end up with a (very\n# long) circular dependency, this can be fixed if we\n# stop importing all exposed classes in\n# neutron.api.rpc.callbacks.resources and provide\n# a decorator to expose classes\n\n\nAgentConsumer = collections.namedtuple('AgentConsumer', ['agent_type',\n 'host'])\nAgentConsumer.__repr__ = lambda self: '%s@%s' % self\n\n\n\n\n\n_cached_version_tracker = None\n\n\n#NOTE(ajo): add locking if we ever stop using greenthreads\n\n\n\n\n\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[]
[]
0
true
[ "[CLS]_", "Module_", "is_", "imported_", "with_", "'", "import", "'_", "and_", "'", "import", " ", "from", "'_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", " ", " ", " ", "License", "d", " ", "under", " ", "the", " ", "Ap", "ache", " ", "License", ",", " ", "Version", " ", "2.0", " ", "(", "the", " ", "\"", "License", "\");", " ", "you", " ", "may", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "not", " ", "use", " ", "this", " ", "file", " ", "except", " ", "in", " ", "compli", "anc", "e", " ", "with", " ", "the", " ", "License", ".", " ", "You", " ", "may", " ", "obtain", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "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", ",", " ", "WITH", "OUT_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "WAR", "RAN", "TIES", " ", "OR", " ", "CONDITION", "S", " ", "OF", " ", "ANY", " ", "KIND", ",", " ", "eit", "her", " ", "express", " ", "or", " ", "impli", "ed", ".", " ", "See", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "License", " ", "for", " ", "the", " ", "specific", " ", "language", " ", "govern", "ing", " ", "permissi", "ons", " ", "and", " ", "limit", "ations_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "under", " ", "the", " ", "License", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "collections_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "copy_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "pprint_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "time_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "neut", "ron", "\\u", "lib_", "import_", "constants_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "oslo", "\\u", "log_", "import_", "log_", "as_", "logging_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "oslo", "\\u", "utils_", "import_", "import", "utils_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "neutron_", "._", "api_", "._", "rpc_", "._", "callbacks_", "import_", "exceptions_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "LOG_", "=_", "logging_", "._", "get", "Logger_", "(_", "\\u\\u", "name\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "VERSIONS", "\\u", "TTL", "_", "=_", "60_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Thi", "s", " ", "is", " ", "the", " ", "list", " ", "of", " ", "agent", "s", " ", "tha", "t", " ", "start", "ed", " ", "usi", "ng", " ", "this", " ", "rpc", " ", "push", "/", "pull", " ", "mechanism", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "for", " ", "versioned", " ", "object", "s", ",", " ", "but", " ", "at", " ", "tha", "t", " ", "time", " ", "stable", "/", "liber", "ty", ",", " ", "the", "y", " ", "wer", "e", " ", "not_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "reporting", " ", "version", "s", ",", " ", "so", " ", "we", " ", "need", " ", "to", " ", "assume", " ", "the", "y", " ", "need", " ", "Qo", "s", "Polic", "y", " ", "1.0_", "\\u\\u\\uNL\\u\\u\\u_", "#", "TOD", "O", "(", "mang", "ela", "jo", "):", " ", "Remove", " ", "this", " ", "logic", " ", "in", " ", "New", "ton", ",", " ", "sinc", "e", " ", "tho", "se", " ", "agent", "s", " ", "will", " ", "be_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "alr", "ead", "y", " ", "reporting", " ", "Fro", "m", " ", "N", " ", "to", " ", "O_", "\\u\\u\\uNL\\u\\u\\u_", "NON", "\\u", "REPORT", "ING", "\\u", "AGE", "NT", "\\u", "TYPES_", "=_", "[_", "constants_", "._", "AGE", "NT", "\\u", "TYPE", "\\u", "OVS", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "constants_", "._", "AGE", "NT", "\\u", "TYPE", "\\u", "NIC", "\\u", "SWITCH", "_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "NOTE", "(", "mang", "ela", "jo", "):", " ", "if", " ", "we", " ", "import", " ", "this", " ", "global", "ly", " ", "we", " ", "end", " ", "up", " ", "with", " ", "a", " ", "(", "very", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", " ", "long", ")", " ", "circular", " ", "dependen", "cy", ",", " ", "this", " ", "can", " ", "be", " ", "fixed", " ", "if", " ", "we", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", " ", "stop", " ", "import", "ing", " ", "all", " ", "exposed", " ", "classe", "s", " ", "in_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", " ", "neut", "ron", ".", "api", ".", "rpc", ".", "callback", "s", ".", "resource", "s", " ", "and", " ", "provide", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", " ", "a", " ", "decorat", "or", " ", "to", " ", "expos", "e", " ", "classes_", "\\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_", "Agent", "Consumer_", "=_", "collections_", "._", "namedtuple_", "(_", "'", "Agent", "Consume", "r", "'_", ",_", "[_", "'", "agent", "\\u", "type", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "host", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Agent", "Consumer_", "._", "\\u\\u", "repr\\u\\u_", "=_", "lambda_", "self_", ":_", "'%", "s", "@", "%", "s", "'_", "%_", "self_", "\\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\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u", "cache", "d\\u", "version", "\\u", "tracker_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "NOTE", "(", "ajo", "):", " ", "add", " ", "locking", " ", "if", " ", "we", " ", "ever", " ", "stop", " ", "usi", "ng", " ", "green", "threads_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\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 ]
Comparison of identical values
zzzeek/sqlalchemy/lib/sqlalchemy/dialects/mysql/base.py
[ { "content": " @property\n def _supports_cast(self):\n return self.server_version_info is None or \\\n self.server_version_info >= (4, 0, 2)", "metadata": "root.MySQLDialect._supports_cast", "header": "['class', 'MySQLDialect', '(', 'default', '.', 'DefaultDialect', ')', ':', '___EOS___']", "index": 1637 } ]
[]
[]
0
true
[ "[CLS]_", "Compari", "son_", "of_", "identical_", "values_", "[SEP]_", "class_", "My", "SQL", "Dial", "ect_", "(_", "default_", "._", "Default", "Dial", "ect_", ")_", ":_", "\\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_", "\\u", "support", "s", "\\u", "cast_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "server", "\\u", "version", "\\u", "info_", "is_", "None_", "or_", "self_", "._", "server", "\\u", "version", "\\u", "info_", ">=_", "(_", "4_", ",_", "0_", ",_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 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 ]
Unused import
StackStorm/st2/st2actions/tests/unit/policies/test_concurrency_by_attr.py
[ { "content": "# Licensed to the StackStorm, Inc ('StackStorm') under one or more\n# contributor license agreements. See the NOTICE file distributed with\n# this work for additional information regarding copyright ownership.\n# The ASF licenses this file to You under the Apache License, Version 2.0\n# (the \"License\"); you may not use this file except in compliance with\n# the License. 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\nimport mock\n\nfrom st2common.constants import action as action_constants\nfrom st2common.models.db.action import LiveActionDB\nfrom st2common.persistence.action import LiveAction\nfrom st2common.persistence.policy import Policy\nfrom st2common.services import action as action_service\nfrom st2common.transport.liveaction import LiveActionPublisher\nfrom st2common.transport.publishers import CUDPublisher\nfrom st2tests import DbTestCase, EventletTestCase\nfrom st2tests.fixturesloader import FixturesLoader\nfrom tests.unit.base import MockLiveActionPublisher\nfrom st2tests.mocks.runner import MockActionRunner\n\nPACK = 'generic'\nTEST_FIXTURES = {\n 'runners': [\n 'testrunner1.yaml'\n ],\n 'actions': [\n 'action1.yaml'\n ],\n 'policytypes': [\n 'policy_type_2.yaml'\n ],\n 'policies': [\n 'policy_3.yaml'\n ]\n}\n\nNON_EMPTY_RESULT = 'non-empty'\n\nSCHEDULED_STATES = [\n action_constants.LIVEACTION_STATUS_SCHEDULED,\n action_constants.LIVEACTION_STATUS_RUNNING,\n action_constants.LIVEACTION_STATUS_SUCCEEDED\n]\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "@mock.patch.object(\n MockActionRunner, 'run',\n mock.MagicMock(\n return_value=(action_constants.LIVEACTION_STATUS_RUNNING, NON_EMPTY_RESULT, None)))\n@mock.patch.object(\n CUDPublisher, 'publish_update',\n mock.MagicMock(side_effect=MockLiveActionPublisher.publish_update))\n@mock.patch.object(\n CUDPublisher, 'publish_create',\n mock.MagicMock(return_value=None))\n@mock.patch.object(\n LiveActionPublisher, 'publish_state',\n mock.MagicMock(side_effect=MockLiveActionPublisher.publish_state))\nclass ConcurrencyByAttributePolicyTest(EventletTestCase, DbTestCase):\n\n\n\n", "metadata": "root.ConcurrencyByAttributePolicyTest", "header": "['module', '___EOS___']", "index": 54 }, { "content": " @classmethod\n def setUpClass(cls):\n EventletTestCase.setUpClass()\n DbTestCase.setUpClass()\n\n loader = FixturesLoader()\n loader.save_fixtures_to_db(fixtures_pack=PACK,\n fixtures_dict=TEST_FIXTURES)", "metadata": "root.ConcurrencyByAttributePolicyTest.setUpClass", "header": "['class', 'ConcurrencyByAttributePolicyTest', '(', 'EventletTestCase', ',', 'DbTestCase', ')', ':', '___EOS___']", "index": 69 }, { "content": " def tearDown(self):\n for liveaction in LiveAction.get_all():\n action_service.update_status(\n liveaction, action_constants.LIVEACTION_STATUS_CANCELED)", "metadata": "root.ConcurrencyByAttributePolicyTest.tearDown", "header": "['class', 'ConcurrencyByAttributePolicyTest', '(', 'EventletTestCase', ',', 'DbTestCase', ')', ':', '___EOS___']", "index": 78 }, { "content": " def test_over_threshold(self):\n policy_db = Policy.get_by_ref('wolfpack.action-1.concurrency.attr')\n self.assertGreater(policy_db.parameters['threshold'], 0)\n self.assertIn('actionstr', policy_db.parameters['attributes'])\n\n for i in range(0, policy_db.parameters['threshold']):\n liveaction = LiveActionDB(action='wolfpack.action-1', parameters={'actionstr': 'fu'})\n action_service.request(liveaction)\n\n scheduled = [item for item in LiveAction.get_all() if item.status in SCHEDULED_STATES]\n self.assertEqual(len(scheduled), policy_db.parameters['threshold'])\n\n # Execution is expected to be delayed since concurrency threshold is reached.\n liveaction = LiveActionDB(action='wolfpack.action-1', parameters={'actionstr': 'fu'})\n liveaction, _ = action_service.request(liveaction)\n delayed = LiveAction.get_by_id(str(liveaction.id))\n self.assertEqual(delayed.status, action_constants.LIVEACTION_STATUS_DELAYED)\n\n # Execution is expected to be scheduled since concurrency threshold is not reached.\n # The execution with actionstr \"fu\" is over the threshold but actionstr \"bar\" is not.\n liveaction = LiveActionDB(action='wolfpack.action-1', parameters={'actionstr': 'bar'})\n liveaction, _ = action_service.request(liveaction)\n liveaction = LiveAction.get_by_id(str(liveaction.id))\n self.assertIn(liveaction.status, SCHEDULED_STATES)\n\n # Mark one of the execution as completed.\n action_service.update_status(\n scheduled[0], action_constants.LIVEACTION_STATUS_SUCCEEDED, publish=True)\n\n # Execution is expected to be rescheduled.\n liveaction = LiveAction.get_by_id(str(delayed.id))\n self.assertIn(liveaction.status, SCHEDULED_STATES)", "metadata": "root.ConcurrencyByAttributePolicyTest.test_over_threshold", "header": "['class', 'ConcurrencyByAttributePolicyTest', '(', 'EventletTestCase', ',', 'DbTestCase', ')', ':', '___EOS___']", "index": 83 }, { "content": " def test_on_cancellation(self):\n policy_db = Policy.get_by_ref('wolfpack.action-1.concurrency.attr')\n self.assertGreater(policy_db.parameters['threshold'], 0)\n self.assertIn('actionstr', policy_db.parameters['attributes'])\n\n for i in range(0, policy_db.parameters['threshold']):\n liveaction = LiveActionDB(action='wolfpack.action-1', parameters={'actionstr': 'fu'})\n action_service.request(liveaction)\n\n scheduled = [item for item in LiveAction.get_all() if item.status in SCHEDULED_STATES]\n self.assertEqual(len(scheduled), policy_db.parameters['threshold'])\n\n # Execution is expected to be delayed since concurrency threshold is reached.\n liveaction = LiveActionDB(action='wolfpack.action-1', parameters={'actionstr': 'fu'})\n liveaction, _ = action_service.request(liveaction)\n delayed = LiveAction.get_by_id(str(liveaction.id))\n self.assertEqual(delayed.status, action_constants.LIVEACTION_STATUS_DELAYED)\n\n # Execution is expected to be scheduled since concurrency threshold is not reached.\n # The execution with actionstr \"fu\" is over the threshold but actionstr \"bar\" is not.\n liveaction = LiveActionDB(action='wolfpack.action-1', parameters={'actionstr': 'bar'})\n liveaction, _ = action_service.request(liveaction)\n liveaction = LiveAction.get_by_id(str(liveaction.id))\n self.assertIn(liveaction.status, SCHEDULED_STATES)\n\n # Cancel execution.\n action_service.request_cancellation(scheduled[0], 'stanley')\n\n # Execution is expected to be rescheduled.\n liveaction = LiveAction.get_by_id(str(delayed.id))\n self.assertIn(liveaction.status, SCHEDULED_STATES)", "metadata": "root.ConcurrencyByAttributePolicyTest.test_on_cancellation", "header": "['class', 'ConcurrencyByAttributePolicyTest', '(', 'EventletTestCase', ',', 'DbTestCase', ')', ':', '___EOS___']", "index": 116 } ]
[]
[]
0
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "License", "d", " ", "to", " ", "the", " ", "Stack", "Stor", "m", ",", " ", "Inc", " ", "('", "Stack", "Stor", "m", "')", " ", "under", " ", "one", " ", "or", " ", "more_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "contributor", " ", "license", " ", "agreement", "s", ".", " ", " ", "See", " ", "the", " ", "NOTICE", " ", "file", " ", "distributed", " ", "with_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "this", " ", "work", " ", "for", " ", "addition", "al", " ", "informati", "on", " ", "regarding", " ", "copyr", "ight", " ", "owner", "ship", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "AS", "F", " ", "license", "s", " ", "this", " ", "file", " ", "to", " ", "You", " ", "under", " ", "the", " ", "Ap", "ache", " ", "License", ",", " ", "Version", " ", "2.0_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "(", "the", " ", "\"", "License", "\");", " ", "you", " ", "may", " ", "not", " ", "use", " ", "this", " ", "file", " ", "except", " ", "in", " ", "compli", "anc", "e", " ", "with_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "the", " ", "License", ".", " ", " ", "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_", "import_", "mock_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "st2", "common_", "._", "constants_", "import_", "action_", "as_", "action", "\\u", "constants_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "st2", "common_", "._", "models_", "._", "db_", "._", "action_", "import_", "Live", "Action", "DB_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "st2", "common_", "._", "persistence_", "._", "action_", "import_", "Live", "Action_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "st2", "common_", "._", "persistence_", "._", "policy_", "import_", "Policy_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "st2", "common_", "._", "services_", "import_", "action_", "as_", "action", "\\u", "service_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "st2", "common_", "._", "transport_", "._", "live", "action_", "import_", "Live", "Action", "Publisher_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "st2", "common_", "._", "transport_", "._", "publishers", "_", "import_", "CU", "DP", "ubli", "sher", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "st2", "tests_", "import_", "Db", "Test", "Case_", ",_", "Event", "let", "Test", "Case_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "st2", "tests_", "._", "fixture", "slo", "ader_", "import_", "Fix", "tures", "Loader_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "tests_", "._", "unit_", "._", "base_", "import_", "Moc", "k", "Live", "Action", "Publisher_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "st2", "tests_", "._", "mocks_", "._", "runner_", "import_", "Moc", "k", "Action", "Runner_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "PACK", "_", "=_", "'", "gener", "ic", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "TEST", "\\u", "FIXTURE", "S_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "runners", "'_", ":_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "'", "testrun", "ner", "1", ".", "yaml", "'_", "\\u\\u\\uNL\\u\\u\\u_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "action", "s", "'_", ":_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "'", "action", "1", ".", "yaml", "'_", "\\u\\u\\uNL\\u\\u\\u_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "policy", "types", "'_", ":_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "'", "policy", "\\u", "type", "\\u", "2", ".", "yaml", "'_", "\\u\\u\\uNL\\u\\u\\u_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "poli", "cies", "'_", ":_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "'", "policy", "\\u", "3", ".", "yaml", "'_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "NON", "\\u", "EMP", "TY", "\\u", "RESULT_", "=_", "'", "non", "-", "empty", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "SCHEDULE", "D", "\\u", "STATES_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "action", "\\u", "constants_", "._", "LIVE", "ACTI", "ON", "\\u", "STATUS", "\\u", "SCHEDULE", "D_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "action", "\\u", "constants_", "._", "LIVE", "ACTI", "ON", "\\u", "STATUS", "\\u", "RUNNING_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "action", "\\u", "constants_", "._", "LIVE", "ACTI", "ON", "\\u", "STATUS", "\\u", "SUC", "CEE", "DED", "_", "\\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_", "@_", "mock_", "._", "patch_", "._", "object_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "Moc", "k", "Action", "Runner_", ",_", "'", "run", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "mock_", "._", "Mag", "ic", "Mock_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "return", "\\u", "value_", "=_", "(_", "action", "\\u", "constants_", "._", "LIVE", "ACTI", "ON", "\\u", "STATUS", "\\u", "RUNNING_", ",_", "NON", "\\u", "EMP", "TY", "\\u", "RESULT_", ",_", "None_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "mock_", "._", "patch_", "._", "object_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "CU", "DP", "ubli", "sher", "_", ",_", "'", "publi", "sh", "\\u", "update", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "mock_", "._", "Mag", "ic", "Mock_", "(_", "side", "\\u", "effect_", "=_", "Moc", "k", "Live", "Action", "Publisher_", "._", "publi", "sh", "\\u", "update_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "mock_", "._", "patch_", "._", "object_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "CU", "DP", "ubli", "sher", "_", ",_", "'", "publi", "sh", "\\u", "create", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "mock_", "._", "Mag", "ic", "Mock_", "(_", "return", "\\u", "value_", "=_", "None_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "mock_", "._", "patch_", "._", "object_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "Live", "Action", "Publisher_", ",_", "'", "publi", "sh", "\\u", "state", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "mock_", "._", "Mag", "ic", "Mock_", "(_", "side", "\\u", "effect_", "=_", "Moc", "k", "Live", "Action", "Publisher_", "._", "publi", "sh", "\\u", "state_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "class_", "Conc", "urr", "ency", "By", "Attribute", "Polic", "y", "Test_", "(_", "Event", "let", "Test", "Case_", ",_", "Db", "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_", "[SEP]_", "class_", "Conc", "urr", "ency", "By", "Attribute", "Polic", "y", "Test_", "(_", "Event", "let", "Test", "Case_", ",_", "Db", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "@_", "classmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "set", "Up", "Class_", "(_", "cls_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Event", "let", "Test", "Case_", "._", "set", "Up", "Class_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Db", "Test", "Case_", "._", "set", "Up", "Class_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "loader_", "=_", "Fix", "tures", "Loader_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "loader_", "._", "save", "\\u", "fixture", "s", "\\u", "to", "\\u", "db_", "(_", "fixture", "s", "\\u", "pack_", "=_", "PACK", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "fixture", "s", "\\u", "dict_", "=_", "TEST", "\\u", "FIXTURE", "S_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Conc", "urr", "ency", "By", "Attribute", "Polic", "y", "Test_", "(_", "Event", "let", "Test", "Case_", ",_", "Db", "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 ", " _", "for_", "live", "action_", "in_", "Live", "Action_", "._", "get", "\\u", "all_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "action", "\\u", "service_", "._", "update", "\\u", "status_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "live", "action_", ",_", "action", "\\u", "constants_", "._", "LIVE", "ACTI", "ON", "\\u", "STATUS", "\\u", "CANCEL", "ED_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Conc", "urr", "ency", "By", "Attribute", "Polic", "y", "Test_", "(_", "Event", "let", "Test", "Case_", ",_", "Db", "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", "over", "\\u", "threshold_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "policy", "\\u", "db_", "=_", "Policy_", "._", "get", "\\u", "by", "\\u", "ref_", "(_", "'", "wolf", "pack", ".", "action", "-1", ".", "concurrency", ".", "attr", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Greater_", "(_", "policy", "\\u", "db_", "._", "parameters_", "[_", "'", "threshol", "d", "'_", "]_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "In_", "(_", "'", "action", "str", "'_", ",_", "policy", "\\u", "db_", "._", "parameters_", "[_", "'", "attribute", "s", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "i_", "in_", "range_", "(_", "0_", ",_", "policy", "\\u", "db_", "._", "parameters_", "[_", "'", "threshol", "d", "'_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "live", "action_", "=_", "Live", "Action", "DB_", "(_", "action_", "=_", "'", "wolf", "pack", ".", "action", "-1", "'_", ",_", "parameters_", "=_", "{_", "'", "action", "str", "'_", ":_", "'", "fu", "'_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "action", "\\u", "service_", "._", "request_", "(_", "live", "action_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "schedule", "d_", "=_", "[_", "item_", "for_", "item_", "in_", "Live", "Action_", "._", "get", "\\u", "all_", "(_", ")_", "if_", "item_", "._", "status_", "in_", "SCHEDULE", "D", "\\u", "STATES_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "schedule", "d_", ")_", ",_", "policy", "\\u", "db_", "._", "parameters_", "[_", "'", "threshol", "d", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Execut", "ion", " ", "is", " ", "expected", " ", "to", " ", "be", " ", "delayed", " ", "sinc", "e", " ", "concurrency", " ", "threshol", "d", " ", "is", " ", "reache", "d", "._", "\\u\\u\\uNL\\u\\u\\u_", "live", "action_", "=_", "Live", "Action", "DB_", "(_", "action_", "=_", "'", "wolf", "pack", ".", "action", "-1", "'_", ",_", "parameters_", "=_", "{_", "'", "action", "str", "'_", ":_", "'", "fu", "'_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "live", "action_", ",_", "\\u_", "=_", "action", "\\u", "service_", "._", "request_", "(_", "live", "action_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "delayed_", "=_", "Live", "Action_", "._", "get", "\\u", "by", "\\u", "id_", "(_", "str_", "(_", "live", "action_", "._", "id_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "delayed_", "._", "status_", ",_", "action", "\\u", "constants_", "._", "LIVE", "ACTI", "ON", "\\u", "STATUS", "\\u", "DELAY", "ED_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Execut", "ion", " ", "is", " ", "expected", " ", "to", " ", "be", " ", "schedule", "d", " ", "sinc", "e", " ", "concurrency", " ", "threshol", "d", " ", "is", " ", "not", " ", "reache", "d", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "executi", "on", " ", "with", " ", "action", "str", " ", "\"", "fu", "\"", " ", "is", " ", "over", " ", "the", " ", "threshol", "d", " ", "but", " ", "action", "str", " ", "\"", "bar", "\"", " ", "is", " ", "not", "._", "\\u\\u\\uNL\\u\\u\\u_", "live", "action_", "=_", "Live", "Action", "DB_", "(_", "action_", "=_", "'", "wolf", "pack", ".", "action", "-1", "'_", ",_", "parameters_", "=_", "{_", "'", "action", "str", "'_", ":_", "'", "bar", "'_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "live", "action_", ",_", "\\u_", "=_", "action", "\\u", "service_", "._", "request_", "(_", "live", "action_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "live", "action_", "=_", "Live", "Action_", "._", "get", "\\u", "by", "\\u", "id_", "(_", "str_", "(_", "live", "action_", "._", "id_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "In_", "(_", "live", "action_", "._", "status_", ",_", "SCHEDULE", "D", "\\u", "STATES_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Mark", " ", "one", " ", "of", " ", "the", " ", "executi", "on", " ", "as", " ", "complete", "d", "._", "\\u\\u\\uNL\\u\\u\\u_", "action", "\\u", "service_", "._", "update", "\\u", "status_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "schedule", "d_", "[_", "0_", "]_", ",_", "action", "\\u", "constants_", "._", "LIVE", "ACTI", "ON", "\\u", "STATUS", "\\u", "SUC", "CEE", "DED", "_", ",_", "publish_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Execut", "ion", " ", "is", " ", "expected", " ", "to", " ", "be", " ", "resc", "hedule", "d", "._", "\\u\\u\\uNL\\u\\u\\u_", "live", "action_", "=_", "Live", "Action_", "._", "get", "\\u", "by", "\\u", "id_", "(_", "str_", "(_", "delayed_", "._", "id_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "In_", "(_", "live", "action_", "._", "status_", ",_", "SCHEDULE", "D", "\\u", "STATES_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Conc", "urr", "ency", "By", "Attribute", "Polic", "y", "Test_", "(_", "Event", "let", "Test", "Case_", ",_", "Db", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "on", "\\u", "cancellat", "ion_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "policy", "\\u", "db_", "=_", "Policy_", "._", "get", "\\u", "by", "\\u", "ref_", "(_", "'", "wolf", "pack", ".", "action", "-1", ".", "concurrency", ".", "attr", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Greater_", "(_", "policy", "\\u", "db_", "._", "parameters_", "[_", "'", "threshol", "d", "'_", "]_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "In_", "(_", "'", "action", "str", "'_", ",_", "policy", "\\u", "db_", "._", "parameters_", "[_", "'", "attribute", "s", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "i_", "in_", "range_", "(_", "0_", ",_", "policy", "\\u", "db_", "._", "parameters_", "[_", "'", "threshol", "d", "'_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "live", "action_", "=_", "Live", "Action", "DB_", "(_", "action_", "=_", "'", "wolf", "pack", ".", "action", "-1", "'_", ",_", "parameters_", "=_", "{_", "'", "action", "str", "'_", ":_", "'", "fu", "'_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "action", "\\u", "service_", "._", "request_", "(_", "live", "action_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "schedule", "d_", "=_", "[_", "item_", "for_", "item_", "in_", "Live", "Action_", "._", "get", "\\u", "all_", "(_", ")_", "if_", "item_", "._", "status_", "in_", "SCHEDULE", "D", "\\u", "STATES_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "schedule", "d_", ")_", ",_", "policy", "\\u", "db_", "._", "parameters_", "[_", "'", "threshol", "d", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Execut", "ion", " ", "is", " ", "expected", " ", "to", " ", "be", " ", "delayed", " ", "sinc", "e", " ", "concurrency", " ", "threshol", "d", " ", "is", " ", "reache", "d", "._", "\\u\\u\\uNL\\u\\u\\u_", "live", "action_", "=_", "Live", "Action", "DB_", "(_", "action_", "=_", "'", "wolf", "pack", ".", "action", "-1", "'_", ",_", "parameters_", "=_", "{_", "'", "action", "str", "'_", ":_", "'", "fu", "'_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "live", "action_", ",_", "\\u_", "=_", "action", "\\u", "service_", "._", "request_", "(_", "live", "action_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "delayed_", "=_", "Live", "Action_", "._", "get", "\\u", "by", "\\u", "id_", "(_", "str_", "(_", "live", "action_", "._", "id_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "delayed_", "._", "status_", ",_", "action", "\\u", "constants_", "._", "LIVE", "ACTI", "ON", "\\u", "STATUS", "\\u", "DELAY", "ED_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Execut", "ion", " ", "is", " ", "expected", " ", "to", " ", "be", " ", "schedule", "d", " ", "sinc", "e", " ", "concurrency", " ", "threshol", "d", " ", "is", " ", "not", " ", "reache", "d", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "executi", "on", " ", "with", " ", "action", "str", " ", "\"", "fu", "\"", " ", "is", " ", "over", " ", "the", " ", "threshol", "d", " ", "but", " ", "action", "str", " ", "\"", "bar", "\"", " ", "is", " ", "not", "._", "\\u\\u\\uNL\\u\\u\\u_", "live", "action_", "=_", "Live", "Action", "DB_", "(_", "action_", "=_", "'", "wolf", "pack", ".", "action", "-1", "'_", ",_", "parameters_", "=_", "{_", "'", "action", "str", "'_", ":_", "'", "bar", "'_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "live", "action_", ",_", "\\u_", "=_", "action", "\\u", "service_", "._", "request_", "(_", "live", "action_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "live", "action_", "=_", "Live", "Action_", "._", "get", "\\u", "by", "\\u", "id_", "(_", "str_", "(_", "live", "action_", "._", "id_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "In_", "(_", "live", "action_", "._", "status_", ",_", "SCHEDULE", "D", "\\u", "STATES_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Cancel", " ", "executi", "on", "._", "\\u\\u\\uNL\\u\\u\\u_", "action", "\\u", "service_", "._", "request", "\\u", "cancellat", "ion_", "(_", "schedule", "d_", "[_", "0_", "]_", ",_", "'", "stan", "ley", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Execut", "ion", " ", "is", " ", "expected", " ", "to", " ", "be", " ", "resc", "hedule", "d", "._", "\\u\\u\\uNL\\u\\u\\u_", "live", "action_", "=_", "Live", "Action_", "._", "get", "\\u", "by", "\\u", "id_", "(_", "str_", "(_", "delayed_", "._", "id_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "In_", "(_", "live", "action_", "._", "status_", ",_", "SCHEDULE", "D", "\\u", "STATES_", ")_" ]
[ 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,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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 ]
Variable defined multiple times
kuri65536/python-for-android/python-modules/twisted/twisted/python/zippath.py
[ { "content": " def parent(self):\n splitup = self.pathInArchive.split(ZIP_PATH_SEP)\n if len(splitup) == 1:\n return self.archive\n return ZipPath(self.archive, ZIP_PATH_SEP.join(splitup[:-1]))", "metadata": "root.ZipPath.parent", "header": "['class', 'ZipPath', '(', '_PathHelper', ')', ':', '___EOS___']", "index": 62 } ]
[]
[]
0
true
[ "[CLS]_", "Variable_", "defined_", "multiple_", "times_", "[SEP]_", "class_", "Zip", "Path_", "(_", "\\u", "Path", "Helper_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "parent_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "split", "up_", "=_", "self_", "._", "path", "In", "Archive_", "._", "split_", "(_", "ZI", "P", "\\u", "PATH", "\\u", "SEP", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "len_", "(_", "split", "up_", ")_", "==_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "archive_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "Zip", "Path_", "(_", "self_", "._", "archive_", ",_", "ZI", "P", "\\u", "PATH", "\\u", "SEP", "_", "._", "join_", "(_", "split", "up_", "[_", ":_", "-_", "1_", "]_", ")_", ")_", "\\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 ]
Unused import
hazelcast/hazelcast-python-client/examples/transaction.py
[ { "content": "import logging\n\nimport sys\nfrom os.path import dirname\n\nsys.path.append(dirname(dirname(__file__)))\nimport hazelcast\n\nif __name__ == '__main__':\n logging.basicConfig(format='%(asctime)s%(msecs)03d [%(name)s] %(levelname)s: %(message)s', datefmt=\"%H:%M%:%S,\")\n logging.getLogger().setLevel(logging.DEBUG)\n logger = logging.getLogger(\"main\")\n\n client = hazelcast.HazelcastClient()\n\n t = client.new_transaction()\n t.begin()\n try:\n map = t.get_map(\"test\")\n print(map)\n t.commit()\n except:\n logger.exception(\"Exception in transaction\")\n t.rollback()\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[]
[]
0
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "import_", "logging_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "os_", "._", "path_", "import_", "dirname_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "sys_", "._", "path_", "._", "append_", "(_", "dirname_", "(_", "dirname_", "(_", "\\u\\u", "file\\u\\u_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "haz", "el", "cast_", "\\u\\u\\uNEWLINE\\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\\uINDENT\\u\\u\\u ", " _", "logging_", "._", "basic", "Config_", "(_", "format_", "=_", "'%", "(", "asc", "time", ")", "s", "%", "(", "msec", "s", ")", "03", "d", " ", "[", "%", "(", "name", ")", "s", "]", " ", "%", "(", "level", "name", ")", "s", ":", " ", "%", "(", "message", ")", "s", "'_", ",_", "datefmt_", "=_", "\"%", "H", ":", "%", "M", "%", ":", "%", "S", ",\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logging_", "._", "get", "Logger_", "(_", ")_", "._", "set", "Level_", "(_", "logging_", "._", "DEBUG_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logger_", "=_", "logging_", "._", "get", "Logger_", "(_", "\"", "main", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "client_", "=_", "haz", "el", "cast_", "._", "Ha", "zel", "cast", "Client_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "t_", "=_", "client_", "._", "new", "\\u", "transaction_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t_", "._", "begin_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "map_", "=_", "t_", "._", "get", "\\u", "map_", "(_", "\"", "test", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "map_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t_", "._", "commit_", "(_", ")_", "\\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 ", " _", "logger_", "._", "exception_", "(_", "\"", "Except", "ion", " ", "in", " ", "transaction", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t_", "._", "rollback_", "(_", ")_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\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 ]
Variable defined multiple times
mne-tools/mne-python/mne/source_estimate.py
[ { "content": "def read_source_estimate(fname, subject=None):\n \"\"\"Read a soure estimate object\n\n Parameters\n ----------\n fname : str\n Path to (a) source-estimate file(s).\n subject : str | None\n Name of the subject the source estimate(s) is (are) from.\n It is good practice to set this attribute to avoid combining\n incompatible labels and SourceEstimates (e.g., ones from other\n subjects). Note that due to file specification limitations, the\n subject name isn't saved to or loaded from files written to disk.\n\n Returns\n -------\n stc : SourceEstimate | VolSourceEstimate\n The soure estimate object loaded from file.\n\n Notes\n -----\n - for volume source estimates, ``fname`` should provide the path to a\n single file named '*-vl.stc` or '*-vol.stc'\n - for surface source estimates, ``fname`` should either provide the\n path to the file corresponding to a single hemisphere ('*-lh.stc',\n '*-rh.stc') or only specify the asterisk part in these patterns. In any\n case, the function expects files for both hemisphere with names\n following this pattern.\n - for single time point .w files, ``fname`` should follow the same\n pattern as for surface estimates, except that files are named\n '*-lh.w' and '*-rh.w'.\n \"\"\"\n fname_arg = fname\n\n # make sure corresponding file(s) can be found\n ftype = None\n if os.path.exists(fname):\n if fname.endswith('-vl.stc') or fname.endswith('-vol.stc') or \\\n fname.endswith('-vl.w') or fname.endswith('-vol.w'):\n ftype = 'volume'\n elif fname.endswith('.stc'):\n ftype = 'surface'\n if fname.endswith(('-lh.stc', '-rh.stc')):\n fname = fname[:-7]\n else:\n err = (\"Invalid .stc filename: %r; needs to end with \"\n \"hemisphere tag ('...-lh.stc' or '...-rh.stc')\"\n % fname)\n raise IOError(err)\n elif fname.endswith('.w'):\n ftype = 'w'\n if fname.endswith(('-lh.w', '-rh.w')):\n fname = fname[:-5]\n else:\n err = (\"Invalid .w filename: %r; needs to end with \"\n \"hemisphere tag ('...-lh.w' or '...-rh.w')\"\n % fname)\n raise IOError(err)\n elif fname.endswith('-stc.h5'):\n ftype = 'h5'\n fname = fname[:-7]\n else:\n raise RuntimeError('Unknown extension for file %s' % fname_arg)\n\n if ftype is not 'volume':\n stc_exist = [os.path.exists(f)\n for f in [fname + '-rh.stc', fname + '-lh.stc']]\n w_exist = [os.path.exists(f)\n for f in [fname + '-rh.w', fname + '-lh.w']]\n h5_exist = os.path.exists(fname + '-stc.h5')\n if all(stc_exist) and (ftype is not 'w'):\n ftype = 'surface'\n elif all(w_exist):\n ftype = 'w'\n elif h5_exist:\n ftype = 'h5'\n elif any(stc_exist) or any(w_exist):\n raise IOError(\"Hemisphere missing for %r\" % fname_arg)\n else:\n raise IOError(\"SourceEstimate File(s) not found for: %r\"\n % fname_arg)\n\n # read the files\n if ftype == 'volume': # volume source space\n if fname.endswith('.stc'):\n kwargs = _read_stc(fname)\n elif fname.endswith('.w'):\n kwargs = _read_w(fname)\n kwargs['data'] = kwargs['data'][:, np.newaxis]\n kwargs['tmin'] = 0.0\n kwargs['tstep'] = 0.0\n else:\n raise IOError('Volume source estimate must end with .stc or .w')\n elif ftype == 'surface': # stc file with surface source spaces\n lh = _read_stc(fname + '-lh.stc')\n rh = _read_stc(fname + '-rh.stc')\n assert lh['tmin'] == rh['tmin']\n assert lh['tstep'] == rh['tstep']\n kwargs = lh.copy()\n kwargs['data'] = np.r_[lh['data'], rh['data']]\n kwargs['vertices'] = [lh['vertices'], rh['vertices']]\n elif ftype == 'w': # w file with surface source spaces\n lh = _read_w(fname + '-lh.w')\n rh = _read_w(fname + '-rh.w')\n kwargs = lh.copy()\n kwargs['data'] = np.atleast_2d(np.r_[lh['data'], rh['data']]).T\n kwargs['vertices'] = [lh['vertices'], rh['vertices']]\n # w files only have a single time point\n kwargs['tmin'] = 0.0\n kwargs['tstep'] = 1.0\n elif ftype == 'h5':\n kwargs = read_hdf5(fname + '-stc.h5', title='mnepython')\n\n if ftype != 'volume':\n # Make sure the vertices are ordered\n vertices = kwargs['vertices']\n if any(np.any(np.diff(v.astype(int)) <= 0) for v in vertices):\n sidx = [np.argsort(verts) for verts in vertices]\n vertices = [verts[idx] for verts, idx in zip(vertices, sidx)]\n data = kwargs['data'][np.r_[sidx[0], len(sidx[0]) + sidx[1]]]\n kwargs['vertices'] = vertices\n kwargs['data'] = data\n\n if 'subject' not in kwargs:\n kwargs['subject'] = subject\n if subject is not None and subject != kwargs['subject']:\n raise RuntimeError('provided subject name \"%s\" does not match '\n 'subject name from the file \"%s'\n % (subject, kwargs['subject']))\n\n if ftype == 'volume':\n stc = VolSourceEstimate(**kwargs)\n else:\n stc = SourceEstimate(**kwargs)\n\n return stc", "metadata": "root.read_source_estimate", "header": "['module', '___EOS___']", "index": 213 } ]
[]
[]
0
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_", "read", "\\u", "source", "\\u", "estimate_", "(_", "fname_", ",_", "subject_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Read", " ", "a", " ", "sou", "re", " ", "estimate", " ", "object", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Parameter", "s", "\\", "10", ";", " ", " ", " ", " ", "----------", "\\", "10", ";", " ", " ", " ", " ", "fname", " ", ":", " ", "str", "\\", "10", ";", " ", " ", " ", " ", "Path", " ", "to", " ", "(", "a", ")", " ", "source", "-", "estimate", " ", "file", "(", "s", ").", "\\", "10", ";", " ", " ", " ", " ", "subject", " ", ":", " ", "str", " ", "|", " ", "Non", "e", "\\", "10", ";", " ", " ", " ", " ", "Name", " ", "of", " ", "the", " ", "subject", " ", "the", " ", "source", " ", "estimate", "(", "s", ")", " ", "is", " ", "(", "are", ")", " ", "from", ".", "\\", "10", ";", " ", " ", " ", " ", "It", " ", "is", " ", "good", " ", "practic", "e", " ", "to", " ", "set", " ", "this", " ", "attribute", " ", "to", " ", "avoid", " ", "combin", "ing", "\\", "10", ";", " ", " ", " ", " ", "incomp", "atible", " ", "labels", " ", "and", " ", "Sou", "rce", "Estimat", "es", " ", "(", "e", ".", "g", ".,", " ", "ones", " ", "from", " ", "other", "\\", "10", ";", " ", " ", " ", " ", "subject", "s", ").", " ", "Not", "e", " ", "tha", "t", " ", "due", " ", "to", " ", "file", " ", "specifica", "tion", " ", "limit", "ation", "s", ",", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "subject", " ", "name", " ", "isn", "'", "t", " ", "saved", " ", "to", " ", "or", " ", "load", "ed", " ", "from", " ", "files", " ", "writt", "en", " ", "to", " ", "disk", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", "\\", "10", ";", " ", " ", " ", " ", "-------", "\\", "10", ";", " ", " ", " ", " ", "stc", " ", ":", " ", "Sou", "rce", "Estimat", "e", " ", "|", " ", "Vol", "Sou", "rce", "Estimat", "e", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "sou", "re", " ", "estimate", " ", "object", " ", "load", "ed", " ", "from", " ", "file", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Not", "es", "\\", "10", ";", " ", " ", " ", " ", "-----", "\\", "10", ";", " ", "-", " ", "for", " ", "volume", " ", "source", " ", "estimate", "s", ",", " ", "``", "fname", "``", " ", "shou", "ld", " ", "provide", " ", "the", " ", "path", " ", "to", " ", "a", "\\", "10", ";", " ", " ", " ", "single", " ", "file", " ", "named", " ", "'*", "-", "vl", ".", "stc", "`", " ", "or", " ", "'*", "-", "vol", ".", "stc", "'", "\\", "10", ";", " ", "-", " ", "for", " ", "surf", "ace", " ", "source", " ", "estimate", "s", ",", " ", "``", "fname", "``", " ", "shou", "ld", " ", "eit", "her", " ", "provide", " ", "the", "\\", "10", ";", " ", " ", " ", "path", " ", "to", " ", "the", " ", "file", " ", "correspond", "ing", " ", "to", " ", "a", " ", "single", " ", "hemi", "sphere", " ", "('", "*-", "lh", ".", "stc", "',", "\\", "10", ";", " ", " ", " ", "'*", "-", "rh", ".", "stc", "')", " ", "or", " ", "only", " ", "speci", "fy", " ", "the", " ", "aster", "isk", " ", "part", " ", "in", " ", "these", " ", "pattern", "s", ".", " ", "In", " ", "any", "\\", "10", ";", " ", " ", " ", "case", ",", " ", "the", " ", "function", " ", "expect", "s", " ", "files", " ", "for", " ", "bot", "h", " ", "hemi", "sphere", " ", "with", " ", "names", "\\", "10", ";", " ", " ", " ", "follow", "ing", " ", "this", " ", "pattern", ".", "\\", "10", ";", " ", "-", " ", "for", " ", "single", " ", "time", " ", "point", " ", ".", "w", " ", "files", ",", " ", "``", "fname", "``", " ", "shou", "ld", " ", "follow", " ", "the", " ", "same", "\\", "10", ";", " ", " ", " ", "pattern", " ", "as", " ", "for", " ", "surf", "ace", " ", "estimate", "s", ",", " ", "except", " ", "tha", "t", " ", "files", " ", "are", " ", "named", "\\", "10", ";", " ", " ", " ", "'*", "-", "lh", ".", "w", "'", " ", "and", " ", "'*", "-", "rh", ".", "w", "'.", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fname", "\\u", "arg_", "=_", "fname_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "make", " ", "sure", " ", "correspond", "ing", " ", "file", "(", "s", ")", " ", "can", " ", "be", " ", "found_", "\\u\\u\\uNL\\u\\u\\u_", "ftype_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "os_", "._", "path_", "._", "exists_", "(_", "fname_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "fname_", "._", "endswith_", "(_", "'-", "vl", ".", "stc", "'_", ")_", "or_", "fname_", "._", "endswith_", "(_", "'-", "vol", ".", "stc", "'_", ")_", "or_", "fname_", "._", "endswith_", "(_", "'-", "vl", ".", "w", "'_", ")_", "or_", "fname_", "._", "endswith_", "(_", "'-", "vol", ".", "w", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ftype_", "=_", "'", "volume", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "fname_", "._", "endswith_", "(_", "'.", "stc", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ftype_", "=_", "'", "surf", "ace", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "fname_", "._", "endswith_", "(_", "(_", "'-", "lh", ".", "stc", "'_", ",_", "'-", "rh", ".", "stc", "'_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "fname_", "=_", "fname_", "[_", ":_", "-_", "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 ", " _", "err_", "=_", "(_", "\"", "Inva", "lid", " ", ".", "stc", " ", "filename", ":", " ", "%", "r", ";", " ", "need", "s", " ", "to", " ", "end", " ", "with", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "hemi", "sphere", " ", "tag", " ", "('.", "..", "-", "lh", ".", "stc", "'", " ", "or", " ", "'...", "-", "rh", ".", "stc", "')\"_", "\\u\\u\\uNL\\u\\u\\u_", "%_", "fname_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "IO", "Error_", "(_", "err_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "fname_", "._", "endswith_", "(_", "'.", "w", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ftype_", "=_", "'", "w", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "fname_", "._", "endswith_", "(_", "(_", "'-", "lh", ".", "w", "'_", ",_", "'-", "rh", ".", "w", "'_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "fname_", "=_", "fname_", "[_", ":_", "-_", "5_", "]_", "\\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_", "=_", "(_", "\"", "Inva", "lid", " ", ".", "w", " ", "filename", ":", " ", "%", "r", ";", " ", "need", "s", " ", "to", " ", "end", " ", "with", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "hemi", "sphere", " ", "tag", " ", "('.", "..", "-", "lh", ".", "w", "'", " ", "or", " ", "'...", "-", "rh", ".", "w", "')\"_", "\\u\\u\\uNL\\u\\u\\u_", "%_", "fname_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "IO", "Error_", "(_", "err_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "fname_", "._", "endswith_", "(_", "'-", "stc", ".", "h5", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ftype_", "=_", "'", "h5", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fname_", "=_", "fname_", "[_", ":_", "-_", "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 ", " _", "raise_", "Run", "time", "Error_", "(_", "'", "Un", "know", "n", " ", "extensi", "on", " ", "for", " ", "file", " ", "%", "s", "'_", "%_", "fname", "\\u", "arg_", ")_", "\\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_", "ftype_", "is_", "not_", "'", "volume", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "stc", "\\u", "exist_", "=_", "[_", "os_", "._", "path_", "._", "exists_", "(_", "f_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "f_", "in_", "[_", "fname_", "+_", "'-", "rh", ".", "stc", "'_", ",_", "fname_", "+_", "'-", "lh", ".", "stc", "'_", "]_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "w", "\\u", "exist_", "=_", "[_", "os_", "._", "path_", "._", "exists_", "(_", "f_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "f_", "in_", "[_", "fname_", "+_", "'-", "rh", ".", "w", "'_", ",_", "fname_", "+_", "'-", "lh", ".", "w", "'_", "]_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "h5", "\\u", "exist_", "=_", "os_", "._", "path_", "._", "exists_", "(_", "fname_", "+_", "'-", "stc", ".", "h5", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "all_", "(_", "stc", "\\u", "exist_", ")_", "and_", "(_", "ftype_", "is_", "not_", "'", "w", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ftype_", "=_", "'", "surf", "ace", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "all_", "(_", "w", "\\u", "exist_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ftype_", "=_", "'", "w", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "h5", "\\u", "exist_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ftype_", "=_", "'", "h5", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "any_", "(_", "stc", "\\u", "exist_", ")_", "or_", "any_", "(_", "w", "\\u", "exist_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "IO", "Error_", "(_", "\"", "He", "mis", "pher", "e", " ", "missi", "ng", " ", "for", " ", "%", "r", "\"_", "%_", "fname", "\\u", "arg_", ")_", "\\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_", "IO", "Error_", "(_", "\"", "Sou", "rce", "Estimat", "e", " ", "File", "(", "s", ")", " ", "not", " ", "found", " ", "for", ":", " ", "%", "r", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "%_", "fname", "\\u", "arg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "read", " ", "the", " ", "files_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "ftype_", "==_", "'", "volume", "'_", ":_", "#", " ", "volume", " ", "source", " ", "space_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "fname_", "._", "endswith_", "(_", "'.", "stc", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "kwargs_", "=_", "\\u", "read", "\\u", "stc_", "(_", "fname_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "fname_", "._", "endswith_", "(_", "'.", "w", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "kwargs_", "=_", "\\u", "read", "\\u", "w_", "(_", "fname_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "kwargs_", "[_", "'", "data", "'_", "]_", "=_", "kwargs_", "[_", "'", "data", "'_", "]_", "[_", ":_", ",_", "np_", "._", "newaxis_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "kwargs_", "[_", "'", "tmi", "n", "'_", "]_", "=_", "0.0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "kwargs_", "[_", "'", "tst", "ep", "'_", "]_", "=_", "0.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 ", " _", "raise_", "IO", "Error_", "(_", "'", "Volume", " ", "source", " ", "estimate", " ", "must", " ", "end", " ", "with", " ", ".", "stc", " ", "or", " ", ".", "w", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "ftype_", "==_", "'", "surf", "ace", "'_", ":_", "#", " ", "stc", " ", "file", " ", "with", " ", "surf", "ace", " ", "source", " ", "spaces_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "lh", "_", "=_", "\\u", "read", "\\u", "stc_", "(_", "fname_", "+_", "'-", "lh", ".", "stc", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rh_", "=_", "\\u", "read", "\\u", "stc_", "(_", "fname_", "+_", "'-", "rh", ".", "stc", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "lh", "_", "[_", "'", "tmi", "n", "'_", "]_", "==_", "rh_", "[_", "'", "tmi", "n", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "lh", "_", "[_", "'", "tst", "ep", "'_", "]_", "==_", "rh_", "[_", "'", "tst", "ep", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "kwargs_", "=_", "lh", "_", "._", "copy_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "kwargs_", "[_", "'", "data", "'_", "]_", "=_", "np_", "._", "r\\u_", "[_", "lh", "_", "[_", "'", "data", "'_", "]_", ",_", "rh_", "[_", "'", "data", "'_", "]_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "kwargs_", "[_", "'", "vertice", "s", "'_", "]_", "=_", "[_", "lh", "_", "[_", "'", "vertice", "s", "'_", "]_", ",_", "rh_", "[_", "'", "vertice", "s", "'_", "]_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "ftype_", "==_", "'", "w", "'_", ":_", "#", " ", "w", " ", "file", " ", "with", " ", "surf", "ace", " ", "source", " ", "spaces_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "lh", "_", "=_", "\\u", "read", "\\u", "w_", "(_", "fname_", "+_", "'-", "lh", ".", "w", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rh_", "=_", "\\u", "read", "\\u", "w_", "(_", "fname_", "+_", "'-", "rh", ".", "w", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "kwargs_", "=_", "lh", "_", "._", "copy_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "kwargs_", "[_", "'", "data", "'_", "]_", "=_", "np_", "._", "atl", "east", "\\u", "2d_", "(_", "np_", "._", "r\\u_", "[_", "lh", "_", "[_", "'", "data", "'_", "]_", ",_", "rh_", "[_", "'", "data", "'_", "]_", "]_", ")_", "._", "T_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "kwargs_", "[_", "'", "vertice", "s", "'_", "]_", "=_", "[_", "lh", "_", "[_", "'", "vertice", "s", "'_", "]_", ",_", "rh_", "[_", "'", "vertice", "s", "'_", "]_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "w", " ", "files", " ", "only", " ", "have", " ", "a", " ", "single", " ", "time", " ", "point_", "\\u\\u\\uNL\\u\\u\\u_", "kwargs_", "[_", "'", "tmi", "n", "'_", "]_", "=_", "0.0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "kwargs_", "[_", "'", "tst", "ep", "'_", "]_", "=_", "1.0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "ftype_", "==_", "'", "h5", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "kwargs_", "=_", "read", "\\u", "hdf5", "_", "(_", "fname_", "+_", "'-", "stc", ".", "h5", "'_", ",_", "title_", "=_", "'", "mne", "python", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "ftype_", "!=_", "'", "volume", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Make", " ", "sure", " ", "the", " ", "vertice", "s", " ", "are", " ", "ordered_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "vertices_", "=_", "kwargs_", "[_", "'", "vertice", "s", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "any_", "(_", "np_", "._", "any_", "(_", "np_", "._", "diff_", "(_", "v_", "._", "astype_", "(_", "int_", ")_", ")_", "<=_", "0_", ")_", "for_", "v_", "in_", "vertices_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sid", "x_", "=_", "[_", "np_", "._", "argsort_", "(_", "verts_", ")_", "for_", "verts_", "in_", "vertices_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "vertices_", "=_", "[_", "verts_", "[_", "idx_", "]_", "for_", "verts_", ",_", "idx_", "in_", "zip_", "(_", "vertices_", ",_", "sid", "x_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data_", "=_", "kwargs_", "[_", "'", "data", "'_", "]_", "[_", "np_", "._", "r\\u_", "[_", "sid", "x_", "[_", "0_", "]_", ",_", "len_", "(_", "sid", "x_", "[_", "0_", "]_", ")_", "+_", "sid", "x_", "[_", "1_", "]_", "]_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "kwargs_", "[_", "'", "vertice", "s", "'_", "]_", "=_", "vertices_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "kwargs_", "[_", "'", "data", "'_", "]_", "=_", "data_", "\\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_", "'", "subject", "'_", "not_", "in_", "kwargs_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "kwargs_", "[_", "'", "subject", "'_", "]_", "=_", "subject_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "subject_", "is_", "not_", "None_", "and_", "subject_", "!=_", "kwargs_", "[_", "'", "subject", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Run", "time", "Error_", "(_", "'", "provided", " ", "subject", " ", "name", " ", "\"%", "s", "\"", " ", "doe", "s", " ", "not", " ", "match", " ", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'", "subject", " ", "name", " ", "from", " ", "the", " ", "file", " ", "\"%", "s", "'_", "\\u\\u\\uNL\\u\\u\\u_", "%_", "(_", "subject_", ",_", "kwargs_", "[_", "'", "subject", "'_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "ftype_", "==_", "'", "volume", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "stc_", "=_", "Vol", "Sou", "rce", "Estimat", "e_", "(_", "**_", "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 ", " _", "stc_", "=_", "Sou", "rce", "Estimat", "e_", "(_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "stc_", "\\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, 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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 ]
Variable defined multiple times
warfares/pretty-json/build/tools/exampleparser.py
[ { "content": "#!/usr/bin/env python\n\nimport sys\nimport os\nimport re\nimport urllib2\nimport time\nfrom xml.dom.minidom import Document\n\ntry:\n import xml.etree.ElementTree as ElementTree \nexcept ImportError:\n try:\n import cElementTree as ElementTree\n except ImportError:\n try:\n import elementtree.ElementTree as ElementTree\n except ImportError:\n import lxml.etree as ElementTree\n\nmissing_deps = False\ntry:\n import simplejson\n from BeautifulSoup import BeautifulSoup\nexcept ImportError, E:\n missing_deps = E \n\nfeedName = \"example-list.xml\"\nfeedPath = \"http://openlayers.org/dev/examples/\"\n\n \n \n\n \n \n\n\n\n \n \n \nif __name__ == \"__main__\":\n\n if missing_deps:\n print \"This script requires simplejson and BeautifulSoup. You don't have them. \\n(%s)\" % E\n sys.exit()\n \n if len(sys.argv) > 1:\n outFile = open(sys.argv[1],'w')\n else:\n outFile = open('../examples/example-list.js','w')\n \n examplesLocation = '../examples'\n print 'Reading examples from %s and writing out to %s' % (examplesLocation, outFile.name)\n \n exampleList = []\n docIds = ['title','shortdesc']\n \n #comment out option to create docs from online resource\n #examplesLocation = 'http://svn.openlayers.org/sandbox/docs/examples/'\n #examples = getListOfOnlineExamples(examplesLocation)\n\n examples = getListOfExamples(examplesLocation)\n\n modtime = time.strftime(\"%Y-%m-%dT%I:%M:%SZ\", time.gmtime())\n\n for example in examples:\n url = os.path.join(examplesLocation,example)\n html = getExampleHtml(url)\n tagvalues = parseHtml(html,docIds)\n tagvalues['example'] = example\n # add in svn info\n d = getSvnInfo(url)\n tagvalues[\"modified\"] = d[\"date\"] or modtime\n tagvalues[\"author\"] = d[\"author\"] or \"anonymous\"\n tagvalues['link'] = example\n\n exampleList.append(tagvalues)\n \n print\n \n exampleList.sort(key=lambda x:x['example'].lower())\n \n index = wordIndex(exampleList)\n\n json = simplejson.dumps({\"examples\": exampleList, \"index\": index})\n #give the json a global variable we can use in our js. This should be replaced or made optional.\n json = 'var info=' + json \n outFile.write(json)\n outFile.close()\n\n print \"writing feed to ../examples/%s \" % feedName\n atom = open('../examples/%s' % feedName, 'w')\n doc = createFeed(exampleList)\n atom.write(doc.toxml())\n atom.close()\n\n\n print 'complete'\n\n \n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[]
[]
0
true
[ "[CLS]_", "Variable_", "defined_", "multiple_", "times_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#!", "/", "usr", "/", "bin", "/", "env", " ", "python_", "\\u\\u\\uNL\\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_", "re_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "urllib2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "time_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "xml_", "._", "dom_", "._", "minidom_", "import_", "Document_", "\\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_", "xml_", "._", "etree_", "._", "Element", "Tree_", "as_", "Element", "Tree_", "\\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 ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "c", "Element", "Tree_", "as_", "Element", "Tree_", "\\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 ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "element", "tree_", "._", "Element", "Tree_", "as_", "Element", "Tree_", "\\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 ", " _", "import_", "lxml_", "._", "etree_", "as_", "Element", "Tree_", "\\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_", "missi", "ng", "\\u", "deps_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "simplejson_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "Bea", "uti", "ful", "Soup_", "import_", "Bea", "uti", "ful", "Soup_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Import", "Error_", ",_", "E_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "missi", "ng", "\\u", "deps_", "=_", "E_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "feed", "Name_", "=_", "\"", "example", "-", "list", ".", "xml", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "feed", "Path_", "=_", "\"", "http", "://", "openl", "aye", "rs", ".", "org", "/", "dev", "/", "example", "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\\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\\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\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "missi", "ng", "\\u", "deps_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "\"", "Thi", "s", " ", "script", " ", "require", "s", " ", "simple", "json", " ", "and", " ", "Bea", "uti", "ful", "Sou", "p", ".", " ", "You", " ", "don", "'", "t", " ", "have", " ", "them", ".", " ", "\\\\", "n", "(%", "s", ")\"_", "%_", "E_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "exit_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "len_", "(_", "sys_", "._", "argv_", ")_", ">_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "out", "File_", "=_", "open_", "(_", "sys_", "._", "argv_", "[_", "1_", "]_", ",_", "'", "w", "'_", ")_", "\\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", "File_", "=_", "open_", "(_", "'../", "example", "s", "/", "example", "-", "list", ".", "js", "'_", ",_", "'", "w", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "example", "s", "Location_", "=_", "'../", "example", "s", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "'", "Reading", " ", "example", "s", " ", "from", " ", "%", "s", " ", "and", " ", "writ", "ing", " ", "out", " ", "to", " ", "%", "s", "'_", "%_", "(_", "example", "s", "Location_", ",_", "out", "File_", "._", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "example", "List_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "doc", "Ids_", "=_", "[_", "'", "title", "'_", ",_", "'", "short", "desc", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "comment", " ", "out", " ", "option", " ", "to", " ", "create", " ", "docs", " ", "from", " ", "onli", "ne", " ", "resource_", "\\u\\u\\uNL\\u\\u\\u_", "#", "example", "s", "Locat", "ion", " ", "=", " ", "'", "http", "://", "svn", ".", "openl", "aye", "rs", ".", "org", "/", "sand", "box", "/", "docs", "/", "example", "s", "/'_", "\\u\\u\\uNL\\u\\u\\u_", "#", "example", "s", " ", "=", " ", "get", "List", "Of", "On", "line", "Exam", "ples", "(", "example", "s", "Locat", "ion", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "examples_", "=_", "get", "List", "Of", "Exam", "ples", "_", "(_", "example", "s", "Location_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "mod", "time_", "=_", "time_", "._", "strftime_", "(_", "\"%", "Y", "-%", "m", "-%", "d", "T", "%", "I", ":", "%", "M", ":", "%", "SZ", "\"_", ",_", "time_", "._", "gmtime_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "example_", "in_", "examples_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "url_", "=_", "os_", "._", "path_", "._", "join_", "(_", "example", "s", "Location_", ",_", "example_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "html_", "=_", "get", "Exam", "ple", "Html_", "(_", "url_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tag", "values_", "=_", "parse", "Html_", "(_", "html_", ",_", "doc", "Ids_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tag", "values_", "[_", "'", "example", "'_", "]_", "=_", "example_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "add", " ", "in", " ", "svn", " ", "info_", "\\u\\u\\uNL\\u\\u\\u_", "d_", "=_", "get", "Sv", "n", "Info_", "(_", "url_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tag", "values_", "[_", "\"", "modifi", "ed", "\"_", "]_", "=_", "d_", "[_", "\"", "date", "\"_", "]_", "or_", "mod", "time_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tag", "values_", "[_", "\"", "author", "\"_", "]_", "=_", "d_", "[_", "\"", "author", "\"_", "]_", "or_", "\"", "anonym", "ous", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tag", "values_", "[_", "'", "link", "'_", "]_", "=_", "example_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "example", "List_", "._", "append_", "(_", "tag", "values_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "print_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "example", "List_", "._", "sort_", "(_", "key_", "=_", "lambda_", "x_", ":_", "x_", "[_", "'", "example", "'_", "]_", "._", "lower_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "index_", "=_", "word", "Index_", "(_", "example", "List_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "json_", "=_", "simplejson_", "._", "dumps_", "(_", "{_", "\"", "example", "s", "\"_", ":_", "example", "List_", ",_", "\"", "index", "\"_", ":_", "index_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "give", " ", "the", " ", "json", " ", "a", " ", "global", " ", "variab", "le", " ", "we", " ", "can", " ", "use", " ", "in", " ", "our", " ", "js", ".", " ", " ", "Thi", "s", " ", "shou", "ld", " ", "be", " ", "replaced", " ", "or", " ", "made", " ", "option", "al", "._", "\\u\\u\\uNL\\u\\u\\u_", "json_", "=_", "'", "var", " ", "info", "='_", "+_", "json_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "out", "File_", "._", "write_", "(_", "json_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "out", "File_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "print_", "\"", "writ", "ing", " ", "feed", " ", "to", " ", "..", "/", "example", "s", "/", "%", "s", " ", "\"_", "%_", "feed", "Name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "atom_", "=_", "open_", "(_", "'../", "example", "s", "/", "%", "s", "'_", "%_", "feed", "Name_", ",_", "'", "w", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "doc_", "=_", "create", "Feed_", "(_", "example", "List_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "atom_", "._", "write_", "(_", "doc_", "._", "tox", "ml_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "atom_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "print_", "'", "complete", "'_", "\\u\\u\\uDEDENT\\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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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
cztomczak/cefpython/cefpython/cef3/windows/binaries_32bit/cefwindow.py
[ { "content": "# Copyright (c) 2012-2014 The CEF Python authors. All rights reserved.\n# License: New BSD License.\n# Website: http://code.google.com/p/cefpython/\n\nimport win32gui\nimport win32con\nimport win32api\nimport time\nimport math\nimport os\nimport sys\nimport re\n\nif sys.version_info.major == 2:\n from urllib import pathname2url as urllib_pathname2url\nelse:\n from urllib.request import pathname2url as urllib_pathname2url\n\ng_debug = False\ng_windows = {} # windowID(int): className\ng_registeredClasses = {}\n\n\n\n\n\n# Memory error when calling win32gui.DestroyWindow()\n# after we called cefpython.CloseBrowser()\n\n\n\n\n\n\n#noinspection PyUnusedLocal\n\n\n\n#noinspection PyUnusedLocal\n\n\nif __name__ == \"__main__\":\n\n g_debug = True\n hwnd = CreateWindow(\"Test window\", \"testwindow\", 800, 600)\n MessageLoop(\"testwindow\")", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def Debug(msg):\n\n if not g_debug:\n return\n msg = \"cefwindow: \"+str(msg)\n print(msg)\n with open(GetRealPath(\"debug.log\"), \"a\") as file:\n file.write(msg+\"\\n\")", "metadata": "root.Debug", "header": "['module', '___EOS___']", "index": 22 }, { "content": "def GetRealPath(file=None, encodeURL=False):\n\n # This function is defined in 2 files: cefpython.pyx and cefwindow.py, if you make changes edit both files.\n # If file is None return current directory, without trailing slash.\n\n # encodeURL param - will call urllib.pathname2url(), only when file is empty (current dir)\n # or is relative path (\"test.html\", \"some/test.html\"), we need to encode it before passing\n # to CreateBrowser(), otherwise it is encoded by CEF internally and becomes (chinese characters):\n # >> %EF%BF%97%EF%BF%80%EF%BF%83%EF%BF%A6\n # but should be:\n # >> %E6%A1%8C%E9%9D%A2\n\n if file is None: file = \"\"\n if file.find(\"/\") != 0 and file.find(\"\\\\\") != 0 and not re.search(r\"^[a-zA-Z]+:[/\\\\]?\", file):\n # Execute this block only when relative path (\"test.html\", \"some\\test.html\") or file is empty (current dir).\n # 1. find != 0 >> not starting with / or \\ (/ - linux absolute path, \\ - just to be sure)\n # 2. not re.search >> not (D:\\\\ or D:/ or D: or http:// or ftp:// or file://),\n # \"D:\" is also valid absolute path (\"D:cefpython\" in chrome becomes \"file:///D:/cefpython/\")\n if hasattr(sys, \"frozen\"): path = os.path.dirname(sys.executable)\n elif \"__file__\" in globals(): path = os.path.dirname(os.path.realpath(__file__))\n else: path = os.getcwd()\n path = path + os.sep + file\n path = re.sub(r\"[/\\\\]+\", re.escape(os.sep), path)\n path = re.sub(r\"[/\\\\]+$\", \"\", path) # directory without trailing slash.\n if encodeURL:\n return urllib_pathname2url(path)\n else:\n return path\n return file", "metadata": "root.GetRealPath", "header": "['module', '___EOS___']", "index": 31 }, { "content": "def CreateWindow(title, className, width, height, xpos=None, ypos=None, icon=None, windowProc=None):\n\n \"\"\"\n for key in g_windows:\n if g_windows[key] == className:\n raise Exception(\"There was already created a window with that className: %s.\"\n \"Each created window must have an unique className.\" % className)\n \"\"\"\n\n if not windowProc:\n windowProc = {win32con.WM_CLOSE: WM_CLOSE}\n\n bigIcon = \"\"\n smallIcon = \"\"\n\n if icon:\n icon = GetRealPath(icon)\n\n # Load small and big icon.\n # WNDCLASSEX (along with hIconSm) is not supported by pywin32,\n # we need to use WM_SETICON message after window creation.\n\n # http://stackoverflow.com/questions/2234988/how-to-set-hicon-on-a-window-ico-with-multiple-sizes\n # http://blog.barthe.ph/2009/07/17/wmseticon/\n\n bigX = win32api.GetSystemMetrics(win32con.SM_CXICON)\n bigY = win32api.GetSystemMetrics(win32con.SM_CYICON)\n bigIcon = win32gui.LoadImage(0, icon, win32con.IMAGE_ICON, bigX, bigY, win32con.LR_LOADFROMFILE)\n smallX = win32api.GetSystemMetrics(win32con.SM_CXSMICON)\n smallY = win32api.GetSystemMetrics(win32con.SM_CYSMICON)\n smallIcon = win32gui.LoadImage(0, icon, win32con.IMAGE_ICON, smallX, smallY, win32con.LR_LOADFROMFILE)\n\n wndclass = win32gui.WNDCLASS()\n wndclass.hInstance = win32api.GetModuleHandle(None)\n wndclass.lpszClassName = className\n wndclass.style = win32con.CS_VREDRAW | win32con.CS_HREDRAW\n # win32con.CS_GLOBALCLASS\n wndclass.hbrBackground = win32con.COLOR_WINDOW\n wndclass.hCursor = win32gui.LoadCursor(0, win32con.IDC_ARROW)\n wndclass.lpfnWndProc = windowProc\n\n #noinspection PyUnusedLocal\n global g_registeredClasses\n if not className in g_registeredClasses:\n g_registeredClasses[className] = True\n atomclass = win32gui.RegisterClass(wndclass)\n Debug(\"win32gui.RegisterClass(%s)\" % className)\n\n if xpos is None or ypos is None:\n # Center window on the screen.\n Debug(\"Centering window on the screen.\")\n screenx = win32api.GetSystemMetrics(win32con.SM_CXSCREEN)\n screeny = win32api.GetSystemMetrics(win32con.SM_CYSCREEN)\n xpos = int(math.floor((screenx - width) / 2))\n ypos = int(math.floor((screeny - height) / 2))\n if xpos < 0: xpos = 0\n if ypos < 0: ypos = 0\n\n windowID = win32gui.CreateWindow(className, title,\n win32con.WS_OVERLAPPEDWINDOW | win32con.WS_CLIPCHILDREN | win32con.WS_VISIBLE,\n xpos, ypos, width, height, # xpos, ypos, width, height\n 0, 0, wndclass.hInstance, None)\n g_windows[windowID] = className\n\n if icon:\n if bigIcon:\n win32api.SendMessage(windowID, win32con.WM_SETICON, win32con.ICON_BIG, bigIcon)\n if smallIcon:\n win32api.SendMessage(windowID, win32con.WM_SETICON, win32con.ICON_SMALL, smallIcon)\n\n Debug(\"windowID = %s\" % windowID)\n return windowID", "metadata": "root.CreateWindow", "header": "['module', '___EOS___']", "index": 61 }, { "content": "def DestroyWindow(windowID):\n\n win32gui.DestroyWindow(windowID)\n #className = GetWindowClassName(windowID)\n #win32gui.UnregisterClass(className, None)\n #del g_windows[windowID] # Let window with this className be created again.", "metadata": "root.DestroyWindow", "header": "['module', '___EOS___']", "index": 138 }, { "content": "def GetWindowClassName(windowID):\n\n for key in g_windows:\n if key == windowID:\n return g_windows[key]", "metadata": "root.GetWindowClassName", "header": "['module', '___EOS___']", "index": 146 }, { "content": "def MoveWindow(windowID, xpos=None, ypos=None, width=None, height=None, center=None):\n\n (left, top, right, bottom) = win32gui.GetWindowRect(windowID)\n if xpos is None and ypos is None:\n xpos = left\n ypos = top\n if width is None and height is None:\n width = right - left\n height = bottom - top\n # Case: only ypos provided\n if xpos is None and ypos is not None:\n xpos = left\n if ypos is None and xpos is not None:\n ypos = top\n # Case: only height provided\n if not width:\n width = right - left\n if not height:\n height = bottom - top\n if center:\n screenx = win32api.GetSystemMetrics(win32con.SM_CXSCREEN)\n screeny = win32api.GetSystemMetrics(win32con.SM_CYSCREEN)\n xpos = int(math.floor((screenx - width) / 2))\n ypos = int(math.floor((screeny - height) / 2))\n if xpos < 0: xpos = 0\n if ypos < 0: ypos = 0\n win32gui.MoveWindow(windowID, xpos, ypos, width, height, 1)", "metadata": "root.MoveWindow", "header": "['module', '___EOS___']", "index": 152 }, { "content": "def WM_CLOSE(windowID, msg, wparam, lparam):\n\n DestroyWindow(windowID)\n win32gui.PostQuitMessage(0)", "metadata": "root.WM_CLOSE", "header": "['module', '___EOS___']", "index": 182 }, { "content": "def GetLastError():\n\n code = win32api.GetLastError()\n return \"(%d) %s\" % (code, win32api.FormatMessage(code))", "metadata": "root.GetLastError", "header": "['module', '___EOS___']", "index": 188 }, { "content": "def MessageLoop(className):\n\n while not win32gui.PumpWaitingMessages():\n time.sleep(0.001)", "metadata": "root.MessageLoop", "header": "['module', '___EOS___']", "index": 194 } ]
[]
[]
0
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "Copy", "right", " ", "(", "c", ")", " ", "2012", "-", "2014", " ", "The", " ", "CE", "F", " ", "Pyth", "on", " ", "author", "s", ".", " ", "All", " ", "rights", " ", "reserve", "d", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "License", ":", " ", "New", " ", "BS", "D", " ", "License", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Webs", "ite", ":", " ", "http", "://", "code", ".", "google", ".", "com", "/", "p", "/", "cef", "python", "/_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "win32", "gui_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "win32con_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "win32", "api_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "time_", "\\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_", "import_", "re_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "sys_", "._", "version", "\\u", "info_", "._", "major_", "==_", "2_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "urllib_", "import_", "path", "name2", "url_", "as_", "url", "lib", "\\u", "path", "name2", "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 ", " _", "from_", "urllib_", "._", "request_", "import_", "path", "name2", "url_", "as_", "url", "lib", "\\u", "path", "name2", "url_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "g", "\\u", "debug_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "g", "\\u", "windows_", "=_", "{_", "}_", "#", " ", "window", "ID", "(", "int", "):", " ", "class", "Name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "g", "\\u", "register", "ed", "Classes_", "=_", "{_", "}_", "\\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_", "#", " ", "Memo", "ry", " ", "error", " ", "whe", "n", " ", "calling", " ", "win32", "gui", ".", "Destr", "oy", "Window", "()", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "after", " ", "we", " ", "call", "ed", " ", "cef", "python", ".", "Clos", "e", "Brows", "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\\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_", "#", "noin", "spect", "ion", " ", "Py", "Un", "used", "Local_", "\\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_", "#", "noin", "spect", "ion", " ", "Py", "Un", "used", "Local_", "\\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 ", " _", "g", "\\u", "debug_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "hwnd", "_", "=_", "Creat", "e", "Window_", "(_", "\"", "Test", " ", "window", "\"_", ",_", "\"", "test", "window", "\"_", ",_", "800_", ",_", "600_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Messag", "e", "Loop_", "(_", "\"", "test", "window", "\"_", ")_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "Debug_", "(_", "msg_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "g", "\\u", "debug_", ":_", "\\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_", "msg_", "=_", "\"", "cef", "window", ":", " ", "\"_", "+_", "str_", "(_", "msg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "msg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "open_", "(_", "Get", "Real", "Path_", "(_", "\"", "debug", ".", "log", "\"_", ")_", ",_", "\"", "a", "\"_", ")_", "as_", "file_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "file_", "._", "write_", "(_", "msg_", "+_", "\"\\\\", "n", "\"_", ")_", "\\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", "Real", "Path_", "(_", "file_", "=_", "None_", ",_", "encode", "URL_", "=_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Thi", "s", " ", "function", " ", "is", " ", "defin", "ed", " ", "in", " ", "2", " ", "files", ":", " ", "cef", "python", ".", "pyx", " ", "and", " ", "cef", "window", ".", "py", ",", " ", "if", " ", "you", " ", "make", " ", "change", "s", " ", "edit", " ", "bot", "h", " ", "files", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "file", " ", "is", " ", "Non", "e", " ", "return", " ", "current", " ", "director", "y", ",", " ", "with", "out", " ", "trail", "ing", " ", "slash", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "encode", "URL", " ", "param", " ", "-", " ", "will", " ", "call", " ", "url", "lib", ".", "path", "name2", "url", "()", ",", " ", "only", " ", "whe", "n", " ", "file", " ", "is", " ", "empty", " ", "(", "current", " ", "dir", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "or", " ", "is", " ", "relative", " ", "path", " ", "(\"", "test", ".", "html", "\",", " ", "\"", "some", "/", "test", ".", "html", "\")", ",", " ", "we", " ", "need", " ", "to", " ", "encode", " ", "it", " ", "bef", "ore", " ", "passi", "ng_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "to", " ", "Creat", "e", "Brows", "er", "()", ",", " ", "other", "wis", "e", " ", "it", " ", "is", " ", "encode", "d", " ", "by", " ", "CE", "F", " ", "internal", "ly", " ", "and", " ", "bec", "ome", "s", " ", "(", "chinese", " ", "character", "s", "):", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", ">>", " ", "%", "EF", "%", "BF", "%", "9", "7", "%", "EF", "%", "BF", "%", "80", "%", "EF", "%", "BF", "%", "8", "3", "%", "EF", "%", "BF", "%", "A6", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "but", " ", "shou", "ld", " ", "be", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", ">>", " ", "%", "E6", "%", "A1", "%", "8", "C", "%", "E", "9", "%", "9", "D", "%", "A2_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "file_", "is_", "None_", ":_", "file_", "=_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "file_", "._", "find_", "(_", "\"/\"_", ")_", "!=_", "0_", "and_", "file_", "._", "find_", "(_", "\"\\\\\\\\\"_", ")_", "!=_", "0_", "and_", "not_", "re_", "._", "search_", "(_", "r", "\"", "^", "[", "a", "-", "z", "A", "-", "Z", "]+", ":[", "/\\\\\\\\", "]?", "\"_", ",_", "file_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Execut", "e", " ", "this", " ", "block", " ", "only", " ", "whe", "n", " ", "relative", " ", "path", " ", "(\"", "test", ".", "html", "\",", " ", "\"", "some", "\\\\", "test", ".", "html", "\")", " ", "or", " ", "file", " ", "is", " ", "empty", " ", "(", "current", " ", "dir", ").", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "1", ".", " ", "find", " ", "!=", " ", "0", " ", ">>", " ", "not", " ", "startin", "g", " ", "with", " ", "/", " ", "or", " ", "\\\\", " ", "(/", " ", "-", " ", "linux", " ", "abs", "olute", " ", "path", ",", " ", "\\\\", " ", "-", " ", "just", " ", "to", " ", "be", " ", "sure", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "2", ".", " ", "not", " ", "re", ".", "search", " ", ">>", " ", "not", " ", "(", "D", ":\\\\", "\\\\", " ", "or", " ", "D", ":/", " ", "or", " ", "D", ":", " ", "or", " ", "http", "://", " ", "or", " ", "ftp", "://", " ", "or", " ", "file", "://", "),", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "\"", "D", ":\"", " ", "is", " ", "als", "o", " ", "valid", " ", "abs", "olute", " ", "path", " ", "(\"", "D", ":", "cef", "python", "\"", " ", "in", " ", "chrome", " ", "bec", "ome", "s", " ", "\"", "file", ":///", "D", ":/", "cef", "python", "/\"", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "hasattr_", "(_", "sys_", ",_", "\"", "frozen", "\"_", ")_", ":_", "path_", "=_", "os_", "._", "path_", "._", "dirname_", "(_", "sys_", "._", "executable_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "elif_", "\"\\u\\u", "file", "\\u\\u\"_", "in_", "globals_", "(_", ")_", ":_", "path_", "=_", "os_", "._", "path_", "._", "dirname_", "(_", "os_", "._", "path_", "._", "realpath_", "(_", "\\u\\u", "file\\u\\u_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "else_", ":_", "path_", "=_", "os_", "._", "getcwd_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "path_", "=_", "path_", "+_", "os_", "._", "sep_", "+_", "file_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "path_", "=_", "re_", "._", "sub_", "(_", "r", "\"[", "/\\\\\\\\", "]+\"", "_", ",_", "re_", "._", "escape_", "(_", "os_", "._", "sep_", ")_", ",_", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "path_", "=_", "re_", "._", "sub_", "(_", "r", "\"[", "/\\\\\\\\", "]+$", "\"_", ",_", "\"\"_", ",_", "path_", ")_", "#", " ", "director", "y", " ", "with", "out", " ", "trail", "ing", " ", "slash", "._", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "encode", "URL_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "url", "lib", "\\u", "path", "name2", "url_", "(_", "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_", "path_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "file_", "\\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_", "Creat", "e", "Window_", "(_", "title_", ",_", "class", "Name_", ",_", "width_", ",_", "height_", ",_", "xpos_", "=_", "None_", ",_", "ypos_", "=_", "None_", ",_", "icon_", "=_", "None_", ",_", "window", "Proc_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "for", " ", "key", " ", "in", " ", "g", "\\u", "windows", ":", "\\", "10", ";", " ", " ", " ", " ", "if", " ", "g", "\\u", "windows", "[", "key", "]", " ", "==", " ", "class", "Name", ":", "\\", "10", ";", " ", " ", " ", " ", "raise", " ", "Except", "ion", "(\"", "There", " ", "was", " ", "alr", "ead", "y", " ", "created", " ", "a", " ", "window", " ", "with", " ", "tha", "t", " ", "class", "Name", ":", " ", "%", "s", ".\"", "\\", "10", ";", " ", " ", " ", " ", "\"", "Ea", "ch", " ", "created", " ", "window", " ", "must", " ", "have", " ", "an", " ", "unique", " ", "class", "Name", ".\"", " ", "%", " ", "class", "Name", ")", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "window", "Proc_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "window", "Proc_", "=_", "{_", "win32con_", "._", "WM", "\\u", "CLOSE_", ":_", "WM", "\\u", "CLOSE_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "big", "Icon_", "=_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "small", "Icon_", "=_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "icon_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "icon_", "=_", "Get", "Real", "Path_", "(_", "icon_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Load", " ", "small", " ", "and", " ", "big", " ", "icon", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "WN", "DC", "LAS", "SE", "X", " ", "(", "along", " ", "with", " ", "h", "Ico", "n", "Sm", ")", " ", "is", " ", "not", " ", "support", "ed", " ", "by", " ", "pywi", "n", "32", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "we", " ", "need", " ", "to", " ", "use", " ", "WM", "\\u", "SET", "ICON", " ", "message", " ", "after", " ", "window", " ", "creati", "on", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "http", "://", "stack", "overflow", ".", "com", "/", "question", "s", "/", "223", "498", "8", "/", "how", "-", "to", "-", "set", "-", "hic", "on", "-", "on", "-", "a", "-", "window", "-", "ico", "-", "with", "-", "multiple", "-", "sizes_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "http", "://", "blog", ".", "bart", "he", ".", "ph", "/", "200", "9", "/", "0", "7", "/", "1", "7", "/", "wms", "etic", "on", "/_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "big", "X_", "=_", "win32", "api_", "._", "Get", "System", "Metrics_", "(_", "win32con_", "._", "SM", "\\u", "CX", "ICON_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "big", "Y_", "=_", "win32", "api_", "._", "Get", "System", "Metrics_", "(_", "win32con_", "._", "SM", "\\u", "CY", "ICON_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "big", "Icon_", "=_", "win32", "gui_", "._", "Load", "Image_", "(_", "0_", ",_", "icon_", ",_", "win32con_", "._", "IMA", "GE", "\\u", "ICON_", ",_", "big", "X_", ",_", "big", "Y_", ",_", "win32con_", "._", "LR", "\\u", "LOAD", "FROM", "FILE_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "small", "X_", "=_", "win32", "api_", "._", "Get", "System", "Metrics_", "(_", "win32con_", "._", "SM", "\\u", "CX", "SMI", "CON", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "small", "Y_", "=_", "win32", "api_", "._", "Get", "System", "Metrics_", "(_", "win32con_", "._", "SM", "\\u", "CY", "SMI", "CON", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "small", "Icon_", "=_", "win32", "gui_", "._", "Load", "Image_", "(_", "0_", ",_", "icon_", ",_", "win32con_", "._", "IMA", "GE", "\\u", "ICON_", ",_", "small", "X_", ",_", "small", "Y_", ",_", "win32con_", "._", "LR", "\\u", "LOAD", "FROM", "FILE_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "wnd", "class_", "=_", "win32", "gui_", "._", "WN", "DC", "LAS", "S_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "wnd", "class_", "._", "h", "Instance_", "=_", "win32", "api_", "._", "Get", "Modul", "e", "Handle_", "(_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "wnd", "class_", "._", "lp", "sz", "Class", "Name_", "=_", "class", "Name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "wnd", "class_", "._", "style_", "=_", "win32con_", "._", "CS", "\\u", "VR", "ED", "RAW_", "|_", "win32con_", "._", "CS", "\\u", "HRE", "DRAW", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "win32", "con", ".", "CS", "\\u", "GLOB", "ALC", "LAS", "S_", "\\u\\u\\uNL\\u\\u\\u_", "wnd", "class_", "._", "hb", "r", "Background_", "=_", "win32con_", "._", "COLOR", "\\u", "WINDOW_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "wnd", "class_", "._", "h", "Cursor_", "=_", "win32", "gui_", "._", "Load", "Cursor_", "(_", "0_", ",_", "win32con_", "._", "ID", "C", "\\u", "ARROW", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "wnd", "class_", "._", "lp", "fn", "Wn", "d", "Proc_", "=_", "window", "Proc_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "noin", "spect", "ion", " ", "Py", "Un", "used", "Local_", "\\u\\u\\uNL\\u\\u\\u_", "global_", "g", "\\u", "register", "ed", "Classes_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "class", "Name_", "in_", "g", "\\u", "register", "ed", "Classes_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "g", "\\u", "register", "ed", "Classes_", "[_", "class", "Name_", "]_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "atom", "class_", "=_", "win32", "gui_", "._", "Register", "Class_", "(_", "wnd", "class_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Debug_", "(_", "\"", "win32", "gui", ".", "Register", "Class", "(%", "s", ")\"_", "%_", "class", "Name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "xpos_", "is_", "None_", "or_", "ypos_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Center", " ", "window", " ", "on", " ", "the", " ", "screen", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Debug_", "(_", "\"", "Center", "ing", " ", "window", " ", "on", " ", "the", " ", "screen", ".\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "screen", "x_", "=_", "win32", "api_", "._", "Get", "System", "Metrics_", "(_", "win32con_", "._", "SM", "\\u", "CX", "SCREEN", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "screen", "y_", "=_", "win32", "api_", "._", "Get", "System", "Metrics_", "(_", "win32con_", "._", "SM", "\\u", "CY", "SCREEN", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xpos_", "=_", "int_", "(_", "math_", "._", "floor_", "(_", "(_", "screen", "x_", "-_", "width_", ")_", "/_", "2_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ypos_", "=_", "int_", "(_", "math_", "._", "floor_", "(_", "(_", "screen", "y_", "-_", "height_", ")_", "/_", "2_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "xpos_", "<_", "0_", ":_", "xpos_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "ypos_", "<_", "0_", ":_", "ypos_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "window", "ID_", "=_", "win32", "gui_", "._", "Creat", "e", "Window_", "(_", "class", "Name_", ",_", "title_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "win32con_", "._", "WS", "\\u", "OVERLA", "PPE", "DW", "IND", "OW", "_", "|_", "win32con_", "._", "WS", "\\u", "CLIP", "CHILD", "REN", "_", "|_", "win32con_", "._", "WS", "\\u", "VISI", "BLE_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "xpos_", ",_", "ypos_", ",_", "width_", ",_", "height_", ",_", "#", " ", "xpo", "s", ",", " ", "ypo", "s", ",", " ", "widt", "h", ",", " ", "height_", "\\u\\u\\uNL\\u\\u\\u_", "0_", ",_", "0_", ",_", "wnd", "class_", "._", "h", "Instance_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "g", "\\u", "windows_", "[_", "window", "ID_", "]_", "=_", "class", "Name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "icon_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "big", "Icon_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "win32", "api_", "._", "Sen", "d", "Message_", "(_", "window", "ID_", ",_", "win32con_", "._", "WM", "\\u", "SET", "ICON_", ",_", "win32con_", "._", "ICON", "\\u", "BIG", "_", ",_", "big", "Icon_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "small", "Icon_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "win32", "api_", "._", "Sen", "d", "Message_", "(_", "window", "ID_", ",_", "win32con_", "._", "WM", "\\u", "SET", "ICON_", ",_", "win32con_", "._", "ICON", "\\u", "SMALL", "_", ",_", "small", "Icon_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "Debug_", "(_", "\"", "window", "ID", " ", "=", " ", "%", "s", "\"_", "%_", "window", "ID_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "window", "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_", "def_", "Destr", "oy", "Window_", "(_", "window", "ID_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "win32", "gui_", "._", "Destr", "oy", "Window_", "(_", "window", "ID_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "class", "Name", " ", "=", " ", "Get", "Window", "Class", "Name", "(", "window", "ID", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", "win32", "gui", ".", "Unregister", "Class", "(", "class", "Name", ",", " ", "Non", "e", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", "del", " ", "g", "\\u", "windows", "[", "window", "ID", "]", " ", "#", " ", "Let", " ", "window", " ", "with", " ", "this", " ", "class", "Name", " ", "be", " ", "created", " ", "again", "._", "\\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_", "def_", "Get", "Window", "Class", "Name_", "(_", "window", "ID_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "key_", "in_", "g", "\\u", "windows_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "key_", "==_", "window", "ID_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "g", "\\u", "windows_", "[_", "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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Move", "Window_", "(_", "window", "ID_", ",_", "xpos_", "=_", "None_", ",_", "ypos_", "=_", "None_", ",_", "width_", "=_", "None_", ",_", "height_", "=_", "None_", ",_", "center_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "(_", "left_", ",_", "top_", ",_", "right_", ",_", "bottom_", ")_", "=_", "win32", "gui_", "._", "Get", "Window", "Rect_", "(_", "window", "ID_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "xpos_", "is_", "None_", "and_", "ypos_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "xpos_", "=_", "left_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ypos_", "=_", "top_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "width_", "is_", "None_", "and_", "height_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "width_", "=_", "right_", "-_", "left_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "height_", "=_", "bottom_", "-_", "top_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Case", ":", " ", "only", " ", "ypo", "s", " ", "provided", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "xpos_", "is_", "None_", "and_", "ypos_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "xpos_", "=_", "left_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "ypos_", "is_", "None_", "and_", "xpos_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ypos_", "=_", "top_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Case", ":", " ", "only", " ", "height", " ", "provided", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "width_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "width_", "=_", "right_", "-_", "left_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "height_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "height_", "=_", "bottom_", "-_", "top_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "center_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "screen", "x_", "=_", "win32", "api_", "._", "Get", "System", "Metrics_", "(_", "win32con_", "._", "SM", "\\u", "CX", "SCREEN", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "screen", "y_", "=_", "win32", "api_", "._", "Get", "System", "Metrics_", "(_", "win32con_", "._", "SM", "\\u", "CY", "SCREEN", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xpos_", "=_", "int_", "(_", "math_", "._", "floor_", "(_", "(_", "screen", "x_", "-_", "width_", ")_", "/_", "2_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ypos_", "=_", "int_", "(_", "math_", "._", "floor_", "(_", "(_", "screen", "y_", "-_", "height_", ")_", "/_", "2_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "xpos_", "<_", "0_", ":_", "xpos_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "ypos_", "<_", "0_", ":_", "ypos_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "win32", "gui_", "._", "Move", "Window_", "(_", "window", "ID_", ",_", "xpos_", ",_", "ypos_", ",_", "width_", ",_", "height_", ",_", "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_", "WM", "\\u", "CLOSE_", "(_", "window", "ID_", ",_", "msg_", ",_", "wpa", "ram_", ",_", "lpar", "am_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Destr", "oy", "Window_", "(_", "window", "ID_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "win32", "gui_", "._", "Post", "Qui", "t", "Message_", "(_", "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_", "Get", "Las", "t", "Error_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "code_", "=_", "win32", "api_", "._", "Get", "Las", "t", "Error_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\"(", "%", "d", ")", " ", "%", "s", "\"_", "%_", "(_", "code_", ",_", "win32", "api_", "._", "Format", "Message_", "(_", "code_", ")_", ")_", "\\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_", "Messag", "e", "Loop_", "(_", "class", "Name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "while_", "not_", "win32", "gui_", "._", "Pump", "Wait", "ing", "Messages_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "time_", "._", "sleep_", "(_", "0.001_", ")_", "\\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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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, 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, 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, 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 ]
Unused import
apache/libcloud/docs/examples/compute/indosat/instantiate_driver.py
[ { "content": "from pprint import pprint\n\nfrom libcloud.compute.types import Provider\nfrom libcloud.compute.providers import get_driver\n\ncls = get_driver(Provider.INDOSAT)\ndriver = cls('my username', 'my password', region='indosat-id')\n\npprint(driver.list_nodes())\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[]
[]
0
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "from_", "pprint_", "import_", "pprint_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "libc", "loud", "_", "._", "compute_", "._", "types_", "import_", "Provider_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "libc", "loud", "_", "._", "compute_", "._", "providers_", "import_", "get", "\\u", "driver_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "cls_", "=_", "get", "\\u", "driver_", "(_", "Provider_", "._", "IND", "OS", "AT_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "driver_", "=_", "cls_", "(_", "'", "my", " ", "user", "name", "'_", ",_", "'", "my", " ", "password", "'_", ",_", "region_", "=_", "'", "indo", "sat", "-", "id", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "pprint_", "(_", "driver_", "._", "list", "\\u", "nodes_", "(_", ")_", ")_" ]
[ 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 ]
Redundant assignment
BU-NU-CLOUD-SP16/Trusted-Platform-Module-nova/nova/tests/unit/network/test_network_info.py
[ { "content": " def _setup_injected_network_scenario(self, should_inject=True,\n use_ipv4=True, use_ipv6=False,\n gateway=True, dns=True,\n two_interfaces=False,\n libvirt_virt_type=None):\n \"\"\"Check that netutils properly decides whether to inject based on\n whether the supplied subnet is static or dynamic.\n \"\"\"\n network = fake_network_cache_model.new_network({'subnets': []})\n\n subnet_dict = {}\n if not gateway:\n subnet_dict['gateway'] = None\n\n if not dns:\n subnet_dict['dns'] = None\n\n if not should_inject:\n subnet_dict['dhcp_server'] = '10.10.0.1'\n\n if use_ipv4:\n network.add_subnet(\n fake_network_cache_model.new_subnet(subnet_dict))\n\n if should_inject and use_ipv6:\n gateway_ip = fake_network_cache_model.new_ip(dict(\n address='1234:567::1'))\n ip = fake_network_cache_model.new_ip(dict(\n address='1234:567::2'))\n ipv6_subnet_dict = dict(\n cidr='1234:567::/48',\n gateway=gateway_ip,\n dns=[fake_network_cache_model.new_ip(\n dict(address='2001:4860:4860::8888')),\n fake_network_cache_model.new_ip(\n dict(address='2001:4860:4860::8844'))],\n ips=[ip])\n if not gateway:\n ipv6_subnet_dict['gateway'] = None\n network.add_subnet(fake_network_cache_model.new_subnet(\n ipv6_subnet_dict))\n\n # Behave as though CONF.flat_injected is True\n network['meta']['injected'] = True\n vif = fake_network_cache_model.new_vif({'network': network})\n vifs = [vif]\n if two_interfaces:\n vifs.append(vif)\n\n nwinfo = model.NetworkInfo(vifs)\n return netutils.get_injected_network_template(\n nwinfo, use_ipv6=use_ipv6, libvirt_virt_type=libvirt_virt_type)", "metadata": "root.NetworkInfoTests._setup_injected_network_scenario", "header": "['class', 'NetworkInfoTests', '(', 'test', '.', 'NoDBTestCase', ')', ':', '___EOS___']", "index": 524 } ]
[]
[]
0
true
[ "[CLS]_", "Redu", "ndan", "t_", "assignment_", "[SEP]_", "class_", "Network", "Info", "Tests_", "(_", "test_", "._", "No", "DB", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "setup", "\\u", "injected", "\\u", "network", "\\u", "scenario_", "(_", "self_", ",_", "shou", "ld", "\\u", "inject_", "=_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "use", "\\u", "ipv4_", "=_", "True_", ",_", "use", "\\u", "ipv6_", "=_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "gateway_", "=_", "True_", ",_", "dns_", "=_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "two", "\\u", "interfaces_", "=_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "libvi", "rt", "\\u", "virt", "\\u", "type_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Check", " ", "tha", "t", " ", "net", "util", "s", " ", "proper", "ly", " ", "decide", "s", " ", "whe", "ther", " ", "to", " ", "inject", " ", "based", " ", "on", "\\", "10", ";", " ", " ", " ", "whe", "ther", " ", "the", " ", "supplie", "d", " ", "subnet", " ", "is", " ", "static", " ", "or", " ", "dynami", "c", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "network_", "=_", "fake", "\\u", "network", "\\u", "cache", "\\u", "model_", "._", "new", "\\u", "network_", "(_", "{_", "'", "subnet", "s", "'_", ":_", "[_", "]_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "subnet", "\\u", "dict_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "gateway_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "subnet", "\\u", "dict_", "[_", "'", "gateway", "'_", "]_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "dns_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "subnet", "\\u", "dict_", "[_", "'", "dns", "'_", "]_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "shou", "ld", "\\u", "inject_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "subnet", "\\u", "dict_", "[_", "'", "dhcp", "\\u", "server", "'_", "]_", "=_", "'", "10.1", "0.", "0.", "1", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "use", "\\u", "ipv4_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "network_", "._", "add", "\\u", "subnet_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "fake", "\\u", "network", "\\u", "cache", "\\u", "model_", "._", "new", "\\u", "subnet_", "(_", "subnet", "\\u", "dict_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "shou", "ld", "\\u", "inject_", "and_", "use", "\\u", "ipv6_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "gateway", "\\u", "ip_", "=_", "fake", "\\u", "network", "\\u", "cache", "\\u", "model_", "._", "new", "\\u", "ip_", "(_", "dict_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "address_", "=_", "'", "1234", ":", "567", "::", "1", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ip_", "=_", "fake", "\\u", "network", "\\u", "cache", "\\u", "model_", "._", "new", "\\u", "ip_", "(_", "dict_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "address_", "=_", "'", "1234", ":", "567", "::", "2", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ipv", "6", "\\u", "subnet", "\\u", "dict_", "=_", "dict_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "cidr_", "=_", "'", "1234", ":", "567", "::", "/", "4", "8", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "gateway_", "=_", "gateway", "\\u", "ip_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "dns_", "=_", "[_", "fake", "\\u", "network", "\\u", "cache", "\\u", "model_", "._", "new", "\\u", "ip_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "dict_", "(_", "address_", "=_", "'", "200", "1", ":", "486", "0", ":", "486", "0", "::", "8888", "'_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "fake", "\\u", "network", "\\u", "cache", "\\u", "model_", "._", "new", "\\u", "ip_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "dict_", "(_", "address_", "=_", "'", "200", "1", ":", "486", "0", ":", "486", "0", "::", "884", "4", "'_", ")_", ")_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "ips_", "=_", "[_", "ip_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "gateway_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ipv", "6", "\\u", "subnet", "\\u", "dict_", "[_", "'", "gateway", "'_", "]_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "network_", "._", "add", "\\u", "subnet_", "(_", "fake", "\\u", "network", "\\u", "cache", "\\u", "model_", "._", "new", "\\u", "subnet_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "ipv", "6", "\\u", "subnet", "\\u", "dict_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Be", "have", " ", "as", " ", "tho", "ugh", " ", "CONF", ".", "flat", "\\u", "injected", " ", "is", " ", "True_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "network_", "[_", "'", "meta", "'_", "]_", "[_", "'", "injected", "'_", "]_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "vif_", "=_", "fake", "\\u", "network", "\\u", "cache", "\\u", "model_", "._", "new", "\\u", "vif_", "(_", "{_", "'", "network", "'_", ":_", "network_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "vi", "fs_", "=_", "[_", "vif_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "two", "\\u", "interfaces_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "vi", "fs_", "._", "append_", "(_", "vif_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "nwi", "nfo_", "=_", "model_", "._", "Network", "Info_", "(_", "vi", "fs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "net", "utils_", "._", "get", "\\u", "injected", "\\u", "network", "\\u", "template_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "nwi", "nfo_", ",_", "use", "\\u", "ipv6_", "=_", "use", "\\u", "ipv6_", ",_", "libvi", "rt", "\\u", "virt", "\\u", "type_", "=_", "libvi", "rt", "\\u", "virt", "\\u", "type_", ")_", "\\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,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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 ]
Unnecessary 'else' clause in loop
openstack/swift/test/probe/test_reconstructor_rebuild.py
[ { "content": " def test_rebuild_partner_down(self):\n # create EC container\n headers = {'X-Storage-Policy': self.policy.name}\n client.put_container(self.url, self.token, self.container_name,\n headers=headers)\n\n # PUT object\n contents = Body()\n client.put_object(self.url, self.token,\n self.container_name,\n self.object_name,\n contents=contents)\n\n opart, onodes = self.object_ring.get_nodes(\n self.account, self.container_name, self.object_name)\n\n # find a primary server that only has one of it's devices in the\n # primary node list\n group_nodes_by_config = defaultdict(list)\n for n in onodes:\n group_nodes_by_config[self.config_number(n)].append(n)\n for config_number, node_list in group_nodes_by_config.items():\n if len(node_list) == 1:\n break\n else:\n self.fail('ring balancing did not use all available nodes')\n primary_node = node_list[0]\n\n # pick one it's partners to fail randomly\n partner_node = random.choice(_get_partners(\n primary_node['index'], onodes))\n\n # 507 the partner device\n device_path = self.device_dir('object', partner_node)\n self.kill_drive(device_path)\n\n # select another primary sync_to node to fail\n failed_primary = [n for n in onodes if n['id'] not in\n (primary_node['id'], partner_node['id'])][0]\n # ... capture it's fragment etag\n failed_primary_etag = self.direct_get(failed_primary, opart)\n # ... and delete it\n part_dir = self.storage_dir('object', failed_primary, part=opart)\n shutil.rmtree(part_dir, True)\n\n # reconstruct from the primary, while one of it's partners is 507'd\n self.reconstructor.once(number=self.config_number(primary_node))\n\n # the other failed primary will get it's fragment rebuilt instead\n self.assertEqual(failed_primary_etag,\n self.direct_get(failed_primary, opart))\n\n # just to be nice\n self.revive_drive(device_path)", "metadata": "root.TestReconstructorRebuild.test_rebuild_partner_down", "header": "['class', 'TestReconstructorRebuild', '(', 'ECProbeTest', ')', ':', '___EOS___']", "index": 169 } ]
[]
[]
0
true
[ "[CLS]_", "Un", "necessar", "y_", "'", "else", "'_", "clause_", "in_", "loop_", "[SEP]_", "class_", "Test", "Recon", "struct", "or", "Reb", "uild", "_", "(_", "EC", "Probe", "Test_", ")_", ":_", "\\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_", "def_", "test\\u", "rebu", "ild", "\\u", "part", "ner", "\\u", "down_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "create", " ", "EC", " ", "container_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "headers_", "=_", "{_", "'", "X", "-", "Stor", "age", "-", "Polic", "y", "'_", ":_", "self_", "._", "policy_", "._", "name_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "client_", "._", "put", "\\u", "container_", "(_", "self_", "._", "url_", ",_", "self_", "._", "token_", ",_", "self_", "._", "container", "\\u", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "headers_", "=_", "headers_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "PU", "T", " ", "object_", "\\u\\u\\uNL\\u\\u\\u_", "contents_", "=_", "Body_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "client_", "._", "put", "\\u", "object_", "(_", "self_", "._", "url_", ",_", "self_", "._", "token_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "container", "\\u", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "object\\u", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "contents_", "=_", "contents_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "opa", "rt_", ",_", "ono", "des_", "=_", "self_", "._", "object\\u", "ring_", "._", "get", "\\u", "nodes_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "account_", ",_", "self_", "._", "container", "\\u", "name_", ",_", "self_", "._", "object\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "find", " ", "a", " ", "primary", " ", "server", " ", "tha", "t", " ", "only", " ", "has", " ", "one", " ", "of", " ", "it", "'", "s", " ", "device", "s", " ", "in", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "primary", " ", "node", " ", "list_", "\\u\\u\\uNL\\u\\u\\u_", "group", "\\u", "nodes", "\\u", "by", "\\u", "config_", "=_", "defaultdict_", "(_", "list_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "n_", "in_", "ono", "des_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "group", "\\u", "nodes", "\\u", "by", "\\u", "config_", "[_", "self_", "._", "config", "\\u", "number_", "(_", "n_", ")_", "]_", "._", "append_", "(_", "n_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "config", "\\u", "number_", ",_", "node", "\\u", "list_", "in_", "group", "\\u", "nodes", "\\u", "by", "\\u", "config_", "._", "items_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "len_", "(_", "node", "\\u", "list_", ")_", "==_", "1_", ":_", "\\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_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "fail_", "(_", "'", "ring", " ", "balancing", " ", "did", " ", "not", " ", "use", " ", "all", " ", "avail", "able", " ", "nodes", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "primary", "\\u", "node_", "=_", "node", "\\u", "list_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "pick", " ", "one", " ", "it", "'", "s", " ", "partners", " ", "to", " ", "fail", " ", "random", "ly_", "\\u\\u\\uNL\\u\\u\\u_", "part", "ner", "\\u", "node_", "=_", "random_", "._", "choice_", "(_", "\\u", "get", "\\u", "partners", "_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "primary", "\\u", "node_", "[_", "'", "index", "'_", "]_", ",_", "ono", "des_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "507", " ", "the", " ", "part", "ner", " ", "device_", "\\u\\u\\uNL\\u\\u\\u_", "device", "\\u", "path_", "=_", "self_", "._", "device", "\\u", "dir_", "(_", "'", "object", "'_", ",_", "part", "ner", "\\u", "node_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "kill", "\\u", "drive_", "(_", "device", "\\u", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "select", " ", "anot", "her", " ", "primary", " ", "sync", "\\u", "to", " ", "node", " ", "to", " ", "fail_", "\\u\\u\\uNL\\u\\u\\u_", "fail", "ed", "\\u", "primary_", "=_", "[_", "n_", "for_", "n_", "in_", "ono", "des_", "if_", "n_", "[_", "'", "id", "'_", "]_", "not_", "in_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "primary", "\\u", "node_", "[_", "'", "id", "'_", "]_", ",_", "part", "ner", "\\u", "node_", "[_", "'", "id", "'_", "]_", ")_", "]_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "...", " ", "captur", "e", " ", "it", "'", "s", " ", "fragment", " ", "etag_", "\\u\\u\\uNL\\u\\u\\u_", "fail", "ed", "\\u", "primary", "\\u", "etag_", "=_", "self_", "._", "direct", "\\u", "get_", "(_", "fail", "ed", "\\u", "primary_", ",_", "opa", "rt_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "...", " ", "and", " ", "delete", " ", "it_", "\\u\\u\\uNL\\u\\u\\u_", "part", "\\u", "dir_", "=_", "self_", "._", "storage", "\\u", "dir_", "(_", "'", "object", "'_", ",_", "fail", "ed", "\\u", "primary_", ",_", "part_", "=_", "opa", "rt_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "shutil_", "._", "rmtree_", "(_", "part", "\\u", "dir_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "reconstruct", " ", "from", " ", "the", " ", "primary", ",", " ", "whi", "le", " ", "one", " ", "of", " ", "it", "'", "s", " ", "partners", " ", "is", " ", "507", "'", "d_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "reconstruct", "or_", "._", "once_", "(_", "number_", "=_", "self_", "._", "config", "\\u", "number_", "(_", "primary", "\\u", "node_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "the", " ", "other", " ", "fail", "ed", " ", "primary", " ", "will", " ", "get", " ", "it", "'", "s", " ", "fragment", " ", "rebu", "ilt", " ", "inst", "ead_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "fail", "ed", "\\u", "primary", "\\u", "etag_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "direct", "\\u", "get_", "(_", "fail", "ed", "\\u", "primary_", ",_", "opa", "rt_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "just", " ", "to", " ", "be", " ", "nice_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "revi", "ve", "\\u", "drive_", "(_", "device", "\\u", "path_", ")_", "\\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,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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 ]
Unused import
BradWhittington/django-mailgun/test_django_mailgun.py
[ { "content": "from django.core.exceptions import ImproperlyConfigured\nfrom django.conf import settings\nfrom django.core.mail import EmailMessage\n\nfrom django_mailgun import MailgunBackend\nfrom pytest import raises\n\n\n\n\n\n\n\n\n\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def test_no_configuration():\n\n with raises(ImproperlyConfigured):\n MailgunBackend()", "metadata": "root.test_no_configuration", "header": "['module', '___EOS___']", "index": 8 }, { "content": "def test_configuration():\n settings.configure(\n MAILGUN_ACCESS_KEY=123,\n MAILGUN_SERVER_NAME='abc'\n )\n MailgunBackend()", "metadata": "root.test_configuration", "header": "['module', '___EOS___']", "index": 14 }, { "content": "def test_marker_methods():\n # Already configured\n mb = MailgunBackend()\n assert mb.open() is None\n assert mb.close() is None", "metadata": "root.test_marker_methods", "header": "['module', '___EOS___']", "index": 22 }, { "content": "def setUp():\n mb = MailgunBackend(fail_silently=True)\n message = EmailMessage()\n return (mb, message)", "metadata": "root.setUp", "header": "['module', '___EOS___']", "index": 29 }, { "content": "def check_output_value(mb, message, test_input, expected_output):\n for k, v in test_input.iteritems():\n message.extra_headers[k] = v\n output = mb._map_smtp_headers_to_api_parameters(message)\n for extra_header in expected_output:\n assert extra_header in output", "metadata": "root.check_output_value", "header": "['module', '___EOS___']", "index": 35 }, { "content": "def test_extra_headers_map():\n mb, message = setUp()\n test_input = {\n 'X-Mailgun-Tag': ['Tag 1', 'Tag 2'],\n 'X-Mailgun-Campaign-Id': \"1\",\n 'X-Mailgun-Dkim': 'yes',\n 'X-Mailgun-Deliver-By': 'Thu, 13 Oct 2011 18:02:00 GMT',\n 'X-Mailgun-Drop-Message': 'yes',\n 'X-Mailgun-Track': 'yes',\n 'X-Mailgun-Track-Clicks': 'htmlonly',\n 'X-Mailgun-Track-Opens': 'no',\n 'X-Mailgun-Variables': 'my_message_id: 123',\n }\n expected_output = [\n ('o:tag', 'Tag 1'),\n ('o:tag', 'Tag 2'),\n ('o:campaign', '1'),\n ('o:dkim', 'yes'),\n ('o:deliverytime', 'Thu, 13 Oct 2011 18:02:00 GMT'),\n ('o:testmode', 'yes'),\n ('o:tracking', 'yes'),\n ('o:tracking-clicks', 'htmlonly'),\n ('o:tracking-opens', 'no'),\n ('v:my-var', 'my_message_id: 123'),\n ]\n check_output_value(mb, message, test_input, expected_output)", "metadata": "root.test_extra_headers_map", "header": "['module', '___EOS___']", "index": 43 } ]
[]
[]
0
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "from_", "django_", "._", "core_", "._", "exceptions_", "import_", "Impro", "perl", "y", "Configured_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "conf_", "import_", "settings_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "core_", "._", "mail_", "import_", "Ema", "il", "Message_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "django", "\\u", "mail", "gun", "_", "import_", "Mail", "gun", "Backend_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "pytest_", "import_", "raises_", "\\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_", "test\\u", "no", "\\u", "configuration_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "with_", "raises_", "(_", "Impro", "perl", "y", "Configured_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Mail", "gun", "Backend_", "(_", ")_", "\\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", "configuration_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "settings_", "._", "configure_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "MAIL", "GU", "N", "\\u", "ACCESS", "\\u", "KEY_", "=_", "123_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "MAIL", "GU", "N", "\\u", "SERVER", "\\u", "NAME_", "=_", "'", "abc", "'_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Mail", "gun", "Backend_", "(_", ")_", "\\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", "marker", "\\u", "methods_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Al", "read", "y", " ", "configured_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "mb_", "=_", "Mail", "gun", "Backend_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "mb_", "._", "open_", "(_", ")_", "is_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "mb_", "._", "close_", "(_", ")_", "is_", "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_", "set", "Up_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "mb_", "=_", "Mail", "gun", "Backend_", "(_", "fail", "\\u", "silently", "_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "message_", "=_", "Ema", "il", "Message_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "(_", "mb_", ",_", "message_", ")_", "\\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", "output", "\\u", "value_", "(_", "mb_", ",_", "message_", ",_", "test\\u", "input_", ",_", "expected", "\\u", "output_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "k_", ",_", "v_", "in_", "test\\u", "input_", "._", "iteritems_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "message_", "._", "extra", "\\u", "headers_", "[_", "k_", "]_", "=_", "v_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "output_", "=_", "mb_", "._", "\\u", "map", "\\u", "smt", "p", "\\u", "header", "s", "\\u", "to", "\\u", "api", "\\u", "parameters_", "(_", "message_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "extra", "\\u", "header_", "in_", "expected", "\\u", "output_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "assert_", "extra", "\\u", "header_", "in_", "output_", "\\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", "extra", "\\u", "header", "s", "\\u", "map_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "mb_", ",_", "message_", "=_", "set", "Up_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "test\\u", "input_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "X", "-", "Mail", "gun", "-", "Ta", "g", "'_", ":_", "[_", "'", "Ta", "g", " ", "1", "'_", ",_", "'", "Ta", "g", " ", "2", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "X", "-", "Mail", "gun", "-", "Camp", "aig", "n", "-", "Id", "'_", ":_", "\"", "1", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "X", "-", "Mail", "gun", "-", "Dk", "im", "'_", ":_", "'", "ye", "s", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "X", "-", "Mail", "gun", "-", "Deliver", "-", "By", "'_", ":_", "'", "Thu", ",", " ", "13", " ", "Oct", " ", "2011", " ", "1", "8", ":", "02", ":", "00", " ", "GM", "T", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "X", "-", "Mail", "gun", "-", "Drop", "-", "Messag", "e", "'_", ":_", "'", "ye", "s", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "X", "-", "Mail", "gun", "-", "Track", "'_", ":_", "'", "ye", "s", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "X", "-", "Mail", "gun", "-", "Track", "-", "Click", "s", "'_", ":_", "'", "html", "only", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "X", "-", "Mail", "gun", "-", "Track", "-", "Opens", "'_", ":_", "'", "no", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "X", "-", "Mail", "gun", "-", "Varia", "bles", "'_", ":_", "'", "my", "\\u", "message", "\\u", "id", ":", " ", "123", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "expected", "\\u", "output_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "o", ":", "tag", "'_", ",_", "'", "Ta", "g", " ", "1", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "o", ":", "tag", "'_", ",_", "'", "Ta", "g", " ", "2", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "o", ":", "camp", "aig", "n", "'_", ",_", "'", "1", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "o", ":", "dk", "im", "'_", ",_", "'", "ye", "s", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "o", ":", "delivery", "time", "'_", ",_", "'", "Thu", ",", " ", "13", " ", "Oct", " ", "2011", " ", "1", "8", ":", "02", ":", "00", " ", "GM", "T", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "o", ":", "testm", "ode", "'_", ",_", "'", "ye", "s", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "o", ":", "track", "ing", "'_", ",_", "'", "ye", "s", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "o", ":", "track", "ing", "-", "clicks", "'_", ",_", "'", "html", "only", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "o", ":", "track", "ing", "-", "opens", "'_", ",_", "'", "no", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "v", ":", "my", "-", "var", "'_", ",_", "'", "my", "\\u", "message", "\\u", "id", ":", " ", "123", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "check", "\\u", "output", "\\u", "value_", "(_", "mb_", ",_", "message_", ",_", "test\\u", "input_", ",_", "expected", "\\u", "output_", ")_" ]
[ 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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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 import
enthought/depsolver/depsolver/pool.py
[ { "content": "import collections\n\nfrom .bundled.traitlets \\\n import \\\n HasTraits, Dict, Instance, List, Long, Unicode\nfrom .errors \\\n import \\\n DepSolverError, MissingPackageInfoInPool\nfrom .package \\\n import \\\n PackageInfo\nfrom .repository \\\n import \\\n Repository\nfrom .requirement \\\n import \\\n Requirement\nfrom .utils \\\n import \\\n CachedScheduler\n\nMATCH_NONE = 0\nMATCH_NAME = 1\nMATCH = 2\nMATCH_PROVIDE = 3\nMATCH_REPLACE = 4\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class Pool(HasTraits):\n \"\"\"Pool objects model a pool of repositories.\n\n Pools are able to find packages that provide a given requirements (handling\n the provides concept from package metadata).\n \"\"\"\n repositories = List(Instance(Repository))\n\n _packages_by_id = Dict()\n _packages_by_name = Dict()\n\n _id = Long(1)\n\n _repository_by_name = Instance(collections.defaultdict)\n _scheduler = Instance(CachedScheduler)\n\n\n\n\n\n\n\n\n #------------------------\n # Repository priority API\n #------------------------\n", "metadata": "root.Pool", "header": "['module', '___EOS___']", "index": 27 }, { "content": " def __init__(self, repositories=None, **kw):\n scheduler = CachedScheduler()\n repository_by_name = collections.defaultdict(list)\n super(Pool, self).__init__(self, _scheduler=scheduler,\n _repository_by_name=repository_by_name, **kw)\n if repositories is None:\n repositories = []\n\n # provide.name -> package mapping\n self._packages_by_name = collections.defaultdict(list)\n\n if len(repositories) > 0:\n for repository in repositories:\n self.add_repository(repository)", "metadata": "root.Pool.__init__", "header": "['class', 'Pool', '(', 'HasTraits', ')', ':', '___EOS___']", "index": 43 }, { "content": " def has_package(self, package):\n package_id = package.id\n return package_id in self._packages_by_id", "metadata": "root.Pool.has_package", "header": "['class', 'Pool', '(', 'HasTraits', ')', ':', '___EOS___']", "index": 58 }, { "content": " def add_repository(self, repository):\n \"\"\"Add a repository to this pool.\n\n Arguments\n ---------\n repository: Repository\n repository to add\n \"\"\"\n self.repositories.append(repository)\n self._repository_by_name[repository.name].append(repository)\n\n for package in repository.iter_packages():\n package.id = self._id\n self._id += 1\n self._packages_by_id[package.id] = package\n\n self._packages_by_name[package.name].append(package)\n for provide in package.provides:\n self._packages_by_name[provide.name].append(package)\n for replace in package.replaces:\n self._packages_by_name[replace.name].append(package)", "metadata": "root.Pool.add_repository", "header": "['class', 'Pool', '(', 'HasTraits', ')', ':', '___EOS___']", "index": 62 }, { "content": " def package_by_id(self, package_id):\n \"\"\"Retrieve a package from its id.\n\n Arguments\n ---------\n package_id: str\n A package id\n \"\"\"\n try:\n return self._packages_by_id[package_id]\n except KeyError:\n raise MissingPackageInfoInPool(package_id)", "metadata": "root.Pool.package_by_id", "header": "['class', 'Pool', '(', 'HasTraits', ')', ':', '___EOS___']", "index": 84 }, { "content": " def what_provides(self, requirement, mode='composer'):\n \"\"\"Returns a list of packages that provide the given requirement.\n\n Arguments\n ---------\n requirement: Requirement\n the requirement to match\n mode: str\n One of the following string:\n\n - 'composer': behaves like Composer does, i.e. only returns\n packages that match this requirement directly, unless no\n match is found in which case packages that provide the\n requirement indirectly are returned.\n - 'direct_only': only returns packages that match this\n requirement directly (i.e. provides are ignored).\n - 'include_indirect': only returns packages that match this\n requirement directly or indirectly (i.e. includes packages\n that provides this package)\n \"\"\"\n # FIXME: this is conceptually copied from whatProvides in Composer, but\n # I don't understand why the policy of preferring non-provided over\n # provided packages is handled here.\n if not mode in ['composer', 'direct_only', 'include_indirect']:\n raise ValueError(\"Invalid mode %r\" % mode)\n\n strict_matches = []\n provided_match = []\n name_match = False\n\n for package in self._packages_by_name[requirement.name]:\n match = self.matches(package, requirement)\n if match == MATCH_NONE:\n pass\n elif match == MATCH_NAME:\n name_match = True\n elif match == MATCH:\n name_match = True\n strict_matches.append(package)\n elif match == MATCH_PROVIDE:\n provided_match.append(package)\n elif match == MATCH_REPLACE:\n strict_matches.append(package)\n else:\n raise ValueError(\"Invalid match type: {}\".format(match))\n\n if mode == 'composer':\n if name_match:\n return strict_matches\n else:\n return strict_matches + provided_match\n elif mode == 'direct_only':\n return strict_matches\n elif mode == 'include_indirect':\n return strict_matches + provided_match", "metadata": "root.Pool.what_provides", "header": "['class', 'Pool', '(', 'HasTraits', ')', ':', '___EOS___']", "index": 97 }, { "content": " def matches(self, candidate, requirement):\n \"\"\"Checks whether the candidate package matches the requirement, either\n directly or through provides.\n\n Arguments\n ---------\n candidate: PackageInfo\n Candidate package\n requirement: Requirement\n The requirement to match\n\n Returns\n -------\n match_type: _Match or False\n An instance of Match, that specified the type of match:\n\n - if only the name matches, will be MATCH_NAME\n - if the name and version actually match, will be MATCH\n - if the match is through the package's provides, will be MATCH_PROVIDE\n - if no match at all, will be False\n\n Examples\n --------\n >>> from depsolver import PackageInfo, Requirement\n >>> R = Requirement.from_string\n >>> pool = Pool()\n >>> pool.matches(PackageInfo.from_string('numpy-1.3.0'), R('numpy >= 1.2.0')) == MATCH\n True\n \"\"\"\n if requirement.name == candidate.name:\n candidate_requirement = Requirement.from_package_string(candidate.unique_name, candidate.version_factory)\n if requirement.is_universal or candidate_requirement.matches(requirement):\n return MATCH\n else:\n return MATCH_NAME\n else:\n for provide in candidate.provides:\n if requirement.matches(provide):\n return MATCH_PROVIDE\n\n for replace in candidate.replaces:\n if requirement.matches(replace):\n return MATCH_REPLACE\n\n return MATCH_NONE", "metadata": "root.Pool.matches", "header": "['class', 'Pool', '(', 'HasTraits', ')', ':', '___EOS___']", "index": 153 }, { "content": " def id_to_string(self, package_id):\n \"\"\"\n Convert a package id to a nice string representation.\n \"\"\"\n package = self.package_by_id(abs(package_id))\n if package_id > 0:\n return \"+\" + str(package)\n else:\n return \"-\" + str(package)", "metadata": "root.Pool.id_to_string", "header": "['class', 'Pool', '(', 'HasTraits', ')', ':', '___EOS___']", "index": 199 }, { "content": " def set_repository_order(self, repository_name, after=None, before=None):\n candidates = self._repository_by_name[repository_name]\n if len(candidates) < 1:\n raise DepSolverError(\"No repository with name '%s'\" % (repository_name,))\n else:\n self._scheduler.set_constraints(repository_name, after, before)", "metadata": "root.Pool.set_repository_order", "header": "['class', 'Pool', '(', 'HasTraits', ')', ':', '___EOS___']", "index": 212 }, { "content": " def repository_priority(self, repository):\n \"\"\"\n Returns the priority of a repository.\n\n Priorities are in the ]-inf, 0] integer range, and the ordering is the\n same as integers: the lower the priority number, the less a repository\n has priority over other repositories.\n\n If no constraint has been set up for the repository, its priority is 0.\n\n Parameters\n ----------\n repository: Repository\n The repository to compute the priority of.\n \"\"\"\n if repository.name in self._repository_by_name:\n priorities = self._scheduler.compute_priority()\n # We return a negative number to follow Composer convention.\n return priorities.get(repository.name, 0) - (len(priorities) - 1)\n else:\n raise DepSolverError(\"Unknown repository name '%s'\" % (repository.name,))", "metadata": "root.Pool.repository_priority", "header": "['class', 'Pool', '(', 'HasTraits', ')', ':', '___EOS___']", "index": 219 } ]
[]
[]
0
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "import_", "collections_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "._", "bundle", "d_", "._", "tra", "itle", "ts_", "import_", "Has", "Trait", "s_", ",_", "Dict_", ",_", "Instance_", ",_", "List_", ",_", "Long_", ",_", "Unicode_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "._", "errors_", "import_", "Dep", "Solve", "r", "Error_", ",_", "Missing", "Packa", "ge", "Info", "In", "Pool_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "._", "package_", "import_", "Packa", "ge", "Info_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "._", "repository_", "import_", "Repository_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "._", "requirement_", "import_", "Requirement", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "._", "utils_", "import_", "Cache", "d", "Scheduler_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "MATCH", "\\u", "NONE_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "MATCH", "\\u", "NAME_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "MATCH_", "=_", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "MATCH", "\\u", "PROVI", "DE_", "=_", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "MATCH", "\\u", "REPLACE", "_", "=_", "4_", "\\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_", "Pool_", "(_", "Has", "Trait", "s_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Poo", "l", " ", "object", "s", " ", "model", " ", "a", " ", "pool", " ", "of", " ", "repos", "itori", "es", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Pools", " ", "are", " ", "able", " ", "to", " ", "find", " ", "package", "s", " ", "tha", "t", " ", "provide", " ", "a", " ", "give", "n", " ", "require", "ment", "s", " ", "(", "handling", "\\", "10", ";", " ", " ", " ", " ", "the", " ", "provide", "s", " ", "concept", " ", "from", " ", "package", " ", "metadata", ").", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "repositories_", "=_", "List_", "(_", "Instance_", "(_", "Repository_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "package", "s", "\\u", "by", "\\u", "id_", "=_", "Dict_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "package", "s", "\\u", "by", "\\u", "name_", "=_", "Dict_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "id_", "=_", "Long_", "(_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "repos", "itor", "y", "\\u", "by", "\\u", "name_", "=_", "Instance_", "(_", "collections_", "._", "defaultdict_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "scheduler_", "=_", "Instance_", "(_", "Cache", "d", "Scheduler_", ")_", "\\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\\uNL\\u\\u\\u_", "#", " ", "Repos", "itor", "y", " ", "priorit", "y", " ", "API_", "\\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_", "Pool_", "(_", "Has", "Trait", "s_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "repositories_", "=_", "None_", ",_", "**_", "kw_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "scheduler_", "=_", "Cache", "d", "Scheduler_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "repos", "itor", "y", "\\u", "by", "\\u", "name_", "=_", "collections_", "._", "defaultdict_", "(_", "list_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "super_", "(_", "Pool_", ",_", "self_", ")_", "._", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "\\u", "scheduler_", "=_", "scheduler_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "repos", "itor", "y", "\\u", "by", "\\u", "name_", "=_", "repos", "itor", "y", "\\u", "by", "\\u", "name_", ",_", "**_", "kw_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "repositories_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "repositories_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "provide", ".", "name", " ", "->", " ", "package", " ", "mapping_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "package", "s", "\\u", "by", "\\u", "name_", "=_", "collections_", "._", "defaultdict_", "(_", "list_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "len_", "(_", "repositories_", ")_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "repository_", "in_", "repositories_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "add", "\\u", "repository_", "(_", "repository_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Pool_", "(_", "Has", "Trait", "s_", ")_", ":_", "\\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_", "has", "\\u", "package_", "(_", "self_", ",_", "package_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "package", "\\u", "id_", "=_", "package_", "._", "id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "package", "\\u", "id_", "in_", "self_", "._", "\\u", "package", "s", "\\u", "by", "\\u", "id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Pool_", "(_", "Has", "Trait", "s_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "add", "\\u", "repository_", "(_", "self_", ",_", "repository_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Add", " ", "a", " ", "repos", "itor", "y", " ", "to", " ", "this", " ", "pool", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Arg", "ument", "s", "\\", "10", ";", " ", " ", " ", " ", "---------", "\\", "10", ";", " ", " ", " ", " ", "repos", "itor", "y", ":", " ", "Repos", "itor", "y", "\\", "10", ";", " ", " ", " ", " ", "repos", "itor", "y", " ", "to", " ", "add", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "repositories_", "._", "append_", "(_", "repository_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "repos", "itor", "y", "\\u", "by", "\\u", "name_", "[_", "repository_", "._", "name_", "]_", "._", "append_", "(_", "repository_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "package_", "in_", "repository_", "._", "iter", "\\u", "packages_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "package_", "._", "id_", "=_", "self_", "._", "\\u", "id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "id_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "package", "s", "\\u", "by", "\\u", "id_", "[_", "package_", "._", "id_", "]_", "=_", "package_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "package", "s", "\\u", "by", "\\u", "name_", "[_", "package_", "._", "name_", "]_", "._", "append_", "(_", "package_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "provide", "_", "in_", "package_", "._", "provides_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "package", "s", "\\u", "by", "\\u", "name_", "[_", "provide", "_", "._", "name_", "]_", "._", "append_", "(_", "package_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "replace_", "in_", "package_", "._", "replace", "s_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "package", "s", "\\u", "by", "\\u", "name_", "[_", "replace_", "._", "name_", "]_", "._", "append_", "(_", "package_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Pool_", "(_", "Has", "Trait", "s_", ")_", ":_", "\\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_", "package", "\\u", "by", "\\u", "id_", "(_", "self_", ",_", "package", "\\u", "id_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Retrieve", " ", "a", " ", "package", " ", "from", " ", "its", " ", "id", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Arg", "ument", "s", "\\", "10", ";", " ", " ", " ", " ", "---------", "\\", "10", ";", " ", " ", " ", " ", "package", "\\u", "id", ":", " ", "str", "\\", "10", ";", " ", " ", " ", " ", "A", " ", "package", " ", "id", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "\\u", "package", "s", "\\u", "by", "\\u", "id_", "[_", "package", "\\u", "id_", "]_", "\\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 ", " _", "raise_", "Missing", "Packa", "ge", "Info", "In", "Pool_", "(_", "package", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Pool_", "(_", "Has", "Trait", "s_", ")_", ":_", "\\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_", "what", "\\u", "provides_", "(_", "self_", ",_", "requirement_", ",_", "mode_", "=_", "'", "composer", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Return", "s", " ", "a", " ", "list", " ", "of", " ", "package", "s", " ", "tha", "t", " ", "provide", " ", "the", " ", "give", "n", " ", "require", "ment", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Arg", "ument", "s", "\\", "10", ";", " ", " ", " ", " ", "---------", "\\", "10", ";", " ", " ", " ", " ", "require", "ment", ":", " ", "Requirement", "\\", "10", ";", " ", " ", " ", " ", "the", " ", "require", "ment", " ", "to", " ", "match", "\\", "10", ";", " ", " ", " ", " ", "mode", ":", " ", "str", "\\", "10", ";", " ", " ", " ", " ", "One", " ", "of", " ", "the", " ", "follow", "ing", " ", "string", ":", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "-", " ", "'", "composer", "':", " ", "behave", "s", " ", "like", " ", "Composer", " ", "doe", "s", ",", " ", "i", ".", "e", ".", " ", "only", " ", "return", "s", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "package", "s", " ", "tha", "t", " ", "match", " ", "this", " ", "require", "ment", " ", "direct", "ly", ",", " ", "unl", "ess", " ", "no", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "match", " ", "is", " ", "found", " ", "in", " ", "whi", "ch", " ", "case", " ", "package", "s", " ", "tha", "t", " ", "provide", " ", "the", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "require", "ment", " ", "indirect", "ly", " ", "are", " ", "return", "ed", ".", "\\", "10", ";", " ", " ", " ", " ", "-", " ", "'", "direct", "\\u", "only", "':", " ", "only", " ", "return", "s", " ", "package", "s", " ", "tha", "t", " ", "match", " ", "this", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "require", "ment", " ", "direct", "ly", " ", "(", "i", ".", "e", ".", " ", "provide", "s", " ", "are", " ", "ignore", "d", ").", "\\", "10", ";", " ", " ", " ", " ", "-", " ", "'", "include", "\\u", "indirect", "':", " ", "only", " ", "return", "s", " ", "package", "s", " ", "tha", "t", " ", "match", " ", "this", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "require", "ment", " ", "direct", "ly", " ", "or", " ", "indirect", "ly", " ", "(", "i", ".", "e", ".", " ", "include", "s", " ", "package", "s", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "tha", "t", " ", "provide", "s", " ", "this", " ", "package", ")", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "FIX", "ME", ":", " ", "this", " ", "is", " ", "concept", "ual", "ly", " ", "copie", "d", " ", "from", " ", "what", "Prov", "ides", " ", "in", " ", "Composer", ",", " ", "but", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "I", " ", "don", "'", "t", " ", "underst", "and", " ", "wh", "y", " ", "the", " ", "policy", " ", "of", " ", "prefer", "ring", " ", "non", "-", "provided", " ", "over_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "provided", " ", "package", "s", " ", "is", " ", "handle", "d", " ", "here", "._", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "mode_", "in_", "[_", "'", "composer", "'_", ",_", "'", "direct", "\\u", "only", "'_", ",_", "'", "include", "\\u", "indirect", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Value", "Error_", "(_", "\"", "Inva", "lid", " ", "mode", " ", "%", "r", "\"_", "%_", "mode_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "strict", "\\u", "matches_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "provided", "\\u", "match_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "name", "\\u", "match_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "package_", "in_", "self_", "._", "\\u", "package", "s", "\\u", "by", "\\u", "name_", "[_", "requirement_", "._", "name_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "match_", "=_", "self_", "._", "matches_", "(_", "package_", ",_", "requirement_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "match_", "==_", "MATCH", "\\u", "NONE_", ":_", "\\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_", "elif_", "match_", "==_", "MATCH", "\\u", "NAME_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "name", "\\u", "match_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "match_", "==_", "MATCH_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "name", "\\u", "match_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "strict", "\\u", "matches_", "._", "append_", "(_", "package_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "match_", "==_", "MATCH", "\\u", "PROVI", "DE_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "provided", "\\u", "match_", "._", "append_", "(_", "package_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "match_", "==_", "MATCH", "\\u", "REPLACE", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "strict", "\\u", "matches_", "._", "append_", "(_", "package_", ")_", "\\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_", "(_", "\"", "Inva", "lid", " ", "match", " ", "type", ":", " ", "{}\"_", "._", "format_", "(_", "match_", ")_", ")_", "\\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_", "mode_", "==_", "'", "composer", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "name", "\\u", "match_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "strict", "\\u", "matches_", "\\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_", "strict", "\\u", "matches_", "+_", "provided", "\\u", "match_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "mode_", "==_", "'", "direct", "\\u", "only", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "strict", "\\u", "matches_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "mode_", "==_", "'", "include", "\\u", "indirect", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "strict", "\\u", "matches_", "+_", "provided", "\\u", "match_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Pool_", "(_", "Has", "Trait", "s_", ")_", ":_", "\\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_", "matches_", "(_", "self_", ",_", "candidate_", ",_", "requirement_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Check", "s", " ", "whe", "ther", " ", "the", " ", "candidate", " ", "package", " ", "matche", "s", " ", "the", " ", "require", "ment", ",", " ", "eit", "her", "\\", "10", ";", " ", " ", " ", " ", "direct", "ly", " ", "or", " ", "through", " ", "provide", "s", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Arg", "ument", "s", "\\", "10", ";", " ", " ", " ", " ", "---------", "\\", "10", ";", " ", " ", " ", " ", "candidate", ":", " ", "Packa", "ge", "Info", "\\", "10", ";", " ", " ", " ", " ", "Candidate", " ", "package", "\\", "10", ";", " ", " ", " ", " ", "require", "ment", ":", " ", "Requirement", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "require", "ment", " ", "to", " ", "match", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", "\\", "10", ";", " ", " ", " ", " ", "-------", "\\", "10", ";", " ", " ", " ", " ", "match", "\\u", "type", ":", " ", "\\u", "Match", " ", "or", " ", "Fal", "se", "\\", "10", ";", " ", " ", " ", " ", "An", " ", "instance", " ", "of", " ", "Match", ",", " ", "tha", "t", " ", "specified", " ", "the", " ", "type", " ", "of", " ", "match", ":", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "-", " ", "if", " ", "only", " ", "the", " ", "name", " ", "matche", "s", ",", " ", "will", " ", "be", " ", "MATCH", "\\u", "NAME", "\\", "10", ";", " ", " ", " ", " ", "-", " ", "if", " ", "the", " ", "name", " ", "and", " ", "version", " ", "actual", "ly", " ", "match", ",", " ", "will", " ", "be", " ", "MATCH", "\\", "10", ";", " ", " ", " ", " ", "-", " ", "if", " ", "the", " ", "match", " ", "is", " ", "through", " ", "the", " ", "package", "'", "s", " ", "provide", "s", ",", " ", "will", " ", "be", " ", "MATCH", "\\u", "PROVI", "DE", "\\", "10", ";", " ", " ", " ", " ", "-", " ", "if", " ", "no", " ", "match", " ", "at", " ", "all", ",", " ", "will", " ", "be", " ", "Fal", "se", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Exam", "ples", "\\", "10", ";", " ", " ", " ", " ", "--------", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "from", " ", "dep", "solve", "r", " ", "import", " ", "Packa", "ge", "Info", ",", " ", "Requirement", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "R", " ", "=", " ", "Requirement", ".", "from", "\\u", "string", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "pool", " ", "=", " ", "Poo", "l", "()", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "pool", ".", "matche", "s", "(", "Packa", "ge", "Info", ".", "from", "\\u", "string", "('", "nump", "y", "-1", ".3", ".0", "')", ",", " ", "R", "('", "nump", "y", " ", ">=", " ", "1.2", ".0", "'))", " ", "==", " ", "MATCH", "\\", "10", ";", " ", " ", " ", " ", "Tru", "e", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "requirement_", "._", "name_", "==_", "candidate_", "._", "name_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "candidate", "\\u", "requirement_", "=_", "Requirement", "_", "._", "from", "\\u", "package", "\\u", "string_", "(_", "candidate_", "._", "unique", "\\u", "name_", ",_", "candidate_", "._", "version", "\\u", "factory_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "requirement_", "._", "is", "\\u", "universal", "_", "or_", "candidate", "\\u", "requirement_", "._", "matches_", "(_", "requirement_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "MATCH_", "\\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_", "MATCH", "\\u", "NAME_", "\\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_", "provide", "_", "in_", "candidate_", "._", "provides_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "requirement_", "._", "matches_", "(_", "provide", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "return_", "MATCH", "\\u", "PROVI", "DE_", "\\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_", "replace_", "in_", "candidate_", "._", "replace", "s_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "requirement_", "._", "matches_", "(_", "replace_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "return_", "MATCH", "\\u", "REPLACE", "_", "\\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_", "MATCH", "\\u", "NONE_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Pool_", "(_", "Has", "Trait", "s_", ")_", ":_", "\\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_", "id", "\\u", "to", "\\u", "string_", "(_", "self_", ",_", "package", "\\u", "id_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Convert", " ", "a", " ", "package", " ", "id", " ", "to", " ", "a", " ", "nice", " ", "string", " ", "represent", "ation", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "package_", "=_", "self_", "._", "package", "\\u", "by", "\\u", "id_", "(_", "abs_", "(_", "package", "\\u", "id_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "package", "\\u", "id_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\"+\"_", "+_", "str_", "(_", "package_", ")_", "\\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_", "\"-\"_", "+_", "str_", "(_", "package_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Pool_", "(_", "Has", "Trait", "s_", ")_", ":_", "\\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_", "set\\u", "repos", "itor", "y", "\\u", "order_", "(_", "self_", ",_", "repos", "itor", "y", "\\u", "name_", ",_", "after_", "=_", "None_", ",_", "before_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "candidates_", "=_", "self_", "._", "\\u", "repos", "itor", "y", "\\u", "by", "\\u", "name_", "[_", "repos", "itor", "y", "\\u", "name_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "len_", "(_", "candidates_", ")_", "<_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Dep", "Solve", "r", "Error_", "(_", "\"", "No", " ", "repos", "itor", "y", " ", "with", " ", "name", " ", "'%", "s", "'\"_", "%_", "(_", "repos", "itor", "y", "\\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_", "._", "\\u", "scheduler_", "._", "set\\u", "constraints_", "(_", "repos", "itor", "y", "\\u", "name_", ",_", "after_", ",_", "before_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Pool_", "(_", "Has", "Trait", "s_", ")_", ":_", "\\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_", "repos", "itor", "y", "\\u", "priority_", "(_", "self_", ",_", "repository_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", " ", "the", " ", "priorit", "y", " ", "of", " ", "a", " ", "repos", "itor", "y", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Prior", "iti", "es", " ", "are", " ", "in", " ", "the", " ", "]-", "inf", ",", " ", "0", "]", " ", "integ", "er", " ", "range", ",", " ", "and", " ", "the", " ", "orderi", "ng", " ", "is", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "same", " ", "as", " ", "integ", "ers", ":", " ", "the", " ", "lower", " ", "the", " ", "priorit", "y", " ", "number", ",", " ", "the", " ", "less", " ", "a", " ", "repos", "itor", "y", "\\", "10", ";", " ", " ", " ", " ", "has", " ", "priorit", "y", " ", "over", " ", "other", " ", "repos", "itori", "es", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "If", " ", "no", " ", "constraint", " ", "has", " ", "bee", "n", " ", "set", " ", "up", " ", "for", " ", "the", " ", "repos", "itor", "y", ",", " ", "its", " ", "priorit", "y", " ", "is", " ", "0.", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Parameter", "s", "\\", "10", ";", " ", " ", " ", " ", "----------", "\\", "10", ";", " ", " ", " ", " ", "repos", "itor", "y", ":", " ", "Repos", "itor", "y", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "repos", "itor", "y", " ", "to", " ", "compute", " ", "the", " ", "priorit", "y", " ", "of", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "repository_", "._", "name_", "in_", "self_", "._", "\\u", "repos", "itor", "y", "\\u", "by", "\\u", "name_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "priorities", "_", "=_", "self_", "._", "\\u", "scheduler_", "._", "compute", "\\u", "priority_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "We", " ", "return", " ", "a", " ", "negati", "ve", " ", "number", " ", "to", " ", "follow", " ", "Composer", " ", "convention", "._", "\\u\\u\\uNL\\u\\u\\u_", "return_", "priorities", "_", "._", "get_", "(_", "repository_", "._", "name_", ",_", "0_", ")_", "-_", "(_", "len_", "(_", "priorities", "_", ")_", "-_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused local variable
anhstudios/swganh/data/scripts/templates/object/mobile/shared_dressed_garyn_prowler_trandoshan_male_01.py
[ { "content": "def create(kernel):\n\tresult = Creature()\n\n\tresult.template = \"object/mobile/shared_dressed_garyn_prowler_trandoshan_male_01.iff\"\n\tresult.attribute_template_id = 9\n\tresult.stfName(\"npc_name\",\"trandoshan_base_male\")\t\t\n\t\n\t#### BEGIN MODIFICATIONS ####\n\t#### END MODIFICATIONS ####\n\t\n\treturn result", "metadata": "root.create", "header": "['module', '___EOS___']", "index": 6 } ]
[]
[]
0
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "create_", "(_", "kernel_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "_", "result_", "=_", "Creat", "ure_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "result_", "._", "template_", "=_", "\"", "object", "/", "mobile", "/", "shared", "\\u", "dress", "ed", "\\u", "gar", "yn", "\\u", "pro", "wle", "r", "\\u", "tran", "dos", "han", "\\u", "male", "\\u", "01", ".", "iff", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "._", "attribute", "\\u", "template", "\\u", "id_", "=_", "9_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "._", "stf", "Name_", "(_", "\"", "npc", "\\u", "name", "\"_", ",_", "\"", "tran", "dos", "han", "\\u", "base", "\\u", "male", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "###", "#", " ", "BEGIN", " ", "MODI", "FICATION", "S", " ", "###", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "###", "#", " ", " ", "END", " ", "MODI", "FICATION", "S", " ", " ", "###", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "result_" ]
[ 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 ]
Unused import
Kitware/minerva/ansible/library/girder.py
[ { "content": "#!/usr/bin/python\n# -*- coding: utf-8 -*-\n\n###############################################################################\n# Copyright Kitware Inc.\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# Ansible's module magic requires this to be\n# 'from ansible.module_utils.basic import *' otherwise it will error out. See:\n# https://github.com/ansible/ansible/blob/v1.9.4-1/lib/ansible/module_common.py#L41-L59\n# For more information on this magic. For now we noqa to prevent flake8 errors\nfrom ansible.module_utils.basic import * # noqa\nfrom inspect import getmembers, ismethod, getargspec\n\ntry:\n from girder_client import GirderClient, AuthenticationError, HttpError\n HAS_GIRDER_CLIENT = True\nexcept ImportError:\n HAS_GIRDER_CLIENT = False\n\nDOCUMENTATION = '''\n---\nmodule: girder\nauthor: \"Chris Kotfila (chris.kotfila@kitware.com)\nversion_added: \"0.1\"\nshort_description: A module that wraps girder_client\nrequirements: [ girder_client==1.1.0 ]\ndescription:\n - Manage a girder instance using the RESTful API\noptions:\n host:\n required: false\n default: 'localhost'\n description:\n - domain or IP of the host running girder\n port:\n required: false\n default: '80' for http, '443' for https\n description:\n - port the girder instance is running on\n\n apiRoot:\n required: false\n default: '/api/v1'\n description:\n - path on server corresponding to the root of Girder REST API\n\n scheme:\n required: false\n default: 'http'\n description:\n - A string containing the scheme for the Girder host\n\n dryrun:\n required: false\n default: None (passed through)\n description:\n - See GirderClient.__init__()\n\n blacklist:\n required: false\n default: None (passed through)\n description:\n - See GirderClient.__init__()\n\n username:\n required: true\n description:\n - Valid username for the system\n - Required with password\n - must be specified if 'token' is not specified\n - (See note on 'user')\n\n password:\n required: true\n description:\n - Valid password for the system\n - Required with username\n - must be specified if 'token' is not specified\n - (See note on 'user')\n token:\n required: true\n description:\n - A girder client token\n - Can be retrieved by accessing the accessing the 'token' attribute\n from a successfully authenticated call to girder in a previous\n task.\n - Required if 'username' and 'password' are not specified\n - (See note on 'user')\n state:\n required: false\n default: \"present\"\n choices: [\"present\", \"absent\"]\n description:\n - Used to indicate the presence or absence of a resource\n - e.g., user, plugin, assetstore\n\n user:\n required: false\n description:\n - If using the 'user' task, you are NOT REQUIRED to pass in a\n 'username' & 'password', or a 'token' attributes. This is because\n the first user created on an fresh install of girder is\n automatically made an administrative user. Once you are certain\n you have an admin user you should use those credentials in all\n subsequent tasks that use the 'user' task.\n\n - Takes a mapping of key value pairs\n options:\n login:\n required: true\n description:\n - The login name of the user\n password:\n required: true\n description:\n - The password of the user\n\n firstName:\n required: false\n default: pass through to girder client\n description:\n - The first name of the user\n\n lastName:\n required: false\n default: pass through to girder client\n description:\n - The last name of the user\n email:\n required: false\n default: pass through to girder client\n description:\n - The email of the user\n admin:\n required: false\n default: false\n description:\n - If true, make the user an administrator.\n\n\n plugin:\n required: false\n description:\n - Specify what plugins should be activated (state: present)\n or deactivated (state: absent).\n - Takes a list of plugin names, incorrect names are silently\n ignored\n\n assetstore:\n required: false\n description:\n - Specifies an assetstore\n - Takes many options depending on 'type'\n options:\n name:\n required: true\n description:\n - Name of the assetstore\n type:\n required: true\n choices: ['filesystem', 'gridfs', 's3', 'hdfs']\n description:\n - Currently only 'filesystem' has been tested\n readOnly:\n required: false\n default: false\n description:\n - Should the assetstore be read only?\n current:\n required: false\n default: false\n description:\n - Should the assetstore be set as the current\n assetstore?\n\n options (filesystem):\n root:\n required: true\n description:\n - Filesystem path to the assetstore\n\n options (gridfs) (EXPERIMENTAL):\n db:\n required: true\n description:\n - database name\n mongohost:\n required: true\n description:\n - Mongo host URI\n\n replicaset:\n required: false\n default: ''\n description:\n - Replica set name\n\n options (s3) (EXPERIMENTAL):\n bucket:\n required: true\n description:\n - The S3 bucket to store data in\n\n prefix:\n required: true\n description:\n - Optional path prefix within the bucket under which\n files will be stored\n\n accessKeyId:\n required: true\n description:\n - the AWS access key ID to use for authentication\n\n secret:\n required: true\n description:\n - the AWS secret key to use for authentication\n\n service:\n required: false\n default: s3.amazonaws.com\n description:\n - The S3 service host (for S3 type)\n - This can be used to specify a protocol and port\n - use the form [http[s]://](host domain)[:(port)]\n - Do not include the bucket name here\n\n options (hdfs) (EXPERIMENTAL):\n host:\n required: true\n description:\n - None\n port:\n required: true\n description:\n - None\n path:\n required: true\n description:\n - None\n user:\n required: true\n description:\n - None\n webHdfsPort\n required: true\n description:\n - None\n\n'''\n\nEXAMPLES = '''\n\n\n#############\n# Example using 'user'\n###\n\n\n# Ensure \"admin\" user exists\n- name: Create 'admin' User\n girder:\n user:\n firstName: \"Chris\"\n lastName: \"Kotfila\"\n login: \"admin\"\n password: \"letmein\"\n email: \"chris.kotfila@kitware.com\"\n admin: yes\n state: present\n\n# Ensure a 'foobar' user exists\n- name: Create 'foobar' User\n girder:\n username: \"admin\"\n password: \"letmein\"\n user:\n firstName: \"Foo\"\n lastName: \"Bar\"\n login: \"foobar\"\n password: \"foobarbaz\"\n email: \"foo.bar@kitware.com\"\n admin: yes\n state: present\n\n# Remove the 'foobar' user\n- name: Remove 'foobar' User\n username: \"admin\"\n password: \"letmein\"\n girder:\n user:\n login: \"foobar\"\n password: \"foobarbaz\"\n state: absent\n\n\n#############\n# Example using 'plugins'\n###\n\n# To enable or disable all plugins you may pass the \"*\"\n# argument. This does not (yet) support arbitrary regexes\n- name: Disable all plugins\n girder:\n username: \"admin\"\n password: \"letmein\"\n plugins: \"*\"\n state: absent\n\n- name: Enable thumbnails plugin\n girder:\n username: \"admin\"\n password: \"letmein\"\n port: 8080\n plugins:\n - thumbnails\n state: present\n\n# Note that 'thumbnails' is still enabled from the previous task,\n# the 'plugins' task ensures that plugins are enabled or disabled,\n# it does NOT define the complete list of enabled or disabled plugins.\n- name: Ensure jobs and gravatar plugins are enabled\n girder:\n username: \"admin\"\n password: \"letmein\"\n plugins:\n - jobs\n - gravatar\n state: present\n\n\n\n############\n# Filesystem Assetstore Tests\n#\n\n- name: Create filesystem assetstore\n girder:\n username: \"admin\"\n password: \"letmein\"\n assetstore:\n name: \"Temp Filesystem Assetstore\"\n type: \"filesystem\"\n root: \"/data/\"\n current: true\n state: present\n\n- name: Delete filesystem assetstore\n girder:\n username: \"admin\"\n password: \"letmein\"\n assetstore:\n name: \"Temp Filesystem Assetstore\"\n type: \"filesystem\"\n root: \"/tmp/\"\n state: absent\n\n############\n# Examples using get\n#\n\n\n# Get my info\n- name: Get users from http://localhost:80/api/v1/users\n girder:\n username: 'admin'\n password: 'letmein'\n get:\n path: \"users\"\n register: ret_val\n\n# Prints debugging messages with the emails of the users\n# From the last task by accessing 'gc_return' of the registered\n# variable 'ret_val'\n- name: print emails of users\n debug: msg=\"{{ item['email'] }}\"\n with_items: \"{{ ret_val['gc_return'] }}\"\n\n\n#############\n# Advanced usage\n#\n\n# Supports get, post, put, delete methods, but does\n# not guarantee idempotence on these methods!\n\n- name: Restart the server\n girder:\n username: \"admin\"\n password: \"letmein\"\n put:\n path: \"system/restart\"\n\n# An example of posting an item to Girder\n# Note that this is NOT idempotent. Running\n# multiple times will create \"An Item\", \"An Item (1)\",\n# \"An Item (2)\", etc..\n\n- name: Get Me\n girder:\n username: \"admin\"\n password: \"letmein\"\n get:\n path: \"user/me\"\n register: ret\n\n# Show use of 'token' for subsequent authentication\n- name: Get my public folder\n girder:\n token: \"{{ ret['token'] }}\"\n get:\n path: \"folder\"\n parameters:\n parentType: \"user\"\n parentId: \"{{ ret['gc_return']['_id'] }}\"\n text: \"Public\"\n register: ret\n\n\n- name: Post an item to my public folder\n girder:\n host: \"data.kitware.com\"\n scheme: 'https'\n token: \"{{ ret['token'] }}\"\n post:\n path: \"item\"\n parameters:\n folderId: \"{{ ret['gc_return'][0]['_id'] }}\"\n name: \"An Item\"\n\n\n'''\n\n\n\n\n\n\n\n\nif __name__ == '__main__':\n main()\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def class_spec(cls, include=None):\n include = include if include is not None else []\n\n for fn, method in getmembers(cls, predicate=ismethod):\n if fn in include:\n spec = getargspec(method)\n # spec.args[1:] so we don't include 'self'\n params = spec.args[1:]\n d = len(spec.defaults) if spec.defaults is not None else 0\n r = len(params) - d\n\n yield (fn, {\"required\": params[:r],\n \"optional\": params[r:]})", "metadata": "root.class_spec", "header": "['module', '___EOS___']", "index": 448 }, { "content": "class GirderClientModule(GirderClient):\n\n # Exclude these methods from both 'raw' mode\n _include_methods = ['get', 'put', 'post', 'delete',\n 'plugins', 'user', 'assetstore']\n\n _debug = True\n\n\n\n\n\n\n\n\n assetstore_types = {\n \"filesystem\": 0,\n \"girdfs\": 1,\n \"s3\": 2,\n \"hdfs\": \"hdfs\"\n }\n\n", "metadata": "root.GirderClientModule", "header": "['module', '___EOS___']", "index": 463 }, { "content": " def exit(self):\n if not self._debug:\n del self.message['debug']\n\n self.module.exit_json(changed=self.changed, **self.message)", "metadata": "root.GirderClientModule.exit", "header": "['class', 'GirderClientModule', '(', 'GirderClient', ')', ':', '___NEWLINE___', '___NL___', \"# Exclude these methods from both 'raw' mode\", '___NL___', '___EOS___']", "index": 471 }, { "content": " def fail(self, msg):\n self.module.fail_json(msg=msg)", "metadata": "root.GirderClientModule.fail", "header": "['class', 'GirderClientModule', '(', 'GirderClient', ')', ':', '___NEWLINE___', '___NL___', \"# Exclude these methods from both 'raw' mode\", '___NL___', '___EOS___']", "index": 477 }, { "content": " def __init__(self):\n self.changed = False\n self.message = {\"msg\": \"Success!\", \"debug\": {}}\n\n self.spec = dict(class_spec(self.__class__,\n GirderClientModule._include_methods))\n self.required_one_of = self.spec.keys()", "metadata": "root.GirderClientModule.__init__", "header": "['class', 'GirderClientModule', '(', 'GirderClient', ')', ':', '___NEWLINE___', '___NL___', \"# Exclude these methods from both 'raw' mode\", '___NL___', '___EOS___']", "index": 480 }, { "content": " def __call__(self, module):\n self.module = module\n\n super(GirderClientModule, self).__init__(\n **{p: self.module.params[p] for p in\n ['host', 'port', 'apiRoot',\n 'scheme', 'dryrun', 'blacklist']\n if module.params[p] is not None})\n # If a username and password are set\n if self.module.params['username'] is not None:\n try:\n self.authenticate(\n username=self.module.params['username'],\n password=self.module.params['password'])\n\n except AuthenticationError:\n self.fail(\"Could not Authenticate!\")\n\n # If a token is set\n elif self.module.params['token'] is not None:\n self.token = self.module.params['token']\n\n # Else error if we're not trying to create a user\n elif self.module.params['user'] is None:\n self.fail(\"Must pass in either username & password, \"\n \"or a valid girder_client token\")\n\n self.message['token'] = self.token\n\n for method in self.required_one_of:\n if self.module.params[method] is not None:\n self.__process(method)\n self.exit()\n\n self.fail(\"Could not find executable method!\")", "metadata": "root.GirderClientModule.__call__", "header": "['class', 'GirderClientModule', '(', 'GirderClient', ')', ':', '___NEWLINE___', '___NL___', \"# Exclude these methods from both 'raw' mode\", '___NL___', '___EOS___']", "index": 488 }, { "content": " def __process(self, method):\n # Parameters from the YAML file\n params = self.module.params[method]\n # Final list of arguments to the function\n args = []\n # Final list of keyword arguments to the function\n kwargs = {}\n\n if type(params) is dict:\n for arg_name in self.spec[method]['required']:\n if arg_name not in params.keys():\n self.fail(\"{} is required for {}\".format(arg_name, method))\n args.append(params[arg_name])\n\n for kwarg_name in self.spec[method]['optional']:\n if kwarg_name in params.keys():\n kwargs[kwarg_name] = params[kwarg_name]\n\n elif type(params) is list:\n args = params\n else:\n args = [params]\n\n ret = getattr(self, method)(*args, **kwargs)\n\n self.message['debug']['method'] = method\n self.message['debug']['args'] = args\n self.message['debug']['kwargs'] = kwargs\n self.message['debug']['params'] = params\n\n self.message['gc_return'] = ret", "metadata": "root.GirderClientModule.__process", "header": "['class', 'GirderClientModule', '(', 'GirderClient', ')', ':', '___NEWLINE___', '___NL___', \"# Exclude these methods from both 'raw' mode\", '___NL___', '___EOS___']", "index": 524 }, { "content": " def plugins(self, *plugins):\n import json\n ret = []\n\n available_plugins = self.get(\"system/plugins\")\n self.message['debug']['available_plugins'] = available_plugins\n\n plugins = set(plugins)\n enabled_plugins = set(available_plugins['enabled'])\n\n # Could maybe be expanded to handle all regular expressions?\n if \"*\" in plugins:\n plugins = set(available_plugins['all'].keys())\n\n # Fail if plugins are passed in that are not available\n if not plugins <= set(available_plugins[\"all\"].keys()):\n self.fail(\"{}, not available!\".format(\n \",\".join(list(plugins - set(available_plugins['all'].keys())))\n ))\n\n # If we're trying to ensure plugins are present\n if self.module.params['state'] == 'present':\n # If plugins is not a subset of enabled plugins:\n if not plugins <= enabled_plugins:\n # Put the union of enabled_plugins nad plugins\n ret = self.put(\"system/plugins\",\n {\"plugins\":\n json.dumps(list(plugins | enabled_plugins))})\n self.changed = True\n\n # If we're trying to ensure plugins are absent\n elif self.module.params['state'] == 'absent':\n # If there are plugins in the list that are enabled\n if len(enabled_plugins & plugins):\n\n # Put the difference of enabled_plugins and plugins\n ret = self.put(\"system/plugins\",\n {\"plugins\":\n json.dumps(list(enabled_plugins - plugins))})\n self.changed = True\n\n return ret", "metadata": "root.GirderClientModule.plugins", "header": "['class', 'GirderClientModule', '(', 'GirderClient', ')', ':', '___NEWLINE___', '___NL___', \"# Exclude these methods from both 'raw' mode\", '___NL___', '___EOS___']", "index": 556 }, { "content": " def user(self, login, password, firstName=None,\n lastName=None, email=None, admin=False):\n\n if self.module.params['state'] == 'present':\n\n # Fail if we don't have firstName, lastName and email\n for var_name, var in [('firstName', firstName),\n ('lastName', lastName), ('email', email)]:\n if var is None:\n self.fail(\"{} must be set if state \"\n \"is 'present'\".format(var_name))\n\n try:\n ret = self.authenticate(username=login,\n password=password)\n\n me = self.get(\"user/me\")\n\n # List of fields that can actually be updated\n updateable = ['firstName', 'lastName', 'email', 'admin']\n passed_in = [firstName, lastName, email, admin]\n\n # If there is actually an update to be made\n if set([(k, v) for k, v in me.items() if k in updateable]) ^ \\\n set(zip(updateable, passed_in)):\n\n self.put(\"user/{}\".format(me['_id']),\n parameters={\n \"login\": login,\n \"firstName\": firstName,\n \"lastName\": lastName,\n \"password\": password,\n \"email\": email,\n \"admin\": \"true\" if admin else \"false\"})\n self.changed = True\n # User does not exist (with this login info)\n except AuthenticationError:\n ret = self.post(\"user\", parameters={\n \"login\": login,\n \"firstName\": firstName,\n \"lastName\": lastName,\n \"password\": password,\n \"email\": email,\n \"admin\": \"true\" if admin else \"false\"\n })\n self.changed = True\n\n elif self.module.params['state'] == 'absent':\n ret = []\n try:\n ret = self.authenticate(username=login,\n password=password)\n\n me = self.get(\"user/me\")\n\n self.delete('user/{}'.format(me['_id']))\n self.changed = True\n # User does not exist (with this login info)\n except AuthenticationError:\n ret = []\n\n return ret", "metadata": "root.GirderClientModule.user", "header": "['class', 'GirderClientModule', '(', 'GirderClient', ')', ':', '___NEWLINE___', '___NL___', \"# Exclude these methods from both 'raw' mode\", '___NL___', '___EOS___']", "index": 599 }, { "content": " def __validate_hdfs_assetstore(self, *args, **kwargs):\n # Check if hdfs plugin is available, enable it if it isn't\n pass", "metadata": "root.GirderClientModule.__validate_hdfs_assetstore", "header": "['class', 'GirderClientModule', '(', 'GirderClient', ')', ':', '___NEWLINE___', '___NL___', \"# Exclude these methods from both 'raw' mode\", '___NL___', '___EOS___']", "index": 669 }, { "content": " def assetstore(self, name, type, root=None, db=None, mongohost=None,\n replicaset='', bucket=None, prefix='', accessKeyId=None,\n secret=None, service='s3.amazonaws.com', host=None,\n port=None, path=None, user=None, webHdfsPort=None,\n readOnly=False, current=False):\n\n # Fail if somehow we have an asset type not in assetstore_types\n if type not in self.assetstore_types.keys():\n self.fail(\"assetstore type {} is not implemented!\".format(type))\n\n argument_hash = {\n \"filesystem\": {'name': name,\n 'type': self.assetstore_types[type],\n 'root': root},\n \"gridfs\": {'name': name,\n 'type': self.assetstore_types[type],\n 'db': db,\n 'mongohost': mongohost,\n 'replicaset': replicaset},\n \"s3\": {'name': name,\n 'type': self.assetstore_types[type],\n 'bucket': bucket,\n 'prefix': prefix,\n 'accessKeyId': accessKeyId,\n 'secret': secret,\n 'service': service},\n 'hdfs': {'name': name,\n 'type': self.assetstore_types[type],\n 'host': host,\n 'port': port,\n 'path': path,\n 'user': user,\n 'webHdfsPort': webHdfsPort}\n }\n\n # Fail if we don't have all the required attributes\n # for this asset type\n for k, v in argument_hash[type].items():\n if v is None:\n self.fail(\"assetstores of type \"\n \"{} require attribute {}\".format(type, k))\n\n # Set optional arguments in the hash\n argument_hash[type]['readOnly'] = readOnly\n argument_hash[type]['current'] = current\n\n ret = []\n # Get the current assetstores\n assetstores = {a['name']: a for a in self.get(\"assetstore\")}\n\n self.message['debug']['assetstores'] = assetstores\n\n # If we want the assetstore to be present\n if self.module.params['state'] == 'present':\n\n # And the asset store exists\n if name in assetstores.keys():\n\n id = assetstores[name]['_id']\n\n ####\n # Fields that could potentially be updated\n #\n # This is necessary because there are fields in the assetstores\n # that do not hash (e.g., capacity) and fields in the\n # argument_hash that are not returned by 'GET' assetstore (e.g.\n # readOnly). We could be more precise about this\n # (e.g., by only checking items that are relevant to this type)\n # but readability suffers.\n updateable = [\"root\", \"mongohost\", \"replicaset\", \"bucket\",\n \"prefix\", \"db\", \"accessKeyId\", \"secret\",\n \"service\", \"host\", \"port\", \"path\", \"user\",\n \"webHdfsPort\", \"current\"]\n\n # tuples of (key, value) for fields that can be updated\n # in the assetstore\n assetstore_items = set((k, assetstores[name][k])\n for k in updateable\n if k in assetstores[name].keys())\n\n # tuples of (key, value) for fields that can be updated\n # in the argument_hash for this assetstore type\n arg_hash_items = set((k, argument_hash[type][k])\n for k in updateable\n if k in argument_hash[type].keys())\n\n # if arg_hash_items not a proper subset of assetstore_items\n if not arg_hash_items <= assetstore_items:\n # Update\n ret = self.put(\"assetstore/{}\".format(id),\n parameters=argument_hash[type])\n\n self.changed = True\n\n # And the asset store does not exist\n else:\n try:\n # If __validate_[type]_assetstore exists then call the\n # function with argument_hash. E.g., to check if the\n # HDFS plugin is enabled\n getattr(self, \"__validate_{}_assetstore\"\n .format(type))(**argument_hash)\n except AttributeError:\n pass\n\n ret = self.post(\"assetstore\",\n parameters=argument_hash[type])\n self.changed = True\n # If we want the assetstore to be gone\n elif self.module.params['state'] == 'absent':\n # And the assetstore exists\n if name in assetstores.keys():\n id = assetstores[name]['_id']\n ret = self.delete(\"assetstore/{}\".format(id),\n parameters=argument_hash[type])\n\n return ret", "metadata": "root.GirderClientModule.assetstore", "header": "['class', 'GirderClientModule', '(', 'GirderClient', ')', ':', '___NEWLINE___', '___NL___', \"# Exclude these methods from both 'raw' mode\", '___NL___', '___EOS___']", "index": 673 }, { "content": "def main():\n \"\"\"Entry point for ansible girder client module\n\n :returns: Nothing\n :rtype: NoneType\n\n \"\"\"\n\n # Default spec for initalizing and authenticating\n argument_spec = {\n # __init__\n 'host': dict(),\n 'port': dict(),\n 'apiRoot': dict(),\n 'scheme': dict(),\n 'dryrun': dict(),\n 'blacklist': dict(),\n\n # authenticate\n 'username': dict(),\n 'password': dict(),\n 'token': dict(),\n\n # General\n 'state': dict(default=\"present\", choices=['present', 'absent'])\n }\n\n gcm = GirderClientModule()\n\n for method in gcm.required_one_of:\n argument_spec[method] = dict()\n\n module = AnsibleModule(\n argument_spec=argument_spec,\n required_one_of=[gcm.required_one_of,\n [\"token\", \"username\", \"user\"]],\n required_together=[[\"username\", \"password\"]],\n mutually_exclusive=gcm.required_one_of,\n supports_check_mode=False)\n\n if not HAS_GIRDER_CLIENT:\n module.fail_json(msg=\"Could not import GirderClient!\")\n\n try:\n gcm(module)\n\n except HttpError as e:\n import traceback\n module.fail_json(msg=\"{}:{}\\n{}\\n{}\".format(e.__class__, str(e),\n e.responseText,\n traceback.format_exc()))\n except Exception as e:\n import traceback\n # exc_type, exc_obj, exec_tb = sys.exc_info()\n module.fail_json(msg=\"{}: {}\\n\\n{}\".format(e.__class__,\n str(e),\n traceback.format_exc()))", "metadata": "root.main", "header": "['module', '___EOS___']", "index": 792 } ]
[]
[]
0
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#!", "/", "usr", "/", "bin", "/", "python_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "-*-", " ", "codi", "ng", ":", " ", "utf", "-", "8", " ", "-*-", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "###########", "###########", "###########", "###########", "###########", "###########", "###########", "##", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "Copy", "right", " ", "Kit", "ware", " ", "Inc", "._", "\\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_", "#", " ", "Ans", "ibl", "e", "'", "s", " ", "module", " ", "magic", " ", "require", "s", " ", "this", " ", "to", " ", "be_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "'", "from", " ", "ansi", "ble", ".", "module", "\\u", "util", "s", ".", "basic", " ", "import", " ", "*'", " ", "other", "wis", "e", " ", "it", " ", "will", " ", "error", " ", "out", ".", " ", "See", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "https", "://", "git", "hub", ".", "com", "/", "ansi", "ble", "/", "ansi", "ble", "/", "blob", "/", "v1", ".9", ".4", "-1", "/", "lib", "/", "ansi", "ble", "/", "module", "\\u", "common", ".", "py", "#", "L4", "1", "-", "L", "59_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "For", " ", "more", " ", "informati", "on", " ", "on", " ", "this", " ", "magic", ".", " ", "For", " ", "now", " ", "we", " ", "no", "qa", " ", "to", " ", "prevent", " ", "flake", "8", " ", "errors_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "ansible_", "._", "module", "\\u", "utils_", "._", "basic_", "import_", "*_", "#", " ", "no", "qa_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "inspect_", "import_", "getmember", "s_", ",_", "isme", "thod", "_", ",_", "getargs", "pec_", "\\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_", "girder", "\\u", "client_", "import_", "Gir", "der", "Client_", ",_", "Auth", "entica", "tion", "Error_", ",_", "Http", "Error_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "HAS", "\\u", "GI", "RD", "ER", "\\u", "CLIENT_", "=_", "True_", "\\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 ", " _", "HAS", "\\u", "GI", "RD", "ER", "\\u", "CLIENT_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "DOCUMENT", "ATION_", "=_", "'''", "\\", "10", ";", "---", "\\", "10", ";", "module", ":", " ", "girder", "\\", "10", ";", "author", ":", " ", "\"", "Chr", "is", " ", "Ko", "tfi", "la", " ", "(", "chris", ".", "kot", "fila", "@", "kit", "ware", ".", "com", ")", "\\", "10", ";", "version", "\\u", "adde", "d", ":", " ", "\"", "0.", "1", "\"", "\\", "10", ";", "short", "\\u", "description", ":", " ", "A", " ", "module", " ", "tha", "t", " ", "wrap", "s", " ", "girder", "\\u", "client", "\\", "10", ";", "require", "ment", "s", ":", " ", "[", " ", "girder", "\\u", "client", "==", "1.1", ".0", " ", "]", "\\", "10", ";", "description", ":", "\\", "10", ";", " ", " ", " ", "-", " ", "Manage", " ", "a", " ", "girder", " ", "instance", " ", "usi", "ng", " ", "the", " ", "REST", "ful", " ", "API", "\\", "10", ";", "options", ":", "\\", "10", ";", " ", " ", " ", " ", "host", ":", "\\", "10", ";", " ", " ", " ", " ", "require", "d", ":", " ", "fal", "se", "\\", "10", ";", " ", " ", " ", " ", "default", ":", " ", "'", "local", "host", "'", "\\", "10", ";", " ", " ", " ", " ", "description", ":", "\\", "10", ";", " ", " ", " ", " ", "-", " ", "domain", " ", "or", " ", "IP", " ", "of", " ", "the", " ", "host", " ", "runn", "ing", " ", "girder", "\\", "10", ";", " ", " ", " ", " ", "port", ":", "\\", "10", ";", " ", " ", " ", " ", "require", "d", ":", " ", "fal", "se", "\\", "10", ";", " ", " ", " ", " ", "default", ":", " ", "'", "80", "'", " ", "for", " ", "http", ",", " ", "'", "443", "'", " ", "for", " ", "https", "\\", "10", ";", " ", " ", " ", " ", "description", ":", "\\", "10", ";", " ", " ", " ", " ", "-", " ", "port", " ", "the", " ", "girder", " ", "instance", " ", "is", " ", "runn", "ing", " ", "on", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "api", "Roo", "t", ":", "\\", "10", ";", " ", " ", " ", " ", "require", "d", ":", " ", "fal", "se", "\\", "10", ";", " ", " ", " ", " ", "default", ":", " ", "'/", "api", "/", "v1", "'", "\\", "10", ";", " ", " ", " ", " ", "description", ":", "\\", "10", ";", " ", " ", " ", " ", "-", " ", "path", " ", "on", " ", "server", " ", "correspond", "ing", " ", "to", " ", "the", " ", "root", " ", "of", " ", "Gir", "der", " ", "REST", " ", "API", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "sche", "me", ":", "\\", "10", ";", " ", " ", " ", " ", "require", "d", ":", " ", "fal", "se", "\\", "10", ";", " ", " ", " ", " ", "default", ":", " ", "'", "http", "'", "\\", "10", ";", " ", " ", " ", " ", "description", ":", "\\", "10", ";", " ", " ", " ", " ", "-", " ", "A", " ", "string", " ", "contain", "ing", " ", "the", " ", "sche", "me", " ", "for", " ", "the", " ", "Gir", "der", " ", "host", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "dry", "run", ":", "\\", "10", ";", " ", " ", " ", " ", "require", "d", ":", " ", "fal", "se", "\\", "10", ";", " ", " ", " ", " ", "default", ":", " ", "Non", "e", " ", "(", "pass", "ed", " ", "through", ")", "\\", "10", ";", " ", " ", " ", " ", "description", ":", "\\", "10", ";", " ", " ", " ", " ", "-", " ", "See", " ", "Gir", "der", "Client", ".\\u", "\\u", "init", "\\u\\u()", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "blacklist", ":", "\\", "10", ";", " ", " ", " ", " ", "require", "d", ":", " ", "fal", "se", "\\", "10", ";", " ", " ", " ", " ", "default", ":", " ", "Non", "e", " ", "(", "pass", "ed", " ", "through", ")", "\\", "10", ";", " ", " ", " ", " ", "description", ":", "\\", "10", ";", " ", " ", " ", " ", "-", " ", "See", " ", "Gir", "der", "Client", ".\\u", "\\u", "init", "\\u\\u()", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "user", "name", ":", "\\", "10", ";", " ", " ", " ", " ", "require", "d", ":", " ", "true", "\\", "10", ";", " ", " ", " ", " ", "description", ":", "\\", "10", ";", " ", " ", " ", " ", "-", " ", "Valid", " ", "user", "name", " ", "for", " ", "the", " ", "system", "\\", "10", ";", " ", " ", " ", " ", "-", " ", "Requ", "ired", " ", "with", " ", "password", "\\", "10", ";", " ", " ", " ", " ", "-", " ", "must", " ", "be", " ", "specified", " ", "if", " ", "'", "token", "'", " ", "is", " ", "not", " ", "specified", "\\", "10", ";", " ", " ", " ", " ", "-", " ", "(", "See", " ", "note", " ", "on", " ", "'", "user", "')", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "password", ":", "\\", "10", ";", " ", " ", " ", " ", "require", "d", ":", " ", "true", "\\", "10", ";", " ", " ", " ", " ", "description", ":", "\\", "10", ";", " ", " ", " ", " ", "-", " ", "Valid", " ", "password", " ", "for", " ", "the", " ", "system", "\\", "10", ";", " ", " ", " ", " ", "-", " ", "Requ", "ired", " ", "with", " ", "user", "name", "\\", "10", ";", " ", " ", " ", " ", "-", " ", "must", " ", "be", " ", "specified", " ", "if", " ", "'", "token", "'", " ", "is", " ", "not", " ", "specified", "\\", "10", ";", " ", " ", " ", " ", "-", " ", "(", "See", " ", "note", " ", "on", " ", "'", "user", "')", "\\", "10", ";", " ", " ", " ", " ", "token", ":", "\\", "10", ";", " ", " ", " ", " ", "require", "d", ":", " ", "true", "\\", "10", ";", " ", " ", " ", " ", "description", ":", "\\", "10", ";", " ", " ", " ", " ", "-", " ", "A", " ", "girder", " ", "client", " ", "token", "\\", "10", ";", " ", " ", " ", " ", "-", " ", "Can", " ", "be", " ", "retrieved", " ", "by", " ", "accessi", "ng", " ", "the", " ", "accessi", "ng", " ", "the", " ", "'", "token", "'", " ", "attribute", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "from", " ", "a", " ", "success", "full", "y", " ", "authenticat", "ed", " ", "call", " ", "to", " ", "girder", " ", "in", " ", "a", " ", "previ", "ous", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "task", ".", "\\", "10", ";", " ", " ", " ", " ", "-", " ", "Requ", "ired", " ", "if", " ", "'", "user", "name", "'", " ", "and", " ", "'", "password", "'", " ", "are", " ", "not", " ", "specified", "\\", "10", ";", " ", " ", " ", " ", "-", " ", "(", "See", " ", "note", " ", "on", " ", "'", "user", "')", "\\", "10", ";", " ", " ", " ", " ", "state", ":", "\\", "10", ";", " ", " ", " ", " ", "require", "d", ":", " ", "fal", "se", "\\", "10", ";", " ", " ", " ", " ", "default", ":", " ", "\"", "presen", "t", "\"", "\\", "10", ";", " ", " ", " ", " ", "choice", "s", ":", " ", "[\"", "presen", "t", "\",", " ", "\"", "absen", "t", "\"]", "\\", "10", ";", " ", " ", " ", " ", "description", ":", "\\", "10", ";", " ", " ", " ", " ", "-", " ", "Us", "ed", " ", "to", " ", "indicat", "e", " ", "the", " ", "presen", "ce", " ", "or", " ", "absen", "ce", " ", "of", " ", "a", " ", "resource", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "-", " ", "e", ".", "g", ".,", " ", " ", "user", ",", " ", "plugin", ",", " ", "asset", "store", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "user", ":", "\\", "10", ";", " ", " ", " ", " ", "require", "d", ":", " ", "fal", "se", "\\", "10", ";", " ", " ", " ", " ", "description", ":", "\\", "10", ";", " ", " ", " ", " ", "-", " ", "If", " ", "usi", "ng", " ", "the", " ", "'", "user", "'", " ", "task", ",", " ", "you", " ", "are", " ", "NOT", " ", "REQUIRE", "D", " ", "to", " ", "pass", " ", "in", " ", "a", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "'", "user", "name", "'", " ", "&", " ", "'", "password", "',", " ", " ", "or", " ", "a", " ", "'", "token", "'", " ", "attribute", "s", ".", " ", "Thi", "s", " ", "is", " ", "bec", "aus", "e", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "the", " ", "first", " ", "user", " ", "created", " ", "on", " ", "an", " ", "fresh", " ", "install", " ", "of", " ", "girder", " ", "is", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "automati", "call", "y", " ", "made", " ", "an", " ", "administrati", "ve", " ", "user", ".", " ", "On", "ce", " ", "you", " ", "are", " ", "cert", "ain", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "you", " ", "have", " ", "an", " ", "admin", " ", "user", " ", "you", " ", "shou", "ld", " ", "use", " ", "tho", "se", " ", "cred", "ential", "s", " ", "in", " ", "all", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "subsequen", "t", " ", "task", "s", " ", "tha", "t", " ", "use", " ", "the", " ", "'", "user", "'", " ", "task", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "-", " ", "Tak", "es", " ", "a", " ", "mapping", " ", "of", " ", "key", " ", "value", " ", "pair", "s", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "options", ":", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "login", ":", "\\", "10", ";", " ", " ", " ", " ", "require", "d", ":", " ", "true", "\\", "10", ";", " ", " ", " ", " ", "description", ":", "\\", "10", ";", " ", " ", " ", " ", "-", " ", "The", " ", "login", " ", "name", " ", "of", " ", "the", " ", "user", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "password", ":", "\\", "10", ";", " ", " ", " ", " ", "require", "d", ":", " ", "true", "\\", "10", ";", " ", " ", " ", " ", "description", ":", "\\", "10", ";", " ", " ", " ", " ", "-", " ", "The", " ", "password", " ", "of", " ", "the", " ", "user", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "first", "Name", ":", "\\", "10", ";", " ", " ", " ", " ", "require", "d", ":", " ", "fal", "se", "\\", "10", ";", " ", " ", " ", " ", "default", ":", " ", "pass", " ", "through", " ", "to", " ", "girder", " ", "client", "\\", "10", ";", " ", " ", " ", " ", "description", ":", "\\", "10", ";", " ", " ", " ", " ", "-", " ", "The", " ", "first", " ", "name", " ", "of", " ", "the", " ", "user", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "last", "Name", ":", "\\", "10", ";", " ", " ", " ", " ", "require", "d", ":", " ", "fal", "se", "\\", "10", ";", " ", " ", " ", " ", "default", ":", " ", "pass", " ", "through", " ", "to", " ", "girder", " ", "client", "\\", "10", ";", " ", " ", " ", " ", "description", ":", "\\", "10", ";", " ", " ", " ", " ", "-", " ", "The", " ", "last", " ", "name", " ", "of", " ", "the", " ", "user", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "email", ":", "\\", "10", ";", " ", " ", " ", " ", "require", "d", ":", " ", "fal", "se", "\\", "10", ";", " ", " ", " ", " ", "default", ":", " ", "pass", " ", "through", " ", "to", " ", "girder", " ", "client", "\\", "10", ";", " ", " ", " ", " ", "description", ":", "\\", "10", ";", " ", " ", " ", " ", "-", " ", "The", " ", "email", " ", "of", " ", "the", " ", "user", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "admin", ":", "\\", "10", ";", " ", " ", " ", " ", "require", "d", ":", " ", "fal", "se", "\\", "10", ";", " ", " ", " ", " ", "default", ":", " ", "fal", "se", "\\", "10", ";", " ", " ", " ", " ", "description", ":", "\\", "10", ";", " ", " ", " ", " ", "-", " ", "If", " ", "true", ",", " ", " ", "make", " ", "the", " ", "user", " ", "an", " ", "administrat", "or", ".", "\\", "10", ";", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "plugin", ":", "\\", "10", ";", " ", " ", " ", " ", "require", "d", ":", " ", "fal", "se", "\\", "10", ";", " ", " ", " ", " ", "description", ":", "\\", "10", ";", " ", " ", " ", " ", "-", " ", "Speci", "fy", " ", "what", " ", "plugin", "s", " ", "shou", "ld", " ", "be", " ", "activat", "ed", " ", "(", "state", ":", " ", "presen", "t", ")", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "or", " ", "deactivate", "d", " ", "(", "state", ":", " ", "absen", "t", ").", "\\", "10", ";", " ", " ", " ", " ", "-", " ", "Tak", "es", " ", "a", " ", "list", " ", "of", " ", "plugin", " ", "names", ",", " ", " ", "incorrect", " ", "names", " ", "are", " ", "silently", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "ignore", "d", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "asset", "store", ":", "\\", "10", ";", " ", " ", " ", " ", "require", "d", ":", " ", "fal", "se", "\\", "10", ";", " ", " ", " ", " ", "description", ":", "\\", "10", ";", " ", " ", " ", " ", "-", " ", "Specifie", "s", " ", "an", " ", "asset", "store", "\\", "10", ";", " ", " ", " ", " ", "-", " ", "Tak", "es", " ", "many", " ", "options", " ", "depend", "ing", " ", "on", " ", "'", "type", "'", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "options", ":", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "name", ":", "\\", "10", ";", " ", " ", " ", " ", "require", "d", ":", " ", "true", "\\", "10", ";", " ", " ", " ", " ", "description", ":", "\\", "10", ";", " ", " ", " ", " ", "-", " ", "Name", " ", "of", " ", "the", " ", "asset", "store", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "type", ":", "\\", "10", ";", " ", " ", " ", " ", "require", "d", ":", " ", "true", "\\", "10", ";", " ", " ", " ", " ", "choice", "s", ":", " ", "['", "filesystem", "',", " ", "'", "grid", "fs", "',", " ", "'", "s3", "',", " ", "'", "hdfs", "']", "\\", "10", ";", " ", " ", " ", " ", "description", ":", "\\", "10", ";", " ", " ", " ", " ", "-", " ", "Curr", "ent", "ly", " ", "only", " ", "'", "filesystem", "'", " ", "has", " ", "bee", "n", " ", "tested", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "read", "On", "ly", ":", "\\", "10", ";", " ", " ", " ", " ", "require", "d", ":", " ", "fal", "se", "\\", "10", ";", " ", " ", " ", " ", "default", ":", " ", "fal", "se", "\\", "10", ";", " ", " ", " ", " ", "description", ":", "\\", "10", ";", " ", " ", " ", " ", "-", " ", "Sho", "ul", "d", " ", "the", " ", "asset", "store", " ", "be", " ", "read", " ", "only", "?", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "current", ":", "\\", "10", ";", " ", " ", " ", " ", "require", "d", ":", " ", "fal", "se", "\\", "10", ";", " ", " ", " ", " ", "default", ":", " ", "fal", "se", "\\", "10", ";", " ", " ", " ", " ", "description", ":", "\\", "10", ";", " ", " ", " ", " ", "-", " ", "Sho", "ul", "d", " ", "the", " ", "asset", "store", " ", "be", " ", "set", " ", "as", " ", "the", " ", "current", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "asset", "store", "?", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "options", " ", "(", "filesystem", "):", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "root", ":", "\\", "10", ";", " ", " ", " ", " ", "require", "d", ":", " ", "true", "\\", "10", ";", " ", " ", " ", " ", "description", ":", "\\", "10", ";", " ", " ", " ", " ", "-", " ", " ", "Files", "yste", "m", " ", "path", " ", "to", " ", "the", " ", "asset", "store", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "options", " ", "(", "grid", "fs", ")", " ", "(", "EXPERIMENT", "AL", "):", "\\", "10", ";", " ", "db", ":", "\\", "10", ";", " ", " ", " ", " ", " ", "require", "d", ":", " ", "true", "\\", "10", ";", " ", " ", " ", " ", " ", "description", ":", "\\", "10", ";", " ", " ", " ", " ", " ", "-", " ", "databa", "se", " ", "name", "\\", "10", ";", " ", "mongo", "host", ":", "\\", "10", ";", " ", " ", " ", " ", " ", "require", "d", ":", " ", "true", "\\", "10", ";", " ", " ", " ", " ", " ", "description", ":", "\\", "10", ";", " ", " ", " ", " ", " ", "-", " ", "Mon", "go", " ", "host", " ", "URI", "\\", "10", ";", "\\", "10", ";", " ", "replica", "set", ":", "\\", "10", ";", " ", " ", " ", " ", " ", "require", "d", ":", " ", "fal", "se", "\\", "10", ";", " ", " ", " ", " ", " ", "default", ":", " ", "''", "\\", "10", ";", " ", " ", " ", " ", " ", "description", ":", "\\", "10", ";", " ", " ", " ", " ", " ", "-", " ", "Replica", " ", "set", " ", "name", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "options", " ", "(", "s3", ")", " ", "(", "EXPERIMENT", "AL", "):", "\\", "10", ";", " ", "bucket", ":", "\\", "10", ";", " ", " ", " ", " ", " ", "require", "d", ":", " ", "true", "\\", "10", ";", " ", " ", " ", " ", " ", "description", ":", "\\", "10", ";", " ", " ", " ", " ", " ", "-", " ", "The", " ", "S", "3", " ", "bucket", " ", "to", " ", "store", " ", "data", " ", "in", "\\", "10", ";", "\\", "10", ";", " ", "prefix", ":", "\\", "10", ";", " ", " ", " ", " ", " ", "require", "d", ":", " ", "true", "\\", "10", ";", " ", " ", " ", " ", " ", "description", ":", "\\", "10", ";", " ", " ", " ", " ", " ", "-", " ", "Optio", "nal", " ", "path", " ", "prefix", " ", "within", " ", "the", " ", "bucket", " ", "under", " ", "whi", "ch", "\\", "10", ";", " ", " ", " ", "files", " ", "will", " ", "be", " ", "store", "d", "\\", "10", ";", "\\", "10", ";", " ", "access", "Key", "Id", ":", "\\", "10", ";", " ", " ", " ", " ", " ", "require", "d", ":", " ", "true", "\\", "10", ";", " ", " ", " ", " ", " ", "description", ":", "\\", "10", ";", " ", " ", " ", " ", " ", "-", " ", "the", " ", "AW", "S", " ", "access", " ", "key", " ", "ID", " ", "to", " ", "use", " ", "for", " ", "authenticat", "ion", "\\", "10", ";", "\\", "10", ";", " ", "secret", ":", "\\", "10", ";", " ", " ", " ", " ", " ", "require", "d", ":", " ", "true", "\\", "10", ";", " ", " ", " ", " ", " ", "description", ":", "\\", "10", ";", " ", " ", " ", " ", " ", "-", " ", "the", " ", "AW", "S", " ", "secret", " ", "key", " ", "to", " ", "use", " ", "for", " ", "authenticat", "ion", "\\", "10", ";", "\\", "10", ";", " ", "service", ":", "\\", "10", ";", " ", " ", " ", " ", " ", "require", "d", ":", " ", "fal", "se", "\\", "10", ";", " ", " ", " ", " ", " ", "default", ":", " ", "s3", ".", "amaz", "ona", "ws", ".", "com", "\\", "10", ";", " ", " ", " ", " ", " ", "description", ":", "\\", "10", ";", " ", " ", " ", " ", " ", "-", " ", "The", " ", "S", "3", " ", "service", " ", "host", " ", "(", "for", " ", "S", "3", " ", "type", ")", "\\", "10", ";", " ", " ", " ", " ", " ", "-", " ", "Thi", "s", " ", "can", " ", "be", " ", "used", " ", "to", " ", "speci", "fy", " ", "a", " ", "protoc", "ol", " ", "and", " ", "port", "\\", "10", ";", " ", " ", " ", "-", " ", " ", "use", " ", "the", " ", "form", " ", "[", "http", "[", "s", "]:", "//", "](", "host", " ", "domain", ")[", ":(", "port", ")]", "\\", "10", ";", " ", " ", " ", " ", " ", "-", " ", "Do", " ", "not", " ", "include", " ", "the", " ", "bucket", " ", "name", " ", "here", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "options", " ", "(", "hdfs", ")", " ", "(", "EXPERIMENT", "AL", "):", "\\", "10", ";", " ", "host", ":", "\\", "10", ";", " ", " ", " ", " ", " ", "require", "d", ":", " ", "true", "\\", "10", ";", " ", " ", " ", " ", " ", "description", ":", "\\", "10", ";", " ", " ", " ", " ", " ", "-", " ", "Non", "e", "\\", "10", ";", " ", "port", ":", "\\", "10", ";", " ", " ", " ", " ", " ", "require", "d", ":", " ", "true", "\\", "10", ";", " ", " ", " ", " ", " ", "description", ":", "\\", "10", ";", " ", " ", " ", " ", " ", "-", " ", "Non", "e", "\\", "10", ";", " ", "path", ":", "\\", "10", ";", " ", " ", " ", " ", " ", "require", "d", ":", " ", "true", "\\", "10", ";", " ", " ", " ", " ", " ", "description", ":", "\\", "10", ";", " ", " ", " ", " ", " ", "-", " ", "Non", "e", "\\", "10", ";", " ", "user", ":", "\\", "10", ";", " ", " ", " ", " ", " ", "require", "d", ":", " ", "true", "\\", "10", ";", " ", " ", " ", " ", " ", "description", ":", "\\", "10", ";", " ", " ", " ", " ", " ", "-", " ", "Non", "e", "\\", "10", ";", " ", "web", "Hd", "fs", "Port", "\\", "10", ";", " ", " ", " ", " ", " ", "require", "d", ":", " ", "true", "\\", "10", ";", " ", " ", " ", " ", " ", "description", ":", "\\", "10", ";", " ", " ", " ", " ", " ", "-", " ", "Non", "e", "\\", "10", ";", "\\", "10", ";'", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "EXAMPLES", "_", "=_", "'''", "\\", "10", ";", "\\", "10", ";", "\\", "10", ";", "###########", "##", "\\", "10", ";", "#", " ", "Exam", "ple", " ", "usi", "ng", " ", "'", "user", "'", "\\", "10", ";", "###", "\\", "10", ";", "\\", "10", ";", "\\", "10", ";", "#", " ", "Ensur", "e", " ", "\"", "admin", "\"", " ", "user", " ", "exist", "s", "\\", "10", ";", "-", " ", "name", ":", " ", "Creat", "e", " ", "'", "admin", "'", " ", "User", "\\", "10", ";", " ", " ", "girder", ":", "\\", "10", ";", " ", " ", " ", " ", "user", ":", "\\", "10", ";", " ", " ", "first", "Name", ":", " ", "\"", "Chr", "is", "\"", "\\", "10", ";", " ", " ", "last", "Name", ":", " ", "\"", "Ko", "tfi", "la", "\"", "\\", "10", ";", " ", " ", "login", ":", " ", "\"", "admin", "\"", "\\", "10", ";", " ", " ", "password", ":", " ", "\"", "let", "mei", "n", "\"", "\\", "10", ";", " ", " ", "email", ":", " ", "\"", "chris", ".", "kot", "fila", "@", "kit", "ware", ".", "com", "\"", "\\", "10", ";", " ", " ", "admin", ":", " ", "ye", "s", "\\", "10", ";", " ", " ", " ", " ", "state", ":", " ", "presen", "t", "\\", "10", ";", "\\", "10", ";", "#", " ", "Ensur", "e", " ", "a", " ", "'", "fooba", "r", "'", " ", "user", " ", "exist", "s", "\\", "10", ";", "-", " ", "name", ":", " ", "Creat", "e", " ", "'", "fooba", "r", "'", " ", "User", "\\", "10", ";", " ", " ", "girder", ":", "\\", "10", ";", " ", " ", " ", " ", "user", "name", ":", " ", "\"", "admin", "\"", "\\", "10", ";", " ", " ", " ", " ", "password", ":", " ", "\"", "let", "mei", "n", "\"", "\\", "10", ";", " ", " ", " ", " ", "user", ":", "\\", "10", ";", " ", " ", "first", "Name", ":", " ", "\"", "Foo", "\"", "\\", "10", ";", " ", " ", "last", "Name", ":", " ", "\"", "Bar", "\"", "\\", "10", ";", " ", " ", "login", ":", " ", "\"", "fooba", "r", "\"", "\\", "10", ";", " ", " ", "password", ":", " ", "\"", "fooba", "rba", "z", "\"", "\\", "10", ";", " ", " ", "email", ":", " ", "\"", "foo", ".", "bar", "@", "kit", "ware", ".", "com", "\"", "\\", "10", ";", " ", " ", "admin", ":", " ", "ye", "s", "\\", "10", ";", " ", " ", " ", " ", "state", ":", " ", "presen", "t", "\\", "10", ";", "\\", "10", ";", "#", " ", "Remove", " ", "the", " ", "'", "fooba", "r", "'", " ", "user", "\\", "10", ";", "-", " ", "name", ":", " ", "Remove", " ", "'", "fooba", "r", "'", " ", "User", "\\", "10", ";", " ", " ", "user", "name", ":", " ", "\"", "admin", "\"", "\\", "10", ";", " ", " ", "password", ":", " ", "\"", "let", "mei", "n", "\"", "\\", "10", ";", " ", " ", "girder", ":", "\\", "10", ";", " ", " ", " ", " ", "user", ":", "\\", "10", ";", " ", " ", "login", ":", " ", "\"", "fooba", "r", "\"", "\\", "10", ";", " ", " ", "password", ":", " ", "\"", "fooba", "rba", "z", "\"", "\\", "10", ";", " ", " ", " ", " ", "state", ":", " ", "absen", "t", "\\", "10", ";", "\\", "10", ";", "\\", "10", ";", "###########", "##", "\\", "10", ";", "#", " ", "Exam", "ple", " ", "usi", "ng", " ", "'", "plugin", "s", "'", "\\", "10", ";", "###", "\\", "10", ";", "\\", "10", ";", "#", " ", "To", " ", "enable", " ", "or", " ", "disable", " ", "all", " ", "plugin", "s", " ", "you", " ", "may", " ", "pass", " ", "the", " ", "\"*", "\"", "\\", "10", ";", "#", " ", "argu", "ment", ".", " ", " ", "Thi", "s", " ", "doe", "s", " ", "not", " ", "(", "ye", "t", ")", " ", "support", " ", "arbitra", "ry", " ", "regex", "es", "\\", "10", ";", "-", " ", "name", ":", " ", "Disa", "ble", " ", "all", " ", "plugin", "s", "\\", "10", ";", " ", " ", "girder", ":", "\\", "10", ";", " ", " ", " ", " ", "user", "name", ":", " ", "\"", "admin", "\"", "\\", "10", ";", " ", " ", " ", " ", "password", ":", " ", "\"", "let", "mei", "n", "\"", "\\", "10", ";", " ", " ", " ", " ", "plugin", "s", ":", " ", "\"*", "\"", "\\", "10", ";", " ", " ", " ", " ", "state", ":", " ", "absen", "t", "\\", "10", ";", "\\", "10", ";", "-", " ", "name", ":", " ", "Enable", " ", "thumbnail", "s", " ", "plugin", "\\", "10", ";", " ", " ", "girder", ":", "\\", "10", ";", " ", " ", " ", " ", "user", "name", ":", " ", "\"", "admin", "\"", "\\", "10", ";", " ", " ", " ", " ", "password", ":", " ", "\"", "let", "mei", "n", "\"", "\\", "10", ";", " ", " ", " ", " ", "port", ":", " ", "808", "0", "\\", "10", ";", " ", " ", " ", " ", "plugin", "s", ":", "\\", "10", ";", " ", " ", "-", " ", "thumbnail", "s", "\\", "10", ";", " ", " ", " ", " ", "state", ":", " ", "presen", "t", "\\", "10", ";", "\\", "10", ";", "#", " ", "Not", "e", " ", "tha", "t", " ", "'", "thumbnail", "s", "'", " ", " ", "is", " ", "still", " ", "enable", "d", " ", "from", " ", "the", " ", "previ", "ous", " ", "task", ",", "\\", "10", ";", "#", " ", "the", " ", "'", "plugin", "s", "'", " ", "task", " ", "ensure", "s", " ", "tha", "t", " ", "plugin", "s", " ", "are", " ", "enable", "d", " ", "or", " ", "disable", "d", ",", "\\", "10", ";", "#", " ", "it", " ", "doe", "s", " ", "NOT", " ", "defin", "e", " ", "the", " ", "complete", " ", "list", " ", "of", " ", "enable", "d", " ", "or", " ", "disable", "d", " ", "plugin", "s", ".", "\\", "10", ";", "-", " ", "name", ":", " ", "Ensur", "e", " ", "jobs", " ", "and", " ", "gravatar", " ", "plugin", "s", " ", "are", " ", "enable", "d", "\\", "10", ";", " ", " ", "girder", ":", "\\", "10", ";", " ", " ", " ", " ", "user", "name", ":", " ", "\"", "admin", "\"", "\\", "10", ";", " ", " ", " ", " ", "password", ":", " ", "\"", "let", "mei", "n", "\"", "\\", "10", ";", " ", " ", " ", " ", "plugin", "s", ":", "\\", "10", ";", " ", " ", "-", " ", "jobs", "\\", "10", ";", " ", " ", "-", " ", "gravatar", "\\", "10", ";", " ", " ", " ", " ", "state", ":", " ", "presen", "t", "\\", "10", ";", "\\", "10", ";", "\\", "10", ";", "\\", "10", ";", "###########", "#", "\\", "10", ";", "#", " ", "Files", "yste", "m", " ", "Asset", "store", " ", "Test", "s", "\\", "10", ";", "#", "\\", "10", ";", "\\", "10", ";", "-", " ", "name", ":", " ", "Creat", "e", " ", "filesystem", " ", "asset", "store", "\\", "10", ";", " ", " ", "girder", ":", "\\", "10", ";", " ", " ", " ", " ", "user", "name", ":", " ", "\"", "admin", "\"", "\\", "10", ";", " ", "password", ":", " ", "\"", "let", "mei", "n", "\"", "\\", "10", ";", " ", "asset", "store", ":", "\\", "10", ";", " ", " ", " ", "name", ":", " ", "\"", "Temp", " ", "Files", "yste", "m", " ", "Asset", "store", "\"", "\\", "10", ";", " ", " ", " ", "type", ":", " ", "\"", "filesystem", "\"", "\\", "10", ";", " ", " ", " ", "root", ":", " ", "\"/", "data", "/\"", "\\", "10", ";", " ", " ", " ", "current", ":", " ", "true", "\\", "10", ";", " ", "state", ":", " ", "presen", "t", "\\", "10", ";", "\\", "10", ";", "-", " ", "name", ":", " ", "Delete", " ", "filesystem", " ", "asset", "store", "\\", "10", ";", " ", " ", "girder", ":", "\\", "10", ";", " ", " ", " ", " ", "user", "name", ":", " ", "\"", "admin", "\"", "\\", "10", ";", " ", " ", " ", " ", "password", ":", " ", "\"", "let", "mei", "n", "\"", "\\", "10", ";", " ", " ", " ", " ", "asset", "store", ":", "\\", "10", ";", " ", " ", "name", ":", " ", "\"", "Temp", " ", "Files", "yste", "m", " ", "Asset", "store", "\"", "\\", "10", ";", " ", " ", "type", ":", " ", "\"", "filesystem", "\"", "\\", "10", ";", " ", " ", "root", ":", " ", "\"/", "tmp", "/\"", "\\", "10", ";", " ", " ", " ", " ", "state", ":", " ", "absen", "t", "\\", "10", ";", "\\", "10", ";", "###########", "#", "\\", "10", ";", "#", " ", "Exam", "ples", " ", "usi", "ng", " ", "get", "\\", "10", ";", "#", "\\", "10", ";", "\\", "10", ";", "\\", "10", ";", "#", " ", "Get", " ", "my", " ", "info", "\\", "10", ";", "-", " ", "name", ":", " ", "Get", " ", "users", " ", "from", " ", "http", "://", "local", "host", ":", "80", "/", "api", "/", "v1", "/", "users", "\\", "10", ";", " ", " ", "girder", ":", "\\", "10", ";", " ", " ", " ", " ", "user", "name", ":", " ", "'", "admin", "'", "\\", "10", ";", " ", " ", " ", " ", "password", ":", " ", "'", "let", "mei", "n", "'", "\\", "10", ";", " ", " ", " ", " ", "get", ":", "\\", "10", ";", " ", " ", "path", ":", " ", "\"", "users", "\"", "\\", "10", ";", " ", " ", " ", " ", "register", ":", " ", "ret", "\\u", "val", "\\", "10", ";", "\\", "10", ";", "#", " ", "Print", "s", " ", "debugg", "ing", " ", "message", "s", " ", "with", " ", "the", " ", "email", "s", " ", "of", " ", "the", " ", "users", "\\", "10", ";", "#", " ", "Fro", "m", " ", "the", " ", "last", " ", "task", " ", "by", " ", "accessi", "ng", " ", "'", "gc", "\\u", "return", "'", " ", "of", " ", "the", " ", "register", "ed", "\\", "10", ";", "#", " ", "variab", "le", " ", "'", "ret", "\\u", "val", "'", "\\", "10", ";", "-", " ", "name", ":", " ", "print", " ", "email", "s", " ", "of", " ", "users", "\\", "10", ";", " ", " ", "debug", ":", " ", "msg", "=\"", "{{", " ", "item", "['", "email", "']", " ", "}}", "\"", "\\", "10", ";", " ", " ", "with", "\\u", "items", ":", " ", "\"{", "{", " ", "ret", "\\u", "val", "['", "gc", "\\u", "return", "']", " ", "}}", "\"", "\\", "10", ";", "\\", "10", ";", "\\", "10", ";", "###########", "##", "\\", "10", ";", "#", " ", "Advance", "d", " ", "usage", "\\", "10", ";", "#", "\\", "10", ";", "\\", "10", ";", "#", " ", "Supp", "orts", " ", "get", ",", " ", "post", ",", " ", "put", ",", " ", "delete", " ", "method", "s", ",", " ", " ", "but", " ", "doe", "s", "\\", "10", ";", "#", " ", "not", " ", "guaran", "tee", " ", "ide", "mpo", "ten", "ce", " ", "on", " ", "these", " ", "method", "s", "!", "\\", "10", ";", "\\", "10", ";", "-", " ", "name", ":", " ", "Restart", " ", "the", " ", "server", "\\", "10", ";", " ", " ", "girder", ":", "\\", "10", ";", " ", " ", " ", " ", "user", "name", ":", " ", "\"", "admin", "\"", "\\", "10", ";", " ", " ", " ", " ", "password", ":", " ", "\"", "let", "mei", "n", "\"", "\\", "10", ";", " ", " ", " ", " ", "put", ":", "\\", "10", ";", " ", " ", "path", ":", " ", "\"", "system", "/", "restart", "\"", "\\", "10", ";", "\\", "10", ";", "#", " ", "An", " ", "example", " ", "of", " ", "posting", " ", "an", " ", "item", " ", "to", " ", "Gir", "der", "\\", "10", ";", "#", " ", "Not", "e", " ", "tha", "t", " ", "this", " ", "is", " ", "NOT", " ", "idempotent", ".", " ", "Run", "ning", "\\", "10", ";", "#", " ", "multiple", " ", "times", " ", "will", " ", "create", " ", "\"", "An", " ", "Item", "\",", " ", "\"", "An", " ", "Item", " ", "(", "1", ")\"", ",", "\\", "10", ";", "#", " ", "\"", "An", " ", "Item", " ", "(", "2", ")\"", ",", " ", "etc", "..", "\\", "10", ";", "\\", "10", ";", "-", " ", "name", ":", " ", "Get", " ", "Me", "\\", "10", ";", " ", " ", "girder", ":", "\\", "10", ";", " ", " ", " ", " ", "user", "name", ":", " ", "\"", "admin", "\"", "\\", "10", ";", " ", " ", " ", " ", "password", ":", " ", "\"", "let", "mei", "n", "\"", "\\", "10", ";", " ", " ", " ", " ", "get", ":", "\\", "10", ";", " ", " ", "path", ":", " ", "\"", "user", "/", "me", "\"", "\\", "10", ";", " ", " ", "register", ":", " ", "ret", "\\", "10", ";", "\\", "10", ";", "#", " ", "Show", " ", "use", " ", "of", " ", "'", "token", "'", " ", "for", " ", "subsequen", "t", " ", "authenticat", "ion", "\\", "10", ";", "-", " ", "name", ":", " ", "Get", " ", "my", " ", "public", " ", "folder", "\\", "10", ";", " ", " ", "girder", ":", "\\", "10", ";", " ", " ", " ", " ", "token", ":", " ", "\"{", "{", " ", "ret", "['", "token", "']", " ", "}}", "\"", "\\", "10", ";", " ", " ", " ", " ", "get", ":", "\\", "10", ";", " ", " ", "path", ":", " ", "\"", "folder", "\"", "\\", "10", ";", " ", " ", "parameter", "s", ":", "\\", "10", ";", " ", " ", " ", " ", "parent", "Type", ":", " ", "\"", "user", "\"", "\\", "10", ";", " ", " ", " ", " ", "parent", "Id", ":", " ", "\"{", "{", " ", "ret", "['", "gc", "\\u", "return", "']", "['", "\\u", "id", "']", " ", "}}", "\"", "\\", "10", ";", " ", " ", " ", " ", "text", ":", " ", "\"", "Public", "\"", "\\", "10", ";", " ", " ", "register", ":", " ", "ret", "\\", "10", ";", "\\", "10", ";", "\\", "10", ";", "-", " ", "name", ":", " ", "Post", " ", "an", " ", "item", " ", "to", " ", "my", " ", "public", " ", "folder", "\\", "10", ";", " ", " ", "girder", ":", "\\", "10", ";", " ", " ", " ", " ", "host", ":", " ", "\"", "data", ".", "kit", "ware", ".", "com", "\"", "\\", "10", ";", " ", " ", " ", " ", "sche", "me", ":", " ", "'", "https", "'", "\\", "10", ";", " ", " ", " ", " ", "token", ":", " ", "\"{", "{", " ", "ret", "['", "token", "']", " ", "}}", "\"", "\\", "10", ";", " ", " ", " ", " ", "post", ":", "\\", "10", ";", " ", " ", "path", ":", " ", "\"", "item", "\"", "\\", "10", ";", " ", " ", "parameter", "s", ":", "\\", "10", ";", " ", " ", " ", " ", "folder", "Id", ":", " ", "\"{", "{", " ", "ret", "['", "gc", "\\u", "return", "']", "[", "0", "]['", "\\u", "id", "']", " ", "}}", "\"", "\\", "10", ";", " ", " ", " ", " ", "name", ":", " ", "\"", "An", " ", "Item", "\"", "\\", "10", ";", "\\", "10", ";", "\\", "10", ";'", "''_", "\\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_", "\\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 ", " _", "main_", "(_", ")_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "class", "\\u", "spec_", "(_", "cls_", ",_", "include_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "include_", "=_", "include_", "if_", "include_", "is_", "not_", "None_", "else_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "fn_", ",_", "method_", "in_", "getmember", "s_", "(_", "cls_", ",_", "predicate_", "=_", "isme", "thod", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "fn_", "in_", "include_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "spec_", "=_", "getargs", "pec_", "(_", "method_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "spec", ".", "args", "[", "1", ":]", " ", "so", " ", "we", " ", "don", "'", "t", " ", "include", " ", "'", "self", "'_", "\\u\\u\\uNL\\u\\u\\u_", "params_", "=_", "spec_", "._", "args_", "[_", "1_", ":_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "d_", "=_", "len_", "(_", "spec_", "._", "defaults_", ")_", "if_", "spec_", "._", "defaults_", "is_", "not_", "None_", "else_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "r_", "=_", "len_", "(_", "params_", ")_", "-_", "d_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "yield_", "(_", "fn_", ",_", "{_", "\"", "require", "d", "\"_", ":_", "params_", "[_", ":_", "r_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "option", "al", "\"_", ":_", "params_", "[_", "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_", "class_", "Gir", "der", "Client", "Module_", "(_", "Gir", "der", "Client_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Exclude", " ", "these", " ", "method", "s", " ", "from", " ", "bot", "h", " ", "'", "raw", "'", " ", "mode_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "include", "\\u", "methods_", "=_", "[_", "'", "get", "'_", ",_", "'", "put", "'_", ",_", "'", "post", "'_", ",_", "'", "delete", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "plugin", "s", "'_", ",_", "'", "user", "'_", ",_", "'", "asset", "store", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "debug_", "=_", "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_", "\\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_", "asset", "store", "\\u", "types_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "filesystem", "\"_", ":_", "0_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "gir", "dfs", "\"_", ":_", "1_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "s3", "\"_", ":_", "2_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "hdfs", "\"_", ":_", "\"", "hdfs", "\"_", "\\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_", "Gir", "der", "Client", "Module_", "(_", "Gir", "der", "Client_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Exclude", " ", "these", " ", "method", "s", " ", "from", " ", "bot", "h", " ", "'", "raw", "'", " ", "mode_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "exit_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "self_", "._", "\\u", "debug_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "del_", "self_", "._", "message_", "[_", "'", "debug", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "module_", "._", "exit", "\\u", "json_", "(_", "changed_", "=_", "self_", "._", "changed_", ",_", "**_", "self_", "._", "message_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Gir", "der", "Client", "Module_", "(_", "Gir", "der", "Client_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Exclude", " ", "these", " ", "method", "s", " ", "from", " ", "bot", "h", " ", "'", "raw", "'", " ", "mode_", "\\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_", "fail_", "(_", "self_", ",_", "msg_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "module_", "._", "fail", "\\u", "json_", "(_", "msg_", "=_", "msg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Gir", "der", "Client", "Module_", "(_", "Gir", "der", "Client_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Exclude", " ", "these", " ", "method", "s", " ", "from", " ", "bot", "h", " ", "'", "raw", "'", " ", "mode_", "\\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\\u", "init\\u\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "changed_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "message_", "=_", "{_", "\"", "msg", "\"_", ":_", "\"", "Success", "!\"_", ",_", "\"", "debug", "\"_", ":_", "{_", "}_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "spec_", "=_", "dict_", "(_", "class", "\\u", "spec_", "(_", "self_", "._", "\\u\\u", "class\\u\\u_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Gir", "der", "Client", "Module_", "._", "\\u", "include", "\\u", "methods_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "require", "d\\u", "one", "\\u", "of_", "=_", "self_", "._", "spec_", "._", "keys_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Gir", "der", "Client", "Module_", "(_", "Gir", "der", "Client_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Exclude", " ", "these", " ", "method", "s", " ", "from", " ", "bot", "h", " ", "'", "raw", "'", " ", "mode_", "\\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\\u", "call\\u\\u_", "(_", "self_", ",_", "module_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "module_", "=_", "module_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "super_", "(_", "Gir", "der", "Client", "Module_", ",_", "self_", ")_", "._", "\\u\\u", "init\\u\\u_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "**_", "{_", "p_", ":_", "self_", "._", "module_", "._", "params_", "[_", "p_", "]_", "for_", "p_", "in_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "'", "host", "'_", ",_", "'", "port", "'_", ",_", "'", "api", "Roo", "t", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "sche", "me", "'_", ",_", "'", "dry", "run", "'_", ",_", "'", "blacklist", "'_", "]_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "module_", "._", "params_", "[_", "p_", "]_", "is_", "not_", "None_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "If", " ", "a", " ", "user", "name", " ", "and", " ", "password", " ", "are", " ", "set_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "self_", "._", "module_", "._", "params_", "[_", "'", "user", "name", "'_", "]_", "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 ", " _", "self_", "._", "authenticate_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "username_", "=_", "self_", "._", "module_", "._", "params_", "[_", "'", "user", "name", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "password_", "=_", "self_", "._", "module_", "._", "params_", "[_", "'", "password", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Auth", "entica", "tion", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "fail_", "(_", "\"", "Cou", "ld", " ", "not", " ", "Auth", "entica", "te", "!\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "a", " ", "token", " ", "is", " ", "set_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "self_", "._", "module_", "._", "params_", "[_", "'", "token", "'_", "]_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "token_", "=_", "self_", "._", "module_", "._", "params_", "[_", "'", "token", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Else", " ", "error", " ", "if", " ", "we", "'", "re", " ", "not", " ", "try", "ing", " ", "to", " ", "create", " ", "a", " ", "user_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "self_", "._", "module_", "._", "params_", "[_", "'", "user", "'_", "]_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "fail_", "(_", "\"", "Mus", "t", " ", "pass", " ", "in", " ", "eit", "her", " ", "user", "name", " ", "&", " ", "password", ",", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "or", " ", "a", " ", "valid", " ", "girder", "\\u", "client", " ", "token", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "message_", "[_", "'", "token", "'_", "]_", "=_", "self_", "._", "token_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "method_", "in_", "self_", "._", "require", "d\\u", "one", "\\u", "of_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "module_", "._", "params_", "[_", "method_", "]_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u\\u", "process_", "(_", "method_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "exit_", "(_", ")_", "\\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_", "._", "fail_", "(_", "\"", "Cou", "ld", " ", "not", " ", "find", " ", "executable", " ", "method", "!\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Gir", "der", "Client", "Module_", "(_", "Gir", "der", "Client_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Exclude", " ", "these", " ", "method", "s", " ", "from", " ", "bot", "h", " ", "'", "raw", "'", " ", "mode_", "\\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\\u", "process_", "(_", "self_", ",_", "method_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Parameter", "s", " ", "from", " ", "the", " ", "YAM", "L", " ", "file_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "params_", "=_", "self_", "._", "module_", "._", "params_", "[_", "method_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Final", " ", "list", " ", "of", " ", "argu", "ment", "s", " ", "to", " ", "the", " ", "function_", "\\u\\u\\uNL\\u\\u\\u_", "args_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Final", " ", "list", " ", "of", " ", "keyw", "ord", " ", "argu", "ment", "s", " ", "to", " ", "the", " ", "function_", "\\u\\u\\uNL\\u\\u\\u_", "kwargs_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "type_", "(_", "params_", ")_", "is_", "dict_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "arg", "\\u", "name_", "in_", "self_", "._", "spec_", "[_", "method_", "]_", "[_", "'", "require", "d", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "arg", "\\u", "name_", "not_", "in_", "params_", "._", "keys_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "self_", "._", "fail_", "(_", "\"{}", " ", "is", " ", "require", "d", " ", "for", " ", "{}\"_", "._", "format_", "(_", "arg", "\\u", "name_", ",_", "method_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "args_", "._", "append_", "(_", "params_", "[_", "arg", "\\u", "name_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "kwarg", "\\u", "name_", "in_", "self_", "._", "spec_", "[_", "method_", "]_", "[_", "'", "option", "al", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "kwarg", "\\u", "name_", "in_", "params_", "._", "keys_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "kwargs_", "[_", "kwarg", "\\u", "name_", "]_", "=_", "params_", "[_", "kwarg", "\\u", "name_", "]_", "\\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_", "type_", "(_", "params_", ")_", "is_", "list_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "args_", "=_", "params_", "\\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 ", " _", "args_", "=_", "[_", "params_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "ret_", "=_", "getattr_", "(_", "self_", ",_", "method_", ")_", "(_", "*_", "args_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "message_", "[_", "'", "debug", "'_", "]_", "[_", "'", "method", "'_", "]_", "=_", "method_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "message_", "[_", "'", "debug", "'_", "]_", "[_", "'", "args", "'_", "]_", "=_", "args_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "message_", "[_", "'", "debug", "'_", "]_", "[_", "'", "kwarg", "s", "'_", "]_", "=_", "kwargs_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "message_", "[_", "'", "debug", "'_", "]_", "[_", "'", "params", "'_", "]_", "=_", "params_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "message_", "[_", "'", "gc", "\\u", "return", "'_", "]_", "=_", "ret_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Gir", "der", "Client", "Module_", "(_", "Gir", "der", "Client_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Exclude", " ", "these", " ", "method", "s", " ", "from", " ", "bot", "h", " ", "'", "raw", "'", " ", "mode_", "\\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_", "plugins_", "(_", "self_", ",_", "*_", "plugins_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "json_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ret_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "avail", "able", "\\u", "plugins_", "=_", "self_", "._", "get_", "(_", "\"", "system", "/", "plugin", "s", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "message_", "[_", "'", "debug", "'_", "]_", "[_", "'", "avail", "able", "\\u", "plugin", "s", "'_", "]_", "=_", "avail", "able", "\\u", "plugins_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "plugins_", "=_", "set_", "(_", "plugins_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "enable", "d\\u", "plugins_", "=_", "set_", "(_", "avail", "able", "\\u", "plugins_", "[_", "'", "enable", "d", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Cou", "ld", " ", "may", "be", " ", "be", " ", "expand", "ed", " ", "to", " ", "handle", " ", "all", " ", "regular", " ", "express", "ion", "s", "?", "_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "\"*\"_", "in_", "plugins_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "plugins_", "=_", "set_", "(_", "avail", "able", "\\u", "plugins_", "[_", "'", "all", "'_", "]_", "._", "keys_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Fail", " ", "if", " ", "plugin", "s", " ", "are", " ", "pass", "ed", " ", "in", " ", "tha", "t", " ", "are", " ", "not", " ", "available_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "plugins_", "<=_", "set_", "(_", "avail", "able", "\\u", "plugins_", "[_", "\"", "all", "\"_", "]_", "._", "keys_", "(_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "fail_", "(_", "\"{}", ",", " ", "not", " ", "avail", "able", "!\"_", "._", "format_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\",\"_", "._", "join_", "(_", "list_", "(_", "plugins_", "-_", "set_", "(_", "avail", "able", "\\u", "plugins_", "[_", "'", "all", "'_", "]_", "._", "keys_", "(_", ")_", ")_", ")_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "we", "'", "re", " ", "try", "ing", " ", "to", " ", "ensure", " ", "plugin", "s", " ", "are", " ", "present_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "module_", "._", "params_", "[_", "'", "state", "'_", "]_", "==_", "'", "presen", "t", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "If", " ", "plugin", "s", " ", "is", " ", "not", " ", "a", " ", "subse", "t", " ", "of", " ", "enable", "d", " ", "plugin", "s", ":_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "plugins_", "<=_", "enable", "d\\u", "plugins_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Put", " ", "the", " ", "uni", "on", " ", "of", " ", "enable", "d\\u", "plugin", "s", " ", "nad", " ", "plugins_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ret_", "=_", "self_", "._", "put_", "(_", "\"", "system", "/", "plugin", "s", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "\"", "plugin", "s", "\"_", ":_", "\\u\\u\\uNL\\u\\u\\u_", "json_", "._", "dumps_", "(_", "list_", "(_", "plugins_", "|_", "enable", "d\\u", "plugins_", ")_", ")_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "changed_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "we", "'", "re", " ", "try", "ing", " ", "to", " ", "ensure", " ", "plugin", "s", " ", "are", " ", "absen", "t_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "self_", "._", "module_", "._", "params_", "[_", "'", "state", "'_", "]_", "==_", "'", "absen", "t", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "If", " ", "there", " ", "are", " ", "plugin", "s", " ", "in", " ", "the", " ", "list", " ", "tha", "t", " ", "are", " ", "enabled_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "len_", "(_", "enable", "d\\u", "plugins_", "&_", "plugins_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Put", " ", "the", " ", "difference", " ", "of", " ", "enable", "d\\u", "plugin", "s", " ", "and", " ", "plugins_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ret_", "=_", "self_", "._", "put_", "(_", "\"", "system", "/", "plugin", "s", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "\"", "plugin", "s", "\"_", ":_", "\\u\\u\\uNL\\u\\u\\u_", "json_", "._", "dumps_", "(_", "list_", "(_", "enable", "d\\u", "plugins_", "-_", "plugins_", ")_", ")_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "changed_", "=_", "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_", "return_", "ret_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Gir", "der", "Client", "Module_", "(_", "Gir", "der", "Client_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Exclude", " ", "these", " ", "method", "s", " ", "from", " ", "bot", "h", " ", "'", "raw", "'", " ", "mode_", "\\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_", "user_", "(_", "self_", ",_", "login_", ",_", "password_", ",_", "first", "Name_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "last", "Name_", "=_", "None_", ",_", "email_", "=_", "None_", ",_", "admin_", "=_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "module_", "._", "params_", "[_", "'", "state", "'_", "]_", "==_", "'", "presen", "t", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Fail", " ", "if", " ", "we", " ", "don", "'", "t", " ", "have", " ", "first", "Name", ",", " ", "last", "Name", " ", "and", " ", "email_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "var", "\\u", "name_", ",_", "var_", "in_", "[_", "(_", "'", "first", "Name", "'_", ",_", "first", "Name_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "last", "Name", "'_", ",_", "last", "Name_", ")_", ",_", "(_", "'", "email", "'_", ",_", "email_", ")_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "var_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "self_", "._", "fail_", "(_", "\"{}", " ", "must", " ", "be", " ", "set", " ", "if", " ", "state", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "is", " ", "'", "presen", "t", "'\"_", "._", "format_", "(_", "var", "\\u", "name_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\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 ", " _", "ret_", "=_", "self_", "._", "authenticate_", "(_", "username_", "=_", "login_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "password_", "=_", "password_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "me_", "=_", "self_", "._", "get_", "(_", "\"", "user", "/", "me", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "List", " ", "of", " ", "fields", " ", "tha", "t", " ", "can", " ", "actual", "ly", " ", "be", " ", "updated_", "\\u\\u\\uNL\\u\\u\\u_", "update", "able_", "=_", "[_", "'", "first", "Name", "'_", ",_", "'", "last", "Name", "'_", ",_", "'", "email", "'_", ",_", "'", "admin", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pass", "ed", "\\u", "in_", "=_", "[_", "first", "Name_", ",_", "last", "Name_", ",_", "email_", ",_", "admin_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "there", " ", "is", " ", "actual", "ly", " ", "an", " ", "update", " ", "to", " ", "be", " ", "made", "_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "set_", "(_", "[_", "(_", "k_", ",_", "v_", ")_", "for_", "k_", ",_", "v_", "in_", "me_", "._", "items_", "(_", ")_", "if_", "k_", "in_", "update", "able_", "]_", ")_", "^_", "set_", "(_", "zip_", "(_", "update", "able_", ",_", "pass", "ed", "\\u", "in_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "self_", "._", "put_", "(_", "\"", "user", "/{}\"_", "._", "format_", "(_", "me_", "[_", "'\\u", "id", "'_", "]_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "parameters_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "login", "\"_", ":_", "login_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "first", "Name", "\"_", ":_", "first", "Name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "last", "Name", "\"_", ":_", "last", "Name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "password", "\"_", ":_", "password_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "email", "\"_", ":_", "email_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "admin", "\"_", ":_", "\"", "true", "\"_", "if_", "admin_", "else_", "\"", "fal", "se", "\"_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "changed_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "User", " ", "doe", "s", " ", "not", " ", "exist", " ", "(", "with", " ", "this", " ", "login", " ", "info", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Auth", "entica", "tion", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ret_", "=_", "self_", "._", "post_", "(_", "\"", "user", "\"_", ",_", "parameters_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "login", "\"_", ":_", "login_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "first", "Name", "\"_", ":_", "first", "Name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "last", "Name", "\"_", ":_", "last", "Name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "password", "\"_", ":_", "password_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "email", "\"_", ":_", "email_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "admin", "\"_", ":_", "\"", "true", "\"_", "if_", "admin_", "else_", "\"", "fal", "se", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "changed_", "=_", "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_", "self_", "._", "module_", "._", "params_", "[_", "'", "state", "'_", "]_", "==_", "'", "absen", "t", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ret_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ret_", "=_", "self_", "._", "authenticate_", "(_", "username_", "=_", "login_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "password_", "=_", "password_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "me_", "=_", "self_", "._", "get_", "(_", "\"", "user", "/", "me", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "delete_", "(_", "'", "user", "/{}'_", "._", "format_", "(_", "me_", "[_", "'\\u", "id", "'_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "changed_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "User", " ", "doe", "s", " ", "not", " ", "exist", " ", "(", "with", " ", "this", " ", "login", " ", "info", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Auth", "entica", "tion", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ret_", "=_", "[_", "]_", "\\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_", "ret_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Gir", "der", "Client", "Module_", "(_", "Gir", "der", "Client_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Exclude", " ", "these", " ", "method", "s", " ", "from", " ", "bot", "h", " ", "'", "raw", "'", " ", "mode_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "validat", "e\\u", "hdfs", "\\u", "asset", "store_", "(_", "self_", ",_", "*_", "args_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Check", " ", "if", " ", "hdfs", " ", "plugin", " ", "is", " ", "avail", "able", ",", " ", " ", "enable", " ", "it", " ", "if", " ", "it", " ", "isn", "'", "t_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Gir", "der", "Client", "Module_", "(_", "Gir", "der", "Client_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Exclude", " ", "these", " ", "method", "s", " ", "from", " ", "bot", "h", " ", "'", "raw", "'", " ", "mode_", "\\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_", "asset", "store_", "(_", "self_", ",_", "name_", ",_", "type_", ",_", "root_", "=_", "None_", ",_", "db_", "=_", "None_", ",_", "mongo", "host_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "replica", "set_", "=_", "''_", ",_", "bucket_", "=_", "None_", ",_", "prefix_", "=_", "''_", ",_", "access", "Key", "Id_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "secret_", "=_", "None_", ",_", "service_", "=_", "'", "s3", ".", "amaz", "ona", "ws", ".", "com", "'_", ",_", "host_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "port_", "=_", "None_", ",_", "path_", "=_", "None_", ",_", "user_", "=_", "None_", ",_", "web", "Hd", "fs", "Port_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "read", "Only_", "=_", "False_", ",_", "current_", "=_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Fail", " ", "if", " ", "some", "how", " ", "we", " ", "have", " ", "an", " ", "asset", " ", "type", " ", "not", " ", "in", " ", "asset", "store", "\\u", "types_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "type_", "not_", "in_", "self_", "._", "asset", "store", "\\u", "types_", "._", "keys_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "fail_", "(_", "\"", "asset", "store", " ", "type", " ", "{}", " ", "is", " ", "not", " ", "implemented", "!\"_", "._", "format_", "(_", "type_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "argu", "ment", "\\u", "hash_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "filesystem", "\"_", ":_", "{_", "'", "name", "'_", ":_", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "type", "'_", ":_", "self_", "._", "asset", "store", "\\u", "types_", "[_", "type_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "root", "'_", ":_", "root_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "grid", "fs", "\"_", ":_", "{_", "'", "name", "'_", ":_", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "type", "'_", ":_", "self_", "._", "asset", "store", "\\u", "types_", "[_", "type_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "db", "'_", ":_", "db_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "mongo", "host", "'_", ":_", "mongo", "host_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "replica", "set", "'_", ":_", "replica", "set_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "s3", "\"_", ":_", "{_", "'", "name", "'_", ":_", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "type", "'_", ":_", "self_", "._", "asset", "store", "\\u", "types_", "[_", "type_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "bucket", "'_", ":_", "bucket_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "prefix", "'_", ":_", "prefix_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "access", "Key", "Id", "'_", ":_", "access", "Key", "Id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "secret", "'_", ":_", "secret_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "service", "'_", ":_", "service_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "hdfs", "'_", ":_", "{_", "'", "name", "'_", ":_", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "type", "'_", ":_", "self_", "._", "asset", "store", "\\u", "types_", "[_", "type_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "host", "'_", ":_", "host_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "port", "'_", ":_", "port_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "path", "'_", ":_", "path_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "user", "'_", ":_", "user_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "web", "Hd", "fs", "Port", "'_", ":_", "web", "Hd", "fs", "Port_", "}_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Fail", " ", "if", " ", "we", " ", "don", "'", "t", " ", "have", " ", "all", " ", "the", " ", "require", "d", " ", "attributes_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "for", " ", "this", " ", "asset", " ", "type_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "k_", ",_", "v_", "in_", "argu", "ment", "\\u", "hash_", "[_", "type_", "]_", "._", "items_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "v_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "fail_", "(_", "\"", "asset", "store", "s", " ", "of", " ", "type", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"{}", " ", "require", " ", "attribute", " ", "{}\"_", "._", "format_", "(_", "type_", ",_", "k_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Set", " ", "option", "al", " ", "argu", "ment", "s", " ", "in", " ", "the", " ", "hash_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "argu", "ment", "\\u", "hash_", "[_", "type_", "]_", "[_", "'", "read", "On", "ly", "'_", "]_", "=_", "read", "Only_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "argu", "ment", "\\u", "hash_", "[_", "type_", "]_", "[_", "'", "current", "'_", "]_", "=_", "current_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "ret_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Get", " ", "the", " ", "current", " ", "asset", "stores_", "\\u\\u\\uNL\\u\\u\\u_", "asset", "stores_", "=_", "{_", "a_", "[_", "'", "name", "'_", "]_", ":_", "a_", "for_", "a_", "in_", "self_", "._", "get_", "(_", "\"", "asset", "store", "\"_", ")_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "message_", "[_", "'", "debug", "'_", "]_", "[_", "'", "asset", "store", "s", "'_", "]_", "=_", "asset", "stores_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "we", " ", "want", " ", "the", " ", "asset", "store", " ", "to", " ", "be", " ", "present_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "self_", "._", "module_", "._", "params_", "[_", "'", "state", "'_", "]_", "==_", "'", "presen", "t", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "And", " ", "the", " ", "asset", " ", "store", " ", "exists_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "name_", "in_", "asset", "stores_", "._", "keys_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "id_", "=_", "asset", "stores_", "[_", "name_", "]_", "[_", "'\\u", "id", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "###", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Field", "s", " ", "tha", "t", " ", "coul", "d", " ", "potenti", "ally", " ", "be", " ", "updated_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Thi", "s", " ", "is", " ", "necessar", "y", " ", "bec", "aus", "e", " ", "there", " ", "are", " ", "fields", " ", "in", " ", "the", " ", "asset", "stores_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "tha", "t", " ", "do", " ", "not", " ", "hash", " ", "(", "e", ".", "g", ".,", " ", "capacit", "y", ")", " ", "and", " ", "fields", " ", "in", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "argu", "ment", "\\u", "hash", " ", "tha", "t", " ", "are", " ", "not", " ", "return", "ed", " ", "by", " ", "'", "GET", "'", " ", "asset", "store", " ", "(", "e", ".", "g", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "read", "On", "ly", ").", " ", "We", " ", "coul", "d", " ", "be", " ", "more", " ", "precise", " ", "abo", "ut", " ", "this_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "(", "e", ".", "g", ".,", " ", "by", " ", "only", " ", "checking", " ", "items", " ", "tha", "t", " ", "are", " ", "rele", "van", "t", " ", "to", " ", "this", " ", "type", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "but", " ", "reada", "bilit", "y", " ", "suff", "ers", "._", "\\u\\u\\uNL\\u\\u\\u_", "update", "able_", "=_", "[_", "\"", "root", "\"_", ",_", "\"", "mongo", "host", "\"_", ",_", "\"", "replica", "set", "\"_", ",_", "\"", "bucket", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "prefix", "\"_", ",_", "\"", "db", "\"_", ",_", "\"", "access", "Key", "Id", "\"_", ",_", "\"", "secret", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "service", "\"_", ",_", "\"", "host", "\"_", ",_", "\"", "port", "\"_", ",_", "\"", "path", "\"_", ",_", "\"", "user", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "web", "Hd", "fs", "Port", "\"_", ",_", "\"", "current", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "tuple", "s", " ", "of", " ", "(", "key", ",", " ", " ", "value", ")", " ", "for", " ", "fields", " ", "tha", "t", " ", "can", " ", "be", " ", "updated_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "in", " ", "the", " ", "asset", "store_", "\\u\\u\\uNL\\u\\u\\u_", "asset", "store", "\\u", "items_", "=_", "set_", "(_", "(_", "k_", ",_", "asset", "stores_", "[_", "name_", "]_", "[_", "k_", "]_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "k_", "in_", "update", "able_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "k_", "in_", "asset", "stores_", "[_", "name_", "]_", "._", "keys_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "tuple", "s", " ", "of", " ", "(", "key", ",", " ", " ", "value", ")", " ", "for", " ", "fields", " ", "tha", "t", " ", "can", " ", "be", " ", "updated_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "in", " ", "the", " ", "argu", "ment", "\\u", "hash", " ", "for", " ", "this", " ", "asset", "store", " ", "type_", "\\u\\u\\uNL\\u\\u\\u_", "arg", "\\u", "hash", "\\u", "items_", "=_", "set_", "(_", "(_", "k_", ",_", "argu", "ment", "\\u", "hash_", "[_", "type_", "]_", "[_", "k_", "]_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "k_", "in_", "update", "able_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "k_", "in_", "argu", "ment", "\\u", "hash_", "[_", "type_", "]_", "._", "keys_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "if", " ", "arg", "\\u", "hash", "\\u", "items", " ", "not", " ", "a", " ", "proper", " ", "subse", "t", " ", "of", " ", "asset", "store", "\\u", "items_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "arg", "\\u", "hash", "\\u", "items_", "<=_", "asset", "store", "\\u", "items_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Update_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "ret_", "=_", "self_", "._", "put_", "(_", "\"", "asset", "store", "/{}\"_", "._", "format_", "(_", "id_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "parameters_", "=_", "argu", "ment", "\\u", "hash_", "[_", "type_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "changed_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "And", " ", "the", " ", "asset", " ", "store", " ", "doe", "s", " ", "not", " ", "exist_", "\\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 ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "If", " ", "\\u\\u", "validat", "e\\u", "[", "type", "]\\u", "asset", "store", " ", "exist", "s", " ", "then", " ", "call", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "function", " ", "with", " ", "argu", "ment", "\\u", "hash", ".", " ", "E", ".", "g", ".,", " ", " ", "to", " ", "check", " ", "if", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "HDF", "S", " ", "plugin", " ", "is", " ", "enabled_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "getattr_", "(_", "self_", ",_", "\"\\u\\u", "validat", "e\\u", "{}\\u", "asset", "store", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "._", "format_", "(_", "type_", ")_", ")_", "(_", "**_", "argu", "ment", "\\u", "hash_", ")_", "\\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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "ret_", "=_", "self_", "._", "post_", "(_", "\"", "asset", "store", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "parameters_", "=_", "argu", "ment", "\\u", "hash_", "[_", "type_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "changed_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "If", " ", "we", " ", "want", " ", "the", " ", "asset", "store", " ", "to", " ", "be", " ", "gone", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "self_", "._", "module_", "._", "params_", "[_", "'", "state", "'_", "]_", "==_", "'", "absen", "t", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "And", " ", "the", " ", "asset", "store", " ", "exists_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "name_", "in_", "asset", "stores_", "._", "keys_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "id_", "=_", "asset", "stores_", "[_", "name_", "]_", "[_", "'\\u", "id", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ret_", "=_", "self_", "._", "delete_", "(_", "\"", "asset", "store", "/{}\"_", "._", "format_", "(_", "id_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "parameters_", "=_", "argu", "ment", "\\u", "hash_", "[_", "type_", "]_", ")_", "\\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_", "ret_", "\\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_", "main_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Entr", "y", " ", "point", " ", "for", " ", "ansi", "ble", " ", "girder", " ", "client", " ", "module", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "return", "s", ":", " ", "Not", "hing", "\\", "10", ";", " ", " ", " ", " ", ":", "rty", "pe", ":", " ", "Non", "e", "Type", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Default", " ", "spec", " ", "for", " ", "init", "ali", "zin", "g", " ", "and", " ", "authenticat", "ing_", "\\u\\u\\uNL\\u\\u\\u_", "argu", "ment", "\\u", "spec_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "\\u\\u", "init\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "'", "host", "'_", ":_", "dict_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "port", "'_", ":_", "dict_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "api", "Roo", "t", "'_", ":_", "dict_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "sche", "me", "'_", ":_", "dict_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "dry", "run", "'_", ":_", "dict_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "blacklist", "'_", ":_", "dict_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "authenticate_", "\\u\\u\\uNL\\u\\u\\u_", "'", "user", "name", "'_", ":_", "dict_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "password", "'_", ":_", "dict_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "token", "'_", ":_", "dict_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "General", "_", "\\u\\u\\uNL\\u\\u\\u_", "'", "state", "'_", ":_", "dict_", "(_", "default_", "=_", "\"", "presen", "t", "\"_", ",_", "choices_", "=_", "[_", "'", "presen", "t", "'_", ",_", "'", "absen", "t", "'_", "]_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "gcm", "_", "=_", "Gir", "der", "Client", "Module_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "method_", "in_", "gcm", "_", "._", "require", "d\\u", "one", "\\u", "of_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "argu", "ment", "\\u", "spec_", "[_", "method_", "]_", "=_", "dict_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "module_", "=_", "Ans", "ibl", "e", "Module_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "argu", "ment", "\\u", "spec_", "=_", "argu", "ment", "\\u", "spec_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "require", "d\\u", "one", "\\u", "of_", "=_", "[_", "gcm", "_", "._", "require", "d\\u", "one", "\\u", "of_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "\"", "token", "\"_", ",_", "\"", "user", "name", "\"_", ",_", "\"", "user", "\"_", "]_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "require", "d\\u", "together_", "=_", "[_", "[_", "\"", "user", "name", "\"_", ",_", "\"", "password", "\"_", "]_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "mutual", "ly", "\\u", "exclusive_", "=_", "gcm", "_", "._", "require", "d\\u", "one", "\\u", "of_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "support", "s", "\\u", "check", "\\u", "mode_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "HAS", "\\u", "GI", "RD", "ER", "\\u", "CLIENT_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "module_", "._", "fail", "\\u", "json_", "(_", "msg_", "=_", "\"", "Cou", "ld", " ", "not", " ", "import", " ", "Gir", "der", "Client", "!\"_", ")_", "\\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 ", " _", "gcm", "_", "(_", "module_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Http", "Error_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "traceback_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "module_", "._", "fail", "\\u", "json_", "(_", "msg_", "=_", "\"{}", ":{}", "\\\\", "n", "{}", "\\\\", "n", "{}\"_", "._", "format_", "(_", "e_", "._", "\\u\\u", "class\\u\\u_", ",_", "str_", "(_", "e_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "e_", "._", "response", "Text_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "traceback_", "._", "format\\u", "exc_", "(_", ")_", ")_", ")_", "\\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 ", " _", "import_", "traceback_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "exc", "\\u", "type", ",", " ", "exc", "\\u", "obj", ",", " ", "exec", "\\u", "tb", " ", "=", " ", "sys", ".", "exc", "\\u", "info", "()", "_", "\\u\\u\\uNL\\u\\u\\u_", "module_", "._", "fail", "\\u", "json_", "(_", "msg_", "=_", "\"{}", ":", " ", "{}", "\\\\", "n", "\\\\", "n", "{}\"_", "._", "format_", "(_", "e_", "._", "\\u\\u", "class\\u\\u_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "str_", "(_", "e_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "traceback_", "._", "format\\u", "exc_", "(_", ")_", ")_", ")_", "\\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, 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, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Variable defined multiple times
mozilla/kitsune/kitsune/wiki/events.py
[ { "content": "class EditDocumentEvent(InstanceEvent):\n \"\"\"Event fired when a certain document is edited\"\"\"\n event_type = 'wiki edit document'\n content_type = Document\n\n", "metadata": "root.EditDocumentEvent", "header": "['module', '___EOS___']", "index": 74 } ]
[]
[]
0
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_", "class_", "Edit", "Document", "Event_", "(_", "Insta", "nce", "Event_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Event", " ", "fired", " ", "whe", "n", " ", "a", " ", "cert", "ain", " ", "document", " ", "is", " ", "edited", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "event", "\\u", "type_", "=_", "'", "wiki", " ", "edit", " ", "document", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "content", "\\u", "type_", "=_", "Document_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\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 ]
Unused import
jonathanslenders/python-prompt-toolkit/examples/bottom-toolbar.py
[ { "content": "#!/usr/bin/env python\n\"\"\"\nSimple example showing a bottom toolbar.\n\"\"\"\nfrom __future__ import unicode_literals\nfrom prompt_toolkit import prompt\nfrom prompt_toolkit.styles import style_from_dict\nfrom prompt_toolkit.token import Token\n\n\ntest_style = style_from_dict({\n Token.Toolbar: '#ffffff bg:#333333',\n})\n\n\n\n\nif __name__ == '__main__':\n main()\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def main():\n def get_bottom_toolbar_tokens(cli):\n return [(Token.Toolbar, ' This is a toolbar. ')]\n\n text = prompt('Say something: ',\n get_bottom_toolbar_tokens=get_bottom_toolbar_tokens,\n style=test_style)\n print('You said: %s' % text)", "metadata": "root.main", "header": "['module', '___EOS___']", "index": 15 } ]
[]
[]
0
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#!", "/", "usr", "/", "bin", "/", "env", " ", "python_", "\\u\\u\\uNL\\u\\u\\u_", "\"\"\"", "\\", "10", ";", "Simple", " ", "example", " ", "showin", "g", " ", "a", " ", "bottom", " ", "toolb", "ar", ".", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "\\u\\u", "future\\u\\u_", "import_", "unicode", "\\u", "literals_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "prompt", "\\u", "toolkit_", "import_", "prompt_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "prompt", "\\u", "toolkit_", "._", "styles_", "import_", "style", "\\u", "from", "\\u", "dict_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "prompt", "\\u", "toolkit_", "._", "token_", "import_", "Token_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "test\\u", "style_", "=_", "style", "\\u", "from", "\\u", "dict_", "(_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "Token_", "._", "Toolbar_", ":_", "'#", "ffffff", " ", "bg", ":", "#", "33333", "3", "'_", ",_", "\\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 ", " _", "main_", "(_", ")_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "main_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "get", "\\u", "bottom", "\\u", "toolb", "ar", "\\u", "tokens_", "(_", "cli_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "[_", "(_", "Token_", "._", "Toolbar_", ",_", "'", " ", "Thi", "s", " ", "is", " ", "a", " ", "toolb", "ar", ".", " ", "'_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "text_", "=_", "prompt_", "(_", "'", "Say", " ", "somet", "hing", ":", " ", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "get", "\\u", "bottom", "\\u", "toolb", "ar", "\\u", "tokens_", "=_", "get", "\\u", "bottom", "\\u", "toolb", "ar", "\\u", "tokens_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "style_", "=_", "test\\u", "style_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "'", "You", " ", "sai", "d", ":", " ", "%", "s", "'_", "%_", "text_", ")_", "\\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, 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 ]
Variable defined multiple times
lisa-lab/pylearn2/pylearn2/models/model.py
[ { "content": " def get_monitoring_channels(self, data):\n \"\"\"\n Get monitoring channels for this model.\n\n Parameters\n ----------\n data : tensor_like, or (possibly nested) tuple of tensor_likes,\n This is data on which the monitoring quantities will be\n calculated (e.g., a validation set). See\n `self.get_monitoring_data_specs()`.\n\n Returns\n -------\n channels : OrderedDict\n A dictionary with strings as keys, mapping channel names to\n symbolic values that depend on the variables in `data`.\n\n Notes\n -----\n You can make any channel names you want, just try to make sure they\n won't collide with names made by the training Cost, etc. Anything you\n think is worth monitoring during training can be added here. You\n probably want to control which channels get added with some config\n option for your model.\n \"\"\"\n space, source = self.get_monitoring_data_specs()\n space.validate(data)\n return OrderedDict()", "metadata": "root.Model.get_monitoring_channels", "header": "['class', 'Model', '(', 'object', ')', ':', '___EOS___']", "index": 180 } ]
[]
[]
0
true
[ "[CLS]_", "Variable_", "defined_", "multiple_", "times_", "[SEP]_", "class_", "Model_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "monitorin", "g", "\\u", "channels_", "(_", "self_", ",_", "data_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Get", " ", "monitorin", "g", " ", "channel", "s", " ", "for", " ", "this", " ", "model", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Parameter", "s", "\\", "10", ";", " ", " ", " ", " ", "----------", "\\", "10", ";", " ", " ", " ", " ", "data", " ", ":", " ", "tensor", "\\u", "like", ",", " ", "or", " ", "(", "possib", "ly", " ", "nest", "ed", ")", " ", "tuple", " ", "of", " ", "tensor", "\\u", "likes", ",", "\\", "10", ";", " ", " ", " ", " ", "Thi", "s", " ", "is", " ", "data", " ", "on", " ", "whi", "ch", " ", "the", " ", "monitorin", "g", " ", "quantities", " ", "will", " ", "be", "\\", "10", ";", " ", " ", " ", " ", "calculated", " ", "(", "e", ".", "g", ".,", " ", "a", " ", "validation", " ", "set", ").", " ", "See", "\\", "10", ";", " ", " ", " ", " ", "`", "self", ".", "get", "\\u", "monitorin", "g", "\\u", "data\\u", "spec", "s", "()`", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", "\\", "10", ";", " ", " ", " ", " ", "-------", "\\", "10", ";", " ", " ", " ", " ", "channel", "s", " ", ":", " ", "Order", "ed", "Dict", "\\", "10", ";", " ", " ", " ", " ", "A", " ", "dictionar", "y", " ", "with", " ", "string", "s", " ", "as", " ", "keys", ",", " ", "mapping", " ", "channel", " ", "names", " ", "to", "\\", "10", ";", " ", " ", " ", " ", "symbolic", " ", "values", " ", "tha", "t", " ", "depend", " ", "on", " ", "the", " ", "variab", "les", " ", "in", " ", "`", "data", "`.", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Not", "es", "\\", "10", ";", " ", " ", " ", " ", "-----", "\\", "10", ";", " ", " ", " ", " ", "You", " ", "can", " ", "make", " ", "any", " ", "channel", " ", "names", " ", "you", " ", "want", ",", " ", "just", " ", "try", " ", "to", " ", "make", " ", "sure", " ", "the", "y", "\\", "10", ";", " ", " ", " ", " ", "won", "'", "t", " ", "collide", " ", "with", " ", "names", " ", "made", " ", "by", " ", "the", " ", "train", "ing", " ", "Cost", ",", " ", "etc", ".", " ", "Any", "thing", " ", "you", "\\", "10", ";", " ", " ", " ", " ", "think", " ", "is", " ", "worth", " ", "monitorin", "g", " ", "dur", "ing", " ", "train", "ing", " ", "can", " ", "be", " ", "adde", "d", " ", "here", ".", " ", "You", "\\", "10", ";", " ", " ", " ", " ", "probab", "ly", " ", "want", " ", "to", " ", "control", " ", "whi", "ch", " ", "channel", "s", " ", "get", " ", "adde", "d", " ", "with", " ", "some", " ", "config", "\\", "10", ";", " ", " ", " ", " ", "option", " ", "for", " ", "your", " ", "model", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "space_", ",_", "source_", "=_", "self_", "._", "get", "\\u", "monitorin", "g", "\\u", "data\\u", "specs_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "space_", "._", "validate_", "(_", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "Order", "ed", "Dict_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 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 ]
Constant in conditional expression or statement
openstack/monitoring-for-openstack/oschecks/neutron.py
[ { "content": " def list_floating_ips(self):\n if not self.all_floating_ips:\n for floating_ip in self.nova_client.list_floatingips(\n fields=['floating_ip_address', 'id'],\n tenant_id=self.tenant_id)['floatingips']:\n self.all_floating_ips.append(floating_ip)\n return self.all_floating_ips", "metadata": "root.Novautils.list_floating_ips", "header": "['class', 'Novautils', '(', 'object', ')', ':', '___EOS___']", "index": 130 } ]
[]
[]
0
true
[ "[CLS]_", "Constant_", "in_", "conditional", "_", "expression_", "or_", "statement_", "[SEP]_", "class_", "Nov", "aut", "ils_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "list", "\\u", "float", "ing", "\\u", "ips_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "self_", "._", "all", "\\u", "float", "ing", "\\u", "ips_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "float", "ing", "\\u", "ip_", "in_", "self_", "._", "nova", "\\u", "client_", "._", "list", "\\u", "floatingip", "s_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "fields_", "=_", "[_", "'", "float", "ing", "\\u", "ip", "\\u", "address", "'_", ",_", "'", "id", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "tenan", "t", "\\u", "id_", "=_", "self_", "._", "tenan", "t", "\\u", "id_", ")_", "[_", "'", "floatingip", "s", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "all", "\\u", "float", "ing", "\\u", "ips_", "._", "append_", "(_", "float", "ing", "\\u", "ip_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "self_", "._", "all", "\\u", "float", "ing", "\\u", "ips_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 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 ]
Unused local variable
mwilliamson/spur.py/spur/local.py
[ { "content": " def spawn(self, command, *args, **kwargs):\n stdout = kwargs.pop(\"stdout\", None)\n stderr = kwargs.pop(\"stderr\", None)\n allow_error = kwargs.pop(\"allow_error\", False)\n store_pid = kwargs.pop(\"store_pid\", False)\n use_pty = kwargs.pop(\"use_pty\", False)\n encoding = kwargs.pop(\"encoding\", None)\n if use_pty:\n if pty is None:\n raise ValueError(\"use_pty is not supported when the pty module cannot be imported\")\n master, slave = pty.openpty()\n stdin_arg = slave\n stdout_arg = slave\n stderr_arg = subprocess.STDOUT\n else:\n stdin_arg = subprocess.PIPE\n stdout_arg = subprocess.PIPE\n stderr_arg = subprocess.PIPE\n \n try:\n process = subprocess.Popen(\n stdin=stdin_arg,\n stdout=stdout_arg,\n stderr=stderr_arg,\n bufsize=0,\n **self._subprocess_args(command, *args, **kwargs)\n )\n except OSError as error:\n if self._is_no_such_command_oserror(error, command[0]):\n raise NoSuchCommandError(command[0])\n else:\n raise\n \n if use_pty:\n # TODO: Should close master ourselves rather than relying on\n # garbage collection\n process_stdin = os.fdopen(os.dup(master), \"wb\", 0)\n process_stdout = os.fdopen(master, \"rb\", 0)\n process_stderr = io.BytesIO()\n \n def close_slave_on_exit():\n process.wait()\n # TODO: ensure the IO handler has finished before closing\n os.close(slave)\n \n thread = threading.Thread(target=close_slave_on_exit)\n thread.daemon = True\n thread.start()\n \n else:\n process_stdin = process.stdin\n process_stdout = process.stdout\n process_stderr = process.stderr\n \n spur_process = LocalProcess(\n process,\n allow_error=allow_error,\n process_stdin=process_stdin,\n io_handler=IoHandler([\n Channel(process_stdout, stdout, is_pty=use_pty),\n Channel(process_stderr, stderr, is_pty=use_pty),\n ], encoding=encoding)\n )\n if store_pid:\n spur_process.pid = process.pid\n return spur_process", "metadata": "root.LocalShell.spawn", "header": "['class', 'LocalShell', '(', 'object', ')', ':', '___EOS___']", "index": 42 } ]
[]
[]
0
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "Local", "Shell_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "spawn_", "(_", "self_", ",_", "command_", ",_", "*_", "args_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "stdout_", "=_", "kwargs_", "._", "pop_", "(_", "\"", "stdout", "\"_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "stderr_", "=_", "kwargs_", "._", "pop_", "(_", "\"", "std", "err", "\"_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "allow", "\\u", "error_", "=_", "kwargs_", "._", "pop_", "(_", "\"", "allow", "\\u", "error", "\"_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "store", "\\u", "pid_", "=_", "kwargs_", "._", "pop_", "(_", "\"", "store", "\\u", "pid", "\"_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "use", "\\u", "pty", "_", "=_", "kwargs_", "._", "pop_", "(_", "\"", "use", "\\u", "pty", "\"_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "encoding_", "=_", "kwargs_", "._", "pop_", "(_", "\"", "encoding", "\"_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "use", "\\u", "pty", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "pty", "_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Value", "Error_", "(_", "\"", "use", "\\u", "pty", " ", "is", " ", "not", " ", "support", "ed", " ", "whe", "n", " ", "the", " ", "pty", " ", "module", " ", "cann", "ot", " ", "be", " ", "import", "ed", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "master_", ",_", "slave_", "=_", "pty", "_", "._", "openp", "ty_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "std", "in", "\\u", "arg_", "=_", "slave_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "stdout", "\\u", "arg_", "=_", "slave_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "std", "err", "\\u", "arg_", "=_", "subprocess_", "._", "STDOUT_", "\\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 ", " _", "std", "in", "\\u", "arg_", "=_", "subprocess_", "._", "PIPE_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "stdout", "\\u", "arg_", "=_", "subprocess_", "._", "PIPE_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "std", "err", "\\u", "arg_", "=_", "subprocess_", "._", "PIPE_", "\\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 ", " _", "process_", "=_", "subprocess_", "._", "Popen_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "stdin_", "=_", "std", "in", "\\u", "arg_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "stdout_", "=_", "stdout", "\\u", "arg_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "stderr_", "=_", "std", "err", "\\u", "arg_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "bufsize_", "=_", "0_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "**_", "self_", "._", "\\u", "subproc", "ess", "\\u", "args_", "(_", "command_", ",_", "*_", "args_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "OSE", "rror_", "as_", "error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "\\u", "is", "\\u", "no", "\\u", "suc", "h", "\\u", "command", "\\u", "ose", "rror_", "(_", "error_", ",_", "command_", "[_", "0_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "No", "Suc", "h", "Command", "Error_", "(_", "command_", "[_", "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 ", " _", "raise_", "\\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_", "use", "\\u", "pty", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "TOD", "O", ":", " ", "Sho", "ul", "d", " ", "close", " ", "master", " ", "ours", "elv", "es", " ", "rat", "her", " ", "than", " ", "rely", "ing", " ", "on_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "gar", "bage", " ", "collection_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "process", "\\u", "stdin_", "=_", "os_", "._", "fdo", "pen_", "(_", "os_", "._", "dup_", "(_", "master_", ")_", ",_", "\"", "wb", "\"_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "process", "\\u", "stdout_", "=_", "os_", "._", "fdo", "pen_", "(_", "master_", ",_", "\"", "rb", "\"_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "process", "\\u", "stderr_", "=_", "io_", "._", "Byte", "s", "IO_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "close", "\\u", "slave", "\\u", "on", "\\u", "exit_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "process_", "._", "wait_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "TOD", "O", ":", " ", "ensure", " ", "the", " ", "IO", " ", "handler", " ", "has", " ", "finish", "ed", " ", "bef", "ore", " ", "closing_", "\\u\\u\\uNL\\u\\u\\u_", "os_", "._", "close_", "(_", "slave_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "thread_", "=_", "threading_", "._", "Thread_", "(_", "target_", "=_", "close", "\\u", "slave", "\\u", "on", "\\u", "exit_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "thread_", "._", "daemon_", "=_", "True_", "\\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_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "process", "\\u", "stdin_", "=_", "process_", "._", "stdin_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "process", "\\u", "stdout_", "=_", "process_", "._", "stdout_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "process", "\\u", "stderr_", "=_", "process_", "._", "stderr_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "spu", "r", "\\u", "process_", "=_", "Local", "Process_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "process_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "allow", "\\u", "error_", "=_", "allow", "\\u", "error_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "process", "\\u", "stdin_", "=_", "process", "\\u", "stdin_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "io", "\\u", "handler_", "=_", "Io", "Handler_", "(_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "Channel_", "(_", "process", "\\u", "stdout_", ",_", "stdout_", ",_", "is", "\\u", "pty", "_", "=_", "use", "\\u", "pty", "_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Channel_", "(_", "process", "\\u", "stderr_", ",_", "stderr_", ",_", "is", "\\u", "pty", "_", "=_", "use", "\\u", "pty", "_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", ",_", "encoding_", "=_", "encoding_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "store", "\\u", "pid_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "spu", "r", "\\u", "process_", "._", "pid_", "=_", "process_", "._", "pid_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "spu", "r", "\\u", "process_", "\\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, 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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 ]
Except block handles 'BaseException'
thesamet/webilder/src/webilder/infofile.py
[ { "content": "def parse_info_file(info_file):\n \"\"\"Parses a info file, returns a dictionary representation.\n\n Returns an empty dictionary on error.\n \"\"\"\n try:\n fileobj = open(info_file, 'r')\n try:\n inf = wbz.parse_metadata(fileobj.read())\n finally:\n fileobj.close()\n except IOError, e:\n inf = {}\n return inf", "metadata": "root.parse_info_file", "header": "['module', '___EOS___']", "index": 4 } ]
[]
[]
0
true
[ "[CLS]_", "Except", "_", "block_", "handles_", "'", "Base", "Except", "ion", "'_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "parse", "\\u", "info", "\\u", "file_", "(_", "info", "\\u", "file_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Pars", "es", " ", "a", " ", "info", " ", "file", ",", " ", "return", "s", " ", "a", " ", "dictionar", "y", " ", "represent", "ation", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", " ", "an", " ", "empty", " ", "dictionar", "y", " ", "on", " ", "error", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "fileobj_", "=_", "open_", "(_", "info", "\\u", "file_", ",_", "'", "r", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "inf_", "=_", "wb", "z_", "._", "parse", "\\u", "metadata_", "(_", "fileobj_", "._", "read_", "(_", ")_", ")_", "\\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 ", " _", "fileobj_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "IO", "Error_", ",_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "inf_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "inf_" ]
[ 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 ]
Unused local variable
pantsbuild/pants/tests/python/pants_test/util/xml_test_base.py
[ { "content": " @contextmanager\n def xml_file(self,\n manifest_element='manifest',\n package_attribute='package',\n package_value='org.pantsbuild.example.hello',\n uses_sdk_element='uses-sdk',\n android_attribute='android:targetSdkVersion',\n activity_element='activity',\n android_name_attribute='android:name',\n application_name_value='org.pantsbuild.example.hello.HelloWorld'):\n \"\"\"Represent an .xml file (Here an AndroidManifest.xml is used).\"\"\"\n with temporary_file() as fp:\n fp.write(textwrap.dedent(\n \"\"\"<?xml version=\"1.0\" encoding=\"utf-8\"?>\n <{manifest} xmlns:android=\"http://schemas.android.com/apk/res/android\"\n xmlns:unrelated=\"http://schemas.android.com/apk/res/android\"\n {package}=\"{package_name}\" >\n <{uses_sdk}\n {android}=\"19\" />\n <application >\n <{activity}\n {android_name}=\"{application_name}\" >\n </{activity}>\n </application>\n </{manifest}>\"\"\".format(manifest=manifest_element,\n package=package_attribute,\n package_name=package_value,\n uses_sdk=uses_sdk_element,\n android=android_attribute,\n activity=activity_element,\n android_name=android_name_attribute,\n application_name=application_name_value)))\n fp.close()\n path = fp.name\n yield path", "metadata": "root.XmlTestBase.xml_file", "header": "['class', 'XmlTestBase', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 17 } ]
[]
[]
0
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "Xm", "l", "Test", "Base_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "@_", "contextmanager_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "xml", "\\u", "file_", "(_", "self_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "manifest", "\\u", "element_", "=_", "'", "manifest", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "package", "\\u", "attribute_", "=_", "'", "package", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "package", "\\u", "value_", "=_", "'", "org", ".", "pant", "sbu", "ild", ".", "example", ".", "hell", "o", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "use", "s", "\\u", "sd", "k", "\\u", "element_", "=_", "'", "use", "s", "-", "sd", "k", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "android", "\\u", "attribute_", "=_", "'", "android", ":", "target", "Sd", "k", "Version", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "activit", "y", "\\u", "element_", "=_", "'", "activit", "y", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "android", "\\u", "name", "\\u", "attribute_", "=_", "'", "android", ":", "name", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "applica", "tion", "\\u", "name", "\\u", "value_", "=_", "'", "org", ".", "pant", "sbu", "ild", ".", "example", ".", "hell", "o", ".", "Hell", "o", "Wor", "ld", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Represent", " ", "an", " ", ".", "xml", " ", "file", " ", "(", "Her", "e", " ", "an", " ", "And", "roid", "Manifest", ".", "xml", " ", "is", " ", "used", ").\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "temporar", "y", "\\u", "file_", "(_", ")_", "as_", "fp_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "fp_", "._", "write_", "(_", "textwrap_", "._", "dedent_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"\"\"", "<", "?", "xml", " ", "version", "=\"", "1.0", "\"", " ", "encoding", "=\"", "utf", "-", "8", "\"?", ">", "\\", "10", ";", " ", " ", " ", " ", "<", "{", "manifest", "}", " ", "xml", "ns", ":", "android", "=\"", "http", "://", "schema", "s", ".", "android", ".", "com", "/", "apk", "/", "res", "/", "android", "\"", "\\", "10", ";", " ", " ", "xml", "ns", ":", "unre", "late", "d", "=\"", "http", "://", "schema", "s", ".", "android", ".", "com", "/", "apk", "/", "res", "/", "android", "\"", "\\", "10", ";", " ", " ", " ", " ", "{", "package", "}=", "\"{", "package", "\\u", "name", "}\"", " ", ">", "\\", "10", ";", " ", " ", " ", " ", "<", "{", "use", "s", "\\u", "sd", "k", "}", "\\", "10", ";", " ", " ", " ", " ", "{", "android", "}=", "\"", "1", "9", "\"", " ", "/>", "\\", "10", ";", " ", " ", " ", " ", "<", "applica", "tion", " ", ">", "\\", "10", ";", " ", " ", " ", " ", "<", "{", "activit", "y", "}", "\\", "10", ";", " ", " ", "{", "android", "\\u", "name", "}=", "\"{", "applica", "tion", "\\u", "name", "}\"", " ", ">", "\\", "10", ";", " ", " ", " ", " ", "</", "{", "activit", "y", "}>", "\\", "10", ";", " ", " ", " ", " ", "</", "applica", "tion", ">", "\\", "10", ";", " ", " ", " ", " ", "</", "{", "manifest", "}>", "\"\"\"_", "._", "format_", "(_", "manifest_", "=_", "manifest", "\\u", "element_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "package_", "=_", "package", "\\u", "attribute_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "package", "\\u", "name_", "=_", "package", "\\u", "value_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "use", "s", "\\u", "sdk_", "=_", "use", "s", "\\u", "sd", "k", "\\u", "element_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "android", "_", "=_", "android", "\\u", "attribute_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "activity_", "=_", "activit", "y", "\\u", "element_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "android", "\\u", "name_", "=_", "android", "\\u", "name", "\\u", "attribute_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "applica", "tion", "\\u", "name_", "=_", "applica", "tion", "\\u", "name", "\\u", "value_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fp_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "path_", "=_", "fp_", "._", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "yield_", "path_" ]
[ 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 ]
Unused import
adlibre/Adlibre-DMS/adlibre_dms/apps/mdtui/templatetags/mui_permissions.py
[ { "content": "\"\"\"\nModule: Permissions for templates rendering helpers for MDTUI\n\nProject: Adlibre DMS\nCopyright: Adlibre Pty Ltd 2012\nLicense: See LICENSE for license information\nAuthor: Iurii Garmash\n\"\"\"\n\nfrom django import template\nfrom mdtui.security import SEC_GROUP_NAMES\n\nregister = template.Library()\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "@register.simple_tag(takes_context=True)\ndef check_search_permit(context):\n \"\"\"\n Checks request.user for permission to SEARCH in MUI\n\n In fact he must be in search group in security.\n Set's up context variable 'search_permitted'\n it can be used farther in IF template compassion.\n \"\"\"\n # Do nothing if context variable has already been set\n if 'search_permitted' in context:\n return ''\n user = context['request'].user\n permission = False\n if not user.is_superuser:\n groups = user.groups.all()\n for group in groups:\n if group.name == SEC_GROUP_NAMES['search']:\n permission = True\n else:\n permission = True\n context['search_permitted'] = permission\n return ''", "metadata": "root.check_search_permit", "header": "['module', '___EOS___']", "index": 14 }, { "content": "@register.simple_tag(takes_context=True)\ndef check_index_permit(context):\n \"\"\"\n Checks request.user for permission to INDEX in MUI\n\n In fact he must be in search group in security.\n Set's up context variable 'index_permitted'\n it can be used farther in IF template compassion.\n \"\"\"\n # Do nothing if context variable has already been set\n if 'index_permitted' in context:\n return ''\n user = context['request'].user\n permission = False\n if not user.is_superuser:\n groups = user.groups.all()\n for group in groups:\n if group.name == SEC_GROUP_NAMES['index']:\n permission = True\n else:\n permission = True\n context['index_permitted'] = permission\n return ''", "metadata": "root.check_index_permit", "header": "['module', '___EOS___']", "index": 38 }, { "content": "@register.simple_tag(takes_context=True)\ndef check_edit_index_permit(context):\n \"\"\"\n Checks request.user for permission to EDIT DOCUMENT INDEX in MUI\n\n In fact he must be in search group in security.\n Set's up context variable 'index_permitted'\n it can be used farther in IF template compassion.\n \"\"\"\n # Do nothing if context variable has already been set\n if 'edit_index_permitted' in context:\n return ''\n user = context['request'].user\n permission = False\n if not user.is_superuser:\n groups = user.groups.all()\n for group in groups:\n if group.name == SEC_GROUP_NAMES['edit_index']:\n permission = True\n else:\n permission = True\n context['edit_index_permitted'] = permission\n return ''", "metadata": "root.check_edit_index_permit", "header": "['module', '___EOS___']", "index": 62 } ]
[]
[]
0
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\"\"\"", "\\", "10", ";", "Modul", "e", ":", " ", "Permi", "ssion", "s", " ", "for", " ", "template", "s", " ", "render", "ing", " ", "help", "ers", " ", "for", " ", "MD", "TU", "I", "\\", "10", ";", "\\", "10", ";", "Project", ":", " ", "Ad", "libre", " ", "DM", "S", "\\", "10", ";", "Copy", "right", ":", " ", "Ad", "libre", " ", "Pt", "y", " ", "Lt", "d", " ", "2012", "\\", "10", ";", "License", ":", " ", "See", " ", "LICENSE", " ", "for", " ", "license", " ", "informati", "on", "\\", "10", ";", "Author", ":", " ", "Iu", "ri", "i", " ", "Gar", "mas", "h", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "django_", "import_", "template_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "mdt", "ui_", "._", "security_", "import_", "SEC", "\\u", "GROU", "P", "\\u", "NAMES_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "register_", "=_", "template_", "._", "Library_", "(_", ")_", "\\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_", "@_", "register_", "._", "simple", "\\u", "tag_", "(_", "take", "s", "\\u", "context_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "check", "\\u", "search", "\\u", "permit", "_", "(_", "context_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Check", "s", " ", "request", ".", "user", " ", "for", " ", "permissi", "on", " ", "to", " ", "SEARCH", " ", "in", " ", "MU", "I", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "In", " ", "fact", " ", "he", " ", "must", " ", "be", " ", "in", " ", "search", " ", "group", " ", "in", " ", "security", ".", "\\", "10", ";", " ", " ", " ", " ", "Set", "'", "s", " ", "up", " ", "context", " ", "variab", "le", " ", "'", "search", "\\u", "permit", "ted", "'", "\\", "10", ";", " ", " ", " ", " ", "it", " ", "can", " ", "be", " ", "used", " ", "far", "ther", " ", "in", " ", "IF", " ", "template", " ", "compass", "ion", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Do", " ", "not", "hing", " ", "if", " ", "context", " ", "variab", "le", " ", "has", " ", "alr", "ead", "y", " ", "bee", "n", " ", "set_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "'", "search", "\\u", "permit", "ted", "'_", "in_", "context_", ":_", "\\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_", "user_", "=_", "context_", "[_", "'", "request", "'_", "]_", "._", "user_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "permission_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "user_", "._", "is", "\\u", "superuser_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "groups_", "=_", "user_", "._", "groups_", "._", "all_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "group_", "in_", "groups_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "group_", "._", "name_", "==_", "SEC", "\\u", "GROU", "P", "\\u", "NAMES_", "[_", "'", "search", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "permission_", "=_", "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 ", " _", "permission_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "context_", "[_", "'", "search", "\\u", "permit", "ted", "'_", "]_", "=_", "permission_", "\\u\\u\\uNEWLINE\\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_", "@_", "register_", "._", "simple", "\\u", "tag_", "(_", "take", "s", "\\u", "context_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "check", "\\u", "index", "\\u", "permit", "_", "(_", "context_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Check", "s", " ", "request", ".", "user", " ", "for", " ", "permissi", "on", " ", "to", " ", "INDE", "X", " ", "in", " ", "MU", "I", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "In", " ", "fact", " ", "he", " ", "must", " ", "be", " ", "in", " ", "search", " ", "group", " ", "in", " ", "security", ".", "\\", "10", ";", " ", " ", " ", " ", "Set", "'", "s", " ", "up", " ", "context", " ", "variab", "le", " ", "'", "index", "\\u", "permit", "ted", "'", "\\", "10", ";", " ", " ", " ", " ", "it", " ", "can", " ", "be", " ", "used", " ", "far", "ther", " ", "in", " ", "IF", " ", "template", " ", "compass", "ion", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Do", " ", "not", "hing", " ", "if", " ", "context", " ", "variab", "le", " ", "has", " ", "alr", "ead", "y", " ", "bee", "n", " ", "set_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "'", "index", "\\u", "permit", "ted", "'_", "in_", "context_", ":_", "\\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_", "user_", "=_", "context_", "[_", "'", "request", "'_", "]_", "._", "user_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "permission_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "user_", "._", "is", "\\u", "superuser_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "groups_", "=_", "user_", "._", "groups_", "._", "all_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "group_", "in_", "groups_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "group_", "._", "name_", "==_", "SEC", "\\u", "GROU", "P", "\\u", "NAMES_", "[_", "'", "index", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "permission_", "=_", "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 ", " _", "permission_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "context_", "[_", "'", "index", "\\u", "permit", "ted", "'_", "]_", "=_", "permission_", "\\u\\u\\uNEWLINE\\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_", "@_", "register_", "._", "simple", "\\u", "tag_", "(_", "take", "s", "\\u", "context_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "check", "\\u", "edit", "\\u", "index", "\\u", "permit", "_", "(_", "context_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Check", "s", " ", "request", ".", "user", " ", "for", " ", "permissi", "on", " ", "to", " ", "EDIT", " ", "DOCUMENT", " ", "INDE", "X", " ", "in", " ", "MU", "I", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "In", " ", "fact", " ", "he", " ", "must", " ", "be", " ", "in", " ", "search", " ", "group", " ", "in", " ", "security", ".", "\\", "10", ";", " ", " ", " ", " ", "Set", "'", "s", " ", "up", " ", "context", " ", "variab", "le", " ", "'", "index", "\\u", "permit", "ted", "'", "\\", "10", ";", " ", " ", " ", " ", "it", " ", "can", " ", "be", " ", "used", " ", "far", "ther", " ", "in", " ", "IF", " ", "template", " ", "compass", "ion", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Do", " ", "not", "hing", " ", "if", " ", "context", " ", "variab", "le", " ", "has", " ", "alr", "ead", "y", " ", "bee", "n", " ", "set_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "'", "edit", "\\u", "index", "\\u", "permit", "ted", "'_", "in_", "context_", ":_", "\\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_", "user_", "=_", "context_", "[_", "'", "request", "'_", "]_", "._", "user_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "permission_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "user_", "._", "is", "\\u", "superuser_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "groups_", "=_", "user_", "._", "groups_", "._", "all_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "group_", "in_", "groups_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "group_", "._", "name_", "==_", "SEC", "\\u", "GROU", "P", "\\u", "NAMES_", "[_", "'", "edit", "\\u", "index", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "permission_", "=_", "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 ", " _", "permission_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "context_", "[_", "'", "edit", "\\u", "index", "\\u", "permit", "ted", "'_", "]_", "=_", "permission_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "''_" ]
[ 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,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, 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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Variable defined multiple times
machinalis/featureforge/featureforge/evaluator.py
[ { "content": " def fit_transform(self, X, y=None):\n self.fit(X, y)\n return self.transform(X)", "metadata": "root.FeatureEvaluator.fit_transform", "header": "['class', 'FeatureEvaluator', '(', 'object', ')', ':', '___EOS___']", "index": 19 } ]
[]
[]
0
true
[ "[CLS]_", "Variable_", "defined_", "multiple_", "times_", "[SEP]_", "class_", "Feature", "Evaluator_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "fit", "\\u", "transform_", "(_", "self_", ",_", "X_", ",_", "y_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "fit_", "(_", "X_", ",_", "y_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "transform_", "(_", "X_", ")_", "\\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 ]
Comparison of constants
UDST/urbansim/urbansim/developer/sqftproforma.py
[ { "content": " def check_is_reasonable(self):\n fars = pd.Series(self.fars)\n assert len(fars[fars > 20]) == 0\n assert len(fars[fars <= 0]) == 0\n for k, v in self.forms.iteritems():\n assert isinstance(v, dict)\n for k2, v2 in self.forms[k].iteritems():\n assert isinstance(k2, str)\n assert isinstance(v2, float)\n for k2, v2 in self.forms[k].iteritems():\n assert isinstance(k2, str)\n assert isinstance(v2, float)\n for k, v in self.parking_rates.iteritems():\n assert isinstance(k, str)\n assert k in self.uses\n assert 0 <= v < 5\n for k, v in self.parking_sqft_d.iteritems():\n assert isinstance(k, str)\n assert k in self.parking_configs\n assert 50 <= v <= 1000\n for k, v in self.parking_sqft_d.iteritems():\n assert isinstance(k, str)\n assert k in self.parking_cost_d\n assert 10 <= v <= 300\n for v in self.heights_for_costs:\n assert isinstance(v, int) or isinstance(v, float)\n if np.isinf(v):\n continue\n assert 0 <= v <= 1000\n for k, v in self.costs.iteritems():\n assert isinstance(k, str)\n assert k in self.uses\n for i in v:\n assert 10 < i < 1000", "metadata": "root.SqFtProFormaConfig.check_is_reasonable", "header": "['class', 'SqFtProFormaConfig', '(', 'object', ')', ':', '___EOS___']", "index": 208 } ]
[]
[]
0
true
[ "[CLS]_", "Compari", "son_", "of_", "constants_", "[SEP]_", "class_", "Sq", "Ft", "Pro", "Form", "a", "Config_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "check", "\\u", "is", "\\u", "reason", "able_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "far", "s_", "=_", "pd_", "._", "Series_", "(_", "self_", "._", "far", "s_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "len_", "(_", "far", "s_", "[_", "far", "s_", ">_", "20_", "]_", ")_", "==_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "len_", "(_", "far", "s_", "[_", "far", "s_", "<=_", "0_", "]_", ")_", "==_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "k_", ",_", "v_", "in_", "self_", "._", "forms_", "._", "iteritems_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "assert_", "isinstance_", "(_", "v_", ",_", "dict_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "k2_", ",_", "v2_", "in_", "self_", "._", "forms_", "[_", "k_", "]_", "._", "iteritems_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "assert_", "isinstance_", "(_", "k2_", ",_", "str_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "isinstance_", "(_", "v2_", ",_", "float_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "k2_", ",_", "v2_", "in_", "self_", "._", "forms_", "[_", "k_", "]_", "._", "iteritems_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "assert_", "isinstance_", "(_", "k2_", ",_", "str_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "isinstance_", "(_", "v2_", ",_", "float_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "k_", ",_", "v_", "in_", "self_", "._", "park", "ing", "\\u", "rates_", "._", "iteritems_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "assert_", "isinstance_", "(_", "k_", ",_", "str_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "k_", "in_", "self_", "._", "uses_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "0_", "<=_", "v_", "<_", "5_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "k_", ",_", "v_", "in_", "self_", "._", "park", "ing", "\\u", "sq", "ft", "\\u", "d_", "._", "iteritems_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "assert_", "isinstance_", "(_", "k_", ",_", "str_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "k_", "in_", "self_", "._", "park", "ing", "\\u", "configs_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "50_", "<=_", "v_", "<=_", "1000_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "k_", ",_", "v_", "in_", "self_", "._", "park", "ing", "\\u", "sq", "ft", "\\u", "d_", "._", "iteritems_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "assert_", "isinstance_", "(_", "k_", ",_", "str_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "k_", "in_", "self_", "._", "park", "ing", "\\u", "cost", "\\u", "d_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "10_", "<=_", "v_", "<=_", "300_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "v_", "in_", "self_", "._", "height", "s", "\\u", "for", "\\u", "costs_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "assert_", "isinstance_", "(_", "v_", ",_", "int_", ")_", "or_", "isinstance_", "(_", "v_", ",_", "float_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "np_", "._", "isinf", "_", "(_", "v_", ")_", ":_", "\\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_", "assert_", "0_", "<=_", "v_", "<=_", "1000_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "k_", ",_", "v_", "in_", "self_", "._", "costs_", "._", "iteritems_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "assert_", "isinstance_", "(_", "k_", ",_", "str_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "k_", "in_", "self_", "._", "uses_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", "in_", "v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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 ]
Imprecise assert
biocore/pyqi/tests/test_commands/test_make_optparse.py
[ { "content": " def test_run(self):\n exp = win_text\n\n pc = CommandIn(Name='DUN', Required=True, DataType=str, Description=\"\")\n bool_param = CommandIn(Name='imabool', DataType=bool,\n Description='zero or one', Required=False)\n\n class stubby:\n CommandIns = ParameterCollection([pc, bool_param])\n CommandOuts = ParameterCollection([])\n\n obs = self.cmd(**{'command_module':'foobar',\n 'command':stubby(),\n 'author': 'bob',\n 'email': 'bob@bob.bob',\n 'license': 'very permissive license',\n 'copyright': 'what\\'s that?',\n 'version': '1.0'\n })\n\n self.assertEqual(obs['result'], exp.splitlines())", "metadata": "root.MakeOptparseTests.test_run", "header": "['class', 'MakeOptparseTests', '(', 'TestCase', ')', ':', '___EOS___']", "index": 22 } ]
[]
[]
0
true
[ "[CLS]_", "Imp", "reci", "se_", "assert_", "[SEP]_", "class_", "Make", "Opt", "parse", "Tests_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "run_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "exp_", "=_", "win", "\\u", "text_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "pc_", "=_", "Command", "In_", "(_", "Name_", "=_", "'", "DU", "N", "'_", ",_", "Required_", "=_", "True_", ",_", "Data", "Type_", "=_", "str_", ",_", "Description_", "=_", "\"\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bool\\u", "param_", "=_", "Command", "In_", "(_", "Name_", "=_", "'", "ima", "bool", "'_", ",_", "Data", "Type_", "=_", "bool_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Description_", "=_", "'", "zero", " ", "or", " ", "one", "'_", ",_", "Required_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "stub", "by_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Command", "Ins", "_", "=_", "Parameter", "Collection_", "(_", "[_", "pc_", ",_", "bool\\u", "param_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Command", "Outs", "_", "=_", "Parameter", "Collection_", "(_", "[_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "obs_", "=_", "self_", "._", "cmd_", "(_", "**_", "{_", "'", "command", "\\u", "module", "'_", ":_", "'", "fooba", "r", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "command", "'_", ":_", "stub", "by_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "author", "'_", ":_", "'", "bob", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "email", "'_", ":_", "'", "bob", "@", "bob", ".", "bob", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "license", "'_", ":_", "'", "very", " ", "permissi", "ve", " ", "license", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "copyr", "ight", "'_", ":_", "'", "what", "\\\\'", "s", " ", "tha", "t", "?'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "version", "'_", ":_", "'", "1.0", "'_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "obs_", "[_", "'", "result", "'_", "]_", ",_", "exp_", "._", "splitlines_", "(_", ")_", ")_", "\\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 ]
Comparison of constants
OpenCobolIDE/OpenCobolIDE/open_cobol_ide/extlibs/future/utils/__init__.py
[ { "content": "def with_metaclass(meta, *bases):\n \"\"\"\n Function from jinja2/_compat.py. License: BSD.\n\n Use it like this::\n \n class BaseForm(object):\n pass\n \n class FormType(type):\n pass\n \n class Form(with_metaclass(FormType, BaseForm)):\n pass\n\n This requires a bit of explanation: the basic idea is to make a\n dummy metaclass for one level of class instantiation that replaces\n itself with the actual metaclass. Because of internal type checks\n we also need to make sure that we downgrade the custom metaclass\n for one level to something closer to type (that's why __call__ and\n __init__ comes back from type etc.).\n \n This has the advantage over six.with_metaclass of not introducing\n dummy classes into the final MRO.\n \"\"\"\n class metaclass(meta):\n __call__ = type.__call__\n __init__ = type.__init__\n def __new__(cls, name, this_bases, d):\n if this_bases is None:\n return type.__new__(cls, name, (), d)\n return meta(name, bases, d)\n return metaclass('temporary_class', None, {})", "metadata": "root.with_metaclass", "header": "['module', '___EOS___']", "index": 105 } ]
[]
[]
0
true
[ "[CLS]_", "Compari", "son_", "of_", "constants_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "with", "\\u", "metaclass_", "(_", "meta_", ",_", "*_", "bases_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Function", " ", "from", " ", "jin", "ja", "2", "/\\u", "compa", "t", ".", "py", ".", " ", "License", ":", " ", "BS", "D", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Us", "e", " ", "it", " ", "like", " ", "this", "::", "\\", "10", ";", " ", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", "class", " ", "Base", "Form", "(", "object", "):", "\\", "10", ";", " ", " ", " ", " ", "pass", "\\", "10", ";", " ", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", "class", " ", "Form", "Type", "(", "type", "):", "\\", "10", ";", " ", " ", " ", " ", "pass", "\\", "10", ";", " ", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", "class", " ", "Form", "(", "with", "\\u", "metaclass", "(", "Form", "Type", ",", " ", "Base", "Form", "))", ":", "\\", "10", ";", " ", " ", " ", " ", "pass", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Thi", "s", " ", "require", "s", " ", "a", " ", "bit", " ", "of", " ", "expl", "anat", "ion", ":", " ", "the", " ", "basic", " ", "idea", " ", "is", " ", "to", " ", "make", " ", "a", "\\", "10", ";", " ", " ", " ", " ", "dummy", " ", "metaclass", " ", "for", " ", "one", " ", "level", " ", "of", " ", "class", " ", "instantiation", " ", "tha", "t", " ", "replace", "s", "\\", "10", ";", " ", " ", " ", " ", "its", "elf", " ", "with", " ", "the", " ", "actual", " ", "metaclass", ".", " ", " ", "Be", "caus", "e", " ", "of", " ", "internal", " ", "type", " ", "checks", "\\", "10", ";", " ", " ", " ", " ", "we", " ", "als", "o", " ", "need", " ", "to", " ", "make", " ", "sure", " ", "tha", "t", " ", "we", " ", "down", "grade", " ", "the", " ", "custom", " ", "metaclass", "\\", "10", ";", " ", " ", " ", " ", "for", " ", "one", " ", "level", " ", "to", " ", "somet", "hing", " ", "close", "r", " ", "to", " ", "type", " ", "(", "tha", "t", "'", "s", " ", "wh", "y", " ", "\\u\\u", "call", "\\u\\u", " ", "and", "\\", "10", ";", " ", " ", " ", " ", "\\u\\u", "init", "\\u\\u", " ", "come", "s", " ", "back", " ", "from", " ", "type", " ", "etc", ".)", ".", "\\", "10", ";", " ", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", "Thi", "s", " ", "has", " ", "the", " ", "advantage", " ", "over", " ", "si", "x", ".", "with", "\\u", "metaclass", " ", "of", " ", "not", " ", "intro", "duci", "ng", "\\", "10", ";", " ", " ", " ", " ", "dummy", " ", "classe", "s", " ", "int", "o", " ", "the", " ", "final", " ", "MR", "O", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "class_", "metaclass_", "(_", "meta_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u\\u", "call\\u\\u_", "=_", "type_", "._", "\\u\\u", "call\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u", "init\\u\\u_", "=_", "type_", "._", "\\u\\u", "init\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u\\u", "new\\u\\u_", "(_", "cls_", ",_", "name_", ",_", "this", "\\u", "bases_", ",_", "d_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "this", "\\u", "bases_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "type_", "._", "\\u\\u", "new\\u\\u_", "(_", "cls_", ",_", "name_", ",_", "(_", ")_", ",_", "d_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "meta_", "(_", "name_", ",_", "bases_", ",_", "d_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "metaclass_", "(_", "'", "temporar", "y", "\\u", "class", "'_", ",_", "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,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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 ]
Unused import
ganeti/ganeti/lib/opcodes_base.py
[ { "content": "#\n#\n\n# Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Google Inc.\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\n# met:\n#\n# 1. Redistributions of source code must retain the above copyright notice,\n# this list of conditions and the following disclaimer.\n#\n# 2. 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#\n# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS\n# IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED\n# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR\n# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR\n# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,\n# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,\n# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\n# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF\n# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING\n# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\n# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\n\n\"\"\"OpCodes base module\n\nThis module implements part of the data structures which define the\ncluster operations - the so-called opcodes.\n\nEvery operation which modifies the cluster state is expressed via\nopcodes.\n\n\"\"\"\n\n# this are practically structures, so disable the message about too\n# few public methods:\n# pylint: disable=R0903\n\nimport copy\nimport logging\nimport re\n\nfrom ganeti import constants\nfrom ganeti import errors\nfrom ganeti import ht\nfrom ganeti import outils\n\n\n#: OP_ID conversion regular expression\n_OPID_RE = re.compile(\"([a-z])([A-Z])\")\n\nSUMMARY_PREFIX = {\n \"CLUSTER_\": \"C_\",\n \"GROUP_\": \"G_\",\n \"NODE_\": \"N_\",\n \"INSTANCE_\": \"I_\",\n }\n\n#: Attribute name for dependencies\nDEPEND_ATTR = \"depends\"\n\n#: Attribute name for comment\nCOMMENT_ATTR = \"comment\"\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nTNoRelativeJobDependencies = BuildJobDepCheck(False)\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def _NameComponents(name):\n \"\"\"Split an opcode class name into its components\n\n @type name: string\n @param name: the class name, as OpXxxYyy\n @rtype: array of strings\n @return: the components of the name\n\n \"\"\"\n assert name.startswith(\"Op\")\n # Note: (?<=[a-z])(?=[A-Z]) would be ideal, since it wouldn't\n # consume any input, and hence we would just have all the elements\n # in the list, one by one; but it seems that split doesn't work on\n # non-consuming input, hence we have to process the input string a\n # bit\n name = _OPID_RE.sub(r\"\\1,\\2\", name)\n elems = name.split(\",\")\n return elems", "metadata": "root._NameComponents", "header": "['module', '___EOS___']", "index": 71 }, { "content": "def _NameToId(name):\n \"\"\"Convert an opcode class name to an OP_ID.\n\n @type name: string\n @param name: the class name, as OpXxxYyy\n @rtype: string\n @return: the name in the OP_XXXX_YYYY format\n\n \"\"\"\n if not name.startswith(\"Op\"):\n return None\n return \"_\".join(n.upper() for n in _NameComponents(name))", "metadata": "root._NameToId", "header": "['module', '___EOS___']", "index": 91 }, { "content": "def NameToReasonSrc(name, prefix):\n \"\"\"Convert an opcode class name to a source string for the reason trail\n\n @type name: string\n @param name: the class name, as OpXxxYyy\n @type prefix: string\n @param prefix: the prefix that will be prepended to the opcode name\n @rtype: string\n @return: the name in the OP_XXXX_YYYY format\n\n \"\"\"\n if not name.startswith(\"Op\"):\n return None\n return \"%s:%s\" % (prefix,\n \"_\".join(n.lower() for n in _NameComponents(name)))", "metadata": "root.NameToReasonSrc", "header": "['module', '___EOS___']", "index": 105 }, { "content": "class _AutoOpParamSlots(outils.AutoSlots):\n \"\"\"Meta class for opcode definitions.\n\n \"\"\"\n", "metadata": "root._AutoOpParamSlots", "header": "['module', '___EOS___']", "index": 122 }, { "content": " def __new__(mcs, name, bases, attrs):\n \"\"\"Called when a class should be created.\n\n @param mcs: The meta class\n @param name: Name of created class\n @param bases: Base classes\n @type attrs: dict\n @param attrs: Class attributes\n\n \"\"\"\n assert \"OP_ID\" not in attrs, \"Class '%s' defining OP_ID\" % name\n\n slots = mcs._GetSlots(attrs)\n assert \"OP_DSC_FIELD\" not in attrs or attrs[\"OP_DSC_FIELD\"] in slots, \\\n \"Class '%s' uses unknown field in OP_DSC_FIELD\" % name\n assert (\"OP_DSC_FORMATTER\" not in attrs or\n callable(attrs[\"OP_DSC_FORMATTER\"])), \\\n (\"Class '%s' uses non-callable in OP_DSC_FORMATTER (%s)\" %\n (name, type(attrs[\"OP_DSC_FORMATTER\"])))\n\n attrs[\"OP_ID\"] = _NameToId(name)\n\n return outils.AutoSlots.__new__(mcs, name, bases, attrs)", "metadata": "root._AutoOpParamSlots.__new__", "header": "['class', '_AutoOpParamSlots', '(', 'outils', '.', 'AutoSlots', ')', ':', '___EOS___']", "index": 126 }, { "content": " @classmethod\n def _GetSlots(mcs, attrs):\n \"\"\"Build the slots out of OP_PARAMS.\n\n \"\"\"\n # Always set OP_PARAMS to avoid duplicates in BaseOpCode.GetAllParams\n params = attrs.setdefault(\"OP_PARAMS\", [])\n\n # Use parameter names as slots\n return [pname for (pname, _, _, _) in params]", "metadata": "root._AutoOpParamSlots._GetSlots", "header": "['class', '_AutoOpParamSlots', '(', 'outils', '.', 'AutoSlots', ')', ':', '___EOS___']", "index": 150 }, { "content": "class BaseOpCode(outils.ValidatedSlots):\n \"\"\"A simple serializable object.\n\n This object serves as a parent class for OpCode without any custom\n field handling.\n\n \"\"\"\n # pylint: disable=E1101\n # as OP_ID is dynamically defined\n __metaclass__ = _AutoOpParamSlots\n\n\n\n\n", "metadata": "root.BaseOpCode", "header": "['module', '___EOS___']", "index": 162 }, { "content": " def __init__(self, **kwargs):\n outils.ValidatedSlots.__init__(self, **kwargs)\n for key, default, _, _ in self.__class__.GetAllParams():\n if not hasattr(self, key):\n setattr(self, key, default)", "metadata": "root.BaseOpCode.__init__", "header": "['class', 'BaseOpCode', '(', 'outils', '.', 'ValidatedSlots', ')', ':', '___EOS___']", "index": 173 }, { "content": " def __getstate__(self):\n \"\"\"Generic serializer.\n\n This method just returns the contents of the instance as a\n dictionary.\n\n @rtype: C{dict}\n @return: the instance attributes and their values\n\n \"\"\"\n state = {}\n for name in self.GetAllSlots():\n if hasattr(self, name):\n state[name] = getattr(self, name)\n return state", "metadata": "root.BaseOpCode.__getstate__", "header": "['class', 'BaseOpCode', '(', 'outils', '.', 'ValidatedSlots', ')', ':', '___EOS___']", "index": 179 }, { "content": " def __setstate__(self, state):\n \"\"\"Generic unserializer.\n\n This method just restores from the serialized state the attributes\n of the current instance.\n\n @param state: the serialized opcode data\n @type state: C{dict}\n\n \"\"\"\n if not isinstance(state, dict):\n raise ValueError(\"Invalid data to __setstate__: expected dict, got %s\" %\n type(state))\n\n for name in self.GetAllSlots():\n if name not in state and hasattr(self, name):\n delattr(self, name)\n\n for name in state:\n setattr(self, name, state[name])", "metadata": "root.BaseOpCode.__setstate__", "header": "['class', 'BaseOpCode', '(', 'outils', '.', 'ValidatedSlots', ')', ':', '___EOS___']", "index": 195 }, { "content": " @classmethod\n def GetAllParams(cls):\n \"\"\"Compute list of all parameters for an opcode.\n\n \"\"\"\n slots = []\n for parent in cls.__mro__:\n slots.extend(getattr(parent, \"OP_PARAMS\", []))\n return slots", "metadata": "root.BaseOpCode.GetAllParams", "header": "['class', 'BaseOpCode', '(', 'outils', '.', 'ValidatedSlots', ')', ':', '___EOS___']", "index": 216 }, { "content": " def Validate(self, set_defaults): # pylint: disable=W0221\n \"\"\"Validate opcode parameters, optionally setting default values.\n\n @type set_defaults: bool\n @param set_defaults: whether to set default values\n\n @rtype: NoneType\n @return: L{None}, if the validation succeeds\n @raise errors.OpPrereqError: when a parameter value doesn't match\n requirements\n\n \"\"\"\n for (attr_name, default, test, _) in self.GetAllParams():\n assert callable(test)\n\n if hasattr(self, attr_name):\n attr_val = getattr(self, attr_name)\n else:\n attr_val = copy.deepcopy(default)\n\n if test(attr_val):\n if set_defaults:\n setattr(self, attr_name, attr_val)\n elif ht.TInt(attr_val) and test(float(attr_val)):\n if set_defaults:\n setattr(self, attr_name, float(attr_val))\n else:\n logging.error(\"OpCode %s, parameter %s, has invalid type %s/value\"\n \" '%s' expecting type %s\",\n self.OP_ID, attr_name, type(attr_val), attr_val, test)\n\n if attr_val is None:\n logging.error(\"OpCode %s, parameter %s, has default value None which\"\n \" is does not check against the parameter's type: this\"\n \" means this parameter is required but no value was\"\n \" given\",\n self.OP_ID, attr_name)\n\n raise errors.OpPrereqError(\"Parameter '%s.%s' fails validation\" %\n (self.OP_ID, attr_name),\n errors.ECODE_INVAL)", "metadata": "root.BaseOpCode.Validate", "header": "['class', 'BaseOpCode', '(', 'outils', '.', 'ValidatedSlots', ')', ':', '___EOS___']", "index": 226 }, { "content": "def BuildJobDepCheck(relative):\n \"\"\"Builds check for job dependencies (L{DEPEND_ATTR}).\n\n @type relative: bool\n @param relative: Whether to accept relative job IDs (negative)\n @rtype: callable\n\n \"\"\"\n if relative:\n job_id = ht.TOr(ht.TJobId, ht.TRelativeJobId)\n else:\n job_id = ht.TJobId\n\n job_dep = \\\n ht.TAnd(ht.TOr(ht.TListOf(ht.TAny), ht.TTuple),\n ht.TIsLength(2),\n ht.TItems([job_id,\n ht.TListOf(ht.TElemOf(constants.JOBS_FINALIZED))]))\n\n return ht.TMaybe(ht.TListOf(job_dep))", "metadata": "root.BuildJobDepCheck", "header": "['module', '___EOS___']", "index": 269 } ]
[]
[]
0
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_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Copy", "right", " ", "(", "C", ")", " ", "2006", ",", " ", "2007", ",", " ", "2008", ",", " ", "200", "9", ",", " ", "2010", ",", " ", "2011", ",", " ", "2012", ",", " ", "2013", " ", "Goo", "gle", " ", "Inc", "._", "\\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", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "met", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "1", ".", " ", "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_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "2", ".", " ", "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_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "THIS", " ", "SOFT", "WARE", " ", "IS", " ", "PROVI", "DED", " ", "BY", " ", "THE", " ", "COPY", "RIG", "HT", " ", "HOLD", "ERS", " ", "AND", " ", "CONTRIB", "UTO", "RS", " ", "\"", "AS_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "IS", "\"", " ", "AND", " ", "ANY", " ", "EXPR", "ESS", " ", "OR", " ", "IMPL", "IED", " ", "WAR", "RAN", "TIES", ",", " ", "INC", "LU", "DING", ",", " ", "BUT", " ", "NOT", " ", "LIMIT", "ED_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "TO", ",", " ", "THE", " ", "IMPL", "IED", " ", "WAR", "RAN", "TIES", " ", "OF", " ", "MER", "CHAN", "TAB", "ILI", "TY", " ", "AND", " ", "FIT", "NESS", " ", "FOR", " ", "A", " ", "PARTI", "CUL", "AR_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "PUR", "POS", "E", " ", "ARE", " ", "DISC", "LAI", "MED", ".", " ", "IN", " ", "NO", " ", "EVENT", " ", "SHA", "LL", " ", "THE", " ", "COPY", "RIG", "HT", " ", "HOLD", "ER", " ", "OR_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "CONTRIB", "UTO", "RS", " ", "BE", " ", "LI", "AB", "LE", " ", "FOR", " ", "ANY", " ", "DIRECT", ",", " ", "INDI", "RECT", ",", " ", "INC", "IDENT", "AL", ",", " ", "SPECIAL", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "EXE", "MPL", "ARY", ",", " ", "OR", " ", "CONS", "EQU", "ENTI", "AL", " ", "DA", "MAGE", "S", " ", "(", "INC", "LU", "DING", ",", " ", "BUT", " ", "NOT", " ", "LIMIT", "ED", " ", "TO", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "PROC", "URE", "MENT", " ", "OF", " ", "SUBST", "ITU", "TE", " ", "GOOD", "S", " ", "OR", " ", "SERVICES", ";", " ", "LOSS", " ", "OF", " ", "USE", ",", " ", "DATA", ",", " ", "OR_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "PROF", "IT", "S", ";", " ", "OR", " ", "BUS", "INE", "SS", " ", "INTER", "RU", "PTION", ")", " ", "HO", "WE", "VER", " ", "CAU", "SED", " ", "AND", " ", "ON", " ", "ANY", " ", "THE", "ORY", " ", "OF_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "LI", "ABI", "LIT", "Y", ",", " ", "WHE", "THER", " ", "IN", " ", "CONTR", "ACT", ",", " ", "STRI", "CT", " ", "LI", "ABI", "LIT", "Y", ",", " ", "OR", " ", "TOR", "T", " ", "(", "INC", "LU", "DING", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "NEG", "LIG", "ENCE", " ", "OR", " ", "OTHER", "WI", "SE", ")", " ", "ARI", "SIN", "G", " ", "IN", " ", "ANY", " ", "WAY", " ", "OUT", " ", "OF", " ", "THE", " ", "USE", " ", "OF", " ", "THIS", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "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_", "\\u\\u\\uNL\\u\\u\\u_", "\"\"\"", "Op", "Code", "s", " ", "base", " ", "module", "\\", "10", ";", "\\", "10", ";", "Thi", "s", " ", "module", " ", "implement", "s", " ", "part", " ", "of", " ", "the", " ", "data", " ", "structure", "s", " ", "whi", "ch", " ", "defin", "e", " ", "the", "\\", "10", ";", "cluster", " ", "operati", "ons", " ", "-", " ", "the", " ", "so", "-", "call", "ed", " ", "opcode", "s", ".", "\\", "10", ";", "\\", "10", ";", "Every", " ", "operati", "on", " ", "whi", "ch", " ", "modifi", "es", " ", "the", " ", "cluster", " ", "state", " ", "is", " ", "express", "ed", " ", "via", "\\", "10", ";", "opcode", "s", ".", "\\", "10", ";", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "this", " ", "are", " ", "practic", "ally", " ", "structure", "s", ",", " ", "so", " ", "disable", " ", "the", " ", "message", " ", "abo", "ut", " ", "too", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "few", " ", "public", " ", "method", "s", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "pylint", ":", " ", "disable", "=", "R0", "903", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "copy_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "logging_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "re_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "gane", "ti_", "import_", "constants_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "gane", "ti_", "import_", "errors_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "gane", "ti_", "import_", "ht_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "gane", "ti_", "import_", "out", "ils_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", ":", " ", "OP", "\\u", "ID", " ", "conve", "rsi", "on", " ", "regular", " ", "expression_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "OP", "ID", "\\u", "RE_", "=_", "re_", "._", "compile_", "(_", "\"([", "a", "-", "z", "])(", "[", "A", "-", "Z", "])\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "SUMMARY", "\\u", "PREFIX_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "CLUSTER", "\\u\"_", ":_", "\"", "C", "\\u\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "GROU", "P", "\\u\"_", ":_", "\"", "G", "\\u\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "NODE", "\\u\"_", ":_", "\"", "N", "\\u\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "INSTANCE", "\\u\"_", ":_", "\"", "I", "\\u\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", ":", " ", "Attribute", " ", "name", " ", "for", " ", "dependencies_", "\\u\\u\\uNL\\u\\u\\u_", "DEP", "END", "\\u", "ATTR_", "=_", "\"", "depend", "s", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", ":", " ", "Attribute", " ", "name", " ", "for", " ", "comment_", "\\u\\u\\uNL\\u\\u\\u_", "COMMENT", "\\u", "ATTR_", "=_", "\"", "comment", "\"_", "\\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_", "TN", "o", "Relative", "Jo", "b", "Dependenc", "ies_", "=_", "Build", "Jo", "b", "Dep", "Check_", "(_", "False_", ")_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u", "Name", "Components_", "(_", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Split", " ", "an", " ", "opcode", " ", "class", " ", "name", " ", "int", "o", " ", "its", " ", "component", "s", "\\", "10", ";", "\\", "10", ";", " ", " ", "@", "type", " ", "name", ":", " ", "string", "\\", "10", ";", " ", " ", "@", "param", " ", "name", ":", " ", "the", " ", "class", " ", "name", ",", " ", "as", " ", "Op", "X", "xx", "Y", "yy", "\\", "10", ";", " ", " ", "@", "rty", "pe", ":", " ", "array", " ", "of", " ", "string", "s", "\\", "10", ";", " ", " ", "@", "return", ":", " ", "the", " ", "component", "s", " ", "of", " ", "the", " ", "name", "\\", "10", ";", "\\", "10", ";", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "name_", "._", "startswith_", "(_", "\"", "Op", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Not", "e", ":", " ", "(?", "<=", "[", "a", "-", "z", "])(", "?=", "[", "A", "-", "Z", "])", " ", "wou", "ld", " ", "be", " ", "ideal", ",", " ", "sinc", "e", " ", "it", " ", "wou", "ld", "n", "'", "t_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "consume", " ", "any", " ", "input", ",", " ", "and", " ", "hen", "ce", " ", "we", " ", "wou", "ld", " ", "just", " ", "have", " ", "all", " ", "the", " ", "elements_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "in", " ", "the", " ", "list", ",", " ", "one", " ", "by", " ", "one", ";", " ", "but", " ", "it", " ", "see", "ms", " ", "tha", "t", " ", "split", " ", "doe", "sn", "'", "t", " ", "work", " ", "on_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "non", "-", "consum", "ing", " ", "input", ",", " ", "hen", "ce", " ", "we", " ", "have", " ", "to", " ", "process", " ", "the", " ", "input", " ", "string", " ", "a_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "bit_", "\\u\\u\\uNL\\u\\u\\u_", "name_", "=_", "\\u", "OP", "ID", "\\u", "RE_", "._", "sub_", "(_", "r", "\"\\\\", "1", ",\\\\", "2", "\"_", ",_", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "elems_", "=_", "name_", "._", "split_", "(_", "\",\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "elems_", "\\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_", "\\u", "Name", "To", "Id_", "(_", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Convert", " ", "an", " ", "opcode", " ", "class", " ", "name", " ", "to", " ", "an", " ", "OP", "\\u", "ID", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", "@", "type", " ", "name", ":", " ", "string", "\\", "10", ";", " ", " ", "@", "param", " ", "name", ":", " ", "the", " ", "class", " ", "name", ",", " ", "as", " ", "Op", "X", "xx", "Y", "yy", "\\", "10", ";", " ", " ", "@", "rty", "pe", ":", " ", "string", "\\", "10", ";", " ", " ", "@", "return", ":", " ", "the", " ", "name", " ", "in", " ", "the", " ", "OP", "\\u", "XXXX", "\\u", "YYY", "Y", " ", "format", "\\", "10", ";", "\\", "10", ";", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "name_", "._", "startswith_", "(_", "\"", "Op", "\"_", ")_", ":_", "\\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_", "return_", "\"\\u\"_", "._", "join_", "(_", "n_", "._", "upper_", "(_", ")_", "for_", "n_", "in_", "\\u", "Name", "Components_", "(_", "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_", "def_", "Name", "To", "Rea", "son", "Src_", "(_", "name_", ",_", "prefix_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Convert", " ", "an", " ", "opcode", " ", "class", " ", "name", " ", "to", " ", "a", " ", "source", " ", "string", " ", "for", " ", "the", " ", "reason", " ", "trail", "\\", "10", ";", "\\", "10", ";", " ", " ", "@", "type", " ", "name", ":", " ", "string", "\\", "10", ";", " ", " ", "@", "param", " ", "name", ":", " ", "the", " ", "class", " ", "name", ",", " ", "as", " ", "Op", "X", "xx", "Y", "yy", "\\", "10", ";", " ", " ", "@", "type", " ", "prefix", ":", " ", "string", "\\", "10", ";", " ", " ", "@", "param", " ", "prefix", ":", " ", "the", " ", "prefix", " ", "tha", "t", " ", "will", " ", "be", " ", "prepend", "ed", " ", "to", " ", "the", " ", "opcode", " ", "name", "\\", "10", ";", " ", " ", "@", "rty", "pe", ":", " ", "string", "\\", "10", ";", " ", " ", "@", "return", ":", " ", "the", " ", "name", " ", "in", " ", "the", " ", "OP", "\\u", "XXXX", "\\u", "YYY", "Y", " ", "format", "\\", "10", ";", "\\", "10", ";", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "name_", "._", "startswith_", "(_", "\"", "Op", "\"_", ")_", ":_", "\\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_", "return_", "\"%", "s", ":", "%", "s", "\"_", "%_", "(_", "prefix_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"\\u\"_", "._", "join_", "(_", "n_", "._", "lower_", "(_", ")_", "for_", "n_", "in_", "\\u", "Name", "Components_", "(_", "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_", "class_", "\\u", "Auto", "Op", "Param", "Slot", "s_", "(_", "out", "ils_", "._", "Auto", "Slot", "s_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Meta", " ", "class", " ", "for", " ", "opcode", " ", "definit", "ion", "s", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "\\u", "Auto", "Op", "Param", "Slot", "s_", "(_", "out", "ils_", "._", "Auto", "Slot", "s_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u\\u", "new\\u\\u_", "(_", "mcs", "_", ",_", "name_", ",_", "bases_", ",_", "attrs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Call", "ed", " ", "whe", "n", " ", "a", " ", "class", " ", "shou", "ld", " ", "be", " ", "created", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "@", "param", " ", "mcs", ":", " ", "The", " ", "meta", " ", "class", "\\", "10", ";", " ", " ", " ", " ", "@", "param", " ", "name", ":", " ", "Name", " ", "of", " ", "created", " ", "class", "\\", "10", ";", " ", " ", " ", " ", "@", "param", " ", "base", "s", ":", " ", "Base", " ", "classe", "s", "\\", "10", ";", " ", " ", " ", " ", "@", "type", " ", "attr", "s", ":", " ", "dict", "\\", "10", ";", " ", " ", " ", " ", "@", "param", " ", "attr", "s", ":", " ", "Class", " ", "attribute", "s", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "\"", "OP", "\\u", "ID", "\"_", "not_", "in_", "attrs_", ",_", "\"", "Class", " ", "'%", "s", "'", " ", "defini", "ng", " ", "OP", "\\u", "ID", "\"_", "%_", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "slots_", "=_", "mcs", "_", "._", "\\u", "Get", "Slot", "s_", "(_", "attrs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "\"", "OP", "\\u", "DSC", "\\u", "FIE", "LD", "\"_", "not_", "in_", "attrs_", "or_", "attrs_", "[_", "\"", "OP", "\\u", "DSC", "\\u", "FIE", "LD", "\"_", "]_", "in_", "slots_", ",_", "\"", "Class", " ", "'%", "s", "'", " ", "use", "s", " ", "unknown", " ", "field", " ", "in", " ", "OP", "\\u", "DSC", "\\u", "FIE", "LD", "\"_", "%_", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "(_", "\"", "OP", "\\u", "DSC", "\\u", "FORMAT", "TER", "\"_", "not_", "in_", "attrs_", "or_", "\\u\\u\\uNL\\u\\u\\u_", "callable_", "(_", "attrs_", "[_", "\"", "OP", "\\u", "DSC", "\\u", "FORMAT", "TER", "\"_", "]_", ")_", ")_", ",_", "(_", "\"", "Class", " ", "'%", "s", "'", " ", "use", "s", " ", "non", "-", "calla", "ble", " ", "in", " ", "OP", "\\u", "DSC", "\\u", "FORMAT", "TER", " ", "(%", "s", ")\"_", "%_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "name_", ",_", "type_", "(_", "attrs_", "[_", "\"", "OP", "\\u", "DSC", "\\u", "FORMAT", "TER", "\"_", "]_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "attrs_", "[_", "\"", "OP", "\\u", "ID", "\"_", "]_", "=_", "\\u", "Name", "To", "Id_", "(_", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "out", "ils_", "._", "Auto", "Slot", "s_", "._", "\\u\\u", "new\\u\\u_", "(_", "mcs", "_", ",_", "name_", ",_", "bases_", ",_", "attrs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "\\u", "Auto", "Op", "Param", "Slot", "s_", "(_", "out", "ils_", "._", "Auto", "Slot", "s_", ")_", ":_", "\\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", "Get", "Slot", "s_", "(_", "mcs", "_", ",_", "attrs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Build", " ", "the", " ", "slot", "s", " ", "out", " ", "of", " ", "OP", "\\u", "PARAM", "S", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Al", "way", "s", " ", "set", " ", "OP", "\\u", "PARAM", "S", " ", "to", " ", "avoid", " ", "duplicat", "es", " ", "in", " ", "Base", "Op", "Code", ".", "Get", "All", "Params_", "\\u\\u\\uNL\\u\\u\\u_", "params_", "=_", "attrs_", "._", "setdefault_", "(_", "\"", "OP", "\\u", "PARAM", "S", "\"_", ",_", "[_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Us", "e", " ", "parameter", " ", "names", " ", "as", " ", "slots_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "[_", "pname_", "for_", "(_", "pname_", ",_", "\\u_", ",_", "\\u_", ",_", "\\u_", ")_", "in_", "params_", "]_", "\\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_", "Base", "Op", "Code_", "(_", "out", "ils_", "._", "Validate", "d", "Slot", "s_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "A", " ", "simple", " ", "serializable", " ", "object", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", "Thi", "s", " ", "object", " ", "serve", "s", " ", "as", " ", "a", " ", "parent", " ", "class", " ", "for", " ", "Op", "Code", " ", "with", "out", " ", "any", " ", "custom", "\\", "10", ";", " ", " ", "field", " ", "handling", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "pylint", ":", " ", "disable", "=", "E1", "101_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "as", " ", "OP", "\\u", "ID", " ", "is", " ", "dynami", "call", "y", " ", "defined_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u", "metaclass\\u\\u_", "=_", "\\u", "Auto", "Op", "Param", "Slot", "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\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Base", "Op", "Code_", "(_", "out", "ils_", "._", "Validate", "d", "Slot", "s_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "out", "ils_", "._", "Validate", "d", "Slot", "s_", "._", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "key_", ",_", "default_", ",_", "\\u_", ",_", "\\u_", "in_", "self_", "._", "\\u\\u", "class\\u\\u_", "._", "Get", "All", "Params_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "hasattr_", "(_", "self_", ",_", "key_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "setattr_", "(_", "self_", ",_", "key_", ",_", "default_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Base", "Op", "Code_", "(_", "out", "ils_", "._", "Validate", "d", "Slot", "s_", ")_", ":_", "\\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_", "\\u\\u", "getstate", "\\u\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Gene", "ric", " ", "serialize", "r", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Thi", "s", " ", "method", " ", "just", " ", "return", "s", " ", "the", " ", "content", "s", " ", "of", " ", "the", " ", "instance", " ", "as", " ", "a", "\\", "10", ";", " ", " ", " ", " ", "dictionar", "y", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "@", "rty", "pe", ":", " ", " ", "C", "{", "dict", "}", "\\", "10", ";", " ", " ", " ", " ", "@", "return", ":", " ", "the", " ", "instance", " ", "attribute", "s", " ", "and", " ", "thei", "r", " ", "values", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "state_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "name_", "in_", "self_", "._", "Get", "All", "Slot", "s_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "hasattr_", "(_", "self_", ",_", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "state_", "[_", "name_", "]_", "=_", "getattr_", "(_", "self_", ",_", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "state_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Base", "Op", "Code_", "(_", "out", "ils_", "._", "Validate", "d", "Slot", "s_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "setstate", "\\u\\u_", "(_", "self_", ",_", "state_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Gene", "ric", " ", "unse", "rial", "ize", "r", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Thi", "s", " ", "method", " ", "just", " ", "restore", "s", " ", "from", " ", "the", " ", "serialize", "d", " ", "state", " ", "the", " ", "attribute", "s", "\\", "10", ";", " ", " ", " ", " ", "of", " ", "the", " ", "current", " ", "instance", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "@", "param", " ", "state", ":", " ", "the", " ", "serialize", "d", " ", "opcode", " ", "data", "\\", "10", ";", " ", " ", " ", " ", "@", "type", " ", "state", ":", " ", " ", "C", "{", "dict", "}", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "isinstance_", "(_", "state_", ",_", "dict_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Value", "Error_", "(_", "\"", "Inva", "lid", " ", "data", " ", "to", " ", "\\u\\u", "setstate", "\\u\\u:", " ", "expected", " ", "dict", ",", " ", "got", " ", "%", "s", "\"_", "%_", "\\u\\u\\uNL\\u\\u\\u_", "type_", "(_", "state_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "name_", "in_", "self_", "._", "Get", "All", "Slot", "s_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "name_", "not_", "in_", "state_", "and_", "hasattr_", "(_", "self_", ",_", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "delattr", "_", "(_", "self_", ",_", "name_", ")_", "\\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_", "name_", "in_", "state_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "setattr_", "(_", "self_", ",_", "name_", ",_", "state_", "[_", "name_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Base", "Op", "Code_", "(_", "out", "ils_", "._", "Validate", "d", "Slot", "s_", ")_", ":_", "\\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_", "Get", "All", "Params_", "(_", "cls_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Compute", " ", "list", " ", "of", " ", "all", " ", "parameter", "s", " ", "for", " ", "an", " ", "opcode", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "slots_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "parent_", "in_", "cls_", "._", "\\u\\u", "mro", "\\u\\u_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "slots_", "._", "extend_", "(_", "getattr_", "(_", "parent_", ",_", "\"", "OP", "\\u", "PARAM", "S", "\"_", ",_", "[_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "slots_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Base", "Op", "Code_", "(_", "out", "ils_", "._", "Validate", "d", "Slot", "s_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Validate", "_", "(_", "self_", ",_", "set\\u", "defaults_", ")_", ":_", "#", " ", "pylint", ":", " ", "disable", "=", "W", "022", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Validate", " ", "opcode", " ", "parameter", "s", ",", " ", "option", "ally", " ", "setti", "ng", " ", "default", " ", "values", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "@", "type", " ", "set\\u", "default", "s", ":", " ", "bool", "\\", "10", ";", " ", " ", " ", " ", "@", "param", " ", "set\\u", "default", "s", ":", " ", "whe", "ther", " ", "to", " ", "set", " ", "default", " ", "values", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "@", "rty", "pe", ":", " ", "Non", "e", "Type", "\\", "10", ";", " ", " ", " ", " ", "@", "return", ":", " ", "L", "{", "Non", "e", "},", " ", "if", " ", "the", " ", "validation", " ", "succeeds", "\\", "10", ";", " ", " ", " ", " ", "@", "raise", " ", "error", "s", ".", "Op", "Pre", "req", "Error", ":", " ", "whe", "n", " ", "a", " ", "parameter", " ", "value", " ", "doe", "sn", "'", "t", " ", "match", "\\", "10", ";", " ", " ", " ", " ", " ", " ", " ", "require", "ment", "s", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "(_", "attr", "\\u", "name_", ",_", "default_", ",_", "test_", ",_", "\\u_", ")_", "in_", "self_", "._", "Get", "All", "Params_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "assert_", "callable_", "(_", "test_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "hasattr_", "(_", "self_", ",_", "attr", "\\u", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "attr", "\\u", "val_", "=_", "getattr_", "(_", "self_", ",_", "attr", "\\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 ", " _", "attr", "\\u", "val_", "=_", "copy_", "._", "deepcopy_", "(_", "default_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "test_", "(_", "attr", "\\u", "val_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "set\\u", "defaults_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "setattr_", "(_", "self_", ",_", "attr", "\\u", "name_", ",_", "attr", "\\u", "val_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "ht_", "._", "TI", "nt_", "(_", "attr", "\\u", "val_", ")_", "and_", "test_", "(_", "float_", "(_", "attr", "\\u", "val_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "set\\u", "defaults_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "setattr_", "(_", "self_", ",_", "attr", "\\u", "name_", ",_", "float_", "(_", "attr", "\\u", "val_", ")_", ")_", "\\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 ", " _", "logging_", "._", "error_", "(_", "\"", "Op", "Code", " ", "%", "s", ",", " ", "parameter", " ", "%", "s", ",", " ", "has", " ", "invalid", " ", "type", " ", "%", "s", "/", "value", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", " ", "'%", "s", "'", " ", "expect", "ing", " ", "type", " ", "%", "s", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "OP", "\\u", "ID_", ",_", "attr", "\\u", "name_", ",_", "type_", "(_", "attr", "\\u", "val_", ")_", ",_", "attr", "\\u", "val_", ",_", "test_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "attr", "\\u", "val_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logging_", "._", "error_", "(_", "\"", "Op", "Code", " ", "%", "s", ",", " ", "parameter", " ", "%", "s", ",", " ", "has", " ", "default", " ", "value", " ", "Non", "e", " ", "whi", "ch", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", " ", "is", " ", "doe", "s", " ", "not", " ", "check", " ", "against", " ", "the", " ", "parameter", "'", "s", " ", "type", ":", " ", "this", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", " ", "means", " ", "this", " ", "parameter", " ", "is", " ", "require", "d", " ", "but", " ", "no", " ", "value", " ", "was", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", " ", "give", "n", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "OP", "\\u", "ID_", ",_", "attr", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "raise_", "errors_", "._", "Op", "Pre", "req", "Error_", "(_", "\"", "Parameter", " ", "'%", "s", ".", "%", "s", "'", " ", "fail", "s", " ", "validation", "\"_", "%_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "self_", "._", "OP", "\\u", "ID_", ",_", "attr", "\\u", "name_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "errors_", "._", "ECO", "DE", "\\u", "INV", "AL_", ")_", "\\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_", "def_", "Build", "Jo", "b", "Dep", "Check_", "(_", "relative_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Build", "s", " ", "check", " ", "for", " ", "job", " ", "dependen", "cies", " ", "(", "L", "{", "DEP", "END", "\\u", "ATT", "R", "}).", "\\", "10", ";", "\\", "10", ";", " ", " ", "@", "type", " ", "relative", ":", " ", "bool", "\\", "10", ";", " ", " ", "@", "param", " ", "relative", ":", " ", "Whe", "ther", " ", "to", " ", "accept", " ", "relative", " ", "job", " ", "ID", "s", " ", "(", "negati", "ve", ")", "\\", "10", ";", " ", " ", "@", "rty", "pe", ":", " ", "calla", "ble", "\\", "10", ";", "\\", "10", ";", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "relative_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "job", "\\u", "id_", "=_", "ht_", "._", "TO", "r_", "(_", "ht_", "._", "TJ", "ob", "Id_", ",_", "ht_", "._", "TR", "ela", "tiv", "e", "Jo", "b", "Id_", ")_", "\\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 ", " _", "job", "\\u", "id_", "=_", "ht_", "._", "TJ", "ob", "Id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "job", "\\u", "dep_", "=_", "ht_", "._", "TA", "nd_", "(_", "ht_", "._", "TO", "r_", "(_", "ht_", "._", "TL", "ist", "Of_", "(_", "ht_", "._", "TA", "ny_", ")_", ",_", "ht_", "._", "TT", "uple_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "ht_", "._", "TI", "s", "Length_", "(_", "2_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "ht_", "._", "TI", "tems_", "(_", "[_", "job", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "ht_", "._", "TL", "ist", "Of_", "(_", "ht_", "._", "TE", "lem", "Of_", "(_", "constants_", "._", "JOB", "S", "\\u", "FINAL", "IZED", "_", ")_", ")_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\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 ]
Unused import
ckan/ckanapi/ckanapi/common.py
[ { "content": "\"\"\"\nCode shared by LocalCKAN, RemoteCKAN and TestCKAN\n\"\"\"\n\nimport json\n\nfrom ckanapi.errors import (CKANAPIError, NotAuthorized, NotFound,\n ValidationError, SearchQueryError, SearchError, SearchIndexError,\n ServerIncompatibleError)\n\n\n\n\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class ActionShortcut(object):\n \"\"\"\n ActionShortcut(foo).bar(baz=2) <=> foo.call_action('bar', {'baz':2})\n\n An instance of this class is used as the .action attribute of\n LocalCKAN and RemoteCKAN instances to provide a short way to call\n actions, e.g::\n\n pkg = demo.action.package_show(id='adur_district_spending')\n\n instead of::\n\n pkg = demo.call_action('package_show', {'id':'adur_district_spending'})\n\n File-like values (objects with a 'read' attribute) are\n sent as file-uploads::\n\n pkg = demo.action.resource_update(package_id='foo', upload=open(..))\n\n becomes::\n\n pkg = demo.call_action('resource_update',\n {'package_id': 'foo'}, files={'upload': open(..)})\n\n \"\"\"\n", "metadata": "root.ActionShortcut", "header": "['module', '___EOS___']", "index": 10 }, { "content": " def __init__(self, ckan):\n self._ckan = ckan", "metadata": "root.ActionShortcut.__init__", "header": "['class', 'ActionShortcut', '(', 'object', ')', ':', '___EOS___']", "index": 35 }, { "content": " def __getattr__(self, name):\n def action(**kwargs):\n files = {}\n for k, v in kwargs.items():\n if is_file_like(v):\n files[k] = v\n if files:\n nonfiles = dict((k, v) for k, v in kwargs.items()\n if k not in files)\n return self._ckan.call_action(name,\n data_dict=nonfiles,\n files=files)\n return self._ckan.call_action(name, data_dict=kwargs)\n return action", "metadata": "root.ActionShortcut.__getattr__", "header": "['class', 'ActionShortcut', '(', 'object', ')', ':', '___EOS___']", "index": 38 }, { "content": "def is_file_like(v):\n \"\"\"\n Return True if this object is file-like or is a tuple in a format\n that the requests library would accept for uploading.\n \"\"\"\n # see http://docs.python-requests.org/en/latest/user/quickstart/#more-complicated-post-requests\n return hasattr(v, 'read') or (\n isinstance(v, tuple) and len(v) >= 2 and hasattr(v[1], 'read'))", "metadata": "root.is_file_like", "header": "['module', '___EOS___']", "index": 54 }, { "content": "def prepare_action(action, data_dict=None, apikey=None, files=None):\n \"\"\"\n Return action_url, data_json, http_headers\n \"\"\"\n if not data_dict:\n data_dict = {}\n headers = {}\n if files:\n # when uploading files all parameters must be strings and\n # no nesting is allowed because request is sent as multipart\n items = data_dict.items()\n data_dict = {}\n for (k, v) in items:\n if v is None:\n continue # assuming missing will work the same as None\n if isinstance(v, (int, float)):\n v = unicode(v)\n data_dict[k.encode('utf-8')] = v.encode('utf-8')\n else:\n data_dict = json.dumps(data_dict).encode('ascii')\n headers['Content-Type'] = 'application/json'\n if apikey:\n apikey = str(apikey)\n headers['X-CKAN-API-Key'] = apikey\n headers['Authorization'] = apikey\n url = 'api/action/' + action\n return url, data_dict, headers", "metadata": "root.prepare_action", "header": "['module', '___EOS___']", "index": 64 }, { "content": "def reverse_apicontroller_action(url, status, response):\n \"\"\"\n Make an API call look like a direct action call by reversing the\n exception -> HTTP response translation that ApiController.action does\n \"\"\"\n try:\n parsed = json.loads(response)\n if parsed.get('success'):\n return parsed['result']\n if hasattr(parsed, 'get'):\n err = parsed.get('error', {})\n else:\n err = {}\n except (AttributeError, ValueError):\n err = {}\n\n if not isinstance(err, dict): # possibly a Socrata API.\n raise ServerIncompatibleError(repr([url, status, response]))\n\n etype = err.get('__type')\n emessage = err.get('message', '').split(': ', 1)[-1]\n if etype == 'Search Query Error':\n # I refuse to eval(emessage), even if it would be more correct\n raise SearchQueryError(emessage)\n elif etype == 'Search Error':\n # I refuse to eval(emessage), even if it would be more correct\n raise SearchError(emessage)\n elif etype == 'Search Index Error':\n raise SearchIndexError(emessage)\n elif etype == 'Validation Error':\n raise ValidationError(err)\n elif etype == 'Not Found Error':\n raise NotFound(emessage)\n elif etype == 'Authorization Error':\n raise NotAuthorized(err)\n\n # don't recognize the error\n raise CKANAPIError(repr([url, status, response]))", "metadata": "root.reverse_apicontroller_action", "header": "['module', '___EOS___']", "index": 93 } ]
[]
[]
0
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\"\"\"", "\\", "10", ";", "Code", " ", "shared", " ", "by", " ", "Local", "CK", "AN", ",", " ", "Remo", "te", "CK", "AN", " ", "and", " ", "Test", "CK", "AN", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "json_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "ckan", "api_", "._", "errors_", "import_", "(_", "CK", "ANA", "PIE", "rror_", ",_", "Not", "Authorized", "_", ",_", "Not", "Found_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Validat", "ion", "Error_", ",_", "Sear", "ch", "Query", "Error_", ",_", "Sear", "ch", "Error_", ",_", "Sear", "ch", "Index", "Error_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Server", "Incomp", "atible", "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\\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_", "Action", "Shortcut_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Action", "Short", "cut", "(", "foo", ").", "bar", "(", "ba", "z", "=", "2", ")", " ", "<=", ">", " ", "foo", ".", "call", "\\u", "action", "('", "bar", "',", " ", "{", "'", "ba", "z", "':", "2", "})", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "An", " ", "instance", " ", "of", " ", "this", " ", "class", " ", "is", " ", "used", " ", "as", " ", "the", " ", ".", "action", " ", "attribute", " ", "of", "\\", "10", ";", " ", " ", " ", " ", "Local", "CK", "AN", " ", "and", " ", "Remo", "te", "CK", "AN", " ", "instance", "s", " ", "to", " ", "provide", " ", "a", " ", "short", " ", "way", " ", "to", " ", "call", "\\", "10", ";", " ", " ", " ", " ", "action", "s", ",", " ", "e", ".", "g", "::", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "pkg", " ", "=", " ", "demo", ".", "action", ".", "package", "\\u", "show", "(", "id", "='", "ad", "ur\\u", "district", "\\u", "spend", "ing", "')", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "inst", "ead", " ", "of", "::", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "pkg", " ", "=", " ", "demo", ".", "call", "\\u", "action", "('", "package", "\\u", "show", "',", " ", "{", "'", "id", "':", "'", "ad", "ur\\u", "district", "\\u", "spend", "ing", "'})", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "File", "-", "like", " ", "values", " ", "(", "object", "s", " ", "with", " ", "a", " ", "'", "read", "'", " ", "attribute", ")", " ", "are", "\\", "10", ";", " ", " ", " ", " ", "sent", " ", "as", " ", "file", "-", "uploads", "::", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "pkg", " ", "=", " ", "demo", ".", "action", ".", "resource", "\\u", "update", "(", "package", "\\u", "id", "='", "foo", "',", " ", "upload", "=", "open", "(.", ".)", ")", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "bec", "ome", "s", "::", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "pkg", " ", "=", " ", "demo", ".", "call", "\\u", "action", "('", "resource", "\\u", "update", "',", "\\", "10", ";", " ", " ", " ", " ", "{", "'", "package", "\\u", "id", "':", " ", "'", "foo", "'}", ",", " ", "files", "={", "'", "upload", "':", " ", "open", "(.", ".)", "})", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Action", "Shortcut_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "ckan", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "ckan", "_", "=_", "ckan", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Action", "Shortcut_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "getattr\\u\\u_", "(_", "self_", ",_", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "action_", "(_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "files_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "k_", ",_", "v_", "in_", "kwargs_", "._", "items_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "is", "\\u", "file", "\\u", "like_", "(_", "v_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "files_", "[_", "k_", "]_", "=_", "v_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "files_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "non", "files_", "=_", "dict_", "(_", "(_", "k_", ",_", "v_", ")_", "for_", "k_", ",_", "v_", "in_", "kwargs_", "._", "items_", "(_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "k_", "not_", "in_", "files_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "\\u", "ckan", "_", "._", "call", "\\u", "action_", "(_", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "data\\u", "dict_", "=_", "non", "files_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "files_", "=_", "files_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "self_", "._", "\\u", "ckan", "_", "._", "call", "\\u", "action_", "(_", "name_", ",_", "data\\u", "dict_", "=_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "action_", "\\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_", "is", "\\u", "file", "\\u", "like_", "(_", "v_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Return", " ", "Tru", "e", " ", "if", " ", "this", " ", "object", " ", "is", " ", "file", "-", "like", " ", "or", " ", "is", " ", "a", " ", "tuple", " ", "in", " ", "a", " ", "format", "\\", "10", ";", " ", " ", " ", " ", "tha", "t", " ", "the", " ", "request", "s", " ", "librar", "y", " ", "wou", "ld", " ", "accept", " ", "for", " ", "upload", "ing", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "see", " ", "http", "://", "docs", ".", "python", "-", "request", "s", ".", "org", "/", "en", "/", "late", "st", "/", "user", "/", "quicks", "tart", "/", "#", "more", "-", "compli", "cated", "-", "post", "-", "requests_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "hasattr_", "(_", "v_", ",_", "'", "read", "'_", ")_", "or_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "isinstance_", "(_", "v_", ",_", "tuple_", ")_", "and_", "len_", "(_", "v_", ")_", ">=_", "2_", "and_", "hasattr_", "(_", "v_", "[_", "1_", "]_", ",_", "'", "read", "'_", ")_", ")_", "\\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_", "prepar", "e\\u", "action_", "(_", "action_", ",_", "data\\u", "dict_", "=_", "None_", ",_", "apikey_", "=_", "None_", ",_", "files_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Return", " ", "action", "\\u", "url", ",", " ", "data\\u", "json", ",", " ", "http", "\\u", "header", "s", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "data\\u", "dict_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "data\\u", "dict_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "headers_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "files_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "whe", "n", " ", "upload", "ing", " ", "files", " ", "all", " ", "parameter", "s", " ", "must", " ", "be", " ", "string", "s", " ", "and_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "no", " ", "nesting", " ", "is", " ", "allow", "ed", " ", "bec", "aus", "e", " ", "request", " ", "is", " ", "sent", " ", "as", " ", "multipart_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "items_", "=_", "data\\u", "dict_", "._", "items_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data\\u", "dict_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "(_", "k_", ",_", "v_", ")_", "in_", "items_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "v_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "continue_", "#", " ", "ass", "umi", "ng", " ", "missi", "ng", " ", "will", " ", "work", " ", "the", " ", "same", " ", "as", " ", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "isinstance_", "(_", "v_", ",_", "(_", "int_", ",_", "float_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "v_", "=_", "unicode_", "(_", "v_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "data\\u", "dict_", "[_", "k_", "._", "encode_", "(_", "'", "utf", "-", "8", "'_", ")_", "]_", "=_", "v_", "._", "encode_", "(_", "'", "utf", "-", "8", "'_", ")_", "\\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 ", " _", "data\\u", "dict_", "=_", "json_", "._", "dumps_", "(_", "data\\u", "dict_", ")_", "._", "encode_", "(_", "'", "ascii", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "headers_", "[_", "'", "Conten", "t", "-", "Type", "'_", "]_", "=_", "'", "applica", "tion", "/", "json", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "apikey_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "apikey_", "=_", "str_", "(_", "apikey_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "headers_", "[_", "'", "X", "-", "CK", "AN", "-", "API", "-", "Key", "'_", "]_", "=_", "apikey_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "headers_", "[_", "'", "Authoriz", "ation", "'_", "]_", "=_", "apikey_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "url_", "=_", "'", "api", "/", "action", "/'_", "+_", "action_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "url_", ",_", "data\\u", "dict_", ",_", "headers_", "\\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_", "reverse", "\\u", "apic", "ontr", "olle", "r", "\\u", "action_", "(_", "url_", ",_", "status_", ",_", "response_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Make", " ", "an", " ", "API", " ", "call", " ", "look", " ", "like", " ", "a", " ", "direct", " ", "action", " ", "call", " ", "by", " ", "reversi", "ng", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "exception", " ", "->", " ", "HTTP", " ", "response", " ", "translatio", "n", " ", "tha", "t", " ", "Ap", "i", "Controlle", "r", ".", "action", " ", "doe", "s", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "parsed_", "=_", "json_", "._", "loads_", "(_", "response_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "parsed_", "._", "get_", "(_", "'", "success", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "parsed_", "[_", "'", "result", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "hasattr_", "(_", "parsed_", ",_", "'", "get", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "err_", "=_", "parsed_", "._", "get_", "(_", "'", "error", "'_", ",_", "{_", "}_", ")_", "\\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_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "(_", "Attribute", "Error_", ",_", "Value", "Error_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "err_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "isinstance_", "(_", "err_", ",_", "dict_", ")_", ":_", "#", " ", "possib", "ly", " ", "a", " ", "So", "cra", "ta", " ", "API", "._", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Server", "Incomp", "atible", "Error_", "(_", "repr_", "(_", "[_", "url_", ",_", "status_", ",_", "response_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "etype_", "=_", "err_", "._", "get_", "(_", "'\\u", "\\u", "type", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "eme", "ssa", "ge_", "=_", "err_", "._", "get_", "(_", "'", "message", "'_", ",_", "''_", ")_", "._", "split_", "(_", "':", " ", "'_", ",_", "1_", ")_", "[_", "-_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "etype_", "==_", "'", "Sear", "ch", " ", "Query", " ", "Error", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "I", " ", "refuse", " ", "to", " ", "eval", "(", "eme", "ssa", "ge", "),", " ", "even", " ", "if", " ", "it", " ", "wou", "ld", " ", "be", " ", "more", " ", "correct_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Sear", "ch", "Query", "Error_", "(_", "eme", "ssa", "ge_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "etype_", "==_", "'", "Sear", "ch", " ", "Error", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "I", " ", "refuse", " ", "to", " ", "eval", "(", "eme", "ssa", "ge", "),", " ", "even", " ", "if", " ", "it", " ", "wou", "ld", " ", "be", " ", "more", " ", "correct_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Sear", "ch", "Error_", "(_", "eme", "ssa", "ge_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "etype_", "==_", "'", "Sear", "ch", " ", "Index", " ", "Error", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Sear", "ch", "Index", "Error_", "(_", "eme", "ssa", "ge_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "etype_", "==_", "'", "Validat", "ion", " ", "Error", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Validat", "ion", "Error_", "(_", "err_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "etype_", "==_", "'", "Not", " ", "Foun", "d", " ", "Error", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Not", "Found_", "(_", "eme", "ssa", "ge_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "etype_", "==_", "'", "Authoriz", "ation", " ", "Error", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Not", "Authorized", "_", "(_", "err_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "don", "'", "t", " ", "recognize", " ", "the", " ", "error_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "raise_", "CK", "ANA", "PIE", "rror_", "(_", "repr_", "(_", "[_", "url_", ",_", "status_", ",_", "response_", "]_", ")_", ")_" ]
[ 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, 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,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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 ]
Unused import
quantmind/pulsar/tests/utils/test_misc.py
[ { "content": "import sys\nimport unittest\n\nfrom pulsar import reraise\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class TestMiscellaneous(unittest.TestCase):\n", "metadata": "root.TestMiscellaneous", "header": "['module', '___EOS___']", "index": 6 }, { "content": " def test_reraise(self):\n self.assertRaises(RuntimeError, reraise, RuntimeError, RuntimeError())\n try:\n raise RuntimeError('bla')\n except Exception:\n exc_info = sys.exc_info()\n self.assertRaises(RuntimeError, reraise, *exc_info)", "metadata": "root.TestMiscellaneous.test_reraise", "header": "['class', 'TestMiscellaneous', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 8 } ]
[]
[]
0
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "unittest_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "puls", "ar_", "import_", "reraise", "_", "\\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_", "Test", "Mis", "cell", "ane", "ous_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Test", "Mis", "cell", "ane", "ous_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "test\\u", "reraise", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "Raises_", "(_", "Run", "time", "Error_", ",_", "reraise", "_", ",_", "Run", "time", "Error_", ",_", "Run", "time", "Error_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Run", "time", "Error_", "(_", "'", "bla", "'_", ")_", "\\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 ", " _", "exc", "\\u", "info_", "=_", "sys_", "._", "exc", "\\u", "info_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert", "Raises_", "(_", "Run", "time", "Error_", ",_", "reraise", "_", ",_", "*_", "exc", "\\u", "info_", ")_" ]
[ 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, 4, 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 ]
Duplicate key in dict literal
zzzeek/sqlalchemy/test/ext/test_mutable.py
[ { "content": " def test_popitem(self):\n sess = Session()\n\n orig = {'a': 'b', 'c': 'd'}\n\n # the orig dict remains unchanged when we assign,\n # but just making this future-proof\n data = dict(orig)\n f1 = Foo(data=data)\n sess.add(f1)\n sess.commit()\n\n k, v = f1.data.popitem()\n assert k in ('a', 'c')\n orig.pop(k)\n\n sess.commit()\n\n eq_(f1.data, orig)", "metadata": "root._MutableDictTestBase.test_popitem", "header": "['class', '_MutableDictTestBase', '(', '_MutableDictTestFixture', ')', ':', '___EOS___']", "index": 165 } ]
[]
[]
0
true
[ "[CLS]_", "Duplicate", "_", "key_", "in_", "dict_", "literal_", "[SEP]_", "class_", "\\u", "Mut", "able", "Dict", "Test", "Base_", "(_", "\\u", "Mut", "able", "Dict", "Test", "Fixture_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "popi", "tem_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sess_", "=_", "Session_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "orig_", "=_", "{_", "'", "a", "'_", ":_", "'", "b", "'_", ",_", "'", "c", "'_", ":_", "'", "d", "'_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "the", " ", "orig", " ", "dict", " ", "remains", " ", "unchanged", " ", "whe", "n", " ", "we", " ", "assign", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "but", " ", "just", " ", "mak", "ing", " ", "this", " ", "future", "-", "proof", "_", "\\u\\u\\uNL\\u\\u\\u_", "data_", "=_", "dict_", "(_", "orig_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f1_", "=_", "Foo_", "(_", "data_", "=_", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sess_", "._", "add_", "(_", "f1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sess_", "._", "commit_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "k_", ",_", "v_", "=_", "f1_", "._", "data_", "._", "popi", "tem_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "k_", "in_", "(_", "'", "a", "'_", ",_", "'", "c", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "orig_", "._", "pop_", "(_", "k_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "sess_", "._", "commit_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "eq\\u_", "(_", "f1_", "._", "data_", ",_", "orig_", ")_", "\\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 ]
Unused local variable
bokeh/datashader/datashader/composite.py
[ { "content": "@operator\ndef over(src, dst):\n sr, sg, sb, sa = extract_scaled(src)\n dr, dg, db, da = extract_scaled(dst)\n\n factor = 1 - sa\n a = sa + da * factor\n if a == 0:\n return np.uint32(0)\n r = (sr * sa + dr * da * factor)/a\n g = (sg * sa + dg * da * factor)/a\n b = (sb * sa + db * da * factor)/a\n return combine_scaled(r, g, b, a)", "metadata": "root.over", "header": "['module', '___EOS___']", "index": 55 } ]
[]
[]
0
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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "operator_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "over_", "(_", "src_", ",_", "dst_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sr_", ",_", "sg_", ",_", "sb_", ",_", "sa_", "=_", "extract", "\\u", "scaled_", "(_", "src_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dr_", ",_", "dg_", ",_", "db_", ",_", "da_", "=_", "extract", "\\u", "scaled_", "(_", "dst_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "factor_", "=_", "1_", "-_", "sa_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "a_", "=_", "sa_", "+_", "da_", "*_", "factor_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "a_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "np_", "._", "uint32_", "(_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "r_", "=_", "(_", "sr_", "*_", "sa_", "+_", "dr_", "*_", "da_", "*_", "factor_", ")_", "/_", "a_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "g_", "=_", "(_", "sg_", "*_", "sa_", "+_", "dg_", "*_", "da_", "*_", "factor_", ")_", "/_", "a_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "b_", "=_", "(_", "sb_", "*_", "sa_", "+_", "db_", "*_", "da_", "*_", "factor_", ")_", "/_", "a_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "combin", "e\\u", "scaled_", "(_", "r_", ",_", "g_", ",_", "b_", ",_", "a_", ")_", "\\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 ]
Unreachable code
kamyu104/LeetCode/Python/create-maximum-number.py
[ { "content": " def maxNumber(self, nums1, nums2, k):\n \"\"\"\n :type nums1: List[int]\n :type nums2: List[int]\n :type k: int\n :rtype: List[int]\n \"\"\"\n def get_max_digits(nums, start, end, max_digits):\n max_digits[end] = max_digit(nums, end)\n for i in reversed(xrange(start, end)):\n max_digits[i] = delete_digit(max_digits[i + 1])\n\n def max_digit(nums, k):\n drop = len(nums) - k\n res = []\n for num in nums:\n while drop and res and res[-1] < num:\n res.pop()\n drop -= 1\n res.append(num)\n return res[:k]\n\n def delete_digit(nums):\n res = list(nums)\n for i in xrange(len(res)):\n if i == len(res) - 1 or res[i] < res[i + 1]:\n res = res[:i] + res[i+1:]\n break\n return res\n \n def merge(a, b):\n return [max(a, b).pop(0) for _ in xrange(len(a)+len(b))]\n\n m, n = len(nums1), len(nums2)\n\n max_digits1, max_digits2 = [[] for _ in xrange(k + 1)], [[] for _ in xrange(k + 1)]\n get_max_digits(nums1, max(0, k - n), min(k, m), max_digits1)\n get_max_digits(nums2, max(0, k - m), min(k, n), max_digits2)\n\n return max(merge(max_digits1[i], max_digits2[k-i]) \\\n for i in xrange(max(0, k - n), min(k, m) + 1))", "metadata": "root.Solution.maxNumber", "header": "['class', 'Solution', '(', 'object', ')', ':', '___EOS___']", "index": 30 } ]
[]
[]
0
true
[ "[CLS]_", "Unrea", "chab", "le_", "code_", "[SEP]_", "class_", "Solution_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "max", "Number_", "(_", "self_", ",_", "nums", "1_", ",_", "nums", "2_", ",_", "k_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", ":", "type", " ", "nums", "1", ":", " ", "List", "[", "int", "]", "\\", "10", ";", " ", " ", " ", " ", ":", "type", " ", "nums", "2", ":", " ", "List", "[", "int", "]", "\\", "10", ";", " ", " ", " ", " ", ":", "type", " ", "k", ":", " ", "int", "\\", "10", ";", " ", " ", " ", " ", ":", "rty", "pe", ":", " ", "List", "[", "int", "]", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "get", "\\u", "max", "\\u", "digits_", "(_", "nums_", ",_", "start_", ",_", "end_", ",_", "max", "\\u", "digits_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "max", "\\u", "digits_", "[_", "end_", "]_", "=_", "max", "\\u", "digit_", "(_", "nums_", ",_", "end_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", "in_", "reversed_", "(_", "xrange_", "(_", "start_", ",_", "end_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "max", "\\u", "digits_", "[_", "i_", "]_", "=_", "delete", "\\u", "digit_", "(_", "max", "\\u", "digits_", "[_", "i_", "+_", "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_", "def_", "max", "\\u", "digit_", "(_", "nums_", ",_", "k_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "drop_", "=_", "len_", "(_", "nums_", ")_", "-_", "k_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "num_", "in_", "nums_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "while_", "drop_", "and_", "res_", "and_", "res_", "[_", "-_", "1_", "]_", "<_", "num_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "res_", "._", "pop_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "drop_", "-=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "res_", "._", "append_", "(_", "num_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "res_", "[_", ":_", "k_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "delete", "\\u", "digit_", "(_", "nums_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "res_", "=_", "list_", "(_", "nums_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", "in_", "xrange_", "(_", "len_", "(_", "res_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "i_", "==_", "len_", "(_", "res_", ")_", "-_", "1_", "or_", "res_", "[_", "i_", "]_", "<_", "res_", "[_", "i_", "+_", "1_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "res_", "=_", "res_", "[_", ":_", "i_", "]_", "+_", "res_", "[_", "i_", "+_", "1_", ":_", "]_", "\\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_", "return_", "res_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "merge_", "(_", "a_", ",_", "b_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "[_", "max_", "(_", "a_", ",_", "b_", ")_", "._", "pop_", "(_", "0_", ")_", "for_", "\\u_", "in_", "xrange_", "(_", "len_", "(_", "a_", ")_", "+_", "len_", "(_", "b_", ")_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "m_", ",_", "n_", "=_", "len_", "(_", "nums", "1_", ")_", ",_", "len_", "(_", "nums", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "max", "\\u", "digit", "s1_", ",_", "max", "\\u", "digit", "s2_", "=_", "[_", "[_", "]_", "for_", "\\u_", "in_", "xrange_", "(_", "k_", "+_", "1_", ")_", "]_", ",_", "[_", "[_", "]_", "for_", "\\u_", "in_", "xrange_", "(_", "k_", "+_", "1_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "get", "\\u", "max", "\\u", "digits_", "(_", "nums", "1_", ",_", "max_", "(_", "0_", ",_", "k_", "-_", "n_", ")_", ",_", "min_", "(_", "k_", ",_", "m_", ")_", ",_", "max", "\\u", "digit", "s1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "get", "\\u", "max", "\\u", "digits_", "(_", "nums", "2_", ",_", "max_", "(_", "0_", ",_", "k_", "-_", "m_", ")_", ",_", "min_", "(_", "k_", ",_", "n_", ")_", ",_", "max", "\\u", "digit", "s2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "max_", "(_", "merge_", "(_", "max", "\\u", "digit", "s1_", "[_", "i_", "]_", ",_", "max", "\\u", "digit", "s2_", "[_", "k_", "-_", "i_", "]_", ")_", "for_", "i_", "in_", "xrange_", "(_", "max_", "(_", "0_", ",_", "k_", "-_", "n_", ")_", ",_", "min_", "(_", "k_", ",_", "m_", ")_", "+_", "1_", ")_", ")_" ]
[ 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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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'
opennode/nodeconductor/nodeconductor/monitoring/zabbix/api_client.py
[ { "content": " def delete_service_if_exists(self, api, instance):\n name = self.get_service_name(instance)\n try:\n serviceid = api.service.get(filter={'name': name})[0]['serviceid']\n api.service.delete(serviceid)\n return True\n except IndexError:\n return False", "metadata": "root.ZabbixApiClient.delete_service_if_exists", "header": "['class', 'ZabbixApiClient', '(', 'object', ')', ':', '___EOS___']", "index": 304 } ]
[]
[]
0
true
[ "[CLS]_", "Except", "_", "block_", "handles_", "'", "Base", "Except", "ion", "'_", "[SEP]_", "class_", "Za", "bbi", "x", "Ap", "i", "Client_", "(_", "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_", "delete", "\\u", "service", "\\u", "if", "\\u", "exists_", "(_", "self_", ",_", "api_", ",_", "instance_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "name_", "=_", "self_", "._", "get", "\\u", "service", "\\u", "name_", "(_", "instance_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "service", "id_", "=_", "api_", "._", "service_", "._", "get_", "(_", "filter_", "=_", "{_", "'", "name", "'_", ":_", "name_", "}_", ")_", "[_", "0_", "]_", "[_", "'", "service", "id", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "api_", "._", "service_", "._", "delete_", "(_", "service", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Index", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "False_", "\\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 ]
Unused local variable
miracle2k/webassets/src/webassets/filter/jade.py
[ { "content": " def setup(self):\n \"\"\"\n Check options and apply defaults if necessary\n \"\"\"\n super(Jade, self).setup()\n\n self.argv = [self.jade or 'jade']\n self.argv.append('--client')\n\n if self.jade_no_debug:\n self.argv.append('--no-debug')\n\n if not self.js_var:\n self.js_var = 'templates'", "metadata": "root.Jade.setup", "header": "['class', 'Jade', '(', 'Filter', ')', ':', '___EOS___']", "index": 69 } ]
[]
[]
0
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "Ja", "de_", "(_", "Filter_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "setup_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Check", " ", "options", " ", "and", " ", "appl", "y", " ", "default", "s", " ", "if", " ", "necessar", "y", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "super_", "(_", "Ja", "de_", ",_", "self_", ")_", "._", "setup_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "argv_", "=_", "[_", "self_", "._", "jad", "e_", "or_", "'", "jad", "e", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "argv_", "._", "append_", "(_", "'--", "client", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "self_", "._", "jad", "e\\u", "no", "\\u", "debug_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "argv_", "._", "append_", "(_", "'--", "no", "-", "debug", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "self_", "._", "js", "\\u", "var_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "js", "\\u", "var_", "=_", "'", "template", "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 ]
Comparison of constants
limodou/uliweb/uliweb/i18n/pygettext.py
[ { "content": "def _visit_pyfiles(list, dirname, names):\n \"\"\"Helper for getFilesForName().\"\"\"\n # get extension for python source files\n if not globals().has_key('_py_ext'):\n global _py_ext\n# _py_ext = [triple[0] for triple in imp.get_suffixes()\n# if triple[2] == imp.PY_SOURCE][0]\n _py_ext = [triple[0] for triple in imp.get_suffixes()\n if triple[2] == imp.PY_SOURCE]\n \n # don't recurse into CVS directories\n if 'CVS' in names:\n names.remove('CVS')\n\n if '.svn' in names:\n names.remove('.svn')\n\n if '.git' in names:\n names.remove('.git')\n\n if 'static' in names:\n names.remove('static')\n \n # add all *.py files to list\n list.extend(\n [os.path.join(dirname, file) for file in names\n if os.path.splitext(file)[1] in _py_ext]\n )", "metadata": "root._visit_pyfiles", "header": "['module', '___EOS___']", "index": 284 } ]
[]
[]
0
true
[ "[CLS]_", "Compari", "son_", "of_", "constants_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "visit", "\\u", "pyfi", "les_", "(_", "list_", ",_", "dirname_", ",_", "names_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Help", "er", " ", "for", " ", "get", "Files", "For", "Name", "().\"", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "get", " ", "extensi", "on", " ", "for", " ", "python", " ", "source", " ", "files_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "globals_", "(_", ")_", "._", "has", "\\u", "key_", "(_", "'\\u", "py", "\\u", "ext", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "global_", "\\u", "py", "\\u", "ext_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", " ", " ", " ", "\\u", "py", "\\u", "ext", " ", "=", " ", "[", "triple", "[", "0", "]", " ", "for", " ", "triple", " ", "in", " ", "imp", ".", "get", "\\u", "suffixe", "s", "()", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "if", " ", "triple", "[", "2", "]", " ", "==", " ", "imp", ".", "PY", "\\u", "SOU", "RC", "E", "][", "0", "]_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "py", "\\u", "ext_", "=_", "[_", "triple_", "[_", "0_", "]_", "for_", "triple_", "in_", "imp_", "._", "get", "\\u", "suffixes_", "(_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "triple_", "[_", "2_", "]_", "==_", "imp_", "._", "PY", "\\u", "SOURCE_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "don", "'", "t", " ", "recurse", " ", "int", "o", " ", "CV", "S", " ", "directories_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "'", "CV", "S", "'_", "in_", "names_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "names_", "._", "remove_", "(_", "'", "CV", "S", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "'.", "svn", "'_", "in_", "names_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "names_", "._", "remove_", "(_", "'.", "svn", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "'.", "git", "'_", "in_", "names_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "names_", "._", "remove_", "(_", "'.", "git", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "'", "static", "'_", "in_", "names_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "names_", "._", "remove_", "(_", "'", "static", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "add", " ", "all", " ", "*.", "py", " ", "files", " ", "to", " ", "list_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "list_", "._", "extend_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "os_", "._", "path_", "._", "join_", "(_", "dirname_", ",_", "file_", ")_", "for_", "file_", "in_", "names_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "os_", "._", "path_", "._", "splitext_", "(_", "file_", ")_", "[_", "1_", "]_", "in_", "\\u", "py", "\\u", "ext_", "]_", "\\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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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
django/django/django/forms/fields.py
[ { "content": "\"\"\"\nField classes.\n\"\"\"\n\nfrom __future__ import unicode_literals\n\nimport copy\nimport datetime\nimport itertools\nimport os\nimport re\nimport sys\nimport uuid\nfrom decimal import Decimal, DecimalException\nfrom io import BytesIO\n\nfrom django.core import validators\nfrom django.core.exceptions import ValidationError\n# Provide this import for backwards compatibility.\nfrom django.core.validators import EMPTY_VALUES # NOQA\nfrom django.forms.boundfield import BoundField\nfrom django.forms.utils import from_current_timezone, to_current_timezone\nfrom django.forms.widgets import (\n FILE_INPUT_CONTRADICTION, CheckboxInput, ClearableFileInput, DateInput,\n DateTimeInput, EmailInput, HiddenInput, MultipleHiddenInput,\n NullBooleanSelect, NumberInput, Select, SelectMultiple,\n SplitDateTimeWidget, SplitHiddenDateTimeWidget, TextInput, TimeInput,\n URLInput,\n)\nfrom django.utils import formats, six\nfrom django.utils.dateparse import parse_duration\nfrom django.utils.duration import duration_string\nfrom django.utils.encoding import force_str, force_text, smart_text\nfrom django.utils.ipv6 import clean_ipv6_address\nfrom django.utils.six.moves.urllib.parse import urlsplit, urlunsplit\nfrom django.utils.translation import ugettext_lazy as _, ungettext_lazy\n\n__all__ = (\n 'Field', 'CharField', 'IntegerField',\n 'DateField', 'TimeField', 'DateTimeField', 'DurationField',\n 'RegexField', 'EmailField', 'FileField', 'ImageField', 'URLField',\n 'BooleanField', 'NullBooleanField', 'ChoiceField', 'MultipleChoiceField',\n 'ComboField', 'MultiValueField', 'FloatField', 'DecimalField',\n 'SplitDateTimeField', 'GenericIPAddressField', 'FilePathField',\n 'SlugField', 'TypedChoiceField', 'TypedMultipleChoiceField', 'UUIDField',\n)\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class Field(object):\n widget = TextInput # Default widget to use when rendering this type of Field.\n hidden_widget = HiddenInput # Default widget to use when rendering this as \"hidden\".\n default_validators = [] # Default set of validators\n # Add an 'invalid' entry to default_error_message if you want a specific\n # field error message not raised by the field validators.\n default_error_messages = {\n 'required': _('This field is required.'),\n }\n empty_values = list(validators.EMPTY_VALUES)\n\n # Tracks each time a Field instance is created. Used to retain order.\n creation_counter = 0\n\n\n\n\n\n\n\n\n\n\n", "metadata": "root.Field", "header": "['module', '___EOS___']", "index": 48 }, { "content": " def __init__(self, required=True, widget=None, label=None, initial=None,\n help_text='', error_messages=None, show_hidden_initial=False,\n validators=[], localize=False, disabled=False, label_suffix=None):\n # required -- Boolean that specifies whether the field is required.\n # True by default.\n # widget -- A Widget class, or instance of a Widget class, that should\n # be used for this Field when displaying it. Each Field has a\n # default Widget that it'll use if you don't specify this. In\n # most cases, the default widget is TextInput.\n # label -- A verbose name for this field, for use in displaying this\n # field in a form. By default, Django will use a \"pretty\"\n # version of the form field name, if the Field is part of a\n # Form.\n # initial -- A value to use in this Field's initial display. This value\n # is *not* used as a fallback if data isn't given.\n # help_text -- An optional string to use as \"help text\" for this Field.\n # error_messages -- An optional dictionary to override the default\n # messages that the field will raise.\n # show_hidden_initial -- Boolean that specifies if it is needed to render a\n # hidden widget with initial value after widget.\n # validators -- List of additional validators to use\n # localize -- Boolean that specifies if the field should be localized.\n # disabled -- Boolean that specifies whether the field is disabled, that\n # is its widget is shown in the form but not editable.\n # label_suffix -- Suffix to be added to the label. Overrides\n # form's label_suffix.\n self.required, self.label, self.initial = required, label, initial\n self.show_hidden_initial = show_hidden_initial\n self.help_text = help_text\n self.disabled = disabled\n self.label_suffix = label_suffix\n widget = widget or self.widget\n if isinstance(widget, type):\n widget = widget()\n\n # Trigger the localization machinery if needed.\n self.localize = localize\n if self.localize:\n widget.is_localized = True\n\n # Let the widget know whether it should display as required.\n widget.is_required = self.required\n\n # Hook into self.widget_attrs() for any Field-specific HTML attributes.\n extra_attrs = self.widget_attrs(widget)\n if extra_attrs:\n widget.attrs.update(extra_attrs)\n\n self.widget = widget\n\n # Increase the creation counter, and save our local copy.\n self.creation_counter = Field.creation_counter\n Field.creation_counter += 1\n\n messages = {}\n for c in reversed(self.__class__.__mro__):\n messages.update(getattr(c, 'default_error_messages', {}))\n messages.update(error_messages or {})\n self.error_messages = messages\n\n self.validators = list(itertools.chain(self.default_validators, validators))\n\n super(Field, self).__init__()", "metadata": "root.Field.__init__", "header": "['class', 'Field', '(', 'object', ')', ':', '___EOS___']", "index": 62 }, { "content": " def prepare_value(self, value):\n return value", "metadata": "root.Field.prepare_value", "header": "['class', 'Field', '(', 'object', ')', ':', '___EOS___']", "index": 126 }, { "content": " def to_python(self, value):\n return value", "metadata": "root.Field.to_python", "header": "['class', 'Field', '(', 'object', ')', ':', '___EOS___']", "index": 129 }, { "content": " def validate(self, value):\n if value in self.empty_values and self.required:\n raise ValidationError(self.error_messages['required'], code='required')", "metadata": "root.Field.validate", "header": "['class', 'Field', '(', 'object', ')', ':', '___EOS___']", "index": 132 }, { "content": " def run_validators(self, value):\n if value in self.empty_values:\n return\n errors = []\n for v in self.validators:\n try:\n v(value)\n except ValidationError as e:\n if hasattr(e, 'code') and e.code in self.error_messages:\n e.message = self.error_messages[e.code]\n errors.extend(e.error_list)\n if errors:\n raise ValidationError(errors)", "metadata": "root.Field.run_validators", "header": "['class', 'Field', '(', 'object', ')', ':', '___EOS___']", "index": 136 }, { "content": " def clean(self, value):\n \"\"\"\n Validates the given value and returns its \"cleaned\" value as an\n appropriate Python object.\n\n Raises ValidationError for any errors.\n \"\"\"\n value = self.to_python(value)\n self.validate(value)\n self.run_validators(value)\n return value", "metadata": "root.Field.clean", "header": "['class', 'Field', '(', 'object', ')', ':', '___EOS___']", "index": 150 }, { "content": " def bound_data(self, data, initial):\n \"\"\"\n Return the value that should be shown for this field on render of a\n bound form, given the submitted POST data for the field and the initial\n data, if any.\n\n For most fields, this will simply be data; FileFields need to handle it\n a bit differently.\n \"\"\"\n if self.disabled:\n return initial\n return data", "metadata": "root.Field.bound_data", "header": "['class', 'Field', '(', 'object', ')', ':', '___EOS___']", "index": 162 }, { "content": " def widget_attrs(self, widget):\n \"\"\"\n Given a Widget instance (*not* a Widget class), returns a dictionary of\n any HTML attributes that should be added to the Widget, based on this\n Field.\n \"\"\"\n return {}", "metadata": "root.Field.widget_attrs", "header": "['class', 'Field', '(', 'object', ')', ':', '___EOS___']", "index": 175 }, { "content": " def has_changed(self, initial, data):\n \"\"\"\n Return True if data differs from initial.\n \"\"\"\n try:\n data = self.to_python(data)\n if hasattr(self, '_coerce'):\n return self._coerce(data) != self._coerce(initial)\n except ValidationError:\n return True\n # For purposes of seeing whether something has changed, None is\n # the same as an empty string, if the data or initial value we get\n # is None, replace it with ''.\n initial_value = initial if initial is not None else ''\n data_value = data if data is not None else ''\n return initial_value != data_value", "metadata": "root.Field.has_changed", "header": "['class', 'Field', '(', 'object', ')', ':', '___EOS___']", "index": 183 }, { "content": " def get_bound_field(self, form, field_name):\n \"\"\"\n Return a BoundField instance that will be used when accessing the form\n field in a template.\n \"\"\"\n return BoundField(form, self, field_name)", "metadata": "root.Field.get_bound_field", "header": "['class', 'Field', '(', 'object', ')', ':', '___EOS___']", "index": 200 }, { "content": " def __deepcopy__(self, memo):\n result = copy.copy(self)\n memo[id(self)] = result\n result.widget = copy.deepcopy(self.widget, memo)\n result.validators = self.validators[:]\n return result", "metadata": "root.Field.__deepcopy__", "header": "['class', 'Field', '(', 'object', ')', ':', '___EOS___']", "index": 207 }, { "content": "class CharField(Field):\n\n", "metadata": "root.CharField", "header": "['module', '___EOS___']", "index": 215 }, { "content": " def __init__(self, max_length=None, min_length=None, strip=True, *args, **kwargs):\n self.max_length = max_length\n self.min_length = min_length\n self.strip = strip\n super(CharField, self).__init__(*args, **kwargs)\n if min_length is not None:\n self.validators.append(validators.MinLengthValidator(int(min_length)))\n if max_length is not None:\n self.validators.append(validators.MaxLengthValidator(int(max_length)))", "metadata": "root.CharField.__init__", "header": "['class', 'CharField', '(', 'Field', ')', ':', '___EOS___']", "index": 216 }, { "content": " def to_python(self, value):\n \"Returns a Unicode object.\"\n if value in self.empty_values:\n return ''\n value = force_text(value)\n if self.strip:\n value = value.strip()\n return value", "metadata": "root.CharField.to_python", "header": "['class', 'CharField', '(', 'Field', ')', ':', '___EOS___']", "index": 226 }, { "content": " def widget_attrs(self, widget):\n attrs = super(CharField, self).widget_attrs(widget)\n if self.max_length is not None:\n # The HTML attribute is maxlength, not max_length.\n attrs['maxlength'] = str(self.max_length)\n if self.min_length is not None:\n # The HTML attribute is minlength, not min_length.\n attrs['minlength'] = str(self.min_length)\n return attrs", "metadata": "root.CharField.widget_attrs", "header": "['class', 'CharField', '(', 'Field', ')', ':', '___EOS___']", "index": 235 }, { "content": "class IntegerField(Field):\n widget = NumberInput\n default_error_messages = {\n 'invalid': _('Enter a whole number.'),\n }\n re_decimal = re.compile(r'\\.0*\\s*$')\n\n\n", "metadata": "root.IntegerField", "header": "['module', '___EOS___']", "index": 246 }, { "content": " def __init__(self, max_value=None, min_value=None, *args, **kwargs):\n self.max_value, self.min_value = max_value, min_value\n if kwargs.get('localize') and self.widget == NumberInput:\n # Localized number input is not well supported on most browsers\n kwargs.setdefault('widget', super(IntegerField, self).widget)\n super(IntegerField, self).__init__(*args, **kwargs)\n\n if max_value is not None:\n self.validators.append(validators.MaxValueValidator(max_value))\n if min_value is not None:\n self.validators.append(validators.MinValueValidator(min_value))", "metadata": "root.IntegerField.__init__", "header": "['class', 'IntegerField', '(', 'Field', ')', ':', '___EOS___']", "index": 253 }, { "content": " def to_python(self, value):\n \"\"\"\n Validates that int() can be called on the input. Returns the result\n of int(). Returns None for empty values.\n \"\"\"\n value = super(IntegerField, self).to_python(value)\n if value in self.empty_values:\n return None\n if self.localize:\n value = formats.sanitize_separators(value)\n # Strip trailing decimal and zeros.\n try:\n value = int(self.re_decimal.sub('', str(value)))\n except (ValueError, TypeError):\n raise ValidationError(self.error_messages['invalid'], code='invalid')\n return value", "metadata": "root.IntegerField.to_python", "header": "['class', 'IntegerField', '(', 'Field', ')', ':', '___EOS___']", "index": 265 }, { "content": " def widget_attrs(self, widget):\n attrs = super(IntegerField, self).widget_attrs(widget)\n if isinstance(widget, NumberInput):\n if self.min_value is not None:\n attrs['min'] = self.min_value\n if self.max_value is not None:\n attrs['max'] = self.max_value\n return attrs", "metadata": "root.IntegerField.widget_attrs", "header": "['class', 'IntegerField', '(', 'Field', ')', ':', '___EOS___']", "index": 282 }, { "content": "class FloatField(IntegerField):\n default_error_messages = {\n 'invalid': _('Enter a number.'),\n }\n\n\n", "metadata": "root.FloatField", "header": "['module', '___EOS___']", "index": 292 }, { "content": " def to_python(self, value):\n \"\"\"\n Validates that float() can be called on the input. Returns the result\n of float(). Returns None for empty values.\n \"\"\"\n value = super(IntegerField, self).to_python(value)\n if value in self.empty_values:\n return None\n if self.localize:\n value = formats.sanitize_separators(value)\n try:\n value = float(value)\n except (ValueError, TypeError):\n raise ValidationError(self.error_messages['invalid'], code='invalid')\n return value", "metadata": "root.FloatField.to_python", "header": "['class', 'FloatField', '(', 'IntegerField', ')', ':', '___EOS___']", "index": 297 }, { "content": " def validate(self, value):\n super(FloatField, self).validate(value)\n\n # Check for NaN (which is the only thing not equal to itself) and +/- infinity\n if value != value or value in (Decimal('Inf'), Decimal('-Inf')):\n raise ValidationError(self.error_messages['invalid'], code='invalid')\n\n return value", "metadata": "root.FloatField.validate", "header": "['class', 'FloatField', '(', 'IntegerField', ')', ':', '___EOS___']", "index": 313 }, { "content": " def widget_attrs(self, widget):\n attrs = super(FloatField, self).widget_attrs(widget)\n if isinstance(widget, NumberInput) and 'step' not in widget.attrs:\n attrs.setdefault('step', 'any')\n return attrs", "metadata": "root.FloatField.widget_attrs", "header": "['class', 'FloatField', '(', 'IntegerField', ')', ':', '___EOS___']", "index": 322 }, { "content": "class DecimalField(IntegerField):\n default_error_messages = {\n 'invalid': _('Enter a number.'),\n }\n\n\n\n", "metadata": "root.DecimalField", "header": "['module', '___EOS___']", "index": 329 }, { "content": " def __init__(self, max_value=None, min_value=None, max_digits=None, decimal_places=None, *args, **kwargs):\n self.max_digits, self.decimal_places = max_digits, decimal_places\n super(DecimalField, self).__init__(max_value, min_value, *args, **kwargs)\n self.validators.append(validators.DecimalValidator(max_digits, decimal_places))", "metadata": "root.DecimalField.__init__", "header": "['class', 'DecimalField', '(', 'IntegerField', ')', ':', '___EOS___']", "index": 334 }, { "content": " def to_python(self, value):\n \"\"\"\n Validates that the input is a decimal number. Returns a Decimal\n instance. Returns None for empty values. Ensures that there are no more\n than max_digits in the number, and no more than decimal_places digits\n after the decimal point.\n \"\"\"\n if value in self.empty_values:\n return None\n if self.localize:\n value = formats.sanitize_separators(value)\n value = smart_text(value).strip()\n try:\n value = Decimal(value)\n except DecimalException:\n raise ValidationError(self.error_messages['invalid'], code='invalid')\n return value", "metadata": "root.DecimalField.to_python", "header": "['class', 'DecimalField', '(', 'IntegerField', ')', ':', '___EOS___']", "index": 339 }, { "content": " def validate(self, value):\n super(DecimalField, self).validate(value)\n if value in self.empty_values:\n return\n # Check for NaN, Inf and -Inf values. We can't compare directly for NaN,\n # since it is never equal to itself. However, NaN is the only value that\n # isn't equal to itself, so we can use this to identify NaN\n if value != value or value == Decimal(\"Inf\") or value == Decimal(\"-Inf\"):\n raise ValidationError(self.error_messages['invalid'], code='invalid')", "metadata": "root.DecimalField.validate", "header": "['class', 'DecimalField', '(', 'IntegerField', ')', ':', '___EOS___']", "index": 357 }, { "content": " def widget_attrs(self, widget):\n attrs = super(DecimalField, self).widget_attrs(widget)\n if isinstance(widget, NumberInput) and 'step' not in widget.attrs:\n if self.decimal_places is not None:\n # Use exponential notation for small values since they might\n # be parsed as 0 otherwise. ref #20765\n step = str(Decimal('1') / 10 ** self.decimal_places).lower()\n else:\n step = 'any'\n attrs.setdefault('step', step)\n return attrs", "metadata": "root.DecimalField.widget_attrs", "header": "['class', 'DecimalField', '(', 'IntegerField', ')', ':', '___EOS___']", "index": 367 }, { "content": "class BaseTemporalField(Field):\n\n\n", "metadata": "root.BaseTemporalField", "header": "['module', '___EOS___']", "index": 380 }, { "content": " def __init__(self, input_formats=None, *args, **kwargs):\n super(BaseTemporalField, self).__init__(*args, **kwargs)\n if input_formats is not None:\n self.input_formats = input_formats", "metadata": "root.BaseTemporalField.__init__", "header": "['class', 'BaseTemporalField', '(', 'Field', ')', ':', '___EOS___']", "index": 382 }, { "content": " def to_python(self, value):\n # Try to coerce the value to unicode.\n unicode_value = force_text(value, strings_only=True)\n if isinstance(unicode_value, six.text_type):\n value = unicode_value.strip()\n # If unicode, try to strptime against each input format.\n if isinstance(value, six.text_type):\n for format in self.input_formats:\n try:\n return self.strptime(value, format)\n except (ValueError, TypeError):\n continue\n raise ValidationError(self.error_messages['invalid'], code='invalid')", "metadata": "root.BaseTemporalField.to_python", "header": "['class', 'BaseTemporalField', '(', 'Field', ')', ':', '___EOS___']", "index": 387 }, { "content": " def strptime(self, value, format):\n raise NotImplementedError('Subclasses must define this method.')", "metadata": "root.BaseTemporalField.strptime", "header": "['class', 'BaseTemporalField', '(', 'Field', ')', ':', '___EOS___']", "index": 401 }, { "content": "class DateField(BaseTemporalField):\n widget = DateInput\n input_formats = formats.get_format_lazy('DATE_INPUT_FORMATS')\n default_error_messages = {\n 'invalid': _('Enter a valid date.'),\n }\n\n", "metadata": "root.DateField", "header": "['module', '___EOS___']", "index": 405 }, { "content": " def to_python(self, value):\n \"\"\"\n Validates that the input can be converted to a date. Returns a Python\n datetime.date object.\n \"\"\"\n if value in self.empty_values:\n return None\n if isinstance(value, datetime.datetime):\n return value.date()\n if isinstance(value, datetime.date):\n return value\n return super(DateField, self).to_python(value)", "metadata": "root.DateField.to_python", "header": "['class', 'DateField', '(', 'BaseTemporalField', ')', ':', '___EOS___']", "index": 412 }, { "content": " def strptime(self, value, format):\n return datetime.datetime.strptime(force_str(value), format).date()", "metadata": "root.DateField.strptime", "header": "['class', 'DateField', '(', 'BaseTemporalField', ')', ':', '___EOS___']", "index": 425 }, { "content": "class TimeField(BaseTemporalField):\n widget = TimeInput\n input_formats = formats.get_format_lazy('TIME_INPUT_FORMATS')\n default_error_messages = {\n 'invalid': _('Enter a valid time.')\n }\n\n", "metadata": "root.TimeField", "header": "['module', '___EOS___']", "index": 429 }, { "content": " def to_python(self, value):\n \"\"\"\n Validates that the input can be converted to a time. Returns a Python\n datetime.time object.\n \"\"\"\n if value in self.empty_values:\n return None\n if isinstance(value, datetime.time):\n return value\n return super(TimeField, self).to_python(value)", "metadata": "root.TimeField.to_python", "header": "['class', 'TimeField', '(', 'BaseTemporalField', ')', ':', '___EOS___']", "index": 436 }, { "content": " def strptime(self, value, format):\n return datetime.datetime.strptime(force_str(value), format).time()", "metadata": "root.TimeField.strptime", "header": "['class', 'TimeField', '(', 'BaseTemporalField', ')', ':', '___EOS___']", "index": 447 }, { "content": "class DateTimeField(BaseTemporalField):\n widget = DateTimeInput\n input_formats = formats.get_format_lazy('DATETIME_INPUT_FORMATS')\n default_error_messages = {\n 'invalid': _('Enter a valid date/time.'),\n }\n\n\n", "metadata": "root.DateTimeField", "header": "['module', '___EOS___']", "index": 451 }, { "content": " def prepare_value(self, value):\n if isinstance(value, datetime.datetime):\n value = to_current_timezone(value)\n return value", "metadata": "root.DateTimeField.prepare_value", "header": "['class', 'DateTimeField', '(', 'BaseTemporalField', ')', ':', '___EOS___']", "index": 458 }, { "content": " def to_python(self, value):\n \"\"\"\n Validates that the input can be converted to a datetime. Returns a\n Python datetime.datetime object.\n \"\"\"\n if value in self.empty_values:\n return None\n if isinstance(value, datetime.datetime):\n return from_current_timezone(value)\n if isinstance(value, datetime.date):\n result = datetime.datetime(value.year, value.month, value.day)\n return from_current_timezone(result)\n result = super(DateTimeField, self).to_python(value)\n return from_current_timezone(result)", "metadata": "root.DateTimeField.to_python", "header": "['class', 'DateTimeField', '(', 'BaseTemporalField', ')', ':', '___EOS___']", "index": 463 }, { "content": " def strptime(self, value, format):\n return datetime.datetime.strptime(force_str(value), format)", "metadata": "root.DateTimeField.strptime", "header": "['class', 'DateTimeField', '(', 'BaseTemporalField', ')', ':', '___EOS___']", "index": 478 }, { "content": "class DurationField(Field):\n default_error_messages = {\n 'invalid': _('Enter a valid duration.'),\n }\n\n", "metadata": "root.DurationField", "header": "['module', '___EOS___']", "index": 482 }, { "content": " def prepare_value(self, value):\n if isinstance(value, datetime.timedelta):\n return duration_string(value)\n return value", "metadata": "root.DurationField.prepare_value", "header": "['class', 'DurationField', '(', 'Field', ')', ':', '___EOS___']", "index": 487 }, { "content": " def to_python(self, value):\n if value in self.empty_values:\n return None\n if isinstance(value, datetime.timedelta):\n return value\n value = parse_duration(force_text(value))\n if value is None:\n raise ValidationError(self.error_messages['invalid'], code='invalid')\n return value", "metadata": "root.DurationField.to_python", "header": "['class', 'DurationField', '(', 'Field', ')', ':', '___EOS___']", "index": 492 }, { "content": "class RegexField(CharField):\n\n\n\n regex = property(_get_regex, _set_regex)", "metadata": "root.RegexField", "header": "['module', '___EOS___']", "index": 503 }, { "content": " def __init__(self, regex, max_length=None, min_length=None, error_message=None, *args, **kwargs):\n \"\"\"\n regex can be either a string or a compiled regular expression object.\n error_message is an optional error message to use, if\n 'Enter a valid value' is too generic for you.\n \"\"\"\n kwargs.setdefault('strip', False)\n super(RegexField, self).__init__(max_length, min_length, *args, **kwargs)\n self._set_regex(regex)", "metadata": "root.RegexField.__init__", "header": "['class', 'RegexField', '(', 'CharField', ')', ':', '___EOS___']", "index": 504 }, { "content": " def _get_regex(self):\n return self._regex", "metadata": "root.RegexField._get_regex", "header": "['class', 'RegexField', '(', 'CharField', ')', ':', '___EOS___']", "index": 514 }, { "content": " def _set_regex(self, regex):\n if isinstance(regex, six.string_types):\n regex = re.compile(regex, re.UNICODE)\n self._regex = regex\n if hasattr(self, '_regex_validator') and self._regex_validator in self.validators:\n self.validators.remove(self._regex_validator)\n self._regex_validator = validators.RegexValidator(regex=regex)\n self.validators.append(self._regex_validator)", "metadata": "root.RegexField._set_regex", "header": "['class', 'RegexField', '(', 'CharField', ')', ':', '___EOS___']", "index": 517 }, { "content": "class EmailField(CharField):\n widget = EmailInput\n default_validators = [validators.validate_email]\n", "metadata": "root.EmailField", "header": "['module', '___EOS___']", "index": 529 }, { "content": " def clean(self, value):\n value = self.to_python(value).strip()\n return super(EmailField, self).clean(value)", "metadata": "root.EmailField.clean", "header": "['class', 'EmailField', '(', 'CharField', ')', ':', '___EOS___']", "index": 533 }, { "content": "class FileField(Field):\n widget = ClearableFileInput\n default_error_messages = {\n 'invalid': _(\"No file was submitted. Check the encoding type on the form.\"),\n 'missing': _(\"No file was submitted.\"),\n 'empty': _(\"The submitted file is empty.\"),\n 'max_length': ungettext_lazy(\n 'Ensure this filename has at most %(max)d character (it has %(length)d).',\n 'Ensure this filename has at most %(max)d characters (it has %(length)d).',\n 'max'),\n 'contradiction': _('Please either submit a file or check the clear checkbox, not both.')\n }\n\n\n\n\n", "metadata": "root.FileField", "header": "['module', '___EOS___']", "index": 538 }, { "content": " def __init__(self, *args, **kwargs):\n self.max_length = kwargs.pop('max_length', None)\n self.allow_empty_file = kwargs.pop('allow_empty_file', False)\n super(FileField, self).__init__(*args, **kwargs)", "metadata": "root.FileField.__init__", "header": "['class', 'FileField', '(', 'Field', ')', ':', '___EOS___']", "index": 551 }, { "content": " def to_python(self, data):\n if data in self.empty_values:\n return None\n\n # UploadedFile objects should have name and size attributes.\n try:\n file_name = data.name\n file_size = data.size\n except AttributeError:\n raise ValidationError(self.error_messages['invalid'], code='invalid')\n\n if self.max_length is not None and len(file_name) > self.max_length:\n params = {'max': self.max_length, 'length': len(file_name)}\n raise ValidationError(self.error_messages['max_length'], code='max_length', params=params)\n if not file_name:\n raise ValidationError(self.error_messages['invalid'], code='invalid')\n if not self.allow_empty_file and not file_size:\n raise ValidationError(self.error_messages['empty'], code='empty')\n\n return data", "metadata": "root.FileField.to_python", "header": "['class', 'FileField', '(', 'Field', ')', ':', '___EOS___']", "index": 556 }, { "content": " def clean(self, data, initial=None):\n # If the widget got contradictory inputs, we raise a validation error\n if data is FILE_INPUT_CONTRADICTION:\n raise ValidationError(self.error_messages['contradiction'], code='contradiction')\n # False means the field value should be cleared; further validation is\n # not needed.\n if data is False:\n if not self.required:\n return False\n # If the field is required, clearing is not possible (the widget\n # shouldn't return False data in that case anyway). False is not\n # in self.empty_value; if a False value makes it this far\n # it should be validated from here on out as None (so it will be\n # caught by the required check).\n data = None\n if not data and initial:\n return initial\n return super(FileField, self).clean(data)", "metadata": "root.FileField.clean", "header": "['class', 'FileField', '(', 'Field', ')', ':', '___EOS___']", "index": 577 }, { "content": " def bound_data(self, data, initial):\n if data in (None, FILE_INPUT_CONTRADICTION):\n return initial\n return data", "metadata": "root.FileField.bound_data", "header": "['class', 'FileField', '(', 'Field', ')', ':', '___EOS___']", "index": 596 }, { "content": " def has_changed(self, initial, data):\n if data is None:\n return False\n return True", "metadata": "root.FileField.has_changed", "header": "['class', 'FileField', '(', 'Field', ')', ':', '___EOS___']", "index": 601 }, { "content": "class ImageField(FileField):\n default_error_messages = {\n 'invalid_image': _(\n \"Upload a valid image. The file you uploaded was either not an \"\n \"image or a corrupted image.\"\n ),\n }\n", "metadata": "root.ImageField", "header": "['module', '___EOS___']", "index": 607 }, { "content": " def to_python(self, data):\n \"\"\"\n Checks that the file-upload field data contains a valid image (GIF, JPG,\n PNG, possibly others -- whatever the Python Imaging Library supports).\n \"\"\"\n f = super(ImageField, self).to_python(data)\n if f is None:\n return None\n\n from PIL import Image\n\n # We need to get a file object for Pillow. We might have a path or we might\n # have to read the data into memory.\n if hasattr(data, 'temporary_file_path'):\n file = data.temporary_file_path()\n else:\n if hasattr(data, 'read'):\n file = BytesIO(data.read())\n else:\n file = BytesIO(data['content'])\n\n try:\n # load() could spot a truncated JPEG, but it loads the entire\n # image in memory, which is a DoS vector. See #3848 and #18520.\n image = Image.open(file)\n # verify() must be called immediately after the constructor.\n image.verify()\n\n # Annotating so subclasses can reuse it for their own validation\n f.image = image\n # Pillow doesn't detect the MIME type of all formats. In those\n # cases, content_type will be None.\n f.content_type = Image.MIME.get(image.format)\n except Exception:\n # Pillow doesn't recognize it as an image.\n six.reraise(ValidationError, ValidationError(\n self.error_messages['invalid_image'],\n code='invalid_image',\n ), sys.exc_info()[2])\n if hasattr(f, 'seek') and callable(f.seek):\n f.seek(0)\n return f", "metadata": "root.ImageField.to_python", "header": "['class', 'ImageField', '(', 'FileField', ')', ':', '___EOS___']", "index": 615 }, { "content": "class URLField(CharField):\n widget = URLInput\n default_error_messages = {\n 'invalid': _('Enter a valid URL.'),\n }\n default_validators = [validators.URLValidator()]\n\n", "metadata": "root.URLField", "header": "['module', '___EOS___']", "index": 659 }, { "content": " def to_python(self, value):\n\n def split_url(url):\n \"\"\"\n Returns a list of url parts via ``urlparse.urlsplit`` (or raises a\n ``ValidationError`` exception for certain).\n \"\"\"\n try:\n return list(urlsplit(url))\n except ValueError:\n # urlparse.urlsplit can raise a ValueError with some\n # misformatted URLs.\n raise ValidationError(self.error_messages['invalid'], code='invalid')\n\n value = super(URLField, self).to_python(value)\n if value:\n url_fields = split_url(value)\n if not url_fields[0]:\n # If no URL scheme given, assume http://\n url_fields[0] = 'http'\n if not url_fields[1]:\n # Assume that if no domain is provided, that the path segment\n # contains the domain.\n url_fields[1] = url_fields[2]\n url_fields[2] = ''\n # Rebuild the url_fields list, since the domain segment may now\n # contain the path too.\n url_fields = split_url(urlunsplit(url_fields))\n value = urlunsplit(url_fields)\n return value", "metadata": "root.URLField.to_python", "header": "['class', 'URLField', '(', 'CharField', ')', ':', '___EOS___']", "index": 666 }, { "content": " def clean(self, value):\n value = self.to_python(value).strip()\n return super(URLField, self).clean(value)", "metadata": "root.URLField.clean", "header": "['class', 'URLField', '(', 'CharField', ')', ':', '___EOS___']", "index": 697 }, { "content": "class BooleanField(Field):\n widget = CheckboxInput\n\n\n", "metadata": "root.BooleanField", "header": "['module', '___EOS___']", "index": 702 }, { "content": " def to_python(self, value):\n \"\"\"Returns a Python boolean object.\"\"\"\n # Explicitly check for the string 'False', which is what a hidden field\n # will submit for False. Also check for '0', since this is what\n # RadioSelect will provide. Because bool(\"True\") == bool('1') == True,\n # we don't need to handle that explicitly.\n if isinstance(value, six.string_types) and value.lower() in ('false', '0'):\n value = False\n else:\n value = bool(value)\n return super(BooleanField, self).to_python(value)", "metadata": "root.BooleanField.to_python", "header": "['class', 'BooleanField', '(', 'Field', ')', ':', '___EOS___']", "index": 705 }, { "content": " def validate(self, value):\n if not value and self.required:\n raise ValidationError(self.error_messages['required'], code='required')", "metadata": "root.BooleanField.validate", "header": "['class', 'BooleanField', '(', 'Field', ')', ':', '___EOS___']", "index": 717 }, { "content": " def has_changed(self, initial, data):\n # Sometimes data or initial may be a string equivalent of a boolean\n # so we should run it through to_python first to get a boolean value\n return self.to_python(initial) != self.to_python(data)", "metadata": "root.BooleanField.has_changed", "header": "['class', 'BooleanField', '(', 'Field', ')', ':', '___EOS___']", "index": 721 }, { "content": "class NullBooleanField(BooleanField):\n \"\"\"\n A field whose valid values are None, True and False. Invalid values are\n cleaned to None.\n \"\"\"\n widget = NullBooleanSelect\n\n", "metadata": "root.NullBooleanField", "header": "['module', '___EOS___']", "index": 727 }, { "content": " def to_python(self, value):\n \"\"\"\n Explicitly checks for the string 'True' and 'False', which is what a\n hidden field will submit for True and False, for 'true' and 'false',\n which are likely to be returned by JavaScript serializations of forms,\n and for '1' and '0', which is what a RadioField will submit. Unlike\n the Booleanfield we need to explicitly check for True, because we are\n not using the bool() function\n \"\"\"\n if value in (True, 'True', 'true', '1'):\n return True\n elif value in (False, 'False', 'false', '0'):\n return False\n else:\n return None", "metadata": "root.NullBooleanField.to_python", "header": "['class', 'NullBooleanField', '(', 'BooleanField', ')', ':', '___EOS___']", "index": 734 }, { "content": " def validate(self, value):\n pass", "metadata": "root.NullBooleanField.validate", "header": "['class', 'NullBooleanField', '(', 'BooleanField', ')', ':', '___EOS___']", "index": 750 }, { "content": "class CallableChoiceIterator(object):\n", "metadata": "root.CallableChoiceIterator", "header": "['module', '___EOS___']", "index": 754 }, { "content": " def __init__(self, choices_func):\n self.choices_func = choices_func", "metadata": "root.CallableChoiceIterator.__init__", "header": "['class', 'CallableChoiceIterator', '(', 'object', ')', ':', '___EOS___']", "index": 755 }, { "content": " def __iter__(self):\n for e in self.choices_func():\n yield e", "metadata": "root.CallableChoiceIterator.__iter__", "header": "['class', 'CallableChoiceIterator', '(', 'object', ')', ':', '___EOS___']", "index": 758 }, { "content": "class ChoiceField(Field):\n widget = Select\n default_error_messages = {\n 'invalid_choice': _('Select a valid choice. %(value)s is not one of the available choices.'),\n }\n\n\n\n\n\n choices = property(_get_choices, _set_choices)\n\n\n", "metadata": "root.ChoiceField", "header": "['module', '___EOS___']", "index": 763 }, { "content": " def __init__(self, choices=(), required=True, widget=None, label=None,\n initial=None, help_text='', *args, **kwargs):\n super(ChoiceField, self).__init__(\n required=required, widget=widget, label=label, initial=initial,\n help_text=help_text, *args, **kwargs\n )\n self.choices = choices", "metadata": "root.ChoiceField.__init__", "header": "['class', 'ChoiceField', '(', 'Field', ')', ':', '___EOS___']", "index": 769 }, { "content": " def __deepcopy__(self, memo):\n result = super(ChoiceField, self).__deepcopy__(memo)\n result._choices = copy.deepcopy(self._choices, memo)\n return result", "metadata": "root.ChoiceField.__deepcopy__", "header": "['class', 'ChoiceField', '(', 'Field', ')', ':', '___EOS___']", "index": 777 }, { "content": " def _get_choices(self):\n return self._choices", "metadata": "root.ChoiceField._get_choices", "header": "['class', 'ChoiceField', '(', 'Field', ')', ':', '___EOS___']", "index": 782 }, { "content": " def _set_choices(self, value):\n # Setting choices also sets the choices on the widget.\n # choices can be any iterable, but we call list() on it because\n # it will be consumed more than once.\n if callable(value):\n value = CallableChoiceIterator(value)\n else:\n value = list(value)\n\n self._choices = self.widget.choices = value", "metadata": "root.ChoiceField._set_choices", "header": "['class', 'ChoiceField', '(', 'Field', ')', ':', '___EOS___']", "index": 785 }, { "content": " def to_python(self, value):\n \"Returns a Unicode object.\"\n if value in self.empty_values:\n return ''\n return smart_text(value)", "metadata": "root.ChoiceField.to_python", "header": "['class', 'ChoiceField', '(', 'Field', ')', ':', '___EOS___']", "index": 798 }, { "content": " def validate(self, value):\n \"\"\"\n Validates that the input is in self.choices.\n \"\"\"\n super(ChoiceField, self).validate(value)\n if value and not self.valid_value(value):\n raise ValidationError(\n self.error_messages['invalid_choice'],\n code='invalid_choice',\n params={'value': value},\n )", "metadata": "root.ChoiceField.validate", "header": "['class', 'ChoiceField', '(', 'Field', ')', ':', '___EOS___']", "index": 804 }, { "content": " def valid_value(self, value):\n \"Check to see if the provided value is a valid choice\"\n text_value = force_text(value)\n for k, v in self.choices:\n if isinstance(v, (list, tuple)):\n # This is an optgroup, so look inside the group for options\n for k2, v2 in v:\n if value == k2 or text_value == force_text(k2):\n return True\n else:\n if value == k or text_value == force_text(k):\n return True\n return False", "metadata": "root.ChoiceField.valid_value", "header": "['class', 'ChoiceField', '(', 'Field', ')', ':', '___EOS___']", "index": 816 }, { "content": "class TypedChoiceField(ChoiceField):\n\n", "metadata": "root.TypedChoiceField", "header": "['module', '___EOS___']", "index": 831 }, { "content": " def __init__(self, *args, **kwargs):\n self.coerce = kwargs.pop('coerce', lambda val: val)\n self.empty_value = kwargs.pop('empty_value', '')\n super(TypedChoiceField, self).__init__(*args, **kwargs)", "metadata": "root.TypedChoiceField.__init__", "header": "['class', 'TypedChoiceField', '(', 'ChoiceField', ')', ':', '___EOS___']", "index": 832 }, { "content": " def _coerce(self, value):\n \"\"\"\n Validate that the value can be coerced to the right type (if not empty).\n \"\"\"\n if value == self.empty_value or value in self.empty_values:\n return self.empty_value\n try:\n value = self.coerce(value)\n except (ValueError, TypeError, ValidationError):\n raise ValidationError(\n self.error_messages['invalid_choice'],\n code='invalid_choice',\n params={'value': value},\n )\n return value", "metadata": "root.TypedChoiceField._coerce", "header": "['class', 'TypedChoiceField', '(', 'ChoiceField', ')', ':', '___EOS___']", "index": 837 }, { "content": " def clean(self, value):\n value = super(TypedChoiceField, self).clean(value)\n return self._coerce(value)", "metadata": "root.TypedChoiceField.clean", "header": "['class', 'TypedChoiceField', '(', 'ChoiceField', ')', ':', '___EOS___']", "index": 853 }, { "content": "class MultipleChoiceField(ChoiceField):\n hidden_widget = MultipleHiddenInput\n widget = SelectMultiple\n default_error_messages = {\n 'invalid_choice': _('Select a valid choice. %(value)s is not one of the available choices.'),\n 'invalid_list': _('Enter a list of values.'),\n }\n\n\n", "metadata": "root.MultipleChoiceField", "header": "['module', '___EOS___']", "index": 858 }, { "content": " def to_python(self, value):\n if not value:\n return []\n elif not isinstance(value, (list, tuple)):\n raise ValidationError(self.error_messages['invalid_list'], code='invalid_list')\n return [smart_text(val) for val in value]", "metadata": "root.MultipleChoiceField.to_python", "header": "['class', 'MultipleChoiceField', '(', 'ChoiceField', ')', ':', '___EOS___']", "index": 866 }, { "content": " def validate(self, value):\n \"\"\"\n Validates that the input is a list or tuple.\n \"\"\"\n if self.required and not value:\n raise ValidationError(self.error_messages['required'], code='required')\n # Validate that each value in the value list is in self.choices.\n for val in value:\n if not self.valid_value(val):\n raise ValidationError(\n self.error_messages['invalid_choice'],\n code='invalid_choice',\n params={'value': val},\n )", "metadata": "root.MultipleChoiceField.validate", "header": "['class', 'MultipleChoiceField', '(', 'ChoiceField', ')', ':', '___EOS___']", "index": 873 }, { "content": " def has_changed(self, initial, data):\n if initial is None:\n initial = []\n if data is None:\n data = []\n if len(initial) != len(data):\n return True\n initial_set = set(force_text(value) for value in initial)\n data_set = set(force_text(value) for value in data)\n return data_set != initial_set", "metadata": "root.MultipleChoiceField.has_changed", "header": "['class', 'MultipleChoiceField', '(', 'ChoiceField', ')', ':', '___EOS___']", "index": 888 }, { "content": "class TypedMultipleChoiceField(MultipleChoiceField):\n\n\n", "metadata": "root.TypedMultipleChoiceField", "header": "['module', '___EOS___']", "index": 900 }, { "content": " def __init__(self, *args, **kwargs):\n self.coerce = kwargs.pop('coerce', lambda val: val)\n self.empty_value = kwargs.pop('empty_value', [])\n super(TypedMultipleChoiceField, self).__init__(*args, **kwargs)", "metadata": "root.TypedMultipleChoiceField.__init__", "header": "['class', 'TypedMultipleChoiceField', '(', 'MultipleChoiceField', ')', ':', '___EOS___']", "index": 901 }, { "content": " def _coerce(self, value):\n \"\"\"\n Validates that the values are in self.choices and can be coerced to the\n right type.\n \"\"\"\n if value == self.empty_value or value in self.empty_values:\n return self.empty_value\n new_value = []\n for choice in value:\n try:\n new_value.append(self.coerce(choice))\n except (ValueError, TypeError, ValidationError):\n raise ValidationError(\n self.error_messages['invalid_choice'],\n code='invalid_choice',\n params={'value': choice},\n )\n return new_value", "metadata": "root.TypedMultipleChoiceField._coerce", "header": "['class', 'TypedMultipleChoiceField', '(', 'MultipleChoiceField', ')', ':', '___EOS___']", "index": 906 }, { "content": " def clean(self, value):\n value = super(TypedMultipleChoiceField, self).clean(value)\n return self._coerce(value)", "metadata": "root.TypedMultipleChoiceField.clean", "header": "['class', 'TypedMultipleChoiceField', '(', 'MultipleChoiceField', ')', ':', '___EOS___']", "index": 925 }, { "content": " def validate(self, value):\n if value != self.empty_value:\n super(TypedMultipleChoiceField, self).validate(value)\n elif self.required:\n raise ValidationError(self.error_messages['required'], code='required')", "metadata": "root.TypedMultipleChoiceField.validate", "header": "['class', 'TypedMultipleChoiceField', '(', 'MultipleChoiceField', ')', ':', '___EOS___']", "index": 929 }, { "content": "class ComboField(Field):\n \"\"\"\n A Field whose clean() method calls multiple Field clean() methods.\n \"\"\"\n", "metadata": "root.ComboField", "header": "['module', '___EOS___']", "index": 936 }, { "content": " def __init__(self, fields=(), *args, **kwargs):\n super(ComboField, self).__init__(*args, **kwargs)\n # Set 'required' to False on the individual fields, because the\n # required validation will be handled by ComboField, not by those\n # individual fields.\n for f in fields:\n f.required = False\n self.fields = fields", "metadata": "root.ComboField.__init__", "header": "['class', 'ComboField', '(', 'Field', ')', ':', '___EOS___']", "index": 940 }, { "content": " def clean(self, value):\n \"\"\"\n Validates the given value against all of self.fields, which is a\n list of Field instances.\n \"\"\"\n super(ComboField, self).clean(value)\n for field in self.fields:\n value = field.clean(value)\n return value", "metadata": "root.ComboField.clean", "header": "['class', 'ComboField', '(', 'Field', ')', ':', '___EOS___']", "index": 949 }, { "content": "class MultiValueField(Field):\n \"\"\"\n A Field that aggregates the logic of multiple Fields.\n\n Its clean() method takes a \"decompressed\" list of values, which are then\n cleaned into a single value according to self.fields. Each value in\n this list is cleaned by the corresponding field -- the first value is\n cleaned by the first field, the second value is cleaned by the second\n field, etc. Once all fields are cleaned, the list of clean values is\n \"compressed\" into a single value.\n\n Subclasses should not have to implement clean(). Instead, they must\n implement compress(), which takes a list of valid values and returns a\n \"compressed\" version of those values -- a single value.\n\n You'll probably want to use this with MultiWidget.\n \"\"\"\n default_error_messages = {\n 'invalid': _('Enter a list of values.'),\n 'incomplete': _('Enter a complete value.'),\n }\n\n\n\n\n\n", "metadata": "root.MultiValueField", "header": "['module', '___EOS___']", "index": 960 }, { "content": " def __init__(self, fields=(), *args, **kwargs):\n self.require_all_fields = kwargs.pop('require_all_fields', True)\n super(MultiValueField, self).__init__(*args, **kwargs)\n for f in fields:\n f.error_messages.setdefault('incomplete',\n self.error_messages['incomplete'])\n if self.require_all_fields:\n # Set 'required' to False on the individual fields, because the\n # required validation will be handled by MultiValueField, not\n # by those individual fields.\n f.required = False\n self.fields = fields", "metadata": "root.MultiValueField.__init__", "header": "['class', 'MultiValueField', '(', 'Field', ')', ':', '___EOS___']", "index": 982 }, { "content": " def __deepcopy__(self, memo):\n result = super(MultiValueField, self).__deepcopy__(memo)\n result.fields = tuple(x.__deepcopy__(memo) for x in self.fields)\n return result", "metadata": "root.MultiValueField.__deepcopy__", "header": "['class', 'MultiValueField', '(', 'Field', ')', ':', '___EOS___']", "index": 995 }, { "content": " def validate(self, value):\n pass", "metadata": "root.MultiValueField.validate", "header": "['class', 'MultiValueField', '(', 'Field', ')', ':', '___EOS___']", "index": 1000 }, { "content": " def clean(self, value):\n \"\"\"\n Validates every value in the given list. A value is validated against\n the corresponding Field in self.fields.\n\n For example, if this MultiValueField was instantiated with\n fields=(DateField(), TimeField()), clean() would call\n DateField.clean(value[0]) and TimeField.clean(value[1]).\n \"\"\"\n clean_data = []\n errors = []\n if not value or isinstance(value, (list, tuple)):\n if not value or not [v for v in value if v not in self.empty_values]:\n if self.required:\n raise ValidationError(self.error_messages['required'], code='required')\n else:\n return self.compress([])\n else:\n raise ValidationError(self.error_messages['invalid'], code='invalid')\n for i, field in enumerate(self.fields):\n try:\n field_value = value[i]\n except IndexError:\n field_value = None\n if field_value in self.empty_values:\n if self.require_all_fields:\n # Raise a 'required' error if the MultiValueField is\n # required and any field is empty.\n if self.required:\n raise ValidationError(self.error_messages['required'], code='required')\n elif field.required:\n # Otherwise, add an 'incomplete' error to the list of\n # collected errors and skip field cleaning, if a required\n # field is empty.\n if field.error_messages['incomplete'] not in errors:\n errors.append(field.error_messages['incomplete'])\n continue\n try:\n clean_data.append(field.clean(field_value))\n except ValidationError as e:\n # Collect all validation errors in a single list, which we'll\n # raise at the end of clean(), rather than raising a single\n # exception for the first error we encounter. Skip duplicates.\n errors.extend(m for m in e.error_list if m not in errors)\n if errors:\n raise ValidationError(errors)\n\n out = self.compress(clean_data)\n self.validate(out)\n self.run_validators(out)\n return out", "metadata": "root.MultiValueField.clean", "header": "['class', 'MultiValueField', '(', 'Field', ')', ':', '___EOS___']", "index": 1003 }, { "content": " def compress(self, data_list):\n \"\"\"\n Returns a single value for the given list of values. The values can be\n assumed to be valid.\n\n For example, if this MultiValueField was instantiated with\n fields=(DateField(), TimeField()), this might return a datetime\n object created by combining the date and time in data_list.\n \"\"\"\n raise NotImplementedError('Subclasses must implement this method.')", "metadata": "root.MultiValueField.compress", "header": "['class', 'MultiValueField', '(', 'Field', ')', ':', '___EOS___']", "index": 1055 }, { "content": " def has_changed(self, initial, data):\n if initial is None:\n initial = ['' for x in range(0, len(data))]\n else:\n if not isinstance(initial, list):\n initial = self.widget.decompress(initial)\n for field, initial, data in zip(self.fields, initial, data):\n try:\n initial = field.to_python(initial)\n except ValidationError:\n return True\n if field.has_changed(initial, data):\n return True\n return False", "metadata": "root.MultiValueField.has_changed", "header": "['class', 'MultiValueField', '(', 'Field', ')', ':', '___EOS___']", "index": 1066 }, { "content": "class FilePathField(ChoiceField):", "metadata": "root.FilePathField", "header": "['module', '___EOS___']", "index": 1082 }, { "content": " def __init__(self, path, match=None, recursive=False, allow_files=True,\n allow_folders=False, required=True, widget=None, label=None,\n initial=None, help_text='', *args, **kwargs):\n self.path, self.match, self.recursive = path, match, recursive\n self.allow_files, self.allow_folders = allow_files, allow_folders\n super(FilePathField, self).__init__(\n choices=(), required=required, widget=widget, label=label,\n initial=initial, help_text=help_text, *args, **kwargs\n )\n\n if self.required:\n self.choices = []\n else:\n self.choices = [(\"\", \"---------\")]\n\n if self.match is not None:\n self.match_re = re.compile(self.match)\n\n if recursive:\n for root, dirs, files in sorted(os.walk(self.path)):\n if self.allow_files:\n for f in files:\n if self.match is None or self.match_re.search(f):\n f = os.path.join(root, f)\n self.choices.append((f, f.replace(path, \"\", 1)))\n if self.allow_folders:\n for f in dirs:\n if f == '__pycache__':\n continue\n if self.match is None or self.match_re.search(f):\n f = os.path.join(root, f)\n self.choices.append((f, f.replace(path, \"\", 1)))\n else:\n try:\n for f in sorted(os.listdir(self.path)):\n if f == '__pycache__':\n continue\n full_file = os.path.join(self.path, f)\n if (((self.allow_files and os.path.isfile(full_file)) or\n (self.allow_folders and os.path.isdir(full_file))) and\n (self.match is None or self.match_re.search(f))):\n self.choices.append((full_file, f))\n except OSError:\n pass\n\n self.widget.choices = self.choices", "metadata": "root.FilePathField.__init__", "header": "['class', 'FilePathField', '(', 'ChoiceField', ')', ':', '___EOS___']", "index": 1083 }, { "content": "class SplitDateTimeField(MultiValueField):\n widget = SplitDateTimeWidget\n hidden_widget = SplitHiddenDateTimeWidget\n default_error_messages = {\n 'invalid_date': _('Enter a valid date.'),\n 'invalid_time': _('Enter a valid time.'),\n }\n\n", "metadata": "root.SplitDateTimeField", "header": "['module', '___EOS___']", "index": 1131 }, { "content": " def __init__(self, input_date_formats=None, input_time_formats=None, *args, **kwargs):\n errors = self.default_error_messages.copy()\n if 'error_messages' in kwargs:\n errors.update(kwargs['error_messages'])\n localize = kwargs.get('localize', False)\n fields = (\n DateField(input_formats=input_date_formats,\n error_messages={'invalid': errors['invalid_date']},\n localize=localize),\n TimeField(input_formats=input_time_formats,\n error_messages={'invalid': errors['invalid_time']},\n localize=localize),\n )\n super(SplitDateTimeField, self).__init__(fields, *args, **kwargs)", "metadata": "root.SplitDateTimeField.__init__", "header": "['class', 'SplitDateTimeField', '(', 'MultiValueField', ')', ':', '___EOS___']", "index": 1139 }, { "content": " def compress(self, data_list):\n if data_list:\n # Raise a validation error if time or date is empty\n # (possible if SplitDateTimeField has required=False).\n if data_list[0] in self.empty_values:\n raise ValidationError(self.error_messages['invalid_date'], code='invalid_date')\n if data_list[1] in self.empty_values:\n raise ValidationError(self.error_messages['invalid_time'], code='invalid_time')\n result = datetime.datetime.combine(*data_list)\n return from_current_timezone(result)\n return None", "metadata": "root.SplitDateTimeField.compress", "header": "['class', 'SplitDateTimeField', '(', 'MultiValueField', ')', ':', '___EOS___']", "index": 1154 }, { "content": "class GenericIPAddressField(CharField):\n", "metadata": "root.GenericIPAddressField", "header": "['module', '___EOS___']", "index": 1167 }, { "content": " def __init__(self, protocol='both', unpack_ipv4=False, *args, **kwargs):\n self.unpack_ipv4 = unpack_ipv4\n self.default_validators = validators.ip_address_validators(protocol, unpack_ipv4)[0]\n super(GenericIPAddressField, self).__init__(*args, **kwargs)", "metadata": "root.GenericIPAddressField.__init__", "header": "['class', 'GenericIPAddressField', '(', 'CharField', ')', ':', '___EOS___']", "index": 1168 }, { "content": " def to_python(self, value):\n if value in self.empty_values:\n return ''\n value = value.strip()\n if value and ':' in value:\n return clean_ipv6_address(value, self.unpack_ipv4)\n return value", "metadata": "root.GenericIPAddressField.to_python", "header": "['class', 'GenericIPAddressField', '(', 'CharField', ')', ':', '___EOS___']", "index": 1173 }, { "content": "class SlugField(CharField):\n default_validators = [validators.validate_slug]\n", "metadata": "root.SlugField", "header": "['module', '___EOS___']", "index": 1182 }, { "content": " def __init__(self, *args, **kwargs):\n self.allow_unicode = kwargs.pop('allow_unicode', False)\n if self.allow_unicode:\n self.default_validators = [validators.validate_unicode_slug]\n super(SlugField, self).__init__(*args, **kwargs)", "metadata": "root.SlugField.__init__", "header": "['class', 'SlugField', '(', 'CharField', ')', ':', '___EOS___']", "index": 1185 }, { "content": "class UUIDField(CharField):\n default_error_messages = {\n 'invalid': _('Enter a valid UUID.'),\n }\n\n", "metadata": "root.UUIDField", "header": "['module', '___EOS___']", "index": 1192 }, { "content": " def prepare_value(self, value):\n if isinstance(value, uuid.UUID):\n return value.hex\n return value", "metadata": "root.UUIDField.prepare_value", "header": "['class', 'UUIDField', '(', 'CharField', ')', ':', '___EOS___']", "index": 1197 }, { "content": " def to_python(self, value):\n value = super(UUIDField, self).to_python(value)\n if value in self.empty_values:\n return None\n if not isinstance(value, uuid.UUID):\n try:\n value = uuid.UUID(value)\n except ValueError:\n raise ValidationError(self.error_messages['invalid'], code='invalid')\n return value", "metadata": "root.UUIDField.to_python", "header": "['class', 'UUIDField', '(', 'CharField', ')', ':', '___EOS___']", "index": 1202 } ]
[]
[]
0
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\"\"\"", "\\", "10", ";", "Field", " ", "classe", "s", ".", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "\\u\\u", "future\\u\\u_", "import_", "unicode", "\\u", "literals_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "copy_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "datetime_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "itertools_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "re_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "uuid_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "decimal_", "import_", "Decimal_", ",_", "Deci", "mal", "Exception_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "io_", "import_", "Byte", "s", "IO_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "django_", "._", "core_", "import_", "validators_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "core_", "._", "exceptions_", "import_", "Validat", "ion", "Error_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Prov", "ide", " ", "this", " ", "import", " ", "for", " ", "back", "ward", "s", " ", "compatibility", "._", "\\u\\u\\uNL\\u\\u\\u_", "from_", "django_", "._", "core_", "._", "validators_", "import_", "EMP", "TY", "\\u", "VALUES_", "#", " ", "NO", "QA", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "forms_", "._", "bound", "field_", "import_", "Bound", "Field_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "forms_", "._", "utils_", "import_", "from", "\\u", "current", "\\u", "timezone_", ",_", "to", "\\u", "current", "\\u", "timezone_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "forms_", "._", "widgets_", "import_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "FILE", "\\u", "INPUT", "\\u", "CONTR", "AD", "ICT", "ION_", ",_", "Checkb", "ox", "Input_", ",_", "Clear", "able", "File", "Input_", ",_", "Date", "Input_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Date", "Time", "Input_", ",_", "Ema", "il", "Input_", ",_", "Hi", "dde", "n", "Input_", ",_", "Multipl", "e", "Hi", "dde", "n", "Input_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Null", "Boo", "lean", "Select_", ",_", "Number", "Input_", ",_", "Select_", ",_", "Select", "Multiple_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Split", "Date", "Time", "Widget_", ",_", "Split", "Hi", "dde", "n", "Date", "Time", "Widget_", ",_", "Text", "Input_", ",_", "Time", "Input_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "URL", "Input_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "utils_", "import_", "formats_", ",_", "six_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "utils_", "._", "date", "parse_", "import_", "parse", "\\u", "duration_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "utils_", "._", "duration_", "import_", "duration", "\\u", "string_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "utils_", "._", "encoding_", "import_", "force", "\\u", "str_", ",_", "force", "\\u", "text_", ",_", "smart", "\\u", "text_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "utils_", "._", "ipv6_", "import_", "clean", "\\u", "ipv", "6", "\\u", "address_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "utils_", "._", "six_", "._", "moves_", "._", "urllib_", "._", "parse_", "import_", "urlsplit_", ",_", "urlu", "nsp", "lit_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "utils_", "._", "translation_", "import_", "uge", "ttext", "\\u", "lazy_", "as_", "\\u_", ",_", "unge", "ttext", "\\u", "lazy_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u", "all\\u\\u_", "=_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Field", "'_", ",_", "'", "Char", "Field", "'_", ",_", "'", "Integer", "Field", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Date", "Field", "'_", ",_", "'", "Time", "Field", "'_", ",_", "'", "Date", "Time", "Field", "'_", ",_", "'", "Dur", "ation", "Field", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Rege", "x", "Field", "'_", ",_", "'", "Ema", "il", "Field", "'_", ",_", "'", "File", "Field", "'_", ",_", "'", "Image", "Field", "'_", ",_", "'", "URL", "Field", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Boo", "lean", "Field", "'_", ",_", "'", "Null", "Boo", "lean", "Field", "'_", ",_", "'", "Choi", "ce", "Field", "'_", ",_", "'", "Multipl", "e", "Choi", "ce", "Field", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Comb", "o", "Field", "'_", ",_", "'", "Multi", "Value", "Field", "'_", ",_", "'", "Float", "Field", "'_", ",_", "'", "Deci", "mal", "Field", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Split", "Date", "Time", "Field", "'_", ",_", "'", "Gene", "ric", "IPA", "ddress", "Field", "'_", ",_", "'", "File", "Path", "Field", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Sl", "ug", "Field", "'_", ",_", "'", "Type", "d", "Choi", "ce", "Field", "'_", ",_", "'", "Type", "d", "Multipl", "e", "Choi", "ce", "Field", "'_", ",_", "'", "UU", "IDF", "iel", "d", "'_", ",_", "\\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\\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_", "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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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Field_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "widget_", "=_", "Text", "Input_", "#", " ", "Default", " ", "widget", " ", "to", " ", "use", " ", "whe", "n", " ", "render", "ing", " ", "this", " ", "type", " ", "of", " ", "Field", "._", "\\u\\u\\uNEWLINE\\u\\u\\u_", "hidden", "\\u", "widget_", "=_", "Hi", "dde", "n", "Input_", "#", " ", "Default", " ", "widget", " ", "to", " ", "use", " ", "whe", "n", " ", "render", "ing", " ", "this", " ", "as", " ", "\"", "hidden", "\".", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "default", "\\u", "validators_", "=_", "[_", "]_", "#", " ", "Default", " ", "set", " ", "of", " ", "validators_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Add", " ", "an", " ", "'", "invalid", "'", " ", "entry", " ", "to", " ", "default", "\\u", "error", "\\u", "message", " ", "if", " ", "you", " ", "want", " ", "a", " ", "specific_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "field", " ", "error", " ", "message", " ", "not", " ", "raise", "d", " ", "by", " ", "the", " ", "field", " ", "validator", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "default", "\\u", "error", "\\u", "messages_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "require", "d", "'_", ":_", "\\u_", "(_", "'", "Thi", "s", " ", "field", " ", "is", " ", "require", "d", ".'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "empty", "\\u", "values_", "=_", "list_", "(_", "validators_", "._", "EMP", "TY", "\\u", "VALUES_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Track", "s", " ", "each", " ", "time", " ", "a", " ", "Field", " ", "instance", " ", "is", " ", "created", ".", " ", "Us", "ed", " ", "to", " ", "retain", " ", "order", "._", "\\u\\u\\uNL\\u\\u\\u_", "creati", "on", "\\u", "counter_", "=_", "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\\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_", "Field_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "required_", "=_", "True_", ",_", "widget_", "=_", "None_", ",_", "label_", "=_", "None_", ",_", "initial_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help", "\\u", "text_", "=_", "''_", ",_", "error", "\\u", "messages_", "=_", "None_", ",_", "show", "\\u", "hidden", "\\u", "initial_", "=_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "validators_", "=_", "[_", "]_", ",_", "localize_", "=_", "False_", ",_", "disabled_", "=_", "False_", ",_", "label", "\\u", "suffix_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "require", "d", " ", "--", " ", "Boo", "lean", " ", "tha", "t", " ", "speci", "fie", "s", " ", "whe", "ther", " ", "the", " ", "field", " ", "is", " ", "require", "d", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "Tru", "e", " ", "by", " ", "default", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "widget", " ", "--", " ", "A", " ", "Wid", "get", " ", "class", ",", " ", "or", " ", "instance", " ", "of", " ", "a", " ", "Wid", "get", " ", "class", ",", " ", "tha", "t", " ", "should_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "be", " ", "used", " ", "for", " ", "this", " ", "Field", " ", "whe", "n", " ", "display", "ing", " ", "it", ".", " ", "Ea", "ch", " ", "Field", " ", "has", " ", "a_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "default", " ", "Wid", "get", " ", "tha", "t", " ", "it", "'", "ll", " ", "use", " ", "if", " ", "you", " ", "don", "'", "t", " ", "speci", "fy", " ", "this", ".", " ", "In_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "most", " ", "case", "s", ",", " ", "the", " ", "default", " ", "widget", " ", "is", " ", "Text", "Inp", "ut", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "label", " ", "--", " ", "A", " ", "verbo", "se", " ", "name", " ", "for", " ", "this", " ", "field", ",", " ", "for", " ", "use", " ", "in", " ", "display", "ing", " ", "this_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "field", " ", "in", " ", "a", " ", "form", ".", " ", "By", " ", "default", ",", " ", "Dj", "ang", "o", " ", "will", " ", "use", " ", "a", " ", "\"", "pretty", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "version", " ", "of", " ", "the", " ", "form", " ", "field", " ", "name", ",", " ", "if", " ", "the", " ", "Field", " ", "is", " ", "part", " ", "of", " ", "a_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "Form", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "initial", " ", "--", " ", "A", " ", "value", " ", "to", " ", "use", " ", "in", " ", "this", " ", "Field", "'", "s", " ", "initial", " ", "display", ".", " ", "Thi", "s", " ", "value_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "is", " ", "*", "not", "*", " ", "used", " ", "as", " ", "a", " ", "fall", "back", " ", "if", " ", "data", " ", "isn", "'", "t", " ", "give", "n", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "help", "\\u", "text", " ", "--", " ", "An", " ", "option", "al", " ", "string", " ", "to", " ", "use", " ", "as", " ", "\"", "help", " ", "text", "\"", " ", "for", " ", "this", " ", "Field", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "error", "\\u", "message", "s", " ", "--", " ", "An", " ", "option", "al", " ", "dictionar", "y", " ", "to", " ", "override", " ", "the", " ", "default_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "message", "s", " ", "tha", "t", " ", "the", " ", "field", " ", "will", " ", "raise", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "show", "\\u", "hidden", "\\u", "initial", " ", "--", " ", "Boo", "lean", " ", "tha", "t", " ", "speci", "fie", "s", " ", "if", " ", "it", " ", "is", " ", "need", "ed", " ", "to", " ", "render", " ", "a_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "hidden", " ", "widget", " ", "with", " ", "initial", " ", "value", " ", "after", " ", "widget", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "validator", "s", " ", "--", " ", "List", " ", "of", " ", "addition", "al", " ", "validator", "s", " ", "to", " ", "use_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "localiz", "e", " ", "--", " ", "Boo", "lean", " ", "tha", "t", " ", "speci", "fie", "s", " ", "if", " ", "the", " ", "field", " ", "shou", "ld", " ", "be", " ", "localized", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "disable", "d", " ", "--", " ", "Boo", "lean", " ", "tha", "t", " ", "speci", "fie", "s", " ", "whe", "ther", " ", "the", " ", "field", " ", "is", " ", "disable", "d", ",", " ", "that_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "is", " ", "its", " ", "widget", " ", "is", " ", "shown", " ", "in", " ", "the", " ", "form", " ", "but", " ", "not", " ", "edita", "ble", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "label", "\\u", "suff", "ix", " ", "--", " ", "Su", "ffi", "x", " ", "to", " ", "be", " ", "adde", "d", " ", "to", " ", "the", " ", "label", ".", " ", "Override", "s_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "form", "'", "s", " ", "label", "\\u", "suff", "ix", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "required_", ",_", "self_", "._", "label_", ",_", "self_", "._", "initial_", "=_", "required_", ",_", "label_", ",_", "initial_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "show", "\\u", "hidden", "\\u", "initial_", "=_", "show", "\\u", "hidden", "\\u", "initial_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "help", "\\u", "text_", "=_", "help", "\\u", "text_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "disabled_", "=_", "disabled_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "label", "\\u", "suffix_", "=_", "label", "\\u", "suffix_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "widget_", "=_", "widget_", "or_", "self_", "._", "widget_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "isinstance_", "(_", "widget_", ",_", "type_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "widget_", "=_", "widget_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Trigger", " ", "the", " ", "localization", " ", "machine", "ry", " ", "if", " ", "need", "ed", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "localize_", "=_", "localize_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "localize_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "widget_", "._", "is", "\\u", "localized", "_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Let", " ", "the", " ", "widget", " ", "know", " ", "whe", "ther", " ", "it", " ", "shou", "ld", " ", "display", " ", "as", " ", "require", "d", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "widget_", "._", "is", "\\u", "required_", "=_", "self_", "._", "required_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Hook", " ", "int", "o", " ", "self", ".", "widget", "\\u", "attr", "s", "()", " ", "for", " ", "any", " ", "Field", "-", "specific", " ", "HTM", "L", " ", "attribute", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "extra", "\\u", "attrs_", "=_", "self_", "._", "widget", "\\u", "attrs_", "(_", "widget_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "extra", "\\u", "attrs_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "widget_", "._", "attrs_", "._", "update_", "(_", "extra", "\\u", "attrs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "widget_", "=_", "widget_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Increase", " ", "the", " ", "creati", "on", " ", "counter", ",", " ", "and", " ", "save", " ", "our", " ", "local", " ", "copy", "._", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "creati", "on", "\\u", "counter_", "=_", "Field_", "._", "creati", "on", "\\u", "counter_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Field_", "._", "creati", "on", "\\u", "counter_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "messages_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "c_", "in_", "reversed_", "(_", "self_", "._", "\\u\\u", "class\\u\\u_", "._", "\\u\\u", "mro", "\\u\\u_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "messages_", "._", "update_", "(_", "getattr_", "(_", "c_", ",_", "'", "default", "\\u", "error", "\\u", "message", "s", "'_", ",_", "{_", "}_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "messages_", "._", "update_", "(_", "error", "\\u", "messages_", "or_", "{_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "error", "\\u", "messages_", "=_", "messages_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "validators_", "=_", "list_", "(_", "itertools_", "._", "chain_", "(_", "self_", "._", "default", "\\u", "validators_", ",_", "validators_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "super_", "(_", "Field_", ",_", "self_", ")_", "._", "\\u\\u", "init\\u\\u_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Field_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "prepar", "e\\u", "value_", "(_", "self_", ",_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Field_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "to", "\\u", "python_", "(_", "self_", ",_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Field_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "validate_", "(_", "self_", ",_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "value_", "in_", "self_", "._", "empty", "\\u", "values_", "and_", "self_", "._", "required_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Validat", "ion", "Error_", "(_", "self_", "._", "error", "\\u", "messages_", "[_", "'", "require", "d", "'_", "]_", ",_", "code_", "=_", "'", "require", "d", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Field_", "(_", "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_", "run", "\\u", "validators_", "(_", "self_", ",_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "value_", "in_", "self_", "._", "empty", "\\u", "values_", ":_", "\\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_", "errors_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "v_", "in_", "self_", "._", "validators_", ":_", "\\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 ", " _", "v_", "(_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Validat", "ion", "Error_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "hasattr_", "(_", "e_", ",_", "'", "code", "'_", ")_", "and_", "e_", "._", "code_", "in_", "self_", "._", "error", "\\u", "messages_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "e_", "._", "message_", "=_", "self_", "._", "error", "\\u", "messages_", "[_", "e_", "._", "code_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "errors_", "._", "extend_", "(_", "e_", "._", "error", "\\u", "list_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "errors_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Validat", "ion", "Error_", "(_", "errors_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Field_", "(_", "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_", "clean_", "(_", "self_", ",_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Validate", "s", " ", "the", " ", "give", "n", " ", "value", " ", "and", " ", "return", "s", " ", "its", " ", "\"", "clean", "ed", "\"", " ", "value", " ", "as", " ", "an", "\\", "10", ";", " ", " ", " ", " ", "appropr", "iate", " ", "Pyth", "on", " ", "object", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Rai", "ses", " ", "Validat", "ion", "Error", " ", "for", " ", "any", " ", "error", "s", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "value_", "=_", "self_", "._", "to", "\\u", "python_", "(_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "validate_", "(_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "run", "\\u", "validators_", "(_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Field_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "bound", "\\u", "data_", "(_", "self_", ",_", "data_", ",_", "initial_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Return", " ", "the", " ", "value", " ", "tha", "t", " ", "shou", "ld", " ", "be", " ", "shown", " ", "for", " ", "this", " ", "field", " ", "on", " ", "render", " ", "of", " ", "a", "\\", "10", ";", " ", " ", " ", " ", "bound", " ", "form", ",", " ", "give", "n", " ", "the", " ", "submitted", " ", "POST", " ", "data", " ", "for", " ", "the", " ", "field", " ", "and", " ", "the", " ", "initial", "\\", "10", ";", " ", " ", " ", " ", "data", ",", " ", "if", " ", "any", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "For", " ", "most", " ", "fields", ",", " ", "this", " ", "will", " ", "simp", "ly", " ", "be", " ", "data", ";", " ", "File", "Field", "s", " ", "need", " ", "to", " ", "handle", " ", "it", "\\", "10", ";", " ", " ", " ", " ", "a", " ", "bit", " ", "different", "ly", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "disabled_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "initial_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "data_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Field_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "widget", "\\u", "attrs_", "(_", "self_", ",_", "widget_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Give", "n", " ", "a", " ", "Wid", "get", " ", "instance", " ", "(*", "not", "*", " ", "a", " ", "Wid", "get", " ", "class", "),", " ", "return", "s", " ", "a", " ", "dictionar", "y", " ", "of", "\\", "10", ";", " ", " ", " ", " ", "any", " ", "HTM", "L", " ", "attribute", "s", " ", "tha", "t", " ", "shou", "ld", " ", "be", " ", "adde", "d", " ", "to", " ", "the", " ", "Wid", "get", ",", " ", "based", " ", "on", " ", "this", "\\", "10", ";", " ", " ", " ", " ", "Field", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Field_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "has", "\\u", "changed_", "(_", "self_", ",_", "initial_", ",_", "data_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Return", " ", "Tru", "e", " ", "if", " ", "data", " ", "differs", " ", "from", " ", "initial", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "data_", "=_", "self_", "._", "to", "\\u", "python_", "(_", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "hasattr_", "(_", "self_", ",_", "'\\u", "coerce", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "\\u", "coerce", "_", "(_", "data_", ")_", "!=_", "self_", "._", "\\u", "coerce", "_", "(_", "initial_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Validat", "ion", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "For", " ", "purpose", "s", " ", "of", " ", "see", "ing", " ", "whe", "ther", " ", "somet", "hing", " ", "has", " ", "change", "d", ",", " ", "Non", "e", " ", "is_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "the", " ", "same", " ", "as", " ", "an", " ", "empty", " ", "string", ",", " ", "if", " ", "the", " ", "data", " ", "or", " ", "initial", " ", "value", " ", "we", " ", "get_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "is", " ", "Non", "e", ",", " ", "replace", " ", "it", " ", "with", " ", "''", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "initial", "\\u", "value_", "=_", "initial_", "if_", "initial_", "is_", "not_", "None_", "else_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data\\u", "value_", "=_", "data_", "if_", "data_", "is_", "not_", "None_", "else_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "initial", "\\u", "value_", "!=_", "data\\u", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Field_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "bound", "\\u", "field_", "(_", "self_", ",_", "form_", ",_", "field", "\\u", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Return", " ", "a", " ", "Bound", "Field", " ", "instance", " ", "tha", "t", " ", "will", " ", "be", " ", "used", " ", "whe", "n", " ", "accessi", "ng", " ", "the", " ", "form", "\\", "10", ";", " ", " ", " ", " ", "field", " ", "in", " ", "a", " ", "template", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "Bound", "Field_", "(_", "form_", ",_", "self_", ",_", "field", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Field_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "deepc", "opy", "\\u\\u_", "(_", "self_", ",_", "memo_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "=_", "copy_", "._", "copy_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "memo_", "[_", "id_", "(_", "self_", ")_", "]_", "=_", "result_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "._", "widget_", "=_", "copy_", "._", "deepcopy_", "(_", "self_", "._", "widget_", ",_", "memo_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "._", "validators_", "=_", "self_", "._", "validators_", "[_", ":_", "]_", "\\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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Char", "Field_", "(_", "Field_", ")_", ":_", "\\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_", "Char", "Field_", "(_", "Field_", ")_", ":_", "\\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_", ",_", "max", "\\u", "length_", "=_", "None_", ",_", "min", "\\u", "length_", "=_", "None_", ",_", "strip_", "=_", "True_", ",_", "*_", "args_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "max", "\\u", "length_", "=_", "max", "\\u", "length_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "min", "\\u", "length_", "=_", "min", "\\u", "length_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "strip_", "=_", "strip_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "super_", "(_", "Char", "Field_", ",_", "self_", ")_", "._", "\\u\\u", "init\\u\\u_", "(_", "*_", "args_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "min", "\\u", "length_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "validators_", "._", "append_", "(_", "validators_", "._", "Min", "Length", "Validator_", "(_", "int_", "(_", "min", "\\u", "length_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "max", "\\u", "length_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "validators_", "._", "append_", "(_", "validators_", "._", "Max", "Length", "Validator_", "(_", "int_", "(_", "max", "\\u", "length_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Char", "Field_", "(_", "Field_", ")_", ":_", "\\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_", "to", "\\u", "python_", "(_", "self_", ",_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"", "Return", "s", " ", "a", " ", "Unic", "ode", " ", "object", ".\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "value_", "in_", "self_", "._", "empty", "\\u", "values_", ":_", "\\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_", "value_", "=_", "force", "\\u", "text_", "(_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "strip_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "value_", "=_", "value_", "._", "strip_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Char", "Field_", "(_", "Field_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "widget", "\\u", "attrs_", "(_", "self_", ",_", "widget_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "attrs_", "=_", "super_", "(_", "Char", "Field_", ",_", "self_", ")_", "._", "widget", "\\u", "attrs_", "(_", "widget_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "max", "\\u", "length_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "The", " ", "HTM", "L", " ", "attribute", " ", "is", " ", "maxlength", ",", " ", "not", " ", "max", "\\u", "length", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "attrs_", "[_", "'", "maxlength", "'_", "]_", "=_", "str_", "(_", "self_", "._", "max", "\\u", "length_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "min", "\\u", "length_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "The", " ", "HTM", "L", " ", "attribute", " ", "is", " ", "minlen", "gth", ",", " ", "not", " ", "min", "\\u", "length", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "attrs_", "[_", "'", "minlen", "gth", "'_", "]_", "=_", "str_", "(_", "self_", "._", "min", "\\u", "length_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "attrs_", "\\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_", "Integer", "Field_", "(_", "Field_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "widget_", "=_", "Number", "Input_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "default", "\\u", "error", "\\u", "messages_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "invalid", "'_", ":_", "\\u_", "(_", "'", "Enter", " ", "a", " ", "whole", " ", "number", ".'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "re", "\\u", "decimal_", "=_", "re_", "._", "compile_", "(_", "r", "'\\\\.", "0", "*\\\\", "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_", "Integer", "Field_", "(_", "Field_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "max", "\\u", "value_", "=_", "None_", ",_", "min", "\\u", "value_", "=_", "None_", ",_", "*_", "args_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "max", "\\u", "value_", ",_", "self_", "._", "min", "\\u", "value_", "=_", "max", "\\u", "value_", ",_", "min", "\\u", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "kwargs_", "._", "get_", "(_", "'", "localiz", "e", "'_", ")_", "and_", "self_", "._", "widget_", "==_", "Number", "Input_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Locali", "zed", " ", "number", " ", "input", " ", "is", " ", "not", " ", "well", " ", "support", "ed", " ", "on", " ", "most", " ", "browsers", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "kwargs_", "._", "setdefault_", "(_", "'", "widget", "'_", ",_", "super_", "(_", "Integer", "Field_", ",_", "self_", ")_", "._", "widget_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "super_", "(_", "Integer", "Field_", ",_", "self_", ")_", "._", "\\u\\u", "init\\u\\u_", "(_", "*_", "args_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "max", "\\u", "value_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "validators_", "._", "append_", "(_", "validators_", "._", "Max", "Value", "Validator_", "(_", "max", "\\u", "value_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "min", "\\u", "value_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "validators_", "._", "append_", "(_", "validators_", "._", "Min", "Value", "Validator_", "(_", "min", "\\u", "value_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Integer", "Field_", "(_", "Field_", ")_", ":_", "\\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_", "to", "\\u", "python_", "(_", "self_", ",_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Validate", "s", " ", "tha", "t", " ", "int", "()", " ", "can", " ", "be", " ", "call", "ed", " ", "on", " ", "the", " ", "input", ".", " ", "Return", "s", " ", "the", " ", "result", "\\", "10", ";", " ", " ", " ", " ", "of", " ", "int", "()", ".", " ", "Return", "s", " ", "Non", "e", " ", "for", " ", "empty", " ", "values", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "value_", "=_", "super_", "(_", "Integer", "Field_", ",_", "self_", ")_", "._", "to", "\\u", "python_", "(_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "value_", "in_", "self_", "._", "empty", "\\u", "values_", ":_", "\\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_", "if_", "self_", "._", "localize_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "value_", "=_", "formats_", "._", "sanitize", "\\u", "separators_", "(_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Strip", " ", "trail", "ing", " ", "decima", "l", " ", "and", " ", "zero", "s", "._", "\\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 ", " _", "value_", "=_", "int_", "(_", "self_", "._", "re", "\\u", "decimal_", "._", "sub_", "(_", "''_", ",_", "str_", "(_", "value_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "(_", "Value", "Error_", ",_", "Type", "Error_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Validat", "ion", "Error_", "(_", "self_", "._", "error", "\\u", "messages_", "[_", "'", "invalid", "'_", "]_", ",_", "code_", "=_", "'", "invalid", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Integer", "Field_", "(_", "Field_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "widget", "\\u", "attrs_", "(_", "self_", ",_", "widget_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "attrs_", "=_", "super_", "(_", "Integer", "Field_", ",_", "self_", ")_", "._", "widget", "\\u", "attrs_", "(_", "widget_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "isinstance_", "(_", "widget_", ",_", "Number", "Input_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "min", "\\u", "value_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "attrs_", "[_", "'", "min", "'_", "]_", "=_", "self_", "._", "min", "\\u", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "max", "\\u", "value_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "attrs_", "[_", "'", "max", "'_", "]_", "=_", "self_", "._", "max", "\\u", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "attrs_", "\\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_", "Float", "Field_", "(_", "Integer", "Field_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "default", "\\u", "error", "\\u", "messages_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "invalid", "'_", ":_", "\\u_", "(_", "'", "Enter", " ", "a", " ", "number", ".'_", ")_", ",_", "\\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_", "Float", "Field_", "(_", "Integer", "Field_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "to", "\\u", "python_", "(_", "self_", ",_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Validate", "s", " ", "tha", "t", " ", "float", "()", " ", "can", " ", "be", " ", "call", "ed", " ", "on", " ", "the", " ", "input", ".", " ", "Return", "s", " ", "the", " ", "result", "\\", "10", ";", " ", " ", " ", " ", "of", " ", "float", "()", ".", " ", "Return", "s", " ", "Non", "e", " ", "for", " ", "empty", " ", "values", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "value_", "=_", "super_", "(_", "Integer", "Field_", ",_", "self_", ")_", "._", "to", "\\u", "python_", "(_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "value_", "in_", "self_", "._", "empty", "\\u", "values_", ":_", "\\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_", "if_", "self_", "._", "localize_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "value_", "=_", "formats_", "._", "sanitize", "\\u", "separators_", "(_", "value_", ")_", "\\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 ", " _", "value_", "=_", "float_", "(_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "(_", "Value", "Error_", ",_", "Type", "Error_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Validat", "ion", "Error_", "(_", "self_", "._", "error", "\\u", "messages_", "[_", "'", "invalid", "'_", "]_", ",_", "code_", "=_", "'", "invalid", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Float", "Field_", "(_", "Integer", "Field_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "validate_", "(_", "self_", ",_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "super_", "(_", "Float", "Field_", ",_", "self_", ")_", "._", "validate_", "(_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Check", " ", "for", " ", "Na", "N", " ", "(", "whi", "ch", " ", "is", " ", "the", " ", "only", " ", "thing", " ", "not", " ", "equal", " ", "to", " ", "its", "elf", ")", " ", "and", " ", "+/-", " ", "infinity", "_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "value_", "!=_", "value_", "or_", "value_", "in_", "(_", "Decimal_", "(_", "'", "Inf", "'_", ")_", ",_", "Decimal_", "(_", "'-", "Inf", "'_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Validat", "ion", "Error_", "(_", "self_", "._", "error", "\\u", "messages_", "[_", "'", "invalid", "'_", "]_", ",_", "code_", "=_", "'", "invalid", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Float", "Field_", "(_", "Integer", "Field_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "widget", "\\u", "attrs_", "(_", "self_", ",_", "widget_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "attrs_", "=_", "super_", "(_", "Float", "Field_", ",_", "self_", ")_", "._", "widget", "\\u", "attrs_", "(_", "widget_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "isinstance_", "(_", "widget_", ",_", "Number", "Input_", ")_", "and_", "'", "step", "'_", "not_", "in_", "widget_", "._", "attrs_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "attrs_", "._", "setdefault_", "(_", "'", "step", "'_", ",_", "'", "any", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "attrs_", "\\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_", "Deci", "mal", "Field_", "(_", "Integer", "Field_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "default", "\\u", "error", "\\u", "messages_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "invalid", "'_", ":_", "\\u_", "(_", "'", "Enter", " ", "a", " ", "number", ".'_", ")_", ",_", "\\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_", "Deci", "mal", "Field_", "(_", "Integer", "Field_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "max", "\\u", "value_", "=_", "None_", ",_", "min", "\\u", "value_", "=_", "None_", ",_", "max", "\\u", "digits_", "=_", "None_", ",_", "decima", "l\\u", "places_", "=_", "None_", ",_", "*_", "args_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "max", "\\u", "digits_", ",_", "self_", "._", "decima", "l\\u", "places_", "=_", "max", "\\u", "digits_", ",_", "decima", "l\\u", "places_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "super_", "(_", "Deci", "mal", "Field_", ",_", "self_", ")_", "._", "\\u\\u", "init\\u\\u_", "(_", "max", "\\u", "value_", ",_", "min", "\\u", "value_", ",_", "*_", "args_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "validators_", "._", "append_", "(_", "validators_", "._", "Deci", "mal", "Validator_", "(_", "max", "\\u", "digits_", ",_", "decima", "l\\u", "places_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Deci", "mal", "Field_", "(_", "Integer", "Field_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "to", "\\u", "python_", "(_", "self_", ",_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Validate", "s", " ", "tha", "t", " ", "the", " ", "input", " ", "is", " ", "a", " ", "decima", "l", " ", "number", ".", " ", "Return", "s", " ", "a", " ", "Deci", "mal", "\\", "10", ";", " ", " ", " ", " ", "instance", ".", " ", "Return", "s", " ", "Non", "e", " ", "for", " ", "empty", " ", "values", ".", " ", "Ensur", "es", " ", "tha", "t", " ", "there", " ", "are", " ", "no", " ", "more", "\\", "10", ";", " ", " ", " ", " ", "than", " ", "max", "\\u", "digit", "s", " ", "in", " ", "the", " ", "number", ",", " ", "and", " ", "no", " ", "more", " ", "than", " ", "decima", "l\\u", "place", "s", " ", "digit", "s", "\\", "10", ";", " ", " ", " ", " ", "after", " ", "the", " ", "decima", "l", " ", "point", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "value_", "in_", "self_", "._", "empty", "\\u", "values_", ":_", "\\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_", "if_", "self_", "._", "localize_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "value_", "=_", "formats_", "._", "sanitize", "\\u", "separators_", "(_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "value_", "=_", "smart", "\\u", "text_", "(_", "value_", ")_", "._", "strip_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "value_", "=_", "Decimal_", "(_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Deci", "mal", "Exception_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Validat", "ion", "Error_", "(_", "self_", "._", "error", "\\u", "messages_", "[_", "'", "invalid", "'_", "]_", ",_", "code_", "=_", "'", "invalid", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Deci", "mal", "Field_", "(_", "Integer", "Field_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "validate_", "(_", "self_", ",_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "super_", "(_", "Deci", "mal", "Field_", ",_", "self_", ")_", "._", "validate_", "(_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "value_", "in_", "self_", "._", "empty", "\\u", "values_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Check", " ", "for", " ", "Na", "N", ",", " ", "Inf", " ", "and", " ", "-", "Inf", " ", "values", ".", " ", "We", " ", "can", "'", "t", " ", "compare", " ", "direct", "ly", " ", "for", " ", "Na", "N", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "sinc", "e", " ", "it", " ", "is", " ", "neve", "r", " ", "equal", " ", "to", " ", "its", "elf", ".", " ", "Ho", "we", "ver", ",", " ", "Na", "N", " ", "is", " ", "the", " ", "only", " ", "value", " ", "that_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "isn", "'", "t", " ", "equal", " ", "to", " ", "its", "elf", ",", " ", "so", " ", "we", " ", "can", " ", "use", " ", "this", " ", "to", " ", "identify", " ", "Na", "N_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "value_", "!=_", "value_", "or_", "value_", "==_", "Decimal_", "(_", "\"", "Inf", "\"_", ")_", "or_", "value_", "==_", "Decimal_", "(_", "\"-", "Inf", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Validat", "ion", "Error_", "(_", "self_", "._", "error", "\\u", "messages_", "[_", "'", "invalid", "'_", "]_", ",_", "code_", "=_", "'", "invalid", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Deci", "mal", "Field_", "(_", "Integer", "Field_", ")_", ":_", "\\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_", "widget", "\\u", "attrs_", "(_", "self_", ",_", "widget_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "attrs_", "=_", "super_", "(_", "Deci", "mal", "Field_", ",_", "self_", ")_", "._", "widget", "\\u", "attrs_", "(_", "widget_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "isinstance_", "(_", "widget_", ",_", "Number", "Input_", ")_", "and_", "'", "step", "'_", "not_", "in_", "widget_", "._", "attrs_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "decima", "l\\u", "places_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Us", "e", " ", "exponential", " ", "notation", " ", "for", " ", "small", " ", "values", " ", "sinc", "e", " ", "the", "y", " ", "mig", "ht_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "be", " ", "parsed", " ", "as", " ", "0", " ", "other", "wis", "e", ".", " ", "ref", " ", "#", "207", "65_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "step_", "=_", "str_", "(_", "Decimal_", "(_", "'", "1", "'_", ")_", "/_", "10_", "**_", "self_", "._", "decima", "l\\u", "places_", ")_", "._", "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 ", " _", "step_", "=_", "'", "any", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "attrs_", "._", "setdefault_", "(_", "'", "step", "'_", ",_", "step_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "attrs_", "\\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_", "Base", "Tempora", "l", "Field_", "(_", "Field_", ")_", ":_", "\\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_", "Base", "Tempora", "l", "Field_", "(_", "Field_", ")_", ":_", "\\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_", ",_", "input", "\\u", "formats_", "=_", "None_", ",_", "*_", "args_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "super_", "(_", "Base", "Tempora", "l", "Field_", ",_", "self_", ")_", "._", "\\u\\u", "init\\u\\u_", "(_", "*_", "args_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "input", "\\u", "formats_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "input", "\\u", "formats_", "=_", "input", "\\u", "formats_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Base", "Tempora", "l", "Field_", "(_", "Field_", ")_", ":_", "\\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_", "to", "\\u", "python_", "(_", "self_", ",_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Tr", "y", " ", "to", " ", "coerce", " ", "the", " ", "value", " ", "to", " ", "unicode", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "unicode", "\\u", "value_", "=_", "force", "\\u", "text_", "(_", "value_", ",_", "string", "s", "\\u", "only_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "isinstance_", "(_", "unicode", "\\u", "value_", ",_", "six_", "._", "text", "\\u", "type_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "value_", "=_", "unicode", "\\u", "value_", "._", "strip_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "If", " ", "unicode", ",", " ", "try", " ", "to", " ", "strp", "time", " ", "against", " ", "each", " ", "input", " ", "format", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "isinstance_", "(_", "value_", ",_", "six_", "._", "text", "\\u", "type_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "format_", "in_", "self_", "._", "input", "\\u", "formats_", ":_", "\\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_", "self_", "._", "strptime_", "(_", "value_", ",_", "format_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "(_", "Value", "Error_", ",_", "Type", "Error_", ")_", ":_", "\\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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "raise_", "Validat", "ion", "Error_", "(_", "self_", "._", "error", "\\u", "messages_", "[_", "'", "invalid", "'_", "]_", ",_", "code_", "=_", "'", "invalid", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Base", "Tempora", "l", "Field_", "(_", "Field_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "strptime_", "(_", "self_", ",_", "value_", ",_", "format_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Not", "Impl", "ement", "ed", "Error_", "(_", "'", "Subc", "lasse", "s", " ", "must", " ", "defin", "e", " ", "this", " ", "method", ".'_", ")_", "\\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_", "Date", "Field_", "(_", "Base", "Tempora", "l", "Field_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "widget_", "=_", "Date", "Input_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "input", "\\u", "formats_", "=_", "formats_", "._", "get", "\\u", "format\\u", "lazy_", "(_", "'", "DAT", "E", "\\u", "INPUT", "\\u", "FORMAT", "S", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "default", "\\u", "error", "\\u", "messages_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "invalid", "'_", ":_", "\\u_", "(_", "'", "Enter", " ", "a", " ", "valid", " ", "date", ".'_", ")_", ",_", "\\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_", "Date", "Field_", "(_", "Base", "Tempora", "l", "Field_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "to", "\\u", "python_", "(_", "self_", ",_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Validate", "s", " ", "tha", "t", " ", "the", " ", "input", " ", "can", " ", "be", " ", "convert", "ed", " ", "to", " ", "a", " ", "date", ".", " ", "Return", "s", " ", "a", " ", "Pyth", "on", "\\", "10", ";", " ", " ", " ", " ", "datetime", ".", "date", " ", "object", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "value_", "in_", "self_", "._", "empty", "\\u", "values_", ":_", "\\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_", "if_", "isinstance_", "(_", "value_", ",_", "datetime_", "._", "datetime_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "value_", "._", "date_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "isinstance_", "(_", "value_", ",_", "datetime_", "._", "date_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "super_", "(_", "Date", "Field_", ",_", "self_", ")_", "._", "to", "\\u", "python_", "(_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Date", "Field_", "(_", "Base", "Tempora", "l", "Field_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "strptime_", "(_", "self_", ",_", "value_", ",_", "format_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "datetime_", "._", "datetime_", "._", "strptime_", "(_", "force", "\\u", "str_", "(_", "value_", ")_", ",_", "format_", ")_", "._", "date_", "(_", ")_", "\\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_", "Time", "Field_", "(_", "Base", "Tempora", "l", "Field_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "widget_", "=_", "Time", "Input_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "input", "\\u", "formats_", "=_", "formats_", "._", "get", "\\u", "format\\u", "lazy_", "(_", "'", "TIME", "\\u", "INPUT", "\\u", "FORMAT", "S", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "default", "\\u", "error", "\\u", "messages_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "invalid", "'_", ":_", "\\u_", "(_", "'", "Enter", " ", "a", " ", "valid", " ", "time", ".'_", ")_", "\\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", "Field_", "(_", "Base", "Tempora", "l", "Field_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "to", "\\u", "python_", "(_", "self_", ",_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Validate", "s", " ", "tha", "t", " ", "the", " ", "input", " ", "can", " ", "be", " ", "convert", "ed", " ", "to", " ", "a", " ", "time", ".", " ", "Return", "s", " ", "a", " ", "Pyth", "on", "\\", "10", ";", " ", " ", " ", " ", "datetime", ".", "time", " ", "object", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "value_", "in_", "self_", "._", "empty", "\\u", "values_", ":_", "\\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_", "if_", "isinstance_", "(_", "value_", ",_", "datetime_", "._", "time_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "super_", "(_", "Time", "Field_", ",_", "self_", ")_", "._", "to", "\\u", "python_", "(_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Time", "Field_", "(_", "Base", "Tempora", "l", "Field_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "strptime_", "(_", "self_", ",_", "value_", ",_", "format_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "datetime_", "._", "datetime_", "._", "strptime_", "(_", "force", "\\u", "str_", "(_", "value_", ")_", ",_", "format_", ")_", "._", "time_", "(_", ")_", "\\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_", "Date", "Time", "Field_", "(_", "Base", "Tempora", "l", "Field_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "widget_", "=_", "Date", "Time", "Input_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "input", "\\u", "formats_", "=_", "formats_", "._", "get", "\\u", "format\\u", "lazy_", "(_", "'", "DATETIME", "\\u", "INPUT", "\\u", "FORMAT", "S", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "default", "\\u", "error", "\\u", "messages_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "invalid", "'_", ":_", "\\u_", "(_", "'", "Enter", " ", "a", " ", "valid", " ", "date", "/", "time", ".'_", ")_", ",_", "\\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_", "Date", "Time", "Field_", "(_", "Base", "Tempora", "l", "Field_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "prepar", "e\\u", "value_", "(_", "self_", ",_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "isinstance_", "(_", "value_", ",_", "datetime_", "._", "datetime_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "value_", "=_", "to", "\\u", "current", "\\u", "timezone_", "(_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Date", "Time", "Field_", "(_", "Base", "Tempora", "l", "Field_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "to", "\\u", "python_", "(_", "self_", ",_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Validate", "s", " ", "tha", "t", " ", "the", " ", "input", " ", "can", " ", "be", " ", "convert", "ed", " ", "to", " ", "a", " ", "datetime", ".", " ", "Return", "s", " ", "a", "\\", "10", ";", " ", " ", " ", " ", "Pyth", "on", " ", "datetime", ".", "datetime", " ", "object", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "value_", "in_", "self_", "._", "empty", "\\u", "values_", ":_", "\\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_", "if_", "isinstance_", "(_", "value_", ",_", "datetime_", "._", "datetime_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "from", "\\u", "current", "\\u", "timezone_", "(_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "isinstance_", "(_", "value_", ",_", "datetime_", "._", "date_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "=_", "datetime_", "._", "datetime_", "(_", "value_", "._", "year_", ",_", "value_", "._", "month_", ",_", "value_", "._", "day_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "from", "\\u", "current", "\\u", "timezone_", "(_", "result_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "result_", "=_", "super_", "(_", "Date", "Time", "Field_", ",_", "self_", ")_", "._", "to", "\\u", "python_", "(_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "from", "\\u", "current", "\\u", "timezone_", "(_", "result_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Date", "Time", "Field_", "(_", "Base", "Tempora", "l", "Field_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "strptime_", "(_", "self_", ",_", "value_", ",_", "format_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "datetime_", "._", "datetime_", "._", "strptime_", "(_", "force", "\\u", "str_", "(_", "value_", ")_", ",_", "format_", ")_", "\\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_", "Dur", "ation", "Field_", "(_", "Field_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "default", "\\u", "error", "\\u", "messages_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "invalid", "'_", ":_", "\\u_", "(_", "'", "Enter", " ", "a", " ", "valid", " ", "duration", ".'_", ")_", ",_", "\\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_", "Dur", "ation", "Field_", "(_", "Field_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "prepar", "e\\u", "value_", "(_", "self_", ",_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "isinstance_", "(_", "value_", ",_", "datetime_", "._", "timedelta_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "duration", "\\u", "string_", "(_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Dur", "ation", "Field_", "(_", "Field_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "to", "\\u", "python_", "(_", "self_", ",_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "value_", "in_", "self_", "._", "empty", "\\u", "values_", ":_", "\\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_", "if_", "isinstance_", "(_", "value_", ",_", "datetime_", "._", "timedelta_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "value_", "=_", "parse", "\\u", "duration_", "(_", "force", "\\u", "text_", "(_", "value_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "value_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Validat", "ion", "Error_", "(_", "self_", "._", "error", "\\u", "messages_", "[_", "'", "invalid", "'_", "]_", ",_", "code_", "=_", "'", "invalid", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "value_", "\\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_", "Rege", "x", "Field_", "(_", "Char", "Field_", ")_", ":_", "\\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\\uDEDENT\\u\\u\\u_", "regex_", "=_", "property_", "(_", "\\u", "get", "\\u", "regex_", ",_", "\\u", "set\\u", "regex_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Rege", "x", "Field_", "(_", "Char", "Field_", ")_", ":_", "\\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_", ",_", "regex_", ",_", "max", "\\u", "length_", "=_", "None_", ",_", "min", "\\u", "length_", "=_", "None_", ",_", "error", "\\u", "message_", "=_", "None_", ",_", "*_", "args_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "regex", " ", "can", " ", "be", " ", "eit", "her", " ", "a", " ", "string", " ", "or", " ", "a", " ", "compile", "d", " ", "regular", " ", "express", "ion", " ", "object", ".", "\\", "10", ";", " ", " ", " ", " ", "error", "\\u", "message", " ", "is", " ", "an", " ", "option", "al", " ", "error", " ", "message", " ", "to", " ", "use", ",", " ", "if", "\\", "10", ";", " ", " ", " ", " ", "'", "Enter", " ", "a", " ", "valid", " ", "value", "'", " ", "is", " ", "too", " ", "gener", "ic", " ", "for", " ", "you", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "kwargs_", "._", "setdefault_", "(_", "'", "strip", "'_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "super_", "(_", "Rege", "x", "Field_", ",_", "self_", ")_", "._", "\\u\\u", "init\\u\\u_", "(_", "max", "\\u", "length_", ",_", "min", "\\u", "length_", ",_", "*_", "args_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "set\\u", "regex_", "(_", "regex_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Rege", "x", "Field_", "(_", "Char", "Field_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "get", "\\u", "regex_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "\\u", "regex_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Rege", "x", "Field_", "(_", "Char", "Field_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "set\\u", "regex_", "(_", "self_", ",_", "regex_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "isinstance_", "(_", "regex_", ",_", "six_", "._", "string", "\\u", "types_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "regex_", "=_", "re_", "._", "compile_", "(_", "regex_", ",_", "re_", "._", "UNICODE_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "regex_", "=_", "regex_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "hasattr_", "(_", "self_", ",_", "'\\u", "regex", "\\u", "validator", "'_", ")_", "and_", "self_", "._", "\\u", "regex", "\\u", "validator_", "in_", "self_", "._", "validators_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "validators_", "._", "remove_", "(_", "self_", "._", "\\u", "regex", "\\u", "validator_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "regex", "\\u", "validator_", "=_", "validators_", "._", "Rege", "x", "Validator_", "(_", "regex_", "=_", "regex_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "validators_", "._", "append_", "(_", "self_", "._", "\\u", "regex", "\\u", "validator_", ")_", "\\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_", "Ema", "il", "Field_", "(_", "Char", "Field_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "widget_", "=_", "Ema", "il", "Input_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "default", "\\u", "validators_", "=_", "[_", "validators_", "._", "validat", "e\\u", "email_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Ema", "il", "Field_", "(_", "Char", "Field_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "clean_", "(_", "self_", ",_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "value_", "=_", "self_", "._", "to", "\\u", "python_", "(_", "value_", ")_", "._", "strip_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "super_", "(_", "Ema", "il", "Field_", ",_", "self_", ")_", "._", "clean_", "(_", "value_", ")_", "\\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_", "File", "Field_", "(_", "Field_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "widget_", "=_", "Clear", "able", "File", "Input_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "default", "\\u", "error", "\\u", "messages_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "invalid", "'_", ":_", "\\u_", "(_", "\"", "No", " ", "file", " ", "was", " ", "submitted", ".", " ", "Check", " ", "the", " ", "encoding", " ", "type", " ", "on", " ", "the", " ", "form", ".\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "missi", "ng", "'_", ":_", "\\u_", "(_", "\"", "No", " ", "file", " ", "was", " ", "submitted", ".\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "empty", "'_", ":_", "\\u_", "(_", "\"", "The", " ", "submitted", " ", "file", " ", "is", " ", "empty", ".\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "max", "\\u", "length", "'_", ":_", "unge", "ttext", "\\u", "lazy_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Ensur", "e", " ", "this", " ", "filename", " ", "has", " ", "at", " ", "most", " ", "%", "(", "max", ")", "d", " ", "character", " ", "(", "it", " ", "has", " ", "%", "(", "length", ")", "d", ").'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Ensur", "e", " ", "this", " ", "filename", " ", "has", " ", "at", " ", "most", " ", "%", "(", "max", ")", "d", " ", "character", "s", " ", "(", "it", " ", "has", " ", "%", "(", "length", ")", "d", ").'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "max", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "contra", "diction", "'_", ":_", "\\u_", "(_", "'", "Ple", "ase", " ", "eit", "her", " ", "submit", " ", "a", " ", "file", " ", "or", " ", "check", " ", "the", " ", "clear", " ", "checkb", "ox", ",", " ", "not", " ", "bot", "h", ".'_", ")_", "\\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_", "File", "Field_", "(_", "Field_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "*_", "args_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "max", "\\u", "length_", "=_", "kwargs_", "._", "pop_", "(_", "'", "max", "\\u", "length", "'_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "allow", "\\u", "empty", "\\u", "file_", "=_", "kwargs_", "._", "pop_", "(_", "'", "allow", "\\u", "empty", "\\u", "file", "'_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "super_", "(_", "File", "Field_", ",_", "self_", ")_", "._", "\\u\\u", "init\\u\\u_", "(_", "*_", "args_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "File", "Field_", "(_", "Field_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "to", "\\u", "python_", "(_", "self_", ",_", "data_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "data_", "in_", "self_", "._", "empty", "\\u", "values_", ":_", "\\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_", "#", " ", "Upload", "ed", "File", " ", "object", "s", " ", "shou", "ld", " ", "have", " ", "name", " ", "and", " ", "size", " ", "attribute", "s", "._", "\\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 ", " _", "file", "\\u", "name_", "=_", "data_", "._", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "file", "\\u", "size_", "=_", "data_", "._", "size_", "\\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 ", " _", "raise_", "Validat", "ion", "Error_", "(_", "self_", "._", "error", "\\u", "messages_", "[_", "'", "invalid", "'_", "]_", ",_", "code_", "=_", "'", "invalid", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "max", "\\u", "length_", "is_", "not_", "None_", "and_", "len_", "(_", "file", "\\u", "name_", ")_", ">_", "self_", "._", "max", "\\u", "length_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "params_", "=_", "{_", "'", "max", "'_", ":_", "self_", "._", "max", "\\u", "length_", ",_", "'", "length", "'_", ":_", "len_", "(_", "file", "\\u", "name_", ")_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "Validat", "ion", "Error_", "(_", "self_", "._", "error", "\\u", "messages_", "[_", "'", "max", "\\u", "length", "'_", "]_", ",_", "code_", "=_", "'", "max", "\\u", "length", "'_", ",_", "params_", "=_", "params_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "file", "\\u", "name_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Validat", "ion", "Error_", "(_", "self_", "._", "error", "\\u", "messages_", "[_", "'", "invalid", "'_", "]_", ",_", "code_", "=_", "'", "invalid", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "self_", "._", "allow", "\\u", "empty", "\\u", "file_", "and_", "not_", "file", "\\u", "size_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Validat", "ion", "Error_", "(_", "self_", "._", "error", "\\u", "messages_", "[_", "'", "empty", "'_", "]_", ",_", "code_", "=_", "'", "empty", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "data_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "File", "Field_", "(_", "Field_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "clean_", "(_", "self_", ",_", "data_", ",_", "initial_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "If", " ", "the", " ", "widget", " ", "got", " ", "contra", "dict", "ory", " ", "inputs", ",", " ", "we", " ", "raise", " ", "a", " ", "validation", " ", "error_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "data_", "is_", "FILE", "\\u", "INPUT", "\\u", "CONTR", "AD", "ICT", "ION_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Validat", "ion", "Error_", "(_", "self_", "._", "error", "\\u", "messages_", "[_", "'", "contra", "diction", "'_", "]_", ",_", "code_", "=_", "'", "contra", "diction", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Fal", "se", " ", "means", " ", "the", " ", "field", " ", "value", " ", "shou", "ld", " ", "be", " ", "clear", "ed", ";", " ", "fur", "ther", " ", "validation", " ", "is_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "not", " ", "need", "ed", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "data_", "is_", "False_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "self_", "._", "required_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "If", " ", "the", " ", "field", " ", "is", " ", "require", "d", ",", " ", "clear", "ing", " ", "is", " ", "not", " ", "possib", "le", " ", "(", "the", " ", "widget_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "shou", "ld", "n", "'", "t", " ", "return", " ", "Fal", "se", " ", "data", " ", "in", " ", "tha", "t", " ", "case", " ", "anyway", ").", " ", "Fal", "se", " ", "is", " ", "not_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "in", " ", "self", ".", "empty", "\\u", "value", ";", " ", "if", " ", "a", " ", "Fal", "se", " ", "value", " ", "make", "s", " ", "it", " ", "this", " ", "far_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "it", " ", "shou", "ld", " ", "be", " ", "validat", "ed", " ", "from", " ", "here", " ", "on", " ", "out", " ", "as", " ", "Non", "e", " ", "(", "so", " ", "it", " ", "will", " ", "be_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "cau", "ght", " ", "by", " ", "the", " ", "require", "d", " ", "check", ").", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "data_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "data_", "and_", "initial_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "initial_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "super_", "(_", "File", "Field_", ",_", "self_", ")_", "._", "clean_", "(_", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "File", "Field_", "(_", "Field_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "bound", "\\u", "data_", "(_", "self_", ",_", "data_", ",_", "initial_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "data_", "in_", "(_", "None_", ",_", "FILE", "\\u", "INPUT", "\\u", "CONTR", "AD", "ICT", "ION_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "initial_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "data_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "File", "Field_", "(_", "Field_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "has", "\\u", "changed_", "(_", "self_", ",_", "initial_", ",_", "data_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "data_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\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]_", "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_", "Image", "Field_", "(_", "File", "Field_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "default", "\\u", "error", "\\u", "messages_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "invalid", "\\u", "image", "'_", ":_", "\\u_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Upload", " ", "a", " ", "valid", " ", "image", ".", " ", "The", " ", "file", " ", "you", " ", "uploade", "d", " ", "was", " ", "eit", "her", " ", "not", " ", "an", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "image", " ", "or", " ", "a", " ", "corrupted", " ", "image", ".\"_", "\\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_", "Image", "Field_", "(_", "File", "Field_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "to", "\\u", "python_", "(_", "self_", ",_", "data_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Check", "s", " ", "tha", "t", " ", "the", " ", "file", "-", "upload", " ", "field", " ", "data", " ", "contain", "s", " ", "a", " ", "valid", " ", "image", " ", "(", "GIF", ",", " ", "JP", "G", ",", "\\", "10", ";", " ", " ", " ", " ", "PNG", ",", " ", "possib", "ly", " ", "other", "s", " ", "--", " ", "what", "ever", " ", "the", " ", "Pyth", "on", " ", "Imagin", "g", " ", "Libr", "ary", " ", "support", "s", ").", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "=_", "super_", "(_", "Image", "Field_", ",_", "self_", ")_", "._", "to", "\\u", "python_", "(_", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "f_", "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_", "from_", "PIL_", "import_", "Image_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "We", " ", "need", " ", "to", " ", "get", " ", "a", " ", "file", " ", "object", " ", "for", " ", "Pil", "low", ".", " ", "We", " ", "mig", "ht", " ", "have", " ", "a", " ", "path", " ", "or", " ", "we", " ", "mig", "ht_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "have", " ", "to", " ", "read", " ", "the", " ", "data", " ", "int", "o", " ", "memory", "._", "\\u\\u\\uNL\\u\\u\\u_", "if_", "hasattr_", "(_", "data_", ",_", "'", "temporar", "y", "\\u", "file", "\\u", "path", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "file_", "=_", "data_", "._", "temporar", "y", "\\u", "file", "\\u", "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 ", " _", "if_", "hasattr_", "(_", "data_", ",_", "'", "read", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "file_", "=_", "Byte", "s", "IO_", "(_", "data_", "._", "read_", "(_", ")_", ")_", "\\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 ", " _", "file_", "=_", "Byte", "s", "IO_", "(_", "data_", "[_", "'", "content", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "load", "()", " ", "coul", "d", " ", "spot", " ", "a", " ", "truncat", "ed", " ", "JP", "EG", ",", " ", "but", " ", "it", " ", "load", "s", " ", "the", " ", "entire", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "image", " ", "in", " ", "memory", ",", " ", "whi", "ch", " ", "is", " ", "a", " ", "Do", "S", " ", "vector", ".", " ", "See", " ", "#", "384", "8", " ", "and", " ", "#", "185", "20._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "image_", "=_", "Image_", "._", "open_", "(_", "file_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "verify", "()", " ", "must", " ", "be", " ", "call", "ed", " ", "immediate", "ly", " ", "after", " ", "the", " ", "construct", "or", "._", "\\u\\u\\uNL\\u\\u\\u_", "image_", "._", "verify_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Annot", "ati", "ng", " ", "so", " ", "subclasses", " ", "can", " ", "reus", "e", " ", "it", " ", "for", " ", "thei", "r", " ", "own", " ", "validation_", "\\u\\u\\uNL\\u\\u\\u_", "f_", "._", "image_", "=_", "image_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Pil", "low", " ", "doe", "sn", "'", "t", " ", "detect", " ", "the", " ", "MIME", " ", "type", " ", "of", " ", "all", " ", "formats", ".", " ", "In", " ", "tho", "se_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "case", "s", ",", " ", "content", "\\u", "type", " ", "will", " ", "be", " ", "Non", "e", "._", "\\u\\u\\uNL\\u\\u\\u_", "f_", "._", "content", "\\u", "type_", "=_", "Image_", "._", "MIME", "_", "._", "get_", "(_", "image_", "._", "format_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Pil", "low", " ", "doe", "sn", "'", "t", " ", "recognize", " ", "it", " ", "as", " ", "an", " ", "image", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "six_", "._", "reraise", "_", "(_", "Validat", "ion", "Error_", ",_", "Validat", "ion", "Error_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "error", "\\u", "messages_", "[_", "'", "invalid", "\\u", "image", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "code_", "=_", "'", "invalid", "\\u", "image", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ",_", "sys_", "._", "exc", "\\u", "info_", "(_", ")_", "[_", "2_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "hasattr_", "(_", "f_", ",_", "'", "seek", "'_", ")_", "and_", "callable_", "(_", "f_", "._", "seek_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "f_", "._", "seek_", "(_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "f_", "\\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_", "URL", "Field_", "(_", "Char", "Field_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "widget_", "=_", "URL", "Input_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "default", "\\u", "error", "\\u", "messages_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "invalid", "'_", ":_", "\\u_", "(_", "'", "Enter", " ", "a", " ", "valid", " ", "URL", ".'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "default", "\\u", "validators_", "=_", "[_", "validators_", "._", "URL", "Validator_", "(_", ")_", "]_", "\\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_", "URL", "Field_", "(_", "Char", "Field_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "to", "\\u", "python_", "(_", "self_", ",_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "split", "\\u", "url_", "(_", "url_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", " ", "a", " ", "list", " ", "of", " ", "url", " ", "part", "s", " ", "via", " ", "``", "urlpa", "rse", ".", "urls", "plit", "``", " ", "(", "or", " ", "raise", "s", " ", "a", "\\", "10", ";", " ", " ", " ", " ", "``", "Validat", "ion", "Error", "``", " ", "exception", " ", "for", " ", "cert", "ain", ").", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "list_", "(_", "urlsplit_", "(_", "url_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Value", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "urlpa", "rse", ".", "urls", "plit", " ", "can", " ", "raise", " ", "a", " ", "Value", "Error", " ", "with", " ", "some", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "mis", "format", "ted", " ", "URL", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Validat", "ion", "Error_", "(_", "self_", "._", "error", "\\u", "messages_", "[_", "'", "invalid", "'_", "]_", ",_", "code_", "=_", "'", "invalid", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "value_", "=_", "super_", "(_", "URL", "Field_", ",_", "self_", ")_", "._", "to", "\\u", "python_", "(_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "value_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "url", "\\u", "fields_", "=_", "split", "\\u", "url_", "(_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "url", "\\u", "fields_", "[_", "0_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "If", " ", "no", " ", "URL", " ", "sche", "me", " ", "give", "n", ",", " ", "assume", " ", "http", "://", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "url", "\\u", "fields_", "[_", "0_", "]_", "=_", "'", "http", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "url", "\\u", "fields_", "[_", "1_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Assume", " ", "tha", "t", " ", "if", " ", "no", " ", "domain", " ", "is", " ", "provided", ",", " ", "tha", "t", " ", "the", " ", "path", " ", "segment_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "contain", "s", " ", "the", " ", "domain", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "url", "\\u", "fields_", "[_", "1_", "]_", "=_", "url", "\\u", "fields_", "[_", "2_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "url", "\\u", "fields_", "[_", "2_", "]_", "=_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Reb", "uild", " ", "the", " ", "url", "\\u", "fields", " ", "list", ",", " ", "sinc", "e", " ", "the", " ", "domain", " ", "segment", " ", "may", " ", "now_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "contain", " ", "the", " ", "path", " ", "too", "._", "\\u\\u\\uNL\\u\\u\\u_", "url", "\\u", "fields_", "=_", "split", "\\u", "url_", "(_", "urlu", "nsp", "lit_", "(_", "url", "\\u", "fields_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "value_", "=_", "urlu", "nsp", "lit_", "(_", "url", "\\u", "fields_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "URL", "Field_", "(_", "Char", "Field_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "clean_", "(_", "self_", ",_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "value_", "=_", "self_", "._", "to", "\\u", "python_", "(_", "value_", ")_", "._", "strip_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "super_", "(_", "URL", "Field_", ",_", "self_", ")_", "._", "clean_", "(_", "value_", ")_", "\\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_", "Boo", "lean", "Field_", "(_", "Field_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "widget_", "=_", "Checkb", "ox", "Input_", "\\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_", "Boo", "lean", "Field_", "(_", "Field_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "to", "\\u", "python_", "(_", "self_", ",_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Return", "s", " ", "a", " ", "Pyth", "on", " ", "boolean", " ", "object", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Exp", "licit", "ly", " ", "check", " ", "for", " ", "the", " ", "string", " ", "'", "Fal", "se", "',", " ", "whi", "ch", " ", "is", " ", "what", " ", "a", " ", "hidden", " ", "field_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "will", " ", "submit", " ", "for", " ", "Fal", "se", ".", " ", "Al", "so", " ", "check", " ", "for", " ", "'", "0", "',", " ", "sinc", "e", " ", "this", " ", "is", " ", "what_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Radio", "Select", " ", "will", " ", "provide", ".", " ", "Be", "caus", "e", " ", "bool", "(\"", "Tru", "e", "\")", " ", "==", " ", "bool", "('", "1", "')", " ", "==", " ", "Tru", "e", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "we", " ", "don", "'", "t", " ", "need", " ", "to", " ", "handle", " ", "tha", "t", " ", "explicit", "ly", "._", "\\u\\u\\uNL\\u\\u\\u_", "if_", "isinstance_", "(_", "value_", ",_", "six_", "._", "string", "\\u", "types_", ")_", "and_", "value_", "._", "lower_", "(_", ")_", "in_", "(_", "'", "fal", "se", "'_", ",_", "'", "0", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "value_", "=_", "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 ", " _", "value_", "=_", "bool_", "(_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "super_", "(_", "Boo", "lean", "Field_", ",_", "self_", ")_", "._", "to", "\\u", "python_", "(_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Boo", "lean", "Field_", "(_", "Field_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "validate_", "(_", "self_", ",_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "value_", "and_", "self_", "._", "required_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Validat", "ion", "Error_", "(_", "self_", "._", "error", "\\u", "messages_", "[_", "'", "require", "d", "'_", "]_", ",_", "code_", "=_", "'", "require", "d", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Boo", "lean", "Field_", "(_", "Field_", ")_", ":_", "\\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_", "has", "\\u", "changed_", "(_", "self_", ",_", "initial_", ",_", "data_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Some", "times", " ", "data", " ", "or", " ", "initial", " ", "may", " ", "be", " ", "a", " ", "string", " ", "equivalent", " ", "of", " ", "a", " ", "boolean_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "so", " ", "we", " ", "shou", "ld", " ", "run", " ", "it", " ", "through", " ", "to", "\\u", "python", " ", "first", " ", "to", " ", "get", " ", "a", " ", "boolean", " ", "value_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "to", "\\u", "python_", "(_", "initial_", ")_", "!=_", "self_", "._", "to", "\\u", "python_", "(_", "data_", ")_", "\\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_", "Null", "Boo", "lean", "Field_", "(_", "Boo", "lean", "Field_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "A", " ", "field", " ", "who", "se", " ", "valid", " ", "values", " ", "are", " ", "Non", "e", ",", " ", "Tru", "e", " ", "and", " ", "Fal", "se", ".", " ", "Inva", "lid", " ", "values", " ", "are", "\\", "10", ";", " ", " ", " ", " ", "clean", "ed", " ", "to", " ", "Non", "e", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "widget_", "=_", "Null", "Boo", "lean", "Select_", "\\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_", "Null", "Boo", "lean", "Field_", "(_", "Boo", "lean", "Field_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "to", "\\u", "python_", "(_", "self_", ",_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Exp", "licit", "ly", " ", "checks", " ", "for", " ", "the", " ", "string", " ", "'", "Tru", "e", "'", " ", "and", " ", "'", "Fal", "se", "',", " ", "whi", "ch", " ", "is", " ", "what", " ", "a", "\\", "10", ";", " ", " ", " ", " ", "hidden", " ", "field", " ", "will", " ", "submit", " ", "for", " ", "Tru", "e", " ", "and", " ", "Fal", "se", ",", " ", "for", " ", "'", "true", "'", " ", "and", " ", "'", "fal", "se", "',", "\\", "10", ";", " ", " ", " ", " ", "whi", "ch", " ", "are", " ", "like", "ly", " ", "to", " ", "be", " ", "return", "ed", " ", "by", " ", "Ja", "va", "Script", " ", "serializ", "ation", "s", " ", "of", " ", "forms", ",", "\\", "10", ";", " ", " ", " ", " ", "and", " ", "for", " ", "'", "1", "'", " ", "and", " ", "'", "0", "',", " ", "whi", "ch", " ", "is", " ", "what", " ", "a", " ", "Radio", "Field", " ", "will", " ", "submit", ".", " ", "Unli", "ke", "\\", "10", ";", " ", " ", " ", " ", "the", " ", "Boo", "lean", "field", " ", "we", " ", "need", " ", "to", " ", "explicit", "ly", " ", "check", " ", "for", " ", "Tru", "e", ",", " ", "bec", "aus", "e", " ", "we", " ", "are", "\\", "10", ";", " ", " ", " ", " ", "not", " ", "usi", "ng", " ", "the", " ", "bool", "()", " ", "function", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "value_", "in_", "(_", "True_", ",_", "'", "Tru", "e", "'_", ",_", "'", "true", "'_", ",_", "'", "1", "'_", ")_", ":_", "\\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_", "elif_", "value_", "in_", "(_", "False_", ",_", "'", "Fal", "se", "'_", ",_", "'", "fal", "se", "'_", ",_", "'", "0", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "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 ", " _", "return_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Null", "Boo", "lean", "Field_", "(_", "Boo", "lean", "Field_", ")_", ":_", "\\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_", "validate_", "(_", "self_", ",_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Call", "able", "Choi", "ce", "Iterator_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Call", "able", "Choi", "ce", "Iterator_", "(_", "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_", ",_", "choice", "s", "\\u", "func_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "choice", "s", "\\u", "func_", "=_", "choice", "s", "\\u", "func_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Call", "able", "Choi", "ce", "Iterator_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "iter\\u\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "e_", "in_", "self_", "._", "choice", "s", "\\u", "func_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "yield_", "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_", "class_", "Choi", "ce", "Field_", "(_", "Field_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "widget_", "=_", "Select_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "default", "\\u", "error", "\\u", "messages_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "invalid", "\\u", "choice", "'_", ":_", "\\u_", "(_", "'", "Select", " ", "a", " ", "valid", " ", "choice", ".", " ", "%", "(", "value", ")", "s", " ", "is", " ", "not", " ", "one", " ", "of", " ", "the", " ", "avail", "able", " ", "choice", "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\\uDEDENT\\u\\u\\u_", "choices_", "=_", "property_", "(_", "\\u", "get", "\\u", "choices_", ",_", "\\u", "set\\u", "choices_", ")_", "\\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_", "Choi", "ce", "Field_", "(_", "Field_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "choices_", "=_", "(_", ")_", ",_", "required_", "=_", "True_", ",_", "widget_", "=_", "None_", ",_", "label_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "initial_", "=_", "None_", ",_", "help", "\\u", "text_", "=_", "''_", ",_", "*_", "args_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "super_", "(_", "Choi", "ce", "Field_", ",_", "self_", ")_", "._", "\\u\\u", "init\\u\\u_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "required_", "=_", "required_", ",_", "widget_", "=_", "widget_", ",_", "label_", "=_", "label_", ",_", "initial_", "=_", "initial_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help", "\\u", "text_", "=_", "help", "\\u", "text_", ",_", "*_", "args_", ",_", "**_", "kwargs_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "choices_", "=_", "choices_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Choi", "ce", "Field_", "(_", "Field_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "deepc", "opy", "\\u\\u_", "(_", "self_", ",_", "memo_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "=_", "super_", "(_", "Choi", "ce", "Field_", ",_", "self_", ")_", "._", "\\u\\u", "deepc", "opy", "\\u\\u_", "(_", "memo_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "._", "\\u", "choices_", "=_", "copy_", "._", "deepcopy_", "(_", "self_", "._", "\\u", "choices_", ",_", "memo_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "result_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Choi", "ce", "Field_", "(_", "Field_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "get", "\\u", "choices_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "\\u", "choices_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Choi", "ce", "Field_", "(_", "Field_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "set\\u", "choices_", "(_", "self_", ",_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Sett", "ing", " ", "choice", "s", " ", "als", "o", " ", "sets", " ", "the", " ", "choice", "s", " ", "on", " ", "the", " ", "widget", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "choice", "s", " ", "can", " ", "be", " ", "any", " ", "iterable", ",", " ", "but", " ", "we", " ", "call", " ", "list", "()", " ", "on", " ", "it", " ", "bec", "aus", "e_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "it", " ", "will", " ", "be", " ", "consume", "d", " ", "more", " ", "than", " ", "onc", "e", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "callable_", "(_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "value_", "=_", "Call", "able", "Choi", "ce", "Iterator_", "(_", "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 ", " _", "value_", "=_", "list_", "(_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "choices_", "=_", "self_", "._", "widget_", "._", "choices_", "=_", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Choi", "ce", "Field_", "(_", "Field_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "to", "\\u", "python_", "(_", "self_", ",_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"", "Return", "s", " ", "a", " ", "Unic", "ode", " ", "object", ".\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "value_", "in_", "self_", "._", "empty", "\\u", "values_", ":_", "\\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_", "return_", "smart", "\\u", "text_", "(_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Choi", "ce", "Field_", "(_", "Field_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "validate_", "(_", "self_", ",_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Validate", "s", " ", "tha", "t", " ", "the", " ", "input", " ", "is", " ", "in", " ", "self", ".", "choice", "s", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "super_", "(_", "Choi", "ce", "Field_", ",_", "self_", ")_", "._", "validate_", "(_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "value_", "and_", "not_", "self_", "._", "valid", "\\u", "value_", "(_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Validat", "ion", "Error_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "error", "\\u", "messages_", "[_", "'", "invalid", "\\u", "choice", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "code_", "=_", "'", "invalid", "\\u", "choice", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "params_", "=_", "{_", "'", "value", "'_", ":_", "value_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Choi", "ce", "Field_", "(_", "Field_", ")_", ":_", "\\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_", "valid", "\\u", "value_", "(_", "self_", ",_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"", "Check", " ", "to", " ", "see", " ", "if", " ", "the", " ", "provided", " ", "value", " ", "is", " ", "a", " ", "valid", " ", "choice", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "text", "\\u", "value_", "=_", "force", "\\u", "text_", "(_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "k_", ",_", "v_", "in_", "self_", "._", "choices_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "isinstance_", "(_", "v_", ",_", "(_", "list_", ",_", "tuple_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Thi", "s", " ", "is", " ", "an", " ", "opt", "group", ",", " ", "so", " ", "look", " ", "insi", "de", " ", "the", " ", "group", " ", "for", " ", "options_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "k2_", ",_", "v2_", "in_", "v_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "value_", "==_", "k2_", "or_", "text", "\\u", "value_", "==_", "force", "\\u", "text_", "(_", "k2_", ")_", ":_", "\\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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "value_", "==_", "k_", "or_", "text", "\\u", "value_", "==_", "force", "\\u", "text_", "(_", "k_", ")_", ":_", "\\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_", "\\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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Type", "d", "Choi", "ce", "Field_", "(_", "Choi", "ce", "Field_", ")_", ":_", "\\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_", "Type", "d", "Choi", "ce", "Field_", "(_", "Choi", "ce", "Field_", ")_", ":_", "\\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 ", " _", "self_", "._", "coerce", "_", "=_", "kwargs_", "._", "pop_", "(_", "'", "coerce", "'_", ",_", "lambda_", "val_", ":_", "val_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "empty", "\\u", "value_", "=_", "kwargs_", "._", "pop_", "(_", "'", "empty", "\\u", "value", "'_", ",_", "''_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "super_", "(_", "Type", "d", "Choi", "ce", "Field_", ",_", "self_", ")_", "._", "\\u\\u", "init\\u\\u_", "(_", "*_", "args_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Type", "d", "Choi", "ce", "Field_", "(_", "Choi", "ce", "Field_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "coerce", "_", "(_", "self_", ",_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Validate", " ", "tha", "t", " ", "the", " ", "value", " ", "can", " ", "be", " ", "coerce", "d", " ", "to", " ", "the", " ", "right", " ", "type", " ", "(", "if", " ", "not", " ", "empty", ").", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "value_", "==_", "self_", "._", "empty", "\\u", "value_", "or_", "value_", "in_", "self_", "._", "empty", "\\u", "values_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "empty", "\\u", "value_", "\\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 ", " _", "value_", "=_", "self_", "._", "coerce", "_", "(_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "(_", "Value", "Error_", ",_", "Type", "Error_", ",_", "Validat", "ion", "Error_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Validat", "ion", "Error_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "error", "\\u", "messages_", "[_", "'", "invalid", "\\u", "choice", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "code_", "=_", "'", "invalid", "\\u", "choice", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "params_", "=_", "{_", "'", "value", "'_", ":_", "value_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Type", "d", "Choi", "ce", "Field_", "(_", "Choi", "ce", "Field_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "clean_", "(_", "self_", ",_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "value_", "=_", "super_", "(_", "Type", "d", "Choi", "ce", "Field_", ",_", "self_", ")_", "._", "clean_", "(_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "\\u", "coerce", "_", "(_", "value_", ")_", "\\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_", "Multipl", "e", "Choi", "ce", "Field_", "(_", "Choi", "ce", "Field_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "hidden", "\\u", "widget_", "=_", "Multipl", "e", "Hi", "dde", "n", "Input_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "widget_", "=_", "Select", "Multiple_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "default", "\\u", "error", "\\u", "messages_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "invalid", "\\u", "choice", "'_", ":_", "\\u_", "(_", "'", "Select", " ", "a", " ", "valid", " ", "choice", ".", " ", "%", "(", "value", ")", "s", " ", "is", " ", "not", " ", "one", " ", "of", " ", "the", " ", "avail", "able", " ", "choice", "s", ".'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "invalid", "\\u", "list", "'_", ":_", "\\u_", "(_", "'", "Enter", " ", "a", " ", "list", " ", "of", " ", "values", ".'_", ")_", ",_", "\\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_", "Multipl", "e", "Choi", "ce", "Field_", "(_", "Choi", "ce", "Field_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "to", "\\u", "python_", "(_", "self_", ",_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "value_", ":_", "\\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_", "elif_", "not_", "isinstance_", "(_", "value_", ",_", "(_", "list_", ",_", "tuple_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Validat", "ion", "Error_", "(_", "self_", "._", "error", "\\u", "messages_", "[_", "'", "invalid", "\\u", "list", "'_", "]_", ",_", "code_", "=_", "'", "invalid", "\\u", "list", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "[_", "smart", "\\u", "text_", "(_", "val_", ")_", "for_", "val_", "in_", "value_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Multipl", "e", "Choi", "ce", "Field_", "(_", "Choi", "ce", "Field_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "validate_", "(_", "self_", ",_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Validate", "s", " ", "tha", "t", " ", "the", " ", "input", " ", "is", " ", "a", " ", "list", " ", "or", " ", "tuple", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "required_", "and_", "not_", "value_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Validat", "ion", "Error_", "(_", "self_", "._", "error", "\\u", "messages_", "[_", "'", "require", "d", "'_", "]_", ",_", "code_", "=_", "'", "require", "d", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Validate", " ", "tha", "t", " ", "each", " ", "value", " ", "in", " ", "the", " ", "value", " ", "list", " ", "is", " ", "in", " ", "self", ".", "choice", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "val_", "in_", "value_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "self_", "._", "valid", "\\u", "value_", "(_", "val_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Validat", "ion", "Error_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "error", "\\u", "messages_", "[_", "'", "invalid", "\\u", "choice", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "code_", "=_", "'", "invalid", "\\u", "choice", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "params_", "=_", "{_", "'", "value", "'_", ":_", "val_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Multipl", "e", "Choi", "ce", "Field_", "(_", "Choi", "ce", "Field_", ")_", ":_", "\\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_", "has", "\\u", "changed_", "(_", "self_", ",_", "initial_", ",_", "data_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "initial_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "initial_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "data_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "data_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "len_", "(_", "initial_", ")_", "!=_", "len_", "(_", "data_", ")_", ":_", "\\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_", "initial", "\\u", "set_", "=_", "set_", "(_", "force", "\\u", "text_", "(_", "value_", ")_", "for_", "value_", "in_", "initial_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data\\u", "set_", "=_", "set_", "(_", "force", "\\u", "text_", "(_", "value_", ")_", "for_", "value_", "in_", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "data\\u", "set_", "!=_", "initial", "\\u", "set_", "\\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_", "Type", "d", "Multipl", "e", "Choi", "ce", "Field_", "(_", "Multipl", "e", "Choi", "ce", "Field_", ")_", ":_", "\\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_", "Type", "d", "Multipl", "e", "Choi", "ce", "Field_", "(_", "Multipl", "e", "Choi", "ce", "Field_", ")_", ":_", "\\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 ", " _", "self_", "._", "coerce", "_", "=_", "kwargs_", "._", "pop_", "(_", "'", "coerce", "'_", ",_", "lambda_", "val_", ":_", "val_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "empty", "\\u", "value_", "=_", "kwargs_", "._", "pop_", "(_", "'", "empty", "\\u", "value", "'_", ",_", "[_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "super_", "(_", "Type", "d", "Multipl", "e", "Choi", "ce", "Field_", ",_", "self_", ")_", "._", "\\u\\u", "init\\u\\u_", "(_", "*_", "args_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Type", "d", "Multipl", "e", "Choi", "ce", "Field_", "(_", "Multipl", "e", "Choi", "ce", "Field_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "coerce", "_", "(_", "self_", ",_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Validate", "s", " ", "tha", "t", " ", "the", " ", "values", " ", "are", " ", "in", " ", "self", ".", "choice", "s", " ", "and", " ", "can", " ", "be", " ", "coerce", "d", " ", "to", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "right", " ", "type", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "value_", "==_", "self_", "._", "empty", "\\u", "value_", "or_", "value_", "in_", "self_", "._", "empty", "\\u", "values_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "empty", "\\u", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "new", "\\u", "value_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "choice_", "in_", "value_", ":_", "\\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 ", " _", "new", "\\u", "value_", "._", "append_", "(_", "self_", "._", "coerce", "_", "(_", "choice_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "(_", "Value", "Error_", ",_", "Type", "Error_", ",_", "Validat", "ion", "Error_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Validat", "ion", "Error_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "error", "\\u", "messages_", "[_", "'", "invalid", "\\u", "choice", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "code_", "=_", "'", "invalid", "\\u", "choice", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "params_", "=_", "{_", "'", "value", "'_", ":_", "choice_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "new", "\\u", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Type", "d", "Multipl", "e", "Choi", "ce", "Field_", "(_", "Multipl", "e", "Choi", "ce", "Field_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "clean_", "(_", "self_", ",_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "value_", "=_", "super_", "(_", "Type", "d", "Multipl", "e", "Choi", "ce", "Field_", ",_", "self_", ")_", "._", "clean_", "(_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "\\u", "coerce", "_", "(_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Type", "d", "Multipl", "e", "Choi", "ce", "Field_", "(_", "Multipl", "e", "Choi", "ce", "Field_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "validate_", "(_", "self_", ",_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "value_", "!=_", "self_", "._", "empty", "\\u", "value_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "super_", "(_", "Type", "d", "Multipl", "e", "Choi", "ce", "Field_", ",_", "self_", ")_", "._", "validate_", "(_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "self_", "._", "required_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Validat", "ion", "Error_", "(_", "self_", "._", "error", "\\u", "messages_", "[_", "'", "require", "d", "'_", "]_", ",_", "code_", "=_", "'", "require", "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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Comb", "o", "Field_", "(_", "Field_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "A", " ", "Field", " ", "who", "se", " ", "clean", "()", " ", "method", " ", "calls", " ", "multiple", " ", "Field", " ", "clean", "()", " ", "method", "s", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Comb", "o", "Field_", "(_", "Field_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "fields_", "=_", "(_", ")_", ",_", "*_", "args_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "super_", "(_", "Comb", "o", "Field_", ",_", "self_", ")_", "._", "\\u\\u", "init\\u\\u_", "(_", "*_", "args_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Set", " ", "'", "require", "d", "'", " ", "to", " ", "Fal", "se", " ", "on", " ", "the", " ", "individual", " ", "fields", ",", " ", "bec", "aus", "e", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "require", "d", " ", "validation", " ", "will", " ", "be", " ", "handle", "d", " ", "by", " ", "Comb", "o", "Field", ",", " ", "not", " ", "by", " ", "tho", "se_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "individual", " ", "fields", "._", "\\u\\u\\uNL\\u\\u\\u_", "for_", "f_", "in_", "fields_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "f_", "._", "required_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "fields_", "=_", "fields_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Comb", "o", "Field_", "(_", "Field_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "clean_", "(_", "self_", ",_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Validate", "s", " ", "the", " ", "give", "n", " ", "value", " ", "against", " ", "all", " ", "of", " ", "self", ".", "fields", ",", " ", "whi", "ch", " ", "is", " ", "a", "\\", "10", ";", " ", " ", " ", " ", "list", " ", "of", " ", "Field", " ", "instance", "s", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "super_", "(_", "Comb", "o", "Field_", ",_", "self_", ")_", "._", "clean_", "(_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "field_", "in_", "self_", "._", "fields_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "value_", "=_", "field_", "._", "clean_", "(_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "value_", "\\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_", "Multi", "Value", "Field_", "(_", "Field_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "A", " ", "Field", " ", "tha", "t", " ", "aggregates", " ", "the", " ", "logic", " ", "of", " ", "multiple", " ", "Field", "s", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "It", "s", " ", "clean", "()", " ", "method", " ", "take", "s", " ", "a", " ", "\"", "decompress", "ed", "\"", " ", "list", " ", "of", " ", "values", ",", " ", "whi", "ch", " ", "are", " ", "then", "\\", "10", ";", " ", " ", " ", " ", "clean", "ed", " ", "int", "o", " ", "a", " ", "single", " ", "value", " ", "according", " ", "to", " ", "self", ".", "fields", ".", " ", "Ea", "ch", " ", "value", " ", "in", "\\", "10", ";", " ", " ", " ", " ", "this", " ", "list", " ", "is", " ", "clean", "ed", " ", "by", " ", "the", " ", "correspond", "ing", " ", "field", " ", "--", " ", "the", " ", "first", " ", "value", " ", "is", "\\", "10", ";", " ", " ", " ", " ", "clean", "ed", " ", "by", " ", "the", " ", "first", " ", "field", ",", " ", "the", " ", "second", " ", "value", " ", "is", " ", "clean", "ed", " ", "by", " ", "the", " ", "second", "\\", "10", ";", " ", " ", " ", " ", "field", ",", " ", "etc", ".", " ", "On", "ce", " ", "all", " ", "fields", " ", "are", " ", "clean", "ed", ",", " ", "the", " ", "list", " ", "of", " ", "clean", " ", "values", " ", "is", "\\", "10", ";", " ", " ", " ", " ", "\"", "compress", "ed", "\"", " ", "int", "o", " ", "a", " ", "single", " ", "value", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Subc", "lasse", "s", " ", "shou", "ld", " ", "not", " ", "have", " ", "to", " ", "implement", " ", "clean", "()", ".", " ", "Ins", "tea", "d", ",", " ", "the", "y", " ", "must", "\\", "10", ";", " ", " ", " ", " ", "implement", " ", "compress", "()", ",", " ", "whi", "ch", " ", "take", "s", " ", "a", " ", "list", " ", "of", " ", "valid", " ", "values", " ", "and", " ", "return", "s", " ", "a", "\\", "10", ";", " ", " ", " ", " ", "\"", "compress", "ed", "\"", " ", "version", " ", "of", " ", "tho", "se", " ", "values", " ", "--", " ", "a", " ", "single", " ", "value", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "You", "'", "ll", " ", "probab", "ly", " ", "want", " ", "to", " ", "use", " ", "this", " ", "with", " ", "Multi", "Wid", "get", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "default", "\\u", "error", "\\u", "messages_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "invalid", "'_", ":_", "\\u_", "(_", "'", "Enter", " ", "a", " ", "list", " ", "of", " ", "values", ".'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "incomplete", "'_", ":_", "\\u_", "(_", "'", "Enter", " ", "a", " ", "complete", " ", "value", ".'_", ")_", ",_", "\\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_", "Multi", "Value", "Field_", "(_", "Field_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "fields_", "=_", "(_", ")_", ",_", "*_", "args_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "require", "\\u", "all", "\\u", "fields_", "=_", "kwargs_", "._", "pop_", "(_", "'", "require", "\\u", "all", "\\u", "fields", "'_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "super_", "(_", "Multi", "Value", "Field_", ",_", "self_", ")_", "._", "\\u\\u", "init\\u\\u_", "(_", "*_", "args_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "f_", "in_", "fields_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "f_", "._", "error", "\\u", "messages_", "._", "setdefault_", "(_", "'", "incomplete", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "error", "\\u", "messages_", "[_", "'", "incomplete", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "require", "\\u", "all", "\\u", "fields_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Set", " ", "'", "require", "d", "'", " ", "to", " ", "Fal", "se", " ", "on", " ", "the", " ", "individual", " ", "fields", ",", " ", "bec", "aus", "e", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "require", "d", " ", "validation", " ", "will", " ", "be", " ", "handle", "d", " ", "by", " ", "Multi", "Value", "Field", ",", " ", "not_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "by", " ", "tho", "se", " ", "individual", " ", "fields", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "f_", "._", "required_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "fields_", "=_", "fields_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Multi", "Value", "Field_", "(_", "Field_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "deepc", "opy", "\\u\\u_", "(_", "self_", ",_", "memo_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "=_", "super_", "(_", "Multi", "Value", "Field_", ",_", "self_", ")_", "._", "\\u\\u", "deepc", "opy", "\\u\\u_", "(_", "memo_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "._", "fields_", "=_", "tuple_", "(_", "x_", "._", "\\u\\u", "deepc", "opy", "\\u\\u_", "(_", "memo_", ")_", "for_", "x_", "in_", "self_", "._", "fields_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "result_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Multi", "Value", "Field_", "(_", "Field_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "validate_", "(_", "self_", ",_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Multi", "Value", "Field_", "(_", "Field_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "clean_", "(_", "self_", ",_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Validate", "s", " ", "every", " ", "value", " ", "in", " ", "the", " ", "give", "n", " ", "list", ".", " ", "A", " ", "value", " ", "is", " ", "validat", "ed", " ", "against", "\\", "10", ";", " ", " ", " ", " ", "the", " ", "correspond", "ing", " ", "Field", " ", "in", " ", "self", ".", "fields", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "For", " ", "example", ",", " ", "if", " ", "this", " ", "Multi", "Value", "Field", " ", "was", " ", "instantiate", "d", " ", "with", "\\", "10", ";", " ", " ", " ", " ", "fields", "=(", "Date", "Field", "()", ",", " ", "Time", "Field", "())", ",", " ", "clean", "()", " ", "wou", "ld", " ", "call", "\\", "10", ";", " ", " ", " ", " ", "Date", "Field", ".", "clean", "(", "value", "[", "0", "])", " ", "and", " ", "Time", "Field", ".", "clean", "(", "value", "[", "1", "])", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "clean", "\\u", "data_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "errors_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "value_", "or_", "isinstance_", "(_", "value_", ",_", "(_", "list_", ",_", "tuple_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "value_", "or_", "not_", "[_", "v_", "for_", "v_", "in_", "value_", "if_", "v_", "not_", "in_", "self_", "._", "empty", "\\u", "values_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "required_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "raise_", "Validat", "ion", "Error_", "(_", "self_", "._", "error", "\\u", "messages_", "[_", "'", "require", "d", "'_", "]_", ",_", "code_", "=_", "'", "require", "d", "'_", ")_", "\\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_", "self_", "._", "compress_", "(_", "[_", "]_", ")_", "\\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_", "Validat", "ion", "Error_", "(_", "self_", "._", "error", "\\u", "messages_", "[_", "'", "invalid", "'_", "]_", ",_", "code_", "=_", "'", "invalid", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "i_", ",_", "field_", "in_", "enumerate_", "(_", "self_", "._", "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 ", " _", "field", "\\u", "value_", "=_", "value_", "[_", "i_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Index", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "field", "\\u", "value_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "field", "\\u", "value_", "in_", "self_", "._", "empty", "\\u", "values_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "require", "\\u", "all", "\\u", "fields_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Rai", "se", " ", "a", " ", "'", "require", "d", "'", " ", "error", " ", "if", " ", "the", " ", "Multi", "Value", "Field", " ", "is_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "require", "d", " ", "and", " ", "any", " ", "field", " ", "is", " ", "empty", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "self_", "._", "required_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "raise_", "Validat", "ion", "Error_", "(_", "self_", "._", "error", "\\u", "messages_", "[_", "'", "require", "d", "'_", "]_", ",_", "code_", "=_", "'", "require", "d", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "field_", "._", "required_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Ot", "her", "wis", "e", ",", " ", "add", " ", "an", " ", "'", "incomplete", "'", " ", "error", " ", "to", " ", "the", " ", "list", " ", "of_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "collected", " ", "error", "s", " ", "and", " ", "skip", " ", "field", " ", "clean", "ing", ",", " ", "if", " ", "a", " ", "required_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "field", " ", "is", " ", "empty", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "field_", "._", "error", "\\u", "messages_", "[_", "'", "incomplete", "'_", "]_", "not_", "in_", "errors_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "errors_", "._", "append_", "(_", "field_", "._", "error", "\\u", "messages_", "[_", "'", "incomplete", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "continue_", "\\u\\u\\uNEWLINE\\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 ", " _", "clean", "\\u", "data_", "._", "append_", "(_", "field_", "._", "clean_", "(_", "field", "\\u", "value_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Validat", "ion", "Error_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Collect", " ", "all", " ", "validation", " ", "error", "s", " ", "in", " ", "a", " ", "single", " ", "list", ",", " ", "whi", "ch", " ", "we", "'", "ll_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "raise", " ", "at", " ", "the", " ", "end", " ", "of", " ", "clean", "()", ",", " ", "rat", "her", " ", "than", " ", "rais", "ing", " ", "a", " ", "single_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "exception", " ", "for", " ", "the", " ", "first", " ", "error", " ", "we", " ", "encounter", ".", " ", "Ski", "p", " ", "duplicat", "es", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "errors_", "._", "extend_", "(_", "m_", "for_", "m_", "in_", "e_", "._", "error", "\\u", "list_", "if_", "m_", "not_", "in_", "errors_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "errors_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Validat", "ion", "Error_", "(_", "errors_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "out_", "=_", "self_", "._", "compress_", "(_", "clean", "\\u", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "validate_", "(_", "out_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "run", "\\u", "validators_", "(_", "out_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "out_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Multi", "Value", "Field_", "(_", "Field_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "compress_", "(_", "self_", ",_", "data\\u", "list_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", " ", "a", " ", "single", " ", "value", " ", "for", " ", "the", " ", "give", "n", " ", "list", " ", "of", " ", "values", ".", " ", "The", " ", "values", " ", "can", " ", "be", "\\", "10", ";", " ", " ", " ", " ", "assume", "d", " ", "to", " ", "be", " ", "valid", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "For", " ", "example", ",", " ", "if", " ", "this", " ", "Multi", "Value", "Field", " ", "was", " ", "instantiate", "d", " ", "with", "\\", "10", ";", " ", " ", " ", " ", "fields", "=(", "Date", "Field", "()", ",", " ", "Time", "Field", "())", ",", " ", "this", " ", "mig", "ht", " ", "return", " ", "a", " ", "datetime", "\\", "10", ";", " ", " ", " ", " ", "object", " ", "created", " ", "by", " ", "combin", "ing", " ", "the", " ", "date", " ", "and", " ", "time", " ", "in", " ", "data\\u", "list", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "Not", "Impl", "ement", "ed", "Error_", "(_", "'", "Subc", "lasse", "s", " ", "must", " ", "implement", " ", "this", " ", "method", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Multi", "Value", "Field_", "(_", "Field_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "has", "\\u", "changed_", "(_", "self_", ",_", "initial_", ",_", "data_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "initial_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "initial_", "=_", "[_", "''_", "for_", "x_", "in_", "range_", "(_", "0_", ",_", "len_", "(_", "data_", ")_", ")_", "]_", "\\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_", "isinstance_", "(_", "initial_", ",_", "list_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "initial_", "=_", "self_", "._", "widget_", "._", "decompress_", "(_", "initial_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "field_", ",_", "initial_", ",_", "data_", "in_", "zip_", "(_", "self_", "._", "fields_", ",_", "initial_", ",_", "data_", ")_", ":_", "\\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 ", " _", "initial_", "=_", "field_", "._", "to", "\\u", "python_", "(_", "initial_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Validat", "ion", "Error_", ":_", "\\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_", "if_", "field_", "._", "has", "\\u", "changed_", "(_", "initial_", ",_", "data_", ")_", ":_", "\\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_", "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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "File", "Path", "Field_", "(_", "Choi", "ce", "Field_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "File", "Path", "Field_", "(_", "Choi", "ce", "Field_", ")_", ":_", "\\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_", ",_", "path_", ",_", "match_", "=_", "None_", ",_", "recursive_", "=_", "False_", ",_", "allow", "\\u", "files_", "=_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "allow", "\\u", "folders_", "=_", "False_", ",_", "required_", "=_", "True_", ",_", "widget_", "=_", "None_", ",_", "label_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "initial_", "=_", "None_", ",_", "help", "\\u", "text_", "=_", "''_", ",_", "*_", "args_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "path_", ",_", "self_", "._", "match_", ",_", "self_", "._", "recursive_", "=_", "path_", ",_", "match_", ",_", "recursive_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "allow", "\\u", "files_", ",_", "self_", "._", "allow", "\\u", "folders_", "=_", "allow", "\\u", "files_", ",_", "allow", "\\u", "folders_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "super_", "(_", "File", "Path", "Field_", ",_", "self_", ")_", "._", "\\u\\u", "init\\u\\u_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "choices_", "=_", "(_", ")_", ",_", "required_", "=_", "required_", ",_", "widget_", "=_", "widget_", ",_", "label_", "=_", "label_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "initial_", "=_", "initial_", ",_", "help", "\\u", "text_", "=_", "help", "\\u", "text_", ",_", "*_", "args_", ",_", "**_", "kwargs_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "self_", "._", "required_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "choices_", "=_", "[_", "]_", "\\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_", "._", "choices_", "=_", "[_", "(_", "\"\"_", ",_", "\"-------", "--\"_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "match_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "match", "\\u", "re_", "=_", "re_", "._", "compile_", "(_", "self_", "._", "match_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "recursive_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "root_", ",_", "dirs_", ",_", "files_", "in_", "sorted_", "(_", "os_", "._", "walk_", "(_", "self_", "._", "path_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "allow", "\\u", "files_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "for_", "f_", "in_", "files_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "if_", "self_", "._", "match_", "is_", "None_", "or_", "self_", "._", "match", "\\u", "re_", "._", "search_", "(_", "f_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "f_", "=_", "os_", "._", "path_", "._", "join_", "(_", "root_", ",_", "f_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "choices_", "._", "append_", "(_", "(_", "f_", ",_", "f_", "._", "replace_", "(_", "path_", ",_", "\"\"_", ",_", "1_", ")_", ")_", ")_", "\\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_", "self_", "._", "allow", "\\u", "folders_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "for_", "f_", "in_", "dirs_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "if_", "f_", "==_", "'\\u", "\\u", "pyca", "che", "\\u\\u'_", ":_", "\\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_", "self_", "._", "match_", "is_", "None_", "or_", "self_", "._", "match", "\\u", "re_", "._", "search_", "(_", "f_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "f_", "=_", "os_", "._", "path_", "._", "join_", "(_", "root_", ",_", "f_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "choices_", "._", "append_", "(_", "(_", "f_", ",_", "f_", "._", "replace_", "(_", "path_", ",_", "\"\"_", ",_", "1_", ")_", ")_", ")_", "\\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_", "\\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 ", " _", "for_", "f_", "in_", "sorted_", "(_", "os_", "._", "listdir_", "(_", "self_", "._", "path_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "f_", "==_", "'\\u", "\\u", "pyca", "che", "\\u\\u'_", ":_", "\\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", "\\u", "file_", "=_", "os_", "._", "path_", "._", "join_", "(_", "self_", "._", "path_", ",_", "f_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "(_", "(_", "(_", "self_", "._", "allow", "\\u", "files_", "and_", "os_", "._", "path_", "._", "isfile_", "(_", "full", "\\u", "file_", ")_", ")_", "or_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "self_", "._", "allow", "\\u", "folders_", "and_", "os_", "._", "path_", "._", "isdir_", "(_", "full", "\\u", "file_", ")_", ")_", ")_", "and_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "self_", "._", "match_", "is_", "None_", "or_", "self_", "._", "match", "\\u", "re_", "._", "search_", "(_", "f_", ")_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "self_", "._", "choices_", "._", "append_", "(_", "(_", "full", "\\u", "file_", ",_", "f_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "OSE", "rror_", ":_", "\\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_", "self_", "._", "widget_", "._", "choices_", "=_", "self_", "._", "choices_", "\\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_", "Split", "Date", "Time", "Field_", "(_", "Multi", "Value", "Field_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "widget_", "=_", "Split", "Date", "Time", "Widget_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "hidden", "\\u", "widget_", "=_", "Split", "Hi", "dde", "n", "Date", "Time", "Widget_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "default", "\\u", "error", "\\u", "messages_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "invalid", "\\u", "date", "'_", ":_", "\\u_", "(_", "'", "Enter", " ", "a", " ", "valid", " ", "date", ".'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "invalid", "\\u", "time", "'_", ":_", "\\u_", "(_", "'", "Enter", " ", "a", " ", "valid", " ", "time", ".'_", ")_", ",_", "\\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_", "Split", "Date", "Time", "Field_", "(_", "Multi", "Value", "Field_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "input", "\\u", "date", "\\u", "formats_", "=_", "None_", ",_", "input", "\\u", "time", "\\u", "formats_", "=_", "None_", ",_", "*_", "args_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "errors_", "=_", "self_", "._", "default", "\\u", "error", "\\u", "messages_", "._", "copy_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "'", "error", "\\u", "message", "s", "'_", "in_", "kwargs_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "errors_", "._", "update_", "(_", "kwargs_", "[_", "'", "error", "\\u", "message", "s", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "localize_", "=_", "kwargs_", "._", "get_", "(_", "'", "localiz", "e", "'_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fields_", "=_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "Date", "Field_", "(_", "input", "\\u", "formats_", "=_", "input", "\\u", "date", "\\u", "formats_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "error", "\\u", "messages_", "=_", "{_", "'", "invalid", "'_", ":_", "errors_", "[_", "'", "invalid", "\\u", "date", "'_", "]_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "localize_", "=_", "localize_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Time", "Field_", "(_", "input", "\\u", "formats_", "=_", "input", "\\u", "time", "\\u", "formats_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "error", "\\u", "messages_", "=_", "{_", "'", "invalid", "'_", ":_", "errors_", "[_", "'", "invalid", "\\u", "time", "'_", "]_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "localize_", "=_", "localize_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "super_", "(_", "Split", "Date", "Time", "Field_", ",_", "self_", ")_", "._", "\\u\\u", "init\\u\\u_", "(_", "fields_", ",_", "*_", "args_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Split", "Date", "Time", "Field_", "(_", "Multi", "Value", "Field_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "compress_", "(_", "self_", ",_", "data\\u", "list_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "data\\u", "list_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Rai", "se", " ", "a", " ", "validation", " ", "error", " ", "if", " ", "time", " ", "or", " ", "date", " ", "is", " ", "empty_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "(", "possib", "le", " ", "if", " ", "Split", "Date", "Time", "Field", " ", "has", " ", "require", "d", "=", "Fal", "se", ").", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "data\\u", "list_", "[_", "0_", "]_", "in_", "self_", "._", "empty", "\\u", "values_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Validat", "ion", "Error_", "(_", "self_", "._", "error", "\\u", "messages_", "[_", "'", "invalid", "\\u", "date", "'_", "]_", ",_", "code_", "=_", "'", "invalid", "\\u", "date", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "data\\u", "list_", "[_", "1_", "]_", "in_", "self_", "._", "empty", "\\u", "values_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Validat", "ion", "Error_", "(_", "self_", "._", "error", "\\u", "messages_", "[_", "'", "invalid", "\\u", "time", "'_", "]_", ",_", "code_", "=_", "'", "invalid", "\\u", "time", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "result_", "=_", "datetime_", "._", "datetime_", "._", "combine_", "(_", "*_", "data\\u", "list_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "from", "\\u", "current", "\\u", "timezone_", "(_", "result_", ")_", "\\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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Gene", "ric", "IPA", "ddress", "Field_", "(_", "Char", "Field_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Gene", "ric", "IPA", "ddress", "Field_", "(_", "Char", "Field_", ")_", ":_", "\\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_", ",_", "protocol_", "=_", "'", "bot", "h", "'_", ",_", "unpack", "\\u", "ipv4_", "=_", "False_", ",_", "*_", "args_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "unpack", "\\u", "ipv4_", "=_", "unpack", "\\u", "ipv4_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "default", "\\u", "validators_", "=_", "validators_", "._", "ip", "\\u", "address", "\\u", "validators_", "(_", "protocol_", ",_", "unpack", "\\u", "ipv4_", ")_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "super_", "(_", "Gene", "ric", "IPA", "ddress", "Field_", ",_", "self_", ")_", "._", "\\u\\u", "init\\u\\u_", "(_", "*_", "args_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Gene", "ric", "IPA", "ddress", "Field_", "(_", "Char", "Field_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "to", "\\u", "python_", "(_", "self_", ",_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "value_", "in_", "self_", "._", "empty", "\\u", "values_", ":_", "\\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_", "value_", "=_", "value_", "._", "strip_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "value_", "and_", "':'_", "in_", "value_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "clean", "\\u", "ipv", "6", "\\u", "address_", "(_", "value_", ",_", "self_", "._", "unpack", "\\u", "ipv4_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "value_", "\\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_", "Sl", "ug", "Field_", "(_", "Char", "Field_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "default", "\\u", "validators_", "=_", "[_", "validators_", "._", "validat", "e\\u", "slug_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Sl", "ug", "Field_", "(_", "Char", "Field_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "*_", "args_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "allow", "\\u", "unicode_", "=_", "kwargs_", "._", "pop_", "(_", "'", "allow", "\\u", "unicode", "'_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "allow", "\\u", "unicode_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "default", "\\u", "validators_", "=_", "[_", "validators_", "._", "validat", "e\\u", "unicode", "\\u", "slug_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "super_", "(_", "Sl", "ug", "Field_", ",_", "self_", ")_", "._", "\\u\\u", "init\\u\\u_", "(_", "*_", "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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "UU", "IDF", "ield_", "(_", "Char", "Field_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "default", "\\u", "error", "\\u", "messages_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "invalid", "'_", ":_", "\\u_", "(_", "'", "Enter", " ", "a", " ", "valid", " ", "UU", "ID", ".'_", ")_", ",_", "\\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_", "UU", "IDF", "ield_", "(_", "Char", "Field_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "prepar", "e\\u", "value_", "(_", "self_", ",_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "isinstance_", "(_", "value_", ",_", "uuid_", "._", "UUID_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "value_", "._", "hex_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "UU", "IDF", "ield_", "(_", "Char", "Field_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "to", "\\u", "python_", "(_", "self_", ",_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "value_", "=_", "super_", "(_", "UU", "IDF", "ield_", ",_", "self_", ")_", "._", "to", "\\u", "python_", "(_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "value_", "in_", "self_", "._", "empty", "\\u", "values_", ":_", "\\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_", "if_", "not_", "isinstance_", "(_", "value_", ",_", "uuid_", "._", "UUID_", ")_", ":_", "\\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 ", " _", "value_", "=_", "uuid_", "._", "UUID_", "(_", "value_", ")_", "\\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 ", " _", "raise_", "Validat", "ion", "Error_", "(_", "self_", "._", "error", "\\u", "messages_", "[_", "'", "invalid", "'_", "]_", ",_", "code_", "=_", "'", "invalid", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "value_" ]
[ 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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able
mbr/tinyrpc/tinyrpc/transports/zmq.py
[ { "content": " def send_message(self, message, expect_reply=True):\n if six.PY3 and isinstance(message, six.string_types):\n # pyzmq won't accept unicode strings\n message = message.encode()\n\n self.socket.send(message)\n\n if expect_reply:\n return self.socket.recv()", "metadata": "root.ZmqClientTransport.send_message", "header": "['class', 'ZmqClientTransport', '(', 'ClientTransport', ')', ':', '___EOS___']", "index": 59 } ]
[]
[]
0
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "Zm", "q", "Client", "Transport_", "(_", "Client", "Transport_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "send", "\\u", "message_", "(_", "self_", ",_", "message_", ",_", "expect", "\\u", "reply_", "=_", "True_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "six_", "._", "PY", "3_", "and_", "isinstance_", "(_", "message_", ",_", "six_", "._", "string", "\\u", "types_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "py", "zmq", " ", "won", "'", "t", " ", "accept", " ", "unicode", " ", "strings_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "message_", "=_", "message_", "._", "encode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "socket_", "._", "send_", "(_", "message_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "expect", "\\u", "reply_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "socket_", "._", "recv_", "(_", ")_", "\\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 ]
Unused import
platformio/platformio/platformio/builder/scripts/ststm32.py
[ { "content": "# Copyright 2014-2016 Ivan Kravets <me@ikravets.com>\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 Builder for ST STM32 Series ARM microcontrollers.\n\"\"\"\n\nfrom os.path import isfile, join\n\nfrom SCons.Script import (COMMAND_LINE_TARGETS, AlwaysBuild, Default,\n DefaultEnvironment, SConscript)\n\nenv = DefaultEnvironment()\n\nSConscript(env.subst(join(\"$PIOBUILDER_DIR\", \"scripts\", \"basearm.py\")))\n\nif env.subst(\"$UPLOAD_PROTOCOL\") == \"gdb\":\n if not isfile(join(env.subst(\"$PROJECT_DIR\"), \"upload.gdb\")):\n env.Exit(\n \"Error: You are using GDB as firmware uploader. \"\n \"Please specify upload commands in upload.gdb \"\n \"file in project directory!\"\n )\n env.Replace(\n UPLOADER=join(\n \"$PIOPACKAGES_DIR\", \"toolchain-gccarmnoneeabi\",\n \"bin\", \"arm-none-eabi-gdb\"\n ),\n UPLOADERFLAGS=[\n join(\"$BUILD_DIR\", \"firmware.elf\"),\n \"-batch\",\n \"-x\",\n '\"%s\"' % join(\"$PROJECT_DIR\", \"upload.gdb\")\n ],\n\n UPLOADCMD='\"$UPLOADER\" $UPLOADERFLAGS'\n )\nelse:\n env.Replace(\n UPLOADER=join(\"$PIOPACKAGES_DIR\", \"tool-stlink\", \"st-flash\"),\n UPLOADERFLAGS=[\n \"write\", # write in flash\n \"$SOURCES\", # firmware path to flash\n \"0x08000000\" # flash start adress\n ],\n\n UPLOADCMD='\"$UPLOADER\" $UPLOADERFLAGS'\n )\n\n\nenv.Append(\n CPPDEFINES=[\n env.get(\"BOARD_OPTIONS\", {}).get(\n \"build\", {}).get(\"variant\", \"\").upper()\n ],\n\n LIBS=[\"stdc++\", \"nosys\"],\n\n LINKFLAGS=[\n \"-nostartfiles\",\n \"-nostdlib\"\n ]\n)\n\n#\n# Target: Build executable and linkable firmware\n#\n\ntarget_elf = env.BuildProgram()\n\n#\n# Target: Build the .bin file\n#\n\nif \"uploadlazy\" in COMMAND_LINE_TARGETS:\n target_firm = join(\"$BUILD_DIR\", \"firmware.bin\")\nelse:\n target_firm = env.ElfToBin(join(\"$BUILD_DIR\", \"firmware\"), target_elf)\n\n#\n# Target: Print binary size\n#\n\ntarget_size = env.Alias(\"size\", target_elf, \"$SIZEPRINTCMD\")\nAlwaysBuild(target_size)\n\n#\n# Target: Upload by default .bin file\n#\n\nif \"mbed\" in env.subst(\"$FRAMEWORK\") and not env.subst(\"$UPLOAD_PROTOCOL\"):\n upload = env.Alias([\"upload\", \"uploadlazy\"],\n target_firm, env.UploadToDisk)\nelse:\n upload = env.Alias([\"upload\", \"uploadlazy\"], target_firm, \"$UPLOADCMD\")\nAlwaysBuild(upload)\n\n#\n# Target: Define targets\n#\n\nDefault([target_firm, target_size])\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[]
[]
0
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "Copy", "right", " ", "2014", "-", "2016", " ", "Iv", "an", " ", "Kra", "vet", "s", " ", "<", "me", "@", "ik", "rave", "ts", ".", "com", ">_", "\\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_", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Build", "er", " ", "for", " ", "ST", " ", "STM", "32", " ", "Serie", "s", " ", "ARM", " ", "micro", "controlle", "rs", ".", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "os_", "._", "path_", "import_", "isfile_", ",_", "join_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "SC", "ons_", "._", "Script_", "import_", "(_", "COMMA", "ND", "\\u", "LINE", "\\u", "TARGET", "S_", ",_", "Al", "way", "s", "Build_", ",_", "Default_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Default", "Environment_", ",_", "SC", "ons", "cript_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "env_", "=_", "Default", "Environment_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "SC", "ons", "cript_", "(_", "env_", "._", "subst_", "(_", "join_", "(_", "\"$", "PI", "OB", "UI", "LD", "ER", "\\u", "DIR", "\"_", ",_", "\"", "scripts", "\"_", ",_", "\"", "base", "arm", ".", "py", "\"_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "env_", "._", "subst_", "(_", "\"$", "UPLOAD", "\\u", "PROTOCOL", "\"_", ")_", "==_", "\"", "gdb", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "isfile_", "(_", "join_", "(_", "env_", "._", "subst_", "(_", "\"$", "PROJECT", "\\u", "DIR", "\"_", ")_", ",_", "\"", "upload", ".", "gdb", "\"_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "env_", "._", "Exit_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Error", ":", " ", "You", " ", "are", " ", "usi", "ng", " ", "GD", "B", " ", "as", " ", "firmware", " ", "uploade", "r", ".", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Ple", "ase", " ", "speci", "fy", " ", "upload", " ", "command", "s", " ", "in", " ", "upload", ".", "gdb", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "file", " ", "in", " ", "project", " ", "director", "y", "!\"_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "env_", "._", "Replace", "_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "UPLOAD", "ER_", "=_", "join_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"$", "PI", "OP", "AC", "KA", "GE", "S", "\\u", "DIR", "\"_", ",_", "\"", "toolchain", "-", "gcc", "arm", "none", "eab", "i", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "bin", "\"_", ",_", "\"", "arm", "-", "none", "-", "eab", "i", "-", "gdb", "\"_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "UPLOAD", "ER", "FLAGS_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "join_", "(_", "\"$", "BUILD", "\\u", "DIR", "\"_", ",_", "\"", "firmware", ".", "elf", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"-", "batch", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"-", "x", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'\"", "%", "s", "\"'_", "%_", "join_", "(_", "\"$", "PROJECT", "\\u", "DIR", "\"_", ",_", "\"", "upload", ".", "gdb", "\"_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "UPLOAD", "CMD_", "=_", "'\"", "$", "UPLOAD", "ER", "\"", " ", "$", "UPLOAD", "ER", "FLAG", "S", "'_", "\\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 ", " _", "env_", "._", "Replace", "_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "UPLOAD", "ER_", "=_", "join_", "(_", "\"$", "PI", "OP", "AC", "KA", "GE", "S", "\\u", "DIR", "\"_", ",_", "\"", "tool", "-", "stl", "ink", "\"_", ",_", "\"", "st", "-", "flash", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "UPLOAD", "ER", "FLAGS_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "write", "\"_", ",_", "#", " ", "write", " ", "in", " ", "flash_", "\\u\\u\\uNL\\u\\u\\u_", "\"$", "SOURCES", "\"_", ",_", "#", " ", "firmware", " ", "path", " ", "to", " ", "flash_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "0x08", "000000", "\"_", "#", " ", "flash", " ", "start", " ", "adress", "_", "\\u\\u\\uNL\\u\\u\\u_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "UPLOAD", "CMD_", "=_", "'\"", "$", "UPLOAD", "ER", "\"", " ", "$", "UPLOAD", "ER", "FLAG", "S", "'_", "\\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_", "env_", "._", "Append_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "CPP", "DEFINE", "S_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "env_", "._", "get_", "(_", "\"", "BOARD", "\\u", "OPTION", "S", "\"_", ",_", "{_", "}_", ")_", "._", "get_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "build", "\"_", ",_", "{_", "}_", ")_", "._", "get_", "(_", "\"", "variant", "\"_", ",_", "\"\"_", ")_", "._", "upper_", "(_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "LIBS", "_", "=_", "[_", "\"", "std", "c", "++", "\"_", ",_", "\"", "nos", "ys", "\"_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "LINK", "FLAGS_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "\"-", "nost", "art", "files", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"-", "nost", "dlib", "\"_", "\\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_", "#", " ", "Target", ":", " ", "Build", " ", "executable", " ", "and", " ", "link", "able", " ", "firmware", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "target", "\\u", "elf_", "=_", "env_", "._", "Build", "Program_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Target", ":", " ", "Build", " ", "the", " ", ".", "bin", " ", "file_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "\"", "upload", "lazy", "\"_", "in_", "COMMA", "ND", "\\u", "LINE", "\\u", "TARGET", "S_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "target", "\\u", "firm", "_", "=_", "join_", "(_", "\"$", "BUILD", "\\u", "DIR", "\"_", ",_", "\"", "firmware", ".", "bin", "\"_", ")_", "\\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 ", " _", "target", "\\u", "firm", "_", "=_", "env_", "._", "El", "f", "To", "Bin_", "(_", "join_", "(_", "\"$", "BUILD", "\\u", "DIR", "\"_", ",_", "\"", "firmware", "\"_", ")_", ",_", "target", "\\u", "elf_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Target", ":", " ", "Print", " ", "binar", "y", " ", "size_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "target", "\\u", "size_", "=_", "env_", "._", "Alias_", "(_", "\"", "size", "\"_", ",_", "target", "\\u", "elf_", ",_", "\"$", "SIZE", "PRINT", "CMD", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Al", "way", "s", "Build_", "(_", "target", "\\u", "size_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Target", ":", " ", "Upload", " ", "by", " ", "default", " ", ".", "bin", " ", "file_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "\"", "mbed", "\"_", "in_", "env_", "._", "subst_", "(_", "\"$", "FRAME", "WORK", "\"_", ")_", "and_", "not_", "env_", "._", "subst_", "(_", "\"$", "UPLOAD", "\\u", "PROTOCOL", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "upload_", "=_", "env_", "._", "Alias_", "(_", "[_", "\"", "upload", "\"_", ",_", "\"", "upload", "lazy", "\"_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "target", "\\u", "firm", "_", ",_", "env_", "._", "Upload", "To", "Disk_", ")_", "\\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 ", " _", "upload_", "=_", "env_", "._", "Alias_", "(_", "[_", "\"", "upload", "\"_", ",_", "\"", "upload", "lazy", "\"_", "]_", ",_", "target", "\\u", "firm", "_", ",_", "\"$", "UPLOAD", "CMD", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "Al", "way", "s", "Build_", "(_", "upload_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Target", ":", " ", "Define", " ", "targets_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "Default_", "(_", "[_", "target", "\\u", "firm", "_", ",_", "target", "\\u", "size_", "]_", ")_" ]
[ 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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