text
stringlengths 2
1.04M
| meta
dict |
---|---|
package com.twitter.ambrose.service.impl;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.PrintWriter;
import java.io.Writer;
import java.util.Collection;
import java.util.Map;
import java.util.Properties;
import java.util.SortedMap;
import java.util.concurrent.ConcurrentSkipListMap;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.Iterables;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.twitter.ambrose.model.DAGNode;
import com.twitter.ambrose.model.Event;
import com.twitter.ambrose.model.Job;
import com.twitter.ambrose.model.PaginatedList;
import com.twitter.ambrose.model.WorkflowSummary;
import com.twitter.ambrose.service.StatsReadService;
import com.twitter.ambrose.service.StatsWriteService;
import com.twitter.ambrose.service.WorkflowIndexReadService;
import com.twitter.ambrose.util.JSONUtil;
/**
* In-memory implementation of both StatsReadService and StatsWriteService. Used when stats
* collection and stats serving are happening within the same VM. This class is intended to run in a
* VM that only handles a single workflow. Hence it ignores workflowId.
* <p/>
* Upon job completion this class can optionally write all json data to disk. This is useful for
* debugging. The written files can also be replayed in the Ambrose UI without re-running the Job
* via the <code>bin/demo</code> script. To write all json data to disk, set the following values as
* system properties using <code>-D</code>:
* <pre>
* <ul>
* <li><code>{@value #DUMP_WORKFLOW_FILE_PARAM}</code> - file in which to write the workflow
* json.</li>
* <li><code>{@value #DUMP_EVENTS_FILE_PARAM}</code> - file in which to write the events
* json.</li>
* </ul>
* </pre>
*/
public class InMemoryStatsService<T extends Job> implements StatsReadService<T>, StatsWriteService<T>,
WorkflowIndexReadService {
private static final Logger LOG = LoggerFactory.getLogger(InMemoryStatsService.class);
private static final String DUMP_WORKFLOW_FILE_PARAM = "ambrose.write.dag.file";
private static final String DUMP_EVENTS_FILE_PARAM = "ambrose.write.events.file";
private final WorkflowSummary summary = new WorkflowSummary(null,
System.getProperty("user.name", "unknown"), "unknown", null, 0, System.currentTimeMillis());
private final PaginatedList<WorkflowSummary> summaries =
new PaginatedList<WorkflowSummary>(ImmutableList.of(summary));
private boolean jobFailed = false;
private Map<String, DAGNode<T>> dagNodeNameMap = Maps.newHashMap();
private SortedMap<Integer, Event> eventMap = new ConcurrentSkipListMap<Integer, Event>();
private Writer workflowWriter;
private Writer eventsWriter;
private boolean eventWritten = false;
public InMemoryStatsService() {
String dumpWorkflowFileName = System.getProperty(DUMP_WORKFLOW_FILE_PARAM);
String dumpEventsFileName = System.getProperty(DUMP_EVENTS_FILE_PARAM);
if (dumpWorkflowFileName != null) {
try {
workflowWriter = new PrintWriter(dumpWorkflowFileName);
} catch (FileNotFoundException e) {
LOG.error("Could not create dag PrintWriter at " + dumpWorkflowFileName, e);
}
}
if (dumpEventsFileName != null) {
try {
eventsWriter = new PrintWriter(dumpEventsFileName);
} catch (FileNotFoundException e) {
LOG.error("Could not create events PrintWriter at " + dumpEventsFileName, e);
}
}
}
@Override
public synchronized void sendDagNodeNameMap(String workflowId,
Map<String, DAGNode<T>> dagNodeNameMap) throws IOException {
this.summary.setId(workflowId);
this.summary.setStatus(WorkflowSummary.Status.RUNNING);
this.summary.setProgress(0);
this.dagNodeNameMap = dagNodeNameMap;
writeJsonDagNodenameMapToDisk(dagNodeNameMap);
}
@Override
public synchronized void pushEvent(String workflowId, Event event) throws IOException {
eventMap.put(event.getId(), event);
switch (event.getType()) {
case WORKFLOW_PROGRESS:
Event.WorkflowProgressEvent workflowProgressEvent = (Event.WorkflowProgressEvent) event;
String progressString =
workflowProgressEvent.getPayload().get(Event.WorkflowProgressField.workflowProgress);
int progress = Integer.parseInt(progressString);
summary.setProgress(progress);
if (progress == 100) {
summary.setStatus(jobFailed
? WorkflowSummary.Status.FAILED
: WorkflowSummary.Status.SUCCEEDED);
}
break;
case JOB_FAILED:
jobFailed = true;
default:
// nothing
}
writeJsonEventToDisk(event);
}
@Override
public synchronized Map<String, DAGNode<T>> getDagNodeNameMap(String workflowId) {
return dagNodeNameMap;
}
@Override
public synchronized Collection<Event> getEventsSinceId(String workflowId, int sinceId) {
int minId = sinceId >= 0 ? sinceId + 1 : sinceId;
return eventMap.tailMap(minId).values();
}
@Override
public Map<String, String> getClusters() throws IOException {
return ImmutableMap.of("default", "default");
}
@Override
public synchronized PaginatedList<WorkflowSummary> getWorkflows(String cluster,
WorkflowSummary.Status status, String userId, int numResults, byte[] startKey)
throws IOException {
return summaries;
}
private void writeJsonDagNodenameMapToDisk(Map<String, DAGNode<T>> dagNodeNameMap)
throws IOException {
if (workflowWriter != null && dagNodeNameMap != null) {
JSONUtil.writeJson(workflowWriter, dagNodeNameMap.values());
}
}
private void writeJsonEventToDisk(Event event) throws IOException {
if (eventsWriter != null && event != null) {
eventsWriter.write(!eventWritten ? "[ " : ", ");
JSONUtil.writeJson(eventsWriter, event);
eventsWriter.flush();
eventWritten = true;
}
}
public void flushJsonToDisk() throws IOException {
if (workflowWriter != null) {
workflowWriter.close();
}
if (eventsWriter != null) {
if (eventWritten) {
eventsWriter.write(" ]\n");
}
eventsWriter.close();
}
}
@Override
public Collection<Event> getEventsSinceId(String workflowId, int sinceId,
int maxEvents) throws IOException {
int minId = sinceId >= 0 ? sinceId + 1 : sinceId;
return Lists.newArrayList(Iterables.limit(eventMap.tailMap(minId).values(), maxEvents));
}
@Override
public void initWriteService(Properties properties) throws IOException {
// Do nothing
}
@Override
public void initReadService(Properties properties) throws IOException {
// Do nothing
}
}
| {
"content_hash": "5112baa132fbe134f0aeed56fd21aca0",
"timestamp": "",
"source": "github",
"line_count": 188,
"max_line_length": 102,
"avg_line_length": 36.255319148936174,
"alnum_prop": 0.7238849765258216,
"repo_name": "tim777z/ambrose",
"id": "84dd7b57f40d39d134d35c78f35b30902bef1e51",
"size": "7371",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "common/src/main/java/com/twitter/ambrose/service/impl/InMemoryStatsService.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "3539"
},
{
"name": "HTML",
"bytes": "7927"
},
{
"name": "Java",
"bytes": "241921"
},
{
"name": "JavaScript",
"bytes": "119752"
},
{
"name": "PigLatin",
"bytes": "4787"
},
{
"name": "Python",
"bytes": "1013"
},
{
"name": "Scala",
"bytes": "1412"
},
{
"name": "Shell",
"bytes": "6012"
}
],
"symlink_target": ""
} |
using System;
using System.Text;
using Apache.Http.Entity.Mime;
using Apache.Http.Entity.Mime.Content;
using Sharpen;
namespace Apache.Http.Entity.Mime
{
/// <summary>
/// FormBodyPart class represents a content body that can be used as a part of multipart encoded
/// entities.
/// </summary>
/// <remarks>
/// FormBodyPart class represents a content body that can be used as a part of multipart encoded
/// entities. This class automatically populates the header with standard fields based on
/// the content description of the enclosed body.
/// </remarks>
/// <since>4.0</since>
public class FormBodyPart
{
private readonly string name;
private readonly Header header;
private readonly ContentBody body;
public FormBodyPart(string name, ContentBody body) : base()
{
if (name == null)
{
throw new ArgumentException("Name may not be null");
}
if (body == null)
{
throw new ArgumentException("Body may not be null");
}
this.name = name;
this.body = body;
this.header = new Header();
GenerateContentDisp(body);
GenerateContentType(body);
GenerateTransferEncoding(body);
}
public virtual string GetName()
{
return this.name;
}
public virtual ContentBody GetBody()
{
return this.body;
}
public virtual Header GetHeader()
{
return this.header;
}
public virtual void AddField(string name, string value)
{
if (name == null)
{
throw new ArgumentException("Field name may not be null");
}
this.header.AddField(new MinimalField(name, value));
}
protected internal virtual void GenerateContentDisp(ContentBody body)
{
StringBuilder buffer = new StringBuilder();
buffer.Append("attachment");
if (body.GetFilename() != null)
{
buffer.Append("; filename=\"");
buffer.Append(body.GetFilename());
buffer.Append("\"");
}
AddField(MIME.ContentDisposition, buffer.ToString());
}
protected internal virtual void GenerateContentType(ContentBody body)
{
StringBuilder buffer = new StringBuilder();
buffer.Append(body.GetMimeType());
// MimeType cannot be null
if (body.GetCharset() != null)
{
// charset may legitimately be null
buffer.Append("; charset=");
buffer.Append(body.GetCharset());
}
AddField(MIME.ContentType, buffer.ToString());
}
protected internal virtual void GenerateTransferEncoding(ContentBody body)
{
AddField(MIME.ContentTransferEnc, body.GetTransferEncoding());
}
// TE cannot be null
}
}
| {
"content_hash": "27c5a2567f2bcc1da1410dec33fa2ea2",
"timestamp": "",
"source": "github",
"line_count": 102,
"max_line_length": 100,
"avg_line_length": 30.558823529411764,
"alnum_prop": 0.5556624959897337,
"repo_name": "JiboStore/couchbase-lite-net",
"id": "51f7b9977aba244af3b5067a047e05810c5d4de6",
"size": "4968",
"binary": false,
"copies": "4",
"ref": "refs/heads/master",
"path": "src/Sharpened/Http/Entity/Mime/FormBodyPart.cs",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Batchfile",
"bytes": "132"
},
{
"name": "C#",
"bytes": "4844295"
},
{
"name": "Makefile",
"bytes": "663"
},
{
"name": "Shell",
"bytes": "3885"
}
],
"symlink_target": ""
} |
using System.ComponentModel.DataAnnotations;
using System;
namespace NinjaBotCore.Database
{
public partial class LogMonitoring
{
[Key]
public long Id { get; set; }
public long ServerId { get; set; }
public long ChannelId { get; set; }
public string ChannelName { get; set; }
public string ServerName { get; set; }
public bool MonitorLogs { get; set; }
public bool WatchLog { get; set; }
public string RetailReportId { get; set; }
public string ClassicReportId { get; set; }
public string ReportId { get; set; }
public DateTime? LatestLog { get; set; }
public DateTime? LatestLogClassic { get; set; }
public DateTime? LatestLogRetail { get; set; }
}
} | {
"content_hash": "a75432f48400e94bf0b8c3b75e0e8592",
"timestamp": "",
"source": "github",
"line_count": 23,
"max_line_length": 63,
"avg_line_length": 34.130434782608695,
"alnum_prop": 0.6114649681528662,
"repo_name": "gngrninja/NinjaBotCore",
"id": "619313ff9a22789e2bd35dcaac9630b0c848ea97",
"size": "785",
"binary": false,
"copies": "1",
"ref": "refs/heads/Dev",
"path": "src/Database/LogMonitoring.cs",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C#",
"bytes": "575811"
}
],
"symlink_target": ""
} |
namespace DotGame.EntitySystem.Components
{
public class AudioListener : Component
{
public override void Update(GameTime gameTime)
{
/*var listener = Entity.Scene.Engine.AudioDevice.Listener;
var position = listener.Position;
listener.Position = Entity.Transform.Position;
listener.Velocity = listener.Position - position;
listener.At = Vector3.TransformNormal(Camera.Lookat, Entity.Transform.Matrix);
var camera = Entity.GetComponent<Camera>();
if (camera == null)
listener.Up = Vector3.UnitY;
else
listener.Up = camera.Up;
*/
}
}
}
| {
"content_hash": "81782a3998ab48e9c5754ec4ce363190",
"timestamp": "",
"source": "github",
"line_count": 20,
"max_line_length": 90,
"avg_line_length": 35.8,
"alnum_prop": 0.5837988826815642,
"repo_name": "henrik1235/DotGame",
"id": "8c02ca780a354473b31892f73394b3c373dc6920",
"size": "718",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "DotGame/EntitySystem/Components/AudioListener.cs",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C#",
"bytes": "725962"
},
{
"name": "GLSL",
"bytes": "3320"
},
{
"name": "HLSL",
"bytes": "2284"
},
{
"name": "Smalltalk",
"bytes": "199"
}
],
"symlink_target": ""
} |
import java.net.*;
import java.io.*;
import java.security.MessageDigest;
public class Lab2P3Server
{
public static void main(String[] args) {
try {
ServerSocket sock = new ServerSocket(6014);
// now listen for connections
while (true) {
Socket client = sock.accept();
// we have a connection
InputStream in = client.getInputStream();
BufferedReader bin = new BufferedReader(new InputStreamReader(in));
String message = bin.readLine();
MessageDigest messageDigest = MessageDigest.getInstance("MD5");
messageDigest.update(message.getBytes());
String encryptedMessage = new String(messageDigest.digest());
PrintWriter pout = new PrintWriter(client.getOutputStream(), true);
// write the Date to the socket
pout.println(encryptedMessage);
// close the socket and resume listening for more connections
client.close();
}
}
catch (Exception e) {
System.out.println(e);
}
}
}
| {
"content_hash": "b19da07ccd23ca94bda8589591853fa7",
"timestamp": "",
"source": "github",
"line_count": 39,
"max_line_length": 71,
"avg_line_length": 24.743589743589745,
"alnum_prop": 0.689119170984456,
"repo_name": "jaredpetersen/wou",
"id": "7b0422e99d21720de0771c8f1221503177bbdc56",
"size": "1202",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "CS372/Lab2/Part2-3/Lab2P3Server.java",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "ASP",
"bytes": "312"
},
{
"name": "Batchfile",
"bytes": "1536"
},
{
"name": "C",
"bytes": "8690"
},
{
"name": "C#",
"bytes": "1204972"
},
{
"name": "CSS",
"bytes": "31093"
},
{
"name": "Groff",
"bytes": "945102"
},
{
"name": "HTML",
"bytes": "10252"
},
{
"name": "Haskell",
"bytes": "4602"
},
{
"name": "Java",
"bytes": "130669"
},
{
"name": "JavaScript",
"bytes": "147772"
},
{
"name": "OpenSCAD",
"bytes": "49208"
},
{
"name": "PHP",
"bytes": "9349"
},
{
"name": "PowerShell",
"bytes": "257986"
},
{
"name": "Python",
"bytes": "8845"
}
],
"symlink_target": ""
} |
jest.mock('fs');
const fs = require('fs');
const copyToFinalDestination = require('../../../builder/copyToFinalDestination');
describe('Builder › copyToFinalDestination.js', () => {
beforeEach(() => {
jest.resetModules();
jest.resetAllMocks();
fs.readFile = jest.fn();
fs.writeFile = jest.fn();
});
it('resolves immediately when no finalPath is provided', () => {
return copyToFinalDestination({ originalPath: 'fake/original/path.ext' })
.then(() => {
expect(fs.readFile).not.toHaveBeenCalled();
expect(fs.writeFile).not.toHaveBeenCalled();
});
});
it('reads the original file and writes it into the final path w/ the same basename', () => {
fs.readFile.mockImplementation((filePath, cb) => cb(null, 'fake content'));
fs.writeFile.mockImplementation((filePath, content, cb) => cb(null));
return copyToFinalDestination({
originalPath: 'fake/original/path.ext',
finalPath: 'fake/final/path/',
}).then(() => {
expect(fs.readFile).toHaveBeenCalled();
expect(fs.writeFile).toHaveBeenCalled();
});
});
it('rejects promise when it is unable to read file', () => {
fs.readFile.mockImplementation((filePath, cb) => cb(new Error('Read error')));
return copyToFinalDestination({
originalPath: 'fake/original/path.ext',
finalPath: 'fake/final/path/',
}).catch((err) => {
expect(fs.readFile).toHaveBeenCalled();
expect(fs.writeFile).not.toHaveBeenCalled();
expect(err).toBeInstanceOf(Error);
expect(err.message).toBe('Read error');
});
});
it('rejects promise when it is unable to write file', () => {
fs.readFile.mockImplementation((filePath, cb) => cb(null, 'fake content'));
fs.writeFile.mockImplementation((filePath, content, cb) => cb(new Error('Write error')));
return copyToFinalDestination({
originalPath: 'fake/original/path.ext',
finalPath: 'fake/final/path/',
}).catch((err) => {
expect(fs.readFile).toHaveBeenCalled();
expect(fs.writeFile).toHaveBeenCalled();
expect(err).toBeInstanceOf(Error);
expect(err.message).toBe('Write error');
});
});
});
| {
"content_hash": "c4e8fabb3f285a744f91d9bcec8fe994",
"timestamp": "",
"source": "github",
"line_count": 64,
"max_line_length": 94,
"avg_line_length": 34.015625,
"alnum_prop": 0.6389526871841984,
"repo_name": "Travix-International/travix-ui-kit",
"id": "45e36cd921f689929618d60f9b1e7ccb70ff3370",
"size": "2179",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "tests/unit/builder/copyToFinalDestination.spec.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "68863"
},
{
"name": "HTML",
"bytes": "1259"
},
{
"name": "JavaScript",
"bytes": "395750"
},
{
"name": "Makefile",
"bytes": "1569"
}
],
"symlink_target": ""
} |
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width" />
<link rel="shortcut icon" type="image/x-icon" href="../../../../../../favicon.ico" />
<title>Action.Builder | Android Developers</title>
<!-- STYLESHEETS -->
<link rel="stylesheet"
href="http://fonts.googleapis.com/css?family=Roboto+Condensed">
<link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Roboto:light,regular,medium,thin,italic,mediumitalic,bold"
title="roboto">
<link href="../../../../../../assets/css/default.css?v=5" rel="stylesheet" type="text/css">
<!-- FULLSCREEN STYLESHEET -->
<link href="../../../../../../assets/css/fullscreen.css" rel="stylesheet" class="fullscreen"
type="text/css">
<!-- JAVASCRIPT -->
<script src="http://www.google.com/jsapi" type="text/javascript"></script>
<script src="../../../../../../assets/js/android_3p-bundle.js" type="text/javascript"></script>
<script type="text/javascript">
var toRoot = "../../../../../../";
var metaTags = [];
var devsite = false;
</script>
<script src="../../../../../../assets/js/docs.js?v=3" type="text/javascript"></script>
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-5831155-1', 'android.com');
ga('create', 'UA-49880327-2', 'android.com', {'name': 'universal'}); // New tracker);
ga('send', 'pageview');
ga('universal.send', 'pageview'); // Send page view for new tracker.
</script>
</head>
<body class="gc-documentation
develop reference" itemscope itemtype="http://schema.org/Article">
<div id="doc-api-level" class="" style="display:none"></div>
<a name="top"></a>
<a name="top"></a>
<!-- dialog to prompt lang pref change when loaded from hardcoded URL
<div id="langMessage" style="display:none">
<div>
<div class="lang en">
<p>You requested a page in English, would you like to proceed with this language setting?</p>
</div>
<div class="lang es">
<p>You requested a page in Spanish (Español), would you like to proceed with this language setting?</p>
</div>
<div class="lang ja">
<p>You requested a page in Japanese (日本語), would you like to proceed with this language setting?</p>
</div>
<div class="lang ko">
<p>You requested a page in Korean (한국어), would you like to proceed with this language setting?</p>
</div>
<div class="lang ru">
<p>You requested a page in Russian (Русский), would you like to proceed with this language setting?</p>
</div>
<div class="lang zh-cn">
<p>You requested a page in Simplified Chinese (简体中文), would you like to proceed with this language setting?</p>
</div>
<div class="lang zh-tw">
<p>You requested a page in Traditional Chinese (繁體中文), would you like to proceed with this language setting?</p>
</div>
<a href="#" class="button yes" onclick="return false;">
<span class="lang en">Yes</span>
<span class="lang es">Sí</span>
<span class="lang ja">Yes</span>
<span class="lang ko">Yes</span>
<span class="lang ru">Yes</span>
<span class="lang zh-cn">是的</span>
<span class="lang zh-tw">没有</span>
</a>
<a href="#" class="button" onclick="$('#langMessage').hide();return false;">
<span class="lang en">No</span>
<span class="lang es">No</span>
<span class="lang ja">No</span>
<span class="lang ko">No</span>
<span class="lang ru">No</span>
<span class="lang zh-cn">没有</span>
<span class="lang zh-tw">没有</span>
</a>
</div>
</div> -->
<!-- Header -->
<div id="header-wrapper">
<div id="header">
<div class="wrap" id="header-wrap">
<div class="col-3 logo">
<a href="../../../../../../index.html">
<img src="../../../../../../assets/images/dac_logo.png"
srcset="../../../../../../assets/images/[email protected] 2x"
width="123" height="25" alt="Android Developers" />
</a>
<div class="btn-quicknav" id="btn-quicknav">
<a href="#" class="arrow-inactive">Quicknav</a>
<a href="#" class="arrow-active">Quicknav</a>
</div>
</div>
<ul class="nav-x col-9">
<li class="design">
<a href="../../../../../../design/index.html"
zh-tw-lang="設計"
zh-cn-lang="设计"
ru-lang="Проектирование"
ko-lang="디자인"
ja-lang="設計"
es-lang="Diseñar"
>Design</a></li>
<li class="develop"><a href="../../../../../../develop/index.html"
zh-tw-lang="開發"
zh-cn-lang="开发"
ru-lang="Разработка"
ko-lang="개발"
ja-lang="開発"
es-lang="Desarrollar"
>Develop</a></li>
<li class="distribute last"><a href="../../../../../../distribute/googleplay/index.html"
zh-tw-lang="發佈"
zh-cn-lang="分发"
ru-lang="Распространение"
ko-lang="배포"
ja-lang="配布"
es-lang="Distribuir"
>Distribute</a></li>
</ul>
<div class="menu-container">
<div class="moremenu">
<div id="more-btn"></div>
</div>
<div class="morehover" id="moremenu">
<div class="top"></div>
<div class="mid">
<div class="header">Links</div>
<ul>
<li><a href="https://play.google.com/apps/publish/" target="_googleplay">Google Play Developer Console</a></li>
<li><a href="http://android-developers.blogspot.com/">Android Developers Blog</a></li>
<li><a href="../../../../../../about/index.html">About Android</a></li>
</ul>
<div class="header">Android Sites</div>
<ul>
<li><a href="http://www.android.com">Android.com</a></li>
<li class="active"><a>Android Developers</a></li>
<li><a href="http://source.android.com">Android Open Source Project</a></li>
</ul>
<br class="clearfix" />
</div><!-- end 'mid' -->
<div class="bottom"></div>
</div><!-- end 'moremenu' -->
<div class="search" id="search-container">
<div class="search-inner">
<div id="search-btn"></div>
<div class="left"></div>
<form onsubmit="return submit_search()">
<input id="search_autocomplete" type="text" value="" autocomplete="off" name="q"
onfocus="search_focus_changed(this, true)" onblur="search_focus_changed(this, false)"
onkeydown="return search_changed(event, true, '../../../../../../')"
onkeyup="return search_changed(event, false, '../../../../../../')" />
</form>
<div class="right"></div>
<a class="close hide">close</a>
<div class="left"></div>
<div class="right"></div>
</div><!-- end search-inner -->
</div><!-- end search-container -->
<div class="search_filtered_wrapper reference">
<div class="suggest-card reference no-display">
<ul class="search_filtered">
</ul>
</div>
</div>
<div class="search_filtered_wrapper docs">
<div class="suggest-card dummy no-display"> </div>
<div class="suggest-card develop no-display">
<ul class="search_filtered">
</ul>
<div class="child-card guides no-display">
</div>
<div class="child-card training no-display">
</div>
<div class="child-card samples no-display">
</div>
</div>
<div class="suggest-card design no-display">
<ul class="search_filtered">
</ul>
</div>
<div class="suggest-card distribute no-display">
<ul class="search_filtered">
</ul>
</div>
</div>
</div><!-- end menu-container (search and menu widget) -->
<!-- Expanded quicknav -->
<div id="quicknav" class="col-13">
<ul>
<li class="about">
<ul>
<li><a href="../../../../../../about/index.html">About</a></li>
<li><a href="../../../../../../wear/index.html">Wear</a></li>
<li><a href="../../../../../../tv/index.html">TV</a></li>
<li><a href="../../../../../../auto/index.html">Auto</a></li>
</ul>
</li>
<li class="design">
<ul>
<li><a href="../../../../../../design/index.html">Get Started</a></li>
<li><a href="../../../../../../design/devices.html">Devices</a></li>
<li><a href="../../../../../../design/style/index.html">Style</a></li>
<li><a href="../../../../../../design/patterns/index.html">Patterns</a></li>
<li><a href="../../../../../../design/building-blocks/index.html">Building Blocks</a></li>
<li><a href="../../../../../../design/downloads/index.html">Downloads</a></li>
<li><a href="../../../../../../design/videos/index.html">Videos</a></li>
</ul>
</li>
<li class="develop">
<ul>
<li><a href="../../../../../../training/index.html"
zh-tw-lang="訓練課程"
zh-cn-lang="培训"
ru-lang="Курсы"
ko-lang="교육"
ja-lang="トレーニング"
es-lang="Capacitación"
>Training</a></li>
<li><a href="../../../../../../guide/index.html"
zh-tw-lang="API 指南"
zh-cn-lang="API 指南"
ru-lang="Руководства по API"
ko-lang="API 가이드"
ja-lang="API ガイド"
es-lang="Guías de la API"
>API Guides</a></li>
<li><a href="../../../../../../reference/packages.html"
zh-tw-lang="參考資源"
zh-cn-lang="参考"
ru-lang="Справочник"
ko-lang="참조문서"
ja-lang="リファレンス"
es-lang="Referencia"
>Reference</a></li>
<li><a href="../../../../../../sdk/index.html"
zh-tw-lang="相關工具"
zh-cn-lang="工具"
ru-lang="Инструменты"
ko-lang="도구"
ja-lang="ツール"
es-lang="Herramientas"
>Tools</a>
</li>
<li><a href="../../../../../../google/index.html">Google Services</a>
</li>
</ul>
</li>
<li class="distribute last">
<ul>
<li><a href="../../../../../../distribute/googleplay/index.html">Google Play</a></li>
<li><a href="../../../../../../distribute/essentials/index.html">Essentials</a></li>
<li><a href="../../../../../../distribute/users/index.html">Get Users</a></li>
<li><a href="../../../../../../distribute/engage/index.html">Engage & Retain</a></li>
<li><a href="../../../../../../distribute/monetize/index.html">Monetize</a></li>
<li><a href="../../../../../../distribute/analyze/index.html">Analyze</a></li>
<li><a href="../../../../../../distribute/tools/index.html">Tools & Reference</a></li>
<li><a href="../../../../../../distribute/stories/index.html">Developer Stories</a></li>
</ul>
</li>
</ul>
</div><!-- /Expanded quicknav -->
</div><!-- end header-wrap.wrap -->
</div><!-- end header -->
<!-- Secondary x-nav -->
<div id="nav-x">
<div class="wrap" style="position:relative;z-index:1">
<ul class="nav-x col-9 develop" style="width:100%">
<li class="training"><a href="../../../../../../training/index.html"
zh-tw-lang="訓練課程"
zh-cn-lang="培训"
ru-lang="Курсы"
ko-lang="교육"
ja-lang="トレーニング"
es-lang="Capacitación"
>Training</a></li>
<li class="guide"><a href="../../../../../../guide/index.html"
zh-tw-lang="API 指南"
zh-cn-lang="API 指南"
ru-lang="Руководства по API"
ko-lang="API 가이드"
ja-lang="API ガイド"
es-lang="Guías de la API"
>API Guides</a></li>
<li class="reference"><a href="../../../../../../reference/packages.html"
zh-tw-lang="參考資源"
zh-cn-lang="参考"
ru-lang="Справочник"
ko-lang="참조문서"
ja-lang="リファレンス"
es-lang="Referencia"
>Reference</a></li>
<li class="tools"><a href="../../../../../../sdk/index.html"
zh-tw-lang="相關工具"
zh-cn-lang="工具"
ru-lang="Инструменты"
ko-lang="도구"
ja-lang="ツール"
es-lang="Herramientas"
>Tools</a></li>
<li class="google"><a href="../../../../../../google/index.html"
>Google Services</a>
</li>
</ul>
</div>
</div>
<!-- /Sendondary x-nav DEVELOP -->
<div id="searchResults" class="wrap" style="display:none;">
<h2 id="searchTitle">Results</h2>
<div id="leftSearchControl" class="search-control">Loading...</div>
</div>
</div> <!--end header-wrapper -->
<div id="sticky-header">
<div>
<a class="logo" href="#top"></a>
<a class="top" href="#top"></a>
<ul class="breadcrumb">
<li class="current">Action.Builder</li>
</ul>
</div>
</div>
<div class="wrap clearfix" id="body-content">
<div class="col-4" id="side-nav" itemscope itemtype="http://schema.org/SiteNavigationElement">
<div id="devdoc-nav">
<div id="api-nav-header">
<div id="api-level-toggle">
<label for="apiLevelCheckbox" class="disabled"
title="Select your target API level to dim unavailable APIs">API level: </label>
<div class="select-wrapper">
<select id="apiLevelSelector">
<!-- option elements added by buildApiLevelSelector() -->
</select>
</div>
</div><!-- end toggle -->
<div id="api-nav-title">Android APIs</div>
</div><!-- end nav header -->
<script>
var SINCE_DATA = [ ];
buildApiLevelSelector();
</script>
<div id="swapper">
<div id="nav-panels">
<div id="resize-packages-nav">
<div id="packages-nav" class="scroll-pane">
<ul>
<li class="api apilevel-">
<a href="../../../../../../reference/com/google/android/gms/package-summary.html">com.google.android.gms</a></li>
<li class="api apilevel-">
<a href="../../../../../../reference/com/google/android/gms/actions/package-summary.html">com.google.android.gms.actions</a></li>
<li class="api apilevel-">
<a href="../../../../../../reference/com/google/android/gms/ads/package-summary.html">com.google.android.gms.ads</a></li>
<li class="api apilevel-">
<a href="../../../../../../reference/com/google/android/gms/ads/doubleclick/package-summary.html">com.google.android.gms.ads.doubleclick</a></li>
<li class="api apilevel-">
<a href="../../../../../../reference/com/google/android/gms/ads/identifier/package-summary.html">com.google.android.gms.ads.identifier</a></li>
<li class="api apilevel-">
<a href="../../../../../../reference/com/google/android/gms/ads/mediation/package-summary.html">com.google.android.gms.ads.mediation</a></li>
<li class="api apilevel-">
<a href="../../../../../../reference/com/google/android/gms/ads/mediation/admob/package-summary.html">com.google.android.gms.ads.mediation.admob</a></li>
<li class="api apilevel-">
<a href="../../../../../../reference/com/google/android/gms/ads/mediation/customevent/package-summary.html">com.google.android.gms.ads.mediation.customevent</a></li>
<li class="api apilevel-">
<a href="../../../../../../reference/com/google/android/gms/ads/purchase/package-summary.html">com.google.android.gms.ads.purchase</a></li>
<li class="api apilevel-">
<a href="../../../../../../reference/com/google/android/gms/ads/search/package-summary.html">com.google.android.gms.ads.search</a></li>
<li class="api apilevel-">
<a href="../../../../../../reference/com/google/android/gms/analytics/package-summary.html">com.google.android.gms.analytics</a></li>
<li class="api apilevel-">
<a href="../../../../../../reference/com/google/android/gms/analytics/ecommerce/package-summary.html">com.google.android.gms.analytics.ecommerce</a></li>
<li class="selected api apilevel-">
<a href="../../../../../../reference/com/google/android/gms/appindexing/package-summary.html">com.google.android.gms.appindexing</a></li>
<li class="api apilevel-">
<a href="../../../../../../reference/com/google/android/gms/appstate/package-summary.html">com.google.android.gms.appstate</a></li>
<li class="api apilevel-">
<a href="../../../../../../reference/com/google/android/gms/auth/package-summary.html">com.google.android.gms.auth</a></li>
<li class="api apilevel-">
<a href="../../../../../../reference/com/google/android/gms/cast/package-summary.html">com.google.android.gms.cast</a></li>
<li class="api apilevel-">
<a href="../../../../../../reference/com/google/android/gms/common/package-summary.html">com.google.android.gms.common</a></li>
<li class="api apilevel-">
<a href="../../../../../../reference/com/google/android/gms/common/annotation/package-summary.html">com.google.android.gms.common.annotation</a></li>
<li class="api apilevel-">
<a href="../../../../../../reference/com/google/android/gms/common/api/package-summary.html">com.google.android.gms.common.api</a></li>
<li class="api apilevel-">
<a href="../../../../../../reference/com/google/android/gms/common/data/package-summary.html">com.google.android.gms.common.data</a></li>
<li class="api apilevel-">
<a href="../../../../../../reference/com/google/android/gms/common/images/package-summary.html">com.google.android.gms.common.images</a></li>
<li class="api apilevel-">
<a href="../../../../../../reference/com/google/android/gms/drive/package-summary.html">com.google.android.gms.drive</a></li>
<li class="api apilevel-">
<a href="../../../../../../reference/com/google/android/gms/drive/events/package-summary.html">com.google.android.gms.drive.events</a></li>
<li class="api apilevel-">
<a href="../../../../../../reference/com/google/android/gms/drive/metadata/package-summary.html">com.google.android.gms.drive.metadata</a></li>
<li class="api apilevel-">
<a href="../../../../../../reference/com/google/android/gms/drive/query/package-summary.html">com.google.android.gms.drive.query</a></li>
<li class="api apilevel-">
<a href="../../../../../../reference/com/google/android/gms/drive/widget/package-summary.html">com.google.android.gms.drive.widget</a></li>
<li class="api apilevel-">
<a href="../../../../../../reference/com/google/android/gms/fitness/package-summary.html">com.google.android.gms.fitness</a></li>
<li class="api apilevel-">
<a href="../../../../../../reference/com/google/android/gms/fitness/data/package-summary.html">com.google.android.gms.fitness.data</a></li>
<li class="api apilevel-">
<a href="../../../../../../reference/com/google/android/gms/fitness/request/package-summary.html">com.google.android.gms.fitness.request</a></li>
<li class="api apilevel-">
<a href="../../../../../../reference/com/google/android/gms/fitness/result/package-summary.html">com.google.android.gms.fitness.result</a></li>
<li class="api apilevel-">
<a href="../../../../../../reference/com/google/android/gms/fitness/service/package-summary.html">com.google.android.gms.fitness.service</a></li>
<li class="api apilevel-">
<a href="../../../../../../reference/com/google/android/gms/games/package-summary.html">com.google.android.gms.games</a></li>
<li class="api apilevel-">
<a href="../../../../../../reference/com/google/android/gms/games/achievement/package-summary.html">com.google.android.gms.games.achievement</a></li>
<li class="api apilevel-">
<a href="../../../../../../reference/com/google/android/gms/games/event/package-summary.html">com.google.android.gms.games.event</a></li>
<li class="api apilevel-">
<a href="../../../../../../reference/com/google/android/gms/games/leaderboard/package-summary.html">com.google.android.gms.games.leaderboard</a></li>
<li class="api apilevel-">
<a href="../../../../../../reference/com/google/android/gms/games/multiplayer/package-summary.html">com.google.android.gms.games.multiplayer</a></li>
<li class="api apilevel-">
<a href="../../../../../../reference/com/google/android/gms/games/multiplayer/realtime/package-summary.html">com.google.android.gms.games.multiplayer.realtime</a></li>
<li class="api apilevel-">
<a href="../../../../../../reference/com/google/android/gms/games/multiplayer/turnbased/package-summary.html">com.google.android.gms.games.multiplayer.turnbased</a></li>
<li class="api apilevel-">
<a href="../../../../../../reference/com/google/android/gms/games/quest/package-summary.html">com.google.android.gms.games.quest</a></li>
<li class="api apilevel-">
<a href="../../../../../../reference/com/google/android/gms/games/request/package-summary.html">com.google.android.gms.games.request</a></li>
<li class="api apilevel-">
<a href="../../../../../../reference/com/google/android/gms/games/snapshot/package-summary.html">com.google.android.gms.games.snapshot</a></li>
<li class="api apilevel-">
<a href="../../../../../../reference/com/google/android/gms/gcm/package-summary.html">com.google.android.gms.gcm</a></li>
<li class="api apilevel-">
<a href="../../../../../../reference/com/google/android/gms/identity/intents/package-summary.html">com.google.android.gms.identity.intents</a></li>
<li class="api apilevel-">
<a href="../../../../../../reference/com/google/android/gms/identity/intents/model/package-summary.html">com.google.android.gms.identity.intents.model</a></li>
<li class="api apilevel-">
<a href="../../../../../../reference/com/google/android/gms/location/package-summary.html">com.google.android.gms.location</a></li>
<li class="api apilevel-">
<a href="../../../../../../reference/com/google/android/gms/location/places/package-summary.html">com.google.android.gms.location.places</a></li>
<li class="api apilevel-">
<a href="../../../../../../reference/com/google/android/gms/location/places/ui/package-summary.html">com.google.android.gms.location.places.ui</a></li>
<li class="api apilevel-">
<a href="../../../../../../reference/com/google/android/gms/maps/package-summary.html">com.google.android.gms.maps</a></li>
<li class="api apilevel-">
<a href="../../../../../../reference/com/google/android/gms/maps/model/package-summary.html">com.google.android.gms.maps.model</a></li>
<li class="api apilevel-">
<a href="../../../../../../reference/com/google/android/gms/nearby/package-summary.html">com.google.android.gms.nearby</a></li>
<li class="api apilevel-">
<a href="../../../../../../reference/com/google/android/gms/nearby/connection/package-summary.html">com.google.android.gms.nearby.connection</a></li>
<li class="api apilevel-">
<a href="../../../../../../reference/com/google/android/gms/panorama/package-summary.html">com.google.android.gms.panorama</a></li>
<li class="api apilevel-">
<a href="../../../../../../reference/com/google/android/gms/plus/package-summary.html">com.google.android.gms.plus</a></li>
<li class="api apilevel-">
<a href="../../../../../../reference/com/google/android/gms/plus/model/moments/package-summary.html">com.google.android.gms.plus.model.moments</a></li>
<li class="api apilevel-">
<a href="../../../../../../reference/com/google/android/gms/plus/model/people/package-summary.html">com.google.android.gms.plus.model.people</a></li>
<li class="api apilevel-">
<a href="../../../../../../reference/com/google/android/gms/safetynet/package-summary.html">com.google.android.gms.safetynet</a></li>
<li class="api apilevel-">
<a href="../../../../../../reference/com/google/android/gms/security/package-summary.html">com.google.android.gms.security</a></li>
<li class="api apilevel-">
<a href="../../../../../../reference/com/google/android/gms/tagmanager/package-summary.html">com.google.android.gms.tagmanager</a></li>
<li class="api apilevel-">
<a href="../../../../../../reference/com/google/android/gms/wallet/package-summary.html">com.google.android.gms.wallet</a></li>
<li class="api apilevel-">
<a href="../../../../../../reference/com/google/android/gms/wallet/fragment/package-summary.html">com.google.android.gms.wallet.fragment</a></li>
<li class="api apilevel-">
<a href="../../../../../../reference/com/google/android/gms/wearable/package-summary.html">com.google.android.gms.wearable</a></li>
</ul><br/>
</div> <!-- end packages-nav -->
</div> <!-- end resize-packages -->
<div id="classes-nav" class="scroll-pane">
<ul>
<li><h2>Interfaces</h2>
<ul>
<li class="api apilevel-"><a href="../../../../../../reference/com/google/android/gms/appindexing/AppIndexApi.html">AppIndexApi</a></li>
<li class="api apilevel-"><a href="../../../../../../reference/com/google/android/gms/appindexing/AppIndexApi.ActionResult.html">AppIndexApi.ActionResult</a></li>
</ul>
</li>
<li><h2>Classes</h2>
<ul>
<li class="api apilevel-"><a href="../../../../../../reference/com/google/android/gms/appindexing/Action.html">Action</a></li>
<li class="selected api apilevel-"><a href="../../../../../../reference/com/google/android/gms/appindexing/Action.Builder.html">Action.Builder</a></li>
<li class="api apilevel-"><a href="../../../../../../reference/com/google/android/gms/appindexing/AndroidAppUri.html">AndroidAppUri</a></li>
<li class="api apilevel-"><a href="../../../../../../reference/com/google/android/gms/appindexing/AppIndex.html">AppIndex</a></li>
<li class="api apilevel-"><a href="../../../../../../reference/com/google/android/gms/appindexing/AppIndexApi.AppIndexingLink.html">AppIndexApi.AppIndexingLink</a></li>
<li class="api apilevel-"><a href="../../../../../../reference/com/google/android/gms/appindexing/Thing.html">Thing</a></li>
<li class="api apilevel-"><a href="../../../../../../reference/com/google/android/gms/appindexing/Thing.Builder.html">Thing.Builder</a></li>
</ul>
</li>
</ul><br/>
</div><!-- end classes -->
</div><!-- end nav-panels -->
<div id="nav-tree" style="display:none" class="scroll-pane">
<div id="tree-list"></div>
</div><!-- end nav-tree -->
</div><!-- end swapper -->
<div id="nav-swap">
<a class="fullscreen">fullscreen</a>
<a href='#' onclick='swapNav();return false;'><span id='tree-link'>Use Tree Navigation</span><span id='panel-link' style='display:none'>Use Panel Navigation</span></a>
</div>
</div> <!-- end devdoc-nav -->
</div> <!-- end side-nav -->
<script type="text/javascript">
// init fullscreen based on user pref
var fullscreen = readCookie("fullscreen");
if (fullscreen != 0) {
if (fullscreen == "false") {
toggleFullscreen(false);
} else {
toggleFullscreen(true);
}
}
// init nav version for mobile
if (isMobile) {
swapNav(); // tree view should be used on mobile
$('#nav-swap').hide();
} else {
chooseDefaultNav();
if ($("#nav-tree").is(':visible')) {
init_default_navtree("../../../../../../");
}
}
// scroll the selected page into view
$(document).ready(function() {
scrollIntoView("packages-nav");
scrollIntoView("classes-nav");
});
</script>
<div class="col-12" id="doc-col">
<div id="api-info-block">
<div class="sum-details-links">
Summary:
<a href="#pubctors">Ctors</a>
| <a href="#pubmethods">Methods</a>
| <a href="#inhmethods">Inherited Methods</a>
| <a href="#" onclick="return toggleAllClassInherited()" id="toggleAllClassInherited">[Expand All]</a>
</div><!-- end sum-details-links -->
<div class="api-level">
</div>
</div><!-- end api-info-block -->
<!-- ======== START OF CLASS DATA ======== -->
<div id="jd-header">
public
static
final
class
<h1 itemprop="name">Action.Builder</h1>
extends <a href="../../../../../../reference/com/google/android/gms/appindexing/Thing.Builder.html">Thing.Builder</a><br/>
</div><!-- end header -->
<div id="naMessage"></div>
<div id="jd-content" class="api apilevel-">
<table class="jd-inheritance-table">
<tr>
<td colspan="3" class="jd-inheritance-class-cell"><a href="http://developer.android.com/reference/java/lang/Object.html">java.lang.Object</a></td>
</tr>
<tr>
<td class="jd-inheritance-space"> ↳</td>
<td colspan="2" class="jd-inheritance-class-cell"><a href="../../../../../../reference/com/google/android/gms/appindexing/Thing.Builder.html">com.google.android.gms.appindexing.Thing.Builder</a></td>
</tr>
<tr>
<td class="jd-inheritance-space"> </td>
<td class="jd-inheritance-space"> ↳</td>
<td colspan="1" class="jd-inheritance-class-cell">com.google.android.gms.appindexing.Action.Builder</td>
</tr>
</table>
<div class="jd-descr">
<h2>Class Overview</h2>
<p itemprop="articleBody">Create a builder for an <code><a href="../../../../../../reference/com/google/android/gms/appindexing/Action.html">Action</a></code>.
</p>
</div><!-- jd-descr -->
<div class="jd-descr">
<h2>Summary</h2>
<!-- ======== CONSTRUCTOR SUMMARY ======== -->
<table id="pubctors" class="jd-sumtable"><tr><th colspan="12">Public Constructors</th></tr>
<tr class="alt-color api apilevel-" >
<td class="jd-typecol"><nobr>
</nobr>
</td>
<td class="jd-linkcol" width="100%"><nobr>
<span class="sympad"><a href="../../../../../../reference/com/google/android/gms/appindexing/Action.Builder.html#Action.Builder(java.lang.String)">Action.Builder</a></span>(<a href="http://developer.android.com/reference/java/lang/String.html">String</a> actionType)</nobr>
</td></tr>
</table>
<!-- ========== METHOD SUMMARY =========== -->
<table id="pubmethods" class="jd-sumtable"><tr><th colspan="12">Public Methods</th></tr>
<tr class="alt-color api apilevel-" >
<td class="jd-typecol"><nobr>
<a href="../../../../../../reference/com/google/android/gms/appindexing/Action.html">Action</a></nobr>
</td>
<td class="jd-linkcol" width="100%"><nobr>
<span class="sympad"><a href="../../../../../../reference/com/google/android/gms/appindexing/Action.Builder.html#build()">build</a></span>()</nobr>
<div class="jd-descrdiv">
Build the <code><a href="../../../../../../reference/com/google/android/gms/appindexing/Action.html">Action</a></code> object.
</div>
</td></tr>
<tr class=" api apilevel-" >
<td class="jd-typecol"><nobr>
<a href="../../../../../../reference/com/google/android/gms/appindexing/Action.Builder.html">Action.Builder</a></nobr>
</td>
<td class="jd-linkcol" width="100%"><nobr>
<span class="sympad"><a href="../../../../../../reference/com/google/android/gms/appindexing/Action.Builder.html#put(java.lang.String, com.google.android.gms.appindexing.Thing)">put</a></span>(<a href="http://developer.android.com/reference/java/lang/String.html">String</a> key, <a href="../../../../../../reference/com/google/android/gms/appindexing/Thing.html">Thing</a> value)</nobr>
<div class="jd-descrdiv">
Sets a property of the action.
</div>
</td></tr>
<tr class="alt-color api apilevel-" >
<td class="jd-typecol"><nobr>
<a href="../../../../../../reference/com/google/android/gms/appindexing/Action.Builder.html">Action.Builder</a></nobr>
</td>
<td class="jd-linkcol" width="100%"><nobr>
<span class="sympad"><a href="../../../../../../reference/com/google/android/gms/appindexing/Action.Builder.html#put(java.lang.String, java.lang.String)">put</a></span>(<a href="http://developer.android.com/reference/java/lang/String.html">String</a> key, <a href="http://developer.android.com/reference/java/lang/String.html">String</a> value)</nobr>
<div class="jd-descrdiv">
Sets a property of the action.
</div>
</td></tr>
<tr class=" api apilevel-" >
<td class="jd-typecol"><nobr>
<a href="../../../../../../reference/com/google/android/gms/appindexing/Action.Builder.html">Action.Builder</a></nobr>
</td>
<td class="jd-linkcol" width="100%"><nobr>
<span class="sympad"><a href="../../../../../../reference/com/google/android/gms/appindexing/Action.Builder.html#setActionStatus(java.lang.String)">setActionStatus</a></span>(<a href="http://developer.android.com/reference/java/lang/String.html">String</a> actionStatusType)</nobr>
<div class="jd-descrdiv">
Specify the status of the action.
</div>
</td></tr>
<tr class="alt-color api apilevel-" >
<td class="jd-typecol"><nobr>
<a href="../../../../../../reference/com/google/android/gms/appindexing/Action.Builder.html">Action.Builder</a></nobr>
</td>
<td class="jd-linkcol" width="100%"><nobr>
<span class="sympad"><a href="../../../../../../reference/com/google/android/gms/appindexing/Action.Builder.html#setName(java.lang.String)">setName</a></span>(<a href="http://developer.android.com/reference/java/lang/String.html">String</a> name)</nobr>
<div class="jd-descrdiv">
Sets the name of the action.
</div>
</td></tr>
<tr class=" api apilevel-" >
<td class="jd-typecol"><nobr>
<a href="../../../../../../reference/com/google/android/gms/appindexing/Action.Builder.html">Action.Builder</a></nobr>
</td>
<td class="jd-linkcol" width="100%"><nobr>
<span class="sympad"><a href="../../../../../../reference/com/google/android/gms/appindexing/Action.Builder.html#setObject(com.google.android.gms.appindexing.Thing)">setObject</a></span>(<a href="../../../../../../reference/com/google/android/gms/appindexing/Thing.html">Thing</a> thing)</nobr>
<div class="jd-descrdiv">
Sets the object of the action.
</div>
</td></tr>
<tr class="alt-color api apilevel-" >
<td class="jd-typecol"><nobr>
<a href="../../../../../../reference/com/google/android/gms/appindexing/Action.Builder.html">Action.Builder</a></nobr>
</td>
<td class="jd-linkcol" width="100%"><nobr>
<span class="sympad"><a href="../../../../../../reference/com/google/android/gms/appindexing/Action.Builder.html#setUrl(android.net.Uri)">setUrl</a></span>(<a href="http://developer.android.com/reference/android/net/Uri.html">Uri</a> url)</nobr>
<div class="jd-descrdiv">
Sets the app URI of the action.
</div>
</td></tr>
</table>
<!-- ========== METHOD SUMMARY =========== -->
<table id="inhmethods" class="jd-sumtable"><tr><th>
<a href="#" class="toggle-all" onclick="return toggleAllInherited(this, null)">[Expand]</a>
<div style="clear:left;">Inherited Methods</div></th></tr>
<tr class="api apilevel-" >
<td colspan="12">
<a href="#" onclick="return toggleInherited(this, null)" id="inherited-methods-com.google.android.gms.appindexing.Thing.Builder" class="jd-expando-trigger closed"
><img id="inherited-methods-com.google.android.gms.appindexing.Thing.Builder-trigger"
src="../../../../../../assets/images/triangle-closed.png"
class="jd-expando-trigger-img" /></a>
From class
<a href="../../../../../../reference/com/google/android/gms/appindexing/Thing.Builder.html">com.google.android.gms.appindexing.Thing.Builder</a>
<div id="inherited-methods-com.google.android.gms.appindexing.Thing.Builder">
<div id="inherited-methods-com.google.android.gms.appindexing.Thing.Builder-list"
class="jd-inheritedlinks">
</div>
<div id="inherited-methods-com.google.android.gms.appindexing.Thing.Builder-summary" style="display: none;">
<table class="jd-sumtable-expando">
<tr class="alt-color api apilevel-" >
<td class="jd-typecol"><nobr>
<a href="../../../../../../reference/com/google/android/gms/appindexing/Thing.html">Thing</a></nobr>
</td>
<td class="jd-linkcol" width="100%"><nobr>
<span class="sympad"><a href="../../../../../../reference/com/google/android/gms/appindexing/Thing.Builder.html#build()">build</a></span>()</nobr>
<div class="jd-descrdiv">
Build the <code><a href="../../../../../../reference/com/google/android/gms/appindexing/Thing.html">Thing</a></code> object.
</div>
</td></tr>
<tr class=" api apilevel-" >
<td class="jd-typecol"><nobr>
<a href="../../../../../../reference/com/google/android/gms/appindexing/Thing.Builder.html">Thing.Builder</a></nobr>
</td>
<td class="jd-linkcol" width="100%"><nobr>
<span class="sympad"><a href="../../../../../../reference/com/google/android/gms/appindexing/Thing.Builder.html#put(java.lang.String, com.google.android.gms.appindexing.Thing)">put</a></span>(<a href="http://developer.android.com/reference/java/lang/String.html">String</a> key, <a href="../../../../../../reference/com/google/android/gms/appindexing/Thing.html">Thing</a> value)</nobr>
<div class="jd-descrdiv">
Sets a property of the content.
</div>
</td></tr>
<tr class="alt-color api apilevel-" >
<td class="jd-typecol"><nobr>
<a href="../../../../../../reference/com/google/android/gms/appindexing/Thing.Builder.html">Thing.Builder</a></nobr>
</td>
<td class="jd-linkcol" width="100%"><nobr>
<span class="sympad"><a href="../../../../../../reference/com/google/android/gms/appindexing/Thing.Builder.html#put(java.lang.String, java.lang.String)">put</a></span>(<a href="http://developer.android.com/reference/java/lang/String.html">String</a> key, <a href="http://developer.android.com/reference/java/lang/String.html">String</a> value)</nobr>
<div class="jd-descrdiv">
Sets a property of the content.
</div>
</td></tr>
<tr class=" api apilevel-" >
<td class="jd-typecol"><nobr>
<a href="../../../../../../reference/com/google/android/gms/appindexing/Thing.Builder.html">Thing.Builder</a></nobr>
</td>
<td class="jd-linkcol" width="100%"><nobr>
<span class="sympad"><a href="../../../../../../reference/com/google/android/gms/appindexing/Thing.Builder.html#setDescription(java.lang.String)">setDescription</a></span>(<a href="http://developer.android.com/reference/java/lang/String.html">String</a> description)</nobr>
<div class="jd-descrdiv">
Sets the optional description of the content.
</div>
</td></tr>
<tr class="alt-color api apilevel-" >
<td class="jd-typecol"><nobr>
<a href="../../../../../../reference/com/google/android/gms/appindexing/Thing.Builder.html">Thing.Builder</a></nobr>
</td>
<td class="jd-linkcol" width="100%"><nobr>
<span class="sympad"><a href="../../../../../../reference/com/google/android/gms/appindexing/Thing.Builder.html#setId(java.lang.String)">setId</a></span>(<a href="http://developer.android.com/reference/java/lang/String.html">String</a> id)</nobr>
<div class="jd-descrdiv">
Sets the optional web URL of the content.
</div>
</td></tr>
<tr class=" api apilevel-" >
<td class="jd-typecol"><nobr>
<a href="../../../../../../reference/com/google/android/gms/appindexing/Thing.Builder.html">Thing.Builder</a></nobr>
</td>
<td class="jd-linkcol" width="100%"><nobr>
<span class="sympad"><a href="../../../../../../reference/com/google/android/gms/appindexing/Thing.Builder.html#setName(java.lang.String)">setName</a></span>(<a href="http://developer.android.com/reference/java/lang/String.html">String</a> name)</nobr>
<div class="jd-descrdiv">
Sets the name of the content.
</div>
</td></tr>
<tr class="alt-color api apilevel-" >
<td class="jd-typecol"><nobr>
<a href="../../../../../../reference/com/google/android/gms/appindexing/Thing.Builder.html">Thing.Builder</a></nobr>
</td>
<td class="jd-linkcol" width="100%"><nobr>
<span class="sympad"><a href="../../../../../../reference/com/google/android/gms/appindexing/Thing.Builder.html#setType(java.lang.String)">setType</a></span>(<a href="http://developer.android.com/reference/java/lang/String.html">String</a> type)</nobr>
<div class="jd-descrdiv">
Sets the schema.org type of the content.
</div>
</td></tr>
<tr class=" api apilevel-" >
<td class="jd-typecol"><nobr>
<a href="../../../../../../reference/com/google/android/gms/appindexing/Thing.Builder.html">Thing.Builder</a></nobr>
</td>
<td class="jd-linkcol" width="100%"><nobr>
<span class="sympad"><a href="../../../../../../reference/com/google/android/gms/appindexing/Thing.Builder.html#setUrl(android.net.Uri)">setUrl</a></span>(<a href="http://developer.android.com/reference/android/net/Uri.html">Uri</a> url)</nobr>
<div class="jd-descrdiv">
Sets the app URI of the content.
</div>
</td></tr>
</table>
</div>
</div>
</td></tr>
<tr class="api apilevel-" >
<td colspan="12">
<a href="#" onclick="return toggleInherited(this, null)" id="inherited-methods-java.lang.Object" class="jd-expando-trigger closed"
><img id="inherited-methods-java.lang.Object-trigger"
src="../../../../../../assets/images/triangle-closed.png"
class="jd-expando-trigger-img" /></a>
From class
<a href="http://developer.android.com/reference/java/lang/Object.html">java.lang.Object</a>
<div id="inherited-methods-java.lang.Object">
<div id="inherited-methods-java.lang.Object-list"
class="jd-inheritedlinks">
</div>
<div id="inherited-methods-java.lang.Object-summary" style="display: none;">
<table class="jd-sumtable-expando">
<tr class="alt-color api apilevel-" >
<td class="jd-typecol"><nobr>
<a href="http://developer.android.com/reference/java/lang/Object.html">Object</a></nobr>
</td>
<td class="jd-linkcol" width="100%"><nobr>
<span class="sympad">clone</span>()</nobr>
</td></tr>
<tr class=" api apilevel-" >
<td class="jd-typecol"><nobr>
boolean</nobr>
</td>
<td class="jd-linkcol" width="100%"><nobr>
<span class="sympad">equals</span>(<a href="http://developer.android.com/reference/java/lang/Object.html">Object</a> arg0)</nobr>
</td></tr>
<tr class="alt-color api apilevel-" >
<td class="jd-typecol"><nobr>
void</nobr>
</td>
<td class="jd-linkcol" width="100%"><nobr>
<span class="sympad">finalize</span>()</nobr>
</td></tr>
<tr class=" api apilevel-" >
<td class="jd-typecol"><nobr>
final
<a href="http://developer.android.com/reference/java/lang/Class.html">Class</a><?></nobr>
</td>
<td class="jd-linkcol" width="100%"><nobr>
<span class="sympad">getClass</span>()</nobr>
</td></tr>
<tr class="alt-color api apilevel-" >
<td class="jd-typecol"><nobr>
int</nobr>
</td>
<td class="jd-linkcol" width="100%"><nobr>
<span class="sympad">hashCode</span>()</nobr>
</td></tr>
<tr class=" api apilevel-" >
<td class="jd-typecol"><nobr>
final
void</nobr>
</td>
<td class="jd-linkcol" width="100%"><nobr>
<span class="sympad">notify</span>()</nobr>
</td></tr>
<tr class="alt-color api apilevel-" >
<td class="jd-typecol"><nobr>
final
void</nobr>
</td>
<td class="jd-linkcol" width="100%"><nobr>
<span class="sympad">notifyAll</span>()</nobr>
</td></tr>
<tr class=" api apilevel-" >
<td class="jd-typecol"><nobr>
<a href="http://developer.android.com/reference/java/lang/String.html">String</a></nobr>
</td>
<td class="jd-linkcol" width="100%"><nobr>
<span class="sympad">toString</span>()</nobr>
</td></tr>
<tr class="alt-color api apilevel-" >
<td class="jd-typecol"><nobr>
final
void</nobr>
</td>
<td class="jd-linkcol" width="100%"><nobr>
<span class="sympad">wait</span>()</nobr>
</td></tr>
<tr class=" api apilevel-" >
<td class="jd-typecol"><nobr>
final
void</nobr>
</td>
<td class="jd-linkcol" width="100%"><nobr>
<span class="sympad">wait</span>(long arg0, int arg1)</nobr>
</td></tr>
<tr class="alt-color api apilevel-" >
<td class="jd-typecol"><nobr>
final
void</nobr>
</td>
<td class="jd-linkcol" width="100%"><nobr>
<span class="sympad">wait</span>(long arg0)</nobr>
</td></tr>
</table>
</div>
</div>
</td></tr>
</table>
</div><!-- jd-descr (summary) -->
<!-- Details -->
<!-- XML Attributes -->
<!-- Enum Values -->
<!-- Constants -->
<!-- Fields -->
<!-- Public ctors -->
<!-- ========= CONSTRUCTOR DETAIL ======== -->
<h2>Public Constructors</h2>
<A NAME="Action.Builder(java.lang.String)"></A>
<div class="jd-details api apilevel-">
<h4 class="jd-details-title">
<span class="normal">
public
</span>
<span class="sympad">Action.Builder</span>
<span class="normal">(<a href="http://developer.android.com/reference/java/lang/String.html">String</a> actionType)</span>
</h4>
<div class="api-level">
<div></div>
</div>
<div class="jd-details-descr">
<div class="jd-tagdata jd-tagdescr"><p></p></div>
</div>
</div>
<!-- ========= CONSTRUCTOR DETAIL ======== -->
<!-- Protected ctors -->
<!-- ========= METHOD DETAIL ======== -->
<!-- Public methdos -->
<h2>Public Methods</h2>
<A NAME="build()"></A>
<div class="jd-details api apilevel-">
<h4 class="jd-details-title">
<span class="normal">
public
<a href="../../../../../../reference/com/google/android/gms/appindexing/Action.html">Action</a>
</span>
<span class="sympad">build</span>
<span class="normal">()</span>
</h4>
<div class="api-level">
<div></div>
</div>
<div class="jd-details-descr">
<div class="jd-tagdata jd-tagdescr"><p>Build the <code><a href="../../../../../../reference/com/google/android/gms/appindexing/Action.html">Action</a></code> object.
</p></div>
</div>
</div>
<A NAME="put(java.lang.String, com.google.android.gms.appindexing.Thing)"></A>
<div class="jd-details api apilevel-">
<h4 class="jd-details-title">
<span class="normal">
public
<a href="../../../../../../reference/com/google/android/gms/appindexing/Action.Builder.html">Action.Builder</a>
</span>
<span class="sympad">put</span>
<span class="normal">(<a href="http://developer.android.com/reference/java/lang/String.html">String</a> key, <a href="../../../../../../reference/com/google/android/gms/appindexing/Thing.html">Thing</a> value)</span>
</h4>
<div class="api-level">
<div></div>
</div>
<div class="jd-details-descr">
<div class="jd-tagdata jd-tagdescr"><p>Sets a property of the action.</p></div>
<div class="jd-tagdata">
<h5 class="jd-tagtitle">Parameters</h5>
<table class="jd-tagtable">
<tr>
<th>key</td>
<td>The schema.org property. Must not be null.</td>
</tr>
<tr>
<th>value</td>
<td>The value of the schema.org property represented as a <code><a href="../../../../../../reference/com/google/android/gms/appindexing/Thing.html">Thing</a></code>.
If null, the value will be ignored.
</td>
</tr>
</table>
</div>
</div>
</div>
<A NAME="put(java.lang.String, java.lang.String)"></A>
<div class="jd-details api apilevel-">
<h4 class="jd-details-title">
<span class="normal">
public
<a href="../../../../../../reference/com/google/android/gms/appindexing/Action.Builder.html">Action.Builder</a>
</span>
<span class="sympad">put</span>
<span class="normal">(<a href="http://developer.android.com/reference/java/lang/String.html">String</a> key, <a href="http://developer.android.com/reference/java/lang/String.html">String</a> value)</span>
</h4>
<div class="api-level">
<div></div>
</div>
<div class="jd-details-descr">
<div class="jd-tagdata jd-tagdescr"><p>Sets a property of the action.</p></div>
<div class="jd-tagdata">
<h5 class="jd-tagtitle">Parameters</h5>
<table class="jd-tagtable">
<tr>
<th>key</td>
<td>The schema.org property. Must not be null.</td>
</tr>
<tr>
<th>value</td>
<td>The value of the schema.org property.
If null, the value will be ignored.
</td>
</tr>
</table>
</div>
</div>
</div>
<A NAME="setActionStatus(java.lang.String)"></A>
<div class="jd-details api apilevel-">
<h4 class="jd-details-title">
<span class="normal">
public
<a href="../../../../../../reference/com/google/android/gms/appindexing/Action.Builder.html">Action.Builder</a>
</span>
<span class="sympad">setActionStatus</span>
<span class="normal">(<a href="http://developer.android.com/reference/java/lang/String.html">String</a> actionStatusType)</span>
</h4>
<div class="api-level">
<div></div>
</div>
<div class="jd-details-descr">
<div class="jd-tagdata jd-tagdescr"><p>Specify the status of the action.
</p></div>
</div>
</div>
<A NAME="setName(java.lang.String)"></A>
<div class="jd-details api apilevel-">
<h4 class="jd-details-title">
<span class="normal">
public
<a href="../../../../../../reference/com/google/android/gms/appindexing/Action.Builder.html">Action.Builder</a>
</span>
<span class="sympad">setName</span>
<span class="normal">(<a href="http://developer.android.com/reference/java/lang/String.html">String</a> name)</span>
</h4>
<div class="api-level">
<div></div>
</div>
<div class="jd-details-descr">
<div class="jd-tagdata jd-tagdescr"><p>Sets the name of the action.</p></div>
<div class="jd-tagdata">
<h5 class="jd-tagtitle">Parameters</h5>
<table class="jd-tagtable">
<tr>
<th>name</td>
<td>The name of the action.
</td>
</tr>
</table>
</div>
</div>
</div>
<A NAME="setObject(com.google.android.gms.appindexing.Thing)"></A>
<div class="jd-details api apilevel-">
<h4 class="jd-details-title">
<span class="normal">
public
<a href="../../../../../../reference/com/google/android/gms/appindexing/Action.Builder.html">Action.Builder</a>
</span>
<span class="sympad">setObject</span>
<span class="normal">(<a href="../../../../../../reference/com/google/android/gms/appindexing/Thing.html">Thing</a> thing)</span>
</h4>
<div class="api-level">
<div></div>
</div>
<div class="jd-details-descr">
<div class="jd-tagdata jd-tagdescr"><p>Sets the object of the action.</p></div>
<div class="jd-tagdata">
<h5 class="jd-tagtitle">Parameters</h5>
<table class="jd-tagtable">
<tr>
<th>thing</td>
<td>The object of the action. Must not be null.
</td>
</tr>
</table>
</div>
</div>
</div>
<A NAME="setUrl(android.net.Uri)"></A>
<div class="jd-details api apilevel-">
<h4 class="jd-details-title">
<span class="normal">
public
<a href="../../../../../../reference/com/google/android/gms/appindexing/Action.Builder.html">Action.Builder</a>
</span>
<span class="sympad">setUrl</span>
<span class="normal">(<a href="http://developer.android.com/reference/android/net/Uri.html">Uri</a> url)</span>
</h4>
<div class="api-level">
<div></div>
</div>
<div class="jd-details-descr">
<div class="jd-tagdata jd-tagdescr"><p>Sets the app URI of the action.</p></div>
<div class="jd-tagdata">
<h5 class="jd-tagtitle">Parameters</h5>
<table class="jd-tagtable">
<tr>
<th>url</td>
<td>The app URI of the action in the
<a href="https://developers.google.com/app-indexing/">App Indexing</a> format.
</td>
</tr>
</table>
</div>
</div>
</div>
<!-- ========= METHOD DETAIL ======== -->
<!-- ========= END OF CLASS DATA ========= -->
<A NAME="navbar_top"></A>
<div id="footer" class="wrap" >
<div id="copyright">
Except as noted, this content is licensed under <a
href="http://www.apache.org/licenses/LICENSE-2.0">Apache 2.0</a>.
For details and restrictions, see the <a href="../../../../../../license.html">
Content License</a>.
</div>
<div id="build_info">
Android GmsCore 1784785 r —
<script src="../../../../../../timestamp.js" type="text/javascript"></script>
<script>document.write(BUILD_TIMESTAMP)</script>
</div>
<div id="footerlinks">
<p>
<a href="../../../../../../about/index.html">About Android</a> |
<a href="../../../../../../legal.html">Legal</a> |
<a href="../../../../../../support.html">Support</a>
</p>
</div>
</div> <!-- end footer -->
</div> <!-- jd-content -->
</div><!-- end doc-content -->
</div> <!-- end body-content -->
</body>
</html>
| {
"content_hash": "d7a9bdd5d227b29d40b8bf54d1308e3b",
"timestamp": "",
"source": "github",
"line_count": 1933,
"max_line_length": 395,
"avg_line_length": 30.323848939472324,
"alnum_prop": 0.5361846594786407,
"repo_name": "CMPUT301W15T05/TrackerExpress",
"id": "958147a4eea5a52d48023b016d96607232fe5056",
"size": "59045",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "google-play-services_lib/docs/reference/com/google/android/gms/appindexing/Action.Builder.html",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "248814"
},
{
"name": "HTML",
"bytes": "44729034"
},
{
"name": "Java",
"bytes": "313720"
},
{
"name": "JavaScript",
"bytes": "608845"
}
],
"symlink_target": ""
} |
from pydevd_constants import * #@UnusedWildImport
try:
import cStringIO as StringIO #may not always be available @UnusedImport
except:
try:
import StringIO #@Reimport
except:
import io as StringIO
if USE_LIB_COPY:
import _pydev_threading as threading
else:
import threading
import sys #@Reimport
import traceback
class TracingFunctionHolder:
'''This class exists just to keep some variables (so that we don't keep them in the global namespace).
'''
_original_tracing = None
_warn = True
_lock = threading.Lock()
_traceback_limit = 1
_warnings_shown = {}
def GetExceptionTracebackStr():
exc_info = sys.exc_info()
s = StringIO.StringIO()
traceback.print_exception(exc_info[0], exc_info[1], exc_info[2], file=s)
return s.getvalue()
def _GetStackStr(frame):
msg = '\nIf this is needed, please check: ' + \
'\nhttp://pydev.blogspot.com/2007/06/why-cant-pydev-debugger-work-with.html' + \
'\nto see how to restore the debug tracing back correctly.\n'
if TracingFunctionHolder._traceback_limit:
s = StringIO.StringIO()
s.write('Call Location:\n')
traceback.print_stack(f=frame, limit=TracingFunctionHolder._traceback_limit, file=s)
msg = msg + s.getvalue()
return msg
def _InternalSetTrace(tracing_func):
if TracingFunctionHolder._warn:
frame = GetFrame()
if frame is not None and frame.f_back is not None:
if not frame.f_back.f_code.co_filename.lower().endswith('threading.py'):
message = \
'\nPYDEV DEBUGGER WARNING:' + \
'\nsys.settrace() should not be used when the debugger is being used.' + \
'\nThis may cause the debugger to stop working correctly.' + \
'%s' % _GetStackStr(frame.f_back)
if message not in TracingFunctionHolder._warnings_shown:
#only warn about each message once...
TracingFunctionHolder._warnings_shown[message] = 1
sys.stderr.write('%s\n' % (message,))
sys.stderr.flush()
if TracingFunctionHolder._original_tracing:
TracingFunctionHolder._original_tracing(tracing_func)
def SetTrace(tracing_func):
TracingFunctionHolder._lock.acquire()
try:
TracingFunctionHolder._warn = False
_InternalSetTrace(tracing_func)
TracingFunctionHolder._warn = True
finally:
TracingFunctionHolder._lock.release()
def ReplaceSysSetTraceFunc():
if TracingFunctionHolder._original_tracing is None:
TracingFunctionHolder._original_tracing = sys.settrace
sys.settrace = _InternalSetTrace
def RestoreSysSetTraceFunc():
if TracingFunctionHolder._original_tracing is not None:
sys.settrace = TracingFunctionHolder._original_tracing
TracingFunctionHolder._original_tracing = None
| {
"content_hash": "3f3b579c0fe5da432abbbfca146d0251",
"timestamp": "",
"source": "github",
"line_count": 90,
"max_line_length": 107,
"avg_line_length": 33.41111111111111,
"alnum_prop": 0.6361822414366478,
"repo_name": "akiokio/centralfitestoque",
"id": "7c197efc2002cc9f74b385d90e0d981c36766701",
"size": "3007",
"binary": false,
"copies": "3",
"ref": "refs/heads/master",
"path": "src/.pycharm_helpers/pydev/pydevd_tracing.py",
"mode": "33188",
"license": "bsd-2-clause",
"language": [
{
"name": "CSS",
"bytes": "253279"
},
{
"name": "JavaScript",
"bytes": "253299"
},
{
"name": "Python",
"bytes": "6144500"
},
{
"name": "Ruby",
"bytes": "168219"
},
{
"name": "Shell",
"bytes": "21"
}
],
"symlink_target": ""
} |
/*
* Segment definitions
*
* 2017 - VVS
*/
/**
* Segment
*
* A Segment is a line that connects two Point the start and the end points
* A Segment can be connected to another segment in which the end of one is the start of the other
* A connected Segment is never closed
* A closed Segment is deleted
*
* @author Vaz da Silva
*
*/
public class Segment {
Point start;
Point end;
/**
* Segment
*
* Create a Segment with @param p as the start Point
*
* @param p
*/
public Segment(Point p){start = new Point(p);}
/**
* setEnd
*
* Set segment's end as @param p Point
*
* @param p
*/
public void setEnd(Point p){end = new Point(p);}
/**
* isPlateau
*
* Return if connected segment @param a , @param b has the same pixel intensity
* on the selected @param canal channel.
*
* @param a
* @param b
* @param canal
* @return
*/
public static boolean isPlateau(Segment a, Segment b, int canal) {
return a.start.pixel.getCanal(canal) == a.end.pixel.getCanal(canal)
&& a.start.pixel.getCanal(canal) == b.start.pixel.getCanal(canal)
&& b.start.pixel.getCanal(canal) == b.end.pixel.getCanal(canal);
}
/**
* isHill
*
* Return if connected segment @param a , @param b are joined by a higher intensity pixel
* on the selected @param canal channel.
*
* @param a
* @param b
* @param canal
* @return
*/
public static boolean isHill(Segment a, Segment b, int canal) {
return a.start.pixel.getCanal(canal) < a.end.pixel.getCanal(canal)
&& b.start.pixel.getCanal(canal) > b.end.pixel.getCanal(canal);
}
/**
* isValley
*
* Return if connected segment @param a , @param b are joined by a less intensity pixel
* on the selected @param canal channel.
*
* @param a
* @param b
* @param canal
* @return
*/
public static boolean isValley(Segment a, Segment b, int canal) {
return a.start.pixel.getCanal(canal) > a.end.pixel.getCanal(canal)
&& b.start.pixel.getCanal(canal) < b.end.pixel.getCanal(canal);
}
/**
* hillHigherThan
*
* True if connected segments @param a, @param b form a Hill on channel @param canal
* and the Hill relative intensity is above @param val
*
* @param a
* @param b
* @param canal
* @param val
* @return
*/
public static boolean hillHigherThan(Segment a, Segment b, int canal, double val){
return (isHill(a,b,canal) && hillHeight(a,b,canal)>=val);
}
/**
* valleyDeeperThan
*
* True if connected segments @param a, @param b form a Valley on channel @param canal
* and the Valley relative intensity is above @param val
*
* @param a
* @param b
* @param canal
* @param val
* @return
*/
public static boolean valleyDeeperThan(Segment a, Segment b, int canal, double val){
return (isValley(a,b,canal) && valleyDepth(a,b,canal)>=val);
}
/**
* distance
*
* Geometric distance between connected segments @param , @param b end points
*
* @param a
* @param b
* @return
*/
public static double distance(Segment a, Segment b) {
return b.end.dist - a.start.dist;
}
/**
* hillHeight
*
* Assuming that @param a and @param b forms a hill, this function returns the height
* of its highest slope according to @param canal channel values
*
* @param a
* @param b
* @param canal
* @return
*/
public static double hillHeight(Segment a, Segment b, int canal) {
double subida = a.end.pixel.getCanal(canal) - a.start.pixel.getCanal(canal);
double descida = b.start.pixel.getCanal(canal) - b.end.pixel.getCanal(canal);
return Math.max(Math.abs(subida),Math.abs(descida));
}
/**
* valleyDepth
*
* Assuming that @param a and @param b forms a valley, this function returns the height
* of its deepest slope according to @param canal channel values
*
* @param a
* @param b
* @param canal
* @return
*/
public static double valleyDepth(Segment a, Segment b, int canal) {
double subida = b.end.pixel.getCanal(canal) - b.start.pixel.getCanal(canal);
double descida =a.start.pixel.getCanal(canal) - a.end.pixel.getCanal(canal);
return Math.max(Math.abs(subida),Math.abs(descida));
}
/**
* Show distance and value of the start and end Point
*/
public String toString(){
return start.dist+":"+start.y+"-"+end.dist+":"+end.y;
}
}
| {
"content_hash": "80d60926de9ac9c67ba8d70a0878e37d",
"timestamp": "",
"source": "github",
"line_count": 174,
"max_line_length": 98,
"avg_line_length": 25.54597701149425,
"alnum_prop": 0.6346456692913386,
"repo_name": "tektonia/otoring",
"id": "bd53d647fd1dc7766459f244e2d43da90cf636df",
"size": "4445",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/Segment.java",
"mode": "33188",
"license": "bsd-2-clause",
"language": [
{
"name": "Java",
"bytes": "44047"
}
],
"symlink_target": ""
} |
package com.jayway.jsonpath.internal.path;
public interface PathTokenAppender {
PathTokenAppender appendPathToken(PathToken next);
}
| {
"content_hash": "0f89be90e67446bd0ca99c0285af70a1",
"timestamp": "",
"source": "github",
"line_count": 5,
"max_line_length": 54,
"avg_line_length": 27.6,
"alnum_prop": 0.8188405797101449,
"repo_name": "zline/JsonPath",
"id": "c5b7a68ed7668609dc946b0e25589b7026029a5e",
"size": "138",
"binary": false,
"copies": "6",
"ref": "refs/heads/master",
"path": "json-path/src/main/java/com/jayway/jsonpath/internal/path/PathTokenAppender.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Groovy",
"bytes": "6380"
},
{
"name": "HTML",
"bytes": "15940"
},
{
"name": "Java",
"bytes": "631989"
},
{
"name": "JavaScript",
"bytes": "3809"
}
],
"symlink_target": ""
} |
/* $FreeBSD$ */
/* $NetBSD: citrus_hash.c,v 1.3 2008/02/09 14:56:20 junyoung Exp $ */
/*-
* Copyright (c)2003 Citrus Project,
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
#include <sys/cdefs.h>
#include <sys/types.h>
#include <assert.h>
#include <stdio.h>
#include <string.h>
#include "citrus_namespace.h"
#include "citrus_types.h"
#include "citrus_region.h"
#include "citrus_hash.h"
#include "citrus_db_hash.h"
int
_citrus_string_hash_func(const char *key, int hashsize)
{
struct _region r;
_region_init(&r, __DECONST(void *, key), strlen(key));
return ((int)(_db_hash_std(&r) % (uint32_t)hashsize));
}
| {
"content_hash": "7dc158eb9cd0541f690d36d7ca440b1e",
"timestamp": "",
"source": "github",
"line_count": 51,
"max_line_length": 77,
"avg_line_length": 36.96078431372549,
"alnum_prop": 0.736870026525199,
"repo_name": "BarrelfishOS/barrelfish",
"id": "4db1bda47305d83a56a65183136d29f1a5c5b877",
"size": "1885",
"binary": false,
"copies": "7",
"ref": "refs/heads/master",
"path": "lib/libc/iconv/citrus_hash.c",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Assembly",
"bytes": "999910"
},
{
"name": "Batchfile",
"bytes": "48598"
},
{
"name": "C",
"bytes": "85073276"
},
{
"name": "C#",
"bytes": "99843"
},
{
"name": "C++",
"bytes": "7573528"
},
{
"name": "CMake",
"bytes": "60487"
},
{
"name": "CSS",
"bytes": "1905"
},
{
"name": "DIGITAL Command Language",
"bytes": "277412"
},
{
"name": "Emacs Lisp",
"bytes": "11006"
},
{
"name": "GAP",
"bytes": "23161"
},
{
"name": "GDB",
"bytes": "5634"
},
{
"name": "Gnuplot",
"bytes": "3383"
},
{
"name": "HTML",
"bytes": "872763"
},
{
"name": "Haskell",
"bytes": "1487583"
},
{
"name": "Java",
"bytes": "1384783"
},
{
"name": "JavaScript",
"bytes": "1403"
},
{
"name": "Lex",
"bytes": "95310"
},
{
"name": "Lua",
"bytes": "232"
},
{
"name": "M4",
"bytes": "112741"
},
{
"name": "Makefile",
"bytes": "1684009"
},
{
"name": "Nix",
"bytes": "2368"
},
{
"name": "Objective-C",
"bytes": "197139"
},
{
"name": "Perl",
"bytes": "1351095"
},
{
"name": "PostScript",
"bytes": "12428691"
},
{
"name": "Prolog",
"bytes": "9660208"
},
{
"name": "Python",
"bytes": "456604"
},
{
"name": "RPC",
"bytes": "17532"
},
{
"name": "Raku",
"bytes": "3718"
},
{
"name": "Roff",
"bytes": "3319475"
},
{
"name": "Scheme",
"bytes": "4249"
},
{
"name": "Scilab",
"bytes": "5315"
},
{
"name": "Shell",
"bytes": "539982"
},
{
"name": "Tcl",
"bytes": "708289"
},
{
"name": "TeX",
"bytes": "3480734"
},
{
"name": "VBA",
"bytes": "20687"
},
{
"name": "XS",
"bytes": "4319"
},
{
"name": "Yacc",
"bytes": "253508"
},
{
"name": "eC",
"bytes": "5079"
}
],
"symlink_target": ""
} |
package org.apache.hadoop.hive.ql.udf;
import org.apache.hadoop.hive.ql.exec.UDF;
import org.apache.hadoop.hive.serde2.io.DoubleWritable;
import org.apache.hadoop.hive.serde2.io.HiveDecimalWritable;
/**
* This class can be used for math based UDFs that only have an evaluate method for {@code doubles}. By extending from
* this class these UDFs will automatically support decimals as well.
*/
public abstract class UDFMath extends UDF {
private final DoubleWritable doubleWritable = new DoubleWritable();
/**
* For subclass to implement.
*/
protected abstract DoubleWritable doEvaluate(DoubleWritable a);
/**
* Returns {@code null} if the passed in value is {@code} and passes on to {@link #doEvaluate(DoubleWritable)} if not.
*/
public final DoubleWritable evaluate(DoubleWritable a) {
if (a == null) {
return null;
}
return doEvaluate(a);
}
/**
* Convert HiveDecimal to a double and call evaluate() on it.
*/
public final DoubleWritable evaluate(HiveDecimalWritable writable) {
if (writable == null) {
return null;
}
double d = writable.doubleValue();
doubleWritable.set(d);
return doEvaluate(doubleWritable);
}
}
| {
"content_hash": "33b8023ea2d8ec12b07cefdf1207cb24",
"timestamp": "",
"source": "github",
"line_count": 46,
"max_line_length": 120,
"avg_line_length": 26.304347826086957,
"alnum_prop": 0.7049586776859504,
"repo_name": "vergilchiu/hive",
"id": "378b3d7913c7cf7bf62a63d55bb58cf9710268cc",
"size": "2016",
"binary": false,
"copies": "1",
"ref": "refs/heads/branch-2.3-htdc",
"path": "ql/src/java/org/apache/hadoop/hive/ql/udf/UDFMath.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "ANTLR",
"bytes": "54494"
},
{
"name": "Batchfile",
"bytes": "845"
},
{
"name": "C",
"bytes": "28218"
},
{
"name": "C++",
"bytes": "76808"
},
{
"name": "CSS",
"bytes": "4263"
},
{
"name": "GAP",
"bytes": "155326"
},
{
"name": "HTML",
"bytes": "50822"
},
{
"name": "Java",
"bytes": "39751326"
},
{
"name": "JavaScript",
"bytes": "25851"
},
{
"name": "M4",
"bytes": "2276"
},
{
"name": "PHP",
"bytes": "148097"
},
{
"name": "PLSQL",
"bytes": "8797"
},
{
"name": "PLpgSQL",
"bytes": "339745"
},
{
"name": "Perl",
"bytes": "319842"
},
{
"name": "PigLatin",
"bytes": "12333"
},
{
"name": "Protocol Buffer",
"bytes": "8769"
},
{
"name": "Python",
"bytes": "386664"
},
{
"name": "Roff",
"bytes": "5379"
},
{
"name": "SQLPL",
"bytes": "20290"
},
{
"name": "Shell",
"bytes": "313510"
},
{
"name": "Thrift",
"bytes": "107584"
},
{
"name": "XSLT",
"bytes": "7619"
}
],
"symlink_target": ""
} |
import IdamClient from 'idam/idamClient'
import { ServiceAuthToken } from 'idam/serviceAuthToken'
import { ServiceAuthTokenFactory } from '@hmcts/draft-store-client/dist/security/serviceAuthTokenFactory'
let token: ServiceAuthToken
export class ServiceAuthTokenFactoryImpl implements ServiceAuthTokenFactory {
async get (): Promise<ServiceAuthToken> {
if (token === undefined || token.hasExpired()) {
token = await IdamClient.retrieveServiceToken()
}
return token
}
}
| {
"content_hash": "733a4ecd81c5294f8eb25aa6666a4ae8",
"timestamp": "",
"source": "github",
"line_count": 15,
"max_line_length": 105,
"avg_line_length": 32.86666666666667,
"alnum_prop": 0.7647058823529411,
"repo_name": "hmcts/cmc-legal-rep-frontend",
"id": "8c6c4ea354acf6fb241b2ada8aec2393d83c3143",
"size": "493",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/main/common/security/serviceTokenFactoryImpl.ts",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Dockerfile",
"bytes": "909"
},
{
"name": "Groovy",
"bytes": "2124"
},
{
"name": "HCL",
"bytes": "1611"
},
{
"name": "JavaScript",
"bytes": "16357"
},
{
"name": "Nunjucks",
"bytes": "86720"
},
{
"name": "SCSS",
"bytes": "10124"
},
{
"name": "Shell",
"bytes": "4590"
},
{
"name": "TypeScript",
"bytes": "682938"
}
],
"symlink_target": ""
} |
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
class Admin_Restaurant extends CI_Controller
{
public function index()
{
if ($this->session->userdata('type') == "Admin") {
$this->load->model('Restaurantm');
$this->data['show_res_content'] = $this->Restaurantm->show_restuarant_content();
$this->load->view('admin_restaurant', $this->data);
} else {
$this->load->model('viewall');
$data['head'] = $this->viewall->show_main_content();
// print_r($data);
$data['head_res_ad_more'] = $this->viewall->home_resturant_andmore_content();
//print_r($data['head_res_ad_more']);
$data['head_how_itworks'] = $this->viewall->show_howitwork_content();
$data['head_section_4'] = $this->viewall->show_sectionfour_content();
$data['head_section_5'] = $this->viewall->show_sectionfive_content();
$data['head_section_6'] = $this->viewall->show_sectionsix_content();
$this->load->view('index', $data);
}
}
public function insert_res()
{
if ($this->session->userdata('type') == "Admin") {
$this->load->model('Restaurantm');
$this->Restaurantm->insert_restuarant_content();
redirect('Admin_Restaurant');
} else {
$this->load->model('viewall');
$data['head'] = $this->viewall->show_main_content();
// print_r($data);
$data['head_res_ad_more'] = $this->viewall->home_resturant_andmore_content();
//print_r($data['head_res_ad_more']);
$data['head_how_itworks'] = $this->viewall->show_howitwork_content();
$data['head_section_4'] = $this->viewall->show_sectionfour_content();
$data['head_section_5'] = $this->viewall->show_sectionfive_content();
$data['head_section_6'] = $this->viewall->show_sectionsix_content();
$this->load->view('index', $data);
}
}
public function edit_res($id)
{
if ($this->session->userdata('type') == "Admin") {
$this->load->model('Restaurantm');
$this->Restaurantm->edit_res($id);
redirect('Admin_Restaurant');
/*
$this->load->model('Menum');
$this->Menum->menuedit($id);
redirect(Restaurant_menu);
*/
} else {
$this->load->model('viewall');
$data['head'] = $this->viewall->show_main_content();
// print_r($data);
$data['head_res_ad_more'] = $this->viewall->home_resturant_andmore_content();
//print_r($data['head_res_ad_more']);
$data['head_how_itworks'] = $this->viewall->show_howitwork_content();
$data['head_section_4'] = $this->viewall->show_sectionfour_content();
$data['head_section_5'] = $this->viewall->show_sectionfive_content();
$data['head_section_6'] = $this->viewall->show_sectionsix_content();
$this->load->view('index', $data);
}
}
/*public function showedit()
{
if ($this->session->userdata('type') == "Admin") {
$id = $this->input->post('id');
$this->load->model('Restaurantm');
$this->data['edit'] = $this->Restaurantm->showedit($id);
// print_r($this->data['edit']);
foreach ($this->data['edit'] as $e) {
echo "<form role=\"form\" method=\"post\" action=\"http://localhost/Rak/Admin_Restaurant/edit_res/$e->res_id\" >
<div class=\"form-group\">
<label>Name</label>
<input class=\"form-control\" type=\"text\" name=\"name\" value=\" $e->name \">
</div>
<div class=\"form-group\">
<label>Type</label>
<input class=\"form-control\" type=\"text\" name=\"type\" value=\" $e->type \">
</div>
<div class=\"form-group\">
<label>Address</label>
<input class=\"form-control\" type=\"text\" name=\"address\" value=\" $e->address \">
</div>
<div class=\"form-group\">
<label>Time</label>
<input class=\"form-control\" type=\"text\" name=\"city\" value=\" $e->city \">
</div>
<div class=\"form-group\">
<label>State</label>
<input class=\"form-control\" type=\"text\" name=\"state\" value=\" $e->state \">
</div>
<div class=\"form-group\">
<label>Postal Code</label>
<input class=\"form-control\" type=\"text\" name=\"postal_code\" value=\" $e->postal_code \">
</div>
<div class=\"form-group\">
<label>Country</label>
<input class=\"form-control\" type=\"text\" name=\"country\" value=\" $e->country \">
</div>
<div class=\"form-group\">
<label>Time</label>
<input class=\"form-control\" type=\"text\" name=\"time\" value=\" $e->time \">
</div>
<div class=\"form-group\">
<label>Username</label>
<input class=\"form-control\" type=\"text\" name=\"username\" value=\" $e->username \">
</div>
<div class=\"form-group\">
<label>password</label>
<input class=\"form-control\" type=\"text\" name=\"password\" value=\" $e->password \">
</div>
<div class=\"form-group\">
<label>VAT</label>
<input class=\"form-control\" type=\"text\" name=\"vat\" value=\" $e->vat \">
</div>
<div class=\"form-group\">
<label>Status</label>
<input class=\"form-control\" type=\"text\" name=\"status\" value=\" $e->status \">
</div>
<div class=\"form - group\">
<label>Image</label>
<input class=\"form - control\" type=\"file\" name=\"res_image\" value=\" $e->Image \">
</div>
<input class=\"btn btn-success\" type=\"submit\">
</form>
";
}
}
else{
$this->load->model('viewall');
$data['head']=$this->viewall->show_main_content();
// print_r($data);
$data['head_res_ad_more']=$this->viewall->home_resturant_andmore_content();
//print_r($data['head_res_ad_more']);
$data['head_how_itworks']=$this->viewall->show_howitwork_content();
$data['head_section_4']=$this->viewall->show_sectionfour_content();
$data['head_section_5']=$this->viewall->show_sectionfive_content();
$data['head_section_6']=$this->viewall->show_sectionsix_content();
$this->load->view('index',$data);
}
}*/
public function showedit()
{
if ($this->session->userdata('type') == "Admin") {
$id = $this->input->post('id');
$rname = $this->input->post('name');
$rtype = $this->input->post('type');
$raddress = $this->input->post('address');
$rcity = $this->input->post('city');
$rstate = $this->input->post('state');
$rpostal_code = $this->input->post('postal_code');
$rcountry = $this->input->post('country');
$rtime = $this->input->post('time');
$rusername = $this->input->post('username');
$rpassword = $this->input->post('password');
$rvat = $this->input->post('vat');
$rstatus = $this->input->post('status');
$rimage= $_FILES["Photo"]["name"];
$website = $this->input->post('website');
$email = $this->input->post('email');
//print_r($rimage);
move_uploaded_file($_FILES["file"]["tmp_name"], "img/" . $rimage);
$this->load->model('Restaurantm');
$this->Restaurantm->edit_res($id,$rname,$rtype,$raddress,$rcity,$rstate,$rpostal_code,$rcountry,$rtime,$rusername,$rpassword,$rvat,$rstatus,$rimage,$website,$email);
redirect('Admin_Restaurant');
}
}
} | {
"content_hash": "237738130482544615cddd49803ad48a",
"timestamp": "",
"source": "github",
"line_count": 192,
"max_line_length": 177,
"avg_line_length": 51.0625,
"alnum_prop": 0.4186046511627907,
"repo_name": "vedlct/raks_kitchen",
"id": "11bca6b5f77a23a4bdefc9090af6582b199875a4",
"size": "9804",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "application/controllers/Admin_Restaurant.php",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "ApacheConf",
"bytes": "411"
},
{
"name": "CSS",
"bytes": "126732"
},
{
"name": "HTML",
"bytes": "8470322"
},
{
"name": "JavaScript",
"bytes": "1068808"
},
{
"name": "PHP",
"bytes": "2455556"
}
],
"symlink_target": ""
} |
ACCEPTED
#### According to
Index Fungorum
#### Published in
Karstenia 23(2): 66 (1983)
#### Original name
Stigmatomyces manicatae Huldén
### Remarks
null | {
"content_hash": "2bb830bf27015203e4285a9f6d671ff2",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 30,
"avg_line_length": 12.076923076923077,
"alnum_prop": 0.7133757961783439,
"repo_name": "mdoering/backbone",
"id": "6322273762c28fd8b6c76c082c0583722b01debc",
"size": "213",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "life/Fungi/Ascomycota/Laboulbeniomycetes/Laboulbeniales/Laboulbeniaceae/Stigmatomyces/Stigmatomyces manicatae/README.md",
"mode": "33188",
"license": "apache-2.0",
"language": [],
"symlink_target": ""
} |
package notebook.front
import scala.util.Random
import scala.xml.{NodeSeq, UnprefixedAttribute, Null}
import play.api.libs.json._
import com.vividsolutions.jts.geom.Geometry
import org.wololo.geojson.GeoJSON
import notebook._
import notebook.JsonCodec._
import notebook.front.widgets.magic
import notebook.front.widgets.magic._
import notebook.front.widgets.magic.Implicits._
import notebook.front.widgets.magic.SamplerImplicits._
/**
* This package contains primitive widgets that can be used in the child environment.
*/
package object widgets
extends Generic
with Texts
with Images
with Lists
with Layouts
with charts.Charts {
} | {
"content_hash": "fc59f87a971ee98b31b5c13dfa46a7bf",
"timestamp": "",
"source": "github",
"line_count": 25,
"max_line_length": 85,
"avg_line_length": 25.88,
"alnum_prop": 0.7990726429675425,
"repo_name": "andypetrella/spark-notebook",
"id": "275ac5e31e12255ecdbddac93174fdbd6c0c23aa",
"size": "647",
"binary": false,
"copies": "5",
"ref": "refs/heads/master",
"path": "modules/common/src/main/scala/notebook/front/widgets/package.scala",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "230120"
},
{
"name": "CoffeeScript",
"bytes": "41754"
},
{
"name": "HTML",
"bytes": "133496"
},
{
"name": "Java",
"bytes": "162"
},
{
"name": "JavaScript",
"bytes": "2767402"
},
{
"name": "Makefile",
"bytes": "1224"
},
{
"name": "Scala",
"bytes": "366614"
},
{
"name": "Shell",
"bytes": "1298"
}
],
"symlink_target": ""
} |
<?xml version="1.0" encoding="utf-8"?>
<MapData>
<Details>
<FileName>[240]M10_S01_F09.rmd</FileName>
<FileType>Red Stone Scenario File 6.0 beta</FileType>
<MapName>スウェブタワー 9F</MapName>
<SysWidth>130</SysWidth>
<SysHeight>130</SysHeight>
<TgaWidth>260</TgaWidth>
<TgaHeight>130</TgaHeight>
<MapType>1</MapType>
<isPremiumMap>0</isPremiumMap>
<isPvPMap>0</isPvPMap>
<MapView_Lv>2</MapView_Lv>
<isLocationStrage>1</isLocationStrage>
<P_SubElement1>18</P_SubElement1>
<P_SubElement2>15</P_SubElement2>
<P_SubElement3>15</P_SubElement3>
<P_SubElement4>15</P_SubElement4>
<P_SubElement5>14</P_SubElement5>
<P_SubElement6>21</P_SubElement6>
<M_AddElement1>18</M_AddElement1>
<M_AddElement2>12</M_AddElement2>
<M_AddElement3>14</M_AddElement3>
<M_AddElement4>14</M_AddElement4>
<M_AddElement5>14</M_AddElement5>
<M_AddElement6>21</M_AddElement6>
</Details>
<CharacterData>
<Character id="cUid0">
<CharacterUID>0</CharacterUID>
<CharacterName>ファントム</CharacterName>
<CharacterType>2</CharacterType>
<InternalID>2</InternalID>
<PopSpeed>18</PopSpeed>
<PopPoint_X>39.91</PopPoint_X>
<PopPoint_Y>40.19</PopPoint_Y>
</Character>
<Character id="cUid1">
<CharacterUID>1</CharacterUID>
<CharacterName>ファントム</CharacterName>
<CharacterType>2</CharacterType>
<InternalID>2</InternalID>
<PopSpeed>18</PopSpeed>
<PopPoint_X>30.28</PopPoint_X>
<PopPoint_Y>46.16</PopPoint_Y>
</Character>
<Character id="cUid2">
<CharacterUID>2</CharacterUID>
<CharacterName>骸骨狂戦士</CharacterName>
<CharacterType>2</CharacterType>
<InternalID>0</InternalID>
<PopSpeed>15</PopSpeed>
<PopPoint_X>29.50</PopPoint_X>
<PopPoint_Y>49.63</PopPoint_Y>
</Character>
<Character id="cUid3">
<CharacterUID>3</CharacterUID>
<CharacterName>骸骨狂戦士</CharacterName>
<CharacterType>2</CharacterType>
<InternalID>0</InternalID>
<PopSpeed>15</PopSpeed>
<PopPoint_X>47.03</PopPoint_X>
<PopPoint_Y>40.00</PopPoint_Y>
</Character>
<Character id="cUid4">
<CharacterUID>4</CharacterUID>
<CharacterName>骸骨狂戦士</CharacterName>
<CharacterType>2</CharacterType>
<InternalID>0</InternalID>
<PopSpeed>15</PopSpeed>
<PopPoint_X>179.16</PopPoint_X>
<PopPoint_Y>89.31</PopPoint_Y>
</Character>
<Character id="cUid5">
<CharacterUID>5</CharacterUID>
<CharacterName>骸骨狂戦士</CharacterName>
<CharacterType>2</CharacterType>
<InternalID>0</InternalID>
<PopSpeed>15</PopSpeed>
<PopPoint_X>182.78</PopPoint_X>
<PopPoint_Y>93.53</PopPoint_Y>
</Character>
<Character id="cUid6">
<CharacterUID>6</CharacterUID>
<CharacterName>ファントム</CharacterName>
<CharacterType>2</CharacterType>
<InternalID>2</InternalID>
<PopSpeed>18</PopSpeed>
<PopPoint_X>229.50</PopPoint_X>
<PopPoint_Y>64.38</PopPoint_Y>
</Character>
<Character id="cUid7">
<CharacterUID>7</CharacterUID>
<CharacterName>骸骨狂戦士</CharacterName>
<CharacterType>2</CharacterType>
<InternalID>0</InternalID>
<PopSpeed>15</PopSpeed>
<PopPoint_X>232.19</PopPoint_X>
<PopPoint_Y>68.38</PopPoint_Y>
</Character>
<Character id="cUid8">
<CharacterUID>8</CharacterUID>
<CharacterName>骸骨狂戦士</CharacterName>
<CharacterType>2</CharacterType>
<InternalID>0</InternalID>
<PopSpeed>15</PopSpeed>
<PopPoint_X>177.69</PopPoint_X>
<PopPoint_Y>37.38</PopPoint_Y>
</Character>
<Character id="cUid9">
<CharacterUID>9</CharacterUID>
<CharacterName>骸骨狂戦士</CharacterName>
<CharacterType>2</CharacterType>
<InternalID>0</InternalID>
<PopSpeed>15</PopSpeed>
<PopPoint_X>181.44</PopPoint_X>
<PopPoint_Y>41.00</PopPoint_Y>
</Character>
<Character id="cUid10">
<CharacterUID>10</CharacterUID>
<CharacterName>骸骨狂戦士</CharacterName>
<CharacterType>2</CharacterType>
<InternalID>0</InternalID>
<PopSpeed>15</PopSpeed>
<PopPoint_X>124.75</PopPoint_X>
<PopPoint_Y>17.31</PopPoint_Y>
</Character>
<Character id="cUid11">
<CharacterUID>11</CharacterUID>
<CharacterName>骸骨狂戦士</CharacterName>
<CharacterType>2</CharacterType>
<InternalID>0</InternalID>
<PopSpeed>15</PopSpeed>
<PopPoint_X>126.88</PopPoint_X>
<PopPoint_Y>13.81</PopPoint_Y>
</Character>
<Character id="cUid12">
<CharacterUID>12</CharacterUID>
<CharacterName>ファントム</CharacterName>
<CharacterType>2</CharacterType>
<InternalID>2</InternalID>
<PopSpeed>18</PopSpeed>
<PopPoint_X>135.38</PopPoint_X>
<PopPoint_Y>14.75</PopPoint_Y>
</Character>
<Character id="cUid13">
<CharacterUID>13</CharacterUID>
<CharacterName>ファントム</CharacterName>
<CharacterType>2</CharacterType>
<InternalID>2</InternalID>
<PopSpeed>18</PopSpeed>
<PopPoint_X>77.25</PopPoint_X>
<PopPoint_Y>38.50</PopPoint_Y>
</Character>
<Character id="cUid14">
<CharacterUID>14</CharacterUID>
<CharacterName>ファントム</CharacterName>
<CharacterType>2</CharacterType>
<InternalID>2</InternalID>
<PopSpeed>18</PopSpeed>
<PopPoint_X>75.50</PopPoint_X>
<PopPoint_Y>42.94</PopPoint_Y>
</Character>
<Character id="cUid15">
<CharacterUID>15</CharacterUID>
<CharacterName>骸骨狂戦士</CharacterName>
<CharacterType>2</CharacterType>
<InternalID>0</InternalID>
<PopSpeed>15</PopSpeed>
<PopPoint_X>83.44</PopPoint_X>
<PopPoint_Y>41.31</PopPoint_Y>
</Character>
<Character id="cUid16">
<CharacterUID>16</CharacterUID>
<CharacterName>骸骨狂戦士</CharacterName>
<CharacterType>2</CharacterType>
<InternalID>0</InternalID>
<PopSpeed>15</PopSpeed>
<PopPoint_X>28.81</PopPoint_X>
<PopPoint_Y>63.63</PopPoint_Y>
</Character>
<Character id="cUid17">
<CharacterUID>17</CharacterUID>
<CharacterName>骸骨狂戦士</CharacterName>
<CharacterType>2</CharacterType>
<InternalID>0</InternalID>
<PopSpeed>15</PopSpeed>
<PopPoint_X>27.50</PopPoint_X>
<PopPoint_Y>67.94</PopPoint_Y>
</Character>
<Character id="cUid18">
<CharacterUID>18</CharacterUID>
<CharacterName>骸骨狂戦士</CharacterName>
<CharacterType>2</CharacterType>
<InternalID>0</InternalID>
<PopSpeed>15</PopSpeed>
<PopPoint_X>83.69</PopPoint_X>
<PopPoint_Y>93.88</PopPoint_Y>
</Character>
<Character id="cUid19">
<CharacterUID>19</CharacterUID>
<CharacterName>ファントム</CharacterName>
<CharacterType>2</CharacterType>
<InternalID>2</InternalID>
<PopSpeed>18</PopSpeed>
<PopPoint_X>78.56</PopPoint_X>
<PopPoint_Y>90.50</PopPoint_Y>
</Character>
<Character id="cUid20">
<CharacterUID>20</CharacterUID>
<CharacterName>ファントム</CharacterName>
<CharacterType>2</CharacterType>
<InternalID>2</InternalID>
<PopSpeed>18</PopSpeed>
<PopPoint_X>126.88</PopPoint_X>
<PopPoint_Y>115.50</PopPoint_Y>
</Character>
<Character id="cUid21">
<CharacterUID>21</CharacterUID>
<CharacterName>ファントム</CharacterName>
<CharacterType>2</CharacterType>
<InternalID>2</InternalID>
<PopSpeed>18</PopSpeed>
<PopPoint_X>130.88</PopPoint_X>
<PopPoint_Y>118.44</PopPoint_Y>
</Character>
<Character id="cUid22">
<CharacterUID>22</CharacterUID>
<CharacterName>ファントム</CharacterName>
<CharacterType>2</CharacterType>
<InternalID>2</InternalID>
<PopSpeed>18</PopSpeed>
<PopPoint_X>63.94</PopPoint_X>
<PopPoint_Y>59.13</PopPoint_Y>
</Character>
<Character id="cUid23">
<CharacterUID>23</CharacterUID>
<CharacterName>ファントム</CharacterName>
<CharacterType>2</CharacterType>
<InternalID>2</InternalID>
<PopSpeed>18</PopSpeed>
<PopPoint_X>66.50</PopPoint_X>
<PopPoint_Y>62.69</PopPoint_Y>
</Character>
<Character id="cUid24">
<CharacterUID>24</CharacterUID>
<CharacterName>ファントム</CharacterName>
<CharacterType>2</CharacterType>
<InternalID>2</InternalID>
<PopSpeed>18</PopSpeed>
<PopPoint_X>78.88</PopPoint_X>
<PopPoint_Y>59.13</PopPoint_Y>
</Character>
<Character id="cUid25">
<CharacterUID>25</CharacterUID>
<CharacterName>ファントム</CharacterName>
<CharacterType>2</CharacterType>
<InternalID>2</InternalID>
<PopSpeed>18</PopSpeed>
<PopPoint_X>69.81</PopPoint_X>
<PopPoint_Y>72.94</PopPoint_Y>
</Character>
<Character id="cUid26">
<CharacterUID>26</CharacterUID>
<CharacterName>骸骨狂戦士</CharacterName>
<CharacterType>2</CharacterType>
<InternalID>0</InternalID>
<PopSpeed>15</PopSpeed>
<PopPoint_X>62.06</PopPoint_X>
<PopPoint_Y>70.94</PopPoint_Y>
</Character>
<Character id="cUid27">
<CharacterUID>27</CharacterUID>
<CharacterName>デスアックス</CharacterName>
<CharacterType>2</CharacterType>
<InternalID>1</InternalID>
<PopSpeed>18</PopSpeed>
<PopPoint_X>69.72</PopPoint_X>
<PopPoint_Y>67.03</PopPoint_Y>
</Character>
<Character id="cUid28">
<CharacterUID>28</CharacterUID>
<CharacterName>骸骨狂戦士</CharacterName>
<CharacterType>2</CharacterType>
<InternalID>0</InternalID>
<PopSpeed>15</PopSpeed>
<PopPoint_X>83.38</PopPoint_X>
<PopPoint_Y>61.56</PopPoint_Y>
</Character>
<Character id="cUid29">
<CharacterUID>29</CharacterUID>
<CharacterName>骸骨狂戦士</CharacterName>
<CharacterType>2</CharacterType>
<InternalID>0</InternalID>
<PopSpeed>15</PopSpeed>
<PopPoint_X>27.59</PopPoint_X>
<PopPoint_Y>85.53</PopPoint_Y>
</Character>
<Character id="cUid30">
<CharacterUID>30</CharacterUID>
<CharacterName>骸骨狂戦士</CharacterName>
<CharacterType>2</CharacterType>
<InternalID>0</InternalID>
<PopSpeed>15</PopSpeed>
<PopPoint_X>30.16</PopPoint_X>
<PopPoint_Y>88.63</PopPoint_Y>
</Character>
<Character id="cUid31">
<CharacterUID>31</CharacterUID>
<CharacterName>ファントム</CharacterName>
<CharacterType>2</CharacterType>
<InternalID>2</InternalID>
<PopSpeed>18</PopSpeed>
<PopPoint_X>39.28</PopPoint_X>
<PopPoint_Y>86.88</PopPoint_Y>
</Character>
<Character id="cUid32">
<CharacterUID>32</CharacterUID>
<CharacterName>ファントム</CharacterName>
<CharacterType>2</CharacterType>
<InternalID>2</InternalID>
<PopSpeed>18</PopSpeed>
<PopPoint_X>42.66</PopPoint_X>
<PopPoint_Y>90.00</PopPoint_Y>
</Character>
<Character id="cUid33">
<CharacterUID>33</CharacterUID>
<CharacterName>デスアックス</CharacterName>
<CharacterType>2</CharacterType>
<InternalID>1</InternalID>
<PopSpeed>18</PopSpeed>
<PopPoint_X>133.06</PopPoint_X>
<PopPoint_Y>31.91</PopPoint_Y>
</Character>
<Character id="cUid34">
<CharacterUID>34</CharacterUID>
<CharacterName>骸骨狂戦士</CharacterName>
<CharacterType>2</CharacterType>
<InternalID>0</InternalID>
<PopSpeed>15</PopSpeed>
<PopPoint_X>187.75</PopPoint_X>
<PopPoint_Y>59.75</PopPoint_Y>
</Character>
<Character id="cUid35">
<CharacterUID>35</CharacterUID>
<CharacterName>骸骨狂戦士</CharacterName>
<CharacterType>2</CharacterType>
<InternalID>0</InternalID>
<PopSpeed>15</PopSpeed>
<PopPoint_X>124.84</PopPoint_X>
<PopPoint_Y>33.78</PopPoint_Y>
</Character>
<Character id="cUid36">
<CharacterUID>36</CharacterUID>
<CharacterName>骸骨狂戦士</CharacterName>
<CharacterType>2</CharacterType>
<InternalID>0</InternalID>
<PopSpeed>15</PopSpeed>
<PopPoint_X>146.19</PopPoint_X>
<PopPoint_Y>40.81</PopPoint_Y>
</Character>
<Character id="cUid37">
<CharacterUID>37</CharacterUID>
<CharacterName>ファントム</CharacterName>
<CharacterType>2</CharacterType>
<InternalID>2</InternalID>
<PopSpeed>18</PopSpeed>
<PopPoint_X>137.97</PopPoint_X>
<PopPoint_Y>31.03</PopPoint_Y>
</Character>
<Character id="cUid38">
<CharacterUID>38</CharacterUID>
<CharacterName>ファントム</CharacterName>
<CharacterType>2</CharacterType>
<InternalID>2</InternalID>
<PopSpeed>18</PopSpeed>
<PopPoint_X>136.81</PopPoint_X>
<PopPoint_Y>35.00</PopPoint_Y>
</Character>
<Character id="cUid39">
<CharacterUID>39</CharacterUID>
<CharacterName>ファントム</CharacterName>
<CharacterType>2</CharacterType>
<InternalID>2</InternalID>
<PopSpeed>18</PopSpeed>
<PopPoint_X>139.84</PopPoint_X>
<PopPoint_Y>41.88</PopPoint_Y>
</Character>
<Character id="cUid40">
<CharacterUID>40</CharacterUID>
<CharacterName>ファントム</CharacterName>
<CharacterType>2</CharacterType>
<InternalID>2</InternalID>
<PopSpeed>18</PopSpeed>
<PopPoint_X>142.50</PopPoint_X>
<PopPoint_Y>46.31</PopPoint_Y>
</Character>
<Character id="cUid41">
<CharacterUID>41</CharacterUID>
<CharacterName>骸骨狂戦士</CharacterName>
<CharacterType>2</CharacterType>
<InternalID>0</InternalID>
<PopSpeed>15</PopSpeed>
<PopPoint_X>189.00</PopPoint_X>
<PopPoint_Y>69.00</PopPoint_Y>
</Character>
<Character id="cUid42">
<CharacterUID>42</CharacterUID>
<CharacterName>ファントム</CharacterName>
<CharacterType>2</CharacterType>
<InternalID>2</InternalID>
<PopSpeed>18</PopSpeed>
<PopPoint_X>179.88</PopPoint_X>
<PopPoint_Y>69.38</PopPoint_Y>
</Character>
<Character id="cUid43">
<CharacterUID>43</CharacterUID>
<CharacterName>ファントム</CharacterName>
<CharacterType>2</CharacterType>
<InternalID>2</InternalID>
<PopSpeed>18</PopSpeed>
<PopPoint_X>184.25</PopPoint_X>
<PopPoint_Y>72.19</PopPoint_Y>
</Character>
<Character id="cUid44">
<CharacterUID>44</CharacterUID>
<CharacterName>ファントム</CharacterName>
<CharacterType>2</CharacterType>
<InternalID>2</InternalID>
<PopSpeed>18</PopSpeed>
<PopPoint_X>197.13</PopPoint_X>
<PopPoint_Y>62.94</PopPoint_Y>
</Character>
<Character id="cUid45">
<CharacterUID>45</CharacterUID>
<CharacterName>骸骨狂戦士</CharacterName>
<CharacterType>2</CharacterType>
<InternalID>0</InternalID>
<PopSpeed>15</PopSpeed>
<PopPoint_X>189.81</PopPoint_X>
<PopPoint_Y>62.63</PopPoint_Y>
</Character>
<Character id="cUid46">
<CharacterUID>46</CharacterUID>
<CharacterName>デスアックス</CharacterName>
<CharacterType>2</CharacterType>
<InternalID>1</InternalID>
<PopSpeed>18</PopSpeed>
<PopPoint_X>194.75</PopPoint_X>
<PopPoint_Y>67.13</PopPoint_Y>
</Character>
<Character id="cUid47">
<CharacterUID>47</CharacterUID>
<CharacterName>デスアックス</CharacterName>
<CharacterType>2</CharacterType>
<InternalID>1</InternalID>
<PopSpeed>18</PopSpeed>
<PopPoint_X>145.03</PopPoint_X>
<PopPoint_Y>96.59</PopPoint_Y>
</Character>
<Character id="cUid48">
<CharacterUID>48</CharacterUID>
<CharacterName>骸骨狂戦士</CharacterName>
<CharacterType>2</CharacterType>
<InternalID>0</InternalID>
<PopSpeed>15</PopSpeed>
<PopPoint_X>138.53</PopPoint_X>
<PopPoint_Y>99.59</PopPoint_Y>
</Character>
<Character id="cUid49">
<CharacterUID>49</CharacterUID>
<CharacterName>骸骨狂戦士</CharacterName>
<CharacterType>2</CharacterType>
<InternalID>0</InternalID>
<PopSpeed>15</PopSpeed>
<PopPoint_X>140.34</PopPoint_X>
<PopPoint_Y>95.72</PopPoint_Y>
</Character>
<Character id="cUid50">
<CharacterUID>50</CharacterUID>
<CharacterName>骸骨狂戦士</CharacterName>
<CharacterType>2</CharacterType>
<InternalID>0</InternalID>
<PopSpeed>15</PopSpeed>
<PopPoint_X>122.38</PopPoint_X>
<PopPoint_Y>91.03</PopPoint_Y>
</Character>
<Character id="cUid51">
<CharacterUID>51</CharacterUID>
<CharacterName>ファントム</CharacterName>
<CharacterType>2</CharacterType>
<InternalID>2</InternalID>
<PopSpeed>18</PopSpeed>
<PopPoint_X>110.69</PopPoint_X>
<PopPoint_Y>94.56</PopPoint_Y>
</Character>
<Character id="cUid52">
<CharacterUID>52</CharacterUID>
<CharacterName>ファントム</CharacterName>
<CharacterType>2</CharacterType>
<InternalID>2</InternalID>
<PopSpeed>18</PopSpeed>
<PopPoint_X>104.53</PopPoint_X>
<PopPoint_Y>90.22</PopPoint_Y>
</Character>
<Character id="cUid53">
<CharacterUID>53</CharacterUID>
<CharacterName>ファントム</CharacterName>
<CharacterType>2</CharacterType>
<InternalID>2</InternalID>
<PopSpeed>18</PopSpeed>
<PopPoint_X>118.56</PopPoint_X>
<PopPoint_Y>89.00</PopPoint_Y>
</Character>
<Character id="cUid54">
<CharacterUID>54</CharacterUID>
<CharacterName>骸骨狂戦士</CharacterName>
<CharacterType>2</CharacterType>
<InternalID>0</InternalID>
<PopSpeed>15</PopSpeed>
<PopPoint_X>169.00</PopPoint_X>
<PopPoint_Y>18.00</PopPoint_Y>
</Character>
<Character id="cUid55">
<CharacterUID>55</CharacterUID>
<CharacterName>骸骨狂戦士</CharacterName>
<CharacterType>2</CharacterType>
<InternalID>0</InternalID>
<PopSpeed>15</PopSpeed>
<PopPoint_X>177.38</PopPoint_X>
<PopPoint_Y>16.63</PopPoint_Y>
</Character>
<Character id="cUid56">
<CharacterUID>56</CharacterUID>
<CharacterName>骸骨狂戦士</CharacterName>
<CharacterType>2</CharacterType>
<InternalID>0</InternalID>
<PopSpeed>15</PopSpeed>
<PopPoint_X>172.94</PopPoint_X>
<PopPoint_Y>20.69</PopPoint_Y>
</Character>
<Character id="cUid57">
<CharacterUID>57</CharacterUID>
<CharacterName>骸骨狂戦士</CharacterName>
<CharacterType>2</CharacterType>
<InternalID>0</InternalID>
<PopSpeed>15</PopSpeed>
<PopPoint_X>179.41</PopPoint_X>
<PopPoint_Y>20.03</PopPoint_Y>
</Character>
<Character id="cUid58">
<CharacterUID>58</CharacterUID>
<CharacterName>骸骨狂戦士</CharacterName>
<CharacterType>2</CharacterType>
<InternalID>0</InternalID>
<PopSpeed>15</PopSpeed>
<PopPoint_X>217.88</PopPoint_X>
<PopPoint_Y>45.44</PopPoint_Y>
</Character>
<Character id="cUid59">
<CharacterUID>59</CharacterUID>
<CharacterName>骸骨狂戦士</CharacterName>
<CharacterType>2</CharacterType>
<InternalID>0</InternalID>
<PopSpeed>15</PopSpeed>
<PopPoint_X>218.28</PopPoint_X>
<PopPoint_Y>42.78</PopPoint_Y>
</Character>
<Character id="cUid60">
<CharacterUID>60</CharacterUID>
<CharacterName>ファントム</CharacterName>
<CharacterType>2</CharacterType>
<InternalID>2</InternalID>
<PopSpeed>18</PopSpeed>
<PopPoint_X>226.06</PopPoint_X>
<PopPoint_Y>45.91</PopPoint_Y>
</Character>
<Character id="cUid61">
<CharacterUID>61</CharacterUID>
<CharacterName>ファントム</CharacterName>
<CharacterType>2</CharacterType>
<InternalID>2</InternalID>
<PopSpeed>18</PopSpeed>
<PopPoint_X>230.25</PopPoint_X>
<PopPoint_Y>43.63</PopPoint_Y>
</Character>
<Character id="cUid62">
<CharacterUID>62</CharacterUID>
<CharacterName>ファントム</CharacterName>
<CharacterType>2</CharacterType>
<InternalID>2</InternalID>
<PopSpeed>18</PopSpeed>
<PopPoint_X>216.94</PopPoint_X>
<PopPoint_Y>91.44</PopPoint_Y>
</Character>
<Character id="cUid63">
<CharacterUID>63</CharacterUID>
<CharacterName>ファントム</CharacterName>
<CharacterType>2</CharacterType>
<InternalID>2</InternalID>
<PopSpeed>18</PopSpeed>
<PopPoint_X>216.09</PopPoint_X>
<PopPoint_Y>93.97</PopPoint_Y>
</Character>
<Character id="cUid64">
<CharacterUID>64</CharacterUID>
<CharacterName>ファントム</CharacterName>
<CharacterType>2</CharacterType>
<InternalID>2</InternalID>
<PopSpeed>18</PopSpeed>
<PopPoint_X>227.88</PopPoint_X>
<PopPoint_Y>85.66</PopPoint_Y>
</Character>
<Character id="cUid65">
<CharacterUID>65</CharacterUID>
<CharacterName>骸骨狂戦士</CharacterName>
<CharacterType>2</CharacterType>
<InternalID>0</InternalID>
<PopSpeed>15</PopSpeed>
<PopPoint_X>231.88</PopPoint_X>
<PopPoint_Y>87.72</PopPoint_Y>
</Character>
<Character id="cUid66">
<CharacterUID>66</CharacterUID>
<CharacterName>骸骨狂戦士</CharacterName>
<CharacterType>2</CharacterType>
<InternalID>0</InternalID>
<PopSpeed>15</PopSpeed>
<PopPoint_X>164.59</PopPoint_X>
<PopPoint_Y>115.63</PopPoint_Y>
</Character>
<Character id="cUid67">
<CharacterUID>67</CharacterUID>
<CharacterName>骸骨狂戦士</CharacterName>
<CharacterType>2</CharacterType>
<InternalID>0</InternalID>
<PopSpeed>15</PopSpeed>
<PopPoint_X>174.78</PopPoint_X>
<PopPoint_Y>111.63</PopPoint_Y>
</Character>
<Character id="cUid68">
<CharacterUID>68</CharacterUID>
<CharacterName>骸骨狂戦士</CharacterName>
<CharacterType>2</CharacterType>
<InternalID>0</InternalID>
<PopSpeed>15</PopSpeed>
<PopPoint_X>168.47</PopPoint_X>
<PopPoint_Y>117.94</PopPoint_Y>
</Character>
<Character id="cUid69">
<CharacterUID>69</CharacterUID>
<CharacterName>ファントム</CharacterName>
<CharacterType>2</CharacterType>
<InternalID>2</InternalID>
<PopSpeed>18</PopSpeed>
<PopPoint_X>178.28</PopPoint_X>
<PopPoint_Y>113.47</PopPoint_Y>
</Character>
<Character id="cUid70">
<CharacterUID>70</CharacterUID>
<CharacterName>ファントム</CharacterName>
<CharacterType>2</CharacterType>
<InternalID>2</InternalID>
<PopSpeed>18</PopSpeed>
<PopPoint_X>78.13</PopPoint_X>
<PopPoint_Y>114.50</PopPoint_Y>
</Character>
<Character id="cUid71">
<CharacterUID>71</CharacterUID>
<CharacterName>ファントム</CharacterName>
<CharacterType>2</CharacterType>
<InternalID>2</InternalID>
<PopSpeed>18</PopSpeed>
<PopPoint_X>81.31</PopPoint_X>
<PopPoint_Y>111.63</PopPoint_Y>
</Character>
<Character id="cUid72">
<CharacterUID>72</CharacterUID>
<CharacterName>骸骨狂戦士</CharacterName>
<CharacterType>2</CharacterType>
<InternalID>0</InternalID>
<PopSpeed>15</PopSpeed>
<PopPoint_X>89.19</PopPoint_X>
<PopPoint_Y>111.81</PopPoint_Y>
</Character>
<Character id="cUid73">
<CharacterUID>73</CharacterUID>
<CharacterName>骸骨狂戦士</CharacterName>
<CharacterType>2</CharacterType>
<InternalID>0</InternalID>
<PopSpeed>15</PopSpeed>
<PopPoint_X>93.31</PopPoint_X>
<PopPoint_Y>114.09</PopPoint_Y>
</Character>
<Character id="cUid74">
<CharacterUID>74</CharacterUID>
<CharacterName>骸骨狂戦士</CharacterName>
<CharacterType>2</CharacterType>
<InternalID>0</InternalID>
<PopSpeed>15</PopSpeed>
<PopPoint_X>88.06</PopPoint_X>
<PopPoint_Y>14.13</PopPoint_Y>
</Character>
<Character id="cUid75">
<CharacterUID>75</CharacterUID>
<CharacterName>骸骨狂戦士</CharacterName>
<CharacterType>2</CharacterType>
<InternalID>0</InternalID>
<PopSpeed>15</PopSpeed>
<PopPoint_X>93.81</PopPoint_X>
<PopPoint_Y>17.16</PopPoint_Y>
</Character>
<Character id="cUid76">
<CharacterUID>76</CharacterUID>
<CharacterName>ファントム</CharacterName>
<CharacterType>2</CharacterType>
<InternalID>2</InternalID>
<PopSpeed>18</PopSpeed>
<PopPoint_X>77.41</PopPoint_X>
<PopPoint_Y>22.09</PopPoint_Y>
</Character>
<Character id="cUid77">
<CharacterUID>77</CharacterUID>
<CharacterName>ファントム</CharacterName>
<CharacterType>2</CharacterType>
<InternalID>2</InternalID>
<PopSpeed>18</PopSpeed>
<PopPoint_X>82.22</PopPoint_X>
<PopPoint_Y>23.84</PopPoint_Y>
</Character>
<Character id="cUid78">
<CharacterUID>78</CharacterUID>
<CharacterName>デスアックス</CharacterName>
<CharacterType>2</CharacterType>
<InternalID>1</InternalID>
<PopSpeed>18</PopSpeed>
<PopPoint_X>71.44</PopPoint_X>
<PopPoint_Y>62.88</PopPoint_Y>
</Character>
<Character id="cUid79">
<CharacterUID>79</CharacterUID>
<CharacterName>デスアックス</CharacterName>
<CharacterType>2</CharacterType>
<InternalID>1</InternalID>
<PopSpeed>18</PopSpeed>
<PopPoint_X>135.94</PopPoint_X>
<PopPoint_Y>39.41</PopPoint_Y>
</Character>
<Character id="cUid80">
<CharacterUID>80</CharacterUID>
<CharacterName>デスアックス</CharacterName>
<CharacterType>2</CharacterType>
<InternalID>1</InternalID>
<PopSpeed>18</PopSpeed>
<PopPoint_X>121.75</PopPoint_X>
<PopPoint_Y>96.47</PopPoint_Y>
</Character>
<Character id="cUid81">
<CharacterUID>81</CharacterUID>
<CharacterName>デスアックス</CharacterName>
<CharacterType>2</CharacterType>
<InternalID>1</InternalID>
<PopSpeed>18</PopSpeed>
<PopPoint_X>191.69</PopPoint_X>
<PopPoint_Y>60.13</PopPoint_Y>
</Character>
</CharacterData>
<AreaData>
<Area id="aUid0">
<AreaUID>0</AreaUID>
<AreaName>_필드 전체</AreaName>
<AreaType>0</AreaType>
<AccessMap></AccessMap>
<AccessMapName></AccessMapName>
<AreaPos_X>0.00</AreaPos_X>
<AreaPos_X2>0.00</AreaPos_X2>
<AreaPos_Y>0.00</AreaPos_Y>
<AreaPos_Y2>0.00</AreaPos_Y2>
<AreaExpansion>
</AreaExpansion>
</Area>
<Area id="aUid1">
<AreaUID>1</AreaUID>
<AreaName>_화면</AreaName>
<AreaType>0</AreaType>
<AccessMap></AccessMap>
<AccessMapName></AccessMapName>
<AreaPos_X>0.00</AreaPos_X>
<AreaPos_X2>0.00</AreaPos_X2>
<AreaPos_Y>0.00</AreaPos_Y>
<AreaPos_Y2>0.00</AreaPos_Y2>
<AreaExpansion>
</AreaExpansion>
</Area>
<Area id="aUid2">
<AreaUID>2</AreaUID>
<AreaName>Area 1</AreaName>
<AreaType>4</AreaType>
<AccessMap></AccessMap>
<AccessMapName></AccessMapName>
<AreaPos_X>134.16</AreaPos_X>
<AreaPos_X2>159.34</AreaPos_X2>
<AreaPos_Y>34.00</AreaPos_Y>
<AreaPos_Y2>47.34</AreaPos_Y2>
<AreaExpansion>
</AreaExpansion>
</Area>
<Area id="aUid3">
<AreaUID>3</AreaUID>
<AreaName>Area 2</AreaName>
<AreaType>4</AreaType>
<AccessMap></AccessMap>
<AccessMapName></AccessMapName>
<AreaPos_X>71.75</AreaPos_X>
<AreaPos_X2>86.16</AreaPos_X2>
<AreaPos_Y>18.25</AreaPos_Y>
<AreaPos_Y2>26.97</AreaPos_Y2>
<AreaExpansion>
</AreaExpansion>
</Area>
<Area id="aUid4">
<AreaUID>4</AreaUID>
<AreaName>Area 3</AreaName>
<AreaType>4</AreaType>
<AccessMap></AccessMap>
<AccessMapName></AccessMapName>
<AreaPos_X>24.09</AreaPos_X>
<AreaPos_X2>37.72</AreaPos_X2>
<AreaPos_Y>42.81</AreaPos_Y>
<AreaPos_Y2>51.06</AreaPos_Y2>
<AreaExpansion>
</AreaExpansion>
</Area>
<Area id="aUid5">
<AreaUID>5</AreaUID>
<AreaName>Area 4</AreaName>
<AreaType>4</AreaType>
<AccessMap></AccessMap>
<AccessMapName></AccessMapName>
<AreaPos_X>57.47</AreaPos_X>
<AreaPos_X2>85.53</AreaPos_X2>
<AreaPos_Y>55.97</AreaPos_Y>
<AreaPos_Y2>68.50</AreaPos_Y2>
<AreaExpansion>
</AreaExpansion>
</Area>
<Area id="aUid6">
<AreaUID>6</AreaUID>
<AreaName>8층으로</AreaName>
<AreaType>3</AreaType>
<AccessMap>[239]M10_S01_F08.rmd</AccessMap>
<AccessMapName>スウェブタワー 8F</AccessMapName>
<AreaPos_X>107.53</AreaPos_X>
<AreaPos_X2>111.94</AreaPos_X2>
<AreaPos_Y>66.00</AreaPos_Y>
<AreaPos_Y2>68.38</AreaPos_Y2>
<AreaExpansion>
</AreaExpansion>
</Area>
<Area id="aUid7">
<AreaUID>7</AreaUID>
<AreaName>10층으로</AreaName>
<AreaType>3</AreaType>
<AccessMap>[241]M10_S01_F10.rmd</AccessMap>
<AccessMapName>スウェブタワー 10F</AccessMapName>
<AreaPos_X>150.09</AreaPos_X>
<AreaPos_X2>154.56</AreaPos_X2>
<AreaPos_Y>73.09</AreaPos_Y>
<AreaPos_Y2>75.75</AreaPos_Y2>
<AreaExpansion>
</AreaExpansion>
</Area>
<Area id="aUid9">
<AreaUID>9</AreaUID>
<AreaName>Area 8</AreaName>
<AreaType>4</AreaType>
<AccessMap></AccessMap>
<AccessMapName></AccessMapName>
<AreaPos_X>36.16</AreaPos_X>
<AreaPos_X2>49.19</AreaPos_X2>
<AreaPos_Y>37.25</AreaPos_Y>
<AreaPos_Y2>45.56</AreaPos_Y2>
<AreaExpansion>
</AreaExpansion>
</Area>
<Area id="aUid10">
<AreaUID>10</AreaUID>
<AreaName>Area 9</AreaName>
<AreaType>4</AreaType>
<AccessMap></AccessMap>
<AccessMapName></AccessMapName>
<AreaPos_X>66.22</AreaPos_X>
<AreaPos_X2>83.25</AreaPos_X2>
<AreaPos_Y>69.28</AreaPos_Y>
<AreaPos_Y2>81.03</AreaPos_Y2>
<AreaExpansion>
</AreaExpansion>
</Area>
<Area id="aUid11">
<AreaUID>11</AreaUID>
<AreaName>Area 10</AreaName>
<AreaType>4</AreaType>
<AccessMap></AccessMap>
<AccessMapName></AccessMapName>
<AreaPos_X>24.25</AreaPos_X>
<AreaPos_X2>47.75</AreaPos_X2>
<AreaPos_Y>83.38</AreaPos_Y>
<AreaPos_Y2>91.06</AreaPos_Y2>
<AreaExpansion>
</AreaExpansion>
</Area>
<Area id="aUid12">
<AreaUID>12</AreaUID>
<AreaName>Area 11</AreaName>
<AreaType>4</AreaType>
<AccessMap></AccessMap>
<AccessMapName></AccessMapName>
<AreaPos_X>74.00</AreaPos_X>
<AreaPos_X2>97.50</AreaPos_X2>
<AreaPos_Y>108.56</AreaPos_Y>
<AreaPos_Y2>124.63</AreaPos_Y2>
<AreaExpansion>
</AreaExpansion>
</Area>
<Area id="aUid13">
<AreaUID>13</AreaUID>
<AreaName>Area 12</AreaName>
<AreaType>4</AreaType>
<AccessMap></AccessMap>
<AccessMapName></AccessMapName>
<AreaPos_X>160.69</AreaPos_X>
<AreaPos_X2>177.56</AreaPos_X2>
<AreaPos_Y>113.00</AreaPos_Y>
<AreaPos_Y2>120.19</AreaPos_Y2>
<AreaExpansion>
</AreaExpansion>
</Area>
<Area id="aUid14">
<AreaUID>14</AreaUID>
<AreaName>Area 13</AreaName>
<AreaType>4</AreaType>
<AccessMap></AccessMap>
<AccessMapName></AccessMapName>
<AreaPos_X>171.19</AreaPos_X>
<AreaPos_X2>187.75</AreaPos_X2>
<AreaPos_Y>106.56</AreaPos_Y>
<AreaPos_Y2>114.19</AreaPos_Y2>
<AreaExpansion>
</AreaExpansion>
</Area>
<Area id="aUid15">
<AreaUID>15</AreaUID>
<AreaName>Area 14</AreaName>
<AreaType>4</AreaType>
<AccessMap></AccessMap>
<AccessMapName></AccessMapName>
<AreaPos_X>209.19</AreaPos_X>
<AreaPos_X2>228.81</AreaPos_X2>
<AreaPos_Y>87.25</AreaPos_Y>
<AreaPos_Y2>100.38</AreaPos_Y2>
<AreaExpansion>
</AreaExpansion>
</Area>
<Area id="aUid16">
<AreaUID>16</AreaUID>
<AreaName>Area 15</AreaName>
<AreaType>4</AreaType>
<AccessMap></AccessMap>
<AccessMapName></AccessMapName>
<AreaPos_X>221.41</AreaPos_X>
<AreaPos_X2>238.00</AreaPos_X2>
<AreaPos_Y>78.88</AreaPos_Y>
<AreaPos_Y2>89.06</AreaPos_Y2>
<AreaExpansion>
</AreaExpansion>
</Area>
<Area id="aUid17">
<AreaUID>17</AreaUID>
<AreaName>Area 16</AreaName>
<AreaType>4</AreaType>
<AccessMap></AccessMap>
<AccessMapName></AccessMapName>
<AreaPos_X>212.50</AreaPos_X>
<AreaPos_X2>234.19</AreaPos_X2>
<AreaPos_Y>32.88</AreaPos_Y>
<AreaPos_Y2>47.44</AreaPos_Y2>
<AreaExpansion>
</AreaExpansion>
</Area>
<Area id="aUid18">
<AreaUID>18</AreaUID>
<AreaName>Area 17</AreaName>
<AreaType>4</AreaType>
<AccessMap></AccessMap>
<AccessMapName></AccessMapName>
<AreaPos_X>162.91</AreaPos_X>
<AreaPos_X2>183.81</AreaPos_X2>
<AreaPos_Y>7.75</AreaPos_Y>
<AreaPos_Y2>22.63</AreaPos_Y2>
<AreaExpansion>
</AreaExpansion>
</Area>
<Area id="aUid19">
<AreaUID>19</AreaUID>
<AreaName>Area 18</AreaName>
<AreaType>4</AreaType>
<AccessMap></AccessMap>
<AccessMapName></AccessMapName>
<AreaPos_X>83.09</AreaPos_X>
<AreaPos_X2>98.06</AreaPos_X2>
<AreaPos_Y>8.56</AreaPos_Y>
<AreaPos_Y2>19.25</AreaPos_Y2>
<AreaExpansion>
</AreaExpansion>
</Area>
<Area id="aUid20">
<AreaUID>20</AreaUID>
<AreaName>Area 19</AreaName>
<AreaType>4</AreaType>
<AccessMap></AccessMap>
<AccessMapName></AccessMapName>
<AreaPos_X>112.28</AreaPos_X>
<AreaPos_X2>134.81</AreaPos_X2>
<AreaPos_Y>28.06</AreaPos_Y>
<AreaPos_Y2>44.47</AreaPos_Y2>
<AreaExpansion>
</AreaExpansion>
</Area>
<Area id="aUid21">
<AreaUID>21</AreaUID>
<AreaName>Area 20</AreaName>
<AreaType>4</AreaType>
<AccessMap></AccessMap>
<AccessMapName></AccessMapName>
<AreaPos_X>100.75</AreaPos_X>
<AreaPos_X2>115.44</AreaPos_X2>
<AreaPos_Y>88.00</AreaPos_Y>
<AreaPos_Y2>97.56</AreaPos_Y2>
<AreaExpansion>
</AreaExpansion>
</Area>
<Area id="aUid22">
<AreaUID>22</AreaUID>
<AreaName>Area 21</AreaName>
<AreaType>4</AreaType>
<AccessMap></AccessMap>
<AccessMapName></AccessMapName>
<AreaPos_X>113.19</AreaPos_X>
<AreaPos_X2>127.88</AreaPos_X2>
<AreaPos_Y>82.50</AreaPos_Y>
<AreaPos_Y2>104.25</AreaPos_Y2>
<AreaExpansion>
</AreaExpansion>
</Area>
<Area id="aUid23">
<AreaUID>23</AreaUID>
<AreaName>Area 22</AreaName>
<AreaType>4</AreaType>
<AccessMap></AccessMap>
<AccessMapName></AccessMapName>
<AreaPos_X>127.50</AreaPos_X>
<AreaPos_X2>152.19</AreaPos_X2>
<AreaPos_Y>92.13</AreaPos_Y>
<AreaPos_Y2>102.28</AreaPos_Y2>
<AreaExpansion>
</AreaExpansion>
</Area>
<Area id="aUid24">
<AreaUID>24</AreaUID>
<AreaName>Area 23</AreaName>
<AreaType>4</AreaType>
<AccessMap></AccessMap>
<AccessMapName></AccessMapName>
<AreaPos_X>176.38</AreaPos_X>
<AreaPos_X2>200.41</AreaPos_X2>
<AreaPos_Y>64.84</AreaPos_Y>
<AreaPos_Y2>76.66</AreaPos_Y2>
<AreaExpansion>
</AreaExpansion>
</Area>
<Area id="aUid25">
<AreaUID>25</AreaUID>
<AreaName>Area 24</AreaName>
<AreaType>4</AreaType>
<AccessMap></AccessMap>
<AccessMapName></AccessMapName>
<AreaPos_X>176.56</AreaPos_X>
<AreaPos_X2>199.06</AreaPos_X2>
<AreaPos_Y>53.44</AreaPos_Y>
<AreaPos_Y2>63.91</AreaPos_Y2>
<AreaExpansion>
</AreaExpansion>
</Area>
<Area id="aUid26">
<AreaUID>26</AreaUID>
<AreaName>Area 25</AreaName>
<AreaType>4</AreaType>
<AccessMap></AccessMap>
<AccessMapName></AccessMapName>
<AreaPos_X>23.56</AreaPos_X>
<AreaPos_X2>35.25</AreaPos_X2>
<AreaPos_Y>61.56</AreaPos_Y>
<AreaPos_Y2>70.50</AreaPos_Y2>
<AreaExpansion>
</AreaExpansion>
</Area>
<Area id="aUid27">
<AreaUID>27</AreaUID>
<AreaName>Area 26</AreaName>
<AreaType>4</AreaType>
<AccessMap></AccessMap>
<AccessMapName></AccessMapName>
<AreaPos_X>74.44</AreaPos_X>
<AreaPos_X2>87.31</AreaPos_X2>
<AreaPos_Y>88.25</AreaPos_Y>
<AreaPos_Y2>96.44</AreaPos_Y2>
<AreaExpansion>
</AreaExpansion>
</Area>
<Area id="aUid28">
<AreaUID>28</AreaUID>
<AreaName>Area 27</AreaName>
<AreaType>4</AreaType>
<AccessMap></AccessMap>
<AccessMapName></AccessMapName>
<AreaPos_X>124.13</AreaPos_X>
<AreaPos_X2>136.44</AreaPos_X2>
<AreaPos_Y>113.31</AreaPos_Y>
<AreaPos_Y2>121.50</AreaPos_Y2>
<AreaExpansion>
</AreaExpansion>
</Area>
<Area id="aUid29">
<AreaUID>29</AreaUID>
<AreaName>Area 28</AreaName>
<AreaType>4</AreaType>
<AccessMap></AccessMap>
<AccessMapName></AccessMapName>
<AreaPos_X>225.44</AreaPos_X>
<AreaPos_X2>237.69</AreaPos_X2>
<AreaPos_Y>61.13</AreaPos_Y>
<AreaPos_Y2>70.88</AreaPos_Y2>
<AreaExpansion>
</AreaExpansion>
</Area>
<Area id="aUid30">
<AreaUID>30</AreaUID>
<AreaName>Area 29</AreaName>
<AreaType>4</AreaType>
<AccessMap></AccessMap>
<AccessMapName></AccessMapName>
<AreaPos_X>172.81</AreaPos_X>
<AreaPos_X2>186.56</AreaPos_X2>
<AreaPos_Y>34.75</AreaPos_Y>
<AreaPos_Y2>44.63</AreaPos_Y2>
<AreaExpansion>
</AreaExpansion>
</Area>
<Area id="aUid31">
<AreaUID>31</AreaUID>
<AreaName>Area 30</AreaName>
<AreaType>4</AreaType>
<AccessMap></AccessMap>
<AccessMapName></AccessMapName>
<AreaPos_X>121.38</AreaPos_X>
<AreaPos_X2>138.38</AreaPos_X2>
<AreaPos_Y>11.94</AreaPos_Y>
<AreaPos_Y2>18.50</AreaPos_Y2>
<AreaExpansion>
</AreaExpansion>
</Area>
<Area id="aUid32">
<AreaUID>32</AreaUID>
<AreaName>Area 31</AreaName>
<AreaType>4</AreaType>
<AccessMap></AccessMap>
<AccessMapName></AccessMapName>
<AreaPos_X>72.31</AreaPos_X>
<AreaPos_X2>86.94</AreaPos_X2>
<AreaPos_Y>37.06</AreaPos_Y>
<AreaPos_Y2>45.94</AreaPos_Y2>
<AreaExpansion>
</AreaExpansion>
</Area>
<Area id="aUid33">
<AreaUID>33</AreaUID>
<AreaName>Area 32</AreaName>
<AreaType>4</AreaType>
<AccessMap></AccessMap>
<AccessMapName></AccessMapName>
<AreaPos_X>174.13</AreaPos_X>
<AreaPos_X2>188.19</AreaPos_X2>
<AreaPos_Y>86.00</AreaPos_Y>
<AreaPos_Y2>95.38</AreaPos_Y2>
<AreaExpansion>
</AreaExpansion>
</Area>
</AreaData>
</MapData>
| {
"content_hash": "fd1b8b0daf9a3c07818898a902cb6bac",
"timestamp": "",
"source": "github",
"line_count": 1200,
"max_line_length": 53,
"avg_line_length": 26.605833333333333,
"alnum_prop": 0.7532182791994236,
"repo_name": "Yotsuba000/YotsubaDataBase",
"id": "b14b53c3866c24095a305c9a762ec6d62f50da89",
"size": "32849",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "MapDataBase/Map/[240]M10_S01_F09.rmd/[240]M10_S01_F09.rmd.xml",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "91005"
},
{
"name": "HTML",
"bytes": "516843"
},
{
"name": "JavaScript",
"bytes": "241418"
}
],
"symlink_target": ""
} |
Stability: 4 - API Frozen
These functions are in the module `'util'`. Use `require('util')` to
access them.
The `util` module is primarily designed to support the needs of Node's
internal APIs. Many of these utilities are useful for your own
programs. If you find that these functions are lacking for your
purposes, however, you are encouraged to write your own utilities. We
are not interested in any future additions to the `util` module that
are unnecessary for Node's internal functionality.
## util.debuglog(section)
* `section` {String} The section of the program to be debugged
* Returns: {Function} The logging function
This is used to create a function which conditionally writes to stderr
based on the existence of a `NODE_DEBUG` environment variable. If the
`section` name appears in that environment variable, then the returned
function will be similar to `console.error()`. If not, then the
returned function is a no-op.
For example:
```javascript
var debuglog = util.debuglog('foo');
var bar = 123;
debuglog('hello from foo [%d]', bar);
```
If this program is run with `NODE_DEBUG=foo` in the environment, then
it will output something like:
FOO 3245: hello from foo [123]
where `3245` is the process id. If it is not run with that
environment variable set, then it will not print anything.
You may separate multiple `NODE_DEBUG` environment variables with a
comma. For example, `NODE_DEBUG=fs,net,tls`.
## util.format(format[, ...])
Returns a formatted string using the first argument as a `printf`-like format.
The first argument is a string that contains zero or more *placeholders*.
Each placeholder is replaced with the converted value from its corresponding
argument. Supported placeholders are:
* `%s` - String.
* `%d` - Number (both integer and float).
* `%j` - JSON. Replaced with the string `'[Circular]'` if the argument
contains circular references.
* `%%` - single percent sign (`'%'`). This does not consume an argument.
If the placeholder does not have a corresponding argument, the placeholder is
not replaced.
util.format('%s:%s', 'foo'); // 'foo:%s'
If there are more arguments than placeholders, the extra arguments are
converted to strings with `util.inspect()` and these strings are concatenated,
delimited by a space.
util.format('%s:%s', 'foo', 'bar', 'baz'); // 'foo:bar baz'
If the first argument is not a format string then `util.format()` returns
a string that is the concatenation of all its arguments separated by spaces.
Each argument is converted to a string with `util.inspect()`.
util.format(1, 2, 3); // '1 2 3'
## util.log(string)
Output with timestamp on `stdout`.
require('util').log('Timestamped message.');
## util.inspect(object[, options])
Return a string representation of `object`, which is useful for debugging.
An optional *options* object may be passed that alters certain aspects of the
formatted string:
- `showHidden` - if `true` then the object's non-enumerable properties will be
shown too. Defaults to `false`.
- `depth` - tells `inspect` how many times to recurse while formatting the
object. This is useful for inspecting large complicated objects. Defaults to
`2`. To make it recurse indefinitely pass `null`.
- `colors` - if `true`, then the output will be styled with ANSI color codes.
Defaults to `false`. Colors are customizable, see below.
- `customInspect` - if `false`, then custom `inspect(depth, opts)` functions
defined on the objects being inspected won't be called. Defaults to `true`.
Example of inspecting all properties of the `util` object:
var util = require('util');
console.log(util.inspect(util, { showHidden: true, depth: null }));
Values may supply their own custom `inspect(depth, opts)` functions, when
called they receive the current depth in the recursive inspection, as well as
the options object passed to `util.inspect()`.
### Customizing `util.inspect` colors
<!-- type=misc -->
Color output (if enabled) of `util.inspect` is customizable globally
via `util.inspect.styles` and `util.inspect.colors` objects.
`util.inspect.styles` is a map assigning each style a color
from `util.inspect.colors`.
Highlighted styles and their default values are:
* `number` (yellow)
* `boolean` (yellow)
* `string` (green)
* `date` (magenta)
* `regexp` (red)
* `null` (bold)
* `undefined` (grey)
* `special` - only function at this time (cyan)
* `name` (intentionally no styling)
Predefined color codes are: `white`, `grey`, `black`, `blue`, `cyan`,
`green`, `magenta`, `red` and `yellow`.
There are also `bold`, `italic`, `underline` and `inverse` codes.
### Custom `inspect()` function on Objects
<!-- type=misc -->
Objects also may define their own `inspect(depth)` function which `util.inspect()`
will invoke and use the result of when inspecting the object:
var util = require('util');
var obj = { name: 'nate' };
obj.inspect = function(depth) {
return '{' + this.name + '}';
};
util.inspect(obj);
// "{nate}"
You may also return another Object entirely, and the returned String will be
formatted according to the returned Object. This is similar to how
`JSON.stringify()` works:
var obj = { foo: 'this will not show up in the inspect() output' };
obj.inspect = function(depth) {
return { bar: 'baz' };
};
util.inspect(obj);
// "{ bar: 'baz' }"
## util.isArray(object)
Internal alias for Array.isArray.
Returns `true` if the given "object" is an `Array`. `false` otherwise.
var util = require('util');
util.isArray([])
// true
util.isArray(new Array)
// true
util.isArray({})
// false
## util.isRegExp(object)
Returns `true` if the given "object" is a `RegExp`. `false` otherwise.
var util = require('util');
util.isRegExp(/some regexp/)
// true
util.isRegExp(new RegExp('another regexp'))
// true
util.isRegExp({})
// false
## util.isDate(object)
Returns `true` if the given "object" is a `Date`. `false` otherwise.
var util = require('util');
util.isDate(new Date())
// true
util.isDate(Date())
// false (without 'new' returns a String)
util.isDate({})
// false
## util.isError(object)
Returns `true` if the given "object" is an `Error`. `false` otherwise.
var util = require('util');
util.isError(new Error())
// true
util.isError(new TypeError())
// true
util.isError({ name: 'Error', message: 'an error occurred' })
// false
## util.inherits(constructor, superConstructor)
Inherit the prototype methods from one
[constructor](https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Object/constructor)
into another. The prototype of `constructor` will be set to a new
object created from `superConstructor`.
As an additional convenience, `superConstructor` will be accessible
through the `constructor.super_` property.
var util = require("util");
var events = require("events");
function MyStream() {
events.EventEmitter.call(this);
}
util.inherits(MyStream, events.EventEmitter);
MyStream.prototype.write = function(data) {
this.emit("data", data);
}
var stream = new MyStream();
console.log(stream instanceof events.EventEmitter); // true
console.log(MyStream.super_ === events.EventEmitter); // true
stream.on("data", function(data) {
console.log('Received data: "' + data + '"');
})
stream.write("It works!"); // Received data: "It works!"
## util.deprecate(function, string)
Marks that a method should not be used any more.
exports.puts = exports.deprecate(function() {
for (var i = 0, len = arguments.length; i < len; ++i) {
process.stdout.write(arguments[i] + '\n');
}
}, 'util.puts: Use console.log instead')
It returns a modified function which warns once by default. If
`--no-deprecation` is set then this function is a NO-OP. If
`--throw-deprecation` is set then the application will throw an exception
if the deprecated API is used.
## util.debug(string)
Stability: 0 - Deprecated: use console.error() instead.
Deprecated predecessor of `console.error`.
## util.error([...])
Stability: 0 - Deprecated: Use console.error() instead.
Deprecated predecessor of `console.error`.
## util.puts([...])
Stability: 0 - Deprecated: Use console.log() instead.
Deprecated predecessor of `console.log`.
## util.print([...])
Stability: 0 - Deprecated: Use `console.log` instead.
Deprecated predecessor of `console.log`.
## util.pump(readableStream, writableStream[, callback])
Stability: 0 - Deprecated: Use readableStream.pipe(writableStream)
Deprecated predecessor of `stream.pipe()`.
| {
"content_hash": "4051eeeae5a271778310172c0f00013c",
"timestamp": "",
"source": "github",
"line_count": 302,
"max_line_length": 102,
"avg_line_length": 29.112582781456954,
"alnum_prop": 0.6902866242038217,
"repo_name": "nomilous/objective_dev",
"id": "cc639ddb49434b7a43be7dc60907c78d9ffab3dd",
"size": "8800",
"binary": false,
"copies": "3",
"ref": "refs/heads/master",
"path": "node_api_docs/util.markdown",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CoffeeScript",
"bytes": "86898"
},
{
"name": "JavaScript",
"bytes": "110093"
},
{
"name": "Shell",
"bytes": "391"
}
],
"symlink_target": ""
} |
<div class="menu">
<div class="container">
<a href="/">About This Project</a>
<a href="/guide">Classification Guide</a>
<a class="right"><span class="classifications-count">--</span> of <span class="classifications-total">--</span> People Classified</a>
</div>
</div>
<div class="classifications container">
<div class="info col half hide">
<div id="info-container"></div>
<script id="info-template" type="x-tmpl-mustache">
<h1>{{name}}</h1>
<div class="image">
{{#img}}<img src="{{{img}}}" />{{/img}}
{{^img}}<p>(No image available)</p>{{/img}}
</div>
<div class="button-group">
<a class="button" href="{{imdb_url}}" target="_blank">Go To IMDb Page</a>
<a class="button" href="{{google_image_url}}" target="_blank">Do Google Image Search</a>
<a class="button" href="{{wiki_url}}" target="_blank">Search on Wikipedia</a>
<a class="button" href="{{google_url}}" target="_blank">Search on Google</a>
</div>
<h3>Credits</h3>
<ul>
{{#roles}}
<li>{{movie_name}} <em>({{role}})</em></li>
{{/roles}}
</ul>
<input id="imdb_id" type="hidden" value="{{imdb_id}}" />
</script>
</div>
<div class="form col half hide">
<h2>What is this person's gender?</h2>
<div class="button-group">
<button data-value="f" class="input gender-input">Female</button>
<button data-value="m" class="input gender-input">Male</button>
<button data-value="o" class="input gender-input">Other</button>
</div>
<button data-value="u" class="input gender-input unsure">I am unsure</button>
<h2>What is this person's race?</h2>
<p>Select all that apply. Hover over each button for more information.</p>
<div class="button-group">
<button data-value="w" class="input race-input" title="A person having origins in any of the original peoples of Europe, the Middle East, or North Africa">White</button>
<button data-value="b" class="input race-input" title="A person having origins in any of the Black racial groups of Africa">Black</button>
<button data-value="h" class="input race-input" title="A person who identifies their origin as Hispanic, Latino, or Spanish.">Hispanic (Non-White)</button>
<button data-value="a" class="input race-input" title="A person having origins in any of the original peoples of the Far East, Southeast Asia, or the Indian subcontinent, or a person having origins in any of the original peoples of Hawaii, Guam, Samoa, or other Pacific Islands">Asian/Pacific Islander</button>
<button data-value="o" class="input race-input" title="A person having origins in any of the original peoples of North and South America and who maintains tribal affiliation or community attachment">American Indian</button>
</div>
<button data-value="u" class="input race-input unsure">I am unsure</button>
<h4>Reference/source URL</h4>
<input id="reference_url" type="text" />
<h4>Image URL</h4>
<input id="image_url" type="text" />
<h4>Add a note about this person</h4>
<input id="note" type="text" />
<input id="user_id" type="hidden" value="<?= $user_id ?>" />
<button class="submit">Submit</button>
<button class="skip">Skip</button>
</div>
<div class="loading">Loading data. One moment please...</div>
</div>
<script>
var UserClassifications = <?= json_encode($user_classifications) ?>;
var ImdbIdsClassified = <?= json_encode($imdb_ids_classified) ?>;
</script>
| {
"content_hash": "6788306ba5f0c3bf949d0b27c533ffd9",
"timestamp": "",
"source": "github",
"line_count": 81,
"max_line_length": 316,
"avg_line_length": 43.20987654320987,
"alnum_prop": 0.6488571428571429,
"repo_name": "beefoo/hollywood-diversity",
"id": "e426d16afbc7e974c4cf287bc307a83a02236dbf",
"size": "3500",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "application/views/classifications/add.php",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "ApacheConf",
"bytes": "321"
},
{
"name": "CSS",
"bytes": "13485"
},
{
"name": "HTML",
"bytes": "1332208"
},
{
"name": "JavaScript",
"bytes": "16780"
},
{
"name": "PHP",
"bytes": "1227327"
},
{
"name": "Python",
"bytes": "56226"
}
],
"symlink_target": ""
} |
namespace MassTransit.SystemView.Core.ViewModel
{
public class LocalSubscriptionCache :
NotifyPropertyChangedBase
{
public static Endpoints Endpoints { get; private set; }
static LocalSubscriptionCache()
{
Endpoints = new Endpoints();
}
}
} | {
"content_hash": "49b27731fa56305140b96bba59f83bc3",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 63,
"avg_line_length": 23.46153846153846,
"alnum_prop": 0.6327868852459017,
"repo_name": "petedavis/MassTransit",
"id": "4dc4211549a3b24a30f89386939f38b88b4261c6",
"size": "926",
"binary": false,
"copies": "6",
"ref": "refs/heads/autofacextensions",
"path": "src/MassTransit.SystemView.Core/ViewModel/LocalSubscriptionCache.cs",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Batchfile",
"bytes": "2073"
},
{
"name": "C#",
"bytes": "3447221"
},
{
"name": "PowerShell",
"bytes": "1631"
},
{
"name": "Ruby",
"bytes": "41686"
}
],
"symlink_target": ""
} |
#include <aws/gamelift/model/SearchGameSessionsRequest.h>
#include <aws/core/utils/json/JsonSerializer.h>
#include <utility>
using namespace Aws::GameLift::Model;
using namespace Aws::Utils::Json;
using namespace Aws::Utils;
SearchGameSessionsRequest::SearchGameSessionsRequest() :
m_fleetIdHasBeenSet(false),
m_aliasIdHasBeenSet(false),
m_filterExpressionHasBeenSet(false),
m_sortExpressionHasBeenSet(false),
m_limit(0),
m_limitHasBeenSet(false),
m_nextTokenHasBeenSet(false)
{
}
Aws::String SearchGameSessionsRequest::SerializePayload() const
{
JsonValue payload;
if(m_fleetIdHasBeenSet)
{
payload.WithString("FleetId", m_fleetId);
}
if(m_aliasIdHasBeenSet)
{
payload.WithString("AliasId", m_aliasId);
}
if(m_filterExpressionHasBeenSet)
{
payload.WithString("FilterExpression", m_filterExpression);
}
if(m_sortExpressionHasBeenSet)
{
payload.WithString("SortExpression", m_sortExpression);
}
if(m_limitHasBeenSet)
{
payload.WithInteger("Limit", m_limit);
}
if(m_nextTokenHasBeenSet)
{
payload.WithString("NextToken", m_nextToken);
}
return payload.View().WriteReadable();
}
Aws::Http::HeaderValueCollection SearchGameSessionsRequest::GetRequestSpecificHeaders() const
{
Aws::Http::HeaderValueCollection headers;
headers.insert(Aws::Http::HeaderValuePair("X-Amz-Target", "GameLift.SearchGameSessions"));
return headers;
}
| {
"content_hash": "74e87a4db24d870c057ecd76afed76cc",
"timestamp": "",
"source": "github",
"line_count": 76,
"max_line_length": 93,
"avg_line_length": 18.973684210526315,
"alnum_prop": 0.7309292649098474,
"repo_name": "jt70471/aws-sdk-cpp",
"id": "476819dc29563294d1b3a02bb25ba59bce980f89",
"size": "1561",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "aws-cpp-sdk-gamelift/source/model/SearchGameSessionsRequest.cpp",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "C",
"bytes": "13452"
},
{
"name": "C++",
"bytes": "278594037"
},
{
"name": "CMake",
"bytes": "653931"
},
{
"name": "Dockerfile",
"bytes": "5555"
},
{
"name": "HTML",
"bytes": "4471"
},
{
"name": "Java",
"bytes": "302182"
},
{
"name": "Python",
"bytes": "110380"
},
{
"name": "Shell",
"bytes": "4674"
}
],
"symlink_target": ""
} |
from __future__ import print_function, division, absolute_import
from marvin.api.base import BaseView
import pytest
@pytest.fixture(autouse=True)
def baseview():
baseview = BaseView()
yield baseview
class TestBase(object):
def test_reset_results(self, baseview):
baseview.results = {'key1': 'value1'}
baseview.reset_results()
desired = {'data': None, 'status': -1, 'error': None, 'traceback': None}
assert baseview.results == desired, 'baseview results should be the same as desired'
def test_update_results(self, baseview):
new_results = {'key1': 'value1'}
baseview.update_results(new_results)
desired = {'data': None, 'status': -1, 'error': None, 'key1': 'value1', 'traceback': None}
assert baseview.results == desired, 'baseview results should be the same as desired'
def test_reset_status(self, baseview):
baseview.results['status'] = 42
baseview.reset_status()
assert baseview.results['status'] == -1
def test_add_config(self, baseview, release, mode):
baseview.add_config()
desired = {'data': None, 'status': -1, 'error': None, 'traceback': None,
'utahconfig': {'release': 'MPL-7', 'mode': 'local'}}
assert baseview.results == desired
def test_after_request_return_response(self, baseview):
name = 'test_name'
req = 'test_request'
actual = baseview.after_request(name, req)
desired = 'test_request'
assert actual == desired
def test_after_request_reset_results(self, baseview):
name = 'test_name'
req = 'test_request'
baseview.after_request(name, req)
desired = {'data': None, 'status': -1, 'error': None, 'traceback': None}
assert baseview.results == desired
| {
"content_hash": "ff7d2928e34dc166fe642cdd5feb19f9",
"timestamp": "",
"source": "github",
"line_count": 50,
"max_line_length": 98,
"avg_line_length": 36.4,
"alnum_prop": 0.6236263736263736,
"repo_name": "albireox/marvin",
"id": "1f48aec6a89dc4c49f44aa958b4e345358a362dd",
"size": "2051",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "python/marvin/tests/api/test_base.py",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "CSS",
"bytes": "210343"
},
{
"name": "HTML",
"bytes": "68596"
},
{
"name": "JavaScript",
"bytes": "217699"
},
{
"name": "PLpgSQL",
"bytes": "1577"
},
{
"name": "Python",
"bytes": "1390874"
},
{
"name": "SQLPL",
"bytes": "141212"
},
{
"name": "Shell",
"bytes": "1150"
}
],
"symlink_target": ""
} |
package com.alibaba.dubbo.remoting.transport.netty4.logging;
import io.netty.util.internal.logging.InternalLoggerFactory;
import io.netty.util.internal.logging.Slf4JLoggerFactory;
/**
* @author <a href="mailto:[email protected]">kimi</a>
* @author <a href="mailto:[email protected]">qinliujie</a>
*/
final class NettyHelper {
public static void setNettyLoggerFactory() {
InternalLoggerFactory factory = InternalLoggerFactory.getDefaultFactory();
if (null == factory) {
InternalLoggerFactory.setDefaultFactory(Slf4JLoggerFactory.getDefaultFactory());
}
}
} | {
"content_hash": "297995030132fdce66c44da77c805c29",
"timestamp": "",
"source": "github",
"line_count": 19,
"max_line_length": 83,
"avg_line_length": 30.736842105263158,
"alnum_prop": 0.773972602739726,
"repo_name": "nince-wyj/jahhan",
"id": "594b3e363bb5d8b6960aa904ddd063eaf6f6668b",
"size": "1187",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "frameworkx/dubbo-remoting/dubbo-remoting-netty4/src/main/java/com/alibaba/dubbo/remoting/transport/netty4/logging/NettyHelper.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Java",
"bytes": "3547482"
},
{
"name": "Lex",
"bytes": "2077"
}
],
"symlink_target": ""
} |
namespace boost {
namespace intrusive {
/// @cond
template <class ValueTraits, class SizeType, bool ConstantTimeSize>
struct listopt
{
typedef ValueTraits value_traits;
typedef SizeType size_type;
static const bool constant_time_size = ConstantTimeSize;
};
template <class T>
struct list_defaults
: pack_options
< none
, base_hook<detail::default_list_hook>
, constant_time_size<true>
, size_type<std::size_t>
>::type
{};
/// @endcond
//! The class template list is an intrusive container that mimics most of the
//! interface of std::list as described in the C++ standard.
//!
//! The template parameter \c T is the type to be managed by the container.
//! The user can specify additional options and if no options are provided
//! default options are used.
//!
//! The container supports the following options:
//! \c base_hook<>/member_hook<>/value_traits<>,
//! \c constant_time_size<> and \c size_type<>.
#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
template<class T, class ...Options>
#else
template<class Config>
#endif
class list_impl
: private detail::clear_on_destructor_base< list_impl<Config> >
{
template<class C> friend class detail::clear_on_destructor_base;
//Public typedefs
public:
typedef typename Config::value_traits value_traits;
/// @cond
static const bool external_value_traits =
detail::external_value_traits_bool_is_true<value_traits>::value;
typedef typename detail::eval_if_c
< external_value_traits
, detail::eval_value_traits<value_traits>
, detail::identity<value_traits>
>::type real_value_traits;
/// @endcond
typedef typename real_value_traits::pointer pointer;
typedef typename real_value_traits::const_pointer const_pointer;
typedef typename pointer_traits<pointer>::element_type value_type;
typedef typename pointer_traits<pointer>::reference reference;
typedef typename pointer_traits<const_pointer>::reference const_reference;
typedef typename pointer_traits<pointer>::difference_type difference_type;
typedef typename Config::size_type size_type;
typedef list_iterator<list_impl, false> iterator;
typedef list_iterator<list_impl, true> const_iterator;
typedef boost::intrusive::detail::reverse_iterator<iterator> reverse_iterator;
typedef boost::intrusive::detail::reverse_iterator<const_iterator>const_reverse_iterator;
typedef typename real_value_traits::node_traits node_traits;
typedef typename node_traits::node node;
typedef typename node_traits::node_ptr node_ptr;
typedef typename node_traits::const_node_ptr const_node_ptr;
typedef circular_list_algorithms<node_traits> node_algorithms;
static const bool constant_time_size = Config::constant_time_size;
static const bool stateful_value_traits = detail::is_stateful_value_traits<real_value_traits>::value;
/// @cond
private:
typedef detail::size_holder<constant_time_size, size_type> size_traits;
//noncopyable
BOOST_MOVABLE_BUT_NOT_COPYABLE(list_impl)
enum { safemode_or_autounlink =
(int)real_value_traits::link_mode == (int)auto_unlink ||
(int)real_value_traits::link_mode == (int)safe_link };
//Constant-time size is incompatible with auto-unlink hooks!
BOOST_STATIC_ASSERT(!(constant_time_size &&
((int)real_value_traits::link_mode == (int)auto_unlink)
));
//Const cast emulation for smart pointers
static node_ptr uncast(const const_node_ptr & ptr)
{ return pointer_traits<node_ptr>::const_cast_from(ptr); }
node_ptr get_root_node()
{ return pointer_traits<node_ptr>::pointer_to(data_.root_plus_size_.root_); }
const_node_ptr get_root_node() const
{ return pointer_traits<const_node_ptr>::pointer_to(data_.root_plus_size_.root_); }
struct root_plus_size : public size_traits
{
node root_;
};
struct data_t : public value_traits
{
typedef typename list_impl::value_traits value_traits;
data_t(const value_traits &val_traits)
: value_traits(val_traits)
{}
root_plus_size root_plus_size_;
} data_;
size_traits &priv_size_traits()
{ return data_.root_plus_size_; }
const size_traits &priv_size_traits() const
{ return data_.root_plus_size_; }
const real_value_traits &get_real_value_traits(detail::bool_<false>) const
{ return data_; }
const real_value_traits &get_real_value_traits(detail::bool_<true>) const
{ return data_.get_value_traits(*this); }
real_value_traits &get_real_value_traits(detail::bool_<false>)
{ return data_; }
real_value_traits &get_real_value_traits(detail::bool_<true>)
{ return data_.get_value_traits(*this); }
const value_traits &priv_value_traits() const
{ return data_; }
value_traits &priv_value_traits()
{ return data_; }
protected:
node &prot_root_node()
{ return data_.root_plus_size_.root_; }
node const &prot_root_node() const
{ return data_.root_plus_size_.root_; }
void prot_set_size(size_type s)
{ data_.root_plus_size_.set_size(s); }
/// @endcond
public:
const real_value_traits &get_real_value_traits() const
{ return this->get_real_value_traits(detail::bool_<external_value_traits>()); }
real_value_traits &get_real_value_traits()
{ return this->get_real_value_traits(detail::bool_<external_value_traits>()); }
//! <b>Effects</b>: constructs an empty list.
//!
//! <b>Complexity</b>: Constant
//!
//! <b>Throws</b>: If real_value_traits::node_traits::node
//! constructor throws (this does not happen with predefined Boost.Intrusive hooks).
explicit list_impl(const value_traits &v_traits = value_traits())
: data_(v_traits)
{
this->priv_size_traits().set_size(size_type(0));
node_algorithms::init_header(this->get_root_node());
}
//! <b>Requires</b>: Dereferencing iterator must yield an lvalue of type value_type.
//!
//! <b>Effects</b>: Constructs a list equal to the range [first,last).
//!
//! <b>Complexity</b>: Linear in std::distance(b, e). No copy constructors are called.
//!
//! <b>Throws</b>: If real_value_traits::node_traits::node
//! constructor throws (this does not happen with predefined Boost.Intrusive hooks).
template<class Iterator>
list_impl(Iterator b, Iterator e, const value_traits &v_traits = value_traits())
: data_(v_traits)
{
this->priv_size_traits().set_size(size_type(0));
node_algorithms::init_header(this->get_root_node());
this->insert(this->cend(), b, e);
}
//! <b>Effects</b>: to-do
//!
list_impl(BOOST_RV_REF(list_impl) x)
: data_(::boost::move(x.priv_value_traits()))
{
this->priv_size_traits().set_size(size_type(0));
node_algorithms::init_header(this->get_root_node());
this->swap(x);
}
//! <b>Effects</b>: to-do
//!
list_impl& operator=(BOOST_RV_REF(list_impl) x)
{ this->swap(x); return *this; }
//! <b>Effects</b>: If it's not a safe-mode or an auto-unlink value_type
//! the destructor does nothing
//! (ie. no code is generated). Otherwise it detaches all elements from this.
//! In this case the objects in the list are not deleted (i.e. no destructors
//! are called), but the hooks according to the ValueTraits template parameter
//! are set to their default value.
//!
//! <b>Complexity</b>: Linear to the number of elements in the list, if
//! it's a safe-mode or auto-unlink value . Otherwise constant.
~list_impl()
{}
//! <b>Requires</b>: value must be an lvalue.
//!
//! <b>Effects</b>: Inserts the value in the back of the list.
//! No copy constructors are called.
//!
//! <b>Throws</b>: Nothing.
//!
//! <b>Complexity</b>: Constant.
//!
//! <b>Note</b>: Does not affect the validity of iterators and references.
void push_back(reference value)
{
node_ptr to_insert = get_real_value_traits().to_node_ptr(value);
if(safemode_or_autounlink)
BOOST_INTRUSIVE_SAFE_HOOK_DEFAULT_ASSERT(node_algorithms::inited(to_insert));
node_algorithms::link_before(this->get_root_node(), to_insert);
this->priv_size_traits().increment();
}
//! <b>Requires</b>: value must be an lvalue.
//!
//! <b>Effects</b>: Inserts the value in the front of the list.
//! No copy constructors are called.
//!
//! <b>Throws</b>: Nothing.
//!
//! <b>Complexity</b>: Constant.
//!
//! <b>Note</b>: Does not affect the validity of iterators and references.
void push_front(reference value)
{
node_ptr to_insert = get_real_value_traits().to_node_ptr(value);
if(safemode_or_autounlink)
BOOST_INTRUSIVE_SAFE_HOOK_DEFAULT_ASSERT(node_algorithms::inited(to_insert));
node_algorithms::link_before(node_traits::get_next(this->get_root_node()), to_insert);
this->priv_size_traits().increment();
}
//! <b>Effects</b>: Erases the last element of the list.
//! No destructors are called.
//!
//! <b>Throws</b>: Nothing.
//!
//! <b>Complexity</b>: Constant.
//!
//! <b>Note</b>: Invalidates the iterators (but not the references) to the erased element.
void pop_back()
{ return this->pop_back_and_dispose(detail::null_disposer()); }
//! <b>Requires</b>: Disposer::operator()(pointer) shouldn't throw.
//!
//! <b>Effects</b>: Erases the last element of the list.
//! No destructors are called.
//! Disposer::operator()(pointer) is called for the removed element.
//!
//! <b>Throws</b>: Nothing.
//!
//! <b>Complexity</b>: Constant.
//!
//! <b>Note</b>: Invalidates the iterators to the erased element.
template<class Disposer>
void pop_back_and_dispose(Disposer disposer)
{
node_ptr to_erase = node_traits::get_previous(this->get_root_node());
node_algorithms::unlink(to_erase);
this->priv_size_traits().decrement();
if(safemode_or_autounlink)
node_algorithms::init(to_erase);
disposer(get_real_value_traits().to_value_ptr(to_erase));
}
//! <b>Effects</b>: Erases the first element of the list.
//! No destructors are called.
//!
//! <b>Throws</b>: Nothing.
//!
//! <b>Complexity</b>: Constant.
//!
//! <b>Note</b>: Invalidates the iterators (but not the references) to the erased element.
void pop_front()
{ return this->pop_front_and_dispose(detail::null_disposer()); }
//! <b>Requires</b>: Disposer::operator()(pointer) shouldn't throw.
//!
//! <b>Effects</b>: Erases the first element of the list.
//! No destructors are called.
//! Disposer::operator()(pointer) is called for the removed element.
//!
//! <b>Throws</b>: Nothing.
//!
//! <b>Complexity</b>: Constant.
//!
//! <b>Note</b>: Invalidates the iterators to the erased element.
template<class Disposer>
void pop_front_and_dispose(Disposer disposer)
{
node_ptr to_erase = node_traits::get_next(this->get_root_node());
node_algorithms::unlink(to_erase);
this->priv_size_traits().decrement();
if(safemode_or_autounlink)
node_algorithms::init(to_erase);
disposer(get_real_value_traits().to_value_ptr(to_erase));
}
//! <b>Effects</b>: Returns a reference to the first element of the list.
//!
//! <b>Throws</b>: Nothing.
//!
//! <b>Complexity</b>: Constant.
reference front()
{ return *get_real_value_traits().to_value_ptr(node_traits::get_next(this->get_root_node())); }
//! <b>Effects</b>: Returns a const_reference to the first element of the list.
//!
//! <b>Throws</b>: Nothing.
//!
//! <b>Complexity</b>: Constant.
const_reference front() const
{ return *get_real_value_traits().to_value_ptr(uncast(node_traits::get_next(this->get_root_node()))); }
//! <b>Effects</b>: Returns a reference to the last element of the list.
//!
//! <b>Throws</b>: Nothing.
//!
//! <b>Complexity</b>: Constant.
reference back()
{ return *get_real_value_traits().to_value_ptr(node_traits::get_previous(this->get_root_node())); }
//! <b>Effects</b>: Returns a const_reference to the last element of the list.
//!
//! <b>Throws</b>: Nothing.
//!
//! <b>Complexity</b>: Constant.
const_reference back() const
{ return *get_real_value_traits().to_value_ptr(uncast(node_traits::get_previous(this->get_root_node()))); }
//! <b>Effects</b>: Returns an iterator to the first element contained in the list.
//!
//! <b>Throws</b>: Nothing.
//!
//! <b>Complexity</b>: Constant.
iterator begin()
{ return iterator(node_traits::get_next(this->get_root_node()), this); }
//! <b>Effects</b>: Returns a const_iterator to the first element contained in the list.
//!
//! <b>Throws</b>: Nothing.
//!
//! <b>Complexity</b>: Constant.
const_iterator begin() const
{ return this->cbegin(); }
//! <b>Effects</b>: Returns a const_iterator to the first element contained in the list.
//!
//! <b>Throws</b>: Nothing.
//!
//! <b>Complexity</b>: Constant.
const_iterator cbegin() const
{ return const_iterator(node_traits::get_next(this->get_root_node()), this); }
//! <b>Effects</b>: Returns an iterator to the end of the list.
//!
//! <b>Throws</b>: Nothing.
//!
//! <b>Complexity</b>: Constant.
iterator end()
{ return iterator(this->get_root_node(), this); }
//! <b>Effects</b>: Returns a const_iterator to the end of the list.
//!
//! <b>Throws</b>: Nothing.
//!
//! <b>Complexity</b>: Constant.
const_iterator end() const
{ return this->cend(); }
//! <b>Effects</b>: Returns a constant iterator to the end of the list.
//!
//! <b>Throws</b>: Nothing.
//!
//! <b>Complexity</b>: Constant.
const_iterator cend() const
{ return const_iterator(uncast(this->get_root_node()), this); }
//! <b>Effects</b>: Returns a reverse_iterator pointing to the beginning
//! of the reversed list.
//!
//! <b>Throws</b>: Nothing.
//!
//! <b>Complexity</b>: Constant.
reverse_iterator rbegin()
{ return reverse_iterator(this->end()); }
//! <b>Effects</b>: Returns a const_reverse_iterator pointing to the beginning
//! of the reversed list.
//!
//! <b>Throws</b>: Nothing.
//!
//! <b>Complexity</b>: Constant.
const_reverse_iterator rbegin() const
{ return this->crbegin(); }
//! <b>Effects</b>: Returns a const_reverse_iterator pointing to the beginning
//! of the reversed list.
//!
//! <b>Throws</b>: Nothing.
//!
//! <b>Complexity</b>: Constant.
const_reverse_iterator crbegin() const
{ return const_reverse_iterator(end()); }
//! <b>Effects</b>: Returns a reverse_iterator pointing to the end
//! of the reversed list.
//!
//! <b>Throws</b>: Nothing.
//!
//! <b>Complexity</b>: Constant.
reverse_iterator rend()
{ return reverse_iterator(begin()); }
//! <b>Effects</b>: Returns a const_reverse_iterator pointing to the end
//! of the reversed list.
//!
//! <b>Throws</b>: Nothing.
//!
//! <b>Complexity</b>: Constant.
const_reverse_iterator rend() const
{ return this->crend(); }
//! <b>Effects</b>: Returns a const_reverse_iterator pointing to the end
//! of the reversed list.
//!
//! <b>Throws</b>: Nothing.
//!
//! <b>Complexity</b>: Constant.
const_reverse_iterator crend() const
{ return const_reverse_iterator(this->begin()); }
//! <b>Precondition</b>: end_iterator must be a valid end iterator
//! of list.
//!
//! <b>Effects</b>: Returns a const reference to the list associated to the end iterator
//!
//! <b>Throws</b>: Nothing.
//!
//! <b>Complexity</b>: Constant.
static list_impl &container_from_end_iterator(iterator end_iterator)
{ return list_impl::priv_container_from_end_iterator(end_iterator); }
//! <b>Precondition</b>: end_iterator must be a valid end const_iterator
//! of list.
//!
//! <b>Effects</b>: Returns a const reference to the list associated to the end iterator
//!
//! <b>Throws</b>: Nothing.
//!
//! <b>Complexity</b>: Constant.
static const list_impl &container_from_end_iterator(const_iterator end_iterator)
{ return list_impl::priv_container_from_end_iterator(end_iterator); }
//! <b>Effects</b>: Returns the number of the elements contained in the list.
//!
//! <b>Throws</b>: Nothing.
//!
//! <b>Complexity</b>: Linear to the number of elements contained in the list.
//! if constant-time size option is disabled. Constant time otherwise.
//!
//! <b>Note</b>: Does not affect the validity of iterators and references.
size_type size() const
{
if(constant_time_size)
return this->priv_size_traits().get_size();
else
return node_algorithms::count(this->get_root_node()) - 1;
}
//! <b>Effects</b>: Returns true if the list contains no elements.
//!
//! <b>Throws</b>: Nothing.
//!
//! <b>Complexity</b>: Constant.
//!
//! <b>Note</b>: Does not affect the validity of iterators and references.
bool empty() const
{ return node_algorithms::unique(this->get_root_node()); }
//! <b>Effects</b>: Swaps the elements of x and *this.
//!
//! <b>Throws</b>: Nothing.
//!
//! <b>Complexity</b>: Constant.
//!
//! <b>Note</b>: Does not affect the validity of iterators and references.
void swap(list_impl& other)
{
node_algorithms::swap_nodes(this->get_root_node(), other.get_root_node());
if(constant_time_size){
size_type backup = this->priv_size_traits().get_size();
this->priv_size_traits().set_size(other.priv_size_traits().get_size());
other.priv_size_traits().set_size(backup);
}
}
//! <b>Effects</b>: Moves backwards all the elements, so that the first
//! element becomes the second, the second becomes the third...
//! the last element becomes the first one.
//!
//! <b>Throws</b>: Nothing.
//!
//! <b>Complexity</b>: Linear to the number of shifts.
//!
//! <b>Note</b>: Does not affect the validity of iterators and references.
void shift_backwards(size_type n = 1)
{ node_algorithms::move_forward(this->get_root_node(), n); }
//! <b>Effects</b>: Moves forward all the elements, so that the second
//! element becomes the first, the third becomes the second...
//! the first element becomes the last one.
//!
//! <b>Throws</b>: Nothing.
//!
//! <b>Complexity</b>: Linear to the number of shifts.
//!
//! <b>Note</b>: Does not affect the validity of iterators and references.
void shift_forward(size_type n = 1)
{ node_algorithms::move_backwards(this->get_root_node(), n); }
//! <b>Effects</b>: Erases the element pointed by i of the list.
//! No destructors are called.
//!
//! <b>Returns</b>: the first element remaining beyond the removed element,
//! or end() if no such element exists.
//!
//! <b>Throws</b>: Nothing.
//!
//! <b>Complexity</b>: Constant.
//!
//! <b>Note</b>: Invalidates the iterators (but not the references) to the
//! erased element.
iterator erase(const_iterator i)
{ return this->erase_and_dispose(i, detail::null_disposer()); }
//! <b>Requires</b>: b and e must be valid iterators to elements in *this.
//!
//! <b>Effects</b>: Erases the element range pointed by b and e
//! No destructors are called.
//!
//! <b>Returns</b>: the first element remaining beyond the removed elements,
//! or end() if no such element exists.
//!
//! <b>Throws</b>: Nothing.
//!
//! <b>Complexity</b>: Linear to the number of erased elements if it's a safe-mode
//! or auto-unlink value, or constant-time size is enabled. Constant-time otherwise.
//!
//! <b>Note</b>: Invalidates the iterators (but not the references) to the
//! erased elements.
iterator erase(const_iterator b, const_iterator e)
{
if(safemode_or_autounlink || constant_time_size){
return this->erase_and_dispose(b, e, detail::null_disposer());
}
else{
node_algorithms::unlink(b.pointed_node(), e.pointed_node());
return e.unconst();
}
}
//! <b>Requires</b>: b and e must be valid iterators to elements in *this.
//! n must be std::distance(b, e).
//!
//! <b>Effects</b>: Erases the element range pointed by b and e
//! No destructors are called.
//!
//! <b>Returns</b>: the first element remaining beyond the removed elements,
//! or end() if no such element exists.
//!
//! <b>Throws</b>: Nothing.
//!
//! <b>Complexity</b>: Linear to the number of erased elements if it's a safe-mode
//! or auto-unlink value is enabled. Constant-time otherwise.
//!
//! <b>Note</b>: Invalidates the iterators (but not the references) to the
//! erased elements.
iterator erase(const_iterator b, const_iterator e, difference_type n)
{
BOOST_INTRUSIVE_INVARIANT_ASSERT(std::distance(b, e) == difference_type(n));
if(safemode_or_autounlink || constant_time_size){
return this->erase_and_dispose(b, e, detail::null_disposer());
}
else{
if(constant_time_size){
this->priv_size_traits().decrease(n);
}
node_algorithms::unlink(b.pointed_node(), e.pointed_node());
return e.unconst();
}
}
//! <b>Requires</b>: Disposer::operator()(pointer) shouldn't throw.
//!
//! <b>Effects</b>: Erases the element pointed by i of the list.
//! No destructors are called.
//! Disposer::operator()(pointer) is called for the removed element.
//!
//! <b>Returns</b>: the first element remaining beyond the removed element,
//! or end() if no such element exists.
//!
//! <b>Throws</b>: Nothing.
//!
//! <b>Complexity</b>: Constant.
//!
//! <b>Note</b>: Invalidates the iterators to the erased element.
template <class Disposer>
iterator erase_and_dispose(const_iterator i, Disposer disposer)
{
node_ptr to_erase(i.pointed_node());
++i;
node_algorithms::unlink(to_erase);
this->priv_size_traits().decrement();
if(safemode_or_autounlink)
node_algorithms::init(to_erase);
disposer(this->get_real_value_traits().to_value_ptr(to_erase));
return i.unconst();
}
#if !defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
template<class Disposer>
iterator erase_and_dispose(iterator i, Disposer disposer)
{ return this->erase_and_dispose(const_iterator(i), disposer); }
#endif
//! <b>Requires</b>: Disposer::operator()(pointer) shouldn't throw.
//!
//! <b>Effects</b>: Erases the element range pointed by b and e
//! No destructors are called.
//! Disposer::operator()(pointer) is called for the removed elements.
//!
//! <b>Returns</b>: the first element remaining beyond the removed elements,
//! or end() if no such element exists.
//!
//! <b>Throws</b>: Nothing.
//!
//! <b>Complexity</b>: Linear to the number of elements erased.
//!
//! <b>Note</b>: Invalidates the iterators to the erased elements.
template <class Disposer>
iterator erase_and_dispose(const_iterator b, const_iterator e, Disposer disposer)
{
node_ptr bp(b.pointed_node()), ep(e.pointed_node());
node_algorithms::unlink(bp, ep);
while(bp != ep){
node_ptr to_erase(bp);
bp = node_traits::get_next(bp);
if(safemode_or_autounlink)
node_algorithms::init(to_erase);
disposer(get_real_value_traits().to_value_ptr(to_erase));
this->priv_size_traits().decrement();
}
return e.unconst();
}
//! <b>Effects</b>: Erases all the elements of the container.
//! No destructors are called.
//!
//! <b>Throws</b>: Nothing.
//!
//! <b>Complexity</b>: Linear to the number of elements of the list.
//! if it's a safe-mode or auto-unlink value_type. Constant time otherwise.
//!
//! <b>Note</b>: Invalidates the iterators (but not the references) to the erased elements.
void clear()
{
if(safemode_or_autounlink){
this->clear_and_dispose(detail::null_disposer());
}
else{
node_algorithms::init_header(this->get_root_node());
this->priv_size_traits().set_size(size_type(0));
}
}
//! <b>Requires</b>: Disposer::operator()(pointer) shouldn't throw.
//!
//! <b>Effects</b>: Erases all the elements of the container.
//! No destructors are called.
//! Disposer::operator()(pointer) is called for the removed elements.
//!
//! <b>Throws</b>: Nothing.
//!
//! <b>Complexity</b>: Linear to the number of elements of the list.
//!
//! <b>Note</b>: Invalidates the iterators to the erased elements.
template <class Disposer>
void clear_and_dispose(Disposer disposer)
{
const_iterator it(this->begin()), itend(this->end());
while(it != itend){
node_ptr to_erase(it.pointed_node());
++it;
if(safemode_or_autounlink)
node_algorithms::init(to_erase);
disposer(get_real_value_traits().to_value_ptr(to_erase));
}
node_algorithms::init_header(this->get_root_node());
this->priv_size_traits().set_size(0);
}
//! <b>Requires</b>: Disposer::operator()(pointer) shouldn't throw.
//! Cloner should yield to nodes equivalent to the original nodes.
//!
//! <b>Effects</b>: Erases all the elements from *this
//! calling Disposer::operator()(pointer), clones all the
//! elements from src calling Cloner::operator()(const_reference )
//! and inserts them on *this.
//!
//! If cloner throws, all cloned elements are unlinked and disposed
//! calling Disposer::operator()(pointer).
//!
//! <b>Complexity</b>: Linear to erased plus inserted elements.
//!
//! <b>Throws</b>: If cloner throws. Basic guarantee.
template <class Cloner, class Disposer>
void clone_from(const list_impl &src, Cloner cloner, Disposer disposer)
{
this->clear_and_dispose(disposer);
detail::exception_disposer<list_impl, Disposer>
rollback(*this, disposer);
const_iterator b(src.begin()), e(src.end());
for(; b != e; ++b){
this->push_back(*cloner(*b));
}
rollback.release();
}
//! <b>Requires</b>: value must be an lvalue and p must be a valid iterator of *this.
//!
//! <b>Effects</b>: Inserts the value before the position pointed by p.
//!
//! <b>Returns</b>: An iterator to the inserted element.
//!
//! <b>Throws</b>: Nothing.
//!
//! <b>Complexity</b>: Constant time. No copy constructors are called.
//!
//! <b>Note</b>: Does not affect the validity of iterators and references.
iterator insert(const_iterator p, reference value)
{
node_ptr to_insert = this->get_real_value_traits().to_node_ptr(value);
if(safemode_or_autounlink)
BOOST_INTRUSIVE_SAFE_HOOK_DEFAULT_ASSERT(node_algorithms::inited(to_insert));
node_algorithms::link_before(p.pointed_node(), to_insert);
this->priv_size_traits().increment();
return iterator(to_insert, this);
}
//! <b>Requires</b>: Dereferencing iterator must yield
//! an lvalue of type value_type and p must be a valid iterator of *this.
//!
//! <b>Effects</b>: Inserts the range pointed by b and e before the position p.
//! No copy constructors are called.
//!
//! <b>Throws</b>: Nothing.
//!
//! <b>Complexity</b>: Linear to the number of elements inserted.
//!
//! <b>Note</b>: Does not affect the validity of iterators and references.
template<class Iterator>
void insert(const_iterator p, Iterator b, Iterator e)
{
for (; b != e; ++b)
this->insert(p, *b);
}
//! <b>Requires</b>: Dereferencing iterator must yield
//! an lvalue of type value_type.
//!
//! <b>Effects</b>: Clears the list and inserts the range pointed by b and e.
//! No destructors or copy constructors are called.
//!
//! <b>Throws</b>: Nothing.
//!
//! <b>Complexity</b>: Linear to the number of elements inserted plus
//! linear to the elements contained in the list if it's a safe-mode
//! or auto-unlink value.
//! Linear to the number of elements inserted in the list otherwise.
//!
//! <b>Note</b>: Invalidates the iterators (but not the references)
//! to the erased elements.
template<class Iterator>
void assign(Iterator b, Iterator e)
{
this->clear();
this->insert(this->cend(), b, e);
}
//! <b>Requires</b>: Disposer::operator()(pointer) shouldn't throw.
//!
//! <b>Requires</b>: Dereferencing iterator must yield
//! an lvalue of type value_type.
//!
//! <b>Effects</b>: Clears the list and inserts the range pointed by b and e.
//! No destructors or copy constructors are called.
//! Disposer::operator()(pointer) is called for the removed elements.
//!
//! <b>Throws</b>: Nothing.
//!
//! <b>Complexity</b>: Linear to the number of elements inserted plus
//! linear to the elements contained in the list.
//!
//! <b>Note</b>: Invalidates the iterators (but not the references)
//! to the erased elements.
template<class Iterator, class Disposer>
void dispose_and_assign(Disposer disposer, Iterator b, Iterator e)
{
this->clear_and_dispose(disposer);
this->insert(this->cend(), b, e);
}
//! <b>Requires</b>: p must be a valid iterator of *this.
//!
//! <b>Effects</b>: Transfers all the elements of list x to this list, before the
//! the element pointed by p. No destructors or copy constructors are called.
//!
//! <b>Throws</b>: Nothing.
//!
//! <b>Complexity</b>: Constant.
//!
//! <b>Note</b>: Iterators of values obtained from list x now point to elements of
//! this list. Iterators of this list and all the references are not invalidated.
void splice(const_iterator p, list_impl& x)
{
if(!x.empty()){
node_algorithms::transfer
(p.pointed_node(), x.begin().pointed_node(), x.end().pointed_node());
size_traits &thist = this->priv_size_traits();
size_traits &xt = x.priv_size_traits();
thist.increase(xt.get_size());
xt.set_size(size_type(0));
}
}
//! <b>Requires</b>: p must be a valid iterator of *this.
//! new_ele must point to an element contained in list x.
//!
//! <b>Effects</b>: Transfers the value pointed by new_ele, from list x to this list,
//! before the the element pointed by p. No destructors or copy constructors are called.
//! If p == new_ele or p == ++new_ele, this function is a null operation.
//!
//! <b>Throws</b>: Nothing.
//!
//! <b>Complexity</b>: Constant.
//!
//! <b>Note</b>: Iterators of values obtained from list x now point to elements of this
//! list. Iterators of this list and all the references are not invalidated.
void splice(const_iterator p, list_impl&x, const_iterator new_ele)
{
node_algorithms::transfer(p.pointed_node(), new_ele.pointed_node());
x.priv_size_traits().decrement();
this->priv_size_traits().increment();
}
//! <b>Requires</b>: p must be a valid iterator of *this.
//! f and e must point to elements contained in list x.
//!
//! <b>Effects</b>: Transfers the range pointed by f and e from list x to this list,
//! before the the element pointed by p. No destructors or copy constructors are called.
//!
//! <b>Throws</b>: Nothing.
//!
//! <b>Complexity</b>: Linear to the number of elements transferred
//! if constant-time size option is enabled. Constant-time otherwise.
//!
//! <b>Note</b>: Iterators of values obtained from list x now point to elements of this
//! list. Iterators of this list and all the references are not invalidated.
void splice(const_iterator p, list_impl&x, const_iterator f, const_iterator e)
{
if(constant_time_size)
this->splice(p, x, f, e, std::distance(f, e));
else
this->splice(p, x, f, e, 1);//distance is a dummy value
}
//! <b>Requires</b>: p must be a valid iterator of *this.
//! f and e must point to elements contained in list x.
//! n == std::distance(f, e)
//!
//! <b>Effects</b>: Transfers the range pointed by f and e from list x to this list,
//! before the the element pointed by p. No destructors or copy constructors are called.
//!
//! <b>Throws</b>: Nothing.
//!
//! <b>Complexity</b>: Constant.
//!
//! <b>Note</b>: Iterators of values obtained from list x now point to elements of this
//! list. Iterators of this list and all the references are not invalidated.
void splice(const_iterator p, list_impl&x, const_iterator f, const_iterator e, difference_type n)
{
if(n){
if(constant_time_size){
BOOST_INTRUSIVE_INVARIANT_ASSERT(n == std::distance(f, e));
node_algorithms::transfer(p.pointed_node(), f.pointed_node(), e.pointed_node());
size_traits &thist = this->priv_size_traits();
size_traits &xt = x.priv_size_traits();
thist.increase(n);
xt.decrease(n);
}
else{
node_algorithms::transfer(p.pointed_node(), f.pointed_node(), e.pointed_node());
}
}
}
//! <b>Effects</b>: This function sorts the list *this according to std::less<value_type>.
//! The sort is stable, that is, the relative order of equivalent elements is preserved.
//!
//! <b>Throws</b>: If real_value_traits::node_traits::node
//! constructor throws (this does not happen with predefined Boost.Intrusive hooks)
//! or std::less<value_type> throws. Basic guarantee.
//!
//! <b>Notes</b>: Iterators and references are not invalidated.
//!
//! <b>Complexity</b>: The number of comparisons is approximately N log N, where N
//! is the list's size.
void sort()
{ this->sort(std::less<value_type>()); }
//! <b>Requires</b>: p must be a comparison function that induces a strict weak ordering
//!
//! <b>Effects</b>: This function sorts the list *this according to p. The sort is
//! stable, that is, the relative order of equivalent elements is preserved.
//!
//! <b>Throws</b>: If real_value_traits::node_traits::node
//! constructor throws (this does not happen with predefined Boost.Intrusive hooks)
//! or the predicate throws. Basic guarantee.
//!
//! <b>Notes</b>: This won't throw if list_base_hook<> or
//! list_member_hook are used.
//! Iterators and references are not invalidated.
//!
//! <b>Complexity</b>: The number of comparisons is approximately N log N, where N
//! is the list's size.
template<class Predicate>
void sort(Predicate p)
{
if(node_traits::get_next(this->get_root_node())
!= node_traits::get_previous(this->get_root_node())){
list_impl carry(this->priv_value_traits());
detail::array_initializer<list_impl, 64> counter(this->priv_value_traits());
int fill = 0;
while(!this->empty()){
carry.splice(carry.cbegin(), *this, this->cbegin());
int i = 0;
while(i < fill && !counter[i].empty()) {
counter[i].merge(carry, p);
carry.swap(counter[i++]);
}
carry.swap(counter[i]);
if(i == fill)
++fill;
}
for (int i = 1; i < fill; ++i)
counter[i].merge(counter[i-1], p);
this->swap(counter[fill-1]);
}
}
//! <b>Effects</b>: This function removes all of x's elements and inserts them
//! in order into *this according to std::less<value_type>. The merge is stable;
//! that is, if an element from *this is equivalent to one from x, then the element
//! from *this will precede the one from x.
//!
//! <b>Throws</b>: If std::less<value_type> throws. Basic guarantee.
//!
//! <b>Complexity</b>: This function is linear time: it performs at most
//! size() + x.size() - 1 comparisons.
//!
//! <b>Note</b>: Iterators and references are not invalidated
void merge(list_impl& x)
{ this->merge(x, std::less<value_type>()); }
//! <b>Requires</b>: p must be a comparison function that induces a strict weak
//! ordering and both *this and x must be sorted according to that ordering
//! The lists x and *this must be distinct.
//!
//! <b>Effects</b>: This function removes all of x's elements and inserts them
//! in order into *this. The merge is stable; that is, if an element from *this is
//! equivalent to one from x, then the element from *this will precede the one from x.
//!
//! <b>Throws</b>: If the predicate throws. Basic guarantee.
//!
//! <b>Complexity</b>: This function is linear time: it performs at most
//! size() + x.size() - 1 comparisons.
//!
//! <b>Note</b>: Iterators and references are not invalidated.
template<class Predicate>
void merge(list_impl& x, Predicate p)
{
const_iterator e(this->cend()), ex(x.cend());
const_iterator b(this->cbegin());
while(!x.empty()){
const_iterator ix(x.cbegin());
while (b != e && !p(*ix, *b)){
++b;
}
if(b == e){
//Now transfer the rest to the end of the container
this->splice(e, x);
break;
}
else{
size_type n(0);
do{
++ix; ++n;
} while(ix != ex && p(*ix, *b));
this->splice(b, x, x.begin(), ix, n);
}
}
}
//! <b>Effects</b>: Reverses the order of elements in the list.
//!
//! <b>Throws</b>: Nothing.
//!
//! <b>Complexity</b>: This function is linear time.
//!
//! <b>Note</b>: Iterators and references are not invalidated
void reverse()
{ node_algorithms::reverse(this->get_root_node()); }
//! <b>Effects</b>: Removes all the elements that compare equal to value.
//! No destructors are called.
//!
//! <b>Throws</b>: If std::equal_to<value_type> throws. Basic guarantee.
//!
//! <b>Complexity</b>: Linear time. It performs exactly size() comparisons for equality.
//!
//! <b>Note</b>: The relative order of elements that are not removed is unchanged,
//! and iterators to elements that are not removed remain valid.
void remove(const_reference value)
{ this->remove_if(detail::equal_to_value<const_reference>(value)); }
//! <b>Requires</b>: Disposer::operator()(pointer) shouldn't throw.
//!
//! <b>Effects</b>: Removes all the elements that compare equal to value.
//! Disposer::operator()(pointer) is called for every removed element.
//!
//! <b>Throws</b>: If std::equal_to<value_type> throws. Basic guarantee.
//!
//! <b>Complexity</b>: Linear time. It performs exactly size() comparisons for equality.
//!
//! <b>Note</b>: The relative order of elements that are not removed is unchanged,
//! and iterators to elements that are not removed remain valid.
template<class Disposer>
void remove_and_dispose(const_reference value, Disposer disposer)
{ this->remove_and_dispose_if(detail::equal_to_value<const_reference>(value), disposer); }
//! <b>Effects</b>: Removes all the elements for which a specified
//! predicate is satisfied. No destructors are called.
//!
//! <b>Throws</b>: If pred throws. Basic guarantee.
//!
//! <b>Complexity</b>: Linear time. It performs exactly size() calls to the predicate.
//!
//! <b>Note</b>: The relative order of elements that are not removed is unchanged,
//! and iterators to elements that are not removed remain valid.
template<class Pred>
void remove_if(Pred pred)
{ this->remove_and_dispose_if(pred, detail::null_disposer()); }
//! <b>Requires</b>: Disposer::operator()(pointer) shouldn't throw.
//!
//! <b>Effects</b>: Removes all the elements for which a specified
//! predicate is satisfied.
//! Disposer::operator()(pointer) is called for every removed element.
//!
//! <b>Throws</b>: If pred throws. Basic guarantee.
//!
//! <b>Complexity</b>: Linear time. It performs exactly size() comparisons for equality.
//!
//! <b>Note</b>: The relative order of elements that are not removed is unchanged,
//! and iterators to elements that are not removed remain valid.
template<class Pred, class Disposer>
void remove_and_dispose_if(Pred pred, Disposer disposer)
{
const_iterator cur(this->cbegin());
const_iterator last(this->cend());
while(cur != last) {
if(pred(*cur)){
cur = this->erase_and_dispose(cur, disposer);
}
else{
++cur;
}
}
}
//! <b>Effects</b>: Removes adjacent duplicate elements or adjacent
//! elements that are equal from the list. No destructors are called.
//!
//! <b>Throws</b>: If std::equal_to<value_type throws. Basic guarantee.
//!
//! <b>Complexity</b>: Linear time (size()-1 comparisons calls to pred()).
//!
//! <b>Note</b>: The relative order of elements that are not removed is unchanged,
//! and iterators to elements that are not removed remain valid.
void unique()
{ this->unique_and_dispose(std::equal_to<value_type>(), detail::null_disposer()); }
//! <b>Effects</b>: Removes adjacent duplicate elements or adjacent
//! elements that satisfy some binary predicate from the list.
//! No destructors are called.
//!
//! <b>Throws</b>: If pred throws. Basic guarantee.
//!
//! <b>Complexity</b>: Linear time (size()-1 comparisons equality comparisons).
//!
//! <b>Note</b>: The relative order of elements that are not removed is unchanged,
//! and iterators to elements that are not removed remain valid.
template<class BinaryPredicate>
void unique(BinaryPredicate pred)
{ this->unique_and_dispose(pred, detail::null_disposer()); }
//! <b>Requires</b>: Disposer::operator()(pointer) shouldn't throw.
//!
//! <b>Effects</b>: Removes adjacent duplicate elements or adjacent
//! elements that are equal from the list.
//! Disposer::operator()(pointer) is called for every removed element.
//!
//! <b>Throws</b>: If std::equal_to<value_type throws. Basic guarantee.
//!
//! <b>Complexity</b>: Linear time (size()-1) comparisons equality comparisons.
//!
//! <b>Note</b>: The relative order of elements that are not removed is unchanged,
//! and iterators to elements that are not removed remain valid.
template<class Disposer>
void unique_and_dispose(Disposer disposer)
{ this->unique_and_dispose(std::equal_to<value_type>(), disposer); }
//! <b>Requires</b>: Disposer::operator()(pointer) shouldn't throw.
//!
//! <b>Effects</b>: Removes adjacent duplicate elements or adjacent
//! elements that satisfy some binary predicate from the list.
//! Disposer::operator()(pointer) is called for every removed element.
//!
//! <b>Throws</b>: If pred throws. Basic guarantee.
//!
//! <b>Complexity</b>: Linear time (size()-1) comparisons equality comparisons.
//!
//! <b>Note</b>: The relative order of elements that are not removed is unchanged,
//! and iterators to elements that are not removed remain valid.
template<class BinaryPredicate, class Disposer>
void unique_and_dispose(BinaryPredicate pred, Disposer disposer)
{
const_iterator itend(this->cend());
const_iterator cur(this->cbegin());
if(cur != itend){
const_iterator after(cur);
++after;
while(after != itend){
if(pred(*cur, *after)){
after = this->erase_and_dispose(after, disposer);
}
else{
cur = after;
++after;
}
}
}
}
//! <b>Requires</b>: value must be a reference to a value inserted in a list.
//!
//! <b>Effects</b>: This function returns a const_iterator pointing to the element
//!
//! <b>Throws</b>: Nothing.
//!
//! <b>Complexity</b>: Constant time.
//!
//! <b>Note</b>: Iterators and references are not invalidated.
//! This static function is available only if the <i>value traits</i>
//! is stateless.
static iterator s_iterator_to(reference value)
{
BOOST_STATIC_ASSERT((!stateful_value_traits));
BOOST_INTRUSIVE_INVARIANT_ASSERT(!node_algorithms::inited(real_value_traits::to_node_ptr(value)));
return iterator(real_value_traits::to_node_ptr(value), 0);
}
//! <b>Requires</b>: value must be a const reference to a value inserted in a list.
//!
//! <b>Effects</b>: This function returns an iterator pointing to the element.
//!
//! <b>Throws</b>: Nothing.
//!
//! <b>Complexity</b>: Constant time.
//!
//! <b>Note</b>: Iterators and references are not invalidated.
//! This static function is available only if the <i>value traits</i>
//! is stateless.
static const_iterator s_iterator_to(const_reference value)
{
BOOST_STATIC_ASSERT((!stateful_value_traits));
BOOST_INTRUSIVE_INVARIANT_ASSERT(!node_algorithms::inited(real_value_traits::to_node_ptr(const_cast<reference> (value))));
return const_iterator(real_value_traits::to_node_ptr(const_cast<reference> (value)), 0);
}
//! <b>Requires</b>: value must be a reference to a value inserted in a list.
//!
//! <b>Effects</b>: This function returns a const_iterator pointing to the element
//!
//! <b>Throws</b>: Nothing.
//!
//! <b>Complexity</b>: Constant time.
//!
//! <b>Note</b>: Iterators and references are not invalidated.
iterator iterator_to(reference value)
{
BOOST_INTRUSIVE_INVARIANT_ASSERT(!node_algorithms::inited(real_value_traits::to_node_ptr(value)));
return iterator(real_value_traits::to_node_ptr(value), this);
}
//! <b>Requires</b>: value must be a const reference to a value inserted in a list.
//!
//! <b>Effects</b>: This function returns an iterator pointing to the element.
//!
//! <b>Throws</b>: Nothing.
//!
//! <b>Complexity</b>: Constant time.
//!
//! <b>Note</b>: Iterators and references are not invalidated.
const_iterator iterator_to(const_reference value) const
{
BOOST_INTRUSIVE_INVARIANT_ASSERT(!node_algorithms::inited(real_value_traits::to_node_ptr(const_cast<reference> (value))));
return const_iterator(real_value_traits::to_node_ptr(const_cast<reference> (value)), this);
}
/// @cond
private:
static list_impl &priv_container_from_end_iterator(const const_iterator &end_iterator)
{
root_plus_size *r = detail::parent_from_member<root_plus_size, node>
( boost::intrusive::detail::to_raw_pointer(end_iterator.pointed_node()), &root_plus_size::root_);
data_t *d = detail::parent_from_member<data_t, root_plus_size>
( r, &data_t::root_plus_size_);
list_impl *s = detail::parent_from_member<list_impl, data_t>(d, &list_impl::data_);
return *s;
}
/// @endcond
};
#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
template<class T, class ...Options>
#else
template<class Config>
#endif
inline bool operator<
#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
(const list_impl<T, Options...> &x, const list_impl<T, Options...> &y)
#else
(const list_impl<Config> &x, const list_impl<Config> &y)
#endif
{ return std::lexicographical_compare(x.begin(), x.end(), y.begin(), y.end()); }
#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
template<class T, class ...Options>
#else
template<class Config>
#endif
bool operator==
#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
(const list_impl<T, Options...> &x, const list_impl<T, Options...> &y)
#else
(const list_impl<Config> &x, const list_impl<Config> &y)
#endif
{
typedef list_impl<Config> list_type;
typedef typename list_type::const_iterator const_iterator;
const bool C = list_type::constant_time_size;
if(C && x.size() != y.size()){
return false;
}
const_iterator end1 = x.end();
const_iterator i1 = x.begin();
const_iterator i2 = y.begin();
if(C){
while (i1 != end1 && *i1 == *i2) {
++i1;
++i2;
}
return i1 == end1;
}
else{
const_iterator end2 = y.end();
while (i1 != end1 && i2 != end2 && *i1 == *i2) {
++i1;
++i2;
}
return i1 == end1 && i2 == end2;
}
}
#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
template<class T, class ...Options>
#else
template<class Config>
#endif
inline bool operator!=
#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
(const list_impl<T, Options...> &x, const list_impl<T, Options...> &y)
#else
(const list_impl<Config> &x, const list_impl<Config> &y)
#endif
{ return !(x == y); }
#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
template<class T, class ...Options>
#else
template<class Config>
#endif
inline bool operator>
#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
(const list_impl<T, Options...> &x, const list_impl<T, Options...> &y)
#else
(const list_impl<Config> &x, const list_impl<Config> &y)
#endif
{ return y < x; }
#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
template<class T, class ...Options>
#else
template<class Config>
#endif
inline bool operator<=
#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
(const list_impl<T, Options...> &x, const list_impl<T, Options...> &y)
#else
(const list_impl<Config> &x, const list_impl<Config> &y)
#endif
{ return !(y < x); }
#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
template<class T, class ...Options>
#else
template<class Config>
#endif
inline bool operator>=
#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
(const list_impl<T, Options...> &x, const list_impl<T, Options...> &y)
#else
(const list_impl<Config> &x, const list_impl<Config> &y)
#endif
{ return !(x < y); }
#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
template<class T, class ...Options>
#else
template<class Config>
#endif
inline void swap
#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
(list_impl<T, Options...> &x, list_impl<T, Options...> &y)
#else
(list_impl<Config> &x, list_impl<Config> &y)
#endif
{ x.swap(y); }
//! Helper metafunction to define a \c list that yields to the same type when the
//! same options (either explicitly or implicitly) are used.
#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) || defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
template<class T, class ...Options>
#else
template<class T, class O1 = none, class O2 = none, class O3 = none>
#endif
struct make_list
{
/// @cond
typedef typename pack_options
< list_defaults<T>,
#if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
O1, O2, O3
#else
Options...
#endif
>::type packed_options;
typedef typename detail::get_value_traits
<T, typename packed_options::value_traits>::type value_traits;
typedef list_impl
<
listopt
< value_traits
, typename packed_options::size_type
, packed_options::constant_time_size
>
> implementation_defined;
/// @endcond
typedef implementation_defined type;
};
#ifndef BOOST_INTRUSIVE_DOXYGEN_INVOKED
#if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
template<class T, class O1, class O2, class O3>
#else
template<class T, class ...Options>
#endif
class list
: public make_list<T,
#if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
O1, O2, O3
#else
Options...
#endif
>::type
{
typedef typename make_list
<T,
#if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
O1, O2, O3
#else
Options...
#endif
>::type Base;
typedef typename Base::real_value_traits real_value_traits;
//Assert if passed value traits are compatible with the type
BOOST_STATIC_ASSERT((detail::is_same<typename real_value_traits::value_type, T>::value));
BOOST_MOVABLE_BUT_NOT_COPYABLE(list)
public:
typedef typename Base::value_traits value_traits;
typedef typename Base::iterator iterator;
typedef typename Base::const_iterator const_iterator;
list(const value_traits &v_traits = value_traits())
: Base(v_traits)
{}
template<class Iterator>
list(Iterator b, Iterator e, const value_traits &v_traits = value_traits())
: Base(b, e, v_traits)
{}
list(BOOST_RV_REF(list) x)
: Base(::boost::move(static_cast<Base&>(x)))
{}
list& operator=(BOOST_RV_REF(list) x)
{ this->Base::operator=(::boost::move(static_cast<Base&>(x))); return *this; }
static list &container_from_end_iterator(iterator end_iterator)
{ return static_cast<list &>(Base::container_from_end_iterator(end_iterator)); }
static const list &container_from_end_iterator(const_iterator end_iterator)
{ return static_cast<const list &>(Base::container_from_end_iterator(end_iterator)); }
};
#endif
} //namespace intrusive
} //namespace boost
#include <boost/intrusive/detail/config_end.hpp>
#endif //BOOST_INTRUSIVE_LIST_HPP
| {
"content_hash": "51f20041bc3f332e54efd17bf1596896",
"timestamp": "",
"source": "github",
"line_count": 1490,
"max_line_length": 128,
"avg_line_length": 36.11543624161074,
"alnum_prop": 0.6211811491860552,
"repo_name": "goodspeed24e/2014iOT",
"id": "59091522e537192d0eddc1482db36155d788a046",
"size": "55075",
"binary": false,
"copies": "24",
"ref": "refs/heads/master",
"path": "import/include/boost_1.54/intrusive/list.hpp",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "ApacheConf",
"bytes": "113"
},
{
"name": "Arduino",
"bytes": "277531"
},
{
"name": "C",
"bytes": "6936891"
},
{
"name": "C++",
"bytes": "172363257"
},
{
"name": "CMake",
"bytes": "164887"
},
{
"name": "CSS",
"bytes": "49182"
},
{
"name": "Elixir",
"bytes": "1173"
},
{
"name": "HTML",
"bytes": "86811"
},
{
"name": "JavaScript",
"bytes": "108448"
},
{
"name": "Makefile",
"bytes": "266049"
},
{
"name": "PHP",
"bytes": "19013"
},
{
"name": "Perl",
"bytes": "6080"
},
{
"name": "Processing",
"bytes": "272212"
},
{
"name": "Python",
"bytes": "92290"
},
{
"name": "QML",
"bytes": "6969"
},
{
"name": "Shell",
"bytes": "18548"
},
{
"name": "XSLT",
"bytes": "6126"
}
],
"symlink_target": ""
} |
//-----------------------------------------------------------------------
// <copyright file="HattrickEntityBase.cs" company="Hyperar">
// Copyright (c) Hyperar. All rights reserved.
// </copyright>
// <author>Matías Ezequiel Sánchez</author>
//-----------------------------------------------------------------------
namespace Hyperar.HattrickUltimate.BusinessObjects
{
using Interface;
/// <summary>
/// Hattrick entity base class.
/// </summary>
public abstract class HattrickEntityBase : EntityBase, IEntity, IHattrickEntity
{
#region Public Properties
/// <summary>
/// Gets or sets the Hattrick Id.
/// </summary>
public long HattrickId { get; set; }
#endregion Public Properties
}
} | {
"content_hash": "bb8de3bc8e10c5167b206a2d177de55c",
"timestamp": "",
"source": "github",
"line_count": 25,
"max_line_length": 83,
"avg_line_length": 30.88,
"alnum_prop": 0.5181347150259067,
"repo_name": "hyperar/Hattrick-Ultimate",
"id": "0a54c8e160a738c5639654abdbf46ce7cdbbba29",
"size": "776",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "Hyperar.HattrickUltimate.BusinessObjects/HattrickEntityBase.cs",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C#",
"bytes": "1111551"
}
],
"symlink_target": ""
} |
import xadmin
from .models import Address, City, Country
xadmin.site.register(Address)
xadmin.site.register(City)
xadmin.site.register(Country)
| {
"content_hash": "85acd4533ca7b9eb50867ece87fd8ef2",
"timestamp": "",
"source": "github",
"line_count": 8,
"max_line_length": 42,
"avg_line_length": 18.375,
"alnum_prop": 0.8027210884353742,
"repo_name": "glasslion/django-sakila",
"id": "605ae2568f0fa470ece98a0cfa7f06c887626fe4",
"size": "147",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "project_template/project_name/addresses/adminx.py",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "39"
},
{
"name": "JavaScript",
"bytes": "45"
},
{
"name": "Python",
"bytes": "52430"
}
],
"symlink_target": ""
} |
@class BGAPhoto;
@interface BGAStatusPhotoView : UIImageView
@property (nonatomic, strong) BGAPhoto *photo;
@end
| {
"content_hash": "1268a2c9bb402ac1ffe413734020364c",
"timestamp": "",
"source": "github",
"line_count": 7,
"max_line_length": 46,
"avg_line_length": 16.571428571428573,
"alnum_prop": 0.7758620689655172,
"repo_name": "bingoogolapple/OCNote-PartTwo",
"id": "21292d54c826104b7b2a2c072c34e2f167d558f2",
"size": "285",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "WeiBo/WeiBo/Classes/Home/View/BGAStatusPhotoView.h",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "1772"
},
{
"name": "HTML",
"bytes": "68017"
},
{
"name": "Objective-C",
"bytes": "1364987"
}
],
"symlink_target": ""
} |
#pragma once
#include <aws/states/SFN_EXPORTS.h>
#include <aws/core/utils/memory/stl/AWSString.h>
#include <aws/states/model/StateMachineStatus.h>
#include <aws/core/utils/DateTime.h>
#include <utility>
namespace Aws
{
template<typename RESULT_TYPE>
class AmazonWebServiceResult;
namespace Utils
{
namespace Json
{
class JsonValue;
} // namespace Json
} // namespace Utils
namespace SFN
{
namespace Model
{
class AWS_SFN_API DescribeStateMachineResult
{
public:
DescribeStateMachineResult();
DescribeStateMachineResult(const AmazonWebServiceResult<Aws::Utils::Json::JsonValue>& result);
DescribeStateMachineResult& operator=(const AmazonWebServiceResult<Aws::Utils::Json::JsonValue>& result);
/**
* <p>The Amazon Resource Name (ARN) that identifies the state machine.</p>
*/
inline const Aws::String& GetStateMachineArn() const{ return m_stateMachineArn; }
/**
* <p>The Amazon Resource Name (ARN) that identifies the state machine.</p>
*/
inline void SetStateMachineArn(const Aws::String& value) { m_stateMachineArn = value; }
/**
* <p>The Amazon Resource Name (ARN) that identifies the state machine.</p>
*/
inline void SetStateMachineArn(Aws::String&& value) { m_stateMachineArn = std::move(value); }
/**
* <p>The Amazon Resource Name (ARN) that identifies the state machine.</p>
*/
inline void SetStateMachineArn(const char* value) { m_stateMachineArn.assign(value); }
/**
* <p>The Amazon Resource Name (ARN) that identifies the state machine.</p>
*/
inline DescribeStateMachineResult& WithStateMachineArn(const Aws::String& value) { SetStateMachineArn(value); return *this;}
/**
* <p>The Amazon Resource Name (ARN) that identifies the state machine.</p>
*/
inline DescribeStateMachineResult& WithStateMachineArn(Aws::String&& value) { SetStateMachineArn(std::move(value)); return *this;}
/**
* <p>The Amazon Resource Name (ARN) that identifies the state machine.</p>
*/
inline DescribeStateMachineResult& WithStateMachineArn(const char* value) { SetStateMachineArn(value); return *this;}
/**
* <p>The name of the state machine.</p>
*/
inline const Aws::String& GetName() const{ return m_name; }
/**
* <p>The name of the state machine.</p>
*/
inline void SetName(const Aws::String& value) { m_name = value; }
/**
* <p>The name of the state machine.</p>
*/
inline void SetName(Aws::String&& value) { m_name = std::move(value); }
/**
* <p>The name of the state machine.</p>
*/
inline void SetName(const char* value) { m_name.assign(value); }
/**
* <p>The name of the state machine.</p>
*/
inline DescribeStateMachineResult& WithName(const Aws::String& value) { SetName(value); return *this;}
/**
* <p>The name of the state machine.</p>
*/
inline DescribeStateMachineResult& WithName(Aws::String&& value) { SetName(std::move(value)); return *this;}
/**
* <p>The name of the state machine.</p>
*/
inline DescribeStateMachineResult& WithName(const char* value) { SetName(value); return *this;}
/**
* <p>The current status of the state machine.</p>
*/
inline const StateMachineStatus& GetStatus() const{ return m_status; }
/**
* <p>The current status of the state machine.</p>
*/
inline void SetStatus(const StateMachineStatus& value) { m_status = value; }
/**
* <p>The current status of the state machine.</p>
*/
inline void SetStatus(StateMachineStatus&& value) { m_status = std::move(value); }
/**
* <p>The current status of the state machine.</p>
*/
inline DescribeStateMachineResult& WithStatus(const StateMachineStatus& value) { SetStatus(value); return *this;}
/**
* <p>The current status of the state machine.</p>
*/
inline DescribeStateMachineResult& WithStatus(StateMachineStatus&& value) { SetStatus(std::move(value)); return *this;}
/**
* <p>The Amazon States Language definition of the state machine.</p>
*/
inline const Aws::String& GetDefinition() const{ return m_definition; }
/**
* <p>The Amazon States Language definition of the state machine.</p>
*/
inline void SetDefinition(const Aws::String& value) { m_definition = value; }
/**
* <p>The Amazon States Language definition of the state machine.</p>
*/
inline void SetDefinition(Aws::String&& value) { m_definition = std::move(value); }
/**
* <p>The Amazon States Language definition of the state machine.</p>
*/
inline void SetDefinition(const char* value) { m_definition.assign(value); }
/**
* <p>The Amazon States Language definition of the state machine.</p>
*/
inline DescribeStateMachineResult& WithDefinition(const Aws::String& value) { SetDefinition(value); return *this;}
/**
* <p>The Amazon States Language definition of the state machine.</p>
*/
inline DescribeStateMachineResult& WithDefinition(Aws::String&& value) { SetDefinition(std::move(value)); return *this;}
/**
* <p>The Amazon States Language definition of the state machine.</p>
*/
inline DescribeStateMachineResult& WithDefinition(const char* value) { SetDefinition(value); return *this;}
/**
* <p>The Amazon Resource Name (ARN) of the IAM role used for executing this state
* machine.</p>
*/
inline const Aws::String& GetRoleArn() const{ return m_roleArn; }
/**
* <p>The Amazon Resource Name (ARN) of the IAM role used for executing this state
* machine.</p>
*/
inline void SetRoleArn(const Aws::String& value) { m_roleArn = value; }
/**
* <p>The Amazon Resource Name (ARN) of the IAM role used for executing this state
* machine.</p>
*/
inline void SetRoleArn(Aws::String&& value) { m_roleArn = std::move(value); }
/**
* <p>The Amazon Resource Name (ARN) of the IAM role used for executing this state
* machine.</p>
*/
inline void SetRoleArn(const char* value) { m_roleArn.assign(value); }
/**
* <p>The Amazon Resource Name (ARN) of the IAM role used for executing this state
* machine.</p>
*/
inline DescribeStateMachineResult& WithRoleArn(const Aws::String& value) { SetRoleArn(value); return *this;}
/**
* <p>The Amazon Resource Name (ARN) of the IAM role used for executing this state
* machine.</p>
*/
inline DescribeStateMachineResult& WithRoleArn(Aws::String&& value) { SetRoleArn(std::move(value)); return *this;}
/**
* <p>The Amazon Resource Name (ARN) of the IAM role used for executing this state
* machine.</p>
*/
inline DescribeStateMachineResult& WithRoleArn(const char* value) { SetRoleArn(value); return *this;}
/**
* <p>The date the state machine was created.</p>
*/
inline const Aws::Utils::DateTime& GetCreationDate() const{ return m_creationDate; }
/**
* <p>The date the state machine was created.</p>
*/
inline void SetCreationDate(const Aws::Utils::DateTime& value) { m_creationDate = value; }
/**
* <p>The date the state machine was created.</p>
*/
inline void SetCreationDate(Aws::Utils::DateTime&& value) { m_creationDate = std::move(value); }
/**
* <p>The date the state machine was created.</p>
*/
inline DescribeStateMachineResult& WithCreationDate(const Aws::Utils::DateTime& value) { SetCreationDate(value); return *this;}
/**
* <p>The date the state machine was created.</p>
*/
inline DescribeStateMachineResult& WithCreationDate(Aws::Utils::DateTime&& value) { SetCreationDate(std::move(value)); return *this;}
private:
Aws::String m_stateMachineArn;
Aws::String m_name;
StateMachineStatus m_status;
Aws::String m_definition;
Aws::String m_roleArn;
Aws::Utils::DateTime m_creationDate;
};
} // namespace Model
} // namespace SFN
} // namespace Aws
| {
"content_hash": "ec2b2b26edf9819cac711bcce0875cef",
"timestamp": "",
"source": "github",
"line_count": 241,
"max_line_length": 137,
"avg_line_length": 33.33609958506224,
"alnum_prop": 0.6540950958426687,
"repo_name": "chiaming0914/awe-cpp-sdk",
"id": "1a54d2795e46f4e77e7351788a88b42b6829db14",
"size": "8607",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "aws-cpp-sdk-states/include/aws/states/model/DescribeStateMachineResult.h",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "C",
"bytes": "2313"
},
{
"name": "C++",
"bytes": "98158533"
},
{
"name": "CMake",
"bytes": "437471"
},
{
"name": "HTML",
"bytes": "4471"
},
{
"name": "Java",
"bytes": "239297"
},
{
"name": "Python",
"bytes": "72827"
},
{
"name": "Shell",
"bytes": "2803"
}
],
"symlink_target": ""
} |
import { bindActionCreators } from 'redux';
import { connect } from 'react-redux';
import { boardsMenuActionCreators } from '../../modules/index';
import HeaderBoard from './HeaderBoard';
const mapStateToProps = state => {
const { isBoardsMenuOpen } = state.boardsMenu;
return {
isBoardsMenuOpen
};
}
const mapDispatchToProps = dispatch => {
return {
boardsMenuActions: bindActionCreators(boardsMenuActionCreators, dispatch)
}
}
export default connect(mapStateToProps, mapDispatchToProps)(HeaderBoard); | {
"content_hash": "7b3c6463db19fda7b57a2343d39103a1",
"timestamp": "",
"source": "github",
"line_count": 22,
"max_line_length": 77,
"avg_line_length": 23.90909090909091,
"alnum_prop": 0.7395437262357415,
"repo_name": "Madmous/Trello-Clone",
"id": "57175788d4fe05a13bb828b71203e3455a03b667",
"size": "526",
"binary": false,
"copies": "2",
"ref": "refs/heads/develop",
"path": "client/trello/src/app/components/HeaderBoard/HeaderBoardContainer.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "23184"
},
{
"name": "HTML",
"bytes": "1757"
},
{
"name": "JavaScript",
"bytes": "285322"
},
{
"name": "Python",
"bytes": "10261"
},
{
"name": "Vue",
"bytes": "2212"
}
],
"symlink_target": ""
} |
""" Classes to handle HTMLText and Catalogues in PubTal.
Copyright (c) 2004 Colin Stewart (http://www.owlfish.com/)
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. The name of the author may not be used to endorse or promote products
derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
If you make any bug fixes or feature enhancements please let me know!
"""
try:
import logging
except:
import InfoLogging as logging
import SitePublisher, CatalogueContent, ContentToHTMLConverter, SiteUploader, FtpLibrary
import os, time, anydbm, codecs
import timeformat
from simpletal import simpleTAL, simpleTALES
# getPluginInfo provides the list of built-in supported content.
def getPluginInfo ():
builtInContent = [{'functionality': 'content', 'content-type': 'HTMLText' ,'file-type': 'txt','class': HTMLTextPagePublisher}
, {'functionality': 'content', 'content-type': 'Catalogue','file-type': 'catalogue','class': CataloguePublisher}
, {'functionality': 'upload-method', 'method-type': 'FTP', 'class': FTPUploadMethod}]
return builtInContent
class CataloguePublisher (SitePublisher.ContentPublisher):
def __init__ (self, pagePublisher):
SitePublisher.ContentPublisher.__init__ (self, pagePublisher)
self.log = logging.getLogger ("PubTal.CataloguePublisher")
self.ui = pagePublisher.getUI ()
def publish (self, page):
indexTemplate = self.templateConfig.getTemplate (page.getOption ('catalogue-index-template', 'template.html'))
itemTemplate = self.templateConfig.getTemplate (page.getOption ('catalogue-item-template', 'template.html'))
maxCols = int (page.getOption ('catalogue-max-columns', '5'))
buildIndexPage = 0
buildItemPages = 0
catalogueBuildPages = page.getOption ('catalogue-build-pages', 'index,item')
for option in catalogueBuildPages.split (','):
if (option == "index"):
if (indexTemplate is not None):
buildIndexPage = 1
else:
msg = "Unable to build the index page for catalogue %s because no catalogue-index-template has been specified." % page.getSource()
self.log.warn (msg)
self.ui.warn (msg)
elif (option == "item"):
if (itemTemplate is not None):
buildItemPages = 1
else:
msg = "Unable to build the item pages for catalogue %s because no catalogue-item-template has been specified." % page.getSource()
self.log.warn (msg)
self.ui.warn (msg)
if (not buildIndexPage | buildItemPages):
msg = "Neither index or item pages are being built for catalogue %s" % page.getSource()
self.log.warn (msg)
self.ui.warn (msg)
return
itemContentType = page.getOption ('catalogue-item-content-type', None)
if (itemContentType is None or itemContentType.lower() == 'none'):
# We wish to turn off item content publishing
itemContentPublisher = None
else:
itemContentPublisher = self.pagePublisher.getContentPublisher (itemContentType)
if (itemContentPublisher is None):
msg = "Unable to find a publisher for catalogue item content type %s." % itemContentType
self.log.error (msg)
raise SitePublisher.PublisherException (msg)
# Build the context pieces we are going to need
pageCharSet = page.getOption ('character-set', None)
if (pageCharSet is not None):
# This page has it's own character set
pageCodec = codecs.lookup (self.pageCharSet)
else:
# This page uses the default character set.
pageCodec = self.characterSetCodec
catalogue = CatalogueContent.CatalogueContent (page.getSource(), pageCodec)
items = []
rows = []
col = []
lastModDate = timeformat.format ('%a[SHORT], %d %b[SHORT] %Y %H:%M:%S %Z', time.localtime (page.getModificationTime()))
copyrightYear = timeformat.format ('%Y')
# Source paths
relativeSourcePath = page.getRelativePath()
contentDir = self.contentDir
absSourcePath = page.getSource()
localDestinationDir = os.path.dirname (page.getRelativePath())
depth = page.getDepthString()
self.log.debug ("Building the context for each item in the catalogue.")
for itemHeaders in catalogue.getItems():
# Destination paths
filename = itemHeaders.get ('filename', None)
if (filename is None and buildItemPages):
msg = "Unable to publish catalogue %s. Missing filename header in catalogue but item publishing is enabled." % page.getSource()
self.log.error (msg)
raise SitePublisher.PublisherException (msg)
actualHeaders = {}
actualHeaders.update (page.getHeaders())
actualHeaders.update (itemHeaders)
if (filename is not None):
# Used to determine the file to write to, kept in case the pageContext doesn't contain them.
relativeDestPath = os.path.join (localDestinationDir, os.path.splitext (filename)[0] + '.html')
destPath = os.path.join (self.destDir, relativeDestPath)
if (itemContentPublisher is not None):
self.log.debug ("Retrieving page context for this catalogue entry.")
# We need a page for this entry so that we can get it's content.
itemPageList = self.contentConfig.getPages (os.path.join (contentDir, filename), {})
if (len (itemPageList) > 1):
self.ui.warn ("Catalogue contains content type that returns more than one page! Only building first page.")
itemPage = itemPageList [0]
pageContext = itemContentPublisher.getPageContext (itemPage, itemTemplate)
actualHeaders.update (pageContext.get ('headers', {}))
pageContext ['headers'] = actualHeaders
if (not pageContext.has_key ('destinationPath')):
pageContext ['destinationPath'] = relativeDestPath
if (not pageContext.has_key ('absoluteDestinationPath')):
pageContext ['absoluteDestinationPath'] = destPath
else:
self.log.debug ("No content type for this catalogue entry - just publish what we have.")
# Get the generic page information for this file
relativeDestPath = os.path.join (localDestinationDir, os.path.splitext (filename)[0] + '.' + itemTemplate.getTemplateExtension())
destPath = os.path.join (self.destDir, relativeDestPath)
destFilename = os.path.basename (destPath)
actualHeaders = {}
actualHeaders.update (page.getHeaders())
actualHeaders.update (itemHeaders)
pageContext = {'lastModifiedDate': lastModDate
,'copyrightYear': copyrightYear
,'sourcePath': relativeSourcePath
,'absoluteSourcePath': absSourcePath
,'destinationPath': relativeDestPath
,'absoluteDestinationPath': destPath
,'destinationFilename': destFilename
,'depth': depth
,'headers': actualHeaders
}
else:
# No filename specified for this entry
pageContext = {'headers': actualHeaders}
items.append (pageContext)
if (len (col) == maxCols):
rows.append (col)
col = []
col.append (pageContext)
if (len (col) > 0):
rows.append (col)
col = []
# Build the Catalogue context
catalogueMap = {'entries': items, 'rows': rows, 'headers': catalogue.getCatalogueHeaders()}
# Do the individual items now
if (buildItemPages):
itemCount = 0
itemLength = len (items)
for item in items:
relativeDestPath = item['destinationPath']
context = simpleTALES.Context(allowPythonPath=1)
context.addGlobal ('page', item)
if (itemCount > 0):
catalogueMap ['previous'] = items[itemCount - 1]
elif (catalogueMap.has_key ('previous')):
del catalogueMap ['previous']
if (itemCount < itemLength - 1):
catalogueMap ['next'] = items[itemCount + 1]
elif (catalogueMap.has_key ('next')):
del catalogueMap ['next']
context.addGlobal ('catalogue', catalogueMap)
macros = page.getMacros()
self.pagePublisher.expandTemplate (itemTemplate, context, relativeDestPath, macros)
itemCount += 1
if (buildIndexPage):
# Cleanup the catalogueMap from the items pages.
if (catalogueMap.has_key ('previous')):
del catalogueMap ['previous']
if (catalogueMap.has_key ('next')):
del catalogueMap ['next']
indexMap = self.getPageContext (page, indexTemplate, catalogue)
relativeDestPath = indexMap ['destinationPath']
context = simpleTALES.Context(allowPythonPath=1)
context.addGlobal ('page', indexMap)
context.addGlobal ('catalogue', catalogueMap)
macros = page.getMacros()
self.pagePublisher.expandTemplate (indexTemplate, context, relativeDestPath, macros)
def getPageContext (self, page, template, catalogue=None):
# The page context for a Catalogue is fairly boring, but someone might use it
indexMap = SitePublisher.ContentPublisher.getPageContext (self, page, template)
if (catalogue is None):
localCatalogue = CatalogueContent.CatalogueContent (page.getSource(), self.characterSetCodec)
else:
localCatalogue = catalogue
actualHeaders = indexMap ['headers']
actualHeaders.update (localCatalogue.getCatalogueHeaders())
indexMap ['headers'] = actualHeaders
return indexMap
class HTMLTextPagePublisher (SitePublisher.ContentPublisher):
def __init__ (self, pagePublisher):
SitePublisher.ContentPublisher.__init__ (self, pagePublisher)
self.htmlConverter = ContentToHTMLConverter.ContentToHTMLConverter()
self.xhtmlConverter = ContentToHTMLConverter.ContentToXHTMLConverter()
self.log = logging.getLogger ("PubTal.HTMLTextPagePublisher")
def publish (self, page):
templateName = page.getOption ('template')
# Get this template's configuration
template = self.templateConfig.getTemplate (templateName)
context = simpleTALES.Context(allowPythonPath=1)
# Get the page context for this content
map = self.getPageContext (page, template)
# Determine the destination for this page
relativeDestPath = map ['destinationPath']
context.addGlobal ('page', map)
macros = page.getMacros()
self.pagePublisher.expandTemplate (template, context, relativeDestPath, macros)
def getPageContext (self, page, template):
pageMap = SitePublisher.ContentPublisher.getPageContext (self, page, template)
ignoreNewlines = page.getBooleanOption ('htmltext-ignorenewlines')
preserveSpaces = page.getBooleanOption ('preserve-html-spaces', 1)
headers, rawContent = self.readHeadersAndContent(page)
# Determine desired output type, HTML or XHTML
outputType = template.getOption ('output-type')
if (outputType == 'HTML'):
content = self.htmlConverter.convertContent (rawContent, ignoreNewLines=ignoreNewlines, preserveSpaces=preserveSpaces)
elif (outputType == 'XHTML'):
content = self.xhtmlConverter.convertContent (rawContent, ignoreNewLines=ignoreNewlines, preserveSpaces=preserveSpaces)
elif (outputType == 'PlainText'):
# It doesn't actually matter how the markup has been entered in the HTMLText, because we
# are going to output Plain Text anyway. We use HTML because it's the least demanding.
content = self.htmlConverter.convertContent (rawContent, ignoreNewLines=ignoreNewlines, plainTextOuput=1)
else:
msg = "HTMLText content doesn't support output in type '%s'." % outputType
self.log.error (msg)
raise SitePublisher.PublisherException (msg)
actualHeaders = pageMap ['headers']
actualHeaders.update (headers)
pageMap ['headers'] = actualHeaders
pageMap ['content'] = content
pageMap ['rawContent'] = rawContent
return pageMap
class FTPUploadMethod (SiteUploader.UploadMethod):
def __init__ (self, siteConfig, uploadConfig):
self.siteConfig = siteConfig
self.uploadConfig = uploadConfig
self.utfencoder = codecs.lookup ("utf8")[0]
self.utfdecoder = codecs.lookup ("utf8")[1]
self.db = None
self.ftpClient = None
self.log = logging.getLogger ("FTPUploadMethod")
try:
conf = 'host'
self.hostname = uploadConfig [conf]
conf = 'username'
self.username = uploadConfig [conf]
except:
raise Exception ("Missing FTP configuration option %s" % conf)
self.password = uploadConfig.get ('password', None)
self.initialDir = uploadConfig.get ('base-dir')
def getDB (self):
if (self.db is None):
self.db = anydbm.open (os.path.join (self.siteConfig.getDataDir(), 'FtpCache-%s-%s' % (self.hostname, self.username)), 'c')
return self.db
def uploadFiles (self, fileDict, userInteraction):
"Return 1 for success, 0 for failure. Must notify userInteraction directly."
if (self.ftpClient is None):
self.log.debug ("First file, there is no ftp client yet.")
if (self.password is None):
self.log.debug ("Asking for password - none in config file.")
self.password = userInteraction.promptPassword ("Password required (%s@%s)" % (self.username, self.hostname))
self.ftpClient = FtpLibrary.FTPUpload (self.hostname, self.username, self.password, self.initialDir)
try:
self.log.info ("Connecting to FTP site.")
userInteraction.info ("Connecting to FTP site.")
if (not self.ftpClient.connect (userInteraction)):
return 0
self.log.info ("Connected.")
userInteraction.info ("Connected.")
except Exception, e:
msg = "Error connecting to FTP site: %s" % str (e)
userInteraction.taskError ("Error connecting to FTP site: %s" % str (e))
return 0
percentageDone = 0.0
incrementSize = 100.0/float (len (fileDict))
db = self.getDB()
allFiles = fileDict.keys()
# Try to keep files together to help FTP performance.
allFiles.sort()
for fName in allFiles:
userInteraction.taskProgress ("Uploading %s" % fName, percentageDone)
percentageDone += incrementSize
if (self.ftpClient.uploadFile (self.siteConfig.getDestinationDir(), fName, userInteraction)):
db [self.utfencoder (fName)[0]] = fileDict [fName]
return 1
def finished (self):
if (self.ftpClient is not None):
self.ftpClient.disconnect()
self.ftpClient = None
if (self.db is not None):
self.db.close()
self.db = None | {
"content_hash": "302ca2bc0de30e56b221b899693a9e66",
"timestamp": "",
"source": "github",
"line_count": 360,
"max_line_length": 135,
"avg_line_length": 41.58611111111111,
"alnum_prop": 0.7207267383608309,
"repo_name": "owlfish/pubtal",
"id": "1bdc4211059e0df2ee210ac9c42464b89c04625c",
"size": "14971",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "lib/pubtal/BuiltInPlugins.py",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "CSS",
"bytes": "372"
},
{
"name": "HTML",
"bytes": "56487"
},
{
"name": "Python",
"bytes": "517058"
},
{
"name": "Shell",
"bytes": "1544"
}
],
"symlink_target": ""
} |
using System.ComponentModel;
namespace Ignite.SharpNetSH.WLAN.Enums
{
public enum Authentication
{
[Description("open")]
Open,
[Description("shared")]
Shared,
[Description("WPA")]
Wpa,
[Description("WPA2")]
Wpa2,
[Description("WPAPSK")]
WpaPsk,
[Description("WPA2PSK")]
Wpa2Psk
}
}
| {
"content_hash": "6336277c55342c05b1639e7099ac4638",
"timestamp": "",
"source": "github",
"line_count": 20,
"max_line_length": 38,
"avg_line_length": 19.6,
"alnum_prop": 0.5331632653061225,
"repo_name": "rpetz/SharpNetSH",
"id": "50c12dcb75e6ad9cc072302c3322fd11df8a1c3e",
"size": "394",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "SharpNetSH/Actions/WLAN/Enums/Authentication.cs",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C#",
"bytes": "96163"
}
],
"symlink_target": ""
} |
@interface MOBProjectionEPSG23847 : MOBProjection
@end
| {
"content_hash": "14784074e74f2cbf5f69918462553c88",
"timestamp": "",
"source": "github",
"line_count": 3,
"max_line_length": 49,
"avg_line_length": 18.666666666666668,
"alnum_prop": 0.8392857142857143,
"repo_name": "jkdubr/Proj4",
"id": "6492634dc66a4bc7d0e2415357eb55f146bf00d0",
"size": "83",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "Pod/Classes/Projection/MOBProjectionEPSG23847.h",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C",
"bytes": "1141"
},
{
"name": "Objective-C",
"bytes": "1689233"
},
{
"name": "Ruby",
"bytes": "1604"
},
{
"name": "Shell",
"bytes": "7202"
}
],
"symlink_target": ""
} |
<div class="row">
<div class="col-md-12">
<div class="panel panel-default">
<div class="panel-heading">
<h3>Here you can see your achievements</h3>
</div>
<br>
<br>
<div class="panel-body">
<div class="row">
<div style="text-align: center" class="col-md-3" *ngFor="let achievement of achievements">
<div class="panel panel-default">
<div class="panel-heading">
<img [id]="'image'" [name]="'image'" [src]="achievement.picture" class="img-responsive">
</div>
<div class="panel-body" style="margin-top: 10px;">
<b>{{achievement.name}}</b>
<div><small>{{achievement.description}}</small></div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<style>
#image{
display: block;
margin-left: auto;
margin-right: auto;
border-radius: 15px;
width: 200px;
height: 130px;
}
</style>
| {
"content_hash": "1212d17bed309146abb178882b1e1642",
"timestamp": "",
"source": "github",
"line_count": 37,
"max_line_length": 120,
"avg_line_length": 33.5945945945946,
"alnum_prop": 0.417538213998391,
"repo_name": "cristirosu/rpg-scheduler-front",
"id": "34dc2533b7d2123a905f15c7d10f631ca686c0b1",
"size": "1243",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/app/pages/achievements/achievements.component.html",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "120636"
},
{
"name": "HTML",
"bytes": "98007"
},
{
"name": "JavaScript",
"bytes": "35594"
},
{
"name": "Shell",
"bytes": "153"
},
{
"name": "TypeScript",
"bytes": "258721"
}
],
"symlink_target": ""
} |
Demo scripts and data for the Mitty program
===========================================
[Mitty](https://github.com/sbg/Mitty) is a data simulator meant to help debug aligners and variant callers.
This repository contains scripts and data files that demonstrate Mitty's features and accompanies the full
[Mitty tutorial](https://github.com/sbg/Mitty#detailed-tutorial-with-commentary).
The data are released under the [Apache](LICENSE.txt) license except for when they are copies of publicly
available data, in which case the original license applies to them.
Getting started
---------------
After cloning the project run the `get-data.sh` script in under the `data` directory to download a reference
FASTA and a 1000G VCF section. **The reference download and index generation are time consuming. It is possible you have suitable FASTA and VCF files on your hard-drive already which you can copy or link into
the data directory. You just have to ensure the names in the script match those on disk**
_(As a reference, on my laptop the process of indexing hg19 takes 4889.075 sec)_
You can then run the scripts under each example directory. Note that some scripts rely on the outputs of
other scripts to work. Following the order in the tutorial will be best. | {
"content_hash": "714af19b274bebe2b20d58f02a0703c8",
"timestamp": "",
"source": "github",
"line_count": 20,
"max_line_length": 208,
"avg_line_length": 63.25,
"alnum_prop": 0.7573122529644268,
"repo_name": "kghosesbg/mitty-demo-data",
"id": "872018a0470643fb2f5d447f63827b41432442a5",
"size": "1265",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "Readme.md",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Python",
"bytes": "531"
},
{
"name": "Shell",
"bytes": "16061"
}
],
"symlink_target": ""
} |
/******************************************************************************
Filename: Character.h
Author: David C. Drake (http://davidcdrake.com)
Description: Declaration of a 'Character' class responsible for representing
both player and non-player characters.
******************************************************************************/
#ifndef CHARACTER_H_
#define CHARACTER_H_
#include <string>
#include "main.h"
#include "Battlefield.h"
using namespace std;
const double DEFAULT_Z_OFFSET = 0.1;
const double GRAVITY = 0.004;
class Battlefield;
const enum Race {
MAN,
BARBARIAN,
AMAZON,
HORSE_RAIDER,
DWARF,
WOOD_ELF,
HIGH_ELF,
ORC,
HALF_ORC,
GOBLIN,
TROLL,
OGRE,
DRAGON,
GIANT,
UNDEAD,
SUMMONED,
NUM_RACES
};
const enum Quality {
ELITE,
VETERAN,
AVERAGE,
POOR,
UNPREDICTABLE,
NUM_QUALITIES
};
const enum Type {
DISCIPLINED,
TRIBAL,
FANATIC,
STUPID,
NUM_TYPES
};
const enum Armor {
NO_ARMOR,
LIGHT,
MEDIUM,
HEAVY,
EXTRA_HEAVY,
NUM_ARMORS
};
const enum Weapon {
ONE_HANDED,
TWO_HANDED, // May not carry a shield.
SPEAR, // May fight in two ranks.
LANCE, // May fight in two ranks.
PIKE, // May fight in three ranks.
POLEARM, // May use as TWO_HANDED or SPEAR. May not carry a shield.
TOOTH_AND_CLAW,
HORN_AND_HOOF,
NUM_WEAPONS
};
class Character {
public:
Character(int race, int type, Battlefield *battlefield);
~Character();
void initialize(int race, int type, Battlefield *battlefield);
int getType() const { return type_; }
double getX() const { return x_; }
double getY() const { return y_; }
double getZ() const { return z_; }
double getZOffset() const { return zOffset_; }
double getHeight() const { return height_; }
double getRotation() const { return rotation_; }
double getRotationRate() const { return rotationRate_; }
double getMovementRate() const { return movementRate_; }
double getRed() const { return red_; }
double getGreen() const { return green_; }
double getBlue() const { return blue_; }
double getNextX() const;
double getNextY() const;
double getNextZ() const;
void act();
void moveForward();
void moveBackward();
void strafeLeft();
void strafeRight();
void rotateLeft();
void rotateRight();
bool isPlayer() const;
bool isOnGround();
void draw();
protected:
string name_;
int race_,
quality_,
type_,
strength_,
resilience_,
worth_,
armor_,
handWeapon_,
rangedWeapon_,
savingThrow_,
volleys_,
magicPoints_,
leadership_,
points_;
bool shield_,
terrible_,
hatesDay_,
hatesNight_;
double red_,
green_,
blue_,
x_,
y_,
z_,
zOffset_,
height_,
rotation_,
rotationRate_,
movementRate_,
collisionRadius_;
Battlefield *battlefield_;
};
#endif // CHARACTER_H_
| {
"content_hash": "f894fec47f1aae9d8a0321bb825b6d39",
"timestamp": "",
"source": "github",
"line_count": 147,
"max_line_length": 79,
"avg_line_length": 20.244897959183675,
"alnum_prop": 0.5940860215053764,
"repo_name": "theDrake/warchief-cpp",
"id": "98fa32d552fd7bac7da98755793301289a38bf94",
"size": "2976",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "Warchief/Character.h",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C",
"bytes": "22748"
},
{
"name": "C++",
"bytes": "31026"
}
],
"symlink_target": ""
} |
public class Client{
public static void main(String[] args){
Context context;
System.out.println("-----执行策略1-----");
context = new Context(new ConcreteStrategy1());
context.execute();
System.out.println("-----执行策略2-----");
context = new Context(new ConcreteStrategy2());
context.execute();
}
} | {
"content_hash": "e94af37ccb2911e1e2bd7e0f71ad1612",
"timestamp": "",
"source": "github",
"line_count": 12,
"max_line_length": 49,
"avg_line_length": 25.833333333333332,
"alnum_prop": 0.6612903225806451,
"repo_name": "happylindz/design-pattern-toturial",
"id": "9905f0f56e11565cca67076904cf81165760cc52",
"size": "327",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "BehavioralPattern/Strategy/Client.java",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Java",
"bytes": "25220"
}
],
"symlink_target": ""
} |
#import <Cocoa/Cocoa.h>
int main(int argc, const char *argv[]) {
return NSApplicationMain(argc, argv);
}
| {
"content_hash": "f11de6a674d623a1f1b86eadb7a2de05",
"timestamp": "",
"source": "github",
"line_count": 7,
"max_line_length": 40,
"avg_line_length": 15.714285714285714,
"alnum_prop": 0.6818181818181818,
"repo_name": "facebook/FBSimulatorControl",
"id": "0a358452bf8d8b5569fab8c76a71199a10de8752",
"size": "297",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "Fixtures/Source/MacUITestFixture/App/main.m",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C",
"bytes": "2096"
},
{
"name": "CSS",
"bytes": "1682"
},
{
"name": "Dockerfile",
"bytes": "148"
},
{
"name": "JavaScript",
"bytes": "5329"
},
{
"name": "Objective-C",
"bytes": "2849557"
},
{
"name": "Objective-C++",
"bytes": "51006"
},
{
"name": "Python",
"bytes": "302699"
},
{
"name": "Shell",
"bytes": "15491"
},
{
"name": "Swift",
"bytes": "206775"
}
],
"symlink_target": ""
} |
namespace DesignPatterns.SingletonPattern
{
public class SingletonPatternDemo
{
public SingleObject SingleObject
{
get
{
throw new System.NotImplementedException();
}
}
public static void Output()
{
//illegal construct
//Compile Time Error: The constructor SingleObject() is not visible
//SingleObject object = new SingleObject();
//Get the only object available
var singleObject = SingleObject.GetInstance();
//show the message
singleObject.ShowMessage();
}
}
}
| {
"content_hash": "a84f20011521aeda0fa6603fa88f9c4c",
"timestamp": "",
"source": "github",
"line_count": 26,
"max_line_length": 79,
"avg_line_length": 25.653846153846153,
"alnum_prop": 0.5472263868065967,
"repo_name": "shuvoamin/SoftwareDesignPatterns",
"id": "1a7344701888f3d6c1232a463e9150b9d0a70f3a",
"size": "669",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "DesignPatterns/SingletonPattern/SingletonPatternDemo.cs",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C#",
"bytes": "125445"
}
],
"symlink_target": ""
} |
module Mixture
module Coerce
# Handles coercion of the Integer class.
class Integer < Base
type Types::Integer
coerce_to(Types::Object, Itself)
coerce_to(Types::String, :to_s)
coerce_to(Types::Float, :to_f)
coerce_to(Types::Rational, :to_r)
coerce_to(Types::Integer, Itself)
coerce_to(Types::Boolean) { |value| !value.zero? }
coerce_to(Types::Time) { |value| ::Time.at(value) }
coerce_to(Types::Date) { |value| ::Time.at(value).to_date }
coerce_to(Types::DateTime) { |value| ::Time.at(value).to_datetime }
end
end
end
| {
"content_hash": "285b0e304664603cb32f73f0203a385a",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 73,
"avg_line_length": 33.05555555555556,
"alnum_prop": 0.6201680672268908,
"repo_name": "medcat/mixture",
"id": "404e82f9d00e09ba74041968b563cec06ee1fd5f",
"size": "644",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "lib/mixture/coerce/integer.rb",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Ruby",
"bytes": "90942"
}
],
"symlink_target": ""
} |
package water.api;
import com.google.common.io.ByteStreams;
import com.google.common.io.Closeables;
import hex.*;
import hex.GridSearch.GridSearchProgress;
import hex.KMeans2.KMeans2ModelView;
import hex.KMeans2.KMeans2Progress;
import hex.anomaly.Anomaly;
import hex.deepfeatures.DeepFeatures;
import hex.deeplearning.DeepLearning;
import hex.drf.DRF;
import hex.gapstat.GapStatistic;
import hex.gapstat.GapStatisticModelView;
import hex.gbm.GBM;
import hex.glm.*;
import hex.nb.NBModelView;
import hex.nb.NBProgressPage;
import hex.gapstat.GapStatisticProgressPage;
import hex.nb.NaiveBayes;
import hex.pca.PCA;
import hex.pca.PCAModelView;
import hex.pca.PCAProgressPage;
import hex.pca.PCAScore;
import hex.singlenoderf.SpeeDRF;
import hex.singlenoderf.SpeeDRFModelView;
import hex.singlenoderf.SpeeDRFProgressPage;
import water.*;
import water.api.Upload.PostFile;
import water.api.handlers.ModelBuildersMetadataHandlerV1;
import water.deploy.LaunchJar;
import water.ga.AppViewHit;
import water.schemas.HTTP404V1;
import water.schemas.HTTP500V1;
import water.schemas.Schema;
import water.util.Log;
import water.util.Log.Tag.Sys;
import water.util.Utils.ExpectedExceptionForDebug;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.lang.reflect.Method;
import java.net.ServerSocket;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.Properties;
import java.util.concurrent.ConcurrentHashMap;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
/** This is a simple web server. */
public class RequestServer extends NanoHTTPD {
private static final int LATEST_VERSION = 2;
public enum API_VERSION {
V_1(1, "/"),
V_2(2, "/2/"); // FIXME: better should be /v2/
final private int _version;
final private String _prefix;
public final String prefix() { return _prefix; }
private API_VERSION(int version, String prefix) { _version = version; _prefix = prefix; }
}
static RequestServer SERVER;
// cache of all loaded resources
private static final ConcurrentHashMap<String,byte[]> _cache = new ConcurrentHashMap();
protected static final HashMap<String,Request> _requests = new HashMap();
// An array of regexs-over-URLs and handling Methods.
// The list is searched in-order, first match gets dispatched.
protected static final LinkedHashMap<String,Method> _handlers = new LinkedHashMap<String,Method>();
static final Request _http404;
static final Request _http500;
public static final Response response404(NanoHTTPD server, Properties parms) { return _http404.serve(server, parms, Request.RequestType.www); }
public static final Response response500(NanoHTTPD server, Properties parms) { return _http500.serve(server, parms, Request.RequestType.www); }
// initialization ------------------------------------------------------------
static {
boolean USE_NEW_TAB = true;
_http404 = registerRequest(new HTTP404());
_http500 = registerRequest(new HTTP500());
registerGET("/1/metadata/modelbuilders/.*", ModelBuildersMetadataHandlerV1.class, "show");
registerGET("/1/metadata/modelbuilders", ModelBuildersMetadataHandlerV1.class, "list");
// Data
Request.addToNavbar(registerRequest(new ImportFiles2()), "Import Files", "Data");
Request.addToNavbar(registerRequest(new Upload2()), "Upload", "Data");
Request.addToNavbar(registerRequest(new Parse2()), "Parse", "Data");
Request.addToNavbar(registerRequest(new Inspector()), "Inspect", "Data");
Request.addToNavbar(registerRequest(new SummaryPage2()), "Summary", "Data");
Request.addToNavbar(registerRequest(new QuantilesPage()), "Quantiles", "Data");
Request.addToNavbar(registerRequest(new Impute()), "Impute", "Data");
Request.addToNavbar(registerRequest(new Interaction()), "Interaction", "Data");
Request.addToNavbar(registerRequest(new CreateFrame()), "Create Frame", "Data");
Request.addToNavbar(registerRequest(new FrameSplitPage()),"Split Frame", "Data");
Request.addToNavbar(registerRequest(new StoreView()), "View All", "Data");
Request.addToNavbar(registerRequest(new ExportFiles()), "Export Files", "Data");
// Register Inspect2 just for viewing frames
registerRequest(new Inspect2());
registerRequest(new MMStats());
registerRequest(new GLMMakeModel());
// FVec models
Request.addToNavbar(registerRequest(new DeepLearning()),"Deep Learning", "Model");
Request.addToNavbar(registerRequest(new GLM2()), "Generalized Linear Model", "Model");
Request.addToNavbar(registerRequest(new GBM()), "Gradient Boosting Machine", "Model");
Request.addToNavbar(registerRequest(new KMeans2()), "K-Means Clustering", "Model");
Request.addToNavbar(registerRequest(new PCA()), "Principal Component Analysis", "Model");
Request.addToNavbar(registerRequest(new SpeeDRF()), "Random Forest", "Model");
Request.addToNavbar(registerRequest(new DRF()), "Random Forest - Big Data", "Model");
Request.addToNavbar(registerRequest(new Anomaly()), "Anomaly Detection (Beta)", "Model");
Request.addToNavbar(registerRequest(new CoxPH()), "Cox Proportional Hazards (Beta)", "Model");
Request.addToNavbar(registerRequest(new DeepFeatures()),"Deep Feature Extractor (Beta)", "Model");
Request.addToNavbar(registerRequest(new NaiveBayes()), "Naive Bayes Classifier (Beta)", "Model");
// FVec scoring
Request.addToNavbar(registerRequest(new Predict()), "Predict", "Score");
// only for glm to allow for overriding of lambda_submodel
registerRequest(new GLMPredict());
Request.addToNavbar(registerRequest(new ConfusionMatrix()), "Confusion Matrix", "Score");
Request.addToNavbar(registerRequest(new AUC()), "AUC", "Score");
Request.addToNavbar(registerRequest(new HitRatio()), "HitRatio", "Score");
Request.addToNavbar(registerRequest(new PCAScore()), "PCAScore", "Score");
Request.addToNavbar(registerRequest(new GainsLiftTable()), "Gains/Lift Table", "Score");
Request.addToNavbar(registerRequest(new Steam()), "Multi-model Scoring (Beta)","Score");
// Admin
Request.addToNavbar(registerRequest(new Jobs()), "Jobs", "Admin");
Request.addToNavbar(registerRequest(new Cloud()), "Cluster Status", "Admin");
Request.addToNavbar(registerRequest(new WaterMeterPerfbar()), "Water Meter (Perfbar)", "Admin");
Request.addToNavbar(registerRequest(new LogView()), "Inspect Log", "Admin");
Request.addToNavbar(registerRequest(new JProfile()), "Profiler", "Admin");
Request.addToNavbar(registerRequest(new JStack()), "Stack Dump", "Admin");
Request.addToNavbar(registerRequest(new NetworkTest()), "Network Test", "Admin");
Request.addToNavbar(registerRequest(new IOStatus()), "Cluster I/O", "Admin");
Request.addToNavbar(registerRequest(new Timeline()), "Timeline", "Admin");
Request.addToNavbar(registerRequest(new UDPDropTest()), "UDP Drop Test", "Admin");
Request.addToNavbar(registerRequest(new TaskStatus()), "Task Status", "Admin");
Request.addToNavbar(registerRequest(new Shutdown()), "Shutdown", "Admin");
// Help and Tutorials
Request.addToNavbar(registerRequest(new Documentation()), "H2O Documentation", "Help", USE_NEW_TAB);
Request.addToNavbar(registerRequest(new Tutorials()), "Tutorials Home", "Help", USE_NEW_TAB);
Request.addToNavbar(registerRequest(new TutorialGBM()), "GBM Tutorial", "Help", USE_NEW_TAB);
Request.addToNavbar(registerRequest(new TutorialDeepLearning()),"Deep Learning Tutorial", "Help", USE_NEW_TAB);
Request.addToNavbar(registerRequest(new TutorialRFIris()), "Random Forest Tutorial", "Help", USE_NEW_TAB);
Request.addToNavbar(registerRequest(new TutorialGLMProstate()), "GLM Tutorial", "Help", USE_NEW_TAB);
Request.addToNavbar(registerRequest(new TutorialKMeans()), "KMeans Tutorial", "Help", USE_NEW_TAB);
Request.addToNavbar(registerRequest(new AboutH2O()), "About H2O", "Help");
// Beta things should be reachable by the API and web redirects, but not put in the menu.
if(H2O.OPT_ARGS.beta == null) {
registerRequest(new hex.LR2());
registerRequest(new ReBalance());
registerRequest(new NFoldFrameExtractPage());
registerRequest(new Console());
registerRequest(new GapStatistic());
registerRequest(new InsertMissingValues());
registerRequest(new KillMinus3());
registerRequest(new SaveModel());
registerRequest(new LoadModel());
registerRequest(new CollectLinuxInfo());
registerRequest(new SetLogLevel());
registerRequest(new Debug());
registerRequest(new UnlockKeys());
registerRequest(new Order());
registerRequest(new RemoveVec());
registerRequest(new GarbageCollect());
} else {
Request.addToNavbar(registerRequest(new MatrixMultiply()), "Matrix Multiply", "Beta");
Request.addToNavbar(registerRequest(new hex.LR2()), "Linear Regression2", "Beta");
Request.addToNavbar(registerRequest(new ReBalance()), "ReBalance", "Beta");
Request.addToNavbar(registerRequest(new NFoldFrameExtractPage()),"N-Fold Frame Extract", "Beta");
Request.addToNavbar(registerRequest(new Console()), "Console", "Beta");
Request.addToNavbar(registerRequest(new GapStatistic()), "Gap Statistic", "Beta");
Request.addToNavbar(registerRequest(new InsertMissingValues()), "Insert Missing Values","Beta");
Request.addToNavbar(registerRequest(new KillMinus3()), "Kill Minus 3", "Beta");
Request.addToNavbar(registerRequest(new SaveModel()), "Save Model", "Beta");
Request.addToNavbar(registerRequest(new LoadModel()), "Load Model", "Beta");
Request.addToNavbar(registerRequest(new CollectLinuxInfo()), "Collect Linux Info", "Beta");
Request.addToNavbar(registerRequest(new SetLogLevel()), "Set Log Level", "Beta");
Request.addToNavbar(registerRequest(new Debug()), "Debug Dump (floods log file)","Beta");
Request.addToNavbar(registerRequest(new UnlockKeys()), "Unlock Keys (use with caution)","Beta");
Request.addToNavbar(registerRequest(new Order()), "Order", "Beta");
Request.addToNavbar(registerRequest(new RemoveVec()), "RemoveVec", "Beta");
Request.addToNavbar(registerRequest(new GarbageCollect()), "GarbageCollect", "Beta");
}
registerRequest(new Up());
registerRequest(new Get()); // Download
//Column Expand
registerRequest(new OneHot());
// internal handlers
//registerRequest(new StaticHTMLPage("/h2o/CoefficientChart.html","chart"));
registerRequest(new Cancel());
registerRequest(new CoxPHModelView());
registerRequest(new CoxPHProgressPage());
registerRequest(new DomainMapping());
registerRequest(new DRFModelView());
registerRequest(new DRFProgressPage());
registerRequest(new DownloadDataset());
registerRequest(new Exec2());
registerRequest(new GBMModelView());
registerRequest(new GBMProgressPage());
registerRequest(new GridSearchProgress());
registerRequest(new LogView.LogDownload());
registerRequest(new NeuralNetModelView());
registerRequest(new NeuralNetProgressPage());
registerRequest(new DeepLearningModelView());
registerRequest(new DeepLearningProgressPage());
registerRequest(new KMeans2Progress());
registerRequest(new KMeans2ModelView());
registerRequest(new NBProgressPage());
registerRequest(new GapStatisticProgressPage());
registerRequest(new NBModelView());
registerRequest(new GapStatisticModelView());
registerRequest(new PCAProgressPage());
registerRequest(new PCAModelView());
registerRequest(new PostFile());
registerRequest(new water.api.Upload2.PostFile());
registerRequest(new Progress2());
registerRequest(new PutValue());
registerRequest(new Remove());
registerRequest(new RemoveAll());
registerRequest(new DeleteHDFSDir());
registerRequest(new RemoveAck());
registerRequest(new SpeeDRFModelView());
registerRequest(new SpeeDRFProgressPage());
registerRequest(new water.api.SetColumnNames2()); // Set colnames for FluidVec objects
registerRequest(new LogAndEcho());
registerRequest(new ToEnum2());
registerRequest(new ToInt2());
registerRequest(new GLMProgress());
registerRequest(new hex.glm.GLMGridProgress());
registerRequest(new water.api.Levels2()); // Temporary hack to get factor levels efficiently
registerRequest(new SetTimezone());
registerRequest(new GetTimezone());
registerRequest(new ListTimezones());
// Typeahead
registerRequest(new TypeaheadModelKeyRequest());
registerRequest(new TypeaheadPCAModelKeyRequest());
registerRequest(new TypeaheadHexKeyRequest());
registerRequest(new TypeaheadFileRequest());
registerRequest(new TypeaheadHdfsPathRequest());
registerRequest(new TypeaheadKeysRequest("Existing H2O Key", "", null));
registerRequest(new TypeaheadS3BucketRequest());
// testing hooks
registerRequest(new TestPoll());
registerRequest(new TestRedirect());
// registerRequest(new GLMProgressPage2());
registerRequest(new GLMModelView());
registerRequest(new GLMModelUpdate());
registerRequest(new GLMGridView());
// registerRequest(new GLMValidationView());
registerRequest(new LaunchJar());
Request.initializeNavBar();
// Pure APIs, no HTML, to support The New World
registerRequest(new Models());
registerRequest(new Frames());
registerRequest(new ModelMetrics());
// WaterMeter support APIs
registerRequest(new WaterMeterPerfbar.WaterMeterCpuTicks());
}
/**
* Registers the request with the request server.
*/
public static Request registerRequest(Request req) {
assert req.supportedVersions().length > 0;
for (API_VERSION ver : req.supportedVersions()) {
String href = req.href(ver);
assert (! _requests.containsKey(href)) : "Request with href "+href+" already registered";
_requests.put(href,req);
req.registered(ver);
}
return req;
}
public static void unregisterRequest(Request req) {
for (API_VERSION ver : req.supportedVersions()) {
String href = req.href(ver);
_requests.remove(href);
}
}
/** Registers the request with the request server. */
public static String registerGET (String url, Class hclass, String hmeth) { return register("GET" ,url,hclass,hmeth); }
public static String registerPUT (String url, Class hclass, String hmeth) { return register("PUT" ,url,hclass,hmeth); }
public static String registerDELETE(String url, Class hclass, String hmeth) { return register("DELETE",url,hclass,hmeth); }
public static String registerPOST (String url, Class hclass, String hmeth) { return register("POST" ,url,hclass,hmeth); }
private static String register(String method, String url, Class hclass, String hmeth) {
try {
assert lookup(method,url)==null; // Not shadowed
Method meth = hclass.getDeclaredMethod(hmeth);
_handlers.put(method+url,meth);
return url;
} catch( NoSuchMethodException nsme ) {
throw new Error("NoSuchMethodException: "+hclass.getName()+"."+hmeth);
}
}
// Lookup the method/url in the register list, and return a matching Method
private static Method lookup( String method, String url ) {
String s = method+url;
for( String x : _handlers.keySet() )
if( x.equals(s) ) // TODO: regex
return _handlers.get(x);
return null;
}
// Handling ------------------------------------------------------------------
private Schema handle( Request.RequestType type, Method meth, int version, Properties parms ) throws Exception {
Schema S;
switch( type ) {
// case html: // These request-types only dictate the response-type;
case java: // the normal action is always done.
case json:
case xml: {
Class x = meth.getDeclaringClass();
Class<Handler> clz = (Class<Handler>)x;
Handler h = clz.newInstance();
return h.handle(version,meth,parms); // Can throw any Exception the handler throws
}
case query:
case help:
default:
throw H2O.unimpl();
}
}
private Response wrap( String http_code, Schema S, RequestStatics.RequestType type ) {
// Convert Schema to desired output flavor
switch( type ) {
case json: return new Response(http_code, MIME_JSON, new String(S.writeJSON(new AutoBuffer()).buf()));
/*
case xml: //return new Response(http_code, MIME_XML , new String(S.writeXML (new AutoBuffer()).buf()));
case java:
throw H2O.unimpl();
case html: {
RString html = new RString(_htmlTemplate);
html.replace("CONTENTS", S.writeHTML(new water.util.DocGen.HTML()).toString());
return new Response(http_code, MIME_HTML, html.toString());
}
*/
default:
throw H2O.fail();
}
}
// Keep spinning until we get to launch the NanoHTTPD
public static void start() {
new Thread( new Runnable() {
@Override public void run() {
while( true ) {
try {
// Try to get the NanoHTTP daemon started
SERVER = new RequestServer(H2O._apiSocket);
break;
} catch( Exception ioe ) {
Log.err(Sys.HTTPD,"Launching NanoHTTP server got ",ioe);
try { Thread.sleep(1000); } catch( InterruptedException e ) { } // prevent denial-of-service
}
}
}
}, "Request Server launcher").start();
}
public static String maybeTransformRequest (String uri) {
if (uri.isEmpty() || uri.equals("/")) {
return "/Tutorials.html";
}
Pattern p = Pattern.compile("/R/bin/([^/]+)/contrib/([^/]+)(.*)");
Matcher m = p.matcher(uri);
boolean b = m.matches();
if (b) {
// On Jenkins, this command sticks his own R version's number
// into the package that gets built.
//
// R CMD INSTALL -l $(TMP_BUILD_DIR) --build h2o-package
//
String versionOfRThatJenkinsUsed = "3.0";
String platform = m.group(1);
String version = m.group(2);
String therest = m.group(3);
String s = "/R/bin/" + platform + "/contrib/" + versionOfRThatJenkinsUsed + therest;
return s;
}
return uri;
}
// uri serve -----------------------------------------------------------------
void maybeLogRequest (String uri, String method, Properties parms, Properties header) {
boolean filterOutRepetitiveStuff = true;
String log = String.format("%-4s %s", method, uri);
for( Object arg : parms.keySet() ) {
String value = parms.getProperty((String) arg);
if( value != null && value.length() != 0 )
log += " " + arg + "=" + value;
}
Log.info_no_stdout(Sys.HTLOG, log);
if (filterOutRepetitiveStuff) {
if (uri.endsWith(".css")) return;
if (uri.endsWith(".js")) return;
if (uri.endsWith(".png")) return;
if (uri.endsWith(".ico")) return;
if (uri.startsWith("/Typeahead")) return;
if (uri.startsWith("/2/Typeahead")) return;
if (uri.endsWith("LogAndEcho.json")) return;
if (uri.startsWith("/Cloud.json")) return;
if (uri.contains("Progress")) return;
if (uri.startsWith("/Jobs.json")) return;
if (uri.startsWith("/Up.json")) return;
if (uri.startsWith("/2/WaterMeter")) return;
}
Log.info(Sys.HTTPD, log);
if(header.getProperty("user-agent") != null)
H2O.GA.postAsync(new AppViewHit(uri).customDimension(H2O.CLIENT_TYPE_GA_CUST_DIM, header.getProperty("user-agent")));
else
H2O.GA.postAsync(new AppViewHit(uri));
}
///////// Stuff for URL parsing brought over from H2O2:
/** Returns the name of the request, that is the request url without the
* request suffix. E.g. converts "/GBM.html/crunk" into "/GBM/crunk" */
String requestName(String url) {
String s = "."+toString();
int i = url.indexOf(s);
if( i== -1 ) return url; // No, or default, type
return url.substring(0,i)+url.substring(i+s.length());
}
// Parse version number. Java has no ref types, bleah, so return the version
// number and the "parse pointer" by shift-by-16 compaction.
// /1/xxx --> version 1
// /2/xxx --> version 2
// /v1/xxx --> version 1
// /v2/xxx --> version 2
// /latest/xxx--> LATEST_VERSION
// /xxx --> LATEST_VERSION
private int parseVersion( String uri ) {
if( uri.length() <= 1 || uri.charAt(0) != '/' ) // If not a leading slash, then I am confused
return (0<<16)|LATEST_VERSION;
if( uri.startsWith("/latest") )
return (("/latest".length())<<16)|LATEST_VERSION;
int idx=1; // Skip the leading slash
int version=0;
char c = uri.charAt(idx); // Allow both /### and /v###
if( c=='v' ) c = uri.charAt(++idx);
while( idx < uri.length() && '0' <= c && c <= '9' ) {
version = version*10+(c-'0');
c = uri.charAt(++idx);
}
if( idx > 10 || version > LATEST_VERSION || version < 1 || uri.charAt(idx) != '/' )
return (0<<16)|LATEST_VERSION; // Failed number parse or baloney version
// Happy happy version
return (idx<<16)|version;
}
@Override public NanoHTTPD.Response serve( String uri, String method, Properties header, Properties parms ) {
// Jack priority for user-visible requests
Thread.currentThread().setPriority(Thread.MAX_PRIORITY-1);
// update arguments and determine control variables
uri = maybeTransformRequest(uri);
// determine the request type
Request.RequestType type = Request.RequestType.requestType(uri);
String requestName = type.requestName(uri);
maybeLogRequest(uri, method, parms, header);
// determine version
int version = parseVersion(uri);
int idx = version>>16;
version &= 0xFFFF;
String uripath = uri.substring(idx);
String path = requestName(uripath); // Strip suffix type from middle of URI
Method meth = null;
try {
// Find handler for url
meth = lookup(method,path);
if (meth != null) {
return wrap(HTTP_OK,handle(type,meth,version,parms),type);
}
} catch( IllegalArgumentException e ) {
return wrap(HTTP_BADREQUEST,new HTTP404V1(e.getMessage(),uri),type);
} catch( Exception e ) {
// make sure that no Exception is ever thrown out from the request
return wrap(e.getMessage()!="unimplemented"? HTTP_INTERNALERROR : HTTP_NOTIMPLEMENTED, new HTTP500V1(e),type);
}
// Wasn't a new type of handler:
try {
// determine if we have known resource
Request request = _requests.get(requestName);
// if the request is not know, treat as resource request, or 404 if not
// found
if (request == null)
return getResource(uri);
// Some requests create an instance per call
request = request.create(parms);
// call the request
return request.serve(this,parms,type);
} catch( Exception e ) {
if(!(e instanceof ExpectedExceptionForDebug))
e.printStackTrace();
// make sure that no Exception is ever thrown out from the request
parms.setProperty(Request.ERROR,e.getClass().getSimpleName()+": "+e.getMessage());
return _http500.serve(this,parms,type);
}
}
private RequestServer( ServerSocket socket ) throws IOException {
super(socket,null);
}
// Resource loading ----------------------------------------------------------
// Returns the response containing the given uri with the appropriate mime
// type.
private NanoHTTPD.Response getResource(String uri) {
byte[] bytes = _cache.get(uri);
if( bytes == null ) {
InputStream resource = Boot._init.getResource2(uri);
if (resource != null) {
try {
bytes = ByteStreams.toByteArray(resource);
} catch( IOException e ) { Log.err(e); }
byte[] res = _cache.putIfAbsent(uri,bytes);
if( res != null ) bytes = res; // Racey update; take what is in the _cache
}
Closeables.closeQuietly(resource);
}
if ((bytes == null) || (bytes.length == 0)) {
// make sure that no Exception is ever thrown out from the request
Properties parms = new Properties();
parms.setProperty(Request.ERROR,uri);
return _http404.serve(this,parms,Request.RequestType.www);
}
String mime = NanoHTTPD.MIME_DEFAULT_BINARY;
if (uri.endsWith(".css"))
mime = "text/css";
else if (uri.endsWith(".html"))
mime = "text/html";
// return new NanoHTTPD.Response(NanoHTTPD.HTTP_OK,mime,new ByteArrayInputStream(bytes));
NanoHTTPD.Response res = new NanoHTTPD.Response(NanoHTTPD.HTTP_OK,mime,new ByteArrayInputStream(bytes));
res.addHeader("Content-Length", Long.toString(bytes.length));
// res.addHeader("Content-Disposition", "attachment; filename=" + uri);
return res;
}
}
| {
"content_hash": "b9291663e6cc0f46c3b91e8c78a384cb",
"timestamp": "",
"source": "github",
"line_count": 569,
"max_line_length": 145,
"avg_line_length": 45.44991212653778,
"alnum_prop": 0.6535323460036349,
"repo_name": "eg-zhang/h2o-2",
"id": "4ef5f621f057cd50d71f6671bb1b2f265259d1c8",
"size": "25861",
"binary": false,
"copies": "8",
"ref": "refs/heads/master",
"path": "src/main/java/water/api/RequestServer.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Batchfile",
"bytes": "7065"
},
{
"name": "C",
"bytes": "2461"
},
{
"name": "CSS",
"bytes": "216906"
},
{
"name": "CoffeeScript",
"bytes": "205094"
},
{
"name": "Emacs Lisp",
"bytes": "7446"
},
{
"name": "Groovy",
"bytes": "518"
},
{
"name": "HTML",
"bytes": "177967"
},
{
"name": "Java",
"bytes": "5177683"
},
{
"name": "JavaScript",
"bytes": "42958"
},
{
"name": "Makefile",
"bytes": "50927"
},
{
"name": "PHP",
"bytes": "8490"
},
{
"name": "Perl",
"bytes": "22594"
},
{
"name": "Python",
"bytes": "3244626"
},
{
"name": "R",
"bytes": "1631216"
},
{
"name": "Ruby",
"bytes": "299"
},
{
"name": "Scala",
"bytes": "39365"
},
{
"name": "Shell",
"bytes": "189829"
}
],
"symlink_target": ""
} |
using System.Diagnostics.CodeAnalysis;
[assembly: SuppressMessage("Microsoft.Design", "CA1020:AvoidNamespacesWithFewTypes", Scope = "namespace", Target = "LimitsMiddleware.Logging")]
[assembly: SuppressMessage("Microsoft.Design", "CA1026:DefaultParametersShouldNotBeUsed", Scope = "member", Target = "LimitsMiddleware.Logging.Logger.#Invoke(LimitsMiddleware.Logging.LogLevel,System.Func`1<System.String>,System.Exception,System.Object[])")]
// If you copied this file manually, you need to change all "YourRootNameSpace" so not to clash with other libraries
// that use LibLog
#if LIBLOG_PROVIDERS_ONLY
namespace LimitsMiddleware.LibLog
#else
namespace LimitsMiddleware.Logging
#endif
{
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
#if LIBLOG_PROVIDERS_ONLY
using LimitsMiddleware.LibLog.LogProviders;
#else
using LimitsMiddleware.Logging.LogProviders;
#endif
using System;
#if !LIBLOG_PROVIDERS_ONLY
using System.Diagnostics;
#if !LIBLOG_PORTABLE
using System.Runtime.CompilerServices;
#endif
#endif
#if LIBLOG_PROVIDERS_ONLY
internal
#else
public
#endif
delegate bool Logger(LogLevel logLevel, Func<string> messageFunc, Exception exception = null, params object[] formatParameters);
#if !LIBLOG_PROVIDERS_ONLY
/// <summary>
/// Simple interface that represent a logger.
/// </summary>
#if LIBLOG_PUBLIC
public
#else
internal
#endif
interface ILog
{
/// <summary>
/// Log a message the specified log level.
/// </summary>
/// <param name="logLevel">The log level.</param>
/// <param name="messageFunc">The message function.</param>
/// <param name="exception">An optional exception.</param>
/// <param name="formatParameters">Optional format parameters for the message generated by the messagefunc. </param>
/// <returns>true if the message was logged. Otherwise false.</returns>
/// <remarks>
/// Note to implementers: the message func should not be called if the loglevel is not enabled
/// so as not to incur performance penalties.
///
/// To check IsEnabled call Log with only LogLevel and check the return value, no event will be written.
/// </remarks>
bool Log(LogLevel logLevel, Func<string> messageFunc, Exception exception = null, params object[] formatParameters);
}
#endif
/// <summary>
/// The log level.
/// </summary>
#if LIBLOG_PROVIDERS_ONLY
internal
#else
public
#endif
enum LogLevel
{
Trace,
Debug,
Info,
Warn,
Error,
Fatal
}
#if !LIBLOG_PROVIDERS_ONLY
#if LIBLOG_PUBLIC
public
#else
internal
#endif
static partial class LogExtensions
{
public static bool IsDebugEnabled(this ILog logger)
{
GuardAgainstNullLogger(logger);
return logger.Log(LogLevel.Debug, null);
}
public static bool IsErrorEnabled(this ILog logger)
{
GuardAgainstNullLogger(logger);
return logger.Log(LogLevel.Error, null);
}
public static bool IsFatalEnabled(this ILog logger)
{
GuardAgainstNullLogger(logger);
return logger.Log(LogLevel.Fatal, null);
}
public static bool IsInfoEnabled(this ILog logger)
{
GuardAgainstNullLogger(logger);
return logger.Log(LogLevel.Info, null);
}
public static bool IsTraceEnabled(this ILog logger)
{
GuardAgainstNullLogger(logger);
return logger.Log(LogLevel.Trace, null);
}
public static bool IsWarnEnabled(this ILog logger)
{
GuardAgainstNullLogger(logger);
return logger.Log(LogLevel.Warn, null);
}
public static void Debug(this ILog logger, Func<string> messageFunc)
{
GuardAgainstNullLogger(logger);
logger.Log(LogLevel.Debug, messageFunc);
}
public static void Debug(this ILog logger, string message)
{
if (logger.IsDebugEnabled())
{
logger.Log(LogLevel.Debug, message.AsFunc());
}
}
public static void DebugFormat(this ILog logger, string message, params object[] args)
{
if (logger.IsDebugEnabled())
{
logger.LogFormat(LogLevel.Debug, message, args);
}
}
public static void DebugException(this ILog logger, string message, Exception exception)
{
if (logger.IsDebugEnabled())
{
logger.Log(LogLevel.Debug, message.AsFunc(), exception);
}
}
public static void DebugException(this ILog logger, string message, Exception exception, params object[] formatParams)
{
if (logger.IsDebugEnabled())
{
logger.Log(LogLevel.Debug, message.AsFunc(), exception, formatParams);
}
}
public static void Error(this ILog logger, Func<string> messageFunc)
{
GuardAgainstNullLogger(logger);
logger.Log(LogLevel.Error, messageFunc);
}
public static void Error(this ILog logger, string message)
{
if (logger.IsErrorEnabled())
{
logger.Log(LogLevel.Error, message.AsFunc());
}
}
public static void ErrorFormat(this ILog logger, string message, params object[] args)
{
if (logger.IsErrorEnabled())
{
logger.LogFormat(LogLevel.Error, message, args);
}
}
public static void ErrorException(this ILog logger, string message, Exception exception, params object[] formatParams)
{
if (logger.IsErrorEnabled())
{
logger.Log(LogLevel.Error, message.AsFunc(), exception, formatParams);
}
}
public static void Fatal(this ILog logger, Func<string> messageFunc)
{
logger.Log(LogLevel.Fatal, messageFunc);
}
public static void Fatal(this ILog logger, string message)
{
if (logger.IsFatalEnabled())
{
logger.Log(LogLevel.Fatal, message.AsFunc());
}
}
public static void FatalFormat(this ILog logger, string message, params object[] args)
{
if (logger.IsFatalEnabled())
{
logger.LogFormat(LogLevel.Fatal, message, args);
}
}
public static void FatalException(this ILog logger, string message, Exception exception, params object[] formatParams)
{
if (logger.IsFatalEnabled())
{
logger.Log(LogLevel.Fatal, message.AsFunc(), exception, formatParams);
}
}
public static void Info(this ILog logger, Func<string> messageFunc)
{
GuardAgainstNullLogger(logger);
logger.Log(LogLevel.Info, messageFunc);
}
public static void Info(this ILog logger, string message)
{
if (logger.IsInfoEnabled())
{
logger.Log(LogLevel.Info, message.AsFunc());
}
}
public static void InfoFormat(this ILog logger, string message, params object[] args)
{
if (logger.IsInfoEnabled())
{
logger.LogFormat(LogLevel.Info, message, args);
}
}
public static void InfoException(this ILog logger, string message, Exception exception, params object[] formatParams)
{
if (logger.IsInfoEnabled())
{
logger.Log(LogLevel.Info, message.AsFunc(), exception, formatParams);
}
}
public static void Trace(this ILog logger, Func<string> messageFunc)
{
GuardAgainstNullLogger(logger);
logger.Log(LogLevel.Trace, messageFunc);
}
public static void Trace(this ILog logger, string message)
{
if (logger.IsTraceEnabled())
{
logger.Log(LogLevel.Trace, message.AsFunc());
}
}
public static void TraceFormat(this ILog logger, string message, params object[] args)
{
if (logger.IsTraceEnabled())
{
logger.LogFormat(LogLevel.Trace, message, args);
}
}
public static void TraceException(this ILog logger, string message, Exception exception, params object[] formatParams)
{
if (logger.IsTraceEnabled())
{
logger.Log(LogLevel.Trace, message.AsFunc(), exception, formatParams);
}
}
public static void Warn(this ILog logger, Func<string> messageFunc)
{
GuardAgainstNullLogger(logger);
logger.Log(LogLevel.Warn, messageFunc);
}
public static void Warn(this ILog logger, string message)
{
if (logger.IsWarnEnabled())
{
logger.Log(LogLevel.Warn, message.AsFunc());
}
}
public static void WarnFormat(this ILog logger, string message, params object[] args)
{
if (logger.IsWarnEnabled())
{
logger.LogFormat(LogLevel.Warn, message, args);
}
}
public static void WarnException(this ILog logger, string message, Exception exception, params object[] formatParams)
{
if (logger.IsWarnEnabled())
{
logger.Log(LogLevel.Warn, message.AsFunc(), exception, formatParams);
}
}
// ReSharper disable once UnusedParameter.Local
private static void GuardAgainstNullLogger(ILog logger)
{
if (logger == null)
{
throw new ArgumentNullException("logger");
}
}
private static void LogFormat(this ILog logger, LogLevel logLevel, string message, params object[] args)
{
logger.Log(logLevel, message.AsFunc(), null, args);
}
// Avoid the closure allocation, see https://gist.github.com/AArnott/d285feef75c18f6ecd2b
private static Func<T> AsFunc<T>(this T value) where T : class
{
return value.Return;
}
private static T Return<T>(this T value)
{
return value;
}
}
#endif
/// <summary>
/// Represents a way to get a <see cref="ILog"/>
/// </summary>
#if LIBLOG_PROVIDERS_ONLY
internal
#else
public
#endif
interface ILogProvider
{
/// <summary>
/// Gets the specified named logger.
/// </summary>
/// <param name="name">Name of the logger.</param>
/// <returns>The logger reference.</returns>
Logger GetLogger(string name);
/// <summary>
/// Opens a nested diagnostics context. Not supported in EntLib logging.
/// </summary>
/// <param name="message">The message to add to the diagnostics context.</param>
/// <returns>A disposable that when disposed removes the message from the context.</returns>
IDisposable OpenNestedContext(string message);
/// <summary>
/// Opens a mapped diagnostics context. Not supported in EntLib logging.
/// </summary>
/// <param name="key">A key.</param>
/// <param name="value">A value.</param>
/// <returns>A disposable that when disposed removes the map from the context.</returns>
IDisposable OpenMappedContext(string key, string value);
}
/// <summary>
/// Provides a mechanism to create instances of <see cref="ILog" /> objects.
/// </summary>
#if LIBLOG_PROVIDERS_ONLY
internal
#else
public
#endif
static class LogProvider
{
#if !LIBLOG_PROVIDERS_ONLY
/// <summary>
/// The disable logging environment variable. If the environment variable is set to 'true', then logging
/// will be disabled.
/// </summary>
public const string DisableLoggingEnvironmentVariable = "LimitsMiddleware_LIBLOG_DISABLE";
private const string NullLogProvider = "Current Log Provider is not set. Call SetCurrentLogProvider " +
"with a non-null value first.";
private static dynamic s_currentLogProvider;
private static Action<ILogProvider> s_onCurrentLogProviderSet;
[SuppressMessage("Microsoft.Performance", "CA1810:InitializeReferenceTypeStaticFieldsInline")]
static LogProvider()
{
IsDisabled = false;
}
/// <summary>
/// Sets the current log provider.
/// </summary>
/// <param name="logProvider">The log provider.</param>
public static void SetCurrentLogProvider(ILogProvider logProvider)
{
s_currentLogProvider = logProvider;
RaiseOnCurrentLogProviderSet();
}
/// <summary>
/// Gets or sets a value indicating whether this is logging is disabled.
/// </summary>
/// <value>
/// <c>true</c> if logging is disabled; otherwise, <c>false</c>.
/// </value>
public static bool IsDisabled { get; set; }
/// <summary>
/// Sets an action that is invoked when a consumer of your library has called SetCurrentLogProvider. It is
/// important that hook into this if you are using child libraries (especially ilmerged ones) that are using
/// LibLog (or other logging abstraction) so you adapt and delegate to them.
/// <see cref="SetCurrentLogProvider"/>
/// </summary>
internal static Action<ILogProvider> OnCurrentLogProviderSet
{
set
{
s_onCurrentLogProviderSet = value;
RaiseOnCurrentLogProviderSet();
}
}
internal static ILogProvider CurrentLogProvider
{
get
{
return s_currentLogProvider;
}
}
/// <summary>
/// Gets a logger for the specified type.
/// </summary>
/// <typeparam name="T">The type whose name will be used for the logger.</typeparam>
/// <returns>An instance of <see cref="ILog"/></returns>
#if LIBLOG_PUBLIC
public
#else
internal
#endif
static ILog For<T>()
{
return GetLogger(typeof(T));
}
#if !LIBLOG_PORTABLE
/// <summary>
/// Gets a logger for the current class.
/// </summary>
/// <returns>An instance of <see cref="ILog"/></returns>
[MethodImpl(MethodImplOptions.NoInlining)]
#if LIBLOG_PUBLIC
public
#else
internal
#endif
static ILog GetCurrentClassLogger()
{
var stackFrame = new StackFrame(1, false);
return GetLogger(stackFrame.GetMethod().DeclaringType);
}
#endif
/// <summary>
/// Gets a logger for the specified type.
/// </summary>
/// <param name="type">The type whose name will be used for the logger.</param>
/// <returns>An instance of <see cref="ILog"/></returns>
#if LIBLOG_PUBLIC
public
#else
internal
#endif
static ILog GetLogger(Type type)
{
return GetLogger(type.FullName);
}
/// <summary>
/// Gets a logger with the specified name.
/// </summary>
/// <param name="name">The name.</param>
/// <returns>An instance of <see cref="ILog"/></returns>
#if LIBLOG_PUBLIC
public
#else
internal
#endif
static ILog GetLogger(string name)
{
ILogProvider logProvider = CurrentLogProvider ?? ResolveLogProvider();
return logProvider == null
? NoOpLogger.Instance
: (ILog)new LoggerExecutionWrapper(logProvider.GetLogger(name), () => IsDisabled);
}
/// <summary>
/// Opens a nested diagnostics context.
/// </summary>
/// <param name="message">A message.</param>
/// <returns>An <see cref="IDisposable"/> that closes context when disposed.</returns>
[SuppressMessage("Microsoft.Naming", "CA2204:Literals should be spelled correctly", MessageId = "SetCurrentLogProvider")]
#if LIBLOG_PUBLIC
public
#else
internal
#endif
static IDisposable OpenNestedContext(string message)
{
ILogProvider logProvider = CurrentLogProvider ?? ResolveLogProvider();
return logProvider == null
? new DisposableAction(() => { })
: logProvider.OpenNestedContext(message);
}
/// <summary>
/// Opens a mapped diagnostics context.
/// </summary>
/// <param name="key">A key.</param>
/// <param name="value">A value.</param>
/// <returns>An <see cref="IDisposable"/> that closes context when disposed.</returns>
[SuppressMessage("Microsoft.Naming", "CA2204:Literals should be spelled correctly", MessageId = "SetCurrentLogProvider")]
#if LIBLOG_PUBLIC
public
#else
internal
#endif
static IDisposable OpenMappedContext(string key, string value)
{
ILogProvider logProvider = CurrentLogProvider ?? ResolveLogProvider();
return logProvider == null
? new DisposableAction(() => { })
: logProvider.OpenMappedContext(key, value);
}
#endif
#if LIBLOG_PROVIDERS_ONLY
private
#else
internal
#endif
delegate bool IsLoggerAvailable();
#if LIBLOG_PROVIDERS_ONLY
private
#else
internal
#endif
delegate ILogProvider CreateLogProvider();
#if LIBLOG_PROVIDERS_ONLY
private
#else
internal
#endif
static readonly List<Tuple<IsLoggerAvailable, CreateLogProvider>> LogProviderResolvers =
new List<Tuple<IsLoggerAvailable, CreateLogProvider>>
{
new Tuple<IsLoggerAvailable, CreateLogProvider>(SerilogLogProvider.IsLoggerAvailable, () => new SerilogLogProvider()),
new Tuple<IsLoggerAvailable, CreateLogProvider>(NLogLogProvider.IsLoggerAvailable, () => new NLogLogProvider()),
new Tuple<IsLoggerAvailable, CreateLogProvider>(Log4NetLogProvider.IsLoggerAvailable, () => new Log4NetLogProvider()),
new Tuple<IsLoggerAvailable, CreateLogProvider>(EntLibLogProvider.IsLoggerAvailable, () => new EntLibLogProvider()),
new Tuple<IsLoggerAvailable, CreateLogProvider>(LoupeLogProvider.IsLoggerAvailable, () => new LoupeLogProvider()),
};
#if !LIBLOG_PROVIDERS_ONLY
private static void RaiseOnCurrentLogProviderSet()
{
if (s_onCurrentLogProviderSet != null)
{
s_onCurrentLogProviderSet(s_currentLogProvider);
}
}
#endif
[SuppressMessage("Microsoft.Globalization", "CA1303:Do not pass literals as localized parameters", MessageId = "System.Console.WriteLine(System.String,System.Object,System.Object)")]
[SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes")]
internal static ILogProvider ResolveLogProvider()
{
try
{
foreach (var providerResolver in LogProviderResolvers)
{
if (providerResolver.Item1())
{
return providerResolver.Item2();
}
}
}
catch (Exception ex)
{
#if LIBLOG_PORTABLE
Debug.WriteLine(
#else
Console.WriteLine(
#endif
"Exception occurred resolving a log provider. Logging for this assembly {0} is disabled. {1}",
typeof(LogProvider).GetAssemblyPortable().FullName,
ex);
}
return null;
}
#if !LIBLOG_PROVIDERS_ONLY
internal class NoOpLogger : ILog
{
internal static readonly NoOpLogger Instance = new NoOpLogger();
public bool Log(LogLevel logLevel, Func<string> messageFunc, Exception exception, params object[] formatParameters)
{
return false;
}
}
#endif
}
#if !LIBLOG_PROVIDERS_ONLY
internal class LoggerExecutionWrapper : ILog
{
private readonly Logger _logger;
private readonly Func<bool> _getIsDisabled;
internal const string FailedToGenerateLogMessage = "Failed to generate log message";
internal LoggerExecutionWrapper(Logger logger, Func<bool> getIsDisabled = null)
{
_logger = logger;
_getIsDisabled = getIsDisabled ?? (() => false);
}
internal Logger WrappedLogger
{
get { return _logger; }
}
[SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes")]
public bool Log(LogLevel logLevel, Func<string> messageFunc, Exception exception = null, params object[] formatParameters)
{
if (_getIsDisabled())
{
return false;
}
#if !LIBLOG_PORTABLE
var envVar = Environment.GetEnvironmentVariable(LogProvider.DisableLoggingEnvironmentVariable);
if (envVar != null && envVar.Equals("true", StringComparison.OrdinalIgnoreCase))
{
return false;
}
#endif
if (messageFunc == null)
{
return _logger(logLevel, null);
}
Func<string> wrappedMessageFunc = () =>
{
try
{
return messageFunc();
}
catch (Exception ex)
{
Log(LogLevel.Error, () => FailedToGenerateLogMessage, ex);
}
return null;
};
return _logger(logLevel, wrappedMessageFunc, exception, formatParameters);
}
}
#endif
}
#if LIBLOG_PROVIDERS_ONLY
namespace LimitsMiddleware.LibLog.LogProviders
#else
namespace LimitsMiddleware.Logging.LogProviders
#endif
{
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
#if !LIBLOG_PORTABLE
using System.Diagnostics;
#endif
using System.Globalization;
using System.Linq;
using System.Linq.Expressions;
using System.Reflection;
#if !LIBLOG_PORTABLE
using System.Text;
#endif
using System.Text.RegularExpressions;
internal abstract class LogProviderBase : ILogProvider
{
protected delegate IDisposable OpenNdc(string message);
protected delegate IDisposable OpenMdc(string key, string value);
private readonly Lazy<OpenNdc> _lazyOpenNdcMethod;
private readonly Lazy<OpenMdc> _lazyOpenMdcMethod;
private static readonly IDisposable NoopDisposableInstance = new DisposableAction();
protected LogProviderBase()
{
_lazyOpenNdcMethod
= new Lazy<OpenNdc>(GetOpenNdcMethod);
_lazyOpenMdcMethod
= new Lazy<OpenMdc>(GetOpenMdcMethod);
}
public abstract Logger GetLogger(string name);
public IDisposable OpenNestedContext(string message)
{
return _lazyOpenNdcMethod.Value(message);
}
public IDisposable OpenMappedContext(string key, string value)
{
return _lazyOpenMdcMethod.Value(key, value);
}
protected virtual OpenNdc GetOpenNdcMethod()
{
return _ => NoopDisposableInstance;
}
protected virtual OpenMdc GetOpenMdcMethod()
{
return (_, __) => NoopDisposableInstance;
}
}
internal class NLogLogProvider : LogProviderBase
{
private readonly Func<string, object> _getLoggerByNameDelegate;
private static bool s_providerIsAvailableOverride = true;
[SuppressMessage("Microsoft.Naming", "CA2204:Literals should be spelled correctly", MessageId = "LogManager")]
[SuppressMessage("Microsoft.Naming", "CA2204:Literals should be spelled correctly", MessageId = "NLog")]
public NLogLogProvider()
{
if (!IsLoggerAvailable())
{
throw new InvalidOperationException("NLog.LogManager not found");
}
_getLoggerByNameDelegate = GetGetLoggerMethodCall();
}
public static bool ProviderIsAvailableOverride
{
get { return s_providerIsAvailableOverride; }
set { s_providerIsAvailableOverride = value; }
}
public override Logger GetLogger(string name)
{
return new NLogLogger(_getLoggerByNameDelegate(name)).Log;
}
public static bool IsLoggerAvailable()
{
return ProviderIsAvailableOverride && GetLogManagerType() != null;
}
protected override OpenNdc GetOpenNdcMethod()
{
Type ndcContextType = Type.GetType("NLog.NestedDiagnosticsContext, NLog");
MethodInfo pushMethod = ndcContextType.GetMethodPortable("Push", typeof(string));
ParameterExpression messageParam = Expression.Parameter(typeof(string), "message");
MethodCallExpression pushMethodCall = Expression.Call(null, pushMethod, messageParam);
return Expression.Lambda<OpenNdc>(pushMethodCall, messageParam).Compile();
}
protected override OpenMdc GetOpenMdcMethod()
{
Type mdcContextType = Type.GetType("NLog.MappedDiagnosticsContext, NLog");
MethodInfo setMethod = mdcContextType.GetMethodPortable("Set", typeof(string), typeof(string));
MethodInfo removeMethod = mdcContextType.GetMethodPortable("Remove", typeof(string));
ParameterExpression keyParam = Expression.Parameter(typeof(string), "key");
ParameterExpression valueParam = Expression.Parameter(typeof(string), "value");
MethodCallExpression setMethodCall = Expression.Call(null, setMethod, keyParam, valueParam);
MethodCallExpression removeMethodCall = Expression.Call(null, removeMethod, keyParam);
Action<string, string> set = Expression
.Lambda<Action<string, string>>(setMethodCall, keyParam, valueParam)
.Compile();
Action<string> remove = Expression
.Lambda<Action<string>>(removeMethodCall, keyParam)
.Compile();
return (key, value) =>
{
set(key, value);
return new DisposableAction(() => remove(key));
};
}
private static Type GetLogManagerType()
{
return Type.GetType("NLog.LogManager, NLog");
}
private static Func<string, object> GetGetLoggerMethodCall()
{
Type logManagerType = GetLogManagerType();
MethodInfo method = logManagerType.GetMethodPortable("GetLogger", typeof(string));
ParameterExpression nameParam = Expression.Parameter(typeof(string), "name");
MethodCallExpression methodCall = Expression.Call(null, method, nameParam);
return Expression.Lambda<Func<string, object>>(methodCall, nameParam).Compile();
}
internal class NLogLogger
{
private readonly dynamic _logger;
internal NLogLogger(dynamic logger)
{
_logger = logger;
}
[SuppressMessage("Microsoft.Maintainability", "CA1502:AvoidExcessiveComplexity")]
public bool Log(LogLevel logLevel, Func<string> messageFunc, Exception exception, params object[] formatParameters)
{
if (messageFunc == null)
{
return IsLogLevelEnable(logLevel);
}
messageFunc = LogMessageFormatter.SimulateStructuredLogging(messageFunc, formatParameters);
if (exception != null)
{
return LogException(logLevel, messageFunc, exception);
}
switch (logLevel)
{
case LogLevel.Debug:
if (_logger.IsDebugEnabled)
{
_logger.Debug(messageFunc());
return true;
}
break;
case LogLevel.Info:
if (_logger.IsInfoEnabled)
{
_logger.Info(messageFunc());
return true;
}
break;
case LogLevel.Warn:
if (_logger.IsWarnEnabled)
{
_logger.Warn(messageFunc());
return true;
}
break;
case LogLevel.Error:
if (_logger.IsErrorEnabled)
{
_logger.Error(messageFunc());
return true;
}
break;
case LogLevel.Fatal:
if (_logger.IsFatalEnabled)
{
_logger.Fatal(messageFunc());
return true;
}
break;
default:
if (_logger.IsTraceEnabled)
{
_logger.Trace(messageFunc());
return true;
}
break;
}
return false;
}
[SuppressMessage("Microsoft.Maintainability", "CA1502:AvoidExcessiveComplexity")]
private bool LogException(LogLevel logLevel, Func<string> messageFunc, Exception exception)
{
switch (logLevel)
{
case LogLevel.Debug:
if (_logger.IsDebugEnabled)
{
_logger.DebugException(messageFunc(), exception);
return true;
}
break;
case LogLevel.Info:
if (_logger.IsInfoEnabled)
{
_logger.InfoException(messageFunc(), exception);
return true;
}
break;
case LogLevel.Warn:
if (_logger.IsWarnEnabled)
{
_logger.WarnException(messageFunc(), exception);
return true;
}
break;
case LogLevel.Error:
if (_logger.IsErrorEnabled)
{
_logger.ErrorException(messageFunc(), exception);
return true;
}
break;
case LogLevel.Fatal:
if (_logger.IsFatalEnabled)
{
_logger.FatalException(messageFunc(), exception);
return true;
}
break;
default:
if (_logger.IsTraceEnabled)
{
_logger.TraceException(messageFunc(), exception);
return true;
}
break;
}
return false;
}
private bool IsLogLevelEnable(LogLevel logLevel)
{
switch (logLevel)
{
case LogLevel.Debug:
return _logger.IsDebugEnabled;
case LogLevel.Info:
return _logger.IsInfoEnabled;
case LogLevel.Warn:
return _logger.IsWarnEnabled;
case LogLevel.Error:
return _logger.IsErrorEnabled;
case LogLevel.Fatal:
return _logger.IsFatalEnabled;
default:
return _logger.IsTraceEnabled;
}
}
}
}
internal class Log4NetLogProvider : LogProviderBase
{
private readonly Func<string, object> _getLoggerByNameDelegate;
private static bool s_providerIsAvailableOverride = true;
[SuppressMessage("Microsoft.Naming", "CA2204:Literals should be spelled correctly", MessageId = "LogManager")]
public Log4NetLogProvider()
{
if (!IsLoggerAvailable())
{
throw new InvalidOperationException("log4net.LogManager not found");
}
_getLoggerByNameDelegate = GetGetLoggerMethodCall();
}
public static bool ProviderIsAvailableOverride
{
get { return s_providerIsAvailableOverride; }
set { s_providerIsAvailableOverride = value; }
}
public override Logger GetLogger(string name)
{
return new Log4NetLogger(_getLoggerByNameDelegate(name)).Log;
}
internal static bool IsLoggerAvailable()
{
return ProviderIsAvailableOverride && GetLogManagerType() != null;
}
protected override OpenNdc GetOpenNdcMethod()
{
Type logicalThreadContextType = Type.GetType("log4net.LogicalThreadContext, log4net");
PropertyInfo stacksProperty = logicalThreadContextType.GetPropertyPortable("Stacks");
Type logicalThreadContextStacksType = stacksProperty.PropertyType;
PropertyInfo stacksIndexerProperty = logicalThreadContextStacksType.GetPropertyPortable("Item");
Type stackType = stacksIndexerProperty.PropertyType;
MethodInfo pushMethod = stackType.GetMethodPortable("Push");
ParameterExpression messageParameter =
Expression.Parameter(typeof(string), "message");
// message => LogicalThreadContext.Stacks.Item["NDC"].Push(message);
MethodCallExpression callPushBody =
Expression.Call(
Expression.Property(Expression.Property(null, stacksProperty),
stacksIndexerProperty,
Expression.Constant("NDC")),
pushMethod,
messageParameter);
OpenNdc result =
Expression.Lambda<OpenNdc>(callPushBody, messageParameter)
.Compile();
return result;
}
protected override OpenMdc GetOpenMdcMethod()
{
Type logicalThreadContextType = Type.GetType("log4net.LogicalThreadContext, log4net");
PropertyInfo propertiesProperty = logicalThreadContextType.GetPropertyPortable("Properties");
Type logicalThreadContextPropertiesType = propertiesProperty.PropertyType;
PropertyInfo propertiesIndexerProperty = logicalThreadContextPropertiesType.GetPropertyPortable("Item");
MethodInfo removeMethod = logicalThreadContextPropertiesType.GetMethodPortable("Remove");
ParameterExpression keyParam = Expression.Parameter(typeof(string), "key");
ParameterExpression valueParam = Expression.Parameter(typeof(string), "value");
MemberExpression propertiesExpression = Expression.Property(null, propertiesProperty);
// (key, value) => LogicalThreadContext.Properties.Item[key] = value;
BinaryExpression setProperties = Expression.Assign(Expression.Property(propertiesExpression, propertiesIndexerProperty, keyParam), valueParam);
// key => LogicalThreadContext.Properties.Remove(key);
MethodCallExpression removeMethodCall = Expression.Call(propertiesExpression, removeMethod, keyParam);
Action<string, string> set = Expression
.Lambda<Action<string, string>>(setProperties, keyParam, valueParam)
.Compile();
Action<string> remove = Expression
.Lambda<Action<string>>(removeMethodCall, keyParam)
.Compile();
return (key, value) =>
{
set(key, value);
return new DisposableAction(() => remove(key));
};
}
private static Type GetLogManagerType()
{
return Type.GetType("log4net.LogManager, log4net");
}
private static Func<string, object> GetGetLoggerMethodCall()
{
Type logManagerType = GetLogManagerType();
MethodInfo method = logManagerType.GetMethodPortable("GetLogger", typeof(string));
ParameterExpression nameParam = Expression.Parameter(typeof(string), "name");
MethodCallExpression methodCall = Expression.Call(null, method, nameParam);
return Expression.Lambda<Func<string, object>>(methodCall, nameParam).Compile();
}
internal class Log4NetLogger
{
private readonly dynamic _logger;
private static Type s_callerStackBoundaryType;
private static readonly object CallerStackBoundaryTypeSync = new object();
private readonly object _levelDebug;
private readonly object _levelInfo;
private readonly object _levelWarn;
private readonly object _levelError;
private readonly object _levelFatal;
private readonly Func<object, object, bool> _isEnabledForDelegate;
private readonly Action<object, Type, object, string, Exception> _logDelegate;
[SuppressMessage("Microsoft.Naming", "CA2204:Literals should be spelled correctly", MessageId = "ILogger")]
internal Log4NetLogger(dynamic logger)
{
_logger = logger.Logger;
var logEventLevelType = Type.GetType("log4net.Core.Level, log4net");
if (logEventLevelType == null)
{
throw new InvalidOperationException("Type log4net.Core.Level was not found.");
}
var levelFields = logEventLevelType.GetFieldsPortable().ToList();
_levelDebug = levelFields.First(x => x.Name == "Debug").GetValue(null);
_levelInfo = levelFields.First(x => x.Name == "Info").GetValue(null);
_levelWarn = levelFields.First(x => x.Name == "Warn").GetValue(null);
_levelError = levelFields.First(x => x.Name == "Error").GetValue(null);
_levelFatal = levelFields.First(x => x.Name == "Fatal").GetValue(null);
// Func<object, object, bool> isEnabledFor = (logger, level) => { return ((log4net.Core.ILogger)logger).IsEnabled(level); }
var loggerType = Type.GetType("log4net.Core.ILogger, log4net");
if (loggerType == null)
{
throw new InvalidOperationException("Type log4net.Core.ILogger, was not found.");
}
MethodInfo isEnabledMethodInfo = loggerType.GetMethodPortable("IsEnabledFor", logEventLevelType);
ParameterExpression instanceParam = Expression.Parameter(typeof(object));
UnaryExpression instanceCast = Expression.Convert(instanceParam, loggerType);
ParameterExpression callerStackBoundaryDeclaringTypeParam = Expression.Parameter(typeof(Type));
ParameterExpression levelParam = Expression.Parameter(typeof(object));
ParameterExpression messageParam = Expression.Parameter(typeof(string));
UnaryExpression levelCast = Expression.Convert(levelParam, logEventLevelType);
MethodCallExpression isEnabledMethodCall = Expression.Call(instanceCast, isEnabledMethodInfo, levelCast);
_isEnabledForDelegate = Expression.Lambda<Func<object, object, bool>>(isEnabledMethodCall, instanceParam, levelParam).Compile();
// Action<object, object, string, Exception> Log =
// (logger, callerStackBoundaryDeclaringType, level, message, exception) => { ((ILogger)logger).Write(callerStackBoundaryDeclaringType, level, message, exception); }
MethodInfo writeExceptionMethodInfo = loggerType.GetMethodPortable("Log",
typeof(Type),
logEventLevelType,
typeof(string),
typeof(Exception));
ParameterExpression exceptionParam = Expression.Parameter(typeof(Exception));
var writeMethodExp = Expression.Call(
instanceCast,
writeExceptionMethodInfo,
callerStackBoundaryDeclaringTypeParam,
levelCast,
messageParam,
exceptionParam);
_logDelegate = Expression.Lambda<Action<object, Type, object, string, Exception>>(
writeMethodExp,
instanceParam,
callerStackBoundaryDeclaringTypeParam,
levelParam,
messageParam,
exceptionParam).Compile();
}
public bool Log(LogLevel logLevel, Func<string> messageFunc, Exception exception, params object[] formatParameters)
{
if (messageFunc == null)
{
return IsLogLevelEnable(logLevel);
}
if (!IsLogLevelEnable(logLevel))
{
return false;
}
messageFunc = LogMessageFormatter.SimulateStructuredLogging(messageFunc, formatParameters);
// determine correct caller - this might change due to jit optimizations with method inlining
if (s_callerStackBoundaryType == null)
{
lock (CallerStackBoundaryTypeSync)
{
#if !LIBLOG_PORTABLE
StackTrace stack = new StackTrace();
Type thisType = GetType();
s_callerStackBoundaryType = Type.GetType("LoggerExecutionWrapper");
for (var i = 1; i < stack.FrameCount; i++)
{
if (!IsInTypeHierarchy(thisType, stack.GetFrame(i).GetMethod().DeclaringType))
{
s_callerStackBoundaryType = stack.GetFrame(i - 1).GetMethod().DeclaringType;
break;
}
}
#else
s_callerStackBoundaryType = typeof(LoggerExecutionWrapper);
#endif
}
}
var translatedLevel = TranslateLevel(logLevel);
_logDelegate(_logger, s_callerStackBoundaryType, translatedLevel, messageFunc(), exception);
return true;
}
private static bool IsInTypeHierarchy(Type currentType, Type checkType)
{
while (currentType != null && currentType != typeof(object))
{
if (currentType == checkType)
{
return true;
}
currentType = currentType.GetBaseTypePortable();
}
return false;
}
private bool IsLogLevelEnable(LogLevel logLevel)
{
var level = TranslateLevel(logLevel);
return _isEnabledForDelegate(_logger, level);
}
private object TranslateLevel(LogLevel logLevel)
{
switch (logLevel)
{
case LogLevel.Trace:
case LogLevel.Debug:
return _levelDebug;
case LogLevel.Info:
return _levelInfo;
case LogLevel.Warn:
return _levelWarn;
case LogLevel.Error:
return _levelError;
case LogLevel.Fatal:
return _levelFatal;
default:
throw new ArgumentOutOfRangeException("logLevel", logLevel, null);
}
}
}
}
internal class EntLibLogProvider : LogProviderBase
{
private const string TypeTemplate = "Microsoft.Practices.EnterpriseLibrary.Logging.{0}, Microsoft.Practices.EnterpriseLibrary.Logging";
private static bool s_providerIsAvailableOverride = true;
private static readonly Type LogEntryType;
private static readonly Type LoggerType;
private static readonly Type TraceEventTypeType;
private static readonly Action<string, string, int> WriteLogEntry;
private static readonly Func<string, int, bool> ShouldLogEntry;
[SuppressMessage("Microsoft.Performance", "CA1810:InitializeReferenceTypeStaticFieldsInline")]
static EntLibLogProvider()
{
LogEntryType = Type.GetType(string.Format(CultureInfo.InvariantCulture, TypeTemplate, "LogEntry"));
LoggerType = Type.GetType(string.Format(CultureInfo.InvariantCulture, TypeTemplate, "Logger"));
TraceEventTypeType = TraceEventTypeValues.Type;
if (LogEntryType == null
|| TraceEventTypeType == null
|| LoggerType == null)
{
return;
}
WriteLogEntry = GetWriteLogEntry();
ShouldLogEntry = GetShouldLogEntry();
}
[SuppressMessage("Microsoft.Naming", "CA2204:Literals should be spelled correctly", MessageId = "EnterpriseLibrary")]
public EntLibLogProvider()
{
if (!IsLoggerAvailable())
{
throw new InvalidOperationException("Microsoft.Practices.EnterpriseLibrary.Logging.Logger not found");
}
}
public static bool ProviderIsAvailableOverride
{
get { return s_providerIsAvailableOverride; }
set { s_providerIsAvailableOverride = value; }
}
public override Logger GetLogger(string name)
{
return new EntLibLogger(name, WriteLogEntry, ShouldLogEntry).Log;
}
internal static bool IsLoggerAvailable()
{
return ProviderIsAvailableOverride
&& TraceEventTypeType != null
&& LogEntryType != null;
}
private static Action<string, string, int> GetWriteLogEntry()
{
// new LogEntry(...)
var logNameParameter = Expression.Parameter(typeof(string), "logName");
var messageParameter = Expression.Parameter(typeof(string), "message");
var severityParameter = Expression.Parameter(typeof(int), "severity");
MemberInitExpression memberInit = GetWriteLogExpression(
messageParameter,
Expression.Convert(severityParameter, TraceEventTypeType),
logNameParameter);
//Logger.Write(new LogEntry(....));
MethodInfo writeLogEntryMethod = LoggerType.GetMethodPortable("Write", LogEntryType);
var writeLogEntryExpression = Expression.Call(writeLogEntryMethod, memberInit);
return Expression.Lambda<Action<string, string, int>>(
writeLogEntryExpression,
logNameParameter,
messageParameter,
severityParameter).Compile();
}
private static Func<string, int, bool> GetShouldLogEntry()
{
// new LogEntry(...)
var logNameParameter = Expression.Parameter(typeof(string), "logName");
var severityParameter = Expression.Parameter(typeof(int), "severity");
MemberInitExpression memberInit = GetWriteLogExpression(
Expression.Constant("***dummy***"),
Expression.Convert(severityParameter, TraceEventTypeType),
logNameParameter);
//Logger.Write(new LogEntry(....));
MethodInfo writeLogEntryMethod = LoggerType.GetMethodPortable("ShouldLog", LogEntryType);
var writeLogEntryExpression = Expression.Call(writeLogEntryMethod, memberInit);
return Expression.Lambda<Func<string, int, bool>>(
writeLogEntryExpression,
logNameParameter,
severityParameter).Compile();
}
private static MemberInitExpression GetWriteLogExpression(Expression message,
Expression severityParameter, ParameterExpression logNameParameter)
{
var entryType = LogEntryType;
MemberInitExpression memberInit = Expression.MemberInit(Expression.New(entryType),
Expression.Bind(entryType.GetPropertyPortable("Message"), message),
Expression.Bind(entryType.GetPropertyPortable("Severity"), severityParameter),
Expression.Bind(
entryType.GetPropertyPortable("TimeStamp"),
Expression.Property(null, typeof(DateTime).GetPropertyPortable("UtcNow"))),
Expression.Bind(
entryType.GetPropertyPortable("Categories"),
Expression.ListInit(
Expression.New(typeof(List<string>)),
typeof(List<string>).GetMethodPortable("Add", typeof(string)),
logNameParameter)));
return memberInit;
}
internal class EntLibLogger
{
private readonly string _loggerName;
private readonly Action<string, string, int> _writeLog;
private readonly Func<string, int, bool> _shouldLog;
internal EntLibLogger(string loggerName, Action<string, string, int> writeLog, Func<string, int, bool> shouldLog)
{
_loggerName = loggerName;
_writeLog = writeLog;
_shouldLog = shouldLog;
}
public bool Log(LogLevel logLevel, Func<string> messageFunc, Exception exception, params object[] formatParameters)
{
var severity = MapSeverity(logLevel);
if (messageFunc == null)
{
return _shouldLog(_loggerName, severity);
}
messageFunc = LogMessageFormatter.SimulateStructuredLogging(messageFunc, formatParameters);
if (exception != null)
{
return LogException(logLevel, messageFunc, exception);
}
_writeLog(_loggerName, messageFunc(), severity);
return true;
}
public bool LogException(LogLevel logLevel, Func<string> messageFunc, Exception exception)
{
var severity = MapSeverity(logLevel);
var message = messageFunc() + Environment.NewLine + exception;
_writeLog(_loggerName, message, severity);
return true;
}
private static int MapSeverity(LogLevel logLevel)
{
switch (logLevel)
{
case LogLevel.Fatal:
return TraceEventTypeValues.Critical;
case LogLevel.Error:
return TraceEventTypeValues.Error;
case LogLevel.Warn:
return TraceEventTypeValues.Warning;
case LogLevel.Info:
return TraceEventTypeValues.Information;
default:
return TraceEventTypeValues.Verbose;
}
}
}
}
internal class SerilogLogProvider : LogProviderBase
{
private readonly Func<string, object> _getLoggerByNameDelegate;
private static bool s_providerIsAvailableOverride = true;
[SuppressMessage("Microsoft.Naming", "CA2204:Literals should be spelled correctly", MessageId = "Serilog")]
public SerilogLogProvider()
{
if (!IsLoggerAvailable())
{
throw new InvalidOperationException("Serilog.Log not found");
}
_getLoggerByNameDelegate = GetForContextMethodCall();
}
public static bool ProviderIsAvailableOverride
{
get { return s_providerIsAvailableOverride; }
set { s_providerIsAvailableOverride = value; }
}
public override Logger GetLogger(string name)
{
return new SerilogLogger(_getLoggerByNameDelegate(name)).Log;
}
internal static bool IsLoggerAvailable()
{
return ProviderIsAvailableOverride && GetLogManagerType() != null;
}
protected override OpenNdc GetOpenNdcMethod()
{
return message => GetPushProperty()("NDC", message);
}
protected override OpenMdc GetOpenMdcMethod()
{
return (key, value) => GetPushProperty()(key, value);
}
private static Func<string, string, IDisposable> GetPushProperty()
{
Type ndcContextType = Type.GetType("Serilog.Context.LogContext, Serilog.FullNetFx");
MethodInfo pushPropertyMethod = ndcContextType.GetMethodPortable(
"PushProperty",
typeof(string),
typeof(object),
typeof(bool));
ParameterExpression nameParam = Expression.Parameter(typeof(string), "name");
ParameterExpression valueParam = Expression.Parameter(typeof(object), "value");
ParameterExpression destructureObjectParam = Expression.Parameter(typeof(bool), "destructureObjects");
MethodCallExpression pushPropertyMethodCall = Expression
.Call(null, pushPropertyMethod, nameParam, valueParam, destructureObjectParam);
var pushProperty = Expression
.Lambda<Func<string, object, bool, IDisposable>>(
pushPropertyMethodCall,
nameParam,
valueParam,
destructureObjectParam)
.Compile();
return (key, value) => pushProperty(key, value, false);
}
private static Type GetLogManagerType()
{
return Type.GetType("Serilog.Log, Serilog");
}
private static Func<string, object> GetForContextMethodCall()
{
Type logManagerType = GetLogManagerType();
MethodInfo method = logManagerType.GetMethodPortable("ForContext", typeof(string), typeof(object), typeof(bool));
ParameterExpression propertyNameParam = Expression.Parameter(typeof(string), "propertyName");
ParameterExpression valueParam = Expression.Parameter(typeof(object), "value");
ParameterExpression destructureObjectsParam = Expression.Parameter(typeof(bool), "destructureObjects");
MethodCallExpression methodCall = Expression.Call(null, method, new Expression[]
{
propertyNameParam,
valueParam,
destructureObjectsParam
});
var func = Expression.Lambda<Func<string, object, bool, object>>(
methodCall,
propertyNameParam,
valueParam,
destructureObjectsParam)
.Compile();
return name => func("SourceContext", name, false);
}
internal class SerilogLogger
{
private readonly object _logger;
private static readonly object DebugLevel;
private static readonly object ErrorLevel;
private static readonly object FatalLevel;
private static readonly object InformationLevel;
private static readonly object VerboseLevel;
private static readonly object WarningLevel;
private static readonly Func<object, object, bool> IsEnabled;
private static readonly Action<object, object, string, object[]> Write;
private static readonly Action<object, object, Exception, string, object[]> WriteException;
[SuppressMessage("Microsoft.Design", "CA1065:DoNotRaiseExceptionsInUnexpectedLocations")]
[SuppressMessage("Microsoft.Performance", "CA1810:InitializeReferenceTypeStaticFieldsInline")]
[SuppressMessage("Microsoft.Naming", "CA2204:Literals should be spelled correctly", MessageId = "ILogger")]
[SuppressMessage("Microsoft.Naming", "CA2204:Literals should be spelled correctly", MessageId = "LogEventLevel")]
[SuppressMessage("Microsoft.Naming", "CA2204:Literals should be spelled correctly", MessageId = "Serilog")]
static SerilogLogger()
{
var logEventLevelType = Type.GetType("Serilog.Events.LogEventLevel, Serilog");
if (logEventLevelType == null)
{
throw new InvalidOperationException("Type Serilog.Events.LogEventLevel was not found.");
}
DebugLevel = Enum.Parse(logEventLevelType, "Debug", false);
ErrorLevel = Enum.Parse(logEventLevelType, "Error", false);
FatalLevel = Enum.Parse(logEventLevelType, "Fatal", false);
InformationLevel = Enum.Parse(logEventLevelType, "Information", false);
VerboseLevel = Enum.Parse(logEventLevelType, "Verbose", false);
WarningLevel = Enum.Parse(logEventLevelType, "Warning", false);
// Func<object, object, bool> isEnabled = (logger, level) => { return ((SeriLog.ILogger)logger).IsEnabled(level); }
var loggerType = Type.GetType("Serilog.ILogger, Serilog");
if (loggerType == null)
{
throw new InvalidOperationException("Type Serilog.ILogger was not found.");
}
MethodInfo isEnabledMethodInfo = loggerType.GetMethodPortable("IsEnabled", logEventLevelType);
ParameterExpression instanceParam = Expression.Parameter(typeof(object));
UnaryExpression instanceCast = Expression.Convert(instanceParam, loggerType);
ParameterExpression levelParam = Expression.Parameter(typeof(object));
UnaryExpression levelCast = Expression.Convert(levelParam, logEventLevelType);
MethodCallExpression isEnabledMethodCall = Expression.Call(instanceCast, isEnabledMethodInfo, levelCast);
IsEnabled = Expression.Lambda<Func<object, object, bool>>(isEnabledMethodCall, instanceParam, levelParam).Compile();
// Action<object, object, string> Write =
// (logger, level, message, params) => { ((SeriLog.ILoggerILogger)logger).Write(level, message, params); }
MethodInfo writeMethodInfo = loggerType.GetMethodPortable("Write", logEventLevelType, typeof(string), typeof(object[]));
ParameterExpression messageParam = Expression.Parameter(typeof(string));
ParameterExpression propertyValuesParam = Expression.Parameter(typeof(object[]));
MethodCallExpression writeMethodExp = Expression.Call(
instanceCast,
writeMethodInfo,
levelCast,
messageParam,
propertyValuesParam);
var expression = Expression.Lambda<Action<object, object, string, object[]>>(
writeMethodExp,
instanceParam,
levelParam,
messageParam,
propertyValuesParam);
Write = expression.Compile();
// Action<object, object, string, Exception> WriteException =
// (logger, level, exception, message) => { ((ILogger)logger).Write(level, exception, message, new object[]); }
MethodInfo writeExceptionMethodInfo = loggerType.GetMethodPortable("Write",
logEventLevelType,
typeof(Exception),
typeof(string),
typeof(object[]));
ParameterExpression exceptionParam = Expression.Parameter(typeof(Exception));
writeMethodExp = Expression.Call(
instanceCast,
writeExceptionMethodInfo,
levelCast,
exceptionParam,
messageParam,
propertyValuesParam);
WriteException = Expression.Lambda<Action<object, object, Exception, string, object[]>>(
writeMethodExp,
instanceParam,
levelParam,
exceptionParam,
messageParam,
propertyValuesParam).Compile();
}
internal SerilogLogger(object logger)
{
_logger = logger;
}
public bool Log(LogLevel logLevel, Func<string> messageFunc, Exception exception, params object[] formatParameters)
{
var translatedLevel = TranslateLevel(logLevel);
if (messageFunc == null)
{
return IsEnabled(_logger, translatedLevel);
}
if (!IsEnabled(_logger, translatedLevel))
{
return false;
}
if (exception != null)
{
LogException(translatedLevel, messageFunc, exception, formatParameters);
}
else
{
LogMessage(translatedLevel, messageFunc, formatParameters);
}
return true;
}
private void LogMessage(object translatedLevel, Func<string> messageFunc, object[] formatParameters)
{
Write(_logger, translatedLevel, messageFunc(), formatParameters);
}
private void LogException(object logLevel, Func<string> messageFunc, Exception exception, object[] formatParams)
{
WriteException(_logger, logLevel, exception, messageFunc(), formatParams);
}
private static object TranslateLevel(LogLevel logLevel)
{
switch (logLevel)
{
case LogLevel.Fatal:
return FatalLevel;
case LogLevel.Error:
return ErrorLevel;
case LogLevel.Warn:
return WarningLevel;
case LogLevel.Info:
return InformationLevel;
case LogLevel.Trace:
return VerboseLevel;
default:
return DebugLevel;
}
}
}
}
internal class LoupeLogProvider : LogProviderBase
{
/// <summary>
/// The form of the Loupe Log.Write method we're using
/// </summary>
internal delegate void WriteDelegate(
int severity,
string logSystem,
int skipFrames,
Exception exception,
bool attributeToException,
int writeMode,
string detailsXml,
string category,
string caption,
string description,
params object[] args
);
private static bool s_providerIsAvailableOverride = true;
private readonly WriteDelegate _logWriteDelegate;
public LoupeLogProvider()
{
if (!IsLoggerAvailable())
{
throw new InvalidOperationException("Gibraltar.Agent.Log (Loupe) not found");
}
_logWriteDelegate = GetLogWriteDelegate();
}
/// <summary>
/// Gets or sets a value indicating whether [provider is available override]. Used in tests.
/// </summary>
/// <value>
/// <c>true</c> if [provider is available override]; otherwise, <c>false</c>.
/// </value>
public static bool ProviderIsAvailableOverride
{
get { return s_providerIsAvailableOverride; }
set { s_providerIsAvailableOverride = value; }
}
public override Logger GetLogger(string name)
{
return new LoupeLogger(name, _logWriteDelegate).Log;
}
public static bool IsLoggerAvailable()
{
return ProviderIsAvailableOverride && GetLogManagerType() != null;
}
private static Type GetLogManagerType()
{
return Type.GetType("Gibraltar.Agent.Log, Gibraltar.Agent");
}
private static WriteDelegate GetLogWriteDelegate()
{
Type logManagerType = GetLogManagerType();
Type logMessageSeverityType = Type.GetType("Gibraltar.Agent.LogMessageSeverity, Gibraltar.Agent");
Type logWriteModeType = Type.GetType("Gibraltar.Agent.LogWriteMode, Gibraltar.Agent");
MethodInfo method = logManagerType.GetMethodPortable(
"Write",
logMessageSeverityType, typeof(string), typeof(int), typeof(Exception), typeof(bool),
logWriteModeType, typeof(string), typeof(string), typeof(string), typeof(string), typeof(object[]));
var callDelegate = (WriteDelegate)method.CreateDelegate(typeof(WriteDelegate));
return callDelegate;
}
internal class LoupeLogger
{
private const string LogSystem = "LibLog";
private readonly string _category;
private readonly WriteDelegate _logWriteDelegate;
private readonly int _skipLevel;
internal LoupeLogger(string category, WriteDelegate logWriteDelegate)
{
_category = category;
_logWriteDelegate = logWriteDelegate;
#if DEBUG
_skipLevel = 2;
#else
_skipLevel = 1;
#endif
}
public bool Log(LogLevel logLevel, Func<string> messageFunc, Exception exception, params object[] formatParameters)
{
if (messageFunc == null)
{
//nothing to log..
return true;
}
messageFunc = LogMessageFormatter.SimulateStructuredLogging(messageFunc, formatParameters);
_logWriteDelegate(ToLogMessageSeverity(logLevel), LogSystem, _skipLevel, exception, true, 0, null,
_category, null, messageFunc.Invoke());
return true;
}
private static int ToLogMessageSeverity(LogLevel logLevel)
{
switch (logLevel)
{
case LogLevel.Trace:
return TraceEventTypeValues.Verbose;
case LogLevel.Debug:
return TraceEventTypeValues.Verbose;
case LogLevel.Info:
return TraceEventTypeValues.Information;
case LogLevel.Warn:
return TraceEventTypeValues.Warning;
case LogLevel.Error:
return TraceEventTypeValues.Error;
case LogLevel.Fatal:
return TraceEventTypeValues.Critical;
default:
throw new ArgumentOutOfRangeException("logLevel");
}
}
}
}
internal static class TraceEventTypeValues
{
internal static readonly Type Type;
internal static readonly int Verbose;
internal static readonly int Information;
internal static readonly int Warning;
internal static readonly int Error;
internal static readonly int Critical;
[SuppressMessage("Microsoft.Performance", "CA1810:InitializeReferenceTypeStaticFieldsInline")]
static TraceEventTypeValues()
{
var assembly = typeof(Uri).GetAssemblyPortable(); // This is to get to the System.dll assembly in a PCL compatible way.
if (assembly == null)
{
return;
}
Type = assembly.GetType("System.Diagnostics.TraceEventType");
if (Type == null) return;
Verbose = (int)Enum.Parse(Type, "Verbose", false);
Information = (int)Enum.Parse(Type, "Information", false);
Warning = (int)Enum.Parse(Type, "Warning", false);
Error = (int)Enum.Parse(Type, "Error", false);
Critical = (int)Enum.Parse(Type, "Critical", false);
}
}
internal static class LogMessageFormatter
{
private static readonly Regex Pattern = new Regex(@"\{@?\w{1,}\}");
/// <summary>
/// Some logging frameworks support structured logging, such as serilog. This will allow you to add names to structured data in a format string:
/// For example: Log("Log message to {user}", user). This only works with serilog, but as the user of LibLog, you don't know if serilog is actually
/// used. So, this class simulates that. it will replace any text in {curly braces} with an index number.
///
/// "Log {message} to {user}" would turn into => "Log {0} to {1}". Then the format parameters are handled using regular .net string.Format.
/// </summary>
/// <param name="messageBuilder">The message builder.</param>
/// <param name="formatParameters">The format parameters.</param>
/// <returns></returns>
public static Func<string> SimulateStructuredLogging(Func<string> messageBuilder, object[] formatParameters)
{
if (formatParameters == null || formatParameters.Length == 0)
{
return messageBuilder;
}
return () =>
{
string targetMessage = messageBuilder();
int argumentIndex = 0;
foreach (Match match in Pattern.Matches(targetMessage))
{
int notUsed;
if (!int.TryParse(match.Value.Substring(1, match.Value.Length - 2), out notUsed))
{
targetMessage = ReplaceFirst(targetMessage, match.Value,
"{" + argumentIndex++ + "}");
}
}
try
{
return string.Format(CultureInfo.InvariantCulture, targetMessage, formatParameters);
}
catch (FormatException ex)
{
throw new FormatException("The input string '" + targetMessage + "' could not be formatted using string.Format", ex);
}
};
}
private static string ReplaceFirst(string text, string search, string replace)
{
int pos = text.IndexOf(search, StringComparison.Ordinal);
if (pos < 0)
{
return text;
}
return text.Substring(0, pos) + replace + text.Substring(pos + search.Length);
}
}
internal static class TypeExtensions
{
internal static MethodInfo GetMethodPortable(this Type type, string name)
{
#if LIBLOG_PORTABLE
return type.GetRuntimeMethods().SingleOrDefault(m => m.Name == name);
#else
return type.GetMethod(name);
#endif
}
internal static MethodInfo GetMethodPortable(this Type type, string name, params Type[] types)
{
#if LIBLOG_PORTABLE
return type.GetRuntimeMethod(name, types);
#else
return type.GetMethod(name, types);
#endif
}
internal static PropertyInfo GetPropertyPortable(this Type type, string name)
{
#if LIBLOG_PORTABLE
return type.GetRuntimeProperty(name);
#else
return type.GetProperty(name);
#endif
}
internal static IEnumerable<FieldInfo> GetFieldsPortable(this Type type)
{
#if LIBLOG_PORTABLE
return type.GetRuntimeFields();
#else
return type.GetFields();
#endif
}
internal static Type GetBaseTypePortable(this Type type)
{
#if LIBLOG_PORTABLE
return type.GetTypeInfo().BaseType;
#else
return type.BaseType;
#endif
}
#if LIBLOG_PORTABLE
internal static MethodInfo GetGetMethod(this PropertyInfo propertyInfo)
{
return propertyInfo.GetMethod;
}
internal static MethodInfo GetSetMethod(this PropertyInfo propertyInfo)
{
return propertyInfo.SetMethod;
}
#endif
#if !LIBLOG_PORTABLE
internal static object CreateDelegate(this MethodInfo methodInfo, Type delegateType)
{
return Delegate.CreateDelegate(delegateType, methodInfo);
}
#endif
internal static Assembly GetAssemblyPortable(this Type type)
{
#if LIBLOG_PORTABLE
return type.GetTypeInfo().Assembly;
#else
return type.Assembly;
#endif
}
}
internal class DisposableAction : IDisposable
{
private readonly Action _onDispose;
public DisposableAction(Action onDispose = null)
{
_onDispose = onDispose;
}
public void Dispose()
{
if (_onDispose != null)
{
_onDispose();
}
}
}
}
| {
"content_hash": "14e147bd6946449ae1774cc9c4c980b5",
"timestamp": "",
"source": "github",
"line_count": 1959,
"max_line_length": 257,
"avg_line_length": 38.22256253190403,
"alnum_prop": 0.5694462993135501,
"repo_name": "lvermeulen/LimitsMiddleware.aspnetcore",
"id": "611eaf8e56b18e601a0bb7261a8d212f7384605c",
"size": "77055",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/LimitsMiddleware.AspNetCore/App_Packages/LibLog.4.2/LibLog.cs",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C#",
"bytes": "195519"
},
{
"name": "PowerShell",
"bytes": "3545"
}
],
"symlink_target": ""
} |
REG_FIDDLE(Path_getConvexityOrUnknown, 256, 256, true, 0) {
void draw(SkCanvas* canvas) {
auto debugster = [](const char* prefix, const SkPath& path) -> void {
SkDebugf("%s path convexity is %s\n", prefix,
SkPath::kUnknown_Convexity == path.getConvexityOrUnknown() ? "unknown" :
SkPath::kConvex_Convexity == path.getConvexityOrUnknown() ? "convex" : "concave"); };
SkPath path;
debugster("initial", path);
path.lineTo(50, 0);
debugster("first line", path);
path.getConvexity();
path.lineTo(50, 50);
debugster("second line", path);
path.lineTo(100, 50);
path.getConvexity();
debugster("third line", path);
}
} // END FIDDLE
| {
"content_hash": "796500bea31a4905aaab3ba316c6df0c",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 97,
"avg_line_length": 38.888888888888886,
"alnum_prop": 0.63,
"repo_name": "youtube/cobalt_sandbox",
"id": "b03c8b4b1b62f66b46af509a58b6962d4e17de9c",
"size": "907",
"binary": false,
"copies": "2",
"ref": "refs/heads/main",
"path": "third_party/skia/docs/examples/Path_getConvexityOrUnknown.cpp",
"mode": "33188",
"license": "bsd-3-clause",
"language": [],
"symlink_target": ""
} |
"""Pyhole Entertainment Plugin"""
import re
from BeautifulSoup import BeautifulSoup
from pyhole import plugin
from pyhole import utils
class Entertainment(plugin.Plugin):
"""Provide access to entertaining sites"""
@plugin.hook_add_command("grouphug")
@utils.spawn
def grouphug(self, params=None, **kwargs):
"""Display a random Group Hug (ex: .grouphug)"""
url = "http://grouphug.us/random"
response = self.irc.fetch_url(url, self.name)
if not response:
return
soup = BeautifulSoup(response.read())
grouphug = utils.decode_entities(
soup.findAll(id=re.compile("node-\d+"))[2].p.contents[0])
self.irc.reply(grouphug)
@plugin.hook_add_command("lastnight")
@utils.spawn
def lastnight(self, params=None, **kwargs):
"""Display a random Text From Last Night (ex: .lastnight)"""
url = ("http://www.textsfromlastnight.com/"
"Random-Texts-From-Last-Night.html")
response = self.irc.fetch_url(url, self.name)
if not response:
return
soup = BeautifulSoup(response.read())
lastnight = utils.decode_entities(
soup.findAll(href=re.compile(
"/Text-Replies-\d+.html"))[0].contents[0])
self.irc.reply(lastnight)
| {
"content_hash": "3c882d9944d9c75f63b8bca840900787",
"timestamp": "",
"source": "github",
"line_count": 42,
"max_line_length": 73,
"avg_line_length": 31.88095238095238,
"alnum_prop": 0.6109036594473488,
"repo_name": "rconradharris/pyhole",
"id": "14e6abcfae3fdd8cd6b185a3624dc6661aa7bfe5",
"size": "1941",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "plugins/entertainment.py",
"mode": "33188",
"license": "apache-2.0",
"language": [],
"symlink_target": ""
} |
from django.core.management import execute_manager
try:
import settings # Assumed to be in the same directory.
except ImportError:
import sys
sys.stderr.write("Error: Can't find the file 'settings.py' in the directory containing %r. It appears you've customized things.\nYou'll have to run django-admin.py, passing it your settings module.\n(If the file settings.py does indeed exist, it's causing an ImportError somehow.)\n" % __file__)
sys.exit(1)
if __name__ == "__main__":
execute_manager(settings)
| {
"content_hash": "c9e72d872cf6642b2b4eace9ddbd9bd8",
"timestamp": "",
"source": "github",
"line_count": 10,
"max_line_length": 299,
"avg_line_length": 52.4,
"alnum_prop": 0.7251908396946565,
"repo_name": "cernops/CloudMan",
"id": "d47073cec3bb406edd140047e4501eb267202b52",
"size": "524",
"binary": false,
"copies": "4",
"ref": "refs/heads/master",
"path": "cloudman/cloudman/manage.py",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "31999"
},
{
"name": "JavaScript",
"bytes": "101757"
},
{
"name": "Python",
"bytes": "591308"
},
{
"name": "Shell",
"bytes": "423"
},
{
"name": "TeX",
"bytes": "95737"
}
],
"symlink_target": ""
} |
SYNONYM
#### According to
The Catalogue of Life, 3rd January 2011
#### Published in
null
#### Original name
null
### Remarks
null | {
"content_hash": "f9b1c36606da2417170f365bf723bb0a",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 39,
"avg_line_length": 10.23076923076923,
"alnum_prop": 0.6917293233082706,
"repo_name": "mdoering/backbone",
"id": "b6e7b3f5af628c1a49bcb5a7e92201ba6f2fff71",
"size": "207",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "life/Plantae/Rhodophyta/Florideophyceae/Corallinales/Corallinaceae/Lithophyllum/Lithophyllum orbiculatum/ Syn. Pseudolithophyllum orbiculatum/README.md",
"mode": "33188",
"license": "apache-2.0",
"language": [],
"symlink_target": ""
} |
# frozen_string_literal: true
# This file is copied to spec/ when you run 'rails generate rspec:install'
ENV['RAILS_ENV'] ||= 'test'
require File.expand_path('../../config/environment', __FILE__)
# Prevent database truncation if the environment is production
abort('The Rails environment is running in production mode!') if Rails.env.production?
require 'spec_helper'
require 'rspec/rails'
# Add additional requires below this line. Rails is not loaded until this point!
# Requires supporting ruby files with custom matchers and macros, etc, in
# spec/support/ and its subdirectories. Files matching `spec/**/*_spec.rb` are
# run as spec files by default. This means that files in spec/support that end
# in _spec.rb will both be required and run as specs, causing the specs to be
# run twice. It is recommended that you do not name files matching this glob to
# end with _spec.rb. You can configure this pattern with the --pattern
# option on the command line or in ~/.rspec, .rspec or `.rspec-local`.
#
# The following line is provided for convenience purposes. It has the downside
# of increasing the boot-up time by auto-requiring all files in the support
# directory. Alternatively, in the individual `*_spec.rb` files, manually
# require only the support files necessary.
#
# Dir[Rails.root.join('spec/support/**/*.rb')].each { |f| require f }
# Checks for pending migration and applies them before tests are run.
# If you are not using ActiveRecord, you can remove this line.
ActiveRecord::Migration.maintain_test_schema!
RSpec.configure do |config|
# Remove this line if you're not using ActiveRecord or ActiveRecord fixtures
config.fixture_path = "#{::Rails.root}/spec/fixtures"
# If you're not using ActiveRecord, or you'd prefer not to run each of your
# examples within a transaction, remove the following line or assign false
# instead of true.
config.use_transactional_fixtures = true
# RSpec Rails can automatically mix in different behaviours to your tests
# based on their file location, for example enabling you to call `get` and
# `post` in specs under `spec/controllers`.
#
# You can disable this behaviour by removing the line below, and instead
# explicitly tag your specs with their type, e.g.:
#
# RSpec.describe UsersController, :type => :controller do
# # ...
# end
#
# The different available types are documented in the features, such as in
# https://relishapp.com/rspec/rspec-rails/docs
config.infer_spec_type_from_file_location!
# Filter lines from Rails gems in backtraces.
config.filter_rails_from_backtrace!
# arbitrary gems may also be filtered via:
# config.filter_gems_from_backtrace("gem name")
end
Shoulda::Matchers.configure do |config|
config.integrate do |with|
with.test_framework :rspec
with.library :rails
end
end
| {
"content_hash": "bd920884fca75f0a7d14338fdca57797",
"timestamp": "",
"source": "github",
"line_count": 65,
"max_line_length": 86,
"avg_line_length": 43.676923076923075,
"alnum_prop": 0.7396970764353645,
"repo_name": "berlin-international-community-church/church-database",
"id": "eb41eb45c47c0c280786aafcffe333e5a324d68e",
"size": "2839",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "spec/rails_helper.rb",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "124735"
},
{
"name": "CoffeeScript",
"bytes": "56"
},
{
"name": "Dockerfile",
"bytes": "204"
},
{
"name": "HTML",
"bytes": "32343"
},
{
"name": "JavaScript",
"bytes": "1201"
},
{
"name": "Ruby",
"bytes": "158684"
},
{
"name": "Shell",
"bytes": "185"
}
],
"symlink_target": ""
} |
<?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.
-->
<inset xmlns:android="http://schemas.android.com/apk/res/android"
android:insetLeft="16dp"
android:insetTop="16dp"
android:insetRight="16dp"
android:insetBottom="16dp">
<shape android:shape="rectangle">
<corners android:radius="2dp" />
<solid android:color="@color/background_floating_material_light" />
</shape>
</inset><!-- From: file:/usr/local/google/buildbot/repo_clients/https___googleplex-android.googlesource.com_a_platform_manifest.git/mnc-release/frameworks/support/v7/appcompat/res/drawable/abc_dialog_material_background_light.xml --><!-- From: file:/Users/lmponceb/Desktop/StudioProjects/sipApp_project1/app/build/intermediates/exploded-aar/com.android.support/appcompat-v7/23.0.0/res/drawable/abc_dialog_material_background_light.xml --> | {
"content_hash": "8b091d1e8171d1ef64214ba3169ed96c",
"timestamp": "",
"source": "github",
"line_count": 26,
"max_line_length": 438,
"avg_line_length": 56.69230769230769,
"alnum_prop": 0.728629579375848,
"repo_name": "manucv/Violations",
"id": "f549385433bd35089ff397a861df88802dee2066",
"size": "1474",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "StudioProjects/sipApp_project1/app/build/intermediates/res/merged/debug/drawable/abc_dialog_material_background_light.xml",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "ApacheConf",
"bytes": "711"
},
{
"name": "CSS",
"bytes": "227399"
},
{
"name": "HTML",
"bytes": "328726"
},
{
"name": "Java",
"bytes": "3724453"
},
{
"name": "JavaScript",
"bytes": "2578931"
},
{
"name": "PHP",
"bytes": "1338129"
},
{
"name": "Shell",
"bytes": "1383"
}
],
"symlink_target": ""
} |
SPK_NAME = transmission
SPK_VERS = 2.92
SPK_REV = 12
SPK_ICON = src/transmission.png
DSM_UI_DIR = app
DEPENDS = cross/busybox cross/$(SPK_NAME)
MAINTAINER = Diaoul
DESCRIPTION = Transmission is an easy and fast BitTorrent client. You can control it remotely with its web interface or dedicated applications.
DESCRIPTION_FRE = Transmission est un client BitTorrent simple et rapide. Vous pouvez le contrôler à distance grâce à son interface web ou des applications dédiées.
DESCRIPTION_SPN = Transmission es un cliente BitTorrent simple y rápido. Puedes controlarlo remotamente mediante su interfaz web o alguna aplicación dedicada.
ADMIN_PORT = 9091
RELOAD_UI = yes
DISPLAY_NAME = Transmission
CHANGELOG = "1. Update Transmission to 2.92<br>2. Enable sc-download group"
HOMEPAGE = http://www.transmissionbt.com
LICENSE = GPLv2/GPLv3
WIZARDS_DIR = src/wizard/
INSTALLER_SCRIPT = src/installer.sh
SSS_SCRIPT = src/dsm-control.sh
FWPORTS = src/${SPK_NAME}.sc
INSTALL_PREFIX = /usr/local/$(SPK_NAME)
POST_STRIP_TARGET = transmission_extra_install
BUSYBOX_CONFIG = usrmng
ENV += BUSYBOX_CONFIG="$(BUSYBOX_CONFIG)"
include ../../mk/spksrc.spk.mk
.PHONY: transmission_extra_install
transmission_extra_install:
install -m 755 -d $(STAGING_DIR)/var
install -m 644 src/settings.json $(STAGING_DIR)/var/settings.json
install -m 755 -d $(STAGING_DIR)/app
install -m 644 src/app/config $(STAGING_DIR)/app/config
install -m 755 -d $(STAGING_DIR)/app/images
for size in 16 24 32 48 72 ; \
do \
convert $(SPK_ICON) -thumbnail $${size}x$${size} \
$(STAGING_DIR)/app/images/$(SPK_NAME)-$${size}.png ; \
done
| {
"content_hash": "6953c32f5b8ea52e6df82e6bc9ce2983",
"timestamp": "",
"source": "github",
"line_count": 47,
"max_line_length": 164,
"avg_line_length": 34.93617021276596,
"alnum_prop": 0.7338611449451888,
"repo_name": "lysin/spksrc",
"id": "a3e40410c5b89acf0c663be67f9e058c62593a5d",
"size": "1650",
"binary": false,
"copies": "9",
"ref": "refs/heads/master",
"path": "spk/transmission/Makefile",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "C",
"bytes": "10061"
},
{
"name": "C++",
"bytes": "109341"
},
{
"name": "CSS",
"bytes": "10521"
},
{
"name": "Erlang",
"bytes": "1685"
},
{
"name": "HTML",
"bytes": "26828"
},
{
"name": "JavaScript",
"bytes": "207184"
},
{
"name": "Makefile",
"bytes": "450385"
},
{
"name": "NewLisp",
"bytes": "1378"
},
{
"name": "PHP",
"bytes": "777"
},
{
"name": "Perl",
"bytes": "12710"
},
{
"name": "Python",
"bytes": "88573"
},
{
"name": "Ruby",
"bytes": "2756"
},
{
"name": "Shell",
"bytes": "342986"
},
{
"name": "Smarty",
"bytes": "562"
},
{
"name": "SuperCollider",
"bytes": "4485"
},
{
"name": "VimL",
"bytes": "36"
}
],
"symlink_target": ""
} |
""" Transform Python code by omitting strings, comments, and/or code.
"""
from cStringIO import StringIO
import os
import shlex
import string
import sys
import tokenize
import grin
__version__ = '1.2'
class Transformer(object):
""" Transform Python files to remove certain features.
"""
def __init__(self, python_code, comments, strings):
# Keep code.
self.python_code = python_code
# Keep comments.
self.comments = comments
# Keep strings.
self.strings = strings
table = [' '] * 256
for s in string.whitespace:
table[ord(s)] = s
# A table for the translate() function that replaces all non-whitespace
# characters with spaces.
self.space_table = ''.join(table)
def keep_token(self, kind):
""" Return True if we should keep the token in the output.
"""
if kind in (tokenize.NL, tokenize.NEWLINE):
return True
elif kind == tokenize.COMMENT:
return self.comments
elif kind == tokenize.STRING:
return self.strings
else:
return self.python_code
def replace_with_spaces(self, s):
""" Replace all non-newline characters in a string with spaces.
"""
return s.translate(self.space_table)
def __call__(self, filename, mode='rb'):
""" Open a file and convert it to a filelike object with transformed
contents.
"""
g = StringIO()
f = open(filename, mode)
try:
gen = tokenize.generate_tokens(f.readline)
old_end = (1, 0)
for kind, token, start, end, line in gen:
if old_end[0] == start[0]:
dx = start[1] - old_end[1]
else:
dx = start[1]
# Put in any omitted whitespace.
g.write(' ' * dx)
old_end = end
if not self.keep_token(kind):
token = self.replace_with_spaces(token)
g.write(token)
finally:
f.close()
# Seek back to the beginning of the file.
g.seek(0, 0)
return g
def get_grinpython_arg_parser(parser=None):
""" Create the command-line parser.
"""
parser = grin.get_grin_arg_parser(parser)
parser.set_defaults(include='*.py')
parser.description = ("Search Python code with strings, comments, and/or "
"code removed.")
for action in parser._actions:
if hasattr(action, 'version'):
action.version = 'grinpython %s' % __version__
group = parser.add_argument_group('Code Transformation')
group.add_argument('-p', '--python-code', action='store_true',
help="Keep non-string, non-comment Python code.")
group.add_argument('-c', '--comments', action='store_true',
help="Keep Python comments.")
group.add_argument('-t', '--strings', action='store_true',
help="Keep Python strings, especially docstrings.")
return parser
def grinpython_main(argv=None):
if argv is None:
# Look at the GRIN_ARGS environment variable for more arguments.
env_args = shlex.split(os.getenv('GRIN_ARGS', ''))
argv = [sys.argv[0]] + env_args + sys.argv[1:]
parser = get_grinpython_arg_parser()
args = parser.parse_args(argv[1:])
if args.context is not None:
args.before_context = args.context
args.after_context = args.context
args.use_color = args.force_color or (not args.no_color and
sys.stdout.isatty() and
(os.environ.get('TERM') != 'dumb'))
xform = Transformer(args.python_code, args.comments, args.strings)
regex = grin.get_regex(args)
g = grin.GrepText(regex, args)
for filename, kind in grin.get_filenames(args):
if kind == 'text':
# Ignore gzipped files.
report = g.grep_a_file(filename, opener=xform)
sys.stdout.write(report)
if __name__ == '__main__':
grinpython_main()
| {
"content_hash": "9aec32b7e186d56fe0322124d981c4f8",
"timestamp": "",
"source": "github",
"line_count": 124,
"max_line_length": 79,
"avg_line_length": 32.58064516129032,
"alnum_prop": 0.5782178217821782,
"repo_name": "lecheel/grin",
"id": "31e23ee4e3e5fc6e4ae2bbfcb06754a8d84c48e9",
"size": "4086",
"binary": false,
"copies": "4",
"ref": "refs/heads/master",
"path": "examples/grinpython.py",
"mode": "33261",
"license": "bsd-3-clause",
"language": [
{
"name": "Python",
"bytes": "65582"
}
],
"symlink_target": ""
} |
package ua.nure.service;
public interface SecurityService {
String findLoggedInUsername();
void autologin(String username, String password);
}
| {
"content_hash": "398fa3ac754313feee33be20d407b198",
"timestamp": "",
"source": "github",
"line_count": 7,
"max_line_length": 53,
"avg_line_length": 21.857142857142858,
"alnum_prop": 0.7647058823529411,
"repo_name": "GrinUA/course",
"id": "f0850c626fb450dc7ac43fd8f99c941891e19a77",
"size": "153",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/main/java/ua/nure/service/SecurityService.java",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "763"
},
{
"name": "Java",
"bytes": "85927"
}
],
"symlink_target": ""
} |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Amburana factsheet on ARKive - Amburana cearensis</title>
<link rel="canonical" href="http://www.arkive.org/amburana/amburana-cearensis/" />
<link rel="stylesheet" type="text/css" media="screen,print" href="/rcss/factsheet.css" />
<link rel="icon" href="/favicon.ico" type="image/x-icon" />
<link rel="shortcut icon" href="/favicon.ico" type="image/x-icon" />
</head>
<body> <!-- onload="window.print()">-->
<div id="container">
<div id="header"><a href="/"><img src="/rimg/factsheet/header_left.png" alt="" border="0" /><img src="/rimg/factsheet/header_logo.png" alt="" border="0" /><img src="/rimg/factsheet/header_right.png" alt="" border="0" /></a></div>
<div id="content">
<h1>Amburana (<i>Amburana cearensis</i>)</h1>
<img alt="" src="/media/47/473CBEB4-44CE-46C2-8288-004D51F4C662/Presentation.Large/Amburana-cearensis-in-cultivation.jpg"/>
<table cellspacing="0" cellpadding="0" class="alternativeSpeciesNames"><tbody>
<tr><th align="left" valign="top">Spanish:</th><td>
Umburana Do Cheiro
</td></tr>
</tbody></table>
<table cellspacing="0" cellpadding="0" id="factList">
<tbody>
<tr class="kingdom"><th align="left">Kingdom</th><td align="left">Plantae</td></tr>
<tr class="phylum"><th align="left">Phylum</th><td align="left">Tracheophyta</td></tr>
<tr class="class"><th align="left">Class</th><td align="left">Magnoliopsida</td></tr>
<tr class="order"><th align="left">Order</th><td align="left">Fabales</td></tr>
<tr class="family"><th align="left">Family</th><td align="left">Leguminosae</td></tr>
<tr class="genus"><th align="left">Genus</th><td align="left"><em>Amburana (1)</em></td></tr>
</tbody>
</table>
<h2><img src="/rimg/factsheet/Status.png" class="heading" /></h2><p class="Status"><p>Classified as Endangered (EN) on the IUCN Red List (1).</p></p><h2><img src="/rimg/factsheet/Description.png" class="heading" /></h2><p class="Description"><p>Information on <em>Amburana cearensis</em> is currently being researched and written and will appear here shortly.</p></p><h2><img src="/rimg/factsheet/Authentication.png" class="heading" /></h2><p class="AuthenticatioModel"><p>This information is awaiting authentication by a species expert, and will be updated as soon as possible. If you are able to help please contact: <br/><a href="mailto:[email protected]">[email protected]</a></p></p><h2><img src="/rimg/factsheet/References.png" class="heading" /></h2>
<ol id="references">
<li id="ref1">
<a id="reference_1" name="reference_1"></a>
IUCN Red List (August, 2010) <br/><a href="http://www.iucnredlist.org" target="_blank">http://www.iucnredlist.org</a></li>
</ol>
</div>
</div>
</body>
</html>
| {
"content_hash": "ddaba05ad01eb42f3246384a0c2ab1da",
"timestamp": "",
"source": "github",
"line_count": 44,
"max_line_length": 779,
"avg_line_length": 68.25,
"alnum_prop": 0.6646686646686647,
"repo_name": "andrewedstrom/cs638project",
"id": "d67339dd5a4ca0cf1e2b02bcfe7232d541c6e5bf",
"size": "3005",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "raw_data/arkive-endangered-html/amburana-cearensis.html",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "HTML",
"bytes": "514473381"
},
{
"name": "Jupyter Notebook",
"bytes": "2192214"
},
{
"name": "Python",
"bytes": "30115"
},
{
"name": "R",
"bytes": "9081"
}
],
"symlink_target": ""
} |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!--NewPage-->
<HTML>
<HEAD>
<!-- Generated by javadoc (build 1.5.0_22) on Wed Mar 02 16:45:48 EST 2011 -->
<TITLE>
DurationUtilsTest
</TITLE>
<META NAME="keywords" CONTENT="gov.nih.nci.cabig.caaers.utils.DurationUtilsTest class">
<LINK REL ="stylesheet" TYPE="text/css" HREF="../../../../../../stylesheet.css" TITLE="Style">
<SCRIPT type="text/javascript">
function windowTitle()
{
parent.document.title="DurationUtilsTest";
}
</SCRIPT>
<NOSCRIPT>
</NOSCRIPT>
</HEAD>
<BODY BGCOLOR="white" onload="windowTitle();">
<!-- ========= START OF TOP NAVBAR ======= -->
<A NAME="navbar_top"><!-- --></A>
<A HREF="#skip-navbar_top" title="Skip navigation links"></A>
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
<TR>
<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
<A NAME="navbar_top_firstrow"><!-- --></A>
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
<TR ALIGN="center" VALIGN="top">
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD>
<TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="class-use/DurationUtilsTest.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../index-files/index-1.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD>
</TR>
</TABLE>
</TD>
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
</EM>
</TD>
</TR>
<TR>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../../../../../gov/nih/nci/cabig/caaers/utils/DurationUtils.html" title="class in gov.nih.nci.cabig.caaers.utils"><B>PREV CLASS</B></A>
<A HREF="../../../../../../gov/nih/nci/cabig/caaers/utils/ExpectedAETermSorter.html" title="class in gov.nih.nci.cabig.caaers.utils"><B>NEXT CLASS</B></A></FONT></TD>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../../../../../index.html?gov/nih/nci/cabig/caaers/utils/DurationUtilsTest.html" target="_top"><B>FRAMES</B></A>
<A HREF="DurationUtilsTest.html" target="_top"><B>NO FRAMES</B></A>
<SCRIPT type="text/javascript">
<!--
if(window==top) {
document.writeln('<A HREF="../../../../../../allclasses-noframe.html"><B>All Classes</B></A>');
}
//-->
</SCRIPT>
<NOSCRIPT>
<A HREF="../../../../../../allclasses-noframe.html"><B>All Classes</B></A>
</NOSCRIPT>
</FONT></TD>
</TR>
<TR>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
SUMMARY: NESTED | FIELD | <A HREF="#constructor_summary">CONSTR</A> | <A HREF="#method_summary">METHOD</A></FONT></TD>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
DETAIL: FIELD | <A HREF="#constructor_detail">CONSTR</A> | <A HREF="#method_detail">METHOD</A></FONT></TD>
</TR>
</TABLE>
<A NAME="skip-navbar_top"></A>
<!-- ========= END OF TOP NAVBAR ========= -->
<HR>
<!-- ======== START OF CLASS DATA ======== -->
<H2>
<FONT SIZE="-1">
gov.nih.nci.cabig.caaers.utils</FONT>
<BR>
Class DurationUtilsTest</H2>
<PRE>
java.lang.Object
<IMG SRC="../../../../../../resources/inherit.gif" ALT="extended by ">junit.framework.Assert
<IMG SRC="../../../../../../resources/inherit.gif" ALT="extended by ">junit.framework.TestCase
<IMG SRC="../../../../../../resources/inherit.gif" ALT="extended by "><B>gov.nih.nci.cabig.caaers.utils.DurationUtilsTest</B>
</PRE>
<DL>
<DT><B>All Implemented Interfaces:</B> <DD>junit.framework.Test</DD>
</DL>
<HR>
<DL>
<DT><PRE>public class <B>DurationUtilsTest</B><DT>extends junit.framework.TestCase</DL>
</PRE>
<P>
<DL>
<DT><B>Author:</B></DT>
<DD>Biju Joseph</DD>
</DL>
<HR>
<P>
<!-- ======== CONSTRUCTOR SUMMARY ======== -->
<A NAME="constructor_summary"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
<B>Constructor Summary</B></FONT></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><CODE><B><A HREF="../../../../../../gov/nih/nci/cabig/caaers/utils/DurationUtilsTest.html#DurationUtilsTest()">DurationUtilsTest</A></B>()</CODE>
<BR>
</TD>
</TR>
</TABLE>
<!-- ========== METHOD SUMMARY =========== -->
<A NAME="method_summary"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
<B>Method Summary</B></FONT></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>protected void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../../gov/nih/nci/cabig/caaers/utils/DurationUtilsTest.html#setUp()">setUp</A></B>()</CODE>
<BR>
</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../../gov/nih/nci/cabig/caaers/utils/DurationUtilsTest.html#testFormatDuration_DayAndHourTesting()">testFormatDuration_DayAndHourTesting</A></B>()</CODE>
<BR>
</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../../gov/nih/nci/cabig/caaers/utils/DurationUtilsTest.html#testFormatDuration_DayTesting()">testFormatDuration_DayTesting</A></B>()</CODE>
<BR>
</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../../gov/nih/nci/cabig/caaers/utils/DurationUtilsTest.html#testFormatDuration_HourTesting()">testFormatDuration_HourTesting</A></B>()</CODE>
<BR>
</TD>
</TR>
</TABLE>
<A NAME="methods_inherited_from_class_junit.framework.TestCase"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor">
<TH ALIGN="left"><B>Methods inherited from class junit.framework.TestCase</B></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><CODE>countTestCases, createResult, getName, run, run, runBare, runTest, setName, tearDown, toString</CODE></TD>
</TR>
</TABLE>
<A NAME="methods_inherited_from_class_junit.framework.Assert"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor">
<TH ALIGN="left"><B>Methods inherited from class junit.framework.Assert</B></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><CODE>assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertFalse, assertFalse, assertNotNull, assertNotNull, assertNotSame, assertNotSame, assertNull, assertNull, assertSame, assertSame, assertTrue, assertTrue, fail, fail</CODE></TD>
</TR>
</TABLE>
<A NAME="methods_inherited_from_class_java.lang.Object"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor">
<TH ALIGN="left"><B>Methods inherited from class java.lang.Object</B></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><CODE>clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait</CODE></TD>
</TR>
</TABLE>
<P>
<!-- ========= CONSTRUCTOR DETAIL ======== -->
<A NAME="constructor_detail"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2">
<B>Constructor Detail</B></FONT></TH>
</TR>
</TABLE>
<A NAME="DurationUtilsTest()"><!-- --></A><H3>
DurationUtilsTest</H3>
<PRE>
public <B>DurationUtilsTest</B>()</PRE>
<DL>
</DL>
<!-- ============ METHOD DETAIL ========== -->
<A NAME="method_detail"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2">
<B>Method Detail</B></FONT></TH>
</TR>
</TABLE>
<A NAME="setUp()"><!-- --></A><H3>
setUp</H3>
<PRE>
protected void <B>setUp</B>()
throws java.lang.Exception</PRE>
<DL>
<DD><DL>
<DT><B>Overrides:</B><DD><CODE>setUp</CODE> in class <CODE>junit.framework.TestCase</CODE></DL>
</DD>
<DD><DL>
<DT><B>Throws:</B>
<DD><CODE>java.lang.Exception</CODE></DL>
</DD>
</DL>
<HR>
<A NAME="testFormatDuration_DayTesting()"><!-- --></A><H3>
testFormatDuration_DayTesting</H3>
<PRE>
public void <B>testFormatDuration_DayTesting</B>()</PRE>
<DL>
<DD><DL>
</DL>
</DD>
</DL>
<HR>
<A NAME="testFormatDuration_HourTesting()"><!-- --></A><H3>
testFormatDuration_HourTesting</H3>
<PRE>
public void <B>testFormatDuration_HourTesting</B>()</PRE>
<DL>
<DD><DL>
</DL>
</DD>
</DL>
<HR>
<A NAME="testFormatDuration_DayAndHourTesting()"><!-- --></A><H3>
testFormatDuration_DayAndHourTesting</H3>
<PRE>
public void <B>testFormatDuration_DayAndHourTesting</B>()</PRE>
<DL>
<DD><DL>
</DL>
</DD>
</DL>
<!-- ========= END OF CLASS DATA ========= -->
<HR>
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<A NAME="navbar_bottom"><!-- --></A>
<A HREF="#skip-navbar_bottom" title="Skip navigation links"></A>
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
<TR>
<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
<A NAME="navbar_bottom_firstrow"><!-- --></A>
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
<TR ALIGN="center" VALIGN="top">
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD>
<TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="class-use/DurationUtilsTest.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../index-files/index-1.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD>
</TR>
</TABLE>
</TD>
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
</EM>
</TD>
</TR>
<TR>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../../../../../gov/nih/nci/cabig/caaers/utils/DurationUtils.html" title="class in gov.nih.nci.cabig.caaers.utils"><B>PREV CLASS</B></A>
<A HREF="../../../../../../gov/nih/nci/cabig/caaers/utils/ExpectedAETermSorter.html" title="class in gov.nih.nci.cabig.caaers.utils"><B>NEXT CLASS</B></A></FONT></TD>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../../../../../index.html?gov/nih/nci/cabig/caaers/utils/DurationUtilsTest.html" target="_top"><B>FRAMES</B></A>
<A HREF="DurationUtilsTest.html" target="_top"><B>NO FRAMES</B></A>
<SCRIPT type="text/javascript">
<!--
if(window==top) {
document.writeln('<A HREF="../../../../../../allclasses-noframe.html"><B>All Classes</B></A>');
}
//-->
</SCRIPT>
<NOSCRIPT>
<A HREF="../../../../../../allclasses-noframe.html"><B>All Classes</B></A>
</NOSCRIPT>
</FONT></TD>
</TR>
<TR>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
SUMMARY: NESTED | FIELD | <A HREF="#constructor_summary">CONSTR</A> | <A HREF="#method_summary">METHOD</A></FONT></TD>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
DETAIL: FIELD | <A HREF="#constructor_detail">CONSTR</A> | <A HREF="#method_detail">METHOD</A></FONT></TD>
</TR>
</TABLE>
<A NAME="skip-navbar_bottom"></A>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
<HR>
</BODY>
</HTML>
| {
"content_hash": "bdf52f96ce1f3a64c542e1d8ea1c6588",
"timestamp": "",
"source": "github",
"line_count": 339,
"max_line_length": 470,
"avg_line_length": 41.4070796460177,
"alnum_prop": 0.6205741967656907,
"repo_name": "NCIP/caaers",
"id": "27fe62fe1d209a556853aca7405a9a801e0688c9",
"size": "14037",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "caAERS/software/docs/gov/nih/nci/cabig/caaers/utils/DurationUtilsTest.html",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "AspectJ",
"bytes": "2052"
},
{
"name": "CSS",
"bytes": "150269"
},
{
"name": "Groovy",
"bytes": "19195107"
},
{
"name": "Java",
"bytes": "13042355"
},
{
"name": "JavaScript",
"bytes": "438475"
},
{
"name": "Ruby",
"bytes": "29724"
},
{
"name": "Shell",
"bytes": "1436"
},
{
"name": "XSLT",
"bytes": "1330533"
}
],
"symlink_target": ""
} |
MISAPPLIED
#### According to
Euro+Med Plantbase
#### Published in
null
#### Original name
null
### Remarks
null | {
"content_hash": "6d1143427be2380643a027567027fa64",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 18,
"avg_line_length": 8.846153846153847,
"alnum_prop": 0.6869565217391305,
"repo_name": "mdoering/backbone",
"id": "8e79924d36b61e265a8d11b98d3f795059d43bf2",
"size": "158",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "life/Plantae/Magnoliophyta/Magnoliopsida/Asterales/Asteraceae/Saussurea/ Syn. Saussurea latifolia/README.md",
"mode": "33188",
"license": "apache-2.0",
"language": [],
"symlink_target": ""
} |
<div class="nav">
<nav>
<a href="/" title="Offices">Offices</a> >
<a ng-href="/office/{{candidate.office_id}}" alt="{{candidate.office}}">{{candidate.office}}</a> >
<span>{{candidate.name}}</span>
</nav>
</div>
<div class="candidate-details">
<h1>{{candidate.name}}</h1>
<h2>{{candidate.office}} {{candidate.year}}</h2>
<span class="candidate-contributions">Contributions: {{candidate.total_contributions | currency}}</h2><br>
<span class="candidate-match">Matching Funds: {{candidate.total_match | currency}}</h2><br>
<span class="candidate-total">Total: {{candidate.total | currency}}</h2>
</div>
<div ng-controller="CandidateMonthlyController" ng-include="'partials/candidate_monthly.html'"></div>
<!--<div class="occupation-pie" d3 d3-data="candidate.occupations" d3-renderer="occupationPieRenderer">-->
<!--<h3>Top Occupations</h3>-->
<!--</div>-->
<div class="mini-graph">
<h3>Top Employers</h3>
<hr>
<svg d3 d3-data="candidate.employers" d3-renderer="nameTotalBarGraph" class="candidate-employer-graph"></svg>
</div>
<div class="mini-graph">
<h3>Top Occupations</h3>
<hr>
<svg d3 d3-data="candidate.occupations" d3-renderer="nameTotalBarGraph" class="candidate-occupation-graph"></svg>
</div>
<div class="mini-graph">
<h3>Top Contributors</h3>
<hr>
<svg d3 d3-data="candidate.contributors" d3-renderer="nameTotalBarGraph" class="candidate-contributor-graph"></svg>
</div>
<div class="mini-map">
<h3>Top Zip Code:</h3>
<hr>
<!--<p>-->
<!--{{borough}} - {{zipCode}}<br>-->
<!--{{zipTotal | currency}}-->
<!--</p>-->
<div id="mini_map"></div>
</div>
<div id="bar_info" class="bar-info tooltip">
{{name}}<br />
{{value}}
</div> | {
"content_hash": "62d5a9815126ccad0e7b65fbd50229c7",
"timestamp": "",
"source": "github",
"line_count": 52,
"max_line_length": 119,
"avg_line_length": 34.15384615384615,
"alnum_prop": 0.6221846846846847,
"repo_name": "akilism/nyc-campaign-finance",
"id": "b32457a5d964f794eb3f94ae0ed174602a78609b",
"size": "1776",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "site_code/app/views/partials/candidate_details.html",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "69444"
},
{
"name": "JavaScript",
"bytes": "97976"
},
{
"name": "Python",
"bytes": "59263"
},
{
"name": "SQL",
"bytes": "27729"
}
],
"symlink_target": ""
} |
"""
Execute tasks through strace to obtain dependencies after the process is run. This
scheme is similar to that of the Fabricate script.
To use::
def configure(conf):
conf.load('strace')
WARNING:
* This will not work when advanced scanners are needed (qt4/qt5)
* The overhead of running 'strace' is significant (56s -> 1m29s)
* It will not work on Windows :-)
"""
import os, re, threading
from waflib import Task, Logs, Utils
#TRACECALLS = 'trace=access,chdir,clone,creat,execve,exit_group,fork,lstat,lstat64,mkdir,open,rename,stat,stat64,symlink,vfork'
TRACECALLS = 'trace=process,file'
BANNED = ('/tmp', '/proc', '/sys', '/dev')
s_process = r'(?:clone|fork|vfork)\(.*?(?P<npid>\d+)'
s_file = r'(?P<call>\w+)\("(?P<path>([^"\\]|\\.)*)"(.*)'
re_lines = re.compile(r'^(?P<pid>\d+)\s+(?:(?:%s)|(?:%s))\r*$' % (s_file, s_process), re.IGNORECASE | re.MULTILINE)
strace_lock = threading.Lock()
def configure(conf):
conf.find_program('strace')
def task_method(func):
# Decorator function to bind/replace methods on the base Task class
#
# The methods Task.exec_command and Task.sig_implicit_deps already exists and are rarely overridden
# we thus expect that we are the only ones doing this
try:
setattr(Task.Task, 'nostrace_%s' % func.__name__, getattr(Task.Task, func.__name__))
except AttributeError:
pass
setattr(Task.Task, func.__name__, func)
return func
@task_method
def get_strace_file(self):
try:
return self.strace_file
except AttributeError:
pass
if self.outputs:
ret = self.outputs[0].abspath() + '.strace'
else:
ret = '%s%s%d%s' % (self.generator.bld.bldnode.abspath(), os.sep, id(self), '.strace')
self.strace_file = ret
return ret
@task_method
def get_strace_args(self):
return (self.env.STRACE or ['strace']) + ['-e', TRACECALLS, '-f', '-o', self.get_strace_file()]
@task_method
def exec_command(self, cmd, **kw):
bld = self.generator.bld
if not 'cwd' in kw:
kw['cwd'] = self.get_cwd()
args = self.get_strace_args()
fname = self.get_strace_file()
if isinstance(cmd, list):
cmd = args + cmd
else:
cmd = '%s %s' % (' '.join(args), cmd)
try:
ret = bld.exec_command(cmd, **kw)
finally:
if not ret:
self.parse_strace_deps(fname, kw['cwd'])
return ret
@task_method
def sig_implicit_deps(self):
# bypass the scanner functions
return
@task_method
def parse_strace_deps(self, path, cwd):
# uncomment the following line to disable the dependencies and force a file scan
# return
try:
cnt = Utils.readf(path)
finally:
try:
os.remove(path)
except OSError:
pass
if not isinstance(cwd, str):
cwd = cwd.abspath()
nodes = []
bld = self.generator.bld
try:
cache = bld.strace_cache
except AttributeError:
cache = bld.strace_cache = {}
# chdir and relative paths
pid_to_cwd = {}
global BANNED
done = set()
for m in re.finditer(re_lines, cnt):
# scraping the output of strace
pid = m.group('pid')
if m.group('npid'):
npid = m.group('npid')
pid_to_cwd[npid] = pid_to_cwd.get(pid, cwd)
continue
p = m.group('path').replace('\\"', '"')
if p == '.' or m.group().find('= -1 ENOENT') > -1:
# just to speed it up a bit
continue
if not os.path.isabs(p):
p = os.path.join(pid_to_cwd.get(pid, cwd), p)
call = m.group('call')
if call == 'chdir':
pid_to_cwd[pid] = p
continue
if p in done:
continue
done.add(p)
for x in BANNED:
if p.startswith(x):
break
else:
if p.endswith('/') or os.path.isdir(p):
continue
try:
node = cache[p]
except KeyError:
strace_lock.acquire()
try:
cache[p] = node = bld.root.find_node(p)
if not node:
continue
finally:
strace_lock.release()
nodes.append(node)
# record the dependencies then force the task signature recalculation for next time
if Logs.verbose:
Logs.debug('deps: real scanner for %r returned %r', self, nodes)
bld = self.generator.bld
bld.node_deps[self.uid()] = nodes
bld.raw_deps[self.uid()] = []
try:
del self.cache_sig
except AttributeError:
pass
self.signature()
| {
"content_hash": "d446f629a5fd841f2fbb5889022432bb",
"timestamp": "",
"source": "github",
"line_count": 170,
"max_line_length": 127,
"avg_line_length": 23.735294117647058,
"alnum_prop": 0.6537794299876084,
"repo_name": "MarekIgnaszak/econ-project-templates",
"id": "37d82cbb724b14f4068415f2d49d3e9f60df20a9",
"size": "4102",
"binary": false,
"copies": "49",
"ref": "refs/heads/python",
"path": ".mywaflib/waflib/extras/stracedeps.py",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "Batchfile",
"bytes": "663"
},
{
"name": "Jupyter Notebook",
"bytes": "3572"
},
{
"name": "Python",
"bytes": "1222989"
},
{
"name": "Shell",
"bytes": "1716"
},
{
"name": "TeX",
"bytes": "14224"
}
],
"symlink_target": ""
} |
// Generated by the protocol buffer compiler. DO NOT EDIT!
// source: google/firestore/v1/firestore.proto
package com.google.firestore.v1;
public interface RunAggregationQueryResponseOrBuilder
extends
// @@protoc_insertion_point(interface_extends:google.firestore.v1.RunAggregationQueryResponse)
com.google.protobuf.MessageOrBuilder {
/**
*
*
* <pre>
* A single aggregation result.
* Not present when reporting partial progress.
* </pre>
*
* <code>.google.firestore.v1.AggregationResult result = 1;</code>
*
* @return Whether the result field is set.
*/
boolean hasResult();
/**
*
*
* <pre>
* A single aggregation result.
* Not present when reporting partial progress.
* </pre>
*
* <code>.google.firestore.v1.AggregationResult result = 1;</code>
*
* @return The result.
*/
com.google.firestore.v1.AggregationResult getResult();
/**
*
*
* <pre>
* A single aggregation result.
* Not present when reporting partial progress.
* </pre>
*
* <code>.google.firestore.v1.AggregationResult result = 1;</code>
*/
com.google.firestore.v1.AggregationResultOrBuilder getResultOrBuilder();
/**
*
*
* <pre>
* The transaction that was started as part of this request.
* Only present on the first response when the request requested to start
* a new transaction.
* </pre>
*
* <code>bytes transaction = 2;</code>
*
* @return The transaction.
*/
com.google.protobuf.ByteString getTransaction();
/**
*
*
* <pre>
* The time at which the aggregate value is valid for.
* </pre>
*
* <code>.google.protobuf.Timestamp read_time = 3;</code>
*
* @return Whether the readTime field is set.
*/
boolean hasReadTime();
/**
*
*
* <pre>
* The time at which the aggregate value is valid for.
* </pre>
*
* <code>.google.protobuf.Timestamp read_time = 3;</code>
*
* @return The readTime.
*/
com.google.protobuf.Timestamp getReadTime();
/**
*
*
* <pre>
* The time at which the aggregate value is valid for.
* </pre>
*
* <code>.google.protobuf.Timestamp read_time = 3;</code>
*/
com.google.protobuf.TimestampOrBuilder getReadTimeOrBuilder();
}
| {
"content_hash": "8e3ffb52ec2447470f9a28573488413b",
"timestamp": "",
"source": "github",
"line_count": 99,
"max_line_length": 98,
"avg_line_length": 22.86868686868687,
"alnum_prop": 0.6356007067137809,
"repo_name": "googleapis/java-firestore",
"id": "8a7025bbdecbed724f27dfa5b2cb70a854d93114",
"size": "2858",
"binary": false,
"copies": "1",
"ref": "refs/heads/main",
"path": "proto-google-cloud-firestore-v1/src/main/java/com/google/firestore/v1/RunAggregationQueryResponseOrBuilder.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Batchfile",
"bytes": "801"
},
{
"name": "Java",
"bytes": "6634579"
},
{
"name": "Python",
"bytes": "3402"
},
{
"name": "Shell",
"bytes": "22826"
},
{
"name": "Starlark",
"bytes": "2861"
}
],
"symlink_target": ""
} |
#ifndef itkRGBGibbsPriorFilter_h
#define itkRGBGibbsPriorFilter_h
#include "vnl/vnl_vector.h"
#include "vnl/vnl_matrix.h"
#include "itkMRFImageFilter.h"
namespace itk
{
/** \class RGBGibbsPriorFilter
* \brief The RGBGibbsPriorFilter applies Gibbs Prior model for the segmentation
* of MRF images.
*
* The core of the method is based on the minimization of a Gibbsian energy function.
* This energy function f can be divided into three part:
* f = f_1 + f_2 + f_3;
* f_1 is related to the object homogeneity,
* f_2 is related to the boundary smoothness,
* f_3 is related to the constraint of the observation (or the noise model).
* The two force components f_1 and f_3 are minimized by the GradientEnergy
* method while f_2 is minized by the GibbsTotalEnergy method.
*
* This filter only works with 3D images.
*
* \ingroup MRFFilters
* \ingroup ITKMarkovRandomFieldsClassifiers
*/
template< typename TInputImage, typename TClassifiedImage >
class ITK_TEMPLATE_EXPORT RGBGibbsPriorFilter:public MRFImageFilter< TInputImage,
TClassifiedImage >
{
public:
/** Standard "Self" type alias. */
using Self = RGBGibbsPriorFilter;
using Superclass = MRFImageFilter< TInputImage, TClassifiedImage >;
using Pointer = SmartPointer< Self >;
using ConstPointer = SmartPointer< const Self >;
/** Method for creation through the object factory. */
itkNewMacro(Self);
/** Run-time type information (and related methods). */
itkTypeMacro(RGBGibbsPriorFilter, MRFImageFilter);
/** Types from superclass. */
using InputImagePixelType = typename Superclass::InputImagePixelType;
using InputImageRegionConstIterator = typename Superclass::InputImageRegionConstIterator;
using InputImageRegionIterator = typename Superclass::InputImageRegionIterator;
using LabelledImageRegionIterator = typename Superclass::LabelledImageRegionIterator;
using LabelledImagePixelType = typename Superclass::LabelledImagePixelType;
using IndexValueType = typename Superclass::IndexValueType;
/** A smart pointer to the input image type. */
using InputImageType = TInputImage;
using InputImagePointer = typename TInputImage::Pointer;
using InputImageConstPointer = typename TInputImage::ConstPointer;
/** Type definition for the input image pixel type. */
using InputPixelType = typename TInputImage::PixelType;
/** Type definitions for the training image. */
using ClassifiedImageType = TClassifiedImage;
using TrainingImageType = typename TClassifiedImage::Pointer;
/** Type definitions for the labelled image.
* It is derived from the training image. */
using LabelledImageType = typename TClassifiedImage::Pointer;
/** Type definition for the classified image index type. */
using LabelledImageIndexType = typename TClassifiedImage::IndexType;
/** Type used as identifier for the Labels
\warning -1 cannot be used as the identifier for unlabeled pixels
the NumericTraits<>::max() value is used for indicating unlabeled pixels */
using LabelType = unsigned int;
/** Type definitions for classifier to be used for the MRF lavbelling. */
using ClassifierType = ImageClassifierBase< TInputImage, TClassifiedImage >;
/** The type of input pixel. */
using InputImageVecType = typename TInputImage::PixelType;
using IndexType = typename TInputImage::IndexType;
/** Set the image required for training type classifiers. */
void SetTrainingImage(TrainingImageType image);
/** Set the labelled image. */
void SetLabelledImage(LabelledImageType LabelledImage);
/** Get the labelled image. */
LabelledImageType GetLabelledImage()
{ return m_LabelledImage; }
/** Set the pointer to the classifer being used. */
void SetClassifier(typename ClassifierType::Pointer ptrToClassifier);
/** Set the Number of classes. */
void SetNumberOfClasses( const unsigned int numberOfClasses ) override
{
itkDebugMacro("setting NumberOfClasses to " << numberOfClasses );
if ( this->m_NumberOfClasses != numberOfClasses )
{
this->m_NumberOfClasses = numberOfClasses;
this->Modified();
}
}
/** Get the Number of classes. */
unsigned int GetNumberOfClasses() const override
{
return this->m_NumberOfClasses;
}
/** Set/Get the number of iteration of the Iterated Conditional Mode
* (ICM) algorithm. A default value is set at 50 iterations. */
void SetMaximumNumberOfIterations( const unsigned int numberOfIterations ) override
{
itkDebugMacro("setting MaximumNumberOfIterations to " << numberOfIterations);
if ( this->m_MaximumNumberOfIterations != numberOfIterations )
{
this->m_MaximumNumberOfIterations = numberOfIterations;
this->Modified();
}
}
/** Get the number of iterations of the Iterated Conditional Mode
* (ICM) algorithm. */
unsigned int GetMaximumNumberOfIterations() const override
{
return this->m_MaximumNumberOfIterations;
}
/** Set the threshold for the object size. */
itkSetMacro(ClusterSize, unsigned int);
/** Set the label for the object region. */
itkSetMacro(ObjectLabel, LabelType);
/** Extract the input image dimension. */
static constexpr unsigned int ImageDimension = TInputImage::ImageDimension;
itkSetMacro(StartPoint, IndexType);
itkSetMacro(BoundaryGradient, unsigned int);
itkSetMacro(ObjectThreshold, double);
/** set and get the value for Clique weights */
itkSetMacro(CliqueWeight_1, double);
itkGetConstMacro(CliqueWeight_1, double);
itkSetMacro(CliqueWeight_2, double);
itkGetConstMacro(CliqueWeight_2, double);
itkSetMacro(CliqueWeight_3, double);
itkGetConstMacro(CliqueWeight_3, double);
itkSetMacro(CliqueWeight_4, double);
itkGetConstMacro(CliqueWeight_4, double);
itkSetMacro(CliqueWeight_5, double);
itkGetConstMacro(CliqueWeight_5, double);
itkSetMacro(CliqueWeight_6, double);
itkGetConstMacro(CliqueWeight_6, double);
/** Specify the type of matrix to use. */
using MatrixType = vnl_matrix< double >;
protected:
RGBGibbsPriorFilter();
~RGBGibbsPriorFilter() override;
void PrintSelf(std::ostream & os, Indent indent) const override;
void Allocate(); /** allocate memory space for the filter. */
void MinimizeFunctional() override;
void GenerateData() override;
virtual void ApplyGibbsLabeller();
virtual void ApplyGPImageFilter();
#ifdef ITK_USE_CONCEPT_CHECKING
// Begin concept checking
itkConceptMacro( SameDimension,
( Concept::SameDimension< Self::InputImageType::ImageDimension,
Self::ClassifiedImageType::ImageDimension > ) );
itkConceptMacro( DimensionShouldBe3,
( Concept::SameDimension< Self::InputImageType::ImageDimension, 3 > ) );
// End concept checking
#endif
private:
RGBGibbsPriorFilter(const Self &) = delete;
void operator=(const Self &) = delete;
using InputImageSizeType = typename TInputImage::SizeType;
InputImageConstPointer m_InputImage; /** the input */
TrainingImageType m_TrainingImage; /** image to train the
filter. */
LabelledImageType m_LabelledImage; /** output */
unsigned int m_NumberOfClasses{0}; /** the number of class
need to be classified.
*/
unsigned int m_MaximumNumberOfIterations{10}; /** number of the
iteration. */
typename ClassifierType::Pointer m_ClassifierPtr;
unsigned int m_BoundaryGradient{7}; /** the threshold for the existence of a
boundary. */
double m_BoundaryWeight{1}; /** weight for H_1 */
double m_GibbsPriorWeight{1}; /** weight for H_2 */
int m_StartRadius{10}; /** define the start region of the object. */
int m_RecursiveNumber{0}; /** number of SA iterations. */
LabelType * m_LabelStatus{nullptr}; /** array for the state of each pixel. */
InputImagePointer m_MediumImage; /** the medium image to store intermedium
result */
unsigned int m_Temp{0}; /** for SA algo. */
IndexType m_StartPoint; /** the seed of object */
unsigned int m_ImageWidth{0}; /** image size. */
unsigned int m_ImageHeight{0};
unsigned int m_ImageDepth{0};
unsigned int m_ClusterSize{10}; /** region size smaller than the threshold will
be erased. */
LabelType m_ObjectLabel{1}; /** the label for object region. */
unsigned int m_VecDim{0}; /** the channel number in the image. */
InputPixelType m_LowPoint; /** the point give lowest value of H-1 in
neighbor. */
unsigned short *m_Region{nullptr}; /** for region erase. */
unsigned short *m_RegionCount{nullptr}; /** for region erase. */
/** weights for different clique configuration. */
double m_CliqueWeight_1{0.0}; /** weight for cliques that v/h smooth boundayr */
double m_CliqueWeight_2{0.0}; /** weight for clique that has an intermadiate
smooth boundary */
double m_CliqueWeight_3{0.0}; /** weight for clique that has a diagonal smooth
boundary */
double m_CliqueWeight_4{0.0}; /** weight for clique consists only object pixels */
double m_CliqueWeight_5{0.0}; /** weight for clique consists only background
pixels */
double m_CliqueWeight_6{0.0}; /** weight for clique other than these */
/** calculate H_2. */
void GibbsTotalEnergy(int i);
/** calculate the energy in each cluster. */
double GibbsEnergy(unsigned int i, unsigned int k, unsigned int k1);
int Sim(int a, int b); /** method to return 1 when a equal to b. */
unsigned int LabelRegion(int i, int l, int change); /** help to erase the
small region. */
void RegionEraser(); /** erase the small region. */
void GenerateMediumImage(); /** create the intermedium image.
*/
void GreyScalarBoundary(LabelledImageIndexType Index3D); /** calculate H_1.
*/
double m_ObjectThreshold{5.0};
};
} // end namespace itk
#ifndef ITK_MANUAL_INSTANTIATION
#include "itkRGBGibbsPriorFilter.hxx"
#endif
#endif
| {
"content_hash": "6e23b6eabd97705560b4156f3ac7311f",
"timestamp": "",
"source": "github",
"line_count": 273,
"max_line_length": 93,
"avg_line_length": 39.18315018315018,
"alnum_prop": 0.6651397588108816,
"repo_name": "fbudin69500/ITK",
"id": "0c251d44f5b0a388cd9a12a4f4e619992cb44187",
"size": "11472",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "Modules/Segmentation/MarkovRandomFieldsClassifiers/include/itkRGBGibbsPriorFilter.h",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "C",
"bytes": "448219"
},
{
"name": "C++",
"bytes": "34440758"
},
{
"name": "CMake",
"bytes": "1406460"
},
{
"name": "CSS",
"bytes": "17428"
},
{
"name": "Java",
"bytes": "28585"
},
{
"name": "JavaScript",
"bytes": "1522"
},
{
"name": "Objective-C++",
"bytes": "5773"
},
{
"name": "Perl",
"bytes": "6029"
},
{
"name": "Python",
"bytes": "403426"
},
{
"name": "Ruby",
"bytes": "296"
},
{
"name": "Shell",
"bytes": "143860"
},
{
"name": "Tcl",
"bytes": "72988"
},
{
"name": "XSLT",
"bytes": "8634"
}
],
"symlink_target": ""
} |
"""
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you 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.
"""
import os
import re
import getpass
import tempfile
from copy import copy
from resource_management.libraries.functions.version import compare_versions
from resource_management import *
from resource_management.core import shell
def setup_users():
"""
Creates users before cluster installation
"""
import params
should_create_users_and_groups = False
if params.host_sys_prepped:
should_create_users_and_groups = not params.sysprep_skip_create_users_and_groups
else:
should_create_users_and_groups = not params.ignore_groupsusers_create
if should_create_users_and_groups:
for group in params.group_list:
Group(group,
)
for user in params.user_list:
User(user,
uid = get_uid(user) if params.override_uid == "true" else None,
gid = params.user_to_gid_dict[user],
groups = params.user_to_groups_dict[user],
fetch_nonlocal_groups = params.fetch_nonlocal_groups,
)
if params.override_uid == "true":
set_uid(params.smoke_user, params.smoke_user_dirs)
else:
Logger.info('Skipping setting uid for smoke user as host is sys prepped')
else:
Logger.info('Skipping creation of User and Group as host is sys prepped or ignore_groupsusers_create flag is on')
pass
if params.has_hbase_masters:
Directory (params.hbase_tmp_dir,
owner = params.hbase_user,
mode=0775,
create_parents = True,
cd_access="a",
)
if params.override_uid == "true":
set_uid(params.hbase_user, params.hbase_user_dirs)
else:
Logger.info('Skipping setting uid for hbase user as host is sys prepped')
if should_create_users_and_groups:
if params.has_namenode:
create_dfs_cluster_admins()
if params.has_tez and params.stack_version_formatted != "" and compare_versions(params.stack_version_formatted, '2.3') >= 0:
create_tez_am_view_acls()
else:
Logger.info('Skipping setting dfs cluster admin and tez view acls as host is sys prepped')
def create_dfs_cluster_admins():
"""
dfs.cluster.administrators support format <comma-delimited list of usernames><space><comma-delimited list of group names>
"""
import params
groups_list = create_users_and_groups(params.dfs_cluster_administrators_group)
User(params.hdfs_user,
groups = params.user_to_groups_dict[params.hdfs_user] + groups_list,
fetch_nonlocal_groups = params.fetch_nonlocal_groups
)
def create_tez_am_view_acls():
"""
tez.am.view-acls support format <comma-delimited list of usernames><space><comma-delimited list of group names>
"""
import params
if not params.tez_am_view_acls.startswith("*"):
create_users_and_groups(params.tez_am_view_acls)
def create_users_and_groups(user_and_groups):
import params
parts = re.split('\s+', user_and_groups)
if len(parts) == 1:
parts.append("")
users_list = parts[0].strip(",").split(",") if parts[0] else []
groups_list = parts[1].strip(",").split(",") if parts[1] else []
# skip creating groups and users if * is provided as value.
users_list = filter(lambda x: x != '*' , users_list)
groups_list = filter(lambda x: x != '*' , groups_list)
if users_list:
User(users_list,
fetch_nonlocal_groups = params.fetch_nonlocal_groups
)
if groups_list:
Group(copy(groups_list),
)
return groups_list
def set_uid(user, user_dirs):
"""
user_dirs - comma separated directories
"""
import params
File(format("{tmp_dir}/changeUid.sh"),
content=StaticFile("changeToSecureUid.sh"),
mode=0555)
ignore_groupsusers_create_str = str(params.ignore_groupsusers_create).lower()
uid = get_uid(user)
Execute(format("{tmp_dir}/changeUid.sh {user} {user_dirs} {new_uid}", new_uid=0 if uid is None else uid),
not_if = format("(test $(id -u {user}) -gt 1000) || ({ignore_groupsusers_create_str})"))
def get_uid(user):
import params
user_str = str(user) + "_uid"
service_env = [ serviceEnv for serviceEnv in params.config['configurations'] if user_str in params.config['configurations'][serviceEnv]]
if service_env and params.config['configurations'][service_env[0]][user_str]:
service_env_str = str(service_env[0])
uid = params.config['configurations'][service_env_str][user_str]
if len(service_env) > 1:
Logger.warning("Multiple values found for %s, using %s" % (user_str, uid))
return uid
else:
if user == params.smoke_user:
return None
File(format("{tmp_dir}/changeUid.sh"),
content=StaticFile("changeToSecureUid.sh"),
mode=0555)
code, newUid = shell.call(format("{tmp_dir}/changeUid.sh {user}"))
return int(newUid)
def setup_hadoop_env():
import params
stackversion = params.stack_version_unformatted
Logger.info("FS Type: {0}".format(params.dfs_type))
if params.has_namenode or stackversion.find('Gluster') >= 0 or params.dfs_type == 'HCFS':
if params.security_enabled:
tc_owner = "root"
else:
tc_owner = params.hdfs_user
# create /etc/hadoop
Directory(params.hadoop_dir, mode=0755)
# HDP < 2.2 used a conf -> conf.empty symlink for /etc/hadoop/
if Script.is_stack_less_than("2.2"):
Directory(params.hadoop_conf_empty_dir, create_parents = True, owner="root",
group=params.user_group )
Link(params.hadoop_conf_dir, to=params.hadoop_conf_empty_dir,
not_if=format("ls {hadoop_conf_dir}"))
# write out hadoop-env.sh, but only if the directory exists
if os.path.exists(params.hadoop_conf_dir):
File(os.path.join(params.hadoop_conf_dir, 'hadoop-env.sh'), owner=tc_owner,
group=params.user_group,
content=InlineTemplate(params.hadoop_env_sh_template))
# Create tmp dir for java.io.tmpdir
# Handle a situation when /tmp is set to noexec
Directory(params.hadoop_java_io_tmpdir,
owner=params.hdfs_user,
group=params.user_group,
mode=01777
)
def setup_java():
"""
Install jdk using specific params.
Install ambari jdk as well if the stack and ambari jdk are different.
"""
import params
__setup_java(custom_java_home=params.java_home, custom_jdk_name=params.jdk_name)
if params.ambari_java_home and params.ambari_java_home != params.java_home:
__setup_java(custom_java_home=params.ambari_java_home, custom_jdk_name=params.ambari_jdk_name)
def __setup_java(custom_java_home, custom_jdk_name):
"""
Installs jdk using specific params, that comes from ambari-server
"""
import params
java_exec = format("{custom_java_home}/bin/java")
if not os.path.isfile(java_exec):
if not params.jdk_name: # if custom jdk is used.
raise Fail(format("Unable to access {java_exec}. Confirm you have copied jdk to this host."))
jdk_curl_target = format("{tmp_dir}/{custom_jdk_name}")
java_dir = os.path.dirname(params.java_home)
Directory(params.artifact_dir,
create_parents = True,
)
File(jdk_curl_target,
content = DownloadSource(format("{jdk_location}/{custom_jdk_name}")),
not_if = format("test -f {jdk_curl_target}")
)
File(jdk_curl_target,
mode = 0755,
)
tmp_java_dir = tempfile.mkdtemp(prefix="jdk_tmp_", dir=params.tmp_dir)
try:
if params.jdk_name.endswith(".bin"):
chmod_cmd = ("chmod", "+x", jdk_curl_target)
install_cmd = format("cd {tmp_java_dir} && echo A | {jdk_curl_target} -noregister && {sudo} cp -rp {tmp_java_dir}/* {java_dir}")
elif params.jdk_name.endswith(".gz"):
chmod_cmd = ("chmod","a+x", java_dir)
install_cmd = format("cd {tmp_java_dir} && tar -xf {jdk_curl_target} && {sudo} cp -rp {tmp_java_dir}/* {java_dir}")
Directory(java_dir
)
Execute(chmod_cmd,
sudo = True,
)
Execute(install_cmd,
)
finally:
Directory(tmp_java_dir, action="delete")
File(format("{custom_java_home}/bin/java"),
mode=0755,
cd_access="a",
)
Execute(('chmod', '-R', '755', params.java_home),
sudo = True,
)
| {
"content_hash": "f4bf50c6ed1827246a3af397bce00403",
"timestamp": "",
"source": "github",
"line_count": 268,
"max_line_length": 138,
"avg_line_length": 33.406716417910445,
"alnum_prop": 0.660895789120965,
"repo_name": "radicalbit/ambari",
"id": "ee950e83cf7b68c7efd3dfa70f14c358304cfef2",
"size": "8953",
"binary": false,
"copies": "1",
"ref": "refs/heads/trunk",
"path": "ambari-server/src/main/resources/stacks/HDP/2.0.6/hooks/before-ANY/scripts/shared_initialization.py",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Batchfile",
"bytes": "42212"
},
{
"name": "C",
"bytes": "331204"
},
{
"name": "C#",
"bytes": "182799"
},
{
"name": "C++",
"bytes": "257"
},
{
"name": "CSS",
"bytes": "1287531"
},
{
"name": "CoffeeScript",
"bytes": "4323"
},
{
"name": "FreeMarker",
"bytes": "2654"
},
{
"name": "Groovy",
"bytes": "88056"
},
{
"name": "HTML",
"bytes": "5098825"
},
{
"name": "Java",
"bytes": "29006663"
},
{
"name": "JavaScript",
"bytes": "17274453"
},
{
"name": "Makefile",
"bytes": "11111"
},
{
"name": "PHP",
"bytes": "149648"
},
{
"name": "PLSQL",
"bytes": "2160"
},
{
"name": "PLpgSQL",
"bytes": "314333"
},
{
"name": "PowerShell",
"bytes": "2087991"
},
{
"name": "Python",
"bytes": "14584206"
},
{
"name": "R",
"bytes": "1457"
},
{
"name": "Roff",
"bytes": "13935"
},
{
"name": "Ruby",
"bytes": "14478"
},
{
"name": "SQLPL",
"bytes": "2117"
},
{
"name": "Shell",
"bytes": "741459"
},
{
"name": "Vim script",
"bytes": "5813"
}
],
"symlink_target": ""
} |
package com.ookamijin.cheskers;
import java.util.ArrayList;
import java.util.Random;
import android.graphics.Rect;
import android.util.Log;
public abstract class Player {
protected String name = "Add Name!"; // pretty sure this doesn't do anything
protected Board mBoard;
protected ArrayList<Coord> tilePath;
protected int score;
public boolean isHet = false;
public boolean isHom = false;
public boolean isRobot = false;
protected int nameX;
protected int nameY;
public Coord scoreLocation;
protected Rect poolBounds;
protected Random gen;
public Player() {
poolBounds = new Rect();
score = 0;
gen = new Random(666);
}
public void setBoard(Board mBoard) {
this.mBoard = mBoard;
}
public Player(Board gameBoard) {
this.mBoard = gameBoard;
poolBounds = new Rect();
score = 0;
gen = new Random(666);
}
public boolean isRobot() {
return isRobot;
}
public void setRobot(boolean isRobot) {
this.isRobot = isRobot;
}
public int getScore() {
return score;
}
public void setScore(int score) {
this.score = score;
}
public boolean isValid(ArrayList<Coord> coords, Chip userChip,
ArrayList<Coord> targets) {
// was a push
for (int i = 1; i < coords.size(); ++i) {
if (!mBoard.tileIsEmpty(coords.get(i)))
return false;
}
if (coords.get(0).x != coords.get(coords.size() - 1).x
&& coords.get(0).y != coords.get(coords.size() - 1).y)
return false;
return true;
}
public abstract boolean isBonus(ArrayList<Coord> tilePath, Chip userChip);
public Coord getPoolCoord() {
int x, y;
Coord coord;
x = poolBounds.left + gen.nextInt(poolBounds.right - poolBounds.left) + 1;
y = poolBounds.top + gen.nextInt(poolBounds.bottom - poolBounds.top) + 1;
coord = new Coord(x, y);
return coord;
}
protected void debug(String message) {
Log.d("DEBUG", message);
}
public int getNameX() {
return nameX;
}
public int getNameY() {
return nameY;
}
protected void addBufferMoves(Coord startCoord,
ArrayList<ArrayList<Coord>> moveList) {
int x = startCoord.getX();
int y = startCoord.getY();
// up
if (y - 1 >= 0) {
if (mBoard.tileHasNothing(new Coord(x, y - 1))) {
moveList.add(new ArrayList<Coord>());
moveList.get(moveList.size() - 1).add(new Coord(x, y));
moveList.get(moveList.size() - 1).add(new Coord(x, y - 1));
}
}
// down
else if (y + 1 <= 5) {
if (mBoard.tileHasNothing(new Coord(x, y + 1))) {
moveList.add(new ArrayList<Coord>());
moveList.get(moveList.size() - 1).add(new Coord(x, y));
moveList.get(moveList.size() - 1).add(new Coord(x, y + 1));
}
}
// left
else if (x - 1 >= 0) {
if (mBoard.tileHasNothing(new Coord(x - 1, y))) {
moveList.add(new ArrayList<Coord>());
moveList.get(moveList.size() - 1).add(new Coord(x, y));
moveList.get(moveList.size() - 1).add(new Coord(x - 1, y));
}
}
// right
else if (x + 1 <= 5) {
if (mBoard.tileHasNothing(new Coord(x + 1, y))) {
moveList.add(new ArrayList<Coord>());
moveList.get(moveList.size() - 1).add(new Coord(x, y));
moveList.get(moveList.size() - 1).add(new Coord(x + 1, y));
}
}
}
public abstract ArrayList<Coord> doRobot(Board mBoard);
protected abstract ArrayList<ArrayList<Coord>> findAllMoves();
protected abstract ArrayList<Coord> pickPriority(
ArrayList<ArrayList<Coord>> moveList);
}
| {
"content_hash": "fbd62e2f9c8289f00924a5ee431665b8",
"timestamp": "",
"source": "github",
"line_count": 149,
"max_line_length": 77,
"avg_line_length": 22.59731543624161,
"alnum_prop": 0.6536976536976536,
"repo_name": "ookamijin/Cheskers",
"id": "d1073f75c34518f794ce3c6bf4e3446db3c5c108",
"size": "3367",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "app/src/main/java/com/ookamijin/cheskers/Player.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Java",
"bytes": "213383"
}
],
"symlink_target": ""
} |
package com.dhian.systemui;
import android.content.Context;
import android.content.res.TypedArray;
import android.preference.Preference;
import android.util.AttributeSet;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewParent;
import android.widget.RelativeLayout;
import android.widget.SeekBar;
import android.widget.SeekBar.OnSeekBarChangeListener;
import android.widget.TextView;
public class SeekBarPreferences extends Preference implements OnSeekBarChangeListener {
private static final String TAG = SeekBarPreferences.class.getSimpleName();
private static final float DEFAULT_VALUE = 50;
private static final String APP_NS = "http://code.google.com/p/javadrone";
private float maxValue = 100;
private float minValue = 0;
private float interval = 1;
public static float sizetext ;
private boolean roundValue = false;
private String unitsLeft = "";
private String unitsRight = "";
private SeekBar seekBar;
private TextView statusText;
public SeekBarPreferences(Context context, AttributeSet attrs) {
super(context, attrs);
initPreference(context, attrs);
}
public SeekBarPreferences(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
initPreference(context, attrs);
Log.d(TAG, "Preferences are installed");
}
private void initPreference(Context context, AttributeSet attrs) {
Log.d(TAG, "Set values from xml");
setValuesFromXml(attrs);
this.seekBar = new SeekBar(context, attrs);
this.seekBar.setMax(Math.round((this.maxValue - this.minValue)/this.interval));
this.seekBar.setOnSeekBarChangeListener(this);
}
private void setValuesFromXml(AttributeSet attrs) {
this.maxValue = attrs.getAttributeFloatValue(APP_NS, "max", 100);
this.minValue = attrs.getAttributeFloatValue(APP_NS, "min", 0);
this.unitsLeft = getAttributeStringValue(attrs, APP_NS, "unitsLeft", "");
this.unitsRight = getAttributeStringValue(attrs, APP_NS, "unitsRight", "");
this.roundValue = attrs.getAttributeBooleanValue(APP_NS, "roundValue", false);
try {
String newInterval = attrs.getAttributeValue(APP_NS, "interval");
if(newInterval != null)
this.interval = Float.parseFloat(newInterval);
}
catch(Exception e) {
Log.e(TAG, "Invalid interval value", e);
}
}
private String getAttributeStringValue(AttributeSet attrs, String namespace, String name, String defaultValue) {
String value = attrs.getAttributeValue(namespace, name);
if(value == null)
value = defaultValue;
return value;
}
@Override
protected View onCreateView(ViewGroup parent){
Log.d(TAG, "Start creating view");
RelativeLayout layout = null;
try {
LayoutInflater mInflater = (LayoutInflater) getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
layout = (RelativeLayout)mInflater.inflate(getID("seek_bar_preference","layout"), parent, false);
}
catch(Exception e) {
Log.e(TAG, "Error creating seek bar preference", e);
}
return layout;
}
@Override
public void onBindView(View view) {
super.onBindView(view);
Log.d(TAG, "Start binding view");
try
{
// move our seekbar to the new view we've been given
ViewParent oldContainer = this.seekBar.getParent();
ViewGroup newContainer = (ViewGroup) view.findViewById(getID("seekBarPrefBarContainer","id"));
if (oldContainer != newContainer) {
// remove the seekbar from the old view
if (oldContainer != null) {
((ViewGroup) oldContainer).removeView(this.seekBar);
}
// remove the existing seekbar (there may not be one) and add ours
newContainer.removeAllViews();
newContainer.addView(this.seekBar, ViewGroup.LayoutParams.MATCH_PARENT,
ViewGroup.LayoutParams.WRAP_CONTENT);
}
}
catch(Exception e) {
Log.e(TAG, "Error binding view: ", e);
}
updateView(view);
}
/**
* Update a SeekBarPreference view with our current state
* @param view
*/
protected void updateView(View view) {
Log.d(TAG, "updateView");
try {
RelativeLayout layout = (RelativeLayout)view;
this.statusText = (TextView)layout.findViewById(getID("seekBarPrefValue","id"));
this.statusText.setText( roundValue ? String.valueOf((int) this.sizetext) : String.valueOf(this.sizetext));
this.statusText.setMinimumWidth(30);
this.seekBar.setProgress((int)Math.round((this.sizetext - this.minValue)/this.interval));
TextView unitsRight = (TextView)layout.findViewById(getID("seekBarPrefUnitsRight","id"));
unitsRight.setText(this.unitsRight);
TextView unitsLeft = (TextView)layout.findViewById(getID("seekBarPrefUnitsLeft","id"));
unitsLeft.setText(this.unitsLeft);
}
catch(Exception e) {
Log.e(TAG, "Error updating seek bar preference", e);
}
}
@Override
public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
Log.d(TAG, "onProgressChanged");
float newValue = ((float)Math.round((progress*this.interval+ this.minValue)*100))/100 ;
if(newValue > this.maxValue)
newValue = this.maxValue;
else if(newValue < this.minValue)
newValue = this.minValue;
if(!callChangeListener(Math.round(newValue))){
seekBar.setProgress(Math.round((this.sizetext - this.minValue)/this.interval));
return;
}
this.sizetext = newValue;
this.statusText.setText(roundValue ? String.valueOf((int)newValue) : String.valueOf(newValue));
persistFloat(newValue);
}
@Override
public void onStartTrackingTouch(SeekBar seekBar) {}
@Override
public void onStopTrackingTouch(SeekBar seekBar) {
}
@Override
protected Object onGetDefaultValue(TypedArray ta, int index){
Log.d(TAG,"onGetDefaultValue");
float defaultValue = ta.getFloat(index, DEFAULT_VALUE);
return defaultValue;
}
@Override
protected void onSetInitialValue(boolean restoreValue, Object defaultValue) {
Log.d(TAG,"onSetInitialValue");
if(restoreValue) {
Log.d(TAG,"restoreValue");
this.sizetext = getPersistedFloat(this.sizetext);
}
else {
float temp = (float)this.minValue;
try {
temp = (Float)defaultValue;
}
catch(Exception e) {
Log.e(TAG, "Invalid default value: " + defaultValue.toString(), e);
}
persistFloat(temp);
this.sizetext = temp;
}}
public int getID(String name, String Type) {
return getContext().getResources().getIdentifier(name, Type, getContext().getPackageName());
}}
| {
"content_hash": "ed4a9a6f4a866adccba4dfe653a94223",
"timestamp": "",
"source": "github",
"line_count": 173,
"max_line_length": 119,
"avg_line_length": 42.35260115606936,
"alnum_prop": 0.6398253036713525,
"repo_name": "DhianRusdhiana/Editable-and-Dynamic-Carrier-Name-in-Statusbar",
"id": "634b03bd5b03569d49c665e85ff6fb8c19fdf53a",
"size": "7327",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "src/com/dhian/systemui/SeekBarPreferences.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Java",
"bytes": "82367"
}
],
"symlink_target": ""
} |
from mock import patch
from channel_facebook.channel import TriggerType
from core.channel import (NotSupportedTrigger, ConditionNotMet)
from core.models import Channel, Trigger
from .test_base import FacebookBaseTestCase
class ChannelTriggerTestCase(FacebookBaseTestCase):
def test_fire_trigger_post(self):
get_data = [{
'message': 'Testmessage',
'permalink_url': 'https://www.facebook.com/permalink.php?story_fbid=1234',
'created_time': '2016-09-14T14:27:06+0000',
'id': '101915710270588_102025766926249',
'type': 'status'
}]
payload = {
'permalink_url': 'https://www.facebook.com/permalink.php?story_fbid=1234',
'message': 'Testmessage'
}
with patch('channel_facebook.channel.FacebookChannel._getFeeds') as mock_get_feeds, \
patch('core.core.Core.handle_trigger') as mock_handle_trigger:
trigger_type = TriggerType.new_post
mock_get_feeds.return_value = get_data
self.channel.fire_trigger(self.webhook_data)
mock_get_feeds.assert_called_once_with(fields=self.fields,
user=self.facebook_account,
time=self.time)
mock_handle_trigger.assert_called_once_with(channel_name=self.channel_name,
trigger_type=trigger_type,
userid=self.facebook_account.user_id,
payload=payload)
def test_fire_trigger_photo(self):
get_data = [{
'id': '101915710270588_101933616935464',
'message': 'testmessage',
'link': 'https://www.facebook.com/photo.php?fbid=101933566935469',
'created_time': '2016-09-14T13:08:39+0000',
'permalink_url': 'https://www.facebook.com/permalink.php?story_fbid=1019&id=100',
'full_picture': 'https://scontent.xx.fbcdn.net/1_n.jpg',
'picture': 'https://scontent.xx.fbcdn.net/1_n.jpg',
'type': 'photo'
}]
payload = {
'message': 'testmessage',
'link': 'https://www.facebook.com/photo.php?fbid=101933566935469',
'permalink_url': 'https://www.facebook.com/permalink.php?story_fbid=1019&id=100',
'full_picture': 'https://scontent.xx.fbcdn.net/1_n.jpg',
'picture': 'https://scontent.xx.fbcdn.net/1_n.jpg'
}
with patch('channel_facebook.channel.FacebookChannel._getFeeds') as mock_get_feeds, \
patch('core.core.Core.handle_trigger') as mock_handle_trigger:
trigger_type = TriggerType.new_photo
mock_get_feeds.return_value = get_data
self.channel.fire_trigger(self.webhook_data)
mock_get_feeds.assert_called_once_with(fields=self.fields,
user=self.facebook_account,
time=self.time)
mock_handle_trigger.assert_called_once_with(channel_name=self.channel_name,
trigger_type=trigger_type,
userid=self.facebook_account.user_id,
payload=payload)
def test_fire_trigger_photo_with_hashtag(self):
get_data = [{
'id': '101915710270588_101933616935464',
'message': '#me',
'link': 'https://www.facebook.com/photo.php?fbid=101933566935469',
'created_time': '2016-09-14T13:08:39+0000',
'permalink_url': 'https://www.facebook.com/permalink.php?story_fbid=1019&id=100',
'full_picture': 'https://scontent.xx.fbcdn.net/1_n.jpg',
'picture': 'https://scontent.xx.fbcdn.net/1_n.jpg',
'type': 'photo'}]
payload = {
'permalink_url': 'https://www.facebook.com/permalink.php?story_fbid=1019&id=100',
'message': '#me', 'full_picture': 'https://scontent.xx.fbcdn.net/1_n.jpg',
'picture': 'https://scontent.xx.fbcdn.net/1_n.jpg',
'link': 'https://www.facebook.com/photo.php?fbid=101933566935469'
}
with patch('channel_facebook.channel.FacebookChannel._getFeeds') as mock_get_feeds, \
patch('core.core.Core.handle_trigger') as mock_handle_trigger:
trigger_type = TriggerType.new_photo_with_hashtag
mock_get_feeds.return_value = get_data
self.channel.fire_trigger(self.webhook_data)
mock_get_feeds.assert_called_once_with(fields=self.fields,
user=self.facebook_account,
time=self.time)
mock_handle_trigger.assert_called_with(channel_name=self.channel_name,
trigger_type=trigger_type,
userid=self.facebook_account.user_id,
payload=payload)
def test_fire_trigger_link(self):
get_data = [{
'link': 'http://daisychain.me/',
'id': '101915710270588_102045486924277',
'message': 'testmessage',
'created_time': '2016-09-14T14:45:28+0000',
'permalink_url': 'https://www.facebook.com/permalink.php?story_fbid=102',
'type': 'link'
}]
payload = {
'permalink_url': 'https://www.facebook.com/permalink.php?story_fbid=102',
'link': 'http://daisychain.me/',
'message': 'testmessage'
}
with patch('channel_facebook.channel.FacebookChannel._getFeeds') as mock_get_feeds, \
patch('core.core.Core.handle_trigger') as mock_handle_trigger:
trigger_type = TriggerType.new_link
mock_get_feeds.return_value = get_data
self.channel.fire_trigger(self.webhook_data)
mock_get_feeds.assert_called_once_with(fields=self.fields,
user=self.facebook_account,
time=self.time)
mock_handle_trigger.assert_called_once_with(channel_name=self.channel_name,
trigger_type=trigger_type,
userid=self.facebook_account.user_id,
payload=payload)
def test_fire_trigger_video(self):
get_data = [{
'link': 'https://www.facebook.com/101915710270588/videos/102056993589793',
'id': '101915710270588_102057203589772',
'message': 'Video',
'created_time': '2016-09-14T14:48:18+0000',
'permalink_url': 'https://www.facebook.com/permalink.php',
'type': 'video',
'picture': 'https://scontent.xx.fbcdn.net/v/t15.0-10/s130x130/14356708_n.jpg?',
'full_picture': 'https://scontent.xx.fbcdn.net/v/t15.0-10/s720x720/1435_n.jpg'
}]
payload = {'message': 'Video',
'link': 'https://www.facebook.com/101915710270588/videos/102056993589793',
'full_picture': 'https://scontent.xx.fbcdn.net/v/t15.0-10/s720x720/1435_n.jpg',
'permalink_url': 'https://www.facebook.com/permalink.php',
'picture': 'https://scontent.xx.fbcdn.net/v/t15.0-10/s130x130/14356708_n.jpg?'}
with patch('channel_facebook.channel.FacebookChannel._getFeeds') as mock_get_feeds, \
patch('core.core.Core.handle_trigger') as mock_handle_trigger:
trigger_type = TriggerType.new_video
mock_get_feeds.return_value = get_data
self.channel.fire_trigger(self.webhook_data)
mock_get_feeds.assert_called_once_with(fields=self.fields,
user=self.facebook_account,
time=self.time)
mock_handle_trigger.assert_called_once_with(channel_name=self.channel_name,
trigger_type=trigger_type,
userid=self.facebook_account.user_id,
payload=payload)
def test_fire_trigger_invalid(self):
invalid_webhook_data = {
"time": self.time,
"id": "101915710270588",
"changed_fields": ["feed"],
"uid": "101915710270588"
}
with self.assertRaises(NotSupportedTrigger):
self.channel.fire_trigger(invalid_webhook_data)
@patch('channel_facebook.channel.FacebookChannel._getFeeds')
def test_fire_trigger_with_invalid_user(self, mock_getFeeds):
invalid_webhook_data = {
"time": self.time,
"id": "101915710270588",
"changed_fields": ["statuses"],
"uid": "invaliduser2"
}
self.channel.fire_trigger(invalid_webhook_data)
mock_getFeeds.assert_not_called()
def test_fire_trigger_with_invalid_channel_object(self):
get_data = [{
'message': 'Testmessage',
'permalink_url': 'https://www.facebook.com/permalink.php?story_fbid=1234',
'created_time': '2016-09-14T14:27:06+0000',
'id': '101915710270588_102025766926249',
'type': 'status'
}]
payload = {
'permalink_url': 'https://www.facebook.com/permalink.php?story_fbid=1234',
'message': 'Testmessage'
}
with patch('channel_facebook.channel.FacebookChannel._getFeeds') as mock_get_feeds, \
patch('core.models.Channel.objects.get') as mock_get_Channel, \
patch('core.core.Core.handle_trigger') as mock_handle_trigger:
mock_get_feeds.return_value = get_data
mock_get_Channel.side_effect = Channel.DoesNotExist
self.channel.fire_trigger(self.webhook_data)
mock_get_feeds.assert_called_once()
mock_handle_trigger.assert_not_called()
def test_fill_recipe_mappings_with_valid_trigger(self):
payload = {
'message': 'testmessage #me',
'link': 'https://www.facebook.com/photo.php?fbid=101933566935469',
'permalink_url': 'https://www.facebook.com/permalink.php?story_fbid=1019&id=100',
'full_picture': 'https://scontent.xx.fbcdn.net/1_n.jpg',
'picture': 'https://scontent.xx.fbcdn.net/1_n.jpg'
}
conditions = {'hashtag': '#me'}
with patch('channel_facebook.channel.FacebookChannel._fill_mappings_for_new_entry') as mock_replace_mappings:
self.channel.fill_recipe_mappings(trigger_type=TriggerType.new_photo,
userid=self.user.id,
payload=payload,
conditions=self.conditions,
mappings={})
mock_replace_mappings.assert_called_once_with(inputs={},
payload=payload)
with patch(
'channel_facebook.channel.FacebookChannel._fill_mappings_for_new_entry_with_hashtags') as mock_replace_mappings:
self.channel.fill_recipe_mappings(trigger_type=TriggerType.new_photo_with_hashtag,
userid=self.user.id,
payload=payload,
conditions=self.conditions,
mappings={})
mock_replace_mappings.assert_called_once_with(inputs={},
payload=payload,
conditions=conditions)
def test_get_trigger_types_with_notSupportedTrigger(self):
data = {'type': 'notSupported'}
with self.assertRaises(NotSupportedTrigger):
self.channel._get_trigger_types(data)
@patch('channel_facebook.channel.FacebookChannel._fill_mappings_for_new_entry')
def test_fill_recipe_mappings_with_ínvalid_trigger(self,
mock_replace_mappings):
payload = {
'message': 'testmessage',
'link': 'https://www.facebook.com/photo.php?fbid=101933566935469',
'permalink_url': 'https://www.facebook.com/permalink.php?story_fbid=1019&id=100',
'full_picture': 'https://scontent.xx.fbcdn.net/1_n.jpg',
'picture': 'https://scontent.xx.fbcdn.net/1_n.jpg'
}
self.channel.fill_recipe_mappings(trigger_type=-42,
userid=self.user.id,
payload=payload,
conditions=self.conditions,
mappings={})
self.assertTrue(mock_replace_mappings.called)
@patch('channel_facebook.channel.FacebookChannel._fill_mappings_for_new_entry')
def test_fill_mappings_for_new_entry_with_hashtags_without_hashtag(self,
mock_replace_mappings):
payload = {
'message': 'testmessage',
'link': 'https://www.facebook.com/photo.php?fbid=101933566935469',
'permalink_url': 'https://www.facebook.com/permalink.php?story_fbid=1019&id=100',
'full_picture': 'https://scontent.xx.fbcdn.net/1_n.jpg',
'picture': 'https://scontent.xx.fbcdn.net/1_n.jpg'
}
with self.assertRaises(ConditionNotMet):
self.channel.fill_recipe_mappings(trigger_type=TriggerType.new_photo_with_hashtag,
userid=self.user.id,
payload=payload,
conditions={},
mappings={})
self.assertFalse(mock_replace_mappings.called)
@patch('channel_facebook.channel.FacebookChannel._fill_mappings_for_new_entry')
def test_fill_mappings_for_new_entry_with_hashtags_not_matching_hashtag(self,
mock_replace_mappings):
payload = {
'message': 'testmessage #falseHashtag',
'link': 'https://www.facebook.com/photo.php?fbid=101933566935469',
'permalink_url': 'https://www.facebook.com/permalink.php?story_fbid=1019&id=100',
'full_picture': 'https://scontent.xx.fbcdn.net/1_n.jpg',
'picture': 'https://scontent.xx.fbcdn.net/1_n.jpg'
}
with self.assertRaises(ConditionNotMet):
self.channel.fill_recipe_mappings(trigger_type=TriggerType.new_photo_with_hashtag,
userid=self.user.id,
payload=payload,
conditions=self.conditions,
mappings={})
self.assertFalse(mock_replace_mappings.called)
@patch('channel_facebook.channel.FacebookChannel._fill_mappings_for_new_entry')
def test_fill_mappings_for_new_entry_with_hashtags_without_hash(self,
mock_replace_mappings):
payload = {
'message': 'testmessage #me',
'link': 'https://www.facebook.com/photo.php?fbid=101933566935469',
'permalink_url': 'https://www.facebook.com/permalink.php?story_fbid=1019&id=100',
'full_picture': 'https://scontent.xx.fbcdn.net/1_n.jpg',
'picture': 'https://scontent.xx.fbcdn.net/1_n.jpg'
}
conditions = {'hashtag': 'me'}
self.channel.fill_recipe_mappings(trigger_type=TriggerType.new_photo_with_hashtag,
userid=self.user.id,
payload=payload,
conditions=conditions,
mappings={})
mock_replace_mappings.assert_called_once()
def test_replace_mappings(self):
def mock_downloadfile(input):
return input
payload = {
'message': 'testmessage',
'description': 'a test description',
'link': 'https://www.facebook.com/photo.php?fbid=101933566935469',
'permalink_url': 'https://www.facebook.com/',
'full_picture': 'https://scontent.xx.fbcdn.net/1_n.jpg',
'picture': 'https://scontent.xx.fbcdn.net/1_n.jpg',
'video': 'https://scontent.xx.fbcdn.net/1_n.mp4',
}
mappings = {
'input1': 'you wrote: %message%',
'input2': 'New Post: %permalink_url%',
'input3': 'A link: %link%',
'input4': 'A Men wrote: %description%',
'input5': 'a picture in small: %image_low%',
'input6': 'a large picture: %image_standard%',
'input7': 'a video: %video%',
}
with patch('core.utils.download_file') as mock_download:
mock_download.side_effect = mock_downloadfile
res = self.channel._fill_mappings_for_new_entry(inputs=mappings,
payload=payload)
expected = {
'input1': 'you wrote: ' + payload['message'],
'input2': 'New Post: ' + payload['permalink_url'],
'input3': 'A link: ' + payload['link'],
'input4': 'A Men wrote: ' + payload['description'],
'input5': payload['picture'],
'input6': payload['full_picture'],
'input7': payload['video'],
}
self.assertEquals(res, expected)
res = self.channel._fill_mappings_for_new_entry(inputs=mappings,
payload={})
self.assertEquals(res, mappings)
def test_trigger_synopsis(self):
conditions = [{'value': '#Daisychain'}]
for trigger in TriggerType:
trigger_id = Trigger.objects.get(trigger_type=trigger,
channel_id=self.channel_id).id
if trigger == TriggerType.new_post:
return_value = "new post by you on Facebook"
elif trigger == TriggerType.new_link:
return_value = "new link posted by you on Facebook"
elif trigger == TriggerType.new_photo:
return_value = "new photo posted by you on Facebook"
elif trigger == TriggerType.new_photo_with_hashtag:
return_value = 'new photo by you with hashtag "{}" ' \
'on Facebook'.format(conditions[0]['value'])
elif trigger == TriggerType.new_video:
return_value = "new video posted by you on Facebook"
self.assertEqual(self.channel.trigger_synopsis(
trigger_id, conditions=conditions
), return_value)
def test_get_payload(self):
feed = {
'description': 'blablabla',
'message': 'blablub',
'picture': 'nakedwoman',
'full_picture': 'largepicture',
'permalink_url': 'http://daisychain.me/secret',
'link': 'http://daisychain.me/s3cr3t',
'source': 'linktovideo',
}
response = self.channel._get_payload(feed)
feed['video'] = feed.pop('source')
self.assertDictEqual(response, feed)
@patch("channel_facebook.channel.Config.get")
@patch("channel_facebook.channel.reverse")
@patch("channel_facebook.channel.log.warning")
def test_build_absolute_uri(self, mock_log, mock_reverse, mock_get):
# first test without having set DOMAIN_BASE before
mock_get.return_value = ""
mock_reverse.return_value = "/test_alias"
actual = self.channel._build_absolute_uri("test_alias")
mock_get.assert_called_with("DOMAIN_BASE")
mock_log.assert_called_with("Facebook Config DOMAIN_BASE "
"was accessed before set")
mock_reverse.assert_called_with("test_alias")
self.assertEqual("/test_alias", actual)
# reset mocks
mock_log.reset_mock()
mock_reverse.reset_mock()
mock_get.reset_mock()
# second test with having set DOMAIN_BASE before
mock_get.return_value = "http://test.domain:1234"
actual = self.channel._build_absolute_uri("test_alias")
mock_get.assert_called_with("DOMAIN_BASE")
mock_log.assert_not_called()
mock_reverse.assert_called_with("test_alias")
self.assertEqual("http://test.domain:1234/test_alias", actual)
| {
"content_hash": "894d699c40a0c6c81d88a65f48328efe",
"timestamp": "",
"source": "github",
"line_count": 426,
"max_line_length": 128,
"avg_line_length": 50.04929577464789,
"alnum_prop": 0.5289151540734487,
"repo_name": "daisychainme/daisychain",
"id": "876126f198a057bc9aa5631aea9de915e88942bd",
"size": "21322",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "daisychain/channel_facebook/tests/test_channel_trigger.py",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "33038"
},
{
"name": "HTML",
"bytes": "69989"
},
{
"name": "JavaScript",
"bytes": "22115"
},
{
"name": "Makefile",
"bytes": "995"
},
{
"name": "Python",
"bytes": "610321"
}
],
"symlink_target": ""
} |
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.badlogicgames.gdx</groupId>
<artifactId>gdx-parent</artifactId>
<version>1.4.2-SNAPSHOT</version>
<relativePath>../../../../</relativePath>
</parent>
<artifactId>gdx-bullet-platform</artifactId>
<packaging>jar</packaging>
<name>libGDX Bullet Native Libraries</name>
<properties>
<base.url>http://libgdx.badlogicgames.com/nightlies/dist/extensions/gdx-bullet/</base.url>
</properties>
<dependencies>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>gdx-bullet</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies>
<build>
<sourceDirectory>src</sourceDirectory>
<plugins>
<!-- first download an unpack the native libraries -->
<plugin>
<groupId>com.googlecode.maven-download-plugin</groupId>
<artifactId>maven-download-plugin</artifactId>
<version>1.1.0</version>
<executions>
<execution>
<id>desktop</id>
<phase>process-resources</phase>
<goals><goal>wget</goal></goals>
<configuration>
<cacheDirectory>${project.build.directory}/download-cache</cacheDirectory>
<url>${base.url}/gdx-bullet-natives.jar</url>
<unpack>true</unpack>
<outputDirectory>${project.build.directory}/desktop</outputDirectory>
</configuration>
</execution>
<execution>
<id>x86-gdx</id>
<phase>process-resources</phase>
<goals><goal>wget</goal></goals>
<configuration>
<cacheDirectory>${project.build.directory}/download-cache/x86</cacheDirectory>
<url>${base.url}/x86/libgdx-bullet.so</url>
<outputDirectory>${project.build.directory}/x86</outputDirectory>
</configuration>
</execution>
<execution>
<id>armeabi-gdx</id>
<phase>process-resources</phase>
<goals><goal>wget</goal></goals>
<configuration>
<cacheDirectory>${project.build.directory}/download-cache/armeabi</cacheDirectory>
<url>${base.url}/armeabi/libgdx-bullet.so</url>
<outputDirectory>${project.build.directory}/armeabi</outputDirectory>
</configuration>
</execution>
<execution>
<id>armeabi-v7a-gdx</id>
<phase>process-resources</phase>
<goals><goal>wget</goal></goals>
<configuration>
<cacheDirectory>${project.build.directory}/download-cache/armeabi-v7a</cacheDirectory>
<url>${base.url}/armeabi-v7a/libgdx-bullet.so</url>
<outputDirectory>${project.build.directory}/armeabi-v7a</outputDirectory>
</configuration>
</execution>
<execution>
<id>ios-gdx</id>
<phase>process-resources</phase>
<goals><goal>wget</goal></goals>
<configuration>
<cacheDirectory>${project.build.directory}/download-cache/ios</cacheDirectory>
<url>${base.url}/ios/libgdx-bullet.a</url>
<outputDirectory>${project.build.directory}/ios</outputDirectory>
</configuration>
</execution>
</executions>
</plugin>
<!-- if we have pre-built versions, replace the downloaded versions with those -->
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<version>2.6</version>
<executions>
<execution>
<id>copy-local-desktop</id>
<phase>prepare-package</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<resources>
<resource><directory>${basedir}/../../libs/linux32</directory></resource>
<resource><directory>${basedir}/../../libs/linux64</directory></resource>
<resource><directory>${basedir}/../../libs/macosx32</directory></resource>
<resource><directory>${basedir}/../../libs/macosx64</directory></resource>
<resource><directory>${basedir}/../../libs/windows32</directory></resource>
<resource><directory>${basedir}/../../libs/windows64</directory></resource>
</resources>
<outputDirectory>${basedir}/target/desktop</outputDirectory>
<overwrite>true</overwrite>
</configuration>
</execution>
<execution>
<id>copy-local-x86</id>
<phase>prepare-package</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<resources>
<resource><directory>${basedir}/../../libs/x86</directory></resource>
</resources>
<outputDirectory>${basedir}/target/x86</outputDirectory>
<overwrite>true</overwrite>
</configuration>
</execution>
<execution>
<id>copy-local-armeabi</id>
<phase>prepare-package</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<resources>
<resource><directory>${basedir}/../../libs/armeabi</directory></resource>
</resources>
<outputDirectory>${basedir}/target/armeabi</outputDirectory>
<overwrite>true</overwrite>
</configuration>
</execution>
<execution>
<id>copy-local-armeabi-v7a</id>
<phase>prepare-package</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<resources>
<resource><directory>${basedir}/../../libs/armeabi-v7a</directory></resource>
</resources>
<outputDirectory>${basedir}/target/armeabi-v7a</outputDirectory>
<overwrite>true</overwrite>
</configuration>
</execution>
<execution>
<id>copy-local-ios</id>
<phase>prepare-package</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<resources>
<resource><directory>${basedir}/../../libs/ios32</directory></resource>
</resources>
<outputDirectory>${basedir}/target/ios</outputDirectory>
<overwrite>true</overwrite>
</configuration>
</execution>
</executions>
</plugin>
<!-- finally package everything up into jar files -->
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<version>2.4</version>
<configuration>
<descriptors>
<descriptor>desktop.xml</descriptor>
<descriptor>x86.xml</descriptor>
<descriptor>armeabi.xml</descriptor>
<descriptor>armeabi-v7a.xml</descriptor>
<descriptor>ios.xml</descriptor>
</descriptors>
</configuration>
<executions>
<execution>
<id>make-assembly</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project> | {
"content_hash": "60dc957af14ccdfb2f05daab9f731750",
"timestamp": "",
"source": "github",
"line_count": 203,
"max_line_length": 201,
"avg_line_length": 48.477832512315274,
"alnum_prop": 0.43603292348338585,
"repo_name": "sinistersnare/libgdx",
"id": "688cd50de76658ef471f39a1f86dd07de6984b02",
"size": "9841",
"binary": false,
"copies": "4",
"ref": "refs/heads/master",
"path": "extensions/gdx-bullet/jni/maven/pom.xml",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Awk",
"bytes": "3965"
},
{
"name": "C",
"bytes": "8966494"
},
{
"name": "C++",
"bytes": "8960448"
},
{
"name": "CSS",
"bytes": "60986"
},
{
"name": "Groovy",
"bytes": "8687"
},
{
"name": "Java",
"bytes": "11955489"
},
{
"name": "JavaScript",
"bytes": "48"
},
{
"name": "Lua",
"bytes": "821"
},
{
"name": "Objective-C",
"bytes": "85527"
},
{
"name": "Objective-C++",
"bytes": "58296"
},
{
"name": "OpenEdge ABL",
"bytes": "8348"
},
{
"name": "Python",
"bytes": "172284"
},
{
"name": "Ragel in Ruby Host",
"bytes": "28239"
},
{
"name": "Shell",
"bytes": "288985"
}
],
"symlink_target": ""
} |
import json
import os
import sys
root_dir = sys.argv[1]
answer_path = sys.argv[2]
file_names = os.listdir(root_dir)
num_correct = 0
num_wrong = 0
with open(answer_path, 'r') as fh:
id2answer_dict = json.load(fh)
for file_name in file_names:
if not file_name.endswith(".question"):
continue
with open(os.path.join(root_dir, file_name), 'r') as fh:
url = fh.readline().strip()
_ = fh.readline()
para = fh.readline().strip()
_ = fh.readline()
ques = fh.readline().strip()
_ = fh.readline()
answer = fh.readline().strip()
_ = fh.readline()
if file_name in id2answer_dict:
pred = id2answer_dict[file_name]
if pred == answer:
num_correct += 1
else:
num_wrong += 1
else:
num_wrong += 1
total = num_correct + num_wrong
acc = float(num_correct) / total
print("{} = {} / {}".format(acc, num_correct, total)) | {
"content_hash": "20f3a764bd97ee2edb10b858db6956e1",
"timestamp": "",
"source": "github",
"line_count": 38,
"max_line_length": 60,
"avg_line_length": 25.842105263157894,
"alnum_prop": 0.5488798370672098,
"repo_name": "allenai/bi-att-flow",
"id": "33d99363ec31ba8ac7a79a4d4a4c1f4b4bf1530e",
"size": "982",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "cnn_dm/evaluate.py",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "HTML",
"bytes": "7398"
},
{
"name": "Jupyter Notebook",
"bytes": "84356"
},
{
"name": "Python",
"bytes": "285931"
},
{
"name": "Shell",
"bytes": "2428"
}
],
"symlink_target": ""
} |
package ecse414.fall2015.group21.game.util;
/**
* Represents a thread that runs at a specific TPS until terminated.
* <p>
* This is a library file from com.flowpowered.commons.ticking
*/
public class TPSLimitedThread extends Thread {
private final TickingElement element;
private final Timer timer;
private volatile boolean running = false;
public TPSLimitedThread(String name, TickingElement element, int tps) {
super(name);
this.element = element;
timer = new Timer(tps);
}
@Override
public void run() {
try {
running = true;
element.onStart();
timer.start();
long lastTime = getTime() - (long) (1f / timer.getTps() * 1000000000), currentTime;
while (running) {
try {
element.onTick((currentTime = getTime()) - lastTime);
lastTime = currentTime;
timer.sync();
} catch (Exception ex) {
System.err.println("Exception in ticking thread, attempting to stop normally");
ex.printStackTrace();
break;
}
}
element.onStop();
} catch (Exception ex) {
System.err.println("Exception in ticking thread");
ex.printStackTrace();
}
}
public void terminate() {
running = false;
}
public boolean isRunning() {
return running;
}
private static long getTime() {
return System.nanoTime();
}
} | {
"content_hash": "6f2bd40b01575ce3e9773ddbb4602537",
"timestamp": "",
"source": "github",
"line_count": 56,
"max_line_length": 99,
"avg_line_length": 28.357142857142858,
"alnum_prop": 0.5472292191435768,
"repo_name": "DDoS/OnlineGame",
"id": "da97ca199f10a704276039d4d02ac4333365636c",
"size": "2783",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/main/java/ecse414/fall2015/group21/game/util/TPSLimitedThread.java",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "GLSL",
"bytes": "387"
},
{
"name": "Java",
"bytes": "226316"
}
],
"symlink_target": ""
} |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!--NewPage-->
<HTML>
<HEAD>
<!-- Generated by javadoc (build 1.6.0_0) on Wed Jul 21 15:54:31 PDT 2010 -->
<TITLE>
com.google.template.soy.javasrc.codedeps (Soy Complete)
</TITLE>
<META NAME="date" CONTENT="2010-07-21">
<LINK REL ="stylesheet" TYPE="text/css" HREF="../../../../../../stylesheet.css" TITLE="Style">
<SCRIPT type="text/javascript">
function windowTitle()
{
if (location.href.indexOf('is-external=true') == -1) {
parent.document.title="com.google.template.soy.javasrc.codedeps (Soy Complete)";
}
}
</SCRIPT>
<NOSCRIPT>
</NOSCRIPT>
</HEAD>
<BODY BGCOLOR="white" onload="windowTitle();">
<HR>
<!-- ========= START OF TOP NAVBAR ======= -->
<A NAME="navbar_top"><!-- --></A>
<A HREF="#skip-navbar_top" title="Skip navigation links"></A>
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
<TR>
<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
<A NAME="navbar_top_firstrow"><!-- --></A>
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
<TR ALIGN="center" VALIGN="top">
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD>
<TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Package</B></FONT> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <FONT CLASS="NavBarFont1">Class</FONT> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD>
</TR>
</TABLE>
</TD>
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
</EM>
</TD>
</TR>
<TR>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../../../../../com/google/template/soy/javasrc/package-summary.html"><B>PREV PACKAGE</B></A>
<A HREF="../../../../../../com/google/template/soy/javasrc/internal/package-summary.html"><B>NEXT PACKAGE</B></A></FONT></TD>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../../../../../index.html?com/google/template/soy/javasrc/codedeps/package-summary.html" target="_top"><B>FRAMES</B></A>
<A HREF="package-summary.html" target="_top"><B>NO FRAMES</B></A>
<SCRIPT type="text/javascript">
<!--
if(window==top) {
document.writeln('<A HREF="../../../../../../allclasses-noframe.html"><B>All Classes</B></A>');
}
//-->
</SCRIPT>
<NOSCRIPT>
<A HREF="../../../../../../allclasses-noframe.html"><B>All Classes</B></A>
</NOSCRIPT>
</FONT></TD>
</TR>
</TABLE>
<A NAME="skip-navbar_top"></A>
<!-- ========= END OF TOP NAVBAR ========= -->
<HR>
<H2>
Package com.google.template.soy.javasrc.codedeps
</H2>
Runtime utilities required for code generated by the Java Source backend.
<P>
<B>See:</B>
<BR>
<A HREF="#package_description"><B>Description</B></A>
<P>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
<B>Class Summary</B></FONT></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD WIDTH="15%"><B><A HREF="../../../../../../com/google/template/soy/javasrc/codedeps/SoyUtils.html" title="class in com.google.template.soy.javasrc.codedeps">SoyUtils</A></B></TD>
<TD>Library of utilities needed by the generated code.</TD>
</TR>
</TABLE>
<P>
<A NAME="package_description"><!-- --></A><H2>
Package com.google.template.soy.javasrc.codedeps Description
</H2>
<P>
Runtime utilities required for code generated by the Java Source backend.
<P>
<P>
<DL>
</DL>
<HR>
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<A NAME="navbar_bottom"><!-- --></A>
<A HREF="#skip-navbar_bottom" title="Skip navigation links"></A>
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
<TR>
<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
<A NAME="navbar_bottom_firstrow"><!-- --></A>
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
<TR ALIGN="center" VALIGN="top">
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD>
<TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Package</B></FONT> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <FONT CLASS="NavBarFont1">Class</FONT> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD>
</TR>
</TABLE>
</TD>
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
</EM>
</TD>
</TR>
<TR>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../../../../../com/google/template/soy/javasrc/package-summary.html"><B>PREV PACKAGE</B></A>
<A HREF="../../../../../../com/google/template/soy/javasrc/internal/package-summary.html"><B>NEXT PACKAGE</B></A></FONT></TD>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../../../../../index.html?com/google/template/soy/javasrc/codedeps/package-summary.html" target="_top"><B>FRAMES</B></A>
<A HREF="package-summary.html" target="_top"><B>NO FRAMES</B></A>
<SCRIPT type="text/javascript">
<!--
if(window==top) {
document.writeln('<A HREF="../../../../../../allclasses-noframe.html"><B>All Classes</B></A>');
}
//-->
</SCRIPT>
<NOSCRIPT>
<A HREF="../../../../../../allclasses-noframe.html"><B>All Classes</B></A>
</NOSCRIPT>
</FONT></TD>
</TR>
</TABLE>
<A NAME="skip-navbar_bottom"></A>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
<HR>
<div id="footer">
<div id="footerlogo" style="float:left">
<img src="http://www.google.com/images/art.gif"
alt="Google colored balls">
</div>
<div id="copyright" style="float:left">
<p>
© 2009 Google -
<a href="http://www.google.com/privacy.html">Privacy Policy</a> -
<a href="http://www.google.com/terms_of_service.html">Terms and Conditions</a> -
<a href="http://www.google.com/about.html">About Google</a>
</p>
</div>
</div>
</BODY>
</HTML>
| {
"content_hash": "cd3f5249a4c86a179706bbc0a42bebab",
"timestamp": "",
"source": "github",
"line_count": 187,
"max_line_length": 181,
"avg_line_length": 39.42245989304813,
"alnum_prop": 0.6022788931090614,
"repo_name": "prop/closure-templates",
"id": "8a63c723a091d900502ab7011eb41412431bc58a",
"size": "7372",
"binary": false,
"copies": "3",
"ref": "refs/heads/master",
"path": "javadoc-complete/com/google/template/soy/javasrc/codedeps/package-summary.html",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Java",
"bytes": "1220172"
},
{
"name": "JavaScript",
"bytes": "79881"
}
],
"symlink_target": ""
} |
@interface GJGCChatFriendTalkModel : NSObject
@property (nonatomic,copy)NSString *toId;
@property (nonatomic,copy)NSString *toUserName;
@property (nonatomic,assign)GJGCChatFriendTalkType talkType;
@property (nonatomic,strong)NSArray *msgArray;
@property (nonatomic,assign)NSInteger msgCount;
@property (nonatomic,strong)EMConversation *conversation;
@property (nonatomic,strong)GJGCMessageExtendGroupModel *groupInfo;
+ (NSString *)talkTypeString:(GJGCChatFriendTalkType)talkType;
@end
| {
"content_hash": "4c2dbd197c1d9ec986e3396a7a9068e7",
"timestamp": "",
"source": "github",
"line_count": 19,
"max_line_length": 67,
"avg_line_length": 26.05263157894737,
"alnum_prop": 0.8202020202020202,
"repo_name": "zyprosoft/ZYChat",
"id": "76a864eb75aa300cdb43f250f570a7c6bad85117",
"size": "855",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "ZYChat-EaseMob/ZYChat/ChatDetail/ViewController/Base/GJGCChatFriendTalkModel.h",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C",
"bytes": "11648"
},
{
"name": "C++",
"bytes": "1206"
},
{
"name": "Objective-C",
"bytes": "3654892"
},
{
"name": "Objective-C++",
"bytes": "15908"
},
{
"name": "Ruby",
"bytes": "467"
}
],
"symlink_target": ""
} |
import cStringIO
import logging
logger = logging.getLogger(__name__)
# import volatility.plugins.gui.messagehooks as messagehooks
LOPHI_TIMEOUT = 100
LOPHI_RETRIES = 5
pil_installed = True
try:
from PIL import Image, ImageDraw
except ImportError:
pil_installed = False
class VolatilityWrapper:
def __init__(self, uri, profile, memory_size):
"""
Initialize volatility with all of our parameters
@param uri: URI to read from (e.g. lophi://, file://, vmi://)
@param profile: Volatility profile (e.g. WinXPSP3x86)
@param memory_size: Memory size in bytes
"""
logger.debug("Initializg volatility: uri: %s, profile: %s, mem: %s"%(
uri,
profile,
memory_size))
self.MODULE_MAP = {"pslist":self._render_pslist,
"ssdt":self._render_ssdt,
"windows":self._render_windows,
"screenshot":self._render_screenshot}
self.uri = uri
self.profile = profile
self.memory_size = memory_size
# Import all of our Volatility classes
import volatility.registry as MemoryRegistry # @UnresolvedImport
import volatility.utils as utils # @UnresolvedImport
import volatility.cache as cache # @UnresolvedImport
import volatility.debug as debug # @UnresolvedImport
import volatility.addrspace as addrspace # @UnresolvedImport
import volatility.commands as commands # @UnresolvedImport
self.MemoryRegistry = MemoryRegistry
self.utils = utils
self.commands = commands
self.addrspace = addrspace
# Hack to disable caching
# cache.disable_caching(0, 0, 0, 0)
# Initialize Volatility
self.volatility_config = None
self.init_ok = self._init_volatility_config()
# Did everything init ok?
if self.init_ok == False:
#logger.error("Could not start memory analysis for %s."%self.machine.name)
logger.error("Could not start memory analysis for uri %s."%self.uri)
return
# Import our plugins module
self.PLUGIN_COMMANDS = None
try:
logger.debug("Init MemoryRegistry")
# try the older method which had an init function
self.MemoryRegistry.Init()
self.PLUGIN_COMMANDS = self.MemoryRegistry.PLUGIN_COMMANDS
except:
logger.debug("Plugin Importer MemoryRegistry (version 2.2+)")
self.MemoryRegistry.PluginImporter()
self.MemoryRegistry.register_global_options(self.volatility_config, self.addrspace.BaseAddressSpace)
self.MemoryRegistry.register_global_options(self.volatility_config, self.commands.Command)
self.PLUGIN_COMMANDS = self.MemoryRegistry.get_plugin_classes(self.commands.Command, lower=True)
self.command_objs = {}
self.addr_space = None
def _init_volatility_config(self):
"""
Creates a new Volatility ConfObject with its own storage
"""
import volatility.conf as conf # @UnresolvedImport
if not self.volatility_config:
config = conf.ConfObject()
# Set all of our static settings
config.update('DONOTLOADADDRSPACE', True)
config.update('LOCATION', self.uri)
config.update('DTB', None)
config.update('KDBG', None)
config.update('NO_CACHE', True) # IMPORTANT: No Cache!
# config.update("OUTPUT", OUTPUT_TYPE)
config.update("CACHE_DTB", False)
# LOPHI Addrspace stuff
config.update("RAM_SIZE", self.memory_size)
# config.update('RETRIES', LOPHI_RETRIES)
# config.update('TIMEOUT', LOPHI_TIMEOUT)
# Ensure our profile is valid and assign it
if self._is_valid_profile(self.profile):
config.update('PROFILE', self.profile)
else:
logger.error("Unrecognized Profile (%s)." % self.profile)
return False
self.volatility_config = config
self.config = property(self.volatility_config)
return True
def _is_valid_profile(self, profile_name):
"""
Just a nice simple function to check if a profile is valid
"""
return True
for p in self.MemoryRegistry.PROFILES.classes:
if p.__name__ == profile_name:
return True
return False
def execute_plugin(self,plugin_name):
"""
This will execute a volatility plugin, render its output with one of
our render functions, and return that output
@param plugin_name: Name of plugin as you would use on the command line
"""
logger.debug("Executing volatility plugin: %s"%plugin_name)
if plugin_name not in self.PLUGIN_COMMANDS:
logger.error("%s is not a valid plugin for this Volatility installation")
return False
# Initialize every module (No need to recall it everytime)
if plugin_name not in self.command_objs:
command = self.PLUGIN_COMMANDS[plugin_name]
command_obj = command(self.volatility_config)
self.command_objs[plugin_name] = command_obj
# Initialize our address space (Only do this once)
if self.addr_space is None:
self.addr_space = self.utils.load_as(self.volatility_config)
# Enable our cache
self.volatility_config.update('LOPHI_CACHE',True)
# Get our results for this module
command_obj = self.command_objs[plugin_name]
# data = command_obj.calculate()
data = command_obj.calculate(self.addr_space)
# Disable and wipe our cache
self.volatility_config.update('LOPHI_CACHE',False)
# Render out output into the format we want
output = self._render_data(plugin_name, self.addr_space, data)
if output is not None:
# We have to append our output specific info for processing
output['MODULE'] = plugin_name
output['URI'] = self.uri
output['PROFILE'] = self.profile
else:
stringio = cStringIO.StringIO()
command_obj.render_text(stringio, data)
output = stringio.getvalue()
stringio.close()
return output
def _render_data(self,module_name, addr_space, data):
"""
Given volatility plugin output, will attempt to render it into a
format that we have specified
"""
logger.debug("Trying to process data for %s"%module_name)
if module_name in self.MODULE_MAP:
return self.MODULE_MAP[module_name](addr_space,data)
else:
return None
def _render_screenshot(self, addr_space, data):
"""
Render the screenshot data and return a Python Image object
To save the output as images:
data[0].save(header[0]+".png","PNG")
Note: This plug seg faults, which is why we are only returning the
default screen
"""
def draw_text(draw, text, left, top, fill = "Black"):
"""Label windows in the screen shot"""
lines = text.split('\x0d\x0a')
for line in lines:
draw.text( (left, top), line, fill = fill)
_, height = draw.textsize(line)
top += height
if not pil_installed:
logger.error("Must install PIL for this plugin.")
return None
out_header = []
out_data = []
seen = []
found = False
for window_station in data:
if found:
break
for desktop in window_station.desktops():
session_name = "session_{0}.{1}.{2}".format(
desktop.dwSessionId,
window_station.Name, desktop.Name)
offset = desktop.PhysicalAddress
if offset in seen:
continue
seen.append(offset)
# The foreground window
win = desktop.DeskInfo.spwnd
# Some desktops don't have any windows
if not win:
logger.info("{0}\{1}\{2} has no windows (Skipping)".format(
desktop.dwSessionId, window_station.Name, desktop.Name))
continue
im = Image.new("RGB", (win.rcWindow.right + 1, win.rcWindow.bottom + 1), "White")
draw = ImageDraw.Draw(im)
# Traverse windows, visible only
for win, _level in desktop.windows(
win = win,
filter = lambda x : 'WS_VISIBLE' in str(x.style)):
draw.rectangle(win.rcWindow.get_tup(), outline = "Black", fill = "White")
draw.rectangle(win.rcClient.get_tup(), outline = "Black", fill = "White")
## Create labels for the windows
draw_text(draw, str(win.strName or ''), win.rcWindow.left + 2, win.rcWindow.top)
del draw
out_header.append(session_name)
out_data.append(im)
break
# Return our output
if len(out_data) > 0:
return {'HEADER':out_header,'DATA':out_data}
else:
return {'HEADER':[],'DATA':[]}
# Render Abstract method added by Chad Spensky for LO-PHI
def _render_pslist(self, addr_space, data):
offsettype = "(V)"
out_header = ['Offset'+offsettype,'Name', 'Pid', 'PPid', 'Thds', 'Hnds', 'Time']
out_data = []
for task in data:
offset = task.obj_offset
try:
out_data.append(map(str,[
hex(offset),
task.ImageFileName,
task.UniqueProcessId,
task.InheritedFromUniqueProcessId,
task.ActiveThreads,
task.ObjectTable.HandleCount,
task.CreateTime]))
except:
logger.error("Could not convert column to string")
return {'HEADER':out_header,'DATA':out_data}
def _render_windows(self,addr_space,data):
"""
Render the windows module output into a nice dict
"""
def translate_atom(winsta, atom_tables, atom_id):
"""
Translate an atom into an atom name.
@param winsta: a tagWINDOWSTATION in the proper
session space
@param atom_tables: a dictionary with _RTL_ATOM_TABLE
instances as the keys and owning window stations as
the values.
@param index: the index into the atom handle table.
"""
import volatility.plugins.gui.constants as consts
# First check the default atoms
if consts.DEFAULT_ATOMS.has_key(atom_id):
return consts.DEFAULT_ATOMS[atom_id].Name
# A list of tables to search. The session atom tables
# have priority and will be searched first.
table_list = [
table for (table, window_station)
in atom_tables.items() if window_station == None
]
table_list.append(winsta.AtomTable)
## Fixme: the session atom tables are found via physical
## AS pool tag scanning, and there's no good way (afaik)
## to associate the table with its session. Thus if more
## than one session has atoms with the same id but different
## values, then we could possibly select the wrong one.
for table in table_list:
atom = table.find_atom(atom_id)
if atom:
return atom.Name
return None
output_dict = {}
for winsta, atom_tables in data:
for desktop in winsta.desktops():
# Create our hierarchy
if winsta.dwSessionId not in output_dict:
output_dict[winsta.dwSessionId] = {}
if winsta.Name not in output_dict[winsta.dwSessionId]:
output_dict[winsta.dwSessionId][winsta.Name] = {}
if desktop.Name not in output_dict[winsta.dwSessionId][winsta.Name]:
output_dict[winsta.dwSessionId][winsta.Name][desktop.Name] = []
output_dict[winsta.dwSessionId][winsta.Name][desktop.Name]
for wnd, _level in desktop.windows(desktop.DeskInfo.spwnd):
window_dict = {'windowhandle':wnd.head.h,
'windowhandle_addr':wnd.obj_offset,
'name':str(wnd.strName or ''),
'classatom':wnd.ClassAtom,
'class':translate_atom(winsta, atom_tables, wnd.ClassAtom),
'superclassatom':wnd.SuperClassAtom,
'superclass':translate_atom(winsta, atom_tables, wnd.SuperClassAtom),
'pti':wnd.head.pti.v(),
'tid':wnd.Thread.Cid.UniqueThread,
'tid_addr':wnd.Thread.obj_offset,
'ppi':wnd.head.pti.ppi.v(),
'process':wnd.Process.ImageFileName,
'pid':wnd.Process.UniqueProcessId,
'visible':wnd.Visible,
'left':wnd.rcClient.left,
'top':wnd.rcClient.top,
'bottom':wnd.rcClient.bottom,
'right':wnd.rcClient.right,
'style_flags':wnd.style,
'exstyle_flags':wnd.ExStyle,
'windows_proc':wnd.lpfnWndProc
}
# Append this window to our list
output_dict[winsta.dwSessionId][winsta.Name][desktop.Name].append(window_dict)
# Return our out nested dictionaries
return {'DATA':output_dict}
def _render_ssdt(self,addr_space,data):
from bisect import bisect_right
# Volatility
import volatility.obj as obj
def find_module(modlist, mod_addrs, addr):
"""Uses binary search to find what module a given address resides in.
This is much faster than a series of linear checks if you have
to do it many times. Note that modlist and mod_addrs must be sorted
in order of the module base address."""
pos = bisect_right(mod_addrs, addr) - 1
if pos == -1:
return None
mod = modlist[mod_addrs[pos]]
if (addr >= mod.DllBase.v() and
addr < mod.DllBase.v() + mod.SizeOfImage.v()):
return mod
else:
return None
syscalls = addr_space.profile.syscalls
# Print out the entries for each table
out_header = ['SSDT Index','Table','Entry Count','Entry Index','Address', 'Name', 'Owner Module']
out_data = []
for idx, table, n, vm, mods, mod_addrs in data:
if vm.is_valid_address(table):
for i in range(n):
syscall_addr = obj.Object('unsigned long', table + (i * 4), vm).v()
try:
syscall_name = syscalls[idx][i]
except IndexError:
syscall_name = "Unknown"
syscall_mod = find_module(mods, mod_addrs, syscall_addr)
if syscall_mod:
syscall_modname = syscall_mod.BaseDllName
else:
syscall_modname = "UNKNOWN"
out_data.append(map(str,[
idx,
table,
n,
"%06x"%(idx * 0x1000 + i),
"%x"%syscall_addr,
syscall_name,
"{0}".format(syscall_modname)
# "WTF"
]))
else:
out_data.append(map(str[
idx,
table,
n,
0,
0,
0,
0]))
return {'HEADER':out_header,'DATA':out_data}
# outfd.write(" [SSDT not resident at 0x{0:08X} ]\n".format(table))
class ButtonClicker():
"""
This module wraps volatility to click buttons using memory introspection.
"""
# Names of buttons that we don't want to click.
bad_button_names = ['save',
'reject',
'print',
'decline',
'back',
'cancel',
'exit',
'close']
def __init__(self, uri, profile, mem_size, control_sensor):
"""
Initialize our volatility instance fro our machine object.
"""
self._vol = VolatilityWrapper(uri,profile,mem_size)
# Init our previous butonns list
self.buttons_prev = {}
# Store our machine
self.control_sensor = control_sensor
def _is_bad_button(self, name):
"""
Check a button name and see if it is in our list of buttons we
shouldn't click
@param name: String to compare against our list
"""
for b in self.bad_button_names:
if b.lower() in str(name).lower():
return True
return False
def __get_windows(self):
"""
Use our volatility instance to get the list of windows on the machine.
"""
return self._vol.execute_plugin("windows")
def _get_buttons(self):
# Get our list of windows
windows = self.__get_windows()
# Create list to store buttons
buttons = []
# Loop through all windows extracting buttons
for session in windows['DATA']:
session_dict = windows['DATA'][session]
for window_ctx in session_dict:
window_dict = session_dict[window_ctx]
for desktop in window_dict:
desktop_dict = window_dict[desktop]
for window in desktop_dict:
# Ensure it is a Windows button Atom
if window['superclassatom'] == 0xc017 \
or window['classatom'] == 0xc061 \
or window['class'] == "Button" \
or window['superclass'] == "Button":
buttons.append({"name":str(window['name']),
"process":str(window['process']),
"visible":str(window['visible']),
"top":int(window['top']),
"left":int(window['left'])
})
return buttons
def update_buttons(self):
"""
Simply extract the list of current buttons and save them
Meant to be used by calling this, then eventually click_buttons with
new_only = True.
"""
self.buttons_prev = self._get_buttons()
def click_buttons(self, process=None, new_only=False):
"""
Attempt to click all buttons
@param process: If provided will only click buttons assigned to
this proccess name
@param new_only: If true, will only click buttons new since the
last funciton call
"""
buttons = self._get_buttons()
clicked = []
for button in buttons:
# Extract our location to click
(top, left) = (button['top'], button['left'])
btn_o = "[ Button ]"
btn_o += " Name: %s"%button['name']
btn_o += " Process: %s"%button['process']
btn_o += " Visible: %s"%button['visible']
btn_o += " (Top,Left): (%d, %d)"%(top,left)
logger.info(btn_o)
# Are we filtering a specific process?
if process is not None and process != str(button['process']):
logger.info("Button not in process specified, skipping.")
continue
# Are we only clicking new windows
if new_only and button in self.buttons_prev:
# Hack: Just catch the key error if the keys don't exist.
logger.info("Button not new, skipping.")
continue
# Does it match a bad word?
if self._is_bad_button(button['name']):
logger.info("Button has a bad word, skipping.")
continue
# Click it!
self.control_sensor.mouse_click(left,top)
clicked.append(button)
# Save these windows for later
self.buttons_prev = buttons
return clicked
| {
"content_hash": "36c96ab1e6034d5e68951f23127b0b7a",
"timestamp": "",
"source": "github",
"line_count": 604,
"max_line_length": 112,
"avg_line_length": 38.061258278145694,
"alnum_prop": 0.48979946931140983,
"repo_name": "mit-ll/LO-PHI",
"id": "afdcabbb58083c69574f88e6ba69983514440adb",
"size": "22998",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "python-lophi-semanticgap/lophi_semanticgap/memory/volatility_extensions.py",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "C",
"bytes": "58723"
},
{
"name": "Elixir",
"bytes": "18208"
},
{
"name": "Emacs Lisp",
"bytes": "1368"
},
{
"name": "Groff",
"bytes": "1900"
},
{
"name": "M4",
"bytes": "2284"
},
{
"name": "Makefile",
"bytes": "64810"
},
{
"name": "Protocol Buffer",
"bytes": "1803"
},
{
"name": "Python",
"bytes": "1220515"
},
{
"name": "Shell",
"bytes": "23976"
}
],
"symlink_target": ""
} |
<?php
namespace Omnipay\Skrill\Message;
use DateTime;
use Omnipay\Tests\TestCase;
class PaymentRequestTest extends TestCase
{
/**
* @var PaymentRequest
*/
private $request;
public function setUp()
{
parent::setUp();
$this->request = new PaymentRequest($this->getHttpClient(), $this->getHttpRequest());
}
public function testGetData()
{
$expectedData = array(
'email' => '[email protected]',
'language' => 'EN',
'amount' => '12.34',
'currency' => 'EUR',
'details' => array('key' => 'value'),
'recipientDescription' => 'phpunit',
'transactionId' => 'ref',
'returnUrl' => 'http://php.unit/return',
'returnUrlText' => 'return',
'returnUrlTarget' => 3,
'cancelUrl' => 'http://php.unit/cancel',
'cancelUrlTarget' => 3,
'notifyUrl' => 'http://php.unit/status',
'notifyUrl2' => 'http://php.unit/status2',
'newWindowRedirect' => 0,
'hideLogin' => false,
'confirmationNote' => 'confirmation note',
'logoUrl' => 'http://php.unit/logo.png',
'referralId' => 'ref_id',
'extReferralId' => 'ext_ref_id',
'merchantFields' => array('key' => 'value'),
'customerEmail' => '[email protected]',
'customerTitle' => 'Mr',
'customerFirstName' => 'php',
'customerLastName' => 'unit',
'customerBirthday' => new DateTime('2014-01-03'),
'customerAddress1' => 'address1',
'customerAddress2' => 'address2',
'customerPhone' => '987654321',
'customerPostalCode' => 'zip',
'customerCity' => 'city',
'customerState' => 'state',
'customerCountry' => 'XXX',
'amountDescriptions' => array('key' => 'value'),
);
$this->request->initialize($expectedData);
$this->request->setPaymentMethod(PaymentMethod::SKRILL_DIRECT);
$data = $this->request->getData();
$this->assertSame($expectedData['email'], $data['pay_to_email']);
$this->assertSame($expectedData['language'], $data['language']);
$this->assertSame($expectedData['amount'], $data['amount']);
$this->assertSame($expectedData['currency'], $data['currency']);
$this->assertSame('key', $data['detail1_description']);
$this->assertSame('value', $data['detail1_text']);
$this->assertSame($expectedData['recipientDescription'], $data['recipient_description']);
$this->assertSame($expectedData['transactionId'], $data['transaction_id']);
$this->assertSame($expectedData['returnUrl'], $data['return_url']);
$this->assertSame($expectedData['returnUrlText'], $data['return_url_text']);
$this->assertSame($expectedData['returnUrlTarget'], $data['return_url_target']);
$this->assertSame($expectedData['cancelUrl'], $data['cancel_url']);
$this->assertSame($expectedData['cancelUrlTarget'], $data['cancel_url_target']);
$this->assertSame($expectedData['notifyUrl'], $data['status_url']);
$this->assertSame($expectedData['notifyUrl2'], $data['status_url2']);
$this->assertSame($expectedData['newWindowRedirect'], $data['new_window_redirect']);
$this->assertSame(0, $data['hide_login']);
$this->assertSame($expectedData['confirmationNote'], $data['confirmation_note']);
$this->assertSame($expectedData['logoUrl'], $data['logo_url']);
$this->assertSame(1, $data['prepare_only']);
$this->assertSame($expectedData['referralId'], $data['rid']);
$this->assertSame($expectedData['extReferralId'], $data['ext_ref_id']);
$this->assertSame('key', $data['merchant_fields']);
$this->assertSame('value', $data['key']);
$this->assertSame($expectedData['customerEmail'], $data['pay_from_email']);
$this->assertSame($expectedData['customerTitle'], $data['title']);
$this->assertSame($expectedData['customerFirstName'], $data['firstname']);
$this->assertSame($expectedData['customerLastName'], $data['lastname']);
$this->assertSame($expectedData['customerBirthday']->format('dmY'), $data['date_of_birth']);
$this->assertSame($expectedData['customerAddress1'], $data['address']);
$this->assertSame($expectedData['customerAddress2'], $data['address2']);
$this->assertSame($expectedData['customerPhone'], $data['phone_number']);
$this->assertSame($expectedData['customerPostalCode'], $data['postal_code']);
$this->assertSame($expectedData['customerCity'], $data['city']);
$this->assertSame($expectedData['customerState'], $data['state']);
$this->assertSame($expectedData['customerCountry'], $data['country']);
$this->assertSame('key', $data['amount2_description']);
$this->assertSame('value', $data['amount2']);
$this->assertSame(PaymentMethod::SKRILL_DIRECT, $data['payment_methods']);
}
}
| {
"content_hash": "c261b6ec85d38a1eea15c1b05acffd39",
"timestamp": "",
"source": "github",
"line_count": 111,
"max_line_length": 100,
"avg_line_length": 45.927927927927925,
"alnum_prop": 0.5863083562181247,
"repo_name": "nikunj05/omnipay-nttdata",
"id": "ed3d0620c8889a7f863457a128b84cb5ef9254f0",
"size": "5098",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "tests/Omnipay/Skrill/Message/PaymentRequestTest.php",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "PHP",
"bytes": "61035"
}
],
"symlink_target": ""
} |
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Web.Security;
using LWAS.Extensible.Interfaces;
namespace LWAS.Infrastructure.Security
{
public class Authorizer : IAuthorizer
{
private string super_role = string.Empty;
private Dictionary<string, List<string>> roles;
public Authorizer()
{
this.super_role = ConfigurationManager.AppSettings["SUPER_ROLE"];
if (!Roles.Enabled)
{
this.roles = new RoleManager().LoadRoles();
}
}
protected virtual bool UserInRole(string user, string role)
{
bool result;
if (!Roles.Enabled)
{
result = (this.roles.ContainsKey(role) && this.roles[role].Contains(user));
}
else
{
result = Roles.IsUserInRole(user, role);
}
return result;
}
public bool IsAuthorized(string filter)
{
return this.IsAuthorized(filter, User.CurrentUser.Name);
}
public bool IsAuthorized(string filter, string user)
{
bool result;
if (string.IsNullOrEmpty(filter) || (!string.IsNullOrEmpty(this.super_role) && this.UserInRole(user, this.super_role)))
{
result = true;
}
else
{
string[] roles = filter.Split(new char[]
{
'|'
});
string[] array = roles;
for (int i = 0; i < array.Length; i++)
{
string role = array[i];
if (this.UserInRole(user, role))
{
result = true;
return result;
}
}
result = false;
}
return result;
}
public bool HasAccess(string screen)
{
return AccessVerifier.Instance.HasAccess(User.CurrentUser.Name, screen);
}
}
}
| {
"content_hash": "061aac689e22c9e5d7551125dd601629",
"timestamp": "",
"source": "github",
"line_count": 74,
"max_line_length": 122,
"avg_line_length": 22.68918918918919,
"alnum_prop": 0.6116736152471709,
"repo_name": "t1b1c/lwas",
"id": "213c47a18fd3d1e5c63a6f7daebb070d2a12ea2a",
"size": "2293",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "LWAS/Infrastructure/Security/Authorizer.cs",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "C#",
"bytes": "1054016"
}
],
"symlink_target": ""
} |
using Cofoundry.Core.Extendable;
namespace Cofoundry.Core.Tests.Core.Formatters;
public class EmailAddressNormalizerTests
{
private EmailAddressNormalizer _emailAddressNormalizer = new EmailAddressNormalizer();
[Theory]
[InlineData(null)]
[InlineData("")]
[InlineData(" ")]
[InlineData(" @ ")]
[InlineData("@@@")]
[InlineData("@example.com")]
[InlineData("example@")]
public void Normalize_WhenInvalid_ReturnsNull(string email)
{
var result = _emailAddressNormalizer.Normalize(email);
result.Should().BeNull();
}
[Theory]
[InlineData(" [email protected] ")]
[InlineData("[email protected] ")]
[InlineData(" [email protected]")]
public void Normalize_Trims(string email)
{
var result = _emailAddressNormalizer.Normalize(email);
result.Should().Be("[email protected]");
}
[Theory]
[InlineData("[email protected]", "[email protected]")]
[InlineData("[email protected]", "[email protected]")]
[InlineData("[email protected]", "[email protected]")]
[InlineData(" [email protected]", "[email protected]")]
[InlineData(" MÜller@MÜller.example.Com", "MÜller@müller.example.com")]
[InlineData("EXAMPLE@😉.FM", "EXAMPLE@😉.fm")]
[InlineData("μαρια@μαρια.GR", "μαρια@μαρια.gr")]
public void Normalize_LowercasesDomainOnly(string email, string expected)
{
var result = _emailAddressNormalizer.Normalize(email);
result.Should().Be(expected);
}
[Theory]
[InlineData(null)]
[InlineData("")]
[InlineData(" ")]
[InlineData(" @ ")]
[InlineData("@@@")]
[InlineData("@example.com")]
[InlineData("example@")]
public void NormalizeAsParts_WhenInvalid_ReturnsNull(string email)
{
var result = _emailAddressNormalizer.NormalizeAsParts(email);
result.Should().BeNull();
}
[Fact]
public void NormalizeAsParts_CanNormalize()
{
const string FORMATTED_RESULT = "MÜller@müller.example.com";
var result = _emailAddressNormalizer.NormalizeAsParts(" MÜller@müller.example.com ");
using (new AssertionScope())
{
result.Should().NotBeNull();
result.Local.Should().Be("MÜller");
result.Domain.Should().NotBeNull();
result.Domain.Name.Should().Be("müller.example.com");
result.Domain.IdnName.Should().Be("xn--mller-kva.example.com");
result.ToEmailAddress().Should().Be(FORMATTED_RESULT);
result.ToString().Should().Be(FORMATTED_RESULT);
}
}
}
| {
"content_hash": "161f4afa57aef81ccd4fcec992b72434",
"timestamp": "",
"source": "github",
"line_count": 82,
"max_line_length": 93,
"avg_line_length": 31.963414634146343,
"alnum_prop": 0.636779855017169,
"repo_name": "cofoundry-cms/cofoundry",
"id": "114c77d87faebb683f770977eeed1bdd6b8359f2",
"size": "2659",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "test/Cofoundry.Core.Tests/Core/Formatters/EmailAddressNormalizerTests.cs",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C#",
"bytes": "4940398"
},
{
"name": "CSS",
"bytes": "185312"
},
{
"name": "HTML",
"bytes": "348286"
},
{
"name": "JavaScript",
"bytes": "869157"
},
{
"name": "PowerShell",
"bytes": "8549"
},
{
"name": "SCSS",
"bytes": "245339"
},
{
"name": "TSQL",
"bytes": "160288"
}
],
"symlink_target": ""
} |
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:padding="20dp"
android:scrollbars="vertical"
>
<RelativeLayout
android:orientation="vertical"
android:id="@+id/movingDayGraphView"
android:layout_width="match_parent"
android:layout_height="300dp"
android:layout_margin="5dp"
android:background="#fff8e9">
</RelativeLayout>
<LinearLayout android:orientation="vertical"
android:layout_height="0dp"
android:layout_width="fill_parent"
android:layout_margin="30dp"
android:baselineAligned="true"
android:layout_weight="7">
<LinearLayout
android:orientation="horizontal"
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:baselineAligned="true">
<TextView
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:text="오늘"
android:textSize="20sp"
android:layout_weight="2"/>
<TextView
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:textSize="30sp"
android:id="@+id/editHealthDateValue1"
android:layout_weight="2"
android:gravity="right"/>
<TextView
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:text="@string/unit1"
android:textSize="15sp"
android:layout_weight="1"
android:gravity="center_horizontal"
android:textColor="#C0C0C0"/>
</LinearLayout>
<LinearLayout
android:orientation="horizontal"
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:layout_marginRight="10dp"
android:layout_marginTop="2dp">
<TextView
android:layout_height="1dp"
android:layout_width="match_parent"
android:background="#4A7EBB"/>
</LinearLayout>
<LinearLayout
android:orientation="horizontal"
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:baselineAligned="true"
android:layout_marginTop="20dp"
>
<TextView
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:text="오늘"
android:textSize="20sp"
android:layout_weight="2"/>
<TextView
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:textSize="30sp"
android:id="@+id/mDayKcal"
android:layout_weight="2"
android:gravity="right"/>
<TextView
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:text="kcal"
android:textSize="15sp"
android:layout_weight="1"
android:gravity="center_horizontal"
android:textColor="#C0C0C0"/>
</LinearLayout>
<LinearLayout
android:orientation="horizontal"
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:layout_marginRight="10dp"
android:layout_marginTop="2dp">
<TextView
android:layout_height="1dp"
android:layout_width="match_parent"
android:background="#4A7EBB"/>
</LinearLayout>
</LinearLayout>
</LinearLayout>
</ScrollView> | {
"content_hash": "26b872c4ace5b4ca1e6e9187bdd9c0e3",
"timestamp": "",
"source": "github",
"line_count": 137,
"max_line_length": 70,
"avg_line_length": 33.481751824817515,
"alnum_prop": 0.5088293001962066,
"repo_name": "GB-SHOCK/GBANG-SHOCK",
"id": "729173dab908c94c1e4308f5ca7ebcf4f2335b98",
"size": "4595",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "SourceCode/mobile/src/main/res/layout/moving_day_fragment.xml",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "12842"
},
{
"name": "HTML",
"bytes": "1581980"
},
{
"name": "Java",
"bytes": "445478"
},
{
"name": "JavaScript",
"bytes": "827"
}
],
"symlink_target": ""
} |
ALTER TABLE `source` ADD `url` varchar(255) NULL DEFAULT NULL AFTER `description`;
# patch identifier
INSERT INTO meta (species_id, meta_key, meta_value) VALUES (NULL,'patch', 'patch_57_58_d.sql|new column url in source table');
| {
"content_hash": "1342603cf9b4826fdb7c115d1d392071",
"timestamp": "",
"source": "github",
"line_count": 5,
"max_line_length": 126,
"avg_line_length": 46.4,
"alnum_prop": 0.7327586206896551,
"repo_name": "adamsardar/perl-libs-custom",
"id": "553381c978fc8f17635bc32a336df6a9299bbf2f",
"size": "265",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "EnsemblAPI/ensembl-variation/sql/patch_57_58_d.sql",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "C",
"bytes": "23699"
},
{
"name": "C++",
"bytes": "262813"
},
{
"name": "Java",
"bytes": "11912"
},
{
"name": "Perl",
"bytes": "16848036"
},
{
"name": "Prolog",
"bytes": "31116"
},
{
"name": "Shell",
"bytes": "111607"
},
{
"name": "Tcl",
"bytes": "2051"
},
{
"name": "XSLT",
"bytes": "84130"
}
],
"symlink_target": ""
} |
module Spree
class Adjustment < Spree::Base
with_options polymorphic: true do
belongs_to :adjustable, touch: true
belongs_to :source
end
belongs_to :order, class_name: 'Spree::Order', inverse_of: :all_adjustments
validates :adjustable, :order, :label, presence: true
validates :amount, numericality: true
state_machine :state, initial: :open do
event :close do
transition from: :open, to: :closed
end
event :open do
transition from: :closed, to: :open
end
end
after_create :update_adjustable_adjustment_total
after_destroy :update_adjustable_adjustment_total
class_attribute :competing_promos_source_types
self.competing_promos_source_types = ['Spree::PromotionAction']
scope :open, -> { where(state: 'open') }
scope :closed, -> { where(state: 'closed') }
scope :tax, -> { where(source_type: 'Spree::TaxRate') }
scope :non_tax, -> do
source_type = arel_table[:source_type]
where(source_type.not_eq('Spree::TaxRate').or(source_type.eq(nil)))
end
scope :price, -> { where(adjustable_type: 'Spree::LineItem') }
scope :shipping, -> { where(adjustable_type: 'Spree::Shipment') }
scope :optional, -> { where(mandatory: false) }
scope :eligible, -> { where(eligible: true) }
scope :charge, -> { where("#{quoted_table_name}.amount >= 0") }
scope :credit, -> { where("#{quoted_table_name}.amount < 0") }
scope :nonzero, -> { where("#{quoted_table_name}.amount != 0") }
scope :promotion, -> { where(source_type: 'Spree::PromotionAction') }
scope :return_authorization, -> { where(source_type: 'Spree::ReturnAuthorization') }
scope :is_included, -> { where(included: true) }
scope :additional, -> { where(included: false) }
scope :competing_promos, -> { where(source_type: competing_promos_source_types) }
scope :for_complete_order, -> { joins(:order).merge(Spree::Order.complete) }
scope :for_incomplete_order, -> { joins(:order).merge(Spree::Order.incomplete) }
extend DisplayMoney
money_methods :amount
def currency
adjustable ? adjustable.currency : Spree::Config[:currency]
end
def promotion?
source_type == 'Spree::PromotionAction'
end
# Passing a target here would always be recommended as it would avoid
# hitting the database again and would ensure you're compute values over
# the specific object amount passed here.
def update!(target = adjustable)
return amount if closed? || source.blank?
amount = source.compute_amount(target)
attributes = { amount: amount, updated_at: Time.current }
attributes[:eligible] = source.promotion.eligible?(target) if promotion?
update_columns(attributes)
amount
end
private
def update_adjustable_adjustment_total
# Cause adjustable's total to be recalculated
Adjustable::AdjustmentsUpdater.update(adjustable)
end
end
end
| {
"content_hash": "ee5d08c41907b9947509b70702f5aed7",
"timestamp": "",
"source": "github",
"line_count": 81,
"max_line_length": 88,
"avg_line_length": 36.67901234567901,
"alnum_prop": 0.6593739481656008,
"repo_name": "vinayvinsol/spree",
"id": "e863e2eff40760f94fa70d2ae18943c41672a7be",
"size": "3926",
"binary": false,
"copies": "6",
"ref": "refs/heads/master",
"path": "core/app/models/spree/adjustment.rb",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "CSS",
"bytes": "136168"
},
{
"name": "CoffeeScript",
"bytes": "34742"
},
{
"name": "HTML",
"bytes": "489982"
},
{
"name": "JavaScript",
"bytes": "59946"
},
{
"name": "Ruby",
"bytes": "2279370"
},
{
"name": "Shell",
"bytes": "2193"
}
],
"symlink_target": ""
} |
#pragma once
#include <aws/s3control/S3Control_EXPORTS.h>
#include <aws/s3control/S3ControlRequest.h>
#include <aws/core/utils/memory/stl/AWSString.h>
#include <utility>
namespace Aws
{
namespace S3Control
{
namespace Model
{
/**
*/
class AWS_S3CONTROL_API GetMultiRegionAccessPointPolicyRequest : public S3ControlRequest
{
public:
GetMultiRegionAccessPointPolicyRequest();
// Service request name is the Operation name which will send this request out,
// each operation should has unique request name, so that we can get operation's name from this request.
// Note: this is not true for response, multiple operations may have the same response name,
// so we can not get operation's name from response.
inline virtual const char* GetServiceRequestName() const override { return "GetMultiRegionAccessPointPolicy"; }
Aws::String SerializePayload() const override;
Aws::Http::HeaderValueCollection GetRequestSpecificHeaders() const override;
inline bool ShouldComputeContentMd5() const override { return true; }
/**
* Helper function to collect parameters (configurable and static hardcoded) required for endpoint computation.
*/
EndpointParameters GetEndpointContextParams() const override;
/**
* <p>The Amazon Web Services account ID for the owner of the Multi-Region Access
* Point.</p>
*/
inline const Aws::String& GetAccountId() const{ return m_accountId; }
/**
* <p>The Amazon Web Services account ID for the owner of the Multi-Region Access
* Point.</p>
*/
inline bool AccountIdHasBeenSet() const { return m_accountIdHasBeenSet; }
/**
* <p>The Amazon Web Services account ID for the owner of the Multi-Region Access
* Point.</p>
*/
inline void SetAccountId(const Aws::String& value) { m_accountIdHasBeenSet = true; m_accountId = value; }
/**
* <p>The Amazon Web Services account ID for the owner of the Multi-Region Access
* Point.</p>
*/
inline void SetAccountId(Aws::String&& value) { m_accountIdHasBeenSet = true; m_accountId = std::move(value); }
/**
* <p>The Amazon Web Services account ID for the owner of the Multi-Region Access
* Point.</p>
*/
inline void SetAccountId(const char* value) { m_accountIdHasBeenSet = true; m_accountId.assign(value); }
/**
* <p>The Amazon Web Services account ID for the owner of the Multi-Region Access
* Point.</p>
*/
inline GetMultiRegionAccessPointPolicyRequest& WithAccountId(const Aws::String& value) { SetAccountId(value); return *this;}
/**
* <p>The Amazon Web Services account ID for the owner of the Multi-Region Access
* Point.</p>
*/
inline GetMultiRegionAccessPointPolicyRequest& WithAccountId(Aws::String&& value) { SetAccountId(std::move(value)); return *this;}
/**
* <p>The Amazon Web Services account ID for the owner of the Multi-Region Access
* Point.</p>
*/
inline GetMultiRegionAccessPointPolicyRequest& WithAccountId(const char* value) { SetAccountId(value); return *this;}
/**
* <p>Specifies the Multi-Region Access Point. The name of the Multi-Region Access
* Point is different from the alias. For more information about the distinction
* between the name and the alias of an Multi-Region Access Point, see <a
* href="https://docs.aws.amazon.com/AmazonS3/latest/userguide/CreatingMultiRegionAccessPoints.html#multi-region-access-point-naming">Managing
* Multi-Region Access Points</a> in the <i>Amazon S3 User Guide</i>.</p>
*/
inline const Aws::String& GetName() const{ return m_name; }
/**
* <p>Specifies the Multi-Region Access Point. The name of the Multi-Region Access
* Point is different from the alias. For more information about the distinction
* between the name and the alias of an Multi-Region Access Point, see <a
* href="https://docs.aws.amazon.com/AmazonS3/latest/userguide/CreatingMultiRegionAccessPoints.html#multi-region-access-point-naming">Managing
* Multi-Region Access Points</a> in the <i>Amazon S3 User Guide</i>.</p>
*/
inline bool NameHasBeenSet() const { return m_nameHasBeenSet; }
/**
* <p>Specifies the Multi-Region Access Point. The name of the Multi-Region Access
* Point is different from the alias. For more information about the distinction
* between the name and the alias of an Multi-Region Access Point, see <a
* href="https://docs.aws.amazon.com/AmazonS3/latest/userguide/CreatingMultiRegionAccessPoints.html#multi-region-access-point-naming">Managing
* Multi-Region Access Points</a> in the <i>Amazon S3 User Guide</i>.</p>
*/
inline void SetName(const Aws::String& value) { m_nameHasBeenSet = true; m_name = value; }
/**
* <p>Specifies the Multi-Region Access Point. The name of the Multi-Region Access
* Point is different from the alias. For more information about the distinction
* between the name and the alias of an Multi-Region Access Point, see <a
* href="https://docs.aws.amazon.com/AmazonS3/latest/userguide/CreatingMultiRegionAccessPoints.html#multi-region-access-point-naming">Managing
* Multi-Region Access Points</a> in the <i>Amazon S3 User Guide</i>.</p>
*/
inline void SetName(Aws::String&& value) { m_nameHasBeenSet = true; m_name = std::move(value); }
/**
* <p>Specifies the Multi-Region Access Point. The name of the Multi-Region Access
* Point is different from the alias. For more information about the distinction
* between the name and the alias of an Multi-Region Access Point, see <a
* href="https://docs.aws.amazon.com/AmazonS3/latest/userguide/CreatingMultiRegionAccessPoints.html#multi-region-access-point-naming">Managing
* Multi-Region Access Points</a> in the <i>Amazon S3 User Guide</i>.</p>
*/
inline void SetName(const char* value) { m_nameHasBeenSet = true; m_name.assign(value); }
/**
* <p>Specifies the Multi-Region Access Point. The name of the Multi-Region Access
* Point is different from the alias. For more information about the distinction
* between the name and the alias of an Multi-Region Access Point, see <a
* href="https://docs.aws.amazon.com/AmazonS3/latest/userguide/CreatingMultiRegionAccessPoints.html#multi-region-access-point-naming">Managing
* Multi-Region Access Points</a> in the <i>Amazon S3 User Guide</i>.</p>
*/
inline GetMultiRegionAccessPointPolicyRequest& WithName(const Aws::String& value) { SetName(value); return *this;}
/**
* <p>Specifies the Multi-Region Access Point. The name of the Multi-Region Access
* Point is different from the alias. For more information about the distinction
* between the name and the alias of an Multi-Region Access Point, see <a
* href="https://docs.aws.amazon.com/AmazonS3/latest/userguide/CreatingMultiRegionAccessPoints.html#multi-region-access-point-naming">Managing
* Multi-Region Access Points</a> in the <i>Amazon S3 User Guide</i>.</p>
*/
inline GetMultiRegionAccessPointPolicyRequest& WithName(Aws::String&& value) { SetName(std::move(value)); return *this;}
/**
* <p>Specifies the Multi-Region Access Point. The name of the Multi-Region Access
* Point is different from the alias. For more information about the distinction
* between the name and the alias of an Multi-Region Access Point, see <a
* href="https://docs.aws.amazon.com/AmazonS3/latest/userguide/CreatingMultiRegionAccessPoints.html#multi-region-access-point-naming">Managing
* Multi-Region Access Points</a> in the <i>Amazon S3 User Guide</i>.</p>
*/
inline GetMultiRegionAccessPointPolicyRequest& WithName(const char* value) { SetName(value); return *this;}
private:
Aws::String m_accountId;
bool m_accountIdHasBeenSet = false;
Aws::String m_name;
bool m_nameHasBeenSet = false;
};
} // namespace Model
} // namespace S3Control
} // namespace Aws
| {
"content_hash": "301bdce19e071d0bfbd6fd1b8e80b68f",
"timestamp": "",
"source": "github",
"line_count": 172,
"max_line_length": 146,
"avg_line_length": 46.71511627906977,
"alnum_prop": 0.7085252022401991,
"repo_name": "aws/aws-sdk-cpp",
"id": "1c3989a69bf4ab113f7607c7552af0c686ead9cf",
"size": "8154",
"binary": false,
"copies": "1",
"ref": "refs/heads/main",
"path": "aws-cpp-sdk-s3control/include/aws/s3control/model/GetMultiRegionAccessPointPolicyRequest.h",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "C",
"bytes": "309797"
},
{
"name": "C++",
"bytes": "476866144"
},
{
"name": "CMake",
"bytes": "1245180"
},
{
"name": "Dockerfile",
"bytes": "11688"
},
{
"name": "HTML",
"bytes": "8056"
},
{
"name": "Java",
"bytes": "413602"
},
{
"name": "Python",
"bytes": "79245"
},
{
"name": "Shell",
"bytes": "9246"
}
],
"symlink_target": ""
} |
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define PYTHON_COMMAND "python"
#define PYTHON2_COMMAND "python2"
#define PYTHON3_COMMAND "python3"
#define PYTHON_SCRIPT_NAME "PerformRequiredConfigurationChecks.py"
char* getPythonProvider();
int main(int argc, char *argv[])
{
char * pythonCommand = PYTHON2_COMMAND;
char* dscScriptPath = malloc(strlen(DSC_SCRIPT_PATH) + 1);
dscScriptPath = strcpy(dscScriptPath, DSC_SCRIPT_PATH);
//if oms config check to be added
if(strstr(dscScriptPath, "omsconfig")!= NULL)
{
pythonCommand = getPythonProvider();
if(strcmp(pythonCommand, PYTHON3_COMMAND) == 0)
{
dscScriptPath = realloc(dscScriptPath, strlen(dscScriptPath) + strlen("/python3") + 1 );
dscScriptPath = strcat(dscScriptPath, "/python3");
}
}
int fullCommandLength = strlen(pythonCommand) + 1 + strlen(dscScriptPath) + 1 + strlen(PYTHON_SCRIPT_NAME) + 1;
char fullCommand[fullCommandLength];
strcpy(fullCommand, pythonCommand);
strcat(fullCommand, " ");
strcat(fullCommand, dscScriptPath);
strcat(fullCommand, "/");
strcat(fullCommand, PYTHON_SCRIPT_NAME);
int returnValue = system(fullCommand);
return returnValue;
}
// I may need to move this method in some file which is accessible to all other files in the project.
char* getPythonProvider()
{
int buffer_length = 128;
char buffer[buffer_length];
char* result = malloc(1);
*result = 0;
FILE* pipe = popen("python2 --version 2>&1", "r");
if(!pipe) {
printf("Cant start command.");
}
while(fgets(buffer, 128, pipe) != NULL) {
result = realloc(result, (result ? strlen(result) : 0) + buffer_length );
strcat(result,buffer);
}
// If python2 --version does not contain 'not found' return python2
if(strstr(result, "not found") == NULL) {
return PYTHON2_COMMAND;
}
// Look for python3
result = malloc(1);
*result = 0;
pipe = popen("python3 --version 2>&1", "r");
if(!pipe) {
printf("Cant start command.");
}
while(fgets(buffer, 128, pipe) != NULL) {
result = realloc(result, (result ? strlen(result) : 0) + buffer_length );
strcat(result,buffer);
}
// If python3 --version does not contain 'not found' return python3
if(strstr(result, "not found") == NULL) {
return PYTHON3_COMMAND;
}
return PYTHON_COMMAND;
}
| {
"content_hash": "ba8e899be1ce7640569b0c508b266218",
"timestamp": "",
"source": "github",
"line_count": 89,
"max_line_length": 115,
"avg_line_length": 27.764044943820224,
"alnum_prop": 0.6361796843383246,
"repo_name": "MSFTOSSMgmt/WPSDSCLinux",
"id": "6b4351ed60af34173ce1318f46f87ae402b532f0",
"size": "3645",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "LCM/dsc/engine/ConsistencyInvoker/ConsistencyInvoker.c",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C",
"bytes": "5870322"
},
{
"name": "C#",
"bytes": "98943"
},
{
"name": "C++",
"bytes": "670183"
},
{
"name": "CMake",
"bytes": "13826"
},
{
"name": "HTML",
"bytes": "166861"
},
{
"name": "Makefile",
"bytes": "164013"
},
{
"name": "Objective-C",
"bytes": "61644"
},
{
"name": "PowerShell",
"bytes": "40239"
},
{
"name": "Python",
"bytes": "1858427"
},
{
"name": "Shell",
"bytes": "8136"
},
{
"name": "SourcePawn",
"bytes": "60242"
},
{
"name": "Yacc",
"bytes": "35814"
}
],
"symlink_target": ""
} |
<?php if (!defined('ABSPATH')) { exit; } ?>
<div class="bwp-modal" id="modal-external-page">
<div class="bwp-modal-dialog">
<div class="bwp-modal-content">
<div class="bwp-modal-header">
<button type="button" class="bwp-close" data-dismiss="modal">
<span aria-hidden="true">×</span>
</button>
<h4 class="bwp-modal-title"><?php _e('Add/Update an external page', $this->domain); ?></h4>
</div>
<div class="bwp-modal-body">
<?php echo $this->get_template_contents(
'templates/provider/admin/external-page-form.html.php',
array_merge($data, array(
))
); ?>
</div>
<div class="bwp-modal-footer">
<span class="bwp-modal-message text-primary" style="display: none"
data-working-text="<?php _e('working ...', $this->domain); ?>"></span>
<button type="button" class="bwp-btn bwp-btn-default button-secondary"
data-dismiss="modal"><?php _e('Close', $this->domain); ?></button>
<button type="button" class="bwp-btn bwp-btn-default button-secondary bwp-button-modal-reset">
<?php _e('Reset', $this->domain); ?>
</button>
<button type="button"
data-ajax-callback="bwp_button_add_new_external_page_cb"
class="bwp-btn bwp-btn-primary button-primary bwp-button-modal-submit">
<?php _e('Save Changes', $this->domain); ?>
</button>
</div>
</div>
</div>
</div>
| {
"content_hash": "a2d4986364e68cdbca2dd008f4b02b00",
"timestamp": "",
"source": "github",
"line_count": 38,
"max_line_length": 98,
"avg_line_length": 36.05263157894737,
"alnum_prop": 0.6211678832116788,
"repo_name": "20steps/alexa",
"id": "71baa3f2f83dd08f030b5ecdb7de932620375328",
"size": "1370",
"binary": false,
"copies": "4",
"ref": "refs/heads/master",
"path": "web/wp-content/plugins/bwp-google-xml-sitemaps/src/templates/provider/admin/external-page-modal.html.php",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "4889348"
},
{
"name": "CoffeeScript",
"bytes": "8023"
},
{
"name": "Gherkin",
"bytes": "4336"
},
{
"name": "HTML",
"bytes": "357026"
},
{
"name": "JavaScript",
"bytes": "9076289"
},
{
"name": "PHP",
"bytes": "33450039"
},
{
"name": "Perl",
"bytes": "365"
},
{
"name": "Ruby",
"bytes": "3054"
},
{
"name": "Shell",
"bytes": "30158"
},
{
"name": "TypeScript",
"bytes": "35051"
},
{
"name": "VCL",
"bytes": "22958"
},
{
"name": "XSLT",
"bytes": "5437"
}
],
"symlink_target": ""
} |
[](https://travis-ci.org/brianjbuck/robie)
[](https://codecov.io/gh/brianjbuck/robie)
[](https://coveralls.io/r/rochacbruno/raise_if)
Robie is a method of ranking teams from any league.
----------------------------
MIT Licensed
| {
"content_hash": "4897b426d59a3181ffea077f5719d781",
"timestamp": "",
"source": "github",
"line_count": 9,
"max_line_length": 124,
"avg_line_length": 51.22222222222222,
"alnum_prop": 0.7158351409978309,
"repo_name": "brianjbuck/robie",
"id": "372072a18955b8d5bf47cf5cc64002e6e746dd34",
"size": "499",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "README.md",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Makefile",
"bytes": "258"
},
{
"name": "Python",
"bytes": "35905"
}
],
"symlink_target": ""
} |
{% extends "base.html" %}
{% block content %}
<script type="text/javascript">
jQuery(document).ready(function() {
var bubble = function() {
indata = {{ colldata | safe }};
data = {"children":[]};
for (var item in indata) {
var arr = {
"className": indata[item]['name'],
"packageName": item,
"value": indata[item]['records'],
"owner": indata[item]['owner'],
"slug": indata[item]['slug'],
"description": indata[item]['description']
}
data["children"].push(arr);
}
var r = jQuery('#collections').width(),
format = d3.format(",d"),
fill = d3.scale.category20c();
var bubble = d3.layout.pack()
.sort(null)
.size([r, r]);
var vis = d3.select("#collections").append("svg:svg")
.attr("width", r)
.attr("height", r)
.attr("class", "bubble")
var node = vis.selectAll("g.node")
.data(bubble(data)
.filter(function(d) { return !d.children; }))
.enter().append("svg:g")
.attr("class", "node")
.attr("transform", function(d) { return "translate(" + d.x + "," + d.y + ")"; });
node.append("svg:title")
.text(function(d) { return d.data.className + " : " + format(d.value) + " records : " + d.data.description; })
node.append("svg:circle")
.attr("r", function(d) { return d.r; })
.style("fill", function(d) { return fill(d.data.packageName); })
node.append("svg:text")
.attr("text-anchor", "middle")
.attr("dy", ".3em")
.text(function(d) { return d.data.className.substr(0,12); })
node.on('click',function(d) {
clickbubble(d.data.owner,d.data.slug)
})
};
bubble()
var clickbubble = function(owner,coll) {
window.location = '/' + owner + '/' + coll
}
});
</script>
<div class="hero-unit clearfix">
<div class="span7">
<h1>Welcome to BibSoup!</h1>
</div>
<div class="span3">
<p>BibSoup makes it easy to find, manage and share bibliography.</p>
<a class="btn" href="/faq">Learn more »</a>
</div>
</div>
<div class="row">
<div class="span4">
<div class="hero-unit">
<h3>We have <a class="label label-info" style="font-size:20px;" href="/search">{{records}}</a> records
<br /><br />across <a class="label label-info" style="font-size:20px;" href="/collections">{{colls}}</a> collections
<br /><br />shared by <span class="label label-info" style="font-size:20px;">{{users}}</span> users</h3>
</div>
<div class="hero-unit">
<h2>Search all records</h3>
<p>Search shared collections and records, find material relevant to your interests, make new collections.</p>
<p><a href="/search" class="btn">Search everything »</a></p>
</div>
<div class="hero-unit">
<h2>Create collections</h3>
<p><a href="/upload">upload</a> from your own source, or <a href="/create">create</a> a new collection.</p>
</div>
</div>
<div class="span8">
<div class="hero-unit">
<h2>Browse recent Collections</h2>
<div id="collections"></div>
<p><a href="/collections" class="btn">Browse all collections »</a></p>
</div>
</div>
</div>
{% endblock %}
| {
"content_hash": "a698662f7257759a5d9a819b9bb3a2c4",
"timestamp": "",
"source": "github",
"line_count": 99,
"max_line_length": 128,
"avg_line_length": 39.04040404040404,
"alnum_prop": 0.473738680465718,
"repo_name": "okfn/bibserver",
"id": "87d66e62bb27c7ed67cb21d7efc3b3798174806e",
"size": "3865",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "bibserver/templates/home/index.html",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "421"
},
{
"name": "HTML",
"bytes": "47207"
},
{
"name": "JavaScript",
"bytes": "9154"
},
{
"name": "Perl",
"bytes": "22029"
},
{
"name": "Python",
"bytes": "202965"
}
],
"symlink_target": ""
} |
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>rsa: 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.11.2 / rsa - 8.9.0</a></li>
</ul>
</div>
</div>
</div>
<div class="article">
<div class="row">
<div class="col-md-12">
<a href="../..">« Up</a>
<h1>
rsa
<small>
8.9.0
<span class="label label-info">Not compatible</span>
</small>
</h1>
<p><em><script>document.write(moment("2020-08-31 05:47:56 +0000", "YYYY-MM-DD HH:mm:ss Z").fromNow());</script> (2020-08-31 05:47:56 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
conf-m4 1 Virtual package relying on m4
coq 8.11.2 Formal proof management system
num 1.3 The legacy Num library for arbitrary-precision integer and rational arithmetic
ocaml 4.11.0 The OCaml compiler (virtual package)
ocaml-base-compiler 4.11.0 Official release 4.11.0
ocaml-config 1 OCaml Switch Configuration
ocamlfind 1.8.1 A library manager for OCaml
# opam file:
opam-version: "2.0"
maintainer: "[email protected]"
homepage: "https://github.com/coq-contribs/rsa"
license: "LGPL 2.1"
build: [make "-j%{jobs}%"]
install: [make "install"]
remove: ["rm" "-R" "%{lib}%/coq/user-contrib/RSA"]
depends: [
"ocaml"
"coq" {>= "8.9" & < "8.10~"}
]
tags: [
"keyword: RSA"
"keyword: Chinese remainder"
"keyword: Fermat's little theorem"
"category: Computer Science/Decision Procedures and Certified Algorithms/Correctness proofs of algorithms"
"date: 1999"
]
authors: [
"Jose C. Almeida"
"Laurent Théry"
]
bug-reports: "https://github.com/coq-contribs/rsa/issues"
dev-repo: "git+https://github.com/coq-contribs/rsa.git"
synopsis: "Correctness of RSA algorithm"
description: """
This directory contains the proof of correctness
of RSA algorithm. It contains a proof of Fermat's little theorem"""
flags: light-uninstall
url {
src: "https://github.com/coq-contribs/rsa/archive/v8.9.0.tar.gz"
checksum: "md5=d080aa0535ef268773d9ea53866ba168"
}
</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-rsa.8.9.0 coq.8.11.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.11.2).
The following dependencies couldn't be met:
- coq-rsa -> coq < 8.10~ -> ocaml < 4.10
base of this switch (use `--unlock-base' to force)
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-rsa.8.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">
<small>Sources are on <a href="https://github.com/coq-bench">GitHub</a>. © Guillaume Claret.</small>
</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": "7da36565c87a9c393daa3b41719eec60",
"timestamp": "",
"source": "github",
"line_count": 172,
"max_line_length": 157,
"avg_line_length": 39.83720930232558,
"alnum_prop": 0.539112667834209,
"repo_name": "coq-bench/coq-bench.github.io",
"id": "09f57757bc86b4e6af68707013d7f870123b991b",
"size": "6855",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "clean/Linux-x86_64-4.11.0-2.0.7/released/8.11.2/rsa/8.9.0.html",
"mode": "33188",
"license": "mit",
"language": [],
"symlink_target": ""
} |
<!DOCTYPE html>
<html>
<head>
<script src='/resources/testharness.js'></script>
<script src='/resources/testharnessreport.js'></script>
<script src='../resources/permissions-policy-report-json.js'></script>
</head>
<body>
<script>
var t = async_test("PaymentRequest Report Format");
var check_report_format = (reports, observer) => {
let report = reports[0];
assert_equals(report.type, "permissions-policy-violation");
assert_equals(report.url, document.location.href);
assert_equals(report.body.featureId, "payment");
assert_equals(report.body.sourceFile, document.location.href);
assert_equals(typeof report.body.lineNumber, "number");
assert_equals(typeof report.body.columnNumber, "number");
assert_equals(report.body.disposition, "enforce");
check_report_json(report);
};
new ReportingObserver(t.step_func_done(check_report_format),
{types: ['permissions-policy-violation']}).observe();
t.step_func(() => {
assert_throws_dom('SecurityError',
() => new PaymentRequest(
[{ supportedMethods: 'https://example.com/pay' }],
{ total: { label: 'Total', amount: { currency: 'USD', value: 0 }}},
{}).show(),
"PaymentRequest API should not be allowed in this document.");
})();
</script>
</body>
</html>
| {
"content_hash": "1d1d34c420e76336b954675cfe5e9d8e",
"timestamp": "",
"source": "github",
"line_count": 37,
"max_line_length": 75,
"avg_line_length": 34.810810810810814,
"alnum_prop": 0.6739130434782609,
"repo_name": "nwjs/chromium.src",
"id": "f639c2b7c62392d2583b44120ac4c66500538f6e",
"size": "1288",
"binary": false,
"copies": "13",
"ref": "refs/heads/nw70",
"path": "third_party/blink/web_tests/external/wpt/permissions-policy/reporting/payment-reporting.https.html",
"mode": "33188",
"license": "bsd-3-clause",
"language": [],
"symlink_target": ""
} |
using FubarDev.FtpServer.FileSystem;
using Microsoft.WindowsAzure.Storage;
using Microsoft.WindowsAzure.Storage.Auth;
using Microsoft.WindowsAzure.Storage.Blob;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace AdamHurwitz.FtpServer.FileSystem.AzureBlob
{
public class AzureBlobFileSystemProvider : IFileSystemClassFactory
{
private readonly string _rootPath;
private readonly bool _useUserIdAsSubFolder;
/// <summary>
/// Gets or sets a value indicating whether deletion of non-empty directories is allowed.
/// </summary>
public bool AllowNonEmptyDirectoryDelete { get; set; }
public AzureBlobFileSystemProvider(string accountName, string accountKey, string container)
{
StorageCredentials creds = new StorageCredentials(accountName, accountKey);
CloudStorageAccount storageAccount = new CloudStorageAccount(creds, true);
CloudBlobClient blob = storageAccount.CreateCloudBlobClient();
Container = blob.GetContainerReference(container);
Container.CreateIfNotExists();
}
private CloudBlobContainer Container;
/// <inheritdoc/>
public Task<IUnixFileSystem> Create(string userId, bool isAnonymous)
{
var path = _rootPath;
if (_useUserIdAsSubFolder)
{
if (isAnonymous)
userId = "anonymous";
path = Path.Combine(path, userId);
}
return Task.FromResult<IUnixFileSystem>(new AzureBlobFileSystem(Container, userId));
}
}
}
| {
"content_hash": "5c2a39eca78583f99eb241aa3a798626",
"timestamp": "",
"source": "github",
"line_count": 50,
"max_line_length": 99,
"avg_line_length": 34.42,
"alnum_prop": 0.6682161533991865,
"repo_name": "adhurwit/AzureBlobFtp",
"id": "bf5d1b709082124b54ecef95b416f6af682e8862",
"size": "1723",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "AzureBlobFileSystemProvider.cs",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C#",
"bytes": "14524"
}
],
"symlink_target": ""
} |
<?php
/**
* Class for upgrade / deactivation / uninstall
*/
class BackWPup_Install {
/**
* Creates DB und updates settings
*/
public static function activate() {
$version_db = get_site_option( 'backwpup_version' );
//changes for version before 3.0.0
if ( ! $version_db && get_option( 'backwpup' ) && get_option( 'backwpup_jobs' ) ) {
self::upgrade_from_version_two();
}
//changes for version before 3.0.14
if ( version_compare( '3.0.13', $version_db, '>' ) && version_compare( '3.0', $version_db, '<' ) ) {
$upload_dir = wp_upload_dir( null, false, true );
$logfolder = get_site_option( 'backwpup_cfg_logfolder' );
if ( empty( $logfolder ) ) {
$old_log_folder = trailingslashit( str_replace( '\\', '/',$upload_dir[ 'basedir' ] ) ) . 'backwpup-' . substr( md5( md5( SECURE_AUTH_KEY ) ), 9, 5 ) . '-logs/';
update_site_option( 'backwpup_cfg_logfolder', $old_log_folder );
}
}
//changes for 3.2
$no_translation = get_site_option( 'backwpup_cfg_jobnotranslate' );
if ( $no_translation ) {
update_site_option( 'backwpup_cfg_loglevel', 'normal' );
delete_site_option( 'backwpup_cfg_jobnotranslate' );
}
delete_site_option( 'backwpup_cfg_jobziparchivemethod' );
//create new options
if ( is_multisite() ) {
add_site_option( 'backwpup_jobs', array() );
} else {
add_option( 'backwpup_jobs', array(), NULL, 'no' );
}
//remove old schedule
wp_clear_scheduled_hook( 'backwpup_cron' );
//make new schedule
$activejobs = BackWPup_Option::get_job_ids( 'activetype', 'wpcron' );
if ( ! empty( $activejobs ) ) {
foreach ( $activejobs as $id ) {
$cron_next = BackWPup_Cron::cron_next( BackWPup_Option::get( $id, 'cron') );
wp_schedule_single_event( $cron_next, 'backwpup_cron', array( 'id' => $id ) );
}
}
$activejobs = BackWPup_Option::get_job_ids( 'activetype', 'easycron' );
if ( ! empty( $activejobs ) ) {
foreach ( $activejobs as $id ) {
BackWPup_EasyCron::update( $id );
}
}
//add Cleanup schedule
if ( ! wp_next_scheduled( 'backwpup_check_cleanup' ) ) {
wp_schedule_event( time(), 'twicedaily', 'backwpup_check_cleanup' );
}
// Add schedule to update backend message
if ( ! wp_next_scheduled( 'backwpup_update_message' ) ) {
wp_schedule_event( time(), 'twicedaily', 'backwpup_update_message' );
}
//add capabilities to administrator role
$role = get_role( 'administrator' );
if ( is_object( $role ) && method_exists( $role, 'add_cap' ) ) {
$role->add_cap( 'backwpup' );
$role->add_cap( 'backwpup_jobs' );
$role->add_cap( 'backwpup_jobs_edit' );
$role->add_cap( 'backwpup_jobs_start' );
$role->add_cap( 'backwpup_backups' );
$role->add_cap( 'backwpup_backups_download' );
$role->add_cap( 'backwpup_backups_delete' );
$role->add_cap( 'backwpup_logs' );
$role->add_cap( 'backwpup_logs_delete' );
$role->add_cap( 'backwpup_settings' );
$role->add_cap( 'backwpup_restore' );
}
//add/overwrite roles
add_role( 'backwpup_admin', __( 'BackWPup Admin', 'backwpup' ), array(
'read' => TRUE, // make it usable for single user
'backwpup' => TRUE, // BackWPup general accesses (like Dashboard)
'backwpup_jobs' => TRUE, // accesses for job page
'backwpup_jobs_edit' => TRUE, // user can edit/delete/copy/export jobs
'backwpup_jobs_start' => TRUE, // user can start jobs
'backwpup_backups' => TRUE, // accesses for backups page
'backwpup_backups_download' => TRUE, // user can download backup files
'backwpup_backups_delete' => TRUE, // user can delete backup files
'backwpup_logs' => TRUE, // accesses for logs page
'backwpup_logs_delete' => TRUE, // user can delete log files
'backwpup_settings' => TRUE, // accesses for settings page
'backwpup_restore' => TRUE, // accesses for restore page
) );
add_role( 'backwpup_check', __( 'BackWPup jobs checker', 'backwpup' ), array(
'read' => TRUE,
'backwpup' => TRUE,
'backwpup_jobs' => TRUE,
'backwpup_jobs_edit' => FALSE,
'backwpup_jobs_start' => FALSE,
'backwpup_backups' => TRUE,
'backwpup_backups_download' => FALSE,
'backwpup_backups_delete' => FALSE,
'backwpup_logs' => TRUE,
'backwpup_logs_delete' => FALSE,
'backwpup_settings' => FALSE,
'backwpup_restore' => FALSE,
) );
add_role( 'backwpup_helper', __( 'BackWPup jobs helper', 'backwpup' ), array(
'read' => TRUE,
'backwpup' => TRUE,
'backwpup_jobs' => TRUE,
'backwpup_jobs_edit' => FALSE,
'backwpup_jobs_start' => TRUE,
'backwpup_backups' => TRUE,
'backwpup_backups_download' => TRUE,
'backwpup_backups_delete' => TRUE,
'backwpup_logs' => TRUE,
'backwpup_logs_delete' => TRUE,
'backwpup_settings' => FALSE,
'backwpup_restore' => FALSE,
) );
//add default options
BackWPup_Option::default_site_options();
//update version
update_site_option( 'backwpup_version', BackWPup::get_plugin_data( 'Version' ) );
if ( ! $version_db ) {
wp_redirect( network_admin_url( 'admin.php' ) . '?page=backwpupabout' );
die();
}
}
private static function upgrade_from_version_two() {
//load options
$cfg = get_option( 'backwpup' ); //only exists in Version 2
$jobs = get_option( 'backwpup_jobs' );
//delete old options
delete_option( 'backwpup' );
delete_option( 'backwpup_jobs' );
//add new option default structure and without auto load cache
if ( ! is_multisite() )
add_option( 'backwpup_jobs', array(), NULL, 'no' );
//upgrade cfg
//if old value switch it to new
if ( ! empty( $cfg[ 'dirlogs' ] ) )
$cfg[ 'logfolder' ] = $cfg[ 'dirlogs' ];
if ( ! empty( $cfg[ 'httpauthpassword' ] ) ) {
if ( preg_match('%^[a-zA-Z0-9/+]*={0,2}$%', $cfg[ 'httpauthpassword' ] ) )
$cfg[ 'httpauthpassword' ] = base64_decode( $cfg[ 'httpauthpassword' ] );
$cfg[ 'httpauthpassword' ] = BackWPup_Encryption::encrypt( $cfg[ 'httpauthpassword' ] );
}
// delete old not needed vars
unset( $cfg[ 'dirtemp' ], $cfg[ 'dirlogs' ], $cfg[ 'logfilelist' ], $cfg[ 'jobscriptruntime' ], $cfg[ 'jobscriptruntimelong' ], $cfg[ 'last_activate' ], $cfg[ 'disablewpcron' ], $cfg[ 'phpzip' ], $cfg[ 'apicronservice' ], $cfg[ 'mailsndemail' ], $cfg[ 'mailsndname' ], $cfg[ 'mailmethod' ], $cfg[ 'mailsendmail' ], $cfg[ 'mailhost' ], $cfg[ 'mailpass' ], $cfg[ 'mailhostport' ], $cfg[ 'mailsecure' ], $cfg[ 'mailuser' ] );
//save in options
foreach ( $cfg as $cfgname => $cfgvalue )
update_site_option( 'backwpup_cfg_' . $cfgname, $cfgvalue );
//Put old jobs to new if exists
foreach ( $jobs as $jobid => $jobvalue ) {
//convert general settings
if ( empty( $jobvalue[ 'jobid' ] ) )
$jobvalue[ 'jobid' ] = $jobid;
if ( empty( $jobvalue[ 'activated' ] ) )
$jobvalue[ 'activetype' ] = '';
else
$jobvalue[ 'activetype' ] = 'wpcron';
if ( ! isset( $jobvalue[ 'cronselect' ] ) && ! isset( $jobvalue[ 'cron' ] ) )
$jobvalue[ 'cronselect' ] = 'basic';
elseif ( ! isset( $jobvalue[ 'cronselect' ] ) && isset( $jobvalue[ 'cron' ] ) )
$jobvalue[ 'cronselect' ] = 'advanced';
$jobvalue[ 'backuptype' ] = 'archive';
$jobvalue[ 'type' ] = explode( '+', $jobvalue[ 'type' ] ); //save as array
foreach ( $jobvalue[ 'type' ] as $key => $type ) {
if ( $type == 'DB' )
$jobvalue[ 'type' ][ $key ] = 'DBDUMP';
if ( $type == 'OPTIMIZE' )
unset( $jobvalue[ 'type' ][ $key ] );
if ( $type == 'CHECK' )
$jobvalue[ 'type' ][ $key ] = 'DBCHECK';
if ( $type == 'MAIL' )
$jobvalue[ 'type' ][ $key ] = 'EMAIL';
}
$jobvalue[ 'archivename' ] = $jobvalue[ 'fileprefix' ] . '%Y-%m-%d_%H-%i-%s';
$jobvalue[ 'archiveformat' ] = $jobvalue[ 'fileformart' ];
//convert active destinations
$jobvalue[ 'destinations' ] = array();
if ( ! empty( $jobvalue[ 'backupdir' ] ) && $jobvalue[ 'backupdir' ] != '/' )
$jobvalue[ 'destinations' ][ ] = 'FOLDER';
if ( ! empty( $jobvalue[ 'mailaddress' ] ) )
$jobvalue[ 'destinations' ][ ] = 'MAIL';
if ( ! empty( $jobvalue[ 'ftphost' ] ) && ! empty( $jobvalue[ 'ftpuser' ] ) && ! empty( $jobvalue[ 'ftppass' ] ) )
$jobvalue[ 'destinations' ][ ] = 'FTP';
if ( ! empty( $jobvalue[ 'dropetoken' ] ) && ! empty( $jobvalue[ 'dropesecret' ] ) )
$jobvalue[ 'destinations' ][ ] = 'DROPBOX';
if ( ! empty( $jobvalue[ 'sugarrefreshtoken' ] ) && ! empty( $jobvalue[ 'sugarroot' ] ) )
$jobvalue[ 'destinations' ][ ] = 'SUGARSYNC';
if ( ! empty( $jobvalue[ 'awsAccessKey' ] ) && ! empty( $jobvalue[ 'awsSecretKey' ] ) && ! empty( $jobvalue[ 'awsBucket' ] ) )
$jobvalue[ 'destinations' ][ ] = 'S3';
if ( ! empty( $jobvalue[ 'GStorageAccessKey' ] ) and ! empty( $jobvalue[ 'GStorageSecret' ] ) && ! empty( $jobvalue[ 'GStorageBucket' ] ) && !in_array( 'S3', $jobvalue[ 'destinations' ], true ) )
$jobvalue[ 'destinations' ][ ] = 'S3';
if ( ! empty( $jobvalue[ 'rscUsername' ] ) && ! empty( $jobvalue[ 'rscAPIKey' ] ) && ! empty( $jobvalue[ 'rscContainer' ] ) )
$jobvalue[ 'destinations' ][ ] = 'RSC';
if ( ! empty( $jobvalue[ 'msazureHost' ] ) && ! empty( $jobvalue[ 'msazureAccName' ] ) && ! empty( $jobvalue[ 'msazureKey' ] ) && ! empty( $jobvalue[ 'msazureContainer' ] ) )
$jobvalue[ 'destinations' ][ ] = 'MSAZURE';
//convert dropbox
$jobvalue[ 'dropboxtoken' ] = ''; //new app key are set must reauth
$jobvalue[ 'dropboxsecret' ] = '';
$jobvalue[ 'dropboxroot' ] = 'dropbox';
$jobvalue[ 'dropboxmaxbackups' ] = $jobvalue[ 'dropemaxbackups' ];
$jobvalue[ 'dropboxdir' ] = $jobvalue[ 'dropedir' ];
unset( $jobvalue[ 'dropetoken' ], $jobvalue[ 'dropesecret' ], $jobvalue[ 'droperoot' ], $jobvalue[ 'dropemaxbackups' ], $jobvalue[ 'dropedir' ] );
//convert amazon S3
$jobvalue[ 's3accesskey' ] = $jobvalue[ 'awsAccessKey' ];
$jobvalue[ 's3secretkey' ] = BackWPup_Encryption::encrypt( $jobvalue[ 'awsSecretKey' ] );
$jobvalue[ 's3bucket' ] = $jobvalue[ 'awsBucket' ];
//get aws region
$jobvalue[ 's3region' ] = 'us-east-1';
$jobvalue[ 's3storageclass' ] = !empty( $jobvalue[ 'awsrrs' ] ) ? 'REDUCED_REDUNDANCY' : '';
$jobvalue[ 's3dir' ] = $jobvalue[ 'awsdir' ];
$jobvalue[ 's3maxbackups' ] = $jobvalue[ 'awsmaxbackups' ];
unset( $jobvalue[ 'awsAccessKey' ], $jobvalue[ 'awsSecretKey' ], $jobvalue[ 'awsBucket' ], $jobvalue[ 'awsrrs' ], $jobvalue[ 'awsdir' ], $jobvalue[ 'awsmaxbackups' ] );
//convert google storage
$jobvalue[ 's3accesskey' ] = $jobvalue[ 'GStorageAccessKey' ];
$jobvalue[ 's3secretkey' ] = BackWPup_Encryption::encrypt( $jobvalue[ 'GStorageSecret' ] );
$jobvalue[ 's3bucket' ] = $jobvalue[ 'GStorageBucket' ];
$jobvalue[ 's3region' ] = 'google-storage';
$jobvalue[ 's3ssencrypt' ] = '';
$jobvalue[ 's3dir' ] = $jobvalue[ 'GStoragedir' ];
$jobvalue[ 's3maxbackups' ] = $jobvalue[ 'GStoragemaxbackups' ];
unset( $jobvalue[ 'GStorageAccessKey' ], $jobvalue[ 'GStorageSecret' ], $jobvalue[ 'GStorageBucket' ], $jobvalue[ 'GStoragedir' ], $jobvalue[ 'GStoragemaxbackups' ] );
//convert MS Azure storage
$jobvalue[ 'msazureaccname' ] = $jobvalue[ 'msazureAccName' ];
$jobvalue[ 'msazurekey' ] = BackWPup_Encryption::encrypt( $jobvalue[ 'msazureKey' ] );
$jobvalue[ 'msazurecontainer' ] = $jobvalue[ 'msazureContainer' ];
unset( $jobvalue[ 'msazureHost' ], $jobvalue[ 'msazureAccName' ], $jobvalue[ 'msazureKey' ], $jobvalue[ 'msazureContainer' ] );
//convert FTP
if ( preg_match('%^[a-zA-Z0-9/+]*={0,2}$%', $jobvalue[ 'ftppass' ]) )
$jobvalue[ 'ftppass' ] = base64_decode( $jobvalue[ 'ftppass' ] );
$jobvalue[ 'ftppass' ] = BackWPup_Encryption::encrypt( $jobvalue[ 'ftppass' ] );
if ( ! empty( $jobvalue[ 'ftphost' ] ) && strstr( $jobvalue[ 'ftphost' ], ':' ) )
list( $jobvalue[ 'ftphost' ], $jobvalue[ 'ftphostport' ] ) = explode( ':', $jobvalue[ 'ftphost' ], 2 );
//convert Sugarsync
//convert Mail
$jobvalue[ 'emailaddress' ] = $jobvalue[ 'mailaddress' ];
$jobvalue[ 'emailefilesize' ] = $jobvalue[ 'mailefilesize' ];
unset( $jobvalue[ 'mailaddress' ], $jobvalue[ 'mailefilesize' ] );
//convert RSC
$jobvalue[ 'rscusername' ] = $jobvalue[ 'rscUsername' ];
$jobvalue[ 'rscapikey' ] = $jobvalue[ 'rscAPIKey' ];
$jobvalue[ 'rsccontainer' ] = $jobvalue[ 'rscContainer' ];
//convert jobtype DB Dump
$jobvalue[ 'dbdumpexclude' ] = $jobvalue[ 'dbexclude' ];
unset( $jobvalue[ 'dbexclude' ], $jobvalue['dbshortinsert'] );
//convert jobtype DBDUMP, DBCHECK
$jobvalue[ 'dbcheckrepair' ] = TRUE;
unset( $jobvalue[ 'maintenance' ] );
//convert jobtype wpexport
//convert jobtype file
$excludes = array();
foreach ( $jobvalue[ 'backuprootexcludedirs' ] as $folder ) {
$excludes[] = basename( $folder );
}
$jobvalue[ 'backuprootexcludedirs' ] = $excludes;
$excludes = array();
foreach ( $jobvalue[ 'backupcontentexcludedirs' ] as $folder ) {
$excludes[] = basename( $folder );
}
$jobvalue[ 'backupcontentexcludedirs' ] = $excludes;
$excludes = array();
foreach ( $jobvalue[ 'backuppluginsexcludedirs' ] as $folder ) {
$excludes[] = basename( $folder );
}
$jobvalue[ 'backuppluginsexcludedirs' ]= $excludes;
$excludes = array();
foreach ( $jobvalue[ 'backupthemesexcludedirs' ] as $folder ) {
$excludes[] = basename( $folder );
}
$jobvalue[ 'backupthemesexcludedirs' ] = $excludes;
$excludes = array();
foreach ( $jobvalue[ 'backupuploadsexcludedirs' ] as $folder ) {
$excludes[] = basename( $folder );
}
$jobvalue[ 'backupuploadsexcludedirs' ] = $excludes;
//delete not longer needed
unset( $jobvalue[ 'cronnextrun' ], $jobvalue[ 'fileprefix' ], $jobvalue[ 'fileformart' ], $jobvalue[ 'scheduleintervaltype' ], $jobvalue[ 'scheduleintervalteimes' ], $jobvalue[ 'scheduleinterval' ], $jobvalue[ 'dropemail' ], $jobvalue[ 'dropepass' ], $jobvalue[ 'dropesignmethod' ] );
//save in options
foreach ( $jobvalue as $jobvaluename => $jobvaluevalue )
BackWPup_Option::update( $jobvalue[ 'jobid' ], $jobvaluename, $jobvaluevalue );
}
}
/**
*
* Cleanup on Plugin deactivation
*
* @return void
*/
public static function deactivate() {
wp_clear_scheduled_hook( 'backwpup_cron' );
$activejobs = BackWPup_Option::get_job_ids( 'activetype', 'wpcron' );
if ( ! empty( $activejobs ) ) {
foreach ( $activejobs as $id ) {
wp_clear_scheduled_hook( 'backwpup_cron', array( 'id' => $id ) );
}
}
wp_clear_scheduled_hook( 'backwpup_check_cleanup' );
wp_clear_scheduled_hook( 'backwpup_update_message' );
$activejobs = BackWPup_Option::get_job_ids( 'activetype', 'easycron' );
if ( ! empty( $activejobs ) ) {
foreach ( $activejobs as $id ) {
BackWPup_EasyCron::delete( $id );
}
}
//remove roles
remove_role( 'backwpup_admin' );
remove_role( 'backwpup_helper' );
remove_role( 'backwpup_check' );
//remove capabilities to administrator role
$role = get_role( 'administrator' );
if ( is_object( $role ) && method_exists( $role, 'remove_cap' ) ) {
$role->remove_cap( 'backwpup' );
$role->remove_cap( 'backwpup_jobs' );
$role->remove_cap( 'backwpup_jobs_edit' );
$role->remove_cap( 'backwpup_jobs_start' );
$role->remove_cap( 'backwpup_backups' );
$role->remove_cap( 'backwpup_backups_download' );
$role->remove_cap( 'backwpup_backups_delete' );
$role->remove_cap( 'backwpup_logs' );
$role->remove_cap( 'backwpup_logs_delete' );
$role->remove_cap( 'backwpup_settings' );
$role->remove_cap( 'backwpup_restore' );
}
}
}
| {
"content_hash": "d9d0c9b3ead6fad85a0546cb1908db90",
"timestamp": "",
"source": "github",
"line_count": 358,
"max_line_length": 424,
"avg_line_length": 43.50837988826816,
"alnum_prop": 0.6104904982023626,
"repo_name": "rollandwalsh/third-rail",
"id": "4d2ea12ac2452d25df6299cabd6886d2f36f4b31",
"size": "15576",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "plugins/backwpup/inc/class-install.php",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "363525"
},
{
"name": "HTML",
"bytes": "324210"
},
{
"name": "JavaScript",
"bytes": "1057014"
},
{
"name": "PHP",
"bytes": "3237489"
},
{
"name": "XSLT",
"bytes": "6608"
}
],
"symlink_target": ""
} |
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd" >
<suite name="Suite1" verbose="1">
<test name="Groups">
<classes>
<class name="ru.stqa.hometask.addressbook.tests.GroupTestCreation"/>
<class name="ru.stqa.hometask.addressbook.tests.GroupTestModify"/>
<class name="ru.stqa.hometask.addressbook.tests.GroupTestDelete"/>
</classes>
</test>
</suite> | {
"content_hash": "12be0edbc223a49a4bb9f418db2882aa",
"timestamp": "",
"source": "github",
"line_count": 11,
"max_line_length": 80,
"avg_line_length": 37.81818181818182,
"alnum_prop": 0.6394230769230769,
"repo_name": "igoretk/java_ht_new",
"id": "67b26ad02d9b547a9ea6199c58ccb677b6c74895",
"size": "416",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "addressbook-hometask-tests/src/test/resources/testng-groups.xml",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Java",
"bytes": "142972"
},
{
"name": "PHP",
"bytes": "237"
}
],
"symlink_target": ""
} |
<?php
namespace observr\State\Notifier {
class AggregateNotifier implements \ArrayAccess, \IteratorAggregate, NotifierInterface {
/**
* Locally stores listener/notifiers
* @var array
*/
private $notifiers = [];
/**
* Default constructor for AggregateListener
* @param array $notifiers
*/
public function __construct(array $notifiers = []) {
$this->notifiers = $notifiers;
}
/**
* Check if listener is at index
* @param mixed $offset
* @return boolean
*/
public function offsetExists($offset) {
return isset($this->notifiers[$offset]);
}
/**
* Retrieve listener from index
* @param mixed $offset
* @return mixed
*/
public function offsetGet($offset) {
if(isset($this->notifiers[$offset])) {
return $this->notifiers[$offset];
}
}
/**
* Remove listener from index
* @param mixed $offset
*/
public function offsetUnset($offset) {
if(isset($this->notifiers[$offset])) {
unset($this->notifiers[$offset]);
}
}
/**
* Allows native iteration over AggregateListener
* @return \ArrayIterator
*/
public function getIterator() {
return new \ArrayIterator($this->notifiers);
}
/**
* Ensure new value is Notifier
* @param mixed $index
* @param \observr\State\Notifier\NotifierInterface $newval
*/
public function offsetSet($index, $newval) {
if($newval instanceof NotifierInterface) {
parent::offsetSet($index, $newval);
}
}
/**
* setState all notifiers
* @param string $state
* @param mixed $e
*/
public function setState($state, $e = null) {
foreach($this as $notifier) {
$notifier->setState($state, $e);
}
}
/**
* Proxies notifiers
* @param string $name
* @param array $arguments
*/
public function __call($name, $arguments) {
foreach($this as $notifier) {
if(is_callable([$notifier,$name])) {
call_user_func_array([$notifier,$name],$arguments);
}
}
}
}
} | {
"content_hash": "e114f9f7982d409fb9b9850e8553b7b3",
"timestamp": "",
"source": "github",
"line_count": 91,
"max_line_length": 92,
"avg_line_length": 28.318681318681318,
"alnum_prop": 0.4792394256887854,
"repo_name": "jgswift/observr",
"id": "a3503526e3082fd954abd4590b06f5b8b1de2c11",
"size": "2577",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/State/Notifier/AggregateNotifier.php",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "PHP",
"bytes": "78070"
}
],
"symlink_target": ""
} |
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/container"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.baraccasoftware.swipesms.app.SettingsActivity"
tools:ignore="MergeRootFrame" />
| {
"content_hash": "ddb27b7a1561dc3ad16a7fb3d3088a7d",
"timestamp": "",
"source": "github",
"line_count": 7,
"max_line_length": 71,
"avg_line_length": 49,
"alnum_prop": 0.7405247813411079,
"repo_name": "chemickypes/SwipeSMS",
"id": "1afd8b2e13cf4421b63bb38846eeee8322aaffd1",
"size": "343",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "app/src/main/res/layout/activity_settings.xml",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Groovy",
"bytes": "1734"
},
{
"name": "Java",
"bytes": "151458"
}
],
"symlink_target": ""
} |
package net.sf.jabref.model.groups;
import java.util.Optional;
import net.sf.jabref.model.entry.BibEntry;
import net.sf.jabref.model.entry.FieldName;
import org.junit.Before;
import org.junit.Test;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
public class ExplicitGroupTest {
private ExplicitGroup group;
private ExplicitGroup group2;
private BibEntry entry;
@Before
public void setUp() {
group = new ExplicitGroup("myExplicitGroup", GroupHierarchyType.INDEPENDENT, ',');
group2 = new ExplicitGroup("myExplicitGroup2", GroupHierarchyType.INCLUDING, ',');
entry = new BibEntry();
}
@Test
public void addSingleGroupToEmptyBibEntryChangesGroupsField() {
group.add(entry);
assertEquals(Optional.of("myExplicitGroup"), entry.getField(FieldName.GROUPS));
}
@Test
public void addSingleGroupToNonemptyBibEntryAppendsToGroupsField() {
entry.setField(FieldName.GROUPS, "some thing");
group.add(entry);
assertEquals(Optional.of("some thing, myExplicitGroup"), entry.getField(FieldName.GROUPS));
}
@Test
public void addTwoGroupsToBibEntryChangesGroupsField() {
group.add(entry);
group2.add(entry);
assertEquals(Optional.of("myExplicitGroup, myExplicitGroup2"), entry.getField(FieldName.GROUPS));
}
@Test
public void addDuplicateGroupDoesNotChangeGroupsField() throws Exception {
entry.setField(FieldName.GROUPS, "myExplicitGroup");
group.add(entry);
assertEquals(Optional.of("myExplicitGroup"), entry.getField(FieldName.GROUPS));
}
@Test
// For https://github.com/JabRef/jabref/issues/2334
public void removeDoesNotChangeFieldIfContainsNameAsPart() throws Exception {
entry.setField(FieldName.GROUPS, "myExplicitGroup_alternative");
group.remove(entry);
assertEquals(Optional.of("myExplicitGroup_alternative"), entry.getField(FieldName.GROUPS));
}
@Test
// For https://github.com/JabRef/jabref/issues/2334
public void removeDoesNotChangeFieldIfContainsNameAsWord() throws Exception {
entry.setField(FieldName.GROUPS, "myExplicitGroup alternative");
group.remove(entry);
assertEquals(Optional.of("myExplicitGroup alternative"), entry.getField(FieldName.GROUPS));
}
@Test
// For https://github.com/JabRef/jabref/issues/1873
public void containsOnlyMatchesCompletePhraseWithWhitespace() throws Exception {
entry.setField(FieldName.GROUPS, "myExplicitGroup b");
assertFalse(group.contains(entry));
}
@Test
// For https://github.com/JabRef/jabref/issues/1873
public void containsOnlyMatchesCompletePhraseWithSlash() throws Exception {
entry.setField(FieldName.GROUPS, "myExplicitGroup/b");
assertFalse(group.contains(entry));
}
@Test
// For https://github.com/JabRef/jabref/issues/2394
public void containsMatchesPhraseWithBrackets() throws Exception {
entry.setField(FieldName.GROUPS, "[aa] Subgroup1");
ExplicitGroup explicitGroup = new ExplicitGroup("[aa] Subgroup1", GroupHierarchyType.INCLUDING, ',');
assertTrue(explicitGroup.contains(entry));
}
}
| {
"content_hash": "90359fdf5d3ba48fba5d5b3cd2f697cf",
"timestamp": "",
"source": "github",
"line_count": 102,
"max_line_length": 109,
"avg_line_length": 32.529411764705884,
"alnum_prop": 0.7118746232670283,
"repo_name": "JessicaDias/JabRef_ES2",
"id": "accc761c022527c9f2394b2472f1002338ac98c2",
"size": "3318",
"binary": false,
"copies": "4",
"ref": "refs/heads/master",
"path": "src/test/java/net/sf/jabref/model/groups/ExplicitGroupTest.java",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "ANTLR",
"bytes": "1751"
},
{
"name": "CSS",
"bytes": "2148"
},
{
"name": "GAP",
"bytes": "1492"
},
{
"name": "HTML",
"bytes": "21991813"
},
{
"name": "Java",
"bytes": "6074740"
},
{
"name": "Perl",
"bytes": "9622"
},
{
"name": "Python",
"bytes": "17912"
},
{
"name": "Ruby",
"bytes": "1115"
},
{
"name": "Shell",
"bytes": "4075"
},
{
"name": "TeX",
"bytes": "302785"
},
{
"name": "XSLT",
"bytes": "2185"
}
],
"symlink_target": ""
} |
import {Observable} from '../../Observable';
import {withLatestFrom} from '../../operator/withLatestFrom';
Observable.prototype.withLatestFrom = withLatestFrom;
export interface WithLatestFromSignature<T> {
<U>(...observables: Array<any>): Observable<U>;
}
declare module '../../Observable' {
interface Observable<T> {
withLatestFrom: WithLatestFromSignature<T>;
}
} | {
"content_hash": "10a083ba80ba51a2063a34146314eaaa",
"timestamp": "",
"source": "github",
"line_count": 14,
"max_line_length": 61,
"avg_line_length": 27.071428571428573,
"alnum_prop": 0.7229551451187335,
"repo_name": "SekibOmazic/myoo",
"id": "1a6b5c54f2bf19c9a83094e731ba1b10c62e407d",
"size": "379",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/add/operator/withLatestFrom.ts",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "TypeScript",
"bytes": "67413"
}
],
"symlink_target": ""
} |
#include "lib.h"
#include "buffer.h"
#include "istream.h"
#include "str.h"
#include "message-parser.h"
#include "rfc822-parser.h"
#include "rfc2231-parser.h"
#include "imap-parser.h"
#include "imap-quote.h"
#include "imap-envelope.h"
#include "imap-bodystructure.h"
#define DEFAULT_CHARSET \
"\"charset\" \"us-ascii\""
#define EMPTY_BODYSTRUCTURE \
"(\"text\" \"plain\" ("DEFAULT_CHARSET") NIL NIL \"7bit\" 0 0)"
#define NVL(str, nullstr) ((str) != NULL ? (str) : (nullstr))
static char *imap_get_string(pool_t pool, const char *value)
{
string_t *str = t_str_new(64);
imap_append_string(str, value);
return p_strdup(pool, str_c(str));
}
static void parse_content_type(struct message_part_body_data *data,
struct message_header_line *hdr)
{
struct rfc822_parser_context parser;
const char *value, *const *results;
string_t *str;
unsigned int i;
bool charset_found = FALSE;
rfc822_parser_init(&parser, hdr->full_value, hdr->full_value_len, NULL);
rfc822_skip_lwsp(&parser);
str = t_str_new(256);
if (rfc822_parse_content_type(&parser, str) < 0)
return;
/* Save content type and subtype */
value = str_c(str);
for (i = 0; value[i] != '\0'; i++) {
if (value[i] == '/') {
data->content_subtype =
imap_get_string(data->pool, value + i+1);
break;
}
}
str_truncate(str, i);
data->content_type = imap_get_string(data->pool, str_c(str));
/* parse parameters and save them */
str_truncate(str, 0);
rfc2231_parse(&parser, &results);
for (; *results != NULL; results += 2) {
if (strcasecmp(results[0], "charset") == 0)
charset_found = TRUE;
str_append_c(str, ' ');
imap_append_string(str, results[0]);
str_append_c(str, ' ');
imap_append_string(str, results[1]);
}
if (!charset_found &&
strcasecmp(data->content_type, "\"text\"") == 0) {
/* set a default charset */
str_append_c(str, ' ');
str_append(str, DEFAULT_CHARSET);
}
if (str_len(str) > 0) {
data->content_type_params =
p_strdup(data->pool, str_c(str) + 1);
}
}
static void parse_content_transfer_encoding(struct message_part_body_data *data,
struct message_header_line *hdr)
{
struct rfc822_parser_context parser;
string_t *str;
rfc822_parser_init(&parser, hdr->full_value, hdr->full_value_len, NULL);
rfc822_skip_lwsp(&parser);
str = t_str_new(256);
if (rfc822_parse_mime_token(&parser, str) >= 0) {
data->content_transfer_encoding =
imap_get_string(data->pool, str_c(str));
}
}
static void parse_content_disposition(struct message_part_body_data *data,
struct message_header_line *hdr)
{
struct rfc822_parser_context parser;
const char *const *results;
string_t *str;
rfc822_parser_init(&parser, hdr->full_value, hdr->full_value_len, NULL);
rfc822_skip_lwsp(&parser);
str = t_str_new(256);
if (rfc822_parse_mime_token(&parser, str) < 0)
return;
data->content_disposition = imap_get_string(data->pool, str_c(str));
/* parse parameters and save them */
str_truncate(str, 0);
rfc2231_parse(&parser, &results);
for (; *results != NULL; results += 2) {
str_append_c(str, ' ');
imap_append_string(str, results[0]);
str_append_c(str, ' ');
imap_append_string(str, results[1]);
}
if (str_len(str) > 0) {
data->content_disposition_params =
p_strdup(data->pool, str_c(str) + 1);
}
}
static void parse_content_language(const unsigned char *value, size_t value_len,
struct message_part_body_data *data)
{
struct rfc822_parser_context parser;
string_t *str;
/* Language-Header = "Content-Language" ":" 1#Language-tag
Language-Tag = Primary-tag *( "-" Subtag )
Primary-tag = 1*8ALPHA
Subtag = 1*8ALPHA */
rfc822_parser_init(&parser, value, value_len, NULL);
str = t_str_new(128);
str_append_c(str, '"');
rfc822_skip_lwsp(&parser);
while (rfc822_parse_atom(&parser, str) >= 0) {
str_append(str, "\" \"");
if (parser.data == parser.end || *parser.data != ',')
break;
parser.data++;
rfc822_skip_lwsp(&parser);
}
if (str_len(str) > 1) {
str_truncate(str, str_len(str) - 2);
data->content_language = p_strdup(data->pool, str_c(str));
}
}
static void parse_content_header(struct message_part_body_data *d,
struct message_header_line *hdr,
pool_t pool)
{
const char *name = hdr->name + strlen("Content-");
const char *value;
if (hdr->continues) {
hdr->use_full_value = TRUE;
return;
}
value = t_strndup(hdr->full_value, hdr->full_value_len);
switch (*name) {
case 'i':
case 'I':
if (strcasecmp(name, "ID") == 0 && d->content_id == NULL)
d->content_id = imap_get_string(pool, value);
break;
case 'm':
case 'M':
if (strcasecmp(name, "MD5") == 0 && d->content_md5 == NULL)
d->content_md5 = imap_get_string(pool, value);
break;
case 't':
case 'T':
if (strcasecmp(name, "Type") == 0 && d->content_type == NULL)
parse_content_type(d, hdr);
else if (strcasecmp(name, "Transfer-Encoding") == 0 &&
d->content_transfer_encoding == NULL)
parse_content_transfer_encoding(d, hdr);
break;
case 'l':
case 'L':
if (strcasecmp(name, "Language") == 0 &&
d->content_language == NULL) {
parse_content_language(hdr->full_value,
hdr->full_value_len, d);
} else if (strcasecmp(name, "Location") == 0 &&
d->content_location == NULL) {
d->content_location = imap_get_string(pool, value);
}
break;
case 'd':
case 'D':
if (strcasecmp(name, "Description") == 0 &&
d->content_description == NULL)
d->content_description = imap_get_string(pool, value);
else if (strcasecmp(name, "Disposition") == 0 &&
d->content_disposition_params == NULL)
parse_content_disposition(d, hdr);
break;
}
}
void imap_bodystructure_parse_header(pool_t pool, struct message_part *part,
struct message_header_line *hdr)
{
struct message_part_body_data *part_data;
struct message_part_envelope_data *envelope;
bool parent_rfc822;
if (hdr == NULL) {
if (part->context == NULL) {
/* no Content-* headers. add an empty context
structure anyway. */
part->context = part_data =
p_new(pool, struct message_part_body_data, 1);
part_data->pool = pool;
} else if ((part->flags & MESSAGE_PART_FLAG_IS_MIME) == 0) {
/* If there was no Mime-Version, forget all
the Content-stuff */
part_data = part->context;
envelope = part_data->envelope;
memset(part_data, 0, sizeof(*part_data));
part_data->pool = pool;
part_data->envelope = envelope;
}
return;
}
if (hdr->eoh)
return;
parent_rfc822 = part->parent != NULL &&
(part->parent->flags & MESSAGE_PART_FLAG_MESSAGE_RFC822) != 0;
if (!parent_rfc822 && strncasecmp(hdr->name, "Content-", 8) != 0)
return;
if (part->context == NULL) {
/* initialize message part data */
part->context = part_data =
p_new(pool, struct message_part_body_data, 1);
part_data->pool = pool;
}
part_data = part->context;
if (strncasecmp(hdr->name, "Content-", 8) == 0) {
T_BEGIN {
parse_content_header(part_data, hdr, pool);
} T_END;
}
if (parent_rfc822) {
/* message/rfc822, we need the envelope */
imap_envelope_parse_header(pool, &part_data->envelope, hdr);
}
}
static void
imap_bodystructure_write_siblings(const struct message_part *part,
string_t *dest, bool extended)
{
for (; part != NULL; part = part->next) {
str_append_c(dest, '(');
imap_bodystructure_write(part, dest, extended);
str_append_c(dest, ')');
}
}
static void
part_write_bodystructure_data_common(struct message_part_body_data *data,
string_t *str)
{
str_append_c(str, ' ');
if (data->content_disposition == NULL)
str_append(str, "NIL");
else {
str_append_c(str, '(');
str_append(str, data->content_disposition);
str_append_c(str, ' ');
if (data->content_disposition_params == NULL)
str_append(str, "NIL");
else {
str_append_c(str, '(');
str_append(str, data->content_disposition_params);
str_append_c(str, ')');
}
str_append_c(str, ')');
}
str_append_c(str, ' ');
if (data->content_language == NULL)
str_append(str, "NIL");
else {
str_append_c(str, '(');
str_append(str, data->content_language);
str_append_c(str, ')');
}
str_append_c(str, ' ');
str_append(str, NVL(data->content_location, "NIL"));
}
static void part_write_body_multipart(const struct message_part *part,
string_t *str, bool extended)
{
struct message_part_body_data *data = part->context;
if (part->children != NULL)
imap_bodystructure_write_siblings(part->children, str, extended);
else {
/* no parts in multipart message,
that's not allowed. write a single
0-length text/plain structure */
str_append(str, EMPTY_BODYSTRUCTURE);
}
str_append_c(str, ' ');
if (data->content_subtype != NULL)
str_append(str, data->content_subtype);
else
str_append(str, "\"x-unknown\"");
if (!extended)
return;
/* BODYSTRUCTURE data */
str_append_c(str, ' ');
if (data->content_type_params == NULL)
str_append(str, "NIL");
else {
str_append_c(str, '(');
str_append(str, data->content_type_params);
str_append_c(str, ')');
}
part_write_bodystructure_data_common(data, str);
}
static void part_write_body(const struct message_part *part,
string_t *str, bool extended)
{
struct message_part_body_data *data = part->context;
bool text;
if (part->flags & MESSAGE_PART_FLAG_MESSAGE_RFC822) {
str_append(str, "\"message\" \"rfc822\"");
text = FALSE;
} else {
/* "content type" "subtype" */
text = data->content_type == NULL ||
strcasecmp(data->content_type, "\"text\"") == 0;
str_append(str, NVL(data->content_type, "\"text\""));
str_append_c(str, ' ');
if (data->content_subtype != NULL)
str_append(str, data->content_subtype);
else {
if (text)
str_append(str, "\"plain\"");
else
str_append(str, "\"unknown\"");
}
}
/* ("content type param key" "value" ...) */
str_append_c(str, ' ');
if (data->content_type_params == NULL) {
if (!text)
str_append(str, "NIL");
else
str_append(str, "("DEFAULT_CHARSET")");
} else {
str_append_c(str, '(');
str_append(str, data->content_type_params);
str_append_c(str, ')');
}
str_printfa(str, " %s %s %s %"PRIuUOFF_T,
NVL(data->content_id, "NIL"),
NVL(data->content_description, "NIL"),
NVL(data->content_transfer_encoding, "\"7bit\""),
part->body_size.virtual_size);
if (text) {
/* text/.. contains line count */
str_printfa(str, " %u", part->body_size.lines);
} else if (part->flags & MESSAGE_PART_FLAG_MESSAGE_RFC822) {
/* message/rfc822 contains envelope + body + line count */
struct message_part_body_data *child_data;
i_assert(part->children != NULL);
i_assert(part->children->next == NULL);
child_data = part->children->context;
str_append(str, " (");
if (child_data->envelope_str != NULL)
str_append(str, child_data->envelope_str);
else
imap_envelope_write_part_data(child_data->envelope, str);
str_append(str, ") ");
imap_bodystructure_write_siblings(part->children, str, extended);
str_printfa(str, " %u", part->body_size.lines);
}
if (!extended)
return;
/* BODYSTRUCTURE data */
/* "md5" ("content disposition" ("disposition" "params"))
("body" "language" "params") "location" */
str_append_c(str, ' ');
str_append(str, NVL(data->content_md5, "NIL"));
part_write_bodystructure_data_common(data, str);
}
bool imap_bodystructure_is_plain_7bit(const struct message_part *part)
{
const struct message_part_body_data *data = part->context;
i_assert(part->parent == NULL);
/* if content-type is text/xxx we don't have to check any
multipart stuff */
if ((part->flags & MESSAGE_PART_FLAG_TEXT) == 0)
return FALSE;
if (part->next != NULL || part->children != NULL)
return FALSE; /* shouldn't happen normally.. */
/* must be text/plain */
if (data->content_subtype != NULL &&
strcasecmp(data->content_subtype, "\"plain\"") != 0)
return FALSE;
/* only allowed parameter is charset=us-ascii, which is also default */
if (data->content_type_params != NULL &&
strcasecmp(data->content_type_params, DEFAULT_CHARSET) != 0)
return FALSE;
if (data->content_id != NULL ||
data->content_description != NULL)
return FALSE;
if (data->content_transfer_encoding != NULL &&
strcasecmp(data->content_transfer_encoding, "\"7bit\"") != 0)
return FALSE;
/* BODYSTRUCTURE checks: */
if (data->content_md5 != NULL ||
data->content_disposition != NULL ||
data->content_language != NULL ||
data->content_location != NULL)
return FALSE;
return TRUE;
}
void imap_bodystructure_write(const struct message_part *part,
string_t *dest, bool extended)
{
if (part->flags & MESSAGE_PART_FLAG_MULTIPART)
part_write_body_multipart(part, dest, extended);
else
part_write_body(part, dest, extended);
}
static bool str_append_nstring(string_t *str, const struct imap_arg *arg)
{
const char *cstr;
if (!imap_arg_get_nstring(arg, &cstr))
return FALSE;
switch (arg->type) {
case IMAP_ARG_NIL:
str_append(str, "NIL");
break;
case IMAP_ARG_ATOM:
str_append(str, cstr);
break;
case IMAP_ARG_STRING:
str_append_c(str, '"');
/* NOTE: we're parsing with no-unescape flag,
so don't double-escape it here */
str_append(str, cstr);
str_append_c(str, '"');
break;
case IMAP_ARG_LITERAL: {
str_printfa(str, "{%"PRIuSIZE_T"}\r\n", strlen(cstr));
str_append(str, cstr);
break;
}
default:
i_unreached();
return FALSE;
}
return TRUE;
}
static bool
get_nstring(const struct imap_arg *arg, pool_t pool, string_t *tmpstr,
const char **value_r)
{
if (arg->type == IMAP_ARG_NIL) {
*value_r = NULL;
return TRUE;
}
str_truncate(tmpstr, 0);
if (!str_append_nstring(tmpstr, arg))
return FALSE;
*value_r = p_strdup(pool, str_c(tmpstr));
return TRUE;
}
static void imap_write_list(const struct imap_arg *args, string_t *str)
{
const struct imap_arg *children;
/* don't do any typechecking, just write it out */
while (!IMAP_ARG_IS_EOL(args)) {
if (!str_append_nstring(str, args)) {
if (!imap_arg_get_list(args, &children)) {
/* everything is either nstring or list */
i_unreached();
}
str_append_c(str, '(');
imap_write_list(children, str);
str_append_c(str, ')');
}
args++;
if (!IMAP_ARG_IS_EOL(args))
str_append_c(str, ' ');
}
}
static int imap_write_nstring_list(const struct imap_arg *args, string_t *str)
{
str_truncate(str, 0);
while (!IMAP_ARG_IS_EOL(args)) {
if (!str_append_nstring(str, &args[0]))
return -1;
args++;
if (IMAP_ARG_IS_EOL(args))
break;
str_append_c(str, ' ');
}
return 0;
}
static int imap_write_params(const struct imap_arg *arg, pool_t pool,
string_t *tmpstr, unsigned int divisible,
const char **value_r)
{
const struct imap_arg *list_args;
unsigned int list_count;
if (arg->type == IMAP_ARG_NIL) {
*value_r = NULL;
return 0;
}
if (!imap_arg_get_list_full(arg, &list_args, &list_count))
return -1;
if ((list_count % divisible) != 0)
return -1;
if (imap_write_nstring_list(list_args, tmpstr) < 0)
return -1;
*value_r = p_strdup(pool, str_c(tmpstr));
return 0;
}
static int
imap_bodystructure_parse_lines(const struct imap_arg *arg,
const struct message_part *part,
const char **error_r)
{
const char *value;
unsigned int lines;
if (!imap_arg_get_atom(arg, &value) ||
str_to_uint(value, &lines) < 0) {
*error_r = "Invalid lines field";
return -1;
}
if (lines != part->body_size.lines) {
*error_r = "message_part lines doesn't match lines in BODYSTRUCTURE";
return -1;
}
return 0;
}
static int
imap_bodystructure_parse_args_common(struct message_part_body_data *data,
pool_t pool, string_t *tmpstr,
const struct imap_arg *args,
const char **error_r)
{
const struct imap_arg *list_args;
if (args->type == IMAP_ARG_NIL)
args++;
else if (!imap_arg_get_list(args, &list_args)) {
*error_r = "Invalid content-disposition list";
return -1;
} else {
if (!get_nstring(list_args++, pool, tmpstr,
&data->content_disposition)) {
*error_r = "Invalid content-disposition";
return -1;
}
if (imap_write_params(list_args, pool, tmpstr, 2,
&data->content_disposition_params) < 0) {
*error_r = "Invalid content-disposition params";
return -1;
}
args++;
}
if (imap_write_params(args++, pool, tmpstr, 1,
&data->content_language) < 0) {
*error_r = "Invalid content-language";
return -1;
}
if (!get_nstring(args++, pool, tmpstr, &data->content_location)) {
*error_r = "Invalid content-location";
return -1;
}
return 0;
}
static int
imap_bodystructure_parse_args(const struct imap_arg *args, pool_t pool,
struct message_part *part, string_t *tmpstr,
const char **error_r)
{
struct message_part_body_data *data;
struct message_part *child_part;
const struct imap_arg *list_args;
const char *value, *content_type, *subtype;
uoff_t vsize;
bool multipart, text, message_rfc822;
i_assert(part->context == NULL);
part->context = data = p_new(pool, struct message_part_body_data, 1);
data->pool = pool;
multipart = FALSE;
child_part = part->children;
while (args->type == IMAP_ARG_LIST) {
if ((part->flags & MESSAGE_PART_FLAG_MULTIPART) == 0 ||
child_part == NULL) {
*error_r = "message_part hierarchy doesn't match BODYSTRUCTURE";
return -1;
}
list_args = imap_arg_as_list(args);
if (imap_bodystructure_parse_args(list_args, pool,
child_part, tmpstr,
error_r) < 0)
return -1;
child_part = child_part->next;
multipart = TRUE;
args++;
}
if (multipart) {
if (child_part != NULL) {
*error_r = "message_part hierarchy doesn't match BODYSTRUCTURE";
return -1;
}
data->content_type = "\"multipart\"";
if (!get_nstring(args++, pool, tmpstr, &data->content_subtype)) {
*error_r = "Invalid multipart content-type";
return -1;
}
if (imap_write_params(args++, pool, tmpstr, 2,
&data->content_type_params) < 0) {
*error_r = "Invalid content params";
return -1;
}
return imap_bodystructure_parse_args_common(data, pool, tmpstr,
args, error_r);
}
if ((part->flags & MESSAGE_PART_FLAG_MULTIPART) != 0) {
*error_r = "message_part multipart flag doesn't match BODYSTRUCTURE";
return -1;
}
/* "content type" "subtype" */
if (!imap_arg_get_astring(&args[0], &content_type) ||
!imap_arg_get_astring(&args[1], &subtype)) {
*error_r = "Invalid content-type";
return -1;
}
if (!get_nstring(&args[0], pool, tmpstr, &data->content_type) ||
!get_nstring(&args[1], pool, tmpstr, &data->content_subtype))
i_unreached();
args += 2;
text = strcasecmp(content_type, "text") == 0;
message_rfc822 = strcasecmp(content_type, "message") == 0 &&
strcasecmp(subtype, "rfc822") == 0;
if (text != ((part->flags & MESSAGE_PART_FLAG_TEXT) != 0)) {
*error_r = "message_part text flag doesn't match BODYSTRUCTURE";
return -1;
}
if (message_rfc822 != ((part->flags & MESSAGE_PART_FLAG_MESSAGE_RFC822) != 0)) {
*error_r = "message_part message/rfc822 flag doesn't match BODYSTRUCTURE";
return -1;
}
/* ("content type param key" "value" ...) | NIL */
if (imap_write_params(args++, pool, tmpstr, 2,
&data->content_type_params) < 0) {
*error_r = "Invalid content params";
return -1;
}
/* "content id" "content description" "transfer encoding" size */
if (!get_nstring(args++, pool, tmpstr, &data->content_id)) {
*error_r = "Invalid content-id";
return -1;
}
if (!get_nstring(args++, pool, tmpstr, &data->content_description)) {
*error_r = "Invalid content-description";
return -1;
}
if (!get_nstring(args++, pool, tmpstr, &data->content_transfer_encoding)) {
*error_r = "Invalid content-transfer-encoding";
return -1;
}
if (!imap_arg_get_atom(args++, &value) ||
str_to_uoff(value, &vsize) < 0) {
*error_r = "Invalid size field";
return -1;
}
if (vsize != part->body_size.virtual_size) {
*error_r = "message_part virtual_size doesn't match "
"size in BODYSTRUCTURE";
return -1;
}
if (text) {
/* text/xxx - text lines */
if (imap_bodystructure_parse_lines(args, part, error_r) < 0)
return -1;
args++;
i_assert(part->children == NULL);
} else if (message_rfc822) {
/* message/rfc822 - envelope + bodystructure + text lines */
struct message_part_body_data *child_data;
i_assert(part->children != NULL &&
part->children->next == NULL);
if (!imap_arg_get_list(&args[1], &list_args)) {
*error_r = "Child bodystructure list expected";
return -1;
}
if (imap_bodystructure_parse_args(list_args, pool,
part->children,
tmpstr, error_r) < 0)
return -1;
/* save envelope to the child's context data */
if (!imap_arg_get_list(&args[0], &list_args)) {
*error_r = "Envelope list expected";
return -1;
}
str_truncate(tmpstr, 0);
imap_write_list(list_args, tmpstr);
child_data = part->children->context;
child_data->envelope_str = p_strdup(pool, str_c(tmpstr));
args += 2;
if (imap_bodystructure_parse_lines(args, part, error_r) < 0)
return -1;
args++;
} else {
i_assert(part->children == NULL);
}
if (!get_nstring(args++, pool, tmpstr, &data->content_md5)) {
*error_r = "Invalid content-description";
return -1;
}
return imap_bodystructure_parse_args_common(data, pool, tmpstr,
args, error_r);
}
int imap_bodystructure_parse(const char *bodystructure, pool_t pool,
struct message_part *parts, const char **error_r)
{
struct istream *input;
struct imap_parser *parser;
const struct imap_arg *args;
int ret;
bool fatal;
i_assert(parts != NULL);
i_assert(parts->next == NULL);
input = i_stream_create_from_data(bodystructure, strlen(bodystructure));
(void)i_stream_read(input);
parser = imap_parser_create(input, NULL, (size_t)-1);
ret = imap_parser_finish_line(parser, 0, IMAP_PARSE_FLAG_NO_UNESCAPE |
IMAP_PARSE_FLAG_LITERAL_TYPE, &args);
if (ret < 0) {
*error_r = t_strdup_printf("IMAP parser failed: %s",
imap_parser_get_error(parser, &fatal));
} else if (ret == 0) {
*error_r = "Empty bodystructure";
ret = -1;
} else T_BEGIN {
string_t *tmpstr = t_str_new(256);
ret = imap_bodystructure_parse_args(args, pool, parts,
tmpstr, error_r);
} T_END;
imap_parser_unref(&parser);
i_stream_destroy(&input);
return ret;
}
static int imap_parse_bodystructure_args(const struct imap_arg *args,
string_t *str, const char **error_r)
{
const struct imap_arg *subargs;
const struct imap_arg *list_args;
const char *value, *content_type, *subtype;
bool multipart, text, message_rfc822;
int i;
multipart = FALSE;
while (args->type == IMAP_ARG_LIST) {
str_append_c(str, '(');
list_args = imap_arg_as_list(args);
if (imap_parse_bodystructure_args(list_args, str, error_r) < 0)
return -1;
str_append_c(str, ')');
multipart = TRUE;
args++;
}
if (multipart) {
/* next is subtype of Content-Type. rest is skipped. */
str_append_c(str, ' ');
if (!str_append_nstring(str, args)) {
*error_r = "Invalid multipart content-type";
return -1;
}
return 0;
}
/* "content type" "subtype" */
if (!imap_arg_get_astring(&args[0], &content_type) ||
!imap_arg_get_astring(&args[1], &subtype)) {
*error_r = "Invalid content-type";
return -1;
}
if (!str_append_nstring(str, &args[0]))
i_unreached();
str_append_c(str, ' ');
if (!str_append_nstring(str, &args[1]))
i_unreached();
text = strcasecmp(content_type, "text") == 0;
message_rfc822 = strcasecmp(content_type, "message") == 0 &&
strcasecmp(subtype, "rfc822") == 0;
args += 2;
/* ("content type param key" "value" ...) | NIL */
if (imap_arg_get_list(args, &subargs)) {
str_append(str, " (");
while (!IMAP_ARG_IS_EOL(subargs)) {
if (!str_append_nstring(str, &subargs[0])) {
*error_r = "Invalid content param key";
return -1;
}
str_append_c(str, ' ');
if (!str_append_nstring(str, &subargs[1])) {
*error_r = "Invalid content param value";
return -1;
}
subargs += 2;
if (IMAP_ARG_IS_EOL(subargs))
break;
str_append_c(str, ' ');
}
str_append(str, ")");
} else if (args->type == IMAP_ARG_NIL) {
str_append(str, " NIL");
} else {
*error_r = "list/NIL expected";
return -1;
}
args++;
/* "content id" "content description" "transfer encoding" size */
for (i = 0; i < 4; i++, args++) {
str_append_c(str, ' ');
if (!str_append_nstring(str, args)) {
*error_r = "nstring expected";
return -1;
}
}
if (text) {
/* text/xxx - text lines */
if (!imap_arg_get_atom(args, &value)) {
*error_r = "Text lines expected";
return -1;
}
str_append_c(str, ' ');
str_append(str, value);
} else if (message_rfc822) {
/* message/rfc822 - envelope + bodystructure + text lines */
str_append_c(str, ' ');
if (!imap_arg_get_list(&args[0], &list_args)) {
*error_r = "Envelope list expected";
return -1;
}
str_append_c(str, '(');
imap_write_list(list_args, str);
str_append(str, ") (");
if (!imap_arg_get_list(&args[1], &list_args)) {
*error_r = "Child bodystructure list expected";
return -1;
}
if (imap_parse_bodystructure_args(list_args, str, error_r) < 0)
return -1;
str_append(str, ") ");
if (!imap_arg_get_atom(&args[2], &value)) {
*error_r = "Text lines expected";
return -1;
}
str_append(str, value);
}
return 0;
}
int imap_body_parse_from_bodystructure(const char *bodystructure,
string_t *dest, const char **error_r)
{
struct istream *input;
struct imap_parser *parser;
const struct imap_arg *args;
bool fatal;
int ret;
input = i_stream_create_from_data(bodystructure, strlen(bodystructure));
(void)i_stream_read(input);
parser = imap_parser_create(input, NULL, (size_t)-1);
ret = imap_parser_finish_line(parser, 0, IMAP_PARSE_FLAG_NO_UNESCAPE |
IMAP_PARSE_FLAG_LITERAL_TYPE, &args);
if (ret < 0) {
*error_r = t_strdup_printf("IMAP parser failed: %s",
imap_parser_get_error(parser, &fatal));
} else if (ret == 0) {
*error_r = "Empty bodystructure";
ret = -1;
} else {
ret = imap_parse_bodystructure_args(args, dest, error_r);
}
imap_parser_unref(&parser);
i_stream_destroy(&input);
return ret;
}
| {
"content_hash": "635f8c060dc330e2f8cf2271ff13f4fa",
"timestamp": "",
"source": "github",
"line_count": 1009,
"max_line_length": 81,
"avg_line_length": 25.93954410307235,
"alnum_prop": 0.6313758453367975,
"repo_name": "jwm/dovecot-notmuch",
"id": "b52f06810e5e1aaf82d4e093341d00f474776dbd",
"size": "26249",
"binary": false,
"copies": "4",
"ref": "refs/heads/master",
"path": "src/lib-imap/imap-bodystructure.c",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C",
"bytes": "10056497"
},
{
"name": "C++",
"bytes": "63489"
},
{
"name": "Objective-C",
"bytes": "12452"
},
{
"name": "Perl",
"bytes": "8162"
},
{
"name": "Python",
"bytes": "1626"
},
{
"name": "Shell",
"bytes": "10547"
}
],
"symlink_target": ""
} |
package cn.org.eshow.webapp.action;
import cn.org.eshow.bean.query.InfoQuery;
import cn.org.eshow.common.page.Page;
import cn.org.eshow.model.Info;
import cn.org.eshow.service.InfoManager;
import cn.org.eshow.util.PageUtil;
import cn.org.eshow.webapp.util.RenderUtil;
import org.apache.struts2.convention.annotation.AllowedMethods;
import org.apache.struts2.convention.annotation.Result;
import org.apache.struts2.convention.annotation.Results;
import org.springframework.beans.factory.annotation.Autowired;
import java.util.List;
@Results({@Result(name = "input", location = "add"),
@Result(name = "list", type = "redirect", location = ""),
@Result(name = "success", type = "redirect", location = "view/${id}"),
@Result(name = "redirect", type = "redirect", location = "${redirect}")})
@AllowedMethods({"list","search","delete","view","browse","update","save"})
public class InfoAction extends BaseAction {
private static final long serialVersionUID = 1L;
@Autowired
private InfoManager infoManager;
private List<Info> infos;
private Info info;
private InfoQuery query = new InfoQuery();
/**
*
* @return
*/
public String search() {
Page<Info> page = infoManager.search(query);
infos = page.getDataList();
saveRequest("page", PageUtil.conversion(page));
saveRequest("query", query);
return LIST;
}
/**
*
*/
public void delete() {
info = infoManager.get(id);
if (info != null) {
info.setEnabled(Boolean.FALSE);
infoManager.save(info);
RenderUtil.success("删除成功");
} else {
RenderUtil.failure("参数不正确");
}
}
/**
*
* @return
*/
public String view() {
if (id != null) {
info = infoManager.get(id);
}
return NONE;
}
/**
*
* @return
*/
public String browse() {
if (info.getUrl() != null) {
query.setUrl(info.getUrl());
query.setWebsite(info.getWebsite());
info = infoManager.browse(query);
}
return NONE;
}
/**
*
* @return
* @throws Exception
*/
public String update() throws Exception {
Info old = infoManager.get(id);
old.setTitle(info.getTitle() != null ? info.getTitle() : old.getTitle());
old.setContent(info.getContent() != null ? info.getContent() : old.getContent());
old.setUrl(info.getUrl() != null ? info.getUrl() : old.getUrl());
old.setRemark(info.getRemark() != null ? info.getRemark() : old.getRemark());
infoManager.save(old);
saveMessage("修改成功");
return REDIRECT;
}
/**
*
* @return
* @throws Exception
*/
public String save() throws Exception {
info.setType (info.getType() );
info.setUrl(info.getUrl());
info.setTitle(info.getTitle() );
info.setContent(info.getContent());
info.setRemark(info.getRemark());
info.setUser(getSessionUser());
info = infoManager.save(info);
id = info.getId();
saveMessage("添加成功");
return REDIRECT;
}
public List<Info> getInfos() {
return infos;
}
public void setInfos(List<Info> infos) {
this.infos = infos;
}
public Info getInfo() {
return info;
}
public void setInfo(Info info) {
this.info = info;
}
public InfoQuery getQuery() {
return query;
}
public void setQuery(InfoQuery query) {
this.query = query;
}
} | {
"content_hash": "73b458bd1362f77247de907d26300ed9",
"timestamp": "",
"source": "github",
"line_count": 141,
"max_line_length": 89,
"avg_line_length": 25.822695035460992,
"alnum_prop": 0.5800604229607251,
"repo_name": "bangqu/EShow",
"id": "25cb5b1c582de41977b2553c05195fb2beecdcda",
"size": "3675",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "eshow-manage/src/main/java/cn/org/eshow/webapp/action/InfoAction.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Batchfile",
"bytes": "1980"
},
{
"name": "CSS",
"bytes": "1466382"
},
{
"name": "FreeMarker",
"bytes": "24510"
},
{
"name": "HTML",
"bytes": "434139"
},
{
"name": "Java",
"bytes": "3171240"
},
{
"name": "JavaScript",
"bytes": "9010130"
},
{
"name": "PHP",
"bytes": "13594"
},
{
"name": "Shell",
"bytes": "63"
}
],
"symlink_target": ""
} |
var InitButton = (function(){
'use strict';
function InitButton(id, custom){
var _ = this;
_.args = {};
_.id = id.substr(1);
_.node = document.getElementById(_.id);
_.args.debug = false;
_.args.defaultInnerHtml = _.node.innerHTML;
for (var arg in custom){
this.args[arg] = custom[arg];
}
_.log(this);
}
InitButton.prototype.default = function(){
var _ = this;
_.changeText(_.args.defaultInnerHtml);
}
InitButton.prototype.changeText = function(text){
var _ = this;
if (text){
_.node.innerHTML = text;
_.log('changeText: '+text);
}else{
_.warn('please send a value to changeText function');
}
return this;
}
InitButton.prototype.changeTextDelay = function(text, time){
var _ = this;
time = time || 1000;
_.processing();
setTimeout(function(){
_.changeText(text);
$(_.node).removeClass('processing');
}, time)
_.log('changeText: "'+text+'" after '+(time/1000)+'s');
return this;
}
InitButton.prototype.disable = function(){
var _ = this, nodeName = _.node.nodeName;
$(_.node).addClass('disabled');
if(nodeName === 'BUTTON'){
_.node.setAttribute('disabled', 'disabled');
}else if(nodeName === 'A') {
var url = _.node.getAttribute('href');
_.node.setAttribute('href', '');
_.node.setAttribute('data-href', url);
};
return this;
}
InitButton.prototype.able = function(){
var _ = this, nodeName = _.node.nodeName;
$(_.node).removeClass('disabled');
if(nodeName === 'BUTTON'){
_.node.removeAttribute('disabled');
}else if(nodeName === 'A'){
var url = _.node.getAttribute('data-href');
_.node.removeAttribute('data-href');
_.node.setAttribute('href', url);
}
return this;
}
InitButton.prototype.processing = function(){
var _ = this;
$(_.node).addClass('processing');
_.node.innerHTML = '<div class="sk-three-bounce"><div class="sk-child sk-bounce1"></div><div class="sk-child sk-bounce2"></div><div class="sk-child sk-bounce3"></div></div>';
_.log('processing');
return this;
}
InitButton.prototype.bindFn = function(fn, args){
var _ = this;
fn.apply(this, args);
return this;
}
InitButton.prototype.bindClickFn = function(fn){
var _ = this;
$(_.node).bind('click', function(){
_.processing();
_.bindFn(fn);
});
_.log('bind click function');
return this;
}
InitButton.prototype.unbindClickFn = function(){
var _ = this;
$(_.node).unbind('click');
_.log('unbind click function');
return this;
}
InitButton.prototype.log = function(log, method){
var _ = this;
try{
if(_.args.debug === true){
console.info(log);
}
}catch(e){
console.warn(e);
}
}
InitButton.prototype.warn = function(log){
var _ = this;
try{
if(_.args.debug === true){
console.warn(log);
}
}catch(e){
console.warn(e);
}
}
jQuery.fn.extend({
InitButton: function(args){
var id = this.selector;
return new InitButton(id, args);
}
});
})(jQuery); | {
"content_hash": "32d81044219c9f833b44a86a1f4e81be",
"timestamp": "",
"source": "github",
"line_count": 132,
"max_line_length": 178,
"avg_line_length": 24.09090909090909,
"alnum_prop": 0.5679245283018868,
"repo_name": "uni-zheng/buttonjs",
"id": "393582174a7f665e2aca2cb9a0678d9f35813de8",
"size": "3180",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "dist/button.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "49702"
},
{
"name": "JavaScript",
"bytes": "3180"
},
{
"name": "Ruby",
"bytes": "892"
}
],
"symlink_target": ""
} |
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package com.intellij.codeInsight.completion;
import com.intellij.codeInsight.lookup.AutoCompletionPolicy;
import com.intellij.codeInsight.lookup.LookupElement;
import com.intellij.codeInsight.lookup.VariableLookupItem;
import com.intellij.featureStatistics.FeatureUsageTracker;
import com.intellij.psi.*;
import com.intellij.psi.util.PsiTreeUtil;
import com.intellij.psi.util.PsiUtil;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.util.List;
/**
* @author peter
*/
public class JavaStaticMemberProcessor extends StaticMemberProcessor {
private final PsiElement myOriginalPosition;
public JavaStaticMemberProcessor(CompletionParameters parameters) {
super(parameters.getPosition());
myOriginalPosition = parameters.getOriginalPosition();
final PsiFile file = parameters.getPosition().getContainingFile();
if (file instanceof PsiJavaFile) {
final PsiImportList importList = ((PsiJavaFile)file).getImportList();
if (importList != null) {
for (PsiImportStaticStatement statement : importList.getImportStaticStatements()) {
importMembersOf(statement.resolveTargetClass());
}
}
}
}
@Nullable
@Override
protected LookupElement createLookupElement(@NotNull PsiMember member, @NotNull final PsiClass containingClass, boolean shouldImport) {
shouldImport |= myOriginalPosition != null && PsiTreeUtil.isAncestor(containingClass, myOriginalPosition, false);
if (!PsiNameHelper.getInstance(member.getProject()).isIdentifier(member.getName(), PsiUtil.getLanguageLevel(getPosition()))) {
return null;
}
PsiReference ref = createReferenceToMemberName(member);
if (ref == null) return null;
if (ref instanceof PsiReferenceExpression && ((PsiReferenceExpression)ref).multiResolve(true).length > 0) {
shouldImport = false;
}
if (member instanceof PsiMethod) {
return AutoCompletionPolicy.NEVER_AUTOCOMPLETE.applyPolicy(new GlobalMethodCallElement((PsiMethod)member, shouldImport, false));
}
return AutoCompletionPolicy.NEVER_AUTOCOMPLETE.applyPolicy(new VariableLookupItem((PsiField)member, shouldImport) {
@Override
public void handleInsert(@NotNull InsertionContext context) {
FeatureUsageTracker.getInstance().triggerFeatureUsed(JavaCompletionFeatures.GLOBAL_MEMBER_NAME);
super.handleInsert(context);
}
});
}
private PsiReference createReferenceToMemberName(@NotNull PsiMember member) {
String exprText = member.getName() + (member instanceof PsiMethod ? "()" : "");
return JavaPsiFacade.getElementFactory(member.getProject()).createExpressionFromText(exprText, myOriginalPosition).findReferenceAt(0);
}
@Override
protected LookupElement createLookupElement(@NotNull List<PsiMethod> overloads,
@NotNull PsiClass containingClass,
boolean shouldImport) {
shouldImport |= myOriginalPosition != null && PsiTreeUtil.isAncestor(containingClass, myOriginalPosition, false);
final JavaMethodCallElement element = new GlobalMethodCallElement(overloads.get(0), shouldImport, true);
JavaCompletionUtil.putAllMethods(element, overloads);
return element;
}
private static class GlobalMethodCallElement extends JavaMethodCallElement {
GlobalMethodCallElement(PsiMethod member, boolean shouldImport, boolean mergedOverloads) {
super(member, shouldImport, mergedOverloads);
}
@Override
public void handleInsert(@NotNull InsertionContext context) {
FeatureUsageTracker.getInstance().triggerFeatureUsed(JavaCompletionFeatures.GLOBAL_MEMBER_NAME);
super.handleInsert(context);
}
}
}
| {
"content_hash": "583a9c0a7f46d50a726b77408ec85ebe",
"timestamp": "",
"source": "github",
"line_count": 94,
"max_line_length": 140,
"avg_line_length": 41.48936170212766,
"alnum_prop": 0.7494871794871795,
"repo_name": "goodwinnk/intellij-community",
"id": "37120f20cac2e681fdfdf1e15ddf6c23d8e08056",
"size": "3900",
"binary": false,
"copies": "4",
"ref": "refs/heads/master",
"path": "java/java-impl/src/com/intellij/codeInsight/completion/JavaStaticMemberProcessor.java",
"mode": "33188",
"license": "apache-2.0",
"language": [],
"symlink_target": ""
} |
layout: detail
--- | {
"content_hash": "fe89aafcf1e736d04f0ee6f23e7ac008",
"timestamp": "",
"source": "github",
"line_count": 2,
"max_line_length": 14,
"avg_line_length": 9,
"alnum_prop": 0.6666666666666666,
"repo_name": "sda17dev/prototype2",
"id": "48a3cac93706c0d868ad67a7f5654b487e16e328",
"size": "22",
"binary": false,
"copies": "3",
"ref": "refs/heads/master",
"path": "sub-series/3.html",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "103020"
},
{
"name": "HTML",
"bytes": "140094"
},
{
"name": "JavaScript",
"bytes": "854608"
}
],
"symlink_target": ""
} |
/*
* 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.
*/
/*
* This code was generated by https://github.com/googleapis/google-api-java-client-services/
* Modify at your own risk.
*/
package com.google.api.services.managedidentities.v1alpha1.model;
/**
* The response message for Locations.ListLocations.
*
* <p> This is the Java data model class that specifies how to parse/serialize into the JSON that is
* transmitted over HTTP when working with the Managed Service for Microsoft Active Directory API.
* For a detailed explanation see:
* <a href="https://developers.google.com/api-client-library/java/google-http-java-client/json">https://developers.google.com/api-client-library/java/google-http-java-client/json</a>
* </p>
*
* @author Google, Inc.
*/
@SuppressWarnings("javadoc")
public final class ListLocationsResponse extends com.google.api.client.json.GenericJson {
/**
* A list of locations that matches the specified filter in the request.
* The value may be {@code null}.
*/
@com.google.api.client.util.Key
private java.util.List<Location> locations;
/**
* The standard List next-page token.
* The value may be {@code null}.
*/
@com.google.api.client.util.Key
private java.lang.String nextPageToken;
/**
* A list of locations that matches the specified filter in the request.
* @return value or {@code null} for none
*/
public java.util.List<Location> getLocations() {
return locations;
}
/**
* A list of locations that matches the specified filter in the request.
* @param locations locations or {@code null} for none
*/
public ListLocationsResponse setLocations(java.util.List<Location> locations) {
this.locations = locations;
return this;
}
/**
* The standard List next-page token.
* @return value or {@code null} for none
*/
public java.lang.String getNextPageToken() {
return nextPageToken;
}
/**
* The standard List next-page token.
* @param nextPageToken nextPageToken or {@code null} for none
*/
public ListLocationsResponse setNextPageToken(java.lang.String nextPageToken) {
this.nextPageToken = nextPageToken;
return this;
}
@Override
public ListLocationsResponse set(String fieldName, Object value) {
return (ListLocationsResponse) super.set(fieldName, value);
}
@Override
public ListLocationsResponse clone() {
return (ListLocationsResponse) super.clone();
}
}
| {
"content_hash": "e77900d22721a7436ce8d742b0f4ceb8",
"timestamp": "",
"source": "github",
"line_count": 91,
"max_line_length": 182,
"avg_line_length": 32.285714285714285,
"alnum_prop": 0.7212389380530974,
"repo_name": "googleapis/google-api-java-client-services",
"id": "088d9368394e9d5d2b04f2fe008364cd8fe6599a",
"size": "2938",
"binary": false,
"copies": "3",
"ref": "refs/heads/main",
"path": "clients/google-api-services-managedidentities/v1alpha1/1.31.0/com/google/api/services/managedidentities/v1alpha1/model/ListLocationsResponse.java",
"mode": "33188",
"license": "apache-2.0",
"language": [],
"symlink_target": ""
} |
using UnityEngine;
using UnityEngine.SceneManagement;
using System.Collections;
using System;
public class CharacterSelection : MonoBehaviour {
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
}
public void ChooseCharacter(string character)
{
if (character == Constants.characters.Zj.ToString())
{
Variables.player = new Player(5, 50, 5, 50, "Zj");
}
else if(character == Constants.characters.Jesse.ToString())
{
Variables.player = new Player(10, 150, 1, 50, "Jesse");
}
else if(character == Constants.characters.John.ToString())
{
Variables.player = new Player(1, 100, 10, 100, "John");
}
else
{
throw new System.ArgumentException("Not a recognized character name!");
}
SceneManager.LoadScene("GameScreen");
}
}
| {
"content_hash": "fbdceb92f663daa1b2bd9e40e5883ac9",
"timestamp": "",
"source": "github",
"line_count": 40,
"max_line_length": 83,
"avg_line_length": 23.975,
"alnum_prop": 0.5870698644421272,
"repo_name": "jmccormack200/Stuntman",
"id": "4dfa57e64d7b6d7c872d48991885af56a9d48e1a",
"size": "961",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "Assets/Scripts/SceneScripts/CharacterSelection.cs",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C#",
"bytes": "53382"
},
{
"name": "HTML",
"bytes": "101378"
}
],
"symlink_target": ""
} |
SYNONYM
#### According to
The Catalogue of Life, 3rd January 2011
#### Published in
null
#### Original name
null
### Remarks
null | {
"content_hash": "171b1815dc7f6b99d1a8f2d503703683",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 39,
"avg_line_length": 10.23076923076923,
"alnum_prop": 0.6917293233082706,
"repo_name": "mdoering/backbone",
"id": "0ae0991c9d04d1dd3825eb58e77909ddaf05eaa6",
"size": "179",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "life/Plantae/Magnoliophyta/Liliopsida/Asparagales/Amaryllidaceae/Allium/Allium subvillosum/ Syn. Allium humbertii/README.md",
"mode": "33188",
"license": "apache-2.0",
"language": [],
"symlink_target": ""
} |
#include <linux/device.h>
#include <linux/signal.h>
#include <linux/platform_device.h>
#include <asm/mach-types.h>
#include <asm/hardware.h>
#include <asm/arch/pxa-regs.h>
#include <asm/arch/ohci.h>
#define PXA_UHC_MAX_PORTNUM 3
#define UHCRHPS(x) __REG2( 0x4C000050, (x)<<2 )
/*
PMM_NPS_MODE -- PMM Non-power switching mode
Ports are powered continuously.
PMM_GLOBAL_MODE -- PMM global switching mode
All ports are powered at the same time.
PMM_PERPORT_MODE -- PMM per port switching mode
Ports are powered individually.
*/
static int pxa27x_ohci_select_pmm( int mode )
{
switch ( mode ) {
case PMM_NPS_MODE:
UHCRHDA |= RH_A_NPS;
break;
case PMM_GLOBAL_MODE:
UHCRHDA &= ~(RH_A_NPS & RH_A_PSM);
break;
case PMM_PERPORT_MODE:
UHCRHDA &= ~(RH_A_NPS);
UHCRHDA |= RH_A_PSM;
/* Set port power control mask bits, only 3 ports. */
UHCRHDB |= (0x7<<17);
break;
default:
printk( KERN_ERR
"Invalid mode %d, set to non-power switch mode.\n",
mode );
UHCRHDA |= RH_A_NPS;
}
return 0;
}
extern int usb_disabled(void);
/*-------------------------------------------------------------------------*/
static int pxa27x_start_hc(struct device *dev)
{
int retval = 0;
struct pxaohci_platform_data *inf;
inf = dev->platform_data;
pxa_set_cken(CKEN10_USBHOST, 1);
UHCHR |= UHCHR_FHR;
udelay(11);
UHCHR &= ~UHCHR_FHR;
UHCHR |= UHCHR_FSBIR;
while (UHCHR & UHCHR_FSBIR)
cpu_relax();
if (inf->init)
retval = inf->init(dev);
if (retval < 0)
return retval;
UHCHR &= ~UHCHR_SSE;
UHCHIE = (UHCHIE_UPRIE | UHCHIE_RWIE);
/* Clear any OTG Pin Hold */
if (PSSR & PSSR_OTGPH)
PSSR |= PSSR_OTGPH;
return 0;
}
static void pxa27x_stop_hc(struct device *dev)
{
struct pxaohci_platform_data *inf;
inf = dev->platform_data;
if (inf->exit)
inf->exit(dev);
UHCHR |= UHCHR_FHR;
udelay(11);
UHCHR &= ~UHCHR_FHR;
UHCCOMS |= 1;
udelay(10);
pxa_set_cken(CKEN10_USBHOST, 0);
}
/*-------------------------------------------------------------------------*/
/* configure so an HC device and id are always provided */
/* always called with process context; sleeping is OK */
/**
* usb_hcd_pxa27x_probe - initialize pxa27x-based HCDs
* Context: !in_interrupt()
*
* Allocates basic resources for this USB host controller, and
* then invokes the start() method for the HCD associated with it
* through the hotplug entry's driver_data.
*
*/
int usb_hcd_pxa27x_probe (const struct hc_driver *driver, struct platform_device *pdev)
{
int retval;
struct usb_hcd *hcd;
struct pxaohci_platform_data *inf;
inf = pdev->dev.platform_data;
if (!inf)
return -ENODEV;
if (pdev->resource[1].flags != IORESOURCE_IRQ) {
pr_debug ("resource[1] is not IORESOURCE_IRQ");
return -ENOMEM;
}
hcd = usb_create_hcd (driver, &pdev->dev, "pxa27x");
if (!hcd)
return -ENOMEM;
hcd->rsrc_start = pdev->resource[0].start;
hcd->rsrc_len = pdev->resource[0].end - pdev->resource[0].start + 1;
if (!request_mem_region(hcd->rsrc_start, hcd->rsrc_len, hcd_name)) {
pr_debug("request_mem_region failed");
retval = -EBUSY;
goto err1;
}
hcd->regs = ioremap(hcd->rsrc_start, hcd->rsrc_len);
if (!hcd->regs) {
pr_debug("ioremap failed");
retval = -ENOMEM;
goto err2;
}
if ((retval = pxa27x_start_hc(&pdev->dev)) < 0) {
pr_debug("pxa27x_start_hc failed");
goto err3;
}
/* Select Power Management Mode */
pxa27x_ohci_select_pmm(inf->port_mode);
if (inf->power_budget)
hcd->power_budget = inf->power_budget;
ohci_hcd_init(hcd_to_ohci(hcd));
retval = usb_add_hcd(hcd, pdev->resource[1].start, IRQF_DISABLED);
if (retval == 0)
return retval;
pxa27x_stop_hc(&pdev->dev);
err3:
iounmap(hcd->regs);
err2:
release_mem_region(hcd->rsrc_start, hcd->rsrc_len);
err1:
usb_put_hcd(hcd);
return retval;
}
/* may be called without controller electrically present */
/* may be called with controller, bus, and devices active */
/**
* usb_hcd_pxa27x_remove - shutdown processing for pxa27x-based HCDs
* @dev: USB Host Controller being removed
* Context: !in_interrupt()
*
* Reverses the effect of usb_hcd_pxa27x_probe(), first invoking
* the HCD's stop() method. It is always called from a thread
* context, normally "rmmod", "apmd", or something similar.
*
*/
void usb_hcd_pxa27x_remove (struct usb_hcd *hcd, struct platform_device *pdev)
{
usb_remove_hcd(hcd);
pxa27x_stop_hc(&pdev->dev);
iounmap(hcd->regs);
release_mem_region(hcd->rsrc_start, hcd->rsrc_len);
usb_put_hcd(hcd);
}
/*-------------------------------------------------------------------------*/
static int __devinit
ohci_pxa27x_start (struct usb_hcd *hcd)
{
struct ohci_hcd *ohci = hcd_to_ohci (hcd);
int ret;
ohci_dbg (ohci, "ohci_pxa27x_start, ohci:%p", ohci);
/* The value of NDP in roothub_a is incorrect on this hardware */
ohci->num_ports = 3;
if ((ret = ohci_init(ohci)) < 0)
return ret;
if ((ret = ohci_run (ohci)) < 0) {
err ("can't start %s", hcd->self.bus_name);
ohci_stop (hcd);
return ret;
}
return 0;
}
/*-------------------------------------------------------------------------*/
static const struct hc_driver ohci_pxa27x_hc_driver = {
.description = hcd_name,
.product_desc = "PXA27x OHCI",
.hcd_priv_size = sizeof(struct ohci_hcd),
/*
* generic hardware linkage
*/
.irq = ohci_irq,
.flags = HCD_USB11 | HCD_MEMORY,
/*
* basic lifecycle operations
*/
.start = ohci_pxa27x_start,
.stop = ohci_stop,
.shutdown = ohci_shutdown,
/*
* managing i/o requests and associated device resources
*/
.urb_enqueue = ohci_urb_enqueue,
.urb_dequeue = ohci_urb_dequeue,
.endpoint_disable = ohci_endpoint_disable,
/*
* scheduling support
*/
.get_frame_number = ohci_get_frame,
/*
* root hub support
*/
.hub_status_data = ohci_hub_status_data,
.hub_control = ohci_hub_control,
.hub_irq_enable = ohci_rhsc_enable,
#ifdef CONFIG_PM
.bus_suspend = ohci_bus_suspend,
.bus_resume = ohci_bus_resume,
#endif
.start_port_reset = ohci_start_port_reset,
};
/*-------------------------------------------------------------------------*/
static int ohci_hcd_pxa27x_drv_probe(struct platform_device *pdev)
{
pr_debug ("In ohci_hcd_pxa27x_drv_probe");
if (usb_disabled())
return -ENODEV;
return usb_hcd_pxa27x_probe(&ohci_pxa27x_hc_driver, pdev);
}
static int ohci_hcd_pxa27x_drv_remove(struct platform_device *pdev)
{
struct usb_hcd *hcd = platform_get_drvdata(pdev);
usb_hcd_pxa27x_remove(hcd, pdev);
platform_set_drvdata(pdev, NULL);
return 0;
}
#ifdef CONFIG_PM
static int ohci_hcd_pxa27x_drv_suspend(struct platform_device *pdev, pm_message_t state)
{
struct usb_hcd *hcd = platform_get_drvdata(pdev);
struct ohci_hcd *ohci = hcd_to_ohci(hcd);
if (time_before(jiffies, ohci->next_statechange))
msleep(5);
ohci->next_statechange = jiffies;
pxa27x_stop_hc(&pdev->dev);
hcd->state = HC_STATE_SUSPENDED;
pdev->dev.power.power_state = PMSG_SUSPEND;
return 0;
}
static int ohci_hcd_pxa27x_drv_resume(struct platform_device *pdev)
{
struct usb_hcd *hcd = platform_get_drvdata(pdev);
struct ohci_hcd *ohci = hcd_to_ohci(hcd);
int status;
if (time_before(jiffies, ohci->next_statechange))
msleep(5);
ohci->next_statechange = jiffies;
if ((status = pxa27x_start_hc(&pdev->dev)) < 0)
return status;
pdev->dev.power.power_state = PMSG_ON;
usb_hcd_resume_root_hub(hcd);
return 0;
}
#endif
static struct platform_driver ohci_hcd_pxa27x_driver = {
.probe = ohci_hcd_pxa27x_drv_probe,
.remove = ohci_hcd_pxa27x_drv_remove,
.shutdown = usb_hcd_platform_shutdown,
#ifdef CONFIG_PM
.suspend = ohci_hcd_pxa27x_drv_suspend,
.resume = ohci_hcd_pxa27x_drv_resume,
#endif
.driver = {
.name = "pxa27x-ohci",
},
};
| {
"content_hash": "db6f14ebee6d0dd0f91ffdf55100ee71",
"timestamp": "",
"source": "github",
"line_count": 352,
"max_line_length": 88,
"avg_line_length": 21.946022727272727,
"alnum_prop": 0.6350809061488674,
"repo_name": "impedimentToProgress/UCI-BlueChip",
"id": "f1563dc319d36085276ff35b3030a3f584e07419",
"size": "8344",
"binary": false,
"copies": "12",
"ref": "refs/heads/master",
"path": "snapgear_linux/linux-2.6.21.1/drivers/usb/host/ohci-pxa27x.c",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "AGS Script",
"bytes": "25338"
},
{
"name": "ASP",
"bytes": "4526"
},
{
"name": "Ada",
"bytes": "1075367"
},
{
"name": "Assembly",
"bytes": "2137017"
},
{
"name": "Awk",
"bytes": "133306"
},
{
"name": "Bison",
"bytes": "399484"
},
{
"name": "BlitzBasic",
"bytes": "101509"
},
{
"name": "C",
"bytes": "288543995"
},
{
"name": "C++",
"bytes": "7495614"
},
{
"name": "CSS",
"bytes": "2128"
},
{
"name": "Clojure",
"bytes": "3747"
},
{
"name": "Common Lisp",
"bytes": "239683"
},
{
"name": "Elixir",
"bytes": "790"
},
{
"name": "Emacs Lisp",
"bytes": "45827"
},
{
"name": "Erlang",
"bytes": "171340"
},
{
"name": "GAP",
"bytes": "3002"
},
{
"name": "Groff",
"bytes": "4517911"
},
{
"name": "Groovy",
"bytes": "26513"
},
{
"name": "HTML",
"bytes": "8141161"
},
{
"name": "Java",
"bytes": "481441"
},
{
"name": "JavaScript",
"bytes": "339345"
},
{
"name": "Logos",
"bytes": "16160"
},
{
"name": "M",
"bytes": "2443"
},
{
"name": "Makefile",
"bytes": "1309237"
},
{
"name": "Max",
"bytes": "3812"
},
{
"name": "Nemerle",
"bytes": "966202"
},
{
"name": "Objective-C",
"bytes": "376270"
},
{
"name": "OpenEdge ABL",
"bytes": "69290"
},
{
"name": "PHP",
"bytes": "11533"
},
{
"name": "PLSQL",
"bytes": "8464"
},
{
"name": "Pascal",
"bytes": "54420"
},
{
"name": "Perl",
"bytes": "6498220"
},
{
"name": "Perl6",
"bytes": "4155"
},
{
"name": "Prolog",
"bytes": "62574"
},
{
"name": "Python",
"bytes": "24287"
},
{
"name": "QMake",
"bytes": "8619"
},
{
"name": "R",
"bytes": "25999"
},
{
"name": "Ruby",
"bytes": "31311"
},
{
"name": "SAS",
"bytes": "15573"
},
{
"name": "Scala",
"bytes": "1506"
},
{
"name": "Scilab",
"bytes": "23534"
},
{
"name": "Shell",
"bytes": "6951414"
},
{
"name": "Smalltalk",
"bytes": "2661"
},
{
"name": "Stata",
"bytes": "7930"
},
{
"name": "Tcl",
"bytes": "1518344"
},
{
"name": "TeX",
"bytes": "1574651"
},
{
"name": "UnrealScript",
"bytes": "20822"
},
{
"name": "VHDL",
"bytes": "37384578"
},
{
"name": "Verilog",
"bytes": "376626"
},
{
"name": "Visual Basic",
"bytes": "180"
},
{
"name": "XS",
"bytes": "24500"
},
{
"name": "XSLT",
"bytes": "5872"
}
],
"symlink_target": ""
} |
using Abp.AutoMapper;
using Abp.Localization;
using Abp.Localization.Dictionaries;
using Abp.Localization.Dictionaries.Json;
using Abp.Modules;
using Abp.Reflection.Extensions;
namespace AbpAspNetCoreDemo.Core
{
[DependsOn(typeof(AbpAutoMapperModule))]
public class AbpAspNetCoreDemoCoreModule : AbpModule
{
public override void PreInitialize()
{
Configuration.Auditing.IsEnabledForAnonymousUsers = true;
Configuration.Localization.Languages.Add(new LanguageInfo("en", "English", isDefault: true));
Configuration.Localization.Languages.Add(new LanguageInfo("tr", "Türkçe"));
Configuration.Localization.Sources.Add(
new DictionaryBasedLocalizationSource("AbpAspNetCoreDemoModule",
new JsonEmbeddedFileLocalizationDictionaryProvider(
typeof(AbpAspNetCoreDemoCoreModule).GetAssembly(),
"AbpAspNetCoreDemo.Core.Localization.SourceFiles"
)
)
);
}
public override void Initialize()
{
IocManager.RegisterAssemblyByConvention(typeof(AbpAspNetCoreDemoCoreModule).GetAssembly());
}
}
} | {
"content_hash": "af74f90d04051e80fa6a4c941207929b",
"timestamp": "",
"source": "github",
"line_count": 35,
"max_line_length": 105,
"avg_line_length": 35.31428571428572,
"alnum_prop": 0.6610032362459547,
"repo_name": "ryancyq/aspnetboilerplate",
"id": "34ad9b1171e8460f761074642104e5c3ebcc61bd",
"size": "1240",
"binary": false,
"copies": "6",
"ref": "refs/heads/dev",
"path": "test/aspnet-core-demo/AbpAspNetCoreDemo.Core/AbpAspNetCoreDemoCoreModule.cs",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Batchfile",
"bytes": "322"
},
{
"name": "C#",
"bytes": "4879008"
},
{
"name": "CSS",
"bytes": "15565"
},
{
"name": "HTML",
"bytes": "22841"
},
{
"name": "JavaScript",
"bytes": "119085"
},
{
"name": "PowerShell",
"bytes": "5493"
},
{
"name": "Shell",
"bytes": "2262"
},
{
"name": "TSQL",
"bytes": "1398"
}
],
"symlink_target": ""
} |
<!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_151) on Thu Mar 08 14:17:43 MST 2018 -->
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Uses of Class org.wildfly.swarm.keycloak.deployment.SecurityContextServletExtension (BOM: * : All 2018.3.3 API)</title>
<meta name="date" content="2018-03-08">
<link rel="stylesheet" type="text/css" href="../../../../../../stylesheet.css" title="Style">
<script type="text/javascript" src="../../../../../../script.js"></script>
</head>
<body>
<script type="text/javascript"><!--
try {
if (location.href.indexOf('is-external=true') == -1) {
parent.document.title="Uses of Class org.wildfly.swarm.keycloak.deployment.SecurityContextServletExtension (BOM: * : All 2018.3.3 API)";
}
}
catch(err) {
}
//-->
</script>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
<!-- ========= START OF TOP NAVBAR ======= -->
<div class="topNav"><a name="navbar.top">
<!-- -->
</a>
<div class="skipNav"><a href="#skip.navbar.top" title="Skip navigation links">Skip navigation links</a></div>
<a name="navbar.top.firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../../../overview-summary.html">Overview</a></li>
<li><a href="../package-summary.html">Package</a></li>
<li><a href="../../../../../../org/wildfly/swarm/keycloak/deployment/SecurityContextServletExtension.html" title="class in org.wildfly.swarm.keycloak.deployment">Class</a></li>
<li class="navBarCell1Rev">Use</li>
<li><a href="../../../../../../overview-tree.html">Tree</a></li>
<li><a href="../../../../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../../../../index-all.html">Index</a></li>
<li><a href="../../../../../../help-doc.html">Help</a></li>
</ul>
<div class="aboutLanguage">WildFly Swarm API, 2018.3.3</div>
</div>
<div class="subNav">
<ul class="navList">
<li>Prev</li>
<li>Next</li>
</ul>
<ul class="navList">
<li><a href="../../../../../../index.html?org/wildfly/swarm/keycloak/deployment/class-use/SecurityContextServletExtension.html" target="_top">Frames</a></li>
<li><a href="SecurityContextServletExtension.html" target="_top">No Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_top">
<li><a href="../../../../../../allclasses-noframe.html">All Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_top");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<a name="skip.navbar.top">
<!-- -->
</a></div>
<!-- ========= END OF TOP NAVBAR ========= -->
<div class="header">
<h2 title="Uses of Class org.wildfly.swarm.keycloak.deployment.SecurityContextServletExtension" class="title">Uses of Class<br>org.wildfly.swarm.keycloak.deployment.SecurityContextServletExtension</h2>
</div>
<div class="classUseContainer">No usage of org.wildfly.swarm.keycloak.deployment.SecurityContextServletExtension</div>
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<div class="bottomNav"><a name="navbar.bottom">
<!-- -->
</a>
<div class="skipNav"><a href="#skip.navbar.bottom" title="Skip navigation links">Skip navigation links</a></div>
<a name="navbar.bottom.firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../../../overview-summary.html">Overview</a></li>
<li><a href="../package-summary.html">Package</a></li>
<li><a href="../../../../../../org/wildfly/swarm/keycloak/deployment/SecurityContextServletExtension.html" title="class in org.wildfly.swarm.keycloak.deployment">Class</a></li>
<li class="navBarCell1Rev">Use</li>
<li><a href="../../../../../../overview-tree.html">Tree</a></li>
<li><a href="../../../../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../../../../index-all.html">Index</a></li>
<li><a href="../../../../../../help-doc.html">Help</a></li>
</ul>
<div class="aboutLanguage">WildFly Swarm API, 2018.3.3</div>
</div>
<div class="subNav">
<ul class="navList">
<li>Prev</li>
<li>Next</li>
</ul>
<ul class="navList">
<li><a href="../../../../../../index.html?org/wildfly/swarm/keycloak/deployment/class-use/SecurityContextServletExtension.html" target="_top">Frames</a></li>
<li><a href="SecurityContextServletExtension.html" target="_top">No Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_bottom">
<li><a href="../../../../../../allclasses-noframe.html">All Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_bottom");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<a name="skip.navbar.bottom">
<!-- -->
</a></div>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
<p class="legalCopy"><small>Copyright © 2018 <a href="http://www.jboss.org">JBoss by Red Hat</a>. All rights reserved.</small></p>
</body>
</html>
| {
"content_hash": "94202d0f7e784c7e8344eab919c881a0",
"timestamp": "",
"source": "github",
"line_count": 128,
"max_line_length": 201,
"avg_line_length": 40.5,
"alnum_prop": 0.6307870370370371,
"repo_name": "wildfly-swarm/wildfly-swarm-javadocs",
"id": "0eb46700cbd97757da39045717acc330ee60d3a7",
"size": "5184",
"binary": false,
"copies": "1",
"ref": "refs/heads/gh-pages",
"path": "2018.3.3/apidocs/org/wildfly/swarm/keycloak/deployment/class-use/SecurityContextServletExtension.html",
"mode": "33188",
"license": "apache-2.0",
"language": [],
"symlink_target": ""
} |
<?php
namespace R\Hive\Commands;
use Illuminate\Console\Command;
use Symfony\Component\Console\Input\InputArgument;
class AssembleCommand extends Command
{
protected $name = 'hive:assemble';
protected $description = 'Create a new Hive RESTful HTTP resource collection.';
public function fire()
{
$name = $this->argument('name');
$this->call('hive:instance', ['name' => $name, '-e' => 'bar', '-m' => 'bar']);
$this->call('hive:factory', ['name' => $name, '-i' => 'bar']);
$this->call('hive:repo', ['name' => $name, '-o' => 'bar']);
$this->call('hive:mutator', ['name' => $name.'Request', '-r' => 'bar']);
$this->call('hive:controller', ['name' => $name]);
}
protected function getArguments()
{
return [
['name', InputArgument::REQUIRED, 'The name of the instance.'],
];
}
}
| {
"content_hash": "af404f48aceb0066ffcac59e6362cb44",
"timestamp": "",
"source": "github",
"line_count": 31,
"max_line_length": 86,
"avg_line_length": 28.64516129032258,
"alnum_prop": 0.5619369369369369,
"repo_name": "r3oath/hive",
"id": "7c8414228fc201660d8c4a5b8e61b1df5c09de82",
"size": "888",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/Commands/AssembleCommand.php",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "PHP",
"bytes": "59668"
}
],
"symlink_target": ""
} |
package org.earthtime.UPb_Redux.dateInterpretation;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.MouseEvent;
import java.util.ArrayList;
import java.util.Vector;
import javax.swing.JMenuItem;
import javax.swing.JPopupMenu;
import javax.swing.JTree;
import javax.swing.event.TreeSelectionEvent;
import javax.swing.tree.DefaultMutableTreeNode;
import javax.swing.tree.DefaultTreeModel;
import javax.swing.tree.TreeNode;
import javax.swing.tree.TreePath;
import javax.swing.tree.TreeSelectionModel;
import org.earthtime.UPb_Redux.customJTrees.CheckBoxNode;
import org.earthtime.UPb_Redux.customJTrees.CheckBoxNodeEditor;
import org.earthtime.UPb_Redux.customJTrees.CheckBoxNodeRenderer;
import org.earthtime.UPb_Redux.dialogs.DialogEditor;
import org.earthtime.UPb_Redux.dialogs.sampleManagers.sampleDateInterpretationManagers.SampleDateInterpretationChooserDialog;
import org.earthtime.UPb_Redux.samples.Sample;
import org.earthtime.UPb_Redux.valueModels.SampleDateModel;
import org.earthtime.UPb_Redux.valueModels.ValueModel;
import org.earthtime.UPb_Redux.valueModels.ValueModelI;
import org.earthtime.aliquots.AliquotInterface;
import org.earthtime.dataDictionaries.SampleAnalysisTypesEnum;
import org.earthtime.samples.SampleInterface;
/**
*
* @author James F. Bowring
*/
public class SampleTreeCompilationMode extends JTree implements SampleTreeI {
// instance variables
private SampleInterface sample;
private SampleTreeChangeI sampleTreeChange;
private Object lastNodeSelected;
/**
* Creates a new instance of SampleTreeCompilationMode
*/
public SampleTreeCompilationMode () {
super();
sample = null;
}
/**
*
* @param mySample
*/
public SampleTreeCompilationMode ( SampleInterface mySample ) {
super( new DefaultMutableTreeNode( mySample ) );
sample = mySample;
CheckBoxNodeRenderer renderer = new CheckBoxNodeRenderer();
setCellRenderer( renderer );
setCellEditor( new CheckBoxNodeEditor( this ) );
setEditable( true );
setLastNodeSelected( null );
}
/**
*
*/
@Override
public void buildTree () {
this.removeAll();
// populate tree
// get a master vector of active fraction names
Vector<String> activeFractionIDs =//
sample.getSampleFractionIDs();
// load the sample date interpretations
for (int index = 0; index < sample.getSampleDateModels().size(); index ++) {
DefaultMutableTreeNode sampleDateModelNode =//
new DefaultMutableTreeNode(//
(SampleDateModel) sample.getSampleDateModels().get( index ) );
((DefaultMutableTreeNode) getModel().getRoot()).add( sampleDateModelNode );
// remove from activefractionIDs any fraction with 0 date
Vector<String> zeroFractionDates = new Vector<>();
for (int i = 0; i < activeFractionIDs.size(); i ++) {
if ( ! ((SampleDateModel) sample.getSampleDateModels().get( index )).//
fractionDateIsPositive( sample.getSampleFractionByName( activeFractionIDs.get( i ) ) ) ) {
zeroFractionDates.add( activeFractionIDs.get( i ) );
}
}
for (int i = 0; i < zeroFractionDates.size(); i ++) {
activeFractionIDs.remove( zeroFractionDates.get( i ) );
}
PopulateSampleDateModel(
activeFractionIDs,
sample,
sample.getSampleDateModels().get( index ),
sampleDateModelNode );
}
int row = getRowCount() - 1;
while (row >= 1) {
collapseRow( row );
row --;
}
DefaultMutableTreeNode rootNode = ((DefaultMutableTreeNode) getModel().getRoot());
for (int i = 0; i < rootNode.getChildCount(); i ++) {
try {
DefaultMutableTreeNode sampleDateNode = (DefaultMutableTreeNode) rootNode.getChildAt( i );
expandPath( new TreePath( sampleDateNode.getPath() ) );
} catch (Exception e) {
}
}
getSelectionModel().setSelectionMode( TreeSelectionModel.SINGLE_TREE_SELECTION );
//Listen for when the selection changes.
addTreeSelectionListener( this );
addMouseListener( this );
// set sample as default selection
setSelectionRow( 0 );
}
private void PopulateSampleDateModel (
Vector<String> activeFractionIDs,
SampleInterface sample,
ValueModel SAM,
DefaultMutableTreeNode SAMnode ) {
DefaultMutableTreeNode sampleDateValue = //
new DefaultMutableTreeNode(//
((SampleDateModel) SAM).ShowCustomDateNode() );
SAMnode.add( sampleDateValue );
DefaultMutableTreeNode sampleDateMSWD = //
new DefaultMutableTreeNode(//
((SampleDateModel) SAM).ShowCustomMSWDwithN() );
SAMnode.add( sampleDateMSWD );
if ( ((SampleDateModel) SAM).getMethodName().contains( "LowerIntercept" ) ) {
SAMnode.add( new DefaultMutableTreeNode( "See Upper Intercept Fractions" ) );
} else {
DefaultMutableTreeNode sampleDateFractions = //
new DefaultMutableTreeNode( "Aliquot Fractions" );
SAMnode.add( sampleDateFractions );
// organize fractions by aliquot for the user
// fractions are in order, just need to extract aliquot
// create checkbox for each fraction set to whether it is in list
String saveAliquotName = "";
DefaultMutableTreeNode aliquotNameNode = new DefaultMutableTreeNode( "NONE" );
for (String fracID : activeFractionIDs) {
String aliquotName = sample.getAliquotNameByFractionID( fracID );
if ( ! aliquotName.equalsIgnoreCase( saveAliquotName ) ) {
saveAliquotName = aliquotName;
aliquotNameNode = new DefaultMutableTreeNode( aliquotName );
sampleDateFractions.add( aliquotNameNode );
}
DefaultMutableTreeNode fractionNode = new DefaultMutableTreeNode( fracID );
fractionNode.setUserObject( //
new CheckBoxNode(
((SampleDateModel) SAM).showFractionIdWithDateAndUnct(//
sample.getSampleFractionByName( fracID ), "Ma" ),
((SampleDateModel) SAM).includesFractionByName( fracID ),
true ) );
aliquotNameNode.add( fractionNode );
}
}
}
/**
*
* @param e
*/
@Override
public void valueChanged ( TreeSelectionEvent e ) {
//Returns the last path element of the selection.
//This method is useful only when the selection model allows a single selection.
DefaultMutableTreeNode node = (DefaultMutableTreeNode) getLastSelectedPathComponent();
if ( node == null ) //Nothing is selected.
{
return;
}
setLastNodeSelected( node );
//System.out.println(e.getSource());
Object nodeInfo = node.getUserObject();
if ( nodeInfo instanceof Sample ) {
System.out.println( ((SampleInterface) nodeInfo).getSampleName() );
} else if ( nodeInfo instanceof AliquotInterface ) {
System.out.println(((AliquotInterface) nodeInfo).getAliquotName() );
} else if ( nodeInfo instanceof ValueModel ) {
System.out.println( ((ValueModelI) nodeInfo).getName() );
} else if ( nodeInfo instanceof CheckBoxNode ) {
System.out.println( nodeInfo.toString() );
// required for toggling because it allows re-focus
setSelectionRow( -1 );
} else {
System.out.println( nodeInfo.toString() );
}
getSampleTreeChange().sampleTreeChangeCompilationMode( node );
}
/**
*
* @param value
* @param selected
* @param expanded
* @param leaf
* @param row
* @param hasFocus
* @return
*/
@Override
public String convertValueToText ( Object value,
boolean selected,
boolean expanded,
boolean leaf,
int row,
boolean hasFocus ) {
Object o = ((DefaultMutableTreeNode) value).getUserObject();
if ( o instanceof Sample ) {
return ((SampleInterface) o).getSampleName();
} else if ( o instanceof AliquotInterface ) {
return ((AliquotInterface) o).getAliquotName();
} else if ( o instanceof ValueModel ) {
String displayName = ((ValueModelI) o).getName();
if ( ((SampleDateModel) o).isPreferred() ) {
displayName = "PREFERRED: " + displayName;
}
if ( ((SampleDateModel) o).isDisplayedAsGraph() ) {
displayName = "\u25CF " + displayName;
}
return displayName + " ";
} else if ( (o instanceof String) && (((String) o).startsWith( "date" )) ) {
return //
((SampleDateModel) ((DefaultMutableTreeNode) ((TreeNode) value).//
getParent()).getUserObject()).ShowCustomDateNode();
} else if ( (o instanceof String) && (((String) o).startsWith( "MSWD" )) ) {
return //
((SampleDateModel) ((DefaultMutableTreeNode) ((TreeNode) value).//
getParent()).getUserObject()).ShowCustomMSWDwithN() + " ";
} else {
return super.convertValueToText(
value,
selected,
expanded,
leaf,
row,
hasFocus );
}
}
/**
*
*/
@Override
public void performLastUserSelection () {
getSampleTreeChange().sampleTreeChangeCompilationMode( getLastNodeSelected() );//
}
// Provide for adding sample age interpretations
/**
*
* @param e
*/
@Override
public void mousePressed ( MouseEvent e ) {
int selRow = getRowForLocation( e.getX(), e.getY() );
TreePath selPath = getPathForLocation( e.getX(), e.getY() );
if ( selRow != -1 ) {
final DefaultMutableTreeNode node = (DefaultMutableTreeNode) selPath.getLastPathComponent();
final Object nodeInfo = node.getUserObject();
if ( ! e.isPopupTrigger() && (e.getButton() == MouseEvent.BUTTON1) ) {
} else if ( (e.isPopupTrigger()) || (e.getButton() == MouseEvent.BUTTON3) ) {
setSelectionPath( selPath );
if ( nodeInfo instanceof Sample ) {
DialogEditor myEditor =
new SampleDateInterpretationChooserDialog(
null,
true,
((SampleInterface) nodeInfo).determineUnusedSampleDateModels( false ) );
myEditor.setSize( 340, 395 );
DialogEditor.setDefaultLookAndFeelDecorated( true );
myEditor.setVisible( true );
// get a master vector of active fraction names
Vector<String> activeFractionIDs =//
((SampleInterface) nodeInfo).getSampleFractionIDs();
if ( ((SampleDateInterpretationChooserDialog) myEditor).getSelectedModels().size() > 0 ) {
DefaultMutableTreeNode sampleDateModelNode = null;
ArrayList<Integer> tempNewNodes = new ArrayList<Integer>();
for (ValueModel selectedSAM : ((SampleDateInterpretationChooserDialog) myEditor).getSelectedModels()) {
((SampleInterface) nodeInfo).getSampleDateModels().add( selectedSAM );
// feb 2013 add in SampleAnalysisTypesEnum for transition to logbased calcs starting with LAICPMS from raw
((SampleDateModel) selectedSAM).setSampleAnalysisType( SampleAnalysisTypesEnum.valueOf( sample.getSampleAnalysisType().trim() ) );
// fix up tree
sampleDateModelNode = new DefaultMutableTreeNode( selectedSAM );
// remove from activefractionIDs any fraction with 0 date
Vector<String> zeroFractionDates = new Vector<>();
for (String activeFractionID : activeFractionIDs) {
if (! //
((SampleDateModel) selectedSAM).fractionDateIsPositive(sample.getSampleFractionByName(activeFractionID))) {
zeroFractionDates.add(activeFractionID);
}
}
for (String zeroFractionDate : zeroFractionDates) {
activeFractionIDs.remove(zeroFractionDate);
}
PopulateSampleDateModel(
activeFractionIDs,
((SampleInterface) nodeInfo),
selectedSAM,
sampleDateModelNode );
node.add( sampleDateModelNode );
// save node indexes of inserted nodes
tempNewNodes.add( node.getChildCount() - 1 );
}
sample.updateSampleDateModels();
int[] newNodes = new int[tempNewNodes.size()];
for (int i = 0; i < tempNewNodes.size(); i ++) {
newNodes[i] = tempNewNodes.get( i );
}
((DefaultTreeModel) getModel()).nodesWereInserted(
node, newNodes );//new int[]{node.getChildCount() - 1});
// collapse all and expand new date
int row = getRowCount() - 1;
while (row >= 1) {
collapseRow( row );
row --;
}
expandPath( new TreePath(//
((DefaultMutableTreeNode) sampleDateModelNode.getChildAt( 2 )).getPath() ) );
getSampleTreeChange().sampleTreeChangeCompilationMode( node );
}
} else if ( nodeInfo instanceof AliquotInterface ) {
} else if ( nodeInfo instanceof ValueModel ) {
//Create the popup menu.
JPopupMenu popup = new JPopupMenu();
JMenuItem menuItem = new JMenuItem( "Set as Preferred Sample Date Interpretation" );
menuItem.addActionListener( new ActionListener() {
@Override
public void actionPerformed ( ActionEvent arg0 ) {
DefaultMutableTreeNode sampleNode =
(DefaultMutableTreeNode) node.getParent();
Object sampleNodeInfo = sampleNode.getUserObject();
((SampleInterface) sampleNodeInfo).setPreferredSampleDateModel( (ValueModel) nodeInfo );
sample.updateSampleDateModels();
// fix tree
((DefaultTreeModel) getModel()).nodeChanged( node );
getSampleTreeChange().sampleTreeChangeCompilationMode( node );
}
} );
popup.add( menuItem );
menuItem = new JMenuItem( "Delete Sample Date Interpretation" );
menuItem.addActionListener( new ActionListener() {
@Override
public void actionPerformed ( ActionEvent arg0 ) {
// delete sample age from aliquot
DefaultMutableTreeNode sampleNode =
(DefaultMutableTreeNode) node.getParent();
Object sampleNodeInfo = sampleNode.getUserObject();
// remove and save sample
// first check for special case of lower-upper intercept
DefaultMutableTreeNode otherInterceptNode = null;
Object otherInterceptNodeInfo = null;
int[] indicesOfIntercepts = new int[2];
DefaultMutableTreeNode[] nodesOfIntercepts = new DefaultMutableTreeNode[2];
if ( ((SampleDateModel) nodeInfo).getMethodName().equalsIgnoreCase( "LowerIntercept" ) ) {
// also remove the next node == upper intercept
otherInterceptNode = node.getNextSibling();
otherInterceptNodeInfo = otherInterceptNode.getUserObject();
indicesOfIntercepts[0] = sampleNode.getIndex( node );
nodesOfIntercepts[0] = node;
indicesOfIntercepts[1] = indicesOfIntercepts[0] + 1;
nodesOfIntercepts[1] = node.getNextSibling();
}
if ( ((SampleDateModel) nodeInfo).getMethodName().equalsIgnoreCase( "UpperIntercept" ) ) {
// also remove the previous node == lower intercept
otherInterceptNode = node.getPreviousSibling();
otherInterceptNodeInfo = otherInterceptNode.getUserObject();
indicesOfIntercepts[1] = sampleNode.getIndex( node );
nodesOfIntercepts[1] = node;
indicesOfIntercepts[0] = indicesOfIntercepts[1] - 1;
nodesOfIntercepts[0] = node.getPreviousSibling();
}
if ( otherInterceptNodeInfo != null ) {
// this is the special case where the two intercpt nodes were removed
((SampleInterface) sampleNodeInfo).getSampleDateModels().remove( (ValueModel) nodeInfo );
((SampleInterface) sampleNodeInfo).getSampleDateModels().remove( (ValueModel) otherInterceptNodeInfo );
sample.updateSampleDateModels();
// fix up tree
sampleNode.remove( nodesOfIntercepts[0] );
sampleNode.remove( nodesOfIntercepts[1] );
((DefaultTreeModel) getModel()).nodesWereRemoved(
sampleNode,
indicesOfIntercepts,
nodesOfIntercepts );
} else {
((SampleInterface) sampleNodeInfo).getSampleDateModels().remove( (ValueModel) nodeInfo );
sample.updateSampleDateModels();
// fix up tree
int indexOfNode = sampleNode.getIndex( node );
sampleNode.remove( node );
((DefaultTreeModel) getModel()).nodesWereRemoved(
sampleNode,
new int[]{indexOfNode},
new Object[]{node} );
}
getSampleTreeChange().sampleTreeChangeCompilationMode( sampleNode );
}
} );
popup.add( menuItem );
// added to speed choice of graph for weighted means
if ( ((ValueModel) nodeInfo).getName().startsWith( "weighted" ) ) {
if ( ((SampleDateModel) nodeInfo).isDisplayedAsGraph() ) {
menuItem = new JMenuItem( "Hide Graph" );
menuItem.addActionListener( new ActionListener() {
public void actionPerformed ( ActionEvent arg0 ) {
((SampleDateModel) nodeInfo).setDisplayedAsGraph( false );
getSampleTreeChange().sampleTreeChangeCompilationMode( node );
}
} );
popup.add( menuItem );
} else {
menuItem = new JMenuItem( "Show Graph" );
menuItem.addActionListener( new ActionListener() {
public void actionPerformed ( ActionEvent arg0 ) {
((SampleDateModel) nodeInfo).setDisplayedAsGraph( true );
getSampleTreeChange().sampleTreeChangeCompilationMode( node );
}
} );
popup.add( menuItem );
}
}
popup.show( e.getComponent(),
e.getX(), e.getY() );
} else if ( nodeInfo instanceof String ) {
System.out.println( "STRING HIT" );
if ( ((String) nodeInfo).equalsIgnoreCase( "Aliquot Fractions" ) ) {
//Create the popup menu.
JPopupMenu popup = new JPopupMenu();
JMenuItem menuItem = new JMenuItem( "Select None" );
menuItem.addActionListener( new ActionListener() {
public void actionPerformed ( ActionEvent arg0 ) {
DefaultMutableTreeNode sampleDateNode =
(DefaultMutableTreeNode) ((DefaultMutableTreeNode) node).getParent();
Object SampleDateNodeInfo = sampleDateNode.getUserObject();
((SampleDateModel) SampleDateNodeInfo).//
setIncludedFractionIDsVector( new Vector<String>() );
sample.updateSampleDateModels();
// fix tree
for (int a = 0; a < node.getChildCount(); a ++) {
DefaultMutableTreeNode aliquotNameNode = //
(DefaultMutableTreeNode) ((DefaultMutableTreeNode) node).getChildAt( a );
for (int c = 0; c < aliquotNameNode.getChildCount(); c ++) {
((CheckBoxNode) ((DefaultMutableTreeNode) aliquotNameNode.//
getChildAt( c )).getUserObject()).setSelected( false );
((DefaultTreeModel) getModel()).nodeChanged( aliquotNameNode.getChildAt( c ) );
}
((DefaultTreeModel) getModel()).nodeChanged( aliquotNameNode );
}
((DefaultTreeModel) getModel()).nodeChanged( node );
((SampleDateModel) SampleDateNodeInfo).//
CalculateDateInterpretationForSample();
getSampleTreeChange().sampleTreeChangeCompilationMode( sampleDateNode );
}
} );
popup.add( menuItem );
menuItem = new JMenuItem( "Select All" );
menuItem.addActionListener( new ActionListener() {
@Override
public void actionPerformed ( ActionEvent arg0 ) {
DefaultMutableTreeNode sampleDateNode = //
(DefaultMutableTreeNode) node.getParent();
DefaultMutableTreeNode sampleNode = //
(DefaultMutableTreeNode) sampleDateNode.getParent();
Object SampleDateNodeInfo = sampleDateNode.getUserObject();
Object SampleNodeInfo = sampleNode.getUserObject();
((SampleDateModel) SampleDateNodeInfo).//
setIncludedFractionIDsVector(//
((SampleInterface) SampleNodeInfo).getSampleFractionIDs() );
sample.updateSampleDateModels();
// fix tree
for (int a = 0; a < node.getChildCount(); a ++) {
DefaultMutableTreeNode aliquotNameNode = //
(DefaultMutableTreeNode) ((DefaultMutableTreeNode) node).getChildAt( a );
for (int c = 0; c < aliquotNameNode.getChildCount(); c ++) {
((CheckBoxNode) ((DefaultMutableTreeNode) aliquotNameNode.//
getChildAt( c )).getUserObject()).setSelected( true );
((DefaultTreeModel) getModel()).nodeChanged( aliquotNameNode.getChildAt( c ) );
}
((DefaultTreeModel) getModel()).nodeChanged( aliquotNameNode );
}
((DefaultTreeModel) getModel()).nodeChanged( node );
((SampleDateModel) SampleDateNodeInfo).//
CalculateDateInterpretationForSample();
getSampleTreeChange().sampleTreeChangeCompilationMode( sampleDateNode );
}
} );
popup.add( menuItem );
popup.show( e.getComponent(),
e.getX(), e.getY() );
}
}
}
} else {
// do nothing
}
}
/**
*
* @param arg0
*/
@Override
public void mouseReleased ( MouseEvent arg0 ) {
//throw new UnsupportedOperationException("Not supported yet.");
}
/**
*
* @param arg0
*/
@Override
public void mouseEntered ( MouseEvent arg0 ) {
//throw new UnsupportedOperationException("Not supported yet.");
}
/**
*
* @param arg0
*/
@Override
public void mouseExited ( MouseEvent arg0 ) {
//throw new UnsupportedOperationException("Not supported yet.");
}
/**
*
* @param arg0
*/
@Override
public void mouseClicked ( MouseEvent arg0 ) {
//throw new UnsupportedOperationException("Not supported yet.");
}
/**
* @return the sampleTreeChange
*/
@Override
public SampleTreeChangeI getSampleTreeChange () {
return sampleTreeChange;
}
/**
* @param sampleTreeChange the sampleTreeChange to set
*/
@Override
public void setSampleTreeChange ( SampleTreeChangeI sampleTreeChange ) {
this.sampleTreeChange = sampleTreeChange;
}
/**
* @return the lastNodeSelected
*/
public Object getLastNodeSelected () {
return lastNodeSelected;
}
/**
* @param lastNodeSelected the lastNodeSelected to set
*/
public void setLastNodeSelected ( Object lastNodeSelected ) {
this.lastNodeSelected = lastNodeSelected;
}
/**
*
*/
@Override
public void performLastUserSelectionOfSampleDate () {
throw new UnsupportedOperationException( "Not supported yet." );
}
}
| {
"content_hash": "0c5f29d34e88bcc57c5fa8b7399fb38f",
"timestamp": "",
"source": "github",
"line_count": 664,
"max_line_length": 158,
"avg_line_length": 43.149096385542165,
"alnum_prop": 0.5138389585005759,
"repo_name": "clementparizot/ET_Redux",
"id": "9f900f9891bc7f74d4ef9515f48cc93e29d2ed74",
"size": "29352",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/main/java/org/earthtime/UPb_Redux/dateInterpretation/SampleTreeCompilationMode.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "HTML",
"bytes": "24186"
},
{
"name": "Java",
"bytes": "8223128"
}
],
"symlink_target": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.