function stringlengths 11 56k | repo_name stringlengths 5 60 | features list |
|---|---|---|
def setUp(self):
self.ts = Series(np.random.randn(1000),
index=date_range('1/1/2000', periods=1000)) | Vvucinic/Wander | [
1,
1,
1,
11,
1449375044
] |
def test_count(self):
self.ts[::3] = np.nan
grouper = TimeGrouper('A', label='right', closed='right')
result = self.ts.resample('A', how='count')
expected = self.ts.groupby(lambda x: x.year).count()
expected.index = result.index
assert_series_equal(result, expected) | Vvucinic/Wander | [
1,
1,
1,
11,
1449375044
] |
def test_apply_iteration(self):
# #2300
N = 1000
ind = pd.date_range(start="2000-01-01", freq="D", periods=N)
df = DataFrame({'open': 1, 'close': 2}, index=ind)
tg = TimeGrouper('M')
_, grouper, _ = tg._get_grouper(df)
# Errors
grouped = df.groupby(group... | Vvucinic/Wander | [
1,
1,
1,
11,
1449375044
] |
def f(x):
assert(isinstance(x, Panel))
return x.mean(1) | Vvucinic/Wander | [
1,
1,
1,
11,
1449375044
] |
def test_fails_on_no_datetime_index(self):
index_names = ('Int64Index', 'PeriodIndex', 'Index', 'Float64Index',
'MultiIndex')
index_funcs = (tm.makeIntIndex, tm.makePeriodIndex,
tm.makeUnicodeIndex, tm.makeFloatIndex,
lambda m: tm.make... | Vvucinic/Wander | [
1,
1,
1,
11,
1449375044
] |
def test_aggregate_with_nat(self):
# check TimeGrouper's aggregation is identical as normal groupby
n = 20
data = np.random.randn(n, 4).astype('int64')
normal_df = DataFrame(data, columns=['A', 'B', 'C', 'D'])
normal_df['key'] = [1, 2, np.nan, 4, 5] * 4
dt_df = DataFram... | Vvucinic/Wander | [
1,
1,
1,
11,
1449375044
] |
def __init__(self, mode, was, now):
self.mode = mode
self.was = was
self.now = now | chromium/chromium | [
14247,
5365,
14247,
62,
1517864132
] |
def IsCopyright(change):
if len(change.now) != 1 or len(change.was) != 1: return False
if 'Copyright (c)' not in change.now[0]: return False
if 'Copyright (c)' not in change.was[0]: return False
return True | chromium/chromium | [
14247,
5365,
14247,
62,
1517864132
] |
def IsBlankComment(change):
if change.now: return False
if len(change.was) != 1: return False
if change.was[0].strip() != '*': return False
return True | chromium/chromium | [
14247,
5365,
14247,
62,
1517864132
] |
def IsBlank(change):
for line in change.now:
if line: return False
for line in change.was:
if line: return False
return True | chromium/chromium | [
14247,
5365,
14247,
62,
1517864132
] |
def IsToCppComment(change):
if not len(change.now) or len(change.now) != len(change.was):
return False
for index in range(len(change.now)):
was = change.was[index].strip()
if was[:2] != '//':
return False
was = was[2:].strip()
now = change.now[index].strip()
if now[:2] != '/*':
r... | chromium/chromium | [
14247,
5365,
14247,
62,
1517864132
] |
def IsSpacing(change):
if len(change.now) != len(change.was): return False
for i in range(len(change.now)):
# Also ignore right side comments
line = change.was[i]
offs = line.find('//')
if offs == -1:
offs = line.find('/*')
if offs >-1:
line = line[:offs-1]
words1 = change.now[i... | chromium/chromium | [
14247,
5365,
14247,
62,
1517864132
] |
def IsInclude(change):
for line in change.was:
if line.strip().find('struct'): return False
for line in change.now:
if line and '#include' not in line: return False
return True | chromium/chromium | [
14247,
5365,
14247,
62,
1517864132
] |
def IsCppComment(change):
if len(change.now): return False
for line in change.was:
line = line.strip()
if line[:2] != '//': return False
return True | chromium/chromium | [
14247,
5365,
14247,
62,
1517864132
] |
def ValidChange(change):
if IsToCppComment(change): return False
if IsCopyright(change): return False
if IsBlankComment(change): return False
if IsMergeComment(change): return False
if IsBlank(change): return False
if IsSpacing(change): return False
if IsInclude(change): return False
if IsCppComment(cha... | chromium/chromium | [
14247,
5365,
14247,
62,
1517864132
] |
def Swapped(last, next):
if not last.now and not next.was and len(last.was) == len(next.now):
cnt = len(last.was)
for i in range(cnt):
match = True
for j in range(cnt):
if last.was[j] != next.now[(i + j) % cnt]:
match = False
break;
if match: return True
if not ... | chromium/chromium | [
14247,
5365,
14247,
62,
1517864132
] |
def GetChanges(output):
# Split on lines, adding an END marker to simply add logic
lines = output.split('\n')
lines = FilterLinesIn(lines)
lines.append('END')
changes = []
was = []
now = []
mode = ''
last = None
for line in lines:
#print("LINE=%s" % line)
if not line: continue
elif li... | chromium/chromium | [
14247,
5365,
14247,
62,
1517864132
] |
def Main(args):
filenames = ParseOptions(args)
if not filenames:
gendir = os.path.join(GetOption('gen'), '*.h')
filenames = sorted(glob.glob(gendir))
srcdir = os.path.join(GetOption('src'), '*.h')
srcs = sorted(glob.glob(srcdir))
for name in srcs:
name = os.path.split(name)[1]
name =... | chromium/chromium | [
14247,
5365,
14247,
62,
1517864132
] |
def __init__(self,
opt,
staleness,
use_locking=False,
name="DropStaleGradient"):
"""Constructs a new DropStaleGradientOptimizer.
Args:
opt: The actual optimizer that will be used to compute and apply the
gradients. Must be one of the ... | unnikrishnankgs/va | [
1,
5,
1,
10,
1496432585
] |
def get_slot(self, *args, **kwargs):
return self._opt.get_slot(*args, **kwargs) | unnikrishnankgs/va | [
1,
5,
1,
10,
1496432585
] |
def _GetGradSource(op_or_tensor):
"""Identify which call to tf.gradients created this gradient op or tensor.
TensorArray gradient calls use an accumulator TensorArray object. If
multiple gradients are calculated and run in the same session, the multiple
gradient nodes may accidentally flow throuth the same ac... | unnikrishnankgs/va | [
1,
5,
1,
10,
1496432585
] |
def _TensorArrayReadGrad(op, grad):
"""Gradient for TensorArrayRead.
Args:
op: Forward TensorArrayRead op.
grad: Gradient `Tensor` to TensorArrayRead.
Returns:
A flow `Tensor`, which can be used in control dependencies to
force the write of `grad` to the gradient `TensorArray`.
"""
# Note: t... | unnikrishnankgs/va | [
1,
5,
1,
10,
1496432585
] |
def _TensorArrayWriteGrad(op, flow):
"""Gradient for TensorArrayWrite.
Args:
op: Forward TensorArrayWrite op.
flow: Gradient `Tensor` flow to TensorArrayWrite.
Returns:
A grad `Tensor`, the gradient created in an upstream ReadGrad or PackGrad.
"""
# handle is the output store_handle of TensorArr... | unnikrishnankgs/va | [
1,
5,
1,
10,
1496432585
] |
def _TensorArrayGatherGrad(op, grad):
"""Gradient for TensorArrayGather.
Args:
op: Forward TensorArrayGather op.
grad: Gradient `Tensor` to TensorArrayGather.
Returns:
A flow `Tensor`, which can be used in control dependencies to
force the write of `grad` to the gradient `TensorArray`.
"""
#... | unnikrishnankgs/va | [
1,
5,
1,
10,
1496432585
] |
def _TensorArrayScatterGrad(op, flow):
"""Gradient for TensorArrayScatter.
Args:
op: Forward TensorArrayScatter op.
flow: Gradient `Tensor` flow to TensorArrayScatter.
Returns:
A grad `Tensor`, the gradient created in upstream ReadGrads or PackGrad.
"""
handle = op.inputs[0]
indices = op.input... | unnikrishnankgs/va | [
1,
5,
1,
10,
1496432585
] |
def _TensorArrayConcatGrad(op, grad, unused_lengths_grad):
"""Gradient for TensorArrayConcat.
Args:
op: Forward TensorArrayConcat op.
grad: Gradient `Tensor` to TensorArrayConcat.
Returns:
A flow `Tensor`, which can be used in control dependencies to
force the write of `grad` to the gradient `Te... | unnikrishnankgs/va | [
1,
5,
1,
10,
1496432585
] |
def setUp(self):
self._msg = array_ops.placeholder(dtype=dtypes.string)
self._encoded_f = string_ops.encode_base64(self._msg, pad=False)
self._decoded_f = string_ops.decode_base64(self._encoded_f)
self._encoded_t = string_ops.encode_base64(self._msg, pad=True)
self._decoded_t = string_ops.decode_bas... | npuichigo/ttsflow | [
16,
6,
16,
1,
1500635633
] |
def _RunTest(self, msg, pad):
with self.test_session() as sess:
if pad:
encoded, decoded = sess.run([self._encoded_t, self._decoded_t],
feed_dict={self._msg: msg})
else:
encoded, decoded = sess.run([self._encoded_f, self._decoded_f],
... | npuichigo/ttsflow | [
16,
6,
16,
1,
1500635633
] |
def testShape(self):
for pad in (False, True):
for _ in range(10):
msg = [np.random.bytes(np.random.randint(20))
for _ in range(np.random.randint(10))]
self._RunTest(msg, pad=pad)
# Zero-element, non-trivial shapes.
for _ in range(10):
k = np.random.randint(... | npuichigo/ttsflow | [
16,
6,
16,
1,
1500635633
] |
def try_decode(enc):
self._decoded_f.eval(feed_dict={self._encoded_f: enc}) | npuichigo/ttsflow | [
16,
6,
16,
1,
1500635633
] |
def setUp(self):
self.params = tensor_forest.ForestHParams(
num_classes=2,
num_features=31,
layer_size=11,
num_layers=13,
num_trees=17,
connection_probability=0.1,
hybrid_tree_depth=4,
regularization_strength=0.01,
regularization="",
le... | npuichigo/ttsflow | [
16,
6,
16,
1,
1500635633
] |
def __init__(self, pattern):
self.pattern = pattern | beetbox/beets | [
11484,
1774,
11484,
509,
1281395840
] |
def match(self):
return True | beetbox/beets | [
11484,
1774,
11484,
509,
1281395840
] |
def _getters(cls):
return {} | beetbox/beets | [
11484,
1774,
11484,
509,
1281395840
] |
def _getters(cls):
return {'aComputedField': (lambda s: 'thing')} | beetbox/beets | [
11484,
1774,
11484,
509,
1281395840
] |
def setUpClass(cls):
handle, cls.orig_libfile = mkstemp('orig_db')
os.close(handle)
# Set up a database with the two-field schema.
old_lib = DatabaseFixture2(cls.orig_libfile)
# Add an item to the old library.
old_lib._connection().execute(
'insert into test ... | beetbox/beets | [
11484,
1774,
11484,
509,
1281395840
] |
def tearDownClass(cls):
os.remove(cls.orig_libfile) | beetbox/beets | [
11484,
1774,
11484,
509,
1281395840
] |
def tearDown(self):
os.remove(self.libfile) | beetbox/beets | [
11484,
1774,
11484,
509,
1281395840
] |
def test_open_with_new_field_adds_column(self):
new_lib = DatabaseFixture3(self.libfile)
c = new_lib._connection().cursor()
c.execute("select * from test")
row = c.fetchone()
self.assertEqual(len(row.keys()), len(ModelFixture3._fields)) | beetbox/beets | [
11484,
1774,
11484,
509,
1281395840
] |
def test_open_with_multiple_new_fields(self):
new_lib = DatabaseFixture4(self.libfile)
c = new_lib._connection().cursor()
c.execute("select * from test")
row = c.fetchone()
self.assertEqual(len(row.keys()), len(ModelFixture4._fields)) | beetbox/beets | [
11484,
1774,
11484,
509,
1281395840
] |
def setUp(self):
self.db = DatabaseFixture1(':memory:') | beetbox/beets | [
11484,
1774,
11484,
509,
1281395840
] |
def test_mutate_increase_revision(self):
old_rev = self.db.revision
with self.db.transaction() as tx:
tx.mutate(
'INSERT INTO {} '
'(field_one) '
'VALUES (?);'.format(ModelFixture1._table),
(111,),
)
self.ass... | beetbox/beets | [
11484,
1774,
11484,
509,
1281395840
] |
def setUp(self):
self.db = DatabaseFixture1(':memory:') | beetbox/beets | [
11484,
1774,
11484,
509,
1281395840
] |
def test_add_model(self):
model = ModelFixture1()
model.add(self.db)
rows = self.db._connection().execute('select * from test').fetchall()
self.assertEqual(len(rows), 1) | beetbox/beets | [
11484,
1774,
11484,
509,
1281395840
] |
def test_revision(self):
old_rev = self.db.revision
model = ModelFixture1()
model.add(self.db)
model.store()
self.assertEqual(model._revision, self.db.revision)
self.assertGreater(self.db.revision, old_rev)
mid_rev = self.db.revision
model2 = ModelFixture... | beetbox/beets | [
11484,
1774,
11484,
509,
1281395840
] |
def test_store_and_retrieve_flexattr(self):
model = ModelFixture1()
model.add(self.db)
model.foo = 'bar'
model.store()
other_model = self.db._get(ModelFixture1, model.id)
self.assertEqual(other_model.foo, 'bar') | beetbox/beets | [
11484,
1774,
11484,
509,
1281395840
] |
def test_delete_flexattr_via_dot(self):
model = ModelFixture1()
model['foo'] = 'bar'
self.assertTrue('foo' in model)
del model.foo
self.assertFalse('foo' in model) | beetbox/beets | [
11484,
1774,
11484,
509,
1281395840
] |
def test_delete_non_existent_attribute(self):
model = ModelFixture1()
with self.assertRaises(KeyError):
del model['foo'] | beetbox/beets | [
11484,
1774,
11484,
509,
1281395840
] |
def test_null_value_normalization_by_type(self):
model = ModelFixture1()
model.field_one = None
self.assertEqual(model.field_one, 0) | beetbox/beets | [
11484,
1774,
11484,
509,
1281395840
] |
def test_normalization_for_typed_flex_fields(self):
model = ModelFixture1()
model.some_float_field = None
self.assertEqual(model.some_float_field, 0.0) | beetbox/beets | [
11484,
1774,
11484,
509,
1281395840
] |
def test_check_db_fails(self):
with self.assertRaisesRegex(ValueError, 'no database'):
dbcore.Model()._check_db()
with self.assertRaisesRegex(ValueError, 'no id'):
ModelFixture1(self.db)._check_db()
dbcore.Model(self.db)._check_db(need_id=False) | beetbox/beets | [
11484,
1774,
11484,
509,
1281395840
] |
def test_computed_field(self):
model = ModelFixtureWithGetters()
self.assertEqual(model.aComputedField, 'thing')
with self.assertRaisesRegex(KeyError, 'computed field .+ deleted'):
del model.aComputedField | beetbox/beets | [
11484,
1774,
11484,
509,
1281395840
] |
def test_delete_internal_field(self):
model = dbcore.Model()
del model._db
with self.assertRaises(AttributeError):
model._db | beetbox/beets | [
11484,
1774,
11484,
509,
1281395840
] |
def test_format_fixed_field_integer(self):
model = ModelFixture1()
model.field_one = 155
value = model.formatted().get('field_one')
self.assertEqual(value, '155') | beetbox/beets | [
11484,
1774,
11484,
509,
1281395840
] |
def test_format_fixed_field_string(self):
model = ModelFixture1()
model.field_two = 'caf\xe9'
value = model.formatted().get('field_two')
self.assertEqual(value, 'caf\xe9') | beetbox/beets | [
11484,
1774,
11484,
509,
1281395840
] |
def test_format_flex_field_bytes(self):
model = ModelFixture1()
model.other_field = 'caf\xe9'.encode()
value = model.formatted().get('other_field')
self.assertTrue(isinstance(value, str))
self.assertEqual(value, 'caf\xe9') | beetbox/beets | [
11484,
1774,
11484,
509,
1281395840
] |
def test_format_typed_flex_field(self):
model = ModelFixture1()
model.some_float_field = 3.14159265358979
value = model.formatted().get('some_float_field')
self.assertEqual(value, '3.1') | beetbox/beets | [
11484,
1774,
11484,
509,
1281395840
] |
def test_keys_equal_model_keys(self):
model = ModelFixture1()
formatted = model.formatted()
self.assertEqual(set(model.keys(True)), set(formatted.keys())) | beetbox/beets | [
11484,
1774,
11484,
509,
1281395840
] |
def test_get_method_with_default(self):
model = ModelFixture1()
formatted = model.formatted()
self.assertEqual(formatted.get('other_field'), '') | beetbox/beets | [
11484,
1774,
11484,
509,
1281395840
] |
def test_parse_fixed_field(self):
value = ModelFixture1._parse('field_one', '2')
self.assertIsInstance(value, int)
self.assertEqual(value, 2) | beetbox/beets | [
11484,
1774,
11484,
509,
1281395840
] |
def test_parse_untyped_field(self):
value = ModelFixture1._parse('field_nine', '2')
self.assertEqual(value, '2') | beetbox/beets | [
11484,
1774,
11484,
509,
1281395840
] |
def pqp(self, part):
return dbcore.queryparse.parse_query_part(
part,
{'year': dbcore.query.NumericQuery},
{':': dbcore.query.RegexpQuery},
)[:-1] # remove the negate flag | beetbox/beets | [
11484,
1774,
11484,
509,
1281395840
] |
def test_one_keyed_term(self):
q = 'test:val'
r = ('test', 'val', dbcore.query.SubstringQuery)
self.assertEqual(self.pqp(q), r) | beetbox/beets | [
11484,
1774,
11484,
509,
1281395840
] |
def test_one_basic_regexp(self):
q = r':regexp'
r = (None, 'regexp', dbcore.query.RegexpQuery)
self.assertEqual(self.pqp(q), r) | beetbox/beets | [
11484,
1774,
11484,
509,
1281395840
] |
def test_escaped_colon(self):
q = r'test\:val'
r = (None, 'test:val', dbcore.query.SubstringQuery)
self.assertEqual(self.pqp(q), r) | beetbox/beets | [
11484,
1774,
11484,
509,
1281395840
] |
def test_single_year(self):
q = 'year:1999'
r = ('year', '1999', dbcore.query.NumericQuery)
self.assertEqual(self.pqp(q), r) | beetbox/beets | [
11484,
1774,
11484,
509,
1281395840
] |
def test_empty_query_part(self):
q = ''
r = (None, '', dbcore.query.SubstringQuery)
self.assertEqual(self.pqp(q), r) | beetbox/beets | [
11484,
1774,
11484,
509,
1281395840
] |
def qfs(self, strings):
return dbcore.queryparse.query_from_strings(
dbcore.query.AndQuery,
ModelFixture1,
{':': dbcore.query.RegexpQuery},
strings,
) | beetbox/beets | [
11484,
1774,
11484,
509,
1281395840
] |
def test_two_parts(self):
q = self.qfs(['foo', 'bar:baz'])
self.assertIsInstance(q, dbcore.query.AndQuery)
self.assertEqual(len(q.subqueries), 2)
self.assertIsInstance(q.subqueries[0], dbcore.query.AnyFieldQuery)
self.assertIsInstance(q.subqueries[1], dbcore.query.SubstringQuery) | beetbox/beets | [
11484,
1774,
11484,
509,
1281395840
] |
def test_parse_flex_type_query(self):
q = self.qfs(['some_float_field:2..3'])
self.assertIsInstance(q.subqueries[0], dbcore.query.NumericQuery) | beetbox/beets | [
11484,
1774,
11484,
509,
1281395840
] |
def test_parse_named_query(self):
q = self.qfs(['some_query:foo'])
self.assertIsInstance(q.subqueries[0], QueryFixture) | beetbox/beets | [
11484,
1774,
11484,
509,
1281395840
] |
def sfs(self, strings):
return dbcore.queryparse.sort_from_strings(
ModelFixture1,
strings,
) | beetbox/beets | [
11484,
1774,
11484,
509,
1281395840
] |
def test_one_parts(self):
s = self.sfs(['field+'])
self.assertIsInstance(s, dbcore.query.Sort) | beetbox/beets | [
11484,
1774,
11484,
509,
1281395840
] |
def test_fixed_field_sort(self):
s = self.sfs(['field_one+'])
self.assertIsInstance(s, dbcore.query.FixedFieldSort)
self.assertEqual(s, dbcore.query.FixedFieldSort('field_one')) | beetbox/beets | [
11484,
1774,
11484,
509,
1281395840
] |
def test_special_sort(self):
s = self.sfs(['some_sort+'])
self.assertIsInstance(s, SortFixture) | beetbox/beets | [
11484,
1774,
11484,
509,
1281395840
] |
def psq(self, parts):
return dbcore.parse_sorted_query(
ModelFixture1,
parts.split(),
) | beetbox/beets | [
11484,
1774,
11484,
509,
1281395840
] |
def test_or_query(self):
q, s = self.psq('foo , bar')
self.assertIsInstance(q, dbcore.query.OrQuery)
self.assertIsInstance(s, dbcore.query.NullSort)
self.assertEqual(len(q.subqueries), 2) | beetbox/beets | [
11484,
1774,
11484,
509,
1281395840
] |
def test_no_spaces_or_query(self):
q, s = self.psq('foo,bar')
self.assertIsInstance(q, dbcore.query.AndQuery)
self.assertIsInstance(s, dbcore.query.NullSort)
self.assertEqual(len(q.subqueries), 1) | beetbox/beets | [
11484,
1774,
11484,
509,
1281395840
] |
def test_leading_comma_or_query(self):
q, s = self.psq(', foo , bar')
self.assertIsInstance(q, dbcore.query.OrQuery)
self.assertIsInstance(s, dbcore.query.NullSort)
self.assertEqual(len(q.subqueries), 3) | beetbox/beets | [
11484,
1774,
11484,
509,
1281395840
] |
def setUp(self):
self.db = DatabaseFixture1(':memory:')
model = ModelFixture1()
model['foo'] = 'baz'
model.add(self.db)
model = ModelFixture1()
model['foo'] = 'bar'
model.add(self.db) | beetbox/beets | [
11484,
1774,
11484,
509,
1281395840
] |
def test_iterate_once(self):
objs = self.db._fetch(ModelFixture1)
self.assertEqual(len(list(objs)), 2) | beetbox/beets | [
11484,
1774,
11484,
509,
1281395840
] |
def test_concurrent_iterators(self):
results = self.db._fetch(ModelFixture1)
it1 = iter(results)
it2 = iter(results)
next(it1)
list(it2)
self.assertEqual(len(list(it1)), 1) | beetbox/beets | [
11484,
1774,
11484,
509,
1281395840
] |
def test_slow_query_negative(self):
q = dbcore.query.SubstringQuery('foo', 'qux', False)
objs = self.db._fetch(ModelFixture1, q)
self.assertEqual(len(list(objs)), 0) | beetbox/beets | [
11484,
1774,
11484,
509,
1281395840
] |
def test_unsorted_subscript(self):
objs = self.db._fetch(ModelFixture1)
self.assertEqual(objs[0].foo, 'baz')
self.assertEqual(objs[1].foo, 'bar') | beetbox/beets | [
11484,
1774,
11484,
509,
1281395840
] |
def test_length(self):
objs = self.db._fetch(ModelFixture1)
self.assertEqual(len(objs), 2) | beetbox/beets | [
11484,
1774,
11484,
509,
1281395840
] |
def test_no_results(self):
self.assertIsNone(self.db._fetch(
ModelFixture1, dbcore.query.FalseQuery()).get()) | beetbox/beets | [
11484,
1774,
11484,
509,
1281395840
] |
def fn():
try:
fd = sys.stdin.fileno()
old_settings = termios.tcgetattr(fd)
tty.setraw(fd)
ch = sys.stdin.read(1)
except:
termios.tcsetattr(fd, termios.TCSADRAIN, old_settings)
raise Exception
termios.tcsetattr(fd, ... | littlecodersh/EasierLife | [
181,
138,
181,
1,
1453081737
] |
def __init__(self, header = 'LittleCoder', symbol = '>', inPip = None, inputMaintain = False):
self.strBuff = []
self.cmdBuff = []
self.historyCmd = -1
self.cursor = 0
self.inPip = [] if inPip == None else inPip
self.outPip = []
self.isLaunch = False
... | littlecodersh/EasierLife | [
181,
138,
181,
1,
1453081737
] |
def getch(self):
c = getch()
return c if c != '\r' else '\n' | littlecodersh/EasierLife | [
181,
138,
181,
1,
1453081737
] |
def output_command(self, s):
self.outPip.append(s if isinstance(s, unicode) else s.decode(sys.stdin.encoding))
if len(self.cmdBuff) >= CMD_HISTORY: self.cmdBuff = self.cmdBuff[::-1].pop()[::-1]
self.cmdBuff.append(s) | littlecodersh/EasierLife | [
181,
138,
181,
1,
1453081737
] |
def fast_input_test(self):
timer = threading.Timer(0.001, thread.interrupt_main)
c = None
try:
timer.start()
c = getch()
except:
pass
timer.cancel()
return c | littlecodersh/EasierLife | [
181,
138,
181,
1,
1453081737
] |
def process_char(self, c):
if ord(c) == 27: # Esc
if OS == 'Linux':
fitc1 = self.fast_input_test()
if ord(fitc1) == 91:
fitc2 = self.fast_input_test()
if 65 <= ord(fitc2) <= 68:
self.process_direct... | littlecodersh/EasierLife | [
181,
138,
181,
1,
1453081737
] |
def start(self):
self.isLaunch = True
thread.start_new_thread(self.print_thread, ())
self.reprint_input()
thread.start_new_thread(self.command_thread, ()) | littlecodersh/EasierLife | [
181,
138,
181,
1,
1453081737
] |
def print_line(self, msg = None):
self.inPip.append(msg) | littlecodersh/EasierLife | [
181,
138,
181,
1,
1453081737
] |
def get_command_pip(self):
return self.outPip | littlecodersh/EasierLife | [
181,
138,
181,
1,
1453081737
] |
def loopinput(c):
while True:
c.print_line('LOOP INPUT......')
time.sleep(3) | littlecodersh/EasierLife | [
181,
138,
181,
1,
1453081737
] |
def __init__(
self, plotly_name="arrayminussrc", parent_name="bar.error_x", **kwargs | plotly/plotly.py | [
13052,
2308,
13052,
1319,
1385013188
] |
def color(self):
"""
The 'color' property is a color and may be specified as:
- A hex string (e.g. '#ff0000')
- An rgb/rgba string (e.g. 'rgb(255,0,0)')
- An hsl/hsla string (e.g. 'hsl(0,100%,50%)')
- An hsv/hsva string (e.g. 'hsv(0,100%,100%)')
- A name... | plotly/python-api | [
13052,
2308,
13052,
1319,
1385013188
] |
def color(self, val):
self["color"] = val | plotly/python-api | [
13052,
2308,
13052,
1319,
1385013188
] |
def colorsrc(self):
"""
Sets the source reference on Chart Studio Cloud for color . | plotly/python-api | [
13052,
2308,
13052,
1319,
1385013188
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.