body
stringlengths
26
98.2k
body_hash
int64
-9,222,864,604,528,158,000
9,221,803,474B
docstring
stringlengths
1
16.8k
path
stringlengths
5
230
name
stringlengths
1
96
repository_name
stringlengths
7
89
lang
stringclasses
1 value
body_without_docstring
stringlengths
20
98.2k
@model_info.command('gtrnadb') @click.argument('filename', type=click.File('r')) @click.argument('output', default='-', type=click.File('w')) def gtrnadb_model_info(filename, output): '\n Parse the metadata.tsv file from R2DT for gtrnadb models to\n produce something we can put in our database.\n ' r2d...
-578,127,961,795,464,700
Parse the metadata.tsv file from R2DT for gtrnadb models to produce something we can put in our database.
rnacentral_pipeline/cli/r2dt.py
gtrnadb_model_info
RNAcentral/rnacentral-import-pipeline
python
@model_info.command('gtrnadb') @click.argument('filename', type=click.File('r')) @click.argument('output', default='-', type=click.File('w')) def gtrnadb_model_info(filename, output): '\n Parse the metadata.tsv file from R2DT for gtrnadb models to\n produce something we can put in our database.\n ' r2d...
@model_info.command('rnase-p') @click.argument('filename', type=click.File('r')) @click.argument('output', default='-', type=click.File('w')) def rnase_p_model_info(filename, output): '\n Parse the metadata.tsv file from R2DT for Ribovision models to\n produce something we can put in our database.\n ' ...
2,337,609,762,601,865,000
Parse the metadata.tsv file from R2DT for Ribovision models to produce something we can put in our database.
rnacentral_pipeline/cli/r2dt.py
rnase_p_model_info
RNAcentral/rnacentral-import-pipeline
python
@model_info.command('rnase-p') @click.argument('filename', type=click.File('r')) @click.argument('output', default='-', type=click.File('w')) def rnase_p_model_info(filename, output): '\n Parse the metadata.tsv file from R2DT for Ribovision models to\n produce something we can put in our database.\n ' ...
def __init__(self, devpath): 'Return a disc object' self.devpath = devpath self.mountpoint = ('/mnt' + devpath) self.hasnicetitle = False self.video_type = 'unknown' self.ejected = False self.updated = False if (cfg['VIDEOTYPE'] != 'auto'): self.video_type = cfg['VIDEOTYPE'] ...
8,437,722,910,963,163,000
Return a disc object
arm/models/models.py
__init__
charmarkk/automatic-ripping-machine
python
def __init__(self, devpath): self.devpath = devpath self.mountpoint = ('/mnt' + devpath) self.hasnicetitle = False self.video_type = 'unknown' self.ejected = False self.updated = False if (cfg['VIDEOTYPE'] != 'auto'): self.video_type = cfg['VIDEOTYPE'] self.parse_udev() ...
def parse_udev(self): 'Parse udev for properties of current disc' context = pyudev.Context() device = pyudev.Devices.from_device_file(context, self.devpath) self.disctype = 'unknown' for (key, value) in device.items(): if (key == 'ID_FS_LABEL'): self.label = value if ...
5,184,117,535,612,883,000
Parse udev for properties of current disc
arm/models/models.py
parse_udev
charmarkk/automatic-ripping-machine
python
def parse_udev(self): context = pyudev.Context() device = pyudev.Devices.from_device_file(context, self.devpath) self.disctype = 'unknown' for (key, value) in device.items(): if (key == 'ID_FS_LABEL'): self.label = value if (value == 'iso9660'): self....
def identify_audio_cd(self): '\n Get the title for audio cds to use for the logfile name.\n\n Needs the job class passed into it so it can be forwarded to mb\n\n return - only the logfile - setup_logging() adds the full path\n ' disc_id = music_brainz.get_disc_id(self) mb_title =...
6,480,684,719,705,463,000
Get the title for audio cds to use for the logfile name. Needs the job class passed into it so it can be forwarded to mb return - only the logfile - setup_logging() adds the full path
arm/models/models.py
identify_audio_cd
charmarkk/automatic-ripping-machine
python
def identify_audio_cd(self): '\n Get the title for audio cds to use for the logfile name.\n\n Needs the job class passed into it so it can be forwarded to mb\n\n return - only the logfile - setup_logging() adds the full path\n ' disc_id = music_brainz.get_disc_id(self) mb_title =...
def __str__(self): 'Returns a string of the object' s = (self.__class__.__name__ + ': ') for (attr, value) in self.__dict__.items(): s = (((((s + '(') + str(attr)) + '=') + str(value)) + ') ') return s
5,233,745,533,802,784,000
Returns a string of the object
arm/models/models.py
__str__
charmarkk/automatic-ripping-machine
python
def __str__(self): s = (self.__class__.__name__ + ': ') for (attr, value) in self.__dict__.items(): s = (((((s + '(') + str(attr)) + '=') + str(value)) + ') ') return s
def pretty_table(self): 'Returns a string of the prettytable' x = PrettyTable() x.field_names = ['Config', 'Value'] x._max_width = {'Config': 50, 'Value': 60} for (attr, value) in self.__dict__.items(): if (attr == 'config'): x.add_row([str(attr), str(value.pretty_table())]) ...
-5,753,102,044,256,257,000
Returns a string of the prettytable
arm/models/models.py
pretty_table
charmarkk/automatic-ripping-machine
python
def pretty_table(self): x = PrettyTable() x.field_names = ['Config', 'Value'] x._max_width = {'Config': 50, 'Value': 60} for (attr, value) in self.__dict__.items(): if (attr == 'config'): x.add_row([str(attr), str(value.pretty_table())]) else: x.add_row([str(...
def eject(self): "Eject disc if it hasn't previously been ejected" if (not self.ejected): self.ejected = True try: if os.system(('umount ' + self.devpath)): logging.debug(('we unmounted disc' + self.devpath)) if os.system(('eject ' + self.devpath)): ...
3,129,454,796,627,657,000
Eject disc if it hasn't previously been ejected
arm/models/models.py
eject
charmarkk/automatic-ripping-machine
python
def eject(self): if (not self.ejected): self.ejected = True try: if os.system(('umount ' + self.devpath)): logging.debug(('we unmounted disc' + self.devpath)) if os.system(('eject ' + self.devpath)): logging.debug(('we ejected disc' + self...
def __init__(self, job_id, track_number, length, aspect_ratio, fps, main_feature, source, basename, filename): 'Return a track object' self.job_id = job_id self.track_number = track_number self.length = length self.aspect_ratio = aspect_ratio self.fps = fps self.main_feature = main_feature ...
190,976,422,805,984,930
Return a track object
arm/models/models.py
__init__
charmarkk/automatic-ripping-machine
python
def __init__(self, job_id, track_number, length, aspect_ratio, fps, main_feature, source, basename, filename): self.job_id = job_id self.track_number = track_number self.length = length self.aspect_ratio = aspect_ratio self.fps = fps self.main_feature = main_feature self.source = source...
def list_params(self): 'Returns a string of the object' s = (self.__class__.__name__ + ': ') for (attr, value) in self.__dict__.items(): if s: s = (s + '\n') if ((str(attr) in hidden_attribs) and value): value = HIDDEN_VALUE s = (((s + str(attr)) + ':') + str(...
6,946,453,928,283,418,000
Returns a string of the object
arm/models/models.py
list_params
charmarkk/automatic-ripping-machine
python
def list_params(self): s = (self.__class__.__name__ + ': ') for (attr, value) in self.__dict__.items(): if s: s = (s + '\n') if ((str(attr) in hidden_attribs) and value): value = HIDDEN_VALUE s = (((s + str(attr)) + ':') + str(value)) return s
def __str__(self): 'Returns a string of the object' s = (self.__class__.__name__ + ': ') for (attr, value) in self.__dict__.items(): if ((str(attr) in hidden_attribs) and value): value = HIDDEN_VALUE s = (((((s + '(') + str(attr)) + '=') + str(value)) + ') ') return s
-2,756,119,392,359,758,000
Returns a string of the object
arm/models/models.py
__str__
charmarkk/automatic-ripping-machine
python
def __str__(self): s = (self.__class__.__name__ + ': ') for (attr, value) in self.__dict__.items(): if ((str(attr) in hidden_attribs) and value): value = HIDDEN_VALUE s = (((((s + '(') + str(attr)) + '=') + str(value)) + ') ') return s
def pretty_table(self): 'Returns a string of the prettytable' x = PrettyTable() x.field_names = ['Config', 'Value'] x._max_width = {'Config': 20, 'Value': 30} for (attr, value) in self.__dict__.items(): if ((str(attr) in hidden_attribs) and value): value = HIDDEN_VALUE x....
2,637,011,702,280,520,700
Returns a string of the prettytable
arm/models/models.py
pretty_table
charmarkk/automatic-ripping-machine
python
def pretty_table(self): x = PrettyTable() x.field_names = ['Config', 'Value'] x._max_width = {'Config': 20, 'Value': 30} for (attr, value) in self.__dict__.items(): if ((str(attr) in hidden_attribs) and value): value = HIDDEN_VALUE x.add_row([str(attr), str(value)]) ...
def __str__(self): 'Returns a string of the object' s = (self.__class__.__name__ + ': ') for (attr, value) in self.__dict__.items(): s = (((((s + '(') + str(attr)) + '=') + str(value)) + ') ') return s
5,233,745,533,802,784,000
Returns a string of the object
arm/models/models.py
__str__
charmarkk/automatic-ripping-machine
python
def __str__(self): s = (self.__class__.__name__ + ': ') for (attr, value) in self.__dict__.items(): s = (((((s + '(') + str(attr)) + '=') + str(value)) + ') ') return s
def testDistributionGroupAppsDeleteRequest(self): 'Test DistributionGroupAppsDeleteRequest' pass
-6,899,858,591,365,831,000
Test DistributionGroupAppsDeleteRequest
sdks/python/test/test_DistributionGroupAppsDeleteRequest.py
testDistributionGroupAppsDeleteRequest
Brantone/appcenter-sdks
python
def testDistributionGroupAppsDeleteRequest(self): pass
def __fleiss_pi_linear__(dataset, **kwargs): "\n Calculates Fleiss' :math:`\\pi` (or multi-:math:`\\pi`), originally proposed in\n [Fleiss1971]_, and is equivalent to Siegel and Castellan's :math:`K`\n [SiegelCastellan1988]_. For 2 coders, this is equivalent to Scott's :math:`\\pi`\n [Scott1955]_.\n ...
5,795,092,333,693,014,000
Calculates Fleiss' :math:`\pi` (or multi-:math:`\pi`), originally proposed in [Fleiss1971]_, and is equivalent to Siegel and Castellan's :math:`K` [SiegelCastellan1988]_. For 2 coders, this is equivalent to Scott's :math:`\pi` [Scott1955]_.
segeval/agreement/pi.py
__fleiss_pi_linear__
cfournie/segmentation.evaluation
python
def __fleiss_pi_linear__(dataset, **kwargs): "\n Calculates Fleiss' :math:`\\pi` (or multi-:math:`\\pi`), originally proposed in\n [Fleiss1971]_, and is equivalent to Siegel and Castellan's :math:`K`\n [SiegelCastellan1988]_. For 2 coders, this is equivalent to Scott's :math:`\\pi`\n [Scott1955]_.\n ...
def fleiss_pi_linear(dataset, **kwargs): "\n Calculates Fleiss' :math:`\\pi` (or multi-:math:`\\pi`), originally proposed in\n [Fleiss1971]_, and is equivalent to Siegel and Castellan's :math:`K`\n [SiegelCastellan1988]_. For 2 coders, this is equivalent to Scott's :math:`\\pi`\n [Scott1955]_.\n " ...
5,529,600,764,925,489,000
Calculates Fleiss' :math:`\pi` (or multi-:math:`\pi`), originally proposed in [Fleiss1971]_, and is equivalent to Siegel and Castellan's :math:`K` [SiegelCastellan1988]_. For 2 coders, this is equivalent to Scott's :math:`\pi` [Scott1955]_.
segeval/agreement/pi.py
fleiss_pi_linear
cfournie/segmentation.evaluation
python
def fleiss_pi_linear(dataset, **kwargs): "\n Calculates Fleiss' :math:`\\pi` (or multi-:math:`\\pi`), originally proposed in\n [Fleiss1971]_, and is equivalent to Siegel and Castellan's :math:`K`\n [SiegelCastellan1988]_. For 2 coders, this is equivalent to Scott's :math:`\\pi`\n [Scott1955]_.\n " ...
def _parse_general_counters(self, init_config): '\n Return a dictionary for each job counter\n {\n counter_group_name: [\n counter_name\n ]\n }\n }\n ' job_counter = {} if init_config.get('general_counters'): for counter_group in ...
-5,951,628,006,159,175,000
Return a dictionary for each job counter { counter_group_name: [ counter_name ] } }
checks.d/mapreduce.py
_parse_general_counters
WPMedia/dd-agent
python
def _parse_general_counters(self, init_config): '\n Return a dictionary for each job counter\n {\n counter_group_name: [\n counter_name\n ]\n }\n }\n ' job_counter = {} if init_config.get('general_counters'): for counter_group in ...
def _parse_job_specific_counters(self, init_config): '\n Return a dictionary for each job counter\n {\n job_name: {\n counter_group_name: [\n counter_name\n ]\n }\n }\n }\n ' job_counter = {} if init_config.get('...
-1,406,056,200,574,110,500
Return a dictionary for each job counter { job_name: { counter_group_name: [ counter_name ] } } }
checks.d/mapreduce.py
_parse_job_specific_counters
WPMedia/dd-agent
python
def _parse_job_specific_counters(self, init_config): '\n Return a dictionary for each job counter\n {\n job_name: {\n counter_group_name: [\n counter_name\n ]\n }\n }\n }\n ' job_counter = {} if init_config.get('...
def _get_running_app_ids(self, rm_address, **kwargs): '\n Return a dictionary of {app_id: (app_name, tracking_url)} for the running MapReduce applications\n ' metrics_json = self._rest_request_to_json(rm_address, YARN_APPS_PATH, YARN_SERVICE_CHECK, states=YARN_APPLICATION_STATES, applicationTypes=...
-2,774,981,823,774,166,500
Return a dictionary of {app_id: (app_name, tracking_url)} for the running MapReduce applications
checks.d/mapreduce.py
_get_running_app_ids
WPMedia/dd-agent
python
def _get_running_app_ids(self, rm_address, **kwargs): '\n \n ' metrics_json = self._rest_request_to_json(rm_address, YARN_APPS_PATH, YARN_SERVICE_CHECK, states=YARN_APPLICATION_STATES, applicationTypes=YARN_APPLICATION_TYPES) running_apps = {} if metrics_json.get('apps'): if (metri...
def _mapreduce_job_metrics(self, running_apps, addl_tags): "\n Get metrics for each MapReduce job.\n Return a dictionary for each MapReduce job\n {\n job_id: {\n 'job_name': job_name,\n 'app_name': app_name,\n 'user_name': user_name,\n 'track...
-1,703,499,876,109,679,600
Get metrics for each MapReduce job. Return a dictionary for each MapReduce job { job_id: { 'job_name': job_name, 'app_name': app_name, 'user_name': user_name, 'tracking_url': tracking_url }
checks.d/mapreduce.py
_mapreduce_job_metrics
WPMedia/dd-agent
python
def _mapreduce_job_metrics(self, running_apps, addl_tags): "\n Get metrics for each MapReduce job.\n Return a dictionary for each MapReduce job\n {\n job_id: {\n 'job_name': job_name,\n 'app_name': app_name,\n 'user_name': user_name,\n 'track...
def _mapreduce_job_counters_metrics(self, running_jobs, addl_tags): '\n Get custom metrics specified for each counter\n ' for (job_id, job_metrics) in running_jobs.iteritems(): job_name = job_metrics['job_name'] if (self.general_counters or (job_name in self.job_specific_counters))...
1,464,761,827,869,469,700
Get custom metrics specified for each counter
checks.d/mapreduce.py
_mapreduce_job_counters_metrics
WPMedia/dd-agent
python
def _mapreduce_job_counters_metrics(self, running_jobs, addl_tags): '\n \n ' for (job_id, job_metrics) in running_jobs.iteritems(): job_name = job_metrics['job_name'] if (self.general_counters or (job_name in self.job_specific_counters)): job_specific_metrics = self.job...
def _mapreduce_task_metrics(self, running_jobs, addl_tags): "\n Get metrics for each MapReduce task\n Return a dictionary of {task_id: 'tracking_url'} for each MapReduce task\n " for (job_id, job_stats) in running_jobs.iteritems(): metrics_json = self._rest_request_to_json(job_stats...
-522,691,520,259,828,400
Get metrics for each MapReduce task Return a dictionary of {task_id: 'tracking_url'} for each MapReduce task
checks.d/mapreduce.py
_mapreduce_task_metrics
WPMedia/dd-agent
python
def _mapreduce_task_metrics(self, running_jobs, addl_tags): "\n Get metrics for each MapReduce task\n Return a dictionary of {task_id: 'tracking_url'} for each MapReduce task\n " for (job_id, job_stats) in running_jobs.iteritems(): metrics_json = self._rest_request_to_json(job_stats...
def _set_metrics_from_json(self, tags, metrics_json, metrics): '\n Parse the JSON response and set the metrics\n ' for (status, (metric_name, metric_type)) in metrics.iteritems(): metric_status = metrics_json.get(status) if (metric_status is not None): self._set_metric(...
-362,926,577,410,417,300
Parse the JSON response and set the metrics
checks.d/mapreduce.py
_set_metrics_from_json
WPMedia/dd-agent
python
def _set_metrics_from_json(self, tags, metrics_json, metrics): '\n \n ' for (status, (metric_name, metric_type)) in metrics.iteritems(): metric_status = metrics_json.get(status) if (metric_status is not None): self._set_metric(metric_name, metric_type, metric_status, ta...
def _set_metric(self, metric_name, metric_type, value, tags=None, device_name=None): '\n Set a metric\n ' if (metric_type == HISTOGRAM): self.histogram(metric_name, value, tags=tags, device_name=device_name) elif (metric_type == INCREMENT): self.increment(metric_name, value, ta...
-4,149,084,100,854,976,500
Set a metric
checks.d/mapreduce.py
_set_metric
WPMedia/dd-agent
python
def _set_metric(self, metric_name, metric_type, value, tags=None, device_name=None): '\n \n ' if (metric_type == HISTOGRAM): self.histogram(metric_name, value, tags=tags, device_name=device_name) elif (metric_type == INCREMENT): self.increment(metric_name, value, tags=tags, dev...
def _rest_request_to_json(self, address, object_path, service_name, *args, **kwargs): '\n Query the given URL and return the JSON response\n ' response_json = None service_check_tags = [('url:%s' % self._get_url_base(address))] url = address if object_path: url = self._join_url...
-6,006,647,949,090,792,000
Query the given URL and return the JSON response
checks.d/mapreduce.py
_rest_request_to_json
WPMedia/dd-agent
python
def _rest_request_to_json(self, address, object_path, service_name, *args, **kwargs): '\n \n ' response_json = None service_check_tags = [('url:%s' % self._get_url_base(address))] url = address if object_path: url = self._join_url_dir(url, object_path) if args: for ...
def _join_url_dir(self, url, *args): '\n Join a URL with multiple directories\n ' for path in args: url = (url.rstrip('/') + '/') url = urljoin(url, path.lstrip('/')) return url
8,838,647,529,342,381,000
Join a URL with multiple directories
checks.d/mapreduce.py
_join_url_dir
WPMedia/dd-agent
python
def _join_url_dir(self, url, *args): '\n \n ' for path in args: url = (url.rstrip('/') + '/') url = urljoin(url, path.lstrip('/')) return url
def _get_url_base(self, url): '\n Return the base of a URL\n ' s = urlsplit(url) return urlunsplit([s.scheme, s.netloc, '', '', ''])
8,414,673,978,274,218,000
Return the base of a URL
checks.d/mapreduce.py
_get_url_base
WPMedia/dd-agent
python
def _get_url_base(self, url): '\n \n ' s = urlsplit(url) return urlunsplit([s.scheme, s.netloc, , , ])
def build_gui_help_add_sine_attr(): ' Creates GUI for Make Stretchy IK ' window_name = 'build_gui_help_add_sine_attr' if cmds.window(window_name, exists=True): cmds.deleteUI(window_name, window=True) cmds.window(window_name, title=(script_name + ' Help'), mnb=False, mxb=False, s=True) cmds.w...
8,131,861,237,518,420,000
Creates GUI for Make Stretchy IK
python-scripts/gt_add_sine_attributes.py
build_gui_help_add_sine_attr
freemanpro/gt-tools
python
def build_gui_help_add_sine_attr(): ' ' window_name = 'build_gui_help_add_sine_attr' if cmds.window(window_name, exists=True): cmds.deleteUI(window_name, window=True) cmds.window(window_name, title=(script_name + ' Help'), mnb=False, mxb=False, s=True) cmds.window(window_name, e=True, s=Tru...
def add_sine_attributes(obj, sine_prefix='sine', tick_source_attr='time1.outTime', hide_unkeyable=True, add_absolute_output=False, nice_name_prefix=True): ' \n Create Sine function without using third-party plugins or expressions\n \n Parameters:\n obj (string): Name of the object\n ...
-4,182,535,674,872,841,000
Create Sine function without using third-party plugins or expressions Parameters: obj (string): Name of the object sine (string): Prefix given to the name of the attributes (default is "sine") tick_source_attr (string): Name of the attribute used as the source for time. It u...
python-scripts/gt_add_sine_attributes.py
add_sine_attributes
freemanpro/gt-tools
python
def add_sine_attributes(obj, sine_prefix='sine', tick_source_attr='time1.outTime', hide_unkeyable=True, add_absolute_output=False, nice_name_prefix=True): ' \n Create Sine function without using third-party plugins or expressions\n \n Parameters:\n obj (string): Name of the object\n ...
def validate_operation(): ' Checks elements one last time before running the script ' is_valid = False stretchy_name = None add_abs_output_value = cmds.checkBox(add_abs_output_chkbox, q=True, value=True) add_prefix_nn_value = cmds.checkBox(add_prefix_nn_chkbox, q=True, value=True) stretchy_prefi...
-4,784,751,434,494,775,000
Checks elements one last time before running the script
python-scripts/gt_add_sine_attributes.py
validate_operation
freemanpro/gt-tools
python
def validate_operation(): ' ' is_valid = False stretchy_name = None add_abs_output_value = cmds.checkBox(add_abs_output_chkbox, q=True, value=True) add_prefix_nn_value = cmds.checkBox(add_prefix_nn_chkbox, q=True, value=True) stretchy_prefix = cmds.textField(stretchy_system_prefix, q=True, text...
def close_help_gui(): ' Closes Help Window ' if cmds.window(window_name, exists=True): cmds.deleteUI(window_name, window=True)
-6,909,947,570,174,779,000
Closes Help Window
python-scripts/gt_add_sine_attributes.py
close_help_gui
freemanpro/gt-tools
python
def close_help_gui(): ' ' if cmds.window(window_name, exists=True): cmds.deleteUI(window_name, window=True)
@event('manager.startup') def init_parsers(manager): 'Prepare our list of parsing plugins and default parsers.' for parser_type in PARSER_TYPES: parsers[parser_type] = {} for p in plugin.get_plugins(group=(parser_type + '_parser')): parsers[parser_type][p.name.replace('parser_', '')]...
8,651,478,703,859,171,000
Prepare our list of parsing plugins and default parsers.
flexget/plugins/parsers/plugin_parsing.py
init_parsers
jbones89/Flexget
python
@event('manager.startup') def init_parsers(manager): for parser_type in PARSER_TYPES: parsers[parser_type] = {} for p in plugin.get_plugins(group=(parser_type + '_parser')): parsers[parser_type][p.name.replace('parser_', )] = p.instance func_name = ('parse_' + parser_type) ...
def parse_series(self, data, name=None, **kwargs): '\n Use the selected series parser to parse series information from `data`\n\n :param data: The raw string to parse information from.\n :param name: The series name to parse data for. If not supplied, parser will attempt to guess series name\n ...
5,577,953,992,979,921,000
Use the selected series parser to parse series information from `data` :param data: The raw string to parse information from. :param name: The series name to parse data for. If not supplied, parser will attempt to guess series name automatically from `data`. :returns: An object containing the parsed information. ...
flexget/plugins/parsers/plugin_parsing.py
parse_series
jbones89/Flexget
python
def parse_series(self, data, name=None, **kwargs): '\n Use the selected series parser to parse series information from `data`\n\n :param data: The raw string to parse information from.\n :param name: The series name to parse data for. If not supplied, parser will attempt to guess series name\n ...
def parse_movie(self, data, **kwargs): '\n Use the selected movie parser to parse movie information from `data`\n\n :param data: The raw string to parse information from\n\n :returns: An object containing the parsed information. The `valid` attribute will be set depending on success.\n '...
3,685,681,231,583,774,700
Use the selected movie parser to parse movie information from `data` :param data: The raw string to parse information from :returns: An object containing the parsed information. The `valid` attribute will be set depending on success.
flexget/plugins/parsers/plugin_parsing.py
parse_movie
jbones89/Flexget
python
def parse_movie(self, data, **kwargs): '\n Use the selected movie parser to parse movie information from `data`\n\n :param data: The raw string to parse information from\n\n :returns: An object containing the parsed information. The `valid` attribute will be set depending on success.\n '...
def save_users(users, filename='output.csv'): "Save users out to a .csv file\n\n Each row will represent a user UID, following by all the user's students\n (if the user has any)\n\n INPUT:\n > users: set of User objects\n > filename: filename to save .csv to." with open(filename, 'w') as ...
-6,584,503,492,924,957,000
Save users out to a .csv file Each row will represent a user UID, following by all the user's students (if the user has any) INPUT: > users: set of User objects > filename: filename to save .csv to.
save_load.py
save_users
Garrett-R/infections
python
def save_users(users, filename='output.csv'): "Save users out to a .csv file\n\n Each row will represent a user UID, following by all the user's students\n (if the user has any)\n\n INPUT:\n > users: set of User objects\n > filename: filename to save .csv to." with open(filename, 'w') as ...
def load_users(filename): "Load users from a .csv file\n\n Each row will represent a user uid, following by all the user's student\n (if the user has any). Note: the uid is not assumed to be an integer,\n so it read in as a string, which shouldn't matter anyway.\n\n TODO: we could probably speed this u...
6,156,269,794,225,563,000
Load users from a .csv file Each row will represent a user uid, following by all the user's student (if the user has any). Note: the uid is not assumed to be an integer, so it read in as a string, which shouldn't matter anyway. TODO: we could probably speed this up by loading multiple lines at a time. INPUT: > ...
save_load.py
load_users
Garrett-R/infections
python
def load_users(filename): "Load users from a .csv file\n\n Each row will represent a user uid, following by all the user's student\n (if the user has any). Note: the uid is not assumed to be an integer,\n so it read in as a string, which shouldn't matter anyway.\n\n TODO: we could probably speed this u...
def check_best(self, metric_dict): '\n Hook function, called after metrics are calculated\n ' if (metric_dict['bl_acc'] > self.best_value): if (self.iters > 0): LOGGER.text(f"Evaluation improved from {self.best_value} to {metric_dict['bl_acc']}", level=LoggerObserver.INFO) ...
969,269,354,907,937,000
Hook function, called after metrics are calculated
theseus/classification/trainer/trainer.py
check_best
lannguyen0910/theseus
python
def check_best(self, metric_dict): '\n \n ' if (metric_dict['bl_acc'] > self.best_value): if (self.iters > 0): LOGGER.text(f"Evaluation improved from {self.best_value} to {metric_dict['bl_acc']}", level=LoggerObserver.INFO) self.best_value = metric_dict['bl_acc'] ...
def save_checkpoint(self, outname='last'): '\n Save all information of the current iteration\n ' weights = {'model': self.model.model.state_dict(), 'optimizer': self.optimizer.state_dict(), 'iters': self.iters, 'best_value': self.best_value} if (self.scaler is not None): weights[self.s...
-3,763,531,432,588,769,300
Save all information of the current iteration
theseus/classification/trainer/trainer.py
save_checkpoint
lannguyen0910/theseus
python
def save_checkpoint(self, outname='last'): '\n \n ' weights = {'model': self.model.model.state_dict(), 'optimizer': self.optimizer.state_dict(), 'iters': self.iters, 'best_value': self.best_value} if (self.scaler is not None): weights[self.scaler.state_dict_key] = self.scaler.state_dic...
def load_checkpoint(self, path: str): '\n Load all information the current iteration from checkpoint \n ' LOGGER.text('Loading checkpoints...', level=LoggerObserver.INFO) state_dict = torch.load(path, map_location='cpu') self.iters = load_state_dict(self.iters, state_dict, 'iters') sel...
-1,633,654,067,348,363,500
Load all information the current iteration from checkpoint
theseus/classification/trainer/trainer.py
load_checkpoint
lannguyen0910/theseus
python
def load_checkpoint(self, path: str): '\n \n ' LOGGER.text('Loading checkpoints...', level=LoggerObserver.INFO) state_dict = torch.load(path, map_location='cpu') self.iters = load_state_dict(self.iters, state_dict, 'iters') self.best_value = load_state_dict(self.best_value, state_dict...
def visualize_gt(self): '\n Visualize dataloader for sanity check \n ' LOGGER.text('Visualizing dataset...', level=LoggerObserver.DEBUG) visualizer = Visualizer() batch = next(iter(self.trainloader)) images = batch['inputs'] batch = [] for (idx, inputs) in enumerate(images): ...
7,366,678,842,902,099,000
Visualize dataloader for sanity check
theseus/classification/trainer/trainer.py
visualize_gt
lannguyen0910/theseus
python
def visualize_gt(self): '\n \n ' LOGGER.text('Visualizing dataset...', level=LoggerObserver.DEBUG) visualizer = Visualizer() batch = next(iter(self.trainloader)) images = batch['inputs'] batch = [] for (idx, inputs) in enumerate(images): img_show = visualizer.denormali...
@torch.enable_grad() def visualize_pred(self): 'Visualize model prediction and CAM\n \n ' LOGGER.text('Visualizing model predictions...', level=LoggerObserver.DEBUG) visualizer = Visualizer() batch = next(iter(self.valloader)) images = batch['inputs'] targets = batch['targets'] ...
-2,684,438,551,393,966,000
Visualize model prediction and CAM
theseus/classification/trainer/trainer.py
visualize_pred
lannguyen0910/theseus
python
@torch.enable_grad() def visualize_pred(self): '\n \n ' LOGGER.text('Visualizing model predictions...', level=LoggerObserver.DEBUG) visualizer = Visualizer() batch = next(iter(self.valloader)) images = batch['inputs'] targets = batch['targets'] self.model.eval() model_name ...
def analyze_gt(self): '\n Perform simple data analysis\n ' LOGGER.text('Analyzing datasets...', level=LoggerObserver.DEBUG) analyzer = ClassificationAnalyzer() analyzer.add_dataset(self.trainloader.dataset) fig = analyzer.analyze(figsize=(10, 5)) LOGGER.log([{'tag': 'Sanitycheck/an...
2,394,997,057,899,787,000
Perform simple data analysis
theseus/classification/trainer/trainer.py
analyze_gt
lannguyen0910/theseus
python
def analyze_gt(self): '\n \n ' LOGGER.text('Analyzing datasets...', level=LoggerObserver.DEBUG) analyzer = ClassificationAnalyzer() analyzer.add_dataset(self.trainloader.dataset) fig = analyzer.analyze(figsize=(10, 5)) LOGGER.log([{'tag': 'Sanitycheck/analysis/train', 'value': fig,...
def sanitycheck(self): 'Sanity check before training\n ' self.visualize_gt() self.analyze_gt() self.visualize_model() self.evaluate_epoch()
2,781,777,548,193,682,000
Sanity check before training
theseus/classification/trainer/trainer.py
sanitycheck
lannguyen0910/theseus
python
def sanitycheck(self): '\n ' self.visualize_gt() self.analyze_gt() self.visualize_model() self.evaluate_epoch()
def test_message_causes_disconnect(self, message): 'Add a p2p connection that sends a message and check that it disconnects.' peer = self.nodes[0].add_p2p_connection(P2PInterface()) peer.send_message(message) peer.wait_for_disconnect() assert_equal(self.nodes[0].getconnectioncount(), 0)
1,046,188,331,780,544,800
Add a p2p connection that sends a message and check that it disconnects.
test/functional/p2p_nobloomfilter_messages.py
test_message_causes_disconnect
BakedInside/Beans-Core
python
def test_message_causes_disconnect(self, message): peer = self.nodes[0].add_p2p_connection(P2PInterface()) peer.send_message(message) peer.wait_for_disconnect() assert_equal(self.nodes[0].getconnectioncount(), 0)
def evaluate(datasource, select, result_table, model, label_name=None, model_params=None, result_column_names=[], pai_table=None): 'TBD\n ' if (model_params is None): model_params = {} validation_metrics = model_params.get('validation.metrics', 'accuracy_score') validation_metrics = [m.strip(...
-4,562,751,783,326,163,500
TBD
python/runtime/step/xgboost/evaluate.py
evaluate
awsl-dbq/sqlflow
python
def evaluate(datasource, select, result_table, model, label_name=None, model_params=None, result_column_names=[], pai_table=None): '\n ' if (model_params is None): model_params = {} validation_metrics = model_params.get('validation.metrics', 'accuracy_score') validation_metrics = [m.strip() f...
def _store_evaluate_result(preds, feature_file_name, label_desc, result_table, result_column_names, validation_metrics, conn): '\n Save the evaluation result in the table.\n\n Args:\n preds: the prediction result.\n feature_file_name (str): the file path where the feature dumps.\n label_d...
-7,471,850,992,633,782,000
Save the evaluation result in the table. Args: preds: the prediction result. feature_file_name (str): the file path where the feature dumps. label_desc (FieldDesc): the label FieldDesc object. result_table (str): the result table name. result_column_names (list[str]): the result column names. v...
python/runtime/step/xgboost/evaluate.py
_store_evaluate_result
awsl-dbq/sqlflow
python
def _store_evaluate_result(preds, feature_file_name, label_desc, result_table, result_column_names, validation_metrics, conn): '\n Save the evaluation result in the table.\n\n Args:\n preds: the prediction result.\n feature_file_name (str): the file path where the feature dumps.\n label_d...
def chunk_fg_comp_dict_by_nbls(fg_model_comps_dict, use_redundancy=False, grp_size_threshold=5): "\n Order dict keys in order of number of baselines in each group\n\n\n chunk fit_groups in fg_model_comps_dict into chunks where all groups in the\n same chunk have the same number of baselines in each group.\...
-964,472,370,095,410,200
Order dict keys in order of number of baselines in each group chunk fit_groups in fg_model_comps_dict into chunks where all groups in the same chunk have the same number of baselines in each group. Parameters ---------- fg_model_comps_dict: dict dictionary with keys that are tuples of tuples of 2-tuples (thats r...
calamity/calibration.py
chunk_fg_comp_dict_by_nbls
aewallwi/calamity
python
def chunk_fg_comp_dict_by_nbls(fg_model_comps_dict, use_redundancy=False, grp_size_threshold=5): "\n Order dict keys in order of number of baselines in each group\n\n\n chunk fit_groups in fg_model_comps_dict into chunks where all groups in the\n same chunk have the same number of baselines in each group.\...
def tensorize_fg_model_comps_dict(fg_model_comps_dict, ants_map, nfreqs, use_redundancy=False, dtype=np.float32, notebook_progressbar=False, verbose=False, grp_size_threshold=5): 'Convert per-baseline model components into a Ndata x Ncomponent tensor\n\n Parameters\n ----------\n fg_model_comps_dict: dict\...
-8,335,094,441,089,768,000
Convert per-baseline model components into a Ndata x Ncomponent tensor Parameters ---------- fg_model_comps_dict: dict dictionary where each key is a 2-tuple (nbl, nvecs) referring to the number of baselines in each vector and the number of vectors. Each 2-tuple points to a dictionary where each key is the...
calamity/calibration.py
tensorize_fg_model_comps_dict
aewallwi/calamity
python
def tensorize_fg_model_comps_dict(fg_model_comps_dict, ants_map, nfreqs, use_redundancy=False, dtype=np.float32, notebook_progressbar=False, verbose=False, grp_size_threshold=5): 'Convert per-baseline model components into a Ndata x Ncomponent tensor\n\n Parameters\n ----------\n fg_model_comps_dict: dict\...
def tensorize_data(uvdata, corr_inds, ants_map, polarization, time, data_scale_factor=1.0, weights=None, nsamples_in_weights=False, dtype=np.float32): 'Convert data in uvdata object to a tensor\n\n Parameters\n ----------\n uvdata: UVData object\n UVData object containing data, flags, and nsamples t...
-2,030,708,951,956,363,000
Convert data in uvdata object to a tensor Parameters ---------- uvdata: UVData object UVData object containing data, flags, and nsamples to tensorize. corr_inds: list list of list of lists of 2-tuples. Hierarchy of lists is chunk group baseline - (int 2-tuple) ants_map: dict mapping int...
calamity/calibration.py
tensorize_data
aewallwi/calamity
python
def tensorize_data(uvdata, corr_inds, ants_map, polarization, time, data_scale_factor=1.0, weights=None, nsamples_in_weights=False, dtype=np.float32): 'Convert data in uvdata object to a tensor\n\n Parameters\n ----------\n uvdata: UVData object\n UVData object containing data, flags, and nsamples t...
def renormalize(uvdata_reference_model, uvdata_deconv, gains, polarization, time, additional_flags=None): 'Remove arbitrary phase and amplitude from deconvolved model and gains.\n\n Parameters\n ----------\n uvdata_reference_model: UVData object\n Reference model for "true" visibilities.\n uvdata...
2,437,212,031,765,043,700
Remove arbitrary phase and amplitude from deconvolved model and gains. Parameters ---------- uvdata_reference_model: UVData object Reference model for "true" visibilities. uvdata_deconv: UVData object "Deconvolved" data solved for in self-cal loop. gains: UVCal object Gains solved for in self-cal loop. pol...
calamity/calibration.py
renormalize
aewallwi/calamity
python
def renormalize(uvdata_reference_model, uvdata_deconv, gains, polarization, time, additional_flags=None): 'Remove arbitrary phase and amplitude from deconvolved model and gains.\n\n Parameters\n ----------\n uvdata_reference_model: UVData object\n Reference model for "true" visibilities.\n uvdata...
def tensorize_gains(uvcal, polarization, time, dtype=np.float32): 'Helper function to extract gains into fitting tensors.\n\n Parameters\n ----------\n uvcal: UVCal object\n UVCal object holding gain data to tensorize.\n polarization: str\n pol-str of gain to extract.\n time: float\n ...
933,491,289,463,469,600
Helper function to extract gains into fitting tensors. Parameters ---------- uvcal: UVCal object UVCal object holding gain data to tensorize. polarization: str pol-str of gain to extract. time: float JD of time to convert to tensor. dtype: numpy.dtype dtype of tensors to output. Returns ------- gains_...
calamity/calibration.py
tensorize_gains
aewallwi/calamity
python
def tensorize_gains(uvcal, polarization, time, dtype=np.float32): 'Helper function to extract gains into fitting tensors.\n\n Parameters\n ----------\n uvcal: UVCal object\n UVCal object holding gain data to tensorize.\n polarization: str\n pol-str of gain to extract.\n time: float\n ...
def yield_fg_model_array(nants, nfreqs, fg_model_comps, fg_coeffs, corr_inds): 'Compute tensor foreground model.\n\n Parameters\n ----------\n nants: int\n number of antennas in data to model.\n freqs: int\n number of frequencies in data to model.\n fg_model_comps: list\n list of...
-4,389,784,291,805,237,000
Compute tensor foreground model. Parameters ---------- nants: int number of antennas in data to model. freqs: int number of frequencies in data to model. fg_model_comps: list list of fg modeling tf.Tensor objects representing foreground modeling vectors. Each tensor is (nvecs, ngrps, nbls, nfreqs) ...
calamity/calibration.py
yield_fg_model_array
aewallwi/calamity
python
def yield_fg_model_array(nants, nfreqs, fg_model_comps, fg_coeffs, corr_inds): 'Compute tensor foreground model.\n\n Parameters\n ----------\n nants: int\n number of antennas in data to model.\n freqs: int\n number of frequencies in data to model.\n fg_model_comps: list\n list of...
def fit_gains_and_foregrounds(g_r, g_i, fg_r, fg_i, data_r, data_i, wgts, fg_comps, corr_inds, use_min=False, tol=1e-14, maxsteps=10000, optimizer='Adamax', freeze_model=False, verbose=False, notebook_progressbar=False, dtype=np.float32, graph_mode=False, n_profile_steps=0, profile_log_dir='./logdir', sky_model_r=None,...
4,280,224,059,098,685,400
Run optimization loop to fit gains and foreground components. Parameters ---------- g_r: tf.Tensor object. tf.Tensor object holding real parts of gains. g_i: tf.Tensor object. tf.Tensor object holding imag parts of gains. fg_r: list list of tf.Tensor objects. Each has shape (nvecs, ngrps, 1, 1) tf.Tens...
calamity/calibration.py
fit_gains_and_foregrounds
aewallwi/calamity
python
def fit_gains_and_foregrounds(g_r, g_i, fg_r, fg_i, data_r, data_i, wgts, fg_comps, corr_inds, use_min=False, tol=1e-14, maxsteps=10000, optimizer='Adamax', freeze_model=False, verbose=False, notebook_progressbar=False, dtype=np.float32, graph_mode=False, n_profile_steps=0, profile_log_dir='./logdir', sky_model_r=None,...
def insert_model_into_uvdata_tensor(uvdata, time, polarization, ants_map, red_grps, model_r, model_i, scale_factor=1.0): 'Insert fitted tensor values back into uvdata object for tensor mode.\n\n Parameters\n ----------\n uvdata: UVData object\n uvdata object to insert model data into.\n time: flo...
-9,176,988,501,350,762,000
Insert fitted tensor values back into uvdata object for tensor mode. Parameters ---------- uvdata: UVData object uvdata object to insert model data into. time: float JD of time to insert. polarization: str polarization to insert. ants_map: dict mapping integers to integers map between each antenna numb...
calamity/calibration.py
insert_model_into_uvdata_tensor
aewallwi/calamity
python
def insert_model_into_uvdata_tensor(uvdata, time, polarization, ants_map, red_grps, model_r, model_i, scale_factor=1.0): 'Insert fitted tensor values back into uvdata object for tensor mode.\n\n Parameters\n ----------\n uvdata: UVData object\n uvdata object to insert model data into.\n time: flo...
def insert_gains_into_uvcal(uvcal, time, polarization, gains_re, gains_im): 'Insert tensorized gains back into uvcal object\n\n Parameters\n ----------\n uvdata: UVData object\n uvdata object to insert model data into.\n time: float\n JD of time to insert.\n polarization: str\n p...
5,082,459,756,504,565,000
Insert tensorized gains back into uvcal object Parameters ---------- uvdata: UVData object uvdata object to insert model data into. time: float JD of time to insert. polarization: str polarization to insert. gains_re: dict with int keys and tf.Tensor object values dictionary mapping i antenna numbers t...
calamity/calibration.py
insert_gains_into_uvcal
aewallwi/calamity
python
def insert_gains_into_uvcal(uvcal, time, polarization, gains_re, gains_im): 'Insert tensorized gains back into uvcal object\n\n Parameters\n ----------\n uvdata: UVData object\n uvdata object to insert model data into.\n time: float\n JD of time to insert.\n polarization: str\n p...
def tensorize_fg_coeffs(data, wgts, fg_model_comps, notebook_progressbar=False, verbose=False): 'Initialize foreground coefficient tensors from uvdata and modeling component dictionaries.\n\n\n Parameters\n ----------\n data: list\n list of tf.Tensor objects, each with shape (ngrps, nbls, nfreqs)\n ...
-1,908,258,831,102,641,400
Initialize foreground coefficient tensors from uvdata and modeling component dictionaries. Parameters ---------- data: list list of tf.Tensor objects, each with shape (ngrps, nbls, nfreqs) representing data wgts: list list of tf.Tensor objects, each with shape (ngrps, nbls, nfreqs) representing weight...
calamity/calibration.py
tensorize_fg_coeffs
aewallwi/calamity
python
def tensorize_fg_coeffs(data, wgts, fg_model_comps, notebook_progressbar=False, verbose=False): 'Initialize foreground coefficient tensors from uvdata and modeling component dictionaries.\n\n\n Parameters\n ----------\n data: list\n list of tf.Tensor objects, each with shape (ngrps, nbls, nfreqs)\n ...
def get_auto_weights(uvdata, delay_extent=25.0): '\n inverse variance weights from interpolated autocorrelation data\n\n Parameters\n ----------\n uvdata: UVData object\n UVData object containing autocorrelation data to use for computing inverse noise weights.\n offset: float, optional\n ...
-1,132,488,393,028,415,200
inverse variance weights from interpolated autocorrelation data Parameters ---------- uvdata: UVData object UVData object containing autocorrelation data to use for computing inverse noise weights. offset: float, optional Fit autocorrelation to delay components with this width. Returns ------- data_weights: U...
calamity/calibration.py
get_auto_weights
aewallwi/calamity
python
def get_auto_weights(uvdata, delay_extent=25.0): '\n inverse variance weights from interpolated autocorrelation data\n\n Parameters\n ----------\n uvdata: UVData object\n UVData object containing autocorrelation data to use for computing inverse noise weights.\n offset: float, optional\n ...
def calibrate_and_model_tensor(uvdata, fg_model_comps_dict, gains=None, freeze_model=False, optimizer='Adamax', tol=1e-14, maxsteps=10000, include_autos=False, verbose=False, sky_model=None, dtype=np.float32, use_min=False, use_redundancy=False, notebook_progressbar=False, correct_resid=False, correct_model=True, weigh...
6,425,277,343,294,833,000
Perform simultaneous calibration and foreground fitting using tensors. Parameters ---------- uvdata: UVData object uvdata objet of data to be calibrated. fg_model_comps_dict: dictionary dictionary with keys that are tuples of tuples of 2-tuples (thats right, 3 levels) in the first level, each tuple repres...
calamity/calibration.py
calibrate_and_model_tensor
aewallwi/calamity
python
def calibrate_and_model_tensor(uvdata, fg_model_comps_dict, gains=None, freeze_model=False, optimizer='Adamax', tol=1e-14, maxsteps=10000, include_autos=False, verbose=False, sky_model=None, dtype=np.float32, use_min=False, use_redundancy=False, notebook_progressbar=False, correct_resid=False, correct_model=True, weigh...
def calibrate_and_model_mixed(uvdata, horizon=1.0, min_dly=0.0, offset=0.0, ant_dly=0.0, include_autos=False, verbose=False, red_tol=1.0, red_tol_freq=0.5, n_angle_bins=200, notebook_progressbar=False, use_redundancy=False, use_tensorflow_to_derive_modeling_comps=False, eigenval_cutoff=1e-10, dtype_matinv=np.float64, r...
2,490,183,869,147,370,000
Simultaneously solve for gains and model foregrounds with a mix of DPSS vectors for baselines with no frequency redundancy and simple_cov components for groups of baselines that have some frequency redundancy. Parameters ---------- uvdata: UVData object. dataset to calibrate and filter. horizon: float, op...
calamity/calibration.py
calibrate_and_model_mixed
aewallwi/calamity
python
def calibrate_and_model_mixed(uvdata, horizon=1.0, min_dly=0.0, offset=0.0, ant_dly=0.0, include_autos=False, verbose=False, red_tol=1.0, red_tol_freq=0.5, n_angle_bins=200, notebook_progressbar=False, use_redundancy=False, use_tensorflow_to_derive_modeling_comps=False, eigenval_cutoff=1e-10, dtype_matinv=np.float64, r...
def calibrate_and_model_dpss(uvdata, horizon=1.0, min_dly=0.0, offset=0.0, include_autos=False, verbose=False, red_tol=1.0, notebook_progressbar=False, fg_model_comps_dict=None, **fitting_kwargs): "Simultaneously solve for gains and model foregrounds with DPSS vectors.\n\n Parameters\n ----------\n uvdata:...
-4,381,372,808,634,719,000
Simultaneously solve for gains and model foregrounds with DPSS vectors. Parameters ---------- uvdata: UVData object. dataset to calibrate and filter. horizon: float, optional fraction of baseline delay length to model with dpss modes unitless. default is 1. min_dly: float, optional minimum delay to...
calamity/calibration.py
calibrate_and_model_dpss
aewallwi/calamity
python
def calibrate_and_model_dpss(uvdata, horizon=1.0, min_dly=0.0, offset=0.0, include_autos=False, verbose=False, red_tol=1.0, notebook_progressbar=False, fg_model_comps_dict=None, **fitting_kwargs): "Simultaneously solve for gains and model foregrounds with DPSS vectors.\n\n Parameters\n ----------\n uvdata:...
def read_calibrate_and_model_dpss(input_data_files, input_model_files=None, input_gain_files=None, resid_outfilename=None, gain_outfilename=None, model_outfilename=None, fitted_info_outfilename=None, x_orientation='east', clobber=False, bllen_min=0.0, bllen_max=np.inf, bl_ew_min=0.0, ex_ants=None, select_ants=None, gpu...
-2,364,376,502,582,659,600
Driver function for using calamity with DPSS modeling. Parameters ---------- input_data_files: list of strings or UVData object. list of paths to input files to read in and calibrate. input_model_files: list of strings or UVData object, optional list of paths to model files for overal phase/amp reference. ...
calamity/calibration.py
read_calibrate_and_model_dpss
aewallwi/calamity
python
def read_calibrate_and_model_dpss(input_data_files, input_model_files=None, input_gain_files=None, resid_outfilename=None, gain_outfilename=None, model_outfilename=None, fitted_info_outfilename=None, x_orientation='east', clobber=False, bllen_min=0.0, bllen_max=np.inf, bl_ew_min=0.0, ex_ants=None, select_ants=None, gpu...
def render_formset(formset, **kwargs): 'Render a formset to a Bootstrap layout.' renderer_cls = get_formset_renderer(**kwargs) return renderer_cls(formset, **kwargs).render()
3,676,325,694,860,855,300
Render a formset to a Bootstrap layout.
src/bootstrap4/forms.py
render_formset
Natureshadow/django-bootstrap4
python
def render_formset(formset, **kwargs): renderer_cls = get_formset_renderer(**kwargs) return renderer_cls(formset, **kwargs).render()
def render_formset_errors(formset, **kwargs): 'Render formset errors to a Bootstrap layout.' renderer_cls = get_formset_renderer(**kwargs) return renderer_cls(formset, **kwargs).render_errors()
-6,894,594,435,518,397,000
Render formset errors to a Bootstrap layout.
src/bootstrap4/forms.py
render_formset_errors
Natureshadow/django-bootstrap4
python
def render_formset_errors(formset, **kwargs): renderer_cls = get_formset_renderer(**kwargs) return renderer_cls(formset, **kwargs).render_errors()
def render_form(form, **kwargs): 'Render a form to a Bootstrap layout.' renderer_cls = get_form_renderer(**kwargs) return renderer_cls(form, **kwargs).render()
-2,290,790,819,255,574,500
Render a form to a Bootstrap layout.
src/bootstrap4/forms.py
render_form
Natureshadow/django-bootstrap4
python
def render_form(form, **kwargs): renderer_cls = get_form_renderer(**kwargs) return renderer_cls(form, **kwargs).render()
def render_form_errors(form, type='all', **kwargs): 'Render form errors to a Bootstrap layout.' renderer_cls = get_form_renderer(**kwargs) return renderer_cls(form, **kwargs).render_errors(type)
-6,262,209,671,540,802,000
Render form errors to a Bootstrap layout.
src/bootstrap4/forms.py
render_form_errors
Natureshadow/django-bootstrap4
python
def render_form_errors(form, type='all', **kwargs): renderer_cls = get_form_renderer(**kwargs) return renderer_cls(form, **kwargs).render_errors(type)
def render_field(field, **kwargs): 'Render a field to a Bootstrap layout.' renderer_cls = get_field_renderer(**kwargs) return renderer_cls(field, **kwargs).render()
212,413,380,482,624,060
Render a field to a Bootstrap layout.
src/bootstrap4/forms.py
render_field
Natureshadow/django-bootstrap4
python
def render_field(field, **kwargs): renderer_cls = get_field_renderer(**kwargs) return renderer_cls(field, **kwargs).render()
def render_label(content, label_for=None, label_class=None, label_title=''): 'Render a label with content.' attrs = {} if label_for: attrs['for'] = label_for if label_class: attrs['class'] = label_class if label_title: attrs['title'] = label_title return render_tag('label...
4,835,622,836,655,177,000
Render a label with content.
src/bootstrap4/forms.py
render_label
Natureshadow/django-bootstrap4
python
def render_label(content, label_for=None, label_class=None, label_title=): attrs = {} if label_for: attrs['for'] = label_for if label_class: attrs['class'] = label_class if label_title: attrs['title'] = label_title return render_tag('label', attrs=attrs, content=content)
def render_button(content, button_type=None, button_class='btn-primary', size='', href='', name=None, value=None, title=None, extra_classes='', id=''): 'Render a button with content.' attrs = {} classes = add_css_class('btn', button_class) size = text_value(size).lower().strip() if (size == 'xs'): ...
5,598,860,407,885,194,000
Render a button with content.
src/bootstrap4/forms.py
render_button
Natureshadow/django-bootstrap4
python
def render_button(content, button_type=None, button_class='btn-primary', size=, href=, name=None, value=None, title=None, extra_classes=, id=): attrs = {} classes = add_css_class('btn', button_class) size = text_value(size).lower().strip() if (size == 'xs'): classes = add_css_class(classes,...
def render_field_and_label(field, label, field_class='', label_for=None, label_class='', layout='', **kwargs): 'Render a field with its label.' if (layout == 'horizontal'): if (not label_class): label_class = get_bootstrap_setting('horizontal_label_class') if (not field_class): ...
2,039,437,234,522,795,500
Render a field with its label.
src/bootstrap4/forms.py
render_field_and_label
Natureshadow/django-bootstrap4
python
def render_field_and_label(field, label, field_class=, label_for=None, label_class=, layout=, **kwargs): if (layout == 'horizontal'): if (not label_class): label_class = get_bootstrap_setting('horizontal_label_class') if (not field_class): field_class = get_bootstrap_set...
def render_form_group(content, css_class=FORM_GROUP_CLASS): 'Render a Bootstrap form group.' return f'<div class="{css_class}">{content}</div>'
-311,337,625,377,371,400
Render a Bootstrap form group.
src/bootstrap4/forms.py
render_form_group
Natureshadow/django-bootstrap4
python
def render_form_group(content, css_class=FORM_GROUP_CLASS): return f'<div class="{css_class}">{content}</div>'
def is_widget_with_placeholder(widget): '\n Return whether this widget should have a placeholder.\n\n Only text, text area, number, e-mail, url, password, number and derived inputs have placeholders.\n ' return isinstance(widget, (TextInput, Textarea, NumberInput, EmailInput, URLInput, PasswordInput))
119,742,989,659,189,860
Return whether this widget should have a placeholder. Only text, text area, number, e-mail, url, password, number and derived inputs have placeholders.
src/bootstrap4/forms.py
is_widget_with_placeholder
Natureshadow/django-bootstrap4
python
def is_widget_with_placeholder(widget): '\n Return whether this widget should have a placeholder.\n\n Only text, text area, number, e-mail, url, password, number and derived inputs have placeholders.\n ' return isinstance(widget, (TextInput, Textarea, NumberInput, EmailInput, URLInput, PasswordInput))
def _init_features(self): 'Set up the repository of available Data ONTAP features.' self.features = na_utils.Features()
3,182,935,898,800,352,000
Set up the repository of available Data ONTAP features.
cinder/volume/drivers/netapp/dataontap/client/client_base.py
_init_features
sapcc/cinder
python
def _init_features(self): self.features = na_utils.Features()
def get_ontap_version(self, cached=True): 'Gets the ONTAP version.' if cached: return self.connection.get_ontap_version() ontap_version = netapp_api.NaElement('system-get-version') result = self.connection.invoke_successfully(ontap_version, True) version_tuple = (result.get_child_by_name('ve...
-6,697,713,649,390,994,000
Gets the ONTAP version.
cinder/volume/drivers/netapp/dataontap/client/client_base.py
get_ontap_version
sapcc/cinder
python
def get_ontap_version(self, cached=True): if cached: return self.connection.get_ontap_version() ontap_version = netapp_api.NaElement('system-get-version') result = self.connection.invoke_successfully(ontap_version, True) version_tuple = (result.get_child_by_name('version-tuple') or netapp_a...
def get_ontapi_version(self, cached=True): 'Gets the supported ontapi version.' if cached: return self.connection.get_api_version() ontapi_version = netapp_api.NaElement('system-get-ontapi-version') res = self.connection.invoke_successfully(ontapi_version, False) major = res.get_child_conten...
7,650,952,949,425,096,000
Gets the supported ontapi version.
cinder/volume/drivers/netapp/dataontap/client/client_base.py
get_ontapi_version
sapcc/cinder
python
def get_ontapi_version(self, cached=True): if cached: return self.connection.get_api_version() ontapi_version = netapp_api.NaElement('system-get-ontapi-version') res = self.connection.invoke_successfully(ontapi_version, False) major = res.get_child_content('major-version') minor = res.g...
def check_is_naelement(self, elem): 'Checks if object is instance of NaElement.' if (not isinstance(elem, netapp_api.NaElement)): raise ValueError('Expects NaElement')
2,203,974,980,253,227,500
Checks if object is instance of NaElement.
cinder/volume/drivers/netapp/dataontap/client/client_base.py
check_is_naelement
sapcc/cinder
python
def check_is_naelement(self, elem): if (not isinstance(elem, netapp_api.NaElement)): raise ValueError('Expects NaElement')
def create_lun(self, volume_name, lun_name, size, metadata, qos_policy_group_name=None): 'Issues API request for creating LUN on volume.' path = ('/vol/%s/%s' % (volume_name, lun_name)) space_reservation = metadata['SpaceReserved'] initial_size = size ontap_version = self.get_ontap_version() if ...
-900,611,365,462,998,100
Issues API request for creating LUN on volume.
cinder/volume/drivers/netapp/dataontap/client/client_base.py
create_lun
sapcc/cinder
python
def create_lun(self, volume_name, lun_name, size, metadata, qos_policy_group_name=None): path = ('/vol/%s/%s' % (volume_name, lun_name)) space_reservation = metadata['SpaceReserved'] initial_size = size ontap_version = self.get_ontap_version() if (ontap_version < '9.5'): initial_size = ...
def set_lun_space_reservation(self, path, flag): 'Sets the LUN space reservation on ONTAP.' lun_modify_space_reservation = netapp_api.NaElement.create_node_with_children('lun-set-space-reservation-info', **{'path': path, 'enable': str(flag)}) self.connection.invoke_successfully(lun_modify_space_reservation,...
3,347,695,314,018,310,700
Sets the LUN space reservation on ONTAP.
cinder/volume/drivers/netapp/dataontap/client/client_base.py
set_lun_space_reservation
sapcc/cinder
python
def set_lun_space_reservation(self, path, flag): lun_modify_space_reservation = netapp_api.NaElement.create_node_with_children('lun-set-space-reservation-info', **{'path': path, 'enable': str(flag)}) self.connection.invoke_successfully(lun_modify_space_reservation, True)
def destroy_lun(self, path, force=True): 'Destroys the LUN at the path.' lun_destroy = netapp_api.NaElement.create_node_with_children('lun-destroy', **{'path': path}) if force: lun_destroy.add_new_child('force', 'true') self.connection.invoke_successfully(lun_destroy, True) seg = path.split(...
7,368,047,698,348,012,000
Destroys the LUN at the path.
cinder/volume/drivers/netapp/dataontap/client/client_base.py
destroy_lun
sapcc/cinder
python
def destroy_lun(self, path, force=True): lun_destroy = netapp_api.NaElement.create_node_with_children('lun-destroy', **{'path': path}) if force: lun_destroy.add_new_child('force', 'true') self.connection.invoke_successfully(lun_destroy, True) seg = path.split('/') LOG.debug('Destroyed L...
def map_lun(self, path, igroup_name, lun_id=None): 'Maps LUN to the initiator and returns LUN id assigned.' lun_map = netapp_api.NaElement.create_node_with_children('lun-map', **{'path': path, 'initiator-group': igroup_name}) if lun_id: lun_map.add_new_child('lun-id', lun_id) try: result...
5,147,786,705,441,598,000
Maps LUN to the initiator and returns LUN id assigned.
cinder/volume/drivers/netapp/dataontap/client/client_base.py
map_lun
sapcc/cinder
python
def map_lun(self, path, igroup_name, lun_id=None): lun_map = netapp_api.NaElement.create_node_with_children('lun-map', **{'path': path, 'initiator-group': igroup_name}) if lun_id: lun_map.add_new_child('lun-id', lun_id) try: result = self.connection.invoke_successfully(lun_map, True) ...
def unmap_lun(self, path, igroup_name): 'Unmaps a LUN from given initiator.' lun_unmap = netapp_api.NaElement.create_node_with_children('lun-unmap', **{'path': path, 'initiator-group': igroup_name}) try: self.connection.invoke_successfully(lun_unmap, True) except netapp_api.NaApiError as e: ...
682,668,600,462,337,700
Unmaps a LUN from given initiator.
cinder/volume/drivers/netapp/dataontap/client/client_base.py
unmap_lun
sapcc/cinder
python
def unmap_lun(self, path, igroup_name): lun_unmap = netapp_api.NaElement.create_node_with_children('lun-unmap', **{'path': path, 'initiator-group': igroup_name}) try: self.connection.invoke_successfully(lun_unmap, True) except netapp_api.NaApiError as e: exc_info = sys.exc_info() ...
def create_igroup(self, igroup, igroup_type='iscsi', os_type='default'): 'Creates igroup with specified args.' igroup_create = netapp_api.NaElement.create_node_with_children('igroup-create', **{'initiator-group-name': igroup, 'initiator-group-type': igroup_type, 'os-type': os_type}) self.connection.invoke_s...
4,476,615,876,935,663,000
Creates igroup with specified args.
cinder/volume/drivers/netapp/dataontap/client/client_base.py
create_igroup
sapcc/cinder
python
def create_igroup(self, igroup, igroup_type='iscsi', os_type='default'): igroup_create = netapp_api.NaElement.create_node_with_children('igroup-create', **{'initiator-group-name': igroup, 'initiator-group-type': igroup_type, 'os-type': os_type}) self.connection.invoke_successfully(igroup_create, True)
def add_igroup_initiator(self, igroup, initiator): 'Adds initiators to the specified igroup.' igroup_add = netapp_api.NaElement.create_node_with_children('igroup-add', **{'initiator-group-name': igroup, 'initiator': initiator}) self.connection.invoke_successfully(igroup_add, True)
-6,145,192,281,599,506,000
Adds initiators to the specified igroup.
cinder/volume/drivers/netapp/dataontap/client/client_base.py
add_igroup_initiator
sapcc/cinder
python
def add_igroup_initiator(self, igroup, initiator): igroup_add = netapp_api.NaElement.create_node_with_children('igroup-add', **{'initiator-group-name': igroup, 'initiator': initiator}) self.connection.invoke_successfully(igroup_add, True)
def do_direct_resize(self, path, new_size_bytes, force=True): 'Resize the LUN.' seg = path.split('/') LOG.info('Resizing LUN %s directly to new size.', seg[(- 1)]) lun_resize = netapp_api.NaElement.create_node_with_children('lun-resize', **{'path': path, 'size': new_size_bytes}) if force: lu...
6,683,164,055,784,541,000
Resize the LUN.
cinder/volume/drivers/netapp/dataontap/client/client_base.py
do_direct_resize
sapcc/cinder
python
def do_direct_resize(self, path, new_size_bytes, force=True): seg = path.split('/') LOG.info('Resizing LUN %s directly to new size.', seg[(- 1)]) lun_resize = netapp_api.NaElement.create_node_with_children('lun-resize', **{'path': path, 'size': new_size_bytes}) if force: lun_resize.add_new_...
def get_lun_geometry(self, path): 'Gets the LUN geometry.' geometry = {} lun_geo = netapp_api.NaElement('lun-get-geometry') lun_geo.add_new_child('path', path) try: result = self.connection.invoke_successfully(lun_geo, True) geometry['size'] = result.get_child_content('size') ...
-6,749,439,803,077,511,000
Gets the LUN geometry.
cinder/volume/drivers/netapp/dataontap/client/client_base.py
get_lun_geometry
sapcc/cinder
python
def get_lun_geometry(self, path): geometry = {} lun_geo = netapp_api.NaElement('lun-get-geometry') lun_geo.add_new_child('path', path) try: result = self.connection.invoke_successfully(lun_geo, True) geometry['size'] = result.get_child_content('size') geometry['bytes_per_sec...
def get_volume_options(self, volume_name): 'Get the value for the volume option.' opts = [] vol_option_list = netapp_api.NaElement('volume-options-list-info') vol_option_list.add_new_child('volume', volume_name) result = self.connection.invoke_successfully(vol_option_list, True) options = result...
-4,522,512,593,235,644,400
Get the value for the volume option.
cinder/volume/drivers/netapp/dataontap/client/client_base.py
get_volume_options
sapcc/cinder
python
def get_volume_options(self, volume_name): opts = [] vol_option_list = netapp_api.NaElement('volume-options-list-info') vol_option_list.add_new_child('volume', volume_name) result = self.connection.invoke_successfully(vol_option_list, True) options = result.get_child_by_name('options') if o...
def move_lun(self, path, new_path): 'Moves the LUN at path to new path.' seg = path.split('/') new_seg = new_path.split('/') LOG.debug('Moving LUN %(name)s to %(new_name)s.', {'name': seg[(- 1)], 'new_name': new_seg[(- 1)]}) lun_move = netapp_api.NaElement('lun-move') lun_move.add_new_child('pat...
-297,760,326,579,492,900
Moves the LUN at path to new path.
cinder/volume/drivers/netapp/dataontap/client/client_base.py
move_lun
sapcc/cinder
python
def move_lun(self, path, new_path): seg = path.split('/') new_seg = new_path.split('/') LOG.debug('Moving LUN %(name)s to %(new_name)s.', {'name': seg[(- 1)], 'new_name': new_seg[(- 1)]}) lun_move = netapp_api.NaElement('lun-move') lun_move.add_new_child('path', path) lun_move.add_new_child...
def get_iscsi_target_details(self): 'Gets the iSCSI target portal details.' raise NotImplementedError()
5,800,743,555,444,232,000
Gets the iSCSI target portal details.
cinder/volume/drivers/netapp/dataontap/client/client_base.py
get_iscsi_target_details
sapcc/cinder
python
def get_iscsi_target_details(self): raise NotImplementedError()
def get_fc_target_wwpns(self): 'Gets the FC target details.' raise NotImplementedError()
2,441,588,315,056,165,400
Gets the FC target details.
cinder/volume/drivers/netapp/dataontap/client/client_base.py
get_fc_target_wwpns
sapcc/cinder
python
def get_fc_target_wwpns(self): raise NotImplementedError()
def get_iscsi_service_details(self): 'Returns iscsi iqn.' raise NotImplementedError()
-6,930,080,783,860,774,000
Returns iscsi iqn.
cinder/volume/drivers/netapp/dataontap/client/client_base.py
get_iscsi_service_details
sapcc/cinder
python
def get_iscsi_service_details(self): raise NotImplementedError()
def check_iscsi_initiator_exists(self, iqn): 'Returns True if initiator exists.' raise NotImplementedError()
8,060,813,294,559,359,000
Returns True if initiator exists.
cinder/volume/drivers/netapp/dataontap/client/client_base.py
check_iscsi_initiator_exists
sapcc/cinder
python
def check_iscsi_initiator_exists(self, iqn): raise NotImplementedError()
def set_iscsi_chap_authentication(self, iqn, username, password): "Provides NetApp host's CHAP credentials to the backend." raise NotImplementedError()
3,464,418,870,571,428,400
Provides NetApp host's CHAP credentials to the backend.
cinder/volume/drivers/netapp/dataontap/client/client_base.py
set_iscsi_chap_authentication
sapcc/cinder
python
def set_iscsi_chap_authentication(self, iqn, username, password): raise NotImplementedError()
def get_lun_list(self): 'Gets the list of LUNs on filer.' raise NotImplementedError()
5,492,762,630,089,887,000
Gets the list of LUNs on filer.
cinder/volume/drivers/netapp/dataontap/client/client_base.py
get_lun_list
sapcc/cinder
python
def get_lun_list(self): raise NotImplementedError()
def get_igroup_by_initiators(self, initiator_list): 'Get igroups exactly matching a set of initiators.' raise NotImplementedError()
7,145,069,194,903,305,000
Get igroups exactly matching a set of initiators.
cinder/volume/drivers/netapp/dataontap/client/client_base.py
get_igroup_by_initiators
sapcc/cinder
python
def get_igroup_by_initiators(self, initiator_list): raise NotImplementedError()
def _has_luns_mapped_to_initiator(self, initiator): 'Checks whether any LUNs are mapped to the given initiator.' lun_list_api = netapp_api.NaElement('lun-initiator-list-map-info') lun_list_api.add_new_child('initiator', initiator) result = self.connection.invoke_successfully(lun_list_api, True) lun_...
9,150,061,350,151,996,000
Checks whether any LUNs are mapped to the given initiator.
cinder/volume/drivers/netapp/dataontap/client/client_base.py
_has_luns_mapped_to_initiator
sapcc/cinder
python
def _has_luns_mapped_to_initiator(self, initiator): lun_list_api = netapp_api.NaElement('lun-initiator-list-map-info') lun_list_api.add_new_child('initiator', initiator) result = self.connection.invoke_successfully(lun_list_api, True) lun_maps_container = (result.get_child_by_name('lun-maps') or ne...
def has_luns_mapped_to_initiators(self, initiator_list): 'Checks whether any LUNs are mapped to the given initiator(s).' for initiator in initiator_list: if self._has_luns_mapped_to_initiator(initiator): return True return False
7,278,811,898,778,940,000
Checks whether any LUNs are mapped to the given initiator(s).
cinder/volume/drivers/netapp/dataontap/client/client_base.py
has_luns_mapped_to_initiators
sapcc/cinder
python
def has_luns_mapped_to_initiators(self, initiator_list): for initiator in initiator_list: if self._has_luns_mapped_to_initiator(initiator): return True return False
def get_lun_by_args(self, **args): 'Retrieves LUNs with specified args.' raise NotImplementedError()
-3,744,136,302,429,453,300
Retrieves LUNs with specified args.
cinder/volume/drivers/netapp/dataontap/client/client_base.py
get_lun_by_args
sapcc/cinder
python
def get_lun_by_args(self, **args): raise NotImplementedError()
def get_performance_counter_info(self, object_name, counter_name): 'Gets info about one or more Data ONTAP performance counters.' api_args = {'objectname': object_name} result = self.connection.send_request('perf-object-counter-list-info', api_args, enable_tunneling=False) counters = (result.get_child_b...
-1,821,368,557,504,805,400
Gets info about one or more Data ONTAP performance counters.
cinder/volume/drivers/netapp/dataontap/client/client_base.py
get_performance_counter_info
sapcc/cinder
python
def get_performance_counter_info(self, object_name, counter_name): api_args = {'objectname': object_name} result = self.connection.send_request('perf-object-counter-list-info', api_args, enable_tunneling=False) counters = (result.get_child_by_name('counters') or netapp_api.NaElement('None')) for co...
def delete_snapshot(self, volume_name, snapshot_name): 'Deletes a volume snapshot.' api_args = {'volume': volume_name, 'snapshot': snapshot_name} self.connection.send_request('snapshot-delete', api_args)
9,135,002,389,939,195,000
Deletes a volume snapshot.
cinder/volume/drivers/netapp/dataontap/client/client_base.py
delete_snapshot
sapcc/cinder
python
def delete_snapshot(self, volume_name, snapshot_name): api_args = {'volume': volume_name, 'snapshot': snapshot_name} self.connection.send_request('snapshot-delete', api_args)
def create_cg_snapshot(self, volume_names, snapshot_name): 'Creates a consistency group snapshot out of one or more flexvols.\n\n ONTAP requires an invocation of cg-start to first fence off the\n flexvols to be included in the snapshot. If cg-start returns\n success, a cg-commit must be execute...
-1,963,789,309,185,197,600
Creates a consistency group snapshot out of one or more flexvols. ONTAP requires an invocation of cg-start to first fence off the flexvols to be included in the snapshot. If cg-start returns success, a cg-commit must be executed to finalized the snapshot and unfence the flexvols.
cinder/volume/drivers/netapp/dataontap/client/client_base.py
create_cg_snapshot
sapcc/cinder
python
def create_cg_snapshot(self, volume_names, snapshot_name): 'Creates a consistency group snapshot out of one or more flexvols.\n\n ONTAP requires an invocation of cg-start to first fence off the\n flexvols to be included in the snapshot. If cg-start returns\n success, a cg-commit must be execute...
def get_snapshot(self, volume_name, snapshot_name): 'Gets a single snapshot.' raise NotImplementedError()
2,336,373,799,148,635,000
Gets a single snapshot.
cinder/volume/drivers/netapp/dataontap/client/client_base.py
get_snapshot
sapcc/cinder
python
def get_snapshot(self, volume_name, snapshot_name): raise NotImplementedError()