body_hash stringlengths 64 64 | body stringlengths 23 109k | docstring stringlengths 1 57k | path stringlengths 4 198 | name stringlengths 1 115 | repository_name stringlengths 7 111 | repository_stars float64 0 191k | lang stringclasses 1
value | body_without_docstring stringlengths 14 108k | unified stringlengths 45 133k |
|---|---|---|---|---|---|---|---|---|---|
a7de602534dbd75f4c20da2810f4c29cbd17626cd190e44245813ab4f626f6ac | def import_reference(self):
'Import the referenec of the current reftrack\n\n :returns: None\n :rtype: None\n :raises: None\n '
self.reftrack.import_reference() | Import the referenec of the current reftrack
:returns: None
:rtype: None
:raises: None | src/jukeboxcore/gui/widgets/reftrackwidget.py | import_reference | JukeboxPipeline/jukebox-core | 2 | python | def import_reference(self):
'Import the referenec of the current reftrack\n\n :returns: None\n :rtype: None\n :raises: None\n '
self.reftrack.import_reference() | def import_reference(self):
'Import the referenec of the current reftrack\n\n :returns: None\n :rtype: None\n :raises: None\n '
self.reftrack.import_reference()<|docstring|>Import the referenec of the current reftrack
:returns: None
:rtype: None
:raises: None<|endoftext|> |
9f5c736b81e266eabc3a255dd3ce0851cf57e50bd16b3aafa49fc07067b08cae | def replace(self):
'Replace the current reftrack\n\n :returns: None\n :rtype: None\n :raises: None\n '
tfi = self.get_taskfileinfo_selection()
if tfi:
self.reftrack.replace(tfi) | Replace the current reftrack
:returns: None
:rtype: None
:raises: None | src/jukeboxcore/gui/widgets/reftrackwidget.py | replace | JukeboxPipeline/jukebox-core | 2 | python | def replace(self):
'Replace the current reftrack\n\n :returns: None\n :rtype: None\n :raises: None\n '
tfi = self.get_taskfileinfo_selection()
if tfi:
self.reftrack.replace(tfi) | def replace(self):
'Replace the current reftrack\n\n :returns: None\n :rtype: None\n :raises: None\n '
tfi = self.get_taskfileinfo_selection()
if tfi:
self.reftrack.replace(tfi)<|docstring|>Replace the current reftrack
:returns: None
:rtype: None
:raises: None<|endoftext... |
86e56e031780f3305a32b1435a2be285eb6460db2f10e0dbd8a0737d71fe6757 | def __init__(self, parent=None):
'Initialize a new ReftrackDelegate\n\n :param parent:\n :type parent:\n :raises: None\n '
super(ReftrackDelegate, self).__init__(parent) | Initialize a new ReftrackDelegate
:param parent:
:type parent:
:raises: None | src/jukeboxcore/gui/widgets/reftrackwidget.py | __init__ | JukeboxPipeline/jukebox-core | 2 | python | def __init__(self, parent=None):
'Initialize a new ReftrackDelegate\n\n :param parent:\n :type parent:\n :raises: None\n '
super(ReftrackDelegate, self).__init__(parent) | def __init__(self, parent=None):
'Initialize a new ReftrackDelegate\n\n :param parent:\n :type parent:\n :raises: None\n '
super(ReftrackDelegate, self).__init__(parent)<|docstring|>Initialize a new ReftrackDelegate
:param parent:
:type parent:
:raises: None<|endoftext|> |
94970b937ed95e63b6aa8252239bec7f03919c7fbd7c84942baa6b3f6adadfee | def create_widget(self, parent=None):
'Return a widget that should get painted by the delegate\n\n You might want to use this in :meth:`WidgetDelegate.createEditor`\n\n :returns: The created widget | None\n :rtype: QtGui.QWidget | None\n :raises: None\n '
return ReftrackWidget... | Return a widget that should get painted by the delegate
You might want to use this in :meth:`WidgetDelegate.createEditor`
:returns: The created widget | None
:rtype: QtGui.QWidget | None
:raises: None | src/jukeboxcore/gui/widgets/reftrackwidget.py | create_widget | JukeboxPipeline/jukebox-core | 2 | python | def create_widget(self, parent=None):
'Return a widget that should get painted by the delegate\n\n You might want to use this in :meth:`WidgetDelegate.createEditor`\n\n :returns: The created widget | None\n :rtype: QtGui.QWidget | None\n :raises: None\n '
return ReftrackWidget... | def create_widget(self, parent=None):
'Return a widget that should get painted by the delegate\n\n You might want to use this in :meth:`WidgetDelegate.createEditor`\n\n :returns: The created widget | None\n :rtype: QtGui.QWidget | None\n :raises: None\n '
return ReftrackWidget... |
e101371bb35b89f01976a767c05e32d77ca69d31d440194a922daed34455689b | def set_widget_index(self, index):
'Set the index for the widget. The widget should retrieve data from the index and display it.\n\n You might want use the same function as for :meth:`WidgetDelegate.setEditorData`.\n\n :param index: the index to paint\n :type index: QtCore.QModelIndex\n ... | Set the index for the widget. The widget should retrieve data from the index and display it.
You might want use the same function as for :meth:`WidgetDelegate.setEditorData`.
:param index: the index to paint
:type index: QtCore.QModelIndex
:returns: None
:rtype: None
:raises: None | src/jukeboxcore/gui/widgets/reftrackwidget.py | set_widget_index | JukeboxPipeline/jukebox-core | 2 | python | def set_widget_index(self, index):
'Set the index for the widget. The widget should retrieve data from the index and display it.\n\n You might want use the same function as for :meth:`WidgetDelegate.setEditorData`.\n\n :param index: the index to paint\n :type index: QtCore.QModelIndex\n ... | def set_widget_index(self, index):
'Set the index for the widget. The widget should retrieve data from the index and display it.\n\n You might want use the same function as for :meth:`WidgetDelegate.setEditorData`.\n\n :param index: the index to paint\n :type index: QtCore.QModelIndex\n ... |
417c515e83c40e0b1a467041672d68a159acddbf12d577897cbe35121009c065 | def create_editor_widget(self, parent, option, index):
"Return the editor to be used for editing the data item with the given index.\n\n Note that the index contains information about the model being used.\n The editor's parent widget is specified by parent, and the item options by option.\n\n ... | Return the editor to be used for editing the data item with the given index.
Note that the index contains information about the model being used.
The editor's parent widget is specified by parent, and the item options by option.
:param parent: the parent widget
:type parent: QtGui.QWidget
:param option: the options f... | src/jukeboxcore/gui/widgets/reftrackwidget.py | create_editor_widget | JukeboxPipeline/jukebox-core | 2 | python | def create_editor_widget(self, parent, option, index):
"Return the editor to be used for editing the data item with the given index.\n\n Note that the index contains information about the model being used.\n The editor's parent widget is specified by parent, and the item options by option.\n\n ... | def create_editor_widget(self, parent, option, index):
"Return the editor to be used for editing the data item with the given index.\n\n Note that the index contains information about the model being used.\n The editor's parent widget is specified by parent, and the item options by option.\n\n ... |
2a04df0d133275324399c888d5758c25fcd0e619b62295ba4b02938b4f40fe76 | def setEditorData(self, editor, index):
'Sets the contents of the given editor to the data for the item at the given index.\n\n Note that the index contains information about the model being used.\n\n :param editor: the editor widget\n :type editor: QtGui.QWidget\n :param index: the ind... | Sets the contents of the given editor to the data for the item at the given index.
Note that the index contains information about the model being used.
:param editor: the editor widget
:type editor: QtGui.QWidget
:param index: the index to paint
:type index: QtCore.QModelIndex
:returns: None
:rtype: None
:raises: No... | src/jukeboxcore/gui/widgets/reftrackwidget.py | setEditorData | JukeboxPipeline/jukebox-core | 2 | python | def setEditorData(self, editor, index):
'Sets the contents of the given editor to the data for the item at the given index.\n\n Note that the index contains information about the model being used.\n\n :param editor: the editor widget\n :type editor: QtGui.QWidget\n :param index: the ind... | def setEditorData(self, editor, index):
'Sets the contents of the given editor to the data for the item at the given index.\n\n Note that the index contains information about the model being used.\n\n :param editor: the editor widget\n :type editor: QtGui.QWidget\n :param index: the ind... |
ff302aaf7b8dd229ab551c5f7f22fcb08f4eec26d74d0a83c4279ea4b294d0ac | def get_features(self, progressbar=None):
'\n Get the feature values\n '
feature_df_rows = []
df = self.dataset.get_df()
rows = list(df.iterrows())
for (i, (_, row)) in enumerate(rows):
feature_series = self._get_features_for_single_case(row)
if (feature_series is not N... | Get the feature values | webapp/extractor.py | get_features | pwoznicki/Radiomics | 2 | python | def get_features(self, progressbar=None):
'\n \n '
feature_df_rows = []
df = self.dataset.get_df()
rows = list(df.iterrows())
for (i, (_, row)) in enumerate(rows):
feature_series = self._get_features_for_single_case(row)
if (feature_series is not None):
feat... | def get_features(self, progressbar=None):
'\n \n '
feature_df_rows = []
df = self.dataset.get_df()
rows = list(df.iterrows())
for (i, (_, row)) in enumerate(rows):
feature_series = self._get_features_for_single_case(row)
if (feature_series is not None):
feat... |
a0839004404583dcfeb9246b3c8d2bb3ec5a55b1832c1fe4ad0552d7818a5f24 | def test_handler_5xx(self):
' Check error view returns error message '
from werkzeug.exceptions import InternalServerError
from pysite.views.error_handlers import http_5xx
error_view = http_5xx.Error500View()
error_message = error_view.get(InternalServerError)
self.assertEqual(error_message[1], ... | Check error view returns error message | tests/test_mixins.py | test_handler_5xx | landizz/site | 0 | python | def test_handler_5xx(self):
' '
from werkzeug.exceptions import InternalServerError
from pysite.views.error_handlers import http_5xx
error_view = http_5xx.Error500View()
error_message = error_view.get(InternalServerError)
self.assertEqual(error_message[1], 500) | def test_handler_5xx(self):
' '
from werkzeug.exceptions import InternalServerError
from pysite.views.error_handlers import http_5xx
error_view = http_5xx.Error500View()
error_message = error_view.get(InternalServerError)
self.assertEqual(error_message[1], 500)<|docstring|>Check error view retu... |
9f1fd78c62c9ad0134a3aa41aa8a457bc00623386b6d0a5156eb3b6bcc676aeb | def test_route_view_runtime_error(self):
' Check that wrong values for route view setup raises runtime error '
from pysite.base_route import RouteView
rv = RouteView()
with self.assertRaises(RuntimeError):
rv.setup(manager, 'sdfsdf') | Check that wrong values for route view setup raises runtime error | tests/test_mixins.py | test_route_view_runtime_error | landizz/site | 0 | python | def test_route_view_runtime_error(self):
' '
from pysite.base_route import RouteView
rv = RouteView()
with self.assertRaises(RuntimeError):
rv.setup(manager, 'sdfsdf') | def test_route_view_runtime_error(self):
' '
from pysite.base_route import RouteView
rv = RouteView()
with self.assertRaises(RuntimeError):
rv.setup(manager, 'sdfsdf')<|docstring|>Check that wrong values for route view setup raises runtime error<|endoftext|> |
ff6d1681358785730747f6782b0f670e796b5a1e210aa67b3fa5d93907643d94 | def test_oauth_property(self):
' Make sure the oauth property works'
from flask import Blueprint
from pysite.route_manager import RouteView
from pysite.oauth import OAuthBackend
class TestRoute(RouteView):
name = 'test'
path = '/test'
tr = TestRoute()
tr.setup(manager, Bluep... | Make sure the oauth property works | tests/test_mixins.py | test_oauth_property | landizz/site | 0 | python | def test_oauth_property(self):
' '
from flask import Blueprint
from pysite.route_manager import RouteView
from pysite.oauth import OAuthBackend
class TestRoute(RouteView):
name = 'test'
path = '/test'
tr = TestRoute()
tr.setup(manager, Blueprint('test', 'test_name'))
sel... | def test_oauth_property(self):
' '
from flask import Blueprint
from pysite.route_manager import RouteView
from pysite.oauth import OAuthBackend
class TestRoute(RouteView):
name = 'test'
path = '/test'
tr = TestRoute()
tr.setup(manager, Blueprint('test', 'test_name'))
sel... |
52461f0c8fab2afb70707e61582aaba36352adfcfe74c03da786b33fde1654d9 | def test_user_data_property(self):
' Make sure the user_data property works'
from flask import Blueprint
from pysite.route_manager import RouteView
class TestRoute(RouteView):
name = 'test'
path = '/test'
tr = TestRoute()
tr.setup(manager, Blueprint('test', 'test_name'))
sel... | Make sure the user_data property works | tests/test_mixins.py | test_user_data_property | landizz/site | 0 | python | def test_user_data_property(self):
' '
from flask import Blueprint
from pysite.route_manager import RouteView
class TestRoute(RouteView):
name = 'test'
path = '/test'
tr = TestRoute()
tr.setup(manager, Blueprint('test', 'test_name'))
self.assertIsNone(tr.user_data) | def test_user_data_property(self):
' '
from flask import Blueprint
from pysite.route_manager import RouteView
class TestRoute(RouteView):
name = 'test'
path = '/test'
tr = TestRoute()
tr.setup(manager, Blueprint('test', 'test_name'))
self.assertIsNone(tr.user_data)<|docstrin... |
d52764bb6a3e1690ac4ffe01af16cfcb1bd429307443b4207fd0d41793b5d0ef | def test_logged_in_property(self):
' Make sure the user_data property works'
from flask import Blueprint
from pysite.route_manager import RouteView
class TestRoute(RouteView):
name = 'test'
path = '/test'
tr = TestRoute()
tr.setup(manager, Blueprint('test', 'test_name'))
sel... | Make sure the user_data property works | tests/test_mixins.py | test_logged_in_property | landizz/site | 0 | python | def test_logged_in_property(self):
' '
from flask import Blueprint
from pysite.route_manager import RouteView
class TestRoute(RouteView):
name = 'test'
path = '/test'
tr = TestRoute()
tr.setup(manager, Blueprint('test', 'test_name'))
self.assertFalse(tr.logged_in) | def test_logged_in_property(self):
' '
from flask import Blueprint
from pysite.route_manager import RouteView
class TestRoute(RouteView):
name = 'test'
path = '/test'
tr = TestRoute()
tr.setup(manager, Blueprint('test', 'test_name'))
self.assertFalse(tr.logged_in)<|docstring... |
23ec926117bce4ccbbc88730c1348d4bad81bcf7fad20aa31f7276edd58e5759 | def __init__(self):
'Constructor\n '
super(Command, self).__init__()
self._scanner = None | Constructor | scale/ingest/management/commands/scale_scan.py | __init__ | kfconsultant/scale | 121 | python | def __init__(self):
'\n '
super(Command, self).__init__()
self._scanner = None | def __init__(self):
'\n '
super(Command, self).__init__()
self._scanner = None<|docstring|>Constructor<|endoftext|> |
d67da7540a6e80378a29b503e0652776e6fa562f37ca1210c251da57544b587f | def handle(self, *args, **options):
'See :meth:`django.core.management.base.BaseCommand.handle`.\n\n This method starts the Scan processor.\n '
signal.signal(signal.SIGTERM, self._onsigterm)
scan_id = options.get('scan_id')
dry_run = bool(strtobool(options.get('dry_run')))
local = opti... | See :meth:`django.core.management.base.BaseCommand.handle`.
This method starts the Scan processor. | scale/ingest/management/commands/scale_scan.py | handle | kfconsultant/scale | 121 | python | def handle(self, *args, **options):
'See :meth:`django.core.management.base.BaseCommand.handle`.\n\n This method starts the Scan processor.\n '
signal.signal(signal.SIGTERM, self._onsigterm)
scan_id = options.get('scan_id')
dry_run = bool(strtobool(options.get('dry_run')))
local = opti... | def handle(self, *args, **options):
'See :meth:`django.core.management.base.BaseCommand.handle`.\n\n This method starts the Scan processor.\n '
signal.signal(signal.SIGTERM, self._onsigterm)
scan_id = options.get('scan_id')
dry_run = bool(strtobool(options.get('dry_run')))
local = opti... |
86f020b5f854d36a6b98362d46587e2e7fa3a92d21363ccfcf9248d8d5cb8085 | def _onsigterm(self, signum, _frame):
'See signal callback registration: :py:func:`signal.signal`.\n\n This callback performs a clean shutdown when a TERM signal is received.\n '
logger.info('Scan command received sigterm, telling scanner to stop')
if self._scanner:
self._scanner.stop(... | See signal callback registration: :py:func:`signal.signal`.
This callback performs a clean shutdown when a TERM signal is received. | scale/ingest/management/commands/scale_scan.py | _onsigterm | kfconsultant/scale | 121 | python | def _onsigterm(self, signum, _frame):
'See signal callback registration: :py:func:`signal.signal`.\n\n This callback performs a clean shutdown when a TERM signal is received.\n '
logger.info('Scan command received sigterm, telling scanner to stop')
if self._scanner:
self._scanner.stop(... | def _onsigterm(self, signum, _frame):
'See signal callback registration: :py:func:`signal.signal`.\n\n This callback performs a clean shutdown when a TERM signal is received.\n '
logger.info('Scan command received sigterm, telling scanner to stop')
if self._scanner:
self._scanner.stop(... |
676a36271e700b6f269a8a86aa1bf19fd83a0db0606c9c956fdede5b809bdc5c | def format_address(host: str, port: int) -> str:
'Return a formatted IP address given the host and port.\n\n Args:\n host: The host IP address or name.\n port: The port number.\n\n Returns:\n An IPv4/v6 formatted address based on the host.\n\n Example:\n >>> format_address("127.... | Return a formatted IP address given the host and port.
Args:
host: The host IP address or name.
port: The port number.
Returns:
An IPv4/v6 formatted address based on the host.
Example:
>>> format_address("127.0.0.1", 8080)
127.0.0.1:8080
>>> format_address("foo", 8080)
foo:8080
>>> fo... | tglib/tglib/utils/ip.py | format_address | kkkkv/tgnms | 12 | python | def format_address(host: str, port: int) -> str:
'Return a formatted IP address given the host and port.\n\n Args:\n host: The host IP address or name.\n port: The port number.\n\n Returns:\n An IPv4/v6 formatted address based on the host.\n\n Example:\n >>> format_address("127.... | def format_address(host: str, port: int) -> str:
'Return a formatted IP address given the host and port.\n\n Args:\n host: The host IP address or name.\n port: The port number.\n\n Returns:\n An IPv4/v6 formatted address based on the host.\n\n Example:\n >>> format_address("127.... |
55c01e2fa5a56bcbd50e0c7cc9f49773ed88630e9838f04806a8b042d100a2d7 | def data_loader(self, **kwargs):
"\n Description\n ----------\n This method enables efficient loading of data, as it allows users to select variables\n and clusters of interest (such that not all data needs to be loaded).\n ----------\n\n Parameters\n ----------\n ... | Description
----------
This method enables efficient loading of data, as it allows users to select variables
and clusters of interest (such that not all data needs to be loaded).
----------
Parameters
----------
**kwargs (dictionary)
extract_clusters (str / int / list)
Cluster IDs to extract (if int, takes first n... | sessions2load.py | data_loader | bartulem/KISN-pancortical-kinematics | 2 | python | def data_loader(self, **kwargs):
"\n Description\n ----------\n This method enables efficient loading of data, as it allows users to select variables\n and clusters of interest (such that not all data needs to be loaded).\n ----------\n\n Parameters\n ----------\n ... | def data_loader(self, **kwargs):
"\n Description\n ----------\n This method enables efficient loading of data, as it allows users to select variables\n and clusters of interest (such that not all data needs to be loaded).\n ----------\n\n Parameters\n ----------\n ... |
138c576200cffbb500d7198158891f25c8ebcdb97fffa5818e1bbbc0f60b0480 | def __str__(self):
'\n Returns\n ----------\n type (str)\n Variable type & description.\n ----------\n '
return f'''Type: {self.data_info[self.describe]['type']}.
Description: {self.data_info[self.describe]['description']}''' | Returns
----------
type (str)
Variable type & description.
---------- | sessions2load.py | __str__ | bartulem/KISN-pancortical-kinematics | 2 | python | def __str__(self):
'\n Returns\n ----------\n type (str)\n Variable type & description.\n ----------\n '
return f'Type: {self.data_info[self.describe]['type']}.
Description: {self.data_info[self.describe]['description']}' | def __str__(self):
'\n Returns\n ----------\n type (str)\n Variable type & description.\n ----------\n '
return f'Type: {self.data_info[self.describe]['type']}.
Description: {self.data_info[self.describe]['description']}'<|docstring|>Returns
----------
type (str)
... |
c95fab714ebef0672251fe9d1ecd39d6f3ba3093ae89914e4ce4d106e0703d8c | def cpu_count():
' Return the number of CPUs.\n '
if (multiprocessing is None):
return 1
return multiprocessing.cpu_count() | Return the number of CPUs. | plugin/AssemblerSPAdes/bin/SPAdes-3.1.0-Linux/share/spades/joblib3/parallel.py | cpu_count | konradotto/TS | 125 | python | def cpu_count():
' \n '
if (multiprocessing is None):
return 1
return multiprocessing.cpu_count() | def cpu_count():
' \n '
if (multiprocessing is None):
return 1
return multiprocessing.cpu_count()<|docstring|>Return the number of CPUs.<|endoftext|> |
df12dc36f01ffd6f4426433208fd343d7c00899136b820a109ec886a7ffbfe95 | def _verbosity_filter(index, verbose):
' Returns False for indices increasingly apart, the distance\n depending on the value of verbose.\n\n We use a lag increasing as the square of index\n '
if (not verbose):
return True
elif (verbose > 10):
return False
if (index == 0)... | Returns False for indices increasingly apart, the distance
depending on the value of verbose.
We use a lag increasing as the square of index | plugin/AssemblerSPAdes/bin/SPAdes-3.1.0-Linux/share/spades/joblib3/parallel.py | _verbosity_filter | konradotto/TS | 125 | python | def _verbosity_filter(index, verbose):
' Returns False for indices increasingly apart, the distance\n depending on the value of verbose.\n\n We use a lag increasing as the square of index\n '
if (not verbose):
return True
elif (verbose > 10):
return False
if (index == 0)... | def _verbosity_filter(index, verbose):
' Returns False for indices increasingly apart, the distance\n depending on the value of verbose.\n\n We use a lag increasing as the square of index\n '
if (not verbose):
return True
elif (verbose > 10):
return False
if (index == 0)... |
1dc15c5cfac1800f22621dbe7524fe4bfb37cab751294977c46852bbdb429099 | def delayed(function):
' Decorator used to capture the arguments of a function.\n '
pickle.dumps(function)
def delayed_function(*args, **kwargs):
return (function, args, kwargs)
try:
delayed_function = functools.wraps(function)(delayed_function)
except AttributeError:
' f... | Decorator used to capture the arguments of a function. | plugin/AssemblerSPAdes/bin/SPAdes-3.1.0-Linux/share/spades/joblib3/parallel.py | delayed | konradotto/TS | 125 | python | def delayed(function):
' \n '
pickle.dumps(function)
def delayed_function(*args, **kwargs):
return (function, args, kwargs)
try:
delayed_function = functools.wraps(function)(delayed_function)
except AttributeError:
' functools.wraps fails on some callable objects '
re... | def delayed(function):
' \n '
pickle.dumps(function)
def delayed_function(*args, **kwargs):
return (function, args, kwargs)
try:
delayed_function = functools.wraps(function)(delayed_function)
except AttributeError:
' functools.wraps fails on some callable objects '
re... |
97c5fb67891fedab6013863f73ebd1beac053faff063dfd3d26d59d9db78b234 | def dispatch(self, func, args, kwargs):
' Queue the function for computing, with or without multiprocessing\n '
if (self._pool is None):
job = ImmediateApply(func, args, kwargs)
index = len(self._jobs)
if (not _verbosity_filter(index, self.verbose)):
self._print('Done ... | Queue the function for computing, with or without multiprocessing | plugin/AssemblerSPAdes/bin/SPAdes-3.1.0-Linux/share/spades/joblib3/parallel.py | dispatch | konradotto/TS | 125 | python | def dispatch(self, func, args, kwargs):
' \n '
if (self._pool is None):
job = ImmediateApply(func, args, kwargs)
index = len(self._jobs)
if (not _verbosity_filter(index, self.verbose)):
self._print('Done %3i jobs | elapsed: %s', ((index + 1), short_format_time((t... | def dispatch(self, func, args, kwargs):
' \n '
if (self._pool is None):
job = ImmediateApply(func, args, kwargs)
index = len(self._jobs)
if (not _verbosity_filter(index, self.verbose)):
self._print('Done %3i jobs | elapsed: %s', ((index + 1), short_format_time((t... |
e34b969d65344a09e720514914bb1d835aea72e67be9927108833717aba3f349 | def dispatch_next(self):
' Dispatch more data for parallel processing\n '
self._dispatch_amount += 1
while self._dispatch_amount:
try:
(func, args, kwargs) = next(self._iterable)
self.dispatch(func, args, kwargs)
self._dispatch_amount -= 1
except Va... | Dispatch more data for parallel processing | plugin/AssemblerSPAdes/bin/SPAdes-3.1.0-Linux/share/spades/joblib3/parallel.py | dispatch_next | konradotto/TS | 125 | python | def dispatch_next(self):
' \n '
self._dispatch_amount += 1
while self._dispatch_amount:
try:
(func, args, kwargs) = next(self._iterable)
self.dispatch(func, args, kwargs)
self._dispatch_amount -= 1
except ValueError:
' Race condition in ... | def dispatch_next(self):
' \n '
self._dispatch_amount += 1
while self._dispatch_amount:
try:
(func, args, kwargs) = next(self._iterable)
self.dispatch(func, args, kwargs)
self._dispatch_amount -= 1
except ValueError:
' Race condition in ... |
5b9dae0625a2a9483581eb9b8011da86ff3061733f2bd8ae3874940d6258705f | def _print(self, msg, msg_args):
' Display the message on stout or stderr depending on verbosity\n '
if (not self.verbose):
return
if (self.verbose < 50):
writer = sys.stderr.write
else:
writer = sys.stdout.write
msg = (msg % msg_args)
writer(('[%s]: %s\n' % (self,... | Display the message on stout or stderr depending on verbosity | plugin/AssemblerSPAdes/bin/SPAdes-3.1.0-Linux/share/spades/joblib3/parallel.py | _print | konradotto/TS | 125 | python | def _print(self, msg, msg_args):
' \n '
if (not self.verbose):
return
if (self.verbose < 50):
writer = sys.stderr.write
else:
writer = sys.stdout.write
msg = (msg % msg_args)
writer(('[%s]: %s\n' % (self, msg))) | def _print(self, msg, msg_args):
' \n '
if (not self.verbose):
return
if (self.verbose < 50):
writer = sys.stderr.write
else:
writer = sys.stdout.write
msg = (msg % msg_args)
writer(('[%s]: %s\n' % (self, msg)))<|docstring|>Display the message on stout or stderr de... |
63ae3182ad340370128ebfbd6e2dcd2ca977508b27ea0c2dfa6f14084c2fd272 | def print_progress(self, index):
'Display the process of the parallel execution only a fraction\n of time, controlled by self.verbose.\n '
if (not self.verbose):
return
elapsed_time = (time.time() - self._start_time)
if self._iterable:
if _verbosity_filter(index, self.ve... | Display the process of the parallel execution only a fraction
of time, controlled by self.verbose. | plugin/AssemblerSPAdes/bin/SPAdes-3.1.0-Linux/share/spades/joblib3/parallel.py | print_progress | konradotto/TS | 125 | python | def print_progress(self, index):
'Display the process of the parallel execution only a fraction\n of time, controlled by self.verbose.\n '
if (not self.verbose):
return
elapsed_time = (time.time() - self._start_time)
if self._iterable:
if _verbosity_filter(index, self.ve... | def print_progress(self, index):
'Display the process of the parallel execution only a fraction\n of time, controlled by self.verbose.\n '
if (not self.verbose):
return
elapsed_time = (time.time() - self._start_time)
if self._iterable:
if _verbosity_filter(index, self.ve... |
07281937d3dd696b8f6c77a53145d2492b858418d9a949a204793a10c7e4f16c | def get_dwd_glm_basedir(sector='C', lat=None, lon=None, period='1min'):
'Return the directory where processed GLM data shall be stored.'
base = os.environ['NAS_DATA']
if (sector not in ('C', 'F', 'M1', 'M2')):
raise ValueError(f"Invalid sector: {sector!s}. Expected 'C', 'F', 'M1', or 'M2'.")
bd ... | Return the directory where processed GLM data shall be stored. | src/sattools/glm.py | get_dwd_glm_basedir | gerritholl/sattools | 0 | python | def get_dwd_glm_basedir(sector='C', lat=None, lon=None, period='1min'):
base = os.environ['NAS_DATA']
if (sector not in ('C', 'F', 'M1', 'M2')):
raise ValueError(f"Invalid sector: {sector!s}. Expected 'C', 'F', 'M1', or 'M2'.")
bd = (pathlib.Path(base) / 'GLM-processed')
bd /= sector
if... | def get_dwd_glm_basedir(sector='C', lat=None, lon=None, period='1min'):
base = os.environ['NAS_DATA']
if (sector not in ('C', 'F', 'M1', 'M2')):
raise ValueError(f"Invalid sector: {sector!s}. Expected 'C', 'F', 'M1', or 'M2'.")
bd = (pathlib.Path(base) / 'GLM-processed')
bd /= sector
if... |
3bc04eb6276bc47ad77aa459e7d971714fe4523a7998f0c7347d7073c4b4b00d | def get_pattern_dwd_glm(sector='C', lat=None, lon=None, period='1min'):
'Return filename pattern for storing processed GLM data.'
bd = get_dwd_glm_basedir(sector=sector, lat=lat, lon=lon, period=period)
seclab = (sector if (sector in ('C', 'F', 'M1')) else 'M1')
return str((bd / f'{{year}}/{{month}}/{{d... | Return filename pattern for storing processed GLM data. | src/sattools/glm.py | get_pattern_dwd_glm | gerritholl/sattools | 0 | python | def get_pattern_dwd_glm(sector='C', lat=None, lon=None, period='1min'):
bd = get_dwd_glm_basedir(sector=sector, lat=lat, lon=lon, period=period)
seclab = (sector if (sector in ('C', 'F', 'M1')) else 'M1')
return str((bd / f'{{year}}/{{month}}/{{day}}/{{hour}}/OR_GLM-L2-GLM{seclab:s}-M3_G16_s{{year}}{{d... | def get_pattern_dwd_glm(sector='C', lat=None, lon=None, period='1min'):
bd = get_dwd_glm_basedir(sector=sector, lat=lat, lon=lon, period=period)
seclab = (sector if (sector in ('C', 'F', 'M1')) else 'M1')
return str((bd / f'{{year}}/{{month}}/{{day}}/{{hour}}/OR_GLM-L2-GLM{seclab:s}-M3_G16_s{{year}}{{d... |
a8b267042c86b781f6baa0dec6c49e00f41dd8fd66c6a55b5f6eb74907d883c2 | def ensure_glm_lcfa_for_period(start_date, end_date):
'Make sure GLM LCFA files for period are present locally.\n\n Yields the local paths for the (cached or downloaded) files.\n '
logger.debug(f'Ensuring local LCFA availability {start_date:%Y-%m-%d %H:%M:%S}--{end_date:%H:%M:%S}')
cachedir = appdirs.... | Make sure GLM LCFA files for period are present locally.
Yields the local paths for the (cached or downloaded) files. | src/sattools/glm.py | ensure_glm_lcfa_for_period | gerritholl/sattools | 0 | python | def ensure_glm_lcfa_for_period(start_date, end_date):
'Make sure GLM LCFA files for period are present locally.\n\n Yields the local paths for the (cached or downloaded) files.\n '
logger.debug(f'Ensuring local LCFA availability {start_date:%Y-%m-%d %H:%M:%S}--{end_date:%H:%M:%S}')
cachedir = appdirs.... | def ensure_glm_lcfa_for_period(start_date, end_date):
'Make sure GLM LCFA files for period are present locally.\n\n Yields the local paths for the (cached or downloaded) files.\n '
logger.debug(f'Ensuring local LCFA availability {start_date:%Y-%m-%d %H:%M:%S}--{end_date:%H:%M:%S}')
cachedir = appdirs.... |
032088abd8553379e2b75f9fb9d1b354570b5c0b2f54c3923921dcbf92f34bf9 | def ensure_glm_for_period(start_date, end_date, sector='C', lat=None, lon=None):
'Get gridded GLM for period, unless already existing.\n\n Yields resulting GLM files as strings.\n '
logger.debug(f'Locating GLM gaps between {start_date:%Y-%m-%d %H:%M:%S}--{end_date:%H:%M:%S}, sector {sector:s}')
for ga... | Get gridded GLM for period, unless already existing.
Yields resulting GLM files as strings. | src/sattools/glm.py | ensure_glm_for_period | gerritholl/sattools | 0 | python | def ensure_glm_for_period(start_date, end_date, sector='C', lat=None, lon=None):
'Get gridded GLM for period, unless already existing.\n\n Yields resulting GLM files as strings.\n '
logger.debug(f'Locating GLM gaps between {start_date:%Y-%m-%d %H:%M:%S}--{end_date:%H:%M:%S}, sector {sector:s}')
for ga... | def ensure_glm_for_period(start_date, end_date, sector='C', lat=None, lon=None):
'Get gridded GLM for period, unless already existing.\n\n Yields resulting GLM files as strings.\n '
logger.debug(f'Locating GLM gaps between {start_date:%Y-%m-%d %H:%M:%S}--{end_date:%H:%M:%S}, sector {sector:s}')
for ga... |
b6e4f09a1d39c5592fb69b0b69eff29ec821e4e3c498fbc1231b85ec00cac7d3 | def find_glm_coverage(start_date, end_date, sector='C', lat=None, lon=None):
'Yield intervals corresponding to GLMC coverage.'
if (sector in 'CF'):
pat = get_pattern_dwd_glm(sector)
else:
pat = get_pattern_dwd_glm(sector, lat=lat, lon=lon)
glm = FileSet(path=pat, name='glm')
for file... | Yield intervals corresponding to GLMC coverage. | src/sattools/glm.py | find_glm_coverage | gerritholl/sattools | 0 | python | def find_glm_coverage(start_date, end_date, sector='C', lat=None, lon=None):
if (sector in 'CF'):
pat = get_pattern_dwd_glm(sector)
else:
pat = get_pattern_dwd_glm(sector, lat=lat, lon=lon)
glm = FileSet(path=pat, name='glm')
for file_info in glm.find(start_date, end_date, no_files_... | def find_glm_coverage(start_date, end_date, sector='C', lat=None, lon=None):
if (sector in 'CF'):
pat = get_pattern_dwd_glm(sector)
else:
pat = get_pattern_dwd_glm(sector, lat=lat, lon=lon)
glm = FileSet(path=pat, name='glm')
for file_info in glm.find(start_date, end_date, no_files_... |
55241142ae2bde588beeb17ec7d76271fbc45efb3fdd638511c2cf53707c26ea | def find_glm_coverage_gaps(start_date, end_date, sector='C', lat=None, lon=None):
'Yield intervals not covered by GLMC in period.'
last = pandas.Timestamp(start_date)
for iv in find_glm_coverage(start_date, end_date, sector=sector, lat=lat, lon=lon):
if (iv.left > last):
(yield pandas.In... | Yield intervals not covered by GLMC in period. | src/sattools/glm.py | find_glm_coverage_gaps | gerritholl/sattools | 0 | python | def find_glm_coverage_gaps(start_date, end_date, sector='C', lat=None, lon=None):
last = pandas.Timestamp(start_date)
for iv in find_glm_coverage(start_date, end_date, sector=sector, lat=lat, lon=lon):
if (iv.left > last):
(yield pandas.Interval(last, iv.left))
last = iv.right
... | def find_glm_coverage_gaps(start_date, end_date, sector='C', lat=None, lon=None):
last = pandas.Timestamp(start_date)
for iv in find_glm_coverage(start_date, end_date, sector=sector, lat=lat, lon=lon):
if (iv.left > last):
(yield pandas.Interval(last, iv.left))
last = iv.right
... |
ff05fb225b6c546e708b586cd555c73adeccd7d768c2cca8d4a92ccab3c42b9a | def load_file(name, path):
'Help to run glmtools by importing module from file.'
spec = importlib.util.spec_from_file_location(name, path)
module = importlib.util.module_from_spec(spec)
spec.loader.exec_module(module)
return module | Help to run glmtools by importing module from file. | src/sattools/glm.py | load_file | gerritholl/sattools | 0 | python | def load_file(name, path):
spec = importlib.util.spec_from_file_location(name, path)
module = importlib.util.module_from_spec(spec)
spec.loader.exec_module(module)
return module | def load_file(name, path):
spec = importlib.util.spec_from_file_location(name, path)
module = importlib.util.module_from_spec(spec)
spec.loader.exec_module(module)
return module<|docstring|>Help to run glmtools by importing module from file.<|endoftext|> |
92c137be2c8a611febb1fd62c5fb78d7c513fc30e155786618c011aa9f7d1ecf | def run_glmtools(files, max_files=180, sector='C', lat=None, lon=None):
'Run glmtools.\n\n This function runs glmtools.\n '
if (len(files) > max_files):
logger.info(f'Got {len(files):d} > {max_files:d} files, splitting...')
idx = 0
glmtool = load_file('glmtool', glm_script)
parser = gl... | Run glmtools.
This function runs glmtools. | src/sattools/glm.py | run_glmtools | gerritholl/sattools | 0 | python | def run_glmtools(files, max_files=180, sector='C', lat=None, lon=None):
'Run glmtools.\n\n This function runs glmtools.\n '
if (len(files) > max_files):
logger.info(f'Got {len(files):d} > {max_files:d} files, splitting...')
idx = 0
glmtool = load_file('glmtool', glm_script)
parser = gl... | def run_glmtools(files, max_files=180, sector='C', lat=None, lon=None):
'Run glmtools.\n\n This function runs glmtools.\n '
if (len(files) > max_files):
logger.info(f'Got {len(files):d} > {max_files:d} files, splitting...')
idx = 0
glmtool = load_file('glmtool', glm_script)
parser = gl... |
5d457dbe52c6c626f2cfe687133bb656de7466b2151985f3e821681f3fd20717 | def get_integrated_scene(glm_files, start_scene=None):
'Get an integrated scene.\n\n Given a set of GLM files, get a scene where quantities are summed or\n averaged or so.\n '
ms = satpy.MultiScene.from_files(glm_files, 'glm_l2', time_threshold=10, group_keys=['start_time'])
ms.load(['flash_extent_... | Get an integrated scene.
Given a set of GLM files, get a scene where quantities are summed or
averaged or so. | src/sattools/glm.py | get_integrated_scene | gerritholl/sattools | 0 | python | def get_integrated_scene(glm_files, start_scene=None):
'Get an integrated scene.\n\n Given a set of GLM files, get a scene where quantities are summed or\n averaged or so.\n '
ms = satpy.MultiScene.from_files(glm_files, 'glm_l2', time_threshold=10, group_keys=['start_time'])
ms.load(['flash_extent_... | def get_integrated_scene(glm_files, start_scene=None):
'Get an integrated scene.\n\n Given a set of GLM files, get a scene where quantities are summed or\n averaged or so.\n '
ms = satpy.MultiScene.from_files(glm_files, 'glm_l2', time_threshold=10, group_keys=['start_time'])
ms.load(['flash_extent_... |
05cc94e06122456b4e0a2e7fe93267eb39d4121d4226b21a0397abef2e7962a9 | def _TestTableSanity(self, tt, lines):
'Run the given truth table through basic sanity checks.\n\n Args:\n tt: A TruthTable object.\n lines: The expect input lines, in order (list of tuples).\n '
iter1 = iter(tt)
iter2 = iter(tt)
self.assertEquals(lines[0], iter1.next())
self.assertE... | Run the given truth table through basic sanity checks.
Args:
tt: A TruthTable object.
lines: The expect input lines, in order (list of tuples). | lib/cros_test_lib_unittest.py | _TestTableSanity | bpsinc-native/src_third_party_chromite | 0 | python | def _TestTableSanity(self, tt, lines):
'Run the given truth table through basic sanity checks.\n\n Args:\n tt: A TruthTable object.\n lines: The expect input lines, in order (list of tuples).\n '
iter1 = iter(tt)
iter2 = iter(tt)
self.assertEquals(lines[0], iter1.next())
self.assertE... | def _TestTableSanity(self, tt, lines):
'Run the given truth table through basic sanity checks.\n\n Args:\n tt: A TruthTable object.\n lines: The expect input lines, in order (list of tuples).\n '
iter1 = iter(tt)
iter2 = iter(tt)
self.assertEquals(lines[0], iter1.next())
self.assertE... |
9a22898b7b394ce8ffc0226922d3a6c1fc8db62a43f12e5f9bfc641f584bdb2a | def testTwoDimensions(self):
'Test TruthTable behavior for two boolean inputs.'
tt = cros_test_lib.TruthTable(inputs=[(True, True), (True, False)])
self.assertEquals(len(tt), pow(2, 2))
self.assertFalse(tt.GetOutput((False, False)))
self.assertFalse(tt.GetOutput((False, True)))
self.assertTrue(t... | Test TruthTable behavior for two boolean inputs. | lib/cros_test_lib_unittest.py | testTwoDimensions | bpsinc-native/src_third_party_chromite | 0 | python | def testTwoDimensions(self):
tt = cros_test_lib.TruthTable(inputs=[(True, True), (True, False)])
self.assertEquals(len(tt), pow(2, 2))
self.assertFalse(tt.GetOutput((False, False)))
self.assertFalse(tt.GetOutput((False, True)))
self.assertTrue(tt.GetOutput((True, False)))
self.assertTrue(tt... | def testTwoDimensions(self):
tt = cros_test_lib.TruthTable(inputs=[(True, True), (True, False)])
self.assertEquals(len(tt), pow(2, 2))
self.assertFalse(tt.GetOutput((False, False)))
self.assertFalse(tt.GetOutput((False, True)))
self.assertTrue(tt.GetOutput((True, False)))
self.assertTrue(tt... |
7e8451dc08fda4ce51e7d53e76184bf14f72e8f73ae621b71b13191ca6ab9d95 | def testFourDimensions(self):
'Test TruthTable behavior for four boolean inputs.'
false1 = (True, True, True, False)
false2 = (True, False, True, False)
true1 = (False, True, False, True)
true2 = (True, True, False, False)
tt = cros_test_lib.TruthTable(inputs=(false1, false2), input_result=False... | Test TruthTable behavior for four boolean inputs. | lib/cros_test_lib_unittest.py | testFourDimensions | bpsinc-native/src_third_party_chromite | 0 | python | def testFourDimensions(self):
false1 = (True, True, True, False)
false2 = (True, False, True, False)
true1 = (False, True, False, True)
true2 = (True, True, False, False)
tt = cros_test_lib.TruthTable(inputs=(false1, false2), input_result=False)
self.assertEquals(len(tt), pow(2, 4))
sel... | def testFourDimensions(self):
false1 = (True, True, True, False)
false2 = (True, False, True, False)
true1 = (False, True, False, True)
true2 = (True, True, False, False)
tt = cros_test_lib.TruthTable(inputs=(false1, false2), input_result=False)
self.assertEquals(len(tt), pow(2, 4))
sel... |
33d8050c19cfc2b984364a53d79b9f9ad6331186614b368ea2a734341dcf03d3 | def _MockTarList(self, files):
'Mock out tarball content list call.\n\n Args:\n files: A list of contents to return.\n '
self.rc_mock.AddCmdResult(partial_mock.ListRegex('tar -tf'), output='\n'.join(files)) | Mock out tarball content list call.
Args:
files: A list of contents to return. | lib/cros_test_lib_unittest.py | _MockTarList | bpsinc-native/src_third_party_chromite | 0 | python | def _MockTarList(self, files):
'Mock out tarball content list call.\n\n Args:\n files: A list of contents to return.\n '
self.rc_mock.AddCmdResult(partial_mock.ListRegex('tar -tf'), output='\n'.join(files)) | def _MockTarList(self, files):
'Mock out tarball content list call.\n\n Args:\n files: A list of contents to return.\n '
self.rc_mock.AddCmdResult(partial_mock.ListRegex('tar -tf'), output='\n'.join(files))<|docstring|>Mock out tarball content list call.
Args:
files: A list of contents to return.<... |
046e155d5a6abd289b554acf1322a1dd7198fc58fd596264ca164149b415fe53 | def testNormPath(self):
'Test path normalization.'
tar_contents = ['./', './foo/', './foo/./a', './foo/./b']
dir_struct = [Dir('.', []), Dir('foo', ['a', 'b'])]
self._MockTarList(tar_contents)
cros_test_lib.VerifyTarball(self.TARBALL, dir_struct) | Test path normalization. | lib/cros_test_lib_unittest.py | testNormPath | bpsinc-native/src_third_party_chromite | 0 | python | def testNormPath(self):
tar_contents = ['./', './foo/', './foo/./a', './foo/./b']
dir_struct = [Dir('.', []), Dir('foo', ['a', 'b'])]
self._MockTarList(tar_contents)
cros_test_lib.VerifyTarball(self.TARBALL, dir_struct) | def testNormPath(self):
tar_contents = ['./', './foo/', './foo/./a', './foo/./b']
dir_struct = [Dir('.', []), Dir('foo', ['a', 'b'])]
self._MockTarList(tar_contents)
cros_test_lib.VerifyTarball(self.TARBALL, dir_struct)<|docstring|>Test path normalization.<|endoftext|> |
42730271c44b4573132d74c828c239426cf5793f9a0726573dbb647ea0850eec | def testDuplicate(self):
'Test duplicate detection.'
tar_contents = ['a', 'b', 'a']
dir_struct = ['a', 'b']
self._MockTarList(tar_contents)
self.assertRaises(AssertionError, cros_test_lib.VerifyTarball, self.TARBALL, dir_struct) | Test duplicate detection. | lib/cros_test_lib_unittest.py | testDuplicate | bpsinc-native/src_third_party_chromite | 0 | python | def testDuplicate(self):
tar_contents = ['a', 'b', 'a']
dir_struct = ['a', 'b']
self._MockTarList(tar_contents)
self.assertRaises(AssertionError, cros_test_lib.VerifyTarball, self.TARBALL, dir_struct) | def testDuplicate(self):
tar_contents = ['a', 'b', 'a']
dir_struct = ['a', 'b']
self._MockTarList(tar_contents)
self.assertRaises(AssertionError, cros_test_lib.VerifyTarball, self.TARBALL, dir_struct)<|docstring|>Test duplicate detection.<|endoftext|> |
b915bbcdb70f1118d6fbad80049b8c6866755838291dd084421dfc5d9595461b | def testPatchRemovalError(self):
'Verify that patch removal during tearDown is robust to Exceptions.'
tc = self.MyMockTestCase('testIt')
patcher = self.GetPatcher('TO_BE_MOCKED', (- 100))
patcher2 = self.GetPatcher('TO_BE_MOCKED2', (- 200))
patcher3 = self.GetPatcher('TO_BE_MOCKED3', (- 300))
pa... | Verify that patch removal during tearDown is robust to Exceptions. | lib/cros_test_lib_unittest.py | testPatchRemovalError | bpsinc-native/src_third_party_chromite | 0 | python | def testPatchRemovalError(self):
tc = self.MyMockTestCase('testIt')
patcher = self.GetPatcher('TO_BE_MOCKED', (- 100))
patcher2 = self.GetPatcher('TO_BE_MOCKED2', (- 200))
patcher3 = self.GetPatcher('TO_BE_MOCKED3', (- 300))
patcher3.start()
tc.setUp()
tc.StartPatcher(patcher)
tc.St... | def testPatchRemovalError(self):
tc = self.MyMockTestCase('testIt')
patcher = self.GetPatcher('TO_BE_MOCKED', (- 100))
patcher2 = self.GetPatcher('TO_BE_MOCKED2', (- 200))
patcher3 = self.GetPatcher('TO_BE_MOCKED3', (- 300))
patcher3.start()
tc.setUp()
tc.StartPatcher(patcher)
tc.St... |
1a58aabf1b3703da19c031cd19c6f7f6fb7ae1c228ca6220333a5d9b05d4f0a9 | def testTimeout(self):
'Test that test cases are interrupted when they are hanging.'
class TimeoutTestCase(cros_test_lib.TestCase):
'Test case that raises a TimeoutError because it takes too long.'
TEST_CASE_TIMEOUT = 1
def testSleeping(self):
'Sleep for 2 minutes. This sho... | Test that test cases are interrupted when they are hanging. | lib/cros_test_lib_unittest.py | testTimeout | bpsinc-native/src_third_party_chromite | 0 | python | def testTimeout(self):
class TimeoutTestCase(cros_test_lib.TestCase):
'Test case that raises a TimeoutError because it takes too long.'
TEST_CASE_TIMEOUT = 1
def testSleeping(self):
'Sleep for 2 minutes. This should raise a TimeoutError.'
time.sleep((2 * 60))
... | def testTimeout(self):
class TimeoutTestCase(cros_test_lib.TestCase):
'Test case that raises a TimeoutError because it takes too long.'
TEST_CASE_TIMEOUT = 1
def testSleeping(self):
'Sleep for 2 minutes. This should raise a TimeoutError.'
time.sleep((2 * 60))
... |
e03fdb4a89fc34efe8241bd5afecce8833cb13aedf1800ae5299a79ced06cb56 | def testSleeping(self):
'Sleep for 2 minutes. This should raise a TimeoutError.'
time.sleep((2 * 60))
raise AssertionError('Test case should have timed out.') | Sleep for 2 minutes. This should raise a TimeoutError. | lib/cros_test_lib_unittest.py | testSleeping | bpsinc-native/src_third_party_chromite | 0 | python | def testSleeping(self):
time.sleep((2 * 60))
raise AssertionError('Test case should have timed out.') | def testSleeping(self):
time.sleep((2 * 60))
raise AssertionError('Test case should have timed out.')<|docstring|>Sleep for 2 minutes. This should raise a TimeoutError.<|endoftext|> |
0c4a7ae24b51f2b59b3ca6a069bba4174518a2ca4ba6638bf4206f32b43f009a | @click.command()
@version_flag
@click.option('--extent', is_flag=True, help='Set this flag to generate extent imagery')
@click.option('--concentration', is_flag=True, help='Set this flag to generate concentration imagery')
@click.option('--anomaly', is_flag=True, help='Set this flag to generate anomaly imagery')
@click... | Run latest daily or monthly image generation | seaice/images/cli/sii_image_latest.py | sii_image_latest | andypbarrett/nsidc-seaice | 2 | python | @click.command()
@version_flag
@click.option('--extent', is_flag=True, help='Set this flag to generate extent imagery')
@click.option('--concentration', is_flag=True, help='Set this flag to generate concentration imagery')
@click.option('--anomaly', is_flag=True, help='Set this flag to generate anomaly imagery')
@click... | @click.command()
@version_flag
@click.option('--extent', is_flag=True, help='Set this flag to generate extent imagery')
@click.option('--concentration', is_flag=True, help='Set this flag to generate concentration imagery')
@click.option('--anomaly', is_flag=True, help='Set this flag to generate anomaly imagery')
@click... |
2abcc87bf4aa025aaa6ac2ba39bc286a0035a5d6af3445d99a51d100c0babdcc | def __init__(self, url, server, user, name, local_dir, commit_hash=None):
'\n Initialize a new repository information object.\n\n Arguments:\n url {string} -- Full remote source URL of the repository.\n server {string} -- Name of the source server (e.g., "github.com").\n ... | Initialize a new repository information object.
Arguments:
url {string} -- Full remote source URL of the repository.
server {string} -- Name of the source server (e.g., "github.com").
user {string} -- Username of the repository owner.
name {string} -- Name of the repository on the server.
local_dir... | engine/preprocessing/repoinfo.py | __init__ | dentonmwood/codeDuplicationParser | 1 | python | def __init__(self, url, server, user, name, local_dir, commit_hash=None):
'\n Initialize a new repository information object.\n\n Arguments:\n url {string} -- Full remote source URL of the repository.\n server {string} -- Name of the source server (e.g., "github.com").\n ... | def __init__(self, url, server, user, name, local_dir, commit_hash=None):
'\n Initialize a new repository information object.\n\n Arguments:\n url {string} -- Full remote source URL of the repository.\n server {string} -- Name of the source server (e.g., "github.com").\n ... |
38995c67ac6b436adb98f436647dbe53101ca610128603b1682df7ed37944016 | def clone_or_pull(self):
'Clone the repository or pull it if it has already been cloned.'
try:
if isdir(self.dir):
repo = Repo(self.dir)
repo.remotes.origin.pull()
else:
repo = Repo.clone_from(self.url, self.dir)
self.hash = repo.head.object.hexsha
... | Clone the repository or pull it if it has already been cloned. | engine/preprocessing/repoinfo.py | clone_or_pull | dentonmwood/codeDuplicationParser | 1 | python | def clone_or_pull(self):
try:
if isdir(self.dir):
repo = Repo(self.dir)
repo.remotes.origin.pull()
else:
repo = Repo.clone_from(self.url, self.dir)
self.hash = repo.head.object.hexsha
return True
except InvalidGitRepositoryError:
r... | def clone_or_pull(self):
try:
if isdir(self.dir):
repo = Repo(self.dir)
repo.remotes.origin.pull()
else:
repo = Repo.clone_from(self.url, self.dir)
self.hash = repo.head.object.hexsha
return True
except InvalidGitRepositoryError:
r... |
4b7ee97bdb61bba7a7ed0334df48a645a90bcc23fd276393f8bc19bc7fded332 | @staticmethod
def parse_repo_info(repo_path):
'\n Parse repository information from a repository path.\n\n There are two valid repository path formats:\n - Full remote repository URL (supports both GitHub and GitLab).\n "https://github.com/user/repo"\n - Short GitH... | Parse repository information from a repository path.
There are two valid repository path formats:
- Full remote repository URL (supports both GitHub and GitLab).
"https://github.com/user/repo"
- Short GitHub repository URL (only works with GitHub).
"user/repo" | engine/preprocessing/repoinfo.py | parse_repo_info | dentonmwood/codeDuplicationParser | 1 | python | @staticmethod
def parse_repo_info(repo_path):
'\n Parse repository information from a repository path.\n\n There are two valid repository path formats:\n - Full remote repository URL (supports both GitHub and GitLab).\n "https://github.com/user/repo"\n - Short GitH... | @staticmethod
def parse_repo_info(repo_path):
'\n Parse repository information from a repository path.\n\n There are two valid repository path formats:\n - Full remote repository URL (supports both GitHub and GitLab).\n "https://github.com/user/repo"\n - Short GitH... |
a96e8f16b25d88aa2d0bf10d8ff560b1d50a98218a7a93dbc4f1c1e6ea075e89 | def __str__(self):
'Convert the most useful repo info into a human-readable string.'
info_str = f'{self.url} -> {self.dir}'
if self.hash:
info_str += f' (commit: {self.hash})'
return info_str | Convert the most useful repo info into a human-readable string. | engine/preprocessing/repoinfo.py | __str__ | dentonmwood/codeDuplicationParser | 1 | python | def __str__(self):
info_str = f'{self.url} -> {self.dir}'
if self.hash:
info_str += f' (commit: {self.hash})'
return info_str | def __str__(self):
info_str = f'{self.url} -> {self.dir}'
if self.hash:
info_str += f' (commit: {self.hash})'
return info_str<|docstring|>Convert the most useful repo info into a human-readable string.<|endoftext|> |
7b240894cd65b70af9311d7f0805d218b74b81efa86f6f835789385607963708 | def __repr__(self):
'Return string representation of the repository information.'
return self.__str__() | Return string representation of the repository information. | engine/preprocessing/repoinfo.py | __repr__ | dentonmwood/codeDuplicationParser | 1 | python | def __repr__(self):
return self.__str__() | def __repr__(self):
return self.__str__()<|docstring|>Return string representation of the repository information.<|endoftext|> |
e053f652cc7bf5bca95a496d0a742c9164876f28d2118f1c9b0e3c9e77ff8495 | def __init__(self, experiment, label=None):
'Initialize the PrintPopulationGraphProperties Action'
super(PrintPopulationGraphProperties, self).__init__(experiment, name='PrintPopulationGraphProperties', label=label)
self.epoch_start = self.experiment.config.getint(self.config_section, 'epoch_start', 0)
... | Initialize the PrintPopulationGraphProperties Action | seeds/plugins/action/PrintPopulationGraphProperties.py | __init__ | briandconnelly/seeds | 11 | python | def __init__(self, experiment, label=None):
super(PrintPopulationGraphProperties, self).__init__(experiment, name='PrintPopulationGraphProperties', label=label)
self.epoch_start = self.experiment.config.getint(self.config_section, 'epoch_start', 0)
self.epoch_end = self.experiment.config.getint(self.co... | def __init__(self, experiment, label=None):
super(PrintPopulationGraphProperties, self).__init__(experiment, name='PrintPopulationGraphProperties', label=label)
self.epoch_start = self.experiment.config.getint(self.config_section, 'epoch_start', 0)
self.epoch_end = self.experiment.config.getint(self.co... |
69c73634755d3bda527dd6617b28318204b6852e6f9a834afded9038ed593aa3 | def update(self):
'Execute the Action'
if self.skip_update():
return
g = self.experiment.population.topology.graph
degrees = list(nx.degree(g).values())
row = [self.experiment.epoch, nx.number_of_nodes(g), nx.number_of_edges(g), mean(degrees), std(degrees), nx.average_clustering(g), nx.diame... | Execute the Action | seeds/plugins/action/PrintPopulationGraphProperties.py | update | briandconnelly/seeds | 11 | python | def update(self):
if self.skip_update():
return
g = self.experiment.population.topology.graph
degrees = list(nx.degree(g).values())
row = [self.experiment.epoch, nx.number_of_nodes(g), nx.number_of_edges(g), mean(degrees), std(degrees), nx.average_clustering(g), nx.diameter(g), nx.number_co... | def update(self):
if self.skip_update():
return
g = self.experiment.population.topology.graph
degrees = list(nx.degree(g).values())
row = [self.experiment.epoch, nx.number_of_nodes(g), nx.number_of_edges(g), mean(degrees), std(degrees), nx.average_clustering(g), nx.diameter(g), nx.number_co... |
2693ca2c4a5e7322636b1e0975634e5e3d911b817e7d17e6164fc95f62061e78 | def PredictTheWinner(self, nums):
'\n :type nums: List[int]\n :rtype: bool\n '
memo = {}
def score(s, start, end):
if ((start, end) in memo):
return memo[(start, end)]
if (start == end):
memo[(start, end)] = nums[start]
return nums[st... | :type nums: List[int]
:rtype: bool | Python3/0486-Predict-the-Winner/soln.py | PredictTheWinner | wyaadarsh/LeetCode-Solutions | 5 | python | def PredictTheWinner(self, nums):
'\n :type nums: List[int]\n :rtype: bool\n '
memo = {}
def score(s, start, end):
if ((start, end) in memo):
return memo[(start, end)]
if (start == end):
memo[(start, end)] = nums[start]
return nums[st... | def PredictTheWinner(self, nums):
'\n :type nums: List[int]\n :rtype: bool\n '
memo = {}
def score(s, start, end):
if ((start, end) in memo):
return memo[(start, end)]
if (start == end):
memo[(start, end)] = nums[start]
return nums[st... |
dc9a414229c1728e1d6a769f7a84e36db02c155f238622bccdf59e8efb806d32 | def update(self, data):
'Set the cell values to the new `data`'
self.data = data
for (i, c) in enumerate(self.cells):
c.update(data[i]) | Set the cell values to the new `data` | src/dfwidget/main.py | update | JoelStansbury/dfwidget | 0 | python | def update(self, data):
self.data = data
for (i, c) in enumerate(self.cells):
c.update(data[i]) | def update(self, data):
self.data = data
for (i, c) in enumerate(self.cells):
c.update(data[i])<|docstring|>Set the cell values to the new `data`<|endoftext|> |
9aaf23e80fdb4312b07abdea9409c08905e6726eb7d1a71ff490ad405b0be8ab | @observe('focus_idx')
def focus(self, change):
'Controls the highlighting of rows'
old = change['old']
new = change['new']
if (old != (- 1)):
self.rows[old].remove_class('row_hover')
if (new != (- 1)):
self.rows[new].add_class('row_hover') | Controls the highlighting of rows | src/dfwidget/main.py | focus | JoelStansbury/dfwidget | 0 | python | @observe('focus_idx')
def focus(self, change):
old = change['old']
new = change['new']
if (old != (- 1)):
self.rows[old].remove_class('row_hover')
if (new != (- 1)):
self.rows[new].add_class('row_hover') | @observe('focus_idx')
def focus(self, change):
old = change['old']
new = change['new']
if (old != (- 1)):
self.rows[old].remove_class('row_hover')
if (new != (- 1)):
self.rows[new].add_class('row_hover')<|docstring|>Controls the highlighting of rows<|endoftext|> |
af7ac0c06eadbe284e9ee0d459c4b34acc6adbf1caeb079ebd87728897aee4ff | def auto_width(self, df, num_rows):
'\n Uses the first `num_rows` elements of each column to determine\n the width of each row element.\n '
cols = list(df.columns)
ppc = 8
spacing = 2
widths = {}
for c in cols:
c_width = len(str(c))
d_width = max([len(str(x))... | Uses the first `num_rows` elements of each column to determine
the width of each row element. | src/dfwidget/main.py | auto_width | JoelStansbury/dfwidget | 0 | python | def auto_width(self, df, num_rows):
'\n Uses the first `num_rows` elements of each column to determine\n the width of each row element.\n '
cols = list(df.columns)
ppc = 8
spacing = 2
widths = {}
for c in cols:
c_width = len(str(c))
d_width = max([len(str(x))... | def auto_width(self, df, num_rows):
'\n Uses the first `num_rows` elements of each column to determine\n the width of each row element.\n '
cols = list(df.columns)
ppc = 8
spacing = 2
widths = {}
for c in cols:
c_width = len(str(c))
d_width = max([len(str(x))... |
f40bd261daa53b8a708cc3120137a90ef91f5feb3d439ffc554048b218aa021c | def get_interfaces(excluded=None):
'gets interfaces'
excluded = (excluded or [])
return [iface for iface in netifaces.interfaces() if (iface not in excluded)] | gets interfaces | pydreamscreen/network/discover.py | get_interfaces | J3n50m4t/pydreamscreen | 5 | python | def get_interfaces(excluded=None):
excluded = (excluded or [])
return [iface for iface in netifaces.interfaces() if (iface not in excluded)] | def get_interfaces(excluded=None):
excluded = (excluded or [])
return [iface for iface in netifaces.interfaces() if (iface not in excluded)]<|docstring|>gets interfaces<|endoftext|> |
90f51302f4540ab3adee23ab2b678884b6b6952181f24360bb222b3951b798be | def get_networks(excluded=None):
'gets networks'
excluded = (excluded or [])
return [netifaces.ifaddresses(iface)[netifaces.AF_INET] for iface in get_interfaces(excluded) if (netifaces.AF_INET in netifaces.ifaddresses(iface))] | gets networks | pydreamscreen/network/discover.py | get_networks | J3n50m4t/pydreamscreen | 5 | python | def get_networks(excluded=None):
excluded = (excluded or [])
return [netifaces.ifaddresses(iface)[netifaces.AF_INET] for iface in get_interfaces(excluded) if (netifaces.AF_INET in netifaces.ifaddresses(iface))] | def get_networks(excluded=None):
excluded = (excluded or [])
return [netifaces.ifaddresses(iface)[netifaces.AF_INET] for iface in get_interfaces(excluded) if (netifaces.AF_INET in netifaces.ifaddresses(iface))]<|docstring|>gets networks<|endoftext|> |
0be0a4327d00136faeaa146aa90dfcd0521ea48a63929f8d066216beb959a94d | def get_broadcasts(excluded=None):
'gets broadcasts'
excluded = (excluded or [])
return [addr['broadcast'] for addresses in get_networks(excluded) for addr in addresses if ('broadcast' in addr.keys())] | gets broadcasts | pydreamscreen/network/discover.py | get_broadcasts | J3n50m4t/pydreamscreen | 5 | python | def get_broadcasts(excluded=None):
excluded = (excluded or [])
return [addr['broadcast'] for addresses in get_networks(excluded) for addr in addresses if ('broadcast' in addr.keys())] | def get_broadcasts(excluded=None):
excluded = (excluded or [])
return [addr['broadcast'] for addresses in get_networks(excluded) for addr in addresses if ('broadcast' in addr.keys())]<|docstring|>gets broadcasts<|endoftext|> |
55462288b97d2b0be344a13bfe4b32d558729f93b1583dffc8480e5ed7b1c8ae | def simple_offset(observation, catalog, wcsprm, report=''):
'Get best offset in x, y direction.\n\n Parameters\n ----------\n observation : dataframe\n pandas dataframe with sources on the observation\n catalog : dataframe\n pandas dataframe with nearby sources from online catalogs with ac... | Get best offset in x, y direction.
Parameters
----------
observation : dataframe
pandas dataframe with sources on the observation
catalog : dataframe
pandas dataframe with nearby sources from online catalogs with accurate astrometric information
wcsprm
Wold coordinates file
report : str
Previous part o... | get_transformation.py | simple_offset | fanff/astrometry | 9 | python | def simple_offset(observation, catalog, wcsprm, report=):
'Get best offset in x, y direction.\n\n Parameters\n ----------\n observation : dataframe\n pandas dataframe with sources on the observation\n catalog : dataframe\n pandas dataframe with nearby sources from online catalogs with accu... | def simple_offset(observation, catalog, wcsprm, report=):
'Get best offset in x, y direction.\n\n Parameters\n ----------\n observation : dataframe\n pandas dataframe with sources on the observation\n catalog : dataframe\n pandas dataframe with nearby sources from online catalogs with accu... |
0f24159b683eab7aab03c56afc42c0bd71c77b532a7b27b02400d59304bf6745 | def rotate(wcsprm, rot):
'Help method for offset_with_orientation. Set the different rotations in the header.'
pc = wcsprm.get_pc()
pc_rotated = (rot @ pc)
wcsprm.pc = pc_rotated
return wcsprm | Help method for offset_with_orientation. Set the different rotations in the header. | get_transformation.py | rotate | fanff/astrometry | 9 | python | def rotate(wcsprm, rot):
pc = wcsprm.get_pc()
pc_rotated = (rot @ pc)
wcsprm.pc = pc_rotated
return wcsprm | def rotate(wcsprm, rot):
pc = wcsprm.get_pc()
pc_rotated = (rot @ pc)
wcsprm.pc = pc_rotated
return wcsprm<|docstring|>Help method for offset_with_orientation. Set the different rotations in the header.<|endoftext|> |
c7555f265fca8ad30ab4072308e776bb70b48b59c22f2360140166964b43afce | def offset_with_orientation(observation, catalog, wcsprm, verbose=True, fast=False, report_global='', INCREASE_FOV_FLAG=False, silent=False):
'Use simple_offset(...) but with trying 0,90,180,270 rotation.\n\n Parameters\n ----------\n observation : dataframe\n pandas dataframe with sources on the ob... | Use simple_offset(...) but with trying 0,90,180,270 rotation.
Parameters
----------
observation : dataframe
pandas dataframe with sources on the observation
catalog : dataframe
pandas dataframe with nearby sources from online catalogs with accurate astrometric information
wcsprm
Wcsprm file
verbose : boole... | get_transformation.py | offset_with_orientation | fanff/astrometry | 9 | python | def offset_with_orientation(observation, catalog, wcsprm, verbose=True, fast=False, report_global=, INCREASE_FOV_FLAG=False, silent=False):
'Use simple_offset(...) but with trying 0,90,180,270 rotation.\n\n Parameters\n ----------\n observation : dataframe\n pandas dataframe with sources on the obse... | def offset_with_orientation(observation, catalog, wcsprm, verbose=True, fast=False, report_global=, INCREASE_FOV_FLAG=False, silent=False):
'Use simple_offset(...) but with trying 0,90,180,270 rotation.\n\n Parameters\n ----------\n observation : dataframe\n pandas dataframe with sources on the obse... |
09940ae06a567f08fc71d1f47ce8d9499a8007328cf11aebfe4971ea1b088882 | def peak_with_histogram(obs_x, obs_y, cat_x, cat_y):
'Find the relation between the two sets. Either the positional offset (not used for that at the moment) or the scale+angle between them.\n\n This should be replaced with a method using convolution instead. Also currently the bandwith is choosen quite random\n\... | Find the relation between the two sets. Either the positional offset (not used for that at the moment) or the scale+angle between them.
This should be replaced with a method using convolution instead. Also currently the bandwith is choosen quite random
Parameters
----------
obs_x: array
first axis to consider of ... | get_transformation.py | peak_with_histogram | fanff/astrometry | 9 | python | def peak_with_histogram(obs_x, obs_y, cat_x, cat_y):
'Find the relation between the two sets. Either the positional offset (not used for that at the moment) or the scale+angle between them.\n\n This should be replaced with a method using convolution instead. Also currently the bandwith is choosen quite random\n\... | def peak_with_histogram(obs_x, obs_y, cat_x, cat_y):
'Find the relation between the two sets. Either the positional offset (not used for that at the moment) or the scale+angle between them.\n\n This should be replaced with a method using convolution instead. Also currently the bandwith is choosen quite random\n\... |
166cda7899dc3611e8c3d80a1c839f8d7e7e7abbc4449ad9bfbfa3618976c8ee | def cross_corr_to_fourier_space(a):
'Tranform 2D array into fourier space. Uses padding and normalization.'
aa = ((a - np.mean(a)) / np.std(a))
aaa = np.pad(aa, (2, 2), 'constant')
ff_a = np.fft.fft2(aaa)
return ff_a | Tranform 2D array into fourier space. Uses padding and normalization. | get_transformation.py | cross_corr_to_fourier_space | fanff/astrometry | 9 | python | def cross_corr_to_fourier_space(a):
aa = ((a - np.mean(a)) / np.std(a))
aaa = np.pad(aa, (2, 2), 'constant')
ff_a = np.fft.fft2(aaa)
return ff_a | def cross_corr_to_fourier_space(a):
aa = ((a - np.mean(a)) / np.std(a))
aaa = np.pad(aa, (2, 2), 'constant')
ff_a = np.fft.fft2(aaa)
return ff_a<|docstring|>Tranform 2D array into fourier space. Uses padding and normalization.<|endoftext|> |
13abc06fdd1563570c1cc4c226e875588d848c9cae835812fbfa43b4b87ba1c4 | def peak_with_cross_correlation(log_distance_obs, angle_obs, log_distance_cat, angle_cat, scale_guessed=False):
'Find the relation between the two sets. Either the positional offset (not used for that at the moment) or the scale+angle between them.\n\n This is using cross correlation\n\n Parameters\n -----... | Find the relation between the two sets. Either the positional offset (not used for that at the moment) or the scale+angle between them.
This is using cross correlation
Parameters
----------
log_distance_obs: array
first axis to consider of observations ( log distance)
angle_obs: array
second axis to consider ... | get_transformation.py | peak_with_cross_correlation | fanff/astrometry | 9 | python | def peak_with_cross_correlation(log_distance_obs, angle_obs, log_distance_cat, angle_cat, scale_guessed=False):
'Find the relation between the two sets. Either the positional offset (not used for that at the moment) or the scale+angle between them.\n\n This is using cross correlation\n\n Parameters\n -----... | def peak_with_cross_correlation(log_distance_obs, angle_obs, log_distance_cat, angle_cat, scale_guessed=False):
'Find the relation between the two sets. Either the positional offset (not used for that at the moment) or the scale+angle between them.\n\n This is using cross correlation\n\n Parameters\n -----... |
41ae4a27af67f82f301cdda808535cc2dbfa6e13224f39147880c9e3d23e2a97 | def get_scaling_and_rotation(observation, catalog, wcsprm, scale_guessed, verbose=True, report_global={}):
'Calculate the scaling and rotation compared to the catalog based on the method of Kaiser et al. (1999).\n\n This should be quite similar to the approach by SCAMP.\n\n Parameters\n ----------\n obs... | Calculate the scaling and rotation compared to the catalog based on the method of Kaiser et al. (1999).
This should be quite similar to the approach by SCAMP.
Parameters
----------
observation : dataframe
pandas dataframe with sources on the observation
catalog : dataframe
pandas dataframe with nearby sources... | get_transformation.py | get_scaling_and_rotation | fanff/astrometry | 9 | python | def get_scaling_and_rotation(observation, catalog, wcsprm, scale_guessed, verbose=True, report_global={}):
'Calculate the scaling and rotation compared to the catalog based on the method of Kaiser et al. (1999).\n\n This should be quite similar to the approach by SCAMP.\n\n Parameters\n ----------\n obs... | def get_scaling_and_rotation(observation, catalog, wcsprm, scale_guessed, verbose=True, report_global={}):
'Calculate the scaling and rotation compared to the catalog based on the method of Kaiser et al. (1999).\n\n This should be quite similar to the approach by SCAMP.\n\n Parameters\n ----------\n obs... |
920694a33ac7d303ca99a5e1a7f5f60ac9b8183223ee7124121023d38e30cd2f | def calculate_rms(observation, catalog, wcsprm):
'Calculate the root mean square deviation of the astrometry fit'
on_sky = wcsprm.p2s([[0, 0], [1, 1]], 0)['world']
px_scale = np.sqrt((((on_sky[(0, 0)] - on_sky[(1, 0)]) ** 2) + ((on_sky[(0, 1)] - on_sky[(1, 1)]) ** 2)))
px_scale = ((px_scale * 60) * 60)
... | Calculate the root mean square deviation of the astrometry fit | get_transformation.py | calculate_rms | fanff/astrometry | 9 | python | def calculate_rms(observation, catalog, wcsprm):
on_sky = wcsprm.p2s([[0, 0], [1, 1]], 0)['world']
px_scale = np.sqrt((((on_sky[(0, 0)] - on_sky[(1, 0)]) ** 2) + ((on_sky[(0, 1)] - on_sky[(1, 1)]) ** 2)))
px_scale = ((px_scale * 60) * 60)
(obs_x, obs_y, cat_x, cat_y, distances) = find_matches(obser... | def calculate_rms(observation, catalog, wcsprm):
on_sky = wcsprm.p2s([[0, 0], [1, 1]], 0)['world']
px_scale = np.sqrt((((on_sky[(0, 0)] - on_sky[(1, 0)]) ** 2) + ((on_sky[(0, 1)] - on_sky[(1, 1)]) ** 2)))
px_scale = ((px_scale * 60) * 60)
(obs_x, obs_y, cat_x, cat_y, distances) = find_matches(obser... |
9a6f41bfca8eec48b833a5a15e2d98ec8e74f9c3eb82a4bd9069888224b8ab6b | def fine_transformation(observation, catalog, wcsprm, threshold=1, verbose=True, compare_threshold=3, skip_rot_scale=False):
'Final improvement of registration. This requires that the wcs is already accurate to a few pixels.\n\n Parameters\n ----------\n observation : dataframe\n pandas dataframe wi... | Final improvement of registration. This requires that the wcs is already accurate to a few pixels.
Parameters
----------
observation : dataframe
pandas dataframe with sources on the observation
catalog : dataframe
pandas dataframe with nearby sources from online catalogs with accurate astrometric information
w... | get_transformation.py | fine_transformation | fanff/astrometry | 9 | python | def fine_transformation(observation, catalog, wcsprm, threshold=1, verbose=True, compare_threshold=3, skip_rot_scale=False):
'Final improvement of registration. This requires that the wcs is already accurate to a few pixels.\n\n Parameters\n ----------\n observation : dataframe\n pandas dataframe wi... | def fine_transformation(observation, catalog, wcsprm, threshold=1, verbose=True, compare_threshold=3, skip_rot_scale=False):
'Final improvement of registration. This requires that the wcs is already accurate to a few pixels.\n\n Parameters\n ----------\n observation : dataframe\n pandas dataframe wi... |
02eb6782424b03d6f8ea0bb3580961427fb58151f98707b764fbfecc9e4b7267 | def wait(wait_fn, wait_complete_fn, timeout=None, spin_cb=None):
"Blocks waiting for an event without blocking the thread indefinitely.\n\n See https://github.com/grpc/grpc/issues/19464 for full context. CPython's\n `threading.Event.wait` and `threading.Condition.wait` methods, if invoked\n without a timeo... | Blocks waiting for an event without blocking the thread indefinitely.
See https://github.com/grpc/grpc/issues/19464 for full context. CPython's
`threading.Event.wait` and `threading.Condition.wait` methods, if invoked
without a timeout kwarg, may block the calling thread indefinitely. If the
call is made from the main... | src/python/grpcio/grpc/_common.py | wait | nextgenadarsh/grpc | 9 | python | def wait(wait_fn, wait_complete_fn, timeout=None, spin_cb=None):
"Blocks waiting for an event without blocking the thread indefinitely.\n\n See https://github.com/grpc/grpc/issues/19464 for full context. CPython's\n `threading.Event.wait` and `threading.Condition.wait` methods, if invoked\n without a timeo... | def wait(wait_fn, wait_complete_fn, timeout=None, spin_cb=None):
"Blocks waiting for an event without blocking the thread indefinitely.\n\n See https://github.com/grpc/grpc/issues/19464 for full context. CPython's\n `threading.Event.wait` and `threading.Condition.wait` methods, if invoked\n without a timeo... |
632987084d13b591ee8773c35211d2d4a585f4a9c7645bea98bbf0d4827ffdea | def make_forcing(ds_trajectory, ds_domain, levels_definition, sampling_method):
'\n Make a forcing profiles along ds_trajectory using data in ds_domain.\n\n See domains.utils.levels.LevelsDefinition and domains.era5.SamplingMethodDefinition\n for how to construct levels_definition and sampling_method objec... | Make a forcing profiles along ds_trajectory using data in ds_domain.
See domains.utils.levels.LevelsDefinition and domains.era5.SamplingMethodDefinition
for how to construct levels_definition and sampling_method objects | lagtraj/forcings/create.py | make_forcing | BuildJet/lagtraj | 4 | python | def make_forcing(ds_trajectory, ds_domain, levels_definition, sampling_method):
'\n Make a forcing profiles along ds_trajectory using data in ds_domain.\n\n See domains.utils.levels.LevelsDefinition and domains.era5.SamplingMethodDefinition\n for how to construct levels_definition and sampling_method objec... | def make_forcing(ds_trajectory, ds_domain, levels_definition, sampling_method):
'\n Make a forcing profiles along ds_trajectory using data in ds_domain.\n\n See domains.utils.levels.LevelsDefinition and domains.era5.SamplingMethodDefinition\n for how to construct levels_definition and sampling_method objec... |
57a7b86fa3f129510de75877eb6bd5a8449d3766ec9f44a627061a0185de882c | def cli(args=None):
'\n Function called with arguments passed from the command line when making\n trajectories through the CLI. When `args==None` they will be taken from\n `sys.argv`\n '
import argparse
argparser = argparse.ArgumentParser()
argparser.add_argument('forcing')
argparser.add... | Function called with arguments passed from the command line when making
trajectories through the CLI. When `args==None` they will be taken from
`sys.argv` | lagtraj/forcings/create.py | cli | BuildJet/lagtraj | 4 | python | def cli(args=None):
'\n Function called with arguments passed from the command line when making\n trajectories through the CLI. When `args==None` they will be taken from\n `sys.argv`\n '
import argparse
argparser = argparse.ArgumentParser()
argparser.add_argument('forcing')
argparser.add... | def cli(args=None):
'\n Function called with arguments passed from the command line when making\n trajectories through the CLI. When `args==None` they will be taken from\n `sys.argv`\n '
import argparse
argparser = argparse.ArgumentParser()
argparser.add_argument('forcing')
argparser.add... |
6a857409926dd0946594b6a56540cdf7578fe7d9407cef30e07644bcc5e3bfe9 | def visstd(a, s=0.1):
'\n Normalise the image range for visualisation.\n :param a: the array to normalise\n :param s: ?\n :return: the normalised image\n '
return ((((a - a.mean()) / max(a.std(), 0.0001)) * s) + 0.5) | Normalise the image range for visualisation.
:param a: the array to normalise
:param s: ?
:return: the normalised image | multiscale_dreaming.py | visstd | EdCo95/deepdream | 2 | python | def visstd(a, s=0.1):
'\n Normalise the image range for visualisation.\n :param a: the array to normalise\n :param s: ?\n :return: the normalised image\n '
return ((((a - a.mean()) / max(a.std(), 0.0001)) * s) + 0.5) | def visstd(a, s=0.1):
'\n Normalise the image range for visualisation.\n :param a: the array to normalise\n :param s: ?\n :return: the normalised image\n '
return ((((a - a.mean()) / max(a.std(), 0.0001)) * s) + 0.5)<|docstring|>Normalise the image range for visualisation.
:param a: the array to ... |
cbeecb4878e1cbe9a5d0e3a6d788730a65362c8f0792ab4e4eb524db563e57e2 | def T(layer):
"\n Convenience function for getting a layer's output tensor\n :param layer: the layer to get the tensor\n :return: the tensor\n "
return graph.get_tensor_by_name(('import/%s:0' % layer)) | Convenience function for getting a layer's output tensor
:param layer: the layer to get the tensor
:return: the tensor | multiscale_dreaming.py | T | EdCo95/deepdream | 2 | python | def T(layer):
"\n Convenience function for getting a layer's output tensor\n :param layer: the layer to get the tensor\n :return: the tensor\n "
return graph.get_tensor_by_name(('import/%s:0' % layer)) | def T(layer):
"\n Convenience function for getting a layer's output tensor\n :param layer: the layer to get the tensor\n :return: the tensor\n "
return graph.get_tensor_by_name(('import/%s:0' % layer))<|docstring|>Convenience function for getting a layer's output tensor
:param layer: the layer to ge... |
a24aeb003041c1c5deb909b6680d2493f0575312f224c5b9b8b3bf5f67710c29 | def tffunc(*argtypes):
'\n Helper function that transforms the TF-graph generating function into a regular one - used to resize the image with\n Tensorflow in combination with the "resize" function below.\n :param argtypes: multiple parameters.\n :return: a normal function\n '
placeholders = list... | Helper function that transforms the TF-graph generating function into a regular one - used to resize the image with
Tensorflow in combination with the "resize" function below.
:param argtypes: multiple parameters.
:return: a normal function | multiscale_dreaming.py | tffunc | EdCo95/deepdream | 2 | python | def tffunc(*argtypes):
'\n Helper function that transforms the TF-graph generating function into a regular one - used to resize the image with\n Tensorflow in combination with the "resize" function below.\n :param argtypes: multiple parameters.\n :return: a normal function\n '
placeholders = list... | def tffunc(*argtypes):
'\n Helper function that transforms the TF-graph generating function into a regular one - used to resize the image with\n Tensorflow in combination with the "resize" function below.\n :param argtypes: multiple parameters.\n :return: a normal function\n '
placeholders = list... |
578fd17f2a679d1ade1b513215fb00cb579c95567e60384777aba8c084c20ee7 | def resize(img, size):
'\n Resizes and image using Tensorflow. Works in tandem with tffunc, above.\n :param img: the image to resize.\n :param size: the size to change the image to.\n :return: the resized image.\n '
img = tf.expand_dims(img, 0)
return tf.image.resize_bilinear(img, size)[(0, :... | Resizes and image using Tensorflow. Works in tandem with tffunc, above.
:param img: the image to resize.
:param size: the size to change the image to.
:return: the resized image. | multiscale_dreaming.py | resize | EdCo95/deepdream | 2 | python | def resize(img, size):
'\n Resizes and image using Tensorflow. Works in tandem with tffunc, above.\n :param img: the image to resize.\n :param size: the size to change the image to.\n :return: the resized image.\n '
img = tf.expand_dims(img, 0)
return tf.image.resize_bilinear(img, size)[(0, :... | def resize(img, size):
'\n Resizes and image using Tensorflow. Works in tandem with tffunc, above.\n :param img: the image to resize.\n :param size: the size to change the image to.\n :return: the resized image.\n '
img = tf.expand_dims(img, 0)
return tf.image.resize_bilinear(img, size)[(0, :... |
74dd05ea2d065c6a5074cc221ec55e3e49593558ed231de4386c89bbd1e0b482 | def calc_grad_tiled(img, t_grad, tile_size=512):
'\n Computes the value of tensor t_grad over the image in a tiled way. Random shifts are applied to the image to blur\n tile boundaries over multiple iterations.\n :param img: the image to modify.\n :param t_grad: the gradient to compute, as a TensorFlow ... | Computes the value of tensor t_grad over the image in a tiled way. Random shifts are applied to the image to blur
tile boundaries over multiple iterations.
:param img: the image to modify.
:param t_grad: the gradient to compute, as a TensorFlow operation.
:param tile_size: the size of each image tile.
:return: the rand... | multiscale_dreaming.py | calc_grad_tiled | EdCo95/deepdream | 2 | python | def calc_grad_tiled(img, t_grad, tile_size=512):
'\n Computes the value of tensor t_grad over the image in a tiled way. Random shifts are applied to the image to blur\n tile boundaries over multiple iterations.\n :param img: the image to modify.\n :param t_grad: the gradient to compute, as a TensorFlow ... | def calc_grad_tiled(img, t_grad, tile_size=512):
'\n Computes the value of tensor t_grad over the image in a tiled way. Random shifts are applied to the image to blur\n tile boundaries over multiple iterations.\n :param img: the image to modify.\n :param t_grad: the gradient to compute, as a TensorFlow ... |
0b8648a3bcea19354ed6f3e560f7aa511a43b6c30fe99750889d2090f96d90f6 | def render_multiscale(t_obj, img0, iter_n=10, step=1.0, octave_n=3, octave_scale=1.4):
'\n Renders the image at different sizes.\n :param t_obj: the objective to render.\n :param img0: the image to alter.\n :param iter_n: the number of iterations of changes to apply.\n :param step: the step size for ... | Renders the image at different sizes.
:param t_obj: the objective to render.
:param img0: the image to alter.
:param iter_n: the number of iterations of changes to apply.
:param step: the step size for each image alteration.
:param octave_n: the number of different octaves to scale over.
:param octave_scale: scale up t... | multiscale_dreaming.py | render_multiscale | EdCo95/deepdream | 2 | python | def render_multiscale(t_obj, img0, iter_n=10, step=1.0, octave_n=3, octave_scale=1.4):
'\n Renders the image at different sizes.\n :param t_obj: the objective to render.\n :param img0: the image to alter.\n :param iter_n: the number of iterations of changes to apply.\n :param step: the step size for ... | def render_multiscale(t_obj, img0, iter_n=10, step=1.0, octave_n=3, octave_scale=1.4):
'\n Renders the image at different sizes.\n :param t_obj: the objective to render.\n :param img0: the image to alter.\n :param iter_n: the number of iterations of changes to apply.\n :param step: the step size for ... |
184a3270e87ad16f90b1f5b8023b5700711c3b347ff4a043c4b1cad4cfb4cbbf | def concatFreeTimes(currentFreeTimes, userFreeTimes, begin_date, end_date):
'\n This function takes two lists of free times and combines them\n Then crops out any resulting free times that are less than a minute long\n Then formats the list to ready it for insertion into the database\n '
updatedFree... | This function takes two lists of free times and combines them
Then crops out any resulting free times that are less than a minute long
Then formats the list to ready it for insertion into the database | meetings/calculations.py | concatFreeTimes | kaschaefer/MeetMe | 0 | python | def concatFreeTimes(currentFreeTimes, userFreeTimes, begin_date, end_date):
'\n This function takes two lists of free times and combines them\n Then crops out any resulting free times that are less than a minute long\n Then formats the list to ready it for insertion into the database\n '
updatedFree... | def concatFreeTimes(currentFreeTimes, userFreeTimes, begin_date, end_date):
'\n This function takes two lists of free times and combines them\n Then crops out any resulting free times that are less than a minute long\n Then formats the list to ready it for insertion into the database\n '
updatedFree... |
0c6c822759f571f873800f445748b78acc4e7b9b5c2010569eb3e3f12fbb7a0d | def add_item_offset(token, sentence):
'Get the start and end offset of a token in a sentence'
s_pattern = re.compile(re.escape(token), re.I)
token_offset_list = []
for m in s_pattern.finditer(sentence):
token_offset_list.append((m.group(), m.start(), m.end()))
return token_offset_list | Get the start and end offset of a token in a sentence | legacy/explore/statistic.py | add_item_offset | zhongyuchen/information-extraction | 2 | python | def add_item_offset(token, sentence):
s_pattern = re.compile(re.escape(token), re.I)
token_offset_list = []
for m in s_pattern.finditer(sentence):
token_offset_list.append((m.group(), m.start(), m.end()))
return token_offset_list | def add_item_offset(token, sentence):
s_pattern = re.compile(re.escape(token), re.I)
token_offset_list = []
for m in s_pattern.finditer(sentence):
token_offset_list.append((m.group(), m.start(), m.end()))
return token_offset_list<|docstring|>Get the start and end offset of a token in a sent... |
aacd3e23befb4300e58d2cd5f115c58dfa3c25b64e12841acbbefdfcce8b098d | def cal_item_pos(target_offset, idx_list):
'Get the index list where the token is located'
target_idx = []
for target in target_offset:
(start, end) = (target[1], target[2])
cur_idx = []
for (i, idx) in enumerate(idx_list):
if ((idx >= start) and (idx < end)):
... | Get the index list where the token is located | legacy/explore/statistic.py | cal_item_pos | zhongyuchen/information-extraction | 2 | python | def cal_item_pos(target_offset, idx_list):
target_idx = []
for target in target_offset:
(start, end) = (target[1], target[2])
cur_idx = []
for (i, idx) in enumerate(idx_list):
if ((idx >= start) and (idx < end)):
cur_idx.append(i)
if (len(cur_idx)... | def cal_item_pos(target_offset, idx_list):
target_idx = []
for target in target_offset:
(start, end) = (target[1], target[2])
cur_idx = []
for (i, idx) in enumerate(idx_list):
if ((idx >= start) and (idx < end)):
cur_idx.append(i)
if (len(cur_idx)... |
ba90065091e4c9c5a488d21d866adcb9f68103e45ea9155444792f07e65c73e9 | def subtract(a, b):
'Subtract a from b and return value'
return (b - a) | Subtract a from b and return value | app/deleted_files/calc.py | subtract | simeon-s/recipe-app-api | 0 | python | def subtract(a, b):
return (b - a) | def subtract(a, b):
return (b - a)<|docstring|>Subtract a from b and return value<|endoftext|> |
2cabb5b43715b0eba8a5faf498ffb780f62cb83a344c576654ab04119d83f25a | def getSettings():
'\n Returns:\n The construct settings object.\n '
return settings | Returns:
The construct settings object. | settings/settings.py | getSettings | Unknowncmbk/Pokemon-Go-Locator-Server | 0 | python | def getSettings():
'\n Returns:\n The construct settings object.\n '
return settings | def getSettings():
'\n Returns:\n The construct settings object.\n '
return settings<|docstring|>Returns:
The construct settings object.<|endoftext|> |
68118909ae7716531883889a9338e4875e244b71841846b43a5fc3509e0a9278 | def getDatabase():
'\n Returns: \n The database connection.\n '
try:
return settings.db_cxn
except Exception as e:
print(('Unable to grab DB connection ' % e)) | Returns:
The database connection. | settings/settings.py | getDatabase | Unknowncmbk/Pokemon-Go-Locator-Server | 0 | python | def getDatabase():
'\n Returns: \n The database connection.\n '
try:
return settings.db_cxn
except Exception as e:
print(('Unable to grab DB connection ' % e)) | def getDatabase():
'\n Returns: \n The database connection.\n '
try:
return settings.db_cxn
except Exception as e:
print(('Unable to grab DB connection ' % e))<|docstring|>Returns:
The database connection.<|endoftext|> |
cfad5309110a2213500f809626e9ec16940a8f151b6c18e77f707542a88f6c53 | def close(self):
'\n Closes the DB connection\n '
try:
self.db_cxn.close()
except Exception as e:
print(('Unable to close DB connection ' % e)) | Closes the DB connection | settings/settings.py | close | Unknowncmbk/Pokemon-Go-Locator-Server | 0 | python | def close(self):
'\n \n '
try:
self.db_cxn.close()
except Exception as e:
print(('Unable to close DB connection ' % e)) | def close(self):
'\n \n '
try:
self.db_cxn.close()
except Exception as e:
print(('Unable to close DB connection ' % e))<|docstring|>Closes the DB connection<|endoftext|> |
887fe3c5ba52a551c22bb0f8b6dceafe03889dd2475c20c28c5a22467c26aa08 | def __init__(self, est, target=None, transformer_pipeline=None, client=None, booster=None, classes=None, name=None):
'\n Construct an ADSModel\n\n Parameters\n ----------\n est: fitted estimator object\n The estimator can be a standard sklearn estimator, a keras, lightgbm, or ... | Construct an ADSModel
Parameters
----------
est: fitted estimator object
The estimator can be a standard sklearn estimator, a keras, lightgbm, or xgboost estimator, or any other object that implement methods from
(BaseEstimator, RegressorMixin) for regression or (BaseEstimator, ClassifierMixin) for classificat... | ads/common/model.py | __init__ | oracle/accelerated-data-science | 20 | python | def __init__(self, est, target=None, transformer_pipeline=None, client=None, booster=None, classes=None, name=None):
'\n Construct an ADSModel\n\n Parameters\n ----------\n est: fitted estimator object\n The estimator can be a standard sklearn estimator, a keras, lightgbm, or ... | def __init__(self, est, target=None, transformer_pipeline=None, client=None, booster=None, classes=None, name=None):
'\n Construct an ADSModel\n\n Parameters\n ----------\n est: fitted estimator object\n The estimator can be a standard sklearn estimator, a keras, lightgbm, or ... |
814a0742595adc411825a998bf1ac4c7ba0f999941c572f7663db7dc97706621 | @staticmethod
def from_estimator(est, transformers=None, classes=None, name=None):
'\n Build ADSModel from a fitted estimator\n\n Parameters\n ----------\n est: fitted estimator object\n The estimator can be a standard sklearn estimator or any object that implement methods fro... | Build ADSModel from a fitted estimator
Parameters
----------
est: fitted estimator object
The estimator can be a standard sklearn estimator or any object that implement methods from
(BaseEstimator, RegressorMixin) for regression or (BaseEstimator, ClassifierMixin) for classification.
transformers: a scalar or ... | ads/common/model.py | from_estimator | oracle/accelerated-data-science | 20 | python | @staticmethod
def from_estimator(est, transformers=None, classes=None, name=None):
'\n Build ADSModel from a fitted estimator\n\n Parameters\n ----------\n est: fitted estimator object\n The estimator can be a standard sklearn estimator or any object that implement methods fro... | @staticmethod
def from_estimator(est, transformers=None, classes=None, name=None):
'\n Build ADSModel from a fitted estimator\n\n Parameters\n ----------\n est: fitted estimator object\n The estimator can be a standard sklearn estimator or any object that implement methods fro... |
dc5077e92701500584990c5cfd9835a63b87e8e7caa84afe4b2893530794cca1 | def rename(self, name):
'\n Changes the name of a model\n\n Parameters\n ----------\n name: str\n A string which is supplied for naming a model.\n '
self.name = name | Changes the name of a model
Parameters
----------
name: str
A string which is supplied for naming a model. | ads/common/model.py | rename | oracle/accelerated-data-science | 20 | python | def rename(self, name):
'\n Changes the name of a model\n\n Parameters\n ----------\n name: str\n A string which is supplied for naming a model.\n '
self.name = name | def rename(self, name):
'\n Changes the name of a model\n\n Parameters\n ----------\n name: str\n A string which is supplied for naming a model.\n '
self.name = name<|docstring|>Changes the name of a model
Parameters
----------
name: str
A string which is suppl... |
6cc3b0e576e18151b7b983b33f91daaed9eeccb5be374b2aff57e8d695ff28cd | def predict(self, X):
'\n Runs the models predict function on some data\n\n Parameters\n ----------\n X: MLData\n A MLData object which holds the examples to be predicted on.\n\n Returns\n -------\n Union[List, pandas.Series], depending on the estimator\n ... | Runs the models predict function on some data
Parameters
----------
X: MLData
A MLData object which holds the examples to be predicted on.
Returns
-------
Union[List, pandas.Series], depending on the estimator
Usually a list or PandasSeries of predictions | ads/common/model.py | predict | oracle/accelerated-data-science | 20 | python | def predict(self, X):
'\n Runs the models predict function on some data\n\n Parameters\n ----------\n X: MLData\n A MLData object which holds the examples to be predicted on.\n\n Returns\n -------\n Union[List, pandas.Series], depending on the estimator\n ... | def predict(self, X):
'\n Runs the models predict function on some data\n\n Parameters\n ----------\n X: MLData\n A MLData object which holds the examples to be predicted on.\n\n Returns\n -------\n Union[List, pandas.Series], depending on the estimator\n ... |
13693e79e9a4e36f342524085450aafab811d8b6a5f159ee31518cd2a4856170 | def predict_proba(self, X):
'\n Runs the models predict probabilities function on some data\n\n Parameters\n ----------\n X: MLData\n A MLData object which holds the examples to be predicted on.\n\n Returns\n -------\n Union[List, pandas.Series], depending... | Runs the models predict probabilities function on some data
Parameters
----------
X: MLData
A MLData object which holds the examples to be predicted on.
Returns
-------
Union[List, pandas.Series], depending on the estimator
Usually a list or PandasSeries of predictions | ads/common/model.py | predict_proba | oracle/accelerated-data-science | 20 | python | def predict_proba(self, X):
'\n Runs the models predict probabilities function on some data\n\n Parameters\n ----------\n X: MLData\n A MLData object which holds the examples to be predicted on.\n\n Returns\n -------\n Union[List, pandas.Series], depending... | def predict_proba(self, X):
'\n Runs the models predict probabilities function on some data\n\n Parameters\n ----------\n X: MLData\n A MLData object which holds the examples to be predicted on.\n\n Returns\n -------\n Union[List, pandas.Series], depending... |
1422fe730d4e4ae51186ea18755190977242125bd1d1615f182e3b6979a97bfc | def score(self, X, y_true, score_fn=None):
'\n Scores a model according to a custom score function\n\n Parameters\n ----------\n X: MLData\n A MLData object which holds the examples to be predicted on.\n y_true: MLData\n A MLData object which holds ground tru... | Scores a model according to a custom score function
Parameters
----------
X: MLData
A MLData object which holds the examples to be predicted on.
y_true: MLData
A MLData object which holds ground truth labels for the examples which are being predicted on.
score_fn: Scorer (callable)
A callable object that r... | ads/common/model.py | score | oracle/accelerated-data-science | 20 | python | def score(self, X, y_true, score_fn=None):
'\n Scores a model according to a custom score function\n\n Parameters\n ----------\n X: MLData\n A MLData object which holds the examples to be predicted on.\n y_true: MLData\n A MLData object which holds ground tru... | def score(self, X, y_true, score_fn=None):
'\n Scores a model according to a custom score function\n\n Parameters\n ----------\n X: MLData\n A MLData object which holds the examples to be predicted on.\n y_true: MLData\n A MLData object which holds ground tru... |
5a3bb02db0787996874abb41eb25457e655c1fb7d42c9b568463ef21be70abfd | def summary(self):
'\n A summary of the ADSModel\n '
print(self) | A summary of the ADSModel | ads/common/model.py | summary | oracle/accelerated-data-science | 20 | python | def summary(self):
'\n \n '
print(self) | def summary(self):
'\n \n '
print(self)<|docstring|>A summary of the ADSModel<|endoftext|> |
7750cea841f507bcfbf659d327de36a86f9f2b2a994173a4bbccbc979f9a81e4 | def transform(self, X):
'\n Process some MLData through the selected ADSModel transformers\n\n Parameters\n ----------\n X: MLData\n A MLData object which holds the examples to be transformed.\n '
if hasattr(X, 'copy'):
X = X.copy()
if (self.transformer_... | Process some MLData through the selected ADSModel transformers
Parameters
----------
X: MLData
A MLData object which holds the examples to be transformed. | ads/common/model.py | transform | oracle/accelerated-data-science | 20 | python | def transform(self, X):
'\n Process some MLData through the selected ADSModel transformers\n\n Parameters\n ----------\n X: MLData\n A MLData object which holds the examples to be transformed.\n '
if hasattr(X, 'copy'):
X = X.copy()
if (self.transformer_... | def transform(self, X):
'\n Process some MLData through the selected ADSModel transformers\n\n Parameters\n ----------\n X: MLData\n A MLData object which holds the examples to be transformed.\n '
if hasattr(X, 'copy'):
X = X.copy()
if (self.transformer_... |
c05314f01faefdd2f7778f167371d19e61b74379a7da02109374d104df9c8962 | def is_classifier(self):
'\n Returns True if ADS believes that the model is a classifier\n\n Returns\n -------\n Boolean: True if the model is a classifier, False otherwise.\n '
return (hasattr(self, 'classes_') and (self.classes_ is not None)) | Returns True if ADS believes that the model is a classifier
Returns
-------
Boolean: True if the model is a classifier, False otherwise. | ads/common/model.py | is_classifier | oracle/accelerated-data-science | 20 | python | def is_classifier(self):
'\n Returns True if ADS believes that the model is a classifier\n\n Returns\n -------\n Boolean: True if the model is a classifier, False otherwise.\n '
return (hasattr(self, 'classes_') and (self.classes_ is not None)) | def is_classifier(self):
'\n Returns True if ADS believes that the model is a classifier\n\n Returns\n -------\n Boolean: True if the model is a classifier, False otherwise.\n '
return (hasattr(self, 'classes_') and (self.classes_ is not None))<|docstring|>Returns True if ADS ... |
a65d2f80c21897bf2123b54fe85d2e64dce9a80427f26747795ee9fced4c584d | def prepare(self, target_dir=None, data_sample=None, X_sample=None, y_sample=None, include_data_sample=False, force_overwrite=False, fn_artifact_files_included=False, fn_name='model_api', inference_conda_env=None, data_science_env=False, ignore_deployment_error=False, use_case_type=None, inference_python_version=None, ... | Prepare model artifact directory to be published to model catalog
Parameters
----------
target_dir : str, default: model.name[:12]
Target directory under which the model artifact files need to be added
data_sample : ADSData
Note: This format is preferable to X_sample and y_sample.
A sample of the test data... | ads/common/model.py | prepare | oracle/accelerated-data-science | 20 | python | def prepare(self, target_dir=None, data_sample=None, X_sample=None, y_sample=None, include_data_sample=False, force_overwrite=False, fn_artifact_files_included=False, fn_name='model_api', inference_conda_env=None, data_science_env=False, ignore_deployment_error=False, use_case_type=None, inference_python_version=None, ... | def prepare(self, target_dir=None, data_sample=None, X_sample=None, y_sample=None, include_data_sample=False, force_overwrite=False, fn_artifact_files_included=False, fn_name='model_api', inference_conda_env=None, data_science_env=False, ignore_deployment_error=False, use_case_type=None, inference_python_version=None, ... |
c540c0b0d8c4aa6b76400493ea52578fc780f2730ce50a200fd35ac6c0a86584 | def visualize_transforms(self):
'\n A graph of the ADSModel transformer pipeline.\n It is only supported in JupyterLabs Notebooks.\n '
self.transformer_pipeline.visualize() | A graph of the ADSModel transformer pipeline.
It is only supported in JupyterLabs Notebooks. | ads/common/model.py | visualize_transforms | oracle/accelerated-data-science | 20 | python | def visualize_transforms(self):
'\n A graph of the ADSModel transformer pipeline.\n It is only supported in JupyterLabs Notebooks.\n '
self.transformer_pipeline.visualize() | def visualize_transforms(self):
'\n A graph of the ADSModel transformer pipeline.\n It is only supported in JupyterLabs Notebooks.\n '
self.transformer_pipeline.visualize()<|docstring|>A graph of the ADSModel transformer pipeline.
It is only supported in JupyterLabs Notebooks.<|endoftext|> |
6bb4d3779a5728a57ccde7d26e068eb71586ac6fb1aedc6fe624a18bc0a7c982 | def show_in_notebook(self):
"\n Describe the model by showing it's properties\n "
if (self._underlying_model == 'automl'):
info = [['Model Name', self.name], ['Target Variable', self.target], ['Selected Algorithm', self.est.selected_model_], ['Task', self.est.task], ['Training Dataset Size... | Describe the model by showing it's properties | ads/common/model.py | show_in_notebook | oracle/accelerated-data-science | 20 | python | def show_in_notebook(self):
"\n \n "
if (self._underlying_model == 'automl'):
info = [['Model Name', self.name], ['Target Variable', self.target], ['Selected Algorithm', self.est.selected_model_], ['Task', self.est.task], ['Training Dataset Size', self.est.train_shape_], ['CV', self.est.cv... | def show_in_notebook(self):
"\n \n "
if (self._underlying_model == 'automl'):
info = [['Model Name', self.name], ['Target Variable', self.target], ['Selected Algorithm', self.est.selected_model_], ['Task', self.est.task], ['Training Dataset Size', self.est.train_shape_], ['CV', self.est.cv... |
9c1b0370ede2182ebeec9236f95e36aff9ec85cb8c571a665a29228cc1fcf430 | def normalize_graph(graph, normalized=True, add_self_loops=True):
"Normalized the graph's adjacency matrix in the scipy sparse matrix format.\n\n Args:\n graph: A scipy sparse adjacency matrix of the input graph.\n normalized: If True, uses the normalized Laplacian formulation. Otherwise,\n use the unno... | Normalized the graph's adjacency matrix in the scipy sparse matrix format.
Args:
graph: A scipy sparse adjacency matrix of the input graph.
normalized: If True, uses the normalized Laplacian formulation. Otherwise,
use the unnormalized Laplacian construction.
add_self_loops: If True, adds a one-diagonal corr... | graph_embedding/dmon/utils.py | normalize_graph | wy-go/google-research | 23,901 | python | def normalize_graph(graph, normalized=True, add_self_loops=True):
"Normalized the graph's adjacency matrix in the scipy sparse matrix format.\n\n Args:\n graph: A scipy sparse adjacency matrix of the input graph.\n normalized: If True, uses the normalized Laplacian formulation. Otherwise,\n use the unno... | def normalize_graph(graph, normalized=True, add_self_loops=True):
"Normalized the graph's adjacency matrix in the scipy sparse matrix format.\n\n Args:\n graph: A scipy sparse adjacency matrix of the input graph.\n normalized: If True, uses the normalized Laplacian formulation. Otherwise,\n use the unno... |
b60e2692627c1d733f36e0289af4f2398075181ec2eb066845ff9089959e9d8d | def main(argv=None):
'script main.\n\n parses command line options in sys.argv, unless *argv* is given.\n '
if (not argv):
argv = sys.argv
parser = E.OptionParser(version='%prog version: $Id: cgat_script_template.py 2871 2010-03-03 10:20:44Z andreas $', usage=globals()['__doc__'])
parser.a... | script main.
parses command line options in sys.argv, unless *argv* is given. | CGAT/scripts/cgat_rebuild_extensions.py | main | CGATOxford/cgat | 87 | python | def main(argv=None):
'script main.\n\n parses command line options in sys.argv, unless *argv* is given.\n '
if (not argv):
argv = sys.argv
parser = E.OptionParser(version='%prog version: $Id: cgat_script_template.py 2871 2010-03-03 10:20:44Z andreas $', usage=globals()['__doc__'])
parser.a... | def main(argv=None):
'script main.\n\n parses command line options in sys.argv, unless *argv* is given.\n '
if (not argv):
argv = sys.argv
parser = E.OptionParser(version='%prog version: $Id: cgat_script_template.py 2871 2010-03-03 10:20:44Z andreas $', usage=globals()['__doc__'])
parser.a... |
c8aafbfc863321c798ad75ec9da334caa77fb38140b5d227d495fa74d114f33e | def receive(self, noparse=0):
'Receives data from Scratch\n Arguments:\n noparse: 0 to pass message through a parser and return the message as a data structure\n 1 to not parse message, but format as a string\n 2 to not parse message and not format as a stri... | Receives data from Scratch
Arguments:
noparse: 0 to pass message through a parser and return the message as a data structure
1 to not parse message, but format as a string
2 to not parse message and not format as a string (returns raw message) | scratch/__init__.py | receive | qihboy/py-scratch | 2 | python | def receive(self, noparse=0):
'Receives data from Scratch\n Arguments:\n noparse: 0 to pass message through a parser and return the message as a data structure\n 1 to not parse message, but format as a string\n 2 to not parse message and not format as a stri... | def receive(self, noparse=0):
'Receives data from Scratch\n Arguments:\n noparse: 0 to pass message through a parser and return the message as a data structure\n 1 to not parse message, but format as a string\n 2 to not parse message and not format as a stri... |
b8bfe5612219fcba223c3a3d1ff362590aeeb9482779b81a873863b219340817 | def sensorupdate(self, data):
'Takes a dictionary and writes a message using the keys as sensors, and the values as the update values'
if (not isinstance(data, dict)):
raise TypeError('Expected a dict')
message = 'sensor-update'
for (k, v) in data.items():
message += (' "%s" %s' % (k, v)... | Takes a dictionary and writes a message using the keys as sensors, and the values as the update values | scratch/__init__.py | sensorupdate | qihboy/py-scratch | 2 | python | def sensorupdate(self, data):
if (not isinstance(data, dict)):
raise TypeError('Expected a dict')
message = 'sensor-update'
for (k, v) in data.items():
message += (' "%s" %s' % (k, v))
self._send(message) | def sensorupdate(self, data):
if (not isinstance(data, dict)):
raise TypeError('Expected a dict')
message = 'sensor-update'
for (k, v) in data.items():
message += (' "%s" %s' % (k, v))
self._send(message)<|docstring|>Takes a dictionary and writes a message using the keys as sensors,... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.