text
stringlengths 2
1.04M
| meta
dict |
---|---|
odoo.define('google_drive.google_drive', function (require) {
"use strict";
var data = require('web.data');
var Model = require('web.DataModel');
var Sidebar = require('web.Sidebar');
Sidebar.include({
init: function () {
var self = this;
var ids;
this._super.apply(this, arguments);
var view = self.getParent();
var result;
if (view.fields_view && view.fields_view.type === "form") {
ids = [];
view.on("load_record", self, function (r) {
ids = [r.id];
self.add_gdoc_items(view, r.id);
});
}
},
add_gdoc_items: function (view, res_id) {
var self = this;
var gdoc_item = _.indexOf(_.pluck(self.items.other, 'classname'), 'oe_share_gdoc');
if (gdoc_item !== -1) {
self.items.other.splice(gdoc_item, 1);
}
if (res_id) {
view.sidebar_eval_context().done(function (context) {
var ds = new data.DataSet(this, 'google.drive.config', context);
ds.call('get_google_drive_config', [view.dataset.model, res_id, context]).done(function (r) {
if (!_.isEmpty(r)) {
_.each(r, function (res) {
var already_there = false;
for (var i = 0;i < self.items.other.length;i++){
if (self.items.other[i].classname === "oe_share_gdoc" && self.items.other[i].label.indexOf(res.name) > -1){
already_there = true;
break;
}
}
if (!already_there){
self.add_items('other', [{
label: res.name+ '<img style="position:absolute;right:5px;height:20px;width:20px;" title="Google Drive" src="google_drive/static/src/img/drive_icon.png"/>',
config_id: res.id,
res_id: res_id,
res_model: view.dataset.model,
callback: self.on_google_doc,
classname: 'oe_share_gdoc'
},
]);
}
});
}
});
});
}
},
fetch: function (model, fields, domain, ctx) {
return new Model(model).query(fields).filter(domain).context(ctx).all();
},
on_google_doc: function (doc_item) {
var self = this;
this.config = doc_item;
var loaded = this.fetch('google.drive.config', ['google_drive_resource_id', 'google_drive_client_id'], [['id', '=', doc_item.config_id]])
.then(function (configs) {
var ds = new data.DataSet(self, 'google.drive.config');
ds.call('get_google_drive_url', [doc_item.config_id, doc_item.res_id,configs[0].google_drive_resource_id, self.dataset.context]).done(function (url) {
if (url){
window.open(url, '_blank');
}
});
});
},
});
});
| {
"content_hash": "bbf846bc18fa8403c38f64a23215417d",
"timestamp": "",
"source": "github",
"line_count": 80,
"max_line_length": 196,
"avg_line_length": 41.5125,
"alnum_prop": 0.4405299608551641,
"repo_name": "vileopratama/vitech",
"id": "bc7449c550775a05e2f1739e2041f1f4a425b173",
"size": "3321",
"binary": false,
"copies": "47",
"ref": "refs/heads/master",
"path": "src/addons/google_drive/static/src/js/gdrive.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Batchfile",
"bytes": "9611"
},
{
"name": "CSS",
"bytes": "2125999"
},
{
"name": "HTML",
"bytes": "252393"
},
{
"name": "Java",
"bytes": "1840167"
},
{
"name": "JavaScript",
"bytes": "6176224"
},
{
"name": "Makefile",
"bytes": "19072"
},
{
"name": "Mako",
"bytes": "7659"
},
{
"name": "NSIS",
"bytes": "16782"
},
{
"name": "Python",
"bytes": "9438805"
},
{
"name": "Ruby",
"bytes": "220"
},
{
"name": "Shell",
"bytes": "22312"
},
{
"name": "Vim script",
"bytes": "406"
},
{
"name": "XSLT",
"bytes": "11489"
}
],
"symlink_target": ""
} |
'''
Created on Dec 27, 2017
@author: prismtech
'''
import unittest
from dds import Listener, DomainParticipant, Qos, DurabilityQosPolicy, DDSDurabilityKind, DDSException,\
DeadlineQosPolicy, DDSDuration, LivelinessQosPolicy, DDSLivelinessKind,\
OwnershipQosPolicy, DDSOwnershipKind, ResourceLimitsQosPolicy,\
DestinationOrderQosPolicy, DDSDestinationOrderKind, DDSTime,\
PublicationMatchedStatus, SubscriptionMatchedStatus,\
OfferedDeadlineMissedStatus, OfferedIncompatibleQosStatus, QosPolicyId,\
LivelinessLostStatus, LivelinessChangedStatus, RequestedDeadlineMissedStatus,\
RequestedIncompatibleQosStatus, SampleRejectedStatus,\
DDSSampleRejectedStatusKind, SampleLostStatus
import ddsutil
import os
import threading
import time
from symbol import nonlocal_stmt
import collections
Info = collections.namedtuple('Info', ['name', 'type'])
class TestListeners(unittest.TestCase):
idl_path = os.path.join('idl', 'Shapes.idl')
shape_type_name = 'ShapeType'
time_out = 10.0
def _check_status(self, status, type, field_info):
self.assertIsInstance(status, type, 'status is not {}'.format(type))
self.assertEqual(len(field_info), len(type._fields), 'incorrect number of field_info entries')
for n, t in field_info:
self.assertTrue(hasattr(status,n), 'status does not have attr {}'.format(n))
self.assertIsInstance(getattr(status,n), t, 'status.{} is not a {}'.format(n,t))
def test_on_data_available(self):
topic_name = 'ST_on_data_available'
event = threading.Event()
dp1 = DomainParticipant()
gci = ddsutil.get_dds_classes_from_idl(self.idl_path, self.shape_type_name)
ShapeType = gci.get_class('ShapeType')
Inner = gci.get_class('Inner')
t1 = gci.register_topic(dp1, topic_name)
wr1 = dp1.create_datawriter(t1)
class L(Listener):
def on_data_available(self,_):
event.set()
dp2 = DomainParticipant()
t2 = gci.register_topic(dp2, topic_name)
rd2 = dp2.create_datareader(t2,listener=L())
data = ShapeType(color='RED',x=1,y=2,z=3,t=Inner(foo=4))
wr1.write(data)
self.assertTrue(event.wait(self.time_out),'Did not receive on_data_available')
def test_on_inconsistent_topic(self):
'''
from: osplo/testsuite/dbt/api/dcps/c99/utest/listener/code/listener_utests.c
It's not that easy for OpenSplice to generate inconsistent_topic
events. However, it is build on top of SAC and it works on that
language binding. We can assume that this test succeeds when
the other listener test pass as well...
So, we will just check that the listener's actually got installed
'''
topic_name = 'ST_on_inconsistent_topic'
event = threading.Event()
gci = ddsutil.get_dds_classes_from_idl(self.idl_path, self.shape_type_name)
# gci2 = ddsutil.get_dds_classes_from_idl(self.idl_path, self.shape_type_name + '2')
class L(Listener):
def on_inconsistent_topic(self, topic, status):
print('on_inconsistent_topic triggered: topic name = {}, total_count = {}, total_change_count = {}'
.format(topic.get_name(), status.total_coutn, status.total_change_count))
event.set()
dp1 = DomainParticipant(listener=L())
self.assertIsNotNone(dp1.listener, "DomainParticipant Listener was not set")
t1 = gci.register_topic(dp1, topic_name, listener=L())
self.assertIsNotNone(t1.listener, "Topic Listener was not set")
# t2qos = Qos([DurabilityQosPolicy(DDSDurabilityKind.PERSISTENT)])
# try:
# t2 = gci2.register_topic(dp2, topic_name, qos=None)
# self.fail("expected this topic registeration to fail")
# except DDSException as e:
# pass
#
# try:
# self.assertTrue(self.event.wait(self.time_out),'Did not receive on_inconsistent_topic')
# finally:
# pass
def test_data_available_listeners(self):
dp_on_data_available_event = threading.Event()
dp_on_publication_matched_event = threading.Event()
dp_on_subscription_matched_event = threading.Event()
p_on_publication_matched_event = threading.Event()
s_on_data_available_event = threading.Event()
s_on_subscription_matched_event = threading.Event()
wr_on_publication_matched_event = threading.Event()
rd_on_data_available_event = threading.Event()
rd_on_subscription_matched_event = threading.Event()
opm_event = threading.Event()
osm_event = threading.Event()
oda_event = threading.Event()
pub_match_status = None
sub_match_status = None
class DPL(Listener):
def on_data_available(self,reader):
dp_on_data_available_event.set()
oda_event.set()
def on_publication_matched(self,writer,status):
dp_on_publication_matched_event.set()
opm_event.set()
def on_subscription_matched(self,reader,status):
dp_on_subscription_matched_event.set()
osm_event.set()
class PL(Listener):
def on_publication_matched(self,writer, status):
p_on_publication_matched_event.set()
class SL(Listener):
def on_data_available(self,reader):
s_on_data_available_event.set()
oda_event.set()
def on_subscription_matched(self,reader, status):
s_on_subscription_matched_event.set()
osm_event.set()
class WL(Listener):
def on_publication_matched(self,writer, status):
nonlocal pub_match_status
pub_match_status = status
wr_on_publication_matched_event.set()
opm_event.set()
class RL(Listener):
def on_data_available(self,reader):
rd_on_data_available_event.set()
oda_event.set()
def on_subscription_matched(self,reader, status):
nonlocal sub_match_status
sub_match_status = status
rd_on_subscription_matched_event.set()
osm_event.set()
dp = DomainParticipant(listener=DPL())
self.assertIsInstance(dp.listener, DPL, 'listener is not a DPL')
topic_name = 'ST_data_available_listeners'
gci = ddsutil.get_dds_classes_from_idl(self.idl_path, self.shape_type_name)
t = gci.register_topic(dp, topic_name)
pub = dp.create_publisher(listener=PL())
self.assertIsInstance(pub.listener, PL, 'listener is not a PL')
sub = dp.create_subscriber(listener=SL())
self.assertIsInstance(sub.listener, SL, 'listener is not a SL')
wr = pub.create_datawriter(t, listener=WL())
self.assertIsInstance(wr.listener, WL, 'listener is not a WL')
rd = sub.create_datareader(t, listener=RL())
self.assertIsInstance(rd.listener, RL, 'listener is not a RL')
ShapeType = gci.get_class('ShapeType')
Inner = gci.get_class('Inner')
data = ShapeType(color='GREEN', x=22, y=33, z=44, t=Inner(foo=55))
# time.sleep(1.0)
wr.write(data)
TriggerState = collections.namedtuple('TriggerState',[
'opm',
'osm',
'oda',
])
actual_trigger_state = TriggerState(
opm_event.wait(self.time_out),
osm_event.wait(self.time_out),
oda_event.wait(self.time_out))
print(actual_trigger_state)
self.assertEqual(
actual_trigger_state,
TriggerState(True, True, True)
, 'Not all events triggered')
EventState = collections.namedtuple('EventState',[
'dp_opm',
'p_opm',
'wr_opm',
'dp_osm',
's_osm',
'rd_osm',
'dp_oda',
's_oda',
'rd_oda',
])
actual_event_state = EventState(
dp_on_publication_matched_event.is_set(),
p_on_publication_matched_event.is_set(),
wr_on_publication_matched_event.is_set(),
dp_on_subscription_matched_event.is_set(),
s_on_subscription_matched_event.is_set(),
rd_on_subscription_matched_event.is_set(),
dp_on_data_available_event.is_set(),
s_on_data_available_event.is_set(),
rd_on_data_available_event.is_set(),
)
expected_event_state = EventState(
False, False, True,
False, False, True,
False, False, True,
)
print(actual_event_state)
self.assertEqual(actual_event_state, expected_event_state, 'Incorrect listeners triggered')
# time.sleep(1.0)
# self.assertTrue(wr_on_publication_matched_event.wait(self.time_out), 'wr_on_publication_matched_event')
# self.assertTrue(rd_on_subscription_matched_event.wait(self.time_out), 'rd_on_subscription_matched_event')
self._check_status(pub_match_status, PublicationMatchedStatus, [
Info('total_count', int),
Info('total_count_change', int),
Info('current_count', int),
Info('current_count_change', int),
Info('last_subscription_handle', int),
])
self._check_status(sub_match_status, SubscriptionMatchedStatus, [
Info('total_count', int),
Info('total_count_change', int),
Info('current_count', int),
Info('current_count_change', int),
Info('last_publication_handle', int),
])
def test_on_offered_deadline_missed(self):
handlerTriggered = threading.Event()
write_time = 0.0
delay = 0.0
saved_status = None
class L(Listener):
def on_offered_deadline_missed(self, writer, status):
nonlocal delay
nonlocal saved_status
handlerTriggered.set()
saved_status = status
delay = time.time() - write_time
dp = DomainParticipant()
topic_name = 'ST_on_offered_deadline_missed'
gci = ddsutil.get_dds_classes_from_idl(self.idl_path, self.shape_type_name)
t = gci.register_topic(dp, topic_name)
wqos = Qos(policies=[
DeadlineQosPolicy(DDSDuration(1,0))
])
wr = dp.create_datawriter(t, wqos, L())
rd = dp.create_datareader(t)
ShapeType = gci.get_class('ShapeType')
Inner = gci.get_class('Inner')
data = ShapeType(color='GREEN', x=22, y=33, z=44, t=Inner(foo=55))
wr.write(data)
write_time = time.time()
self.assertTrue(handlerTriggered.wait(self.time_out), 'Event not triggered')
self.assertGreaterEqual(delay, 1.0 - 0.05, 'Delay not >= 1.0s')
self._check_status(saved_status, OfferedDeadlineMissedStatus, [
Info('total_count', int),
Info('total_count_change', int),
Info('last_instance_handle', int),
])
def test_on_offered_incompatible_qos(self):
handlerTriggered = threading.Event()
saved_status = None
class L(Listener):
def on_offered_incompatible_qos(self, writer, status):
nonlocal saved_status
saved_status = status
handlerTriggered.set()
dp = DomainParticipant()
topic_name = 'ST_on_offered_incompatible_qos'
gci = ddsutil.get_dds_classes_from_idl(self.idl_path, self.shape_type_name)
t = gci.register_topic(dp, topic_name)
wqos = Qos(policies=[
DurabilityQosPolicy(DDSDurabilityKind.VOLATILE)
])
rqos = Qos(policies=[
DurabilityQosPolicy(DDSDurabilityKind.TRANSIENT)
])
wr = dp.create_datawriter(t, wqos, L())
rd = dp.create_datareader(t,rqos)
ShapeType = gci.get_class('ShapeType')
Inner = gci.get_class('Inner')
data = ShapeType(color='GREEN', x=22, y=33, z=44, t=Inner(foo=55))
wr.write(data)
self.assertTrue(handlerTriggered.wait(self.time_out), 'Event not triggered')
self._check_status(saved_status, OfferedIncompatibleQosStatus, [
Info('total_count', int),
Info('total_count_change', int),
Info('last_policy_id', QosPolicyId),
])
def test_liveliness(self):
handlerTriggered = threading.Event()
aliveTriggered = threading.Event()
notaliveTriggered = threading.Event()
write_time = 0.0
delay = 0.0
saved_lost_status = None
saved_changed_status = None
class L(Listener):
def on_liveliness_lost(self, writer, status):
nonlocal delay
nonlocal saved_lost_status
saved_lost_status = status
handlerTriggered.set()
delay = time.time() - write_time
class RL(Listener):
def on_liveliness_changed(self, reader, status):
nonlocal saved_changed_status
saved_changed_status = status
if status.alive_count == 1:
aliveTriggered.set()
else:
notaliveTriggered.set()
qos = Qos(policies=[
LivelinessQosPolicy(DDSLivelinessKind.MANUAL_BY_TOPIC,
DDSDuration(1,0)),
OwnershipQosPolicy(DDSOwnershipKind.EXCLUSIVE)
])
dp = DomainParticipant()
topic_name = 'ST_liveliness'
gci = ddsutil.get_dds_classes_from_idl(self.idl_path, self.shape_type_name)
t = gci.register_topic(dp, topic_name, qos)
wr = dp.create_datawriter(t, qos=qos, listener=L())
rd = dp.create_datareader(t, qos=qos, listener=RL())
ShapeType = gci.get_class('ShapeType')
Inner = gci.get_class('Inner')
data = ShapeType(color='GREEN', x=22, y=33, z=44, t=Inner(foo=55))
wr.write(data)
write_time = time.time()
self.assertTrue(handlerTriggered.wait(self.time_out), 'Event not triggered')
self.assertGreaterEqual(delay, 1.0 - 0.05, 'Delay not >= 1.0s')
self.assertTrue(aliveTriggered.wait(self.time_out), 'Alive not signaled to reader')
self.assertTrue(notaliveTriggered.wait(self.time_out), 'Not Alive not signaled to reader')
self._check_status(saved_lost_status, LivelinessLostStatus, [
Info('total_count', int),
Info('total_count_change', int),
])
self._check_status(saved_changed_status, LivelinessChangedStatus, [
Info('alive_count', int),
Info('not_alive_count', int),
Info('alive_count_change', int),
Info('not_alive_count_change', int),
Info('last_publication_handle', int),
])
def test_on_requested_deadline_missed(self):
handlerTriggered = threading.Event()
write_time = 0.0
delay = 0.0
saved_status = None
class L(Listener):
def on_requested_deadline_missed(self, reader, status):
nonlocal delay
nonlocal saved_status
saved_status = status
handlerTriggered.set()
delay = time.time() - write_time
dp = DomainParticipant()
topic_name = 'ST_on_requested_deadline_missed'
gci = ddsutil.get_dds_classes_from_idl(self.idl_path, self.shape_type_name)
t = gci.register_topic(dp, topic_name)
qos = Qos(policies=[
DeadlineQosPolicy(DDSDuration(1,0))
])
wr = dp.create_datawriter(t, qos)
rd = dp.create_datareader(t, qos, L())
ShapeType = gci.get_class('ShapeType')
Inner = gci.get_class('Inner')
data = ShapeType(color='GREEN', x=22, y=33, z=44, t=Inner(foo=55))
wr.write(data)
write_time = time.time()
self.assertTrue(handlerTriggered.wait(self.time_out), 'Event not triggered')
self.assertGreaterEqual(delay, 1.0 - 0.05, 'Delay not >= 1.0s')
self._check_status(saved_status, RequestedDeadlineMissedStatus, [
Info('total_count', int),
Info('total_count_change', int),
Info('last_instance_handle', int),
])
def test_on_requested_incompatible_qos(self):
handlerTriggered = threading.Event()
saved_status = None
class L(Listener):
def on_requested_incompatible_qos(self, reader, status):
nonlocal saved_status
saved_status = status
handlerTriggered.set()
dp = DomainParticipant()
topic_name = 'ST_test_on_requested_incompatible_qos'
gci = ddsutil.get_dds_classes_from_idl(self.idl_path, self.shape_type_name)
t = gci.register_topic(dp, topic_name)
wqos = Qos(policies=[
DurabilityQosPolicy(DDSDurabilityKind.VOLATILE)
])
rqos = Qos(policies=[
DurabilityQosPolicy(DDSDurabilityKind.TRANSIENT)
])
wr = dp.create_datawriter(t, wqos)
rd = dp.create_datareader(t,rqos, L())
ShapeType = gci.get_class('ShapeType')
Inner = gci.get_class('Inner')
data = ShapeType(color='GREEN', x=22, y=33, z=44, t=Inner(foo=55))
wr.write(data)
self.assertTrue(handlerTriggered.wait(self.time_out), 'Event not triggered')
self._check_status(saved_status, RequestedIncompatibleQosStatus, [
Info('total_count', int),
Info('total_count_change', int),
Info('last_policy_id', QosPolicyId),
])
def test_on_sample_rejected(self):
handlerTriggered = threading.Event()
saved_status = None
class L(Listener):
def on_sample_rejected(self, reader, status):
nonlocal saved_status
saved_status = status
handlerTriggered.set()
dp = DomainParticipant()
topic_name = 'ST_on_sample_rejected'
gci = ddsutil.get_dds_classes_from_idl(self.idl_path, self.shape_type_name)
t = gci.register_topic(dp, topic_name)
qos = Qos(policies=[
ResourceLimitsQosPolicy(max_samples=1)
])
wr = dp.create_datawriter(t)
rd = dp.create_datareader(t, qos, L())
ShapeType = gci.get_class('ShapeType')
Inner = gci.get_class('Inner')
data1 = ShapeType(color='GREEN', x=22, y=33, z=44, t=Inner(foo=55))
data2 = ShapeType(color='BLUE', x=222, y=233, z=244, t=Inner(foo=255))
wr.write(data1)
self.assertFalse(handlerTriggered.is_set(), 'Event already triggered')
wr.write(data2)
self.assertTrue(handlerTriggered.wait(self.time_out), 'Event not triggered')
self._check_status(saved_status, SampleRejectedStatus, [
Info('total_count', int),
Info('total_count_change', int),
Info('last_reason', DDSSampleRejectedStatusKind),
Info('last_instance_handle', int),
])
def test_on_sample_lost(self):
handlerTriggered = threading.Event()
saved_status = None
class L(Listener):
def on_sample_lost(self, reader, status):
nonlocal saved_status
saved_status = status
handlerTriggered.set()
qos = Qos(policies=[
DestinationOrderQosPolicy(DDSDestinationOrderKind.BY_SOURCE_TIMESTAMP)
])
dp = DomainParticipant()
topic_name = 'ST_on_sample_lost'
gci = ddsutil.get_dds_classes_from_idl(self.idl_path, self.shape_type_name)
t = gci.register_topic(dp, topic_name)
wr = dp.create_datawriter(t, qos)
rd = dp.create_datareader(t, qos, L())
ShapeType = gci.get_class('ShapeType')
Inner = gci.get_class('Inner')
data1 = ShapeType(color='GREEN', x=22, y=33, z=44, t=Inner(foo=55))
t1 = DDSTime(1000,0)
t2 = DDSTime(1001,0)
# write out-of-order samples
wr.write_ts(data1, t2)
rd.take()
wr.write_ts(data1, t1)
self.assertTrue(handlerTriggered.wait(self.time_out), 'Event not triggered')
self._check_status(saved_status, SampleLostStatus, [
Info('total_count', int),
Info('total_count_change', int),
])
if __name__ == "__main__":
#import sys;sys.argv = ['', 'Test.testName']
unittest.main() | {
"content_hash": "daa2fbbdee224fa99e05c537fd08e708",
"timestamp": "",
"source": "github",
"line_count": 580,
"max_line_length": 115,
"avg_line_length": 37.01379310344828,
"alnum_prop": 0.5711757033724614,
"repo_name": "osrf/opensplice",
"id": "031985f9191637d415d657ab524e606bfe7ae1e5",
"size": "22244",
"binary": false,
"copies": "2",
"ref": "refs/heads/osrf-6.9.0",
"path": "src/api/dcps/python/test/test_listeners.py",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Awk",
"bytes": "16400"
},
{
"name": "Batchfile",
"bytes": "192174"
},
{
"name": "C",
"bytes": "19618578"
},
{
"name": "C#",
"bytes": "2428591"
},
{
"name": "C++",
"bytes": "8036199"
},
{
"name": "CMake",
"bytes": "35186"
},
{
"name": "CSS",
"bytes": "41427"
},
{
"name": "HTML",
"bytes": "457045"
},
{
"name": "Java",
"bytes": "5184488"
},
{
"name": "JavaScript",
"bytes": "540355"
},
{
"name": "LLVM",
"bytes": "13059"
},
{
"name": "Lex",
"bytes": "51476"
},
{
"name": "Makefile",
"bytes": "513684"
},
{
"name": "Objective-C",
"bytes": "38424"
},
{
"name": "Perl",
"bytes": "164028"
},
{
"name": "Python",
"bytes": "915683"
},
{
"name": "Shell",
"bytes": "363583"
},
{
"name": "TeX",
"bytes": "8134"
},
{
"name": "Visual Basic",
"bytes": "290"
},
{
"name": "Yacc",
"bytes": "202848"
}
],
"symlink_target": ""
} |
namespace TowerDefence.Minions {
public interface IMinionFactory {
Minion CreateStrongMinion();
Minion CreateIntermediateMinion();
Minion CreateWeakMinion();
}
}
| {
"content_hash": "a12c6ba135305a9af98938e0354abf94",
"timestamp": "",
"source": "github",
"line_count": 7,
"max_line_length": 42,
"avg_line_length": 27.857142857142858,
"alnum_prop": 0.6820512820512821,
"repo_name": "simonasB/TowerDefence",
"id": "c43dff955c13ef7e057b549f85bcba8f4f788cdf",
"size": "197",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "TowerDefence/Minions/IMinionFactory.cs",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C#",
"bytes": "104212"
}
],
"symlink_target": ""
} |
/**
* Autogenerated by Thrift Compiler (0.12.0)
*
* DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
* @generated
*/
package org.apache.accumulo.core.master.thrift;
@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused"})
public class TabletServerStatus implements org.apache.thrift.TBase<TabletServerStatus, TabletServerStatus._Fields>, java.io.Serializable, Cloneable, Comparable<TabletServerStatus> {
private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TabletServerStatus");
private static final org.apache.thrift.protocol.TField TABLE_MAP_FIELD_DESC = new org.apache.thrift.protocol.TField("tableMap", org.apache.thrift.protocol.TType.MAP, (short)1);
private static final org.apache.thrift.protocol.TField LAST_CONTACT_FIELD_DESC = new org.apache.thrift.protocol.TField("lastContact", org.apache.thrift.protocol.TType.I64, (short)2);
private static final org.apache.thrift.protocol.TField NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("name", org.apache.thrift.protocol.TType.STRING, (short)3);
private static final org.apache.thrift.protocol.TField OS_LOAD_FIELD_DESC = new org.apache.thrift.protocol.TField("osLoad", org.apache.thrift.protocol.TType.DOUBLE, (short)5);
private static final org.apache.thrift.protocol.TField HOLD_TIME_FIELD_DESC = new org.apache.thrift.protocol.TField("holdTime", org.apache.thrift.protocol.TType.I64, (short)7);
private static final org.apache.thrift.protocol.TField LOOKUPS_FIELD_DESC = new org.apache.thrift.protocol.TField("lookups", org.apache.thrift.protocol.TType.I64, (short)8);
private static final org.apache.thrift.protocol.TField INDEX_CACHE_HITS_FIELD_DESC = new org.apache.thrift.protocol.TField("indexCacheHits", org.apache.thrift.protocol.TType.I64, (short)10);
private static final org.apache.thrift.protocol.TField INDEX_CACHE_REQUEST_FIELD_DESC = new org.apache.thrift.protocol.TField("indexCacheRequest", org.apache.thrift.protocol.TType.I64, (short)11);
private static final org.apache.thrift.protocol.TField DATA_CACHE_HITS_FIELD_DESC = new org.apache.thrift.protocol.TField("dataCacheHits", org.apache.thrift.protocol.TType.I64, (short)12);
private static final org.apache.thrift.protocol.TField DATA_CACHE_REQUEST_FIELD_DESC = new org.apache.thrift.protocol.TField("dataCacheRequest", org.apache.thrift.protocol.TType.I64, (short)13);
private static final org.apache.thrift.protocol.TField LOG_SORTS_FIELD_DESC = new org.apache.thrift.protocol.TField("logSorts", org.apache.thrift.protocol.TType.LIST, (short)14);
private static final org.apache.thrift.protocol.TField FLUSHS_FIELD_DESC = new org.apache.thrift.protocol.TField("flushs", org.apache.thrift.protocol.TType.I64, (short)15);
private static final org.apache.thrift.protocol.TField SYNCS_FIELD_DESC = new org.apache.thrift.protocol.TField("syncs", org.apache.thrift.protocol.TType.I64, (short)16);
private static final org.apache.thrift.protocol.TField BULK_IMPORTS_FIELD_DESC = new org.apache.thrift.protocol.TField("bulkImports", org.apache.thrift.protocol.TType.LIST, (short)17);
private static final org.apache.thrift.protocol.TField VERSION_FIELD_DESC = new org.apache.thrift.protocol.TField("version", org.apache.thrift.protocol.TType.STRING, (short)19);
private static final org.apache.thrift.protocol.TField RESPONSE_TIME_FIELD_DESC = new org.apache.thrift.protocol.TField("responseTime", org.apache.thrift.protocol.TType.I64, (short)18);
private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = new TabletServerStatusStandardSchemeFactory();
private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = new TabletServerStatusTupleSchemeFactory();
public @org.apache.thrift.annotation.Nullable java.util.Map<java.lang.String,TableInfo> tableMap; // required
public long lastContact; // required
public @org.apache.thrift.annotation.Nullable java.lang.String name; // required
public double osLoad; // required
public long holdTime; // required
public long lookups; // required
public long indexCacheHits; // required
public long indexCacheRequest; // required
public long dataCacheHits; // required
public long dataCacheRequest; // required
public @org.apache.thrift.annotation.Nullable java.util.List<RecoveryStatus> logSorts; // required
public long flushs; // required
public long syncs; // required
public @org.apache.thrift.annotation.Nullable java.util.List<BulkImportStatus> bulkImports; // required
public @org.apache.thrift.annotation.Nullable java.lang.String version; // required
public long responseTime; // required
/** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
public enum _Fields implements org.apache.thrift.TFieldIdEnum {
TABLE_MAP((short)1, "tableMap"),
LAST_CONTACT((short)2, "lastContact"),
NAME((short)3, "name"),
OS_LOAD((short)5, "osLoad"),
HOLD_TIME((short)7, "holdTime"),
LOOKUPS((short)8, "lookups"),
INDEX_CACHE_HITS((short)10, "indexCacheHits"),
INDEX_CACHE_REQUEST((short)11, "indexCacheRequest"),
DATA_CACHE_HITS((short)12, "dataCacheHits"),
DATA_CACHE_REQUEST((short)13, "dataCacheRequest"),
LOG_SORTS((short)14, "logSorts"),
FLUSHS((short)15, "flushs"),
SYNCS((short)16, "syncs"),
BULK_IMPORTS((short)17, "bulkImports"),
VERSION((short)19, "version"),
RESPONSE_TIME((short)18, "responseTime");
private static final java.util.Map<java.lang.String, _Fields> byName = new java.util.HashMap<java.lang.String, _Fields>();
static {
for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) {
byName.put(field.getFieldName(), field);
}
}
/**
* Find the _Fields constant that matches fieldId, or null if its not found.
*/
@org.apache.thrift.annotation.Nullable
public static _Fields findByThriftId(int fieldId) {
switch(fieldId) {
case 1: // TABLE_MAP
return TABLE_MAP;
case 2: // LAST_CONTACT
return LAST_CONTACT;
case 3: // NAME
return NAME;
case 5: // OS_LOAD
return OS_LOAD;
case 7: // HOLD_TIME
return HOLD_TIME;
case 8: // LOOKUPS
return LOOKUPS;
case 10: // INDEX_CACHE_HITS
return INDEX_CACHE_HITS;
case 11: // INDEX_CACHE_REQUEST
return INDEX_CACHE_REQUEST;
case 12: // DATA_CACHE_HITS
return DATA_CACHE_HITS;
case 13: // DATA_CACHE_REQUEST
return DATA_CACHE_REQUEST;
case 14: // LOG_SORTS
return LOG_SORTS;
case 15: // FLUSHS
return FLUSHS;
case 16: // SYNCS
return SYNCS;
case 17: // BULK_IMPORTS
return BULK_IMPORTS;
case 19: // VERSION
return VERSION;
case 18: // RESPONSE_TIME
return RESPONSE_TIME;
default:
return null;
}
}
/**
* Find the _Fields constant that matches fieldId, throwing an exception
* if it is not found.
*/
public static _Fields findByThriftIdOrThrow(int fieldId) {
_Fields fields = findByThriftId(fieldId);
if (fields == null) throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!");
return fields;
}
/**
* Find the _Fields constant that matches name, or null if its not found.
*/
@org.apache.thrift.annotation.Nullable
public static _Fields findByName(java.lang.String name) {
return byName.get(name);
}
private final short _thriftId;
private final java.lang.String _fieldName;
_Fields(short thriftId, java.lang.String fieldName) {
_thriftId = thriftId;
_fieldName = fieldName;
}
public short getThriftFieldId() {
return _thriftId;
}
public java.lang.String getFieldName() {
return _fieldName;
}
}
// isset id assignments
private static final int __LASTCONTACT_ISSET_ID = 0;
private static final int __OSLOAD_ISSET_ID = 1;
private static final int __HOLDTIME_ISSET_ID = 2;
private static final int __LOOKUPS_ISSET_ID = 3;
private static final int __INDEXCACHEHITS_ISSET_ID = 4;
private static final int __INDEXCACHEREQUEST_ISSET_ID = 5;
private static final int __DATACACHEHITS_ISSET_ID = 6;
private static final int __DATACACHEREQUEST_ISSET_ID = 7;
private static final int __FLUSHS_ISSET_ID = 8;
private static final int __SYNCS_ISSET_ID = 9;
private static final int __RESPONSETIME_ISSET_ID = 10;
private short __isset_bitfield = 0;
public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
static {
java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
tmpMap.put(_Fields.TABLE_MAP, new org.apache.thrift.meta_data.FieldMetaData("tableMap", org.apache.thrift.TFieldRequirementType.DEFAULT,
new org.apache.thrift.meta_data.MapMetaData(org.apache.thrift.protocol.TType.MAP,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING),
new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, TableInfo.class))));
tmpMap.put(_Fields.LAST_CONTACT, new org.apache.thrift.meta_data.FieldMetaData("lastContact", org.apache.thrift.TFieldRequirementType.DEFAULT,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
tmpMap.put(_Fields.NAME, new org.apache.thrift.meta_data.FieldMetaData("name", org.apache.thrift.TFieldRequirementType.DEFAULT,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
tmpMap.put(_Fields.OS_LOAD, new org.apache.thrift.meta_data.FieldMetaData("osLoad", org.apache.thrift.TFieldRequirementType.DEFAULT,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.DOUBLE)));
tmpMap.put(_Fields.HOLD_TIME, new org.apache.thrift.meta_data.FieldMetaData("holdTime", org.apache.thrift.TFieldRequirementType.DEFAULT,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
tmpMap.put(_Fields.LOOKUPS, new org.apache.thrift.meta_data.FieldMetaData("lookups", org.apache.thrift.TFieldRequirementType.DEFAULT,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
tmpMap.put(_Fields.INDEX_CACHE_HITS, new org.apache.thrift.meta_data.FieldMetaData("indexCacheHits", org.apache.thrift.TFieldRequirementType.DEFAULT,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
tmpMap.put(_Fields.INDEX_CACHE_REQUEST, new org.apache.thrift.meta_data.FieldMetaData("indexCacheRequest", org.apache.thrift.TFieldRequirementType.DEFAULT,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
tmpMap.put(_Fields.DATA_CACHE_HITS, new org.apache.thrift.meta_data.FieldMetaData("dataCacheHits", org.apache.thrift.TFieldRequirementType.DEFAULT,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
tmpMap.put(_Fields.DATA_CACHE_REQUEST, new org.apache.thrift.meta_data.FieldMetaData("dataCacheRequest", org.apache.thrift.TFieldRequirementType.DEFAULT,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
tmpMap.put(_Fields.LOG_SORTS, new org.apache.thrift.meta_data.FieldMetaData("logSorts", org.apache.thrift.TFieldRequirementType.DEFAULT,
new org.apache.thrift.meta_data.ListMetaData(org.apache.thrift.protocol.TType.LIST,
new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, RecoveryStatus.class))));
tmpMap.put(_Fields.FLUSHS, new org.apache.thrift.meta_data.FieldMetaData("flushs", org.apache.thrift.TFieldRequirementType.DEFAULT,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
tmpMap.put(_Fields.SYNCS, new org.apache.thrift.meta_data.FieldMetaData("syncs", org.apache.thrift.TFieldRequirementType.DEFAULT,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
tmpMap.put(_Fields.BULK_IMPORTS, new org.apache.thrift.meta_data.FieldMetaData("bulkImports", org.apache.thrift.TFieldRequirementType.DEFAULT,
new org.apache.thrift.meta_data.ListMetaData(org.apache.thrift.protocol.TType.LIST,
new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, BulkImportStatus.class))));
tmpMap.put(_Fields.VERSION, new org.apache.thrift.meta_data.FieldMetaData("version", org.apache.thrift.TFieldRequirementType.DEFAULT,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
tmpMap.put(_Fields.RESPONSE_TIME, new org.apache.thrift.meta_data.FieldMetaData("responseTime", org.apache.thrift.TFieldRequirementType.DEFAULT,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
metaDataMap = java.util.Collections.unmodifiableMap(tmpMap);
org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(TabletServerStatus.class, metaDataMap);
}
public TabletServerStatus() {
}
public TabletServerStatus(
java.util.Map<java.lang.String,TableInfo> tableMap,
long lastContact,
java.lang.String name,
double osLoad,
long holdTime,
long lookups,
long indexCacheHits,
long indexCacheRequest,
long dataCacheHits,
long dataCacheRequest,
java.util.List<RecoveryStatus> logSorts,
long flushs,
long syncs,
java.util.List<BulkImportStatus> bulkImports,
java.lang.String version,
long responseTime)
{
this();
this.tableMap = tableMap;
this.lastContact = lastContact;
setLastContactIsSet(true);
this.name = name;
this.osLoad = osLoad;
setOsLoadIsSet(true);
this.holdTime = holdTime;
setHoldTimeIsSet(true);
this.lookups = lookups;
setLookupsIsSet(true);
this.indexCacheHits = indexCacheHits;
setIndexCacheHitsIsSet(true);
this.indexCacheRequest = indexCacheRequest;
setIndexCacheRequestIsSet(true);
this.dataCacheHits = dataCacheHits;
setDataCacheHitsIsSet(true);
this.dataCacheRequest = dataCacheRequest;
setDataCacheRequestIsSet(true);
this.logSorts = logSorts;
this.flushs = flushs;
setFlushsIsSet(true);
this.syncs = syncs;
setSyncsIsSet(true);
this.bulkImports = bulkImports;
this.version = version;
this.responseTime = responseTime;
setResponseTimeIsSet(true);
}
/**
* Performs a deep copy on <i>other</i>.
*/
public TabletServerStatus(TabletServerStatus other) {
__isset_bitfield = other.__isset_bitfield;
if (other.isSetTableMap()) {
java.util.Map<java.lang.String,TableInfo> __this__tableMap = new java.util.HashMap<java.lang.String,TableInfo>(other.tableMap.size());
for (java.util.Map.Entry<java.lang.String, TableInfo> other_element : other.tableMap.entrySet()) {
java.lang.String other_element_key = other_element.getKey();
TableInfo other_element_value = other_element.getValue();
java.lang.String __this__tableMap_copy_key = other_element_key;
TableInfo __this__tableMap_copy_value = new TableInfo(other_element_value);
__this__tableMap.put(__this__tableMap_copy_key, __this__tableMap_copy_value);
}
this.tableMap = __this__tableMap;
}
this.lastContact = other.lastContact;
if (other.isSetName()) {
this.name = other.name;
}
this.osLoad = other.osLoad;
this.holdTime = other.holdTime;
this.lookups = other.lookups;
this.indexCacheHits = other.indexCacheHits;
this.indexCacheRequest = other.indexCacheRequest;
this.dataCacheHits = other.dataCacheHits;
this.dataCacheRequest = other.dataCacheRequest;
if (other.isSetLogSorts()) {
java.util.List<RecoveryStatus> __this__logSorts = new java.util.ArrayList<RecoveryStatus>(other.logSorts.size());
for (RecoveryStatus other_element : other.logSorts) {
__this__logSorts.add(new RecoveryStatus(other_element));
}
this.logSorts = __this__logSorts;
}
this.flushs = other.flushs;
this.syncs = other.syncs;
if (other.isSetBulkImports()) {
java.util.List<BulkImportStatus> __this__bulkImports = new java.util.ArrayList<BulkImportStatus>(other.bulkImports.size());
for (BulkImportStatus other_element : other.bulkImports) {
__this__bulkImports.add(new BulkImportStatus(other_element));
}
this.bulkImports = __this__bulkImports;
}
if (other.isSetVersion()) {
this.version = other.version;
}
this.responseTime = other.responseTime;
}
public TabletServerStatus deepCopy() {
return new TabletServerStatus(this);
}
@Override
public void clear() {
this.tableMap = null;
setLastContactIsSet(false);
this.lastContact = 0;
this.name = null;
setOsLoadIsSet(false);
this.osLoad = 0.0;
setHoldTimeIsSet(false);
this.holdTime = 0;
setLookupsIsSet(false);
this.lookups = 0;
setIndexCacheHitsIsSet(false);
this.indexCacheHits = 0;
setIndexCacheRequestIsSet(false);
this.indexCacheRequest = 0;
setDataCacheHitsIsSet(false);
this.dataCacheHits = 0;
setDataCacheRequestIsSet(false);
this.dataCacheRequest = 0;
this.logSorts = null;
setFlushsIsSet(false);
this.flushs = 0;
setSyncsIsSet(false);
this.syncs = 0;
this.bulkImports = null;
this.version = null;
setResponseTimeIsSet(false);
this.responseTime = 0;
}
public int getTableMapSize() {
return (this.tableMap == null) ? 0 : this.tableMap.size();
}
public void putToTableMap(java.lang.String key, TableInfo val) {
if (this.tableMap == null) {
this.tableMap = new java.util.HashMap<java.lang.String,TableInfo>();
}
this.tableMap.put(key, val);
}
@org.apache.thrift.annotation.Nullable
public java.util.Map<java.lang.String,TableInfo> getTableMap() {
return this.tableMap;
}
public TabletServerStatus setTableMap(@org.apache.thrift.annotation.Nullable java.util.Map<java.lang.String,TableInfo> tableMap) {
this.tableMap = tableMap;
return this;
}
public void unsetTableMap() {
this.tableMap = null;
}
/** Returns true if field tableMap is set (has been assigned a value) and false otherwise */
public boolean isSetTableMap() {
return this.tableMap != null;
}
public void setTableMapIsSet(boolean value) {
if (!value) {
this.tableMap = null;
}
}
public long getLastContact() {
return this.lastContact;
}
public TabletServerStatus setLastContact(long lastContact) {
this.lastContact = lastContact;
setLastContactIsSet(true);
return this;
}
public void unsetLastContact() {
__isset_bitfield = org.apache.thrift.EncodingUtils.clearBit(__isset_bitfield, __LASTCONTACT_ISSET_ID);
}
/** Returns true if field lastContact is set (has been assigned a value) and false otherwise */
public boolean isSetLastContact() {
return org.apache.thrift.EncodingUtils.testBit(__isset_bitfield, __LASTCONTACT_ISSET_ID);
}
public void setLastContactIsSet(boolean value) {
__isset_bitfield = org.apache.thrift.EncodingUtils.setBit(__isset_bitfield, __LASTCONTACT_ISSET_ID, value);
}
@org.apache.thrift.annotation.Nullable
public java.lang.String getName() {
return this.name;
}
public TabletServerStatus setName(@org.apache.thrift.annotation.Nullable java.lang.String name) {
this.name = name;
return this;
}
public void unsetName() {
this.name = null;
}
/** Returns true if field name is set (has been assigned a value) and false otherwise */
public boolean isSetName() {
return this.name != null;
}
public void setNameIsSet(boolean value) {
if (!value) {
this.name = null;
}
}
public double getOsLoad() {
return this.osLoad;
}
public TabletServerStatus setOsLoad(double osLoad) {
this.osLoad = osLoad;
setOsLoadIsSet(true);
return this;
}
public void unsetOsLoad() {
__isset_bitfield = org.apache.thrift.EncodingUtils.clearBit(__isset_bitfield, __OSLOAD_ISSET_ID);
}
/** Returns true if field osLoad is set (has been assigned a value) and false otherwise */
public boolean isSetOsLoad() {
return org.apache.thrift.EncodingUtils.testBit(__isset_bitfield, __OSLOAD_ISSET_ID);
}
public void setOsLoadIsSet(boolean value) {
__isset_bitfield = org.apache.thrift.EncodingUtils.setBit(__isset_bitfield, __OSLOAD_ISSET_ID, value);
}
public long getHoldTime() {
return this.holdTime;
}
public TabletServerStatus setHoldTime(long holdTime) {
this.holdTime = holdTime;
setHoldTimeIsSet(true);
return this;
}
public void unsetHoldTime() {
__isset_bitfield = org.apache.thrift.EncodingUtils.clearBit(__isset_bitfield, __HOLDTIME_ISSET_ID);
}
/** Returns true if field holdTime is set (has been assigned a value) and false otherwise */
public boolean isSetHoldTime() {
return org.apache.thrift.EncodingUtils.testBit(__isset_bitfield, __HOLDTIME_ISSET_ID);
}
public void setHoldTimeIsSet(boolean value) {
__isset_bitfield = org.apache.thrift.EncodingUtils.setBit(__isset_bitfield, __HOLDTIME_ISSET_ID, value);
}
public long getLookups() {
return this.lookups;
}
public TabletServerStatus setLookups(long lookups) {
this.lookups = lookups;
setLookupsIsSet(true);
return this;
}
public void unsetLookups() {
__isset_bitfield = org.apache.thrift.EncodingUtils.clearBit(__isset_bitfield, __LOOKUPS_ISSET_ID);
}
/** Returns true if field lookups is set (has been assigned a value) and false otherwise */
public boolean isSetLookups() {
return org.apache.thrift.EncodingUtils.testBit(__isset_bitfield, __LOOKUPS_ISSET_ID);
}
public void setLookupsIsSet(boolean value) {
__isset_bitfield = org.apache.thrift.EncodingUtils.setBit(__isset_bitfield, __LOOKUPS_ISSET_ID, value);
}
public long getIndexCacheHits() {
return this.indexCacheHits;
}
public TabletServerStatus setIndexCacheHits(long indexCacheHits) {
this.indexCacheHits = indexCacheHits;
setIndexCacheHitsIsSet(true);
return this;
}
public void unsetIndexCacheHits() {
__isset_bitfield = org.apache.thrift.EncodingUtils.clearBit(__isset_bitfield, __INDEXCACHEHITS_ISSET_ID);
}
/** Returns true if field indexCacheHits is set (has been assigned a value) and false otherwise */
public boolean isSetIndexCacheHits() {
return org.apache.thrift.EncodingUtils.testBit(__isset_bitfield, __INDEXCACHEHITS_ISSET_ID);
}
public void setIndexCacheHitsIsSet(boolean value) {
__isset_bitfield = org.apache.thrift.EncodingUtils.setBit(__isset_bitfield, __INDEXCACHEHITS_ISSET_ID, value);
}
public long getIndexCacheRequest() {
return this.indexCacheRequest;
}
public TabletServerStatus setIndexCacheRequest(long indexCacheRequest) {
this.indexCacheRequest = indexCacheRequest;
setIndexCacheRequestIsSet(true);
return this;
}
public void unsetIndexCacheRequest() {
__isset_bitfield = org.apache.thrift.EncodingUtils.clearBit(__isset_bitfield, __INDEXCACHEREQUEST_ISSET_ID);
}
/** Returns true if field indexCacheRequest is set (has been assigned a value) and false otherwise */
public boolean isSetIndexCacheRequest() {
return org.apache.thrift.EncodingUtils.testBit(__isset_bitfield, __INDEXCACHEREQUEST_ISSET_ID);
}
public void setIndexCacheRequestIsSet(boolean value) {
__isset_bitfield = org.apache.thrift.EncodingUtils.setBit(__isset_bitfield, __INDEXCACHEREQUEST_ISSET_ID, value);
}
public long getDataCacheHits() {
return this.dataCacheHits;
}
public TabletServerStatus setDataCacheHits(long dataCacheHits) {
this.dataCacheHits = dataCacheHits;
setDataCacheHitsIsSet(true);
return this;
}
public void unsetDataCacheHits() {
__isset_bitfield = org.apache.thrift.EncodingUtils.clearBit(__isset_bitfield, __DATACACHEHITS_ISSET_ID);
}
/** Returns true if field dataCacheHits is set (has been assigned a value) and false otherwise */
public boolean isSetDataCacheHits() {
return org.apache.thrift.EncodingUtils.testBit(__isset_bitfield, __DATACACHEHITS_ISSET_ID);
}
public void setDataCacheHitsIsSet(boolean value) {
__isset_bitfield = org.apache.thrift.EncodingUtils.setBit(__isset_bitfield, __DATACACHEHITS_ISSET_ID, value);
}
public long getDataCacheRequest() {
return this.dataCacheRequest;
}
public TabletServerStatus setDataCacheRequest(long dataCacheRequest) {
this.dataCacheRequest = dataCacheRequest;
setDataCacheRequestIsSet(true);
return this;
}
public void unsetDataCacheRequest() {
__isset_bitfield = org.apache.thrift.EncodingUtils.clearBit(__isset_bitfield, __DATACACHEREQUEST_ISSET_ID);
}
/** Returns true if field dataCacheRequest is set (has been assigned a value) and false otherwise */
public boolean isSetDataCacheRequest() {
return org.apache.thrift.EncodingUtils.testBit(__isset_bitfield, __DATACACHEREQUEST_ISSET_ID);
}
public void setDataCacheRequestIsSet(boolean value) {
__isset_bitfield = org.apache.thrift.EncodingUtils.setBit(__isset_bitfield, __DATACACHEREQUEST_ISSET_ID, value);
}
public int getLogSortsSize() {
return (this.logSorts == null) ? 0 : this.logSorts.size();
}
@org.apache.thrift.annotation.Nullable
public java.util.Iterator<RecoveryStatus> getLogSortsIterator() {
return (this.logSorts == null) ? null : this.logSorts.iterator();
}
public void addToLogSorts(RecoveryStatus elem) {
if (this.logSorts == null) {
this.logSorts = new java.util.ArrayList<RecoveryStatus>();
}
this.logSorts.add(elem);
}
@org.apache.thrift.annotation.Nullable
public java.util.List<RecoveryStatus> getLogSorts() {
return this.logSorts;
}
public TabletServerStatus setLogSorts(@org.apache.thrift.annotation.Nullable java.util.List<RecoveryStatus> logSorts) {
this.logSorts = logSorts;
return this;
}
public void unsetLogSorts() {
this.logSorts = null;
}
/** Returns true if field logSorts is set (has been assigned a value) and false otherwise */
public boolean isSetLogSorts() {
return this.logSorts != null;
}
public void setLogSortsIsSet(boolean value) {
if (!value) {
this.logSorts = null;
}
}
public long getFlushs() {
return this.flushs;
}
public TabletServerStatus setFlushs(long flushs) {
this.flushs = flushs;
setFlushsIsSet(true);
return this;
}
public void unsetFlushs() {
__isset_bitfield = org.apache.thrift.EncodingUtils.clearBit(__isset_bitfield, __FLUSHS_ISSET_ID);
}
/** Returns true if field flushs is set (has been assigned a value) and false otherwise */
public boolean isSetFlushs() {
return org.apache.thrift.EncodingUtils.testBit(__isset_bitfield, __FLUSHS_ISSET_ID);
}
public void setFlushsIsSet(boolean value) {
__isset_bitfield = org.apache.thrift.EncodingUtils.setBit(__isset_bitfield, __FLUSHS_ISSET_ID, value);
}
public long getSyncs() {
return this.syncs;
}
public TabletServerStatus setSyncs(long syncs) {
this.syncs = syncs;
setSyncsIsSet(true);
return this;
}
public void unsetSyncs() {
__isset_bitfield = org.apache.thrift.EncodingUtils.clearBit(__isset_bitfield, __SYNCS_ISSET_ID);
}
/** Returns true if field syncs is set (has been assigned a value) and false otherwise */
public boolean isSetSyncs() {
return org.apache.thrift.EncodingUtils.testBit(__isset_bitfield, __SYNCS_ISSET_ID);
}
public void setSyncsIsSet(boolean value) {
__isset_bitfield = org.apache.thrift.EncodingUtils.setBit(__isset_bitfield, __SYNCS_ISSET_ID, value);
}
public int getBulkImportsSize() {
return (this.bulkImports == null) ? 0 : this.bulkImports.size();
}
@org.apache.thrift.annotation.Nullable
public java.util.Iterator<BulkImportStatus> getBulkImportsIterator() {
return (this.bulkImports == null) ? null : this.bulkImports.iterator();
}
public void addToBulkImports(BulkImportStatus elem) {
if (this.bulkImports == null) {
this.bulkImports = new java.util.ArrayList<BulkImportStatus>();
}
this.bulkImports.add(elem);
}
@org.apache.thrift.annotation.Nullable
public java.util.List<BulkImportStatus> getBulkImports() {
return this.bulkImports;
}
public TabletServerStatus setBulkImports(@org.apache.thrift.annotation.Nullable java.util.List<BulkImportStatus> bulkImports) {
this.bulkImports = bulkImports;
return this;
}
public void unsetBulkImports() {
this.bulkImports = null;
}
/** Returns true if field bulkImports is set (has been assigned a value) and false otherwise */
public boolean isSetBulkImports() {
return this.bulkImports != null;
}
public void setBulkImportsIsSet(boolean value) {
if (!value) {
this.bulkImports = null;
}
}
@org.apache.thrift.annotation.Nullable
public java.lang.String getVersion() {
return this.version;
}
public TabletServerStatus setVersion(@org.apache.thrift.annotation.Nullable java.lang.String version) {
this.version = version;
return this;
}
public void unsetVersion() {
this.version = null;
}
/** Returns true if field version is set (has been assigned a value) and false otherwise */
public boolean isSetVersion() {
return this.version != null;
}
public void setVersionIsSet(boolean value) {
if (!value) {
this.version = null;
}
}
public long getResponseTime() {
return this.responseTime;
}
public TabletServerStatus setResponseTime(long responseTime) {
this.responseTime = responseTime;
setResponseTimeIsSet(true);
return this;
}
public void unsetResponseTime() {
__isset_bitfield = org.apache.thrift.EncodingUtils.clearBit(__isset_bitfield, __RESPONSETIME_ISSET_ID);
}
/** Returns true if field responseTime is set (has been assigned a value) and false otherwise */
public boolean isSetResponseTime() {
return org.apache.thrift.EncodingUtils.testBit(__isset_bitfield, __RESPONSETIME_ISSET_ID);
}
public void setResponseTimeIsSet(boolean value) {
__isset_bitfield = org.apache.thrift.EncodingUtils.setBit(__isset_bitfield, __RESPONSETIME_ISSET_ID, value);
}
public void setFieldValue(_Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) {
switch (field) {
case TABLE_MAP:
if (value == null) {
unsetTableMap();
} else {
setTableMap((java.util.Map<java.lang.String,TableInfo>)value);
}
break;
case LAST_CONTACT:
if (value == null) {
unsetLastContact();
} else {
setLastContact((java.lang.Long)value);
}
break;
case NAME:
if (value == null) {
unsetName();
} else {
setName((java.lang.String)value);
}
break;
case OS_LOAD:
if (value == null) {
unsetOsLoad();
} else {
setOsLoad((java.lang.Double)value);
}
break;
case HOLD_TIME:
if (value == null) {
unsetHoldTime();
} else {
setHoldTime((java.lang.Long)value);
}
break;
case LOOKUPS:
if (value == null) {
unsetLookups();
} else {
setLookups((java.lang.Long)value);
}
break;
case INDEX_CACHE_HITS:
if (value == null) {
unsetIndexCacheHits();
} else {
setIndexCacheHits((java.lang.Long)value);
}
break;
case INDEX_CACHE_REQUEST:
if (value == null) {
unsetIndexCacheRequest();
} else {
setIndexCacheRequest((java.lang.Long)value);
}
break;
case DATA_CACHE_HITS:
if (value == null) {
unsetDataCacheHits();
} else {
setDataCacheHits((java.lang.Long)value);
}
break;
case DATA_CACHE_REQUEST:
if (value == null) {
unsetDataCacheRequest();
} else {
setDataCacheRequest((java.lang.Long)value);
}
break;
case LOG_SORTS:
if (value == null) {
unsetLogSorts();
} else {
setLogSorts((java.util.List<RecoveryStatus>)value);
}
break;
case FLUSHS:
if (value == null) {
unsetFlushs();
} else {
setFlushs((java.lang.Long)value);
}
break;
case SYNCS:
if (value == null) {
unsetSyncs();
} else {
setSyncs((java.lang.Long)value);
}
break;
case BULK_IMPORTS:
if (value == null) {
unsetBulkImports();
} else {
setBulkImports((java.util.List<BulkImportStatus>)value);
}
break;
case VERSION:
if (value == null) {
unsetVersion();
} else {
setVersion((java.lang.String)value);
}
break;
case RESPONSE_TIME:
if (value == null) {
unsetResponseTime();
} else {
setResponseTime((java.lang.Long)value);
}
break;
}
}
@org.apache.thrift.annotation.Nullable
public java.lang.Object getFieldValue(_Fields field) {
switch (field) {
case TABLE_MAP:
return getTableMap();
case LAST_CONTACT:
return getLastContact();
case NAME:
return getName();
case OS_LOAD:
return getOsLoad();
case HOLD_TIME:
return getHoldTime();
case LOOKUPS:
return getLookups();
case INDEX_CACHE_HITS:
return getIndexCacheHits();
case INDEX_CACHE_REQUEST:
return getIndexCacheRequest();
case DATA_CACHE_HITS:
return getDataCacheHits();
case DATA_CACHE_REQUEST:
return getDataCacheRequest();
case LOG_SORTS:
return getLogSorts();
case FLUSHS:
return getFlushs();
case SYNCS:
return getSyncs();
case BULK_IMPORTS:
return getBulkImports();
case VERSION:
return getVersion();
case RESPONSE_TIME:
return getResponseTime();
}
throw new java.lang.IllegalStateException();
}
/** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
public boolean isSet(_Fields field) {
if (field == null) {
throw new java.lang.IllegalArgumentException();
}
switch (field) {
case TABLE_MAP:
return isSetTableMap();
case LAST_CONTACT:
return isSetLastContact();
case NAME:
return isSetName();
case OS_LOAD:
return isSetOsLoad();
case HOLD_TIME:
return isSetHoldTime();
case LOOKUPS:
return isSetLookups();
case INDEX_CACHE_HITS:
return isSetIndexCacheHits();
case INDEX_CACHE_REQUEST:
return isSetIndexCacheRequest();
case DATA_CACHE_HITS:
return isSetDataCacheHits();
case DATA_CACHE_REQUEST:
return isSetDataCacheRequest();
case LOG_SORTS:
return isSetLogSorts();
case FLUSHS:
return isSetFlushs();
case SYNCS:
return isSetSyncs();
case BULK_IMPORTS:
return isSetBulkImports();
case VERSION:
return isSetVersion();
case RESPONSE_TIME:
return isSetResponseTime();
}
throw new java.lang.IllegalStateException();
}
@Override
public boolean equals(java.lang.Object that) {
if (that == null)
return false;
if (that instanceof TabletServerStatus)
return this.equals((TabletServerStatus)that);
return false;
}
public boolean equals(TabletServerStatus that) {
if (that == null)
return false;
if (this == that)
return true;
boolean this_present_tableMap = true && this.isSetTableMap();
boolean that_present_tableMap = true && that.isSetTableMap();
if (this_present_tableMap || that_present_tableMap) {
if (!(this_present_tableMap && that_present_tableMap))
return false;
if (!this.tableMap.equals(that.tableMap))
return false;
}
boolean this_present_lastContact = true;
boolean that_present_lastContact = true;
if (this_present_lastContact || that_present_lastContact) {
if (!(this_present_lastContact && that_present_lastContact))
return false;
if (this.lastContact != that.lastContact)
return false;
}
boolean this_present_name = true && this.isSetName();
boolean that_present_name = true && that.isSetName();
if (this_present_name || that_present_name) {
if (!(this_present_name && that_present_name))
return false;
if (!this.name.equals(that.name))
return false;
}
boolean this_present_osLoad = true;
boolean that_present_osLoad = true;
if (this_present_osLoad || that_present_osLoad) {
if (!(this_present_osLoad && that_present_osLoad))
return false;
if (this.osLoad != that.osLoad)
return false;
}
boolean this_present_holdTime = true;
boolean that_present_holdTime = true;
if (this_present_holdTime || that_present_holdTime) {
if (!(this_present_holdTime && that_present_holdTime))
return false;
if (this.holdTime != that.holdTime)
return false;
}
boolean this_present_lookups = true;
boolean that_present_lookups = true;
if (this_present_lookups || that_present_lookups) {
if (!(this_present_lookups && that_present_lookups))
return false;
if (this.lookups != that.lookups)
return false;
}
boolean this_present_indexCacheHits = true;
boolean that_present_indexCacheHits = true;
if (this_present_indexCacheHits || that_present_indexCacheHits) {
if (!(this_present_indexCacheHits && that_present_indexCacheHits))
return false;
if (this.indexCacheHits != that.indexCacheHits)
return false;
}
boolean this_present_indexCacheRequest = true;
boolean that_present_indexCacheRequest = true;
if (this_present_indexCacheRequest || that_present_indexCacheRequest) {
if (!(this_present_indexCacheRequest && that_present_indexCacheRequest))
return false;
if (this.indexCacheRequest != that.indexCacheRequest)
return false;
}
boolean this_present_dataCacheHits = true;
boolean that_present_dataCacheHits = true;
if (this_present_dataCacheHits || that_present_dataCacheHits) {
if (!(this_present_dataCacheHits && that_present_dataCacheHits))
return false;
if (this.dataCacheHits != that.dataCacheHits)
return false;
}
boolean this_present_dataCacheRequest = true;
boolean that_present_dataCacheRequest = true;
if (this_present_dataCacheRequest || that_present_dataCacheRequest) {
if (!(this_present_dataCacheRequest && that_present_dataCacheRequest))
return false;
if (this.dataCacheRequest != that.dataCacheRequest)
return false;
}
boolean this_present_logSorts = true && this.isSetLogSorts();
boolean that_present_logSorts = true && that.isSetLogSorts();
if (this_present_logSorts || that_present_logSorts) {
if (!(this_present_logSorts && that_present_logSorts))
return false;
if (!this.logSorts.equals(that.logSorts))
return false;
}
boolean this_present_flushs = true;
boolean that_present_flushs = true;
if (this_present_flushs || that_present_flushs) {
if (!(this_present_flushs && that_present_flushs))
return false;
if (this.flushs != that.flushs)
return false;
}
boolean this_present_syncs = true;
boolean that_present_syncs = true;
if (this_present_syncs || that_present_syncs) {
if (!(this_present_syncs && that_present_syncs))
return false;
if (this.syncs != that.syncs)
return false;
}
boolean this_present_bulkImports = true && this.isSetBulkImports();
boolean that_present_bulkImports = true && that.isSetBulkImports();
if (this_present_bulkImports || that_present_bulkImports) {
if (!(this_present_bulkImports && that_present_bulkImports))
return false;
if (!this.bulkImports.equals(that.bulkImports))
return false;
}
boolean this_present_version = true && this.isSetVersion();
boolean that_present_version = true && that.isSetVersion();
if (this_present_version || that_present_version) {
if (!(this_present_version && that_present_version))
return false;
if (!this.version.equals(that.version))
return false;
}
boolean this_present_responseTime = true;
boolean that_present_responseTime = true;
if (this_present_responseTime || that_present_responseTime) {
if (!(this_present_responseTime && that_present_responseTime))
return false;
if (this.responseTime != that.responseTime)
return false;
}
return true;
}
@Override
public int hashCode() {
int hashCode = 1;
hashCode = hashCode * 8191 + ((isSetTableMap()) ? 131071 : 524287);
if (isSetTableMap())
hashCode = hashCode * 8191 + tableMap.hashCode();
hashCode = hashCode * 8191 + org.apache.thrift.TBaseHelper.hashCode(lastContact);
hashCode = hashCode * 8191 + ((isSetName()) ? 131071 : 524287);
if (isSetName())
hashCode = hashCode * 8191 + name.hashCode();
hashCode = hashCode * 8191 + org.apache.thrift.TBaseHelper.hashCode(osLoad);
hashCode = hashCode * 8191 + org.apache.thrift.TBaseHelper.hashCode(holdTime);
hashCode = hashCode * 8191 + org.apache.thrift.TBaseHelper.hashCode(lookups);
hashCode = hashCode * 8191 + org.apache.thrift.TBaseHelper.hashCode(indexCacheHits);
hashCode = hashCode * 8191 + org.apache.thrift.TBaseHelper.hashCode(indexCacheRequest);
hashCode = hashCode * 8191 + org.apache.thrift.TBaseHelper.hashCode(dataCacheHits);
hashCode = hashCode * 8191 + org.apache.thrift.TBaseHelper.hashCode(dataCacheRequest);
hashCode = hashCode * 8191 + ((isSetLogSorts()) ? 131071 : 524287);
if (isSetLogSorts())
hashCode = hashCode * 8191 + logSorts.hashCode();
hashCode = hashCode * 8191 + org.apache.thrift.TBaseHelper.hashCode(flushs);
hashCode = hashCode * 8191 + org.apache.thrift.TBaseHelper.hashCode(syncs);
hashCode = hashCode * 8191 + ((isSetBulkImports()) ? 131071 : 524287);
if (isSetBulkImports())
hashCode = hashCode * 8191 + bulkImports.hashCode();
hashCode = hashCode * 8191 + ((isSetVersion()) ? 131071 : 524287);
if (isSetVersion())
hashCode = hashCode * 8191 + version.hashCode();
hashCode = hashCode * 8191 + org.apache.thrift.TBaseHelper.hashCode(responseTime);
return hashCode;
}
@Override
public int compareTo(TabletServerStatus other) {
if (!getClass().equals(other.getClass())) {
return getClass().getName().compareTo(other.getClass().getName());
}
int lastComparison = 0;
lastComparison = java.lang.Boolean.valueOf(isSetTableMap()).compareTo(other.isSetTableMap());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetTableMap()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.tableMap, other.tableMap);
if (lastComparison != 0) {
return lastComparison;
}
}
lastComparison = java.lang.Boolean.valueOf(isSetLastContact()).compareTo(other.isSetLastContact());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetLastContact()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.lastContact, other.lastContact);
if (lastComparison != 0) {
return lastComparison;
}
}
lastComparison = java.lang.Boolean.valueOf(isSetName()).compareTo(other.isSetName());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetName()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.name, other.name);
if (lastComparison != 0) {
return lastComparison;
}
}
lastComparison = java.lang.Boolean.valueOf(isSetOsLoad()).compareTo(other.isSetOsLoad());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetOsLoad()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.osLoad, other.osLoad);
if (lastComparison != 0) {
return lastComparison;
}
}
lastComparison = java.lang.Boolean.valueOf(isSetHoldTime()).compareTo(other.isSetHoldTime());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetHoldTime()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.holdTime, other.holdTime);
if (lastComparison != 0) {
return lastComparison;
}
}
lastComparison = java.lang.Boolean.valueOf(isSetLookups()).compareTo(other.isSetLookups());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetLookups()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.lookups, other.lookups);
if (lastComparison != 0) {
return lastComparison;
}
}
lastComparison = java.lang.Boolean.valueOf(isSetIndexCacheHits()).compareTo(other.isSetIndexCacheHits());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetIndexCacheHits()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.indexCacheHits, other.indexCacheHits);
if (lastComparison != 0) {
return lastComparison;
}
}
lastComparison = java.lang.Boolean.valueOf(isSetIndexCacheRequest()).compareTo(other.isSetIndexCacheRequest());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetIndexCacheRequest()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.indexCacheRequest, other.indexCacheRequest);
if (lastComparison != 0) {
return lastComparison;
}
}
lastComparison = java.lang.Boolean.valueOf(isSetDataCacheHits()).compareTo(other.isSetDataCacheHits());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetDataCacheHits()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.dataCacheHits, other.dataCacheHits);
if (lastComparison != 0) {
return lastComparison;
}
}
lastComparison = java.lang.Boolean.valueOf(isSetDataCacheRequest()).compareTo(other.isSetDataCacheRequest());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetDataCacheRequest()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.dataCacheRequest, other.dataCacheRequest);
if (lastComparison != 0) {
return lastComparison;
}
}
lastComparison = java.lang.Boolean.valueOf(isSetLogSorts()).compareTo(other.isSetLogSorts());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetLogSorts()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.logSorts, other.logSorts);
if (lastComparison != 0) {
return lastComparison;
}
}
lastComparison = java.lang.Boolean.valueOf(isSetFlushs()).compareTo(other.isSetFlushs());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetFlushs()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.flushs, other.flushs);
if (lastComparison != 0) {
return lastComparison;
}
}
lastComparison = java.lang.Boolean.valueOf(isSetSyncs()).compareTo(other.isSetSyncs());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetSyncs()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.syncs, other.syncs);
if (lastComparison != 0) {
return lastComparison;
}
}
lastComparison = java.lang.Boolean.valueOf(isSetBulkImports()).compareTo(other.isSetBulkImports());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetBulkImports()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.bulkImports, other.bulkImports);
if (lastComparison != 0) {
return lastComparison;
}
}
lastComparison = java.lang.Boolean.valueOf(isSetVersion()).compareTo(other.isSetVersion());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetVersion()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.version, other.version);
if (lastComparison != 0) {
return lastComparison;
}
}
lastComparison = java.lang.Boolean.valueOf(isSetResponseTime()).compareTo(other.isSetResponseTime());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetResponseTime()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.responseTime, other.responseTime);
if (lastComparison != 0) {
return lastComparison;
}
}
return 0;
}
@org.apache.thrift.annotation.Nullable
public _Fields fieldForId(int fieldId) {
return _Fields.findByThriftId(fieldId);
}
public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
scheme(iprot).read(iprot, this);
}
public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
scheme(oprot).write(oprot, this);
}
@Override
public java.lang.String toString() {
java.lang.StringBuilder sb = new java.lang.StringBuilder("TabletServerStatus(");
boolean first = true;
sb.append("tableMap:");
if (this.tableMap == null) {
sb.append("null");
} else {
sb.append(this.tableMap);
}
first = false;
if (!first) sb.append(", ");
sb.append("lastContact:");
sb.append(this.lastContact);
first = false;
if (!first) sb.append(", ");
sb.append("name:");
if (this.name == null) {
sb.append("null");
} else {
sb.append(this.name);
}
first = false;
if (!first) sb.append(", ");
sb.append("osLoad:");
sb.append(this.osLoad);
first = false;
if (!first) sb.append(", ");
sb.append("holdTime:");
sb.append(this.holdTime);
first = false;
if (!first) sb.append(", ");
sb.append("lookups:");
sb.append(this.lookups);
first = false;
if (!first) sb.append(", ");
sb.append("indexCacheHits:");
sb.append(this.indexCacheHits);
first = false;
if (!first) sb.append(", ");
sb.append("indexCacheRequest:");
sb.append(this.indexCacheRequest);
first = false;
if (!first) sb.append(", ");
sb.append("dataCacheHits:");
sb.append(this.dataCacheHits);
first = false;
if (!first) sb.append(", ");
sb.append("dataCacheRequest:");
sb.append(this.dataCacheRequest);
first = false;
if (!first) sb.append(", ");
sb.append("logSorts:");
if (this.logSorts == null) {
sb.append("null");
} else {
sb.append(this.logSorts);
}
first = false;
if (!first) sb.append(", ");
sb.append("flushs:");
sb.append(this.flushs);
first = false;
if (!first) sb.append(", ");
sb.append("syncs:");
sb.append(this.syncs);
first = false;
if (!first) sb.append(", ");
sb.append("bulkImports:");
if (this.bulkImports == null) {
sb.append("null");
} else {
sb.append(this.bulkImports);
}
first = false;
if (!first) sb.append(", ");
sb.append("version:");
if (this.version == null) {
sb.append("null");
} else {
sb.append(this.version);
}
first = false;
if (!first) sb.append(", ");
sb.append("responseTime:");
sb.append(this.responseTime);
first = false;
sb.append(")");
return sb.toString();
}
public void validate() throws org.apache.thrift.TException {
// check for required fields
// check for sub-struct validity
}
private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
try {
write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
} catch (org.apache.thrift.TException te) {
throw new java.io.IOException(te);
}
}
private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, java.lang.ClassNotFoundException {
try {
// it doesn't seem like you should have to do this, but java serialization is wacky, and doesn't call the default constructor.
__isset_bitfield = 0;
read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
} catch (org.apache.thrift.TException te) {
throw new java.io.IOException(te);
}
}
private static class TabletServerStatusStandardSchemeFactory implements org.apache.thrift.scheme.SchemeFactory {
public TabletServerStatusStandardScheme getScheme() {
return new TabletServerStatusStandardScheme();
}
}
private static class TabletServerStatusStandardScheme extends org.apache.thrift.scheme.StandardScheme<TabletServerStatus> {
public void read(org.apache.thrift.protocol.TProtocol iprot, TabletServerStatus struct) throws org.apache.thrift.TException {
org.apache.thrift.protocol.TField schemeField;
iprot.readStructBegin();
while (true)
{
schemeField = iprot.readFieldBegin();
if (schemeField.type == org.apache.thrift.protocol.TType.STOP) {
break;
}
switch (schemeField.id) {
case 1: // TABLE_MAP
if (schemeField.type == org.apache.thrift.protocol.TType.MAP) {
{
org.apache.thrift.protocol.TMap _map0 = iprot.readMapBegin();
struct.tableMap = new java.util.HashMap<java.lang.String,TableInfo>(2*_map0.size);
@org.apache.thrift.annotation.Nullable java.lang.String _key1;
@org.apache.thrift.annotation.Nullable TableInfo _val2;
for (int _i3 = 0; _i3 < _map0.size; ++_i3)
{
_key1 = iprot.readString();
_val2 = new TableInfo();
_val2.read(iprot);
struct.tableMap.put(_key1, _val2);
}
iprot.readMapEnd();
}
struct.setTableMapIsSet(true);
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
case 2: // LAST_CONTACT
if (schemeField.type == org.apache.thrift.protocol.TType.I64) {
struct.lastContact = iprot.readI64();
struct.setLastContactIsSet(true);
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
case 3: // NAME
if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
struct.name = iprot.readString();
struct.setNameIsSet(true);
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
case 5: // OS_LOAD
if (schemeField.type == org.apache.thrift.protocol.TType.DOUBLE) {
struct.osLoad = iprot.readDouble();
struct.setOsLoadIsSet(true);
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
case 7: // HOLD_TIME
if (schemeField.type == org.apache.thrift.protocol.TType.I64) {
struct.holdTime = iprot.readI64();
struct.setHoldTimeIsSet(true);
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
case 8: // LOOKUPS
if (schemeField.type == org.apache.thrift.protocol.TType.I64) {
struct.lookups = iprot.readI64();
struct.setLookupsIsSet(true);
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
case 10: // INDEX_CACHE_HITS
if (schemeField.type == org.apache.thrift.protocol.TType.I64) {
struct.indexCacheHits = iprot.readI64();
struct.setIndexCacheHitsIsSet(true);
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
case 11: // INDEX_CACHE_REQUEST
if (schemeField.type == org.apache.thrift.protocol.TType.I64) {
struct.indexCacheRequest = iprot.readI64();
struct.setIndexCacheRequestIsSet(true);
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
case 12: // DATA_CACHE_HITS
if (schemeField.type == org.apache.thrift.protocol.TType.I64) {
struct.dataCacheHits = iprot.readI64();
struct.setDataCacheHitsIsSet(true);
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
case 13: // DATA_CACHE_REQUEST
if (schemeField.type == org.apache.thrift.protocol.TType.I64) {
struct.dataCacheRequest = iprot.readI64();
struct.setDataCacheRequestIsSet(true);
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
case 14: // LOG_SORTS
if (schemeField.type == org.apache.thrift.protocol.TType.LIST) {
{
org.apache.thrift.protocol.TList _list4 = iprot.readListBegin();
struct.logSorts = new java.util.ArrayList<RecoveryStatus>(_list4.size);
@org.apache.thrift.annotation.Nullable RecoveryStatus _elem5;
for (int _i6 = 0; _i6 < _list4.size; ++_i6)
{
_elem5 = new RecoveryStatus();
_elem5.read(iprot);
struct.logSorts.add(_elem5);
}
iprot.readListEnd();
}
struct.setLogSortsIsSet(true);
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
case 15: // FLUSHS
if (schemeField.type == org.apache.thrift.protocol.TType.I64) {
struct.flushs = iprot.readI64();
struct.setFlushsIsSet(true);
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
case 16: // SYNCS
if (schemeField.type == org.apache.thrift.protocol.TType.I64) {
struct.syncs = iprot.readI64();
struct.setSyncsIsSet(true);
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
case 17: // BULK_IMPORTS
if (schemeField.type == org.apache.thrift.protocol.TType.LIST) {
{
org.apache.thrift.protocol.TList _list7 = iprot.readListBegin();
struct.bulkImports = new java.util.ArrayList<BulkImportStatus>(_list7.size);
@org.apache.thrift.annotation.Nullable BulkImportStatus _elem8;
for (int _i9 = 0; _i9 < _list7.size; ++_i9)
{
_elem8 = new BulkImportStatus();
_elem8.read(iprot);
struct.bulkImports.add(_elem8);
}
iprot.readListEnd();
}
struct.setBulkImportsIsSet(true);
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
case 19: // VERSION
if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
struct.version = iprot.readString();
struct.setVersionIsSet(true);
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
case 18: // RESPONSE_TIME
if (schemeField.type == org.apache.thrift.protocol.TType.I64) {
struct.responseTime = iprot.readI64();
struct.setResponseTimeIsSet(true);
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
default:
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
iprot.readFieldEnd();
}
iprot.readStructEnd();
// check for required fields of primitive type, which can't be checked in the validate method
struct.validate();
}
public void write(org.apache.thrift.protocol.TProtocol oprot, TabletServerStatus struct) throws org.apache.thrift.TException {
struct.validate();
oprot.writeStructBegin(STRUCT_DESC);
if (struct.tableMap != null) {
oprot.writeFieldBegin(TABLE_MAP_FIELD_DESC);
{
oprot.writeMapBegin(new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.STRING, org.apache.thrift.protocol.TType.STRUCT, struct.tableMap.size()));
for (java.util.Map.Entry<java.lang.String, TableInfo> _iter10 : struct.tableMap.entrySet())
{
oprot.writeString(_iter10.getKey());
_iter10.getValue().write(oprot);
}
oprot.writeMapEnd();
}
oprot.writeFieldEnd();
}
oprot.writeFieldBegin(LAST_CONTACT_FIELD_DESC);
oprot.writeI64(struct.lastContact);
oprot.writeFieldEnd();
if (struct.name != null) {
oprot.writeFieldBegin(NAME_FIELD_DESC);
oprot.writeString(struct.name);
oprot.writeFieldEnd();
}
oprot.writeFieldBegin(OS_LOAD_FIELD_DESC);
oprot.writeDouble(struct.osLoad);
oprot.writeFieldEnd();
oprot.writeFieldBegin(HOLD_TIME_FIELD_DESC);
oprot.writeI64(struct.holdTime);
oprot.writeFieldEnd();
oprot.writeFieldBegin(LOOKUPS_FIELD_DESC);
oprot.writeI64(struct.lookups);
oprot.writeFieldEnd();
oprot.writeFieldBegin(INDEX_CACHE_HITS_FIELD_DESC);
oprot.writeI64(struct.indexCacheHits);
oprot.writeFieldEnd();
oprot.writeFieldBegin(INDEX_CACHE_REQUEST_FIELD_DESC);
oprot.writeI64(struct.indexCacheRequest);
oprot.writeFieldEnd();
oprot.writeFieldBegin(DATA_CACHE_HITS_FIELD_DESC);
oprot.writeI64(struct.dataCacheHits);
oprot.writeFieldEnd();
oprot.writeFieldBegin(DATA_CACHE_REQUEST_FIELD_DESC);
oprot.writeI64(struct.dataCacheRequest);
oprot.writeFieldEnd();
if (struct.logSorts != null) {
oprot.writeFieldBegin(LOG_SORTS_FIELD_DESC);
{
oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, struct.logSorts.size()));
for (RecoveryStatus _iter11 : struct.logSorts)
{
_iter11.write(oprot);
}
oprot.writeListEnd();
}
oprot.writeFieldEnd();
}
oprot.writeFieldBegin(FLUSHS_FIELD_DESC);
oprot.writeI64(struct.flushs);
oprot.writeFieldEnd();
oprot.writeFieldBegin(SYNCS_FIELD_DESC);
oprot.writeI64(struct.syncs);
oprot.writeFieldEnd();
if (struct.bulkImports != null) {
oprot.writeFieldBegin(BULK_IMPORTS_FIELD_DESC);
{
oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, struct.bulkImports.size()));
for (BulkImportStatus _iter12 : struct.bulkImports)
{
_iter12.write(oprot);
}
oprot.writeListEnd();
}
oprot.writeFieldEnd();
}
oprot.writeFieldBegin(RESPONSE_TIME_FIELD_DESC);
oprot.writeI64(struct.responseTime);
oprot.writeFieldEnd();
if (struct.version != null) {
oprot.writeFieldBegin(VERSION_FIELD_DESC);
oprot.writeString(struct.version);
oprot.writeFieldEnd();
}
oprot.writeFieldStop();
oprot.writeStructEnd();
}
}
private static class TabletServerStatusTupleSchemeFactory implements org.apache.thrift.scheme.SchemeFactory {
public TabletServerStatusTupleScheme getScheme() {
return new TabletServerStatusTupleScheme();
}
}
private static class TabletServerStatusTupleScheme extends org.apache.thrift.scheme.TupleScheme<TabletServerStatus> {
@Override
public void write(org.apache.thrift.protocol.TProtocol prot, TabletServerStatus struct) throws org.apache.thrift.TException {
org.apache.thrift.protocol.TTupleProtocol oprot = (org.apache.thrift.protocol.TTupleProtocol) prot;
java.util.BitSet optionals = new java.util.BitSet();
if (struct.isSetTableMap()) {
optionals.set(0);
}
if (struct.isSetLastContact()) {
optionals.set(1);
}
if (struct.isSetName()) {
optionals.set(2);
}
if (struct.isSetOsLoad()) {
optionals.set(3);
}
if (struct.isSetHoldTime()) {
optionals.set(4);
}
if (struct.isSetLookups()) {
optionals.set(5);
}
if (struct.isSetIndexCacheHits()) {
optionals.set(6);
}
if (struct.isSetIndexCacheRequest()) {
optionals.set(7);
}
if (struct.isSetDataCacheHits()) {
optionals.set(8);
}
if (struct.isSetDataCacheRequest()) {
optionals.set(9);
}
if (struct.isSetLogSorts()) {
optionals.set(10);
}
if (struct.isSetFlushs()) {
optionals.set(11);
}
if (struct.isSetSyncs()) {
optionals.set(12);
}
if (struct.isSetBulkImports()) {
optionals.set(13);
}
if (struct.isSetVersion()) {
optionals.set(14);
}
if (struct.isSetResponseTime()) {
optionals.set(15);
}
oprot.writeBitSet(optionals, 16);
if (struct.isSetTableMap()) {
{
oprot.writeI32(struct.tableMap.size());
for (java.util.Map.Entry<java.lang.String, TableInfo> _iter13 : struct.tableMap.entrySet())
{
oprot.writeString(_iter13.getKey());
_iter13.getValue().write(oprot);
}
}
}
if (struct.isSetLastContact()) {
oprot.writeI64(struct.lastContact);
}
if (struct.isSetName()) {
oprot.writeString(struct.name);
}
if (struct.isSetOsLoad()) {
oprot.writeDouble(struct.osLoad);
}
if (struct.isSetHoldTime()) {
oprot.writeI64(struct.holdTime);
}
if (struct.isSetLookups()) {
oprot.writeI64(struct.lookups);
}
if (struct.isSetIndexCacheHits()) {
oprot.writeI64(struct.indexCacheHits);
}
if (struct.isSetIndexCacheRequest()) {
oprot.writeI64(struct.indexCacheRequest);
}
if (struct.isSetDataCacheHits()) {
oprot.writeI64(struct.dataCacheHits);
}
if (struct.isSetDataCacheRequest()) {
oprot.writeI64(struct.dataCacheRequest);
}
if (struct.isSetLogSorts()) {
{
oprot.writeI32(struct.logSorts.size());
for (RecoveryStatus _iter14 : struct.logSorts)
{
_iter14.write(oprot);
}
}
}
if (struct.isSetFlushs()) {
oprot.writeI64(struct.flushs);
}
if (struct.isSetSyncs()) {
oprot.writeI64(struct.syncs);
}
if (struct.isSetBulkImports()) {
{
oprot.writeI32(struct.bulkImports.size());
for (BulkImportStatus _iter15 : struct.bulkImports)
{
_iter15.write(oprot);
}
}
}
if (struct.isSetVersion()) {
oprot.writeString(struct.version);
}
if (struct.isSetResponseTime()) {
oprot.writeI64(struct.responseTime);
}
}
@Override
public void read(org.apache.thrift.protocol.TProtocol prot, TabletServerStatus struct) throws org.apache.thrift.TException {
org.apache.thrift.protocol.TTupleProtocol iprot = (org.apache.thrift.protocol.TTupleProtocol) prot;
java.util.BitSet incoming = iprot.readBitSet(16);
if (incoming.get(0)) {
{
org.apache.thrift.protocol.TMap _map16 = new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.STRING, org.apache.thrift.protocol.TType.STRUCT, iprot.readI32());
struct.tableMap = new java.util.HashMap<java.lang.String,TableInfo>(2*_map16.size);
@org.apache.thrift.annotation.Nullable java.lang.String _key17;
@org.apache.thrift.annotation.Nullable TableInfo _val18;
for (int _i19 = 0; _i19 < _map16.size; ++_i19)
{
_key17 = iprot.readString();
_val18 = new TableInfo();
_val18.read(iprot);
struct.tableMap.put(_key17, _val18);
}
}
struct.setTableMapIsSet(true);
}
if (incoming.get(1)) {
struct.lastContact = iprot.readI64();
struct.setLastContactIsSet(true);
}
if (incoming.get(2)) {
struct.name = iprot.readString();
struct.setNameIsSet(true);
}
if (incoming.get(3)) {
struct.osLoad = iprot.readDouble();
struct.setOsLoadIsSet(true);
}
if (incoming.get(4)) {
struct.holdTime = iprot.readI64();
struct.setHoldTimeIsSet(true);
}
if (incoming.get(5)) {
struct.lookups = iprot.readI64();
struct.setLookupsIsSet(true);
}
if (incoming.get(6)) {
struct.indexCacheHits = iprot.readI64();
struct.setIndexCacheHitsIsSet(true);
}
if (incoming.get(7)) {
struct.indexCacheRequest = iprot.readI64();
struct.setIndexCacheRequestIsSet(true);
}
if (incoming.get(8)) {
struct.dataCacheHits = iprot.readI64();
struct.setDataCacheHitsIsSet(true);
}
if (incoming.get(9)) {
struct.dataCacheRequest = iprot.readI64();
struct.setDataCacheRequestIsSet(true);
}
if (incoming.get(10)) {
{
org.apache.thrift.protocol.TList _list20 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, iprot.readI32());
struct.logSorts = new java.util.ArrayList<RecoveryStatus>(_list20.size);
@org.apache.thrift.annotation.Nullable RecoveryStatus _elem21;
for (int _i22 = 0; _i22 < _list20.size; ++_i22)
{
_elem21 = new RecoveryStatus();
_elem21.read(iprot);
struct.logSorts.add(_elem21);
}
}
struct.setLogSortsIsSet(true);
}
if (incoming.get(11)) {
struct.flushs = iprot.readI64();
struct.setFlushsIsSet(true);
}
if (incoming.get(12)) {
struct.syncs = iprot.readI64();
struct.setSyncsIsSet(true);
}
if (incoming.get(13)) {
{
org.apache.thrift.protocol.TList _list23 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, iprot.readI32());
struct.bulkImports = new java.util.ArrayList<BulkImportStatus>(_list23.size);
@org.apache.thrift.annotation.Nullable BulkImportStatus _elem24;
for (int _i25 = 0; _i25 < _list23.size; ++_i25)
{
_elem24 = new BulkImportStatus();
_elem24.read(iprot);
struct.bulkImports.add(_elem24);
}
}
struct.setBulkImportsIsSet(true);
}
if (incoming.get(14)) {
struct.version = iprot.readString();
struct.setVersionIsSet(true);
}
if (incoming.get(15)) {
struct.responseTime = iprot.readI64();
struct.setResponseTimeIsSet(true);
}
}
}
private static <S extends org.apache.thrift.scheme.IScheme> S scheme(org.apache.thrift.protocol.TProtocol proto) {
return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) ? STANDARD_SCHEME_FACTORY : TUPLE_SCHEME_FACTORY).getScheme();
}
private static void unusedMethod() {}
}
| {
"content_hash": "9151e2d0d6ad682d24b2e7010e78b46f",
"timestamp": "",
"source": "github",
"line_count": 2033,
"max_line_length": 198,
"avg_line_length": 35.79586817511068,
"alnum_prop": 0.6552842400340786,
"repo_name": "lstav/accumulo",
"id": "17a89adcc69a0dc3ca8dbb30da96de8012eb648d",
"size": "73580",
"binary": false,
"copies": "3",
"ref": "refs/heads/master",
"path": "core/src/main/java/org/apache/accumulo/core/master/thrift/TabletServerStatus.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "C",
"bytes": "2465"
},
{
"name": "C++",
"bytes": "37312"
},
{
"name": "CSS",
"bytes": "6443"
},
{
"name": "FreeMarker",
"bytes": "57422"
},
{
"name": "HTML",
"bytes": "5454"
},
{
"name": "Java",
"bytes": "18381917"
},
{
"name": "JavaScript",
"bytes": "71755"
},
{
"name": "Makefile",
"bytes": "2872"
},
{
"name": "Python",
"bytes": "7344"
},
{
"name": "Shell",
"bytes": "61899"
},
{
"name": "Thrift",
"bytes": "40724"
}
],
"symlink_target": ""
} |
describe('Build', function() {
'use strict';
var workspaceElement = null;
beforeEach(function() {
atom.config.set('build.keepVisible', true);
runs(function() {
workspaceElement = atom.views.getView(atom.workspace);
jasmine.attachToDOM(workspaceElement);
});
waitsForPromise(function() {
return atom.packages.activatePackage('build');
});
});
describe('when package is activated', function() {
it('should show build window', function() {
expect(workspaceElement.querySelector('.build')).toExist();
});
});
});
| {
"content_hash": "f1e97eb3d9078436947eb9f3c1b0970f",
"timestamp": "",
"source": "github",
"line_count": 24,
"max_line_length": 65,
"avg_line_length": 24.083333333333332,
"alnum_prop": 0.643598615916955,
"repo_name": "e-jigsaw/atom-build",
"id": "dd3dc14c831ee394a4d810be620d8c6f638d57f7",
"size": "579",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "spec/build-visible-spec.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "896"
},
{
"name": "JavaScript",
"bytes": "51060"
}
],
"symlink_target": ""
} |
#include "stdafx.h"
#include <zorba/xquery_exception.h>
#include "store/api/item_factory.h"
#include "store/api/iterator.h"
#include "system/globalenv.h"
#include "common.h"
using namespace std;
namespace zorba {
///////////////////////////////////////////////////////////////////////////////
bool get_attribute_value( store::Item_t const &element, char const *att_name,
zstring *att_value ) {
store::Iterator_t i( element->getAttributes() );
bool found = false;
i->open();
store::Item_t att_item;
while ( i->next( att_item ) ) {
if ( name_of( att_item ) == att_name ) {
att_item->getStringValue2( *att_value );
found = true;
break;
}
}
i->close();
return found;
}
zstring name_of( store::Item_t const &node, char const *ns ) {
store::Item_t const name( node->getNodeName() );
zstring const z_ns( name->getNamespace() );
zstring const z_local( name->getLocalName() );
if ( z_ns.empty() || (ns && z_ns == ns) )
return z_local;
return '{' + z_ns + '}' + z_local;
}
bool x2j_map_atomic( store::Item_t const &xml_item, store::Item_t *json_item ) {
if ( xml_item->isAtomic() ) {
switch ( xml_item->getTypeCode() ) {
case store::JS_NULL:
case store::XS_BOOLEAN:
case store::XS_BYTE:
case store::XS_DECIMAL:
case store::XS_DOUBLE:
case store::XS_ENTITY:
case store::XS_FLOAT:
case store::XS_ID:
case store::XS_IDREF:
case store::XS_INT:
case store::XS_INTEGER:
case store::XS_LONG:
case store::XS_NAME:
case store::XS_NCNAME:
case store::XS_NEGATIVE_INTEGER:
case store::XS_NMTOKEN:
case store::XS_NON_NEGATIVE_INTEGER:
case store::XS_NON_POSITIVE_INTEGER:
case store::XS_NORMALIZED_STRING:
case store::XS_POSITIVE_INTEGER:
case store::XS_SHORT:
case store::XS_STRING:
case store::XS_TOKEN:
case store::XS_UNSIGNED_BYTE:
case store::XS_UNSIGNED_INT:
case store::XS_UNSIGNED_LONG:
case store::XS_UNSIGNED_SHORT:
*json_item = xml_item;
break;
default:
zstring s( xml_item->getStringValue() );
GENV_ITEMFACTORY->createString( *json_item, s );
break;
} // switch
return true;
} // if
return false;
}
///////////////////////////////////////////////////////////////////////////////
#if ZORBA_DEBUG_JSON
ostream& operator<<( ostream &o, parse_state s ) {
static char const *const string_of[] = {
"in_array",
"in_object"
};
return o << string_of[ s ];
}
#endif /* ZORBA_DEBUG_JSON */
///////////////////////////////////////////////////////////////////////////////
} // namespace zorba
/* vim:set et sw=2 ts=2: */
| {
"content_hash": "52d2c63a45bc4c1577b26e23c3db8e49",
"timestamp": "",
"source": "github",
"line_count": 103,
"max_line_length": 80,
"avg_line_length": 26.563106796116504,
"alnum_prop": 0.5449561403508771,
"repo_name": "bgarrels/zorba",
"id": "3d011e49d0f378756c8306d515490652c1fa12f4",
"size": "3344",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "src/runtime/json/common.cpp",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "C",
"bytes": "964197"
},
{
"name": "C++",
"bytes": "17448935"
},
{
"name": "CMake",
"bytes": "497427"
},
{
"name": "HTML",
"bytes": "3131726"
},
{
"name": "JSONiq",
"bytes": "162641"
},
{
"name": "Java",
"bytes": "136"
},
{
"name": "Lex",
"bytes": "41399"
},
{
"name": "NSIS",
"bytes": "19787"
},
{
"name": "PHP",
"bytes": "6790"
},
{
"name": "Perl",
"bytes": "17432"
},
{
"name": "Python",
"bytes": "2118"
},
{
"name": "Shell",
"bytes": "38023"
},
{
"name": "XQuery",
"bytes": "2800978"
},
{
"name": "XSLT",
"bytes": "92314"
}
],
"symlink_target": ""
} |
package org.apache.camel.model;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;
import org.apache.camel.ExchangePattern;
import org.apache.camel.builder.EndpointProducerBuilder;
import org.apache.camel.spi.AsEndpointUri;
import org.apache.camel.spi.Metadata;
/**
* Sends the message to a dynamic endpoint
*/
@Metadata(label = "eip,routing")
@XmlRootElement(name = "toD")
@XmlAccessorType(XmlAccessType.FIELD)
public class ToDynamicDefinition extends NoOutputDefinition<ToDynamicDefinition> {
@XmlTransient
protected EndpointProducerBuilder endpointProducerBuilder;
@XmlAttribute
@Metadata(required = true)
private String uri;
@XmlAttribute
@Metadata(javaType = "org.apache.camel.ExchangePattern", enums = "InOnly,InOut,InOptionalOut")
private String pattern;
@XmlAttribute
@Metadata(javaType = "java.lang.Integer")
private String cacheSize;
@XmlAttribute
@Metadata(javaType = "java.lang.Boolean")
private String ignoreInvalidEndpoint;
@XmlAttribute
@Metadata(label = "advanced", defaultValue = "true", javaType = "java.lang.Boolean")
private String allowOptimisedComponents;
@XmlAttribute
@Metadata(label = "advanced", defaultValue = "true", javaType = "java.lang.Boolean")
private String autoStartComponents;
public ToDynamicDefinition() {
}
public ToDynamicDefinition(String uri) {
this.uri = uri;
}
@Override
public String getShortName() {
return "toD";
}
@Override
public String toString() {
return "DynamicTo[" + getLabel() + "]";
}
@Override
public String getLabel() {
return uri;
}
// Fluent API
// -------------------------------------------------------------------------
/**
* The uri of the endpoint to send to. The uri can be dynamic computed using the
* {@link org.apache.camel.language.simple.SimpleLanguage} expression.
*/
public ToDynamicDefinition uri(@AsEndpointUri String uri) {
setUri(uri);
return this;
}
/**
* The uri of the endpoint to send to.
*
* @param endpointProducerBuilder the dynamic endpoint to send to (resolved using simple language by default)
*/
public ToDynamicDefinition uri(@AsEndpointUri EndpointProducerBuilder endpointProducerBuilder) {
setEndpointProducerBuilder(endpointProducerBuilder);
return this;
}
/**
* Sets the optional {@link ExchangePattern} used to invoke this endpoint
*/
public ToDynamicDefinition pattern(ExchangePattern pattern) {
return pattern(pattern.name());
}
/**
* Sets the optional {@link ExchangePattern} used to invoke this endpoint
*/
public ToDynamicDefinition pattern(String pattern) {
setPattern(pattern);
return this;
}
/**
* Sets the maximum size used by the {@link org.apache.camel.spi.ProducerCache} which is used to cache and reuse
* producers when using this recipient list, when uris are reused.
*
* Beware that when using dynamic endpoints then it affects how well the cache can be utilized. If each dynamic
* endpoint is unique then its best to turn of caching by setting this to -1, which allows Camel to not cache both
* the producers and endpoints; they are regarded as prototype scoped and will be stopped and discarded after use.
* This reduces memory usage as otherwise producers/endpoints are stored in memory in the caches.
*
* However if there are a high degree of dynamic endpoints that have been used before, then it can benefit to use
* the cache to reuse both producers and endpoints and therefore the cache size can be set accordingly or rely on
* the default size (1000).
*
* If there is a mix of unique and used before dynamic endpoints, then setting a reasonable cache size can help
* reduce memory usage to avoid storing too many non frequent used producers.
*
* @param cacheSize the cache size, use <tt>0</tt> for default cache size, or <tt>-1</tt> to turn cache off.
* @return the builder
*/
public ToDynamicDefinition cacheSize(int cacheSize) {
return cacheSize(Integer.toString(cacheSize));
}
/**
* Sets the maximum size used by the {@link org.apache.camel.spi.ProducerCache} which is used to cache and reuse
* producers when using this recipient list, when uris are reused.
*
* Beware that when using dynamic endpoints then it affects how well the cache can be utilized. If each dynamic
* endpoint is unique then its best to turn of caching by setting this to -1, which allows Camel to not cache both
* the producers and endpoints; they are regarded as prototype scoped and will be stopped and discarded after use.
* This reduces memory usage as otherwise producers/endpoints are stored in memory in the caches.
*
* However if there are a high degree of dynamic endpoints that have been used before, then it can benefit to use
* the cache to reuse both producers and endpoints and therefore the cache size can be set accordingly or rely on
* the default size (1000).
*
* If there is a mix of unique and used before dynamic endpoints, then setting a reasonable cache size can help
* reduce memory usage to avoid storing too many non frequent used producers.
*
* @param cacheSize the cache size, use <tt>0</tt> for default cache size, or <tt>-1</tt> to turn cache off.
* @return the builder
*/
public ToDynamicDefinition cacheSize(String cacheSize) {
setCacheSize(cacheSize);
return this;
}
/**
* Ignore the invalidate endpoint exception when try to create a producer with that endpoint
*
* @return the builder
*/
public ToDynamicDefinition ignoreInvalidEndpoint(boolean ignoreInvalidEndpoint) {
return ignoreInvalidEndpoint(Boolean.toString(ignoreInvalidEndpoint));
}
/**
* Ignore the invalidate endpoint exception when try to create a producer with that endpoint
*
* @return the builder
*/
public ToDynamicDefinition ignoreInvalidEndpoint(String ignoreInvalidEndpoint) {
setIgnoreInvalidEndpoint(ignoreInvalidEndpoint);
return this;
}
/**
* Whether to allow components to optimise toD if they are {@link org.apache.camel.spi.SendDynamicAware}.
*
* @return the builder
*/
public ToDynamicDefinition allowOptimisedComponents(boolean allowOptimisedComponents) {
return allowOptimisedComponents(Boolean.toString(allowOptimisedComponents));
}
/**
* Whether to allow components to optimise toD if they are {@link org.apache.camel.spi.SendDynamicAware}.
*
* @return the builder
*/
public ToDynamicDefinition allowOptimisedComponents(String allowOptimisedComponents) {
setAllowOptimisedComponents(allowOptimisedComponents);
return this;
}
/**
* Whether to auto startup components when toD is starting up.
*
* @return the builder
*/
public ToDynamicDefinition autoStartComponents(String autoStartComponents) {
setAutoStartComponents(autoStartComponents);
return this;
}
// Properties
// -------------------------------------------------------------------------
public String getUri() {
return uri;
}
/**
* The uri of the endpoint to send to. The uri can be dynamic computed using the
* {@link org.apache.camel.language.simple.SimpleLanguage} expression.
*/
public void setUri(String uri) {
this.uri = uri;
}
public EndpointProducerBuilder getEndpointProducerBuilder() {
return endpointProducerBuilder;
}
public void setEndpointProducerBuilder(EndpointProducerBuilder endpointProducerBuilder) {
this.endpointProducerBuilder = endpointProducerBuilder;
}
public String getPattern() {
return pattern;
}
public void setPattern(String pattern) {
this.pattern = pattern;
}
public String getCacheSize() {
return cacheSize;
}
public void setCacheSize(String cacheSize) {
this.cacheSize = cacheSize;
}
public String getIgnoreInvalidEndpoint() {
return ignoreInvalidEndpoint;
}
public void setIgnoreInvalidEndpoint(String ignoreInvalidEndpoint) {
this.ignoreInvalidEndpoint = ignoreInvalidEndpoint;
}
public String getAllowOptimisedComponents() {
return allowOptimisedComponents;
}
public void setAllowOptimisedComponents(String allowOptimisedComponents) {
this.allowOptimisedComponents = allowOptimisedComponents;
}
public String getAutoStartComponents() {
return autoStartComponents;
}
public void setAutoStartComponents(String autoStartComponents) {
this.autoStartComponents = autoStartComponents;
}
}
| {
"content_hash": "62f947993b15d29e438b345fbc89fd47",
"timestamp": "",
"source": "github",
"line_count": 260,
"max_line_length": 118,
"avg_line_length": 35.28846153846154,
"alnum_prop": 0.6874114441416894,
"repo_name": "pax95/camel",
"id": "15625cf03f79c31d320a59f038c7d5aa39d5a03f",
"size": "9977",
"binary": false,
"copies": "1",
"ref": "refs/heads/CAMEL-17322",
"path": "core/camel-core-model/src/main/java/org/apache/camel/model/ToDynamicDefinition.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Apex",
"bytes": "6519"
},
{
"name": "Batchfile",
"bytes": "1518"
},
{
"name": "CSS",
"bytes": "30373"
},
{
"name": "Elm",
"bytes": "10852"
},
{
"name": "FreeMarker",
"bytes": "11410"
},
{
"name": "Groovy",
"bytes": "54390"
},
{
"name": "HTML",
"bytes": "190919"
},
{
"name": "Java",
"bytes": "68575773"
},
{
"name": "JavaScript",
"bytes": "90399"
},
{
"name": "Makefile",
"bytes": "513"
},
{
"name": "PLSQL",
"bytes": "1419"
},
{
"name": "Python",
"bytes": "36"
},
{
"name": "Ruby",
"bytes": "4802"
},
{
"name": "Scala",
"bytes": "323702"
},
{
"name": "Shell",
"bytes": "17107"
},
{
"name": "Tcl",
"bytes": "4974"
},
{
"name": "Thrift",
"bytes": "6979"
},
{
"name": "XQuery",
"bytes": "546"
},
{
"name": "XSLT",
"bytes": "284638"
}
],
"symlink_target": ""
} |
#ifndef _RB_TREE_H_
#define _RB_TREE_H_
#include "dict.h"
BEGIN_DECL
typedef struct rb_tree rb_tree;
rb_tree* rb_tree_new(dict_compare_func cmp_func,
dict_delete_func del_func);
dict* rb_dict_new(dict_compare_func cmp_func,
dict_delete_func del_func);
size_t rb_tree_free(rb_tree* tree);
rb_tree* rb_tree_clone(rb_tree* tree,
dict_key_datum_clone_func clone_func);
void** rb_tree_insert(rb_tree* tree, void* key, bool* inserted);
void* rb_tree_search(rb_tree* tree, const void* key);
void* rb_tree_search_le(rb_tree* tree, const void* key);
void* rb_tree_search_lt(rb_tree* tree, const void* key);
void* rb_tree_search_ge(rb_tree* tree, const void* key);
void* rb_tree_search_gt(rb_tree* tree, const void* key);
bool rb_tree_remove(rb_tree* tree, const void* key);
size_t rb_tree_clear(rb_tree* tree);
size_t rb_tree_traverse(rb_tree* tree, dict_visit_func visit);
size_t rb_tree_count(const rb_tree* tree);
size_t rb_tree_height(const rb_tree* tree);
size_t rb_tree_mheight(const rb_tree* tree);
size_t rb_tree_pathlen(const rb_tree* tree);
const void* rb_tree_min(const rb_tree* tree);
const void* rb_tree_max(const rb_tree* tree);
bool rb_tree_verify(const rb_tree* tree);
typedef struct rb_itor rb_itor;
rb_itor* rb_itor_new(rb_tree* tree);
dict_itor* rb_dict_itor_new(rb_tree* tree);
void rb_itor_free(rb_itor* tree);
bool rb_itor_valid(const rb_itor* itor);
void rb_itor_invalidate(rb_itor* itor);
bool rb_itor_next(rb_itor* itor);
bool rb_itor_prev(rb_itor* itor);
bool rb_itor_nextn(rb_itor* itor, size_t count);
bool rb_itor_prevn(rb_itor* itor, size_t count);
bool rb_itor_first(rb_itor* itor);
bool rb_itor_last(rb_itor* itor);
bool rb_itor_search(rb_itor* itor, const void* key);
bool rb_itor_search_le(rb_itor* itor, const void* key);
bool rb_itor_search_lt(rb_itor* itor, const void* key);
bool rb_itor_search_ge(rb_itor* itor, const void* key);
bool rb_itor_search_gt(rb_itor* itor, const void* key);
const void* rb_itor_key(const rb_itor* itor);
void** rb_itor_data(rb_itor* itor);
bool rb_itor_remove(rb_itor* itor);
END_DECL
#endif /* !_RB_TREE_H_ */
| {
"content_hash": "6d89ab771492618f5232403f03407ba0",
"timestamp": "",
"source": "github",
"line_count": 62,
"max_line_length": 65,
"avg_line_length": 34.45161290322581,
"alnum_prop": 0.6928838951310862,
"repo_name": "scalingdata/go-grok",
"id": "191c9ca3af56f988f17f5b5e7dd78abacc9f23dc",
"size": "3550",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "cgrok/rb_tree.h",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C",
"bytes": "1092851"
},
{
"name": "C++",
"bytes": "48976"
},
{
"name": "Go",
"bytes": "23956"
}
],
"symlink_target": ""
} |
@implementation ShareTableViewCell
- (void)awakeFromNib {
_iconImageView.layer.cornerRadius = _iconImageView.width * 0.5;
_iconImageView.clipsToBounds = YES;
}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
[super setSelected:selected animated:animated];
// Configure the view for the selected state
}
- (void)setModel:(ShareGoodsModel *)model
{
[self.iconImageView setImageWithURL:[NSURL URLWithString:model.headImgUrl] placeholderImage:[UIImage imageNamed:@"head_gray"]];
self.nameLabel.text = model.nickName;
self.titleLable.text = [NSString stringWithFormat:@"[第%@期] %@", model.term, model.title];
self.commentLabel.text = model.content;
NSArray * imageViews = @[self.firstImageView, self.secondImageView, self.thirdImageView];
NSArray * arr = [model.picUrls componentsSeparatedByString:@","];
[self hiddenViewWithCount:arr.count];
NSInteger count = MIN(arr.count, imageViews.count);
NSLog(@"count = %@", @(count));
for (int i = 0; i < count; i++) {
UIImageView * imageView = imageViews[i];
imageView.hidden = NO;
[imageView setImageWithURL:[NSURL URLWithString:arr[i]]];
}
}
- (void)hiddenViewWithCount:(NSInteger)count
{
switch (count) {
case 1:
self.secondImageView.hidden = self.thirdImageView.hidden = YES;
break;
case 2:
self.thirdImageView.hidden = YES;
break;
case 3:
self.firstImageView.hidden = self.secondImageView.hidden = self.thirdImageView.hidden = NO;
break;
}
}
- (void)prepareForReuse
{
[super prepareForReuse];
for (UIView * view in self.contentView.subviews) {
if ([view isKindOfClass:[UIImageView class]]) {
UIImageView * img = (UIImageView *)view;
img.image = nil;
}
}
}
@end
| {
"content_hash": "8d780491fb3afd97b4b8ecec032c9964",
"timestamp": "",
"source": "github",
"line_count": 58,
"max_line_length": 131,
"avg_line_length": 32.13793103448276,
"alnum_prop": 0.651824034334764,
"repo_name": "zhangdaohong1992/ZDHLearn",
"id": "fc3d6570812c170053ef12589c733399485641bb",
"size": "2099",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "Treasure/HomeTreasure/View/GoodsDetailCell/ShareTableViewCell.m",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C",
"bytes": "1147263"
},
{
"name": "C++",
"bytes": "317789"
},
{
"name": "HTML",
"bytes": "4555"
},
{
"name": "Objective-C",
"bytes": "959501"
},
{
"name": "Ruby",
"bytes": "250"
}
],
"symlink_target": ""
} |
const { FriendlyError } = require('discord.js-commando');
const { oneLine } = require('common-tags');
const path = require('path');
const winston = require('winston');
const SequelizeProvider = require('./providers/Sequelize');
const { OWNERS, COMMAND_PREFIX, TOKEN } = process.env;
const CommandoClient = require('./structures/CommandoClient');
const client = new CommandoClient({
owner: OWNERS.split(','),
commandPrefix: COMMAND_PREFIX,
unknownCommandResponse: false,
disableEveryone: true
});
const Currency = require('./structures/currency/Currency');
const Experience = require('./structures/currency/Experience');
const userName = require('./models/UserName');
let earnedRecently = [];
let gainedXPRecently = [];
client.setProvider(new SequelizeProvider(client.database));
client.dispatcher.addInhibitor(msg => {
const blacklist = client.provider.get('global', 'userBlacklist', []);
if (!blacklist.includes(msg.author.id)) return false;
return `Has been blacklisted.`;
});
client.on('error', winston.error)
.on('warn', winston.warn)
.once('ready', () => Currency.leaderboard())
.on('ready', () => {
winston.info(oneLine`
[DISCORD]: Client ready...
Logged in as ${client.user.tag} (${client.user.id})
`);
})
.on('disconnect', () => winston.warn('[DISCORD]: Disconnected!'))
.on('reconnect', () => winston.warn('[DISCORD]: Reconnecting...'))
.on('commandRun', (cmd, promise, msg, args) =>
winston.info(oneLine`
[DISCORD]: ${msg.author.tag} (${msg.author.id})
> ${msg.guild ? `${msg.guild.name} (${msg.guild.id})` : 'DM'}
>> ${cmd.groupID}:${cmd.memberName}
${Object.values(args).length ? `>>> ${Object.values(args)}` : ''}
`)
)
.on('unknownCommand', msg => {
if (msg.channel.type === 'dm') return;
if (msg.author.bot) return;
if (msg.content.split(msg.guild.commandPrefix)[1] === 'undefined') return;
const args = { name: msg.content.split(msg.guild.commandPrefix)[1].toLowerCase() };
client.registry.resolveCommand('tags:tag').run(msg, args);
})
.on('message', async message => {
if (message.channel.type === 'dm') return;
if (message.author.bot) return;
const channelLocks = client.provider.get(message.guild.id, 'locks', []);
if (channelLocks.includes(message.channel.id)) return;
if (!earnedRecently.includes(message.author.id)) {
const hasImageAttachment = message.attachments.some(attachment =>
attachment.url.match(/\.(png|jpg|jpeg|gif|webp)$/)
);
const moneyEarned = hasImageAttachment
? Math.ceil(Math.random() * 7) + 5
: Math.ceil(Math.random() * 7) + 1;
Currency._changeBalance(message.author.id, moneyEarned);
earnedRecently.push(message.author.id);
setTimeout(() => {
const index = earnedRecently.indexOf(message.author.id);
earnedRecently.splice(index, 1);
}, 8000);
}
if (!gainedXPRecently.includes(message.author.id)) {
const xpEarned = Math.ceil(Math.random() * 9) + 3;
const oldLevel = await Experience.getLevel(message.author.id);
Experience.addExperience(message.author.id, xpEarned).then(async () => {
const newLevel = await Experience.getLevel(message.author.id);
if (newLevel > oldLevel) {
Currency._changeBalance(message.author.id, 100 * newLevel);
}
}).catch(err => null); // eslint-disable-line no-unused-vars, handle-callback-err
gainedXPRecently.push(message.author.id);
setTimeout(() => {
const index = gainedXPRecently.indexOf(message.author.id);
gainedXPRecently.splice(index, 1);
}, 60 * 1000);
}
})
.on('commandError', (cmd, err) => {
if (err instanceof FriendlyError) return;
winston.error(`[DISCORD]: Error in command ${cmd.groupID}:${cmd.memberName}`, err);
})
.on('commandBlocked', (msg, reason) => {
winston.info(oneLine`
[DISCORD]: Command ${msg.command ? `${msg.command.groupID}:${msg.command.memberName}` : ''}
blocked; User ${msg.author.tag} (${msg.author.id}): ${reason}
`);
})
.on('commandPrefixChange', (guild, prefix) => {
winston.info(oneLine`
[DISCORD]: Prefix changed to ${prefix || 'the default'}
${guild ? `in guild ${guild.name} (${guild.id})` : 'globally'}.
`);
})
.on('commandStatusChange', (guild, command, enabled) => {
winston.info(oneLine`
[DISCORD]: Command ${command.groupID}:${command.memberName}
${enabled ? 'enabled' : 'disabled'}
${guild ? `in guild ${guild.name} (${guild.id})` : 'globally'}.
`);
})
.on('groupStatusChange', (guild, group, enabled) => {
winston.info(oneLine`
[DISCORD]: Group ${group.id}
${enabled ? 'enabled' : 'disabled'}
${guild ? `in guild ${guild.name} (${guild.id})` : 'globally'}.
`);
})
.on('userUpdate', (oldUser, newUser) => {
if (oldUser.username !== newUser.username) {
userName.create({ userID: newUser.id, username: oldUser.username }).catch(err => null); // eslint-disable-line no-unused-vars, handle-callback-err, max-len
}
});
client.registry
.registerGroups([
['info', 'Info'],
['economy', 'Economy'],
['social', 'Social'],
['games', 'Games'],
['item', 'Item'],
['weather', 'Weather'],
['music', 'Music'],
['tags', 'Tags'],
['docs', 'Documentation']
])
.registerDefaults()
.registerTypesIn(path.join(__dirname, 'types'))
.registerCommandsIn(path.join(__dirname, 'commands'));
client.login(TOKEN);
| {
"content_hash": "034270843a15b65cca766dd5fe5d9f5c",
"timestamp": "",
"source": "github",
"line_count": 151,
"max_line_length": 158,
"avg_line_length": 34.87417218543046,
"alnum_prop": 0.657045195594379,
"repo_name": "WeebDev/Commando",
"id": "9dba59f8f9f0a63ea0544dcfddb129b5c575b95b",
"size": "5266",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "Commando.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "JavaScript",
"bytes": "178889"
},
{
"name": "Shell",
"bytes": "1124"
}
],
"symlink_target": ""
} |
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "archives.settings")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
| {
"content_hash": "bc49b3f6a19c0483f2c6187d54355db5",
"timestamp": "",
"source": "github",
"line_count": 9,
"max_line_length": 72,
"avg_line_length": 25.444444444444443,
"alnum_prop": 0.7117903930131004,
"repo_name": "mattwaite/CanvasStoryArchive",
"id": "b581f3857ab1717ee2f0eea2c350d45dc9e6f4bf",
"size": "251",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "manage.py",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Python",
"bytes": "28295"
}
],
"symlink_target": ""
} |
set -e
declare parentDir=$(cd $(dirname $(cd $(dirname $0);pwd));pwd)
declare currentDir=$(cd $(dirname $0);pwd)
declare projectDir=$(git rev-parse --show-toplevel);
declare SCRIPT_DIR="${projectDir}/_tools"
SRC_FILE=${parentDir}/$1
# CHANGE Working directory
cd ${SCRIPT_DIR}
# config for fopub
CUSTOM_CONFIG_PATH="${SCRIPT_DIR}/fopub-config/custom-config.xml"
# WTF http://d.hatena.ne.jp/hkobayash/20111106/1320560290
ESCAPE_CONFIG_PATH=`echo $CUSTOM_CONFIG_PATH | sed "s/\//\\\\\\\\\//g"`
# hack rewrite fopub/fopub
sed -i.bak "s/\$DOCBOOK_XSL_DIR\/fop-config.xml/$ESCAPE_CONFIG_PATH/" "${SCRIPT_DIR}/fopub/fopub"
${SCRIPT_DIR}/fopub/fopub "${SRC_FILE}" \
-param body.font.family GenShinGothic-P-Regular \
-param dingbat.font.family GenShinGothic-P-Regular \
-param monospace.font.family GenShinGothic-Monospace-Regular \
-param sans.font.family GenShinGothic-P-Regular \
-param title.font.family GenShinGothic-P-Regular \
-param alignment left
# back .bak to fopub
mv -f ${SCRIPT_DIR}/fopub/fopub.bak ${SCRIPT_DIR}/fopub/fopub
| {
"content_hash": "ae0b98ff24af6295e766f57031156da0",
"timestamp": "",
"source": "github",
"line_count": 28,
"max_line_length": 97,
"avg_line_length": 37,
"alnum_prop": 0.7287644787644788,
"repo_name": "azu/promises-book",
"id": "7ff740b344502d16adee8d707edab2cdc59cbf73",
"size": "1049",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "_tools/build_pdf.sh",
"mode": "33261",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "39527"
},
{
"name": "HTML",
"bytes": "724324"
},
{
"name": "JavaScript",
"bytes": "85988"
},
{
"name": "Makefile",
"bytes": "1053"
},
{
"name": "Ruby",
"bytes": "62"
},
{
"name": "Shell",
"bytes": "3081"
}
],
"symlink_target": ""
} |
#ifndef OCLCRYPTO_TASK_H_
#define OCLCRYPTO_TASK_H_
#include "oclcrypto/ForwardDecls.h"
#include <memory>
namespace oclcrypto
{
enum TaskAlgorithm
{
TA_PASSTHROUGH = 1
};
enum TaskState
{
TS_SPECIFIED = 1,
TS_RUNNING = 2,
TS_ERROR = 3,
TS_FINISHED = 4
};
/**
* @brief
*/
class OCLCRYPTO_EXPORT Task
{
public:
inline Task(Algorithm algorithm, ConstBufferPtr input, ConstBufferPtr secret, BufferPtr output):
algorithm(algorithm),
state(TS_SPECIFIED),
input(input),
secret(secret),
output(output)
{}
const TaskAlgorithm algorithm;
std::atomic<TaskState> state;
const ConstBufferPtr input;
const ConstBufferPtr secret;
/// @note This can only be valid if task.state equals TS_FINISHED
const BufferPtr output;
};
}
#endif
| {
"content_hash": "5d73ec81f5be659ccc83ee2cccb5f713",
"timestamp": "",
"source": "github",
"line_count": 52,
"max_line_length": 104,
"avg_line_length": 16.923076923076923,
"alnum_prop": 0.6170454545454546,
"repo_name": "wdv4758h/oclcrypto",
"id": "33c606b3da593adaf084df59b5e34fc4aa6280ef",
"size": "2040",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "include/oclcrypto/Task.h",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C",
"bytes": "27085"
},
{
"name": "C++",
"bytes": "227059"
},
{
"name": "CMake",
"bytes": "15962"
}
],
"symlink_target": ""
} |
<!DOCTYPE html>
<html>
<head>
<title>util documentation</title>
<link rel="stylesheet" type="text/css" href="../../index.css" />
<link rel="stylesheet" type="text/css" href="../../highlight.css" />
<script type="text/javascript" src="../../index.js"></script>
</head>
<body class="module" id="component_772">
<div id="outer">
<div id="header">
<a class="ctype" href="../../index.html">module</a>
<span></span>
<span class="breadcrumbs">
<span class="delimiter">:</span><a href="index.html" class="breadcrumb module">util</a>
</span>
</div>
<div id="TOC">
<div class="section">
<h4 class="header"><a href="#methods">Methods</a></h4>
<a href="#component_767">debug</a><br />
<a href="#component_757">debuglog</a><br />
<a href="#component_766">deprecate</a><br />
<a href="#component_768">error</a><br />
<a href="#component_758">format</a><br />
<a href="#component_765">inherits</a><br />
<a href="#component_760">inspect</a><br />
<a href="#component_761">isArray</a><br />
<a href="#component_763">isDate</a><br />
<a href="#component_764">isError</a><br />
<a href="#component_762">isRegExp</a><br />
<a href="#component_759">log</a><br />
<a href="#component_770">print</a><br />
<a href="#component_771">pump</a><br />
<a href="#component_769">puts</a><br />
</div>
</div>
<div id="content">
<!-- basic document info -->
<div id="details">
<div class="clear"></div>
<!-- extra document info -->
<h1>Additional Documentation Pages</h1>
<div id="spares" class="section spares">
<a class="spare" id="component_756" href="https://nodejs.org/api/util.html#util_custom_inspect_function_on_objects">Custom inspect() function on Objects</a>
<br />
<a class="spare" id="component_755" href="https://nodejs.org/api/util.html#util_customizing_util_inspect_colors">Customizing util.inspect colors</a>
<br />
<a class="spare" id="component_754" href="https://nodejs.org/api/util.html#util_util">Library Documentation</a>
<br />
</div>
</div>
<div class="children">
<!-- methods -->
<h1 id="methods" class="header">Methods</h1>
<div class="section members">
<div id="component_767" class="child function">
<span class="signature">
<span></span>
<a href="https://nodejs.org/api/util.html#util_util_debug_string" class="title">
debug
</a>
(
<span></span>
) {
</span>
<div class="info">
<span class="markdown"></span>
<div class="tail" /></div>
</div>
</div>
<div id="component_757" class="child function">
<span class="signature">
<span></span>
<a href="https://nodejs.org/api/util.html#util_util_debuglog_section" class="title">
debuglog
</a>
(
<span></span>
) {
</span>
<div class="info">
<span class="markdown"></span>
<div class="tail" /></div>
</div>
</div>
<div id="component_766" class="child function">
<span class="signature">
<span></span>
<a href="https://nodejs.org/api/util.html#util_util_deprecate_function_string" class="title">
deprecate
</a>
(
<span></span>
) {
</span>
<div class="info">
<span class="markdown"></span>
<div class="tail" /></div>
</div>
</div>
<div id="component_768" class="child function">
<span class="signature">
<span></span>
<a href="https://nodejs.org/api/util.html#util_util_error" class="title">
error
</a>
(
<span></span>
) {
</span>
<div class="info">
<span class="markdown"></span>
<div class="tail" /></div>
</div>
</div>
<div id="component_758" class="child function">
<span class="signature">
<span></span>
<a href="https://nodejs.org/api/util.html#util_util_format_format" class="title">
format
</a>
(
<span></span>
) {
</span>
<div class="info">
<span class="markdown"></span>
<div class="tail" /></div>
</div>
</div>
<div id="component_765" class="child function">
<span class="signature">
<span></span>
<a href="https://nodejs.org/api/util.html#util_util_inherits_constructor_superconstructor" class="title">
inherits
</a>
(
<span></span>
) {
</span>
<div class="info">
<span class="markdown"></span>
<div class="tail" /></div>
</div>
</div>
<div id="component_760" class="child function">
<span class="signature">
<span></span>
<a href="https://nodejs.org/api/util.html#util_util_inspect_object_options" class="title">
inspect
</a>
(
<span></span>
) {
</span>
<div class="info">
<span class="markdown"></span>
<div class="tail" /></div>
</div>
</div>
<div id="component_761" class="child function">
<span class="signature">
<span></span>
<a href="https://nodejs.org/api/util.html#util_util_isarray_object" class="title">
isArray
</a>
(
<span></span>
) {
</span>
<div class="info">
<span class="markdown"></span>
<div class="tail" /></div>
</div>
</div>
<div id="component_763" class="child function">
<span class="signature">
<span></span>
<a href="https://nodejs.org/api/util.html#util_util_isdate_object" class="title">
isDate
</a>
(
<span></span>
) {
</span>
<div class="info">
<span class="markdown"></span>
<div class="tail" /></div>
</div>
</div>
<div id="component_764" class="child function">
<span class="signature">
<span></span>
<a href="https://nodejs.org/api/util.html#util_util_iserror_object" class="title">
isError
</a>
(
<span></span>
) {
</span>
<div class="info">
<span class="markdown"></span>
<div class="tail" /></div>
</div>
</div>
<div id="component_762" class="child function">
<span class="signature">
<span></span>
<a href="https://nodejs.org/api/util.html#util_util_isregexp_object" class="title">
isRegExp
</a>
(
<span></span>
) {
</span>
<div class="info">
<span class="markdown"></span>
<div class="tail" /></div>
</div>
</div>
<div id="component_759" class="child function">
<span class="signature">
<span></span>
<a href="https://nodejs.org/api/util.html#util_util_log_string" class="title">
log
</a>
(
<span></span>
) {
</span>
<div class="info">
<span class="markdown"></span>
<div class="tail" /></div>
</div>
</div>
<div id="component_770" class="child function">
<span class="signature">
<span></span>
<a href="https://nodejs.org/api/util.html#util_util_print" class="title">
print
</a>
(
<span></span>
) {
</span>
<div class="info">
<span class="markdown"></span>
<div class="tail" /></div>
</div>
</div>
<div id="component_771" class="child function">
<span class="signature">
<span></span>
<a href="https://nodejs.org/api/util.html#util_util_pump_readablestream_writablestream_callback" class="title">
pump
</a>
(
<span></span>
) {
</span>
<div class="info">
<span class="markdown"></span>
<div class="tail" /></div>
</div>
</div>
<div id="component_769" class="child function">
<span class="signature">
<span></span>
<a href="https://nodejs.org/api/util.html#util_util_puts" class="title">
puts
</a>
(
<span></span>
) {
</span>
<div class="info">
<span class="markdown"></span>
<div class="tail" /></div>
</div>
</div>
</div>
</div>
</div>
</div>
<div id="footer">
This document was generated with
<a href="https://github.com/shenanigans/node-doczar">doczar</a>
at <span class="time">3:55pm</span> on <span class="date">8/14/2015</span>
</div>
</body>
</html>
| {
"content_hash": "aebc26b756a8b055308bea477330a49a",
"timestamp": "",
"source": "github",
"line_count": 297,
"max_line_length": 184,
"avg_line_length": 30.646464646464647,
"alnum_prop": 0.4911008569545155,
"repo_name": "shenanigans/node-sublayer",
"id": "36098b8968d8c45c9ce723682aed247f4aaf1f98",
"size": "9102",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "static/docs/generated/module/util/index.html",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "19097"
},
{
"name": "HTML",
"bytes": "7637111"
},
{
"name": "JavaScript",
"bytes": "2783424"
}
],
"symlink_target": ""
} |
package com.example.android.datafrominternet;
import android.os.AsyncTask;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.EditText;
import android.widget.ProgressBar;
import android.widget.TextView;
import com.example.android.datafrominternet.utilities.NetworkUtils;
import java.io.IOException;
import java.net.URL;
public class MainActivity extends AppCompatActivity {
private EditText mSearchBoxEditText;
private TextView mUrlDisplayTextView;
private TextView mSearchResultsTextView;
// TODO (12) Create a variable to store a reference to the error message TextView
private TextView mErrorMessageTextView;
// TODO (24) Create a ProgressBar variable to store a reference to the ProgressBar
private ProgressBar mLoadingIndicatorProgressBar;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
mSearchBoxEditText = (EditText) findViewById(R.id.et_search_box);
mUrlDisplayTextView = (TextView) findViewById(R.id.tv_url_display);
mSearchResultsTextView = (TextView) findViewById(R.id.tv_github_search_results_json);
// TODO (13) Get a reference to the error TextView using findViewById
mErrorMessageTextView = (TextView) findViewById(R.id.tv_error_message_display);
// TODO (25) Get a reference to the ProgressBar using findViewById
mLoadingIndicatorProgressBar = (ProgressBar) findViewById(R.id.pb_loading_indicator);
}
/**
* This method retrieves the search text from the EditText, constructs the
* URL (using {@link NetworkUtils}) for the github repository you'd like to find, displays
* that URL in a TextView, and finally fires off an AsyncTask to perform the GET request using
* our {@link GithubQueryTask}
*/
private void makeGithubSearchQuery() {
String githubQuery = mSearchBoxEditText.getText().toString();
URL githubSearchUrl = NetworkUtils.buildUrl(githubQuery);
mUrlDisplayTextView.setText(githubSearchUrl.toString());
new GithubQueryTask().execute(githubSearchUrl);
}
// TODO (14) Create a method called showJsonDataView to show the data and hide the error
private void showJsonDataView(){
mSearchResultsTextView.setVisibility(View.VISIBLE);
mErrorMessageTextView.setVisibility(View.INVISIBLE);
}
// TODO (15) Create a method called showErrorMessage to show the error and hide the data
private void showErrorMessage(){
mSearchResultsTextView.setVisibility(View.INVISIBLE);
mErrorMessageTextView.setVisibility(View.VISIBLE);
}
public class GithubQueryTask extends AsyncTask<URL, Void, String> {
// TODO (26) Override onPreExecute to set the loading indicator to visible
@Override
protected void onPreExecute() {
mLoadingIndicatorProgressBar.setVisibility(View.VISIBLE);
}
@Override
protected String doInBackground(URL... params) {
URL searchUrl = params[0];
String githubSearchResults = null;
try {
githubSearchResults = NetworkUtils.getResponseFromHttpUrl(searchUrl);
} catch (IOException e) {
e.printStackTrace();
}
return githubSearchResults;
}
@Override
protected void onPostExecute(String githubSearchResults) {
// TODO (27) As soon as the loading is complete, hide the loading indicator
mLoadingIndicatorProgressBar.setVisibility(View.INVISIBLE);
if (githubSearchResults != null && !githubSearchResults.equals("")) {
// TODO (17) Call showJsonDataView if we have valid, non-null results
showJsonDataView();
mSearchResultsTextView.setText(githubSearchResults);
} else {
showErrorMessage();
}
// TODO (16) Call showErrorMessage if the result is null in onPostExecute
}
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.main, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
int itemThatWasClickedId = item.getItemId();
if (itemThatWasClickedId == R.id.action_search) {
makeGithubSearchQuery();
return true;
}
return super.onOptionsItemSelected(item);
}
}
| {
"content_hash": "b5df66ba3734de2dbc1346afc679272a",
"timestamp": "",
"source": "github",
"line_count": 125,
"max_line_length": 98,
"avg_line_length": 37.32,
"alnum_prop": 0.6889603429796356,
"repo_name": "ribbon7/ud851-Exercises",
"id": "0ddaf20c868e253a3bb1c2909a40db35efdbad31",
"size": "5284",
"binary": false,
"copies": "1",
"ref": "refs/heads/student",
"path": "Lesson02-GitHub-Repo-Search/T02.06-Exercise-AddPolish/app/src/main/java/com/example/android/datafrominternet/MainActivity.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Java",
"bytes": "2448831"
},
{
"name": "Python",
"bytes": "4312"
}
],
"symlink_target": ""
} |
// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.siyeh.ig.fixes.controlflow;
import com.siyeh.InspectionGadgetsBundle;
import com.siyeh.ig.BaseInspection;
import com.siyeh.ig.IGQuickFixesTestCase;
import com.siyeh.ig.controlflow.ConfusingElseInspection;
/**
* @author Fabrice TIERCELIN
*/
public class ConfusingElseFixTest extends IGQuickFixesTestCase {
@Override
protected BaseInspection getInspection() {
return new ConfusingElseInspection();
}
public void testRemoveElse() {
doMemberTest(InspectionGadgetsBundle.message("redundant.else.unwrap.quickfix"),
"""
public void printName(String name) {
if (name == null) {
throw new IllegalArgumentException();
} else/**/ {
System.out.println(name);
}
}
""",
"""
public void printName(String name) {
if (name == null) {
throw new IllegalArgumentException();
}
System.out.println(name);
}
"""
);
}
public void testReturnStatement() {
doMemberTest(InspectionGadgetsBundle.message("redundant.else.unwrap.quickfix"),
"""
public int printName(String name) {
if (name == null) {
return -1;
} else/**/ {
System.out.println(name);
}
return 0;
}
""",
"""
public int printName(String name) {
if (name == null) {
return -1;
}
System.out.println(name);
return 0;
}
"""
);
}
public void testBreakStatement() {
doMemberTest(InspectionGadgetsBundle.message("redundant.else.unwrap.quickfix"),
"""
public void printName(String[] texts) {
for (String text : texts) {
if ("illegal".equals(text)) {
break;
} else/**/ {
System.out.println(text);
}
}
}
""",
"""
public void printName(String[] texts) {
for (String text : texts) {
if ("illegal".equals(text)) {
break;
}
System.out.println(text);
}
}
"""
);
}
public void testContinueStatement() {
doMemberTest(InspectionGadgetsBundle.message("redundant.else.unwrap.quickfix"),
"""
public void printName(String[] texts) {
for (String text : texts) {
if ("illegal".equals(text)) {
continue;
} else/**/ {
System.out.println(text);
}
}
}
""",
"""
public void printName(String[] texts) {
for (String text : texts) {
if ("illegal".equals(text)) {
continue;
}
System.out.println(text);
}
}
"""
);
}
public void testDoNotFixElseWithoutJump() {
assertQuickfixNotAvailable(InspectionGadgetsBundle.message("redundant.else.unwrap.quickfix"),
"""
class X {
public void printName(String name) {
if (name == null) {
System.out.println("illegal");
} else/**/ {
System.out.println(name);
}
}
}
""");
}
}
| {
"content_hash": "3e413bd9d0aedc4c814ba4da9ef087bf",
"timestamp": "",
"source": "github",
"line_count": 130,
"max_line_length": 120,
"avg_line_length": 35.89230769230769,
"alnum_prop": 0.37526789541363054,
"repo_name": "JetBrains/intellij-community",
"id": "39a1b8042fb0937adb3110b53cb291acb01e32fa",
"size": "4666",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "plugins/InspectionGadgets/testsrc/com/siyeh/ig/fixes/controlflow/ConfusingElseFixTest.java",
"mode": "33188",
"license": "apache-2.0",
"language": [],
"symlink_target": ""
} |
<?php
/**
* DO NOT EDIT THIS FILE!
*
* This file was automatically generated from external sources.
*
* Any manual change here will be lost the next time the SDK
* is updated. You've been warned!
*/
namespace DTS\eBaySDK\Trading\Types;
/**
*
* @property string $VariationSpecificValue
* @property string[] $PictureURL
* @property string[] $ExternalPictureURL
* @property \DTS\eBaySDK\Trading\Types\ExtendedPictureDetailsType $ExtendedPictureDetails
*/
class VariationSpecificPictureSetType extends \DTS\eBaySDK\Types\BaseType
{
/**
* @var array Properties belonging to objects of this class.
*/
private static $propertyTypes = [
'VariationSpecificValue' => [
'type' => 'string',
'repeatable' => false,
'attribute' => false,
'elementName' => 'VariationSpecificValue'
],
'PictureURL' => [
'type' => 'string',
'repeatable' => true,
'attribute' => false,
'elementName' => 'PictureURL'
],
'ExternalPictureURL' => [
'type' => 'string',
'repeatable' => true,
'attribute' => false,
'elementName' => 'ExternalPictureURL'
],
'ExtendedPictureDetails' => [
'type' => 'DTS\eBaySDK\Trading\Types\ExtendedPictureDetailsType',
'repeatable' => false,
'attribute' => false,
'elementName' => 'ExtendedPictureDetails'
]
];
/**
* @param array $values Optional properties and values to assign to the object.
*/
public function __construct(array $values = [])
{
list($parentValues, $childValues) = self::getParentValues(self::$propertyTypes, $values);
parent::__construct($parentValues);
if (!array_key_exists(__CLASS__, self::$properties)) {
self::$properties[__CLASS__] = array_merge(self::$properties[get_parent_class()], self::$propertyTypes);
}
if (!array_key_exists(__CLASS__, self::$xmlNamespaces)) {
self::$xmlNamespaces[__CLASS__] = 'xmlns="urn:ebay:apis:eBLBaseComponents"';
}
$this->setValues(__CLASS__, $childValues);
}
}
| {
"content_hash": "2aea9ee22d831aa39262dc471609b5dd",
"timestamp": "",
"source": "github",
"line_count": 71,
"max_line_length": 116,
"avg_line_length": 31.197183098591548,
"alnum_prop": 0.581941309255079,
"repo_name": "davidtsadler/ebay-sdk-php",
"id": "5966638d39ca377107debb77a896aaf5464099b0",
"size": "2215",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/Trading/Types/VariationSpecificPictureSetType.php",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Makefile",
"bytes": "10944"
},
{
"name": "PHP",
"bytes": "9958599"
}
],
"symlink_target": ""
} |
import sys, os, operator, smtplib, re
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText
def send_email(addr, subject, msg_body):
email_subject = subject
from_addr="confer@csail.mit.edu"
to_addr = [addr]
msg = MIMEMultipart()
msg['From'] = 'Confer Team <confer@csail.mit.edu>'
msg['To'] = addr
msg['Subject'] = email_subject
msg.attach(MIMEText(msg_body))
smtp_conn = smtplib.SMTP_SSL('localhost', 25)
smtp_conn.sendmail(from_addr, to_addr, msg.as_string())
smtp_conn.close()
def send_survey_email():
f = open(sys.argv[1]).read()
names = re.split('\n', f)
subject = "Confer@CHI 2014 -- make interesting connections!"
for name in names:
tokens = re.split(',', name.strip())
tokens = map(lambda x: x.strip(), tokens)
print tokens
msg_body = """
Dear %s,
We're pleased that you're using Confer to mark the papers you want to see at CHI 2014. Did you know Confer can also introduce you to *people* you ought to meet while you're there? Confer has identified a number of individuals whose paper selections suggest that they share your research interests. If you enable Confer's meetups feature, these people will be able to find you and introduce themselves! Just go to http://confer.csail.mit.edu/chi2014/meetups and enable the meetups feature to start making some interesting connections at CHI 2014.
Best,
The Confer Team
confer@csail.mit.edu
""" %(tokens[1])
send_email(tokens[0], subject, msg_body)
def main():
send_survey_email()
if __name__ == '__main__':
main()
| {
"content_hash": "02029bfb341d53a9958a76f9e0f9da86",
"timestamp": "",
"source": "github",
"line_count": 65,
"max_line_length": 549,
"avg_line_length": 24.246153846153845,
"alnum_prop": 0.7011421319796954,
"repo_name": "anantb/confer",
"id": "9121703331e49141c969b6bb072358a32465af7c",
"size": "1594",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "scripts/chi2014/send_email.py",
"mode": "33261",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "67633"
},
{
"name": "HTML",
"bytes": "58970"
},
{
"name": "Java",
"bytes": "10536"
},
{
"name": "JavaScript",
"bytes": "172622"
},
{
"name": "PHP",
"bytes": "659"
},
{
"name": "Python",
"bytes": "263209"
},
{
"name": "Shell",
"bytes": "2339"
},
{
"name": "TeX",
"bytes": "188951"
}
],
"symlink_target": ""
} |
/*!
* Start Bootstrap - Modern Business HTML Template (http://startbootstrap.com)
* Code licensed under the Apache License v2.0.
* For details, see http://www.apache.org/licenses/LICENSE-2.0.
*/
/* Global Styles */
html,
body {
height: 100%;
}
body {
padding-top: 50px; /* Required padding for .navbar-fixed-top. Remove if using .navbar-static-top. Change if height of navigation changes. */
background-color: #e1e1e1;
}
img {
max-width: 100%;
}
/* teste */
.img-portfolio {
margin-bottom: 30px;
}
.img-hover {
box-shadow: 02px 02px 10px 0px;
}
.img-hover:hover {
opacity: 0.8;
}
.navbar-inverse {
background-color: #072855;
border-color: #072855;
}
.navbar-inverse .navbar-brand {
color: #E2B65F !important;
font-weight: bold;
}
.navbar-inverse .navbar-nav>li>a {
color: #E2B65F !important;
font-weight: bold;
font-size: 17px;
}
.navbar-inverse .navbar-nav>li>a:hover {
color: white !important;
}
.navbar-inverse .navbar-nav>.active>a, .navbar-inverse .navbar-nav>.active>a:focus, .navbar-inverse .navbar-nav>.active>a:hover {
background-color: #E2B65F !important;
color: white !important;
}
.navbar-inverse .navbar-nav>.open>a, .navbar-inverse .navbar-nav>.open>a:focus, .navbar-inverse .navbar-nav>.open>a:hover {
background-color: #E2B65F !important;
color: white !important;
}
tabs-nav {padding: 20px 0 0 0; list-style: none;}
.tabs-nav li {display: inline;}
.tabs-nav a {
display:inline-block;
border: 1px solid #ddd;
border-bottom: none;
padding: 15px;
cursor: pointer;
border-radius: 5px 5px 0 0;
font-size: 14px;
color: #fff;
background: #072855;
}
.tabs-nav .active {
background: #fff;
color: #072855;
border-bottom: 1px solid #fff;
margin-bottom: -1px;
}
.tab-content {
padding: 0px 20px 20px 45px;
}
p {
margin-bottom: 15px;
}
p.default {
text-align: justify;
text-indent: 40px;
}
.social{
text-align:center;
width:64px;
height:64px;
float:right;
background:rgb(255,255,255);
border:1px solid rgb(204,204,204);
box-shadow:0 2px 4px rgba(0,0,0,0.15), inset 0 0 50px rgba(0,0,0,0.1);
border-radius:5px;
margin:0 10px 10px 0;
padding:17px;
font-size: .7rem;
}
.social-link { color: inherit;}
.google-pluse:hover{background:#DD4B39;color:#FFF;}
.facebook:hover{background:#3b5998;color:#FFF;}
.twitter:hover{background:#00acee;color:#FFF;}
.pinterest:hover{background:#c8232c;color:#FFF;}
.linkedin:hover{background:#0e76a8;color:#FFF;}
.skype:hover{background:#00aff0;color:#FFF;}
.youtube:hover{background:#c4302b;color:#FFF;}
.tumblr:hover{background:#34526f;color:#FFF;}
#main {
height: 100%;
min-height: 100%;
}
/* Home Page Carousel */
header.carousel {
height: 99%;
}
header.carousel .item,
header.carousel .item.active,
header.carousel .carousel-inner {
height: 100%;
min-height: 380px;
}
header.carousel .fill {
width: 100%;
height: 100%;
min-height: 380px;
background-position: center;
background-size: cover;
}
/* 404 Page Styles */
.error-404 {
font-size: 100px;
}
/* Pricing Page Styles */
.price {
display: block;
font-size: 50px;
line-height: 50px;
}
.price sup {
top: -20px;
left: 2px;
font-size: 20px;
}
.period {
display: block;
font-style: italic;
}
/* Footer Styles */
footer {
margin: 50px 0;
}
/* Responsive Styles */
@media(max-width:991px) {
.customer-img,
.img-related {
margin-bottom: 30px;
}
}
.video-container {
position:relative;
padding-bottom:56.25%;
padding-top:30px;
height:0;
overflow:hidden;
}
.video-container iframe, .video-container object, .video-container embed {
position:absolute;
top:0;
left:0;
width:100%;
height:100%;
}
@media(max-width:768px) {
.img-portfolio {
margin-bottom: 15px;
}
header.carousel .carousel {
height: 70%;
}
header div.carousel-caption h2 {
font-size: 22px;
}
.video-incorporado {
min-width: 100%;
min-height: 100%;
max-height: 100%;
max-width: 100%;
}
.social-bar {
margin-top: -10px !important;
margin-bottom: 20px;
}
.social {
height: 32px;
width: 32px;
padding: 4px;
font-size: .4rem;
}
}
h1 { font-size: 28px; }
h4.detail_title {
font-weight: bold;color:#000;
text-align:center;
text-shadow: 02px 02px #eee;
font-size: 16px;
}
span.filter_result {
color: blue;
padding:03px 05px;
background-color: #eee;
font-size: 16px;
font-weight:bold;
}
h2.no_results {
color: red;
font-weight: bold;
}
select.default {
float: none;
}
select.money_filter_field {
float: none;
max-width:120px;
display:inline;
}
div.results_search {
margin: 0px auto;
width: 98%;
background-color: #f2f3ff;
margin-top: 20px;
margin-bottom: 20px;
border: 01px dotted #ccc;
padding: 15px 5px;
}
p.result_description {
text-align: justify;
text-indent: 30px;
margin-top: 20px;
margin-bottom: 20px;
}
p.imovel_detail {
font-size: 13px;
text-align: justify;
text-indent: 30px;
margin-top: 20px;
margin-bottom: 20px;
}
ul.imovel_detail {
font-size: 13px;
}
h5.imovel_detail {
color:blue;
font-weight:bold;
}
h5.imovel_detail_green {
color:green;
font-weight:bold;
}
div.description_resource {
margin:0px auto;
text-align:center;
margin-top:10px;
background-color: #fff;
}
p.info_destaque {
font-size: 12px;
font-weight: bold; color: red;
}
#main div.container {
background-color: white !important;
width: 80%;
}
.font-small {
font-size: 13px !important;
}
| {
"content_hash": "4e87a02f383a792eb834dd73504a71c8",
"timestamp": "",
"source": "github",
"line_count": 314,
"max_line_length": 144,
"avg_line_length": 18.38216560509554,
"alnum_prop": 0.6306306306306306,
"repo_name": "leandroseverino/application-florenca",
"id": "ac569a52880cda87c99fa771cbb2c952da3b1f75",
"size": "5772",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "css/modern-business.css",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "133073"
},
{
"name": "HTML",
"bytes": "660637"
},
{
"name": "JavaScript",
"bytes": "199576"
},
{
"name": "PHP",
"bytes": "24935"
},
{
"name": "Shell",
"bytes": "721"
}
],
"symlink_target": ""
} |
exports.API_REST = './api/rest';
exports.API_SOCKET_IO = './api/socket.io';
exports.API_GROONGA = './api/groonga';
exports.API_DROONGA = './api/droonga';
exports.exportTo = function(target) {
target.API_REST = exports.API_REST;
target.API_SOCKET_IO = exports.API_SOCKET_IO;
target.API_GROONGA = exports.API_GROONGA;
target.API_DROONGA = exports.API_DROONGA;
};
exports.normalize = function(apis) {
apis = apis || [];
if (!Array.isArray(apis))
apis = [apis];
apis = apis.map(function(api) {
if (typeof api == 'string')
return require(api);
else
return api;
});
return apis;
};
| {
"content_hash": "e6159da9c0ecd3c1ef16f71d2ba7a751",
"timestamp": "",
"source": "github",
"line_count": 24,
"max_line_length": 47,
"avg_line_length": 26.583333333333332,
"alnum_prop": 0.6285266457680251,
"repo_name": "KitaitiMakoto/express-droonga",
"id": "acf7e84f0648c85872b183b87770b573a4c0f693",
"size": "638",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "lib/adapter/api.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "347"
},
{
"name": "Emacs Lisp",
"bytes": "120"
},
{
"name": "HTML",
"bytes": "583"
},
{
"name": "JavaScript",
"bytes": "205577"
}
],
"symlink_target": ""
} |
import os
import unittest
import pyowm.commons.exceptions
from pyowm import owm
from pyowm.weatherapi25.one_call import OneCall
from pyowm.weatherapi25.weather import Weather
from pyowm.weatherapi25.national_weather_alert import NationalWeatherAlert
class IntegrationTestsWebAPI25(unittest.TestCase):
__owm = owm.OWM(os.getenv('OWM_API_KEY', None)).weather_manager()
def test_weather_at_place(self):
"""
Test feature: get currently observed weather at specific location
"""
o1 = self.__owm.weather_at_place('London,GB')
o2 = self.__owm.weather_at_place('Kiev')
self.assertTrue(o1 is not None)
self.assertTrue(o1.reception_time() is not None)
loc = o1.location
self.assertTrue(loc is not None)
self.assertTrue(all(v is not None for v in loc.__dict__.values()))
weat = o1.weather
self.assertTrue(weat is not None)
self.assertTrue(o2 is not None)
self.assertTrue(o2.reception_time() is not None)
loc = o2.location
self.assertTrue(loc is not None)
self.assertTrue(all(v is not None for v in loc.__dict__.values()))
weat = o2.weather
self.assertTrue(weat is not None)
def test_weather_at_coords(self):
"""
Test feature: get currently observed weather at specific coordinates
"""
o1 = self.__owm.weather_at_coords(41.896144, 12.484589) # Rome
o2 = self.__owm.weather_at_coords(-33.936524, 18.503723) # Cape Town
self.assertTrue(o1)
self.assertTrue(o1.reception_time())
loc = o1.location
self.assertTrue(loc)
self.assertTrue(all(v is not None for v in loc.__dict__.values()))
weat = o1.weather
self.assertTrue(weat)
self.assertTrue(o2)
self.assertTrue(o2.reception_time())
loc = o2.location
self.assertTrue(loc)
self.assertTrue(all(v is not None for v in loc.__dict__.values()))
weat = o2.weather
self.assertTrue(weat)
def test_weather_at_zipcode(self):
"""
Test feature: get currently observed weather at specific postcode
"""
o1 = self.__owm.weather_at_zip_code("94040", "US")
self.assertTrue(o1)
self.assertTrue(o1.reception_time())
loc = o1.location
self.assertTrue(loc)
self.assertTrue(all(v is not None for v in loc.__dict__.values()))
weat = o1.weather
self.assertTrue(weat)
def test_weather_at_id(self):
o1 = self.__owm.weather_at_id(5128581) # New York
o2 = self.__owm.weather_at_id(703448) # Kiev'
self.assertTrue(o1 is not None)
self.assertTrue(o1.reception_time() is not None)
loc = o1.location
self.assertTrue(loc is not None)
self.assertTrue(all(v is not None for v in loc.__dict__.values()))
weat = o1.weather
self.assertTrue(weat is not None)
self.assertTrue(o2 is not None)
self.assertTrue(o2.reception_time() is not None)
loc = o2.location
self.assertTrue(loc is not None)
self.assertTrue(all(v is not None for v in loc.__dict__.values()))
weat = o2.weather
self.assertTrue(weat is not None)
def test_weather_at_ids(self):
# New York, Kiev
observations = self.__owm.weather_at_ids([5128581, 703448])
o1 = observations[0]
o2 = observations[1]
self.assertTrue(o1 is not None)
self.assertTrue(o1.reception_time() is not None)
loc = o1.location
self.assertTrue(loc is not None)
self.assertTrue(all(v is not None for v in loc.__dict__.values()))
weat = o1.weather
self.assertTrue(weat is not None)
self.assertTrue(o2 is not None)
self.assertTrue(o2.reception_time() is not None)
loc = o2.location
self.assertTrue(loc is not None)
self.assertTrue(all(v is not None for v in loc.__dict__.values()))
weat = o2.weather
self.assertTrue(weat is not None)
def test_weather_at_places(self):
"""
Test feature: find currently observed weather for locations matching
the specified text search pattern
"""
# Test using searchtype=accurate
o1 = self.__owm.weather_at_places("London", "accurate")
o2 = self.__owm.weather_at_places("Paris", "accurate", 2)
self.assertTrue(isinstance(o1, list))
for item in o1:
self.assertTrue(item)
self.assertTrue(item.reception_time())
loc = item.location
self.assertTrue(loc is not None)
self.assertTrue(all(v is not None for v in loc.__dict__.values()))
weat = item.weather
self.assertTrue(weat is not None)
self.assertTrue(isinstance(o2, list))
self.assertFalse(len(o2) > 2)
for item in o2:
self.assertTrue(item)
self.assertTrue(item.reception_time())
loc = item.location
self.assertTrue(loc is not None)
self.assertTrue(all(v is not None for v in loc.__dict__.values()))
weat = item.weather
self.assertTrue(weat is not None)
# Test using searchtype=like
o3 = self.__owm.weather_at_places("London", "like")
o4 = self.__owm.weather_at_places("Paris", "like", 2)
self.assertTrue(isinstance(o3, list))
for item in o3:
self.assertTrue(item)
self.assertTrue(item.reception_time())
loc = item.location
self.assertTrue(loc is not None)
self.assertTrue(all(v is not None for v in loc.__dict__.values()))
weat = item.weather
self.assertTrue(weat is not None)
self.assertTrue(isinstance(o4, list))
self.assertFalse(len(o4) > 2)
for item in o4:
self.assertTrue(item)
self.assertTrue(item.reception_time())
loc = item.location
self.assertTrue(loc is not None)
self.assertTrue(all(v is not None for v in loc.__dict__.values()))
weat = item.weather
self.assertTrue(weat is not None)
def test_weather_around_coords(self):
"""
Test feature: find currently observed weather for locations that are
nearby the specified coordinates
"""
o2 = self.__owm.weather_around_coords(57.0, -2.15) # Scotland
self.assertTrue(isinstance(o2, list))
for item in o2:
self.assertTrue(item is not None)
self.assertTrue(item.reception_time() is not None)
loc = item.location
self.assertTrue(loc is not None)
self.assertTrue(all(v is not None for v in loc.__dict__.values()))
weat = item.weather
self.assertTrue(weat is not None)
o1 = self.__owm.weather_around_coords(57.0, -2.15, 2) # Scotland
self.assertTrue(isinstance(o1, list))
for item in o1:
self.assertTrue(item is not None)
self.assertTrue(item.reception_time() is not None)
loc = item.location
self.assertTrue(loc is not None)
self.assertTrue(all(v is not None for v in loc.__dict__.values()))
weat = item.weather
self.assertTrue(weat is not None)
def test_forecast_at_place_on_3h(self):
"""
Test feature: get 3 hours forecast for a specific location
"""
fc1 = self.__owm.forecast_at_place("London,GB", "3h")
fc2 = self.__owm.forecast_at_place('Kiev', "3h")
self.assertTrue(fc1)
f1 = fc1.forecast
self.assertTrue(f1 is not None)
self.assertTrue(f1.reception_time() is not None)
loc = f1.location
self.assertTrue(loc is not None)
self.assertTrue(all(v is not None for v in loc.__dict__.values()))
for weather in f1:
self.assertTrue(weather is not None)
self.assertTrue(fc2 is not None)
f2 = fc2.forecast
self.assertTrue(f2 is not None)
self.assertTrue(f2.reception_time() is not None)
loc = f2.location
self.assertTrue(loc is not None)
self.assertTrue(all(v is not None for v in loc.__dict__.values()))
for weather in f2:
self.assertTrue(weather is not None)
def test_forecast_at_coords_on_3h(self):
"""
Test feature: get 3 hours forecast at a specific geographic coordinate
"""
# London,uk
fc1 = self.__owm.forecast_at_coords(51.5073509, -0.1277583, "3h")
# Kiev
fc2 = self.__owm.forecast_at_coords(50.4501, 30.5234, "3h")
self.assertTrue(fc1)
f1 = fc1.forecast
self.assertTrue(f1 is not None)
self.assertTrue(f1.reception_time() is not None)
loc = f1.location
self.assertTrue(loc is not None)
self.assertTrue(all(v is not None for v in loc.__dict__.values()))
for weather in f1:
self.assertTrue(weather is not None)
self.assertTrue(fc2 is not None)
f2 = fc2.forecast
self.assertTrue(f2 is not None)
self.assertTrue(f2.reception_time() is not None)
loc = f2.location
self.assertTrue(loc is not None)
self.assertTrue(all(v is not None for v in loc.__dict__.values()))
for weather in f2:
self.assertTrue(weather is not None)
with self.assertRaises(ValueError):
self.__owm.forecast_at_coords(199, 199, '3h')
def test_forecast_at_id_on_3h(self):
"""
Test feature: get 3 hours forecast for city ID
"""
# London,uk
fc1 = self.__owm.forecast_at_id(2643743, '3h')
# Kiev
fc2 = self.__owm.forecast_at_id(703448, '3h')
self.assertTrue(fc1)
f1 = fc1.forecast
self.assertTrue(f1 is not None)
self.assertTrue(f1.reception_time() is not None)
loc = f1.location
self.assertTrue(loc is not None)
self.assertTrue(all(v is not None for v in loc.__dict__.values()))
for weather in f1:
self.assertTrue(weather is not None)
self.assertTrue(fc2 is not None)
f2 = fc2.forecast
self.assertTrue(f2 is not None)
self.assertTrue(f2.reception_time() is not None)
loc = f2.location
self.assertTrue(loc is not None)
self.assertTrue(all(v is not None for v in loc.__dict__.values()))
for weather in f2:
self.assertTrue(weather is not None)
# Unexistent
try:
fc3 = self.__owm.forecast_at_id(99999999999999, '3h')
self.fail()
except pyowm.commons.exceptions.NotFoundError:
pass # ok
def forecast_at_place_daily(self):
"""
Test feature: get daily forecast for a specific location
"""
fc1 = self.__owm.forecast_at_place("London,GB", "daily")
fc2 = self.__owm.forecast_at_place('Kiev', "daily")
self.assertTrue(fc1)
f1 = fc1.forecast
f1 = fc1.forecast
self.assertTrue(f1 is not None)
self.assertTrue(f1.reception_time() is not None)
loc = f1.location
self.assertTrue(loc is not None)
self.assertTrue(all(v is not None for v in loc.__dict__.values()))
for weather in f1:
self.assertTrue(weather is not None)
self.assertTrue(fc2 is not None)
f2 = fc2.forecast
self.assertTrue(f2 is not None)
self.assertTrue(f2.reception_time() is not None)
loc = f2.location
self.assertTrue(loc is not None)
self.assertTrue(all(v is not None for v in loc.__dict__.values()))
for weather in f2:
self.assertTrue(weather is not None)
def test_forecast_at_coords_daily(self):
"""
Test feature: get daily forecast at a specific geographic coordinate
"""
fc1 = self.__owm.forecast_at_coords(51.5073509, -0.1277583, 'daily') # London,uk
self.assertTrue(fc1)
f1 = fc1.forecast
self.assertTrue(f1 is not None)
self.assertTrue(f1.reception_time() is not None)
loc = f1.location
self.assertTrue(loc is not None)
self.assertTrue(all(v is not None for v in loc.__dict__.values()))
for weather in f1:
self.assertTrue(weather is not None)
with self.assertRaises(ValueError):
self.__owm.forecast_at_coords(199, 199, 'daily')
def test_forecast_at_id_daily(self):
"""
Test feature: get daily forecast for a specific city ID
"""
# London,uk
fc1 = self.__owm.forecast_at_id(2643743, 'daily')
# Kiev
fc2 = self.__owm.forecast_at_id(703448, 'daily')
try:
fc3 = self.__owm.forecast_at_id(99999999, 'daily')
raise AssertionError("APIRequestError was expected here")
except pyowm.commons.exceptions.NotFoundError:
pass # Ok!
self.assertTrue(fc1)
f1 = fc1.forecast
self.assertTrue(f1 is not None)
self.assertTrue(f1.reception_time() is not None)
loc = f1.location
self.assertTrue(loc is not None)
self.assertTrue(all(v is not None for v in loc.__dict__.values()))
for weather in f1:
self.assertTrue(weather is not None)
self.assertTrue(fc2 is not None)
f2 = fc2.forecast
self.assertTrue(f2 is not None)
self.assertTrue(f2.reception_time() is not None)
loc = f2.location
self.assertTrue(loc is not None)
self.assertTrue(all(v is not None for v in loc.__dict__.values()))
for weather in f2:
self.assertTrue(weather is not None)
def test_station_tick_history(self):
"""
Test feature: get station tick weather history for a specific
meteostation
"""
try:
h1 = self.__owm.station_tick_history(39276)
if h1 is not None:
sh1 = h1.station_history
self.assertTrue(sh1 is not None)
data1 = sh1.measurements
self.assertTrue(data1 is not None)
self.assertFalse(0, len(data1))
h2 = self.__owm.station_tick_history(39276, limit=2)
self.assertTrue(h2 is not None)
sh2 = h2.station_history
self.assertTrue(sh2 is not None)
data2 = sh2.measurements
self.assertTrue(data2 is not None)
self.assertFalse(len(data2) > 2)
h3 = self.__owm.station_tick_history(987654) # Shall be None
self.assertFalse(h3 is not None)
except pyowm.commons.exceptions.UnauthorizedError:
pass # it's a paid-level API feature
def test_station_hour_history(self):
"""
Test feature: get station hour weather history for a specific
meteostation
"""
try:
h1 = self.__owm.station_hour_history(123)
if h1 is not None:
sh1 = h1.station_history
self.assertTrue(sh1 is not None)
data1 = sh1.measurements
self.assertTrue(data1 is not None)
self.assertFalse(0, len(data1))
h2 = self.__owm.station_hour_history(987654) # Shall be None
self.assertFalse(h2 is not None)
except pyowm.commons.exceptions.UnauthorizedError:
pass # it's a paid-level API feature
def test_station_day_history(self):
"""
Test feature: get station hour weather history for a specific
meteostation
"""
try:
h1 = self.__owm.station_day_history(123)
if h1 is not None:
sh1 = h1.station_history
self.assertTrue(sh1 is not None)
data1 = sh1.measurements
self.assertTrue(data1 is not None)
self.assertFalse(0, len(data1))
h2 = self.__owm.station_day_history(123, limit=3)
self.assertTrue(h2 is not None)
sh2 = h2.station_history
self.assertTrue(sh2 is not None)
data2 = sh2.measurements
self.assertTrue(data2 is not None)
h3 = self.__owm.station_day_history(987654) # Shall be None
self.assertFalse(h3 is not None)
except pyowm.commons.exceptions.UnauthorizedError:
pass # it's a paid-level API feature
def test_weather_at_places_in_bbox(self):
o = self.__owm.weather_at_places_in_bbox(0.734720, 38.422663, 1.964651, 39.397204, 10, False) # Ibiza
self.assertTrue(isinstance(o, list))
for item in o:
self.assertTrue(item is not None)
self.assertTrue(item.reception_time() is not None)
loc = item.location
self.assertTrue(loc is not None)
weat = item.weather
self.assertTrue(weat is not None)
def test_one_call(self):
result = self.__owm.one_call(lat=46.49, lon=11.33)
self.assertTrue(isinstance(result, OneCall))
self.assertEqual(46.49, result.lat)
self.assertEqual(11.33, result.lon)
self.assertEqual("Europe/Rome", result.timezone)
self.assertTrue(isinstance(result.current, Weather))
self.assertEqual(48, len(result.forecast_hourly))
for i, weather in enumerate(result.forecast_hourly):
self.assertTrue(isinstance(weather, Weather), f"entry {i} of forecast_hourly is invalid")
self.assertEqual(8, len(result.forecast_daily))
for i, weather in enumerate(result.forecast_daily):
self.assertTrue(isinstance(weather, Weather), f"entry {i} of forecast_hourly is invalid")
if result.national_weather_alerts is not None:
self.assertTrue(isinstance(result.national_weather_alerts, list))
for alert in result.national_weather_alerts:
self.assertTrue(isinstance(alert, NationalWeatherAlert))
def test_one_call_historical(self):
result = self.__owm.one_call_history(lat=48.8576, lon=2.3377)
self.assertTrue(isinstance(result, OneCall))
self.assertEqual(48.8576, result.lat)
self.assertEqual(2.3377, result.lon)
self.assertEqual("Europe/Paris", result.timezone)
self.assertTrue(isinstance(result.current, Weather))
if result.forecast_hourly is not None:
for i, weather in enumerate(result.forecast_hourly):
self.assertTrue(isinstance(weather, Weather), f"entry {i} of forecast_hourly is invalid")
if result.forecast_daily is not None:
self.assertEqual(8, len(result.forecast_daily))
for i, weather in enumerate(result.forecast_daily):
self.assertTrue(isinstance(weather, Weather), f"entry {i} of forecast_hourly is invalid")
if __name__ == "__main__":
unittest.main()
| {
"content_hash": "17a43298523db19a4224b0ecee1c2f24",
"timestamp": "",
"source": "github",
"line_count": 459,
"max_line_length": 110,
"avg_line_length": 41.450980392156865,
"alnum_prop": 0.5946073793755913,
"repo_name": "csparpa/pyowm",
"id": "f239adabb59831ecde8ca063d385041ed662ac16",
"size": "19073",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "tests/integration/weatherapi25/test_integration.py",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Batchfile",
"bytes": "6699"
},
{
"name": "Makefile",
"bytes": "6758"
},
{
"name": "Python",
"bytes": "1045787"
},
{
"name": "Shell",
"bytes": "6424"
}
],
"symlink_target": ""
} |
@interface CpuMeterTests : XCTestCase
@end
@implementation CpuMeterTests
- (void)testCpuPerformanceIsZeroOnFirstCall {
CpuMeter *meter = [[CpuMeter alloc] init];
int usage = [meter usage];
XCTAssert(usage == 0, @"The usage should be zero on first call");
}
- (void)testCpuPerformanceShouldBecomeNonZeroOnSubsequentCalls {
CpuMeter *meter = [[CpuMeter alloc] init];
int MAX_TRIES = 1000;
while (MAX_TRIES--) {
if ([meter usage] > 0)
return;
}
XCTAssert(false, @"The usage did not rise about zero");
}
@end
| {
"content_hash": "7b0edae2be825ec02256e6bb2eb28fee",
"timestamp": "",
"source": "github",
"line_count": 27,
"max_line_length": 67,
"avg_line_length": 20,
"alnum_prop": 0.6925925925925925,
"repo_name": "kevinmcconnell/minimon",
"id": "467c3319a525238efab4976c1bbcf468611cfc2b",
"size": "730",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "MinimonTests/CpuMeterTests.m",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Objective-C",
"bytes": "7708"
}
],
"symlink_target": ""
} |
<?php
/* TwigBundle:Exception:exception.rdf.twig */
class __TwigTemplate_d34b362439b59d996ebe42344ef13ac66208e852683b0361f7cf97278581882b extends Twig_Template
{
public function __construct(Twig_Environment $env)
{
parent::__construct($env);
$this->parent = false;
$this->blocks = array(
);
}
protected function doDisplay(array $context, array $blocks = array())
{
// line 1
$this->env->loadTemplate("TwigBundle:Exception:exception.xml.twig")->display(array_merge($context, array("exception" => (isset($context["exception"]) ? $context["exception"] : null))));
}
public function getTemplateName()
{
return "TwigBundle:Exception:exception.rdf.twig";
}
public function isTraitable()
{
return false;
}
public function getDebugInfo()
{
return array ( 19 => 1,);
}
}
| {
"content_hash": "09fc919ff971ff46409a3735b17ba58d",
"timestamp": "",
"source": "github",
"line_count": 36,
"max_line_length": 193,
"avg_line_length": 25.055555555555557,
"alnum_prop": 0.6263858093126385,
"repo_name": "ramoraes/myproject",
"id": "d4336898edb0c52f726895f75a53f10f74db4fa7",
"size": "902",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "app/cache/prod/twig/d3/4b/362439b59d996ebe42344ef13ac66208e852683b0361f7cf97278581882b.php",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "2204"
},
{
"name": "PHP",
"bytes": "59829"
}
],
"symlink_target": ""
} |
from django.contrib import admin
from django.utils.translation import ugettext_lazy as _
from django.core.urlresolvers import reverse
from .models import *
class HistoryEventAdmin(admin.ModelAdmin):
date_hierarchy = 'event_timestamp'
list_display = ('display_as', 'event_timestamp', 'publish_timestamp', 'related_object_admin')
search_fields = ['content_type']
list_filter = ('is_hidden', 'is_internal', 'content_type')
def related_object_admin(self, obj):
""" Display link to related object's admin """
try:
if obj.content_type and obj.object_id:
admin_url = reverse('admin:%s_%s_change' % (obj.content_type.app_label, obj.content_type.model), args=(obj.object_id,))
return '%s: <a href="%s">%s</a>' % (obj.content_type.model.capitalize(), admin_url, obj.content_object.__unicode__())
except Exception, ex:
pass
return _('No relative object')
related_object_admin.allow_tags = True
related_object_admin.short_description = _('Related object')
class HistoryAdmin(admin.ModelAdmin):
list_display = ('owner', )
admin.site.register(HistoryEvent, HistoryEventAdmin)
admin.site.register(History, HistoryAdmin)
| {
"content_hash": "abe5d2444f5835b03c4466a3f3a84778",
"timestamp": "",
"source": "github",
"line_count": 33,
"max_line_length": 135,
"avg_line_length": 37.515151515151516,
"alnum_prop": 0.6672051696284329,
"repo_name": "arteria/django-history",
"id": "e10fef8f7009d4a3df546778c09c93d1ba19362a",
"size": "1238",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "history/admin.py",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "HTML",
"bytes": "1690"
},
{
"name": "Makefile",
"bytes": "269"
},
{
"name": "Python",
"bytes": "19872"
}
],
"symlink_target": ""
} |
#ifndef __BLE_HEART_RATE_SERVICE_H__
#define __BLE_HEART_RATE_SERVICE_H__
#include "ble/BLE.h"
/**
* @class HeartRateService
* @brief BLE Service for HeartRate. This BLE Service contains the location of the sensor, the heartrate in beats per minute. <br>
* Service: https://developer.bluetooth.org/gatt/services/Pages/ServiceViewer.aspx?u=org.bluetooth.service.heart_rate.xml <br>
* HRM Char: https://developer.bluetooth.org/gatt/characteristics/Pages/CharacteristicViewer.aspx?u=org.bluetooth.characteristic.heart_rate_measurement.xml <br>
* Location: https://developer.bluetooth.org/gatt/characteristics/Pages/CharacteristicViewer.aspx?u=org.bluetooth.characteristic.body_sensor_location.xml
*/
class HeartRateService {
public:
/**
* @enum SensorLocation
* @brief Location of HeartRate sensor on body.
*/
enum {
LOCATION_OTHER = 0, /*!< Other Location */
LOCATION_CHEST, /*!< Chest */
LOCATION_WRIST, /*!< Wrist */
LOCATION_FINGER, /*!< Finger */
LOCATION_HAND, /*!< Hand */
LOCATION_EAR_LOBE, /*!< Earlobe */
LOCATION_FOOT, /*!< Foot */
};
public:
/**
* @brief Constructor with 8bit HRM Counter value.
*
* @param[ref] _ble
* Reference to the underlying BLE.
* @param[in] hrmCounter (8-bit)
* initial value for the hrm counter.
* @param[in] location
* Sensor's location.
*/
HeartRateService(BLE &_ble, uint8_t hrmCounter, uint8_t location) :
ble(_ble),
valueBytes(hrmCounter),
hrmRate(GattCharacteristic::UUID_HEART_RATE_MEASUREMENT_CHAR, valueBytes.getPointer(),
valueBytes.getNumValueBytes(), HeartRateValueBytes::MAX_VALUE_BYTES,
GattCharacteristic::BLE_GATT_CHAR_PROPERTIES_READ | GattCharacteristic::BLE_GATT_CHAR_PROPERTIES_NOTIFY),
hrmLocation(GattCharacteristic::UUID_BODY_SENSOR_LOCATION_CHAR, &location),
controlPoint(GattCharacteristic::UUID_HEART_RATE_CONTROL_POINT_CHAR, &controlPointValue) {
setupService();
}
/**
* @brief Constructor with a 16-bit HRM Counter value.
*
* @param[in] _ble
* Reference to the underlying BLE.
* @param[in] hrmCounter (8-bit)
* initial value for the hrm counter.
* @param[in] location
* Sensor's location.
*/
HeartRateService(BLE &_ble, uint16_t hrmCounter, uint8_t location) :
ble(_ble),
valueBytes(hrmCounter),
hrmRate(GattCharacteristic::UUID_HEART_RATE_MEASUREMENT_CHAR, valueBytes.getPointer(),
valueBytes.getNumValueBytes(), HeartRateValueBytes::MAX_VALUE_BYTES,
GattCharacteristic::BLE_GATT_CHAR_PROPERTIES_NOTIFY),
hrmLocation(GattCharacteristic::UUID_BODY_SENSOR_LOCATION_CHAR, &location),
controlPoint(GattCharacteristic::UUID_HEART_RATE_CONTROL_POINT_CHAR, &controlPointValue) {
setupService();
}
/**
* @brief Set a new 8-bit value for heart rate.
*
* @param[in] hrmCounter
* HeartRate in bpm.
*/
void updateHeartRate(uint8_t hrmCounter) {
valueBytes.updateHeartRate(hrmCounter);
ble.gattServer().write(hrmRate.getValueHandle(), valueBytes.getPointer(), valueBytes.getNumValueBytes());
}
/**
* Set a new 16-bit value for heart rate.
*
* @param[in] hrmCounter
* HeartRate in bpm.
*/
void updateHeartRate(uint16_t hrmCounter) {
valueBytes.updateHeartRate(hrmCounter);
ble.gattServer().write(hrmRate.getValueHandle(), valueBytes.getPointer(), valueBytes.getNumValueBytes());
}
/**
* This callback allows the HeartRateService to receive updates to the
* controlPoint Characteristic.
*
* @param[in] params
* Information about the characterisitc being updated.
*/
virtual void onDataWritten(const GattWriteCallbackParams *params) {
if (params->handle == controlPoint.getValueAttribute().getHandle()) {
/* Do something here if the new value is 1; else you can override this method by
* extending this class.
* @NOTE: if you are extending this class, be sure to also call
* ble.onDataWritten(this, &ExtendedHRService::onDataWritten); in
* your constructor.
*/
}
}
protected:
void setupService(void) {
GattCharacteristic *charTable[] = {&hrmRate, &hrmLocation, &controlPoint};
GattService hrmService(GattService::UUID_HEART_RATE_SERVICE, charTable, sizeof(charTable) / sizeof(GattCharacteristic *));
ble.addService(hrmService);
ble.onDataWritten(this, &HeartRateService::onDataWritten);
}
protected:
/* Private internal representation for the bytes used to work with the vaulue of the heart-rate characteristic. */
struct HeartRateValueBytes {
static const unsigned MAX_VALUE_BYTES = 3; /* FLAGS + up to two bytes for heart-rate */
static const unsigned FLAGS_BYTE_INDEX = 0;
static const unsigned VALUE_FORMAT_BITNUM = 0;
static const uint8_t VALUE_FORMAT_FLAG = (1 << VALUE_FORMAT_BITNUM);
HeartRateValueBytes(uint8_t hrmCounter) : valueBytes() {
updateHeartRate(hrmCounter);
}
HeartRateValueBytes(uint16_t hrmCounter) : valueBytes() {
updateHeartRate(hrmCounter);
}
void updateHeartRate(uint8_t hrmCounter) {
valueBytes[FLAGS_BYTE_INDEX] &= ~VALUE_FORMAT_FLAG;
valueBytes[FLAGS_BYTE_INDEX + 1] = hrmCounter;
}
void updateHeartRate(uint16_t hrmCounter) {
valueBytes[FLAGS_BYTE_INDEX] |= VALUE_FORMAT_FLAG;
valueBytes[FLAGS_BYTE_INDEX + 1] = (uint8_t)(hrmCounter & 0xFF);
valueBytes[FLAGS_BYTE_INDEX + 2] = (uint8_t)(hrmCounter >> 8);
}
uint8_t *getPointer(void) {
return valueBytes;
}
const uint8_t *getPointer(void) const {
return valueBytes;
}
unsigned getNumValueBytes(void) const {
return 1 + ((valueBytes[FLAGS_BYTE_INDEX] & VALUE_FORMAT_FLAG) ? sizeof(uint16_t) : sizeof(uint8_t));
}
private:
/* First byte = 8-bit values, no extra info, Second byte = uint8_t HRM value */
/* See --> https://developer.bluetooth.org/gatt/characteristics/Pages/CharacteristicViewer.aspx?u=org.bluetooth.characteristic.heart_rate_measurement.xml */
uint8_t valueBytes[MAX_VALUE_BYTES];
};
protected:
BLE &ble;
HeartRateValueBytes valueBytes;
uint8_t controlPointValue;
GattCharacteristic hrmRate;
ReadOnlyGattCharacteristic<uint8_t> hrmLocation;
WriteOnlyGattCharacteristic<uint8_t> controlPoint;
};
#endif /* #ifndef __BLE_HEART_RATE_SERVICE_H__*/ | {
"content_hash": "1f74b617daa74894132cfcd9970d3536",
"timestamp": "",
"source": "github",
"line_count": 180,
"max_line_length": 164,
"avg_line_length": 38.86666666666667,
"alnum_prop": 0.6315037164093767,
"repo_name": "marduino/bleController",
"id": "3e61ada1c9ce15d581eba1fd5151ad3f11901108",
"size": "7628",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "BLE_API/ble/services/HeartRateService.h",
"mode": "33261",
"license": "mit",
"language": [
{
"name": "Assembly",
"bytes": "7634"
},
{
"name": "C",
"bytes": "2392691"
},
{
"name": "C++",
"bytes": "744809"
},
{
"name": "Eagle",
"bytes": "368469"
},
{
"name": "Makefile",
"bytes": "8982"
}
],
"symlink_target": ""
} |
ACCEPTED
#### According to
International Plant Names Index
#### Published in
Ann. Mus. Natl. Hist. Nat. 4:93. 1804
#### Original name
null
### Remarks
null | {
"content_hash": "4f5e2c61b1eb49ce6b81c77e3eb5a0a1",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 37,
"avg_line_length": 12.23076923076923,
"alnum_prop": 0.6855345911949685,
"repo_name": "mdoering/backbone",
"id": "4336232c8036b271ae4b719460702c2767720158",
"size": "205",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "life/Plantae/Magnoliophyta/Magnoliopsida/Malvales/Malvaceae/Grewia/Grewia eriocarpa/README.md",
"mode": "33188",
"license": "apache-2.0",
"language": [],
"symlink_target": ""
} |
using System;
using System.Collections.Generic;
using System.Linq;
class Program
{
static void Main()
{
int n = int.Parse(Console.ReadLine());
var minDist = double.MaxValue;
List<Point> points = new List<Point>();
List<Point> closestPoints = new List<Point>();
for (int i = 0; i < n; i++)
{
var coords = Console.ReadLine().Split().Select(int.Parse).ToArray();
Point p = new Point
{
X = coords[0],
Y = coords[1],
};
points.Add(p);
}
for (var i = 0; i < points.Count; i++)
{
for (var j = i + 1; j < points.Count; j++)
{
var dist = DistanceBetweenPoints(points[i], points[j]);
if (dist < minDist)
{
minDist = dist;
closestPoints.Insert(0, points[j]);
closestPoints.Insert(0, points[i]);
}
}
}
var res = closestPoints.Take(2);
Console.WriteLine($"{minDist:f3}");
foreach (var item in res)
{
Console.Write("(" + item.X + "," + " ");
Console.WriteLine(item.Y + ")");
}
}
private static double DistanceBetweenPoints(Point point1, Point point2)
{
return Math.Sqrt(Math.Pow(point1.X - point2.X, 2) + Math.Pow(point1.Y - point2.Y, 2));
}
}
public class Point
{
public int X { get; set; }
public int Y { get; set; }
}
| {
"content_hash": "2d23401e7bf2c80e7b1fa2d51845661c",
"timestamp": "",
"source": "github",
"line_count": 64,
"max_line_length": 94,
"avg_line_length": 24.3125,
"alnum_prop": 0.4697943444730077,
"repo_name": "delian1986/SoftUni-C-Sharp-repo",
"id": "ec0122afcf0bf6f72b817ee57e1355bf175a285a",
"size": "1558",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "Fundamentals of Programming/05. ClassesConstructorsMethods/05.ClassesMethods/17. Closest Two Points/17. Closest Two Points.cs",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "ASP",
"bytes": "111"
},
{
"name": "C#",
"bytes": "1666528"
},
{
"name": "CSS",
"bytes": "513"
},
{
"name": "HTML",
"bytes": "31742"
},
{
"name": "JavaScript",
"bytes": "225478"
}
],
"symlink_target": ""
} |
<?xml version="1.0" encoding="UTF-8"?>
<actions>
<action>
<actionName>CUSTOM-install (skip tests)</actionName>
<displayName>install (skip tests)</displayName>
<goals>
<goal>clean</goal>
<goal>install</goal>
</goals>
<properties>
<skipTests>true</skipTests>
</properties>
</action>
</actions>
| {
"content_hash": "411311848fdc0cfc2cc98bae716a2f55",
"timestamp": "",
"source": "github",
"line_count": 14,
"max_line_length": 64,
"avg_line_length": 30.857142857142858,
"alnum_prop": 0.4861111111111111,
"repo_name": "agapsys/scanner-maven-plugin-lib",
"id": "3d93e14a216a4a1325e13f97f5da3998ba607949",
"size": "432",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "nbactions.xml",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Java",
"bytes": "45109"
}
],
"symlink_target": ""
} |
title: ahe15
type: products
image: /img/Screen Shot 2017-05-09 at 11.56.54 AM.png
heading: e15
description: lksadjf lkasdjf lksajdf lksdaj flksadj flksa fdj
main:
heading: Foo Bar BAz
description: |-
***This is i a thing***kjh hjk kj
# Blah Blah
## Blah![undefined](undefined)
### Baah
image1:
alt: kkkk
---
| {
"content_hash": "0d4d90efbd10eb26f8a82f73d7ab3697",
"timestamp": "",
"source": "github",
"line_count": 15,
"max_line_length": 61,
"avg_line_length": 22.333333333333332,
"alnum_prop": 0.6656716417910448,
"repo_name": "pblack/kaldi-hugo-cms-template",
"id": "1416ec6b0b3d51d66e9e216e418166aa5d41608c",
"size": "339",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "site/content/pages2/ahe15.md",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "94394"
},
{
"name": "HTML",
"bytes": "18889"
},
{
"name": "JavaScript",
"bytes": "10014"
}
],
"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 (version 1.7.0_51) on Sat May 24 10:54:47 EDT 2014 -->
<title>enemies</title>
<meta name="date" content="2014-05-24">
<link rel="stylesheet" type="text/css" href="../stylesheet.css" title="Style">
</head>
<body>
<h1 class="bar"><a href="../enemies/package-summary.html" target="classFrame">enemies</a></h1>
<div class="indexContainer">
<h2 title="Classes">Classes</h2>
<ul title="Classes">
<li><a href="Enemy.html" title="class in enemies" target="classFrame">Enemy</a></li>
<li><a href="Enemy_Shooter.html" title="class in enemies" target="classFrame">Enemy_Shooter</a></li>
<li><a href="Enemy_Template.html" title="class in enemies" target="classFrame">Enemy_Template</a></li>
<li><a href="EnemySegment.html" title="class in enemies" target="classFrame">EnemySegment</a></li>
</ul>
<h2 title="Enums">Enums</h2>
<ul title="Enums">
<li><a href="Enemy_Template.Direction.html" title="enum in enemies" target="classFrame">Enemy_Template.Direction</a></li>
</ul>
</div>
</body>
</html>
| {
"content_hash": "5a62c3b0573227f04b2d4ec430afc46c",
"timestamp": "",
"source": "github",
"line_count": 26,
"max_line_length": 121,
"avg_line_length": 44.34615384615385,
"alnum_prop": 0.6895056374674762,
"repo_name": "Avantol13/Improved-Classic-Snake-Game",
"id": "6da404c60d56ed6e5f45065b20e2b1b22643cfc8",
"size": "1153",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "doc/enemies/package-frame.html",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Java",
"bytes": "204714"
}
],
"symlink_target": ""
} |
import React from 'react';
import PostImage from '../components/story/PostImage';
import TwoPostImages from '../components/story/TwoPostImages';
import StoryPage from '../components/story/StoryPage';
import StoryTextBlock from '../components/story/StoryTextBlock';
import StoryImages from '../components/story/StoryImages';
import StoryIntro from '../components/story/StoryIntro';
const imgDirPath = "/images/stories/2016-11-20-irina-and-lucian-maternity-photo-session/";
const imgDirPath1 = "stories/2016-11-20-irina-and-lucian-maternity-photo-session";
class IrinaAndLucianMaternityPhotoSessionStory extends React.Component {
constructor() {
super();
}
render() {
return (
<StoryPage logoDirPath={imgDirPath1}
logoPrefix="teaser"
logoNumber="08-2048"
title="Irina & Lucian Maternity Photos"
author="Dan"
location="Charlottenburg Palace, Berlin"
tags="maternity, baby, pregnancy">
<StoryIntro>
Our friends, Lucian and Irina are having a baby. This is such a wonderful moment!
We decided to go together at the Charlottenburg Palace to do a maternity photo session.
We were really lucky we got a wonderful sunny weekend, the last sunny one this autumn,
before all of the leaves have already fallen.
</StoryIntro>
<StoryTextBlock title="The Charlottenburg Palace">
The impressive palace is a great place to take photos and this time is
covered with scaffolding, which somehow gives a symbolic hint to our photo shoot:
"work in progress!" We start our photo session here,
taking advantage of the bright sun. I'm using a polarizer filter here,
to make the colors pop!
</StoryTextBlock>
<StoryImages>
<PostImage dirPath={imgDirPath} number="01" />
<TwoPostImages dirPath={imgDirPath}
number1="02"
number2="03" />
<TwoPostImages dirPath={imgDirPath}
number1="05"
number2="06" />
<PostImage dirPath={imgDirPath} number="07" />
<PostImage dirPath={imgDirPath} number="10" />
<PostImage dirPath={imgDirPath} number="27" />
</StoryImages>
<StoryTextBlock title="The Forest">
The sun coming through the colorful leaves of the autumn gave the perfect light for the next photos.
Using a long lens allowed me to isolate my subjects and bring that great shallow depth of field!
I'll let you observe the authentic joy on Lucian and Irina's faces, brought by this great moment in their lives,
having a baby.
</StoryTextBlock>
<StoryImages>
<PostImage dirPath={imgDirPath} number="16" />
<TwoPostImages dirPath={imgDirPath}
number1="13"
number2="15" />
<PostImage dirPath={imgDirPath} number="19" />
<TwoPostImages dirPath={imgDirPath}
number1="20"
number2="21" />
<PostImage dirPath={imgDirPath} number="22" />
<TwoPostImages dirPath={imgDirPath}
number1="23"
number2="24" />
<PostImage dirPath={imgDirPath} number="35" />
</StoryImages>
<StoryTextBlock title="The Lake">
Moving away from "the forest", we chose the nearby lake is our third location.
<br/>
In the next photo, the contrast between the blue lake and Irina's orange
pullover is just amazing.
<br/>
You might already know that the bridge in the Charlottenburg Garden is
one of our <a href="/streets-of-berlin/charlottenburg-bridge-in-autumn.html">favorite
places</a>. Like always, it gave me a really nice opportunity to play
with reflections.
</StoryTextBlock>
<StoryImages>
<PostImage dirPath={imgDirPath} number="28" />
<PostImage dirPath={imgDirPath} number="30" />
<PostImage dirPath={imgDirPath} number="31" />
<PostImage dirPath={imgDirPath} number="37" />
<PostImage dirPath={imgDirPath} number="39" />
<PostImage dirPath={imgDirPath} number="42" />
</StoryImages>
<StoryTextBlock title="The Autumn">
The colors of the autumn are just amazing! My favorite photo from this
series is the next one. I call it "The Tree of Life", as there are four
colors spreading from each of the corners, one for each of the seasons.
We have spring and summer to the left, and autumn and winter to the right.
And of course, pregnant Irina in the middle getting support from her dear
husband, Lucian.
</StoryTextBlock>
<StoryImages>
<PostImage dirPath={imgDirPath} number="44" />
<PostImage dirPath={imgDirPath} number="46" />
<PostImage dirPath={imgDirPath} number="48" />
<PostImage dirPath={imgDirPath} number="51" />
<TwoPostImages dirPath={imgDirPath}
number1="52"
number2="53" />
<PostImage dirPath={imgDirPath} number="54" />
<TwoPostImages dirPath={imgDirPath}
number1="55"
number2="56" />
<PostImage dirPath={imgDirPath} number="59" />
<TwoPostImages dirPath={imgDirPath}
number1="60"
number2="61" />
<TwoPostImages dirPath={imgDirPath}
number1="62"
number2="63" />
<PostImage dirPath={imgDirPath} number="64" />
</StoryImages>
</StoryPage>);
}
}
export default IrinaAndLucianMaternityPhotoSessionStory;
| {
"content_hash": "ac3e2d217897d58dc4c628096305b4e6",
"timestamp": "",
"source": "github",
"line_count": 134,
"max_line_length": 132,
"avg_line_length": 44.8955223880597,
"alnum_prop": 0.5997340425531915,
"repo_name": "danpersa/remindmetolive-react",
"id": "b5ae6d78cbfc11475c3bc0cb1f8fbbe582d0385c",
"size": "6016",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/stories/2016-11-20-irina-and-lucian-maternity-photo-session.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "191530"
},
{
"name": "HTML",
"bytes": "2211"
},
{
"name": "JavaScript",
"bytes": "265518"
},
{
"name": "Makefile",
"bytes": "1829"
},
{
"name": "Shell",
"bytes": "715"
}
],
"symlink_target": ""
} |
<?php
namespace SilverStripe\FullTextSearch\Search\Processors;
use SilverStripe\Core\Config\Config;
use stdClass;
use Symbiote\QueuedJobs\Services\QueuedJob;
use Symbiote\QueuedJobs\Services\QueuedJobService;
if (!interface_exists(QueuedJob::class)) {
return;
}
class SearchUpdateQueuedJobProcessor extends SearchUpdateBatchedProcessor implements QueuedJob
{
/**
* The QueuedJob queue to use when processing updates
* @config
* @var string
*/
private static $reindex_queue = QueuedJob::QUEUED;
protected $messages = array();
public function triggerProcessing()
{
parent::triggerProcessing();
singleton(QueuedJobService::class)->queueJob($this);
}
public function getTitle()
{
return "FullTextSearch Update Job";
}
public function getSignature()
{
return md5(get_class($this) . time() . mt_rand(0, 100000));
}
public function getJobType()
{
return Config::inst()->get(__CLASS__, 'reindex_queue');
}
public function jobFinished()
{
return $this->currentBatch >= count($this->batches);
}
public function setup()
{
// NOP
}
public function prepareForRestart()
{
// NOP
}
public function afterComplete()
{
// Once indexing is complete, commit later in order to avoid solr limits
// see http://stackoverflow.com/questions/7512945/how-to-fix-exceeded-limit-of-maxwarmingsearchers
SearchUpdateCommitJobProcessor::queue();
}
public function getJobData()
{
$data = new stdClass();
$data->totalSteps = count($this->batches);
$data->currentStep = $this->currentBatch;
$data->isComplete = $this->jobFinished();
$data->messages = $this->messages;
$data->jobData = new stdClass();
$data->jobData->batches = $this->batches;
$data->jobData->currentBatch = $this->currentBatch;
return $data;
}
public function setJobData($totalSteps, $currentStep, $isComplete, $jobData, $messages)
{
$this->isComplete = $isComplete;
$this->messages = $messages;
$this->batches = $jobData->batches;
$this->currentBatch = $jobData->currentBatch;
}
public function addMessage($message, $severity = 'INFO')
{
$severity = strtoupper($severity);
$this->messages[] = '[' . date('Y-m-d H:i:s') . "][$severity] $message";
}
public function process()
{
$result = parent::process();
if ($this->jobFinished()) {
$this->addMessage("All batched updates complete. Queuing commit job");
}
return $result;
}
}
| {
"content_hash": "3ff194d02cd60345355c0a7fcaaa1d7e",
"timestamp": "",
"source": "github",
"line_count": 108,
"max_line_length": 106,
"avg_line_length": 25.12037037037037,
"alnum_prop": 0.6162919277552524,
"repo_name": "silverstripe-labs/silverstripe-fulltextsearch",
"id": "edb70027f2c3592b872aa4a719258c8678aaa600",
"size": "2713",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/Search/Processors/SearchUpdateQueuedJobProcessor.php",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "PHP",
"bytes": "246234"
},
{
"name": "Scheme",
"bytes": "46347"
}
],
"symlink_target": ""
} |
using System;
using System.Diagnostics;
using System.Net.Security;
using System.Runtime.InteropServices;
using System.Security.Authentication;
using System.Security.Authentication.ExtendedProtection;
using System.Security.Cryptography;
using Microsoft.Win32.SafeHandles;
internal static partial class Interop
{
internal static partial class Ssl
{
[DllImport(Libraries.CryptoNative, EntryPoint = "CryptoNative_SetProtocolOptions")]
internal static extern void SetProtocolOptions(SafeSslContextHandle ctx, SslProtocols protocols);
[DllImport(Libraries.CryptoNative, EntryPoint = "CryptoNative_SslCtxUseCertificate")]
internal static extern int SslCtxUseCertificate(SafeSslContextHandle ctx, SafeX509Handle certPtr);
[DllImport(Libraries.CryptoNative, EntryPoint = "CryptoNative_SslCtxUsePrivateKey")]
internal static extern int SslCtxUsePrivateKey(SafeSslContextHandle ctx, SafeEvpPKeyHandle keyPtr);
[DllImport(Libraries.CryptoNative, EntryPoint = "CryptoNative_SslCtxCheckPrivateKey")]
internal static extern int SslCtxCheckPrivateKey(SafeSslContextHandle ctx);
[DllImport(Libraries.CryptoNative, EntryPoint = "CryptoNative_SslCtxSetQuietShutdown")]
internal static extern void SslCtxSetQuietShutdown(SafeSslContextHandle ctx);
[DllImport(Libraries.CryptoNative, EntryPoint = "CryptoNative_SslCtxSetVerify")]
internal static extern void SslCtxSetVerify(SafeSslContextHandle ctx, SslCtxSetVerifyCallback callback);
[DllImport(Libraries.CryptoNative, EntryPoint = "CryptoNative_SetEncryptionPolicy")]
internal static extern bool SetEncryptionPolicy(SafeSslContextHandle ctx, EncryptionPolicy policy);
[DllImport(Libraries.CryptoNative, EntryPoint = "CryptoNative_SslCtxSetClientCAList")]
internal static extern void SslCtxSetClientCAList(SafeSslContextHandle ctx, SafeX509NameStackHandle x509NameStackPtr);
}
}
| {
"content_hash": "3dd92e344a314ba9a8063fca9ceecbd7",
"timestamp": "",
"source": "github",
"line_count": 38,
"max_line_length": 126,
"avg_line_length": 51.5,
"alnum_prop": 0.7925396014307614,
"repo_name": "kkurni/corefx",
"id": "4daac203ac0824e5e6a13724290e2ebf3aebf405",
"size": "2161",
"binary": false,
"copies": "3",
"ref": "refs/heads/master",
"path": "src/Common/src/Interop/Unix/System.Security.Cryptography.Native/Interop.SslCtxOptions.cs",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Batchfile",
"bytes": "19390"
},
{
"name": "C",
"bytes": "1112598"
},
{
"name": "C#",
"bytes": "101334716"
},
{
"name": "C++",
"bytes": "310021"
},
{
"name": "CMake",
"bytes": "31142"
},
{
"name": "DIGITAL Command Language",
"bytes": "26402"
},
{
"name": "Groff",
"bytes": "4236"
},
{
"name": "Groovy",
"bytes": "32663"
},
{
"name": "Makefile",
"bytes": "9085"
},
{
"name": "Perl",
"bytes": "3895"
},
{
"name": "PowerShell",
"bytes": "9085"
},
{
"name": "Python",
"bytes": "1535"
},
{
"name": "Shell",
"bytes": "36768"
},
{
"name": "Visual Basic",
"bytes": "829974"
}
],
"symlink_target": ""
} |
using System;
using System.Collections.Generic;
using ZyGames.Framework.Model;
using ZyGames.Framework.Net.Redis;
using ZyGames.Framework.Redis;
namespace ZyGames.Framework.Net
{
/// <summary>
///
/// </summary>
public class RedisTransponder : ITransponder
{
/// <summary>
///
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="receiveParam"></param>
/// <param name="dataList"></param>
/// <returns></returns>
public bool TryReceiveData<T>(TransReceiveParam receiveParam, out List<T> dataList) where T : AbstractEntity, new()
{
using (IDataReceiver getter = new RedisDataGetter(receiveParam.RedisKey))
{
return getter.TryReceive<T>(out dataList);
}
}
/// <summary>
///
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="dataList"></param>
/// <param name="sendParam"></param>
public void SendData<T>(T[] dataList, TransSendParam sendParam) where T : AbstractEntity, new()
{
using (IDataSender sender = new RedisDataSender())
{
sender.Send(dataList, sendParam.IsChange, sendParam.ConnectKey, sendParam.BeforeProcessHandle);
}
}
}
} | {
"content_hash": "93daf210a087dc9e2ab82969b60ad46c",
"timestamp": "",
"source": "github",
"line_count": 44,
"max_line_length": 123,
"avg_line_length": 31.75,
"alnum_prop": 0.5497494631352899,
"repo_name": "wenhulove333/ScutServer",
"id": "43aeb75729f9bf58b46fc9c6e709fba028642304",
"size": "2662",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "Source/Framework/ZyGames.Framework/Net/RedisTransponder.cs",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "ASP",
"bytes": "150472"
},
{
"name": "ActionScript",
"bytes": "339184"
},
{
"name": "Batchfile",
"bytes": "60466"
},
{
"name": "C",
"bytes": "3976261"
},
{
"name": "C#",
"bytes": "9481083"
},
{
"name": "C++",
"bytes": "11640198"
},
{
"name": "CMake",
"bytes": "489"
},
{
"name": "CSS",
"bytes": "13478"
},
{
"name": "Groff",
"bytes": "16179"
},
{
"name": "HTML",
"bytes": "283997"
},
{
"name": "Inno Setup",
"bytes": "28931"
},
{
"name": "Java",
"bytes": "214263"
},
{
"name": "JavaScript",
"bytes": "2809"
},
{
"name": "Lua",
"bytes": "4667522"
},
{
"name": "Makefile",
"bytes": "166623"
},
{
"name": "Objective-C",
"bytes": "401654"
},
{
"name": "Objective-C++",
"bytes": "355347"
},
{
"name": "Python",
"bytes": "1633926"
},
{
"name": "Shell",
"bytes": "101770"
},
{
"name": "Visual Basic",
"bytes": "18764"
}
],
"symlink_target": ""
} |
ACCEPTED
#### According to
International Plant Names Index
#### Published in
null
#### Original name
null
### Remarks
null | {
"content_hash": "d9eccf5fd22d173ea5480c90864e98d3",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 31,
"avg_line_length": 9.692307692307692,
"alnum_prop": 0.7063492063492064,
"repo_name": "mdoering/backbone",
"id": "179b9a17066c4b212379402950f5e4d74ec64997",
"size": "200",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "life/Plantae/Magnoliophyta/Magnoliopsida/Dipsacales/Dipsacaceae/Scabiosa/Scabiosa japonica/Scabiosa japonica breviligula/README.md",
"mode": "33188",
"license": "apache-2.0",
"language": [],
"symlink_target": ""
} |
[NativeBase](https://nativebase.io/) makes use of <code>List</code> to design Forms that include group of related input components. Include any combination of NativeBase components to make up your form.<br/>
Input is a NativeBase component built on top of React Native's <code>TextInput</code>. A foundational component for inputting text into the app via a keyboard. Item component wrapper around it that apply specific styles.<br />
Props provide configurability for several features, such as auto-correction, auto-capitalization, placeholder text, and different keyboard types, such as a numeric keypad.<br />
Provides a number of attributes that follows styling and interaction guidelines for each platform, so that they are intuitive for users to interact with.<br />
Replacing Component:
* <b>Form</b>: React Native [View](https://facebook.github.io/react-native/docs/view.html)
* <b>Item</b>: React Native [TouchableOpacity](http://facebook.github.io/react-native/docs/touchableopacity.html)
* <b>Input</b>: React Native [TextInput](http://facebook.github.io/react-native/docs/textinput.html)
* <b>Label</b>: React Native [Text](http://facebook.github.io/react-native/docs/text.html)
**Contents:**
* [Fixed Label](Components.md#fixed-label-headref)
* [Inline Label](Components.md#inline-label-headref)
* [Floating Label](Components.md#floating-label-headref)
* [Stacked Label](Components.md#stacked-label-headref)
* [Picker Input](Components.md#picker-input-headref)
* [Regular Textbox](Components.md#regular-textbox-headref)
* [Underlined Textbox](Components.md#underlined-textbox-headref)
* [Rounded Textbox](Components.md#rounded-textbox-headref)
* [Icon Textbox](Components.md#icon-textbox-headref)
* [Success Input Textbox](Components.md#success-textbox-headref)
* [Error Input Textbox](Components.md#error-textbox-headref)
* [Disabled Textbox](Components.md#disabled-textbox-headref)
* [Textarea](Components.md#textarea-textbox-headref)
![Preview ios Form](https://github.com/GeekyAnts/NativeBase-KitchenSink/raw/v2.6.1/screenshots/ios/input-placeholder.png)
![Preview android Form](https://github.com/GeekyAnts/NativeBase-KitchenSink/raw/v2.6.1/screenshots/android/input-placeholder.png)
*Syntax*
{% codetabs name="React Native", type="js" -%}
import React, { Component } from 'react';
import { Container, Header, Content, Form, Item, Input } from 'native-base';
export default class FormExample extends Component {
render() {
return (
<Container>
<Header />
<Content>
<Form>
<Item>
<Input placeholder="Username" />
</Item>
<Item last>
<Input placeholder="Password" />
</Item>
</Form>
</Content>
</Container>
);
}
}
{%- language name="Vue Native", type="vue" -%}
<template>
<nb-container>
<nb-header />
<nb-content>
<nb-form>
<nb-item>
<nb-input placeholder="Username" />
</nb-item>
<nb-item last>
<nb-input placeholder="Password" />
</nb-item>
</nb-form>
</nb-content>
</nb-container>
</template>
{%- endcodetabs %}
<br />
**Configuration**
<table class = "table table-bordered">
<thead>
<tr>
<th>Property</th>
<th>Default</th>
<th>Option</th>
<th width="50%">
Description
</th>
</tr>
</thead>
<tbody>
<tr>
<td>fixedLabel</td>
<td>true</td>
<td>boolean</td>
<td>
Label is fixed to the left of Input and does not hide when text is entered.
</td>
</tr>
<tr>
<td>floatingLabel</td>
<td>true</td>
<td>boolean</td>
<td>
Label that animates upward when input is selected and animates downward when input is erased.
</td>
</tr>
<tr>
<td>inlineLabel</td>
<td> - </td>
<td>boolean</td>
<td>
Label placed to the left of input element and does not hide when text is entered. This can also be used along with placeholder.
</td>
</tr>
<tr>
<td>stackedLabel</td>
<td> - </td>
<td> - </td>
<td>
Places the label on top of input element which appears like a stack. This can also be used along with placeholder.
</td>
</tr>
<tr>
<td>bordered</td>
<td> - </td>
<td> - </td>
<td>
Includes border with the textbox
</td>
</tr>
<tr>
<td>rounded</td>
<td> - </td>
<td> - </td>
<td>
Includes rounded border with the textbox.
</td>
</tr>
<tr>
<td>regular</td>
<td> - </td>
<td> - </td>
<td>
Includes rectangular border with the textbox.
</td>
</tr>
<tr>
<td>underline</td>
<td> true </td>
<td> - </td>
<td>
Includes underline border with the textbox
</td>
</tr>
<tr>
<td>disabled</td>
<td> - </td>
<td> - </td>
<td>
Disables inputting data
</td>
</tr>
<tr>
<td>placeholderLabel</td>
<td> - </td>
<td> - </td>
<td>
Renders the same way the TextInput does with the form styling of NativeBase
</td>
</tr>
<tr>
<td>placeholder</td>
<td> - </td>
<td> - </td>
<td>
String that renders before text input is entered
</td>
</tr>
<tr>
<td>placeholderTextColor</td>
<td> - </td>
<td> - </td>
<td>
Color of the Input placeholder
</td>
</tr>
<tr>
<td>last</td>
<td> - </td>
<td> - </td>
<td>
Styles last Item of the Form
</td>
</tr>
<tr>
<td>error</td>
<td> - </td>
<td> - </td>
<td>
Border color of textbox for invalid input
</td>
</tr>
<tr>
<td>success</td>
<td> - </td>
<td> - </td>
<td>
Border color of textbox for valid input
</td>
</tr>
<tr>
<td>picker</td>
<td> - </td>
<td> - </td>
<td>
Styles picker field with Input
</td>
</tr>
</tbody>
</table>
<p>
<div id="" class="mobileDevice" style="background: url("https://docs.nativebase.io/docs/assets/iosphone.png") no-repeat; padding: 63px 20px 100px 15px; width: 292px; height: 600px;margin:0 auto;float:none;">
<img src="https://github.com/GeekyAnts/NativeBase-KitchenSink/raw/v2.6.1/screenshots/ios/input-placeholder.png" alt="" style="display:block !important" />
</div>
</p>
<br />
**Note:** Form in NativeBase is just a wrapper around the inputs and hence has no <code>onSubmit</code> function.<br /><br />
| {
"content_hash": "5bde19061a8e8551b4bef2acd335a9fb",
"timestamp": "",
"source": "github",
"line_count": 225,
"max_line_length": 226,
"avg_line_length": 35.84444444444444,
"alnum_prop": 0.4917544947303162,
"repo_name": "GeekyAnts/native-base-docs",
"id": "45ad064c70a9a20f8a57a55a7f71b0c8a9914b1a",
"size": "8074",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "docs/components/form/Form.md",
"mode": "33261",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "49047"
},
{
"name": "HTML",
"bytes": "2127250"
},
{
"name": "JavaScript",
"bytes": "69529"
}
],
"symlink_target": ""
} |
use dfa::Dfa;
use error::Error;
use itertools::Itertools;
use look::Look;
use nfa::{Accept, Nfa, NoLooks, State, StateIdx, StateSet};
use num_traits::PrimInt;
use range_map::{Range, RangeMap, RangeMultiMap};
use std::{char, u8, usize};
use std::cmp::max;
use std::collections::{HashMap, HashSet};
use std::fmt::Debug;
use std::marker::PhantomData;
use std::mem::swap;
use utf8_ranges::{Utf8Range, Utf8Sequence, Utf8Sequences};
// This provides a more compact way of representing UTF-8 sequences.
//
// A sequence of bytes belongs to this set if its first byte is in `head[0]`, its second byte is
// in `head[1]`, etc., and its last byte belongs to one of the ranges in `last_byte`.
//
// This representation is handy for making NFAs because compared to the representation in
// `Utf8Sequences`, it adds many fewer states. Basically, we are doing some crude minimization
// before creating the states.
struct MergedUtf8Sequences {
pub head: Vec<Utf8Range>,
pub last_byte: Vec<Utf8Range>,
}
// Returns this range as a pair of chars, or none if this is an empty range.
fn to_char_pair(r: Range<u32>) -> Option<(char, char)> {
// Round up self.start to the nearest legal codepoint.
let start = if r.start > 0xD7FF && r.start < 0xE000 {
0xE000
} else {
r.start
};
// Round down self.end.
let end = if r.end > 0x10FFFF {
0x10FFFF
} else if r.end < 0xE000 && r.end > 0xD7FF {
0xD7FF
} else {
r.end
};
if start > end {
None
} else {
Some((char::from_u32(start).unwrap(), char::from_u32(end).unwrap()))
}
}
impl MergedUtf8Sequences {
// Panics if not all the input sequences have the same leading byte ranges.
fn merge<I>(iter: I) -> MergedUtf8Sequences where I: Iterator<Item=Utf8Sequence> {
let mut head = Vec::new();
let mut last_byte = Vec::new();
for seq in iter {
let len = seq.len();
let h = &seq.as_slice()[..len-1];
if head.is_empty() {
head.extend_from_slice(h);
} else if &head[..] != h {
panic!("invalid sequences to merge");
}
last_byte.push(seq.as_slice()[len-1]);
}
MergedUtf8Sequences {
head: head,
last_byte: last_byte,
}
}
fn from_sequences<'a, I>(iter: I) -> Box<Iterator<Item=MergedUtf8Sequences> + 'a>
where I: Iterator<Item=Utf8Sequence> + 'a {
fn head(u: &Utf8Sequence) -> Vec<Utf8Range> {
let len = u.len();
u.as_slice()[..len-1].to_owned()
}
Box::new(iter
.group_by(head)
.into_iter()
.map(|(_, seqs)| MergedUtf8Sequences::merge(seqs.into_iter())))
}
fn from_ranges<'a, I>(iter: I) -> Box<Iterator<Item=MergedUtf8Sequences> + 'a>
where I: Iterator<Item=Range<u32>> + 'a {
MergedUtf8Sequences::from_sequences(
iter.filter_map(to_char_pair)
.flat_map(|r| Utf8Sequences::new(r.0, r.1)))
}
fn num_bytes(&self) -> u8 {
(self.head.len() + 1) as u8
}
}
// Creates a byte-based Dfa that matches all the chars in `look.as_set()`.
fn make_char_dfa(look: Look) -> Dfa<(Look, u8)> {
let mut nfa: Nfa<u32, NoLooks> = Nfa::with_capacity(2);
nfa.add_state(Accept::Never);
nfa.add_look_ahead_state(look, 1, 0);
// TODO: shouldn't adding both Full and Boundary be redundant?
nfa.init.push((Look::Full, 0));
nfa.init.push((Look::Boundary, 0));
nfa.states[0].consuming
= RangeMultiMap::from_vec(look.as_set().ranges().map(|x| (x, 1)).collect());
// These unwraps are OK because the only failures are caused by having too many states.
nfa.byte_me(usize::MAX).unwrap()
.determinize(usize::MAX).unwrap()
.optimize()
}
// Creates a byte-based Dfa that matches backwards all the chars in `look.as_set()`.
fn make_rev_char_dfa(look: Look) -> Dfa<(Look, u8)> {
let mut nfa: Nfa<u8, NoLooks> = Nfa::with_capacity(0); // TODO: better capacity
nfa.add_state(Accept::Never);
nfa.init.push((Look::Full, 0));
nfa.init.push((Look::Boundary, 0));
// This is more-or-less C&P from add_utf8_sequence.
for seq in MergedUtf8Sequences::from_ranges(look.as_set().ranges()) {
let mut last_state = nfa.add_state(Accept::Never);
for range in &seq.last_byte {
nfa.add_transition(0, last_state, Range::new(range.start, range.end));
}
for range in seq.head.iter().rev() {
let cur_state = nfa.add_state(Accept::Never);
nfa.add_transition(last_state, cur_state, Range::new(range.start, range.end));
last_state = cur_state;
}
nfa.states[last_state].accept = Accept::Always;
nfa.states[last_state].accept_look = look;
nfa.states[last_state].accept_state = 0;
nfa.states[last_state].accept_tokens = seq.num_bytes();
}
// This unwrap is OK because the only failures are caused by having too many states.
nfa.determinize(usize::MAX).unwrap()
.optimize()
}
// We cache optimized Dfas for the expensive looks. See `Nfa<u8, NoLooks>::add_min_utf8_sequences`
// for an explanation.
lazy_static! {
static ref WORD_CHAR_DFA: Dfa<(Look, u8)> = make_char_dfa(Look::WordChar);
static ref NOT_WORD_CHAR_DFA: Dfa<(Look, u8)> = make_char_dfa(Look::NotWordChar);
static ref REV_WORD_CHAR_DFA: Dfa<(Look, u8)> = make_rev_char_dfa(Look::WordChar);
static ref REV_NOT_WORD_CHAR_DFA: Dfa<(Look, u8)> = make_rev_char_dfa(Look::NotWordChar);
}
impl<Tok: Debug + PrimInt> Nfa<Tok, NoLooks> {
// Returns the set of all states that can be reached from some initial state.
fn reachable_from<I>(&self, states: I) -> HashSet<StateIdx> where I: Iterator<Item=StateIdx> {
let mut active: HashSet<StateIdx> = states.collect();
let mut next_active: HashSet<StateIdx> = HashSet::new();
let mut ret = active.clone();
while !active.is_empty() {
for &s in &active {
for &(_, t) in self.states[s].consuming.ranges_values() {
if !ret.contains(&t) {
ret.insert(t);
next_active.insert(t);
}
}
}
swap(&mut active, &mut next_active);
next_active.clear();
}
ret
}
// Reverses this Nfa, but only the transitions (i.e. doesn't do anything about initial and
// final states).
fn reversed_simple(&self) -> Nfa<Tok, NoLooks> {
let rev_transitions = self.reversed_transitions();
let mut ret: Nfa<Tok, NoLooks> = Nfa::with_capacity(self.states.len());
for trans in rev_transitions {
let idx = ret.add_state(Accept::Never);
ret.states[idx].consuming = trans;
}
ret
}
// Returns the set of all states that can be reached from an initial state and that can reach
// some accepting state.
fn reachable_states(&self) -> HashSet<StateIdx> {
let init_states = self.init.iter().map(|pair| pair.1);
let final_states = self.states.iter().enumerate()
.filter(|&(_, state)| state.accept != Accept::Never)
.map(|(idx, _)| idx);
let forward = self.reachable_from(init_states);
let backward = self.reversed_simple().reachable_from(final_states);
forward.intersection(&backward).cloned().collect()
}
/// Optimizes this Nfa by removing all states that cannot be reached from an initial state
/// and all states that cannot lead to an accepting state.
pub fn trim_unreachable(&mut self) {
let reachable = self.reachable_states();
let mut old_states = Vec::new();
swap(&mut self.states, &mut old_states);
let mut old_to_new = vec![None; old_states.len()];
let (new_to_old, new_states): (Vec<_>, Vec<State<Tok>>) = old_states.into_iter()
.enumerate()
.filter(|&(i, _)| reachable.contains(&i))
.unzip();
self.states = new_states;
for (new, &old) in new_to_old.iter().enumerate() {
old_to_new[old] = Some(new);
}
self.map_states(|s| old_to_new[s]);
}
// Returns an `Accept` that will accept whenever anything in `states` would accept.
fn accept_union(&self, states: &StateSet) -> Accept {
states.iter().map(|s| self.states[*s].accept).max().unwrap_or(Accept::Never)
}
}
impl Nfa<u32, NoLooks> {
/// Converts this `Nfa` into one that consumes the input byte-by-byte.
pub fn byte_me(self, max_states: usize) -> ::Result<Nfa<u8, NoLooks>> {
let mut ret = Nfa::<u8, NoLooks> {
states: self.states.iter().map(|s| State {
accept: s.accept,
accept_look: s.accept_look,
accept_state: s.accept_state,
accept_tokens: s.accept_tokens,
consuming: RangeMultiMap::new(),
looking: Vec::new(),
}).collect(),
init: self.init,
phantom: PhantomData,
};
for (i, state) in self.states.into_iter().enumerate() {
// Group transitions by the target state, and add them in batches. Most of the time, we
// can merge a bunch of Utf8Sequences before adding them, which saves a bunch of
// states.
for (tgt, transitions) in state.consuming.ranges_values().group_by(|x| x.1) {
try!(ret.add_utf8_sequences(i, transitions.into_iter().map(|x| x.0), tgt, max_states));
}
}
Ok(ret)
}
}
impl Nfa<u8, NoLooks> {
/// Converts this `Nfa` into a `Dfa`.
pub fn determinize(&self, max_states: usize) -> ::Result<Dfa<(Look, u8)>> {
Determinizer::determinize(self, max_states, MatchChoice::TransitionOrder, self.init.clone())
}
/// Converts this `Nfa` into a `Dfa`.
///
/// Whenever this `Nfa` matches some text, the `Dfa` also will. But if this `Nfa` has multiple
/// possible endpoints for a match then the returned `Dfa` is only guaranteed to match the
/// longest one.
pub fn determinize_longest(&self, max_states: usize) -> ::Result<Dfa<(Look, u8)>> {
Determinizer::determinize(self, max_states, MatchChoice::LongestMatch, self.init.clone())
}
/// Returns the reversal of this `Nfa`.
///
/// If `self` matches some string of bytes, then the return value of this method will match
/// the same strings of bytes reversed.
///
/// Note that this loses information about match priorities.
pub fn reverse(&self, max_states: usize) -> ::Result<Nfa<u8, NoLooks>> {
let mut ret = self.reversed_simple();
// Turn our initial states into ret's accepting states.
for &(look, i) in &self.init {
match look {
Look::Full => {
ret.states[i].accept = Accept::Always;
ret.states[i].accept_look = Look::Full;
},
Look::Boundary => {
ret.states[i].accept = max(ret.states[i].accept, Accept::AtEoi);
ret.states[i].accept_look = max(ret.states[i].accept_look, Look::Boundary);
},
Look::NewLine => {
let accept_state = ret.add_look_ahead_state(Look::NewLine, 1, i);
ret.add_transition(i, accept_state, Range::new(b'\n', b'\n'));
ret.states[i].accept = max(ret.states[i].accept, Accept::AtEoi);
ret.states[i].accept_look = max(ret.states[i].accept_look, Look::Boundary);
},
Look::WordChar | Look::NotWordChar => {
// It would make more sense to put this outside the loop, but having it inside
// prevents a deadlock: constructing REV_*_DFA ends up calling reverse(), but
// with no look-ahead so it never gets inside this loop.
let dfa: &Dfa<_> = if look == Look::WordChar {
&REV_WORD_CHAR_DFA
} else {
ret.states[i].accept = max(ret.states[i].accept, Accept::AtEoi);
ret.states[i].accept_look = max(ret.states[i].accept_look, Look::Boundary);
&REV_NOT_WORD_CHAR_DFA
};
let accept_state = ret.add_look_ahead_state(look, 1, i);
try!(ret.add_min_utf8_sequences(i, dfa, accept_state, max_states));
},
Look::Empty => {
panic!("Empty cannot be an init look");
},
}
}
// Turn our accepting states into ret's initial states.
ret.init.clear();
for st in &self.states {
if st.accept != Accept::Never {
ret.init.push((st.accept_look, st.accept_state));
}
}
Ok(ret)
}
/// Can we accept immediately if the beginning of the input matches `look`?
fn init_accept(&self, look: Look) -> Accept {
let set = self.init.iter()
.filter(|pair| look <= pair.0)
.map(|pair| pair.1)
.collect::<Vec<_>>();
self.accept_union(&set)
}
/// This essentially modifies `self` by adding a `^.*` at the beginning.
///
/// The result is actually a little bit different, because `.` matches a whole code point,
/// whereas the `^.*` that we add works at the byte level.
pub fn anchor(mut self, max_states: usize) -> ::Result<Nfa<u8, NoLooks>> {
let loop_accept = self.init_accept(Look::Full);
let loop_state = self.add_state(loop_accept);
let init_accept = self.init_accept(Look::Boundary);
let init_state = self.add_state(init_accept);
// Swap out init so that we can iterate over it while modifying `self`.
let mut init = Vec::new();
swap(&mut init, &mut self.init);
for &(look, st_idx) in &init {
if look.allows_eoi() {
// TODO: shouldn't need to clone here.
for &(range, target) in self.states[st_idx].consuming.clone().ranges_values() {
self.add_transition(init_state, target, range);
}
}
match look {
Look::Boundary => {},
Look::Full => {
for &(range, target) in self.states[st_idx].consuming.clone().ranges_values() {
self.add_transition(loop_state, target, range);
}
},
Look::NewLine => {
self.add_transition(init_state, st_idx, Range::new(b'\n', b'\n'));
self.add_transition(loop_state, st_idx, Range::new(b'\n', b'\n'));
},
Look::WordChar | Look::NotWordChar => {
let dfa: &Dfa<_> =
if look == Look::WordChar { &WORD_CHAR_DFA } else { &NOT_WORD_CHAR_DFA };
try!(self.add_min_utf8_sequences(loop_state, dfa, st_idx, max_states));
try!(self.add_min_utf8_sequences(init_state, dfa, st_idx, max_states));
},
Look::Empty => {
panic!("Cannot start with an empty look");
},
}
// Once we've found an init state that accepts immediately, don't look for any others
// (since any matches that we find starting from them are lower priority that the one
// we've found already). This check is *almost* unnecessary, since similar pruning
// happens when we turn the NFA into a DFA. The important case that needs to be handled
// here is the case that a high-priority init state has no transitions out of it. Such
// a state will be completely removed by this function, and so we need to acknowledge
// its existence here.
if self.states[st_idx].accept == Accept::Always {
break;
}
}
// Wire up the initial and loop states, but only if they aren't accepting. That's because
// if they are accepting then the accept should take priority over the transition (since
// making the transition means that we are searching for a match that starts later).
if init_accept != Accept::Always {
self.add_transition(init_state, loop_state, Range::full());
}
if loop_accept != Accept::Always {
self.add_transition(loop_state, loop_state, Range::full());
}
// The new Nfa is only allowed to start at the beginning of the input, and only at the new
// initial state.
self.init.push((Look::Boundary, init_state));
self.trim_unreachable();
Ok(self)
}
// This does the same thing as add_utf8_sequences, but it gets the transitions from a dfa,
// which should have zero as its only starting state, and for which every accepting state
// should be Accept::Always.
//
// This is probably used in conjunction with make_char_dfa, which ends up having the same
// effect as add_utf8_sequences, but adds fewer states.
fn add_min_utf8_sequences(
&mut self,
start_state: StateIdx,
dfa: &Dfa<(Look, u8)>,
end_state: StateIdx,
max_states: usize,
) -> ::Result<()> {
let offset = self.states.len();
// If end_accept is true, then it isn't actually important that we end in state
// `end_state`: we can create a new look_ahead state to end in.
let end_accept = self.states[end_state].accept_tokens > 0;
if self.states.len() + dfa.num_states() > max_states {
return Err(Error::TooManyStates);
}
for _ in 0..dfa.num_states() {
self.add_state(Accept::Never);
}
for d_idx in 0..dfa.num_states() {
let n_src = if d_idx == 0 { start_state } else { d_idx + offset };
for &(range, d_tgt) in dfa.transitions(d_idx).ranges_values() {
let n_tgt = if dfa.accept(d_tgt) == &Accept::Always && !end_accept {
end_state
} else {
let n_tgt = d_tgt + offset;
self.states[n_tgt].accept = *dfa.accept(d_tgt);
if let Some(&(look, bytes)) = dfa.ret(d_tgt) {
self.states[n_tgt].accept_look = look;
self.states[n_tgt].accept_state = start_state;
self.states[n_tgt].accept_tokens = bytes;
}
n_tgt
};
self.add_transition(n_src, n_tgt, range);
}
}
Ok(())
}
// Adds a path from `start_state` to `end_state` for all byte sequences matching `seq`.
//
// If `end_state` is a look-ahead state, makes a new accepting state instead (so that we know
// how many bytes of look-ahead we used).
fn add_utf8_sequence(
&mut self,
start_state: StateIdx,
mut end_state: StateIdx,
seq: MergedUtf8Sequences
) {
let mut last_state = start_state;
for range in &seq.head {
let cur_state = self.add_state(Accept::Never);
self.add_transition(last_state, cur_state, Range::new(range.start, range.end));
last_state = cur_state;
}
if self.states[end_state].accept_tokens > 0 {
let look = self.states[end_state].accept_look;
let acc_state = self.states[end_state].accept_state;
end_state = self.add_look_ahead_state(look, seq.num_bytes(), acc_state);
}
for range in &seq.last_byte {
self.add_transition(last_state, end_state, Range::new(range.start, range.end));
}
}
// Adds a byte path from `start_state` to `end_state` for every char in `ranges`.
fn add_utf8_sequences<I>(
&mut self,
start_state: StateIdx,
ranges: I,
end_state: StateIdx,
max_states: usize
) -> ::Result<()>
where I: Iterator<Item=Range<u32>> {
for m in MergedUtf8Sequences::from_ranges(ranges) {
self.add_utf8_sequence(start_state, end_state, m);
if self.states.len() > max_states {
return Err(Error::TooManyStates);
}
}
Ok(())
}
// Finds the transitions out of the given set of states, as a RangeMap.
fn transition_map(&self, states: &[StateIdx]) -> RangeMap<u8, Vec<usize>> {
let mut transitions = states.into_iter()
.flat_map(|s| self.states[*s].consuming.ranges_values().cloned())
.collect::<RangeMultiMap<u8, StateIdx>>()
.group();
// `scratch` is large enough to be indexed by anything in `elts`. It is full of `false`.
fn uniquify(elts: &mut Vec<StateIdx>, scratch: &mut Vec<bool>) {
elts.retain(|&e| {
let ret = !scratch[e];
scratch[e] = true;
ret
});
// Clean up scratch, so that it is full of `false` again.
for e in elts {
scratch[*e] = false;
}
}
let mut scratch = vec![false; self.num_states()];
for pair in transitions.as_mut_slice() {
uniquify(&mut pair.1, &mut scratch);
}
transitions
}
}
#[derive(PartialEq)]
enum MatchChoice {
TransitionOrder,
LongestMatch,
}
// This contains all the intermediate data structures that we need when turning an `Nfa` into a
// `Dfa`.
struct Determinizer<'a> {
nfa: &'a Nfa<u8, NoLooks>,
dfa: Dfa<(Look, u8)>,
state_map: HashMap<StateSet, StateIdx>,
active_states: Vec<StateSet>,
max_states: usize,
match_choice: MatchChoice,
}
impl<'a> Determinizer<'a> {
// Turns an Nfa into an almost-equivalent (up to the difference between shortest and longest
// matches) Dfa.
//
// `init` is a vector of length Look::num(). Each entry gives a set of initial states that
// will be turned into the initial states of the dfa.
fn determinize(nfa: &Nfa<u8, NoLooks>,
max_states: usize,
match_choice: MatchChoice,
init: Vec<(Look, StateIdx)>) -> ::Result<Dfa<(Look, u8)>> {
let mut det = Determinizer::new(nfa, max_states, match_choice);
try!(det.run(init));
Ok(det.dfa)
}
fn new(nfa: &'a Nfa<u8, NoLooks>,
max_states: usize,
match_choice: MatchChoice) -> Determinizer<'a> {
Determinizer {
nfa: nfa,
dfa: Dfa::new(),
state_map: HashMap::new(),
active_states: Vec::new(),
max_states: max_states,
match_choice: match_choice,
}
}
// Checks whether we should accept in the given set of states.
//
// Returns a tuple: the first element says when we accept, the second says what look-ahead (if
// any) led to us accepting, and the third says how many bytes of look-ahead we needed before
// knowing that we can accept.
//
// There is one annoying corner case: there could be two states in the set `s` with different
// values of `accept_tokens`, where the higher priority state says `Accept::AtEoi` and the
// lower priority state says `Accept::Always`. In this case, we return `(AtEoi, look, bytes)`
// where `look` and `bytes` come from the lower priority state. This doesn't lose any
// information, since if a state says `Accept::AtEoi` then its `accept_look` and
// `accept_tokens` are guaranteed to be `Boundary` and `0`.
fn accept(&self, s: &[StateIdx]) -> (Accept, Look, u8) {
let mut accept_states = s.iter().cloned()
.filter(|i| self.nfa.states[*i].accept != Accept::Never);
let mut accept_always_states = s.iter().cloned()
.filter(|i| self.nfa.states[*i].accept == Accept::Always);
let (first_accept, other_accept) = if self.match_choice == MatchChoice::TransitionOrder {
(accept_states.next(), accept_always_states.next())
} else {
(accept_states.min_by_key(|i| self.nfa.states[*i].accept_tokens),
accept_always_states.min_by_key(|i| self.nfa.states[*i].accept_tokens))
};
// Returns the intersection of state.accept_look over all states in s that accept
// unconditionally and have the given number of look-ahead bytes.
let look_intersection = |toks: u8| {
s.iter().cloned()
.filter(|i| self.nfa.states[*i].accept == Accept::Always)
.filter(|i| self.nfa.states[*i].accept_tokens == toks)
.fold(Look::Full, |x, y| x.intersection(&self.nfa.states[y].accept_look))
};
if let Some(first_accept) = first_accept {
let st = &self.nfa.states[first_accept];
if st.accept == Accept::AtEoi {
// Check if there is a lower-priority Accept::Always.
if let Some(other_accept) = other_accept {
let other_st = &self.nfa.states[other_accept];
if other_st.accept_tokens > 0 {
let look = look_intersection(other_st.accept_tokens);
return (Accept::AtEoi, look, other_st.accept_tokens);
}
}
(Accept::AtEoi, Look::Boundary, 0)
} else {
(Accept::Always, look_intersection(st.accept_tokens), st.accept_tokens)
}
} else {
// There are no accepting states.
(Accept::Never, Look::Empty, 0)
}
}
// Tries to add a new state to the Dfa.
//
// If the state already exists, returns the index of the old one. If there are too many states,
// returns an error.
fn add_state(&mut self, mut s: StateSet) -> ::Result<StateIdx> {
// When we choose our matches by transition order, discard any states that have lower
// priority than the best match we've found.
if self.match_choice == MatchChoice::TransitionOrder {
if let Some(accept_idx) = s.iter().position(|&i| self.nfa.states[i].accept == Accept::Always) {
s.truncate(accept_idx + 1);
}
}
if self.state_map.contains_key(&s) {
Ok(*self.state_map.get(&s).unwrap())
} else if self.dfa.num_states() >= self.max_states {
Err(Error::TooManyStates)
} else {
let (acc, look, bytes_ago) = self.accept(&s);
let ret = if acc != Accept::Never { Some ((look, bytes_ago)) } else { None };
let new_state = self.dfa.add_state(acc, ret);
self.active_states.push(s.clone());
self.state_map.insert(s, new_state);
Ok(new_state)
}
}
// Creates a deterministic automaton representing the same language as our `nfa`.
// Puts the new Dfa in self.dfa.
fn run(&mut self, init: Vec<(Look, StateIdx)>) -> ::Result<()> {
if self.nfa.states.is_empty() {
return Ok(());
}
for &look in Look::all() {
let init_states: StateSet = init.iter().cloned()
.filter(|&(x, _)| look == x)
.map(|(_, y)| y)
.collect();
if !init_states.is_empty() {
let new_state_idx = try!(self.add_state(init_states));
self.dfa.init[look.as_usize()] = Some(new_state_idx);
}
}
while !self.active_states.is_empty() {
let state = self.active_states.pop().unwrap();
// This unwrap is ok because anything in active_states must also be in state_map.
let state_idx = *self.state_map.get(&state).unwrap();
let trans = self.nfa.transition_map(&state);
let mut dfa_trans = Vec::new();
for &(range, ref target) in trans.ranges_values() {
let target_idx = try!(self.add_state(target.clone()));
dfa_trans.push((range, target_idx));
}
self.dfa.set_transitions(state_idx, dfa_trans.into_iter().collect());
}
Ok(())
}
}
#[cfg(test)]
mod tests {
use look::Look;
use dfa::Dfa;
use nfa::{Accept, Nfa, NoLooks};
use nfa::tests::{re_nfa, trans_nfa, trans_range_nfa};
use range_map::Range;
use std::usize;
fn re_nfa_anchored(re: &str) -> Nfa<u8, NoLooks> {
re_nfa(re).byte_me(usize::MAX).unwrap().anchor(usize::MAX).unwrap()
}
fn re_dfa(re: &str) -> Dfa<(Look, u8)> {
re_nfa(re).byte_me(usize::MAX).unwrap().determinize(usize::MAX).unwrap()
}
#[test]
fn anchor_simple() {
let nfa = re_nfa_anchored("a");
let mut target = trans_range_nfa(3, &[(2, 0, Range::new(b'a', b'a')),
(2, 1, Range::full()),
(1, 0, Range::new(b'a', b'a')),
(1, 1, Range::full())]);
target.init.push((Look::Boundary, 2));
target.states[0].accept = Accept::Always;
assert_eq!(nfa, target);
}
#[test]
fn anchor_nl() {
let nfa = re_nfa_anchored(r"(?m)^a");
let mut target = trans_nfa(4, &[(3, 1, 'a'),
(0, 1, 'a'),
(2, 0, '\n'),
(3, 0, '\n')]);
target.init.push((Look::Boundary, 3));
target.states[1].accept = Accept::Always;
let mut target = target.byte_me(usize::MAX).unwrap();
target.states[2].consuming.insert(Range::full(), 2);
target.states[3].consuming.insert(Range::full(), 2);
assert_eq!(nfa, target);
}
#[test]
fn anchor_already_anchored() {
let nfa = re_nfa_anchored("^a");
let mut target = trans_nfa(2, &[(1, 0, 'a')]);
target.init.push((Look::Boundary, 1));
target.states[0].accept = Accept::Always;
assert_eq!(nfa, target);
}
#[test]
fn determinize_pruning() {
assert_eq!(re_dfa("a|aa"), re_dfa("a"));
}
macro_rules! check_rev_inits {
($name:ident, $re:expr, $inits:expr) => {
#[test]
fn $name() {
let rev = re_nfa($re).byte_me(usize::MAX).unwrap().reverse(usize::MAX).unwrap();
println!("{:?}", rev.init);
for &look in Look::all() {
println!("checking look {:?}", look);
if $inits.contains(&look) {
assert!(rev.init.iter().any(|pair| pair.0 == look));
} else {
assert!(!rev.init.iter().any(|pair| pair.0 == look));
}
}
}
};
}
check_rev_inits!(rev_init_simple, "abc", [Look::Full]);
check_rev_inits!(rev_init_boundary, "abc$", [Look::Boundary]);
check_rev_inits!(rev_init_simple_and_boundary, "(abc$|abc)", [Look::Full, Look::Boundary]);
check_rev_inits!(rev_init_new_line, "(?m)abc$", [Look::Boundary, Look::NewLine]);
check_rev_inits!(rev_init_word, r" \b", [Look::WordChar]);
check_rev_inits!(rev_init_not_word, r"abc\b", [Look::Boundary, Look::NotWordChar]);
check_rev_inits!(rev_init_word_or_not_word, r".\b", [Look::Boundary, Look::NotWordChar, Look::WordChar]);
}
| {
"content_hash": "40d4f628a6a82d1253938ec40c35628d",
"timestamp": "",
"source": "github",
"line_count": 793,
"max_line_length": 109,
"avg_line_length": 39.98360655737705,
"alnum_prop": 0.5500678083703914,
"repo_name": "jneem/regex-dfa",
"id": "34d60f945b81673f09a0e44e4fe932fbff6836f6",
"size": "32046",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/nfa/no_looks.rs",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Rust",
"bytes": "235604"
}
],
"symlink_target": ""
} |
import gdb
import sys
import re
from glib_gobject_helper import g_type_to_name, g_type_name_from_instance, \
g_type_to_typenode, g_quark_to_string
if sys.version_info[0] >= 3:
long = int
def is_gst_type(val, klass):
def _is_gst_type(type):
if str(type) == klass:
return True
while type.code == gdb.TYPE_CODE_TYPEDEF:
type = type.target()
if type.code != gdb.TYPE_CODE_STRUCT:
return False
fields = type.fields()
if len(fields) < 1:
return False
first_field = fields[0]
return _is_gst_type(first_field.type)
type = val.type
if type.code != gdb.TYPE_CODE_PTR:
return False
type = type.target()
return _is_gst_type(type)
class GstMiniObjectPrettyPrinter:
"Prints a GstMiniObject instance pointer"
def __init__(self, val):
self.val = val
def to_string(self):
try:
inst = self.val.cast(gdb.lookup_type("GstMiniObject").pointer())
gtype = inst["type"]
name = g_type_to_name(gtype)
return "0x%x [%s]" % (long(self.val), name)
except RuntimeError:
return "0x%x" % long(self.val)
class GstObjectPrettyPrinter:
"Prints a GstObject instance"
def __init__(self, val):
self.val = val
def to_string(self):
try:
name = g_type_name_from_instance(self.val)
if not name:
name = str(self.val.type.target())
if long(self.val) != 0:
inst = self.val.cast(gdb.lookup_type("GstObject").pointer())
inst_name = inst["name"].string()
if inst_name:
name += "|" + inst_name
return ("0x%x [%s]") % (long(self.val), name)
except RuntimeError:
return "0x%x" % long(self.val)
class GstClockTimePrinter:
"Prints a GstClockTime / GstClockTimeDiff"
def __init__(self, val):
self.val = val
def to_string(self):
GST_SECOND = 1000000000
GST_CLOCK_TIME_NONE = 2**64-1
GST_CLOCK_STIME_NONE = -2**63
n = int(self.val)
prefix = ""
invalid = False
if str(self.val.type) == "GstClockTimeDiff":
if n == GST_CLOCK_STIME_NONE:
invalid = True
prefix = "+" if n >= 0 else "-"
n = abs(n)
else:
if n == GST_CLOCK_TIME_NONE:
invalid = True
if invalid:
return str(n) + " [99:99:99.999999999]"
return str(n) + " [%s%u:%02u:%02u.%09u]" % (
prefix,
n / (GST_SECOND * 60 * 60),
(n / (GST_SECOND * 60)) % 60,
(n / GST_SECOND) % 60,
n % GST_SECOND)
def gst_pretty_printer_lookup(val):
if is_gst_type(val, "GstMiniObject"):
return GstMiniObjectPrettyPrinter(val)
if is_gst_type(val, "GstObject"):
return GstObjectPrettyPrinter(val)
if str(val.type) == "GstClockTime" or str(val.type) == "GstClockTimeDiff":
return GstClockTimePrinter(val)
return None
def save_memory_access(fallback):
def _save_memory_access(func):
def wrapper(*args, **kwargs):
try:
return func(*args, **kwargs)
except gdb.MemoryError:
return fallback
return wrapper
return _save_memory_access
def save_memory_access_print(message):
def _save_memory_access_print(func):
def wrapper(*args, **kwargs):
try:
func(*args, **kwargs)
except gdb.MemoryError:
_gdb_write(args[1], message)
return wrapper
return _save_memory_access_print
def _g_type_from_instance(instance):
if long(instance) != 0:
try:
inst = instance.cast(gdb.lookup_type("GTypeInstance").pointer())
klass = inst["g_class"]
gtype = klass["g_type"]
return gtype
except RuntimeError:
pass
return None
def g_inherits_type(val, typename):
if is_gst_type(val, "GstObject"):
gtype = _g_type_from_instance(val)
if gtype is None:
return False
typenode = g_type_to_typenode(gtype)
elif is_gst_type(val, "GstMiniObject"):
mini = val.cast(gdb.lookup_type("GstMiniObject").pointer())
try:
typenode = mini["type"].cast(gdb.lookup_type("TypeNode").pointer())
except gdb.MemoryError:
return False
else:
return False
for i in range(typenode["n_supers"]):
if g_type_to_name(typenode["supers"][i]) == typename:
return True
return False
def gst_is_bin(val):
return g_inherits_type(val, "GstBin")
def _g_array_iter(array, element_type):
if array == 0:
return
try:
item = array["data"].cast(element_type.pointer())
for i in range(int(array["len"])):
yield item[i]
except gdb.MemoryError:
pass
def _g_value_get_value(val):
typenode = g_type_to_typenode(val["g_type"])
if not typenode:
return None
tname = g_quark_to_string(typenode["qname"])
fname = g_type_to_name(typenode["supers"][int(typenode["n_supers"])])
if fname in ("gchar", "guchar", "gboolean", "gint", "guint", "glong",
"gulong", "gint64", "guint64", "gfloat", "gdouble",
"gpointer", "GFlags"):
try:
t = gdb.lookup_type(tname).pointer()
except RuntimeError:
t = gdb.lookup_type(fname).pointer()
elif fname == "gchararray":
t = gdb.lookup_type("char").pointer().pointer()
elif fname == "GstBitmask":
t = gdb.lookup_type("guint64").pointer()
elif fname == "GstFlagSet":
t = gdb.lookup_type("guint").pointer().pointer()
return val["data"].cast(t)
elif fname == "GstFraction":
t = gdb.lookup_type("gint").pointer().pointer()
return val["data"].cast(t)
elif fname == "GstFractionRange":
t = gdb.lookup_type("GValue").pointer().pointer()
elif fname == "GstValueList":
t = gdb.lookup_type("GArray").pointer().pointer()
elif fname in ("GBoxed", "GObject"):
try:
t = gdb.lookup_type(tname).pointer().pointer()
except RuntimeError:
t = gdb.lookup_type(tname).pointer().pointer()
else:
return val["data"]
return val["data"].cast(t).dereference()
def _gdb_write(indent, text):
gdb.write("%s%s\n" % (" " * indent, text))
class GdbCapsFeatures:
def __init__(self, val):
self.val = val
def size(self):
if long(self.val) == 0:
return 0
return int(self.val["array"]["len"])
def items(self):
if long(self.val) == 0:
return
for q in _g_array_iter(self.val["array"], gdb.lookup_type("GQuark")):
yield q
def __eq__(self, other):
if self.size() != other.size():
return False
a1 = list(self.items())
a2 = list(other.items())
for item in a1:
if item not in a2:
return False
return True
def __str__(self):
if long(self.val) == 0:
return ""
count = self.size()
if int(self.val["is_any"]) == 1 and count == 0:
return "(ANY)"
if count == 0:
return ""
s = ""
for f in self.items():
ss = g_quark_to_string(f)
if ss != "memory:SystemMemory" or count > 1:
s += ", " if s else ""
s += ss
return s
class GdbGstCaps:
def __init__(self, val):
self.val = val.cast(gdb.lookup_type("GstCapsImpl").pointer())
def size(self):
return int(self.val["array"]["len"])
def items(self):
gdb_type = gdb.lookup_type("GstCapsArrayElement")
for f in _g_array_iter(self.val["array"], gdb_type):
yield(GdbCapsFeatures(f["features"]),
GdbGstStructure(f["structure"]))
def __eq__(self, other):
if self.size() != other.size():
return False
a1 = list(self.items())
a2 = list(other.items())
for i in range(self.size()):
if a1[i] != a2[i]:
return False
return True
def dot(self):
if self.size() == 0:
return "ANY"
s = ""
for (features, structure) in self.items():
s += structure.name()
tmp = str(features)
if tmp:
s += "(" + tmp + ")"
s += "\\l"
if structure.size() > 0:
s += "\\l".join(structure.value_strings(" %18s: %s")) + "\\l"
return s
@save_memory_access_print("<inaccessible memory>")
def print(self, indent, prefix=""):
items = list(self.items())
if len(items) != 1:
_gdb_write(indent, prefix)
prefix = ""
for (features, structure) in items:
s = "%s %s" % (prefix, structure.name())
tmp = str(features)
if tmp:
s += "(" + tmp + ")"
_gdb_write(indent, s)
for val in structure.value_strings("%s: %s", False):
_gdb_write(indent+1, val)
return s
class GdbGValue:
def __init__(self, val):
self.val = val
def fundamental_typename(self):
typenode = g_type_to_typenode(self.val["g_type"])
if not typenode:
return None
return g_type_to_name(typenode["supers"][int(typenode["n_supers"])])
def value(self):
return _g_value_get_value(self.val)
def __str__(self):
try:
value = self.value()
tname = self.fundamental_typename()
gvalue_type = gdb.lookup_type("GValue")
if tname == "GstFraction":
v = "%d/%d" % (value[0], value[1])
elif tname == "GstBitmask":
v = "0x%016x" % long(value)
elif tname == "gboolean":
v = "false" if int(value) == 0 else "true"
elif tname == "GstFlagSet":
v = "%x:%x" % (value[0], value[1])
elif tname == "GstIntRange":
rmin = int(value[0]["v_uint64"]) >> 32
rmax = int(value[0]["v_uint64"]) & 0xffffffff
step = int(value[1]["v_int"])
if step == 1:
v = "[ %d, %d ]" % (rmin, rmax)
else:
v = "[ %d, %d, %d ]" % (rmin*step, rmax*step, step)
elif tname == "GstFractionRange":
v = "[ %s, %s ]" % (GdbGValue(value[0]), GdbGValue(value[1]))
elif tname in ("GstValueList", "GstValueArray"):
if gvalue_type.fields()[1].type == value.type:
gdb_type = gdb.lookup_type("GArray").pointer()
value = value[0]["v_pointer"].cast(gdb_type)
v = "<"
for l in _g_array_iter(value, gvalue_type):
v += " " if v == "<" else ", "
v += str(GdbGValue(l))
v += " >"
else:
try:
v = value.string()
except RuntimeError:
# it is not a string-like type
if gvalue_type.fields()[1].type == value.type:
# don't print the raw GValue union
v = "<unkown type: %s>" % tname
else:
v = str(value)
except gdb.MemoryError:
v = "<inaccessible memory at 0x%x>" % int(self.val)
return v
def __eq__(self, other):
return self.val == other.val
class GdbGstStructure:
def __init__(self, val):
self.val = val.cast(gdb.lookup_type("GstStructureImpl").pointer())
@save_memory_access("<inaccessible memory>")
def name(self):
return g_quark_to_string(self.val["s"]["name"])
@save_memory_access(0)
def size(self):
return int(self.val["fields"]["len"])
def values(self):
for f in _g_array_iter(self.val["fields"],
gdb.lookup_type("GstStructureField")):
key = g_quark_to_string(f["name"])
value = GdbGValue(f["value"])
yield(key, value)
def value(self, key):
for (k, value) in self.values():
if k == key:
return value
raise KeyError(key)
def __eq__(self, other):
if self.size() != other.size():
return False
a1 = list(self.values())
a2 = list(other.values())
for (key, value) in a1:
if (key, value) not in a2:
return False
return True
def value_strings(self, pattern, elide=True):
s = []
for (key, value) in self.values():
v = str(value)
if elide and len(v) > 25:
if v[0] in "[(<\"":
v = v[:20] + "... " + v[-1:]
else:
v = v[:22] + "..."
s.append(pattern % (key, v))
return s
@save_memory_access_print("<inaccessible memory>")
def print(self, indent, prefix=None):
if prefix is not None:
_gdb_write(indent, "%s: %s" % (prefix, self.name()))
else:
_gdb_write(indent, "%s:" % (prefix, self.name()))
for (key, value) in self.values():
_gdb_write(indent+1, "%s: %s" % (key, str(value)))
class GdbGstEvent:
def __init__(self, val):
self.val = val.cast(gdb.lookup_type("GstEventImpl").pointer())
@save_memory_access("<inaccessible memory>")
def typestr(self):
t = self.val["event"]["type"]
(event_quarks, _) = gdb.lookup_symbol("event_quarks")
event_quarks = event_quarks.value()
i = 0
while event_quarks[i]["name"] != 0:
if t == event_quarks[i]["type"]:
return event_quarks[i]["name"].string()
i += 1
return None
def structure(self):
return GdbGstStructure(self.val["structure"])
@save_memory_access_print("<inaccessible memory>")
def print(self, indent):
typestr = self.typestr()
if typestr == "caps":
caps = GdbGstCaps(self.structure().value("caps").value())
caps.print(indent, "caps:")
elif typestr == "stream-start":
stream_id = self.structure().value("stream-id").value()
_gdb_write(indent, "stream-start:")
_gdb_write(indent + 1, "stream-id: %s" % stream_id.string())
elif typestr == "segment":
segment = self.structure().value("segment").value()
fmt = str(segment["format"]).split("_")[-1].lower()
_gdb_write(indent, "segment: %s" % fmt)
rate = float(segment["rate"])
applied_rate = float(segment["applied_rate"])
if applied_rate != 1.0:
applied = "(applied rate: %g)" % applied_rate
else:
applied = ""
_gdb_write(indent+1, "rate: %g%s" % (rate, applied))
elif typestr == "tag":
struct = self.structure()
# skip 'GstTagList-'
name = struct.name()[11:]
t = gdb.lookup_type("GstTagListImpl").pointer()
s = struct.value("taglist").value().cast(t)["structure"]
structure = GdbGstStructure(s)
_gdb_write(indent, "tag: %s" % name)
for (key, value) in structure.values():
_gdb_write(indent+1, "%s: %s" % (key, str(value)))
else:
self.structure().print(indent, typestr)
class GdbGstObject:
def __init__(self, klass, val):
self.val = val.cast(klass)
@save_memory_access("<inaccessible memory>")
def name(self):
obj = self.val.cast(gdb.lookup_type("GstObject").pointer())
return obj["name"].string()
def dot_name(self):
ptr = self.val.cast(gdb.lookup_type("void").pointer())
return re.sub('[^a-zA-Z0-9<>]', '_', "%s_%s" % (self.name(), str(ptr)))
def parent(self):
obj = self.val.cast(gdb.lookup_type("GstObject").pointer())
return obj["parent"]
def parent_element(self):
p = self.parent()
if p != 0 and g_inherits_type(p, "GstElement"):
element = p.cast(gdb.lookup_type("GstElement").pointer())
return GdbGstElement(element)
return None
class GdbGstPad(GdbGstObject):
def __init__(self, val):
gdb_type = gdb.lookup_type("GstPad").pointer()
super(GdbGstPad, self).__init__(gdb_type, val)
def __eq__(self, other):
return self.val == other.val
def is_linked(self):
return long(self.val["peer"]) != 0
def peer(self):
return GdbGstPad(self.val["peer"])
def direction(self):
return str(self.val["direction"])
def events(self):
if long(self.val["priv"]) == 0:
return
array = self.val["priv"]["events"]
for ev in _g_array_iter(array, gdb.lookup_type("PadEvent")):
yield GdbGstEvent(ev["event"])
def caps(self):
for ev in self.events():
if ev.typestr() != "caps":
continue
return GdbGstCaps(ev.structure().value("caps").value())
return None
def template_caps(self):
tmp = self.val["padtemplate"]
return GdbGstCaps(tmp["caps"]) if int(tmp) != 0 else None
def mode(self):
m = str(self.val["mode"]).split("_")[-1].lower()
if m in ("push", "pull"):
return m
return None
def pad_type(self):
s = str(self.val["direction"]).split("_")[-1].capitalize()
if g_inherits_type(self.val, "GstGhostPad"):
s += "Ghost"
return s + "Pad"
@save_memory_access_print("Pad(<inaccessible memory>)")
def print(self, indent):
m = ", " + self.mode() if self.mode() else ""
_gdb_write(indent, "%s(%s%s) {" % (self.pad_type(), self.name(), m))
first = True
for ev in self.events():
if first:
_gdb_write(indent+1, "events:")
first = False
ev.print(indent+2)
_gdb_write(indent, "}")
def _dot(self, color, pname, indent):
spc = " " * indent
activation_mode = "-><"
style = "filled,solid"
template = self.val["padtemplate"]
if template != 0:
presence = template["presence"]
if str(presence) == "GST_PAD_SOMETIMES":
style = "filled,dotted"
if str(presence) == "GST_PAD_REQUEST":
style = "filled,dashed"
task_mode = ""
task = self.val["task"]
if long(task) != 0:
task_state = int(task["state"])
if task_state == 0: # started
task_mode = "[T]"
if task_state == 2: # paused
task_mode = "[t]"
f = int(self.val["object"]["flags"])
flags = "B" if f & 16 else "b" # GST_PAD_FLAG_BLOCKED
flags += "F" if f & 32 else "f" # GST_PAD_FLAG_FLUSHING
flags += "B" if f & 16 else "b" # GST_PAD_FLAG_BLOCKING
s = "%s %s_%s [color=black, fillcolor=\"%s\", " \
"label=\"%s%s\\n[%c][%s]%s\", height=\"0.2\", style=\"%s\"];\n" % \
(spc, pname, self.dot_name(), color, self.name(), "",
activation_mode[int(self.val["mode"])], flags, task_mode, style)
return s
def dot(self, indent):
spc = " " * indent
direction = self.direction()
element = self.parent_element()
ename = element.dot_name() if element else ""
s = ""
if g_inherits_type(self.val, "GstGhostPad"):
if direction == "GST_PAD_SRC":
color = "#ffdddd"
elif direction == "GST_PAD_SINK":
color = "#ddddff"
else:
color = "#ffffff"
t = gdb.lookup_type("GstProxyPad").pointer()
other = GdbGstPad(self.val.cast(t)["priv"]["internal"])
if other:
s += other._dot(color, "", indent)
pname = self.dot_name()
other_element = other.parent_element()
other_ename = other_element.dot_name() if other_element else ""
other_pname = other.dot_name()
if direction == "GST_PAD_SRC":
s += "%s%s_%s -> %s_%s [style=dashed, minlen=0]\n" % \
(spc, other_ename, other_pname, ename, pname)
else:
s += "%s%s_%s -> %s_%s [style=dashed, minlen=0]\n" % \
(spc, ename, pname, other_ename, other_pname)
else:
if direction == "GST_PAD_SRC":
color = "#ffaaaa"
elif direction == "GST_PAD_SINK":
color = "#aaaaff"
else:
color = "#cccccc"
s += self._dot(color, ename, indent)
return s
def link_dot(self, indent, element):
spc = " " * indent
peer = self.peer()
peer_element = peer.parent_element()
caps = self.caps()
if not caps:
caps = self.template_caps()
peer_caps = peer.caps()
if not peer_caps:
peer_caps = peer.template_caps()
pname = self.dot_name()
ename = element.dot_name() if element else ""
peer_pname = peer.dot_name()
peer_ename = peer_element.dot_name() if peer_element else ""
if caps and peer_caps and caps == peer_caps:
s = "%s%s_%s -> %s_%s [label=\"%s\"]\n" % \
(spc, ename, pname, peer_ename, peer_pname, caps.dot())
elif caps and peer_caps and caps != peer_caps:
s = "%s%s_%s -> %s_%s [labeldistance=\"10\", labelangle=\"0\", " \
% (spc, ename, pname, peer_ename, peer_pname)
s += "label=\"" + " "*50 + "\", "
if self.direction() == "GST_PAD_SRC":
media_src = caps.dot()
media_dst = peer_caps.dot()
else:
media_src = peer_caps.dot()
media_dst = caps.dot()
s += "taillabel=\"%s\", headlabel=\"%s\"]\n" % \
(media_src, media_dst)
else:
s = "%s%s_%s -> %s_%s\n" % \
(spc, ename, pname, peer_ename, peer_pname)
return s
class GdbGstElement(GdbGstObject):
def __init__(self, val):
gdb_type = gdb.lookup_type("GstElement").pointer()
super(GdbGstElement, self).__init__(gdb_type, val)
self.is_bin = gst_is_bin(self.val)
def __eq__(self, other):
return self.val == other.val
def children(self):
if not self.is_bin:
return
b = self.val.cast(gdb.lookup_type("GstBin").pointer())
link = b["children"]
while link != 0:
yield GdbGstElement(link["data"])
link = link["next"]
def has_pads(self, pad_group="pads"):
return self.val[pad_group] != 0
def pads(self, pad_group="pads"):
link = self.val[pad_group]
while link != 0:
yield GdbGstPad(link["data"])
link = link["next"]
def _state_dot(self):
icons = "~0-=>"
current = int(self.val["current_state"])
pending = int(self.val["pending_state"])
if pending == 0:
# GST_ELEMENT_FLAG_LOCKED_STATE == 16
locked = (int(self.val["object"]["flags"]) & 16) != 0
return "\\n[%c]%s" % (icons[current], "(locked)" if locked else "")
return "\\n[%c] -> [%c]" % (icons[current], icons[pending])
@save_memory_access_print("Element(<inaccessible memory>)")
def print(self, indent):
_gdb_write(indent, "%s(%s) {" %
(g_type_name_from_instance(self.val), self.name()))
for p in self.pads():
p.print(indent+2)
_gdb_write(indent, "}")
def _dot(self, indent=0):
spc = " " * indent
s = "%ssubgraph cluster_%s {\n" % (spc, self.dot_name())
s += "%s fontname=\"Bitstream Vera Sans\";\n" % spc
s += "%s fontsize=\"8\";\n" % spc
s += "%s style=\"filled,rounded\";\n" % spc
s += "%s color=black;\n" % spc
s += "%s label=\"%s\\n%s%s%s\";\n" % \
(spc, g_type_name_from_instance(self.val), self.name(),
self._state_dot(), "")
sink_name = None
if self.has_pads("sinkpads"):
(ss, sink_name) = self._dot_pads(indent+1, "sinkpads",
self.dot_name() + "_sink")
s += ss
src_name = None
if self.has_pads("srcpads"):
(ss, src_name) = self._dot_pads(indent+1, "srcpads",
self.dot_name() + "_src")
s += ss
if sink_name and src_name:
name = self.dot_name()
s += "%s %s_%s -> %s_%s [style=\"invis\"];\n" % \
(spc, name, sink_name, name, src_name)
if gst_is_bin(self.val):
s += "%s fillcolor=\"#ffffff\";\n" % spc
s += self.dot(indent+1)
else:
if src_name and not sink_name:
s += "%s fillcolor=\"#ffaaaa\";\n" % spc
elif not src_name and sink_name:
s += "%s fillcolor=\"#aaaaff\";\n" % spc
elif src_name and sink_name:
s += "%s fillcolor=\"#aaffaa\";\n" % spc
else:
s += "%s fillcolor=\"#ffffff\";\n" % spc
s += "%s}\n\n" % spc
for p in self.pads():
if not p.is_linked():
continue
if p.direction() == "GST_PAD_SRC":
s += p.link_dot(indent, self)
else:
pp = p.peer()
if not g_inherits_type(pp.val, "GstGhostPad") and \
g_inherits_type(pp.val, "GstProxyPad"):
s += pp.link_dot(indent, None)
return s
def _dot_pads(self, indent, pad_group, cluster_name):
spc = " " * indent
s = "%ssubgraph cluster_%s {\n" % (spc, cluster_name)
s += "%s label=\"\";\n" % spc
s += "%s style=\"invis\";\n" % spc
name = None
for p in self.pads(pad_group):
s += p.dot(indent)
if not name:
name = p.dot_name()
s += "%s}\n\n" % spc
return(s, name)
def dot(self, indent):
s = ""
for child in self.children():
try:
s += child._dot(indent)
except gdb.MemoryError:
gdb.write("warning: inaccessible memory in element 0x%x\n" %
long(child.val))
return s
def pipeline_dot(self):
t = g_type_name_from_instance(self.val)
s = "digraph pipeline {\n"
s += " rankdir=LR;\n"
s += " fontname=\"sans\";\n"
s += " fontsize=\"10\";\n"
s += " labelloc=t;\n"
s += " nodesep=.1;\n"
s += " ranksep=.2;\n"
s += " label=\"<%s>\\n%s%s%s\";\n" % (t, self.name(), "", "")
s += " node [style=\"filled,rounded\", shape=box, fontsize=\"9\", " \
"fontname=\"sans\", margin=\"0.0,0.0\"];\n"
s += " edge [labelfontsize=\"6\", fontsize=\"9\", " \
"fontname=\"monospace\"];\n"
s += " \n"
s += " legend [\n"
s += " pos=\"0,0!\",\n"
s += " margin=\"0.05,0.05\",\n"
s += " style=\"filled\",\n"
s += " label=\"Legend\\lElement-States: [~] void-pending, " \
"[0] null, [-] ready, [=] paused, [>] playing\\l" \
"Pad-Activation: [-] none, [>] push, [<] pull\\l" \
"Pad-Flags: [b]locked, [f]lushing, [b]locking, [E]OS; " \
"upper-case is set\\lPad-Task: [T] has started task, " \
"[t] has paused task\\l\",\n"
s += " ];"
s += "\n"
s += self.dot(1)
s += "}\n"
return s
class GstDot(gdb.Command):
"""\
Create a pipeline dot file as close as possible to the output of
GST_DEBUG_BIN_TO_DOT_FILE. This command will find the top-level parent
for the given gstreamer object and create the dot for that element.
Usage: gst-dot <gst-object> <file-name>"""
def __init__(self):
super(GstDot, self).__init__("gst-dot", gdb.COMMAND_DATA)
def invoke(self, arg, from_tty):
self.dont_repeat()
args = gdb.string_to_argv(arg)
if len(args) != 2:
raise Exception("Usage: gst-dot <gst-object> <file>")
value = gdb.parse_and_eval(args[0])
if not value:
raise Exception("'%s' is not a valid object" % args[0])
if value.type.code != gdb.TYPE_CODE_PTR:
value = value.address
if not is_gst_type(value, "GstObject"):
raise Exception("'%s' is not a GstObject" % args[0])
value = value.cast(gdb.lookup_type("GstObject").pointer())
try:
while value["parent"] != 0:
tmp = value["parent"]
# sanity checks to handle memory corruption
if g_inherits_type(value, "GstElement") and \
GdbGstElement(value) not in GdbGstElement(tmp).children():
break
if g_inherits_type(value, "GstPad") and \
GdbGstPad(value) not in GdbGstElement(tmp).pads():
break
value = tmp
except gdb.MemoryError:
pass
if not g_inherits_type(value, "GstElement"):
raise Exception("Toplevel parent is not a GstElement")
value = value.cast(gdb.lookup_type("GstElement").pointer())
dot = GdbGstElement(value).pipeline_dot()
file = open(args[1], "w")
file.write(dot)
file.close()
def complete(self, text, word):
cmd = gdb.string_to_argv(text)
if len(cmd) == 0 or(len(cmd) == 1 and len(word) > 0):
return gdb.COMPLETE_SYMBOL
return gdb.COMPLETE_FILENAME
class GstPrint(gdb.Command):
"""\
Print high-level information for GStreamer objects
Usage gst-print <gstreamer-object>"""
def __init__(self):
super(GstPrint, self).__init__("gst-print", gdb.COMMAND_DATA,
gdb.COMPLETE_SYMBOL)
def invoke(self, arg, from_tty):
value = gdb.parse_and_eval(arg)
if not value:
raise Exception("'%s' is not a valid object" % args[0])
if value.type.code != gdb.TYPE_CODE_PTR:
value = value.address
if g_inherits_type(value, "GstElement"):
obj = GdbGstElement(value)
elif g_inherits_type(value, "GstPad"):
obj = GdbGstPad(value)
elif g_inherits_type(value, "GstCaps"):
obj = GdbGstCaps(value)
elif g_inherits_type(value, "GstEvent"):
obj = GdbGstCaps(value)
else:
raise Exception("'%s' has an unkown type" % arg)
obj.print(0)
GstDot()
GstPrint()
def register(obj):
if obj is None:
obj = gdb
# Make sure this is always used befor the glib lookup function.
# Otherwise the gobject pretty printer is used for GstObjects
obj.pretty_printers.insert(0, gst_pretty_printer_lookup)
| {
"content_hash": "5ba1b0ff9ae9da466d86494b4e6715f6",
"timestamp": "",
"source": "github",
"line_count": 946,
"max_line_length": 79,
"avg_line_length": 33.30443974630021,
"alnum_prop": 0.49704818129880024,
"repo_name": "google/aistreams",
"id": "75ccc6d95565e2ebc5da8d1254a7c202ea14fb83",
"size": "32369",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "third_party/gstreamer/libs/gst/helpers/gst_gdb.py",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "C",
"bytes": "77741"
},
{
"name": "C++",
"bytes": "626396"
},
{
"name": "Python",
"bytes": "41809"
},
{
"name": "Starlark",
"bytes": "56595"
}
],
"symlink_target": ""
} |
/* -*- mode: c++; indent-tabs-mode: nil -*- */
/*
Bioturbation via diffusion
Authors: Ethan Coon (ecoon@lanl.gov)
*/
#include "Epetra_SerialDenseVector.h"
#include "bioturbation_evaluator.hh"
namespace Amanzi {
namespace BGC {
namespace BGCRelations {
BioturbationEvaluator::BioturbationEvaluator(Teuchos::ParameterList& plist)
: EvaluatorSecondaryMonotypeCV(plist)
{
Tag tag = my_keys_.front().second;
Key domain_name = Keys::getDomain(my_keys_.front().first);
carbon_key_ = Keys::readKey(plist_, domain_name, "soil organic matter", "soil_organic_matter");
dependencies_.insert(KeyTag{carbon_key_, tag});
diffusivity_key_ = Keys::readKey(plist_, domain_name, "cryoturbation diffusivity", "cryoturbation_diffusivity");
dependencies_.insert(KeyTag{diffusivity_key_, tag});
}
Teuchos::RCP<Evaluator>
BioturbationEvaluator::Clone() const
{
return Teuchos::rcp(new BioturbationEvaluator(*this));
}
// Required methods from EvaluatorSecondaryMonotypeCV
void BioturbationEvaluator::Evaluate_(const State& S,
const std::vector<CompositeVector*>& result)
{
Tag tag = my_keys_.front().second;
auto carbon_cv = S.GetPtr<CompositeVector>(carbon_key_, tag);
const AmanziMesh::Mesh& mesh = *carbon_cv->Mesh();
const Epetra_MultiVector& carbon = *carbon_cv->ViewComponent("cell",false);
const Epetra_MultiVector& diff = *S.GetPtr<CompositeVector>(diffusivity_key_, tag)
->ViewComponent("cell",false);
Epetra_MultiVector& res_c = *result[0]->ViewComponent("cell",false);
// iterate over columns of the mesh
int ncolumns = mesh.num_columns();
for (int i=0; i<ncolumns; ++i) {
// grab the column
const AmanziMesh::Entity_ID_List& col = mesh.cells_of_column(i);
Epetra_SerialDenseVector dC_up(carbon.NumVectors());
Epetra_SerialDenseVector dC_dn(carbon.NumVectors());
// loop over column, getting cell index ci and cell c
int ci=0;
for (AmanziMesh::Entity_ID_List::const_iterator c=col.begin(); c!=col.end(); ++c, ++ci) {
double my_z = mesh.cell_centroid(*c)[2];
double dz_up = 0.;
double dz_dn = 0.;
if (ci != 0) {
double my_z = mesh.cell_centroid(*c)[2];
int c_up = col[ci-1];
dz_up = mesh.cell_centroid(c_up)[2] - my_z;
for (int p=0; p!=carbon.NumVectors(); ++p) {
dC_up[p] = (diff[p][*c]+diff[p][c_up]) / 2. * (carbon[p][*c] - carbon[p][c_up]) / dz_up;
}
}
if (ci != col.size()-1) {
int c_dn = col[ci+1];
dz_dn = mesh.cell_centroid(c_dn)[2] - my_z;
for (int p=0; p!=carbon.NumVectors(); ++p) {
dC_dn[p] = (diff[p][*c]+diff[p][c_dn]) / 2. * (carbon[p][c_dn] - carbon[p][*c]) / dz_up;
}
}
double dz = dz_dn == 0. ? dz_up :
dz_up == 0. ? dz_dn : (dz_up + dz_dn) / 2.;
for (int p=0; p!=carbon.NumVectors(); ++p) {
res_c[p][*c] = (dC_dn[p] - dC_up[p]) / dz;
}
}
}
}
void BioturbationEvaluator::EvaluatePartialDerivative_(
const State& S,
const Key& wrt_key, const Tag& wrt_tag,
const std::vector<CompositeVector*>& result)
{
AMANZI_ASSERT(0);
}
} //namespace
} //namespace
} //namespace
| {
"content_hash": "bcc116622b906230b99aa2021369df7b",
"timestamp": "",
"source": "github",
"line_count": 109,
"max_line_length": 114,
"avg_line_length": 29.045871559633028,
"alnum_prop": 0.6225521162349968,
"repo_name": "amanzi/ats-dev",
"id": "a88cbd9405448774cd19c65af44d79ffda5dfdc3",
"size": "3166",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/pks/biogeochemistry/constitutive_models/carbon/bioturbation_evaluator.cc",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "C",
"bytes": "3360"
},
{
"name": "C++",
"bytes": "2842879"
},
{
"name": "CMake",
"bytes": "97837"
},
{
"name": "Fortran",
"bytes": "8905"
},
{
"name": "Python",
"bytes": "6272"
}
],
"symlink_target": ""
} |
/*
* color_ramp_editor_plugin.cpp
*/
#include "color_ramp_editor_plugin.h"
#include "spatial_editor_plugin.h"
#include "canvas_item_editor_plugin.h"
ColorRampEditorPlugin::ColorRampEditorPlugin(EditorNode *p_node, bool p_2d) {
editor=p_node;
ramp_editor = memnew( ColorRampEdit );
_2d=p_2d;
if (p_2d)
add_control_to_container(CONTAINER_CANVAS_EDITOR_BOTTOM,ramp_editor);
else
add_control_to_container(CONTAINER_SPATIAL_EDITOR_BOTTOM,ramp_editor);
ramp_editor->set_custom_minimum_size(Size2(100, 48));
ramp_editor->hide();
ramp_editor->connect("ramp_changed", this, "ramp_changed");
}
void ColorRampEditorPlugin::edit(Object *p_object) {
ColorRamp* color_ramp = p_object->cast_to<ColorRamp>();
if (!color_ramp)
return;
color_ramp_ref = Ref<ColorRamp>(color_ramp);
ramp_editor->set_points(color_ramp_ref->get_points());
}
bool ColorRampEditorPlugin::handles(Object *p_object) const {
if (_2d)
return p_object->is_type("ColorRamp") && CanvasItemEditor::get_singleton()->is_visible() == true;
else
return p_object->is_type("ColorRamp") && SpatialEditor::get_singleton()->is_visible() == true;
}
void ColorRampEditorPlugin::make_visible(bool p_visible) {
if (p_visible) {
ramp_editor->show();
} else {
ramp_editor->hide();
}
}
void ColorRampEditorPlugin::_ramp_changed() {
if(color_ramp_ref.is_valid())
{
UndoRedo *ur=EditorNode::get_singleton()->get_undo_redo();
//Not sure if I should convert this data to DVector
Vector<float> new_offsets=ramp_editor->get_offsets();
Vector<Color> new_colors=ramp_editor->get_colors();
Vector<float> old_offsets=color_ramp_ref->get_offsets();
Vector<Color> old_colors=color_ramp_ref->get_colors();
if (old_offsets.size()!=new_offsets.size())
ur->create_action(TTR("Add/Remove Color Ramp Point"));
else
ur->create_action(TTR("Modify Color Ramp"),true);
ur->add_do_method(this,"undo_redo_color_ramp",new_offsets,new_colors);
ur->add_undo_method(this,"undo_redo_color_ramp",old_offsets,old_colors);
ur->commit_action();
//color_ramp_ref->set_points(ramp_editor->get_points());
}
}
void ColorRampEditorPlugin::_undo_redo_color_ramp(const Vector<float>& offsets,
const Vector<Color>& colors) {
color_ramp_ref->set_offsets(offsets);
color_ramp_ref->set_colors(colors);
ramp_editor->set_points(color_ramp_ref->get_points());
ramp_editor->update();
}
ColorRampEditorPlugin::~ColorRampEditorPlugin(){
}
void ColorRampEditorPlugin::_bind_methods() {
ObjectTypeDB::bind_method(_MD("ramp_changed"),&ColorRampEditorPlugin::_ramp_changed);
ObjectTypeDB::bind_method(_MD("undo_redo_color_ramp","offsets","colors"),&ColorRampEditorPlugin::_undo_redo_color_ramp);
}
| {
"content_hash": "33b9ae14c0a6dc69fb83d9b95d6cbf94",
"timestamp": "",
"source": "github",
"line_count": 92,
"max_line_length": 121,
"avg_line_length": 29.08695652173913,
"alnum_prop": 0.7133781763826607,
"repo_name": "agusbena/godot",
"id": "854a0149a52ca3ab07fa52c76e42427f75ef22c7",
"size": "2676",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "tools/editor/plugins/color_ramp_editor_plugin.cpp",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Assembly",
"bytes": "59962"
},
{
"name": "Batchfile",
"bytes": "2356"
},
{
"name": "C",
"bytes": "28624914"
},
{
"name": "C++",
"bytes": "12176754"
},
{
"name": "DIGITAL Command Language",
"bytes": "96686"
},
{
"name": "GAP",
"bytes": "4502"
},
{
"name": "GDScript",
"bytes": "85895"
},
{
"name": "GLSL",
"bytes": "57189"
},
{
"name": "Java",
"bytes": "454469"
},
{
"name": "M4",
"bytes": "49030"
},
{
"name": "Makefile",
"bytes": "73149"
},
{
"name": "Matlab",
"bytes": "2076"
},
{
"name": "Objective-C",
"bytes": "84186"
},
{
"name": "Objective-C++",
"bytes": "142765"
},
{
"name": "PHP",
"bytes": "1095905"
},
{
"name": "Perl",
"bytes": "11747"
},
{
"name": "Python",
"bytes": "132168"
},
{
"name": "Shell",
"bytes": "1058"
},
{
"name": "XS",
"bytes": "4319"
},
{
"name": "eC",
"bytes": "3788"
}
],
"symlink_target": ""
} |
(HTML
(HEAD
(script
Atype text/javascript
"\n This is a <b>test</b>. Don't go crazy! </i>\n
)script
)HEAD
(body
)body
)HTML
| {
"content_hash": "410b50fbaf571fafdb1691f439a9d9cf",
"timestamp": "",
"source": "github",
"line_count": 10,
"max_line_length": 49,
"avg_line_length": 12.4,
"alnum_prop": 0.6612903225806451,
"repo_name": "HtmlUnit/htmlunit-neko",
"id": "dbca26cf77c60537905dbcb809231d86a111c606",
"size": "124",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/test/resources/canonical/test005.html",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "HTML",
"bytes": "51224"
},
{
"name": "Java",
"bytes": "2509522"
}
],
"symlink_target": ""
} |
Token::Token(TokenType pType, std::string pRepresentation)
{
mType = pType;
mValue = pRepresentation;
}
//Constructs a literal token from a double value
Token::Token(double pValue)
{
mValueAsFloat = pValue;
mType = eLiteral;
}
//Returns the float value of the token, for literals
double Token::getValue()
{
return mValueAsFloat;
}
//Returns the type of token
TokenType Token::getType()
{
return mType;
}
//Return the string representation of the token
std::string Token::toString()
{
return mValue;
} | {
"content_hash": "f1e31648c179ee31fdfd2b12375cdc59",
"timestamp": "",
"source": "github",
"line_count": 30,
"max_line_length": 58,
"avg_line_length": 17.166666666666668,
"alnum_prop": 0.7320388349514563,
"repo_name": "TaylorP/3DGraphingCalculator",
"id": "4fb307efaa2bf2811550f523394d9f0ac5afb287",
"size": "623",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "GraphingCalc/rpn/token.cpp",
"mode": "33188",
"license": "bsd-2-clause",
"language": [
{
"name": "C",
"bytes": "988449"
},
{
"name": "C++",
"bytes": "34817"
}
],
"symlink_target": ""
} |
/** Automatically generated file. DO NOT MODIFY */
package zsl.ex2.wifip2p;
public final class BuildConfig {
public final static boolean DEBUG = true;
} | {
"content_hash": "ae2b3b4bb01ad315c3dda9508ef2d55a",
"timestamp": "",
"source": "github",
"line_count": 6,
"max_line_length": 50,
"avg_line_length": 26.166666666666668,
"alnum_prop": 0.7452229299363057,
"repo_name": "PeriForGWP/Test",
"id": "d8c83b6df2f88aae7fced16bac238c5fff46fd2f",
"size": "157",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "WifiP2p/gen/zsl/ex2/wifip2p/BuildConfig.java",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Java",
"bytes": "14493"
}
],
"symlink_target": ""
} |
REGISTER_TEST_CASE(Core);
bool TestCore::Init() {
return true;
}
void TestCore::RunTests(const std::string& filter) {
RUN_TEST(Time, filter);
RUN_TEST(TimeTicks, filter);
}
std::string TestCore::TestTime() {
pp::Core* core = pp::Module::Get()->core();
PP_Time time1 = core->GetTime();
ASSERT_TRUE(time1 > 0);
PlatformSleep(100); // 0.1 second
PP_Time time2 = core->GetTime();
ASSERT_TRUE(time2 > time1);
PASS();
}
std::string TestCore::TestTimeTicks() {
pp::Core* core = pp::Module::Get()->core();
PP_Time time1 = core->GetTimeTicks();
ASSERT_TRUE(time1 > 0);
PlatformSleep(100); // 0.1 second
PP_Time time2 = core->GetTimeTicks();
ASSERT_TRUE(time2 > time1);
PASS();
}
| {
"content_hash": "92e1027907216b51e40964b283fe1be8",
"timestamp": "",
"source": "github",
"line_count": 37,
"max_line_length": 52,
"avg_line_length": 19.37837837837838,
"alnum_prop": 0.6359832635983264,
"repo_name": "nwjs/chromium.src",
"id": "1557085d25eccefa74e924446562c34e7de3249c",
"size": "1034",
"binary": false,
"copies": "7",
"ref": "refs/heads/nw70",
"path": "ppapi/tests/test_core.cc",
"mode": "33188",
"license": "bsd-3-clause",
"language": [],
"symlink_target": ""
} |
// https://leetcode.com/problems/reverse-nodes-in-k-group/description/
/**
* Definition for singly-linked list.
* function ListNode(val) {
* this.val = val;
* this.next = null;
* }
*/
function ListNode(val) {
this.val = val;
this.next = null;
}
/**
* @param {ListNode} head
* @param {number} k
* @return {ListNode}
*/
var reverseKGroup = function (head, k) {
if (k <= 1 || !head) {
return head;
}
let headStore = new ListNode(-1);
headStore.next = head;
let tempHeadStore = headStore;
let tempHead = head;
let len = 0;
while (tempHead) {
len++;
tempHead = tempHead.next;
}
tempHead = head;
while (len >= k) {
let reverseHead = tempHeadStore.next;
for (let i = 1; i < k; i++) {
let temp = reverseHead.next;
reverseHead.next = temp.next;
temp.next = tempHeadStore.next;
tempHeadStore.next = temp;
}
tempHeadStore = reverseHead;
len = len - k;
}
head = headStore.next;
return head;
};
let head = new ListNode(1);
head.next = new ListNode(2);
head.next.next = new ListNode(3);
head.next.next.next = new ListNode(4);
head.next.next.next.next = new ListNode(5);
console.log(JSON.stringify(reverseKGroup(head, 2)));
let head2 = new ListNode(1);
head2.next = new ListNode(2);
head2.next.next = new ListNode(3);
head2.next.next.next = new ListNode(4);
head2.next.next.next.next = new ListNode(5);
console.log(JSON.stringify(reverseKGroup(head2, 3))); | {
"content_hash": "9cf5588c0539be49fd45fca4af6fb65d",
"timestamp": "",
"source": "github",
"line_count": 64,
"max_line_length": 70,
"avg_line_length": 22.71875,
"alnum_prop": 0.6368638239339752,
"repo_name": "lon-yang/leetcode",
"id": "e699090265649cc54e1fdfba4039f5320426e592",
"size": "1454",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "Hard/025_Reverse Nodes in k-Group.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C++",
"bytes": "1498"
},
{
"name": "JavaScript",
"bytes": "201184"
}
],
"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/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<title>Jnomics-manager: JnomicsThriftHandle Class Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
$(document).ready(function() { searchBox.OnSelectItem(0); });
</script>
</head>
<body>
<div id="top"><!-- do not remove this div! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 56px;">
<td style="padding-left: 0.5em;">
<div id="projectname">Jnomics-manager
</div>
<div id="projectbrief">Client/ServermanagerforJnomicsHadoopFramework</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- Generated by Doxygen 1.7.6.1 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
<div id="navrow1" class="tabs">
<ul class="tablist">
<li><a href="index.html"><span>Main Page</span></a></li>
<li class="current"><a href="annotated.html"><span>Classes</span></a></li>
<li><a href="files.html"><span>Files</span></a></li>
<li>
<div id="MSearchBox" class="MSearchBoxInactive">
<span class="left">
<img id="MSearchSelect" src="search/mag_sel.png"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
alt=""/>
<input type="text" id="MSearchField" value="Search" accesskey="S"
onfocus="searchBox.OnSearchFieldFocus(true)"
onblur="searchBox.OnSearchFieldFocus(false)"
onkeyup="searchBox.OnSearchFieldChange(event)"/>
</span><span class="right">
<a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
</span>
</div>
</li>
</ul>
</div>
<div id="navrow2" class="tabs2">
<ul class="tablist">
<li><a href="annotated.html"><span>Class List</span></a></li>
<li><a href="classes.html"><span>Class Index</span></a></li>
<li><a href="functions.html"><span>Class Members</span></a></li>
</ul>
</div>
</div>
<div class="header">
<div class="summary">
<a href="#pub-attribs">Public Attributes</a> </div>
<div class="headertitle">
<div class="title">JnomicsThriftHandle Class Reference</div> </div>
</div><!--header-->
<div class="contents">
<!-- doxytag: class="JnomicsThriftHandle" -->
<p>Container containing a hanlde to open file in hdfs.
<a href="structJnomicsThriftHandle.html#details">More...</a></p>
<p><code>#include <<a class="el" href="jnomics__thrift__api_8hpp_source.html">jnomics_thrift_api.hpp</a>></code></p>
<p><a href="classJnomicsThriftHandle-members.html">List of all members.</a></p>
<table class="memberdecls">
<tr><td colspan="2"><h2><a name="pub-attribs"></a>
Public Attributes</h2></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">string </td><td class="memItemRight" valign="bottom"><a class="el" href="structJnomicsThriftHandle.html#a2a8a4d97fe75323c69cabe4420a01119">uuid</a></td></tr>
</table>
<hr/><a name="details" id="details"></a><h2>Detailed Description</h2>
<div class="textblock"><p>Container containing a hanlde to open file in hdfs. </p>
</div><hr/><h2>Member Data Documentation</h2>
<a class="anchor" id="a2a8a4d97fe75323c69cabe4420a01119"></a><!-- doxytag: member="JnomicsThriftHandle::uuid" ref="a2a8a4d97fe75323c69cabe4420a01119" args="" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">string <a class="el" href="structJnomicsThriftHandle.html#a2a8a4d97fe75323c69cabe4420a01119">JnomicsThriftHandle::uuid</a></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>hdfs filehandle uuid </p>
</div>
</div>
<hr/>The documentation for this class was generated from the following file:<ul>
<li>thrift/<a class="el" href="jnomics__thrift__api_8hpp_source.html">jnomics_thrift_api.hpp</a></li>
</ul>
</div><!-- contents -->
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
onkeydown="return searchBox.OnSearchSelectKey(event)">
<a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(0)"><span class="SelectionMark"> </span>All</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark"> </span>Classes</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark"> </span>Functions</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(3)"><span class="SelectionMark"> </span>Variables</a></div>
<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0"
name="MSearchResults" id="MSearchResults">
</iframe>
</div>
<hr class="footer"/><address class="footer"><small>
Generated on Sun Nov 25 2012 11:40:07 for Jnomics-manager by  <a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.7.6.1
</small></address>
</body>
</html>
| {
"content_hash": "53b93c2993faa72eeffd6918012ca89c",
"timestamp": "",
"source": "github",
"line_count": 141,
"max_line_length": 550,
"avg_line_length": 41.638297872340424,
"alnum_prop": 0.6676886390734117,
"repo_name": "kbase/docs",
"id": "a4e07bcb32f85e0b7de2f7d72094cb4ab2fce2ed",
"size": "5871",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "jnomics/docs/html/structJnomicsThriftHandle.html",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "87338"
},
{
"name": "HTML",
"bytes": "33780935"
},
{
"name": "JavaScript",
"bytes": "147498"
},
{
"name": "Jupyter Notebook",
"bytes": "101314"
},
{
"name": "Makefile",
"bytes": "893"
},
{
"name": "PHP",
"bytes": "16652"
},
{
"name": "Perl",
"bytes": "18895"
},
{
"name": "Python",
"bytes": "24049"
},
{
"name": "Ruby",
"bytes": "53646"
},
{
"name": "Shell",
"bytes": "3673"
}
],
"symlink_target": ""
} |
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("09.MatrixOfNumbers")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("09.MatrixOfNumbers")]
[assembly: AssemblyCopyright("Copyright © 2015")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("e99b3413-a446-4770-9d95-0445fa330c51")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
| {
"content_hash": "a8ede15eaaf864bc5e431ba8ab68c239",
"timestamp": "",
"source": "github",
"line_count": 36,
"max_line_length": 84,
"avg_line_length": 39.138888888888886,
"alnum_prop": 0.7459190915542938,
"repo_name": "kossov/Telerik-Academy",
"id": "9f63001ee3b6de32fe3503493a94d2594757f04b",
"size": "1412",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "C#/C#1/MyHomeworks/Loops/09.MatrixOfNumbers/Properties/AssemblyInfo.cs",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C#",
"bytes": "907639"
},
{
"name": "CSS",
"bytes": "85660"
},
{
"name": "CoffeeScript",
"bytes": "3700"
},
{
"name": "HTML",
"bytes": "265090"
},
{
"name": "JavaScript",
"bytes": "1475083"
},
{
"name": "Smalltalk",
"bytes": "635"
}
],
"symlink_target": ""
} |
//
// Generated by the J2ObjC translator. DO NOT EDIT!
// source: android/libcore/xml/src/main/java/org/xmlpull/v1/sax2/Driver.java
//
#ifndef _OrgXmlpullV1Sax2Driver_H_
#define _OrgXmlpullV1Sax2Driver_H_
#include "J2ObjC_header.h"
#include "org/xml/sax/Attributes.h"
#include "org/xml/sax/Locator.h"
#include "org/xml/sax/XMLReader.h"
@class OrgXmlSaxInputSource;
@protocol OrgXmlSaxContentHandler;
@protocol OrgXmlSaxDTDHandler;
@protocol OrgXmlSaxEntityResolver;
@protocol OrgXmlSaxErrorHandler;
@protocol OrgXmlpullV1XmlPullParser;
/*!
@brief SAX2 Driver that pulls events from XmlPullParser
and comverts them into SAX2 callbacks.
@author <a href="http://www.extreme.indiana.edu/~aslom/">Aleksander Slominski</a>
*/
@interface OrgXmlpullV1Sax2Driver : NSObject < OrgXmlSaxLocator, OrgXmlSaxXMLReader, OrgXmlSaxAttributes > {
@public
id<OrgXmlSaxContentHandler> contentHandler_;
id<OrgXmlSaxErrorHandler> errorHandler_;
NSString *systemId_;
id<OrgXmlpullV1XmlPullParser> pp_;
}
#pragma mark Public
/*!
*/
- (instancetype)init;
- (instancetype)initWithOrgXmlpullV1XmlPullParser:(id<OrgXmlpullV1XmlPullParser>)pp;
- (jint)getColumnNumber;
- (id<OrgXmlSaxContentHandler>)getContentHandler;
- (id<OrgXmlSaxDTDHandler>)getDTDHandler;
- (id<OrgXmlSaxEntityResolver>)getEntityResolver;
- (id<OrgXmlSaxErrorHandler>)getErrorHandler;
- (jboolean)getFeatureWithNSString:(NSString *)name;
- (jint)getIndexWithNSString:(NSString *)qName;
- (jint)getIndexWithNSString:(NSString *)uri
withNSString:(NSString *)localName;
- (jint)getLength;
- (jint)getLineNumber;
- (NSString *)getLocalNameWithInt:(jint)index;
- (id)getPropertyWithNSString:(NSString *)name;
- (NSString *)getPublicId;
- (NSString *)getQNameWithInt:(jint)index;
- (NSString *)getSystemId;
- (NSString *)getTypeWithInt:(jint)index;
- (NSString *)getTypeWithNSString:(NSString *)qName;
- (NSString *)getTypeWithNSString:(NSString *)uri
withNSString:(NSString *)localName;
- (NSString *)getURIWithInt:(jint)index;
- (NSString *)getValueWithInt:(jint)index;
- (NSString *)getValueWithNSString:(NSString *)qName;
- (NSString *)getValueWithNSString:(NSString *)uri
withNSString:(NSString *)localName;
- (void)parseWithOrgXmlSaxInputSource:(OrgXmlSaxInputSource *)source;
- (void)parseWithNSString:(NSString *)systemId;
- (void)parseSubTreeWithOrgXmlpullV1XmlPullParser:(id<OrgXmlpullV1XmlPullParser>)pp;
- (void)setContentHandlerWithOrgXmlSaxContentHandler:(id<OrgXmlSaxContentHandler>)handler;
- (void)setDTDHandlerWithOrgXmlSaxDTDHandler:(id<OrgXmlSaxDTDHandler>)handler;
- (void)setEntityResolverWithOrgXmlSaxEntityResolver:(id<OrgXmlSaxEntityResolver>)resolver;
- (void)setErrorHandlerWithOrgXmlSaxErrorHandler:(id<OrgXmlSaxErrorHandler>)handler;
- (void)setFeatureWithNSString:(NSString *)name
withBoolean:(jboolean)value;
- (void)setPropertyWithNSString:(NSString *)name
withId:(id)value;
#pragma mark Protected
/*!
@brief Calls <code>startElement</code>
on the <code>ContentHandler</code> with <code>this</code> driver object as the
<code>Attributes</code> implementation.
In default implementation
<code>Attributes</code> object is valid only during this method call and may not
be stored. Sub-classes can overwrite this method to cache attributes.
*/
- (void)startElementWithNSString:(NSString *)namespace_
withNSString:(NSString *)localName
withNSString:(NSString *)qName;
@end
J2OBJC_EMPTY_STATIC_INIT(OrgXmlpullV1Sax2Driver)
J2OBJC_FIELD_SETTER(OrgXmlpullV1Sax2Driver, contentHandler_, id<OrgXmlSaxContentHandler>)
J2OBJC_FIELD_SETTER(OrgXmlpullV1Sax2Driver, errorHandler_, id<OrgXmlSaxErrorHandler>)
J2OBJC_FIELD_SETTER(OrgXmlpullV1Sax2Driver, systemId_, NSString *)
J2OBJC_FIELD_SETTER(OrgXmlpullV1Sax2Driver, pp_, id<OrgXmlpullV1XmlPullParser>)
FOUNDATION_EXPORT NSString *OrgXmlpullV1Sax2Driver_DECLARATION_HANDLER_PROPERTY_;
J2OBJC_STATIC_FIELD_GETTER(OrgXmlpullV1Sax2Driver, DECLARATION_HANDLER_PROPERTY_, NSString *)
FOUNDATION_EXPORT NSString *OrgXmlpullV1Sax2Driver_LEXICAL_HANDLER_PROPERTY_;
J2OBJC_STATIC_FIELD_GETTER(OrgXmlpullV1Sax2Driver, LEXICAL_HANDLER_PROPERTY_, NSString *)
FOUNDATION_EXPORT NSString *OrgXmlpullV1Sax2Driver_NAMESPACES_FEATURE_;
J2OBJC_STATIC_FIELD_GETTER(OrgXmlpullV1Sax2Driver, NAMESPACES_FEATURE_, NSString *)
FOUNDATION_EXPORT NSString *OrgXmlpullV1Sax2Driver_NAMESPACE_PREFIXES_FEATURE_;
J2OBJC_STATIC_FIELD_GETTER(OrgXmlpullV1Sax2Driver, NAMESPACE_PREFIXES_FEATURE_, NSString *)
FOUNDATION_EXPORT NSString *OrgXmlpullV1Sax2Driver_VALIDATION_FEATURE_;
J2OBJC_STATIC_FIELD_GETTER(OrgXmlpullV1Sax2Driver, VALIDATION_FEATURE_, NSString *)
FOUNDATION_EXPORT NSString *OrgXmlpullV1Sax2Driver_APACHE_SCHEMA_VALIDATION_FEATURE_;
J2OBJC_STATIC_FIELD_GETTER(OrgXmlpullV1Sax2Driver, APACHE_SCHEMA_VALIDATION_FEATURE_, NSString *)
FOUNDATION_EXPORT NSString *OrgXmlpullV1Sax2Driver_APACHE_DYNAMIC_VALIDATION_FEATURE_;
J2OBJC_STATIC_FIELD_GETTER(OrgXmlpullV1Sax2Driver, APACHE_DYNAMIC_VALIDATION_FEATURE_, NSString *)
FOUNDATION_EXPORT void OrgXmlpullV1Sax2Driver_init(OrgXmlpullV1Sax2Driver *self);
FOUNDATION_EXPORT OrgXmlpullV1Sax2Driver *new_OrgXmlpullV1Sax2Driver_init() NS_RETURNS_RETAINED;
FOUNDATION_EXPORT void OrgXmlpullV1Sax2Driver_initWithOrgXmlpullV1XmlPullParser_(OrgXmlpullV1Sax2Driver *self, id<OrgXmlpullV1XmlPullParser> pp);
FOUNDATION_EXPORT OrgXmlpullV1Sax2Driver *new_OrgXmlpullV1Sax2Driver_initWithOrgXmlpullV1XmlPullParser_(id<OrgXmlpullV1XmlPullParser> pp) NS_RETURNS_RETAINED;
J2OBJC_TYPE_LITERAL_HEADER(OrgXmlpullV1Sax2Driver)
#endif // _OrgXmlpullV1Sax2Driver_H_
| {
"content_hash": "6d9b5c16000182c7fd6c8b5f7157dd12",
"timestamp": "",
"source": "github",
"line_count": 163,
"max_line_length": 158,
"avg_line_length": 34.98159509202454,
"alnum_prop": 0.7905997895475272,
"repo_name": "benf1977/j2objc-serialization-example",
"id": "56801a403b8af427df23bcd9d780aaa230081325",
"size": "5702",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "j2objc/include/org/xmlpull/v1/sax2/Driver.h",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C",
"bytes": "6216"
},
{
"name": "C++",
"bytes": "50169"
},
{
"name": "Groff",
"bytes": "5681"
},
{
"name": "Java",
"bytes": "2156"
},
{
"name": "Objective-C",
"bytes": "10210534"
},
{
"name": "Shell",
"bytes": "4566"
}
],
"symlink_target": ""
} |
package org.robolectric.bytecode;
public class ShadowConfig {
public final String shadowClassName;
public final boolean callThroughByDefault;
ShadowConfig(String shadowClassName, boolean callThroughByDefault) {
this.callThroughByDefault = callThroughByDefault;
this.shadowClassName = shadowClassName;
}
}
| {
"content_hash": "d2987c1975efcc7b6defba0b04bdade5",
"timestamp": "",
"source": "github",
"line_count": 11,
"max_line_length": 72,
"avg_line_length": 30.818181818181817,
"alnum_prop": 0.7669616519174042,
"repo_name": "dierksen/robolectric",
"id": "6ae24532e98181c3a465bf5e2dca87cdbc2845ca",
"size": "339",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/main/java/org/robolectric/bytecode/ShadowConfig.java",
"mode": "33188",
"license": "mit",
"language": [],
"symlink_target": ""
} |
package org.docksidestage.sqlite.dbflute.readonly.exentity;
import org.docksidestage.sqlite.dbflute.readonly.bsentity.RoyBsServiceRank;
/**
* The entity of SERVICE_RANK.
* <p>
* You can implement your original methods here.
* This class remains when re-generating.
* </p>
* @author DBFlute(AutoGenerator)
*/
public class RoyServiceRank extends RoyBsServiceRank {
/** The serial version UID for object serialization. (Default) */
private static final long serialVersionUID = 1L;
}
| {
"content_hash": "f2f0c449b3655335eb94c182eb3ac9be",
"timestamp": "",
"source": "github",
"line_count": 17,
"max_line_length": 75,
"avg_line_length": 29.294117647058822,
"alnum_prop": 0.7530120481927711,
"repo_name": "dbflute-test/dbflute-test-dbms-sqlite",
"id": "7c0065a306373901b30cf1c72bfb2375f984933b",
"size": "498",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/main/java/org/docksidestage/sqlite/dbflute/readonly/exentity/RoyServiceRank.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Batchfile",
"bytes": "41835"
},
{
"name": "HTML",
"bytes": "42250"
},
{
"name": "Java",
"bytes": "8007820"
},
{
"name": "Perl",
"bytes": "9821"
},
{
"name": "Python",
"bytes": "3285"
},
{
"name": "Roff",
"bytes": "105"
},
{
"name": "Shell",
"bytes": "34572"
},
{
"name": "XSLT",
"bytes": "218435"
}
],
"symlink_target": ""
} |
package net.ceos.project.poi.annotated.core;
import java.util.Arrays;
import java.util.List;
import net.ceos.project.poi.annotated.annotation.XlsGroupColumn;
import net.ceos.project.poi.annotated.annotation.XlsGroupRow;
/**
* This class manage the group of columns and/or rows to apply to one sheet.
*
* @version 1.0
* @author Carlos CRISTO ABREU
*/
class SheetGroupElementHandler {
private SheetGroupElementHandler() {
/* private constructor to hide the implicit public */
}
/**
* Apply a freeze pane to the sheet.
*
* @param configCriteria
* the {@link XConfigCriteria}
*/
protected static void applyGroupElements(final XConfigCriteria configCriteria) {
if (configCriteria.getGroupElement() != null) {
applyToColumns(configCriteria);
applyToRows(configCriteria);
}
}
/**
* Group n elements by columns.
*
* @param configCriteria
* the {@link XConfigCriteria}
*/
private static void applyToColumns(final XConfigCriteria configCriteria) {
List<XlsGroupColumn> columnsList = Arrays.asList(configCriteria.getGroupElement().groupColumns());
columnsList.stream().forEach(group -> {
if(PredicateFactory.isGroupColumnValid.test(group)) {
configCriteria.getSheet().groupColumn(group.fromColumn(), group.toColumn());
}
});
}
/**
* Group n elements by rows.
*
* @param configCriteria
* the {@link XConfigCriteria}
*/
private static void applyToRows(final XConfigCriteria configCriteria) {
List<XlsGroupRow> rowsList = Arrays.asList(configCriteria.getGroupElement().groupRows());
rowsList.stream().forEach(group -> {
if(PredicateFactory.isGroupRowValid.test(group)) {
configCriteria.getSheet().groupRow(group.fromRow(), group.toRow());
}
});
}
}
| {
"content_hash": "04b2a996a375a8c931872b98b03580e2",
"timestamp": "",
"source": "github",
"line_count": 65,
"max_line_length": 100,
"avg_line_length": 27.246153846153845,
"alnum_prop": 0.7131564088085828,
"repo_name": "cacristo/ceos-project",
"id": "0da851c24eec7bf52911c334956e60e79023fc9e",
"size": "2378",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "jexan/src/main/java/net/ceos/project/poi/annotated/core/SheetGroupElementHandler.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Java",
"bytes": "1052050"
}
],
"symlink_target": ""
} |
using System;
using System.Collections.Generic;
using System.Web.Http;
using System.Web.Http.Cors;
using System.Web.Http.Description;
using FLS.Data.WebApi.Location;
using FLS.Server.Service;
namespace FLS.Server.WebApi.Controllers
{
/// <summary>
/// Length unit types controller
/// </summary>
//[Authorize]
[RoutePrefix("api/v1/lengthunittypes")]
public class LengthUnitTypesController : ApiController
{
private readonly LocationService _locationService;
/// <summary>
/// Initializes a new instance of the <see cref="LengthUnitTypesController"/> class.
/// </summary>
/// <param name="locationService">The location service.</param>
public LengthUnitTypesController(LocationService locationService)
{
_locationService = locationService;
}
/// <summary>
/// Gets the length unit types.
/// </summary>
/// <returns></returns>
[HttpGet]
[Route("")]
[Route("listitems")]
[ResponseType(typeof(List<LengthUnitType>))]
public IHttpActionResult GetLengthUnitTypes()
{
var lengthUnitTypes = _locationService.GetLengthUnitTypeListItems();
return Ok(lengthUnitTypes);
}
}
}
| {
"content_hash": "566ef657c23095940eca07932dcd3fd9",
"timestamp": "",
"source": "github",
"line_count": 44,
"max_line_length": 92,
"avg_line_length": 29.34090909090909,
"alnum_prop": 0.6320681642137878,
"repo_name": "flightlog/flsserver",
"id": "169c072f82f6b783f50bef92971e03c2024aafe8",
"size": "1293",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/FLS.Server.Web/Controllers/LengthUnitTypesController.cs",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "ASP.NET",
"bytes": "111"
},
{
"name": "C#",
"bytes": "2718411"
},
{
"name": "CSS",
"bytes": "2996"
},
{
"name": "HTML",
"bytes": "19943"
},
{
"name": "JavaScript",
"bytes": "246053"
},
{
"name": "TSQL",
"bytes": "444278"
}
],
"symlink_target": ""
} |
unsigned int can_transition(config_t *cfg, const char *path, const char *input) {
config_setting_t *accepts = config_lookup(cfg, path);
int length = config_setting_length(accepts);
int i;
for(i = 0; i < length; ++i) {
const char *cur = config_setting_get_string_elem(accepts, i);
if(*cur == input[0]) {
return 1;
} else if(*cur == '~') {
return 2;
}
}
return 0;
}
bool automata_is_accepted(config_t *cfg, const char *start, const char *input) {
char path[80] = "automaton.nodes.";
strcat(path, start);
config_setting_t *cur_node = config_lookup(cfg, path);
if(cur_node == NULL) {
fprintf(stderr, "Couldn't find node %s", start);
return false;
}
int end_node = false;
config_setting_lookup_bool(cur_node, "accepted", &end_node);
if(end_node && input[0] == '\0') return true;
// config_setting_t *trans = config_setting_lookup(cur_node, "transitions");
char trans_path[91];
snprintf(trans_path, 91, "%s.transitions", path);
config_setting_t *trans = config_lookup(cfg, trans_path);
if(trans == NULL) return false;
bool any_path_found = false;
#pragma omp parallel
{
int num_paths = config_setting_length(trans);
int i;
if(!any_path_found) {
#pragma omp for
for(i = 0; i < num_paths; ++i) {
config_setting_t *cur_path = config_setting_get_elem(trans, i);
char cur_path_str[120];
snprintf(cur_path_str, 120, "%s.[%d].accepts", trans_path, i);
unsigned int ct = can_transition(cfg, cur_path_str, input);
if(ct) {
const char *next_input = (ct == 1) ? input + 1 : input;
const char *next_start;
config_setting_lookup_string(cur_path, "to", &next_start);
bool next = automata_is_accepted(cfg, next_start, next_input);
if(next) any_path_found = true;
}
}
}
}
return any_path_found;
return false;
}
int automata_to_dot(config_t *cfg, const char *start, char *dest, int dest_size) {
// char path[80] = "automaton.nodes.";
// strcat(path, start);
const char *fmt_str = "digraph automaton {\n"
"\tgraph [rankdir=LR];\n\tstart [shape=plaintext];\n"
"\tstart -> %s;\n"; // start_node
config_setting_t *nodes = config_lookup(cfg, "automaton.nodes");
int node_count = config_setting_length(nodes);
const char *start_node;
config_lookup_string(cfg, "automaton.start", &start_node);
int cur_length = snprintf(dest, dest_size, fmt_str, start_node);
int i;
for(i = 0; i < node_count; ++i) {
config_setting_t *cur_node = config_setting_get_elem(nodes, i);
if(cur_node == NULL) {
fprintf(stderr, "Couldn't find node %s", start);
return false;
}
// config_setting_t *trans = config_setting_lookup(cur_node, "transitions");
char trans_path[91];
snprintf(trans_path, 91, "automaton.nodes.[%d].transitions", i);
config_setting_t *trans = config_lookup(cfg, trans_path);
if(trans == NULL) return false;
int num_paths = config_setting_length(trans);
int j;
const char *loop_fmt_str = "\t%s%s%s -> %s [label=\"%s\"];\n";
for(j = 0; j < num_paths; ++j) {
config_setting_t *cur_path = config_setting_get_elem(trans, j);
const char *next_start;
config_setting_lookup_string(cur_path, "to", &next_start);
int accepted_state;
config_setting_lookup_bool(cur_node, "accepted", &accepted_state);
char *cur_node_txt = config_setting_name(cur_node);
const char *cur_node_shape = accepted_state ? " [shape=doublecircle];\n\t" : "";
// config_setting_t *accepted = config_setting_lookup(cur_path, "accepts");
char cur_path_str[120];
snprintf(cur_path_str, 120, "%s.[%d].accepts", trans_path, j);
config_setting_t *accepted = config_lookup(cfg, cur_path_str);
if(accepted == NULL) printf("REEEEE\n");
int num_accepted = config_setting_length(accepted);
char *label = (char *)calloc(2 * num_accepted, sizeof(char));
int k;
for(k = 0; k < num_accepted; ++k) {
if(k > 0) {
strcat(label, ",");
}
config_setting_t *cur_acc = config_setting_get_elem(accepted, k);
strcat(label, config_setting_get_string(cur_acc));
}
cur_length += snprintf(dest + cur_length, dest_size, loop_fmt_str, accepted_state ? cur_node_txt : "", cur_node_shape, cur_node_txt, next_start, label);
free(label);
}
}
snprintf(dest + cur_length, dest_size, "}\n");
return 0;
}
| {
"content_hash": "742b63809ab97d9a78de8acd3262864b",
"timestamp": "",
"source": "github",
"line_count": 135,
"max_line_length": 164,
"avg_line_length": 37.05925925925926,
"alnum_prop": 0.5468718768738757,
"repo_name": "colatkinson/automata",
"id": "5ad67360a98ada25394d18939fbe62dbb3cb4f6c",
"size": "5110",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "include/automata.c",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C",
"bytes": "26839"
},
{
"name": "CMake",
"bytes": "3501"
}
],
"symlink_target": ""
} |
// Copyright 2013 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "chromeos/ime/xkeyboard.h"
#include <cstdlib>
#include <cstring>
#include <queue>
#include <set>
#include <utility>
#include "base/bind.h"
#include "base/logging.h"
#include "base/memory/scoped_ptr.h"
#include "base/message_loop/message_loop.h"
#include "base/process/kill.h"
#include "base/process/launch.h"
#include "base/process/process_handle.h"
#include "base/strings/string_util.h"
#include "base/strings/stringprintf.h"
#include "base/sys_info.h"
#include "base/threading/thread_checker.h"
// These includes conflict with base/tracked_objects.h so must come last.
#include <X11/XKBlib.h>
#include <X11/Xlib.h>
namespace chromeos {
namespace input_method {
namespace {
Display* GetXDisplay() {
return base::MessagePumpForUI::GetDefaultXDisplay();
}
// The delay in milliseconds that we'll wait between checking if
// setxkbmap command finished.
const int kSetLayoutCommandCheckDelayMs = 100;
// The command we use to set the current XKB layout and modifier key mapping.
// TODO(yusukes): Use libxkbfile.so instead of the command (crosbug.com/13105)
const char kSetxkbmapCommand[] = "/usr/bin/setxkbmap";
// A string for obtaining a mask value for Num Lock.
const char kNumLockVirtualModifierString[] = "NumLock";
const char *kISOLevel5ShiftLayoutIds[] = {
"ca(multix)",
"de(neo)",
};
const char *kAltGrLayoutIds[] = {
"be",
"be",
"be",
"bg",
"bg(phonetic)",
"br",
"ca",
"ca(eng)",
"ca(multix)",
"ch",
"ch(fr)",
"cz",
"de",
"de(neo)",
"dk",
"ee",
"es",
"es(cat)",
"fi",
"fr",
"gb(dvorak)",
"gb(extd)",
"gr",
"hr",
"il",
"it",
"latam",
"lt",
"no",
"pl",
"pt",
"ro",
"se",
"si",
"sk",
"tr",
"ua",
"us(altgr-intl)",
"us(intl)",
};
// Returns false if |layout_name| contains a bad character.
bool CheckLayoutName(const std::string& layout_name) {
static const char kValidLayoutNameCharacters[] =
"abcdefghijklmnopqrstuvwxyz0123456789()-_";
if (layout_name.empty()) {
DVLOG(1) << "Invalid layout_name: " << layout_name;
return false;
}
if (layout_name.find_first_not_of(kValidLayoutNameCharacters) !=
std::string::npos) {
DVLOG(1) << "Invalid layout_name: " << layout_name;
return false;
}
return true;
}
class XKeyboardImpl : public XKeyboard {
public:
XKeyboardImpl();
virtual ~XKeyboardImpl() {}
// Adds/removes observer.
virtual void AddObserver(Observer* observer) OVERRIDE;
virtual void RemoveObserver(Observer* observer) OVERRIDE;
// Overridden from XKeyboard:
virtual bool SetCurrentKeyboardLayoutByName(
const std::string& layout_name) OVERRIDE;
virtual bool ReapplyCurrentKeyboardLayout() OVERRIDE;
virtual void ReapplyCurrentModifierLockStatus() OVERRIDE;
virtual void DisableNumLock() OVERRIDE;
virtual void SetCapsLockEnabled(bool enable_caps_lock) OVERRIDE;
virtual bool CapsLockIsEnabled() OVERRIDE;
virtual bool IsISOLevel5ShiftAvailable() const OVERRIDE;
virtual bool IsAltGrAvailable() const OVERRIDE;
virtual bool SetAutoRepeatEnabled(bool enabled) OVERRIDE;
virtual bool SetAutoRepeatRate(const AutoRepeatRate& rate) OVERRIDE;
private:
// Returns a mask for Num Lock (e.g. 1U << 4). Returns 0 on error.
unsigned int GetNumLockMask();
// Sets the caps-lock status. Note that calling this function always disables
// the num-lock.
void SetLockedModifiers(bool caps_lock_enabled);
// This function is used by SetLayout() and RemapModifierKeys(). Calls
// setxkbmap command if needed, and updates the last_full_layout_name_ cache.
bool SetLayoutInternal(const std::string& layout_name, bool force);
// Executes 'setxkbmap -layout ...' command asynchronously using a layout name
// in the |execute_queue_|. Do nothing if the queue is empty.
// TODO(yusukes): Use libxkbfile.so instead of the command (crosbug.com/13105)
void MaybeExecuteSetLayoutCommand();
// Polls to see setxkbmap process exits.
void PollUntilChildFinish(const base::ProcessHandle handle);
// Called when execve'd setxkbmap process exits.
void OnSetLayoutFinish();
const bool is_running_on_chrome_os_;
unsigned int num_lock_mask_;
// The current Caps Lock status. If true, enabled.
bool current_caps_lock_status_;
// The XKB layout name which we set last time like "us" and "us(dvorak)".
std::string current_layout_name_;
// A queue for executing setxkbmap one by one.
std::queue<std::string> execute_queue_;
base::ThreadChecker thread_checker_;
base::WeakPtrFactory<XKeyboardImpl> weak_factory_;
ObserverList<Observer> observers_;
DISALLOW_COPY_AND_ASSIGN(XKeyboardImpl);
};
XKeyboardImpl::XKeyboardImpl()
: is_running_on_chrome_os_(base::SysInfo::IsRunningOnChromeOS()),
weak_factory_(this) {
// X must be already initialized.
CHECK(GetXDisplay());
num_lock_mask_ = GetNumLockMask();
if (is_running_on_chrome_os_) {
// Some code seems to assume that Mod2Mask is always assigned to
// Num Lock.
//
// TODO(yusukes): Check the assumption is really okay. If not,
// modify the Aura code, and then remove the CHECK below.
LOG_IF(ERROR, num_lock_mask_ != Mod2Mask)
<< "NumLock is not assigned to Mod2Mask. : " << num_lock_mask_;
}
current_caps_lock_status_ = CapsLockIsEnabled();
}
void XKeyboardImpl::AddObserver(XKeyboard::Observer* observer) {
observers_.AddObserver(observer);
}
void XKeyboardImpl::RemoveObserver(XKeyboard::Observer* observer) {
observers_.RemoveObserver(observer);
}
unsigned int XKeyboardImpl::GetNumLockMask() {
DCHECK(thread_checker_.CalledOnValidThread());
static const unsigned int kBadMask = 0;
unsigned int real_mask = kBadMask;
XkbDescPtr xkb_desc =
XkbGetKeyboard(GetXDisplay(), XkbAllComponentsMask, XkbUseCoreKbd);
if (!xkb_desc)
return kBadMask;
if (xkb_desc->dpy && xkb_desc->names) {
const std::string string_to_find(kNumLockVirtualModifierString);
for (size_t i = 0; i < XkbNumVirtualMods; ++i) {
const unsigned int virtual_mod_mask = 1U << i;
char* virtual_mod_str_raw_ptr =
XGetAtomName(xkb_desc->dpy, xkb_desc->names->vmods[i]);
if (!virtual_mod_str_raw_ptr)
continue;
const std::string virtual_mod_str = virtual_mod_str_raw_ptr;
XFree(virtual_mod_str_raw_ptr);
if (string_to_find == virtual_mod_str) {
if (!XkbVirtualModsToReal(xkb_desc, virtual_mod_mask, &real_mask)) {
DVLOG(1) << "XkbVirtualModsToReal failed";
real_mask = kBadMask; // reset the return value, just in case.
}
break;
}
}
}
XkbFreeKeyboard(xkb_desc, 0, True /* free all components */);
return real_mask;
}
void XKeyboardImpl::SetLockedModifiers(bool caps_lock_enabled) {
DCHECK(thread_checker_.CalledOnValidThread());
// Always turn off num lock.
unsigned int affect_mask = num_lock_mask_;
unsigned int value_mask = 0;
affect_mask |= LockMask;
value_mask |= (caps_lock_enabled ? LockMask : 0);
current_caps_lock_status_ = caps_lock_enabled;
XkbLockModifiers(GetXDisplay(), XkbUseCoreKbd, affect_mask, value_mask);
}
bool XKeyboardImpl::SetLayoutInternal(const std::string& layout_name,
bool force) {
if (!is_running_on_chrome_os_) {
// We should not try to change a layout on Linux or inside ui_tests. Just
// return true.
return true;
}
if (!CheckLayoutName(layout_name))
return false;
if (!force && (current_layout_name_ == layout_name)) {
DVLOG(1) << "The requested layout is already set: " << layout_name;
return true;
}
DVLOG(1) << (force ? "Reapply" : "Set") << " layout: " << layout_name;
const bool start_execution = execute_queue_.empty();
// If no setxkbmap command is in flight (i.e. start_execution is true),
// start the first one by explicitly calling MaybeExecuteSetLayoutCommand().
// If one or more setxkbmap commands are already in flight, just push the
// layout name to the queue. setxkbmap command for the layout will be called
// via OnSetLayoutFinish() callback later.
execute_queue_.push(layout_name);
if (start_execution)
MaybeExecuteSetLayoutCommand();
return true;
}
// Executes 'setxkbmap -layout ...' command asynchronously using a layout name
// in the |execute_queue_|. Do nothing if the queue is empty.
// TODO(yusukes): Use libxkbfile.so instead of the command (crosbug.com/13105)
void XKeyboardImpl::MaybeExecuteSetLayoutCommand() {
if (execute_queue_.empty())
return;
const std::string layout_to_set = execute_queue_.front();
std::vector<std::string> argv;
base::ProcessHandle handle = base::kNullProcessHandle;
argv.push_back(kSetxkbmapCommand);
argv.push_back("-layout");
argv.push_back(layout_to_set);
argv.push_back("-synch");
if (!base::LaunchProcess(argv, base::LaunchOptions(), &handle)) {
DVLOG(1) << "Failed to execute setxkbmap: " << layout_to_set;
execute_queue_ = std::queue<std::string>(); // clear the queue.
return;
}
PollUntilChildFinish(handle);
DVLOG(1) << "ExecuteSetLayoutCommand: "
<< layout_to_set << ": pid=" << base::GetProcId(handle);
}
// Delay and loop until child process finishes and call the callback.
void XKeyboardImpl::PollUntilChildFinish(const base::ProcessHandle handle) {
int exit_code;
DVLOG(1) << "PollUntilChildFinish: poll for pid=" << base::GetProcId(handle);
switch (base::GetTerminationStatus(handle, &exit_code)) {
case base::TERMINATION_STATUS_STILL_RUNNING:
DVLOG(1) << "PollUntilChildFinish: Try waiting again";
base::MessageLoop::current()->PostDelayedTask(
FROM_HERE,
base::Bind(&XKeyboardImpl::PollUntilChildFinish,
weak_factory_.GetWeakPtr(), handle),
base::TimeDelta::FromMilliseconds(kSetLayoutCommandCheckDelayMs));
return;
case base::TERMINATION_STATUS_NORMAL_TERMINATION:
DVLOG(1) << "PollUntilChildFinish: Child process finished";
OnSetLayoutFinish();
return;
case base::TERMINATION_STATUS_ABNORMAL_TERMINATION:
DVLOG(1) << "PollUntilChildFinish: Abnormal exit code: " << exit_code;
OnSetLayoutFinish();
return;
default:
NOTIMPLEMENTED();
OnSetLayoutFinish();
return;
}
}
bool XKeyboardImpl::CapsLockIsEnabled() {
DCHECK(thread_checker_.CalledOnValidThread());
XkbStateRec status;
XkbGetState(GetXDisplay(), XkbUseCoreKbd, &status);
return (status.locked_mods & LockMask);
}
bool XKeyboardImpl::IsISOLevel5ShiftAvailable() const {
for (size_t i = 0; i < arraysize(kISOLevel5ShiftLayoutIds); ++i) {
if (current_layout_name_ == kISOLevel5ShiftLayoutIds[i])
return true;
}
return false;
}
bool XKeyboardImpl::IsAltGrAvailable() const {
for (size_t i = 0; i < arraysize(kAltGrLayoutIds); ++i) {
if (current_layout_name_ == kAltGrLayoutIds[i])
return true;
}
return false;
}
bool XKeyboardImpl::SetAutoRepeatEnabled(bool enabled) {
if (enabled)
XAutoRepeatOn(GetXDisplay());
else
XAutoRepeatOff(GetXDisplay());
DVLOG(1) << "Set auto-repeat mode to: " << (enabled ? "on" : "off");
return true;
}
bool XKeyboardImpl::SetAutoRepeatRate(const AutoRepeatRate& rate) {
DVLOG(1) << "Set auto-repeat rate to: "
<< rate.initial_delay_in_ms << " ms delay, "
<< rate.repeat_interval_in_ms << " ms interval";
if (XkbSetAutoRepeatRate(GetXDisplay(), XkbUseCoreKbd,
rate.initial_delay_in_ms,
rate.repeat_interval_in_ms) != True) {
DVLOG(1) << "Failed to set auto-repeat rate";
return false;
}
return true;
}
void XKeyboardImpl::SetCapsLockEnabled(bool enable_caps_lock) {
bool old_state = current_caps_lock_status_;
SetLockedModifiers(enable_caps_lock);
if (old_state != enable_caps_lock) {
FOR_EACH_OBSERVER(XKeyboard::Observer, observers_,
OnCapsLockChanged(enable_caps_lock));
}
}
bool XKeyboardImpl::SetCurrentKeyboardLayoutByName(
const std::string& layout_name) {
if (SetLayoutInternal(layout_name, false)) {
current_layout_name_ = layout_name;
return true;
}
return false;
}
bool XKeyboardImpl::ReapplyCurrentKeyboardLayout() {
if (current_layout_name_.empty()) {
DVLOG(1) << "Can't reapply XKB layout: layout unknown";
return false;
}
return SetLayoutInternal(current_layout_name_, true /* force */);
}
void XKeyboardImpl::ReapplyCurrentModifierLockStatus() {
SetLockedModifiers(current_caps_lock_status_);
}
void XKeyboardImpl::DisableNumLock() {
SetCapsLockEnabled(current_caps_lock_status_);
}
void XKeyboardImpl::OnSetLayoutFinish() {
if (execute_queue_.empty()) {
DVLOG(1) << "OnSetLayoutFinish: execute_queue_ is empty. "
<< "base::LaunchProcess failed?";
return;
}
execute_queue_.pop();
MaybeExecuteSetLayoutCommand();
}
} // namespace
// static
bool XKeyboard::GetAutoRepeatEnabledForTesting() {
XKeyboardState state = {};
XGetKeyboardControl(GetXDisplay(), &state);
return state.global_auto_repeat != AutoRepeatModeOff;
}
// static
bool XKeyboard::GetAutoRepeatRateForTesting(AutoRepeatRate* out_rate) {
return XkbGetAutoRepeatRate(GetXDisplay(), XkbUseCoreKbd,
&(out_rate->initial_delay_in_ms),
&(out_rate->repeat_interval_in_ms)) == True;
}
// static
bool XKeyboard::CheckLayoutNameForTesting(const std::string& layout_name) {
return CheckLayoutName(layout_name);
}
// static
XKeyboard* XKeyboard::Create() {
return new XKeyboardImpl();
}
} // namespace input_method
} // namespace chromeos
| {
"content_hash": "c81ce087d01dbaa73d23fba1cc13a139",
"timestamp": "",
"source": "github",
"line_count": 465,
"max_line_length": 80,
"avg_line_length": 29.640860215053763,
"alnum_prop": 0.684756584197925,
"repo_name": "patrickm/chromium.src",
"id": "8f2adc824563dc275612747b8997e67f4658e3c3",
"size": "13783",
"binary": false,
"copies": "1",
"ref": "refs/heads/nw",
"path": "chromeos/ime/xkeyboard.cc",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "ASP",
"bytes": "853"
},
{
"name": "AppleScript",
"bytes": "6973"
},
{
"name": "Arduino",
"bytes": "464"
},
{
"name": "Assembly",
"bytes": "52960"
},
{
"name": "Awk",
"bytes": "8660"
},
{
"name": "C",
"bytes": "40737238"
},
{
"name": "C#",
"bytes": "1132"
},
{
"name": "C++",
"bytes": "207930633"
},
{
"name": "CSS",
"bytes": "939170"
},
{
"name": "Java",
"bytes": "5844934"
},
{
"name": "JavaScript",
"bytes": "17837835"
},
{
"name": "Mercury",
"bytes": "10533"
},
{
"name": "Objective-C",
"bytes": "886228"
},
{
"name": "Objective-C++",
"bytes": "6667789"
},
{
"name": "PHP",
"bytes": "97817"
},
{
"name": "Perl",
"bytes": "672770"
},
{
"name": "Python",
"bytes": "10857933"
},
{
"name": "Rebol",
"bytes": "262"
},
{
"name": "Shell",
"bytes": "1326032"
},
{
"name": "Tcl",
"bytes": "277091"
},
{
"name": "XSLT",
"bytes": "13493"
},
{
"name": "nesC",
"bytes": "15206"
}
],
"symlink_target": ""
} |
namespace geofeatures_boost {} namespace boost = geofeatures_boost; namespace geofeatures_boost { namespace numeric
{
template<class S>
struct Trunc
{
typedef S source_type ;
typedef typename mpl::if_< is_arithmetic<S>,S,S const&>::type argument_type ;
static source_type nearbyint ( argument_type s )
{
#if !defined(BOOST_NO_STDC_NAMESPACE)
using std::floor ;
using std::ceil ;
#endif
return s < static_cast<S>(0) ? ceil(s) : floor(s) ;
}
typedef mpl::integral_c< std::float_round_style, std::round_toward_zero> round_style ;
} ;
template<class S>
struct Floor
{
typedef S source_type ;
typedef typename mpl::if_< is_arithmetic<S>,S,S const&>::type argument_type ;
static source_type nearbyint ( argument_type s )
{
#if !defined(BOOST_NO_STDC_NAMESPACE)
using std::floor ;
#endif
return floor(s) ;
}
typedef mpl::integral_c< std::float_round_style, std::round_toward_neg_infinity> round_style ;
} ;
template<class S>
struct Ceil
{
typedef S source_type ;
typedef typename mpl::if_< is_arithmetic<S>,S,S const&>::type argument_type ;
static source_type nearbyint ( argument_type s )
{
#if !defined(BOOST_NO_STDC_NAMESPACE)
using std::ceil ;
#endif
return ceil(s) ;
}
typedef mpl::integral_c< std::float_round_style, std::round_toward_infinity> round_style ;
} ;
template<class S>
struct RoundEven
{
typedef S source_type ;
typedef typename mpl::if_< is_arithmetic<S>,S,S const&>::type argument_type ;
static source_type nearbyint ( argument_type s )
{
// Algorithm contributed by Guillaume Melquiond
#if !defined(BOOST_NO_STDC_NAMESPACE)
using std::floor ;
using std::ceil ;
#endif
// only works inside the range not at the boundaries
S prev = floor(s);
S next = ceil(s);
S rt = (s - prev) - (next - s); // remainder type
S const zero(0.0);
S const two(2.0);
if ( rt < zero )
return prev;
else if ( rt > zero )
return next;
else
{
bool is_prev_even = two * floor(prev / two) == prev ;
return ( is_prev_even ? prev : next ) ;
}
}
typedef mpl::integral_c< std::float_round_style, std::round_to_nearest> round_style ;
} ;
enum range_check_result
{
cInRange = 0 ,
cNegOverflow = 1 ,
cPosOverflow = 2
} ;
class bad_numeric_cast : public std::bad_cast
{
public:
virtual const char * what() const throw()
{ return "bad numeric conversion: overflow"; }
};
class negative_overflow : public bad_numeric_cast
{
public:
virtual const char * what() const throw()
{ return "bad numeric conversion: negative overflow"; }
};
class positive_overflow : public bad_numeric_cast
{
public:
virtual const char * what() const throw()
{ return "bad numeric conversion: positive overflow"; }
};
struct def_overflow_handler
{
void operator() ( range_check_result r ) // throw(negative_overflow,positive_overflow)
{
#ifndef BOOST_NO_EXCEPTIONS
if ( r == cNegOverflow )
throw negative_overflow() ;
else if ( r == cPosOverflow )
throw positive_overflow() ;
#else
if ( r == cNegOverflow )
::geofeatures_boost::throw_exception(negative_overflow()) ;
else if ( r == cPosOverflow )
::geofeatures_boost::throw_exception(positive_overflow()) ;
#endif
}
} ;
struct silent_overflow_handler
{
void operator() ( range_check_result ) {} // throw()
} ;
template<class Traits>
struct raw_converter
{
typedef typename Traits::result_type result_type ;
typedef typename Traits::argument_type argument_type ;
static result_type low_level_convert ( argument_type s ) { return static_cast<result_type>(s) ; }
} ;
struct UseInternalRangeChecker {} ;
} } // namespace geofeatures_boost::numeric
#endif
| {
"content_hash": "27e2ef7fcf90475034d4f896403df0f0",
"timestamp": "",
"source": "github",
"line_count": 170,
"max_line_length": 115,
"avg_line_length": 22.158823529411766,
"alnum_prop": 0.6570215025219007,
"repo_name": "sachindeorah/geofeatures",
"id": "830b7d841cab555d14fe8acc7bb661387d434f64",
"size": "4586",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "GeoFeatures/boost/numeric/conversion/converter_policies.hpp",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "C",
"bytes": "163405"
},
{
"name": "C++",
"bytes": "19516286"
},
{
"name": "CSS",
"bytes": "31169"
},
{
"name": "HTML",
"bytes": "1116920"
},
{
"name": "JavaScript",
"bytes": "38071"
},
{
"name": "Makefile",
"bytes": "1537"
},
{
"name": "Objective-C",
"bytes": "256214"
},
{
"name": "Objective-C++",
"bytes": "100588"
},
{
"name": "Perl",
"bytes": "1297"
},
{
"name": "Ruby",
"bytes": "1827"
},
{
"name": "Shell",
"bytes": "9174"
},
{
"name": "TeX",
"bytes": "197791"
}
],
"symlink_target": ""
} |
Learn C stuff in less than 7 days
Check https://github.com/STB1019/SkullOfSummer/wiki to access the manual of the skull
| {
"content_hash": "ddde30d0f7cb32e13b92ae14afc79165",
"timestamp": "",
"source": "github",
"line_count": 3,
"max_line_length": 85,
"avg_line_length": 40.666666666666664,
"alnum_prop": 0.7868852459016393,
"repo_name": "STB1019/SkullOfSummer",
"id": "50f8441a87b66b0a7d47eaa0eacf4b72e6a48888",
"size": "139",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "README.md",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Assembly",
"bytes": "3125"
},
{
"name": "C",
"bytes": "176639"
},
{
"name": "C++",
"bytes": "93"
},
{
"name": "CMake",
"bytes": "2737"
},
{
"name": "Makefile",
"bytes": "705"
},
{
"name": "Shell",
"bytes": "1532"
}
],
"symlink_target": ""
} |
using System.Data.Entity.Migrations;
namespace MyFishEye.Entities.Migrations
{
public partial class SecondShoot : DbMigration
{
public override void Up()
{
DropIndex("dbo.UserGroup", "IX_UserGroup_Description");
}
public override void Down()
{
CreateIndex("dbo.UserGroup", "Description", unique: true, name: "IX_UserGroup_Description");
}
}
}
| {
"content_hash": "28176f29ffb2e991f1fbb71d38c11878",
"timestamp": "",
"source": "github",
"line_count": 17,
"max_line_length": 104,
"avg_line_length": 25.705882352941178,
"alnum_prop": 0.5995423340961098,
"repo_name": "danieleperugini/ASP-NET-MVC-Custom-Identity-Authentication",
"id": "eec4e6e74539911d44080e8cda6df3de64124b44",
"size": "437",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "MyFishEye.Entities/Migrations/201412081443473_SecondShoot.cs",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "ASP",
"bytes": "111"
},
{
"name": "C#",
"bytes": "115291"
},
{
"name": "CSS",
"bytes": "513"
},
{
"name": "JavaScript",
"bytes": "10714"
}
],
"symlink_target": ""
} |
<?php
declare(strict_types=1);
namespace bovigo\vfs;
use function class_alias;
use function clearstatcache;
use function strlen;
use function strncmp;
use function strstr;
use function time;
/**
* Base stream contents container.
*/
abstract class vfsStreamAbstractContent implements vfsStreamContent
{
/**
* name of the container
*
* @var string
*/
protected $name;
/**
* type of the container
*
* @var int
*/
protected $type;
/**
* timestamp of last access
*
* @var int
*/
protected $lastAccessed;
/**
* timestamp of last attribute modification
*
* @var int
*/
protected $lastAttributeModified;
/**
* timestamp of last modification
*
* @var int
*/
protected $lastModified;
/**
* permissions for content
*
* @var int
*/
protected $permissions;
/**
* owner of the file
*
* @var int
*/
protected $user;
/**
* owner group of the file
*
* @var int
*/
protected $group;
/**
* path to to this content
*
* @var string|null
*/
private $parentPath;
/**
* constructor
*
* @param int|null $permissions optional
*/
public function __construct(string $name, ?int $permissions = null)
{
if (strstr($name, '/') !== false) {
throw new vfsStreamException('Name can not contain /.');
}
$this->name = $name;
$time = time();
if ($permissions === null) {
$permissions = $this->getDefaultPermissions() & ~vfsStream::umask();
}
$this->lastAccessed = $time;
$this->lastAttributeModified = $time;
$this->lastModified = $time;
$this->permissions = $permissions;
$this->user = vfsStream::getCurrentUser();
$this->group = vfsStream::getCurrentGroup();
}
/**
* returns default permissions for concrete implementation
*
* @since 0.8.0
*/
abstract protected function getDefaultPermissions(): int;
/**
* returns the file name of the content
*/
public function getName(): string
{
return $this->name;
}
/**
* renames the content
*/
public function rename(string $newName): void
{
if (strstr($newName, '/') !== false) {
throw new vfsStreamException('Name can not contain /.');
}
$this->name = $newName;
}
/**
* checks whether the container can be applied to given name
*/
public function appliesTo(string $name): bool
{
if ($name === $this->name) {
return true;
}
$segment_name = $this->name . '/';
return strncmp($segment_name, $name, strlen($segment_name)) === 0;
}
/**
* returns the type of the container
*/
public function getType(): int
{
return $this->type;
}
/**
* sets the last modification time of the stream content
*/
public function lastModified(int $filemtime): vfsStreamContent
{
$this->lastModified = $filemtime;
return $this;
}
/**
* returns the last modification time of the stream content
*/
public function filemtime(): int
{
return $this->lastModified;
}
/**
* sets last access time of the stream content
*
* @since 0.9
*/
public function lastAccessed(int $fileatime): vfsStreamContent
{
$this->lastAccessed = $fileatime;
return $this;
}
/**
* returns the last access time of the stream content
*
* @since 0.9
*/
public function fileatime(): int
{
return $this->lastAccessed;
}
/**
* sets the last attribute modification time of the stream content
*
* @since 0.9
*/
public function lastAttributeModified(int $filectime): vfsStreamContent
{
$this->lastAttributeModified = $filectime;
return $this;
}
/**
* returns the last attribute modification time of the stream content
*
* @since 0.9
*/
public function filectime(): int
{
return $this->lastAttributeModified;
}
/**
* adds content to given container
*/
public function at(vfsStreamContainer $container): vfsStreamContent
{
$container->addChild($this);
return $this;
}
/**
* change file mode to given permissions
*/
public function chmod(int $permissions): vfsStreamContent
{
$this->permissions = $permissions;
$this->lastAttributeModified = time();
clearstatcache();
return $this;
}
/**
* returns permissions
*/
public function getPermissions(): int
{
return $this->permissions;
}
/**
* checks whether content is readable
*
* @param int $user id of user to check for
* @param int $group id of group to check for
*/
public function isReadable(int $user, int $group): bool
{
if ($this->user === $user) {
$check = 0400;
} elseif ($this->group === $group) {
$check = 0040;
} else {
$check = 0004;
}
return (bool) ($this->permissions & $check);
}
/**
* checks whether content is writable
*
* @param int $user id of user to check for
* @param int $group id of group to check for
*/
public function isWritable(int $user, int $group): bool
{
if ($this->user === $user) {
$check = 0200;
} elseif ($this->group === $group) {
$check = 0020;
} else {
$check = 0002;
}
return (bool) ($this->permissions & $check);
}
/**
* checks whether content is executable
*
* @param int $user id of user to check for
* @param int $group id of group to check for
*/
public function isExecutable(int $user, int $group): bool
{
if ($this->user === $user) {
$check = 0100;
} elseif ($this->group === $group) {
$check = 0010;
} else {
$check = 0001;
}
return (bool) ($this->permissions & $check);
}
/**
* change owner of file to given user
*/
public function chown(int $user): vfsStreamContent
{
$this->user = $user;
$this->lastAttributeModified = time();
return $this;
}
/**
* checks whether file is owned by given user
*/
public function isOwnedByUser(int $user): bool
{
return $this->user === $user;
}
/**
* returns owner of file
*/
public function getUser(): int
{
return $this->user;
}
/**
* change owner group of file to given group
*/
public function chgrp(int $group): vfsStreamContent
{
$this->group = $group;
$this->lastAttributeModified = time();
return $this;
}
/**
* checks whether file is owned by group
*/
public function isOwnedByGroup(int $group): bool
{
return $this->group === $group;
}
/**
* returns owner group of file
*/
public function getGroup(): int
{
return $this->group;
}
/**
* sets parent path
*
* @internal only to be set by parent
*
* @since 1.2.0
*/
public function setParentPath(string $parentPath): void
{
$this->parentPath = $parentPath;
}
/**
* removes parent path
*
* @internal only to be set by parent
*
* @since 2.0.0
*/
public function removeParentPath(): void
{
$this->parentPath = null;
}
/**
* returns path to this content
*
* @since 1.2.0
*/
public function path(): string
{
if ($this->parentPath === null) {
return $this->name;
}
return $this->parentPath . '/' . $this->name;
}
/**
* returns complete vfsStream url for this content
*
* @since 1.2.0
*/
public function url(): string
{
return vfsStream::url($this->path());
}
}
class_alias('bovigo\vfs\vfsStreamAbstractContent', 'org\bovigo\vfs\vfsStreamAbstractContent');
| {
"content_hash": "44b884f434352d344e45a4299df10cdb",
"timestamp": "",
"source": "github",
"line_count": 402,
"max_line_length": 94,
"avg_line_length": 20.945273631840795,
"alnum_prop": 0.5309976247030879,
"repo_name": "mikey179/vfsStream",
"id": "f448bfe63e91f81bdce8a21078751eb7aa1b0c8f",
"size": "8592",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/vfsStreamAbstractContent.php",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "PHP",
"bytes": "306138"
}
],
"symlink_target": ""
} |
<!doctype html>
<html class="default no-js">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>CTEBeamFollow | demofile</title>
<meta name="description" content="Documentation for demofile">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="../assets/css/main.css">
</head>
<body>
<header>
<div class="tsd-page-toolbar">
<div class="container">
<div class="table-wrap">
<div class="table-cell" id="tsd-search" data-index="../assets/js/search.json" data-base="..">
<div class="field">
<label for="tsd-search-field" class="tsd-widget search no-caption">Search</label>
<input id="tsd-search-field" type="text" />
</div>
<ul class="results">
<li class="state loading">Preparing search index...</li>
<li class="state failure">The search index is not available</li>
</ul>
<a href="../index.html" class="title">demofile</a>
</div>
<div class="table-cell" id="tsd-widgets">
<div id="tsd-filter">
<a href="#" class="tsd-widget options no-caption" data-toggle="options">Options</a>
<div class="tsd-filter-group">
<div class="tsd-select" id="tsd-filter-visibility">
<span class="tsd-select-label">All</span>
<ul class="tsd-select-list">
<li data-value="public">Public</li>
<li data-value="protected">Public/Protected</li>
<li data-value="private" class="selected">All</li>
</ul>
</div>
<input type="checkbox" id="tsd-filter-inherited" checked />
<label class="tsd-widget" for="tsd-filter-inherited">Inherited</label>
<input type="checkbox" id="tsd-filter-externals" checked />
<label class="tsd-widget" for="tsd-filter-externals">Externals</label>
<input type="checkbox" id="tsd-filter-only-exported" />
<label class="tsd-widget" for="tsd-filter-only-exported">Only exported</label>
</div>
</div>
<a href="#" class="tsd-widget menu no-caption" data-toggle="menu">Menu</a>
</div>
</div>
</div>
</div>
<div class="tsd-page-title">
<div class="container">
<ul class="tsd-breadcrumb">
<li>
<a href="../globals.html">Globals</a>
</li>
<li>
<a href="../modules/_sendtabletypes_.html">"sendtabletypes"</a>
</li>
<li>
<a href="_sendtabletypes_.ctebeamfollow.html">CTEBeamFollow</a>
</li>
</ul>
<h1>Interface CTEBeamFollow</h1>
</div>
</div>
</header>
<div class="container container-main">
<div class="row">
<div class="col-8 col-content">
<section class="tsd-panel tsd-hierarchy">
<h3>Hierarchy</h3>
<ul class="tsd-hierarchy">
<li>
<span class="target">CTEBeamFollow</span>
</li>
</ul>
</section>
<section class="tsd-panel-group tsd-index-group">
<h2>Index</h2>
<section class="tsd-panel tsd-index-panel">
<div class="tsd-index-content">
<section class="tsd-index-section ">
<h3>Properties</h3>
<ul class="tsd-index-list">
<li class="tsd-kind-property tsd-parent-kind-interface"><a href="_sendtabletypes_.ctebeamfollow.html#dt_basebeam" class="tsd-kind-icon">DT_<wbr><wbr>Base<wbr>Beam</a></li>
<li class="tsd-kind-property tsd-parent-kind-interface"><a href="_sendtabletypes_.ctebeamfollow.html#dt_tebeamfollow" class="tsd-kind-icon">DT_<wbr>TEBeam<wbr>Follow</a></li>
</ul>
</section>
</div>
</section>
</section>
<section class="tsd-panel-group tsd-member-group ">
<h2>Properties</h2>
<section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-interface">
<a name="dt_basebeam" class="tsd-anchor"></a>
<h3>DT_<wbr><wbr>Base<wbr>Beam</h3>
<div class="tsd-signature tsd-kind-icon">DT_<wbr><wbr>Base<wbr>Beam<span class="tsd-signature-symbol">:</span> <a href="_sendtabletypes_.dt_basebeam.html" class="tsd-signature-type">DT_BaseBeam</a></div>
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/saul/demofile/blob/5327326/src/sendtabletypes.ts#L13851">src/sendtabletypes.ts:13851</a></li>
</ul>
</aside>
</section>
<section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-interface">
<a name="dt_tebeamfollow" class="tsd-anchor"></a>
<h3>DT_<wbr>TEBeam<wbr>Follow</h3>
<div class="tsd-signature tsd-kind-icon">DT_<wbr>TEBeam<wbr>Follow<span class="tsd-signature-symbol">:</span> <a href="_sendtabletypes_.dt_tebeamfollow.html" class="tsd-signature-type">DT_TEBeamFollow</a></div>
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/saul/demofile/blob/5327326/src/sendtabletypes.ts#L13852">src/sendtabletypes.ts:13852</a></li>
</ul>
</aside>
</section>
</section>
</div>
<div class="col-4 col-menu menu-sticky-wrap menu-highlight">
<nav class="tsd-navigation primary">
<ul>
<li class="globals ">
<a href="../globals.html"><em>Globals</em></a>
</li>
<li class="current tsd-kind-module">
<a href="../modules/_sendtabletypes_.html">"sendtabletypes"</a>
</li>
</ul>
</nav>
<nav class="tsd-navigation secondary menu-sticky">
<ul class="before-current">
</ul>
<ul class="current">
<li class="current tsd-kind-interface tsd-parent-kind-module">
<a href="_sendtabletypes_.ctebeamfollow.html" class="tsd-kind-icon">CTEBeam<wbr>Follow</a>
<ul>
<li class=" tsd-kind-property tsd-parent-kind-interface">
<a href="_sendtabletypes_.ctebeamfollow.html#dt_basebeam" class="tsd-kind-icon">DT_<wbr><wbr>Base<wbr>Beam</a>
</li>
<li class=" tsd-kind-property tsd-parent-kind-interface">
<a href="_sendtabletypes_.ctebeamfollow.html#dt_tebeamfollow" class="tsd-kind-icon">DT_<wbr>TEBeam<wbr>Follow</a>
</li>
</ul>
</li>
</ul>
<ul class="after-current">
</ul>
</nav>
</div>
</div>
</div>
<footer class="with-border-bottom">
<div class="container">
<h2>Legend</h2>
<div class="tsd-legend-group">
<ul class="tsd-legend">
<li class="tsd-kind-object-literal"><span class="tsd-kind-icon">Object literal</span></li>
<li class="tsd-kind-variable"><span class="tsd-kind-icon">Variable</span></li>
<li class="tsd-kind-function"><span class="tsd-kind-icon">Function</span></li>
<li class="tsd-kind-function tsd-has-type-parameter"><span class="tsd-kind-icon">Function with type parameter</span></li>
<li class="tsd-kind-type-alias"><span class="tsd-kind-icon">Type alias</span></li>
<li class="tsd-kind-type-alias tsd-has-type-parameter"><span class="tsd-kind-icon">Type alias with type parameter</span></li>
</ul>
<ul class="tsd-legend">
<li class="tsd-kind-interface"><span class="tsd-kind-icon">Interface</span></li>
<li class="tsd-kind-interface tsd-has-type-parameter"><span class="tsd-kind-icon">Interface with type parameter</span></li>
<li class="tsd-kind-property tsd-parent-kind-interface"><span class="tsd-kind-icon">Property</span></li>
</ul>
<ul class="tsd-legend">
<li class="tsd-kind-class"><span class="tsd-kind-icon">Class</span></li>
<li class="tsd-kind-class tsd-has-type-parameter"><span class="tsd-kind-icon">Class with type parameter</span></li>
</ul>
<ul class="tsd-legend">
<li class="tsd-kind-enum"><span class="tsd-kind-icon">Enumeration</span></li>
</ul>
</div>
</div>
</footer>
<div class="container tsd-generator">
<p>Generated using <a href="https://typedoc.org/" target="_blank">TypeDoc</a></p>
</div>
<div class="overlay"></div>
<script src="../assets/js/main.js"></script>
</body>
</html> | {
"content_hash": "e77c9b6ae5c97fae6cdf949320232eed",
"timestamp": "",
"source": "github",
"line_count": 184,
"max_line_length": 215,
"avg_line_length": 41.83152173913044,
"alnum_prop": 0.639599844095102,
"repo_name": "saul/demofile",
"id": "aa078cc2d234810b842ecd67b02b47bfd8c289ec",
"size": "7697",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "docs/interfaces/_sendtabletypes_.ctebeamfollow.html",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "HTML",
"bytes": "2579"
},
{
"name": "JavaScript",
"bytes": "5880001"
},
{
"name": "Shell",
"bytes": "735"
},
{
"name": "TypeScript",
"bytes": "1675150"
}
],
"symlink_target": ""
} |
An IMaterialDefinition object represents a material definition in the game. A Material Definition is needed if you want to create a new block.
# 导入相关包
It might be required for you to import the package if you encounter any issues, so better be safe than sorry and add the import.
`import mods.contenttweaker.BlockMaterial;`
## Calling an IMaterialDefinition object
You can get such an object using the [Block Material Bracket Handler](/Mods/ContentTweaker/Vanilla/Brackets/Bracket_Block_Material/):
`<blockmaterial:wood>`
## 不带参数的 ZenGetters/ZenMethods
| ZenGetter | ZenMethod | 返回值类型 |
| --------------- | ------------------- | ---------------------------------------------------------------------- |
| blocksLight | blocksLight() | bool |
| blocksMovement | blocksMovement() | bool |
| canBurn | getCanBurn() | bool |
| mobilityFlag | getMobilityFlag() | [PushReaction](/Mods/ContentTweaker/Vanilla/Types/Block/PushReaction/) |
| liquid | isLiquid() | bool |
| opaque | isOpaque() | bool |
| replaceable | isReplaceable() | bool |
| solid | isSolid() | bool |
| toolNotRequired | isToolNotRequired() | bool |
## Compare two BlockMaterials
You can use the `==` operator to see if two MaterialDefinitions are equal
```zenscript
if(materialA == materialB)
print("success!");
``` | {
"content_hash": "8d67479e6e0f6b1cf0360a3a4dce624b",
"timestamp": "",
"source": "github",
"line_count": 34,
"max_line_length": 142,
"avg_line_length": 58.85294117647059,
"alnum_prop": 0.4362818590704648,
"repo_name": "jaredlll08/CraftTweaker-Documentation",
"id": "4ab69526e460d4c16b5c5ce8f76333c09054e873",
"size": "2054",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "translations/zh/docs/Mods/ContentTweaker/Vanilla/Types/Block/IMaterialDefinition.md",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "195475"
},
{
"name": "HTML",
"bytes": "11110"
},
{
"name": "JavaScript",
"bytes": "155278"
}
],
"symlink_target": ""
} |
> see https://aka.ms/autorest
This is the AutoRest configuration file for managedApplication.
## Getting Started
To build the SDKs for My API, simply install AutoRest via `npm` (`npm install -g autorest`) and then run:
> `autorest readme.md`
To see additional help and options, run:
> `autorest --help`
For other options on installation see [Installing AutoRest](https://aka.ms/autorest/install) on the AutoRest github page.
---
## Configuration
### Basic Information
These are the global settings for the managedApplication.
```yaml
openapi-type: arm
openapi-subtype: rpaas
tag: package-managedapplications-2021-07
```
``` yaml $(package-managedapplications)
tag: package-managedapplications-2021-07
```
### Tag: package-managedapplications-2021-07
These settings apply only when `--tag=package-managedapplications-2021-07` is specified on the command line.
``` yaml $(tag) == 'package-managedapplications-2021-07'
input-file:
- Microsoft.Solutions/stable/2021-07-01/managedapplications.json
```
### Tag: package-managedapplications-2021-02
These settings apply only when `--tag=package-managedapplications-2021-02` is specified on the command line.
``` yaml $(tag) == 'package-managedapplications-2021-02'
input-file:
- Microsoft.Solutions/preview/2021-02-01-preview/managedapplications.json
```
### Tag: package-managedapplications-2020-08
These settings apply only when `--tag=package-managedapplications-2020-08` is specified on the command line.
``` yaml $(tag) == 'package-managedapplications-2020-08'
input-file:
- Microsoft.Solutions/preview/2020-08-21-preview/managedapplications.json
```
### Tag: package-managedapplications-2019-07
These settings apply only when `--tag=package-managedapplications-2019-07` is specified on the command line.
``` yaml $(tag) == 'package-managedapplications-2019-07'
input-file:
- Microsoft.Solutions/stable/2019-07-01/managedapplications.json
```
### Tag: package-managedapplications-2018-09
These settings apply only when `--tag=package-managedapplications-2018-09` is specified on the command line.
``` yaml $(tag) == 'package-managedapplications-2018-09'
input-file:
- Microsoft.Solutions/preview/2018-09-01-preview/managedapplications.json
```
### Tag: package-managedapplications-2018-06
These settings apply only when `--tag=package-managedapplications-2018-06` is specified on the command line.
``` yaml $(tag) == 'package-managedapplications-2018-06'
input-file:
- Microsoft.Solutions/stable/2018-06-01/managedapplications.json
```
### Tag: package-managedapplications-2018-03
These settings apply only when `--tag=package-managedapplications-2018-03` is specified on the command line.
``` yaml $(tag) == 'package-managedapplications-2018-03'
input-file:
- Microsoft.Solutions/stable/2018-03-01/managedapplications.json
```
### Tag: package-managedapplications-2018-02
These settings apply only when `--tag=package-managedapplications-2018-02` is specified on the command line.
``` yaml $(tag) == 'package-managedapplications-2018-02'
input-file:
- Microsoft.Solutions/stable/2018-02-01/managedapplications.json
```
### Tag: package-managedapplications-2017-12
These settings apply only when `--tag=package-managedapplications-2017-12` is specified on the command line.
``` yaml $(tag) == 'package-managedapplications-2017-12'
input-file:
- Microsoft.Solutions/stable/2017-12-01/managedapplications.json
```
### Tag: package-managedapplications-2017-09
These settings apply only when `--tag=package-managedapplications-2017-09` is specified on the command line.
``` yaml $(tag) == 'package-managedapplications-2017-09'
input-file:
- Microsoft.Solutions/stable/2017-09-01/managedapplications.json
```
---
# Code Generation
## Swagger to SDK
This section describes what SDK should be generated by the automatic system.
This is not used by Autorest itself.
```yaml $(swagger-to-sdk)
swagger-to-sdk:
- repo: azure-sdk-for-python-track2
- repo: azure-sdk-for-java
- repo: azure-sdk-for-go
- repo: azure-sdk-for-js
- repo: azure-sdk-for-ruby
after_scripts:
- bundle install && rake arm:regen_all_profiles['azure_mgmt_managedApplication']
- repo: azure-powershell
```
## Go
See configuration in [readme.go.md](./readme.go.md)
## Python
See configuration in [readme.python.md](./readme.python.md)
## Ruby
See configuration in [readme.ruby.md](./readme.ruby.md)
## TypeScript
See configuration in [readme.typescript.md](./readme.typescript.md)
## CSharp
See configuration in [readme.csharp.md](./readme.csharp.md)
| {
"content_hash": "5f8f0ce360666cda399ae81fde015abc",
"timestamp": "",
"source": "github",
"line_count": 165,
"max_line_length": 121,
"avg_line_length": 27.503030303030304,
"alnum_prop": 0.753415601586602,
"repo_name": "solankisamir/azure-rest-api-specs",
"id": "1771900ef1d2d76fd2358417f0bb007193ed4317",
"size": "4560",
"binary": false,
"copies": "2",
"ref": "refs/heads/main",
"path": "specification/solutions/resource-manager/readme.md",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Dockerfile",
"bytes": "306"
},
{
"name": "Shell",
"bytes": "617"
},
{
"name": "TypeScript",
"bytes": "5417"
}
],
"symlink_target": ""
} |
using System;
// Task Description:
// Create console application that prints your first and last name, each at a separate line.
namespace FirstAndLastName
{
class FirstAndLastName
{
static void Main()
{
string FirstName = "Vesela";
string LastName = "Karkova";
Console.WriteLine("My first name is {0}.", FirstName);
Console.WriteLine("My last name is {0}.", LastName);
}
}
}
| {
"content_hash": "d6c42492890ed77dc601ed85bf08e174",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 92,
"avg_line_length": 26.333333333333332,
"alnum_prop": 0.5843881856540084,
"repo_name": "VesKark/Telerik-Academy-BG",
"id": "995bb10625f6710264aaae857707c028dd2f3a61",
"size": "476",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "Programming with C#/C# - Part 1/01-Intro-Programming-Homework/FirstAndLastName/FirstAndLastName.cs",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C#",
"bytes": "208599"
}
],
"symlink_target": ""
} |
layout: post
title: Unraid Server Setup
subtitle: file storage and much more...
date: 2021-01-30
background: /img/headers/maligne_lake4.jpg
comments: true
published: true
---
Having run a [basic media server](/2018/01/19/private_media_server/) on an old Ubuntu box for a few years now, I found some time over the holidays to move into a more spacious system running [Unraid](https://unraid.net/).
Building upon a solid Linux core, Unraid is a network-attached storage (NAS) product that excels at serving media, particularly handy for home users. It allows growth by adding mismatched hard-drives over time. Docker containers offer all the required media services.
# Hardware
As this storage device is not a [gaming PC](/2019/07/16/zen2_pc_gaming/), you're better to run Unraid on many CPU cores with lots of drives, neither of which need to be blazing fast. In my case, I had a spare tower with dual CPUs (12 cores with 24 threads).
<img src="/img/posts/unraid_server_setup_processor.png" class="img-fluid" />
To allow for many Docker containers and a few VMs, its got 48 GB of ECC RAM:
<img src="/img/posts/unraid_server_setup_memory.png" class="img-fluid" />
I added a UPS to deal with brown-outs and black-outs, monitored by Unraid:
<img src="/img/posts/unraid_server_setup_power.png" class="img-fluid" />
It also has an old Quadro GPU, but that's [another story](/2021/02/02/unraid-gpu-passthru).
# Array Setup
Unraid itself runs in RAM, [booting off a USB thumb-drive](https://wiki.unraid.net/UnRAID_6/Getting_Started). After updating the BIOS settings to ignore disks in the boot order, I was able to access the Unraid GUI via web browser. With a 30 day trial, I started to test with a new 8 TB shucked drive for [parity](https://wiki.unraid.net/UnRAID_6/Storage_Management#Parity_Disks), a single 2 TB hard disk, and a small 240 GB SSD for cache.
As testing progressed, I continued to add hard-drives, [pre-clearing](https://wiki.unraid.net/UnRAID_6/Storage_Management#Clear_v_Pre-Clear) them first, then rolling them into the array:
<img src="/img/posts/unraid_server_setup_array.png" class="img-fluid" />
As shown above, I'm now up to 27 TB in the array, with data redundancy provided by the 8 TB parity disk. The oldest drive is a WD Green 1 TB from 2008!
# Cache Setup
While Unraid excels at growing a heterogenous storage array over time, these mismatched disks will not handle writes as fast as a homogenous array of fast ZFS disks on FreeNAS for example. To make up for this, Unraid uses a cache pool of SSD drives. I started with a single Kingston SSD, but added a 2nd to make a redundant pair.
<img src="/img/posts/unraid_server_setup_cache.png" class="img-fluid" />
# File Shares
As a storage array, Unraid comes with a few file shares already setup:
* appdata: resides solely on the Cache and is used by Docker containers for databases etc.
* domains: also on the fast Cache, holds the disks of virtual machines
* isos: good spot for holding ISO images
* system: used by Unraid itself, though most of Unraid runs in RAM for speed.
<img src="/img/posts/unraid_server_setup_shares.png" class="img-fluid" />
I added a couple more:
* data: My general storage share, which is set to write to Cache for speed, but Mover pushes changes to the full sized array overnight. Available via both SMB and NFS to my network.
* backups: Used to hold Urbackup data, writes slowly to the array as needed. Not shared via SMB/NFS to prevent ransomware from encrypting my backups.
# Docker Containers
Unraid makes it really easy to run and update all sorts of Docker containers. For basic media server, I'm following this [guide](https://trash-guides.info/Misc/how-to-set-up-hardlinks-and-atomic-moves/):
<img src="/img/posts/unraid_server_setup_docker.png" class="img-fluid" />
Swag provides reverse-proxy and Organizr tabs it all together. I've also added [Urbackup](https://www.urbackup.org/) to backup computers on my network, and [AMP](https://cubecoders.com/AMP) to [run Minecraft servers](/2020/06/03/minecraft-servers/).
# Conclusions
Overall, I'm really impressed with Unraid. It's been on my list to try for years, but I kept putting it off. We'll see how it holds up in the coming months and years, but for the price, it seems to offer a lot of value. It's done an excellent job of taking over as my media server. I hope to explore additional projects my adding more containers and VMs in the future.
### More in this series...
* [Unraid GPU Passthrough](/2021/02/02/unraid-gpu-passthru) - failed attempt
* [Unraid Urbackup](/2021/03/15/unraid-urbackup) - household backups
* [Unraid Chia](/2021/04/30/unraid-chia-plotting-farming) - plotting and farming
| {
"content_hash": "0d06f6bf549cc415ed1cf81effe8176d",
"timestamp": "",
"source": "github",
"line_count": 74,
"max_line_length": 440,
"avg_line_length": 63.648648648648646,
"alnum_prop": 0.7573248407643313,
"repo_name": "guydavis/guydavis.github.io",
"id": "dc761ac9350be436f84d2d9ab4adff363735f99b",
"size": "4714",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "_posts/2021-01-30-unraid-server-setup.markdown",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Batchfile",
"bytes": "92"
},
{
"name": "CSS",
"bytes": "8900"
},
{
"name": "HTML",
"bytes": "25851"
},
{
"name": "JavaScript",
"bytes": "60"
},
{
"name": "Ruby",
"bytes": "1184"
},
{
"name": "SCSS",
"bytes": "198"
},
{
"name": "Shell",
"bytes": "105"
}
],
"symlink_target": ""
} |
using System;
using PdfSharp.Charting;
namespace MigraDoc.Rendering.ChartMapper
{
/// <summary>
/// The XValuesMapper class.
/// </summary>
public class XValuesMapper
{
/// <summary>
/// Initializes a new instance of the <see cref="XValuesMapper"/> class.
/// </summary>
public XValuesMapper()
{
}
void MapObject(XValues xValues, MigraDoc.DocumentObjectModel.Shapes.Charts.XValues domXValues)
{
foreach (MigraDoc.DocumentObjectModel.Shapes.Charts.XSeries domXSeries in domXValues)
{
XSeries xSeries = xValues.AddXSeries();
MigraDoc.DocumentObjectModel.Shapes.Charts.XSeriesElements domXSeriesElements = domXSeries.GetValue("XSeriesElements") as MigraDoc.DocumentObjectModel.Shapes.Charts.XSeriesElements;
foreach (MigraDoc.DocumentObjectModel.Shapes.Charts.XValue domXValue in domXSeriesElements)
{
if (domXValue == null)
xSeries.AddBlank();
else
xSeries.Add(domXValue.GetValue("Value").ToString());
}
}
}
internal static void Map(XValues xValues, MigraDoc.DocumentObjectModel.Shapes.Charts.XValues domXValues)
{
XValuesMapper mapper = new XValuesMapper();
mapper.MapObject(xValues, domXValues);
}
}
}
| {
"content_hash": "ba046798360a633aaff849a4608e8905",
"timestamp": "",
"source": "github",
"line_count": 40,
"max_line_length": 189,
"avg_line_length": 31.975,
"alnum_prop": 0.6856919468334637,
"repo_name": "jgshumate1/Migradoc",
"id": "25b1667832241e6f51f11be4dd620ed0169b6766",
"size": "2663",
"binary": false,
"copies": "5",
"ref": "refs/heads/master",
"path": "MigraDoc/code/MigraDoc.Rendering/MigraDoc.Rendering.ChartMapper/XValuesMapper.cs",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "ASP",
"bytes": "437"
},
{
"name": "C#",
"bytes": "6237325"
},
{
"name": "CSS",
"bytes": "3141"
},
{
"name": "Shell",
"bytes": "263"
},
{
"name": "Visual Basic",
"bytes": "3628"
},
{
"name": "XSLT",
"bytes": "12347"
}
],
"symlink_target": ""
} |
NAME= vips
SRC = vips.opt
CCFLAGS := -pthread $(CCFLAGS)
LIBS := -lm -ldl -lstdc++ $(LIBS)
TX_RUNTIME_FLAGS := $(TX_RUNTIME_FLAGS) -D THRESHOLD=5000
TX_PASS_FLAGS := $(TX_PASS_FLAGS) -called-from-outside=_events_thread
TX_PASS_FLAGS := $(TX_PASS_FLAGS) -func-explicit-trans
include ../../Makefile.$(ACTION)
| {
"content_hash": "1a7bbdd84749e2999057c7c7ba2fe9a6",
"timestamp": "",
"source": "github",
"line_count": 15,
"max_line_length": 69,
"avg_line_length": 20.933333333333334,
"alnum_prop": 0.6687898089171974,
"repo_name": "tudinfse/haft",
"id": "932b69bdeac905b53706d257a947e424c1922db4",
"size": "314",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/benches/parsec/vips/Makefile",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C",
"bytes": "100395"
},
{
"name": "C++",
"bytes": "72515"
},
{
"name": "Makefile",
"bytes": "8258"
},
{
"name": "Python",
"bytes": "24099"
},
{
"name": "Shell",
"bytes": "17075"
}
],
"symlink_target": ""
} |
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ChangeListManager">
<list default="true" id="cca0973c-fb7e-4eed-b5f9-77074a29274a" name="Default" comment="">
<<<<<<< HEAD
<change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/conftest.py" />
<change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/test/test_del_group.py" />
<change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/test/test_del_user.py" />
=======
>>>>>>> origin/master
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/.idea/workspace.xml" afterPath="$PROJECT_DIR$/.idea/workspace.xml" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/fixture/application.py" afterPath="$PROJECT_DIR$/fixture/application.py" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/fixture/group.py" afterPath="$PROJECT_DIR$/fixture/group.py" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/fixture/user.py" afterPath="$PROJECT_DIR$/fixture/user.py" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/test/test_add_group.py" afterPath="$PROJECT_DIR$/test/test_add_group.py" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/test/test_add_user.py" afterPath="$PROJECT_DIR$/test/test_add_user.py" />
</list>
<option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
<option name="TRACKING_ENABLED" value="true" />
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
<option name="LAST_RESOLUTION" value="IGNORE" />
</component>
<component name="CreatePatchCommitExecutor">
<option name="PATCH_PATH" value="" />
</component>
<component name="ExecutionTargetManager" SELECTED_TARGET="default_target" />
<component name="FileEditorManager">
<leaf SIDE_TABS_SIZE_LIMIT_KEY="300">
<<<<<<< HEAD
<file leaf-file-name="conftest.py" pinned="false" current-in-tab="true">
<entry file="file://$PROJECT_DIR$/conftest.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="120">
<caret line="9" column="18" lean-forward="false" selection-start-line="9" selection-start-column="18" selection-end-line="9" selection-end-column="18" />
=======
<file leaf-file-name="test_add_group.py" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/test/test_add_group.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="225">
<caret line="15" column="0" lean-forward="true" selection-start-line="15" selection-start-column="0" selection-end-line="15" selection-end-column="0" />
>>>>>>> origin/master
<folding />
</state>
</provider>
</entry>
</file>
<file leaf-file-name="application.py" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/fixture/application.py">
<provider selected="true" editor-type-id="text-editor">
<<<<<<< HEAD
<state relative-caret-position="255">
<caret line="17" column="9" lean-forward="false" selection-start-line="17" selection-start-column="9" selection-end-line="17" selection-end-column="9" />
=======
<state relative-caret-position="345">
<caret line="23" column="0" lean-forward="true" selection-start-line="23" selection-start-column="0" selection-end-line="23" selection-end-column="0" />
>>>>>>> origin/master
<folding>
<element signature="e#0#58#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
</file>
<<<<<<< HEAD
=======
<file leaf-file-name="conftest.py" pinned="false" current-in-tab="true">
<entry file="file://$PROJECT_DIR$/conftest.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="120">
<caret line="9" column="18" lean-forward="true" selection-start-line="9" selection-start-column="18" selection-end-line="9" selection-end-column="18" />
<folding />
</state>
</provider>
</entry>
</file>
<file leaf-file-name="group.py" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/fixture/group.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="660">
<caret line="44" column="0" lean-forward="true" selection-start-line="44" selection-start-column="0" selection-end-line="44" selection-end-column="0" />
<folding />
</state>
</provider>
</entry>
</file>
<file leaf-file-name="test_del_group.py" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/test/test_del_group.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="30">
<caret line="2" column="9" lean-forward="true" selection-start-line="2" selection-start-column="9" selection-end-line="2" selection-end-column="21" />
<folding />
</state>
</provider>
</entry>
</file>
<file leaf-file-name="test_del_user.py" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/test/test_del_user.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="75">
<caret line="5" column="24" lean-forward="true" selection-start-line="5" selection-start-column="24" selection-end-line="5" selection-end-column="24" />
<folding />
</state>
</provider>
</entry>
</file>
<file leaf-file-name="session.py" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/fixture/session.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="315">
<caret line="21" column="0" lean-forward="true" selection-start-line="21" selection-start-column="0" selection-end-line="21" selection-end-column="0" />
<folding />
</state>
</provider>
</entry>
</file>
>>>>>>> origin/master
</leaf>
</component>
<component name="FileTemplateManagerImpl">
<option name="RECENT_TEMPLATES">
<list>
<option value="Python Script" />
</list>
</option>
</component>
<component name="Git.Settings">
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
</component>
<component name="IdeDocumentHistory">
<option name="CHANGED_PATHS">
<list>
<option value="$PROJECT_DIR$/1.py" />
<option value="$PROJECT_DIR$/new.py" />
<option value="$PROJECT_DIR$/user.py" />
<option value="$PROJECT_DIR$/group.py" />
<option value="$PROJECT_DIR$/test_add_group.py" />
<option value="$PROJECT_DIR$/application.py" />
<option value="$PROJECT_DIR$/test_add_user.py" />
<option value="$PROJECT_DIR$/fixture/session.py" />
<option value="$PROJECT_DIR$/test/conftest.py" />
<option value="$PROJECT_DIR$/test/test_add_group.py" />
<option value="$PROJECT_DIR$/test/test_add_user.py" />
<option value="$PROJECT_DIR$/fixture/user.py" />
<option value="$PROJECT_DIR$/fixture/group.py" />
<<<<<<< HEAD
<option value="$PROJECT_DIR$/test/test_del_group.py" />
<option value="$PROJECT_DIR$/test/test_del_user.py" />
<option value="$PROJECT_DIR$/test/conftest.py" />
<option value="$PROJECT_DIR$/test/ошибка" />
<option value="$PROJECT_DIR$/fixture/application.py" />
=======
<option value="$PROJECT_DIR$/fixture/application.py" />
<option value="$PROJECT_DIR$/test/test_del_group.py" />
<option value="$PROJECT_DIR$/test/test_del_user.py" />
>>>>>>> origin/master
<option value="$PROJECT_DIR$/conftest.py" />
</list>
</option>
</component>
<component name="ProjectFrameBounds">
<<<<<<< HEAD
<option name="x" value="39" />
<option name="y" value="23" />
<option name="width" value="1218" />
=======
<option name="x" value="57" />
<option name="y" value="54" />
<option name="width" value="1280" />
>>>>>>> origin/master
<option name="height" value="773" />
</component>
<component name="ProjectInspectionProfilesVisibleTreeState">
<entry key="Project Default">
<profile-state>
<expanded-state>
<State>
<id />
</State>
<State>
<id>General</id>
</State>
<State>
<id>Internationalization issues</id>
</State>
<State>
<id>Python</id>
</State>
</expanded-state>
</profile-state>
</entry>
</component>
<component name="ProjectLevelVcsManager">
<ConfirmationsSetting value="1" id="Add" />
</component>
<component name="ProjectView">
<navigator currentView="ProjectPane" proportions="" version="1">
<flattenPackages />
<showMembers />
<showModules />
<showLibraryContents />
<hideEmptyPackages />
<abbreviatePackageNames />
<autoscrollToSource />
<autoscrollFromSource />
<sortByType />
<manualOrder />
<foldersAlwaysOnTop value="true" />
</navigator>
<panes>
<pane id="ProjectPane">
<subPane>
<PATH>
<PATH_ELEMENT>
<option name="myItemId" value="python_training" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="python_training" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
</PATH>
<PATH>
<PATH_ELEMENT>
<option name="myItemId" value="python_training" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="python_training" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="test" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
</PATH>
<PATH>
<PATH_ELEMENT>
<option name="myItemId" value="python_training" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="python_training" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="model" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
</PATH>
<PATH>
<PATH_ELEMENT>
<option name="myItemId" value="python_training" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="python_training" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="fixture" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
</PATH>
</subPane>
</pane>
<pane id="Scratches" />
<pane id="Scope" />
</panes>
</component>
<component name="PropertiesComponent">
<property name="settings.editor.selected.configurable" value="com.jetbrains.python.configuration.PyActiveSdkModuleConfigurable" />
</component>
<component name="RecentsManager">
<key name="MoveFile.RECENT_KEYS">
<recent name="$PROJECT_DIR$" />
<<<<<<< HEAD
=======
<recent name="$PROJECT_DIR$/fixture" />
>>>>>>> origin/master
<recent name="$PROJECT_DIR$/test" />
<recent name="$PROJECT_DIR$/fixture" />
<recent name="$PROJECT_DIR$/model" />
</key>
</component>
<<<<<<< HEAD
<component name="RunManager" selected="Python tests.py.test in test_add_user.py (1)">
=======
<component name="RunManager" selected="Python tests.py.test in test">
>>>>>>> origin/master
<configuration default="false" name="py.test in test_add_group.py (1)" type="tests" factoryName="py.test" temporary="true">
<option name="INTERPRETER_OPTIONS" value="" />
<option name="PARENT_ENVS" value="true" />
<envs />
<option name="SDK_HOME" value="" />
<option name="WORKING_DIRECTORY" value="" />
<option name="IS_MODULE_SDK" value="true" />
<option name="ADD_CONTENT_ROOTS" value="true" />
<option name="ADD_SOURCE_ROOTS" value="true" />
<module name="python_training" />
<option name="SCRIPT_NAME" value="" />
<option name="CLASS_NAME" value="" />
<option name="METHOD_NAME" value="" />
<option name="FOLDER_NAME" value="" />
<option name="TEST_TYPE" value="TEST_SCRIPT" />
<option name="PATTERN" value="" />
<option name="USE_PATTERN" value="false" />
<option name="testToRun" value="$PROJECT_DIR$/test/test_add_group.py" />
<option name="keywords" value="" />
<option name="params" value="" />
<option name="USE_PARAM" value="false" />
<option name="USE_KEYWORD" value="false" />
<method />
</configuration>
<configuration default="false" name="py.test in test_add_user.py (1)" type="tests" factoryName="py.test" temporary="true">
<option name="INTERPRETER_OPTIONS" value="" />
<option name="PARENT_ENVS" value="true" />
<envs />
<option name="SDK_HOME" value="" />
<option name="WORKING_DIRECTORY" value="" />
<option name="IS_MODULE_SDK" value="true" />
<option name="ADD_CONTENT_ROOTS" value="true" />
<option name="ADD_SOURCE_ROOTS" value="true" />
<module name="python_training" />
<option name="SCRIPT_NAME" value="" />
<option name="CLASS_NAME" value="" />
<option name="METHOD_NAME" value="" />
<option name="FOLDER_NAME" value="" />
<option name="TEST_TYPE" value="TEST_SCRIPT" />
<option name="PATTERN" value="" />
<option name="USE_PATTERN" value="false" />
<option name="testToRun" value="$PROJECT_DIR$/test/test_add_user.py" />
<option name="keywords" value="" />
<option name="params" value="" />
<option name="USE_PARAM" value="false" />
<option name="USE_KEYWORD" value="false" />
<method />
</configuration>
<configuration default="false" name="py.test in test_del_group.py" type="tests" factoryName="py.test" temporary="true">
<option name="INTERPRETER_OPTIONS" value="" />
<option name="PARENT_ENVS" value="true" />
<envs />
<option name="SDK_HOME" value="" />
<option name="WORKING_DIRECTORY" value="" />
<option name="IS_MODULE_SDK" value="true" />
<option name="ADD_CONTENT_ROOTS" value="true" />
<option name="ADD_SOURCE_ROOTS" value="true" />
<module name="python_training" />
<option name="SCRIPT_NAME" value="" />
<option name="CLASS_NAME" value="" />
<option name="METHOD_NAME" value="" />
<option name="FOLDER_NAME" value="" />
<option name="TEST_TYPE" value="TEST_SCRIPT" />
<option name="PATTERN" value="" />
<option name="USE_PATTERN" value="false" />
<option name="testToRun" value="$PROJECT_DIR$/test/test_del_group.py" />
<option name="keywords" value="" />
<option name="params" value="" />
<option name="USE_PARAM" value="false" />
<option name="USE_KEYWORD" value="false" />
<method />
</configuration>
<configuration default="false" name="py.test in test_del_user.py" type="tests" factoryName="py.test" temporary="true">
<option name="INTERPRETER_OPTIONS" value="" />
<option name="PARENT_ENVS" value="true" />
<envs />
<option name="SDK_HOME" value="" />
<option name="WORKING_DIRECTORY" value="" />
<option name="IS_MODULE_SDK" value="true" />
<option name="ADD_CONTENT_ROOTS" value="true" />
<option name="ADD_SOURCE_ROOTS" value="true" />
<module name="python_training" />
<option name="SCRIPT_NAME" value="" />
<option name="CLASS_NAME" value="" />
<option name="METHOD_NAME" value="" />
<option name="FOLDER_NAME" value="" />
<option name="TEST_TYPE" value="TEST_SCRIPT" />
<option name="PATTERN" value="" />
<option name="USE_PATTERN" value="false" />
<option name="testToRun" value="$PROJECT_DIR$/test/test_del_user.py" />
<option name="keywords" value="" />
<option name="params" value="" />
<option name="USE_PARAM" value="false" />
<option name="USE_KEYWORD" value="false" />
<method />
</configuration>
<configuration default="false" name="py.test in test" type="tests" factoryName="py.test" temporary="true">
<option name="INTERPRETER_OPTIONS" value="" />
<option name="PARENT_ENVS" value="true" />
<envs />
<option name="SDK_HOME" value="" />
<option name="WORKING_DIRECTORY" value="" />
<option name="IS_MODULE_SDK" value="true" />
<option name="ADD_CONTENT_ROOTS" value="true" />
<option name="ADD_SOURCE_ROOTS" value="true" />
<module name="python_training" />
<option name="SCRIPT_NAME" value="" />
<option name="CLASS_NAME" value="" />
<option name="METHOD_NAME" value="" />
<option name="FOLDER_NAME" value="" />
<option name="TEST_TYPE" value="TEST_SCRIPT" />
<option name="PATTERN" value="" />
<option name="USE_PATTERN" value="false" />
<option name="testToRun" value="$PROJECT_DIR$/test" />
<option name="keywords" value="" />
<option name="params" value="" />
<option name="USE_PARAM" value="false" />
<option name="USE_KEYWORD" value="false" />
<method />
</configuration>
<configuration default="true" type="PythonConfigurationType" factoryName="Python">
<option name="INTERPRETER_OPTIONS" value="" />
<option name="PARENT_ENVS" value="true" />
<envs>
<env name="PYTHONUNBUFFERED" value="1" />
</envs>
<option name="SDK_HOME" value="" />
<option name="WORKING_DIRECTORY" value="" />
<option name="IS_MODULE_SDK" value="false" />
<option name="ADD_CONTENT_ROOTS" value="true" />
<option name="ADD_SOURCE_ROOTS" value="true" />
<module name="python_training" />
<option name="SCRIPT_NAME" value="" />
<option name="PARAMETERS" value="" />
<option name="SHOW_COMMAND_LINE" value="false" />
<method />
</configuration>
<configuration default="true" type="Tox" factoryName="Tox">
<option name="INTERPRETER_OPTIONS" value="" />
<option name="PARENT_ENVS" value="true" />
<envs />
<option name="SDK_HOME" value="" />
<option name="WORKING_DIRECTORY" value="" />
<option name="IS_MODULE_SDK" value="false" />
<option name="ADD_CONTENT_ROOTS" value="true" />
<option name="ADD_SOURCE_ROOTS" value="true" />
<module name="python_training" />
<method />
</configuration>
<configuration default="true" type="tests" factoryName="Attests">
<option name="INTERPRETER_OPTIONS" value="" />
<option name="PARENT_ENVS" value="true" />
<envs />
<option name="SDK_HOME" value="" />
<option name="WORKING_DIRECTORY" value="" />
<option name="IS_MODULE_SDK" value="false" />
<option name="ADD_CONTENT_ROOTS" value="true" />
<option name="ADD_SOURCE_ROOTS" value="true" />
<module name="python_training" />
<option name="SCRIPT_NAME" value="" />
<option name="CLASS_NAME" value="" />
<option name="METHOD_NAME" value="" />
<option name="FOLDER_NAME" value="" />
<option name="TEST_TYPE" value="TEST_SCRIPT" />
<option name="PATTERN" value="" />
<option name="USE_PATTERN" value="false" />
<method />
</configuration>
<configuration default="true" type="tests" factoryName="Doctests">
<option name="INTERPRETER_OPTIONS" value="" />
<option name="PARENT_ENVS" value="true" />
<envs />
<option name="SDK_HOME" value="" />
<option name="WORKING_DIRECTORY" value="" />
<option name="IS_MODULE_SDK" value="false" />
<option name="ADD_CONTENT_ROOTS" value="true" />
<option name="ADD_SOURCE_ROOTS" value="true" />
<module name="python_training" />
<option name="SCRIPT_NAME" value="" />
<option name="CLASS_NAME" value="" />
<option name="METHOD_NAME" value="" />
<option name="FOLDER_NAME" value="" />
<option name="TEST_TYPE" value="TEST_SCRIPT" />
<option name="PATTERN" value="" />
<option name="USE_PATTERN" value="false" />
<method />
</configuration>
<configuration default="true" type="tests" factoryName="Nosetests">
<option name="INTERPRETER_OPTIONS" value="" />
<option name="PARENT_ENVS" value="true" />
<envs />
<option name="SDK_HOME" value="" />
<option name="WORKING_DIRECTORY" value="" />
<option name="IS_MODULE_SDK" value="false" />
<option name="ADD_CONTENT_ROOTS" value="true" />
<option name="ADD_SOURCE_ROOTS" value="true" />
<module name="python_training" />
<option name="SCRIPT_NAME" value="" />
<option name="CLASS_NAME" value="" />
<option name="METHOD_NAME" value="" />
<option name="FOLDER_NAME" value="" />
<option name="TEST_TYPE" value="TEST_SCRIPT" />
<option name="PATTERN" value="" />
<option name="USE_PATTERN" value="false" />
<option name="PARAMS" value="" />
<option name="USE_PARAM" value="false" />
<method />
</configuration>
<configuration default="true" type="tests" factoryName="Unittests">
<option name="INTERPRETER_OPTIONS" value="" />
<option name="PARENT_ENVS" value="true" />
<envs />
<option name="SDK_HOME" value="" />
<option name="WORKING_DIRECTORY" value="" />
<option name="IS_MODULE_SDK" value="false" />
<option name="ADD_CONTENT_ROOTS" value="true" />
<option name="ADD_SOURCE_ROOTS" value="true" />
<module name="python_training" />
<option name="SCRIPT_NAME" value="" />
<option name="CLASS_NAME" value="" />
<option name="METHOD_NAME" value="" />
<option name="FOLDER_NAME" value="" />
<option name="TEST_TYPE" value="TEST_SCRIPT" />
<option name="PATTERN" value="" />
<option name="USE_PATTERN" value="false" />
<option name="PUREUNITTEST" value="true" />
<option name="PARAMS" value="" />
<option name="USE_PARAM" value="false" />
<method />
</configuration>
<configuration default="true" type="tests" factoryName="py.test">
<option name="INTERPRETER_OPTIONS" value="" />
<option name="PARENT_ENVS" value="true" />
<envs />
<option name="SDK_HOME" value="" />
<option name="WORKING_DIRECTORY" value="" />
<option name="IS_MODULE_SDK" value="false" />
<option name="ADD_CONTENT_ROOTS" value="true" />
<option name="ADD_SOURCE_ROOTS" value="true" />
<module name="python_training" />
<option name="SCRIPT_NAME" value="" />
<option name="CLASS_NAME" value="" />
<option name="METHOD_NAME" value="" />
<option name="FOLDER_NAME" value="" />
<option name="TEST_TYPE" value="TEST_SCRIPT" />
<option name="PATTERN" value="" />
<option name="USE_PATTERN" value="false" />
<option name="testToRun" value="" />
<option name="keywords" value="" />
<option name="params" value="" />
<option name="USE_PARAM" value="false" />
<option name="USE_KEYWORD" value="false" />
<method />
</configuration>
<list size="5">
<item index="0" class="java.lang.String" itemvalue="Python tests.py.test in test_add_group.py (1)" />
<item index="1" class="java.lang.String" itemvalue="Python tests.py.test in test_add_user.py (1)" />
<item index="2" class="java.lang.String" itemvalue="Python tests.py.test in test_del_group.py" />
<item index="3" class="java.lang.String" itemvalue="Python tests.py.test in test_del_user.py" />
<item index="4" class="java.lang.String" itemvalue="Python tests.py.test in test" />
</list>
<recent_temporary>
<list size="5">
<<<<<<< HEAD
<item index="0" class="java.lang.String" itemvalue="Python tests.py.test in test_add_user.py (1)" />
<item index="1" class="java.lang.String" itemvalue="Python tests.py.test in test_add_group.py (1)" />
<item index="2" class="java.lang.String" itemvalue="Python tests.py.test in test" />
<item index="3" class="java.lang.String" itemvalue="Python tests.py.test in test_del_group.py" />
=======
<item index="0" class="java.lang.String" itemvalue="Python tests.py.test in test" />
<item index="1" class="java.lang.String" itemvalue="Python tests.py.test in test_del_group.py" />
<item index="2" class="java.lang.String" itemvalue="Python tests.py.test in test_add_group.py (1)" />
<item index="3" class="java.lang.String" itemvalue="Python tests.py.test in test_add_user.py (1)" />
>>>>>>> origin/master
<item index="4" class="java.lang.String" itemvalue="Python tests.py.test in test_del_user.py" />
</list>
</recent_temporary>
</component>
<component name="ShelveChangesManager" show_recycled="false">
<option name="remove_strategy" value="false" />
</component>
<component name="TaskManager">
<task active="true" id="Default" summary="Default task">
<changelist id="cca0973c-fb7e-4eed-b5f9-77074a29274a" name="Default" comment="" />
<created>1491856911212</created>
<option name="number" value="Default" />
<option name="presentableId" value="Default" />
<updated>1491856911212</updated>
</task>
<servers />
</component>
<component name="TestHistory">
<<<<<<< HEAD
<history-entry file="py_test_in_test_add_group_py_(1) - 2017.04.14 at 10h 15m 04s.xml">
<configuration name="py.test in test_add_group.py (1)" configurationId="tests" />
</history-entry>
<history-entry file="py_test_in_test_add_group_py_(1) - 2017.04.14 at 10h 15m 43s.xml">
<configuration name="py.test in test_add_group.py (1)" configurationId="tests" />
</history-entry>
<history-entry file="py_test_in_test_add_group_py_(1) - 2017.04.14 at 10h 16m 23s.xml">
<configuration name="py.test in test_add_group.py (1)" configurationId="tests" />
</history-entry>
<history-entry file="py_test_in_test_add_group_py_(1) - 2017.04.14 at 16h 04m 19s.xml">
<configuration name="py.test in test_add_group.py (1)" configurationId="tests" />
</history-entry>
<history-entry file="py_test_in_test_add_group_py_(1) - 2017.04.14 at 16h 04m 46s.xml">
<configuration name="py.test in test_add_group.py (1)" configurationId="tests" />
</history-entry>
<history-entry file="py_test_in_test_add_group_py_(1) - 2017.04.14 at 16h 06m 01s.xml">
<configuration name="py.test in test_add_group.py (1)" configurationId="tests" />
</history-entry>
<history-entry file="py_test_in_test_add_group_py_(1) - 2017.04.14 at 16h 06m 32s.xml">
<configuration name="py.test in test_add_group.py (1)" configurationId="tests" />
</history-entry>
<history-entry file="py_test_in_test_add_group_py_(1) - 2017.04.14 at 16h 06m 55s.xml">
<configuration name="py.test in test_add_group.py (1)" configurationId="tests" />
</history-entry>
<history-entry file="py_test_in_test_add_user_py_(1) - 2017.04.14 at 10h 08m 38s.xml">
<configuration name="py.test in test_add_user.py (1)" configurationId="tests" />
</history-entry>
<history-entry file="py_test_in_test_add_user_py_(1) - 2017.04.14 at 16h 07m 12s.xml">
<configuration name="py.test in test_add_user.py (1)" configurationId="tests" />
</history-entry>
</component>
<component name="ToolWindowManager">
<frame x="39" y="23" width="1218" height="773" extended-state="0" />
<editor active="false" />
<layout>
<window_info id="Project" active="true" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.26272577" sideWeight="0.5" order="0" side_tool="false" content_ui="combo" />
=======
<history-entry file="py_test_in_test - 2017.04.13 at 18h 07m 57s.xml">
<configuration name="py.test in test" configurationId="tests" />
</history-entry>
<history-entry file="py_test_in_test - 2017.04.13 at 18h 11m 46s.xml">
<configuration name="py.test in test" configurationId="tests" />
</history-entry>
<history-entry file="py_test_in_test - 2017.04.13 at 18h 12m 25s.xml">
<configuration name="py.test in test" configurationId="tests" />
</history-entry>
<history-entry file="py_test_in_test - 2017.04.13 at 18h 12m 59s.xml">
<configuration name="py.test in test" configurationId="tests" />
</history-entry>
<history-entry file="py_test_in_test - 2017.04.13 at 18h 14m 00s.xml">
<configuration name="py.test in test" configurationId="tests" />
</history-entry>
<history-entry file="py_test_in_test - 2017.04.13 at 18h 15m 09s.xml">
<configuration name="py.test in test" configurationId="tests" />
</history-entry>
<history-entry file="py_test_in_test - 2017.04.13 at 18h 16m 10s.xml">
<configuration name="py.test in test" configurationId="tests" />
</history-entry>
<history-entry file="py_test_in_test - 2017.04.13 at 18h 17m 44s.xml">
<configuration name="py.test in test" configurationId="tests" />
</history-entry>
<history-entry file="py_test_in_test - 2017.04.13 at 18h 19m 21s.xml">
<configuration name="py.test in test" configurationId="tests" />
</history-entry>
<history-entry file="py_test_in_test - 2017.04.13 at 18h 20m 09s.xml">
<configuration name="py.test in test" configurationId="tests" />
</history-entry>
</component>
<component name="ToolWindowManager">
<frame x="57" y="54" width="1280" height="773" extended-state="0" />
<editor active="true" />
<layout>
<window_info id="Project" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="0" side_tool="false" content_ui="combo" />
>>>>>>> origin/master
<window_info id="TODO" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="6" side_tool="false" content_ui="tabs" />
<window_info id="Event Log" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="7" side_tool="true" content_ui="tabs" />
<window_info id="Version Control" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
<window_info id="Python Console" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
<window_info id="Run" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.23863636" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
<window_info id="Structure" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
<window_info id="Terminal" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
<window_info id="Favorites" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="2" side_tool="true" content_ui="tabs" />
<window_info id="Debug" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.4" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
<window_info id="Cvs" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="4" side_tool="false" content_ui="tabs" />
<window_info id="Message" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" />
<window_info id="Commander" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.4" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" />
<window_info id="Inspection" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.4" sideWeight="0.5" order="5" side_tool="false" content_ui="tabs" />
<window_info id="Hierarchy" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="2" side_tool="false" content_ui="combo" />
<window_info id="Find" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.32954547" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
<window_info id="Ant Build" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
</layout>
</component>
<component name="VcsContentAnnotationSettings">
<option name="myLimit" value="2678400000" />
</component>
<component name="XDebuggerManager">
<breakpoint-manager />
<watches-manager />
</component>
<component name="editorHistoryManager">
<entry file="file://$PROJECT_DIR$/conftest.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="120">
<caret line="9" column="12" lean-forward="false" selection-start-line="9" selection-start-column="12" selection-end-line="9" selection-end-column="12" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/test/test_add_group.py">
<provider selected="true" editor-type-id="text-editor">
<<<<<<< HEAD
<state relative-caret-position="225">
<caret line="15" column="0" lean-forward="false" selection-start-line="15" selection-start-column="0" selection-end-line="15" selection-end-column="0" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/fixture/group.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="0">
<caret line="0" column="0" lean-forward="false" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/fixture/user.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="465">
<caret line="31" column="0" lean-forward="false" selection-start-line="31" selection-start-column="0" selection-end-line="31" selection-end-column="0" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/test/test_add_user.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="210">
<caret line="14" column="18" lean-forward="true" selection-start-line="14" selection-start-column="18" selection-end-line="14" selection-end-column="18" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/test/test_del_group.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="30">
<caret line="2" column="9" lean-forward="false" selection-start-line="2" selection-start-column="9" selection-end-line="2" selection-end-column="21" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/fixture/application.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="300">
<caret line="23" column="0" lean-forward="false" selection-start-line="23" selection-start-column="0" selection-end-line="23" selection-end-column="0" />
<folding>
<element signature="e#0#58#0" expanded="true" />
</folding>
=======
<state relative-caret-position="150">
<caret line="12" column="40" lean-forward="true" selection-start-line="12" selection-start-column="40" selection-end-line="12" selection-end-column="40" />
<folding />
>>>>>>> origin/master
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/test/test_add_group.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="150">
<caret line="12" column="40" lean-forward="true" selection-start-line="12" selection-start-column="40" selection-end-line="12" selection-end-column="40" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/test.py" />
<entry file="file://$PROJECT_DIR$/new.py" />
<entry file="file://$PROJECT_DIR$/model/group.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="30">
<caret line="2" column="0" lean-forward="false" selection-start-line="2" selection-start-column="0" selection-end-line="2" selection-end-column="0" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/model/user.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="150">
<caret line="10" column="0" lean-forward="true" selection-start-line="10" selection-start-column="0" selection-end-line="10" selection-end-column="0" />
</state>
</provider>
</entry>
<<<<<<< HEAD
<entry file="file://$PROJECT_DIR$/2" />
<entry file="file://$PROJECT_DIR$/1.py" />
<entry file="file://$PROJECT_DIR$/fixture/session.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="315">
<caret line="21" column="0" lean-forward="false" selection-start-line="21" selection-start-column="0" selection-end-line="21" selection-end-column="0" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/test/test_del_user.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="75">
<caret line="5" column="24" lean-forward="false" selection-start-line="5" selection-start-column="24" selection-end-line="5" selection-end-column="24" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/test/test_del_group.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="30">
<caret line="2" column="9" lean-forward="false" selection-start-line="2" selection-start-column="9" selection-end-line="2" selection-end-column="21" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/test/ошибка">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="21165">
<caret line="1411" column="0" lean-forward="false" selection-start-line="1411" selection-start-column="0" selection-end-line="1411" selection-end-column="0" />
=======
<entry file="file://$PROJECT_DIR$/fixture/user.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="175">
<caret line="31" column="0" lean-forward="false" selection-start-line="31" selection-start-column="0" selection-end-line="31" selection-end-column="0" />
<folding />
>>>>>>> origin/master
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/2">
<provider selected="true" editor-type-id="text-editor">
<<<<<<< HEAD
<state relative-caret-position="210">
<caret line="14" column="18" lean-forward="false" selection-start-line="14" selection-start-column="18" selection-end-line="14" selection-end-column="18" />
=======
<state relative-caret-position="-155">
<caret line="0" column="0" lean-forward="false" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
>>>>>>> origin/master
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/1.py">
<provider selected="true" editor-type-id="text-editor">
<<<<<<< HEAD
<state relative-caret-position="465">
<caret line="31" column="0" lean-forward="false" selection-start-line="31" selection-start-column="0" selection-end-line="31" selection-end-column="0" />
=======
<state relative-caret-position="150">
<caret line="21" column="63" lean-forward="false" selection-start-line="21" selection-start-column="8" selection-end-line="21" selection-end-column="63" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/test/test_add_user.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="210">
<caret line="14" column="24" lean-forward="true" selection-start-line="14" selection-start-column="24" selection-end-line="14" selection-end-column="24" />
>>>>>>> origin/master
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/fixture/group.py">
<provider selected="true" editor-type-id="text-editor">
<<<<<<< HEAD
<state relative-caret-position="225">
<caret line="19" column="55" lean-forward="false" selection-start-line="19" selection-start-column="55" selection-end-line="19" selection-end-column="55" />
=======
<state relative-caret-position="660">
<caret line="44" column="0" lean-forward="true" selection-start-line="44" selection-start-column="0" selection-end-line="44" selection-end-column="0" />
>>>>>>> origin/master
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/fixture/application.py">
<provider selected="true" editor-type-id="text-editor">
<<<<<<< HEAD
<state relative-caret-position="255">
<caret line="17" column="9" lean-forward="false" selection-start-line="17" selection-start-column="9" selection-end-line="17" selection-end-column="9" />
<folding>
<element signature="e#0#58#0" expanded="true" />
</folding>
=======
<state relative-caret-position="315">
<caret line="21" column="0" lean-forward="true" selection-start-line="21" selection-start-column="0" selection-end-line="21" selection-end-column="0" />
<folding />
>>>>>>> origin/master
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/test/test_add_group.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="225">
<caret line="15" column="0" lean-forward="true" selection-start-line="15" selection-start-column="0" selection-end-line="15" selection-end-column="0" />
<folding />
</state>
</provider>
</entry>
<<<<<<< HEAD
<entry file="file://$PROJECT_DIR$/conftest.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="120">
<caret line="9" column="18" lean-forward="false" selection-start-line="9" selection-start-column="18" selection-end-line="9" selection-end-column="18" />
<folding />
=======
<entry file="file://$PROJECT_DIR$/test/test_del_group.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="30">
<caret line="2" column="9" lean-forward="true" selection-start-line="2" selection-start-column="9" selection-end-line="2" selection-end-column="21" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/test/test_del_user.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="75">
<caret line="5" column="24" lean-forward="true" selection-start-line="5" selection-start-column="24" selection-end-line="5" selection-end-column="24" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/fixture/application.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="345">
<caret line="23" column="0" lean-forward="true" selection-start-line="23" selection-start-column="0" selection-end-line="23" selection-end-column="0" />
<folding>
<element signature="e#0#58#0" expanded="true" />
</folding>
>>>>>>> origin/master
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/conftest.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="120">
<caret line="9" column="18" lean-forward="true" selection-start-line="9" selection-start-column="18" selection-end-line="9" selection-end-column="18" />
<folding />
</state>
</provider>
</entry>
</component>
</project> | {
"content_hash": "9c3349f6f3ddd22cd61d0c1f24540382",
"timestamp": "",
"source": "github",
"line_count": 926,
"max_line_length": 247,
"avg_line_length": 51.595032397408204,
"alnum_prop": 0.6160286330242586,
"repo_name": "fiore24/python_training",
"id": "4f421ea67e26c17945522371f8d61e3119fa44f1",
"size": "47789",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": ".idea/workspace.xml",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Python",
"bytes": "23112"
}
],
"symlink_target": ""
} |
/*
* serialization_utils.h
*
* Created on: May 12, 2014
* Author: hendrik
*/
#ifndef SERIALIZATION_UTILS_H_
#define SERIALIZATION_UTILS_H_
#include <arpa/inet.h>
#include <boost/property_tree/ptree.hpp>
#include <boost/property_tree/json_parser.hpp>
namespace keyvi {
namespace dictionary {
namespace fsa {
namespace internal {
class SerializationUtils {
public:
static void WriteJsonRecord(std::ostream& stream,
boost::property_tree::ptree& properties) {
std::stringstream string_buffer;
boost::property_tree::write_json(string_buffer, properties, false);
std::string header = string_buffer.str();
uint32_t size = ntohl(header.size());
stream.write(reinterpret_cast<const char*>(&size), sizeof(uint32_t));
stream << header;
}
static boost::property_tree::ptree ReadJsonRecord(std::istream& stream) {
uint32_t header_size;
stream.read(reinterpret_cast<char*>(&header_size), sizeof(int));
header_size = htonl(header_size);
char * buffer = new char[header_size];
stream.read(buffer, header_size);
std::string buffer_as_string(buffer, header_size);
delete[] buffer;
std::istringstream string_stream(buffer_as_string);
boost::property_tree::ptree properties;
boost::property_tree::read_json(string_stream, properties);
return properties;
}
};
} /* namespace internal */
} /* namespace fsa */
} /* namespace dictionary */
} /* namespace keyvi */
#endif /* SERIALIZATION_UTILS_H_ */
| {
"content_hash": "01d4dd5bff8061613a82fd3c29f6d9f4",
"timestamp": "",
"source": "github",
"line_count": 58,
"max_line_length": 75,
"avg_line_length": 25.879310344827587,
"alnum_prop": 0.6822118587608261,
"repo_name": "DavidNemeskey/keyvi",
"id": "01d7fee8b82984f7d84856ba951e6a0cfa207ff9",
"size": "2150",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "keyvi/src/cpp/dictionary/fsa/internal/serialization_utils.h",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "C",
"bytes": "7256"
},
{
"name": "C++",
"bytes": "455845"
},
{
"name": "Python",
"bytes": "73622"
},
{
"name": "Shell",
"bytes": "484"
}
],
"symlink_target": ""
} |
package org.eclipse.bpmn2.impl;
import org.eclipse.bpmn2.Bpmn2Package;
import org.eclipse.bpmn2.GlobalConversation;
import org.eclipse.emf.ecore.EClass;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>Global Conversation</b></em>'.
* <!-- end-user-doc -->
*
* @generated
*/
public class GlobalConversationImpl extends CollaborationImpl implements GlobalConversation {
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected GlobalConversationImpl() {
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass() {
return Bpmn2Package.Literals.GLOBAL_CONVERSATION;
}
} //GlobalConversationImpl
| {
"content_hash": "c3c11e4ad066d5947a21be7d3d4cef7f",
"timestamp": "",
"source": "github",
"line_count": 36,
"max_line_length": 93,
"avg_line_length": 20.77777777777778,
"alnum_prop": 0.6671122994652406,
"repo_name": "porcelli-forks/kie-wb-common",
"id": "74e99b298f01794997359d4fad1f7332f3b89923",
"size": "1189",
"binary": false,
"copies": "3",
"ref": "refs/heads/master",
"path": "kie-wb-common-stunner/kie-wb-common-stunner-sets/kie-wb-common-stunner-bpmn/kie-wb-common-stunner-bpmn-emf/src/main/java/org/eclipse/bpmn2/impl/GlobalConversationImpl.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Batchfile",
"bytes": "2591"
},
{
"name": "CSS",
"bytes": "89726"
},
{
"name": "Dockerfile",
"bytes": "210"
},
{
"name": "FreeMarker",
"bytes": "36613"
},
{
"name": "GAP",
"bytes": "86275"
},
{
"name": "HTML",
"bytes": "298373"
},
{
"name": "Java",
"bytes": "33954524"
},
{
"name": "JavaScript",
"bytes": "20277"
},
{
"name": "Shell",
"bytes": "905"
},
{
"name": "Visual Basic",
"bytes": "84832"
}
],
"symlink_target": ""
} |
'use strict';
let express = require('express'),
app = express(),
port = process.env.PORT;
app.use(
(req, res, next) => {
res.setHeader('X-POWERED-BY', 'analogbird.com');
return next();
},
require('body-parser').json(),
require('body-parser').urlencoded({ extended: false }),
require('compression')(),
require('serve-favicon')(__dirname + '/public/img/favicon.png'),
require('./router')(express),
require('./library/error')
);
app.listen(port, () => {
console.log(`The app is up on port: ${port}`);
});
| {
"content_hash": "97e4b30c768b27b57b5bd3e22f4799bd",
"timestamp": "",
"source": "github",
"line_count": 23,
"max_line_length": 68,
"avg_line_length": 24.608695652173914,
"alnum_prop": 0.5795053003533569,
"repo_name": "Analogbird/aBird.co.api",
"id": "44ca5c2d3d95ba5fc303fb373cbeb8f974425c52",
"size": "566",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "app/index.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "JavaScript",
"bytes": "15476"
}
],
"symlink_target": ""
} |
package com.handmark.pulltorefresh.library.internal;
import android.annotation.SuppressLint;
import android.content.Context;
import android.graphics.Matrix;
import android.graphics.drawable.Drawable;
import android.view.View;
import android.view.animation.Animation;
import android.view.animation.Animation.AnimationListener;
import android.view.animation.AnimationUtils;
import android.view.animation.Interpolator;
import android.view.animation.LinearInterpolator;
import android.view.animation.RotateAnimation;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.ImageView.ScaleType;
import com.handmark.pulltorefresh.library.PullToRefreshBase;
import com.txmcu.iair.R;
@SuppressLint("ViewConstructor")
public class IndicatorLayout extends FrameLayout implements AnimationListener {
static final int DEFAULT_ROTATION_ANIMATION_DURATION = 150;
private Animation mInAnim, mOutAnim;
private ImageView mArrowImageView;
private final Animation mRotateAnimation, mResetRotateAnimation;
public IndicatorLayout(Context context, PullToRefreshBase.Mode mode) {
super(context);
mArrowImageView = new ImageView(context);
Drawable arrowD = getResources().getDrawable(R.drawable.indicator_arrow);
mArrowImageView.setImageDrawable(arrowD);
final int padding = getResources().getDimensionPixelSize(R.dimen.indicator_internal_padding);
mArrowImageView.setPadding(padding, padding, padding, padding);
addView(mArrowImageView);
int inAnimResId, outAnimResId;
switch (mode) {
case PULL_FROM_END:
inAnimResId = R.anim.slide_in_from_bottom;
outAnimResId = R.anim.slide_out_to_bottom;
setBackgroundResource(R.drawable.indicator_bg_bottom);
// Rotate Arrow so it's pointing the correct way
mArrowImageView.setScaleType(ScaleType.MATRIX);
Matrix matrix = new Matrix();
matrix.setRotate(180f, arrowD.getIntrinsicWidth() / 2f, arrowD.getIntrinsicHeight() / 2f);
mArrowImageView.setImageMatrix(matrix);
break;
default:
case PULL_FROM_START:
inAnimResId = R.anim.slide_in_from_top;
outAnimResId = R.anim.slide_out_to_top;
setBackgroundResource(R.drawable.indicator_bg_top);
break;
}
mInAnim = AnimationUtils.loadAnimation(context, inAnimResId);
mInAnim.setAnimationListener(this);
mOutAnim = AnimationUtils.loadAnimation(context, outAnimResId);
mOutAnim.setAnimationListener(this);
final Interpolator interpolator = new LinearInterpolator();
mRotateAnimation = new RotateAnimation(0, -180, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF,
0.5f);
mRotateAnimation.setInterpolator(interpolator);
mRotateAnimation.setDuration(DEFAULT_ROTATION_ANIMATION_DURATION);
mRotateAnimation.setFillAfter(true);
mResetRotateAnimation = new RotateAnimation(-180, 0, Animation.RELATIVE_TO_SELF, 0.5f,
Animation.RELATIVE_TO_SELF, 0.5f);
mResetRotateAnimation.setInterpolator(interpolator);
mResetRotateAnimation.setDuration(DEFAULT_ROTATION_ANIMATION_DURATION);
mResetRotateAnimation.setFillAfter(true);
}
public final boolean isVisible() {
Animation currentAnim = getAnimation();
if (null != currentAnim) {
return mInAnim == currentAnim;
}
return getVisibility() == View.VISIBLE;
}
public void hide() {
startAnimation(mOutAnim);
}
public void show() {
mArrowImageView.clearAnimation();
startAnimation(mInAnim);
}
@Override
public void onAnimationEnd(Animation animation) {
if (animation == mOutAnim) {
mArrowImageView.clearAnimation();
setVisibility(View.GONE);
} else if (animation == mInAnim) {
setVisibility(View.VISIBLE);
}
clearAnimation();
}
@Override
public void onAnimationRepeat(Animation animation) {
// NO-OP
}
@Override
public void onAnimationStart(Animation animation) {
setVisibility(View.VISIBLE);
}
public void releaseToRefresh() {
mArrowImageView.startAnimation(mRotateAnimation);
}
public void pullToRefresh() {
mArrowImageView.startAnimation(mResetRotateAnimation);
}
}
| {
"content_hash": "eb12f94a5e1bc397f979385cf26875e5",
"timestamp": "",
"source": "github",
"line_count": 133,
"max_line_length": 111,
"avg_line_length": 30.127819548872182,
"alnum_prop": 0.7771400049912652,
"repo_name": "arventwei/iAirAndroid",
"id": "390561a62ee86e98502dabf8b7f0e16e9963e872",
"size": "4760",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "iair/src/com/handmark/pulltorefresh/library/internal/IndicatorLayout.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Java",
"bytes": "639787"
},
{
"name": "Shell",
"bytes": "96"
}
],
"symlink_target": ""
} |
'use strict';
angular.module("snippetShare")
.controller("ModalInstanceCtrl", function ($scope, $modalInstance, memebers) {
$scope.members = memebers;
$scope.ok = function () {
$modalInstance.close();
};
$scope.cancel = function () {
$modalInstance.dismiss('cancel');
};
});
| {
"content_hash": "4e468582a69f5189c1ebbbb6453238b5",
"timestamp": "",
"source": "github",
"line_count": 16,
"max_line_length": 82,
"avg_line_length": 22,
"alnum_prop": 0.5482954545454546,
"repo_name": "jiangxiaoli/SnippetShare",
"id": "fd4fd9d40b4327acacd82ee597b6ea9ed7744a1c",
"size": "352",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/main/webapp/javascript/controllers/ModalInstanceCtrl.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "4354"
},
{
"name": "HTML",
"bytes": "51198"
},
{
"name": "Java",
"bytes": "126446"
},
{
"name": "JavaScript",
"bytes": "62266"
}
],
"symlink_target": ""
} |
package io.debezium.connector.mongodb;
import org.apache.kafka.connect.data.Schema;
import org.apache.kafka.connect.data.Struct;
import io.debezium.config.CommonConnectorConfig;
import io.debezium.connector.AbstractSourceInfoStructMaker;
public class MongoDbSourceInfoStructMaker extends AbstractSourceInfoStructMaker<SourceInfo> {
private final Schema schema;
public MongoDbSourceInfoStructMaker(String connector, String version, CommonConnectorConfig connectorConfig) {
super(connector, version, connectorConfig);
schema = commonSchemaBuilder()
.name(connectorConfig.schemaNameAdjustmentMode().createAdjuster().adjust("io.debezium.connector.mongo.Source"))
.field(SourceInfo.REPLICA_SET_NAME, Schema.STRING_SCHEMA)
.field(SourceInfo.COLLECTION, Schema.STRING_SCHEMA)
.field(SourceInfo.ORDER, Schema.INT32_SCHEMA)
.field(SourceInfo.LSID, Schema.OPTIONAL_STRING_SCHEMA)
.field(SourceInfo.TXN_NUMBER, Schema.OPTIONAL_INT64_SCHEMA)
.build();
}
@Override
public Schema schema() {
return schema;
}
@Override
public Struct struct(SourceInfo sourceInfo) {
Struct struct = super.commonStruct(sourceInfo)
.put(SourceInfo.REPLICA_SET_NAME, sourceInfo.replicaSetName())
.put(SourceInfo.COLLECTION, sourceInfo.collectionId().name())
.put(SourceInfo.ORDER, sourceInfo.position().getInc());
if (sourceInfo.position().getChangeStreamSessionTxnId() != null) {
struct.put(SourceInfo.LSID, sourceInfo.position().getChangeStreamSessionTxnId().lsid)
.put(SourceInfo.TXN_NUMBER, sourceInfo.position().getChangeStreamSessionTxnId().txnNumber);
}
return struct;
}
}
| {
"content_hash": "3f2179266d70bec12b69d745802f6567",
"timestamp": "",
"source": "github",
"line_count": 45,
"max_line_length": 127,
"avg_line_length": 40.84444444444444,
"alnum_prop": 0.6893362350380848,
"repo_name": "debezium/debezium",
"id": "46fd457e47ecd3437967c16a4ebdc50b1c2f73f5",
"size": "1993",
"binary": false,
"copies": "1",
"ref": "refs/heads/main",
"path": "debezium-connector-mongodb/src/main/java/io/debezium/connector/mongodb/MongoDbSourceInfoStructMaker.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "ANTLR",
"bytes": "431371"
},
{
"name": "Batchfile",
"bytes": "345"
},
{
"name": "Dockerfile",
"bytes": "4761"
},
{
"name": "Groovy",
"bytes": "205713"
},
{
"name": "Java",
"bytes": "10320379"
},
{
"name": "JavaScript",
"bytes": "1388"
},
{
"name": "PLSQL",
"bytes": "46006"
},
{
"name": "Python",
"bytes": "15667"
},
{
"name": "Shell",
"bytes": "62163"
},
{
"name": "TSQL",
"bytes": "4613"
}
],
"symlink_target": ""
} |
ImageSequenceReader::ImageSequenceReader(ImageSourceSettings& settings)
{
startFrameNo = settings.startFrame;
totalFrameNo = settings.numFrames;
m_nWidth = settings.width;
m_nHeight = settings.height;
inputPath = settings.dataPath;
imgFormat = settings.imageFormat;
currentFrameNo = startFrameNo;
char buffer[BUFFER_SIZE];
std::stringstream imagePath;
sprintf(buffer, imgFormat.c_str(), currentFrameNo);
imagePath << inputPath << buffer;
//memset(&buffer[0], 0, sizeof(buffer));
m_curImage = cv::imread(imagePath.str().c_str(),1); // read in color image
cout << imagePath.str() << endl;
// read the calibration information
std::stringstream intrinsicsFileName;
intrinsicsFileName << inputPath << settings.intrinsicsFile;
ifstream intrinsicsFile(intrinsicsFileName.str().c_str());
for(int i = 0; i < 3; ++i)
{
for(int j = 0; j < 3; ++j)
{
intrinsicsFile >> KK[i][j];
std::cout << KK[i][j] << " ";
}
std::cout << std::endl;
}
// read different level images if necessary
if(imageSourceSettings.useMultiImages)
{
char buffer1[BUFFER_SIZE];
char buffer2[BUFFER_SIZE];
int level_num = imageSourceSettings.dataPathLevelList.size();
m_curImages.resize(level_num);
for(int i = 0; i < level_num; ++i)
{
std::stringstream imagePath;
sprintf(buffer1, imageSourceSettings.dataPathLevelFormat.c_str(),
imageSourceSettings.dataPathLevelList[i]);
sprintf(buffer2, imageSourceSettings.imageLevelFormat.c_str(),
currentFrameNo);
imagePath << imageSourceSettings.dataPathLevelRoot << buffer1 << buffer2;
cout << imagePath.str() << endl;
m_curImages[i] = cv::imread(imagePath.str().c_str());
}
}
}
ImageSequenceReader::ImageSequenceReader(std::string& inputPath, std::string& imgFormat,
int nHeight, int nWidth, int startFrame, int numTrackingFrames, double shapeScale):
startFrameNo(startFrame),
totalFrameNo(numTrackingFrames),
currentFrameNo(startFrame),
m_nHeight(nHeight),
m_nWidth(nWidth),
m_ShapeScale(shapeScale),
inputPath(inputPath),
imgFormat(imgFormat)
{
char buffer[BUFFER_SIZE];
std::stringstream imagePath;
sprintf(buffer, imgFormat.c_str(), currentFrameNo);
imagePath << inputPath << buffer;
//memset(&buffer[0], 0, sizeof(buffer));
m_curImage = cv::imread(imagePath.str().c_str(),1); // read in color image
// read different level images if necessary
if(imageSourceSettings.useMultiImages)
{
char buffer1[BUFFER_SIZE];
char buffer2[BUFFER_SIZE];
int level_num = imageSourceSettings.dataPathLevelList.size();
m_curImages.resize(level_num);
for(int i = 0; i < level_num; ++i)
{
std::stringstream imagePath;
sprintf(buffer1, imageSourceSettings.dataPathLevelFormat.c_str(),
imageSourceSettings.dataPathLevelList[i]);
sprintf(buffer2, imageSourceSettings.imageLevelFormat.c_str(),
currentFrameNo);
imagePath << imageSourceSettings.dataPathLevelRoot << buffer1 << buffer2;
m_curImages[i] = cv::imread(imagePath.str().c_str());
}
}
}
ImageSequenceReader::~ImageSequenceReader()
{}
void ImageSequenceReader::setCurrentFrame(int curFrame)
{
if(currentFrameNo != curFrame)
{
currentFrameNo = curFrame; // update current frame number
char buffer[BUFFER_SIZE];
std::stringstream imagePath;
sprintf(buffer, imgFormat.c_str(), currentFrameNo);
imagePath << inputPath << buffer;
//memset(&buffer[0], 0, sizeof(buffer));
std::cout << imagePath.str() << std::endl;
try
{
m_curImage = cv::imread(imagePath.str().c_str(),1); // read in color image
}
catch(exception& e)
{
cerr << "ERROR: cv::imread failed." << endl;
cerr << "(Exception = " << e.what() << ")" << endl;
}
// read different level images if necessary
if(imageSourceSettings.useMultiImages)
{
char buffer1[BUFFER_SIZE];
char buffer2[BUFFER_SIZE];
int level_num = imageSourceSettings.dataPathLevelList.size();
m_curImages.resize(level_num);
for(int i = 0; i < level_num; ++i)
{
std::stringstream imagePath;
sprintf(buffer1, imageSourceSettings.dataPathLevelFormat.c_str(),
imageSourceSettings.dataPathLevelList[i]);
sprintf(buffer2, imageSourceSettings.imageLevelFormat.c_str(),
currentFrameNo);
imagePath << imageSourceSettings.dataPathLevelRoot << buffer1 << buffer2;
cout << imagePath.str() << endl;
m_curImages[i] = cv::imread(imagePath.str().c_str());
}
}
}
}
unsigned char* ImageSequenceReader::getColorImage()
{
return m_curImage.data;
}
unsigned char* ImageSequenceReader::getLevelColorImage(int nLevel)
{
return m_curImages[nLevel].data;
}
void ImageSequenceReader::readUVDImage(DepthImageType& uImage, DepthImageType& vImage,
DepthImageType& dImage, InternalIntensityImageType& maskImageAux)
{
// read in uImage, vImage and dImage
std::stringstream data_path;
data_path << inputPath;
if(trackerSettings.useXYZ)
{
// for perspective camera, in this case
ReadRawDepth(data_path,"refX.raw",m_nWidth,m_nHeight,uImage);
ReadRawDepth(data_path,"refY.raw",m_nWidth,m_nHeight,vImage);
}
else
{
// mainly for orthographic camera
for(int i=0; i<m_nHeight; ++i)
{
for(int j=0; j<m_nWidth; ++j)
{
uImage(i,j) = j+1;
vImage(i,j) = i+1;
}
}
}
ReadRawDepth(data_path,"depth0001.raw",m_nWidth,m_nHeight,dImage);
// read in maskImage
std::stringstream imagePath;
if(trackerSettings.cropMask)
imagePath << data_path.str() << "mask_crop.png";
else
imagePath << data_path.str() << "mask.png";
IntensityImageType maskImage = cv::imread(imagePath.str().c_str(),0);
maskImage.convertTo( maskImageAux, cv::DataType<CoordinateType>::type);
}
void ImageSequenceReader::ReadRawDepth(std::stringstream& data_path, std::string filename,
int width, int height, DepthImageType& resImage)
{
std::ifstream inputFileStream;
std::stringstream imagePath;
CoordinateType* ref_buffer;
imagePath << data_path.str() << filename;
if(bfs::exists(imagePath.str()))
{
ref_buffer = new CoordinateType[width*height];
// std::cout << data_path.str() << filename << std::endl;
inputFileStream.open(imagePath.str().c_str(),std::ios::binary);
inputFileStream.read((char*)ref_buffer,sizeof(CoordinateType)*width*height);
inputFileStream.close();
DepthImageType imgTemp(width,height,ref_buffer);
imgTemp = imgTemp.t();
imgTemp.copyTo(resImage);
delete[] ref_buffer;
}
else
{
cerr << imagePath.str() << " does not exist! " << endl;
}
}
| {
"content_hash": "782a7bee898de6bfd0dce9ff78ac1c83",
"timestamp": "",
"source": "github",
"line_count": 235,
"max_line_length": 124,
"avg_line_length": 30.77872340425532,
"alnum_prop": 0.6246370800497719,
"repo_name": "cvfish/PangaeaTracking",
"id": "efbaf3963716d5a1d3c71611a4ac73b884f73b67",
"size": "7290",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/main_engine/image_source/ImageSequenceReader.cpp",
"mode": "33261",
"license": "mit",
"language": [
{
"name": "C++",
"bytes": "672464"
},
{
"name": "Makefile",
"bytes": "4756"
},
{
"name": "Shell",
"bytes": "45"
}
],
"symlink_target": ""
} |
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>ipc: 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.15.0 / ipc - 8.6.0</a></li>
</ul>
</div>
</div>
</div>
<div class="article">
<div class="row">
<div class="col-md-12">
<a href="../..">« Up</a>
<h1>
ipc
<small>
8.6.0
<span class="label label-info">Not compatible 👼</span>
</small>
</h1>
<p>📅 <em><script>document.write(moment("2022-03-09 10:04:44 +0000", "YYYY-MM-DD HH:mm:ss Z").fromNow());</script> (2022-03-09 10:04:44 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-gmp 4 Virtual package relying on a GMP lib system installation
coq 8.15.0 Formal proof management system
dune 3.0.3 Fast, portable, and opinionated build system
ocaml 4.09.1 The OCaml compiler (virtual package)
ocaml-base-compiler 4.09.1 Official release 4.09.1
ocaml-config 1 OCaml Switch Configuration
ocamlfind 1.9.3 A library manager for OCaml
zarith 1.12 Implements arithmetic and logical operations over arbitrary-precision integers
# opam file:
opam-version: "2.0"
maintainer: "Hugo.Herbelin@inria.fr"
homepage: "https://github.com/coq-contribs/ipc"
license: "Unknown"
build: [make "-j%{jobs}%"]
install: [make "install"]
remove: ["rm" "-R" "%{lib}%/coq/user-contrib/IPC"]
depends: [
"ocaml"
"coq" {>= "8.6" & < "8.7~"}
]
tags: [
"keyword: intuitionistic logic"
"keyword: proof search"
"keyword: proof-as-programs"
"keyword: correct-by-construction"
"keyword: program verification"
"keyword: program extraction"
"category: Mathematics/Logic/Foundations"
"category: Computer Science/Decision Procedures and Certified Algorithms/Decision procedures"
"category: Miscellaneous/Extracted Programs/Decision procedures"
]
authors: [ "Klaus Weich" ]
bug-reports: "https://github.com/coq-contribs/ipc/issues"
dev-repo: "git+https://github.com/coq-contribs/ipc.git"
synopsis: "Intuitionistic Propositional Checker"
description: """
This development treats proof search in intuitionistic propositional logic,
a fragment of any constructive type theory. We present new and more
efficient decision procedures for intuitionistic propositional
logic. They themselves are given by (non-formal) constructive proofs.
We take one of them to demonstrate that constructive type theory can
be used in practice to develop a real, efficient, but error-free proof
searcher. This was done by formally proving the decidability of
intuitionistic propositional logic in Coq; the proof searcher was
automatically extracted."""
flags: light-uninstall
url {
src: "https://github.com/coq-contribs/ipc/archive/v8.6.0.tar.gz"
checksum: "md5=5e0ac9d66ddbf5e9e00a0326d2b12e9a"
}
</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-ipc.8.6.0 coq.8.15.0</code></dd>
<dt>Return code</dt>
<dd>5120</dd>
<dt>Output</dt>
<dd><pre>[NOTE] Package coq is already installed (current version is 8.15.0).
The following dependencies couldn't be met:
- coq-ipc -> coq < 8.7~ -> ocaml < 4.06.0
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-ipc.8.6.0</code></dd>
<dt>Return code</dt>
<dd>0</dd>
</dl>
<h2>Install dependencies</h2>
<dl class="dl-horizontal">
<dt>Command</dt>
<dd><code>true</code></dd>
<dt>Return code</dt>
<dd>0</dd>
<dt>Duration</dt>
<dd>0 s</dd>
</dl>
<h2>Install 🚀</h2>
<dl class="dl-horizontal">
<dt>Command</dt>
<dd><code>true</code></dd>
<dt>Return code</dt>
<dd>0</dd>
<dt>Duration</dt>
<dd>0 s</dd>
</dl>
<h2>Installation size</h2>
<p>No files were installed.</p>
<h2>Uninstall 🧹</h2>
<dl class="dl-horizontal">
<dt>Command</dt>
<dd><code>true</code></dd>
<dt>Return code</dt>
<dd>0</dd>
<dt>Missing removes</dt>
<dd>
none
</dd>
<dt>Wrong removes</dt>
<dd>
none
</dd>
</dl>
</div>
</div>
</div>
<hr/>
<div class="footer">
<p class="text-center">
Sources are on <a href="https://github.com/coq-bench">GitHub</a> © Guillaume Claret 🐣
</p>
</div>
</div>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script src="../../../../../bootstrap.min.js"></script>
</body>
</html>
| {
"content_hash": "71e473c73b6c242dd6f15db923a4d13b",
"timestamp": "",
"source": "github",
"line_count": 181,
"max_line_length": 159,
"avg_line_length": 42.03867403314917,
"alnum_prop": 0.5668287554212117,
"repo_name": "coq-bench/coq-bench.github.io",
"id": "a2a61e4ea88ddf0295934b1c4ca1476b1a5dc66c",
"size": "7634",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "clean/Linux-x86_64-4.09.1-2.0.6/released/8.15.0/ipc/8.6.0.html",
"mode": "33188",
"license": "mit",
"language": [],
"symlink_target": ""
} |
#import "Elements.h"
#import "DatabaseOperations.h"
@implementation LabelParser
- (BOOL)endElement:(NSError **)error {
[super endElement:error];
// The Label is CData: <xf:label>A Label</xf:label>
// We don't commit a label to the database directly,
// rather, a label is always nested under a control or <item/>
[self.parentElementParser.attributes setValue:self.cdata forKey:kLabelElement];
return YES;
}
@end
| {
"content_hash": "1fe99dab2152f163d3454b155a8088a9",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 83,
"avg_line_length": 24.77777777777778,
"alnum_prop": 0.6973094170403588,
"repo_name": "dankrywenky/ocRosa",
"id": "5e7aa0834302b994407c37014ffc963d5b536de7",
"size": "1044",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "ocRosa/ocRosa/xForms/parser/elements/LabelParser.m",
"mode": "33188",
"license": "apache-2.0",
"language": [],
"symlink_target": ""
} |
module Gouge
module TokenAuthentication
extend ::ActiveSupport::Concern
# Please see https://gist.github.com/josevalim/fb706b1e933ef01e4fb6
# before editing this file, the discussion is very interesting.
included do
private :authenticate_user_from_token!
# This is our new function that comes before Devise's one
before_action :authenticate_user_from_token!
# This is Devise's authentication
# before_action :authenticate_user!
around_action :set_current_user
end
# For this example, we are simply using token authentication
# via parameters. However, anyone could use Rails's token
# authentication features to get the token from a header.
def authenticate_user_from_token!
# Set the authentication params if not already present
if username = params[:username].blank? && request.headers["X-Username"]
params[:username] = username
end
if authn_token = params[:authn_token].blank? && request.headers["X-User-Token"]
params[:authn_token] = authn_token
end
username = params[:username].presence
user = username && self.class.token_authentication_class.find_by(username: username)
# Notice how we use Devise.secure_compare to compare the token
# in the database with the token given in the params, mitigating
# timing attacks.
if user &&
::Devise.secure_compare(user.authn_token, params[:authn_token]) &&
DateTime.current < (user.current_sign_in_at + Devise.timeout_in)
# Notice we are passing store false, so the user is not
# actually stored in the session and a token is needed
# for every request. If you want the token to work as a
# sign in token, you can simply remove store: false.
sign_in user, store: false
# Set current user
@current_user = user
else
# TODO: @giosakti investigate better behaviour for authentication during
# testing
raise LoginRequiredException unless ::Rails.env.test?
end
end
def set_current_user
begin
self.class.token_authentication_class.current_user_id = current_user.try(:id)
yield
ensure
# Clean up var so that the thread may be recycled.
# Note: Cleaning up on test environment will be handled by specs
self.class.token_authentication_class.current_user_id = nil unless Rails.env.test?
end
end
module ClassMethods
# NOP
end
end
end
| {
"content_hash": "d67b3c962752614101ff6f1acfd5dabc",
"timestamp": "",
"source": "github",
"line_count": 69,
"max_line_length": 90,
"avg_line_length": 36.594202898550726,
"alnum_prop": 0.6700990099009901,
"repo_name": "starqle/gouge",
"id": "2798228202549515a6ebe0cb976c2171d7d404d6",
"size": "3329",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "lib/gouge/action_controller/concerns/token_authentication.rb",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "686"
},
{
"name": "HTML",
"bytes": "4883"
},
{
"name": "JavaScript",
"bytes": "596"
},
{
"name": "Ruby",
"bytes": "112579"
}
],
"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.
*/
package org.camunda.bpm.engine.impl;
import java.io.Serializable;
import java.util.List;
import org.camunda.bpm.engine.impl.interceptor.CommandContext;
import org.camunda.bpm.engine.impl.interceptor.CommandExecutor;
import org.camunda.bpm.engine.impl.persistence.entity.SuspensionState;
import org.camunda.bpm.engine.management.JobDefinition;
import org.camunda.bpm.engine.management.JobDefinitionQuery;
import static org.camunda.bpm.engine.impl.util.EnsureUtil.ensureNotNull;
/**
* @author roman.smirnov
*/
public class JobDefinitionQueryImpl extends AbstractQuery<JobDefinitionQuery, JobDefinition> implements JobDefinitionQuery, Serializable {
private static final long serialVersionUID = 1L;
protected String id;
protected String[] activityIds;
protected String processDefinitionId;
protected String processDefinitionKey;
protected String jobType;
protected String jobConfiguration;
protected SuspensionState suspensionState;
protected Boolean withOverridingJobPriority;
public JobDefinitionQueryImpl() {
}
public JobDefinitionQueryImpl(CommandContext commandContext) {
super(commandContext);
}
public JobDefinitionQueryImpl(CommandExecutor commandExecutor) {
super(commandExecutor);
}
public JobDefinitionQuery jobDefinitionId(String jobDefinitionId) {
ensureNotNull("Job definition id", jobDefinitionId);
this.id = jobDefinitionId;
return this;
}
public JobDefinitionQuery activityIdIn(String... activityIds) {
ensureNotNull("Activity ids", activityIds);
this.activityIds = activityIds;
return this;
}
public JobDefinitionQuery processDefinitionId(String processDefinitionId) {
ensureNotNull("Process definition id", processDefinitionId);
this.processDefinitionId = processDefinitionId;
return this;
}
public JobDefinitionQuery processDefinitionKey(String processDefinitionKey) {
ensureNotNull("Process definition key", processDefinitionKey);
this.processDefinitionKey = processDefinitionKey;
return this;
}
public JobDefinitionQuery jobType(String jobType) {
ensureNotNull("Job type", jobType);
this.jobType = jobType;
return this;
}
public JobDefinitionQuery jobConfiguration(String jobConfiguration) {
ensureNotNull("Job configuration", jobConfiguration);
this.jobConfiguration = jobConfiguration;
return this;
}
public JobDefinitionQuery active() {
this.suspensionState = SuspensionState.ACTIVE;
return this;
}
public JobDefinitionQuery suspended() {
this.suspensionState = SuspensionState.SUSPENDED;
return this;
}
public JobDefinitionQuery withOverridingJobPriority() {
this.withOverridingJobPriority = true;
return this;
}
// order by ///////////////////////////////////////////
public JobDefinitionQuery orderByJobDefinitionId() {
return orderBy(JobDefinitionQueryProperty.JOB_DEFINITION_ID);
}
public JobDefinitionQuery orderByActivityId() {
return orderBy(JobDefinitionQueryProperty.ACTIVITY_ID);
}
public JobDefinitionQuery orderByProcessDefinitionId() {
return orderBy(JobDefinitionQueryProperty.PROCESS_DEFINITION_ID);
}
public JobDefinitionQuery orderByProcessDefinitionKey() {
return orderBy(JobDefinitionQueryProperty.PROCESS_DEFINITION_KEY);
}
public JobDefinitionQuery orderByJobType() {
return orderBy(JobDefinitionQueryProperty.JOB_TYPE);
}
public JobDefinitionQuery orderByJobConfiguration() {
return orderBy(JobDefinitionQueryProperty.JOB_CONFIGURATION);
}
// results ////////////////////////////////////////////
public long executeCount(CommandContext commandContext) {
checkQueryOk();
return commandContext
.getJobDefinitionManager()
.findJobDefinitionCountByQueryCriteria(this);
}
public List<JobDefinition> executeList(CommandContext commandContext, Page page) {
checkQueryOk();
return commandContext
.getJobDefinitionManager()
.findJobDefnitionByQueryCriteria(this, page);
}
// getters /////////////////////////////////////////////
public String getId() {
return id;
}
public String[] getActivityIds() {
return activityIds;
}
public String getProcessDefinitionId() {
return processDefinitionId;
}
public String getProcessDefinitionKey() {
return processDefinitionKey;
}
public String getJobType() {
return jobType;
}
public String getJobConfiguration() {
return jobConfiguration;
}
public SuspensionState getSuspensionState() {
return suspensionState;
}
public Boolean getWithOverridingJobPriority() {
return withOverridingJobPriority;
}
}
| {
"content_hash": "7ce8a6082ee454ab8ffc2a30929ac547",
"timestamp": "",
"source": "github",
"line_count": 179,
"max_line_length": 138,
"avg_line_length": 30.094972067039105,
"alnum_prop": 0.7198811954705773,
"repo_name": "holisticon/camunda-bpm-platform",
"id": "7ea190acb604bdfc7ad07b955b65e23d35a54ba1",
"size": "5387",
"binary": false,
"copies": "3",
"ref": "refs/heads/master",
"path": "engine/src/main/java/org/camunda/bpm/engine/impl/JobDefinitionQueryImpl.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Batchfile",
"bytes": "6657"
},
{
"name": "CSS",
"bytes": "1301"
},
{
"name": "Groovy",
"bytes": "1594"
},
{
"name": "HTML",
"bytes": "35196"
},
{
"name": "Java",
"bytes": "18549055"
},
{
"name": "JavaScript",
"bytes": "43"
},
{
"name": "PLpgSQL",
"bytes": "3267"
},
{
"name": "Python",
"bytes": "187"
},
{
"name": "Ruby",
"bytes": "60"
},
{
"name": "Shell",
"bytes": "4048"
}
],
"symlink_target": ""
} |
using log4net;
using NServiceBus;
using NServiceBus.Saga;
#region thesaga
public class OrderSaga : Saga<OrderSagaData>,
IAmStartedByMessages<StartOrder>,
IHandleMessages<CompleteOrder>
{
static ILog logger = LogManager.GetLogger(typeof(OrderSaga));
public override void ConfigureHowToFindSaga()
{
ConfigureMapping<StartOrder>(m => m.OrderId).ToSaga(s => s.OrderId);
ConfigureMapping<CompleteOrder>(m => m.OrderId).ToSaga(s => s.OrderId);
}
#endregion
public void Handle(StartOrder message)
{
Data.OrderId = message.OrderId;
logger.Info(string.Format("Saga with OrderId {0} received StartOrder with OrderId {1}", Data.OrderId, message.OrderId));
Bus.SendLocal(new CompleteOrder
{
OrderId = Data.OrderId
});
}
public void Handle(CompleteOrder message)
{
logger.Info(string.Format("Saga with OrderId {0} received CompleteOrder with OrderId {1}", Data.OrderId, message.OrderId));
MarkAsComplete();
}
} | {
"content_hash": "26f6f3d0cb5aa1826749bd3a65b6080e",
"timestamp": "",
"source": "github",
"line_count": 35,
"max_line_length": 131,
"avg_line_length": 31.2,
"alnum_prop": 0.641941391941392,
"repo_name": "pashute/docs.particular.net",
"id": "edb7af454e0dc1c5da94f3d8c586b73b73ed87d4",
"size": "1094",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "samples/saga/complexfindinglogic/Version_4/Sample/OrderSaga.cs",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "C#",
"bytes": "169460"
}
],
"symlink_target": ""
} |
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Templates - Firebrick JS API</title>
<link rel="stylesheet" href="http://yui.yahooapis.com/3.9.1/build/cssgrids/cssgrids-min.css">
<link rel="stylesheet" href="../assets/vendor/prettify/prettify-min.css">
<link rel="stylesheet" href="../assets/css/main.css" id="site_styles">
<link rel="shortcut icon" type="image/png" href="../assets/favicon.png">
<script src="http://yui.yahooapis.com/combo?3.9.1/build/yui/yui-min.js"></script>
</head>
<body class="yui3-skin-sam">
<div id="doc">
<div id="hd" class="yui3-g header">
<div class="yui3-u-3-4">
<h1><img src="..\fb_small.png" title="Firebrick JS API"></h1>
</div>
<div class="yui3-u-1-4 version">
<em>API Docs for: 0.13.12</em>
</div>
</div>
<div id="bd" class="yui3-g">
<div class="yui3-u-1-4">
<div id="docs-sidebar" class="sidebar apidocs">
<div id="api-list">
<h2 class="off-left">APIs</h2>
<div id="api-tabview" class="tabview">
<ul class="tabs">
<li><a href="#api-classes">Classes</a></li>
<li><a href="#api-modules">Modules</a></li>
</ul>
<div id="api-tabview-filter">
<input type="search" id="api-filter" placeholder="Type to filter APIs">
</div>
<div id="api-tabview-panel">
<ul id="api-classes" class="apis classes">
<li><a href="../classes/Boot.html">Boot</a></li>
<li><a href="../classes/Classes.html">Classes</a></li>
<li><a href="../classes/controller.Base.html">controller.Base</a></li>
<li><a href="../classes/Controllers.html">Controllers</a></li>
<li><a href="../classes/Data.html">Data</a></li>
<li><a href="../classes/Data.Store.html">Data.Store</a></li>
<li><a href="../classes/Events.html">Events</a></li>
<li><a href="../classes/Firebrick.html">Firebrick</a></li>
<li><a href="../classes/Languages.html">Languages</a></li>
<li><a href="../classes/Router.html">Router</a></li>
<li><a href="../classes/Router.class.Base.html">Router.class.Base</a></li>
<li><a href="../classes/Router.Hashbang.html">Router.Hashbang</a></li>
<li><a href="../classes/Router.History.html">Router.History</a></li>
<li><a href="../classes/Router.Router.html">Router.Router</a></li>
<li><a href="../classes/store.Base.html">store.Base</a></li>
<li><a href="../classes/Templates.html">Templates</a></li>
<li><a href="../classes/Utils.html">Utils</a></li>
<li><a href="../classes/view.Base.html">view.Base</a></li>
<li><a href="../classes/Views.html">Views</a></li>
<li><a href="../classes/window.html">window</a></li>
</ul>
<ul id="api-modules" class="apis modules">
<li><a href="../modules/Firebrick.html">Firebrick</a></li>
<li><a href="../modules/Firebrick.class.html">Firebrick.class</a></li>
<li><a href="../modules/Global.html">Global</a></li>
</ul>
</div>
</div>
</div>
</div>
</div>
<div class="yui3-u-3-4">
<div id="api-options">
Show:
<label for="api-show-inherited">
<input type="checkbox" id="api-show-inherited" checked>
Inherited
</label>
<label for="api-show-protected">
<input type="checkbox" id="api-show-protected">
Protected
</label>
<label for="api-show-private">
<input type="checkbox" id="api-show-private">
Private
</label>
<label for="api-show-deprecated">
<input type="checkbox" id="api-show-deprecated">
Deprecated
</label>
</div>
<div class="apidocs">
<div id="docs-main">
<div class="content">
<h1>Templates Class</h1>
<div class="box meta">
<div class="foundat">
Defined in: <a href="../files/src_firebrick.js.html#l713"><code>src\firebrick.js:713</code></a>
</div>
Module: <a href="../modules/Firebrick.html">Firebrick</a>
</div>
<div class="box intro">
</div>
<div id="classdocs" class="tabview">
<ul class="api-class-tabs">
<li class="api-class-tab index"><a href="#index">Index</a></li>
<li class="api-class-tab properties"><a href="#properties">Properties</a></li>
</ul>
<div>
<div id="index" class="api-class-tabpanel index">
<h2 class="off-left">Item Index</h2>
<div class="index-section properties">
<h3>Properties</h3>
<ul class="index-list properties">
<li class="index-item property">
<a href="#property_loadingTpl">loadingTpl</a>
</li>
</ul>
</div>
</div>
<div id="properties" class="api-class-tabpanel">
<h2 class="off-left">Properties</h2>
<div id="property_loadingTpl" class="property item">
<h3 class="name"><code>loadingTpl</code></h3>
<span class="type">Unknown</span>
<div class="meta">
<p>
Defined in
<a href="../files/src_firebrick.js.html#l718"><code>src\firebrick.js:718</code></a>
</p>
</div>
<div class="description">
<p>General loading tpl - override to change the loading mask
Bootstrap is needed for this to work</p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<script src="../assets/vendor/prettify/prettify-min.js"></script>
<script>prettyPrint();</script>
<script src="../assets/js/yui-prettify.js"></script>
<script src="../assets/../api.js"></script>
<script src="../assets/js/api-filter.js"></script>
<script src="../assets/js/api-list.js"></script>
<script src="../assets/js/api-search.js"></script>
<script src="../assets/js/apidocs.js"></script>
</body>
</html>
| {
"content_hash": "adc13a6cfa62f1826a4b5a05bdf20549",
"timestamp": "",
"source": "github",
"line_count": 275,
"max_line_length": 107,
"avg_line_length": 26.636363636363637,
"alnum_prop": 0.4536518771331058,
"repo_name": "smasala/firebrick",
"id": "e666ee9fc4b00c2d6c6772a99366180b8b9da580",
"size": "7325",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "docs/classes/Templates.html",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "90"
},
{
"name": "HTML",
"bytes": "638"
},
{
"name": "JavaScript",
"bytes": "157241"
}
],
"symlink_target": ""
} |
<?php
namespace PHPExiftool\Driver\Tag\XMPCc;
use JMS\Serializer\Annotation\ExclusionPolicy;
use PHPExiftool\Driver\AbstractTag;
/**
* @ExclusionPolicy("all")
*/
class LegalCode extends AbstractTag
{
protected $Id = 'legalcode';
protected $Name = 'LegalCode';
protected $FullName = 'XMP::cc';
protected $GroupName = 'XMP-cc';
protected $g0 = 'XMP';
protected $g1 = 'XMP-cc';
protected $g2 = 'Author';
protected $Type = 'string';
protected $Writable = true;
protected $Description = 'Legal Code';
}
| {
"content_hash": "56e31bea104bc9948cdd0051b63a4058",
"timestamp": "",
"source": "github",
"line_count": 36,
"max_line_length": 46,
"avg_line_length": 15.444444444444445,
"alnum_prop": 0.6510791366906474,
"repo_name": "bburnichon/PHPExiftool",
"id": "420cc7e3985fab1c3005c2aa52ba6f233c242b13",
"size": "780",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "lib/PHPExiftool/Driver/Tag/XMPCc/LegalCode.php",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "PHP",
"bytes": "22076400"
}
],
"symlink_target": ""
} |
package io.datakernel.multilog;
public final class PartitionAndFile {
private final String logPartition;
private final LogFile logFile;
public PartitionAndFile(String logPartition, LogFile logFile) {
this.logPartition = logPartition;
this.logFile = logFile;
}
public String getLogPartition() {
return logPartition;
}
public LogFile getLogFile() {
return logFile;
}
}
| {
"content_hash": "8ca53c71afb81a30657395432d5dd7a3",
"timestamp": "",
"source": "github",
"line_count": 19,
"max_line_length": 64,
"avg_line_length": 20.36842105263158,
"alnum_prop": 0.7648578811369509,
"repo_name": "softindex/datakernel",
"id": "3c5b4b79bd7622f3c27c404d0e80138d1b6db6cf",
"size": "387",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "cloud-multilog/src/main/java/io/datakernel/multilog/PartitionAndFile.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Dockerfile",
"bytes": "438"
},
{
"name": "HTML",
"bytes": "1244"
},
{
"name": "Java",
"bytes": "5078460"
},
{
"name": "Shell",
"bytes": "55"
},
{
"name": "TSQL",
"bytes": "1305"
}
],
"symlink_target": ""
} |
reproduction::mac!();
fn main() {}
| {
"content_hash": "45d00d9a763c724f11104696d8cbbeba",
"timestamp": "",
"source": "github",
"line_count": 3,
"max_line_length": 21,
"avg_line_length": 12,
"alnum_prop": 0.5833333333333334,
"repo_name": "graydon/rust",
"id": "c1f4331438e5762dcdf84d17481ab2a9b979d8da",
"size": "133",
"binary": false,
"copies": "14",
"ref": "refs/heads/master",
"path": "src/test/ui/crate-loading/cross-compiled-proc-macro.rs",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "ANTLR",
"bytes": "4990"
},
{
"name": "Assembly",
"bytes": "20064"
},
{
"name": "Awk",
"bytes": "159"
},
{
"name": "Bison",
"bytes": "78848"
},
{
"name": "C",
"bytes": "725899"
},
{
"name": "C++",
"bytes": "55803"
},
{
"name": "CSS",
"bytes": "22181"
},
{
"name": "JavaScript",
"bytes": "36295"
},
{
"name": "LLVM",
"bytes": "1587"
},
{
"name": "Makefile",
"bytes": "227056"
},
{
"name": "Puppet",
"bytes": "16300"
},
{
"name": "Python",
"bytes": "142548"
},
{
"name": "RenderScript",
"bytes": "99815"
},
{
"name": "Rust",
"bytes": "18342682"
},
{
"name": "Shell",
"bytes": "269546"
},
{
"name": "TeX",
"bytes": "57"
}
],
"symlink_target": ""
} |
using System.Collections.Generic;
using System.Linq;
using UnityEngine;
using UtyDepend;
using UtyMap.Unity;
using Mesh = UtyMap.Unity.Mesh;
namespace Assets.Scripts.Core.Plugins
{
/// <summary> Responsible for building Unity game objects from meshes and elements. </summary>
internal class GameObjectBuilder
{
private readonly IList<IElementBuilder> _elementBuilders;
private readonly MaterialProvider _materialProvider;
[Dependency]
public GameObjectBuilder(MaterialProvider materialProvider, IEnumerable<IElementBuilder> elementBuilders)
{
_materialProvider = materialProvider;
_elementBuilders = elementBuilders.ToList();
}
/// <inheritdoc />
public void BuildFromElement(Tile tile, Element element)
{
foreach (var builder in _elementBuilders)
{
if (!element.Styles["builder"].Contains(builder.Name))
continue;
var gameObject = builder.Build(tile, element);
if (gameObject.transform.parent == null)
gameObject.transform.parent = tile.GameObject.transform;
}
}
/// <inheritdoc />
public void BuildFromMesh(Tile tile, Mesh mesh)
{
var gameObject = new GameObject(mesh.Name);
var uMesh = new UnityEngine.Mesh();
uMesh.vertices = mesh.Vertices;
uMesh.triangles = mesh.Triangles;
uMesh.colors = mesh.Colors;
uMesh.uv = mesh.Uvs;
uMesh.uv2 = mesh.Uvs2;
uMesh.uv3 = mesh.Uvs3;
uMesh.RecalculateNormals();
gameObject.isStatic = true;
gameObject.AddComponent<MeshFilter>().mesh = uMesh;
gameObject.AddComponent<MeshRenderer>().sharedMaterial = _materialProvider.GetSharedMaterial(mesh.TextureIndex);
gameObject.AddComponent<MeshCollider>();
gameObject.transform.parent = tile.GameObject.transform;
}
}
}
| {
"content_hash": "6a11604206ab488b026e21efd3e1b003",
"timestamp": "",
"source": "github",
"line_count": 59,
"max_line_length": 124,
"avg_line_length": 34.779661016949156,
"alnum_prop": 0.6189083820662769,
"repo_name": "reinterpretcat/utymap",
"id": "1a573efd539e18e9c163f5b31a5e17c3458ad8b9",
"size": "2054",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "unity/demo/Assets/Scripts/Core/Plugins/GameObjectBuilder.cs",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "C#",
"bytes": "526125"
},
{
"name": "C++",
"bytes": "662743"
},
{
"name": "CMake",
"bytes": "11876"
},
{
"name": "Java",
"bytes": "1589"
},
{
"name": "ShaderLab",
"bytes": "2612"
}
],
"symlink_target": ""
} |