function stringlengths 11 56k | repo_name stringlengths 5 60 | features list |
|---|---|---|
def grad(w, X, y, L, K):
g,_ = getAvgGradient(w, X, y, L, K)
return g | jihunhamm/Crowd-ML | [
16,
10,
16,
5,
1463416723
] |
def setup_method(self, method):
self.easy_data = pd.DataFrame({"A": np.random.randn(10),
"B": np.random.randn(10),
"C": np.random.randn(10),
"datetime": pd.date_range('1/1/2019', periods=10)})
... | intel-analytics/analytics-zoo | [
2553,
722,
2553,
534,
1493951250
] |
def imports(
self, interface: str, module_imports: dict[str, str] | flacjacket/pywayland | [
64,
11,
64,
8,
1427851565
] |
def method_type(self) -> str:
pass | flacjacket/pywayland | [
64,
11,
64,
8,
1427851565
] |
def method_args(self) -> Iterable[str]:
pass | flacjacket/pywayland | [
64,
11,
64,
8,
1427851565
] |
def return_type(self) -> str:
pass | flacjacket/pywayland | [
64,
11,
64,
8,
1427851565
] |
def output_doc_params(self, printer: Printer) -> None:
pass | flacjacket/pywayland | [
64,
11,
64,
8,
1427851565
] |
def output_body(self, printer: Printer, opcode: int) -> None:
pass | flacjacket/pywayland | [
64,
11,
64,
8,
1427851565
] |
def test_i386():
p = angr.Project(os.path.join(test_location, 'i386', 'test_strcasecmp'), auto_load_libs=False)
arg1 = claripy.BVS('arg1', 20*8)
s = p.factory.entry_state(args=("test_strcasecmp", arg1))
sm = p.factory.simulation_manager(s)
sm.explore()
sm.move('deadended', 'found', filter_func=... | angr/angr | [
6420,
966,
6420,
287,
1438897615
] |
def test_ui_gotopage_security_groups(self):
print
print "Started Test: GotoPage Security Groups"
self.click_element_by_id("euca-logo")
print
print "Test: Received the Page Title -> " + self.driver.title
self.click_element_by_id("dashboard-netsec-sgroup")
print
... | eucalyptus/se34euca | [
12,
13,
12,
18,
1352789276
] |
def test_ui_create_empty_security_group(self):
print
print "Started Test: Create Security Group"
self.click_element_by_link_text("Dashboard")
self.verify_element_by_link_text("Launch new instance")
print
print "Test: Go to the Page Security Group"
self.click_eleme... | eucalyptus/se34euca | [
12,
13,
12,
18,
1352789276
] |
def test_ui_delete_security_group(self):
print
print "Started Test: Delete Security Group"
self.click_element_by_link_text("Dashboard")
self.verify_element_by_link_text("Launch new instance")
print
print "Test: Go to the Page Security Group"
self.click_element_by_... | eucalyptus/se34euca | [
12,
13,
12,
18,
1352789276
] |
def test_ui_check_security_group_count(self, sg_count):
print
print "Started Test: Check Security Group Count"
self.click_element_by_link_text("Dashboard")
self.verify_element_by_link_text("Launch new instance")
print "Verifying that Security Group Count on Dashboard is "+sg_coun... | eucalyptus/se34euca | [
12,
13,
12,
18,
1352789276
] |
def test_cromu_00070_caching():
# Test exploitation of CROMU_00070 given an input which causes a leak. Then test that we can do it again restoring
# from the cache.
for _ in range(2):
payload = bytes.fromhex("06000006020a00000000000000000000000c030c00000100e1f505000000000000eb")
cg = colorg... | mechaphish/colorguard | [
11,
11,
11,
1,
1471720164
] |
def setUp(self):
self.set_filename('image51.xlsx') | jmcnamara/XlsxWriter | [
3172,
594,
3172,
18,
1357261626
] |
def __init__(self, *args, **kwargs):
super(Roles, self).__init__(*args, **kwargs)
self.roles = []
self.policies = [] | remind101/stacker_blueprints | [
40,
52,
40,
16,
1449594934
] |
def create_ec2_role(self, name):
return self.create_role(name, get_default_assumerole_policy()) | remind101/stacker_blueprints | [
40,
52,
40,
16,
1449594934
] |
def generate_policy_statements(self):
"""Should be overridden on a subclass to create policy statements.
By subclassing this blueprint, and overriding this method to generate
a list of :class:`awacs.aws.Statement` types, a
:class:`troposphere.iam.PolicyType` will be created and attached... | remind101/stacker_blueprints | [
40,
52,
40,
16,
1449594934
] |
def list(self, survey_id, **kwargs):
kwargs.update({'survey_id': survey_id, })
return super(SurveyPage, self).list(**kwargs) | ITNG/SurveyGizmo | [
16,
19,
16,
4,
1372462650
] |
def create(self, survey_id, title, **kwargs):
kwargs.update({
'survey_id': survey_id,
'title': title,
})
return super(SurveyPage, self).create(**kwargs) | ITNG/SurveyGizmo | [
16,
19,
16,
4,
1372462650
] |
def copy(self, **kwargs):
raise NotImplementedError() | ITNG/SurveyGizmo | [
16,
19,
16,
4,
1372462650
] |
def get_permission_decorator():
if getattr(settings, 'CENTAUR_PERMISSION_DECORATOR', None):
module, decorator = settings.CENTAUR_PERMISSION_DECORATOR.rsplit('.', 1)
return getattr(import_module(module), decorator)
return user_passes_test(lambda u: u.is_superuser) | potatolondon/centaur | [
2,
3,
2,
1,
1398151823
] |
def timestamp(datetime):
""" Returns UTC timestamp, this is included in python3 but not 2"""
return calendar.timegm(datetime.timetuple()) | potatolondon/centaur | [
2,
3,
2,
1,
1398151823
] |
def index(request):
errors = Error.objects.all()
# Filter by user email
if request.GET.get('user', None):
errors_pks = [e.error.pk for e in Event.objects.filter(logged_in_user_email=request.GET.get('user'))]
errors = errors.filter(pk__in=errors_pks)
errors = errors.order_by("-last_eve... | potatolondon/centaur | [
2,
3,
2,
1,
1398151823
] |
def error(request, error_id, limit=200):
error = get_object_or_404(Error, pk=error_id)
events = error.events.all().order_by("-created")[:limit]
series = [
timestamp(event.created.replace(minute=0, second=0, microsecond=0))
for event in events
]
page = request.GET.get('page', 1)
... | potatolondon/centaur | [
2,
3,
2,
1,
1398151823
] |
def clear_old_events(request):
defer(_clear_old_events, _queue=CLEANUP_QUEUE)
return HttpResponse("OK. Cleaning task deferred.") | potatolondon/centaur | [
2,
3,
2,
1,
1398151823
] |
def _update_error_count(error_id, events_removed):
@db.transactional(xg=True)
def txn():
_error = Error.objects.get(pk=error_id)
_error.event_count -= events_removed
_error.save()
txn() | potatolondon/centaur | [
2,
3,
2,
1,
1398151823
] |
def add_arguments(self, parser):
parser.add_argument('domain') | dimagi/commcare-hq | [
465,
201,
465,
202,
1247158807
] |
def get_duplicate_users(domain):
by_username = defaultdict(list)
for user_id, username in get_all_user_id_username_pairs_by_domain(domain, include_web_users=False):
by_username[username].append(user_id)
dupes = {}
for username, user_ids in by_username.items():
if len(user_ids) > 1:
... | dimagi/commcare-hq | [
465,
201,
465,
202,
1247158807
] |
def sharing_group_tuple(self, g):
return ("sg__%s" % g['_id'], '%s [case sharing]' % g['name']) | dimagi/commcare-hq | [
465,
201,
465,
202,
1247158807
] |
def static_options(self):
options = super(CaseListFilterUtils, self).static_options
# replace [Active Mobile Workers] and [Deactivated Mobile Workers] with case-list-specific options
assert options[0][0] == "t__0"
return [
("all_data", _("[All Data]")),
('project_... | dimagi/commcare-hq | [
465,
201,
465,
202,
1247158807
] |
def utils(self):
return CaseListFilterUtils(self.domain) | dimagi/commcare-hq | [
465,
201,
465,
202,
1247158807
] |
def show_all_data(mobile_user_and_group_slugs):
return 'all_data' in mobile_user_and_group_slugs | dimagi/commcare-hq | [
465,
201,
465,
202,
1247158807
] |
def show_project_data(mobile_user_and_group_slugs):
return 'project_data' in mobile_user_and_group_slugs | dimagi/commcare-hq | [
465,
201,
465,
202,
1247158807
] |
def show_deactivated_data(mobile_user_and_group_slugs):
from corehq.apps.reports.models import HQUserType
return "t__{}".format(HQUserType.DEACTIVATED) in mobile_user_and_group_slugs | dimagi/commcare-hq | [
465,
201,
465,
202,
1247158807
] |
def selected_sharing_group_ids(mobile_user_and_group_slugs):
return [g[4:] for g in mobile_user_and_group_slugs if g.startswith("sg__")] | dimagi/commcare-hq | [
465,
201,
465,
202,
1247158807
] |
def selected_group_ids(cls, mobile_user_and_group_slugs):
return (super(CaseListFilter, cls).selected_group_ids(mobile_user_and_group_slugs) +
cls.selected_sharing_group_ids(mobile_user_and_group_slugs)) | dimagi/commcare-hq | [
465,
201,
465,
202,
1247158807
] |
def test_init(self):
f = Field("test", b"\x01\x23", slice(10, 12), "std")
self.assertEqual(f.name, "test")
self.assertEqual(f.size, slice(10, 12, 1))
self.assertEqual(f.default, Value(b"\x01\x23", 10))
self.assertEqual(f.fuzz, "std") | ernw/dizzy | [
62,
10,
62,
1,
1529939719
] |
def test_add_unaligned(self):
pass | ernw/dizzy | [
62,
10,
62,
1,
1529939719
] |
def test_iter(self):
expected = [Value(b'\x01#', 10), Value(b'\x00\x00', 10), Value(b'\x00\x01', 10), Value(b'\x00\x02', 10),
Value(b'\x00\x03', 10), Value(b'\x00\x04', 10), Value(b'\x03\xfb', 10), Value(b'\x03\xfc', 10),
Value(b'\x03\xfd', 10), Value(b'\x03\xfe', 10), Va... | ernw/dizzy | [
62,
10,
62,
1,
1529939719
] |
def test_size(self):
f = Field("test", b"\x01\x23", 10, "std")
self.assertEqual(f.length(), 19)
self.assertEqual(len(list(f)), f.length()) | ernw/dizzy | [
62,
10,
62,
1,
1529939719
] |
def __init__(self, pos, char, name, color,
blocks=False, always_visible=False,
fighter=None, ai=None, item=None, equipment=None):
self.pos = pos
self.char = char
self.name = name
self.color = color
self.blocks = blocks
self.always_visible... | Naburimannu/libtcodpy-tutorial | [
11,
3,
11,
2,
1454382865
] |
def x(self):
return self.pos.x | Naburimannu/libtcodpy-tutorial | [
11,
3,
11,
2,
1454382865
] |
def y(self):
return self.pos.y | Naburimannu/libtcodpy-tutorial | [
11,
3,
11,
2,
1454382865
] |
def distance_to(self, other):
"""
Return the distance to another object.
"""
dx = other.x - self.x
dy = other.y - self.y
return math.sqrt(dx ** 2 + dy ** 2) | Naburimannu/libtcodpy-tutorial | [
11,
3,
11,
2,
1454382865
] |
def distance(self, pos):
"""
Return the distance to some coordinates.
"""
return math.sqrt((pos.x - self.x) ** 2 + (pos.y - self.y) ** 2) | Naburimannu/libtcodpy-tutorial | [
11,
3,
11,
2,
1454382865
] |
def set_owner(self, entity):
self.owner = entity | Naburimannu/libtcodpy-tutorial | [
11,
3,
11,
2,
1454382865
] |
def __init__(self, hp, defense, power, xp, death_function=None):
self.base_max_hp = hp
self.hp = hp
self.base_defense = defense
self.base_power = power
self.xp = xp
self.death_function = death_function | Naburimannu/libtcodpy-tutorial | [
11,
3,
11,
2,
1454382865
] |
def power(self):
bonus = sum(equipment.power_bonus for equipment
in _get_all_equipped(self.owner))
return self.base_power + bonus | Naburimannu/libtcodpy-tutorial | [
11,
3,
11,
2,
1454382865
] |
def defense(self):
bonus = sum(equipment.defense_bonus for equipment
in _get_all_equipped(self.owner))
return self.base_defense + bonus | Naburimannu/libtcodpy-tutorial | [
11,
3,
11,
2,
1454382865
] |
def max_hp(self):
bonus = sum(equipment.max_hp_bonus for equipment
in _get_all_equipped(self.owner))
return self.base_max_hp + bonus | Naburimannu/libtcodpy-tutorial | [
11,
3,
11,
2,
1454382865
] |
def __init__(self, description=None, count=1, use_function=None):
self.description = description
self.use_function = use_function
self.count = count | Naburimannu/libtcodpy-tutorial | [
11,
3,
11,
2,
1454382865
] |
def __init__(self, slot, power_bonus=0, defense_bonus=0, max_hp_bonus=0):
self.power_bonus = power_bonus
self.defense_bonus = defense_bonus
self.max_hp_bonus = max_hp_bonus
self.slot = slot
self.is_equipped = False | Naburimannu/libtcodpy-tutorial | [
11,
3,
11,
2,
1454382865
] |
def __init__(self, take_turn, metadata=None):
self._turn_function = take_turn
self._metadata = metadata | Naburimannu/libtcodpy-tutorial | [
11,
3,
11,
2,
1454382865
] |
def create_jobs(api_type):
api = api_select.api(__file__, api_type)
api.flow_job()
api.job('passwd_args', exec_time=0.5, max_fails=0, expect_invocations=1, expect_order=1,
params=(('s1', 'no-secret', 'desc'), ('passwd', 'p2', 'desc'), ('PASS', 'p3', 'desc')))
return api | lhupfeldt/jenkinsflow | [
13,
5,
13,
3,
1355357553
] |
def __init__(self, temperature=None, duration=None, start=True):
self.state = self.STATE_SETUP
self.sensor = W1ThermSensor()
self.end_time = None
self._setup_gpio()
self._set_target_temperature(temperature)
self._set_duration(duration)
self.display_initial_info()... | bennuttall/chef-hat | [
2,
1,
2,
1,
1424026705
] |
def _setup_gpio(self):
"""
Setup the GPIO pins used in the Chef HAT (input buttons and status LED)
and create an event on the back button to terminate the process.
"""
GPIO.setup(self.LED, GPIO.OUT)
self.turn_led_off()
for button in self.BUTTONS:
GPI... | bennuttall/chef-hat | [
2,
1,
2,
1,
1424026705
] |
def write(self, text, line=1):
"""
Prints `text`
TODO: writes to the LCD
"""
print(text) | bennuttall/chef-hat | [
2,
1,
2,
1,
1424026705
] |
def turn_led_off(self):
"""
Turns the status LED off
"""
GPIO.output(self.LED, False) | bennuttall/chef-hat | [
2,
1,
2,
1,
1424026705
] |
def turn_cooker_off(self):
"""
Uses energenie to switch the cooker off. Also turns off the status LED.
"""
energenie.switch_off()
self.turn_led_off() | bennuttall/chef-hat | [
2,
1,
2,
1,
1424026705
] |
def remove_button_event(self, button):
"""
Removes a GPIO event for a particular button.
"""
GPIO.remove_event_detect(button) | bennuttall/chef-hat | [
2,
1,
2,
1,
1424026705
] |
def _setup_up_down_buttons(self, increase_function, decrease_function):
"""
Configures the *up* and *down* buttons on the Chef HAT to run
particular increase and decrease functions accordingly. When the
*enter* button is pressed removes the up/down button events and
continues.
... | bennuttall/chef-hat | [
2,
1,
2,
1,
1424026705
] |
def _set_duration(self, duration):
"""
Sets the object's `duration` property. If `duration` is
passed, sets it to the *int* of that value, otherwise sets it to its
configured default value and provides the means to change the value
using the up/down buttons and the LCD.
"... | bennuttall/chef-hat | [
2,
1,
2,
1,
1424026705
] |
def increase_target_temperature(self, pin):
"""
Increases the target temperature by the temperature increment and
displays the new value on the LCD.
"""
self.target_temperature += self.TEMPERATURE_INCREMENT
self.write("Temp:")
self.write("%7dC" % self.target_temp... | bennuttall/chef-hat | [
2,
1,
2,
1,
1424026705
] |
def increase_duration(self, pin):
"""
Increases the duration by the duration increment and displays the new
value on the LCD.
"""
self.duration += self.DURATION_INCREMENT
self.write("Timer:")
self.write("%3d mins" % self.duration, 2) | bennuttall/chef-hat | [
2,
1,
2,
1,
1424026705
] |
def update_status_to_ready(self):
"""
Updates the object state to *ready* and adds a button press event for
the user to proceed to the *food in* state.
"""
self.state = self.STATE_READY
self.add_button_event(self.BUTTON_ENTER, self.update_status_to_food_in)
self.... | bennuttall/chef-hat | [
2,
1,
2,
1,
1424026705
] |
def update_status_to_cooking(self):
"""
Updates the object state to *cooking* and sets the timer according to
the object's `duration` property, relative to the current time.
"""
self.state = self.STATE_COOKING
self.write("Cooking")
current_time = datetime.now()
... | bennuttall/chef-hat | [
2,
1,
2,
1,
1424026705
] |
def update_status_to_finished(self, pin):
"""
Updates the object state to *finished*.
"""
self.state = self.STATE_FINISHED
self.write("Finished") | bennuttall/chef-hat | [
2,
1,
2,
1,
1424026705
] |
def moderate_temperature(self, temperature):
"""
Moderates the temperature of the cooker. Switches it off if the
temperature is too high, and switches it off if it's too low, relative
to the object's `target_temperature` property. Also writes out the on
or off action and the temp... | bennuttall/chef-hat | [
2,
1,
2,
1,
1424026705
] |
def show_remaining_time(self):
"""
Prints the amount of cooking time remaining. If under 1 minute, shown
in seconds, otherwise shown in minutes.
"""
current_time = datetime.now()
time_left = self.end_time - current_time
seconds_left = time_left.seconds
mi... | bennuttall/chef-hat | [
2,
1,
2,
1,
1424026705
] |
def get_default_country(self):
"""Get the default country based on geoip data.
"""
if not geoip or not request.remote_addr:
return None
Country = Pool().get('country.country')
try:
current_app.logger.debug(
"GeoIP lookup for remote address... | fulfilio/nereid-webshop | [
3,
12,
3,
1,
1439289405
] |
def RunGit(self, _git_repo, cmd, _retry=True, **kwargs):
return self._results['RunGit'].LookupResult(
(cmd,), hook_args=(cmd,), hook_kwargs=kwargs) | endlessm/chromium-browser | [
21,
16,
21,
3,
1435959644
] |
def setUp(self):
self._branch = 'test_branch'
self._target_manifest_branch = 'cros/master' | endlessm/chromium-browser | [
21,
16,
21,
3,
1435959644
] |
def testPushChange(self):
"""Verify pushing changes works."""
self._TestPushChange(bad_cls=False) | endlessm/chromium-browser | [
21,
16,
21,
3,
1435959644
] |
def __init__(self, path, new_package=True):
self.path = path
self.package = '%s_package' % path
self.cros_workon_vars = 'cros_workon_vars'
self._new_package = new_package | endlessm/chromium-browser | [
21,
16,
21,
3,
1435959644
] |
def RevWorkOnEBuild(self, srcroot, manifest):
if self._new_package:
return ('%s_new_package' % self.path,
'%s_new_ebuild' % self.path,
'%s_old_ebuild' % self.path) | endlessm/chromium-browser | [
21,
16,
21,
3,
1435959644
] |
def setUp(self):
self._manifest = 'manifest'
self._parser = cros_mark_as_stable.GetParser()
self._package_list = ['pkg1']
self._overlays = [os.path.join(self.tempdir, 'overlay_%s' % i)
for i in range(0, 3)]
self._overlay_remote_ref = {
self._overlays[0]: git.RemoteRef... | endlessm/chromium-browser | [
21,
16,
21,
3,
1435959644
] |
def testPushOverlays(self):
"""Test _PushOverlays."""
self.PatchObject(os.path, 'isdir', return_value=True)
mock_push_change = self.PatchObject(cros_mark_as_stable, 'PushChange')
cros_mark_as_stable._PushOverlays(
self._push_options, self._overlays, self._overlay_tracking_branch)
self.asser... | endlessm/chromium-browser | [
21,
16,
21,
3,
1435959644
] |
def testGetOverlayToEbuildsMap(self):
"""Test _GetOverlayToEbuildsMap."""
self.PatchObject(portage_util, 'GetOverlayEBuilds', return_value=['ebuild'])
expected_overlay_dicts = {
overlay : ['ebuild'] for overlay in self._overlays}
overlay_ebuilds = cros_mark_as_stable._GetOverlayToEbuildsMap(
... | endlessm/chromium-browser | [
21,
16,
21,
3,
1435959644
] |
def testWorkOnEbuildWithNewPackage(self):
"""Test _WorkOnEbuild with new packages."""
overlay = self._overlays[0]
ebuild = EbuildMock('ebuild')
with parallel.Manager() as manager:
revved_packages = manager.list()
new_package_atoms = manager.list()
messages = manager.list()
ebui... | endlessm/chromium-browser | [
21,
16,
21,
3,
1435959644
] |
def setUp(self):
self.PatchObject(git.ManifestCheckout, 'Cached', return_value='manifest')
self.mock_work_on_push = self.PatchObject(
cros_mark_as_stable, '_WorkOnPush')
self.mock_work_on_commit = self.PatchObject(
cros_mark_as_stable, '_WorkOnCommit')
self._overlays = []
remote_ref... | endlessm/chromium-browser | [
21,
16,
21,
3,
1435959644
] |
def testMainWithPush(self):
"""Test Main with Push options."""
cros_mark_as_stable.main(
['push', '--all', '--overlays', ':'.join(self._overlays)])
self.mock_work_on_push.assert_called_once_with(
mock.ANY, self._overlay_tracking_branch, self._git_project_overlays)
options = self.mock_wor... | endlessm/chromium-browser | [
21,
16,
21,
3,
1435959644
] |
def testMainWithBuildroot(self):
"""Test Main with Commit options."""
self.PatchObject(os.path, 'isdir', side_effect=lambda p: p == '/buildroot')
cros_mark_as_stable.main(
['commit', '--all', '--overlay-type', 'both',
'--buildroot', '/buildroot'])
options = self.mock_work_on_commit.ca... | endlessm/chromium-browser | [
21,
16,
21,
3,
1435959644
] |
def setUp(self):
self.PatchObject(osutils, 'FindMissingBinaries', return_value=[]) | endlessm/chromium-browser | [
21,
16,
21,
3,
1435959644
] |
def testNothingToUnmerge(self):
"""Clean up packages that don't exist (portage will exit 1)"""
self.rc.AddCmdResult(partial_mock.In('emerge'), returncode=1)
cros_mark_as_stable.CleanStalePackages('.', (), ['no/pkg']) | endlessm/chromium-browser | [
21,
16,
21,
3,
1435959644
] |
def setUp(self):
# Always stub RunCommmand out as we use it in every method.
self.git_mock = self.PatchObject(git, 'RunGit')
self.start_mock = self.PatchObject(repo_util.Repository, 'StartBranch')
self._branch_name = 'test_branch'
self._target_manifest_branch = 'cros/test'
self._branch = cros_m... | endlessm/chromium-browser | [
21,
16,
21,
3,
1435959644
] |
def testCheckoutNoCreate(self):
"""Test init with previous branch existing."""
self.PatchObject(self._branch, 'Exists', return_value=True)
cros_mark_as_stable.GitBranch.Checkout(self._branch)
self.git_mock.assert_called_with('.', ['checkout', '-f', self._branch_name],
... | endlessm/chromium-browser | [
21,
16,
21,
3,
1435959644
] |
def list_models(kind=None):
# type: (str) -> List[str]
"""
Return the list of available models on the model path.
*kind* can be one of the following:
* all: all models
* py: python models only
* c: c models only
* single: c models which support single precision
... | SasView/sasmodels | [
13,
25,
13,
185,
1423839860
] |
def load_model(model_name, dtype=None, platform='ocl'):
# type: (str, str, str) -> KernelModel
"""
Load model info and build model.
*model_name* is the name of the model, or perhaps a model expression
such as sphere*hardsphere or sphere+cylinder.
*dtype* and *platform* are given by :func:`buil... | SasView/sasmodels | [
13,
25,
13,
185,
1423839860
] |
def reparameterize(
base, parameters, translation, filename=None,
title=None, insert_after=None, docs=None, name=None,
source=None,
):
"""
Reparameterize an existing model.
*base* is the original modelinfo. This cannot be a reparameterized model;
only one level of reparamete... | SasView/sasmodels | [
13,
25,
13,
185,
1423839860
] |
def merge_deps(old, new):
"""
Merge two dependency lists. The lists are partially ordered, with
all dependents coming after the items they depend on, but otherwise
order doesn't matter. The merged list preserves the partial ordering.
So if old and new both include the item "c", then all items that... | SasView/sasmodels | [
13,
25,
13,
185,
1423839860
] |
def precompile_dlls(path, dtype="double"):
# type: (str, str) -> List[str]
"""
Precompile the dlls for all builtin models, returning a list of dll paths.
*path* is the directory in which to save the dlls. It will be created if
it does not already exist.
This can be used when build the windows... | SasView/sasmodels | [
13,
25,
13,
185,
1423839860
] |
def test_composite_order():
"""
Check that mixture models produce the same result independent of ordder.
"""
def test_models(fst, snd):
"""Confirm that two models produce the same parameters"""
fst = load_model(fst)
snd = load_model(snd)
# Un-disambiguate parameter names ... | SasView/sasmodels | [
13,
25,
13,
185,
1423839860
] |
def list_models_main():
# type: () -> int
"""
Run list_models as a main program. See :func:`list_models` for the
kinds of models that can be requested on the command line.
"""
import sys
kind = sys.argv[1] if len(sys.argv) > 1 else "all"
try:
models = list_models(kind)
p... | SasView/sasmodels | [
13,
25,
13,
185,
1423839860
] |
def setUp(self):
self.username = 'theskumar'
self.email = 'theskumar@example.com' | theskumar/django-unsubscribe | [
24,
11,
24,
4,
1392272801
] |
def setUp(self):
pass | UCSBarchlab/PyRTL | [
184,
70,
184,
23,
1393210686
] |
def test_output_list_type(self):
outputs = pyrtl.helperfuncs.output_list('one, two, three')
self.assertTrue(all(isinstance(outp, pyrtl.Output) for outp in outputs)) | UCSBarchlab/PyRTL | [
184,
70,
184,
23,
1393210686
] |
def test_wirevector_list_type(self):
# Single string of names
wirevectors = pyrtl.helperfuncs.wirevector_list('one, two, three')
self.assertTrue(all(isinstance(wire, pyrtl.WireVector) for wire in wirevectors))
self.assertListEqual([wire.bitwidth for wire in wirevectors], [1, 1, 1])
... | UCSBarchlab/PyRTL | [
184,
70,
184,
23,
1393210686
] |
def test_wirevector_list_per_wire_width(self):
wirevectors = pyrtl.helperfuncs.wirevector_list('one/2, two/4, three/8')
self.assertListEqual([wire.bitwidth for wire in wirevectors], [2, 4, 8])
wirevectors = pyrtl.helperfuncs.wirevector_list(['one', 'two', 'three'], [2, 4, 8])
self.asser... | UCSBarchlab/PyRTL | [
184,
70,
184,
23,
1393210686
] |
def setUp(self):
pass | UCSBarchlab/PyRTL | [
184,
70,
184,
23,
1393210686
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.