body stringlengths 26 98.2k | body_hash int64 -9,222,864,604,528,158,000 9,221,803,474B | docstring stringlengths 1 16.8k | path stringlengths 5 230 | name stringlengths 1 96 | repository_name stringlengths 7 89 | lang stringclasses 1
value | body_without_docstring stringlengths 20 98.2k |
|---|---|---|---|---|---|---|---|
def preferred_variants(self, pkg_name):
'Facts on concretization preferences, as read from packages.yaml'
preferences = spack.package_prefs.PackagePrefs
preferred_variants = preferences.preferred_variants(pkg_name)
if (not preferred_variants):
return
for variant_name in sorted(preferred_vari... | 7,701,278,619,298,708,000 | Facts on concretization preferences, as read from packages.yaml | lib/spack/spack/solver/asp.py | preferred_variants | AaltoSciComp/spack | python | def preferred_variants(self, pkg_name):
preferences = spack.package_prefs.PackagePrefs
preferred_variants = preferences.preferred_variants(pkg_name)
if (not preferred_variants):
return
for variant_name in sorted(preferred_variants):
variant = preferred_variants[variant_name]
... |
def checked_spec_clauses(self, *args, **kwargs):
'Wrap a call to spec clauses into a try/except block that raise\n a comprehensible error message in case of failure.\n '
requestor = kwargs.pop('required_from', None)
try:
clauses = self.spec_clauses(*args, **kwargs)
except RuntimeEr... | 5,603,958,043,790,484,000 | Wrap a call to spec clauses into a try/except block that raise
a comprehensible error message in case of failure. | lib/spack/spack/solver/asp.py | checked_spec_clauses | AaltoSciComp/spack | python | def checked_spec_clauses(self, *args, **kwargs):
'Wrap a call to spec clauses into a try/except block that raise\n a comprehensible error message in case of failure.\n '
requestor = kwargs.pop('required_from', None)
try:
clauses = self.spec_clauses(*args, **kwargs)
except RuntimeEr... |
def spec_clauses(self, spec, body=False, transitive=True):
"Return a list of clauses for a spec mandates are true.\n\n Arguments:\n spec (spack.spec.Spec): the spec to analyze\n body (bool): if True, generate clauses to be used in rule bodies\n (final values) instead of r... | 5,841,212,043,630,514,000 | Return a list of clauses for a spec mandates are true.
Arguments:
spec (spack.spec.Spec): the spec to analyze
body (bool): if True, generate clauses to be used in rule bodies
(final values) instead of rule heads (setters).
transitive (bool): if False, don't generate clauses from
dependenci... | lib/spack/spack/solver/asp.py | spec_clauses | AaltoSciComp/spack | python | def spec_clauses(self, spec, body=False, transitive=True):
"Return a list of clauses for a spec mandates are true.\n\n Arguments:\n spec (spack.spec.Spec): the spec to analyze\n body (bool): if True, generate clauses to be used in rule bodies\n (final values) instead of r... |
def build_version_dict(self, possible_pkgs, specs):
'Declare any versions in specs not declared in packages.'
self.declared_versions = collections.defaultdict(list)
self.possible_versions = collections.defaultdict(set)
self.deprecated_versions = collections.defaultdict(set)
packages_yaml = spack.con... | -8,180,885,107,792,739,000 | Declare any versions in specs not declared in packages. | lib/spack/spack/solver/asp.py | build_version_dict | AaltoSciComp/spack | python | def build_version_dict(self, possible_pkgs, specs):
self.declared_versions = collections.defaultdict(list)
self.possible_versions = collections.defaultdict(set)
self.deprecated_versions = collections.defaultdict(set)
packages_yaml = spack.config.get('packages')
packages_yaml = _normalize_packag... |
def _supported_targets(self, compiler_name, compiler_version, targets):
'Get a list of which targets are supported by the compiler.\n\n Results are ordered most to least recent.\n '
supported = []
for target in targets:
try:
with warnings.catch_warnings():
w... | -1,959,975,852,145,534,000 | Get a list of which targets are supported by the compiler.
Results are ordered most to least recent. | lib/spack/spack/solver/asp.py | _supported_targets | AaltoSciComp/spack | python | def _supported_targets(self, compiler_name, compiler_version, targets):
'Get a list of which targets are supported by the compiler.\n\n Results are ordered most to least recent.\n '
supported = []
for target in targets:
try:
with warnings.catch_warnings():
w... |
def target_defaults(self, specs):
'Add facts about targets and target compatibility.'
self.gen.h2('Default target')
platform = spack.architecture.platform()
uarch = archspec.cpu.TARGETS.get(platform.default)
self.gen.h2('Target compatibility')
compatible_targets = ([uarch] + uarch.ancestors)
... | 5,557,989,692,404,767,000 | Add facts about targets and target compatibility. | lib/spack/spack/solver/asp.py | target_defaults | AaltoSciComp/spack | python | def target_defaults(self, specs):
self.gen.h2('Default target')
platform = spack.architecture.platform()
uarch = archspec.cpu.TARGETS.get(platform.default)
self.gen.h2('Target compatibility')
compatible_targets = ([uarch] + uarch.ancestors)
additional_targets_in_family = sorted([t for t in ... |
def define_version_constraints(self):
'Define what version_satisfies(...) means in ASP logic.'
for (pkg_name, versions) in sorted(self.version_constraints):
allowed_versions = [v for v in sorted(self.possible_versions[pkg_name]) if v.satisfies(versions)]
exact_match = [v for v in allowed_version... | 4,387,517,118,108,470,300 | Define what version_satisfies(...) means in ASP logic. | lib/spack/spack/solver/asp.py | define_version_constraints | AaltoSciComp/spack | python | def define_version_constraints(self):
for (pkg_name, versions) in sorted(self.version_constraints):
allowed_versions = [v for v in sorted(self.possible_versions[pkg_name]) if v.satisfies(versions)]
exact_match = [v for v in allowed_versions if (v == versions)]
if exact_match:
... |
def define_virtual_constraints(self):
'Define versions for constraints on virtuals.\n\n Must be called before define_version_constraints().\n '
constraint_map = collections.defaultdict((lambda : set()))
for (pkg_name, versions) in self.version_constraints:
if (not spack.repo.path.is_vi... | -3,161,284,530,170,989,600 | Define versions for constraints on virtuals.
Must be called before define_version_constraints(). | lib/spack/spack/solver/asp.py | define_virtual_constraints | AaltoSciComp/spack | python | def define_virtual_constraints(self):
'Define versions for constraints on virtuals.\n\n Must be called before define_version_constraints().\n '
constraint_map = collections.defaultdict((lambda : set()))
for (pkg_name, versions) in self.version_constraints:
if (not spack.repo.path.is_vi... |
def define_variant_values(self):
'Validate variant values from the command line.\n\n Also add valid variant values from the command line to the\n possible values for a variant.\n\n '
for (pkg, variant, value) in sorted(self.variant_values_from_specs):
self.gen.fact(fn.variant_possib... | 5,043,408,363,552,209,000 | Validate variant values from the command line.
Also add valid variant values from the command line to the
possible values for a variant. | lib/spack/spack/solver/asp.py | define_variant_values | AaltoSciComp/spack | python | def define_variant_values(self):
'Validate variant values from the command line.\n\n Also add valid variant values from the command line to the\n possible values for a variant.\n\n '
for (pkg, variant, value) in sorted(self.variant_values_from_specs):
self.gen.fact(fn.variant_possib... |
def setup(self, driver, specs, tests=False):
'Generate an ASP program with relevant constraints for specs.\n\n This calls methods on the solve driver to set up the problem with\n facts and rules from all possible dependencies of the input\n specs, as well as constraints from the specs themselve... | -8,143,368,605,306,560,000 | Generate an ASP program with relevant constraints for specs.
This calls methods on the solve driver to set up the problem with
facts and rules from all possible dependencies of the input
specs, as well as constraints from the specs themselves.
Arguments:
specs (list): list of Specs to solve | lib/spack/spack/solver/asp.py | setup | AaltoSciComp/spack | python | def setup(self, driver, specs, tests=False):
'Generate an ASP program with relevant constraints for specs.\n\n This calls methods on the solve driver to set up the problem with\n facts and rules from all possible dependencies of the input\n specs, as well as constraints from the specs themselve... |
def external_spec_selected(self, pkg, idx):
'This means that the external spec and index idx\n has been selected for this package.\n '
packages_yaml = spack.config.get('packages')
packages_yaml = _normalize_packages_yaml(packages_yaml)
spec_info = packages_yaml[pkg]['externals'][int(idx)]
... | -2,211,581,437,128,111,000 | This means that the external spec and index idx
has been selected for this package. | lib/spack/spack/solver/asp.py | external_spec_selected | AaltoSciComp/spack | python | def external_spec_selected(self, pkg, idx):
'This means that the external spec and index idx\n has been selected for this package.\n '
packages_yaml = spack.config.get('packages')
packages_yaml = _normalize_packages_yaml(packages_yaml)
spec_info = packages_yaml[pkg]['externals'][int(idx)]
... |
def reorder_flags(self):
"Order compiler flags on specs in predefined order.\n\n We order flags so that any node's flags will take priority over\n those of its dependents. That is, the deepest node in the DAG's\n flags will appear last on the compile line, in the order they\n were speci... | -8,122,179,783,565,153,000 | Order compiler flags on specs in predefined order.
We order flags so that any node's flags will take priority over
those of its dependents. That is, the deepest node in the DAG's
flags will appear last on the compile line, in the order they
were specified.
The solver determines wihch flags are on nodes; this routine... | lib/spack/spack/solver/asp.py | reorder_flags | AaltoSciComp/spack | python | def reorder_flags(self):
"Order compiler flags on specs in predefined order.\n\n We order flags so that any node's flags will take priority over\n those of its dependents. That is, the deepest node in the DAG's\n flags will appear last on the compile line, in the order they\n were speci... |
def test_homepage(self):
'Make sure that homepage works fine'
response = self.client.get(url_for('home_view'))
assert (b'Add a feature request:' in response.data)
assert (b'List feature requests:' in response.data) | -1,474,053,232,443,634,700 | Make sure that homepage works fine | test_core.py | test_homepage | spapas/feature-requests | python | def test_homepage(self):
response = self.client.get(url_for('home_view'))
assert (b'Add a feature request:' in response.data)
assert (b'List feature requests:' in response.data) |
def test_empty_listpage(self):
'Make sure that empty list page works fine'
response = self.client.get(url_for('home_view'))
response = self.client.get(url_for('feature_requests_view'))
assert (b'No feature requests found.' in response.data) | 9,047,264,463,829,702,000 | Make sure that empty list page works fine | test_core.py | test_empty_listpage | spapas/feature-requests | python | def test_empty_listpage(self):
response = self.client.get(url_for('home_view'))
response = self.client.get(url_for('feature_requests_view'))
assert (b'No feature requests found.' in response.data) |
def test_non_empty_listpage(self):
'Also that it can display multiple entries'
fr = FeatureRequest(title='Title', description='Desc', client=None, client_priority=1, target_date=datetime.date(2018, 1, 1), product_area=None)
db.session.add(fr)
fr2 = FeatureRequest(title='Title', description='Desc', clien... | 2,469,986,225,949,389,300 | Also that it can display multiple entries | test_core.py | test_non_empty_listpage | spapas/feature-requests | python | def test_non_empty_listpage(self):
fr = FeatureRequest(title='Title', description='Desc', client=None, client_priority=1, target_date=datetime.date(2018, 1, 1), product_area=None)
db.session.add(fr)
fr2 = FeatureRequest(title='Title', description='Desc', client=None, client_priority=1, target_date=date... |
def test_createpage(self):
'Make sure that the create page works'
response = self.client.get(url_for('feature_requests_create'))
assert (b'Add Feature Request' in response.data)
assert (b"<form method='POST'>" in response.data)
assert (b'form-group has-error' not in response.data) | -5,400,908,960,627,150,000 | Make sure that the create page works | test_core.py | test_createpage | spapas/feature-requests | python | def test_createpage(self):
response = self.client.get(url_for('feature_requests_create'))
assert (b'Add Feature Request' in response.data)
assert (b"<form method='POST'>" in response.data)
assert (b'form-group has-error' not in response.data) |
def test_createpage_error(self):
'The create page should return with error when post data is missing'
response = self.client.post(url_for('feature_requests_create'), data=dict(title='Title', description='Desc', client=None, client_priority=1, target_date=datetime.date(2018, 1, 1), product_area=None))
assert... | -6,914,650,206,671,616,000 | The create page should return with error when post data is missing | test_core.py | test_createpage_error | spapas/feature-requests | python | def test_createpage_error(self):
response = self.client.post(url_for('feature_requests_create'), data=dict(title='Title', description='Desc', client=None, client_priority=1, target_date=datetime.date(2018, 1, 1), product_area=None))
assert (b'form-group has-error' in response.data)
assert (b"<form meth... |
def test_createpage_success(self):
'The create page should return a 302 FOUND redirect when an entry is submitted'
client = Client('C1')
db.session.add(client)
product_area = ProductArea('PA1')
db.session.add(product_area)
db.session.commit()
response = self.client.post(url_for('feature_requ... | -6,706,679,454,331,955,000 | The create page should return a 302 FOUND redirect when an entry is submitted | test_core.py | test_createpage_success | spapas/feature-requests | python | def test_createpage_success(self):
client = Client('C1')
db.session.add(client)
product_area = ProductArea('PA1')
db.session.add(product_area)
db.session.commit()
response = self.client.post(url_for('feature_requests_create'), data=dict(title='Title', description='Desc', client=client.id, c... |
def test_createpage_success_flash(self):
'The create page should display the proper flash message when an object is\n created'
self.add_other_objects()
response = self.client.post(url_for('feature_requests_create'), data=dict(title='Title', description='Desc', client=self.cl.id, client_priority=1, ta... | -5,260,746,790,233,260,000 | The create page should display the proper flash message when an object is
created | test_core.py | test_createpage_success_flash | spapas/feature-requests | python | def test_createpage_success_flash(self):
'The create page should display the proper flash message when an object is\n created'
self.add_other_objects()
response = self.client.post(url_for('feature_requests_create'), data=dict(title='Title', description='Desc', client=self.cl.id, client_priority=1, ta... |
def test_createpage_change_priorities(self):
'The create page should change the priorities of the other objects when a\n new one has the same priority and client'
self.add_other_objects()
fr = FeatureRequest(title='Title', description='Desc', client=self.cl, client_priority=1, target_date=datetime.da... | -4,539,755,280,102,366,000 | The create page should change the priorities of the other objects when a
new one has the same priority and client | test_core.py | test_createpage_change_priorities | spapas/feature-requests | python | def test_createpage_change_priorities(self):
'The create page should change the priorities of the other objects when a\n new one has the same priority and client'
self.add_other_objects()
fr = FeatureRequest(title='Title', description='Desc', client=self.cl, client_priority=1, target_date=datetime.da... |
def add_feature_request(self):
'A reusable method for this class'
self.fr = FeatureRequest(title='Title', description='Desc', client=None, client_priority=1, target_date=datetime.date(2018, 1, 1), product_area=None)
db.session.add(self.fr)
db.session.commit() | 5,368,258,466,379,493,000 | A reusable method for this class | test_core.py | add_feature_request | spapas/feature-requests | python | def add_feature_request(self):
self.fr = FeatureRequest(title='Title', description='Desc', client=None, client_priority=1, target_date=datetime.date(2018, 1, 1), product_area=None)
db.session.add(self.fr)
db.session.commit() |
def test_updatepage_not_found(self):
'Make sure that the update page returs 404 when the obj is not found'
response = self.client.get(url_for('feature_requests_update', feature_request_id=1232))
assert (response.status == '404 NOT FOUND') | 3,947,901,401,632,254,500 | Make sure that the update page returs 404 when the obj is not found | test_core.py | test_updatepage_not_found | spapas/feature-requests | python | def test_updatepage_not_found(self):
response = self.client.get(url_for('feature_requests_update', feature_request_id=1232))
assert (response.status == '404 NOT FOUND') |
def test_updatepage_ok(self):
'Make sure that the update page is displayed properly along with the object'
self.add_feature_request()
response = self.client.get(url_for('feature_requests_update', feature_request_id=self.fr.id))
assert ('Edit Feature Request: {0}'.format(self.fr.id).encode() in response.... | 7,812,104,558,715,032,000 | Make sure that the update page is displayed properly along with the object | test_core.py | test_updatepage_ok | spapas/feature-requests | python | def test_updatepage_ok(self):
self.add_feature_request()
response = self.client.get(url_for('feature_requests_update', feature_request_id=self.fr.id))
assert ('Edit Feature Request: {0}'.format(self.fr.id).encode() in response.data)
assert (b"<form method='POST'>" in response.data)
assert (b'fo... |
def test_updatepage_error(self):
'The createpage should return an error when data is missing'
self.add_feature_request()
response = self.client.post(url_for('feature_requests_update', feature_request_id=self.fr.id), data=dict(title='Title', description='Desc', client=None, client_priority=1, target_date=dat... | 5,283,285,016,547,896,000 | The createpage should return an error when data is missing | test_core.py | test_updatepage_error | spapas/feature-requests | python | def test_updatepage_error(self):
self.add_feature_request()
response = self.client.post(url_for('feature_requests_update', feature_request_id=self.fr.id), data=dict(title='Title', description='Desc', client=None, client_priority=1, target_date=datetime.date(2018, 1, 1), product_area=None))
assert (b'fo... |
def test_createpage_success(self):
'The createpage should properly update the object'
self.add_feature_request()
self.add_other_objects()
newtitle = 'The new title'
response = self.client.post(url_for('feature_requests_update', feature_request_id=self.fr.id), data=dict(title=newtitle, description='D... | -5,652,872,008,606,689,000 | The createpage should properly update the object | test_core.py | test_createpage_success | spapas/feature-requests | python | def test_createpage_success(self):
self.add_feature_request()
self.add_other_objects()
newtitle = 'The new title'
response = self.client.post(url_for('feature_requests_update', feature_request_id=self.fr.id), data=dict(title=newtitle, description='Desc', client=self.cl.id, client_priority=1, target... |
def test_updatepage_success_flash(self):
'Make sure that the flash message is displayed correctly and we are\n redirected to the list view'
self.add_feature_request()
self.add_other_objects()
response = self.client.post(url_for('feature_requests_update', feature_request_id=self.fr.id), data=dict(... | 6,706,171,406,238,756,000 | Make sure that the flash message is displayed correctly and we are
redirected to the list view | test_core.py | test_updatepage_success_flash | spapas/feature-requests | python | def test_updatepage_success_flash(self):
'Make sure that the flash message is displayed correctly and we are\n redirected to the list view'
self.add_feature_request()
self.add_other_objects()
response = self.client.post(url_for('feature_requests_update', feature_request_id=self.fr.id), data=dict(... |
def test_updatepage_change_priorities(self):
'The updatepage should also update the client priorities'
self.add_other_objects()
fr = FeatureRequest(title='Title', description='Desc', client=self.cl, client_priority=1, target_date=datetime.date(2018, 1, 1), product_area=self.pa)
db.session.add(fr)
fr... | 5,855,504,665,284,687,000 | The updatepage should also update the client priorities | test_core.py | test_updatepage_change_priorities | spapas/feature-requests | python | def test_updatepage_change_priorities(self):
self.add_other_objects()
fr = FeatureRequest(title='Title', description='Desc', client=self.cl, client_priority=1, target_date=datetime.date(2018, 1, 1), product_area=self.pa)
db.session.add(fr)
fr2 = FeatureRequest(title='Title', description='Desc', cli... |
def add_feature_request(self):
'A reusable method for this class'
self.fr = FeatureRequest(title='Title', description='Desc', client=None, client_priority=1, target_date=datetime.date(2018, 1, 1), product_area=None)
db.session.add(self.fr)
db.session.commit() | 5,368,258,466,379,493,000 | A reusable method for this class | test_core.py | add_feature_request | spapas/feature-requests | python | def add_feature_request(self):
self.fr = FeatureRequest(title='Title', description='Desc', client=None, client_priority=1, target_date=datetime.date(2018, 1, 1), product_area=None)
db.session.add(self.fr)
db.session.commit() |
def test_deletepdatepage_only_post(self):
'Make sure that the delete page returns 405 when requested with get'
response = self.client.get(url_for('feature_requests_delete', feature_request_id=1232))
assert (response.status == '405 METHOD NOT ALLOWED') | 3,604,485,937,408,843,300 | Make sure that the delete page returns 405 when requested with get | test_core.py | test_deletepdatepage_only_post | spapas/feature-requests | python | def test_deletepdatepage_only_post(self):
response = self.client.get(url_for('feature_requests_delete', feature_request_id=1232))
assert (response.status == '405 METHOD NOT ALLOWED') |
def test_deletepdatepage_not_found(self):
'Make sure that the delete page returs 404 when the obj is not found'
response = self.client.post(url_for('feature_requests_delete', feature_request_id=1232))
assert (response.status == '404 NOT FOUND') | 6,247,266,416,346,871,000 | Make sure that the delete page returs 404 when the obj is not found | test_core.py | test_deletepdatepage_not_found | spapas/feature-requests | python | def test_deletepdatepage_not_found(self):
response = self.client.post(url_for('feature_requests_delete', feature_request_id=1232))
assert (response.status == '404 NOT FOUND') |
def test_deletepage_ok(self):
'Make sure that the delete page deletes the obj'
self.add_feature_request()
assert (db.session.query(FeatureRequest.query.filter().exists()).scalar() is True)
response = self.client.post(url_for('feature_requests_delete', feature_request_id=self.fr.id))
assert (db.sessi... | -1,981,492,078,870,599,200 | Make sure that the delete page deletes the obj | test_core.py | test_deletepage_ok | spapas/feature-requests | python | def test_deletepage_ok(self):
self.add_feature_request()
assert (db.session.query(FeatureRequest.query.filter().exists()).scalar() is True)
response = self.client.post(url_for('feature_requests_delete', feature_request_id=self.fr.id))
assert (db.session.query(FeatureRequest.query.filter().exists())... |
def test_deletepage_flash_message(self):
'Make sure that the delete page shows the proper flash message'
self.add_feature_request()
response = self.client.post(url_for('feature_requests_delete', feature_request_id=self.fr.id), follow_redirects=True)
assert (response.status == '200 OK')
assert (b'Fea... | 2,915,011,334,631,146,000 | Make sure that the delete page shows the proper flash message | test_core.py | test_deletepage_flash_message | spapas/feature-requests | python | def test_deletepage_flash_message(self):
self.add_feature_request()
response = self.client.post(url_for('feature_requests_delete', feature_request_id=self.fr.id), follow_redirects=True)
assert (response.status == '200 OK')
assert (b'Feature request deleted!' in response.data)
assert (response.d... |
def __init__(self, parent, settings):
'\n Constructs a WarningPopUp\n :param parent: Parent Frame\n :param settings: settings class \n '
self.settings = settings
ttk.Frame.__init__(self, parent, relief='raised', borderwidth=2)
self.content = ttk.Frame(self, borderwidth=2)
... | -4,057,271,277,834,414,600 | Constructs a WarningPopUp
:param parent: Parent Frame
:param settings: settings class | dashboard/entities/Devices.py | __init__ | Hexagoons/GUI-Arduino-Weather-Station | python | def __init__(self, parent, settings):
'\n Constructs a WarningPopUp\n :param parent: Parent Frame\n :param settings: settings class \n '
self.settings = settings
ttk.Frame.__init__(self, parent, relief='raised', borderwidth=2)
self.content = ttk.Frame(self, borderwidth=2)
... |
def decode_one_batch(params: AttributeDict, model: nn.Module, HLG: Optional[k2.Fsa], H: Optional[k2.Fsa], bpe_model: Optional[spm.SentencePieceProcessor], batch: dict, word_table: k2.SymbolTable, sos_id: int, eos_id: int, G: Optional[k2.Fsa]=None) -> Dict[(str, List[List[str]])]:
'Decode one batch and return the re... | -3,078,755,603,851,290,600 | Decode one batch and return the result in a dict. The dict has the
following format:
- key: It indicates the setting used for decoding. For example,
if no rescoring is used, the key is the string `no_rescore`.
If LM rescoring is used, the key is the string `lm_scale_xxx`,
where `xx... | egs/librispeech/ASR/conformer_mmi/decode.py | decode_one_batch | aarora8/icefall | python | def decode_one_batch(params: AttributeDict, model: nn.Module, HLG: Optional[k2.Fsa], H: Optional[k2.Fsa], bpe_model: Optional[spm.SentencePieceProcessor], batch: dict, word_table: k2.SymbolTable, sos_id: int, eos_id: int, G: Optional[k2.Fsa]=None) -> Dict[(str, List[List[str]])]:
'Decode one batch and return the re... |
def decode_dataset(dl: torch.utils.data.DataLoader, params: AttributeDict, model: nn.Module, HLG: Optional[k2.Fsa], H: Optional[k2.Fsa], bpe_model: Optional[spm.SentencePieceProcessor], word_table: k2.SymbolTable, sos_id: int, eos_id: int, G: Optional[k2.Fsa]=None) -> Dict[(str, List[Tuple[(List[str], List[str])]])]:
... | -7,345,658,783,875,339,000 | Decode dataset.
Args:
dl:
PyTorch's dataloader containing the dataset to decode.
params:
It is returned by :func:`get_params`.
model:
The neural model.
HLG:
The decoding graph. Used only when params.method is NOT ctc-decoding.
H:
The ctc topo. Used only when params.method is ctc-decoding.... | egs/librispeech/ASR/conformer_mmi/decode.py | decode_dataset | aarora8/icefall | python | def decode_dataset(dl: torch.utils.data.DataLoader, params: AttributeDict, model: nn.Module, HLG: Optional[k2.Fsa], H: Optional[k2.Fsa], bpe_model: Optional[spm.SentencePieceProcessor], word_table: k2.SymbolTable, sos_id: int, eos_id: int, G: Optional[k2.Fsa]=None) -> Dict[(str, List[Tuple[(List[str], List[str])]])]:
... |
@staticmethod
def createSetsFromStrings(structureString='', valueString=None):
'\n Construct a list of GeneSet objects based on the given strings.\n The first string, structureString, determines the number of GeneSets to create.\n An empty string will return an empty list.\n A stri... | -8,194,630,866,699,173,000 | Construct a list of GeneSet objects based on the given strings.
The first string, structureString, determines the number of GeneSets to create.
An empty string will return an empty list.
A string containing anything else will return one or more subsets.
The number of subsets is determined by the number of times... | code/core/Genes.py | createSetsFromStrings | somtirtharoy/jqmm | python | @staticmethod
def createSetsFromStrings(structureString=, valueString=None):
'\n Construct a list of GeneSet objects based on the given strings.\n The first string, structureString, determines the number of GeneSets to create.\n An empty string will return an empty list.\n A string... |
def _get_wrapped_function_from_comp(comp, must_pin_function_to_cpu, param_type, device):
'Extracts the TensorFlow function from serialized computation.\n\n Args:\n comp: An instance of `pb.Computation`.\n must_pin_function_to_cpu: A boolean flag to indicate if the computation is\n forced to be on CPUs.\... | 8,839,281,469,228,193,000 | Extracts the TensorFlow function from serialized computation.
Args:
comp: An instance of `pb.Computation`.
must_pin_function_to_cpu: A boolean flag to indicate if the computation is
forced to be on CPUs.
param_type: A `tff.Type` instance or None.
device: A `tf.config.LogicalDevice` or None.
Returns:
A T... | tensorflow_federated/python/core/impl/executors/eager_tf_executor.py | _get_wrapped_function_from_comp | ddayzzz/federated | python | def _get_wrapped_function_from_comp(comp, must_pin_function_to_cpu, param_type, device):
'Extracts the TensorFlow function from serialized computation.\n\n Args:\n comp: An instance of `pb.Computation`.\n must_pin_function_to_cpu: A boolean flag to indicate if the computation is\n forced to be on CPUs.\... |
def embed_tensorflow_computation(comp, type_spec=None, device=None):
'Embeds a TensorFlow computation for use in the eager context.\n\n Args:\n comp: An instance of `pb.Computation`.\n type_spec: An optional `tff.Type` instance or something convertible to it.\n device: An optional `tf.config.LogicalDevice... | 5,325,071,796,585,580,000 | Embeds a TensorFlow computation for use in the eager context.
Args:
comp: An instance of `pb.Computation`.
type_spec: An optional `tff.Type` instance or something convertible to it.
device: An optional `tf.config.LogicalDevice`.
Returns:
Either a one-argument or a zero-argument callable that executes the
co... | tensorflow_federated/python/core/impl/executors/eager_tf_executor.py | embed_tensorflow_computation | ddayzzz/federated | python | def embed_tensorflow_computation(comp, type_spec=None, device=None):
'Embeds a TensorFlow computation for use in the eager context.\n\n Args:\n comp: An instance of `pb.Computation`.\n type_spec: An optional `tff.Type` instance or something convertible to it.\n device: An optional `tf.config.LogicalDevice... |
def to_representation_for_type(value: Any, tf_function_cache: MutableMapping[(str, Any)], type_spec: Optional[computation_types.Type]=None, device: Optional[tf.config.LogicalDevice]=None) -> Any:
'Verifies or converts the `value` to an eager object matching `type_spec`.\n\n WARNING: This function is only partially... | -5,421,512,149,350,450,000 | Verifies or converts the `value` to an eager object matching `type_spec`.
WARNING: This function is only partially implemented. It does not support
data sets at this point.
The output of this function is always an eager tensor, eager dataset, a
representation of a TensorFlow computation, or a nested structure of thos... | tensorflow_federated/python/core/impl/executors/eager_tf_executor.py | to_representation_for_type | ddayzzz/federated | python | def to_representation_for_type(value: Any, tf_function_cache: MutableMapping[(str, Any)], type_spec: Optional[computation_types.Type]=None, device: Optional[tf.config.LogicalDevice]=None) -> Any:
'Verifies or converts the `value` to an eager object matching `type_spec`.\n\n WARNING: This function is only partially... |
def function_to_wrap():
'No-arg function to import graph def.\n\n We pass a no-arg function to `tf.compat.v1.wrap_function` to avoid\n the leftover placeholders that can result from binding arguments to the\n imported graphdef via `input_map`. The correct signature will be added to\n this function later... | 1,383,540,077,352,208,600 | No-arg function to import graph def.
We pass a no-arg function to `tf.compat.v1.wrap_function` to avoid
the leftover placeholders that can result from binding arguments to the
imported graphdef via `input_map`. The correct signature will be added to
this function later, via the `prune` call below.
Returns:
Result o... | tensorflow_federated/python/core/impl/executors/eager_tf_executor.py | function_to_wrap | ddayzzz/federated | python | def function_to_wrap():
'No-arg function to import graph def.\n\n We pass a no-arg function to `tf.compat.v1.wrap_function` to avoid\n the leftover placeholders that can result from binding arguments to the\n imported graphdef via `input_map`. The correct signature will be added to\n this function later... |
def __init__(self, value, tf_function_cache, type_spec=None, device=None):
'Creates an instance of a value in this executor.\n\n Args:\n value: Depending on `type_spec`, either a `tf.Tensor`, `tf.data.Dataset`,\n or a nested structure of these stored in an `Struct`.\n tf_function_cache: A cache ... | -5,315,987,343,711,920,000 | Creates an instance of a value in this executor.
Args:
value: Depending on `type_spec`, either a `tf.Tensor`, `tf.data.Dataset`,
or a nested structure of these stored in an `Struct`.
tf_function_cache: A cache obeying `dict` semantics that can be used to
look up previously embedded TensorFlow functions.
... | tensorflow_federated/python/core/impl/executors/eager_tf_executor.py | __init__ | ddayzzz/federated | python | def __init__(self, value, tf_function_cache, type_spec=None, device=None):
'Creates an instance of a value in this executor.\n\n Args:\n value: Depending on `type_spec`, either a `tf.Tensor`, `tf.data.Dataset`,\n or a nested structure of these stored in an `Struct`.\n tf_function_cache: A cache ... |
@property
def internal_representation(self):
'Returns a representation of the eager value embedded in the executor.\n\n This property is only intended for use by the eager executor and tests. Not\n for consumption by consumers of the executor interface.\n '
return self._value | 4,524,943,150,084,182,500 | Returns a representation of the eager value embedded in the executor.
This property is only intended for use by the eager executor and tests. Not
for consumption by consumers of the executor interface. | tensorflow_federated/python/core/impl/executors/eager_tf_executor.py | internal_representation | ddayzzz/federated | python | @property
def internal_representation(self):
'Returns a representation of the eager value embedded in the executor.\n\n This property is only intended for use by the eager executor and tests. Not\n for consumption by consumers of the executor interface.\n '
return self._value |
def __init__(self, device=None):
'Creates a new instance of an eager executor.\n\n Args:\n device: An optional `tf.config.LogicalDevice` that this executor will\n schedule all of its operations to run on. For example, the list of\n logical devices can be obtained using\n `tf.config.list... | 1,817,966,913,073,732,900 | Creates a new instance of an eager executor.
Args:
device: An optional `tf.config.LogicalDevice` that this executor will
schedule all of its operations to run on. For example, the list of
logical devices can be obtained using
`tf.config.list_logical_devices()`.
Raises:
RuntimeError: If not executing e... | tensorflow_federated/python/core/impl/executors/eager_tf_executor.py | __init__ | ddayzzz/federated | python | def __init__(self, device=None):
'Creates a new instance of an eager executor.\n\n Args:\n device: An optional `tf.config.LogicalDevice` that this executor will\n schedule all of its operations to run on. For example, the list of\n logical devices can be obtained using\n `tf.config.list... |
@tracing.trace(span=True)
async def create_value(self, value, type_spec=None):
'Embeds `value` of type `type_spec` within this executor.\n\n Args:\n value: An object that represents the value to embed within the executor.\n type_spec: The `tff.Type` of the value represented by this object, or\n ... | -8,492,140,350,242,627,000 | Embeds `value` of type `type_spec` within this executor.
Args:
value: An object that represents the value to embed within the executor.
type_spec: The `tff.Type` of the value represented by this object, or
something convertible to it. Can optionally be `None` if `value` is an
instance of `typed_object.Type... | tensorflow_federated/python/core/impl/executors/eager_tf_executor.py | create_value | ddayzzz/federated | python | @tracing.trace(span=True)
async def create_value(self, value, type_spec=None):
'Embeds `value` of type `type_spec` within this executor.\n\n Args:\n value: An object that represents the value to embed within the executor.\n type_spec: The `tff.Type` of the value represented by this object, or\n ... |
@tracing.trace
async def create_call(self, comp, arg=None):
'Creates a call to `comp` with optional `arg`.\n\n Args:\n comp: As documented in `executor_base.Executor`.\n arg: As documented in `executor_base.Executor`.\n\n Returns:\n An instance of `EagerValue` representing the result of the cal... | 7,628,042,971,048,479,000 | Creates a call to `comp` with optional `arg`.
Args:
comp: As documented in `executor_base.Executor`.
arg: As documented in `executor_base.Executor`.
Returns:
An instance of `EagerValue` representing the result of the call.
Raises:
RuntimeError: If not executing eagerly.
TypeError: If the arguments are of t... | tensorflow_federated/python/core/impl/executors/eager_tf_executor.py | create_call | ddayzzz/federated | python | @tracing.trace
async def create_call(self, comp, arg=None):
'Creates a call to `comp` with optional `arg`.\n\n Args:\n comp: As documented in `executor_base.Executor`.\n arg: As documented in `executor_base.Executor`.\n\n Returns:\n An instance of `EagerValue` representing the result of the cal... |
@tracing.trace
async def create_struct(self, elements):
'Creates a tuple of `elements`.\n\n Args:\n elements: As documented in `executor_base.Executor`.\n\n Returns:\n An instance of `EagerValue` that represents the constructed tuple.\n '
elements = structure.to_elements(structure.from_contai... | -5,155,764,902,810,965,000 | Creates a tuple of `elements`.
Args:
elements: As documented in `executor_base.Executor`.
Returns:
An instance of `EagerValue` that represents the constructed tuple. | tensorflow_federated/python/core/impl/executors/eager_tf_executor.py | create_struct | ddayzzz/federated | python | @tracing.trace
async def create_struct(self, elements):
'Creates a tuple of `elements`.\n\n Args:\n elements: As documented in `executor_base.Executor`.\n\n Returns:\n An instance of `EagerValue` that represents the constructed tuple.\n '
elements = structure.to_elements(structure.from_contai... |
@tracing.trace
async def create_selection(self, source, index=None, name=None):
'Creates a selection from `source`.\n\n Args:\n source: As documented in `executor_base.Executor`.\n index: As documented in `executor_base.Executor`.\n name: As documented in `executor_base.Executor`.\n\n Returns:\... | 2,041,311,405,275,014,700 | Creates a selection from `source`.
Args:
source: As documented in `executor_base.Executor`.
index: As documented in `executor_base.Executor`.
name: As documented in `executor_base.Executor`.
Returns:
An instance of `EagerValue` that represents the constructed selection.
Raises:
TypeError: If arguments are ... | tensorflow_federated/python/core/impl/executors/eager_tf_executor.py | create_selection | ddayzzz/federated | python | @tracing.trace
async def create_selection(self, source, index=None, name=None):
'Creates a selection from `source`.\n\n Args:\n source: As documented in `executor_base.Executor`.\n index: As documented in `executor_base.Executor`.\n name: As documented in `executor_base.Executor`.\n\n Returns:\... |
def ensemble(scores):
'\n Ensemble by majority vote.\n '
c = Counter()
for probs in zip(scores):
idx = int(np.argmax(np.array(probs)))
c.update([idx])
best = c.most_common(1)[0][0]
return best | -556,498,030,192,940,700 | Ensemble by majority vote. | ensemble.py | ensemble | gstoica27/tacred-exploration | python | def ensemble(scores):
'\n \n '
c = Counter()
for probs in zip(scores):
idx = int(np.argmax(np.array(probs)))
c.update([idx])
best = c.most_common(1)[0][0]
return best |
def __len__(self):
'Return the total number of path components.'
i = (- 1)
for (i, _) in enumerate(self):
pass
return (i + 1) | -4,726,724,090,606,615,000 | Return the total number of path components. | grr/lib/rdfvalues/paths.py | __len__ | mrhania/grr | python | def __len__(self):
i = (- 1)
for (i, _) in enumerate(self):
pass
return (i + 1) |
def __iter__(self):
'Only iterate over all components from the current pointer.'
element = self
while element.HasField('pathtype'):
(yield element)
if element.HasField('nested_path'):
element = element.nested_path
else:
break | -346,827,248,376,829,700 | Only iterate over all components from the current pointer. | grr/lib/rdfvalues/paths.py | __iter__ | mrhania/grr | python | def __iter__(self):
element = self
while element.HasField('pathtype'):
(yield element)
if element.HasField('nested_path'):
element = element.nested_path
else:
break |
def Insert(self, index, rdfpathspec=None, **kwarg):
'Insert a single component at index.'
if (rdfpathspec is None):
rdfpathspec = self.__class__(**kwarg)
if (index == 0):
nested_proto = self.__class__()
nested_proto.SetRawData(self.GetRawData())
self.SetRawData(rdfpathspec.Ge... | 2,803,779,637,885,970,000 | Insert a single component at index. | grr/lib/rdfvalues/paths.py | Insert | mrhania/grr | python | def Insert(self, index, rdfpathspec=None, **kwarg):
if (rdfpathspec is None):
rdfpathspec = self.__class__(**kwarg)
if (index == 0):
nested_proto = self.__class__()
nested_proto.SetRawData(self.GetRawData())
self.SetRawData(rdfpathspec.GetRawData())
self.last.nested_... |
def Append(self, component=None, **kwarg):
'Append a new pathspec component to this pathspec.'
if (component is None):
component = self.__class__(**kwarg)
if self.HasField('pathtype'):
self.last.nested_path = component
else:
for (k, v) in kwarg.items():
setattr(self, ... | -4,659,558,211,762,946,000 | Append a new pathspec component to this pathspec. | grr/lib/rdfvalues/paths.py | Append | mrhania/grr | python | def Append(self, component=None, **kwarg):
if (component is None):
component = self.__class__(**kwarg)
if self.HasField('pathtype'):
self.last.nested_path = component
else:
for (k, v) in kwarg.items():
setattr(self, k, v)
self.SetRawData(component.GetRawData(... |
def Pop(self, index=0):
'Removes and returns the pathspec at the specified index.'
if (index < 0):
index += len(self)
if (index == 0):
result = self.__class__()
result.SetRawData(self.GetRawData())
self.SetRawData(self.nested_path.GetRawData())
else:
previous = se... | 3,488,132,426,749,126,700 | Removes and returns the pathspec at the specified index. | grr/lib/rdfvalues/paths.py | Pop | mrhania/grr | python | def Pop(self, index=0):
if (index < 0):
index += len(self)
if (index == 0):
result = self.__class__()
result.SetRawData(self.GetRawData())
self.SetRawData(self.nested_path.GetRawData())
else:
previous = self[(index - 1)]
result = previous.nested_path
... |
def Dirname(self):
'Get a new copied object with only the directory path.'
result = self.Copy()
while 1:
last_directory = posixpath.dirname(result.last.path)
if ((last_directory != '/') or (len(result) <= 1)):
result.last.path = last_directory
result.last.inode = None... | -4,814,401,091,083,449,000 | Get a new copied object with only the directory path. | grr/lib/rdfvalues/paths.py | Dirname | mrhania/grr | python | def Dirname(self):
result = self.Copy()
while 1:
last_directory = posixpath.dirname(result.last.path)
if ((last_directory != '/') or (len(result) <= 1)):
result.last.path = last_directory
result.last.inode = None
break
result.Pop((- 1))
return... |
def AFF4Path(self, client_urn):
'Returns the AFF4 URN this pathspec will be stored under.\n\n Args:\n client_urn: A ClientURN.\n\n Returns:\n A urn that corresponds to this pathspec.\n\n Raises:\n ValueError: If pathspec is not of the correct type.\n '
if (not self.HasField('pathtype'... | 3,655,332,079,633,526,300 | Returns the AFF4 URN this pathspec will be stored under.
Args:
client_urn: A ClientURN.
Returns:
A urn that corresponds to this pathspec.
Raises:
ValueError: If pathspec is not of the correct type. | grr/lib/rdfvalues/paths.py | AFF4Path | mrhania/grr | python | def AFF4Path(self, client_urn):
'Returns the AFF4 URN this pathspec will be stored under.\n\n Args:\n client_urn: A ClientURN.\n\n Returns:\n A urn that corresponds to this pathspec.\n\n Raises:\n ValueError: If pathspec is not of the correct type.\n '
if (not self.HasField('pathtype'... |
def Validate(self):
'GlobExpression is valid.'
if (len(self.RECURSION_REGEX.findall(self._value)) > 1):
raise ValueError(('Only one ** is permitted per path: %s.' % self._value)) | -7,115,543,097,806,057,000 | GlobExpression is valid. | grr/lib/rdfvalues/paths.py | Validate | mrhania/grr | python | def Validate(self):
if (len(self.RECURSION_REGEX.findall(self._value)) > 1):
raise ValueError(('Only one ** is permitted per path: %s.' % self._value)) |
def InterpolateGrouping(self, pattern):
'Interpolate inline globbing groups.'
components = []
offset = 0
for match in GROUPING_PATTERN.finditer(pattern):
components.append([pattern[offset:match.start()]])
alternatives = match.group(1).split(',')
components.append(set(alternatives... | -7,670,459,769,591,568,000 | Interpolate inline globbing groups. | grr/lib/rdfvalues/paths.py | InterpolateGrouping | mrhania/grr | python | def InterpolateGrouping(self, pattern):
components = []
offset = 0
for match in GROUPING_PATTERN.finditer(pattern):
components.append([pattern[offset:match.start()]])
alternatives = match.group(1).split(',')
components.append(set(alternatives))
offset = match.end()
c... |
def AsRegEx(self):
'Return the current glob as a simple regex.\n\n Note: No interpolation is performed.\n\n Returns:\n A RegularExpression() object.\n '
parts = self.__class__.REGEX_SPLIT_PATTERN.split(self._value)
result = ''.join((self._ReplaceRegExPart(p) for p in parts))
return rdf_sta... | -634,661,955,549,305,600 | Return the current glob as a simple regex.
Note: No interpolation is performed.
Returns:
A RegularExpression() object. | grr/lib/rdfvalues/paths.py | AsRegEx | mrhania/grr | python | def AsRegEx(self):
'Return the current glob as a simple regex.\n\n Note: No interpolation is performed.\n\n Returns:\n A RegularExpression() object.\n '
parts = self.__class__.REGEX_SPLIT_PATTERN.split(self._value)
result = .join((self._ReplaceRegExPart(p) for p in parts))
return rdf_stand... |
def _get_cluster_id_value(self):
'\n Getter method for cluster_id_value, mapped from YANG variable /routing_system/router/router_bgp/router_bgp_attributes/cluster_id/cluster_id_value (decimal-number)\n '
return self.__cluster_id_value | 2,962,098,623,915,979,000 | Getter method for cluster_id_value, mapped from YANG variable /routing_system/router/router_bgp/router_bgp_attributes/cluster_id/cluster_id_value (decimal-number) | pybind/slxos/v17r_1_01a/routing_system/router/router_bgp/router_bgp_attributes/cluster_id/__init__.py | _get_cluster_id_value | extremenetworks/pybind | python | def _get_cluster_id_value(self):
'\n \n '
return self.__cluster_id_value |
def _set_cluster_id_value(self, v, load=False):
'\n Setter method for cluster_id_value, mapped from YANG variable /routing_system/router/router_bgp/router_bgp_attributes/cluster_id/cluster_id_value (decimal-number)\n If this variable is read-only (config: false) in the\n source YANG file, then _set_cluster... | 236,462,422,169,550,080 | Setter method for cluster_id_value, mapped from YANG variable /routing_system/router/router_bgp/router_bgp_attributes/cluster_id/cluster_id_value (decimal-number)
If this variable is read-only (config: false) in the
source YANG file, then _set_cluster_id_value is considered as a private
method. Backends looking to popu... | pybind/slxos/v17r_1_01a/routing_system/router/router_bgp/router_bgp_attributes/cluster_id/__init__.py | _set_cluster_id_value | extremenetworks/pybind | python | def _set_cluster_id_value(self, v, load=False):
'\n Setter method for cluster_id_value, mapped from YANG variable /routing_system/router/router_bgp/router_bgp_attributes/cluster_id/cluster_id_value (decimal-number)\n If this variable is read-only (config: false) in the\n source YANG file, then _set_cluster... |
def _get_cluster_id_ipv4_address(self):
'\n Getter method for cluster_id_ipv4_address, mapped from YANG variable /routing_system/router/router_bgp/router_bgp_attributes/cluster_id/cluster_id_ipv4_address (inet:ipv4-address)\n '
return self.__cluster_id_ipv4_address | -3,337,470,066,997,727,000 | Getter method for cluster_id_ipv4_address, mapped from YANG variable /routing_system/router/router_bgp/router_bgp_attributes/cluster_id/cluster_id_ipv4_address (inet:ipv4-address) | pybind/slxos/v17r_1_01a/routing_system/router/router_bgp/router_bgp_attributes/cluster_id/__init__.py | _get_cluster_id_ipv4_address | extremenetworks/pybind | python | def _get_cluster_id_ipv4_address(self):
'\n \n '
return self.__cluster_id_ipv4_address |
def _set_cluster_id_ipv4_address(self, v, load=False):
'\n Setter method for cluster_id_ipv4_address, mapped from YANG variable /routing_system/router/router_bgp/router_bgp_attributes/cluster_id/cluster_id_ipv4_address (inet:ipv4-address)\n If this variable is read-only (config: false) in the\n source YANG... | 5,680,376,728,149,061,000 | Setter method for cluster_id_ipv4_address, mapped from YANG variable /routing_system/router/router_bgp/router_bgp_attributes/cluster_id/cluster_id_ipv4_address (inet:ipv4-address)
If this variable is read-only (config: false) in the
source YANG file, then _set_cluster_id_ipv4_address is considered as a private
method. ... | pybind/slxos/v17r_1_01a/routing_system/router/router_bgp/router_bgp_attributes/cluster_id/__init__.py | _set_cluster_id_ipv4_address | extremenetworks/pybind | python | def _set_cluster_id_ipv4_address(self, v, load=False):
'\n Setter method for cluster_id_ipv4_address, mapped from YANG variable /routing_system/router/router_bgp/router_bgp_attributes/cluster_id/cluster_id_ipv4_address (inet:ipv4-address)\n If this variable is read-only (config: false) in the\n source YANG... |
def test_rss2_feed(self):
'\n Test the structure and content of feeds generated by Rss201rev2Feed.\n '
response = self.client.get('/syndication/rss2/')
doc = minidom.parseString(response.content)
feed_elem = doc.getElementsByTagName('rss')
self.assertEqual(len(feed_elem), 1)
feed =... | -553,182,212,880,170,560 | Test the structure and content of feeds generated by Rss201rev2Feed. | tests/regressiontests/syndication/tests.py | test_rss2_feed | Smarsh/django | python | def test_rss2_feed(self):
'\n \n '
response = self.client.get('/syndication/rss2/')
doc = minidom.parseString(response.content)
feed_elem = doc.getElementsByTagName('rss')
self.assertEqual(len(feed_elem), 1)
feed = feed_elem[0]
self.assertEqual(feed.getAttribute('version'), '2.... |
def test_rss091_feed(self):
'\n Test the structure and content of feeds generated by RssUserland091Feed.\n '
response = self.client.get('/syndication/rss091/')
doc = minidom.parseString(response.content)
feed_elem = doc.getElementsByTagName('rss')
self.assertEqual(len(feed_elem), 1)
... | -545,652,658,098,288,800 | Test the structure and content of feeds generated by RssUserland091Feed. | tests/regressiontests/syndication/tests.py | test_rss091_feed | Smarsh/django | python | def test_rss091_feed(self):
'\n \n '
response = self.client.get('/syndication/rss091/')
doc = minidom.parseString(response.content)
feed_elem = doc.getElementsByTagName('rss')
self.assertEqual(len(feed_elem), 1)
feed = feed_elem[0]
self.assertEqual(feed.getAttribute('version'),... |
def test_atom_feed(self):
'\n Test the structure and content of feeds generated by Atom1Feed.\n '
response = self.client.get('/syndication/atom/')
feed = minidom.parseString(response.content).firstChild
self.assertEqual(feed.nodeName, 'feed')
self.assertEqual(feed.getAttribute('xmlns')... | -7,519,615,970,066,044,000 | Test the structure and content of feeds generated by Atom1Feed. | tests/regressiontests/syndication/tests.py | test_atom_feed | Smarsh/django | python | def test_atom_feed(self):
'\n \n '
response = self.client.get('/syndication/atom/')
feed = minidom.parseString(response.content).firstChild
self.assertEqual(feed.nodeName, 'feed')
self.assertEqual(feed.getAttribute('xmlns'), 'http://www.w3.org/2005/Atom')
self.assertChildNodes(feed... |
def test_title_escaping(self):
'\n Tests that titles are escaped correctly in RSS feeds.\n '
response = self.client.get('/syndication/rss2/')
doc = minidom.parseString(response.content)
for item in doc.getElementsByTagName('item'):
link = item.getElementsByTagName('link')[0]
... | -6,928,047,492,795,901,000 | Tests that titles are escaped correctly in RSS feeds. | tests/regressiontests/syndication/tests.py | test_title_escaping | Smarsh/django | python | def test_title_escaping(self):
'\n \n '
response = self.client.get('/syndication/rss2/')
doc = minidom.parseString(response.content)
for item in doc.getElementsByTagName('item'):
link = item.getElementsByTagName('link')[0]
if (link.firstChild.wholeText == 'http://example.co... |
def test_naive_datetime_conversion(self):
'\n Test that datetimes are correctly converted to the local time zone.\n '
response = self.client.get('/syndication/naive-dates/')
doc = minidom.parseString(response.content)
updated = doc.getElementsByTagName('updated')[0].firstChild.wholeText
... | 4,198,248,771,720,096,000 | Test that datetimes are correctly converted to the local time zone. | tests/regressiontests/syndication/tests.py | test_naive_datetime_conversion | Smarsh/django | python | def test_naive_datetime_conversion(self):
'\n \n '
response = self.client.get('/syndication/naive-dates/')
doc = minidom.parseString(response.content)
updated = doc.getElementsByTagName('updated')[0].firstChild.wholeText
d = Entry.objects.latest('date').date
ltz = tzinfo.LocalTimez... |
def test_aware_datetime_conversion(self):
"\n Test that datetimes with timezones don't get trodden on.\n "
response = self.client.get('/syndication/aware-dates/')
doc = minidom.parseString(response.content)
updated = doc.getElementsByTagName('updated')[0].firstChild.wholeText
self.asse... | 4,785,870,899,759,614,000 | Test that datetimes with timezones don't get trodden on. | tests/regressiontests/syndication/tests.py | test_aware_datetime_conversion | Smarsh/django | python | def test_aware_datetime_conversion(self):
"\n \n "
response = self.client.get('/syndication/aware-dates/')
doc = minidom.parseString(response.content)
updated = doc.getElementsByTagName('updated')[0].firstChild.wholeText
self.assertEqual(updated[(- 6):], '+00:42') |
def test_feed_url(self):
'\n Test that the feed_url can be overridden.\n '
response = self.client.get('/syndication/feedurl/')
doc = minidom.parseString(response.content)
for link in doc.getElementsByTagName('link'):
if (link.getAttribute('rel') == 'self'):
self.assertE... | -4,254,890,965,348,122,600 | Test that the feed_url can be overridden. | tests/regressiontests/syndication/tests.py | test_feed_url | Smarsh/django | python | def test_feed_url(self):
'\n \n '
response = self.client.get('/syndication/feedurl/')
doc = minidom.parseString(response.content)
for link in doc.getElementsByTagName('link'):
if (link.getAttribute('rel') == 'self'):
self.assertEqual(link.getAttribute('href'), 'http://e... |
def test_item_link_error(self):
'\n Test that a ImproperlyConfigured is raised if no link could be found\n for the item(s).\n '
self.assertRaises(ImproperlyConfigured, self.client.get, '/syndication/articles/') | 4,261,096,110,716,304,400 | Test that a ImproperlyConfigured is raised if no link could be found
for the item(s). | tests/regressiontests/syndication/tests.py | test_item_link_error | Smarsh/django | python | def test_item_link_error(self):
'\n Test that a ImproperlyConfigured is raised if no link could be found\n for the item(s).\n '
self.assertRaises(ImproperlyConfigured, self.client.get, '/syndication/articles/') |
def test_template_feed(self):
'\n Test that the item title and description can be overridden with\n templates.\n '
response = self.client.get('/syndication/template/')
doc = minidom.parseString(response.content)
feed = doc.getElementsByTagName('rss')[0]
chan = feed.getElementsBy... | -8,862,071,585,553,255,000 | Test that the item title and description can be overridden with
templates. | tests/regressiontests/syndication/tests.py | test_template_feed | Smarsh/django | python | def test_template_feed(self):
'\n Test that the item title and description can be overridden with\n templates.\n '
response = self.client.get('/syndication/template/')
doc = minidom.parseString(response.content)
feed = doc.getElementsByTagName('rss')[0]
chan = feed.getElementsBy... |
def test_add_domain(self):
'\n Test add_domain() prefixes domains onto the correct URLs.\n '
self.assertEqual(views.add_domain('example.com', '/foo/?arg=value'), 'http://example.com/foo/?arg=value')
self.assertEqual(views.add_domain('example.com', 'http://djangoproject.com/doc/'), 'http://djan... | 9,005,860,053,456,032,000 | Test add_domain() prefixes domains onto the correct URLs. | tests/regressiontests/syndication/tests.py | test_add_domain | Smarsh/django | python | def test_add_domain(self):
'\n \n '
self.assertEqual(views.add_domain('example.com', '/foo/?arg=value'), 'http://example.com/foo/?arg=value')
self.assertEqual(views.add_domain('example.com', 'http://djangoproject.com/doc/'), 'http://djangoproject.com/doc/')
self.assertEqual(views.add_domai... |
def test_empty_feed_dict(self):
'\n Test that an empty feed_dict raises a 404.\n '
response = self.client.get('/syndication/depr-feeds-empty/aware-dates/')
self.assertEquals(response.status_code, 404) | 6,601,415,122,694,413,000 | Test that an empty feed_dict raises a 404. | tests/regressiontests/syndication/tests.py | test_empty_feed_dict | Smarsh/django | python | def test_empty_feed_dict(self):
'\n \n '
response = self.client.get('/syndication/depr-feeds-empty/aware-dates/')
self.assertEquals(response.status_code, 404) |
def test_nonexistent_slug(self):
'\n Test that a non-existent slug raises a 404.\n '
response = self.client.get('/syndication/depr-feeds/foobar/')
self.assertEquals(response.status_code, 404) | -625,279,591,304,710,500 | Test that a non-existent slug raises a 404. | tests/regressiontests/syndication/tests.py | test_nonexistent_slug | Smarsh/django | python | def test_nonexistent_slug(self):
'\n \n '
response = self.client.get('/syndication/depr-feeds/foobar/')
self.assertEquals(response.status_code, 404) |
def test_rss_feed(self):
'\n A simple test for Rss201rev2Feed feeds generated by the deprecated\n system.\n '
response = self.client.get('/syndication/depr-feeds/rss/')
doc = minidom.parseString(response.content)
feed = doc.getElementsByTagName('rss')[0]
self.assertEqual(feed.ge... | 9,172,127,389,360,837,000 | A simple test for Rss201rev2Feed feeds generated by the deprecated
system. | tests/regressiontests/syndication/tests.py | test_rss_feed | Smarsh/django | python | def test_rss_feed(self):
'\n A simple test for Rss201rev2Feed feeds generated by the deprecated\n system.\n '
response = self.client.get('/syndication/depr-feeds/rss/')
doc = minidom.parseString(response.content)
feed = doc.getElementsByTagName('rss')[0]
self.assertEqual(feed.ge... |
def test_complex_base_url(self):
"\n Tests that the base url for a complex feed doesn't raise a 500\n exception.\n "
response = self.client.get('/syndication/depr-feeds/complex/')
self.assertEquals(response.status_code, 404) | -4,618,111,784,728,741,000 | Tests that the base url for a complex feed doesn't raise a 500
exception. | tests/regressiontests/syndication/tests.py | test_complex_base_url | Smarsh/django | python | def test_complex_base_url(self):
"\n Tests that the base url for a complex feed doesn't raise a 500\n exception.\n "
response = self.client.get('/syndication/depr-feeds/complex/')
self.assertEquals(response.status_code, 404) |
def search(self, params, max_results=None, results=[]):
'\n Do a search.\n '
sleep(random.randint(0, 1))
count = (max_results if (max_results and (max_results <= Linkedin._MAX_SEARCH_COUNT)) else Linkedin._MAX_SEARCH_COUNT)
default_params = {'count': count, 'guides': 'List()', 'origin': 'G... | 3,976,749,391,847,237,000 | Do a search. | linkedin_api/linkedin.py | search | Alexander-Bakogeorge/linkedin-api | python | def search(self, params, max_results=None, results=[]):
'\n \n '
sleep(random.randint(0, 1))
count = (max_results if (max_results and (max_results <= Linkedin._MAX_SEARCH_COUNT)) else Linkedin._MAX_SEARCH_COUNT)
default_params = {'count': count, 'guides': 'List()', 'origin': 'GLOBAL_SEARCH... |
def search_people(self, keywords=None, connection_of=None, network_depth=None, regions=None, industries=None):
'\n Do a people search.\n '
guides = ['v->PEOPLE']
if connection_of:
guides.append(f'facetConnectionOf->{connection_of}')
if network_depth:
guides.append(f'facetNe... | 1,342,571,766,792,130,300 | Do a people search. | linkedin_api/linkedin.py | search_people | Alexander-Bakogeorge/linkedin-api | python | def search_people(self, keywords=None, connection_of=None, network_depth=None, regions=None, industries=None):
'\n \n '
guides = ['v->PEOPLE']
if connection_of:
guides.append(f'facetConnectionOf->{connection_of}')
if network_depth:
guides.append(f'facetNetwork->{network_dep... |
def search_companies(self, max_results=None, results=[]):
'\n Do a company search\n Note: try swap from blended search to cluster\n '
sleep(random.randint(2, 5))
'\n default_params = {\n "count": count,\n "guides": "List()",\n "origin": "GLOBAL_SE... | -919,447,569,238,439,700 | Do a company search
Note: try swap from blended search to cluster | linkedin_api/linkedin.py | search_companies | Alexander-Bakogeorge/linkedin-api | python | def search_companies(self, max_results=None, results=[]):
'\n Do a company search\n Note: try swap from blended search to cluster\n '
sleep(random.randint(2, 5))
'\n default_params = {\n "count": count,\n "guides": "List()",\n "origin": "GLOBAL_SE... |
def get_profile_contact_info(self, public_id=None, urn_id=None):
'\n Return data for a single profile.\n\n [public_id] - public identifier i.e. tom-quirk-1928345\n [urn_id] - id provided by the related URN\n '
res = self.client.session.get(f'{self.client.API_BASE_URL}/identity/profil... | 3,077,738,592,435,370,500 | Return data for a single profile.
[public_id] - public identifier i.e. tom-quirk-1928345
[urn_id] - id provided by the related URN | linkedin_api/linkedin.py | get_profile_contact_info | Alexander-Bakogeorge/linkedin-api | python | def get_profile_contact_info(self, public_id=None, urn_id=None):
'\n Return data for a single profile.\n\n [public_id] - public identifier i.e. tom-quirk-1928345\n [urn_id] - id provided by the related URN\n '
res = self.client.session.get(f'{self.client.API_BASE_URL}/identity/profil... |
def get_profile(self, public_id=None, urn_id=None):
'\n Return data for a single profile.\n\n [public_id] - public identifier i.e. tom-quirk-1928345\n [urn_id] - id provided by the related URN\n '
sleep(random.randint(2, 5))
res = self.client.session.get(f'{self.client.API_BASE_U... | 4,548,155,974,933,145,000 | Return data for a single profile.
[public_id] - public identifier i.e. tom-quirk-1928345
[urn_id] - id provided by the related URN | linkedin_api/linkedin.py | get_profile | Alexander-Bakogeorge/linkedin-api | python | def get_profile(self, public_id=None, urn_id=None):
'\n Return data for a single profile.\n\n [public_id] - public identifier i.e. tom-quirk-1928345\n [urn_id] - id provided by the related URN\n '
sleep(random.randint(2, 5))
res = self.client.session.get(f'{self.client.API_BASE_U... |
def get_profile_connections(self, urn_id):
'\n Return a list of profile ids connected to profile of given [urn_id]\n '
return self.search_people(connection_of=urn_id, network_depth='F') | -8,977,781,855,160,709,000 | Return a list of profile ids connected to profile of given [urn_id] | linkedin_api/linkedin.py | get_profile_connections | Alexander-Bakogeorge/linkedin-api | python | def get_profile_connections(self, urn_id):
'\n \n '
return self.search_people(connection_of=urn_id, network_depth='F') |
def get_profile_networkinfo(self, urn_id):
'\n Return the nework info connected to the profile of the given [urn_id]\n '
sleep(random.randint(2, 5))
res = self.client.session.get(f'{self.client.API_BASE_URL}/identity/profiles/{urn_id}/networkinfo')
return res.json() | 4,752,674,305,240,124,000 | Return the nework info connected to the profile of the given [urn_id] | linkedin_api/linkedin.py | get_profile_networkinfo | Alexander-Bakogeorge/linkedin-api | python | def get_profile_networkinfo(self, urn_id):
'\n \n '
sleep(random.randint(2, 5))
res = self.client.session.get(f'{self.client.API_BASE_URL}/identity/profiles/{urn_id}/networkinfo')
return res.json() |
def get_company_updates(self, public_id=None, urn_id=None, max_results=None, results=[]):
'"\n Return a list of company posts\n\n [public_id] - public identifier ie - microsoft\n [urn_id] - id provided by the related URN\n '
sleep(random.randint(2, 5))
params = {'companyUniversal... | -8,852,638,028,545,315,000 | "
Return a list of company posts
[public_id] - public identifier ie - microsoft
[urn_id] - id provided by the related URN | linkedin_api/linkedin.py | get_company_updates | Alexander-Bakogeorge/linkedin-api | python | def get_company_updates(self, public_id=None, urn_id=None, max_results=None, results=[]):
'"\n Return a list of company posts\n\n [public_id] - public identifier ie - microsoft\n [urn_id] - id provided by the related URN\n '
sleep(random.randint(2, 5))
params = {'companyUniversal... |
def get_profile_updates(self, public_id=None, urn_id=None, max_results=None, results=[]):
'"\n Return a list of profile posts\n\n [public_id] - public identifier i.e. tom-quirk-1928345\n [urn_id] - id provided by the related URN\n '
sleep(random.randint(2, 5))
params = {'profileI... | 4,512,190,451,809,785,000 | "
Return a list of profile posts
[public_id] - public identifier i.e. tom-quirk-1928345
[urn_id] - id provided by the related URN | linkedin_api/linkedin.py | get_profile_updates | Alexander-Bakogeorge/linkedin-api | python | def get_profile_updates(self, public_id=None, urn_id=None, max_results=None, results=[]):
'"\n Return a list of profile posts\n\n [public_id] - public identifier i.e. tom-quirk-1928345\n [urn_id] - id provided by the related URN\n '
sleep(random.randint(2, 5))
params = {'profileI... |
def get_current_profile_views(self):
'\n Get profile view statistics, including chart data.\n '
res = self.client.session.get(f'{self.client.API_BASE_URL}/identity/panels')
data = res.json()
return data['elements'][0]['value']['com.linkedin.voyager.identity.me.ProfileViewsByTimePanel'] | 7,285,217,187,157,486,000 | Get profile view statistics, including chart data. | linkedin_api/linkedin.py | get_current_profile_views | Alexander-Bakogeorge/linkedin-api | python | def get_current_profile_views(self):
'\n \n '
res = self.client.session.get(f'{self.client.API_BASE_URL}/identity/panels')
data = res.json()
return data['elements'][0]['value']['com.linkedin.voyager.identity.me.ProfileViewsByTimePanel'] |
def get_school(self, public_id):
'\n Return data for a single school.\n\n [public_id] - public identifier i.e. uq\n '
sleep(random.randint(2, 5))
params = {'decoration': '\n (\n autoGenerated,backgroundCoverImage,\n companyEmployeesSearchPage... | 7,497,702,793,954,886,000 | Return data for a single school.
[public_id] - public identifier i.e. uq | linkedin_api/linkedin.py | get_school | Alexander-Bakogeorge/linkedin-api | python | def get_school(self, public_id):
'\n Return data for a single school.\n\n [public_id] - public identifier i.e. uq\n '
sleep(random.randint(2, 5))
params = {'decoration': '\n (\n autoGenerated,backgroundCoverImage,\n companyEmployeesSearchPage... |
def get_similar_companies(self, public_id):
'\n Return similar companies for a single company.\n\n [public_id] - public identifier i.e. univeristy-of-queensland\n '
sleep(random.randint(2, 5))
res = self.client.session.get(f'{self.client.API_BASE_URL}/organization/companies?count={Linke... | -165,383,243,870,637,150 | Return similar companies for a single company.
[public_id] - public identifier i.e. univeristy-of-queensland | linkedin_api/linkedin.py | get_similar_companies | Alexander-Bakogeorge/linkedin-api | python | def get_similar_companies(self, public_id):
'\n Return similar companies for a single company.\n\n [public_id] - public identifier i.e. univeristy-of-queensland\n '
sleep(random.randint(2, 5))
res = self.client.session.get(f'{self.client.API_BASE_URL}/organization/companies?count={Linke... |
def get_company(self, public_id):
'\n Return data for a single company.\n\n [public_id] - public identifier i.e. univeristy-of-queensland\n '
sleep(random.randint(2, 5))
params = {'decoration': '\n (\n affiliatedCompaniesWithEmployeesRollup,affiliatedCompan... | -4,725,619,835,804,699,000 | Return data for a single company.
[public_id] - public identifier i.e. univeristy-of-queensland | linkedin_api/linkedin.py | get_company | Alexander-Bakogeorge/linkedin-api | python | def get_company(self, public_id):
'\n Return data for a single company.\n\n [public_id] - public identifier i.e. univeristy-of-queensland\n '
sleep(random.randint(2, 5))
params = {'decoration': '\n (\n affiliatedCompaniesWithEmployeesRollup,affiliatedCompan... |
def get_conversation_details(self, profile_urn_id):
'\n Return the conversation (or "message thread") details for a given [public_profile_id]\n '
res = self.client.session.get(f'{self.client.API_BASE_URL}/messaging/conversations? keyVersion=LEGACY_INBOX&q=participants&recipients=List({p... | -4,790,249,521,740,766,000 | Return the conversation (or "message thread") details for a given [public_profile_id] | linkedin_api/linkedin.py | get_conversation_details | Alexander-Bakogeorge/linkedin-api | python | def get_conversation_details(self, profile_urn_id):
'\n \n '
res = self.client.session.get(f'{self.client.API_BASE_URL}/messaging/conversations? keyVersion=LEGACY_INBOX&q=participants&recipients=List({profile_urn_id})')
data = res.json()
item = data['elements'][0]
item['id']... |
def get_conversations(self):
'\n Return list of conversations the user is in.\n '
params = {'keyVersion': 'LEGACY_INBOX'}
res = self.client.session.get(f'{self.client.API_BASE_URL}/messaging/conversations', params=params)
return res.json() | 8,023,586,044,105,106,000 | Return list of conversations the user is in. | linkedin_api/linkedin.py | get_conversations | Alexander-Bakogeorge/linkedin-api | python | def get_conversations(self):
'\n \n '
params = {'keyVersion': 'LEGACY_INBOX'}
res = self.client.session.get(f'{self.client.API_BASE_URL}/messaging/conversations', params=params)
return res.json() |
def get_conversation(self, conversation_urn_id):
'\n Return the full conversation at a given [conversation_urn_id]\n '
res = self.client.session.get(f'{self.client.API_BASE_URL}/messaging/conversations/{conversation_urn_id}/events')
return res.json() | 8,517,749,211,933,363,000 | Return the full conversation at a given [conversation_urn_id] | linkedin_api/linkedin.py | get_conversation | Alexander-Bakogeorge/linkedin-api | python | def get_conversation(self, conversation_urn_id):
'\n \n '
res = self.client.session.get(f'{self.client.API_BASE_URL}/messaging/conversations/{conversation_urn_id}/events')
return res.json() |
def send_message(self, conversation_urn_id, message_body):
'\n Return the full conversation at a given [conversation_urn_id]\n '
params = {'action': 'create'}
payload = json.dumps({'eventCreate': {'value': {'com.linkedin.voyager.messaging.create.MessageCreate': {'body': message_body, 'attachme... | -6,964,454,851,207,718,000 | Return the full conversation at a given [conversation_urn_id] | linkedin_api/linkedin.py | send_message | Alexander-Bakogeorge/linkedin-api | python | def send_message(self, conversation_urn_id, message_body):
'\n \n '
params = {'action': 'create'}
payload = json.dumps({'eventCreate': {'value': {'com.linkedin.voyager.messaging.create.MessageCreate': {'body': message_body, 'attachments': [], 'attributedBody': {'text': message_body, 'attribute... |
def test_too_many_arguments_in_fixture(absolute_path):
"\n End-to-End test to check arguments count.\n\n It is required due to how 'function_type' parameter\n works inside 'flake8'.\n\n Otherwise it is not set, unit tests can not cover `is_method` correctly.\n "
filename = absolute_path('fixtures... | 4,681,387,448,552,898,000 | End-to-End test to check arguments count.
It is required due to how 'function_type' parameter
works inside 'flake8'.
Otherwise it is not set, unit tests can not cover `is_method` correctly. | tests/test_checkers/test_high_complexity.py | test_too_many_arguments_in_fixture | AlwxSin/wemake-python-styleguide | python | def test_too_many_arguments_in_fixture(absolute_path):
"\n End-to-End test to check arguments count.\n\n It is required due to how 'function_type' parameter\n works inside 'flake8'.\n\n Otherwise it is not set, unit tests can not cover `is_method` correctly.\n "
filename = absolute_path('fixtures... |
@Backend._assert_backend_available
def compile_function(self, function, arguments):
'Compiles a Theano graph into a callable.'
return self._compile_function_without_warnings(arguments, function) | -8,960,196,433,114,248,000 | Compiles a Theano graph into a callable. | pymanopt/autodiff/backends/_theano.py | compile_function | Andrew-Wyn/pymanopt | python | @Backend._assert_backend_available
def compile_function(self, function, arguments):
return self._compile_function_without_warnings(arguments, function) |
@Backend._assert_backend_available
def compute_gradient(self, function, arguments):
'Returns a compiled function computing the gradient of ``function``\n with respect to ``arguments``.\n '
if (len(arguments) == 1):
(argument,) = arguments
gradient = T.grad(function, argument)
... | -52,295,808,930,264,856 | Returns a compiled function computing the gradient of ``function``
with respect to ``arguments``. | pymanopt/autodiff/backends/_theano.py | compute_gradient | Andrew-Wyn/pymanopt | python | @Backend._assert_backend_available
def compute_gradient(self, function, arguments):
'Returns a compiled function computing the gradient of ``function``\n with respect to ``arguments``.\n '
if (len(arguments) == 1):
(argument,) = arguments
gradient = T.grad(function, argument)
... |
def _compute_unary_hessian_vector_product(self, gradient, argument):
'Returns a function accepting two arguments to compute a\n Hessian-vector product of a scalar-valued unary function.\n '
argument_type = argument.type()
try:
Rop = T.Rop(gradient, argument, argument_type)
except N... | -4,414,070,525,013,380,000 | Returns a function accepting two arguments to compute a
Hessian-vector product of a scalar-valued unary function. | pymanopt/autodiff/backends/_theano.py | _compute_unary_hessian_vector_product | Andrew-Wyn/pymanopt | python | def _compute_unary_hessian_vector_product(self, gradient, argument):
'Returns a function accepting two arguments to compute a\n Hessian-vector product of a scalar-valued unary function.\n '
argument_type = argument.type()
try:
Rop = T.Rop(gradient, argument, argument_type)
except N... |
def _compute_nary_hessian_vector_product(self, gradients, arguments):
"Returns a function accepting `2 * len(arguments)` arguments to\n compute a Hessian-vector product of a multivariate function.\n\n Notes\n -----\n The implementation is based on TensorFlow's '_hessian_vector_product'\n... | 6,644,731,796,320,247,000 | Returns a function accepting `2 * len(arguments)` arguments to
compute a Hessian-vector product of a multivariate function.
Notes
-----
The implementation is based on TensorFlow's '_hessian_vector_product'
function in 'tensorflow.python.ops.gradients_impl'. | pymanopt/autodiff/backends/_theano.py | _compute_nary_hessian_vector_product | Andrew-Wyn/pymanopt | python | def _compute_nary_hessian_vector_product(self, gradients, arguments):
"Returns a function accepting `2 * len(arguments)` arguments to\n compute a Hessian-vector product of a multivariate function.\n\n Notes\n -----\n The implementation is based on TensorFlow's '_hessian_vector_product'\n... |
@Backend._assert_backend_available
def compute_hessian_vector_product(self, function, arguments):
'Computes the directional derivative of the gradient, which is\n equivalent to computing a Hessian-vector product with the direction\n vector.\n '
if (len(arguments) == 1):
(argument,) ... | -6,657,651,170,826,868,000 | Computes the directional derivative of the gradient, which is
equivalent to computing a Hessian-vector product with the direction
vector. | pymanopt/autodiff/backends/_theano.py | compute_hessian_vector_product | Andrew-Wyn/pymanopt | python | @Backend._assert_backend_available
def compute_hessian_vector_product(self, function, arguments):
'Computes the directional derivative of the gradient, which is\n equivalent to computing a Hessian-vector product with the direction\n vector.\n '
if (len(arguments) == 1):
(argument,) ... |
def _check_cuda_version():
'\n Make sure that CUDA versions match between the pytorch install and torchvision install\n '
if (not _HAS_OPS):
return (- 1)
import torch
_version = torch.ops.torchvision._cuda_version()
if ((_version != (- 1)) and (torch.version.cuda is not None)):
... | -8,702,634,230,537,215,000 | Make sure that CUDA versions match between the pytorch install and torchvision install | torchvision/extension.py | _check_cuda_version | AryanRaj315/vision | python | def _check_cuda_version():
'\n \n '
if (not _HAS_OPS):
return (- 1)
import torch
_version = torch.ops.torchvision._cuda_version()
if ((_version != (- 1)) and (torch.version.cuda is not None)):
tv_version = str(_version)
if (int(tv_version) < 10000):
tv_major... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.