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 __getitem__(self, i):
'\n Indexing method.\n Returns a Molecule object for given index (frame).\n Returns a Trajectory object if used as slicing.\n\n '
if isinstance(i, slice):
indices = range(len(self))[i.start:i.stop:i.step]
if (len(indices) == 0):
r... | -6,427,802,718,642,753,000 | Indexing method.
Returns a Molecule object for given index (frame).
Returns a Trajectory object if used as slicing. | angstrom/trajectory/trajectory.py | __getitem__ | kbsezginel/angstrom | python | def __getitem__(self, i):
'\n Indexing method.\n Returns a Molecule object for given index (frame).\n Returns a Trajectory object if used as slicing.\n\n '
if isinstance(i, slice):
indices = range(len(self))[i.start:i.stop:i.step]
if (len(indices) == 0):
r... |
def __iter__(self):
'\n Initialize iterator, reset frame index.\n\n '
self.current_frame = 0
return self | 5,526,493,697,258,412,000 | Initialize iterator, reset frame index. | angstrom/trajectory/trajectory.py | __iter__ | kbsezginel/angstrom | python | def __iter__(self):
'\n \n\n '
self.current_frame = 0
return self |
def __next__(self):
'\n Returns the next frame in Trajectory as a Molecule object.\n\n '
if (self.current_frame >= len(self)):
raise StopIteration
next_mol = self[self.current_frame]
self.current_frame += 1
return next_mol | -5,573,255,124,753,591,000 | Returns the next frame in Trajectory as a Molecule object. | angstrom/trajectory/trajectory.py | __next__ | kbsezginel/angstrom | python | def __next__(self):
'\n \n\n '
if (self.current_frame >= len(self)):
raise StopIteration
next_mol = self[self.current_frame]
self.current_frame += 1
return next_mol |
def append(self, mol):
'\n Append molecule to trajectory.\n The number of atoms in the molecule must match that of the trajectory.\n\n Parameters\n ----------\n mol : Molecule\n Molecule object to be added\n\n Returns\n -------\n None\n A... | -5,508,576,439,384,275,000 | Append molecule to trajectory.
The number of atoms in the molecule must match that of the trajectory.
Parameters
----------
mol : Molecule
Molecule object to be added
Returns
-------
None
Added to Trajectory object. | angstrom/trajectory/trajectory.py | append | kbsezginel/angstrom | python | def append(self, mol):
'\n Append molecule to trajectory.\n The number of atoms in the molecule must match that of the trajectory.\n\n Parameters\n ----------\n mol : Molecule\n Molecule object to be added\n\n Returns\n -------\n None\n A... |
def read(self, filename):
"\n Read xyz formatted trajectory file.\n\n Parameters\n ----------\n filename : str\n Trajectory file name.\n\n Returns\n -------\n None\n Assigns 'coordinates', 'atoms', and 'headers' attributes.\n\n "
self... | -9,214,895,155,869,046,000 | Read xyz formatted trajectory file.
Parameters
----------
filename : str
Trajectory file name.
Returns
-------
None
Assigns 'coordinates', 'atoms', and 'headers' attributes. | angstrom/trajectory/trajectory.py | read | kbsezginel/angstrom | python | def read(self, filename):
"\n Read xyz formatted trajectory file.\n\n Parameters\n ----------\n filename : str\n Trajectory file name.\n\n Returns\n -------\n None\n Assigns 'coordinates', 'atoms', and 'headers' attributes.\n\n "
self... |
def write(self, filename):
'\n Write xyz formatted trajectory file.\n\n Parameters\n ----------\n filename : str\n Trajectory file name (formats: xyz).\n\n Returns\n -------\n None\n Writes molecule information to given file name.\n\n '
... | -412,128,814,471,408,600 | Write xyz formatted trajectory file.
Parameters
----------
filename : str
Trajectory file name (formats: xyz).
Returns
-------
None
Writes molecule information to given file name. | angstrom/trajectory/trajectory.py | write | kbsezginel/angstrom | python | def write(self, filename):
'\n Write xyz formatted trajectory file.\n\n Parameters\n ----------\n filename : str\n Trajectory file name (formats: xyz).\n\n Returns\n -------\n None\n Writes molecule information to given file name.\n\n '
... |
def get_center(self, mass=True):
'\n Get coordinates of molecule center at each frame.\n\n Parameters\n ----------\n mass : bool\n Calculate center of mass (True) or geometric center (False).\n\n Returns\n -------\n ndarray\n Molecule center coo... | -114,730,489,028,035,970 | Get coordinates of molecule center at each frame.
Parameters
----------
mass : bool
Calculate center of mass (True) or geometric center (False).
Returns
-------
ndarray
Molecule center coordinates for each frame. | angstrom/trajectory/trajectory.py | get_center | kbsezginel/angstrom | python | def get_center(self, mass=True):
'\n Get coordinates of molecule center at each frame.\n\n Parameters\n ----------\n mass : bool\n Calculate center of mass (True) or geometric center (False).\n\n Returns\n -------\n ndarray\n Molecule center coo... |
def main():
'\n Main entry point for the script.\n '
movie_list = get_movie_list('src/data/movies.json')
fresh_tomatoes.open_movies_page(movie_list) | -4,412,794,696,642,767,000 | Main entry point for the script. | src/entertainment_center.py | main | golgistudio/udacity-movie-trailer | python | def main():
'\n \n '
movie_list = get_movie_list('src/data/movies.json')
fresh_tomatoes.open_movies_page(movie_list) |
def testInit(self):
'Testing initialization from valid units'
d = Distance(m=100)
self.assertEqual(d.m, 100)
(d1, d2, d3) = (D(m=100), D(meter=100), D(metre=100))
for d in (d1, d2, d3):
self.assertEqual(d.m, 100)
d = D(nm=100)
self.assertEqual(d.m, 185200)
(y1, y2, y3) = (D(yd=10... | -939,912,387,337,035,100 | Testing initialization from valid units | tests/gis_tests/test_measure.py | testInit | iMerica/dj-models | python | def testInit(self):
d = Distance(m=100)
self.assertEqual(d.m, 100)
(d1, d2, d3) = (D(m=100), D(meter=100), D(metre=100))
for d in (d1, d2, d3):
self.assertEqual(d.m, 100)
d = D(nm=100)
self.assertEqual(d.m, 185200)
(y1, y2, y3) = (D(yd=100), D(yard=100), D(Yard=100))
for d i... |
def testInitInvalid(self):
'Testing initialization from invalid units'
with self.assertRaises(AttributeError):
D(banana=100) | 6,802,256,834,421,843,000 | Testing initialization from invalid units | tests/gis_tests/test_measure.py | testInitInvalid | iMerica/dj-models | python | def testInitInvalid(self):
with self.assertRaises(AttributeError):
D(banana=100) |
def testAccess(self):
'Testing access in different units'
d = D(m=100)
self.assertEqual(d.km, 0.1)
self.assertAlmostEqual(d.ft, 328.084, 3) | 8,387,798,650,130,048,000 | Testing access in different units | tests/gis_tests/test_measure.py | testAccess | iMerica/dj-models | python | def testAccess(self):
d = D(m=100)
self.assertEqual(d.km, 0.1)
self.assertAlmostEqual(d.ft, 328.084, 3) |
def testAccessInvalid(self):
'Testing access in invalid units'
d = D(m=100)
self.assertFalse(hasattr(d, 'banana')) | 8,163,053,566,261,297,000 | Testing access in invalid units | tests/gis_tests/test_measure.py | testAccessInvalid | iMerica/dj-models | python | def testAccessInvalid(self):
d = D(m=100)
self.assertFalse(hasattr(d, 'banana')) |
def testAddition(self):
'Test addition & subtraction'
d1 = D(m=100)
d2 = D(m=200)
d3 = (d1 + d2)
self.assertEqual(d3.m, 300)
d3 += d1
self.assertEqual(d3.m, 400)
d4 = (d1 - d2)
self.assertEqual(d4.m, (- 100))
d4 -= d1
self.assertEqual(d4.m, (- 200))
with self.assertRaises... | -696,819,538,585,398,100 | Test addition & subtraction | tests/gis_tests/test_measure.py | testAddition | iMerica/dj-models | python | def testAddition(self):
d1 = D(m=100)
d2 = D(m=200)
d3 = (d1 + d2)
self.assertEqual(d3.m, 300)
d3 += d1
self.assertEqual(d3.m, 400)
d4 = (d1 - d2)
self.assertEqual(d4.m, (- 100))
d4 -= d1
self.assertEqual(d4.m, (- 200))
with self.assertRaises(TypeError):
(d1 + 1)... |
def testMultiplication(self):
'Test multiplication & division'
d1 = D(m=100)
d3 = (d1 * 2)
self.assertEqual(d3.m, 200)
d3 = (2 * d1)
self.assertEqual(d3.m, 200)
d3 *= 5
self.assertEqual(d3.m, 1000)
d4 = (d1 / 2)
self.assertEqual(d4.m, 50)
d4 /= 5
self.assertEqual(d4.m, 10... | 4,051,457,820,995,021,000 | Test multiplication & division | tests/gis_tests/test_measure.py | testMultiplication | iMerica/dj-models | python | def testMultiplication(self):
d1 = D(m=100)
d3 = (d1 * 2)
self.assertEqual(d3.m, 200)
d3 = (2 * d1)
self.assertEqual(d3.m, 200)
d3 *= 5
self.assertEqual(d3.m, 1000)
d4 = (d1 / 2)
self.assertEqual(d4.m, 50)
d4 /= 5
self.assertEqual(d4.m, 10)
d5 = (d1 / D(m=2))
sel... |
def testUnitConversions(self):
'Testing default units during maths'
d1 = D(m=100)
d2 = D(km=1)
d3 = (d1 + d2)
self.assertEqual(d3._default_unit, 'm')
d4 = (d2 + d1)
self.assertEqual(d4._default_unit, 'km')
d5 = (d1 * 2)
self.assertEqual(d5._default_unit, 'm')
d6 = (d1 / 2)
se... | 1,915,829,929,822,303,200 | Testing default units during maths | tests/gis_tests/test_measure.py | testUnitConversions | iMerica/dj-models | python | def testUnitConversions(self):
d1 = D(m=100)
d2 = D(km=1)
d3 = (d1 + d2)
self.assertEqual(d3._default_unit, 'm')
d4 = (d2 + d1)
self.assertEqual(d4._default_unit, 'km')
d5 = (d1 * 2)
self.assertEqual(d5._default_unit, 'm')
d6 = (d1 / 2)
self.assertEqual(d6._default_unit, 'm'... |
def testComparisons(self):
'Testing comparisons'
d1 = D(m=100)
d2 = D(km=1)
d3 = D(km=0)
self.assertGreater(d2, d1)
self.assertEqual(d1, d1)
self.assertLess(d1, d2)
self.assertFalse(d3) | 6,504,463,429,873,153,000 | Testing comparisons | tests/gis_tests/test_measure.py | testComparisons | iMerica/dj-models | python | def testComparisons(self):
d1 = D(m=100)
d2 = D(km=1)
d3 = D(km=0)
self.assertGreater(d2, d1)
self.assertEqual(d1, d1)
self.assertLess(d1, d2)
self.assertFalse(d3) |
def testUnitsStr(self):
'Testing conversion to strings'
d1 = D(m=100)
d2 = D(km=3.5)
self.assertEqual(str(d1), '100.0 m')
self.assertEqual(str(d2), '3.5 km')
self.assertEqual(repr(d1), 'Distance(m=100.0)')
self.assertEqual(repr(d2), 'Distance(km=3.5)') | 5,147,494,180,421,207,000 | Testing conversion to strings | tests/gis_tests/test_measure.py | testUnitsStr | iMerica/dj-models | python | def testUnitsStr(self):
d1 = D(m=100)
d2 = D(km=3.5)
self.assertEqual(str(d1), '100.0 m')
self.assertEqual(str(d2), '3.5 km')
self.assertEqual(repr(d1), 'Distance(m=100.0)')
self.assertEqual(repr(d2), 'Distance(km=3.5)') |
def testUnitAttName(self):
'Testing the `unit_attname` class method'
unit_tuple = [('Yard', 'yd'), ('Nautical Mile', 'nm'), ('German legal metre', 'german_m'), ('Indian yard', 'indian_yd'), ('Chain (Sears)', 'chain_sears'), ('Chain', 'chain')]
for (nm, att) in unit_tuple:
with self.subTest(nm=nm):
... | 6,803,828,265,511,653,000 | Testing the `unit_attname` class method | tests/gis_tests/test_measure.py | testUnitAttName | iMerica/dj-models | python | def testUnitAttName(self):
unit_tuple = [('Yard', 'yd'), ('Nautical Mile', 'nm'), ('German legal metre', 'german_m'), ('Indian yard', 'indian_yd'), ('Chain (Sears)', 'chain_sears'), ('Chain', 'chain')]
for (nm, att) in unit_tuple:
with self.subTest(nm=nm):
self.assertEqual(att, D.unit_a... |
def testInit(self):
'Testing initialization from valid units'
a = Area(sq_m=100)
self.assertEqual(a.sq_m, 100)
a = A(sq_m=100)
self.assertEqual(a.sq_m, 100)
a = A(sq_mi=100)
self.assertEqual(a.sq_m, 258998811.0336) | -5,344,861,859,352,767,000 | Testing initialization from valid units | tests/gis_tests/test_measure.py | testInit | iMerica/dj-models | python | def testInit(self):
a = Area(sq_m=100)
self.assertEqual(a.sq_m, 100)
a = A(sq_m=100)
self.assertEqual(a.sq_m, 100)
a = A(sq_mi=100)
self.assertEqual(a.sq_m, 258998811.0336) |
def testInitInvaliA(self):
'Testing initialization from invalid units'
with self.assertRaises(AttributeError):
A(banana=100) | -8,369,222,064,090,536,000 | Testing initialization from invalid units | tests/gis_tests/test_measure.py | testInitInvaliA | iMerica/dj-models | python | def testInitInvaliA(self):
with self.assertRaises(AttributeError):
A(banana=100) |
def testAccess(self):
'Testing access in different units'
a = A(sq_m=100)
self.assertEqual(a.sq_km, 0.0001)
self.assertAlmostEqual(a.sq_ft, 1076.391, 3) | 1,555,348,347,969,236,700 | Testing access in different units | tests/gis_tests/test_measure.py | testAccess | iMerica/dj-models | python | def testAccess(self):
a = A(sq_m=100)
self.assertEqual(a.sq_km, 0.0001)
self.assertAlmostEqual(a.sq_ft, 1076.391, 3) |
def testAccessInvaliA(self):
'Testing access in invalid units'
a = A(sq_m=100)
self.assertFalse(hasattr(a, 'banana')) | -4,501,221,602,945,441,000 | Testing access in invalid units | tests/gis_tests/test_measure.py | testAccessInvaliA | iMerica/dj-models | python | def testAccessInvaliA(self):
a = A(sq_m=100)
self.assertFalse(hasattr(a, 'banana')) |
def testAddition(self):
'Test addition & subtraction'
a1 = A(sq_m=100)
a2 = A(sq_m=200)
a3 = (a1 + a2)
self.assertEqual(a3.sq_m, 300)
a3 += a1
self.assertEqual(a3.sq_m, 400)
a4 = (a1 - a2)
self.assertEqual(a4.sq_m, (- 100))
a4 -= a1
self.assertEqual(a4.sq_m, (- 200))
with... | 2,796,483,916,572,844,000 | Test addition & subtraction | tests/gis_tests/test_measure.py | testAddition | iMerica/dj-models | python | def testAddition(self):
a1 = A(sq_m=100)
a2 = A(sq_m=200)
a3 = (a1 + a2)
self.assertEqual(a3.sq_m, 300)
a3 += a1
self.assertEqual(a3.sq_m, 400)
a4 = (a1 - a2)
self.assertEqual(a4.sq_m, (- 100))
a4 -= a1
self.assertEqual(a4.sq_m, (- 200))
with self.assertRaises(TypeError)... |
def testMultiplication(self):
'Test multiplication & division'
a1 = A(sq_m=100)
a3 = (a1 * 2)
self.assertEqual(a3.sq_m, 200)
a3 = (2 * a1)
self.assertEqual(a3.sq_m, 200)
a3 *= 5
self.assertEqual(a3.sq_m, 1000)
a4 = (a1 / 2)
self.assertEqual(a4.sq_m, 50)
a4 /= 5
self.asser... | 1,916,095,202,108,542,500 | Test multiplication & division | tests/gis_tests/test_measure.py | testMultiplication | iMerica/dj-models | python | def testMultiplication(self):
a1 = A(sq_m=100)
a3 = (a1 * 2)
self.assertEqual(a3.sq_m, 200)
a3 = (2 * a1)
self.assertEqual(a3.sq_m, 200)
a3 *= 5
self.assertEqual(a3.sq_m, 1000)
a4 = (a1 / 2)
self.assertEqual(a4.sq_m, 50)
a4 /= 5
self.assertEqual(a4.sq_m, 10)
with sel... |
def testUnitConversions(self):
'Testing default units during maths'
a1 = A(sq_m=100)
a2 = A(sq_km=1)
a3 = (a1 + a2)
self.assertEqual(a3._default_unit, 'sq_m')
a4 = (a2 + a1)
self.assertEqual(a4._default_unit, 'sq_km')
a5 = (a1 * 2)
self.assertEqual(a5._default_unit, 'sq_m')
a6 = ... | 5,208,338,653,270,393,000 | Testing default units during maths | tests/gis_tests/test_measure.py | testUnitConversions | iMerica/dj-models | python | def testUnitConversions(self):
a1 = A(sq_m=100)
a2 = A(sq_km=1)
a3 = (a1 + a2)
self.assertEqual(a3._default_unit, 'sq_m')
a4 = (a2 + a1)
self.assertEqual(a4._default_unit, 'sq_km')
a5 = (a1 * 2)
self.assertEqual(a5._default_unit, 'sq_m')
a6 = (a1 / 2)
self.assertEqual(a6._de... |
def testComparisons(self):
'Testing comparisons'
a1 = A(sq_m=100)
a2 = A(sq_km=1)
a3 = A(sq_km=0)
self.assertGreater(a2, a1)
self.assertEqual(a1, a1)
self.assertLess(a1, a2)
self.assertFalse(a3) | -1,874,166,189,157,217,500 | Testing comparisons | tests/gis_tests/test_measure.py | testComparisons | iMerica/dj-models | python | def testComparisons(self):
a1 = A(sq_m=100)
a2 = A(sq_km=1)
a3 = A(sq_km=0)
self.assertGreater(a2, a1)
self.assertEqual(a1, a1)
self.assertLess(a1, a2)
self.assertFalse(a3) |
def testUnitsStr(self):
'Testing conversion to strings'
a1 = A(sq_m=100)
a2 = A(sq_km=3.5)
self.assertEqual(str(a1), '100.0 sq_m')
self.assertEqual(str(a2), '3.5 sq_km')
self.assertEqual(repr(a1), 'Area(sq_m=100.0)')
self.assertEqual(repr(a2), 'Area(sq_km=3.5)') | 7,429,780,586,714,596,000 | Testing conversion to strings | tests/gis_tests/test_measure.py | testUnitsStr | iMerica/dj-models | python | def testUnitsStr(self):
a1 = A(sq_m=100)
a2 = A(sq_km=3.5)
self.assertEqual(str(a1), '100.0 sq_m')
self.assertEqual(str(a2), '3.5 sq_km')
self.assertEqual(repr(a1), 'Area(sq_m=100.0)')
self.assertEqual(repr(a2), 'Area(sq_km=3.5)') |
def get_pref(prefs, name, request_fn):
'Get a preference from existing preference dictionary or invoke a function that can collect it from the user'
val = prefs.get(name)
if (not val):
val = request_fn()
prefs[name] = val
return val | 3,936,301,530,224,665,000 | Get a preference from existing preference dictionary or invoke a function that can collect it from the user | release.py | get_pref | SharaWeil/kafka-0.11.0 | python | def get_pref(prefs, name, request_fn):
val = prefs.get(name)
if (not val):
val = request_fn()
prefs[name] = val
return val |
def get_icon_name(category, artifact):
' Returns the icon name from the feathericons collection. To add an icon type for \n an artifact, select one of the types from ones listed @ feathericons.com\n If no icon is available, the alert triangle is returned as default icon.\n '
category = category... | 889,248,293,334,245,900 | Returns the icon name from the feathericons collection. To add an icon type for
an artifact, select one of the types from ones listed @ feathericons.com
If no icon is available, the alert triangle is returned as default icon. | scripts/report.py | get_icon_name | theAtropos4n6/iLEAPP | python | def get_icon_name(category, artifact):
' Returns the icon name from the feathericons collection. To add an icon type for \n an artifact, select one of the types from ones listed @ feathericons.com\n If no icon is available, the alert triangle is returned as default icon.\n '
category = category... |
def create_index_html(reportfolderbase, time_in_secs, time_HMS, extraction_type, image_input_path, nav_list_data):
'Write out the index.html page to the report folder'
content = '<br />'
content += '\n <div class="card bg-white" style="padding: 20px;">\n <h2 class="card-title">Case Information</h2... | 526,606,604,849,340,740 | Write out the index.html page to the report folder | scripts/report.py | create_index_html | theAtropos4n6/iLEAPP | python | def create_index_html(reportfolderbase, time_in_secs, time_HMS, extraction_type, image_input_path, nav_list_data):
content = '<br />'
content += '\n <div class="card bg-white" style="padding: 20px;">\n <h2 class="card-title">Case Information</h2>\n '
case_list = [['Extraction location', im... |
def generate_key_val_table_without_headings(title, data_list, html_escape=True, width='70%'):
'Returns the html code for a key-value table (2 cols) without col names'
code = ''
if title:
code += f'<h2>{title}</h2>'
table_header_code = '\n <div class="table-responsive">\n <table... | -2,558,255,663,354,864,600 | Returns the html code for a key-value table (2 cols) without col names | scripts/report.py | generate_key_val_table_without_headings | theAtropos4n6/iLEAPP | python | def generate_key_val_table_without_headings(title, data_list, html_escape=True, width='70%'):
code =
if title:
code += f'<h2>{title}</h2>'
table_header_code = '\n <div class="table-responsive">\n <table class="table table-bordered table-hover table-sm" width={}>\n ... |
def mark_item_active(data, itemname):
'Finds itemname in data, then marks that node as active. Return value is changed data'
pos = data.find(f'" href="{itemname}"')
if (pos < 0):
logfunc(f'Error, could not find {itemname} in {data}')
return data
else:
ret = ((data[0:pos] + ' acti... | 8,354,774,601,941,152,000 | Finds itemname in data, then marks that node as active. Return value is changed data | scripts/report.py | mark_item_active | theAtropos4n6/iLEAPP | python | def mark_item_active(data, itemname):
pos = data.find(f'" href="{itemname}"')
if (pos < 0):
logfunc(f'Error, could not find {itemname} in {data}')
return data
else:
ret = ((data[0:pos] + ' active') + data[pos:])
return ret |
@register.filter
def markdown_to_html(text):
'マークダウンをhtmlに変換する。'
return mark_safe(markdownify(text)) | 7,837,217,836,842,435,000 | マークダウンをhtmlに変換する。 | blog/templatetags/markdown_html.py | markdown_to_html | whitecat-22/blog_site | python | @register.filter
def markdown_to_html(text):
return mark_safe(markdownify(text)) |
@register.filter
def markdown_to_html_with_escape(text):
'マークダウンをhtmlに変換する。\n\n 生のHTMLやCSS、JavaScript等のコードをエスケープした上で、マークダウンをHTMLに変換します。\n 公開しているコメント欄等には、こちらを使ってください。\n\n '
extensions = (MARKDOWNX_MARKDOWN_EXTENSIONS + [EscapeHtml()])
html = markdown.markdown(text, extensions=extensions, extension_c... | -4,383,165,759,974,250,500 | マークダウンをhtmlに変換する。
生のHTMLやCSS、JavaScript等のコードをエスケープした上で、マークダウンをHTMLに変換します。
公開しているコメント欄等には、こちらを使ってください。 | blog/templatetags/markdown_html.py | markdown_to_html_with_escape | whitecat-22/blog_site | python | @register.filter
def markdown_to_html_with_escape(text):
'マークダウンをhtmlに変換する。\n\n 生のHTMLやCSS、JavaScript等のコードをエスケープした上で、マークダウンをHTMLに変換します。\n 公開しているコメント欄等には、こちらを使ってください。\n\n '
extensions = (MARKDOWNX_MARKDOWN_EXTENSIONS + [EscapeHtml()])
html = markdown.markdown(text, extensions=extensions, extension_c... |
def cursor_iter(cursor, sentinel, col_count):
'\n Yields blocks of rows from a cursor and ensures the cursor is closed when\n done.\n '
try:
for rows in iter((lambda : cursor.fetchmany(GET_ITERATOR_CHUNK_SIZE)), sentinel):
(yield [r[0:col_count] for r in rows])
finally:
... | 442,839,228,491,569,100 | Yields blocks of rows from a cursor and ensures the cursor is closed when
done. | django/db/models/sql/compiler.py | cursor_iter | hottwaj/django | python | def cursor_iter(cursor, sentinel, col_count):
'\n Yields blocks of rows from a cursor and ensures the cursor is closed when\n done.\n '
try:
for rows in iter((lambda : cursor.fetchmany(GET_ITERATOR_CHUNK_SIZE)), sentinel):
(yield [r[0:col_count] for r in rows])
finally:
... |
def pre_sql_setup(self):
"\n Does any necessary class setup immediately prior to producing SQL. This\n is for things that can't necessarily be done in __init__ because we\n might not have all the pieces in place at that time.\n "
self.setup_query()
order_by = self.get_order_by()
... | -5,332,599,130,163,166,000 | Does any necessary class setup immediately prior to producing SQL. This
is for things that can't necessarily be done in __init__ because we
might not have all the pieces in place at that time. | django/db/models/sql/compiler.py | pre_sql_setup | hottwaj/django | python | def pre_sql_setup(self):
"\n Does any necessary class setup immediately prior to producing SQL. This\n is for things that can't necessarily be done in __init__ because we\n might not have all the pieces in place at that time.\n "
self.setup_query()
order_by = self.get_order_by()
... |
def get_group_by(self, select, order_by):
'\n Returns a list of 2-tuples of form (sql, params).\n\n The logic of what exactly the GROUP BY clause contains is hard\n to describe in other words than "if it passes the test suite,\n then it is correct".\n '
if (self.query.group_by... | -1,263,401,982,640,389,000 | Returns a list of 2-tuples of form (sql, params).
The logic of what exactly the GROUP BY clause contains is hard
to describe in other words than "if it passes the test suite,
then it is correct". | django/db/models/sql/compiler.py | get_group_by | hottwaj/django | python | def get_group_by(self, select, order_by):
'\n Returns a list of 2-tuples of form (sql, params).\n\n The logic of what exactly the GROUP BY clause contains is hard\n to describe in other words than "if it passes the test suite,\n then it is correct".\n '
if (self.query.group_by... |
def get_select(self):
'\n Returns three values:\n - a list of 3-tuples of (expression, (sql, params), alias)\n - a klass_info structure,\n - a dictionary of annotations\n\n The (sql, params) is what the expression will produce, and alias is the\n "AS alias" for the column (... | -421,693,087,299,432,060 | Returns three values:
- a list of 3-tuples of (expression, (sql, params), alias)
- a klass_info structure,
- a dictionary of annotations
The (sql, params) is what the expression will produce, and alias is the
"AS alias" for the column (possibly None).
The klass_info structure contains the following information:
- Whi... | django/db/models/sql/compiler.py | get_select | hottwaj/django | python | def get_select(self):
'\n Returns three values:\n - a list of 3-tuples of (expression, (sql, params), alias)\n - a klass_info structure,\n - a dictionary of annotations\n\n The (sql, params) is what the expression will produce, and alias is the\n "AS alias" for the column (... |
def get_order_by(self):
'\n Returns a list of 2-tuples of form (expr, (sql, params, is_ref)) for the\n ORDER BY clause.\n\n The order_by clause can alter the select clause (for example it\n can add aliases to clauses that do not yet have one, or it can\n add totally new select cla... | -882,710,292,227,771,400 | Returns a list of 2-tuples of form (expr, (sql, params, is_ref)) for the
ORDER BY clause.
The order_by clause can alter the select clause (for example it
can add aliases to clauses that do not yet have one, or it can
add totally new select clauses). | django/db/models/sql/compiler.py | get_order_by | hottwaj/django | python | def get_order_by(self):
'\n Returns a list of 2-tuples of form (expr, (sql, params, is_ref)) for the\n ORDER BY clause.\n\n The order_by clause can alter the select clause (for example it\n can add aliases to clauses that do not yet have one, or it can\n add totally new select cla... |
def quote_name_unless_alias(self, name):
"\n A wrapper around connection.ops.quote_name that doesn't quote aliases\n for table names. This avoids problems with some SQL dialects that treat\n quoted strings specially (e.g. PostgreSQL).\n "
if (name in self.quote_cache):
return... | -1,623,040,495,631,383,600 | A wrapper around connection.ops.quote_name that doesn't quote aliases
for table names. This avoids problems with some SQL dialects that treat
quoted strings specially (e.g. PostgreSQL). | django/db/models/sql/compiler.py | quote_name_unless_alias | hottwaj/django | python | def quote_name_unless_alias(self, name):
"\n A wrapper around connection.ops.quote_name that doesn't quote aliases\n for table names. This avoids problems with some SQL dialects that treat\n quoted strings specially (e.g. PostgreSQL).\n "
if (name in self.quote_cache):
return... |
def as_sql(self, with_limits=True, with_col_aliases=False, subquery=False):
"\n Creates the SQL for this query. Returns the SQL string and list of\n parameters.\n\n If 'with_limits' is False, any limit/offset information is not included\n in the query.\n "
if (with_limits and ... | -2,196,786,343,217,834,000 | Creates the SQL for this query. Returns the SQL string and list of
parameters.
If 'with_limits' is False, any limit/offset information is not included
in the query. | django/db/models/sql/compiler.py | as_sql | hottwaj/django | python | def as_sql(self, with_limits=True, with_col_aliases=False, subquery=False):
"\n Creates the SQL for this query. Returns the SQL string and list of\n parameters.\n\n If 'with_limits' is False, any limit/offset information is not included\n in the query.\n "
if (with_limits and ... |
def as_nested_sql(self):
"\n Perform the same functionality as the as_sql() method, returning an\n SQL string and parameters. However, the alias prefixes are bumped\n beforehand (in a copy -- the current query isn't changed), and any\n ordering is removed if the query is unsliced.\n\n ... | 4,420,097,920,054,420,500 | Perform the same functionality as the as_sql() method, returning an
SQL string and parameters. However, the alias prefixes are bumped
beforehand (in a copy -- the current query isn't changed), and any
ordering is removed if the query is unsliced.
Used when nesting this query inside another. | django/db/models/sql/compiler.py | as_nested_sql | hottwaj/django | python | def as_nested_sql(self):
"\n Perform the same functionality as the as_sql() method, returning an\n SQL string and parameters. However, the alias prefixes are bumped\n beforehand (in a copy -- the current query isn't changed), and any\n ordering is removed if the query is unsliced.\n\n ... |
def get_default_columns(self, start_alias=None, opts=None, from_parent=None):
'\n Computes the default columns for selecting every field in the base\n model. Will sometimes be called to pull in related models (e.g. via\n select_related), in which case "opts" and "start_alias" will be given\n ... | -1,544,447,054,007,162,000 | Computes the default columns for selecting every field in the base
model. Will sometimes be called to pull in related models (e.g. via
select_related), in which case "opts" and "start_alias" will be given
to provide a starting point for the traversal.
Returns a list of strings, quoted appropriately for use in SQL
dire... | django/db/models/sql/compiler.py | get_default_columns | hottwaj/django | python | def get_default_columns(self, start_alias=None, opts=None, from_parent=None):
'\n Computes the default columns for selecting every field in the base\n model. Will sometimes be called to pull in related models (e.g. via\n select_related), in which case "opts" and "start_alias" will be given\n ... |
def get_distinct(self):
'\n Returns a quoted list of fields to use in DISTINCT ON part of the query.\n\n Note that this method can alter the tables in the query, and thus it\n must be called before get_from_clause().\n '
qn = self.quote_name_unless_alias
qn2 = self.connection.ops... | 7,028,599,802,511,206,000 | Returns a quoted list of fields to use in DISTINCT ON part of the query.
Note that this method can alter the tables in the query, and thus it
must be called before get_from_clause(). | django/db/models/sql/compiler.py | get_distinct | hottwaj/django | python | def get_distinct(self):
'\n Returns a quoted list of fields to use in DISTINCT ON part of the query.\n\n Note that this method can alter the tables in the query, and thus it\n must be called before get_from_clause().\n '
qn = self.quote_name_unless_alias
qn2 = self.connection.ops... |
def find_ordering_name(self, name, opts, alias=None, default_order='ASC', already_seen=None):
"\n Returns the table alias (the name might be ambiguous, the alias will\n not be) and column name for ordering by the given 'name' parameter.\n The 'name' is of the form 'field1__field2__...__fieldN'.... | 5,748,303,804,264,708,000 | Returns the table alias (the name might be ambiguous, the alias will
not be) and column name for ordering by the given 'name' parameter.
The 'name' is of the form 'field1__field2__...__fieldN'. | django/db/models/sql/compiler.py | find_ordering_name | hottwaj/django | python | def find_ordering_name(self, name, opts, alias=None, default_order='ASC', already_seen=None):
"\n Returns the table alias (the name might be ambiguous, the alias will\n not be) and column name for ordering by the given 'name' parameter.\n The 'name' is of the form 'field1__field2__...__fieldN'.... |
def _setup_joins(self, pieces, opts, alias):
'\n A helper method for get_order_by and get_distinct.\n\n Note that get_ordering and get_distinct must produce same target\n columns on same input, as the prefixes of get_ordering and get_distinct\n must match. Executing SQL where this is not... | -8,333,750,037,689,660,000 | A helper method for get_order_by and get_distinct.
Note that get_ordering and get_distinct must produce same target
columns on same input, as the prefixes of get_ordering and get_distinct
must match. Executing SQL where this is not true is an error. | django/db/models/sql/compiler.py | _setup_joins | hottwaj/django | python | def _setup_joins(self, pieces, opts, alias):
'\n A helper method for get_order_by and get_distinct.\n\n Note that get_ordering and get_distinct must produce same target\n columns on same input, as the prefixes of get_ordering and get_distinct\n must match. Executing SQL where this is not... |
def get_from_clause(self):
'\n Returns a list of strings that are joined together to go after the\n "FROM" part of the query, as well as a list any extra parameters that\n need to be included. Sub-classes, can override this to create a\n from-clause via a "select".\n\n This should... | -6,299,220,823,378,438,000 | Returns a list of strings that are joined together to go after the
"FROM" part of the query, as well as a list any extra parameters that
need to be included. Sub-classes, can override this to create a
from-clause via a "select".
This should only be called after any SQL construction methods that
might change the tables... | django/db/models/sql/compiler.py | get_from_clause | hottwaj/django | python | def get_from_clause(self):
'\n Returns a list of strings that are joined together to go after the\n "FROM" part of the query, as well as a list any extra parameters that\n need to be included. Sub-classes, can override this to create a\n from-clause via a "select".\n\n This should... |
def get_related_selections(self, select, opts=None, root_alias=None, cur_depth=1, requested=None, restricted=None):
'\n Fill in the information needed for a select_related query. The current\n depth is measured as the number of connections away from the root model\n (for example, cur_depth=1 me... | 5,857,042,856,470,152,000 | Fill in the information needed for a select_related query. The current
depth is measured as the number of connections away from the root model
(for example, cur_depth=1 means we are looking at models with direct
connections to the root model). | django/db/models/sql/compiler.py | get_related_selections | hottwaj/django | python | def get_related_selections(self, select, opts=None, root_alias=None, cur_depth=1, requested=None, restricted=None):
'\n Fill in the information needed for a select_related query. The current\n depth is measured as the number of connections away from the root model\n (for example, cur_depth=1 me... |
def deferred_to_columns(self):
'\n Converts the self.deferred_loading data structure to mapping of table\n names to sets of column names which are to be loaded. Returns the\n dictionary.\n '
columns = {}
self.query.deferred_to_data(columns, self.query.get_loaded_field_names_cb)
... | -7,688,170,534,660,855,000 | Converts the self.deferred_loading data structure to mapping of table
names to sets of column names which are to be loaded. Returns the
dictionary. | django/db/models/sql/compiler.py | deferred_to_columns | hottwaj/django | python | def deferred_to_columns(self):
'\n Converts the self.deferred_loading data structure to mapping of table\n names to sets of column names which are to be loaded. Returns the\n dictionary.\n '
columns = {}
self.query.deferred_to_data(columns, self.query.get_loaded_field_names_cb)
... |
def results_iter(self, results=None):
'\n Returns an iterator over the results from executing this query.\n '
converters = None
if (results is None):
results = self.execute_sql(MULTI)
fields = [s[0] for s in self.select[0:self.col_count]]
converters = self.get_converters(fields... | 3,676,796,479,780,158,000 | Returns an iterator over the results from executing this query. | django/db/models/sql/compiler.py | results_iter | hottwaj/django | python | def results_iter(self, results=None):
'\n \n '
converters = None
if (results is None):
results = self.execute_sql(MULTI)
fields = [s[0] for s in self.select[0:self.col_count]]
converters = self.get_converters(fields)
for rows in results:
for row in rows:
... |
def has_results(self):
'\n Backends (e.g. NoSQL) can override this in order to use optimized\n versions of "query has any results."\n '
self.query.add_extra({'a': 1}, None, None, None, None, None)
self.query.set_extra_mask(['a'])
return bool(self.execute_sql(SINGLE)) | -878,524,087,765,658,400 | Backends (e.g. NoSQL) can override this in order to use optimized
versions of "query has any results." | django/db/models/sql/compiler.py | has_results | hottwaj/django | python | def has_results(self):
'\n Backends (e.g. NoSQL) can override this in order to use optimized\n versions of "query has any results."\n '
self.query.add_extra({'a': 1}, None, None, None, None, None)
self.query.set_extra_mask(['a'])
return bool(self.execute_sql(SINGLE)) |
def execute_sql(self, result_type=MULTI):
"\n Run the query against the database and returns the result(s). The\n return value is a single data item if result_type is SINGLE, or an\n iterator over the results if the result_type is MULTI.\n\n result_type is either MULTI (use fetchmany() t... | 1,245,196,509,513,170,400 | Run the query against the database and returns the result(s). The
return value is a single data item if result_type is SINGLE, or an
iterator over the results if the result_type is MULTI.
result_type is either MULTI (use fetchmany() to retrieve all rows),
SINGLE (only retrieve a single row), or None. In this last case... | django/db/models/sql/compiler.py | execute_sql | hottwaj/django | python | def execute_sql(self, result_type=MULTI):
"\n Run the query against the database and returns the result(s). The\n return value is a single data item if result_type is SINGLE, or an\n iterator over the results if the result_type is MULTI.\n\n result_type is either MULTI (use fetchmany() t... |
def field_as_sql(self, field, val):
'\n Take a field and a value intended to be saved on that field, and\n return placeholder SQL and accompanying params. Checks for raw values,\n expressions and fields with get_placeholder() defined in that order.\n\n When field is None, the value is co... | -1,086,004,953,535,969,000 | Take a field and a value intended to be saved on that field, and
return placeholder SQL and accompanying params. Checks for raw values,
expressions and fields with get_placeholder() defined in that order.
When field is None, the value is considered raw and is used as the
placeholder, with no corresponding parameters r... | django/db/models/sql/compiler.py | field_as_sql | hottwaj/django | python | def field_as_sql(self, field, val):
'\n Take a field and a value intended to be saved on that field, and\n return placeholder SQL and accompanying params. Checks for raw values,\n expressions and fields with get_placeholder() defined in that order.\n\n When field is None, the value is co... |
def prepare_value(self, field, value):
"\n Prepare a value to be used in a query by resolving it if it is an\n expression and otherwise calling the field's get_db_prep_save().\n "
if hasattr(value, 'resolve_expression'):
value = value.resolve_expression(self.query, allow_joins=False... | 5,424,878,748,118,091,000 | Prepare a value to be used in a query by resolving it if it is an
expression and otherwise calling the field's get_db_prep_save(). | django/db/models/sql/compiler.py | prepare_value | hottwaj/django | python | def prepare_value(self, field, value):
"\n Prepare a value to be used in a query by resolving it if it is an\n expression and otherwise calling the field's get_db_prep_save().\n "
if hasattr(value, 'resolve_expression'):
value = value.resolve_expression(self.query, allow_joins=False... |
def pre_save_val(self, field, obj):
"\n Get the given field's value off the given obj. pre_save() is used for\n things like auto_now on DateTimeField. Skip it if this is a raw query.\n "
if self.query.raw:
return getattr(obj, field.attname)
return field.pre_save(obj, add=True) | -4,987,961,374,691,074,000 | Get the given field's value off the given obj. pre_save() is used for
things like auto_now on DateTimeField. Skip it if this is a raw query. | django/db/models/sql/compiler.py | pre_save_val | hottwaj/django | python | def pre_save_val(self, field, obj):
"\n Get the given field's value off the given obj. pre_save() is used for\n things like auto_now on DateTimeField. Skip it if this is a raw query.\n "
if self.query.raw:
return getattr(obj, field.attname)
return field.pre_save(obj, add=True) |
def assemble_as_sql(self, fields, value_rows):
"\n Take a sequence of N fields and a sequence of M rows of values,\n generate placeholder SQL and parameters for each field and value, and\n return a pair containing:\n * a sequence of M rows of N SQL placeholder strings, and\n * a... | -6,079,551,684,280,164,000 | Take a sequence of N fields and a sequence of M rows of values,
generate placeholder SQL and parameters for each field and value, and
return a pair containing:
* a sequence of M rows of N SQL placeholder strings, and
* a sequence of M rows of corresponding parameter values.
Each placeholder string may contain any nu... | django/db/models/sql/compiler.py | assemble_as_sql | hottwaj/django | python | def assemble_as_sql(self, fields, value_rows):
"\n Take a sequence of N fields and a sequence of M rows of values,\n generate placeholder SQL and parameters for each field and value, and\n return a pair containing:\n * a sequence of M rows of N SQL placeholder strings, and\n * a... |
def as_sql(self):
'\n Creates the SQL for this query. Returns the SQL string and list of\n parameters.\n '
assert (len([t for t in self.query.tables if (self.query.alias_refcount[t] > 0)]) == 1), 'Can only delete from one table at a time.'
qn = self.quote_name_unless_alias
result = ... | -8,388,625,242,359,966,000 | Creates the SQL for this query. Returns the SQL string and list of
parameters. | django/db/models/sql/compiler.py | as_sql | hottwaj/django | python | def as_sql(self):
'\n Creates the SQL for this query. Returns the SQL string and list of\n parameters.\n '
assert (len([t for t in self.query.tables if (self.query.alias_refcount[t] > 0)]) == 1), 'Can only delete from one table at a time.'
qn = self.quote_name_unless_alias
result = ... |
def as_sql(self):
'\n Creates the SQL for this query. Returns the SQL string and list of\n parameters.\n '
self.pre_sql_setup()
if (not self.query.values):
return ('', ())
table = self.query.tables[0]
qn = self.quote_name_unless_alias
result = [('UPDATE %s' % qn(tabl... | 1,968,413,504,332,736,500 | Creates the SQL for this query. Returns the SQL string and list of
parameters. | django/db/models/sql/compiler.py | as_sql | hottwaj/django | python | def as_sql(self):
'\n Creates the SQL for this query. Returns the SQL string and list of\n parameters.\n '
self.pre_sql_setup()
if (not self.query.values):
return (, ())
table = self.query.tables[0]
qn = self.quote_name_unless_alias
result = [('UPDATE %s' % qn(table)... |
def execute_sql(self, result_type):
'\n Execute the specified update. Returns the number of rows affected by\n the primary update query. The "primary update query" is the first\n non-empty query that is executed. Row counts for any subsequent,\n related queries are not available.\n ... | 5,114,767,702,504,362,000 | Execute the specified update. Returns the number of rows affected by
the primary update query. The "primary update query" is the first
non-empty query that is executed. Row counts for any subsequent,
related queries are not available. | django/db/models/sql/compiler.py | execute_sql | hottwaj/django | python | def execute_sql(self, result_type):
'\n Execute the specified update. Returns the number of rows affected by\n the primary update query. The "primary update query" is the first\n non-empty query that is executed. Row counts for any subsequent,\n related queries are not available.\n ... |
def pre_sql_setup(self):
'\n If the update depends on results from other tables, we need to do some\n munging of the "where" conditions to match the format required for\n (portable) SQL updates. That is done here.\n\n Further, if we are going to be running multiple updates, we pull out\n... | -1,691,562,841,568,250,000 | If the update depends on results from other tables, we need to do some
munging of the "where" conditions to match the format required for
(portable) SQL updates. That is done here.
Further, if we are going to be running multiple updates, we pull out
the id values to update at this point so that they don't change as a
... | django/db/models/sql/compiler.py | pre_sql_setup | hottwaj/django | python | def pre_sql_setup(self):
'\n If the update depends on results from other tables, we need to do some\n munging of the "where" conditions to match the format required for\n (portable) SQL updates. That is done here.\n\n Further, if we are going to be running multiple updates, we pull out\n... |
def as_sql(self):
'\n Creates the SQL for this query. Returns the SQL string and list of\n parameters.\n '
if (not self.query.subquery):
raise EmptyResultSet
(sql, params) = ([], [])
for annotation in self.query.annotation_select.values():
(ann_sql, ann_params) = sel... | -7,176,846,690,096,063,000 | Creates the SQL for this query. Returns the SQL string and list of
parameters. | django/db/models/sql/compiler.py | as_sql | hottwaj/django | python | def as_sql(self):
'\n Creates the SQL for this query. Returns the SQL string and list of\n parameters.\n '
if (not self.query.subquery):
raise EmptyResultSet
(sql, params) = ([], [])
for annotation in self.query.annotation_select.values():
(ann_sql, ann_params) = sel... |
def test_register():
'Just test that there is no crash'
plugin.register_plugins([feedback]) | 1,114,956,463,751,036,300 | Just test that there is no crash | tests/test_feedback.py | test_register | slarse/repobee-feedback | python | def test_register():
plugin.register_plugins([feedback]) |
@pytest.fixture
def with_issues(tmp_path):
'Create issue files in a temporary directory and return a list of (team,\n issue) tuples.\n '
repo_names = plug.generate_repo_names(STUDENT_TEAM_NAMES, ASSIGNMENT_NAMES)
existing_issues = []
for repo_name in repo_names:
issue_file = (tmp_path / '{... | 3,977,162,880,016,719,400 | Create issue files in a temporary directory and return a list of (team,
issue) tuples. | tests/test_feedback.py | with_issues | slarse/repobee-feedback | python | @pytest.fixture
def with_issues(tmp_path):
'Create issue files in a temporary directory and return a list of (team,\n issue) tuples.\n '
repo_names = plug.generate_repo_names(STUDENT_TEAM_NAMES, ASSIGNMENT_NAMES)
existing_issues = []
for repo_name in repo_names:
issue_file = (tmp_path / '{... |
@pytest.fixture
def with_multi_issues_file(tmp_path):
'Create the multi issues file.'
repo_names = plug.generate_repo_names(STUDENT_TEAM_NAMES, ASSIGNMENT_NAMES)
repos_and_issues = [(repo_name, random.choice(ISSUES)) for repo_name in repo_names]
issues_file = (tmp_path / 'issues.md')
_write_multi_is... | -4,134,705,189,988,907,500 | Create the multi issues file. | tests/test_feedback.py | with_multi_issues_file | slarse/repobee-feedback | python | @pytest.fixture
def with_multi_issues_file(tmp_path):
repo_names = plug.generate_repo_names(STUDENT_TEAM_NAMES, ASSIGNMENT_NAMES)
repos_and_issues = [(repo_name, random.choice(ISSUES)) for repo_name in repo_names]
issues_file = (tmp_path / 'issues.md')
_write_multi_issues_file(repos_and_issues, iss... |
def test_opens_issues_from_issues_dir(self, with_issues, parsed_args_issues_dir, api_mock):
'Test that the callback calls the API.open_issue for the expected\n repos and issues, when the issues all exist and are well formed.\n '
expected_calls = [mock.call(issue.title, issue.body, mock.ANY) for (r... | 2,710,277,438,403,715,000 | Test that the callback calls the API.open_issue for the expected
repos and issues, when the issues all exist and are well formed. | tests/test_feedback.py | test_opens_issues_from_issues_dir | slarse/repobee-feedback | python | def test_opens_issues_from_issues_dir(self, with_issues, parsed_args_issues_dir, api_mock):
'Test that the callback calls the API.open_issue for the expected\n repos and issues, when the issues all exist and are well formed.\n '
expected_calls = [mock.call(issue.title, issue.body, mock.ANY) for (r... |
def test_aborts_if_issue_is_missing(self, with_issues, parsed_args_issues_dir, api_mock, tmp_path):
'Test that the callback exits with a plug.PlugError if any of the\n expected issues is not found.\n '
repo_without_issue = plug.generate_repo_name(STUDENT_TEAM_NAMES[(- 1)], ASSIGNMENT_NAMES[0])
... | -8,800,887,472,667,265,000 | Test that the callback exits with a plug.PlugError if any of the
expected issues is not found. | tests/test_feedback.py | test_aborts_if_issue_is_missing | slarse/repobee-feedback | python | def test_aborts_if_issue_is_missing(self, with_issues, parsed_args_issues_dir, api_mock, tmp_path):
'Test that the callback exits with a plug.PlugError if any of the\n expected issues is not found.\n '
repo_without_issue = plug.generate_repo_name(STUDENT_TEAM_NAMES[(- 1)], ASSIGNMENT_NAMES[0])
... |
def test_ignores_missing_issue_if_allow_missing(self, with_issues, parsed_args_issues_dir, api_mock, tmp_path):
'Test that missing issues are ignored if --allow-mising is set.'
repo_without_issue = plug.generate_repo_name(STUDENT_TEAM_NAMES[(- 1)], ASSIGNMENT_NAMES[0])
(tmp_path / '{}.md'.format(repo_withou... | 607,823,310,561,474,000 | Test that missing issues are ignored if --allow-mising is set. | tests/test_feedback.py | test_ignores_missing_issue_if_allow_missing | slarse/repobee-feedback | python | def test_ignores_missing_issue_if_allow_missing(self, with_issues, parsed_args_issues_dir, api_mock, tmp_path):
repo_without_issue = plug.generate_repo_name(STUDENT_TEAM_NAMES[(- 1)], ASSIGNMENT_NAMES[0])
(tmp_path / '{}.md'.format(repo_without_issue)).unlink()
expected_calls = [mock.call(issue.title, ... |
def test_opens_nothing_if_open_prompt_returns_false(self, with_issues, parsed_args_issues_dir, api_mock):
"Test that the callback does not attempt to open any issues if the\n 'may I open' prompt returns false.\n "
args_dict = vars(parsed_args_issues_dir)
args_dict['batch_mode'] = False
par... | -425,145,883,097,062,600 | Test that the callback does not attempt to open any issues if the
'may I open' prompt returns false. | tests/test_feedback.py | test_opens_nothing_if_open_prompt_returns_false | slarse/repobee-feedback | python | def test_opens_nothing_if_open_prompt_returns_false(self, with_issues, parsed_args_issues_dir, api_mock):
"Test that the callback does not attempt to open any issues if the\n 'may I open' prompt returns false.\n "
args_dict = vars(parsed_args_issues_dir)
args_dict['batch_mode'] = False
par... |
def test_opens_issues_from_multi_issues_file(self, with_multi_issues_file, api_mock, parsed_args_multi_issues_file):
'Test that the callback opens issues correctly when they are all\n contained in a multi issues file.\n '
(issues_file, repos_and_issues) = with_multi_issues_file
expected_calls ... | 3,622,953,374,141,381,000 | Test that the callback opens issues correctly when they are all
contained in a multi issues file. | tests/test_feedback.py | test_opens_issues_from_multi_issues_file | slarse/repobee-feedback | python | def test_opens_issues_from_multi_issues_file(self, with_multi_issues_file, api_mock, parsed_args_multi_issues_file):
'Test that the callback opens issues correctly when they are all\n contained in a multi issues file.\n '
(issues_file, repos_and_issues) = with_multi_issues_file
expected_calls ... |
def test_skips_unexpected_issues_in_multi_issues_file(self, with_multi_issues_file, parsed_args_multi_issues_file, api_mock):
'Test that an exception is raised if one or more issues are found\n relating to student repos that ar not in prod(assignments, students).\n '
student_teams = parsed_args_mu... | 1,893,744,415,645,420,800 | Test that an exception is raised if one or more issues are found
relating to student repos that ar not in prod(assignments, students). | tests/test_feedback.py | test_skips_unexpected_issues_in_multi_issues_file | slarse/repobee-feedback | python | def test_skips_unexpected_issues_in_multi_issues_file(self, with_multi_issues_file, parsed_args_multi_issues_file, api_mock):
'Test that an exception is raised if one or more issues are found\n relating to student repos that ar not in prod(assignments, students).\n '
student_teams = parsed_args_mu... |
def __init__(self, x: Union[(List[float], np.ndarray)], fval: float, variables: List[Variable], replacements: Dict[(str, Tuple[(str, int)])], history: Tuple[(List[MinimumEigenOptimizationResult], OptimizationResult)]) -> None:
'\n Constructs an instance of the result class.\n\n Args:\n x: t... | 8,220,554,276,182,333,000 | Constructs an instance of the result class.
Args:
x: the optimal value found in the optimization.
fval: the optimal function value.
variables: the list of variables of the optimization problem.
replacements: a dictionary of substituted variables. Key is a variable being
substituted, value is a ... | qiskit/optimization/algorithms/recursive_minimum_eigen_optimizer.py | __init__ | Cristian-Malinescu/qiskit-aqua | python | def __init__(self, x: Union[(List[float], np.ndarray)], fval: float, variables: List[Variable], replacements: Dict[(str, Tuple[(str, int)])], history: Tuple[(List[MinimumEigenOptimizationResult], OptimizationResult)]) -> None:
'\n Constructs an instance of the result class.\n\n Args:\n x: t... |
@property
def replacements(self) -> Dict[(str, Tuple[(str, int)])]:
'\n Returns a dictionary of substituted variables. Key is a variable being substituted, value\n is a tuple of substituting variable and a weight, either 1 or -1.'
return self._replacements | 6,997,684,331,896,984,000 | Returns a dictionary of substituted variables. Key is a variable being substituted, value
is a tuple of substituting variable and a weight, either 1 or -1. | qiskit/optimization/algorithms/recursive_minimum_eigen_optimizer.py | replacements | Cristian-Malinescu/qiskit-aqua | python | @property
def replacements(self) -> Dict[(str, Tuple[(str, int)])]:
'\n Returns a dictionary of substituted variables. Key is a variable being substituted, value\n is a tuple of substituting variable and a weight, either 1 or -1.'
return self._replacements |
@property
def history(self) -> Tuple[(List[MinimumEigenOptimizationResult], OptimizationResult)]:
'\n Returns intermediate results. The first element is a list of\n :class:`~qiskit.optimization.algorithms.MinimumEigenOptimizerResult` obtained by invoking\n :class:`~qiskit.optimization.algorithm... | 487,360,261,191,788,160 | Returns intermediate results. The first element is a list of
:class:`~qiskit.optimization.algorithms.MinimumEigenOptimizerResult` obtained by invoking
:class:`~qiskit.optimization.algorithms.MinimumEigenOptimizer` iteratively, the second
element is an instance of :class:`~qiskit.optimization.algorithm.OptimizationResul... | qiskit/optimization/algorithms/recursive_minimum_eigen_optimizer.py | history | Cristian-Malinescu/qiskit-aqua | python | @property
def history(self) -> Tuple[(List[MinimumEigenOptimizationResult], OptimizationResult)]:
'\n Returns intermediate results. The first element is a list of\n :class:`~qiskit.optimization.algorithms.MinimumEigenOptimizerResult` obtained by invoking\n :class:`~qiskit.optimization.algorithm... |
def __init__(self, min_eigen_optimizer: MinimumEigenOptimizer, min_num_vars: int=1, min_num_vars_optimizer: Optional[OptimizationAlgorithm]=None, penalty: Optional[float]=None, history: Optional[IntermediateResult]=IntermediateResult.LAST_ITERATION) -> None:
' Initializes the recursive minimum eigen optimizer.\n\n ... | -677,792,891,465,104,500 | Initializes the recursive minimum eigen optimizer.
This initializer takes a ``MinimumEigenOptimizer``, the parameters to specify until when to
to apply the iterative scheme, and the optimizer to be applied once the threshold number of
variables is reached.
Args:
min_eigen_optimizer: The eigen optimizer to use in ... | qiskit/optimization/algorithms/recursive_minimum_eigen_optimizer.py | __init__ | Cristian-Malinescu/qiskit-aqua | python | def __init__(self, min_eigen_optimizer: MinimumEigenOptimizer, min_num_vars: int=1, min_num_vars_optimizer: Optional[OptimizationAlgorithm]=None, penalty: Optional[float]=None, history: Optional[IntermediateResult]=IntermediateResult.LAST_ITERATION) -> None:
' Initializes the recursive minimum eigen optimizer.\n\n ... |
def get_compatibility_msg(self, problem: QuadraticProgram) -> str:
'Checks whether a given problem can be solved with this optimizer.\n\n Checks whether the given problem is compatible, i.e., whether the problem can be converted\n to a QUBO, and otherwise, returns a message explaining the incompatibil... | -6,303,538,141,527,137,000 | Checks whether a given problem can be solved with this optimizer.
Checks whether the given problem is compatible, i.e., whether the problem can be converted
to a QUBO, and otherwise, returns a message explaining the incompatibility.
Args:
problem: The optimization problem to check compatibility.
Returns:
A m... | qiskit/optimization/algorithms/recursive_minimum_eigen_optimizer.py | get_compatibility_msg | Cristian-Malinescu/qiskit-aqua | python | def get_compatibility_msg(self, problem: QuadraticProgram) -> str:
'Checks whether a given problem can be solved with this optimizer.\n\n Checks whether the given problem is compatible, i.e., whether the problem can be converted\n to a QUBO, and otherwise, returns a message explaining the incompatibil... |
def solve(self, problem: QuadraticProgram) -> OptimizationResult:
'Tries to solve the given problem using the recursive optimizer.\n\n Runs the optimizer to try to solve the optimization problem.\n\n Args:\n problem: The problem to be solved.\n\n Returns:\n The result of t... | 8,254,324,393,457,410,000 | Tries to solve the given problem using the recursive optimizer.
Runs the optimizer to try to solve the optimization problem.
Args:
problem: The problem to be solved.
Returns:
The result of the optimizer applied to the problem.
Raises:
QiskitOptimizationError: Incompatible problem.
QiskitOptimization... | qiskit/optimization/algorithms/recursive_minimum_eigen_optimizer.py | solve | Cristian-Malinescu/qiskit-aqua | python | def solve(self, problem: QuadraticProgram) -> OptimizationResult:
'Tries to solve the given problem using the recursive optimizer.\n\n Runs the optimizer to try to solve the optimization problem.\n\n Args:\n problem: The problem to be solved.\n\n Returns:\n The result of t... |
def generateEphemeris(orbits, observers, backend='MJOLNIR', backend_kwargs={}, test_orbit=None, threads=Config.NUM_THREADS, chunk_size=1):
"\n Generate ephemeris for the orbits and the given observatories. \n \n Parameters\n ----------\n orbits : `~numpy.ndarray` (N, 6)\n Orbits for which to g... | 7,057,143,526,735,753,000 | Generate ephemeris for the orbits and the given observatories.
Parameters
----------
orbits : `~numpy.ndarray` (N, 6)
Orbits for which to generate ephemeris. If backend is 'THOR', then these orbits must be expressed
as heliocentric ecliptic cartesian elements. If backend is 'PYOORB' orbits may be
express... | thor/orbits/ephemeris.py | generateEphemeris | B612-Asteroid-Institute/thor | python | def generateEphemeris(orbits, observers, backend='MJOLNIR', backend_kwargs={}, test_orbit=None, threads=Config.NUM_THREADS, chunk_size=1):
"\n Generate ephemeris for the orbits and the given observatories. \n \n Parameters\n ----------\n orbits : `~numpy.ndarray` (N, 6)\n Orbits for which to g... |
def get_data(self, verbose: bool):
'\n I: get data\n -----------\n :param verbose: [bool]\n :return: -\n '
url_base = 'https://raw.githubusercontent.com/patverga/torch-ner-nlp-from-scratch/master/data/conll2003/'
targets = ['eng.train', 'eng.testa', 'eng.testb']
for ta... | -3,496,901,125,002,046,000 | I: get data
-----------
:param verbose: [bool]
:return: - | nerblackbox/modules/datasets/formatter/conll2003_formatter.py | get_data | af-ai-center/nerblackbox | python | def get_data(self, verbose: bool):
'\n I: get data\n -----------\n :param verbose: [bool]\n :return: -\n '
url_base = 'https://raw.githubusercontent.com/patverga/torch-ner-nlp-from-scratch/master/data/conll2003/'
targets = ['eng.train', 'eng.testa', 'eng.testb']
for ta... |
def create_ner_tag_mapping(self):
'\n II: customize ner_training tag mapping if wanted\n -------------------------------------\n :return: ner_tag_mapping: [dict] w/ keys = tags in original data, values = tags in formatted data\n '
return dict() | -1,371,010,697,111,993,300 | II: customize ner_training tag mapping if wanted
-------------------------------------
:return: ner_tag_mapping: [dict] w/ keys = tags in original data, values = tags in formatted data | nerblackbox/modules/datasets/formatter/conll2003_formatter.py | create_ner_tag_mapping | af-ai-center/nerblackbox | python | def create_ner_tag_mapping(self):
'\n II: customize ner_training tag mapping if wanted\n -------------------------------------\n :return: ner_tag_mapping: [dict] w/ keys = tags in original data, values = tags in formatted data\n '
return dict() |
def format_data(self):
'\n III: format data\n ----------------\n :return: -\n '
for phase in ['train', 'val', 'test']:
rows = self._read_original_file(phase)
self._write_formatted_csv(phase, rows) | 6,290,795,515,144,693,000 | III: format data
----------------
:return: - | nerblackbox/modules/datasets/formatter/conll2003_formatter.py | format_data | af-ai-center/nerblackbox | python | def format_data(self):
'\n III: format data\n ----------------\n :return: -\n '
for phase in ['train', 'val', 'test']:
rows = self._read_original_file(phase)
self._write_formatted_csv(phase, rows) |
def resplit_data(self, val_fraction: float):
'\n IV: resplit data\n ----------------\n :param val_fraction: [float]\n :return: -\n '
df_train = self._read_formatted_csvs(['train'])
self._write_final_csv('train', df_train)
df_val = self._read_formatted_csvs(['val'])
... | -2,747,583,459,563,875,300 | IV: resplit data
----------------
:param val_fraction: [float]
:return: - | nerblackbox/modules/datasets/formatter/conll2003_formatter.py | resplit_data | af-ai-center/nerblackbox | python | def resplit_data(self, val_fraction: float):
'\n IV: resplit data\n ----------------\n :param val_fraction: [float]\n :return: -\n '
df_train = self._read_formatted_csvs(['train'])
self._write_final_csv('train', df_train)
df_val = self._read_formatted_csvs(['val'])
... |
def _read_original_file(self, phase):
"\n III: format data\n ---------------------------------------------\n :param phase: [str] 'train' or 'test'\n :return: _rows: [list] of [list] of [str], e.g. [[], ['Inger', 'PER'], ['säger', '0'], ..]\n "
file_name = {'train': 'eng.trai... | 6,818,160,006,964,992,000 | III: format data
---------------------------------------------
:param phase: [str] 'train' or 'test'
:return: _rows: [list] of [list] of [str], e.g. [[], ['Inger', 'PER'], ['säger', '0'], ..] | nerblackbox/modules/datasets/formatter/conll2003_formatter.py | _read_original_file | af-ai-center/nerblackbox | python | def _read_original_file(self, phase):
"\n III: format data\n ---------------------------------------------\n :param phase: [str] 'train' or 'test'\n :return: _rows: [list] of [list] of [str], e.g. [[], ['Inger', 'PER'], ['säger', '0'], ..]\n "
file_name = {'train': 'eng.trai... |
def main():
'Main routine\n '
print('\nTesting ADMM')
print('====================')
print('m = n : ', args.n)
print('dataset: ', args.dataset)
if (args.dataset == 'DOTmark'):
print('class : ', args.imageclass)
print('method : ', args.method)
print('====================')
... | 6,122,039,336,531,661,000 | Main routine | test_ADMM.py | main | CrazyIvanPro/Optimal_Transport | python | def main():
'\n '
print('\nTesting ADMM')
print('====================')
print('m = n : ', args.n)
print('dataset: ', args.dataset)
if (args.dataset == 'DOTmark'):
print('class : ', args.imageclass)
print('method : ', args.method)
print('====================')
(mu, nu, c)... |
def create_security_token(api_key, stage):
'\n Generates a security token for SBT API access.\n\n Args:\n api_key (string): API_KEY value provided by solutionsbytext\n stage (string): STAGE values (test or ui)\n\n Returns:\n string: SecurityToken returns by LoginAPIService\n\n Raise... | 6,539,444,712,881,635,000 | Generates a security token for SBT API access.
Args:
api_key (string): API_KEY value provided by solutionsbytext
stage (string): STAGE values (test or ui)
Returns:
string: SecurityToken returns by LoginAPIService
Raises:
CustomException: Raises while error during GET request. | solutions_by_text/sbt_token_generator.py | create_security_token | sijanonly/sbt-python-client | python | def create_security_token(api_key, stage):
'\n Generates a security token for SBT API access.\n\n Args:\n api_key (string): API_KEY value provided by solutionsbytext\n stage (string): STAGE values (test or ui)\n\n Returns:\n string: SecurityToken returns by LoginAPIService\n\n Raise... |
def testChild(self):
'Test Child\n This will fail because additional_properties_type is None in ChildAllOf and it must be defined as any type\n to allow in the property radio_waves which is not defined in ChildAllOf, it is defined in Grandparent\n '
radio_waves = True
tele_vision = True... | 7,167,641,836,760,918,000 | Test Child
This will fail because additional_properties_type is None in ChildAllOf and it must be defined as any type
to allow in the property radio_waves which is not defined in ChildAllOf, it is defined in Grandparent | samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/test/test_child.py | testChild | 0x0c/openapi-generator | python | def testChild(self):
'Test Child\n This will fail because additional_properties_type is None in ChildAllOf and it must be defined as any type\n to allow in the property radio_waves which is not defined in ChildAllOf, it is defined in Grandparent\n '
radio_waves = True
tele_vision = True... |
def attach(self, engine: Engine) -> None:
'\n Args:\n engine: Ignite Engine, it can be a trainer, validator or evaluator.\n '
if (self._name is None):
self.logger = engine.logger
engine.add_event_handler(Events.STARTED, self) | 7,773,029,528,368,912,000 | Args:
engine: Ignite Engine, it can be a trainer, validator or evaluator. | monai/handlers/checkpoint_loader.py | attach | BRAINSia/MONAI | python | def attach(self, engine: Engine) -> None:
'\n Args:\n engine: Ignite Engine, it can be a trainer, validator or evaluator.\n '
if (self._name is None):
self.logger = engine.logger
engine.add_event_handler(Events.STARTED, self) |
def __call__(self, engine: Engine) -> None:
'\n Args:\n engine: Ignite Engine, it can be a trainer, validator or evaluator.\n '
checkpoint = torch.load(self.load_path, map_location=self.map_location)
if (len(self.load_dict) == 1):
key = list(self.load_dict.keys())[0]
... | 8,321,460,817,494,644,000 | Args:
engine: Ignite Engine, it can be a trainer, validator or evaluator. | monai/handlers/checkpoint_loader.py | __call__ | BRAINSia/MONAI | python | def __call__(self, engine: Engine) -> None:
'\n Args:\n engine: Ignite Engine, it can be a trainer, validator or evaluator.\n '
checkpoint = torch.load(self.load_path, map_location=self.map_location)
if (len(self.load_dict) == 1):
key = list(self.load_dict.keys())[0]
... |
def __init__(self, xml_file=None):
'\n Given a well formed XML file (xml_file), read it and turn it into\n a big string.\n '
self.__root = None
self.__name = ''
self.__namespace = None
self.__include_header_files = []
self.__includes = []
self.__include_enum_files = []
... | 8,446,292,367,681,806,000 | Given a well formed XML file (xml_file), read it and turn it into
a big string. | Autocoders/Python/src/fprime_ac/parsers/XmlSerializeParser.py | __init__ | 1Blackdiamondsc/fprime | python | def __init__(self, xml_file=None):
'\n Given a well formed XML file (xml_file), read it and turn it into\n a big string.\n '
self.__root = None
self.__name =
self.__namespace = None
self.__include_header_files = []
self.__includes = []
self.__include_enum_files = []
... |
def get_typeid(self):
'\n Return a generated type ID from contents of XML file.\n '
return self.__type_id | 5,982,048,283,816,331,000 | Return a generated type ID from contents of XML file. | Autocoders/Python/src/fprime_ac/parsers/XmlSerializeParser.py | get_typeid | 1Blackdiamondsc/fprime | python | def get_typeid(self):
'\n \n '
return self.__type_id |
def get_xml_filename(self):
'\n Return the original XML filename parsed.\n '
return self.__xml_filename | -5,144,559,668,066,074,000 | Return the original XML filename parsed. | Autocoders/Python/src/fprime_ac/parsers/XmlSerializeParser.py | get_xml_filename | 1Blackdiamondsc/fprime | python | def get_xml_filename(self):
'\n \n '
return self.__xml_filename |
def get_include_header_files(self):
'\n Return a list of all imported Port type XML files.\n '
return self.__include_header_files | 17,913,104,661,121,070 | Return a list of all imported Port type XML files. | Autocoders/Python/src/fprime_ac/parsers/XmlSerializeParser.py | get_include_header_files | 1Blackdiamondsc/fprime | python | def get_include_header_files(self):
'\n \n '
return self.__include_header_files |
def get_includes(self):
'\n Returns a list of all imported XML serializable files.\n '
return self.__includes | 8,429,568,674,755,246,000 | Returns a list of all imported XML serializable files. | Autocoders/Python/src/fprime_ac/parsers/XmlSerializeParser.py | get_includes | 1Blackdiamondsc/fprime | python | def get_includes(self):
'\n \n '
return self.__includes |
def get_include_enums(self):
'\n Returns a list of all imported XML enum files.\n '
return self.__include_enum_files | -8,368,547,394,618,953,000 | Returns a list of all imported XML enum files. | Autocoders/Python/src/fprime_ac/parsers/XmlSerializeParser.py | get_include_enums | 1Blackdiamondsc/fprime | python | def get_include_enums(self):
'\n \n '
return self.__include_enum_files |
def get_include_arrays(self):
'\n Returns a list of all imported XML array files.\n '
return self.__include_array_files | 1,281,047,629,684,097,800 | Returns a list of all imported XML array files. | Autocoders/Python/src/fprime_ac/parsers/XmlSerializeParser.py | get_include_arrays | 1Blackdiamondsc/fprime | python | def get_include_arrays(self):
'\n \n '
return self.__include_array_files |
def get_comment(self):
'\n Return text block string of comment for serializable class.\n '
return self.__comment | 502,717,888,823,918,800 | Return text block string of comment for serializable class. | Autocoders/Python/src/fprime_ac/parsers/XmlSerializeParser.py | get_comment | 1Blackdiamondsc/fprime | python | def get_comment(self):
'\n \n '
return self.__comment |
def get_members(self):
'\n Returns a list of member (name, type, optional size, optional format, optional comment) needed.\n '
return self.__members | -6,281,081,859,112,102,000 | Returns a list of member (name, type, optional size, optional format, optional comment) needed. | Autocoders/Python/src/fprime_ac/parsers/XmlSerializeParser.py | get_members | 1Blackdiamondsc/fprime | python | def get_members(self):
'\n \n '
return self.__members |
def eval_metric(label, approx, metric, weight=None, group_id=None, thread_count=(- 1)):
'\n Evaluate metrics with raw approxes and labels.\n\n Parameters\n ----------\n label : list or numpy.arrays or pandas.DataFrame or pandas.Series\n Object labels.\n\n approx : list or numpy.arrays or panda... | 3,825,111,144,821,981,000 | Evaluate metrics with raw approxes and labels.
Parameters
----------
label : list or numpy.arrays or pandas.DataFrame or pandas.Series
Object labels.
approx : list or numpy.arrays or pandas.DataFrame or pandas.Series
Object approxes.
metrics : list of strings
List of eval metrics.
weight : list or numpy... | catboost/python-package/catboost/utils.py | eval_metric | infected-mushroom/catboost | python | def eval_metric(label, approx, metric, weight=None, group_id=None, thread_count=(- 1)):
'\n Evaluate metrics with raw approxes and labels.\n\n Parameters\n ----------\n label : list or numpy.arrays or pandas.DataFrame or pandas.Series\n Object labels.\n\n approx : list or numpy.arrays or panda... |
def get_roc_curve(model, data, thread_count=(- 1)):
'\n Build points of ROC curve.\n\n Parameters\n ----------\n model : catboost.CatBoost\n The trained model.\n\n data : catboost.Pool or list of catboost.Pool\n A set of samples to build ROC curve with.\n\n thread_count : int (defaul... | 2,717,702,817,336,356,000 | Build points of ROC curve.
Parameters
----------
model : catboost.CatBoost
The trained model.
data : catboost.Pool or list of catboost.Pool
A set of samples to build ROC curve with.
thread_count : int (default=-1)
Number of threads to work with.
If -1, then the number of threads is set to the number ... | catboost/python-package/catboost/utils.py | get_roc_curve | infected-mushroom/catboost | python | def get_roc_curve(model, data, thread_count=(- 1)):
'\n Build points of ROC curve.\n\n Parameters\n ----------\n model : catboost.CatBoost\n The trained model.\n\n data : catboost.Pool or list of catboost.Pool\n A set of samples to build ROC curve with.\n\n thread_count : int (defaul... |
def get_fpr_curve(model=None, data=None, curve=None, thread_count=(- 1)):
'\n Build points of FPR curve.\n\n Parameters\n ----------\n model : catboost.CatBoost\n The trained model.\n\n data : catboost.Pool or list of catboost.Pool\n A set of samples to build ROC curve with.\n\n curv... | 7,066,552,134,008,052,000 | Build points of FPR curve.
Parameters
----------
model : catboost.CatBoost
The trained model.
data : catboost.Pool or list of catboost.Pool
A set of samples to build ROC curve with.
curve : tuple of three arrays (fpr, tpr, thresholds)
ROC curve points in format of get_roc_curve returned value.
If set... | catboost/python-package/catboost/utils.py | get_fpr_curve | infected-mushroom/catboost | python | def get_fpr_curve(model=None, data=None, curve=None, thread_count=(- 1)):
'\n Build points of FPR curve.\n\n Parameters\n ----------\n model : catboost.CatBoost\n The trained model.\n\n data : catboost.Pool or list of catboost.Pool\n A set of samples to build ROC curve with.\n\n curv... |
def get_fnr_curve(model=None, data=None, curve=None, thread_count=(- 1)):
'\n Build points of FNR curve.\n\n Parameters\n ----------\n model : catboost.CatBoost\n The trained model.\n\n data : catboost.Pool or list of catboost.Pool\n A set of samples to build ROC curve with.\n\n curv... | 1,644,376,199,734,561,300 | Build points of FNR curve.
Parameters
----------
model : catboost.CatBoost
The trained model.
data : catboost.Pool or list of catboost.Pool
A set of samples to build ROC curve with.
curve : tuple of three arrays (fpr, tpr, thresholds)
ROC curve points in format of get_roc_curve returned value.
If set... | catboost/python-package/catboost/utils.py | get_fnr_curve | infected-mushroom/catboost | python | def get_fnr_curve(model=None, data=None, curve=None, thread_count=(- 1)):
'\n Build points of FNR curve.\n\n Parameters\n ----------\n model : catboost.CatBoost\n The trained model.\n\n data : catboost.Pool or list of catboost.Pool\n A set of samples to build ROC curve with.\n\n curv... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.