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 |
|---|---|---|---|---|---|---|---|---|---|
7a8fbcc4b5df7aea417793e352ccd156ec00fad91f1a8ded0ac5b9480ff2f3f4 | def disk_usage(path):
'Return the number of bytes used by a file/folder and any descendents.'
total = os.path.getsize(path)
if os.path.isdir(path):
for filename in os.listdir(path):
child_path = os.path.join(path, filename)
total += disk_usage(child_path)
print('{0:<7}'.f... | Return the number of bytes used by a file/folder and any descendents. | recursion/fs.py | disk_usage | bestgopher/dsa | 0 | python | def disk_usage(path):
total = os.path.getsize(path)
if os.path.isdir(path):
for filename in os.listdir(path):
child_path = os.path.join(path, filename)
total += disk_usage(child_path)
print('{0:<7}'.format(total), path)
return total | def disk_usage(path):
total = os.path.getsize(path)
if os.path.isdir(path):
for filename in os.listdir(path):
child_path = os.path.join(path, filename)
total += disk_usage(child_path)
print('{0:<7}'.format(total), path)
return total<|docstring|>Return the number of b... |
481fa0d1872fc5a1e0d368fc920a2883cb6877a40ce21aecb78e381f6370b382 | def accuracy(output, target, topk=(1, 5)):
'Computes the precision@k for the specified values of k'
with torch.no_grad():
maxk = max(topk)
batch_size = target.size(0)
(_, pred) = output.topk(maxk, 1, True, True)
pred = pred.t()
correct = pred.eq(target.view(1, (- 1)).expa... | Computes the precision@k for the specified values of k | core/video_utils.py | accuracy | Bhaskers-Blu-Org1/bLVNet-TAM | 62 | python | def accuracy(output, target, topk=(1, 5)):
with torch.no_grad():
maxk = max(topk)
batch_size = target.size(0)
(_, pred) = output.topk(maxk, 1, True, True)
pred = pred.t()
correct = pred.eq(target.view(1, (- 1)).expand_as(pred))
res = []
for k in topk:
... | def accuracy(output, target, topk=(1, 5)):
with torch.no_grad():
maxk = max(topk)
batch_size = target.size(0)
(_, pred) = output.topk(maxk, 1, True, True)
pred = pred.t()
correct = pred.eq(target.view(1, (- 1)).expand_as(pred))
res = []
for k in topk:
... |
1652a6fb20004ec12ecdd0350da6cb2170c7bc1698bb5b91257a8a545d5d9c83 | def probabilities_on_graph(cell_or_clust, results_df, rsrc_loc, clust=True, root_label=None, p_thresh=0.0):
"\n cell_or_clust\n The name of a cell or cluster for which to plot the probabilities of it \n being each cell type in the Cell Ontology.\n results_df\n A DataFrame storing CellO's ... | cell_or_clust
The name of a cell or cluster for which to plot the probabilities of it
being each cell type in the Cell Ontology.
results_df
A DataFrame storing CellO's output probabilities in which rows correspond
to cells and columns to cell types.
rsrc_loc
The location of the CellO resources dir... | cello/plot_annotations.py | probabilities_on_graph | Ann-Holmes/CellO | 42 | python | def probabilities_on_graph(cell_or_clust, results_df, rsrc_loc, clust=True, root_label=None, p_thresh=0.0):
"\n cell_or_clust\n The name of a cell or cluster for which to plot the probabilities of it \n being each cell type in the Cell Ontology.\n results_df\n A DataFrame storing CellO's ... | def probabilities_on_graph(cell_or_clust, results_df, rsrc_loc, clust=True, root_label=None, p_thresh=0.0):
"\n cell_or_clust\n The name of a cell or cluster for which to plot the probabilities of it \n being each cell type in the Cell Ontology.\n results_df\n A DataFrame storing CellO's ... |
b2a9a58c89c03a9682113d9b6358e5f261fa5fc84d8795ca8fb7efd7f6a02f3d | def findTargetSumWays(self, nums: List[int], S: int) -> int:
'\n TLE Solution\n '
if (not nums):
return 0
cur_sum = S
start_index = 0
return self.dfs(nums, S, start_index) | TLE Solution | Python/lc_494_target_sum.py | findTargetSumWays | cmattey/leetcode_problems | 6 | python | def findTargetSumWays(self, nums: List[int], S: int) -> int:
'\n \n '
if (not nums):
return 0
cur_sum = S
start_index = 0
return self.dfs(nums, S, start_index) | def findTargetSumWays(self, nums: List[int], S: int) -> int:
'\n \n '
if (not nums):
return 0
cur_sum = S
start_index = 0
return self.dfs(nums, S, start_index)<|docstring|>TLE Solution<|endoftext|> |
a1d3fde11899ff087b21de4cfa7b901d1aa0dbc51cb13ccf40a304211af99af7 | def top_k_top_p_filtering(logits, top_k=0, top_p=0.0, filter_value=(- float('Inf'))):
' Filter a distribution of logits using top-k and/or nucleus (top-p) filtering\n Args:\n logits: logits distribution shape (batch size x vocabulary size)\n top_k > 0: keep only top k tokens with highes... | Filter a distribution of logits using top-k and/or nucleus (top-p) filtering
Args:
logits: logits distribution shape (batch size x vocabulary size)
top_k > 0: keep only top k tokens with highest probability (top-k filtering).
top_p > 0.0: keep the top tokens with cumulative probability >= top_p (nucleus fil... | gpt2generator.py | top_k_top_p_filtering | Acidburn0zzz/Clover-Edition | 1 | python | def top_k_top_p_filtering(logits, top_k=0, top_p=0.0, filter_value=(- float('Inf'))):
' Filter a distribution of logits using top-k and/or nucleus (top-p) filtering\n Args:\n logits: logits distribution shape (batch size x vocabulary size)\n top_k > 0: keep only top k tokens with highes... | def top_k_top_p_filtering(logits, top_k=0, top_p=0.0, filter_value=(- float('Inf'))):
' Filter a distribution of logits using top-k and/or nucleus (top-p) filtering\n Args:\n logits: logits distribution shape (batch size x vocabulary size)\n top_k > 0: keep only top k tokens with highes... |
fef1e018e8a7eb949c5e5c07be9cf540f5aa9312d897b2bf23944af3b35a694d | def truncate_multiple_sequences(seqs, max_len=100):
'Truncate multiple sequences, longest first, removing first.'
while (sum((len(s) for s in seqs)) > max_len):
longest = sorted(seqs, key=len, reverse=True)[0]
longest.pop(0) | Truncate multiple sequences, longest first, removing first. | gpt2generator.py | truncate_multiple_sequences | Acidburn0zzz/Clover-Edition | 1 | python | def truncate_multiple_sequences(seqs, max_len=100):
while (sum((len(s) for s in seqs)) > max_len):
longest = sorted(seqs, key=len, reverse=True)[0]
longest.pop(0) | def truncate_multiple_sequences(seqs, max_len=100):
while (sum((len(s) for s in seqs)) > max_len):
longest = sorted(seqs, key=len, reverse=True)[0]
longest.pop(0)<|docstring|>Truncate multiple sequences, longest first, removing first.<|endoftext|> |
3e89304a9407a6746a2bbf01c865901284c4b7f973bf027f27910473eed74faa | @app.route('/')
def control_panel():
'Route that render the main template with current GPIOs status.'
for GPIO_number in GPIOs:
GPIOs[GPIO_number]['status'] = GPIO.input(GPIO_number)
data_for_template = {'pins': GPIOs, 'temp': temp}
return render_template('panel.html', **data_for_template) | Route that render the main template with current GPIOs status. | start-web-opi.py | control_panel | arthur-bryan/web-opi | 2 | python | @app.route('/')
def control_panel():
for GPIO_number in GPIOs:
GPIOs[GPIO_number]['status'] = GPIO.input(GPIO_number)
data_for_template = {'pins': GPIOs, 'temp': temp}
return render_template('panel.html', **data_for_template) | @app.route('/')
def control_panel():
for GPIO_number in GPIOs:
GPIOs[GPIO_number]['status'] = GPIO.input(GPIO_number)
data_for_template = {'pins': GPIOs, 'temp': temp}
return render_template('panel.html', **data_for_template)<|docstring|>Route that render the main template with current GPIOs st... |
51692b707237a37c12ec5e9bd4e3f0b33a228a4238674bc35fda20e29a6fa68f | def change_gpio(gpio_num, value):
"Changes the current value of the GPIO.\n\n Args:\n gpio_num (int): the GPIO number to be controlled\n value (str): 'on' to power on the pin, 'off' to power off\n "
if (gpio_num in list(GPIOs.keys())):
status = {'on': True, 'off': Fals... | Changes the current value of the GPIO.
Args:
gpio_num (int): the GPIO number to be controlled
value (str): 'on' to power on the pin, 'off' to power off | start-web-opi.py | change_gpio | arthur-bryan/web-opi | 2 | python | def change_gpio(gpio_num, value):
"Changes the current value of the GPIO.\n\n Args:\n gpio_num (int): the GPIO number to be controlled\n value (str): 'on' to power on the pin, 'off' to power off\n "
if (gpio_num in list(GPIOs.keys())):
status = {'on': True, 'off': Fals... | def change_gpio(gpio_num, value):
"Changes the current value of the GPIO.\n\n Args:\n gpio_num (int): the GPIO number to be controlled\n value (str): 'on' to power on the pin, 'off' to power off\n "
if (gpio_num in list(GPIOs.keys())):
status = {'on': True, 'off': Fals... |
a5239559da7af03a2e263cfa794a3844b65261120ae747450652646ff760c5a9 | def speak(pin_number, status):
'Uses the mpg123 program to play an audio based on the taken action'
os.system(('mpg123 ' + os.path.abspath('static/audio/{}-{}.mp3'.format(pin_number, status)))) | Uses the mpg123 program to play an audio based on the taken action | start-web-opi.py | speak | arthur-bryan/web-opi | 2 | python | def speak(pin_number, status):
os.system(('mpg123 ' + os.path.abspath('static/audio/{}-{}.mp3'.format(pin_number, status)))) | def speak(pin_number, status):
os.system(('mpg123 ' + os.path.abspath('static/audio/{}-{}.mp3'.format(pin_number, status))))<|docstring|>Uses the mpg123 program to play an audio based on the taken action<|endoftext|> |
8ee33f3a68c108c37e8728de9fe4bc4836c08e145fefdefa3d189d0b682fa081 | @app.route('/<pin_number>/<status>')
def send_action(pin_number, status):
"Route that render the updated GPIO's status after an taken action\n On button press, two threads starts: one for speaking the action, other\n for changing the GPIO status.\n "
f1 = threading.Thread(target=speak, args=[in... | Route that render the updated GPIO's status after an taken action
On button press, two threads starts: one for speaking the action, other
for changing the GPIO status. | start-web-opi.py | send_action | arthur-bryan/web-opi | 2 | python | @app.route('/<pin_number>/<status>')
def send_action(pin_number, status):
"Route that render the updated GPIO's status after an taken action\n On button press, two threads starts: one for speaking the action, other\n for changing the GPIO status.\n "
f1 = threading.Thread(target=speak, args=[in... | @app.route('/<pin_number>/<status>')
def send_action(pin_number, status):
"Route that render the updated GPIO's status after an taken action\n On button press, two threads starts: one for speaking the action, other\n for changing the GPIO status.\n "
f1 = threading.Thread(target=speak, args=[in... |
1987e3137e225f547663a207cf107404b01adaaec1f99cf8c822493f51423d49 | def process_entry(self, defect_entry):
'\n Process a given Defect entry with qualifiers given from initialization of class.\n Order of processing is:\n 1) perform all possible defect corrections with information given\n 2) consider delocalization analyses based on qualifier metri... | Process a given Defect entry with qualifiers given from initialization of class.
Order of processing is:
1) perform all possible defect corrections with information given
2) consider delocalization analyses based on qualifier metrics
given initialization of class. If delocalized, flag entry as delocalized
... | pymatgen/analysis/defects/defect_compatibility.py | process_entry | anjlip/pymatgen | 2 | python | def process_entry(self, defect_entry):
'\n Process a given Defect entry with qualifiers given from initialization of class.\n Order of processing is:\n 1) perform all possible defect corrections with information given\n 2) consider delocalization analyses based on qualifier metri... | def process_entry(self, defect_entry):
'\n Process a given Defect entry with qualifiers given from initialization of class.\n Order of processing is:\n 1) perform all possible defect corrections with information given\n 2) consider delocalization analyses based on qualifier metri... |
ba8536027c781cb7bcc63860a4a70a087ba1e2da75465c5e7e2835bd6e1717a9 | def delocalization_analysis(self, defect_entry):
'\n Do delocalization analysis. To do this, one considers:\n i) sampling region of planar averaged electrostatic potential (freysoldt approach)\n ii) sampling region of atomic site averaged potentials (kumagai approach)\n iii) ... | Do delocalization analysis. To do this, one considers:
i) sampling region of planar averaged electrostatic potential (freysoldt approach)
ii) sampling region of atomic site averaged potentials (kumagai approach)
iii) structural relaxation amount outside of radius considered in kumagai approach (default is w... | pymatgen/analysis/defects/defect_compatibility.py | delocalization_analysis | anjlip/pymatgen | 2 | python | def delocalization_analysis(self, defect_entry):
'\n Do delocalization analysis. To do this, one considers:\n i) sampling region of planar averaged electrostatic potential (freysoldt approach)\n ii) sampling region of atomic site averaged potentials (kumagai approach)\n iii) ... | def delocalization_analysis(self, defect_entry):
'\n Do delocalization analysis. To do this, one considers:\n i) sampling region of planar averaged electrostatic potential (freysoldt approach)\n ii) sampling region of atomic site averaged potentials (kumagai approach)\n iii) ... |
4a797421f50968ccbf52524fe59c518861ad4e788a761e258c56a0bfdc6e1ab4 | def __init__(self, root_dir, options, build_config, run_tracker, reporting, target_roots=None, daemon_graph_helper=None, exiter=sys.exit):
'\n :param str root_dir: The root directory of the pants workspace (aka the "build root").\n :param Options options: The global, pre-initialized Options instance.\n :pa... | :param str root_dir: The root directory of the pants workspace (aka the "build root").
:param Options options: The global, pre-initialized Options instance.
:param BuildConfiguration build_config: A pre-initialized BuildConfiguration instance.
:param Runtracker run_tracker: The global, pre-initialized/running RunTracke... | src/python/pants/bin/goal_runner.py | __init__ | foursquare/pants | 1 | python | def __init__(self, root_dir, options, build_config, run_tracker, reporting, target_roots=None, daemon_graph_helper=None, exiter=sys.exit):
'\n :param str root_dir: The root directory of the pants workspace (aka the "build root").\n :param Options options: The global, pre-initialized Options instance.\n :pa... | def __init__(self, root_dir, options, build_config, run_tracker, reporting, target_roots=None, daemon_graph_helper=None, exiter=sys.exit):
'\n :param str root_dir: The root directory of the pants workspace (aka the "build root").\n :param Options options: The global, pre-initialized Options instance.\n :pa... |
7bc8685e8e0a1fcb7b95b58b849f4c28150c787809d3f5ddd2414cbaaa7f99a4 | def _handle_help(self, help_request):
'Handle requests for `help` information.'
if help_request:
help_printer = HelpPrinter(self._options)
result = help_printer.print_help()
self._exiter(result) | Handle requests for `help` information. | src/python/pants/bin/goal_runner.py | _handle_help | foursquare/pants | 1 | python | def _handle_help(self, help_request):
if help_request:
help_printer = HelpPrinter(self._options)
result = help_printer.print_help()
self._exiter(result) | def _handle_help(self, help_request):
if help_request:
help_printer = HelpPrinter(self._options)
result = help_printer.print_help()
self._exiter(result)<|docstring|>Handle requests for `help` information.<|endoftext|> |
a949bbf04fba17b467b70ffa6dd664d1e9d1ee29578797a7926724041581c809 | def _init_graph(self, pants_ignore_patterns, build_ignore_patterns, exclude_target_regexps, target_specs, target_roots, workdir, graph_helper, subproject_build_roots):
"Determine the BuildGraph, AddressMapper and spec_roots for a given run.\n\n :param list pants_ignore_patterns: The pants ignore patterns from '-... | Determine the BuildGraph, AddressMapper and spec_roots for a given run.
:param list pants_ignore_patterns: The pants ignore patterns from '--pants-ignore'.
:param list build_ignore_patterns: The build ignore patterns from '--build-ignore',
applied during BUILD file searching.
:param ... | src/python/pants/bin/goal_runner.py | _init_graph | foursquare/pants | 1 | python | def _init_graph(self, pants_ignore_patterns, build_ignore_patterns, exclude_target_regexps, target_specs, target_roots, workdir, graph_helper, subproject_build_roots):
"Determine the BuildGraph, AddressMapper and spec_roots for a given run.\n\n :param list pants_ignore_patterns: The pants ignore patterns from '-... | def _init_graph(self, pants_ignore_patterns, build_ignore_patterns, exclude_target_regexps, target_specs, target_roots, workdir, graph_helper, subproject_build_roots):
"Determine the BuildGraph, AddressMapper and spec_roots for a given run.\n\n :param list pants_ignore_patterns: The pants ignore patterns from '-... |
28dba97c5abdf524d098e0709b4973140080b8bd626f633f54620e00ae7725ba | def _determine_goals(self, requested_goals):
'Check and populate the requested goals for a given run.'
spec_parser = CmdLineSpecParser(self._root_dir)
for goal in requested_goals:
if self._address_mapper.is_valid_single_address(spec_parser.parse_spec(goal)):
logger.warning("Command-line ... | Check and populate the requested goals for a given run. | src/python/pants/bin/goal_runner.py | _determine_goals | foursquare/pants | 1 | python | def _determine_goals(self, requested_goals):
spec_parser = CmdLineSpecParser(self._root_dir)
for goal in requested_goals:
if self._address_mapper.is_valid_single_address(spec_parser.parse_spec(goal)):
logger.warning("Command-line argument '{0}' is ambiguous and was assumed to be a goal.... | def _determine_goals(self, requested_goals):
spec_parser = CmdLineSpecParser(self._root_dir)
for goal in requested_goals:
if self._address_mapper.is_valid_single_address(spec_parser.parse_spec(goal)):
logger.warning("Command-line argument '{0}' is ambiguous and was assumed to be a goal.... |
7fa0d8dee1800e43892c4db422b02f4d673b2bfc7682313a4aff15ec8de571d3 | def _roots_to_targets(self, target_roots):
'Populate the BuildGraph and target list from a set of input TargetRoots.'
with self._run_tracker.new_workunit(name='parse', labels=[WorkUnitLabel.SETUP]):
def filter_for_tag(tag):
return (lambda target: (tag in map(str, target.tags)))
tag_... | Populate the BuildGraph and target list from a set of input TargetRoots. | src/python/pants/bin/goal_runner.py | _roots_to_targets | foursquare/pants | 1 | python | def _roots_to_targets(self, target_roots):
with self._run_tracker.new_workunit(name='parse', labels=[WorkUnitLabel.SETUP]):
def filter_for_tag(tag):
return (lambda target: (tag in map(str, target.tags)))
tag_filter = wrap_filters(create_filters(self._tag, filter_for_tag))
... | def _roots_to_targets(self, target_roots):
with self._run_tracker.new_workunit(name='parse', labels=[WorkUnitLabel.SETUP]):
def filter_for_tag(tag):
return (lambda target: (tag in map(str, target.tags)))
tag_filter = wrap_filters(create_filters(self._tag, filter_for_tag))
... |
f59e7732893464b2a1a58e236ce02ef374621b193445bf3464b0e37314649703 | def __init__(self, context, goals, run_tracker, kill_nailguns, exiter=sys.exit):
'\n :param Context context: The global, pre-initialized Context as created by GoalRunnerFactory.\n :param list[Goal] goals: The list of goals to act on.\n :param Runtracker run_tracker: The global, pre-initialized/running RunT... | :param Context context: The global, pre-initialized Context as created by GoalRunnerFactory.
:param list[Goal] goals: The list of goals to act on.
:param Runtracker run_tracker: The global, pre-initialized/running RunTracker instance.
:param bool kill_nailguns: Whether or not to kill nailguns after the run.
:param func... | src/python/pants/bin/goal_runner.py | __init__ | foursquare/pants | 1 | python | def __init__(self, context, goals, run_tracker, kill_nailguns, exiter=sys.exit):
'\n :param Context context: The global, pre-initialized Context as created by GoalRunnerFactory.\n :param list[Goal] goals: The list of goals to act on.\n :param Runtracker run_tracker: The global, pre-initialized/running RunT... | def __init__(self, context, goals, run_tracker, kill_nailguns, exiter=sys.exit):
'\n :param Context context: The global, pre-initialized Context as created by GoalRunnerFactory.\n :param list[Goal] goals: The list of goals to act on.\n :param Runtracker run_tracker: The global, pre-initialized/running RunT... |
cab58d9ce7925f4b2dc79b5dc81141d6eb6fce1a07fdb9512ef76f219e8ad2d3 | @classmethod
def subsystems(cls):
'Subsystems used outside of any task.'
return {SourceRootConfig, Reporting, Reproducer, RunTracker, Changed, BinaryUtilPrivate.Factory, Subprocess.Factory} | Subsystems used outside of any task. | src/python/pants/bin/goal_runner.py | subsystems | foursquare/pants | 1 | python | @classmethod
def subsystems(cls):
return {SourceRootConfig, Reporting, Reproducer, RunTracker, Changed, BinaryUtilPrivate.Factory, Subprocess.Factory} | @classmethod
def subsystems(cls):
return {SourceRootConfig, Reporting, Reproducer, RunTracker, Changed, BinaryUtilPrivate.Factory, Subprocess.Factory}<|docstring|>Subsystems used outside of any task.<|endoftext|> |
0263d0a2fda6ddadff09c1e6d82dc98db626e6a52e568d45f093b114a63968b8 | def test001_uptime():
'TC395\n check ubuntu uptime\n\n **Test Scenario**\n #. Check uptime from system file located at /proc/uptime\n #. Compare it with tested method ubuntu.uptime()\n #. Both uptime from system file and from method are almost equal\n '
info('verfying uptime method')
with... | TC395
check ubuntu uptime
**Test Scenario**
#. Check uptime from system file located at /proc/uptime
#. Compare it with tested method ubuntu.uptime()
#. Both uptime from system file and from method are almost equal | JumpscaleLibs/sal/ubuntu/tests/test_ubuntu.py | test001_uptime | grimpy/jumpscaleX_libs | 0 | python | def test001_uptime():
'TC395\n check ubuntu uptime\n\n **Test Scenario**\n #. Check uptime from system file located at /proc/uptime\n #. Compare it with tested method ubuntu.uptime()\n #. Both uptime from system file and from method are almost equal\n '
info('verfying uptime method')
with... | def test001_uptime():
'TC395\n check ubuntu uptime\n\n **Test Scenario**\n #. Check uptime from system file located at /proc/uptime\n #. Compare it with tested method ubuntu.uptime()\n #. Both uptime from system file and from method are almost equal\n '
info('verfying uptime method')
with... |
7ce4c85ff6a0165270d203de19173993a4c991d1e4fa6db77eee8c11e7f9a2b0 | def test002_service_install():
'TC396\n service_install is not a package install which is mean only create a config file in /etc/init/ dir\n\n **Test Scenario**\n #. Let take a zdb as out tested service , check the zdb config file existing\n #. Check if the service config file is exist, then we need to ... | TC396
service_install is not a package install which is mean only create a config file in /etc/init/ dir
**Test Scenario**
#. Let take a zdb as out tested service , check the zdb config file existing
#. Check if the service config file is exist, then we need to uninstall service to verify tested method service ins... | JumpscaleLibs/sal/ubuntu/tests/test_ubuntu.py | test002_service_install | grimpy/jumpscaleX_libs | 0 | python | def test002_service_install():
'TC396\n service_install is not a package install which is mean only create a config file in /etc/init/ dir\n\n **Test Scenario**\n #. Let take a zdb as out tested service , check the zdb config file existing\n #. Check if the service config file is exist, then we need to ... | def test002_service_install():
'TC396\n service_install is not a package install which is mean only create a config file in /etc/init/ dir\n\n **Test Scenario**\n #. Let take a zdb as out tested service , check the zdb config file existing\n #. Check if the service config file is exist, then we need to ... |
2cc868be0c66fbe7ee42046f576bf3cf30cc1f6970bea2deb5dbd17856d76ef6 | def test003_version_get():
'TC398\n Check the ubuntu version\n\n **Test Scenario**\n #. Check Ubuntu version using tested method ubuntu.version_get\n #. Verify step1 output include keyword Ubuntu\n '
info('checking ubuntu version ')
assert ('Ubuntu' in j.sal.ubuntu.version_get()) | TC398
Check the ubuntu version
**Test Scenario**
#. Check Ubuntu version using tested method ubuntu.version_get
#. Verify step1 output include keyword Ubuntu | JumpscaleLibs/sal/ubuntu/tests/test_ubuntu.py | test003_version_get | grimpy/jumpscaleX_libs | 0 | python | def test003_version_get():
'TC398\n Check the ubuntu version\n\n **Test Scenario**\n #. Check Ubuntu version using tested method ubuntu.version_get\n #. Verify step1 output include keyword Ubuntu\n '
info('checking ubuntu version ')
assert ('Ubuntu' in j.sal.ubuntu.version_get()) | def test003_version_get():
'TC398\n Check the ubuntu version\n\n **Test Scenario**\n #. Check Ubuntu version using tested method ubuntu.version_get\n #. Verify step1 output include keyword Ubuntu\n '
info('checking ubuntu version ')
assert ('Ubuntu' in j.sal.ubuntu.version_get())<|docstring|>... |
573eb7a9a5fc1cca339aefca4e1c7ec2bfbbb2679b07daba845dd2556e530acc | def test004_apt_install_check():
'TC399\n check if an ubuntu package is installed or not installed will install it\n\n **Test Scenario**\n #. Just run method and if it fails, it will raise an error\n '
info('checking ping is installed or not ')
j.sal.ubuntu.apt_install_check('iputils-ping', 'pin... | TC399
check if an ubuntu package is installed or not installed will install it
**Test Scenario**
#. Just run method and if it fails, it will raise an error | JumpscaleLibs/sal/ubuntu/tests/test_ubuntu.py | test004_apt_install_check | grimpy/jumpscaleX_libs | 0 | python | def test004_apt_install_check():
'TC399\n check if an ubuntu package is installed or not installed will install it\n\n **Test Scenario**\n #. Just run method and if it fails, it will raise an error\n '
info('checking ping is installed or not ')
j.sal.ubuntu.apt_install_check('iputils-ping', 'pin... | def test004_apt_install_check():
'TC399\n check if an ubuntu package is installed or not installed will install it\n\n **Test Scenario**\n #. Just run method and if it fails, it will raise an error\n '
info('checking ping is installed or not ')
j.sal.ubuntu.apt_install_check('iputils-ping', 'pin... |
494084b30b6d85de06968d9eb8a5e51117ea0a7dbefd39585062523d766075bd | def test005_apt_install_version():
'TC400\n Install a specific version of an ubuntu package.\n\n **Test Scenario**\n #. Install wget package using apt_install_version method\n #. check version of wget after installing it\n #. step1 and step2 should be identical\n :return:\n '
wget_installed... | TC400
Install a specific version of an ubuntu package.
**Test Scenario**
#. Install wget package using apt_install_version method
#. check version of wget after installing it
#. step1 and step2 should be identical
:return: | JumpscaleLibs/sal/ubuntu/tests/test_ubuntu.py | test005_apt_install_version | grimpy/jumpscaleX_libs | 0 | python | def test005_apt_install_version():
'TC400\n Install a specific version of an ubuntu package.\n\n **Test Scenario**\n #. Install wget package using apt_install_version method\n #. check version of wget after installing it\n #. step1 and step2 should be identical\n :return:\n '
wget_installed... | def test005_apt_install_version():
'TC400\n Install a specific version of an ubuntu package.\n\n **Test Scenario**\n #. Install wget package using apt_install_version method\n #. check version of wget after installing it\n #. step1 and step2 should be identical\n :return:\n '
wget_installed... |
343f085443399081c7bf1c99358ca0513c2d1c72e5bd99506df46cc729f26a86 | def test006_deb_install():
'TC402\n Install a debian package.\n\n **Test Scenario**\n #. Download python-tmuxp debian package\n #. Install downloaded debian package by deb_install method\n #. Get the installed package status by dpkg command\n #. Installed package python-tmuxp should be install ok\... | TC402
Install a debian package.
**Test Scenario**
#. Download python-tmuxp debian package
#. Install downloaded debian package by deb_install method
#. Get the installed package status by dpkg command
#. Installed package python-tmuxp should be install ok | JumpscaleLibs/sal/ubuntu/tests/test_ubuntu.py | test006_deb_install | grimpy/jumpscaleX_libs | 0 | python | def test006_deb_install():
'TC402\n Install a debian package.\n\n **Test Scenario**\n #. Download python-tmuxp debian package\n #. Install downloaded debian package by deb_install method\n #. Get the installed package status by dpkg command\n #. Installed package python-tmuxp should be install ok\... | def test006_deb_install():
'TC402\n Install a debian package.\n\n **Test Scenario**\n #. Download python-tmuxp debian package\n #. Install downloaded debian package by deb_install method\n #. Get the installed package status by dpkg command\n #. Installed package python-tmuxp should be install ok\... |
d8950d16a3154a11102e4c529bf8e1013830691b736806302671a6e102cbeebb | def test007_pkg_list():
'TC403\n list files of dpkg.\n\n **Test Scenario**\n # . no package called ping so output len should equal zero the correct package name is iputils-ping\n '
info('verifying that pkg_list equal zero as no dpkg called ping, it should be iputils-ping')
assert (len(j.sal.u... | TC403
list files of dpkg.
**Test Scenario**
# . no package called ping so output len should equal zero the correct package name is iputils-ping | JumpscaleLibs/sal/ubuntu/tests/test_ubuntu.py | test007_pkg_list | grimpy/jumpscaleX_libs | 0 | python | def test007_pkg_list():
'TC403\n list files of dpkg.\n\n **Test Scenario**\n # . no package called ping so output len should equal zero the correct package name is iputils-ping\n '
info('verifying that pkg_list equal zero as no dpkg called ping, it should be iputils-ping')
assert (len(j.sal.u... | def test007_pkg_list():
'TC403\n list files of dpkg.\n\n **Test Scenario**\n # . no package called ping so output len should equal zero the correct package name is iputils-ping\n '
info('verifying that pkg_list equal zero as no dpkg called ping, it should be iputils-ping')
assert (len(j.sal.u... |
8e323c568f1cf10e65e62d7f7c3e2a0c65f7357b38d46f6a04eba49e966cd14d | def test008_service_start():
'TC404\n start an ubuntu service.\n\n **Test Scenario**\n #. Check cron status before testing service_start method\n #. If status of cron is running then stop cron service so we can test service_start method\n #. Start cron service using start_service method\n #. Check... | TC404
start an ubuntu service.
**Test Scenario**
#. Check cron status before testing service_start method
#. If status of cron is running then stop cron service so we can test service_start method
#. Start cron service using start_service method
#. Check the corn status by service_status method
#. As it was running be... | JumpscaleLibs/sal/ubuntu/tests/test_ubuntu.py | test008_service_start | grimpy/jumpscaleX_libs | 0 | python | def test008_service_start():
'TC404\n start an ubuntu service.\n\n **Test Scenario**\n #. Check cron status before testing service_start method\n #. If status of cron is running then stop cron service so we can test service_start method\n #. Start cron service using start_service method\n #. Check... | def test008_service_start():
'TC404\n start an ubuntu service.\n\n **Test Scenario**\n #. Check cron status before testing service_start method\n #. If status of cron is running then stop cron service so we can test service_start method\n #. Start cron service using start_service method\n #. Check... |
7f6d20bcf293d0be09040981af3f9382d048d79f3777748bf2c44f3c76b50ee4 | def test009_service_stop():
'TC405\n stop an ubuntu service.\n\n **Test Scenario**\n #. Check cron status before testing service_stop method\n #. If status of cron is not running then start before test service_stop method\n #. Service should be running, stopping cron service using tested method servi... | TC405
stop an ubuntu service.
**Test Scenario**
#. Check cron status before testing service_stop method
#. If status of cron is not running then start before test service_stop method
#. Service should be running, stopping cron service using tested method service_stop
#. Get the service status by service_status method ... | JumpscaleLibs/sal/ubuntu/tests/test_ubuntu.py | test009_service_stop | grimpy/jumpscaleX_libs | 0 | python | def test009_service_stop():
'TC405\n stop an ubuntu service.\n\n **Test Scenario**\n #. Check cron status before testing service_stop method\n #. If status of cron is not running then start before test service_stop method\n #. Service should be running, stopping cron service using tested method servi... | def test009_service_stop():
'TC405\n stop an ubuntu service.\n\n **Test Scenario**\n #. Check cron status before testing service_stop method\n #. If status of cron is not running then start before test service_stop method\n #. Service should be running, stopping cron service using tested method servi... |
63f296a5bb9ba05197e98cb9c58402476bc925dcbf80f177bac95588bc6b4200 | def test010_service_restart():
'TC406\n restart an ubuntu service.\n\n **Test Scenario**\n #. Check cron status before testing service_start method\n #. If status of cron is running then stop cron service so we can test service_start method\n #. Restart cron service using start_service method\n #.... | TC406
restart an ubuntu service.
**Test Scenario**
#. Check cron status before testing service_start method
#. If status of cron is running then stop cron service so we can test service_start method
#. Restart cron service using start_service method
#. Check the corn status by service_status method
#. As it was runnin... | JumpscaleLibs/sal/ubuntu/tests/test_ubuntu.py | test010_service_restart | grimpy/jumpscaleX_libs | 0 | python | def test010_service_restart():
'TC406\n restart an ubuntu service.\n\n **Test Scenario**\n #. Check cron status before testing service_start method\n #. If status of cron is running then stop cron service so we can test service_start method\n #. Restart cron service using start_service method\n #.... | def test010_service_restart():
'TC406\n restart an ubuntu service.\n\n **Test Scenario**\n #. Check cron status before testing service_start method\n #. If status of cron is running then stop cron service so we can test service_start method\n #. Restart cron service using start_service method\n #.... |
ef60f6d1a86bbe9a01313b64fd086a1ebb7a081b7bc5bfa1fcaf59b7046d72e4 | def test011_service_status():
'TC407\n check service status\n\n **Test Scenario**\n #. Get service status\n #. if service is not running, verifying tested method return False\n #. else service is running, should return True\n '
info('Get service status')
state = j.sal.ubuntu.service_status... | TC407
check service status
**Test Scenario**
#. Get service status
#. if service is not running, verifying tested method return False
#. else service is running, should return True | JumpscaleLibs/sal/ubuntu/tests/test_ubuntu.py | test011_service_status | grimpy/jumpscaleX_libs | 0 | python | def test011_service_status():
'TC407\n check service status\n\n **Test Scenario**\n #. Get service status\n #. if service is not running, verifying tested method return False\n #. else service is running, should return True\n '
info('Get service status')
state = j.sal.ubuntu.service_status... | def test011_service_status():
'TC407\n check service status\n\n **Test Scenario**\n #. Get service status\n #. if service is not running, verifying tested method return False\n #. else service is running, should return True\n '
info('Get service status')
state = j.sal.ubuntu.service_status... |
b64f39cd32dbfe0109c0a6e364fba0d4e54c367e5622210675e16273da30c3aa | def test012_apt_find_all():
"TC408\n find all packages match with the package_name, this mean must not be installed\n\n **Test Scenario**\n #. alot if packages are containing wget like 'python3-wget', 'wget'\n "
info('verifying all available packages have a keyword wget')
assert ('wget' in j.sa... | TC408
find all packages match with the package_name, this mean must not be installed
**Test Scenario**
#. alot if packages are containing wget like 'python3-wget', 'wget' | JumpscaleLibs/sal/ubuntu/tests/test_ubuntu.py | test012_apt_find_all | grimpy/jumpscaleX_libs | 0 | python | def test012_apt_find_all():
"TC408\n find all packages match with the package_name, this mean must not be installed\n\n **Test Scenario**\n #. alot if packages are containing wget like 'python3-wget', 'wget'\n "
info('verifying all available packages have a keyword wget')
assert ('wget' in j.sa... | def test012_apt_find_all():
"TC408\n find all packages match with the package_name, this mean must not be installed\n\n **Test Scenario**\n #. alot if packages are containing wget like 'python3-wget', 'wget'\n "
info('verifying all available packages have a keyword wget')
assert ('wget' in j.sa... |
ff94aee5b4687118fc5f5c8dc26820dde4ce9440b7d5ea107b2373f030727c61 | def test013_is_pkg_installed():
'TC409\n check if the package is installed or not\n\n **Test Scenario**\n #. make sure wget installed successfully\n #. Install it if does not installed\n #. Verifying tested pkg_installed should return True as wget is installed\n #. Remove it to return to origin st... | TC409
check if the package is installed or not
**Test Scenario**
#. make sure wget installed successfully
#. Install it if does not installed
#. Verifying tested pkg_installed should return True as wget is installed
#. Remove it to return to origin state | JumpscaleLibs/sal/ubuntu/tests/test_ubuntu.py | test013_is_pkg_installed | grimpy/jumpscaleX_libs | 0 | python | def test013_is_pkg_installed():
'TC409\n check if the package is installed or not\n\n **Test Scenario**\n #. make sure wget installed successfully\n #. Install it if does not installed\n #. Verifying tested pkg_installed should return True as wget is installed\n #. Remove it to return to origin st... | def test013_is_pkg_installed():
'TC409\n check if the package is installed or not\n\n **Test Scenario**\n #. make sure wget installed successfully\n #. Install it if does not installed\n #. Verifying tested pkg_installed should return True as wget is installed\n #. Remove it to return to origin st... |
7eb00b79ed9cf9f845163f73abd4be8028dc788774333795f00777cb685552d2 | def test014_sshkey_generate():
'TC410\n generate a new ssh key\n\n **Test Scenario**\n #. Generate sshkey in path /tmp/id_rsa\n #. verify that there is a files, their names contain id_rsa\n '
info('Generate sshkey in path /tmp/id_rsa')
j.sal.ubuntu.sshkey_generate(path='/tmp/id_rsa')
info... | TC410
generate a new ssh key
**Test Scenario**
#. Generate sshkey in path /tmp/id_rsa
#. verify that there is a files, their names contain id_rsa | JumpscaleLibs/sal/ubuntu/tests/test_ubuntu.py | test014_sshkey_generate | grimpy/jumpscaleX_libs | 0 | python | def test014_sshkey_generate():
'TC410\n generate a new ssh key\n\n **Test Scenario**\n #. Generate sshkey in path /tmp/id_rsa\n #. verify that there is a files, their names contain id_rsa\n '
info('Generate sshkey in path /tmp/id_rsa')
j.sal.ubuntu.sshkey_generate(path='/tmp/id_rsa')
info... | def test014_sshkey_generate():
'TC410\n generate a new ssh key\n\n **Test Scenario**\n #. Generate sshkey in path /tmp/id_rsa\n #. verify that there is a files, their names contain id_rsa\n '
info('Generate sshkey in path /tmp/id_rsa')
j.sal.ubuntu.sshkey_generate(path='/tmp/id_rsa')
info... |
1fef9c83a97b626e640f746f0678b35c64a9b405de856c3bf35e74475bd4708f | def test015_apt_get_cache_keys():
'TC411\n get all cached packages of ubuntu\n\n **Test Scenario**\n #. Get all cached keys by our tested method apt_get_cache_keys\n #. Get a one package from cached packages by apt-cache command\n #. Compare the package name of step2 should be included in keys from s... | TC411
get all cached packages of ubuntu
**Test Scenario**
#. Get all cached keys by our tested method apt_get_cache_keys
#. Get a one package from cached packages by apt-cache command
#. Compare the package name of step2 should be included in keys from step 1 | JumpscaleLibs/sal/ubuntu/tests/test_ubuntu.py | test015_apt_get_cache_keys | grimpy/jumpscaleX_libs | 0 | python | def test015_apt_get_cache_keys():
'TC411\n get all cached packages of ubuntu\n\n **Test Scenario**\n #. Get all cached keys by our tested method apt_get_cache_keys\n #. Get a one package from cached packages by apt-cache command\n #. Compare the package name of step2 should be included in keys from s... | def test015_apt_get_cache_keys():
'TC411\n get all cached packages of ubuntu\n\n **Test Scenario**\n #. Get all cached keys by our tested method apt_get_cache_keys\n #. Get a one package from cached packages by apt-cache command\n #. Compare the package name of step2 should be included in keys from s... |
690de65d1d2a7f94286e6c18850698918d55bbf5457cf2ba9d33b8d65f1c5915 | def test016_apt_get_installed():
'TC412\n Get all the installed packages.\n\n **Test Scenario**\n #. Get length of installed packages from apt list command\n #. Get length of installed packages from tested method\n #. Compare step 1 and 2 should be equal installed packages by tested method and ap... | TC412
Get all the installed packages.
**Test Scenario**
#. Get length of installed packages from apt list command
#. Get length of installed packages from tested method
#. Compare step 1 and 2 should be equal installed packages by tested method and apt list command should be the same | JumpscaleLibs/sal/ubuntu/tests/test_ubuntu.py | test016_apt_get_installed | grimpy/jumpscaleX_libs | 0 | python | def test016_apt_get_installed():
'TC412\n Get all the installed packages.\n\n **Test Scenario**\n #. Get length of installed packages from apt list command\n #. Get length of installed packages from tested method\n #. Compare step 1 and 2 should be equal installed packages by tested method and ap... | def test016_apt_get_installed():
'TC412\n Get all the installed packages.\n\n **Test Scenario**\n #. Get length of installed packages from apt list command\n #. Get length of installed packages from tested method\n #. Compare step 1 and 2 should be equal installed packages by tested method and ap... |
439be9569754aaddb941b6cdd698154c4f341d8cff1029588faa4856fc4cac8a | def test017_apt_install():
'TC413\n install a specific ubuntu package.\n\n **Test Scenario**\n #. Check if speedtest-cli is installed or not\n #. if installed, remove it and use tested method to install it and verify that is installed\n #. else we install speedtest-cli by tested method\n #. verify... | TC413
install a specific ubuntu package.
**Test Scenario**
#. Check if speedtest-cli is installed or not
#. if installed, remove it and use tested method to install it and verify that is installed
#. else we install speedtest-cli by tested method
#. verify that is installed successfully
#. remove it to be as origin st... | JumpscaleLibs/sal/ubuntu/tests/test_ubuntu.py | test017_apt_install | grimpy/jumpscaleX_libs | 0 | python | def test017_apt_install():
'TC413\n install a specific ubuntu package.\n\n **Test Scenario**\n #. Check if speedtest-cli is installed or not\n #. if installed, remove it and use tested method to install it and verify that is installed\n #. else we install speedtest-cli by tested method\n #. verify... | def test017_apt_install():
'TC413\n install a specific ubuntu package.\n\n **Test Scenario**\n #. Check if speedtest-cli is installed or not\n #. if installed, remove it and use tested method to install it and verify that is installed\n #. else we install speedtest-cli by tested method\n #. verify... |
96dbbc823ceebd7d978d056ab8cf0873381279651e605553a9162931cf0a7238 | def test018_apt_sources_list():
'TC414\n represents the full sources.list + sources.list.d file\n\n **Test Scenario**\n #. Get all listed apt sources by tested method apt_sources_list\n #. Get the first line in apt sources list\n #. Verify first item should contains a keyword deb\n '
info('Get... | TC414
represents the full sources.list + sources.list.d file
**Test Scenario**
#. Get all listed apt sources by tested method apt_sources_list
#. Get the first line in apt sources list
#. Verify first item should contains a keyword deb | JumpscaleLibs/sal/ubuntu/tests/test_ubuntu.py | test018_apt_sources_list | grimpy/jumpscaleX_libs | 0 | python | def test018_apt_sources_list():
'TC414\n represents the full sources.list + sources.list.d file\n\n **Test Scenario**\n #. Get all listed apt sources by tested method apt_sources_list\n #. Get the first line in apt sources list\n #. Verify first item should contains a keyword deb\n '
info('Get... | def test018_apt_sources_list():
'TC414\n represents the full sources.list + sources.list.d file\n\n **Test Scenario**\n #. Get all listed apt sources by tested method apt_sources_list\n #. Get the first line in apt sources list\n #. Verify first item should contains a keyword deb\n '
info('Get... |
96ba217018527068e136c645e23253ad46952e19ecd1584e026964d3583358cc | def test019_apt_sources_uri_add():
'TC415\n add a new apt source url.\n\n **Test Scenario**\n #. Check if the source link file that am gonna add it exist or not\n #. file exist move it a /tmp dir\n #. Adding new url to apt sources\n #. Check contents of added file under /etc/apt/sources.list.d\n ... | TC415
add a new apt source url.
**Test Scenario**
#. Check if the source link file that am gonna add it exist or not
#. file exist move it a /tmp dir
#. Adding new url to apt sources
#. Check contents of added file under /etc/apt/sources.list.d
#. Verify file contents are contains deb keyword
#. Remove created file by... | JumpscaleLibs/sal/ubuntu/tests/test_ubuntu.py | test019_apt_sources_uri_add | grimpy/jumpscaleX_libs | 0 | python | def test019_apt_sources_uri_add():
'TC415\n add a new apt source url.\n\n **Test Scenario**\n #. Check if the source link file that am gonna add it exist or not\n #. file exist move it a /tmp dir\n #. Adding new url to apt sources\n #. Check contents of added file under /etc/apt/sources.list.d\n ... | def test019_apt_sources_uri_add():
'TC415\n add a new apt source url.\n\n **Test Scenario**\n #. Check if the source link file that am gonna add it exist or not\n #. file exist move it a /tmp dir\n #. Adding new url to apt sources\n #. Check contents of added file under /etc/apt/sources.list.d\n ... |
2dbf82480aa782e2129f50755fc8706149e6b3eaffd8a697ebb735b87c000a76 | def test020_apt_upgrade():
'TC416\n upgrade is used to install the newest versions of all packages currently installed on the system\n\n **Test Scenario**\n #. Get number of packages that need to be upgraded\n #. Run tested method to upgrade packages\n #. Get number of packages that need to be upgrad... | TC416
upgrade is used to install the newest versions of all packages currently installed on the system
**Test Scenario**
#. Get number of packages that need to be upgraded
#. Run tested method to upgrade packages
#. Get number of packages that need to be upgraded again after upgrade
#. if upgrade runs successfully the... | JumpscaleLibs/sal/ubuntu/tests/test_ubuntu.py | test020_apt_upgrade | grimpy/jumpscaleX_libs | 0 | python | def test020_apt_upgrade():
'TC416\n upgrade is used to install the newest versions of all packages currently installed on the system\n\n **Test Scenario**\n #. Get number of packages that need to be upgraded\n #. Run tested method to upgrade packages\n #. Get number of packages that need to be upgrad... | def test020_apt_upgrade():
'TC416\n upgrade is used to install the newest versions of all packages currently installed on the system\n\n **Test Scenario**\n #. Get number of packages that need to be upgraded\n #. Run tested method to upgrade packages\n #. Get number of packages that need to be upgrad... |
6578889ded0c1c12513eec6207bb391a982f52ea65b3e9cbb3862cbd5c549a5d | def test021_check_os():
'TC417\n check is True when the destribution is ubunut or linuxmint\n\n **Test Scenario**\n #. Get os name by lsb_release command\n #. Get release number (version) by lsb_release command\n #. Check OS name should be between "Ubuntu", "LinuxMint"\n #. if OS is Ubuntu or Linu... | TC417
check is True when the destribution is ubunut or linuxmint
**Test Scenario**
#. Get os name by lsb_release command
#. Get release number (version) by lsb_release command
#. Check OS name should be between "Ubuntu", "LinuxMint"
#. if OS is Ubuntu or LinuxMint, checking version should be greater than 14
#. if OS i... | JumpscaleLibs/sal/ubuntu/tests/test_ubuntu.py | test021_check_os | grimpy/jumpscaleX_libs | 0 | python | def test021_check_os():
'TC417\n check is True when the destribution is ubunut or linuxmint\n\n **Test Scenario**\n #. Get os name by lsb_release command\n #. Get release number (version) by lsb_release command\n #. Check OS name should be between "Ubuntu", "LinuxMint"\n #. if OS is Ubuntu or Linu... | def test021_check_os():
'TC417\n check is True when the destribution is ubunut or linuxmint\n\n **Test Scenario**\n #. Get os name by lsb_release command\n #. Get release number (version) by lsb_release command\n #. Check OS name should be between "Ubuntu", "LinuxMint"\n #. if OS is Ubuntu or Linu... |
16c4b25696233ae21cad4ed049f83b76d8c5c459c8b3c9ca0951fd428e14fbbe | def test022_deb_download_install():
'TC418\n check download and install the package\n\n **Test Scenario**\n #. Check status of nano is installed or not\n #. If nano installed remove it by apt remove before install it\n #. Installed it again by tested method\n #. Get nano st... | TC418
check download and install the package
**Test Scenario**
#. Check status of nano is installed or not
#. If nano installed remove it by apt remove before install it
#. Installed it again by tested method
#. Get nano status should be installed successfully
#. Verify that nano installed successfully
#. Remove nano ... | JumpscaleLibs/sal/ubuntu/tests/test_ubuntu.py | test022_deb_download_install | grimpy/jumpscaleX_libs | 0 | python | def test022_deb_download_install():
'TC418\n check download and install the package\n\n **Test Scenario**\n #. Check status of nano is installed or not\n #. If nano installed remove it by apt remove before install it\n #. Installed it again by tested method\n #. Get nano st... | def test022_deb_download_install():
'TC418\n check download and install the package\n\n **Test Scenario**\n #. Check status of nano is installed or not\n #. If nano installed remove it by apt remove before install it\n #. Installed it again by tested method\n #. Get nano st... |
2f784a2511d37a17bc47f53cf665418a81bcdf18fd36101feabce4bf70e12c57 | def test023_pkg_remove():
'TC419\n remove an ubuntu package.\n\n **Test Scenario**\n #. Check the tcpdummp is installed or not\n #. If tcpdump not installed, install it manually\n #. Remove tcpdump by tested method pkg_remove\n #. Verify package has been removed by tested method\n #. Remove tcp... | TC419
remove an ubuntu package.
**Test Scenario**
#. Check the tcpdummp is installed or not
#. If tcpdump not installed, install it manually
#. Remove tcpdump by tested method pkg_remove
#. Verify package has been removed by tested method
#. Remove tcpdump to return to origin state | JumpscaleLibs/sal/ubuntu/tests/test_ubuntu.py | test023_pkg_remove | grimpy/jumpscaleX_libs | 0 | python | def test023_pkg_remove():
'TC419\n remove an ubuntu package.\n\n **Test Scenario**\n #. Check the tcpdummp is installed or not\n #. If tcpdump not installed, install it manually\n #. Remove tcpdump by tested method pkg_remove\n #. Verify package has been removed by tested method\n #. Remove tcp... | def test023_pkg_remove():
'TC419\n remove an ubuntu package.\n\n **Test Scenario**\n #. Check the tcpdummp is installed or not\n #. If tcpdump not installed, install it manually\n #. Remove tcpdump by tested method pkg_remove\n #. Verify package has been removed by tested method\n #. Remove tcp... |
fef78b8ab01e35bb58eff0b71bdaba99810a418aa56deb9b5e13ae9245f8bade | def test024_service_disable_start_boot():
'TC420\n remove all links are named as /etc/rcrunlevel.d/[SK]NNname that point to the script /etc/init.d/name.\n\n **Test Scenario**\n #. Check cron file link exist or not\n #. If file does not exist, enable service so file will created\n #. Disable cron serv... | TC420
remove all links are named as /etc/rcrunlevel.d/[SK]NNname that point to the script /etc/init.d/name.
**Test Scenario**
#. Check cron file link exist or not
#. If file does not exist, enable service so file will created
#. Disable cron service by using tested method service_disable_start_boot
#. Verify that file... | JumpscaleLibs/sal/ubuntu/tests/test_ubuntu.py | test024_service_disable_start_boot | grimpy/jumpscaleX_libs | 0 | python | def test024_service_disable_start_boot():
'TC420\n remove all links are named as /etc/rcrunlevel.d/[SK]NNname that point to the script /etc/init.d/name.\n\n **Test Scenario**\n #. Check cron file link exist or not\n #. If file does not exist, enable service so file will created\n #. Disable cron serv... | def test024_service_disable_start_boot():
'TC420\n remove all links are named as /etc/rcrunlevel.d/[SK]NNname that point to the script /etc/init.d/name.\n\n **Test Scenario**\n #. Check cron file link exist or not\n #. If file does not exist, enable service so file will created\n #. Disable cron serv... |
095ffaa07eab63fec190846dd60bd14d8e95fa2d8b6e71035e6432d9d2ebc923 | def test025_service_enable_start_boot():
'TC421\n it makes links named /etc/rcrunlevel.d/[SK]NNname that point to the script /etc/init.d/name.\n\n **Test Scenario**\n #. Check cron file link exist or not\n #. If file exist,backup service file to /tmp before disabling it\n #. Disable service at boot\n... | TC421
it makes links named /etc/rcrunlevel.d/[SK]NNname that point to the script /etc/init.d/name.
**Test Scenario**
#. Check cron file link exist or not
#. If file exist,backup service file to /tmp before disabling it
#. Disable service at boot
#. Verify that file does not eixst after disabling service
#. Enable serv... | JumpscaleLibs/sal/ubuntu/tests/test_ubuntu.py | test025_service_enable_start_boot | grimpy/jumpscaleX_libs | 0 | python | def test025_service_enable_start_boot():
'TC421\n it makes links named /etc/rcrunlevel.d/[SK]NNname that point to the script /etc/init.d/name.\n\n **Test Scenario**\n #. Check cron file link exist or not\n #. If file exist,backup service file to /tmp before disabling it\n #. Disable service at boot\n... | def test025_service_enable_start_boot():
'TC421\n it makes links named /etc/rcrunlevel.d/[SK]NNname that point to the script /etc/init.d/name.\n\n **Test Scenario**\n #. Check cron file link exist or not\n #. If file exist,backup service file to /tmp before disabling it\n #. Disable service at boot\n... |
ddcdce168cfb6da6eac743885fa4c805b4616faeedd2f980ba7e28b5f320401d | def test026_service_uninstall():
'TC422\n remove an ubuntu service.\n\n **Test Scenario**\n #. Check cron service config file existing under /etc/init\n #. If ron service file config does not exist in /etc/ini, install service so config file will created\n #. Backup the config file to /tmp before tes... | TC422
remove an ubuntu service.
**Test Scenario**
#. Check cron service config file existing under /etc/init
#. If ron service file config does not exist in /etc/ini, install service so config file will created
#. Backup the config file to /tmp before testing
#. Uninstall service to test tested method service_uninstal... | JumpscaleLibs/sal/ubuntu/tests/test_ubuntu.py | test026_service_uninstall | grimpy/jumpscaleX_libs | 0 | python | def test026_service_uninstall():
'TC422\n remove an ubuntu service.\n\n **Test Scenario**\n #. Check cron service config file existing under /etc/init\n #. If ron service file config does not exist in /etc/ini, install service so config file will created\n #. Backup the config file to /tmp before tes... | def test026_service_uninstall():
'TC422\n remove an ubuntu service.\n\n **Test Scenario**\n #. Check cron service config file existing under /etc/init\n #. If ron service file config does not exist in /etc/ini, install service so config file will created\n #. Backup the config file to /tmp before tes... |
d4b0121657bd6af1e9b1bb588b6e9294f32a183ef027dca86aa4b49267c305d9 | def test027_whoami():
'TC397\n check current login user\n\n **Test Scenario**\n #. Check whoami method output\n #. Check os current user by using command whoami\n #. Comapre step1 and step2, should be identical\n\n '
info('checking whoami method output')
sal_user = j.sal.ubuntu.whoami()
... | TC397
check current login user
**Test Scenario**
#. Check whoami method output
#. Check os current user by using command whoami
#. Comapre step1 and step2, should be identical | JumpscaleLibs/sal/ubuntu/tests/test_ubuntu.py | test027_whoami | grimpy/jumpscaleX_libs | 0 | python | def test027_whoami():
'TC397\n check current login user\n\n **Test Scenario**\n #. Check whoami method output\n #. Check os current user by using command whoami\n #. Comapre step1 and step2, should be identical\n\n '
info('checking whoami method output')
sal_user = j.sal.ubuntu.whoami()
... | def test027_whoami():
'TC397\n check current login user\n\n **Test Scenario**\n #. Check whoami method output\n #. Check os current user by using command whoami\n #. Comapre step1 and step2, should be identical\n\n '
info('checking whoami method output')
sal_user = j.sal.ubuntu.whoami()
... |
4490538c9a0460608ba82e9f5789fd2a9bf9f433e0b8b2f4b765a6d9e27de14e | def main():
'\n to run:\n kosmos \'j.sal.ubuntu.test(name="ubuntu")\'\n '
before()
test001_uptime()
test002_service_install()
test003_version_get()
test004_apt_install_check()
test005_apt_install_version()
test006_deb_install()
test007_pkg_list()
test008_service_start()
... | to run:
kosmos 'j.sal.ubuntu.test(name="ubuntu")' | JumpscaleLibs/sal/ubuntu/tests/test_ubuntu.py | main | grimpy/jumpscaleX_libs | 0 | python | def main():
'\n to run:\n kosmos \'j.sal.ubuntu.test(name="ubuntu")\'\n '
before()
test001_uptime()
test002_service_install()
test003_version_get()
test004_apt_install_check()
test005_apt_install_version()
test006_deb_install()
test007_pkg_list()
test008_service_start()
... | def main():
'\n to run:\n kosmos \'j.sal.ubuntu.test(name="ubuntu")\'\n '
before()
test001_uptime()
test002_service_install()
test003_version_get()
test004_apt_install_check()
test005_apt_install_version()
test006_deb_install()
test007_pkg_list()
test008_service_start()
... |
a962523a97b6de0310877378bbb0d7050562ffd4292ffa8528f525b75fe0d697 | def dictstatus(node_list, reports_dict, status_dict, sort=True, sortby=None, asc=False, get_status='all', puppet_run_time=PUPPET_RUN_INTERVAL):
'\n :param node_list: dict\n :param status_dict: dict\n :param sortby: Takes a field name to sort by \'certname\', \'latestCatalog\', \'latestReport\', \'latestFac... | :param node_list: dict
:param status_dict: dict
:param sortby: Takes a field name to sort by 'certname', 'latestCatalog', 'latestReport', 'latestFacts', 'success', 'noop', 'failure', 'skipped'
:param get_status: Status type to return. all, changed, failed, unreported, noops
:return: tuple(tuple,tuple)
node_dict input:... | pano/methods/dictfuncs.py | dictstatus | jeroenzeegers/panopuppet | 0 | python | def dictstatus(node_list, reports_dict, status_dict, sort=True, sortby=None, asc=False, get_status='all', puppet_run_time=PUPPET_RUN_INTERVAL):
'\n :param node_list: dict\n :param status_dict: dict\n :param sortby: Takes a field name to sort by \'certname\', \'latestCatalog\', \'latestReport\', \'latestFac... | def dictstatus(node_list, reports_dict, status_dict, sort=True, sortby=None, asc=False, get_status='all', puppet_run_time=PUPPET_RUN_INTERVAL):
'\n :param node_list: dict\n :param status_dict: dict\n :param sortby: Takes a field name to sort by \'certname\', \'latestCatalog\', \'latestReport\', \'latestFac... |
b9088c28b5c2adadbbab63812a499d026d3bfc7a8c76186958339a0e1ef53045 | def check_failed_compile(report_timestamp, fact_timestamp, catalog_timestamp, puppet_run_interval=puppet_run_time):
'\n :param report_timestamp: str\n :param fact_timestamp: str\n :param catalog_timestamp: str\n :return: Bool\n Returns False if the compiled run has not failed\n ... | :param report_timestamp: str
:param fact_timestamp: str
:param catalog_timestamp: str
:return: Bool
Returns False if the compiled run has not failed
Returns True if the compiled run has failed | pano/methods/dictfuncs.py | check_failed_compile | jeroenzeegers/panopuppet | 0 | python | def check_failed_compile(report_timestamp, fact_timestamp, catalog_timestamp, puppet_run_interval=puppet_run_time):
'\n :param report_timestamp: str\n :param fact_timestamp: str\n :param catalog_timestamp: str\n :return: Bool\n Returns False if the compiled run has not failed\n ... | def check_failed_compile(report_timestamp, fact_timestamp, catalog_timestamp, puppet_run_interval=puppet_run_time):
'\n :param report_timestamp: str\n :param fact_timestamp: str\n :param catalog_timestamp: str\n :return: Bool\n Returns False if the compiled run has not failed\n ... |
d7439c8f3ccf9568ddf7cc8e09e42c25895f15f2579ad4d3a7b1015953c68966 | def claims(request):
'\n Show all current claims.\n '
claims = Claim.objects.all()
paginator = Paginator(claims, 10)
page = request.GET.get('page')
try:
claims = paginator.page(page)
except PageNotAnInteger:
claims = paginator.page(1)
except EmptyPage:
claims = ... | Show all current claims. | django/search/views.py | claims | arunchaganty/odd-nails | 0 | python | def claims(request):
'\n \n '
claims = Claim.objects.all()
paginator = Paginator(claims, 10)
page = request.GET.get('page')
try:
claims = paginator.page(page)
except PageNotAnInteger:
claims = paginator.page(1)
except EmptyPage:
claims = paginator.page(paginator... | def claims(request):
'\n \n '
claims = Claim.objects.all()
paginator = Paginator(claims, 10)
page = request.GET.get('page')
try:
claims = paginator.page(page)
except PageNotAnInteger:
claims = paginator.page(1)
except EmptyPage:
claims = paginator.page(paginator... |
f7fda0206a061d24cfaa16ee25d4745a1bdd97dc541ddd020e0d61ccc4d37aa5 | def build_mathematica(target, source, env):
'\n Build targets with a Mathematica command\n \n This function executes a Mathematica function to build objects \n specified by target using the objects specified by source.\n It requires Mathematica to be callable from the command line \n via `math` (or `... | Build targets with a Mathematica command
This function executes a Mathematica function to build objects
specified by target using the objects specified by source.
It requires Mathematica to be callable from the command line
via `math` (or `MathKernel` for OS X). | gslab_scons/builders/build_mathematica.py | build_mathematica | gslab-econ/gslab_python | 12 | python | def build_mathematica(target, source, env):
'\n Build targets with a Mathematica command\n \n This function executes a Mathematica function to build objects \n specified by target using the objects specified by source.\n It requires Mathematica to be callable from the command line \n via `math` (or `... | def build_mathematica(target, source, env):
'\n Build targets with a Mathematica command\n \n This function executes a Mathematica function to build objects \n specified by target using the objects specified by source.\n It requires Mathematica to be callable from the command line \n via `math` (or `... |
93d039bdaf07e7117907f6737498291acce34fef257803ccc5f0cb2780b5c417 | def is_downloaded(folder):
' Returns whether data has been downloaded '
return (os.path.isfile(get_data_path(folder)) and os.path.isfile(get_data_path(folder))) | Returns whether data has been downloaded | datasets/motor.py | is_downloaded | DaniUPC/tf_dataio | 2 | python | def is_downloaded(folder):
' '
return (os.path.isfile(get_data_path(folder)) and os.path.isfile(get_data_path(folder))) | def is_downloaded(folder):
' '
return (os.path.isfile(get_data_path(folder)) and os.path.isfile(get_data_path(folder)))<|docstring|>Returns whether data has been downloaded<|endoftext|> |
425d1a9f25297befba3e90eaf3778f51c63674b953b3e96aa3e3787229922563 | def __init__(self, data_path):
' See base class '
super(MotorSerialize, self).__init__(data_path)
create_dir(data_path)
if (not is_downloaded(data_path)):
logger.info('Downloading Motor dataset ...')
urllib.request.urlretrieve(DATA_URL, get_data_path(data_path)) | See base class | datasets/motor.py | __init__ | DaniUPC/tf_dataio | 2 | python | def __init__(self, data_path):
' '
super(MotorSerialize, self).__init__(data_path)
create_dir(data_path)
if (not is_downloaded(data_path)):
logger.info('Downloading Motor dataset ...')
urllib.request.urlretrieve(DATA_URL, get_data_path(data_path)) | def __init__(self, data_path):
' '
super(MotorSerialize, self).__init__(data_path)
create_dir(data_path)
if (not is_downloaded(data_path)):
logger.info('Downloading Motor dataset ...')
urllib.request.urlretrieve(DATA_URL, get_data_path(data_path))<|docstring|>See base class<|endoftext|> |
899c87f9633db109b65eda6b46e89b5fcc09c3679c452b3abf0a3932c62ea947 | def construct(identifier, uco_object, *args):
'Constructs property bundles based on the given identifier.\n\n Args:\n identifier: The unique identifier to associate to a property bundle to create.\n uco_object: The uco_object to place the property bundles in.\n *args: Extra arguments used by... | Constructs property bundles based on the given identifier.
Args:
identifier: The unique identifier to associate to a property bundle to create.
uco_object: The uco_object to place the property bundles in.
*args: Extra arguments used by the given property bundle constructor. | case_plaso/file_relationships.py | construct | casework/CASE-Implementation-Plaso | 1 | python | def construct(identifier, uco_object, *args):
'Constructs property bundles based on the given identifier.\n\n Args:\n identifier: The unique identifier to associate to a property bundle to create.\n uco_object: The uco_object to place the property bundles in.\n *args: Extra arguments used by... | def construct(identifier, uco_object, *args):
'Constructs property bundles based on the given identifier.\n\n Args:\n identifier: The unique identifier to associate to a property bundle to create.\n uco_object: The uco_object to place the property bundles in.\n *args: Extra arguments used by... |
07a73ff33d05aa099f0bf1d2cb8c239eeb2000bac6ef1fc99da04714262ea231 | def __init__(self, model, Q, R):
'\n Constructs stage cost\n\n Parameters\n ---------\n model : object of nmpccodegen.models.model or nmpccodegen.models.model_continious \n Q : quadratic cost on the state\n R : quadratic cost on the input\n '
self._Q = Q
self... | Constructs stage cost
Parameters
---------
model : object of nmpccodegen.models.model or nmpccodegen.models.model_continious
Q : quadratic cost on the state
R : quadratic cost on the input | old_code/src_python/nmpccodegen/controller/stage_costs.py | __init__ | kul-forbes/nmpc-codegen | 24 | python | def __init__(self, model, Q, R):
'\n Constructs stage cost\n\n Parameters\n ---------\n model : object of nmpccodegen.models.model or nmpccodegen.models.model_continious \n Q : quadratic cost on the state\n R : quadratic cost on the input\n '
self._Q = Q
self... | def __init__(self, model, Q, R):
'\n Constructs stage cost\n\n Parameters\n ---------\n model : object of nmpccodegen.models.model or nmpccodegen.models.model_continious \n Q : quadratic cost on the state\n R : quadratic cost on the input\n '
self._Q = Q
self... |
6b4ea8203d7b7c15e2dc2232f45c4d45fea178d2ec9973a72f8d5370538028dc | def evaluate_cost(self, state, input, iteration_index, state_reference, input_reference):
" \n Calculate stage cost \n\n Parameters\n ---------\n state : current state of the system\n input : current input of the system\n iteration_index : step index of the discrete system\... | Calculate stage cost
Parameters
---------
state : current state of the system
input : current input of the system
iteration_index : step index of the discrete system
state_reference : wanted state of the system
input_reference : wanted input of the system
Returns
------
Stage Cost (x'Qx + u'Ru) | old_code/src_python/nmpccodegen/controller/stage_costs.py | evaluate_cost | kul-forbes/nmpc-codegen | 24 | python | def evaluate_cost(self, state, input, iteration_index, state_reference, input_reference):
" \n Calculate stage cost \n\n Parameters\n ---------\n state : current state of the system\n input : current input of the system\n iteration_index : step index of the discrete system\... | def evaluate_cost(self, state, input, iteration_index, state_reference, input_reference):
" \n Calculate stage cost \n\n Parameters\n ---------\n state : current state of the system\n input : current input of the system\n iteration_index : step index of the discrete system\... |
63dda0155c8c97163d2354941872707f3e7622299a2ca8c22ecd074f6af675c9 | def initialize_schema(self):
'Create every necessary objects (like tables or indices) in the\n backend.\n\n This is excuted when the ``cliquet migrate`` command is ran.\n '
raise NotImplementedError | Create every necessary objects (like tables or indices) in the
backend.
This is excuted when the ``cliquet migrate`` command is ran. | cliquet/cache/__init__.py | initialize_schema | ravitejavalluri/cliquet | 89 | python | def initialize_schema(self):
'Create every necessary objects (like tables or indices) in the\n backend.\n\n This is excuted when the ``cliquet migrate`` command is ran.\n '
raise NotImplementedError | def initialize_schema(self):
'Create every necessary objects (like tables or indices) in the\n backend.\n\n This is excuted when the ``cliquet migrate`` command is ran.\n '
raise NotImplementedError<|docstring|>Create every necessary objects (like tables or indices) in the
backend.
This is... |
c267ea5dd835bbb742b9ddb78c33572872f7a2c8bd7c9bff492255f204215462 | def flush(self):
'Delete every values.'
raise NotImplementedError | Delete every values. | cliquet/cache/__init__.py | flush | ravitejavalluri/cliquet | 89 | python | def flush(self):
raise NotImplementedError | def flush(self):
raise NotImplementedError<|docstring|>Delete every values.<|endoftext|> |
9f37b7ecefaf076b93e24a1b8e24fce537b206637f9ef1166023da4100efb3db | def ttl(self, key):
'Obtain the expiration value of the specified `key`.\n\n :param str key: key\n :returns: number of seconds or negative if no TTL.\n :rtype: float\n '
raise NotImplementedError | Obtain the expiration value of the specified `key`.
:param str key: key
:returns: number of seconds or negative if no TTL.
:rtype: float | cliquet/cache/__init__.py | ttl | ravitejavalluri/cliquet | 89 | python | def ttl(self, key):
'Obtain the expiration value of the specified `key`.\n\n :param str key: key\n :returns: number of seconds or negative if no TTL.\n :rtype: float\n '
raise NotImplementedError | def ttl(self, key):
'Obtain the expiration value of the specified `key`.\n\n :param str key: key\n :returns: number of seconds or negative if no TTL.\n :rtype: float\n '
raise NotImplementedError<|docstring|>Obtain the expiration value of the specified `key`.
:param str key: key
:re... |
b93c49281ade0fa93a3bd5c03367d56a66051ae24b8fe29c8e2fa1e8166d928a | def expire(self, key, ttl):
'Set the expiration value `ttl` for the specified `key`.\n\n :param str key: key\n :param float ttl: number of seconds\n '
raise NotImplementedError | Set the expiration value `ttl` for the specified `key`.
:param str key: key
:param float ttl: number of seconds | cliquet/cache/__init__.py | expire | ravitejavalluri/cliquet | 89 | python | def expire(self, key, ttl):
'Set the expiration value `ttl` for the specified `key`.\n\n :param str key: key\n :param float ttl: number of seconds\n '
raise NotImplementedError | def expire(self, key, ttl):
'Set the expiration value `ttl` for the specified `key`.\n\n :param str key: key\n :param float ttl: number of seconds\n '
raise NotImplementedError<|docstring|>Set the expiration value `ttl` for the specified `key`.
:param str key: key
:param float ttl: number ... |
6ab7ee58c0d6bf74f51ae27a4ba0ecb437bbe14a8278b52b7053d078f8d13ea1 | def set(self, key, value, ttl=None):
'Store a value with the specified `key`. If `ttl` is provided,\n set an expiration value.\n\n :param str key: key\n :param str value: value to store\n :param float ttl: expire after number of seconds\n '
raise NotImplementedError | Store a value with the specified `key`. If `ttl` is provided,
set an expiration value.
:param str key: key
:param str value: value to store
:param float ttl: expire after number of seconds | cliquet/cache/__init__.py | set | ravitejavalluri/cliquet | 89 | python | def set(self, key, value, ttl=None):
'Store a value with the specified `key`. If `ttl` is provided,\n set an expiration value.\n\n :param str key: key\n :param str value: value to store\n :param float ttl: expire after number of seconds\n '
raise NotImplementedError | def set(self, key, value, ttl=None):
'Store a value with the specified `key`. If `ttl` is provided,\n set an expiration value.\n\n :param str key: key\n :param str value: value to store\n :param float ttl: expire after number of seconds\n '
raise NotImplementedError<|docstring... |
e7fe6353d54c0909cf298e75102c15b587ebb0261df71da0301d98913d319ffd | def get(self, key):
'Obtain the value of the specified `key`.\n\n :param str key: key\n :returns: the stored value or None if missing.\n :rtype: str\n '
raise NotImplementedError | Obtain the value of the specified `key`.
:param str key: key
:returns: the stored value or None if missing.
:rtype: str | cliquet/cache/__init__.py | get | ravitejavalluri/cliquet | 89 | python | def get(self, key):
'Obtain the value of the specified `key`.\n\n :param str key: key\n :returns: the stored value or None if missing.\n :rtype: str\n '
raise NotImplementedError | def get(self, key):
'Obtain the value of the specified `key`.\n\n :param str key: key\n :returns: the stored value or None if missing.\n :rtype: str\n '
raise NotImplementedError<|docstring|>Obtain the value of the specified `key`.
:param str key: key
:returns: the stored value or N... |
5d581adabfda22516216dd014f9d957c82fc9e1ba63429fdd6c99b12fc02044b | def delete(self, key):
'Delete the value of the specified `key`.\n\n :param str key: key\n '
raise NotImplementedError | Delete the value of the specified `key`.
:param str key: key | cliquet/cache/__init__.py | delete | ravitejavalluri/cliquet | 89 | python | def delete(self, key):
'Delete the value of the specified `key`.\n\n :param str key: key\n '
raise NotImplementedError | def delete(self, key):
'Delete the value of the specified `key`.\n\n :param str key: key\n '
raise NotImplementedError<|docstring|>Delete the value of the specified `key`.
:param str key: key<|endoftext|> |
ca913ca87f2a6e9feb95af81414d1104b0e32ef3dcc970a3411551e905583e8c | def ping(request):
'Test that cache backend is operationnal.\n\n :param request: current request object\n :type request: :class:`~pyramid:pyramid.request.Request`\n :returns: ``True`` is everything is ok, ``False`` otherwise.\n :rtype: bool\n '
try:
if (random.random()... | Test that cache backend is operationnal.
:param request: current request object
:type request: :class:`~pyramid:pyramid.request.Request`
:returns: ``True`` is everything is ok, ``False`` otherwise.
:rtype: bool | cliquet/cache/__init__.py | ping | ravitejavalluri/cliquet | 89 | python | def ping(request):
'Test that cache backend is operationnal.\n\n :param request: current request object\n :type request: :class:`~pyramid:pyramid.request.Request`\n :returns: ``True`` is everything is ok, ``False`` otherwise.\n :rtype: bool\n '
try:
if (random.random()... | def ping(request):
'Test that cache backend is operationnal.\n\n :param request: current request object\n :type request: :class:`~pyramid:pyramid.request.Request`\n :returns: ``True`` is everything is ok, ``False`` otherwise.\n :rtype: bool\n '
try:
if (random.random()... |
14e2efa685bbd5865d8543dc78b8e2e58a5afa347c67a0364e49c15323c77ae3 | def fmu_qss_gen():
'Generate an FMU-QSS from an FMU-ME'
parser = argparse.ArgumentParser()
parser.add_argument('ME', help='FMU-ME fmu or xml file', default='modelDescription.xml')
parser.add_argument('--qss', help='QSS method (x)(LI)QSS(1|2|3) [QSS2]', default='QSS2')
parser.add_argument('--rTol',... | Generate an FMU-QSS from an FMU-ME | bin/FMU-QSS.gen.py | fmu_qss_gen | NREL/SOEP-QSS | 13 | python | def fmu_qss_gen():
parser = argparse.ArgumentParser()
parser.add_argument('ME', help='FMU-ME fmu or xml file', default='modelDescription.xml')
parser.add_argument('--qss', help='QSS method (x)(LI)QSS(1|2|3) [QSS2]', default='QSS2')
parser.add_argument('--rTol', help='relative tolerance [FMU]', t... | def fmu_qss_gen():
parser = argparse.ArgumentParser()
parser.add_argument('ME', help='FMU-ME fmu or xml file', default='modelDescription.xml')
parser.add_argument('--qss', help='QSS method (x)(LI)QSS(1|2|3) [QSS2]', default='QSS2')
parser.add_argument('--rTol', help='relative tolerance [FMU]', t... |
32f76d4ad855507dda06b64afe7370a398f1e75b1b18efefcbc19ea0e3d74fa0 | def generate_states(start: int=0, stop: int=14, n_states: int=100, parity: Union[(str, int)]='both'):
'\n Generate correct string for input to `kshell_ui.py` when asked for\n which states to calculate. Copy the string generated by this\n function and paste it into `kshell_ui.py` when it prompts for\n st... | Generate correct string for input to `kshell_ui.py` when asked for
which states to calculate. Copy the string generated by this
function and paste it into `kshell_ui.py` when it prompts for
states.
DEPRECATED: RANGE FUNCTIONALITY WAS ADDED IN kshell_ui.py MAKING
THIS FUNCTION OBSOLETE. WILL BE REMOVED.
Parameters
---... | kshell_utilities/kshell_utilities.py | generate_states | GaffaSnobb/kshell_utilities | 0 | python | def generate_states(start: int=0, stop: int=14, n_states: int=100, parity: Union[(str, int)]='both'):
'\n Generate correct string for input to `kshell_ui.py` when asked for\n which states to calculate. Copy the string generated by this\n function and paste it into `kshell_ui.py` when it prompts for\n st... | def generate_states(start: int=0, stop: int=14, n_states: int=100, parity: Union[(str, int)]='both'):
'\n Generate correct string for input to `kshell_ui.py` when asked for\n which states to calculate. Copy the string generated by this\n function and paste it into `kshell_ui.py` when it prompts for\n st... |
9a77251b4d9d088cd34d5811c164a3dff0e7a76a2804763d8148e0b6a82cb4f7 | def _generate_unique_identifier(path: str) -> str:
'\n Generate a unique identifier based on the shell script and the\n save_input file from KSHELL.\n\n Parameters\n ----------\n path : str\n The path to a summary file or a directory with a summary file.\n '
shell_file_content = ''
... | Generate a unique identifier based on the shell script and the
save_input file from KSHELL.
Parameters
----------
path : str
The path to a summary file or a directory with a summary file. | kshell_utilities/kshell_utilities.py | _generate_unique_identifier | GaffaSnobb/kshell_utilities | 0 | python | def _generate_unique_identifier(path: str) -> str:
'\n Generate a unique identifier based on the shell script and the\n save_input file from KSHELL.\n\n Parameters\n ----------\n path : str\n The path to a summary file or a directory with a summary file.\n '
shell_file_content =
sa... | def _generate_unique_identifier(path: str) -> str:
'\n Generate a unique identifier based on the shell script and the\n save_input file from KSHELL.\n\n Parameters\n ----------\n path : str\n The path to a summary file or a directory with a summary file.\n '
shell_file_content =
sa... |
62220fd102b860389ff4d69a5b57e221451f2c944ae5842db8f44ba1eb155e6b | def _load_energy_levels(infile):
'\n Load excitation energy, spin and parity into a list of structure:\n levels = [[energy, spin, parity], ...].\n Example\n -------\n Energy levels\n\n N J prty N_Jp T E(MeV) Ex(MeV) log-file\n\n 1 5/2 + 1 3/2 -16.565 0.000 log_O19_sdp... | Load excitation energy, spin and parity into a list of structure:
levels = [[energy, spin, parity], ...].
Example
-------
Energy levels
N J prty N_Jp T E(MeV) Ex(MeV) log-file
1 5/2 + 1 3/2 -16.565 0.000 log_O19_sdpf-mu_m1p.txt
2 3/2 + 1 3/2 -15.977 0.588 log_O19_sdpf-mu_m1p... | kshell_utilities/kshell_utilities.py | _load_energy_levels | GaffaSnobb/kshell_utilities | 0 | python | def _load_energy_levels(infile):
'\n Load excitation energy, spin and parity into a list of structure:\n levels = [[energy, spin, parity], ...].\n Example\n -------\n Energy levels\n\n N J prty N_Jp T E(MeV) Ex(MeV) log-file\n\n 1 5/2 + 1 3/2 -16.565 0.000 log_O19_sdp... | def _load_energy_levels(infile):
'\n Load excitation energy, spin and parity into a list of structure:\n levels = [[energy, spin, parity], ...].\n Example\n -------\n Energy levels\n\n N J prty N_Jp T E(MeV) Ex(MeV) log-file\n\n 1 5/2 + 1 3/2 -16.565 0.000 log_O19_sdp... |
79f07b4651aa580e2b258bb6bf953de3bdd9885717d36601bf54c3d64d70fd44 | def _load_transition_probabilities_old(infile):
'\n For summary files with old syntax (pre 2021-11-24).\n Parameters\n ----------\n infile:\n The KSHELL summary file.\n '
reduced_transition_prob_decay_list = []
negative_spin_counts = 0
for _ in range(2):
... | For summary files with old syntax (pre 2021-11-24).
Parameters
----------
infile:
The KSHELL summary file. | kshell_utilities/kshell_utilities.py | _load_transition_probabilities_old | GaffaSnobb/kshell_utilities | 0 | python | def _load_transition_probabilities_old(infile):
'\n For summary files with old syntax (pre 2021-11-24).\n Parameters\n ----------\n infile:\n The KSHELL summary file.\n '
reduced_transition_prob_decay_list = []
negative_spin_counts = 0
for _ in range(2):
... | def _load_transition_probabilities_old(infile):
'\n For summary files with old syntax (pre 2021-11-24).\n Parameters\n ----------\n infile:\n The KSHELL summary file.\n '
reduced_transition_prob_decay_list = []
negative_spin_counts = 0
for _ in range(2):
... |
f200a2798c834db6422a71a78d59bf19843c3fe2680b90b2959aff4f2b99e599 | def _load_transition_probabilities(infile):
'\n Example structure:\n B(E2) ( > -0.0 W.u.) mass = 50 1 W.u. = 10.9 e^2 fm^4\n e^2 fm^4 (W.u.)\n J_i pi_i idx_i Ex_i J_f pi_f idx_f Ex_f dE B(E2)-> B(E2)->[wu] B(E2)<- B(E2)<-[wu]\n 5 + ... | Example structure:
B(E2) ( > -0.0 W.u.) mass = 50 1 W.u. = 10.9 e^2 fm^4
e^2 fm^4 (W.u.)
J_i pi_i idx_i Ex_i J_f pi_f idx_f Ex_f dE B(E2)-> B(E2)->[wu] B(E2)<- B(E2)<-[wu]
5 + 1 0.036 6 + 1 0.000 0.036 70.43477980 6.43689168 59.59865983 ... | kshell_utilities/kshell_utilities.py | _load_transition_probabilities | GaffaSnobb/kshell_utilities | 0 | python | def _load_transition_probabilities(infile):
'\n Example structure:\n B(E2) ( > -0.0 W.u.) mass = 50 1 W.u. = 10.9 e^2 fm^4\n e^2 fm^4 (W.u.)\n J_i pi_i idx_i Ex_i J_f pi_f idx_f Ex_f dE B(E2)-> B(E2)->[wu] B(E2)<- B(E2)<-[wu]\n 5 + ... | def _load_transition_probabilities(infile):
'\n Example structure:\n B(E2) ( > -0.0 W.u.) mass = 50 1 W.u. = 10.9 e^2 fm^4\n e^2 fm^4 (W.u.)\n J_i pi_i idx_i Ex_i J_f pi_f idx_f Ex_f dE B(E2)-> B(E2)->[wu] B(E2)<- B(E2)<-[wu]\n 5 + ... |
843dc061447c6dbfed7caab751dfb08f2204456a5fb443283ff5bce1bf49548c | def _load_parallel(arg_list):
'\n For parallel data loads.\n [self.fname_summary, "Energy", self._load_energy_levels, None]\n '
(fname, condition, loader, thread_idx) = arg_list
print(f'Thread {thread_idx} loading {condition} values...')
load_time = time.perf_counter()
with open(fname, 'r')... | For parallel data loads.
[self.fname_summary, "Energy", self._load_energy_levels, None] | kshell_utilities/kshell_utilities.py | _load_parallel | GaffaSnobb/kshell_utilities | 0 | python | def _load_parallel(arg_list):
'\n For parallel data loads.\n [self.fname_summary, "Energy", self._load_energy_levels, None]\n '
(fname, condition, loader, thread_idx) = arg_list
print(f'Thread {thread_idx} loading {condition} values...')
load_time = time.perf_counter()
with open(fname, 'r')... | def _load_parallel(arg_list):
'\n For parallel data loads.\n [self.fname_summary, "Energy", self._load_energy_levels, None]\n '
(fname, condition, loader, thread_idx) = arg_list
print(f'Thread {thread_idx} loading {condition} values...')
load_time = time.perf_counter()
with open(fname, 'r')... |
3406c905b322eba9453d5444590a1bc142efb80a448c136371d9017b31e63354 | def _process_kshell_output_in_parallel(args):
'\n Simple wrapper for parallelizing loading of KSHELL files.\n '
(filepath, load_and_save_to_file, old_or_new) = args
print(filepath)
return ReadKshellOutput(filepath, load_and_save_to_file, old_or_new) | Simple wrapper for parallelizing loading of KSHELL files. | kshell_utilities/kshell_utilities.py | _process_kshell_output_in_parallel | GaffaSnobb/kshell_utilities | 0 | python | def _process_kshell_output_in_parallel(args):
'\n \n '
(filepath, load_and_save_to_file, old_or_new) = args
print(filepath)
return ReadKshellOutput(filepath, load_and_save_to_file, old_or_new) | def _process_kshell_output_in_parallel(args):
'\n \n '
(filepath, load_and_save_to_file, old_or_new) = args
print(filepath)
return ReadKshellOutput(filepath, load_and_save_to_file, old_or_new)<|docstring|>Simple wrapper for parallelizing loading of KSHELL files.<|endoftext|> |
182f25e6df1b45ce7da2a5a679e4adf030d6ec0c36398b90c9e7e59f3b857bc4 | def loadtxt(path: str, is_directory: bool=False, filter_: Union[(None, str)]=None, load_and_save_to_file: Union[(bool, str)]=True, old_or_new='new') -> list:
"\n Wrapper for using ReadKshellOutput class as a function.\n TODO: Consider changing 'path' to 'fname' to be the same as\n np.loadtxt.\n\n Parame... | Wrapper for using ReadKshellOutput class as a function.
TODO: Consider changing 'path' to 'fname' to be the same as
np.loadtxt.
Parameters
----------
path : str
Filename (and path) of `KSHELL` output data file, or path to
directory containing sub-directories with `KSHELL` output data.
is_directory : bool
... | kshell_utilities/kshell_utilities.py | loadtxt | GaffaSnobb/kshell_utilities | 0 | python | def loadtxt(path: str, is_directory: bool=False, filter_: Union[(None, str)]=None, load_and_save_to_file: Union[(bool, str)]=True, old_or_new='new') -> list:
"\n Wrapper for using ReadKshellOutput class as a function.\n TODO: Consider changing 'path' to 'fname' to be the same as\n np.loadtxt.\n\n Parame... | def loadtxt(path: str, is_directory: bool=False, filter_: Union[(None, str)]=None, load_and_save_to_file: Union[(bool, str)]=True, old_or_new='new') -> list:
"\n Wrapper for using ReadKshellOutput class as a function.\n TODO: Consider changing 'path' to 'fname' to be the same as\n np.loadtxt.\n\n Parame... |
cb4b60a2eb3c2c1ac66cf0043f6a6b71ec3d4bd0acdf2a170aa55f8afdedbc41 | def _get_timing_data(path: str):
'\n Get timing data from KSHELL log files.\n\n Parameters\n ----------\n path : str\n Path to log file.\n\n Examples\n --------\n Last 10 lines of log_Ar30_usda_m0p.txt:\n ```\n total 20.899 2 10.44928 1.0000\n pre-process... | Get timing data from KSHELL log files.
Parameters
----------
path : str
Path to log file.
Examples
--------
Last 10 lines of log_Ar30_usda_m0p.txt:
```
total 20.899 2 10.44928 1.0000
pre-process 0.029 1 0.02866 0.0014
operate 3.202 1... | kshell_utilities/kshell_utilities.py | _get_timing_data | GaffaSnobb/kshell_utilities | 0 | python | def _get_timing_data(path: str):
'\n Get timing data from KSHELL log files.\n\n Parameters\n ----------\n path : str\n Path to log file.\n\n Examples\n --------\n Last 10 lines of log_Ar30_usda_m0p.txt:\n ```\n total 20.899 2 10.44928 1.0000\n pre-process... | def _get_timing_data(path: str):
'\n Get timing data from KSHELL log files.\n\n Parameters\n ----------\n path : str\n Path to log file.\n\n Examples\n --------\n Last 10 lines of log_Ar30_usda_m0p.txt:\n ```\n total 20.899 2 10.44928 1.0000\n pre-process... |
6b8dc4df1920697583beda577262f9a1be8530ffa1e8716b34b89072080a8a66 | def _get_memory_usage(path: str) -> Union[(float, None)]:
'\n Get memory usage from KSHELL log files.\n\n Parameters\n ----------\n path : str\n Path to a single log file.\n\n Returns\n -------\n total : float, None\n Memory usage in GB or None if memory usage could not be read.\n... | Get memory usage from KSHELL log files.
Parameters
----------
path : str
Path to a single log file.
Returns
-------
total : float, None
Memory usage in GB or None if memory usage could not be read. | kshell_utilities/kshell_utilities.py | _get_memory_usage | GaffaSnobb/kshell_utilities | 0 | python | def _get_memory_usage(path: str) -> Union[(float, None)]:
'\n Get memory usage from KSHELL log files.\n\n Parameters\n ----------\n path : str\n Path to a single log file.\n\n Returns\n -------\n total : float, None\n Memory usage in GB or None if memory usage could not be read.\n... | def _get_memory_usage(path: str) -> Union[(float, None)]:
'\n Get memory usage from KSHELL log files.\n\n Parameters\n ----------\n path : str\n Path to a single log file.\n\n Returns\n -------\n total : float, None\n Memory usage in GB or None if memory usage could not be read.\n... |
8ea1cb6a69e9161ec44e3a810d071847786c426834150cded5eb18fe15767fd4 | def _sortkey(filename):
"\n Key for sorting filenames based on angular momentum and parity.\n Example filename: 'log_Sc44_GCLSTsdpfsdgix5pn_j0n.txt'\n (angular momentum = 0). \n "
tmp = filename.split('_')[(- 1)]
tmp = tmp.split('.')[0]
spin = int(tmp[1:(- 1)])
return spin | Key for sorting filenames based on angular momentum and parity.
Example filename: 'log_Sc44_GCLSTsdpfsdgix5pn_j0n.txt'
(angular momentum = 0). | kshell_utilities/kshell_utilities.py | _sortkey | GaffaSnobb/kshell_utilities | 0 | python | def _sortkey(filename):
"\n Key for sorting filenames based on angular momentum and parity.\n Example filename: 'log_Sc44_GCLSTsdpfsdgix5pn_j0n.txt'\n (angular momentum = 0). \n "
tmp = filename.split('_')[(- 1)]
tmp = tmp.split('.')[0]
spin = int(tmp[1:(- 1)])
return spin | def _sortkey(filename):
"\n Key for sorting filenames based on angular momentum and parity.\n Example filename: 'log_Sc44_GCLSTsdpfsdgix5pn_j0n.txt'\n (angular momentum = 0). \n "
tmp = filename.split('_')[(- 1)]
tmp = tmp.split('.')[0]
spin = int(tmp[1:(- 1)])
return spin<|docstring|>K... |
ba8242dfd9500e601685a84440118dfd564d12e998e4acafcfefa102faf114df | def _get_data_general(path: str, func: Callable, plot: bool):
'\n General input handling for timing data and memory data.\n\n Parameters\n ----------\n path : str\n Path to a single log file or path to a directory of log files.\n\n func : Callable\n _get_timing_data or _get_memory_usage... | General input handling for timing data and memory data.
Parameters
----------
path : str
Path to a single log file or path to a directory of log files.
func : Callable
_get_timing_data or _get_memory_usage. | kshell_utilities/kshell_utilities.py | _get_data_general | GaffaSnobb/kshell_utilities | 0 | python | def _get_data_general(path: str, func: Callable, plot: bool):
'\n General input handling for timing data and memory data.\n\n Parameters\n ----------\n path : str\n Path to a single log file or path to a directory of log files.\n\n func : Callable\n _get_timing_data or _get_memory_usage... | def _get_data_general(path: str, func: Callable, plot: bool):
'\n General input handling for timing data and memory data.\n\n Parameters\n ----------\n path : str\n Path to a single log file or path to a directory of log files.\n\n func : Callable\n _get_timing_data or _get_memory_usage... |
fbb2a920d8588f3ea9552a22b2f3414a4aa22707df026c2f2ba462add385fa17 | def get_timing_data(path: str, plot: bool=False) -> float:
'\n Wrapper for _get_timing_data. Input a single log filename and get\n the timing data. Input a path to a directory several log files and\n get the summed timing data. In units of seconds.\n\n Parameters\n ----------\n path : str\n ... | Wrapper for _get_timing_data. Input a single log filename and get
the timing data. Input a path to a directory several log files and
get the summed timing data. In units of seconds.
Parameters
----------
path : str
Path to a single log file or path to a directory of log files.
Returns
-------
: float
The summ... | kshell_utilities/kshell_utilities.py | get_timing_data | GaffaSnobb/kshell_utilities | 0 | python | def get_timing_data(path: str, plot: bool=False) -> float:
'\n Wrapper for _get_timing_data. Input a single log filename and get\n the timing data. Input a path to a directory several log files and\n get the summed timing data. In units of seconds.\n\n Parameters\n ----------\n path : str\n ... | def get_timing_data(path: str, plot: bool=False) -> float:
'\n Wrapper for _get_timing_data. Input a single log filename and get\n the timing data. Input a path to a directory several log files and\n get the summed timing data. In units of seconds.\n\n Parameters\n ----------\n path : str\n ... |
c04a3f8375c4587a4eff2776c61ebdd23741a5b10782b180dcbd4af8dfb8a189 | def get_memory_usage(path: str) -> float:
'\n Wrapper for _get_memory_usage. Input a single log filename and get\n the memory data. Input a path to a directory several log files and\n get the summed memory data. In units of GB.\n\n Parameters\n ----------\n path : str\n Path to a single log... | Wrapper for _get_memory_usage. Input a single log filename and get
the memory data. Input a path to a directory several log files and
get the summed memory data. In units of GB.
Parameters
----------
path : str
Path to a single log file or path to a directory of log files.
Returns
-------
: float
The summed m... | kshell_utilities/kshell_utilities.py | get_memory_usage | GaffaSnobb/kshell_utilities | 0 | python | def get_memory_usage(path: str) -> float:
'\n Wrapper for _get_memory_usage. Input a single log filename and get\n the memory data. Input a path to a directory several log files and\n get the summed memory data. In units of GB.\n\n Parameters\n ----------\n path : str\n Path to a single log... | def get_memory_usage(path: str) -> float:
'\n Wrapper for _get_memory_usage. Input a single log filename and get\n the memory data. Input a path to a directory several log files and\n get the summed memory data. In units of GB.\n\n Parameters\n ----------\n path : str\n Path to a single log... |
f5086febe6eeed1703cfaff6e280e1d7b8bf32fac04793e80f38732e7bb8daaf | def get_parameters(path: str, verbose: bool=True) -> dict:
'\n Extract the parameters which are fed to KSHELL throught the shell\n script.\n\n Parameters\n ----------\n path : str\n Path to a KSHELL work directory.\n\n Returns\n -------\n res : dict\n A dictionary where the key... | Extract the parameters which are fed to KSHELL throught the shell
script.
Parameters
----------
path : str
Path to a KSHELL work directory.
Returns
-------
res : dict
A dictionary where the keys are the parameter names and the
values are the corresponding values. | kshell_utilities/kshell_utilities.py | get_parameters | GaffaSnobb/kshell_utilities | 0 | python | def get_parameters(path: str, verbose: bool=True) -> dict:
'\n Extract the parameters which are fed to KSHELL throught the shell\n script.\n\n Parameters\n ----------\n path : str\n Path to a KSHELL work directory.\n\n Returns\n -------\n res : dict\n A dictionary where the key... | def get_parameters(path: str, verbose: bool=True) -> dict:
'\n Extract the parameters which are fed to KSHELL throught the shell\n script.\n\n Parameters\n ----------\n path : str\n Path to a KSHELL work directory.\n\n Returns\n -------\n res : dict\n A dictionary where the key... |
6e78a97d5f9eab3e7e197dd81e6f50c74ff4b9040d9a9dc82ff52f1ee61840bc | def __init__(self, path: str, load_and_save_to_file: bool, old_or_new: str):
'\n Parameters\n ----------\n path : string\n Path of `KSHELL` output file directory, or path to a\n specific `KSHELL` data file.\n\n load_and_save_to_file : bool\n Toggle saving... | Parameters
----------
path : string
Path of `KSHELL` output file directory, or path to a
specific `KSHELL` data file.
load_and_save_to_file : bool
Toggle saving data as `.npy` files on / off. If `overwrite`,
saved `.npy` files are overwritten.
old_or_new : str
Choose between old and new summary fi... | kshell_utilities/kshell_utilities.py | __init__ | GaffaSnobb/kshell_utilities | 0 | python | def __init__(self, path: str, load_and_save_to_file: bool, old_or_new: str):
'\n Parameters\n ----------\n path : string\n Path of `KSHELL` output file directory, or path to a\n specific `KSHELL` data file.\n\n load_and_save_to_file : bool\n Toggle saving... | def __init__(self, path: str, load_and_save_to_file: bool, old_or_new: str):
'\n Parameters\n ----------\n path : string\n Path of `KSHELL` output file directory, or path to a\n specific `KSHELL` data file.\n\n load_and_save_to_file : bool\n Toggle saving... |
e6096f3b027338be86453547e75ed97fcf382db5bfe88a83580b440398d17a30 | def _extract_info_from_ptn_fname(self):
'\n Extract nucleus and model space name.\n '
fname_split = self.fname_ptn.split('/')[(- 1)]
fname_split = fname_split.split('_')
self.nucleus = fname_split[0]
self.model_space = fname_split[1] | Extract nucleus and model space name. | kshell_utilities/kshell_utilities.py | _extract_info_from_ptn_fname | GaffaSnobb/kshell_utilities | 0 | python | def _extract_info_from_ptn_fname(self):
'\n \n '
fname_split = self.fname_ptn.split('/')[(- 1)]
fname_split = fname_split.split('_')
self.nucleus = fname_split[0]
self.model_space = fname_split[1] | def _extract_info_from_ptn_fname(self):
'\n \n '
fname_split = self.fname_ptn.split('/')[(- 1)]
fname_split = fname_split.split('_')
self.nucleus = fname_split[0]
self.model_space = fname_split[1]<|docstring|>Extract nucleus and model space name.<|endoftext|> |
91e286a4c19e78a392c427af0d7250743b267001157b6fcd32ef30fc3882f2cc | def _read_ptn(self):
'\n Read `KSHELL` partition file (.ptn) and extract proton\n partition, neutron partition, and particle-hole truncation data.\n Save as instance attributes.\n '
line_number = 0
line_number_inner = 0
self.truncation = []
with open(self.fname_ptn, 'r') ... | Read `KSHELL` partition file (.ptn) and extract proton
partition, neutron partition, and particle-hole truncation data.
Save as instance attributes. | kshell_utilities/kshell_utilities.py | _read_ptn | GaffaSnobb/kshell_utilities | 0 | python | def _read_ptn(self):
'\n Read `KSHELL` partition file (.ptn) and extract proton\n partition, neutron partition, and particle-hole truncation data.\n Save as instance attributes.\n '
line_number = 0
line_number_inner = 0
self.truncation = []
with open(self.fname_ptn, 'r') ... | def _read_ptn(self):
'\n Read `KSHELL` partition file (.ptn) and extract proton\n partition, neutron partition, and particle-hole truncation data.\n Save as instance attributes.\n '
line_number = 0
line_number_inner = 0
self.truncation = []
with open(self.fname_ptn, 'r') ... |
1f8ec1e02e50617a2a510b3f9bba7723c79eec83c96ef03b1a61e2863bee863c | def _extract_info_from_summary_fname(self):
'\n Extract nucleus and model space name.\n '
fname_split = self.fname_summary.split('/')[(- 1)]
fname_split = fname_split.split('_')
self.nucleus = fname_split[1]
self.model_space = fname_split[2][:(- 4)] | Extract nucleus and model space name. | kshell_utilities/kshell_utilities.py | _extract_info_from_summary_fname | GaffaSnobb/kshell_utilities | 0 | python | def _extract_info_from_summary_fname(self):
'\n \n '
fname_split = self.fname_summary.split('/')[(- 1)]
fname_split = fname_split.split('_')
self.nucleus = fname_split[1]
self.model_space = fname_split[2][:(- 4)] | def _extract_info_from_summary_fname(self):
'\n \n '
fname_split = self.fname_summary.split('/')[(- 1)]
fname_split = fname_split.split('_')
self.nucleus = fname_split[1]
self.model_space = fname_split[2][:(- 4)]<|docstring|>Extract nucleus and model space name.<|endoftext|> |
a5063e4cd9c4d92e88aa286a60d41586d8e9b67729f2a3a3a11bb880d4b3d25e | def _read_summary(self):
'\n Read energy level data, transition probabilities and transition\n strengths from `KSHELL` output files.\n\n Raises\n ------\n KshellDataStructureError\n If the `KSHELL` file has unexpected structure / syntax.\n '
npy_path = 'tmp'
... | Read energy level data, transition probabilities and transition
strengths from `KSHELL` output files.
Raises
------
KshellDataStructureError
If the `KSHELL` file has unexpected structure / syntax. | kshell_utilities/kshell_utilities.py | _read_summary | GaffaSnobb/kshell_utilities | 0 | python | def _read_summary(self):
'\n Read energy level data, transition probabilities and transition\n strengths from `KSHELL` output files.\n\n Raises\n ------\n KshellDataStructureError\n If the `KSHELL` file has unexpected structure / syntax.\n '
npy_path = 'tmp'
... | def _read_summary(self):
'\n Read energy level data, transition probabilities and transition\n strengths from `KSHELL` output files.\n\n Raises\n ------\n KshellDataStructureError\n If the `KSHELL` file has unexpected structure / syntax.\n '
npy_path = 'tmp'
... |
029af502c307e76ff52da0b2c0f448023378f5c8e5f1c87e68806f0b4176b47f | def level_plot(self, max_spin_states: int=1000, filter_spins: Union[(None, list)]=None):
'\n Wrapper method to include level plot as an attribute to this\n class. Generate a level plot for a single isotope. Spin on the x\n axis, energy on the y axis.\n\n Parameters\n ----------\n ... | Wrapper method to include level plot as an attribute to this
class. Generate a level plot for a single isotope. Spin on the x
axis, energy on the y axis.
Parameters
----------
max_spin_states : int
The maximum amount of states to plot for each spin. Default
set to a large number to indicate ≈ no limit.
filter... | kshell_utilities/kshell_utilities.py | level_plot | GaffaSnobb/kshell_utilities | 0 | python | def level_plot(self, max_spin_states: int=1000, filter_spins: Union[(None, list)]=None):
'\n Wrapper method to include level plot as an attribute to this\n class. Generate a level plot for a single isotope. Spin on the x\n axis, energy on the y axis.\n\n Parameters\n ----------\n ... | def level_plot(self, max_spin_states: int=1000, filter_spins: Union[(None, list)]=None):
'\n Wrapper method to include level plot as an attribute to this\n class. Generate a level plot for a single isotope. Spin on the x\n axis, energy on the y axis.\n\n Parameters\n ----------\n ... |
8c725164d7792ec362239bd7182d699e0e40d08ae2b5718bdcd86e66c2dfccd8 | def level_density_plot(self, bin_width: Union[(int, float)]=0.2, include_n_states: Union[(None, int)]=None, plot: bool=True, save_plot: bool=False):
'\n Wrapper method to include level density plotting as\n an attribute to this class. Generate the level density with the\n input bin size.\n\n ... | Wrapper method to include level density plotting as
an attribute to this class. Generate the level density with the
input bin size.
Parameters
----------
See level_density in general_utilities.py for parameter
information. | kshell_utilities/kshell_utilities.py | level_density_plot | GaffaSnobb/kshell_utilities | 0 | python | def level_density_plot(self, bin_width: Union[(int, float)]=0.2, include_n_states: Union[(None, int)]=None, plot: bool=True, save_plot: bool=False):
'\n Wrapper method to include level density plotting as\n an attribute to this class. Generate the level density with the\n input bin size.\n\n ... | def level_density_plot(self, bin_width: Union[(int, float)]=0.2, include_n_states: Union[(None, int)]=None, plot: bool=True, save_plot: bool=False):
'\n Wrapper method to include level density plotting as\n an attribute to this class. Generate the level density with the\n input bin size.\n\n ... |
ae6468fbcf49f11cb2dedfbcec47fcac68f255f4493bd7cf542375fe345d1d3f | def nld(self, bin_width: Union[(int, float)]=0.2, include_n_states: Union[(None, int)]=None, plot: bool=True, save_plot: bool=False):
'\n Wrapper method to level_density_plot.\n '
return self.level_density_plot(bin_width=bin_width, include_n_states=include_n_states, plot=plot, save_plot=save_plot) | Wrapper method to level_density_plot. | kshell_utilities/kshell_utilities.py | nld | GaffaSnobb/kshell_utilities | 0 | python | def nld(self, bin_width: Union[(int, float)]=0.2, include_n_states: Union[(None, int)]=None, plot: bool=True, save_plot: bool=False):
'\n \n '
return self.level_density_plot(bin_width=bin_width, include_n_states=include_n_states, plot=plot, save_plot=save_plot) | def nld(self, bin_width: Union[(int, float)]=0.2, include_n_states: Union[(None, int)]=None, plot: bool=True, save_plot: bool=False):
'\n \n '
return self.level_density_plot(bin_width=bin_width, include_n_states=include_n_states, plot=plot, save_plot=save_plot)<|docstring|>Wrapper method to level_... |
0be06deaa7572b333dd87244352f67737377ab23c5b640f9ca330f2ce47ea70a | def gamma_strength_function_average_plot(self, bin_width: Union[(float, int)]=0.2, Ex_min: Union[(float, int)]=5, Ex_max: Union[(float, int)]=50, multipole_type: str='M1', prefactor_E1: Union[(None, float)]=None, prefactor_M1: Union[(None, float)]=None, prefactor_E2: Union[(None, float)]=None, initial_or_final: str='in... | Wrapper method to include gamma ray strength function
calculations as an attribute to this class.
Parameters
----------
See gamma_strength_function_average in general_utilities.py
for parameter descriptions. | kshell_utilities/kshell_utilities.py | gamma_strength_function_average_plot | GaffaSnobb/kshell_utilities | 0 | python | def gamma_strength_function_average_plot(self, bin_width: Union[(float, int)]=0.2, Ex_min: Union[(float, int)]=5, Ex_max: Union[(float, int)]=50, multipole_type: str='M1', prefactor_E1: Union[(None, float)]=None, prefactor_M1: Union[(None, float)]=None, prefactor_E2: Union[(None, float)]=None, initial_or_final: str='in... | def gamma_strength_function_average_plot(self, bin_width: Union[(float, int)]=0.2, Ex_min: Union[(float, int)]=5, Ex_max: Union[(float, int)]=50, multipole_type: str='M1', prefactor_E1: Union[(None, float)]=None, prefactor_M1: Union[(None, float)]=None, prefactor_E2: Union[(None, float)]=None, initial_or_final: str='in... |
f26ad7c09bd63e92790bd03b7c44e54dcd3a09cbd426f1caf67e48ac45ca426a | def gsf(self, bin_width: Union[(float, int)]=0.2, Ex_min: Union[(float, int)]=5, Ex_max: Union[(float, int)]=50, multipole_type: str='M1', prefactor_E1: Union[(None, float)]=None, prefactor_M1: Union[(None, float)]=None, prefactor_E2: Union[(None, float)]=None, initial_or_final: str='initial', partial_or_total: str='pa... | Alias for gamma_strength_function_average_plot. See that
docstring for details. | kshell_utilities/kshell_utilities.py | gsf | GaffaSnobb/kshell_utilities | 0 | python | def gsf(self, bin_width: Union[(float, int)]=0.2, Ex_min: Union[(float, int)]=5, Ex_max: Union[(float, int)]=50, multipole_type: str='M1', prefactor_E1: Union[(None, float)]=None, prefactor_M1: Union[(None, float)]=None, prefactor_E2: Union[(None, float)]=None, initial_or_final: str='initial', partial_or_total: str='pa... | def gsf(self, bin_width: Union[(float, int)]=0.2, Ex_min: Union[(float, int)]=5, Ex_max: Union[(float, int)]=50, multipole_type: str='M1', prefactor_E1: Union[(None, float)]=None, prefactor_M1: Union[(None, float)]=None, prefactor_E2: Union[(None, float)]=None, initial_or_final: str='initial', partial_or_total: str='pa... |
15f526c6f74d3a959ddc70e521fef07c5843c6eac949053fc470ed2682e22d7a | @property
def help(self):
'\n Generate a list of instance attributes without magic and private\n methods.\n\n Returns\n -------\n help_list : list\n A list of non-magic instance attributes.\n '
help_list = []
for elem in dir(self):
if (not elem.st... | Generate a list of instance attributes without magic and private
methods.
Returns
-------
help_list : list
A list of non-magic instance attributes. | kshell_utilities/kshell_utilities.py | help | GaffaSnobb/kshell_utilities | 0 | python | @property
def help(self):
'\n Generate a list of instance attributes without magic and private\n methods.\n\n Returns\n -------\n help_list : list\n A list of non-magic instance attributes.\n '
help_list = []
for elem in dir(self):
if (not elem.st... | @property
def help(self):
'\n Generate a list of instance attributes without magic and private\n methods.\n\n Returns\n -------\n help_list : list\n A list of non-magic instance attributes.\n '
help_list = []
for elem in dir(self):
if (not elem.st... |
3b20d5932a57043daa215b87c230dcf8d19f57d35789ddd986c6bec62610c1e9 | @property
def parameters(self) -> dict:
'\n Get the KSHELL parameters from the shell file.\n\n Returns\n -------\n : dict\n A dictionary of KSHELL parameters.\n '
path = self.path
if os.path.isfile(path):
path = path.rsplit('/', 1)[0]
return get_para... | Get the KSHELL parameters from the shell file.
Returns
-------
: dict
A dictionary of KSHELL parameters. | kshell_utilities/kshell_utilities.py | parameters | GaffaSnobb/kshell_utilities | 0 | python | @property
def parameters(self) -> dict:
'\n Get the KSHELL parameters from the shell file.\n\n Returns\n -------\n : dict\n A dictionary of KSHELL parameters.\n '
path = self.path
if os.path.isfile(path):
path = path.rsplit('/', 1)[0]
return get_para... | @property
def parameters(self) -> dict:
'\n Get the KSHELL parameters from the shell file.\n\n Returns\n -------\n : dict\n A dictionary of KSHELL parameters.\n '
path = self.path
if os.path.isfile(path):
path = path.rsplit('/', 1)[0]
return get_para... |
113f5fea67db5980ba7bd031b3abd4d0698a4492dcf6f7d6067594f5b5e2e536 | def makeRegistry(doc, configBaseType=Config):
'A convenience function to create a new registry.\n\n The returned value is an instance of a trivial subclass of Registry whose only purpose is to\n customize its doc string and set attrList.\n '
cls = type('Registry', (Registry,), {'__doc__': doc})
ret... | A convenience function to create a new registry.
The returned value is an instance of a trivial subclass of Registry whose only purpose is to
customize its doc string and set attrList. | gempy/library/config/registry.py | makeRegistry | astrochun/DRAGONS | 19 | python | def makeRegistry(doc, configBaseType=Config):
'A convenience function to create a new registry.\n\n The returned value is an instance of a trivial subclass of Registry whose only purpose is to\n customize its doc string and set attrList.\n '
cls = type('Registry', (Registry,), {'__doc__': doc})
ret... | def makeRegistry(doc, configBaseType=Config):
'A convenience function to create a new registry.\n\n The returned value is an instance of a trivial subclass of Registry whose only purpose is to\n customize its doc string and set attrList.\n '
cls = type('Registry', (Registry,), {'__doc__': doc})
ret... |
16ebbbd6b8d4546592feaa9dd5463f0a47bb03fed7f01dd178ef047e92c4c111 | def registerConfigurable(name, registry, ConfigClass=None):
"A decorator that adds a class as a configurable in a Registry.\n\n If the 'ConfigClass' argument is None, the class's ConfigClass attribute will be used.\n "
def decorate(cls):
registry.register(name, target=cls, ConfigClass=ConfigClass... | A decorator that adds a class as a configurable in a Registry.
If the 'ConfigClass' argument is None, the class's ConfigClass attribute will be used. | gempy/library/config/registry.py | registerConfigurable | astrochun/DRAGONS | 19 | python | def registerConfigurable(name, registry, ConfigClass=None):
"A decorator that adds a class as a configurable in a Registry.\n\n If the 'ConfigClass' argument is None, the class's ConfigClass attribute will be used.\n "
def decorate(cls):
registry.register(name, target=cls, ConfigClass=ConfigClass... | def registerConfigurable(name, registry, ConfigClass=None):
"A decorator that adds a class as a configurable in a Registry.\n\n If the 'ConfigClass' argument is None, the class's ConfigClass attribute will be used.\n "
def decorate(cls):
registry.register(name, target=cls, ConfigClass=ConfigClass... |
dc5cafc8c4f8666cafc26dcef4fe5a6e08983f845f1c8b3788fac44b79605580 | def registerConfig(name, registry, target):
'A decorator that adds a class as a ConfigClass in a Registry, and associates it with the given\n configurable.\n '
def decorate(cls):
registry.register(name, target=target, ConfigClass=cls)
return cls
return decorate | A decorator that adds a class as a ConfigClass in a Registry, and associates it with the given
configurable. | gempy/library/config/registry.py | registerConfig | astrochun/DRAGONS | 19 | python | def registerConfig(name, registry, target):
'A decorator that adds a class as a ConfigClass in a Registry, and associates it with the given\n configurable.\n '
def decorate(cls):
registry.register(name, target=target, ConfigClass=cls)
return cls
return decorate | def registerConfig(name, registry, target):
'A decorator that adds a class as a ConfigClass in a Registry, and associates it with the given\n configurable.\n '
def decorate(cls):
registry.register(name, target=target, ConfigClass=cls)
return cls
return decorate<|docstring|>A decorator... |
d04f2a2b18748e078a3a15f01704f1654fe6878a9c106b0046ce4220fed211c9 | def __init__(self, configBaseType=Config):
'Construct a registry of name: configurables\n\n @param configBaseType: base class for config classes in registry\n '
if (not issubclass(configBaseType, Config)):
raise TypeError(('configBaseType=%s must be a subclass of Config' % _typeStr(configB... | Construct a registry of name: configurables
@param configBaseType: base class for config classes in registry | gempy/library/config/registry.py | __init__ | astrochun/DRAGONS | 19 | python | def __init__(self, configBaseType=Config):
'Construct a registry of name: configurables\n\n @param configBaseType: base class for config classes in registry\n '
if (not issubclass(configBaseType, Config)):
raise TypeError(('configBaseType=%s must be a subclass of Config' % _typeStr(configB... | def __init__(self, configBaseType=Config):
'Construct a registry of name: configurables\n\n @param configBaseType: base class for config classes in registry\n '
if (not issubclass(configBaseType, Config)):
raise TypeError(('configBaseType=%s must be a subclass of Config' % _typeStr(configB... |
ac0b2256fcd3da8fa2b5290a896184d8b074ea1c6a86da6f87efafbb73f40331 | def register(self, name, target, ConfigClass=None):
"Add a new item to the registry.\n\n @param target A callable 'object that takes a Config instance as its first argument.\n This may be a Python type, but is not required to be.\n @param ConfigClass A subclass of pex... | Add a new item to the registry.
@param target A callable 'object that takes a Config instance as its first argument.
This may be a Python type, but is not required to be.
@param ConfigClass A subclass of pex_config Config used to configure the configurable;
if None then c... | gempy/library/config/registry.py | register | astrochun/DRAGONS | 19 | python | def register(self, name, target, ConfigClass=None):
"Add a new item to the registry.\n\n @param target A callable 'object that takes a Config instance as its first argument.\n This may be a Python type, but is not required to be.\n @param ConfigClass A subclass of pex... | def register(self, name, target, ConfigClass=None):
"Add a new item to the registry.\n\n @param target A callable 'object that takes a Config instance as its first argument.\n This may be a Python type, but is not required to be.\n @param ConfigClass A subclass of pex... |
9d0b83e99dca24153a05dede7d60960d49eea79cc07420966b97f7540882394d | def apply(self, *args, **kw):
'Call the active target(s) with the active config as a keyword arg\n\n If this is a multi-selection field, return a list obtained by calling\n each active target with its corresponding active config.\n\n Additional arguments will be passed on to the configurable ta... | Call the active target(s) with the active config as a keyword arg
If this is a multi-selection field, return a list obtained by calling
each active target with its corresponding active config.
Additional arguments will be passed on to the configurable target(s) | gempy/library/config/registry.py | apply | astrochun/DRAGONS | 19 | python | def apply(self, *args, **kw):
'Call the active target(s) with the active config as a keyword arg\n\n If this is a multi-selection field, return a list obtained by calling\n each active target with its corresponding active config.\n\n Additional arguments will be passed on to the configurable ta... | def apply(self, *args, **kw):
'Call the active target(s) with the active config as a keyword arg\n\n If this is a multi-selection field, return a list obtained by calling\n each active target with its corresponding active config.\n\n Additional arguments will be passed on to the configurable ta... |
7bb945ffe54deef31be000f4ff76c0ce8b199a77b8be281301527458e289bac3 | def __deepcopy__(self, memo):
'Customize deep-copying, want a reference to the original registry.\n WARNING: this must be overridden by subclasses if they change the\n constructor signature!\n '
other = type(self)(doc=self.doc, registry=self.registry, default=copy.deepcopy(self.default)... | Customize deep-copying, want a reference to the original registry.
WARNING: this must be overridden by subclasses if they change the
constructor signature! | gempy/library/config/registry.py | __deepcopy__ | astrochun/DRAGONS | 19 | python | def __deepcopy__(self, memo):
'Customize deep-copying, want a reference to the original registry.\n WARNING: this must be overridden by subclasses if they change the\n constructor signature!\n '
other = type(self)(doc=self.doc, registry=self.registry, default=copy.deepcopy(self.default)... | def __deepcopy__(self, memo):
'Customize deep-copying, want a reference to the original registry.\n WARNING: this must be overridden by subclasses if they change the\n constructor signature!\n '
other = type(self)(doc=self.doc, registry=self.registry, default=copy.deepcopy(self.default)... |
805670c7152eff4df5111d07caa3052e25d2b82a325548f22f64aaa625b875fa | def condense_coords(matches):
'restructure point match dictionary structure to Nx2 array\n\n Parameters\n ----------\n matches : list of dict\n list of match dictionaries in Render format\n\n Returns\n -------\n coords : numpy.ndarray\n Nx2 array representing matches\n '
x = [... | restructure point match dictionary structure to Nx2 array
Parameters
----------
matches : list of dict
list of match dictionaries in Render format
Returns
-------
coords : numpy.ndarray
Nx2 array representing matches | em_stitch/lens_correction/mesh_and_solve_transform.py | condense_coords | AllenInstitute/em_stitch | 2 | python | def condense_coords(matches):
'restructure point match dictionary structure to Nx2 array\n\n Parameters\n ----------\n matches : list of dict\n list of match dictionaries in Render format\n\n Returns\n -------\n coords : numpy.ndarray\n Nx2 array representing matches\n '
x = [... | def condense_coords(matches):
'restructure point match dictionary structure to Nx2 array\n\n Parameters\n ----------\n matches : list of dict\n list of match dictionaries in Render format\n\n Returns\n -------\n coords : numpy.ndarray\n Nx2 array representing matches\n '
x = [... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.