{ // 获取包含Hugging Face文本的span元素 const spans = link.querySelectorAll('span.whitespace-nowrap, span.hidden.whitespace-nowrap'); spans.forEach(span => { if (span.textContent && span.textContent.trim().match(/Hugging\s*Face/i)) { span.textContent = 'AI快站'; } }); }); // 替换logo图片的alt属性 document.querySelectorAll('img[alt*="Hugging"], img[alt*="Face"]').forEach(img => { if (img.alt.match(/Hugging\s*Face/i)) { img.alt = 'AI快站 logo'; } }); } // 替换导航栏中的链接 function replaceNavigationLinks() { // 已替换标记,防止重复运行 if (window._navLinksReplaced) { return; } // 已经替换过的链接集合,防止重复替换 const replacedLinks = new Set(); // 只在导航栏区域查找和替换链接 const headerArea = document.querySelector('header') || document.querySelector('nav'); if (!headerArea) { return; } // 在导航区域内查找链接 const navLinks = headerArea.querySelectorAll('a'); navLinks.forEach(link => { // 如果已经替换过,跳过 if (replacedLinks.has(link)) return; const linkText = link.textContent.trim(); const linkHref = link.getAttribute('href') || ''; // 替换Spaces链接 - 仅替换一次 if ( (linkHref.includes('/spaces') || linkHref === '/spaces' || linkText === 'Spaces' || linkText.match(/^s*Spacess*$/i)) && linkText !== 'OCR模型免费转Markdown' && linkText !== 'OCR模型免费转Markdown' ) { link.textContent = 'OCR模型免费转Markdown'; link.href = 'https://fast360.xyz'; link.setAttribute('target', '_blank'); link.setAttribute('rel', 'noopener noreferrer'); replacedLinks.add(link); } // 删除Posts链接 else if ( (linkHref.includes('/posts') || linkHref === '/posts' || linkText === 'Posts' || linkText.match(/^s*Postss*$/i)) ) { if (link.parentNode) { link.parentNode.removeChild(link); } replacedLinks.add(link); } // 替换Docs链接 - 仅替换一次 else if ( (linkHref.includes('/docs') || linkHref === '/docs' || linkText === 'Docs' || linkText.match(/^s*Docss*$/i)) && linkText !== '模型下载攻略' ) { link.textContent = '模型下载攻略'; link.href = '/'; replacedLinks.add(link); } // 删除Enterprise链接 else if ( (linkHref.includes('/enterprise') || linkHref === '/enterprise' || linkText === 'Enterprise' || linkText.match(/^s*Enterprises*$/i)) ) { if (link.parentNode) { link.parentNode.removeChild(link); } replacedLinks.add(link); } }); // 查找可能嵌套的Spaces和Posts文本 const textNodes = []; function findTextNodes(element) { if (element.nodeType === Node.TEXT_NODE) { const text = element.textContent.trim(); if (text === 'Spaces' || text === 'Posts' || text === 'Enterprise') { textNodes.push(element); } } else { for (const child of element.childNodes) { findTextNodes(child); } } } // 只在导航区域内查找文本节点 findTextNodes(headerArea); // 替换找到的文本节点 textNodes.forEach(node => { const text = node.textContent.trim(); if (text === 'Spaces') { node.textContent = node.textContent.replace(/Spaces/g, 'OCR模型免费转Markdown'); } else if (text === 'Posts') { // 删除Posts文本节点 if (node.parentNode) { node.parentNode.removeChild(node); } } else if (text === 'Enterprise') { // 删除Enterprise文本节点 if (node.parentNode) { node.parentNode.removeChild(node); } } }); // 标记已替换完成 window._navLinksReplaced = true; } // 替换代码区域中的域名 function replaceCodeDomains() { // 特别处理span.hljs-string和span.njs-string元素 document.querySelectorAll('span.hljs-string, span.njs-string, span[class*="hljs-string"], span[class*="njs-string"]').forEach(span => { if (span.textContent && span.textContent.includes('huggingface.co')) { span.textContent = span.textContent.replace(/huggingface.co/g, 'aifasthub.com'); } }); // 替换hljs-string类的span中的域名(移除多余的转义符号) document.querySelectorAll('span.hljs-string, span[class*="hljs-string"]').forEach(span => { if (span.textContent && span.textContent.includes('huggingface.co')) { span.textContent = span.textContent.replace(/huggingface.co/g, 'aifasthub.com'); } }); // 替换pre和code标签中包含git clone命令的域名 document.querySelectorAll('pre, code').forEach(element => { if (element.textContent && element.textContent.includes('git clone')) { const text = element.innerHTML; if (text.includes('huggingface.co')) { element.innerHTML = text.replace(/huggingface.co/g, 'aifasthub.com'); } } }); // 处理特定的命令行示例 document.querySelectorAll('pre, code').forEach(element => { const text = element.innerHTML; if (text.includes('huggingface.co')) { // 针对git clone命令的专门处理 if (text.includes('git clone') || text.includes('GIT_LFS_SKIP_SMUDGE=1')) { element.innerHTML = text.replace(/huggingface.co/g, 'aifasthub.com'); } } }); // 特别处理模型下载页面上的代码片段 document.querySelectorAll('.flex.border-t, .svelte_hydrator, .inline-block').forEach(container => { const content = container.innerHTML; if (content && content.includes('huggingface.co')) { container.innerHTML = content.replace(/huggingface.co/g, 'aifasthub.com'); } }); // 特别处理模型仓库克隆对话框中的代码片段 try { // 查找包含"Clone this model repository"标题的对话框 const cloneDialog = document.querySelector('.svelte_hydration_boundary, [data-target="MainHeader"]'); if (cloneDialog) { // 查找对话框中所有的代码片段和命令示例 const codeElements = cloneDialog.querySelectorAll('pre, code, span'); codeElements.forEach(element => { if (element.textContent && element.textContent.includes('huggingface.co')) { if (element.innerHTML.includes('huggingface.co')) { element.innerHTML = element.innerHTML.replace(/huggingface.co/g, 'aifasthub.com'); } else { element.textContent = element.textContent.replace(/huggingface.co/g, 'aifasthub.com'); } } }); } // 更精确地定位克隆命令中的域名 document.querySelectorAll('[data-target]').forEach(container => { const codeBlocks = container.querySelectorAll('pre, code, span.hljs-string'); codeBlocks.forEach(block => { if (block.textContent && block.textContent.includes('huggingface.co')) { if (block.innerHTML.includes('huggingface.co')) { block.innerHTML = block.innerHTML.replace(/huggingface.co/g, 'aifasthub.com'); } else { block.textContent = block.textContent.replace(/huggingface.co/g, 'aifasthub.com'); } } }); }); } catch (e) { // 错误处理但不打印日志 } } // 当DOM加载完成后执行替换 if (document.readyState === 'loading') { document.addEventListener('DOMContentLoaded', () => { replaceHeaderBranding(); replaceNavigationLinks(); replaceCodeDomains(); // 只在必要时执行替换 - 3秒后再次检查 setTimeout(() => { if (!window._navLinksReplaced) { console.log('[Client] 3秒后重新检查导航链接'); replaceNavigationLinks(); } }, 3000); }); } else { replaceHeaderBranding(); replaceNavigationLinks(); replaceCodeDomains(); // 只在必要时执行替换 - 3秒后再次检查 setTimeout(() => { if (!window._navLinksReplaced) { console.log('[Client] 3秒后重新检查导航链接'); replaceNavigationLinks(); } }, 3000); } // 增加一个MutationObserver来处理可能的动态元素加载 const observer = new MutationObserver(mutations => { // 检查是否导航区域有变化 const hasNavChanges = mutations.some(mutation => { // 检查是否存在header或nav元素变化 return Array.from(mutation.addedNodes).some(node => { if (node.nodeType === Node.ELEMENT_NODE) { // 检查是否是导航元素或其子元素 if (node.tagName === 'HEADER' || node.tagName === 'NAV' || node.querySelector('header, nav')) { return true; } // 检查是否在导航元素内部 let parent = node.parentElement; while (parent) { if (parent.tagName === 'HEADER' || parent.tagName === 'NAV') { return true; } parent = parent.parentElement; } } return false; }); }); // 只在导航区域有变化时执行替换 if (hasNavChanges) { // 重置替换状态,允许再次替换 window._navLinksReplaced = false; replaceHeaderBranding(); replaceNavigationLinks(); } }); // 开始观察document.body的变化,包括子节点 if (document.body) { observer.observe(document.body, { childList: true, subtree: true }); } else { document.addEventListener('DOMContentLoaded', () => { observer.observe(document.body, { childList: true, subtree: true }); }); } })(); \n\n"},"meta":{"kind":"string","value":"{\n \"content_hash\": \"9a8e72bf3d3c8ab246f93fc1983d4436\",\n \"timestamp\": \"\",\n \"source\": \"github\",\n \"line_count\": 75,\n \"max_line_length\": 451,\n \"avg_line_length\": 78.58666666666667,\n \"alnum_prop\": 0.6511706820495419,\n \"repo_name\": \"calvinfarias/IC2015-2\",\n \"id\": \"6237d2db908818b1a42b51de315bab783a0da94a\",\n \"size\": \"5894\",\n \"binary\": false,\n \"copies\": \"4\",\n \"ref\": \"refs/heads/master\",\n \"path\": \"BOOST/boost_1_61_0/libs/asio/doc/html/boost_asio/reference/buffer/overload24.html\",\n \"mode\": \"33188\",\n \"license\": \"mit\",\n \"language\": [\n {\n \"name\": \"Assembly\",\n \"bytes\": \"223360\"\n },\n {\n \"name\": \"Batchfile\",\n \"bytes\": \"32233\"\n },\n {\n \"name\": \"C\",\n \"bytes\": \"2977162\"\n },\n {\n \"name\": \"C#\",\n \"bytes\": \"40804\"\n },\n {\n \"name\": \"C++\",\n \"bytes\": \"184445796\"\n },\n {\n \"name\": \"CMake\",\n \"bytes\": \"119765\"\n },\n {\n \"name\": \"CSS\",\n \"bytes\": \"427923\"\n },\n {\n \"name\": \"Cuda\",\n \"bytes\": \"111870\"\n },\n {\n \"name\": \"DIGITAL Command Language\",\n \"bytes\": \"6246\"\n },\n {\n \"name\": \"FORTRAN\",\n \"bytes\": \"5291\"\n },\n {\n \"name\": \"Groff\",\n \"bytes\": \"5189\"\n },\n {\n \"name\": \"HTML\",\n \"bytes\": \"234946752\"\n },\n {\n \"name\": \"IDL\",\n \"bytes\": \"14\"\n },\n {\n \"name\": \"JavaScript\",\n \"bytes\": \"682223\"\n },\n {\n \"name\": \"Lex\",\n \"bytes\": \"1231\"\n },\n {\n \"name\": \"M4\",\n \"bytes\": \"29689\"\n },\n {\n \"name\": \"Makefile\",\n \"bytes\": \"1083443\"\n },\n {\n \"name\": \"Max\",\n \"bytes\": \"36857\"\n },\n {\n \"name\": \"Objective-C\",\n \"bytes\": \"11406\"\n },\n {\n \"name\": \"Objective-C++\",\n \"bytes\": \"630\"\n },\n {\n \"name\": \"PHP\",\n \"bytes\": \"59030\"\n },\n {\n \"name\": \"Perl\",\n \"bytes\": \"39008\"\n },\n {\n \"name\": \"Perl6\",\n \"bytes\": \"2053\"\n },\n {\n \"name\": \"Python\",\n \"bytes\": \"1759984\"\n },\n {\n \"name\": \"QML\",\n \"bytes\": \"593\"\n },\n {\n \"name\": \"QMake\",\n \"bytes\": \"16692\"\n },\n {\n \"name\": \"Rebol\",\n \"bytes\": \"354\"\n },\n {\n \"name\": \"Ruby\",\n \"bytes\": \"5532\"\n },\n {\n \"name\": \"Shell\",\n \"bytes\": \"355247\"\n },\n {\n \"name\": \"Tcl\",\n \"bytes\": \"1172\"\n },\n {\n \"name\": \"TeX\",\n \"bytes\": \"126042\"\n },\n {\n \"name\": \"XSLT\",\n \"bytes\": \"552736\"\n },\n {\n \"name\": \"Yacc\",\n \"bytes\": \"19623\"\n }\n ],\n \"symlink_target\": \"\"\n}"}}},{"rowIdx":301,"cells":{"text":{"kind":"string","value":"\r\n\r\n\r\n\r\n\r\nMember List\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n
\r\n
\r\n \r\n
\r\n \r\n
\r\n
\r\n

edge_t Member List

This is the complete list of members for edge_t, including all inherited members.\r\n \r\n \r\n
iedge_t
jedge_t
\r\n\r\n\r\n\r\n\r\n
\r\n\r\n
\r\n\r\n
Generated on Wed Apr 18 11:36:55 2012 by \r\n\r\n\"doxygen\"/ 1.6.3
\r\n\r\n\r\n"},"meta":{"kind":"string","value":"{\n \"content_hash\": \"53f57ee38cc90ecfb80b7bb6079f7042\",\n \"timestamp\": \"\",\n \"source\": \"github\",\n \"line_count\": 69,\n \"max_line_length\": 957,\n \"avg_line_length\": 63,\n \"alnum_prop\": 0.665976535541753,\n \"repo_name\": \"madratman/riss_bingham\",\n \"id\": \"87592bcb6e25a73bd4670d13de88314cdefcd80e\",\n \"size\": \"4347\",\n \"binary\": false,\n \"copies\": \"1\",\n \"ref\": \"refs/heads/master\",\n \"path\": \"c/doc/html/structedge__t-members.html\",\n \"mode\": \"33188\",\n \"license\": \"bsd-3-clause\",\n \"language\": [\n {\n \"name\": \"C\",\n \"bytes\": \"17198129\"\n },\n {\n \"name\": \"C++\",\n \"bytes\": \"22178342\"\n },\n {\n \"name\": \"CSS\",\n \"bytes\": \"14525\"\n },\n {\n \"name\": \"Fortran\",\n \"bytes\": \"285254\"\n },\n {\n \"name\": \"HTML\",\n \"bytes\": \"3452018\"\n },\n {\n \"name\": \"Java\",\n \"bytes\": \"36102\"\n },\n {\n \"name\": \"JavaScript\",\n \"bytes\": \"22349\"\n },\n {\n \"name\": \"Lua\",\n \"bytes\": \"29317\"\n },\n {\n \"name\": \"M\",\n \"bytes\": \"3179\"\n },\n {\n \"name\": \"Makefile\",\n \"bytes\": \"7138\"\n },\n {\n \"name\": \"Mathematica\",\n \"bytes\": \"465\"\n },\n {\n \"name\": \"Matlab\",\n \"bytes\": \"3540588\"\n },\n {\n \"name\": \"Mercury\",\n \"bytes\": \"201\"\n },\n {\n \"name\": \"Perl\",\n \"bytes\": \"2698\"\n },\n {\n \"name\": \"R\",\n \"bytes\": \"2166\"\n }\n ],\n \"symlink_target\": \"\"\n}"}}},{"rowIdx":302,"cells":{"text":{"kind":"string","value":"\n\n#ifndef UDP_TESTS_H\n#define UDP_TESTS_H\n\n#include \"../test_params.h\"\n#include \"mbed_trace.h\"\n\n#define TRACE_GROUP \"GRNT\"\n\nNetworkInterface *get_interface();\nvoid drop_bad_packets(UDPSocket &sock, int orig_timeout);\nnsapi_version_t get_ip_version();\nbool check_oversized_packets(nsapi_error_t error, int &size);\nvoid fill_tx_buffer_ascii(char *buff, size_t len);\n\n#if MBED_CONF_NSAPI_SOCKET_STATS_ENABLED\nextern mbed_stats_socket_t udp_stats[MBED_CONF_NSAPI_SOCKET_STATS_MAX_COUNT];\nint fetch_stats(void);\n#endif\n\n/**\n * Single testcase might take only half of the remaining execution time\n */\nint split2half_rmng_udp_test_time(); // [s]\n\nnamespace udp_global {\n#ifdef MBED_GREENTEA_TEST_UDPSOCKET_TIMEOUT_S\nstatic const int TESTS_TIMEOUT = MBED_GREENTEA_TEST_UDPSOCKET_TIMEOUT_S;\n#else\n#define MESH 3\n#define WISUN 0x2345\n#if MBED_CONF_TARGET_NETWORK_DEFAULT_INTERFACE_TYPE == MESH && MBED_CONF_NSAPI_DEFAULT_MESH_TYPE == WISUN\nstatic const int TESTS_TIMEOUT = (25 * 60);\n#else\nstatic const int TESTS_TIMEOUT = (20 * 60);\n#endif\n#endif\n\nstatic const int MAX_SEND_SIZE_IPV4 = 536;\nstatic const int MAX_SEND_SIZE_IPV6 = 1220;\n}\n\n/*\n * Test cases\n */\nvoid UDPSOCKET_ECHOTEST();\nvoid UDPSOCKET_ECHOTEST_CONNECT_SEND_RECV();\nvoid UDPSOCKET_ECHOTEST_NONBLOCK();\nvoid UDPSOCKET_ECHOTEST_NONBLOCK_CONNECT_SEND_RECV();\nvoid UDPSOCKET_ECHOTEST_BURST();\nvoid UDPSOCKET_ECHOTEST_BURST_NONBLOCK();\nvoid UDPSOCKET_OPEN_CLOSE_REPEAT();\nvoid UDPSOCKET_OPEN_DESTRUCT();\nvoid UDPSOCKET_OPEN_LIMIT();\nvoid UDPSOCKET_OPEN_TWICE();\nvoid UDPSOCKET_BIND_PORT();\nvoid UDPSOCKET_BIND_PORT_FAIL();\nvoid UDPSOCKET_BIND_ADDRESS_PORT();\nvoid UDPSOCKET_BIND_ADDRESS_NULL();\nvoid UDPSOCKET_BIND_ADDRESS_INVALID();\nvoid UDPSOCKET_BIND_ADDRESS();\nvoid UDPSOCKET_BIND_WRONG_TYPE();\nvoid UDPSOCKET_BIND_UNOPENED();\nvoid UDPSOCKET_RECV_TIMEOUT();\nvoid UDPSOCKET_SENDTO_INVALID();\nvoid UDPSOCKET_SENDTO_REPEAT();\nvoid UDPSOCKET_SENDTO_TIMEOUT();\n\n#endif //UDP_TESTS_H\n"},"meta":{"kind":"string","value":"{\n \"content_hash\": \"c2d62691143d9661ddbb56f81adcf2f0\",\n \"timestamp\": \"\",\n \"source\": \"github\",\n \"line_count\": 70,\n \"max_line_length\": 105,\n \"avg_line_length\": 27.614285714285714,\n \"alnum_prop\": 0.7537506466632178,\n \"repo_name\": \"andcor02/mbed-os\",\n \"id\": \"ed5bba5821d55df5c5b5a544f426b28352ac4747\",\n \"size\": \"2588\",\n \"binary\": false,\n \"copies\": \"4\",\n \"ref\": \"refs/heads/master\",\n \"path\": \"TESTS/netsocket/udp/udp_tests.h\",\n \"mode\": \"33188\",\n \"license\": \"apache-2.0\",\n \"language\": [\n {\n \"name\": \"Assembly\",\n \"bytes\": \"6601399\"\n },\n {\n \"name\": \"Batchfile\",\n \"bytes\": \"22\"\n },\n {\n \"name\": \"C\",\n \"bytes\": \"295194591\"\n },\n {\n \"name\": \"C++\",\n \"bytes\": \"9038670\"\n },\n {\n \"name\": \"CMake\",\n \"bytes\": \"5285\"\n },\n {\n \"name\": \"HTML\",\n \"bytes\": \"2063156\"\n },\n {\n \"name\": \"Makefile\",\n \"bytes\": \"103497\"\n },\n {\n \"name\": \"Objective-C\",\n \"bytes\": \"460244\"\n },\n {\n \"name\": \"Perl\",\n \"bytes\": \"2589\"\n },\n {\n \"name\": \"Python\",\n \"bytes\": \"38809\"\n },\n {\n \"name\": \"Shell\",\n \"bytes\": \"16862\"\n },\n {\n \"name\": \"XSLT\",\n \"bytes\": \"5596\"\n }\n ],\n \"symlink_target\": \"\"\n}"}}},{"rowIdx":303,"cells":{"text":{"kind":"string","value":"define(['jquery', 'findTableName'], function($, findTableName) {\n //找到当前选中的table,返回tablename\n function convert2table() {\n var tablename;\n var leftitemsname = $(\".clear-backend\").children(\"input.focused\").next().text();\n tablename = findTableName(leftitemsname);\n return tablename;\n }\n return convert2table;\n});"},"meta":{"kind":"string","value":"{\n \"content_hash\": \"77270f5b8ea25945bc0fe6c622d94c7b\",\n \"timestamp\": \"\",\n \"source\": \"github\",\n \"line_count\": 10,\n \"max_line_length\": 88,\n \"avg_line_length\": 35,\n \"alnum_prop\": 0.6485714285714286,\n \"repo_name\": \"xiangsongtao/jikexueyuan_Homework\",\n \"id\": \"5bb57557fe43b24e3ae0cde376a80ad20ca6f77d\",\n \"size\": \"370\",\n \"binary\": false,\n \"copies\": \"3\",\n \"ref\": \"refs/heads/master\",\n \"path\": \"Lesson9-NodeJS_MySQL/1.开发手机版本的百度新闻_NodeJS/public/BgManager/js/basic/convert2table.js\",\n \"mode\": \"33188\",\n \"license\": \"mit\",\n \"language\": [\n {\n \"name\": \"ApacheConf\",\n \"bytes\": \"203\"\n },\n {\n \"name\": \"CSS\",\n \"bytes\": \"973622\"\n },\n {\n \"name\": \"HTML\",\n \"bytes\": \"566268\"\n },\n {\n \"name\": \"JavaScript\",\n \"bytes\": \"508441\"\n },\n {\n \"name\": \"PHP\",\n \"bytes\": \"1245127\"\n },\n {\n \"name\": \"Ruby\",\n \"bytes\": \"901\"\n },\n {\n \"name\": \"Smarty\",\n \"bytes\": \"8471\"\n }\n ],\n \"symlink_target\": \"\"\n}"}}},{"rowIdx":304,"cells":{"text":{"kind":"string","value":"using System.Web;\nusing System.Web.Optimization;\n\nnamespace WebRoleSample\n{\n public class BundleConfig\n {\n // For more information on bundling, visit http://go.microsoft.com/fwlink/?LinkId=301862\n public static void RegisterBundles(BundleCollection bundles)\n {\n bundles.Add(new ScriptBundle(\"~/bundles/jquery\").Include(\n \"~/Scripts/jquery-{version}.js\"));\n\n bundles.Add(new ScriptBundle(\"~/bundles/jqueryval\").Include(\n \"~/Scripts/jquery.validate*\"));\n\n // Use the development version of Modernizr to develop with and learn from. Then, when you're\n // ready for production, use the build tool at http://modernizr.com to pick only the tests you need.\n bundles.Add(new ScriptBundle(\"~/bundles/modernizr\").Include(\n \"~/Scripts/modernizr-*\"));\n\n bundles.Add(new ScriptBundle(\"~/bundles/bootstrap\").Include(\n \"~/Scripts/bootstrap.js\",\n \"~/Scripts/respond.js\"));\n\n bundles.Add(new StyleBundle(\"~/Content/css\").Include(\n \"~/Content/bootstrap.css\",\n \"~/Content/site.css\"));\n }\n }\n}\n"},"meta":{"kind":"string","value":"{\n \"content_hash\": \"a92653e1aa6a8707e4d629e3e41b4f75\",\n \"timestamp\": \"\",\n \"source\": \"github\",\n \"line_count\": 31,\n \"max_line_length\": 112,\n \"avg_line_length\": 40.064516129032256,\n \"alnum_prop\": 0.5740740740740741,\n \"repo_name\": \"qinxgit/azure-ssl-configure\",\n \"id\": \"2be986231a27ddcc5e50e032b1926dfce5758c76\",\n \"size\": \"1244\",\n \"binary\": false,\n \"copies\": \"1\",\n \"ref\": \"refs/heads/master\",\n \"path\": \"AzureCloudServiceSample/WebRoleSample/App_Start/BundleConfig.cs\",\n \"mode\": \"33188\",\n \"license\": \"mit\",\n \"language\": [\n {\n \"name\": \"ASP\",\n \"bytes\": \"104\"\n },\n {\n \"name\": \"Batchfile\",\n \"bytes\": \"487\"\n },\n {\n \"name\": \"C#\",\n \"bytes\": \"9327\"\n },\n {\n \"name\": \"CSS\",\n \"bytes\": \"513\"\n },\n {\n \"name\": \"HTML\",\n \"bytes\": \"5127\"\n },\n {\n \"name\": \"JavaScript\",\n \"bytes\": \"21032\"\n },\n {\n \"name\": \"PowerShell\",\n \"bytes\": \"19579\"\n }\n ],\n \"symlink_target\": \"\"\n}"}}},{"rowIdx":305,"cells":{"text":{"kind":"string","value":"beConstructedWith($suite, 10, Example::FAILED);\n }\n\n function it_is_an_event()\n {\n $this->shouldBeAnInstanceOf('Symfony\\Component\\EventDispatcher\\Event');\n $this->shouldBeAnInstanceOf('PhpSpec\\Event\\PhpSpecEvent');\n }\n\n function it_provides_a_link_to_suite($suite)\n {\n $this->getSuite()->shouldReturn($suite);\n }\n\n function it_provides_a_link_to_time()\n {\n $this->getTime()->shouldReturn(10);\n }\n\n function it_provides_a_link_to_result()\n {\n $this->getResult()->shouldReturn(Example::FAILED);\n }\n\n function it_defaults_to_saying_suite_is_not_worth_rerunning()\n {\n $this->isWorthRerunning()->shouldReturn(false);\n }\n\n function it_can_be_told_that_the_suite_is_worth_rerunning()\n {\n $this->markAsWorthRerunning();\n $this->isWorthRerunning()->shouldReturn(true);\n }\n\n function it_can_be_told_that_the_suite_is_no_longer_worth_rerunning()\n {\n $this->markAsWorthRerunning();\n $this->markAsNotWorthRerunning();\n\n $this->isWorthRerunning()->shouldReturn(false);\n }\n}\n"},"meta":{"kind":"string","value":"{\n \"content_hash\": \"ea06e3148bbe4003a7d5ef81039aa471\",\n \"timestamp\": \"\",\n \"source\": \"github\",\n \"line_count\": 56,\n \"max_line_length\": 79,\n \"avg_line_length\": 23.892857142857142,\n \"alnum_prop\": 0.6442451420029895,\n \"repo_name\": \"Harrisonbro/phpspec\",\n \"id\": \"87c13c345cb0c0289977ea32ee7eec1a5882503b\",\n \"size\": \"1338\",\n \"binary\": false,\n \"copies\": \"4\",\n \"ref\": \"refs/heads/master\",\n \"path\": \"spec/PhpSpec/Event/SuiteEventSpec.php\",\n \"mode\": \"33188\",\n \"license\": \"mit\",\n \"language\": [\n {\n \"name\": \"Cucumber\",\n \"bytes\": \"153687\"\n },\n {\n \"name\": \"HTML\",\n \"bytes\": \"6057\"\n },\n {\n \"name\": \"Makefile\",\n \"bytes\": \"412\"\n },\n {\n \"name\": \"PHP\",\n \"bytes\": \"841614\"\n },\n {\n \"name\": \"Smarty\",\n \"bytes\": \"762\"\n }\n ],\n \"symlink_target\": \"\"\n}"}}},{"rowIdx":306,"cells":{"text":{"kind":"string","value":"\n\n\nbuffered_write_stream::async_write_some\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n
\"BoostHomeLibrariesPeopleFAQMore
\n
\n
\n\"Prev\"\"Up\"\"Home\"\"Next\"\n
\n
\n\n

\n \nStart\n an asynchronous write. The data being written must be valid for the lifetime\n of the asynchronous operation.\n

\n
template<\n    typename ConstBufferSequence,\n    typename WriteHandler>\nDEDUCED async_write_some(\n    const ConstBufferSequence & buffers,\n    WriteHandler && handler);\n
\n
\n\n\n\n
Copyright © 2003-2018 Christopher M. Kohlhoff

\n Distributed under the Boost Software License, Version 1.0. (See accompanying\n file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)\n

\n
\n
\n
\n\"Prev\"\"Up\"\"Home\"\"Next\"\n
\n\n\n"},"meta":{"kind":"string","value":"{\n \"content_hash\": \"4641ea85a8cec090a0fb046c34ebed79\",\n \"timestamp\": \"\",\n \"source\": \"github\",\n \"line_count\": 56,\n \"max_line_length\": 455,\n \"avg_line_length\": 70.33928571428571,\n \"alnum_prop\": 0.6567656765676567,\n \"repo_name\": \"c72578/poedit\",\n \"id\": \"d215da695755c80bb0112a4a5dbdfc1da7097ca5\",\n \"size\": \"3939\",\n \"binary\": false,\n \"copies\": \"5\",\n \"ref\": \"refs/heads/master\",\n \"path\": \"deps/boost/doc/html/boost_asio/reference/buffered_write_stream/async_write_some.html\",\n \"mode\": \"33188\",\n \"license\": \"mit\",\n \"language\": [\n {\n \"name\": \"C\",\n \"bytes\": \"23633\"\n },\n {\n \"name\": \"C++\",\n \"bytes\": \"1088488\"\n },\n {\n \"name\": \"Inno Setup\",\n \"bytes\": \"11765\"\n },\n {\n \"name\": \"M4\",\n \"bytes\": \"104132\"\n },\n {\n \"name\": \"Makefile\",\n \"bytes\": \"9152\"\n },\n {\n \"name\": \"Objective-C\",\n \"bytes\": \"26402\"\n },\n {\n \"name\": \"Objective-C++\",\n \"bytes\": \"13730\"\n },\n {\n \"name\": \"Python\",\n \"bytes\": \"3081\"\n },\n {\n \"name\": \"Ruby\",\n \"bytes\": \"261\"\n },\n {\n \"name\": \"Shell\",\n \"bytes\": \"10717\"\n },\n {\n \"name\": \"sed\",\n \"bytes\": \"557\"\n }\n ],\n \"symlink_target\": \"\"\n}"}}},{"rowIdx":307,"cells":{"text":{"kind":"string","value":"layout: page\ntitle: Shadow Music Award Ceremony\ndate: 2016-05-24\nauthor: Lori Barnes\ntags: weekly links, java\nstatus: published\nsummary: Sed eu risus tellus. Proin.\nbanner: images/banner/meeting-01.jpg\nbooking:\n startDate: 01/10/2019\n endDate: 01/13/2019\n ctyhocn: YQGCNHX\n groupCode: SMAC\npublished: true\n---\nFusce in rutrum libero. Donec rutrum sem sit amet pharetra hendrerit. In hac habitasse platea dictumst. Integer eget neque dapibus magna venenatis maximus at at enim. Sed non fringilla metus. Nullam luctus ultricies tortor scelerisque molestie. Pellentesque ut vulputate arcu, sed iaculis erat. Donec congue ut nunc a elementum. Etiam dictum augue eu sem ullamcorper finibus. Vestibulum laoreet nibh vitae nunc elementum dapibus. Nulla eget tortor id risus fringilla molestie ut ac mauris. Quisque tortor est, ultricies non mi a, accumsan maximus ligula. Pellentesque auctor consequat efficitur.\n\n* Aliquam vitae eros ac libero suscipit scelerisque.\n\nNunc rutrum mattis neque id commodo. Duis sed augue a sem semper lobortis sit amet nec justo. Maecenas eu tristique nibh. Sed id mauris aliquam dui fermentum malesuada vitae a est. Maecenas sed aliquam lorem, vel commodo sapien. In gravida vehicula quam vel viverra. Curabitur rhoncus quam a diam ullamcorper, at fermentum orci mattis. Curabitur sit amet consequat nisi. Fusce elementum dui nisl, sit amet dapibus nunc commodo eu. Aliquam at tristique est. Nulla elementum ligula a sem sagittis, ac tempus ipsum cursus. In in tortor arcu.\nInteger at leo risus. Sed convallis sapien augue, id finibus ligula viverra nec. Ut lacus tortor, aliquet non aliquam eu, accumsan eget diam. Nulla consequat bibendum odio, vel pretium felis vulputate nec. Fusce pulvinar gravida libero in accumsan. Vivamus consequat vehicula ipsum, vitae tempus purus fringilla ut. Mauris sem odio, cursus lobortis erat sed, mollis efficitur nisl. In porttitor lectus quis pretium sollicitudin. Pellentesque sed maximus nisl. Maecenas maximus consequat interdum. Sed efficitur augue nunc. Praesent justo ipsum, finibus in tincidunt a, facilisis nec justo.\n"},"meta":{"kind":"string","value":"{\n \"content_hash\": \"74be392cdbc636831e2f3518a01bc818\",\n \"timestamp\": \"\",\n \"source\": \"github\",\n \"line_count\": 21,\n \"max_line_length\": 595,\n \"avg_line_length\": 99.71428571428571,\n \"alnum_prop\": 0.8089780324737345,\n \"repo_name\": \"KlishGroup/prose-pogs\",\n \"id\": \"4bb092e5af4dfe4859889a3e59774f5877c5b64d\",\n \"size\": \"2098\",\n \"binary\": false,\n \"copies\": \"1\",\n \"ref\": \"refs/heads/gh-pages\",\n \"path\": \"pogs/Y/YQGCNHX/SMAC/index.md\",\n \"mode\": \"33188\",\n \"license\": \"mit\",\n \"language\": [],\n \"symlink_target\": \"\"\n}"}}},{"rowIdx":308,"cells":{"text":{"kind":"string","value":"\n\npackage util\n\nimport (\n\t\"bytes\"\n\t\"encoding/json\"\n\t\"errors\"\n\t\"fmt\"\n\t\"io\"\n\t\"io/ioutil\"\n\t\"net/url\"\n\t\"os\"\n\t\"strings\"\n\t\"time\"\n\n\t\"k8s.io/kubernetes/pkg/api\"\n\tkerrors \"k8s.io/kubernetes/pkg/api/errors\"\n\t\"k8s.io/kubernetes/pkg/api/meta\"\n\t\"k8s.io/kubernetes/pkg/api/unversioned\"\n\t\"k8s.io/kubernetes/pkg/apimachinery/registered\"\n\t\"k8s.io/kubernetes/pkg/apis/extensions\"\n\t\"k8s.io/kubernetes/pkg/client/unversioned/clientcmd\"\n\t\"k8s.io/kubernetes/pkg/kubectl\"\n\t\"k8s.io/kubernetes/pkg/kubectl/resource\"\n\t\"k8s.io/kubernetes/pkg/runtime\"\n\tutilerrors \"k8s.io/kubernetes/pkg/util/errors\"\n\tutilexec \"k8s.io/kubernetes/pkg/util/exec\"\n\t\"k8s.io/kubernetes/pkg/util/sets\"\n\t\"k8s.io/kubernetes/pkg/util/strategicpatch\"\n\n\tjsonpatch \"github.com/evanphx/json-patch\"\n\t\"github.com/golang/glog\"\n\t\"github.com/spf13/cobra\"\n)\n\nconst (\n\tApplyAnnotationsFlag = \"save-config\"\n\tDefaultErrorExitCode = 1\n)\n\ntype debugError interface {\n\tDebugError() (msg string, args []interface{})\n}\n\n// AddSourceToErr adds handleResourcePrefix and source string to error message.\n// verb is the string like \"creating\", \"deleting\" etc.\n// source is the filename or URL to the template file(*.json or *.yaml), or stdin to use to handle the resource.\nfunc AddSourceToErr(verb string, source string, err error) error {\n\tif source != \"\" {\n\t\tif statusError, ok := err.(kerrors.APIStatus); ok {\n\t\t\tstatus := statusError.Status()\n\t\t\tstatus.Message = fmt.Sprintf(\"error when %s %q: %v\", verb, source, status.Message)\n\t\t\treturn &kerrors.StatusError{ErrStatus: status}\n\t\t}\n\t\treturn fmt.Errorf(\"error when %s %q: %v\", verb, source, err)\n\t}\n\treturn err\n}\n\nvar fatalErrHandler = fatal\n\n// BehaviorOnFatal allows you to override the default behavior when a fatal\n// error occurs, which is to call os.Exit(code). You can pass 'panic' as a function\n// here if you prefer the panic() over os.Exit(1).\nfunc BehaviorOnFatal(f func(string, int)) {\n\tfatalErrHandler = f\n}\n\n// DefaultBehaviorOnFatal allows you to undo any previous override. Useful in\n// tests.\nfunc DefaultBehaviorOnFatal() {\n\tfatalErrHandler = fatal\n}\n\n// fatal prints the message (if provided) and then exits. If V(2) or greater,\n// glog.Fatal is invoked for extended information.\nfunc fatal(msg string, code int) {\n\tif glog.V(2) {\n\t\tglog.FatalDepth(2, msg)\n\t}\n\tif len(msg) > 0 {\n\t\t// add newline if needed\n\t\tif !strings.HasSuffix(msg, \"\\n\") {\n\t\t\tmsg += \"\\n\"\n\t\t}\n\t\tfmt.Fprint(os.Stderr, msg)\n\t}\n\tos.Exit(code)\n}\n\n// ErrExit may be passed to CheckError to instruct it to output nothing but exit with\n// status code 1.\nvar ErrExit = fmt.Errorf(\"exit\")\n\n// CheckErr prints a user friendly error to STDERR and exits with a non-zero\n// exit code. Unrecognized errors will be printed with an \"error: \" prefix.\n//\n// This method is generic to the command in use and may be used by non-Kubectl\n// commands.\nfunc CheckErr(err error) {\n\tcheckErr(\"\", err, fatalErrHandler)\n}\n\n// checkErrWithPrefix works like CheckErr, but adds a caller-defined prefix to non-nil errors\nfunc checkErrWithPrefix(prefix string, err error) {\n\tcheckErr(prefix, err, fatalErrHandler)\n}\n\n// checkErr formats a given error as a string and calls the passed handleErr\n// func with that string and an kubectl exit code.\nfunc checkErr(prefix string, err error, handleErr func(string, int)) {\n\t// unwrap aggregates of 1\n\tif agg, ok := err.(utilerrors.Aggregate); ok && len(agg.Errors()) == 1 {\n\t\terr = agg.Errors()[0]\n\t}\n\n\tswitch {\n\tcase err == nil:\n\t\treturn\n\tcase err == ErrExit:\n\t\thandleErr(\"\", DefaultErrorExitCode)\n\t\treturn\n\tcase kerrors.IsInvalid(err):\n\t\tdetails := err.(*kerrors.StatusError).Status().Details\n\t\ts := fmt.Sprintf(\"%sThe %s %q is invalid\", prefix, details.Kind, details.Name)\n\t\tif len(details.Causes) > 0 {\n\t\t\terrs := statusCausesToAggrError(details.Causes)\n\t\t\thandleErr(MultilineError(s+\": \", errs), DefaultErrorExitCode)\n\t\t} else {\n\t\t\thandleErr(s, DefaultErrorExitCode)\n\t\t}\n\tcase clientcmd.IsConfigurationInvalid(err):\n\t\thandleErr(MultilineError(fmt.Sprintf(\"%sError in configuration: \", prefix), err), DefaultErrorExitCode)\n\tdefault:\n\t\tswitch err := err.(type) {\n\t\tcase *meta.NoResourceMatchError:\n\t\t\tswitch {\n\t\t\tcase len(err.PartialResource.Group) > 0 && len(err.PartialResource.Version) > 0:\n\t\t\t\thandleErr(fmt.Sprintf(\"%sthe server doesn't have a resource type %q in group %q and version %q\", prefix, err.PartialResource.Resource, err.PartialResource.Group, err.PartialResource.Version), DefaultErrorExitCode)\n\t\t\tcase len(err.PartialResource.Group) > 0:\n\t\t\t\thandleErr(fmt.Sprintf(\"%sthe server doesn't have a resource type %q in group %q\", prefix, err.PartialResource.Resource, err.PartialResource.Group), DefaultErrorExitCode)\n\t\t\tcase len(err.PartialResource.Version) > 0:\n\t\t\t\thandleErr(fmt.Sprintf(\"%sthe server doesn't have a resource type %q in version %q\", prefix, err.PartialResource.Resource, err.PartialResource.Version), DefaultErrorExitCode)\n\t\t\tdefault:\n\t\t\t\thandleErr(fmt.Sprintf(\"%sthe server doesn't have a resource type %q\", prefix, err.PartialResource.Resource), DefaultErrorExitCode)\n\t\t\t}\n\t\tcase utilerrors.Aggregate:\n\t\t\thandleErr(MultipleErrors(prefix, err.Errors()), DefaultErrorExitCode)\n\t\tcase utilexec.ExitError:\n\t\t\t// do not print anything, only terminate with given error\n\t\t\thandleErr(\"\", err.ExitStatus())\n\t\tdefault: // for any other error type\n\t\t\tmsg, ok := StandardErrorMessage(err)\n\t\t\tif !ok {\n\t\t\t\tmsg = err.Error()\n\t\t\t\tif !strings.HasPrefix(msg, \"error: \") {\n\t\t\t\t\tmsg = fmt.Sprintf(\"error: %s\", msg)\n\t\t\t\t}\n\t\t\t}\n\t\t\thandleErr(msg, DefaultErrorExitCode)\n\t\t}\n\t}\n}\n\nfunc statusCausesToAggrError(scs []unversioned.StatusCause) utilerrors.Aggregate {\n\terrs := make([]error, 0, len(scs))\n\terrorMsgs := sets.NewString()\n\tfor _, sc := range scs {\n\t\t// check for duplicate error messages and skip them\n\t\tmsg := fmt.Sprintf(\"%s: %s\", sc.Field, sc.Message)\n\t\tif errorMsgs.Has(msg) {\n\t\t\tcontinue\n\t\t}\n\t\terrorMsgs.Insert(msg)\n\t\terrs = append(errs, errors.New(msg))\n\t}\n\treturn utilerrors.NewAggregate(errs)\n}\n\n// StandardErrorMessage translates common errors into a human readable message, or returns\n// false if the error is not one of the recognized types. It may also log extended\n// information to glog.\n//\n// This method is generic to the command in use and may be used by non-Kubectl\n// commands.\nfunc StandardErrorMessage(err error) (string, bool) {\n\tif debugErr, ok := err.(debugError); ok {\n\t\tglog.V(4).Infof(debugErr.DebugError())\n\t}\n\tstatus, isStatus := err.(kerrors.APIStatus)\n\tswitch {\n\tcase isStatus:\n\t\tswitch s := status.Status(); {\n\t\tcase s.Reason == unversioned.StatusReasonUnauthorized:\n\t\t\treturn fmt.Sprintf(\"error: You must be logged in to the server (%s)\", s.Message), true\n\t\tcase len(s.Reason) > 0:\n\t\t\treturn fmt.Sprintf(\"Error from server (%s): %s\", s.Reason, err.Error()), true\n\t\tdefault:\n\t\t\treturn fmt.Sprintf(\"Error from server: %s\", err.Error()), true\n\t\t}\n\tcase kerrors.IsUnexpectedObjectError(err):\n\t\treturn fmt.Sprintf(\"Server returned an unexpected response: %s\", err.Error()), true\n\t}\n\tswitch t := err.(type) {\n\tcase *url.Error:\n\t\tglog.V(4).Infof(\"Connection error: %s %s: %v\", t.Op, t.URL, t.Err)\n\t\tswitch {\n\t\tcase strings.Contains(t.Err.Error(), \"connection refused\"):\n\t\t\thost := t.URL\n\t\t\tif server, err := url.Parse(t.URL); err == nil {\n\t\t\t\thost = server.Host\n\t\t\t}\n\t\t\treturn fmt.Sprintf(\"The connection to the server %s was refused - did you specify the right host or port?\", host), true\n\t\t}\n\t\treturn fmt.Sprintf(\"Unable to connect to the server: %v\", t.Err), true\n\t}\n\treturn \"\", false\n}\n\n// MultilineError returns a string representing an error that splits sub errors into their own\n// lines. The returned string will end with a newline.\nfunc MultilineError(prefix string, err error) string {\n\tif agg, ok := err.(utilerrors.Aggregate); ok {\n\t\terrs := utilerrors.Flatten(agg).Errors()\n\t\tbuf := &bytes.Buffer{}\n\t\tswitch len(errs) {\n\t\tcase 0:\n\t\t\treturn fmt.Sprintf(\"%s%v\\n\", prefix, err)\n\t\tcase 1:\n\t\t\treturn fmt.Sprintf(\"%s%v\\n\", prefix, messageForError(errs[0]))\n\t\tdefault:\n\t\t\tfmt.Fprintln(buf, prefix)\n\t\t\tfor _, err := range errs {\n\t\t\t\tfmt.Fprintf(buf, \"* %v\\n\", messageForError(err))\n\t\t\t}\n\t\t\treturn buf.String()\n\t\t}\n\t}\n\treturn fmt.Sprintf(\"%s%s\\n\", prefix, err)\n}\n\n// PrintErrorWithCauses prints an error's kind, name, and each of the error's causes in a new line.\n// The returned string will end with a newline.\n// Returns true if a case exists to handle the error type, or false otherwise.\nfunc PrintErrorWithCauses(err error, errOut io.Writer) bool {\n\tswitch t := err.(type) {\n\tcase *kerrors.StatusError:\n\t\terrorDetails := t.Status().Details\n\t\tif errorDetails != nil {\n\t\t\tfmt.Fprintf(errOut, \"error: %s %q is invalid\\n\\n\", errorDetails.Kind, errorDetails.Name)\n\t\t\tfor _, cause := range errorDetails.Causes {\n\t\t\t\tfmt.Fprintf(errOut, \"* %s: %s\\n\", cause.Field, cause.Message)\n\t\t\t}\n\t\t\treturn true\n\t\t}\n\t}\n\n\tfmt.Fprintf(errOut, \"error: %v\\n\", err)\n\treturn false\n}\n\n// MultipleErrors returns a newline delimited string containing\n// the prefix and referenced errors in standard form.\nfunc MultipleErrors(prefix string, errs []error) string {\n\tbuf := &bytes.Buffer{}\n\tfor _, err := range errs {\n\t\tfmt.Fprintf(buf, \"%s%v\\n\", prefix, messageForError(err))\n\t}\n\treturn buf.String()\n}\n\n// messageForError returns the string representing the error.\nfunc messageForError(err error) string {\n\tmsg, ok := StandardErrorMessage(err)\n\tif !ok {\n\t\tmsg = err.Error()\n\t}\n\treturn msg\n}\n\nfunc UsageError(cmd *cobra.Command, format string, args ...interface{}) error {\n\tmsg := fmt.Sprintf(format, args...)\n\treturn fmt.Errorf(\"%s\\nSee '%s -h' for help and examples.\", msg, cmd.CommandPath())\n}\n\nfunc IsFilenameEmpty(filenames []string) bool {\n\tif len(filenames) == 0 {\n\t\treturn true\n\t}\n\treturn false\n}\n\n// Whether this cmd need watching objects.\nfunc isWatch(cmd *cobra.Command) bool {\n\tif w, err := cmd.Flags().GetBool(\"watch\"); w && err == nil {\n\t\treturn true\n\t}\n\n\tif wo, err := cmd.Flags().GetBool(\"watch-only\"); wo && err == nil {\n\t\treturn true\n\t}\n\n\treturn false\n}\n\nfunc GetFlagString(cmd *cobra.Command, flag string) string {\n\ts, err := cmd.Flags().GetString(flag)\n\tif err != nil {\n\t\tglog.Fatalf(\"error accessing flag %s for command %s: %v\", flag, cmd.Name(), err)\n\t}\n\treturn s\n}\n\n// GetFlagStringSlice can be used to accept multiple argument with flag repetition (e.g. -f arg1,arg2 -f arg3 ...)\nfunc GetFlagStringSlice(cmd *cobra.Command, flag string) []string {\n\ts, err := cmd.Flags().GetStringSlice(flag)\n\tif err != nil {\n\t\tglog.Fatalf(\"error accessing flag %s for command %s: %v\", flag, cmd.Name(), err)\n\t}\n\treturn s\n}\n\n// GetFlagStringArray can be used to accept multiple argument with flag repetition (e.g. -f arg1 -f arg2 ...)\nfunc GetFlagStringArray(cmd *cobra.Command, flag string) []string {\n\ts, err := cmd.Flags().GetStringArray(flag)\n\tif err != nil {\n\t\tglog.Fatalf(\"err accessing flag %s for command %s: %v\", flag, cmd.Name(), err)\n\t}\n\treturn s\n}\n\n// GetWideFlag is used to determine if \"-o wide\" is used\nfunc GetWideFlag(cmd *cobra.Command) bool {\n\tf := cmd.Flags().Lookup(\"output\")\n\tif f.Value.String() == \"wide\" {\n\t\treturn true\n\t}\n\treturn false\n}\n\nfunc GetFlagBool(cmd *cobra.Command, flag string) bool {\n\tb, err := cmd.Flags().GetBool(flag)\n\tif err != nil {\n\t\tglog.Fatalf(\"error accessing flag %s for command %s: %v\", flag, cmd.Name(), err)\n\t}\n\treturn b\n}\n\n// Assumes the flag has a default value.\nfunc GetFlagInt(cmd *cobra.Command, flag string) int {\n\ti, err := cmd.Flags().GetInt(flag)\n\tif err != nil {\n\t\tglog.Fatalf(\"error accessing flag %s for command %s: %v\", flag, cmd.Name(), err)\n\t}\n\treturn i\n}\n\n// Assumes the flag has a default value.\nfunc GetFlagInt64(cmd *cobra.Command, flag string) int64 {\n\ti, err := cmd.Flags().GetInt64(flag)\n\tif err != nil {\n\t\tglog.Fatalf(\"error accessing flag %s for command %s: %v\", flag, cmd.Name(), err)\n\t}\n\treturn i\n}\n\nfunc GetFlagDuration(cmd *cobra.Command, flag string) time.Duration {\n\td, err := cmd.Flags().GetDuration(flag)\n\tif err != nil {\n\t\tglog.Fatalf(\"error accessing flag %s for command %s: %v\", flag, cmd.Name(), err)\n\t}\n\treturn d\n}\n\nfunc AddValidateFlags(cmd *cobra.Command) {\n\tcmd.Flags().Bool(\"validate\", true, \"If true, use a schema to validate the input before sending it\")\n\tcmd.Flags().String(\"schema-cache-dir\", fmt.Sprintf(\"~/%s/%s\", clientcmd.RecommendedHomeDir, clientcmd.RecommendedSchemaName), fmt.Sprintf(\"If non-empty, load/store cached API schemas in this directory, default is '$HOME/%s/%s'\", clientcmd.RecommendedHomeDir, clientcmd.RecommendedSchemaName))\n\tcmd.MarkFlagFilename(\"schema-cache-dir\")\n}\n\nfunc AddFilenameOptionFlags(cmd *cobra.Command, options *resource.FilenameOptions, usage string) {\n\tkubectl.AddJsonFilenameFlag(cmd, &options.Filenames, \"Filename, directory, or URL to files \"+usage)\n\tcmd.Flags().BoolVarP(&options.Recursive, \"recursive\", \"R\", options.Recursive, \"Process the directory used in -f, --filename recursively. Useful when you want to manage related manifests organized within the same directory.\")\n}\n\n// AddDryRunFlag adds dry-run flag to a command. Usually used by mutations.\nfunc AddDryRunFlag(cmd *cobra.Command) {\n\tcmd.Flags().Bool(\"dry-run\", false, \"If true, only print the object that would be sent, without sending it.\")\n}\n\nfunc AddApplyAnnotationFlags(cmd *cobra.Command) {\n\tcmd.Flags().Bool(ApplyAnnotationsFlag, false, \"If true, the configuration of current object will be saved in its annotation. This is useful when you want to perform kubectl apply on this object in the future.\")\n}\n\n// AddGeneratorFlags adds flags common to resource generation commands\n// TODO: need to take a pass at other generator commands to use this set of flags\nfunc AddGeneratorFlags(cmd *cobra.Command, defaultGenerator string) {\n\tcmd.Flags().String(\"generator\", defaultGenerator, \"The name of the API generator to use.\")\n\tAddDryRunFlag(cmd)\n}\n\nfunc ReadConfigDataFromReader(reader io.Reader, source string) ([]byte, error) {\n\tdata, err := ioutil.ReadAll(reader)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif len(data) == 0 {\n\t\treturn nil, fmt.Errorf(\"Read from %s but no data found\", source)\n\t}\n\n\treturn data, nil\n}\n\n// Merge requires JSON serialization\n// TODO: merge assumes JSON serialization, and does not properly abstract API retrieval\nfunc Merge(codec runtime.Codec, dst runtime.Object, fragment, kind string) (runtime.Object, error) {\n\t// encode dst into versioned json and apply fragment directly too it\n\ttarget, err := runtime.Encode(codec, dst)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tpatched, err := jsonpatch.MergePatch(target, []byte(fragment))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tout, err := runtime.Decode(codec, patched)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn out, nil\n}\n\n// DumpReaderToFile writes all data from the given io.Reader to the specified file\n// (usually for temporary use).\nfunc DumpReaderToFile(reader io.Reader, filename string) error {\n\tf, err := os.OpenFile(filename, os.O_WRONLY|os.O_CREATE|os.O_TRUNC, 0600)\n\tdefer f.Close()\n\tif err != nil {\n\t\treturn err\n\t}\n\tbuffer := make([]byte, 1024)\n\tfor {\n\t\tcount, err := reader.Read(buffer)\n\t\tif err == io.EOF {\n\t\t\tbreak\n\t\t}\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\t_, err = f.Write(buffer[:count])\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}\n\n// UpdateObject updates resource object with updateFn\nfunc UpdateObject(info *resource.Info, codec runtime.Codec, updateFn func(runtime.Object) error) (runtime.Object, error) {\n\thelper := resource.NewHelper(info.Client, info.Mapping)\n\n\tif err := updateFn(info.Object); err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Update the annotation used by kubectl apply\n\tif err := kubectl.UpdateApplyAnnotation(info, codec); err != nil {\n\t\treturn nil, err\n\t}\n\n\tif _, err := helper.Replace(info.Namespace, info.Name, true, info.Object); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn info.Object, nil\n}\n\n// AddCmdRecordFlag adds --record flag to command\nfunc AddRecordFlag(cmd *cobra.Command) {\n\tcmd.Flags().Bool(\"record\", false, \"Record current kubectl command in the resource annotation. If set to false, do not record the command. If set to true, record the command. If not set, default to updating the existing annotation value only if one already exists.\")\n}\n\nfunc GetRecordFlag(cmd *cobra.Command) bool {\n\treturn GetFlagBool(cmd, \"record\")\n}\n\nfunc GetDryRunFlag(cmd *cobra.Command) bool {\n\treturn GetFlagBool(cmd, \"dry-run\")\n}\n\n// RecordChangeCause annotate change-cause to input runtime object.\nfunc RecordChangeCause(obj runtime.Object, changeCause string) error {\n\taccessor, err := meta.Accessor(obj)\n\tif err != nil {\n\t\treturn err\n\t}\n\tannotations := accessor.GetAnnotations()\n\tif annotations == nil {\n\t\tannotations = make(map[string]string)\n\t}\n\tannotations[kubectl.ChangeCauseAnnotation] = changeCause\n\taccessor.SetAnnotations(annotations)\n\treturn nil\n}\n\n// ChangeResourcePatch creates a strategic merge patch between the origin input resource info\n// and the annotated with change-cause input resource info.\nfunc ChangeResourcePatch(info *resource.Info, changeCause string) ([]byte, error) {\n\toldData, err := json.Marshal(info.Object)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif err := RecordChangeCause(info.Object, changeCause); err != nil {\n\t\treturn nil, err\n\t}\n\tnewData, err := json.Marshal(info.Object)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn strategicpatch.CreateTwoWayMergePatch(oldData, newData, info.Object)\n}\n\n// containsChangeCause checks if input resource info contains change-cause annotation.\nfunc ContainsChangeCause(info *resource.Info) bool {\n\tannotations, err := info.Mapping.MetadataAccessor.Annotations(info.Object)\n\tif err != nil {\n\t\treturn false\n\t}\n\treturn len(annotations[kubectl.ChangeCauseAnnotation]) > 0\n}\n\n// ShouldRecord checks if we should record current change cause\nfunc ShouldRecord(cmd *cobra.Command, info *resource.Info) bool {\n\treturn GetRecordFlag(cmd) || (ContainsChangeCause(info) && !cmd.Flags().Changed(\"record\"))\n}\n\nfunc AddInclude3rdPartyFlags(cmd *cobra.Command) {\n\tcmd.Flags().Bool(\"include-extended-apis\", true, \"If true, include definitions of new APIs via calls to the API server. [default true]\")\n\tcmd.Flags().MarkDeprecated(\"include-extended-apis\", \"No longer required.\")\n}\n\n// GetResourcesAndPairs retrieves resources and \"KEY=VALUE or KEY-\" pair args from given args\nfunc GetResourcesAndPairs(args []string, pairType string) (resources []string, pairArgs []string, err error) {\n\tfoundPair := false\n\tfor _, s := range args {\n\t\tnonResource := strings.Contains(s, \"=\") || strings.HasSuffix(s, \"-\")\n\t\tswitch {\n\t\tcase !foundPair && nonResource:\n\t\t\tfoundPair = true\n\t\t\tfallthrough\n\t\tcase foundPair && nonResource:\n\t\t\tpairArgs = append(pairArgs, s)\n\t\tcase !foundPair && !nonResource:\n\t\t\tresources = append(resources, s)\n\t\tcase foundPair && !nonResource:\n\t\t\terr = fmt.Errorf(\"all resources must be specified before %s changes: %s\", pairType, s)\n\t\t\treturn\n\t\t}\n\t}\n\treturn\n}\n\n// ParsePairs retrieves new and remove pairs (if supportRemove is true) from \"KEY=VALUE or KEY-\" pair args\nfunc ParsePairs(pairArgs []string, pairType string, supportRemove bool) (newPairs map[string]string, removePairs []string, err error) {\n\tnewPairs = map[string]string{}\n\tif supportRemove {\n\t\tremovePairs = []string{}\n\t}\n\tvar invalidBuf bytes.Buffer\n\n\tfor _, pairArg := range pairArgs {\n\t\tif strings.Index(pairArg, \"=\") != -1 {\n\t\t\tparts := strings.SplitN(pairArg, \"=\", 2)\n\t\t\tif len(parts) != 2 {\n\t\t\t\tif invalidBuf.Len() > 0 {\n\t\t\t\t\tinvalidBuf.WriteString(\", \")\n\t\t\t\t}\n\t\t\t\tinvalidBuf.WriteString(fmt.Sprintf(pairArg))\n\t\t\t} else {\n\t\t\t\tnewPairs[parts[0]] = parts[1]\n\t\t\t}\n\t\t} else if supportRemove && strings.HasSuffix(pairArg, \"-\") {\n\t\t\tremovePairs = append(removePairs, pairArg[:len(pairArg)-1])\n\t\t} else {\n\t\t\tif invalidBuf.Len() > 0 {\n\t\t\t\tinvalidBuf.WriteString(\", \")\n\t\t\t}\n\t\t\tinvalidBuf.WriteString(fmt.Sprintf(pairArg))\n\t\t}\n\t}\n\tif invalidBuf.Len() > 0 {\n\t\terr = fmt.Errorf(\"invalid %s format: %s\", pairType, invalidBuf.String())\n\t\treturn\n\t}\n\n\treturn\n}\n\n// MaybeConvertObject attempts to convert an object to a specific group/version. If the object is\n// a third party resource it is simply passed through.\nfunc MaybeConvertObject(obj runtime.Object, gv unversioned.GroupVersion, converter runtime.ObjectConvertor) (runtime.Object, error) {\n\tswitch obj.(type) {\n\tcase *extensions.ThirdPartyResourceData:\n\t\t// conversion is not supported for 3rd party objects\n\t\treturn obj, nil\n\tdefault:\n\t\treturn converter.ConvertToVersion(obj, gv)\n\t}\n}\n\n// MustPrintWithKinds determines if printer is dealing\n// with multiple resource kinds, in which case it will\n// return true, indicating resource kind will be\n// included as part of printer output\nfunc MustPrintWithKinds(objs []runtime.Object, infos []*resource.Info, sorter *kubectl.RuntimeSort, printAll bool) bool {\n\tvar lastMap *meta.RESTMapping\n\n\tif len(infos) == 1 && printAll {\n\t\treturn true\n\t}\n\n\tfor ix := range objs {\n\t\tvar mapping *meta.RESTMapping\n\t\tif sorter != nil {\n\t\t\tmapping = infos[sorter.OriginalPosition(ix)].Mapping\n\t\t} else {\n\t\t\tmapping = infos[ix].Mapping\n\t\t}\n\n\t\t// display \"kind\" only if we have mixed resources\n\t\tif lastMap != nil && mapping.Resource != lastMap.Resource {\n\t\t\treturn true\n\t\t}\n\t\tlastMap = mapping\n\t}\n\n\treturn false\n}\n\n// FilterResourceList receives a list of runtime objects.\n// If any objects are filtered, that number is returned along with a modified list.\nfunc FilterResourceList(obj runtime.Object, filterFuncs kubectl.Filters, filterOpts *kubectl.PrintOptions) (int, []runtime.Object, error) {\n\titems, err := meta.ExtractList(obj)\n\tif err != nil {\n\t\treturn 0, []runtime.Object{obj}, utilerrors.NewAggregate([]error{err})\n\t}\n\tif errs := runtime.DecodeList(items, api.Codecs.UniversalDecoder(), runtime.UnstructuredJSONScheme); len(errs) > 0 {\n\t\treturn 0, []runtime.Object{obj}, utilerrors.NewAggregate(errs)\n\t}\n\n\tfilterCount := 0\n\tlist := make([]runtime.Object, 0, len(items))\n\tfor _, obj := range items {\n\t\tif isFiltered, err := filterFuncs.Filter(obj, filterOpts); !isFiltered {\n\t\t\tif err != nil {\n\t\t\t\tglog.V(2).Infof(\"Unable to filter resource: %v\", err)\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tlist = append(list, obj)\n\t\t} else if isFiltered {\n\t\t\tfilterCount++\n\t\t}\n\t}\n\treturn filterCount, list, nil\n}\n\nfunc PrintFilterCount(hiddenObjNum int, resource string, options *kubectl.PrintOptions) {\n\tif !options.NoHeaders && !options.ShowAll && hiddenObjNum > 0 {\n\t\tglog.V(2).Infof(\" info: %d completed object(s) was(were) not shown in %s list. Pass --show-all to see all objects.\\n\\n\", hiddenObjNum, resource)\n\t}\n}\n\n// ObjectListToVersionedObject receives a list of api objects and a group version\n// and squashes the list's items into a single versioned runtime.Object.\nfunc ObjectListToVersionedObject(objects []runtime.Object, version unversioned.GroupVersion) (runtime.Object, error) {\n\tobjectList := &api.List{Items: objects}\n\tconverted, err := resource.TryConvert(api.Scheme, objectList, version, registered.GroupOrDie(api.GroupName).GroupVersion)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn converted, nil\n}\n\n// IsSiblingCommandExists receives a pointer to a cobra command and a target string.\n// Returns true if the target string is found in the list of sibling commands.\nfunc IsSiblingCommandExists(cmd *cobra.Command, targetCmdName string) bool {\n\tfor _, c := range cmd.Parent().Commands() {\n\t\tif c.Name() == targetCmdName {\n\t\t\treturn true\n\t\t}\n\t}\n\n\treturn false\n}\n\n// DefaultSubCommandRun prints a command's help string to the specified output if no\n// arguments (sub-commands) are provided, or a usage error otherwise.\nfunc DefaultSubCommandRun(out io.Writer) func(c *cobra.Command, args []string) {\n\treturn func(c *cobra.Command, args []string) {\n\t\tc.SetOutput(out)\n\t\tRequireNoArguments(c, args)\n\t\tc.Help()\n\t}\n}\n\n// RequireNoArguments exits with a usage error if extra arguments are provided.\nfunc RequireNoArguments(c *cobra.Command, args []string) {\n\tif len(args) > 0 {\n\t\tCheckErr(UsageError(c, fmt.Sprintf(`unknown command %q`, strings.Join(args, \" \"))))\n\t}\n}\n"},"meta":{"kind":"string","value":"{\n \"content_hash\": \"8b88dc2c97f83a70270702669835bfd4\",\n \"timestamp\": \"\",\n \"source\": \"github\",\n \"line_count\": 713,\n \"max_line_length\": 293,\n \"avg_line_length\": 33.23141654978962,\n \"alnum_prop\": 0.7127120790073437,\n \"repo_name\": \"f-higashi/dashboard\",\n \"id\": \"01e34a64edf14b360715032ff81b4d1d59e31e31\",\n \"size\": \"24263\",\n \"binary\": false,\n \"copies\": \"22\",\n \"ref\": \"refs/heads/master\",\n \"path\": \"vendor/k8s.io/kubernetes/pkg/kubectl/cmd/util/helpers.go\",\n \"mode\": \"33188\",\n \"license\": \"apache-2.0\",\n \"language\": [\n {\n \"name\": \"CSS\",\n \"bytes\": \"49847\"\n },\n {\n \"name\": \"Go\",\n \"bytes\": \"675631\"\n },\n {\n \"name\": \"HTML\",\n \"bytes\": \"346956\"\n },\n {\n \"name\": \"JavaScript\",\n \"bytes\": \"1237610\"\n },\n {\n \"name\": \"Shell\",\n \"bytes\": \"5736\"\n },\n {\n \"name\": \"XSLT\",\n \"bytes\": \"1119\"\n }\n ],\n \"symlink_target\": \"\"\n}"}}},{"rowIdx":309,"cells":{"text":{"kind":"string","value":"// Generated by CoffeeScript 1.7.1\n\n/*\n TouchController (stick + buttons) for touch devices\n Based on the touch demo by Seb Lee-Delisle \n \n @class bkcore.controllers.TouchController\n @author Thibaut 'BKcore' Despoulain \n */\n\n(function() {\n var TouchController, Vec2, exports, _base;\n\n TouchController = (function() {\n TouchController.isCompatible = function() {\n return 'ontouchstart' in document.documentElement;\n };\n\n\n /*\n Creates a new TouchController\n \n @param dom DOMElement The element that will listen to touch events\n @param stickMargin int The left margin in px for stick detection\n @param buttonCallback function Callback for non-stick touches\n */\n\n function TouchController(dom, stickMargin, buttonCallback) {\n this.dom = dom;\n this.stickMargin = stickMargin != null ? stickMargin : 200;\n this.buttonCallback = buttonCallback != null ? buttonCallback : null;\n this.active = true;\n this.touches = null;\n this.stickID = -1;\n this.stickPos = new Vec2(0, 0);\n this.stickStartPos = new Vec2(0, 0);\n this.stickVector = new Vec2(0, 0);\n this.dom.addEventListener('touchstart', ((function(_this) {\n return function(e) {\n return _this.touchStart(e);\n };\n })(this)), false);\n this.dom.addEventListener('touchmove', ((function(_this) {\n return function(e) {\n return _this.touchMove(e);\n };\n })(this)), false);\n this.dom.addEventListener('touchend', ((function(_this) {\n return function(e) {\n return _this.touchEnd(e);\n };\n })(this)), false);\n }\n\n\n /*\n @private\n */\n\n TouchController.prototype.touchStart = function(event) {\n var touch, _i, _len, _ref;\n if (!this.active) {\n return;\n }\n _ref = event.changedTouches;\n for (_i = 0, _len = _ref.length; _i < _len; _i++) {\n touch = _ref[_i];\n if (this.stickID < 0 && touch.clientX < this.stickMargin) {\n this.stickID = touch.identifier;\n this.stickStartPos.set(touch.clientX, touch.clientY);\n this.stickPos.copy(this.stickStartPos);\n this.stickVector.set(0, 0);\n continue;\n } else {\n if (typeof this.buttonCallback === \"function\") {\n this.buttonCallback(true, touch, event);\n }\n }\n }\n this.touches = event.touches;\n return false;\n };\n\n\n /*\n @private\n */\n\n TouchController.prototype.touchMove = function(event) {\n var touch, _i, _len, _ref;\n event.preventDefault();\n if (!this.active) {\n return;\n }\n _ref = event.changedTouches;\n for (_i = 0, _len = _ref.length; _i < _len; _i++) {\n touch = _ref[_i];\n if (this.stickID === touch.identifier && touch.clientX < this.stickMargin) {\n this.stickPos.set(touch.clientX, touch.clientY);\n this.stickVector.copy(this.stickPos).substract(this.stickStartPos);\n break;\n }\n }\n this.touches = event.touches;\n return false;\n };\n\n\n /*\n @private\n */\n\n TouchController.prototype.touchEnd = function(event) {\n var touch, _i, _len, _ref;\n if (!this.active) {\n return;\n }\n this.touches = event.touches;\n _ref = event.changedTouches;\n for (_i = 0, _len = _ref.length; _i < _len; _i++) {\n touch = _ref[_i];\n if (this.stickID === touch.identifier) {\n this.stickID = -1;\n this.stickVector.set(0, 0);\n break;\n } else {\n if (typeof this.buttonCallback === \"function\") {\n this.buttonCallback(false, touch, event);\n }\n }\n }\n return false;\n };\n\n return TouchController;\n\n })();\n\n\n /*\n Internal class used for vector2\n @class Vec2\n @private\n */\n\n Vec2 = (function() {\n function Vec2(x, y) {\n this.x = x != null ? x : 0;\n this.y = y != null ? y : 0;\n }\n\n Vec2.prototype.substract = function(vec) {\n this.x -= vec.x;\n this.y -= vec.y;\n return this;\n };\n\n Vec2.prototype.copy = function(vec) {\n this.x = vec.x;\n this.y = vec.y;\n return this;\n };\n\n Vec2.prototype.set = function(x, y) {\n this.x = x;\n this.y = y;\n return this;\n };\n\n return Vec2;\n\n })();\n\n\n /*\n Exports\n @package bkcore\n */\n\n exports = exports != null ? exports : this;\n\n exports.bkcore || (exports.bkcore = {});\n\n (_base = exports.bkcore).controllers || (_base.controllers = {});\n\n exports.bkcore.controllers.TouchController = TouchController;\n\n}).call(this);\n"},"meta":{"kind":"string","value":"{\n \"content_hash\": \"9dce981922eb5d780c4f49ba671faef6\",\n \"timestamp\": \"\",\n \"source\": \"github\",\n \"line_count\": 188,\n \"max_line_length\": 84,\n \"avg_line_length\": 24.81382978723404,\n \"alnum_prop\": 0.5562700964630225,\n \"repo_name\": \"BKcore/HexGL\",\n \"id\": \"d8e7f1578b0021d81663622645ebe7a410b0a2cb\",\n \"size\": \"4665\",\n \"binary\": false,\n \"copies\": \"9\",\n \"ref\": \"refs/heads/master\",\n \"path\": \"bkcore.coffee/controllers/TouchController.js\",\n \"mode\": \"33188\",\n \"license\": \"mit\",\n \"language\": [\n {\n \"name\": \"ApacheConf\",\n \"bytes\": \"191\"\n },\n {\n \"name\": \"CSS\",\n \"bytes\": \"12899\"\n },\n {\n \"name\": \"CoffeeScript\",\n \"bytes\": \"22802\"\n },\n {\n \"name\": \"HTML\",\n \"bytes\": \"49500\"\n },\n {\n \"name\": \"JavaScript\",\n \"bytes\": \"286735\"\n }\n ],\n \"symlink_target\": \"\"\n}"}}},{"rowIdx":310,"cells":{"text":{"kind":"string","value":"// Licensed to the .NET Foundation under one or more agreements.\n// The .NET Foundation licenses this file to you under the MIT license.\n// See the LICENSE file in the project root for more information.\n\nusing System.Collections.Generic;\nusing System.Collections.Immutable;\nusing System.Threading;\nusing System.Threading.Tasks;\n\nnamespace Microsoft.CodeAnalysis.FindSymbols\n{\n // This file contains the legacy FindReferences APIs. The APIs are legacy because they\n // do not contain enough information for us to effectively remote them over to the OOP\n // process to do the work. Specifically, they lack the \"current project context\" necessary\n // to be able to effectively serialize symbols to/from the remote process.\n\n public static partial class SymbolFinder\n {\n /// \n /// Finds all references to a symbol throughout a solution\n /// \n /// The symbol to find references to.\n /// The solution to find references within.\n /// A cancellation token.\n public static Task> FindReferencesAsync(\n ISymbol symbol,\n Solution solution,\n CancellationToken cancellationToken = default)\n {\n return FindReferencesAsync(new SymbolAndProjectId(symbol, projectId: null), solution, cancellationToken);\n }\n\n internal static async Task> FindReferencesAsync(\n SymbolAndProjectId symbolAndProjectId,\n Solution solution,\n CancellationToken cancellationToken = default)\n {\n var progressCollector = new StreamingProgressCollector(StreamingFindReferencesProgress.Instance);\n await FindReferencesAsync(\n symbolAndProjectId,\n solution, progress: progressCollector, documents: null,\n options: FindReferencesSearchOptions.Default,\n cancellationToken: cancellationToken).ConfigureAwait(false);\n return progressCollector.GetReferencedSymbols();\n }\n\n /// \n /// Finds all references to a symbol throughout a solution\n /// \n /// The symbol to find references to.\n /// The solution to find references within.\n /// A set of documents to be searched. If documents is null, then that means \"all documents\".\n /// A cancellation token.\n public static Task> FindReferencesAsync(\n ISymbol symbol,\n Solution solution,\n IImmutableSet documents,\n CancellationToken cancellationToken = default)\n {\n return FindReferencesAsync(symbol, solution, progress: null, documents: documents, cancellationToken: cancellationToken);\n }\n\n /// \n /// Finds all references to a symbol throughout a solution\n /// \n /// The symbol to find references to.\n /// The solution to find references within.\n /// An optional progress object that will receive progress\n /// information as the search is undertaken.\n /// An optional set of documents to be searched. If documents is null, then that means \"all documents\".\n /// An optional cancellation token.\n public static Task> FindReferencesAsync(\n ISymbol symbol,\n Solution solution,\n IFindReferencesProgress progress,\n IImmutableSet documents,\n CancellationToken cancellationToken = default)\n {\n return FindReferencesAsync(\n symbol, solution, progress, documents,\n FindReferencesSearchOptions.Default, cancellationToken);\n }\n\n private static async Task> FindReferencesAsync(\n ISymbol symbol,\n Solution solution,\n IFindReferencesProgress progress,\n IImmutableSet documents,\n FindReferencesSearchOptions options,\n CancellationToken cancellationToken)\n {\n progress ??= FindReferencesProgress.Instance;\n var streamingProgress = new StreamingProgressCollector(\n new StreamingFindReferencesProgressAdapter(progress));\n await FindReferencesAsync(\n SymbolAndProjectId.Create(symbol, projectId: null),\n solution, streamingProgress, documents,\n options, cancellationToken).ConfigureAwait(false);\n return streamingProgress.GetReferencedSymbols();\n }\n\n internal static class TestAccessor\n {\n internal static Task> FindReferencesAsync(\n ISymbol symbol,\n Solution solution,\n IFindReferencesProgress progress,\n IImmutableSet documents,\n FindReferencesSearchOptions options,\n CancellationToken cancellationToken)\n {\n return SymbolFinder.FindReferencesAsync(symbol, solution, progress, documents, options, cancellationToken);\n }\n }\n }\n}\n"},"meta":{"kind":"string","value":"{\n \"content_hash\": \"e91a096b6d2a6c72dfee654955b07b1d\",\n \"timestamp\": \"\",\n \"source\": \"github\",\n \"line_count\": 116,\n \"max_line_length\": 143,\n \"avg_line_length\": 48.31896551724138,\n \"alnum_prop\": 0.6603033006244424,\n \"repo_name\": \"agocke/roslyn\",\n \"id\": \"10e1645fb8c5b9d0026ba7342d3372ee6637fd02\",\n \"size\": \"5607\",\n \"binary\": false,\n \"copies\": \"2\",\n \"ref\": \"refs/heads/master\",\n \"path\": \"src/Workspaces/Core/Portable/FindSymbols/SymbolFinder_FindReferences_Legacy.cs\",\n \"mode\": \"33188\",\n \"license\": \"mit\",\n \"language\": [\n {\n \"name\": \"1C Enterprise\",\n \"bytes\": \"289100\"\n },\n {\n \"name\": \"Batchfile\",\n \"bytes\": \"9059\"\n },\n {\n \"name\": \"C#\",\n \"bytes\": \"126326705\"\n },\n {\n \"name\": \"C++\",\n \"bytes\": \"5602\"\n },\n {\n \"name\": \"CMake\",\n \"bytes\": \"8276\"\n },\n {\n \"name\": \"Dockerfile\",\n \"bytes\": \"2450\"\n },\n {\n \"name\": \"F#\",\n \"bytes\": \"549\"\n },\n {\n \"name\": \"PowerShell\",\n \"bytes\": \"237208\"\n },\n {\n \"name\": \"Shell\",\n \"bytes\": \"94927\"\n },\n {\n \"name\": \"Visual Basic .NET\",\n \"bytes\": \"70527543\"\n }\n ],\n \"symlink_target\": \"\"\n}"}}},{"rowIdx":311,"cells":{"text":{"kind":"string","value":"// This file has been automatically generated by goFB and should not be edited by hand\n// Compiler written by Hammond Pearce and available at github.com/kiwih/goFB\n\n// This file represents the implementation of the Composite Function Block for FlexPRET\n#include \"FlexPRET.h\"\n\n//When running a composite block, note that you would call the functions in this order (and this is very important)\n//_preinit(); \n//_init();\n//do {\n//\t_syncOutputEvents();\n//\t_syncInputEvents();\n//\t_syncOutputData();\n//\t_syncInputData();\n//\t_run();\n//} loop;\n\n\n/* FlexPRET_preinit() is required to be called to \n * initialise an instance of FlexPRET. \n * It sets all I/O values to zero.\n */\nint FlexPRET_preinit(FlexPRET_t *me) {\n\t//if there are input events, reset them\n\t\n\t//if there are output events, reset them\n\t\n\t//if there are input vars with default values, set them\n\t\n\t//if there are output vars with default values, set them\n\t\n\t//if there are internal vars with default values, set them (BFBs only)\n\t\n\t//if there are resource vars with default values, set them\n\t\n\t//if there are resources with set parameters, set them\n\t\n\t//if there are fb children (CFBs/Devices/Resources only), call this same function on them\n\tif(IOManager_preinit(&me->IO) != 0) {\n\t\treturn 1;\n\t}\n\tif(CanisterCounter_preinit(&me->CCounter) != 0) {\n\t\treturn 1;\n\t}\n\tif(DoorController_preinit(&me->Door) != 0) {\n\t\treturn 1;\n\t}\n\tif(ConveyorController_preinit(&me->Conveyor) != 0) {\n\t\treturn 1;\n\t}\n\tif(RejectArmController_preinit(&me->RejectArm) != 0) {\n\t\treturn 1;\n\t}\n\tif(InjectorPumpsController_preinit(&me->Pumps) != 0) {\n\t\treturn 1;\n\t}\n\tif(InjectorMotorController_preinit(&me->Motor) != 0) {\n\t\treturn 1;\n\t}\n\t\n\t\n\t//if this is a BFB, set _trigger to be true and start state so that the start state is properly executed\n\t\n\n\treturn 0;\n}\n\n/* FlexPRET_init() is required to be called to \n * set up an instance of FlexPRET. \n * It passes around configuration data.\n */\nint FlexPRET_init(FlexPRET_t *me) {\n\t//pass in any parameters on this level\n\t\n\t\n\t\n\n\t//perform a data copy to all children (if any present) (can move config data around, doesn't do anything otherwise)\n\tme->Door.EmergencyStop = me->IO.EmergencyStop;\n\tme->Conveyor.EmergencyStop = me->IO.EmergencyStop;\n\tme->Motor.EmergencyStop = me->IO.EmergencyStop;\n\tme->Pumps.EmergencyStop = me->IO.EmergencyStop;\n\tme->Pumps.CanisterPressure = me->IO.CanisterPressure;\n\tme->Pumps.FillContentsAvailable = me->IO.FillContentsAvailable;\n\tme->CCounter.DoorSiteLaser = me->IO.DoorSiteLaser;\n\tme->Conveyor.InjectSiteLaser = me->IO.InjectSiteLaser;\n\tme->RejectArm.RejectSiteLaser = me->IO.RejectSiteLaser;\n\tme->CCounter.RejectBinLaser = me->IO.RejectBinLaser;\n\tme->CCounter.AcceptBinLaser = me->IO.AcceptBinLaser;\n\tme->IO.CanisterCount = me->CCounter.CanisterCount;\n\tme->IO.ConveyorSpeed = me->Conveyor.ConveyorSpeed;\n\tme->IO.InjectorContentsValveOpen = me->Pumps.InjectorContentsValveOpen;\n\tme->IO.InjectorVacuumRun = me->Pumps.InjectorVacuumRun;\n\tme->IO.InjectorPressurePumpRun = me->Pumps.InjectorPressurePumpRun;\n\tme->IO.FillContents = me->Pumps.FillContents;\n\tme->IO.InjectorPosition = me->Motor.InjectorPosition;\n\t\n\n\t//if there are fb children (CFBs/Devices/Resources only), call this same function on them\n\tif(IOManager_init(&me->IO) != 0) {\n\t\treturn 1;\n\t}\n\tif(CanisterCounter_init(&me->CCounter) != 0) {\n\t\treturn 1;\n\t}\n\tif(DoorController_init(&me->Door) != 0) {\n\t\treturn 1;\n\t}\n\tif(ConveyorController_init(&me->Conveyor) != 0) {\n\t\treturn 1;\n\t}\n\tif(RejectArmController_init(&me->RejectArm) != 0) {\n\t\treturn 1;\n\t}\n\tif(InjectorPumpsController_init(&me->Pumps) != 0) {\n\t\treturn 1;\n\t}\n\tif(InjectorMotorController_init(&me->Motor) != 0) {\n\t\treturn 1;\n\t}\n\t\n\t\n\n\treturn 0;\n}\n\n\n\n/* FlexPRET_syncOutputEvents() synchronises the output events of an\n * instance of FlexPRET as required by synchronous semantics.\n * Notice that it does NOT perform any computation - this occurs in the\n * _run function.\n */\nvoid FlexPRET_syncOutputEvents(FlexPRET_t *me) {\n\t//first, for all cfb children, call this same function\n\t\n\t\n\t//then, for all connections that are connected to an output on the parent, run their run their copy\n\t\n}\n\n/* FlexPRET_syncInputEvents() synchronises the input events of an\n * instance of FlexPRET as required by synchronous semantics.\n * Notice that it does NOT perform any computation - this occurs in the\n * _run function.\n */\nvoid FlexPRET_syncInputEvents(FlexPRET_t *me) {\n\t//first, we explicitly synchronise the children\n\t\n\tme->IO.inputEvents.event.DoorReleaseCanister = me->Door.outputEvents.event.DoorReleaseCanister; \n\t\n\tme->IO.inputEvents.event.ConveyorChanged = me->Conveyor.outputEvents.event.ConveyorChanged; \n\t\n\tme->IO.inputEvents.event.InjectorPositionChanged = me->Motor.outputEvents.event.InjectorPositionChanged; \n\t\n\tme->IO.inputEvents.event.InjectorControlsChanged = me->Pumps.outputEvents.event.InjectorControlsChanged; \n\t\n\tme->IO.inputEvents.event.FillContentsChanged = me->Pumps.outputEvents.event.FillContentsChanged; \n\t\n\tme->IO.inputEvents.event.StartVacuumTimer = me->Pumps.outputEvents.event.StartVacuumTimer; \n\t\n\tme->IO.inputEvents.event.GoRejectArm = me->RejectArm.outputEvents.event.GoRejectArm; \n\t\n\tme->IO.inputEvents.event.CanisterCountChanged = me->CCounter.outputEvents.event.CanisterCountChanged; \n\t\n\tme->IO.inputEvents.event.InjectDone = me->Motor.outputEvents.event.InjectDone; \n\t\n\tme->CCounter.inputEvents.event.LasersChanged = me->IO.outputEvents.event.LasersChanged; \n\t\n\tme->Door.inputEvents.event.ReleaseDoorOverride = me->IO.outputEvents.event.DoorOverride; \n\t\n\tme->Door.inputEvents.event.BottlingDone = me->Motor.outputEvents.event.InjectDone; \n\t\n\tme->Door.inputEvents.event.EmergencyStopChanged = me->IO.outputEvents.event.EmergencyStopChanged; \n\t\n\tme->Conveyor.inputEvents.event.InjectDone = me->Motor.outputEvents.event.InjectDone; \n\t\n\tme->Conveyor.inputEvents.event.EmergencyStopChanged = me->IO.outputEvents.event.EmergencyStopChanged; \n\t\n\tme->Conveyor.inputEvents.event.LasersChanged = me->IO.outputEvents.event.LasersChanged; \n\t\n\tme->RejectArm.inputEvents.event.RejectCanister = me->Pumps.outputEvents.event.RejectCanister; \n\t\n\tme->RejectArm.inputEvents.event.LasersChanged = me->IO.outputEvents.event.LasersChanged; \n\t\n\tme->Pumps.inputEvents.event.StartPump = me->Motor.outputEvents.event.StartPump; \n\t\n\tme->Pumps.inputEvents.event.EmergencyStopChanged = me->IO.outputEvents.event.EmergencyStopChanged; \n\t\n\tme->Pumps.inputEvents.event.CanisterPressureChanged = me->IO.outputEvents.event.CanisterPressureChanged; \n\t\n\tme->Pumps.inputEvents.event.FillContentsAvailableChanged = me->IO.outputEvents.event.FillContentsAvailableChanged; \n\t\n\tme->Pumps.inputEvents.event.VacuumTimerElapsed = me->IO.outputEvents.event.VacuumTimerElapsed; \n\t\n\tme->Motor.inputEvents.event.InjectorArmFinishedMovement = me->IO.outputEvents.event.InjectorArmFinishMovement; \n\t\n\tme->Motor.inputEvents.event.EmergencyStopChanged = me->IO.outputEvents.event.EmergencyStopChanged; \n\t\n\tme->Motor.inputEvents.event.ConveyorStoppedForInject = me->Conveyor.outputEvents.event.ConveyorStoppedForInject; \n\t\n\tme->Motor.inputEvents.event.PumpFinished = me->Pumps.outputEvents.event.PumpFinished; \n\t\n\n\t//then, call this same function on all cfb children\n\t\n}\n\n/* FlexPRET_syncOutputData() synchronises the output data connections of an\n * instance of FlexPRET as required by synchronous semantics.\n * It does the checking to ensure that only connections which have had their\n * associated event fire are updated.\n * Notice that it does NOT perform any computation - this occurs in the\n * _run function.\n */\nvoid FlexPRET_syncOutputData(FlexPRET_t *me) {\n\t//for all composite function block children, call this same function\n\t\n\t\n\t//for data that is sent from child to this CFB (me), always copy (event controlled copies will be resolved at the next level up) //TODO: arrays!?\n\t\n\t\n}\n\n/* FlexPRET_syncInputData() synchronises the input data connections of an\n * instance of FlexPRET as required by synchronous semantics.\n * It does the checking to ensure that only connections which have had their\n * associated event fire are updated.\n * Notice that it does NOT perform any computation - this occurs in the\n * _run function.\n */\nvoid FlexPRET_syncInputData(FlexPRET_t *me) {\n\t//for all basic function block children, perform their synchronisations explicitly\n\t\n\t//sync for IO (of type IOManager) which is a BFB\n\t\n\tif(me->IO.inputEvents.event.ConveyorChanged == 1) { \n\t\tme->IO.ConveyorSpeed = me->Conveyor.ConveyorSpeed;\n\t} \n\tif(me->IO.inputEvents.event.InjectorPositionChanged == 1) { \n\t\tme->IO.InjectorPosition = me->Motor.InjectorPosition;\n\t} \n\tif(me->IO.inputEvents.event.InjectorControlsChanged == 1) { \n\t\tme->IO.InjectorContentsValveOpen = me->Pumps.InjectorContentsValveOpen;\n\t\tme->IO.InjectorVacuumRun = me->Pumps.InjectorVacuumRun;\n\t\tme->IO.InjectorPressurePumpRun = me->Pumps.InjectorPressurePumpRun;\n\t} \n\tif(me->IO.inputEvents.event.FillContentsChanged == 1) { \n\t\tme->IO.FillContents = me->Pumps.FillContents;\n\t} \n\tif(me->IO.inputEvents.event.CanisterCountChanged == 1) { \n\t\tme->IO.CanisterCount = me->CCounter.CanisterCount;\n\t} \n\t\n\t//sync for CCounter (of type CanisterCounter) which is a BFB\n\t\n\tif(me->CCounter.inputEvents.event.LasersChanged == 1) { \n\t\tme->CCounter.DoorSiteLaser = me->IO.DoorSiteLaser;\n\t\tme->CCounter.RejectBinLaser = me->IO.RejectBinLaser;\n\t\tme->CCounter.AcceptBinLaser = me->IO.AcceptBinLaser;\n\t} \n\t\n\t//sync for Door (of type DoorController) which is a BFB\n\t\n\tif(me->Door.inputEvents.event.EmergencyStopChanged == 1) { \n\t\tme->Door.EmergencyStop = me->IO.EmergencyStop;\n\t} \n\t\n\t//sync for Conveyor (of type ConveyorController) which is a BFB\n\t\n\tif(me->Conveyor.inputEvents.event.EmergencyStopChanged == 1) { \n\t\tme->Conveyor.EmergencyStop = me->IO.EmergencyStop;\n\t} \n\tif(me->Conveyor.inputEvents.event.LasersChanged == 1) { \n\t\tme->Conveyor.InjectSiteLaser = me->IO.InjectSiteLaser;\n\t} \n\t\n\t//sync for RejectArm (of type RejectArmController) which is a BFB\n\t\n\tif(me->RejectArm.inputEvents.event.LasersChanged == 1) { \n\t\tme->RejectArm.RejectSiteLaser = me->IO.RejectSiteLaser;\n\t} \n\t\n\t//sync for Pumps (of type InjectorPumpsController) which is a BFB\n\t\n\tif(me->Pumps.inputEvents.event.EmergencyStopChanged == 1) { \n\t\tme->Pumps.EmergencyStop = me->IO.EmergencyStop;\n\t} \n\tif(me->Pumps.inputEvents.event.CanisterPressureChanged == 1) { \n\t\tme->Pumps.CanisterPressure = me->IO.CanisterPressure;\n\t} \n\tif(me->Pumps.inputEvents.event.FillContentsAvailableChanged == 1) { \n\t\tme->Pumps.FillContentsAvailable = me->IO.FillContentsAvailable;\n\t} \n\t\n\t//sync for Motor (of type InjectorMotorController) which is a BFB\n\t\n\tif(me->Motor.inputEvents.event.EmergencyStopChanged == 1) { \n\t\tme->Motor.EmergencyStop = me->IO.EmergencyStop;\n\t} \n\t\n\t\n\t//for all composite function block children, call this same function\n\t\n\t\n}\n\n\n/* FlexPRET_run() executes a single tick of an\n * instance of FlexPRET according to synchronise semantics.\n * Notice that it does NOT perform any I/O - synchronisation\n * is done using the _syncX functions at this (and any higher) level.\n */\nvoid FlexPRET_run(FlexPRET_t *me) {\n\tIOManager_run(&me->IO);\n\tCanisterCounter_run(&me->CCounter);\n\tDoorController_run(&me->Door);\n\tConveyorController_run(&me->Conveyor);\n\tRejectArmController_run(&me->RejectArm);\n\tInjectorPumpsController_run(&me->Pumps);\n\tInjectorMotorController_run(&me->Motor);\n\t\n}\n\n"},"meta":{"kind":"string","value":"{\n \"content_hash\": \"fbae10d531f7024632d3ade403e39e7b\",\n \"timestamp\": \"\",\n \"source\": \"github\",\n \"line_count\": 324,\n \"max_line_length\": 146,\n \"avg_line_length\": 34.82716049382716,\n \"alnum_prop\": 0.7479617157036512,\n \"repo_name\": \"kiwih/goFB\",\n \"id\": \"67f084e5ebc2bf98a0e03c9364d9a52263365ebb\",\n \"size\": \"11284\",\n \"binary\": false,\n \"copies\": \"4\",\n \"ref\": \"refs/heads/master\",\n \"path\": \"examples/goFB_only/c_tcrest/bottlingplant_single_mem/c/FlexPRET.c\",\n \"mode\": \"33188\",\n \"license\": \"mit\",\n \"language\": [\n {\n \"name\": \"C\",\n \"bytes\": \"43131\"\n },\n {\n \"name\": \"C++\",\n \"bytes\": \"5595\"\n },\n {\n \"name\": \"Go\",\n \"bytes\": \"176099\"\n },\n {\n \"name\": \"Makefile\",\n \"bytes\": \"158\"\n },\n {\n \"name\": \"Shell\",\n \"bytes\": \"153\"\n },\n {\n \"name\": \"VHDL\",\n \"bytes\": \"15110\"\n }\n ],\n \"symlink_target\": \"\"\n}"}}},{"rowIdx":312,"cells":{"text":{"kind":"string","value":"from com.android.monkeyrunner import MonkeyRunner, MonkeyDevice\n\n# Connects to the current device, returning a MonkeyDevice object\ndevice = MonkeyRunner.waitForConnection()\n\n# Installs the Android package. Notice that this method returns a boolean, so you can test\n# to see if the installation worked.\ndevice.installPackage('../app/target/net-d53dev-dslfy-android-1.0.apk')\n\n# sets a variable with the package's internal name\npackage = 'net.d53dev.dslfy.android'\n\n# sets a variable with the name of an Activity in the package\nactivity = 'net.d53dev.dslfy.android.ui.CarouselActivity'\n\n# sets the name of the component to start\nrunComponent = package + '/' + activity\n\n# Runs the component\ndevice.startActivity(component=runComponent)\n\nMonkeyRunner.sleep(5)\n\ndevice.type('example@example.com')\n\n# Takes a screenshot\nresult = device.takeSnapshot()\n\n# Writes the screenshot to a file\nresult.writeToFile('screenshot.png','png')\n"},"meta":{"kind":"string","value":"{\n \"content_hash\": \"418732af8f97a9a2ab958fb6c523943a\",\n \"timestamp\": \"\",\n \"source\": \"github\",\n \"line_count\": 30,\n \"max_line_length\": 90,\n \"avg_line_length\": 30.8,\n \"alnum_prop\": 0.7813852813852814,\n \"repo_name\": \"d53dave/DSLFY-Android\",\n \"id\": \"b9374572e102990fb5735a85b1c956380dcf5865\",\n \"size\": \"980\",\n \"binary\": false,\n \"copies\": \"1\",\n \"ref\": \"refs/heads/master\",\n \"path\": \"integration-tests/monkeyrunnerTestSuite.py\",\n \"mode\": \"33188\",\n \"license\": \"mit\",\n \"language\": [\n {\n \"name\": \"Java\",\n \"bytes\": \"187405\"\n },\n {\n \"name\": \"Python\",\n \"bytes\": \"980\"\n }\n ],\n \"symlink_target\": \"\"\n}"}}},{"rowIdx":313,"cells":{"text":{"kind":"string","value":"Docker image of [ADAM](https://github.com/bigdatagenomics/adam) built with [Linuxbrew](http://brew.sh/linuxbrew/).\n\n * docker pull [heuermh/adam](https://registry.hub.docker.com/u/heuermh/adam/)"},"meta":{"kind":"string","value":"{\n \"content_hash\": \"c83238ba7fd95054cd3190d8a13d0f4b\",\n \"timestamp\": \"\",\n \"source\": \"github\",\n \"line_count\": 3,\n \"max_line_length\": 114,\n \"avg_line_length\": 64.66666666666667,\n \"alnum_prop\": 0.7474226804123711,\n \"repo_name\": \"heuermh/docker-linuxbrew-bio\",\n \"id\": \"2c4a22274bf079243f8468d9c8b48473fd987828\",\n \"size\": \"257\",\n \"binary\": false,\n \"copies\": \"1\",\n \"ref\": \"refs/heads/master\",\n \"path\": \"adam/README.md\",\n \"mode\": \"33188\",\n \"license\": \"apache-2.0\",\n \"language\": [\n {\n \"name\": \"Dockerfile\",\n \"bytes\": \"6840\"\n }\n ],\n \"symlink_target\": \"\"\n}"}}},{"rowIdx":314,"cells":{"text":{"kind":"string","value":"package com.codingpan.leetcode.todo;\n\nimport java.util.TreeSet;\n\n/**\n * [220. Contains Duplicate III](https://leetcode.com/problems/contains-duplicate-iii/description/)\n * Given an array of integers, find out whether there are two distinct indices i and j in the array\n * such that the absolute difference between nums[i] and nums[j] is at most t and the absolute\n * difference between i and j is at most k.\n */\npublic class LC220ContainsDuplicateIII {\n // Failed at com.codingpan.test case 4\n public boolean containsNearbyAlmostDuplicate(int[] nums, int k, int t) {\n TreeSet treeSet = new TreeSet();\n for (int i = 0; i < nums.length; i++) {\n Integer max = treeSet.floor(nums[i] + t);\n Integer min = treeSet.ceiling(nums[i] - t);\n if (max != null && max >= nums[i]) return true;\n if (min != null && min <= nums[i]) return true;\n treeSet.add(nums[i]);\n if (i >= k) treeSet.remove(nums[i - k]);\n }\n return false;\n }\n\n public static void main(String[] args) {\n LC220ContainsDuplicateIII solu = new LC220ContainsDuplicateIII();\n // false\n // int[] nums = {-1, 2147483647};\n // int k = 1;\n // int t = 2147483647;\n\n // true\n // int[] nums = {-1, -1};\n // int k = 1;\n // int t = 0;\n\n // false\n // int[] nums = {2147483647, -2147483647};\n // int k = 1;\n // int t = 2147483647;\n\n // 4 true\n int[] nums = {-2147483648, -2147483647};\n int k = 3;\n int t = 3;\n\n // int[] nums = {-1, -1};\n // int k = 1;\n // int t = -1;\n System.out.println(solu.containsNearbyAlmostDuplicate(nums, k, t));\n }\n}\n"},"meta":{"kind":"string","value":"{\n \"content_hash\": \"3d8d906d34f13a9b7922c35171ac31d4\",\n \"timestamp\": \"\",\n \"source\": \"github\",\n \"line_count\": 53,\n \"max_line_length\": 99,\n \"avg_line_length\": 33.490566037735846,\n \"alnum_prop\": 0.5464788732394367,\n \"repo_name\": \"wszdwp/AlgorithmPractice\",\n \"id\": \"a7cb5d3aa682e28530d86e765e2ecafe73cd59ab\",\n \"size\": \"1775\",\n \"binary\": false,\n \"copies\": \"1\",\n \"ref\": \"refs/heads/master\",\n \"path\": \"src/main/java/com/codingpan/leetcode/todo/LC220ContainsDuplicateIII.java\",\n \"mode\": \"33188\",\n \"license\": \"mit\",\n \"language\": [\n {\n \"name\": \"Java\",\n \"bytes\": \"581475\"\n }\n ],\n \"symlink_target\": \"\"\n}"}}},{"rowIdx":315,"cells":{"text":{"kind":"string","value":"\npackage org.kuali.rice.kew.api.doctype;\n\nimport org.apache.commons.collections.CollectionUtils;\nimport org.apache.commons.lang.StringUtils;\nimport org.kuali.rice.core.api.CoreConstants;\nimport org.kuali.rice.core.api.mo.AbstractDataTransferObject;\nimport org.kuali.rice.core.api.mo.ModelBuilder;\nimport org.kuali.rice.kew.api.KewApiConstants;\nimport org.w3c.dom.Element;\n\nimport javax.xml.bind.annotation.XmlAccessType;\nimport javax.xml.bind.annotation.XmlAccessorType;\nimport javax.xml.bind.annotation.XmlAnyElement;\nimport javax.xml.bind.annotation.XmlElement;\nimport javax.xml.bind.annotation.XmlElementWrapper;\nimport javax.xml.bind.annotation.XmlRootElement;\nimport javax.xml.bind.annotation.XmlType;\nimport javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;\nimport java.io.Serializable;\nimport java.util.ArrayList;\nimport java.util.Collection;\nimport java.util.Collections;\nimport java.util.HashMap;\nimport java.util.List;\nimport java.util.Map;\n\n@XmlRootElement(name = DocumentType.Constants.ROOT_ELEMENT_NAME)\n@XmlAccessorType(XmlAccessType.NONE)\n@XmlType(name = DocumentType.Constants.TYPE_NAME, propOrder = {\n DocumentType.Elements.ID,\n DocumentType.Elements.NAME,\n DocumentType.Elements.DOCUMENT_TYPE_VERSION,\n DocumentType.Elements.LABEL,\n DocumentType.Elements.DESCRIPTION,\n DocumentType.Elements.PARENT_ID,\n DocumentType.Elements.ACTIVE,\n DocumentType.Elements.UNRESOLVED_DOC_HANDLER_URL,\n DocumentType.Elements.RESOLVED_DOC_HANDLER_URL,\n DocumentType.Elements.HELP_DEFINITION_URL,\n DocumentType.Elements.DOC_SEARCH_HELP_URL,\n DocumentType.Elements.POST_PROCESSOR_NAME,\n DocumentType.Elements.APPLICATION_ID,\n DocumentType.Elements.CURRENT,\n DocumentType.Elements.BLANKET_APPROVE_GROUP_ID,\n DocumentType.Elements.SUPER_USER_GROUP_ID,\n DocumentType.Elements.POLICIES,\n DocumentType.Elements.DOCUMENT_TYPE_ATTRIBUTES,\n CoreConstants.CommonElements.VERSION_NUMBER,\n DocumentType.Elements.AUTHORIZER,\n CoreConstants.CommonElements.FUTURE_ELEMENTS\n})\npublic final class DocumentType extends AbstractDataTransferObject implements DocumentTypeContract {\n\n private static final long serialVersionUID = 6866926296038814812L;\n\n @XmlElement(name = Elements.ID, required = false)\n private final String id;\n\n @XmlElement(name = Elements.NAME, required = true)\n private final String name;\n\n @XmlElement(name = Elements.DOCUMENT_TYPE_VERSION, required = false)\n private final Integer documentTypeVersion;\n\n @XmlElement(name = Elements.LABEL, required = false)\n private final String label;\n\n @XmlElement(name = Elements.DESCRIPTION, required = false)\n private final String description;\n\n @XmlElement(name = Elements.PARENT_ID, required = false)\n private final String parentId;\n\n @XmlElement(name = Elements.ACTIVE, required = true)\n private final boolean active;\n\n @XmlElement(name = Elements.UNRESOLVED_DOC_HANDLER_URL, required = false)\n private final String unresolvedDocHandlerUrl;\n\n @XmlElement(name = Elements.RESOLVED_DOC_HANDLER_URL, required = false)\n private final String resolvedDocumentHandlerUrl;\n \n @XmlElement(name = Elements.HELP_DEFINITION_URL, required = false)\n private final String helpDefinitionUrl;\n\n @XmlElement(name = Elements.DOC_SEARCH_HELP_URL, required = false)\n private final String docSearchHelpUrl;\n \n @XmlElement(name = Elements.POST_PROCESSOR_NAME, required = false)\n private final String postProcessorName;\n\n @XmlElement(name = Elements.APPLICATION_ID, required = false)\n private final String applicationId;\n\n @XmlElement(name = Elements.CURRENT, required = true)\n private final boolean current;\n\n @XmlElement(name = Elements.BLANKET_APPROVE_GROUP_ID, required = false)\n private final String blanketApproveGroupId;\n\n @XmlElement(name = Elements.SUPER_USER_GROUP_ID, required = false)\n private final String superUserGroupId;\n\n @XmlElement(name = CoreConstants.CommonElements.VERSION_NUMBER, required = false)\n private final Long versionNumber;\n\n @XmlElement(name = Elements.POLICIES, required = true)\n @XmlJavaTypeAdapter(DocumentTypePolicyMapAdapter.class)\n private final Map policies;\n\n @XmlElementWrapper(name = Elements.DOCUMENT_TYPE_ATTRIBUTES, required = false)\n @XmlElement(name = Elements.DOCUMENT_TYPE_ATTRIBUTE, required = false)\n private final List documentTypeAttributes;\n\n /**\n * @since 2.1.3\n */\n @XmlElement(name = Elements.AUTHORIZER, required = false)\n private final String authorizer;\n\n @SuppressWarnings(\"unused\")\n @XmlAnyElement\n private final Collection _futureElements = null;\n\n /**\n * Private constructor used only by JAXB.\n */\n private DocumentType() {\n this.id = null;\n this.name = null;\n this.documentTypeVersion = null;\n this.label = null;\n this.description = null;\n this.parentId = null;\n this.active = false;\n this.unresolvedDocHandlerUrl = null;\n this.resolvedDocumentHandlerUrl = null;\n this.helpDefinitionUrl = null;\n this.docSearchHelpUrl = null;\n this.postProcessorName = null;\n this.applicationId = null;\n this.current = false;\n this.blanketApproveGroupId = null;\n this.superUserGroupId = null;\n this.policies = null;\n this.versionNumber = null;\n this.documentTypeAttributes = null;\n this.authorizer = null;\n }\n\n private DocumentType(Builder builder) {\n this.name = builder.getName();\n this.id = builder.getId();\n this.documentTypeVersion = builder.getDocumentTypeVersion();\n this.label = builder.getLabel();\n this.description = builder.getDescription();\n this.parentId = builder.getParentId();\n this.active = builder.isActive();\n this.unresolvedDocHandlerUrl = builder.getUnresolvedDocHandlerUrl();\n this.resolvedDocumentHandlerUrl = builder.getResolvedDocumentHandlerUrl();\n this.helpDefinitionUrl = builder.getHelpDefinitionUrl();\n this.docSearchHelpUrl = builder.getDocSearchHelpUrl();\n this.postProcessorName = builder.getPostProcessorName();\n this.applicationId = builder.getApplicationId();\n this.current = builder.isCurrent();\n this.blanketApproveGroupId = builder.getBlanketApproveGroupId();\n this.superUserGroupId = builder.getSuperUserGroupId();\n if (builder.getPolicies() == null) {\n this.policies = Collections.emptyMap();\n } else {\n this.policies = Collections.unmodifiableMap(new HashMap(builder.getPolicies()));\n }\n this.versionNumber = builder.getVersionNumber();\n \n List tempAttributes = new ArrayList();\n if (CollectionUtils.isNotEmpty(builder.getDocumentTypeAttributes())) {\n for (DocumentTypeAttribute.Builder externalId : builder.getDocumentTypeAttributes()) {\n tempAttributes.add(externalId.build());\n }\n }\n this.documentTypeAttributes = Collections.unmodifiableList(tempAttributes);\n this.authorizer = builder.getAuthorizer();\n }\n\n @Override\n public String getId() {\n return this.id;\n }\n\n @Override\n public String getName() {\n return this.name;\n }\n\n @Override\n public Integer getDocumentTypeVersion() {\n return this.documentTypeVersion;\n }\n\n @Override\n public String getLabel() {\n return this.label;\n }\n\n @Override\n public String getDescription() {\n return this.description;\n }\n\n @Override\n public String getParentId() {\n return this.parentId;\n }\n\n @Override\n public boolean isActive() {\n return this.active;\n }\n\n @Override\n public String getUnresolvedDocHandlerUrl() {\n return this.unresolvedDocHandlerUrl;\n }\n\n @Override\n public String getHelpDefinitionUrl() {\n return this.helpDefinitionUrl;\n }\n\n @Override\n public String getDocSearchHelpUrl() {\n return this.docSearchHelpUrl;\n }\n \n @Override\n public String getPostProcessorName() {\n return this.postProcessorName;\n }\n\n @Override\n public String getApplicationId() {\n return this.applicationId;\n }\n\n @Override\n public boolean isCurrent() {\n return this.current;\n }\n\n @Override\n public String getBlanketApproveGroupId() {\n return this.blanketApproveGroupId;\n }\n\n @Override\n public String getSuperUserGroupId() {\n return this.superUserGroupId;\n }\n\n @Override\n public Map getPolicies() {\n return this.policies;\n }\n \n @Override\n public List getDocumentTypeAttributes() {\n return this.documentTypeAttributes;\n }\n\n @Override\n public Long getVersionNumber() {\n return this.versionNumber;\n }\n \n @Override\n public String getResolvedDocumentHandlerUrl() {\n return this.resolvedDocumentHandlerUrl;\n }\n\n /**\n * @since 2.1.3\n * @\n */\n @Override\n public String getAuthorizer() {\n return this.authorizer;\n }\n\n /**\n * A builder which can be used to construct {@link DocumentType} instances. Enforces the\n * constraints of the {@link DocumentTypeContract}.\n */\n public final static class Builder implements Serializable, ModelBuilder, DocumentTypeContract {\n\n private static final long serialVersionUID = 1678979180435181578L;\n\n private String id;\n private String name;\n private Integer documentTypeVersion;\n private String label;\n private String description;\n private String parentId;\n private boolean active;\n private String unresolvedDocHandlerUrl;\n private String resolvedDocumentHandlerUrl;\n private String helpDefinitionUrl;\n private String docSearchHelpUrl;\n private String postProcessorName;\n private String applicationId;\n private boolean current;\n private String blanketApproveGroupId;\n private String superUserGroupId;\n private Map policies;\n private List documentTypeAttributes;\n private Long versionNumber;\n private String authorizer;\n\n private Builder(String name) {\n setName(name);\n setActive(true);\n setCurrent(true);\n this.policies = new HashMap();\n this.documentTypeAttributes = Collections.emptyList();\n }\n\n public static Builder create(String name) {\n return new Builder(name);\n }\n\n public static Builder create(DocumentTypeContract contract) {\n if (contract == null) {\n throw new IllegalArgumentException(\"contract was null\");\n }\n Builder builder = create(contract.getName());\n builder.setId(contract.getId());\n builder.setDocumentTypeVersion(contract.getDocumentTypeVersion());\n builder.setLabel(contract.getLabel());\n builder.setDescription(contract.getDescription());\n builder.setParentId(contract.getParentId());\n builder.setActive(contract.isActive());\n builder.setUnresolvedDocHandlerUrl(contract.getUnresolvedDocHandlerUrl());\n builder.setResolvedDocHandlerUrl(contract.getResolvedDocumentHandlerUrl());\n builder.setHelpDefinitionUrl(contract.getHelpDefinitionUrl());\n builder.setDocSearchHelpUrl(contract.getDocSearchHelpUrl());\n builder.setPostProcessorName(contract.getPostProcessorName());\n builder.setApplicationId(contract.getApplicationId());\n builder.setCurrent(contract.isCurrent());\n builder.setBlanketApproveGroupId(contract.getBlanketApproveGroupId());\n builder.setSuperUserGroupId(contract.getSuperUserGroupId());\n builder.setPolicies(new HashMap(contract.getPolicies()));\n if (contract.getDocumentTypeAttributes() != null) {\n List tempAttrs = new ArrayList();\n for (DocumentTypeAttributeContract attrContract : contract.getDocumentTypeAttributes()) {\n tempAttrs.add(DocumentTypeAttribute.Builder.create(attrContract));\n }\n builder.setDocumentTypeAttributes(tempAttrs);\n }\n builder.setVersionNumber(contract.getVersionNumber());\n builder.setAuthorizer(contract.getAuthorizer());\n return builder;\n }\n\n public DocumentType build() {\n return new DocumentType(this);\n }\n\n @Override\n public String getId() {\n return this.id;\n }\n\n @Override\n public String getName() {\n return this.name;\n }\n\n @Override\n public Integer getDocumentTypeVersion() {\n return this.documentTypeVersion;\n }\n\n @Override\n public String getLabel() {\n return this.label;\n }\n\n @Override\n public String getDescription() {\n return this.description;\n }\n\n @Override\n public String getParentId() {\n return this.parentId;\n }\n\n @Override\n public boolean isActive() {\n return this.active;\n }\n\n @Override\n public String getUnresolvedDocHandlerUrl() {\n return this.unresolvedDocHandlerUrl;\n }\n \n @Override\n public String getResolvedDocumentHandlerUrl() {\n return this.resolvedDocumentHandlerUrl;\n }\n \n @Override\n public String getHelpDefinitionUrl() {\n return this.helpDefinitionUrl;\n }\n\n @Override\n public String getDocSearchHelpUrl() {\n return this.docSearchHelpUrl;\n }\n\n @Override\n public String getPostProcessorName() {\n return this.postProcessorName;\n }\n\n @Override\n public String getApplicationId() {\n return this.applicationId;\n }\n\n @Override\n public boolean isCurrent() {\n return this.current;\n }\n\n @Override\n public String getBlanketApproveGroupId() {\n return this.blanketApproveGroupId;\n }\n\n @Override\n public String getSuperUserGroupId() {\n return this.superUserGroupId;\n }\n\n @Override\n public Map getPolicies() {\n return this.policies;\n }\n \n @Override\n public List getDocumentTypeAttributes() {\n return this.documentTypeAttributes;\n }\n\n @Override\n public Long getVersionNumber() {\n return this.versionNumber;\n }\n\n /**\n * @since 2.1.3\n * @\n */\n @Override\n public String getAuthorizer() {\n return this.authorizer;\n }\n\n public void setId(String id) {\n this.id = id;\n }\n\n public void setName(String name) {\n if (StringUtils.isBlank(name)) {\n throw new IllegalArgumentException(\"name was null or blank\");\n }\n this.name = name;\n }\n\n public void setDocumentTypeVersion(Integer documentTypeVersion) {\n this.documentTypeVersion = documentTypeVersion;\n }\n\n public void setLabel(String label) {\n this.label = label;\n }\n\n public void setDescription(String description) {\n this.description = description;\n }\n\n public void setParentId(String parentId) {\n this.parentId = parentId;\n }\n\n public void setActive(boolean active) {\n this.active = active;\n }\n\n public void setUnresolvedDocHandlerUrl(String unresolvedDocHandlerUrl) {\n this.unresolvedDocHandlerUrl = unresolvedDocHandlerUrl;\n }\n\n public void setResolvedDocHandlerUrl(String resolvedDocumentHandlerUrl) {\n this.resolvedDocumentHandlerUrl = resolvedDocumentHandlerUrl;\n }\n\n public void setHelpDefinitionUrl(String helpDefinitionUrl) {\n this.helpDefinitionUrl = helpDefinitionUrl;\n }\n\n public void setDocSearchHelpUrl(String docSearchHelpUrl) {\n this.docSearchHelpUrl = docSearchHelpUrl;\n }\n \n public void setPostProcessorName(String postProcessorName) {\n this.postProcessorName = postProcessorName;\n }\n\n public void setApplicationId(String applicationId) {\n this.applicationId = applicationId;\n }\n\n public void setCurrent(boolean current) {\n this.current = current;\n }\n\n public void setBlanketApproveGroupId(String blanketApproveGroupId) {\n this.blanketApproveGroupId = blanketApproveGroupId;\n }\n\n public void setSuperUserGroupId(String superUserGroupId) {\n this.superUserGroupId = superUserGroupId;\n }\n\n public void setPolicies(Map policies) {\n this.policies = policies;\n }\n \n public void setDocumentTypeAttributes(List documentTypeAttributes) {\n this.documentTypeAttributes = documentTypeAttributes;\n }\n\n public void setVersionNumber(Long versionNumber) {\n this.versionNumber = versionNumber;\n }\n\n public void setAuthorizer(String authorizer) {\n this.authorizer = authorizer;\n }\n }\n\n /**\n * Defines some internal constants used on this class.\n */\n static class Constants {\n final static String ROOT_ELEMENT_NAME = \"documentType\";\n final static String TYPE_NAME = \"DocumentTypeType\";\n }\n\n /**\n * A private class which exposes constants which define the XML element names to use when this\n * object is marshalled to XML.\n */\n static class Elements {\n final static String ID = \"id\";\n final static String NAME = \"name\";\n final static String DOCUMENT_TYPE_VERSION = \"documentTypeVersion\";\n final static String LABEL = \"label\";\n final static String DESCRIPTION = \"description\";\n final static String PARENT_ID = \"parentId\";\n final static String ACTIVE = \"active\";\n final static String UNRESOLVED_DOC_HANDLER_URL = \"unresolvedDocHandlerUrl\";\n final static String RESOLVED_DOC_HANDLER_URL = \"resolvedDocumentHandlerUrl\";\n final static String HELP_DEFINITION_URL = \"helpDefinitionUrl\";\n final static String DOC_SEARCH_HELP_URL = \"docSearchHelpUrl\";\n final static String POST_PROCESSOR_NAME = \"postProcessorName\";\n final static String APPLICATION_ID = \"applicationId\";\n final static String CURRENT = \"current\";\n final static String BLANKET_APPROVE_GROUP_ID = \"blanketApproveGroupId\";\n final static String SUPER_USER_GROUP_ID = \"superUserGroupId\";\n final static String POLICIES = \"policies\";\n final static String DOCUMENT_TYPE_ATTRIBUTES = \"documentTypeAttributes\";\n final static String DOCUMENT_TYPE_ATTRIBUTE = \"documentTypeAttribute\";\n final static String AUTHORIZER = \"authorizer\";\n }\n\n public static class Cache {\n public static final String NAME = KewApiConstants.Namespaces.KEW_NAMESPACE_2_0 + \"/\" + DocumentType.Constants.TYPE_NAME;\n }\n}\n"},"meta":{"kind":"string","value":"{\n \"content_hash\": \"a8584e18c091378ae689c80eab598c31\",\n \"timestamp\": \"\",\n \"source\": \"github\",\n \"line_count\": 594,\n \"max_line_length\": 128,\n \"avg_line_length\": 33.42087542087542,\n \"alnum_prop\": 0.6600342534757203,\n \"repo_name\": \"kuali/rice-playground\",\n \"id\": \"6b7da5132b06b23c3c88881b0bc9f355f700babd\",\n \"size\": \"20473\",\n \"binary\": false,\n \"copies\": \"9\",\n \"ref\": \"refs/heads/master\",\n \"path\": \"rice-middleware/kew/api/src/main/java/org/kuali/rice/kew/api/doctype/DocumentType.java\",\n \"mode\": \"33188\",\n \"license\": \"apache-2.0\",\n \"language\": [\n {\n \"name\": \"CSS\",\n \"bytes\": \"582089\"\n },\n {\n \"name\": \"Groovy\",\n \"bytes\": \"2237959\"\n },\n {\n \"name\": \"Java\",\n \"bytes\": \"35408880\"\n },\n {\n \"name\": \"JavaScript\",\n \"bytes\": \"2665736\"\n },\n {\n \"name\": \"PHP\",\n \"bytes\": \"15766\"\n },\n {\n \"name\": \"Shell\",\n \"bytes\": \"13217\"\n },\n {\n \"name\": \"XSLT\",\n \"bytes\": \"107818\"\n }\n ],\n \"symlink_target\": \"\"\n}"}}},{"rowIdx":316,"cells":{"text":{"kind":"string","value":"\npackage co.cask.cdap.data2.transaction.stream;\n\nimport co.cask.cdap.api.flow.flowlet.StreamEvent;\nimport co.cask.cdap.data2.queue.ConsumerConfig;\nimport co.cask.cdap.data2.queue.DequeueResult;\nimport co.cask.cdap.proto.Id;\nimport co.cask.tephra.Transaction;\n\nimport java.io.IOException;\nimport java.util.Collection;\nimport java.util.concurrent.TimeUnit;\n\n/**\n * A {@link StreamConsumer} that forwards every methods to another {@link StreamConsumer}.\n */\npublic abstract class ForwardingStreamConsumer implements StreamConsumer {\n\n private final StreamConsumer delegate;\n\n protected ForwardingStreamConsumer(StreamConsumer delegate) {\n this.delegate = delegate;\n }\n\n @Override\n public Id.Stream getStreamId() {\n return delegate.getStreamId();\n }\n\n @Override\n public ConsumerConfig getConsumerConfig() {\n return delegate.getConsumerConfig();\n }\n\n @Override\n public DequeueResult poll(int maxEvents, long timeout,\n TimeUnit timeoutUnit) throws IOException, InterruptedException {\n return delegate.poll(maxEvents, timeout, timeoutUnit);\n }\n\n @Override\n public void close() throws IOException {\n delegate.close();\n }\n\n @Override\n public void startTx(Transaction tx) {\n delegate.startTx(tx);\n }\n\n @Override\n public void updateTx(Transaction tx) {\n delegate.updateTx(tx);\n }\n\n @Override\n public Collection getTxChanges() {\n return delegate.getTxChanges();\n }\n\n @Override\n public boolean commitTx() throws Exception {\n return delegate.commitTx();\n }\n\n @Override\n public void postTxCommit() {\n delegate.postTxCommit();\n }\n\n @Override\n public boolean rollbackTx() throws Exception {\n return delegate.rollbackTx();\n }\n\n @Override\n public String getTransactionAwareName() {\n return delegate.getTransactionAwareName();\n }\n}\n"},"meta":{"kind":"string","value":"{\n \"content_hash\": \"d5739c6eb672475dbe63ffb093a048c5\",\n \"timestamp\": \"\",\n \"source\": \"github\",\n \"line_count\": 80,\n \"max_line_length\": 105,\n \"avg_line_length\": 23.0625,\n \"alnum_prop\": 0.7224932249322493,\n \"repo_name\": \"chtyim/cdap\",\n \"id\": \"5e7c6f86c20183971e30f463dc7e8d2256629440\",\n \"size\": \"2442\",\n \"binary\": false,\n \"copies\": \"4\",\n \"ref\": \"refs/heads/develop\",\n \"path\": \"cdap-data-fabric/src/main/java/co/cask/cdap/data2/transaction/stream/ForwardingStreamConsumer.java\",\n \"mode\": \"33188\",\n \"license\": \"apache-2.0\",\n \"language\": [\n {\n \"name\": \"Batchfile\",\n \"bytes\": \"13173\"\n },\n {\n \"name\": \"CSS\",\n \"bytes\": \"219754\"\n },\n {\n \"name\": \"HTML\",\n \"bytes\": \"455678\"\n },\n {\n \"name\": \"Java\",\n \"bytes\": \"15847298\"\n },\n {\n \"name\": \"JavaScript\",\n \"bytes\": \"1180404\"\n },\n {\n \"name\": \"Python\",\n \"bytes\": \"102235\"\n },\n {\n \"name\": \"Ruby\",\n \"bytes\": \"3178\"\n },\n {\n \"name\": \"Scala\",\n \"bytes\": \"30340\"\n },\n {\n \"name\": \"Shell\",\n \"bytes\": \"195815\"\n }\n ],\n \"symlink_target\": \"\"\n}"}}},{"rowIdx":317,"cells":{"text":{"kind":"string","value":"package main // import \"github.com/hashicorp/consul/connect/certgen\"\n\nimport (\n\t\"flag\"\n\t\"fmt\"\n\t\"io/ioutil\"\n\t\"log\"\n\t\"os\"\n\n\t\"github.com/hashicorp/consul/agent/connect\"\n\t\"github.com/hashicorp/consul/agent/structs\"\n\t\"github.com/mitchellh/go-testing-interface\"\n)\n\nfunc main() {\n\tvar numCAs = 2\n\tvar services = []string{\"web\", \"db\", \"cache\"}\n\tvar outDir string\n\n\tflag.StringVar(&outDir, \"out-dir\", \"\",\n\t\t\"REQUIRED: the dir to write certificates to\")\n\tflag.Parse()\n\n\tif outDir == \"\" {\n\t\tflag.PrintDefaults()\n\t\tos.Exit(1)\n\t}\n\n\t// Create CA certs\n\tvar prevCA *structs.CARoot\n\tfor i := 1; i <= numCAs; i++ {\n\t\tca := connect.TestCA(&testing.RuntimeT{}, prevCA)\n\t\tprefix := fmt.Sprintf(\"%s/ca%d-ca\", outDir, i)\n\t\twriteFile(prefix+\".cert.pem\", ca.RootCert)\n\t\twriteFile(prefix+\".key.pem\", ca.SigningKey)\n\t\tif prevCA != nil {\n\t\t\tfname := fmt.Sprintf(\"%s/ca%d-xc-by-ca%d.cert.pem\", outDir, i, i-1)\n\t\t\twriteFile(fname, ca.SigningCert)\n\t\t}\n\t\tprevCA = ca\n\n\t\t// Create service certs for each CA\n\t\tfor _, svc := range services {\n\t\t\tcertPEM, keyPEM := connect.TestLeaf(&testing.RuntimeT{}, svc, ca)\n\t\t\tprefix := fmt.Sprintf(\"%s/ca%d-svc-%s\", outDir, i, svc)\n\t\t\twriteFile(prefix+\".cert.pem\", certPEM)\n\t\t\twriteFile(prefix+\".key.pem\", keyPEM)\n\t\t}\n\t}\n}\n\nfunc writeFile(name, content string) {\n\tfmt.Println(\"Writing \", name)\n\terr := ioutil.WriteFile(name, []byte(content), 0600)\n\tif err != nil {\n\t\tlog.Fatalf(\"failed writing file: %s\", err)\n\t}\n}\n"},"meta":{"kind":"string","value":"{\n \"content_hash\": \"3dd2f39a6314c7ea5944e09628494d8b\",\n \"timestamp\": \"\",\n \"source\": \"github\",\n \"line_count\": 58,\n \"max_line_length\": 70,\n \"avg_line_length\": 24.46551724137931,\n \"alnum_prop\": 0.6525722339675828,\n \"repo_name\": \"mhausenblas/burry.sh\",\n \"id\": \"89c424576199943dee9fb91818bfadc59e30fd97\",\n \"size\": \"2549\",\n \"binary\": false,\n \"copies\": \"4\",\n \"ref\": \"refs/heads/master\",\n \"path\": \"vendor/github.com/hashicorp/consul/connect/certgen/certgen.go\",\n \"mode\": \"33188\",\n \"license\": \"apache-2.0\",\n \"language\": [\n {\n \"name\": \"Go\",\n \"bytes\": \"37075\"\n },\n {\n \"name\": \"Makefile\",\n \"bytes\": \"472\"\n }\n ],\n \"symlink_target\": \"\"\n}"}}},{"rowIdx":318,"cells":{"text":{"kind":"string","value":"namespace Nancy.Templates.CSharp.AspNetHost\r\n{\r\n using Nancy;\r\n\r\n public class IndexModule : NancyModule\r\n {\r\n public IndexModule()\r\n {\r\n Get[\"/\"] = parameters => {\r\n return View[\"index\"];\r\n };\r\n }\r\n }\r\n}"},"meta":{"kind":"string","value":"{\n \"content_hash\": \"bb548290627b55ae594b1fec04f35d7a\",\n \"timestamp\": \"\",\n \"source\": \"github\",\n \"line_count\": 14,\n \"max_line_length\": 44,\n \"avg_line_length\": 19.642857142857142,\n \"alnum_prop\": 0.4618181818181818,\n \"repo_name\": \"tparnell8/Nancy.Templates\",\n \"id\": \"7cb2bc5aaca018a153213f9e2da274fe03027392\",\n \"size\": \"277\",\n \"binary\": false,\n \"copies\": \"5\",\n \"ref\": \"refs/heads/master\",\n \"path\": \"src/Nancy.Templates/Nancy.Templates.CSharp.AspNetHost/IndexModule.cs\",\n \"mode\": \"33188\",\n \"license\": \"mit\",\n \"language\": [\n {\n \"name\": \"C#\",\n \"bytes\": \"20170\"\n },\n {\n \"name\": \"HTML\",\n \"bytes\": \"3537\"\n },\n {\n \"name\": \"PowerShell\",\n \"bytes\": \"2642\"\n }\n ],\n \"symlink_target\": \"\"\n}"}}},{"rowIdx":319,"cells":{"text":{"kind":"string","value":"/* eslint-disable import/extensions */\nconst request = require('request')\nconst helpers = require('../../../lib/test_helpers.js')\n\ndescribe('cyclecounter', () => {\n // The only thing that changes is the form attribute, so why not just re-use the object\n const fieldsToCheckFor = ['DayCount', 'YearCount', 'Time', 'Date']\n\n it('should return an array of objects containing correct fields', (done) => {\n const params = helpers.testRequestParams('/cyclecounter')\n const resultHandler = helpers.testRequestHandlerForFields(done, fieldsToCheckFor)\n request(params, resultHandler)\n })\n})\n"},"meta":{"kind":"string","value":"{\n \"content_hash\": \"82272f756d1e875dd9fa161593aa811b\",\n \"timestamp\": \"\",\n \"source\": \"github\",\n \"line_count\": 14,\n \"max_line_length\": 89,\n \"avg_line_length\": 42.5,\n \"alnum_prop\": 0.7142857142857143,\n \"repo_name\": \"apis-is/apis\",\n \"id\": \"a3bf1a1ef04b8d0846b2b4e0ef2a0fbc40e7eda4\",\n \"size\": \"595\",\n \"binary\": false,\n \"copies\": \"1\",\n \"ref\": \"refs/heads/master\",\n \"path\": \"endpoints/cyclecounter/tests/integration_test.js\",\n \"mode\": \"33188\",\n \"license\": \"mit\",\n \"language\": [\n {\n \"name\": \"JavaScript\",\n \"bytes\": \"160301\"\n }\n ],\n \"symlink_target\": \"\"\n}"}}},{"rowIdx":320,"cells":{"text":{"kind":"string","value":"\n#import \"TiProxy.h\"\n\n#ifdef USE_TI_UIIPAD\n\n// if we use a split window, we need to include the ipad popover\n#ifdef USE_TI_UIIPADSPLITWINDOW\n#ifndef USE_TI_UIIPADPOPOVER\n#define USE_TI_UIIPADPOPOVER\n#endif\n#endif\n\n#ifdef USE_TI_UIIPADPOPOVER\n\t#import \"TiUIiPadPopoverProxy.h\"\n#endif\n#ifdef USE_TI_UIIPADSPLITWINDOW\n\t#import \"TiUIiPadSplitWindowProxy.h\"\n#endif\n#ifdef USE_TI_UIIPADDOCUMENTVIEWER\n\t#import \"TiUIiOSDocumentViewerProxy.h\"\n#endif\n\n\n\n@interface TiUIiPadProxy : TiProxy {\n\n@private\n\n}\n\n#ifdef USE_TI_UIIPADPOPOVER\n@property(nonatomic,readonly) NSNumber* POPOVER_ARROW_DIRECTION_UP;\n@property(nonatomic,readonly) NSNumber* POPOVER_ARROW_DIRECTION_DOWN;\n@property(nonatomic,readonly) NSNumber* POPOVER_ARROW_DIRECTION_LEFT;\n@property(nonatomic,readonly) NSNumber* POPOVER_ARROW_DIRECTION_RIGHT;\n@property(nonatomic,readonly) NSNumber* POPOVER_ARROW_DIRECTION_ANY;\n@property(nonatomic,readonly) NSNumber* POPOVER_ARROW_DIRECTION_UNKNOWN;\n\n-(id)createPopover:(id)args;\n#endif\n\n#ifdef USE_TI_UIIPADSPLITWINDOW\n-(id)createSplitWindow:(id)args;\n#endif\n\n#ifdef USE_TI_UIIPADDOCUMENTVIEWER\n-(id)createDocumentViewer:(id)args;\n#endif\n\n@end\n\n\n#endif\n"},"meta":{"kind":"string","value":"{\n \"content_hash\": \"2fdf07dced9e95c00a8dae85d8887765\",\n \"timestamp\": \"\",\n \"source\": \"github\",\n \"line_count\": 53,\n \"max_line_length\": 72,\n \"avg_line_length\": 21.67924528301887,\n \"alnum_prop\": 0.7928633594429939,\n \"repo_name\": \"AppWerft/KrickelKrake\",\n \"id\": \"1b74f61459908cbcc0239b595e1bc040757ea2fd\",\n \"size\": \"1471\",\n \"binary\": false,\n \"copies\": \"3\",\n \"ref\": \"refs/heads/master\",\n \"path\": \"build/iphone/Classes/TiUIiPadProxy.h\",\n \"mode\": \"33188\",\n \"license\": \"apache-2.0\",\n \"language\": [\n {\n \"name\": \"C\",\n \"bytes\": \"140292\"\n },\n {\n \"name\": \"C++\",\n \"bytes\": \"56872\"\n },\n {\n \"name\": \"D\",\n \"bytes\": \"893244\"\n },\n {\n \"name\": \"JavaScript\",\n \"bytes\": \"18548\"\n },\n {\n \"name\": \"Objective-C\",\n \"bytes\": \"3325780\"\n },\n {\n \"name\": \"Shell\",\n \"bytes\": \"132\"\n }\n ],\n \"symlink_target\": \"\"\n}"}}},{"rowIdx":321,"cells":{"text":{"kind":"string","value":"mysql_error()\n--SKIPIF--\n\n--FILE--\n') == 1) && !is_unicode($tmp)) {\n\tprintf(\"[007] Expecting Unicode error message!\\n\");\n\tvar_inspect($tmp);\n}\n\nmysql_close($link);\n\nvar_dump(mysql_error($link));\n\nif ($link = @mysql_connect($host . '_unknown', $user . '_unknown', $passwd, true)) {\n\tprintf(\"[008] Can connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\\n\",\n\t\t$host . '_unknown', $user . '_unknown', $db, $port, $socket);\n}\nif ('' == mysql_error())\n\tprintf(\"[009] Connect error should have been set\\n\");\n\nprint \"done!\";\n?>\n--CLEAN--\n\n--EXPECTF--\nDeprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in %s on line %d\n\nWarning: mysql_error(): %d is not a valid MySQL-Link resource in %s on line %d\nbool(false)\ndone!\n"},"meta":{"kind":"string","value":"{\n \"content_hash\": \"32db5ffe75d4618e1b9b8e21668dfcda\",\n \"timestamp\": \"\",\n \"source\": \"github\",\n \"line_count\": 68,\n \"max_line_length\": 141,\n \"avg_line_length\": 33.470588235294116,\n \"alnum_prop\": 0.6221441124780316,\n \"repo_name\": \"anindoasaha/php_nginx\",\n \"id\": \"a2cf7e003430ae5385c0b225511d10b591141eec\",\n \"size\": \"2285\",\n \"binary\": false,\n \"copies\": \"5\",\n \"ref\": \"refs/heads/master\",\n \"path\": \"php-5.5.16/ext/mysql/tests/mysql_error.phpt\",\n \"mode\": \"33188\",\n \"license\": \"apache-2.0\",\n \"language\": [\n {\n \"name\": \"Assembly\",\n \"bytes\": \"1050\"\n },\n {\n \"name\": \"Awk\",\n \"bytes\": \"15007\"\n },\n {\n \"name\": \"Bison\",\n \"bytes\": \"69182\"\n },\n {\n \"name\": \"C\",\n \"bytes\": \"53217026\"\n },\n {\n \"name\": \"C++\",\n \"bytes\": \"2492956\"\n },\n {\n \"name\": \"CMake\",\n \"bytes\": \"28491\"\n },\n {\n \"name\": \"DTrace\",\n \"bytes\": \"2194\"\n },\n {\n \"name\": \"GAP\",\n \"bytes\": \"4\"\n },\n {\n \"name\": \"GLSL\",\n \"bytes\": \"239\"\n },\n {\n \"name\": \"Groff\",\n \"bytes\": \"504611\"\n },\n {\n \"name\": \"HTML\",\n \"bytes\": \"569653\"\n },\n {\n \"name\": \"JavaScript\",\n \"bytes\": \"108172\"\n },\n {\n \"name\": \"Makefile\",\n \"bytes\": \"56241\"\n },\n {\n \"name\": \"Nginx\",\n \"bytes\": \"3817\"\n },\n {\n \"name\": \"Objective-C\",\n \"bytes\": \"7678\"\n },\n {\n \"name\": \"PHP\",\n \"bytes\": \"24647829\"\n },\n {\n \"name\": \"Pascal\",\n \"bytes\": \"26071\"\n },\n {\n \"name\": \"Perl\",\n \"bytes\": \"39455\"\n },\n {\n \"name\": \"Python\",\n \"bytes\": \"165\"\n },\n {\n \"name\": \"Ruby\",\n \"bytes\": \"357716\"\n },\n {\n \"name\": \"Shell\",\n \"bytes\": \"731299\"\n },\n {\n \"name\": \"VimL\",\n \"bytes\": \"32089\"\n },\n {\n \"name\": \"XS\",\n \"bytes\": \"21306\"\n },\n {\n \"name\": \"XSLT\",\n \"bytes\": \"7946\"\n }\n ],\n \"symlink_target\": \"\"\n}"}}},{"rowIdx":322,"cells":{"text":{"kind":"string","value":"import sys\n\nnumber = 0\nwhile number >= 0:\n print \"Enter number:\"\n number = float(sys.stdin.readline())\n if number >= 0:\n if number % 2 == 0:\n print \"Even\"\n else:\n print \"Odd\"\nprint \"Bye\"\n"},"meta":{"kind":"string","value":"{\n \"content_hash\": \"82e55ed33e6b245aa18d90b9fe6c3a65\",\n \"timestamp\": \"\",\n \"source\": \"github\",\n \"line_count\": 12,\n \"max_line_length\": 40,\n \"avg_line_length\": 19.333333333333332,\n \"alnum_prop\": 0.5129310344827587,\n \"repo_name\": \"nathano/Perl_to_Python_Converter\",\n \"id\": \"6adfe6c6e9ace17ee4fbdb2e555bacf164d19366\",\n \"size\": \"256\",\n \"binary\": false,\n \"copies\": \"1\",\n \"ref\": \"refs/heads/master\",\n \"path\": \"examples/subset4/odd0.py\",\n \"mode\": \"33188\",\n \"license\": \"mit\",\n \"language\": [\n {\n \"name\": \"Perl\",\n \"bytes\": \"20894\"\n },\n {\n \"name\": \"Python\",\n \"bytes\": \"2735\"\n }\n ],\n \"symlink_target\": \"\"\n}"}}},{"rowIdx":323,"cells":{"text":{"kind":"string","value":" content::RegisterIPCLogger(msg_id, logger)\n#include \"content/shell/common/shell_messages.h\"\n#endif\n\n#if defined(OS_ANDROID)\n#include \"base/posix/global_descriptors.h\"\n#include \"content/shell/android/shell_descriptors.h\"\n#endif\n\n#if defined(OS_MACOSX)\n#include \"base/mac/os_crash_dumps.h\"\n#include \"components/crash/app/breakpad_mac.h\"\n#include \"content/shell/app/paths_mac.h\"\n#include \"content/shell/app/shell_main_delegate_mac.h\"\n#endif // OS_MACOSX\n\n#if defined(OS_WIN)\n#include \n#include \n#include \"base/logging_win.h\"\n#include \"components/crash/app/breakpad_win.h\"\n#include \"content/shell/common/v8_breakpad_support_win.h\"\n#endif\n\n#if defined(OS_POSIX) && !defined(OS_MACOSX)\n#include \"components/crash/app/breakpad_linux.h\"\n#endif\n\nnamespace {\n\nbase::LazyInstance::Leaky\n g_shell_crash_client = LAZY_INSTANCE_INITIALIZER;\n\n#if defined(OS_WIN)\n// If \"Content Shell\" doesn't show up in your list of trace providers in\n// Sawbuck, add these registry entries to your machine (NOTE the optional\n// Wow6432Node key for x64 machines):\n// 1. Find: HKLM\\SOFTWARE\\[Wow6432Node\\]Google\\Sawbuck\\Providers\n// 2. Add a subkey with the name \"{6A3E50A4-7E15-4099-8413-EC94D8C2A4B6}\"\n// 3. Add these values:\n// \"default_flags\"=dword:00000001\n// \"default_level\"=dword:00000004\n// @=\"Content Shell\"\n\n// {6A3E50A4-7E15-4099-8413-EC94D8C2A4B6}\nconst GUID kContentShellProviderName = {\n 0x6a3e50a4, 0x7e15, 0x4099,\n { 0x84, 0x13, 0xec, 0x94, 0xd8, 0xc2, 0xa4, 0xb6 } };\n#endif\n\nvoid InitLogging() {\n base::FilePath log_filename;\n PathService::Get(base::DIR_EXE, &log_filename);\n log_filename = log_filename.AppendASCII(\"content_shell.log\");\n logging::LoggingSettings settings;\n settings.logging_dest = logging::LOG_TO_ALL;\n settings.log_file = log_filename.value().c_str();\n settings.delete_old = logging::DELETE_OLD_LOG_FILE;\n logging::InitLogging(settings);\n logging::SetLogItems(true, true, true, true);\n}\n\n} // namespace\n\nnamespace content {\n\nShellMainDelegate::ShellMainDelegate() {\n}\n\nShellMainDelegate::~ShellMainDelegate() {\n}\n\nbool ShellMainDelegate::BasicStartupComplete(int* exit_code) {\n base::CommandLine& command_line = *base::CommandLine::ForCurrentProcess();\n\n // \"dump-render-tree\" has been renamed to \"run-layout-test\", but the old\n // flag name is still used in some places, so this check will remain until\n // it is phased out entirely.\n if (command_line.HasSwitch(switches::kDumpRenderTree))\n command_line.AppendSwitch(switches::kRunLayoutTest);\n\n#if defined(OS_WIN)\n // Enable trace control and transport through event tracing for Windows.\n logging::LogEventProvider::Initialize(kContentShellProviderName);\n\n v8_breakpad_support::SetUp();\n#endif\n#if defined(OS_MACOSX)\n // Needs to happen before InitializeResourceBundle() and before\n // BlinkTestPlatformInitialize() are called.\n OverrideFrameworkBundlePath();\n OverrideChildProcessPath();\n EnsureCorrectResolutionSettings();\n#endif // OS_MACOSX\n\n InitLogging();\n if (command_line.HasSwitch(switches::kCheckLayoutTestSysDeps)) {\n // If CheckLayoutSystemDeps succeeds, we don't exit early. Instead we\n // continue and try to load the fonts in BlinkTestPlatformInitialize\n // below, and then try to bring up the rest of the content module.\n if (!CheckLayoutSystemDeps()) {\n if (exit_code)\n *exit_code = 1;\n return true;\n }\n }\n\n if (command_line.HasSwitch(switches::kRunLayoutTest)) {\n EnableBrowserLayoutTestMode();\n\n command_line.AppendSwitch(switches::kProcessPerTab);\n command_line.AppendSwitch(switches::kEnableLogging);\n command_line.AppendSwitch(switches::kAllowFileAccessFromFiles);\n // only default to osmesa if the flag isn't already specified.\n if (!command_line.HasSwitch(switches::kUseGL)) {\n command_line.AppendSwitchASCII(switches::kUseGL,\n gfx::kGLImplementationOSMesaName);\n }\n command_line.AppendSwitch(switches::kSkipGpuDataLoading);\n command_line.AppendSwitchASCII(switches::kTouchEvents,\n switches::kTouchEventsEnabled);\n command_line.AppendSwitchASCII(switches::kForceDeviceScaleFactor, \"1.0\");\n#if defined(OS_ANDROID)\n command_line.AppendSwitch(\n switches::kDisableGestureRequirementForMediaPlayback);\n#endif\n\n if (!command_line.HasSwitch(switches::kStableReleaseMode)) {\n command_line.AppendSwitch(\n switches::kEnableExperimentalWebPlatformFeatures);\n }\n\n if (!command_line.HasSwitch(switches::kEnableThreadedCompositing)) {\n command_line.AppendSwitch(switches::kDisableThreadedCompositing);\n command_line.AppendSwitch(cc::switches::kDisableThreadedAnimation);\n // Text blobs are normally disabled when kDisableImplSidePainting is\n // present to ensure correct LCD behavior, but for layout tests we want\n // them on because LCD is always suppressed.\n command_line.AppendSwitch(switches::kForceTextBlobs);\n }\n\n if (!command_line.HasSwitch(switches::kEnableDisplayList2dCanvas)) {\n command_line.AppendSwitch(switches::kDisableDisplayList2dCanvas);\n }\n\n command_line.AppendSwitch(switches::kEnableInbandTextTracks);\n command_line.AppendSwitch(switches::kMuteAudio);\n\n // TODO: crbug.com/311404 Make layout tests work w/ delegated renderer.\n command_line.AppendSwitch(switches::kDisableDelegatedRenderer);\n command_line.AppendSwitch(cc::switches::kCompositeToMailbox);\n\n command_line.AppendSwitch(switches::kEnablePreciseMemoryInfo);\n\n command_line.AppendSwitchASCII(switches::kHostResolverRules,\n \"MAP *.test 127.0.0.1\");\n\n // TODO(wfh): crbug.com/295137 Remove this when NPAPI is gone.\n command_line.AppendSwitch(switches::kEnableNpapi);\n\n // Unless/until WebM files are added to the media layout tests, we need to\n // avoid removing MP4/H264/AAC so that layout tests can run on Android.\n#if !defined(OS_ANDROID)\n net::RemoveProprietaryMediaTypesAndCodecsForTests();\n#endif\n\n if (!BlinkTestPlatformInitialize()) {\n if (exit_code)\n *exit_code = 1;\n return true;\n }\n }\n SetContentClient(&content_client_);\n return false;\n}\n\nvoid ShellMainDelegate::PreSandboxStartup() {\n#if defined(ARCH_CPU_ARM_FAMILY) && (defined(OS_ANDROID) || defined(OS_LINUX))\n // Create an instance of the CPU class to parse /proc/cpuinfo and cache\n // cpu_brand info.\n base::CPU cpu_info;\n#endif\n if (base::CommandLine::ForCurrentProcess()->HasSwitch(\n switches::kEnableCrashReporter)) {\n std::string process_type =\n base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII(\n switches::kProcessType);\n crash_reporter::SetCrashReporterClient(g_shell_crash_client.Pointer());\n#if defined(OS_MACOSX)\n base::mac::DisableOSCrashDumps();\n breakpad::InitCrashReporter(process_type);\n breakpad::InitCrashProcessInfo(process_type);\n#elif defined(OS_POSIX) && !defined(OS_MACOSX)\n if (process_type != switches::kZygoteProcess) {\n#if defined(OS_ANDROID)\n if (process_type.empty())\n breakpad::InitCrashReporter(process_type);\n else\n breakpad::InitNonBrowserCrashReporterForAndroid(process_type);\n#else\n breakpad::InitCrashReporter(process_type);\n#endif\n }\n#elif defined(OS_WIN)\n UINT new_flags =\n SEM_FAILCRITICALERRORS | SEM_NOGPFAULTERRORBOX | SEM_NOOPENFILEERRORBOX;\n UINT existing_flags = SetErrorMode(new_flags);\n SetErrorMode(existing_flags | new_flags);\n breakpad::InitCrashReporter(process_type);\n#endif\n }\n\n InitializeResourceBundle();\n}\n\nint ShellMainDelegate::RunProcess(\n const std::string& process_type,\n const MainFunctionParams& main_function_params) {\n if (!process_type.empty())\n return -1;\n\n#if !defined(OS_ANDROID)\n // Android stores the BrowserMainRunner instance as a scoped member pointer\n // on the ShellMainDelegate class because of different object lifetime.\n scoped_ptr browser_runner_;\n#endif\n\n browser_runner_.reset(BrowserMainRunner::Create());\n base::CommandLine& command_line = *base::CommandLine::ForCurrentProcess();\n return command_line.HasSwitch(switches::kRunLayoutTest) ||\n command_line.HasSwitch(switches::kCheckLayoutTestSysDeps)\n ? LayoutTestBrowserMain(main_function_params, browser_runner_)\n : ShellBrowserMain(main_function_params, browser_runner_);\n}\n\n#if defined(OS_POSIX) && !defined(OS_ANDROID) && !defined(OS_MACOSX)\nvoid ShellMainDelegate::ZygoteForked() {\n if (base::CommandLine::ForCurrentProcess()->HasSwitch(\n switches::kEnableCrashReporter)) {\n std::string process_type =\n base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII(\n switches::kProcessType);\n breakpad::InitCrashReporter(process_type);\n }\n}\n#endif\n\nvoid ShellMainDelegate::InitializeResourceBundle() {\n#if defined(OS_ANDROID)\n // In the Android case, the renderer runs with a different UID and can never\n // access the file system. So we are passed a file descriptor to the\n // ResourceBundle pak at launch time.\n int pak_fd =\n base::GlobalDescriptors::GetInstance()->MaybeGet(kShellPakDescriptor);\n if (pak_fd >= 0) {\n // This is clearly wrong. See crbug.com/330930\n ui::ResourceBundle::InitSharedInstanceWithPakFileRegion(\n base::File(pak_fd), base::MemoryMappedFile::Region::kWholeFile);\n ResourceBundle::GetSharedInstance().AddDataPackFromFile(\n base::File(pak_fd), ui::SCALE_FACTOR_100P);\n return;\n }\n#endif\n\n base::FilePath pak_file;\n#if defined(OS_MACOSX)\n pak_file = GetResourcesPakFilePath();\n#else\n base::FilePath pak_dir;\n\n#if defined(OS_ANDROID)\n bool got_path = PathService::Get(base::DIR_ANDROID_APP_DATA, &pak_dir);\n DCHECK(got_path);\n pak_dir = pak_dir.Append(FILE_PATH_LITERAL(\"paks\"));\n#else\n PathService::Get(base::DIR_MODULE, &pak_dir);\n#endif\n\n pak_file = pak_dir.Append(FILE_PATH_LITERAL(\"content_shell.pak\"));\n#endif\n ui::ResourceBundle::InitSharedInstanceWithPakPath(pak_file);\n}\n\nContentBrowserClient* ShellMainDelegate::CreateContentBrowserClient() {\n browser_client_.reset(base::CommandLine::ForCurrentProcess()->HasSwitch(\n switches::kRunLayoutTest)\n ? new LayoutTestContentBrowserClient\n : new ShellContentBrowserClient);\n\n return browser_client_.get();\n}\n\nContentRendererClient* ShellMainDelegate::CreateContentRendererClient() {\n renderer_client_.reset(base::CommandLine::ForCurrentProcess()->HasSwitch(\n switches::kRunLayoutTest)\n ? new LayoutTestContentRendererClient\n : new ShellContentRendererClient);\n\n return renderer_client_.get();\n}\n\n} // namespace content\n"},"meta":{"kind":"string","value":"{\n \"content_hash\": \"8599341047f23893ef94be370280495e\",\n \"timestamp\": \"\",\n \"source\": \"github\",\n \"line_count\": 302,\n \"max_line_length\": 80,\n \"avg_line_length\": 35.794701986754966,\n \"alnum_prop\": 0.7147086031452359,\n \"repo_name\": \"mou4e/zirconium\",\n \"id\": \"ee1878ce1a7bad22e42cd6ab38c42dd5c3137ad7\",\n \"size\": \"12638\",\n \"binary\": false,\n \"copies\": \"2\",\n \"ref\": \"refs/heads/master\",\n \"path\": \"content/shell/app/shell_main_delegate.cc\",\n \"mode\": \"33188\",\n \"license\": \"bsd-3-clause\",\n \"language\": [\n {\n \"name\": \"AppleScript\",\n \"bytes\": \"6973\"\n },\n {\n \"name\": \"Arduino\",\n \"bytes\": \"464\"\n },\n {\n \"name\": \"Assembly\",\n \"bytes\": \"23829\"\n },\n {\n \"name\": \"C\",\n \"bytes\": \"4115478\"\n },\n {\n \"name\": \"C++\",\n \"bytes\": \"233013312\"\n },\n {\n \"name\": \"CSS\",\n \"bytes\": \"931463\"\n },\n {\n \"name\": \"Emacs Lisp\",\n \"bytes\": \"988\"\n },\n {\n \"name\": \"HTML\",\n \"bytes\": \"28131619\"\n },\n {\n \"name\": \"Java\",\n \"bytes\": \"9810569\"\n },\n {\n \"name\": \"JavaScript\",\n \"bytes\": \"19670133\"\n },\n {\n \"name\": \"Makefile\",\n \"bytes\": \"68017\"\n },\n {\n \"name\": \"Objective-C\",\n \"bytes\": \"1475873\"\n },\n {\n \"name\": \"Objective-C++\",\n \"bytes\": \"8640851\"\n },\n {\n \"name\": \"PHP\",\n \"bytes\": \"97817\"\n },\n {\n \"name\": \"PLpgSQL\",\n \"bytes\": \"171186\"\n },\n {\n \"name\": \"Perl\",\n \"bytes\": \"63937\"\n },\n {\n \"name\": \"Protocol Buffer\",\n \"bytes\": \"456460\"\n },\n {\n \"name\": \"Python\",\n \"bytes\": \"7958623\"\n },\n {\n \"name\": \"Shell\",\n \"bytes\": \"477153\"\n },\n {\n \"name\": \"Standard ML\",\n \"bytes\": \"4965\"\n },\n {\n \"name\": \"XSLT\",\n \"bytes\": \"418\"\n },\n {\n \"name\": \"nesC\",\n \"bytes\": \"18347\"\n }\n ],\n \"symlink_target\": \"\"\n}"}}},{"rowIdx":324,"cells":{"text":{"kind":"string","value":"Goal: Show how to use Beam Notebooks for interactive development of pipelines and use the Dataframes API\n\n## Demo Setup and Notes\n\nTo set up this demo, you will need to create a Dataflow Notebooks environment and clone the training-data-analyst repo. This can be done in advance of the demo for the sake of time, but should only take a couple of minutes if done live. \n\nTo create the Dataflow Notebooks environment go to the Google Cloud Console, click on the main menu, and then go to **Dataflow > Workbench**. Once in the Dataflow Notebooks UI, click on **New Instance** and select **Apache Beam > Without GPUs**. You do not need to edit anything else about the instance, but just need to click **Create**.\n\nOnce the notebook is ready, you can click on **Open JupyterLab** to tunnel into the JupyterLab interface.\n\n![Dataflow Notebooks UI](img/notebook_ui.png)\n\nOnce in the notebook interface, on the Launcher select **Terminal**. \n\n![JupyterLab Launcher](img/launcher.png)\n\nIn the new terminal session run the following commands to clone the repo,\n\n```bash\ncd home/jupyter\ngit clone https://github.com/GoogleCloudPlatform/training-data-analyst.git\n```\n\nOnce the repo is cloned, in the file browser go to **training-data-analyst > courses > dataflow > demos > beam_notebooks** and open the **beam_notebooks_demo.ipynb** file. When asked, select **Apache Beam 2.40.0 for Python 3** as the kernel.\n\nStep through the notebook cell by cell to finish the demo!\n\n**Note**: Be sure to run the notebook cell by cell and not run the entire notebook in advance. One of the cells is supposed to return an error to discuss a certain concept.\n"},"meta":{"kind":"string","value":"{\n \"content_hash\": \"3ae434b2a5030ee9bc85bad9fe9ad96f\",\n \"timestamp\": \"\",\n \"source\": \"github\",\n \"line_count\": 28,\n \"max_line_length\": 338,\n \"avg_line_length\": 58.285714285714285,\n \"alnum_prop\": 0.7640931372549019,\n \"repo_name\": \"GoogleCloudPlatform/training-data-analyst\",\n \"id\": \"d57b6716ca42f7df309751d7ae2e3acdf3ea5c53\",\n \"size\": \"1675\",\n \"binary\": false,\n \"copies\": \"1\",\n \"ref\": \"refs/heads/master\",\n \"path\": \"courses/dataflow/demos/beam_notebooks/README.md\",\n \"mode\": \"33188\",\n \"license\": \"apache-2.0\",\n \"language\": [\n {\n \"name\": \"C\",\n \"bytes\": \"39536\"\n },\n {\n \"name\": \"C#\",\n \"bytes\": \"23445\"\n },\n {\n \"name\": \"C++\",\n \"bytes\": \"30926\"\n },\n {\n \"name\": \"CSS\",\n \"bytes\": \"53087\"\n },\n {\n \"name\": \"Dockerfile\",\n \"bytes\": \"90856\"\n },\n {\n \"name\": \"Go\",\n \"bytes\": \"93755\"\n },\n {\n \"name\": \"HCL\",\n \"bytes\": \"73891\"\n },\n {\n \"name\": \"HTML\",\n \"bytes\": \"2342167\"\n },\n {\n \"name\": \"Java\",\n \"bytes\": \"2441030\"\n },\n {\n \"name\": \"JavaScript\",\n \"bytes\": \"3957504\"\n },\n {\n \"name\": \"Jinja\",\n \"bytes\": \"257585\"\n },\n {\n \"name\": \"Jsonnet\",\n \"bytes\": \"5696\"\n },\n {\n \"name\": \"Jupyter Notebook\",\n \"bytes\": \"242016061\"\n },\n {\n \"name\": \"Makefile\",\n \"bytes\": \"12642\"\n },\n {\n \"name\": \"PigLatin\",\n \"bytes\": \"11558\"\n },\n {\n \"name\": \"Pug\",\n \"bytes\": \"457977\"\n },\n {\n \"name\": \"Python\",\n \"bytes\": \"18543833\"\n },\n {\n \"name\": \"R\",\n \"bytes\": \"68\"\n },\n {\n \"name\": \"Scala\",\n \"bytes\": \"27161\"\n },\n {\n \"name\": \"Shell\",\n \"bytes\": \"763259\"\n },\n {\n \"name\": \"TypeScript\",\n \"bytes\": \"66858\"\n }\n ],\n \"symlink_target\": \"\"\n}"}}},{"rowIdx":325,"cells":{"text":{"kind":"string","value":"require 'spec_helper'\n\ndescribe RailsTemplater::Templater do\n\n let(:group) { 'sample' }\n\n its(:fixture_replacement) { should be_kind_of(RailsTemplater::FixtureReplacement) }\n its(:javascript_framework) { should be_kind_of(RailsTemplater::JavaScriptFramework) }\n its(:orm) { should be_kind_of(RailsTemplater::Orm) }\n its(:testing_framework) { should be_kind_of(RailsTemplater::TestingFramework) }\n\n it \"generates a recipe path based on a name\" do\n subject.recipe(\"mongoid\").should == File.expand_path('recipes/mongoid.rb', TEMPLATE_FRAMEWORK_PATH)\n end\n\n it \"generates a snippet path\" do\n subject.snippet_path(\"cucumber\").should == File.expand_path('snippets/cucumber', TEMPLATE_FRAMEWORK_PATH)\n end\n\n it \"generates a template path\" do\n subject.template_path(\"haml\").should == File.expand_path('templates/haml', TEMPLATE_FRAMEWORK_PATH)\n end\n\n describe \"#load_snippet\" do\n\n let(:snippet_name) { 'sample_snippet' }\n\n before(:each) do\n subject.stub(:snippet_path) { FIXTURE_PATH }\n end\n\n it \"loads a snippet\" do\n subject.load_snippet(snippet_name, group).should == load_fixture(snippet_name)\n end\n\n end\n\n describe \"#load_template\" do\n\n let(:template_name) { 'sample_template.rb' }\n\n before(:each) do\n subject.stub(:template_path) { FIXTURE_PATH }\n end\n\n it \"loads a template\" do\n subject.load_template(template_name, group).should == load_fixture(template_name)\n end\n\n end\n\n describe \"#post_bundler\" do\n\n it \"adds blocks to post_bundler_strategies\" do\n subject.post_bundler do\n \"Hi\"\n end\n subject.post_bundler_strategies.should have(1).item\n result = subject.post_bundler_strategies.first.call\n result.should == 'Hi'\n end\n\n end\n\nend\n"},"meta":{"kind":"string","value":"{\n \"content_hash\": \"e4f2370e2466ceed29e876ac66caa1ae\",\n \"timestamp\": \"\",\n \"source\": \"github\",\n \"line_count\": 65,\n \"max_line_length\": 109,\n \"avg_line_length\": 26.83076923076923,\n \"alnum_prop\": 0.6863532110091743,\n \"repo_name\": \"kfaustino/rails-templater\",\n \"id\": \"dc578c19f315a076a2abd5f98ec9186445e7d94e\",\n \"size\": \"1744\",\n \"binary\": false,\n \"copies\": \"2\",\n \"ref\": \"refs/heads/master\",\n \"path\": \"spec/rails_templater/templater_spec.rb\",\n \"mode\": \"33188\",\n \"license\": \"mit\",\n \"language\": [\n {\n \"name\": \"Ruby\",\n \"bytes\": \"23019\"\n }\n ],\n \"symlink_target\": \"\"\n}"}}},{"rowIdx":326,"cells":{"text":{"kind":"string","value":"\n Device ID\n\n"},"meta":{"kind":"string","value":"{\n \"content_hash\": \"3d565d4d5bd4ff465f3b8c97e013d9b6\",\n \"timestamp\": \"\",\n \"source\": \"github\",\n \"line_count\": 3,\n \"max_line_length\": 46,\n \"avg_line_length\": 24,\n \"alnum_prop\": 0.6805555555555556,\n \"repo_name\": \"joststricker/device-id\",\n \"id\": \"36e9ddfb4251fe99ad759afd49e6d968efafb4f7\",\n \"size\": \"72\",\n \"binary\": false,\n \"copies\": \"1\",\n \"ref\": \"refs/heads/master\",\n \"path\": \"app/src/main/res/values/strings.xml\",\n \"mode\": \"33188\",\n \"license\": \"mit\",\n \"language\": [\n {\n \"name\": \"Java\",\n \"bytes\": \"2693\"\n }\n ],\n \"symlink_target\": \"\"\n}"}}},{"rowIdx":327,"cells":{"text":{"kind":"string","value":"\"\"\"\nSnap7 client used for connection to a siemens 7 server.\n\"\"\"\nimport re\nimport logging\nfrom ctypes import byref, create_string_buffer, sizeof\nfrom ctypes import Array, c_byte, c_char_p, c_int, c_int32, c_uint16, c_ulong, c_void_p\nfrom datetime import datetime\nfrom typing import List, Optional, Tuple, Union\n\nfrom .common import check_error, ipv4, load_library\nfrom .types import S7SZL, Areas, BlocksList, S7CpInfo, S7CpuInfo, S7DataItem\nfrom .types import S7OrderCode, S7Protection, S7SZLList, TS7BlockInfo, WordLen\nfrom .types import S7Object, buffer_size, buffer_type, cpu_statuses, param_types\nfrom .types import S7CpuInfo, RemotePort, wordlen_to_ctypes, block_types\nlogger = logging.getLogger(__name__)\n\n\ndef error_wrap(func):\n \"\"\"Parses a s7 error code returned the decorated function.\"\"\"\n\n def f(*args, **kw):\n code = func(*args, **kw)\n check_error(code, context=\"client\")\n\n return f\n\n\nclass Client:\n \"\"\"\n A snap7 client\n\n Examples:\n >>> import snap7\n >>> client = snap7.client.Client()\n >>> client.connect(\"127.0.0.1\", 0, 0, 1012)\n >>> client.get_connected()\n True\n >>> data = client.db_read(1, 0, 4)\n >>> data\n bytearray(b\"\\\\x00\\\\x00\\\\x00\\\\x00\")\n >>> data[3] = 0b00000001\n >>> data\n bytearray(b'\\\\x00\\\\x00\\\\x00\\\\x01')\n >>> client.db_write(1, 0, data)\n \"\"\"\n\n def __init__(self, lib_location: Optional[str] = None):\n \"\"\"Creates a new `Client` instance.\n\n Args:\n lib_location: Full path to the snap7.dll file. Optional.\n\n Examples:\n >>> import snap7\n >>> client = snap7.client.Client() # If the `snap7.dll` file is in the path location\n >>> client = snap7.client.Client(lib_location=\"/path/to/snap7.dll\") # If the `snap7.dll` file is in another location\n >>> client\n \n \"\"\"\n self._read_callback = None\n self._callback = None\n self._pointer = None\n self._library = load_library(lib_location)\n self.create()\n\n def __del__(self):\n self.destroy()\n\n def create(self):\n \"\"\"Creates a SNAP7 client.\n \"\"\"\n logger.info(\"creating snap7 client\")\n self._library.Cli_Create.restype = c_void_p\n self._pointer = S7Object(self._library.Cli_Create())\n\n def destroy(self) -> Optional[int]:\n \"\"\"Destroys the Client object.\n\n Returns:\n Error code from snap7 library.\n\n Examples:\n >>> client.destroy()\n 640719840\n \"\"\"\n logger.info(\"destroying snap7 client\")\n if self._pointer:\n return self._library.Cli_Destroy(byref(self._pointer))\n self._pointer = None\n return None\n\n def plc_stop(self) -> int:\n \"\"\"Puts the CPU in STOP mode\n\n Returns:\n Error code from snap7 library.\n \"\"\"\n logger.info(\"stopping plc\")\n return self._library.Cli_PlcStop(self._pointer)\n\n def plc_cold_start(self) -> int:\n \"\"\"Puts the CPU in RUN mode performing a COLD START.\n\n Returns:\n Error code from snap7 library.\n \"\"\"\n logger.info(\"cold starting plc\")\n return self._library.Cli_PlcColdStart(self._pointer)\n\n def plc_hot_start(self) -> int:\n \"\"\"Puts the CPU in RUN mode performing an HOT START.\n\n Returns:\n Error code from snap7 library.\n \"\"\"\n logger.info(\"hot starting plc\")\n return self._library.Cli_PlcHotStart(self._pointer)\n\n def get_cpu_state(self) -> str:\n \"\"\"Returns the CPU status (running/stopped)\n\n Returns:\n Description of the cpu state.\n\n Raises:\n :obj:`ValueError`: if the cpu state is invalid.\n\n Examples:\n >>> client.get_cpu_statE()\n 'S7CpuStatusRun'\n \"\"\"\n state = c_int(0)\n self._library.Cli_GetPlcStatus(self._pointer, byref(state))\n try:\n status_string = cpu_statuses[state.value]\n except KeyError:\n raise ValueError(f\"The cpu state ({state.value}) is invalid\")\n\n logger.debug(f\"CPU state is {status_string}\")\n return status_string\n\n def get_cpu_info(self) -> S7CpuInfo:\n \"\"\"Returns some information about the AG.\n\n Returns:\n :obj:`S7CpuInfo`: data structure with the information.\n\n Examples:\n >>> cpu_info = client.get_cpu_info()\n >>> print(cpu_info)\n \"\n \"\"\"\n info = S7CpuInfo()\n result = self._library.Cli_GetCpuInfo(self._pointer, byref(info))\n check_error(result, context=\"client\")\n return info\n\n @error_wrap\n def disconnect(self) -> int:\n \"\"\"Disconnect a client.\n\n Returns:\n Error code from snap7 library.\n \"\"\"\n logger.info(\"disconnecting snap7 client\")\n return self._library.Cli_Disconnect(self._pointer)\n\n @error_wrap\n def connect(self, address: str, rack: int, slot: int, tcpport: int = 102) -> int:\n \"\"\"Connects a Client Object to a PLC.\n\n Args:\n address: IP address of the PLC.\n rack: rack number where the PLC is located.\n slot: slot number where the CPU is located.\n tcpport: port of the PLC.\n\n Returns:\n Error code from snap7 library.\n\n Example:\n >>> import snap7\n >>> client = snap7.client.Client()\n >>> client.connect(\"192.168.0.1\", 0, 0) # port is implicit = 102.\n \"\"\"\n logger.info(f\"connecting to {address}:{tcpport} rack {rack} slot {slot}\")\n\n self.set_param(RemotePort, tcpport)\n return self._library.Cli_ConnectTo(\n self._pointer, c_char_p(address.encode()),\n c_int(rack), c_int(slot))\n\n def db_read(self, db_number: int, start: int, size: int) -> bytearray:\n \"\"\"Reads a part of a DB from a PLC\n\n Note:\n Use it only for reading DBs, not Marks, Inputs, Outputs.\n\n Args:\n db_number: number of the DB to be read.\n start: byte index from where is start to read from.\n size: amount of bytes to be read.\n\n Returns:\n Buffer read.\n\n Example:\n >>> import snap7\n >>> client = snap7.client.Client()\n >>> client.connect(\"192.168.0.1\", 0, 0)\n >>> buffer = client.db_read(1, 10, 4) # reads the db number 1 starting from the byte 10 until byte 14.\n >>> buffer\n bytearray(b'\\\\x00\\\\x00')\n \"\"\"\n logger.debug(f\"db_read, db_number:{db_number}, start:{start}, size:{size}\")\n\n type_ = wordlen_to_ctypes[WordLen.Byte.value]\n data = (type_ * size)()\n result = (self._library.Cli_DBRead(\n self._pointer, db_number, start, size,\n byref(data)))\n check_error(result, context=\"client\")\n return bytearray(data)\n\n @error_wrap\n def db_write(self, db_number: int, start: int, data: bytearray) -> int:\n \"\"\"Writes a part of a DB into a PLC.\n\n Args:\n db_number: number of the DB to be read.\n start: byte index to start writing to.\n data: buffer to be write.\n\n Returns:\n Buffer written.\n\n Example:\n >>> import snap7\n >>> client = snap7.client.Client()\n >>> client.connect(\"192.168.0.1\", 0, 0)\n >>> buffer = bytearray([0b00000001])\n >>> client.db_write(1, 10, buffer) # writes the bit number 0 from the byte 10 to TRUE.\n \"\"\"\n wordlen = WordLen.Byte\n type_ = wordlen_to_ctypes[wordlen.value]\n size = len(data)\n cdata = (type_ * size).from_buffer_copy(data)\n logger.debug(f\"db_write db_number:{db_number} start:{start} size:{size} data:{data}\")\n return self._library.Cli_DBWrite(self._pointer, db_number, start, size,\n byref(cdata))\n\n def delete(self, block_type: str, block_num: int) -> int:\n \"\"\"Delete a block into AG.\n\n Args:\n block_type: type of block.\n block_num: block number.\n\n Returns:\n Error code from snap7 library.\n \"\"\"\n logger.info(\"deleting block\")\n blocktype = block_types[block_type]\n result = self._library.Cli_Delete(self._pointer, blocktype, block_num)\n return result\n\n def full_upload(self, _type: str, block_num: int) -> Tuple[bytearray, int]:\n \"\"\"Uploads a block from AG with Header and Footer infos.\n The whole block (including header and footer) is copied into the user\n buffer.\n\n Args:\n _type: type of block.\n block_num: number of block.\n\n Returns:\n Tuple of the buffer and size.\n \"\"\"\n _buffer = buffer_type()\n size = c_int(sizeof(_buffer))\n block_type = block_types[_type]\n result = self._library.Cli_FullUpload(self._pointer, block_type,\n block_num, byref(_buffer),\n byref(size))\n check_error(result, context=\"client\")\n return bytearray(_buffer)[:size.value], size.value\n\n def upload(self, block_num: int) -> bytearray:\n \"\"\"Uploads a block from AG.\n\n Note:\n Upload means from the PLC to the PC.\n\n Args:\n block_num: block to be upload.\n\n Returns:\n Buffer with the uploaded block.\n \"\"\"\n logger.debug(f\"db_upload block_num: {block_num}\")\n block_type = block_types['DB']\n _buffer = buffer_type()\n size = c_int(sizeof(_buffer))\n\n result = self._library.Cli_Upload(self._pointer, block_type, block_num,\n byref(_buffer), byref(size))\n\n check_error(result, context=\"client\")\n logger.info(f'received {size} bytes')\n return bytearray(_buffer)\n\n @error_wrap\n def download(self, data: bytearray, block_num: int = -1) -> int:\n \"\"\"Download a block into AG.\n A whole block (including header and footer) must be available into the\n user buffer.\n\n Note:\n Download means from the PC to the PLC.\n\n Args:\n data: buffer data.\n block_num: new block number.\n\n Returns:\n Error code from snap7 library.\n \"\"\"\n type_ = c_byte\n size = len(data)\n cdata = (type_ * len(data)).from_buffer_copy(data)\n return self._library.Cli_Download(self._pointer, block_num,\n byref(cdata), size)\n\n def db_get(self, db_number: int) -> bytearray:\n \"\"\"Uploads a DB from AG using DBRead.\n\n Note:\n This method can't be use for 1200/1500 PLCs.\n\n Args:\n db_number: db number to be read from.\n\n Returns:\n Buffer with the data read.\n\n Example:\n >>> import snap7\n >>> client = snap7.client.Client()\n >>> client.connect(\"192.168.0.1\", 0, 0)\n >>> buffer = client.db_get(1) # reads the db number 1.\n >>> buffer\n bytearray(b\"\\\\x00\\\\x00\\\\x00\\\\x00\\\\x00\\\\x00\\\\x00\\\\x00...\\\\x00\\\\x00\")\n \"\"\"\n logger.debug(f\"db_get db_number: {db_number}\")\n _buffer = buffer_type()\n result = self._library.Cli_DBGet(\n self._pointer, db_number, byref(_buffer),\n byref(c_int(buffer_size)))\n check_error(result, context=\"client\")\n return bytearray(_buffer)\n\n def read_area(self, area: Areas, dbnumber: int, start: int, size: int) -> bytearray:\n \"\"\"Reads a data area from a PLC\n With it you can read DB, Inputs, Outputs, Merkers, Timers and Counters.\n\n Args:\n area: area to be read from.\n dbnumber: number of the db to be read from. In case of Inputs, Marks or Outputs, this should be equal to 0.\n start: byte index to start reading.\n size: number of bytes to read.\n\n Returns:\n Buffer with the data read.\n\n Raises:\n :obj:`ValueError`: if the area is not defined in the `Areas`\n\n Example:\n >>> import snap7\n >>> client = snap7.client.Client()\n >>> client.connect(\"192.168.0.1\", 0, 0)\n >>> buffer = client.read_area(Areas.DB, 1, 10, 4) # Reads the DB number 1 from the byte 10 to the byte 14.\n >>> buffer\n bytearray(b'\\\\x00\\\\x00')\n \"\"\"\n if area not in Areas:\n raise ValueError(f\"{area} is not implemented in types\")\n elif area == Areas.TM:\n wordlen = WordLen.Timer\n elif area == Areas.CT:\n wordlen = WordLen.Counter\n else:\n wordlen = WordLen.Byte\n type_ = wordlen_to_ctypes[wordlen.value]\n logger.debug(f\"reading area: {area.name} dbnumber: {dbnumber} start: {start}: amount {size}: wordlen: {wordlen.name}={wordlen.value}\")\n data = (type_ * size)()\n result = self._library.Cli_ReadArea(self._pointer, area.value, dbnumber, start,\n size, wordlen.value, byref(data))\n check_error(result, context=\"client\")\n return bytearray(data)\n\n @error_wrap\n def write_area(self, area: Areas, dbnumber: int, start: int, data: bytearray) -> int:\n \"\"\"Writes a data area into a PLC.\n\n Args:\n area: area to be write.\n dbnumber: number of the db to be write to. In case of Inputs, Marks or Outputs, this should be equal to 0.\n start: byte index to start writting.\n data: buffer to be write.\n\n Returns:\n Snap7 error code.\n\n Exmaple:\n >>> import snap7\n >>> client = snap7.client.Client()\n >>> client.connect(\"192.168.0.1\", 0, 0)\n >>> buffer = bytearray([0b00000001])\n >>> client.write_area(Areas.DB, 1, 10, buffer) # Writes the bit 0 of the byte 10 from the DB number 1 to TRUE.\n \"\"\"\n if area == Areas.TM:\n wordlen = WordLen.Timer\n elif area == Areas.CT:\n wordlen = WordLen.Counter\n else:\n wordlen = WordLen.Byte\n type_ = wordlen_to_ctypes[WordLen.Byte.value]\n size = len(data)\n logger.debug(f\"writing area: {area.name} dbnumber: {dbnumber} start: {start}: size {size}: \"\n f\"wordlen {wordlen.name}={wordlen.value} type: {type_}\")\n cdata = (type_ * len(data)).from_buffer_copy(data)\n return self._library.Cli_WriteArea(self._pointer, area.value, dbnumber, start,\n size, wordlen.value, byref(cdata))\n\n def read_multi_vars(self, items) -> Tuple[int, S7DataItem]:\n \"\"\"Reads different kind of variables from a PLC simultaneously.\n\n Args:\n items: list of items to be read.\n\n Returns:\n Tuple with the return code from the snap7 library and the list of items.\n \"\"\"\n result = self._library.Cli_ReadMultiVars(self._pointer, byref(items),\n c_int32(len(items)))\n check_error(result, context=\"client\")\n return result, items\n\n def list_blocks(self) -> BlocksList:\n \"\"\"Returns the AG blocks amount divided by type.\n\n Returns:\n Block list structure object.\n\n Examples:\n >>> block_list = client.list_blocks()\n >>> print(block_list)\n \n \"\"\"\n logger.debug(\"listing blocks\")\n blocksList = BlocksList()\n result = self._library.Cli_ListBlocks(self._pointer, byref(blocksList))\n check_error(result, context=\"client\")\n logger.debug(f\"blocks: {blocksList}\")\n return blocksList\n\n def list_blocks_of_type(self, blocktype: str, size: int) -> Union[int, Array]:\n \"\"\"This function returns the AG list of a specified block type.\n\n Args:\n blocktype: specified block type.\n size: size of the block type.\n\n Returns:\n If size is 0, it returns a 0, otherwise an `Array` of specified block type.\n\n Raises:\n :obj:`ValueError`: if the `blocktype` is not valid.\n \"\"\"\n\n _blocktype = block_types.get(blocktype)\n if not _blocktype:\n raise ValueError(\"The blocktype parameter was invalid\")\n\n logger.debug(f\"listing blocks of type: {_blocktype} size: {size}\")\n\n if size == 0:\n return 0\n\n data = (c_uint16 * size)()\n count = c_int(size)\n result = self._library.Cli_ListBlocksOfType(\n self._pointer, _blocktype,\n byref(data),\n byref(count))\n\n logger.debug(f\"number of items found: {count}\")\n\n check_error(result, context=\"client\")\n return data\n\n def get_block_info(self, blocktype: str, db_number: int) -> TS7BlockInfo:\n \"\"\"Returns detailed information about a block present in AG.\n\n Args:\n blocktype: specified block type.\n db_number: number of db to get information from.\n\n Returns:\n Structure of information from block.\n\n Raises:\n :obj:`ValueError`: if the `blocktype` is not valid.\n\n Examples:\n >>> block_info = client.get_block_info(\"DB\", 1)\n >>> print(block_info)\n Block type: 10\n Block number: 1\n Block language: 5\n Block flags: 1\n MC7Size: 100\n Load memory size: 192\n Local data: 0\n SBB Length: 20\n Checksum: 0\n Version: 1\n Code date: b'1999/11/17'\n Interface date: b'1999/11/17'\n Author: b''\n Family: b''\n Header: b''\n \"\"\"\n blocktype_ = block_types.get(blocktype)\n\n if not blocktype_:\n raise ValueError(\"The blocktype parameter was invalid\")\n logger.debug(f\"retrieving block info for block {db_number} of type {blocktype_}\")\n\n data = TS7BlockInfo()\n\n result = self._library.Cli_GetAgBlockInfo(self._pointer, blocktype_, db_number, byref(data))\n check_error(result, context=\"client\")\n return data\n\n @error_wrap\n def set_session_password(self, password: str) -> int:\n \"\"\"Send the password to the PLC to meet its security level.\n\n Args:\n password: password to set.\n\n Returns:\n Snap7 code.\n\n Raises:\n :obj:`ValueError`: if the length of the `password` is more than 8 characters.\n \"\"\"\n if len(password) > 8:\n raise ValueError(\"Maximum password length is 8\")\n return self._library.Cli_SetSessionPassword(self._pointer,\n c_char_p(password.encode()))\n\n @error_wrap\n def clear_session_password(self) -> int:\n \"\"\"Clears the password set for the current session (logout).\n\n Returns:\n Snap7 code.\n \"\"\"\n return self._library.Cli_ClearSessionPassword(self._pointer)\n\n def set_connection_params(self, address: str, local_tsap: int, remote_tsap: int) -> None:\n \"\"\"Sets internally (IP, LocalTSAP, RemoteTSAP) Coordinates.\n\n Note:\n This function must be called just before `Cli_Connect()`.\n\n Args:\n address: PLC/Equipment IPV4 Address, for example \"192.168.1.12\"\n local_tsap: Local TSAP (PC TSAP)\n remote_tsap: Remote TSAP (PLC TSAP)\n\n Raises:\n :obj:`ValueError`: if the `address` is not a valid IPV4.\n :obj:`ValueError`: if the result of setting the connection params is\n different than 0.\n \"\"\"\n if not re.match(ipv4, address):\n raise ValueError(f\"{address} is invalid ipv4\")\n result = self._library.Cli_SetConnectionParams(self._pointer, address,\n c_uint16(local_tsap),\n c_uint16(remote_tsap))\n if result != 0:\n raise ValueError(\"The parameter was invalid\")\n\n def set_connection_type(self, connection_type: int):\n \"\"\" Sets the connection resource type, i.e the way in which the Clients connects to a PLC.\n\n Args:\n connection_type: 1 for PG, 2 for OP, 3 to 10 for S7 Basic\n\n Raises:\n :obj:`ValueError`: if the result of setting the connection type is\n different than 0.\n \"\"\"\n result = self._library.Cli_SetConnectionType(self._pointer,\n c_uint16(connection_type))\n if result != 0:\n raise ValueError(\"The parameter was invalid\")\n\n def get_connected(self) -> bool:\n \"\"\"Returns the connection status\n\n Note:\n Sometimes returns True, while connection is lost.\n\n Returns:\n True if is connected, otherwise false.\n \"\"\"\n connected = c_int32()\n result = self._library.Cli_GetConnected(self._pointer, byref(connected))\n check_error(result, context=\"client\")\n return bool(connected)\n\n def ab_read(self, start: int, size: int) -> bytearray:\n \"\"\"Reads a part of IPU area from a PLC.\n\n Args:\n start: byte index from where start to read.\n size: amount of bytes to read.\n\n Returns:\n Buffer with the data read.\n \"\"\"\n wordlen = WordLen.Byte\n type_ = wordlen_to_ctypes[wordlen.value]\n data = (type_ * size)()\n logger.debug(f\"ab_read: start: {start}: size {size}: \")\n result = self._library.Cli_ABRead(self._pointer, start, size,\n byref(data))\n check_error(result, context=\"client\")\n return bytearray(data)\n\n def ab_write(self, start: int, data: bytearray) -> int:\n \"\"\"Writes a part of IPU area into a PLC.\n\n Args:\n start: byte index from where start to write.\n data: buffer with the data to be written.\n\n Returns:\n Snap7 code.\n \"\"\"\n wordlen = WordLen.Byte\n type_ = wordlen_to_ctypes[wordlen.value]\n size = len(data)\n cdata = (type_ * size).from_buffer_copy(data)\n logger.debug(f\"ab write: start: {start}: size: {size}: \")\n return self._library.Cli_ABWrite(\n self._pointer, start, size, byref(cdata))\n\n def as_ab_read(self, start: int, size: int, data) -> int:\n \"\"\"Reads a part of IPU area from a PLC asynchronously.\n\n Args:\n start: byte index from where start to read.\n size: amount of bytes to read.\n data: buffer where the data will be place.\n\n Returns:\n Snap7 code.\n \"\"\"\n logger.debug(f\"ab_read: start: {start}: size {size}: \")\n result = self._library.Cli_AsABRead(self._pointer, start, size,\n byref(data))\n check_error(result, context=\"client\")\n return result\n\n def as_ab_write(self, start: int, data: bytearray) -> int:\n \"\"\"Writes a part of IPU area into a PLC asynchronously.\n\n Args:\n start: byte index from where start to write.\n data: buffer with the data to be written.\n\n Returns:\n Snap7 code.\n \"\"\"\n wordlen = WordLen.Byte\n type_ = wordlen_to_ctypes[wordlen.value]\n size = len(data)\n cdata = (type_ * size).from_buffer_copy(data)\n logger.debug(f\"ab write: start: {start}: size: {size}: \")\n result = self._library.Cli_AsABWrite(\n self._pointer, start, size, byref(cdata))\n check_error(result, context=\"client\")\n return result\n\n def as_compress(self, time: int) -> int:\n \"\"\"\tPerforms the Compress action asynchronously.\n\n Args:\n time: timeout.\n\n Returns:\n Snap7 code.\n \"\"\"\n result = self._library.Cli_AsCompress(self._pointer, time)\n check_error(result, context=\"client\")\n return result\n\n def as_copy_ram_to_rom(self, timeout: int = 1) -> int:\n \"\"\"Performs the Copy Ram to Rom action asynchronously.\n\n Args:\n timeout: time to wait unly fail.\n\n Returns:\n Snap7 code.\n \"\"\"\n result = self._library.Cli_AsCopyRamToRom(self._pointer, timeout)\n check_error(result, context=\"client\")\n return result\n\n def as_ct_read(self, start: int, amount: int, data) -> int:\n \"\"\"Reads counters from a PLC asynchronously.\n\n Args:\n start: byte index to start to read from.\n amount: amount of bytes to read.\n data: buffer where the value read will be place.\n\n Returns:\n Snap7 code.\n \"\"\"\n result = self._library.Cli_AsCTRead(self._pointer, start, amount, byref(data))\n check_error(result, context=\"client\")\n return result\n\n def as_ct_write(self, start: int, amount: int, data: bytearray) -> int:\n \"\"\"Write counters into a PLC.\n\n Args:\n start: byte index to start to write from.\n amount: amount of bytes to write.\n data: buffer to be write.\n\n Returns:\n Snap7 code.\n \"\"\"\n type_ = wordlen_to_ctypes[WordLen.Counter.value]\n cdata = (type_ * amount).from_buffer_copy(data)\n result = self._library.Cli_AsCTWrite(self._pointer, start, amount, byref(cdata))\n check_error(result, context=\"client\")\n return result\n\n def as_db_fill(self, db_number: int, filler) -> int:\n \"\"\"Fills a DB in AG with a given byte.\n\n Args:\n db_number: number of DB to fill.\n filler: buffer to fill with.\n\n Returns:\n Snap7 code.\n \"\"\"\n result = self._library.Cli_AsDBFill(self._pointer, db_number, filler)\n check_error(result, context=\"client\")\n return result\n\n def as_db_get(self, db_number: int, _buffer, size) -> bytearray:\n \"\"\"Uploads a DB from AG using DBRead.\n\n Note:\n This method will not work in 1200/1500.\n\n Args:\n db_number: number of DB to get.\n _buffer: buffer where the data read will be place.\n size: amount of bytes to be read.\n\n Returns:\n Snap7 code.\n \"\"\"\n result = self._library.Cli_AsDBGet(self._pointer, db_number, byref(_buffer), byref(size))\n check_error(result, context=\"client\")\n return result\n\n def as_db_read(self, db_number: int, start: int, size: int, data) -> Array:\n \"\"\"Reads a part of a DB from a PLC.\n\n Args:\n db_number: number of DB to be read.\n start: byte index from where start to read from.\n size: amount of bytes to read.\n data: buffer where the data read will be place.\n\n Returns:\n Snap7 code.\n\n Examples:\n >>> import ctypes\n >>> data = (ctypes.c_uint8 * size_to_read)() # In this ctypes array data will be stored.\n >>> result = client.as_db_read(1, 0, size_to_read, data)\n >>> result # 0 = success\n 0\n \"\"\"\n result = self._library.Cli_AsDBRead(self._pointer, db_number, start, size, byref(data))\n check_error(result, context=\"client\")\n return result\n\n def as_db_write(self, db_number: int, start: int, size: int, data) -> int:\n \"\"\"Writes a part of a DB into a PLC.\n\n Args:\n db_number: number of DB to be write.\n start: byte index from where start to write to.\n size: amount of bytes to write.\n data: buffer to be write.\n\n Returns:\n Snap7 code.\n \"\"\"\n result = self._library.Cli_AsDBWrite(self._pointer, db_number, start, size, byref(data))\n check_error(result, context=\"client\")\n return result\n\n def as_download(self, data: bytearray, block_num: int) -> int:\n \"\"\"Download a block into AG asynchronously.\n\n Note:\n A whole block (including header and footer) must be available into the user buffer.\n\n Args:\n block_num: new block number.\n data: buffer where the data will be place.\n\n Returns:\n Snap7 code.\n \"\"\"\n size = len(data)\n type_ = c_byte * len(data)\n cdata = type_.from_buffer_copy(data)\n result = self._library.Cli_AsDownload(self._pointer, block_num, byref(cdata), size)\n check_error(result)\n return result\n\n @error_wrap\n def compress(self, time: int) -> int:\n \"\"\"Performs the Compress action.\n\n Args:\n time: timeout.\n\n Returns:\n Snap7 code.\n \"\"\"\n return self._library.Cli_Compress(self._pointer, time)\n\n @error_wrap\n def set_param(self, number: int, value: int) -> int:\n \"\"\"Writes an internal Server Parameter.\n\n Args:\n number: number of argument to be written.\n value: value to be written.\n\n Returns:\n Snap7 code.\n \"\"\"\n logger.debug(f\"setting param number {number} to {value}\")\n type_ = param_types[number]\n return self._library.Cli_SetParam(self._pointer, number, byref(type_(value)))\n\n def get_param(self, number: int) -> int:\n \"\"\"Reads an internal Server parameter.\n\n Args:\n number: number of argument to be read.\n\n Return:\n Value of the param read.\n \"\"\"\n logger.debug(f\"retreiving param number {number}\")\n type_ = param_types[number]\n value = type_()\n code = self._library.Cli_GetParam(self._pointer, c_int(number), byref(value))\n check_error(code)\n return value.value\n\n def get_pdu_length(self) -> int:\n \"\"\"Returns info about the PDU length (requested and negotiated).\n\n Returns:\n PDU length.\n\n Examples:\n >>> client.get_pdu_length()\n 480\n \"\"\"\n logger.info(\"getting PDU length\")\n requested_ = c_uint16()\n negotiated_ = c_uint16()\n code = self._library.Cli_GetPduLength(self._pointer, byref(requested_), byref(negotiated_))\n check_error(code)\n return negotiated_.value\n\n def get_plc_datetime(self) -> datetime:\n \"\"\"Returns the PLC date/time.\n\n Returns:\n Date and time as datetime\n\n Examples:\n >>> client.get_plc_datetime()\n datetime.datetime(2021, 4, 6, 12, 12, 36)\n \"\"\"\n type_ = c_int32\n buffer = (type_ * 9)()\n result = self._library.Cli_GetPlcDateTime(self._pointer, byref(buffer))\n check_error(result, context=\"client\")\n\n return datetime(\n year=buffer[5] + 1900,\n month=buffer[4] + 1,\n day=buffer[3],\n hour=buffer[2],\n minute=buffer[1],\n second=buffer[0]\n )\n\n @error_wrap\n def set_plc_datetime(self, dt: datetime) -> int:\n \"\"\"Sets the PLC date/time with a given value.\n\n Args:\n dt: datetime to be set.\n\n Returns:\n Snap7 code.\n \"\"\"\n type_ = c_int32\n buffer = (type_ * 9)()\n buffer[0] = dt.second\n buffer[1] = dt.minute\n buffer[2] = dt.hour\n buffer[3] = dt.day\n buffer[4] = dt.month - 1\n buffer[5] = dt.year - 1900\n\n return self._library.Cli_SetPlcDateTime(self._pointer, byref(buffer))\n\n def check_as_completion(self, p_value) -> int:\n \"\"\"Method to check Status of an async request. Result contains if the check was successful, not the data value itself\n\n Args:\n p_value: Pointer where result of this check shall be written.\n\n Returns:\n Snap7 code. If 0 - Job is done successfully. If 1 - Job is either pending or contains s7errors\n \"\"\"\n result = self._library.Cli_CheckAsCompletion(self._pointer, p_value)\n check_error(result, context=\"client\")\n return result\n\n def set_as_callback(self, pfn_clicompletion, p_usr):\n # Cli_SetAsCallback\n result = self._library.Cli_SetAsCallback(self._pointer, pfn_clicompletion, p_usr)\n check_error(result, context='client')\n return result\n\n def wait_as_completion(self, timeout: int) -> int:\n \"\"\"Snap7 Cli_WaitAsCompletion representative.\n\n Args:\n timeout: ms to wait for async job\n\n Returns:\n Snap7 code.\n \"\"\"\n # Cli_WaitAsCompletion\n result = self._library.Cli_WaitAsCompletion(self._pointer, c_ulong(timeout))\n check_error(result, context=\"client\")\n return result\n\n def _prepare_as_read_area(self, area: Areas, size: int) -> Tuple[WordLen, Array]:\n if area not in Areas:\n raise ValueError(f\"{area} is not implemented in types\")\n elif area == Areas.TM:\n wordlen = WordLen.Timer\n elif area == Areas.CT:\n wordlen = WordLen.Counter\n else:\n wordlen = WordLen.Byte\n type_ = wordlen_to_ctypes[wordlen.value]\n usrdata = (type_ * size)()\n return wordlen, usrdata\n\n def as_read_area(self, area: Areas, dbnumber: int, start: int, size: int, wordlen: WordLen, pusrdata) -> int:\n \"\"\"Reads a data area from a PLC asynchronously.\n With it you can read DB, Inputs, Outputs, Merkers, Timers and Counters.\n\n Args:\n area: memory area to be read from.\n dbnumber: The DB number, only used when area=Areas.DB\n start: offset to start writing\n size: number of units to read\n pusrdata: buffer where the data will be place.\n wordlen: length of the word to be read.\n\n Returns:\n Snap7 code.\n \"\"\"\n logger.debug(f\"reading area: {area.name} dbnumber: {dbnumber} start: {start}: amount {size}: wordlen: {wordlen.name}={wordlen.value}\")\n result = self._library.Cli_AsReadArea(self._pointer, area.value, dbnumber, start, size, wordlen.value, pusrdata)\n check_error(result, context=\"client\")\n return result\n\n def _prepare_as_write_area(self, area: Areas, data: bytearray) -> Tuple[WordLen, Array]:\n if area not in Areas:\n raise ValueError(f\"{area} is not implemented in types\")\n elif area == Areas.TM:\n wordlen = WordLen.Timer\n elif area == Areas.CT:\n wordlen = WordLen.Counter\n else:\n wordlen = WordLen.Byte\n type_ = wordlen_to_ctypes[WordLen.Byte.value]\n cdata = (type_ * len(data)).from_buffer_copy(data)\n return wordlen, cdata\n\n def as_write_area(self, area: Areas, dbnumber: int, start: int, size: int, wordlen: WordLen, pusrdata) -> int:\n \"\"\"Writes a data area into a PLC asynchronously.\n\n Args:\n area: memory area to be written.\n dbnumber: The DB number, only used when area=Areas.DB\n start: offset to start writing.\n size: amount of bytes to be written.\n wordlen: length of the word to be written.\n pusrdata: buffer to be written.\n\n Returns:\n Snap7 code.\n \"\"\"\n type_ = wordlen_to_ctypes[WordLen.Byte.value]\n logger.debug(f\"writing area: {area.name} dbnumber: {dbnumber} start: {start}: size {size}: \"\n f\"wordlen {wordlen} type: {type_}\")\n cdata = (type_ * len(pusrdata)).from_buffer_copy(pusrdata)\n res = self._library.Cli_AsWriteArea(self._pointer, area.value, dbnumber, start, size, wordlen.value, byref(cdata))\n check_error(res, context=\"client\")\n return res\n\n def as_eb_read(self, start: int, size: int, data) -> int:\n \"\"\"Reads a part of IPI area from a PLC asynchronously.\n\n Args:\n start: byte index from where to start reading from.\n size: amount of bytes to read.\n data: buffer where the data read will be place.\n\n Returns:\n Snap7 code.\n \"\"\"\n result = self._library.Cli_AsEBRead(self._pointer, start, size, byref(data))\n check_error(result, context=\"client\")\n return result\n\n def as_eb_write(self, start: int, size: int, data: bytearray) -> int:\n \"\"\"Writes a part of IPI area into a PLC.\n\n Args:\n start: byte index from where to start writing from.\n size: amount of bytes to write.\n data: buffer to write.\n\n Returns:\n Snap7 code.\n \"\"\"\n type_ = wordlen_to_ctypes[WordLen.Byte.value]\n cdata = (type_ * size).from_buffer_copy(data)\n result = self._library.Cli_AsEBWrite(self._pointer, start, size, byref(cdata))\n check_error(result, context=\"client\")\n return result\n\n def as_full_upload(self, _type: str, block_num: int) -> int:\n \"\"\"Uploads a block from AG with Header and Footer infos.\n\n Note:\n Upload means from PLC to PC.\n\n Args:\n _type: type of block.\n block_num: number of block to upload.\n\n Returns:\n Snap7 code.\n \"\"\"\n _buffer = buffer_type()\n size = c_int(sizeof(_buffer))\n block_type = block_types[_type]\n result = self._library.Cli_AsFullUpload(self._pointer, block_type, block_num, byref(_buffer), byref(size))\n check_error(result, context=\"client\")\n return result\n\n def as_list_blocks_of_type(self, blocktype: str, data, count) -> int:\n \"\"\"Returns the AG blocks list of a given type.\n\n Args:\n blocktype: block type.\n data: buffer where the data will be place.\n count: pass.\n\n Returns:\n Snap7 code.\n\n Raises:\n :obj:`ValueError`: if the `blocktype` is invalid\n \"\"\"\n _blocktype = block_types.get(blocktype)\n if not _blocktype:\n raise ValueError(\"The blocktype parameter was invalid\")\n result = self._library.Cli_AsListBlocksOfType(self._pointer, _blocktype, byref(data), byref(count))\n check_error(result, context=\"client\")\n return result\n\n def as_mb_read(self, start: int, size: int, data) -> int:\n \"\"\"Reads a part of Merkers area from a PLC.\n\n Args:\n start: byte index from where to start to read from.\n size: amount of byte to read.\n data: buffer where the data read will be place.\n\n Returns:\n Snap7 code.\n \"\"\"\n result = self._library.Cli_AsMBRead(self._pointer, start, size, byref(data))\n check_error(result, context=\"client\")\n return result\n\n def as_mb_write(self, start: int, size: int, data: bytearray) -> int:\n \"\"\"Writes a part of Merkers area into a PLC.\n\n Args:\n start: byte index from where to start to write to.\n size: amount of byte to write.\n data: buffer to write.\n\n Returns:\n Snap7 code.\n \"\"\"\n type_ = wordlen_to_ctypes[WordLen.Byte.value]\n cdata = (type_ * size).from_buffer_copy(data)\n result = self._library.Cli_AsMBWrite(self._pointer, start, size, byref(cdata))\n check_error(result, context=\"client\")\n return result\n\n def as_read_szl(self, ssl_id: int, index: int, s7_szl: S7SZL, size) -> int:\n \"\"\"Reads a partial list of given ID and Index.\n\n Args:\n ssl_id: TODO\n index: TODO\n s7_szl: TODO\n size: TODO\n\n Returns:\n Snap7 code.\n \"\"\"\n result = self._library.Cli_AsReadSZL(self._pointer, ssl_id, index, byref(s7_szl), byref(size))\n check_error(result, context=\"client\")\n return result\n\n def as_read_szl_list(self, szl_list, items_count) -> int:\n \"\"\"Reads the list of partial lists available in the CPU.\n\n Args:\n szl_list: TODO\n items_count: TODO\n\n Returns:\n Snap7 code.\n \"\"\"\n result = self._library.Cli_AsReadSZLList(self._pointer, byref(szl_list), byref(items_count))\n check_error(result, context=\"client\")\n return result\n\n def as_tm_read(self, start: int, amount: int, data) -> bytearray:\n \"\"\"Reads timers from a PLC.\n\n Args:\n start: byte index to start read from.\n amount: amount of bytes to read.\n data: buffer where the data will be placed.\n\n Returns:\n Snap7 code.\n \"\"\"\n result = self._library.Cli_AsTMRead(self._pointer, start, amount, byref(data))\n check_error(result, context=\"client\")\n return result\n\n def as_tm_write(self, start: int, amount: int, data: bytearray) -> int:\n \"\"\"Write timers into a PLC.\n\n Args:\n start: byte index to start writing to.\n amount: amount of bytes to write.\n data: buffer to write.\n\n Returns:\n Snap7 code.\n \"\"\"\n type_ = wordlen_to_ctypes[WordLen.Timer.value]\n cdata = (type_ * amount).from_buffer_copy(data)\n result = self._library.Cli_AsTMWrite(self._pointer, start, amount, byref(cdata))\n check_error(result)\n return result\n\n def as_upload(self, block_num: int, _buffer, size) -> int:\n \"\"\"Uploads a block from AG.\n\n Note:\n Uploads means from PLC to PC.\n\n Args:\n block_num: block number to upload.\n _buffer: buffer where the data will be place.\n size: amount of bytes to uplaod.\n\n Returns:\n Snap7 code.\n \"\"\"\n block_type = block_types['DB']\n result = self._library.Cli_AsUpload(self._pointer, block_type, block_num, byref(_buffer), byref(size))\n check_error(result, context=\"client\")\n return result\n\n def copy_ram_to_rom(self, timeout: int = 1) -> int:\n \"\"\"Performs the Copy Ram to Rom action.\n\n Args:\n timeout: timeout time.\n\n Returns:\n Snap7 code.\n \"\"\"\n result = self._library.Cli_CopyRamToRom(self._pointer, timeout)\n check_error(result, context=\"client\")\n return result\n\n def ct_read(self, start: int, amount: int) -> bytearray:\n \"\"\"Reads counters from a PLC.\n\n Args:\n start: byte index to start read from.\n amount: amount of bytes to read.\n\n Returns:\n Buffer read.\n \"\"\"\n type_ = wordlen_to_ctypes[WordLen.Counter.value]\n data = (type_ * amount)()\n result = self._library.Cli_CTRead(self._pointer, start, amount, byref(data))\n check_error(result, context=\"client\")\n return bytearray(data)\n\n def ct_write(self, start: int, amount: int, data: bytearray) -> int:\n \"\"\"Write counters into a PLC.\n\n Args:\n start: byte index to start write to.\n amount: amount of bytes to write.\n data: buffer data to write.\n\n Returns:\n Snap7 code.\n \"\"\"\n type_ = wordlen_to_ctypes[WordLen.Counter.value]\n cdata = (type_ * amount).from_buffer_copy(data)\n result = self._library.Cli_CTWrite(self._pointer, start, amount, byref(cdata))\n check_error(result)\n return result\n\n def db_fill(self, db_number: int, filler: int) -> int:\n \"\"\"Fills a DB in AG with a given byte.\n\n Args:\n db_number: db number to fill.\n filler: value filler.\n\n Returns:\n Snap7 code.\n \"\"\"\n result = self._library.Cli_DBFill(self._pointer, db_number, filler)\n check_error(result)\n return result\n\n def eb_read(self, start: int, size: int) -> bytearray:\n \"\"\"Reads a part of IPI area from a PLC.\n\n Args:\n start: byte index to start read from.\n size: amount of bytes to read.\n\n Returns:\n Data read.\n \"\"\"\n type_ = wordlen_to_ctypes[WordLen.Byte.value]\n data = (type_ * size)()\n result = self._library.Cli_EBRead(self._pointer, start, size, byref(data))\n check_error(result, context=\"client\")\n return bytearray(data)\n\n def eb_write(self, start: int, size: int, data: bytearray) -> int:\n \"\"\"Writes a part of IPI area into a PLC.\n\n Args:\n start: byte index to be written.\n size: amount of bytes to write.\n data: data to write.\n\n Returns:\n Snap7 code.\n \"\"\"\n type_ = wordlen_to_ctypes[WordLen.Byte.value]\n cdata = (type_ * size).from_buffer_copy(data)\n result = self._library.Cli_EBWrite(self._pointer, start, size, byref(cdata))\n check_error(result)\n return result\n\n def error_text(self, error: int) -> str:\n \"\"\"Returns a textual explanation of a given error number.\n\n Args:\n error: error number.\n\n Returns:\n Text error.\n \"\"\"\n text_length = c_int(256)\n error_code = c_int32(error)\n text = create_string_buffer(buffer_size)\n response = self._library.Cli_ErrorText(error_code, byref(text), text_length)\n check_error(response)\n result = bytearray(text)[:text_length.value].decode().strip('\\x00')\n return result\n\n def get_cp_info(self) -> S7CpInfo:\n \"\"\"Returns some information about the CP (communication processor).\n\n Returns:\n Structure object containing the CP information.\n \"\"\"\n cp_info = S7CpInfo()\n result = self._library.Cli_GetCpInfo(self._pointer, byref(cp_info))\n check_error(result)\n return cp_info\n\n def get_exec_time(self) -> int:\n \"\"\"Returns the last job execution time in milliseconds.\n\n Returns:\n Execution time value.\n \"\"\"\n time = c_int32()\n result = self._library.Cli_GetExecTime(self._pointer, byref(time))\n check_error(result)\n return time.value\n\n def get_last_error(self) -> int:\n \"\"\"Returns the last job result.\n\n Returns:\n Returns the last error value.\n \"\"\"\n last_error = c_int32()\n result = self._library.Cli_GetLastError(self._pointer, byref(last_error))\n check_error(result)\n return last_error.value\n\n def get_order_code(self) -> S7OrderCode:\n \"\"\"Returns the CPU order code.\n\n Returns:\n Order of the code in a structure object.\n \"\"\"\n order_code = S7OrderCode()\n result = self._library.Cli_GetOrderCode(self._pointer, byref(order_code))\n check_error(result)\n return order_code\n\n def get_pg_block_info(self, block: bytearray) -> TS7BlockInfo:\n \"\"\"Returns detailed information about a block loaded in memory.\n\n Args:\n block: buffer where the data will be place.\n\n Returns:\n Structure object that contains the block information.\n \"\"\"\n block_info = TS7BlockInfo()\n size = c_int(len(block))\n buffer = (c_byte * len(block)).from_buffer_copy(block)\n result = self._library.Cli_GetPgBlockInfo(self._pointer, byref(buffer), byref(block_info), size)\n check_error(result)\n return block_info\n\n def get_protection(self) -> S7Protection:\n \"\"\"Gets the CPU protection level info.\n\n Returns:\n Structure object with protection attributes.\n \"\"\"\n s7_protection = S7Protection()\n result = self._library.Cli_GetProtection(self._pointer, byref(s7_protection))\n check_error(result)\n return s7_protection\n\n def iso_exchange_buffer(self, data: bytearray) -> bytearray:\n \"\"\"Exchanges a given S7 PDU (protocol data unit) with the CPU.\n\n Args:\n data: buffer to exchange.\n\n Returns:\n Snap7 code.\n \"\"\"\n size = c_int(len(data))\n cdata = (c_byte * len(data)).from_buffer_copy(data)\n response = self._library.Cli_IsoExchangeBuffer(self._pointer, byref(cdata), byref(size))\n check_error(response)\n result = bytearray(cdata)[:size.value]\n return result\n\n def mb_read(self, start: int, size: int) -> bytearray:\n \"\"\"Reads a part of Merkers area from a PLC.\n\n Args:\n start: byte index to be read from.\n size: amount of bytes to read.\n\n Returns:\n Buffer with the data read.\n \"\"\"\n type_ = wordlen_to_ctypes[WordLen.Byte.value]\n data = (type_ * size)()\n result = self._library.Cli_MBRead(self._pointer, start, size, byref(data))\n check_error(result, context=\"client\")\n return bytearray(data)\n\n def mb_write(self, start: int, size: int, data: bytearray) -> int:\n \"\"\"Writes a part of Merkers area into a PLC.\n\n Args:\n start: byte index to be written.\n size: amount of bytes to write.\n data: buffer to write.\n\n Returns:\n Snap7 code.\n \"\"\"\n type_ = wordlen_to_ctypes[WordLen.Byte.value]\n cdata = (type_ * size).from_buffer_copy(data)\n result = self._library.Cli_MBWrite(self._pointer, start, size, byref(cdata))\n check_error(result)\n return result\n\n def read_szl(self, ssl_id: int, index: int = 0x0000) -> S7SZL:\n \"\"\"Reads a partial list of given ID and Index.\n\n Args:\n ssl_id: ssl id to be read.\n index: index to be read.\n\n Returns:\n SZL structure object.\n \"\"\"\n s7_szl = S7SZL()\n size = c_int(sizeof(s7_szl))\n result = self._library.Cli_ReadSZL(self._pointer, ssl_id, index, byref(s7_szl), byref(size))\n check_error(result, context=\"client\")\n return s7_szl\n\n def read_szl_list(self) -> bytearray:\n \"\"\"Reads the list of partial lists available in the CPU.\n\n Returns:\n Buffer read.\n \"\"\"\n szl_list = S7SZLList()\n items_count = c_int(sizeof(szl_list))\n response = self._library.Cli_ReadSZLList(self._pointer, byref(szl_list), byref(items_count))\n check_error(response, context=\"client\")\n result = bytearray(szl_list.List)[:items_count.value]\n return result\n\n def set_plc_system_datetime(self) -> int:\n \"\"\"Sets the PLC date/time with the host (PC) date/time.\n\n Returns:\n Snap7 code.\n \"\"\"\n result = self._library.Cli_SetPlcSystemDateTime(self._pointer)\n check_error(result)\n return result\n\n def tm_read(self, start: int, amount: int) -> bytearray:\n \"\"\"Reads timers from a PLC.\n\n Args:\n start: byte index from where is start to read from.\n amount: amount of byte to be read.\n\n Returns:\n Buffer read.\n \"\"\"\n wordlen = WordLen.Timer\n type_ = wordlen_to_ctypes[wordlen.value]\n data = (type_ * amount)()\n result = self._library.Cli_TMRead(self._pointer, start, amount, byref(data))\n check_error(result, context=\"client\")\n return bytearray(data)\n\n def tm_write(self, start: int, amount: int, data: bytearray) -> int:\n \"\"\"Write timers into a PLC.\n\n Args:\n start: byte index from where is start to write to.\n amount: amount of byte to be written.\n data: data to be write.\n\n Returns:\n Snap7 code.\n \"\"\"\n wordlen = WordLen.Timer\n type_ = wordlen_to_ctypes[wordlen.value]\n cdata = (type_ * amount).from_buffer_copy(data)\n result = self._library.Cli_TMWrite(self._pointer, start, amount, byref(cdata))\n check_error(result)\n return result\n\n def write_multi_vars(self, items: List[S7DataItem]) -> int:\n \"\"\"Writes different kind of variables into a PLC simultaneously.\n\n Args:\n items: list of items to be written.\n\n Returns:\n Snap7 code.\n \"\"\"\n items_count = c_int32(len(items))\n data = bytearray()\n for item in items:\n data += bytearray(item)\n cdata = (S7DataItem * len(items)).from_buffer_copy(data)\n result = self._library.Cli_WriteMultiVars(self._pointer, byref(cdata), items_count)\n check_error(result, context=\"client\")\n return result\n"},"meta":{"kind":"string","value":"{\n \"content_hash\": \"c8014c09a10026ef6a60ab84dddf21b5\",\n \"timestamp\": \"\",\n \"source\": \"github\",\n \"line_count\": 1566,\n \"max_line_length\": 142,\n \"avg_line_length\": 33.577905491698594,\n \"alnum_prop\": 0.5620637848734382,\n \"repo_name\": \"gijzelaerr/python-snap7\",\n \"id\": \"103d5e553222560b908d12bd0b5935cab020fe73\",\n \"size\": \"52583\",\n \"binary\": false,\n \"copies\": \"1\",\n \"ref\": \"refs/heads/master\",\n \"path\": \"snap7/client.py\",\n \"mode\": \"33261\",\n \"license\": \"mit\",\n \"language\": [\n {\n \"name\": \"Dockerfile\",\n \"bytes\": \"288\"\n },\n {\n \"name\": \"Makefile\",\n \"bytes\": \"934\"\n },\n {\n \"name\": \"Python\",\n \"bytes\": \"267248\"\n }\n ],\n \"symlink_target\": \"\"\n}"}}},{"rowIdx":328,"cells":{"text":{"kind":"string","value":"\n\n
\n Location\n location_geonames_2748074\n public\n 1390753461702\n \n NL &gt; North Brabant &gt; Bergeijk &gt; Rijt\n \n
\n \n \n NL,North Brabant,Bergeijk,Rijt\n \n Rijt\n populated place\n \n \n \n 5.3097199999999996\n 51.29583\n \n http://www.geonames.org/2748074\n \n \n \n \n
\n"},"meta":{"kind":"string","value":"{\n \"content_hash\": \"5e98e70d058a06cb6fc50a1a9dfc3999\",\n \"timestamp\": \"\",\n \"source\": \"github\",\n \"line_count\": 29,\n \"max_line_length\": 83,\n \"avg_line_length\": 31.482758620689655,\n \"alnum_prop\": 0.664841182913472,\n \"repo_name\": \"delving/oscr-data\",\n \"id\": \"3699bd03d56c1668c8158393571dbd3eebb1fbca\",\n \"size\": \"913\",\n \"binary\": false,\n \"copies\": \"1\",\n \"ref\": \"refs/heads/master\",\n \"path\": \"shared/Location/location_geonames_2748074.xml\",\n \"mode\": \"33188\",\n \"license\": \"apache-2.0\",\n \"language\": [],\n \"symlink_target\": \"\"\n}"}}},{"rowIdx":329,"cells":{"text":{"kind":"string","value":"package main\n\nimport (\n\t\"fmt\"\n\t\"log\"\n\t\"net/http\"\n\t\"runtime\"\n\t\"strings\"\n\t\"text/template\"\n\n\t\"github.com/studygolang/mux\"\n)\n\nfunc init() {\n\truntime.GOMAXPROCS(runtime.NumCPU())\n}\n\nfunc main() {\n\n\trouter := initRouter()\n\thttp.Handle(\"/\", router)\n\tlog.Fatal(http.ListenAndServe(\":9999\", nil))\n}\n\n// TODO:多人同时请求不同的包,验证可能会失败\nvar project = \"\"\n\nfunc initRouter() *mux.Router {\n\trouter := mux.NewRouter()\n\n\trouter.PathPrefix(\"/x\").HandlerFunc(func(rw http.ResponseWriter, req *http.Request) {\n\t\tpath := req.URL.Path\n\n\t\tpaths := strings.SplitN(path, \"/\", 4)\n\n\t\tif len(paths) < 3 {\n\t\t\treturn parseTmpl(rw)\n\t\t}\n\t\tproject = paths[2]\n\n\t\tparseTmpl(rw)\n\t})\n\n\treturn router\n}\n\nfunc parseTmpl(rw http.ResponseWriter) {\n\ttmpl, err := template.New(\"gox\").Parse(tpl)\n\tif err != nil {\n\t\tfmt.Fprintln(rw, \"error:\", err)\n\t\treturn\n\t}\n\n\terr = tmpl.Execute(rw, project)\n\tif err != nil {\n\t\tfmt.Fprintln(rw, \"error:\", err)\n\t\treturn\n\t}\n}\n\nvar tpl = `\n\n\n\n\t\n\t\n\n\n\n\n`\n"},"meta":{"kind":"string","value":"{\n \"content_hash\": \"688c858e802db1cca5938a529f54cd10\",\n \"timestamp\": \"\",\n \"source\": \"github\",\n \"line_count\": 71,\n \"max_line_length\": 89,\n \"avg_line_length\": 15.633802816901408,\n \"alnum_prop\": 0.6342342342342342,\n \"repo_name\": \"xiexingguang/studygolang\",\n \"id\": \"b3d5c919012db7c22933e982c5ddd6e399013318\",\n \"size\": \"1589\",\n \"binary\": false,\n \"copies\": \"6\",\n \"ref\": \"refs/heads/master\",\n \"path\": \"websites/code/gox_dispatcher/src/gox/main.go\",\n \"mode\": \"33188\",\n \"license\": \"bsd-3-clause\",\n \"language\": [\n {\n \"name\": \"Batchfile\",\n \"bytes\": \"1712\"\n },\n {\n \"name\": \"CSS\",\n \"bytes\": \"234616\"\n },\n {\n \"name\": \"Go\",\n \"bytes\": \"388336\"\n },\n {\n \"name\": \"HTML\",\n \"bytes\": \"296414\"\n },\n {\n \"name\": \"JavaScript\",\n \"bytes\": \"309333\"\n },\n {\n \"name\": \"Shell\",\n \"bytes\": \"1994\"\n },\n {\n \"name\": \"XSLT\",\n \"bytes\": \"3842\"\n }\n ],\n \"symlink_target\": \"\"\n}"}}},{"rowIdx":330,"cells":{"text":{"kind":"string","value":"\n\n'use strict';\n\n/**\n * Class representing a AccessPolicyCreateOrUpdateParameters.\n */\nclass AccessPolicyCreateOrUpdateParameters {\n /**\n * Create a AccessPolicyCreateOrUpdateParameters.\n * @member {string} [principalObjectId] The objectId of the principal in\n * Azure Active Directory.\n * @member {string} [description] An description of the access policy.\n * @member {array} [roles] The list of roles the principal is assigned on the\n * environment.\n */\n constructor() {\n }\n\n /**\n * Defines the metadata of AccessPolicyCreateOrUpdateParameters\n *\n * @returns {object} metadata of AccessPolicyCreateOrUpdateParameters\n *\n */\n mapper() {\n return {\n required: false,\n serializedName: 'AccessPolicyCreateOrUpdateParameters',\n type: {\n name: 'Composite',\n className: 'AccessPolicyCreateOrUpdateParameters',\n modelProperties: {\n principalObjectId: {\n required: false,\n serializedName: 'properties.principalObjectId',\n type: {\n name: 'String'\n }\n },\n description: {\n required: false,\n serializedName: 'properties.description',\n type: {\n name: 'String'\n }\n },\n roles: {\n required: false,\n serializedName: 'properties.roles',\n type: {\n name: 'Sequence',\n element: {\n required: false,\n serializedName: 'AccessPolicyRoleElementType',\n type: {\n name: 'Enum',\n allowedValues: [ 'Reader', 'Contributor' ]\n }\n }\n }\n }\n }\n }\n };\n }\n}\n\nmodule.exports = AccessPolicyCreateOrUpdateParameters;\n"},"meta":{"kind":"string","value":"{\n \"content_hash\": \"ddad45f908fef0996eb6a835efc01d00\",\n \"timestamp\": \"\",\n \"source\": \"github\",\n \"line_count\": 69,\n \"max_line_length\": 79,\n \"avg_line_length\": 26.333333333333332,\n \"alnum_prop\": 0.5476059438635112,\n \"repo_name\": \"xingwu1/azure-sdk-for-node\",\n \"id\": \"077d725860f9e2008f6997b6883f9b22d9b4d8ce\",\n \"size\": \"2134\",\n \"binary\": false,\n \"copies\": \"2\",\n \"ref\": \"refs/heads/master\",\n \"path\": \"lib/services/timeseriesinsightsManagement/lib/models/accessPolicyCreateOrUpdateParameters.js\",\n \"mode\": \"33188\",\n \"license\": \"apache-2.0\",\n \"language\": [\n {\n \"name\": \"Batchfile\",\n \"bytes\": \"661\"\n },\n {\n \"name\": \"JavaScript\",\n \"bytes\": \"122792600\"\n },\n {\n \"name\": \"Shell\",\n \"bytes\": \"437\"\n },\n {\n \"name\": \"TypeScript\",\n \"bytes\": \"2558\"\n }\n ],\n \"symlink_target\": \"\"\n}"}}},{"rowIdx":331,"cells":{"text":{"kind":"string","value":"\n\nvar fs = require('fs');\n\n/**\n * Mock Data\n */\n\nvar _tags = 'dev misc etc hello world thoughts'.split(' ');\n\nvar _lorem = 'Non eram nescius Brute cum quae summis ingeniis exquisitaque'\n+ ' doctrina philosophi Graeco sermone tractavissent ea Latinis litteris mandaremus'\n+ ' fore ut hic noster labor in varias reprehensiones incurreret nam quibusdam et'\n+ ' iis quidem non admodum indoctis totum hoc displicet philosophari quidam autem'\n+ ' non tam id reprehendunt si remissius agatur sed tantum studium tamque multam'\n+ ' operam ponendam in eo non arbitrantur erunt etiam et ii quidem eruditi Graecis'\n+ ' litteris contemnentes Latinas qui se dicant in Graecis legendis operam malle'\n+ ' consumere postremo aliquos futuros suspicor qui me ad alias litteras vocent'\n+ ' genus hoc scribendi etsi sit elegans personae tamen et dignitatis esse negent'\n+ ' Contra quos omnis dicendum breviter existimo Quamquam philosophiae quidem'\n+ ' vituperatoribus satis responsum est eo libro quo a nobis philosophia defensa et'\n+ ' collaudata est cum esset accusata et vituperata ab Hortensio qui liber cum et'\n+ ' tibi probatus videretur et iis quos ego posse iudicare arbitrarer plura suscepi'\n+ ' veritus ne movere hominum studia viderer retinere non posse Qui autem si maxime'\n+ ' hoc placeat moderatius tamen id volunt fieri difficilem quandam temperantiam'\n+ ' postulant in eo quod semel admissum coerceri reprimique non potest ut'\n+ ' propemodum iustioribus utamur illis qui omnino avocent a philosophia quam his'\n+ ' qui rebus infinitis modum constituant in reque eo meliore quo maior sit'\n+ ' mediocritatem desiderent Sive enim ad sapientiam perveniri potest non paranda'\n+ ' nobis solum ea sed fruenda etiam sapientia est sive hoc difficile est tamen nec'\n+ ' modus est ullus investigandi veri nisi inveneris et quaerendi defatigatio'\n+ ' turpis est cum id quod quaeritur sit pulcherrimum etenim si delectamur cum'\n+ ' scribimus quis est tam invidus qui ab eo nos abducat sin laboramus quis est qui'\n+ ' alienae modum statuat industriae nam ut Terentianus Chremes non inhumanus qui'\n+ ' novum vicinum non vult fodere aut arare aut aliquid ferre denique non enim'\n+ ' illum ab industria sed ab inliberali labore deterret sic isti curiosi quos'\n+ ' offendit noster minime nobis iniucundus labor Iis igitur est difficilius satis'\n+ ' facere qui se Latina scripta dicunt contemnere in quibus hoc primum est in quo'\n+ ' admirer cur in gravissimis rebus non delectet eos sermo patrius cum idem'\n+ ' fabellas Latinas ad verbum e Graecis expressas non inviti legant quis enim tam'\n+ ' inimicus paene nomini Romano est qui Ennii Medeam aut Antiopam Pacuvii spernat'\n+ ' aut reiciat quod se isdem Euripidis fabulis delectari dicat Latinas litteras'\n+ ' oderit Quid si nos non interpretum fungimur munere sed tuemur ea quae dicta'\n+ ' sunt ab iis quos probamus eisque nostrum iudicium et nostrum scribendi ordinem'\n+ ' adiungimus quid habent cur Graeca anteponant iis quae et splendide dicta sint'\n+ ' neque sint conversa de Graecis nam si dicent ab illis has res esse tractatas ne'\n+ ' ipsos quidem Graecos est cur tam multos legant quam legendi sunt quid enim est'\n+ ' a Chrysippo praetermissum in Stoicis legimus tamen Diogenem Antipatrum'\n+ ' Mnesarchum Panaetium multos alios in primisque familiarem nostrum Posidonium'\n+ ' quid Theophrastus mediocriterne delectat cum tractat locos ab Aristotele ante'\n+ ' tractatos quid Epicurei num desistunt de isdem de quibus et ab Epicuro scriptum'\n+ ' est et ab antiquis ad arbitrium suum scribere quodsi Graeci leguntur a Graecis'\n+ ' isdem de rebus alia ratione compositis quid est cur nostri a nostris non'\n+ ' legantur'.split(' ');\n\n/**\n * Mock Data Generation\n */\n\nfunction ipsum(num) {\n var lorem = _lorem.sort(function() {\n return Math.random() > .5 ? -1 : 1;\n });\n\n var words = []\n , i = lorem.length;\n\n if (num) {\n while (i-- && words.length < num) {\n if (Math.random() > .5) words.push(lorem[i]);\n }\n } else {\n while (i--) {\n if (Math.random() > .5) words.push(lorem[i]);\n if (Math.random() > .99) words.push('\\n\\n');\n }\n }\n\n return words.sort(function() {\n return Math.random() > .5 ? -1 : 1;\n }).join(' ')\n .replace(/\\n{3,}/g, '\\n\\n')\n .replace(/\\n | \\n/g, '\\n')\n .replace(/(\\w)(?=\\n|$)/g, '$1.')\n .replace(/(^|\\n)\\w/g, function(s) {\n return s.toUpperCase();\n });\n}\n\nfunction rand(min, max) {\n return Math.floor(Math.random() * (max - min + 1)) + min;\n}\n\nfunction tag() {\n var out = []\n , i = _tags.length\n , num = rand(1, 5)\n , tags = _tags.sort(function() {\n return Math.random() > .5 ? -1 : 1;\n });\n\n while (out.length < num) {\n out.push(tags[--i]);\n }\n\n return out;\n}\n\nmodule.exports = function(dir, ext) {\n for (var i = 10, id, title, date; i--;) {\n title = ipsum(3)\n .replace('.', '')\n .replace(/(^|\\s)\\w/g, function(s) {\n return s.toUpperCase();\n });\n\n id = title.toLowerCase().replace(/\\s+/g, '_');\n date = new Date(Date.now() - (Math.random() *\n (1000 * 60 * 60 * 24 * 7 * 10)));\n\n return fs.writeFileSync(\n dir + '/' + id + ext,\n JSON.stringify({\n title: title,\n timestamp: date.toISOString(),\n tags: tag(),\n }, null, 2) + '\\n\\n'\n + ipsum()\n );\n }\n};\n"},"meta":{"kind":"string","value":"{\n \"content_hash\": \"398094a02bfe6cb38731332da27f5ebf\",\n \"timestamp\": \"\",\n \"source\": \"github\",\n \"line_count\": 131,\n \"max_line_length\": 84,\n \"avg_line_length\": 40.412213740458014,\n \"alnum_prop\": 0.6885153003400075,\n \"repo_name\": \"chjj/dilated\",\n \"id\": \"660d321968af3a8c46daff356f566c08ce7a7f43\",\n \"size\": \"5383\",\n \"binary\": false,\n \"copies\": \"1\",\n \"ref\": \"refs/heads/master\",\n \"path\": \"lib/mock.js\",\n \"mode\": \"33188\",\n \"license\": \"mit\",\n \"language\": [\n {\n \"name\": \"CSS\",\n \"bytes\": \"19448\"\n },\n {\n \"name\": \"JavaScript\",\n \"bytes\": \"57410\"\n }\n ],\n \"symlink_target\": \"\"\n}"}}},{"rowIdx":332,"cells":{"text":{"kind":"string","value":"{% extends 'base.html' %}\n\n{% block content %}\n\n\t

Register success!

\n\n{% endblock %}"},"meta":{"kind":"string","value":"{\n \"content_hash\": \"f4c0727f0bb83d88c4dd3e63c5f321ec\",\n \"timestamp\": \"\",\n \"source\": \"github\",\n \"line_count\": 7,\n \"max_line_length\": 27,\n \"avg_line_length\": 13,\n \"alnum_prop\": 0.5934065934065934,\n \"repo_name\": \"jussi-kalliokoski/paul\",\n \"id\": \"6e98667bdd99d9d2216c84ea005413b7ccf1fe50\",\n \"size\": \"91\",\n \"binary\": false,\n \"copies\": \"1\",\n \"ref\": \"refs/heads/master\",\n \"path\": \"paul/templates/account/register_success.html\",\n \"mode\": \"33188\",\n \"license\": \"mit\",\n \"language\": [\n {\n \"name\": \"CSS\",\n \"bytes\": \"12191\"\n },\n {\n \"name\": \"JavaScript\",\n \"bytes\": \"7003\"\n },\n {\n \"name\": \"Python\",\n \"bytes\": \"9905\"\n }\n ],\n \"symlink_target\": \"\"\n}"}}},{"rowIdx":333,"cells":{"text":{"kind":"string","value":"\n\npackage io.druid.segment.realtime.appenderator;\n\nimport com.google.common.base.Supplier;\nimport io.druid.data.input.InputRow;\n\nimport javax.annotation.Nullable;\n\n/**\n * Result of {@link AppenderatorDriver#add(InputRow, String, Supplier, boolean)}. It contains the identifier of the\n * segment which the InputRow is added to, the number of rows in that segment and if persist is required because either\n * maxRowsInMemory or intermediate persist period threshold is hit.\n */\npublic class AppenderatorDriverAddResult\n{\n private final SegmentIdentifier segmentIdentifier;\n private final int numRowsInSegment;\n private final long totalNumRowsInAppenderator;\n private final boolean isPersistRequired;\n\n public static AppenderatorDriverAddResult ok(\n SegmentIdentifier segmentIdentifier,\n int numRowsInSegment,\n long totalNumRowsInAppenderator,\n boolean isPersistRequired\n )\n {\n return new AppenderatorDriverAddResult(segmentIdentifier, numRowsInSegment, totalNumRowsInAppenderator, isPersistRequired);\n }\n\n public static AppenderatorDriverAddResult fail()\n {\n return new AppenderatorDriverAddResult(null, 0, 0, false);\n }\n\n private AppenderatorDriverAddResult(\n @Nullable SegmentIdentifier segmentIdentifier,\n int numRowsInSegment,\n long totalNumRowsInAppenderator,\n boolean isPersistRequired\n )\n {\n this.segmentIdentifier = segmentIdentifier;\n this.numRowsInSegment = numRowsInSegment;\n this.totalNumRowsInAppenderator = totalNumRowsInAppenderator;\n this.isPersistRequired = isPersistRequired;\n }\n\n public boolean isOk()\n {\n return segmentIdentifier != null;\n }\n\n public SegmentIdentifier getSegmentIdentifier()\n {\n return segmentIdentifier;\n }\n\n public int getNumRowsInSegment()\n {\n return numRowsInSegment;\n }\n\n public long getTotalNumRowsInAppenderator()\n {\n return totalNumRowsInAppenderator;\n }\n\n public boolean isPersistRequired()\n {\n return isPersistRequired;\n }\n}\n"},"meta":{"kind":"string","value":"{\n \"content_hash\": \"5d0ddfc279a78ec4c2380705926288ca\",\n \"timestamp\": \"\",\n \"source\": \"github\",\n \"line_count\": 74,\n \"max_line_length\": 127,\n \"avg_line_length\": 26.675675675675677,\n \"alnum_prop\": 0.7689969604863222,\n \"repo_name\": \"winval/druid\",\n \"id\": \"4838d58a227fcb6f90d9eaac16c98ee99152fd91\",\n \"size\": \"2779\",\n \"binary\": false,\n \"copies\": \"1\",\n \"ref\": \"refs/heads/master\",\n \"path\": \"server/src/main/java/io/druid/segment/realtime/appenderator/AppenderatorDriverAddResult.java\",\n \"mode\": \"33188\",\n \"license\": \"apache-2.0\",\n \"language\": [\n {\n \"name\": \"ANTLR\",\n \"bytes\": \"1406\"\n },\n {\n \"name\": \"CSS\",\n \"bytes\": \"11623\"\n },\n {\n \"name\": \"HTML\",\n \"bytes\": \"26739\"\n },\n {\n \"name\": \"Java\",\n \"bytes\": \"18262421\"\n },\n {\n \"name\": \"JavaScript\",\n \"bytes\": \"295150\"\n },\n {\n \"name\": \"Makefile\",\n \"bytes\": \"659\"\n },\n {\n \"name\": \"PostScript\",\n \"bytes\": \"5\"\n },\n {\n \"name\": \"R\",\n \"bytes\": \"17002\"\n },\n {\n \"name\": \"Roff\",\n \"bytes\": \"3617\"\n },\n {\n \"name\": \"Shell\",\n \"bytes\": \"6103\"\n },\n {\n \"name\": \"TeX\",\n \"bytes\": \"399444\"\n },\n {\n \"name\": \"Thrift\",\n \"bytes\": \"199\"\n }\n ],\n \"symlink_target\": \"\"\n}"}}},{"rowIdx":334,"cells":{"text":{"kind":"string","value":"\n\n#include \n__FBSDID(\"$FreeBSD$\");\n\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\n#include \n#include \n#include \n#include \n\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\nMODULE_VERSION(linux, 1);\n\nMALLOC_DEFINE(M_LINUX, \"linux\", \"Linux mode structures\");\n\n#if BYTE_ORDER == LITTLE_ENDIAN\n#define SHELLMAGIC 0x2123 /* #! */\n#else\n#define SHELLMAGIC 0x2321\n#endif\n\n/*\n * Allow the sendsig functions to use the ldebug() facility\n * even though they are not syscalls themselves. Map them\n * to syscall 0. This is slightly less bogus than using\n * ldebug(sigreturn).\n */\n#define\tLINUX_SYS_linux_rt_sendsig\t0\n#define\tLINUX_SYS_linux_sendsig\t\t0\n\n#define\tLINUX_PS_STRINGS\t(LINUX_USRSTACK - sizeof(struct ps_strings))\n\nextern char linux_sigcode[];\nextern int linux_szsigcode;\n\nextern struct sysent linux_sysent[LINUX_SYS_MAXSYSCALL];\n\nSET_DECLARE(linux_ioctl_handler_set, struct linux_ioctl_handler);\nSET_DECLARE(linux_device_handler_set, struct linux_device_handler);\n\nstatic int\tlinux_fixup(register_t **stack_base,\n\t\t struct image_params *iparams);\nstatic int\telf_linux_fixup(register_t **stack_base,\n\t\t struct image_params *iparams);\nstatic void linux_sendsig(sig_t catcher, ksiginfo_t *ksi, sigset_t *mask);\nstatic void\texec_linux_setregs(struct thread *td,\n\t\t struct image_params *imgp, u_long stack);\nstatic register_t *linux_copyout_strings(struct image_params *imgp);\nstatic boolean_t linux_trans_osrel(const Elf_Note *note, int32_t *osrel);\n\nstatic int linux_szplatform;\nconst char *linux_platform;\n\nstatic eventhandler_tag linux_exit_tag;\nstatic eventhandler_tag linux_exec_tag;\n\n/*\n * Linux syscalls return negative errno's, we do positive and map them\n * Reference:\n * FreeBSD: src/sys/sys/errno.h\n * Linux: linux-2.6.17.8/include/asm-generic/errno-base.h\n * linux-2.6.17.8/include/asm-generic/errno.h\n */\nstatic int bsd_to_linux_errno[ELAST + 1] = {\n\t-0, -1, -2, -3, -4, -5, -6, -7, -8, -9,\n\t-10, -35, -12, -13, -14, -15, -16, -17, -18, -19,\n\t-20, -21, -22, -23, -24, -25, -26, -27, -28, -29,\n\t-30, -31, -32, -33, -34, -11,-115,-114, -88, -89,\n\t-90, -91, -92, -93, -94, -95, -96, -97, -98, -99,\n\t-100,-101,-102,-103,-104,-105,-106,-107,-108,-109,\n\t-110,-111, -40, -36,-112,-113, -39, -11, -87,-122,\n\t-116, -66, -6, -6, -6, -6, -6, -37, -38, -9,\n\t -6, -6, -43, -42, -75,-125, -84, -95, -16, -74,\n\t -72, -67, -71\n};\n\nint bsd_to_linux_signal[LINUX_SIGTBLSZ] = {\n\tLINUX_SIGHUP, LINUX_SIGINT, LINUX_SIGQUIT, LINUX_SIGILL,\n\tLINUX_SIGTRAP, LINUX_SIGABRT, 0, LINUX_SIGFPE,\n\tLINUX_SIGKILL, LINUX_SIGBUS, LINUX_SIGSEGV, LINUX_SIGSYS,\n\tLINUX_SIGPIPE, LINUX_SIGALRM, LINUX_SIGTERM, LINUX_SIGURG,\n\tLINUX_SIGSTOP, LINUX_SIGTSTP, LINUX_SIGCONT, LINUX_SIGCHLD,\n\tLINUX_SIGTTIN, LINUX_SIGTTOU, LINUX_SIGIO, LINUX_SIGXCPU,\n\tLINUX_SIGXFSZ, LINUX_SIGVTALRM, LINUX_SIGPROF, LINUX_SIGWINCH,\n\t0, LINUX_SIGUSR1, LINUX_SIGUSR2\n};\n\nint linux_to_bsd_signal[LINUX_SIGTBLSZ] = {\n\tSIGHUP, SIGINT, SIGQUIT, SIGILL,\n\tSIGTRAP, SIGABRT, SIGBUS, SIGFPE,\n\tSIGKILL, SIGUSR1, SIGSEGV, SIGUSR2,\n\tSIGPIPE, SIGALRM, SIGTERM, SIGBUS,\n\tSIGCHLD, SIGCONT, SIGSTOP, SIGTSTP,\n\tSIGTTIN, SIGTTOU, SIGURG, SIGXCPU,\n\tSIGXFSZ, SIGVTALRM, SIGPROF, SIGWINCH,\n\tSIGIO, SIGURG, SIGSYS\n};\n\n#define LINUX_T_UNKNOWN 255\nstatic int _bsd_to_linux_trapcode[] = {\n\tLINUX_T_UNKNOWN,\t/* 0 */\n\t6,\t\t\t/* 1 T_PRIVINFLT */\n\tLINUX_T_UNKNOWN,\t/* 2 */\n\t3,\t\t\t/* 3 T_BPTFLT */\n\tLINUX_T_UNKNOWN,\t/* 4 */\n\tLINUX_T_UNKNOWN,\t/* 5 */\n\t16,\t\t\t/* 6 T_ARITHTRAP */\n\t254,\t\t\t/* 7 T_ASTFLT */\n\tLINUX_T_UNKNOWN,\t/* 8 */\n\t13,\t\t\t/* 9 T_PROTFLT */\n\t1,\t\t\t/* 10 T_TRCTRAP */\n\tLINUX_T_UNKNOWN,\t/* 11 */\n\t14,\t\t\t/* 12 T_PAGEFLT */\n\tLINUX_T_UNKNOWN,\t/* 13 */\n\t17,\t\t\t/* 14 T_ALIGNFLT */\n\tLINUX_T_UNKNOWN,\t/* 15 */\n\tLINUX_T_UNKNOWN,\t/* 16 */\n\tLINUX_T_UNKNOWN,\t/* 17 */\n\t0,\t\t\t/* 18 T_DIVIDE */\n\t2,\t\t\t/* 19 T_NMI */\n\t4,\t\t\t/* 20 T_OFLOW */\n\t5,\t\t\t/* 21 T_BOUND */\n\t7,\t\t\t/* 22 T_DNA */\n\t8,\t\t\t/* 23 T_DOUBLEFLT */\n\t9,\t\t\t/* 24 T_FPOPFLT */\n\t10,\t\t\t/* 25 T_TSSFLT */\n\t11,\t\t\t/* 26 T_SEGNPFLT */\n\t12,\t\t\t/* 27 T_STKFLT */\n\t18,\t\t\t/* 28 T_MCHK */\n\t19,\t\t\t/* 29 T_XMMFLT */\n\t15\t\t\t/* 30 T_RESERVED */\n};\n#define bsd_to_linux_trapcode(code) \\\n ((code)args->argc + 1);\n\t(*stack_base)--;\n\tsuword(*stack_base, (intptr_t)(void *)envp);\n\t(*stack_base)--;\n\tsuword(*stack_base, (intptr_t)(void *)argv);\n\t(*stack_base)--;\n\tsuword(*stack_base, imgp->args->argc);\n\treturn (0);\n}\n\nstatic int\nelf_linux_fixup(register_t **stack_base, struct image_params *imgp)\n{\n\tstruct proc *p;\n\tElf32_Auxargs *args;\n\tElf32_Addr *uplatform;\n\tstruct ps_strings *arginfo;\n\tregister_t *pos;\n\tint issetugid;\n\n\tKASSERT(curthread->td_proc == imgp->proc,\n\t (\"unsafe elf_linux_fixup(), should be curproc\"));\n\n\tp = imgp->proc;\n\tissetugid = imgp->proc->p_flag & P_SUGID ? 1 : 0;\n\targinfo = (struct ps_strings *)p->p_sysent->sv_psstrings;\n\tuplatform = (Elf32_Addr *)((caddr_t)arginfo - linux_szplatform);\n\targs = (Elf32_Auxargs *)imgp->auxargs;\n\tpos = *stack_base + (imgp->args->argc + imgp->args->envc + 2);\n\n\tAUXARGS_ENTRY(pos, LINUX_AT_HWCAP, cpu_feature);\n\n\t/*\n\t * Do not export AT_CLKTCK when emulating Linux kernel prior to 2.4.0,\n\t * as it has appeared in the 2.4.0-rc7 first time.\n\t * Being exported, AT_CLKTCK is returned by sysconf(_SC_CLK_TCK),\n\t * glibc falls back to the hard-coded CLK_TCK value when aux entry\n\t * is not present.\n\t * Also see linux_times() implementation.\n\t */\n\tif (linux_kernver(curthread) >= LINUX_KERNVER_2004000)\n\t\tAUXARGS_ENTRY(pos, LINUX_AT_CLKTCK, stclohz);\n\tAUXARGS_ENTRY(pos, AT_PHDR, args->phdr);\n\tAUXARGS_ENTRY(pos, AT_PHENT, args->phent);\n\tAUXARGS_ENTRY(pos, AT_PHNUM, args->phnum);\n\tAUXARGS_ENTRY(pos, AT_PAGESZ, args->pagesz);\n\tAUXARGS_ENTRY(pos, AT_FLAGS, args->flags);\n\tAUXARGS_ENTRY(pos, AT_ENTRY, args->entry);\n\tAUXARGS_ENTRY(pos, AT_BASE, args->base);\n\tAUXARGS_ENTRY(pos, LINUX_AT_SECURE, issetugid);\n\tAUXARGS_ENTRY(pos, AT_UID, imgp->proc->p_ucred->cr_ruid);\n\tAUXARGS_ENTRY(pos, AT_EUID, imgp->proc->p_ucred->cr_svuid);\n\tAUXARGS_ENTRY(pos, AT_GID, imgp->proc->p_ucred->cr_rgid);\n\tAUXARGS_ENTRY(pos, AT_EGID, imgp->proc->p_ucred->cr_svgid);\n\tAUXARGS_ENTRY(pos, LINUX_AT_PLATFORM, PTROUT(uplatform));\n\tif (args->execfd != -1)\n\t\tAUXARGS_ENTRY(pos, AT_EXECFD, args->execfd);\n\tAUXARGS_ENTRY(pos, AT_NULL, 0);\n\n\tfree(imgp->auxargs, M_TEMP);\n\timgp->auxargs = NULL;\n\n\t(*stack_base)--;\n\tsuword(*stack_base, (register_t)imgp->args->argc);\n\treturn (0);\n}\n\n/*\n * Copied from kern/kern_exec.c\n */\nstatic register_t *\nlinux_copyout_strings(struct image_params *imgp)\n{\n\tint argc, envc;\n\tchar **vectp;\n\tchar *stringp, *destp;\n\tregister_t *stack_base;\n\tstruct ps_strings *arginfo;\n\tstruct proc *p;\n\n\t/*\n\t * Calculate string base and vector table pointers.\n\t * Also deal with signal trampoline code for this exec type.\n\t */\n\tp = imgp->proc;\n\targinfo = (struct ps_strings *)p->p_sysent->sv_psstrings;\n\tdestp = (caddr_t)arginfo - SPARE_USRSPACE - linux_szplatform -\n\t roundup((ARG_MAX - imgp->args->stringspace), sizeof(char *));\n\n\t/*\n\t * install LINUX_PLATFORM\n\t */\n\tcopyout(linux_platform, ((caddr_t)arginfo - linux_szplatform),\n\t linux_szplatform);\n\n\t/*\n\t * If we have a valid auxargs ptr, prepare some room\n\t * on the stack.\n\t */\n\tif (imgp->auxargs) {\n\t\t/*\n\t\t * 'AT_COUNT*2' is size for the ELF Auxargs data. This is for\n\t\t * lower compatibility.\n\t\t */\n\t\timgp->auxarg_size = (imgp->auxarg_size) ? imgp->auxarg_size :\n\t\t (LINUX_AT_COUNT * 2);\n\t\t/*\n\t\t * The '+ 2' is for the null pointers at the end of each of\n\t\t * the arg and env vector sets,and imgp->auxarg_size is room\n\t\t * for argument of Runtime loader.\n\t\t */\n\t\tvectp = (char **)(destp - (imgp->args->argc +\n\t\t imgp->args->envc + 2 + imgp->auxarg_size) * sizeof(char *));\n\t} else {\n\t\t/*\n\t\t * The '+ 2' is for the null pointers at the end of each of\n\t\t * the arg and env vector sets\n\t\t */\n\t\tvectp = (char **)(destp - (imgp->args->argc + imgp->args->envc + 2) *\n\t\t sizeof(char *));\n\t}\n\n\t/*\n\t * vectp also becomes our initial stack base\n\t */\n\tstack_base = (register_t *)vectp;\n\n\tstringp = imgp->args->begin_argv;\n\targc = imgp->args->argc;\n\tenvc = imgp->args->envc;\n\n\t/*\n\t * Copy out strings - arguments and environment.\n\t */\n\tcopyout(stringp, destp, ARG_MAX - imgp->args->stringspace);\n\n\t/*\n\t * Fill in \"ps_strings\" struct for ps, w, etc.\n\t */\n\tsuword(&arginfo->ps_argvstr, (long)(intptr_t)vectp);\n\tsuword(&arginfo->ps_nargvstr, argc);\n\n\t/*\n\t * Fill in argument portion of vector table.\n\t */\n\tfor (; argc > 0; --argc) {\n\t\tsuword(vectp++, (long)(intptr_t)destp);\n\t\twhile (*stringp++ != 0)\n\t\t\tdestp++;\n\t\tdestp++;\n\t}\n\n\t/* a null vector table pointer separates the argp's from the envp's */\n\tsuword(vectp++, 0);\n\n\tsuword(&arginfo->ps_envstr, (long)(intptr_t)vectp);\n\tsuword(&arginfo->ps_nenvstr, envc);\n\n\t/*\n\t * Fill in environment portion of vector table.\n\t */\n\tfor (; envc > 0; --envc) {\n\t\tsuword(vectp++, (long)(intptr_t)destp);\n\t\twhile (*stringp++ != 0)\n\t\t\tdestp++;\n\t\tdestp++;\n\t}\n\n\t/* end of vector table is a null pointer */\n\tsuword(vectp, 0);\n\n\treturn (stack_base);\n}\n\n\n\nextern unsigned long linux_sznonrtsigcode;\n\nstatic void\nlinux_rt_sendsig(sig_t catcher, ksiginfo_t *ksi, sigset_t *mask)\n{\n\tstruct thread *td = curthread;\n\tstruct proc *p = td->td_proc;\n\tstruct sigacts *psp;\n\tstruct trapframe *regs;\n\tstruct l_rt_sigframe *fp, frame;\n\tint sig, code;\n\tint oonstack;\n\n\tsig = ksi->ksi_signo;\n\tcode = ksi->ksi_code;\t\n\tPROC_LOCK_ASSERT(p, MA_OWNED);\n\tpsp = p->p_sigacts;\n\tmtx_assert(&psp->ps_mtx, MA_OWNED);\n\tregs = td->td_frame;\n\toonstack = sigonstack(regs->tf_esp);\n\n#ifdef DEBUG\n\tif (ldebug(rt_sendsig))\n\t\tprintf(ARGS(rt_sendsig, \"%p, %d, %p, %u\"),\n\t\t catcher, sig, (void*)mask, code);\n#endif\n\t/*\n\t * Allocate space for the signal handler context.\n\t */\n\tif ((td->td_pflags & TDP_ALTSTACK) && !oonstack &&\n\t SIGISMEMBER(psp->ps_sigonstack, sig)) {\n\t\tfp = (struct l_rt_sigframe *)(td->td_sigstk.ss_sp +\n\t\t td->td_sigstk.ss_size - sizeof(struct l_rt_sigframe));\n\t} else\n\t\tfp = (struct l_rt_sigframe *)regs->tf_esp - 1;\n\tmtx_unlock(&psp->ps_mtx);\n\n\t/*\n\t * Build the argument list for the signal handler.\n\t */\n\tif (p->p_sysent->sv_sigtbl)\n\t\tif (sig <= p->p_sysent->sv_sigsize)\n\t\t\tsig = p->p_sysent->sv_sigtbl[_SIG_IDX(sig)];\n\n\tbzero(&frame, sizeof(frame));\n\n\tframe.sf_handler = catcher;\n\tframe.sf_sig = sig;\n\tframe.sf_siginfo = &fp->sf_si;\n\tframe.sf_ucontext = &fp->sf_sc;\n\n\t/* Fill in POSIX parts */\n\tksiginfo_to_lsiginfo(ksi, &frame.sf_si, sig);\n\n\t/*\n\t * Build the signal context to be used by sigreturn.\n\t */\n\tframe.sf_sc.uc_flags = 0;\t\t/* XXX ??? */\n\tframe.sf_sc.uc_link = NULL;\t\t/* XXX ??? */\n\n\tframe.sf_sc.uc_stack.ss_sp = td->td_sigstk.ss_sp;\n\tframe.sf_sc.uc_stack.ss_size = td->td_sigstk.ss_size;\n\tframe.sf_sc.uc_stack.ss_flags = (td->td_pflags & TDP_ALTSTACK)\n\t ? ((oonstack) ? LINUX_SS_ONSTACK : 0) : LINUX_SS_DISABLE;\n\tPROC_UNLOCK(p);\n\n\tbsd_to_linux_sigset(mask, &frame.sf_sc.uc_sigmask);\n\n\tframe.sf_sc.uc_mcontext.sc_mask = frame.sf_sc.uc_sigmask.__bits[0];\n\tframe.sf_sc.uc_mcontext.sc_gs = rgs();\n\tframe.sf_sc.uc_mcontext.sc_fs = regs->tf_fs;\n\tframe.sf_sc.uc_mcontext.sc_es = regs->tf_es;\n\tframe.sf_sc.uc_mcontext.sc_ds = regs->tf_ds;\n\tframe.sf_sc.uc_mcontext.sc_edi = regs->tf_edi;\n\tframe.sf_sc.uc_mcontext.sc_esi = regs->tf_esi;\n\tframe.sf_sc.uc_mcontext.sc_ebp = regs->tf_ebp;\n\tframe.sf_sc.uc_mcontext.sc_ebx = regs->tf_ebx;\n\tframe.sf_sc.uc_mcontext.sc_edx = regs->tf_edx;\n\tframe.sf_sc.uc_mcontext.sc_ecx = regs->tf_ecx;\n\tframe.sf_sc.uc_mcontext.sc_eax = regs->tf_eax;\n\tframe.sf_sc.uc_mcontext.sc_eip = regs->tf_eip;\n\tframe.sf_sc.uc_mcontext.sc_cs = regs->tf_cs;\n\tframe.sf_sc.uc_mcontext.sc_eflags = regs->tf_eflags;\n\tframe.sf_sc.uc_mcontext.sc_esp_at_signal = regs->tf_esp;\n\tframe.sf_sc.uc_mcontext.sc_ss = regs->tf_ss;\n\tframe.sf_sc.uc_mcontext.sc_err = regs->tf_err;\n\tframe.sf_sc.uc_mcontext.sc_cr2 = (register_t)ksi->ksi_addr;\n\tframe.sf_sc.uc_mcontext.sc_trapno = bsd_to_linux_trapcode(code);\n\n#ifdef DEBUG\n\tif (ldebug(rt_sendsig))\n\t\tprintf(LMSG(\"rt_sendsig flags: 0x%x, sp: %p, ss: 0x%x, mask: 0x%x\"),\n\t\t frame.sf_sc.uc_stack.ss_flags, td->td_sigstk.ss_sp,\n\t\t td->td_sigstk.ss_size, frame.sf_sc.uc_mcontext.sc_mask);\n#endif\n\n\tif (copyout(&frame, fp, sizeof(frame)) != 0) {\n\t\t/*\n\t\t * Process has trashed its stack; give it an illegal\n\t\t * instruction to halt it in its tracks.\n\t\t */\n#ifdef DEBUG\n\t\tif (ldebug(rt_sendsig))\n\t\t\tprintf(LMSG(\"rt_sendsig: bad stack %p, oonstack=%x\"),\n\t\t\t fp, oonstack);\n#endif\n\t\tPROC_LOCK(p);\n\t\tsigexit(td, SIGILL);\n\t}\n\n\t/*\n\t * Build context to run handler in.\n\t */\n\tregs->tf_esp = (int)fp;\n\tregs->tf_eip = p->p_sysent->sv_sigcode_base + linux_sznonrtsigcode;\n\tregs->tf_eflags &= ~(PSL_T | PSL_VM | PSL_D);\n\tregs->tf_cs = _ucodesel;\n\tregs->tf_ds = _udatasel;\n\tregs->tf_es = _udatasel;\n\tregs->tf_fs = _udatasel;\n\tregs->tf_ss = _udatasel;\n\tPROC_LOCK(p);\n\tmtx_lock(&psp->ps_mtx);\n}\n\n\n/*\n * Send an interrupt to process.\n *\n * Stack is set up to allow sigcode stored\n * in u. to call routine, followed by kcall\n * to sigreturn routine below. After sigreturn\n * resets the signal mask, the stack, and the\n * frame pointer, it returns to the user\n * specified pc, psl.\n */\nstatic void\nlinux_sendsig(sig_t catcher, ksiginfo_t *ksi, sigset_t *mask)\n{\n\tstruct thread *td = curthread;\n\tstruct proc *p = td->td_proc;\n\tstruct sigacts *psp;\n\tstruct trapframe *regs;\n\tstruct l_sigframe *fp, frame;\n\tl_sigset_t lmask;\n\tint sig, code;\n\tint oonstack, i;\n\n\tPROC_LOCK_ASSERT(p, MA_OWNED);\n\tpsp = p->p_sigacts;\n\tsig = ksi->ksi_signo;\n\tcode = ksi->ksi_code;\n\tmtx_assert(&psp->ps_mtx, MA_OWNED);\n\tif (SIGISMEMBER(psp->ps_siginfo, sig)) {\n\t\t/* Signal handler installed with SA_SIGINFO. */\n\t\tlinux_rt_sendsig(catcher, ksi, mask);\n\t\treturn;\n\t}\n\tregs = td->td_frame;\n\toonstack = sigonstack(regs->tf_esp);\n\n#ifdef DEBUG\n\tif (ldebug(sendsig))\n\t\tprintf(ARGS(sendsig, \"%p, %d, %p, %u\"),\n\t\t catcher, sig, (void*)mask, code);\n#endif\n\n\t/*\n\t * Allocate space for the signal handler context.\n\t */\n\tif ((td->td_pflags & TDP_ALTSTACK) && !oonstack &&\n\t SIGISMEMBER(psp->ps_sigonstack, sig)) {\n\t\tfp = (struct l_sigframe *)(td->td_sigstk.ss_sp +\n\t\t td->td_sigstk.ss_size - sizeof(struct l_sigframe));\n\t} else\n\t\tfp = (struct l_sigframe *)regs->tf_esp - 1;\n\tmtx_unlock(&psp->ps_mtx);\n\tPROC_UNLOCK(p);\n\n\t/*\n\t * Build the argument list for the signal handler.\n\t */\n\tif (p->p_sysent->sv_sigtbl)\n\t\tif (sig <= p->p_sysent->sv_sigsize)\n\t\t\tsig = p->p_sysent->sv_sigtbl[_SIG_IDX(sig)];\n\n\tbzero(&frame, sizeof(frame));\n\n\tframe.sf_handler = catcher;\n\tframe.sf_sig = sig;\n\n\tbsd_to_linux_sigset(mask, &lmask);\n\n\t/*\n\t * Build the signal context to be used by sigreturn.\n\t */\n\tframe.sf_sc.sc_mask = lmask.__bits[0];\n\tframe.sf_sc.sc_gs = rgs();\n\tframe.sf_sc.sc_fs = regs->tf_fs;\n\tframe.sf_sc.sc_es = regs->tf_es;\n\tframe.sf_sc.sc_ds = regs->tf_ds;\n\tframe.sf_sc.sc_edi = regs->tf_edi;\n\tframe.sf_sc.sc_esi = regs->tf_esi;\n\tframe.sf_sc.sc_ebp = regs->tf_ebp;\n\tframe.sf_sc.sc_ebx = regs->tf_ebx;\n\tframe.sf_sc.sc_edx = regs->tf_edx;\n\tframe.sf_sc.sc_ecx = regs->tf_ecx;\n\tframe.sf_sc.sc_eax = regs->tf_eax;\n\tframe.sf_sc.sc_eip = regs->tf_eip;\n\tframe.sf_sc.sc_cs = regs->tf_cs;\n\tframe.sf_sc.sc_eflags = regs->tf_eflags;\n\tframe.sf_sc.sc_esp_at_signal = regs->tf_esp;\n\tframe.sf_sc.sc_ss = regs->tf_ss;\n\tframe.sf_sc.sc_err = regs->tf_err;\n\tframe.sf_sc.sc_cr2 = (register_t)ksi->ksi_addr;\n\tframe.sf_sc.sc_trapno = bsd_to_linux_trapcode(ksi->ksi_trapno);\n\n\tfor (i = 0; i < (LINUX_NSIG_WORDS-1); i++)\n\t\tframe.sf_extramask[i] = lmask.__bits[i+1];\n\n\tif (copyout(&frame, fp, sizeof(frame)) != 0) {\n\t\t/*\n\t\t * Process has trashed its stack; give it an illegal\n\t\t * instruction to halt it in its tracks.\n\t\t */\n\t\tPROC_LOCK(p);\n\t\tsigexit(td, SIGILL);\n\t}\n\n\t/*\n\t * Build context to run handler in.\n\t */\n\tregs->tf_esp = (int)fp;\n\tregs->tf_eip = p->p_sysent->sv_sigcode_base;\n\tregs->tf_eflags &= ~(PSL_T | PSL_VM | PSL_D);\n\tregs->tf_cs = _ucodesel;\n\tregs->tf_ds = _udatasel;\n\tregs->tf_es = _udatasel;\n\tregs->tf_fs = _udatasel;\n\tregs->tf_ss = _udatasel;\n\tPROC_LOCK(p);\n\tmtx_lock(&psp->ps_mtx);\n}\n\n/*\n * System call to cleanup state after a signal\n * has been taken. Reset signal mask and\n * stack state from context left by sendsig (above).\n * Return to previous pc and psl as specified by\n * context left by sendsig. Check carefully to\n * make sure that the user has not modified the\n * psl to gain improper privileges or to cause\n * a machine fault.\n */\nint\nlinux_sigreturn(struct thread *td, struct linux_sigreturn_args *args)\n{\n\tstruct l_sigframe frame;\n\tstruct trapframe *regs;\n\tl_sigset_t lmask;\n\tsigset_t bmask;\n\tint eflags, i;\n\tksiginfo_t ksi;\n\n\tregs = td->td_frame;\n\n#ifdef DEBUG\n\tif (ldebug(sigreturn))\n\t\tprintf(ARGS(sigreturn, \"%p\"), (void *)args->sfp);\n#endif\n\t/*\n\t * The trampoline code hands us the sigframe.\n\t * It is unsafe to keep track of it ourselves, in the event that a\n\t * program jumps out of a signal handler.\n\t */\n\tif (copyin(args->sfp, &frame, sizeof(frame)) != 0)\n\t\treturn (EFAULT);\n\n\t/*\n\t * Check for security violations.\n\t */\n#define\tEFLAGS_SECURE(ef, oef)\t((((ef) ^ (oef)) & ~PSL_USERCHANGE) == 0)\n\teflags = frame.sf_sc.sc_eflags;\n\tif (!EFLAGS_SECURE(eflags, regs->tf_eflags))\n\t\treturn(EINVAL);\n\n\t/*\n\t * Don't allow users to load a valid privileged %cs. Let the\n\t * hardware check for invalid selectors, excess privilege in\n\t * other selectors, invalid %eip's and invalid %esp's.\n\t */\n#define\tCS_SECURE(cs)\t(ISPL(cs) == SEL_UPL)\n\tif (!CS_SECURE(frame.sf_sc.sc_cs)) {\n\t\tksiginfo_init_trap(&ksi);\n\t\tksi.ksi_signo = SIGBUS;\n\t\tksi.ksi_code = BUS_OBJERR;\n\t\tksi.ksi_trapno = T_PROTFLT;\n\t\tksi.ksi_addr = (void *)regs->tf_eip;\n\t\ttrapsignal(td, &ksi);\n\t\treturn(EINVAL);\n\t}\n\n\tlmask.__bits[0] = frame.sf_sc.sc_mask;\n\tfor (i = 0; i < (LINUX_NSIG_WORDS-1); i++)\n\t\tlmask.__bits[i+1] = frame.sf_extramask[i];\n\tlinux_to_bsd_sigset(&lmask, &bmask);\n\tkern_sigprocmask(td, SIG_SETMASK, &bmask, NULL, 0);\n\n\t/*\n\t * Restore signal context.\n\t */\n\t/* %gs was restored by the trampoline. */\n\tregs->tf_fs = frame.sf_sc.sc_fs;\n\tregs->tf_es = frame.sf_sc.sc_es;\n\tregs->tf_ds = frame.sf_sc.sc_ds;\n\tregs->tf_edi = frame.sf_sc.sc_edi;\n\tregs->tf_esi = frame.sf_sc.sc_esi;\n\tregs->tf_ebp = frame.sf_sc.sc_ebp;\n\tregs->tf_ebx = frame.sf_sc.sc_ebx;\n\tregs->tf_edx = frame.sf_sc.sc_edx;\n\tregs->tf_ecx = frame.sf_sc.sc_ecx;\n\tregs->tf_eax = frame.sf_sc.sc_eax;\n\tregs->tf_eip = frame.sf_sc.sc_eip;\n\tregs->tf_cs = frame.sf_sc.sc_cs;\n\tregs->tf_eflags = eflags;\n\tregs->tf_esp = frame.sf_sc.sc_esp_at_signal;\n\tregs->tf_ss = frame.sf_sc.sc_ss;\n\n\treturn (EJUSTRETURN);\n}\n\n/*\n * System call to cleanup state after a signal\n * has been taken. Reset signal mask and\n * stack state from context left by rt_sendsig (above).\n * Return to previous pc and psl as specified by\n * context left by sendsig. Check carefully to\n * make sure that the user has not modified the\n * psl to gain improper privileges or to cause\n * a machine fault.\n */\nint\nlinux_rt_sigreturn(struct thread *td, struct linux_rt_sigreturn_args *args)\n{\n\tstruct l_ucontext uc;\n\tstruct l_sigcontext *context;\n\tsigset_t bmask;\n\tl_stack_t *lss;\n\tstack_t ss;\n\tstruct trapframe *regs;\n\tint eflags;\n\tksiginfo_t ksi;\n\n\tregs = td->td_frame;\n\n#ifdef DEBUG\n\tif (ldebug(rt_sigreturn))\n\t\tprintf(ARGS(rt_sigreturn, \"%p\"), (void *)args->ucp);\n#endif\n\t/*\n\t * The trampoline code hands us the ucontext.\n\t * It is unsafe to keep track of it ourselves, in the event that a\n\t * program jumps out of a signal handler.\n\t */\n\tif (copyin(args->ucp, &uc, sizeof(uc)) != 0)\n\t\treturn (EFAULT);\n\n\tcontext = &uc.uc_mcontext;\n\n\t/*\n\t * Check for security violations.\n\t */\n#define\tEFLAGS_SECURE(ef, oef)\t((((ef) ^ (oef)) & ~PSL_USERCHANGE) == 0)\n\teflags = context->sc_eflags;\n\tif (!EFLAGS_SECURE(eflags, regs->tf_eflags))\n\t\treturn(EINVAL);\n\n\t/*\n\t * Don't allow users to load a valid privileged %cs. Let the\n\t * hardware check for invalid selectors, excess privilege in\n\t * other selectors, invalid %eip's and invalid %esp's.\n\t */\n#define\tCS_SECURE(cs)\t(ISPL(cs) == SEL_UPL)\n\tif (!CS_SECURE(context->sc_cs)) {\n\t\tksiginfo_init_trap(&ksi);\n\t\tksi.ksi_signo = SIGBUS;\n\t\tksi.ksi_code = BUS_OBJERR;\n\t\tksi.ksi_trapno = T_PROTFLT;\n\t\tksi.ksi_addr = (void *)regs->tf_eip;\n\t\ttrapsignal(td, &ksi);\n\t\treturn(EINVAL);\n\t}\n\n\tlinux_to_bsd_sigset(&uc.uc_sigmask, &bmask);\n\tkern_sigprocmask(td, SIG_SETMASK, &bmask, NULL, 0);\n\n\t/*\n\t * Restore signal context\n\t */\n\t/* %gs was restored by the trampoline. */\n\tregs->tf_fs = context->sc_fs;\n\tregs->tf_es = context->sc_es;\n\tregs->tf_ds = context->sc_ds;\n\tregs->tf_edi = context->sc_edi;\n\tregs->tf_esi = context->sc_esi;\n\tregs->tf_ebp = context->sc_ebp;\n\tregs->tf_ebx = context->sc_ebx;\n\tregs->tf_edx = context->sc_edx;\n\tregs->tf_ecx = context->sc_ecx;\n\tregs->tf_eax = context->sc_eax;\n\tregs->tf_eip = context->sc_eip;\n\tregs->tf_cs = context->sc_cs;\n\tregs->tf_eflags = eflags;\n\tregs->tf_esp = context->sc_esp_at_signal;\n\tregs->tf_ss = context->sc_ss;\n\n\t/*\n\t * call sigaltstack & ignore results..\n\t */\n\tlss = &uc.uc_stack;\n\tss.ss_sp = lss->ss_sp;\n\tss.ss_size = lss->ss_size;\n\tss.ss_flags = linux_to_bsd_sigaltstack(lss->ss_flags);\n\n#ifdef DEBUG\n\tif (ldebug(rt_sigreturn))\n\t\tprintf(LMSG(\"rt_sigret flags: 0x%x, sp: %p, ss: 0x%x, mask: 0x%x\"),\n\t\t ss.ss_flags, ss.ss_sp, ss.ss_size, context->sc_mask);\n#endif\n\t(void)kern_sigaltstack(td, &ss, NULL);\n\n\treturn (EJUSTRETURN);\n}\n\nstatic int\nlinux_fetch_syscall_args(struct thread *td, struct syscall_args *sa)\n{\n\tstruct proc *p;\n\tstruct trapframe *frame;\n\n\tp = td->td_proc;\n\tframe = td->td_frame;\n\n\tsa->code = frame->tf_eax;\n\tsa->args[0] = frame->tf_ebx;\n\tsa->args[1] = frame->tf_ecx;\n\tsa->args[2] = frame->tf_edx;\n\tsa->args[3] = frame->tf_esi;\n\tsa->args[4] = frame->tf_edi;\n\tsa->args[5] = frame->tf_ebp;\t/* Unconfirmed */\n\n\tif (sa->code >= p->p_sysent->sv_size)\n\t\tsa->callp = &p->p_sysent->sv_table[0];\n \telse\n \t\tsa->callp = &p->p_sysent->sv_table[sa->code];\n\tsa->narg = sa->callp->sy_narg;\n\n\ttd->td_retval[0] = 0;\n\ttd->td_retval[1] = frame->tf_edx;\n\n\treturn (0);\n}\n\n/*\n * If a linux binary is exec'ing something, try this image activator\n * first. We override standard shell script execution in order to\n * be able to modify the interpreter path. We only do this if a linux\n * binary is doing the exec, so we do not create an EXEC module for it.\n */\nstatic int\texec_linux_imgact_try(struct image_params *iparams);\n\nstatic int\nexec_linux_imgact_try(struct image_params *imgp)\n{\n const char *head = (const char *)imgp->image_header;\n char *rpath;\n int error = -1;\n\n /*\n * The interpreter for shell scripts run from a linux binary needs\n * to be located in /compat/linux if possible in order to recursively\n * maintain linux path emulation.\n */\n if (((const short *)head)[0] == SHELLMAGIC) {\n\t /*\n\t * Run our normal shell image activator. If it succeeds attempt\n\t * to use the alternate path for the interpreter. If an alternate\n\t * path is found, use our stringspace to store it.\n\t */\n\t if ((error = exec_shell_imgact(imgp)) == 0) {\n\t\t linux_emul_convpath(FIRST_THREAD_IN_PROC(imgp->proc),\n\t\t\timgp->interpreter_name, UIO_SYSSPACE, &rpath, 0, AT_FDCWD);\n\t\t if (rpath != NULL)\n\t\t\t imgp->args->fname_buf =\n\t\t\t\timgp->interpreter_name = rpath;\n\t }\n }\n return (error);\n}\n\n/*\n * exec_setregs may initialize some registers differently than Linux\n * does, thus potentially confusing Linux binaries. If necessary, we\n * override the exec_setregs default(s) here.\n */\nstatic void\nexec_linux_setregs(struct thread *td, struct image_params *imgp, u_long stack)\n{\n\tstruct pcb *pcb = td->td_pcb;\n\n\texec_setregs(td, imgp, stack);\n\n\t/* Linux sets %gs to 0, we default to _udatasel */\n\tpcb->pcb_gs = 0;\n\tload_gs(0);\n\n\tpcb->pcb_initial_npxcw = __LINUX_NPXCW__;\n}\n\nstatic void\nlinux_get_machine(const char **dst)\n{\n\n\tswitch (cpu_class) {\n\tcase CPUCLASS_686:\n\t\t*dst = \"i686\";\n\t\tbreak;\n\tcase CPUCLASS_586:\n\t\t*dst = \"i586\";\n\t\tbreak;\n\tcase CPUCLASS_486:\n\t\t*dst = \"i486\";\n\t\tbreak;\n\tdefault:\n\t\t*dst = \"i386\";\n\t}\n}\n\nstruct sysentvec linux_sysvec = {\n\t.sv_size\t= LINUX_SYS_MAXSYSCALL,\n\t.sv_table\t= linux_sysent,\n\t.sv_mask\t= 0,\n\t.sv_sigsize\t= LINUX_SIGTBLSZ,\n\t.sv_sigtbl\t= bsd_to_linux_signal,\n\t.sv_errsize\t= ELAST + 1,\n\t.sv_errtbl\t= bsd_to_linux_errno,\n\t.sv_transtrap\t= translate_traps,\n\t.sv_fixup\t= linux_fixup,\n\t.sv_sendsig\t= linux_sendsig,\n\t.sv_sigcode\t= linux_sigcode,\n\t.sv_szsigcode\t= &linux_szsigcode,\n\t.sv_prepsyscall\t= NULL,\n\t.sv_name\t= \"Linux a.out\",\n\t.sv_coredump\t= NULL,\n\t.sv_imgact_try\t= exec_linux_imgact_try,\n\t.sv_minsigstksz\t= LINUX_MINSIGSTKSZ,\n\t.sv_pagesize\t= PAGE_SIZE,\n\t.sv_minuser\t= VM_MIN_ADDRESS,\n\t.sv_maxuser\t= VM_MAXUSER_ADDRESS,\n\t.sv_usrstack\t= LINUX_USRSTACK,\n\t.sv_psstrings\t= PS_STRINGS,\n\t.sv_stackprot\t= VM_PROT_ALL,\n\t.sv_copyout_strings = exec_copyout_strings,\n\t.sv_setregs\t= exec_linux_setregs,\n\t.sv_fixlimit\t= NULL,\n\t.sv_maxssiz\t= NULL,\n\t.sv_flags\t= SV_ABI_LINUX | SV_AOUT | SV_IA32 | SV_ILP32,\n\t.sv_set_syscall_retval = cpu_set_syscall_retval,\n\t.sv_fetch_syscall_args = linux_fetch_syscall_args,\n\t.sv_syscallnames = NULL,\n\t.sv_shared_page_base = LINUX_SHAREDPAGE,\n\t.sv_shared_page_len = PAGE_SIZE,\n\t.sv_schedtail\t= linux_schedtail,\n};\nINIT_SYSENTVEC(aout_sysvec, &linux_sysvec);\n\nstruct sysentvec elf_linux_sysvec = {\n\t.sv_size\t= LINUX_SYS_MAXSYSCALL,\n\t.sv_table\t= linux_sysent,\n\t.sv_mask\t= 0,\n\t.sv_sigsize\t= LINUX_SIGTBLSZ,\n\t.sv_sigtbl\t= bsd_to_linux_signal,\n\t.sv_errsize\t= ELAST + 1,\n\t.sv_errtbl\t= bsd_to_linux_errno,\n\t.sv_transtrap\t= translate_traps,\n\t.sv_fixup\t= elf_linux_fixup,\n\t.sv_sendsig\t= linux_sendsig,\n\t.sv_sigcode\t= linux_sigcode,\n\t.sv_szsigcode\t= &linux_szsigcode,\n\t.sv_prepsyscall\t= NULL,\n\t.sv_name\t= \"Linux ELF\",\n\t.sv_coredump\t= elf32_coredump,\n\t.sv_imgact_try\t= exec_linux_imgact_try,\n\t.sv_minsigstksz\t= LINUX_MINSIGSTKSZ,\n\t.sv_pagesize\t= PAGE_SIZE,\n\t.sv_minuser\t= VM_MIN_ADDRESS,\n\t.sv_maxuser\t= VM_MAXUSER_ADDRESS,\n\t.sv_usrstack\t= LINUX_USRSTACK,\n\t.sv_psstrings\t= LINUX_PS_STRINGS,\n\t.sv_stackprot\t= VM_PROT_ALL,\n\t.sv_copyout_strings = linux_copyout_strings,\n\t.sv_setregs\t= exec_linux_setregs,\n\t.sv_fixlimit\t= NULL,\n\t.sv_maxssiz\t= NULL,\n\t.sv_flags\t= SV_ABI_LINUX | SV_IA32 | SV_ILP32 | SV_SHP,\n\t.sv_set_syscall_retval = cpu_set_syscall_retval,\n\t.sv_fetch_syscall_args = linux_fetch_syscall_args,\n\t.sv_syscallnames = NULL,\n\t.sv_shared_page_base = LINUX_SHAREDPAGE,\n\t.sv_shared_page_len = PAGE_SIZE,\n\t.sv_schedtail\t= linux_schedtail,\n};\nINIT_SYSENTVEC(elf_sysvec, &elf_linux_sysvec);\n\nstatic char GNU_ABI_VENDOR[] = \"GNU\";\nstatic int GNULINUX_ABI_DESC = 0;\n\nstatic boolean_t\nlinux_trans_osrel(const Elf_Note *note, int32_t *osrel)\n{\n\tconst Elf32_Word *desc;\n\tuintptr_t p;\n\n\tp = (uintptr_t)(note + 1);\n\tp += roundup2(note->n_namesz, sizeof(Elf32_Addr));\n\n\tdesc = (const Elf32_Word *)p;\n\tif (desc[0] != GNULINUX_ABI_DESC)\n\t\treturn (FALSE);\n\n\t/*\n\t * For linux we encode osrel as follows (see linux_mib.c):\n\t * VVVMMMIII (version, major, minor), see linux_mib.c.\n\t */\n\t*osrel = desc[1] * 1000000 + desc[2] * 1000 + desc[3];\n\n\treturn (TRUE);\n}\n\nstatic Elf_Brandnote linux_brandnote = {\n\t.hdr.n_namesz\t= sizeof(GNU_ABI_VENDOR),\n\t.hdr.n_descsz\t= 16,\t/* XXX at least 16 */\n\t.hdr.n_type\t= 1,\n\t.vendor\t\t= GNU_ABI_VENDOR,\n\t.flags\t\t= BN_TRANSLATE_OSREL,\n\t.trans_osrel\t= linux_trans_osrel\n};\n\nstatic Elf32_Brandinfo linux_brand = {\n\t.brand\t\t= ELFOSABI_LINUX,\n\t.machine\t= EM_386,\n\t.compat_3_brand\t= \"Linux\",\n\t.emul_path\t= \"/compat/linux\",\n\t.interp_path\t= \"/lib/ld-linux.so.1\",\n\t.sysvec\t\t= &elf_linux_sysvec,\n\t.interp_newpath\t= NULL,\n\t.brand_note\t= &linux_brandnote,\n\t.flags\t\t= BI_CAN_EXEC_DYN | BI_BRAND_NOTE\n};\n\nstatic Elf32_Brandinfo linux_glibc2brand = {\n\t.brand\t\t= ELFOSABI_LINUX,\n\t.machine\t= EM_386,\n\t.compat_3_brand\t= \"Linux\",\n\t.emul_path\t= \"/compat/linux\",\n\t.interp_path\t= \"/lib/ld-linux.so.2\",\n\t.sysvec\t\t= &elf_linux_sysvec,\n\t.interp_newpath\t= NULL,\n\t.brand_note\t= &linux_brandnote,\n\t.flags\t\t= BI_CAN_EXEC_DYN | BI_BRAND_NOTE\n};\n\nElf32_Brandinfo *linux_brandlist[] = {\n\t&linux_brand,\n\t&linux_glibc2brand,\n\tNULL\n};\n\nstatic int\nlinux_elf_modevent(module_t mod, int type, void *data)\n{\n\tElf32_Brandinfo **brandinfo;\n\tint error;\n\tstruct linux_ioctl_handler **lihp;\n\tstruct linux_device_handler **ldhp;\n\n\terror = 0;\n\n\tswitch(type) {\n\tcase MOD_LOAD:\n\t\tfor (brandinfo = &linux_brandlist[0]; *brandinfo != NULL;\n\t\t ++brandinfo)\n\t\t\tif (elf32_insert_brand_entry(*brandinfo) < 0)\n\t\t\t\terror = EINVAL;\n\t\tif (error == 0) {\n\t\t\tSET_FOREACH(lihp, linux_ioctl_handler_set)\n\t\t\t\tlinux_ioctl_register_handler(*lihp);\n\t\t\tSET_FOREACH(ldhp, linux_device_handler_set)\n\t\t\t\tlinux_device_register_handler(*ldhp);\n\t\t\tmtx_init(&emul_lock, \"emuldata lock\", NULL, MTX_DEF);\n\t\t\tsx_init(&emul_shared_lock, \"emuldata->shared lock\");\n\t\t\tLIST_INIT(&futex_list);\n\t\t\tmtx_init(&futex_mtx, \"ftllk\", NULL, MTX_DEF);\n\t\t\tlinux_exit_tag = EVENTHANDLER_REGISTER(process_exit, linux_proc_exit,\n\t\t\t NULL, 1000);\n\t\t\tlinux_exec_tag = EVENTHANDLER_REGISTER(process_exec, linux_proc_exec,\n\t\t\t NULL, 1000);\n\t\t\tlinux_get_machine(&linux_platform);\n\t\t\tlinux_szplatform = roundup(strlen(linux_platform) + 1,\n\t\t\t sizeof(char *));\n\t\t\tlinux_osd_jail_register();\n\t\t\tstclohz = (stathz ? stathz : hz);\n\t\t\tif (bootverbose)\n\t\t\t\tprintf(\"Linux ELF exec handler installed\\n\");\n\t\t} else\n\t\t\tprintf(\"cannot insert Linux ELF brand handler\\n\");\n\t\tbreak;\n\tcase MOD_UNLOAD:\n\t\tfor (brandinfo = &linux_brandlist[0]; *brandinfo != NULL;\n\t\t ++brandinfo)\n\t\t\tif (elf32_brand_inuse(*brandinfo))\n\t\t\t\terror = EBUSY;\n\t\tif (error == 0) {\n\t\t\tfor (brandinfo = &linux_brandlist[0];\n\t\t\t *brandinfo != NULL; ++brandinfo)\n\t\t\t\tif (elf32_remove_brand_entry(*brandinfo) < 0)\n\t\t\t\t\terror = EINVAL;\n\t\t}\n\t\tif (error == 0) {\n\t\t\tSET_FOREACH(lihp, linux_ioctl_handler_set)\n\t\t\t\tlinux_ioctl_unregister_handler(*lihp);\n\t\t\tSET_FOREACH(ldhp, linux_device_handler_set)\n\t\t\t\tlinux_device_unregister_handler(*ldhp);\n\t\t\tmtx_destroy(&emul_lock);\n\t\t\tsx_destroy(&emul_shared_lock);\n\t\t\tmtx_destroy(&futex_mtx);\n\t\t\tEVENTHANDLER_DEREGISTER(process_exit, linux_exit_tag);\n\t\t\tEVENTHANDLER_DEREGISTER(process_exec, linux_exec_tag);\n\t\t\tlinux_osd_jail_deregister();\n\t\t\tif (bootverbose)\n\t\t\t\tprintf(\"Linux ELF exec handler removed\\n\");\n\t\t} else\n\t\t\tprintf(\"Could not deinstall ELF interpreter entry\\n\");\n\t\tbreak;\n\tdefault:\n\t\treturn EOPNOTSUPP;\n\t}\n\treturn error;\n}\n\nstatic moduledata_t linux_elf_mod = {\n\t\"linuxelf\",\n\tlinux_elf_modevent,\n\t0\n};\n\nDECLARE_MODULE_TIED(linuxelf, linux_elf_mod, SI_SUB_EXEC, SI_ORDER_ANY);\n"},"meta":{"kind":"string","value":"{\n \"content_hash\": \"3da574bd6121674bf89fe4be596baf91\",\n \"timestamp\": \"\",\n \"source\": \"github\",\n \"line_count\": 1135,\n \"max_line_length\": 78,\n \"avg_line_length\": 28.01762114537445,\n \"alnum_prop\": 0.6517295597484277,\n \"repo_name\": \"jrobhoward/SCADAbase\",\n \"id\": \"ab46672b9d87c6874ec8d2de888c48fdd91827b2\",\n \"size\": \"33311\",\n \"binary\": false,\n \"copies\": \"1\",\n \"ref\": \"refs/heads/SCADAbase\",\n \"path\": \"sys/i386/linux/linux_sysvec.c\",\n \"mode\": \"33188\",\n \"license\": \"bsd-3-clause\",\n \"language\": [\n {\n \"name\": \"AGS Script\",\n \"bytes\": \"62471\"\n },\n {\n \"name\": \"Assembly\",\n \"bytes\": \"4615704\"\n },\n {\n \"name\": \"Awk\",\n \"bytes\": \"273794\"\n },\n {\n \"name\": \"Batchfile\",\n \"bytes\": \"20333\"\n },\n {\n \"name\": \"C\",\n \"bytes\": \"457666547\"\n },\n {\n \"name\": \"C++\",\n \"bytes\": \"91495356\"\n },\n {\n \"name\": \"CMake\",\n \"bytes\": \"17632\"\n },\n {\n \"name\": \"CSS\",\n \"bytes\": \"104220\"\n },\n {\n \"name\": \"ChucK\",\n \"bytes\": \"39\"\n },\n {\n \"name\": \"D\",\n \"bytes\": \"6321\"\n },\n {\n \"name\": \"DIGITAL Command Language\",\n \"bytes\": \"10638\"\n },\n {\n \"name\": \"DTrace\",\n \"bytes\": \"1904158\"\n },\n {\n \"name\": \"Emacs Lisp\",\n \"bytes\": \"32010\"\n },\n {\n \"name\": \"EmberScript\",\n \"bytes\": \"286\"\n },\n {\n \"name\": \"Forth\",\n \"bytes\": \"204603\"\n },\n {\n \"name\": \"GAP\",\n \"bytes\": \"72078\"\n },\n {\n \"name\": \"Groff\",\n \"bytes\": \"32376243\"\n },\n {\n \"name\": \"HTML\",\n \"bytes\": \"5776268\"\n },\n {\n \"name\": \"Haskell\",\n \"bytes\": \"2458\"\n },\n {\n \"name\": \"IGOR Pro\",\n \"bytes\": \"6510\"\n },\n {\n \"name\": \"Java\",\n \"bytes\": \"112547\"\n },\n {\n \"name\": \"KRL\",\n \"bytes\": \"4950\"\n },\n {\n \"name\": \"Lex\",\n \"bytes\": \"425858\"\n },\n {\n \"name\": \"Limbo\",\n \"bytes\": \"4037\"\n },\n {\n \"name\": \"Logos\",\n \"bytes\": \"179088\"\n },\n {\n \"name\": \"Makefile\",\n \"bytes\": \"12750766\"\n },\n {\n \"name\": \"Mathematica\",\n \"bytes\": \"21782\"\n },\n {\n \"name\": \"Max\",\n \"bytes\": \"4105\"\n },\n {\n \"name\": \"Module Management System\",\n \"bytes\": \"816\"\n },\n {\n \"name\": \"Objective-C\",\n \"bytes\": \"1571960\"\n },\n {\n \"name\": \"PHP\",\n \"bytes\": \"2471\"\n },\n {\n \"name\": \"PLSQL\",\n \"bytes\": \"96552\"\n },\n {\n \"name\": \"PLpgSQL\",\n \"bytes\": \"2212\"\n },\n {\n \"name\": \"Perl\",\n \"bytes\": \"3947402\"\n },\n {\n \"name\": \"Perl6\",\n \"bytes\": \"122803\"\n },\n {\n \"name\": \"PostScript\",\n \"bytes\": \"152255\"\n },\n {\n \"name\": \"Prolog\",\n \"bytes\": \"42792\"\n },\n {\n \"name\": \"Protocol Buffer\",\n \"bytes\": \"54964\"\n },\n {\n \"name\": \"Python\",\n \"bytes\": \"381066\"\n },\n {\n \"name\": \"R\",\n \"bytes\": \"764\"\n },\n {\n \"name\": \"Rebol\",\n \"bytes\": \"738\"\n },\n {\n \"name\": \"Ruby\",\n \"bytes\": \"67015\"\n },\n {\n \"name\": \"Scheme\",\n \"bytes\": \"5087\"\n },\n {\n \"name\": \"Scilab\",\n \"bytes\": \"196\"\n },\n {\n \"name\": \"Shell\",\n \"bytes\": \"10963470\"\n },\n {\n \"name\": \"SourcePawn\",\n \"bytes\": \"2293\"\n },\n {\n \"name\": \"SuperCollider\",\n \"bytes\": \"80208\"\n },\n {\n \"name\": \"Tcl\",\n \"bytes\": \"7102\"\n },\n {\n \"name\": \"TeX\",\n \"bytes\": \"720582\"\n },\n {\n \"name\": \"VimL\",\n \"bytes\": \"19597\"\n },\n {\n \"name\": \"XS\",\n \"bytes\": \"17496\"\n },\n {\n \"name\": \"XSLT\",\n \"bytes\": \"4564\"\n },\n {\n \"name\": \"Yacc\",\n \"bytes\": \"1881915\"\n }\n ],\n \"symlink_target\": \"\"\n}"}}},{"rowIdx":335,"cells":{"text":{"kind":"string","value":"\nimport { dirname, join, normalize } from '@angular-devkit/core';\nimport {\n Rule,\n SchematicContext,\n SchematicsException,\n Tree,\n chain,\n noop,\n schematic,\n} from '@angular-devkit/schematics';\nimport { Schema as ComponentOptions } from '../component/schema';\nimport * as ts from '../third_party/github.com/Microsoft/TypeScript/lib/typescript';\nimport {\n addImportToModule,\n addSymbolToNgModuleMetadata,\n findNode,\n getDecoratorMetadata,\n getSourceNodes,\n insertImport,\n isImported,\n} from '../utility/ast-utils';\nimport { Change, InsertChange } from '../utility/change';\nimport { getAppModulePath } from '../utility/ng-ast-utils';\nimport { targetBuildNotFoundError } from '../utility/project-targets';\nimport { getWorkspace, updateWorkspace } from '../utility/workspace';\nimport { BrowserBuilderOptions, Builders, ServerBuilderOptions } from '../utility/workspace-models';\nimport { Schema as AppShellOptions } from './schema';\n\nfunction getSourceFile(host: Tree, path: string): ts.SourceFile {\n const buffer = host.read(path);\n if (!buffer) {\n throw new SchematicsException(`Could not find ${path}.`);\n }\n const content = buffer.toString();\n const source = ts.createSourceFile(path, content, ts.ScriptTarget.Latest, true);\n\n return source;\n}\n\nfunction getServerModulePath(\n host: Tree,\n sourceRoot: string,\n mainPath: string,\n): string | null {\n const mainSource = getSourceFile(host, join(normalize(sourceRoot), mainPath));\n const allNodes = getSourceNodes(mainSource);\n const expNode = allNodes.find(node => ts.isExportDeclaration(node));\n if (!expNode) {\n return null;\n }\n const relativePath = (expNode as ts.ExportDeclaration).moduleSpecifier as ts.StringLiteral;\n const modulePath = normalize(`/${sourceRoot}/${relativePath.text}.ts`);\n\n return modulePath;\n}\n\ninterface TemplateInfo {\n templateProp?: ts.PropertyAssignment;\n templateUrlProp?: ts.PropertyAssignment;\n}\n\nfunction getComponentTemplateInfo(host: Tree, componentPath: string): TemplateInfo {\n const compSource = getSourceFile(host, componentPath);\n const compMetadata = getDecoratorMetadata(compSource, 'Component', '@angular/core')[0];\n\n return {\n templateProp: getMetadataProperty(compMetadata, 'template'),\n templateUrlProp: getMetadataProperty(compMetadata, 'templateUrl'),\n };\n}\n\nfunction getComponentTemplate(host: Tree, compPath: string, tmplInfo: TemplateInfo): string {\n let template = '';\n\n if (tmplInfo.templateProp) {\n template = tmplInfo.templateProp.getFullText();\n } else if (tmplInfo.templateUrlProp) {\n const templateUrl = (tmplInfo.templateUrlProp.initializer as ts.StringLiteral).text;\n const dir = dirname(normalize(compPath));\n const templatePath = join(dir, templateUrl);\n const buffer = host.read(templatePath);\n if (buffer) {\n template = buffer.toString();\n }\n }\n\n return template;\n}\n\nfunction getBootstrapComponentPath(\n host: Tree,\n mainPath: string,\n): string {\n const modulePath = getAppModulePath(host, mainPath);\n const moduleSource = getSourceFile(host, modulePath);\n\n const metadataNode = getDecoratorMetadata(moduleSource, 'NgModule', '@angular/core')[0];\n const bootstrapProperty = getMetadataProperty(metadataNode, 'bootstrap');\n\n const arrLiteral = (bootstrapProperty as ts.PropertyAssignment)\n .initializer as ts.ArrayLiteralExpression;\n\n const componentSymbol = arrLiteral.elements[0].getText();\n\n const relativePath = getSourceNodes(moduleSource)\n .filter(node => node.kind === ts.SyntaxKind.ImportDeclaration)\n .filter(imp => {\n return findNode(imp, ts.SyntaxKind.Identifier, componentSymbol);\n })\n .map((imp: ts.ImportDeclaration) => {\n const pathStringLiteral = imp.moduleSpecifier as ts.StringLiteral;\n\n return pathStringLiteral.text;\n })[0];\n\n return join(dirname(normalize(modulePath)), relativePath + '.ts');\n}\n// end helper functions.\n\nfunction validateProject(mainPath: string): Rule {\n return (host: Tree, context: SchematicContext) => {\n const routerOutletCheckRegex = /([\\s\\S]*?)<\\/router\\-outlet>/;\n\n const componentPath = getBootstrapComponentPath(host, mainPath);\n const tmpl = getComponentTemplateInfo(host, componentPath);\n const template = getComponentTemplate(host, componentPath, tmpl);\n if (!routerOutletCheckRegex.test(template)) {\n const errorMsg =\n `Prerequisite for app shell is to define a router-outlet in your root component.`;\n context.logger.error(errorMsg);\n throw new SchematicsException(errorMsg);\n }\n };\n}\n\nfunction addUniversalTarget(options: AppShellOptions): Rule {\n return () => {\n // Copy options.\n const universalOptions = {\n ...options,\n };\n\n // Delete non-universal options.\n delete universalOptions.universalProject;\n delete universalOptions.route;\n delete universalOptions.name;\n delete universalOptions.outDir;\n delete universalOptions.root;\n delete universalOptions.index;\n delete universalOptions.sourceDir;\n\n return schematic('universal', universalOptions);\n };\n}\n\nfunction addAppShellConfigToWorkspace(options: AppShellOptions): Rule {\n return () => {\n if (!options.route) {\n throw new SchematicsException(`Route is not defined`);\n }\n\n return updateWorkspace(workspace => {\n const project = workspace.projects.get(options.clientProject);\n if (!project) {\n return;\n }\n\n project.targets.add({\n name: 'app-shell',\n builder: Builders.AppShell,\n options: {\n browserTarget: `${options.clientProject}:build`,\n serverTarget: `${options.clientProject}:server`,\n route: options.route,\n },\n configurations: {\n production: {\n browserTarget: `${options.clientProject}:build:production`,\n serverTarget: `${options.clientProject}:server:production`,\n },\n },\n });\n });\n };\n}\n\nfunction addRouterModule(mainPath: string): Rule {\n return (host: Tree) => {\n const modulePath = getAppModulePath(host, mainPath);\n const moduleSource = getSourceFile(host, modulePath);\n const changes = addImportToModule(moduleSource, modulePath, 'RouterModule', '@angular/router');\n const recorder = host.beginUpdate(modulePath);\n changes.forEach((change: Change) => {\n if (change instanceof InsertChange) {\n recorder.insertLeft(change.pos, change.toAdd);\n }\n });\n host.commitUpdate(recorder);\n\n return host;\n };\n}\n\nfunction getMetadataProperty(metadata: ts.Node, propertyName: string): ts.PropertyAssignment {\n const properties = (metadata as ts.ObjectLiteralExpression).properties;\n const property = properties\n .filter(prop => prop.kind === ts.SyntaxKind.PropertyAssignment)\n .filter((prop: ts.PropertyAssignment) => {\n const name = prop.name;\n switch (name.kind) {\n case ts.SyntaxKind.Identifier:\n return (name as ts.Identifier).getText() === propertyName;\n case ts.SyntaxKind.StringLiteral:\n return (name as ts.StringLiteral).text === propertyName;\n }\n\n return false;\n })[0];\n\n return property as ts.PropertyAssignment;\n}\n\nfunction addServerRoutes(options: AppShellOptions): Rule {\n return async (host: Tree) => {\n // The workspace gets updated so this needs to be reloaded\n const workspace = await getWorkspace(host);\n const clientProject = workspace.projects.get(options.clientProject);\n if (!clientProject) {\n throw new Error('Universal schematic removed client project.');\n }\n const clientServerTarget = clientProject.targets.get('server');\n if (!clientServerTarget) {\n throw new Error('Universal schematic did not add server target to client project.');\n }\n const clientServerOptions = clientServerTarget.options as unknown as ServerBuilderOptions;\n if (!clientServerOptions) {\n throw new SchematicsException('Server target does not contain options.');\n }\n const modulePath = getServerModulePath(host, clientProject.sourceRoot || 'src', options.main as string);\n if (modulePath === null) {\n throw new SchematicsException('Universal/server module not found.');\n }\n\n let moduleSource = getSourceFile(host, modulePath);\n if (!isImported(moduleSource, 'Routes', '@angular/router')) {\n const recorder = host.beginUpdate(modulePath);\n const routesChange = insertImport(moduleSource,\n modulePath,\n 'Routes',\n '@angular/router') as InsertChange;\n if (routesChange.toAdd) {\n recorder.insertLeft(routesChange.pos, routesChange.toAdd);\n }\n\n const imports = getSourceNodes(moduleSource)\n .filter(node => node.kind === ts.SyntaxKind.ImportDeclaration)\n .sort((a, b) => a.getStart() - b.getStart());\n const insertPosition = imports[imports.length - 1].getEnd();\n const routeText =\n `\\n\\nconst routes: Routes = [ { path: '${options.route}', component: AppShellComponent }];`;\n recorder.insertRight(insertPosition, routeText);\n host.commitUpdate(recorder);\n }\n\n moduleSource = getSourceFile(host, modulePath);\n if (!isImported(moduleSource, 'RouterModule', '@angular/router')) {\n const recorder = host.beginUpdate(modulePath);\n const routerModuleChange = insertImport(moduleSource,\n modulePath,\n 'RouterModule',\n '@angular/router') as InsertChange;\n\n if (routerModuleChange.toAdd) {\n recorder.insertLeft(routerModuleChange.pos, routerModuleChange.toAdd);\n }\n\n const metadataChange = addSymbolToNgModuleMetadata(\n moduleSource, modulePath, 'imports', 'RouterModule.forRoot(routes)');\n if (metadataChange) {\n metadataChange.forEach((change: InsertChange) => {\n recorder.insertRight(change.pos, change.toAdd);\n });\n }\n host.commitUpdate(recorder);\n }\n };\n}\n\nfunction addShellComponent(options: AppShellOptions): Rule {\n const componentOptions: ComponentOptions = {\n name: 'app-shell',\n module: options.rootModuleFileName,\n project: options.clientProject,\n };\n\n return schematic('component', componentOptions);\n}\n\nexport default function (options: AppShellOptions): Rule {\n return async tree => {\n const workspace = await getWorkspace(tree);\n const clientProject = workspace.projects.get(options.clientProject);\n if (!clientProject || clientProject.extensions.projectType !== 'application') {\n throw new SchematicsException(`A client project type of \"application\" is required.`);\n }\n const clientBuildTarget = clientProject.targets.get('build');\n if (!clientBuildTarget) {\n throw targetBuildNotFoundError();\n }\n const clientBuildOptions =\n (clientBuildTarget.options || {}) as unknown as BrowserBuilderOptions;\n\n return chain([\n validateProject(clientBuildOptions.main),\n clientProject.targets.has('server') ? noop() : addUniversalTarget(options),\n addAppShellConfigToWorkspace(options),\n addRouterModule(clientBuildOptions.main),\n addServerRoutes(options),\n addShellComponent(options),\n ]);\n };\n}\n"},"meta":{"kind":"string","value":"{\n \"content_hash\": \"2358f50847501bb1d1f9ebc7574969dc\",\n \"timestamp\": \"\",\n \"source\": \"github\",\n \"line_count\": 323,\n \"max_line_length\": 108,\n \"avg_line_length\": 34.90402476780186,\n \"alnum_prop\": 0.684761397906688,\n \"repo_name\": \"hansl/angular-cli\",\n \"id\": \"a2d661abf5659c4ed69d6008336911264069cb06\",\n \"size\": \"11476\",\n \"binary\": false,\n \"copies\": \"3\",\n \"ref\": \"refs/heads/master\",\n \"path\": \"packages/schematics/angular/app-shell/index.ts\",\n \"mode\": \"33188\",\n \"license\": \"mit\",\n \"language\": [\n {\n \"name\": \"CSS\",\n \"bytes\": \"734\"\n },\n {\n \"name\": \"Dockerfile\",\n \"bytes\": \"36\"\n },\n {\n \"name\": \"HTML\",\n \"bytes\": \"36848\"\n },\n {\n \"name\": \"JavaScript\",\n \"bytes\": \"59268\"\n },\n {\n \"name\": \"Shell\",\n \"bytes\": \"7396\"\n },\n {\n \"name\": \"Starlark\",\n \"bytes\": \"46242\"\n },\n {\n \"name\": \"TypeScript\",\n \"bytes\": \"3412424\"\n }\n ],\n \"symlink_target\": \"\"\n}"}}},{"rowIdx":336,"cells":{"text":{"kind":"string","value":"package tests.integration.Trees.cartesianTree;\r\n\r\nimport org.junit.Assert;\r\nimport org.junit.Test;\r\nimport SLPs.SLPExtractor;\r\nimport cartesianTree.CartesianTreeManagerFactory;\r\nimport cartesianTree.slpBuilders.CartesianSlpTreeBuilder;\r\nimport cartesianTree.slpBuilders.ICartesianSlpTreeBuilder;\r\nimport commons.settings.ISettings;\r\nimport dataContracts.DataFactoryType;\r\nimport dataContracts.LZFactorDef;\r\nimport dataContracts.SLPModel;\r\nimport dataContracts.statistics.Statistics;\r\nimport helpers.FactorizationScenarios;\r\nimport serialization.products.IProductSerializer;\r\nimport tests.integration.IntegrationTestBase;\r\n\r\npublic class CartesianSLPBuilderTests extends IntegrationTestBase {\r\n\r\n @Test\r\n public void test() {\r\n LZFactorDef[] factors = FactorizationScenarios.generate(200000);\r\n \r\n IProductSerializer productSerializer = container.get(IProductSerializer.class);\r\n ICartesianSlpTreeBuilder slpTreeBuilder = new CartesianSlpTreeBuilder(new CartesianTreeManagerFactory(container.get(ISettings.class), DataFactoryType.memory), new SLPExtractor(), productSerializer);\r\n SLPModel slpModel = slpTreeBuilder.buildSlp(factors, new Statistics());\r\n String expected = FactorizationScenarios.stringify(factors);\r\n String actuals = slpModel.toString();\r\n Assert.assertEquals(expected, actuals);\r\n }\r\n}\r\n"},"meta":{"kind":"string","value":"{\n \"content_hash\": \"3e8a5e11dcde3581c2ba1e4eade8d277\",\n \"timestamp\": \"\",\n \"source\": \"github\",\n \"line_count\": 31,\n \"max_line_length\": 206,\n \"avg_line_length\": 44.193548387096776,\n \"alnum_prop\": 0.7905109489051095,\n \"repo_name\": \"jaamal/overclocking\",\n \"id\": \"40bd889ece914f1060f9cf78df92e1163e112d93\",\n \"size\": \"1370\",\n \"binary\": false,\n \"copies\": \"1\",\n \"ref\": \"refs/heads/master\",\n \"path\": \"sources/Tests/src/tests/integration/Trees/cartesianTree/CartesianSLPBuilderTests.java\",\n \"mode\": \"33261\",\n \"license\": \"mit\",\n \"language\": [\n {\n \"name\": \"Batchfile\",\n \"bytes\": \"2990\"\n },\n {\n \"name\": \"C++\",\n \"bytes\": \"8729\"\n },\n {\n \"name\": \"Java\",\n \"bytes\": \"926976\"\n },\n {\n \"name\": \"TeX\",\n \"bytes\": \"6505694\"\n }\n ],\n \"symlink_target\": \"\"\n}"}}},{"rowIdx":337,"cells":{"text":{"kind":"string","value":"\n\n \n \n \n tlc: Not compatible 👼\n \n \n \n \n \n \n \n \n \n \n
\n
\n \n
\n
\n
\n
\n « Up\n

\n tlc\n \n 20171128\n Not compatible 👼\n \n

\n

📅 (2022-10-19 08:48:41 UTC)

\n

Context

\n
# Packages matching: installed\n# Name              # Installed # Synopsis\nbase-bigarray       base\nbase-num            base        Num library distributed with the OCaml compiler\nbase-ocamlbuild     base        OCamlbuild binary and libraries distributed with the OCaml compiler\nbase-threads        base\nbase-unix           base\ncamlp5              7.14        Preprocessor-pretty-printer of OCaml\nconf-findutils      1           Virtual package relying on findutils\nconf-perl           2           Virtual package relying on perl\ncoq                 8.5.0       Formal proof management system\nnum                 0           The Num library for arbitrary-precision integer and rational arithmetic\nocaml               4.02.3      The OCaml compiler (virtual package)\nocaml-base-compiler 4.02.3      Official 4.02.3 release\nocaml-config        1           OCaml Switch Configuration\n# opam file:\nopam-version: &quot;2.0&quot;\nmaintainer: &quot;francois.pottier@inria.fr&quot;\nauthors: [\n  &quot;Arthur Charguéraud &lt;arthur.chargueraud@inria.fr&gt;&quot;\n]\nhomepage: &quot;https://gitlab.inria.fr/charguer/tlc&quot;\ndev-repo: &quot;git+https://gitlab.inria.fr/charguer/tlc.git&quot;\nbug-reports: &quot;tlc-users@lists.gforge.inria.fr&quot;\nlicense: &quot;CeCILL-B&quot;\nbuild: [\n  [make &quot;-j%{jobs}%&quot;]\n]\ninstall: [\n  [make &quot;install&quot;]\n]\ndepends: [\n  &quot;ocaml&quot;\n  &quot;coq&quot; {&gt;= &quot;8.6&quot; &amp; &lt; &quot;8.7~&quot;}\n]\nsynopsis: &quot;A general-purpose library&quot;\nurl {\n  src: &quot;https://github.com/charguer/tlc/archive/refs/tags/20171128.tar.gz&quot;\n  checksum: &quot;md5=f1036a9aa16fd3b081395717dcccd7d3&quot;\n}\n
\n

Lint

\n
\n
Command
\n
true
\n
Return code
\n
0
\n
\n

Dry install 🏜️

\n

Dry install with the current Coq version:

\n
\n
Command
\n
opam install -y --show-action coq-tlc.20171128 coq.8.5.0
\n
Return code
\n
5120
\n
Output
\n
[NOTE] Package coq is already installed (current version is 8.5.0).\nThe following dependencies couldn&#39;t be met:\n  - coq-tlc -&gt; coq &gt;= 8.6 -&gt; ocaml &gt;= 4.05.0\n      base of this switch (use `--unlock-base&#39; to force)\nYour request can&#39;t be satisfied:\n  - No available version of coq satisfies the constraints\nNo solution found, exiting\n
\n
\n

Dry install without Coq/switch base, to test if the problem was incompatibility with the current Coq/OCaml version:

\n
\n
Command
\n
opam remove -y coq; opam install -y --show-action --unlock-base coq-tlc.20171128
\n
Return code
\n
0
\n
\n

Install dependencies

\n
\n
Command
\n
true
\n
Return code
\n
0
\n
Duration
\n
0 s
\n
\n

Install 🚀

\n
\n
Command
\n
true
\n
Return code
\n
0
\n
Duration
\n
0 s
\n
\n

Installation size

\n

No files were installed.

\n

Uninstall 🧹

\n
\n
Command
\n
true
\n
Return code
\n
0
\n
Missing removes
\n
\n none\n
\n
Wrong removes
\n
\n none\n
\n
\n
\n
\n
\n
\n
\n

\n Sources are on GitHub © Guillaume Claret 🐣\n

\n
\n
\n \n \n \n\n"},"meta":{"kind":"string","value":"{\n \"content_hash\": \"cdb245e7ad78e70d7fd86994c76abb7a\",\n \"timestamp\": \"\",\n \"source\": \"github\",\n \"line_count\": 167,\n \"max_line_length\": 159,\n \"avg_line_length\": 39.616766467065865,\n \"alnum_prop\": 0.5309854897218863,\n \"repo_name\": \"coq-bench/coq-bench.github.io\",\n \"id\": \"6ea18b7501c7391743f77e2cf3293e4cef9349fe\",\n \"size\": \"6642\",\n \"binary\": false,\n \"copies\": \"1\",\n \"ref\": \"refs/heads/master\",\n \"path\": \"clean/Linux-x86_64-4.02.3-2.0.6/released/8.5.0/tlc/20171128.html\",\n \"mode\": \"33188\",\n \"license\": \"mit\",\n \"language\": [],\n \"symlink_target\": \"\"\n}"}}},{"rowIdx":338,"cells":{"text":{"kind":"string","value":"from django.forms.models import ModelForm, model_to_dict\nfrom moderation.models import MODERATION_STATUS_PENDING,\\\n MODERATION_STATUS_REJECTED\nfrom django.core.exceptions import ObjectDoesNotExist\n\n\nclass BaseModeratedObjectForm(ModelForm):\n\n def __init__(self, *args, **kwargs):\n instance = kwargs.get('instance', None)\n\n if instance:\n try:\n if instance.moderated_object.moderation_status in\\\n [MODERATION_STATUS_PENDING, MODERATION_STATUS_REJECTED] and\\\n not instance.moderated_object.moderator.\\\n visible_until_rejected:\n initial =\\\n model_to_dict(instance.moderated_object.changed_object)\n kwargs.setdefault('initial', {})\n kwargs['initial'].update(initial)\n except ObjectDoesNotExist:\n pass\n\n super(BaseModeratedObjectForm, self).__init__(*args, **kwargs)\n"},"meta":{"kind":"string","value":"{\n \"content_hash\": \"f68dac2c244a621c7676c08e9ea49ee8\",\n \"timestamp\": \"\",\n \"source\": \"github\",\n \"line_count\": 25,\n \"max_line_length\": 79,\n \"avg_line_length\": 38.8,\n \"alnum_prop\": 0.6113402061855671,\n \"repo_name\": \"ebrelsford/django-moderation\",\n \"id\": \"c352b6d4d92d1064992910fab7f8c068c1bcc264\",\n \"size\": \"970\",\n \"binary\": false,\n \"copies\": \"1\",\n \"ref\": \"refs/heads/master\",\n \"path\": \"src/moderation/forms.py\",\n \"mode\": \"33188\",\n \"license\": \"bsd-3-clause\",\n \"language\": [\n {\n \"name\": \"Python\",\n \"bytes\": \"150827\"\n },\n {\n \"name\": \"Shell\",\n \"bytes\": \"425\"\n }\n ],\n \"symlink_target\": \"\"\n}"}}},{"rowIdx":339,"cells":{"text":{"kind":"string","value":"layout: guide\n---\n\nReact exports a handful of utility types that may be useful to you when typing\nadvanced React patterns. In previous sections we have seen a few of them. The\nfollowing is a complete reference for each of these types along with some\nexamples for how/where to use them.\n\nTable of contents:\n\n- [`React.Node`](#toc-react-node)\n- [`React.Element`](#toc-react-element)\n- [`React.ChildrenArray`](#toc-react-childrenarray)\n- [`React.ComponentType`](#toc-react-componenttype)\n- [`React.StatelessFunctionalComponent`](#toc-react-statelessfunctionalcomponent)\n- [`React.ElementType`](#toc-react-elementtype)\n- [`React.Key`](#toc-react-key)\n- [`React.Ref`](#toc-react-ref)\n- [`React.ElementProps`](#toc-react-elementprops)\n- [`React.ElementConfig`](#toc-react-elementconfig)\n- [`React.ElementRef`](#toc-react-elementref)\n\nThese types are all exported as named type exports from the `react` module. If\nyou want to access them as members on the `React` object (e.g.\n[`React.Node`](#toc-react-node) or\n[`React.StatelessFunctionalComponent`](#toc-react-statelessfunctionalcomponent)) and\nyou are importing React as an ES module then you should import `React` as a\nnamespace:\n\n```js\nimport * as React from 'react';\n```\n\nIf you are using CommonJS you can also require React:\n\n```js\nconst React = require('react');\n```\n\nYou can also use named type imports in either an ES module environment or a\nCommonJS environment:\n\n```js\nimport type {Node} from 'react';\n```\n\nWe will refer to all the types in the following reference as if we imported them\nwith:\n\n```js\nimport * as React from 'react';\n```\n\n> **Note:** While importing React with a default import works:\n>\n> ```\n> import React from 'react';\n> ```\n>\n> You will have access to all of the values that React exports, but you will\n> **not** have access to the types documented below! This is because Flow will\n> not add types to a default export since the default export could be any value\n> (like a number). Flow will add exported named types to an ES namespace object\n> which you can get with `import * as React from 'react'` since Flow knows if\n> you export a value with the same name as an exported type.\n>\n> Again, if you import React with: `import React from 'react'` you will be able\n> to access `React.Component`, `React.createElement()`, `React.Children`, and\n> other JavaScript *values*. However, you will not be able to access\n> [`React.Node`](#toc-react-node), [`React.ChildrenArray`](#toc-react-childrenarray) or\n> other Flow *types*. You will need to use a named type import like:\n> `import type {Node} from 'react'` in addition to your default import.\n\n## `React.Node` \n\nThis represents any node that can be rendered in a React application.\n`React.Node` can be undefined, null, a boolean, a number, a string, a React\nelement, or an array of any of those types recursively.\n\nIf you need a return type for your component `render()` methods or you need a\ngeneric type for a children prop then you should use `React.Node`.\n\nHere is an example of `React.Node` being used as the return type to `render()`:\n\n```js\nclass MyComponent extends React.Component<{}> {\n render(): React.Node {\n // ...\n }\n}\n```\n\nIt may also be used as the return type of a stateless functional component:\n\n```js\nfunction MyComponent(props: {}): React.Node {\n // ...\n}\n```\n\nYou don't need to annotate the return type of either your `render()` method or a\nstateless functional component. However, if you want to annotate the return type\nthen `React.Node` is the generic to use.\n\nHere is an example of `React.Node` as the prop type for children:\n\n```js\nfunction MyComponent({ children }: { children: React.Node }) {\n return
{children}
;\n}\n```\n\nAll `react-dom` JSX intrinsics have `React.Node` as their children type.\n`
`, ``, and all the rest.\n\nThe definition of `React.Node` can be roughly approximated with a\n[`React.ChildrenArray`](#toc-react-childrenarray):\n\n```js\ntype Node = React.ChildrenArray>;\n```\n\n## `React.Element` \n\nA React element is the type for the value of a JSX element:\n\n```js\nconst element: React.Element<'div'> =
;\n```\n\n`React.Element` is also the return type of\n`React.createElement()`.\n\nA `React.Element` takes a single type argument,\n`typeof Component`. `typeof Component` is the component type of the React\nelement. For an intrinsic element, `typeof Component` will be the string literal\nfor the intrinsic you used. Here are a few examples with DOM intrinsics:\n\n```js\n(
: React.Element<'div'>); // OK\n(: React.Element<'span'>); // OK\n(
: React.Element<'span'>); // Error: div is not a span.\n```\n\n`typeof Component` can also be your React class component or stateless\nfunctional component.\n\n```js\nclass Foo extends React.Component<{}> {}\nfunction Bar(props: {}) {}\n\n(: React.Element); // OK\n(: React.Element); // OK\n(: React.Element); // Error: Foo is not Bar\n```\n\nTake note of the `typeof`, it is required! `Foo` without `typeof` would be the\ntype of an instance of `Foo`. So: `(new Foo(): Foo)`. We want the type *of*\n`Foo` not the type of an instance of `Foo`. So: `(Foo: typeof Foo)`.\n`Class` would also work here, but we prefer `typeof` for consistency with\nstateless functional components.\n\nWe also need `typeof` for `Bar` because `Bar` is a value. So we want to get the\ntype *of* the value `Bar`. `(Bar: Bar)` is an error because `Bar` cannot be used\nas a type, so the following is correct: `(Bar: typeof Bar)`.\n\n## `React.ChildrenArray` \n\nA React children array can be a single value or an array nested to any level.\nIt is designed to be used with the [`React.Children` API][].\n\n[`React.Children` API]: https://facebook.github.io/react/docs/react-api.html#react.children\n\nFor example if you want to get a normal JavaScript array from a\n`React.ChildrenArray` see the following example:\n\n```js\nimport * as React from 'react';\n\n// A children array can be a single value...\nconst children: React.ChildrenArray = 42;\n// ...or an arbitrarily nested array.\nconst children: React.ChildrenArray = [[1, 2], 3, [4, 5]];\n\n// Using the `React.Children` API can flatten the array.\nconst array: Array = React.Children.toArray(children);\n```\n\n## `React.ComponentType` \n\nThis is a union of a class component or a stateless functional component. This\nis the type you want to use for functions that receive or return React\ncomponents such as higher-order components or other utilities.\n\nHere is how you may use `React.ComponentType` with\n[`React.Element`](#toc-react-element) to construct a component\nwith a specific set of props:\n\n```js\ntype Props = {\n foo: number,\n bar: number,\n};\n\nfunction createMyElement>(\n Component: C,\n): React.Element {\n return ;\n}\n```\n\n`React.ComponentType` does not include intrinsic JSX element types like\n`div` or `span`. See [`React.ElementType`](#toc-react-elementtype) if you also want\nto include JSX intrinsics.\n\nThe definition for `React.ComponentType` is roughly:\n\n```js\ntype ComponentType =\n | React.StatelessFunctionalComponent\n | Class>;\n```\n\n## `React.StatelessFunctionalComponent` \n\nThis is the type of a React stateless functional component.\n\nThe definition for `React.StatelessFunctionalComponent` is roughly:\n\n```js\ntype StatelessFunctionalComponent =\n (props: Props) => React.Node;\n```\n\nThere is a little bit more to the definition of\n`React.StatelessFunctionalComponent` for context and props.\n\n## `React.ElementType` \n\nSimilar to [`React.ComponentType`](#toc-react-componenttype) except it also\nincludes JSX intrinsics (strings).\n\nThe definition for `React.ElementType` is roughly:\n\n```js\ntype ElementType =\n | string\n | React.ComponentType;\n```\n\n## `React.Key` \n\nThe type of the key prop on React elements. It is a union of strings and\nnumbers defined as:\n\n```js\ntype Key = string | number;\n```\n\n## `React.Ref` \n\nThe type of the [ref prop on React elements][]. `React.Ref`\ncould be a string or a ref function.\n\n[ref prop on React elements]: https://facebook.github.io/react/docs/refs-and-the-dom.html\n\nThe ref function will take one and only argument which will be the element\ninstance which is retrieved using\n[`React.ElementRef`](#toc-react-elementref) or null since\n[React will pass null into a ref function when unmounting][].\n\n[React will pass null into a ref function when unmounting]: https://facebook.github.io/react/docs/refs-and-the-dom.html#adding-a-ref-to-a-dom-element\n\nLike [`React.Element`](#toc-react-element), `typeof Component`\nmust be the type *of* a React component so you need to use `typeof` as in\n`React.Ref`.\n\nThe definition for `React.Ref` is roughly:\n\n```js\ntype Ref =\n | string\n | (instance: React.ElementRef | null) => mixed;\n```\n\n## `React.ElementProps` \n\nGets the props for a React element type, *without* preserving the optionality of `defaultProps`. `Type` could be a React class\ncomponent, a stateless functional component, or a JSX intrinsic string. This\ntype is used for the `props` property on [`React.Element`](#toc-react-element).\n\nLike [`React.Element`](#toc-react-element), `Type` must be the\ntype *of* a React component so you need to use `typeof` as in\n`React.ElementProps`.\n\n> **Note:** Because [`React.ElementProps`](#toc-react-elementprops) does not preserve the optionality of `defaultProps`, [`React.ElementConfig`](#toc-react-elementconfig) (which does) is more often the right choice, especially for simple props pass-through as with [higher-order components](../hoc/#toc-supporting-defaultprops-with-react-elementconfig).\n\n## `React.ElementConfig` \n\nLike `React.ElementProps` this utility gets the type of a\ncomponent's props but *preserves* the optionality of `defaultProps`!\n\nFor example,\n\n```js\nimport * as React from 'react';\n\nclass MyComponent extends React.Component<{foo: number}> {\n static defaultProps = {foo: 42};\n\n render() {\n return this.props.foo;\n }\n}\n\n// `React.ElementProps<>` requires `foo` even though it has a `defaultProp`.\n({foo: 42}: React.ElementProps);\n\n// `React.ElementConfig<>` does not require `foo` since it has a `defaultProp`.\n({}: React.ElementConfig);\n```\n\nLike [`React.Element`](#toc-react-element), `Type` must be the\ntype *of* a React component so you need to use `typeof` as in\n`React.ElementProps`.\n\n## `React.ElementRef` \n\nGets the instance type for a React element. The instance will be different for\nvarious component types:\n\n- React class components will be the class instance. So if you had\n `class Foo extends React.Component<{}> {}` and used\n `React.ElementRef` then the type would be the instance of `Foo`.\n- React stateless functional components do not have a backing instance and so\n `React.ElementRef` (when `Bar` is `function Bar() {}`) will give\n you the undefined type.\n- JSX intrinsics like `div` will give you their DOM instance. For\n `React.ElementRef<'div'>` that would be `HTMLDivElement`. For\n `React.ElementRef<'input'>` that would be `HTMLInputElement`.\n\nLike [`React.Element`](#toc-react-element), `Type` must be the\ntype *of* a React component so you need to use `typeof` as in\n`React.ElementRef`.\n"},"meta":{"kind":"string","value":"{\n \"content_hash\": \"83954184c09dd018cb0d0180595d925c\",\n \"timestamp\": \"\",\n \"source\": \"github\",\n \"line_count\": 344,\n \"max_line_length\": 353,\n \"avg_line_length\": 36.901162790697676,\n \"alnum_prop\": 0.7271151725224515,\n \"repo_name\": \"claudiopro/flow\",\n \"id\": \"8b7e81b4f830bb676b0fe3bc7454b2a9b8914c33\",\n \"size\": \"12698\",\n \"binary\": false,\n \"copies\": \"2\",\n \"ref\": \"refs/heads/master\",\n \"path\": \"website/en/docs/react/types.md\",\n \"mode\": \"33188\",\n \"license\": \"mit\",\n \"language\": [\n {\n \"name\": \"C\",\n \"bytes\": \"117458\"\n },\n {\n \"name\": \"CSS\",\n \"bytes\": \"47820\"\n },\n {\n \"name\": \"HTML\",\n \"bytes\": \"36429\"\n },\n {\n \"name\": \"JavaScript\",\n \"bytes\": \"2074042\"\n },\n {\n \"name\": \"Liquid\",\n \"bytes\": \"13216\"\n },\n {\n \"name\": \"Makefile\",\n \"bytes\": \"18100\"\n },\n {\n \"name\": \"OCaml\",\n \"bytes\": \"3544394\"\n },\n {\n \"name\": \"PowerShell\",\n \"bytes\": \"1031\"\n },\n {\n \"name\": \"Ruby\",\n \"bytes\": \"24723\"\n },\n {\n \"name\": \"Shell\",\n \"bytes\": \"72437\"\n },\n {\n \"name\": \"Standard ML\",\n \"bytes\": \"7257\"\n }\n ],\n \"symlink_target\": \"\"\n}"}}},{"rowIdx":340,"cells":{"text":{"kind":"string","value":"\n\npackage org.apache.flink.graph.asm.degree.filter.undirected;\n\nimport org.apache.flink.graph.Graph;\nimport org.apache.flink.graph.asm.AsmTestBase;\nimport org.apache.flink.graph.asm.dataset.ChecksumHashCode.Checksum;\nimport org.apache.flink.graph.library.metric.ChecksumHashCode;\nimport org.apache.flink.test.util.TestBaseUtils;\nimport org.apache.flink.types.IntValue;\nimport org.apache.flink.types.NullValue;\n\nimport org.junit.Test;\n\nimport static org.junit.Assert.assertEquals;\n\n/**\n * Tests for {@link MaximumDegree}.\n */\npublic class MaximumDegreeTest\nextends AsmTestBase {\n\n\t@Test\n\tpublic void testWithSimpleGraph()\n\t\t\tthrows Exception {\n\t\tGraph graph = undirectedSimpleGraph\n\t\t\t.run(new MaximumDegree<>(3));\n\n\t\tString expectedVerticesResult =\n\t\t\t\"(0,(null))\\n\" +\n\t\t\t\"(1,(null))\\n\" +\n\t\t\t\"(2,(null))\\n\" +\n\t\t\t\"(4,(null))\\n\" +\n\t\t\t\"(5,(null))\";\n\n\t\tTestBaseUtils.compareResultAsText(graph.getVertices().collect(), expectedVerticesResult);\n\n\t\tString expectedEdgesResult =\n\t\t\t\"(0,1,(null))\\n\" +\n\t\t\t\"(0,2,(null))\\n\" +\n\t\t\t\"(1,0,(null))\\n\" +\n\t\t\t\"(1,2,(null))\\n\" +\n\t\t\t\"(2,0,(null))\\n\" +\n\t\t\t\"(2,1,(null))\";\n\n\t\tTestBaseUtils.compareResultAsText(graph.getEdges().collect(), expectedEdgesResult);\n\t}\n\n\t@Test\n\tpublic void testWithRMatGraph()\n\t\t\tthrows Exception {\n\t\tChecksum checksum = undirectedRMatGraph(10, 16)\n\t\t\t.run(new MaximumDegree<>(16))\n\t\t\t.run(new ChecksumHashCode<>())\n\t\t\t.execute();\n\n\t\tassertEquals(805, checksum.getCount());\n\t\tassertEquals(0x0000000008028b43L, checksum.getChecksum());\n\t}\n}\n"},"meta":{"kind":"string","value":"{\n \"content_hash\": \"e425fa81f62cdca2e3a3a515f25b3e4b\",\n \"timestamp\": \"\",\n \"source\": \"github\",\n \"line_count\": 60,\n \"max_line_length\": 91,\n \"avg_line_length\": 25.433333333333334,\n \"alnum_prop\": 0.7077326343381389,\n \"repo_name\": \"zohar-mizrahi/flink\",\n \"id\": \"51e7712f5893a69cd25e25c847f63d898600102f\",\n \"size\": \"2331\",\n \"binary\": false,\n \"copies\": \"1\",\n \"ref\": \"refs/heads/master\",\n \"path\": \"flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/asm/degree/filter/undirected/MaximumDegreeTest.java\",\n \"mode\": \"33188\",\n \"license\": \"apache-2.0\",\n \"language\": [\n {\n \"name\": \"Batchfile\",\n \"bytes\": \"4792\"\n },\n {\n \"name\": \"CSS\",\n \"bytes\": \"18100\"\n },\n {\n \"name\": \"CoffeeScript\",\n \"bytes\": \"89007\"\n },\n {\n \"name\": \"HTML\",\n \"bytes\": \"86524\"\n },\n {\n \"name\": \"Java\",\n \"bytes\": \"31605216\"\n },\n {\n \"name\": \"JavaScript\",\n \"bytes\": \"8267\"\n },\n {\n \"name\": \"Python\",\n \"bytes\": \"240673\"\n },\n {\n \"name\": \"Scala\",\n \"bytes\": \"5925253\"\n },\n {\n \"name\": \"Shell\",\n \"bytes\": \"93241\"\n }\n ],\n \"symlink_target\": \"\"\n}"}}},{"rowIdx":341,"cells":{"text":{"kind":"string","value":"\n\npackage org.waveprotocol.wave.client.common.util;\n\nimport com.google.gwt.core.client.GWT;\n\n\n/**\n * Collection of constants defining various browser quirky behaviours.\n *\n * Each constant should be accompanied by a detailed comment, and a \"Tested:\"\n * section detailing which browsers and operating systems the quirk has been\n * tested on, so that it's easy to know what's untested as new browser versions\n * come out, etc.\n *\n * Sometimes an \"Untested exceptions:\" field is appropriate, to note exceptions\n * to the \"Tested:\" field, in particular if they are concerning and represent a\n * reasonable doubt as to the correctness of the field's value.\n *\n * It is preferable to use the constants in this class than to have logic that\n * switches on explicit browser checks.\n *\n * @author danilatos@google.com (Daniel Danilatos)\n */\npublic final class QuirksConstants {\n\n /**\n * Whether we get DOM Mutation events\n *\n * Tested:\n * Safari 3-4, Firefox 3-3.5, Chrome 1-2, IE7, IE8\n *\n * Will IE9 give us mutation events? probably not.\n */\n public static final boolean PROVIDES_MUTATION_EVENTS =\n UserAgent.isFirefox() || UserAgent.isWebkit();\n\n /**\n * Whether the browser left normalises the caret in most cases (There are\n * exceptions, usually to do with links).\n *\n * Tested:\n * Safari 3*, Safari 4 beta, Firefox 3.0, IE7, IE8\n */\n public static final boolean USUALLY_LEFT_NORMALISES =\n UserAgent.isWebkit() || UserAgent.isWebkit();\n\n /**\n * Certain versions of webkit have a specific hack implemented in them, where\n * they go against the regular left-normalised behaviour at the end of an\n * anchor boundary, if it has an href. They still report the cursor as being\n * left-normalised, but if the user types, text goes to the right, outside the\n * link.\n *\n * Tested:\n * All OS: Safari 3.2.1, Safari 4 beta, Chrome 1.0, Chrome 2.0 special sauce\n */\n public static final boolean LIES_ABOUT_CARET_AT_LINK_END_BOUNDARY =\n UserAgent.isWebkit() && UserAgent.isAtLeastVersion(528, 0);\n\n /**\n * Similar to {@link #LIES_ABOUT_CARET_AT_LINK_END_BOUNDARY}, but does not\n * actually lie, just doesn't like reporting carets as being inside link\n * boundaries, and typing occurs outside as well.\n *\n * Tested: IE8 beta\n *\n * TODO(danilatos): check IE7\n */\n public static final boolean DOES_NOT_LEFT_NORMALISE_AT_LINK_END_BOUNDARY =\n UserAgent.isIE();\n\n /**\n * If the user is typing, we always get a key event before the browser changes\n * the dom.\n *\n * Tested:\n * All OS: Safari 3.2.1, 4 beta, Chrome 1, 2, Firefox 3, IE7, IE8\n *\n * Untested exceptions: Any IME on Linux!\n */\n public static final boolean ALWAYS_GIVES_KEY_EVENT_BEFORE_CHANGING_DOM =\n UserAgent.isFirefox() || UserAgent.isIE7();\n\n /**\n * Whether we get the magic 229 keycode for IME key events, at least for the\n * first one (sometimes we don't get key events for subsequent mutations).\n *\n * Tested:\n * All OS: Safari 3.2.1, 4 beta, Chrome 1, 2, Firefox 3.0\n *\n * Untested exceptions: Any IME on Linux!\n */\n public static final boolean CAN_TELL_WHEN_FIRST_KEY_EVENT_IS_IME =\n UserAgent.isIE() || UserAgent.isWebkit() || UserAgent.isWin();\n\n /**\n * Whether the old school Ctrl+Insert, Shift+Delete, Shift+Insert shortcuts\n * for Copy, Cut, Paste work.\n *\n * Tested: All OS: Firefox 3, IE 7/8, Safari 3, Chrome 2\n *\n * Untested exceptions: Safari on Windows\n */\n public static final boolean HAS_OLD_SCHOOL_CLIPBOARD_SHORTCUTS =\n UserAgent.isWin() || UserAgent.isLinux();\n\n // NOTE(danilatos): These selection constants, unless mentioned otherwise,\n // refer to selection boundaries (e.g. the start, or end, of a ranged\n // selection, or a collapsed selection).\n\n /**\n * Whether the selection is either cleared or correctly transformed by the\n * browser in at least the following scenarios:\n * - textNode.insertData adds to the cursor location, if it is after the\n * deletion point\n * - textNode.deleteData subtracts from the cursor location, if it is after\n * the deletion point\n *\n * Tested: Safari 3.2.1, FF 3.0, 3.5, Chrome 1, IE7, IE8\n */\n public static final boolean OK_SELECTION_ACROSS_TEXT_NODE_DATA_CHANGES =\n UserAgent.isFirefox() || UserAgent.isIE();\n\n /**\n * Whether the selection is either cleared or correctly transformed by the\n * browser when text nodes are deleted.\n *\n * Gecko/IE preserve, Webkit clears selection. Both OK behaviours.\n *\n * Tested: Safari 3.2.1, FF 3.0, 3.5, Chrome 1, IE7, IE8\n */\n public static final boolean OK_SELECTION_ACROSS_NODE_REMOVALS = true;\n\n /**\n * Whether the browser moves the selection into the neighbouring text node\n * after a text node split before the selection point, or at least clears the\n * selection.\n *\n * Tested: Safari 3.2.1, FF 3.0, 3.5, Chrome 1, IE7, IE8\n */\n public static final boolean OK_SELECTION_ACROSS_TEXT_NODE_SPLITS =\n UserAgent.isIE();\n\n /**\n * In this case, only clearing occurs by Webkit. Other two browsers move the\n * selection to the point where the moved node was. Which is BAD for wrapping!\n *\n * Tested: Safari 3.2.1, FF 3.0, 3.5, Chrome 1, IE7, IE8\n *\n * @see #PRESERVES_SEMANTIC_SELECTION_ACROSS_MUTATIONS_OR_CLEARS_IT\n */\n public static final boolean OK_SELECTION_ACROSS_MOVES =\n UserAgent.isWebkit();\n\n /**\n * Preserves changes to text nodes made by calling methods on the text nodes\n * directly (i.e. not moving or deleting the text nodes).\n */\n public static final boolean PRESERVES_SEMANTIC_SELECTION_ACROSS_INTRINSIC_TEXT_NODE_CHANGES =\n OK_SELECTION_ACROSS_TEXT_NODE_DATA_CHANGES &&\n OK_SELECTION_ACROSS_TEXT_NODE_SPLITS;\n\n /**\n * Whether the selection preservation is completely reliable across mutations\n * in terms of correctness. It might get cleared in some circumstances, but\n * that's OK, we can just check if the selection is gone and restore it. We\n * don't need to transform it for correctness.\n *\n * The biggest problem here is wrap. Currently implemented with insertBefore,\n * it breaks selections in all browsers, even IE, AND IE doesn't clear the\n * selection, just moves it. Damn! Anyway, there might be a smarter way to\n * implement wrap - perhaps using an exec command to apply a styling to a\n * region and using the resulting wrapper nodes... but that's a long way off.\n *\n * Tested: Safari 3.2.1, FF 3.0, 3.5, Chrome 1, IE7, IE8\n */\n public static final boolean PRESERVES_SEMANTIC_SELECTION_ACROSS_MUTATIONS_OR_CLEARS_IT =\n OK_SELECTION_ACROSS_TEXT_NODE_DATA_CHANGES &&\n OK_SELECTION_ACROSS_TEXT_NODE_SPLITS &&\n OK_SELECTION_ACROSS_MOVES;\n\n /**\n * Whether changing stuff in the middle of a ranged selection (that doesn't\n * affect the selection end points in any way), such as splitting some\n * entirely contained text node, affects the ranged selection. With firefox,\n * it appears that the selection is still \"correct\", but visually new text\n * nodes inserted don't get highlighted as selected, which is bad.\n *\n * Tested: Safari 3.2.1, FF 3.0, IE8\n */\n public static final boolean RANGED_SELECTION_AFFECTED_BY_INTERNAL_CHANGED =\n UserAgent.isFirefox();\n\n /**\n * True if IME input in not totally munged by adjacent text node mutations\n *\n * Tested:\n * Safari 3.2.1, FF 3.0, 3.5, Chrome 1, IE7, IE8\n */\n public static final boolean PRESERVES_IME_STATE_ACROSS_ADJACENT_CHANGES =\n UserAgent.isIE();\n\n /**\n * True if we can do the __proto__ override trick to remove defaults method\n * in a JSO.\n * WARNING(dnailatos/reuben) Should be kept as static constant for\n * speed reasons in string map implementation.\n *\n * Tested: Safari 4, FF 3.0, 3.5, Chrome 3-4, IE8\n */\n public static final boolean DOES_NOT_SUPPORT_JSO_PROTO_FIELD = UserAgent.isIE();\n\n /**\n * It appears that in some browsers, if you stopPropagation() an IME\n * composition or contextmenu event, the default action for the event is not\n * executed (as if you had cancelled it)\n *\n * TODO(danilatos): File a bug\n *\n * Tested:\n * FF 3.0\n *\n * Untested:\n * Everything else (at time of writing, nothing else has composition\n * events...)\n */\n public static final boolean CANCEL_BUBBLING_CANCELS_IME_COMPOSITION_AND_CONTEXTMENU =\n UserAgent.isFirefox();\n\n /**\n * True if mouse events have rangeParent and rangeOffset fields.\n *\n * Tested:\n * FF 3.0, 3.6\n * Safari 4\n * Chrome 5\n */\n public static final boolean SUPPORTS_EVENT_GET_RANGE_METHODS =\n UserAgent.isFirefox();\n\n /**\n * True if preventDefault stops a native context menu from being shown. In\n * firefox this is not the case when dom.event.contextmenu.enabled is set.\n *\n * Tested:\n * FF 3.0, 3.6\n */\n public static final boolean PREVENT_DEFAULT_STOPS_CONTEXTMENT =\n !UserAgent.isFirefox();\n\n /**\n * True if displaying a context menu updates the current selection. Safari selects\n * the word clicked unless you click on the current selection, Firefox does not\n * change the selection and Chrome and IE clears the selection unless you click\n * on the current selection.\n *\n * The selection that is active on mousedown will, in all browsers, be the\n * original selection and the selection on the contextmenu event will be the new\n * one.\n *\n * Tested:\n * FF 3.0, 3.5\n * Chrome 5\n * Safari 4\n * IE 8\n */\n public static final boolean CONTEXTMENU_SETS_SELECTION =\n !UserAgent.isFirefox();\n\n /**\n * True if the browser has the setBaseAndExtent JS method to allow better setting of\n * the selection within the browser.\n *\n * So far, only webkit browsers have this in their API, and documentation is scarce. See:\n * http://developer.apple.com/DOCUMENTATION/AppleApplications/Reference/WebKitDOMRef\n * /DOMSelection_idl/Classes/DOMSelection/index.html#//apple_ref/idl/instm\n * /DOMSelection/setBaseAndExtent/void/(inNode,inlong,inNode,inlong)\n */\n public static final boolean HAS_BASE_AND_EXTENT =\n UserAgent.isWebkit();\n\n /**\n * Chrome on Mac generates doesn't keypress for command combos, only keydown.\n *\n * In general, it makes sense to only fire the keypress event if the combo\n * generates content. https://bugs.webkit.org/show_bug.cgi?id=30397\n *\n * However since it is the odd one out here, it is listed as a\n * quirk.\n */\n public static final boolean COMMAND_COMBO_DOESNT_GIVE_KEYPRESS =\n UserAgent.isMac() && UserAgent.isChrome();\n\n /**\n * True if the browser has native support for getElementsByClassName.\n *\n * Tested:\n * Chrome, Safari 3.1, Firefox 3.0\n */\n public static final boolean SUPPORTS_GET_ELEMENTS_BY_CLASSNAME =\n GWT.isScript() && checkGetElementsByClassNameSupport();\n\n /**\n * True if the browser supports composition events.\n *\n * (This does not differentiate between the per-browser composition event quirks,\n * such as whether they provide a text vs a compositionupdate event, or other\n * glitches).\n *\n * Tested:\n * Chrome 3.0, 4.0; Safari 4; FF 3.0, 3.5; IE 7,8\n */\n public static final boolean SUPPORTS_COMPOSITION_EVENTS =\n UserAgent.isFirefox() || (UserAgent.isWebkit()\n && UserAgent.isAtLeastVersion(532, 5));\n\n /**\n * True if the browser does an extra modification of the DOM after the\n * compositionend event, and also fires a text input event if the composition\n * was not cancelled.\n *\n * Tested: Chrome 4.0; FF 3.0, 3.5;\n */\n public static final boolean MODIFIES_DOM_AND_FIRES_TEXTINPUT_AFTER_COMPOSITION =\n UserAgent.isWebkit(); // Put an upper bound on the version here when it's fixed...\n\n\n /**\n * True if the browser keeps the selection in an empty span after the\n * app has programmatically set it there.\n *\n * Tested:\n * Chrome 3.0, 4.0; Safari 3, 4; FF 3.0, 3.5; IE 7,8\n */\n public static final boolean SUPPORTS_CARET_IN_EMPTY_SPAN =\n UserAgent.isFirefox();\n\n /**\n * True if the browser automatically scrolls a contentEditable element\n * into view when we set focus on the element\n *\n * Tested:\n * Chrome 5.0.307.11 beta / linux, Safari 4.0.4 / mac, Firefox 3.0.7 + 3.6 / linux\n */\n public static final boolean ADJUSTS_SCROLL_TOP_WHEN_FOCUSING =\n UserAgent.isWebkit();\n\n /**\n * True if the browser does not emit a paste event for plaintext paste.\n * This was a bug on Webkit and has been fixed and pushed to Chrome 4+\n *\n * Tested:\n * Chrome 4.0.302.3; Safari 4.05 Mac\n */\n public static final boolean PLAINTEXT_PASTE_DOES_NOT_EMIT_PASTE_EVENT =\n UserAgent.isSafari();\n \n /**\n * True if the browser supports input type 'search'.\n *\n * Tested:\n * Chrome 9.0, Chrome 4.0\n */\n public static final boolean SUPPORTS_SEARCH_INPUT =\n UserAgent.isWebkit();\n\n /**\n * True if the browser sanitizes pasted content to contenteditable to\n * prevent script execution.\n *\n * Tested:\n * Chrome 9.0, Safari 5, FF 3.5, FF 4.0\n */\n public static final boolean SANITIZES_PASTED_CONTENT =\n (UserAgent.isWebkit() && UserAgent.isAtLeastVersion(533, 16)) ||\n (UserAgent.isFirefox() && UserAgent.isAtLeastVersion(4, 0));\n\n private static native boolean checkGetElementsByClassNameSupport() /*-{\n return !!document.body.getElementsByClassName;\n }-*/;\n\n private QuirksConstants(){}\n}\n"},"meta":{"kind":"string","value":"{\n \"content_hash\": \"fa423acbcc89249022d3b60bc13e642d\",\n \"timestamp\": \"\",\n \"source\": \"github\",\n \"line_count\": 384,\n \"max_line_length\": 95,\n \"avg_line_length\": 34.802083333333336,\n \"alnum_prop\": 0.6865459443280455,\n \"repo_name\": \"somehume/wavefu\",\n \"id\": \"378e93dd7a84e003936436baac38f0a7c5d86609\",\n \"size\": \"13963\",\n \"binary\": false,\n \"copies\": \"5\",\n \"ref\": \"refs/heads/trunk\",\n \"path\": \"src/org/waveprotocol/wave/client/common/util/QuirksConstants.java\",\n \"mode\": \"33188\",\n \"license\": \"apache-2.0\",\n \"language\": [\n {\n \"name\": \"Java\",\n \"bytes\": \"12952668\"\n },\n {\n \"name\": \"JavaScript\",\n \"bytes\": \"2691\"\n },\n {\n \"name\": \"Python\",\n \"bytes\": \"356911\"\n },\n {\n \"name\": \"Shell\",\n \"bytes\": \"7099\"\n },\n {\n \"name\": \"Smalltalk\",\n \"bytes\": \"44615\"\n }\n ],\n \"symlink_target\": \"\"\n}"}}},{"rowIdx":342,"cells":{"text":{"kind":"string","value":"import {IStructure} from \"./_structure\";\nimport {StructureNode, StatementNode} from \"../../nodes\";\nimport {INode} from \"../../nodes/_inode\";\nimport {IStatement, MacroCall, NativeSQL} from \"../../2_statements/statements/_statement\";\nimport {IStructureRunnable} from \"./_structure_runnable\";\nimport {IMatch} from \"./_match\";\n\nclass Sequence implements IStructureRunnable {\n private readonly list: IStructureRunnable[];\n\n public constructor(list: IStructureRunnable[]) {\n if (list.length < 2) {\n throw new Error(\"Sequence, length error\");\n }\n this.list = list;\n }\n\n public toRailroad() {\n const children = this.list.map((e) => { return e.toRailroad(); });\n return \"Railroad.Sequence(\" + children.join() + \")\";\n }\n\n public getUsing(): string[] {\n return this.list.reduce((a, c) => { return a.concat(c.getUsing()); }, [] as string[]);\n }\n\n public first() {\n return this.list[0].first();\n }\n\n public run(statements: StatementNode[], parent: INode): IMatch {\n let inn = statements;\n const out: StatementNode[] = [];\n for (const i of this.list) {\n const match = i.run(inn, parent);\n if (match.error) {\n return {\n matched: [],\n unmatched: statements,\n error: true,\n errorDescription: match.errorDescription,\n errorMatched: out.length,\n };\n }\n out.push(...match.matched);\n inn = match.unmatched;\n }\n return {\n matched: out,\n unmatched: inn,\n error: false,\n errorDescription: \"\",\n errorMatched: 0,\n };\n }\n}\n\n// Note that the Alternative does not nessesarily return the first in the alternative\n// as a map is used for better performance\nclass Alternative implements IStructureRunnable {\n private readonly list: IStructureRunnable[];\n private map: {[index: string]: IStructureRunnable[]};\n\n public constructor(list: IStructureRunnable[]) {\n if (list.length < 2) {\n throw new Error(\"Alternative, length error\");\n }\n this.list = list;\n }\n\n private setupMap() {\n // dont call from constructor, it will cause infinite loop\n if (this.map === undefined) {\n this.map = {};\n for (const i of this.list) {\n for (const first of i.first()) {\n if (this.map[first]) {\n this.map[first].push(i);\n } else {\n this.map[first] = [i];\n }\n }\n }\n }\n }\n\n public first() {\n return [\"\"];\n }\n\n public toRailroad() {\n const children = this.list.map((e) => { return e.toRailroad(); });\n return \"Railroad.Choice(0, \" + children.join() + \")\";\n }\n\n public getUsing() {\n return this.list.reduce((a, c) => { return a.concat(c.getUsing()); }, [] as string[]);\n }\n\n public run(statements: StatementNode[], parent: INode): IMatch {\n this.setupMap();\n let count = 0;\n let countError = \"\";\n\n if (statements.length === 0) {\n return {\n matched: [],\n unmatched: statements,\n error: true,\n errorDescription: countError,\n errorMatched: count,\n };\n }\n\n const token = statements[0].getFirstToken().getStr().toUpperCase();\n for (const i of this.map[token] || []) {\n const match = i.run(statements, parent);\n if (match.error === false) {\n return match;\n }\n if (match.errorMatched > count) {\n countError = match.errorDescription;\n count = match.errorMatched;\n }\n }\n\n for (const i of this.map[\"\"] || []) {\n const match = i.run(statements, parent);\n if (match.error === false) {\n return match;\n }\n if (match.errorMatched > count) {\n countError = match.errorDescription;\n count = match.errorMatched;\n }\n }\n\n if (count === 0) {\n return {\n matched: [],\n unmatched: statements,\n error: true,\n errorDescription: \"Unexpected code structure\",\n errorMatched: count,\n };\n } else {\n return {\n matched: [],\n unmatched: statements,\n error: true,\n errorDescription: countError,\n errorMatched: count,\n };\n }\n }\n}\n\nclass Optional implements IStructureRunnable {\n private readonly obj: IStructureRunnable;\n\n public constructor(obj: IStructureRunnable) {\n this.obj = obj;\n }\n\n public toRailroad() {\n return \"Railroad.Optional(\" + this.obj.toRailroad() + \")\";\n }\n\n public getUsing() {\n return this.obj.getUsing();\n }\n\n public run(statements: StatementNode[], parent: INode): IMatch {\n const ret = this.obj.run(statements, parent);\n ret.error = false;\n return ret;\n }\n\n public first() {\n return [\"\"];\n }\n}\n\nclass Star implements IStructureRunnable {\n private readonly obj: IStructureRunnable;\n\n public constructor(obj: IStructureRunnable) {\n this.obj = obj;\n }\n\n public toRailroad() {\n return \"Railroad.ZeroOrMore(\" + this.obj.toRailroad() + \")\";\n }\n\n public getUsing() {\n return this.obj.getUsing();\n }\n\n public run(statements: StatementNode[], parent: INode): IMatch {\n let inn = statements;\n const out: StatementNode[] = [];\n while (true) {\n if (inn.length === 0) {\n return {\n matched: out,\n unmatched: inn,\n error: false,\n errorDescription: \"\",\n errorMatched: 0,\n };\n }\n\n const match = this.obj.run(inn, parent);\n\n if (match.error === true) {\n if (match.errorMatched > 0) {\n return {\n matched: out,\n unmatched: inn,\n error: true,\n errorDescription: match.errorDescription,\n errorMatched: match.errorMatched,\n };\n } else {\n return {\n matched: out,\n unmatched: inn,\n error: false,\n errorDescription: \"\",\n errorMatched: 0,\n };\n }\n }\n out.push(...match.matched);\n inn = match.unmatched;\n }\n }\n\n public first() {\n return [\"\"];\n }\n}\n\nclass SubStructure implements IStructureRunnable {\n private readonly s: IStructure;\n private matcher: IStructureRunnable;\n\n public constructor(s: IStructure) {\n this.s = s;\n }\n\n public toRailroad() {\n return \"Railroad.NonTerminal('\" + this.s.constructor.name + \"', {href: '#/structure/\" + this.s.constructor.name + \"'})\";\n }\n\n public getUsing() {\n return [\"structure/\" + this.s.constructor.name];\n }\n\n public first() {\n this.setupMatcher();\n return this.matcher.first();\n }\n\n private setupMatcher() {\n if (this.matcher === undefined) {\n // SubStructures are singletons, so the getMatcher can be saved, its expensive to create\n // dont move this to the constructor, as it might trigger infinite recursion\n this.matcher = this.s.getMatcher();\n }\n }\n\n public run(statements: StatementNode[], parent: INode): IMatch {\n const nparent = new StructureNode(this.s);\n this.setupMatcher();\n const ret = this.matcher.run(statements, nparent);\n if (ret.matched.length === 0) {\n ret.error = true;\n } else {\n parent.addChild(nparent);\n }\n return ret;\n }\n}\n\nclass SubStatement implements IStructureRunnable {\n private readonly obj: new () => IStatement;\n\n public constructor(obj: new () => IStatement) {\n this.obj = obj;\n }\n\n public first() {\n const o = new this.obj();\n if (o instanceof MacroCall || o instanceof NativeSQL) {\n return [\"\"];\n }\n return o.getMatcher().first();\n }\n\n public toRailroad() {\n return \"Railroad.Terminal('\" + this.className() + \"', {href: '#/statement/\" + this.className() + \"'})\";\n }\n\n public getUsing() {\n return [\"statement/\" + this.className()];\n }\n\n private className() {\n return this.obj.name;\n }\n\n public run(statements: StatementNode[], parent: INode): IMatch {\n if (statements.length === 0) {\n return {\n matched: [],\n unmatched: [],\n error: true,\n errorDescription: \"Expected \" + this.className().toUpperCase(),\n errorMatched: 0,\n };\n } else if (statements[0].get() instanceof this.obj) {\n parent.addChild(statements[0]);\n return {\n matched: [statements[0]],\n unmatched: statements.splice(1),\n error: false,\n errorDescription: \"\",\n errorMatched: 0,\n };\n } else {\n return {\n matched: [],\n unmatched: statements,\n error: true,\n errorDescription: \"Expected \" + this.className().toUpperCase(),\n errorMatched: 0,\n };\n }\n }\n}\n\nexport function seq(first: IStructureRunnable, ...rest: IStructureRunnable[]): IStructureRunnable {\n return new Sequence([first].concat(rest));\n}\n\nexport function alt(first: IStructureRunnable, ...rest: IStructureRunnable[]): IStructureRunnable {\n return new Alternative([first].concat(rest));\n}\n\nexport function beginEnd(begin: IStructureRunnable, body: IStructureRunnable, end: IStructureRunnable): IStructureRunnable {\n return new Sequence([begin, body, end]);\n}\n\nexport function opt(o: IStructureRunnable): IStructureRunnable {\n return new Optional(o);\n}\n\nexport function star(s: IStructureRunnable): IStructureRunnable {\n return new Star(s);\n}\n\nexport function sta(s: new () => IStatement): IStructureRunnable {\n return new SubStatement(s);\n}\n\nconst singletons: {[index: string]: SubStructure} = {};\nexport function sub(s: new () => IStructure): IStructureRunnable {\n if (singletons[s.name] === undefined) {\n singletons[s.name] = new SubStructure(new s());\n }\n return singletons[s.name];\n}"},"meta":{"kind":"string","value":"{\n \"content_hash\": \"18a079d86682e0cfd7c6afaf37e74223\",\n \"timestamp\": \"\",\n \"source\": \"github\",\n \"line_count\": 373,\n \"max_line_length\": 124,\n \"avg_line_length\": 25.353887399463808,\n \"alnum_prop\": 0.5945860209368722,\n \"repo_name\": \"larshp/abapOpenChecksJS\",\n \"id\": \"85cc92a8a9ecf8f54d32dc9eafc877a7111200d3\",\n \"size\": \"9457\",\n \"binary\": false,\n \"copies\": \"2\",\n \"ref\": \"refs/heads/hvam/upd0910\",\n \"path\": \"packages/core/src/abap/3_structures/structures/_combi.ts\",\n \"mode\": \"33188\",\n \"license\": \"mit\",\n \"language\": [\n {\n \"name\": \"ABAP\",\n \"bytes\": \"7026\"\n },\n {\n \"name\": \"CSS\",\n \"bytes\": \"51\"\n },\n {\n \"name\": \"HTML\",\n \"bytes\": \"1211\"\n },\n {\n \"name\": \"JavaScript\",\n \"bytes\": \"1049\"\n },\n {\n \"name\": \"TypeScript\",\n \"bytes\": \"122500\"\n }\n ],\n \"symlink_target\": \"\"\n}"}}},{"rowIdx":343,"cells":{"text":{"kind":"string","value":"\n\n\n \n \n \n The <javaClientGenerator> Element\n \n \n \n \n \n \n \n\n \n \n \n \n \n \n \n \n \n
\n
\n
\n \"MyBatis\n \n
\n
\n

\n
\n \n
\n
    \n \n \n
  • Last Published: 16 July 2012
  • \n
  • |
  • Version: 1.3.2
  • \n \n \n \n \n
\n
\n\n \n \n
\n
\n \n \r\n\r\n\r\n

The &lt;javaClientGenerator&gt; Element

\r\n

The &lt;javaClientGenerator&gt; element is used to define properties of the Java\r\nclient generator. The Java client Generator builds Java interfaces and classes that allow\r\neasy use of the generated Java model and XML map files. For iBATIS2 target environments, these\r\ngenerated objects take the form of DAO interface and implementation classes. For MyBatis, the\r\ngenerated objects take the form of mapper interfaces.\r\nThis element is a optional child element\r\nof the &lt;context&gt; element. If you do not\r\nspecify this element, then MyBatis Generator (MBG) will not generate Java client interfaces and classes.

\r\n

Required Attributes

\r\n\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n
AttributeDescription
typeThis attribute is used to select one of the predefined Java Client generators, or\r\n to specify a user provided Java Client generator.\r\n Any user provided DAO generator must extend the class\r\n org.mybatis.generator.codegen.AbstractJavaClientGenerator\r\n class, and must have a public default constructor.\r\n

The attribute accepts the following values for selecting one of the\r\n predefined generators:

\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n
If the &lt;context&gt; targetRuntime is MyBatis3:
ANNOTATEDMAPPERThe generated objects will be Java interfaces for the MyBatis 3.x mapper\r\n infrastructure. The interfaces will be based on annotations and MyBatis 3.x SqlProviders.\r\n No XML mapper files will be generated.\r\n

The ANNOTATEDMAPPER requires MyBatis version 3.0.4 or higher.

\r\n
MIXEDMAPPERThe generated objects will be Java interfaces for the MyBatis 3.x mapper\r\n infrastructure. The interfaces will be based on a mix of annotations and XML.\r\n An annotation will be used where a simple annotation will work. This client\r\n will not generate and Sql Provider, so all complex dynamic SQL will be generated\r\n in XML.\r\n

The MIXEDMAPPER requires MyBatis version 3.0.4 or higher.

\r\n
XMLMAPPERThe generated objects will be Java interfaces for the MyBatis 3.x mapper\r\n infrastructure. The interfaces will be dependent on generated XML mapper files.
If the &lt;context&gt; targetRuntime is MyBatis3Simple:
ANNOTATEDMAPPERThe generated objects will be Java interfaces for the MyBatis 3.x mapper\r\n infrastructure. The interfaces will be based on annotations and MyBatis 3.x SqlProviders.\r\n No XML mapper files will be generated.\r\n

The ANNOTATEDMAPPER requires MyBatis version 3.0.4 or higher.

\r\n
XMLMAPPERThe generated objects will be Java interfaces for the MyBatis 3.x mapper\r\n infrastructure. The interfaces will be dependent on generated XML mapper files.
If the &lt;context&gt; targetRuntime is Ibatis2Java2\r\n or Ibatis2Java5:
IBATISThe generated objects will conform to the (deprecated) iBATIS DAO framework.
GENERIC-CIThe generated objects will rely only on the SqlMapClient. The SqlMapClient\r\n will be supplied by constructor dependency injection.\r\n The generated objects will be in the form of DAO interfaces amd implementation classes.\r\n
GENERIC-SIThe generated objects will rely only on the SqlMapClient. The SqlMapClient\r\n will be supplied by setter dependency injection.\r\n The generated objects will be in the form of DAO interfaces amd implementation classes.\r\n
SPRINGThe generated objects will conform to the Spring DAO framework.
\r\n
targetPackageThis is the package where the generated interfaces and implementation classes\r\n will be placed. In\r\n the default generators, the property &quot;enableSubPackages&quot;\r\n controls how the actual package is calculated. If true,\r\n then the calculated package will be the targetPackage plus\r\n sub packages for the table's catalog and schema if they exist.\r\n If &quot;enableSubPackages&quot; is false (the default) then the calculated package will be\r\n exactly what is specified in the targetPackage attribute.\r\n MBG will create folders as required for the generated\r\n packages.\r\n

Note: the package for implementation classes may\r\n be overridden by specifying the optional implementationPackage\r\n attribute as shown below.

targetProjectThis is used to specify a target project for the\r\n generated interfaces and classes. When running in the Eclipse\r\n environment, this specifies the project and source folder where\r\n the objects will be saved.\r\n In other environments, this value should be an existing directory\r\n on the local file system. MBG will not create this directory if\r\n it does not exist.
\r\n\r\n

Optional Attributes

\r\n\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n
AttributeDescription
implementationPackageIf specified, implementation classes will be placed in this package.\r\n In the default generators, the property &quot;enableSubPackages&quot;\r\n controls how the actual package is calculated. If true,\r\n then the calculated package will be the implementationPackage plus\r\n sub packages for the table's catalog and schema if they exist.\r\n If &quot;enableSubPackages&quot; is false (the default) then the calculated package will be\r\n exactly what is specified in the implementationPackage attribute.\r\n MBG will create folders as required for the generated\r\n packages.
\r\n\r\n

Child Elements

\r\n\r\n\r\n

Supported Properties

\r\n

This table lists the properties of the default SQL Map generators that can be\r\nspecified with the &lt;property&gt; child element:

\r\n\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n
Property NameProperty Values
enableSubPackagesThis property is used to select whether MBG will generate different\r\n Java packages for the objects based on the catalog and schema of the\r\n introspected table.\r\n

For example, suppose a table MYTABLE in schema MYSCHMA.\r\n Also suppose that the targetPackage attribute is set to &quot;com.mycompany&quot;.\r\n If this property is true, the generated DAO interface and class for the table\r\n will be placed in\r\n the package &quot;com.mycompany.myschema&quot;. If the property is false, the generated\r\n SQL Map will be placed in the &quot;com.mycompany&quot; schema.

\r\n

The default value is false.

exampleMethodVisibilityThis property is used to set the visibility of the different &quot;ByExample&quot;\r\n methods - selectByExample, deleteByExample, etc. If not specified, the\r\n methods will be public and will be declared in the interface.\r\n This property allows you to hide these methods if you only want to use them\r\n to implement other specialized methods.\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n
publicThis is the default value
\r\n The generated methods in the implementation class will be public,\r\n and the methods will be declared in the interface.
privateThe generated methods in the implementation class will be private,\r\n and the methods will not be declared in the interface\r\n
protectedThe generated methods in the implementation class will be protected,\r\n and the methods will not be declared in the interface\r\n
defaultThe generated methods in the implementation class will have default\r\n (package) visibility,\r\n and the methods will not be declared in the interface\r\n
\r\n

Important note: this property is ignored if the target runtime is\r\n MyBatis3.

\r\n
methodNameCalculatorThis property is used to select a method name calculator. A method name\r\n calculator can be used to provide different names for the DAO methods.\r\n You can select one of the predefined values, or you can specify the\r\n fully qualified name of a class that implements the\r\n org.mybatis.generator.api.DAOMethodNameCalculator interface\r\n if neither of the supplied options are appropriate in your environment.\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n
defaultThis is the default value
\r\n The generated methods names will be very simple (&quot;insert&quot;,\r\n &quot;updateByPrimaryKey&quot;, etc.)
extendedThe generated method names will include the name of the domain object\r\n associated with the method (&quot;insertWidget&quot;, &quot;updateWidgetByPrimaryKey&quot;, etc.)\r\n
\r\n

Important note: this property is ignored if the target runtime is\r\n MyBatis3.

\r\n
rootInterfaceThis property can be used to specify a super interface for all generated\r\n interface objects. This value may be overridden by specifying\r\n the rootInterface property on a Table configuration.\r\n

Important: MBG does not verify that the interface exists, or is a\r\n valid Java interface.

\r\n

If specified, the value of this property should be a fully qualified\r\n interface name (like com.mycompany.MyRootInterface).

\r\n\r\n

Example

\r\n

This element specifies that we always want to place generated interfaces and\r\nobjects\r\nin the &quot;'test.model&quot; package and that we want to use subpackages based on the\r\ntable schema and catalog. It also specifies that we want to generate\r\nmapper interfaces that reference an XML configuration file for MyBatis3.

\r\n
\r\n&lt;javaClientGenerator targetPackage=&quot;test.model&quot;\r\n     targetProject=&quot;\\MyProject\\src&quot; type=&quot;XMLMAPPER&quot;&gt;\r\n  &lt;property name=&quot;enableSubPackages&quot; value=&quot;true&quot; /&gt;\r\n&lt;/javaClientGenerator&gt;\r\n
\r\n\r\n
\r\n\n
\n
\n
\n\n
\n
\n
Copyright &copy; 2010-2012\n MyBatis.org.\n All Rights Reserved. \n \n
\n\n \n \n
\n
\n \n\n"},"meta":{"kind":"string","value":"{\n \"content_hash\": \"fb96d09adce5646e907d26b1263690ae\",\n \"timestamp\": \"\",\n \"source\": \"github\",\n \"line_count\": 443,\n \"max_line_length\": 387,\n \"avg_line_length\": 51.59367945823928,\n \"alnum_prop\": 0.5402957647882394,\n \"repo_name\": \"hemingwang0902/mochasoft-framework\",\n \"id\": \"b6b30c4af90b070641f7ce7c2c98473b0c304236\",\n \"size\": \"22856\",\n \"binary\": false,\n \"copies\": \"1\",\n \"ref\": \"refs/heads/master\",\n \"path\": \"tools/mybatis-generator/docs/configreference/javaClientGenerator.html\",\n \"mode\": \"33188\",\n \"license\": \"mit\",\n \"language\": [\n {\n \"name\": \"CSS\",\n \"bytes\": \"1665\"\n },\n {\n \"name\": \"Java\",\n \"bytes\": \"235598\"\n },\n {\n \"name\": \"JavaScript\",\n \"bytes\": \"2410\"\n },\n {\n \"name\": \"Shell\",\n \"bytes\": \"981\"\n }\n ],\n \"symlink_target\": \"\"\n}"}}},{"rowIdx":344,"cells":{"text":{"kind":"string","value":"/*\n * To change this license header, choose License Headers in Project Properties.\n * To change this template file, choose Tools | Templates\n * and open the template in the editor.\n */\npackage p_ServidorUDP;\n\nimport java.net.InetAddress;\n\n/**\n * Clase creada para almacenar la informacion de cada cliente, en la lista de grupos.\n * Como no hay Structs en Java (MAL), usamos una clase \n *\n * @author Jose Lluch\n */\npublic class Clientecillo {\n \n private int id, stock, grupo, puerto; \n private InetAddress address;\n\n public Clientecillo(int id, int stock, int grupo, int puerto, InetAddress address) {\n this.id = id;\n this.stock = stock;\n this.grupo = grupo;\n this.puerto = puerto;\n this.address = address;\n }\n\n public int getGrupo() {\n return grupo;\n }\n\n public int getId() {\n return id;\n }\n\n public int getPuerto() {\n return puerto;\n }\n\n public InetAddress getAddress() {\n return address;\n }\n\n public int getStock() {\n return stock;\n }\n \n \n \n \n}\n"},"meta":{"kind":"string","value":"{\n \"content_hash\": \"0aba2c4f4ebdf411bdda45da690cd1be\",\n \"timestamp\": \"\",\n \"source\": \"github\",\n \"line_count\": 52,\n \"max_line_length\": 88,\n \"avg_line_length\": 20.653846153846153,\n \"alnum_prop\": 0.6154562383612663,\n \"repo_name\": \"Joselluchp/ARC_Sesiones\",\n \"id\": \"665ea49f38721f5cf1757a79372091d5beb39f16\",\n \"size\": \"1074\",\n \"binary\": false,\n \"copies\": \"2\",\n \"ref\": \"refs/heads/master\",\n \"path\": \"ARC_Multicomputador_S4/src/p_ServidorUDP/Clientecillo.java\",\n \"mode\": \"33188\",\n \"license\": \"mit\",\n \"language\": [\n {\n \"name\": \"Java\",\n \"bytes\": \"77810\"\n }\n ],\n \"symlink_target\": \"\"\n}"}}},{"rowIdx":345,"cells":{"text":{"kind":"string","value":"// Copyright 2022 Google LLC\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 * ActivateLabels.java\n *\n * This file was auto-generated from WSDL\n * by the Apache Axis 1.4 Mar 02, 2009 (07:08:06 PST) WSDL2Java emitter.\n */\n\npackage com.google.api.ads.admanager.axis.v202205;\n\n\n/**\n * The action used for activating {@link Label} objects.\n */\npublic class ActivateLabels extends com.google.api.ads.admanager.axis.v202205.LabelAction implements java.io.Serializable {\n public ActivateLabels() {\n }\n\n @Override\n public String toString() {\n return com.google.common.base.MoreObjects.toStringHelper(this.getClass())\n .omitNullValues()\n .toString();\n }\n private java.lang.Object __equalsCalc = null;\n public synchronized boolean equals(java.lang.Object obj) {\n if (!(obj instanceof ActivateLabels)) return false;\n ActivateLabels other = (ActivateLabels) obj;\n if (obj == null) return false;\n if (this == obj) return true;\n if (__equalsCalc != null) {\n return (__equalsCalc == obj);\n }\n __equalsCalc = obj;\n boolean _equals;\n _equals = super.equals(obj);\n __equalsCalc = null;\n return _equals;\n }\n\n private boolean __hashCodeCalc = false;\n public synchronized int hashCode() {\n if (__hashCodeCalc) {\n return 0;\n }\n __hashCodeCalc = true;\n int _hashCode = super.hashCode();\n __hashCodeCalc = false;\n return _hashCode;\n }\n\n // Type metadata\n private static org.apache.axis.description.TypeDesc typeDesc =\n new org.apache.axis.description.TypeDesc(ActivateLabels.class, true);\n\n static {\n typeDesc.setXmlType(new javax.xml.namespace.QName(\"https://www.google.com/apis/ads/publisher/v202205\", \"ActivateLabels\"));\n }\n\n /**\n * Return type metadata object\n */\n public static org.apache.axis.description.TypeDesc getTypeDesc() {\n return typeDesc;\n }\n\n /**\n * Get Custom Serializer\n */\n public static org.apache.axis.encoding.Serializer getSerializer(\n java.lang.String mechType, \n java.lang.Class _javaType, \n javax.xml.namespace.QName _xmlType) {\n return \n new org.apache.axis.encoding.ser.BeanSerializer(\n _javaType, _xmlType, typeDesc);\n }\n\n /**\n * Get Custom Deserializer\n */\n public static org.apache.axis.encoding.Deserializer getDeserializer(\n java.lang.String mechType, \n java.lang.Class _javaType, \n javax.xml.namespace.QName _xmlType) {\n return \n new org.apache.axis.encoding.ser.BeanDeserializer(\n _javaType, _xmlType, typeDesc);\n }\n\n}\n"},"meta":{"kind":"string","value":"{\n \"content_hash\": \"05d2f683ca967b6f0ae7111a037b42ec\",\n \"timestamp\": \"\",\n \"source\": \"github\",\n \"line_count\": 104,\n \"max_line_length\": 130,\n \"avg_line_length\": 31.240384615384617,\n \"alnum_prop\": 0.6398891966759003,\n \"repo_name\": \"googleads/googleads-java-lib\",\n \"id\": \"4102578b90189f55b134d4e7db6025a208ef0d63\",\n \"size\": \"3249\",\n \"binary\": false,\n \"copies\": \"1\",\n \"ref\": \"refs/heads/master\",\n \"path\": \"modules/dfp_axis/src/main/java/com/google/api/ads/admanager/axis/v202205/ActivateLabels.java\",\n \"mode\": \"33188\",\n \"license\": \"apache-2.0\",\n \"language\": [\n {\n \"name\": \"Java\",\n \"bytes\": \"81068791\"\n }\n ],\n \"symlink_target\": \"\"\n}"}}},{"rowIdx":346,"cells":{"text":{"kind":"string","value":" array(\n 'namespaces' => array(\n __NAMESPACE__ => __DIR__ . '/src/' . __NAMESPACE__,\n ),\n ),\n );\n }\n public function getViewHelperConfig()\n {\n return array(\n 'invokables' => array(\n 'SpecialPurpose' => 'Dashboard\\View\\Helper\\SpecialPurpose',\n ),\n );\n }\n \n\tpublic function getServiceConfig() {\n\t\treturn array(\n\t\t\t'factories' => array(\n\t\t\t\t'DepartmentTable' => function($sm) {\n\t\t\t\t\t$dbAdapter = $sm->get('Zend\\Db\\Adapter\\Adapter');\n\t\t\t\t\t$table = new DepartmentTable($dbAdapter);\n\t\t\t\t\treturn $table;\n\t\t\t\t},\n\t\t\t\t'DesignationTable' => function($sm) {\n\t\t\t\t\t$dbAdapter = $sm->get('Zend\\Db\\Adapter\\Adapter');\n\t\t\t\t\t$table = new DesignationTable($dbAdapter);\n\t\t\t\t\treturn $table;\n\t\t\t\t},\n\t\t\t\t'SkillTable' => function($sm) {\n\t\t\t\t\t$dbAdapter = $sm->get('Zend\\Db\\Adapter\\Adapter');\n\t\t\t\t\t$table = new SkillTable($dbAdapter);\n\t\t\t\t\treturn $table;\n\t\t\t\t},\n\t\t\t\t'TopicTable' => function($sm) {\n\t\t\t\t\t$dbAdapter = $sm->get('Zend\\Db\\Adapter\\Adapter');\n\t\t\t\t\t$table = new TopicTable($dbAdapter);\n\t\t\t\t\treturn $table;\n\t\t\t\t},\n\t\t\t),\n\t\t);\n\t}\n}\n"},"meta":{"kind":"string","value":"{\n \"content_hash\": \"7b57e9823f674fd03a5c1e0cf876433c\",\n \"timestamp\": \"\",\n \"source\": \"github\",\n \"line_count\": 61,\n \"max_line_length\": 73,\n \"avg_line_length\": 25.868852459016395,\n \"alnum_prop\": 0.5716096324461344,\n \"repo_name\": \"narwaria/test\",\n \"id\": \"a3d8dfd79913ed0c58e142940400e09b60812951\",\n \"size\": \"1578\",\n \"binary\": false,\n \"copies\": \"2\",\n \"ref\": \"refs/heads/master\",\n \"path\": \"module/Dashboard/Module.php\",\n \"mode\": \"33261\",\n \"license\": \"bsd-3-clause\",\n \"language\": [\n {\n \"name\": \"CSS\",\n \"bytes\": \"28351\"\n },\n {\n \"name\": \"JavaScript\",\n \"bytes\": \"153314\"\n },\n {\n \"name\": \"PHP\",\n \"bytes\": \"170945\"\n }\n ],\n \"symlink_target\": \"\"\n}"}}},{"rowIdx":347,"cells":{"text":{"kind":"string","value":"Your program should display the outputs shown in this table for the given\ninputs provided:\n\n| Input | Output |\n| ------------- | --------------------- |\n| 50184385 | Valid product code! |\n| 036000241457 | Valid product code! |\n| 50174385 | Invalid product code! |\n| 9330462119318 | Valid product code! |\n| 9330463119318 | Invalid product code! |\n| 036002241457 | Invalid product code! |\n"},"meta":{"kind":"string","value":"{\n \"content_hash\": \"1086d8e2a477689f42014c7f6ac27755\",\n \"timestamp\": \"\",\n \"source\": \"github\",\n \"line_count\": 11,\n \"max_line_length\": 73,\n \"avg_line_length\": 38.90909090909091,\n \"alnum_prop\": 0.5934579439252337,\n \"repo_name\": \"uccser/cs-unplugged\",\n \"id\": \"2bd4cb463ba882817ca7fc9c039702f9d817b1d0\",\n \"size\": \"528\",\n \"binary\": false,\n \"copies\": \"1\",\n \"ref\": \"refs/heads/develop\",\n \"path\": \"csunplugged/topics/content/en/error-detection-and-correction/programming-challenges/product-code-check-valid-any-length/testing-examples.md\",\n \"mode\": \"33188\",\n \"license\": \"mit\",\n \"language\": [\n {\n \"name\": \"Dockerfile\",\n \"bytes\": \"7927\"\n },\n {\n \"name\": \"HTML\",\n \"bytes\": \"432891\"\n },\n {\n \"name\": \"JavaScript\",\n \"bytes\": \"104806\"\n },\n {\n \"name\": \"Python\",\n \"bytes\": \"1257568\"\n },\n {\n \"name\": \"SCSS\",\n \"bytes\": \"67560\"\n },\n {\n \"name\": \"Shell\",\n \"bytes\": \"12461\"\n }\n ],\n \"symlink_target\": \"\"\n}"}}},{"rowIdx":348,"cells":{"text":{"kind":"string","value":"/**\n * This file is provided by Facebook for testing and evaluation purposes\n * only. Facebook reserves all rights not expressly granted.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL\n * FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN\n * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\n * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n */\n\nimport React from 'react';\nimport Relay from 'react-relay';\nimport AddMessageMutation from '../mutations/AddMessageMutation';\n\nvar ENTER_KEY_CODE = 13;\n\nclass MessageComposer extends React.Component {\n\n constructor(props, context) {\n super(props, context);\n this.state = {text: ''};\n }\n\n render() {\n return (\n \n );\n }\n\n _onChange = (event) => {\n this.setState({text: event.target.value});\n }\n\n _onKeyDown = (event) => {\n if (event.keyCode === ENTER_KEY_CODE) {\n event.preventDefault();\n var text = this.state.text.trim();\n if (text) {\n Relay.Store.update(new AddMessageMutation({\n text,\n viewer: this.props.viewer,\n thread: this.props.thread\n }));\n }\n this.setState({text: ''});\n }\n }\n\n}\n\nexport default Relay.createContainer(MessageComposer, {\n fragments: {\n thread: () => Relay.QL`\n fragment on Thread {\n ${AddMessageMutation.getFragment('thread')}\n }\n `,\n viewer: () => Relay.QL`\n fragment on User {\n ${AddMessageMutation.getFragment('viewer')}\n }\n `,\n }\n});\n"},"meta":{"kind":"string","value":"{\n \"content_hash\": \"3531d720fb0fb232f0c2e6ef92d686c1\",\n \"timestamp\": \"\",\n \"source\": \"github\",\n \"line_count\": 72,\n \"max_line_length\": 77,\n \"avg_line_length\": 26.26388888888889,\n \"alnum_prop\": 0.6351136964569011,\n \"repo_name\": \"chentsulin/relay-chat\",\n \"id\": \"d1aefcd5c21eecfec244e6a423f24c4ac2fe0733\",\n \"size\": \"1891\",\n \"binary\": false,\n \"copies\": \"3\",\n \"ref\": \"refs/heads/master\",\n \"path\": \"js/components/MessageComposer.js\",\n \"mode\": \"33188\",\n \"license\": \"mit\",\n \"language\": [\n {\n \"name\": \"CSS\",\n \"bytes\": \"1977\"\n },\n {\n \"name\": \"HTML\",\n \"bytes\": \"911\"\n },\n {\n \"name\": \"JavaScript\",\n \"bytes\": \"34848\"\n }\n ],\n \"symlink_target\": \"\"\n}"}}},{"rowIdx":349,"cells":{"text":{"kind":"string","value":"\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"},"meta":{"kind":"string","value":"{\n \"content_hash\": \"46f1010f61482492ba0b18df389def62\",\n \"timestamp\": \"\",\n \"source\": \"github\",\n \"line_count\": 181,\n \"max_line_length\": 133,\n \"avg_line_length\": 41.54696132596685,\n \"alnum_prop\": 0.542686170212766,\n \"repo_name\": \"danasselin/line-cook\",\n \"id\": \"841ecbc5431dd96113011f482168753441ff0049\",\n \"size\": \"7520\",\n \"binary\": false,\n \"copies\": \"2\",\n \"ref\": \"refs/heads/master\",\n \"path\": \"workshop/platforms/ios/www/index.html\",\n \"mode\": \"33188\",\n \"license\": \"mit\",\n \"language\": [\n {\n \"name\": \"Batchfile\",\n \"bytes\": \"3009\"\n },\n {\n \"name\": \"C\",\n \"bytes\": \"5598682\"\n },\n {\n \"name\": \"C#\",\n \"bytes\": \"5291\"\n },\n {\n \"name\": \"C++\",\n \"bytes\": \"89158\"\n },\n {\n \"name\": \"CSS\",\n \"bytes\": \"2896\"\n },\n {\n \"name\": \"HTML\",\n \"bytes\": \"35448\"\n },\n {\n \"name\": \"Java\",\n \"bytes\": \"11310\"\n },\n {\n \"name\": \"JavaScript\",\n \"bytes\": \"128230\"\n },\n {\n \"name\": \"Objective-C\",\n \"bytes\": \"510868\"\n },\n {\n \"name\": \"Ruby\",\n \"bytes\": \"15425\"\n },\n {\n \"name\": \"Scheme\",\n \"bytes\": \"102\"\n },\n {\n \"name\": \"Shell\",\n \"bytes\": \"4592\"\n }\n ],\n \"symlink_target\": \"\"\n}"}}},{"rowIdx":350,"cells":{"text":{"kind":"string","value":"/* AUTO-GENERATED FILE. DO NOT MODIFY.\n *\n * This class was automatically generated by the\n * aapt tool from the resource data it found. It\n * should not be modified by hand.\n */\n\npackage org.opencv.samples.myarm;\n\npublic final class R {\n public static final class attr {\n }\n public static final class drawable {\n public static final int c=0x7f020000;\n public static final int fang=0x7f020001;\n public static final int icon=0x7f020002;\n public static final int l=0x7f020003;\n public static final int r=0x7f020004;\n public static final int up=0x7f020005;\n public static final int zhua=0x7f020006;\n }\n public static final class id {\n public static final int fang_Button=0x7f050005;\n public static final int foward_Button=0x7f050001;\n public static final int leftfoward_Button=0x7f050002;\n public static final int mid_Button=0x7f050000;\n public static final int rightfoward_Button=0x7f050003;\n public static final int zhua_Button=0x7f050004;\n }\n public static final class layout {\n public static final int color_blob_detection_surface_view=0x7f030000;\n }\n public static final class string {\n public static final int app_name=0x7f040000;\n public static final int connect=0x7f040002;\n public static final int hello=0x7f040001;\n public static final int send=0x7f040003;\n }\n}\n"},"meta":{"kind":"string","value":"{\n \"content_hash\": \"41add641502c7f7b4cfc12273ab258ec\",\n \"timestamp\": \"\",\n \"source\": \"github\",\n \"line_count\": 39,\n \"max_line_length\": 77,\n \"avg_line_length\": 36.58974358974359,\n \"alnum_prop\": 0.6951646811492642,\n \"repo_name\": \"SWJTUyuhui/RoboticArm-\",\n \"id\": \"aeb09dbdeb4a8db7fc8f5e9b5f7f76580c20bf75\",\n \"size\": \"1427\",\n \"binary\": false,\n \"copies\": \"1\",\n \"ref\": \"refs/heads/master\",\n \"path\": \"myarmapp/gen/org/opencv/samples/myarm/R.java\",\n \"mode\": \"33188\",\n \"license\": \"mit\",\n \"language\": [\n {\n \"name\": \"Arduino\",\n \"bytes\": \"7314\"\n },\n {\n \"name\": \"Java\",\n \"bytes\": \"13686\"\n }\n ],\n \"symlink_target\": \"\"\n}"}}},{"rowIdx":351,"cells":{"text":{"kind":"string","value":"\"\"\"Helper classes that list&validate all attributes to serialize to SavedModel.\"\"\"\n\nfrom __future__ import absolute_import\nfrom __future__ import division\nfrom __future__ import print_function\n\nimport abc\nimport six\n\nfrom tensorflow.python.keras.saving.saved_model import json_utils\nfrom tensorflow.python.training.tracking import tracking\n\n\n@six.add_metaclass(abc.ABCMeta)\nclass SavedModelSaver(object):\n \"\"\"Saver defining the methods and properties used to serialize Keras objects.\n \"\"\"\n\n def __init__(self, obj):\n self.obj = obj\n\n @abc.abstractproperty\n def object_identifier(self):\n \"\"\"String stored in object identifier field in the SavedModel proto.\n\n Returns:\n A string with the object identifier, which is used at load time.\n \"\"\"\n raise NotImplementedError\n\n @property\n def tracking_metadata(self):\n \"\"\"String stored in metadata field in the SavedModel proto.\n\n Returns:\n A serialized JSON storing information necessary for recreating this layer.\n \"\"\"\n # TODO(kathywu): check that serialized JSON can be loaded (e.g., if an\n # object is in the python property)\n return json_utils.Encoder().encode(self.python_properties)\n\n def list_extra_dependencies_for_serialization(self, serialization_cache):\n \"\"\"Lists extra dependencies to serialize to SavedModel.\n\n By overriding this method, extra dependencies can be attached to the\n serialized Layer. For example, this is used to save the list of `variables`\n and `trainable_variables`, which are python properties in a Layer object,\n but are represented as a static list in the SavedModel.\n\n Args:\n serialization_cache: A dictionary shared between all objects in the same\n object graph. This object is passed to both\n `_list_extra_dependencies_for_serialization` and\n `_list_functions_for_serialization`.\n\n Returns:\n A dictionary mapping attribute names to trackable objects. The entire list\n of attributes are listed in the `saved_model._LayerAttributes` class.\n \"\"\"\n return self.objects_to_serialize(serialization_cache)\n\n def list_functions_for_serialization(self, serialization_cache):\n \"\"\"Lists extra functions to serialize to the SavedModel.\n\n Args:\n serialization_cache: Dictionary passed to all objects in the same object\n graph during serialization.\n\n Returns:\n A dictionary mapping attribute names to `Function` or\n `ConcreteFunction`.\n \"\"\"\n fns = self.functions_to_serialize(serialization_cache)\n\n # The parent AutoTrackable class saves all user-defined tf.functions, and\n # returns them in _list_functions_for_serialization(). Add these functions\n # to the dict.\n fns.update(\n tracking.AutoTrackable._list_functions_for_serialization( # pylint:disable=protected-access\n self.obj, serialization_cache))\n return fns\n\n @abc.abstractproperty\n def python_properties(self):\n \"\"\"Returns dictionary of python properties to save in the metadata.\n\n This dictionary must be serializable and deserializable to/from JSON.\n\n When loading, the items in this dict are used to initialize the object and\n define attributes in the revived object.\n \"\"\"\n raise NotImplementedError\n\n @abc.abstractmethod\n def objects_to_serialize(self, serialization_cache):\n \"\"\"Returns dictionary of extra checkpointable objects to serialize.\n\n See `functions_to_serialize` for an explanation of this function's\n effects.\n\n Args:\n serialization_cache: Dictionary passed to all objects in the same object\n graph during serialization.\n\n Returns:\n A dictionary mapping attribute names to checkpointable objects.\n \"\"\"\n raise NotImplementedError\n\n @abc.abstractmethod\n def functions_to_serialize(self, serialization_cache):\n \"\"\"Returns extra functions to include when serializing a Keras object.\n\n Normally, when calling exporting an object to SavedModel, only the\n functions and objects defined by the user are saved. For example:\n\n ```\n obj = tf.Module()\n obj.v = tf.Variable(1.)\n\n @tf.function\n def foo(...): ...\n\n obj.foo = foo\n\n w = tf.Variable(1.)\n\n tf.saved_model.save(obj, 'path/to/saved/model')\n loaded = tf.saved_model.load('path/to/saved/model')\n\n loaded.v # Variable with the same value as obj.v\n loaded.foo # Equivalent to obj.foo\n loaded.w # AttributeError\n ```\n\n Assigning trackable objects to attributes creates a graph, which is used for\n both checkpointing and SavedModel serialization.\n\n When the graph generated from attribute tracking is insufficient, extra\n objects and functions may be added at serialization time. For example,\n most models do not have their call function wrapped with a @tf.function\n decorator. This results in `model.call` not being saved. Since Keras objects\n should be revivable from the SavedModel format, the call function is added\n as an extra function to serialize.\n\n This function and `objects_to_serialize` is called multiple times when\n exporting to SavedModel. Please use the cache to avoid generating new\n functions and objects. A fresh cache is created for each SavedModel export.\n\n Args:\n serialization_cache: Dictionary passed to all objects in the same object\n graph during serialization.\n\n Returns:\n A dictionary mapping attribute names to `Function` or\n `ConcreteFunction`.\n \"\"\"\n raise NotImplementedError\n"},"meta":{"kind":"string","value":"{\n \"content_hash\": \"4894553db2e3400db1fac952867dc151\",\n \"timestamp\": \"\",\n \"source\": \"github\",\n \"line_count\": 158,\n \"max_line_length\": 100,\n \"avg_line_length\": 34.56962025316456,\n \"alnum_prop\": 0.7226290735994141,\n \"repo_name\": \"gunan/tensorflow\",\n \"id\": \"0065e6d786e95bed952abb1ca730c3f3cd19ff56\",\n \"size\": \"6151\",\n \"binary\": false,\n \"copies\": \"5\",\n \"ref\": \"refs/heads/master\",\n \"path\": \"tensorflow/python/keras/saving/saved_model/base_serialization.py\",\n \"mode\": \"33188\",\n \"license\": \"apache-2.0\",\n \"language\": [\n {\n \"name\": \"Assembly\",\n \"bytes\": \"5003\"\n },\n {\n \"name\": \"Batchfile\",\n \"bytes\": \"45924\"\n },\n {\n \"name\": \"C\",\n \"bytes\": \"774953\"\n },\n {\n \"name\": \"C#\",\n \"bytes\": \"8562\"\n },\n {\n \"name\": \"C++\",\n \"bytes\": \"77908225\"\n },\n {\n \"name\": \"CMake\",\n \"bytes\": \"6500\"\n },\n {\n \"name\": \"Dockerfile\",\n \"bytes\": \"104215\"\n },\n {\n \"name\": \"Go\",\n \"bytes\": \"1841471\"\n },\n {\n \"name\": \"HTML\",\n \"bytes\": \"4686483\"\n },\n {\n \"name\": \"Java\",\n \"bytes\": \"962443\"\n },\n {\n \"name\": \"Jupyter Notebook\",\n \"bytes\": \"556650\"\n },\n {\n \"name\": \"LLVM\",\n \"bytes\": \"6536\"\n },\n {\n \"name\": \"MLIR\",\n \"bytes\": \"1479029\"\n },\n {\n \"name\": \"Makefile\",\n \"bytes\": \"58603\"\n },\n {\n \"name\": \"Objective-C\",\n \"bytes\": \"104667\"\n },\n {\n \"name\": \"Objective-C++\",\n \"bytes\": \"297830\"\n },\n {\n \"name\": \"PHP\",\n \"bytes\": \"23994\"\n },\n {\n \"name\": \"Pascal\",\n \"bytes\": \"3739\"\n },\n {\n \"name\": \"Pawn\",\n \"bytes\": \"17039\"\n },\n {\n \"name\": \"Perl\",\n \"bytes\": \"7536\"\n },\n {\n \"name\": \"Python\",\n \"bytes\": \"39476740\"\n },\n {\n \"name\": \"RobotFramework\",\n \"bytes\": \"891\"\n },\n {\n \"name\": \"Roff\",\n \"bytes\": \"2472\"\n },\n {\n \"name\": \"Ruby\",\n \"bytes\": \"7459\"\n },\n {\n \"name\": \"Shell\",\n \"bytes\": \"650007\"\n },\n {\n \"name\": \"Smarty\",\n \"bytes\": \"34649\"\n },\n {\n \"name\": \"Swift\",\n \"bytes\": \"62814\"\n },\n {\n \"name\": \"Vim Snippet\",\n \"bytes\": \"58\"\n }\n ],\n \"symlink_target\": \"\"\n}"}}},{"rowIdx":352,"cells":{"text":{"kind":"string","value":"using EPiServer.Cms.UI.AspNetIdentity;\nusing EPiServer.Core;\nusing EPiServer.Reference.Commerce.Shared.Identity;\nusing EPiServer.Reference.Commerce.Site.Features.Login.Services;\nusing EPiServer.Reference.Commerce.Site.Features.Shared.Extensions;\nusing EPiServer.Web;\nusing EPiServer.Web.Mvc;\nusing System.Collections.Generic;\nusing System.Web.Mvc;\n\nnamespace EPiServer.Reference.Commerce.Site.Features.Shared.Controllers\n{\n /// \n /// Base class for controllers related to ASP.NET Identity. This controller can be used both for\n /// pages and blocks.\n /// \n /// The contextual IContent related to the current page or block.\n [AuthorizeContent]\n [VisitorGroupImpersonation]\n public abstract class IdentityControllerBase : ActionControllerBase, IRenderTemplate where T : IContentData\n {\n protected IdentityControllerBase(ApplicationSignInManager applicationSignInManager, ApplicationUserManager applicationUserManager, UserService userService)\n {\n SignInManager = applicationSignInManager;\n UserManager = applicationUserManager;\n UserService = userService;\n }\n\n public UserService UserService { get; }\n\n public ApplicationSignInManager SignInManager { get; }\n\n public ApplicationUserManager UserManager { get; }\n\n /// \n /// Redirects the request to the original URL.\n /// \n /// The URL to be redirected to.\n /// The ActionResult of the URL if it is within the current application, else it\n /// redirects to the web application start page.\n public ActionResult RedirectToLocal(string returnUrl)\n {\n if (returnUrl.IsLocalUrl(Request))\n {\n return Redirect(returnUrl);\n }\n return RedirectToAction(\"Index\", new { node = ContentReference.StartPage });\n }\n\n [HttpGet]\n public ActionResult SignOut()\n {\n UserService.SignOut();\n return RedirectToAction(\"Index\", new { node = ContentReference.StartPage });\n }\n\n public void AddErrors(IEnumerable errors)\n {\n foreach (var error in errors)\n {\n ModelState.AddModelError(string.Empty, error);\n }\n }\n\n private bool _disposed;\n protected override void Dispose(bool disposing)\n {\n if (!disposing || _disposed)\n {\n return;\n }\n\n UserManager?.Dispose();\n SignInManager?.Dispose();\n UserService?.Dispose();\n\n base.Dispose(true);\n\n _disposed = true;\n }\n }\n}"},"meta":{"kind":"string","value":"{\n \"content_hash\": \"24f4fa896b050fd146aca9f33929d1da\",\n \"timestamp\": \"\",\n \"source\": \"github\",\n \"line_count\": 82,\n \"max_line_length\": 183,\n \"avg_line_length\": 34.573170731707314,\n \"alnum_prop\": 0.6373897707231041,\n \"repo_name\": \"Geta/SEO.Sitemaps\",\n \"id\": \"dc64570daa4aaf9e7a8376dd61444d6bde3151cf\",\n \"size\": \"2837\",\n \"binary\": false,\n \"copies\": \"3\",\n \"ref\": \"refs/heads/master\",\n \"path\": \"samples/Quicksilver/EPiServer.Reference.Commerce.Site/Features/Shared/Controllers/IdentityControllerBase.cs\",\n \"mode\": \"33188\",\n \"license\": \"apache-2.0\",\n \"language\": [\n {\n \"name\": \"ASP.NET\",\n \"bytes\": \"12363\"\n },\n {\n \"name\": \"C#\",\n \"bytes\": \"128426\"\n },\n {\n \"name\": \"HTML\",\n \"bytes\": \"771\"\n },\n {\n \"name\": \"JavaScript\",\n \"bytes\": \"4548\"\n },\n {\n \"name\": \"PowerShell\",\n \"bytes\": \"427\"\n }\n ],\n \"symlink_target\": \"\"\n}"}}},{"rowIdx":353,"cells":{"text":{"kind":"string","value":"load->view('admin/header'); ?>\n
\n
\n \n
\n load->view('admin/'.$content); ?>\n load->view('admin/footer'); ?>\n"},"meta":{"kind":"string","value":"{\n \"content_hash\": \"bd6f9d0f3c241a3b57bb84295d54207c\",\n \"timestamp\": \"\",\n \"source\": \"github\",\n \"line_count\": 15,\n \"max_line_length\": 221,\n \"avg_line_length\": 78,\n \"alnum_prop\": 0.558974358974359,\n \"repo_name\": \"Arkeon-net/bandung\",\n \"id\": \"09ae422dd194c596a6840abec97db6d35016f8fd\",\n \"size\": \"1170\",\n \"binary\": false,\n \"copies\": \"1\",\n \"ref\": \"refs/heads/master\",\n \"path\": \"application/views/admin/main.php\",\n \"mode\": \"33188\",\n \"license\": \"apache-2.0\",\n \"language\": [\n {\n \"name\": \"ActionScript\",\n \"bytes\": \"626638\"\n },\n {\n \"name\": \"CSS\",\n \"bytes\": \"1046320\"\n },\n {\n \"name\": \"JavaScript\",\n \"bytes\": \"2425179\"\n },\n {\n \"name\": \"PHP\",\n \"bytes\": \"1493049\"\n },\n {\n \"name\": \"Python\",\n \"bytes\": \"85164\"\n }\n ],\n \"symlink_target\": \"\"\n}"}}},{"rowIdx":354,"cells":{"text":{"kind":"string","value":"\n\npackage com.blazebit.persistence.view.impl.objectbuilder;\n\nimport com.blazebit.persistence.view.impl.collection.PluralObjectFactory;\n\nimport java.util.ArrayList;\nimport java.util.Collection;\nimport java.util.Collections;\nimport java.util.Comparator;\nimport java.util.HashSet;\nimport java.util.Iterator;\nimport java.util.Set;\n\n/**\n *\n * @author Christian Beikov\n * @since 1.5.0\n */\npublic class SimpleCollectionAccumulator implements ContainerAccumulator> {\n\n private final PluralObjectFactory> pluralObjectFactory;\n private final boolean forceUnique;\n private final Comparator comparator;\n\n public SimpleCollectionAccumulator(PluralObjectFactory> pluralObjectFactory, boolean forceUnique, Comparator comparator) {\n this.pluralObjectFactory = (PluralObjectFactory>) pluralObjectFactory;\n this.forceUnique = forceUnique;\n this.comparator = comparator;\n }\n\n @Override\n public Collection createContainer(boolean recording, int size) {\n return pluralObjectFactory.createCollection(size);\n }\n\n @Override\n public void add(Collection container, Object indexObject, Object value, boolean recording) {\n container.add(value);\n }\n\n @Override\n public void addAll(Collection container, Collection collection, boolean recording) {\n container.addAll(collection);\n }\n\n @Override\n public boolean requiresPostConstruct() {\n return forceUnique || comparator != null;\n }\n\n @Override\n public void postConstruct(Collection collection) {\n ArrayList list = (ArrayList) collection;\n if (forceUnique) {\n Set set = new HashSet<>(list.size());\n Iterator iter = list.iterator();\n\n while (iter.hasNext()) {\n Object o = iter.next();\n if (!set.add(o)) {\n iter.remove();\n }\n }\n }\n if (comparator != null) {\n Collections.sort(list, comparator);\n }\n }\n}\n"},"meta":{"kind":"string","value":"{\n \"content_hash\": \"700081c16d471ae04abad83d0ddc9789\",\n \"timestamp\": \"\",\n \"source\": \"github\",\n \"line_count\": 70,\n \"max_line_length\": 158,\n \"avg_line_length\": 30.757142857142856,\n \"alnum_prop\": 0.6758012076172782,\n \"repo_name\": \"Blazebit/blaze-persistence\",\n \"id\": \"95b9c145058da039febaf09ae341234f1cb046ff\",\n \"size\": \"2753\",\n \"binary\": false,\n \"copies\": \"1\",\n \"ref\": \"refs/heads/main\",\n \"path\": \"entity-view/impl/src/main/java/com/blazebit/persistence/view/impl/objectbuilder/SimpleCollectionAccumulator.java\",\n \"mode\": \"33188\",\n \"license\": \"apache-2.0\",\n \"language\": [\n {\n \"name\": \"ANTLR\",\n \"bytes\": \"44368\"\n },\n {\n \"name\": \"Batchfile\",\n \"bytes\": \"727\"\n },\n {\n \"name\": \"CSS\",\n \"bytes\": \"85149\"\n },\n {\n \"name\": \"FreeMarker\",\n \"bytes\": \"16964\"\n },\n {\n \"name\": \"HTML\",\n \"bytes\": \"8988\"\n },\n {\n \"name\": \"Java\",\n \"bytes\": \"20068561\"\n },\n {\n \"name\": \"JavaScript\",\n \"bytes\": \"7022\"\n },\n {\n \"name\": \"Shell\",\n \"bytes\": \"12643\"\n }\n ],\n \"symlink_target\": \"\"\n}"}}},{"rowIdx":355,"cells":{"text":{"kind":"string","value":".class public final enum Lcom/android/internal/telephony/PhoneConstants$State;\n.super Ljava/lang/Enum;\n.source \"PhoneConstants.java\"\n\n\n# annotations\n.annotation system Ldalvik/annotation/EnclosingClass;\n value = Lcom/android/internal/telephony/PhoneConstants;\n.end annotation\n\n.annotation system Ldalvik/annotation/InnerClass;\n accessFlags = 0x4019\n name = \"State\"\n.end annotation\n\n.annotation system Ldalvik/annotation/Signature;\n value = {\n \"Ljava/lang/Enum\",\n \"<\",\n \"Lcom/android/internal/telephony/PhoneConstants$State;\",\n \">;\"\n }\n.end annotation\n\n\n# static fields\n.field private static final synthetic $VALUES:[Lcom/android/internal/telephony/PhoneConstants$State;\n\n.field public static final enum IDLE:Lcom/android/internal/telephony/PhoneConstants$State;\n\n.field public static final enum OFFHOOK:Lcom/android/internal/telephony/PhoneConstants$State;\n\n.field public static final enum RINGING:Lcom/android/internal/telephony/PhoneConstants$State;\n\n\n# direct methods\n.method static constructor ()V\n .locals 5\n\n .prologue\n const/4 v4, 0x2\n\n const/4 v3, 0x1\n\n const/4 v2, 0x0\n\n .line 35\n new-instance v0, Lcom/android/internal/telephony/PhoneConstants$State;\n\n const-string v1, \"IDLE\"\n\n invoke-direct {v0, v1, v2}, Lcom/android/internal/telephony/PhoneConstants$State;->(Ljava/lang/String;I)V\n\n sput-object v0, Lcom/android/internal/telephony/PhoneConstants$State;->IDLE:Lcom/android/internal/telephony/PhoneConstants$State;\n\n new-instance v0, Lcom/android/internal/telephony/PhoneConstants$State;\n\n const-string v1, \"RINGING\"\n\n invoke-direct {v0, v1, v3}, Lcom/android/internal/telephony/PhoneConstants$State;->(Ljava/lang/String;I)V\n\n sput-object v0, Lcom/android/internal/telephony/PhoneConstants$State;->RINGING:Lcom/android/internal/telephony/PhoneConstants$State;\n\n new-instance v0, Lcom/android/internal/telephony/PhoneConstants$State;\n\n const-string v1, \"OFFHOOK\"\n\n invoke-direct {v0, v1, v4}, Lcom/android/internal/telephony/PhoneConstants$State;->(Ljava/lang/String;I)V\n\n sput-object v0, Lcom/android/internal/telephony/PhoneConstants$State;->OFFHOOK:Lcom/android/internal/telephony/PhoneConstants$State;\n\n .line 34\n const/4 v0, 0x3\n\n new-array v0, v0, [Lcom/android/internal/telephony/PhoneConstants$State;\n\n sget-object v1, Lcom/android/internal/telephony/PhoneConstants$State;->IDLE:Lcom/android/internal/telephony/PhoneConstants$State;\n\n aput-object v1, v0, v2\n\n sget-object v1, Lcom/android/internal/telephony/PhoneConstants$State;->RINGING:Lcom/android/internal/telephony/PhoneConstants$State;\n\n aput-object v1, v0, v3\n\n sget-object v1, Lcom/android/internal/telephony/PhoneConstants$State;->OFFHOOK:Lcom/android/internal/telephony/PhoneConstants$State;\n\n aput-object v1, v0, v4\n\n sput-object v0, Lcom/android/internal/telephony/PhoneConstants$State;->$VALUES:[Lcom/android/internal/telephony/PhoneConstants$State;\n\n return-void\n.end method\n\n.method private constructor (Ljava/lang/String;I)V\n .locals 0\n .annotation system Ldalvik/annotation/Signature;\n value = {\n \"()V\"\n }\n .end annotation\n\n .prologue\n .line 34\n invoke-direct {p0, p1, p2}, Ljava/lang/Enum;->(Ljava/lang/String;I)V\n\n return-void\n.end method\n\n.method public static valueOf(Ljava/lang/String;)Lcom/android/internal/telephony/PhoneConstants$State;\n .locals 1\n .param p0, \"name\" # Ljava/lang/String;\n\n .prologue\n .line 34\n const-class v0, Lcom/android/internal/telephony/PhoneConstants$State;\n\n invoke-static {v0, p0}, Ljava/lang/Enum;->valueOf(Ljava/lang/Class;Ljava/lang/String;)Ljava/lang/Enum;\n\n move-result-object v0\n\n check-cast v0, Lcom/android/internal/telephony/PhoneConstants$State;\n\n return-object v0\n.end method\n\n.method public static values()[Lcom/android/internal/telephony/PhoneConstants$State;\n .locals 1\n\n .prologue\n .line 34\n sget-object v0, Lcom/android/internal/telephony/PhoneConstants$State;->$VALUES:[Lcom/android/internal/telephony/PhoneConstants$State;\n\n invoke-virtual {v0}, [Lcom/android/internal/telephony/PhoneConstants$State;->clone()Ljava/lang/Object;\n\n move-result-object v0\n\n check-cast v0, [Lcom/android/internal/telephony/PhoneConstants$State;\n\n return-object v0\n.end method\n"},"meta":{"kind":"string","value":"{\n \"content_hash\": \"f58daa5634023bef791593085f494a35\",\n \"timestamp\": \"\",\n \"source\": \"github\",\n \"line_count\": 140,\n \"max_line_length\": 137,\n \"avg_line_length\": 31.15,\n \"alnum_prop\": 0.7418023389130933,\n \"repo_name\": \"Liberations/Flyme5_devices_base_cm\",\n \"id\": \"283a0b7bf4e63744946e88148b84a3c59b6600c9\",\n \"size\": \"4361\",\n \"binary\": false,\n \"copies\": \"4\",\n \"ref\": \"refs/heads/master\",\n \"path\": \"vendor/aosp/framework.jar.out/smali_classes2/com/android/internal/telephony/PhoneConstants$State.smali\",\n \"mode\": \"33188\",\n \"license\": \"apache-2.0\",\n \"language\": [\n {\n \"name\": \"GLSL\",\n \"bytes\": \"1500\"\n },\n {\n \"name\": \"HTML\",\n \"bytes\": \"96769\"\n },\n {\n \"name\": \"Makefile\",\n \"bytes\": \"11209\"\n },\n {\n \"name\": \"Python\",\n \"bytes\": \"1195\"\n },\n {\n \"name\": \"Shell\",\n \"bytes\": \"55270\"\n },\n {\n \"name\": \"Smali\",\n \"bytes\": \"160321888\"\n }\n ],\n \"symlink_target\": \"\"\n}"}}},{"rowIdx":356,"cells":{"text":{"kind":"string","value":"/*\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 */\npackage org.jctools.queues;\n\nimport static org.jctools.queues.CircularArrayOffsetCalculator.allocate;\nimport static org.jctools.queues.CircularArrayOffsetCalculator.calcElementOffset;\nimport static org.jctools.util.UnsafeRefArrayAccess.lvElement;\n\nimport org.jctools.util.Pow2;\n\npublic class SpscChunkedArrayQueue extends BaseSpscLinkedArrayQueue {\n private int maxQueueCapacity;\n private long producerQueueLimit;\n\n public SpscChunkedArrayQueue(final int capacity) {\n this(Math.max(8, Pow2.roundToPowerOfTwo(capacity / 8)), capacity);\n }\n\n public SpscChunkedArrayQueue(final int chunkSize, final int capacity) {\n if (capacity < 16) {\n throw new IllegalArgumentException(\"Max capacity must be 4 or more\");\n }\n // minimal chunk size of eight makes sure minimal lookahead step is 2\n if (chunkSize < 8) {\n throw new IllegalArgumentException(\"Chunk size must be 2 or more\");\n }\n\n maxQueueCapacity = Pow2.roundToPowerOfTwo(capacity);\n int chunkCapacity = Pow2.roundToPowerOfTwo(chunkSize);\n if (chunkCapacity >= maxQueueCapacity) {\n throw new IllegalArgumentException(\n \"Initial capacity cannot exceed maximum capacity(both rounded up to a power of 2)\");\n }\n\n long mask = chunkCapacity - 1;\n // need extra element to point at next array\n E[] buffer = allocate(chunkCapacity + 1);\n producerBuffer = buffer;\n producerMask = mask;\n consumerBuffer = buffer;\n consumerMask = mask;\n producerBufferLimit = mask - 1; // we know it's all empty to start with\n producerQueueLimit = maxQueueCapacity;\n soProducerIndex(0L);// serves as a StoreStore barrier to support correct publication\n }\n\n @Override\n protected final boolean offerColdPath(E[] buffer, long mask, E e, long pIndex, long offset) {\n // use a fixed lookahead step based on buffer capacity\n final long lookAheadStep = (mask + 1) / 4;\n long pBufferLimit = pIndex + lookAheadStep;\n\n long pQueueLimit = producerQueueLimit;\n\n if (pIndex >= pQueueLimit) {\n // we tested against a potentially out of date queue limit, refresh it\n long cIndex = lvConsumerIndex();\n producerQueueLimit = pQueueLimit = cIndex + maxQueueCapacity;\n // if we're full we're full\n if (pIndex >= pQueueLimit) {\n return false;\n }\n }\n // if buffer limit is after queue limit we use queue limit. We need to handle overflow so\n // cannot use Math.min\n if (pBufferLimit - pQueueLimit > 0) {\n pBufferLimit = pQueueLimit;\n }\n\n // go around the buffer or add a new buffer\n if (pBufferLimit > pIndex + 1 && // there's sufficient room in buffer/queue to use pBufferLimit\n null == lvElement(buffer, calcElementOffset(pBufferLimit, mask))) {\n producerBufferLimit = pBufferLimit - 1; // joy, there's plenty of room\n writeToQueue(buffer, e, pIndex, offset);\n }\n else if (null == lvElement(buffer, calcElementOffset(pIndex + 1, mask))) { // buffer is not full\n writeToQueue(buffer, e, pIndex, offset);\n }\n else {\n // we got one slot left to write into, and we are not full. Need to link new buffer.\n // allocate new buffer of same length\n final E[] newBuffer = allocate((int)(mask + 2));\n producerBuffer = newBuffer;\n\n linkOldToNew(pIndex, buffer, offset, newBuffer, offset, e);\n }\n return true;\n }\n\n}\n"},"meta":{"kind":"string","value":"{\n \"content_hash\": \"85b49924674b04d009b36289f5c05af5\",\n \"timestamp\": \"\",\n \"source\": \"github\",\n \"line_count\": 101,\n \"max_line_length\": 104,\n \"avg_line_length\": 41.62376237623762,\n \"alnum_prop\": 0.6527117031398668,\n \"repo_name\": \"franz1981/JCTools\",\n \"id\": \"9a581f5992eed880e2018ac27f153f5fc2538b6b\",\n \"size\": \"4204\",\n \"binary\": false,\n \"copies\": \"1\",\n \"ref\": \"refs/heads/master\",\n \"path\": \"jctools-core/src/main/java/org/jctools/queues/SpscChunkedArrayQueue.java\",\n \"mode\": \"33188\",\n \"license\": \"apache-2.0\",\n \"language\": [\n {\n \"name\": \"Java\",\n \"bytes\": \"1120334\"\n }\n ],\n \"symlink_target\": \"\"\n}"}}},{"rowIdx":357,"cells":{"text":{"kind":"string","value":"extern crate sdl2;\n\nfn main() {\n // start sdl2\n\n let ctx = sdl2::init().unwrap();\n let video_ctx = ctx.video().unwrap();\n let mut timer = ctx.timer().unwrap();\n\n // Create a window\n\n let mut window = match video_ctx.window(\"eg01\", 640, 480).position_centered().opengl().build() {\n Ok(window) => window,\n Err(err) => panic!(\"failed to create window: {}\", err)\n };\n\n // Display the window for 3 seconds\n\n window.show();\n timer.delay(3000);\n}\n\n"},"meta":{"kind":"string","value":"{\n \"content_hash\": \"2959eeec69ef058b34199f6e96faa826\",\n \"timestamp\": \"\",\n \"source\": \"github\",\n \"line_count\": 22,\n \"max_line_length\": 100,\n \"avg_line_length\": 22.136363636363637,\n \"alnum_prop\": 0.5749486652977412,\n \"repo_name\": \"jdeseno/rs-sdl2-examples\",\n \"id\": \"fb4c7489358083ffad8e590f63ac6f74d9e2b31f\",\n \"size\": \"487\",\n \"binary\": false,\n \"copies\": \"1\",\n \"ref\": \"refs/heads/master\",\n \"path\": \"src/eg01.rs\",\n \"mode\": \"33188\",\n \"license\": \"mit\",\n \"language\": [\n {\n \"name\": \"Rust\",\n \"bytes\": \"6552\"\n }\n ],\n \"symlink_target\": \"\"\n}"}}},{"rowIdx":358,"cells":{"text":{"kind":"string","value":"import numpy as np\nimport os\nimport sys\nimport matplotlib.pyplot as plt\nimport json\nfrom mpl_toolkits.mplot3d import Axes3D\n\n#sys.path.append(os.path.join(os.path.dirname(__file__),\"../\"))\nfrom crowdsourcing.interfaces.mechanical_turk import *\nfrom crowdsourcing.interfaces.local_webserver import *\nfrom crowdsourcing.util.image_search import *\nfrom crowdsourcing.annotation_types.classification import *\nfrom crowdsourcing.annotation_types.bbox import *\nfrom crowdsourcing.annotation_types.part import *\n\n# directory containing the images we want to annotate\nIMAGE_DIR = 'data/classification/imagenet'\n\nOUTPUT_FOLDER = 'ImageNet4'\n\nUSE_MTURK = True\nONLINE = True\nWORKERS_PER_IMAGE = 0\n\nwith open('keys.json') as f: keys = json.load(f)\n\n# Amazon account information for paying for mturk tasks, see \n# http://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSGettingStartedGuide/AWSCredentials.htm\nAWS_ACCESS_KEY = keys.AWS_ACCESS_KEY\nAWS_SECRET_ACCESS_KEY = AWS_SECRET_ACCESS_KEY\nSANDBOX = False\n\n# API key for Flickr image search, see https://www.flickr.com/services/api/misc.api_keys.html\nFLICKR_API_KEY = keys.FLICKR_API_KEY\nFLICKR_API_SECRET_KEY = keys.FLICKR_API_SECRET_KEY\nMAX_PHOTOS = 4000\n\nHOST = 'sbranson.no-ip.org'\n\n\n# The name of the objects we want to collect. Images will be obtained by crawling flickr\n# image search for each object, and we want to use mturk to filter out images that\n# don't contain the object of interest\nCLASSES = [ { 'object_name' : 'beaker', 'definition' : 'A flatbottomed jar made of glass or plastic; used for chemistry', 'search' : ['beaker', 'beaker chemistry', 'beaker lab'], 'wikipedia_url' : 'https://en.wikipedia.org/wiki/Beaker_(glassware)', 'example_image_urls' : ['http://imagenet.stanford.edu/nodes/12/02815834/99/998d93ef3fdd9a30034cda8f0ce246b7bb13ebc4.thumb', 'http://imagenet.stanford.edu/nodes/12/02815834/51/5171dde0d020b00923d4297d88d427326846efb2.thumb', 'http://imagenet.stanford.edu/nodes/12/02815834/d0/d06ccaf38a410e0b59bfe73819eb7bd0028bb8f1.thumb', 'https://sbranson.no-ip.org/online_crowdsourcing/not_beaker.jpg' ] },\n { 'object_name' : 'scorpion', 'definition' : 'Arachnid of warm dry regions having a long segmented tail ending in a venomous stinger', 'search' : ['scorpion', 'scorpion arachnid'], 'wikipedia_url' : 'https://en.wikipedia.org/wiki/Scorpion', 'example_image_urls' : ['http://imagenet.stanford.edu/nodes/2/01770393/b0/b02dcf2c1d8c7a735b52ab74300c342124e4be5c.thumb', 'http://imagenet.stanford.edu/nodes/2/01770393/31/31af6ea97dd040ec2ddd6ae86fe1f601ecfc8c02.thumb', 'http://imagenet.stanford.edu/nodes/2/01770393/38/382e998365d5667fc333a7c8f5f6e74e3c1fe164.thumb', 'http://imagenet.stanford.edu/nodes/2/01770393/88/88bc0f14c9779fad2bc364f5f4d8269d452e26c2.thumb'] },\n { 'object_name' : 'apiary', 'definition' : 'A shed containing a number of beehives', 'search' : ['apiary'], 'wikipedia_url' : 'https://en.wikipedia.org/wiki/Apiary', 'example_image_urls' : ['http://imagenet.stanford.edu/nodes/10/02727426/1f/1f6f71add82d10edad8b3630ec26490055c70a5d.thumb', 'http://imagenet.stanford.edu/nodes/10/02727426/94/94a3624ff3e639fe2d8ae836e91ca7e8fcdd0ed7.thumb', 'http://imagenet.stanford.edu/nodes/10/02727426/15/15a37da46bddd5010d3f1d1996899b8472c9556b.thumb', 'http://imagenet.stanford.edu/nodes/10/02727426/01/013b499a063b6ea83218c5ed63ea811bce5a9974.thumb'] },\n { 'object_name' : 'cardigan', 'definition' : 'Knitted jacket that is fastened up the front with buttons or a zipper', 'search' : ['cardigan'], 'wikipedia_url' : 'https://en.wikipedia.org/wiki/Cardigan_(sweater)', 'example_image_urls' : ['http://imagenet.stanford.edu/nodes/9/02963159/d7/d7419041a96e8baf9a870c81d549ad0b345c8127.thumb', 'http://imagenet.stanford.edu/nodes/9/02963159/34/34256aaf7b10073ec16dc5ddb0b31305878de875.thumb', 'http://imagenet.stanford.edu/nodes/9/02963159/e8/e8a50045dd40da5299ee8817052edfc090b05355.thumb', 'http://imagenet.stanford.edu/nodes/9/02963159/38/38216bf40fafe4bb526fabb430188c24b968a152.thumb'] } \n ]\n\nfor c in CLASSES:\n # directories to store images and results\n output_folder = os.path.join(OUTPUT_FOLDER, c['object_name'])\n image_folder = os.path.join('output', output_folder, 'flickr')\n if not os.path.exists(image_folder):\n os.makedirs(image_folder)\n \n # Download images from Flickr\n FlickrImageSearch(c['search'], image_folder, FLICKR_API_KEY, FLICKR_API_SECRET_KEY, max_photos=MAX_PHOTOS)\n\n # Load an unlabelled dataset by scanning a directory of images\n dataset = CrowdDatasetBinaryClassification(name=c['object_name'])\n dataset.scan_image_directory(os.path.join(image_folder, 'images'))\n\n if USE_MTURK:\n crowdsource = MTurkCrowdsourcer(dataset, AWS_ACCESS_KEY, AWS_SECRET_ACCESS_KEY, HOST, output_folder, sandbox=SANDBOX,\n hit_params = c, online = ONLINE, thumbnail_size = (100,100), initial_assignments_per_image=WORKERS_PER_IMAGE)\n else:\n crowdsource = LocalCrowdsourcer(dataset, HOST, output_folder, hit_params = c, online = ONLINE, thumbnail_size = (100,100), initial_assignments_per_image=WORKERS_PER_IMAGE, port=8080)\n crowdsource.run()\n\n"},"meta":{"kind":"string","value":"{\n \"content_hash\": \"f5401d1cf82b1db8149333eb79cd82be\",\n \"timestamp\": \"\",\n \"source\": \"github\",\n \"line_count\": 70,\n \"max_line_length\": 675,\n \"avg_line_length\": 73.37142857142857,\n \"alnum_prop\": 0.7610981308411215,\n \"repo_name\": \"sbranson/online_crowdsourcing\",\n \"id\": \"9353ada9e3fba211f9f107c0a3fd4e8811908e3a\",\n \"size\": \"5136\",\n \"binary\": false,\n \"copies\": \"1\",\n \"ref\": \"refs/heads/master\",\n \"path\": \"experiments/collect_annotations_imagenet3.py\",\n \"mode\": \"33188\",\n \"license\": \"mit\",\n \"language\": [\n {\n \"name\": \"HTML\",\n \"bytes\": \"15706\"\n },\n {\n \"name\": \"Python\",\n \"bytes\": \"444456\"\n }\n ],\n \"symlink_target\": \"\"\n}"}}},{"rowIdx":359,"cells":{"text":{"kind":"string","value":"if VERSION < v\"0.4.0-dev\"\n Base.copy{T,A,uplo}(t::Triangular{T,A,uplo}) = Triangular(copy(t.data), uplo)\n typealias AbstractTriangular Triangular\n typealias UpperTriangular{T,M} Triangular{T,M,:U,false}\n set_zero_subnormals(yes::Bool) = ccall(:jl_zero_subnormals, Bool, (Bool,), yes)\nelse\n import Base.LinAlg.AbstractTriangular\nend\n\n## this we need for xμTΛxμ!\n#Base.A_mul_Bc!(A::StridedMatrix{Float64}, B::AbstractTriangular{Float32}) = A_mul_Bc!(A, convert(AbstractMatrix{Float64}, B))\n#Base.A_mul_Bc!(A::Matrix{Float32}, B::AbstractTriangular{Float64}) = A_mul_Bc!(A, convert(AbstractMatrix{Float32}, B))\n## this for diagstats\n#Base.BLAS.gemm!(a::Char, b::Char, alpha::Float64, A::Matrix{Float32}, B::Matrix{Float64}, beta::Float64, C::Matrix{Float64}) = Base.BLAS.gemm!(a, b, alpha, float64(A), B, beta, C)\n"},"meta":{"kind":"string","value":"{\n \"content_hash\": \"cfbd5a0a273bc7ea5e858504eea5b5f7\",\n \"timestamp\": \"\",\n \"source\": \"github\",\n \"line_count\": 14,\n \"max_line_length\": 180,\n \"avg_line_length\": 59,\n \"alnum_prop\": 0.7046004842615012,\n \"repo_name\": \"tkelman/GaussianMixtures.jl\",\n \"id\": \"a58ec080d64c601d0f7041c7465f2efa0c8b84ae\",\n \"size\": \"863\",\n \"binary\": false,\n \"copies\": \"1\",\n \"ref\": \"refs/heads/master\",\n \"path\": \"src/compat.jl\",\n \"mode\": \"33188\",\n \"license\": \"mit\",\n \"language\": [\n {\n \"name\": \"Julia\",\n \"bytes\": \"58967\"\n }\n ],\n \"symlink_target\": \"\"\n}"}}},{"rowIdx":360,"cells":{"text":{"kind":"string","value":"name 'test_java'\nmaintainer 'test cookbook'\nlicense 'All rights reserved'\ndescription 'A test cookbook to land testing jar for java cookbook'\nversion '0.1.0'\n"},"meta":{"kind":"string","value":"{\n \"content_hash\": \"7f40aca32c6a717fffb2dd37942a2dea\",\n \"timestamp\": \"\",\n \"source\": \"github\",\n \"line_count\": 5,\n \"max_line_length\": 72,\n \"avg_line_length\": 39.8,\n \"alnum_prop\": 0.6180904522613065,\n \"repo_name\": \"kruzda/elasticsearch\",\n \"id\": \"38d8b72fa1ac7dcc683d022218ffde2fd8dcc7bf\",\n \"size\": \"199\",\n \"binary\": false,\n \"copies\": \"3\",\n \"ref\": \"refs/heads/master\",\n \"path\": \"cookbooks/java/test/fixtures/cookbooks/test_java/metadata.rb\",\n \"mode\": \"33188\",\n \"license\": \"apache-2.0\",\n \"language\": [\n {\n \"name\": \"HTML\",\n \"bytes\": \"55551\"\n },\n {\n \"name\": \"Java\",\n \"bytes\": \"1162\"\n },\n {\n \"name\": \"Python\",\n \"bytes\": \"3210\"\n },\n {\n \"name\": \"Ruby\",\n \"bytes\": \"504466\"\n },\n {\n \"name\": \"Shell\",\n \"bytes\": \"36394\"\n }\n ],\n \"symlink_target\": \"\"\n}"}}},{"rowIdx":361,"cells":{"text":{"kind":"string","value":"using System;\r\nusing System.Collections.Generic;\r\nusing System.Data.Entity;\r\nusing System.Data.Entity.ModelConfiguration.Conventions;\r\nusing System.Linq;\r\nusing System.Web;\r\n\r\nnamespace AThousandCounts.Models\r\n{\r\n public class CountContext : DbContext\r\n {\r\n public CountContext() : base(\"AzureSqlConnection\")\r\n {\r\n }\r\n\r\n public DbSet Counts { get; set; }\r\n\r\n protected override void OnModelCreating(DbModelBuilder modelBuilder)\r\n {\r\n modelBuilder.Conventions.Remove();\r\n }\r\n }\r\n}"},"meta":{"kind":"string","value":"{\n \"content_hash\": \"6f65cdc27e0c094aa28c5121598ba9fd\",\n \"timestamp\": \"\",\n \"source\": \"github\",\n \"line_count\": 23,\n \"max_line_length\": 78,\n \"avg_line_length\": 25.782608695652176,\n \"alnum_prop\": 0.6677908937605397,\n \"repo_name\": \"erooijak/athousandcounts\",\n \"id\": \"6ff77c6adbc3a13c527ddf46738b508ca5e5f217\",\n \"size\": \"595\",\n \"binary\": false,\n \"copies\": \"1\",\n \"ref\": \"refs/heads/master\",\n \"path\": \"AThousandCounts/Models/CountContext.cs\",\n \"mode\": \"33188\",\n \"license\": \"mit\",\n \"language\": [\n {\n \"name\": \"ASP\",\n \"bytes\": \"107\"\n },\n {\n \"name\": \"C#\",\n \"bytes\": \"41186\"\n },\n {\n \"name\": \"CSS\",\n \"bytes\": \"549427\"\n },\n {\n \"name\": \"JavaScript\",\n \"bytes\": \"205317\"\n },\n {\n \"name\": \"Ruby\",\n \"bytes\": \"270\"\n }\n ],\n \"symlink_target\": \"\"\n}"}}},{"rowIdx":362,"cells":{"text":{"kind":"string","value":"\n#ifndef INTEGRATOR_HPP\n#define INTEGRATOR_HPP\n#include \"../rhs/rhs.h\"\n#include \"../engine/item.h\"\n#include \"engine/item_dim.h\"\n#include \"utils/vartype.hpp\"\n#include \"utils/ptr_passer.hpp\"\n//!This class defines the integration base class\n/*!\n * This class defines the base integration class, the interface that is used by\n * the engine to integrate differential equations\n */\nclass integrator:public item_dim, public vartype{\n protected:\n rhs* rh_val;\n std::shared_ptr actual;\n public:\n virtual void initial_condition(ptr_passer in, size_t len);\n inline void initial_condition(ptr_passer in){\n initial_condition(in, dimension);\n }\n virtual void postprocess(input& inval);\n virtual std::vector dependencies() const;\n //!returns the vtype of the actual integrator. Expect infinite loop if implementation doesn't override\n virtual const std::type_info& vtype() const;\n\n //!Integrates the function rh\n /*!\n * This function integrates the equation du/dt=rh->dxdt(u) from t0 to tf\n * @param rh The function being integrated\n * @param u A pointer to the initial condition, also stores the final condition\n * @param t0 The initial time\n * @param tf The ending time\n *\n * The default definition calls the integrator of the actual type.\n * If this isn't overridden, expect an infinite loop\n */\n virtual int integrate(ptr_passer u, double t0, double tf);\n //!Blank destructor for integrator\n virtual ~integrator(){}\n};\n\n#endif\n"},"meta":{"kind":"string","value":"{\n \"content_hash\": \"c95a92a0a1f70bade563ba61515c98e8\",\n \"timestamp\": \"\",\n \"source\": \"github\",\n \"line_count\": 44,\n \"max_line_length\": 110,\n \"avg_line_length\": 37,\n \"alnum_prop\": 0.6597051597051597,\n \"repo_name\": \"UW-Kutz-Lab/lilac\",\n \"id\": \"820433e12a89c3c1ebc46a4792870efc10fa613f\",\n \"size\": \"3182\",\n \"binary\": false,\n \"copies\": \"1\",\n \"ref\": \"refs/heads/master\",\n \"path\": \"src/integrator/integrator.h\",\n \"mode\": \"33188\",\n \"license\": \"bsd-3-clause\",\n \"language\": [\n {\n \"name\": \"C\",\n \"bytes\": \"21958\"\n },\n {\n \"name\": \"C++\",\n \"bytes\": \"439116\"\n },\n {\n \"name\": \"Haskell\",\n \"bytes\": \"2848\"\n },\n {\n \"name\": \"Python\",\n \"bytes\": \"73538\"\n },\n {\n \"name\": \"Shell\",\n \"bytes\": \"2777\"\n }\n ],\n \"symlink_target\": \"\"\n}"}}},{"rowIdx":363,"cells":{"text":{"kind":"string","value":"ACCEPTED\n\n#### According to\nIndex Fungorum\n\n#### Published in\nnull\n\n#### Original name\nGlonium lineare f. angustissimum De Not.\n\n### Remarks\nnull"},"meta":{"kind":"string","value":"{\n \"content_hash\": \"00393e36c4e82decc610cf73c0a1942e\",\n \"timestamp\": \"\",\n \"source\": \"github\",\n \"line_count\": 13,\n \"max_line_length\": 40,\n \"avg_line_length\": 11.153846153846153,\n \"alnum_prop\": 0.7103448275862069,\n \"repo_name\": \"mdoering/backbone\",\n \"id\": \"968522aecc2984e7dadb2b6795606621df8fdbe0\",\n \"size\": \"206\",\n \"binary\": false,\n \"copies\": \"1\",\n \"ref\": \"refs/heads/master\",\n \"path\": \"life/Fungi/Ascomycota/Dothideomycetes/Hysteriales/Hysteriaceae/Glonium/Glonium lineare/Glonium lineare angustissimum/README.md\",\n \"mode\": \"33188\",\n \"license\": \"apache-2.0\",\n \"language\": [],\n \"symlink_target\": \"\"\n}"}}},{"rowIdx":364,"cells":{"text":{"kind":"string","value":"/*global loadFixtures: true, waits:true, beforeEach: true, it: true, expect: true, describe:true, spyOn: true, white: true, vars: true, jQuery:true, $:true*/\n/*jslint browser: true, devel: true, bitwise: true, debug: true, nomen: true, sloppy: false, indent: 2*/\n\ndescribe(\"Array Prototypes\", function () {\n \"use strict\";\n\n beforeEach(function () {\n });\n\n});\n"},"meta":{"kind":"string","value":"{\n \"content_hash\": \"c6ff425494a960bf6eeb0aabb7d196a8\",\n \"timestamp\": \"\",\n \"source\": \"github\",\n \"line_count\": 10,\n \"max_line_length\": 157,\n \"avg_line_length\": 36.2,\n \"alnum_prop\": 0.6740331491712708,\n \"repo_name\": \"dperrymorrow/lil-p\",\n \"id\": \"edf7b361e3644c0faa4f90df3e6b718024325d1a\",\n \"size\": \"362\",\n \"binary\": false,\n \"copies\": \"1\",\n \"ref\": \"refs/heads/master\",\n \"path\": \"tests/ArraySpec.js\",\n \"mode\": \"33188\",\n \"license\": \"mit\",\n \"language\": [\n {\n \"name\": \"JavaScript\",\n \"bytes\": \"19690\"\n }\n ],\n \"symlink_target\": \"\"\n}"}}},{"rowIdx":365,"cells":{"text":{"kind":"string","value":"\"\"\"This application demonstrates how to perform basic operations with the\nGoogle Cloud Translate API\n\nFor more information, the documentation at\nhttps://cloud.google.com/translate/docs.\n\"\"\"\n\nimport argparse\n\nfrom google.cloud import translate\nimport six\n\n\ndef detect_language(text):\n \"\"\"Detects the text's language.\"\"\"\n translate_client = translate.Client()\n\n # Text can also be a sequence of strings, in which case this method\n # will return a sequence of results for each text.\n result = translate_client.detect_language(text)\n\n print('Text: {}'.format(text))\n print('Confidence: {}'.format(result['confidence']))\n print('Language: {}'.format(result['language']))\n\n\ndef list_languages():\n \"\"\"Lists all available languages.\"\"\"\n translate_client = translate.Client()\n\n results = translate_client.get_languages()\n\n for language in results:\n print(u'{name} ({language})'.format(**language))\n\n\ndef list_languages_with_target(target):\n \"\"\"Lists all available languages and localizes them to the target language.\n\n Target must be an ISO 639-1 language code.\n See https://g.co/cloud/translate/v2/translate-reference#supported_languages\n \"\"\"\n translate_client = translate.Client()\n\n results = translate_client.get_languages(target_language=target)\n\n for language in results:\n print(u'{name} ({language})'.format(**language))\n\n\ndef translate_text_with_model(target, text, model=translate.NMT):\n \"\"\"Translates text into the target language.\n\n Make sure your project is whitelisted.\n\n Target must be an ISO 639-1 language code.\n See https://g.co/cloud/translate/v2/translate-reference#supported_languages\n \"\"\"\n translate_client = translate.Client()\n\n if isinstance(text, six.binary_type):\n text = text.decode('utf-8')\n\n # Text can also be a sequence of strings, in which case this method\n # will return a sequence of results for each text.\n result = translate_client.translate(\n text, target_language=target, model=model)\n\n print(u'Text: {}'.format(result['input']))\n print(u'Translation: {}'.format(result['translatedText']))\n print(u'Detected source language: {}'.format(\n result['detectedSourceLanguage']))\n\n\ndef translate_text(target, text):\n \"\"\"Translates text into the target language.\n\n Target must be an ISO 639-1 language code.\n See https://g.co/cloud/translate/v2/translate-reference#supported_languages\n \"\"\"\n translate_client = translate.Client()\n\n if isinstance(text, six.binary_type):\n text = text.decode('utf-8')\n\n # Text can also be a sequence of strings, in which case this method\n # will return a sequence of results for each text.\n result = translate_client.translate(\n text, target_language=target)\n\n print(u'Text: {}'.format(result['input']))\n print(u'Translation: {}'.format(result['translatedText']))\n print(u'Detected source language: {}'.format(\n result['detectedSourceLanguage']))\n\n\nif __name__ == '__main__':\n parser = argparse.ArgumentParser(\n description=__doc__,\n formatter_class=argparse.RawDescriptionHelpFormatter)\n subparsers = parser.add_subparsers(dest='command')\n\n detect_langage_parser = subparsers.add_parser(\n 'detect-language', help=detect_language.__doc__)\n detect_langage_parser.add_argument('text')\n\n list_languages_parser = subparsers.add_parser(\n 'list-languages', help=list_languages.__doc__)\n\n list_languages_with_target_parser = subparsers.add_parser(\n 'list-languages-with-target', help=list_languages_with_target.__doc__)\n list_languages_with_target_parser.add_argument('target')\n\n translate_text_parser = subparsers.add_parser(\n 'translate-text', help=translate_text.__doc__)\n translate_text_parser.add_argument('target')\n translate_text_parser.add_argument('text')\n\n args = parser.parse_args()\n\n if args.command == 'detect-language':\n detect_language(args.text)\n elif args.command == 'list-languages':\n list_languages()\n elif args.command == 'list-languages-with-target':\n list_languages_with_target(args.target)\n elif args.command == 'translate-text':\n translate_text(args.target, args.text)\n"},"meta":{"kind":"string","value":"{\n \"content_hash\": \"bd15ed9ab28536f5318f5c3b79b14878\",\n \"timestamp\": \"\",\n \"source\": \"github\",\n \"line_count\": 128,\n \"max_line_length\": 79,\n \"avg_line_length\": 33.109375,\n \"alnum_prop\": 0.6882963662104766,\n \"repo_name\": \"sharbison3/python-docs-samples\",\n \"id\": \"91aef63d5c849f7a804e892742b330c9f01bb9c3\",\n \"size\": \"4837\",\n \"binary\": false,\n \"copies\": \"4\",\n \"ref\": \"refs/heads/master\",\n \"path\": \"translate/cloud-client/snippets.py\",\n \"mode\": \"33188\",\n \"license\": \"apache-2.0\",\n \"language\": [\n {\n \"name\": \"CSS\",\n \"bytes\": \"2924\"\n },\n {\n \"name\": \"HTML\",\n \"bytes\": \"26110\"\n },\n {\n \"name\": \"JavaScript\",\n \"bytes\": \"11222\"\n },\n {\n \"name\": \"Makefile\",\n \"bytes\": \"881\"\n },\n {\n \"name\": \"Python\",\n \"bytes\": \"994536\"\n },\n {\n \"name\": \"Shell\",\n \"bytes\": \"9331\"\n }\n ],\n \"symlink_target\": \"\"\n}"}}},{"rowIdx":366,"cells":{"text":{"kind":"string","value":"\n\t4.0.0\n\torg.ablx\n\tcurrency-ws-client\n\t0.0.1-SNAPSHOT\n\thttps://github.com/mikrethor/currency-ws-client\n\t\n\t\t\n\t\t\tXavier Bouclet\n\t\t\tmikrethor@gmail.com\n\t\t\n\t\n\t\n\t\t\n\t\t\torg.springframework.ws\n\t\t\tspring-ws-core\n\t\t\t2.2.4.RELEASE\n\t\t\n\t\t\n\t\t\torg.springframework\n\t\t\tspring-aop\n\t\t\t4.2.4.RELEASE\n\t\t\n\t\t\n\t\t\torg.springframework\n\t\t\tspring-aspects\n\t\t\t4.2.4.RELEASE\n\t\t\n\t\t\n\t\t\torg.springframework\n\t\t\tspring-beans\n\t\t\t4.2.4.RELEASE\n\t\t\n\t\t\n\t\t\torg.springframework\n\t\t\tspring-context\n\t\t\t4.2.4.RELEASE\n\t\t\n\t\t\n\t\t\torg.springframework\n\t\t\tspring-context-support\n\t\t\t4.2.4.RELEASE\n\t\t\n\t\t\n\t\t\tjunit\n\t\t\tjunit\n\t\t\t4.12\n\t\t\ttest\n\t\t\n\t\t\n\t\t\torg.springframework\n\t\t\tspring-core\n\t\t\t4.2.4.RELEASE\n\t\t\n\t\n\n\t\n\t\t\n\t\t\t\n\t\t\t\torg.codehaus.mojo\n\t\t\t\tjaxb2-maven-plugin\n\t\t\t\t1.5\n\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\txjc\n\t\t\t\t\t\t\n\t\t\t\t\t\t\txjc\n\t\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\torg.ablx.currency.wsdl.binding\n\t\t\t\t\t\n\t\t\t\t\ttrue\n\t\t\t\t\t\n\t\t\t\t\tfalse\n\t\t\t\t\t\n\t\t\t\t\tCurrencyConvertor.wsdl\n\t\t\t\t\t\n\t\t\t\t\t${project.basedir}/src/main/resources\n\t\t\t\t\t\n\t\t\t\t\t${project.basedir}/src/main/java\n\t\t\t\t\t\n\t\t\t\t\tfalse\n\t\t\t\t\n\t\t\t\n\t\t\n\t\n"},"meta":{"kind":"string","value":"{\n \"content_hash\": \"75a801e5599a3be338953096c6a791da\",\n \"timestamp\": \"\",\n \"source\": \"github\",\n \"line_count\": 91,\n \"max_line_length\": 104,\n \"avg_line_length\": 31.582417582417584,\n \"alnum_prop\": 0.6826722338204593,\n \"repo_name\": \"mikrethor/samples\",\n \"id\": \"6e174aa096010865942bb233fec7c8c81a034330\",\n \"size\": \"2874\",\n \"binary\": false,\n \"copies\": \"1\",\n \"ref\": \"refs/heads/master\",\n \"path\": \"currency-ws-client/pom.xml\",\n \"mode\": \"33188\",\n \"license\": \"apache-2.0\",\n \"language\": [\n {\n \"name\": \"Java\",\n \"bytes\": \"18962\"\n }\n ],\n \"symlink_target\": \"\"\n}"}}},{"rowIdx":367,"cells":{"text":{"kind":"string","value":"package com.google.common.util.concurrent;\n\n\n\n\npublic abstract class AbstractExecutionThreadService\n implements com.google.common.base.Service\n{\n // Constructors\n\n public AbstractExecutionThreadService(){\n }\n // Methods\n\n protected abstract void run() throws java.lang.Exception;\n public java.lang.String toString(){\n return (java.lang.String) null;\n }\n public final java.util.concurrent.Future start(){\n return (java.util.concurrent.Future) null;\n }\n public final java.util.concurrent.Future stop(){\n return (java.util.concurrent.Future) null;\n }\n public final com.google.common.base.Service.State state(){\n return (com.google.common.base.Service.State) null;\n }\n public final boolean isRunning(){\n return false;\n }\n protected void startUp() throws java.lang.Exception{\n }\n protected void shutDown() throws java.lang.Exception{\n }\n protected void triggerShutdown(){\n }\n protected java.util.concurrent.Executor executor(){\n return (java.util.concurrent.Executor) null;\n }\n public final com.google.common.base.Service.State startAndWait(){\n return (com.google.common.base.Service.State) null;\n }\n public final com.google.common.base.Service.State stopAndWait(){\n return (com.google.common.base.Service.State) null;\n }\n}\n"},"meta":{"kind":"string","value":"{\n \"content_hash\": \"50df6f1026bc4887f44bfbbe02e40c0b\",\n \"timestamp\": \"\",\n \"source\": \"github\",\n \"line_count\": 46,\n \"max_line_length\": 89,\n \"avg_line_length\": 29.282608695652176,\n \"alnum_prop\": 0.7371937639198218,\n \"repo_name\": \"Orange-OpenSource/matos-profiles\",\n \"id\": \"1f2bb7e1fc31ba25fc35810a390e9fa12ed78bff\",\n \"size\": \"2008\",\n \"binary\": false,\n \"copies\": \"1\",\n \"ref\": \"refs/heads/master\",\n \"path\": \"matos-android/src/main/java/com/google/common/util/concurrent/AbstractExecutionThreadService.java\",\n \"mode\": \"33188\",\n \"license\": \"apache-2.0\",\n \"language\": [\n {\n \"name\": \"Java\",\n \"bytes\": \"13536133\"\n }\n ],\n \"symlink_target\": \"\"\n}"}}},{"rowIdx":368,"cells":{"text":{"kind":"string","value":"\n\n// Code generated by client-gen. DO NOT EDIT.\n\npackage v1\n\nimport (\n\t\"context\"\n\t\"time\"\n\n\tv1 \"k8s.io/api/admissionregistration/v1\"\n\tmetav1 \"k8s.io/apimachinery/pkg/apis/meta/v1\"\n\ttypes \"k8s.io/apimachinery/pkg/types\"\n\twatch \"k8s.io/apimachinery/pkg/watch\"\n\tscheme \"k8s.io/client-go/kubernetes/scheme\"\n\trest \"k8s.io/client-go/rest\"\n)\n\n// MutatingWebhookConfigurationsGetter has a method to return a MutatingWebhookConfigurationInterface.\n// A group's client should implement this interface.\ntype MutatingWebhookConfigurationsGetter interface {\n\tMutatingWebhookConfigurations() MutatingWebhookConfigurationInterface\n}\n\n// MutatingWebhookConfigurationInterface has methods to work with MutatingWebhookConfiguration resources.\ntype MutatingWebhookConfigurationInterface interface {\n\tCreate(ctx context.Context, mutatingWebhookConfiguration *v1.MutatingWebhookConfiguration, opts metav1.CreateOptions) (*v1.MutatingWebhookConfiguration, error)\n\tUpdate(ctx context.Context, mutatingWebhookConfiguration *v1.MutatingWebhookConfiguration, opts metav1.UpdateOptions) (*v1.MutatingWebhookConfiguration, error)\n\tDelete(ctx context.Context, name string, opts *metav1.DeleteOptions) error\n\tDeleteCollection(ctx context.Context, opts *metav1.DeleteOptions, listOpts metav1.ListOptions) error\n\tGet(ctx context.Context, name string, opts metav1.GetOptions) (*v1.MutatingWebhookConfiguration, error)\n\tList(ctx context.Context, opts metav1.ListOptions) (*v1.MutatingWebhookConfigurationList, error)\n\tWatch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error)\n\tPatch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.MutatingWebhookConfiguration, err error)\n\tMutatingWebhookConfigurationExpansion\n}\n\n// mutatingWebhookConfigurations implements MutatingWebhookConfigurationInterface\ntype mutatingWebhookConfigurations struct {\n\tclient rest.Interface\n}\n\n// newMutatingWebhookConfigurations returns a MutatingWebhookConfigurations\nfunc newMutatingWebhookConfigurations(c *AdmissionregistrationV1Client) *mutatingWebhookConfigurations {\n\treturn &mutatingWebhookConfigurations{\n\t\tclient: c.RESTClient(),\n\t}\n}\n\n// Get takes name of the mutatingWebhookConfiguration, and returns the corresponding mutatingWebhookConfiguration object, and an error if there is any.\nfunc (c *mutatingWebhookConfigurations) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.MutatingWebhookConfiguration, err error) {\n\tresult = &v1.MutatingWebhookConfiguration{}\n\terr = c.client.Get().\n\t\tResource(\"mutatingwebhookconfigurations\").\n\t\tName(name).\n\t\tVersionedParams(&options, scheme.ParameterCodec).\n\t\tDo(ctx).\n\t\tInto(result)\n\treturn\n}\n\n// List takes label and field selectors, and returns the list of MutatingWebhookConfigurations that match those selectors.\nfunc (c *mutatingWebhookConfigurations) List(ctx context.Context, opts metav1.ListOptions) (result *v1.MutatingWebhookConfigurationList, err error) {\n\tvar timeout time.Duration\n\tif opts.TimeoutSeconds != nil {\n\t\ttimeout = time.Duration(*opts.TimeoutSeconds) * time.Second\n\t}\n\tresult = &v1.MutatingWebhookConfigurationList{}\n\terr = c.client.Get().\n\t\tResource(\"mutatingwebhookconfigurations\").\n\t\tVersionedParams(&opts, scheme.ParameterCodec).\n\t\tTimeout(timeout).\n\t\tDo(ctx).\n\t\tInto(result)\n\treturn\n}\n\n// Watch returns a watch.Interface that watches the requested mutatingWebhookConfigurations.\nfunc (c *mutatingWebhookConfigurations) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) {\n\tvar timeout time.Duration\n\tif opts.TimeoutSeconds != nil {\n\t\ttimeout = time.Duration(*opts.TimeoutSeconds) * time.Second\n\t}\n\topts.Watch = true\n\treturn c.client.Get().\n\t\tResource(\"mutatingwebhookconfigurations\").\n\t\tVersionedParams(&opts, scheme.ParameterCodec).\n\t\tTimeout(timeout).\n\t\tWatch(ctx)\n}\n\n// Create takes the representation of a mutatingWebhookConfiguration and creates it. Returns the server's representation of the mutatingWebhookConfiguration, and an error, if there is any.\nfunc (c *mutatingWebhookConfigurations) Create(ctx context.Context, mutatingWebhookConfiguration *v1.MutatingWebhookConfiguration, opts metav1.CreateOptions) (result *v1.MutatingWebhookConfiguration, err error) {\n\tresult = &v1.MutatingWebhookConfiguration{}\n\terr = c.client.Post().\n\t\tResource(\"mutatingwebhookconfigurations\").\n\t\tVersionedParams(&opts, scheme.ParameterCodec).\n\t\tBody(mutatingWebhookConfiguration).\n\t\tDo(ctx).\n\t\tInto(result)\n\treturn\n}\n\n// Update takes the representation of a mutatingWebhookConfiguration and updates it. Returns the server's representation of the mutatingWebhookConfiguration, and an error, if there is any.\nfunc (c *mutatingWebhookConfigurations) Update(ctx context.Context, mutatingWebhookConfiguration *v1.MutatingWebhookConfiguration, opts metav1.UpdateOptions) (result *v1.MutatingWebhookConfiguration, err error) {\n\tresult = &v1.MutatingWebhookConfiguration{}\n\terr = c.client.Put().\n\t\tResource(\"mutatingwebhookconfigurations\").\n\t\tName(mutatingWebhookConfiguration.Name).\n\t\tVersionedParams(&opts, scheme.ParameterCodec).\n\t\tBody(mutatingWebhookConfiguration).\n\t\tDo(ctx).\n\t\tInto(result)\n\treturn\n}\n\n// Delete takes name of the mutatingWebhookConfiguration and deletes it. Returns an error if one occurs.\nfunc (c *mutatingWebhookConfigurations) Delete(ctx context.Context, name string, options *metav1.DeleteOptions) error {\n\treturn c.client.Delete().\n\t\tResource(\"mutatingwebhookconfigurations\").\n\t\tName(name).\n\t\tBody(options).\n\t\tDo(ctx).\n\t\tError()\n}\n\n// DeleteCollection deletes a collection of objects.\nfunc (c *mutatingWebhookConfigurations) DeleteCollection(ctx context.Context, options *metav1.DeleteOptions, listOptions metav1.ListOptions) error {\n\tvar timeout time.Duration\n\tif listOptions.TimeoutSeconds != nil {\n\t\ttimeout = time.Duration(*listOptions.TimeoutSeconds) * time.Second\n\t}\n\treturn c.client.Delete().\n\t\tResource(\"mutatingwebhookconfigurations\").\n\t\tVersionedParams(&listOptions, scheme.ParameterCodec).\n\t\tTimeout(timeout).\n\t\tBody(options).\n\t\tDo(ctx).\n\t\tError()\n}\n\n// Patch applies the patch and returns the patched mutatingWebhookConfiguration.\nfunc (c *mutatingWebhookConfigurations) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.MutatingWebhookConfiguration, err error) {\n\tresult = &v1.MutatingWebhookConfiguration{}\n\terr = c.client.Patch(pt).\n\t\tResource(\"mutatingwebhookconfigurations\").\n\t\tName(name).\n\t\tSubResource(subresources...).\n\t\tVersionedParams(&opts, scheme.ParameterCodec).\n\t\tBody(data).\n\t\tDo(ctx).\n\t\tInto(result)\n\treturn\n}\n"},"meta":{"kind":"string","value":"{\n \"content_hash\": \"52ab2347163b5c082364c71705f2bd57\",\n \"timestamp\": \"\",\n \"source\": \"github\",\n \"line_count\": 154,\n \"max_line_length\": 217,\n \"avg_line_length\": 42.91558441558441,\n \"alnum_prop\": 0.7999697382357391,\n \"repo_name\": \"davidz627/kubernetes\",\n \"id\": \"e9787bf408f5894ebea978d3b665f50b13fc4119\",\n \"size\": \"7173\",\n \"binary\": false,\n \"copies\": \"6\",\n \"ref\": \"refs/heads/master\",\n \"path\": \"staging/src/k8s.io/client-go/kubernetes/typed/admissionregistration/v1/mutatingwebhookconfiguration.go\",\n \"mode\": \"33188\",\n \"license\": \"apache-2.0\",\n \"language\": [\n {\n \"name\": \"C\",\n \"bytes\": \"2840\"\n },\n {\n \"name\": \"Dockerfile\",\n \"bytes\": \"49820\"\n },\n {\n \"name\": \"Go\",\n \"bytes\": \"54599083\"\n },\n {\n \"name\": \"HTML\",\n \"bytes\": \"38\"\n },\n {\n \"name\": \"Lua\",\n \"bytes\": \"17200\"\n },\n {\n \"name\": \"Makefile\",\n \"bytes\": \"65536\"\n },\n {\n \"name\": \"PowerShell\",\n \"bytes\": \"118255\"\n },\n {\n \"name\": \"Python\",\n \"bytes\": \"23490\"\n },\n {\n \"name\": \"Ruby\",\n \"bytes\": \"413\"\n },\n {\n \"name\": \"Shell\",\n \"bytes\": \"1609250\"\n },\n {\n \"name\": \"Starlark\",\n \"bytes\": \"3806986\"\n },\n {\n \"name\": \"sed\",\n \"bytes\": \"1390\"\n }\n ],\n \"symlink_target\": \"\"\n}"}}},{"rowIdx":369,"cells":{"text":{"kind":"string","value":"require 'torch'\nrequire 'nn'\nrequire 'nngraph'\nrequire 'optim'\nrequire('pl.stringx').import()\nrequire 'pl.seq'\nrequire 'utils/SymbolsManager'\ninclude \"../utils/utils.lua\"\nlocal MinibatchLoader = require 'utils.MinibatchLoader'\n\nfunction transfer_data(x)\n if opt.gpuid>=0 then\n return x:cuda()\n end\n return x\nend\n\nfunction lstm(x, prev_c, prev_h)\n -- Calculate all four gates in one go\n local i2h = nn.Linear(opt.rnn_size, 4 * opt.rnn_size)(x)\n local h2h = nn.Linear(opt.rnn_size, 4 * opt.rnn_size)(prev_h)\n local gates = nn.CAddTable()({i2h, h2h})\n \n -- Reshape to (batch_size, n_gates, hid_size)\n -- Then slize the n_gates dimension\n local reshaped_gates = nn.Reshape(4, opt.rnn_size)(gates)\n local sliced_gates = nn.SplitTable(2)(reshaped_gates)\n \n -- Use select gate to fetch each gate and apply nonlinearity\n local in_gate = nn.Sigmoid()(nn.SelectTable(1)(sliced_gates)):annotate{name='in_gate'}\n local in_transform = nn.Tanh()(nn.SelectTable(2)(sliced_gates)):annotate{name='in_transform'}\n local forget_gate = nn.Sigmoid()(nn.SelectTable(3)(sliced_gates)):annotate{name='forget_gate'}\n local out_gate = nn.Sigmoid()(nn.SelectTable(4)(sliced_gates)):annotate{name='out_gate'}\n \n if opt.dropoutrec > 0 then\n in_transform = nn.Dropout(opt.dropoutrec)(in_transform)\n end\n\n local next_c = nn.CAddTable()({\n nn.CMulTable()({forget_gate, prev_c}):annotate{name='next_c_1'},\n nn.CMulTable()({in_gate, in_transform}):annotate{name='next_c_2'}\n })\n local next_h = nn.CMulTable()({out_gate, nn.Tanh()(next_c)}):annotate{name='next_h'}\n\n return next_c, next_h\nend\n\nfunction create_lstm_unit(w_size)\n -- input\n local x = nn.Identity()()\n local prev_s = nn.Identity()()\n\n local i = {[0] = nn.LookupTable(w_size, opt.rnn_size)(x):annotate{name='lstm'}}\n local next_s = {}\n local splitted = {prev_s:split(2 * opt.num_layers)}\n for layer_idx = 1, opt.num_layers do\n local prev_c = splitted[2 * layer_idx - 1]\n local prev_h = splitted[2 * layer_idx]\n local x_in = i[layer_idx - 1]\n if opt.dropout > 0 then\n x_in = nn.Dropout(opt.dropout)(x_in)\n end\n local next_c, next_h = lstm(x_in, prev_c, prev_h)\n table.insert(next_s, next_c)\n table.insert(next_s, next_h)\n i[layer_idx] = next_h\n end\n local m = nn.gModule({x, prev_s}, {nn.Identity()(next_s)})\n \n return transfer_data(m)\nend\n\nfunction create_attention_unit(w_size)\n -- input\n local enc_s_top = nn.Identity()()\n local dec_s_top = nn.Identity()()\n\n -- (batch*length*H) * (batch*H*1) = (batch*length*1)\n local dot = nn.MM()({enc_s_top, nn.View(opt.rnn_size,1):setNumInputDims(1)(dec_s_top)})\n local attention = nn.SoftMax()(nn.Sum(3)(dot))\n -- (batch*length*H)^T * (batch*length*1) = (batch*H*1)\n local enc_attention = nn.MM(true, false)({enc_s_top, nn.View(-1, 1):setNumInputDims(1)(attention)})\n local hid = nn.Tanh()(nn.Linear(2*opt.rnn_size, opt.rnn_size)(nn.JoinTable(2)({nn.Sum(3)(enc_attention), dec_s_top})))\n local h2y_in = hid\n if opt.dropout > 0 then\n h2y_in = nn.Dropout(opt.dropout)(h2y_in)\n end\n local h2y = nn.Linear(opt.rnn_size, w_size)(h2y_in)\n local pred = nn.LogSoftMax()(h2y)\n local m = nn.gModule({enc_s_top, dec_s_top}, {pred})\n \n return transfer_data(m)\nend\n\nfunction setup()\n -- initialize model\n model = {}\n model.enc_s = {}\n model.dec_s = {}\n model.ds = {}\n model.save_enc_ds = {}\n model.enc_s_top = transfer_data(torch.Tensor(opt.batch_size, opt.enc_seq_length, opt.rnn_size))\n model.enc_ds_top = transfer_data(torch.Tensor(opt.batch_size, opt.enc_seq_length, opt.rnn_size))\n \n for j = 0, opt.enc_seq_length do\n model.enc_s[j] = {}\n for d = 1, 2 * opt.num_layers do\n model.enc_s[j][d] = transfer_data(torch.zeros(opt.batch_size, opt.rnn_size))\n end\n end\n \n for j = 0, opt.dec_seq_length do\n model.dec_s[j] = {}\n for d = 1, 2 * opt.num_layers do\n model.dec_s[j][d] = transfer_data(torch.zeros(opt.batch_size, opt.rnn_size))\n end\n end\n\n for d = 1, 2 * opt.num_layers do\n model.ds[d] = transfer_data(torch.zeros(opt.batch_size, opt.rnn_size))\n model.save_enc_ds[d] = transfer_data(torch.zeros(opt.batch_size, opt.rnn_size))\n end\n\n local word_manager, form_manager = unpack(torch.load(path.join(opt.data_dir, 'map.t7')))\n\n print(\"Creating encoder\")\n model.enc_rnn_unit = create_lstm_unit(word_manager.vocab_size)\n model.enc_rnn_unit:training()\n\n print(\"Creating decoder\")\n model.dec_rnn_unit = create_lstm_unit(form_manager.vocab_size)\n model.dec_rnn_unit:training()\n model.dec_att_unit = create_attention_unit(form_manager.vocab_size)\n\n model.criterions={}\n for i = 1, opt.dec_seq_length do\n table.insert(model.criterions, transfer_data(nn.ClassNLLCriterion()))\n end\n\n -- collect all parameters to a vector\n param_x, param_dx = combine_all_parameters(model.enc_rnn_unit, model.dec_rnn_unit, model.dec_att_unit)\n print('number of parameters in the model: ' .. param_x:nElement())\n \n param_x:uniform(-opt.init_weight, opt.init_weight)\n\n -- make a bunch of clones after flattening, as that reallocates memory (tips from char-rnn)\n model.enc_rnns = cloneManyTimes(model.enc_rnn_unit, opt.enc_seq_length)\n model.dec_rnns = cloneManyTimes(model.dec_rnn_unit, opt.dec_seq_length)\n model.dec_atts = cloneManyTimes(model.dec_att_unit, opt.dec_seq_length)\nend\n\nfunction reset_ds()\n for d = 1, #model.ds do\n model.ds[d]:zero()\n end\nend\n\nfunction eval_training(param_x_)\n model.enc_rnn_unit:training()\n model.dec_rnn_unit:training()\n model.dec_att_unit:training()\n for i = 1, #model.enc_rnns do\n model.enc_rnns[i]:training()\n end\n for i = 1, #model.dec_rnns do\n model.dec_rnns[i]:training()\n end\n for i = 1, #model.dec_atts do\n model.dec_atts[i]:training()\n end\n\n -- load batch data\n local enc_batch, enc_len_batch, dec_batch = train_loader:random_batch()\n -- ship batch data to gpu\n if opt.gpuid >= 0 then\n enc_batch = enc_batch:float():cuda()\n dec_batch = dec_batch:float():cuda()\n end\n\n -- do not predict after \n local enc_max_len = enc_batch:size(2)\n local dec_max_len = dec_batch:size(2) - 1\n\n -- forward propagation ===============================\n if param_x_ ~= param_x then\n param_x:copy(param_x_)\n end\n\n -- encode\n for i = 1, #model.enc_s[0] do\n model.enc_s[0][i]:zero()\n end\n for i = 1, enc_max_len do\n model.enc_s[i] = model.enc_rnns[i]:forward({enc_batch[{{}, i}], model.enc_s[i - 1]})\n\n if opt.gpuid >= 0 then\n cutorch.synchronize()\n end\n end\n -- initialize decoder using encoding results\n for i = 1, opt.batch_size do\n for j = 1, #model.dec_s[0] do\n model.dec_s[0][j][{i,{}}]:copy(model.enc_s[enc_len_batch[i]][j][{i,{}}])\n end\n end\n\n -- build (batch*length*H) for attention score computation\n model.enc_s_top:zero()\n for i = 1, enc_max_len do\n model.enc_s_top[{{},i,{}}]:copy(model.enc_s[i][2*opt.num_layers])\n end\n\n local enc_s_top_view = model.enc_s_top[{{},{1, enc_max_len},{}}]\n\n -- decode\n local softmax_predictions = {}\n local loss = 0\n for i = 1, dec_max_len do\n model.dec_s[i] = model.dec_rnns[i]:forward({dec_batch[{{}, i}], model.dec_s[i - 1]})\n softmax_predictions[i] = model.dec_atts[i]:forward({enc_s_top_view, model.dec_s[i][2*opt.num_layers]})\n loss = loss + model.criterions[i]:forward(softmax_predictions[i], dec_batch[{{}, i+1}])\n\n if opt.gpuid >= 0 then\n cutorch.synchronize()\n end\n end\n loss = loss / opt.batch_size\n\n -- backward propagation ===============================\n param_dx:zero()\n local enc_ds_top_view = model.enc_ds_top[{{},{1, enc_max_len},{}}]\n enc_ds_top_view:zero()\n reset_ds()\n for i = dec_max_len, 1, -1 do\n local crit_dx = model.criterions[i]:backward(softmax_predictions[i], dec_batch[{{}, i+1}])\n local tmp1, tmp2 = unpack(model.dec_atts[i]:backward({enc_s_top_view, model.dec_s[i][2*opt.num_layers]}, crit_dx))\n enc_ds_top_view:add(tmp1)\n model.ds[2*opt.num_layers]:add(tmp2)\n local tmp = model.dec_rnns[i]:backward({dec_batch[{{}, i}], model.dec_s[i - 1]}, model.ds)[2]\n copy_table(model.ds, tmp)\n if opt.gpuid >= 0 then\n cutorch.synchronize()\n end\n end\n -- back-propagate to encoder\n copy_table(model.save_enc_ds, model.ds)\n local no_blank = false\n for i = enc_max_len, 1, -1 do\n -- mask, or not\n if (not no_blank) then\n no_blank = true\n for j = 1, opt.batch_size do\n if i > enc_len_batch[j] then\n for k = 1, #model.ds do\n model.ds[k][{j,{}}]:zero()\n end\n no_blank = false\n elseif i == enc_len_batch[j] then\n for k = 1, #model.ds do\n model.ds[k][{j,{}}]:copy(model.save_enc_ds[k][{j,{}}])\n end\n end\n end\n end\n -- add gradient from attention layer\n if no_blank then\n model.ds[2*opt.num_layers]:add(model.enc_ds_top[{{},i,{}}])\n else\n for j = 1, opt.batch_size do\n if i <= enc_len_batch[j] then\n model.ds[2*opt.num_layers][{j,{}}]:add(model.enc_ds_top[{j,i,{}}])\n end\n end\n end\n -- bp\n local tmp = model.enc_rnns[i]:backward({enc_batch[{{}, i}], model.enc_s[i - 1]}, model.ds)[2]\n copy_table(model.ds, tmp)\n if opt.gpuid >= 0 then\n cutorch.synchronize()\n end\n end\n\n -- clip gradient element-wise\n param_dx:clamp(-opt.grad_clip, opt.grad_clip)\n\n return loss, param_dx\nend\n\nfunction main()\n local cmd = torch.CmdLine()\n cmd:option('-gpuid', 0, 'which gpu to use. -1 = use CPU')\n cmd:option('-data_dir', '', 'data path')\n -- bookkeeping\n cmd:option('-seed',123,'torch manual random number generator seed')\n cmd:option('-checkpoint_dir', '', 'output directory where checkpoints get written')\n cmd:option('-savefile','save','filename to autosave the checkpont to. Will be inside checkpoint_dir/')\n cmd:option('-print_every',2000,'how many steps/minibatches between printing out the loss')\n -- model params\n cmd:option('-rnn_size', 200, 'size of LSTM internal state')\n cmd:option('-num_layers', 1, 'number of layers in the LSTM')\n cmd:option('-dropout',0.4,'dropout for regularization, used after each RNN hidden layer. 0 = no dropout')\n cmd:option('-dropoutrec',0,'dropout for regularization, used after each c_i. 0 = no dropout')\n cmd:option('-enc_seq_length',50,'number of timesteps to unroll for')\n cmd:option('-dec_seq_length',100,'number of timesteps to unroll for')\n cmd:option('-batch_size',20,'number of sequences to train on in parallel')\n cmd:option('-max_epochs',80,'number of full passes through the training data')\n -- optimization\n cmd:option('-opt_method', 0, 'optimization method: 0-rmsprop 1-sgd')\n cmd:option('-learning_rate',0.01,'learning rate')\n cmd:option('-init_weight',0.08,'initailization weight')\n cmd:option('-learning_rate_decay',0.98,'learning rate decay')\n cmd:option('-learning_rate_decay_after',5,'in number of epochs, when to start decaying the learning rate')\n cmd:option('-restart',-1,'in number of epochs, when to restart the optimization')\n cmd:option('-decay_rate',0.95,'decay rate for rmsprop')\n\n cmd:option('-grad_clip',5,'clip gradients at this value')\n cmd:text()\n opt = cmd:parse(arg)\n\n -- initialize gpu/cpu\n init_device(opt)\n\n -- setup network\n setup()\n\n -- load data\n train_loader = MinibatchLoader.create(opt, 'train')\n\n -- make sure output directory exists\n if not path.exists(opt.checkpoint_dir) then\n lfs.mkdir(opt.checkpoint_dir)\n end\n\n -- start training\n local step = 0\n local epoch = 0\n local optim_state = {learningRate = opt.learning_rate, alpha = opt.decay_rate}\n\n print(\"Starting training.\")\n local iterations = opt.max_epochs * train_loader.num_batch\n for i = 1, iterations do\n local epoch = i / train_loader.num_batch\n\n local timer = torch.Timer()\n local loss = 0\n if opt.opt_method == 0 then\n _, loss = optim.rmsprop(eval_training, param_x, optim_state)\n elseif opt.opt_method == 1 then\n _, loss = optim.sgd(eval_training, param_x, optim_state)\n end\n local time = timer:time().real\n\n local train_loss = loss[1] -- the loss is inside a list, pop it\n\n -- exponential learning rate decay\n if opt.opt_method == 0 then\n if i % train_loader.num_batch == 0 and opt.learning_rate_decay < 1 then\n if epoch >= opt.learning_rate_decay_after then\n local decay_factor = opt.learning_rate_decay\n optim_state.learningRate = optim_state.learningRate * decay_factor -- decay it\n end\n end\n end\n\n if (epoch == opt.restart) and (optim_state.m) then\n optim_state.m:zero()\n optim_state.learningRate = opt.learning_rate\n end\n\n if i % opt.print_every == 0 then\n print(string.format(\"%d/%d, train_loss = %6.8f, time/batch = %.2fs\", i, iterations, train_loss, time))\n end\n\n -- on last iteration\n if i == iterations then\n local checkpoint = {}\n checkpoint.enc_rnn_unit = model.enc_rnn_unit\n checkpoint.dec_rnn_unit = model.dec_rnn_unit\n checkpoint.dec_att_unit = model.dec_att_unit\n checkpoint.opt = opt\n checkpoint.i = i\n checkpoint.epoch = epoch\n\n torch.save(string.format('%s/model.t7', opt.checkpoint_dir), checkpoint)\n end\n \n if i % 30 == 0 then\n collectgarbage()\n end\n\n -- handle early stopping if things are going really bad\n if loss[1] ~= loss[1] then\n print('loss is NaN. This usually indicates a bug.')\n break -- halt\n end\n end\nend\n\nmain()\n"},"meta":{"kind":"string","value":"{\n \"content_hash\": \"dea0ef40c5c80bfb01d99445f98ab85b\",\n \"timestamp\": \"\",\n \"source\": \"github\",\n \"line_count\": 399,\n \"max_line_length\": 120,\n \"avg_line_length\": 33.576441102756895,\n \"alnum_prop\": 0.6396954542061656,\n \"repo_name\": \"donglixp/lang2logic\",\n \"id\": \"d61e61f232e71ad77f96b1a76b22260c766203d0\",\n \"size\": \"13397\",\n \"binary\": false,\n \"copies\": \"1\",\n \"ref\": \"refs/heads/master\",\n \"path\": \"seq2seq/atis/attention/main.lua\",\n \"mode\": \"33188\",\n \"license\": \"mit\",\n \"language\": [\n {\n \"name\": \"Cuda\",\n \"bytes\": \"7882\"\n },\n {\n \"name\": \"Lua\",\n \"bytes\": \"395284\"\n },\n {\n \"name\": \"Python\",\n \"bytes\": \"510\"\n },\n {\n \"name\": \"Shell\",\n \"bytes\": \"1032\"\n }\n ],\n \"symlink_target\": \"\"\n}"}}},{"rowIdx":370,"cells":{"text":{"kind":"string","value":"\n\n\n\n\nCassandra.AsyncClient.get_indexed_slices_call (apache-cassandra API)\n\n\n\n\n\n\n\n\n
\n\n\n\n
\n\n
\n
\n\n
    \n
  • Detail:&nbsp;
  • \n
  • Field&nbsp;|&nbsp;
  • \n
  • Constr&nbsp;|&nbsp;
  • \n
  • Method
  • \n
\n
\n\n\n
\n\n\n
\n
org.apache.cassandra.thrift
\n

Class Cassandra.AsyncClient.get_indexed_slices_call

\n
\n
\n
    \n
  • java.lang.Object
  • \n
  • \n
      \n
    • org.apache.thrift.async.TAsyncMethodCall
    • \n
    • \n
        \n
      • org.apache.cassandra.thrift.Cassandra.AsyncClient.get_indexed_slices_call
      • \n
      \n
    • \n
    \n
  • \n
\n
\n
    \n
  • \n
    \n
    Enclosing class:
    \n
    Cassandra.AsyncClient
    \n
    \n
    \n
    \n
    public static class Cassandra.AsyncClient.get_indexed_slices_call\nextends org.apache.thrift.async.TAsyncMethodCall
    \n
  • \n
\n
\n
\n
    \n
  • \n\n
      \n
    • \n\n\n

      Nested Class Summary

      \n
        \n
      • \n\n\n

        Nested classes/interfaces inherited from class&nbsp;org.apache.thrift.async.TAsyncMethodCall

        \norg.apache.thrift.async.TAsyncMethodCall.State
      • \n
      \n
    • \n
    \n\n
      \n
    • \n\n\n

      Field Summary

      \n
        \n
      • \n\n\n

        Fields inherited from class&nbsp;org.apache.thrift.async.TAsyncMethodCall

        \nclient, transport
      • \n
      \n
    • \n
    \n\n
      \n
    • \n\n\n

      Constructor Summary

      \n\n\n\n\n\n\n\n\n
      Constructors&nbsp;
      Constructor and Description
      Cassandra.AsyncClient.get_indexed_slices_call(ColumnParent&nbsp;column_parent,\n IndexClause&nbsp;index_clause,\n SlicePredicate&nbsp;column_predicate,\n ConsistencyLevel&nbsp;consistency_level,\n org.apache.thrift.async.AsyncMethodCallback&nbsp;resultHandler,\n org.apache.thrift.async.TAsyncClient&nbsp;client,\n org.apache.thrift.protocol.TProtocolFactory&nbsp;protocolFactory,\n org.apache.thrift.transport.TNonblockingTransport&nbsp;transport)&nbsp;
      \n
    • \n
    \n\n
      \n
    • \n\n\n

      Method Summary

      \n\n\n\n\n\n\n\n\n\n\n\n\n\n\n
      Methods&nbsp;
      Modifier and TypeMethod and Description
      java.util.List&lt;KeySlice&gt;getResult()&nbsp;
      voidwrite_args(org.apache.thrift.protocol.TProtocol&nbsp;prot)&nbsp;
      \n
        \n
      • \n\n\n

        Methods inherited from class&nbsp;org.apache.thrift.async.TAsyncMethodCall

        \ngetClient, getFrameBuffer, getSequenceId, getStartTime, getState, getTimeoutTimestamp, hasTimeout, isFinished, onError, prepareMethodCall, transition
      • \n
      \n
        \n
      • \n\n\n

        Methods inherited from class&nbsp;java.lang.Object

        \nclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • \n
      \n
    • \n
    \n
  • \n
\n
\n
\n
    \n
  • \n\n
      \n
    • \n\n\n

      Constructor Detail

      \n\n\n\n
        \n
      • \n

        Cassandra.AsyncClient.get_indexed_slices_call

        \n
        public&nbsp;Cassandra.AsyncClient.get_indexed_slices_call(ColumnParent&nbsp;column_parent,\n                                             IndexClause&nbsp;index_clause,\n                                             SlicePredicate&nbsp;column_predicate,\n                                             ConsistencyLevel&nbsp;consistency_level,\n                                             org.apache.thrift.async.AsyncMethodCallback&nbsp;resultHandler,\n                                             org.apache.thrift.async.TAsyncClient&nbsp;client,\n                                             org.apache.thrift.protocol.TProtocolFactory&nbsp;protocolFactory,\n                                             org.apache.thrift.transport.TNonblockingTransport&nbsp;transport)\n                                              throws org.apache.thrift.TException
        \n
        Throws:
        \n
        org.apache.thrift.TException
        \n
      • \n
      \n
    • \n
    \n\n\n
  • \n
\n
\n
\n\n\n\n
\n\n\n\n
\n\n
\n
\n\n
    \n
  • Detail:&nbsp;
  • \n
  • Field&nbsp;|&nbsp;
  • \n
  • Constr&nbsp;|&nbsp;
  • \n
  • Method
  • \n
\n
\n\n\n
\n\n

Copyright &copy; 2014 The Apache Software Foundation

\n\n\n"},"meta":{"kind":"string","value":"{\n \"content_hash\": \"9d39e4d6a0e88423540367452e91b370\",\n \"timestamp\": \"\",\n \"source\": \"github\",\n \"line_count\": 348,\n \"max_line_length\": 754,\n \"avg_line_length\": 48.27298850574713,\n \"alnum_prop\": 0.6555747365914638,\n \"repo_name\": \"anuragkapur/cassandra-2.1.2-ak-skynet\",\n \"id\": \"7b2ced2e0993c6052bcca2cedb0779b25e075084\",\n \"size\": \"16799\",\n \"binary\": false,\n \"copies\": \"2\",\n \"ref\": \"refs/heads/master\",\n \"path\": \"apache-cassandra-2.1.2/javadoc/org/apache/cassandra/thrift/Cassandra.AsyncClient.get_indexed_slices_call.html\",\n \"mode\": \"33188\",\n \"license\": \"apache-2.0\",\n \"language\": [\n {\n \"name\": \"Batchfile\",\n \"bytes\": \"59670\"\n },\n {\n \"name\": \"PowerShell\",\n \"bytes\": \"37758\"\n },\n {\n \"name\": \"Python\",\n \"bytes\": \"622552\"\n },\n {\n \"name\": \"Shell\",\n \"bytes\": \"100474\"\n },\n {\n \"name\": \"Thrift\",\n \"bytes\": \"78926\"\n }\n ],\n \"symlink_target\": \"\"\n}"}}},{"rowIdx":371,"cells":{"text":{"kind":"string","value":"package engine.gui;\n\nimport java.awt.Color;\nimport java.awt.Dimension;\n\nimport javax.swing.BorderFactory;\nimport javax.swing.BoxLayout;\nimport javax.swing.JButton;\nimport javax.swing.JPanel;\nimport javax.swing.border.Border;\nimport javax.swing.border.TitledBorder;\n\nimport engine.GameEngine;\n\nimport model.unit.Unit;\n\npublic class ActionPanel extends JPanel {\n\t\n\tprivate Dimension mySize = new Dimension(300, 230);\n\tprivate JButton myNextTurnButton;\n\tprivate JPanel myUnitListArea;\n\tprivate JohnTestAbilityArea myAbilityListArea;\n\t//private AbilityListArea myAbilityListArea;\n\tprivate GameEngine myGameEngine;\n\t\n\tpublic ActionPanel(GameEngine ge) {\n\t\tmyGameEngine = ge;\n\t\t//setPreferredSize(mySize);\n\t\t\n\t\tsetLayout(new BoxLayout(this, BoxLayout.PAGE_AXIS));\n\t\tTitledBorder titledBorder = BorderFactory.createTitledBorder(BorderFactory.createLineBorder(Color.black), \"Actions\");\n\t\ttitledBorder.setTitleJustification(TitledBorder.LEFT);\n\t\tsetBorder(titledBorder);\n\t\t\n\t\tmyUnitListArea = new UnitListArea(myGameEngine);\n\t\tmyAbilityListArea = new JohnTestAbilityArea(myGameEngine);\n\t\t//myAbilityListArea = new AbilityListArea(myGameEngine);\n\t\t\n\t\tadd(new ButtonArea(myGameEngine));\n\t\tadd(myUnitListArea);\n\t\tadd(myAbilityListArea);\n\t}\n\t\n\tpublic JPanel getUnitListArea() {\n\t\treturn myUnitListArea;\n\t}\n\t\n\tpublic JohnTestAbilityArea getAbilityListArea() {\n\t\treturn myAbilityListArea;\n\t}\n\t\n\tpublic void setSelectedUnit(Unit u){\n\t\tmyAbilityListArea.setUnit(u);\n\t}\n\t\n}\n"},"meta":{"kind":"string","value":"{\n \"content_hash\": \"fe185e13a62ce059ff218b1f0c9b9d5a\",\n \"timestamp\": \"\",\n \"source\": \"github\",\n \"line_count\": 56,\n \"max_line_length\": 119,\n \"avg_line_length\": 26,\n \"alnum_prop\": 0.790521978021978,\n \"repo_name\": \"bradleysykes/game_leprechaun\",\n \"id\": \"c2278be8fd9a779d991fd4a84c56128f1ee03294\",\n \"size\": \"1456\",\n \"binary\": false,\n \"copies\": \"2\",\n \"ref\": \"refs/heads/master\",\n \"path\": \"src/engine/gui/ActionPanel.java\",\n \"mode\": \"33188\",\n \"license\": \"mit\",\n \"language\": [\n {\n \"name\": \"Java\",\n \"bytes\": \"338938\"\n }\n ],\n \"symlink_target\": \"\"\n}"}}},{"rowIdx":372,"cells":{"text":{"kind":"string","value":"var\n\n Garam = require(process.cwd()+'/server/lib/Garam')\n , _ = require('underscore')\n\n ,BaseTransaction = require(process.cwd()+'/server/lib/BaseTransaction');\n\n\n\n\nmodule.exports = BaseTransaction.extend({\n pid:'ServerLoginWorkerStatusRes',\n create : function() {\n\n this._packet = {\n state : false\n\n }\n },\n addEvent : function(client) {\n\n\n client.on('ServerReConnectionWorkerRes',function (state) {\n //DC 가 떨어지고 자동으로 재접속에 성공했을때의 처리\n Garam.getCtl('dc_worker').setConnectionStatus();\n Garam.logger().info('reconnection dc-worker',client.getHostname());\n })\n\n }\n\n\n\n\n});\n\n"},"meta":{"kind":"string","value":"{\n \"content_hash\": \"88ddb97b2c6f81f7683ebe2ba9af9abe\",\n \"timestamp\": \"\",\n \"source\": \"github\",\n \"line_count\": 35,\n \"max_line_length\": 79,\n \"avg_line_length\": 19,\n \"alnum_prop\": 0.5894736842105263,\n \"repo_name\": \"ssdosso/garam\",\n \"id\": \"f9b36224a44be9a92fbfca2ca286d0849e07cba7\",\n \"size\": \"707\",\n \"binary\": false,\n \"copies\": \"1\",\n \"ref\": \"refs/heads/master\",\n \"path\": \"application/transactions/dc_worker/login/ServerReConnectionWorkerRes.js\",\n \"mode\": \"33188\",\n \"license\": \"apache-2.0\",\n \"language\": [\n {\n \"name\": \"HTML\",\n \"bytes\": \"24851\"\n },\n {\n \"name\": \"JavaScript\",\n \"bytes\": \"367378\"\n }\n ],\n \"symlink_target\": \"\"\n}"}}},{"rowIdx":373,"cells":{"text":{"kind":"string","value":"package com.plugin.content;\n\nimport java.io.Serializable;\nimport java.util.ArrayList;\nimport java.util.HashMap;\n\nimport com.plugin.util.LogUtil;\n\nimport android.app.Application;\nimport android.content.Context;\nimport dalvik.system.DexClassLoader;\n\n/**\n *
\n * @author cailiming\n * 
\n */\npublic class PluginDescriptor implements Serializable {\n\n\tprivate static final long serialVersionUID = -7545734825911798344L;\n\n\tpublic static final int UNKOWN = 0;\n\tpublic static final int BROADCAST = 1;\n\tpublic static final int ACTIVITY = 2;\n\tpublic static final int SERVICE = 4;\n\tpublic static final int PROVIDER = 6;\n\tpublic static final int FRAGMENT = 8;\n\tpublic static final int FUNCTION = 9;\n\n\tprivate String packageName;\n\n\tprivate String version;\n\n\tprivate String description;\n\n\tprivate boolean isStandalone;\n\n\tprivate boolean isEnabled;\n\n\tprivate String applicationName;\n\n\tprivate HashMap providerInfos = new HashMap();\n\n\t/**\n\t * key: fragment id,\n\t * value: fragment class\n\t */\n\tprivate HashMap fragments = new HashMap();\n\n\t/**\n\t * key: activity class name\n\t * value: intentfilter list\n\t */\n\tprivate HashMap> activitys = new HashMap>();\n\n\t/**\n\t * key: service class name\n\t * value: intentfilter list\n\t */\n\tprivate HashMap> services = new HashMap>();\n\n\t/**\n\t * key: receiver class name\n\t * value: intentfilter list\n\t */\n\tprivate HashMap> receivers = new HashMap>();\n\n\tprivate String installedPath;\n\n\tprivate transient Application pluginApplication;\n\t\n\tprivate transient DexClassLoader pluginClassLoader;\n\n\tprivate transient Context pluginContext;\n\n\n\t//=============getter and setter======================\n\n\n\tpublic Context getPluginContext() {\n\t\treturn pluginContext;\n\t}\n\n\tpublic void setPluginContext(Context pluginContext) {\n\t\tthis.pluginContext = pluginContext;\n\t}\n\n\tpublic DexClassLoader getPluginClassLoader() {\n\t\treturn pluginClassLoader;\n\t}\n\n\tpublic void setPluginClassLoader(DexClassLoader pluginLoader) {\n\t\tthis.pluginClassLoader = pluginLoader;\n\t}\n\n\tpublic String getPackageName() {\n\t\treturn packageName;\n\t}\n\n\tpublic void setPackageName(String packageName) {\n\t\tthis.packageName = packageName;\n\t}\n\n\tpublic String getVersion() {\n\t\treturn version;\n\t}\n\n\tpublic void setVersion(String version) {\n\t\tthis.version = version;\n\t}\n\n\tpublic HashMap getFragments() {\n\t\treturn fragments;\n\t}\n\n\tpublic void setfragments(HashMap fragments) {\n\t\tthis.fragments = fragments;\n\t}\n\n\tpublic HashMap> getReceivers() {\n\t\treturn receivers;\n\t}\n\n\tpublic void setReceivers(HashMap> receivers) {\n\t\tthis.receivers = receivers;\n\t}\n\n\tpublic HashMap> getActivitys() {\n\t\treturn activitys;\n\t}\n\n\tpublic void setActivitys(HashMap> activitys) {\n\t\tthis.activitys = activitys;\n\t}\n\n\tpublic HashMap> getServices() {\n\t\treturn services;\n\t}\n\n\tpublic void setServices(HashMap> services) {\n\t\tthis.services = services;\n\t}\n\n\tpublic String getInstalledPath() {\n\t\treturn installedPath;\n\t}\n\n\tpublic void setInstalledPath(String installedPath) {\n\t\tthis.installedPath = installedPath;\n\t}\n\n\tpublic void setDescription(String description) {\n\t\tthis.description = description;\n\t}\n\t\n\tpublic String getApplicationName() {\n\t\treturn applicationName;\n\t}\n\n\tpublic void setApplicationName(String applicationName) {\n\t\tthis.applicationName = applicationName;\n\t}\n\t\n\tpublic boolean isEnabled() {\n\t\treturn isEnabled;\n\t}\n\n\tpublic void setEnabled(boolean isEnabled) {\n\t\tthis.isEnabled = isEnabled;\n\t}\n\n\tpublic Application getPluginApplication() {\n\t\treturn pluginApplication;\n\t}\n\n\tpublic void setPluginApplication(Application pluginApplication) {\n\t\tthis.pluginApplication = pluginApplication;\n\t}\n\n\tpublic boolean isStandalone() {\n\t\treturn isStandalone;\n\t}\n\n\tpublic void setStandalone(boolean isStandalone) {\n\t\tthis.isStandalone = isStandalone;\n\t}\n\n\tpublic HashMap getProviderInfos() {\n\t\treturn providerInfos;\n\t}\n\n\tpublic void setProviderInfos(HashMap providerInfos) {\n\t\tthis.providerInfos = providerInfos;\n\t}\n\n\tpublic String getDescription() {\n\t\tif (description != null && description.startsWith(\"@\") && description.length() == 9) {\n\t\t\tString idHex = description.replace(\"@\", \"\");\n\t\t\ttry {\n\t\t\t\tint id = Integer.parseInt(idHex, 16);\n\t\t\t\t//此时context可能还没有初始化\n\t\t\t\tif (pluginContext != null) {\n\t\t\t\t\tString des = pluginContext.getString(id);\n\t\t\t\t\treturn des;\n\t\t\t\t}\n\t\t\t} catch (Exception e) {\n\t\t\t\te.printStackTrace();\n\t\t\t}\n\t\t}\n\t\treturn description;\n\t}\n\n\t/**\n\t * 需要根据id查询的只有fragment\n\t * @param clazzId\n\t * @return\n\t */\n\tpublic String getPluginClassNameById(String clazzId) {\n\t\tString clazzName = getFragments().get(clazzId);\n\n\t\tif (clazzName == null) {\n\t\t\tLogUtil.d(\"PluginDescriptor\", \"clazzName not found for classId \", clazzId);\n\t\t} else {\n\t\t\tLogUtil.d(\"PluginDescriptor\", \"clazzName found \", clazzName);\n\t\t}\n\t\treturn clazzName;\n\t}\n\n\t/**\n\t * 需要根据Id查询的只有fragment\n\t * @param clazzId\n\t * @return\n\t */\n\tpublic boolean containsFragment(String clazzId) {\n\t\tif (getFragments().containsKey(clazzId) && isEnabled()) {\n\t\t\treturn true;\n\t\t}\n\t\treturn false;\n\t}\n\t\n\t/**\n\t * 根据className查询\n\t * @param clazzName\n\t * @return\n\t */\n\tpublic boolean containsName(String clazzName) {\n\t\tif (getFragments().containsValue(clazzName) && isEnabled()) {\n\t\t\treturn true;\n\t\t} else if (getActivitys().containsKey(clazzName) && isEnabled()) {\n\t\t\treturn true;\n\t\t} else if (getReceivers().containsKey(clazzName) && isEnabled()) {\n\t\t\treturn true;\n\t\t} else if (getServices().containsKey(clazzName) && isEnabled()) {\n\t\t\treturn true;\n\t\t} else if (getProviderInfos().containsKey(clazzName) && isEnabled()) {\n\t\t\treturn true;\n\t\t}\n\t\treturn false;\n\t}\n\n\t/**\n\t * 获取class的类型: activity\n\t * @return\n\t */\n\tpublic int getType(String clazzName) {\n\t\tif (getFragments().containsValue(clazzName) && isEnabled()) {\n\t\t\treturn FRAGMENT;\n\t\t} else if (getActivitys().containsKey(clazzName) && isEnabled()) {\n\t\t\treturn ACTIVITY;\n\t\t} else if (getReceivers().containsKey(clazzName) && isEnabled()) {\n\t\t\treturn BROADCAST;\n\t\t} else if (getServices().containsKey(clazzName) && isEnabled()) {\n\t\t\treturn SERVICE;\n\t\t} else if (getProviderInfos().containsKey(clazzName) && isEnabled()) {\n\t\t\treturn PROVIDER;\n\t\t}\n\t\treturn UNKOWN;\n\t}\n}\n"},"meta":{"kind":"string","value":"{\n \"content_hash\": \"6bcc5204bff1e1d96af098b2fb5d967a\",\n \"timestamp\": \"\",\n \"source\": \"github\",\n \"line_count\": 279,\n \"max_line_length\": 121,\n \"avg_line_length\": 23.774193548387096,\n \"alnum_prop\": 0.7227498869289914,\n \"repo_name\": \"GKerison/Android-Plugin-Framework\",\n \"id\": \"d1e5e69e2bca4084e9820d0ac3d3912fa25fccf7\",\n \"size\": \"6709\",\n \"binary\": false,\n \"copies\": \"5\",\n \"ref\": \"refs/heads/master\",\n \"path\": \"PluginCore/src/com/plugin/content/PluginDescriptor.java\",\n \"mode\": \"33188\",\n \"license\": \"mit\",\n \"language\": [\n {\n \"name\": \"Java\",\n \"bytes\": \"272659\"\n }\n ],\n \"symlink_target\": \"\"\n}"}}},{"rowIdx":374,"cells":{"text":{"kind":"string","value":"namespace Springboard.Migrations\n{\n using System.CodeDom.Compiler;\n using System.Data.Entity.Migrations;\n using System.Data.Entity.Migrations.Infrastructure;\n using System.Resources;\n \n [GeneratedCode(\"EntityFramework.Migrations\", \"6.1.3-40302\")]\n public sealed partial class ForeignKeyFix : IMigrationMetadata\n {\n private readonly ResourceManager Resources = new ResourceManager(typeof(ForeignKeyFix));\n \n string IMigrationMetadata.Id\n {\n get { return \"201602272239156_ForeignKeyFix\"; }\n }\n \n string IMigrationMetadata.Source\n {\n get { return null; }\n }\n \n string IMigrationMetadata.Target\n {\n get { return Resources.GetString(\"Target\"); }\n }\n }\n}\n"},"meta":{"kind":"string","value":"{\n \"content_hash\": \"fa535f7193835d84ffe02da899e16335\",\n \"timestamp\": \"\",\n \"source\": \"github\",\n \"line_count\": 28,\n \"max_line_length\": 96,\n \"avg_line_length\": 28.571428571428573,\n \"alnum_prop\": 0.6225,\n \"repo_name\": \"CSC394-Springboard/Springboard\",\n \"id\": \"ea4b9cdb9ab29bc45c2f852c967e90b12661583a\",\n \"size\": \"822\",\n \"binary\": false,\n \"copies\": \"1\",\n \"ref\": \"refs/heads/master\",\n \"path\": \"Springboard/Springboard/Migrations/201602272239156_ForeignKeyFix.Designer.cs\",\n \"mode\": \"33188\",\n \"license\": \"mit\",\n \"language\": [\n {\n \"name\": \"ASP\",\n \"bytes\": \"102\"\n },\n {\n \"name\": \"C#\",\n \"bytes\": \"218051\"\n },\n {\n \"name\": \"CSS\",\n \"bytes\": \"82456\"\n },\n {\n \"name\": \"HTML\",\n \"bytes\": \"7027\"\n },\n {\n \"name\": \"JavaScript\",\n \"bytes\": \"293476\"\n },\n {\n \"name\": \"PowerShell\",\n \"bytes\": \"135839\"\n }\n ],\n \"symlink_target\": \"\"\n}"}}},{"rowIdx":375,"cells":{"text":{"kind":"string","value":"\"\"\"\nCollects Web IDL definitions in IDL files into a Python object per Blink\ncomponent.\n\nCollected IDL definitions are parsed into ASTs and saved into a file with\na label of Blink component.\n\"\"\"\n\nimport optparse\n\nimport utilities\nimport web_idl\n\nfrom idl_parser import idl_parser\nfrom idl_parser import idl_lexer\n\n_VALID_COMPONENTS = ('core', 'modules', 'extensions_chromeos')\n\n\ndef parse_options():\n parser = optparse.OptionParser()\n parser.add_option(\n '--idl_list_file',\n type='string',\n help=\"a file path which lists IDL file paths to process\")\n parser.add_option(\n '--component',\n type='choice',\n choices=_VALID_COMPONENTS,\n help=\"specify a component name\")\n parser.add_option(\n '--for_testing',\n action='store_true',\n help=(\"specify this option if the IDL definitions are meant for \"\n \"testing only\"))\n parser.add_option('--output', type='string', help=\"the output file path\")\n options, args = parser.parse_args()\n\n required_option_names = ('idl_list_file', 'component', 'output')\n for opt_name in required_option_names:\n if getattr(options, opt_name) is None:\n parser.error(\"--{} is a required option.\".format(opt_name))\n\n if args:\n parser.error(\"Unknown arguments {}\".format(args))\n\n return options, args\n\n\ndef main():\n options, _ = parse_options()\n\n filepaths = utilities.read_idl_files_list_from_file(options.idl_list_file)\n lexer = idl_lexer.IDLLexer()\n parser = idl_parser.IDLParser(lexer)\n ast_group = web_idl.AstGroup(\n component=web_idl.Component(options.component),\n for_testing=bool(options.for_testing))\n for filepath in filepaths:\n ast_group.add_ast_node(idl_parser.ParseFile(parser, filepath))\n ast_group.write_to_file(options.output)\n\n\nif __name__ == '__main__':\n main()\n"},"meta":{"kind":"string","value":"{\n \"content_hash\": \"8fe1a96a4840617d3ed484177499ecac\",\n \"timestamp\": \"\",\n \"source\": \"github\",\n \"line_count\": 65,\n \"max_line_length\": 78,\n \"avg_line_length\": 28.846153846153847,\n \"alnum_prop\": 0.6544,\n \"repo_name\": \"nwjs/chromium.src\",\n \"id\": \"750304dd2492835f6e3dd81d4720935ff21b54d9\",\n \"size\": \"2037\",\n \"binary\": false,\n \"copies\": \"1\",\n \"ref\": \"refs/heads/nw70\",\n \"path\": \"third_party/blink/renderer/bindings/scripts/collect_idl_files.py\",\n \"mode\": \"33188\",\n \"license\": \"bsd-3-clause\",\n \"language\": [],\n \"symlink_target\": \"\"\n}"}}},{"rowIdx":376,"cells":{"text":{"kind":"string","value":"require 'spec_helper'\n\ndescribe Target do\n # pending \"add some examples to (or delete) #{__FILE__}\"\nend\n"},"meta":{"kind":"string","value":"{\n \"content_hash\": \"9f765ef31ad41371a4fe65b508964129\",\n \"timestamp\": \"\",\n \"source\": \"github\",\n \"line_count\": 5,\n \"max_line_length\": 58,\n \"avg_line_length\": 21,\n \"alnum_prop\": 0.6857142857142857,\n \"repo_name\": \"TonFw/Pinger\",\n \"id\": \"7e366835b9ecd180aed4fc8f8763c250ccfa3e33\",\n \"size\": \"105\",\n \"binary\": false,\n \"copies\": \"1\",\n \"ref\": \"refs/heads/master\",\n \"path\": \"spec/models/target_spec.rb\",\n \"mode\": \"33188\",\n \"license\": \"mit\",\n \"language\": [\n {\n \"name\": \"CSS\",\n \"bytes\": \"3050\"\n },\n {\n \"name\": \"CoffeeScript\",\n \"bytes\": \"844\"\n },\n {\n \"name\": \"JavaScript\",\n \"bytes\": \"697\"\n },\n {\n \"name\": \"Ruby\",\n \"bytes\": \"84300\"\n }\n ],\n \"symlink_target\": \"\"\n}"}}},{"rowIdx":377,"cells":{"text":{"kind":"string","value":"\n"},"meta":{"kind":"string","value":"{\n \"content_hash\": \"9265d79f23d54a96c95fd26d031c1363\",\n \"timestamp\": \"\",\n \"source\": \"github\",\n \"line_count\": 8,\n \"max_line_length\": 68,\n \"avg_line_length\": 49.625,\n \"alnum_prop\": 0.672544080604534,\n \"repo_name\": \"voxelgenesis/Sunshine-Version-2\",\n \"id\": \"5f59cdcb942ed933c103d52ef483d10a408195ce\",\n \"size\": \"397\",\n \"binary\": false,\n \"copies\": \"1\",\n \"ref\": \"refs/heads/1.01_hello_world\",\n \"path\": \"app/src/main/res/layout/list_item_forecast.xml\",\n \"mode\": \"33188\",\n \"license\": \"apache-2.0\",\n \"language\": [\n {\n \"name\": \"Java\",\n \"bytes\": \"6379\"\n }\n ],\n \"symlink_target\": \"\"\n}"}}},{"rowIdx":378,"cells":{"text":{"kind":"string","value":"set `planner.slice_target`=1;\nselect cast(t.data.p_partkey as varchar) from schema_change_empty_batch_part t order by t.data.p_partkey limit 5;\nreset `planner.slice_target`;\n"},"meta":{"kind":"string","value":"{\n \"content_hash\": \"b75e04f12f23a10d053f99bad06bf143\",\n \"timestamp\": \"\",\n \"source\": \"github\",\n \"line_count\": 3,\n \"max_line_length\": 113,\n \"avg_line_length\": 58,\n \"alnum_prop\": 0.7701149425287356,\n \"repo_name\": \"cchang738/drill-test-framework\",\n \"id\": \"f87b6560d83521c88dc03c82177813b310228e8d\",\n \"size\": \"174\",\n \"binary\": false,\n \"copies\": \"4\",\n \"ref\": \"refs/heads/master\",\n \"path\": \"framework/resources/Functional/schema_change_empty_batch/hbase/emptyHbaseScan2.sql\",\n \"mode\": \"33188\",\n \"license\": \"apache-2.0\",\n \"language\": [\n {\n \"name\": \"E\",\n \"bytes\": \"19826071\"\n },\n {\n \"name\": \"Eiffel\",\n \"bytes\": \"68483171\"\n },\n {\n \"name\": \"Forth\",\n \"bytes\": \"87\"\n },\n {\n \"name\": \"HiveQL\",\n \"bytes\": \"781960\"\n },\n {\n \"name\": \"Java\",\n \"bytes\": \"185017\"\n },\n {\n \"name\": \"OpenEdge ABL\",\n \"bytes\": \"1590703\"\n },\n {\n \"name\": \"PLSQL\",\n \"bytes\": \"58311\"\n },\n {\n \"name\": \"PLpgSQL\",\n \"bytes\": \"72111\"\n },\n {\n \"name\": \"Python\",\n \"bytes\": \"15030\"\n },\n {\n \"name\": \"Shell\",\n \"bytes\": \"107060\"\n },\n {\n \"name\": \"q\",\n \"bytes\": \"3508170\"\n }\n ],\n \"symlink_target\": \"\"\n}"}}},{"rowIdx":379,"cells":{"text":{"kind":"string","value":"module Rails\n module Paths\n # This object is an extended hash that behaves as root of the Rails::Paths system.\n # It allows you to collect information about how you want to structure your application\n # paths by a Hash like API. It requires you to give a physical path on initialization.\n #\n # root = Root.new \"/rails\"\n # root.add \"app/controllers\", eager_load: true\n #\n # The command above creates a new root object and adds \"app/controllers\" as a path.\n # This means we can get a Rails::Paths::Path object back like below:\n #\n # path = root[\"app/controllers\"]\n # path.eager_load? # => true\n # path.is_a?(Rails::Paths::Path) # => true\n #\n # The +Path+ object is simply an enumerable and allows you to easily add extra paths:\n #\n # path.is_a?(Enumerable) # => true\n # path.to_ary.inspect # => [\"app/controllers\"]\n #\n # path << \"lib/controllers\"\n # path.to_ary.inspect # => [\"app/controllers\", \"lib/controllers\"]\n #\n # Notice that when you add a path using +add+, the path object created already\n # contains the path with the same path value given to +add+. In some situations,\n # you may not want this behavior, so you can give :with as option.\n #\n # root.add \"config/routes\", with: \"config/routes.rb\"\n # root[\"config/routes\"].inspect # => [\"config/routes.rb\"]\n #\n # The +add+ method accepts the following options as arguments:\n # eager_load, autoload, autoload_once, and glob.\n #\n # Finally, the +Path+ object also provides a few helpers:\n #\n # root = Root.new \"/rails\"\n # root.add \"app/controllers\"\n #\n # root[\"app/controllers\"].expanded # => [\"/rails/app/controllers\"]\n # root[\"app/controllers\"].existent # => [\"/rails/app/controllers\"]\n #\n # Check the Rails::Paths::Path documentation for more information.\n class Root\n attr_accessor :path\n\n def initialize(path)\n @path = path\n @root = {}\n end\n\n def []=(path, value)\n glob = self[path] ? self[path].glob : nil\n add(path, with: value, glob: glob)\n end\n\n def add(path, options = {})\n with = Array(options.fetch(:with, path))\n @root[path] = Path.new(self, path, with, options)\n end\n\n def [](path)\n @root[path]\n end\n\n def values\n @root.values\n end\n\n def keys\n @root.keys\n end\n\n def values_at(*list)\n @root.values_at(*list)\n end\n\n def all_paths\n values.tap(&:uniq!)\n end\n\n def autoload_once\n filter_by(&:autoload_once?)\n end\n\n def eager_load\n filter_by(&:eager_load?)\n end\n\n def autoload_paths\n filter_by(&:autoload?)\n end\n\n def load_paths\n filter_by(&:load_path?)\n end\n\n private\n\n def filter_by(&block)\n all_paths.find_all(&block).flat_map { |path|\n paths = path.existent\n paths - path.children.flat_map { |p| yield(p) ? [] : p.existent }\n }.uniq\n end\n end\n\n class Path\n include Enumerable\n\n attr_accessor :glob\n\n def initialize(root, current, paths, options = {})\n @paths = paths\n @current = current\n @root = root\n @glob = options[:glob]\n\n options[:autoload_once] ? autoload_once! : skip_autoload_once!\n options[:eager_load] ? eager_load! : skip_eager_load!\n options[:autoload] ? autoload! : skip_autoload!\n options[:load_path] ? load_path! : skip_load_path!\n end\n\n def absolute_current # :nodoc:\n File.expand_path(@current, @root.path)\n end\n\n def children\n keys = @root.keys.find_all { |k|\n k.start_with?(@current) && k != @current\n }\n @root.values_at(*keys.sort)\n end\n\n def first\n expanded.first\n end\n\n def last\n expanded.last\n end\n\n %w(autoload_once eager_load autoload load_path).each do |m|\n class_eval <<-RUBY, __FILE__, __LINE__ + 1\n def #{m}! # def eager_load!\n @#{m} = true # @eager_load = true\n end # end\n #\n def skip_#{m}! # def skip_eager_load!\n @#{m} = false # @eager_load = false\n end # end\n #\n def #{m}? # def eager_load?\n @#{m} # @eager_load\n end # end\n RUBY\n end\n\n def each(&block)\n @paths.each(&block)\n end\n\n def <<(path)\n @paths << path\n end\n alias :push :<<\n\n def concat(paths)\n @paths.concat paths\n end\n\n def unshift(*paths)\n @paths.unshift(*paths)\n end\n\n def to_ary\n @paths\n end\n\n def extensions # :nodoc:\n $1.split(\",\") if @glob =~ /\\{([\\S]+)\\}/\n end\n\n # Expands all paths against the root and return all unique values.\n def expanded\n raise \"You need to set a path root\" unless @root.path\n result = []\n\n each do |p|\n path = File.expand_path(p, @root.path)\n\n if @glob && File.directory?(path)\n Dir.chdir(path) do\n result.concat(Dir.glob(@glob).map { |file| File.join path, file }.sort)\n end\n else\n result << path\n end\n end\n\n result.uniq!\n result\n end\n\n # Returns all expanded paths but only if they exist in the filesystem.\n def existent\n expanded.select { |f| File.exist?(f) }\n end\n\n def existent_directories\n expanded.select { |d| File.directory?(d) }\n end\n\n alias to_a expanded\n end\n end\nend\n"},"meta":{"kind":"string","value":"{\n \"content_hash\": \"ec5c596f2ebe1653d2b43ce6225fb8a5\",\n \"timestamp\": \"\",\n \"source\": \"github\",\n \"line_count\": 218,\n \"max_line_length\": 95,\n \"avg_line_length\": 26.58256880733945,\n \"alnum_prop\": 0.5287316652286453,\n \"repo_name\": \"tijwelch/rails\",\n \"id\": \"10925de8b20407ac876bd9dde7e2d8514ba46e50\",\n \"size\": \"5795\",\n \"binary\": false,\n \"copies\": \"4\",\n \"ref\": \"refs/heads/master\",\n \"path\": \"railties/lib/rails/paths.rb\",\n \"mode\": \"33188\",\n \"license\": \"mit\",\n \"language\": [\n {\n \"name\": \"CSS\",\n \"bytes\": \"33444\"\n },\n {\n \"name\": \"CoffeeScript\",\n \"bytes\": \"41914\"\n },\n {\n \"name\": \"HTML\",\n \"bytes\": \"195552\"\n },\n {\n \"name\": \"JavaScript\",\n \"bytes\": \"86514\"\n },\n {\n \"name\": \"Ruby\",\n \"bytes\": \"10496098\"\n },\n {\n \"name\": \"Yacc\",\n \"bytes\": \"965\"\n }\n ],\n \"symlink_target\": \"\"\n}"}}},{"rowIdx":380,"cells":{"text":{"kind":"string","value":"namespace bookmarks {\nclass BookmarkModel;\n}\n\n// ChromeHistoryBackendClient implements history::HistoryBackendClient interface\n// to provides access to embedder-specific features.\nclass ChromeHistoryBackendClient : public history::HistoryBackendClient {\n public:\n explicit ChromeHistoryBackendClient(bookmarks::BookmarkModel* bookmark_model);\n ~ChromeHistoryBackendClient() override;\n\n // history::HistoryBackendClient implementation.\n bool IsBookmarked(const GURL& url) override;\n void GetBookmarks(std::vector* bookmarks) override;\n bool ShouldReportDatabaseError() override;\n bool IsWebSafe(const GURL& url) override;\n#if defined(OS_ANDROID)\n void OnHistoryBackendInitialized(\n history::HistoryBackend* history_backend,\n history::HistoryDatabase* history_database,\n history::ThumbnailDatabase* thumbnail_database,\n const base::FilePath& history_dir) override;\n void OnHistoryBackendDestroyed(history::HistoryBackend* history_backend,\n const base::FilePath& history_dir) override;\n#endif // defined(OS_ANDROID)\n\n private:\n // BookmarkModel instance providing access to bookmarks. May be null during\n // testing but must outlive ChromeHistoryBackendClient if non-null.\n bookmarks::BookmarkModel* bookmark_model_;\n\n DISALLOW_COPY_AND_ASSIGN(ChromeHistoryBackendClient);\n};\n\n#endif // CHROME_BROWSER_HISTORY_CHROME_HISTORY_BACKEND_CLIENT_H_\n"},"meta":{"kind":"string","value":"{\n \"content_hash\": \"32adcf1541bb7e077d3a75c42a5ffb8a\",\n \"timestamp\": \"\",\n \"source\": \"github\",\n \"line_count\": 35,\n \"max_line_length\": 80,\n \"avg_line_length\": 40.82857142857143,\n \"alnum_prop\": 0.7739678096571029,\n \"repo_name\": \"Samsung/ChromiumGStreamerBackend\",\n \"id\": \"7d689f5db35d7f7a9e9a0000eaa622ce3d51255b\",\n \"size\": \"1850\",\n \"binary\": false,\n \"copies\": \"11\",\n \"ref\": \"refs/heads/master\",\n \"path\": \"chrome/browser/history/chrome_history_backend_client.h\",\n \"mode\": \"33188\",\n \"license\": \"bsd-3-clause\",\n \"language\": [],\n \"symlink_target\": \"\"\n}"}}},{"rowIdx":381,"cells":{"text":{"kind":"string","value":"\npackage com.intuit.ipp.serialization.custom;\n\nimport java.io.IOException;\n\nimport com.fasterxml.jackson.core.JsonGenerator;\nimport com.fasterxml.jackson.databind.JsonSerializer;\nimport com.fasterxml.jackson.databind.SerializerProvider;\nimport com.intuit.ipp.data.DeliveryErrorTypeEnum;\n\n/**\n * Custom JsonSerializer for reading DeliveryErrorTypeEnum values\n * \n */\npublic class DeliveryErrorTypeEnumJsonSerializer extends JsonSerializer {\n\n\t/**\n\t * {@inheritDoc}\n\t */\n\t@Override\n\tpublic void serialize(DeliveryErrorTypeEnum value, JsonGenerator jgen, SerializerProvider provider) throws IOException {\n\t\tjgen.writeString(value.value());\n\t}\n\n}\n"},"meta":{"kind":"string","value":"{\n \"content_hash\": \"015346fc514be18fa793dba6a4d92dd6\",\n \"timestamp\": \"\",\n \"source\": \"github\",\n \"line_count\": 25,\n \"max_line_length\": 121,\n \"avg_line_length\": 26.64,\n \"alnum_prop\": 0.8063063063063063,\n \"repo_name\": \"intuit/QuickBooks-V3-Java-SDK\",\n \"id\": \"a0f6f84cac94053666c5e80deca598e8b37a4e86\",\n \"size\": \"1412\",\n \"binary\": false,\n \"copies\": \"1\",\n \"ref\": \"refs/heads/develop\",\n \"path\": \"ipp-v3-java-devkit/src/main/java/com/intuit/ipp/serialization/custom/DeliveryErrorTypeEnumJsonSerializer.java\",\n \"mode\": \"33188\",\n \"license\": \"apache-2.0\",\n \"language\": [\n {\n \"name\": \"Java\",\n \"bytes\": \"4762384\"\n }\n ],\n \"symlink_target\": \"\"\n}"}}},{"rowIdx":382,"cells":{"text":{"kind":"string","value":"\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n
\n\n{exp:channel:entries channel=\"articles\" limit=\"1\" disable=\"categories|category_fields|member_data\" search:article_content=\"blockquote\"}\n\n{title}\n\n\n{exp:safecracker channel=\"articles\" include_jquery=\"no\" json=\"yes\" safecracker_head=\"no\" class=\"editForm\" id=\"editForm{entry_id}\" entry_id=\"{entry_id}\"}\n\n\t\n\t\n\t\n\n{/exp:safecracker}\n\n
\n\n{paginate}\n\n\t

\n\t\n\t{if previous_page}\n\tPrevious Page &nbsp;\n\t{/if}\n\t\n\t{current_page} of {total_pages}\n\t\n\t{if next_page}\n\t&nbsp; Next Page\n\t{/if}\n\t\n\t

\n\t\n{/paginate}\n\n{/exp:channel:entries}\n\n\n\n\n\n\n\n\n\n\n"},"meta":{"kind":"string","value":"{\n \"content_hash\": \"825443092445b76e7d5c7fe7598b5c97\",\n \"timestamp\": \"\",\n \"source\": \"github\",\n \"line_count\": 1182,\n \"max_line_length\": 152,\n \"avg_line_length\": 33.423857868020306,\n \"alnum_prop\": 0.5116814741691346,\n \"repo_name\": \"MikaCaldera/AListApart\",\n \"id\": \"f2647fed117780e7fc57a9f42719d098d522ec1e\",\n \"size\": \"39507\",\n \"binary\": false,\n \"copies\": \"1\",\n \"ref\": \"refs/heads/components\",\n \"path\": \"templates/default_site/utilities.group/blockquotes.html\",\n \"mode\": \"33261\",\n \"license\": \"mit\",\n \"language\": [\n {\n \"name\": \"CSS\",\n \"bytes\": \"143702\"\n },\n {\n \"name\": \"HTML\",\n \"bytes\": \"444650\"\n },\n {\n \"name\": \"JavaScript\",\n \"bytes\": \"154967\"\n }\n ],\n \"symlink_target\": \"\"\n}"}}},{"rowIdx":383,"cells":{"text":{"kind":"string","value":"\n\n\t\n\t\tLogging in...\n\t\n\t\n\t\t\n\t\n\n"},"meta":{"kind":"string","value":"{\n \"content_hash\": \"8d956a8ad69edbe578367bf3fa112f23\",\n \"timestamp\": \"\",\n \"source\": \"github\",\n \"line_count\": 13,\n \"max_line_length\": 63,\n \"avg_line_length\": 19.923076923076923,\n \"alnum_prop\": 0.640926640926641,\n \"repo_name\": \"macropodhq/gitr-client\",\n \"id\": \"57ebcc5c62ee758b9e2f6dd6aae3ee575920a7ba\",\n \"size\": \"259\",\n \"binary\": false,\n \"copies\": \"4\",\n \"ref\": \"refs/heads/master\",\n \"path\": \"login-callback.html\",\n \"mode\": \"33188\",\n \"license\": \"mit\",\n \"language\": [\n {\n \"name\": \"CSS\",\n \"bytes\": \"18667\"\n },\n {\n \"name\": \"JavaScript\",\n \"bytes\": \"57045\"\n },\n {\n \"name\": \"Shell\",\n \"bytes\": \"1208\"\n }\n ],\n \"symlink_target\": \"\"\n}"}}},{"rowIdx":384,"cells":{"text":{"kind":"string","value":"module ActiveRecord\n module Associations\n # = Active Record Has One Association\n class HasOneAssociation < SingularAssociation #:nodoc:\n include ForeignAssociation\n\n def handle_dependency\n case options[:dependent]\n when :restrict_with_exception\n raise ActiveRecord::DeleteRestrictionError.new(reflection.name) if load_target\n\n when :restrict_with_error\n if load_target\n record = owner.class.human_attribute_name(reflection.name).downcase\n owner.errors.add(:base, :'restrict_dependent_destroy.has_one', record: record)\n throw(:abort)\n end\n\n else\n delete\n end\n end\n\n def delete(method = options[:dependent])\n if load_target\n case method\n when :delete\n target.delete\n when :destroy\n target.destroyed_by_association = reflection\n target.destroy\n throw(:abort) unless target.destroyed?\n when :destroy_async\n primary_key_column = target.class.primary_key.to_sym\n id = target.public_send(primary_key_column)\n\n enqueue_destroy_association(\n owner_model_name: owner.class.to_s,\n owner_id: owner.id,\n association_class: reflection.klass.to_s,\n association_ids: [id],\n association_primary_key_column: primary_key_column,\n ensuring_owner_was_method: options.fetch(:ensuring_owner_was, nil)\n )\n when :nullify\n target.update_columns(nullified_owner_attributes) if target.persisted?\n end\n end\n end\n\n private\n def replace(record, save = true)\n raise_on_type_mismatch!(record) if record\n\n return target unless load_target || record\n\n assigning_another_record = target != record\n if assigning_another_record || record.has_changes_to_save?\n save &&= owner.persisted?\n\n transaction_if(save) do\n remove_target!(options[:dependent]) if target && !target.destroyed? && assigning_another_record\n\n if record\n set_owner_attributes(record)\n set_inverse_instance(record)\n\n if save && !record.save\n nullify_owner_attributes(record)\n set_owner_attributes(target) if target\n raise RecordNotSaved, \"Failed to save the new associated #{reflection.name}.\"\n end\n end\n end\n end\n\n self.target = record\n end\n\n # The reason that the save param for replace is false, if for create (not just build),\n # is because the setting of the foreign keys is actually handled by the scoping when\n # the record is instantiated, and so they are set straight away and do not need to be\n # updated within replace.\n def set_new_record(record)\n replace(record, false)\n end\n\n def remove_target!(method)\n case method\n when :delete\n target.delete\n when :destroy\n target.destroyed_by_association = reflection\n if target.persisted?\n target.destroy\n end\n else\n nullify_owner_attributes(target)\n remove_inverse_instance(target)\n\n if target.persisted? && owner.persisted? && !target.save\n set_owner_attributes(target)\n raise RecordNotSaved, \"Failed to remove the existing associated #{reflection.name}. \" \\\n \"The record failed to save after its foreign key was set to nil.\"\n end\n end\n end\n\n def nullify_owner_attributes(record)\n record[reflection.foreign_key] = nil\n end\n\n def transaction_if(value)\n if value\n reflection.klass.transaction { yield }\n else\n yield\n end\n end\n\n def _create_record(attributes, raise_error = false, &block)\n unless owner.persisted?\n raise ActiveRecord::RecordNotSaved, \"You cannot call create unless the parent is saved\"\n end\n\n super\n end\n end\n end\nend\n"},"meta":{"kind":"string","value":"{\n \"content_hash\": \"c3375d607f982c929df90a6cfd5df30b\",\n \"timestamp\": \"\",\n \"source\": \"github\",\n \"line_count\": 130,\n \"max_line_length\": 109,\n \"avg_line_length\": 32.815384615384616,\n \"alnum_prop\": 0.5745428973277075,\n \"repo_name\": \"vipulnsward/rails\",\n \"id\": \"d25f0fa55a863229370bf549fd094e0fe8dbf9c1\",\n \"size\": \"4297\",\n \"binary\": false,\n \"copies\": \"10\",\n \"ref\": \"refs/heads/master\",\n \"path\": \"activerecord/lib/active_record/associations/has_one_association.rb\",\n \"mode\": \"33188\",\n \"license\": \"mit\",\n \"language\": [\n {\n \"name\": \"CSS\",\n \"bytes\": \"47086\"\n },\n {\n \"name\": \"CoffeeScript\",\n \"bytes\": \"24534\"\n },\n {\n \"name\": \"HTML\",\n \"bytes\": \"495148\"\n },\n {\n \"name\": \"JavaScript\",\n \"bytes\": \"185195\"\n },\n {\n \"name\": \"Ruby\",\n \"bytes\": \"13331204\"\n },\n {\n \"name\": \"Shell\",\n \"bytes\": \"4531\"\n },\n {\n \"name\": \"Yacc\",\n \"bytes\": \"983\"\n }\n ],\n \"symlink_target\": \"\"\n}"}}},{"rowIdx":385,"cells":{"text":{"kind":"string","value":"
\n \n

this is product named

\n
"},"meta":{"kind":"string","value":"{\n \"content_hash\": \"fd9b2093c2da9a9514bc711aaa4d3c59\",\n \"timestamp\": \"\",\n \"source\": \"github\",\n \"line_count\": 4,\n \"max_line_length\": 53,\n \"avg_line_length\": 28.25,\n \"alnum_prop\": 0.5929203539823009,\n \"repo_name\": \"darkty2009/html-layout-tool\",\n \"id\": \"2843462baf3098aecea0cee0bd979682e0d5e14b\",\n \"size\": \"113\",\n \"binary\": false,\n \"copies\": \"1\",\n \"ref\": \"refs/heads/master\",\n \"path\": \"demo/page_compile/module/product-item.html\",\n \"mode\": \"33188\",\n \"license\": \"mit\",\n \"language\": [\n {\n \"name\": \"JavaScript\",\n \"bytes\": \"69945\"\n }\n ],\n \"symlink_target\": \"\"\n}"}}},{"rowIdx":386,"cells":{"text":{"kind":"string","value":"package uk.co.yottr.model;\n\nimport org.junit.Test;\n\nimport static org.junit.Assert.assertEquals;\n\n\n\npublic class SailingPurposeTest {\n @Test\n public void testGetDisplayName() throws Exception {\n assertEquals(\"Cruising\", SailingPurpose.CRUISING.getDisplayName());\n assertEquals(\"Racing\", SailingPurpose.RACING.getDisplayName());\n assertEquals(\"Long Term\", SailingPurpose.LONG_TERM.getDisplayName());\n assertEquals(\"Delivery\", SailingPurpose.DELIVERY.getDisplayName());\n assertEquals(\"Course\", SailingPurpose.COURSE.getDisplayName());\n }\n}"},"meta":{"kind":"string","value":"{\n \"content_hash\": \"7f68c136f0c2ea1fc42fd5833f638a3c\",\n \"timestamp\": \"\",\n \"source\": \"github\",\n \"line_count\": 18,\n \"max_line_length\": 77,\n \"avg_line_length\": 32.27777777777778,\n \"alnum_prop\": 0.7314974182444062,\n \"repo_name\": \"mikehartley/yottr\",\n \"id\": \"3a85d37d2cc97c99c5aac9faf594963a54d5c91c\",\n \"size\": \"661\",\n \"binary\": false,\n \"copies\": \"1\",\n \"ref\": \"refs/heads/master\",\n \"path\": \"src/test/java/uk/co/yottr/model/SailingPurposeTest.java\",\n \"mode\": \"33188\",\n \"license\": \"apache-2.0\",\n \"language\": [\n {\n \"name\": \"CSS\",\n \"bytes\": \"20426\"\n },\n {\n \"name\": \"Java\",\n \"bytes\": \"209412\"\n },\n {\n \"name\": \"JavaScript\",\n \"bytes\": \"1506\"\n }\n ],\n \"symlink_target\": \"\"\n}"}}},{"rowIdx":387,"cells":{"text":{"kind":"string","value":"\npackage com.sri.ai.praise.core.representation.interfacebased.factor.api;\n\nimport java.util.List;\n\npublic interface Variable {\n\tList getValues();\n}"},"meta":{"kind":"string","value":"{\n \"content_hash\": \"fdb76751c883fb9a20b7954c0b503d4c\",\n \"timestamp\": \"\",\n \"source\": \"github\",\n \"line_count\": 8,\n \"max_line_length\": 72,\n \"avg_line_length\": 20.625,\n \"alnum_prop\": 0.7818181818181819,\n \"repo_name\": \"aic-sri-international/aic-praise\",\n \"id\": \"583a176fc17d123c05ad2517681d6eb3152977c5\",\n \"size\": \"1950\",\n \"binary\": false,\n \"copies\": \"1\",\n \"ref\": \"refs/heads/master\",\n \"path\": \"src/main/java/com/sri/ai/praise/core/representation/interfacebased/factor/api/Variable.java\",\n \"mode\": \"33188\",\n \"license\": \"bsd-3-clause\",\n \"language\": [\n {\n \"name\": \"ANTLR\",\n \"bytes\": \"24960\"\n },\n {\n \"name\": \"CSS\",\n \"bytes\": \"1076\"\n },\n {\n \"name\": \"Java\",\n \"bytes\": \"1518608\"\n },\n {\n \"name\": \"MATLAB\",\n \"bytes\": \"166392\"\n }\n ],\n \"symlink_target\": \"\"\n}"}}},{"rowIdx":388,"cells":{"text":{"kind":"string","value":"\npackage org.sleuthkit.autopsy.commonfilessearch;\n\nimport java.io.File;\nimport java.io.IOException;\nimport java.nio.file.Path;\nimport java.nio.file.Paths;\nimport java.sql.SQLException;\nimport java.util.ArrayList;\nimport java.util.Collection;\nimport java.util.HashMap;\nimport java.util.Map;\nimport org.apache.commons.io.FileUtils;\nimport org.netbeans.junit.NbTestCase;\nimport org.openide.util.Exceptions;\nimport org.sleuthkit.autopsy.casemodule.Case;\nimport org.sleuthkit.autopsy.casemodule.ImageDSProcessor;\nimport org.sleuthkit.autopsy.centralrepository.datamodel.EamDbException;\nimport org.sleuthkit.autopsy.centralrepository.datamodel.EamDbPlatformEnum;\nimport org.sleuthkit.autopsy.centralrepository.datamodel.EamDbUtil;\nimport org.sleuthkit.autopsy.centralrepository.datamodel.SqliteEamDbSettings;\nimport org.sleuthkit.autopsy.ingest.IngestJobSettings;\nimport org.sleuthkit.autopsy.ingest.IngestJobSettings.IngestType;\nimport org.sleuthkit.autopsy.ingest.IngestModuleTemplate;\nimport org.sleuthkit.autopsy.modules.filetypeid.FileTypeIdModuleFactory;\nimport org.sleuthkit.autopsy.modules.hashdatabase.HashLookupModuleFactory;\nimport org.sleuthkit.autopsy.testutils.CaseUtils;\nimport org.sleuthkit.autopsy.testutils.IngestUtils;\nimport org.sleuthkit.datamodel.TskCoreException;\nimport junit.framework.Assert;\nimport org.sleuthkit.autopsy.casemodule.CaseActionException;\nimport org.sleuthkit.autopsy.casemodule.NoCurrentCaseException;\nimport org.sleuthkit.autopsy.centralrepository.datamodel.CorrelationAttributeInstance;\nimport org.sleuthkit.autopsy.centralrepository.datamodel.CorrelationCase;\nimport org.sleuthkit.autopsy.centralrepository.datamodel.EamDb;\nimport org.sleuthkit.autopsy.commonfilesearch.AbstractCommonAttributeInstance;\nimport org.sleuthkit.autopsy.commonfilesearch.CaseDBCommonAttributeInstanceNode;\nimport org.sleuthkit.autopsy.commonfilesearch.CentralRepoCommonAttributeInstance;\nimport org.sleuthkit.autopsy.commonfilesearch.CentralRepoCommonAttributeInstanceNode;\nimport org.sleuthkit.autopsy.commonfilesearch.CommonAttributeSearchResults;\nimport org.sleuthkit.autopsy.commonfilesearch.DataSourceLoader;\nimport org.sleuthkit.autopsy.commonfilesearch.CommonAttributeValue;\nimport org.sleuthkit.autopsy.commonfilesearch.CommonAttributeValueList;\nimport org.sleuthkit.autopsy.datamodel.DisplayableItemNode;\nimport org.sleuthkit.autopsy.modules.e01verify.E01VerifierModuleFactory;\nimport org.sleuthkit.autopsy.modules.embeddedfileextractor.EmbeddedFileExtractorModuleFactory;\nimport org.sleuthkit.autopsy.modules.exif.ExifParserModuleFactory;\nimport org.sleuthkit.autopsy.modules.fileextmismatch.FileExtMismatchDetectorModuleFactory;\nimport org.sleuthkit.autopsy.modules.iOS.iOSModuleFactory;\nimport org.sleuthkit.autopsy.modules.interestingitems.InterestingItemsIngestModuleFactory;\nimport org.sleuthkit.autopsy.modules.photoreccarver.PhotoRecCarverIngestModuleFactory;\nimport org.sleuthkit.autopsy.modules.vmextractor.VMExtractorIngestModuleFactory;\nimport org.sleuthkit.datamodel.AbstractFile;\n\n/**\n * Utilities for testing intercase correlation feature.\n *\n * This will be more useful when we add more flesh out the intercase correlation\n * features and need to add more tests. In particular, testing scenarios where\n * we need different cases to be the current case will suggest that we create\n * additional test classes, and we will want to import this utility in each new\n * intercase test file.\n *\n * Description of Test Data: (Note: files of the same name and extension are\n * identical; files of the same name and differing extension are not identical.)\n *\n * Case 1 +Data Set 1 - Hash-0.dat [testFile of size 0] - Hash-A.jpg -\n * Hash-A.pdf\n *\n * +Data Set2 - Hash-0.dat [testFile of size 0] - Hash-A.jpg - Hash-A.pdf\n *\n * Case 2 +Data Set 1 - Hash-B.jpg - Hash-B.pdf +Data Set 2 - Hash-A.jpg -\n * Hash-A.pdf - Hash_D.doc\n *\n * Case 3 +Data Set 1 - Hash-A.jpg - Hash-A.pdf - Hash-C.jpg - Hash-C.pdf -\n * Hash-D.jpg +Data Set 2 - Hash-C.jpg - Hash-C.pdf - Hash-D.doc\n *\n * Frequency Breakdown (ratio of datasources a given file appears in to total\n * number of datasources):\n *\n * Hash-0.dat - moot; these are always excluded Hash-A.jpg - 4/6 Hash-A.pdf -\n * 4/6 Hash-B.jpg - 1/6 Hash-B.pdf - 1/6 Hash-C.jpg - 2/6 Hash-C.pdf - 2/6\n * Hash_D.doc - 2/6 Hash-D.jpg - 1/6\n *\n */\nclass InterCaseTestUtils {\n\n private static final Path CENTRAL_REPO_DIRECTORY_PATH = Paths.get(System.getProperty(\"java.io.tmpdir\"), \"InterCaseCommonFilesSearchTest\");\n private static final String CR_DB_NAME = \"testcentralrepo.db\";\n\n static final String CASE1 = \"Case1\";\n static final String CASE2 = \"Case2\";\n static final String CASE3 = \"Case3\";\n static final String CASE4 = \"Case4\";\n\n final Path case1DataSet1Path;\n final Path case1DataSet2Path;\n final Path case2DataSet1Path;\n final Path case2DataSet2Path;\n final Path case3DataSet1Path;\n final Path case3DataSet2Path;\n\n static final String HASH_0_DAT = \"Hash-0.dat\";\n static final String HASH_A_JPG = \"Hash-A.jpg\";\n static final String HASH_A_PDF = \"Hash-A.pdf\";\n static final String HASH_B_JPG = \"Hash-B.jpg\";\n static final String HASH_B_PDF = \"Hash-B.pdf\";\n static final String HASH_C_JPG = \"Hash-C.jpg\";\n static final String HASH_C_PDF = \"Hash-C.pdf\";\n static final String HASH_D_JPG = \"Hash-D.jpg\";\n static final String HASH_D_DOC = \"Hash-D.doc\";\n\n static final String CASE1_DATASET_1 = \"c1ds1_v1.vhd\";\n static final String CASE1_DATASET_2 = \"c1ds2_v1.vhd\";\n static final String CASE2_DATASET_1 = \"c2ds1_v1.vhd\";\n static final String CASE2_DATASET_2 = \"c2ds2_v1.vhd\";\n static final String CASE3_DATASET_1 = \"c3ds1_v1.vhd\";\n static final String CASE3_DATASET_2 = \"c3ds2_v1.vhd\";\n\n final Path attrCase1Path;\n final Path attrCase2Path;\n final Path attrCase3Path;\n final Path attrCase4Path;\n\n static final String ATTR_CASE1 = \"CommonFilesAttrs_img1_v1.vhd\";\n static final String ATTR_CASE2 = \"CommonFilesAttrs_img2_v1.vhd\";\n static final String ATTR_CASE3 = \"CommonFilesAttrs_img3_v1.vhd\";\n static final String ATTR_CASE4 = \"CommonFilesAttrs_img4_v1.vhd\";\n\n private final ImageDSProcessor imageDSProcessor;\n\n private final IngestJobSettings hashAndFileType;\n private final IngestJobSettings hashAndNoFileType;\n private final IngestJobSettings kitchenShink;\n\n private final DataSourceLoader dataSourceLoader;\n\n CorrelationAttributeInstance.Type FILE_TYPE;\n CorrelationAttributeInstance.Type DOMAIN_TYPE;\n CorrelationAttributeInstance.Type USB_ID_TYPE;\n CorrelationAttributeInstance.Type EMAIL_TYPE;\n CorrelationAttributeInstance.Type PHONE_TYPE;\n\n InterCaseTestUtils(NbTestCase testCase) {\n\n this.case1DataSet1Path = Paths.get(testCase.getDataDir().toString(), CASE1_DATASET_1);\n this.case1DataSet2Path = Paths.get(testCase.getDataDir().toString(), CASE1_DATASET_2);\n this.case2DataSet1Path = Paths.get(testCase.getDataDir().toString(), CASE1_DATASET_1);\n this.case2DataSet2Path = Paths.get(testCase.getDataDir().toString(), CASE2_DATASET_2);\n this.case3DataSet1Path = Paths.get(testCase.getDataDir().toString(), CASE3_DATASET_1);\n this.case3DataSet2Path = Paths.get(testCase.getDataDir().toString(), CASE3_DATASET_2);\n\n this.attrCase1Path = Paths.get(testCase.getDataDir().toString(), ATTR_CASE1);\n this.attrCase2Path = Paths.get(testCase.getDataDir().toString(), ATTR_CASE2);\n this.attrCase3Path = Paths.get(testCase.getDataDir().toString(), ATTR_CASE3);\n this.attrCase4Path = Paths.get(testCase.getDataDir().toString(), ATTR_CASE4);\n\n this.imageDSProcessor = new ImageDSProcessor();\n\n final IngestModuleTemplate exifTemplate = IngestUtils.getIngestModuleTemplate(new ExifParserModuleFactory());\n final IngestModuleTemplate iOsTemplate = IngestUtils.getIngestModuleTemplate(new iOSModuleFactory());\n final IngestModuleTemplate embeddedFileExtractorTemplate = IngestUtils.getIngestModuleTemplate(new EmbeddedFileExtractorModuleFactory());\n final IngestModuleTemplate interestingItemsTemplate = IngestUtils.getIngestModuleTemplate(new InterestingItemsIngestModuleFactory());\n final IngestModuleTemplate mimeTypeLookupTemplate = IngestUtils.getIngestModuleTemplate(new FileTypeIdModuleFactory());\n final IngestModuleTemplate hashLookupTemplate = IngestUtils.getIngestModuleTemplate(new HashLookupModuleFactory());\n final IngestModuleTemplate vmExtractorTemplate = IngestUtils.getIngestModuleTemplate(new VMExtractorIngestModuleFactory());\n final IngestModuleTemplate photoRecTemplate = IngestUtils.getIngestModuleTemplate(new PhotoRecCarverIngestModuleFactory());\n final IngestModuleTemplate e01VerifierTemplate = IngestUtils.getIngestModuleTemplate(new E01VerifierModuleFactory());\n final IngestModuleTemplate eamDbTemplate = IngestUtils.getIngestModuleTemplate(new org.sleuthkit.autopsy.centralrepository.ingestmodule.IngestModuleFactory());\n final IngestModuleTemplate fileExtMismatchDetectorTemplate = IngestUtils.getIngestModuleTemplate(new FileExtMismatchDetectorModuleFactory());\n //TODO we need to figure out how to get ahold of these objects because they are required for properly filling the CR with test data\n// final IngestModuleTemplate objectDetectorTemplate = IngestUtils.getIngestModuleTemplate(new org.sleuthkit.autopsy.experimental.objectdetection.ObjectDetectionModuleFactory());\n// final IngestModuleTemplate emailParserTemplate = IngestUtils.getIngestModuleTemplate(new org.sleuthkit.autopsy.thunderbirdparser.EmailParserModuleFactory());\n// final IngestModuleTemplate recentActivityTemplate = IngestUtils.getIngestModuleTemplate(new org.sleuthkit.autopsy.recentactivity.RecentActivityExtracterModuleFactory());\n// final IngestModuleTemplate keywordSearchTemplate = IngestUtils.getIngestModuleTemplate(new org.sleuthkit.autopsy.keywordsearch.KeywordSearchModuleFactory());\n\n //hash and mime\n ArrayList hashAndMimeTemplate = new ArrayList<>(2);\n hashAndMimeTemplate.add(hashLookupTemplate);\n hashAndMimeTemplate.add(mimeTypeLookupTemplate);\n hashAndMimeTemplate.add(eamDbTemplate);\n\n this.hashAndFileType = new IngestJobSettings(InterCaseTestUtils.class.getCanonicalName(), IngestType.FILES_ONLY, hashAndMimeTemplate);\n\n //hash and no mime\n ArrayList hashAndNoMimeTemplate = new ArrayList<>(1);\n hashAndNoMimeTemplate.add(hashLookupTemplate);\n hashAndMimeTemplate.add(eamDbTemplate);\n\n this.hashAndNoFileType = new IngestJobSettings(InterCaseTestUtils.class.getCanonicalName(), IngestType.FILES_ONLY, hashAndNoMimeTemplate);\n\n //kitchen sink\n ArrayList kitchenSink = new ArrayList<>();\n kitchenSink.add(exifTemplate);\n kitchenSink.add(iOsTemplate);\n kitchenSink.add(embeddedFileExtractorTemplate);\n kitchenSink.add(interestingItemsTemplate);\n kitchenSink.add(mimeTypeLookupTemplate);\n kitchenSink.add(hashLookupTemplate);\n kitchenSink.add(vmExtractorTemplate);\n kitchenSink.add(photoRecTemplate);\n kitchenSink.add(e01VerifierTemplate);\n kitchenSink.add(eamDbTemplate);\n kitchenSink.add(fileExtMismatchDetectorTemplate);\n //TODO this list should probably be populated by way of loading the appropriate modules based on finding all of the @ServiceProvider(service = IngestModuleFactory.class) types\n// kitchenSink.add(objectDetectorTemplate);\n// kitchenSink.add(emailParserTemplate);\n// kitchenSink.add(recentActivityTemplate);\n// kitchenSink.add(keywordSearchTemplate);\n\n this.kitchenShink = new IngestJobSettings(InterCaseTestUtils.class.getCanonicalName(), IngestType.ALL_MODULES, kitchenSink);\n\n this.dataSourceLoader = new DataSourceLoader();\n\n try {\n Collection types = CorrelationAttributeInstance.getDefaultCorrelationTypes();\n\n //TODO use ids instead of strings\n FILE_TYPE = types.stream().filter(type -> type.getDisplayName().equals(\"Files\")).findAny().get();\n DOMAIN_TYPE = types.stream().filter(type -> type.getDisplayName().equals(\"Domains\")).findAny().get();\n USB_ID_TYPE = types.stream().filter(type -> type.getDisplayName().equals(\"USB Devices\")).findAny().get();\n EMAIL_TYPE = types.stream().filter(type -> type.getDisplayName().equals(\"Email Addresses\")).findAny().get();\n PHONE_TYPE = types.stream().filter(type -> type.getDisplayName().equals(\"Phone Numbers\")).findAny().get();\n\n } catch (EamDbException ex) {\n Assert.fail(ex.getMessage());\n\n //none of this really matters but satisfies the compiler\n FILE_TYPE = null;\n DOMAIN_TYPE = null;\n USB_ID_TYPE = null;\n EMAIL_TYPE = null;\n PHONE_TYPE = null;\n }\n }\n\n void clearTestDir() {\n if (CENTRAL_REPO_DIRECTORY_PATH.toFile().exists()) {\n try {\n if (EamDb.isEnabled()) {\n EamDb.getInstance().shutdownConnections();\n }\n FileUtils.deleteDirectory(CENTRAL_REPO_DIRECTORY_PATH.toFile());\n } catch (IOException | EamDbException ex) {\n Exceptions.printStackTrace(ex);\n Assert.fail(ex.getMessage());\n }\n }\n }\n\n Map getDataSourceMap() throws NoCurrentCaseException, TskCoreException, SQLException {\n return this.dataSourceLoader.getDataSourceMap();\n }\n\n Map getCaseMap() throws EamDbException {\n\n if (EamDb.isEnabled()) {\n Map mapOfCaseIdsToCase = new HashMap<>();\n\n for (CorrelationCase caze : EamDb.getInstance().getCases()) {\n mapOfCaseIdsToCase.put(caze.getDisplayName(), caze.getID());\n }\n return mapOfCaseIdsToCase;\n } else {\n //it is reasonable that this might happen...\n // for example when we test the feature in the absence of an enabled eamdb \n return new HashMap<>(0);\n }\n }\n\n IngestJobSettings getIngestSettingsForHashAndFileType() {\n return this.hashAndFileType;\n }\n\n IngestJobSettings getIngestSettingsForHashAndNoFileType() {\n return this.hashAndNoFileType;\n }\n\n IngestJobSettings getIngestSettingsForKitchenSink() {\n return this.kitchenShink;\n }\n\n void enableCentralRepo() throws EamDbException {\n\n SqliteEamDbSettings crSettings = new SqliteEamDbSettings();\n crSettings.setDbName(CR_DB_NAME);\n crSettings.setDbDirectory(CENTRAL_REPO_DIRECTORY_PATH.toString());\n if (!crSettings.dbDirectoryExists()) {\n crSettings.createDbDirectory();\n }\n\n crSettings.initializeDatabaseSchema();\n crSettings.insertDefaultDatabaseContent();\n\n crSettings.saveSettings();\n\n EamDbUtil.setUseCentralRepo(true);\n EamDbPlatformEnum.setSelectedPlatform(EamDbPlatformEnum.SQLITE.name());\n EamDbPlatformEnum.saveSelectedPlatform();\n }\n\n /**\n * Create the cases defined by caseNames and caseDataSourcePaths and ingest\n * each with the given settings. Null settings are permitted but IngestUtils\n * will not be run.\n *\n * The length of caseNames and caseDataSourcePaths should be the same, and\n * cases should appear in the same order.\n *\n * @param caseNames list case names\n * @param caseDataSourcePaths two dimensional array listing the datasources\n * in each case\n * @param ingestJobSettings HashLookup FileType etc...\n * @param caseReferenceToStore\n */\n Case createCases(String[] caseNames, Path[][] caseDataSourcePaths, IngestJobSettings ingestJobSettings, String caseReferenceToStore) throws TskCoreException {\n\n Case currentCase = null;\n\n if (caseNames.length != caseDataSourcePaths.length) {\n Assert.fail(new IllegalArgumentException(\"caseReferenceToStore should be one of the values given in the 'cases' parameter.\").getMessage());\n }\n\n String lastCaseName = null;\n Path[] lastPathsForCase = null;\n //iterate over the collections above, creating cases, and storing\n // just one of them for future reference\n for (int i = 0; i < caseNames.length; i++) {\n String caseName = caseNames[i];\n Path[] pathsForCase = caseDataSourcePaths[i];\n\n if (caseName.equals(caseReferenceToStore)) {\n //put aside and do this one last so we can hang onto the case\n lastCaseName = caseName;\n lastPathsForCase = pathsForCase;\n } else {\n //dont hang onto this case; close it\n this.createCase(caseName, ingestJobSettings, false, pathsForCase);\n }\n }\n\n if (lastCaseName != null && lastPathsForCase != null) {\n //hang onto this case and dont close it\n currentCase = this.createCase(lastCaseName, ingestJobSettings, true, lastPathsForCase);\n }\n\n if (currentCase == null) {\n Assert.fail(new IllegalArgumentException(\"caseReferenceToStore should be one of the values given in the 'cases' parameter.\").getMessage());\n return null;\n } else {\n return currentCase;\n }\n }\n\n private Case createCase(String caseName, IngestJobSettings ingestJobSettings, boolean keepAlive, Path... dataSetPaths) throws TskCoreException {\n /*\n * TODO (JIRA-4241): If the case already exists, do not recreate it.\n * Delete this code when the Image Gallery tool cleans up its drawable\n * database connection deterministically, instead of in a finalizer. As\n * it is now, case deletion can fail due to an open drawable database\n * file handles, so this unchanging case may still be hanging around.\n */\n Case existingCase = null;\n Path caseDirectoryPath = Paths.get(System.getProperty(\"java.io.tmpdir\"), caseName);\n File caseDirectory = caseDirectoryPath.toFile();\n if (caseDirectory.exists()) {\n if (keepAlive) {\n String metadataFileName = caseName + \".aut\";\n Path metadataFilePath = Paths.get(caseDirectoryPath.toString(), metadataFileName);\n try {\n Case.openAsCurrentCase(metadataFilePath.toString());\n existingCase = Case.getCurrentCaseThrows();\n } catch (CaseActionException | NoCurrentCaseException ex) {\n Exceptions.printStackTrace(ex);\n Assert.fail(String.format(\"Failed to open case %s at %s: %s\", caseName, caseDirectoryPath, ex.getMessage()));\n }\n }\n return existingCase;\n }\n\n Case caze = CaseUtils.createAsCurrentCase(caseName);\n for (Path dataSetPath : dataSetPaths) {\n IngestUtils.addDataSource(this.imageDSProcessor, dataSetPath);\n }\n if (ingestJobSettings != null) {\n IngestUtils.runIngestJob(caze.getDataSources(), ingestJobSettings);\n }\n if (keepAlive) {\n return caze;\n } else {\n CaseUtils.closeCurrentCase(false);\n return null;\n }\n }\n\n static boolean verifyInstanceCount(CommonAttributeSearchResults searchDomain, int instanceCount) {\n try {\n int tally = 0;\n\n for (Map.Entry entry : searchDomain.getMetadata().entrySet()) {\n entry.getValue().displayDelayedMetadata();\n for (CommonAttributeValue value : entry.getValue().getMetadataList()) {\n\n tally += value.getInstanceCount();\n }\n }\n\n return tally == instanceCount;\n\n } catch (EamDbException ex) {\n Exceptions.printStackTrace(ex);\n Assert.fail(ex.getMessage());\n return false;\n }\n }\n\n static boolean verifyInstanceExistenceAndCount(CommonAttributeSearchResults searchDomain, String fileName, String dataSource, String crCase, int instanceCount) {\n\n try {\n int tally = 0;\n\n for (Map.Entry entry : searchDomain.getMetadata().entrySet()) {\n entry.getValue().displayDelayedMetadata();\n for (CommonAttributeValue value : entry.getValue().getMetadataList()) {\n\n for (AbstractCommonAttributeInstance commonAttribute : value.getInstances()) {\n\n if (commonAttribute instanceof CentralRepoCommonAttributeInstance) {\n CentralRepoCommonAttributeInstance results = (CentralRepoCommonAttributeInstance) commonAttribute;\n for (DisplayableItemNode din : results.generateNodes()) {\n\n if (din instanceof CentralRepoCommonAttributeInstanceNode) {\n\n CentralRepoCommonAttributeInstanceNode node = (CentralRepoCommonAttributeInstanceNode) din;\n CorrelationAttributeInstance instance = node.getCorrelationAttributeInstance();\n\n final String fullPath = instance.getFilePath();\n final File testFile = new File(fullPath);\n\n final String testCaseName = instance.getCorrelationCase().getDisplayName();\n\n final String testFileName = testFile.getName();\n\n final String testDataSource = instance.getCorrelationDataSource().getName();\n\n boolean sameFileName = testFileName.equalsIgnoreCase(fileName);\n boolean sameDataSource = testDataSource.equalsIgnoreCase(dataSource);\n boolean sameCrCase = testCaseName.equalsIgnoreCase(crCase);\n\n if (sameFileName && sameDataSource && sameCrCase) {\n tally++;\n }\n }\n\n if (din instanceof CaseDBCommonAttributeInstanceNode) {\n\n CaseDBCommonAttributeInstanceNode node = (CaseDBCommonAttributeInstanceNode) din;\n AbstractFile file = node.getContent();\n\n final String testFileName = file.getName();\n final String testCaseName = node.getCase();\n final String testDataSource = node.getDataSource();\n\n boolean sameFileName = testFileName.equalsIgnoreCase(fileName);\n boolean sameCaseName = testCaseName.equalsIgnoreCase(crCase);\n boolean sameDataSource = testDataSource.equalsIgnoreCase(dataSource);\n\n if (sameFileName && sameDataSource && sameCaseName) {\n tally++;\n }\n }\n }\n } else {\n Assert.fail(\"Unable to cast AbstractCommonAttributeInstanceNode to InterCaseCommonAttributeSearchResults.\");\n }\n }\n }\n }\n\n return tally == instanceCount;\n\n } catch (EamDbException ex) {\n Exceptions.printStackTrace(ex);\n Assert.fail(ex.getMessage());\n return false;\n }\n }\n\n /**\n * Close the currently open case, delete the case directory, delete the\n * central repo db.\n */\n void tearDown() {\n CaseUtils.closeCurrentCase(false);\n }\n\n /**\n * Is everything in metadata a result of the given attribute type?\n *\n * @param metadata\n * @param attributeType\n *\n * @return true if yes, else false\n */\n boolean areAllResultsOfType(CommonAttributeSearchResults metadata, CorrelationAttributeInstance.Type attributeType) {\n try {\n for (CommonAttributeValueList matches : metadata.getMetadata().values()) {\n for (CommonAttributeValue value : matches.getMetadataList()) {\n return value\n .getInstances()\n .stream()\n .allMatch(inst -> inst.getCorrelationAttributeInstanceType().equals(attributeType));\n }\n return false;\n }\n return false;\n } catch (EamDbException ex) {\n Assert.fail(ex.getMessage());\n return false;\n }\n }\n}\n"},"meta":{"kind":"string","value":"{\n \"content_hash\": \"640e7e7c365dc8539f34d66bc3158003\",\n \"timestamp\": \"\",\n \"source\": \"github\",\n \"line_count\": 522,\n \"max_line_length\": 185,\n \"avg_line_length\": 48.024904214559385,\n \"alnum_prop\": 0.6756551916709881,\n \"repo_name\": \"millmanorama/autopsy\",\n \"id\": \"e4d6ae5dd8597e59fa3afb8f4999c3d2a4d43114\",\n \"size\": \"25757\",\n \"binary\": false,\n \"copies\": \"1\",\n \"ref\": \"refs/heads/develop\",\n \"path\": \"Core/test/qa-functional/src/org/sleuthkit/autopsy/commonfilessearch/InterCaseTestUtils.java\",\n \"mode\": \"33188\",\n \"license\": \"apache-2.0\",\n \"language\": [\n {\n \"name\": \"CSS\",\n \"bytes\": \"4467\"\n },\n {\n \"name\": \"HTML\",\n \"bytes\": \"9644\"\n },\n {\n \"name\": \"Java\",\n \"bytes\": \"11348573\"\n },\n {\n \"name\": \"Python\",\n \"bytes\": \"297069\"\n },\n {\n \"name\": \"Shell\",\n \"bytes\": \"9705\"\n }\n ],\n \"symlink_target\": \"\"\n}"}}},{"rowIdx":389,"cells":{"text":{"kind":"string","value":"using System;\n\nnamespace Structural.Facade\n{\n public interface IAuthorization\n {\n Guid Authorize(string userName, string password);\n void SignOut(Guid userToken);\n }\n}"},"meta":{"kind":"string","value":"{\n \"content_hash\": \"c5f062082d318d900afa58712f44feb2\",\n \"timestamp\": \"\",\n \"source\": \"github\",\n \"line_count\": 10,\n \"max_line_length\": 57,\n \"avg_line_length\": 19.1,\n \"alnum_prop\": 0.680628272251309,\n \"repo_name\": \"pavelekNET/DesignPatterns\",\n \"id\": \"321e013e7338766c451f7d8c2338dccb5f852639\",\n \"size\": \"193\",\n \"binary\": false,\n \"copies\": \"1\",\n \"ref\": \"refs/heads/master\",\n \"path\": \"DesignPatterns/Structural/Facade/IAuthorization.cs\",\n \"mode\": \"33188\",\n \"license\": \"mit\",\n \"language\": [\n {\n \"name\": \"C#\",\n \"bytes\": \"35009\"\n }\n ],\n \"symlink_target\": \"\"\n}"}}},{"rowIdx":390,"cells":{"text":{"kind":"string","value":" 'contacts/$1/dnc/add/$2', // 2.6.0\n 'contacts/(.*?)/dnc/(.*?)/remove' => 'contacts/$1/dnc/remove/$2' // 2.6.0\n );\n\n /**\n * {@inheritdoc}\n */\n protected $searchCommands = array(\n 'ids',\n 'is:anonymous',\n 'is:unowned',\n 'is:mine',\n 'name',\n 'email',\n 'segment',\n 'company',\n 'onwer',\n 'ip',\n 'common',\n );\n\n /**\n * @param string $search\n * @param int $start\n * @param int $limit\n * @param string $orderBy\n * @param string $orderByDir\n * @param bool $publishedOnly\n * @param bool $minimal\n *\n * @return array|mixed\n */\n public function getIdentified($search = '', $start = 0, $limit = 0, $orderBy = '', $orderByDir = 'ASC', $publishedOnly = false, $minimal = false)\n {\n $search .= ($search) ? \"$search !is:anonymous\" : '!is:anonymous';\n\n return $this->getList($search, $start, $limit, $orderBy, $orderByDir, $publishedOnly, $minimal);\n }\n\n /**\n * Get a list of users available as contact owners\n *\n * @return array|mixed\n */\n public function getOwners()\n {\n return $this->makeRequest($this->endpoint.'/list/owners');\n }\n\n /**\n * Get a list of custom fields\n *\n * @return array|mixed\n */\n public function getFieldList()\n {\n return $this->makeRequest($this->endpoint.'/list/fields');\n }\n\n /**\n * Get a list of contact segments\n *\n * @return array|mixed\n */\n public function getSegments()\n {\n return $this->makeRequest($this->endpoint.'/list/segments');\n }\n\n /**\n * Get a list of a contact's engagement events\n *\n * @param int $id Contact ID\n * @param string $search\n * @param array $includeEvents\n * @param array $excludeEvents\n * @param string $orderBy\n * @param string $orderByDir\n * @param int $page\n *\n * @return array|mixed\n */\n public function getEvents(\n $id,\n $search = '',\n array $includeEvents = array(),\n array $excludeEvents = array(),\n $orderBy = '',\n $orderByDir = 'ASC',\n $page = 1\n ) {\n $parameters = array(\n 'filters' => array(\n 'search' => $search,\n 'includeEvents' => $includeEvents,\n 'excludeEvents' => $excludeEvents,\n ),\n 'order' => array(\n $orderBy,\n $orderByDir,\n ),\n 'page' => $page\n );\n\n return $this->makeRequest(\n $this->endpoint.'/'.$id.'/events',\n $parameters\n );\n }\n\n /**\n * Get a list of a contact's notes\n *\n * @param int $id Contact ID\n * @param string $search\n * @param int $start\n * @param int $limit\n * @param string $orderBy\n * @param string $orderByDir\n *\n * @return array|mixed\n */\n public function getContactNotes($id, $search = '', $start = 0, $limit = 0, $orderBy = '', $orderByDir = 'ASC')\n {\n $parameters = array(\n 'search' => $search,\n 'start' => $start,\n 'limit' => $limit,\n 'orderBy' => $orderBy,\n 'orderByDir' => $orderByDir,\n );\n\n $parameters = array_filter($parameters);\n\n return $this->makeRequest($this->endpoint.'/'.$id.'/notes', $parameters);\n }\n\n /**\n * Get a list of a contact's devices\n *\n * @param int $id Contact ID\n * @param string $search\n * @param int $start\n * @param int $limit\n * @param string $orderBy\n * @param string $orderByDir\n *\n * @return array|mixed\n */\n public function getContactDevices($id, $search = '', $start = 0, $limit = 0, $orderBy = '', $orderByDir = 'ASC')\n {\n $parameters = array(\n 'search' => $search,\n 'start' => $start,\n 'limit' => $limit,\n 'orderBy' => $orderBy,\n 'orderByDir' => $orderByDir,\n );\n\n $parameters = array_filter($parameters);\n\n return $this->makeRequest($this->endpoint.'/'.$id.'/devices', $parameters);\n }\n\n /**\n * Get a list of smart segments the contact is in\n *\n * @param $id\n *\n * @return array|mixed\n */\n public function getContactSegments($id)\n {\n return $this->makeRequest($this->endpoint.'/'.$id.'/segments');\n }\n\n /**\n * Get a list of companies the contact is in\n *\n * @param $id\n *\n * @return array|mixed\n */\n public function getContactCompanies($id)\n {\n return $this->makeRequest($this->endpoint.'/'.$id.'/companies');\n }\n\n /**\n * Get a list of campaigns the contact is in\n *\n * @param $id\n *\n * @return array|mixed\n */\n public function getContactCampaigns($id)\n {\n return $this->makeRequest($this->endpoint.'/'.$id.'/campaigns');\n }\n\n /**\n * Add the points to a contact\n *\n * @param int $id\n * @param int $points\n * @param array $parameters 'eventName' and 'actionName'\n *\n * @return mixed\n */\n public function addPoints($id, $points, array $parameters = array())\n {\n return $this->makeRequest('contacts/'.$id.'/points/plus/'.$points, $parameters, 'POST');\n }\n\n /**\n * Subtract points from a contact\n *\n * @param int $id\n * @param int $points\n * @param array $parameters 'eventName' and 'actionName'\n *\n * @return mixed\n */\n public function subtractPoints($id, $points, array $parameters = array())\n {\n return $this->makeRequest('contacts/'.$id.'/points/minus/'.$points, $parameters, 'POST');\n }\n\n /**\n * Adds Do Not Contact\n *\n * @param int $id\n * @param string $channel\n * @param int $reason\n * @param null $channelId\n * @param string $comments\n *\n * @return array|mixed\n */\n public function addDnc($id, $channel = 'email', $reason = Contacts::MANUAL, $channelId = null, $comments = 'via API') {\n\n return $this->makeRequest(\n 'contacts/'.$id.'/dnc/'.$channel.'/add',\n array(\n 'reason' => $reason,\n 'channelId' => $channelId,\n 'comments' => $comments,\n ),\n 'POST'\n );\n }\n\n /**\n * Removes Do Not Contact\n *\n * @param int $id\n * @param string $channel\n *\n * @return mixed\n */\n public function removeDnc($id, $channel)\n {\n return $this->makeRequest(\n 'contacts/'.$id.'/dnc/'.$channel.'/remove',\n array(),\n 'POST'\n );\n }\n}\n"},"meta":{"kind":"string","value":"{\n \"content_hash\": \"8075adab8822aabdc1afcf749d877d83\",\n \"timestamp\": \"\",\n \"source\": \"github\",\n \"line_count\": 314,\n \"max_line_length\": 149,\n \"avg_line_length\": 23.75796178343949,\n \"alnum_prop\": 0.4957104557640751,\n \"repo_name\": \"mandino/nu\",\n \"id\": \"41587d68a198b859857739917335f8f1b2b9f070\",\n \"size\": \"7656\",\n \"binary\": false,\n \"copies\": \"6\",\n \"ref\": \"refs/heads/master\",\n \"path\": \"wp-content/plugins/hustle/vendor/mautic/api-library/lib/Api/Contacts.php\",\n \"mode\": \"33188\",\n \"license\": \"mit\",\n \"language\": [\n {\n \"name\": \"CSS\",\n \"bytes\": \"2534865\"\n },\n {\n \"name\": \"HTML\",\n \"bytes\": \"131438\"\n },\n {\n \"name\": \"JavaScript\",\n \"bytes\": \"3766596\"\n },\n {\n \"name\": \"Modelica\",\n \"bytes\": \"10338\"\n },\n {\n \"name\": \"PHP\",\n \"bytes\": \"19289064\"\n },\n {\n \"name\": \"Perl\",\n \"bytes\": \"2554\"\n },\n {\n \"name\": \"Shell\",\n \"bytes\": \"1145\"\n }\n ],\n \"symlink_target\": \"\"\n}"}}},{"rowIdx":391,"cells":{"text":{"kind":"string","value":"\n\n\n\n\n\norg.jivesoftware.smackx.workgroup.ext.forms (Smack 3.3.0 Documentation)\n\n\n\n\n\n\n\n\n\n\n\norg.jivesoftware.smackx.workgroup.ext.forms\n\n\n\n\n
\nClasses&nbsp;\n\n
\nWorkgroupForm\n
\nWorkgroupForm.InternalProvider
\n\n\n\n\n"},"meta":{"kind":"string","value":"{\n \"content_hash\": \"3ff797ffa72d1e1610d6992781adf497\",\n \"timestamp\": \"\",\n \"source\": \"github\",\n \"line_count\": 34,\n \"max_line_length\": 173,\n \"avg_line_length\": 34.55882352941177,\n \"alnum_prop\": 0.6987234042553192,\n \"repo_name\": \"UzxMx/java-bells\",\n \"id\": \"83b42b32e1272c43a38b590792a23f249aedfe8d\",\n \"size\": \"1175\",\n \"binary\": false,\n \"copies\": \"3\",\n \"ref\": \"refs/heads/master\",\n \"path\": \"lib-src/smack_src_3_3_0/javadoc/org/jivesoftware/smackx/workgroup/ext/forms/package-frame.html\",\n \"mode\": \"33188\",\n \"license\": \"bsd-3-clause\",\n \"language\": [\n {\n \"name\": \"C\",\n \"bytes\": \"446956\"\n },\n {\n \"name\": \"C++\",\n \"bytes\": \"1572\"\n },\n {\n \"name\": \"HTML\",\n \"bytes\": \"38549\"\n },\n {\n \"name\": \"Java\",\n \"bytes\": \"11455869\"\n },\n {\n \"name\": \"Objective-C\",\n \"bytes\": \"44632\"\n }\n ],\n \"symlink_target\": \"\"\n}"}}},{"rowIdx":392,"cells":{"text":{"kind":"string","value":"package org.skk.tide;\n\n\n/**\n * The runtime exception thrown when a registered handler does handle the specified event.\n *\n * When a handler registers for an event, the handle method needs to be annotated with {@link org.skk.tide.HandleEvent}.\n * If it does not, {@link org.skk.tide.HandlerMethodNotFoundException} is thrown at runtime\n */\npublic class HandlerMethodNotFoundException extends Exception {\n private final Class handlerClass;\n private final Class eventClass;\n\n public HandlerMethodNotFoundException(Class handlerClass, Class eventClass) {\n\n this.handlerClass = handlerClass;\n this.eventClass = eventClass;\n }\n\n @Override\n public String getMessage() {\n return \"No handler method found for event \" + eventClass + \" on handler \" + handlerClass + \". Make sure the method is annotated with @HandleEvent passing the event class and it takes only one or no arguments\";\n }\n}\n"},"meta":{"kind":"string","value":"{\n \"content_hash\": \"831899a8b0b467a3b55a5882cd7df452\",\n \"timestamp\": \"\",\n \"source\": \"github\",\n \"line_count\": 24,\n \"max_line_length\": 217,\n \"avg_line_length\": 41.791666666666664,\n \"alnum_prop\": 0.7367896311066799,\n \"repo_name\": \"abyu/tide\",\n \"id\": \"df6690bc9a06635cbefb55511b35f6b911214d17\",\n \"size\": \"1003\",\n \"binary\": false,\n \"copies\": \"1\",\n \"ref\": \"refs/heads/master\",\n \"path\": \"src/main/java/org/skk/tide/HandlerMethodNotFoundException.java\",\n \"mode\": \"33188\",\n \"license\": \"apache-2.0\",\n \"language\": [\n {\n \"name\": \"Java\",\n \"bytes\": \"24983\"\n }\n ],\n \"symlink_target\": \"\"\n}"}}},{"rowIdx":393,"cells":{"text":{"kind":"string","value":"\n\n \n\t \n \n\t