function stringlengths 11 56k | repo_name stringlengths 5 60 | features list |
|---|---|---|
def RecoverDevice(device, denylist, should_reboot=lambda device: True):
if device_status.IsDenylisted(device.adb.GetDeviceSerial(), denylist):
logger.debug('%s is denylisted, skipping recovery.', str(device))
return
if device.adb.GetState() == 'unauthorized' and TryAuth(device):
logger.info('Successful... | catapult-project/catapult | [
1835,
570,
1835,
1039,
1429033745
] |
def main():
parser = argparse.ArgumentParser()
logging_common.AddLoggingArguments(parser)
script_common.AddEnvironmentArguments(parser)
parser.add_argument('--denylist-file', help='Device denylist JSON file.')
parser.add_argument(
'--known-devices-file',
action='append',
default=[],
de... | catapult-project/catapult | [
1835,
570,
1835,
1039,
1429033745
] |
def getrc(defns,depth=1):
from sys import getrefcount, _getframe
f = _getframe(depth)
G0 = f.f_globals
L = f.f_locals
if L is not G0:
LL = [L]
while 1:
f = f.f_back
G = f.f_globals
L = f.f_locals
if G is not G0 or G is L: break
... | mattjmorrison/ReportLab | [
24,
24,
24,
3,
1302902528
] |
def testFpStr(self):
# should give siz decimal places if less than 1.
# if more, give up to seven sig figs
from _rl_accel import fp_str
assert fp_str(1,2,3)=='1 2 3'
assert fp_str(1) == '1'
assert fp_str(595.275574) == '595.2756'
assert fp_str(59.5275574) == '59.... | mattjmorrison/ReportLab | [
24,
24,
24,
3,
1302902528
] |
def test_AsciiBase85Decode(self):
from _rl_accel import _AsciiBase85Decode
assert _AsciiBase85Decode('6ul^K@;[2RDIdd%@f~>')=='Dragan Andric' | mattjmorrison/ReportLab | [
24,
24,
24,
3,
1302902528
] |
def test_instanceEscapePDF(self):
from _rl_accel import _instanceEscapePDF
assert _instanceEscapePDF('', '(test)')=='\\(test\\)' | mattjmorrison/ReportLab | [
24,
24,
24,
3,
1302902528
] |
def test_instanceStringWidth(self):
from reportlab.pdfbase.pdfmetrics import registerFont, getFont, _fonts, unicode2T1
from reportlab.pdfbase.ttfonts import TTFont
ttfn = 'Vera'
t1fn = 'Times-Roman'
registerFont(TTFont(ttfn, "Vera.ttf"))
ttf = getFont(ttfn)
t1f = ... | mattjmorrison/ReportLab | [
24,
24,
24,
3,
1302902528
] |
def tfunc(f,ts):
w1 = unicode2T1(ts,[f]+f.substitutionFonts)
w2 = _py_unicode2T1(ts,[f]+f.substitutionFonts)
assert w1==w2,"%r != %r" % (w1,w2) | mattjmorrison/ReportLab | [
24,
24,
24,
3,
1302902528
] |
def test_sameFrag(self):
from _rl_accel import _sameFrag
class ABag:
def __init__(self,**kwd):
self.__dict__.update(kwd)
def __str__(self):
V=['%s=%r' % v for v in self.__dict__.items()]
V.sort()
return 'ABag(%s)' % ... | mattjmorrison/ReportLab | [
24,
24,
24,
3,
1302902528
] |
def main():
"""Drives the main script behavior."""
script_dir = os.path.dirname(os.path.realpath(__file__))
for filename in os.listdir(script_dir):
basename, extension = os.path.splitext(filename)
if basename.startswith("Test") and extension == '.py':
source_path = os.path.join(s... | endlessm/chromium-browser | [
21,
16,
21,
3,
1435959644
] |
def test_execute(self, mock_hook, mock_object):
op = WorkflowsCreateWorkflowOperator(
task_id="test_task",
workflow=WORKFLOW,
workflow_id=WORKFLOW_ID,
location=LOCATION,
project_id=PROJECT_ID,
retry=RETRY,
timeout=TIMEOUT,
... | apache/incubator-airflow | [
29418,
12032,
29418,
869,
1428948298
] |
def test_execute(self, mock_hook, mock_object):
op = WorkflowsUpdateWorkflowOperator(
task_id="test_task",
workflow_id=WORKFLOW_ID,
location=LOCATION,
project_id=PROJECT_ID,
update_mask=UPDATE_MASK,
retry=RETRY,
timeout=TIMEOUT,... | apache/incubator-airflow | [
29418,
12032,
29418,
869,
1428948298
] |
def test_execute(
self,
mock_hook, | apache/incubator-airflow | [
29418,
12032,
29418,
869,
1428948298
] |
def test_execute(self, mock_hook, mock_object):
workflow_mock = mock.MagicMock()
workflow_mock.start_time = datetime.datetime.now(tz=pytz.UTC) + datetime.timedelta(minutes=5)
mock_hook.return_value.list_workflows.return_value = [workflow_mock]
op = WorkflowsListWorkflowsOperator(
... | apache/incubator-airflow | [
29418,
12032,
29418,
869,
1428948298
] |
def test_execute(self, mock_hook, mock_object):
op = WorkflowsGetWorkflowOperator(
task_id="test_task",
workflow_id=WORKFLOW_ID,
location=LOCATION,
project_id=PROJECT_ID,
retry=RETRY,
timeout=TIMEOUT,
metadata=METADATA,
... | apache/incubator-airflow | [
29418,
12032,
29418,
869,
1428948298
] |
def test_execute(self, mock_xcom, mock_hook, mock_object):
mock_hook.return_value.create_execution.return_value.name = "name/execution_id"
op = WorkflowsCreateExecutionOperator(
task_id="test_task",
workflow_id=WORKFLOW_ID,
execution=EXECUTION,
location=LO... | apache/incubator-airflow | [
29418,
12032,
29418,
869,
1428948298
] |
def test_execute(self, mock_hook, mock_object):
op = WorkflowsCancelExecutionOperator(
task_id="test_task",
workflow_id=WORKFLOW_ID,
execution_id=EXECUTION_ID,
location=LOCATION,
project_id=PROJECT_ID,
retry=RETRY,
timeout=TIMEO... | apache/incubator-airflow | [
29418,
12032,
29418,
869,
1428948298
] |
def test_execute(self, mock_hook, mock_object):
execution_mock = mock.MagicMock()
execution_mock.start_time = datetime.datetime.now(tz=pytz.UTC) + datetime.timedelta(minutes=5)
mock_hook.return_value.list_executions.return_value = [execution_mock]
op = WorkflowsListExecutionsOperator(
... | apache/incubator-airflow | [
29418,
12032,
29418,
869,
1428948298
] |
def __init__(self, initial_learning_rate):
self.initial_learning_rate = initial_learning_rate | tensorflow/tensorflow | [
171949,
87931,
171949,
2300,
1446859160
] |
def __call__(self, step):
raise NotImplementedError("Learning rate schedule must override __call__") | tensorflow/tensorflow | [
171949,
87931,
171949,
2300,
1446859160
] |
def get_config(self):
raise NotImplementedError("Learning rate schedule must override get_config") | tensorflow/tensorflow | [
171949,
87931,
171949,
2300,
1446859160
] |
def from_config(cls, config):
"""Instantiates a `LearningRateSchedule` from its config.
Args:
config: Output of `get_config()`.
Returns:
A `LearningRateSchedule` instance.
"""
return cls(**config) | tensorflow/tensorflow | [
171949,
87931,
171949,
2300,
1446859160
] |
def decayed_learning_rate(step):
return initial_learning_rate * decay_rate ^ (step / decay_steps) | tensorflow/tensorflow | [
171949,
87931,
171949,
2300,
1446859160
] |
def __init__(
self,
initial_learning_rate,
decay_steps,
decay_rate,
staircase=False,
name=None):
"""Applies exponential decay to the learning rate.
Args:
initial_learning_rate: A scalar `float32` or `float64` `Tensor` or a
Python number. The initial learning r... | tensorflow/tensorflow | [
171949,
87931,
171949,
2300,
1446859160
] |
def get_config(self):
return {
"initial_learning_rate": self.initial_learning_rate,
"decay_steps": self.decay_steps,
"decay_rate": self.decay_rate,
"staircase": self.staircase,
"name": self.name
} | tensorflow/tensorflow | [
171949,
87931,
171949,
2300,
1446859160
] |
def __init__(
self,
boundaries,
values,
name=None):
"""Piecewise constant from boundaries and interval values.
Args:
boundaries: A list of `Tensor`s or `int`s or `float`s with strictly
increasing entries, and with all elements having the same type as the
optimizer ... | tensorflow/tensorflow | [
171949,
87931,
171949,
2300,
1446859160
] |
def get_config(self):
return {
"boundaries": self.boundaries,
"values": self.values,
"name": self.name
} | tensorflow/tensorflow | [
171949,
87931,
171949,
2300,
1446859160
] |
def decayed_learning_rate(step):
step = min(step, decay_steps)
return ((initial_learning_rate - end_learning_rate) *
(1 - step / decay_steps) ^ (power)
) + end_learning_rate | tensorflow/tensorflow | [
171949,
87931,
171949,
2300,
1446859160
] |
def decayed_learning_rate(step):
decay_steps = decay_steps * ceil(step / decay_steps)
return ((initial_learning_rate - end_learning_rate) *
(1 - step / decay_steps) ^ (power)
) + end_learning_rate | tensorflow/tensorflow | [
171949,
87931,
171949,
2300,
1446859160
] |
def __init__(
self,
initial_learning_rate,
decay_steps,
end_learning_rate=0.0001,
power=1.0,
cycle=False,
name=None):
"""Applies a polynomial decay to the learning rate.
Args:
initial_learning_rate: A scalar `float32` or `float64` `Tensor` or a
Python num... | tensorflow/tensorflow | [
171949,
87931,
171949,
2300,
1446859160
] |
def get_config(self):
return {
"initial_learning_rate": self.initial_learning_rate,
"decay_steps": self.decay_steps,
"end_learning_rate": self.end_learning_rate,
"power": self.power,
"cycle": self.cycle,
"name": self.name
} | tensorflow/tensorflow | [
171949,
87931,
171949,
2300,
1446859160
] |
def decayed_learning_rate(step):
return initial_learning_rate / (1 + decay_rate * step / decay_step) | tensorflow/tensorflow | [
171949,
87931,
171949,
2300,
1446859160
] |
def decayed_learning_rate(step):
return initial_learning_rate / (1 + decay_rate * floor(step / decay_step)) | tensorflow/tensorflow | [
171949,
87931,
171949,
2300,
1446859160
] |
def __init__(
self,
initial_learning_rate,
decay_steps,
decay_rate,
staircase=False,
name=None):
"""Applies inverse time decay to the initial learning rate.
Args:
initial_learning_rate: A scalar `float32` or `float64` `Tensor` or a
Python number. The initial l... | tensorflow/tensorflow | [
171949,
87931,
171949,
2300,
1446859160
] |
def get_config(self):
return {
"initial_learning_rate": self.initial_learning_rate,
"decay_steps": self.decay_steps,
"decay_rate": self.decay_rate,
"staircase": self.staircase,
"name": self.name
} | tensorflow/tensorflow | [
171949,
87931,
171949,
2300,
1446859160
] |
def decayed_learning_rate(step):
step = min(step, decay_steps)
cosine_decay = 0.5 * (1 + cos(pi * step / decay_steps))
decayed = (1 - alpha) * cosine_decay + alpha
return initial_learning_rate * decayed | tensorflow/tensorflow | [
171949,
87931,
171949,
2300,
1446859160
] |
def __init__(
self,
initial_learning_rate,
decay_steps,
alpha=0.0,
name=None):
"""Applies cosine decay to the learning rate.
Args:
initial_learning_rate: A scalar `float32` or `float64` Tensor or a
Python number. The initial learning rate.
decay_steps: A scalar... | tensorflow/tensorflow | [
171949,
87931,
171949,
2300,
1446859160
] |
def get_config(self):
return {
"initial_learning_rate": self.initial_learning_rate,
"decay_steps": self.decay_steps,
"alpha": self.alpha,
"name": self.name
} | tensorflow/tensorflow | [
171949,
87931,
171949,
2300,
1446859160
] |
def __init__(
self,
initial_learning_rate,
first_decay_steps,
t_mul=2.0,
m_mul=1.0,
alpha=0.0,
name=None):
"""Applies cosine decay with restarts to the learning rate.
Args:
initial_learning_rate: A scalar `float32` or `float64` Tensor or a Python
number. ... | tensorflow/tensorflow | [
171949,
87931,
171949,
2300,
1446859160
] |
def compute_step(completed_fraction, geometric=False):
"""Helper for `cond` operation."""
if geometric:
i_restart = math_ops.floor(
math_ops.log(1.0 - completed_fraction * (1.0 - t_mul)) /
math_ops.log(t_mul))
sum_r = (1.0 - t_mul**i_restart) / (1.0 - t_m... | tensorflow/tensorflow | [
171949,
87931,
171949,
2300,
1446859160
] |
def get_config(self):
return {
"initial_learning_rate": self.initial_learning_rate,
"first_decay_steps": self.first_decay_steps,
"t_mul": self._t_mul,
"m_mul": self._m_mul,
"alpha": self.alpha,
"name": self.name
} | tensorflow/tensorflow | [
171949,
87931,
171949,
2300,
1446859160
] |
def decayed_learning_rate(step):
step = min(step, decay_steps)
linear_decay = (decay_steps - step) / decay_steps
cosine_decay = 0.5 * (
1 + cos(pi * 2 * num_periods * step / decay_steps))
decayed = (alpha + linear_decay) * cosine_decay + beta
return initial_learning_rate * decayed | tensorflow/tensorflow | [
171949,
87931,
171949,
2300,
1446859160
] |
def __init__(
self,
initial_learning_rate,
decay_steps,
num_periods=0.5,
alpha=0.0,
beta=0.001,
name=None):
"""Applies linear cosine decay to the learning rate.
Args:
initial_learning_rate: A scalar `float32` or `float64` Tensor or a Python
number. The in... | tensorflow/tensorflow | [
171949,
87931,
171949,
2300,
1446859160
] |
def get_config(self):
return {
"initial_learning_rate": self.initial_learning_rate,
"decay_steps": self.decay_steps,
"num_periods": self.num_periods,
"alpha": self.alpha,
"beta": self.beta,
"name": self.name
} | tensorflow/tensorflow | [
171949,
87931,
171949,
2300,
1446859160
] |
def decayed_learning_rate(step):
step = min(step, decay_steps)
linear_decay = (decay_steps - step) / decay_steps)
cosine_decay = 0.5 * (
1 + cos(pi * 2 * num_periods * step / decay_steps))
decayed = (alpha + linear_decay + eps_t) * cosine_decay + beta
return initial_learning_rate * decayed | tensorflow/tensorflow | [
171949,
87931,
171949,
2300,
1446859160
] |
def __init__(
self,
initial_learning_rate,
decay_steps,
initial_variance=1.0,
variance_decay=0.55,
num_periods=0.5,
alpha=0.0,
beta=0.001,
name=None):
"""Applies noisy linear cosine decay to the learning rate.
Args:
initial_learning_rate: A scalar `fl... | tensorflow/tensorflow | [
171949,
87931,
171949,
2300,
1446859160
] |
def get_config(self):
return {
"initial_learning_rate": self.initial_learning_rate,
"decay_steps": self.decay_steps,
"initial_variance": self.initial_variance,
"variance_decay": self.variance_decay,
"num_periods": self.num_periods,
"alpha": self.alpha,
"beta":... | tensorflow/tensorflow | [
171949,
87931,
171949,
2300,
1446859160
] |
def serialize(learning_rate_schedule):
return generic_utils.serialize_keras_object(learning_rate_schedule) | tensorflow/tensorflow | [
171949,
87931,
171949,
2300,
1446859160
] |
def testDistortOpWithStandardLensModel(self): | code-google-com/cortex-vfx | [
4,
3,
4,
21,
1426431447
] |
def __init__(self, table_prefix=''):
self.table_prefix = table_prefix | naparuba/shinken | [
1129,
344,
1129,
221,
1290510176
] |
def create_insert_query(self, table, data):
"""Create a INSERT query in table with all data of data (a dict)"""
query = u"INSERT INTO %s " % (self.table_prefix + table)
props_str = u' ('
values_str = u' ('
i = 0 # f or the ',' problem... look like C here...
for prop in d... | naparuba/shinken | [
1129,
344,
1129,
221,
1290510176
] |
def fetchone(self):
"""Just get an entry"""
return self.db_cursor.fetchone() | naparuba/shinken | [
1129,
344,
1129,
221,
1290510176
] |
def generate_visit_struct_body(field_prefix, members):
ret = ""
if len(field_prefix):
field_prefix = field_prefix + "."
for argname, argentry, optional, structured in parse_args(members):
if optional:
ret += mcgen(''' | KernelAnalysisPlatform/KlareDbg | [
73,
9,
73,
1,
1466427520
] |
def generate_visit_struct(name, members):
ret = mcgen(''' | KernelAnalysisPlatform/KlareDbg | [
73,
9,
73,
1,
1466427520
] |
def generate_visit_list(name, members):
return mcgen(''' | KernelAnalysisPlatform/KlareDbg | [
73,
9,
73,
1,
1466427520
] |
def generate_visit_enum(name, members):
return mcgen(''' | KernelAnalysisPlatform/KlareDbg | [
73,
9,
73,
1,
1466427520
] |
def generate_visit_union(name, members):
ret = generate_visit_enum('%sKind' % name, members.keys())
ret += mcgen(''' | KernelAnalysisPlatform/KlareDbg | [
73,
9,
73,
1,
1466427520
] |
def generate_declaration(name, members, genlist=True):
ret = mcgen(''' | KernelAnalysisPlatform/KlareDbg | [
73,
9,
73,
1,
1466427520
] |
def generate_decl_enum(name, members, genlist=True):
return mcgen(''' | KernelAnalysisPlatform/KlareDbg | [
73,
9,
73,
1,
1466427520
] |
def should_skip(test):
if test.startswith("native"):
return True
if test.startswith("viper"):
return True | infinnovation/micropython | [
2,
1,
2,
8,
1460816997
] |
def test_one_dim_odd_input(self):
x = [1., 5., 3., 2., 4.]
for q in [0, 10, 25, 49.9, 50, 50.01, 90, 95, 100]:
expected_percentile = np.percentile(
x, q=q, interpolation=self._interpolation, axis=0)
with self.test_session():
pct = sample_stats.percentile(
x, q=q, interp... | npuichigo/ttsflow | [
16,
6,
16,
1,
1500635633
] |
def test_two_dim_odd_input_axis_0(self):
x = np.array([[-1., 50., -3.5, 2., -1], [0., 0., 3., 2., 4.]]).T
for q in [0, 10, 25, 49.9, 50, 50.01, 90, 95, 100]:
expected_percentile = np.percentile(
x, q=q, interpolation=self._interpolation, axis=0)
with self.test_session():
# Get dim ... | npuichigo/ttsflow | [
16,
6,
16,
1,
1500635633
] |
def test_two_dim_even_input_and_keep_dims_true(self):
x = np.array([[1., 2., 4., 50.], [1., 2., -4., 5.]]).T
for q in [0, 10, 25, 49.9, 50, 50.01, 90, 95, 100]:
expected_percentile = np.percentile(
x, q=q, interpolation=self._interpolation, keepdims=True, axis=0)
with self.test_session():
... | npuichigo/ttsflow | [
16,
6,
16,
1,
1500635633
] |
def test_four_dimensional_input_and_keepdims(self):
x = rng.rand(2, 3, 4, 5)
for axis in [None, 0, 1, -2, (0,), (-1,), (-1, 1), (3, 1), (-3, 0)]:
expected_percentile = np.percentile(
x,
q=0.77,
interpolation=self._interpolation,
axis=axis,
keepdims=True)
... | npuichigo/ttsflow | [
16,
6,
16,
1,
1500635633
] |
def test_four_dimensional_input_and_keepdims_x_static_ndims_dynamic_sz(self):
x = rng.rand(2, 3, 4, 5)
x_ph = array_ops.placeholder(dtypes.float64, shape=[None, None, None, None])
for axis in [None, 0, 1, -2, (0,), (-1,), (-1, 1), (3, 1), (-3, 0)]:
expected_percentile = np.percentile(
x,
... | npuichigo/ttsflow | [
16,
6,
16,
1,
1500635633
] |
def test_one_dim_odd_input(self):
x = [1., 5., 3., 2., 4.]
for q in [0, 10.1, 25.1, 49.9, 50.1, 50.01, 89, 100]:
expected_percentile = np.percentile(
x, q=q, interpolation=self._interpolation)
with self.test_session():
pct = sample_stats.percentile(x, q=q, interpolation=self._inter... | npuichigo/ttsflow | [
16,
6,
16,
1,
1500635633
] |
def test_invalid_interpolation_raises(self):
x = [1., 5., 3., 2., 4.]
with self.assertRaisesRegexp(ValueError, "interpolation"):
sample_stats.percentile(x, q=0.5, interpolation="bad") | npuichigo/ttsflow | [
16,
6,
16,
1,
1500635633
] |
def test_vector_q_raises_dynamic(self):
x = [1., 5., 3., 2., 4.]
q_ph = array_ops.placeholder(dtypes.float32)
pct = sample_stats.percentile(x, q=q_ph, validate_args=True)
with self.test_session():
with self.assertRaisesOpError("rank"):
pct.eval(feed_dict={q_ph: [0.5]}) | npuichigo/ttsflow | [
16,
6,
16,
1,
1500635633
] |
def __init__(self, screen, folder, interval = None, autoplay = True):
super(Animation, self).__init__(screen)
if folder[:-1] != '/':
folder = folder + '/' | marian42/pixelpi | [
90,
15,
90,
3,
1440634832
] |
def load_frames(self):
self.frames = []
i = 0
while os.path.isfile(self.folder + str(i) + '.bmp'):
try:
bmp = pygame.image.load(self.folder + str(i) + '.bmp')
except Exception:
print('Error loading ' + str(i) + '.bmp from ' + self.folder)
raise
pixel_array = pygame.PixelArray(bmp) | marian42/pixelpi | [
90,
15,
90,
3,
1440634832
] |
def is_single_file(self):
return os.path.isfile(self.folder + '0.bmp') and not os.path.isfile(self.folder + '1.bmp') | marian42/pixelpi | [
90,
15,
90,
3,
1440634832
] |
def load_single(self):
self.frames = []
bmp = pygame.image.load(self.folder + '0.bmp')
framecount = bmp.get_height() / 16
pixel_array = pygame.PixelArray(bmp) | marian42/pixelpi | [
90,
15,
90,
3,
1440634832
] |
def load_interval(self):
cfg = ConfigParser.ConfigParser()
cfg.read(self.folder + 'config.ini')
return cfg.getint('animation', 'hold') | marian42/pixelpi | [
90,
15,
90,
3,
1440634832
] |
def on_start(self):
print('Starting ' + self.folder) | marian42/pixelpi | [
90,
15,
90,
3,
1440634832
] |
def test_01_setting_signature(self):
print("\nThe expected unit test environment is")
print("1. TBD")
self.assertEqual(gc.SETTING["SIGNATURE"],'LASS-SIM') | LinkItONEDevGroup/LASS | [
153,
77,
153,
3,
1435306462
] |
def test_03_check_dir_exist(self):
pass | LinkItONEDevGroup/LASS | [
153,
77,
153,
3,
1435306462
] |
def setUp(self):
self.request = Request('localhost', port=8182)
self.gremlin = Gremlin('gizmo_testing')
self.mapper = Mapper(self.request, self.gremlin)
self.ioloop = asyncio.get_event_loop()
super(BaseTests, self).setUp() | emehrkay/Gizmo | [
20,
3,
20,
1,
1417416909
] |
def hash(binary):
return hashlib.sha256(binary).hexdigest() | ultmaster/eoj3 | [
161,
29,
161,
27,
1489228488
] |
def main():
# Read the station lookup table
col, dummy = ascii_dat_read("ATCA_stations.txt", delim=" ",
doFloatCols=[2, 3])
statDict = {}
for station, N, W in zip(col[1], col[2], col[3]):
statDict[station] = (-W+1622.449, N)
# Read the array configura... | crpurcell/friendlyVRI | [
39,
12,
39,
2,
1488335416
] |
def request_oauth_token(request):
# We'll require a refresh in the blue dot cache
if BLUE_DOT_CACHE_KEY in request.session:
del request.session[BLUE_DOT_CACHE_KEY]
access_token_callback = settings.QUICKBOOKS['OAUTH_CALLBACK_URL']
if callable(access_token_callback):
access_token_callback... | grue/django-quickbooks-online | [
20,
12,
20,
20,
1394156571
] |
def get_access_token(request):
# [todo] - add doc string for get_access_token
session = OAuth1Session(client_key=settings.QUICKBOOKS['CONSUMER_KEY'],
client_secret=settings.QUICKBOOKS['CONSUMER_SECRET'],
resource_owner_key=request.session['qb_oauth_token']... | grue/django-quickbooks-online | [
20,
12,
20,
20,
1394156571
] |
def blue_dot_menu(request):
""" Returns the blue dot menu. If possible a cached copy is returned.
"""
html = request.session.get(BLUE_DOT_CACHE_KEY)
if not html:
html = request.session[BLUE_DOT_CACHE_KEY] = \
HttpResponse(QuickbooksApi(request.user).app_menu())
return html | grue/django-quickbooks-online | [
20,
12,
20,
20,
1394156571
] |
def test_simple_uri_comparision(uri):
u1 = URI(b'http://abc.com:80/~smith/home.html')
u2 = URI(b'http://ABC.com/%7Esmith/home.html')
u3 = URI(b'http://ABC.com:/%7esmith/home.html')
u4 = URI(b'http://ABC.com:/%7esmith/./home.html')
u5 = URI(b'http://ABC.com:/%7esmith/foo/../home.html')
assert u1 == u2
assert u2 =... | spaceone/httoop | [
17,
5,
17,
5,
1365534138
] |
def test_request_uri_is_star():
pass | spaceone/httoop | [
17,
5,
17,
5,
1365534138
] |
def test_invalid_uri_scheme():
pass | spaceone/httoop | [
17,
5,
17,
5,
1365534138
] |
def test_normalized_uri_redirects():
pass | spaceone/httoop | [
17,
5,
17,
5,
1365534138
] |
def setUp(self):
self.settings = get_project_settings()
self.settings.set('KAFKA_TOPIC_PREFIX', "demo_test")
# set up redis
self.redis_conn = redis.Redis(host=self.settings['REDIS_HOST'],
port=self.settings['REDIS_PORT'],
... | istresearch/scrapy-cluster | [
1100,
320,
1100,
15,
1429045924
] |
def thread_func():
time.sleep(20)
reactor.stop() | istresearch/scrapy-cluster | [
1100,
320,
1100,
15,
1429045924
] |
def tearDown(self):
keys = self.redis_conn.keys('stats:crawler:*:test-spider:*')
keys = keys + self.redis_conn.keys('test-spider:*')
for key in keys:
self.redis_conn.delete(key)
# if for some reason the tests fail, we end up falling behind on
# the consumer
f... | istresearch/scrapy-cluster | [
1100,
320,
1100,
15,
1429045924
] |
def __init__(
self, plotly_name="showtickprefix", parent_name="layout.yaxis", **kwargs | plotly/python-api | [
13052,
2308,
13052,
1319,
1385013188
] |
def format_subtables_for_results(table_ids):
parts = []
deferred_racials = defaultdict(list)
deferred_pr = []
for table in table_ids:
parsed = parse_table_id(table)
if parsed['racial']:
key = parsed['table_type']
if parsed['puerto_rico']:
key += '... | censusreporter/censusreporter | [
659,
135,
659,
96,
1369089960
] |
def setUp(self):
super(TokensTest, self).setUp()
TestClient.execute("""TRUNCATE auth_token""")
self.test_token_data = {'description': 'Test token 1',
'scope_push': True,
'scope_pull': True} | InfraBox/infrabox | [
44,
7,
44,
11,
1504426936
] |
def D_to_nu(D):
"""True anomaly from parabolic eccentric anomaly.
Parameters
----------
D : ~astropy.units.Quantity
Eccentric anomaly.
Returns
-------
nu : ~astropy.units.Quantity
True anomaly.
Notes
-----
Taken from Farnocchia, Davide, Davide Bracali Cioci, an... | poliastro/poliastro | [
713,
256,
713,
128,
1372947285
] |
def nu_to_D(nu):
"""Parabolic eccentric anomaly from true anomaly.
Parameters
----------
nu : ~astropy.units.Quantity
True anomaly.
Returns
-------
D : ~astropy.units.Quantity
Hyperbolic eccentric anomaly.
Notes
-----
Taken from Farnocchia, Davide, Davide Braca... | poliastro/poliastro | [
713,
256,
713,
128,
1372947285
] |
def nu_to_E(nu, ecc):
"""Eccentric anomaly from true anomaly.
.. versionadded:: 0.4.0
Parameters
----------
nu : ~astropy.units.Quantity
True anomaly.
ecc : ~astropy.units.Quantity
Eccentricity.
Returns
-------
E : ~astropy.units.Quantity
Eccentric anomaly.... | poliastro/poliastro | [
713,
256,
713,
128,
1372947285
] |
def nu_to_F(nu, ecc):
"""Hyperbolic eccentric anomaly from true anomaly.
Parameters
----------
nu : ~astropy.units.Quantity
True anomaly.
ecc : ~astropy.units.Quantity
Eccentricity (>1).
Returns
-------
F : ~astropy.units.Quantity
Hyperbolic eccentric anomaly.
... | poliastro/poliastro | [
713,
256,
713,
128,
1372947285
] |
def E_to_nu(E, ecc):
"""True anomaly from eccentric anomaly.
.. versionadded:: 0.4.0
Parameters
----------
E : ~astropy.units.Quantity
Eccentric anomaly.
ecc : ~astropy.units.Quantity
Eccentricity.
Returns
-------
nu : ~astropy.units.Quantity
True anomaly.
... | poliastro/poliastro | [
713,
256,
713,
128,
1372947285
] |
def F_to_nu(F, ecc):
"""True anomaly from hyperbolic eccentric anomaly.
Parameters
----------
F : ~astropy.units.Quantity
Hyperbolic eccentric anomaly.
ecc : ~astropy.units.Quantity
Eccentricity (>1).
Returns
-------
nu : ~astropy.units.Quantity
True anomaly.
... | poliastro/poliastro | [
713,
256,
713,
128,
1372947285
] |
def M_to_E(M, ecc):
"""Eccentric anomaly from mean anomaly.
.. versionadded:: 0.4.0
Parameters
----------
M : ~astropy.units.Quantity
Mean anomaly.
ecc : ~astropy.units.Quantity
Eccentricity.
Returns
-------
E : ~astropy.units.Quantity
Eccentric anomaly.
... | poliastro/poliastro | [
713,
256,
713,
128,
1372947285
] |
def M_to_F(M, ecc):
"""Hyperbolic eccentric anomaly from mean anomaly.
Parameters
----------
M : ~astropy.units.Quantity
Mean anomaly.
ecc : ~astropy.units.Quantity
Eccentricity (>1).
Returns
-------
F : ~astropy.units.Quantity
Hyperbolic eccentric anomaly.
... | poliastro/poliastro | [
713,
256,
713,
128,
1372947285
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.