{ // 获取包含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":"{'content_hash': '579c1af52bcb896f2d1594a965c738be', 'timestamp': '', 'source': 'github', 'line_count': 121, 'max_line_length': 272, 'avg_line_length': 46.47933884297521, 'alnum_prop': 0.6205547652916074, 'repo_name': 'OxyTeam/OxyEngine', 'id': '002d768936d04f1edd87b0c494a0627c57c4d275', 'size': '5624', 'binary': False, 'copies': '1', 'ref': 'refs/heads/develop', 'path': 'docs/html/class_oxy_1_1_framework_1_1_input_map.html', 'mode': '33188', 'license': 'mit', 'language': [{'name': 'C#', 'bytes': '128159'}]}"}}},{"rowIdx":849407,"cells":{"text":{"kind":"string","value":"declare function makeValue(): T;\n\nexport type BigIntLiteral = 1n;\nexport const BigIntLiteralType = makeValue<1n>();\n\nexport type NegativeBigIntLiteral = -1n;\nexport const NegativeBigIntLiteralType = makeValue<-1n>();\n\nexport type NumArray = number[];\nexport const numArray = makeValue();\n\nexport type BigIntAlias = bigint;\n\nexport type NegativeOne = -1;\nexport const negativeOne = -1;\n\nexport type FirstIfString = T extends [\n infer S extends string,\n ...unknown[]\n]\n ? S\n : never;\n"},"meta":{"kind":"string","value":"{'content_hash': 'ad0a3696950c82185e2c7605bbc426fd', 'timestamp': '', 'source': 'github', 'line_count': 22, 'max_line_length': 60, 'avg_line_length': 24.0, 'alnum_prop': 0.7159090909090909, 'repo_name': 'TypeStrong/typedoc', 'id': 'db679fab776e5357866c782b667d45fa4514c838', 'size': '528', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'src/test/converter/types/general.ts', 'mode': '33188', 'license': 'apache-2.0', 'language': [{'name': 'Batchfile', 'bytes': '189'}, {'name': 'CSS', 'bytes': '27924'}, {'name': 'JavaScript', 'bytes': '23874'}, {'name': 'Shell', 'bytes': '433'}, {'name': 'TypeScript', 'bytes': '1207272'}]}"}}},{"rowIdx":849408,"cells":{"text":{"kind":"string","value":"using namespace DirectX;\n\n#include \n\nBitmapClass::BitmapClass()\n{\n\tm_vertexBuffer = 0;\n\tm_indexBuffer = 0;\n\tm_Texture = 0;\n}\n\nBitmapClass::~BitmapClass()\n{\n}\n\nbool BitmapClass::Initialize(ID3D11Device* device, WCHAR* textureFilename,\n\t\t\t\t\t\t\t int screenWidth, int screenHeight, int bitmapWidth, int bitmapHeight)\n{\n\tbool result;\n\n\t// Store the screen size.\n\tm_screenWidth = screenWidth;\n\tm_screenHeight = screenHeight;\n\n\t// Store the size in pixels that this bitmap should be rendered at.\n\tm_bitmapWidth = bitmapWidth;\n\tm_bitmapHeight = bitmapHeight;\n\n\t// Initialize the previous rendering position to negative one.\n\tm_previousPosX = -1;\n\tm_previousPosY = -1;\n\n\t// Initialize the vertex and index buffer that hold the geometry for the triangle.\n\tresult = InitializeBuffers(device);\n\tif(!result)\n\t{\n\t\treturn false;\n\t}\n\n\t// Load the texture for this model.\n\tresult = LoadTexture(device, textureFilename);\n\tif(!result)\n\t{\n\t\treturn false;\n\t}\n\n\n\treturn true;\n}\n\nbool BitmapClass::Render(ID3D11DeviceContext* deviceContext, int positionX, int positionY)\n{\n\tbool result;\n\t// Re-build the dynamic vertex buffer for rendering to possibly a different location on the screen.\n\tresult = UpdateBuffers(deviceContext, positionX, positionY);\n\tif(!result){\n\t\treturn false;\n\t}\n\n\t// Put the vertex and index buffers on the graphics pipeline to prepare them for drawing.\n\tRenderBuffers(deviceContext);\n\treturn true;\n}\n\nvoid BitmapClass::Shutdown()\n{\n\t// Release the model texture.\n\tReleaseTexture();\n\n\t// Release the vertex and index buffers.\n\tShutdownBuffers();\n\n}\n\nID3D11ShaderResourceView* BitmapClass::GetTexture()\n{\n\treturn m_Texture->GetTexture();\n}\n\n\nint BitmapClass::GetIndexCount()\n{\n\treturn m_indexCount;\n}\n\n\nbool BitmapClass::InitializeBuffers(ID3D11Device* device)\n{\n\n\tm_vertexCount = m_indexCount = 6;\n\n\t// Create the vertex array.\n\tVertexType* vertices;\n\tvertices = new VertexType[m_vertexCount];\n\tif(!vertices)\n\t{\n\t\treturn false;\n\t}\n\n\t// Create the index array.\n\tunsigned long* indices;\n\tindices = new unsigned long[m_indexCount];\n\tif(!indices)\n\t{\n\t\treturn false;\n\t}\n\n\t// Initialize vertex array to zeros at first.\n\tZeroMemory(vertices, (sizeof(VertexType) * m_vertexCount));\n\n\n\t// Load the index array with data.\n\tfor(int i=0; iCreateBuffer(&vertexBufferDesc, &vertexData, &m_vertexBuffer);\n\tif(FAILED(result))\n\t{\n\t\treturn false;\n\t}\n\n\t// Set up the description of the static index buffer.\n\tD3D11_BUFFER_DESC indexBufferDesc;\n\tindexBufferDesc.Usage = D3D11_USAGE_DEFAULT;\n\tindexBufferDesc.ByteWidth = sizeof(unsigned long) * m_indexCount;\n\tindexBufferDesc.BindFlags = D3D11_BIND_INDEX_BUFFER;\n\tindexBufferDesc.CPUAccessFlags = 0;\n\tindexBufferDesc.MiscFlags = 0;\n\tindexBufferDesc.StructureByteStride = 0;\n\n\t// Give the subresource structure a pointer to the index data.\n\tD3D11_SUBRESOURCE_DATA indexData;\n\tindexData.pSysMem = indices;\n\tindexData.SysMemPitch = 0;\n\tindexData.SysMemSlicePitch = 0;\n\n\t// Create the index buffer.\n\tresult = device->CreateBuffer(&indexBufferDesc, &indexData, &m_indexBuffer);\n\tif(FAILED(result))\n\t{\n\t\treturn false;\n\t}\n\n\t// Release the arrays now that the vertex and index buffers have been created and loaded.\n\tdelete [] vertices;\n\tvertices = 0;\n\n\tdelete [] indices;\n\tindices = 0;\n\n\treturn true;\n}\n\nbool BitmapClass::UpdateBuffers(ID3D11DeviceContext* deviceContext, int positionX, int positionY)\n{\n\n\n\t// If the position we are rendering this bitmap to has not changed then don't update the vertex buffer since it\n\t// currently has the correct parameters.\n\tif((positionX == m_previousPosX) && (positionY == m_previousPosY))\n\t{\n\t\treturn true;\n\t}\n\n\t// If it has changed then update the position it is being rendered to.\n\tm_previousPosX = positionX;\n\tm_previousPosY = positionY;\n\n\tfloat left, right, top, bottom;\n\n\t// Calculate the screen coordinates of the left side of the bitmap.\n\tleft = (float)((m_screenWidth / 2) * -1) + (float)positionX;\n\n\t// Calculate the screen coordinates of the right side of the bitmap.\n\tright = left + (float)m_bitmapWidth;\n\n\t// Calculate the screen coordinates of the top of the bitmap.\n\ttop = (float)(m_screenHeight / 2) - (float)positionY;\n\n\t// Calculate the screen coordinates of the bottom of the bitmap.\n\tbottom = top - (float)m_bitmapHeight;\n\n\tstd::cout << \"left: \" << left << \" \" << \"right: \" << right << \" \" << \"top: \" << top << \" \" << \"bottom: \" << bottom << std::endl;\n\n\t// Create the vertex array.\n\tVertexType* vertices;\n\tvertices = new VertexType[m_vertexCount];\n\tif(!vertices)\n\t{\n\t\treturn false;\n\t}\n\n\t// Load the vertex array with data.\n\t// First triangle.\n\tvertices[0].position = XMFLOAT3(left, top, 0.0f); // Top left.\n\tvertices[0].texture = XMFLOAT2(0.0f, 0.0f);\n\n\tvertices[1].position = XMFLOAT3(right, bottom, 0.0f); // Bottom right.\n\tvertices[1].texture = XMFLOAT2(1.0f, 1.0f);\n\n\tvertices[2].position = XMFLOAT3(left, bottom, 0.0f); // Bottom left.\n\tvertices[2].texture = XMFLOAT2(0.0f, 1.0f);\n\n\t// Second triangle.\n\tvertices[3].position = XMFLOAT3(left, top, 0.0f); // Top left.\n\tvertices[3].texture = XMFLOAT2(0.0f, 0.0f);\n\n\tvertices[4].position = XMFLOAT3(right, top, 0.0f); // Top right.\n\tvertices[4].texture = XMFLOAT2(1.0f, 0.0f);\n\n\tvertices[5].position = XMFLOAT3(right, bottom, 0.0f); // Bottom right.\n\tvertices[5].texture = XMFLOAT2(1.0f, 1.0f);\n\n\t// Lock the vertex buffer so it can be written to.\n\tHRESULT result;\n\tD3D11_MAPPED_SUBRESOURCE mappedResource;\n\tresult = deviceContext->Map(m_vertexBuffer, 0, D3D11_MAP_WRITE_DISCARD, 0, &mappedResource);\n\tif(FAILED(result))\n\t{\n\t\treturn false;\n\t}\n\n\t// Get a pointer to the data in the vertex buffer\n\tVertexType* verticesPtr;\n\tverticesPtr = (VertexType*)mappedResource.pData;\n\n\t// Copy the data into the vertex buffer.\n\tmemcpy(verticesPtr, (void*)vertices, (sizeof(VertexType) * m_vertexCount));\n\n\t// Unlock the vertex buffer.\n\tdeviceContext->Unmap(m_vertexBuffer, 0);\n\n\t// Release the vertex array as it is no longer needed.\n\tdelete [] vertices;\n\tvertices = 0;\n\n\treturn true;\n}\n\nvoid BitmapClass::RenderBuffers(ID3D11DeviceContext* deviceContext)\n{\n\tunsigned int stride;\n\tunsigned int offset;\n\n\t// Set vertex buffer stride and offset.\n\tstride = sizeof(VertexType); \n\toffset = 0;\n\n\t// Set the vertex buffer to active in the input assembler so it can be rendered.\n\tdeviceContext->IASetVertexBuffers(0, 1, &m_vertexBuffer, &stride, &offset);\n\n\t// Set the index buffer to active in the input assembler so it can be rendered.\n\tdeviceContext->IASetIndexBuffer(m_indexBuffer, DXGI_FORMAT_R32_UINT, 0);\n\n\t// Set the type of primitive that should be rendered from this vertex buffer, in this case triangles.\n\tdeviceContext->IASetPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY_TRIANGLELIST);\n}\n\nvoid BitmapClass::ShutdownBuffers()\n{\n\t// Release the index buffer.\n\tif(m_indexBuffer)\n\t{\n\t\tm_indexBuffer->Release();\n\t\tm_indexBuffer = 0;\n\t}\n\n\t// Release the vertex buffer.\n\tif(m_vertexBuffer)\n\t{\n\t\tm_vertexBuffer->Release();\n\t\tm_vertexBuffer = 0;\n\t}\n}\nbool BitmapClass::LoadTexture(ID3D11Device* device, WCHAR* filename)\n{\n\tbool result;\n\n\n\t// Create the texture object.\n\tm_Texture = new TextureClass;\n\tif(!m_Texture)\n\t{\n\t\treturn false;\n\t}\n\n\t// Initialize the texture object.\n\tresult = m_Texture->Initialize(device, filename);\n\tif(!result)\n\t{\n\t\treturn false;\n\t}\n\n\treturn true;\n}\n\nvoid BitmapClass::ReleaseTexture()\n{\n\t// Release the texture object.\n\tif(m_Texture)\n\t{\n\t\tm_Texture->Shutdown();\n\t\tdelete m_Texture;\n\t\tm_Texture = 0;\n\t}\n}\n"},"meta":{"kind":"string","value":"{'content_hash': 'b1ba4dce3125385c254d228ccc18f7e7', 'timestamp': '', 'source': 'github', 'line_count': 325, 'max_line_length': 129, 'avg_line_length': 24.815384615384616, 'alnum_prop': 0.7217606943583385, 'repo_name': 'Cassio90/engine', 'id': '7d76aa25f1c3e5b1bd8cec05d5c71fce028507eb', 'size': '8091', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'Engine/BitmapClass.cpp', 'mode': '33188', 'license': 'mit', 'language': [{'name': 'C', 'bytes': '2058'}, {'name': 'C++', 'bytes': '244283'}]}"}}},{"rowIdx":849409,"cells":{"text":{"kind":"string","value":"![0 stars](../../images/ic_star_border_black_18dp_1x.png)![0 stars](../../images/ic_star_border_black_18dp_1x.png)![0 stars](../../images/ic_star_border_black_18dp_1x.png)![0 stars](../../images/ic_star_border_black_18dp_1x.png)![0 stars](../../images/ic_star_border_black_18dp_1x.png) 0\n\nTo use the Who Played Bond - 007 Trivia skill, try saying...\n\n* *Alexa, open Who Played Bond*\n\nThink you know the James Bond films? Put your knowledge to the test with this Alexa Trivia Skill.\n\nAlexa will ask you \"Who Played Bond\" in 5 different 007 movies. Your job is to match up the correct actors with each movie. \n\nEnjoy!\n\n***\n\n### Skill Details\n\n* **Invocation Name:** who played bond\n* **Category:** null\n* **ID:** amzn1.echo-sdk-ams.app.052b92cd-025f-4b4e-92cf-fef35214b7de\n* **ASIN:** B01DEYA56M\n* **Author:** JGDev!\n* **Release Date:** March 25, 2016 @ 03:07:49\n* **In-App Purchasing:** No\n"},"meta":{"kind":"string","value":"{'content_hash': '26c875dcfcc7ef970f85e8fb3db07a8e', 'timestamp': '', 'source': 'github', 'line_count': 23, 'max_line_length': 287, 'avg_line_length': 38.65217391304348, 'alnum_prop': 0.6850393700787402, 'repo_name': 'dale3h/alexa-skills-list', 'id': '87bed5f368dbda2b39b5aa4a75c072cf368b10ce', 'size': '1015', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'skills/B01DEYA56M/README.md', 'mode': '33188', 'license': 'mit', 'language': [{'name': 'JavaScript', 'bytes': '16985'}]}"}}},{"rowIdx":849410,"cells":{"text":{"kind":"string","value":"/**\n* Config file for the API\n*/\nexports.db_url = 'mongodb://localhost/my_mongorilla';"},"meta":{"kind":"string","value":"{'content_hash': '8055012150eba71a49d9f2625101f007', 'timestamp': '', 'source': 'github', 'line_count': 4, 'max_line_length': 53, 'avg_line_length': 21.5, 'alnum_prop': 0.686046511627907, 'repo_name': 'shoptology/boilerplate', 'id': '28b86229c39d679967a33a4f6b1c295978c0d03e', 'size': '86', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'api/config.js', 'mode': '33261', 'license': 'mit', 'language': [{'name': 'Batchfile', 'bytes': '5124'}, {'name': 'CSS', 'bytes': '2423672'}, {'name': 'HTML', 'bytes': '2677337'}, {'name': 'JavaScript', 'bytes': '13933823'}, {'name': 'Makefile', 'bytes': '5620'}, {'name': 'PHP', 'bytes': '188824'}, {'name': 'PowerShell', 'bytes': '161'}, {'name': 'Python', 'bytes': '11423'}, {'name': 'Ruby', 'bytes': '2205'}, {'name': 'Shell', 'bytes': '111'}]}"}}},{"rowIdx":849411,"cells":{"text":{"kind":"string","value":".\n\n\n\n\ndefined('MOODLE_INTERNAL') || die();\n\n\n/**\n * Provides the information to backup multianswer questions\n *\n * @copyright 2010 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}\n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\nclass backup_qtype_multianswer_plugin extends backup_qtype_plugin {\n\n /**\n * Returns the qtype information to attach to question element\n */\n protected function define_question_plugin_structure() {\n\n // Define the virtual plugin element with the condition to fulfill.\n $plugin = $this->get_plugin_element(null, '../../qtype', 'multianswer');\n\n // Create one standard named plugin element (the visible container).\n $pluginwrapper = new backup_nested_element($this->get_recommended_name());\n\n // Connect the visible container ASAP.\n $plugin->add_child($pluginwrapper);\n\n // This qtype uses standard question_answers, add them here\n // to the tree before any other information that will use them.\n $this->add_question_question_answers($pluginwrapper);\n\n // Now create the qtype own structures.\n $multianswer = new backup_nested_element('multianswer', array('id'), array(\n 'question', 'sequence'));\n\n // Now the own qtype tree.\n $pluginwrapper->add_child($multianswer);\n\n // Set source to populate the data.\n $multianswer->set_source_table('question_multianswer',\n array('question' => backup::VAR_PARENTID));\n\n // Don't need to annotate ids nor files.\n\n return $plugin;\n }\n}\n"},"meta":{"kind":"string","value":"{'content_hash': 'ac47b24412086c75e2ae1fc8527b9c3c', 'timestamp': '', 'source': 'github', 'line_count': 64, 'max_line_length': 83, 'avg_line_length': 35.734375, 'alnum_prop': 0.675120244862265, 'repo_name': 'sirromas/george', 'id': 'afe1b64c8f1aa05250534ec60392552207d16888', 'size': '2501', 'binary': False, 'copies': '512', 'ref': 'refs/heads/master', 'path': 'lms/question/type/multianswer/backup/moodle2/backup_qtype_multianswer_plugin.class.php', 'mode': '33188', 'license': 'mit', 'language': [{'name': 'ActionScript', 'bytes': '1205'}, {'name': 'ApacheConf', 'bytes': '240'}, {'name': 'CSS', 'bytes': '1510088'}, {'name': 'Gherkin', 'bytes': '1801305'}, {'name': 'HTML', 'bytes': '9090317'}, {'name': 'Java', 'bytes': '14870'}, {'name': 'JavaScript', 'bytes': '13189901'}, {'name': 'PHP', 'bytes': '80552810'}, {'name': 'PLSQL', 'bytes': '4867'}, {'name': 'Perl', 'bytes': '20769'}, {'name': 'XSLT', 'bytes': '33489'}]}"}}},{"rowIdx":849412,"cells":{"text":{"kind":"string","value":"using System.Threading.Tasks;\nusing System.Diagnostics.Contracts;\n\nnamespace System.Linq.Parallel\n{\n /// \n /// Partitioned stream recipient that will merge the results. \n /// \n internal class PartitionedStreamMerger : IPartitionedStreamRecipient\n {\n private bool _forEffectMerge;\n private ParallelMergeOptions _mergeOptions;\n private bool _isOrdered;\n private MergeExecutor _mergeExecutor = null;\n private TaskScheduler _taskScheduler;\n private int _queryId; // ID of the current query execution\n\n private CancellationState _cancellationState;\n\n#if DEBUG\n private bool _received = false;\n#endif\n // Returns the merge executor which merges the received partitioned stream.\n internal MergeExecutor MergeExecutor\n {\n get\n {\n#if DEBUG\n Contract.Assert(_received, \"Cannot return the merge executor because Receive() has not been called yet.\");\n#endif\n return _mergeExecutor;\n }\n }\n\n internal PartitionedStreamMerger(bool forEffectMerge, ParallelMergeOptions mergeOptions, TaskScheduler taskScheduler, bool outputOrdered,\n CancellationState cancellationState, int queryId)\n {\n _forEffectMerge = forEffectMerge;\n _mergeOptions = mergeOptions;\n _isOrdered = outputOrdered;\n _taskScheduler = taskScheduler;\n _cancellationState = cancellationState;\n _queryId = queryId;\n }\n\n public void Receive(PartitionedStream partitionedStream)\n {\n#if DEBUG\n _received = true;\n#endif\n _mergeExecutor = MergeExecutor.Execute(\n partitionedStream, _forEffectMerge, _mergeOptions, _taskScheduler, _isOrdered, _cancellationState, _queryId);\n\n TraceHelpers.TraceInfo(\"[timing]: {0}: finished opening - QueryOperator<>::GetEnumerator\", DateTime.Now.Ticks);\n }\n }\n}"},"meta":{"kind":"string","value":"{'content_hash': 'f1e879500a20a0baf53af5ecfcdf332d', 'timestamp': '', 'source': 'github', 'line_count': 57, 'max_line_length': 145, 'avg_line_length': 36.08771929824562, 'alnum_prop': 0.6562955760816723, 'repo_name': 'dmitry-shechtman/corefx', 'id': '417ad54d301820b50a779e2c6c0f4a2e8d3970dd', 'size': '2426', 'binary': False, 'copies': '3', 'ref': 'refs/heads/master', 'path': 'src/System.Linq.Parallel/src/System/Linq/Parallel/QueryOperators/PartitionedStreamMerger.cs', 'mode': '33188', 'license': 'mit', 'language': [{'name': 'Batchfile', 'bytes': '1598'}, {'name': 'C#', 'bytes': '15067107'}, {'name': 'C++', 'bytes': '127'}, {'name': 'Visual Basic', 'bytes': '1609'}]}"}}},{"rowIdx":849413,"cells":{"text":{"kind":"string","value":"package com.neoranga55.cleanguitestarchitecture.cucumber.steps;\n\nimport android.support.test.espresso.EspressoException;\n\nimport com.neoranga55.cleanguitestarchitecture.util.SpoonScreenshotAction;\n\nimport java.io.File;\nimport java.io.FileInputStream;\nimport java.io.IOException;\n\nimport cucumber.api.Scenario;\nimport cucumber.api.java.After;\nimport cucumber.api.java.Before;\nimport cucumber.api.java.en.Given;\n\n/**\n * Class containing generic Cucumber test step definitions not related to specific views\n */\npublic class HelperSteps {\n\n private static Scenario scenario;\n\n @Before\n public static void before(final Scenario scenario) {\n HelperSteps.scenario = scenario;\n }\n\n public static Scenario getScenario() {\n return HelperSteps.scenario;\n }\n\n @After\n public static void after() {\n if ((HelperSteps.scenario != null) && (HelperSteps.scenario.isFailed())) {\n takeScreenshot(\"failed\");\n }\n }\n\n @Given(\"^I take a screenshot$\")\n public void i_take_a_screenshot() {\n takeScreenshot(\"screenshot\");\n }\n\n /**\n * Take a screenshot of the current activity and embed it in the HTML report\n *\n * @param tag Name of the screenshot to include in the file name\n */\n public static void takeScreenshot(final String tag) {\n if (scenario == null) {\n throw new ScreenshotException(\"Error taking screenshot: I'm missing a valid test scenario to attach the screenshot to\");\n }\n SpoonScreenshotAction.perform(tag);\n final File screenshot = SpoonScreenshotAction.getLastScreenshot();\n if (screenshot == null) {\n throw new ScreenshotException(\"Screenshot was not taken correctly, check for failures in screenshot library\");\n }\n FileInputStream screenshotStream = null;\n try {\n screenshotStream = new FileInputStream(screenshot);\n final byte fileContent[] = new byte[(int) screenshot.length()];\n final int readImageBytes = screenshotStream.read(fileContent); // Read data from input image file into an array of bytes\n if (readImageBytes != -1) {\n scenario.embed(fileContent, \"image/png\"); // Embed the screenshot in the report under current test step\n }\n } catch (final IOException ioe) {\n throw new ScreenshotException(\"Exception while reading file \" + ioe);\n } finally {\n try { // close the streams using close method\n if (screenshotStream != null) {\n screenshotStream.close();\n }\n } catch (final IOException ioe) {\n //noinspection ThrowFromFinallyBlock\n throw new ScreenshotException(\"Error while closing screenshot stream: \" + ioe);\n }\n }\n }\n\n public static class ScreenshotException extends RuntimeException implements EspressoException {\n private static final long serialVersionUID = -1247022787790657324L;\n\n ScreenshotException(final String message) {\n super(message);\n }\n }\n\n}"},"meta":{"kind":"string","value":"{'content_hash': 'ae5de26d814a822f7036e78a72e7f0c7', 'timestamp': '', 'source': 'github', 'line_count': 88, 'max_line_length': 132, 'avg_line_length': 35.21590909090909, 'alnum_prop': 0.6556953856082607, 'repo_name': 'whembed197923/CleanGUITestArchitecture', 'id': '363f7b5d3fa0a29ec245155159da28fc088a78db', 'size': '3099', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'app/src/androidTest/java/com/neoranga55/cleanguitestarchitecture/cucumber/steps/HelperSteps.java', 'mode': '33188', 'license': 'mit', 'language': [{'name': 'Cucumber', 'bytes': '981'}, {'name': 'Java', 'bytes': '26954'}]}"}}},{"rowIdx":849414,"cells":{"text":{"kind":"string","value":"This is a Chrome extension that translates nasty troll terms into 💕 emojis ✨. \n\nIt's not about sanitizing, but making your browser a place with less hate and more 🌺 🐣 🙊 🐳. \n\nRead that article, scan the comments, and be free of the hate speech and threatening language of internet trolls. \n\nAnd remember, DON'T FEED THE TROLLS. \n\n\n## Install\n\nPull down zip file. Unzip. \n\nIn your Chrome browser, select \"More Tools.\" Select \"Extensions.\"\n\nSelect \"Load unpacked extension...\" and choose the unzipped file. \n\n\n## Usage\n\nClick the troll icon in your browser to trollmoji a page. \n\nIf you have suggestions for new words or phrases to add to the library, get at us at trollmoji@gmail.com. \n\n\n##\nThis was made with [emojilib](https://github.com/muan/emojilib) and [emoji-translate](https://github.com/notwaldorf/emoji-translate).\n"},"meta":{"kind":"string","value":"{'content_hash': '877d95e1189288cf7aa48f83f473b5a2', 'timestamp': '', 'source': 'github', 'line_count': 27, 'max_line_length': 133, 'avg_line_length': 30.48148148148148, 'alnum_prop': 0.7448359659781288, 'repo_name': 'ITP-DevPubInt/emoji-translate', 'id': '23bb98171dde40131af4a889cf2d6f6ccb28c342', 'size': '854', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'README.md', 'mode': '33188', 'license': 'mit', 'language': [{'name': 'JavaScript', 'bytes': '3695'}]}"}}},{"rowIdx":849415,"cells":{"text":{"kind":"string","value":"package com.walkertribe.ian.protocol.core;\n\nimport org.junit.Test;\n\nimport com.walkertribe.ian.util.TestUtil;\n\npublic class CorePacketTypeTest {\n\t@Test\n\tpublic void makeEclEmmaHappy() {\n\t\tTestUtil.coverPrivateConstructor(CorePacketType.class);\n\t}\n}\n"},"meta":{"kind":"string","value":"{'content_hash': 'e9a9980296b829157f81b808dbbd8a73', 'timestamp': '', 'source': 'github', 'line_count': 12, 'max_line_length': 57, 'avg_line_length': 20.75, 'alnum_prop': 0.7951807228915663, 'repo_name': 'rjwut/ian', 'id': 'b27fffdad40db30e865ef5f3ad8cfdab89d66edb', 'size': '249', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'src/test/java/com/walkertribe/ian/protocol/core/CorePacketTypeTest.java', 'mode': '33188', 'license': 'mit', 'language': [{'name': 'Java', 'bytes': '875325'}]}"}}},{"rowIdx":849416,"cells":{"text":{"kind":"string","value":"\r\n\r\npackage com.siriusit.spezg.multilib.jsf.login;\r\n\r\nimport java.io.IOException;\r\n\r\nimport javax.annotation.Resource;\r\nimport javax.faces.context.ExternalContext;\r\nimport javax.faces.context.FacesContext;\r\nimport javax.servlet.RequestDispatcher;\r\nimport javax.servlet.ServletException;\r\nimport javax.servlet.ServletRequest;\r\nimport javax.servlet.ServletResponse;\r\n\r\nimport org.springframework.context.annotation.Scope;\r\nimport org.springframework.stereotype.Controller;\r\n\r\n/**\r\n * \r\n * @author Tommy Bø \r\n * @author Svein Erik Løvland \r\n */\r\n@Controller(\"loginBean\")\r\n@Scope(\"request\")\r\npublic class LoginBean {\r\n\r\n private String username;\r\n private String password;\r\n private boolean rememberMe;\r\n @Resource\r\n private FacesContext context;\r\n\r\n public String logIn() throws IOException, ServletException {\r\n ExternalContext externalContext = context.getExternalContext();\r\n ServletRequest servletRequest = (ServletRequest) externalContext.getRequest();\r\n RequestDispatcher dispatcher = servletRequest.getRequestDispatcher(\"/j_spring_security_check\");\r\n dispatcher.forward((ServletRequest) externalContext.getRequest(),\r\n (ServletResponse) externalContext.getResponse());\r\n context.responseComplete();\r\n return null;\r\n }\r\n\r\n public String getPassword() {\r\n return password;\r\n }\r\n\r\n public void setPassword(String password) {\r\n this.password = password;\r\n }\r\n\r\n public String getUsername() {\r\n return username;\r\n }\r\n\r\n public void setUsername(String username) {\r\n this.username = username;\r\n }\r\n\r\n public void setRememberMe(boolean rememberMe) {\r\n this.rememberMe = rememberMe;\r\n }\r\n\r\n public boolean isRememberMe() {\r\n return rememberMe;\r\n }\r\n}\r\n"},"meta":{"kind":"string","value":"{'content_hash': '2645038deb080d6b07fa9473a5c3d882', 'timestamp': '', 'source': 'github', 'line_count': 66, 'max_line_length': 103, 'avg_line_length': 28.166666666666668, 'alnum_prop': 0.6944593867670791, 'repo_name': 'sveintl/Multilib', 'id': '7ecfd9665448da26589811099910c6a74c8d998e', 'size': '2679', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'multilib-war/src/main/java/com/siriusit/spezg/multilib/jsf/login/LoginBean.java', 'mode': '33188', 'license': 'apache-2.0', 'language': []}"}}},{"rowIdx":849417,"cells":{"text":{"kind":"string","value":"/* eslint-disable */\n/**\n * Generated React hooks.\n *\n * THIS CODE IS AUTOMATICALLY GENERATED.\n *\n * Generated by convex@0.2.0.\n * To regenerate, run `npx convex codegen`.\n * @module\n */\n\nimport type {\n ApiFromModules,\n OptimisticLocalStore as GenericOptimisticLocalStore,\n} from \"convex/browser\";\nimport type {\n UseQueryForAPI,\n UseMutationForAPI,\n UseConvexForAPI,\n} from \"convex/react\";\nimport type * as getCounter from \"../getCounter\";\nimport type * as incrementCounter from \"../incrementCounter\";\n\n/**\n * A type describing your app's public Convex API.\n *\n * This `ConvexAPI` type includes information about the arguments and return\n * types of your app's query and mutation functions.\n *\n * This type should be used with type-parameterized classes like\n * `ConvexReactClient` to create app-specific types.\n */\nexport type ConvexAPI = ApiFromModules<{\n getCounter: typeof getCounter;\n incrementCounter: typeof incrementCounter;\n}>;\n\n/**\n * Load a reactive query within a React component.\n *\n * This React hook contains internal state that will cause a rerender whenever\n * the query result changes.\n *\n * This relies on the {@link ConvexProvider} being above in the React component tree.\n *\n * @param name - The name of the query function.\n * @param args - The arguments to the query function.\n * @returns `undefined` if loading and the query's return value otherwise.\n */\nexport declare const useQuery: UseQueryForAPI;\n\n/**\n * Construct a new {@link ReactMutation}.\n *\n * Mutation objects can be called like functions to request execution of the\n * corresponding Convex function, or further configured with\n * [optimistic updates](https://docs.convex.dev/using/optimistic-updates).\n *\n * The value returned by this hook is stable across renders, so it can be used\n * by React dependency arrays and memoization logic relying on object identity\n * without causing rerenders.\n *\n * This relies on the {@link ConvexProvider} being above in the React component tree.\n *\n * @param name - The name of the mutation.\n * @returns The {@link ReactMutation} object with that name.\n */\nexport declare const useMutation: UseMutationForAPI;\n\n/**\n * Get the {@link ConvexReactClient} within a React component.\n *\n * This relies on the {@link ConvexProvider} being above in the React component tree.\n *\n * @returns The active {@link ConvexReactClient} object, or `undefined`.\n */\nexport declare const useConvex: UseConvexForAPI;\n\n/**\n * A view of the query results currently in the Convex client for use within\n * optimistic updates.\n */\nexport type OptimisticLocalStore = GenericOptimisticLocalStore;\n"},"meta":{"kind":"string","value":"{'content_hash': 'aebb16e16e325e2896875a86cae6e836', 'timestamp': '', 'source': 'github', 'line_count': 83, 'max_line_length': 85, 'avg_line_length': 31.83132530120482, 'alnum_prop': 0.7452687358062074, 'repo_name': 'JeromeFitz/next.js', 'id': '53b69d9b1246a612df41e2a54f796c3072beeb7c', 'size': '2642', 'binary': False, 'copies': '1', 'ref': 'refs/heads/canary', 'path': 'examples/convex/convex/_generated/react.d.ts', 'mode': '33188', 'license': 'mit', 'language': [{'name': 'Batchfile', 'bytes': '579'}, {'name': 'CSS', 'bytes': '38864'}, {'name': 'JavaScript', 'bytes': '8065763'}, {'name': 'Rust', 'bytes': '165055'}, {'name': 'SCSS', 'bytes': '5957'}, {'name': 'Sass', 'bytes': '302'}, {'name': 'Shell', 'bytes': '4512'}, {'name': 'TypeScript', 'bytes': '4906530'}]}"}}},{"rowIdx":849418,"cells":{"text":{"kind":"string","value":"\"\"\"Compare two Graphite clusters for a given list of queries.\n\nThrough this module, a \"query\" is \"the name of a query\", a string.\n\"\"\"\nfrom __future__ import unicode_literals\nfrom __future__ import absolute_import\nfrom __future__ import print_function\nimport argparse\nimport urllib2\nimport json\nimport base64\nimport time\nimport sys\nimport logging\nimport urllib\nimport collections\nimport progressbar\nimport operator\nimport abc\nimport netrc\n\n\nclass Error(Exception):\n \"\"\"Error.\"\"\"\n\n\nclass RequestError(Error):\n \"\"\"RequestError.\"\"\"\n\n\nclass Request(object):\n \"\"\"Runs HTTP requests and parses JSON.\"\"\"\n\n def __init__(self, url, auth_key, timeout_s, data=None):\n \"\"\"Create a Request.\"\"\"\n self._request = self._prepare(url, auth_key, data=data)\n self._timeout_s = timeout_s\n\n def _prepare(self, url, auth_key, data=None):\n \"\"\"Create an http request.\"\"\"\n headers = {}\n if auth_key is not None:\n headers[\"Authorization\"] = \"Basic %s\" % auth_key\n request = urllib2.Request(url, data, headers)\n return request\n\n def _parse_request_result(self, json_str):\n \"\"\"Parse a jsonObject into a list of DiffableTarget.\"\"\"\n if not json_str:\n return []\n\n try:\n json_data = json.loads(json_str)\n except ValueError:\n return []\n\n diffable_targets = []\n for json_object in json_data:\n if \"target\" not in json_object:\n continue\n\n target = json_object[\"target\"]\n # target are not always formated in the same way in every cluster, so we delete spaces\n target = target.replace(\" \", \"\")\n\n ts_to_val = {ts: val for val, ts in json_object[\"datapoints\"]}\n\n diffable_targets.append(DiffableTarget(target, ts_to_val))\n return diffable_targets\n\n def execute(self):\n \"\"\"Execute the request and returns a list of DiffableTarget, time_s.\"\"\"\n start = time.time()\n diffable_targets = []\n try:\n response = urllib2.urlopen(self._request, timeout=self._timeout_s)\n json_str = response.read()\n diffable_targets = self._parse_request_result(json_str)\n except IOError as e:\n raise RequestError(e)\n time_s = time.time() - start\n\n return (diffable_targets, time_s)\n\n\nclass HostResult(object):\n \"\"\"Store all information on a given host.\"\"\"\n\n def __init__(self, name):\n \"\"\"Create a HostResult.\"\"\"\n self.name = name\n self.query_to_error = {}\n self.query_to_time_s = {}\n self.diffable_queries = []\n\n def add_error(self, query, e):\n \"\"\"Add an error message for a given query.\"\"\"\n self.query_to_error[query] = \"%s\" % e\n\n def add_time_s(self, query, time_s):\n \"\"\"Add a recorded time to fetch a query.\"\"\"\n self.query_to_time_s[query] = time_s\n\n def add_diffable_query(self, diffable_query):\n \"\"\"Add a diffable_query to the list.\"\"\"\n self.diffable_queries.append(diffable_query)\n\n def compute_timing_pctls(self):\n \"\"\"Compute a dict of pctl from query_to_time_s values.\"\"\"\n return _compute_pctls(self.query_to_time_s.values())\n\n def get_error_to_query(self):\n \"\"\"Reverse query_to_error to get error_to_queries.\"\"\"\n error_to_queries = collections.defaultdict(list)\n for query, err in self.query_to_error.iteritems():\n error_to_queries[err].append(query)\n return error_to_queries\n\n\nclass Diffable(object):\n \"\"\"ABC for diffable objects.\"\"\"\n\n __metaclass__ = abc.ABCMeta\n\n @abc.abstractmethod\n def measure_dissymmetry(self, other):\n \"\"\"Return measure of difference as a Dissymmetry.\"\"\"\n pass\n\n\nclass DiffableTarget(Diffable):\n \"\"\"DiffableTarget.\"\"\"\n\n def __init__(self, name, ts_to_val):\n \"\"\"DiffableTarget.\"\"\"\n self.name = name\n self.ts_to_val = ts_to_val\n\n def _measure_relative_gap(self, val1, val2):\n if val1 == val2:\n return 0.0\n\n if val1 is None or val2 is None:\n return 1.0\n\n return abs(val1 - val2)/(abs(val1)+abs(val2))\n\n def measure_dissymmetry(self, other):\n \"\"\"Return measure of difference as a Dissymmetry.\"\"\"\n other_ts_to_val = other.ts_to_val if other else {}\n all_ts_set = self.ts_to_val.viewkeys() | other_ts_to_val.viewkeys()\n\n if not all_ts_set:\n return None\n\n val_tuples = [(self.ts_to_val.get(ts), other_ts_to_val.get(ts)) for ts in all_ts_set]\n diff_measures = [self._measure_relative_gap(val1, val2) for val1, val2 in val_tuples]\n\n return Dissymmetry(self.name, diff_measures)\n\n\nclass DiffableQuery(Diffable):\n \"\"\"DiffableQuery.\"\"\"\n\n def __init__(self, name, diffable_targets, threshold):\n \"\"\"Create a DiffableQuery.\"\"\"\n self.name = name\n self.threshold = threshold\n self.diffable_targets = diffable_targets\n\n def _measure_non_equal_pts_percentage(self, diffable_targets1, diffable_targets2, threshold):\n if not diffable_targets1 or not diffable_targets2:\n return 1.0\n\n # if target_dissymmetry is None, both host responses were empty for this target name\n target_dissymmetry = diffable_targets1.measure_dissymmetry(diffable_targets2)\n if not target_dissymmetry:\n return 0.0\n\n val_diff_measures = target_dissymmetry.measures\n count = 0\n for val_diff_measure in val_diff_measures:\n if val_diff_measure > threshold:\n count += 1\n\n return float(count) / len(val_diff_measures)\n\n def measure_dissymmetry(self, other):\n \"\"\"Return measure of difference as a Dissymmetry.\"\"\"\n # For each couple of diffable_target it calls measure_dissymmetries\n # and measure the percentage of non-equal points using a threshold.\n diffable_target_tuples = _outer_join_diffables(\n self.diffable_targets, other.diffable_targets)\n\n if not diffable_target_tuples:\n return None\n\n diff_measures = [self._measure_non_equal_pts_percentage(diffable_target1,\n diffable_target2,\n self.threshold)\n for diffable_target1, diffable_target2 in diffable_target_tuples]\n return Dissymmetry(self.name, diff_measures)\n\n\nclass Dissymmetry(object):\n \"\"\"Dissymmetry.\"\"\"\n\n def __init__(self, name, measures):\n \"\"\"Create a Dissymmetry.\"\"\"\n self.name = name\n self.measures = measures\n self.pctls = _compute_pctls(measures)\n\n def get_99th(self):\n \"\"\"Return only the 99pctl.\n\n Usefull to sort Percentiles.\n \"\"\"\n return self.pctls.get(99, None)\n\n\nclass Printer(object):\n \"\"\"ABC for printers.\"\"\"\n\n __metaclass__ = abc.ABCMeta\n\n QUERY_PCTLS_DESCRIPTION = \"Percentage of almost non-equal points using threshold\"\n TARGET_PCTLS_DESCRIPTION = \"Percentage of dyssymmetries between values\"\n TIMING_PCTLS_DESCRIPTION = \"Durations in second to fetch queries\"\n\n @abc.abstractmethod\n def print_parameters(self, opts):\n \"\"\"Print all parameters of the script.\"\"\"\n pass\n\n @abc.abstractmethod\n def print_dissymetry_results(self, query_dissymmetries, query_to_target_dissymmetries,\n verbosity, show_max):\n \"\"\"Print all percentiles per query and per target.\n\n The list is limited with the show_max parameter\n and target percentiles are shown only if the verbose parameter is True.\n \"\"\"\n pass\n\n @abc.abstractmethod\n def print_errors(self, hosts, error_counts_tuple, error_to_queries_tuple, verbosity):\n \"\"\"Print per host the number of errors and the number of occurrences of errors.\n\n If the verbose parameter is True,\n the list of queries affected are printed after each error.\n \"\"\"\n pass\n\n @abc.abstractmethod\n def print_times(self, hosts, timing_pctls_tuple, query_to_time_s_tuple, verbosity, show_max):\n \"\"\"Print per host the durations percentiles for fetching queries.\n\n If the verbose parameter is True, the list of the slowest queries is printed,\n limited with the show_max parameter.\n \"\"\"\n pass\n\n\nclass TxtPrinter(Printer):\n \"\"\"TxtPrinter.\"\"\"\n\n def __init__(self, fp=None):\n \"\"\"Create a txt Printer.\"\"\"\n self._file = fp or sys.stdout\n\n def _print(self, *args, **kwargs):\n \"\"\"Print in a given file.\"\"\"\n kwargs[\"file\"] = self._file\n print(*args, **kwargs)\n\n def _format_header(self, header_title):\n seq = [\n \"\",\n \"\".center(30, \"=\"),\n header_title.upper().center(30, \"=\")\n ]\n return \"\\n\".join(seq)\n\n def _format_pctl(self, pctls, nth, unit):\n val = pctls.get(nth)\n if unit == \"%\":\n val *= 100\n return \"%s pctl : %0.3f %s\" % (nth, val, unit)\n\n def print_parameters(self, opts):\n \"\"\"See Printer. Print all parameters of the script.\"\"\"\n seq = [\n self._format_header(\"Parameters\"),\n \"|\",\n \"| netrc_filename : %s\" % (opts.netrc_filename or \"$HOME/$USER/.netrc\"),\n \"|\",\n \"| hosts :\",\n \"| \\t- %s\" % opts.hosts[0],\n \"| \\t- %s\" % opts.hosts[1],\n \"|\",\n \"| inputs filename : %s\" % opts.input_filename,\n \"| \\t- from : %s\" % opts.from_param,\n \"| \\t- until : %s\" % opts.until_param,\n \"| \\t- timeout : %s seconds\" % opts.timeout_s,\n \"| \\t- threshold : %s %%\" % opts.threshold,\n \"|\",\n \"| outputs filename : %s\" % (opts.output_filename or \"stdout\"),\n \"| \\t- max number of shown results : %s\" % opts.show_max,\n \"| \\t- verbosity : %s\" % opts.verbosity,\n \"|\",\n ]\n self._print(\"\\n\".join(seq))\n\n def _print_pctls(self, name, pctls, prefix=\"\", chip=\"\", delay=\"\"):\n self._print(\"\\n %s %s %s : %s\" % (delay, chip, prefix, name))\n if pctls is None:\n return\n for k in pctls.iterkeys():\n if prefix == \"host\":\n self._print(\"\\t%s %s\" % (delay, self._format_pctl(pctls, k, unit=\"s\")))\n else:\n self._print(\"\\t%s %s\" % (delay, self._format_pctl(pctls, k, unit=\"%\")))\n\n def print_dissymetry_results(self, query_dissymmetries, query_to_target_dissymmetries,\n verbosity, show_max):\n \"\"\"See Printer. Print all percentiles per query and per target.\n\n The list is limited with the show_max parameter\n and target percentiles are shown only if the verbose parameter is True.\n \"\"\"\n self._print(self._format_header(\"Comparison results\"))\n\n all_query_dissymmetries_count = len(query_dissymmetries)\n query_dissymmetries = [query_dissymmetry\n for query_dissymmetry in query_dissymmetries if query_dissymmetry]\n self._print(\"\\nThere was %s queries with empty response on both clusters.\" % (\n all_query_dissymmetries_count - len(query_dissymmetries)))\n\n query_dissymmetries = sorted(\n query_dissymmetries, key=Dissymmetry.get_99th, reverse=True)\n del query_dissymmetries[show_max:]\n\n self._print(\"\\nThe %s most dissymmetrical queries : \" % show_max)\n self._print(\"%s for : \" % Printer.QUERY_PCTLS_DESCRIPTION)\n for query_dissymmetry in query_dissymmetries:\n self._print_pctls(query_dissymmetry.name,\n query_dissymmetry.pctls,\n \"query\", chip=\">\")\n\n if verbosity >= 1:\n self._print(\"\\n\\tThe %s most dissymmetrical targets : \" % show_max)\n self._print(\"\\t%s for : \" % Printer.TARGET_PCTLS_DESCRIPTION)\n for target_dissymmetry in query_to_target_dissymmetries[query_dissymmetry.name]:\n self._print_pctls(target_dissymmetry.name,\n target_dissymmetry.pctls,\n \"target\", chip=\">>\", delay=\"\\t\")\n\n def print_errors(self, hosts, error_counts_tuple, error_to_queries_tuple, verbosity):\n \"\"\"See Printer. Print per host the number of errors and the number of occurrences of errors.\n\n If the verbose parameter is True,\n the list of queries affected are printed after each error.\n \"\"\"\n self._print(self._format_header(\"Error report\"))\n for i, host in enumerate(hosts):\n error_counts = error_counts_tuple[i]\n total_errors = 0\n for error, count in error_counts:\n total_errors += count\n\n self._print(\"\\nThere was %s error(s) for %s\" % (total_errors, host))\n\n if error_counts:\n error_to_queries = error_to_queries_tuple[i]\n self._print(\"\\tError counts : \")\n for (error, count) in error_counts:\n self._print(\"\\t > %s : %s\" % (error, count))\n\n if verbosity >= 1:\n for query in error_to_queries[error]:\n self._print(\"\\t\\t >> %s \" % query)\n\n def print_times(self, hosts, timing_pctls_tuple, query_to_time_s_tuple, verbosity, show_max):\n \"\"\"See Printer. Print per host the durations percentiles for fetching queries.\n\n If the verbose parameter is True, the list of the slowest queries is printed,\n limited with the show_max parameter.\n \"\"\"\n self._print(self._format_header(\"Timing info\"))\n\n self._print(\"\\n%s for : \" % Printer.TIMING_PCTLS_DESCRIPTION)\n for i in range(2):\n host = hosts[i]\n timing_pctls = timing_pctls_tuple[i]\n self._print_pctls(host, timing_pctls, prefix=\"host\")\n\n if verbosity >= 1:\n query_to_time_s = query_to_time_s_tuple[i]\n query_time_s = sorted(\n query_to_time_s.items(), key=operator.itemgetter(1), reverse=True)\n del query_time_s[show_max:]\n self._print(\"\\n\\tThe %s slowest queries : \" % show_max)\n for (query, time_s) in query_time_s:\n self._print(\"\\t > %s : %s\" % (query, time_s))\n\n\ndef _read_queries(filename):\n \"\"\"Read the list of queries from a given input text file.\"\"\"\n with open(filename, \"r\") as f:\n lines = f.readlines()\n\n queries = []\n for line in lines:\n query = line.partition(\"#\")[0]\n query = query.strip()\n if not query:\n continue\n queries.append(query)\n return queries\n\n\ndef _get_url_from_query(host, prefix, query, from_param, until_param):\n \"\"\"Encode an url from a given query for a given host.\"\"\"\n # If the query is not already url-friendly, we make it be\n if \"%\" not in query:\n query = urllib.quote(query)\n\n url = \"http://%s/render/?noCache&format=json&from=%s&until=%s&target=%s\" % (\n host, from_param, until_param, prefix + query)\n return url\n\n\ndef fetch_queries(host, prefix, auth_key, queries,\n from_param, until_param, timeout_s, threshold, progress_cb):\n \"\"\"Return a list of HostResult.\"\"\"\n host_result = HostResult(host)\n for n, query in enumerate(queries):\n url = _get_url_from_query(host, prefix, query, from_param, until_param)\n request = Request(url, auth_key, timeout_s)\n try:\n diffable_targets, time_s = request.execute()\n host_result.add_time_s(query, time_s)\n host_result.add_diffable_query(DiffableQuery(query, diffable_targets, threshold))\n except RequestError as e:\n host_result.add_error(query, e)\n host_result.add_diffable_query(DiffableQuery(query, [], threshold))\n\n progress_cb(n)\n return host_result\n\n\ndef _compute_pctls(measures):\n \"\"\"Return 50pctl, 90pctl, 99pctl, and 999pctl in a dict for the given dissymetries.\"\"\"\n # If measures is empty, then one of the diffables was empty and not the other,\n # so the dissymmetry pctls should all be set at 100%\n if not measures:\n return None\n\n pctls = collections.OrderedDict()\n\n sorted_measures = sorted(measures)\n for i in [50, 75, 90, 99, 99.9]:\n # Don't even try to interpolate.\n rank = int(i / 100. * (len(measures)))\n pctls[i] = sorted_measures[rank]\n\n return pctls\n\n\ndef compute_dissymmetries(diffables_a, diffables_b):\n \"\"\"Return a list of dissymmetry from two given diffable lists.\"\"\"\n if not diffables_a and not diffables_b:\n return []\n\n dissymmetries = []\n for a, b in _outer_join_diffables(diffables_a, diffables_b):\n if not a:\n dissymmetry = b.measure_dissymmetry(a)\n else:\n dissymmetry = a.measure_dissymmetry(b)\n dissymmetries.append(dissymmetry)\n return dissymmetries\n\n\ndef _outer_join_diffables(diffables_a, diffables_b):\n \"\"\"Return a safe list of tuples of diffables whose name is equal.\"\"\"\n index_a = {a.name: a for a in diffables_a}\n index_b = {b.name: b for b in diffables_b}\n\n names = {a.name for a in diffables_a}\n names.update([b.name for b in diffables_b])\n return [(index_a.get(n), index_b.get(n)) for n in names]\n\n\ndef _parse_opts(args):\n parser = argparse.ArgumentParser(\n description=\"Compare two Graphite clusters for a given list of queries.\",\n epilog=\"Through this module, a \\\"query\\\" is \\\"the name of a query\\\", a string.\")\n\n # authentication\n authentication = parser.add_argument_group(\"authentication\")\n authentication.add_argument(\"--netrc-file\", metavar=\"FILENAME\", dest=\"netrc_filename\",\n action=\"store\", help=\"a netrc file (default: $HOME/$USER/.netrc)\",\n default=\"\")\n\n # clusters parameters\n comparison_params = parser.add_argument_group(\"comparison parameters\")\n comparison_params.add_argument(\"--hosts\", metavar=\"HOST\", dest=\"hosts\", action=\"store\",\n nargs=2, help=\"hosts to compare\", required=True)\n comparison_params.add_argument(\"--prefixes\", metavar=\"PREFIX\", dest=\"prefixes\",\n action=\"store\", nargs=2, help=\"prefix for each host.\",\n required=False, default=\"\")\n comparison_params.add_argument(\"--input-file\", metavar=\"FILENAME\", dest=\"input_filename\",\n action=\"store\", help=\"text file containing one query per line\",\n required=True)\n comparison_params.add_argument(\"--from\", metavar=\"FROM_PARAM\", dest=\"from_param\",\n action=\"store\", default=\"-24hours\",\n help=\"from param for Graphite API (default: %(default)s)\")\n comparison_params.add_argument(\"--until\", metavar=\"UNTIL_PARAM\", dest=\"until_param\",\n action=\"store\", default=\"-2minutes\",\n help=\"until param for Graphite API (default: %(default)s)\")\n comparison_params.add_argument(\n \"--timeout\", metavar=\"SECONDS\", dest=\"timeout_s\", action=\"store\", type=float,\n help=\"timeout in seconds used to fetch queries (default: %(default)ss)\", default=5)\n comparison_params.add_argument(\n \"--threshold\", metavar=\"PERCENT\", action=\"store\", type=float, default=1,\n help=\"percent threshold to evaluate equality between two values (default: %(default)s%%)\")\n\n # outputs parameters\n outputs_params = parser.add_argument_group(\"outputs parameters\")\n outputs_params.add_argument(\"--output-file\", metavar=\"FILENAME\", dest=\"output_filename\",\n action=\"store\", help=\"file containing outputs (default: stdout)\",\n default=\"\")\n outputs_params.add_argument(\"-v\", \"--verbosity\", action=\"count\", default=0,\n help=\"increases verbosity, can be passed multiple times\")\n outputs_params.add_argument(\n \"--show-max\", metavar=\"N_LINES\", dest=\"show_max\", type=int, default=5,\n help=\"truncate the number of shown dissymmetry in outputs (default: %(default)s)\")\n\n # TODO (t.chataigner) enable several kind of outputs : txt, csv, html...\n\n opts = parser.parse_args(args)\n\n # compute authentication keys from netrc file\n opts.auth_keys = [None, None]\n for host in opts.hosts:\n auth = netrc.netrc().authenticators(host)\n if auth is not None:\n username = auth[0]\n password = auth[2]\n opts.auth_keys.append(base64.encodestring(username + \":\" + password).replace(\"\\n\", \"\"))\n else:\n logging.info(netrc.NetrcParseError(\"No authenticators for %s\" % host))\n\n opts.threshold /= 100\n\n return opts\n\n\ndef main(args=None):\n \"\"\"Entry point for the module.\"\"\"\n if not args:\n args = sys.argv[1:]\n opts = _parse_opts(args)\n\n # fetch inputs\n queries = _read_queries(opts.input_filename)\n\n # host_result_1\n pbar = progressbar.ProgressBar(maxval=len(queries)).start()\n host_result_1 = fetch_queries(opts.hosts[0], opts.prefixes[0], opts.auth_keys[0],\n queries, opts.from_param,\n opts.until_param, opts.timeout_s, opts.threshold, pbar.update)\n pbar.finish()\n # host_result_2\n pbar = progressbar.ProgressBar(maxval=len(queries)).start()\n host_result_2 = fetch_queries(opts.hosts[1], opts.prefixes[1], opts.auth_keys[1],\n queries, opts.from_param,\n opts.until_param, opts.timeout_s, opts.threshold, pbar.update)\n pbar.finish()\n\n # compute outputs\n query_dissymmetries = compute_dissymmetries(\n host_result_1.diffable_queries, host_result_2.diffable_queries)\n\n diffable_query_tuples = _outer_join_diffables(\n host_result_1.diffable_queries, host_result_2.diffable_queries)\n query_to_target_dissymmetries = {\n diffable_query_1.name: compute_dissymmetries(\n diffable_query_1.diffable_targets, diffable_query_2.diffable_targets)\n for diffable_query_1, diffable_query_2 in diffable_query_tuples}\n\n timing_pctls_tuple = (\n host_result_1.compute_timing_pctls(),\n host_result_2.compute_timing_pctls(),\n )\n query_to_time_s_tuple = (\n host_result_1.query_to_time_s,\n host_result_2.query_to_time_s\n )\n\n error_counts_tuple = (\n collections.Counter(host_result_1.query_to_error.values()).most_common(),\n collections.Counter(host_result_2.query_to_error.values()).most_common()\n )\n error_to_queries_tuple = (\n host_result_1.get_error_to_query(),\n host_result_2.get_error_to_query()\n )\n\n # print outputs\n if not opts.output_filename:\n fp = sys.stdout\n else:\n fp = open(opts.output_filename, 'w')\n\n printer = TxtPrinter(fp=fp)\n printer.print_parameters(opts)\n\n printer.print_times(\n opts.hosts, timing_pctls_tuple, query_to_time_s_tuple, opts.verbosity, opts.show_max)\n\n printer.print_errors(\n opts.hosts, error_counts_tuple, error_to_queries_tuple, opts.verbosity)\n\n printer.print_dissymetry_results(\n query_dissymmetries, query_to_target_dissymmetries, opts.verbosity, opts.show_max)\n\n\nif __name__ == \"__main__\":\n main()\n"},"meta":{"kind":"string","value":"{'content_hash': '24554a29ea0fff82cb37106a12e502ff', 'timestamp': '', 'source': 'github', 'line_count': 632, 'max_line_length': 100, 'avg_line_length': 37.26107594936709, 'alnum_prop': 0.5901312157628774, 'repo_name': 'dpanth3r/biggraphite', 'id': 'ec60fd1e456855237dd1c5e9f6f56a21acb45c04', 'size': '24141', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'biggraphite/cli/clusters_diff.py', 'mode': '33188', 'license': 'apache-2.0', 'language': [{'name': 'Python', 'bytes': '452294'}]}"}}},{"rowIdx":849419,"cells":{"text":{"kind":"string","value":"div.dataTables_length label {\n font-weight: normal;\n float: left;\n text-align: left;\n}\n\ndiv.dataTables_length select {\n width: 75px;\n}\n\ndiv.dataTables_filter label {\n font-weight: normal;\n float: right;\n}\n\ndiv.dataTables_filter input {\n width: 16em;\n}\n\ndiv.dataTables_info {\n padding-top: 8px;\n}\n\ndiv.dataTables_paginate {\n float: right;\n margin: 0;\n}\n\ndiv.dataTables_paginate ul.pagination {\n margin: 2px 0;\n white-space: nowrap;\n}\n\ntable.dataTable td,\ntable.dataTable th {\n -webkit-box-sizing: content-box;\n -moz-box-sizing: content-box;\n box-sizing: content-box;\n}\n\n\ntable.dataTable {\n clear: both;\n margin-top: 6px !important;\n margin-bottom: 6px !important;\n max-width: none !important;\n}\n\ntable.dataTable thead .sorting,\ntable.dataTable thead .sorting_asc,\ntable.dataTable thead .sorting_desc,\ntable.dataTable thead .sorting_asc_disabled,\ntable.dataTable thead .sorting_desc_disabled {\n cursor: pointer;\n}\n\ntable.dataTable thead .sorting { background: url('../images/sort_both.png') no-repeat center right; }\ntable.dataTable thead .sorting_asc { background: url('../images/sort_asc.png') no-repeat center right; }\ntable.dataTable thead .sorting_desc { background: url('../images/sort_desc.png') no-repeat center right; }\n\ntable.dataTable thead .sorting_asc_disabled { background: url('../images/sort_asc_disabled.png') no-repeat center right; }\ntable.dataTable thead .sorting_desc_disabled { background: url('../images/sort_desc_disabled.png') no-repeat center right; }\n\ntable.dataTable thead > tr > th {\n padding-left: 18px;\n padding-right: 18px;\n}\n\ntable.dataTable th:active {\n outline: none;\n}\n\n/* Scrolling */\ndiv.dataTables_scrollHead table {\n margin-bottom: 0 !important;\n border-bottom-left-radius: 0;\n border-bottom-right-radius: 0;\n}\n\ndiv.dataTables_scrollHead table thead tr:last-child th:first-child,\ndiv.dataTables_scrollHead table thead tr:last-child td:first-child {\n border-bottom-left-radius: 0 !important;\n border-bottom-right-radius: 0 !important;\n}\n\ndiv.dataTables_scrollBody table {\n border-top: none;\n margin-top: 0 !important;\n margin-bottom: 0 !important;\n}\n\ndiv.dataTables_scrollBody tbody tr:first-child th,\ndiv.dataTables_scrollBody tbody tr:first-child td {\n border-top: none;\n}\n\ndiv.dataTables_scrollFoot table {\n margin-top: 0 !important;\n border-top: none;\n}\n\n/* Frustratingly the border-collapse:collapse used by Bootstrap makes the column\n width calculations when using scrolling impossible to align columns. We have\n to use separate\n */\ntable.table-bordered.dataTable {\n border-collapse: separate !important;\n}\ntable.table-bordered thead th,\ntable.table-bordered thead td {\n border-left-width: 0;\n border-top-width: 0;\n}\ntable.table-bordered tbody th,\ntable.table-bordered tbody td {\n border-left-width: 0;\n border-bottom-width: 0;\n}\ntable.table-bordered th:last-child,\ntable.table-bordered td:last-child {\n border-right-width: 0;\n}\ndiv.dataTables_scrollHead table.table-bordered {\n border-bottom-width: 0;\n}\n\n\n\n\n/*\n * TableTools styles\n */\n.table tbody tr.active td,\n.table tbody tr.active th {\n background-color: #08C;\n color: white;\n}\n\n.table tbody tr.active:hover td,\n.table tbody tr.active:hover th {\n background-color: #0075b0 !important;\n}\n\n.table tbody tr.active a {\n color: white;\n}\n\n.table-striped tbody tr.active:nth-child(odd) td,\n.table-striped tbody tr.active:nth-child(odd) th {\n background-color: #017ebc;\n}\n\ntable.DTTT_selectable tbody tr {\n cursor: pointer;\n}\n\ndiv.DTTT .btn {\n color: #333 !important;\n font-size: 12px;\n}\n\ndiv.DTTT .btn:hover {\n text-decoration: none !important;\n}\n\nul.DTTT_dropdown.dropdown-menu {\n z-index: 2003;\n}\n\nul.DTTT_dropdown.dropdown-menu a {\n color: #333 !important; /* needed only when demo_page.css is included */\n}\n\nul.DTTT_dropdown.dropdown-menu li {\n position: relative;\n}\n\nul.DTTT_dropdown.dropdown-menu li:hover a {\n background-color: #0088cc;\n color: white !important;\n}\n\ndiv.DTTT_collection_background {\n z-index: 2002;\n}\n\n/* TableTools information display */\ndiv.DTTT_print_info.modal {\n height: 150px;\n margin-top: -75px;\n text-align: center;\n}\n\ndiv.DTTT_print_info h6 {\n font-weight: normal;\n font-size: 28px;\n line-height: 28px;\n margin: 1em;\n}\n\ndiv.DTTT_print_info p {\n font-size: 14px;\n line-height: 20px;\n}\n\ndiv.dataTables_processing {\n position: absolute;\n top: 50%;\n left: 50%;\n width: 100%;\n height: 40px;\n margin-left: -50%;\n margin-top: -25px;\n padding-top: 20px;\n text-align: center;\n font-size: 1.2em;\n background-color: white;\n background: -webkit-gradient(linear, left top, right top, color-stop(0%, rgba(255,255,255,0)), color-stop(25%, rgba(255,255,255,0.9)), color-stop(75%, rgba(255,255,255,0.9)), color-stop(100%, rgba(255,255,255,0)));\n background: -webkit-linear-gradient(left, rgba(255,255,255,0) 0%, rgba(255,255,255,0.9) 25%, rgba(255,255,255,0.9) 75%, rgba(255,255,255,0) 100%);\n background: -moz-linear-gradient(left, rgba(255,255,255,0) 0%, rgba(255,255,255,0.9) 25%, rgba(255,255,255,0.9) 75%, rgba(255,255,255,0) 100%);\n background: -ms-linear-gradient(left, rgba(255,255,255,0) 0%, rgba(255,255,255,0.9) 25%, rgba(255,255,255,0.9) 75%, rgba(255,255,255,0) 100%);\n background: -o-linear-gradient(left, rgba(255,255,255,0) 0%, rgba(255,255,255,0.9) 25%, rgba(255,255,255,0.9) 75%, rgba(255,255,255,0) 100%);\n background: linear-gradient(to right, rgba(255,255,255,0) 0%, rgba(255,255,255,0.9) 25%, rgba(255,255,255,0.9) 75%, rgba(255,255,255,0) 100%);\n}\n\n\n\n/*\n * FixedColumns styles\n */\ndiv.DTFC_LeftHeadWrapper table,\ndiv.DTFC_LeftFootWrapper table,\ndiv.DTFC_RightHeadWrapper table,\ndiv.DTFC_RightFootWrapper table,\ntable.DTFC_Cloned tr.even {\n background-color: white;\n margin-bottom: 0;\n}\n\ndiv.DTFC_RightHeadWrapper table ,\ndiv.DTFC_LeftHeadWrapper table {\n margin-bottom: 0 !important;\n border-top-right-radius: 0 !important;\n border-bottom-left-radius: 0 !important;\n border-bottom-right-radius: 0 !important;\n}\n\ndiv.DTFC_RightHeadWrapper table thead tr:last-child th:first-child,\ndiv.DTFC_RightHeadWrapper table thead tr:last-child td:first-child,\ndiv.DTFC_LeftHeadWrapper table thead tr:last-child th:first-child,\ndiv.DTFC_LeftHeadWrapper table thead tr:last-child td:first-child {\n border-bottom-left-radius: 0 !important;\n border-bottom-right-radius: 0 !important;\n}\n\ndiv.DTFC_RightBodyWrapper table,\ndiv.DTFC_LeftBodyWrapper table {\n border-top: none;\n margin: 0 !important;\n}\n\ndiv.DTFC_RightBodyWrapper tbody tr:first-child th,\ndiv.DTFC_RightBodyWrapper tbody tr:first-child td,\ndiv.DTFC_LeftBodyWrapper tbody tr:first-child th,\ndiv.DTFC_LeftBodyWrapper tbody tr:first-child td {\n border-top: none;\n}\n\ndiv.DTFC_RightFootWrapper table,\ndiv.DTFC_LeftFootWrapper table {\n border-top: none;\n}\n\n\n/*\n * FixedHeader styles\n */\ndiv.FixedHeader_Cloned table {\n margin: 0 !important\n}\n\n"},"meta":{"kind":"string","value":"{'content_hash': '9149103ef38ced5d3a71e2af5116f873', 'timestamp': '', 'source': 'github', 'line_count': 281, 'max_line_length': 218, 'avg_line_length': 24.91103202846975, 'alnum_prop': 0.6988571428571428, 'repo_name': 'habibun/craft', 'id': '0ffe5ca952557b4ce98e35de6df11234c3b3f8c3', 'size': '7000', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'web/assets/data-tables-edited/theme-able/bootstrap/dataTables.bootstrap.css', 'mode': '33188', 'license': 'mit', 'language': [{'name': 'ActionScript', 'bytes': '15982'}, {'name': 'ApacheConf', 'bytes': '3365'}, {'name': 'CSS', 'bytes': '890625'}, {'name': 'CoffeeScript', 'bytes': '80553'}, {'name': 'Go', 'bytes': '6713'}, {'name': 'HTML', 'bytes': '4357397'}, {'name': 'JavaScript', 'bytes': '5282919'}, {'name': 'Makefile', 'bytes': '397'}, {'name': 'PHP', 'bytes': '513287'}, {'name': 'Python', 'bytes': '5173'}, {'name': 'Shell', 'bytes': '7411'}]}"}}},{"rowIdx":849420,"cells":{"text":{"kind":"string","value":"\n\n \n\n\n"},"meta":{"kind":"string","value":"{'content_hash': '065f309a40918efd225a35fca22c67a9', 'timestamp': '', 'source': 'github', 'line_count': 11, 'max_line_length': 64, 'avg_line_length': 33.0, 'alnum_prop': 0.6776859504132231, 'repo_name': 'rentianhua/tsf_android', 'id': '40313b9666678a3a23327d699e856c0cb4530bd7', 'size': '363', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'houseAd/HouseGo/res/menu/map_house_main.xml', 'mode': '33261', 'license': 'mit', 'language': [{'name': 'Java', 'bytes': '3172144'}]}"}}},{"rowIdx":849421,"cells":{"text":{"kind":"string","value":"@implementation PHSessionView\n\n#pragma mark - property\n\n- (UIButton*)button\n{\n if (!_button) {\n _button = [UIButton buttonWithType:UIButtonTypeCustom];\n _button.frame = CGRectMake(0, 40, self.frame.size.width, kHeaderTitleHeight-40);\n _button.contentHorizontalAlignment = UIControlContentHorizontalAlignmentLeft;\n [self addSubview:_button];\n }\n return _button;\n}\n\n- (UIView*)containView\n{\n if (!_containView) {\n _containView = [[UIView alloc] initWithFrame:CGRectMake(0, kHeaderTitleHeight + 20, self.frame.size.width, self.frame.size.height - kHeaderTitleHeight)];\n [self addSubview:_containView];\n }\n return _containView;\n}\n\n#pragma mark - clean up\n\n- (void)dealloc\n{\n [_button removeFromSuperview];\n _button = nil;\n [_containView removeFromSuperview];\n _containView = nil;\n}\n\n@end\n"},"meta":{"kind":"string","value":"{'content_hash': 'e2f2526f0c8367675025d790da558643', 'timestamp': '', 'source': 'github', 'line_count': 35, 'max_line_length': 161, 'avg_line_length': 24.457142857142856, 'alnum_prop': 0.677570093457944, 'repo_name': 'LLaurenter/IdeaBox', 'id': 'bd1339631dde6ebb646c8a92f8a4bd10c251c150', 'size': '1028', 'binary': False, 'copies': '4', 'ref': 'refs/heads/master', 'path': 'IdeaBox/Source/PHSessionView.m', 'mode': '33261', 'license': 'mit', 'language': [{'name': 'JavaScript', 'bytes': '848'}, {'name': 'Objective-C', 'bytes': '303294'}]}"}}},{"rowIdx":849422,"cells":{"text":{"kind":"string","value":"\n\n\n\n\n\norg.apache.jena.riot.lang (Apache Jena ARQ)\n\n\n\n\n\n

org.apache.jena.riot.lang

\n\n\n\n"},"meta":{"kind":"string","value":"{'content_hash': 'f38cebe518ca916fdc910798791ee26c', 'timestamp': '', 'source': 'github', 'line_count': 59, 'max_line_length': 167, 'avg_line_length': 92.37288135593221, 'alnum_prop': 0.74, 'repo_name': 'manonsys/MVC', 'id': '2558cf909369fc1b26f2b8ce80157ed0cee90e21', 'size': '5450', 'binary': False, 'copies': '2', 'ref': 'refs/heads/master', 'path': 'libs/Jena/javadoc-arq/org/apache/jena/riot/lang/package-frame.html', 'mode': '33188', 'license': 'mit', 'language': [{'name': 'ApacheConf', 'bytes': '419'}, {'name': 'Batchfile', 'bytes': '14683'}, {'name': 'C', 'bytes': '233384'}, {'name': 'C++', 'bytes': '5473'}, {'name': 'CSS', 'bytes': '672088'}, {'name': 'HTML', 'bytes': '88037916'}, {'name': 'Java', 'bytes': '197704'}, {'name': 'JavaScript', 'bytes': '3308500'}, {'name': 'Makefile', 'bytes': '1758'}, {'name': 'PHP', 'bytes': '1202703'}, {'name': 'Perl', 'bytes': '1542'}, {'name': 'Shell', 'bytes': '97135'}, {'name': 'Web Ontology Language', 'bytes': '7918'}]}"}}},{"rowIdx":849423,"cells":{"text":{"kind":"string","value":"// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.\n\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Threading;\nusing System.Threading.Tasks;\nusing Microsoft.CodeAnalysis.CodeGeneration;\nusing Microsoft.CodeAnalysis.Editing;\nusing Microsoft.CodeAnalysis.Shared.Extensions;\nusing Microsoft.CodeAnalysis.Text;\nusing Roslyn.Utilities;\n\nnamespace Microsoft.CodeAnalysis.Completion.Providers\n{\n internal abstract partial class AbstractOverrideCompletionProvider : AbstractMemberInsertingCompletionProvider\n {\n private readonly SyntaxAnnotation _annotation = new SyntaxAnnotation();\n\n public AbstractOverrideCompletionProvider()\n {\n }\n\n public abstract SyntaxToken FindStartingToken(SyntaxTree tree, int position, CancellationToken cancellationToken);\n public abstract ISet FilterOverrides(ISet members, ITypeSymbol returnType);\n public abstract bool TryDetermineModifiers(SyntaxToken startToken, SourceText text, int startLine, out Accessibility seenAccessibility, out DeclarationModifiers modifiers);\n\n public override async Task ProvideCompletionsAsync(CompletionContext context)\n {\n var state = await ItemGetter.CreateAsync(this, context.Document, context.Position, context.DefaultItemSpan, context.CancellationToken).ConfigureAwait(false);\n var items = await state.GetItemsAsync().ConfigureAwait(false);\n\n if (items?.Any() == true)\n {\n context.IsExclusive = true;\n context.AddItems(items);\n }\n }\n\n protected override async Task GenerateMemberAsync(ISymbol newOverriddenMember, INamedTypeSymbol newContainingType, Document newDocument, CompletionItem completionItem, CancellationToken cancellationToken)\n {\n // Figure out what to insert, and do it. Throw if we've somehow managed to get this far and can't.\n var syntaxFactory = newDocument.GetLanguageService();\n var codeGenService = newDocument.GetLanguageService();\n\n var itemModifiers = MemberInsertionCompletionItem.GetModifiers(completionItem);\n var modifiers = itemModifiers.WithIsUnsafe(itemModifiers.IsUnsafe | newOverriddenMember.IsUnsafe());\n if (newOverriddenMember.Kind == SymbolKind.Method)\n {\n return await syntaxFactory.OverrideMethodAsync((IMethodSymbol)newOverriddenMember,\n modifiers, newContainingType, newDocument, cancellationToken).ConfigureAwait(false);\n }\n else if (newOverriddenMember.Kind == SymbolKind.Property)\n {\n return await syntaxFactory.OverridePropertyAsync((IPropertySymbol)newOverriddenMember,\n modifiers, newContainingType, newDocument, cancellationToken).ConfigureAwait(false);\n }\n else\n {\n return syntaxFactory.OverrideEvent((IEventSymbol)newOverriddenMember,\n modifiers, newContainingType);\n }\n }\n\n public abstract bool TryDetermineReturnType(\n SyntaxToken startToken,\n SemanticModel semanticModel,\n CancellationToken cancellationToken,\n out ITypeSymbol returnType,\n out SyntaxToken nextToken);\n\n public bool IsOverridable(ISymbol member, INamedTypeSymbol containingType)\n {\n if (member.IsAbstract || member.IsVirtual || member.IsOverride)\n {\n if (member.IsSealed)\n {\n return false;\n }\n\n if (!member.IsAccessibleWithin(containingType))\n {\n return false;\n }\n\n switch (member.Kind)\n {\n case SymbolKind.Event:\n return true;\n case SymbolKind.Method:\n return ((IMethodSymbol)member).MethodKind == MethodKind.Ordinary;\n case SymbolKind.Property:\n return !((IPropertySymbol)member).IsWithEvents;\n }\n }\n\n return false;\n }\n\n protected bool IsOnStartLine(int position, SourceText text, int startLine)\n {\n return text.Lines.IndexOf(position) == startLine;\n }\n\n protected ITypeSymbol GetReturnType(ISymbol symbol)\n {\n switch (symbol.Kind)\n {\n case SymbolKind.Event:\n return ((IEventSymbol)symbol).Type;\n case SymbolKind.Method:\n return ((IMethodSymbol)symbol).ReturnType;\n case SymbolKind.Property:\n return ((IPropertySymbol)symbol).Type;\n default:\n throw ExceptionUtilities.Unreachable;\n }\n }\n }\n}\n"},"meta":{"kind":"string","value":"{'content_hash': 'd273134a05795afc429d75fd59d55766', 'timestamp': '', 'source': 'github', 'line_count': 119, 'max_line_length': 221, 'avg_line_length': 42.52100840336134, 'alnum_prop': 0.6343873517786561, 'repo_name': 'jaredpar/roslyn', 'id': '3d03710c51e68e0202805b40f9b4b84a22ee0042', 'size': '5062', 'binary': False, 'copies': '6', 'ref': 'refs/heads/master', 'path': 'src/Features/Core/Portable/Completion/Providers/AbstractOverrideCompletionProvider.cs', 'mode': '33188', 'license': 'apache-2.0', 'language': [{'name': 'Batchfile', 'bytes': '15099'}, {'name': 'C#', 'bytes': '80732271'}, {'name': 'C++', 'bytes': '6311'}, {'name': 'F#', 'bytes': '421'}, {'name': 'Groovy', 'bytes': '7036'}, {'name': 'Makefile', 'bytes': '3606'}, {'name': 'PowerShell', 'bytes': '25894'}, {'name': 'Shell', 'bytes': '7453'}, {'name': 'Visual Basic', 'bytes': '61232818'}]}"}}},{"rowIdx":849424,"cells":{"text":{"kind":"string","value":"workspace->workers->get($workerSid)->reservations as $reservation)\n{\n\techo $reservation->reservation_status;\n\techo $reservation->worker_name;\n}\n"},"meta":{"kind":"string","value":"{'content_hash': 'c2c70e5cbdbcbe86ad9cafc9f4b7a2df', 'timestamp': '', 'source': 'github', 'line_count': 17, 'max_line_length': 83, 'avg_line_length': 38.0, 'alnum_prop': 0.7770897832817337, 'repo_name': 'teoreteetik/api-snippets', 'id': 'd63330fb0bfb162d3162ed28206fb388cc68f74b', 'size': '646', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'rest/taskrouter/worker-reservations/list-get-example1/example-1.4.x.php', 'mode': '33188', 'license': 'mit', 'language': [{'name': 'C#', 'bytes': '643369'}, {'name': 'HTML', 'bytes': '335'}, {'name': 'Java', 'bytes': '943336'}, {'name': 'JavaScript', 'bytes': '539577'}, {'name': 'M', 'bytes': '117'}, {'name': 'Mathematica', 'bytes': '93'}, {'name': 'Objective-C', 'bytes': '46198'}, {'name': 'PHP', 'bytes': '538312'}, {'name': 'Python', 'bytes': '467248'}, {'name': 'Ruby', 'bytes': '470316'}, {'name': 'Shell', 'bytes': '1564'}, {'name': 'Swift', 'bytes': '36563'}]}"}}},{"rowIdx":849425,"cells":{"text":{"kind":"string","value":"\npackage com.intellij.openapi.components.impl.stores;\n\nimport com.intellij.openapi.components.*;\nimport com.intellij.openapi.options.StreamProvider;\nimport com.intellij.openapi.util.Pair;\nimport com.intellij.openapi.vfs.VirtualFile;\nimport com.intellij.util.io.fs.IFile;\nimport org.jetbrains.annotations.NotNull;\nimport org.jetbrains.annotations.Nullable;\n\nimport java.util.Collection;\nimport java.util.List;\nimport java.util.Set;\n\n/**\n * @author mike\n */\npublic interface StateStorageManager {\n void addMacro(String macro, String expansion);\n\n @Nullable\n TrackingPathMacroSubstitutor getMacroSubstitutor();\n\n @Nullable\n StateStorage getStateStorage(@NotNull Storage storageSpec) throws StateStorageException;\n\n @Nullable\n StateStorage getFileStateStorage(@NotNull String fileSpec);\n\n Collection getStorageFileNames();\n\n void clearStateStorage(@NotNull String file);\n\n @NotNull\n ExternalizationSession startExternalization();\n\n @NotNull\n SaveSession startSave(@NotNull ExternalizationSession externalizationSession);\n\n void finishSave(@NotNull SaveSession saveSession);\n\n @Nullable\n StateStorage getOldStorage(Object component, String componentName, StateStorageOperation operation) throws StateStorageException;\n\n @Nullable\n String expandMacros(String file);\n\n @Deprecated\n void registerStreamProvider(@SuppressWarnings(\"deprecation\") StreamProvider streamProvider, final RoamingType type);\n\n void setStreamProvider(@Nullable com.intellij.openapi.components.impl.stores.StreamProvider streamProvider);\n\n @Nullable\n com.intellij.openapi.components.impl.stores.StreamProvider getStreamProvider();\n\n void reset();\n\n interface ExternalizationSession {\n void setState(@NotNull Storage[] storageSpecs, @NotNull Object component, String componentName, @NotNull Object state) throws StateStorageException;\n void setStateInOldStorage(@NotNull Object component, @NotNull String componentName, @NotNull Object state) throws StateStorageException;\n }\n\n interface SaveSession {\n //returns set of component which were changed, null if changes are much more than just component state.\n @Nullable\n Set analyzeExternalChanges(@NotNull Set> files);\n\n @NotNull\n List getAllStorageFilesToSave() throws StateStorageException;\n\n @NotNull\n List getAllStorageFiles();\n\n void save() throws StateStorageException;\n }\n}"},"meta":{"kind":"string","value":"{'content_hash': 'd21277a2492a17ceae8fb6b972dd5af2', 'timestamp': '', 'source': 'github', 'line_count': 77, 'max_line_length': 152, 'avg_line_length': 31.337662337662337, 'alnum_prop': 0.7985909656029838, 'repo_name': 'IllusionRom-deprecated/android_platform_tools_idea', 'id': '0e2828e988a3553c3b69569adc0c6019594e7f3a', 'size': '3013', 'binary': False, 'copies': '2', 'ref': 'refs/heads/master', 'path': 'platform/platform-impl/src/com/intellij/openapi/components/impl/stores/StateStorageManager.java', 'mode': '33188', 'license': 'apache-2.0', 'language': [{'name': 'C', 'bytes': '177802'}, {'name': 'C#', 'bytes': '390'}, {'name': 'C++', 'bytes': '78894'}, {'name': 'CSS', 'bytes': '102018'}, {'name': 'Erlang', 'bytes': '10'}, {'name': 'Groovy', 'bytes': '1906667'}, {'name': 'J', 'bytes': '5050'}, {'name': 'Java', 'bytes': '128322265'}, {'name': 'JavaScript', 'bytes': '123045'}, {'name': 'Objective-C', 'bytes': '22558'}, {'name': 'Perl', 'bytes': '6549'}, {'name': 'Python', 'bytes': '17760420'}, {'name': 'Ruby', 'bytes': '1213'}, {'name': 'Shell', 'bytes': '76554'}, {'name': 'TeX', 'bytes': '60798'}, {'name': 'XSLT', 'bytes': '113531'}]}"}}},{"rowIdx":849426,"cells":{"text":{"kind":"string","value":"package com.vaadin.v7.tests.components.grid;\n\nimport java.util.List;\nimport java.util.Random;\n\nimport com.vaadin.server.VaadinRequest;\nimport com.vaadin.tests.components.AbstractTestUIWithLog;\nimport com.vaadin.ui.CheckBox;\nimport com.vaadin.v7.data.Item;\nimport com.vaadin.v7.data.util.IndexedContainer;\nimport com.vaadin.v7.ui.Grid;\nimport com.vaadin.v7.ui.Grid.Column;\nimport com.vaadin.v7.ui.Grid.SelectionMode;\nimport com.vaadin.v7.ui.renderers.HtmlRenderer;\nimport com.vaadin.v7.ui.renderers.TextRenderer;\n\n@SuppressWarnings(\"serial\")\npublic class GridSwitchRenderers extends AbstractTestUIWithLog {\n private static final int MANUALLY_FORMATTED_COLUMNS = 1;\n private static final int COLUMNS = 3;\n private static final int ROWS = 1000;\n private static final String EXPANSION_COLUMN_ID = \"Column 0\";\n\n private IndexedContainer ds;\n\n @Override\n protected void setup(VaadinRequest request) {\n ds = new IndexedContainer() {\n @Override\n public List getItemIds(int startIndex, int numberOfIds) {\n log(\"Requested items \" + startIndex + \" - \"\n + (startIndex + numberOfIds));\n return super.getItemIds(startIndex, numberOfIds);\n }\n };\n\n {\n ds.addContainerProperty(EXPANSION_COLUMN_ID, String.class, \"\");\n\n int col = MANUALLY_FORMATTED_COLUMNS;\n for (; col < COLUMNS; col++) {\n ds.addContainerProperty(getColumnProperty(col), String.class,\n \"\");\n }\n }\n\n Random rand = new Random();\n rand.setSeed(13334);\n for (int row = 0; row < ROWS; row++) {\n Item item = ds.addItem(Integer.valueOf(row));\n fillRow(\"\" + row, item);\n item.getItemProperty(getColumnProperty(1)).setReadOnly(true);\n }\n\n final Grid grid = new Grid(ds);\n grid.setWidth(\"100%\");\n\n grid.getColumn(EXPANSION_COLUMN_ID).setWidth(50);\n for (int col = MANUALLY_FORMATTED_COLUMNS; col < COLUMNS; col++) {\n grid.getColumn(getColumnProperty(col)).setWidth(300);\n grid.getColumn(getColumnProperty(col))\n .setRenderer(new TextRenderer());\n }\n\n grid.setSelectionMode(SelectionMode.NONE);\n addComponent(grid);\n\n final CheckBox changeRenderer = new CheckBox(\n \"SetHtmlRenderer for Column 2\", false);\n changeRenderer.addValueChangeListener(event -> {\n Column column = grid.getColumn(getColumnProperty(1));\n if (changeRenderer.getValue()) {\n column.setRenderer(new HtmlRenderer());\n } else {\n column.setRenderer(new TextRenderer());\n }\n grid.markAsDirty();\n });\n addComponent(changeRenderer);\n }\n\n @SuppressWarnings(\"unchecked\")\n private void fillRow(String content, Item item) {\n int col = MANUALLY_FORMATTED_COLUMNS;\n\n for (; col < COLUMNS; col++) {\n item.getItemProperty(getColumnProperty(col))\n .setValue(\"(\" + content + \", \" + col + \")\");\n }\n }\n\n private static String getColumnProperty(int c) {\n return \"Column \" + c;\n }\n\n}"},"meta":{"kind":"string","value":"{'content_hash': '453d71b1dc604ab9c955f225e74c794f', 'timestamp': '', 'source': 'github', 'line_count': 96, 'max_line_length': 77, 'avg_line_length': 33.9375, 'alnum_prop': 0.6089625537139349, 'repo_name': 'kironapublic/vaadin', 'id': 'd26f5400385b0242d36fdac90fed413f3a1fb7ee', 'size': '3258', 'binary': False, 'copies': '4', 'ref': 'refs/heads/master', 'path': 'uitest/src/main/java/com/vaadin/v7/tests/components/grid/GridSwitchRenderers.java', 'mode': '33188', 'license': 'apache-2.0', 'language': [{'name': 'CSS', 'bytes': '740138'}, {'name': 'HTML', 'bytes': '102292'}, {'name': 'Java', 'bytes': '23876126'}, {'name': 'JavaScript', 'bytes': '128039'}, {'name': 'Python', 'bytes': '34992'}, {'name': 'Shell', 'bytes': '14720'}, {'name': 'Smarty', 'bytes': '175'}]}"}}},{"rowIdx":849427,"cells":{"text":{"kind":"string","value":"import _ from 'lodash'\nimport React from 'react'\n\nimport Label from 'src/elements/Label/Label'\nimport LabelDetail from 'src/elements/Label/LabelDetail'\nimport LabelGroup from 'src/elements/Label/LabelGroup'\nimport * as common from 'test/specs/commonTests'\nimport { SUI } from 'src/lib'\nimport { sandbox } from 'test/utils'\n\ndescribe('Label', () => {\n common.isConformant(Label)\n common.hasSubComponents(Label, [LabelDetail, LabelGroup])\n common.hasUIClassName(Label)\n common.rendersChildren(Label)\n\n common.implementsCreateMethod(Label)\n common.implementsIconProp(Label)\n common.implementsImageProp(Label)\n common.implementsShorthandProp(Label, {\n propKey: 'detail',\n ShorthandComponent: LabelDetail,\n mapValueToProps: val => ({ content: val }),\n })\n\n common.propKeyAndValueToClassName(Label, 'attached', [\n 'top', 'bottom', 'top right', 'top left', 'bottom left', 'bottom right',\n ])\n\n common.propKeyOnlyToClassName(Label, 'active')\n common.propKeyOnlyToClassName(Label, 'basic')\n common.propKeyOnlyToClassName(Label, 'circular')\n common.propKeyOnlyToClassName(Label, 'empty')\n common.propKeyOnlyToClassName(Label, 'floating')\n common.propKeyOnlyToClassName(Label, 'horizontal')\n common.propKeyOnlyToClassName(Label, 'tag')\n\n common.propKeyOrValueAndKeyToClassName(Label, 'corner', ['left', 'right'])\n common.propKeyOrValueAndKeyToClassName(Label, 'ribbon', ['right'])\n\n common.propValueOnlyToClassName(Label, 'color', SUI.COLORS)\n common.propValueOnlyToClassName(Label, 'size', SUI.SIZES)\n\n it('is a div by default', () => {\n shallow(