function stringlengths 11 56k | repo_name stringlengths 5 60 | features list |
|---|---|---|
def n_rvs(self):
return self._alpha.size | csferrie/python-qinfer | [
91,
32,
91,
22,
1344992565
] |
def __init__(self, n, alpha=None, beta=None, mean=None, var=None):
self.n = n
if alpha is not None and beta is not None:
self.alpha = alpha
self.beta = beta
self.mean = n * alpha / (alpha + beta)
self.var = n * alpha * beta * (alpha + beta + n) / ((alpha ... | csferrie/python-qinfer | [
91,
32,
91,
22,
1344992565
] |
def n_rvs(self):
return 1 | csferrie/python-qinfer | [
91,
32,
91,
22,
1344992565
] |
def __init__(self, alpha=None, beta=None, mean=None, var=None):
if alpha is not None and beta is not None:
self.alpha = alpha
self.beta = beta
self.mean = alpha / beta
self.var = alpha / beta ** 2
elif mean is not None and var is not None:
self... | csferrie/python-qinfer | [
91,
32,
91,
22,
1344992565
] |
def n_rvs(self):
return 1 | csferrie/python-qinfer | [
91,
32,
91,
22,
1344992565
] |
def __init__(self, dim = 6):
warnings.warn(
"This class has been deprecated, and may "
"be renamed in future versions.",
DeprecationWarning
)
self._dim = dim | csferrie/python-qinfer | [
91,
32,
91,
22,
1344992565
] |
def n_rvs(self):
return self._dim | csferrie/python-qinfer | [
91,
32,
91,
22,
1344992565
] |
def __init__(self, num_bits):
self._num_bits = num_bits | csferrie/python-qinfer | [
91,
32,
91,
22,
1344992565
] |
def n_rvs(self):
return 1 | csferrie/python-qinfer | [
91,
32,
91,
22,
1344992565
] |
def __init__(self, dim=2):
warnings.warn(
"This class has been deprecated; please see "
"qinfer.tomography.GinibreDistribution(rank=None).",
DeprecationWarning
)
self.dim = dim
self.paulis1Q = np.array([[[1,0],[0,1]],[[1,0],[0,-1]],[[0,-1j],[1j,0]],[[0... | csferrie/python-qinfer | [
91,
32,
91,
22,
1344992565
] |
def n_rvs(self):
return self.dim**2 - 1 | csferrie/python-qinfer | [
91,
32,
91,
22,
1344992565
] |
def make_Paulis(self,paulis,d):
if d == self.dim*2:
return paulis
else:
temp = np.zeros([d**2,d,d],dtype='complex128')
for idx in range(temp.shape[0]):
temp[idx,:] = np.kron(paulis[np.trunc(idx/d)], self.paulis1Q[idx % 4])
return self.make_... | csferrie/python-qinfer | [
91,
32,
91,
22,
1344992565
] |
def __init__(self, dim=2):
warnings.warn(
"This class has been deprecated; please see "
"qinfer.tomography.GinibreDistribution(rank=1).",
DeprecationWarning
)
# TODO: add basis as an option
self.dim = dim | csferrie/python-qinfer | [
91,
32,
91,
22,
1344992565
] |
def n_rvs(self):
return 3 | csferrie/python-qinfer | [
91,
32,
91,
22,
1344992565
] |
def __init__(self,dim=2, k=2):
warnings.warn(
"This class has been deprecated; please see "
"qinfer.tomography.GinibreDistribution.",
DeprecationWarning
)
self.dim = dim
self.k = k | csferrie/python-qinfer | [
91,
32,
91,
22,
1344992565
] |
def n_rvs(self):
return 3 | csferrie/python-qinfer | [
91,
32,
91,
22,
1344992565
] |
def __init__(self, distribution, model, maxiters=100):
self._dist = distribution
self._model = model
self._maxiters = maxiters | csferrie/python-qinfer | [
91,
32,
91,
22,
1344992565
] |
def n_rvs(self):
return self._dist.n_rvs | csferrie/python-qinfer | [
91,
32,
91,
22,
1344992565
] |
def grad_log_pdf(self, x):
return self._dist.grad_log_pdf(x) | csferrie/python-qinfer | [
91,
32,
91,
22,
1344992565
] |
def __init__(self, pdf, compactification_scale=1, n_interp_points=1500):
self._pdf = pdf
self._xs = u.compactspace(compactification_scale, n_interp_points)
self._generate_interp() | csferrie/python-qinfer | [
91,
32,
91,
22,
1344992565
] |
def n_rvs(self):
return 1 | csferrie/python-qinfer | [
91,
32,
91,
22,
1344992565
] |
def __init__(self, underlying_distribution, desired_total=1):
super(ConstrainedSumDistribution, self).__init__()
self._ud = underlying_distribution
self.desired_total = desired_total | csferrie/python-qinfer | [
91,
32,
91,
22,
1344992565
] |
def underlying_distribution(self):
return self._ud | csferrie/python-qinfer | [
91,
32,
91,
22,
1344992565
] |
def n_rvs(self):
return self.underlying_distribution.n_rvs | csferrie/python-qinfer | [
91,
32,
91,
22,
1344992565
] |
def Args(parser):
health_checks_utils.AddHttpRelatedCreationArgs(parser)
health_checks_utils.AddProtocolAgnosticCreationArgs(parser, 'HTTP') | KaranToor/MA450 | [
1,
1,
1,
4,
1484697944
] |
def service(self):
return self.compute.healthChecks | KaranToor/MA450 | [
1,
1,
1,
4,
1484697944
] |
def method(self):
return 'Insert' | KaranToor/MA450 | [
1,
1,
1,
4,
1484697944
] |
def resource_type(self):
return 'healthChecks' | KaranToor/MA450 | [
1,
1,
1,
4,
1484697944
] |
def Args(parser):
Create.Args(parser)
health_checks_utils.AddHttpRelatedResponseArg(parser) | KaranToor/MA450 | [
1,
1,
1,
4,
1484697944
] |
def setUpClass(cls):
super(VolumeQuotasNegativeTestJSON, cls).setUpClass()
demo_user = cls.isolated_creds.get_primary_creds()
cls.demo_tenant_id = demo_user.tenant_id
cls.shared_quota_set = {'gigabytes': 3, 'volumes': 1, 'snapshots': 1}
# NOTE(gfidente): no need to restore origi... | Mirantis/tempest | [
2,
7,
2,
1,
1327963146
] |
def test_quota_volumes(self):
self.assertRaises(exceptions.OverLimit,
self.volumes_client.create_volume,
size=1) | Mirantis/tempest | [
2,
7,
2,
1,
1327963146
] |
def test_quota_volume_snapshots(self):
self.assertRaises(exceptions.OverLimit,
self.snapshots_client.create_snapshot,
self.volume['id']) | Mirantis/tempest | [
2,
7,
2,
1,
1327963146
] |
def test_quota_volume_gigabytes(self):
# NOTE(gfidente): quota set needs to be changed for this test
# or we may be limited by the volumes or snaps quota number, not by
# actual gigs usage; next line ensures shared set is restored.
self.addCleanup(self.quotas_client.update_quota_set,
... | Mirantis/tempest | [
2,
7,
2,
1,
1327963146
] |
def parse_mailmap(mailmap='.mailmap'):
mapping = {}
if os.path.exists(mailmap):
fp = open(mailmap, 'r')
for l in fp:
l = l.strip()
if not l.startswith('#') and ' ' in l:
canonical_email, alias = l.split(' ')
mapping[alias] = canonical_email... | chmouel/python-swiftclient | [
5,
2,
5,
1,
1329139665
] |
def get_reqs_from_files(requirements_files):
reqs_in = []
for requirements_file in requirements_files:
if os.path.exists(requirements_file):
return open(requirements_file, 'r').read().split('\n')
return [] | chmouel/python-swiftclient | [
5,
2,
5,
1,
1329139665
] |
def parse_dependency_links(requirements_files=['requirements.txt',
'tools/pip-requires']):
dependency_links = []
# dependency_links inject alternate locations to find packages listed
# in requirements
for line in get_reqs_from_files(requirements_files):
... | chmouel/python-swiftclient | [
5,
2,
5,
1,
1329139665
] |
def _run_shell_command(cmd):
output = subprocess.Popen(["/bin/sh", "-c", cmd],
stdout=subprocess.PIPE)
out = output.communicate()
if len(out) == 0:
return None
if len(out[0].strip()) == 0:
return None
return out[0].strip() | chmouel/python-swiftclient | [
5,
2,
5,
1,
1329139665
] |
def _get_git_current_tag():
return _run_shell_command("git tag --contains HEAD") | chmouel/python-swiftclient | [
5,
2,
5,
1,
1329139665
] |
def _get_git_post_version():
current_tag = _get_git_current_tag()
if current_tag is not None:
return current_tag
else:
tag_info = _get_git_tag_info()
if tag_info is None:
base_version = "0.0"
cmd = "git --no-pager log --oneline"
out = _run_shell_co... | chmouel/python-swiftclient | [
5,
2,
5,
1,
1329139665
] |
def generate_authors():
"""Create AUTHORS file using git commits."""
jenkins_email = 'jenkins@review.openstack.org'
old_authors = 'AUTHORS.in'
new_authors = 'AUTHORS'
if os.path.isdir('.git'):
# don't include jenkins email address in AUTHORS file
git_log_cmd = ("git log --format='%aN... | chmouel/python-swiftclient | [
5,
2,
5,
1,
1329139665
] |
def read_versioninfo(project):
"""Read the versioninfo file. If it doesn't exist, we're in a github
zipball, and there's really know way to know what version we really
are, but that should be ok, because the utility of that should be
just about nil if this code path is in use in the first place... | chmouel/python-swiftclient | [
5,
2,
5,
1,
1329139665
] |
def get_cmdclass():
"""Return dict of commands to run from setup.py."""
cmdclass = dict()
def _find_modules(arg, dirname, files):
for filename in files:
if filename.endswith('.py') and filename != '__init__.py':
arg["%s.%s" % (dirname.replace('/', '.'),
... | chmouel/python-swiftclient | [
5,
2,
5,
1,
1329139665
] |
def run(self):
if not os.getenv('SPHINX_DEBUG'):
self.generate_autoindex()
for builder in ['html', 'man']:
self.builder = builder
self.finalize_options()
self.project = self.distribution.get_name()
... | chmouel/python-swiftclient | [
5,
2,
5,
1,
1329139665
] |
def get_git_branchname():
for branch in _run_shell_command("git branch --color=never").split("\n"):
if branch.startswith('*'):
_branch_name = branch.split()[1].strip()
if _branch_name == "(no":
_branch_name = "no-branch"
return _branch_name | chmouel/python-swiftclient | [
5,
2,
5,
1,
1329139665
] |
def __init__(self, name=""):
self.name = name
self.instr_group = "Instruction Group"
self.instr_format = "Instruction Format"
self.instr_category = "Instruction Category"
self.instr_name = "Instruction Name"
self.instr_imm_t = "Instruction Immediate Type"
self.instr_src2 = "Instruction Sourc... | lowRISC/ibex | [
932,
400,
932,
152,
1502194596
] |
def convert2asm(self):
asm = name = self.solution[self.instr_name]
format = self.solution[self.instr_format]
category = self.solution[self.instr_category]
src2 = self.solution[self.instr_src2]
src1 = self.solution[self.instr_src1]
destination = self.solution[self.instr_rd]
csr = self.solutio... | lowRISC/ibex | [
932,
400,
932,
152,
1502194596
] |
def convert2bin(self, sol):
name = sol[self.instr_name]
format = sol[self.instr_format]
imm = sol[self.imm]
rd = sol[self.instr_rd]
if format == "J_FORMAT":
binary = "" | lowRISC/ibex | [
932,
400,
932,
152,
1502194596
] |
def get_imm(self):
return self.imm_str | lowRISC/ibex | [
932,
400,
932,
152,
1502194596
] |
def default_c(is_pseudo_instr):
if not is_pseudo_instr:
return True | lowRISC/ibex | [
932,
400,
932,
152,
1502194596
] |
def fence_c(name, source1, destination, imm):
if name == "FENCE" or name == "FENCEI":
if source1 == "ZERO" and destination == "ZERO" and imm == 0:
return True
else:
return True | lowRISC/ibex | [
932,
400,
932,
152,
1502194596
] |
def nop_c(name, source1, source2, destination):
if name == "NOP":
if source1 == "ZERO" and source2 == "ZERO" and destination == "ZERO":
return True
else:
return True | lowRISC/ibex | [
932,
400,
932,
152,
1502194596
] |
def imm_len_c(format, imm_t, imm_length):
if format == "U_FORMAT" or format == "J_FORMAT":
return imm_length == 20
elif format == "I_FORMAT" or format == "S_FORMAT" or format == "B_FORMAT":
if imm_t == "UIMM":
return imm_length == 5
else:
return imm_length == 11
... | lowRISC/ibex | [
932,
400,
932,
152,
1502194596
] |
def shift_imm_val_c(category, imm):
if category == "SHIFT":
return imm < utils.XLEN
else:
return True | lowRISC/ibex | [
932,
400,
932,
152,
1502194596
] |
def non_system(category):
if category != "SYSTEM":
return True | lowRISC/ibex | [
932,
400,
932,
152,
1502194596
] |
def non_synch(category):
if category != "SYNCH":
return True | lowRISC/ibex | [
932,
400,
932,
152,
1502194596
] |
def no_load_store_c(category):
if category != "LOAD" and category != "STORE":
return True | lowRISC/ibex | [
932,
400,
932,
152,
1502194596
] |
def randomize(self):
# old randomize()
# self.solution = self.problem.getSolution()
# self.post_randomize()
self.solution = self.problem.getSolution()
if self.solution:
# print("TODO: randomized with steps: {}".format(self.problem._solver._steps))
pass
else:
i = 1
while ... | lowRISC/ibex | [
932,
400,
932,
152,
1502194596
] |
def __init__(self, name=""):
# calling super constructor
riscv_instr_base.__init__(self, name)
# Important: Constraint solver gets too slow in pseudo class. We have three solutions:
# 1- change the type of the constraint solver, from MinConflict to regular, this one
# also takes fairly good amount o... | lowRISC/ibex | [
932,
400,
932,
152,
1502194596
] |
def pseudo_name_c(name, group, format, category):
condition = (((name == "LI" or name == "LA") and group == "RV32I" and
format == "I_FORMAT" and category == "LOAD"))
if condition:
return True | lowRISC/ibex | [
932,
400,
932,
152,
1502194596
] |
def default_c(is_pseudo_instr):
if is_pseudo_instr:
return True | lowRISC/ibex | [
932,
400,
932,
152,
1502194596
] |
def convert2asm(self):
asm_str = self.get_instr_name()
destination = self.solution[self.instr_rd]
# instr rd,imm
asm_str = "{} {}, {}".format(asm_str, destination, self.get_imm())
if self.comment != "":
asm_str = asm_str + " #" + self.comment
return asm_str.lower() | lowRISC/ibex | [
932,
400,
932,
152,
1502194596
] |
def testA():
# test A
assert packet.pack('A','C') == b'AC'
assert packet.pack('A','B') == b'AB'
assert packet.pack('A','C') != b'AB'
assert packet.unpack_stream(io.BytesIO(b'AC')) == ('A', 'C')
assert packet.unpack_stream(io.BytesIO(b'AB')) == ('A', 'B')
assert packet.unpack_stream(io.Byte... | mcdeoliveira/ctrl | [
11,
6,
11,
1,
1435356913
] |
def testS():
# test S
assert packet.pack('S','abc') == struct.pack('<cI3s', b'S', 3, b'abc')
assert packet.pack('S','abcd') != struct.pack('<cI3s', b'S', 3, b'abc')
assert packet.unpack_stream(
io.BytesIO(struct.pack('<cI3s', b'S', 3, b'abc'))) == ('S', 'abc')
assert packet.unpack_stream(... | mcdeoliveira/ctrl | [
11,
6,
11,
1,
1435356913
] |
def testV():
# test VI
vector = numpy.array((1,2,3), int)
assert packet.pack('V',vector) == struct.pack('<ccIiii', b'V', b'I', 3, 1, 2, 3)
(type, rvector) = packet.unpack_stream(
io.BytesIO(struct.pack('<ccIiii', b'V', b'I', 3, 1, 2, 3)))
assert type == 'V'
assert numpy.all(rvector == ... | mcdeoliveira/ctrl | [
11,
6,
11,
1,
1435356913
] |
def testP():
vector = numpy.array(((1.3,-2,3), (0,-1,2.5)), numpy.float)
string = packet.pack('P', vector)
(type, rvector) = packet.unpack_stream(io.BytesIO(string))
assert type == 'P'
assert numpy.all(rvector == vector) | mcdeoliveira/ctrl | [
11,
6,
11,
1,
1435356913
] |
def __init__(self, device, cmdline_file):
"""Initializes the FlagChanger and records the original arguments.
Args:
device: A DeviceUtils instance.
cmdline_file: Path to the command line file on the device.
"""
self._device = device
self._cmdline_file = cmdline_file
# Save the origi... | Teamxrtc/webrtc-streaming-node | [
6,
5,
6,
2,
1449773735
] |
def Set(self, flags):
"""Replaces all flags on the current command line with the flags given.
Args:
flags: A list of flags to set, eg. ['--single-process'].
"""
if flags:
assert flags[0] != 'chrome'
self._current_flags = flags
self._UpdateCommandLineFile() | Teamxrtc/webrtc-streaming-node | [
6,
5,
6,
2,
1449773735
] |
def RemoveFlags(self, flags):
"""Removes flags from the command line, if they exist.
Args:
flags: A list of flags to remove, eg. ['--single-process']. Note that we
expect a complete match when removing flags; if you want to remove
a switch with a value, you must use the exact s... | Teamxrtc/webrtc-streaming-node | [
6,
5,
6,
2,
1449773735
] |
def _UpdateCommandLineFile(self):
"""Writes out the command line to the file, or removes it if empty."""
logging.info('Current flags: %s', self._current_flags)
# Root is not required to write to /data/local/tmp/.
use_root = '/data/local/tmp/' not in self._cmdline_file
if self._current_flags:
#... | Teamxrtc/webrtc-streaming-node | [
6,
5,
6,
2,
1449773735
] |
def generate(data):
data['correct_answers']['x'] = 3 | PrairieLearn/PrairieLearn | [
246,
250,
246,
871,
1400730536
] |
def test_trigger(self) -> None:
expected_message = 'Incident [3](https://zulip-test.pagerduty.com/incidents/P140S4Y) triggered by [Test service](https://zulip-test.pagerduty.com/services/PIL5CUQ) (assigned to [armooo](https://zulip-test.pagerduty.com/users/POBCFRJ)):\n\n``` quote\nfoo\n```'
self.send_an... | timabbott/zulip | [
2,
7,
2,
1,
1443209656
] |
def test_trigger_without_assignee_v2(self) -> None:
expected_message = 'Incident [33](https://webdemo.pagerduty.com/incidents/PRORDTY) triggered by [Production XDB Cluster](https://webdemo.pagerduty.com/services/PN49J75) (assigned to nobody):\n\n``` quote\nMy new incident\n```'
self.send_and_test_stream... | timabbott/zulip | [
2,
7,
2,
1,
1443209656
] |
def test_resolved(self) -> None:
expected_message = 'Incident [1](https://zulip-test.pagerduty.com/incidents/PO1XIJ5) resolved by [armooo](https://zulip-test.pagerduty.com/users/POBCFRJ):\n\n``` quote\nIt is on fire\n```'
self.send_and_test_stream_message('resolved', "Incident 1", expected_message) | timabbott/zulip | [
2,
7,
2,
1,
1443209656
] |
def test_auto_resolved(self) -> None:
expected_message = 'Incident [2](https://zulip-test.pagerduty.com/incidents/PX7K9J2) resolved:\n\n``` quote\nnew\n```'
self.send_and_test_stream_message('auto_resolved', "Incident 2", expected_message) | timabbott/zulip | [
2,
7,
2,
1,
1443209656
] |
def test_acknowledge_without_trigger_summary_data(self) -> None:
expected_message = 'Incident [1](https://zulip-test.pagerduty.com/incidents/PO1XIJ5) acknowledged by [armooo](https://zulip-test.pagerduty.com/users/POBCFRJ):\n\n``` quote\n\n```'
self.send_and_test_stream_message('acknowledge_without_trig... | timabbott/zulip | [
2,
7,
2,
1,
1443209656
] |
def test_incident_assigned_v2(self) -> None:
expected_message = 'Incident [33](https://webdemo.pagerduty.com/incidents/PRORDTY) assigned to [Wiley Jacobson](https://webdemo.pagerduty.com/users/PFBSJ2Z):\n\n``` quote\nMy new incident\n```'
self.send_and_test_stream_message('assign_v2', 'Incident 33', exp... | timabbott/zulip | [
2,
7,
2,
1,
1443209656
] |
def setup_platform(hass, config, add_devices, discovery_info=None):
"""Setup the Demo covers."""
add_devices([
DemoCover(hass, 'Kitchen Window'),
DemoCover(hass, 'Hall Window', 10),
DemoCover(hass, 'Living Room Window', 70, 50),
]) | Smart-Torvy/torvy-home-assistant | [
1,
1,
1,
2,
1460403687
] |
def __init__(self, hass, name, position=None, tilt_position=None):
"""Initialize the cover."""
self.hass = hass
self._name = name
self._position = position
self._set_position = None
self._set_tilt_position = None
self._tilt_position = tilt_position
self._c... | Smart-Torvy/torvy-home-assistant | [
1,
1,
1,
2,
1460403687
] |
def name(self):
"""Return the name of the cover."""
return self._name | Smart-Torvy/torvy-home-assistant | [
1,
1,
1,
2,
1460403687
] |
def should_poll(self):
"""No polling needed for a demo cover."""
return False | Smart-Torvy/torvy-home-assistant | [
1,
1,
1,
2,
1460403687
] |
def current_cover_position(self):
"""Return the current position of the cover."""
return self._position | Smart-Torvy/torvy-home-assistant | [
1,
1,
1,
2,
1460403687
] |
def current_cover_tilt_position(self):
"""Return the current tilt position of the cover."""
return self._tilt_position | Smart-Torvy/torvy-home-assistant | [
1,
1,
1,
2,
1460403687
] |
def is_closed(self):
"""Return if the cover is closed."""
if self._position is not None:
if self.current_cover_position > 0:
return False
else:
return True
else:
return None | Smart-Torvy/torvy-home-assistant | [
1,
1,
1,
2,
1460403687
] |
def close_cover_tilt(self, **kwargs):
"""Close the cover tilt."""
if self._tilt_position in (0, None):
return
self._listen_cover_tilt()
self._closing_tilt = True | Smart-Torvy/torvy-home-assistant | [
1,
1,
1,
2,
1460403687
] |
def open_cover_tilt(self, **kwargs):
"""Open the cover tilt."""
if self._tilt_position in (100, None):
return
self._listen_cover_tilt()
self._closing_tilt = False | Smart-Torvy/torvy-home-assistant | [
1,
1,
1,
2,
1460403687
] |
def set_cover_tilt_position(self, tilt_position, **kwargs):
"""Move the cover til to a specific position."""
self._set_tilt_position = round(tilt_position, -1)
if self._tilt_position == tilt_position:
return
self._listen_cover_tilt()
self._closing_tilt = tilt_positio... | Smart-Torvy/torvy-home-assistant | [
1,
1,
1,
2,
1460403687
] |
def stop_cover_tilt(self, **kwargs):
"""Stop the cover tilt."""
if self._tilt_position is None:
return
if self._unsub_listener_cover_tilt is not None:
self._unsub_listener_cover_tilt()
self._unsub_listener_cover_tilt = None
self._set_tilt_position... | Smart-Torvy/torvy-home-assistant | [
1,
1,
1,
2,
1460403687
] |
def _time_changed_cover(self, now):
"""Track time changes."""
if self._closing:
self._position -= 10
else:
self._position += 10
if self._position in (100, 0, self._set_position):
self.stop_cover()
self.update_ha_state() | Smart-Torvy/torvy-home-assistant | [
1,
1,
1,
2,
1460403687
] |
def setUp(self):
super().setUp()
self.adapter = DOTAdapter()
self.user = UserFactory()
self.client = self.adapter.create_public_client(
name='public app',
user=self.user,
redirect_uri=DUMMY_REDIRECT_URL,
client_id='public-client-id',
... | eduNEXT/edx-platform | [
5,
3,
5,
6,
1390926698
] |
def test_create_token_success(self):
token = api.create_dot_access_token(HttpRequest(), self.user, self.client)
assert token['access_token']
assert token['refresh_token']
self.assertDictContainsSubset(
{
'token_type': 'Bearer',
'expires_in': EX... | eduNEXT/edx-platform | [
5,
3,
5,
6,
1390926698
] |
def add_filters(self, **kwargs):
"""
Returns the queryset with new filters
"""
return super(AOIManager, self).get_query_set().filter(**kwargs) | stephenrjones/geoq | [
4,
14,
4,
3,
1398889424
] |
def assigned(self):
"""
Returns assigned AOIs.
"""
return self.add_filters(status='Assigned') | stephenrjones/geoq | [
4,
14,
4,
3,
1398889424
] |
def submitted(self):
"""
Returns submitted AOIs.
"""
return self.add_filters(status='Submitted') | stephenrjones/geoq | [
4,
14,
4,
3,
1398889424
] |
def test_create_and_delete_directory(self):
file_io.create_dir_v2('ram://testdirectory')
file_io.delete_recursively_v2('ram://testdirectory') | tensorflow/tensorflow | [
171949,
87931,
171949,
2300,
1446859160
] |
def test_write_file(self):
with gfile.GFile('ram://a.txt', 'w') as f:
f.write('Hello, world.')
f.write('Hello, world.')
with gfile.GFile('ram://a.txt', 'r') as f:
self.assertEqual(f.read(), 'Hello, world.' * 2) | tensorflow/tensorflow | [
171949,
87931,
171949,
2300,
1446859160
] |
def test_list_dir(self):
for i in range(10):
with gfile.GFile('ram://a/b/%d.txt' % i, 'w') as f:
f.write('')
with gfile.GFile('ram://c/b/%d.txt' % i, 'w') as f:
f.write('')
matches = ['%d.txt' % i for i in range(10)]
self.assertEqual(gfile.ListDirectory('ram://a/b/'), matches) | tensorflow/tensorflow | [
171949,
87931,
171949,
2300,
1446859160
] |
def test_file_exists(self):
with gfile.GFile('ram://exists/a/b/c.txt', 'w') as f:
f.write('')
self.assertTrue(gfile.Exists('ram://exists/a'))
self.assertTrue(gfile.Exists('ram://exists/a/b'))
self.assertTrue(gfile.Exists('ram://exists/a/b/c.txt'))
self.assertFalse(gfile.Exists('ram://exists/b... | tensorflow/tensorflow | [
171949,
87931,
171949,
2300,
1446859160
] |
def model_fn(features, labels, mode, params):
del params
x = core_layers.dense(features, 100)
x = core_layers.dense(x, 100)
x = core_layers.dense(x, 100)
x = core_layers.dense(x, 100)
y = core_layers.dense(x, 1)
loss = losses.mean_squared_error(labels, y)
opt = adam.AdamO... | tensorflow/tensorflow | [
171949,
87931,
171949,
2300,
1446859160
] |
def test_savedmodel(self):
class MyModule(module.Module):
@def_function.function(input_signature=[])
def foo(self):
return constant_op.constant([1])
saved_model.save(MyModule(), 'ram://my_module')
loaded = saved_model.load('ram://my_module')
self.assertAllEqual(loaded.foo(), [1]) | tensorflow/tensorflow | [
171949,
87931,
171949,
2300,
1446859160
] |
def KillAllAdb():
def get_all_adb():
for p in psutil.process_iter():
try:
# Retrieve all required process infos at once.
pinfo = p.as_dict(attrs=['pid', 'name', 'cmdline'])
if pinfo['name'] == 'adb':
pinfo['cmdline'] = ' '.join(pinfo['cmdline'])
yield p, pinfo
... | catapult-project/catapult | [
1835,
570,
1835,
1039,
1429033745
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.