Dataset Preview
Duplicate
The full dataset viewer is not available (click to read why). Only showing a preview of the rows.
The dataset generation failed
Error code:   DatasetGenerationError
Exception:    ArrowInvalid
Message:      JSON parse error: Missing a closing quotation mark in string. in row 639
Traceback:    Traceback (most recent call last):
                File "/src/services/worker/.venv/lib/python3.9/site-packages/datasets/packaged_modules/json/json.py", line 145, in _generate_tables
                  dataset = json.load(f)
                File "/usr/local/lib/python3.9/json/__init__.py", line 293, in load
                  return loads(fp.read(),
                File "/usr/local/lib/python3.9/json/__init__.py", line 346, in loads
                  return _default_decoder.decode(s)
                File "/usr/local/lib/python3.9/json/decoder.py", line 340, in decode
                  raise JSONDecodeError("Extra data", s, end)
              json.decoder.JSONDecodeError: Extra data: line 2 column 1 (char 1984)
              
              During handling of the above exception, another exception occurred:
              
              Traceback (most recent call last):
                File "/src/services/worker/.venv/lib/python3.9/site-packages/datasets/builder.py", line 1995, in _prepare_split_single
                  for _, table in generator:
                File "/src/services/worker/.venv/lib/python3.9/site-packages/datasets/packaged_modules/json/json.py", line 148, in _generate_tables
                  raise e
                File "/src/services/worker/.venv/lib/python3.9/site-packages/datasets/packaged_modules/json/json.py", line 122, in _generate_tables
                  pa_table = paj.read_json(
                File "pyarrow/_json.pyx", line 308, in pyarrow._json.read_json
                File "pyarrow/error.pxi", line 154, in pyarrow.lib.pyarrow_internal_check_status
                File "pyarrow/error.pxi", line 91, in pyarrow.lib.check_status
              pyarrow.lib.ArrowInvalid: JSON parse error: Missing a closing quotation mark in string. in row 639
              
              The above exception was the direct cause of the following exception:
              
              Traceback (most recent call last):
                File "/src/services/worker/src/worker/job_runners/config/parquet_and_info.py", line 1529, in compute_config_parquet_and_info_response
                  parquet_operations = convert_to_parquet(builder)
                File "/src/services/worker/src/worker/job_runners/config/parquet_and_info.py", line 1154, in convert_to_parquet
                  builder.download_and_prepare(
                File "/src/services/worker/.venv/lib/python3.9/site-packages/datasets/builder.py", line 1027, in download_and_prepare
                  self._download_and_prepare(
                File "/src/services/worker/.venv/lib/python3.9/site-packages/datasets/builder.py", line 1122, in _download_and_prepare
                  self._prepare_split(split_generator, **prepare_split_kwargs)
                File "/src/services/worker/.venv/lib/python3.9/site-packages/datasets/builder.py", line 1882, in _prepare_split
                  for job_id, done, content in self._prepare_split_single(
                File "/src/services/worker/.venv/lib/python3.9/site-packages/datasets/builder.py", line 2038, in _prepare_split_single
                  raise DatasetGenerationError("An error occurred while generating the dataset") from e
              datasets.exceptions.DatasetGenerationError: An error occurred while generating the dataset

Need help to make the dataset viewer work? Make sure to review how to configure the dataset viewer, and open a discussion for direct support.

text
string
meta
dict
function stat = clusterStat(data1, data2, nsubj) % do cluster stats across the group cfgstats = []; cfgstats.method = 'montecarlo'; % permutation test cfgstats.statistic = 'ft_statfun_depsamplesT'; % dependent samples ttest % do cluster correction cfgstats.correctm = 'cluster'; cfgstats.clusteralpha = 0.05; % cfgstats.clusterstatistic = 'maxsize'; % weighted cluster mass needs cfg.wcm_weight... % cfgstats.minnbchan = 1; % average over chans cfgstats.tail = 0; % two-tailed! cfgstats.clustertail = 0; % two-tailed! cfgstats.alpha = 0.025; cfgstats.numrandomization = 1000; % make sure this is large enough cfgstats.randomseed = 1; % make the stats reproducible! % use only our preselected sensors for the time being cfgstats.channel = 'EyePupil'; % specifies with which sensors other sensors can form clusters cfgstats.neighbours = []; % only cluster over data and time design = zeros(2,2*nsubj); for i = 1:nsubj, design(1,i) = i; end for i = 1:nsubj, design(1,nsubj+i) = i; end design(2,1:nsubj) = 1; design(2,nsubj+1:2*nsubj) = 2; cfgstats.design = design; cfgstats.uvar = 1; cfgstats.ivar = 2; stat = ... ft_timelockstatistics(cfgstats, ... data1, data2); end
{ "content_hash": "36940c8ba4798e62f4581d56fdca6789", "timestamp": "", "source": "github", "line_count": 41, "max_line_length": 88, "avg_line_length": 32.170731707317074, "alnum_prop": 0.6482183472327521, "repo_name": "anne-urai/pupilUncertainty", "id": "e58e760f5572a49f577391edc6188c3986ff79a5", "size": "1320", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "Analysis/clusterStat.m", "mode": "33188", "license": "mit", "language": [ { "name": "Matlab", "bytes": "585870" }, { "name": "Python", "bytes": "120228" }, { "name": "R", "bytes": "4714" }, { "name": "Shell", "bytes": "1229" } ] }
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html> <head> <title> RACHEL - Local Content</title> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> <link rel="stylesheet" type="text/css" href="common.css"> <link rel="stylesheet" type="text/css" href="style.css"> </head> <body> <a href="index.php" id="rachel-small" target="_top">Rachel</a> <div class="haut cf"> <ul> <li><a href="index.php" target="_top">HOME</a></li> <li><a href="about.html" target="_top">ABOUT</a></li> <li><a href="local-frameset.html" target="_top">LOCAL CONTENT</a></li> </ul> </div> </div> <div id="content"> <div class="thumblist" style="line-height: 120%;"> Below is a list of content added locally to this RACHEL installation. If you would like to add files here, you can just place them in the directory <b>bin/www/LOCAL_CONTENT</b> on your RACHEL USB or server. Files listed below were not provided as part of the RACHEL package, so we won't be able to answer questions about them. However you can ask your local computer administrator. </div> </body> </html>
{ "content_hash": "2f9a36b497da9c8ae0c72b83bec4a716", "timestamp": "", "source": "github", "line_count": 28, "max_line_length": 90, "avg_line_length": 40.285714285714285, "alnum_prop": 0.6852836879432624, "repo_name": "tunapanda/rachel-content", "id": "7d10ffe4638aa579fc01637df115ff45556df5e3", "size": "1128", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "local-heading.html", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "84260" }, { "name": "HTML", "bytes": "82982" }, { "name": "JavaScript", "bytes": "8410" }, { "name": "PHP", "bytes": "4602327" }, { "name": "Shell", "bytes": "844" }, { "name": "XSLT", "bytes": "4015" } ] }
package com.hp.autonomy.frontend.find.hod.beanconfiguration; import com.hp.autonomy.frontend.configuration.ConfigService; import com.hp.autonomy.frontend.configuration.redis.RedisConfig; import com.hp.autonomy.frontend.configuration.server.HostAndPort; import com.hp.autonomy.frontend.find.core.beanconfiguration.AppConfiguration; import com.hp.autonomy.frontend.find.core.beanconfiguration.RedisCondition; import com.hp.autonomy.frontend.find.hod.configuration.HodFindConfig; import com.hp.autonomy.frontend.find.hod.web.HodFindCacheNames; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.cache.CacheManager; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Conditional; import org.springframework.context.annotation.Configuration; import org.springframework.data.redis.cache.DefaultRedisCachePrefix; import org.springframework.data.redis.cache.RedisCacheManager; import org.springframework.data.redis.connection.RedisSentinelConfiguration; import org.springframework.data.redis.connection.jedis.JedisConnectionFactory; import org.springframework.data.redis.core.RedisTemplate; import org.springframework.session.data.redis.config.ConfigureNotifyKeyspaceEventsAction; import org.springframework.session.data.redis.config.ConfigureRedisAction; import org.springframework.session.data.redis.config.annotation.web.http.EnableRedisHttpSession; @Configuration @Conditional(RedisCondition.class) @EnableRedisHttpSession public class RedisConfiguration { private static final int DEFAULT_EXPIRATION = 30 * 60; @Autowired private ConfigService<HodFindConfig> configService; @Value(AppConfiguration.GIT_COMMIT_PROPERTY) private String commit; @Bean public JedisConnectionFactory redisConnectionFactory() { final RedisConfig config = configService.getConfig().getRedis(); final JedisConnectionFactory connectionFactory; //If we haven't specified any sentinels then assume non-distributed setup if (config.getSentinels().isEmpty()) { connectionFactory = new JedisConnectionFactory(); connectionFactory.setHostName(config.getAddress().getHost()); connectionFactory.setPort(config.getAddress().getPort()); } else { final RedisSentinelConfiguration sentinelConfig = new RedisSentinelConfiguration().master(config.getMasterName()); for (final HostAndPort node : config.getSentinels()) { sentinelConfig.sentinel(node.getHost(), node.getPort()); } connectionFactory = new JedisConnectionFactory(sentinelConfig); } final Integer database = config.getDatabase(); if (database != null) { connectionFactory.setDatabase(database); } connectionFactory.setPassword(config.getPassword()); return connectionFactory; } @Bean public CacheManager cacheManager() { final RedisCacheManager cacheManager = new RedisCacheManager(cachingRedisTemplate()); cacheManager.setUsePrefix(true); cacheManager.setCachePrefix(new DefaultRedisCachePrefix(":cache:" + commit + ':')); cacheManager.setDefaultExpiration(DEFAULT_EXPIRATION); cacheManager.setExpires(HodFindCacheNames.CACHE_EXPIRES); return cacheManager; } @Bean public RedisTemplate<Object, Object> cachingRedisTemplate() { final RedisTemplate<Object, Object> template = new RedisTemplate<>(); template.setConnectionFactory(redisConnectionFactory()); return template; } @Bean public ConfigureRedisAction configureRedisAction() { // The config action might not be available in a secure redis (eg: Azure) return configService.getConfig().getRedis().getAutoConfigure() ? new ConfigureNotifyKeyspaceEventsAction() : ConfigureRedisAction.NO_OP; } }
{ "content_hash": "3db67b69c46d22b3d83c13085de93e28", "timestamp": "", "source": "github", "line_count": 94, "max_line_length": 144, "avg_line_length": 42.41489361702128, "alnum_prop": 0.7609731627790318, "repo_name": "hpautonomy/find", "id": "88ab0f71e6386fef3444d241f42613f810196b68", "size": "4163", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "webapp/hod/src/main/java/com/hp/autonomy/frontend/find/hod/beanconfiguration/RedisConfiguration.java", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "237847" }, { "name": "CoffeeScript", "bytes": "6019" }, { "name": "HTML", "bytes": "31529" }, { "name": "Java", "bytes": "327042" }, { "name": "JavaScript", "bytes": "253372" }, { "name": "Ruby", "bytes": "206" }, { "name": "Shell", "bytes": "4782" } ] }
This project is mostly a proof of concept showing how to use [Gulp][] to render a collection of PHP files to static HTML. A simple gulpfile linking to a few modules from Gulp's vibrant ecosystem make it easy to add extras like a local auto-reloading BrowserSync webserver, static file copying and automatic Sass compilation. ##### What this does - Complete 1-to-1 mirroring of an arbitrarily nested directory of PHP source files, including auto-removal of deleted and renamed files - Correct referencing of nested includes - Static file mirroring - Starts a local [BrowserSync][] webserver ##### What this doesn't do - There’s not much of anything in PHP's global `$_SERVER` array. But you weren't counting on that anyway. Right? Magic PHP variables `__FILE__` and `__DIR__` also don't work. - There's no dependency-graph of includes, changing a nested file won't trigger a re-render of the files that reference it. If you've got a directory of include files, add a `watch` that calls the `php` task to rebuild everything if those files change. - [phpinfo() outputs plain text][phpinfo] instead of HTML when using the CLI mode. ## Working with Gulp These are the main gulpfile tasks which combine to do most of the work: * `gulp build` - Builds a fresh copy of the site, after first cleaning out any existing build files. * `gulp watch` - Starts a local webserver to preview changes. `gulp build` is automatically run when the server starts up. * `gulp clean` - Removes the build folder. ## Setup instructions 1. Make sure gulp is installed globally: `npm install -g gulp` 2. Clone the repo: `git clone https://github.com/joemaller/php-static-generator-gulpfile.git` 3. install everything from package.json: `npm install` ## Prerequisites You need to have node and PHP installed. Mac instructions are below. If you're on Linux, you probably already know this. I've never set these up on Windows, so I can't help there. #### Mac Setup instructions 1. Install [Xcode][] from the Mac App Store. 2. Install [Homebrew][] 3. Use homebrew to install [node.js][]: `brew install node` 4. Use homebrew to [install PHP][]: * `brew tap homebrew/dupes` * `brew tap homebrew/versions` * `brew tap homebrew/homebrew-php` * `brew install php55` or `brew install php56` ## Additional notes ##### Composer [Composer][] works just fine. Be sure to reference the autoloader like this: require get_include_path() . '/../vendor/autoload.php'; ##### Two to the power of 276,709 to one against This example is completely insane, and deeply irresponsible: The **source/twig.php** file demonstrates how the gulpfile can be used to render a flat HTML file from a PHP file linking to a [Twig template][twig] which includes two sub-templates. There is absolutely no reason anyone should ever do this. Madness. [xcode]: https://itunes.apple.com/us/app/xcode/id497799835?mt=12 [homebrew]: http://brew.sh/ [node.js]: http://nodejs.org/ [install PHP]: https://github.com/Homebrew/homebrew-php#installation [gulp]: http://gulpjs.com/ [twig]: http://twig.sensiolabs.org/ [phpinfo]: http://php.net/manual/en/function.phpinfo.php#refsect1-function.phpinfo-notes [composer]: http://getcomposer.org [browsersync]: http://www.browsersync.io
{ "content_hash": "95781dcfdbde8f66507c25ed4c29382d", "timestamp": "", "source": "github", "line_count": 67, "max_line_length": 324, "avg_line_length": 48.46268656716418, "alnum_prop": 0.7440714505697567, "repo_name": "joemaller/php-static-generator-gulpfile", "id": "47696a7220ba3c9579a6c43932d7db98ba4c236f", "size": "3282", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "README.md", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "468" }, { "name": "JavaScript", "bytes": "6754" }, { "name": "PHP", "bytes": "1172" } ] }
{ "translatorID": "076bd26a-1517-469d-85e9-31316a6f6cb0", "label": "Wikisource", "creator": "Philipp Zumstein", "target": "^https?://en\\.wikisource\\.org/w", "minVersion": "2.1.9", "maxVersion": "", "priority": 100, "inRepository": true, "translatorType": 4, "browserSupport": "gcsibv", "lastUpdated": "2016-04-15 06:46:02" } function detectWeb(doc, url) { if (doc.getElementById("header_title_text")) { var titleLink = ZU.xpath(doc, '//span[@id="header_title_text"]/a'); if (titleLink.length && (titleLink[0].textContent.match(/Encyclop(æ|ae|e)dia|Dictionary/) )) { return "encyclopediaArticle"; } if (doc.getElementById("ca-proofread-source")) { if (doc.getElementById("header_section_text")) { return "bookSection"; } else { return "book"; } } else { return "manuscript"; } } else if (getSearchResults(doc, true)) { return "multiple"; } } function getSearchResults(doc, checkOnly) { var items = {}; var found = false; var rows = ZU.xpath(doc, '//ul[contains(@class, "search-results")]//a'); for (var i=0; i<rows.length; i++) { var href = rows[i].href; var title = ZU.trimInternal(rows[i].textContent); if (!href || !title) continue; if (checkOnly) return true; found = true; items[href] = title; } return found ? items : false; } function doWeb(doc, url) { if (detectWeb(doc, url) == "multiple") { Zotero.selectItems(getSearchResults(doc, false), function (items) { if (!items) { return true; } var articles = new Array(); for (var i in items) { articles.push(i); } ZU.processDocuments(articles, scrape); }); } else { scrape(doc, url); } } function scrape(doc, url) { var item = new Zotero.Item(detectWeb(doc, url)); if (item.itemType === "bookSection") { item.title = doc.getElementById("header_section_text").textContent; item.bookTitle = doc.getElementById("header_title_text").textContent; } else if (item.itemType === "encyclopediaArticle") { var header = doc.getElementById("header_title_text"); item.encyclopediaTitle = ZU.xpathText(header, './a[1]'); if (ZU.xpath(header, './a[2]').length > 0) { item.volume = ZU.xpathText(header, './a[2]'); } if (doc.getElementById("header_section_text")) { item.title = doc.getElementById("header_section_text").textContent; } else { item.title = ZU.xpathText(doc, '//*[@id="header_title_text"]/text()').replace(/(,|\n)/g,''); } } else { item.title = doc.getElementById("header_title_text").textContent; } var creators = ZU.xpath(doc, '//span[@id="header_author_text"]'); for (var i=0; i<creators.length; i++) { var author = creators[i].textContent.replace('by', '').replace(/\(.+/, ''); item.creators.push(ZU.cleanAuthor(author, "author")); } var tags = ZU.xpath(doc, '//div[@id="mw-normal-catlinks"]/ul/li/a'); for (var i=0; i<tags.length; i++) { item.tags.push(tags[i].text); } item.rights = ZU.xpathText(doc, '//li[@id="footer-info-copyright"]'); item.archive = "Wikisource"; var permalink = ZU.xpathText(doc, '//li[@id="t-permalink"]/a/@href'); item.attachments.push({ url : permalink, title : "Wikisource Snapshot", type : "text/html" }); //Add more metadata from the "Source" page if it is present var sourcePage = ZU.xpathText(doc, '//li[@id="ca-proofread-source"]//a/@href'); if (sourcePage) { ZU.processDocuments(sourcePage, function(sourceDoc) { scrapeSource(sourceDoc, item); }); } else { item.complete(); } } function scrapeSource(doc, item) { var indexedFields = {}; var lines = ZU.xpath(doc, '//table[@id="prp-indexTable"]/tbody/tr'); for (var i=0; i<lines.length; i++) { var label = ZU.xpathText(lines[i], './th').trim(); var value = ZU.xpathText(lines[i], './td').trim(); indexedFields[label] = value; } //Z.debug(indexedFields); if (indexedFields.Year) { item.date = indexedFields.Year; } if (indexedFields.Publisher) { item.publisher = indexedFields.Publisher; } if (indexedFields.Location) { item.place = indexedFields.Location; } if (indexedFields.Editor) { item.creators.push(ZU.cleanAuthor(indexedFields.Editor, "editor")); } if (indexedFields.Illustrator) { item.creators.push(ZU.cleanAuthor(indexedFields.Illustrator, "contributor")); } item.complete(); }/** BEGIN TEST CASES **/ var testCases = [ { "type": "web", "url": "https://en.wikisource.org/wiki/Amazing_Grace", "items": [ { "itemType": "manuscript", "title": "Amazing Grace", "creators": [ { "firstName": "John", "lastName": "Newton", "creatorType": "author" } ], "archive": "Wikisource", "libraryCatalog": "Wikisource", "rights": "Text is available under the Creative Commons Attribution-ShareAlike License; additional terms may apply. By using this site, you agree to the Terms of Use and Privacy Policy.", "attachments": [ { "title": "Wikisource Snapshot", "type": "text/html" } ], "tags": [ "Individual Christian hymns", "Non-gospel Christian and Judaic hymns", "Spoken works" ], "notes": [], "seeAlso": [] } ] }, { "type": "web", "url": "https://en.wikisource.org/wiki/Alice%27s_Adventures_in_Wonderland_(1866)/Chapter_2", "items": [ { "itemType": "bookSection", "title": "Chapter 2: The Pool of Tears", "creators": [ { "firstName": "Lewis", "lastName": "Carroll", "creatorType": "author" }, { "firstName": "John", "lastName": "Tenniel", "creatorType": "contributor" } ], "date": "1866", "archive": "Wikisource", "bookTitle": "Alice's Adventures in Wonderland (1866)", "libraryCatalog": "Wikisource", "place": "London", "publisher": "MacMillan & Co.", "rights": "Text is available under the Creative Commons Attribution-ShareAlike License; additional terms may apply. By using this site, you agree to the Terms of Use and Privacy Policy.", "shortTitle": "Chapter 2", "attachments": [ { "title": "Wikisource Snapshot", "type": "text/html" } ], "tags": [], "notes": [], "seeAlso": [] } ] }, { "type": "web", "url": "https://en.wikisource.org/wiki/Letters_of_Tagore_(1917)", "items": [ { "itemType": "book", "title": "Letters of Tagore (1917)", "creators": [ { "firstName": "Rabindranath", "lastName": "Tagore", "creatorType": "author" } ], "date": "1917", "archive": "Wikisource", "libraryCatalog": "Wikisource", "place": "New York", "publisher": "The Macmillan Company", "rights": "Text is available under the Creative Commons Attribution-ShareAlike License; additional terms may apply. By using this site, you agree to the Terms of Use and Privacy Policy.", "attachments": [ { "title": "Wikisource Snapshot", "type": "text/html" } ], "tags": [ "1917 works", "PD-old-70-1923" ], "notes": [], "seeAlso": [] } ] }, { "type": "web", "url": "https://en.wikisource.org/wiki/The_Descent_of_Man_(Darwin)/Chapter_IV", "items": [ { "itemType": "bookSection", "title": "Chapter IV: Comparison of the Mental Powers of Man and the Lower Animals (Continued)", "creators": [ { "firstName": "Charles", "lastName": "Darwin", "creatorType": "author" } ], "date": "1875", "archive": "Wikisource", "bookTitle": "The Descent of Man", "libraryCatalog": "Wikisource", "place": "New York", "publisher": "D. Appleton", "rights": "Text is available under the Creative Commons Attribution-ShareAlike License; additional terms may apply. By using this site, you agree to the Terms of Use and Privacy Policy.", "shortTitle": "Chapter IV", "attachments": [ { "title": "Wikisource Snapshot", "type": "text/html" } ], "tags": [], "notes": [], "seeAlso": [] } ] }, { "type": "web", "url": "https://en.wikisource.org/w/index.php?search=mannheim&title=Special:Search&go=Go", "items": "multiple" }, { "type": "web", "url": "https://en.wikisource.org/wiki/Gell,_John_%281593-1671%29_%28DNB00%29", "items": [ { "itemType": "encyclopediaArticle", "title": "Gell John (1593-1671)", "creators": [ { "firstName": "Charles Harding", "lastName": "Firth", "creatorType": "author" }, { "firstName": "Leslie", "lastName": "Stephen", "creatorType": "editor" } ], "date": "1890", "archive": "Wikisource", "encyclopediaTitle": "Dictionary of National Biography, 1885-1900", "libraryCatalog": "Wikisource", "place": "London", "publisher": "Elder Smith & Co.", "rights": "Text is available under the Creative Commons Attribution-ShareAlike License; additional terms may apply. By using this site, you agree to the Terms of Use and Privacy Policy.", "volume": "Volume 21", "attachments": [ { "title": "Wikisource Snapshot", "type": "text/html" } ], "tags": [ "1890 works", "DNB biographies" ], "notes": [], "seeAlso": [] } ] }, { "type": "web", "url": "https://en.wikisource.org/wiki/A_Dictionary_of_Music_and_Musicians/Cannabich,_Christian", "items": [ { "itemType": "encyclopediaArticle", "title": "Cannabich, Christian", "creators": [ { "firstName": "George", "lastName": "Grove", "creatorType": "editor" } ], "date": "1900", "archive": "Wikisource", "encyclopediaTitle": "A Dictionary of Music and Musicians", "libraryCatalog": "Wikisource", "place": "London", "publisher": "MacMillan & Co., Ltd.", "rights": "Text is available under the Creative Commons Attribution-ShareAlike License; additional terms may apply. By using this site, you agree to the Terms of Use and Privacy Policy.", "attachments": [ { "title": "Wikisource Snapshot", "type": "text/html" } ], "tags": [ "DMM composer biographies" ], "notes": [], "seeAlso": [] } ] } ] /** END TEST CASES **/
{ "content_hash": "44823017da950f48b94a35e3fa650ee0", "timestamp": "", "source": "github", "line_count": 372, "max_line_length": 192, "avg_line_length": 27.341397849462364, "alnum_prop": 0.6014157899911513, "repo_name": "retorquere/zotero-better-bibtex", "id": "0bee1972595d9a4f530476338226e72537d7749e", "size": "10934", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "test/fixtures/profile/zotero/zotero/translators/Wikisource.js", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "2086" }, { "name": "EJS", "bytes": "2307" }, { "name": "Gherkin", "bytes": "67942" }, { "name": "HTML", "bytes": "68981" }, { "name": "JavaScript", "bytes": "94697" }, { "name": "Lua", "bytes": "74469" }, { "name": "Makefile", "bytes": "3574" }, { "name": "Mako", "bytes": "14600" }, { "name": "Pug", "bytes": "57754" }, { "name": "Python", "bytes": "174108" }, { "name": "Ruby", "bytes": "8775" }, { "name": "Shell", "bytes": "2835" }, { "name": "TeX", "bytes": "21343" }, { "name": "TypeScript", "bytes": "690937" } ] }
<?php use Berg\LdapAuthenticator\Authenticator; use Berg\LdapAuthenticator\Driver\LdapDriver; use \Mockery as m; class AuthenticatorTest extends PHPUnit_Framework_TestCase { public function testInvalidConfiguration() { $this->setExpectedException('Berg\LdapAuthenticator\Exceptions\ConfigNotSetException'); new LdapDriver(null); } public function testInvalidCredentials() { $this->setExpectedException('Berg\LdapAuthenticator\Exceptions\InvalidCredentialsException'); $driver = m::mock('Berg\LdapAuthenticator\Driver\LdapDriver'); $driver->shouldReceive('validate')->andReturn(false); $authenticator = new Authenticator($driver); $authenticator->authenticate('username', 'password'); } public function testUserDoesNotExist() { $this->setExpectedException('Berg\LdapAuthenticator\Exceptions\UserDoesNotExistException'); $driver = m::mock('Berg\LdapAuthenticator\Driver\LdapDriver'); $driver->shouldReceive('validate')->andReturn(true); $driver->shouldReceive('doesUserExist')->andReturn(false); $authenticator = new Authenticator($driver); $authenticator->authenticate('username', 'password'); } public function testAuthenticationFails() { $this->setExpectedException('Berg\LdapAuthenticator\Exceptions\IncorrectCredentialsException'); $driver = m::mock('Berg\LdapAuthenticator\Driver\LdapDriver'); $driver->shouldReceive('validate')->andReturn(true); $driver->shouldReceive('doesUserExist')->andReturn(true); $driver->shouldReceive('authenticate')->andReturn(false); $authenticator = new Authenticator($driver); $authenticator->authenticate('username', 'password'); } public function testValidLogin() { $driver = m::mock('Berg\LdapAuthenticator\Driver\LdapDriver'); $driver->shouldReceive('validate')->andReturn(true); $driver->shouldReceive('doesUserExist')->andReturn(true); $driver->shouldReceive('authenticate')->andReturn(true); $authenticator = new Authenticator($driver); $authenticated = $authenticator->authenticate('username', 'password'); $this->assertTrue($authenticated); } public function tearDown() { m::close(); } }
{ "content_hash": "474917f905737cb0a441d7b244feedc8", "timestamp": "", "source": "github", "line_count": 61, "max_line_length": 103, "avg_line_length": 38.278688524590166, "alnum_prop": 0.6886509635974304, "repo_name": "mrberggg/ldap-authenticator", "id": "000209f34e7fa4cdf317ad5c0f3cae5c27c66611", "size": "2335", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "tests/AuthenticatorTest.php", "mode": "33188", "license": "mit", "language": [ { "name": "PHP", "bytes": "8435" } ] }
namespace iSukces.Code.Interfaces { /* public interface ICodeWriter { void AppendText(string text); [NotNull] string GetCode(); int Indent { get; set; } } public static class CodeWriterExtensions { [NotNull] public static T AppendTextFormat<T>([NotNull] this T writer, string format, params object[] args) where T : ICodeWriter { if (writer == null) throw new ArgumentNullException(nameof(writer)); var text = string.Format(format, args); writer.AppendText(text); return writer; } } public interface ICsCodeMaker { void MakeCode(ICsCodeWritter writer); } */ }
{ "content_hash": "abce0e441010d356cc2be35771cbc619", "timestamp": "", "source": "github", "line_count": 39, "max_line_length": 105, "avg_line_length": 19.615384615384617, "alnum_prop": 0.5555555555555556, "repo_name": "isukces/isukces.code", "id": "2b0cfb365e6a24ba6661529c018438f8af33343a", "size": "767", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "isukces.code/interfaces/_codeFormatters/ICsCodeMaker.cs", "mode": "33188", "license": "mit", "language": [ { "name": "Batchfile", "bytes": "52" }, { "name": "C#", "bytes": "871212" } ] }
'use strict'; var module = angular.module('Thinder.Commander.Directives'); module.directive('thinderCommanderVersion', ['version', function (version) { return function (scope, elm, attrs) { elm.text(version); }; }]);
{ "content_hash": "f11aa2053d32dd18571972cae4078ba9", "timestamp": "", "source": "github", "line_count": 9, "max_line_length": 76, "avg_line_length": 26.11111111111111, "alnum_prop": 0.6723404255319149, "repo_name": "basdp/Thinder", "id": "1b101fa27459a2e3833b8db1cdd04600adcfd0b0", "size": "235", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "Commander/directives/version.js", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "C", "bytes": "7313" }, { "name": "CSS", "bytes": "2358" }, { "name": "HTML", "bytes": "2706" }, { "name": "JavaScript", "bytes": "1967" }, { "name": "Shell", "bytes": "64135" } ] }
module Admin::Resources::DataTypes::HasManyHelper def has_many_filter(filter) att_assoc = @resource.reflect_on_association(filter.to_sym) class_name = att_assoc.options[:class_name] || filter.classify resource = class_name.constantize items = [[Typus::I18n.t("View all %{attribute}", :attribute => @resource.human_attribute_name(filter).downcase.pluralize), ""]] items += resource.order(resource.typus_order_by).map { |v| [v.to_label, v.id] } end alias_method :has_and_belongs_to_many_filter, :has_many_filter def typus_form_has_many(field) setup_relationship(field) options = { "resource[#{@reflection.foreign_key}]" => @item.id } if @reflection.options && (as = @reflection.options[:as]) klass = @resource.is_sti? ? @resource.superclass : @resource options.merge!("#{as}_type" => klass) end build_pagination set_has_many_resource_actions locals = { :association_name => @association_name, :add_new => build_add_new_for_has_many(@model_to_relate, field, options), :table => build_relationship_table } render "admin/templates/has_many", locals end def build_add_new_for_has_many(klass, field, options = {}) if admin_user.can?("create", klass) html_options = set_modal_options_for(klass) html_options["url"] = "/admin/#{klass.to_resource}/new?_popup=true" link_to Typus::I18n.t("Add"), "##{html_options['data-controls-modal']}", html_options end end def set_has_many_resource_actions klass = @model_to_relate @resource_actions = [set_has_many_resource_edit_action(klass), set_has_many_resource_show_action(klass), set_has_many_resource_destroy_action(klass)] end def set_has_many_resource_edit_action(klass) html_options = set_modal_options_for(klass) [ "Edit", { :action => 'edit', :anchor => html_options['data-controls-modal'] }, html_options ] end def set_has_many_resource_show_action(klass) html_options = set_modal_options_for(klass) [ "Show", { :action => 'show', :anchor => html_options['data-controls-modal'] }, html_options ] end def set_has_many_resource_destroy_action(klass) [ "Trash", { :action => 'destroy' }, { :confirm => "Trash?" } ] end end
{ "content_hash": "fe61db86b5b1fb4bdc34c46e6bfe34e5", "timestamp": "", "source": "github", "line_count": 65, "max_line_length": 131, "avg_line_length": 35.46153846153846, "alnum_prop": 0.6433839479392625, "repo_name": "jogiranjith/typuspanel", "id": "1ac8666bd330ff817f1bee17fcfd79ab3abc6005", "size": "2305", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "app/helpers/admin/resources/data_types/has_many_helper.rb", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "210" }, { "name": "JavaScript", "bytes": "1379" }, { "name": "Python", "bytes": "6972" }, { "name": "Ruby", "bytes": "229905" }, { "name": "Shell", "bytes": "62" } ] }
#ifndef LOG_H__ #define LOG_H__ #include <ctime> #include <string> #include <iostream> #include <fstream> #include <sstream> #include <chrono> #include <memory> #include <thread> #include <functional> #include "Queue.h" #ifndef _WIN32 #include <syslog.h> #endif enum LogLevel { eLogNone = 0, eLogError, eLogWarning, eLogInfo, eLogDebug, eNumLogLevels }; enum LogType { eLogStdout = 0, eLogStream, eLogFile, #ifndef _WIN32 eLogSyslog, #endif }; namespace i2p { namespace log { struct LogMsg; /* forward declaration */ class Log { private: enum LogType m_Destination; enum LogLevel m_MinLevel; std::shared_ptr<std::ostream> m_LogStream; std::string m_Logfile; std::time_t m_LastTimestamp; char m_LastDateTime[64]; i2p::util::Queue<std::shared_ptr<LogMsg> > m_Queue; bool m_HasColors; std::string m_TimeFormat; volatile bool m_IsRunning; std::thread * m_Thread; private: /** prevent making copies */ Log (const Log &); const Log& operator=(const Log&); void Run (); void Process (std::shared_ptr<LogMsg> msg); /** * @brief Makes formatted string from unix timestamp * @param ts Second since epoch * * This function internally caches the result for last provided value */ const char * TimeAsString(std::time_t ts); public: Log (); ~Log (); LogType GetLogType () { return m_Destination; }; LogLevel GetLogLevel () { return m_MinLevel; }; void Start (); void Stop (); /** * @brief Sets minimal allowed level for log messages * @param level String with wanted minimal msg level */ void SetLogLevel (const std::string& level); /** * @brief Sets log destination to logfile * @param path Path to logfile */ void SendTo (const std::string &path); /** * @brief Sets log destination to given output stream * @param os Output stream */ void SendTo (std::shared_ptr<std::ostream> os); /** * @brief Sets format for timestamps in log * @param format String with timestamp format */ void SetTimeFormat (std::string format) { m_TimeFormat = format; }; #ifndef _WIN32 /** * @brief Sets log destination to syslog * @param name Wanted program name * @param facility Wanted log category */ void SendTo (const char *name, int facility); #endif /** * @brief Format log message and write to output stream/syslog * @param msg Pointer to processed message */ void Append(std::shared_ptr<i2p::log::LogMsg> &); /** @brief Reopen log file */ void Reopen(); }; /** * @struct LogMsg * @brief Log message container * * We creating it somewhere with LogPrint(), * then put in MsgQueue for later processing. */ struct LogMsg { std::time_t timestamp; std::string text; /**< message text as single string */ LogLevel level; /**< message level */ std::thread::id tid; /**< id of thread that generated message */ LogMsg (LogLevel lvl, std::time_t ts, std::string&& txt): timestamp(ts), text(std::move(txt)), level(lvl) {} }; Log & Logger(); typedef std::function<void (const std::string&)> ThrowFunction; ThrowFunction GetThrowFunction (); void SetThrowFunction (ThrowFunction f); } // log } // i2p /** internal usage only -- folding args array to single string */ template<typename TValue> void LogPrint (std::stringstream& s, TValue&& arg) noexcept { s << std::forward<TValue>(arg); } #if (__cplusplus < 201703L) // below C++ 17 /** internal usage only -- folding args array to single string */ template<typename TValue, typename... TArgs> void LogPrint (std::stringstream& s, TValue&& arg, TArgs&&... args) noexcept { LogPrint (s, std::forward<TValue>(arg)); LogPrint (s, std::forward<TArgs>(args)...); } #endif /** * @brief Create log message and send it to queue * @param level Message level (eLogError, eLogInfo, ...) * @param args Array of message parts */ template<typename... TArgs> void LogPrint (LogLevel level, TArgs&&... args) noexcept { i2p::log::Log &log = i2p::log::Logger(); if (level > log.GetLogLevel ()) return; // fold message to single string std::stringstream ss; #if (__cplusplus >= 201703L) // C++ 17 or higher (LogPrint (ss, std::forward<TArgs>(args)), ...); #else LogPrint (ss, std::forward<TArgs>(args)...); #endif auto msg = std::make_shared<i2p::log::LogMsg>(level, std::time(nullptr), std::move(ss).str()); msg->tid = std::this_thread::get_id(); log.Append(msg); } /** * @brief Throw fatal error message with the list of arguments * @param args Array of message parts */ template<typename... TArgs> void ThrowFatal (TArgs&&... args) noexcept { auto f = i2p::log::GetThrowFunction (); if (!f) return; // fold message to single string std::stringstream ss(""); #if (__cplusplus >= 201703L) // C++ 17 or higher (LogPrint (ss, std::forward<TArgs>(args)), ...); #else LogPrint (ss, std::forward<TArgs>(args)...); #endif f (ss.str ()); } #endif // LOG_H__
{ "content_hash": "9a5dbedc9dfe0b400e650bf8a2868c32", "timestamp": "", "source": "github", "line_count": 218, "max_line_length": 110, "avg_line_length": 22.908256880733944, "alnum_prop": 0.6503804565478575, "repo_name": "brain5lug/i2pd", "id": "08c401a9c8dcdefa0be0b457f8ab6c0e1c1f1fae", "size": "5182", "binary": false, "copies": "1", "ref": "refs/heads/openssl", "path": "libi2pd/Log.h", "mode": "33188", "license": "bsd-3-clause", "language": [ { "name": "Batchfile", "bytes": "4324" }, { "name": "C", "bytes": "2076" }, { "name": "C++", "bytes": "1923733" }, { "name": "CMake", "bytes": "21637" }, { "name": "CSS", "bytes": "5103" }, { "name": "Dockerfile", "bytes": "2510" }, { "name": "Emacs Lisp", "bytes": "67" }, { "name": "Go", "bytes": "600" }, { "name": "Inno Setup", "bytes": "2140" }, { "name": "Makefile", "bytes": "8294" }, { "name": "Shell", "bytes": "1177" } ] }
require 'compass/import-once/activate' # Require any additional compass plugins here. # Set this to the root of your project when deployed: http_path = "/" css_dir = "stylesheets" sass_dir = "_sass" images_dir = "images" javascripts_dir = "javascripts" # You can select your preferred output style here (can be overridden via the command line): # output_style = :expanded or :nested or :compact or :compressed output_style = :expanded # To enable relative paths to assets via compass helper functions. Uncomment: relative_assets = true # To disable debugging comments that display the original location of your selectors. Uncomment: line_comments = false # If you prefer the indented syntax, you might want to regenerate this # project again passing --syntax sass, or you can uncomment this: # preferred_syntax = :sass # and then run: # sass-convert -R --from scss --to sass sass scss && rm -rf sass && mv scss sass
{ "content_hash": "33e63abc3c64eec670eb5c82ed5098f5", "timestamp": "", "source": "github", "line_count": 26, "max_line_length": 96, "avg_line_length": 35.46153846153846, "alnum_prop": 0.7494577006507592, "repo_name": "twainj/twainj.github.io", "id": "b814ec19ca4ebef1ecd6dc92ed6034dcecc26371", "size": "922", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "config.rb", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "53942" }, { "name": "HTML", "bytes": "19587" }, { "name": "JavaScript", "bytes": "17685" }, { "name": "Ruby", "bytes": "1111" } ] }
import express from 'express'; import bodyParser from 'body-parser'; import path from 'path'; import favicon from 'serve-favicon'; import webpack from 'webpack'; import webpackDevMiddleware from 'webpack-dev-middleware'; import webpackHotMiddleware from 'webpack-hot-middleware'; import graphQLHandler from '../api/graphql'; import webpackConfig from './webpack/webpack.dev'; const APP_PORT = parseInt(process.env.PORT, 10); const app = express(); const compiler = webpack(webpackConfig); const middleware = webpackDevMiddleware(compiler, { noInfo: true, publicPath: webpackConfig.output.publicPath, silent: true, stats: 'errors-only', }); app.use(bodyParser.json()); app.use((req, res, next) => { console.log(new Date(), req.method, req.url); next(); }); app.post('/graphql', (req, res) => { graphQLHandler(req.body.query, req.body.variables) .then(result => { res.setHeader('Content-Type', 'application/json; charset=utf-8'); res.end(JSON.stringify(result, null, 2)); }) .catch(err => res.end(err)); }); app.use(middleware); app.use(webpackHotMiddleware(compiler)); app.use(favicon(path.resolve(process.cwd(), 'app/favicon.ico'))); app.get('*', (req, res) => { const indexFilePath = path.join(compiler.outputPath, 'index.html'); middleware.fileSystem.readFile(indexFilePath, (err, file) => { if (err) { res.sendStatus(404); } else { res.send(file.toString()); } }); }); app.listen(APP_PORT, (err) => { if (err) console.log(err); console.log(`App is now running on http://localhost:${APP_PORT}`); });
{ "content_hash": "f948cf5246bf6549c6eac2949eba4a51", "timestamp": "", "source": "github", "line_count": 55, "max_line_length": 71, "avg_line_length": 28.745454545454546, "alnum_prop": 0.6818469323213157, "repo_name": "beingmohit/tranium", "id": "2dd213fddf5b53002d0f7bbb44daec7fc1e49e0e", "size": "1581", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "scripts/devServer.js", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "1873" }, { "name": "HTML", "bytes": "528" }, { "name": "JavaScript", "bytes": "20440" } ] }
@implementation ZEasing_Quintic + (CGFloat)easeIn:(CGFloat)currentTime fromValue:(CGFloat)fromValue toValue:(CGFloat)toValue duration:(CGFloat)duration { toValue = toValue - fromValue; return (currentTime >= duration) ? fromValue + toValue : toValue * (currentTime /= duration) * currentTime * currentTime * currentTime * currentTime + fromValue; } + (CGFloat)easeOut:(CGFloat)currentTime fromValue:(CGFloat)fromValue toValue:(CGFloat)toValue duration:(CGFloat)duration { toValue = toValue - fromValue; return (currentTime >= duration) ? fromValue + toValue : toValue * ((currentTime = currentTime / duration - 1) * currentTime * currentTime * currentTime * currentTime + 1) + fromValue; } + (CGFloat)easeInOut:(CGFloat)currentTime fromValue:(CGFloat)fromValue toValue:(CGFloat)toValue duration:(CGFloat)duration { toValue = toValue - fromValue; if ((currentTime /= duration / 2) < 1) { return (currentTime >= duration) ? fromValue + toValue : toValue / 2 * currentTime * currentTime * currentTime * currentTime * currentTime + fromValue; } else { return (currentTime >= duration) ? fromValue + toValue : toValue / 2 * ((currentTime -= 2) * currentTime * currentTime * currentTime * currentTime - 2) + fromValue; } } @end
{ "content_hash": "927f77a9b129da8eb62d03d22e689dad", "timestamp": "", "source": "github", "line_count": 26, "max_line_length": 189, "avg_line_length": 49.80769230769231, "alnum_prop": 0.7042471042471042, "repo_name": "zhuayi/ZEasing", "id": "e69c402a49991db4e613171a22af31269e1c6325", "size": "1456", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "Pod/Classes/ZEasing+Quintic.m", "mode": "33188", "license": "mit", "language": [ { "name": "C", "bytes": "810" }, { "name": "Objective-C", "bytes": "17938" }, { "name": "Ruby", "bytes": "1545" }, { "name": "Shell", "bytes": "9314" } ] }
layout: page title: Palace Entertainment Seminar date: 2016-05-24 author: Katherine Shaffer tags: weekly links, java status: published summary: Vestibulum interdum tempus lectus. Curabitur ut elit condimentum. banner: images/banner/leisure-05.jpg booking: startDate: 06/08/2018 endDate: 06/12/2018 ctyhocn: MOBFHHX groupCode: PES published: true --- Interdum et malesuada fames ac ante ipsum primis in faucibus. Nam volutpat venenatis purus, a aliquam magna efficitur eget. Sed vitae erat eu magna pretium venenatis vitae et sem. Nulla diam elit, fringilla eget finibus at, venenatis in turpis. Suspendisse erat nisi, accumsan id dapibus vel, eleifend sit amet dui. Fusce mollis, purus quis aliquam porttitor, nunc est imperdiet nisl, non feugiat orci metus sit amet justo. Cras imperdiet dui lectus, ut placerat purus rhoncus non. Nulla egestas nulla metus, rhoncus varius nibh vulputate vitae. In porttitor ex a velit volutpat, at blandit risus hendrerit. Pellentesque ac placerat neque, nec vehicula nisl. Ut id ligula eget risus sollicitudin volutpat. Aliquam at mauris lobortis, volutpat elit sit amet, laoreet lacus. Interdum et malesuada fames ac ante ipsum primis in faucibus. Nulla facilisi. Proin hendrerit elit enim, ac euismod odio dapibus a. * Cras ut enim a velit feugiat gravida * Sed a augue convallis, pretium massa eget, consectetur nunc * Nunc pulvinar purus in faucibus maximus * Duis vel elit maximus, aliquet magna at, pellentesque odio * Quisque sagittis massa sit amet velit vestibulum, in cursus tortor tristique. Maecenas in egestas eros. Nullam quis elit malesuada, posuere nulla sit amet, convallis elit. Sed efficitur neque ut orci ultrices auctor. Aenean ac augue tincidunt, congue diam et, consequat dolor. Aliquam sed velit quam. Phasellus metus odio, placerat vitae fermentum sed, vulputate non sapien. Nunc venenatis mauris tincidunt dictum feugiat. Praesent pellentesque nulla nec dapibus laoreet. Morbi sit amet feugiat purus. Duis luctus sapien a tortor volutpat, id tincidunt ante ullamcorper.
{ "content_hash": "a2616939bdd0bb219f92c93b08266bb9", "timestamp": "", "source": "github", "line_count": 24, "max_line_length": 904, "avg_line_length": 85.08333333333333, "alnum_prop": 0.8060724779627816, "repo_name": "KlishGroup/prose-pogs", "id": "10f7dde75ea4695bd9a6663c3207b6f952191546", "size": "2046", "binary": false, "copies": "1", "ref": "refs/heads/gh-pages", "path": "pogs/M/MOBFHHX/PES/index.md", "mode": "33188", "license": "mit", "language": [] }
from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('app', '0001_initial'), ] operations = [ migrations.AddField( model_name='user', name='manual_created_date', field=models.DateTimeField(blank=True, null=True, verbose_name='manual created date'), ), ]
{ "content_hash": "a7589070b8e47d7084b49a187ada2254", "timestamp": "", "source": "github", "line_count": 18, "max_line_length": 98, "avg_line_length": 23.333333333333332, "alnum_prop": 0.6071428571428571, "repo_name": "druids/django-pyston", "id": "7ac481ec921323f4288e3b0a62cd2c9ff721d576", "size": "491", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "example/dj/apps/app/migrations/0002_user_manual_created_date.py", "mode": "33188", "license": "bsd-3-clause", "language": [ { "name": "HTML", "bytes": "9676" }, { "name": "Makefile", "bytes": "3369" }, { "name": "Python", "bytes": "405274" } ] }
var hapi = require('hapi'); var socketIO = require('socket.io'); var socketIoContainer = require('./app/socketIoContainer') var generalRoutes = require('./app/routes'); var apiRoutes = require('./api/routes'); var remoteLights = require('./app/remoteLights'); var webApi = require('./webapi/control'); var state = require('./api/state'); var discovery = require('./api/discovery'); if (process.argv.length > 2) { state.port = parseInt(process.argv[2]); } else { state.port = 80; } var server = new hapi.createServer('0.0.0.0', state.port, { files : { 'relativeTo' : 'routes' } }); apiRoutes.addRoutes(server); generalRoutes.addRoutes(server); discovery.enableDiscovery(); // Add the initial 3 lights webApi.addLight({model : 'LCT001'}); webApi.addLight({model : 'LCT001'}); webApi.addLight({model : 'LCT001'}); server.start(function () { var io = socketIO.listen(server.listener, { log: false}); socketIoContainer.io = io; io.sockets.on('connection', function(socket){ console.log('Client Connected'); remoteLights.sendAllLights(); }); }) console.log('Listening on http://0.0.0.0:' + state.port );
{ "content_hash": "606764ff00ac6dfafe8aa01babccfcbe", "timestamp": "", "source": "github", "line_count": 48, "max_line_length": 61, "avg_line_length": 24.333333333333332, "alnum_prop": 0.660958904109589, "repo_name": "bruderstein/huemulator", "id": "569e9e94789221d0e7407ee2820fb4f41372ba88", "size": "1168", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "server.js", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "6767" }, { "name": "JavaScript", "bytes": "41097" } ] }
default_app_config = 'django_ethereum_events.apps.EthereumEventsConfig'
{ "content_hash": "1f27feead865e4c5e4bb794fce762564", "timestamp": "", "source": "github", "line_count": 1, "max_line_length": 71, "avg_line_length": 72, "alnum_prop": 0.8333333333333334, "repo_name": "artemistomaras/django-ethereum-events", "id": "b45c1157d9e25357f33efeaf02b4a12d5cb40f5b", "size": "72", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "django_ethereum_events/__init__.py", "mode": "33188", "license": "mit", "language": [ { "name": "JavaScript", "bytes": "4086" }, { "name": "Python", "bytes": "66636" }, { "name": "Solidity", "bytes": "724" } ] }
<?php namespace ITSS\TicketsBundle\DependencyInjection; use Symfony\Component\Config\Definition\Builder\TreeBuilder; use Symfony\Component\Config\Definition\ConfigurationInterface; /** * This is the class that validates and merges configuration from your app/config files * * To learn more see {@link http://symfony.com/doc/current/cookbook/bundles/extension.html#cookbook-bundles-extension-config-class} */ class Configuration implements ConfigurationInterface { /** * {@inheritdoc} */ public function getConfigTreeBuilder() { $treeBuilder = new TreeBuilder(); $rootNode = $treeBuilder->root('itss_tickets'); // Here you should define the parameters that are allowed to // configure your bundle. See the documentation linked above for // more information on that topic. return $treeBuilder; } }
{ "content_hash": "063f809f7ac5b9a30fb0caed9b02f17d", "timestamp": "", "source": "github", "line_count": 29, "max_line_length": 131, "avg_line_length": 30.310344827586206, "alnum_prop": 0.7167235494880546, "repo_name": "BornAgain/tickets", "id": "5b0289827e1e3213391ef77ff448c35cf00bae87", "size": "879", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "src/ITSS/TicketsBundle/DependencyInjection/Configuration.php", "mode": "33188", "license": "mit", "language": [ { "name": "ApacheConf", "bytes": "3073" }, { "name": "Batchfile", "bytes": "111" }, { "name": "CSS", "bytes": "536443" }, { "name": "HTML", "bytes": "1262092" }, { "name": "JavaScript", "bytes": "1528822" }, { "name": "PHP", "bytes": "113197" }, { "name": "Shell", "bytes": "166" } ] }
require_relative "../sqs-ruby-example-show-queues" describe "#list_queue_urls" do let(:sqs_client) do Aws::SQS::Client.new( stub_responses: { list_queues: { queue_urls: [ "https://sqs.us-west-2.amazonaws.com/111111111111/my-queue", "https://sqs.us-west-2.amazonaws.com/111111111111/my-queue-2" ] } } ) end it "lists available queue URLs" do expect { list_queue_urls(sqs_client) }.to_not raise_error end end describe "#list_queue_attributes" do let(:queue_name) { "my-queue" } let(:queue_url) { "https://sqs.us-west-2.amazonaws.com/111111111111/" + queue_name } let(:sqs_client) do Aws::SQS::Client.new( stub_responses: { get_queue_attributes: { attributes: { "QueueArn" => "arn:aws:sqs:us-west-2:992648334831:my-queue", "ApproximateNumberOfMessages" => "2", "ApproximateNumberOfMessagesNotVisible" => "0", "ApproximateNumberOfMessagesDelayed" => "0", "CreatedTimestamp" => "1612302412", "LastModifiedTimestamp" => "1612302412", "VisibilityTimeout" => "30", "MaximumMessageSize" => "262144", "MessageRetentionPeriod" => "345600", "DelaySeconds" => "0", "ReceiveMessageWaitTimeSeconds" => "0" } } } ) end it "lists a queue's attributes" do expect { list_queue_attributes(sqs_client, queue_url) }.to_not raise_error end end
{ "content_hash": "92956dad3d6677a2a7d94ec31f0c13de", "timestamp": "", "source": "github", "line_count": 50, "max_line_length": 86, "avg_line_length": 30.2, "alnum_prop": 0.5821192052980132, "repo_name": "awsdocs/aws-doc-sdk-examples", "id": "2ef6923dfdf92d2f2c7795c4ee3b32d7b31ca1b4", "size": "1618", "binary": false, "copies": "1", "ref": "refs/heads/main", "path": "ruby/example_code/sqs/tests/test_sqs-ruby-example-show-queues.rb", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "ABAP", "bytes": "476653" }, { "name": "Batchfile", "bytes": "900" }, { "name": "C", "bytes": "3852" }, { "name": "C#", "bytes": "2051923" }, { "name": "C++", "bytes": "943634" }, { "name": "CMake", "bytes": "82068" }, { "name": "CSS", "bytes": "33378" }, { "name": "Dockerfile", "bytes": "2243" }, { "name": "Go", "bytes": "1764292" }, { "name": "HTML", "bytes": "319090" }, { "name": "Java", "bytes": "4966853" }, { "name": "JavaScript", "bytes": "1655476" }, { "name": "Jupyter Notebook", "bytes": "9749" }, { "name": "Kotlin", "bytes": "1099902" }, { "name": "Makefile", "bytes": "4922" }, { "name": "PHP", "bytes": "1220594" }, { "name": "Python", "bytes": "2507509" }, { "name": "Ruby", "bytes": "500331" }, { "name": "Rust", "bytes": "558811" }, { "name": "Shell", "bytes": "63776" }, { "name": "Swift", "bytes": "267325" }, { "name": "TypeScript", "bytes": "119632" } ] }
#import "NSObject.h" @class NSString; @interface SBFileLogger : NSObject { int _logLevel; id <SBFileLoggerDelegate> _delegate; } @property(readonly, nonatomic) int logLevel; // @synthesize logLevel=_logLevel; @property(nonatomic) id <SBFileLoggerDelegate> delegate; // @synthesize delegate=_delegate; - (void)willBeginLoggingToPath:(id)arg1; - (id)consoleFormat:(id)arg1 withArguments:(struct __va_list_tag [1])arg2; - (id)fileFormat:(id)arg1 withArguments:(struct __va_list_tag [1])arg2; - (void)reloadFromDefaults; @property(readonly, nonatomic) int maxLogSize; @property(readonly, nonatomic) int maxLogCount; @property(readonly, nonatomic) _Bool includeConsole; @property(readonly, nonatomic) NSString *logPath; @property(readonly, nonatomic) NSString *name; @property(readonly, nonatomic, getter=isEnabled) _Bool enabled; - (void)dealloc; - (id)init; @end
{ "content_hash": "0caa75d2dcbe15d8d62f1b9ad25ee8f6", "timestamp": "", "source": "github", "line_count": 29, "max_line_length": 91, "avg_line_length": 30.17241379310345, "alnum_prop": 0.7542857142857143, "repo_name": "matthewsot/CocoaSharp", "id": "4d12ce3a6d1156319cd235900c60f0a19ab62159", "size": "1015", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "Headers/SpringBoard/SBFileLogger.h", "mode": "33188", "license": "mit", "language": [ { "name": "C", "bytes": "259784" }, { "name": "C#", "bytes": "2789005" }, { "name": "C++", "bytes": "252504" }, { "name": "Objective-C", "bytes": "24301417" }, { "name": "Smalltalk", "bytes": "167909" } ] }
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), Ui(new Ui::MainWindow), LeftDirectorySelector(), RightDirectorySelector(), DataTransferer(), Error(this), Progress(this), About(this), Help(this), TransferThread() { Ui->setupUi(this); LeftDirectorySelector.reset(new SteamAppDirectorySelector(Ui->SteamAppLocationLeftText, Ui->AppsLeftListBox, this)); RightDirectorySelector.reset(new SteamAppDirectorySelector(Ui->SteamAppLocationRightText, Ui->AppsRightListBox, this)); connect(Ui->BrowseLeftBtn, SIGNAL(clicked()), LeftDirectorySelector.data(), SLOT(OpenFileDialog())); connect(Ui->RefreshBtn, SIGNAL(clicked()), LeftDirectorySelector.data(), SLOT(Refresh())); connect(Ui->BrowseRightBtn, SIGNAL(clicked()), RightDirectorySelector.data(), SLOT(OpenFileDialog())); connect(Ui->RefreshBtn, SIGNAL(clicked()), RightDirectorySelector.data(), SLOT(Refresh())); connect(Ui->MoveSelectedRightBtn, SIGNAL(clicked()), LeftDirectorySelector.data(), SLOT(MoveSelectedApps())); connect(Ui->MoveSelectedLeftBtn, SIGNAL(clicked()), RightDirectorySelector.data(), SLOT(MoveSelectedApps())); connect(Ui->MoveAllRightBtn, SIGNAL(clicked()), LeftDirectorySelector.data(), SLOT(MoveAllApps())); connect(Ui->MoveAllLeftBtn, SIGNAL(clicked()), RightDirectorySelector.data(), SLOT(MoveAllApps())); connect(Ui->actionAbout, SIGNAL(triggered()), &About, SLOT(show())); connect(Ui->actionHelp, SIGNAL(triggered()), &Help, SLOT(show())); SetupTransferer(); } void MainWindow::SetupTransferer() { connect(LeftDirectorySelector.data(), SIGNAL(AppDirChanged(QString)), &DataTransferer, SLOT(SetLeftDir(QString))); connect(RightDirectorySelector.data(), SIGNAL(AppDirChanged(QString)), &DataTransferer, SLOT(SetRightDir(QString))); connect(LeftDirectorySelector.data(), SIGNAL(MoveApps(QList<QSharedPointer<SteamAppListItem> >)), &DataTransferer, SLOT(MoveAppsLeftToRight(QList<QSharedPointer<SteamAppListItem> >))); connect(RightDirectorySelector.data(), SIGNAL(MoveApps(QList<QSharedPointer<SteamAppListItem> >)), &DataTransferer, SLOT(MoveAppsRightToLeft(QList<QSharedPointer<SteamAppListItem> >))); connect(&DataTransferer, SIGNAL(TransferComplete()), LeftDirectorySelector.data(), SLOT(Refresh())); connect(&DataTransferer, SIGNAL(TransferComplete()), RightDirectorySelector.data(), SLOT(Refresh())); connect(&DataTransferer, SIGNAL(ErrorsDuringTransfer(QList<AppTransferError>)), &Error, SLOT(Show(QList<AppTransferError>))); connect(&Error, SIGNAL(RetryTransfer(QList<QSharedPointer<SteamAppListItem> >)), &DataTransferer, SLOT(RetryPreviousTransfer(QList<QSharedPointer<SteamAppListItem> >))); connect(&DataTransferer, SIGNAL(TransferBeginning(int)), &Progress, SLOT(Show(int))); connect(&DataTransferer, SIGNAL(TransferComplete()), &Progress, SLOT(Hide())); connect(&DataTransferer, SIGNAL(SingleTransferStarting()), &Progress, SLOT(NewTransferStarted())); connect(&DataTransferer, SIGNAL(TransferProgress(QString,int)), &Progress, SLOT(UpdateProgress(QString,int))); connect(&Progress, SIGNAL(Abort()), this, SLOT(AbortTransfer())); DataTransferer.moveToThread(&TransferThread); TransferThread.start(); LeftDirectorySelector->Refresh(); RightDirectorySelector->Refresh(); } void MainWindow::AbortTransfer() { DataTransferer.AbortTransfer(); } MainWindow::~MainWindow() { TransferThread.quit(); TransferThread.wait(1000); delete Ui; Ui = NULL; }
{ "content_hash": "80ae3cb892c71ab258edab06fed9c713", "timestamp": "", "source": "github", "line_count": 81, "max_line_length": 189, "avg_line_length": 46.592592592592595, "alnum_prop": 0.6981981981981982, "repo_name": "larryprice/SteamGameMover", "id": "10b1245cdbfd214b3bcca296f90cfeaaf7721736", "size": "3866", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "SteamGameMover/MainWindow.cpp", "mode": "33188", "license": "mit", "language": [ { "name": "C++", "bytes": "51757" }, { "name": "Prolog", "bytes": "2300" } ] }
from basic_utils.layers import ConcatFixedStd, Add_One, Softplus from basic_utils.utils import * from models.optimizers import Target_Updater class StochPolicy: def __init__(self, net, probtype, updater, target_net=None, tau=0.01, update_target_every=None): self.net = net self.target_net = target_net self.target_updater = Target_Updater(self.net, self.target_net, tau, update_target_every) self.probtype = probtype self.updater = updater def act(self, ob, target=False): ob = turn_into_cuda(np_to_var(ob)) if target: prob = self.target_net(ob).data.cpu().numpy() else: prob = self.net(ob).data.cpu().numpy() return self.probtype.sample(prob) def update(self, *args): stats = self.updater(*args) self.target_updater.update() return stats def save_model(self, name): torch.save(self.net, name + "_policy.pkl") def load_model(self, name): net = torch.load(name + "_policy.pkl") self.net.load_state_dict(net.state_dict()) if self.target_net is not None: self.target_net.load_state_dict(net.state_dict()) # ================================================================ # Abstract Class of Probtype # ================================================================ class Probtype: """ This is the abstract class of probtype. """ def likelihood(self, a, prob): """ Output the likelihood of an action given the parameters of the probability. Args: a: the action prob: the parameters of the probability Return: likelihood: the likelihood of the action """ raise NotImplementedError def loglikelihood(self, a, prob): """ Output the log likelihood of an action given the parameters of the probability. Args: a: the action prob: the parameters of the probability Return: log_likelihood: the log likelihood of the action """ raise NotImplementedError def kl(self, prob0, prob1): """ Output the kl divergence of two given distributions Args: prob0: the parameter of the first distribution prob1: the parameter of the second distribution Return: kl: the kl divergence between the two distributions """ raise NotImplementedError def entropy(self, prob0): """ Output the entropy of one given distribution Args: prob0: the parameter of the distribution Return: entropy: the entropy of the distribution """ raise NotImplementedError def sample(self, prob): """ Sample action from the given distribution. Args: prob: the parameter of the distribution Return: action: the sampled action """ raise NotImplementedError def maxprob(self, prob): """ Sample action with the maximum likelihood. Args: prob: the parameter of the distribution Return: action: the sampled action """ raise NotImplementedError def output_layers(self, oshp): """ Set the output layer needed for the distribution. Args: oshp: the input shape Return: layer: the corresponding layer """ raise NotImplementedError def process_act(self, a): """ Optional action processer. Args: a: the action to be processed Return: processed_action: the processed action """ return a class Deterministic(Probtype): """ The deterministic policy type for the continuous action space, which directly determines the output point. """ def __init__(self, ac_space): self.d = ac_space.shape[0] def likelihood(self, a, prob): pass def loglikelihood(self, a, prob): pass def kl(self, prob0, prob1): pass def entropy(self, prob0): pass def sample(self, prob): return prob def maxprob(self, prob): return prob def output_layers(self, oshp): return [nn.Linear(oshp, self.d)] class Categorical(Probtype): """ The multinomial distribution for discrete action space. It gives a vector representing the probability for selecting each action. """ def __init__(self, ac_space): self.n = ac_space.n def likelihood(self, a, prob): return prob.gather(1, a.long()) def loglikelihood(self, a, prob): return self.likelihood(a, prob).log() def kl(self, prob0, prob1): return (prob0 * torch.log(prob0 / prob1)).sum(dim=1) def entropy(self, prob0): return - (prob0 * prob0.log()).sum(dim=1) def sample(self, prob): assert prob.ndim == 2 N = prob.shape[0] csprob_nk = np.cumsum(prob, axis=1) return np.argmax(csprob_nk > np.random.rand(N, 1), axis=1) def maxprob(self, prob): return prob.argmax(axis=1) def output_layers(self, oshp): return [nn.Linear(oshp, self.n), nn.Softmax()] class DiagGauss(Probtype): """ The diagonal Gauss distribution for continuous action space. It models the distribution of the action as independent Gaussian distribution. """ def __init__(self, ac_space): self.d = ac_space.shape[0] def loglikelihood(self, a, prob): mean0 = prob[:, :self.d] std0 = prob[:, self.d:] return - 0.5 * (((a - mean0) / std0).pow(2)).sum(dim=1, keepdim=True) - 0.5 * np.log( 2.0 * np.pi) * self.d - std0.log().sum(dim=1, keepdim=True) def likelihood(self, a, prob): return self.loglikelihood(a, prob).exp() def kl(self, prob0, prob1): mean0 = prob0[:, :self.d] std0 = prob0[:, self.d:] mean1 = prob1[:, :self.d] std1 = prob1[:, self.d:] return ((std1 / std0).log()).sum(dim=1) + ( (std0.pow(2) + (mean0 - mean1).pow(2)) / (2.0 * std1.pow(2))).sum(dim=1) - 0.5 * self.d def entropy(self, prob): std_nd = prob[:, self.d:] return std_nd.log().sum(dim=1) + .5 * np.log(2 * np.pi * np.e) * self.d def sample(self, prob): mean_nd = prob[:, :self.d] std_nd = prob[:, self.d:] return np.random.randn(prob.shape[0], self.d) * std_nd + mean_nd def maxprob(self, prob): return prob[:, :self.d] def output_layers(self, oshp): return [nn.Linear(oshp, self.d), ConcatFixedStd(self.d)] class DiagBeta(Probtype): """ The diagonal Beta distribution for continuous action space. It models the distribution of the action as independent Beta distribution. """ def __init__(self, ac_space): self.d = ac_space.shape[0] self.scale = ac_space.high - ac_space.low self.center = (ac_space.high + ac_space.low)/2 def loglikelihood(self, a, prob): prob = prob.view(-1, self.d, 2) lbeta = log_gamma(prob[:, :, 0]) + log_gamma(prob[:, :, 1]) - log_gamma(prob[:, :, 0] + prob[:, :, 1]) lp = -lbeta + (prob[:, :, 0] - 1) * torch.log(a) + (prob[:, :, 1] - 1) * torch.log(1 - a) lp = lp.sum(dim=-1, keepdim=True) return lp def likelihood(self, a, prob): return torch.exp(self.loglikelihood(a, prob)) def kl(self, prob0, prob1): prob0 = prob0.view(-1, self.d, 2) prob1 = prob1.view(-1, self.d, 2) alpha0 = prob0[:, :, 0] beta0 = prob0[:, :, 1] alpha1 = prob1[:, :, 0] beta1 = prob1[:, :, 1] lbeta0 = log_gamma(alpha0) + log_gamma(beta0) - log_gamma(alpha0 + beta0) lbeta1 = log_gamma(alpha1) + log_gamma(beta1) - log_gamma(alpha1 + beta1) kl = -lbeta0 + lbeta1 + (alpha0 - alpha1) * (digamma(alpha0) - digamma(alpha0 + beta0) ) + (beta0 - beta1) * (digamma(beta0) - digamma(alpha0 + beta0)) kl = kl.sum(dim=-1) return kl def entropy(self, prob): prob = prob.view(-1, self.d, 2) alpha = prob[:, :, 0] beta = prob[:, :, 1] lbeta = log_gamma(alpha) + log_gamma(beta) - log_gamma(alpha + beta) ent = -lbeta + (prob[:, :, 0] - 1) * (digamma( prob[:, :, 0]) - digamma(prob[:, :, 0] + prob[:, :, 1])) + (prob[:, :, 1] - 1) * (digamma( prob[:, :, 1]) - digamma(prob[:, :, 0] + prob[:, :, 1])) ent = ent.sum(dim=-1) return ent def sample(self, prob): prob = np.reshape(prob, (-1, self.d, 2)) alpha = prob[:, :, 0] beta = prob[:, :, 1] return np.random.beta(alpha, beta) def process_act(self, a): a = a - 0.5 return a * self.scale + self.center def output_layers(self, oshp): return [nn.Linear(oshp, 2 * self.d), Softplus(), Add_One()]
{ "content_hash": "7cc31e6abac280a630e4a6de15bf2c0c", "timestamp": "", "source": "github", "line_count": 302, "max_line_length": 110, "avg_line_length": 29.857615894039736, "alnum_prop": 0.5549517577908395, "repo_name": "hzxsnczpku/banrinochoujou", "id": "b2234a107370f91cb0e66b07ebb1d43c2f749175", "size": "9017", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "models/policies.py", "mode": "33188", "license": "mit", "language": [ { "name": "Python", "bytes": "130283" } ] }
package io.fabric8.openshift; import org.fusesource.common.util.Maps; import org.fusesource.common.util.Strings; import org.fusesource.common.util.Systems; import io.fabric8.api.Container; import io.fabric8.api.ContainerAutoScaler; import io.fabric8.api.Containers; import io.fabric8.api.FabricService; import io.fabric8.api.NameValidator; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.util.List; import java.util.Map; /** */ public class OpenShiftAutoScaler implements ContainerAutoScaler { private static final transient Logger LOG = LoggerFactory.getLogger(OpenShiftAutoScaler.class); private final OpenshiftContainerProvider containerProvider; public OpenShiftAutoScaler(OpenshiftContainerProvider containerProvider) { this.containerProvider = containerProvider; } @Override public int getWeight() { return 100; } @Override public void createContainers(String version, String profile, int count) throws Exception { FabricService fabricService = containerProvider.getFabricService(); CreateOpenshiftContainerOptions.Builder builder = null; if (fabricService != null) { builder = createAutoScaleOptions(fabricService); } if (builder != null) { // TODO this is actually generic to all providers! :) for (int i = 0; i < count; i++) { Container[] containers = fabricService.getContainers(); final CreateOpenshiftContainerOptions.Builder configuredBuilder = builder.number(1).version(version).profiles(profile); NameValidator openShiftValidator = containerProvider.createNameValidator(configuredBuilder.build()); NameValidator fabricNameValidator = Containers.createNameValidator(fabricService.getContainers()); NameValidator nameValidator = Containers.joinNameValidators(openShiftValidator, fabricNameValidator); String name = Containers.createContainerName(containers, profile, containerProvider.getScheme(), nameValidator); CreateOpenshiftContainerOptions options = configuredBuilder.name(name).build(); LOG.info("Creating container name " + name + " version " + version + " profile " + profile + " " + count + " container(s)"); fabricService.createContainers(options); } } else { LOG.warn("Could not create version " + version + " profile " + profile + " due to missing autoscale configuration"); } } protected CreateOpenshiftContainerOptions.Builder createAutoScaleOptions(FabricService fabricService) { CreateOpenshiftContainerOptions.Builder builder = CreateOpenshiftContainerOptions.builder(); String zookeeperUrl = fabricService.getZookeeperUrl(); String zookeeperPassword = fabricService.getZookeeperPassword(); builder = builder.zookeeperUrl(zookeeperUrl).zookeeperPassword(zookeeperPassword); Map<String, ?> properties = containerProvider.getConfiguration(); String serverUrl = validateProperty(properties, "serverUrl", OpenshiftContainerProvider.PROPERTY_AUTOSCALE_SERVER_URL, "OPENSHIFT_BROKER_HOST", OpenShiftConstants.DEFAULT_SERVER_URL); String domain = validateProperty(properties, "domain", OpenshiftContainerProvider.PROPERTY_AUTOSCALE_DOMAIN, "OPENSHIFT_NAMESPACE", ""); String login = validateProperty(properties, "login", OpenshiftContainerProvider.PROPERTY_AUTOSCALE_LOGIN, "OPENSHIFT_LOGIN", ""); String password = validateProperty(properties, "login", OpenshiftContainerProvider.PROPERTY_AUTOSCALE_PASSWORD, "OPENSHIFT_PASSWORD", ""); if (Strings.isNotBlank(domain) && Strings.isNotBlank(login) && Strings.isNotBlank(password)) { LOG.info("Using serverUrl: " + serverUrl + " domain: " + domain + " login: " + login); return builder.serverUrl(serverUrl).domain(domain).login(login).password(password); } else { return null; } } protected String validateProperty(Map<String, ?> properties, String name, String propertyName, String envVarName, String defaultValue) { String answer = Maps.stringValue(properties, propertyName, Systems.getEnvVar(envVarName, defaultValue)); if (Strings.isNullOrBlank(answer)) { LOG.warn("No configured value for " + name + " in property " + propertyName + " or environment variable $" + envVarName); } return answer; } @Override public void destroyContainers(String profile, int count, List<Container> containers) { // TODO } }
{ "content_hash": "0df8a05bbabf5507e042e390bf678db5", "timestamp": "", "source": "github", "line_count": 116, "max_line_length": 140, "avg_line_length": 42.327586206896555, "alnum_prop": 0.6716904276985743, "repo_name": "alexeev/jboss-fuse-mirror", "id": "8f4614727b153291de4333de7add5c3e0b5dbd8a", "size": "5533", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "fabric/fabric-openshift/src/main/java/io/fabric8/openshift/OpenShiftAutoScaler.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "CSS", "bytes": "313969" }, { "name": "CoffeeScript", "bytes": "278706" }, { "name": "Java", "bytes": "8498768" }, { "name": "JavaScript", "bytes": "2483260" }, { "name": "Kotlin", "bytes": "14282" }, { "name": "Scala", "bytes": "484151" }, { "name": "Shell", "bytes": "11547" }, { "name": "XSLT", "bytes": "26098" } ] }
package com.intellij.vcs.log.ui; import com.intellij.util.NotNullFunction; import com.intellij.util.containers.ContainerUtil; import com.intellij.vcs.log.*; import com.intellij.vcs.log.data.VcsLogDataManager; import com.intellij.vcs.log.ui.filter.VcsLogUserFilterImpl; import com.intellij.vcs.log.util.VcsUserUtil; import org.jetbrains.annotations.NotNull; import java.util.Collection; import java.util.Collections; import java.util.Set; public class MyCommitsHighlighter implements VcsLogHighlighter { @NotNull private final VcsLogDataManager myDataManager; @NotNull private final VcsLogUi myLogUi; private boolean myShouldHighlightUser = false; public MyCommitsHighlighter(@NotNull VcsLogDataManager logDataManager, @NotNull VcsLogUi logUi) { myDataManager = logDataManager; myLogUi = logUi; } @NotNull @Override public VcsCommitStyle getStyle(@NotNull VcsShortCommitDetails details, boolean isSelected) { if (!myLogUi.isHighlighterEnabled(Factory.ID)) return VcsCommitStyle.DEFAULT; if (myShouldHighlightUser) { VcsUser currentUser = myDataManager.getCurrentUser().get(details.getRoot()); if (currentUser != null && VcsUserUtil.isSamePerson(currentUser, details.getAuthor())) { return VcsCommitStyleFactory.bold(); } } return VcsCommitStyle.DEFAULT; } @Override public void update(@NotNull VcsLogDataPack dataPack, boolean refreshHappened) { myShouldHighlightUser = !isSingleUser() && !isFilteredByCurrentUser(dataPack.getFilters()); } // returns true if only one user commits to this repository private boolean isSingleUser() { NotNullFunction<VcsUser, String> nameToString = new NotNullFunction<VcsUser, String>() { @NotNull @Override public String fun(VcsUser user) { return VcsUserUtil.getNameInStandardForm(VcsUserUtil.getShortPresentation(user)); } }; Set<String> allUserNames = ContainerUtil.newHashSet(ContainerUtil.map(myDataManager.getAllUsers(), nameToString)); Set<String> currentUserNames = ContainerUtil.newHashSet(ContainerUtil.map(myDataManager.getCurrentUser().values(), nameToString)); return allUserNames.size() == currentUserNames.size() && currentUserNames.containsAll(allUserNames); } // returns true if filtered by "me" private static boolean isFilteredByCurrentUser(@NotNull VcsLogFilterCollection filters) { VcsLogUserFilter userFilter = filters.getUserFilter(); if (userFilter == null) return false; Collection<String> filterByName = ((VcsLogUserFilterImpl)userFilter).getUserNamesForPresentation(); if (Collections.singleton(VcsLogUserFilterImpl.ME).containsAll(filterByName)) return true; return false; } public static class Factory implements VcsLogHighlighterFactory { @NotNull private static final String ID = "MY_COMMITS"; @NotNull @Override public VcsLogHighlighter createHighlighter(@NotNull VcsLogDataManager logDataManager, @NotNull VcsLogUi logUi) { return new MyCommitsHighlighter(logDataManager, logUi); } @NotNull @Override public String getId() { return ID; } @NotNull @Override public String getTitle() { return "My Commits"; } @Override public boolean showMenuItem() { return true; } } }
{ "content_hash": "ce7b2d6669c0020efb7fcb51a77a2cfc", "timestamp": "", "source": "github", "line_count": 93, "max_line_length": 134, "avg_line_length": 35.505376344086024, "alnum_prop": 0.7495457298606905, "repo_name": "lucafavatella/intellij-community", "id": "e2ba5cfed5c2e5c7227e512592c7792ed7abb522", "size": "3902", "binary": false, "copies": "1", "ref": "refs/heads/cli-wip", "path": "platform/vcs-log/impl/src/com/intellij/vcs/log/ui/MyCommitsHighlighter.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "AMPL", "bytes": "20665" }, { "name": "AspectJ", "bytes": "182" }, { "name": "Batchfile", "bytes": "63896" }, { "name": "C", "bytes": "214817" }, { "name": "C#", "bytes": "1538" }, { "name": "C++", "bytes": "191650" }, { "name": "CSS", "bytes": "195482" }, { "name": "CoffeeScript", "bytes": "1759" }, { "name": "Cucumber", "bytes": "14382" }, { "name": "Erlang", "bytes": "10" }, { "name": "Groff", "bytes": "35232" }, { "name": "Groovy", "bytes": "2470587" }, { "name": "HLSL", "bytes": "57" }, { "name": "HTML", "bytes": "1804175" }, { "name": "J", "bytes": "5050" }, { "name": "Java", "bytes": "155219443" }, { "name": "JavaScript", "bytes": "562259" }, { "name": "Jupyter Notebook", "bytes": "92629" }, { "name": "Kotlin", "bytes": "1454397" }, { "name": "Lex", "bytes": "179878" }, { "name": "Makefile", "bytes": "2352" }, { "name": "NSIS", "bytes": "53411" }, { "name": "Objective-C", "bytes": "27183" }, { "name": "Perl", "bytes": "903" }, { "name": "Perl6", "bytes": "26" }, { "name": "Protocol Buffer", "bytes": "6570" }, { "name": "Python", "bytes": "23630760" }, { "name": "Ruby", "bytes": "1213" }, { "name": "Scala", "bytes": "11698" }, { "name": "Shell", "bytes": "70829" }, { "name": "Smalltalk", "bytes": "64" }, { "name": "TeX", "bytes": "25473" }, { "name": "TypeScript", "bytes": "9469" }, { "name": "XSLT", "bytes": "113040" } ] }
<?xml version="1.0" encoding="utf-8"?> <!-- Copyright (C) 2014 The Android Open Source Project Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. --> <android.support.v7.internal.widget.TintImageView xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/action_mode_close_button" android:contentDescription="@string/abc_action_mode_done" android:focusable="true" android:clickable="true" android:src="?attr/actionModeCloseDrawable" style="?attr/actionModeCloseButtonStyle" android:layout_width="wrap_content" android:layout_height="match_parent" /><!-- From: file:/usr/local/google/buildbot/repo_clients/https___googleplex-android.googlesource.com_a_platform_manifest.git/mnc-sdk-release/frameworks/support/v7/appcompat/res/layout/abc_action_mode_close_item_material.xml --><!-- From: file:/home/zsl/workspace/React_Native/ReactCalculator/android/app/build/intermediates/exploded-aar/com.android.support/appcompat-v7/23.0.1/res/layout/abc_action_mode_close_item_material.xml -->
{ "content_hash": "b44ae8cea847d24a345684f131676aa4", "timestamp": "", "source": "github", "line_count": 26, "max_line_length": 482, "avg_line_length": 63, "alnum_prop": 0.7112332112332113, "repo_name": "horizon-z40/RN-homework", "id": "ad814d5b198e5c5dd8d5d6836a72cdcfc6bc4d1f", "size": "1638", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "android/app/build/intermediates/res/merged/debug/layout/abc_action_mode_close_item_material.xml", "mode": "33188", "license": "mit", "language": [ { "name": "Java", "bytes": "594572" }, { "name": "JavaScript", "bytes": "5266" }, { "name": "Objective-C", "bytes": "4419" }, { "name": "Python", "bytes": "1655" } ] }
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <title>mathcomp-algebra: Not compatible 👼</title> <link rel="shortcut icon" type="image/png" href="../../../../../favicon.png" /> <link href="../../../../../bootstrap.min.css" rel="stylesheet"> <link href="../../../../../bootstrap-custom.css" rel="stylesheet"> <link href="//maxcdn.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.min.css" rel="stylesheet"> <script src="../../../../../moment.min.js"></script> <!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries --> <!-- WARNING: Respond.js doesn't work if you view the page via file:// --> <!--[if lt IE 9]> <script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script> <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script> <![endif]--> </head> <body> <div class="container"> <div class="navbar navbar-default" role="navigation"> <div class="container-fluid"> <div class="navbar-header"> <a class="navbar-brand" href="../../../../.."><i class="fa fa-lg fa-flag-checkered"></i> Coq bench</a> </div> <div id="navbar" class="collapse navbar-collapse"> <ul class="nav navbar-nav"> <li><a href="../..">clean / released</a></li> <li class="active"><a href="">8.12.2 / mathcomp-algebra - 1.9.0</a></li> </ul> </div> </div> </div> <div class="article"> <div class="row"> <div class="col-md-12"> <a href="../..">« Up</a> <h1> mathcomp-algebra <small> 1.9.0 <span class="label label-info">Not compatible 👼</span> </small> </h1> <p>📅 <em><script>document.write(moment("2022-10-18 00:27:54 +0000", "YYYY-MM-DD HH:mm:ss Z").fromNow());</script> (2022-10-18 00:27:54 UTC)</em><p> <h2>Context</h2> <pre># Packages matching: installed # Name # Installed # Synopsis base-bigarray base base-threads base base-unix base conf-findutils 1 Virtual package relying on findutils coq 8.12.2 Formal proof management system num 1.4 The legacy Num library for arbitrary-precision integer and rational arithmetic ocaml 4.11.2 The OCaml compiler (virtual package) ocaml-base-compiler 4.11.2 Official release 4.11.2 ocaml-config 1 OCaml Switch Configuration ocamlfind 1.9.5 A library manager for OCaml # opam file: opam-version: &quot;2.0&quot; name: &quot;coq-mathcomp-algebra&quot; version: &quot;1.9.0&quot; maintainer: &quot;Mathematical Components &lt;mathcomp-dev@sympa.inria.fr&gt;&quot; homepage: &quot;https://math-comp.github.io/&quot; bug-reports: &quot;https://github.com/math-comp/math-comp/issues&quot; dev-repo: &quot;git+https://github.com/math-comp/math-comp.git&quot; license: &quot;CeCILL-B&quot; build: [ make &quot;-C&quot; &quot;mathcomp/algebra&quot; &quot;-j&quot; &quot;%{jobs}%&quot; ] install: [ make &quot;-C&quot; &quot;mathcomp/algebra&quot; &quot;install&quot; ] depends: [ &quot;coq-mathcomp-fingroup&quot; { = &quot;1.9.0&quot; } ] tags: [ &quot;keyword:algebra&quot; &quot;keyword:small scale reflection&quot; &quot;keyword:mathematical components&quot; &quot;keyword:odd order theorem&quot; &quot;logpath:mathcomp.algebra&quot; ] authors: [ &quot;Jeremy Avigad &lt;&gt;&quot; &quot;Andrea Asperti &lt;&gt;&quot; &quot;Stephane Le Roux &lt;&gt;&quot; &quot;Yves Bertot &lt;&gt;&quot; &quot;Laurence Rideau &lt;&gt;&quot; &quot;Enrico Tassi &lt;&gt;&quot; &quot;Ioana Pasca &lt;&gt;&quot; &quot;Georges Gonthier &lt;&gt;&quot; &quot;Sidi Ould Biha &lt;&gt;&quot; &quot;Cyril Cohen &lt;&gt;&quot; &quot;Francois Garillot &lt;&gt;&quot; &quot;Alexey Solovyev &lt;&gt;&quot; &quot;Russell O&#39;Connor &lt;&gt;&quot; &quot;Laurent Théry &lt;&gt;&quot; &quot;Assia Mahboubi &lt;&gt;&quot; ] synopsis: &quot;Mathematical Components Library on Algebra&quot; description: &quot;&quot;&quot; This library contains definitions and theorems about discrete (i.e. with decidable equality) algebraic structures : ring, fields, ordered fields, real fields, modules, algebras, integers, rational numbers, polynomials, matrices, vector spaces... &quot;&quot;&quot; url { src: &quot;http://github.com/math-comp/math-comp/archive/mathcomp-1.9.0.tar.gz&quot; checksum: &quot;sha256=fe3d157a4db7e96f39212f76e701a7fc1e3f125c54b8c38f06a6a387eda61c96&quot; } </pre> <h2>Lint</h2> <dl class="dl-horizontal"> <dt>Command</dt> <dd><code>true</code></dd> <dt>Return code</dt> <dd>0</dd> </dl> <h2>Dry install 🏜️</h2> <p>Dry install with the current Coq version:</p> <dl class="dl-horizontal"> <dt>Command</dt> <dd><code>opam install -y --show-action coq-mathcomp-algebra.1.9.0 coq.8.12.2</code></dd> <dt>Return code</dt> <dd>5120</dd> <dt>Output</dt> <dd><pre>[NOTE] Package coq is already installed (current version is 8.12.2). The following dependencies couldn&#39;t be met: - coq-mathcomp-algebra -&gt; coq-mathcomp-fingroup = 1.9.0 -&gt; coq-mathcomp-ssreflect = 1.9.0 -&gt; coq &lt; 8.12~ -&gt; ocaml &lt; 4.10 base of this switch (use `--unlock-base&#39; to force) Your request can&#39;t be satisfied: - No available version of coq satisfies the constraints No solution found, exiting </pre></dd> </dl> <p>Dry install without Coq/switch base, to test if the problem was incompatibility with the current Coq/OCaml version:</p> <dl class="dl-horizontal"> <dt>Command</dt> <dd><code>opam remove -y coq; opam install -y --show-action --unlock-base coq-mathcomp-algebra.1.9.0</code></dd> <dt>Return code</dt> <dd>0</dd> </dl> <h2>Install dependencies</h2> <dl class="dl-horizontal"> <dt>Command</dt> <dd><code>true</code></dd> <dt>Return code</dt> <dd>0</dd> <dt>Duration</dt> <dd>0 s</dd> </dl> <h2>Install 🚀</h2> <dl class="dl-horizontal"> <dt>Command</dt> <dd><code>true</code></dd> <dt>Return code</dt> <dd>0</dd> <dt>Duration</dt> <dd>0 s</dd> </dl> <h2>Installation size</h2> <p>No files were installed.</p> <h2>Uninstall 🧹</h2> <dl class="dl-horizontal"> <dt>Command</dt> <dd><code>true</code></dd> <dt>Return code</dt> <dd>0</dd> <dt>Missing removes</dt> <dd> none </dd> <dt>Wrong removes</dt> <dd> none </dd> </dl> </div> </div> </div> <hr/> <div class="footer"> <p class="text-center"> Sources are on <a href="https://github.com/coq-bench">GitHub</a> © Guillaume Claret 🐣 </p> </div> </div> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script> <script src="../../../../../bootstrap.min.js"></script> </body> </html>
{ "content_hash": "7388f0f4a74c03886a79b92992d4189b", "timestamp": "", "source": "github", "line_count": 164, "max_line_length": 554, "avg_line_length": 46.951219512195124, "alnum_prop": 0.565064935064935, "repo_name": "coq-bench/coq-bench.github.io", "id": "e3cb5545320d86d107d1019c61885639abdea3e0", "size": "7726", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "clean/Linux-x86_64-4.11.2-2.0.7/released/8.12.2/mathcomp-algebra/1.9.0.html", "mode": "33188", "license": "mit", "language": [] }
<?php namespace common\models\query; /** * This is the ActiveQuery class for [[\common\models\Equipos]]. * * @see \common\models\Equipos */ class EquiposQuery extends \yii\db\ActiveQuery { /*public function active() { $this->andWhere('[[status]]=1'); return $this; }*/ /** * @inheritdoc * @return \common\models\Equipos[]|array */ public function all($db = null) { return parent::all($db); } /** * @inheritdoc * @return \common\models\Equipos|array|null */ public function one($db = null) { return parent::one($db); } }
{ "content_hash": "8f4cd11475bfd40bfb1d8dc126620e4f", "timestamp": "", "source": "github", "line_count": 35, "max_line_length": 64, "avg_line_length": 18.085714285714285, "alnum_prop": 0.5545023696682464, "repo_name": "magdielikari/HidroLab-Manager", "id": "b4c4ffadf77709efaace9fdd0cba90ac54287091", "size": "633", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "common/models/query/EquiposQuery.php", "mode": "33188", "license": "bsd-3-clause", "language": [ { "name": "ApacheConf", "bytes": "436" }, { "name": "Batchfile", "bytes": "1541" }, { "name": "CSS", "bytes": "205065" }, { "name": "JavaScript", "bytes": "12995" }, { "name": "PHP", "bytes": "827785" } ] }
# grunt-contrib-uglify v5.2.1 [![Build Status](https://github.com/gruntjs/grunt-contrib-uglify/workflows/Tests/badge.svg)](https://github.com/gruntjs/grunt-contrib-uglify/actions?workflow=Tests) > Minify JavaScript files with UglifyJS ## Getting Started If you haven't used [Grunt](https://gruntjs.com/) before, be sure to check out the [Getting Started](https://gruntjs.com/getting-started) guide, as it explains how to create a [Gruntfile](https://gruntjs.com/sample-gruntfile) as well as install and use Grunt plugins. Once you're familiar with that process, you may install this plugin with this command: ```shell npm install grunt-contrib-uglify --save-dev ``` Once the plugin has been installed, it may be enabled inside your Gruntfile with this line of JavaScript: ```js grunt.loadNpmTasks('grunt-contrib-uglify'); ``` ## Uglify task _Run this task with the `grunt uglify` command._ Task targets, files and options may be specified according to the grunt [Configuring tasks](https://gruntjs.com/configuring-tasks) guide. ### Options This task primarily delegates to [UglifyJS](https://github.com/mishoo/UglifyJS2), so please consider their documentation as required reading for advanced configuration. ###### Deprecated options from `2.x` Option | Replacement ----------------------- | ----------- ASCIIOnly | output.ascii_only enclose | &mdash; exportAll | &mdash; expression | parse.expression indentLevel | output.indent_level mangleProperties | mangle.properties maxLineLen | output.max\_line_len preserveComments | output.comments quoteStyle | output.quote_style screwIE8 | !ie8 sourceMapIncludeSources | sourceMap.includeSources sourceMapRoot | sourceMap.root sourceMapUrl | sourceMap.url #### mangle Type: `Boolean` `Object` Default: `{}` Turn on or off mangling with default options. If an `Object` is specified, it is passed directly to `ast.mangle_names()` *and* `ast.compute_char_frequency()` (mimicking command line behavior). [View all options here](https://github.com/mishoo/UglifyJS2#mangle-options). #### compress Type: `Boolean` `Object` Default: `{}` Turn on or off source compression with default options. If an `Object` is specified, it is passed as options to `UglifyJS.Compressor()`. [View all options here](https://github.com/mishoo/UglifyJS2#compress-options). #### beautify Type: `Boolean` `Object` Default: `false` Turns on beautification of the generated source code. [View all options here](https://github.com/mishoo/UglifyJS2#output-options) ###### parse.expression Type: `Boolean` Default: `false` Parse a single expression, rather than a program (for parsing JSON) #### report Type: `string` Choices: `'min'`, `'gzip'` Default: `'min'` Report minification result or both minification and gzip results. This is useful to see exactly how well uglify-js is performing but using `'gzip'` will make the task take 5-10x longer to complete. [Example output](https://github.com/sindresorhus/maxmin#readme). #### sourceMap Type: `Boolean` Default: `false` If `true`, a source map file will be generated in the same directory as the `dest` file. By default it will have the same basename as the `dest` file, but with a `.map` extension. #### sourceMapName Type: `String` `Function` Default: `undefined` To customize the name or location of the generated source map, pass a string to indicate where to write the source map to. If a function is provided, the uglify destination is passed as the argument and the return value will be used as the file name. #### sourceMapIn Type: `String` `Function` Default: `undefined` The location of an input source map from an earlier compilation, e.g. from CoffeeScript. If a function is provided, the uglify source is passed as the argument and the return value will be used as the sourceMap name. This only makes sense when there's one source file. #### sourceMap.includeSources Type: `Boolean` Default: `false` Pass this flag if you want to include the content of source files in the source map as sourcesContent property. ###### sourceMap.root Type: `String` Default: `undefined` With this option you can customize root URL that browser will use when looking for sources. If the sources are not absolute URLs after prepending of the `sourceMap.root`, the sources are resolved relative to the source map. #### sourceMap.url Type: `String` Default: `undefined` Override the calculated value for `sourceMappingURL` in the source map. This is useful if the source map location is not relative to the base path of the minified file, i.e. when using a CDN #### wrap Type: `String` Default: `undefined` Wrap all of the code in a closure, an easy way to make sure nothing is leaking. For variables that need to be public `exports` and `global` variables are made available. The value of wrap is the global variable exports will be available as. #### output.ascii_only Type: `Boolean` Default: `false` Enables to encode non-ASCII characters as \uXXXX. #### output.comments Type: `Boolean` `String` `Function` Default: `undefined` Options: `false` `'all'` `'some'` Turn on preservation of comments. - `false` will strip all comments - `'all'` will preserve all comments in code blocks that have not been squashed or dropped - `'some'` will preserve all comments that include a closure compiler style directive (`@preserve` `@license` `@cc_on`) - `Function` specify your own comment preservation function. You will be passed the current node and the current comment and are expected to return either `true` or `false` - `RegExp` `'/[RegExp]/'` will preserve comments matching given RegExp or stringified RegExp #### banner Type: `String` Default: `''` This string will be prepended to the minified output. Template strings (e.g. `<%= config.value %>`) will be expanded automatically. #### footer Type: `String` Default: `''` This string will be appended to the minified output. Template strings (e.g. `<%= config.value %>`) will be expanded automatically. #### ie8 Type: `Boolean` Default: `false` Set this to `true` if you still care about full compliance with Internet Explorer 6-8 quirks. #### mangle.properties Type: `Boolean` `Object` Default: `false` Turn on or off property mangling with default options. If an `Object` is specified, it is passed directly to `ast.mangle_properties()` (mimicking command line behavior). [View all options here](https://github.com/mishoo/UglifyJS2#mangle-options). #### reserveDOMProperties Type: `Boolean` Default: `false` Use this flag in conjunction with `mangle.properties` to prevent built-in browser object properties from being mangled. #### exceptionsFiles Type: `Array` Default: `[]` Use this with `mangle.properties` to pass one or more JSON files containing a list of variables and object properties that should not be mangled. See the [UglifyJS docs](https://www.npmjs.com/package/uglify-js) for more info on the file syntax. #### nameCache Type: `String` Default: `''` A string that is a path to a JSON cache file that uglify will create and use to coordinate symbol mangling between multiple runs of uglify. Note: this generated file uses the same JSON format as the `exceptionsFiles` files. #### output.quote_style Type: `Integer` Default: `0` Preserve or enforce quotation mark style. * `0` will use single or double quotes such as to minimize the number of bytes (prefers double quotes when both will do) * `1` will always use single quotes * `2` will always use double quotes * `3` will preserve original quotation marks ### Usage examples #### Basic compression This configuration will compress and mangle the input files using the default options. ```js // Project configuration. grunt.initConfig({ uglify: { my_target: { files: { 'dest/output.min.js': ['src/input1.js', 'src/input2.js'] } } } }); ``` #### No mangling Specify `mangle: false` to prevent changes to your variable and function names. ```js // Project configuration. grunt.initConfig({ uglify: { options: { mangle: false }, my_target: { files: { 'dest/output.min.js': ['src/input.js'] } } } }); ``` #### Reserved identifiers You can specify identifiers to leave untouched with an `reserved` array in the `mangle` options. ```js // Project configuration. grunt.initConfig({ uglify: { options: { mangle: { reserved: ['jQuery', 'Backbone'] } }, my_target: { files: { 'dest/output.min.js': ['src/input.js'] } } } }); ``` #### Source maps Generate a source map by setting the `sourceMap` option to `true`. The generated source map will be in the same directory as the destination file. Its name will be the basename of the destination file with a `.map` extension. Override these defaults with the `sourceMapName` attribute. ```js // Project configuration. grunt.initConfig({ uglify: { my_target: { options: { sourceMap: true, sourceMapName: 'path/to/sourcemap.map' }, files: { 'dest/output.min.js': ['src/input.js'] } } } }); ``` #### Advanced source maps Set the `sourceMap.includeSources` option to `true` to embed your sources directly into the map. To include a source map from a previous compilation pass it as the value of the `sourceMapIn` option. ```js // Project configuration. grunt.initConfig({ uglify: { my_target: { options: { sourceMap: { includeSources: true }, sourceMapIn: 'example/coffeescript-sourcemap.js', // input sourcemap from a previous compilation }, files: { 'dest/output.min.js': ['src/input.js'], }, }, }, }); ``` Refer to the [UglifyJS SourceMap Documentation](https://github.com/mishoo/UglifyJS2#source-map-options) for more information. #### Turn off console warnings Specify `drop_console: true` as part of the `compress` options to discard calls to `console.*` functions. This will suppress warning messages in the console. ```js // Project configuration. grunt.initConfig({ uglify: { options: { compress: { drop_console: true } }, my_target: { files: { 'dest/output.min.js': ['src/input.js'] } } } }); ``` #### Beautify Specify `beautify: true` to beautify your code for debugging/troubleshooting purposes. Pass an object to manually configure any other output options. See [UglifyJS documentation](https://github.com/mishoo/UglifyJS2#output-options) for more information. ```js // Project configuration. grunt.initConfig({ uglify: { my_target: { options: { beautify: true }, files: { 'dest/output.min.js': ['src/input.js'] } }, my_advanced_target: { options: { beautify: { width: 80 } }, files: { 'dest/output.min.js': ['src/input.js'] } } } }); ``` #### Banner comments In this example, running `grunt uglify:my_target` will prepend a banner created by interpolating the `banner` template string with the config object. Here, those properties are the values imported from the `package.json` file (which are available via the `pkg` config property) plus today's date. _Note: you don't have to use an external JSON file. It's also valid to create the `pkg` object inline in the config. That being said, if you already have a JSON file, you might as well reference it._ ```js // Project configuration. grunt.initConfig({ pkg: grunt.file.readJSON('package.json'), uglify: { options: { banner: '/*! <%= pkg.name %> - v<%= pkg.version %> - ' + '<%= grunt.template.today("yyyy-mm-dd") %> */' }, my_target: { files: { 'dest/output.min.js': ['src/input.js'] } } } }); ``` #### Conditional compilation You can also enable UglifyJS conditional compilation. This is commonly used to remove debug code blocks for production builds. This is equivalent to the command line `--define` option. See [UglifyJS global definitions documentation](https://github.com/mishoo/UglifyJS2#conditional-compilation) for more information. ```js // Project configuration. grunt.initConfig({ uglify: { options: { compress: { global_defs: { 'DEBUG': false }, dead_code: true } }, my_target: { files: { 'dest/output.min.js': ['src/input.js'] } } } }); ``` #### Compiling all files in a folder dynamically This configuration will compress and mangle the files dynamically. ```js // Project configuration. grunt.initConfig({ uglify: { my_target: { files: [{ expand: true, cwd: 'src/js', src: '**/*.js', dest: 'dest/js' }] } } }); ``` #### Compiling all files separately in the each their path This configuration will compress and mangle all js files separately in each folder. Also exclude jQuery for mangling and ignore all `*.min.js` files. ```js // Project configuration. uglify: { dev: { options: { mangle: { reserved: ['jQuery'] } }, files: [{ expand: true, src: ['dist/assets/js/*.js', '!dist/assets/js/*.min.js'], dest: 'dist/assets', cwd: '.', rename: function (dst, src) { // To keep the source js files and make new files as `*.min.js`: // return dst + '/' + src.replace('.js', '.min.js'); // Or to override to src: return src; } }] } }, ``` #### Turn on object property name mangling This configuration will turn on object property name mangling, but not mangle built-in browser object properties. Additionally, variables and object properties listed in the `myExceptionsFile.json` will be mangled. For more info, on the format of the exception file format please see the [UglifyJS docs](https://www.npmjs.com/package/uglify-js). ```js // Project configuration. grunt.initConfig({ uglify: { options: { mangle: { properties: true }, reserveDOMProperties: true, exceptionsFiles: [ 'myExceptionsFile.json' ] }, my_target: { files: { 'dest/output.min.js': ['src/input.js'] } } } }); ``` #### Turn on use of name mangling cache Turn on use of name mangling cache to coordinate mangled symbols between outputted uglify files. uglify will the generate a JSON cache file with the name provided in the options. Note: this generated file uses the same JSON format as the `exceptionsFiles` files. ```js // Project configuration. grunt.initConfig({ uglify: { options: { nameCache: '.tmp/grunt-uglify-cache.json', }, my_target: { files: { 'dest/output1.min.js': ['src/input1.js'], 'dest/output2.min.js': ['src/input2.js'] } } } }); ``` ## Release History * 2022-03-27   v5.1.0   Update dependencies. uglify-js ^3.15.2. Requires node 12+. * 2020-07-16   v5.0.0   Requires node 10+. Update dependencies. * 2019-03-21   v4.0.1   Update uglify-js to v3.5.0. Update dependencies. * 2018-08-26   v4.0.0   Update dependencies. Requires Node.js >= 6. * 2018-07-29   v3.4.0   Update uglify-js to v3.4.0. * 2017-12-24   v3.3.0   Update uglify-js to v3.3.0. * 2017-11-26   v3.2.1   Update uglify-js to v3.2.0. * 2017-09-11   v3.1.0   Update uglify-js to v3.1.0. * 2017-05-20   v3.0.1   Fix toplevel option. * 2017-05-12   v3.0.0   Update uglify-js to v3.0.4. * 2017-04-05   v2.3.0   Make CLI output less verbose. * 2017-03-31   v2.2.1   Fix banner option. * 2017-03-01   v2.2.0   Update uglify-js to v2.8.3. * 2017-02-08   v2.1.0   Show size changes in output. Switch to `object.assign`. * 2016-07-19   v2.0.0   Update uglify-js to v2.7.0. `screwIE8` is enabled by default. * 2016-07-19   v1.0.2   Update grunt to ^1.0.0. Fix `beautify` when passed as an object. Fix docs about `report` values. * 2016-03-16   v1.0.1   Downgrade maxmin for Node.js 0.10. * 2016-03-04   v1.0.0   Use uglify-js ~2.6.2 to fix sourcemap issue. Improve docs for `global-defs` and `--define` options. Add `sourceMapUrl` option. Add `bare_returns` option. Optionally set report verbosity level using report option. * 2016-01-29   v0.11.1   Update lodash to ^4.0.1. Update grunt-contrib-clean to ^0.7.0. Update grunt-contrib-jshint to ^0.12.0. * 2015-11-20   v0.11.0   Update uglify-js to ~2.6.0. * 2015-11-12   v0.10.1   Update uglify-js to ~2.5. * 2015-10-27   v0.10.0   Update uglify-js to ^2.5. * 2015-08-24   v0.9.2   Update uglify-js to ^2.4.24 * 2015-04-07   v0.9.1   More fixes for `mangle` options. * 2015-04-07   v0.9.0   Add hook into uglify-js's mangling functionality. * 2015-03-30   v0.8.1   Lock uglify-js to 2.4.17 due to breaking changes. * 2015-02-19   v0.8.0   Add `screwIE8` option. Fix issue with explicit `compress` in Node.js 0.12.0. * 2014-12-23   v0.7.0   Add `sourceMapRoot` options. Update readme descriptions. Remove reference to clean-css. * 2014-09-17   v0.6.0   Output fixes. Add `ASCIIOnly` option. Other fixes. * 2014-07-25   v0.5.1   Update chalk to ^0.5.1. Output updates. * 2014-03-01   v0.4.0   Remove grunt-lib-contrib dependency and add more colors. * 2014-02-27   v0.3.3   Remove unnecessary calls to `grunt.template.process`. * 2014-01-22   v0.3.2   Fix handling of `sourceMapIncludeSources` option. * 2014-01-20   v0.3.1   Fix relative path issue in sourcemaps. * 2014-01-16   v0.3.0   Refactor sourcemap support. * 2013-11-09   v0.2.7   Prepend banner if `sourceMap` option not set, addresses #109. * 2013-11-08   v0.2.6   Merge #45, #53, #85 (#105 by way of duping #53). Add support for banners in uglified files with sourcemaps. Update docs. * 2013-10-28   v0.2.5   Add warning for banners when using sourcemaps. * 2013-09-02   v0.2.4   Update sourcemap format via #83. * 2013-06-10   v0.2.3   Add `footer` option. * 2013-05-31   v0.2.2   Revert #56 due to #58 until [chrome/239660](https://code.google.com/p/chromium/issues/detail?id=239660&q=sourcemappingurl&colspec=ID%20Pri%20M%20Iteration%20ReleaseBlock%20Cr%20Status%20Owner%20Summary%20OS%20Modified) [firefox/870361](https://bugzilla.mozilla.org/show_bug.cgi?id=870361) drop. * 2013-05-22   v0.2.1   Update uglify-js to ~2.3.5 #55 #40. Change `sourcemappingUrl` syntax #56. Disable sorting of names for consistent mangling #44. Update docs for `sourceMapRoot` #47 #25. * 2013-03-14   v0.2.0   No longer report gzip results by default. Support `report` option. * 2013-01-30   v0.1.2   Add better error reporting. Support for dynamic names of multiple sourcemaps. * 2013-02-15   v0.1.1   First official release for Grunt 0.4.0. * 2013-01-18   v0.1.1rc6   Update grunt/gruntplugin dependencies to rc6. Change in-development grunt/gruntplugin dependency versions from tilde version ranges to specific versions. * 2013-01-09   v0.1.1rc5   Update to work with grunt v0.4.0rc5. Switch back to `this.files` API. * 2012-11-28   v0.1.0   Work in progress, not officially released yet. --- Task submitted by ["Cowboy" Ben Alman](http://benalman.com) *This file was generated on Fri Apr 15 2022 21:00:08.*
{ "content_hash": "1819f9a96d813ac2100db94a52f835e8", "timestamp": "", "source": "github", "line_count": 581, "max_line_length": 354, "avg_line_length": 33.21170395869191, "alnum_prop": 0.6779125207296849, "repo_name": "gruntjs/grunt-contrib-uglify", "id": "2e1a6ed7de09864517eb7b429df9c9bfca398d06", "size": "19872", "binary": false, "copies": "2", "ref": "refs/heads/main", "path": "README.md", "mode": "33188", "license": "mit", "language": [ { "name": "JavaScript", "bytes": "24718" } ] }
Castle.Windsor ASP.NET MVC bootstrapping package ------------------------------------------------ This package simplifies bootstrapping of `Castle.Windsor` container in your ASP.NET MVC 4 application. To install this package, use following NuGet command: PM> Install-Package Castle.Windsor.Web.Mvc Package contains `WindsorControllerFactory`, `ControllersInstaller` and `WindsorActivator` classes for your MVC application. All controllers are now resolved with controller factory. To register your custom components just [create another Installer class](http://docs.castleproject.org/Windsor.Installers.ashx) implementing `IWindsorInstaller` interface. Fo more informations [how to use Windsor](http://docs.castleproject.org/Windsor.MainPage.ashx) see the [documentation](http://docs.castleproject.org/Windsor.MainPage.ashx). [![endorse](https://api.coderwall.com/rarous/endorsecount.png)](https://coderwall.com/rarous)
{ "content_hash": "fc3933c655ab9f46d55a7456ab687e87", "timestamp": "", "source": "github", "line_count": 18, "max_line_length": 124, "avg_line_length": 52.77777777777778, "alnum_prop": 0.751578947368421, "repo_name": "rarous/Castle.Windsor.Web.Mvc", "id": "cd8c9028c51cbfe148bb5e2e185decb5976f57a3", "size": "950", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "Readme.md", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "C#", "bytes": "1469" }, { "name": "Puppet", "bytes": "3162" } ] }
.. _gmir: Generic Machine IR ================== .. contents:: :local: Generic MIR (gMIR) is an intermediate representation that shares the same data structures as :doc:`MachineIR (MIR) <../MIRLangRef>` but has more relaxed constraints. As the compilation pipeline proceeds, these constraints are gradually tightened until gMIR has become MIR. The rest of this document will assume that you are familiar with the concepts in :doc:`MachineIR (MIR) <../MIRLangRef>` and will highlight the differences between MIR and gMIR. .. _gmir-instructions: Generic Machine Instructions ---------------------------- .. note:: This section expands on :ref:`mir-instructions` from the MIR Language Reference. Whereas MIR deals largely in Target Instructions and only has a small set of target independent opcodes such as ``COPY``, ``PHI``, and ``REG_SEQUENCE``, gMIR defines a rich collection of ``Generic Opcodes`` which are target independent and describe operations which are typically supported by targets. One example is ``G_ADD`` which is the generic opcode for an integer addition. More information on each of the generic opcodes can be found at :doc:`GenericOpcode`. The ``MachineIRBuilder`` class wraps the ``MachineInstrBuilder`` and provides a convenient way to create these generic instructions. .. _gmir-gvregs: Generic Virtual Registers ------------------------- .. note:: This section expands on :ref:`mir-registers` from the MIR Language Reference. Generic virtual registers are like virtual registers but they are not assigned a Register Class constraint. Instead, generic virtual registers have less strict constraints starting with a :ref:`gmir-llt` and then further constrained to a :ref:`gmir-regbank`. Eventually they will be constrained to a register class at which point they become normal virtual registers. Generic virtual registers can be used with all the virtual register API's provided by ``MachineRegisterInfo``. In particular, the def-use chain API's can be used without needing to distinguish them from non-generic virtual registers. For simplicity, most generic instructions only accept virtual registers (both generic and non-generic). There are some exceptions to this but in general: * instead of immediates, they use a generic virtual register defined by an instruction that materializes the immediate value (see :ref:`irtranslator-constants`). Typically this is a G_CONSTANT or a G_FCONSTANT. One example of an exception to this rule is G_SEXT_INREG where having an immediate is mandatory. * instead of physical register, they use a generic virtual register that is either defined by a ``COPY`` from the physical register or used by a ``COPY`` that defines the physical register. .. admonition:: Historical Note We started with an alternative representation, where MRI tracks a size for each generic virtual register, and instructions have lists of types. That had two flaws: the type and size are redundant, and there was no generic way of getting a given operand's type (as there was no 1:1 mapping between instruction types and operands). We considered putting the type in some variant of MCInstrDesc instead: See `PR26576 <https://llvm.org/PR26576>`_: [GlobalISel] Generic MachineInstrs need a type but this increases the memory footprint of the related objects .. _gmir-regbank: Register Bank ------------- A Register Bank is a set of register classes defined by the target. This definition is rather loose so let's talk about what they can achieve. Suppose we have a processor that has two register files, A and B. These are equal in every way and support the same instructions for the same cost. They're just physically stored apart and each instruction can only access registers from A or B but never a mix of the two. If we want to perform an operation on data that's in split between the two register files, we must first copy all the data into a single register file. Given a processor like this, we would benefit from clustering related data together into one register file so that we minimize the cost of copying data back and forth to satisfy the (possibly conflicting) requirements of all the instructions. Register Banks are a means to constrain the register allocator to use a particular register file for a virtual register. In practice, register files A and B are rarely equal. They can typically store the same data but there's usually some restrictions on what operations you can do on each register file. A fairly common pattern is for one of them to be accessible to integer operations and the other accessible to floating point operations. To accomodate this, let's rename A and B to GPR (general purpose registers) and FPR (floating point registers). We now have some additional constraints that limit us. An operation like G_FMUL has to happen in FPR and G_ADD has to happen in GPR. However, even though this prescribes a lot of the assignments we still have some freedom. A G_LOAD can happen in both GPR and FPR, and which we want depends on who is going to consume the loaded data. Similarly, G_FNEG can happen in both GPR and FPR. If we assign it to FPR, then we'll use floating point negation. However, if we assign it to GPR then we can equivalently G_XOR the sign bit with 1 to invert it. In summary, Register Banks are a means of disambiguating between seemingly equivalent choices based on some analysis of the differences when each choice is applied in a given context. To give some concrete examples: AArch64 AArch64 has three main banks. GPR for integer operations, FPR for floating point and also for the NEON vector instruction set. The third is CCR and describes the condition code register used for predication. MIPS MIPS has five main banks of which many programs only really use one or two. GPR is the general purpose bank for integer operations. FGR or CP1 is for the floating point operations as well as the MSA vector instructions and a few other application specific extensions. CP0 is for system registers and few programs will use it. CP2 and CP3 are for any application specific coprocessors that may be present in the chip. Arguably, there is also a sixth for the LO and HI registers but these are only used for the result of a few operations and it's of questionable value to model distinctly from GPR. X86 X86 can be seen as having 3 main banks: general-purpose, x87, and vector (which could be further split into a bank per domain for single vs double precision instructions). It also looks like there's arguably a few more potential banks such as one for the AVX512 Mask Registers. Register banks are described by a target-provided API, :ref:`RegisterBankInfo <api-registerbankinfo>`. .. _gmir-llt: Low Level Type -------------- Additionally, every generic virtual register has a type, represented by an instance of the ``LLT`` class. Like ``EVT``/``MVT``/``Type``, it has no distinction between unsigned and signed integer types. Furthermore, it also has no distinction between integer and floating-point types: it mainly conveys absolutely necessary information, such as size and number of vector lanes: * ``sN`` for scalars * ``pN`` for pointers * ``<N x sM>`` for vectors ``LLT`` is intended to replace the usage of ``EVT`` in SelectionDAG. Here are some LLT examples and their ``EVT`` and ``Type`` equivalents: ============= ========= ====================================== LLT EVT IR Type ============= ========= ====================================== ``s1`` ``i1`` ``i1`` ``s8`` ``i8`` ``i8`` ``s32`` ``i32`` ``i32`` ``s32`` ``f32`` ``float`` ``s17`` ``i17`` ``i17`` ``s16`` N/A ``{i8, i8}`` [#abi-dependent]_ ``s32`` N/A ``[4 x i8]`` [#abi-dependent]_ ``p0`` ``iPTR`` ``i8*``, ``i32*``, ``%opaque*`` ``p2`` ``iPTR`` ``i8 addrspace(2)*`` ``<4 x s32>`` ``v4f32`` ``<4 x float>`` ``s64`` ``v1f64`` ``<1 x double>`` ``<3 x s32>`` ``v3i32`` ``<3 x i32>`` ============= ========= ====================================== Rationale: instructions already encode a specific interpretation of types (e.g., ``add`` vs. ``fadd``, or ``sdiv`` vs. ``udiv``). Also encoding that information in the type system requires introducing bitcast with no real advantage for the selector. Pointer types are distinguished by address space. This matches IR, as opposed to SelectionDAG where address space is an attribute on operations. This representation better supports pointers having different sizes depending on their addressspace. .. note:: .. caution:: Is this still true? I thought we'd removed the 1-element vector concept. Hypothetically, it could be distinct from a scalar but I think we failed to find a real occurrence. Currently, LLT requires at least 2 elements in vectors, but some targets have the concept of a '1-element vector'. Representing them as their underlying scalar type is a nice simplification. .. rubric:: Footnotes .. [#abi-dependent] This mapping is ABI dependent. Here we've assumed no additional padding is required. Generic Opcode Reference ------------------------ The Generic Opcodes that are available are described at :doc:`GenericOpcode`.
{ "content_hash": "6064f39a466bfa66cd6cbfd5ad14aabf", "timestamp": "", "source": "github", "line_count": 219, "max_line_length": 104, "avg_line_length": 42.78538812785388, "alnum_prop": 0.7211312700106723, "repo_name": "endlessm/chromium-browser", "id": "ca0d6069222416f31853d50f13822b753c3faefd", "size": "9370", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "third_party/llvm/llvm/docs/GlobalISel/GMIR.rst", "mode": "33188", "license": "bsd-3-clause", "language": [] }
import copy import datetime import colander from daybed import schemas from daybed.tests.support import unittest, BaseWebTest OBJECT_FIELD_DEFINITION = { 'name': u'tasks', 'type': u'list', 'hint': u'An object', 'item': {'type': u'int', 'hint': u'An integer'} } class ListFieldTest(unittest.TestCase): def setUp(self): self.schema = schemas.ListField.definition() self.definition = copy.deepcopy(OBJECT_FIELD_DEFINITION) self.validator = schemas.ListField.validation(**self.definition) def test_can_be_defined_with_a_field_type(self): field = self.schema.deserialize(self.definition) for defaultattr in ['required', 'label']: field.pop(defaultattr) field['item'].pop(defaultattr) self.assertDictEqual(self.definition, field) def test_is_not_valid_if_field_type_unknown(self): self.definition['item']['type'] = 'asteroid' self.assertRaises(colander.Invalid, self.schema.deserialize, self.definition) def test_validation_succeeds_if_items_are_valid(self): value = self.validator.deserialize('[1,3,4]') self.assertEquals(value, [1, 3, 4]) def test_validation_succeeds_if_given_as_list(self): value = self.validator.deserialize([1, 3, 4]) self.assertEquals(value, [1, 3, 4]) def test_validation_fails_with_comma_separated_values(self): self.assertRaises(colander.Invalid, self.validator.deserialize, '1,3,4') def test_validation_succeeds_if_no_items(self): value = self.validator.deserialize('[]') self.assertEquals(value, []) def test_validation_fails_if_items_malformed(self): self.assertRaises(colander.Invalid, self.validator.deserialize, '[1,,3]') def test_validation_fails_if_items_are_invalid(self): self.assertRaises(colander.Invalid, self.validator.deserialize, '[1, "a" ,4]') def test_validation_fails_if_items_as_list_are_invalid(self): self.assertRaises(colander.Invalid, self.validator.deserialize, [1, "a", 4]) class NoItemTypeListTest(unittest.TestCase): def setUp(self): self.schema = schemas.ListField.definition() self.definition = OBJECT_FIELD_DEFINITION.copy() self.definition.pop('item') self.validator = schemas.ListField.validation(**self.definition) def test_no_item_type_validation_is_performed(self): value = self.validator.deserialize('[1,"a",{"status": false}]') self.assertEquals(value, [1, u'a', {u'status': False}]) def test_no_item_works_with_comma_separated_values(self): value = self.validator.deserialize('8, 5 , 1982') self.assertEquals(value, [u'8', u'5', u'1982']) class ItemTypeListTest(unittest.TestCase): def setUp(self): self.schema = schemas.ListField.definition() self.definition = copy.deepcopy(OBJECT_FIELD_DEFINITION) self.definition['item']['type'] = 'date' self.validator = schemas.ListField.validation(**self.definition) def test_validation_succeeds_if_items_are_valid(self): value = self.validator.deserialize('["2012-04-01", "2014-06-01"]') expected = [datetime.date(2012, 4, 1), datetime.date(2014, 6, 1)] self.assertEquals(value, expected) def test_validation_fails_if_items_are_invalid(self): self.assertRaises(colander.Invalid, self.validator.deserialize, '["2012-33-01", "2014-06-01"]') class ObjectListTest(BaseWebTest): def setUp(self): super(ObjectListTest, self).setUp() self.schema = schemas.ListField.definition() self.definition = copy.deepcopy(OBJECT_FIELD_DEFINITION) self.definition['item'] = { 'type': 'object', 'fields': [ {'type': u'enum', 'name': u'status', 'choices': [u'todo', u'done']} ] } self.validator = schemas.ListField.validation(**self.definition) def test_is_not_valid_if_parameters_are_invalid(self): self.definition['item']['fields'] = [] self.assertRaises(colander.Invalid, self.schema.deserialize, self.definition) def test_validation_succeeds_if_items_are_valid(self): value = self.validator.deserialize('[{"status": "todo"},' ' {"status": "done"}]') self.assertEquals(value, [{'status': 'todo'}, {'status': 'done'}]) def test_validation_fails_if_items_are_invalid(self): self.assertRaises(colander.Invalid, self.validator.deserialize, '[{"status": "todo"}, {"status": "3.14"}]') def test_validation_sets_default_values(self): self.definition['item']['fields'].append({ 'type': 'date', 'name': 'created', 'autonow': True}) self.validator = schemas.ListField.validation(**self.definition) values = self.validator.deserialize('[{"status": "todo"}]') self.assertIsNotNone(values[0].get('created'))
{ "content_hash": "3ff041fbfc37a600ed17918221283058", "timestamp": "", "source": "github", "line_count": 147, "max_line_length": 74, "avg_line_length": 36.87074829931973, "alnum_prop": 0.5898523985239852, "repo_name": "spiral-project/daybed", "id": "39f8b818e1f684122e63e04e8076a8e36661c3e3", "size": "5420", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "daybed/tests/test_schemas_list.py", "mode": "33188", "license": "bsd-3-clause", "language": [ { "name": "Python", "bytes": "256646" }, { "name": "Shell", "bytes": "865" } ] }
package com.doctusoft.jsf.render; import javax.faces.application.Application; import javax.faces.context.FacesContext; import com.doctusoft.jsf.AbstractRendererFactory; import com.doctusoft.jsf.comp.model.JsfBaseComponentModel; import com.doctusoft.jsf.comp.model.JsfButtonModel; import com.doctusoft.jsf.comp.model.JsfCheckboxModel; import com.doctusoft.jsf.comp.model.JsfCommandLinkModel; import com.doctusoft.jsf.comp.model.JsfCustomContentModel; import com.doctusoft.jsf.comp.model.JsfCustomElementModel; import com.doctusoft.jsf.comp.model.JsfFormModel; import com.doctusoft.jsf.comp.model.JsfInputHiddenModel; import com.doctusoft.jsf.comp.model.JsfInputTextModel; import com.doctusoft.jsf.comp.model.JsfLabelModel; import com.doctusoft.jsf.comp.model.JsfLinkModel; import com.doctusoft.jsf.comp.model.JsfMessageModel; import com.doctusoft.jsf.comp.model.JsfNamingContainerModel; import com.doctusoft.jsf.comp.model.JsfNumberInputModel; import com.doctusoft.jsf.comp.model.JsfOutputTextModel; import com.doctusoft.jsf.comp.model.JsfPanelGroupModel; import com.doctusoft.jsf.comp.model.JsfRepeatModel; import com.doctusoft.jsf.comp.model.JsfSelectOneMenuModel; import com.doctusoft.jsf.comp.model.JsfSelectOneRadioModel; import com.doctusoft.jsf.comp.model.JsfTextareaModel; import com.doctusoft.jsf.custom.CustomContentComponent; import com.doctusoft.jsf.custom.CustomElementComponent; public class JsfRendererFactory extends AbstractRendererFactory { public JsfRendererFactory() { // register custom components Application app = FacesContext.getCurrentInstance().getApplication(); app.addComponent(CustomElementComponent.COMPONENT_TYPE, CustomElementComponent.class.getName()); app.addComponent(CustomContentComponent.COMPONENT_TYPE, CustomContentComponent.class.getName()); } public Renderer resolveRenderer(JsfBaseComponentModel model) { if (model instanceof JsfLabelModel) return new JsfLabelRenderer((JsfLabelModel) model); if (model instanceof JsfPanelGroupModel) return new JsfPanelGroupRenderer((JsfPanelGroupModel) model); if (model instanceof JsfButtonModel) return new JsfButtonRenderer((JsfButtonModel) model); if (model instanceof JsfInputTextModel) return new JsfInputTextRenderer((JsfInputTextModel) model); if (model instanceof JsfCheckboxModel) return new JsfCheckboxRenderer((JsfCheckboxModel) model); if (model instanceof JsfTextareaModel) return new JsfTextareaRenderer((JsfTextareaModel) model); if (model instanceof JsfOutputTextModel) return new JsfOutputTextRenderer((JsfOutputTextModel) model); if (model instanceof JsfFormModel) return new JsfFormRenderer((JsfFormModel) model); if (model instanceof JsfSelectOneMenuModel) return new JsfSelectOneMenuRenderer((JsfSelectOneMenuModel) model); if (model instanceof JsfSelectOneRadioModel) return new JsfSelectOneRadioRenderer((JsfSelectOneRadioModel) model); if (model instanceof JsfCustomElementModel) return new JsfCustomElementRenderer((JsfCustomElementModel) model); if (model instanceof JsfCustomContentModel) return new JsfCustomContentRenderer((JsfCustomContentModel) model); if (model instanceof JsfRepeatModel) return new JsfRepeatRenderer((JsfRepeatModel) model); if (model instanceof JsfInputHiddenModel) return new JsfInputHiddenRenderer((JsfInputHiddenModel) model); if (model instanceof JsfMessageModel) return new JsfMessageRenderer((JsfMessageModel) model); if (model instanceof JsfNumberInputModel) return new JsfNumberInputRenderer((JsfNumberInputModel) model); if (model instanceof JsfLinkModel) return new JsfLinkRenderer((JsfLinkModel) model); if (model instanceof JsfCommandLinkModel) return new JsfCommandLinkRenderer((JsfCommandLinkModel) model); if (model instanceof JsfNamingContainerModel) return new JsfNamingContainerRenderer((JsfNamingContainerModel) model); return null; } }
{ "content_hash": "1ca4244f4eafc91c7f9ab5295e0ea6f6", "timestamp": "", "source": "github", "line_count": 82, "max_line_length": 98, "avg_line_length": 47.63414634146341, "alnum_prop": 0.82642089093702, "repo_name": "Doctusoft/jsf-builder", "id": "8ab91dcb6f42bfea521c6937d6c50f789e781185", "size": "3906", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "jsf-builder/src/main/java/com/doctusoft/jsf/render/JsfRendererFactory.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "HTML", "bytes": "2709" }, { "name": "Java", "bytes": "93188" } ] }
ACCEPTED #### According to International Plant Names Index #### Published in null #### Original name null ### Remarks null
{ "content_hash": "afb7541999d9d5ae6cb3ad1f68ca2147", "timestamp": "", "source": "github", "line_count": 13, "max_line_length": 31, "avg_line_length": 9.692307692307692, "alnum_prop": 0.7063492063492064, "repo_name": "mdoering/backbone", "id": "4bcc1c2fd8fe8cc93f3b3309399a0372b481689d", "size": "173", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "life/Plantae/Magnoliophyta/Magnoliopsida/Boraginales/Boraginaceae/Omphalodes/Omphalodes rugulosa/README.md", "mode": "33188", "license": "apache-2.0", "language": [] }
import '../utils/boot.js'; import { resolveUrl, pathFromUrl } from '../utils/resolve-url.js'; import { strictTemplatePolicy } from '../utils/settings.js'; let modules = {}; let lcModules = {}; /** * Sets a dom-module into the global registry by id. * * @param {string} id dom-module id * @param {DomModule} module dom-module instance * @return {void} */ function setModule(id, module) { // store id separate from lowercased id so that // in all cases mixedCase id will stored distinctly // and lowercase version is a fallback modules[id] = lcModules[id.toLowerCase()] = module; } /** * Retrieves a dom-module from the global registry by id. * * @param {string} id dom-module id * @return {DomModule!} dom-module instance */ function findModule(id) { return modules[id] || lcModules[id.toLowerCase()]; } function styleOutsideTemplateCheck(inst) { if (inst.querySelector('style')) { console.warn('dom-module %s has style outside template', inst.id); } } /** * The `dom-module` element registers the dom it contains to the name given * by the module's id attribute. It provides a unified database of dom * accessible via its static `import` API. * * A key use case of `dom-module` is for providing custom element `<template>`s * via HTML imports that are parsed by the native HTML parser, that can be * relocated during a bundling pass and still looked up by `id`. * * Example: * * <dom-module id="foo"> * <img src="stuff.png"> * </dom-module> * * Then in code in some other location that cannot access the dom-module above * * let img = customElements.get('dom-module').import('foo', 'img'); * * @customElement * @extends HTMLElement * @summary Custom element that provides a registry of relocatable DOM content * by `id` that is agnostic to bundling. * @unrestricted */ export class DomModule extends HTMLElement { /** @override */ static get observedAttributes() { return ['id']; } /** * Retrieves the element specified by the css `selector` in the module * registered by `id`. For example, this.import('foo', 'img'); * @param {string} id The id of the dom-module in which to search. * @param {string=} selector The css selector by which to find the element. * @return {Element} Returns the element which matches `selector` in the * module registered at the specified `id`. * * @export * @nocollapse Referred to indirectly in style-gather.js */ static import(id, selector) { if (id) { let m = findModule(id); if (m && selector) { return m.querySelector(selector); } return m; } return null; } /* eslint-disable no-unused-vars */ /** * @param {string} name Name of attribute. * @param {?string} old Old value of attribute. * @param {?string} value Current value of attribute. * @param {?string} namespace Attribute namespace. * @return {void} * @override */ attributeChangedCallback(name, old, value, namespace) { if (old !== value) { this.register(); } } /* eslint-enable no-unused-args */ /** * The absolute URL of the original location of this `dom-module`. * * This value will differ from this element's `ownerDocument` in the * following ways: * - Takes into account any `assetpath` attribute added during bundling * to indicate the original location relative to the bundled location * - Uses the HTMLImports polyfill's `importForElement` API to ensure * the path is relative to the import document's location since * `ownerDocument` is not currently polyfilled */ get assetpath() { // Don't override existing assetpath. if (!this.__assetpath) { // note: assetpath set via an attribute must be relative to this // element's location; accomodate polyfilled HTMLImports const owner = window.HTMLImports && HTMLImports.importForElement ? HTMLImports.importForElement(this) || document : this.ownerDocument; const url = resolveUrl(this.getAttribute('assetpath') || '', owner.baseURI); this.__assetpath = pathFromUrl(url); } return this.__assetpath; } /** * Registers the dom-module at a given id. This method should only be called * when a dom-module is imperatively created. For * example, `document.createElement('dom-module').register('foo')`. * @param {string=} id The id at which to register the dom-module. * @return {void} */ register(id) { id = id || this.id; if (id) { // Under strictTemplatePolicy, reject and null out any re-registered // dom-module since it is ambiguous whether first-in or last-in is trusted if (strictTemplatePolicy && findModule(id) !== undefined) { setModule(id, null); throw new Error(`strictTemplatePolicy: dom-module ${id} re-registered`); } this.id = id; setModule(id, this); styleOutsideTemplateCheck(this); } } } DomModule.prototype['modules'] = modules; customElements.define('dom-module', DomModule);
{ "content_hash": "ed7c1d4ff37b68a2fa98a18a785a6389", "timestamp": "", "source": "github", "line_count": 168, "max_line_length": 141, "avg_line_length": 30.089285714285715, "alnum_prop": 0.6666666666666666, "repo_name": "Leeps-Lab/otree-redwood", "id": "d4845d93b87d51b67cf16e4a663a2a9dd4c56a19", "size": "5565", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "polymer/build/otree-redwood/node_modules/@polymer/polymer/lib/elements/dom-module.js", "mode": "33188", "license": "mit", "language": [ { "name": "HTML", "bytes": "3406" }, { "name": "JavaScript", "bytes": "64175" }, { "name": "Python", "bytes": "38518" } ] }
'use strict'; angular.module('swedicApp') .controller('OauthButtonsController', function ($window) { this.loginOauth = function(provider) { $window.location.href = '/auth/' + provider; }; }); angular.module('swedicApp') .directive('oauthButtons', () => ({ templateUrl: 'components/oauth-buttons/oauth-buttons.html', restrict: 'EA', controller: 'OauthButtonsController', controllerAs: 'OauthButtons', scope: { classes: '@' } }));
{ "content_hash": "e46dfb8d1e7ef7f641ddc2231f3f60ab", "timestamp": "", "source": "github", "line_count": 19, "max_line_length": 65, "avg_line_length": 26.157894736842106, "alnum_prop": 0.6177062374245473, "repo_name": "pavel-r/swedic", "id": "1c267299926bc85edf65b5309b514738cfdd771c", "size": "497", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "client/components/oauth-buttons/index.js", "mode": "33188", "license": "mit", "language": [ { "name": "ApacheConf", "bytes": "24139" }, { "name": "CSS", "bytes": "2916" }, { "name": "HTML", "bytes": "27127" }, { "name": "JavaScript", "bytes": "121978" }, { "name": "Shell", "bytes": "316" } ] }
// Copyright 1998-2015 Epic Games, Inc. All Rights Reserved. // This code is modified from that in the Mesa3D Graphics library available at // http://mesa3d.org/ // The license for the original code follows: /** * \file ir_rvalue_visitor.cpp * * Generic class to implement the common pattern we have of wanting to * visit each ir_rvalue * and possibly change that node to a different * class. */ #include "ShaderCompilerCommon.h" #include "ir.h" #include "ir_visitor.h" #include "ir_rvalue_visitor.h" #include "ir_print_visitor.h" #include "glsl_types.h" ir_visitor_status ir_rvalue_visitor::visit_leave(ir_expression *ir) { unsigned int operand; for (operand = 0; operand < ir->get_num_operands(); operand++) { handle_rvalue(&ir->operands[operand]); } return visit_continue; } ir_visitor_status ir_rvalue_visitor::visit_leave(ir_texture *ir) { ir_rvalue* sampler_rvalue = ir->sampler; handle_rvalue(&sampler_rvalue); if (sampler_rvalue) { ir->sampler = sampler_rvalue->as_dereference(); } else { ir->sampler = NULL; } handle_rvalue(&ir->coordinate); handle_rvalue(&ir->projector); handle_rvalue(&ir->shadow_comparitor); handle_rvalue(&ir->offset); handle_rvalue(&ir->SamplerState); switch (ir->op) { case ir_tex: case ir_txm: case ir_txg: break; case ir_txb: handle_rvalue(&ir->lod_info.bias); break; case ir_txf: case ir_txl: case ir_txs: handle_rvalue(&ir->lod_info.lod); break; case ir_txd: handle_rvalue(&ir->lod_info.grad.dPdx); handle_rvalue(&ir->lod_info.grad.dPdy); break; } return visit_continue; } ir_visitor_status ir_rvalue_visitor::visit_leave(ir_swizzle *ir) { handle_rvalue(&ir->val); return visit_continue; } ir_visitor_status ir_rvalue_visitor::visit_leave(ir_dereference_array *ir) { /* The array index is not the target of the assignment, so clear the * 'in_assignee' flag. Restore it after returning from the array index. */ const bool was_in_assignee = this->in_assignee; this->in_assignee = false; handle_rvalue(&ir->array_index); this->in_assignee = was_in_assignee; handle_rvalue(&ir->array); return visit_continue; } ir_visitor_status ir_rvalue_visitor::visit_leave(ir_dereference_record *ir) { handle_rvalue(&ir->record); return visit_continue; } ir_visitor_status ir_rvalue_visitor::visit_leave(ir_assignment *ir) { handle_rvalue(&ir->rhs); handle_rvalue(&ir->condition); return visit_continue; } ir_visitor_status ir_rvalue_visitor::visit_leave(ir_call *ir) { foreach_iter(exec_list_iterator, iter, *ir) { ir_rvalue *param = (ir_rvalue *)iter.get(); ir_rvalue *new_param = param; handle_rvalue(&new_param); if (new_param != param) { param->replace_with(new_param); } } return visit_continue; } ir_visitor_status ir_rvalue_visitor::visit_leave(ir_return *ir) { handle_rvalue(&ir->value);; return visit_continue; } ir_visitor_status ir_rvalue_visitor::visit_leave(ir_if *ir) { handle_rvalue(&ir->condition); return visit_continue; }
{ "content_hash": "a73d06ee3d94178f953de029ea0a1719", "timestamp": "", "source": "github", "line_count": 138, "max_line_length": 78, "avg_line_length": 21.55072463768116, "alnum_prop": 0.7027572293207801, "repo_name": "PopCap/GameIdea", "id": "78caff1651be9632a8434b372e4c2226b1b64f5f", "size": "4108", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "Engine/Source/ThirdParty/hlslcc/hlslcc/src/hlslcc_lib/ir_rvalue_visitor.cpp", "mode": "33188", "license": "bsd-2-clause", "language": [ { "name": "ASP", "bytes": "238055" }, { "name": "Assembly", "bytes": "184134" }, { "name": "Batchfile", "bytes": "116983" }, { "name": "C", "bytes": "84264210" }, { "name": "C#", "bytes": "9612596" }, { "name": "C++", "bytes": "242290999" }, { "name": "CMake", "bytes": "548754" }, { "name": "CSS", "bytes": "134910" }, { "name": "GLSL", "bytes": "96780" }, { "name": "HLSL", "bytes": "124014" }, { "name": "HTML", "bytes": "4097051" }, { "name": "Java", "bytes": "757767" }, { "name": "JavaScript", "bytes": "2742822" }, { "name": "Makefile", "bytes": "1976144" }, { "name": "Objective-C", "bytes": "75778979" }, { "name": "Objective-C++", "bytes": "312592" }, { "name": "PAWN", "bytes": "2029" }, { "name": "PHP", "bytes": "10309" }, { "name": "PLSQL", "bytes": "130426" }, { "name": "Pascal", "bytes": "23662" }, { "name": "Perl", "bytes": "218656" }, { "name": "Python", "bytes": "21593012" }, { "name": "SAS", "bytes": "1847" }, { "name": "Shell", "bytes": "2889614" }, { "name": "Tcl", "bytes": "1452" } ] }
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <!-- NewPage --> <html lang="en"> <head> <!-- Generated by javadoc (1.8.0_11) on Mon Sep 01 22:26:13 IST 2014 --> <title>org.util.regex</title> <meta name="date" content="2014-09-01"> <link rel="stylesheet" type="text/css" href="../../../stylesheet.css" title="Style"> <script type="text/javascript" src="../../../script.js"></script> </head> <body> <h1 class="bar"><a href="../../../org/util/regex/package-summary.html" target="classFrame">org.util.regex</a></h1> <div class="indexContainer"> <h2 title="Classes">Classes</h2> <ul title="Classes"> <li><a href="RegularExpressionPatterns.html" title="class in org.util.regex" target="classFrame">RegularExpressionPatterns</a></li> <li><a href="RegularExpressions.html" title="class in org.util.regex" target="classFrame">RegularExpressions</a></li> </ul> </div> </body> </html>
{ "content_hash": "41a389294e9e1db707ba0202db3acf20", "timestamp": "", "source": "github", "line_count": 21, "max_line_length": 131, "avg_line_length": 44.285714285714285, "alnum_prop": 0.6806451612903226, "repo_name": "shivam091/Java-Utility-Classes", "id": "afd8a11afaff1f6097b9065ee69bdf5905d27885", "size": "930", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "Java Utility Classes/docs/org/util/regex/package-frame.html", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "12808" }, { "name": "Java", "bytes": "49211" }, { "name": "JavaScript", "bytes": "827" } ] }
// This file is automatically generated. package adila.db; /* * Samsung Galaxy S4 * * DEVICE: jfltetfnatt * MODEL: SM-S975L */ final class jfltetfnatt { public static final String DATA = "Samsung|Galaxy S4|Galaxy S"; }
{ "content_hash": "e1a2e1f09a9b199e66bb39069ce40a4d", "timestamp": "", "source": "github", "line_count": 13, "max_line_length": 67, "avg_line_length": 17.692307692307693, "alnum_prop": 0.6956521739130435, "repo_name": "karim/adila", "id": "bb9c8f2eb143e46b6525be3a8ab053922d394477", "size": "230", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "database/src/main/java/adila/db/jfltetfnatt.java", "mode": "33188", "license": "mit", "language": [ { "name": "Java", "bytes": "2903103" }, { "name": "Prolog", "bytes": "489" }, { "name": "Python", "bytes": "3280" } ] }
'use strict'; exports.__esModule = true; var _utils = require('flux/utils'); var _ActorAppDispatcher = require('../dispatcher/ActorAppDispatcher'); var _ActorAppDispatcher2 = _interopRequireDefault(_ActorAppDispatcher); var _ActorAppConstants = require('../constants/ActorAppConstants'); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } var DropdownStore = function (_Store) { _inherits(DropdownStore, _Store); function DropdownStore(dispatcher) { _classCallCheck(this, DropdownStore); var _this = _possibleConstructorReturn(this, _Store.call(this, dispatcher)); _this._isMessageDropdownOpen = false; _this._isRecentContextOpen = false; _this._targetRect = {}; _this._contextPos = {}; _this._message = {}; _this._peer = {}; return _this; } DropdownStore.prototype.isMessageDropdownOpen = function isMessageDropdownOpen(rid) { if (rid === this._message.rid) { return this._isMessageDropdownOpen; } else { return false; } }; DropdownStore.prototype.isRecentContextOpen = function isRecentContextOpen() { return this._isRecentContextOpen; }; DropdownStore.prototype.getMessage = function getMessage() { return this._message; }; DropdownStore.prototype.getTargetRect = function getTargetRect() { return this._targetRect; }; DropdownStore.prototype.getContextPos = function getContextPos() { return this._contextPos; }; DropdownStore.prototype.getPeer = function getPeer() { return this._peer; }; DropdownStore.prototype.__onDispatch = function __onDispatch(action) { switch (action.type) { case _ActorAppConstants.ActionTypes.MESSAGE_DROPDOWN_SHOW: this._isMessageDropdownOpen = true; this._isRecentContextOpen = false; this._message = action.message; this._targetRect = action.targetRect; this.__emitChange(); break; case _ActorAppConstants.ActionTypes.MESSAGE_DROPDOWN_HIDE: this._isMessageDropdownOpen = false; this.__emitChange(); break; case _ActorAppConstants.ActionTypes.RECENT_CONTEXT_MENU_SHOW: this._isRecentContextOpen = true; this._isMessageDropdownOpen = false; this._contextPos = action.contextPos; this._peer = action.peer; this.__emitChange(); break; case _ActorAppConstants.ActionTypes.RECENT_CONTEXT_MENU_HIDE: this._isRecentContextOpen = false; this.__emitChange(); break; default: } }; return DropdownStore; }(_utils.Store); exports.default = new DropdownStore(_ActorAppDispatcher2.default); //# sourceMappingURL=DropdownStore.js.map
{ "content_hash": "6309c80d3eb1b1e3369cd66097d384a4", "timestamp": "", "source": "github", "line_count": 99, "max_line_length": 495, "avg_line_length": 36.44444444444444, "alnum_prop": 0.6926274944567627, "repo_name": "EaglesoftZJ/iGem_Web", "id": "25f14b9fc01b0cedccdd9484ea8ad09d53080772", "size": "4656", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "build/stores/DropdownStore.js", "mode": "33261", "license": "apache-2.0", "language": [ { "name": "CSS", "bytes": "175789" }, { "name": "HTML", "bytes": "808" }, { "name": "JavaScript", "bytes": "1965824" } ] }
#include <iostream> #include <fstream> using std::ofstream; using std::ifstream; #include <cmath> using std::sqrt; #include <algorithm> using std::min; using std::max; //#include <vector> //using std::vector; #include "aipUtils.h" #include "aipVnmrFuncs.h" #include "aipStructs.h" #include "aipGraphicsWin.h" #include "aipGframe.h" #include "aipGframeManager.h" #include "aipRoi.h" #include "aipRoiManager.h" #include "aipLine.h" #include "aipPolygon.h" #include "aipPolyline.h" bool Polyline::firstTime = true; /* * Constructor from pixel location. * Assume gf is valid. */ Polyline::Polyline(spGframe_t gf, int x, int y) : Polygon() { init(gf, 2); created_type = ROI_POLYGON_OPEN; closed = false; initEdgelist(); initPix(x, y); lastx = (int) basex; lasty = (int) basey; pntData->name = "Polyline"; magnetCoords->name="Polyline"; Roi::create(gf); } /* * Constructor from data location. * Assume gf is valid. */ Polyline::Polyline(spGframe_t gf, spCoordVector_t dpts, bool pixflag) : Polygon() { init(gf, dpts->coords.size()); created_type = ROI_POLYGON_OPEN; closed = false; initEdgelist(); if(pixflag) { pntData = dpts; setMagnetCoordsFromPixels(); // TODO: Should be set from data } else { magnetCoords = dpts; setDataPntsFromMagnet(); } setPixPntsFromData(); // Sets pntPix, npnts, min/max gf->addRoi(this); pntData->name = "Polyline"; magnetCoords->name="Polyline"; } /* * FindDuplicateVertex returns the index of the first vertex that is * "near" its successor vertex. Near is defined to be within the * specified "tolerance". */ int Polyline::findDuplicateVertex(int tolerance) { for (int i = 1; i < npnts; i++) { int j = i - 1; // Previous point if (fabs(pntPix[i].x - pntPix[j].x) <= tolerance &&fabs(pntPix[i].y - pntPix[j].y) <= tolerance) { //printf("duplicate vertex[%d] \n", i); return i; } } return -1; } /* * Copy this ROI to another Gframe */ Roi *Polyline::copy(spGframe_t gframe) { if (gframe == nullFrame) { return NULL; } Roi *roi; roi = new Polyline(gframe, magnetCoords); return roi; } /* * Draw the polyline. */ void Polyline::draw() { Roi::draw(); } /* * Returns the address of the first data pixel in this ROI. * Initializes variables needed by NextPixel() to step through all the * pixels in the ROI. */ float *Polyline::firstPixel() { spImgInfo_t img = pOwnerFrame->getFirstImage(); if (img == nullImg || npnts < 2) { return NULL; } spDataInfo_t di = img->getDataInfo(); data = Line::InitIterator(di->getFast(), di->getMedium(), pntData->coords[0].x, pntData->coords[0].y, pntData->coords[1].x, pntData->coords[1].y, di->getData(), &pix_step, &npix, &ipix, &req_data_step, &opt_data_step, &test); ivertex = 1; return data; } /* * After initialization by calling FirstPixel(), each call to NextPixel() * returns the address of the next data pixel that is inside this ROI. * Successive calls to NextPixel() step through all the data in the ROI. * If no pixels are left, returns 0. */ float *Polyline::nextPixel() { if (ipix >= npix) { if (++ivertex >= npnts) { return 0; } else { spDataInfo_t di = pOwnerFrame->getFirstImage()->getDataInfo(); data = Line::InitIterator(di->getFast(), di->getMedium(), pntData->coords[ivertex-1].x, pntData->coords[ivertex-1].y, pntData->coords[ivertex].x, pntData->coords[ivertex].y, di->getData(), &pix_step, &npix, &ipix, &req_data_step, &opt_data_step, &test); return data; } } else { ipix++; data += req_data_step; if ((test += pix_step) > 1) { data += opt_data_step; test--; } return data; } } /* * Calculate some polyline info */ void Polyline::someInfo(bool isMoving, bool clear) { const int buflen = 100; int i, j; // counters if (isMoving && getReal("aipInfoUpdateOnMove", 0) == 0) { return; // Don't update while still dragging ROI } if (firstTime) { deleteOldFiles(Line::baseFilename); firstTime = false; } // Do not do anything if we are not the active ROI //if (RoiManager::get()->getFirstActive() != this) { //return; //} // Remember that we are the line to update if (clear) { RoiManager::infoLine = NULL; } else { RoiManager::infoLine = this; if (npnts < 2) { return; } } spImgInfo_t img = pOwnerFrame->getFirstImage(); spDataInfo_t di = img->getDataInfo(); // Calculate and print out the line length double wd = di->getSpan(0); double ht = di->getSpan(1); double xscale = wd / di->getFast(); double yscale = ht / di->getMedium(); double lenx; double lenxcm; double leny; double lenycm; double line_len = 0; double *segment_len = new double [npnts]; // NB: Segment numbers start at 1 for (i=1; i<npnts; i++) { lenx = pntData->coords[i].x - pntData->coords[i-1].x; lenxcm = lenx * xscale; leny = pntData->coords[i].y - pntData->coords[i-1].y; lenycm = leny * yscale; segment_len[i] = sqrt((lenxcm * lenxcm) + (lenycm * lenycm)); line_len += segment_len[i]; } char buf[buflen]; // holds text to be displayed static char lengthStr[buflen] = "---"; if (clear) { sprintf(buf, "Length:"); } else { sprintf(buf, "Length of polyline: %.4g cm", line_len); } if (strcmp(buf, lengthStr)) { strcpy(lengthStr, buf); setString("aipProfileLengthMsg", buf, true); } //setReal("aipProfileLength", line_len, true); // Print the line end coords. static char startStr[buflen] = "---"; if (clear) { sprintf(buf, "Start:"); } else { sprintf(buf, "Start: (%.2f, %.2f)", pntData->coords[0].x, pntData->coords[0].y); } if (strcmp(buf, startStr)) { strcpy(startStr, buf); setString("aipProfileDataCoordsStartMsg", buf, true); } static char endStr[buflen] = "---"; if (clear) { sprintf(buf, " End:"); } else { sprintf(buf, " End: (%.2f, %.2f)", pntData->coords[npnts-1].x, pntData->coords[npnts-1].y); } if (strcmp(buf, endStr)) { strcpy(endStr, buf); setString("aipProfileDataCoordsEndMsg", buf, true); } float *profile= NULL; int num_points = 0; if (!clear) { // Calculate line profile info -- (we never do projections!) setReal("aipProfileMIP", 0, true); float *ldata = di->getData(); int pixperrow = di->getFast(); double scale = xscale < yscale ? xscale : yscale; // Min cm per pixel scale /= 2; // cm between points we sample num_points = (int) (line_len / scale) + 1; if (num_points < 2) { delete[] segment_len; return; } profile = new float[num_points]; double x, y, s, cs, dx, dy, ds; cs = 0; // Current location along segment (cm) ds = line_len / (num_points - 1); // Distance between samples for (i=1, j=0; i<npnts; i++) { s = segment_len[i]; if (s <= 0) { continue; // Skip 0 length segments } dx = (pntData->coords[i].x - pntData->coords[i-1].x) * ds / s; dy = (pntData->coords[i].y - pntData->coords[i-1].y) * ds / s; x = pntData->coords[i-1].x + cs * dx / ds; y = pntData->coords[i-1].y + cs * dy / ds; for (; cs <= s && j < num_points; j++, x += dx, y += dy, cs += ds) { profile[j] = *(ldata + (int)x + (int)y * pixperrow); } cs -= s; } num_points = j; // Last point could be missed (roundoff) } Line::drawProfile(profile, num_points, line_len, "Intensity"); delete[] profile; delete[] segment_len; }
{ "content_hash": "8250071d2086ccf21478ca874033fa4c", "timestamp": "", "source": "github", "line_count": 284, "max_line_length": 80, "avg_line_length": 28.940140845070424, "alnum_prop": 0.5615038325830393, "repo_name": "OpenVnmrJ/OpenVnmrJ", "id": "6c0ac235ec4b8c944ff983e07b00cd784be96e6d", "size": "8461", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "src/aip/aipPolyline.C", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Assembly", "bytes": "8033" }, { "name": "Awk", "bytes": "3726" }, { "name": "Batchfile", "bytes": "993" }, { "name": "C", "bytes": "44578835" }, { "name": "C++", "bytes": "1895471" }, { "name": "CSS", "bytes": "12739" }, { "name": "Fortran", "bytes": "1661682" }, { "name": "HTML", "bytes": "68197" }, { "name": "Inno Setup", "bytes": "18741" }, { "name": "Java", "bytes": "17274464" }, { "name": "JavaScript", "bytes": "44448" }, { "name": "Lex", "bytes": "42593" }, { "name": "LiveScript", "bytes": "1071" }, { "name": "MATLAB", "bytes": "77708" }, { "name": "Makefile", "bytes": "126047" }, { "name": "OpenEdge ABL", "bytes": "6980" }, { "name": "PLpgSQL", "bytes": "1040" }, { "name": "Perl", "bytes": "10286" }, { "name": "PostScript", "bytes": "801" }, { "name": "Python", "bytes": "590263" }, { "name": "R", "bytes": "1082" }, { "name": "RPC", "bytes": "43654" }, { "name": "Roff", "bytes": "41584" }, { "name": "Shell", "bytes": "1478413" }, { "name": "Tcl", "bytes": "864859" }, { "name": "Vim Script", "bytes": "7711" }, { "name": "Yacc", "bytes": "95121" } ] }
/** * Module dependencies. */ var express = require('express'); var routes = require('./routes'); var user = require('./routes/user'); var http = require('http'); var path = require('path'); // additions var db = require('mongojs').connect(process.env.MONGOLAB_URI); var app = express(); // all environments app.set('port', process.env.PORT || 3000); app.set('views', path.join(__dirname, 'views')); app.set('view engine', 'jade'); app.use(express.favicon()); app.use(express.logger('dev')); app.use(express.json()); app.use(express.urlencoded()); app.use(express.methodOverride()); app.use(express.cookieParser(process.env.SESSION_SECRET)); app.use(express.session()); require('../')(db, app, process.env); // require login app.use(app.router); app.use(express.static(path.join(__dirname, 'public'))); // development only if ('development' == app.get('env')) { app.use(express.errorHandler()); } // additions function auth(req, res, next) { if (req.isAuthenticated()) { return next(); } res.redirect('/'); } app.get('/', routes.index); app.get('/users', auth, user.list); http.createServer(app).listen(app.get('port'), function(){ console.log('Express server listening on port ' + app.get('port')); });
{ "content_hash": "d56bb9af71e3429f0cdae7abe2bbc6bf", "timestamp": "", "source": "github", "line_count": 47, "max_line_length": 69, "avg_line_length": 26.085106382978722, "alnum_prop": 0.66721044045677, "repo_name": "ogt/express-linkedin-connect", "id": "3d84d4b89ecb979ecfb4b1ca35a886d3881a600a", "size": "1226", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "example/app.js", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "110" }, { "name": "JavaScript", "bytes": "6486" } ] }
using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.Mvc; using System.Web.Routing; namespace Redis.Dashboard.Web { public class RouteConfig { public static void RegisterRoutes(RouteCollection routes) { routes.IgnoreRoute("{resource}.axd/{*pathInfo}"); routes.MapRoute( name: "ServerGroup", url: "{friendlyUrl}", defaults: new { controller = "Home", action = "Index", friendlyUrl = UrlParameter.Optional } ); routes.MapRoute( name: "LoadData", url: "LoadData/{friendlyUrl}", defaults: new { controller = "LoadData", action = "Index", friendlyUrl = UrlParameter.Optional } ); routes.MapRoute( name: "Search", url: "Search/{friendlyUrl}/{pattern}", defaults: new { controller = "Search", action = "Index", pattern = UrlParameter.Optional } ); routes.MapRoute( name: "Default", url: "{controller}/{action}/{id}", defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional } ); } } }
{ "content_hash": "0b36f6a3cb965e66405e7f366f0434b7", "timestamp": "", "source": "github", "line_count": 41, "max_line_length": 112, "avg_line_length": 31.5609756097561, "alnum_prop": 0.5340030911901081, "repo_name": "cmvcamacho/redis-dashboard", "id": "ce346dbbaab882d0b067311efa7dd77ecaabbbe1", "size": "1296", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "Redis.Dashboard/Redis.Dashboard.Web/App_Start/RouteConfig.cs", "mode": "33188", "license": "mit", "language": [ { "name": "ASP", "bytes": "110" }, { "name": "Batchfile", "bytes": "628" }, { "name": "C#", "bytes": "59398" }, { "name": "CSS", "bytes": "11073" }, { "name": "HTML", "bytes": "5127" }, { "name": "JavaScript", "bytes": "620139" } ] }
import sys import re import redis from netaddr import * avail_threattypes = [ "emergingthreats", "binarydefense", "alienvaultreputation", "sslipblacklist", "ransomwaretracker", "blocklistdessh", "blocklistdeapache", "blocklistdebots", "cinsscore", "sblam", "stopforumspam", "atlasattacks", "atlasfastflux", "atlasphishing", "atlasscans", "myip","botvrij", "darklist", "labssnort", "openbl","dangerrulez", "bambenekconsulting", "torproject" ] threatscore_dict={'Malicious Host':20, 'Scanning Host':5, 'Spamming Host':10, 'Compromised IP':10, 'Bad SSL':5, 'SSH attacks':20, 'Apache attacks':20, 'Bad bots':10, 'Web Form Spammer':5, 'Fast flux hosting':10, 'Phishing Host':10, 'Web attacks':10, 'C2 servers':50, 'TOR exit nodes':10} if len(sys.argv) != 4: print "Usage: python threatuploader.py (ipdb|domaindb) filetype filepath" sys.exit(1) db_type = sys.argv[1] threatfile_type = sys.argv[2] threatfile_path = sys.argv[3] if threatfile_type not in avail_threattypes: print "available filetypes: ["+", ".join(avail_threattypes)+"]" sys.exit(1) redis_server = '127.0.0.1' redis_port = 6379 redis_ipdb = 0 redis_domaindb=1 # TTL of entry in the database threat_ttl=172800 # 48 hours def threatscore_alias(threttype): out=0 # AlienVailt DB threat types if threttype == 'Malicious Host': out=threatscore_dict[threttype] if threttype == 'Scanning Host': out=threatscore_dict[threttype] if threttype == 'Spamming Host': out=threatscore_dict[threttype] return str(out) # Upload parsed data to Redis # rpipe - redis-py pipeline object # ltype - 'ip'|'net' # lobj - ip address| CIDR # thsource - threat source # thtype - threat category # thscore - threat score # thttl - TTL of key in Redis def upload2redis(rpipe, ltype, lobj, thsource, thtype, thscore, thttl): try: # Add the key to redis (ip|net:IPaddress|CIDR) => List [ThreatSource1:score1, ThreatSource2:score1] rpipe.sadd(ltype+':'+lobj, "%s:%s:%s" % (thsource, thtype, str(thscore))).expire(ltype+':'+lobj,thttl) # Add to index 'net:index'=> Set [CIDR] if ltype == 'net': rpipe.sadd('net:index',lobj) except: print 'status=error, message="Cant insert data to Redis"' sys.exit(1) # Parse simple feeds with IPs single column and comments rows def simpleparser(file_path, red, threatscore, threattype, current_threatsource): red_pipe = red.pipeline() iplist_object = open(file_path, "r") for row in iplist_object: line_type='' line = row[:-1] if line == '' or line[0] == '#': continue try: IPAddress(line) line_type='ip' except AddrFormatError: continue except ValueError: try: IPNetwork(line) line_type='net' except AddrFormatError: continue except ValueError: continue upload2redis(red_pipe, line_type, line, current_threatsource, threattype, threatscore, threat_ttl) red_pipe.execute() iplist_object.close() def parse_emergingthreats(file_path, red): threattype = 'Compromised IP' threatscore = threatscore_dict[threattype] red_pipe = red.pipeline() iplist_object = open(file_path, "r") current_threatsource='' for row in iplist_object: line_type='' line = row[:-1] if line == '': continue # Parse Feodo if line == '# Feodo': current_threatsource = 'Feodo' continue if line == '# Zeus': current_threatsource = 'Zeus' continue if line == '# Spyeye': current_threatsource = 'Spyeye' continue if line == '# Palevo': current_threatsource = 'Palevo' continue if line == '#Spamhaus DROP Nets': current_threatsource = 'Spamhaus DROP Nets' continue if line == '#Dshield Top Attackers': current_threatsource = 'Dshield Top Attackers' continue try: IPAddress(line) line_type='ip' except AddrFormatError: continue except ValueError: try: IPNetwork(line) line_type='net' except AddrFormatError: continue except ValueError: continue upload2redis(red_pipe, line_type, line, current_threatsource, threattype, threatscore, threat_ttl) red_pipe.execute() iplist_object.close() def parse_binarydefense(fp, rd): threattype = 'Compromised IP' simpleparser(fp, rd, threatscore_dict[threattype], threattype, 'Binarydefense.com') def parse_alienvaultreputation(file_path, red): threattype = '' #Def in feed red_pipe = red.pipeline() iplist_object = open(file_path, "r") current_threatsource='AlienVault.com' for row in iplist_object: line_type='' line = row[:-1] if line == '' or line[0] == '#': continue linetemp = line.split('#', 1) line = linetemp[0].strip() threattype = linetemp[1].split(';',1)[0].strip() threatscore = threatscore_alias(threattype) try: IPAddress(line) line_type='ip' except AddrFormatError: continue except ValueError: try: IPNetwork(line) line_type='net' except AddrFormatError: continue except ValueError: continue upload2redis(red_pipe, line_type, line, current_threatsource, threattype, threatscore, threat_ttl) red_pipe.execute() iplist_object.close() def parse_sslipblacklist(file_path, red): threattype = 'Bad SSL' threatscore = threatscore_dict[threattype] red_pipe = red.pipeline() iplist_object = open(file_path, "r") current_threatsource='SSLBL.abuse.ch' for row in iplist_object: line_type='' line = row[:-1] if line == '' or line[0] == '#': continue linetemp = line.split(',') line = linetemp[0].strip() threattype = linetemp[2].strip() try: IPAddress(line) line_type='ip' except AddrFormatError: continue except ValueError: try: IPNetwork(line) line_type='net' except AddrFormatError: continue except ValueError: continue upload2redis(red_pipe, line_type, line, current_threatsource, threattype, threatscore, threat_ttl) red_pipe.execute() iplist_object.close() def parse_ransomwaretracker(fp, rd): threattype = 'Compromised IP' simpleparser(fp, rd, threatscore_dict[threattype], threattype, 'Ransomwaretracker.abuse.ch') def parse_blocklistdessh(fp, rd): threattype = 'SSH attacks' simpleparser(fp, rd, threatscore_dict[threattype], threattype,'Blocklist.de') def parse_blocklistdeapache(fp, rd): threattype = 'Web attacks' simpleparser(fp, rd, threatscore_dict[threattype], threattype,'Blocklist.de') def parse_blocklistdebots(fp, rd): threattype = 'Bad bots' simpleparser(fp, rd, threatscore_dict[threattype], threattype,'Blocklist.de') def parse_cinsscore(fp, rd): threattype = 'Compromised IP' simpleparser(fp, rd, threatscore_dict[threattype], threattype,'CINSScore.com') def parse_sblam(fp, rd): threattype = 'Web Form Spammer' simpleparser(fp, rd, threatscore_dict[threattype], threattype,'Sblam.com') def parse_stopforumspam(fp, rd): threattype = 'Web Form Spammer' simpleparser(fp, rd, threatscore_dict[threattype], threattype,'Stopforumspam.com') def parse_arboratlas(file_path, red, threatscore, threattype): red_pipe = red.pipeline() iplist_object = open(file_path, "r") current_threatsource='ATLAS.Arbor.net' for row in iplist_object: line_type='' line = row[:-1] if line == '': continue regip = re.match('^([0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}).*', row) if regip is not None: line = regip.group(1) try: IPAddress(line) line_type='ip' except AddrFormatError: continue except ValueError: try: IPNetwork(line) line_type='net' except AddrFormatError: continue except ValueError: continue upload2redis(red_pipe, line_type, line, current_threatsource, threattype, threatscore, threat_ttl) red_pipe.execute() iplist_object.close() def parse_atlasattacks(fp, rd): threattype = 'Malicious Host' parse_arboratlas(fp, rd, threatscore_dict[threattype], threattype) def parse_atlasfastflux(fp, rd): threattype = 'Fast flux hosting' parse_arboratlas(fp, rd, threatscore_dict[threattype], threattype) def parse_atlasphishing(fp, rd): threattype = 'Phishing Host' parse_arboratlas(fp, rd, threatscore_dict[threattype], threattype) def parse_atlasscans(fp, rd): threattype = 'Scanning Host' parse_arboratlas(fp, rd, threatscore_dict[threattype], threattype) def parse_myip(file_path, red): threattype = 'Bad bots' threatscore = threatscore_dict[threattype] red_pipe = red.pipeline() iplist_object = open(file_path, "r") current_threatsource='MYIP.ms' for row in iplist_object: line_type='' line = row[:-1] if line == '': continue regip = re.match('^([0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}).*', row) if regip is not None: line = regip.group(1) try: IPAddress(line) line_type='ip' except AddrFormatError: continue except ValueError: try: IPNetwork(line) line_type='net' except AddrFormatError: continue except ValueError: continue upload2redis(red_pipe, line_type, line, current_threatsource, threattype, threatscore, threat_ttl) red_pipe.execute() iplist_object.close() def parse_botvrij(fp, rd): threattype = 'Malicious Host' simpleparser(fp, rd, threatscore_dict[threattype], threattype, 'Botvrij.eu') def parse_darklist(fp, rd): threattype = 'SSH attacks' simpleparser(fp, rd, threatscore_dict[threattype], threattype, 'Darklist.de') def parse_labssnort(fp, rd): threattype = 'Malicious Host' simpleparser(fp, rd, threatscore_dict[threattype], threattype, 'Labs.snort.org') def parse_openbl(fp, rd): threattype = 'Web attacks' simpleparser(fp, rd, threatscore_dict[threattype], threattype, 'OpenBL.org') def parse_dangerrulez(file_path, red): threattype = 'SSH attacks' threatscore = threatscore_dict[threattype] red_pipe = red.pipeline() iplist_object = open(file_path, "r") current_threatsource='Danger.rulez.sk' for row in iplist_object: line_type='' line = row[:-1] if line == '' or line[0] == "#": continue regip = re.match('^([0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3})', row) if regip is not None: line = regip.group(1) try: IPAddress(line) line_type='ip' except AddrFormatError: continue except ValueError: try: IPNetwork(line) line_type='net' except AddrFormatError: continue except ValueError: continue upload2redis(red_pipe, line_type, line, current_threatsource, threattype, threatscore, threat_ttl) red_pipe.execute() iplist_object.close() def parse_bambenekconsulting(file_path, red): threattype = 'C2 servers' threatscore = threatscore_dict[threattype] red_pipe = red.pipeline() iplist_object = open(file_path, "r") current_threatsource='BambenekConsulting.com' for row in iplist_object: line_type='' line = row[:-1] if line == '' or line[0] == "#": continue regip = re.match('^([0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}),', row) if regip is not None: line = regip.group(1) try: IPAddress(line) line_type='ip' except AddrFormatError: continue except ValueError: try: IPNetwork(line) line_type='net' except AddrFormatError: continue except ValueError: continue upload2redis(red_pipe, line_type, line, current_threatsource, threattype, threatscore, threat_ttl) red_pipe.execute() iplist_object.close() def parse_torproject(file_path, red): threattype='TOR exit nodes' threatscore = threatscore_dict[threattype] red_pipe = red.pipeline() iplist_object = open(file_path, "r") current_threatsource='TORproject.org' for row in iplist_object: line_type='' line = row[:-1] if line == '': continue regip = re.match('^ExitAddress ([0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3})', row) if regip is not None: line = regip.group(1) try: IPAddress(line) line_type='ip' except AddrFormatError: continue except ValueError: try: IPNetwork(line) line_type='net' except AddrFormatError: continue except ValueError: continue upload2redis(red_pipe, line_type, line, current_threatsource, threattype, threatscore, threat_ttl) red_pipe.execute() iplist_object.close() def make_redisconn(conn_db): try: redis_pool = redis.ConnectionPool(host=redis_server, port=redis_port, db=conn_db) redis_conn = redis.Redis(connection_pool=redis_pool) redis_conn.ping() except: print 'status=error, message="Redis connection error '+redis_server+':'+str(redis_port)+'"' sys.exit(1) return redis_conn def main(): if db_type == 'ipdb': red = make_redisconn(redis_ipdb) method_name = 'parse_'+threatfile_type method = globals().get(method_name) if not method: print 'status=error, message="'+method_name+' method not exist"' sys.exit(1) method(threatfile_path, red) print 'status=done, threatsource='+threatfile_type+', message="UploadedIntoDB"' if db_type == 'domaindb': print 'status=error, message="domaindb is not implemented yet"' main() sys.exit(0)
{ "content_hash": "feaf454724e9223141fda66084788eb2", "timestamp": "", "source": "github", "line_count": 476, "max_line_length": 110, "avg_line_length": 32.74579831932773, "alnum_prop": 0.5666260345159427, "repo_name": "rstcloud/threatdb", "id": "6b9a0f93ed910bb1218e8c2e5dd1ec304ca8426b", "size": "15811", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "threatDB/bin/threatuploader.py", "mode": "33188", "license": "mit", "language": [ { "name": "Python", "bytes": "21097" }, { "name": "Shell", "bytes": "3097" } ] }
<?php defined('BASEPATH') OR exit('No direct script access allowed'); class Aboutus extends CI_Controller { public function index() { $this->load->view('header'); $this->load->view(''); $this->load->view('footer'); } }
{ "content_hash": "252ec62e85b44f654a1ba55c2f21abd5", "timestamp": "", "source": "github", "line_count": 12, "max_line_length": 63, "avg_line_length": 19.166666666666668, "alnum_prop": 0.6478260869565218, "repo_name": "arsischeon/blankit", "id": "fad73ea3e2956fc5c9bc39721d54c0564e537c67", "size": "230", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "application/controllers/Aboutus.php", "mode": "33188", "license": "mit", "language": [ { "name": "ApacheConf", "bytes": "240" }, { "name": "CSS", "bytes": "34665" }, { "name": "HTML", "bytes": "8091362" }, { "name": "JavaScript", "bytes": "121164" }, { "name": "PHP", "bytes": "2216077" } ] }
.. index:: WOPI requests; Lock, Lock .. |operation| replace:: Lock .. _Lock: Lock ==== :Required for: |web| |ios| .. default-domain:: http .. post:: /wopi/files/(file_id) The |operation| operation locks a file for editing by the WOPI client application instance that requested the lock. To support editing files, WOPI clients require that the WOPI host support locking files. When locked, a file should not be writable by other applications. If the file is currently unlocked, the host should lock the file and return :http:statuscode:`200`. If the file is currently locked and the **X-WOPI-Lock** value matches the lock currently on the file, the host should treat the request as if it is a :ref:`RefreshLock` request. That is, the host should refresh the lock timer and return :http:statuscode:`200`. In all other cases, the host must return a "lock mismatch" response (:http:statuscode:`409`) and include an **X-WOPI-Lock** response header containing the value of the current lock on the file. .. include:: /_fragments/no_lock_id.rst See :term:`Lock` for more general information regarding locks. .. include:: /_fragments/common_params.rst :reqheader X-WOPI-Override: The **string** ``LOCK``. Required. :reqheader X-WOPI-Lock: A **string** provided by the WOPI client that the host must use to identify the lock on the file. Required. :resheader X-WOPI-Lock: .. include:: /_fragments/headers/X-WOPI-Lock.rst :resheader X-WOPI-LockFailureReason: .. include:: /_fragments/headers/X-WOPI-LockFailureReason.rst :resheader X-WOPI-LockedByOtherInterface: .. include:: /_fragments/headers/X-WOPI-LockedByOtherInterface.rst :resheader X-WOPI-ItemVersion: .. include:: /_fragments/headers/X-WOPI-ItemVersion.rst :code 200: Success :code 400: **X-WOPI-Lock** was not provided or was empty :code 401: Invalid :term:`access token` :code 404: Resource not found/user unauthorized :code 409: Lock mismatch/locked by another interface; an **X-WOPI-Lock** response header containing the value of the current lock on the file must always be included when using this response code :code 500: Server error :code 501: Unsupported .. include:: /_fragments/common_headers.rst
{ "content_hash": "06bb997121a4ced2b08a92ad0c5c5423", "timestamp": "", "source": "github", "line_count": 64, "max_line_length": 118, "avg_line_length": 36.859375, "alnum_prop": 0.6943620178041543, "repo_name": "gtritchie/Office-Online-Test-Tools-and-Documentation", "id": "2ef99ec660379dfa4b7708f44e93bb0d3ef9630d", "size": "2360", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "docs/rest/src/files/Lock.rst", "mode": "33188", "license": "mit", "language": [] }
End of preview.

No dataset card yet

Downloads last month
4